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

     Python 3.14.6, 6月 28, 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.6, 6月 28, 2026

     Author name not set

     Copyright © 2001 Python Software Foundation

* Menu:

* What's New in Python::
* Python チュートリアル::
* Python のセットアップと利用::
* Python 言語リファレンス::
* Python 標準ライブラリ::
* Python インタプリタの拡張と埋め込み::
* Python/C API reference manual::
* 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.
* Notable changes in 3.14.5: Notable changes in 3 14 5.

新しい機能

* PEP 649 と PEP 749; アノテーションの遅延評価: PEP 649 と PEP 749 アノテーションの遅延評価.
* PEP 734; 複数インタープリタ機能が標準ライブラリに追加: PEP 734 複数インタープリタ機能が標準ライブラリに追加.
* PEP 750; テンプレート文字列リテラル: PEP 750 テンプレート文字列リテラル.
* PEP 768; 安全な外部デバッガインターフェース: PEP 768 安全な外部デバッガインターフェース.
* 新しいインタープリタ::
* 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.
* 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::

Notable changes in 3.14.5

* gc: gc<2>.

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<3>.
* 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<4>.
* 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<5>.
* 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<6>.
* 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<7>.
* 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<8>.
* 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.6 final: Python 3 14 6 final.
* Python 3.14.5 final: Python 3 14 5 final.
* Python 3.14.5 release candidate 1: Python 3 14 5 release candidate 1.
* Python 3.14.4 final: Python 3 14 4 final.
* 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

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

Python 3.14.6 final

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

Python 3.14.5 final

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

Python 3.14.5 release candidate 1

* セキュリティ: セキュリティ<4>.
* Core and Builtins: Core and Builtins<4>.
* ライブラリ: ライブラリ<4>.
* ドキュメント: ドキュメント<4>.
* ビルド: ビルド<3>.
* Windows: Windows<2>.
* macOS: macOS<3>.

Python 3.14.4 final

* セキュリティ: セキュリティ<5>.
* Core and Builtins: Core and Builtins<5>.
* ライブラリ: ライブラリ<5>.
* ドキュメント: ドキュメント<5>.
* テスト: テスト<4>.
* ビルド: ビルド<4>.
* Windows: Windows<3>.
* macOS: macOS<4>.
* C API: C API<3>.

Python 3.14.3 final

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

Python 3.14.2 final

* セキュリティ: セキュリティ<7>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<7>.
* ライブラリ: ライブラリ<8>.

Python 3.14.1 final

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

Python 3.14.0 final

* macOS: macOS<5>.
* Windows: Windows<6>.
* Tools/Demos: Tools/Demos<3>.
* セキュリティ: セキュリティ<9>.
* ライブラリ: ライブラリ<16>.

Python 3.14.0 release candidate 3

* Windows: Windows<7>.
* Tools/Demos: Tools/Demos<4>.
* セキュリティ: セキュリティ<10>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<15>.

Python 3.14.0 release candidate 2

* macOS: macOS<6>.
* Windows: Windows<8>.
* ライブラリ: ライブラリ<18>.
* ドキュメント: ドキュメント<8>.
* Core and Builtins: Core and Builtins<16>.
* C API: C API<6>.
* ビルド: ビルド<7>.

Python 3.14.0 release candidate 1

* Tools/Demos: Tools/Demos<5>.
* セキュリティ: セキュリティ<11>.
* ライブラリ: ライブラリ<19>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<19>.
* C API: C API<7>.
* ビルド: ビルド<8>.

Python 3.14.0 beta 4

* Tools/Demos: Tools/Demos<6>.
* テスト: テスト<7>.
* セキュリティ: セキュリティ<12>.
* ライブラリ: ライブラリ<22>.
* ドキュメント: ドキュメント<9>.
* Core and Builtins: Core and Builtins<20>.
* C API: C API<8>.
* ビルド: ビルド<9>.

Python 3.14.0 beta 3

* Windows: Windows<9>.
* テスト: テスト<8>.
* セキュリティ: セキュリティ<13>.
* ライブラリ: ライブラリ<23>.
* ドキュメント: ドキュメント<10>.
* Core and Builtins: Core and Builtins<21>.
* ライブラリ: ライブラリ<24>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<24>.
* C API: C API<9>.
* ビルド: ビルド<10>.

Python 3.14.0 beta 2

* Windows: Windows<10>.
* Tools/Demos: Tools/Demos<7>.
* テスト: テスト<9>.
* セキュリティ: セキュリティ<14>.
* ライブラリ: ライブラリ<27>.
* Core and Builtins: Core and Builtins<25>.
* C API: C API<10>.
* ビルド: ビルド<11>.

Python 3.14.0 beta 1

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

Python 3.14.0 alpha 7

* macOS: macOS<7>.
* Windows: Windows<12>.
* Tools/Demos: Tools/Demos<9>.
* テスト: テスト<11>.
* セキュリティ: セキュリティ<16>.
* ライブラリ: ライブラリ<32>.
* ドキュメント: ドキュメント<12>.
* Core and Builtins: Core and Builtins<29>.
* ライブラリ: ライブラリ<33>.
* Core and Builtins: Core and Builtins<30>.
* C API: C API<12>.
* ビルド: ビルド<13>.

Python 3.14.0 alpha 6

* macOS: macOS<8>.
* Windows: Windows<13>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<12>.
* セキュリティ: セキュリティ<17>.
* ライブラリ: ライブラリ<34>.
* ドキュメント: ドキュメント<13>.
* Core and Builtins: Core and Builtins<31>.
* ライブラリ: ライブラリ<35>.
* Core and Builtins: Core and Builtins<32>.
* ライブラリ: ライブラリ<36>.
* Core and Builtins: Core and Builtins<33>.
* C API: C API<13>.
* ビルド: ビルド<14>.

Python 3.14.0 alpha 5

* macOS: macOS<9>.
* Tools/Demos: Tools/Demos<11>.
* テスト: テスト<13>.
* セキュリティ: セキュリティ<18>.
* ライブラリ: ライブラリ<37>.
* IDLE: IDLE<7>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<34>.
* ライブラリ: ライブラリ<38>.
* Core and Builtins: Core and Builtins<35>.
* ライブラリ: ライブラリ<39>.
* Core and Builtins: Core and Builtins<36>.
* ライブラリ: ライブラリ<40>.
* C API: C API<14>.
* ビルド: ビルド<15>.

Python 3.14.0 alpha 4

* macOS: macOS<10>.
* Tools/Demos: Tools/Demos<12>.
* テスト: テスト<14>.
* ライブラリ: ライブラリ<41>.
* Core and Builtins: Core and Builtins<37>.
* ライブラリ: ライブラリ<42>.
* Core and Builtins: Core and Builtins<38>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<39>.
* C API: C API<15>.
* ビルド: ビルド<16>.

Python 3.14.0 alpha 3

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

Python 3.14.0 alpha 2

* Windows: Windows<15>.
* Tools/Demos: Tools/Demos<14>.
* テスト: テスト<16>.
* セキュリティ: セキュリティ<20>.
* ライブラリ: ライブラリ<46>.
* ドキュメント: ドキュメント<16>.
* Core and Builtins: Core and Builtins<42>.
* ライブラリ: ライブラリ<47>.
* Core and Builtins: Core and Builtins<43>.
* ライブラリ: ライブラリ<48>.
* Core and Builtins: Core and Builtins<44>.
* ライブラリ: ライブラリ<49>.
* C API: C API<17>.
* ビルド: ビルド<18>.

Python 3.14.0 alpha 1

* macOS: macOS<11>.
* Windows: Windows<16>.
* Tools/Demos: Tools/Demos<15>.
* テスト: テスト<17>.
* セキュリティ: セキュリティ<21>.
* ライブラリ: ライブラリ<50>.
* IDLE: IDLE<8>.
* ドキュメント: ドキュメント<17>.
* 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>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<55>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<57>.
* Core and Builtins: Core and Builtins<52>.
* C API: C API<18>.
* ビルド: ビルド<19>.

Python 3.13.0 beta 1

* セキュリティ: セキュリティ<22>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<59>.
* ドキュメント: ドキュメント<18>.
* ビルド: ビルド<20>.
* Windows: Windows<17>.
* macOS: macOS<12>.
* IDLE: IDLE<9>.
* C API: C API<19>.

Python 3.13.0 alpha 6

* Core and Builtins: Core and Builtins<55>.
* ライブラリ: ライブラリ<60>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<61>.
* ドキュメント: ドキュメント<19>.
* テスト: テスト<18>.
* ビルド: ビルド<21>.
* Windows: Windows<18>.
* C API: C API<20>.

Python 3.13.0 alpha 5

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

Python 3.13.0 alpha 4

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

Python 3.13.0 alpha 3

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<66>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<21>.
* ビルド: ビルド<24>.
* Windows: Windows<21>.
* macOS: macOS<15>.
* IDLE: IDLE<12>.
* C API: C API<23>.

Python 3.13.0 alpha 2

* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<67>.
* テスト: テスト<22>.
* ビルド: ビルド<25>.
* Windows: Windows<22>.
* macOS: macOS<16>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<24>.

Python 3.13.0 alpha 1

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<63>.
* ライブラリ: ライブラリ<68>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<23>.
* ビルド: ビルド<26>.
* Windows: Windows<23>.
* macOS: macOS<17>.
* IDLE: IDLE<14>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<25>.

Python 3.12.0 beta 1

* セキュリティ: セキュリティ<27>.
* ライブラリ: ライブラリ<69>.
* Core and Builtins: Core and Builtins<64>.
* ライブラリ: ライブラリ<70>.
* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<71>.
* ドキュメント: ドキュメント<24>.
* テスト: テスト<24>.
* ビルド: ビルド<27>.
* Windows: Windows<24>.
* macOS: macOS<18>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<26>.

Python 3.12.0 alpha 7

* Core and Builtins: Core and Builtins<66>.
* ライブラリ: ライブラリ<72>.
* Core and Builtins: Core and Builtins<67>.
* ビルド: ビルド<28>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<73>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<25>.
* ビルド: ビルド<29>.
* Windows: Windows<25>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<27>.

Python 3.12.0 alpha 6

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

Python 3.12.0 alpha 5

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<70>.
* ライブラリ: ライブラリ<75>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<27>.
* ビルド: ビルド<31>.
* Windows: Windows<27>.

Python 3.12.0 alpha 4

* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<76>.
* Core and Builtins: Core and Builtins<72>.
* ライブラリ: ライブラリ<77>.
* Core and Builtins: Core and Builtins<73>.
* ライブラリ: ライブラリ<78>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<28>.
* ビルド: ビルド<32>.
* Windows: Windows<28>.
* macOS: macOS<20>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<29>.

Python 3.12.0 alpha 3

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<79>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<80>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<29>.
* ビルド: ビルド<33>.
* Windows: Windows<29>.
* macOS: macOS<21>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<30>.

Python 3.12.0 alpha 2

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<76>.
* ビルド: ビルド<34>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<81>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<30>.
* ビルド: ビルド<35>.
* Windows: Windows<30>.
* macOS: macOS<22>.
* C API: C API<31>.

Python 3.12.0 alpha 1

* セキュリティ: セキュリティ<32>.
* 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>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<85>.
* ライブラリ: ライブラリ<89>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<91>.
* ドキュメント: ドキュメント<31>.
* テスト: テスト<31>.
* ビルド: ビルド<36>.
* Windows: Windows<31>.
* macOS: macOS<23>.
* IDLE: IDLE<16>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<32>.

Python 3.11.0 beta 1

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<92>.
* Core and Builtins: Core and Builtins<89>.
* ビルド: ビルド<37>.
* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<93>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<32>.
* ビルド: ビルド<38>.
* Windows: Windows<32>.
* macOS: macOS<24>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<33>.

Python 3.11.0 alpha 7

* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<94>.
* Core and Builtins: Core and Builtins<92>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<96>.
* ドキュメント: ドキュメント<33>.
* テスト: テスト<33>.
* ビルド: ビルド<39>.
* Windows: Windows<33>.
* macOS: macOS<25>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<34>.

Python 3.11.0 alpha 6

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<97>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<98>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<99>.
* Core and Builtins: Core and Builtins<97>.
* ライブラリ: ライブラリ<100>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<34>.
* ビルド: ビルド<40>.
* Windows: Windows<34>.
* IDLE: IDLE<17>.
* C API: C API<35>.

Python 3.11.0 alpha 5

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

Python 3.11.0 alpha 4

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<104>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<105>.
* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<106>.
* Core and Builtins: Core and Builtins<104>.
* ライブラリ: ライブラリ<107>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<36>.
* ビルド: ビルド<43>.
* Windows: Windows<36>.
* macOS: macOS<27>.
* C API: C API<37>.

Python 3.11.0 alpha 3

* Core and Builtins: Core and Builtins<105>.
* ライブラリ: ライブラリ<108>.
* Core and Builtins: Core and Builtins<106>.
* ライブラリ: ライブラリ<109>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<37>.
* ビルド: ビルド<44>.
* Windows: Windows<37>.
* macOS: macOS<28>.
* C API: C API<38>.

Python 3.11.0 alpha 2

* Core and Builtins: Core and Builtins<107>.
* ライブラリ: ライブラリ<110>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<38>.
* ビルド: ビルド<45>.
* Windows: Windows<38>.
* macOS: macOS<29>.
* IDLE: IDLE<19>.
* C API: C API<39>.

Python 3.11.0 alpha 1

* セキュリティ: セキュリティ<34>.
* 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>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<119>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<120>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<39>.
* ビルド: ビルド<46>.
* Windows: Windows<39>.
* macOS: macOS<30>.
* IDLE: IDLE<20>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<40>.

Python 3.10.0 beta 1

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<121>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<123>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<40>.
* ビルド: ビルド<47>.
* Windows: Windows<40>.
* macOS: macOS<31>.
* IDLE: IDLE<21>.
* C API: C API<41>.

Python 3.10.0 alpha 7

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<124>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<125>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<41>.
* ビルド: ビルド<48>.
* Windows: Windows<41>.
* IDLE: IDLE<22>.
* C API: C API<42>.

Python 3.10.0 alpha 6

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<126>.
* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<128>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<42>.
* ビルド: ビルド<49>.
* Windows: Windows<42>.
* macOS: macOS<32>.
* IDLE: IDLE<23>.
* C API: C API<43>.

Python 3.10.0 alpha 5

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<129>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<130>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<43>.
* ビルド: ビルド<50>.
* Windows: Windows<43>.
* macOS: macOS<33>.
* IDLE: IDLE<24>.
* C API: C API<44>.

Python 3.10.0 alpha 4

* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<131>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<133>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<44>.
* ビルド: ビルド<51>.
* macOS: macOS<34>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<45>.

Python 3.10.0 alpha 3

* セキュリティ: セキュリティ<39>.
* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<134>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<135>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<137>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<45>.
* ビルド: ビルド<52>.
* Windows: Windows<44>.
* macOS: macOS<35>.
* IDLE: IDLE<25>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<46>.

Python 3.10.0 alpha 2

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<138>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<139>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<46>.
* ビルド: ビルド<53>.
* Windows: Windows<45>.
* macOS: macOS<36>.
* IDLE: IDLE<26>.
* C API: C API<47>.

Python 3.10.0 alpha 1

* セキュリティ: セキュリティ<41>.
* 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>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<151>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<152>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<153>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<154>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<47>.
* ビルド: ビルド<54>.
* Windows: Windows<46>.
* macOS: macOS<37>.
* IDLE: IDLE<27>.
* C API: C API<48>.

Python 3.9.0 beta 1

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<48>.
* テスト: テスト<48>.
* ビルド: ビルド<55>.
* Windows: Windows<47>.
* macOS: macOS<38>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<49>.

Python 3.9.0 alpha 6

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

Python 3.9.0 alpha 5

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

Python 3.9.0 alpha 4

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<51>.
* ビルド: ビルド<58>.
* Windows: Windows<50>.
* IDLE: IDLE<30>.
* C API: C API<52>.

Python 3.9.0 alpha 3

* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<159>.
* ドキュメント: ドキュメント<52>.
* ビルド: ビルド<59>.
* IDLE: IDLE<31>.
* C API: C API<53>.

Python 3.9.0 alpha 2

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<160>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<52>.
* ビルド: ビルド<60>.
* Windows: Windows<51>.
* macOS: macOS<41>.
* IDLE: IDLE<32>.
* C API: C API<54>.

Python 3.9.0 alpha 1

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<158>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<53>.
* ビルド: ビルド<61>.
* Windows: Windows<52>.
* macOS: macOS<42>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<55>.

Python 3.8.0 beta 1

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

Python 3.8.0 alpha 4

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<163>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<55>.
* ビルド: ビルド<63>.
* Windows: Windows<54>.
* macOS: macOS<44>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<57>.

Python 3.8.0 alpha 3

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<57>.
* テスト: テスト<56>.
* ビルド: ビルド<64>.
* Windows: Windows<55>.
* IDLE: IDLE<36>.
* Tools/Demos: Tools/Demos<36>.
* C API: C API<58>.

Python 3.8.0 alpha 2

* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<57>.
* Windows: Windows<56>.
* IDLE: IDLE<37>.

Python 3.8.0 alpha 1

* セキュリティ: セキュリティ<51>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<166>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<58>.
* ビルド: ビルド<65>.
* Windows: Windows<57>.
* macOS: macOS<45>.
* IDLE: IDLE<38>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<59>.

Python 3.7.0 final

* ライブラリ: ライブラリ<167>.
* C API: C API<60>.

Python 3.7.0 release candidate 1

* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<168>.
* ドキュメント: ドキュメント<60>.
* ビルド: ビルド<66>.
* Windows: Windows<58>.
* IDLE: IDLE<39>.

Python 3.7.0 beta 5

* Core and Builtins: Core and Builtins<165>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<59>.
* ビルド: ビルド<67>.
* macOS: macOS<46>.
* IDLE: IDLE<40>.

Python 3.7.0 beta 4

* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<60>.
* ビルド: ビルド<68>.
* Windows: Windows<59>.
* macOS: macOS<47>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<38>.

Python 3.7.0 beta 3

* セキュリティ: セキュリティ<52>.
* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<61>.
* ビルド: ビルド<69>.
* Windows: Windows<60>.
* macOS: macOS<48>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<61>.

Python 3.7.0 beta 2

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<62>.
* ビルド: ビルド<70>.
* Windows: Windows<61>.
* macOS: macOS<49>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<40>.

Python 3.7.0 beta 1

* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<65>.
* テスト: テスト<63>.
* ビルド: ビルド<71>.
* Windows: Windows<62>.
* macOS: macOS<50>.
* C API: C API<62>.

Python 3.7.0 alpha 4

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

Python 3.7.0 alpha 3

* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<65>.
* ビルド: ビルド<72>.
* Windows: Windows<64>.
* macOS: macOS<51>.
* IDLE: IDLE<44>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<64>.

Python 3.7.0 alpha 2

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<68>.
* ビルド: ビルド<73>.
* IDLE: IDLE<45>.
* C API: C API<65>.

Python 3.7.0 alpha 1

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<177>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<66>.
* ビルド: ビルド<74>.
* Windows: Windows<65>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<66>.

Python 3.6.6 release candidate 1

* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<67>.
* ビルド: ビルド<75>.
* Windows: Windows<66>.
* macOS: macOS<52>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<67>.

Python 3.6.5 final

* テスト: テスト<68>.
* ビルド: ビルド<76>.

Python 3.6.5 release candidate 1

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

Python 3.6.4 release candidate 1

* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<180>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<70>.
* ビルド: ビルド<78>.
* Windows: Windows<68>.
* macOS: macOS<54>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<46>.
* C API: C API<69>.

Python 3.6.3 final

* ライブラリ: ライブラリ<181>.
* ビルド: ビルド<79>.

Python 3.6.3 release candidate 1

* セキュリティ: セキュリティ<56>.
* Core and Builtins: Core and Builtins<177>.
* ライブラリ: ライブラリ<182>.
* ドキュメント: ドキュメント<73>.
* テスト: テスト<71>.
* ビルド: ビルド<80>.
* Windows: Windows<69>.
* IDLE: IDLE<50>.
* Tools/Demos: Tools/Demos<47>.

Python 3.6.2 release candidate 2

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

Python 3.6.2 release candidate 1

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<183>.
* IDLE: IDLE<51>.
* C API: C API<70>.
* ビルド: ビルド<81>.
* ドキュメント: ドキュメント<74>.
* Tools/Demos: Tools/Demos<48>.
* テスト: テスト<72>.
* Windows: Windows<70>.

Python 3.6.1 final

* Core and Builtins: Core and Builtins<179>.
* ビルド: ビルド<82>.

Python 3.6.1 release candidate 1

* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<184>.
* IDLE: IDLE<52>.
* Windows: Windows<71>.
* C API: C API<71>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<73>.
* ビルド: ビルド<83>.

Python 3.6.0 release candidate 2

* Core and Builtins: Core and Builtins<181>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<72>.
* ビルド: ビルド<84>.

Python 3.6.0 release candidate 1

* Core and Builtins: Core and Builtins<182>.
* ライブラリ: ライブラリ<185>.
* C API: C API<72>.
* ドキュメント: ドキュメント<76>.
* Tools/Demos: Tools/Demos<50>.

Python 3.6.0 beta 4

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<186>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<74>.
* ビルド: ビルド<85>.

Python 3.6.0 beta 3

* Core and Builtins: Core and Builtins<184>.
* ライブラリ: ライブラリ<187>.
* Windows: Windows<73>.
* ビルド: ビルド<86>.
* テスト: テスト<75>.

Python 3.6.0 beta 2

* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<188>.
* Windows: Windows<74>.
* C API: C API<73>.
* ビルド: ビルド<87>.
* テスト: テスト<76>.

Python 3.6.0 beta 1

* Core and Builtins: Core and Builtins<186>.
* ライブラリ: ライブラリ<189>.
* IDLE: IDLE<53>.
* C API: C API<74>.
* テスト: テスト<77>.
* ビルド: ビルド<88>.
* Tools/Demos: Tools/Demos<51>.
* Windows: Windows<75>.

Python 3.6.0 alpha 4

* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<190>.
* IDLE: IDLE<54>.
* テスト: テスト<78>.
* Windows: Windows<76>.
* ビルド: ビルド<89>.

Python 3.6.0 alpha 3

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<191>.
* IDLE: IDLE<55>.
* C API: C API<75>.
* ビルド: ビルド<90>.
* Tools/Demos: Tools/Demos<52>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<79>.

Python 3.6.0 alpha 2

* セキュリティ: セキュリティ<60>.
* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<192>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<80>.
* Windows: Windows<77>.
* ビルド: ビルド<91>.
* C API: C API<76>.
* Tools/Demos: Tools/Demos<53>.

Python 3.6.0 alpha 1

* セキュリティ: セキュリティ<61>.
* Core and Builtins: Core and Builtins<190>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<57>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<81>.
* ビルド: ビルド<92>.
* Windows: Windows<78>.
* Tools/Demos: Tools/Demos<54>.
* C API: C API<77>.

Python 3.5.5 release candidate 1

* セキュリティ: セキュリティ<62>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<194>.

Python 3.5.4 final

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

Python 3.5.4 release candidate 1

* セキュリティ: セキュリティ<63>.
* Core and Builtins: Core and Builtins<192>.
* ライブラリ: ライブラリ<196>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<82>.
* ビルド: ビルド<93>.
* Windows: Windows<79>.
* C API: C API<78>.

Python 3.5.3 release candidate 1

* セキュリティ: セキュリティ<64>.
* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<197>.
* IDLE: IDLE<58>.
* C API: C API<79>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<83>.
* Tools/Demos: Tools/Demos<55>.
* Windows: Windows<80>.
* ビルド: ビルド<94>.

Python 3.5.2 final

* Core and Builtins: Core and Builtins<194>.
* テスト: テスト<84>.
* IDLE: IDLE<59>.

Python 3.5.2 release candidate 1

* セキュリティ: セキュリティ<65>.
* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<198>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<83>.
* テスト: テスト<85>.
* ビルド: ビルド<95>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<56>.

Python 3.5.1 final

* Core and Builtins: Core and Builtins<196>.
* Windows: Windows<82>.

Python 3.5.1 release candidate 1

* Core and Builtins: Core and Builtins<197>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<84>.
* テスト: テスト<86>.
* ビルド: ビルド<96>.
* Windows: Windows<83>.
* Tools/Demos: Tools/Demos<57>.

Python 3.5.0 final

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

Python 3.5.0 release candidate 4

* ライブラリ: ライブラリ<200>.
* ビルド: ビルド<98>.

Python 3.5.0 release candidate 3

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

Python 3.5.0 release candidate 2

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

Python 3.5.0 release candidate 1

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

Python 3.5.0 beta 4

* Core and Builtins: Core and Builtins<201>.
* ライブラリ: ライブラリ<204>.
* ビルド: ビルド<99>.

Python 3.5.0 beta 3

* Core and Builtins: Core and Builtins<202>.
* ライブラリ: ライブラリ<205>.
* テスト: テスト<88>.
* ドキュメント: ドキュメント<86>.
* ビルド: ビルド<100>.

Python 3.5.0 beta 2

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<206>.

Python 3.5.0 beta 1

* Core and Builtins: Core and Builtins<204>.
* ライブラリ: ライブラリ<207>.
* IDLE: IDLE<63>.
* テスト: テスト<89>.
* ドキュメント: ドキュメント<87>.
* Tools/Demos: Tools/Demos<58>.

Python 3.5.0 alpha 4

* Core and Builtins: Core and Builtins<205>.
* ライブラリ: ライブラリ<208>.
* ビルド: ビルド<101>.
* テスト: テスト<90>.
* Tools/Demos: Tools/Demos<59>.
* C API: C API<80>.

Python 3.5.0 alpha 3

* Core and Builtins: Core and Builtins<206>.
* ライブラリ: ライブラリ<209>.
* ビルド: ビルド<102>.
* テスト: テスト<91>.
* Tools/Demos: Tools/Demos<60>.

Python 3.5.0 alpha 2

* Core and Builtins: Core and Builtins<207>.
* ライブラリ: ライブラリ<210>.
* ビルド: ビルド<103>.
* C API: C API<81>.
* Windows: Windows<84>.

Python 3.5.0 alpha 1

* Core and Builtins: Core and Builtins<208>.
* ライブラリ: ライブラリ<211>.
* IDLE: IDLE<64>.
* ビルド: ビルド<104>.
* C API: C API<82>.
* ドキュメント: ドキュメント<88>.
* テスト: テスト<92>.
* Tools/Demos: Tools/Demos<61>.
* Windows: Windows<85>.

Python チュートリアル

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

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 のスコープと名前空間

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

クラス初見

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

継承

* 多重継承::

Brief tour of the standard library

* Operating system interface::
* File wildcards::
* Command-line arguments::
* Error output redirection and program termination::
* String pattern matching::
* 数学::
* Internet access::
* Dates and times::
* Data compression::
* Performance measurement::
* Quality control::
* Batteries included::

Brief tour of the standard library -- part II

* Output formatting::
* 文字列テンプレート::
* Working with binary data record layouts::
* マルチスレッディング: マルチスレッディング<2>.
* ログ記録::
* Weak references::
* Tools for working with lists::
* Decimal floating-point arithmetic::

仮想環境とパッケージ

* はじめに: はじめに<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::
* Index signatures::
* 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 forms::
* Displays for lists, sets and dictionaries: Displays for lists sets and dictionaries.
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<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>.
* 組み込み関数::
* 組み込み定数::
* 組み込み型::
* 組み込み例外::
* Thread Safety Guarantees::
* テキスト処理サービス::
* バイナリデータ処理::
* データ型::
* 数値と数学モジュール::
* 関数型プログラミング用モジュール::
* ファイルとディレクトリへのアクセス::
* データの永続化::
* データ圧縮とアーカイブ::
* ファイルフォーマット::
* 暗号関連のサービス::
* 汎用オペレーティングシステムサービス::
* コマンドラインインターフェースライブラリ::
* 並行実行::
* ネットワーク通信とプロセス間通信::
* インターネット上のデータの操作::
* 構造化マークアップツール::
* インターネットプロトコルとサポート::
* マルチメディアサービス::
* 国際化::
* Graphical user interfaces with Tk::
* 開発ツール::
* Debugging and Profiling::
* ソフトウェア・パッケージと配布::
* Python ランタイムサービス::
* カスタム Python インタプリタ::
* モジュールのインポート::
* Python言語サービス::
* MS Windows 固有のサービス::
* Unix-specific services::
* モジュールのコマンドラインインターフェース (CLI): モジュールのコマンドラインインターフェース CLI.
* Superseded Modules::
* 削除されたモジュール::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<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
* Mapping Types: Mapping Types --- 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 の書式化::
* メモリビュー::

Mapping Types -- dict

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

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

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

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

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

その他の組み込み型

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

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

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

組み込み例外

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

具象例外

* OS 例外::

Thread Safety Guarantees

* Thread safety levels::
* Thread safety for list objects::
* Thread safety for dict objects::
* Thread safety for set objects::
* Thread safety for bytearray objects::
* Thread safety for memoryview objects::

Thread safety levels

* Incompatible::
* Compatible::
* Safe on distinct objects::
* Safe on shared objects::
* Atomic::

テキスト処理サービス

* 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 -- 一般的な文字列操作

* 文字列定数::
* Custom string formatting::
* Format string syntax::
* Template strings ($-strings): Template strings $-strings.
* ヘルパー関数::

Format string syntax

* Format specification mini-language::
* 書式指定例::

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

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

re -- 正規表現操作

* Regular Expression Syntax::
* Module Contents::
* Regular Expression Objects::
* Match Objects::
* Regular Expression Examples::

Module Contents

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

Regular Expression Examples

* Checking for a Pair::
* scanf() をシミュレートする: scanf をシミュレートする.
* search() vs. match(): search vs match.
* Making a Phonebook::
* Text Munging::
* Finding all Adverbs::
* Finding all Adverbs and their Positions::
* Raw String Notation::
* Writing a Tokenizer::

difflib -- 差分の計算の補助

* SequenceMatcher objects::
* SequenceMatcher examples::
* Differ objects::
* Differ example::
* 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>.
* Utilities and decorators::
* 注釈::

データ型

* __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 ファイルの読み書き

* モジュールコンテンツ::
* 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 objects::
* 定数: 定数<6>.

curses.textpad -- Text input widget for curses programs

* Textbox オブジェクト::

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

* 関数: 関数<7>.
* Panel objects::

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::
* Coroutines and tasks::
* ストリーム::
* 同期プリミティブ: 同期プリミティブ<2>.
* サブプロセス::
* キュー::
* 例外: 例外<16>.
* Call Graph Introspection::
* Event loop::
* Future::
* トランスポートとプロトコル::
* ポリシー::
* プラットフォームでのサポート::
* Extending::
* 高水準の API インデックス::
* 低水準の API インデックス::
* asyncio での開発::
* asyncio and free-threaded Python::

Runners

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

Coroutines and tasks

* コルーチン: コルーチン<3>.
* Awaitable::
* Creating tasks::
* Task cancellation::
* Task groups::
* スリープ::
* Running tasks concurrently::
* Eager task factory::
* Shielding from cancellation::
* タイムアウト::
* Waiting primitives::
* Running in threads::
* Scheduling from other threads::
* イントロスペクション::
* Task object::

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::

Event loop

* Event loop methods::
* Callback handles::
* Server objects::
* Event loop implementations::
* 使用例: 使用例<25>.

Event loop methods

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

使用例

* 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<86>.
* macOS: macOS<55>.

Windows

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

Extending

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

高水準の API インデックス

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

低水準の API インデックス

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

asyncio での開発

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

Asynchronous generators best practices

* Close asynchronous generators explicitly::
* Create asynchronous generators only when the event loop is running::
* Avoid concurrent iteration and closure of the same generator::

asyncio and free-threaded Python

* Thread safety considerations::
* Using asyncio with threads::
* Producer/consumer across threads::

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

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

モジュールの内容

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

関数

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

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

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

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

* Functions, constants, and exceptions: Functions constants and exceptions.
* SSL sockets::
* SSL contexts::
* 証明書::
* 使用例: 使用例<28>.
* ノンブロッキングソケットについての注意事項::
* Memory BIO support::
* SSL セッション::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<3>.
* TLS 1.3: TLS 1 3.

Functions, constants, and exceptions

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

証明書

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

使用例

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

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

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

手動での設定

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

select -- I/O 完了の待機

* /dev/poll polling objects::
* Edge and level trigger polling (epoll) objects: Edge and level trigger polling epoll objects.
* Polling objects::
* Kqueue objects::
* Kevent objects::

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

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

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

* 一般的なルール::
* モジュールの内容: モジュールの内容<3>.
* 使用例: 使用例<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

* モジュールコンテンツ: モジュールコンテンツ<2>.
* 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オブジェクト::
* 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 objects::
* CGIXMLRPCRequestHandler::
* XMLRPC サーバの文書化::
* DocXMLRPCServer objects::
* DocCGIXMLRPCRequestHandler::

SimpleXMLRPCServer objects

* SimpleXMLRPCServer example::

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 dialogs::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- Scrolled text widget. Scrolled text widget
* 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 modules::
* Tkinter life preserver::
* Threading model::
* Handy reference::
* リファレンス: リファレンス<8>.

Tkinter life preserver

* 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::

Handy reference

* Setting options::
* The packer::
* Packer options::
* Coupling widget variables::
* The window manager::
* Tk option data types::
* Bindings and events::
* The index parameter::
* 画像::

リファレンス

* Base and mixin classes::
* Toplevel widgets::
* Widget classes::
* Variable classes::
* Image classes::
* Other classes::
* Module-level functions::
* File handlers::
* 定数: 定数<10>.

Tkinter dialogs

* 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.dialog: tkinter dialog --- Classic Tk dialog boxes. Classic Tk dialog boxes

tkinter.filedialog -- File selection dialogs

* Native load/save dialogs::

tkinter.ttk -- Tk のテーマ付きウィジェット

* Ttk を使う::
* Ttk widgets::
* ウィジェット::
* コンボボックス::
* Spinbox::
* ノートブック::
* プログレスバー::
* セパレータ::
* サイズグリップ::
* ツリービュー::
* Ttk styling::
* Additional widgets::

ウィジェット

* Standard options::
* Scrollable widget options::
* Label options::
* Compatibility options::
* Widget states::
* ttk.Widget: ttk Widget.

コンボボックス

* オプション::
* 仮想イベント::
* ttk.Combobox: ttk Combobox.

Spinbox

* オプション: オプション<2>.
* 仮想イベント: 仮想イベント<2>.
* ttk.Spinbox: ttk Spinbox.

ノートブック

* オプション: オプション<3>.
* Tab options::
* Tab identifiers::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.

プログレスバー

* オプション: オプション<4>.
* ttk.Progressbar: ttk Progressbar.

セパレータ

* オプション: オプション<5>.

サイズグリップ

* プラットフォーム固有のメモ::
* バグ::

ツリービュー

* オプション: オプション<6>.
* Item options::
* Tag options::
* Column identifiers::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.

Ttk styling

* レイアウト::

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 --- 型ヒントのサポート. 型ヒントのサポート
* 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 -- 型ヒントのサポート

* Python 型システムの仕様::
* 型エイリアス::
* NewType::
* 呼び出し可能オブジェクトのアノテーション::
* ジェネリクス::
* タプルのアノテーション::
* クラスオブジェクトの型::
* Annotating generators and coroutines::
* ユーザー定義のジェネリック型::
* Any 型::
* 名前的部分型 vs 構造的部分型::
* モジュールの内容: モジュールの内容<4>.
* メジャーな機能の非推奨時系列::

モジュールの内容

* 特殊型付けプリミティブ::
* プロトコル: プロトコル<4>.
* ABCs and Protocols for working with I/O::
* Functions and decorators::
* Introspection helpers::
* 定数: 定数<11>.
* 非推奨のエイリアス::

特殊型付けプリミティブ

* 特殊型::
* 特殊形式::
* 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 decorators::
* Further examples::

Mock を使う

* Mock patching methods::
* Mock for method calls on an object::
* Mocking classes::
* モックに名前をつける::
* Tracking all calls::
* Setting return values and attributes::
* モックから例外を発生させる::
* side_effect の関数と iterable::
* 非同期イテレータをモックする::
* 非同期コンテキストマネージャをモックする::
* Creating a mock from an existing object::
* Using side_effect to return per file content::

Further examples

* chained call をモックする::
* 部分的なモック::
* Mocking a generator method::
* 同じパッチを全てのメソッドに適用する::
* Mocking unbound methods::
* モックで複数回の呼び出しをチェックする::
* ミュータブルな引数に対処する::
* Nesting patches::
* 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::
* コマンドラインインターフェースを利用してテストを実行する::

Debugging and Profiling

* 監査イベント表::
* bdb: bdb --- デバッガーフレームワーク. デバッガーフレームワーク
* faulthandler: faulthandler --- Python トレースバックをダンプする. Python トレースバックをダンプする
* pdb: pdb --- The Python Debugger. The Python Debugger
* The Python Profilers::
* 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::

The Python Profilers

* Introduction to the profilers::
* Instant User's Manual::
* profile and cProfile Module Reference::
* The Stats Class::
* What Is Deterministic Profiling?::
* 制限事項: 制限事項<2>.
* キャリブレーション (補正): キャリブレーション 補正.
* カスタムな時刻取得用関数を使う::

timeit -- 小さなコードスニペットの実行時間計測

* Basic Examples::
* Python Interface::
* Command-Line Interface::
* 使用例: 使用例<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 アーカイブを管理する

* 基本的な例: 基本的な例<3>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<3>.
* 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 -- データクラス

* モジュールの内容: モジュールの内容<5>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<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 文の定義

* モジュールコンテンツ: モジュールコンテンツ<3>.

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::
* Creating a custom callable annotate function::

site -- サイト固有の設定フック

* sitecustomize::
* usercustomize::
* readline の設定::
* モジュールの内容: モジュールの内容<6>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<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 ソース用のトークナイザー

* Tokenizing Input::
* Command-Line Usage::
* 使用例: 使用例<50>.

pyclbr -- Python モジュールブラウザーサポート

* Function オブジェクト::
* クラスオブジェクト: クラスオブジェクト<2>.

py_compile -- Python ソースファイルをコンパイルする

* コマンドラインインターフェイス: コマンドラインインターフェイス<4>.

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>.
* 定数: 定数<12>.
* レジストリハンドルオブジェクト::

定数

* 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>.

使用例

* シンプルな例::

Superseded Modules

* 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 インタプリタの拡張と埋め込み

* おすすめのサードパーティツール::
* Creating extensions without third party tools::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::

Creating extensions without third party tools

* Extending Python with C or C++::
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::

Extending Python with C or C++

* A Simple Example::
* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions.
* Back to the Example::
* The Module's Method Table and Initialization Function::
* Compilation and Linkage::
* 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 reference manual

* はじめに: はじめに<14>.
* C API Stability::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* ユーティリティ: ユーティリティ<2>.
* 抽象オブジェクトレイヤ (Abstract Objects Layer): 抽象オブジェクトレイヤ Abstract Objects Layer.
* 具象オブジェクト (concrete object) レイヤ: 具象オブジェクト concrete object レイヤ.
* インタープリタの初期化と終了処理::
* Thread states and the global interpreter lock::
* Asynchronous notifications::
* Operating system thread APIs::
* 同期プリミティブ: 同期プリミティブ<3>.
* Thread-local storage support::
* Multiple interpreters in a Python process::
* Profiling and tracing::
* Reference tracing::
* 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 Stability

* Unstable C API::
* Stable Application Binary Interface::
* プラットフォームで考慮すべき点::
* 限定版APIの内容::

Stable Application Binary Interface

* Limited C API::
* Stable ABI::
* Limited API Scope and Performance::
* Limited API Caveats::

超高水準レイヤ

* Available start symbols::
* Stack Effects::

例外処理

* 出力とクリア::
* 例外の送出::
* 警告: 警告<3>.
* エラーインジケータの問い合わせ::
* シグナルハンドリング: シグナルハンドリング<2>.
* 例外クラス: 例外クラス<2>.
* 例外オブジェクト::
* Unicode 例外オブジェクト::
* 再帰の管理::
* Exception and warning types::
* Tracebacks::

Exception and warning types

* Exception types::
* OSError aliases::
* Warning types::

拡張モジュールの定義

* 複数のモジュールインスタンス::
* Initialization function::
* 多段階初期化::
* 従来の一段階初期化::

ユーティリティ

* オペレーティングシステム関連のユーティリティ::
* システム関数::
* プロセス制御::
* モジュールのインポート: モジュールのインポート<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 構造体としての複素数::
* Complex Numbers as Python Objects::

シーケンスオブジェクト (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 Objects::
* Set オブジェクト::

Dictionary Objects

* 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::

その他のオブジェクト

* File objects::
* モジュールオブジェクト (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 objects

* Soft-deprecated API::

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<4>.

C API for extension modules

* Curses C API::
* Internal data::
* DateTime オブジェクト: DateTime オブジェクト<2>.
* Internal data: Internal data<2>.

インタープリタの初期化と終了処理

* Before Python initialization::
* グローバルな設定変数::
* インタープリタの初期化と終了処理: インタープリタの初期化と終了処理<2>.
* Cautions regarding runtime finalization::
* プロセスワイドのパラメータ::

Thread states and the global interpreter lock

* Detaching the thread state from extension code::
* Non-Python created threads::
* Legacy API::
* Cautions about fork(): Cautions about fork.
* 高水準 API::
* GIL-state APIs::
* 低水準 API::

Detaching the thread state from extension code

* APIs::

同期プリミティブ

* Python critical section API::
* Legacy locking APIs::

Thread-local storage support

* Thread-specific storage API::
* Dynamic allocation::
* メソッド: メソッド<2>.
* Legacy APIs::

Multiple interpreters in a Python process

* A per-interpreter GIL::
* バグと注意事項::
* 高水準 API: 高水準 API<2>.
* 低水準 API: 低水準 API<2>.
* Advanced debugger support::

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)

* Allocating objects on the heap::
* Object Life Cycle::
* 共通のオブジェクト構造体 (common object structure): 共通のオブジェクト構造体 common object structure.
* Type Object Structures::
* 循環参照ガベージコレクションをサポートする::

Allocating objects on the heap

* Soft-deprecated aliases::

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>.
* どうすればいいの...？: どうすればいいの ？.
* よくあるインストールに関する問題::

どうすればいいの...？

* ... パッケージを現在のユーザ用のみにインストールするには？: パッケージを現在のユーザ用のみにインストールするには？.
* ... 科学技術計算用の 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 クックブック::
* Regular expression HOWTO::
* ソケットプログラミング HOWTO::
* ソートのテクニック::
* Unicode HOWTO::
* urllib パッケージを使ってインターネット上のリソースを取得するには::
* ipaddressモジュールの紹介::
* DTrace と SystemTap で CPython を測定する::
* Python support for the Linux perf profiler::
* アノテーションのベストプラクティス::
* 拡張モジュールを分離する::
* 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::
* Security and threat model::

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

* Event Loop::
* 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>.

細かい点

* Supported __dunder__ and _sunder_ names::
* _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 を使うとき::
* 簡単な例::
* ファイルへの 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の利用.
* Deploying web applications using Gunicorn and uWSGI::

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 以外のハンドラーを追加する::
* 大量のロガーを作成する::

Regular expression HOWTO

* はじめに: はじめに<16>.
* Simple patterns::
* Using regular expressions::
* More pattern power::
* Modifying strings::
* Common problems::
* フィードバック::

Simple patterns

* Matching characters::
* Repeating things::

Using regular expressions

* Compiling regular expressions::
* The backslash plague::
* Performing matches::
* Module-level functions: Module-level functions<2>.
* Compilation flags::

More pattern power

* More metacharacters::
* グルーピング::
* Non-capturing and named groups::
* Lookahead assertions::

Modifying strings

* Splitting strings::
* Search and replace::

Common problems

* Use string methods::
* match() versus search(): match versus search.
* Greedy versus 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>.

利用可能な静的マーカー

* C Entry Points::
* C Probing Checks::

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::

アノテーションのベストプラクティス

* オブジェクトのアノテーション辞書へのアクセス (Python 3.10 以降): オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降.
* オブジェクトのアノテーション辞書へのアクセス (Python 3.9 以前): オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前.
* 文字列指定のアノテーションを手動で解決する方法::
* __annotations__ のベストプラクティス (全 Python バージョン共通): __annotations__ のベストプラクティス 全 Python バージョン共通.
* __annotations__ の注意点::

拡張モジュールを分離する

* Who should read this::
* 背景: 背景<2>.
* Making Modules Safe with Multiple Interpreters::
* Heap Types: Heap Types<2>.
* 取り掛かり中の問題::

背景

* Enter Per-Module State::
* 分離されたモジュールオブジェクト::
* 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::
* Increased memory usage::

Increased memory usage

* All interned strings are immortal::
* Non-GC objects have a larger object header::
* QSBR can delay freeing of memory::
* mimalloc allocator vs pymalloc::
* Free-threaded reference counting can cause objects to live longer::
* Per-thread reference counting can delay freeing objects::

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<87>.

Remote debugging attachment protocol

* Disabling remote debugging::

Security and threat model

* When to use PYTHON_DISABLE_REMOTE_DEBUG::

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>.
* Sequences (tuples/lists): Sequences tuples/lists.
* オブジェクト::
* モジュール: モジュール<5>.

一般的な質問

* ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？::
* バグの発見や静的解析に役立つツールはありますか？::
* どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？::
* Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？::

コア言語

* なぜ変数に値があるのに UnboundLocalError が出るのですか？::
* Python のローカルとグローバル変数のルールは何ですか？::
* ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？::
* グローバル変数をモジュール間で共有するにはどうしたらいいですか？::
* モジュールで import を使う際の「ベストプラクティス」は何ですか？::
* なぜオブジェクト間でデフォルト値が共有されるのですか？::
* オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？::
* 実引数と仮引数の違いは何ですか?::
* なぜ list 'y' を変更すると list 'x' も変更されるのですか?::
* 出力引数のある関数 (参照渡し) はどのように書きますか？: 出力引数のある関数 参照渡し はどのように書きますか？.
* Python で高次関数はどのようにつくりますか？::
* Python のオブジェクトはどのようにコピーしますか？::
* オブジェクトのメソッドや属性はどのように見つけますか？::
* どうすればコードにてオブジェクトの名前を得ることができますか？::
* カンマ演算子はなぜ優先されるのですか？::
* C の "?;" 三項演算子と等価なものはありますか？: C の "? " 三項演算子と等価なものはありますか？.
* Python で解し難いワンライナーを書くことはできますか？::
* 関数の仮引数リストにあるスラッシュ (/) は何を意味しますか？: 関数の仮引数リストにあるスラッシュ / は何を意味しますか？.

数と文字列

* 十六進数や八進数を指定するにはどうしたらいいですか？::
* なぜ -22 // 10 は -3 を返すのですか？::
* どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* 文字列から後端の改行を取り除く Perl の chomp() に相当するものはありますか？: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？.
* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.
* What does UnicodeDecodeError or UnicodeEncodeError error mean?::
* raw string を奇数個のバックスラッシュで終えることはできますか？::

性能

* プログラムが遅すぎます。どうしたら速くなりますか？::
* 多くの文字列を結合するのに最も効率的な方法は何ですか？::

Sequences (tuples/lists)

* タプル、リスト間の変更はどのようにするのですか？::
* 負の添え字は何ですか？::
* シーケンスを逆順にイテレートするにはどうしたらいいですか？::
* リストから重複を取り除くにはどうしますか？::
* 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
変更履歴: 143. をご覧ください。

参考
....

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.
* Notable changes in 3.14.5: Notable changes in 3 14 5.

   ---------- 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 テンプレート文字列リテラル: 145.、*note
アノテーションの遅延評価: 146.、標準ライブラリへの *note
subinterpreters: 147. の追加です。

ライブラリの変更内容には *note asyncio のイントロスペクション機能: 148.
の重要な改善、 新モジュール *note compression.zstd: 23. による *note
Zstandard のサポート: 149. 、 REPL における構文ハイライトが、通常の非推
奨化や削除、また利便性と正確性の向上に加えて含まれます。

本記事は、全ての新機能の仕様を網羅的に説明する代わりに、分かりやすく概要
を説明するものとなっています。詳細については *note
ライブラリリファレンス: 14a. や *note 言語リファレンス: 14b. などを参照
してください。各変更点の実装や設計の理由を網羅的に理解したい方は、該当の
PEP を参照してください。ただし、 PEP は機能が実装されたあとは Python の
最新バージョンに合わせて更新されないことが多いので注意してください。
Python を以前のバージョンからアップグレードする際の注意点は *note
Porting to Python 3.14: 14c. を参照してください。

__________________________________________________________________

インタプリタの改善:

   * PEP 649(1) と PEP 749(2): *note アノテーションの遅延評価: 146.

   * PEP 734(3): *note 標準ライブラリにおける複数インタープリタ: 147.

   * PEP 750(4): *note テンプレート文字列: 145.

   * PEP 758(5): *note 括弧を省略した except and except* 式を許可: 14d.

   * PEP 765(6): *note finally ブロック内の制御フロー: 14e.

   * PEP 768(7): *note CPython
     における安全な外部デバッガインターフェース: 14f.

   * *note 新型のインタープリタ: 150.

   * *note フリースレッドモードの改善: 151.

   * *note エラーメッセージの改善: 152.

   * *note 漸進的なガベージコレクション: 153.

標準ライブラリーの顕著な改善

   * PEP 784(8): *note 標準ライブラリでの Zstandard のサポート: 149.

   * *note Asyncio introspection capabilities: 148.

   * *note Concurrent safe warnings control: 154.

   * *note デフォルトの対話シェルでのシンタックスハイライトSyntax
     highlighting in the default interactive shell: 155. と、複数の標準
     ライブラリのCLIでのカラー出力

C API の改善:

   * PEP 741(9): *note Python configuration C API: 156.

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

   * PEP 776(10): Emscripten が tier 3(11) として *note
     公式にサポートされるプラットフォーム: 157. となりました。

リリースの変更:

   * PEP 779(12): *note フリースレッドな Python
     は公式にサポートされました: 158.

   * PEP 761(13): *note 公式のリリースについて、PGP
     署名は廃止されました: 159.

   * *note Windows と macOS
     のバイナリリリースは、実験的なジャスト・イン・タイムコンパイラをサポートします:
     15a.

   * *note Android のためのバイナリリリースが提供されるようになりました:
     157.

   ---------- 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; 複数インタープリタ機能が標準ライブラリに追加: PEP 734 複数インタープリタ機能が標準ライブラリに追加.
* PEP 750; テンプレート文字列リテラル: PEP 750 テンプレート文字列リテラル.
* PEP 768; 安全な外部デバッガインターフェース: PEP 768 安全な外部デバッガインターフェース.
* 新しいインタープリタ::
* 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 複数インタープリタ機能が標準ライブラリに追加,  Up: 新しい機能

'PEP 649' と 'PEP 749': アノテーションの遅延評価

関数、クラス、モジュールの *note アノテーション: 15d. が先行評価されなく
なりました。代わりに、アノテーションは専用の *note annotate 関数: 15e. に
格納され、必要になったときのみ評価されるようになります (‘from __future__
import annotations’ を使用している場合を除く)。

この変更により、Pythonのアノテーションのパフォーマンスと使いやすさがほと
んどの状況で向上します。アノテーションを定義することで発生する実行コスト
はほとんどなくなりましたが、実行中にアノテーションを値として取得すること
は依然として可能です。また、アノテーションに前方参照が含まれている場合に
、クォーテーションで囲って文字列にする必要はなくなりました。

新しく追加された *note annotationlib: 6. モジュールを使うことで、遅延評
価となったアノテーションを取得することができます。アノテーションの評価フ
ォーマットとして、 *note VALUE: 15f. (以前のPythonバージョンと同様に、ア
ノテーションの実行時の値を評価する) *note FORWARDREF: 160. (未定義の名前
を特別なマーカーに置き換える) *note STRING: 161. (アノテーションを文字列
として返す) があります。

各フォーマットの挙動は以下の例の通りです：

     >>> 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'}

この変更により既存コードでどのような修正が必要になる可能性があるかを
*note 移植: 162. セクションで説明しています。ただし、ほとんどのコードで
は修正は不要です。

(Jelle Zijlstra の貢献による PEP 749(1) と gh-119180(2) 、 Larry
Hastings の貢献による PEP 649(3) )

参考
....

PEP 649(4)

     デスクリプタを使ったアノテーション遅延評価

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 複数インタープリタ機能が標準ライブラリに追加,  Next: PEP 750 テンプレート文字列リテラル,  Prev: PEP 649 と PEP 749 アノテーションの遅延評価,  Up: 新しい機能

'PEP 734': 複数インタープリタ機能が標準ライブラリに追加

CPython ランタイムでは、同じプロセスの中で複数の Python 環境を実行する機
能が20年以上存在します。この各環境は「インタープリタ」といいます。しかし
この機能は *note C-API: 164. 経由でしか利用できませんでした。

Python 3.14 で *note concurrent.interpreters: 25. モジュールが追加された
ことにより、この制限がなくなりました。

複数インタープリタを利用することで得られる大きな利点が２つあります：

   * (Python としては新しい) 使いやすい並行実行モデル

   * マルチコアを活用した真の並列実行

並行実行は、原理的には実行効率が上がったり設計を単純化できる用途がある一
方で、非常に単純な並行実行でない限り、人間にとって実装や保守が難しいこと
が多いです。特に、OSレベルのスレッドを直接使用する場合は (例えば *note
threading: f3.)、メモリがすべてのスレッド間で共有されるため、複雑になり
ます。

互いに独立した複数インタープリタを使用することで、 Communicating
Sequential Processes (CSP) やアクターモデルといった、他言語 (Smalltalk、
Erlang、Haskell、Go など) で成功している並行実行モデルを取り入れることが
できます。複数インタープリタは、ユーザーが明示的にメモリ共有をするスレッ
ドとみなすことができます。

マルチコアの並列実行については、Python 3.12 で、インタープリタは並列実行
できるレベルにお互いに隔離されるようになりました (参照： PEP 684(1)) 。
これにより、 *note GIL: 165. の制限がなくなり、様々な CPU バウンドな用途
に Python を用いることができるようになります。

複数インタープリタは、デフォルトでメモリ共有がされない点や、隔離された論
理的な「プロセス」が並列に動作するという点で、 *note multiprocessing:
98. と類似しています。しかし、複数インタープリタを使うことで、システムの
リソースを節約でき、処理効率もあがります (同じプロセスに存在するため) 。
スレッドの処理効率とプロセス的な隔離を両立している、と考えられます。

複数インタープリタの機能は何十年も存在していましたが、認知度が低く、標準
ライブラリモジュールがないことから、あまり使用されていませんでした。その
ため、いくつか大きな制限事項がありますが、メイン機能になったことで今後大
きく改善していくと思われます。

現状の制限事項：

   * インタープリタの起動処理がまだ最適化されていない

   * インタープリタのメモリ使用量が必要以上に大きい (インタープリタ間で
     内部リソースをできるだけ共有するよう改善中)

   * インタープリタ間でオブジェクトなどのデータを真の意味で共有する方法
     がまだ少ない (*note memoryview: 166. 以外)

   * PyPI 上のサードパーティ拡張モジュールの多くが複数インタープリタに対
     応していない (標準ライブラリの拡張モジュールはすべて対応)

   * Python 利用者はまだ複数インタープリタを使ったアプリケーション開発に
     慣れていない人が多い

今後 CPython がどう改善していくか、インタープリタがどう使われるか、PyPI
パッケージでどこまで解決できるようになるかによって、以上の制限事項の影響
度合いは変わります。用途によっては、影響は少ないかもしれません。ぜひ使っ
てみてください！

さらに、今後の CPython のバージョンで、オーバーヘッドは少なくなり、 PyPI
パッケージとして実装するには向かない補助機能が追加される予定です。それま
での間、上記の制限事項のほとんどは拡張モジュールを作ることで解消できるの
で、今の時点で PyPI パッケージによって穴埋めすることもできます。これは
3.14 から 3.12 (インタープリタが隔離が完全になり、 *note GIL: 165. の共
有がなくなったバージョン) まで可能です。同様に、インタープリタをさらに抽
象化するライブラリも PyPI に現れると予想されます。

拡張モジュールの対応については、一部の PyPI プロジェクトや、Cython、
pybind11、nanobind、PyO3などのツールの対応作業が進行中です。どうすれば拡
張モジュールを隔離できるかについては、 *note 拡張モジュールを分離する:
167. を参照してください。隔離のために必要な作業は、 *note
フリースレッド: 151. の対応に必要な作業とかなり重複するため、すでにコミ
ュニティで進められているフリースレッド対応作業により、複数インタープリタ
の対応も早まると思われます。

他の 3.14 追加要素: *note concurrent.futures.InterpreterPoolExecutor:
168. 。

(Eric Snow の貢献による 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 安全な外部デバッガインターフェース,  Prev: PEP 734 複数インタープリタ機能が標準ライブラリに追加,  Up: 新しい機能

'PEP 750': テンプレート文字列リテラル

テンプレート文字列とは、カスタムの文字列処理を行うための新しい仕組みです
。f-string と構文が類似していますが、f-string が単に *note str: 16a. を
返すのに対し、テンプレート文字列は、文字列の固定の部分と補間された部分を
表すオブジェクトを返します。

t-stringを書くには、プレフィックスとして ‘'f'’ の代わりに ‘'t'’ を使用し
ます:

     >>> variety = 'Stilton'
     >>> template = t'Try some {variety} cheese!'
     >>> type(template)
     <class 'string.templatelib.Template'>

*note Template: 16b. オブジェクトでは、一つの文字列に結合される前の、固
定部分の文字列や補間部分 (波括弧で囲まれる) の文字列を取得することができ
ます。 ‘Template’ のインスタンスに反復を行うことで、各部分を順に取り出せ
ます:

     >>> list(template)
     ['Try some ', Interpolation('Stilton', 'variety', None, ''), ' cheese!']

‘Template’ インスタンスを処理するコードは書くのも呼び出すのも簡単です。
例えば以下の例は、固定部分を小文字で、 *note Interpolation: 16c. インス
タンスを大文字で表示する関数です:

     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'

‘Template’ インスタンスを使うことで、動的に固定部分と補間部分を区別する
ことができるため、これはユーザー入力のサニタイズをするのに便利です。練習
問題として、ユーザー入力を HTML 用にサニタイズする関数 ‘html()’ を書いて
みてください！例えば、比較的高度な ‘html()’ 関数にするならば、 HTML 属性
の ‘dict’ を直接テンプレートに埋め込めるようにすることが考えられます:

     attributes = {'src': 'limburger.jpg', 'alt': 'lovely cheese'}
     template = t'<img {attributes}>'
     assert html(template) == '<img src="limburger.jpg" alt="lovely cheese" />'

当然ながら、テンプレートを処理たあと必ずしも文字列的な値を返す必要はあり
ません。先程の ‘html()’ 関数をより高度にして、DOM のようなカスタムの構造
体を返すようにすることも考えられます。

t-string を使えば、SQL 文をサニタイズしたり、シェル操作を安全にしたり、
ログを改善したり、Web 開発 (HTML、CSS など) のモダンな技術を扱ったり、カ
スタムの DSL を実装したりするシステムを作成できます。

(Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono, Lysandros
Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt Tran, Pablo
Galindo Salgado の貢献による 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 安全な外部デバッガインターフェース,  Next: 新しいインタープリタ,  Prev: PEP 750 テンプレート文字列リテラル,  Up: 新しい機能

'PEP 768': 安全な外部デバッガインターフェース

Python プロセスを停止したり再起動したりすることなく安全にデバッガやプロ
ファイラを接続できる、オーバーヘッドのないデバッグインターフェースが
Python 3.14 で追加されました。これは Python のデバッグ機能を大きく強化す
るものであり、安全でない手法をとる必要がなくなります。

このインターフェースにより、インタープリタの通常の実行パスに変更を加える
ことなく、実行のオーバーヘッドを生じさせることもなく、安全にデバッガを接
続できるポイントが追加されます。これにより、外部ツールからリアルタイムで
Python アプリケーションの状態を取得したり操作できるようになります。これ
は、安定稼働が必要なシステムや本番環境においては非常に重要な機能です。

利便性のため、このインターフェースは *note sys.remote_exec(): 16e. 関数
として実装されています。例えば：

     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()})')

     # PID 1234 としてプロセスを実行
     print('Behold! An offering:')
     sys.remote_exec(1234, script_path)

この関数を使えば、対象のプロセスに Python コードを送信し、次のチェックポ
イントで実行されるように指示できます。ただ、デバッグツールを自分で作成す
る際は、この関数を使わず、直接プロトコルを実装することもできます。PEP の
中で、実装方法と、プロセスに安全に接続するための内部的な仕組みが説明され
ています。

このデバッグインターフェースはセキュリティを意識して慎重に設計されており
、アクセス制御の仕組みがいくつか備わっています：

   * 環境変数 *note PYTHON_DISABLE_REMOTE_DEBUG: 16f.

   * コマンドラインオプション *note -X disable-remote-debug: 170.

   * ビルド時に本機能を完全に無効化する、configure フラグ *note
     -without-remote-debug: 171.

(Pablo Galindo Salgado, Matt Wozniski, Ivona Stojanovic による貢献
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: 新しいインタープリタ,  Next: Free-threaded mode improvements,  Prev: PEP 768 安全な外部デバッガインターフェース,  Up: 新しい機能

1.1.2.5 新しいインタープリタ
............................

CPython に新しいインタープリタが追加されました。Python の個々の命令コー
ドを C 言語の長い ‘case’ 文で実装する代わりに、小さな C 関数に分けて末尾
呼び出し (tail call) でお互いを呼び出すようになっています。一部の新しい
コンパイラでビルドすれば、このインタープリタのパフォーマンスは以前のイン
タープリタより大きく改善します。簡易的に ‘pyperformance’ 標準ベンチマー
クでテストした結果、プラットフォームやアーキテクチャによっては、相乗平均
で 3% から 5% の速度向上がみられました。比較対象は、Clang 19 でビルドし
た、新しいインタープリタなしの Python 3.14 です。

このインタープリタは現状、Clang 19 以上かつ x86-64 と AArch64 アーキテク
チャのみ対応しています。ただ、GCC も今後のバージョンで対応になる見込みで
す。

This feature is opt-in for now.  Enabling profile-guided optimization is
highly recommended 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:
173.

     注釈: 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: 新しいインタープリタ,  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(): 175.

The new *note -X context_aware_warnings: 170. flag controls if *note
concurrent safe warnings control: 154. 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: 176. flag has been added, which if
enabled means that threads created with *note threading.Thread: 177.
start with a copy of the *note Context(): 178. of the caller of *note
start(): 179.  Most significantly, this makes the warning filtering
context established by *note catch_warnings: 17a. 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: 17c. statements that follow an *note else: 17d. 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): 17e. after *note else: 17d, or one of *note pass:
     17f, *note break: 180, or *note continue: 181. is passed before
     *note if: 182, then the error message highlights where the *note
     expression: 183. 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: 184. or *note set: 185.
     (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: 186.
     instead of *note with: 187, 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: 13a. 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: 138, 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: 17a. context manager will now
optionally use a context variable for warning filters.  This is enabled
by setting the *note context_aware_warnings: 18b. flag, either with the
‘-X’ command-line option or an environment variable.  This gives
predictable warnings control when using ‘catch_warnings’ 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: 18d. command-line option.  This includes writes to
     ‘__debug__’, incorrect use of *note await: 18e, 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: 18f.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.
* 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(): 191. and *note bytearray.fromhex(): 192.
     methods now accept ASCII *note bytes: 193. and *note bytes-like
     objects: 194.  (Contributed by Daniel Pope in gh-129349(1).)

   * Add class methods *note float.from_number(): 195. and *note
     complex.from_number(): 196. to convert a number to *note float:
     197. or *note complex: 198. type correspondingly.  They raise a
     *note TypeError: 199. 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(): 19a. or *note
     f-strings: 19b.).  (Contributed by Sergey B Kirpichev in
     gh-87790(3).)

   * The *note int(): 19c. function no longer delegates to *note
     __trunc__(): 19d.  Classes that want to support conversion to
     ‘int()’ must implement either *note __int__(): 19e. or *note
     __index__(): 19f.  (Contributed by Mark Dickinson in gh-119743(4).)

   * The *note map(): 1a0. function now has an optional keyword-only
     'strict' flag like *note zip(): 1a1. to check that all the
     iterables are of equal length.  (Contributed by Wannes Boeykens in
     gh-119793(5).)

   * The *note memoryview: 166. type now supports subscription, making
     it a *note generic type: 1a2.  (Contributed by Brian Schubert in
     gh-126012(6).)

   * Using *note NotImplemented: 1a3. in a boolean context will now
     raise a *note TypeError: 199.  This has raised a *note
     DeprecationWarning: 1a4. since Python 3.9.  (Contributed by Jelle
     Zijlstra in gh-118767(7).)

   * Three-argument *note pow(): 1a5. now tries calling *note
     __rpow__(): 1a6. 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: 1a7. 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: 170.  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: 1a9. now automatically dedents
     its code argument before execution.  The auto-dedentation behavior
     mirrors *note textwrap.dedent(): 1aa.  (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: 1ac. and *note except*: 1ad. 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: 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: 1af. when a *note return:
1b0, *note break: 180, or *note continue: 181. statement have the effect
of leaving a *note finally: 1b1. 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:
1b2. 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:
119. 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: Garbage collection,  Next: Default interactive shell,  Prev: PEP 765 Control flow in finally blocks,  Up: Other language changes

1.1.3.5 Garbage collection
..........................

'From Python 3.14.5 onwards:'

The garbage collector (GC) has changed in Python 3.14.5.

Python 3.14.0-3.14.4 shipped with a new incremental GC. However, due to
a number of reports(1) of significant memory pressure in production
environments, it has been reverted back to the generational GC from
3.13.  This is the GC now used in Python 3.14.5 and later.

'Previously in Python 3.14.0-3.14.4:'

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(): 1b5. 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(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142516

   (2) https://github.com/python/cpython/issues/108362


File: python.info,  Node: Default interactive shell,  Prev: Garbage collection,  Up: Other language changes

1.1.3.6 Default interactive shell
.................................

   * The default *note interactive: 1b7. shell now highlights Python
     syntax.  The feature is enabled by default, save if *note
     PYTHON_BASIC_REPL: 1b8. or any other environment variable that
     disables colour is set.  See *note 色の制御: 1b9. 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: 1ba. 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: 1b7. 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: 15d.
     See *note PEP 749: 146. 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: 149.
     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: 147. 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: 145. 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: 1be. for *note
     argparse.ArgumentParser: 1bf. 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: 1bf, 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: 1bf.  This can
     also be controlled by *note environment variables: 1b9.
     (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(): 1c1, a function for comparing two ASTs.
     (Contributed by Batuhan Taskaya and Jeremy Hylton in gh-60191(1).)

   * Add support for *note copy.replace(): 1c2. 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(): 1c3. 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(): 1c4. 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: 1c5, *note -optimize: 1c6, and *note -show-empty:
     1c7.  (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: 1c9. constructor or the custom task
     factory.  (See *note set_task_factory(): 1ca. 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(): 1cb, *note asyncio.loop.create_task(): 1cc,
     *note asyncio.TaskGroup.create_task(): 1cd.

     (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(): 1ce. and *note
     print_call_graph(): 1cf.  See *note Asyncio introspection
     capabilities: 148. 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: 1d2. text output.  This can be controlled
     by *note environment variables: 1b9.  (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: 1d4, 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: 147.  (Contributed by Eric Snow in
     gh-124548(1).)

   * On Unix platforms other than macOS, *note 'forkserver': 1d6. is now
     the default *note start method: 1d7. for *note ProcessPoolExecutor:
     1d8. (replacing *note 'fork': 1d9.).  This change does not affect
     Windows or macOS, where *note 'spawn': 1da. 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: 1d8.

     See *note forkserver restrictions: 1db. 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: 1d8, *note
     terminate_workers(): 1dc. and *note kill_workers(): 1dd, 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: 1de.
     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(): 1e0. keys
     containing delimiters or beginning with the section header pattern
     will raise an *note InvalidWriteError: 1e1.  (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: 1e3. protocol for *note Token:
     1e4. 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: 1e6. in *note Structure: 1e7. and
     *note Union: 1e8. 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_: 1e9. 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: 1e7./*note Union: 1e8. field
     descriptors is now available as *note CField: 1ea, and has new
     attributes to aid debugging and introspection.  (Contributed by
     Petr Viktorin in gh-128715(3).)

   * On Windows, the *note COMError: 1eb. exception is now public.
     (Contributed by Jun Komoda in gh-126686(4).)

   * On Windows, the *note CopyComPointer(): 1ec. function is now
     public.  (Contributed by Jun Komoda in gh-127275(5).)

   * Add *note memoryview_at(): 1ed, a function to create a *note
     memoryview: 166. object that refers to the supplied pointer and
     length.  This works like *note ctypes.string_at(): 1ee. 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: 1ef, *note c_double_complex:
     1f0, and *note c_longdouble_complex: 1f1, 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(): 1f2. for listing the shared
     libraries loaded by the current process.  (Contributed by Brian
     Ward in gh-119349(8).)

   * Move *note ctypes.POINTER(): 1f3. types cache from a global
     internal cache (‘_pointer_type_cache’) to the *note
     _CData.__pointer_type__: 1f4. 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: 1f5. type now supports subscription, making it
     a *note generic type: 1a2.  (Contributed by Brian Schubert in
     gh-132168(10).)

   * ‘ctypes’ now supports *note free-threading builds: 1f6.
     (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(): 1f8. function, a refinement
     of the *note use_default_colors(): 1f9. 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(): 1fb. method to the *note datetime.date:
     1fc. and *note datetime.time: 1fd. 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(): 1ff. as an alternative constructor
     for *note Decimal: 200.  (Contributed by Serhiy Storchaka in
     gh-121798(1).)

   * Expose *note IEEEContext(): 201. 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: 203. 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: 205, rather than only the line number.  This feature
     is added to the following interfaces via the 'show_positions'
     keyword argument:

        - *note dis.Bytecode: 206.

        - *note dis.dis(): 207.

        - *note dis.distb(): 208.

        - *note dis.disassemble(): 209.

     This feature is also exposed via *note dis -show-positions: 20a.
     (Contributed by Bénédikt Tran in gh-123165(1).)

   * Add the *note dis -specialized: 20b. 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: 20d. 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: 20f. via the new *note dump_c_stack(): 210. function or
     via the 'c_stack' argument in *note faulthandler.enable(): 211.
     (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(): 213, 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: 215. 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(): 216. as an alternative
     constructor for *note Fraction: 215.  (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: 218. sentinel.  This may be used with
     the *note partial(): 219. or *note partialmethod(): 21a. functions
     to reserve a place for positional arguments in the returned *note
     partial object: 21b.  (Contributed by Dominykas Grigonis in
     gh-119127(1).)

   * Allow the 'initial' parameter of *note reduce(): 21c. 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(): 21f. 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(): 221. 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(): 223.

        * *note heappush_max(): 224.

        * *note heappop_max(): 225.

        * *note heapreplace_max(): 226.

        * *note heappushpop_max(): 227.


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: 22a. class.  This
     functionality is exposed by the command-line interface (‘python -m
     http.server’) through the following options:

        * *note -tls-cert <path>: 22b.: Path to the TLS certificate
          file.

        * *note -tls-key <path>: 22c.: Optional path to the private key
          file.

        * *note -tls-password-file <path>: 22d.: 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(): 22f, 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(): 231. takes a new argument 'annotation_format' to
     control the *note annotationlib.Format: 232. used for representing
     annotations.  (Contributed by Jelle Zijlstra in gh-101552(1).)

   * *note Signature.format(): 233. takes a new argument
     'unquote_annotations'.  If true, string *note annotations: 15d. are
     displayed without surrounding quotes.  (Contributed by Jelle
     Zijlstra in gh-101552(2).)

   * Add function *note ispackage(): 234. to determine whether an object
     is a *note package: 235. 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: 237. if the operation cannot immediately
     return bytes.  (Contributed by Giovanni Siragusa in gh-109523(1).)

   * Add the *note Reader: 238. and *note Writer: 239. protocols as
     simpler alternatives to the pseudo-protocols *note typing.IO: 23a,
     *note typing.TextIO: 23b, and *note typing.BinaryIO: 23c.
     (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: 23e. switch: ‘python -m json’.  This is now preferred to
     ‘python -m json.tool’, which is *note soft deprecated: 23f.  See
     the *note JSON command-line interface: 240. documentation.
     (Contributed by Trey Hunner in gh-122873(2).)

   * By default, the output of the *note JSON command-line interface:
     240. is highlighted in color.  This can be controlled by *note
     environment variables: 1b9.  (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(): 242. 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: 244. objects now support the *note context
     manager: 1e3. protocol.  (Contributed by Charles Machalow in
     gh-132106(1).)

   * *note QueueListener.start: 245. now raises a *note RuntimeError:
     246. 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: 249. 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': 1d6. is now
     the default *note start method: 1d7. (replacing *note 'fork':
     1d9.).  This change does not affect Windows or macOS, where *note
     'spawn': 1da. 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(): 24c.
     (preferred) or change the default via *note set_start_method():
     24d.

     See *note forkserver restrictions: 1db. 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: 24e. for 'list' and 'dict'
     types gain previously overlooked missing methods:

             * ‘clear()’ and ‘copy()’ for proxies of *note list: 24f.

             * *note fromkeys(): 250, ‘reversed(d)’, ‘d | {}’, ‘{} | d’,
               ‘d |= {'b': 2}’ for proxies of *note dict: 184.

     (Contributed by Roy Hyunjin Han for gh-103134(3).)

   * Add support for shared *note set: 185. objects via *note
     SyncManager.set(): 251.  The *note set(): 185. in *note Manager():
     252. method is now available.  (Contributed by Mingyu Park in
     gh-129949(4).)

   * Add the *note interrupt(): 253. to *note multiprocessing.Process:
     254. objects, which terminates the child process by sending *note
     SIGINT: 255.  This enables *note finally: 1b1. 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(): 257. and *note is_not_none(): 258. 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(): 25a. function to update *note
     os.environ: 25b. and *note os.environb: 25c. with changes to the
     environment made by *note os.putenv(): 25d, by *note os.unsetenv():
     25e, or made outside Python in the same process.  (Contributed by
     Victor Stinner in gh-120057(1).)

   * Add the *note SCHED_DEADLINE: 25f. and *note SCHED_NORMAL: 260.
     constants to the ‘os’ module.  (Contributed by James Roy in
     gh-127688(2).)

   * Add the *note readinto(): 261. function to read into a *note buffer
     object: 262. 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(): 264. accepts a new
     value, *note ALLOW_MISSING: 265.  If used, errors other than *note
     FileNotFoundError: 266. 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: 268. to recursively copy or move
     files and directories:

        * *note copy(): 269. copies a file or directory tree to a
          destination.

        * *note copy_into(): 26a. copies 'into' a destination directory.

        * *note move(): 26b. moves a file or directory tree to a
          destination.

        * *note move_into(): 26c. moves 'into' a destination directory.

     (Contributed by Barney Gale in gh-73991(1).)

   * Add the *note info: 26d. attribute, which stores an object
     implementing the new *note pathlib.types.PathInfo: 26e. protocol.
     The object supports querying the file type and internally caching
     *note stat(): 26f. results.  Path objects generated by *note
     iterdir(): 270. 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: 272. 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: 14f. and the new *note
     sys.remote_exec(): 16e. 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(): 273. and *note
     set_trace(): 274.) now reuse the most recent *note Pdb: 275.
     instance that calls *note set_trace(): 276, instead of creating a
     new one each time.  As a result, all the instance specific data
     like *note display: 277. and *note commands: 278. are preserved
     across hardcoded breakpoints.  (Contributed by Tian Gao in
     gh-121450(2).)

   * Add a new argument 'mode' to *note pdb.Pdb: 275.  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(): 279, instead of raising
     *note bdb.BdbQuit: 27a.  (Contributed by Tian Gao in gh-124704(4).)

   * Inline breakpoints like *note breakpoint(): 273. or *note
     pdb.set_trace(): 274. 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(): 27b. is added to support debugging
     asyncio coroutines.  *note await: 18e. 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: 1b7. shell, in addition to the newly
     added ‘colorize’ argument of *note pdb.Pdb: 275.  (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: 27d.

   * 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(): 27f, 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: 15d. 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: 283. on FreeBSD.
          (Contributed by Victor Stinner in gh-111178(2).)

        * Add support for *note BTPROTO_SCO: 284. on FreeBSD.
          (Contributed by Serhiy Storchaka in gh-85302(3).)

        * Add support for 'cid' and 'bdaddr_type' in the address for
          *note BTPROTO_L2CAP: 285. on FreeBSD. (Contributed by Serhiy
          Storchaka in gh-132429(4).)

        * Add support for 'channel' in the address for *note
          BTPROTO_HCI: 283. on Linux.  (Contributed by Serhiy Storchaka
          in gh-70145(5).)

        * Accept an integer as the address for *note BTPROTO_HCI: 283.
          on Linux.  (Contributed by Serhiy Storchaka in gh-132099(6).)

        * Return 'cid' in *note getsockname(): 286. for *note
          BTPROTO_L2CAP: 285.  (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: 288. 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: 28b. methods:

        * *note is_comp_cell(): 28c.

        * *note is_comp_iter(): 28d.

        * *note is_free_class(): 28e.

     (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(): 290, 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(): 291. for determining if an object is
     *note immortal: 292.  (Contributed by Peter Bierma in
     gh-128509(2).)

   * On FreeBSD, *note sys.platform: 293. 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: 1a4. for *note
     sys._clear_type_cache(): 294.  This function was deprecated in
     Python 3.13 but it didn't raise a runtime warning.

   * Add *note sys.remote_exec(): 16e. to implement the new external
     debugger interface.  See *note PEP 768: 14f. for details.
     (Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona
     Stojanovic in gh-131591(4).)

   * Add the *note sys._jit: 295. 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: 297. and *note
     BRANCH_RIGHT: 298.  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(): 29a. 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(): 29c. 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(): 29d. 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(): 29e. and *note extractall(): 29d. 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: 29f.  (Contributed by Petr Viktorin for CVE
     2025-4330(5) and CVE 2024-12718(6).)

   * *note extract(): 29e. and *note extractall(): 29d. no longer
     extract rejected members when *note errorlevel(): 2a0. 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(): 179. now sets the operating system
     thread name to *note threading.Thread.name: 2a2.  (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(): 2a5, *note
     turtle.poly(): 2a6, and *note turtle.no_animation(): 2a7.
     (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: 2a9. is now an alias for *note typing.Union:
     2aa.  See *note below: 2ab. 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: 2a9. and *note typing.Union: 2aa. 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(): 1c3.  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:
          2a9. 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(): 2ad. and *note typing.get_args(): 2ae.
          instead of relying on private implementation details.

        - It is now possible to use *note typing.Union: 2aa. itself in
          *note isinstance(): 2af. checks.  For example, ‘isinstance(int
          | str, typing.Union)’ will return ‘True’; previously this
          raised *note TypeError: 199.

        - The ‘__args__’ attribute of *note typing.Union: 2aa. objects
          is no longer writable.

        - It is no longer possible to set any attributes on *note Union:
          2aa. 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: 2b0. 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: 10d. output is now colored by default.  This can be
     controlled by *note environment variables: 1b9.  (Contributed by
     Hugo van Kemenade in gh-127221(1).)

   * unittest discovery supports *note namespace package: 2b4. 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: 2b5.
     class that provide more specialized tests.

        - *note assertHasAttr(): 2b6. and *note assertNotHasAttr(): 2b7.
          check whether the object has a particular attribute.

        - *note assertIsSubclass(): 2b8. and *note
          assertNotIsSubclass(): 2b9. check whether the object is a
          subclass of a particular class, or of one of a tuple of
          classes.

        - *note assertStartsWith(): 2ba, *note assertNotStartsWith():
          2bb, *note assertEndsWith(): 2bc. and *note
          assertNotEndsWith(): 2bd. 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: 112. 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(): 2bf.:

        - 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: 2c0. if a URL authority isn't local,
          except on Windows where we return a UNC path as before.

     In *note pathname2url(): 2c1.:

        - 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: 2c2. 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(): 2c4,
     *note uuid7(): 2c5, and *note uuid8(): 2c6. respectively, as
     specified in RFC 9562(1).  (Contributed by Bénédikt Tran in
     gh-89083(2).)

   * *note NIL: 2c7. and *note MAX: 2c8. 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: 2c9.  (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: 11c. 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: 2cc, a method to resolve suitable
     defaults for a *note ZipInfo: 2cd. object as used by *note
     ZipFile.writestr: 2ce.  (Contributed by Bénédikt Tran in
     gh-123424(1).)

   * *note ZipFile.writestr(): 2ce. 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: 103, *note types: 10a, and *note zipfile: 138.

     (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(): 2d0. and *note
     Py_REFCNT(): 2d1. compared to previous versions of Python.  See
     *note below: 2d2. 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: 1c9, also reducing memory usage.  This enables
     external introspection tools such as *note python -m asyncio
     pstree: 148. 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: 1f6.  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(): 2d5. 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: 2d7. 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(): 2d9. 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
..........

   * 'From Python 3.14.5 onwards:'

     Python 3.14.0-3.14.4 shipped with a new incremental garbage
     collector.  However, due to a number of reports(1) of significant
     memory pressure in production environments, it has been reverted
     back to the generational GC from 3.13.  This is the GC now used in
     Python 3.14.5 and later.

   * 'Previously in Python 3.14.0-3.14.4:'

     The new *note incremental garbage collector: 153. 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(): 2db. and *note set_threshold(): 2dc. have changed,
     along with *note get_count(): 2dd. and *note get_stats(): 2de.

        - For backwards compatibility, *note get_threshold(): 2db.
          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(): 2dc. now ignores any items after the
          second.

        - *note get_count(): 2dd. and *note get_stats(): 2de. 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(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142516

   (2) 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: 2e1. 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(): 2e3. or *note sys.monitoring: e0.  Using the *note
     pdb CLI: 2e4. or *note breakpoint(): 273. will always use the
     ‘sys.monitoring’ backend.  Explicitly instantiating *note pdb.Pdb:
     275. and its derived classes will use the ‘sys.settrace()’ 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(): 1aa. 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(): 2e7. and *note uuid5(): 2e8. 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(): 2e9. 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: 13a. 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(): 2ed. on an argument group now
     raises a *note ValueError: 2ee.  Similarly, ‘add_argument_group()’
     or *note add_mutually_exclusive_group(): 2ef. on a mutually
     exclusive group now both raise ‘ValueError’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: 2f1. 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: 2f2.
     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:
     2f1, 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(): 2f4. now raises a *note
     RuntimeError: 246. 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():
     2f4, most of them can be replaced with *note asyncio.run(): 2f5.

     If you're running an async function, simply use *note
     asyncio.run(): 2f5.

     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(): 2f5. and an
     *note asyncio.Event: 2f6.

     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: 2f7.

     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(): 2f9.'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: 2fb.)

        * ‘Traversable’ (use *note Traversable: 2fc.)

        * ‘TraversableResources’ (use *note TraversableResources: 2fb.)

     (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: 1a4. 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: 268.  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(): 2ff. and *note is_relative_to(): 300.  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(): 303.
     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: 305. and *note
     sqlite_version_info: 306. 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: 307, 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: 111, 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: 112, which have been deprecated since Python 3.3.

     ‘myopener.open()’ can be replaced with *note urlopen(): 309.
     ‘myopener.retrieve()’ can be replaced with *note urlretrieve():
     30a.  Customisations to the opener classes can be replaced by
     passing customized handlers to *note build_opener(): 30b.
     (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(): 198. 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(): 2ed. method is now deprecated.
          (Contributed by Savannah Ostrowski in gh-125563(2).)

        * Deprecated the *note argparse.FileType: 30e. 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(): 30f. 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: 310.

             * *note asyncio.DefaultEventLoopPolicy: 311.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 312.

             * *note asyncio.WindowsProactorEventLoopPolicy: 313.

             * *note asyncio.get_event_loop_policy(): 314.

             * *note asyncio.set_event_loop_policy(): 315.

          Users should use *note asyncio.run(): 2f5. or *note
          asyncio.Runner: 2f7. with the 'loop_factory' argument to use
          the desired event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 316. 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(): 317. function is now
     deprecated, and will be removed in a future version of Python.  Use
     *note open(): 318. instead.  (Contributed by Inada Naoki in
     gh-133036(6).)

   * *note ctypes: 2e.:

        * On non-Windows platforms, setting *note Structure._pack_: 319.
          to use a MSVC-compatible default memory layout is now
          deprecated in favor of setting *note Structure._layout_: 1e9.
          to ‘'ms'’, and will be removed in Python 3.19.  (Contributed
          by Petr Viktorin in gh-131747(7).)

        * Calling *note ctypes.POINTER(): 1f3. on a string is now
          deprecated.  Use *note incomplete types: 31a. for
          self-referential structures.  Also, the internal
          ‘ctypes._pointer_type_cache’ is deprecated.  See
          ‘ctypes.POINTER()’ for updated implementation details.
          (Contributed by Sergey Myrianov in gh-100926(8).)

   * *note functools: 63.: Calling the Python implementation of *note
     functools.reduce(): 21c. 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(): 31b.
     Undotted extensions are deprecated and will raise a *note
     ValueError: 2ee. in Python 3.16.  (Contributed by Hugo van Kemenade
     in gh-75223(11).)

   * ‘nturl2path’: This module is now deprecated.  Call *note
     urllib.request.url2pathname(): 2bf. and *note pathname2url(): 2c1.
     instead.  (Contributed by Barney Gale in gh-125866(12).)

   * *note os: a5.: The *note os.popen(): 31c. and *note os.spawn*: 31d.
     functions are now *note soft deprecated: 23f.  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(): 31e. 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():
     31f. 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: 111.: Accepting objects with false values (like
     ‘0’ and ‘[]’) except empty strings, bytes-like objects and ‘None’
     in *note parse_qsl(): 320. and *note parse_qs(): 321. 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__: 323. on a module while failing to
          set *note __spec__.cached: 324. 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__: 325. on a module while failing to
          set *note __spec__.parent: 326. 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: 327.
          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 pathlib: a8.:

        * *note PurePath.is_reserved(): 328. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 329. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32a. 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(): 32b. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32c. 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: 10a.:

        * *note types.CodeType: 32d.: Accessing *note co_lnotab: 32e.
          was deprecated in PEP 626(3) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10b.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 32f. 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: 330.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(): 331. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10b. module, it has yet to be
          supported by any major type checker.

   * *note wave: 11a.:

        * The *note getmark(): 332, ‘setmark()’, and *note getmarkers():
          333. methods of the *note Wave_read: 334. and *note
          Wave_write: 335. classes have been deprecated since Python
          3.13.

   * *note zipimport: 139.:

        * *note load_module(): 336. has been deprecated since Python
          3.10.  Use *note exec_module(): 337. instead.  (Contributed by
          Jiahao Li in gh-125746(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://peps.python.org/pep-0626/

   (4) https://github.com/python/cpython/issues/101866

   (5) 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__: 339. on a module while failing to
          set *note __spec__.loader: 33a. 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: 33b.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30f. 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: 310.

             * *note asyncio.DefaultEventLoopPolicy: 311.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 312.

             * *note asyncio.WindowsProactorEventLoopPolicy: 313.

             * *note asyncio.get_event_loop_policy(): 314.

             * *note asyncio.set_event_loop_policy(): 315.

          Users should use *note asyncio.run(): 2f5. or *note
          asyncio.Runner: 2f7. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 316. 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():
          21c. 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(): 31b.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ee. 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: 246.

   * *note symtable: de.:

        * The *note Class.get_methods: 31f. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33c. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33d. 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(): 33e. 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: 340. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 10b.:

        - 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(): 2ad. and *note
          typing.get_args(): 2ae. instead of relying on private
          implementation details.

        - *note typing.ByteString: 343, 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: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 200. 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_: 319. but not *note _layout_: 1e9. 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(): 2ed. is now deprecated.

        * The *note argparse.FileType: 30e. 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:
          347, *note else: 17d, *note for: 348, *note if: 182, *note in:
          349, *note is: 34a. and *note or: 34b.  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: 19c.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 197.: these methods will be required to return
          an instance of ‘float’.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 198.: these methods will be required to
          return an instance of ‘complex’.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 198. 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:
     34c. and *note calendar.FEBRUARY: 34d.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 318. instead of *note
     codecs.open(): 317.  (gh-133038(4))

   * *note codeobject.co_lnotab: 32e.: use the *note
     codeobject.co_lines(): 34e. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 34f.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 350.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 351. '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(): 352. 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(): 353. 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(): 354.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 355. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 355.: *note set_npn_protocols(): 356.
          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():
          357.

        * ‘threading.Event.isSet()’: use *note is_set(): 358.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 359.: use *note
          threading.Thread.daemon: 35a. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35b.: use *note
          threading.Thread.name: 2a2. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35c.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35d.

   * *note typing.Text: 35e. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2aa.  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: 35f.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 111. deprecated functions: *note urlparse():
     360. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11f.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12c.: Testing the truth value of an
     *note Element: 361. 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(): 294. is deprecated: use *note
     sys._clear_internal_caches(): 362. 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: 364.
     opcode with the ‘NB_SUBSCR’ oparg.  (Contributed by Irit Katriel in
     gh-100239(1).)

   * Add the *note BUILD_INTERPOLATION: 365. and *note BUILD_TEMPLATE:
     366. opcodes to construct new *note Interpolation: 16c. and *note
     Template: 16b. instances, respectively.  (Contributed by Lysandros
     Nikolaou and others in gh-132661(2); see also *note PEP 750;
     Template strings: 145.).

   * Remove the ‘BUILD_CONST_KEY_MAP’ opcode.  Use *note BUILD_MAP: 367.
     instead.  (Contributed by Mark Shannon in gh-122160(3).)

   * Replace the ‘LOAD_ASSERTION_ERROR’ opcode with *note
     LOAD_COMMON_CONSTANT: 368. and add support for loading *note
     NotImplementedError: 369.

   * Add the *note LOAD_FAST_BORROW: 36a. and *note
     LOAD_FAST_BORROW_LOAD_FAST_BORROW: 36b. 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: 36c. 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: 36d. instruction.  Generate code
     for *note with: 187. and *note async with: 186. 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: 36e. 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: 146.  (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: 370.; ‘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: 371. and *note JUMP_IF_FALSE: 372.
     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: 373. 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: 374. pseudo instruction, used by *note
     sys.monitoring: e0. to record branch events (such as *note
     BRANCH_LEFT: 297.).  (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: 377. 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: 378. by adding *note
PyInitConfig_AddModule(): 379. which can be used to add a built-in
extension module; a feature previously referred to as the "inittab".

Add *note PyConfig_Get(): 37a. and *note PyConfig_Set(): 37b. 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(): 37d. and *note Py_PACK_FULL_VERSION():
     37e, two new macros for bit-packing Python version numbers.  This
     is useful for comparisons with *note Py_Version: 37f. or *note
     PY_VERSION_HEX: 380.  (Contributed by Petr Viktorin in
     gh-128629(1).)

   * Add *note PyBytes_Join(sep, iterable): 381. 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: 156.):

        * *note PyConfig_Get(): 37a.

        * *note PyConfig_GetInt(): 382.

        * *note PyConfig_Set(): 37b.

        * *note PyConfig_Names(): 383.

     (Contributed by Victor Stinner in gh-107954(3).)

   * Add functions to configure Python initialization (*note PEP 741;
     Python configuration C API: 156.):

        * *note Py_InitializeFromInitConfig(): 384.

        * *note PyInitConfig_AddModule(): 379.

        * *note PyInitConfig_Create(): 385.

        * *note PyInitConfig_Free(): 386.

        * *note PyInitConfig_FreeStrList(): 387.

        * *note PyInitConfig_GetError(): 388.

        * *note PyInitConfig_GetExitCode(): 389.

        * *note PyInitConfig_GetInt(): 38a.

        * *note PyInitConfig_GetStr(): 38b.

        * *note PyInitConfig_GetStrList(): 38c.

        * *note PyInitConfig_HasOption(): 38d.

        * *note PyInitConfig_SetInt(): 38e.

        * *note PyInitConfig_SetStr(): 38f.

        * *note PyInitConfig_SetStrList(): 390.

     (Contributed by Victor Stinner in gh-107954(4).)

   * Add *note Py_fopen(): 391. 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(): 392. function
     should be used to close a file.  (Contributed by Victor Stinner in
     gh-127350(5).)

   * Add *note Py_HashBuffer(): 393. 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(): 394. and *note
     PyImport_ImportModuleAttrString(): 395. 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(): 396. to replace *note PyIter_Next():
     397, which has an ambiguous return value.  (Contributed by Irit
     Katriel and Erlend Aasland in gh-105201(8).)

   * Add *note PyLong_GetSign(): 398. function to get the sign of *note
     int: 19c. objects.  (Contributed by Sergey B Kirpichev in
     gh-116560(9).)

   * Add *note PyLong_IsPositive(): 399, *note PyLong_IsNegative(): 39a.
     and *note PyLong_IsZero(): 39b. for checking if *note PyLongObject:
     39c. 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: 19c. objects:

        * *note PyLong_AsInt32(): 39d.

        * *note PyLong_AsInt64(): 39e.

        * *note PyLong_AsUInt32(): 39f.

        * *note PyLong_AsUInt64(): 3a0.

        * *note PyLong_FromInt32(): 3a1.

        * *note PyLong_FromInt64(): 3a2.

        * *note PyLong_FromUInt32(): 3a3.

        * *note PyLong_FromUInt64(): 3a4.

     (Contributed by Victor Stinner in gh-120389(11).)

   * Add a new import and export API for Python *note int: 19c. objects
     ( PEP 757(12)):

        * *note PyLong_GetNativeLayout(): 3a5.

        * *note PyLong_Export(): 3a6.

        * *note PyLong_FreeExport(): 3a7.

        * *note PyLongWriter_Create(): 3a8.

        * *note PyLongWriter_Finish(): 3a9.

        * *note PyLongWriter_Discard(): 3aa.

     (Contributed by Sergey B Kirpichev and Victor Stinner in
     gh-102471(13).)

   * Add *note PyMonitoring_FireBranchLeftEvent(): 3ab. and *note
     PyMonitoring_FireBranchRightEvent(): 3ac. for generating *note
     BRANCH_LEFT: 297. and *note BRANCH_RIGHT: 298. events,
     respectively.  (Contributed by Mark Shannon in gh-122548(14).)

   * Add *note PyType_Freeze(): 3ad. function to make a type immutable.
     (Contributed by Victor Stinner in gh-121654(15).)

   * Add *note PyType_GetBaseByToken(): 3ae. and *note Py_tp_token: 3af.
     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(): 3b0. 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: 3b1. API to create a Python *note
     str: 16a. object, with the following functions:

        * *note PyUnicodeWriter_Create(): 3b2.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 3b3.

        * *note PyUnicodeWriter_Discard(): 3b4.

        * *note PyUnicodeWriter_Finish(): 3b5.

        * *note PyUnicodeWriter_Format(): 3b6.

        * *note PyUnicodeWriter_WriteASCII(): 3b7.

        * *note PyUnicodeWriter_WriteChar(): 3b8.

        * *note PyUnicodeWriter_WriteRepr(): 3b9.

        * *note PyUnicodeWriter_WriteStr(): 3ba.

        * *note PyUnicodeWriter_WriteSubstring(): 3bb.

        * *note PyUnicodeWriter_WriteUCS4(): 3bc.

        * *note PyUnicodeWriter_WriteUTF8(): 3bd.

        * *note PyUnicodeWriter_WriteWideChar(): 3be.

     (Contributed by Victor Stinner in gh-119182(19).)

   * The ‘k’ and ‘K’ formats in *note PyArg_ParseTuple(): 3bf. and
     similar functions now use *note __index__(): 19f. 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():
     3c0. that produces a Python *note bool: 3c1. object from a C
     integer.  (Contributed by Pablo Galindo in bpo-45325(21).)

   * Add *note PyUnstable_IsImmortal(): 3c2. for determining if an
     object is *note immortal: 292, for debugging purposes.
     (Contributed by Peter Bierma in gh-128509(22).)

   * Add *note PyUnstable_Object_EnableDeferredRefcount(): 3c3. for
     enabling deferred reference counting, as outlined in PEP 703(23).

   * Add *note PyUnstable_Object_IsUniquelyReferenced(): 3c4. as a
     replacement for ‘Py_REFCNT(op) == 1’ on *note free threaded: 1f6.
     builds.  (Contributed by Peter Bierma in gh-133140(24).)

   * Add *note PyUnstable_Object_IsUniqueReferencedTemporary(): 3c5. 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(): 2d1. 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(): 3c7.
     and *note Py_REFCNT(): 2d1. 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: 3c8, *note
     PySequence_Fast_GET_ITEM: 3c9, and *note PySequence_Fast_ITEMS:
     3ca. 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: 3cd. with mutable bases was
     deprecated in Python 3.12, and now raises a *note TypeError: 199.
     (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(): 3ce. API
     instead.  (Contributed by Sam Gross in gh-124296(2).)

   * Remove the private ‘_Py_InitializeMain()’ function.  It was a *note
     provisional API: 3cf. 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(): 3d0. 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: 23f.  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: 23f.  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(): 3bf. and other
     *note argument parsing: 3d3. functions if 'items' contains format
     units which store a *note borrowed buffer: 3d4. or a *note borrowed
     reference: 3d5.  (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(): 3ab. and *note
     PyMonitoring_FireBranchRightEvent(): 3ac.

   * The previously undocumented function *note PySequence_In(): 3d6. is
     now *note soft deprecated: 23f.  Use *note PySequence_Contains():
     3d7. 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(): 3d9.: Use *note
     PyImport_ImportModule(): 3da. instead.

   * *note PyWeakref_GetObject(): 3db. and *note PyWeakref_GET_OBJECT():
     3dc.: Use *note PyWeakref_GetRef(): 3dd. instead.  The
     pythoncapi-compat project(1) can be used to get
     ‘PyWeakref_GetRef()’ on Python 3.12 and older.

   * *note Py_UNICODE: 3de. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3df.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3df.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 16a, such as *note bytes: 193.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e0.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e0.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 193, such as *note str: 16a.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e1.: Use *note
          PyConfig_Get("module_search_paths"): 37a. (*note sys.path:
          3e2.) instead.

        * *note Py_GetPrefix(): 3e3.: Use *note
          PyConfig_Get("base_prefix"): 37a. (*note sys.base_prefix:
          3e4.) instead.  Use ‘PyConfig_Get("prefix")’ (*note
          sys.prefix: 3e5.) if *note virtual environments: 3e6. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e7.: Use *note
          PyConfig_Get("base_exec_prefix"): 37a. (*note
          sys.base_exec_prefix: 3e8.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3e9.) if
          *note virtual environments: 3e6. need to be handled.

        * *note Py_GetProgramFullPath(): 3ea.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetProgramName(): 3ec.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetPythonHome(): 3ed.: Use *note
          PyConfig_Get("home"): 37a. or the *note PYTHONHOME: 3ee.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37a. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f0.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f1. instead.

        * *note PySys_ResetWarnOptions(): 3f2.: Clear *note
          sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f6.: Use *note PyConfig.parser_debug:
          3f7. or *note PyConfig_Get("parser_debug"): 37a. instead.

        * *note Py_VerboseFlag: 3f8.: Use *note PyConfig.verbose: 3f9.
          or *note PyConfig_Get("verbose"): 37a. instead.

        * *note Py_QuietFlag: 3fa.: Use *note PyConfig.quiet: 3fb. or
          *note PyConfig_Get("quiet"): 37a. instead.

        * *note Py_InteractiveFlag: 3fc.: Use *note
          PyConfig.interactive: 3fd. or *note
          PyConfig_Get("interactive"): 37a. instead.

        * *note Py_InspectFlag: 3fe.: Use *note PyConfig.inspect: 3ff.
          or *note PyConfig_Get("inspect"): 37a. instead.

        * *note Py_OptimizeFlag: 400.: Use *note
          PyConfig.optimization_level: 401. or *note
          PyConfig_Get("optimization_level"): 37a. instead.

        * *note Py_NoSiteFlag: 402.: Use *note PyConfig.site_import:
          403. or *note PyConfig_Get("site_import"): 37a. instead.

        * *note Py_BytesWarningFlag: 404.: Use *note
          PyConfig.bytes_warning: 405. or *note
          PyConfig_Get("bytes_warning"): 37a. instead.

        * *note Py_FrozenFlag: 406.: Use *note
          PyConfig.pathconfig_warnings: 407. or *note
          PyConfig_Get("pathconfig_warnings"): 37a. instead.

        * *note Py_IgnoreEnvironmentFlag: 408.: Use *note
          PyConfig.use_environment: 409. or *note
          PyConfig_Get("use_environment"): 37a. instead.

        * *note Py_DontWriteBytecodeFlag: 40a.: Use *note
          PyConfig.write_bytecode: 40b. or *note
          PyConfig_Get("write_bytecode"): 37a. instead.

        * *note Py_NoUserSiteDirectory: 40c.: Use *note
          PyConfig.user_site_directory: 40d. or *note
          PyConfig_Get("user_site_directory"): 37a. instead.

        * *note Py_UnbufferedStdioFlag: 40e.: Use *note
          PyConfig.buffered_stdio: 40f. or *note
          PyConfig_Get("buffered_stdio"): 37a. instead.

        * *note Py_HashRandomizationFlag: 410.: Use *note
          PyConfig.use_hash_seed: 411. and *note PyConfig.hash_seed:
          412. or *note PyConfig_Get("hash_seed"): 37a. instead.

        * *note Py_IsolatedFlag: 413.: Use *note PyConfig.isolated: 414.
          or *note PyConfig_Get("isolated"): 37a. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 415.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 416. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37a. instead.

        * *note Py_LegacyWindowsStdioFlag: 417.: Use *note
          PyConfig.legacy_windows_stdio: 418. or *note
          PyConfig_Get("legacy_windows_stdio"): 37a. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 419. or *note
          PyConfig_Get("filesystem_encoding"): 37a. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41a. or *note
          PyConfig_Get("filesystem_errors"): 37a. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41b. or *note
          PyConfig_Get("utf8_mode"): 37a. instead.  (see *note
          Py_PreInitialize(): 41c.)

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. to set these options.  Or *note
     PyConfig_Get(): 37a. 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(): 381.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 41f.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 420.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 398.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3a8.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 421.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 422.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b2.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b5.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b4.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3b8.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3ba.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bb.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b7.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bd.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 423.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 391.

     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: 425.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 426.: Use *note PyErr_GetRaisedException():
     427. instead.

   * *note PyErr_NormalizeException(): 428.: Use *note
     PyErr_GetRaisedException(): 427. instead.

   * *note PyErr_Restore(): 429.: Use *note PyErr_SetRaisedException():
     42a. instead.

   * *note PyModule_GetFilename(): 42b.: Use *note
     PyModule_GetFilenameObject(): 42c. instead.

   * *note PyOS_AfterFork(): 42d.: Use *note PyOS_AfterFork_Child():
     42e. instead.

   * *note PySlice_GetIndicesEx(): 42f.: Use *note PySlice_Unpack():
     430. and *note PySlice_AdjustIndices(): 431. instead.

   * *note PyUnicode_READY(): 432.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 433.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 434.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 435.: Use *note
          PyThread_tss_alloc(): 436. instead.

        * *note PyThread_delete_key(): 437.: Use *note
          PyThread_tss_free(): 438. instead.

        * *note PyThread_set_key_value(): 439.: Use *note
          PyThread_tss_set(): 43a. instead.

        * *note PyThread_get_key_value(): 43b.: Use *note
          PyThread_tss_get(): 43c. instead.

        * *note PyThread_delete_key_value(): 43d.: Use *note
          PyThread_tss_delete(): 43e. instead.

        * *note PyThread_ReInitTLS(): 43f.: 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: 441.  (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: 442.  (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: 443.
     ‘configure’ option to disable them, or the *note
     -enable-slower-safety: 444. 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: 173. may
     be used to enable the experimental tail call interpreter.  See
     *note 新しいインタープリタ: 150. for further details.

   * To disable the new remote debugging support, use the *note
     -without-remote-debug: 171. ‘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':
447. *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: 44b. as an environment variable.  Downstream source builds
and redistributors can use the *note -enable-experimental-jit=yes-off:
44c. 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: 295. namespace.  *note sys._jit.is_available(): 44d. can be
used to determine if the current executable supports JIT compilation,
while *note sys._jit.is_enabled(): 44e. 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: 1d7. for *note multiprocessing: 98. and *note
     ProcessPoolExecutor: 1d8, instead of 'fork'.

     See *note (1): 1d5. and *note (2): 24b. for details.

     If you encounter *note NameError: 450.s or pickling errors coming
     out of *note multiprocessing: 98. or *note concurrent.futures: 24,
     see the *note forkserver restrictions: 1db.

     This change does not affect Windows or macOS, where *note 'spawn':
     1da. remains the default start method.

   * *note functools.partial: 219. is now a method descriptor.  Wrap it
     in *note staticmethod(): 451. 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: 153, which means
     that the behavior of *note gc.collect(): 1b5. 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(): 452. 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: 2a9. is now an alias for *note typing.Union:
     2aa, causing changes in some behaviors.  See *note above: 2ab. for
     more details.  (Contributed by Jelle Zijlstra in gh-105499(3).)

   * The runtime behavior of annotations has changed in various ways;
     see *note above: 146. 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: 293. 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: 146.

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__: 456. 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(): 457. with the *note FORWARDREF:
160. 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: 232. enum and the *note get_annotations(): 457.
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(): 459. during class
construction and *note annotationlib.get_annotations(): 457. 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: 45b, 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(): 45d. now deletes all interned strings.  This
     is backwards incompatible to any C extension that holds onto an
     interned string after a call to ‘Py_Finalize()’ and is then reused
     after a call to *note Py_Initialize(): 45e.  Any issues arising
     from this behavior will normally result in crashes during the
     execution of the subsequent call to ‘Py_Initialize()’ 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: 45f. C API now raises a *note
     TypeError: 199. if its exception argument is not a *note
     UnicodeError: 460. 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: 3d5. references when possible.  This can lead to smaller
     reference count values compared to previous Python versions.  C API
     extensions that checked *note Py_REFCNT(): 2d1. of ‘1’ to determine
     if an function argument is not referenced by any other code should
     instead use *note PyUnstable_Object_IsUniqueReferencedTemporary():
     3c5. as a safer replacement.

   * Private functions promoted to public C APIs:

        * ‘_PyBytes_Join()’: *note PyBytes_Join(): 381.

        * ‘_PyLong_IsNegative()’: *note PyLong_IsNegative(): 39a.

        * ‘_PyLong_IsPositive()’: *note PyLong_IsPositive(): 399.

        * ‘_PyLong_IsZero()’: *note PyLong_IsZero(): 39b.

        * ‘_PyLong_Sign()’: *note PyLong_GetSign(): 398.

        * ‘_PyUnicodeWriter_Dealloc()’: *note PyUnicodeWriter_Discard():
          3b4.

        * ‘_PyUnicodeWriter_Finish()’: *note PyUnicodeWriter_Finish():
          3b5.

        * ‘_PyUnicodeWriter_Init()’: use *note PyUnicodeWriter_Create():
          3b2.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement)

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement)

        * ‘_PyUnicodeWriter_WriteChar()’: *note
          PyUnicodeWriter_WriteChar(): 3b8.

        * ‘_PyUnicodeWriter_WriteStr()’: *note
          PyUnicodeWriter_WriteStr(): 3ba.

        * ‘_PyUnicodeWriter_WriteSubstring()’: *note
          PyUnicodeWriter_WriteSubstring(): 3bb.

        * ‘_PyUnicode_EQ()’: *note PyUnicode_Equal(): 3b0.

        * ‘_PyUnicode_Equal()’: *note PyUnicode_Equal(): 3b0.

        * ‘_Py_GetConfig()’: *note PyConfig_Get(): 37a. and *note
          PyConfig_GetInt(): 382.

        * ‘_Py_HashBytes()’: *note Py_HashBuffer(): 393.

        * ‘_Py_fopen_obj()’: *note Py_fopen(): 391.

        * ‘PyMutex_IsLocked()’ : *note PyMutex_IsLocked(): 461.

     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,  Next: Notable changes in 3 14 5,  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(): 464. and
     *note PyUnstable_ThreadState_ResetStackProtection(): 465. 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: Notable changes in 3 14 5,  Prev: Notable changes in 3 14 1,  Up: What's new in Python 3 14

1.1.14 Notable changes in 3.14.5
--------------------------------

* Menu:

* gc: gc<2>.


File: python.info,  Node: gc<2>,  Up: Notable changes in 3 14 5

1.1.14.1 gc
...........

   * The incremental garbage collector shipped in Python 3.14.0-3.14.4
     has been reverted back to the generational garbage collector from
     3.13, due to a number of reports(1) of significant memory pressure
     in production environments.  See *note Garbage collection: 153. for
     details.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142516


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
変更履歴: 143. をご覧ください。

参考
....

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
ライブラリリファレンス: 14a. や *note 言語レファレンス: 14b. などを参照
してください。各変更点の実装や設計の理由を網羅的に理解したい方は、該当の
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(): 1c2. が
     *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: 165.
     を無効化した状態での実行をサポート

   * *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: 330. の項目を読み取り専用としてマークするた
     めに使用できます。

   * 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: 1b7. シェルがデフォルトで使われるようになりました。これから
は、ターミナル上で *note REPL: 491. を起動すると、以下の機能が使えます:

   * 複数行の編集。履歴機能もサポート。

   * ‘help’ や ‘exit’ 、 ‘quit’ といったREPL 固有のコマンドが直接サポー
     トされるようになり、関数として呼び出す必要がなくなりました。

   * デフォルトでプロンプトやトレースバックが *note 色付きで表示: 1b9. さ
     れるようになりました。

   * インタラクティブなヘルプが ‘F1’ で閲覧できるようになり、REPLとは別
     にコマンド履歴が記録されるようになりました。

   * ‘F2’ で履歴を閲覧できるようになりました。出力や プロンプト内の
     *note >>>: 492. と *note ...: 493. は表示されません。

   * ‘F3’ で「ペーストモード」に切り替え、長いコードブロックをより簡単に
     貼り付けることができるようになりました (‘F3’ をもう一度押すことで通
     常のプロンプトに戻ることができます)。

新しいインタラクティブシェルを無効化するには、環境変数 *note
PYTHON_BASIC_REPL: 1b8. をセットします。インタラクティブモードの詳細につ
いては *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 制御できます: 1b9.。（この機
     能は 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: 170. によって有効化できます。

使用しているインタープリタがフリースレッドに対応しているかどうかは、
*note python -VV: 49b. を実行するか、 *note sys.version: 49c. に 「
experimental free-threading build」が含まれているかどうかで確認できます
。新しく追加された ‘sys._is_gil_enabled()’ 関数により、 GIL が現在のプロ
セスで実際に有効になっているかを確認できます。

C-API 拡張モジュールは、フリースレッド用に別にビルドする必要があります。
*note GIL: 165. 無効状態での実行に対応している拡張モジュールは、 *note
Py_mod_gil: 482. を使用してください。一段階初期化を使用する C 拡張は
*note PyUnstable_Module_SetGIL(): 49d. を使用することで、 GIL 無効状態で
の実行に対応しているかどうかを指定してください。このような仕組みをいずれ
も使用しないモジュールがインポートされると、環境変数 *note PYTHON_GIL:
49a. か *note -X gil=0: 170. オプションが指定されていない限り、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: 45b. 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:
     1ac. blocks when that global is used in the *note else: 17d. block.
     Previously this raised an erroneous *note SyntaxError: 18f.
     (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: 170.
     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: 170.  (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: 246. and used to signal when operations
     are blocked during *note finalization: 479.  The following
     callables now raise ‘PythonFinalizationError’, instead of
     ‘RuntimeError’:

        * *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: 138. 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: 1a4.  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(): 1c4. 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:
     18e, 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(): 1cd. 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: 1c9. and to custom task factories.

     This affects the following function and methods: *note
     asyncio.create_task(): 1cb, *note asyncio.loop.create_task(): 1cc,
     *note asyncio.TaskGroup.create_task(): 1cd.  (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: 193. 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(): 1c2. 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 ‘replace()’ function and
     implement the replace protocol:

        * *note collections.namedtuple(): 4e0.

        * *note dataclasses.dataclass: 4e1.

        * *note datetime.datetime: 4e2, *note datetime.date: 1fc, *note
          datetime.time: 1fd.

        * *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(): 1c2.
     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: 1e7. 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: 205, in the new 'cache_info' field.  The
     'show_caches' argument to ‘get_instructions()’ 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 色の制御: 1b9.  (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: 215. 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: 2fc. 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: 2ee. 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: 23f.  (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: 170.  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(): 329. 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(): 264. 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: 369. when a path operation isn't
     supported.  (Contributed by Barney Gale in gh-89812(1).)

   * Add a new constructor for creating *note Path: 268. 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(): 273. and *note set_trace(): 274. 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: 137. 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: 184,
     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: 19c. 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: 330. 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: 10b. 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: 1a4. 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: 10b. 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(): 320. 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(): 321. 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 ‘classmethod’, consider using the ‘__wrapped__’
     attribute that was added in Python 3.10.  (Contributed by Raymond
     Hettinger in gh-89519(2).)

   * Raise a *note RuntimeError: 246. 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: 23f.
     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: 268. 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: 10b. module.  (Contributed by Sebastian
     Rittau in gh-92871(1).)

   * Remove the keyword-argument method of creating *note TypedDict:
     330. 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: 10d. 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(): 309. function, deprecated in Python
     3.6.  Use the 'context' parameter instead with an *note SSLContext:
     355. 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: 33b.) 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: 23f. 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:
          200. 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: 327, 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: 23f. 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(): 328, to be removed in
          Python 3.15.  Use *note os.path.isreserved(): 329. to detect
          reserved paths on Windows.  (Contributed by Barney Gale in
          gh-88569(13).)

   * *note platform: af.:

        * Deprecate *note java_ver(): 32a, 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(): 33c.
          function, to be removed in Python 3.16.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33d. 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: 105.:

        * 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: 10b.:

        * Deprecate the undocumented keyword argument syntax for
          creating *note NamedTuple: 32f. 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: 32f. or *note typing.TypedDict: 330. 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(): 331.
          decorator function, to be removed in Python 3.15.  After eight
          years in the *note typing: 10b. 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: 1a4. 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: 11a.:

        * Deprecate the *note getmark(): 332, ‘setmark()’, and *note
          getmarkers(): 333. methods of the *note Wave_read: 334. and
          *note Wave_write: 335. 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: 1a4. 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: 2f1. 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(): 2f4. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a4. 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(): 2f9.  (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: 2fc.

        * *note importlib.resources.abc.TraversableResources: 2fb.

     (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(): 24c. or *note set_start_method(): 24d. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 1d7.

   * *note pathlib: a8.: *note is_relative_to(): 300. and *note
     relative_to(): 2ff.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 1a4.;
     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(): 303.

        * ‘slave_open()’: use *note pty.openpty(): 303.

   * *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: 184.

   * *note urllib: 10f.: ‘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__: 323. on a module while failing to
          set *note __spec__.cached: 324. 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__: 325. on a module while failing to
          set *note __spec__.parent: 326. 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: 327.
          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 pathlib: a8.:

        * *note PurePath.is_reserved(): 328. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 329. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32a. 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(): 32b. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32c. 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: 10a.:

        * *note types.CodeType: 32d.: Accessing *note co_lnotab: 32e.
          was deprecated in PEP 626(3) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10b.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 32f. 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: 330.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(): 331. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10b. module, it has yet to be
          supported by any major type checker.

   * *note wave: 11a.:

        * The *note getmark(): 332, ‘setmark()’, and *note getmarkers():
          333. methods of the *note Wave_read: 334. and *note
          Wave_write: 335. classes have been deprecated since Python
          3.13.

   * *note zipimport: 139.:

        * *note load_module(): 336. has been deprecated since Python
          3.10.  Use *note exec_module(): 337. instead.  (Contributed by
          Jiahao Li in gh-125746(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://peps.python.org/pep-0626/

   (4) https://github.com/python/cpython/issues/101866

   (5) 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__: 339. on a module while failing to
          set *note __spec__.loader: 33a. 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: 33b.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30f. 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: 310.

             * *note asyncio.DefaultEventLoopPolicy: 311.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 312.

             * *note asyncio.WindowsProactorEventLoopPolicy: 313.

             * *note asyncio.get_event_loop_policy(): 314.

             * *note asyncio.set_event_loop_policy(): 315.

          Users should use *note asyncio.run(): 2f5. or *note
          asyncio.Runner: 2f7. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 316. 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():
          21c. 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(): 31b.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ee. 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: 246.

   * *note symtable: de.:

        * The *note Class.get_methods: 31f. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33c. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33d. 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(): 33e. 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: 340. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 10b.:

        - 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(): 2ad. and *note
          typing.get_args(): 2ae. instead of relying on private
          implementation details.

        - *note typing.ByteString: 343, 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: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 200. 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_: 319. but not *note _layout_: 1e9. 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(): 2ed. is now deprecated.

        * The *note argparse.FileType: 30e. 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:
          347, *note else: 17d, *note for: 348, *note if: 182, *note in:
          349, *note is: 34a. and *note or: 34b.  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: 19c.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 197.: these methods will be required to return
          an instance of ‘float’.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 198.: these methods will be required to
          return an instance of ‘complex’.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 198. 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:
     34c. and *note calendar.FEBRUARY: 34d.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 318. instead of *note
     codecs.open(): 317.  (gh-133038(4))

   * *note codeobject.co_lnotab: 32e.: use the *note
     codeobject.co_lines(): 34e. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 34f.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 350.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 351. '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(): 352. 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(): 353. 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(): 354.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 355. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 355.: *note set_npn_protocols(): 356.
          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():
          357.

        * ‘threading.Event.isSet()’: use *note is_set(): 358.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 359.: use *note
          threading.Thread.daemon: 35a. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35b.: use *note
          threading.Thread.name: 2a2. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35c.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35d.

   * *note typing.Text: 35e. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2aa.  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: 35f.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 111. deprecated functions: *note urlparse():
     360. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11f.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12c.: Testing the truth value of an
     *note Element: 361. 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(): 294. is deprecated: use *note
     sys._clear_internal_caches(): 362. 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: 165. (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(): 41f. functions, which behave similarly
     to *note PyDict_GetItemWithError(): 5e1, but return a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d5.
     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: 3d5.
     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(): 420. 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: 3d5. 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: 3d5. 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:
     3d5.  (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: 3d5.
     (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: 19c.
     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(): 423. 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: 106. 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(): 421. 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(): 3dd. function as an alternative
     to *note PyWeakref_GetObject(): 3db. 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): 262. instead.

        * ‘PyObject_CheckReadBuffer()’: Use *note
          PyObject_CheckBuffer(): 639. to test whether the object
          supports the buffer protocol.  Note that
          ‘PyObject_CheckBuffer()’ doesn't guarantee that *note
          PyObject_GetBuffer(): 63a. will succeed.  To test if the
          object is actually readable, see the next example of
          ‘PyObject_GetBuffer()’.

        * ‘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: 184. or ‘NULL’,
               whereas the removed functions checked argument types and
               accepted ‘NULL’ positional and keyword arguments.  To
               replace ‘PyEval_CallObjectWithKeywords(func, NULL,
               kwargs)’ with ‘PyObject_Call()’, 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: 418. (on Windows).

        * ‘_Py_SetProgramFullPath()’: Set *note PyConfig.executable:
          645. instead.

     Use the new *note PyConfig: 3f5. 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 ‘PyInterpreterState_Get()’ 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(): 3f2.: Clear *note
          sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

        * *note Py_GetExecPrefix(): 3e7.: Get *note sys.exec_prefix:
          3e9. instead.

        * *note Py_GetPath(): 3e1.: Get *note sys.path: 3e2. instead.

        * *note Py_GetPrefix(): 3e3.: Get *note sys.prefix: 3e5.
          instead.

        * *note Py_GetProgramFullPath(): 3ea.: Get *note sys.executable:
          3eb. instead.

        * *note Py_GetProgramName(): 3ec.: Get *note sys.executable:
          3eb. instead.

        * *note Py_GetPythonHome(): 3ed.: Get *note PyConfig.home: 3f1.
          or the *note PYTHONHOME: 3ee. environment variable instead.

     (Contributed by Victor Stinner in gh-105145(1).)

   * *note Soft deprecate: 23f. the *note PyEval_GetBuiltins(): 5f4,
     *note PyEval_GetGlobals(): 5f6, and *note PyEval_GetLocals(): 5f8.
     functions, which return a *note borrowed reference: 3d5.  (Soft
     deprecated as part of PEP 667(2).)

   * Deprecate the *note PyImport_ImportModuleNoBlock(): 3d9. function,
     which is just an alias to *note PyImport_ImportModule(): 3da. since
     Python 3.3.  (Contributed by Victor Stinner in gh-105396(3).)

   * *note Soft deprecate: 23f. 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(): 3db. and *note
     PyWeakref_GET_OBJECT(): 3dc. functions, which return a *note
     borrowed reference: 3d5.  Replace them with the new *note
     PyWeakref_GetRef(): 3dd. function, which returns a *note strong
     reference: 5e2.  The pythoncapi-compat project(6) can be used to
     get ‘PyWeakref_GetRef()’ 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: 3cd. 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(): 3d9.: Use *note
     PyImport_ImportModule(): 3da. instead.

   * *note PyWeakref_GetObject(): 3db. and *note PyWeakref_GET_OBJECT():
     3dc.: Use *note PyWeakref_GetRef(): 3dd. instead.  The
     pythoncapi-compat project(1) can be used to get
     ‘PyWeakref_GetRef()’ on Python 3.12 and older.

   * *note Py_UNICODE: 3de. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3df.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3df.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 16a, such as *note bytes: 193.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e0.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e0.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 193, such as *note str: 16a.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e1.: Use *note
          PyConfig_Get("module_search_paths"): 37a. (*note sys.path:
          3e2.) instead.

        * *note Py_GetPrefix(): 3e3.: Use *note
          PyConfig_Get("base_prefix"): 37a. (*note sys.base_prefix:
          3e4.) instead.  Use ‘PyConfig_Get("prefix")’ (*note
          sys.prefix: 3e5.) if *note virtual environments: 3e6. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e7.: Use *note
          PyConfig_Get("base_exec_prefix"): 37a. (*note
          sys.base_exec_prefix: 3e8.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3e9.) if
          *note virtual environments: 3e6. need to be handled.

        * *note Py_GetProgramFullPath(): 3ea.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetProgramName(): 3ec.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetPythonHome(): 3ed.: Use *note
          PyConfig_Get("home"): 37a. or the *note PYTHONHOME: 3ee.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37a. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f0.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f1. instead.

        * *note PySys_ResetWarnOptions(): 3f2.: Clear *note
          sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f6.: Use *note PyConfig.parser_debug:
          3f7. or *note PyConfig_Get("parser_debug"): 37a. instead.

        * *note Py_VerboseFlag: 3f8.: Use *note PyConfig.verbose: 3f9.
          or *note PyConfig_Get("verbose"): 37a. instead.

        * *note Py_QuietFlag: 3fa.: Use *note PyConfig.quiet: 3fb. or
          *note PyConfig_Get("quiet"): 37a. instead.

        * *note Py_InteractiveFlag: 3fc.: Use *note
          PyConfig.interactive: 3fd. or *note
          PyConfig_Get("interactive"): 37a. instead.

        * *note Py_InspectFlag: 3fe.: Use *note PyConfig.inspect: 3ff.
          or *note PyConfig_Get("inspect"): 37a. instead.

        * *note Py_OptimizeFlag: 400.: Use *note
          PyConfig.optimization_level: 401. or *note
          PyConfig_Get("optimization_level"): 37a. instead.

        * *note Py_NoSiteFlag: 402.: Use *note PyConfig.site_import:
          403. or *note PyConfig_Get("site_import"): 37a. instead.

        * *note Py_BytesWarningFlag: 404.: Use *note
          PyConfig.bytes_warning: 405. or *note
          PyConfig_Get("bytes_warning"): 37a. instead.

        * *note Py_FrozenFlag: 406.: Use *note
          PyConfig.pathconfig_warnings: 407. or *note
          PyConfig_Get("pathconfig_warnings"): 37a. instead.

        * *note Py_IgnoreEnvironmentFlag: 408.: Use *note
          PyConfig.use_environment: 409. or *note
          PyConfig_Get("use_environment"): 37a. instead.

        * *note Py_DontWriteBytecodeFlag: 40a.: Use *note
          PyConfig.write_bytecode: 40b. or *note
          PyConfig_Get("write_bytecode"): 37a. instead.

        * *note Py_NoUserSiteDirectory: 40c.: Use *note
          PyConfig.user_site_directory: 40d. or *note
          PyConfig_Get("user_site_directory"): 37a. instead.

        * *note Py_UnbufferedStdioFlag: 40e.: Use *note
          PyConfig.buffered_stdio: 40f. or *note
          PyConfig_Get("buffered_stdio"): 37a. instead.

        * *note Py_HashRandomizationFlag: 410.: Use *note
          PyConfig.use_hash_seed: 411. and *note PyConfig.hash_seed:
          412. or *note PyConfig_Get("hash_seed"): 37a. instead.

        * *note Py_IsolatedFlag: 413.: Use *note PyConfig.isolated: 414.
          or *note PyConfig_Get("isolated"): 37a. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 415.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 416. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37a. instead.

        * *note Py_LegacyWindowsStdioFlag: 417.: Use *note
          PyConfig.legacy_windows_stdio: 418. or *note
          PyConfig_Get("legacy_windows_stdio"): 37a. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 419. or *note
          PyConfig_Get("filesystem_encoding"): 37a. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41a. or *note
          PyConfig_Get("filesystem_errors"): 37a. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41b. or *note
          PyConfig_Get("utf8_mode"): 37a. instead.  (see *note
          Py_PreInitialize(): 41c.)

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. to set these options.  Or *note
     PyConfig_Get(): 37a. 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(): 381.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 41f.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 420.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 398.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3a8.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 421.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 422.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b2.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b5.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b4.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3b8.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3ba.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bb.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b7.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bd.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 423.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 391.

     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: 425.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 426.: Use *note PyErr_GetRaisedException():
     427. instead.

   * *note PyErr_NormalizeException(): 428.: Use *note
     PyErr_GetRaisedException(): 427. instead.

   * *note PyErr_Restore(): 429.: Use *note PyErr_SetRaisedException():
     42a. instead.

   * *note PyModule_GetFilename(): 42b.: Use *note
     PyModule_GetFilenameObject(): 42c. instead.

   * *note PyOS_AfterFork(): 42d.: Use *note PyOS_AfterFork_Child():
     42e. instead.

   * *note PySlice_GetIndicesEx(): 42f.: Use *note PySlice_Unpack():
     430. and *note PySlice_AdjustIndices(): 431. instead.

   * *note PyUnicode_READY(): 432.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 433.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 434.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 435.: Use *note
          PyThread_tss_alloc(): 436. instead.

        * *note PyThread_delete_key(): 437.: Use *note
          PyThread_tss_free(): 438. instead.

        * *note PyThread_set_key_value(): 439.: Use *note
          PyThread_tss_set(): 43a. instead.

        * *note PyThread_get_key_value(): 43b.: Use *note
          PyThread_tss_get(): 43c. instead.

        * *note PyThread_delete_key_value(): 43d.: Use *note
          PyThread_tss_delete(): 43e. instead.

        * *note PyThread_ReInitTLS(): 43f.: 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: 219. now emits a *note FutureWarning: 659.
     when used as a method.  The behavior will change in future Python
     versions.  Wrap it in *note staticmethod(): 451. if you want to
     preserve the old behavior.  (Contributed by Serhiy Storchaka in
     gh-121027(5).)

   * An *note OSError: 2c2. 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 ‘PyEval_GetLocals()’ 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
          ‘PyEval_GetLocals()’ 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(): 420. 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(): 421.;

        * ‘_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(): 423.;

        * ‘_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: 170. 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
変更履歴: 143. をご覧ください。

参考
....

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 ジェネリック: 1a2. と *note 型エイリアス:
66e. を静的型チェッカーで使用する際の人間工学を改善します。

この記事は全ての新機能の完全な仕様を提供しようとするものではなく、便利な
概要について説明をするものです。 全詳細については、 *note
ライブラリリファレンス: 14a. や *note 言語リファレンス: 14b. などのドキ
ュメントを参照してください。 変更の実装や設計原理について完全に理解した
い場合は、特定の新機能の 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: 450, *note ImportError: 65b, *note SyntaxError:
     18f. 例外に対する *note 'Did you mean ...'  サジェストを改善: 672.
     しました

Python のデータモデルの改善:

   * *note PEP 688: 673, Python の *note バッファプロトコル: 262. を使用
     します

標準ライブラリーの顕著な改善

   * *note pathlib.Path: 268. クラスがサブクラス化をサポートするようにな
     りました

   * *note os: a5. モジュールは Windows サポートのためにいくつかの改良が
     加えられました

   * *note sqlite3: d4. モジュールに *note
     コマンドライン・インターフェース: 674. が追加されました

   * *note runtime-checkable プロトコル: 675. に対する *note
     isinstance(): 2af. のチェックは、2倍～20倍のスピードアップを実現し
     ます

   * *note asyncio: b. パッケージは多くのパフォーマンスを向上させ、いく
     つかのベンチマークでは75%のスピードアップを示しました。

   * *note uuid: 117. モジュールに *note
     コマンドライン・インターフェース: 676. が追加されました

   * *note PEP 701: 66f. の変更により、 *note tokenize: 102. モジュール
     によるトークンの生成は最大で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: 330. を使用して *note
     **kwargs: 67b. をアノテートします

   * *note PEP 698: 67c, *note typing.override(): 67d. デコレータ

重要な非推奨化、削除または制限:

   * PEP 623(2): Python の C API の Unicode オブジェクトから ‘wstr’ を削
     除し、全ての *note str: 16a. オブジェクトのサイズを少なくとも 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: 118. で作成された仮想環境には ‘setuptools’
     をプリインストールしません。これは ‘distutils’, ‘setuptools’,
     ‘pkg_resources’, ‘easy_install’ がデフォルトでは利用できなることを
     意味します。これらを利用するには、 *note 有効化された: 67e. 仮想環
     境で ‘pip install setuptools’ を実行してください。

   * ‘asynchat’, ‘asyncore’, ‘imp’ モジュールが、いくつかの *note
     unittest.TestCase: 2b5. *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: 2b0. のイ
ンスタンスを作成します:

     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 アノテーション: 15d. もアノテーションスコープで評価されます。

より詳しくは 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: 18f. が発生し、ユーザーは
     他の利用可能なクォート( 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: 18f. を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. を定義します。呼び出し
、戻り値、行、例外、ジャンプなどを含む幅広いイベントをカバーします。つま
り、使用した分だけ料金を支払い、オーバーヘッドがほぼゼロのデバッガーとカ
バレッジツールのサポートを提供します。詳細については ‘sys.monitoring’ を
参照してください。

(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 バッファプロトコル: 262. を利用
する方法を導入します。 *note __buffer__(): 68c. メソッドを実装するクラス
は今やバッファ型として利用可能です。

新規追加された *note collections.abc.Buffer: 341. 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: 450. 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: 450. exceptions
     for instances.  Now if a ‘NameError’ 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: 18f. 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: 10b. 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: 10b. 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: 18f. 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: 1af, instead of *note
     DeprecationWarning: 1a4.  For example, ‘re.compile("\d+\.\d+")’ now
     emits a ‘SyntaxWarning’ (‘"\d"’ is an invalid escape sequence, use
     raw strings for regular expression: ‘re.compile(r"\d+\.\d+")’).  In
     a future Python version, *note SyntaxError: 18f. will eventually be
     raised, instead of ‘SyntaxWarning’.  (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: 1af,
     instead of *note DeprecationWarning: 1a4.  In a future Python
     version they will be eventually a *note SyntaxError: 18f.
     (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: 246.  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 ‘ExceptionGroup’.  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: 3c1.
     and *note int: 19c.  (Contributed by Serhiy Storchaka in
     gh-60203(10).)

   * *note memoryview: 166. 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(): 1c4. now raises *note SyntaxError: 18f. instead
     of *note ValueError: 2ee. 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: 170, 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: 1a2.  (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(): 2f5. 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: 215. 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(): 30f.  (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(): 26f. 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: 268, 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(): 2ff. 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(): 354. 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: 102. 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 ‘tokenize’ 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(): 2af. 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(): 2af.
     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(): 2af. 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: 330. and *note typing.NamedTuple: 32f.
     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: 1c9. 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: 102. module.  (Contributed by Marta Gómez Macías
     and Pablo Galindo in gh-102856(8).)

   * Speed up *note super(): 1a7. 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.  ‘LOAD_ATTR’ 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 ‘LOAD_LOCALS’
     plus ‘LOAD_FROM_DICT_OR_DEREF’.  (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 ‘ast’ features have been deprecated in
     documentation since Python 3.8, now cause a *note
     DeprecationWarning: 1a4. 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: 2f1. 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(): 2f4. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a4. 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:
     34c. and *note calendar.FEBRUARY: 34d.  (Contributed by Prince
     Roshan in gh-103636(6).)

   * *note collections.abc: 1f.: Deprecated *note
     collections.abc.ByteString: 340.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 262. at runtime.  For use in
     type annotations, either use *note Buffer: 341. 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: 193. and *note
     bytearray: 342.  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: 166. 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(): 34f. and *note utcfromtimestamp(): 350. 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(): 2f9.  (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: 2fc.

        * *note importlib.resources.abc.TraversableResources: 2fb.

     (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
     ‘multiprocessing’ 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(): 24c. or *note
     set_start_method(): 24d. APIs to explicitly specify when your code
     'requires' ‘'fork'’.  See *note contexts and start methods: 1d7.

   * *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: 1a4. 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(): 26f. 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: 1a4. 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 ‘os.fork()’
          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
     ‘multiprocessing’ start method such as ‘"spawn"’ or ‘"forkserver"’.

   * *note shutil: ca.: The 'onerror' argument of *note shutil.rmtree():
     354. 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: 1a4. 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: 184.  Starting from Python 3.14, using named
          placeholders with parameters supplied as a sequence will raise
          a *note ProgrammingError: 307.  (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: 10b.:

        * *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: 343, deprecated since Python 3.9, now
          causes a *note DeprecationWarning: 1a4. to be emitted when it
          is used.  (Contributed by Alex Waygood in gh-91896(23).)

   * *note xml.etree.ElementTree: 12c.: The module now emits *note
     DeprecationWarning: 1a4. when testing the truth value of an *note
     xml.etree.ElementTree.Element: 361.  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: 1a4. is now raised when *note
     __package__: 325. on a module differs from *note __spec__.parent:
     326. (previously it was *note ImportWarning: 71e.).  (Contributed
     by Brett Cannon in gh-65961(26).)

   * Setting *note __package__: 325. or *note __cached__: 323. 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: 32e. on code objects was deprecated in
     Python 3.10 via PEP 626(29), but it only got a proper *note
     DeprecationWarning: 1a4. 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: 1a4. 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: 2f1. 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(): 2f4. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a4. 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(): 2f9.  (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: 2fc.

        * *note importlib.resources.abc.TraversableResources: 2fb.

     (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(): 24c. or *note set_start_method(): 24d. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 1d7.

   * *note pathlib: a8.: *note is_relative_to(): 300. and *note
     relative_to(): 2ff.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 1a4.;
     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(): 303.

        * ‘slave_open()’: use *note pty.openpty(): 303.

   * *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: 184.

   * *note urllib: 10f.: ‘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__: 323. on a module while failing to
          set *note __spec__.cached: 324. 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__: 325. on a module while failing to
          set *note __spec__.parent: 326. 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: 327.
          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 pathlib: a8.:

        * *note PurePath.is_reserved(): 328. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 329. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32a. 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(): 32b. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32c. 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: 10a.:

        * *note types.CodeType: 32d.: Accessing *note co_lnotab: 32e.
          was deprecated in PEP 626(3) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10b.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 32f. 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: 330.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(): 331. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10b. module, it has yet to be
          supported by any major type checker.

   * *note wave: 11a.:

        * The *note getmark(): 332, ‘setmark()’, and *note getmarkers():
          333. methods of the *note Wave_read: 334. and *note
          Wave_write: 335. classes have been deprecated since Python
          3.13.

   * *note zipimport: 139.:

        * *note load_module(): 336. has been deprecated since Python
          3.10.  Use *note exec_module(): 337. instead.  (Contributed by
          Jiahao Li in gh-125746(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://peps.python.org/pep-0626/

   (4) https://github.com/python/cpython/issues/101866

   (5) 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__: 339. on a module while failing to
          set *note __spec__.loader: 33a. 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: 33b.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30f. 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: 310.

             * *note asyncio.DefaultEventLoopPolicy: 311.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 312.

             * *note asyncio.WindowsProactorEventLoopPolicy: 313.

             * *note asyncio.get_event_loop_policy(): 314.

             * *note asyncio.set_event_loop_policy(): 315.

          Users should use *note asyncio.run(): 2f5. or *note
          asyncio.Runner: 2f7. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 316. 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():
          21c. 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(): 31b.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ee. 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: 246.

   * *note symtable: de.:

        * The *note Class.get_methods: 31f. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33c. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33d. 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(): 33e. 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: 340. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 10b.:

        - 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(): 2ad. and *note
          typing.get_args(): 2ae. instead of relying on private
          implementation details.

        - *note typing.ByteString: 343, 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: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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(): 2ed. is now deprecated.

        * The *note argparse.FileType: 30e. 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:
          347, *note else: 17d, *note for: 348, *note if: 182, *note in:
          349, *note is: 34a. and *note or: 34b.  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: 19c.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 197.: these methods will be required to return
          an instance of ‘float’.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 198.: these methods will be required to
          return an instance of ‘complex’.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 198. 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:
     34c. and *note calendar.FEBRUARY: 34d.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 318. instead of *note
     codecs.open(): 317.  (gh-133038(4))

   * *note codeobject.co_lnotab: 32e.: use the *note
     codeobject.co_lines(): 34e. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 34f.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 350.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 351. '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(): 352. 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(): 353. 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(): 354.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 355. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 355.: *note set_npn_protocols(): 356.
          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():
          357.

        * ‘threading.Event.isSet()’: use *note is_set(): 358.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 359.: use *note
          threading.Thread.daemon: 35a. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35b.: use *note
          threading.Thread.name: 2a2. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35c.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35d.

   * *note typing.Text: 35e. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2aa.  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: 35f.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 111. deprecated functions: *note urlparse():
     360. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11f.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12c.: Testing the truth value of an
     *note Element: 361. 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(): 294. is deprecated: use *note
     sys._clear_internal_caches(): 362. 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:
     118.

     ‘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 ‘pbkdf2_hmac()’ 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(): 351.
                                                
                                                
          ‘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(): 318. instead.
     The ‘open()’ (*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: 16a. 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: 355. 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: 10d. features:

        * A number of *note TestCase: 2b5. 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: 2b5. 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: 11c.
     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: 12c. 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: 139.'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
     ‘imaplib’) 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: 199.  Also, the
     exception raised for non-integer values such as ‘randrange(10.5)’
     or ‘randrange('10')’ has been changed from *note ValueError: 2ee.
     to ‘TypeError’.  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: 1bf. 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: 342. and *note memoryview: 166. types: only the
     exact *note bytes: 193. 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
     ‘syslog.openlog()’ 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: 3cd.).  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(): 3ce, *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(): 427. and *note
     PyErr_SetRaisedException(): 42a. 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(): 426. and *note PyErr_Restore():
     429.  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(): 433, 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(): 3bf.
     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 ‘Py_TPFLAGS_MANAGED_DICT’ 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: 342. and *note memoryview:
     166. types: only the exact *note bytes: 193. 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():
          17a. from Python.

   * *note PyOS_InputHook: 7a4. and *note PyOS_ReadlineFunctionPointer:
     7a5. are no longer called in *note subinterpreters: 164.  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: 39c. has had its internals changed for better
     performance.  Although the internals of ‘PyLongObject’ 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
     ‘PyLongObject’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: 3f6.: use *note PyConfig.parser_debug:
          3f7.

        * *note Py_VerboseFlag: 3f8.: use *note PyConfig.verbose: 3f9.

        * *note Py_QuietFlag: 3fa.: use *note PyConfig.quiet: 3fb.

        * *note Py_InteractiveFlag: 3fc.: use *note
          PyConfig.interactive: 3fd.

        * *note Py_InspectFlag: 3fe.: use *note PyConfig.inspect: 3ff.

        * *note Py_OptimizeFlag: 400.: use *note
          PyConfig.optimization_level: 401.

        * *note Py_NoSiteFlag: 402.: use *note PyConfig.site_import:
          403.

        * *note Py_BytesWarningFlag: 404.: use *note
          PyConfig.bytes_warning: 405.

        * *note Py_FrozenFlag: 406.: use *note
          PyConfig.pathconfig_warnings: 407.

        * *note Py_IgnoreEnvironmentFlag: 408.: use *note
          PyConfig.use_environment: 409.

        * *note Py_DontWriteBytecodeFlag: 40a.: use *note
          PyConfig.write_bytecode: 40b.

        * *note Py_NoUserSiteDirectory: 40c.: use *note
          PyConfig.user_site_directory: 40d.

        * *note Py_UnbufferedStdioFlag: 40e.: use *note
          PyConfig.buffered_stdio: 40f.

        * *note Py_HashRandomizationFlag: 410.: use *note
          PyConfig.use_hash_seed: 411. and *note PyConfig.hash_seed:
          412.

        * *note Py_IsolatedFlag: 413.: use *note PyConfig.isolated: 414.

        * *note Py_LegacyWindowsFSEncodingFlag: 415.: use *note
          PyPreConfig.legacy_windows_fs_encoding: 416.

        * *note Py_LegacyWindowsStdioFlag: 417.: use *note
          PyConfig.legacy_windows_stdio: 418.

        * ‘Py_FileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 419.

        * ‘Py_HasFileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 419.

        * ‘Py_FileSystemDefaultEncodeErrors’: use *note
          PyConfig.filesystem_errors: 41a.

        * ‘Py_UTF8Mode’: use *note PyPreConfig.utf8_mode: 41b. (see
          *note Py_PreInitialize(): 41c.)

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. instead.  (Contributed by Victor Stinner in
     gh-77782(3).)

   * Creating *note immutable types: 3cd. 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(): 426. and *note PyErr_Restore(): 429. are
     deprecated.  Use *note PyErr_GetRaisedException(): 427. and *note
     PyErr_SetRaisedException(): 42a. instead.  (Contributed by Mark
     Shannon in gh-101578(6).)

   * ‘PyErr_Display()’ is deprecated.  Use *note
     PyErr_DisplayException(): 433. 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: 3cd. 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(): 3d9.: Use *note
     PyImport_ImportModule(): 3da. instead.

   * *note PyWeakref_GetObject(): 3db. and *note PyWeakref_GET_OBJECT():
     3dc.: Use *note PyWeakref_GetRef(): 3dd. instead.  The
     pythoncapi-compat project(1) can be used to get
     ‘PyWeakref_GetRef()’ on Python 3.12 and older.

   * *note Py_UNICODE: 3de. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3df.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3df.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 16a, such as *note bytes: 193.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e0.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e0.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 193, such as *note str: 16a.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e1.: Use *note
          PyConfig_Get("module_search_paths"): 37a. (*note sys.path:
          3e2.) instead.

        * *note Py_GetPrefix(): 3e3.: Use *note
          PyConfig_Get("base_prefix"): 37a. (*note sys.base_prefix:
          3e4.) instead.  Use ‘PyConfig_Get("prefix")’ (*note
          sys.prefix: 3e5.) if *note virtual environments: 3e6. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e7.: Use *note
          PyConfig_Get("base_exec_prefix"): 37a. (*note
          sys.base_exec_prefix: 3e8.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3e9.) if
          *note virtual environments: 3e6. need to be handled.

        * *note Py_GetProgramFullPath(): 3ea.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetProgramName(): 3ec.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetPythonHome(): 3ed.: Use *note
          PyConfig_Get("home"): 37a. or the *note PYTHONHOME: 3ee.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37a. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f0.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f1. instead.

        * *note PySys_ResetWarnOptions(): 3f2.: Clear *note
          sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f6.: Use *note PyConfig.parser_debug:
          3f7. or *note PyConfig_Get("parser_debug"): 37a. instead.

        * *note Py_VerboseFlag: 3f8.: Use *note PyConfig.verbose: 3f9.
          or *note PyConfig_Get("verbose"): 37a. instead.

        * *note Py_QuietFlag: 3fa.: Use *note PyConfig.quiet: 3fb. or
          *note PyConfig_Get("quiet"): 37a. instead.

        * *note Py_InteractiveFlag: 3fc.: Use *note
          PyConfig.interactive: 3fd. or *note
          PyConfig_Get("interactive"): 37a. instead.

        * *note Py_InspectFlag: 3fe.: Use *note PyConfig.inspect: 3ff.
          or *note PyConfig_Get("inspect"): 37a. instead.

        * *note Py_OptimizeFlag: 400.: Use *note
          PyConfig.optimization_level: 401. or *note
          PyConfig_Get("optimization_level"): 37a. instead.

        * *note Py_NoSiteFlag: 402.: Use *note PyConfig.site_import:
          403. or *note PyConfig_Get("site_import"): 37a. instead.

        * *note Py_BytesWarningFlag: 404.: Use *note
          PyConfig.bytes_warning: 405. or *note
          PyConfig_Get("bytes_warning"): 37a. instead.

        * *note Py_FrozenFlag: 406.: Use *note
          PyConfig.pathconfig_warnings: 407. or *note
          PyConfig_Get("pathconfig_warnings"): 37a. instead.

        * *note Py_IgnoreEnvironmentFlag: 408.: Use *note
          PyConfig.use_environment: 409. or *note
          PyConfig_Get("use_environment"): 37a. instead.

        * *note Py_DontWriteBytecodeFlag: 40a.: Use *note
          PyConfig.write_bytecode: 40b. or *note
          PyConfig_Get("write_bytecode"): 37a. instead.

        * *note Py_NoUserSiteDirectory: 40c.: Use *note
          PyConfig.user_site_directory: 40d. or *note
          PyConfig_Get("user_site_directory"): 37a. instead.

        * *note Py_UnbufferedStdioFlag: 40e.: Use *note
          PyConfig.buffered_stdio: 40f. or *note
          PyConfig_Get("buffered_stdio"): 37a. instead.

        * *note Py_HashRandomizationFlag: 410.: Use *note
          PyConfig.use_hash_seed: 411. and *note PyConfig.hash_seed:
          412. or *note PyConfig_Get("hash_seed"): 37a. instead.

        * *note Py_IsolatedFlag: 413.: Use *note PyConfig.isolated: 414.
          or *note PyConfig_Get("isolated"): 37a. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 415.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 416. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37a. instead.

        * *note Py_LegacyWindowsStdioFlag: 417.: Use *note
          PyConfig.legacy_windows_stdio: 418. or *note
          PyConfig_Get("legacy_windows_stdio"): 37a. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 419. or *note
          PyConfig_Get("filesystem_encoding"): 37a. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41a. or *note
          PyConfig_Get("filesystem_errors"): 37a. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41b. or *note
          PyConfig_Get("utf8_mode"): 37a. instead.  (see *note
          Py_PreInitialize(): 41c.)

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. to set these options.  Or *note
     PyConfig_Get(): 37a. 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: 425.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 426.: Use *note PyErr_GetRaisedException():
     427. instead.

   * *note PyErr_NormalizeException(): 428.: Use *note
     PyErr_GetRaisedException(): 427. instead.

   * *note PyErr_Restore(): 429.: Use *note PyErr_SetRaisedException():
     42a. instead.

   * *note PyModule_GetFilename(): 42b.: Use *note
     PyModule_GetFilenameObject(): 42c. instead.

   * *note PyOS_AfterFork(): 42d.: Use *note PyOS_AfterFork_Child():
     42e. instead.

   * *note PySlice_GetIndicesEx(): 42f.: Use *note PySlice_Unpack():
     430. and *note PySlice_AdjustIndices(): 431. instead.

   * *note PyUnicode_READY(): 432.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 433.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 434.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 435.: Use *note
          PyThread_tss_alloc(): 436. instead.

        * *note PyThread_delete_key(): 437.: Use *note
          PyThread_tss_free(): 438. instead.

        * *note PyThread_set_key_value(): 439.: Use *note
          PyThread_tss_set(): 43a. instead.

        * *note PyThread_get_key_value(): 43b.: Use *note
          PyThread_tss_get(): 43c. instead.

        * *note PyThread_delete_key_value(): 43d.: Use *note
          PyThread_tss_delete(): 43e. instead.

        * *note PyThread_ReInitTLS(): 43f.: 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
変更履歴: 143. をご覧ください。

* 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: 103. — TOML(2) のパースを標準ライブラリ
     でサポート

インタープリタの改善:

   * *note PEP 657; トレースバックのエラー位置の詳細化: 7c0.

   * 新しい *note -P: 7c1. コマンドライン引数と *note PYTHONSAFEPATH:
     7c2. 環境変数により、 *note 安全でない可能性のあるパス: 7c3. を
     *note sys.path: 3e2. に自動的に先頭に付加しないようにします。

新しい型ヒントの機能:

   * *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: 184. オブジェクトや複数の関数呼び出しを処理すると
きにも役立ちます:

     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: 170. コマンドライン引数または
     *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*: 1ad. 構文は、 *note except: 1ac. を例外グループのサブグループに
マッチするように一般化したものです。

より詳しくは 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: 10b. 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 ‘TypeVarTuple’ 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: 330. 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: 45b.) 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: 348.
     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: 199. is now raised instead of an *note
     AttributeError: 5f0. in *note with: 187. statements and *note
     contextlib.ExitStack.enter_context(): 7ee. for objects that do not
     support the *note context manager: 1e3. protocol, and in *note
     async with: 186. 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: 342, *note set: 185, *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
     ‘object.__getstate__()’ 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: 3e2. of the script's
     directory when running a script, or the current directory when
     using *note -c: 1a9. and *note -m: 23e.  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 Format specification
     mini-language: 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: 3e2.  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: 16a. and *note bytes: 193. 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:
     198. and *note __bytes__(): 7fe. for *note bytes: 193. 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: 16a, *note bytes: 193, 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: 1ac. 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:
     3e2.  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: 170. 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: 19c. and *note str: 16a. in bases
     other than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such
     as base 10 (decimal) now raises a *note ValueError: 2ee. 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: 103.: For parsing TOML(1). See PEP 680(2) for more
     details.  (Contributed by Taneli Hukkinen in bpo-40059(3).)

   * *note wsgiref.types: 123.: 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(): 1cb. 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: 2f7. class, which exposes the machinery
     used by *note run(): 2f5.  (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: 316. 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: 1c9.  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: 184, *note list: 24f. or *note set: 185.
     (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(): 16a, *note format(): 19a.
     and *note f-string: 66b.s).

   * Changed *note Enum.__format__(): 832. (the default for *note
     format(): 19a, *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: 349./*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: 215.
     from string.  (Contributed by Sergey B Kirpichev in bpo-44258(2).)

   * *note Fraction: 215. 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: 2a9. and *note typing.Union: 2aa. 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 ‘compress()’ 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(): 866. to get the current locale
     encoding.  It is similar to ‘locale.getpreferredencoding(False)’
     but ignores the *note Python UTF-8 Mode: 867.


File: python.info,  Node: logging,  Next: math<4>,  Prev: locale<3>,  Up: 改良されたモジュール<3>

1.4.7.14 logging
................

   * Added *note getLevelNamesMapping(): 86a. to return a mapping from
     logging level names (e.g.  ‘'CRITICAL'’) to the values of their
     corresponding *note ロギングレベル: 86b. (e.g.  ‘50’, by default).
     (Contributed by Andrei Kulakovin in gh-88024(1).)

   * Added a *note createSocket(): 86c. method to *note SysLogHandler:
     86d, to match *note SocketHandler.createSocket(): 86e.  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(): 871.: return 2 raised to the power of x.
     (Contributed by Gideon Mitchell in bpo-45917(1).)

   * Add *note math.cbrt(): 872.: return the cube root of x.
     (Contributed by Ajith Ramachandran in bpo-44357(2).)

   * The behaviour of two *note math.pow(): 873. 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: 2ee.  (Contributed by Mark Dickinson in bpo-44339(3).)

   * The *note math.nan: 874. 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:
     87b. or *note altsep: 87c.  (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(): 354.
     (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(): 883. 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: 886. to
     *note set_authorizer(): 5a9.  (Contributed by Erlend E. Aasland in
     bpo-44491(1).)

   * Collation name *note create_collation(): 887. can now contain any
     Unicode character.  Collation names with invalid characters now
     raise *note UnicodeEncodeError: 888. instead of *note
     sqlite3.ProgrammingError: 307.  (Contributed by Erlend E. Aasland
     in bpo-44688(2).)

   * *note sqlite3: d4. exceptions now include the SQLite extended error
     code as *note sqlite_errorcode: 889. and the SQLite error name as
     *note sqlite_errorname: 88a.  (Contributed by Aviv Palivoda, Daniel
     Shahaf, and Erlend E. Aasland in bpo-16379(3) and bpo-24139(4).)

   * Add *note setlimit(): 88b. and *note getlimit(): 88c. 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: 88d. 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: 88e.
     Instead we leave it to the SQLite library to handle these cases.
     (Contributed by Erlend E. Aasland in bpo-44092(8).)

   * Add *note serialize(): 88f. and *note deserialize(): 890. to *note
     sqlite3.Connection: 54d. for serializing and deserializing
     databases.  (Contributed by Erlend E. Aasland in bpo-41930(9).)

   * Add *note create_window_function(): 891. to *note
     sqlite3.Connection: 54d. for creating aggregate window functions.
     (Contributed by Erlend E. Aasland in bpo-34916(10).)

   * Add *note blobopen(): 892. to *note sqlite3.Connection: 54d.  *note
     sqlite3.Blob: 893. 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(): 896. and *note is_valid(): 897. to
     *note string.Template: 898, 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(): 89b. 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(): 89c. 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: 89d. 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: 447. ('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(): 8a0.  Third party code that
     creates new virtual environments should use the new 'venv'
     installation scheme to determine the paths, as does *note venv:
     118.  (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: 8a3. objects now fully implement the
     methods of *note io.BufferedIOBase: 8a4. or *note io.TextIOBase:
     8a5. (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():
     8a8. method now uses the monotonic clock (*note
     time.CLOCK_MONOTONIC: 8a9.) for the timeout, rather than using the
     system clock (*note time.CLOCK_REALTIME: 8aa.), 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(): 8ad. 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(): 8ad. 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:
     8b0.  (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(): 8b3. 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(): 8b4, 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(): 8b7. and *note typing.Never: 8b8.
     ‘typing.assert_never()’ is useful for asking a type checker to
     confirm that a line of code is not reachable.  At runtime, it
     raises an *note AssertionError: 8b9.  (Contributed by Jelle
     Zijlstra in gh-90633(1).)

   * Add *note typing.reveal_type(): 8ba.  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(): 8bb.  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: 330. types can now be generic.
     (Contributed by Samodya Abeysiriwardane in gh-89026(4).)

   * *note NamedTuple: 32f. types can now be generic.  (Contributed by
     Serhiy Storchaka in bpo-43923(5).)

   * Allow subclassing of *note typing.Any: 8bc.  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(): 8bd. decorator now sets the ‘__final__’
     attributed on the decorated object.  (Contributed by Jelle Zijlstra
     in gh-90500(7).)

   * The *note typing.get_overloads(): 8be. function can be used for
     introspecting the overloads of a function.  *note
     typing.clear_overloads(): 8bf. can be used to clear all registered
     overloads of a function.  (Contributed by Jelle Zijlstra in
     gh-89263(8).)

   * The *note __init__(): 8c0. 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(): 8c1. now supports evaluating strings
     as forward references in *note PEP 585 generic aliases: 8c2.
     (Contributed by Niklas Rosenstein in gh-85542(12).)

   * *note typing.get_type_hints(): 8c1. no longer adds *note Optional:
     8c3. to parameters with ‘None’ as a default.  (Contributed by
     Nikita Sobolev in gh-90353(13).)

   * *note typing.get_type_hints(): 8c1. now supports evaluating bare
     stringified *note ClassVar: 56d. annotations.  (Contributed by
     Gregory Beauregard in gh-90711(14).)

   * *note typing.no_type_check(): 8c4. 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(): 8c9. and *note
     enterClassContext(): 8ca. of class *note TestCase: 2b5, method
     *note enterAsyncContext(): 8cb. of class *note
     IsolatedAsyncioTestCase: 35f. and function *note
     unittest.enterModuleContext(): 8cc.  (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: 447. 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(): 17a. now accepts arguments for
     *note warnings.simplefilter(): 8d1, 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: 8d4.'s directory and file headers.
     (Contributed by Stephen J. Turnbull and Serhiy Storchaka in
     bpo-28080(1).)

   * Added *note ZipFile.mkdir(): 8d5. for creating new directories
     inside ZIP archives.  (Contributed by Sam Ezeh in gh-49083(2).)

   * Added *note stem: 8d6, *note suffix: 8d7. and *note suffixes: 8d8.
     to *note zipfile.Path: 8d9.  (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:
     8dc. 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: 19c. 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(): 8dd. by ≈15% and simple *note list
     comprehension: 8de.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: 184. 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: 8df. 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(): 8e0. and *note perm(): 8e1.
     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(): 8e2, *note
     variance(): 8e3. and *note stdev(): 8e4. now consume iterators in
     one pass rather than converting them to a *note list: 24f. first.
     This is twice as fast and can save substantial memory.
     (Contributed by Raymond Hettinger in gh-90415(8).)

   * *note unicodedata.normalize(): 8e5. 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:
8e7. and *note Faster Runtime: 8e8.  Optimizations not covered by this
project are listed separately under *note 最適化: 8db.

* 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__: 8ec.
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: 8f0. are now created only when requested
by debuggers or by Python introspection functions such as *note
sys._getframe(): 8f1. and *note inspect.currentframe(): 8f2.  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: 19c, *note float: 197. and *note str: 16a.                            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: 24f,       10-25%                  Irit Katriel, Mark
                                             *note tuple: 614. and *note dict: 184. directly index the                           Shannon
                                             underlying data structures.                                                         
                                             
                                             Subscripting custom *note __getitem__(): 588. is also
                                             inlined similar to
                                             *note Inlined Python function calls: 8f3.
                                             
                                                                                                                                 
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: 16a. 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: 24f. 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: 8f9. 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: 906.  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: 909. 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: 90c. and *note SEND: 90d,
     used in generators and co-routines.

   * *note COPY_FREE_VARS: 90e, which avoids needing special caller-side
     code for closures.

   * *note JUMP_BACKWARD_NO_INTERRUPT: 90f, for use in certain loops
     where handling interrupts is undesirable.

   * *note MAKE_CELL: 910, to create *note セルオブジェクト (cell
     object): 911.

   * *note CHECK_EG_MATCH: 912. and ‘PREP_RERAISE_STAR’, to handle the
     *note new exception groups and except*: 7be. added in PEP 654(1).

   * *note PUSH_EXC_INFO: 913, 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: 364.                    Replaced all numeric binary/in-place
     ‘INPLACE_*’                                                                  opcodes with a single opcode
                                                                                  
                                                                                  
     ‘CALL_FUNCTION’                          *note CALL: 916.                    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: 917.               
                                         
                                                                                  
     ‘DUP_TOP’                                *note COPY: 918.                    Stack manipulation instructions
     ‘DUP_TOP_TWO’                            *note SWAP: 919.                    
     ‘ROT_TWO’                           
     ‘ROT_THREE’
     ‘ROT_FOUR’
     ‘ROT_N’

     ‘JUMP_IF_NOT_EXC_MATCH’                  *note CHECK_EXC_MATCH: 91a.         Now performs check but doesn't jump
                                                                                  
                                                                                  
     ‘JUMP_ABSOLUTE’                          *note JUMP_BACKWARD: 91b.           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: 187. 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: 920. and *note MATCH_KEYS: 921. 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: 925.
* 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 ‘classmethod’, 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:
     1a4.  In a future Python version, they will raise a *note
     SyntaxWarning: 1af. and eventually a *note SyntaxError: 18f.
     (Contributed by Serhiy Storchaka in gh-81548(3).)

   * The delegation of *note int(): 19c. to *note __trunc__(): 19d. is
     now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not *note __int__(): 19e. or *note __index__():
     19f. now raises a *note DeprecationWarning: 1a4.  (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: 1a4. and will be removed in Python 3.13.  Use
     *note configparser.BasicInterpolation: 92d. or *note
     configparser.ExtendedInterpolation: 92e. 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(): 92f. function is deprecated
     and will be removed in Python 3.15.  Use *note locale.setlocale():
     930, *note locale.getpreferredencoding(False): 75c. and *note
     locale.getlocale(): 931. 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: 932.  Only sequences
     of ASCII digits will now be accepted as a numerical reference, and
     the group name in *note bytes: 193. 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(): 933. 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: 35e, 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: 16a. instead wherever possible.
     (Contributed by Alex Waygood in gh-92332(8).)

   * The keyword argument syntax for constructing *note
     typing.TypedDict: 330. 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: 11c. itself.  (Contributed by Donghee Na in
     bpo-42255(10).)

   * The behavior of returning a value from a *note TestCase: 2b5. and
     *note IsolatedAsyncioTestCase: 35f. test methods (other than the
     default ‘None’ value) is now deprecated.

   * Deprecated the following not-formally-documented *note unittest:
     10d. 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: 937.

   * The ‘asynchat’ module

   * The ‘asyncore’ module

   * The *note entire distutils package: 938.

   * The ‘imp’ module

   * The *note typing.io: 23a. namespace

   * The *note typing.re: 939. 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: 10d.:

          非推奨のエイリアス               メソッド名                          非推奨となるバー
                                                                               ジョン
                                                                               
          -----------------------------------------------------------------------------------------
                                                                               
          ‘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: 93d.

   * Removed the ‘@asyncio.coroutine()’ *note decorator: 93e. enabling
     legacy generator-based coroutines to be compatible with *note
     async: 93f. / *note await: 18e. 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(): 940, 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(): 941. 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: 942, *note
     wsgiref.util.FileWrapper: 943. and *note fileinput.FileInput: 944,
     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(): 231. or *note
          inspect.getfullargspec(): 945. instead.

        * The ‘formatargspec()’ function, deprecated since Python 3.5;
          use the *note inspect.signature(): 231. 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(): 946. method
          instead.

     (Contributed by Hugo van Kemenade in bpo-45320(8).)

   * Removed the *note __class_getitem__(): 947. 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: 10d.
     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: 94b.

   * *note open(): 318, *note io.open(): 740, *note codecs.open(): 317.
     and *note fileinput.FileInput: 944. 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: 94c. 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: 2ee. will be raised.
     (Contributed by Pablo Galindo in gh-93351(2))

   * Prohibited passing non-*note concurrent.futures.ThreadPoolExecutor:
     94d. executors to *note asyncio.loop.set_default_executor(): 94e.
     following a deprecation in Python 3.8.  (Contributed by Illia
     Volochii in bpo-43234(3).)

   * *note calendar: 15.: The *note calendar.LocaleTextCalendar: 94f.
     and *note calendar.LocaleHTMLCalendar: 950. classes now use *note
     locale.getlocale(): 931, instead of using *note
     locale.getdefaultlocale(): 92f, 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(): 951. must be a
     sequence, and automatic conversion of *note set: 185.s to *note
     list: 24f.s is no longer supported.  Also, if the sample size is
     larger than the population size, a *note ValueError: 2ee. is
     raised.  (Contributed by Raymond Hettinger in bpo-40465(6).)

   * The 'random' optional parameter of *note random.shuffle(): 952. was
     removed.  It was previously an arbitrary random function to use for
     the shuffle; now, *note random.random(): 953. (its previous
     default) will always be used.

   * In *note re: be. *note Regular Expression Syntax: 932, 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: 956, 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: 19c. 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: 957. 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(): 95c. function to get type's short
     name.  (Contributed by Hai Shi in bpo-42035(1).)

   * Add a new *note PyType_GetQualName(): 95d. function to get type's
     qualified name.  (Contributed by Hai Shi in bpo-42035(2).)

   * Add new *note PyThreadState_EnterTracing(): 95e. and *note
     PyThreadState_LeaveTracing(): 95f. 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: 37f. constant which bears the same
     value as *note PY_VERSION_HEX: 380.  (Contributed by Gabriele N.
     Tornetta in bpo-43931(4).)

   * *note Py_buffer: 960. and APIs are now part of the limited API and
     the stable ABI:

        * *note PyObject_CheckBuffer(): 639.

        * *note PyObject_GetBuffer(): 63a.

        * *note PyBuffer_GetPointer(): 961.

        * *note PyBuffer_SizeFromFormat(): 962.

        * *note PyBuffer_ToContiguous(): 963.

        * *note PyBuffer_FromContiguous(): 964.

        * *note PyObject_CopyData(): 965.

        * *note PyBuffer_IsContiguous(): 966.

        * *note PyBuffer_FillContiguousStrides(): 967.

        * *note PyBuffer_FillInfo(): 968.

        * *note PyBuffer_Release(): 63b.

        * *note PyMemoryView_FromBuffer(): 969.

        * *note bf_getbuffer: 96a. and *note bf_releasebuffer: 96b. 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: 96c.).
     (Contributed by Petr Viktorin in bpo-46613(6).)

   * Add new functions to pack and unpack C double (serialize and
     deserialize): *note PyFloat_Pack2(): 96d, *note PyFloat_Pack4():
     96e, *note PyFloat_Pack8(): 96f, *note PyFloat_Unpack2(): 970,
     *note PyFloat_Unpack4(): 971. and *note PyFloat_Unpack8(): 972.
     (Contributed by Victor Stinner in bpo-46906(7).)

   * Add new functions to get frame object attributes: *note
     PyFrame_GetBuiltins(): 973, *note PyFrame_GetGenerator(): 974,
     *note PyFrame_GetGlobals(): 975, *note PyFrame_GetLasti(): 976.

   * Added two new functions to get and set the active exception
     instance: *note PyErr_GetHandledException(): 977. and *note
     PyErr_SetHandledException(): 978.  These are alternatives to *note
     PyErr_SetExcInfo(): 979. and *note PyErr_GetExcInfo(): 97a. which
     work with the legacy 3-tuple representation of exceptions.
     (Contributed by Irit Katriel in bpo-46343(8).)

   * Added the *note PyConfig.safe_path: 97b. 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(): 979. 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(): 97a. 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: 97d. 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(): 97e. 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: 97f. no longer has the ‘co_code’,
     ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’ fields.  Instead,
     use *note PyCode_GetCode(): 980, *note PyCode_GetVarnames(): 981,
     *note PyCode_GetCellvars(): 982. and *note PyCode_GetFreevars():
     983. 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(): 984. function now raises an error if a
     type is defined with the *note Py_TPFLAGS_HAVE_GC: 985. flag set
     but has no traverse function (*note PyTypeObject.tp_traverse:
     986.).  (Contributed by Victor Stinner in bpo-44263(11).)

   * Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE: 3cd. flag can
     now inherit the PEP 590(12) vectorcall protocol.  Previously, this
     was only possible for *note static types: 987.  (Contributed by
     Erlend E. Aasland in bpo-43908(13))

   * Since *note Py_TYPE(): 3c7. 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(): 988. 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(): 989. 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(): 98a. 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: 98b.  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(): 98c.

        * *note PyFrame_GetBack(): 98d.

        * *note PyFrame_GetBuiltins(): 973.

        * *note PyFrame_GetGenerator(): 974.

        * *note PyFrame_GetGlobals(): 975.

        * *note PyFrame_GetLasti(): 976.

        * *note PyFrame_GetLocals(): 661.

        * *note PyFrame_Type: 98e.

     (Contributed by Victor Stinner in gh-93937(19).)

   * The *note PyFrameObject: 990. structure members have been removed
     from the public C API.

     While the documentation notes that the *note PyFrameObject: 990.
     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: 990. fields:

        * ‘f_back’: use *note PyFrame_GetBack(): 98d.

        * ‘f_blockstack’: removed.

        * ‘f_builtins’: use *note PyFrame_GetBuiltins(): 973.

        * ‘f_code’: use *note PyFrame_GetCode(): 991.

        * ‘f_gen’: use *note PyFrame_GetGenerator(): 974.

        * ‘f_globals’: use *note PyFrame_GetGlobals(): 975.

        * ‘f_iblock’: removed.

        * ‘f_lasti’: use *note PyFrame_GetLasti(): 976.  Code using
          ‘f_lasti’ with ‘PyCode_Addr2Line()’ should use *note
          PyFrame_GetLineNumber(): 992. instead; it may be faster.

        * ‘f_lineno’: use *note PyFrame_GetLineNumber(): 992.

        * ‘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: 993. member must not be accessed directly,
     since its value is now also computed lazily.  The *note
     PyFrame_GetBack(): 98d. 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: 994. structure members:

        * ‘frame’: removed, use *note PyThreadState_GetFrame(): 995.
          (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(): 996.

        * ‘tracing’: changed, use *note PyThreadState_EnterTracing():
          95e. and *note PyThreadState_LeaveTracing(): 95f. (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:
     3e2.  Otherwise, initialization will recalculate the path and
     replace any values added to ‘module_search_paths’.

   * *note PyConfig_Read(): 997. 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: 3e2. 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: 3f5. 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: 999.
     Use *note PyObject_Hash(): 434. 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(): 432.

   * ‘PyUnicode_WSTR_LENGTH()’

   * ‘_PyUnicode_AsUnicode()’

   * ‘PyUnicode_WCHAR_KIND’

   * *note PyUnicodeObject: 99b.

   * ‘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(): 99d.

        * *note PyMarshal_WriteObjectToFile(): 99e.

        * *note PyMarshal_ReadObjectFromString(): 99f.

        * *note PyMarshal_WriteObjectToString(): 9a0.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: 9a1.

     (Contributed by Victor Stinner in bpo-45474(6).)

   * Exclude *note PyWeakref_GET_OBJECT(): 3dc. 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: 3de. 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:
     1a4.  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
変更履歴: 143. をご覧ください。

* 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: 450. 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: 9b3. attribute of frame objects will always contain
the expected line number.

The *note co_lnotab: 32e. 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(): 34e. 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: 9c2. and *note open(): 318.
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: 89d. is true and
locale-specific default encoding is used.

‘-X warn_default_encoding’ option and *note PYTHONWARNDEFAULTENCODING:
9c3. are added to enable the warning.

See *note Text Encoding: 9c4. 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: 10b. 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: 2aa, especially in type hints.

In previous versions of Python, to apply a type hint for functions
accepting arguments of multiple types, *note typing.Union: 2aa. 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(): 2af. and *note issubclass(): 9c8.:

     >>> isinstance(1, int | str)
     True

See *note Union 型: 9c9. 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: 10b. 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:
9cb.

See *note typing.Callable: 9cc, *note typing.ParamSpec: 487, *note
typing.Concatenate: 9cb, *note typing.ParamSpecArgs: 9cd, *note
typing.ParamSpecKwargs: 9ce, 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: 10b. module has a special value *note TypeAlias:
9d0. 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: 10b. module to
annotate type guard functions and improve information provided to static
type checkers during type narrowing.  For more information, please see
‘TypeGuard’'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: 19c. type has a new method *note int.bit_count():
     9d3, 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(): 9d4, *note dict.values():
     9d5. and *note dict.items(): 9d6. 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(): 1a1. 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: 200.s, *note Fraction: 215.s and other
     objects that can be converted to integers only with a loss (e.g.
     that have the *note __int__(): 19e. method but do not have the
     *note __index__(): 19f. method).  (Contributed by Serhiy Storchaka
     in bpo-37999(4).)

   * If *note object.__ipow__(): 9d7. returns *note NotImplemented: 1a3,
     the operator will correctly fall back to *note object.__pow__():
     9d8. and *note object.__rpow__(): 1a6. 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(): 9d9. and *note anext():
     9da. have been added to provide asynchronous counterparts to *note
     iter(): 9db. and *note next(): 9dc, respectively.  (Contributed by
     Joshua Bronson, Daniel Pope, and Justin Wang in bpo-31861(7).)

   * Static methods (*note @staticmethod: 451.) 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 アノテーションのベストプラクティス: 9dd.
     (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: 197. type and *note
     decimal.Decimal: 200. 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: 18f. (instead of a *note NameError: 450.) will
     be raised when deleting the *note __debug__: 9de. constant.
     (Contributed by Donghee Na in bpo-45000(15).)

   * *note SyntaxError: 18f. 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<3>.
* 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(): 9e2. 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(): 9e5. 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: 1a4. 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(): 9e8. and *note base64.b32hexdecode():
9e9. 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(): 9ed. 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: 8c2. for *note
collections.abc.Callable: 9ef. are now consistent with *note
typing.Callable: 9cc.  ‘collections.abc.Callable’ generic now flattens
type parameters, similar to what ‘typing.Callable’ 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: 9f0. can now be
subclassed, and a subclass will be returned when subscripting the
‘collections.abc.Callable’ type.  Note that a *note TypeError: 199. may
be raised for invalid forms of parameterizing ‘collections.abc.Callable’
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(): 9f2. 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(): 9f3.  (Contributed by Tom Gringauz in
bpo-41543(2).)

Add *note AsyncContextDecorator: 9f4, 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(): 9f6, *note
curses.init_color(): 9f7, *note curses.init_pair(): 9f8, and *note
curses.pair_content(): 9f9.  A new function, *note
curses.has_extended_color_support(): 9fa, 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(): a01. 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(): 1c3. 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(): a04.
and *note fileinput.FileInput: 944.  (Contributed by Inada Naoki in
bpo-43712(1).)

*note fileinput.hook_compressed(): a05. now returns *note TextIOWrapper:
9c2. 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<3>,  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<3>,  Next: glob<2>,  Prev: faulthandler<2>,  Up: 改良されたモジュール<4>

1.5.6.21 gc
...........

Add audit hooks for *note gc.get_objects(): a08, *note
gc.get_referrers(): a09. and *note gc.get_referents(): a0a.
(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<3>,  Up: 改良されたモジュール<4>

1.5.6.22 glob
.............

Add the 'root_dir' and 'dir_fd' parameters in *note glob(): 5a0. and
*note iglob(): a0c. 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(): a10. (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: a11. *note match: a12, ‘case’,
and *note _: a13. 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(): a15. for
resolving top-level Python modules and packages to their *note
importlib.metadata.Distribution: a16.

   ---------- 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(): a18, 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.
‘inspect.get_annotations()’ can also correctly un-stringize stringized
annotations.  ‘inspect.get_annotations()’ 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 アノテーションのベストプラクティス: 9dd.
Relatedly, *note inspect.signature(): 231, *note
inspect.Signature.from_callable(): 946, and
‘inspect.Signature.from_function()’ now call ‘inspect.get_annotations()’
to retrieve annotations.  This means ‘inspect.signature()’ and
‘inspect.Signature.from_callable()’ 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(): a1a.  (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(): a1d. and related helpers to wrap
the ‘eventfd2’ syscall on Linux.  (Contributed by Christian Heimes in
bpo-41001(2).)

Add *note os.splice(): a1e. 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: a1f, *note O_FSYNC: a20, *note O_SYMLINK: a21. and
*note O_NOFOLLOW_ANY: a22. 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(): 264. now accepts a 'strict' keyword-only
argument.  When set to ‘True’, *note OSError: 2c2. 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: a25.  (Contributed by
Joshua Cannon in bpo-35498(1).)

Add negative indexing support to *note PurePath.parents: a25.
(Contributed by Yaroslav Pankovych in bpo-21041(2).)

Add *note Path.hardlink_to: a26. method that supersedes ‘link_to()’.
The new method has the same argument order as *note symlink_to(): a27.
(Contributed by Barney Gale in bpo-39950(3).)

*note pathlib.Path.stat(): a28. and *note chmod(): a29. 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(): a2b. 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(): a2d. 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(): a30. and *note
pyclbr.readmodule_ex(): a31.  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:
a33. 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(): a35, Pearson's *note correlation(): 6e3, and
simple *note linear_regression(): a36. 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: a39. is now an alias of *note
TimeoutError: a3a.  (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: a3c.  (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: 1a4.  *note ssl.SSLContext.options: a3d. has
*note OP_NO_SSLv2: a3e. and *note OP_NO_SSLv3: a3f. set by default and
therefore cannot warn about setting the flag again.  The *note
deprecation section: a40. 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: 355. 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():
a41. 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(): a43, 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: a45. 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: a46, 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(): a48. now takes an optional signal number
to simulate (the default is still *note signal.SIGINT: 255.).
(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(): a4a. and *note threading.getprofile():
a4b. to retrieve the functions set by *note threading.settrace(): a4c.
and *note threading.setprofile(): a4d. respectively.  (Contributed by
Mario Corchero in bpo-42251(1).)

Add *note threading.__excepthook__: a4e. to allow retrieving the
original value of *note threading.excepthook(): a4f. 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(): a51, *note format_exception_only(): a52,
and *note print_exception(): a53. 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: a55, *note types.NoneType:
a56. and *note types.NotImplementedType: a57. 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 型ヒントに関連する新しい機能: 9c5.

The behavior of *note typing.Literal: a59. 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: 199. 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(): a5a. to introspect if an
annotation is a *note typing.TypedDict: 330.  (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: 1a4.  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: 10b. 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(): a5c. to complement the existing
*note assertLogs(): a5d.  (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(): 321. and
*note urllib.parse.parse_qsl(): 320.  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: 111.
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: a60. class to the *note xml.sax.handler:
131. 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(): a62, *note
zipimport.zipimporter.create_module(): a63, and *note
zipimport.zipimporter.exec_module(): 337.  (Contributed by Brett Cannon
in bpo-42131(2).)

Add *note invalidate_caches(): a64. 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(): 16a, *note bytes(): 193. and *note
     bytearray(): 342. 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: a66. 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: a67. 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: 13a. 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(): 1a0, *note filter():
     a68, *note reversed(): a69, *note bool(): 3c1. and *note float():
     197.  (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: a6a. 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: 347, *note else: 17d, *note for: 348, *note if: 182, *note in:
     349, *note is: 34a. and *note or: 34b.  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(): a6c.), *note load_module(): a6d.
     (superseded by *note exec_module(): a6e.), ‘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: 1a4.
     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: 938. section for
     more information.

   * Non-integer arguments to *note random.randrange(): a6f. are
     deprecated.  The *note ValueError: 2ee. is deprecated in favor of a
     *note TypeError: 199.  (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: 1a4.  Use *note exec_module():
     a6e. instead.  (Contributed by Brett Cannon in bpo-26131(3).)

   * ‘zimport.zipimporter.load_module()’ has been deprecated in
     preference for *note exec_module(): 337.  (Contributed by Brett
     Cannon in bpo-26131(4).)

   * The use of *note load_module(): a6d. by the import system now
     triggers an *note ImportWarning: 71e. as *note exec_module(): a6e.
     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(): a6c. and *note
     importlib.abc.PathEntryFinder.find_spec(): a70. are preferred,
     respectively.  You can use *note importlib.util.spec_from_loader():
     a71. 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(): a70. is preferred.  You
     can use *note importlib.util.spec_from_loader(): a71. 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: 1a4. 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: a72.
     and *note importlib.abc.PathEntryFinder: a73. 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: 1a4. 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: 16a.  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():
          35c.

        * ‘threading.activeCount’ => *note threading.active_count():
          35d.

        * ‘threading.Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 357.

        * ‘threading.Event.isSet’ => *note threading.Event.is_set():
          358.

        * ‘threading.Thread.setName’ => *note threading.Thread.name:
          2a2.

        * ‘threading.thread.getName’ => *note threading.Thread.name:
          2a2.

        * ‘threading.Thread.isDaemon’ => *note threading.Thread.daemon:
          35a.

        * ‘threading.Thread.setDaemon’ => *note threading.Thread.daemon:
          35a.

     (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(): a26. 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: a74. and *note maximum_version: a75.

        * ‘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: a76. and *note PROTOCOL_TLS_SERVER: a77.

        * ‘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():
          a78. and *note ssl.SSLContext.set_npn_protocols(): 356. 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: 1a4.  These submodules will be
     removed in a future version of Python.  Anything belonging to these
     submodules should be imported directly from *note typing: 10b.
     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: 198. class.  They always raised
     a *note TypeError: 199.  (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: a7b. 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 コレクション抽象基底クラス: a7c.
     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: a7d. 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 の変更: a7e. 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(): a51, *note
     format_exception_only(): a52, and *note print_exception(): a53.
     functions in the *note traceback: 105. 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(): a82. 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: 9ef. generic now flattens type
     parameters, similar to what *note typing.Callable: 9cc. 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(): 2ae. or ‘__args__’ need to account for this
     change.  Furthermore, *note TypeError: 199. may be raised for
     invalid forms of parameterizing ‘collections.abc.Callable’ which
     may have passed silently in Python 3.9.  (Contributed by Ken Jin in
     bpo-42195(3).)

   * *note socket.htons(): a83. and *note socket.ntohs(): a84. now raise
     *note OverflowError: a85. instead of *note DeprecationWarning: 1a4.
     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: a7d. 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(): a86. instead.

     (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and
     Kyle Stanley in bpo-42392(5).)

   * The *note types.FunctionType: a87. 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(): a89.  The resulting code
     object can then be evaluated using, for example, *note
     PyEval_EvalCode(): a8a.

     Specifically:

        * A call to ‘PyParser_SimpleParseStringFlags’ followed by
          ‘PyNode_Compile’ can be replaced by calling *note
          Py_CompileString(): a89.

        * 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(): a89.

        * 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(): 3da, *note PyObject_CallMethod():
          640, *note PyBytes_AsString(): a8b. and *note
          Py_CompileString(): a89, 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: a8c. 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(): a8d. for example).
          Notice as well that the ‘f_lasti’ member of ‘FrameObject’
          objects is not considered stable: please use *note
          PyFrame_GetLineNumber(): 992. 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: a90. 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: a91. 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: a92. 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: a93. 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 Stability: 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(): a97. now always has exact
     type *note int: 19c.  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: a98. member to the *note PyConfig: 3f5.
     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(): a99. and *note
     PyDateTime_TIME_GET_TZINFO(): a9a. macros have been added for
     accessing the ‘tzinfo’ attributes of *note datetime.datetime: 4e2.
     and *note datetime.time: 1fd. objects.  (Contributed by Zackery
     Spytz in bpo-30155(3).)

   * Add a *note PyCodec_Unregister(): a9b. function to unregister a
     codec search function.  (Contributed by Hai Shi in bpo-41842(4).)

   * The *note PyIter_Send(): a9c. 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(): a9d. 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(): a9e. and *note Py_XNewRef(): a9f. 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(): aa0. function can accept *note static
     types: 987.  (Contributed by Hai Shi and Petr Viktorin in
     bpo-41073(11).)

   * Add a new *note PySet_CheckExact(): aa1. function to the C-API to
     check if an object is an instance of *note set: 185. but not an
     instance of a subtype.  (Contributed by Pablo Galindo in
     bpo-43277(12).)

   * Add *note PyErr_SetInterruptEx(): aa2. 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: aa3. 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): aa4. 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(): aa5, *note Py_IsTrue(): aa6, *note Py_IsFalse():
     aa7. 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(): aa8, *note PyGC_Disable(): aa9, *note
     PyGC_IsEnabled(): aaa.  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: 3cd. 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(): 3bf. and *note Py_BuildValue(): 3c0. formats
     which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’ and ‘Z#’.
     See *note 引数の解釈と値の構築: 3d3. and PEP 353(1).  (Contributed
     by Victor Stinner in bpo-40943(2).)

   * Since *note Py_REFCNT(): 2d1. 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(): aac.
     (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: 165. 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(): aad. 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(): 3e1, *note Py_GetPrefix(): 3e3, *note
     Py_GetExecPrefix(): 3e7, *note Py_GetProgramFullPath(): 3ea, *note
     Py_GetPythonHome(): 3ed. and *note Py_GetProgramName(): 3ec.
     functions now return ‘NULL’ if called before *note Py_Initialize():
     45e. (before Python is initialized).  Use the new *note Python
     初期化設定: 646. API to get the *note Python Path Configuration:
     aae.  (Contributed by Victor Stinner in bpo-42260(7).)

   * *note PyList_SET_ITEM(): 62f, *note PyTuple_SET_ITEM(): 62e. and
     *note PyCell_SET(): aaf. 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 インクルードファイル:
     98b.  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: 3cd. type flag to create
     immutable type objects.  Do not rely on *note Py_TPFLAGS_HEAPTYPE:
     ab0. to decide if a type object is mutable or not; check if
     ‘Py_TPFLAGS_IMMUTABLETYPE’ 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(): ab2. 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(): ab4. or
          *note PyUnicode_GET_LENGTH: ab5.

        * ‘Py_UNICODE_strcat’: use *note PyUnicode_CopyCharacters():
          ab6. or *note PyUnicode_FromFormat(): 62b.

        * ‘Py_UNICODE_strcpy’, ‘Py_UNICODE_strncpy’: use *note
          PyUnicode_CopyCharacters(): ab6. or *note
          PyUnicode_Substring(): ab7.

        * ‘Py_UNICODE_strcmp’: use *note PyUnicode_Compare(): ab8.

        * ‘Py_UNICODE_strncmp’: use *note PyUnicode_Tailmatch(): ab9.

        * ‘Py_UNICODE_strchr’, ‘Py_UNICODE_strrchr’: use *note
          PyUnicode_FindChar(): aba.

   * 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(): abb.  (Contributed by Inada Naoki in
     bpo-41103(4).)

   * Removed ‘PyUnicode_AsUnicodeCopy()’.  Please use *note
     PyUnicode_AsUCS4Copy(): abc. or *note PyUnicode_AsWideCharString():
     abd. (Contributed by Inada Naoki in bpo-41103(5).)

   * Removed ‘_Py_CheckRecursionLimit’ variable: it has been replaced by
     ‘ceval.recursion_limit’ of the *note PyInterpreterState: abe.
     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: abe. 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: abf.  (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: 19c. and *note str: 16a. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ee. 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:
     1a4.  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: 143.

参考
....

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: 13a.) are now using the stable ABI defined by PEP 384.

新たなライブラリモジュール:

   * PEP 615(9)、IANAのTime Zone Databaseが標準ライブラリの *note
     zoneinfo: 13b. モジュールで提供されるようになりました。

   * 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: 1a4. を出すようになりました。例え
ば、2012年にリリースされたPython 3.3以降、‘collections.abc.Mapping’ の代
りに ‘collections.Mapping’ を使うと、警告 ‘DeprecationWarning’ が出ます
。

警告 *note DeprecationWarning: 1a4. および *note
PendingDeprecationWarning: ac9. を確認するために、 *note -W: aca.
‘default’ コマンドラインオプションを付けて、あなたのアプリケーションをテ
ストして下さい。あるいは、‘-W’ ‘error’ で警告をエラーとして扱うこともで
きます。サードパーティによるコードの警告を無視するには、*note Warnings
Filter: 1b2. を使うことができます。

Python 3.9は、Python 2後方互換性レイヤを提供する最後のバージョンです。こ
のレイヤは、Pythonプロジェクトの保守管理者に、Python 2サポートを止めて
Python 3.9サポートを追加する時間的な余裕を与えるためのものです。

Aliases to *note Abstract Base Classes: a7c. in the *note collections:
1e. module, like ‘collections.Mapping’ alias to *note
collections.abc.Mapping: acb, 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 削除: acc. を見て下さい。


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: 184. クラスにマージ(‘|’)と更新(‘|=’)演算子が追加
されました。この演算子は、辞書をマージする既存の方法 ‘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): ad0. と *note str.removesuffix(suffix): ad1. が
追加されました。 ‘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__(): ad5. now raises *note ImportError: 65b. instead
     of *note ValueError: 2ee, 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
     ‘__main__’ 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(): 318, *note str.encode(): ad6. and *note bytes.decode():
     ad7.

     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: 193. and *note
     bytearray: 342. objects.  (Contributed by Serhiy Storchaka in
     bpo-28029(4).)

   * Any valid expression can now be used as a *note decorator: 93e.
     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: 10b. module.  Docstrings are
     now shown for all special forms and special generic aliases (like
     ‘Union’ and ‘List’).  Using *note help(): ad8. 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(): ad9. / *note asend(): ada. /
     *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: 349. operator and functions
     *note contains(): adb, *note indexOf(): adc. and *note countOf():
     add. 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: 13b. モジュールにより標準ライブラリにIANAのタイムゾーン
データベースへのサポートを導入されます。*note zoneinfo.ZoneInfo: ae0. と
いう、システムのタイムゾーンデータを背景とした具体的な *note
datetime.tzinfo: 7f6. の実装が追加されます。

以下はプログラム例です:

     >>> from zoneinfo import ZoneInfo
     >>> import datetime as dt

     >>> # Daylight saving time
     >>> when = dt.datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(when)
     2020-10-31 12:00:00-07:00
     >>> when.tzname()
     'PDT'

     >>> # Standard time
     >>> when += dt.timedelta(days=7)
     >>> print(when)
     2020-11-07 12:00:00-08:00
     >>> print(when.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: ae2. 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<4>.
* 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(): ae5. which allows it to
produce a multiline indented output.  (Contributed by Serhiy Storchaka
in bpo-37995(1).)

Added *note ast.unparse(): ae6. 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 ‘ast.AST’
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(): 940. での '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():
ae8. that schedules a shutdown for the default executor that waits on
the *note ThreadPoolExecutor: 94d. to finish closing.  Also, *note
asyncio.run(): 2f5. has been updated to use the new coroutine.
(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(): ae9.  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(): aea. 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: 199. when calling
incompatible methods with an *note ssl.SSLSocket: aeb. 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(): aee. 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: 94d. and *note
ProcessPoolExecutor: 1d8.  This improves compatibility with
subinterpreters and predictability in their shutdown processes.
(Contributed by Kyle Stanley in bpo-39812(2).)

Workers in *note ProcessPoolExecutor: 1d8. 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(): af0, *note curses.set_escdelay(): af1,
*note curses.get_tabsize(): af2, *note curses.set_tabsize(): af3. の関数
が追加されました。(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(): af5. of *note datetime.date: 1fc. and *note
isocalendar(): af6. 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<4>,  Prev: fcntl<2>,  Up: 改良されたモジュール<5>

1.6.6.9 ftplib
..............

*note FTP: afa. and *note FTP_TLS: afb. now raise a *note ValueError:
2ee. 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<4>,  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(): afd. 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<4>,  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: b00.  (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(): a10. (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: b03. and *note IMAP4_SSL: b04. now have an optional
'timeout' parameter for their constructors.  Also, the *note open():
b05. method now has an optional 'timeout' parameter with this change.
The overridden methods of ‘IMAP4_SSL’ and *note IMAP4_stream: b06. were
applied to this change.  (Contributed by Donghee Na in bpo-38615(1).)

*note imaplib.IMAP4.unselect(): b07. is added.
‘imaplib.IMAP4.unselect()’ 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():
b08, 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(): b0a. now raises *note ImportError: 65b.
instead of *note ValueError: 2ee. 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: b0c. は ‘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:
b0e. 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(): b10. function to handle multiple
arguments.  Formerly, it only supported two arguments.  (Contributed by
Serhiy Storchaka in bpo-39648(1).)

Added *note math.lcm(): b11.: 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(): b12.: 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: b14. class has a new *note
close(): b15. 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: 2ee. 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: b18. and *note CLD_STOPPED: b19. 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: b1a. (bpo-38713(3)) for process management with
file descriptors.

*note os.unsetenv(): 25e. 関数が、Windowsでも使えるようになりました。
(bpo-39413(4) におけるVictor Stinnerの貢献による)

*note os.putenv(): 25d. と *note os.unsetenv(): 25e. 関数が、常に利用で
きるようになりました。(bpo-39395(5) におけるVictor Stinnerの貢献による)

Added *note os.waitstatus_to_exitcode(): b1b. 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(): b1d. which acts similarly to *note
os.readlink(): b1e.  (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: 275. 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: b21. and *note POP3_SSL: b22. now raise a *note ValueError:
2ee. 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__: b25.
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(): b27. 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(): b29. 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: b2b. and *note SMTP_SSL: b2c. now raise a *note ValueError:
2ee. 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: b2d. 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:
b2f. 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: b30. protocol on
platforms that support it.  (Contributed by Karl Ding in bpo-40291(2).)

The socket module now has the *note socket.send_fds(): b31. and *note
socket.recv_fds(): b32. 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(): b34. 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: b36. 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: b37. 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(): b39. 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: b3b. type to decorate
existing types with context-specific metadata and new ‘include_extras’
parameter to *note typing.get_type_hints(): 8c1. 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: 118. 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: 12c. 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(): b40. 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: b41, *note tuple: 614,
     *note set: 185, *note frozenset: 7f2, *note list: 24f, *note dict:
     184.) 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: b42. of float operation now has a better
     performance.  Also the message of *note ZeroDivisionError: b43. 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(): b45. accepts *note float: 197.
     instances with non-negative integer values (like ‘5.0’).  It raises
     a *note ValueError: 2ee. for non-integral and negative floats.  It
     is now deprecated.  In future Python versions it will raise a *note
     TypeError: 199. 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: 1a3. 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: 199. 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: 886, *note int:
     19c, *note float: 197, *note str: 16a, *note bytes: 193, and *note
     bytearray: 342.

   * 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:
     165. is initialized by *note Py_Initialize(): 45e. 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:
     ac9.  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(): 952. の*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:
     886.  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(): b47. and *note
     sys.setswitchinterval(): b48. 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():
     b49. 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: 177. has been
     removed.  It was deprecated since Python 3.8.  Use *note
     is_alive(): b4a. instead.  (Contributed by Donghee Na in
     bpo-37804(8).)

   * Methods ‘getchildren()’ and ‘getiterator()’ of classes *note
     ElementTree: b4b. and *note Element: 361. in the *note ElementTree:
     12c. 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(): b4c, *note loads(): b4d,
     *note dump(): b4e, and *note dumps(): b4f. functions.
     Additionally, the 'use_builtin_types' parameter was removed,
     standard *note bytes: 193. 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(): b50. and *note base64.decodebytes(): b51.
     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(): b10.
     instead.  (Contributed by Victor Stinner in bpo-39350(15).)

   * The 'buffering' parameter of *note bz2.BZ2File: a6a. has been
     removed.  Since Python 3.0, it was ignored and using it emitted a
     *note DeprecationWarning: 1a4.  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(): b52. has been
     removed.  As of Python 3.1, it was deprecated and ignored; using it
     has emitted a *note DeprecationWarning: 1a4. 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: 3f5. 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: 32f.
     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(): b53. instead.  (Contributed by Rémi Lapeyre in
     bpo-40967(22))

   * The ‘unescape()’ method in the *note html.parser.HTMLParser: a7b.
     class has been removed (it was deprecated since Python 3.4).  *note
     html.unescape(): b54. 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__(): ad5. and *note importlib.util.resolve_name():
     b0a. now raise *note ImportError: 65b. where it previously raised
     *note ValueError: 2ee.  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: 118. activation scripts no longer special-case when
     ‘__VENV_PROMPT__’ is set to ‘""’.

   * The *note select.epoll.unregister(): b57. method no longer ignores
     the *note EBADF: b58. error.  (Contributed by Victor Stinner in
     bpo-39239(1).)

   * The 'compresslevel' parameter of *note bz2.BZ2File: a6a. 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:
     b59. environment variable when the *note -E: b5a. or *note -I: b5b.
     command line options are being used.

   * The 'encoding' parameter has been added to the classes *note
     ftplib.FTP: afa. and *note ftplib.FTP_TLS: afb. 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(): ae8. has been added
     to *note AbstractEventLoop: b5c, 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(): b5d. 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: 1a3. instead of raising a *note TypeError: 199.
     when passed something other than an instance of ‘str’ or
     ‘PurePath’.  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(): b5e. treats leading zeros as octal notatation.
     glibc implementation of modern *note inet_pton(): b5f. does not
     accept any leading zeros.  (Contributed by Christian Heimes in
     bpo-36384(10)).

   * *note codecs.lookup(): b60. now normalizes the encoding name the
     same way as *note encodings.normalize_encoding(): a01, except that
     ‘codecs.lookup()’ 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: b62. (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: 986. 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: b62. 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: b64. statement.  Previously, the assert statement would not
     work correctly if the *note AssertionError: 8b9. exception was
     being shadowed.  (Contributed by Zackery Spytz in bpo-34880(1).)

   * The *note COMPARE_OP: b65. 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: b36. attribute.  See ‘sys.platlibdir’ 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: b67. 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(): b6a. and
     *note PyType_GetModuleState(): b6b. to retrieve the module and its
     state; and *note PyCMethod: 96c. and *note METH_METHOD: b6c. 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(): 991. function: get a frame code.
     Added *note PyFrame_GetBack(): 98d. function: get the frame next
     outer frame.  (Contributed by Victor Stinner in bpo-40421(3).)

   * Added *note PyFrame_GetLineNumber(): 992. to the limited C API.
     (Contributed by Victor Stinner in bpo-40421(4).)

   * Added *note PyThreadState_GetInterpreter(): b6d. and *note
     PyInterpreterState_Get(): 64c. functions to get the interpreter.
     Added *note PyThreadState_GetFrame(): 995. function to get the
     current frame of a Python thread state.  Added *note
     PyThreadState_GetID(): b6e. 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(): 3d0. and *note
          Py_LeaveRecursiveCall(): b6f. 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(): b70. 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(): b71. and *note
     PyObject_GC_IsFinalized(): b72. 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(): b73. 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: b75, *note m_clear: b76. and
     *note m_free: b77. functions of *note PyModuleDef: b78. 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: b79.
     function).  More precisely, these functions are not called if *note
     m_size: b7a. is greater than 0 and the module state (as returned by
     *note PyModule_GetState(): b7b.) is ‘NULL’.

     Extension modules without module state (‘m_size <= 0’) are not
     affected.

   * If *note Py_AddPendingCall(): b7c. 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: 3e2. when the ‘-E’ option is used (if *note
     PyConfig.use_environment: 409. 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: b7d. 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(): b7e. 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(): b7f. macro was converted to a
          function.

        * The ‘PyObject_NEW()’ macro becomes an alias to the *note
          PyObject_New: b80. macro, and the ‘PyObject_NEW_VAR()’ macro
          becomes an alias to the *note PyObject_NewVar: b81. macro.
          They no longer access directly the *note
          PyTypeObject.tp_basicsize: b82. member.

        * ‘PyObject_GET_WEAKREFS_LISTPTR()’ macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_weaklistoffset: b83. member.

        * *note PyObject_CheckBuffer(): 639. macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_as_buffer: b84. member.

        * *note PyIndex_Check(): b85. 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: b86. 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: b88. 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(): b89. 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(): ab9.
     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: a59. 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: 199. 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: 9ef. generic now flattens type
parameters, similar to what *note typing.Callable: 9cc. 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: 9f0. can now be
subclassed, and a subclass will be returned when subscripting the
‘collections.abc.Callable’ type.  Code which accesses the arguments via
*note typing.get_args(): 2ae. or ‘__args__’ need to account for this
change.  A *note DeprecationWarning: 1a4. may be emitted for invalid
forms of parameterizing ‘collections.abc.Callable’ which may have passed
silently in Python 3.9.1.  This ‘DeprecationWarning’ will become a *note
TypeError: 199. 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(): 321. and *note
urllib.parse.parse_qsl(): 320.  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: afa. 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: 111.
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: 19c. and *note str: 16a. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ee. 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:
     1a4.  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: 143.

* 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(): b9d. 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: b9f. （またはコマンドラインオプション
*note -X: 170. ‘pycache_prefix’) を指定すると、ソースコードと分離された
ディレクトリツリーに格納されるようになります。

キャッシュの場所は *note sys.pycache_prefix: ba0. で参照できます（
‘__pycache__’ を使用する場合は *note None: 886. になります）。

（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 共通化
..................................................

The ABI of Python *note debug builds: 509. is now compatible with Python
release builds.  On Unix, when Python is built in debug mode, it is now
possible to load C extensions built in release mode and C extensions
built using the stable ABI. The inverse is not true, as debug builds
expose additional symbols not available in release builds.

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(): 290.
function and the *note PYTHONDUMPREFS: ba2. 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 に書かれ
た式、イコール記号、式を評価されたものの文字列表現、の順で表示されます。
例えば:

     >>> import datetime as dt
     >>> user = 'eric_idle'
     >>> member_since = dt.date(1975, 7, 31)
     >>> f'{user=} {member_since=}'
     "user='eric_idle' member_since=datetime.date(1975, 7, 31)"

通常の *note f-string 書式指定子: 19b. を用いると、より柔軟に式の結果の
表示方法を変えられます:

     >>> delta = dt.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: 3f5.

   * *note PyPreConfig: ba7.

   * *note PyStatus: ba8.

   * *note PyWideStringList: ba9.

新たな関数:

   * *note PyConfig_Clear(): baa.

   * *note PyConfig_InitIsolatedConfig(): bab.

   * *note PyConfig_InitPythonConfig(): bac.

   * *note PyConfig_Read(): 997.

   * *note PyConfig_SetArgv(): bad.

   * *note PyConfig_SetBytesArgv(): bae.

   * *note PyConfig_SetBytesString(): baf.

   * *note PyConfig_SetString(): bb0.

   * *note PyPreConfig_InitIsolatedConfig(): bb1.

   * *note PyPreConfig_InitPythonConfig(): bb2.

   * *note PyStatus_Error(): bb3.

   * *note PyStatus_Exception(): bb4.

   * *note PyStatus_Exit(): bb5.

   * *note PyStatus_IsError(): bb6.

   * *note PyStatus_IsExit(): bb7.

   * *note PyStatus_NoMemory(): bb8.

   * *note PyStatus_Ok(): bb9.

   * *note PyWideStringList_Append(): bba.

   * *note PyWideStringList_Insert(): bbb.

   * *note Py_BytesMain(): bbc.

   * *note Py_ExitStatusException(): bbd.

   * *note Py_InitializeFromConfig(): 3f4.

   * *note Py_PreInitialize(): 41c.

   * *note Py_PreInitializeFromArgs(): bbe.

   * *note Py_PreInitializeFromBytesArgs(): bbf.

   * *note Py_RunMain(): bc0.

このPEP は、‘_PyRuntimeState.preconfig’ (*note PyPreConfig: ba7. 型) と
‘PyInterpreterState.config’ (*note PyConfig: 3f5. 型) を内部構造体に加え
ます。‘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: 987. 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: 1b1. 節での *note continue: 181.
     文は不正でした。Python3.8 では、この制限は取り除かれています。
     (Serhiy Storchaka の貢献による bpo-32489(1))

   * *note bool: 3c1, *note int: 19c, *note fractions.Fraction: 215. タ
     イプは、*note float: 197. や *note decimal.Decimal: 200. と同様の
     *note as_integer_ratio(): bc4. メソッドを持つようになりました。この
     API の拡張によって、‘numerator, denominator = x.as_integer_ratio()’
     のようなコードがより多くの数値型で動作します。 (Lisa Roach の貢献に
     よる bpo-33073(2) および Raymond Hettinger の貢献による
     bpo-37819(3))

   * *note int: 19c, *note float: 197, *note complex: 198. のコンストラ
     クタは、可能ならば *note __index__(): 19f. 特殊メソッドを利用し、そ
     の場合は対応する *note __int__(): 19e, *note __float__(): bc5. や
     *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(): a69. を使って逆順でイテレー
     トすることが可能になりました。(Rémi Lapeyre の貢献による
     bpo-33462(6))

   * 関数内でのキーワード名に関する構文の制限が強化されました。具体的に
     は、‘f((keyword)=arg)’ の表現が許容されなくなりました。キーワード引
     数への代入の際、左側にキーワードそのまま以外の表現を許可する意図は
     、以前からありませんでした。 (Benjamin Peterson の貢献による
     bpo-34641(7))

   * *note yield: bc6. 文と *note return: 1b0. 文における一般化されたイ
     テラブルへの展開のために、全体を覆うかっこが不要になりました。これ
     は '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: 1af. を、分かりやすい形式で表示します。これ
     で、最初のタプルが呼び出し可能ではないことを *note TypeError: 199.
     で表示するよりもわかりやすくなります。(Serhiy Storchaka の貢献によ
     る bpo-15248(9))

   * *note datetime.date: 1fc, *note datetime.datetime: 4e2, *note
     datetime.timedelta: bc7. オブジェクトのサブクラス間の算術演算は、基
     底クラスではなくサブクラスのインスタンスを返すようになりました。こ
     の変更は、*note astimezone(): bc8. のような、‘datetime.timedelta’ に
     対する算術演算を直接ないし間接的に使用する実装の戻り値の型に影響し
     ます。(Paul Ganssle の貢献による bpo-32417(10))

   * Python インタープリタがCtrl-C (SIGINT) によって中断され、*note
     KeyboardInterrupt: bc9. 例外の結果が捕捉されなかった場合、Python プ
     ロセスはSIGINT シグナルか、呼び出したプロセスが、Ctrl-C によって終
     了したことを判別できるような適切な終了コードで終了するようになりま
     した。　POSIX とWindows 上のシェルは、非対話セッション内でスクリプ
     トの終了処理を適切に行うために、これを利用できます。(Gregory P.
     Smith を通してGoogle の貢献による bpo-1054041(11))

   * 先進的なプログラミングにおいて、既存の関数の *note types.CodeType:
     32d. オブジェクトを更新する必要が生じます。code オブジェクトはイミ
     ュータブルなので、既存のオブジェクトがあるにもかかわらず、新しい
     code オブジェクトを生成する必要がありました。パラメータが19もあるの
     で、一から作成するのは非合理的です。新しい ‘replace()’ メソッドを使
     えば、更新すべきパラメータを書くだけで、新しいクローンを作成するこ
     とができます。

     ここでは、*note statistics.mean(): 8e2. 関数がキーワード引数として
     '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(): 1a5.
     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__(): bca. 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__(): bcb. 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<5>.
* 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(): bcf. 関数は、特定の AST ノードの
ソースコードを返します。

(Ivan Levkivskyi の貢献による bpo-33416(1))

*note ast.parse(): 1c4. 関数の新しいフラグが有効になりました:

   * ‘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:
     93f. と *note await: 18e. キーワードは、予約語ではないとして扱われ
     ます。

(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(): 2f5. は暫定から安定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(): 2f5. は非同期IOプログラムを動かす際にまず選ぶべき選択肢で
す。

(Yury Selivanov の貢献による bpo-32314(1))

‘python -m asyncio’ を実行すると、ネイティブ async 対話型インタプリタが
起動します。高水準キーワード *note await: 18e. を使うコードの試験を簡単
に行えます。すべての呼び出しに対して新しいイベントループを作る
‘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: bd1. and no longer
inherits from *note concurrent.futures.CancelledError: bd2.
(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: bc9.
("CTRL+C") によって中断できるようになりました。(Vladimir Matveev の貢献
による bpo-23057(6))

*note asyncio.Task: 1c9. 内で、内包されたコルーチンを得られる *note
asyncio.Task.get_coro(): bd3. メソッドが追加されました。(Alex Grönholm の
貢献による bpo-36999(7))

*note asyncio.create_task(): 1cb. 関数か *note create_task(): 1cc. の
‘name’ 引数を指定するか、もしくはタスクに対して *note set_name(): bd4. メ
ソッドを呼ぶことによって、asyncio タスクに名前をつけることができます。タ
スクの名前は、*note asyncio.Task: 1c9. の ‘repr()’ 出力で、または *note
get_name(): bd5. メソッドで確認することができます。(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’
フラグを受け取るようになりました。このフラグが有効である場合、
‘compile()’ は、一般には有効な公文ではない、トップレベルの ‘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(): bd8. メソッドは
、*note collections.OrderedDict: 7f3. ではなく *note dict: 184. を返すよ
うになりました。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: bda. クラスは、コンテキストマネージャとして使用
できるようになりました。このようにしてコードブロックをプロファイルします
:

     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: bdc. は、*note collections.OrderedDict: 7f3. では
なく *note dict: 184. のインスタンスを返すようになりました。この変更によ
って、順序を保ちながら、より高速にかつメモリの使用量を減らして実行できま
す。(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: bde.　 (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: be0. とそのサブクラスが 'winmode' 引数を受け取
り、根底の ‘LoadLibraryEx’ 呼び出しのフラグを指定できるようになりました
。デフォルトでは、フラグは (フルパスか部分パスが初期DLL を読み込むのに使
われていた場合) そのDLL が保存されている場所を含んだ信頼済みの場所と、
*note add_dll_directory(): be1. によって加えられた場所からのみ、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():
be3. and *note datetime.datetime.fromisocalendar(): be4, which construct
*note date: 1fc. 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<5>,  Prev: datetime<4>,  Up: 改良されたモジュール<6>

1.7.5.10 functools
..................

*note functools.lru_cache(): be6. は、デコレータを返す関数としての使い方
に加えて、デコレータそのものとしても使えるようになりました。両方の使い方
ができます:

     @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: be7. を利用して、メソッドを *note
ジェネリック関数: be8. に変換する *note
functools.singledispatchmethod(): be9. デコレータが追加されました:

     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<5>,  Next: gettext,  Prev: functools<3>,  Up: 改良されたモジュール<6>

1.7.5.11 gc
...........

*note get_objects(): a08. は、オブジェクトを得る世代を指定するオプション
のパラメータ引数 '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<5>,  Up: 改良されたモジュール<6>

1.7.5.12 gettext
................

*note pgettext(): bec. を含む、類似のいくつかの関数が追加されました。
(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: 2c2. にかわって *note BadGzipFile: bee. 例外が送出される
ようになりました。(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(): bf1. 関数は、‘__slots__’ 属性に値が docstrings で
あるような *note dict: 184. がある場合、docstrings の内容を探索できるよ
うになりました。これは、既に *note property(): 4b3.、*note
classmethod(): 48e.、*note staticmethod(): 451. に現在あるような、ドキュ
メント生成の選択肢を提供します:

     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: 170. ‘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(): bf4. 関数に、初期値を定める、オプションの
'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(): bf7.
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(): bf9. 関数が追加さ
れました。(Raymond Hettinger の貢献による bpo-33089(1))

*note math.hypot(): bfa. 関数は、3次元以上を扱えるように拡張されました。
以前は、二次元の場合のみに対応していました。(Raymond Hettinger の貢献に
よる bpo-33089(2))

*note sum(): 695. に類似する関数として、初期値(デフォルトは1) に対してイ
テレート可能なオブジェクトの数を掛けていく *note math.prod(): bfb. 関数
が追加されました:

     >>> 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(): 8e1. と *note math.comb(): 8e0.
が追加されました:

     >>> 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(): bfc. が追加されました。この関数は、巨大な整数にも使用でき
ます。‘floor(sqrt(n))’ より高速ですが、*note math.sqrt(): bfd. より少し
遅いです:

     >>> r = 650320427
     >>> s = r ** 2
     >>> isqrt(s - 1)         # correct
     650320426
     >>> floor(sqrt(s - 1))   # incorrect
     650320427

(Mark Dickinson の貢献による bpo-36887(7))

*note math.factorial(): b45. 関数は、引数に 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(): bff. 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(): be1. 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(): c02. 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(): 26f. 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 ‘os.stat()’.  In all cases, *note
os.stat_result.st_mode: c03. 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: c04.
attribute.

On Windows, *note os.readlink(): b1e. is now able to read directory
junctions.  Note that *note islink(): c05. 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 ‘os.readlink()’ 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(): c07, *note lexists(): c08, *note isdir(): c09, *note isfile():
c0a, *note islink(): c05, and *note ismount(): c0b. now return ‘False’
instead of raising *note ValueError: 2ee. or its subclasses *note
UnicodeEncodeError: 888. and *note UnicodeDecodeError: c0c. for paths
that contain characters or bytes unrepresentable at the OS level.
(Contributed by Serhiy Storchaka in bpo-33721(1).)

*note expanduser(): c0d. 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(): c09. on Windows no longer returns ‘True’ for a link to a
non-existent directory.

*note realpath(): 264. 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: 268. methods that return a boolean result like *note
exists(): c0f, *note is_dir(): 53a, *note is_file(): 539, *note
is_mount(): c10, *note is_symlink(): c11, *note is_block_device(): c12,
*note is_char_device(): c13, *note is_fifo(): c14, *note is_socket():
c15. now return ‘False’ instead of raising *note ValueError: 2ee. or its
subclass *note UnicodeEncodeError: 888. 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:
c17. can now override the pickling logic of functions and classes by
defining the special *note reducer_override(): c18. 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: c1a. 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():
c1c. that is like *note pprint.pprint(): a2d. 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(): c1e. 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(): c20. 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(): c22. 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(): 354. 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(): c24. and *note has_dualstack_ipv6(): c25.
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(): c26, *note socket.if_nametoindex():
c27, and *note socket.if_indextoname(): c28. 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: c2a. to enable and *note
verify_client_post_handshake(): c2b. 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(): c2d. as a faster, floating-point variant
of *note statistics.mean(): 8e2.  (Contributed by Raymond Hettinger and
Steven D'Aprano in bpo-35904(1).)

Added *note statistics.geometric_mean(): c2e. (Contributed by Raymond
Hettinger in bpo-27181(2).)

Added *note statistics.multimode(): c2f. that returns a list of the most
common values.  (Contributed by Raymond Hettinger in bpo-35892(3).)

Added *note statistics.quantiles(): c30. 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: c31, 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(): 1b5.).  (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(): a4f. function which handles
uncaught *note threading.Thread.run(): c35. exception.  It can be
overridden to control how uncaught ‘threading.Thread.run()’ exceptions
are handled.  (Contributed by Victor Stinner in bpo-1230540(1).)

Add a new *note threading.get_native_id(): c36. function and a *note
native_id: c37. attribute to the *note threading.Thread: 177. 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 ‘get_native_id’ 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: 102. 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: c3b. 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: 10b. module incorporates several new features:

   * A dictionary type with per-key types.  See PEP 589(1) and *note
     typing.TypedDict: 330.  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: a59.
     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(): 8bd.  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: c3d. are now ‘Protocol’ subclasses.

   * New protocol class *note typing.SupportsIndex: c3e.

   * New functions *note typing.get_origin(): 2ad. and *note
     typing.get_args(): 2ae.

   ---------- 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: 10c. module has been upgraded to use the Unicode
12.1.0(1) release.

New function *note is_normalized(): c40. 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: c42. to support an asynchronous version of *note
Mock: c43.  Appropriate new assert functions for testing have been added
as well.  (Contributed by Lisa Roach in bpo-26467(1)).

Added *note addModuleCleanup(): c44. and *note addClassCleanup(): c45.
to unittest to support cleanups for *note setUpModule(): c46. and *note
setUpClass(): c47.  (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: 10d. module gained support for coroutines to be used as
test cases with *note unittest.IsolatedAsyncioTestCase: 35f.
(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: 118. 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(): c4a. 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: 129. and *note xml.sax: 130. 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: 12c. 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: 12c. module provides a new function
*note canonicalize(): c4c. that implements C14N 2.0.  (Contributed by
Stefan Behnel in bpo-13611(3).)

The target object of *note xml.etree.ElementTree.XMLParser: c4d. can
receive namespace declaration events through the new callback methods
‘start_ns()’ and ‘end_ns()’.  Additionally, the *note
xml.etree.ElementTree.TreeBuilder: c4e. 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: c50. 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(): c52, *note shutil.copy(): c53, *note
     shutil.copy2(): c54, *note shutil.copytree(): c22. and *note
     shutil.move(): c55. 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 ‘shutil.copyfile()’ uses
     a bigger default buffer size (1 MiB instead of 16 KiB) and a *note
     memoryview(): 166.-based variant of *note shutil.copyfileobj():
     c56. 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
     プラットフォーム依存の効率的なコピー操作: c57. section.
     (Contributed by Giampaolo Rodolà in bpo-33671(2).)

   * *note shutil.copytree(): c22. uses *note os.scandir(): c58.
     function and all copy functions depending from it use cached *note
     os.stat(): 26f. 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 ‘os.stat()’ syscalls is
     reduced by 38% making ‘shutil.copytree()’ 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: c59. 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: c5a. 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(): c5b. 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: 24f. 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: c5d. 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(): c5e, *note Py_XDECREF(): 996.

        * ‘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(): c5f. 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(): 3bf. with integer converting format units like
     ‘'i'’ will now use the *note __index__(): 19f. special method
     instead of *note __int__(): 19e, if available.  The deprecation
     warning will be emitted for objects with the ‘__int__()’ method but
     without the ‘__index__()’ method (like *note Decimal: 200. and
     *note Fraction: 215.).  *note PyNumber_Check(): c60. will now
     return ‘1’ for objects implementing ‘__index__()’.  *note
     PyNumber_Long(): c61, *note PyNumber_Float(): c62. and *note
     PyFloat_AsDouble(): c63. 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(): c64. (and its parallel macro
     ‘PyObject_INIT’) instead of in *note PyType_GenericAlloc(): c65.
     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: 3eb. to the program
     full path (*note Py_GetProgramFullPath(): 3ea.) rather than to the
     program name (*note Py_GetProgramName(): 3ec.).  (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: 12c. module now emit a *note DeprecationWarning: 1a4.
     instead of *note PendingDeprecationWarning: ac9.  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: 94d. to *note
     loop.set_default_executor(): 94e. 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: 942, *note
     wsgiref.util.FileWrapper: 943. and *note fileinput.FileInput: 944.
     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: 32f. 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: 2f1. should be used instead.
     (Contributed by Serhiy Storchaka in bpo-32892(6).)

   * *note ast.NodeVisitor: 2f2. 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(): c67. method to handle all constant
     nodes.  (Contributed by Serhiy Storchaka in bpo-36917(7).)

   * The ‘@asyncio.coroutine’ *note decorator: 93e. 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(): c68, *note asyncio.gather(): 813,
     *note asyncio.shield(): c69, *note asyncio.wait_for(): 815, *note
     asyncio.wait(): 6a7, *note asyncio.as_completed(): 4c6, *note
     asyncio.Task: 1c9, *note asyncio.Lock: c6a, *note asyncio.Event:
     2f6, *note asyncio.Condition: c6b, *note asyncio.Semaphore: c6c,
     *note asyncio.BoundedSemaphore: c6d, *note asyncio.Queue: c6e,
     *note asyncio.create_subprocess_exec(): c6f, and *note
     asyncio.create_subprocess_shell(): c70.

   * 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(): c71. and *note
     install(): c72. 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: 177. 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: 200.s, *note
     Fraction: 215.s and any other objects that can be converted to
     integers only with a loss (e.g.  that have the *note __int__():
     19e. method but do not have the *note __index__(): 19f. 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(): 21a, *note
          weakref.finalize(): c73, *note profile.Profile.runcall(): c74,
          ‘cProfile.Profile.runcall()’, *note bdb.Bdb.runcall(): c75,
          *note trace.Trace.runfunc(): c76. and *note curses.wrapper():
          c77.

        - 'function' in *note unittest.TestCase.addCleanup(): c78.

        - 'fn' in the *note submit(): c79. method of *note
          concurrent.futures.ThreadPoolExecutor: 94d. and *note
          concurrent.futures.ProcessPoolExecutor: 1d8.

        - 'callback' in *note contextlib.ExitStack.callback(): c7a,
          ‘contextlib.AsyncExitStack.callback()’ and *note
          contextlib.AsyncExitStack.push_async_callback(): c7b.

        - 'c' and 'typeid' in the ‘create()’ method of
          ‘multiprocessing.managers.Server’ and
          ‘multiprocessing.managers.SharedMemoryServer’.

        - 'obj' in *note weakref.finalize(): c73.

     In future releases of Python, they will be *note positional-only:
     c7c.  (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(): 31c. 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(): c7e. or
     *note time.process_time(): c7f. 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: c4d. 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: c4d.
     (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(): a04. and
     *note fileinput.FileInput(): 944. 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: 1af. 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:
     3c1, *note int: 19c, *note float: 197, *note complex: 198. and few
     classes from the standard library.  They now inherit ‘__str__()’
     from *note object: c82.  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: 293. 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(): c83, and *note PyGILState_Ensure():
     64a.  If this behavior is not desired, guard the call by checking
     ‘_Py_IsFinalizing()’ or *note sys.is_finalizing(): c84.
     (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(): c86. 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 ‘Popen’ constructor using
     ‘os.posix_spawn()’ no longer raises an exception on errors like
     "missing program".  Instead the child process fails with a non-zero
     *note returncode: c87.  (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: 246.
     (Contributed by Eric Snow in bpo-34651(4), modified by Christian
     Heimes in bpo-37951(5).)

   * The *note imaplib.IMAP4.logout(): c88. 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(): 31c. instead.
     (Contributed by Victor Stinner in bpo-35345(7).)

   * The *note statistics.mode(): c89. 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(): c8a. method of the *note
     tkinter.ttk.Treeview: c8b. 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():
     c8c. for changing the selection.  (Contributed by Serhiy Storchaka
     in bpo-31508(9).)

   * The *note writexml(): c8d, *note toxml(): c8e. and *note
     toprettyxml(): c8f. methods of *note xml.dom.minidom: 129. and the
     *note write(): c90. method of *note xml.etree.ElementTree: 12c. 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(): c91. 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:
     c4d. will no longer be called and will emit a *note RuntimeWarning:
     4d7. instead of a *note DeprecationWarning: 1a4.  Define the *note
     doctype(): c92. method on a target for handling an XML doctype
     declaration.  (Contributed by Serhiy Storchaka in bpo-29209(12).)

   * A *note RuntimeError: 246. is now raised when the custom metaclass
     doesn't provide the ‘__classcell__’ entry in the namespace passed
     to ‘type.__new__’.  A *note DeprecationWarning: 1a4. was emitted in
     Python 3.6-3.7.  (Contributed by Serhiy Storchaka in
     bpo-23722(13).)

   * The *note cProfile.Profile: bda. class can now be used as a context
     manager.  (Contributed by Scott Sanderson in bpo-29235(14).)

   * *note shutil.copyfile(): c52, *note shutil.copy(): c53, *note
     shutil.copy2(): c54, *note shutil.copytree(): c22. and *note
     shutil.move(): c55. use platform-specific "fast-copy" syscalls (see
     *note プラットフォーム依存の効率的なコピー操作: c57. section).

   * *note shutil.copyfile(): c52. 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: abe. 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(): c93. 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: 129. and *note xml.sax: 130. 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: c94, *note dbm.gnu.error: c95. or
     *note dbm.ndbm.error: c96.) 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: 2f1. 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(): c0d. 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: bd1. and no
     longer inherits from *note concurrent.futures.CancelledError: bd2.
     (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: 1c9.
     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(): c97. 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: c98. 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(): be1. 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
     ‘add_dll_directory()’ 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: 32d. 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 ‘types.CodeType’ can be used to make the code
     future-proof.

   * The parameter ‘digestmod’ for *note hmac.new(): c9a. 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: c9c. 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(): 42e. 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(): 3bf, *note Py_BuildValue(): 3c0, *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 引数の解釈と値の構築: 3d3. 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(): c65. to the more low-level
     functions, *note PyObject_Init(): c64. and ‘PyObject_INIT’.  This
     makes types created through ‘PyType_FromSpec()’ behave like other
     classes in managed code.

     *note Statically allocated types: 987. 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: b80, *note PyObject_NewVar: b81,
          *note PyObject_GC_New(): c9d, *note PyObject_GC_NewVar(): c9e,
          or any other custom allocator that uses *note PyObject_Init():
          c64. 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(): c9f. 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: ca0. exported by a third-party extension module is
     supposed to have all the slots expected in the current Python
     version, including *note tp_finalize: ca1. (*note
     Py_TPFLAGS_HAVE_FINALIZE: 425. is not checked anymore before
     reading ‘tp_finalize’).

     (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 を使う: ca2. 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: 180, *note
     continue: 181. and *note return: 1b0.

     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: ca4. for handling exceptions
     raised when awaiting a next item in an *note async for: ca5. loop.
     (Contributed by Serhiy Storchaka in bpo-33041(2).)

   * The *note MAP_ADD: ca6. 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(): 940. での '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(): c22.  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(): 321. and *note
urllib.parse.parse_qsl(): 320.  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: afa. 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: 111.
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(): b5e. treats
leading zeros as octal notation.  glibc implementation of modern *note
inet_pton(): b5f. 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: 19c. and *note str: 16a. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ee. 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:
     1a4.  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
変更履歴: 143. をご覧ください。

* 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: cba. 、型アノテーションの評価の遅延。

後方非互換な文法の変更:

   * *note async: 93f. と *note await: 18e. は予約されたキーワードになり
     ました。

新たなライブラリモジュール:

   * *note contextvars: 28.: *note PEP 567 - コンテキスト変数: cbb.

   * *note dataclasses: 33.: *note PEP 557 - データクラス: cbc.

   * *note importlib.resources: cbd.

新たな組み込み機能:

   * *note PEP 553: cbe. 、新しい *note breakpoint(): 273. 関数。

Python のデータモデルの改善:

   * *note PEP 562: cbf. 、モジュール属性へのアクセスのカスタマイズ。

   * *note PEP 560: cc0. 、typing モジュールとジェネリック型に対する言語
     コアによるサポート。

   * *note dict: cc1. オブジェクトの挿入順序を保存するという性質が、公式
     に Python 言語仕様の一部であると 宣言されました(1) 。

標準ライブラリーの顕著な改善

   * *note asyncio: b. モジュールに新しい機能が加わりました。 顕著な
     *note 使い勝手とパフォーマンスの改善: cc2. です。

   * *note time: f4. モジュールが *note ナノ秒単位の分解能を持つ関数:
     cc3. をサポートするようになりました。

CPython の実装の改善:

   * デフォルトのテキストエンコーディングとして ASCII を使わなくなりまし
     た:

        * *note PEP 538: cc4. 、レガシーな C ロケールの抑圧

        * *note PEP 540: cc5, UTF-8 実行時モードの強制

   * *note PEP 552: cc6. 、決定論的な .pyc

   * *note New Python Development Mode: cc7.

   * *note PEP 565: cc8. 、 *note DeprecationWarning: 1a4. の取り扱いの
     改善

C API の改善:

   * *note PEP 539: cc9. 、スレッドローカルなストレージのための新しい C
     API

ドキュメントの改善:

   * *note PEP 545: cca. 、 Python ドキュメント翻訳

   * 新しいドキュメント翻訳: 日本語(2) 、 フランス語(3) 、 韓国語(4) 。

このリリースの特色は、多くの領域での特筆すべきパフォーマンスの改善です。
*note 最適化: ccb. 節に詳細な一覧があります。

1つ前にリリースされた Python との互換性に影響を持つ変更の一覧については
、 *note Python 3.7 への移植: ccc. 節を参照してください。

   ---------- Footnotes ----------

   (1) 
https://mail.python.org/pipermail/python-dev/2017-December/151283.html

   (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():
8c1. を使って実行時にアノテーションを解決できます。 たいていのケースでは
その必要は無く、(短い文字列はインタプリタによって格納されるので) アノテ
ーションを保存するコストはより安くなり、起動時間がより速くなります。

使い勝手の点では、アノテーションは前方参照をサポートするようになり、次の
文法が妥当なものになりました:

     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: cd0. 環境変数のドキ
ュメントにある通り、自動的にロケールを 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: cd1. のデフォルトのエラーハンドラは (‘strict’ ではなく)
‘surrogateescape’ になります。 *note stderr: b37. のデフォルトのエラーハ
ンドラは、ロケールに関係無く引き続き ‘backslashreplace’ です。

デフォルトではロケールの強制は暗黙に行われますが、ロケールが関係する結合
における問題のデバッグを支援するために、 ‘PYTHONCOERCECLOCALE=warn’ を設
定することで (*note stderr: b37. に直接出力される) 明示的な警告を要求で
きます。 この設定を有効にしていると、コアのインタプリタの初期化時にレガ
シーな C ロケールが有効なままの場合、 Python 実行器が警告を出力します。

PEP 538(3) のロケール強制には、(非 Python アプリケーションや古いバージョ
ンの Python で動くのも含めた) 子プロセスに加え (GNU ‘readline’ などの) 影
響を受ける拡張モジュールにも利益がある一方、適切な対象ロケールが実行する
システムに存在することを要求するという負の面もあります。 (例えば、
RHEL/CentOS 7 で起きているように) 適切な対象ロケールで利用可能なものが無
いケースにきちんと対処するために、 Python 3.7 には *note PEP 540; 強制
UTF-8 実行モード: cc5. も実装されています。

参考
....

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: 170. ‘utf8’ command line option and *note PYTHONUTF8:
cd3. environment variable can be used to enable the *note Python UTF-8
Mode: 867.

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: cd1. 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 実行モード: cc5.).

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(): 273. 関数があります。

Built-in ‘breakpoint()’ calls *note sys.breakpointhook(): cd5.  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: cd6. 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: cd8. 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: cd9. 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: cda. 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__(): cdc. on modules and will
call it whenever a module attribute is otherwise not found.  Defining
*note __dir__(): cdd. 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(): cdf.

   * *note time.clock_settime_ns(): ce0.

   * *note time.monotonic_ns(): ce1.

   * *note time.perf_counter_ns(): ce2.

   * *note time.process_time_ns(): ce3.

   * *note time.time_ns(): ce4.

新しい関数は、整数値としてナノ秒単位の数値を返します。

Measurements(2) show that on Linux and Windows the resolution of *note
time.time_ns(): ce4. 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: 1a4. 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: 1a4.: 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: ac9.: displayed by default only
     when running tests, intended for cases where a future version
     upgrade will change the warning category to *note
     DeprecationWarning: 1a4. or *note FutureWarning: 659.

Previously both *note DeprecationWarning: 1a4. and *note
PendingDeprecationWarning: ac9. 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: 10b. module are extensively used by the community,
so this restriction is removed.  The PEP introduces two special methods
*note __class_getitem__(): 947. and *note __mro_entries__(): ce7, these
methods are now used by most classes and special constructs in ‘typing’.
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 ‘typing’ 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: 170. ‘dev’ command line option or the new *note
PYTHONDEVMODE: ceb. 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: 18e. expression and comprehensions containing an
     *note async for: ca5. clause were illegal in the expressions in
     *note formatted string literals: 19b. 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(): 191. and *note bytearray.fromhex(): 192. now
     ignore all ASCII whitespace, not only spaces.  (Contributed by
     Robert Xiao in bpo-28927(3).)

   * *note str: 16a, *note bytes: 193, and *note bytearray: 342. gained
     support for the new *note isascii(): ced. 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: cee. can now be instantiated from Python code,
     and the *note tb_next: cef. attribute on *note tracebacks: cf0. is
     now writable.  (Contributed by Nathaniel J. Smith in bpo-30579(8).)

   * When using the *note -m: 23e. 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: 170. ‘importtime’ option or the *note
     PYTHONPROFILEIMPORTTIME: cf1. 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:
cf4. 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__(): cf6, *note __hash__(): cf7. などのマジックメソッドは自動で生成
されます。

以下はプログラム例です:

     @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<6>.
* 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(): cfb. 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: cfd.  Notable changes include:

   * The new *note provisional: 3cf. *note asyncio.run(): 2f5. 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(): cfe, *note loop.call_soon_threadsafe(): cff,
     *note loop.call_later(): d00, *note loop.call_at(): d01, and *note
     Future.add_done_callback(): d02. have a new optional keyword-only
     'context' parameter.  *note Tasks: 1c9. 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(): 1cb. 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(): d03. 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(): d04. 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: 1c9. instance, and the new *note
     asyncio.all_tasks(): b53. 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: c98. 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(): d05. function returns the
     currently running loop, and raises a *note RuntimeError: 246. if no
     loop is running.  This is in contrast with *note
     asyncio.get_event_loop(): 2f4, 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(): d06. coroutine method
     allows waiting until the stream writer is closed.  The new *note
     StreamWriter.is_closing(): d07. 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(): d08. coroutine method allows
     sending files using *note os.sendfile: d09. when possible.
     (Contributed by Andrew Svetlov in bpo-32410(11).)

   * The new *note Future.get_loop(): d0a. and ‘Task.get_loop()’ methods
     return the instance of the loop on which a task or a future were
     created.  *note Server.get_loop(): d0b. allows doing the same for
     *note asyncio.Server: d0c. 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: d0c. begin serving.  Previously, the server would
     start serving immediately when created.  The new 'start_serving'
     keyword argument to *note loop.create_server(): d0d. and *note
     loop.create_unix_server(): 4ca, as well as *note
     Server.start_serving(): d0e, and *note Server.serve_forever(): d0f.
     can be used to decouple server instantiation and serving.  The new
     *note Server.is_serving(): d10. method returns ‘True’ if the server
     is serving.  ‘Server’ 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(): d00. gained
     the new *note when(): d11. method which returns an absolute
     scheduled callback timestamp.  (Contributed by Andrew Svetlov in
     bpo-32741(15).)

   * The *note loop.create_datagram_endpoint(): 940. method gained
     support for Unix sockets.  (Contributed by Quentin Dawans in
     bpo-31245(16).)

   * The *note asyncio.open_connection(): d12, *note
     asyncio.start_server(): d13. functions, *note
     loop.create_connection(): 818, *note loop.create_server(): d0d,
     *note loop.create_accepted_socket(): 9e2. 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(): d14. 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:
     93f./*note await: 18e. syntax.  (Contributed by Andrew Svetlov in
     bpo-32193(19).)

   * The new *note ReadTransport.is_reading(): d15. method can be used
     to determine the reading state of the transport.  Additionally,
     calls to *note ReadTransport.resume_reading(): d16. and *note
     ReadTransport.pause_reading(): d17. 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: d18.

   ---------- 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(): d1a. 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: d1c. クラスに、作成された 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(): d1f. learned the new 'invalidation_mode'
parameter, which can be used to enable *note hash-based .pyc
invalidation: cc6.  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: 1d8. と *note ThreadPoolExecutor: 94d. が新し
いコンストラクタ引数 'initializer' と 'initargs' をサポートするようにな
りました。 (Contributed by Antoine Pitrou in bpo-21423(1).)

*note ProcessPoolExecutor: 1d8. が新しい '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(): 9f3. is a simpler and faster no-op context
manager than *note ExitStack: d22.  (Contributed by Jesse-Bakker in
bpo-10049(1).)

The new *note asynccontextmanager(): d23, *note
AbstractAsyncContextManager: d24, and *note AsyncExitStack: d25. 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(): d29.  (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: cbb. 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(): 207. 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: 199. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
835. member will raise ‘TypeError’ (e.g.  ‘1 in Perm.RW’); currently,
both operations return *note False: d2f. 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<6>,  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<6>,  Next: hmac<3>,  Prev: functools<4>,  Up: 改良されたモジュール<7>

1.8.5.18 gc
...........

The new *note gc.freeze(): d32. 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(): d33. functions reverses this operation.  Additionally,
*note gc.get_freeze_count(): d34. 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<6>,  Up: 改良されたモジュール<7>

1.8.5.19 hmac
.............

The *note hmac: 6e. module now has an optimized one-shot *note digest():
d36. function, which is up to three times faster than *note HMAC(): d37.
(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: d39. and *note HTTPSConnection: d3a. 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: d3c. 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: d3c. 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: d3d. class uses threads to handle
requests using *note ThreadingMixIn: d3e.  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:
cbd.  (Contributed by Barry Warsaw, Brett Cannon in bpo-32248(1).)

*note importlib.reload(): 73d. now raises *note ModuleNotFoundError:
d41. if the module lacks a spec.  (Contributed by Garvit Khatri in
bpo-29851(2).)

*note importlib.util.find_spec(): 5af. now raises *note
ModuleNotFoundError: d41. 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(): d42. can be used to compute
the hash of the passed source.  A *note hash-based .pyc file: cc6.
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(): d44. 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(): d47. now accepts *note integer-like objects:
19f. 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:
cc5.

   ---------- 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: d4a. インスタンスが pickle 化できるようになりました。
(Contributed by Vinay Sajip in bpo-30520(1).)

The new *note StreamHandler.setStream(): d4b. 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(): d4c.
(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(): d4e. 関数が 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(): d52. method explicitly closes the process
object and releases all resources associated with it.  *note ValueError:
2ee. is raised if the underlying process is still running.  (Contributed
by Antoine Pitrou in bpo-30596(1).)

The new *note Process.kill(): d53. method can be used to terminate the
process using the *note SIGKILL: d54. signal on Unix.  (Contributed by
Vitor Pereira in bpo-30794(2).)

Non-daemonic threads created by *note Process: 254. 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(): d56. now accepts the 'path' argument as *note bytes:
193.  (Contributed by Serhiy Storchaka in bpo-28682(1).)

*note os.scandir(): c58. gained support for *note file descriptors: d57.
(Contributed by Serhiy Storchaka in bpo-25996(2).)

The new *note register_at_fork(): 353. function allows registering
Python callbacks to be executed at process fork.  (Contributed by
Antoine Pitrou in bpo-16500(3).)

Added *note os.preadv(): d58. (combine the functionality of *note
os.readv(): d59. and *note os.pread(): d5a.) and *note os.pwritev():
d5b. functions (combine the functionality of *note os.writev(): d5c. and
*note os.pwrite(): d5d.).  (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(): d5e. 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(): 26f. now contains the *note
st_fstype: d5f. 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(): c10. 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(): 274. 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(): c1e. - 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: d65. 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: d67. and *note
re.UNICODE: d68. 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: d67. 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(): d69.  (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(): d6b. 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(): d6d. 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(): d6e. function closes the passed socket
file descriptor.  This function should be used instead of *note
os.close(): d6f. 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: d70. (Linux 2.6.13), *note
socket.TCP_USER_TIMEOUT: d70. (Linux 2.6.37), and *note
socket.TCP_NOTSENT_LOWAT: d70. (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: d71. 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: d73. now waits until all
non-daemon threads complete.  ‘socketserver.ForkingMixIn.server_close’
now waits until all child processes complete.

Add a new *note socketserver.ForkingMixIn.block_on_close: d74. class
attribute to *note socketserver.ForkingMixIn: d75. and *note
socketserver.ThreadingMixIn: d3e. 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(): d77.
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: d79. 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: d7a.  (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
     サポート対象プラットフォームからの除外: d7b. 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: d7c. 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: d7d.  (Contributed by Christian Heimes
in bpo-32947(7), bpo-20995(8), bpo-29136(9), bpo-30622(10) and
bpo-33618(11))

*note SSLSocket: aeb. and *note SSLObject: d7e. no longer have a public
constructor.  Direct instantiation was never a documented and supported
feature.  Instances must be created with *note SSLContext: 355. methods
*note wrap_socket(): 748. and *note wrap_bio(): d7f.  (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: a74. and
*note SSLContext.maximum_version: a75.  Supported protocols are
indicated by several new flags, such as *note HAS_TLSv1_1: d80.
(Contributed by Christian Heimes in bpo-32609(13).)

Added *note ssl.SSLContext.post_handshake_auth: c2a. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): c2b. 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: 898. 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(): d83. function accepts the new
'capture_output' keyword argument.  When true, stdout and stderr will be
captured.  This is equivalent to passing *note subprocess.PIPE: d84. 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: bc9. during *note subprocess.call(): d85, *note
subprocess.run(): d83, 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(): cd5. hook function is called by the
built-in *note breakpoint(): 273.  (Contributed by Barry Warsaw in
bpo-31353(1).)

On Android, the new *note sys.getandroidapilevel(): d87. returns the
build-time Android API version.  (Contributed by Victor Stinner in
bpo-28740(2).)

The new *note sys.get_coroutine_origin_tracking_depth(): d88. function
returns the current coroutine origin tracking depth, as set by the new
*note sys.set_coroutine_origin_tracking_depth(): d89.  *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(): cdf.

   * *note time.clock_settime_ns(): ce0.

   * *note time.monotonic_ns(): ce1.

   * *note time.perf_counter_ns(): ce2.

   * *note time.process_time_ns(): ce3.

   * *note time.time_ns(): ce4.

New clock identifiers have been added:

   * *note time.CLOCK_BOOTTIME: d8b. (Linux): Identical to *note
     time.CLOCK_MONOTONIC: 8a9, except it also includes any time that
     the system is suspended.

   * *note time.CLOCK_PROF: d8c. (FreeBSD, NetBSD and OpenBSD):
     High-resolution per-process CPU timer.

   * *note time.CLOCK_UPTIME: d8d. (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(): b34. and *note time.thread_time_ns():
d8e. 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(): d8f. 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: d91. 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: d93. behaves more like regular tracebacks,
sorting the frames from oldest to most recent.  *note
Traceback.format(): d94. 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: d96, *note MethodWrapperType: 85b,
*note MethodDescriptorType: d97, and *note ClassMethodDescriptorType:
d98. 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(): d99. 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: 10c. 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: d9d. 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(): d9e. function allows sealing *note Mock: c43.
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(): da0. 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: da3. 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(): da4. 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(): da5.  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: 170. ‘dev’
     option) are always passed to the warnings machinery via the *note
     sys.warnoptions: 3f3. 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: aca. option

        * any filters specified with the *note PYTHONWARNINGS: da7.
          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__: cc8. 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: 129. and *note xml.sax: 130. 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: daa. 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(): dad. 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(): dad. 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: 8d4. 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: cc9. for an
overview and *note Thread-specific storage API: cd9. for a complete
reference.  (Contributed by Masayuki Yamamoto in bpo-25658(1).)

The new *note context variables: cbb. functionality exposes a number of
*note new C APIs: cf4.

The new *note PyImport_GetModule(): db0. function returns the previously
imported module with the given name.  (Contributed by Eric Snow in
bpo-28411(2).)

The new *note Py_RETURN_RICHCOMPARE: db1. macro eases writing rich
comparison functions.  (Contributed by Petr Victorin in bpo-23699(3).)

The new *note Py_UNREACHABLE: db2. macro can be used to mark unreachable
code paths.  (Contributed by Barry Warsaw in bpo-31338(4).)

The *note tracemalloc: 106. now exposes a C API through the new *note
PyTraceMalloc_Track(): db3. and *note PyTraceMalloc_Untrack(): db4.
functions.  (Contributed by Victor Stinner in bpo-30054(5).)

The new *note import__find__load__start: db5. and *note
import__find__load__done: db5. 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: db6, *note PyStructSequence_Field: db7, *note
PyStructSequence_Desc: db8, 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(): a9d. and *note
PyUnicode_AsUTF8(): 422. is now of type ‘const char *’ rather of ‘char
*’.  (Contributed by Serhiy Storchaka in bpo-28769(8).)

The result of *note PyMapping_Keys(): db9, *note PyMapping_Values():
dba. and *note PyMapping_Items(): dbb. 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(): 430. and *note
PySlice_AdjustIndices(): 431.  (Contributed by Serhiy Storchaka in
bpo-27867(10).)

*note PyOS_AfterFork(): 42d. is deprecated in favour of the new
functions *note PyOS_BeforeFork(): dbc, *note PyOS_AfterFork_Parent():
dbd. and *note PyOS_AfterFork_Child(): 42e.  (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(): dbe. and *note PyTimeZone_FromOffsetAndName():
dbf, and access to the UTC singleton with *note PyDateTime_TimeZone_UTC:
dc0.  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(): dc1. changed from long to unsigned long.
(Contributed by Serhiy Storchaka in bpo-6532(15).)

*note PyUnicode_AsWideCharString(): abd. now raises a *note ValueError:
2ee. 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(): 45e. 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 への移植: ccc. section
in this document and the *note Before Python initialization: dc2.
section in the C API documentation for more details.

The new *note PyInterpreterState_GetID(): dc3. returns the unique ID for
a given interpreter.  (Contributed by Eric Snow in bpo-29102(17).)

*note Py_DecodeLocale(): dc4, *note Py_EncodeLocale(): dc5. now use the
UTF-8 encoding when the *note UTF-8 mode: cc5. is enabled.  (Contributed
by Victor Stinner in bpo-29240(18).)

*note PyUnicode_DecodeLocaleAndSize(): dc6. and *note
PyUnicode_EncodeLocale(): dc7. 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(): aba. 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(): 2f4. 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: dca. 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(): c68. 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: cc0, the import time of *note typing:
10b. 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(): dcb. and *note list.sort(): dcc. have been optimized for
common cases to be up to 40-75% faster.  (Contributed by Elliot
Gorokhovsky in bpo-28685(14).)

*note dict.copy(): dcd. is now up to 5.5 times faster.  (Contributed by
Yury Selivanov in bpo-31179(15).)

*note hasattr(): 6f9. and *note getattr(): dce. are now about 4 times
faster when 'name' is not found and 'obj' does not override *note
object.__getattr__(): 6fa. or *note object.__getattribute__(): dcf.
(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(): dd0. and *note
datetime.date.fromtimestamp(): dd1. are now up to 30% faster in the
common case.  (Contributed by Paul Ganssle in bpo-32403(19).)

The *note os.fwalk(): d56. function is now up to 2 times faster thanks
to the use of *note os.scandir(): c58.  (Contributed by Serhiy Storchaka
in bpo-25996(20).)

The speed of the *note shutil.rmtree(): 354. function has been improved
by 20-40% thanks to the use of the *note os.scandir(): c58. 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(): dd2. 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(): dd3. methods of classes *note
selectors.EpollSelector: dd4, *note selectors.PollSelector: dd5. and
*note selectors.DevpollSelector: dd6. 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(): 2af. and *note issubclass(): 9c8. 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: 1fc. 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(): dd7. and *note math.erfc(): dd8. 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: dda. and *note
     f_trace_opcodes: ddb. 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: ddd.
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: 1a4. when
compiled, in Python 3.8 this will be a *note SyntaxError: 18f.
(Contributed by Serhiy Storchaka in bpo-10544(1).)

Returning a subclass of *note complex: 198. from *note
object.__complex__(): 7fd. is deprecated and will be an error in future
Python versions.  This makes ‘__complex__()’ consistent with *note
object.__int__(): 19e. and *note object.__float__(): bc5.  (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: c6a.
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: 199. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
835. member will raise ‘TypeError’ (e.g.  ‘1 in Perm.RW’); currently,
both operations return *note False: d2f. 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(): a6c.) and ‘PathEntryFinder.find_loader()’
(replaced by *note PathEntryFinder.find_spec(): a70.) both deprecated in
Python 3.4 now emit *note DeprecationWarning: 1a4.  (Contributed by
Matthias Bussonnier in bpo-29576(1).)

The *note importlib.abc.ResourceLoader: de6. 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(): a83. and
*note socket.ntohs(): a84. 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(): b49. 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(): 42f. 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(): 42d. has been deprecated.  Use *note
PyOS_BeforeFork(): dbc, *note PyOS_AfterFork_Parent(): dbd. or *note
PyOS_AfterFork_Child(): 42e. 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(): df2.  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(): df3. 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(): 3c1, *note float(): 197, *note list(): 24f.
     and *note tuple(): 614. no longer take keyword arguments.  The
     first argument of *note int(): 19c. 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(): df4. 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: aeb. and *note
     ssl.SSLObject: d7e. 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: 355.  (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: 93f. and *note await: 18e. names are now reserved
     keywords.  Code using these names as identifiers will now raise a
     *note SyntaxError: 18f.  (Contributed by Jelle Zijlstra in
     bpo-30406(1).)

   * PEP 479(2) is enabled for all code in Python 3.7, meaning that
     *note StopIteration: df9. exceptions raised directly or indirectly
     in coroutines and generators are transformed into *note
     RuntimeError: 246. exceptions.  (Contributed by Yury Selivanov in
     bpo-32670(3).)

   * *note object.__aiter__(): dfa. 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: 18f, 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: 23e. switch, the initial working directory
     is now added to *note sys.path: 3e2, 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: d73. now waits
     until all non-daemon threads complete.  Set the new *note
     socketserver.ThreadingMixIn.block_on_close: d74. 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: d73. now waits until
     all child processes complete.  Set the new *note
     socketserver.ForkingMixIn.block_on_close: d74. 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(): dfc. 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(): dfd. now raises a *note ValueError:
     2ee. 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(): dfe.
     is now *note positional-only: c7c.  Passing it as a keyword
     argument was deprecated in Python 3.5.  (Contributed by Serhiy
     Storchaka in bpo-29193(7).)

   * Attributes *note key: dff, *note value: e00. and *note coded_value:
     e01. of class *note http.cookies.Morsel: e02. are now read-only.
     Assigning to them was deprecated in Python 3.5.  Use the *note
     set(): e03. 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: e04. type is now *note str: 16a.
     instead of *note bytes: 193.  (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(): e05. on a socket created by *note socket.share:
     e06. 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: bc7. has changed to include
     the keyword arguments in the output.  (Contributed by Utkarsh
     Upadhyay in bpo-30302(13).)

   * Because *note shutil.rmtree(): 354. is now implemented using the
     *note os.scandir(): c58. 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(): e07. 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: d93. frames are now sorted from oldest
     to most recent to be more consistent with *note traceback: 105.
     (Contributed by Jesse Bakker in bpo-32121(19).)

   * On OSes that support *note socket.SOCK_NONBLOCK: e08. or *note
     socket.SOCK_CLOEXEC: e09. bit flags, the *note socket.type: e0a. 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: d2f. to *note
     True: e0b. when redirecting the standard handles.  If you
     previously depended on handles being inherited when using
     ‘subprocess.Popen’ with standard io redirection, you will have to
     pass ‘close_fds=False’ to preserve the previous behaviour, or use
     *note STARTUPINFO.lpAttributeList: e0c.

   * *note importlib.machinery.PathFinder.invalidate_caches(): e0d. -
     which implicitly affects *note importlib.invalidate_caches(): e0e.
     - 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(): e0f, *note
     loop.sock_sendall(): e10, *note loop.sock_accept(): e11, *note
     loop.getaddrinfo(): e12, *note loop.getnameinfo(): e13. have been
     changed to be proper coroutine methods to match their
     documentation.  Previously, these methods returned *note
     asyncio.Future: dca. instances.  (Contributed by Yury Selivanov in
     bpo-32327(22).)

   * *note asyncio.Server.sockets: e14. 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: e04. is now a *note str: 16a. instance instead
     of a *note bytes: 193. 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(): e15.
     (Contributed by Anthony Sottile in bpo-26510(25).)

   * *note ast.literal_eval(): e16. is now stricter.  Addition and
     subtraction of arbitrary numbers are no longer allowed.
     (Contributed by Serhiy Storchaka in bpo-31778(26).)

   * *note Calendar.itermonthdates: e17. 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: e18. and
     *note Calendar.itermonthdays4: e19. can be used.  The new methods
     return tuples and are not restricted by the range supported by
     *note datetime.date: 1fc.  (Contributed by Alexander Belopolsky in
     bpo-28292(27).)

   * *note collections.ChainMap: e1a. now preserves the order of the
     underlying mappings.  (Contributed by Raymond Hettinger in
     bpo-32792(28).)

   * The ‘submit()’ method of *note
     concurrent.futures.ThreadPoolExecutor: 94d. and *note
     concurrent.futures.ProcessPoolExecutor: 1d8. now raises a *note
     RuntimeError: 246. 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(): 42f. is considered unsafe for
resizable sequences.  If the slice indices are not instances of *note
int: 19c, 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(): 430. and *note
PySlice_AdjustIndices(): 431.  (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: 3e2. is now called
‘<python-executable>._pth’ instead of ‘'sys.path'’.  See *note
モジュールの検索: e1e. 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: 404. to a value greater than one is
no longer sufficient to both emit *note BytesWarning: e20. 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(): 45e. now consistently reads
and respects all of the same environment settings as *note Py_Main():
e22. (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: 408. to 1 before calling ‘Py_Initialize()’.

In 3.7.1 the C API for Context Variables *note was updated: e23. to use
*note PyObject: 5df. pointers.  See also bpo-34762(2).

In 3.7.1 the *note tokenize: 102. 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: 118. 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(): 940. での '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(): 321. and *note
urllib.parse.parse_qsl(): 320.  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: afa. 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(): 111. 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: 19c. and *note str: 16a. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ee. 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: e2d.、フォーマット済み文字列リテラル。

   * *note PEP 515: e2e.、数値リテラル内のアンダースコア。

   * *note PEP 526: e2f.、変数アノテーションの文法。

   * *note PEP 525: e30.、非同期ジェネレータ。

   * *note PEP 530: e31.: 非同期内包表記

新たなライブラリモジュール:

   * *note secrets: c5.: *note PEP 506 - 標準ライブラリーに Secrets
     モジュールを追加: e32.

CPython の実装の改善:

   * *note dict: cc1. 型は、 Raymond Hettinger(1) の提案に基づき、 PyPy
     dict implementation(2) と同様の *note よりコンパクトな表現: e33. を
     使うように再実装されました。 その結果、 Python 3.5 と比較して辞書が
     使うメモリ 20% から 25% 減少しました。

   * *note 新しいプロトコル: e34. により、クラス生成のカスタマイズがより
     簡単になりました。

   * クラス属性の定義の順番が *note 保持されるようになりました: e35.。

   * ‘**kwargs’ の要素の順序が、キーワード引数が関数に渡されたときの
     *note 順序に一致した: e36. ものになりました。

   * DTrace と SystemTap の *note プローブのサポート: e37. が追加されま
     した。

   * 新しい *note PYTHONMALLOC: e38.  環境変数が、インタープリタのメモリ
     確保とメモリアクセスエラーのデバッグに使えるようになりました。

標準ライブラリーの顕著な改善

   * 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: e39. 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 地域時間の曖昧さ回避: e3a. が
     サポートされました。

   * *note typing: 10b. モジュールに数多くの *note 改善: e3b. がなされま
     した。

   * *note tracemalloc: 106. モジュールが大幅に書き直され、改善されたメ
     モリ割り当てエラーの診断プログラムの提供だけでなく、 *note
     ResourceWarning: 54c. の出力メッセージも改善されています。 より詳し
     いことは *note PYTHONMALLOC 節: e38. を参照してください。

セキュリティの改善:

   * 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(): e3c. キー導出関数がサポートされるようにな
     りました。

Windows の改善:

   * *note PEP 528: e3d. および *note PEP 529: e3e.、 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: e3f. 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: e1e. for more information.

   * A ‘python36.zip’ file now works as a landmark to infer *note
     PYTHONHOME: 3ee.  See *note the documentation: e1e. 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
フォーマット済み文字列リテラル: 19b. を導入しました。

フォーマット済み文字列リテラルはプレフィックスに ‘'f'’ をとり *note
str.format(): 833. による書式文字列に似ています。これらには中括弧で囲ま
れた置換フィールドがあります。置換フィールドは実行時に評価される式で、
*note format(): 19a. プロトコルによってフォーマットされます:

     >>> 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: 19b.

   ---------- 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(): 1a7. 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
クラスオブジェクトの作成: e48.).

参考
....

PEP 487(1) - Simpler customization of class creation

     PEP 著と実装 Martin Teichmann.

*note Feature documentation: e49.

   ---------- 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__(): e4c. 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: e4d.

   ---------- 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: 16a.
or *note bytes: 193. 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: 19c. 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:
e4f. has been defined.  By implementing the *note __fspath__(): e50.
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:
16a. or *note bytes: 193. object.  This means an object is considered
*note path-like: 5a1. if it implements ‘os.PathLike’ or is a ‘str’ or
‘bytes’ object which represents a file system path.  Code can use *note
os.fspath(): e51, *note os.fsdecode(): e52, or *note os.fsencode(): e53.
to explicitly get a ‘str’ and/or ‘bytes’ representation of a path-like
object.

The built-in *note open(): 318. function has been updated to accept
*note os.PathLike: e4f. 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 ‘os.PathLike’.

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(): e51. 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: 268. 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: 1fd. クラスに追加しました。

     >>> 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: e55. 属性の値は、曖昧な場合に時間内の二番目の (年代的) 瞬間
を表しているものを除く全てのインスタンスで ‘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(): e57, which now defaults
to ‘'utf-8'’.

Applications that do not use str to represent paths should use *note
os.fsencode(): e53. and *note os.fsdecode(): e52. to ensure their bytes
are correctly encoded.  To revert to the previous behaviour, set *note
PYTHONLEGACYWINDOWSFSENCODING: 33d. or call *note
sys._enablelegacywindowsfsencoding(): 33c.

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: e59.

参考
....

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__: e5b. attribute.

Also, the effective default class 'execution' namespace (returned from
*note type.__prepare__(): e5c.) 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: cc1. 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(): 184. 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: e62. により Python メモリアロケータの
設定とデバッグフックの導入ができます。

‘PYTHONMALLOC=debug’ を使用してリリースモードでコンパイルされた Python で
、Python メモリアロケータにデバッグフックを導入できるようになりました。
デバッグフックの効果は:

   * 新たに割り当てられたメモリを ‘0xCB’ バイトで埋めます

   * 解放されたメモリを ‘0xDB’ バイトで埋めます

   * Python メモリアロケータ API の違反を検知します。例えば *note
     PyMem_Malloc(): e63. で割り当てられたメモリブロックに *note
     PyObject_Free(): e64. を呼ぶこと。

   * バッファ開始前の書き込み (バッファアンダーフロー) を検知します

   * バッファ終端後の書き込み (バッファオーバーフロー) を検知します

   * Check that the *note GIL: 474. is held when allocator functions of
     *note PYMEM_DOMAIN_OBJ: e65. (ex: *note PyObject_Malloc(): e66.)
     and *note PYMEM_DOMAIN_MEM: e67. (ex: *note PyMem_Malloc(): e63.)
     domains are called.

Checking if the GIL is held is also a new feature of Python 3.6.

See the *note PyMem_SetupDebugHooks(): e68. 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: 106. 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 を測定する: e6a. を
参照してください。

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: 1af.

   * It is now possible to set a *note special method: e6c. to ‘None’ to
     indicate that the corresponding operation is not available.  For
     example, if a class sets *note __iter__(): e6d. 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: e6e. for an example).  (Contributed by Emanuel Barry in
     bpo-26823(2).)

   * Import now raises the new exception *note ModuleNotFoundError: d41.
     (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: 2f1. 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(): 2f4. 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(): e75. function and all functions that use
     it, such as *note loop.run_until_complete(): e76, now accept all
     kinds of *note awaitable objects: 4c9.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): a86. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): e77. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): d0d. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

   * New *note loop.create_future(): e78. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(2), to provide a faster *note asyncio.Future: dca.
     implementation.  (Contributed by Yury Selivanov in bpo-27041(3).)

   * New *note loop.get_exception_handler(): e79. 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(): e7a. has been
     improved.  (Contributed by Mark Korenberg in bpo-28370(5).)

   * The *note loop.getaddrinfo(): e12. 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(): e7b. 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: e7c. will now raise *note TypeError:
     199. when passed an instance of the *note StopIteration: df9.
     exception.  (Contributed by Chris Angelico in bpo-26221(7).)

   * New *note loop.connect_accepted_socket(): 9e2. 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(): e7d. to properly close pending
     asynchronous generators before closing the loop.  (Contributed by
     Yury Selivanov in bpo-28003(10).)

   * *note Future: dca. and *note Task: 1c9. 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(): e7f. 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: e81. ('τ') constant has been added.
(Contributed by Lisa Roach in bpo-12345(1), see PEP 628(2) for details.)

新たに定数が追加されました。 *note math.inf: e82. と *note math.nan:
874. に対応する *note cmath.inf: e83. と *note cmath.nan: e84.。複素数の
repr が使用する書式に対応する *note cmath.infj: e85. と *note
cmath.nanj: e86.。 (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: e88. 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: e89. abstract base class represents iterable
classes that also provide the *note __reversed__(): e8a. method.
(Contributed by Ivan Levkivskyi in bpo-25987(2).)

The new *note AsyncGenerator: e8b. 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: 94d. 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: e8e. 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: 10b. module as *note typing.ContextManager:
e8f.  (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: 1fd. classes have the new *note
fold: e91. 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: e3a.
section for more information.  (Contributed by Alexander Belopolsky in
bpo-24773(1).)

The *note datetime.strftime(): e92. and *note date.strftime(): e93.
methods now support ISO 8601 date directives ‘%G’, ‘%u’ and ‘%V’.
(Contributed by Ashley Anderson in bpo-12006(2).)

The *note datetime.isoformat(): d29. 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(): e94. 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(): e96. method that returns a pair
‘(n, d)’ of integers that represent the given *note Decimal: 200.
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: e99. now supports the 'policy' keyword.

There is a new *note policy: 53. attribute, *note message_factory: e9a,
that controls what class is used by default when the parser creates new
message objects.  For the *note email.policy.compat32: e9b. 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: e9e.  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: e9e. class for their constants.

The new *note enum.auto: e9f. 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(): 211.
(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(): ea2. 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(): ea4, *note sha3_256(): ea5,
*note sha3_384(): ea6, *note sha3_512(): ea7, and SHAKE hash functions
*note shake_128(): ea8. and *note shake_256(): ea9. 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(): e3c. 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(): eab. and *note endheaders(): eac. 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: d41.
(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: eaf. now calls *note create_module():
eb0. on the wrapped loader, removing the restriction that *note
importlib.machinery.BuiltinImporter: eb1. and *note
importlib.machinery.ExtensionFileLoader: eb2. couldn't be used with
‘importlib.util.LazyLoader’.

*note importlib.util.cache_from_source(): 351, *note
importlib.util.source_from_cache(): 73e, and *note
importlib.util.spec_from_file_location(): eb3. 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(): 231. 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(): 945. has been reversed.  While this
function is convenient for single/source Python 2/3 code bases, the
richer *note inspect.signature(): 231. 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(): eb6. と *note json.loads(): b52. は、バイナリ入力をサ
ポートしました。エンコード済みの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(): eb8. メソッドが追加さ
れ、ログファイルを再オープンする必要があるかどうかをチェックする機能が追
加れました。(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: 24e. returned by *note multiprocessing.Manager():
252. 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: e39. for details on how the *note os:
a5. and *note os.path: a6. modules now support *note path-like objects:
5a1.

*note scandir(): c58. now supports *note bytes: 193. paths on Windows.

A new *note close(): ebc. method allows explicitly closing a *note
scandir(): c58. iterator.  The ‘scandir()’ iterator now supports the
*note context manager: 1e3. 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(): ebd. 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: e39. の要約を参照してください。

   ---------- 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: 275. クラスのコンストラクタに、新しくオプション引数 '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: 27d. 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(): ec2. 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(): ad8. 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(): ec5. 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: ec7. objects now support *note index-like objects: 19f. 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(): ec9. 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: ecc. has much *note improved shell compatibility: ecd.
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: 3e2. 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: ed0. は、 ‘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(): ed2. function now supports the *note
SIO_LOOPBACK_FAST_PATH: ed3. control code.  (Contributed by Daniel
Stokes in bpo-26536(1).)

The *note getsockopt(): ed4. constants ‘SO_DOMAIN’, ‘SO_PROTOCOL’,
‘SO_PEERSEC’, and ‘SO_PASSSEC’ are now supported.  (Contributed by
Christian Heimes in bpo-26907(2).)

The *note setsockopt(): ed5. 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: ed6. to
interface with Linux Kernel crypto API. ‘ALG_*’, ‘SOL_ALG’ and *note
sendmsg_afalg(): ed7. 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: 136. and *note
wsgiref.simple_server: 122, now support the *note context manager: 1e3.
protocol.  (Contributed by Aviv Palivoda in bpo-26404(1).)

The *note wfile: ed9. attribute of *note StreamRequestHandler: eda.
classes now implements the *note io.BufferedIOBase: 8a4. writable
interface.  In particular, calling *note write(): edb. 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: 355. 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: edd. 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(): ede. 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: edf. and
*note IntFlag: e9e.  (Contributed by Christian Heimes in bpo-28025(6).)

Server and client-side specific TLS protocols for *note SSLContext: 355.
were added.  (Contributed by Christian Heimes in bpo-28085(7).)

Added *note ssl.SSLContext.post_handshake_auth: c2a. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): c2b. 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(): ee1. 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(): ee4. 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(): ee6. 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(): ee7.
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: eea. 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(): eec. convenience method has been added
to call *note Timer.timeit(): eed. 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: 106. module now supports tracing memory
allocations in multiple different address spaces.

The new *note DomainFilter: ef1. 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: 10b. module is *note provisional: 3cf, all
changes introduced in Python 3.6 have also been backported to Python
3.5.x.

The *note typing: 10b. 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: e8f. class has been added for
representing *note contextlib.AbstractContextManager: e8e.  (Contributed
by Brett Cannon in bpo-25609(2).)

The *note typing.Collection: ef3. class has been added for representing
*note collections.abc.Collection: e88.  (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: ef4. 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(): ef5. 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: 10c. 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: c43. クラスは、次の改善が行われました。

   * *note Mock.assert_called(): ef8. と *note
     Mock.assert_called_once(): ef9. は、mockオブジェクトが呼ばれたかど
     うかを確認します。 (Contributed by Amit Saha in bpo-26323(1).)

   * The *note Mock.reset_mock(): efa. 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: efc. 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: efe. 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(): f01. 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: 106. 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: 106. is tracing Python memory allocations and if the
*note warnings: 119. 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: f03.  (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: f05, *note
MessageBeep: f06, and *note PlaySound: f07. (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: 135. 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(): f0a. class method allows making a *note
ZipInfo: 2cd. instance from a filesystem file.  A new *note
ZipInfo.is_dir(): f0b. method can be used to check if the ‘ZipInfo’
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(): f0d. 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: dca. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov and INADA Naoki in
     bpo-26081(3).)

   * The *note asyncio.Task: 1c9. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov in bpo-28544(4).)

   * Various implementation improvements in the *note typing: 10b.
     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(): 191. and *note bytearray.fromhex():
     192.: 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(): e63. domain (*note
     PYMEM_DOMAIN_MEM: e67.) now use the *note pymalloc memory
     allocator: f0f. 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(): f10. and *note pickle.loads(): f11. are now up
     to 10% faster when deserializing many small objects (Contributed by
     Victor Stinner in bpo-27056(14)).

   * Passing *note keyword arguments: f12. to a function has an overhead
     in comparison with passing *note positional arguments: f13.  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(): a0c. 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(): c58.; it is now about 1.5-4 times faster.
     (Contributed by Serhiy Storchaka in bpo-26032(17)).

   * *note xml.etree.ElementTree: 12c. 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: 215. 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: e65. (ex: *note PyObject_Malloc(): e66.)
     and *note PYMEM_DOMAIN_MEM: e67. (ex: *note PyMem_Malloc(): e63.)
     domains are called.

   * New *note Py_FinalizeEx(): f15. 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: c7c.  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(): f16. 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(): f17. 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(): f18. 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(): f19. 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: f1b. (短縮系: *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: 1a4. が
出ます。

   ---------- 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: df9. exception inside a generator will
now generate a *note DeprecationWarning: 1a4, and will trigger a *note
RuntimeError: 246. in Python 3.7.  See *note PEP 479; ジェネレータ内の
StopIteration の処理の変更: f1f. for details.

The *note __aiter__(): dfa. 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:
1a4.  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: 1a4.  Although this will
eventually become a *note SyntaxError: 18f, 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(): f26. の非整数の引数のサポートは非推奨になりました。
(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(): f28. and
*note importlib.machinery.SourcelessFileLoader.load_module(): f29.
methods are now deprecated.  They were the only remaining
implementations of *note importlib.abc.Loader.load_module(): a6d. in
*note importlib: 7b. that had not been deprecated in previous versions
of Python in favour of *note importlib.abc.Loader.exec_module(): a6e.

The *note importlib.machinery.WindowsRegistryFinder: f2a. class is now
deprecated.  As of 3.6.0, it is still added to *note sys.meta_path: f2b.
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: 194. 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: 100. 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: 129. and *note xml.sax: 130. 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: f34. 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: d67. flag can now only be used with binary
     patterns.

   * ‘inspect.getmoduleinfo()’ was removed (was deprecated since CPython
     3.3).  *note inspect.getmodulename(): f38. 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: 105. 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: 8d4.
     class no longer supports the ‘'U'’ mode (was deprecated since
     Python 3.4).  Use *note io.TextIOWrapper: 9c2. for reading
     compressed text files in *note universal newlines: f39. 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(): 318. 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(): a6e. is defined,
     *note importlib.abc.Loader.create_module(): eb0. must also be
     defined.

   * *note PyErr_SetImportError(): f3d. now sets *note TypeError: 199.
     when its 'msg' argument is not set.  Previously only ‘NULL’ was
     returned.

   * The format of the *note co_lnotab: 32e. 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: 9b3,
     ‘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(): f3e.
     and *note urlparse(): 360. results now raises *note ValueError:
     2ee. for out-of-range values, rather than returning *note None:
     886.  See bpo-20059(4).

   * The ‘imp’ module now raises a *note DeprecationWarning: 1a4.
     instead of *note PendingDeprecationWarning: ac9.

   * The following modules have had missing APIs added to their *note
     __all__: f3f. attributes to match the documented APIs: *note
     calendar: 15, ‘cgi’, *note csv: 2d, *note ElementTree: 12c, *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: 11a.  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: 136.
     and *note wsgiref.simple_server: 122, now only catch exceptions
     derived from *note Exception: bd1.  Therefore if a request handler
     raises an exception like *note SystemExit: f40. or *note
     KeyboardInterrupt: bc9, *note handle_error(): f41. 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: f42. instead
     of *note KeyError: 5e7. if the user doesn't have privileges.

   * The *note socket.socket.close(): f43. 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(): f44, *note dumps():
     f45, *note load(): eb6. and *note loads(): b52. functions and *note
     JSONEncoder: f46. and *note JSONDecoder: f47. 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: f48. のサブク
     ラスは、オブジェクトの型を得るのに１引数形式を利用することができま
     せん。

   * As part of PEP 487(11), the handling of keyword arguments passed to
     *note type: f48. (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__: 8c0. both now accept arbitrary keyword arguments,
     but ‘object.__init_subclass__()’ (which is called from
     ‘type.__new__’) will reject them by default.  Custom metaclasses
     accepting additional keyword arguments will need to adjust their
     calls to ‘type.__new__’ (whether direct or via *note super: 1a7.)
     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: 112. module and the *note
     http.client.HTTPConnection.request(): eab. 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: bdc. 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(): f49. now looks in
     ‘LD_LIBRARY_PATH’ for shared libraries.  (Contributed by Vinay
     Sajip in bpo-9998(16).)

   * The *note imaplib.IMAP4: b03. 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(): f4a. 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(): f4b. and *note
     pkgutil.walk_packages(): dfd. functions now return *note
     ModuleInfo: f4c. 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: 8d4. will now raise *note
     NotImplementedError: 369. for unrecognized compression values.
     Previously a plain *note RuntimeError: 246. was raised.
     Additionally, calling ‘ZipFile’ methods on a closed ZipFile or
     calling the *note write(): f4d. method on a ZipFile created with
     mode ‘'r'’ will raise a *note ValueError: 2ee.  Previously, a
     ‘RuntimeError’ was raised in those scenarios.

   * when custom metaclasses are combined with zero-argument *note
     super(): 1a7. 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: 1a4. in Python 3.6 and a *note RuntimeError:
     246. in Python 3.8.

   * With the introduction of *note ModuleNotFoundError: d41, 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__(): ad5.
     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(): e63. allocator family now uses the *note
     pymalloc allocator: f0f. rather than the system ‘malloc()’.
     Applications calling ‘PyMem_Malloc()’ without holding the GIL can
     now crash.  Set the *note PYTHONMALLOC: e62. environment variable
     to ‘debug’ to validate the usage of memory allocators in your
     application.  See bpo-26249(1).

   * *note Py_Exit(): f4f. (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: f51. opcodes as part
     of the *note formatted string literal: e2d. 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:
     f52, ‘CALL_FUNCTION’, ‘CALL_FUNCTION_KW’ and
     ‘BUILD_MAP_UNPACK_WITH_CALL’ opcodes have been modified, the new
     *note CALL_FUNCTION_EX: f53. 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: f54. and ‘STORE_ANNOTATION’
     opcodes have been added to support the new *note variable
     annotation: f55. 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(): dfc. 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: 129. and *note xml.sax: 130. modules no longer
process external entities by default.  See also gh-61441(1).

In 3.6.7 the *note tokenize: 102. 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(): 940. での '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(): 321. and *note
urllib.parse.parse_qsl(): 320.  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: afa. 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(): 111. 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: f63.、コルーチン、async 構文と await 構文。

   * *note PEP 465: f64.、新たな行列乗算演算子 ‘a @ b’。

   * *note PEP 448: f65.、追加可能なアンパックへの一般化。

新たなライブラリモジュール:

   * *note typing: 10b.: *note PEP 484 - 型ヒント: f66.。

   * *note zipapp: 137.: *note PEP 441 Python ZIP
     アプリケーションのサポートの改善: f67.。

新たな組み込み機能:

   * ‘bytes % args’, ‘bytearray % args’: *note PEP 461: f68. - bytes と
     bytearray に ‘%’ 書式化を追加。

   * 新たな *note bytes.hex(): f69, *note bytearray.hex(): f6a. *note
     memoryview.hex(): f6b. メソッド。 (Contributed by Arnon Yaari in
     bpo-9951(1).)

   * *note memoryview: 166. クラスが、(複数次元の場合を含んだ) タプルの
     添字をサポートするようになりました。 (bpo-23632(2) におけるAntoine
     Pitrouによる貢献です。)

   * ジェネレータに ‘gi_yieldfrom’ 属性が新しく追加され、これは ‘yield
     from’ 式で反復処理されるオブジェクトを返します。 (Contributed by
     Benno Leslie and Yury Selivanov in bpo-24450(3).)

   * 新たな例外 *note RecursionError: f6c. が最長再帰深度に到達した際に
     送出されるようになりました。 (Contributed by Georg Brandl in
     bpo-19235(4).)

CPython の実装の改善:

   * ‘LC_TYPE’ ロケールが POSIX ロケール (‘C’ ロケール) のとき、 *note
     sys.stdin: 75f. および *note sys.stdout: cd1. は ‘strict’ エラーハ
     ンドラではなく ‘surrogateescape’ を使うようになりました。
     (Contributed by Victor Stinner in bpo-19977(5).)

   * ‘.pyo’ ファイルは使われなくなり、‘.pyc’ ファイル名に最適化レベルが
     明示される、より柔軟な仕組みに置き換えられました。(*note PEP 488
     の概要: f6d. を参照してください。)

   * 組み込みおよび拡張モジュールが多段階で初期化されるようになりました
     。これは Python モジュールのロード方法と同じです。 (*note PEP 489
     の概要: f6e. を参照してください。)

標準ライブラリーの顕著な改善

   * *note collections.OrderedDict: 7f3. が *note C で実装されました:
     f6f.。 これにより 4 倍から 100 倍高速になりました。

   * *note ssl: d5. モジュールに *note メモリ BIO サポート: f70. が追加
     されました。これにより SSL プロトコルの処理と ネットワーク IO が分
     離されました。

   * 新たな関数 *note os.scandir(): c58. はディレクトリー走査の *note
     改良され非常に速い方法: f71. を提供します。

   * *note functools.lru_cache(): be6. の大部分が *note C で再実装: f72.
     され、性能が大幅に向上しました。

   * 新たな関数 *note subprocess.run(): d83. は *note
     サブプロセスを実行する合理的な方法: f73. を提供します。

   * *note traceback: 105. モジュールは性能と開発者の利便性が向上し、大
     いに *note 強化され: f74. ました。

セキュリティの改善:

   * SSLv3 が標準ライブラリ全体を通じて無効化されました。ただし *note
     ssl.SSLContext: 355. を手動でインスタンス化することによってなら今で
     も有効には出来ます。 (詳細に関しては bpo-22638(6) を参照してくださ
     い。この変更は CPython 3.4 と 2.7 にもバックポートされました。)

   * 潜在的なインジェクション攻撃からの防御のために、HTTP クッキーの解析
     がより厳密に行われるようになりました。 (Contributed by Antoine
     Pitrou in bpo-22796(7).)

Windows の改善:

   * Windows のインストーラが新しくなり古い MSI を置き換えました。さらに
     詳しい情報は *note Windows で Python を使う: ca2. をご覧ください。

   * 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 コルーチン関数:
f77.、*note 非同期イテレーション: f78.、*note
非同期コンテキストマネージャ: 7f0. が追加され、Python における非同期プロ
グラミングを大幅に向上しました。

コルーチン関数は新たな構文 *note async def: 7ed. を用いて定義されます:

     >>> async def coro():
     ...     return 'spam'

Inside a coroutine function, the new *note await: 18e. 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__(): f79. method.

PEP 492 により *note async for: ca5. 文も追加されました。非同期イテラブ
ルを反復するのに便利です。

新たな構文を用いた初歩的な 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: ca5. と *note async with: 186. は両方とも、 *note async
def: 7ed. で宣言されたコルーチン関数内でのみ使えることに注意してください
。

コルーチン関数は *note asyncio loop: f7a. のような適したイベントループ内
で実行させるためのものです。

     注釈: 
     バージョン 3.5.2 で変更: CPython 3.5.2 以降では、 ‘__aiter__’ は
     *note 非同期イテレータ: 4c7. を直接返せます。 *note awaitable: 4c9.
     オブジェクトを返すと *note PendingDeprecationWarning: ac9. が送出さ
     れます。

     より詳細なことはドキュメントの *note 非同期イテレータ (Asynchronous
     Iterator): f7b. 節を参照してください。

参考
....

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__(): f7d, *note
__rmatmul__(): f7e, and *note __imatmul__(): f7f. 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 関数呼び出し: f81. で任意の数
のアンパックで使えるようになりました:

     >>> 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 式のリスト: f82. および *note 辞書表示: f83. を参照してください):

     >>> *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: 193. と *note bytearray: 342. に ‘%’
*note 補間演算子: f85. のサポートが追加されます。

補間は通常は文字列演算だと考えられていますが、 ‘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: 3cf. 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__: 456. 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: 8bc. という全ての型と互
換な (すなわち代入可能) 特殊型をサポートしています。

参考
....

   * *note typing: 10b. モジュールのドキュメント

   * 
     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(): c58. が
標準ライブラリへ追加されました。 さらに、 ‘scandir’ を使い *note
os.walk(): 6d0. が実装され、 POSIX システムで3倍から5倍、 Windows システ
ムで7倍から20倍高速になりました。 これは主に、ディレクトリツリーを走査す
るのに必要な *note os.stat(): 26f. の呼び出し回数をかなり減らしたことに
よるものです。

これの他にも、 ‘scandir’ ファイル名のリストではなくイテレータを返すよう
になり、非常に大きなディレクトリ群の走査をするときのメモリ効率が改善され
ました。

次の例では、 *note os.scandir(): c58. を使用して、与えられた 'path' 内の
先頭が ‘'.'’ でないすべてのファイル (ディレクトリを除く) を表示します。
*note entry.is_file(): f88. を呼び出しても、通常は追加のシステムコールは
行われません:

     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: f8b. 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: f8c. 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: f8c. を扱う負担をなくし、標準ライブラリを含む Python プ
ログラムをより堅牢にします。 シグナルハンドラが例外を投げない場合にのみ
システムコールを再試行することに注意してください。

下記は、シグナルで中断された際に再試行をするようになった関数のリストです
:

   * *note open(): 318. および *note io.open(): 740.;

   * *note faulthandler: 5c. モジュールの関数;

   * *note os: a5. モジュールの関数: *note fchdir(): f8d, *note
     fchmod(): 52a, *note fchown(): f8e, *note fdatasync(): f8f, *note
     fstat(): f90, *note fstatvfs(): f91, *note fsync(): f92, *note
     ftruncate(): f93, *note mkfifo(): f94, *note mknod(): f95, *note
     open(): f96, *note posix_fadvise(): f97, *note posix_fallocate():
     f98, *note pread(): d5a, *note pwrite(): d5d, *note read(): f99,
     *note readv(): d59, *note sendfile(): d09, *note wait3(): f9a,
     *note wait4(): f9b, *note wait(): f9c, *note waitid(): f9d, *note
     waitpid(): f9e, *note write(): f9f, *note writev(): d5c.;

   * special cases: *note os.close(): d6f. and *note os.dup2(): d5e. now
     ignore *note EINTR: f8b. errors; the syscall is not retried (see
     the PEP for the rationale);

   * *note select: c6. モジュール関数: *note devpoll.poll(): fa0, *note
     epoll.poll(): fa1, *note kqueue.control(): fa2, *note poll.poll():
     fa3, *note select(): fa4.;

   * *note socket: fa5. クラスのメソッド: *note accept(): fa6, *note
     connect(): fa7. (ノンブロッキングソケットを除く), *note recv():
     fa8, *note recvfrom(): fa9, *note recvmsg(): faa, *note send():
     fab, *note sendall(): fac, *note sendmsg(): 6a1, *note sendto():
     fad.;

   * *note signal.sigtimedwait(): fae. および *note
     signal.sigwaitinfo(): faf.;

   * *note time.sleep(): 8ad.

参考
....

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: df9. の組み合わ
せが驚くような動作をし、分かりづらいバグを隠すことがありました。 以前は
、ジェネレータ関数内でうっかり ‘StopIteration’ が送出されると、そのジェ
ネレータの反復処理をしているループ構造が終端に達したと解釈されていました
。

PEP 479(1) によってジェネレータのこの振る舞いが変更されました: ジェネレ
ータ内部で ‘StopIteration’ 例外が送出されたときは、ジェネレータのフレー
ムを抜ける前に *note RuntimeError: 246. に置き換えられます。 この変更の
一番の目的は、保護されていない *note next(): 9dc. の呼び出しが
‘StopIteration’ を送出し、ジェネレータを回している反復処理が黙って終了し
てしまうような状況で、デバッグをしやすくすることです。 これは ‘yield
from’ 構造と組み合わさったとき特に有害になります。

これは後方互換性の無い変更ですので、この新しい振る舞いを有効にするには
*note __future__: fb1. のインポートが必要です:

     >>> 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: df9. 例外が送出されたときには *note
PendingDeprecationWarning: ac9. が送出されます。

参考
....

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(): fb4. 及び *note cmath.isclose(): fb5. が追加されま
した。 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: 18d. と *note
-OO: fb9. のいずれかで実行した場合でも、バイトコードのファイル名が衝突し
ないようになりました。 それにより、‘-O’ および ‘-OO’ で生成したバイトコ
ードは同時に存在できるようになりました。 *note
importlib.util.cache_from_source(): 351. にの 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: 193. と *note int: 19c. の
     比較に影響するようになりました。 (Contributed by Serhiy Storchaka
     in bpo-23681(3).)

   * 新たなカザフ語 ‘kz1048’ 及びタジク語 ‘koi8_t’ *note コーデックス:
     fbc.。 (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: 10b. *note provisional: 3cf. module provides
standard definitions and tools for function type annotations.  See *note
Type Hints: f66. for more information.


File: python.info,  Node: zipapp<2>,  Prev: typing<11>,  Up: 新たなモジュール<9>

1.10.4.2 zipapp
...............

新たな *note zipapp: 137. モジュール ( 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: 1bf. クラスは、*note allow_abbrev: fc2. を ‘False’
に設定することでロングオプションの *note 短縮使用: fc3. を無効化できるよ
うになりました。 (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: 3cf, 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(): fc5. と *note
     loop.get_debug(): fc6. メソッド。 (Contributed by Victor Stinner.)

   * proactor イベントループが SSL をサポートしました。 (Contributed by
     Antoine Pitrou and Victor Stinner in bpo-22560(1).)

   * イベントループが閉じているかどうか調べる新たな *note
     loop.is_closed(): fc7. メソッド。 (Contributed by Victor Stinner in
     bpo-21326(2).)

   * コルーチンの新しい *note Task: 1c9. を便利に作成しスケジュールする
     ための新たな *note loop.create_task(): 1cc.。 ‘create_task’ メソッ
     ドは コルーチンをタスクにラップする全ての asyncio 関数、たとえば
     *note asyncio.wait(): 6a7, *note asyncio.gather(): 813.、にも使われ
     ます。 (Contributed by Victor Stinner.)

   * A new *note transport.get_write_buffer_limits(): fc8. 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(): e75.  (Contributed by Yury Selivanov.)

   * *note loop.create_task(): 1cc. メソッドが使うタスクファクトリーをカ
     スタマイズするための新たな *note loop.set_task_factory(): 1ca. メソ
     ッドと *note loop.get_task_factory(): fc9. メソッド。 (Yury
     Selivanovによる貢献。)

   * 新たな *note Queue.join(): fca. および *note Queue.task_done():
     fcb. キューメソッド。(Contributed by Victor Stinner.)

   * ‘JoinableQueue’ クラスは *note asyncio.Queue: c6e. クラスにより削除
     されました。 (Contributed by Victor Stinner.)

3.5.1 での変更:

   * The *note ensure_future(): e75. function and all functions that use
     it, such as *note loop.run_until_complete(): e76, now accept all
     kinds of *note awaitable objects: 4c9.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): a86. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): e77. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): d0d. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

3.5.2 での変更:

   * New *note loop.create_future(): e78. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(3), to provide a faster *note asyncio.Future: dca.
     implementation.  (Contributed by Yury Selivanov.)

   * New *note loop.get_exception_handler(): e79. 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(): d0d. 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): fcc. 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: fce. メソッドがオプション引数
'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: 1e3.
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(): fb5. は近似的に等しいかどうかを判断する方法
を提供します。 (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(): fd2. メソッドが、対話的イ
ンタープリタのように連なったスタックトレース全体を表示するようになりまし
た。 (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(): a69. iteration.  (Contributed by
Serhiy Storchaka in bpo-19505(2).)

*note deque: 7f4. クラスが *note index(): fd4.、 *note insert(): fd5.、
*note copy(): fd6. を定義し、‘+’ と ‘*’ 演算をサポートしました。 これに
より 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: fd7. class now implements the *note
__getnewargs__(): fd8, *note __rmod__(): fd9, *note casefold(): fda,
*note format_map(): fdb, *note isprintable(): fdc, and *note
maketrans(): fdd. methods to match the corresponding methods of *note
str: 16a.  (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: 24f,
etc.  (Contributed by Devin Jeanpierre in bpo-23086(1).)

新たに *note Generator: fdf. 抽象基底クラスが追加されました。
(Contributed by Stefan Behnel in bpo-24018(2).)

新たに *note Awaitable: fe0, *note Coroutine: fe1, *note AsyncIterator:
fe2, *note AsyncIterable: fe3. 抽象基底クラスが追加されました。
(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(): d1f. 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(): d1f, *note
compile_file(): fe5, and *note compile_path(): fe6. 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(): 1de. method now accepts a 'chunksize' argument
to allow batching of tasks to improve performance when *note
ProcessPoolExecutor(): 1d8. is used.  (Contributed by Dan O'Reilly in
bpo-11271(1).)

The number of workers in the *note ThreadPoolExecutor: 94d. 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: 1e3. の *note contextlib.redirect_stderr():
fea. は、ユーティリティスクリプトにて、その出力を *note sys.stderr: b37.
に書き出す一方でその向き先を変えれない頑固な API の扱いを簡単にしてくれ
ます (*note redirect_stdout(): feb. と対となるものです)。:

     >>> 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(): fed. メソッドは、シーケンスだけでなく、 任意のイテラブ
ルをサポートしました。(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(): fef. function updates the *note
LINES: ff0. and *note COLS: ff1. 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: c91. 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():
ff4. 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(): ff5. 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(): ff8. 関数が、 'module' がドキュメンテーション文字
列(docstrings)を含まない場合に *note ValueError: 2ee. を送出するのではな
く空の *note unittest.TestSuite: ff9. を返すようになりました。
(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_: ffb. 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: e9b. and ‘False’ for all other policies.  (Contributed by
Milan Oberkirch in bpo-20098(1).)

A new *note Message.get_content_disposition(): ffc. 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: ffd. 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: ffe. constructor now accepts a *note
charset.Charset: fff. 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(): 211, *note register(): 1002, *note
dump_traceback(): 1003, *note dump_traceback_later(): 1004. が、ファイル
様オブジェクトだけでなくファイル記述子を受け取るようになりました。
(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(): be6. 機構の多くが 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(): a0c. 関数と *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(): 1009. can now be customized by
passing a *note key function: 100a. 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: b00. の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(): 100d. now raises a *note
RemoteDisconnected: 100e. exception when a remote server connection is
closed unexpectedly.  Additionally, if a *note ConnectionError: 100f.
(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: b03. クラスが *note context manager: 1e3. プロトコルをサポ
ートするようになりました。 *note with: 187. 文とともに使うと、 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():
1012. method.  A new *note IMAP4.utf8_enabled: 1013. 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: eaf. 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(): 1016. 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(): 1017. function is now the
preferred way to create a new module.  As opposed to creating a *note
types.ModuleType: 1018. 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(): 101a. 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(): 946. makes
subclassing of *note Signature: 4e3. easier.  (Contributed by Yury
Selivanov and Eric Snow in bpo-17373(4).)

The *note signature(): 231. 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: f77. and
*note coroutine objects: 6b9. has been added: *note iscoroutine(): 101b,
*note iscoroutinefunction(): 30f, *note isawaitable(): 101c, *note
getcoroutinelocals(): 101d, and *note getcoroutinestate(): 101e.
(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(): 1020. method, that uses at most
one call to the underlying raw stream's *note RawIOBase.read(): 1021. or
*note RawIOBase.readinto(): 1022. 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: 1024. 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: 1026. instead of *note
ValueError: 2ee. 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(): 1028. function can be used to capture
information about a non-file-based module to permit getting its lines
later via *note getline(): 242.  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(): 102a. 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: d4a. *note log(): 102c, *note
exception(): 102d, *note critical(): 102e, *note debug(): 102f, 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: 1030. class now accepts an optional
*note ssl.SSLContext: 355. instance to configure SSL settings used in an
HTTP connection.  (Contributed by Alex Gaynor in bpo-22788(2).)

The *note handlers.QueueListener: 244. 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(): 1032. 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: e82. および *note nan: 874.
が追加されました。 (Contributed by Mark Dickinson in bpo-23185(1).)

新たな関数 *note isclose(): fb4. は近似的に等しいことを調べる方法を提供
します。 (Contributed by Chris Barker and Tal Einat in bpo-24270(2).)

A new *note gcd(): b10. 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(): 1035. オブジェクトが *note
コンテキストマネージャ: 1e3. プロトコルをサポートするようになりました。
(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(): 1037, *note itemgetter(): c5b, and *note
methodcaller(): 1038. objects now support pickling.  (Contributed by
Josh Rosenberg and Serhiy Storchaka in bpo-22955(1).)

行列乗算を行う *note matmul(): 1039. 関数と *note imatmul(): 103a. 関数
が新しく追加されました。 (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(): c58. function returning an iterator of *note
DirEntry: 6c3. objects has been added.  If possible, ‘scandir()’
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: 103c. 属
性が利用可能です。これは 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(): 103d. and *note set_blocking(): 103e.
functions allow getting and setting a file descriptor's blocking mode
(*note O_NONBLOCK: 103f.)  (Contributed by Victor Stinner in
bpo-22054(4).)

*note truncate(): 1040. と *note ftruncate(): f93. が Windows でサポート
されるようになりました。 (Contributed by Steve Dower in bpo-23668(5).)

There is a new *note os.path.commonpath(): 1041. function returning the
longest common sub-path of each passed pathname.  Unlike the *note
os.path.commonprefix(): 1042. 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(): 1044. method can be used to check whether
the path points to the same file as another path, which can be either
another *note Path: 268. 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(): 1045. 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(): 1046. method to expand ‘~’ and
‘~user’ prefixes.  (Contributed by Serhiy Storchaka and Claudiu Popa in
bpo-19776(3).)

A new *note Path.home(): 1047. class method can be used to get a *note
Path: 268. instance representing the user’s home directory.
(Contributed by Victor Salgado and Mayank Tripathi in bpo-19777(4).)

New *note Path.write_text(): 1048, *note Path.read_text(): 1049, *note
Path.write_bytes(): 104a, *note Path.read_bytes(): 2e1. 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: 27d. 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(): 104d. 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:
104f, *note pattern: 1050, *note pos: 1051, *note lineno: 1052, and
*note colno: 1053, 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(): 1055. 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: dd6. 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(): c55. function now accepts a 'copy_function' argument,
allowing, for example, the *note copy(): c53. function to be used
instead of the default *note copy2(): c54. 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(): d6b. 関数がソケットハンドルも
サポートするようになりました。 (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(): 105b. method provides a convenient way to
implement custom authentication mechanisms.  (Contributed by Milan
Oberkirch in bpo-15014(1).)

The *note SMTP.set_debuglevel(): 105c. 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(): 105d. and *note SMTP.send_message():
105e. 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(): 1061. method allows sending a file over a
socket by using the high-performance *note os.sendfile(): d09. function
on UNIX, resulting in uploads being from 2 to 3 times faster than when
using plain *note socket.send(): fab.  (Contributed by Giampaolo Rodola'
in bpo-17552(2).)

The *note socket.sendall(): fac. 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(): 1062. method is now
optional.  By default it is set to *note SOMAXCONN: 1063. 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: d7e. class has been added to provide SSL
protocol support for cases when the network I/O capabilities of *note
SSLSocket: aeb. 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: 1066. 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:
aeb.'s readiness model ("select/poll") is inefficient.

A new *note SSLContext.wrap_bio(): d7f. 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(): 1068. can be used to
specify which protocols a socket should advertise during the TLS
handshake.

The new *note SSLSocket.selected_alpn_protocol(): 1069. returns the
protocol that was selected during the TLS handshake.  The *note
HAS_ALPN: 106a. 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(): 106c. method to query the
actual protocol version in use.  (Contributed by Antoine Pitrou in
bpo-20421(1).)

The *note SSLSocket: aeb. 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: 106d. or *note ssl.SSLWantWriteError: 106e.
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(): 106f. 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: 19c.  (Contributed by Akira Li
in bpo-19940(5).)

New ‘SSLObject.shared_ciphers()’ and *note SSLSocket.shared_ciphers():
1070. 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(): 1071, *note SSLSocket.read(): 1072,
‘SSLSocket.shutdown()’, and *note SSLSocket.write(): 1073. methods of
the *note SSLSocket: aeb. 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: 1075. class now fully supports the sequence protocol, in
particular *note reversed(): a69. 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(): d83. 関数が追加されました。 これは指定されたコマンド
を実行し *note CompletedProcess: 1077. オブジェクトを返します。 オブジェ
クトは終了したプロセスを記述します。 新たな 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: 3cf, and are intended for
debugging purposes only.  (Contributed by Yury Selivanov in
bpo-24017(1).)

A new *note is_finalizing(): c84. 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(): 107b. 関数の 'mode' 引数が排他的作成を要求する ‘"x"’ を受
け取るようになりました。 (Contributed by Berker Peksag in bpo-21717(1).)

The *note TarFile.extractall(): 29d. and *note TarFile.extract(): 29e.
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(): 107c. now accepts an optional 'members'
keyword argument that can be set to a subset of the list returned by
*note TarFile.getmembers(): 107d.  (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(): 8a8. と *note RLock.acquire(): 107f. の両メソッド
がタイムアウトの管理に単調時計を使用するようになりました。 (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(): 1082. 関数に引数 '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(): 1085. and *note walk_tb(): 1086. functions to
conveniently traverse frame and *note traceback objects: cf0.
(Contributed by Robert Collins in bpo-17911(1).)

New lightweight classes: *note TracebackException: 563, *note
StackSummary: 1087, and *note FrameSummary: 1088.  (Contributed by
Robert Collins in bpo-17911(2).)

Both the *note print_tb(): 1089. and *note print_stack(): 108a.
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(): 108c. 関数が追加されました。 *note
ジェネレータ: ddd. と *note ジェネレータ様: fdf. オブジェクトを *note
awaitable: 4c9. に変換します。 (Contributed by Yury Selivanov in
bpo-24017(1).)

新たに型 *note CoroutineType: 108d. が追加されました。 *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: 10c. 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: 1090. 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: c43. クラスは、次の改善が行われました。

   * 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(): 1092. method to check if the
     mock object was called.  (Contributed by Kushal Das in
     bpo-21262(2).)

The *note MagicMock: 1093. class now supports *note __truediv__(): 1094,
*note __divmod__(): 1095. and *note __matmul__(): f7d. 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(): 1096. 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: 1098. 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(): 1099.
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(): 309. function accepts an *note
ssl.SSLContext: 355. 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(): 109a. 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: 109c. 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: c50. クラスが *note コンテキストマネージャ:
1e3. プロトコルをサポートするようになりました。 (Contributed by Claudiu
Popa in bpo-20627(1).)

*note client.ServerProxy: c50. コンストラクタは任意の *note
ssl.SSLContext: 355. インスタンスを受け取るようになりました。
(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: 109f. オブジェクトの文字ストリ
ームをサポートしました。 (Contributed by Serhiy Storchaka in
bpo-2175(1).)

*note parseString(): 10a0. が *note str: 16a. インスタンスを受け取るよう
になりました。 (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: 194.  (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(): c58. 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(): 10a4, *note supernet(): 10a5, *note
summarize_address_range(): 10a6, *note collapse_addresses(): 10a7.  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: 10a8. の多くの操作が 50% から 100% 速くなりました。
(Contributed by Serhiy Storchaka in bpo-15381(8) and David Wilson in
bpo-22003(9).)

The *note marshal.dumps(): 10a9. 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(): f45. 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(): 10aa. and *note PyObject_IsSubclass():
10ab. functions have been sped up in the common case that the second
argument has *note type: f48. 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: 215. のインスタンス化が最高で 30% 速くなりまし
た。 (Contributed by Stefan Behnel in bpo-22464(19).)

String methods *note find(): 10ac, *note rfind(): 10ad, *note split():
10ae, *note partition(): 10af. and the *note in: 349. 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(): 10b1,

   * *note PyObject_Calloc(): 10b2.

(Contributed by Victor Stinner in bpo-21233(1).)

新たなエンコーディング/デコーディングヘルパ関数:

   * *note Py_DecodeLocale(): dc4. (‘_Py_char2wchar()’ の代わり),

   * *note Py_EncodeLocale(): dc5. (‘_Py_wchar2char()’ の代わり).

(Contributed by Victor Stinner in bpo-18395(2).)

A new *note PyCodec_NameReplaceErrors(): 10b3. function to replace the
unicode encode error with ‘\N{...}’ escapes.  (Contributed by Serhiy
Storchaka in bpo-19676(3).)

A new *note PyErr_FormatV(): 10b4. function similar to *note
PyErr_Format(): 10b5, but accepts a ‘va_list’ argument.  (Contributed by
Antoine Pitrou in bpo-18711(4).)

A new *note PyExc_RecursionError: 10b6. exception.  (Contributed by
Georg Brandl in bpo-19235(5).)

New *note PyModule_FromDefAndSpec(): 10b7, *note
PyModule_FromDefAndSpec2(): 10b8, and *note PyModule_ExecDef(): 10b9.
functions introduced by PEP 489(6) - multi-phase extension module
initialization.  (Contributed by Petr Viktorin in bpo-24268(7).)

New *note PyNumber_MatrixMultiply(): 10ba. and *note
PyNumber_InPlaceMatrixMultiply(): 10bb. 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: ca1. 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: df9. 例外を送出すると現在は静かな
*note PendingDeprecationWarning: ac9. が発生します。 これは、Python 3.6
では静かでない非推奨の警告となり、Python 3.7 では *note RuntimeError:
246. を起こします。 詳細は *note PEP 479; Change StopIteration handling
inside generators: f1f. を参照してください。


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(): e75.

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: e02. オブジェクトの *note key: dff, *note
value: e00, *note coded_value: e01. に対して直接代入することは非推奨です
。 *note set(): e03. メソッドを使うようにしてください。また、 ‘set()’ の
ドキュメントされていなかった 'LegalChars' パラメータは非推奨となり、無視
されます。

*note string.Formatter: 10c1. クラスの *note format(): dfe. メソッドに対
し、キーワード引数 '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(): 946. を代わりに使ってください。 (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(): 945, *note getcallargs():
10c2, and ‘formatargspec()’ functions are deprecated in favor of the
*note inspect.signature(): 231. API. (Contributed by Yury Selivanov in
bpo-20438(5).)

*note getargvalues(): 10c3. and *note formatargvalues(): 10c4. functions
were inadvertently marked as deprecated with the release of Python
3.5.0.

str のパターンとともに *note re.LOCALE: d67. や *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: 18f. を投げます。ジェネレー
     タ式は関数への唯一の引数でない場合には、括弧で囲まなければならない
     のです。(--訳注: 一応。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: f8c. を
     送出せずにシステムコールを再試行するようになりました。

   * Python 3.5 以前は、 *note time: 1fd. オブジェクトは UTC で深夜を表
     すときに偽とみなされていました。 この挙動は分かりにくく、エラーの元
     となると考えられ、Python 3.5 で削除されました。 全詳細については
     bpo-13936(2) を参照してください。

   * The ‘ssl.SSLSocket.send()’ method now raises either *note
     ssl.SSLWantReadError: 106d. or *note ssl.SSLWantWriteError: 106e.
     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: a7b,
     ‘HTMLParser.error()’, and the ‘HTMLParserError’ exception have been
     removed.  (Contributed by Ezio Melotti in bpo-15114(5).)  The
     'convert_charrefs' argument of ‘HTMLParser’ 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: 194. is required,
     not 'sometype'" の形になっています。 (Contributed by Ezio Melotti
     in bpo-16518(7).)

   * 既に存在していないディレクトリをカレントディレクトリとして指してい
     た場合に、 *note find_spec(): 10ca. は以前は *note
     FileNotFoundError: 266. 例外を送出していましたが、そうではなく
     ‘None’ を返却するようになりました。この際 *note
     sys.path_importer_cache: 7fa. に ‘None’ を 'キャッシュはしません' 。
     これは典型的なケースとは違います(訳注: msg231477(8))。
     (bpo-22834(9))

   * *note http.client: 73. モジュールと *note http.server: 76. モジュー
     ルに散らばっていた HTTP ステータスコードと対応するメッセージを、共
     通の *note HTTPStatus: b00. enum としてまとめ直しました。
     ‘http.client’ 、 ‘http.server’ にあったもとの値も後方互換性のために
     残してあります。 (Contributed by Demian Brecht in bpo-21793(10).)

   * When an import loader defines *note exec_module(): a6e. it is now
     expected to also define *note create_module(): eb0. (raises a *note
     DeprecationWarning: 1a4. now, will be an error in Python 3.6).  If
     the loader inherits from *note importlib.abc.Loader: 10cb. then
     there is nothing to do, else simply define ‘create_module()’ to
     return ‘None’.  (Contributed by Brett Cannon in bpo-23014(11).)

   * *note re.split(): 5a2. 関数は常に空のパターンマッチを無視してきまし
     た。ですからパターン ‘"x*"’ はパターン ‘"x+"’ と同じように動作し、
     パターン ‘"\b"’ は決して動作しませんでした。今後は ‘re.split()’ は
     パターンが空文字列に合致しうる場合に警告を出します。互換性のために
     は空文字列とはマッチしえないパターンを使ってください(たとえば
     ‘"x*"’ ではなく ‘"x+"’ を使ってください)。空文字列としかマッチしえ
     ないパターン(例えば ‘"\b"’)はエラーとなります。 (Contributed by
     Serhiy Storchaka in bpo-22818(12).)

   * *note http.cookies.Morsel: e02. 辞書風インターフェイスのそれ自身で
     の一貫性を持たせるようにしました: morsel の比較に *note key: dff. と
     *note value: e00. を考慮するようにし、 *note copy(): 10cc. は *note
     dict: 184. を返さずに ‘Morsel’ インスタンスを返すようにし、 *note
     update(): 10cd. は更新する辞書内のいずれかのキーが不正(訳注: RFC
     2109(13) として不正なキーのことで、update 以外のインターフェイスで
     は変更前も拒絶される)であれば例外を投げるようにしています。加えて、
     ドキュメントされていない *note set(): e03. の '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(): 351. 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: 10ce. constant on linux 3.6 and greater.

   * RFC 5280(16) に基づき、 *note ssl.cert_time_to_seconds(): 106f. 関
     数が入力の時刻をローカル時刻ではなく UTC として解釈するようになりま
     した。また、戻り値は常に *note int: 19c. となります。 (Contributed
     by Akira Li in bpo-19940(17).)

   * ‘pygettext.py’ ツールが POT-Creation-Date ヘッダ内のタイムゾーン形
     式として、標準の +NNNN 形式を使うようになりました。

   * The *note smtplib: cf. module now uses *note sys.stderr: b37.
     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(): 10cf. と *note str.endswith(): 10d0. メソッ
     ドは空文字列を見つけた場合と完全に範囲外のインデクスが渡された場合
     に ‘True’ を返すことはしなくなりました。 (Contributed by Serhiy
     Storchaka in bpo-24284(18).)

   * *note inspect.getdoc(): bf1. 関数が基底クラスから継承したドキュメン
     テーション文字列を返すようになりました。その継承したドキュメンテー
     ション文字列が相応しいのであれば、もはやそれを繰り返して記述する必
     要はありません。継承されたそれを抑制するには、空の文字列を記述しな
     ければなりません(もしくは然るべきドキュメンテーションを埋めれば良い
     です)。この変更は *note pydoc: ba. モジュールと *note help(): ad8.
     関数の出力に影響します。 (Contributed by Serhiy Storchaka in
     bpo-15582(19).)

   * ネストされた *note functools.partial(): 219. 呼び出しは平坦化される
     ようになりました。以前の振る舞いに依存していたのであれば
     ‘functools.partial()’ オブジェクトに属性を追加するか、または
     ‘functools.partial()’ をサブクラス化することで出来ます。 (-訳注: 後
     半が意味がある内容を言ってるようには思えません。「以前の振る舞い」
     とはおそらく ‘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: 10d2. 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(): 1c3. 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 ‘__module__’ 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: ca0. was replaced with a *note tp_as_async:
     10d3. slot.  Refer to *note コルーチンオブジェクト: 10d4. 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 が常に利用可能であることが保障されるようになりました:
     10dc. ( PEP 453(1))。

   * *note 新しく作成されたファイル記述子が継承不可能 （non-inheritable）
     になりました: 10dd. ( PEP 446(2))。

   * *note 隔離モード (isolated mode): 10de. の為のコマンドラインオプシ
     ョン (bpo-16499(3))。

   * 非テキストエンコーディングでの *note Codec 処理の改良: 10df. (複数
     の issue に関係).

   * インポートシステムのための *note ModuleSpec 型: 10e0. ( PEP
     451(4)).  (インポーターの作者に影響します)

   * *note marshal: 91. フォーマットが *note よりコンパクトで効率的に:
     10e1. なりました (bpo-16475(5))。

新たなライブラリモジュール:

   * *note asyncio: b.: *note 非同期 IO のための新たな暫定 API: 10e2. (
     PEP 3156(6))。

   * *note ensurepip: 59.: *note pip インストーラのブートストラップ:
     10e3. ( PEP 453(7))。

   * *note enum: 5a.: *note 列挙型のサポート: 10e4. ( PEP 435(8))。

   * *note pathlib: a8.: *note オブジェクト指向のファイルシステムパス:
     10e5. ( PEP 428(9))。

   * *note selectors: c7.: *note 高水準で効率的な I/O の多重化: 10e6.、
     *note select: c6. モジュールプリミティブを基にしています ( PEP
     3156(10) の一部)。

   * *note statistics: d7.: 基礎的な *note 数値的に安定な統計ライブラリ:
     10e7. ( PEP 450(11))。

   * *note tracemalloc: 106.: *note Python のメモリ割り当てのトレース:
     10e8. ( PEP 454(12))。

大幅に改善されたライブラリモジュール:

   * *note functools: 63. の *note シングルディスパッチジェネリック関数:
     10e9. ( PEP 443(13))。

   * *note pickle: ab. の新しい *note プロトコル 4: 10ea. ( PEP
     3154(14)).

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプションを持つようになりました: 10eb.
     (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: 10ec. (bpo-18891(16)).

   * *note inspect: 82. と *note pydoc: ba. が以前よりも遥かに幅広い種類
     の callable オブジェクトを正しくイントロスペクション出来るようにな
     り、これは Python *note help(): ad8. システムを改善することになりま
     した。

   * *note ipaddress: 84. モジュール API は安定だと宣言されました。

セキュリティの改善:

   * *note 安全で取り替え可能なハッシュアルゴリズム: 10ed. ( PEP
     456(17))。

   * ファイル記述子が子プロセスにリークするのを防ぐために *note
     新しく作成されたファイル記述子が継承不可になりました: 10dd. ( PEP
     446(18))。

   * *note 隔離モード (isolated mode): 10de. のための新たなコマンドライ
     ンオプション (bpo-16499(19))。

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプション: 10eb. を持つようになりました。 子プロセス
     とのデータ共有を避けるため 'spawn' と 'forkserver' はより安全です。

   * Windows での *note multiprocessing: 98. 子プロセスはもはや、必要な
     ものを除いて親の継承可能なハンドルを継承しません。

   * 新たな関数 *note hashlib.pbkdf2_hmac(): 733. は PKCS#5 パスワードベ
     ースの鍵導出関数２(20) を提供します。

   * *note ssl: d5. での *note TLSv1.1、 TLSv1.2 サポート: 10ee. の追加
     。

   * *note ssl: d5. での *note Windows
     のシステム証明書ストアよりの証明書抽出サポート: 10ef. の追加。

   * *note ssl: d5. での *note サーバサイド SNI (Server Name Indication)
     サポート: 10f0. の追加。

   * *note ssl.SSLContext: 355. クラスに *note 多数の改善: 10f1. がなさ
     れました。

   * 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(): 10f2.).

CPython の実装の改善:

   * *note オブジェクトの安全なファイナライゼーション: 10f3. ( PEP
     442(21))。

   * PEP 442(22) を活用することで、ほとんどのケースで *note
     モジュールのグローバルがファイナライゼーション中に None
     がセットされることはなくなりました: 10f3. (bpo-18214(23))。

   * *note 設定可能なメモリアロケータ: 10f4. ( PEP 445(24))。

   * *note Argument Clinic: 10f5. ( 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: 118. モジュールは、
仮想環境で ‘pip’ が使えるようにするために *note ensurepip: 59. モジュー
ルを使います。 コマンドラインユーティリティを使う際は ‘pip’ はデフォルト
でインストールされます。 ‘venv’ モジュールの *note API: 10f9. を使う際は
、 ‘pip’ のインストールは明示的に要求しなければなりません。

CPython の *note source builds on POSIX systems: 10fa. では ‘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 モジュールのインストール: 10fc. と
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++ 拡張のビルド: 10fd. and *note setuptools による C および
C++ 拡張のビルド: 10fe.

参考
....

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): 1100. となります。一般的にはこれこそがアプリケーショ
ンが望む振る舞いです。新たにプロセスを生成する際に、現在開いているファイ
ルを起こした子プロセスでも開くことは、検出が困難なあらゆるバグや潜在的な
セキュリティ問題を引き起こしかねません。

そうはいっても継承することが望ましい場合もあります。それらのケースをサポ
ートするために、以下の新規関数とメソッドが利用出来ます:

   * *note os.get_inheritable(): 1101, *note os.set_inheritable(): 1102.

   * *note os.get_handle_inheritable(): 1103, *note
     os.set_handle_inheritable(): 1104.

   * *note socket.socket.get_inheritable(): 1105, *note
     socket.socket.set_inheritable(): 1106.

参考
....

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: 16a, *note bytes: 193, *note bytearray: 342.
にある型に制限があるコンビニエンスメソッドのおかげで、歴史的にその本来の
意図を曖昧にしてきたのでした。

そんな状況を清く正しくするための重要な一歩として、今ではコンビニエンス関
数 *note codecs.encode(): 1108, *note codecs.decode(): 1109. が Python
2.7、3.3、3.4 で適切にドキュメントされました。これら関数は *note codecs:
1c. モジュールに Python 2.4 からずっと存在している (うえに回帰テストスイ
ートでもずっと網羅してきた) のですが、以前はドキュメントされていなかった
わけなので、実行時イントロスペクションでようやく見つけられるというものだ
ったわけです。

*note str: 16a, *note bytes: 193, *note bytearray: 342. でのコンビニエン
スメソッドが 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): 110a. と *note テキスト変換 (Text
Transforms): 110b. に詳細記述されました。

(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 非推奨: 110d. を参照してくださ
い。

   ---------- 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(): 110f. と *note max(): 1110. にキーワード専用引数
     'default' が追加されました。これにはイテラブルが要素なしであると評
     価される場合に返す値を指定出来ます。 (Contributed by Julian Berman
     in bpo-18111(1).)

   * Module objects are now *note weakly referenceable: 1111.

   * モジュールの ‘__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: fbc. ‘cp273’.  (Contributed by
     Michael Bierenfeld and Andrew Kuchling in bpo-1097797(4).)

   * 新規ウクライナ語 *note codec: fbc. ‘cp1125’.  (Contributed by
     Serhiy Storchaka in bpo-19668(5).)

   * *note bytes: 193.join() と *note bytearray: 342.join() が引数として
     任意のバッファオブジェクトを受け取れるようになりました。
     (Contributed by Antoine Pitrou in bpo-15958(6).)

   * *note int: 19c. コンストラクタの 'base' 引数に、 ‘__index__’ メソッ
     ドを持つ任意のオブジェクトを渡せるようになりました。(Contributed by
     Mark Dickinson in bpo-16772(7).)  (--訳注: *note Python API の変更:
     1112. に同じ bpo-16772(8) を発端とする変更が書かれているのでそちら
     も参照して下さい。 --)

   * フレームオブジェクトに、ローカル変数への全ての参照をフレームからク
     リアするメソッド *note clear(): 585. が追加されました。(Contributed
     by Antoine Pitrou in bpo-17934(9).)

   * *note memoryview: 166. が *note Sequence: 1f. として登録され、また
     、組み込み関数 *note reversed(): a69. をサポートするようになりまし
     た。 (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(): ad8. が報告する
     シグニチャが修正・改善されました。

   * *note __length_hint__(): 1113. が、公式な言語仕様の一部になりました
     (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: 3cf. であるとみなされ
ています。

参考
....

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: 3cf. であるとみなされ
ています。

参考
....

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: 106. モジュール ( 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<7>.
* 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(): 111e. は、オブジェクトグラフ内での
変化の影響を受けるキャッシュをいつ無効化すれば良いかを知るために使えます
。 (Contributed by Łukasz Langa in bpo-16832(1).)

新規クラス *note ABC: 111f. はそのメタクラスとして *note ABCMeta: 1120.
を持ちます。この ‘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: 187. 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: 194.  (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: 30e. クラスが 'encoding' 引数、 'errors' 引数を受け付け
るようになりました。これは *note open(): 318. にそのまま渡されます。
(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: 194.
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: 194. オブジェクトを受け取れるようになりました。以前は *note
bytes: 193. または *note bytearray: 342. インスタンスである必要がありま
した。 (Contributed by Nick Coghlan in bpo-17839(1).)

新規関数 *note a85encode(): 1125, *note a85decode(): 1126. は ‘Ascii85’
フォーマットの、 *note b85encode(): 1127, *note b85decode(): 1128. は
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(): 112a. メソッドが、チェーンに追加する子マップ
を指定する '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: 112d. によって、意
図して単独ステートメントからの例外を抑制しているというコードの意図をはっ
きりと読み手に伝えることが出来ます。 (Contributed by Raymond Hettinger
in bpo-15806(1) and Zero Piraeus in bpo-19266(2).)

新規コンテキストマネージャ *note contextlib.redirect_stdout(): feb. は、
ユーティリティスクリプトにて、その出力を *note sys.stdout: cd1. に書き出
す一方でその向き先を変えれない頑固な API の扱いを簡単にしてくれます。こ
れを使うと、 ‘sys.stdout’ 出力をなにかほかのストリームに振り替えたり、あ
るいは *note io.StringIO: 112e. と組み合わせて文字列化したり出来ます。後
者などは特に便利で、たとえば元々はコマンドラインインターフェイスとして実
装された関数からの出力を取り込む、などということが出来ます。このコンテキ
ストマネージャはユーティリティスクリプト以外では使わない方が肝要です。と
いうのもこれは ‘sys.stdout’ の大域的な状態に影響を与えてしまうからです。
(Contributed by Raymond Hettinger in bpo-15805(3).)

*note contextlib: 27. ドキュメントにも改善が行われ、コンテキストマネージ
ャを単独で使うのと再利用したり再入可能(リエントラント)するのとの違いにつ
いての *note 議論: 112f. が追加されました。

   ---------- 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(): 1131. がコンテキスト管理プロトコルをサポートするように
なりました: *note with: 187. ブロックで使うとデータベースオブジェクトの
‘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(): 1133, *note dis(): 207, *note distb(): 208,
*note disassemble(): 209. が新たにキーワード専用引数 'file' を受け取りま
す。これは出力先を制御します。

*note dis: 3c. モジュールはいまでは *note Instruction: 205. クラスを中心
に据えて構築されています。これは個々のバイトコード操作の詳細に対し、オブ
ジェクト指向的なアクセスを提供するクラスです。

新規メソッド *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: 206.
provides an object-oriented API for inspecting bytecode in both in
human-readable form and for iterating over instructions.  The ‘Bytecode’
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: 205. objects.  But it also has
a *note dis: 1134. method, equivalent to calling *note dis: 207. 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: 206. にはクラスメソッド *note from_traceback(): 1135. も
あります。トレースバックから ‘Bytecode’ を構築します。
(‘print(Bytecode.from_traceback(tb).dis())’ は *note distb(): 208. を使
って ‘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(): 1136. は与えられた 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: 1138, *note FAIL_FAST: 1139, 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 オプション: 1138. を指定
することが出来ます。 ‘-f’ は ‘-o FAIL_FAST’ の速記法です (*note
unittest: 10d. CLI でサポートされる似たオプション *note
サポートされる同じオプション: 113a. に似せるためです)。 (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(): 113c. メソッドが、その文字列表現を生成するのに使うデ
フォルトポリシーを上書き出来る 'policy' 引数を取るようになりました。つま
り *note Message: 581. を作り直したり ‘flattern’ メソッドの書式化パラメ
ータのためだけに *note generator: 44. を使うことなしに、 ‘as_string’ を
より多くの状況で使えるということになります。(Contributed by R. David
Murray in bpo-18600(1).)

*note as_bytes(): 113d. メソッドが追加されました。これは ‘as_string’ が
文字列表現を生成するのと似たやり方で、メッセージの bytes 表現を生成しま
す。これは 'maxheaderlen' 引数を取りませんが、 'unixfrom' 引数と
'policy' 引数を取ります。 *note Message: 581. の *note __bytes__():
113e. がこれを呼び出すようにしたので、 ‘bytes(mymsg)’ は今や直感に反しな
い結果、つまり完全にフォーマットされたメッセージを生成します。
(Contributed by R. David Murray in bpo-18600(2).)

*note Message.set_param(): 113f. メソッドにキーワード引数 'replace' が追
加されました。真を渡すとヘッダリスト内のその位置を変更せずに関連ヘッダを
更新します。後方互換のためにデフォルトは ‘False’ です。 (Contributed by
R. David Murray in bpo-18891(3).)  サブモジュール *note contentmanager:
41. と *note policy: 53. 属性の *note content_manager: 1140. の追加と併
せて、 *note Message: 581. の対となる二つのサブクラス (*note
EmailMessage: 580. と *note MIMEPart: 1141.) が追加されました。 全てのド
キュメントは、 email の新規 *note 暫定 API: 3cf. の構成要素として追加さ
れたこの新しいモジュールにあります。 これらのクラスは、 email メッセージ
からの内容抽出や挿入を遥かに簡単に行える、数多くの新規メソッドを提供して
います。 詳細は ‘contentmanager’ のドキュメントと *note email; 使用例:
1142. を参照してください。 これらの 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(): 1144. 関数が追加されました。 *note filecmp: 5e. は
*note os.stat(): 26f. 情報をキャッシュして最後の比較時点からのファイルの
変化をみていますが、このキャッシュをクリアします。これはたとえば、ファイ
ルシステムのタイムスタンプフィールドの解像度未満の時間差で再比較したい場
合に使えるでしょう。(Contributed by Mark Levitt in bpo-18149(1).)

New module attribute *note DEFAULT_IGNORES: 1145. provides the list of
directories that are used as the default value for the 'ignore'
parameter of the *note dircmp(): 1146. 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<7>,  Prev: filecmp,  Up: 改良されたモジュール<10>

1.11.4.14 functools
...................

新たな *note partialmethod(): 21a. デスクリプタは、ちょうど普通の
callable に対して *note partial(): 219. がするように、デスクリプタへの引
数部分適用を可能にします。この新しいデスクリプタをクラス定義内で使うと、
簡単に (‘partial()’ インスタンスを含む) 任意の 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(): 1148. now supports a return value of *note
NotImplemented: 1a3. from the underlying comparison function.
(Contributed by Katie Miller in bpo-10042(3).)

*note partial(): 219. 関数のピュア 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<7>,  Next: glob<4>,  Prev: functools<6>,  Up: 改良されたモジュール<10>

1.11.4.15 gc
............

新規関数 *note get_stats(): 2de. は、インタプリタが開始してからの、世代
ごと回収統計を持つ辞書の、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<7>,  Up: 改良されたモジュール<10>

1.11.4.16 glob
..............

新規関数 *note escape(): 114b. は、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: 114d. 属性が、公
式にサポートされるインターフェイスになりました。これは CPython の
‘hashlib’ には以前から存在していました (ただしサポートされるハッシュの名
前を必ずしも小文字で返してはいませんでした) が、公開インターフェイスとし
ていなかったために、ほかのいくつかの 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(): c9a. の 'key' 引数として ‘bytearray’ と
‘bytes’ を許容するようになり、また、 ‘new()’ 関数と *note update():
114f. メソッドの両方への 'msg' パラメータとして、 *note hashlib: 6c. モ
ジュールがサポートする任意の型を許容するようになりました。(Contributed
by Jonas Borgström in bpo-18240(1).)

*note hmac.new(): c9a. 関数への 'digestmod' 引数には、*note hashlib: 6c.
が認識する任意のハッシュダイジェスト名を渡せるようになりました。これとと
もに、 'digestmod' のデフォルトとして ‘MD5’ を使う現在の振る舞いは非推奨
です。将来のバージョンの Python ではこれのデフォルト値はなくなり、指定が
必須になります。 (Contributed by Christian Heimes in bpo-17276(2).)

*note block_size: 1150. 属性と *note name: 1151. 属性 (と *note
digest_size: 1152. 属性の公式ドキュメント) の追加をもって、 *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(): b54. は HTML5 文字参照を対応する Unicode 文字
に変換します。 (Contributed by Ezio Melotti in bpo-2927(1).)

*note HTMLParser: a7b. が新規キーワード引数 'convert_charrefs' を受け取
ります。これが ‘True’ の場合に、全ての文字参照が自動的に変換されます。後
方互換性の問題から今はこのデフォルトを ‘False’ にしてありますが、将来バ
ージョンの Python でこれを ‘True’ に変えます。ですから値は明示的にセット
してこの新しい機能を使うように更新しておくと良いです。(Contributed by
Ezio Melotti in bpo-13633(2).)

*note HTMLParser: a7b. の '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(): 1155. 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:
1156. attribute and sent as the body of the error response.
(Contributed by Karl Cow in bpo-12921(1).)

*note http.server: 76. の *note コマンドラインインターフェイス: 1157. に
‘-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: 115a. ABC に新規メソッド *note source_to_code():
1016. が追加されました。ソースデータとパスを受け取り、コードオブジェクト
を返します。これのデフォルト実装は ‘compile(data, path, 'exec',
dont_inherit=True)’ と同じです。 (Contributed by Eric Snow and Brett
Cannon in bpo-15627(1).)

*note InspectLoader: 115a. では *note get_code(): 115b. メソッドへのデフ
ォルト実装追加も行われました。とはいえ性能面の理由より、通常はデフォルト
実装をオーバライドすることが望ましいです。 (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(): 351.
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: 115c. が
*note InspectLoader: 115a. 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(): 115d. 関数が追加され
ました。 *note universal newlines: f39. 処理を使って bytes からソースを
デコードします。 *note InspectLoader.get_source(): 115e. メソッドを実装
するのに便利です。

*note importlib.machinery.ExtensionFileLoader: eb2. に *note
get_filename(): 115f. メソッドが追加されました。これは本来実装されるべき
ものでしたが見落とされていました。(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
コマンドラインインターフェイス: 1161. が追加されました。 (Contributed by
Claudiu Popa and Nick Coghlan in bpo-18626(1).)

新規の *note unwrap(): 1162. で、 *note functools.wraps(): 1163. (やラッ
パー関数に ‘__wrapped__’ 属性をセットするその他 API) で作られたラッパー
関数のチェインを、簡単にほどくことが出来ます。 (Contributed by Daniel
Urban, Aaron Iles and Nick Coghlan in bpo-13266(2).)  (--訳注: 「簡単に
」の意味するところについて、 *note Python API の変更: 1112. に記述されて
いる ‘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(): 945. and ‘getargspec()’ now use the *note
signature(): 231. 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():
219. objects and more.  Note that, unlike ‘signature()’, 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 ‘signature()’ directly if those features are desired.
(Contributed by Yury Selivanov in bpo-17481(5).)

*note signature(): 231. が 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:
3cf. として追加されました。Python 3.4 リリースで、この但し書きは削除され
ました: ‘ipaddress’ は今や安定 API とみなされ、今後は通常の標準ライブラ
リの後方互換性維持要件に従います。

新規のプロパティ *note is_global: 1165. は、アドレスが 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: 1167. に 'atTime' パラメータが追加されま
した。ロールオーバ対象となる日付での時刻を指定します。 (Contributed by
Ronald Oussoren in bpo-9556(1).)

*note SocketHandler: 1168. と *note DatagramHandler: 1169. が Unix ドメ
インソケットをサポートするようになりました ('port' に ‘None’ をセットす
ることで)。 (Contributed by Vinay Sajip in commit ce46195b56a9(2) .)

*note fileConfig(): d4c. が 'fname' パラメータとして *note
configparser.RawConfigParser: 116a. のサブクラスを許容するようになりまし
た。これはロギングの設定がアプリケーション全体の設定の一部に過ぎない場合
や、 ‘fileConfig()’ に渡す前にアプリケーションが設定を修正するような場合
でも設定ファイルを使用することを容易にします。(Contributed by Vinay
Sajip in bpo-16110(3).)

*note logging.config.listen(): 116b. 関数経由でソケットから受信したロギ
ング設定データを、処理前に検証出来るようになりました。新規のキーワード引
数 '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: 1111.  (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 開始方式:
1d7. として、Unix において 2 つ、 ‘spawn’ と ‘forkserver’ が追加されまし
た。これらはスレッドとプロセスのミックスをより堅牢にし、また、 ‘spawn’ は
multiprocessing が以前から常に Windows で使ってきたセマンティクスと一致
します。新規関数の、 *note get_all_start_methods(): 116f. はプラットフォ
ームで利用出来るすべての開始方式を報告し、 *note get_start_method():
1170. は現在設定されている開始方式を報告し、 *note set_start_method():
24d. は開始方式を設定します。(Contributed by Richard Oudkerk in
bpo-8713(1).)

*note multiprocessing: 98. には、子プロセスがどのように作られるかを決定
する ‘context’ のコンセプトが追加されています。新規関数 *note
get_context(): 24c. は指定した開始方式を使うコンテキストを返します。コン
テキストは ‘multiprocessing’ モジュール自身と同じ API を持っているので、
コンテキスト内で操作する *note Pool: 1171. や他のオブジェクトを、それを
使って作成することが出来ます。コンテキストによって、フレームワークとアプ
リケーションあるいは同じアプリケーションの別の部分が相互に干渉しあわない
ようにして 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(): 1173. は、言語仕様となった特殊メソッド
*note __length_hint__(): 1113. の 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 継承可能フラグ: 1100. を制御出来るようになりました
。ファイル記述子には *note os.get_inheritable(): 1101, *note
os.set_inheritable(): 1102. を、Windows のハンドルには *note
os.get_handle_inheritable(): 1103, *note os.set_handle_inheritable():
1104. を使います。

関数 *note cpu_count(): 4db. が追加されました。これは Python を実行して
いるプラットフォームで利用可能な CPU 数を返します (決定できない場合は
‘None’ を返します)。既存の *note multiprocessing.cpu_count(): 1175. はこ
の関数の値を返すようになりました。(Contributed by Trent Nelson, Yogesh
Chaudhari, Victor Stinner, and Charles-François Natali in bpo-17914(1).)

*note os.path.samestat(): 1176. が Windows プラットフォームでも動作する
ようになりました (また、 *note os.path.samefile(): 1177. の実装は Unix と
Windows で共有されました)。 (Contributed by Brian Curtin in
bpo-11939(2).)

*note os.path.ismount(): c0b. が Windows において、ドライブルートよりも
下にあるマウントポイントを認識するようになりました。 (Contributed by Tim
Golden in bpo-9035(3).)

*note os.open(): f96. supports two new flags on platforms that provide
them, *note O_PATH: 1178. (un-opened file descriptor), and *note
O_TMPFILE: 1179. (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: bc6. 、 ‘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(): 117b. 関数へのアクセスを取り戻しました。 Python 2
の ‘pdb’ には ‘print’ コマンドはなく ‘print’ の入力は Python 2 の
‘print’ 文を実行していました。 Python 3 で pdb の *note p: 117c. コマン
ドへのエイリアスとして ‘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(): b4c,
*note dump(): b4e, *note loads(): b4d, and *note dumps(): b4f.
functions.  (The older API is now deprecated.)  In addition to the
already supported XML plist format (*note FMT_XML: 117f.), it also now
supports the binary plist format (*note FMT_BINARY: 1180.).
(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():
1182. は POP サーバにより公表された機能リストを返します。 *note stls():
1183. は平文 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: 1185. クラス、
*note pformat(): 1186. 関数、 *note pprint(): a2d. 関数に、新規オプショ
ン '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(): 1188. が ‘None’ ではなく *note os.waitpid(): f9e. か
らの戻り値から取ったステータス値を返すようになりました。 (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(): 231. に直接基くようになりました。これによりより幅広
く 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(): ad8. は *note pydoc: ba. モジュールに基いているの
で、上記変更は ‘help()’ の振る舞いにも影響します。

   ---------- 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(): 118b. function and *note Pattern.fullmatch():
118c. 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 正規表現オブジェクト: 118d. の repr にパターンとフラグを含めるよう
になりました。 *note match オブジェクト: 118e. の 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(): 1190. は、指定プロセスのリソースリミットの問い
合わせとセットを、一度の呼び出しで行えます。カーネルバージョン 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: 1191, *note RLIMIT_NICE:
1192, *note RLIMIT_RTPRIO: 1193, *note RLIMIT_RTTIME: 1194, and *note
RLIMIT_SIGPENDING: 1195.  (Contributed by Christian Heimes in
bpo-19324(2).)

On FreeBSD version 9 and later, there some new FreeBSD specific
constants: *note RLIMIT_SBSIZE: 1196, *note RLIMIT_SWAP: 1197, and *note
RLIMIT_NPTS: 1198.  (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: 119a. がコンテキスト管理プロトコルをサポートするようになり
ました: *note with: 187. ブロックで使うと *note close(): 119b. メソッド
がブロックの終了時に自動的に呼び出されます。 (Contributed by Serhiy
Storchaka in bpo-16488(1).)

*note devpoll: 119c. オブジェクトに、メソッド *note fileno(): 119d. とメ
ソッド *note close(): 119e. 、それに属性 *note closed: 119f. が追加され
ました。 (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: 11a1. がコンテキスト管理プロトコルをサポートするようになり
ました: ‘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(): c52. が、コピー元とコピー先が同じファイルの場合に
*note Error: 11a3. の限定されたサブクラスである *note SameFileError:
11a4. を投げるようになりました。これにより、アプリケーションはこの特定の
エラーでそれに相応しいアクションを取れます。 (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: 11a7. が *note OSError: 2c2. のサブクラスになりまし
た。これによって、とにかくエラーが起こったのだということにしか関心がない
コードが、ソケット階層でのエラーと 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: 11a9. protocol on
platforms that support it.  (Contributed by Brian Thorne in
bpo-15359(1).)

ソケットオブジェクトで *note 継承可能フラグ: 1100. を制御出来るようにな
りました。 *note get_inheritable(): 1105. で取得し、 *note
set_inheritable(): 1106. でセットします。

定数値の ‘socket.AF_*’ と ‘socket.SOCK_*’ が、新規の *note enum: 5a. モ
ジュールを使った列挙値になりました。つまりデバッグなどで魑魅魍魎な整数で
はなく徳高い名前で表示されるということです。

The *note AF_LINK: 11aa. constant is now available on BSD and OSX.

*note inet_pton(): b5f. と *note inet_ntop(): 11ab. が 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: 11ae. と *note PROTOCOL_TLSv1_2: 11af. (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: 355. を得るための標
準手段として追加されました。それらの設定は ‘SSLContext’ コンストラクタが
与えるデフォルトよりも厳しく、そして将来的にセキュリティにおけるベストプ
ラクティスによる要請が変化すれば、事前予告なしで調整されるかもしれません
。SSL をサポートする標準ライブラリの使用においての新しいベストプラクティ
スとして、 ‘SSLContext’ を得るのには ‘create_default_context()’ を使うこ
とが推奨です。必要に応じ、対応する標準ライブラリ API の 'context' 引数に
渡すためにそれを使うよう修正してください。(Contributed by Christian
Heimes in bpo-19689(2).)

*note SSLContext: 355. のメソッド *note load_verify_locations(): 10f2. に
オプショナル引数 'cadata' が追加されました。これには PEM あるいは DER エ
ンコードの証明書を直接指定できます。前者の場合は文字列で、後者では *note
bytes-like object: 194. で指定します。(Contributed by Christian Heimes
in bpo-18138(3).)

関数 *note get_default_verify_paths(): 11b0. が追加されました。これは
*note set_default_verify_paths(): 11b1. メソッドが OpenSSL デフォルトの
‘cafile’ と ‘capath’ をセットするのに使うパスと環境変数から成る名前付き
タプルを返します。デフォルトの検証にまつわる問題をデバッグするのに使える
でしょう。(Contributed by Christian Heimes in bpo-18143(4).)

*note SSLContext: 355. の新規メソッド *note cert_store_stats(): 11b2. は
ロードされた ‘X.509’ 証明書、 ‘X.509 CA’ 証明書、証明書失効リスト
(‘crl’) を報告し、また、新規メソッド *note get_ca_certs(): 11b3. はロー
ドされた ‘CA’ 証明書のリストを返します。(Contributed by Christian Heimes
in bpo-18147(5).)

If OpenSSL 0.9.8 or later is available, *note SSLContext: 355. has a new
attribute *note verify_flags: 11b4. that can be used to control the
certificate verification process by setting it to some combination of
the new constants *note VERIFY_DEFAULT: 11b5, *note
VERIFY_CRL_CHECK_LEAF: 11b6, *note VERIFY_CRL_CHECK_CHAIN: 11b7, 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: 355. の新規メソッド *note load_default_certs(): 11b8.
は、プラットフォームによって異なるデフォルトの場所から “認証局”
(CA=certification authority) 証明書ファイル一式をロードします。クライア
ントがサーバを検証するための TLS web サーバ証明の証明書をロード
(‘purpose=’*note SERVER_AUTH: 11b9.) することも、サーバがクライアント証
明書を検証するのに用いる証明書をロード (‘purpose=’*note CLIENT_AUTH:
11ba.) することも出来ます。(Contributed by Christian Heimes in
bpo-19292(7).)  Windows だけで利用出来る関数が 2 つ追加されました。
*note enum_certificates(): 11bb. と *note enum_crls(): 11bc. で Windows
のシステム証明書ストアから、証明書、証明書の情報、CRLs (certification
revocation=証明書失効リスト) を抽出出来ます。(Contributed by Christian
Heimes in bpo-17134(8).)  新規メソッド *note
ssl.SSLContext.set_servername_callback(): 11bd. によるサーバサイド SNI
(Server Name Indication) サポートが追加されました。 (Contributed by
Daniel Black in bpo-8109(9).)

*note SSLSocket.getpeercert(): 11be. が返す辞書に ‘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: 11c0. flags, *note S_IFDOOR:
11c1, *note S_IFPORT: 11c2, and *note S_IFWHT: 11c3.  (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: 11c5. と、コンパイル済フォーマットでのメソッド
*note struct.Struct.iter_unpack(): 11c6. が追加されました。これは、与え
られたデータフォーマットの繰り返しインスタンスを含むバッファを逐次的にア
ンパックします。 (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(): 11c8. が 'input' 引数を受け付けるようになりました
。これは実行するコマンドにとっての ‘stdin’ を供給するのに使われます (訳
注: *note run(): d83. のドキュメント参照)。 (Contributed by Zack
Weinberg in bpo-16624(1).)

*note getoutput(): 11c9. and *note getstatusoutput(): 11ca. 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: 187. 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: 194.  (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(): 11cd. は、現在インタプリタによ
りアロケートされているブロック数を返します (デフォルトの
‘--with-pymalloc’ 設定での CPython では、これは *note PyObject_Malloc():
e66. API によるアロケーションです)。これはメモリリークの追跡に、とりわけ
テストスイートで自動化されている場合はなおさら有用です。 (Contributed by
Antoine Pitrou in bpo-13390(1).)

Python インタプリタが *note 対話モード: 441. で開始する際に *note sys:
df. モジュールの属性 *note __interactivehook__: 11ce. をチェックするよう
になりました。この属性があると、対話モード開始直前にその設定値が引数なし
で呼び出されます。このチェックは *note PYTHONSTARTUP: 1ba. ファイルが読
み込まれたあとで行われるので、そのファイル内でセット出来ます。 *note
site: cc. モジュールは *note readline: bf. をサポートするプラットフォー
ムではタブ補完と (‘~/.python-history’ への) 履歴保存を有効にする関数を
*note __interactivehook__ にセットします: 11cf. 。この (新たな) 振る舞い
がお気に召さなければ、 ‘PYTHONSTARTUP’, *note sitecustomize: cd, *note
usercustomize: 115. のいずれかで ‘sys’ からこの属性を削除 (あるいはほか
のなにか 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 コマンドラインインターフェイス: 11d1. をサポートするようにな
りました。 これにより 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: 11d3. に 2 つ新しい制御変数が追加されていて、これらは
属性値であり、コンストラクタ引数に渡せます。それぞれ *note max_lines:
11d4. が最大出力行数、 *note placeholder: 11d5. が 'max_lines' により切
り詰める場合に出力の最終行に置くテキストです。これら機能を使った新規のコ
ンビニエンス関数 *note shorten(): 11d6. が追加されています。これは入力に
含まれる全ての空白文字を単一の空白に置き換え、また幅 '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: 177. オブジェクトを、新規関数
*note main_thread(): 11d8. で得られるようになりました。通常の条件であれ
ばこれは 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(): 11da. は、トレースバックオブジ
ェクトを受け取って、それが参照している全てのフレーム内のローカル変数をク
リアすることで、メモリ消費量を削減します。 (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: 112. が新規クラス *note DataHandler: 11dd. を介し
て ‘data:’ URL をサポートするようになりました。 (Contributed by Mathias
Panzenböck in bpo-16423(1).)

*note Request: 11de. クラスで使われる HTTP メソッドを、サブクラスで
*note method: 11df. 属性をセットすることにより指定出来るようになりました
。 (Contributed by Jason R Coombs in bpo-18978(2).)  (--訳注: ‘method’ は
3.3 で追加されたが、コンストラクタに渡されたものが設定されるだけだった。
--)

*note Request: 11de. オブジェクトは今では再利用可能です: *note full_url:
11e0. あるいは *note data: 11e1. 属性などが変更されると、関連する全ての
内部プロパティが更新されます。このことによって今や、例えば、 ‘Request’ オ
ブジェクトを、異なる 'data' 引数での *note OpenerDirector.open(): 11e2.
の複数回呼び出し内で使ったり、あるいは、まっさらから作り直すのではなく
‘Request’ の ‘url’ を書き換えて使ったり出来ます。新たに *note
remove_header(): 11e3. メソッドも追加されていて、これは ‘Request’ からヘ
ッダを取り除きます。 (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: 11e4. オブジェクトに、エラーに関係する HTTP レスポンス
ヘッダへのアクセスを提供する *note headers: 11e5. 属性が追加されました。
(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: 2b5. class has a new method, *note subTest(): 11e7,
that produces a context manager whose *note with: 187. 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
サブテストを利用して繰り返しテストの区別を付ける: 11e8. にあります。
(Contributed by Antoine Pitrou in bpo-16997(1).)

*note unittest.main(): 11e9. の 'defaultTest' に、テスト名からなるイテラ
ブルを渡せるようになりました。以前は文字列で単一のテスト名を渡せるだけで
した。 (Contributed by Jyrki Pulliainen in bpo-15132(2).)

テストディスカバリ最中に発生する *note SkipTest: 11ea. (これはテストファ
イル内のモジュールレベルで起こせます) を、エラーとしてではなくスキップと
して報告するようになりました。 (Contributed by Zach Ware in
bpo-16935(3).)

*note discover(): 11eb. が発見したファイルをソートするようになったので、
一貫したテスト順でテスト出来ます。 (Contributed by Martin Melin and Jeff
Ramnani in bpo-16709(4).)

*note TestSuite: ff9. がその実行完了次第すぐに、テスト成功していれば、テ
ストへの参照を取り除くようになりました。ガーベージコレクションを行う
Python インタプリタ上ではこの振る舞いによって、テストへの参照を保持して
いるものが他にない場合のテストのガーベージコレクトを可能にします。この振
る舞いは *note TestSuite: ff9. をサブクラス化して何もしない
‘_removeTestAtIndex’ を定義することで上書き出来ます。 (Contributed by
Tom Wardill, Matt McClure, and Andrew Svetlov in bpo-11798(5).)

テストアサーションの新規コンテキストマネージャ *note assertLogs(): a5d.
が追加されました。これはコードブロックが *note logging: 8b. を使ってログ
メッセージを発行しているか確認します。デフォルトでは任意のロガーからの
‘INFO’ 以上のプライオリティを持つメッセージを取れますが、ロガー名と最小
プライオリティの両方とも指定可能です。コンテキストマネージャからの戻りオ
ブジェクトに対して、ログされた *note LogRecord: 11ec. とフォーマットされ
たメッセージの両方あるいはどちらかを問い合わせることが出来ます。
(Contributed by Antoine Pitrou in bpo-18937(6).)

テストディスカバリが名前空間パッケージで動作するようになりました。
(Contributed by Claudiu Popa in bpo-17457(7).)

*note unittest.mock: 10e. オブジェクトが、呼び出しが合致する際に仕様とし
てのシグニチャを検査するようになりました。これはつまり、以前は位置引数だ
けの合致だったものが、位置引数と名前の両方で合致できるようになったという
ことです。(Contributed by Antoine Pitrou in bpo-17015(8).)

*note mock_open(): 11ed. 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: 118. に ‘csh’ と ‘fish’ シェルの有効化スクリプトが追加されま
した。 (Contributed by Andrew Svetlov in bpo-15417(1).)

*note EnvBuilder: 571. クラスとコンビニエンス関数 *note create(): 572. が
新規キーワード引数 'with_pip' を取るようになりました。デフォルトは
‘False’ です。これは ‘EnvBuilder’ が仮想環境に ‘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(): 11f0. method now returns a namedtuple rather than
a plain tuple.  (Contributed by Claudiu Popa in bpo-17487(1).)

*note wave.open(): b49. がコンテキスト管理プロトコルをサポートするように
なりました。 (Contributed by Claudiu Popa in bpo-17616(2).)

*note wave: 11a. は *note
シーク不能なファイルへの書き出しが出来るように: 11f1. なりました。
(Contributed by David Jones, Guilherme Polo, and Serhiy Storchaka in
bpo-5202(3).)

*note writeframesraw(): 11f2. メソッドと *note writeframes(): 11f3. メソ
ッドが *note bytes-like object: 194. を受け付けるようになりました。
(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: 11f5. クラスは、インスタンスメソッドへの弱参照を
シミュレートします。 (Contributed by Antoine Pitrou in bpo-14631(1).)

新規クラス *note finalize: c73. は、弱参照自身のライフサイクルを注意深く
管理する必要性なしに、オブジェクトがガーベージコレクトされる際に呼び出さ
れるコールバックを登録することを可能にします。 (Contributed by Richard
Oudkerk in bpo-15528(2).)

*note ref: 11f6. に関連付いたコールバック (あれば) を、新規属性 *note
__callback__: 11f7. で取得出来るようになりました。(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: 11f9. を利用出来ます。実例は *note
非ブロックパースのためのプル API: 11fa. をみてください。 (Contributed by
Antoine Pitrou in bpo-17741(1).)

*note xml.etree.ElementTree: 12c. の関数 *note tostring(): 11fb. 、*note
tostringlist(): 11fc. と、 *note ElementTree: b4b. クラスの *note
write(): c90. メソッドに、 *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: 11fe. クラスの *note writepy(): 11ff. メソッドに
'filterfunc' オプションが追加されました。これはアーカイブにどのディレク
トリ・ファイルを加えるのかをコントロールするのに使うことが出来ます。例え
ばテスト用ファイルをアーカイブから除外する、などということが出来ます。
(Contributed by Christian Tismer in bpo-19274(1).)

The 'allowZip64' parameter to *note ZipFile: 8d4. and *note PyZipFile:
11fe. 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__(): 1203.
methods, as well as generators with *note finally: 1b1. clauses, can be
finalized when they are part of a reference cycle.

この変更の一環で、モジュールのグローバルは、ほとんどのケースではインタプ
リタのシャットダウン中に強制的に *note None: 886. がセットされることはな
くなり、代わりに循環ガーベージコレクタの通常のオペレーションに委ねます。
このことは、循環 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: 1205. 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(): aa0. 関数が、安定 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(): 1208. 関数を補うものとし
     て、 *note PyStructSequence_InitType2(): 1209. が追加されました。違
     いは、これは成功時に ‘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(): 1173. と等価な C API 関数 *note
     PyObject_LengthHint(): 120a. が追加されました。 (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: 120d. command has a new *note option: 120e, ‘-I’,
     which causes it to run in "isolated mode", which means that *note
     sys.path: 3e2. 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: 120f.
     now also checks for memory allocation leaks, using *note
     sys.getallocatedblocks(): 11cd.  (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__: e5c.  (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: 1210. の値内で、エンコーディング名
     を省略出来るようになりました。つまり、デフォルトエンコーディングを
     変更することなしにエラーハンドラだけをセット出来ます。 (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: a6a. が大半の場合 Python2 のバージョン以上に速く
     なりました。*note lzma.LZMAFile: 1212. も最適化されました。
     (Contributed by Serhiy Storchaka and Nadeem Vawda in bpo-16034(8).)

   * *note random.getrandbits(): 1213. が (通常使用される) 小さな整数に
     対して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(): 1214. が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: 1a4. を励起します。

* 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 型: 10e0, 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(): 1217.;
     ‘importlib.abc.MetaPathFinder.find_module()’ is replaced by *note
     importlib.abc.MetaPathFinder.find_spec(): a6c.;
     ‘importlib.abc.PathEntryFinder.find_loader()’ and ‘find_module()’
     are replaced by *note importlib.abc.PathEntryFinder.find_spec():
     a70.; 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(): a6e, *note
     importlib.abc.InspectLoader.exec_module(): 1218. *note
     importlib.abc.SourceLoader.exec_module(): 1219.) 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(): c9a. 関数の 'digestmod' がデフォルトで暗黙に
     ‘MD5’ を使う仕様は撤廃されます。Python 3.6 では 'digestmod' 引数に
     は明示的にダイジェスト名かコンストラクタを渡すことが求められます。

   * *note ftplib: 62. モジュール内の内部クラス ‘Netrc’ はずっと長いこと
     そのドキュメンテーション文字列内で非推奨であることを謳ってきました
     。これは今や *note DeprecationWarning: 1a4. を発行します。Python
     3.5 ではこのクラスは完全に削除されます。

   * *note subprocess.Popen.wait(): ee4. の文書化されていない引数
     'endtime' は本来曝してはいけないものでしたので、使用されていないこ
     とを願っています。これは非推奨ですし、確実に Python 3.5 では削除さ
     れるのではないでしょうか。(--訳注: 3.5 では削除はされませんでしたが
     、もちろん使用しないでください。これは内部用です。--)

   * *note HTMLParser: a7b. の 'strict' 引数は非推奨です。

   * The *note plistlib: b0. ‘readPlist()’, ‘writePlist()’,
     ‘readPlistFromBytes()’, and ‘writePlistToBytes()’ functions are
     deprecated in favor of the corresponding new functions *note
     load(): b4c, *note dump(): b4e, *note loads(): b4d, and *note
     dumps(): b4f.  ‘Data()’ is deprecated in favor of just using the
     *note bytes: 193. constructor.

   * *note sysconfig: e1. のキー ‘SO’ は非推奨です。これは ‘EXT_SUFFIX’
     に取って代わられました。

   * 種々の ‘open’ 関数で受け付けられていた ‘U’ モードは非推奨となりまし
     た。Python 3 ではこれは何も役に立つことはしません。 *note
     io.TextIOWrapper: 9c2. (必要ならば)、 'newline' 引数を適切に使うこ
     とによって置き換えられるはずです。

   * *note xml.etree.ElementTree.iterparse(): 57a. の 'parser' 引数と
     *note XMLParser(): c4d. の 'html' 引数が非推奨となりました。後者は
     (訳注: 第一引数のため) 削除に備えて ‘XMLParser’ への全ての引数はキ
     ーワード引数として渡すようにしてください。


File: python.info,  Node: 非推奨の機能,  Prev: Python API の非推奨項目,  Up: 非推奨<12>

1.11.6.2 非推奨の機能
.....................

   * *note IDLE -- Python のエディタとシェル: 121b. の ‘-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: d39. と *note HTTPSConnection: d3a. の
     'strict' 引数は削除されました。 HTTP 0.9 スタイルの 「Simple
     Responses」はもはやサポートされません。

   * *note urllib.request.Request: 11de. の非推奨となっていた
     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: 199. を投げます。空で
     ない文字列を渡すことは既に Python 3.2 で非推奨となっていました。こ
     の変更は以前は動作した (そして正しくない) コードが、オブジェクトが
     __format__ メソッドを得ることで処理に失敗し始めていた状況を防ぐ目的
     でなされました。この変更が意味することはあなたのコードにとって、そ
     れを処理する __format__ メソッドを持たないオブジェクトに ‘s’ フォー
     マットコードを使うと ‘TypeError’ を起こしうるようになった、というこ
     とです。背景については 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: 121f. 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: 1223. に空の
     値をセットすることは、何もセットしないことと 'まったく同じではあり
     ませんでした': ‘PYTHONPATH’ に空の値をセットすると、 ‘.’ をセットし
     たのと同じ意味になっていて、これは ‘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
     その他の改善: 120c. セクション内参照)。

   ---------- 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: 369. を投げるのではなく、相応しい例外を投げる
     かデフォルト値を返すかのどちらかになりました。このことは *note
     super(): 1a7. を呼び出して ABC がするがままに任せているコードにのみ
     影響します。互換性のために、必要であれば ‘NotImplementedError’ とそ
     の投げられる新たな例外の両方を捕捉してください。

   * The module type now initializes the *note __package__: 325. and
     *note __loader__: 339. 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:
     1224, or if Python 2 compatibility is necessary you can use
     ‘imp.is_frozen()’.

   * *note py_compile.compile(): c1e. が書き込み先ファイルパスがシンボリ
     ックリンクか非レギュラーファイルの場合に *note FileExistsError:
     1225. を投げるようになりました。これは、警告の役割を果たすためです
     、インポートがファイルパスの元のファイルタイプが何かによらずに、そ
     れらファイルをレギュラーファイルで上書きすることの。

   * ソースコードをロードしようとして *note SyntaxError: 18f. かもしくは
     *note UnicodeDecodeError: c0c. を引き起こした場合に、 *note
     importlib.abc.SourceLoader.get_source(): 1226. はそれを *note
     ImportError: 65b. に読み替えて投げることをしなくなりました。
     ‘ImportError’ はそうあるべきなのに見つからない場合にのみ投げられる
     べきなので、ソースコードが見つかったけれども正しくない構造である場
     合の意味にまで及ぶのは、手を伸ばし過ぎで過負荷です。ImportError を
     捕捉していたコードで今後とも構文エラーとデコーディングの問題を無視
     したいと望むならば、これら 3 つ全ての例外を捕捉するようにしてくださ
     い。 (訳注: changeset 84172:e353f64dfd95(4) )

   * *note functools.update_wrapper(): 1227. と *note functools.wraps():
     1163. が、たとえその関数も ‘__wrapped__’ を持っていたとしても正しく
     その関数が包まれるように ‘__wrapped__’ 属性値をセットするようになり
     ました。つまり ‘__wrapped__’ 属性は、以前のようにチェイン内の全ての
     ‘__wrapped__’ 属性が最も内側の関数を参照するのではなく、デコレート
     された関数の積み上げを正しくリンクするようになったということです。
     以前の振る舞いが意図されたものであると思い込んでいたイントロスペク
     ションライブラリの作者は、チェインの中の最初の関数 (‘__wrapped__’ 属
     性を持たない) にアクセスするのに *note inspect.unwrap(): 1162. を使
     えます。(--訳注: bpo-17482(5).  わかりにくいので実例で。中で適切に
     @wrap を使うデコレータ @deco1、@deco2 があるとして、my_func をこの
     両方でデコレートするとします。この場合に、Python 3.3 までは
     ‘my_func.__wrapped__.__wrapped__’ が AttributeError になります。今
     回のこの修正で ‘my_func.__wrapped__.__wrapped__’ は期待通りに振舞い
     ます。 --)

   * *note inspect.getfullargspec(): 945. は、 *note
     inspect.signature(): 231. を前提とした再実装がなされました。これに
     より、かつて扱えていたよりも遥かに広い種類の呼び出し可能 (callable)
     を扱うようになりました (訳注: 例えば *note open(): 318. などは
     Python 3.3 までは扱えなかった)。Python 3.4 系列の経過のなかで、追加
     で組み込みや拡張モジュールの callable がシグニチャのメタデータを持
     つことが期待されています。 ‘inspect.getfullargspec()’ が非 Python
     callable で失敗することを前提としたコードは、適宜調整の必要があるか
     もしれません。

   * *note importlib.machinery.PathFinder: 1228. は *note
     sys.path_hooks: 1229. 内のオブジェクトに、空文字列の場合は現在作業
     ディレクトリを渡すようになりました。結果の *note
     sys.path_importer_cache: 7fa. が決して ‘''’ を含まないことになるの
     で、 *note sys.path: 3e2. に基いて ‘sys.path_importer_cache’ を巡回
     しても全てのキーを見つけられません。インタプリタを ‘-m’ で起動した
     場合も含め、現在作業ディレクトリ内でインポートされた際のモジュール
     の ‘__file__’ も絶対パスで持つようになりました (ただしスクリプトが
     コマンドラインから相対パスを使って直接実行された際の
     ‘__main__.__file__’ を除きます (Contributed by Brett Cannon in
     bpo-18416(6)))。 (bpo-18416(7))

   * *note HTTPConnection: d39. と *note HTTPSConnection: d3a. から
     'strict' 引数が削除されたことは、残りの引数をキーワード引数としてで
     はなく位置引数として使っていたなら意味が変わってしまいます。非推奨
     警告に注意を払ってきたのであれば、あなたのコードは既に全てのオプシ
     ョナル引数をキーワードで渡しているはずです。

   * ‘from __future__ import ...’ ステートメントの間に文字列が含まれる場
     合に '常に' *note SyntaxError: 18f. となるようになりました。以前は
     モジュールの docstring が先頭にある場合とない場合で振る舞いが違って
     いて、ない場合にこのエラーが意図せず無視される場合がありました。こ
     の修正は CPython を言語仕様に準拠させるものです。Jython と PyPy で
     は既にこれが行われています。 (bpo-17434(8))

   * *note ssl.SSLSocket.getpeercert(): 11be. と *note
     ssl.SSLSocket.do_handshake(): 1071. は、 ‘SSLSocket’ が未接続時に以
     前は *note AttributeError: 5f0. を投げていましたが、 ‘ENOTCONN’ を
     持った *note OSError: 2c2. を投げるように改められました。加えて
     ‘getpeercert()’ はハンドシェイクが未実施の場合に *note ValueError:
     2ee. を投げるようになりました。

   * *note base64.b32decode(): 122a. が入力文字列が非 b32 文字を含む場合
     に *note TypeError: 199. ではなく *note binascii.Error: 122b. を投
     げるようになりました。今回のこの ‘TypeError’ はほか (訳注: if the
     input is incorrectly padded のとき) の ‘TypeError’ が置き換えられた
     際に置き換え忘れられたものでした。 (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: 2ee. を投げるようになりました。
     (bpo-9177(10))

   * *note slice.indices(): 122c. が巨大な値で *note OverflowError: a85.
     を起こすことはなくなりました。この修正からの流れで
     ‘slice.indices()’ は負の値に対して *note ValueError: 2ee. を投げる
     ようになっています。以前はこれは馬鹿げた値を返していました。
     (bpo-14794(11))

   * 特殊メソッド ‘__complex__’ が複素数ではなく *note float: 197. を返
     す実装をしているオブジェクトを渡すと *note cmath: 19. 関数ではエラ
     ーとなり、 *note complex: 198. コンストラクタでは受け容れられていま
     したが、これはいずれも *note TypeError: 199. となるように改められま
     した。(bpo-16290(12).)

   * 3.2 と 3.3 での *note int: 19c. コンストラクタが 'base' パラメータ
     として誤って *note float: 197. を許容してしまっていました。それをわ
     ざわざやっているとも思えないですが、そうしていたなら今後は *note
     TypeError: 199. になります。 (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__: 122d.  (Contributed by
     Yury Selivanov in bpo-20625(16).)

   * *note hashlib.hash.name: 114d. が識別子を常に小文字で返すようになり
     ました。以前はいくつかの組み込みハッシュが大文字名を持っていました
     が、公式インターフェイスであることから、命名に一貫性を持たせるよう
     にしました。 (bpo-18532(17))

   * Because *note unittest.TestSuite: ff9. now drops references to
     tests after they are run, test harnesses that reuse a *note
     TestSuite: ff9. 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: 10d. is designed to provide.  However, if the lack of
     isolation is considered acceptable, the old behavior can be
     restored by creating a ‘TestSuite’ subclass that defines a
     ‘_removeTestAtIndex’ method that does nothing (see *note
     TestSuite.__iter__(): 122e.) (bpo-11798(18)).

   * *note unittest: 10d. がコマンドライン解析に *note argparse: 7. を使
     うようになりました。このことで、以前は動作していた不当なコマンド形
     式で許されなくなったものがあります。理屈から言えばこれは後方互換性
     の問題ではないはずです。許されなくなったコマンド形式は意味をなして
     いなかったものですから、使われていたとは思えません。

   * The *note re.split(): 5a2, *note re.findall(): 122f, and *note
     re.sub(): 5a3. functions, and the *note group(): 1230. and *note
     groups(): 1231. methods of ‘match’ objects now always return a
     'bytes' object when the string to be matched is a *note bytes-like
     object: 194.  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: a7b. の新規引数 'convert_charrefs' は現在は後方互
     換性維持のために ‘False’ をデフォルトとしていますが、最終的には
     ‘True’ がデフォルトになります。あなたのコードでは ‘HTMLParser’ の全
     ての呼び出しでこれをキーワード引数として明示することをお勧めします
     。 (bpo-13633(20))

   * *note hmac.new(): c9a. 関数の 'digestmod' 引数からデフォルト値が消
     える予定です。ので、 ‘hmac.new()’ 呼び出しは常に 'digestmod' を明示
     するように修正すべきです。 (bpo-17276(21))

   * *note sysconfig.get_config_var(): 175. にキー ‘SO’ を渡すことと
     *note sysconfig.get_config_vars(): 29a. の呼び出し結果から ‘SO’ キ
     ーを探すことは非推奨です。このキーは文脈依存の ‘EXT_SUFFIX’ または
     ‘SHLIB_SUFFIX’ で置き換えられるべきです。 (bpo-19555(22))

   * ‘open’ 系関数にモード ‘U’ を使っていたコードは修正すべきです。 ‘U’
     は Python 3 では無力であり、いずれはこれの使用は例外を投げるように
     なる予定です。使う関数に依存しますが、 'newline' 引数を使うか、ある
     いは必要であればストリームを *note TextIOWrapper: 9c2. でラップして
     その 'newline' 引数を使うことで、その古い Python 2 の振る舞いと同等
     なものを実現出来ます。 (bpo-15204(23))

   * スクリプト内から ‘pyvenv’ を使っていて、pip がインストール 'されな
     い' ことを望むならば、コマンド呼び出しに ‘--without-pip’ を追加しな
     ければなりません。

   * indent を明示した場合の *note json.dump(): f44. と *note
     json.dumps(): f45. のデフォルトの振る舞いが変更されました。要素を区
     切るカンマが行末に来る場合の後ろに、空白を追加しなくなりました。こ
     れはその出力のテストを空白に繊細な比較をすることで行っている場合に
     だけ問題になります。 (bpo-16333(24))

   * *note doctest: 3e. が拡張モジュールの ‘__doc__’ 文字列から doctest
     を見つけるようになったので、doctest のテストディスカバリが拡張モジ
     ュールを含んでいてその中で doctest のようにみえるものが含まれている
     と、テスト実行時にこれまで見かけたことのないテスト失敗を目にするか
     もしれません。 (bpo-3158(25))

   * *note collections.abc: 1f. モジュールが、Python スタートアップの改
     善の一環で少々リファクタリングが行われました。これの結果として
     *note collections: 1e. は自動で ‘collections.abc’ をインポートしな
     くなりました。もしもこの (文書化されていなかった) 暗黙でのインポー
     トに依存していたのであれば、 ‘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(): 1233,
     *note PyObject_Repr(): 1234, *note PyObject_Str(): 1235. に、現在ア
     クティブな例外を黙殺する状況で使われていないことを確かにするための
     デバッグアサーションが仕込まれました。アクティブな例外を捨てること
     が期待されて望ましいケース (たとえば、既にローカルに *note
     PyErr_Fetch(): 426. で保存済みであるとか、異なる例外に置き換えるこ
     とが意図である場合) は、アサーション有効でコンパイルされている
     Python バージョンで実行して、(直接的・間接的によらず) それら操作呼
     び出しがそのアサーションを発行するのを、明示的に *note
     PyErr_Clear(): 1236. 呼び出しをすることで潰してください。

   * *note PyErr_SetImportError(): f3d. が 'msg' がセットされていない場
     合に *note TypeError: 199. をセットするようになりました。以前は例外
     をセットすることなく ‘NULL’ を返すだけでした。

   * *note PyOS_ReadlineFunctionPointer: 7a5. コールバックは、エラー時に
     ‘NULL’ を返すか *note PyMem_RawMalloc(): 631. または *note
     PyMem_RawRealloc(): 633. でアロケートした文字列を返さなければなりま
     せん。 *note PyMem_Malloc(): e63. や *note PyMem_Realloc(): 1237. で
     アロケートした文字列はダメです。 (bpo-16742(1))

   * *note PyThread_set_key_value(): 439. が必ず値をセットするようになり
     ました。Python 3.3 ではこの関数はキーが既存 (で現在値が ‘NULL’ ポイ
     ンタでない) の場合には何もしませんでした。

   * *note PyFrameObject: 990. 構造体のフィールド ‘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: 112. や *note xmlrpc.client: 135. が、サーバをプラットフ
ォームが持つ信頼ストアにある 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 ジェネレータの委譲: 123f.  のための新しい ‘yield from’ 式

   * *note str: 16a. オブジェクト向けの ‘u'unicode'’ 文法の再適用

新たなライブラリモジュール:

   * *note faulthandler: 5c. (低水準のクラッシュのデバッグを補助する)

   * *note ipaddress: 84. (IPアドレスとマスクを表す高水準オブジェクト)

   * *note lzma: 8e. (XZ / LZMA アルゴリズムを使用したデータ圧縮)

   * *note unittest.mock: 10e. (テスト向けにシステムの一部をモックオブジ
     ェクトで置き換える)

   * *note venv: 118. (人気の ‘virtualenv’ パッケージのような、Python
     *note virtual environments: 1240.)

新たな組み込み機能:

   * *note I/O 例外階層: 1241. の手直し

実装の改善:

   * *note インポート機構: 1242. を、 *note importlib: 7b. を元に書き換
     え

   * よりコンパクトな *note ユニコード文字列: 1243.

   * よりコンパクトな *note 属性辞書: 1244.

ライブラリモジュールの大幅な改善:

   * *note decimal: 1245. モジュールのCによる高速化

   * *note email: 1246. モジュールでのより良いユニコード処理 (*note
     暫定版: 1247.)

セキュリティの改善:

   * ハッシュのランダム化がデフォルトで有効になりました。

以降はユーザ向けの変更の包括的なリストになっています。


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: 118. モジュールと、
コマンドラインからのアクセスと管理向けの ‘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): 124c. 参照)。これはコンシューマの要求型をチェックします。多
くの新機能が追加されており、これらのほとんどが不連続配列とサブオフセット
を持つ配列に完全な一般化をもたらすものです。

*note ドキュメント: 262. が更新され、エキスポータ(提供側)とコンシューマ
(利用側)両方についての責務をより明確に詳細化しています。 *note
バッファ要求のフラグ: 124d. が、基本フラグと組合せフラグでグループ分けさ
れています。不連続配列と多次元の 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 書式指定文字: 124f. を
     サポートするようになりました ('@' プレフィクスが付いていても良いで
     す)。 (訳注: *note format: 1250. 参照。)

   * いくつかの制限はありますが、 *note cast(): 1251. メソッドでフォーマ
     ット変更と C-*note contiguous: 1252. 配列の形状 (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 次元: 1254. は公式に 64 に制限されています。

   * 空の *note shape: 1255, 空の *note strides: 1256, 空の *note
     suboffsets: 1257. を表現するのに以前は ‘None’ を用いていましたが今
     ではこれは空のタプルです。

   * フォーマット 'B' (unsigned bytes) での memoryview 要素へのアクセス
     は整数を返すようになりました (struct モジュールでの構文に従っていま
     す)。bytes オブジェクトが欲しければまずビューを 'c' で *note
     cast(): 1251. しなければなりません。

   * memoryview どうしの比較は被演算対象の論理構造を使って行うようになり
     、また、全ての配列要素は値で比較されます。struct モジュールの構文の
     全てのフォーマット文字でサポートされます。認識出来ないフォーマット
     文字でのビューは今でも許されていますが、ビューの指す中身によらずこ
     れは常に等しくないとされます。

   * ほかの変更については、 *note ビルドならびに C API の変更: 1258. と
     *note C コードの移植: 1259. を参照してください。

(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: 125c. の値は今やいつでも ‘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: 1260.

   ---------- 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: 2c2, *note IOError: 1262, *note
EnvironmentError: 1263, *note WindowsError: 1264, ‘mmap.error’, *note
socket.error: 1265. or *note select.error: 1266.  All these exception
types are now only one: ‘OSError’.  The other names are kept as aliases
for compatibility reasons.

また、特定のエラー条件を捕捉するのが容易になりました。 ‘errno’ 属性 (ま
たは ‘args[0]’) の特定の定数を *note errno: 5b. モジュールから調べる代わ
りに、適切な *note OSError: 2c2. 派生クラスを捕捉することが出来ます。 利
用可能な派生クラスは以下の通りです:

   * *note BlockingIOError: 237.

   * *note ChildProcessError: 1267.

   * *note ConnectionError: 100f.

   * *note FileExistsError: 1225.

   * *note FileNotFoundError: 266.

   * *note InterruptedError: f8c.

   * *note IsADirectoryError: 1268.

   * *note NotADirectoryError: 1269.

   * *note PermissionError: f42.

   * *note ProcessLookupError: 126a.

   * *note TimeoutError: a3a.

*note ConnectionError: 100f. 自身には細かな派生クラスがあります:

   * *note BrokenPipeError: 126b.

   * *note ConnectionAbortedError: 126c.

   * *note ConnectionRefusedError: 126d.

   * *note ConnectionResetError: 126e.

新たな例外のおかげで *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 ジェネレータ: 1270.
に、その操作の一部をほかのジェネレータに委譲するための式です。これによっ
て *note yield: bc6. を含んでいるコードのセクションをほかのジェネレータ
に移動出来るでしょう。加えてサブジェネレータは値を伴って戻ることが出来、
その戻り値は委譲した側のジェネレータで使えます。

‘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(): 1271. されたり *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__: 1275.
attribute representing the "path" from the module top-level to their
definition.  For global functions and classes, this is the same as *note
__name__: 1276.  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(): 231. は、Python 呼び出し
可能オブジェクト (callable) を調べることを簡単で直接的なものにしてくれま
す。幅広い callable をサポートしています:デコレートされているかどうかに
よらず関数、クラス、 *note functools.partial(): 219. オブジェクト。新た
に追加されたクラス群 *note inspect.Signature: 4e3, *note
inspect.Parameter: 4e4, *note inspect.BoundArguments: 1279. は、アノテー
ション、デフォルト値、パラメータの種類、束縛されている引数などのような呼
び出しシグニチャについての情報を保持し、これによって、デコレータを書いた
りあるいは呼び出しシグニチャや引数を検証したり改訂したりするコードを書く
ことが、非常に単純になります。

参考
....

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:
184. のようなマッピングベースの名前空間とは対照的に、 ‘SimpleNamespace’
は *note object: c82. のような属性ベースです。ですが ‘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__(): ad5. 関数を *note importlib.__import__(): 127d. によ
って実現するようにしました。これは PEP 302(5) の「第二段階」を完了させる
ものです。この変更には複数の恩恵があります。まず最初にこれはインポートの
機構を、C コードの奥深くで暗黙に秘密裏に行うのではなく、より透明化します
。このことで、Python 3.3 をサポートする全ての Python VM で単一の実装を用
いることが出来るようになり、インポートのセマンティクスにおける VM 固有の
逸脱と決別する助けともなります。そしてこれはインポート機構の保守をより容
易とし、将来起こりうる進化を促します。

一般のユーザにとっては、セマンティクスにおいて目に見える変化はないはずで
す。今時点でインポートを操作したりインポート呼び出しをプログラム的に行っ
ている場合は、このドキュメントの *note Python コードの移植: 127e. でカバ
ーしているコードの修正が必要になるかもしれません。

* 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: 1280.
and *note path entry finders: 1281. by introducing *note
importlib.abc.MetaPathFinder: a72. and *note
importlib.abc.PathEntryFinder: a73, 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: 1282. 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:
1229.

ローダ (loader) については、新規の抽象基底クラス *note
importlib.abc.FileLoader: 1283. が、モジュールのコードを格納する機構とし
てのファイルシステムを使うローダを書く助けとなります。ソースファイルのロ
ーダ (*note importlib.machinery.SourceFileLoader: 1284.)、ソースを持たな
いバイトコードのためのローダ (*note
importlib.machinery.SourcelessFileLoader: 1285.)、そして拡張モジュールの
ためのローダ (*note importlib.machinery.ExtensionFileLoader: eb2.) が今
では直接的に利用出来ます。

*note ImportError: 65b. には属性 ‘name’ と ‘path’ が追加されて、これには
提供すべき関連データがある場合にセットされます。インポート失敗時のメッセ
ージも、これまでのようにモジュール名の末尾だけを与えるのではなく、モジュ
ールの完全名を提供するようになりました。

The *note importlib.invalidate_caches(): e0e. 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
コードの移植: 127e. セクションを参照してください。

*note importlib: 7b. によって公開されるものが拡がったことによる、インポ
ートについてのほかの目に見える変化があります。最大の変化は *note
sys.meta_path: f2b. と *note sys.path_hooks: 1229. が、インポートで使わ
れる 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: 1229.  Since
‘imp.NullImporter’ is not directly exposed on ‘sys.path_hooks’ 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 コードの移植: 127e. セクションを読むべきです。

(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(): 1288. and ‘'\N{...}'’ now resolve name
     aliases, and ‘unicodedata.lookup()’ resolves named sequences too.

     (Contributed by Ezio Melotti in bpo-12753(1).)

   * Unicode データベースを UCD バージョン 6.1.0 にアップグレードしまし
     た。

   * *note range(): b41. オブジェクトどうしの等値性比較が、それぞれの
     range オブジェクトによって生成されるシーケンスの等値性を反映して行
     われるようになりました (bpo-13201(2))。

   * *note bytes: 193. と *note bytearray: 342. オブジェクトのメソッド
     ‘count()’, ‘find()’, ‘rfind()’, ‘index()’, ‘rindex()’ が、第一引数
     に 0 から 255 の整数を受け付けるようになりました。

     (Contributed by Petri Lehtinen in bpo-12170(3).)

   * *note bytes: 193. と *note bytearray: 342. オブジェクトのメソッド
     ‘rjust()’, ‘ljust()’, ‘center()’ が、 ‘fill’ 引数として ‘bytearray’
     を受け付けるようになりました (Contributed by Petri Lehtinen in
     bpo-12380(4).)。

   * New methods have been added to *note list: 24f. and *note
     bytearray: 342.: ‘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(): 1289. が与えられたキーのルックアップを一度
     しか行わないようになったので、組み込み型でのこれの使用はアトミック
     になります。(訳注: 外部観察可能な変化で説明すると、以前はこの呼び出
     しが、キーの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 細粒度のインポートロック
--------------------------------

Previous versions of CPython have always relied on a global import lock.
This led to unexpected annoyances, such as deadlocks when importing a
module would trigger code execution in a different thread as a
side-effect.  Clumsy workarounds were sometimes employed, such as the
*note PyImport_ImportModuleNoBlock(): 3d9. C API function.

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(): 318. 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: 128c. for example.  The ‘'x'’ mode
     was added: open for exclusive creation, failing if the file already
     exists.

   * *note print(): 117b.: 'flush' キーワード引数が追加されました。
     'flush' キーワード引数が真の場合ストリームは強制的にフラッシュされ
     ます。

   * *note hash(): 801.: ハッシュのランダム化がデフォルトで有効になりま
     した。 *note object.__hash__(): cf7. と環境変数 *note
     PYTHONHASHSEED: 128d. を参照してください。

   * *note str: 16a. 型に *note casefold(): fda. メソッドが追加されまし
     た。文字列の 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(): 211. to install fault handlers for the *note
SIGSEGV: 1290, *note SIGFPE: 1291, *note SIGABRT: 1292, *note SIGBUS:
1293, and *note SIGILL: 1294. signals.  You can also enable them at
startup by setting the *note PYTHONFAULTHANDLER: 1295. environment
variable or by using *note -X: 170. ‘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<8>.
* 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: 129a. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 129b. に *note property: 4b3. を渡して
     使ってください。

   * *note abc.abstractclassmethod: 129c. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 129b. に *note classmethod: 48e. を渡し
     て使ってください。

   * *note abc.abstractstaticmethod: 129d. は非推奨となりました。代わり
     に *note abc.abstractmethod(): 129b. に *note staticmethod: 451. を
     渡して使ってください。

(Contributed by Darren Dale in bpo-11610(1).)

*note abc.ABCMeta.register(): 129e. が登録されたサブクラスを返すようにな
りました。つまりクラスデコレータとして使うことができるようになったという
ことです (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(): 12a3. 関数: bzip2 で圧縮されたファイルをバ
     イナリかテキストモードで開きます。

   * *note bz2.BZ2File: a6a. が、コンストラクタの 'fileobj' 引数で、任意
     のファイル様オブジェクトの読み書きが出来るようになりました。

     (Contributed by Nadeem Vawda in bpo-5863(1).)

   * *note bz2.BZ2File: a6a. と *note bz2.decompress(): 12a4. が
     (‘pbzip2’ ツールで生成されたような) マルチストリームの入力を展開出
     来るようになりました。同時に ‘bz2.BZ2File’ は、 ‘'a'’ (追記) モード
     を使ってこのタイプの圧縮ファイルを作るのに使えるようになりました。

     (Contributed by Nir Aides in bpo-1625(2).)

   * *note bz2.BZ2File: a6a. now implements all of the *note
     io.BufferedIOBase: 8a4. 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’ を正しく処理するように書き換えられました。 ‘mbcs’
コーデックは以前は、エンコードでは ‘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: e1a. は、複数のマッピングをひとま
とまりに扱えるようにします。 (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: 12a7. クラスが、単項 ‘+’ 演算子、単項 ‘-’ 演算子、インプ
レイス演算子の ‘+=’, ‘-=’, ‘|=’, ‘&=’ をサポートするようになりました。
(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: d22. が今後は確かな基礎を提供
します。かつての (非推奨となり削除された) ‘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: 12ab. クラスに属性 *note
     curses.window.encoding: 12ac. が追加されました。

   * *note curses.window: 12ab. クラスに *note get_wch(): 12ad. メソッド
     が追加されました。これはワイド文字を一つ取得します。

   * *note curses: 2f. モジュールに関数 *note unget_wch(): 12ae. が追加
     されました。これはワイド文字をプッシュし、次に *note get_wch():
     12ad. を呼び出した時にその値が返るようにします。

(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 な ‘datetime’ イ
     ンスタンスの等価比較で、 *note TypeError: 199. を投げずに *note
     False: d2f. を返すようになりました。 (bpo-15006(1)).

   * 新規メソッド *note datetime.datetime.timestamp(): 12b0.: *note
     datetime: 4e2. インスタンスに対応する POSIX タイムスタンプを返しま
     す。

   * *note datetime.datetime.strftime(): e92. メソッドが 1000 年よりも前
     の書式化をサポートしました。(--訳注: What's New in Python 3.2 での
     変更も参照してみてください。--)

   * *note datetime.datetime.astimezone(): bc8. メソッドを引数なしで呼び
     出せるようになりました。これは 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: 12b3. *note シグナル: 12b4. により、float と
     Decimal の混合の厳密なセマンティクスを有効に出来ます。(--訳注: 使用
     例が *note Quick-start tutorial: 12b5. にあります。--)

   * 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: 12b6. 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: 12b8.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MAX_EMAX: 12b9.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MIN_EMIN: 12ba.            ‘-425000000’         ‘-999999999999999999’
                                                                

   * In the context templates (*note DefaultContext: 12bb, *note
     BasicContext: 12bc. and *note ExtendedContext: 12bd.) the magnitude
     of *note Emax: 12be. and *note Emin: 12bf. has changed to ‘999999’.

   * decimal.py の *note Decimal: 200. コンストラクタは上記のコンテキス
     ト制限に無知で、任意の指数や精度で正確に変換しようとします。C 版は
     内部の制限を持っていますので、次の規則が使われます: 可能ならば値は
     正確に変換され、そうでない場合 *note InvalidOperation: 12c0. が送出
     されて結果が NaN となります。後者のケースは丸めあるいは不正確な値を
     得るために *note create_decimal(): 12c1. を使うことでいつでも可能で
     す。(--訳注: わかりにくい表現ですがコンテキストで 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(): 12c2. and *note ln(): 12c3. functions, but the final
     result is only "almost always correctly rounded".

   * C 版ではシグナルを含む辞書は *note MutableMapping: 12c4. です。速度
     的な理由により *note flags: 12c5. と *note traps: 12c6. はコンテキ
     ストが初期化された時点での ‘MutableMapping’ を参照し続けます。新た
     なシグナル辞書を ‘flags’ に ‘traps’ 割り当てれば新しい値で更新はさ
     れるものの、コンテキストはそれら右辺の辞書を参照しません。

   * *note Context: 12c7. を pickle 化するとこれまでとは異なる出力をしま
     す。これは Python 版と C 版で共通の交換フォーマットを実現するためで
     す。

   * *note Context: 12c7. コンストタクタの引数順が *note repr(): 1c3. で
     の表示順に合うように改められました。

   * *note quantize(): 12c8. メソッドの ‘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: 12cb. は、 email パッケージがどのように振舞うのかを制御す
るための多数のメソッドとプロパティを持つオブジェクトです。Python 3.3 の
ための最初のポリシーは *note Compat32: 12cc. で、これは Python 3.2 の
email パッケージとの後方互換性を提供します。 ‘policy’ は、 *note parser:
52. によって email メッセージが解析される際、あるいは *note Message:
581. オブジェクトを生成する際、あるいは *note generator: 44. を用いて
email がシリアライズする際に指定出来ます。オーバライドしない限りは、
‘parser’ に渡されたポリシーは全ての ‘Message’ オブジェクトと ‘parser’ が
生成したサブオブジェクトに引き継がれます。デフォルトでは ‘generator’ は
、シリアライズしようとする ‘Message’ オブジェクトのポリシーを使います。
デフォルトのポリシーは *note compat32: e9b. です。

すべての ‘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(): 12cd. メソッドを使って作られます。 ‘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 暫定ポリシー: 1247. としてリリース
しました。コア開発者が必要と判断すれば、後方互換性を破壊する (コードの破
棄さえも含む) 変更が起こりえます。

その新規ポリシーは *note EmailPolicy: 12cf. のインスタンス (訳注: *note
email.policy.default: 12d0. や *note email.policy.SMTP: 12d1. など) です
。これには以下の制御が追加されています:

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(): 12d2. 関数や
*note make_header(): 12d3. 関数を取り扱う必要性を取り除いてくれています
。

アドレスを部品から組み立てることも出来ます:

     >>> 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: 12d5. が *note parser: 52. モジュールに追加され
ました。これは *note HeaderParser: 12d6. を補足するものであり、また、
bytes API を完全にする (訳注: What's New in Python 3.2 での email の変更
内容参照) ものです。

新しいユーティリティ関数:

   * *note format_datetime(): 12d7.: *note datetime: 4e2. を与えると
     email ヘッダで使われる書式でフォーマットした文字列を生成します。

   * *note parsedate_to_datetime(): 12d8.: email ヘッダからの日付文字列
     を渡すと、 aware な、または naive な *note datetime: 4e2. に変換し
     ます。オフセットが ‘-0000’ の場合に naive で返します。

   * *note localtime(): 2f9.: 引数なしで呼び出すと、ローカル *note
     timezone: 12d9. を使った aware な *note datetime: 4e2. として現在ロ
     ーカル時間を返します。aware な ‘datetime’ を渡して呼び出すと、ロー
     カル ‘timezone’ を使った aware な ‘datetime’ に変換します。


File: python.info,  Node: ftplib<3>,  Next: functools<7>,  Prev: email<6>,  Up: 改良されたモジュール<11>

1.12.20.19 ftplib
.................

   * *note ftplib.FTP: afa. に新しいキーワード引数 ‘source_address’ が追
     加されました。 ‘(host, port)’ の形で指定し、これは外に向かうソケッ
     トを作成する際に *note bind(): 12db. 呼び出し内でのソースアドレスと
     して用いられます。 (Contributed by Giampaolo Rodolà in
     bpo-8594(1).)

   * *note FTP_TLS: afb. クラスに、制御チャネルを平文に戻すための *note
     ccc(): 12dc. 関数が追加されました。これは、固定ポートで開くことなく
     非セキュア FTP で NAT を処理する方法を知っているファイアウォールを
     利用するのに有用となりえます。(Contributed by Giampaolo Rodolà in
     bpo-12139(2).)

   * 新規メソッド *note ftplib.FTP.mlsd(): 12dd. は機械で読めるディレク
     トリリスティングのフォーマットを提供し、 *note ftplib.FTP.nlst():
     12de. と *note ftplib.FTP.dir(): 12df. に取って代わるものとなりまし
     た。(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<8>,  Prev: ftplib<3>,  Up: 改良されたモジュール<11>

1.12.20.20 functools
....................

*note functools.lru_cache(): be6. デコレータにキーワード引数 ‘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<8>,  Next: hmac<5>,  Prev: functools<7>,  Up: 改良されたモジュール<11>

1.12.20.21 gc
.............

ガーベージコレクタが回収前後に呼び出すコールバックを登録出来るようになり
ました。新規属性 *note callbacks: 12e2. リストに登録します。


File: python.info,  Node: hmac<5>,  Next: http<5>,  Prev: gc<8>,  Up: 改良されたモジュール<11>

1.12.20.22 hmac
...............

タイミング解析によるダイジェストに対する サイドチャンネル攻撃(1) からの
防御のために、 *note compare_digest(): 12e4. 関数が追加されました。
(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: 12e6. がヘッダをバッファするよ
うになり、 *note end_headers(): 12e7. 呼び出し時に一度に全てをまとめて書
き出すようになりました。新規のメソッド *note flush_headers(): 12e8. は、
集積したヘッダを送信する場合の管理に直接使うことが出来ます。(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: 12e9. にメソッド *note readinto(): 12ea.
が追加されました。つまりこのクラスを *note io.RawIOBase: 12eb. のように
扱えるということです。 (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: a7b. 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: 12ed. 辞書が追加されました (例:
‘html5['gt;'] == '>'’)。この辞書は既に *note HTMLParser: a7b. が使ってい
ます。 (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: b04. コンストラクタが 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(): 12f0. 関数が追加されました。この関数は、指定した
関数の関数本体から参照されている現在束縛されている全ての名前と、それら名
前が解決された場所 (訳注: globals, builtins など) を報告します。これによ
り、ステートフルなクロージャに依存するコードをテストするのに、正しい内部
状態を検証するのが容易になります。

(Contributed by Meador Inge and Nick Coghlan in bpo-13062(1).)

*note getgeneratorlocals(): 12f1. 関数が追加されました。この関数は、指定
したジェネレータのスタックフレーム内のローカル変数の、現在束縛されている
ものを報告します。これにより、ジェネレータをテストするのに、正しい内部状
態を検証するのが容易になります。

(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: 1225. を送
出します。 C11 fopen() の 'x' モードに基づいています。

(Contributed by David Townshend in bpo-12760(1).)

The constructor of the *note TextIOWrapper: 9c2. 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
‘TextIOWrapper’ 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(): bf4. がユーザ提供二項関数を渡すためのオプショナル引
数 ‘func’ を受け付けるようになりました。


File: python.info,  Node: logging<7>,  Next: math<10>,  Prev: itertools<7>,  Up: 改良されたモジュール<11>

1.12.20.29 logging
..................

*note basicConfig(): bf7. 関数がオプショナルな ‘handlers’ 引数をサポート
するようになりました。これはルートロガーに追加するハンドラ群の *note
イテラブル: 12f5. です。

A class level attribute ‘append_nul’ has been added to *note
SysLogHandler: 86d. 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(): 12f7. が追加されま
した。'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(): 12f9. メソッドの他のファイルライクなオブジェクトとの互換性
が増しました。引数が省略されるか ‘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(): 12fb. が追加されました。こ
れは複数の (接続やソケット、パイプのような) オブジェクトをタイムアウト付
きでポーリングします。(Contributed by Richard Oudkerk in bpo-12328(1).)

*note multiprocessing.connection.Connection: 12fc. objects can now be
transferred over multiprocessing connections.  (Contributed by Richard
Oudkerk in bpo-4892(2).)

*note multiprocessing.Process: 254. がキーワード引数 ‘daemon’ を取るよう
になりました。これは親プロセスから ‘daemon’ フラグを継承するデフォルトの
振る舞いをオーバライドします (bpo-6064(3))。

属性 *note multiprocessing.Process.sentinel: 12fd. が追加されました。こ
れを用いることで、ふさわしい OS プリミティブ (例えば POSIX システムでの
*note select: c6.) を使った一括での複数 *note Process: 254. オブジェクト
待ちが可能です。

*note map(): 1a0. と *note itertools.starmap(): 12fe. との関係と同じ、既
存の *note multiprocessing.pool.Pool.map(): 12ff. と *note map_async():
1300. に対応する *note multiprocessing.pool.Pool.starmap(): 1301. と
*note starmap_async(): 1302. が追加されました。 (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: 1265. 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(): 1305. function
     that makes it possible to create a pipe with *note O_CLOEXEC: 128c.
     or *note O_NONBLOCK: 103f. flags set atomically.  This is
     especially useful to avoid race conditions in multi-threaded
     programs.

   * *note os: a5. モジュールに *note sendfile(): d09. 関数が追加されま
     した。これはあるファイル (またはソケット) 記述子からのコピーを、効
     率的な「ゼロコピー」で行います。「ゼロコピー」という言い回しは、こ
     れは二つの記述子間でのデータのコピー全てが完全にカーネルによって行
     われる、という事実について指しています。データコピーにユーザ空間の
     バッファは使われません。 ‘sendfile()’ は例えばファイルのダウンロー
     ドのような、ディスク上のファイルとネットワークソケット間での効率的
     なデータコピーに使うことが出来ます。

     (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(): d56. は
          *note walk(): 6d0. と似ていますが、これは訪問するディレクトリ
          を指すファイル記述子も yield します。これは特にシンボリックリ
          ンクの競合を避けるために有用です。

        - The following functions get new optional 'dir_fd' (*note paths
          relative to directory descriptors: 1306.) and/or
          'follow_symlinks' (*note not following symlinks: 1307.): *note
          access(): 1308, *note chflags(): 1309, *note chmod(): 529,
          *note chown(): 130a, *note link(): 130b, *note lstat(): 6c8,
          *note mkdir(): 52b, *note mkfifo(): f94, *note mknod(): f95,
          *note open(): f96, *note readlink(): b1e, *note remove():
          130c, *note rename(): 130d, *note replace(): 130e, *note
          rmdir(): 130f, *note stat(): 26f, *note symlink(): 1310, *note
          unlink(): 1311, *note utime(): 1312.  Platform support for
          using these parameters can be checked via the sets *note
          os.supports_dir_fd: 1313. and *note
          os.supports_follow_symlinks: 1314.

        - 関数 *note chdir(): 821, *note chmod(): 529, *note chown():
          130a, *note execve(): 1315, *note listdir(): 1316, *note
          pathconf(): 1317, *note exists(): c07, *note stat(): 26f,
          *note statvfs(): 1318, *note utime(): 1312. が、パス引数として
          ファイル記述子をサポートするようになりました。これをプラットフ
          ォームがサポートするかどうかは *note os.supports_fd: 1319. を
          調べることでわかります。

   * *note access(): 1308. がキーワード引数 ‘effective_ids’ を受け取るよ
     うになりました。これは実 uid/gid の代わりに実効 uid/gid を使ってア
     クセスチェックを行うように振る舞いを変更します。これをプラットフォ
     ームがサポートするかどうかは *note supports_effective_ids: 131a. を
     調べることでわかります。

   * *note os: a5. モジュールに 2 つの関数が追加されました。 *note
     getpriority(): 131b. と *note setpriority(): 131c. です。これらはプ
     ロセスのナイス値/優先度 (niceness/priority) を *note os.nice():
     131d. と似た方法で取得・設定しますが、現在プロセスだけのものだけで
     はなく全てのプロセスに対して使えるよう拡張されています。

     (Patch submitted by Giampaolo Rodolà in bpo-10784(5).)

   * 新規関数 *note os.replace(): 130e. は変更先の上書きにおいてクロスプ
     ラットフォームな方法でファイル名変更を行えます。既存の *note
     os.rename(): 130d. では、変更先が既存のファイルの場合に POSIX では
     上書き、Windows ではエラーとなります。(Contributed by Antoine
     Pitrou in bpo-8828(6).)

   * stat 系関数 (*note stat(): 26f, *note fstat(): f90, *note lstat():
     6c8.) がファイルのタイムスタンプのナノ秒精度を読み取れるようになり
     ました。これと対となる *note utime(): 1312. もファイルのタイムスタ
     ンプをナノ秒精度で書き出せるようになりました。 (Contributed by
     Larry Hastings in bpo-14127(7).)

   * 新規関数 *note os.get_terminal_size(): 131e. はファイル記述子が接続
     しているターミナルウィンドウのサイズを取得します。 *note
     shutil.get_terminal_size(): 131f. も参照して下さい。 (Contributed
     by Zbigniew Jędrzejewski-Szmek in bpo-13609(8).)

   * Linux 拡張属性をサポートするための新たな関数 (bpo-12720(9)): *note
     getxattr(): 1320, *note listxattr(): 1321, *note removexattr():
     1322, *note setxattr(): 1323.

   * スケジューラに対する新たなインターフェイス。これら関数はプロセスに
     対する OS による CPU 時間割り当てを制御します。新規関数: *note
     sched_get_priority_max(): 1324, *note sched_get_priority_min():
     1325, *note sched_getaffinity(): 1326, *note sched_getparam():
     1327, *note sched_getscheduler(): 1328, *note
     sched_rr_get_interval(): 1329, *note sched_setaffinity(): 132a,
     *note sched_setparam(): 132b, *note sched_setscheduler(): 132c,
     *note sched_yield(): 132d,

   * ファイルシステムを制御する新たな関数:

        * *note posix_fadvise(): f97.: データへアクセスする意思を、パタ
          ーンを指定して宣言します。これによりカーネルが最適化を行えるよ
          うになります。

        * *note posix_fallocate(): f98.: ファイルを割り当てるに十分なデ
          ィスクスペースを確保します。

        * *note sync(): 132e.: ディスクへの全ての書き込みを強制します。

   * 追加された新たな POSIX 関数:

        * *note lockf(): 132f.: オープンされたファイル記述子に対して、
          POSIX ロックの適用、テスト、解除を行います。

        * *note pread(): d5a.: ファイル記述子の指定オフセット位置から読
          み込みます。ファイルオフセットは変化しません。

        * *note pwrite(): d5d.: ファイル記述子に対し、指定オフセット位置
          から書き出します。ファイルオフセットは変化しません。

        * *note readv(): d59.: ファイル記述子からデータを読みこんで複数
          の書き込み可能なバッファに書き込みます。

        * *note truncate(): 1040.: 'path' に対応するファイルを、サイズが
          最大で 'length' バイトになるよう切り詰めます。

        * *note waitid(): f9d.: 一つ以上の子プロセスの完了を待ちます。

        * *note writev(): d5c.: 'buffers' の内容をファイル記述子へ書き出
          します。 'buffer' は任意のバッファのシーケンスです。

        * *note getgrouplist(): 1330. (bpo-9344(10)): 指定したユーザが属
          するグループ ID のリストを返します。

   * *note times(): 1331. および *note uname(): 1332.: 戻り値の型がタプ
     ルから属性名のついたタプルライクオブジェクトに変更されました。

   * いくつかのプラットフォームにおいて、 *note lseek(): 1333. 関数で使
     う追加の定数をサポートするようになりました。 ‘os.SEEK_HOLE’ や
     ‘os.SEEK_DATA’ などです。

   * New constants *note RTLD_LAZY: 1334, *note RTLD_NOW: 1335, *note
     RTLD_GLOBAL: 1336, *note RTLD_LOCAL: 1337, *note RTLD_NODELETE:
     1338, *note RTLD_NOLOAD: 1339, and *note RTLD_DEEPBIND: 133a. are
     available on platforms that support them.  These are for use with
     the *note sys.setdlopenflags(): 133b. 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(): 1310. がキーワード引数
     ‘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: c17. オブジェクトに pickler ごとのリダクション関数
を設定する、オプショナルな *note dispatch_table: 133e. 属性が追加されま
した。

(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: 16a. 正規表現が ‘\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(): 1342. が 'blocking' パラメータを取るようになりました。
     これを偽にセットすると、このメソッドは既に実行予定時間になっている
     イベント (もしあれば) を実行してすぐに戻ります。 これは *note
     scheduler: 1343. を非ブロッキングなアプリケーションで使いたい場合に
     有用です。 (Contributed by Giampaolo Rodolà in bpo-13449(1).)  (--訳
     注: 原文の表現がわかりにくいですが、これは ‘blocking=False’ 時はス
     ケジュールされた時間になっているタスクがあれば通常は 'delayfunc' を
     呼び出すところをそうせずに、一番早く次の予定時間に達するタスクの予
     定時間までの時間差を返します。--)

   * *note scheduler: 1343. クラスをマルチスレッド環境で安全に使えるよう
     になりました。 (Contributed by Josiah Carlson and Giampaolo Rodolà
     in bpo-8684(2).)

   * *note scheduler: 1343. クラスのコンストラクタでのパラメータ
     'timefunc' と 'delayfunc' が省略可能になりました。それぞれデフォル
     トで順に *note time.time(): 55d, *note time.sleep(): 8ad. が使われ
     ます。 (Contributed by Chris Clark in bpo-13245(3).)

   * *note enter(): 1344. と *note enterabs(): 1345. の 'argument' パラ
     メータが省略可能になりました。 (Contributed by Chris Clark in
     bpo-13245(4).)

   * *note enter(): 1344. と *note enterabs(): 1345. が '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: 119c. が追加されました。これはハイパフォーマンスな非同期
ソケットを ‘/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(): 1349.: ディスクの利用状況について、トータ
          ル、使用中、空きの容量を返します。 (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(): 131f.: インタプリタが接続し
          ているターミナルウィンドウのサイズを取得します。 (Contributed
          by Zbigniew Jędrzejewski-Szmek in bpo-13609(3).)

   * *note copy2(): c54. と *note copystat(): 134a. がファイルのタイムス
     タンプを、それをサポートするプラットフォームではナノ秒精度も維持す
     るようになりました。また、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():
     c55. がシンボリックリンクを POSIX の ‘move’ コマンドが行うのと同じ
     やり方で扱うようになりました。つまりターゲットのファイルの中身をコ
     ピーするのではなくシンボリックリンクを再作成します。(Contributed by
     Jonathan Niehof in bpo-9993(7).)  また、 ‘move()’ は ‘dst’ 引数を戻
     り値として返すようになりました。

   * *note os.open(): f96. と *note os.unlink(): 1311. が新パラメータ
     ‘dir_fd’ をサポートしているプラットフォームでは、 *note rmtree():
     354. は今では シンボリックリンク攻撃に耐性を持ちます。 (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(): 134c.: これを呼び出すスレッドにセット
          されているシグナルマスクを取り出したり変更したりします
          (Contributed by Jean-Paul Calderone in bpo-8407(1));

        * *note pthread_kill(): 134d.: スレッドにシグナルを送ります;

        * *note sigpending(): 134e.: 保留中のシグナルを調べます;

        * *note sigwait(): 134f.: シグナルを待ちます;

        * *note sigwaitinfo(): faf.: シグナルを待ちますが、それについて
          の詳細情報を返します;

        * *note sigtimedwait(): fae.: *note sigwaitinfo(): faf. と似てい
          ますがタイムアウト指定できます。

   * シグナルハンドラは wakeup ファイル記述子に以前は ‘\0’ を書き込んで
     いましたが、シグナル番号を 1 バイト整数として書き込むようにしました
     。これにより、一つ以上のシグナルを待った上でどのシグナルが発生した
     のかあとから調べるといったことが出来ます。

   * *note signal.signal(): 1350. と *note signal.siginterrupt(): 1351.
     は RuntimeError ではなく *note OSError: 2c2. を投げるようになりまし
     た: 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: b2b, *note SMTP_SSL: b2c, *note LMTP: b2d. に新しいキ
ーワード引数 ‘source_address’ が追加されました。 ‘(host, port)’ の形で指
定し、これは外に向かうソケットを作成する際に *note bind(): 12db. 呼び出
し内でのソースアドレスとして用いられます。(Contributed by Paulo Scardine
in bpo-11281(1).)

*note SMTP: b2b. がコンテキスト管理プロトコルをサポートするようになった
ので ‘SMTP’ のインスタンスを ‘with’ 文で使えます。 (Contributed by
Giampaolo Rodolà in bpo-11289(2).)

*note SMTP_SSL: b2c. コンストラクタと *note starttls(): 1354. メソッドが
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: fa5. クラスが、前提となるプラットフォームがサポートし
     ていれば従属的なデータを処理する追加のメソッドを公開しました:

        * *note sendmsg(): 6a1.

        * *note recvmsg(): faa.

        * *note recvmsg_into(): 1356.

     (Contributed by David Watson in bpo-6560(1), based on an earlier
     patch by Heiko Wundram)

   * *note socket: fa5. クラスが 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: fa5. 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: fa5. クラスが OS X で ‘PF_SYSTEM’ プロトコルファミリ
     をサポートするようになりました。 (Contributed by Michael Goderbauer
     in bpo-13777(4).)

   * New function *note sethostname(): 1357. 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: 1359. がオーバライド可能な *note service_actions():
135a. メソッドを持つようになり、これは *note serve_forever(): 135b. によ
りサービスループ内で呼び出されます。 *note ForkingMixIn: d75. がこれをゾ
ンビ化した子プロセスのクリーンアップに使っています。 (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(): 135e. メソッドと *note set_ecdh_curve():
     135f. メソッドを通じてサポートされるようになりました。(Contributed
     by Antoine Pitrou in bpo-13626(4) and bpo-13627(5).)

   * SSL ソケットに新規メソッド *note get_channel_binding(): 1360. が追
     加されました。これは 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(): 1361. method.  The new
     attribute *note OP_NO_COMPRESSION: 1362. can be used to disable
     compression.  (Contributed by Antoine Pitrou in bpo-13634(8).)

   * *note ssl.SSLContext.set_npn_protocols(): 356. による Next Protocol
     Negotiation 拡張のサポートが追加されました。 (Contributed by Colin
     Marc in bpo-14204(9).)

   * 属性 *note library: 1363. と *note reason: 1364. が追加されたので、
     SSL のエラーは以前よりもっと簡単に調べることが出来るようになりまし
     た。(Contributed by Antoine Pitrou in bpo-14837(10).)

   * *note get_server_certificate(): a41. 関数が IPv6 をサポートするよう
     になりました。 (Contributed by Charles-François Natali in
     bpo-11811(11).)

   * New attribute *note OP_CIPHER_SERVER_PREFERENCE: 1365. 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(): 1367. に移動されました。これはファイルモードを
'-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: 136a. 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: 136c. が追加さ
れました。 (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: 8a3.'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: 1371, *note threading.Semaphore: 1372, *note
threading.BoundedSemaphore: 1373, *note threading.Event: 1374, *note
threading.Timer: 1375. がクラスになったので、サブクラス化出来るようにな
りました。 (Contributed by Éric Araujo in bpo-10968(1).)

*note threading.Thread: 177. コンストラクタがキーワード引数 ‘daemon’ を
取るようになりました。これは親スレッドから ‘daemon’ フラグを継承するデフ
ォルトの振る舞いをオーバライドします (bpo-6064(2))。

かつての非公開関数 ‘_thread.get_ident’ が公開関数 *note
threading.get_ident(): 1376. として利用可能となっています。これは標準ラ
イブラリにおいて多数の ‘_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(): 1378.: クロックの情報を取得します。

   * *note monotonic(): 55c.: 単調なクロック (逆行しない)、システムクロ
     ックの更新の影響を受けません。

   * *note perf_counter(): c7e.: 短期間の計測のために利用可能な最高の解
     像度を持つパフォーマンスカウンタです。

   * *note process_time(): c7f.: 現在のプロセスの system と user CPU 時
     間の和です。

その他の新たな関数:

   * *note clock_getres(): 1379, *note clock_gettime(): 137a. and *note
     clock_settime(): 137b. functions with ‘CLOCK_XXX’ constants.
     (Contributed by Victor Stinner in bpo-10278(2).)

クロスプラットフォーム間での一貫性を改善するために、 *note sleep(): 8ad.
が負の値を渡すと *note ValueError: 2ee. を投げるように変更されています。
以前から 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(): 137d. と *note types.prepare_class():
137e. は 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(): 1380, *note assertWarnsRegex(): 1381. が、コンテキ
ストマネージャとして使われる際にキーワード引数 'msg' を受け付けるように
なりました。 (Contributed by Ezio Melotti and Winston Ewert in
bpo-10775(1).)

*note unittest.TestCase.run(): 1382. が *note TestResult: 1383. オブジェ
クトを返すようになりました。

   ---------- 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: 11de. クラスが *note get_method(): 1385. で使われる
'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: 11c. モジュールがさらに多くの "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: 12c. 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: 361. 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: 1389. 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: 138a. 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(): 138c.

   * PEP 393(2) により追加された新たな Unicode 型、マクロ、関数:

        * 高水準 API:

             * *note PyUnicode_CopyCharacters(): ab6.

             * *note PyUnicode_FindChar(): aba.

             * *note PyUnicode_GetLength(): ab4, *note
               PyUnicode_GET_LENGTH: ab5.

             * *note PyUnicode_New(): aad.

             * *note PyUnicode_Substring(): ab7.

             * *note PyUnicode_ReadChar(): 138d, *note
               PyUnicode_WriteChar(): 138e.

        * 低水準 API:

             * 型 *note Py_UCS1: 138f, *note Py_UCS2: 1390, *note
               Py_UCS4: 33b.

             * 構造体 *note PyASCIIObject: 1391. と *note
               PyCompactUnicodeObject: 1392.

             * *note PyUnicode_READY: 432.

             * *note PyUnicode_FromKindAndData(): 1393.

             * *note PyUnicode_AsUCS4(): 1394, *note
               PyUnicode_AsUCS4Copy(): abc.

             * *note PyUnicode_DATA: 1395, *note PyUnicode_1BYTE_DATA:
               1396, *note PyUnicode_2BYTE_DATA: 1397, *note
               PyUnicode_4BYTE_DATA: 1398.

             * *note PyUnicode_KIND: 1399. with ‘PyUnicode_Kind’ enum:
               ‘PyUnicode_WCHAR_KIND’, *note PyUnicode_1BYTE_KIND: 139a,
               *note PyUnicode_2BYTE_KIND: 139b, *note
               PyUnicode_4BYTE_KIND: 139c.

             * *note PyUnicode_READ: 139d, *note PyUnicode_READ_CHAR:
               139e, *note PyUnicode_WRITE: 139f.

             * *note PyUnicode_MAX_CHAR_VALUE: 13a0.

   * *note PyArg_ParseTuple: 3bf. が ‘c’ フォーマットとして *note
     bytearray: 342. を許容するようになりました (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: 199.
     となります (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(): 12de. および *note ftplib.FTP.dir():
     12df.: *note ftplib.FTP.mlsd(): 12dd. を使ってください

   * ‘platform.popen()’: use the *note subprocess: dc. module.  Check
     especially the *note Replacing Older Functions with the subprocess
     Module: 13a4. 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(): c7e. or *note time.process_time():
     c7f. 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: 129a. は非推奨となりました。代わり
          に *note abc.abstractmethod(): 129b. に *note property: 4b3. を
          渡して使ってください。

        * *note abc.abstractclassmethod: 129c. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 129b. に *note classmethod:
          48e. を渡して使ってください。

        * *note abc.abstractstaticmethod: 129d. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 129b. に *note
          staticmethod: 451. を渡して使ってください。

   * *note importlib: 7b. パッケージ:

        * バイトコードファイルとしての *note
          importlib.abc.SourceLoader.path_stats(): 13a5. によりコンパイ
          ル時点の修正時刻とソースファイルサイズの両方を格納するようにな
          ったので、 *note importlib.abc.SourceLoader.path_mtime():
          13a6. は非推奨となりました。

   ---------- 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: 3de. は非推奨になり、Python 4 で削除され
ます。この型を使用している全ての関数は非推奨です。

Unicode functions and methods using *note Py_UNICODE: 3de. and *note
Py_UNICODE: 3de.* types:

   * ‘PyUnicode_FromUnicode’: use *note PyUnicode_FromWideChar(): 13a8.
     or *note PyUnicode_FromKindAndData(): 1393.

   * ‘PyUnicode_AS_UNICODE’, ‘PyUnicode_AsUnicode()’,
     ‘PyUnicode_AsUnicodeAndSize()’: use *note
     PyUnicode_AsWideCharString(): abd.

   * ‘PyUnicode_AS_DATA’: use *note PyUnicode_DATA: 1395. with *note
     PyUnicode_READ: 139d. and *note PyUnicode_WRITE: 139f.

   * ‘PyUnicode_GET_SIZE’, ‘PyUnicode_GetSize()’: use *note
     PyUnicode_GET_LENGTH: ab5. or *note PyUnicode_GetLength(): ab4.

   * ‘PyUnicode_GET_DATA_SIZE’: use ‘PyUnicode_GET_LENGTH(str) *
     PyUnicode_KIND(str)’ (only work on ready strings)

   * ‘PyUnicode_AsUnicodeCopy()’: use *note PyUnicode_AsUCS4Copy(): abc.
     or *note PyUnicode_AsWideCharString(): abd.

   * ‘PyUnicode_GetMax()’

Py_UNICODE* 文字列を操作する関数ならびにマクロ:

   * ‘Py_UNICODE_strlen()’: use *note PyUnicode_GetLength(): ab4. or
     *note PyUnicode_GET_LENGTH: ab5.

   * ‘Py_UNICODE_strcat()’: use *note PyUnicode_CopyCharacters(): ab6.
     or *note PyUnicode_FromFormat(): 62b.

   * ‘Py_UNICODE_strcpy()’, ‘Py_UNICODE_strncpy()’, ‘Py_UNICODE_COPY()’:
     use *note PyUnicode_CopyCharacters(): ab6. or *note
     PyUnicode_Substring(): ab7.

   * ‘Py_UNICODE_strcmp()’: use *note PyUnicode_Compare(): ab8.

   * ‘Py_UNICODE_strncmp()’: use *note PyUnicode_Tailmatch(): ab9.

   * ‘Py_UNICODE_strchr()’, ‘Py_UNICODE_strrchr()’: use *note
     PyUnicode_FindChar(): aba.

   * ‘Py_UNICODE_FILL()’: use *note PyUnicode_Fill(): 13a9.

   * ‘Py_UNICODE_MATCH’

エンコーダ:

   * ‘PyUnicode_Encode()’: use ‘PyUnicode_AsEncodedObject()’

   * ‘PyUnicode_EncodeUTF7()’

   * ‘PyUnicode_EncodeUTF8()’: use *note PyUnicode_AsUTF8(): 422. or
     *note PyUnicode_AsUTF8String(): 13aa.

   * ‘PyUnicode_EncodeUTF32()’

   * ‘PyUnicode_EncodeUTF16()’

   * ‘PyUnicode_EncodeUnicodeEscape()’ use *note
     PyUnicode_AsUnicodeEscapeString(): 13ab.

   * ‘PyUnicode_EncodeRawUnicodeEscape()’ use *note
     PyUnicode_AsRawUnicodeEscapeString(): 13ac.

   * ‘PyUnicode_EncodeLatin1()’: use *note PyUnicode_AsLatin1String():
     13ad.

   * ‘PyUnicode_EncodeASCII()’: use *note PyUnicode_AsASCIIString():
     13ae.

   * ‘PyUnicode_EncodeCharmap()’

   * ‘PyUnicode_TranslateCharmap()’

   * ‘PyUnicode_EncodeMBCS()’: use *note PyUnicode_AsMBCSString(): 13af.
     or *note PyUnicode_EncodeCodePage(): 13b0. (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: 3de.) 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: 128d. を ‘0’ にセットして下さ
     い。 *note object.__hash__(): cf7. メソッドも参照して下さい。

   * bpo-12326(1): Linux では、 *note sys.platform: 293. はもはやメジャ
     ーバージョン番号を含みません。 これは今では常に '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: 2ee. ではな
     く *note OverflowError: a85. を送出するようになりました。また、C 関
     数の ‘gmtime()’ あるいは ‘localtime()’ が失敗した場合には *note
     OSError: 2c2. を送出するようになりました。

   * インポートで使われるデフォルトのファインダが、特定のディレクトリに
     何が含まれるのかについてのキャッシュを利用するようになっています。
     実行中に Python ソースファイルやバイトコードファイルを作ったら、キ
     ャッシュをクリアしてファインダが新しく作られたファイルに気付けるよ
     うに、 *note importlib.invalidate_caches(): e0e. を呼ぶ必要があるこ
     とに注意してください。

   * *note ImportError: 65b. がインポートを試みたモジュール名として完全
     名を使うようになっています。ImportError のメッセージをチェックする
     doctest は、モジュール名をその末尾の名前ではなく完全な名前を使うよ
     うに更新する必要があります。

   * *note __import__(): ad5. の引数 'index' のデフォルトが -1 ではなく
     0 となり、また、もはや負の値はサポートされません。デフォルト値が -1
     で残されたのは(訳注: つまり絶対、相対インポートの両方を試みるように
     したのは) PEP 328(4) を実装した際の過失でした。絶対インポートに先立
     って相対インポートを実行する振る舞いがまだ必要なのであれば、index を
     1 にして相対インポートを実行して、その後で index 0 のインポートをす
     るようにしてください。そうなのですが、 ‘__import__()’ を直接呼び出
     すのではなく、 *note importlib.import_module(): 73c. を使うことが望
     ましいやり方です。

   * *note __import__(): ad5. の index に、トップレベルモジュールに対し
     て 0 でなく 1 を与えることは今では許されません。例えば
     ‘__import__('sys', level=1)’ はエラーです。

   * Because *note sys.meta_path: f2b. and *note sys.path_hooks: 1229.
     now have finders on them by default, you will most likely want to
     use *note list.insert(): 13b4. instead of *note list.append(): 8dd.
     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
     ‘sys.path_importer_cache’ 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: 1281.

   * *note pkgutil: ae. は、内部的に *note importlib: 7b. を使うように変
     更されました。このことは、 PEP 302(5) インポートエミュレーションの
     古い振る舞いが本物のインポートシステムの振る舞いに合わせるのに失敗
     していた数多くの特殊ケースの問題を取り除きます。インポートエミュレ
     ーションそのものはまだ存在しますが、今では非推奨です。 *note
     pkgutil.iter_importers(): 13b5. 関数と *note
     pkgutil.walk_packages(): dfd. 関数は標準インポートフックを特別に扱
     うので、ファインダの ‘iter_modules()’ メソッドは標準ではないにも関
     わらず、まだサポートされます。

   * *note email.header.decode_header(): 12d2. によってなされる解析に長
     い間存在していた 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(): 13b6. は非 ASCII の display name に
     対し正しい content transfer encoding の扱いをするようになっています
     。かつての、フォーマット後文字列内に非 ASCII Unicode を維持してしま
     う誤った振る舞いに依存するすべてのコードは、変更の必要があります。
     (bpo-1690608(7))

   * *note poplib.POP3.quit(): 13b7. メソッドもほかの全ての ‘poplib’ の
     メソッドと同じく、今ではプロトコルエラーを送出し得ます。 ‘quit’ が
     *note poplib.error_proto: 13b8. エラーを送出しないことをあてにして
     いたコードは、 ‘quit’ でのエラーが特定のアプリケーションにとって問
     題となるようであれば、修正の必要があるかもしれません
     (bpo-11291(8))。

   * Python 2.4 から非推奨となっていた、 *note email.parser.Parser:
     13b9. への ‘strict’ 引数はついに削除されました。

   * 非推奨となっていたメソッド ‘unittest.TestCase.assertSameElements’ は
     削除されました。

   * 非推奨となっていた変数 ‘time.accept2dyear’ は削除されました。

   * 非推奨となっていた ‘Context._clamp’ 属性が *note decimal: 3a. モジ
     ュールから削除されました。以前に既にこれは公開属性 *note clamp:
     13ba. に置き換えられていました (bpo-8540(9) 参照)。

   * 文書化されていなかった内部ヘルパクラス ‘SSLFakeFile’ が *note
     smtplib: cf. モジュールより削除されました。この機能はずっと以前から
     *note socket.socket.makefile(): 13bb. によって直接的に提供されてい
     ます。

   * Windows では *note time.sleep(): 8ad. に負値を与えた場合に無限に眠
     っていましたが、今ではこれは例外を送出します。POSIX ではこれは以前
     より常に例外です。

   * The ‘ast.__version__’ constant has been removed.  If you need to
     make decisions affected by the AST version, use *note
     sys.version_info: 8b0. 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: 960. structure has been
     removed and the layout of the ‘PyMemoryViewObject’ has changed.

     ‘memoryobject.h’ あるいは ‘object.h’ での関係する部分に依存する全て
     の拡張は、再ビルドが必要です。

   * *note PEP 393: 1243. により、 *note Py_UNICODE: 3de. 型とこの型を使
     う全ての関数は非推奨となりました (ただし最低 5 年は利用可能なまま保
     たれます)。Unicode オブジェクトの構築とアクセスに低水準 Unicode API
     をこれまで使っていて、 PEP 393(1) によって提供されるメモリフットプ
     リント削減の恩恵を受けたければ、新しい *note Unicode API: 13bc. に
     乗り換える必要があります。

     一方で *note PyUnicode_Concat(): 13bd. 、 *note PyUnicode_Join():
     13be. あるいは *note PyUnicode_FromFormat(): 62b. といった高水準関
     数のみを使ってきたのであれば、あなたのコードは自動的に新しい
     Unicode 表現に便乗できます。

   * *note PyImport_GetMagicNumber(): 13bf. は失敗時に ‘-1’ を返すように
     なりました。

   * *note __import__(): ad5. の 'level' 引数に負値を渡すことはもはや有
     効ではないので、対応する *note PyImport_ImportModuleLevel(): 13c0.
     でも同じです。このことは *note PyImport_ImportModuleEx(): 13c1. に
     使われる '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: 13c4. スイッチ付きで ‘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: 13ca. に *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(): 13cc. が追加されました。これはロギングの設
定を通常の 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: 13ce. オブジェクトで表現され、これはスレッド、プロセス、遠
隔手続呼び出しの共通的な側面を抽象化しています。そのオブジェクトはステー
タスのチェック (実行中あるいは完了かどうか)、タイムアウト、キャンセル、
コールバックの追加、そして結果や例外へのアクセスをサポートします。

この新モジュールで提供される最も基本となるのが、呼び出しの実行と管理のた
めの 2 つの executor クラスです。これら executor の目標は、これまでにも
あった道具立てでの並列呼び出しを、もっと簡単にすることです。リソースプー
ルをお膳立てしたり呼び出しを実行したり、結果のキューを作ったり、あるいは
タイムアウトのハンドラを追加したり、スレッドやプロセスや遠隔手続呼び出し
の総数を制限したり、といったことを、これらを使えば、その労力を小さく出来
ます。

理想的にはそれぞれのアプリケーションは、プロセスとスレッドの制限が確実に
管理されるように、複数コンポーネントをまたがって単一の executor を共有す
べきです。そうしておけば、個々のコンポーネントがリソース管理についての競
合する戦略を持つ場合に起こる設計の難題は解決出来ます。

どちらの executor クラスとも 3 つのメソッドを持つ共通インターフェイスを
持ちます。 *note submit(): c79. メソッドは呼び出し可能オブジェクトをスケ
ジュールし、 *note Future: 13ce. オブジェクトを返します。 *note map():
1de. メソッドは一気に複数の非同期呼び出しをスケジュールします。 *note
shutdown(): aee. メソッドはリソースを解放します。これらクラスは *note
context manager: 1e3. なので *note with: 187. 文とともに使うことが出来、
現時点で保留中の future が実行を終えた際にリソースが自動的に解放されるこ
とを保障出来ます。

以下はファイルコピーを行う 4 つの並列スレッドを実行する、 *note
ThreadPoolExecutor: 94d. の単純な使用例です:

     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 の例: 13cf. はスレッド並列でウェブページを取得
する実例コードです。

*note ProcessPoolExecutor: 1d8. の実例を *note
並列で素数計算するコード例: 13d0. として挙げています。

   ---------- 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__: 323. 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: 13d2. 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: 16a. 型で便利に文
字列処理出来るようにすることが挑戦でした。

この PEP では、リクエスト/レスポンスヘッダとメタデータに使われるいわゆる
'ネイティブ文字列(native strings)' と、リクエストとレスポンスのボディに
使われる 'バイト列文字列(byte strings)' を区別します。

The 'native strings' are always of type *note str: 16a. 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: 11f. module has a
new function, *note wsgiref.handlers.read_environ(): 13d5. for
transcoding CGI variables from *note os.environ: 25b. 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(): 19a. と *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(): fdb. method that
     extends the capabilities of the existing *note str.format(): 833.
     method by accepting arbitrary *note mapping: 13d7. objects.  This
     new method makes it possible to use string formatting with any of
     Python's many dictionary-like objects such as *note defaultdict:
     13d8, *note Shelf: 11a1, *note ConfigParser: 4de, or *note dbm: 35.
     It is also useful with custom *note dict: 184. subclasses that
     normalize keys before look-up or that supply a *note __missing__():
     13d9. 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: 89d. 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(): dce. and detecting whether an exception is raised.  This
     technique allows it to detect methods created dynamically by *note
     __getattr__(): 6fa. or *note __getattribute__(): dcf. 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(): 16a. は *note repr():
     1c3. 表現と同じになりました。以前は ‘str()’ 形式のほうが短い表現に
     なっていましたがこれは単に困惑させるものでした。 ‘repr()’ がデフォ
     ルトで可能ななかでの一番短い表現をするようになったので、 ‘str()’ が
     あえて短い表現を取ろうとする必要性がなくなりました。

          >>> import math
          >>> repr(math.pi)
          '3.141592653589793'
          >>> str(math.pi)
          '3.141592653589793'

     (Proposed and implemented by Mark Dickinson; bpo-9337(5).)

   * *note memoryview: 166. objects now have a *note release(): 13da.
     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: 1ac. 節の対象が消去されるこ
     とを思い出せば、 Python 2.6 では動き、Python 3.1 では *note
     SyntaxError: 18f. を送出するこのコードは再び動きます:

          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: 13db. are now subclasses of tuple.
     This means that C structures like those returned by *note
     os.stat(): 26f, *note time.gmtime(): 13dc, and *note
     sys.version_info: 8b0. 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: da7. を使えば、コマンドラインで ‘-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: 119. モジュールで意味付けを変更 (訳注:
     *note 警告フィルタ: 1b2. 参照) するかコマンドラインオプションで有効
     に出来ます。

     A *note ResourceWarning: 54c. is issued at interpreter shutdown if
     the *note gc.garbage: 13dd. list isn't empty, and if *note
     gc.DEBUG_UNCOLLECTABLE: 13de. 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: 13df. が破壊される際にも発行されます。そのようなオブジ
     ェクトのデアロケータは背後の 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: b41. objects now support 'index' and 'count' methods.
     This is part of an effort to make more objects fully implement the
     *note collections.Sequence: 13e0. *note abstract base class: 13d2.
     As a result, the language will have a more uniform API. In
     addition, ‘range’ objects now support slicing and negative indices,
     even with values larger than *note sys.maxsize: 13e1.  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(): 13e2. 組み込み関数が復活しました。 こ
     の関数は ‘isinstance(x, collections.Callable)’ のように式内で *note
     抽象基底クラス: 13d2. を使用するよりも、簡潔で可読性の高い手段を提
     供します:

          >>> 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: 1e3.
を実装し、 *note with: 187. 文を使った便利で信頼出来るリソースのクリーン
アップをサポートしています。

* 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: 193. rather than *note str: 16a. 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(): 13e5, *note
     message_from_binary_file(): 13e6. 、それに新規クラス *note
     BytesFeedParser: 13e7, *note BytesParser: 13e8. が、バイナリメッセ
     ージデータをパースしてモデルオブジェクトに読み込みます。

   * bytes の入力をモデルに与えると *note get_payload(): 13e9. は、デフ
     ォルトでは '8 ビット' の ‘Content-Transfer-Encoding’ MIME ヘッダを
     もったメッセージボディをそのヘッダで指定された文字セットを使い、デ
     コードして結果文字列を返します。

   * bytes の入力をモデルに与えると *note Generator: 13ea. は、 '8 ビッ
     ト' の ‘Content-Transfer-Encoding’ MIME ヘッダをもったメッセージボ
     ディを、 '7 ビット' の ‘Content-Transfer-Encoding’ を持つものに変換
     します。

     エンコードされていない非 ASCII バイト列を持つヘッダは '未知の 8 ビ
     ット' 文字セットを使った RFC 2047(1) エンコードであると見做されます
     。

   * 新規クラス *note BytesGenerator: 13eb. は出力としてバイト列を生成し
     ます。これはモデルを構築するのに使った入力にあった非 ASCII データを
     そのままにし、 '8ビットの' ‘Content-Transfer-Encoding’ を持つメッセ
     ージボディに含めます。

   * *note smtplib: cf. モジュールの *note SMTP: b2b. クラスが *note
     sendmail(): 105d. メソッドの 'msg' 引数としてバイト列文字列を受け付
     けるようになりました。新しく追加されたメソッド *note
     send_message(): 105e. は '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: 12c. package and its
‘xml.etree.cElementTree’ counterpart have been updated to version 1.3.

有用な関数とメソッドが幾つか新たに追加されました:

   * *note xml.etree.ElementTree.fromstringlist(): 13ed.、断片のシーケン
     スから XML 文書を組み立てます

   * *note xml.etree.ElementTree.register_namespace(): 13ee.、大域名前空
     間接頭辞を登録するのに使用します

   * *note xml.etree.ElementTree.tostringlist(): 11fc.、全サブリストを含
     めた文字列表記に使用します

   * *note xml.etree.ElementTree.Element.extend(): 13ef.、ゼロ以上の要素
     のシークエンスを追加するのに使用します

   * *note xml.etree.ElementTree.Element.iterfind(): 13f0.、要素と子要素
     を検索します

   * *note xml.etree.ElementTree.Element.itertext(): 13f1.、要素と子要素
     を走るテキストイテレータを作成します

   * *note xml.etree.ElementTree.TreeBuilder.end(): 13f2.、現在の要素を
     閉じます

   * *note xml.etree.ElementTree.TreeBuilder.doctype(): c92.、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(): be6. を使うと
     、同じ結果が期待される場合の外部リソースへの問い合わせ繰り返しを防
     ぐことができます。

     たとえばデータベース問い合わせ関数をキャッシュするデコレータで修飾
     すれば、人気の検索のデータベースアクセスを省けます:

          >>> 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(): 1163. decorator now adds a
     ‘__wrapped__’ attribute pointing to the original callable function.
     This allows wrapped functions to be introspected.  It also copies
     *note __annotations__: 13f4. if defined.  And now it also
     gracefully skips over missing attributes such as *note __doc__:
     13f5. 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(): 1148. が追加さ
     れました。これは既存の等式と不等式メソッドを使って残りのメソッドを
     埋めます。

     例えば '__eq__' と '__lt__' を与えると、 *note total_ordering():
     1148. は '__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(): 13f6. 関数が追加されました。これは旧式の比
     較関数をモダンな *note key function: 100a. に変換します:

          >>> # locale-aware sort order
          >>> sorted(iterable, key=cmp_to_key(locale.strcoll))

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f7.
     を参照して下さい。

     (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():
     bf4. が新しく追加されました:

          >>> 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(): bf4. の使用例が *note examples for the random
     module: 13f9. にあります。

     (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: 12a7. クラスに 2 つの形式のインプレイス
     減算が追加されました。 saturating subtraction(1) (訳注: 結果を
     [min, max] に収める演算) を行う既存の '-=' 演算子に加え、新しく追加
     された *note subtract(): 13fb. メソッドは通常の減算を行います。前者
     は要素数に正しか持たない 多重集合(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():
     13fc. メソッド (訳注: 「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(): 13fd. と *note reverse(): 13fe. が追加されました。これでさ
     らに *note list: 24f. との置換可能性が増しました:

          >>> 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: 1400. が
追加されました。これは多重のスレッドに、それら全てが共通のバリアポイント
に到達するまで待たせます。バリアは、複数の事前条件を持ったタスクを、その
前任タスクの全てが完了するまで走らせたくない場合に有用です。

バリアは任意の数のスレッドに対して使えます。これは Rendezvous(1) を一般
化したもので、それは 2 つのスレッドに対してのみに定義されていました。

二段階の周期バリアとしての実装なので、 *note Barrier: 1400. オブジェクト
はループ内での利用に適しています。分けられた '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(): 1401. でのそれといかに似ているか気付くと思いま
す。ですがバリアポイントを通過した後に、スレッドは生き続けて (投票を集計
する (summarizing ballots) という) 仕事を続けます。

いずれかの前任タスクがハングしたり遅延したりしうるのであれば、バリアを
'timeout' 付きで作ることができます。全ての前任タスクがバリアポイントに到
達する前にタイムアウトの期間が経過すると、全ての待機スレッドは解放されて
*note BrokenBarrierError: 1402. 例外が発生します:

     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: 12d9. 型が追
     加されています。これは *note tzinfo: 7f6. インターフェイスを実装し
     、UTC からの固定オフセットとタイムゾーン名を返します。これによりタ
     イムゾーンを意識する (timezone-aware な) datetime オブジェクトを容
     易に作れます:

          >>> import datetime as dt

          >>> dt.datetime.now(dt.timezone.utc)
          datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone.utc)

          >>> dt.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: bc7. オブジェクトは今では *note float:
     197. を掛けることができ、 ‘float’ や *note int: 19c. で割ることがで
     きます。また、 ‘timedelta’ オブジェクトは別の ‘timedelta’ で割るこ
     とが出来ます。

   * *note datetime.date.strftime(): e93. メソッドにはもう 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: 1a4.  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(): 1404.
     function will accept any year that fits in a C int, while the *note
     time.mktime(): 1405. and *note time.strftime(): 1406. 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(): 1408. 関数は特殊値を確実に、かつ高速に検出する方法を提
供します。通常の数には ‘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(): 1409. 関数は小さな '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(): dd7. 関数は確率積分、すなわち 誤差関数(1) を返します。 相補
誤差関数 *note erfc(): dd8. は ‘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(): 140a. 関数は階乗を連続的に拡張したものです。詳細は ガンマ
関数(2) を参照してください。ガンマ関数は階乗に関係しているため、小さな
'x' でも大きくなります。そのため、ガンマ関数の自然対数を計算する *note
lgamma(): 140b. 関数があります。

     >>> 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(): 129c. と *note
abstractstaticmethod(): 129d. をサポートしました。

これらのツールによって特定の *note classmethod(): 48e. や *note
staticmethod(): 451. を実装する必要のある *note 抽象基底クラス: 13d2. を
定義することが出来ます。

     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: 10a8. に *note memoryview(): 166. と同様の機能を提供す
る新たなメソッド *note getbuffer(): 140e. が追加されました。 このメソッ
ドはコピーせずにデータの編集可能なビューを作成します。 バッファのランダ
ムアクセスとスライス記法のサポートはインプレースな編集に適しています:

     >>> 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: 24f. and
*note set: 185. 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(): 1410, 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 基本チュートリアル: 1412. 、 *note
上級チュートリアル: 1413. 、 *note クックブック: 1414. により増強されて
きました。ロギングについて学習するにはこれらのドキュメントが最速の方法で
す。

セットアップ関数 *note logging.basicConfig(): bf7. に 'style' 引数が追加
され、これにより異なる 3 つのタイプの文字列書式化がサポートされます。デ
フォルトは伝統的な % 書式化を使う "%" で、 *note str.format(): 833. スタ
イルの "{" 、 *note string.Template: 898. で提供されるシェルスタイルの
"$" をセット出来ます。以下の 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: 1415. directed
to *note sys.stderr: b37. 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: 1416.  The new default handler
is stored in *note logging.lastResort: 1417.

フィルタの利用は単純になりました。 *note Filter: 1418. オブジェクトを作
る代わりに、 ‘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: 141a. をサポー
トしました。 この方言は全フィールドをクォートし、行末を伝統的な Unix 形
式の ‘'\n'’ にします。 登録された方言名は ‘unix’ です。

*note csv.DictWriter: 141b. に新たなメソッド *note writeheader(): 141c.
が追加されました。 最初の列をドキュメントのフィールド名に書き出すのに使
用します:

     >>> 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: 141e. は、関数デコレータとしての任務も果たす *note
context manager: 1e3. を作るのに役立つものです。

利便性のためにこの新機能は *note contextmanager(): 141f. で使われている
ので、両方の役割をサポートするのにことさら労力は要しません。

基本的なアイディアは、コンテキストマネージャも関数デコレータも、ともに事
前アクション・事後アクションラッパーとして使うことが出来るというものです
。コンテキストマネージャは *note with: 187. 文を使ったステートメント (文
) のグループを包みますし、関数デコレータは関数に取り囲まれたステートメン
トのグループを包みます。そうです、どちらかの役割で使える事前アクションあ
るいは事後アクションラッパーを書く必要性は、しばしば起こることです。

たとえば関数やステートメントのグループをロガーで包んで、開始時刻と終了時
刻を追跡できるようにするとしばしば便利です。このタスクをこなすために関数
デコレータとコンテキストマネージャの両方を書く代わりに、 *note
contextmanager(): 141f. が単一の定義に両方の能力をもたらしてくれます:

     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(): 141f.
では、これはコンテキストマネージャとして使えるだけでした:

     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: 187. 文で使える値を返せる柔
軟性を持ちますが、関数デコレータにはそれに匹敵するものはありません。

上の例の場合は、'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: 1205, 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: 200. コンストラクタに *note float: 197. オブ
     ジェクトを直接渡せるようになりました。これにより *note
     from_float(): 1421. メソッドを使う必要はなくなりました
     (bpo-8257(2))。

   * 型違いの比較はいまでは完全にサポートされたので、 *note Decimal:
     200. オブジェクトを直接 *note float: 197. や *note
     fractions.Fraction: 215. と比較出来ます (bpo-2531(3) and
     bpo-8188(4))。

Similar changes were made to *note fractions.Fraction: 215. so that the
*note from_float(): 1422. and *note from_decimal(): 1423. 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: 13ba. 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: afa. クラスがコンテキスト管理プロトコルをサポートする
ようになりました。with ブロックを抜ける際に無条件に FTP 接続をクローズし
ます (クローズ処理で発生する *note socket.error: 1265. は無視されます)。
:

     >>> 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(): a04. のような
ほかのファイルライクなオブジェクトも自動クローズするコンテキスト管理プロ
トコルをサポートするようになっていたりします:

     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: afb. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 355. オブジェクトを渡します。これ
は 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(): 31c. ならびに *note subprocess.Popen(): 4b7. 関数が自
動的にファイル記述子を閉じる *note with: 187. 文をサポートしました。

(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: 1427, which gives the minimum number of bytes which are
guaranteed not to block when *note select.select(): fa4. 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: 8a4. *note
抽象基底クラス: 13d2. を継承しました (‘truncate()’ をのぞく)。 *note
peek(): 1429. メソッドが追加され、シーク不能なファイルオブジェクトならび
にゼロ埋めされたファイルオブジェクトをサポートしました。

また、*note gzip: 6b. モジュールにより簡便でインメモリな圧縮および解凍を
行う *note compress(): 84e. ならびに *note decompress(): 142a. 関数が追
加されました。 圧縮や解凍の前に *note bytes: 193. としてエンコードしなけ
ればならない点に注意してください:

     >>> 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:
142b. 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: 142d. クラスは今ではコンテキストマネージャとして使えます
。加えて、その *note add(): df2. メソッドに新しいオプション 'filter' が
追加されました。これはファイルをアーカイブに追加するかどうかを制御し、ま
た、ファイルのメタデータを編集するのにも使えます。

'filter' オプションは古くて柔軟性に欠ける 'exclude' パラメータを置き換え
るものであり、 'exclude' は非推奨となりました。 'filter' を指定する場合
は *note keyword argument: f12. として渡さなければなりません。ユーザ指定
の filter 関数は *note TarInfo: 142e. オブジェクトを受け取り、更新した
‘TarInfo’ オブジェクトを返すか、あるいはアーカイブから除外したければ
‘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(): e16. 関数は、悪用されやすい組み込み関数 *note
eval(): 4a3. の安全な代替品として働いてくれます。Python 3.2 はこれのサポ
ート型に *note bytes: 193. と *note set: 185. を加えました。結果サポート
する型は全部でこれらになりました: 文字列型、バイト列文字列型、数値型、タ
プル型、リスト型、辞書型、集合型、真偽値型、‘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(): e53. と
*note fsdecode(): e52. を追加しました。それぞれファイル名のエンコード、
デコードを行います:

     >>> 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: 1432. constant
will be true.

エンコードされた環境変数への直接アクセス (可能な場合) には、新規関数
*note os.getenvb(): 1433. または *note os.environb: 25c. を使ってくださ
い。これは *note os.environ: 25b. のバイト列バージョンです。

(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(): c22. 関数に新たに 2 つのオプションが追加されま
した:

   * 'ignore_dangling_symlinks': ‘symlinks=False’ とするとこの関数は、フ
     ァイルがシンボリックリンクだった場合にリンクそのものではなくそれが
     指しているファイルをコピーします。 'ignore_dangling_symlinks' を真
     にすると、そのファイルが存在しない場合のエラーを無視します。

   * 'copy_function': これはファイルをコピーするのに使われる呼び出し可能
     オブジェクトです。デフォルトでは *note shutil.copy2(): c54. が使わ
     れます。

(Contributed by Tarek Ziadé.)

これらに加え、 *note shutil: ca. モジュールは ZIP ファイル、未圧縮の tar
ファイル、gzip 圧縮の tar、 bzip 圧縮の tar のための *note archiving
operations: 1435. を新たにサポートします。また、追加のアーカイブファイル
フォーマットを登録する関数もあります (例えば 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(): a43. メソッドと
     *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(): 1214. が提供される、新しい *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(): 1439. 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(): 883. がコンテキスト管理プロトコル
     をサポートするようになりました。with ブロックを抜ける際に無条件にソ
     ケットをクローズします (クローズ処理で発生する *note socket.error:
     1265. は無視されます)。 (Contributed by Giampaolo Rodolà;
     bpo-9794(2).)  (--訳注: リファレンスもそうなのですが、「
     ‘socket.create_connection()’ が with をサポート」というのは実態とは
     違うんじゃないかと思います(この関数のユーザからは同じにみえたとして
     も)。実際には *note socket.socket: fa5. がコンテキストマネージャを
     サポートしています。 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: 355. は、プロトコル設定や証明書、秘密
     鍵やそのた色々なオプションのような、永続的 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: a3e. は安全でなく時代遅れの SSLv2 を無効にします
     。

   * 拡張はOpenSSL の全ての暗号とメッセージダイジェストアルゴリズムをロ
     ードします。SSL 証明書の中に検証できないものがある場合、"unknown
     algorithm" エラーを報告します。

   * The version of OpenSSL being used is now accessible using the
     module attributes *note ssl.OPENSSL_VERSION: 143b. (a string),
     *note ssl.OPENSSL_VERSION_INFO: 143c. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 143d. (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: d3a, *note
urllib.request.HTTPSHandler: 1440. *note urllib.request.urlopen(): 309.
はサーバ証明書を証明書認証局 (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: 1442. で出来るようになりました。

(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: d39. クラスと *note HTTPSConnection: d3a. クラスが
'source_address' パラメータを取るようになりました。これには HTTP(S) 接続
の接続元を表す (host, port) のタプルを渡します。

*note HTTPSConnection: d3a. に、証明書検証と HTTPS バーチャルホストのサ
ポートが追加されました。

接続オブジェクトの *note request(): eab. メソッドのオプショナルな 'body'
引数には、リクエストのコンテンツを与えるために *note file object: 13df.
を渡すことが出来ました。便利のためにこれに *note iterable: 12f5. も渡す
ことが出来るようになりました。ただしこの場合は明示的に ‘Content-Length’
ヘッダを加えなければなりません。この拡張されたインターフェイスは以前より
も遥かに柔軟です。

プロキシサーバ経由で HTTPS 接続を確立するために、新規メソッド *note
set_tunnel(): 1444. が追加されています。これにより 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: 2b5. class can now be instantiated without
     arguments:

          >>> from unittest import TestCase
          >>> TestCase().assertEqual(pow(2, 3), 8)

     (Contributed by Michael Foord.)

   * *note unittest: 10d. モジュールは 2 つの新メソッド *note
     assertWarns(): 1380. と *note assertWarnsRegex(): 1381. を持ちます
     。これらはテストのもとでコードによって所与の警告が発行されるかどう
     かを検証します:

          with self.assertWarns(DeprecationWarning):
              legacy_function('XYZ')

     (Contributed by Antoine Pitrou, bpo-9754(2).)

     もう一つの新メソッド *note assertCountEqual(): 1446. は 2 つのイテ
     ラブルを比較して、要素の出現回数が同じか (順序に関わらず同じ要素が
     同じ数だけ出現するかどうか) をテストします:

          def test_anagram(self):
              self.assertCountEqual('algorithm', 'logarithm')

     (Contributed by Raymond Hettinger.)

   * unittest モジュールの大事な特長は、テスト失敗時の有意義な診断を生成
     するよう腐心してくれることです。可能ならば失敗は期待値と実際の出力
     との差分と一緒に記録されます。これは失敗したテスト実行の解析に特に
     役に立ちますが、差分は時々とてつもなく大きくもなりますので、新たに
     追加した属性 *note maxDiff: 1447. に差分の最大長をセットすることで
     表示を制御できるようになりました。

   * さらにモジュールのメソッド名に数多くのクリーンアップを行いました。

     For example, *note assertRegex(): 751. is the new name for
     ‘assertRegexpMatches()’ which was misnamed because the test uses
     *note re.search(): 1448, not *note re.match(): 1449.  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(): a6f.、*note
randint(): 144b.、*note choice(): 144c.、*note shuffle(): 952. ならびに
*note sample(): 951. です。

(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: b22. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 355. オブジェクトを渡します。これ
は 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: 1450. が追加されました。一時ディレクトリの確実な後片
付けを容易に行えます:

     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(): 1452. が追加されました。これで簡単にジェネレー
     タイテレータの現在状態を識別出来ます (--訳注: generator-iterator と
     いう用語を使っている箇所は Python ドキュメント全体通して多くはない
     のですが 2.x の *note yield 文: bc6. 説明中に登場します。ジェネレー
     タと同じ意味です。なお 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(): 1455. と *note show_code(): 1133. が追加されました。ともに
、与えられた関数、メソッド、ソースコード文字列、コードオブジェクトについ
ての詳細なコードオブジェクト情報を提供します。前者はそれを文字列で返し、
後者は印字します:

     >>> 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(): 207. 関数が文字列引数を取れるようになり、これによっ
て、よくあるイディオム ‘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: 1458. が
追加されました。


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(): 145a. は全てのグローバルな site-packages デ
     ィレクトリを一覧します。

   * *note getuserbase(): 145b. は、ユーザのデータを格納できるベースディ
     レクトリを報告します。

   * *note getusersitepackages(): 145c. はユーザ固有の 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(): 145e. は 'linux-i586' や 'macosx-10.6-ppc' と
     いった値を返します。

   * *note get_python_version(): 145f. は 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(): 33e. は現在のインストールスキームに関するインス
     トールパスを含むディレクトリ名を作ります。

   * *note get_config_vars(): 29a. はプラットフォーム依存変数の辞書を返
     します。

便利なコマンドラインインターフェースもあります:

     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: 275. 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: 92e. が含まれています:

     >>> 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: 111. モジュールにな
されました。

*note urlparse(): 360. 関数が 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(): 1463. 関数は、今や *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(): 1099. 関数はさらに柔軟になり、 'query' 引数と
しては文字列とバイト列のどちらも受け付けます。文字列で渡した場合、パラメ
ータ 'safe', 'encoding', 'error' がエンコードのために *note
quote_plus(): 1464. に送られます:

     >>> urllib.parse.urlencode([
     ...      ('type', 'telenovela'),
     ...      ('name', '¿Dónde Está Elisa?')],
     ...      encoding='latin-1')
     'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'

*note ASCII エンコードバイト列の解析: 1465. に詳細に書きましたが、全ての
*note urllib.parse: 111. 関数は今では 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: 193. because various parts of a
message may have different encodings.

解決のためには任意の email メッセージをパースするために、 *note email:
3f. パッケージのバイナリサポートが利用されました (--訳注: *note
BytesGenerator: 13eb. や *note message_from_bytes(): 13e5. など)。また、
API の変更も必要となりました。

*note mailbox.Mailbox: 1467. オブジェクトの *note add(): 1468. メソッド
は、今や期待通りにバイナリ入力を受け付けます。

*note StringIO: 112e. とテキストファイルでの入力は非推奨となりました。ま
た、文字列での入力は、非 ASCII 文字が使用されていると早々に失敗します。
以前は後のほうのステップで email が処理される際にようやく失敗していまし
た。

バイナリ出力のサポートもあります。 *note get_file(): 1469. メソッドは今
ではバイナリモードのファイルを返します (これまでは不適切にテキストモード
が使われていました)。また、新しい *note get_bytes(): 146a. メソッドは、
指定した 'key' に対応するメッセージの *note bytes: 193. 表現を返します。

今でも古い API の *note get_string(): 146b. を使って非バイナリ出力は可能
ですが、そのアプローチはあまり役に立ちません。そうではなく *note
Message: 146c. オブジェクトからメッセージを抽出するか、それらをバイナリ
入力からロードするのが最善です。

(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: 108. 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: 3e2, 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: 165. 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(): b48.
     It currently defaults to 5 milliseconds.

     この実装に関するさらなる詳細は python-dev mailing-list message(1) で
     読むことが出来ます (ただしこのメッセージで言っている "priority
     requests" は含められませんでした)。

     (Contributed by Antoine Pitrou.)

   * 通常のロックと再帰的なロックが、*note acquire(): 8a8. メソッドでオ
     プションで 'timeout' 引数を受け取るようになりました。 (Contributed
     by Antoine Pitrou; bpo-7316(2).)

   * 同様に、*note threading.Semaphore.acquire(): 146f. にも '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: 185. 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(): dcc. and *note
     sorted(): dcb. now runs faster and uses less memory when called
     with a *note key function: 100a.  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(): 32c. 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(): 10ae, *note rsplit(): 1471, *note splitlines(): 1472. and
     *note replace(): 4b8. methods on *note bytes: 193, *note bytearray:
     342. and *note str: 16a. objects.  Likewise, the algorithm is also
     used by *note rfind(): 10ad, *note rindex(): 1473, ‘rsplit()’ and
     *note rpartition(): 1474.

     (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: 12e6. has more efficient buffering (bpo-3709(14)
by Andrew Schaaf).  The *note operator.attrgetter(): 1037. 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: c0c. を、エンコードできない文字に対して *note
UnicodeEncodeError: 888. を投げます。

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 組み込み関数: 1478. のような長大なセクションには先頭にクイッ
     クリンクの表が追加されました。 *note itertools: 85. のようなケース
     では cheatsheet(1) スタイルの表からリンクが張られていて、これで要約
     がわかりますし、ドキュメント全体を読む必要なく記憶を呼び覚ますこと
     が出来ます。

   * ある種のケースではピュア Python のソースコードが文書化の助手として
     便利に働いてくれますので、今では多くのモジュールがソースコードの最
     新バージョンへのクイックリンクを客演させています。例えば *note
     functools: 63. モジュールのドキュメントは先頭にこのようにクイックリ
     ンクを置いています:

          'ソースコード' Lib/functools.py(2).

     (Contributed by Raymond Hettinger; see rationale(3).)

   * ドキュメントには今ではもっと実例とレシピが含まれています。特に
     *note re: be. モジュールのものには大掛かりなセクション *note
     Regular Expression Examples: 1479. があります。同じように *note
     itertools: 85. では新しい *note Itertools レシピ: 147a. で更新され
     続けます。

   * *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(): 147e. が正しい値を返し、 *note repr(): 1c3.
     はより多くの文字を表示可能と考えるようになりました。

     (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: 147f. を使うようになりま
     した。これはポインタと同じサイズになるように定義されています。以前
     は long 型を使っていましたが、これはいくつかの 64 ビット OS でも 32
     ビット長のままでした。この修正の結果、64 ビットポインタでビルドすれ
     ば *note set: 185. と *note dict: 184. が ‘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: 1480. without also modifying
     *note sys.path: 3e2. (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(): 1481. の姉妹品の *note
     PyLong_AsLongLongAndOverflow(): 1482. 関数が追加されました。両方と
     も Python *note int: 19c. を C ネイティブの固定幅型に変換しますが、
     変換が幅に合わないことを検出します (bpo-7767(9))。

   * *note PyUnicode_CompareWithASCIIString(): 1483. 関数が、Python 文字
     列が 'NUL' 終端である場合に「 '等しくない' 」を返すようになりました
     。

   * 新しい関数 *note PyErr_NewExceptionWithDoc(): 1484. は *note
     PyErr_NewException(): 1485. と似ていますが、ドキュメンテーション文
     字列を受け付けます。これは 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(): 1487. と
          *note set(): 1488. の操作で検証されます。デフォルトの補間スキ
          ームでは、パーセント記号を使ったただ二つのトークンのみが正当で
          す: ‘%(name)s’ と ‘%%’ 、後者はエスケープされたパーセント記号
          自身。

        * *note set(): 1488. メソッドと *note add_section(): 1489. メソ
          ッドは今ではその値が実際に文字列かどうかを検証します。以前はサ
          ポートされない型が意図せず持ち込まれる可能性がありました。

        * 単一ソースからのセクションまたはオプションの複製 (重複) に対し
          、今では *note DuplicateSectionError: 148a. もしくは *note
          DuplicateOptionError: 148b. を投げます。以前は重複は黙って以前
          のエントリを上書きしていました。

        * インラインコメントは今ではデフォルトで無効なので、 ';' 文字を
          安全に値のなかで使えます。

        * コメントを字下げ出来るようになっています。このことにより、値が
          継続行となる場合の後続行の字下げ開始位置に ';' または '#' を置
          くには、補間を使う必要があります。こうすればコメントのプレフィ
          クス文字が値内に現れて誤ってコメントと解釈されるのを防げます。

        * ‘""’ は今では合法な値なので、もはや自動的に空文字列に変換され
          ることはありません。空文字列のためには行内で ‘"option ="’ と書
          いてください。

   * The ‘nntplib’ module was reworked extensively, meaning that its
     APIs are often incompatible with the 3.1 APIs.

   * *note bytearray: 342. オブジェクトはもうファイル名には使えません。
     代わりに *note bytes: 193. に変換しなければいけません。

   * The ‘array.tostring()’ and ‘array.fromstring()’ have been renamed
     to *note array.tobytes(): 148c. and *note array.frombytes(): 148d.
     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: 148e. 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(): 148f. 関数とメソッドが、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():
     1490. and *note bytearray.maketrans(): 1491.  This change solves
     the confusion around which types were supported by the *note
     string: d8. module.  Now, *note str: 16a, *note bytes: 193, and
     *note bytearray: 342. 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: 187. 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(): 1492. は、文字列パックコード ‘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: 12c. クラスが *note
     xml.etree.ElementTree.ParseError: 1493. を投げるようになりました。
     以前は *note xml.parsers.expat.ExpatError: 1494. を投げていました。

   * 浮動小数点数と複素数に対する *note str(): 16a. が以前より長い表現を
     するようになったことで、古いフォーマットに依存する doctest は壊れる
     かもしれません。

   * *note subprocess.Popen: 4b7. の 'close_fds' のデフォルトが、Unix で
     は ‘True’ になりました。Windows では 3 つの標準ストリームに ‘None’
     がセットされている場合には ‘True’ 、以外の場合は ‘False’ になりまし
     た。以前は 'close_fds' のデフォルトはいつでも ‘False’ でした。これ
     は開いているファイル記述子が子プロセスに漏れた場合に解決が難しいバ
     グや競合状態を生み出していました。

   * レガシーな HTTP 0.9 のサポートが *note urllib.request: 112. と
     *note http.client: 73. から削除されました。このサポートはサーバサイ
     ドではまだ健在です (*note http.server: 76. 内)。

     (Contributed by Antoine Pitrou, bpo-10711(5).)

   * タイムアウトモード時の SSL ソケットでタイムアウトした場合に、汎用の
     *note SSLError: 1495. ではなく *note socket.timeout: a39. を投げる
     ようになりました。

     (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: 165. implementation,
     ‘PyEval_InitThreads()’ cannot be called before *note
     Py_Initialize(): 45e. 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: f47. クラスのコンストラクタに
'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(): 19a. 関数と *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: 19c, *note float: 197, *note complex:
198. , *note decimal.Decimal: 200. です。

ドットやら空白やらアポストロフィやらあるいはアンダースコアなどの他のセパ
レータをどうやって指定するかの議論は水面下にありますが、ロケールに従う必
要があるアプリケーションは、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(): 19c. 型に ‘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(): 19a. 文字列のフィールドに自動的に番号が振られるよう
     になりました:

          >>> '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(): 1490. and *note
     bytearray.maketrans(): 1491.  This change solves the confusion
     around which types were supported by the *note string: d8. module.
     Now, *note str: 16a, *note bytes: 193, and *note bytearray: 342.
     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: 187. 文のシンタックスは一つの文で複数のコンテキストマネ
     ージャを使えるようになりました:

          >>> 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: 12a7. クラスが追加されました:

          >>> 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: 100. モジュールが追加されました。 ‘tkinter.ttk’ の基本
     的なアイディアは、拡張可能性のためにウィジェットの動作を実装するコ
     ードと見た目を記述するコードを分離することです。

     (Contributed by Guilherme Polo; bpo-2983(2).)

   * *note gzip.GzipFile: 65c. と *note bz2.BZ2File: a6a. クラスはコンテ
     キストマネジメントプロトコルをサポートするようになりました:

          >>> # 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: 197. から 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(): 149d. 関数は、置換 (順列
     , permutation) や直積 (Cartesian product) を含む組合せ論の 4 つの生
     成関数のうちの 1 つです。 *note itertools.compress(): 149e. 関数は
     APL(3) の同名機能の模倣品です。また、既存の *note
     itertools.count(): 149f. 関数は新たにオプショナルな 'step' 引数を取
     るようになり、そして数え方に *note fractions.Fraction: 215. や
     *note decimal.Decimal: 200. を含む任意の数値型を使えるようになりま
     した。

          >>> [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: 14a0. を実装しました。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: 139. (あるいはなにかほ
     かの PEP 302(7) 準拠ローダ) でロードされたモジュールのソースコード
     にアクセスでき、表示できるようになりました。

     (Contributed by Alexander Belopolsky; bpo-4201(8).)

   * *note functools.partial: 219. オブジェクトが 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: 10d. に特定のテストメソッドやテストクラス全体をスキ
     ップする仕組みのサポートが追加されました。さらに、この機能はテスト
     結果を「意図的な失敗」とすることができ、テストが失敗しても
     ‘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: 187. 文で使えるコンテキス
     トマネージャとして増強されました:

          def test_division_by_zero(self):
              with self.assertRaises(ZeroDivisionError):
                  x / 0

     In addition, several new assertion methods were added including
     *note assertSetEqual(): 14a1, *note assertDictEqual(): 14a2,
     ‘assertDictContainsSubset()’, *note assertListEqual(): 14a3, *note
     assertTupleEqual(): 14a4, *note assertSequenceEqual(): 14a5, *note
     assertRaisesRegexp(): 752, *note assertIsNone(): 14a6, and *note
     assertIsNotNone(): 14a7.

     (Contributed by Benjamin Peterson and Antoine Pitrou.)

   * The *note io: 83. module has three new constants for the *note
     seek(): 14a8. method: *note SEEK_SET: 14a9, *note SEEK_CUR: 14aa,
     and *note SEEK_END: 14ab.

   * *note sys.version_info: 8b0. タプルが名前付きタプルになりました。

          >>> 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__(): ad5. 関数の、完全で
     移植性が高いピュア 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: 16a, not with *note bytes: 193.
     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: 14af. が追加されましたが、これにより数字あた
     りのビット数と各数字の格納に使われる 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(): 14b0. 関数は負の 'pylong' に対し
     *note TypeError: 199. ではなく *note OverflowError: a85. を送出する
     ようになりました。

     (Contributed by Mark Dickinson and Lisandro Dalcrin; bpo-5175(2).)

   * ‘PyNumber_Int()’ が非推奨になりました。代わりに *note
     PyNumber_Long(): c61. を使用してください。

     (Contributed by Mark Dickinson; bpo-4910(3).)

   * 非推奨の関数 ‘PyOS_ascii_strtod()’ および ‘PyOS_ascii_atof()’ を置
     き換えるために新しく *note PyOS_string_to_double(): 14b1. 関数が追
     加されました。

     (Contributed by Mark Dickinson; bpo-5914(4).)

   * ‘PyCObject’ API を置き換えるものとして、 *note PyCapsule: 148e. が
     追加されました。主な違いとしては、新しい型は、型安全に情報を渡すた
     めの良く定義されたインターフェースを持ち、また、デストラクタの呼び
     出しのシグネチャの複雑さが小さくなっています。古い型は問題のある
     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(): 117b. 関数に置き換えられ、古い ‘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(): 117b. 関数は、古い ‘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(): 117b. 関数呼び出しに自動的に置換されるので、大きなプロジェ
     クトでもさほど問題にならないでしょう。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3105/


File: python.info,  Node: リストからビューおよびイテレータへ,  Next: 順序比較,  Prev: print関数,  Up: よくある悩みの種

1.15.1.2 リストからビューおよびイテレータへ
...........................................

いくつかの良く使われている API はもはやリストを返しません:

   * *note dict: 184. の *note dict.keys(): 9d4, *note dict.items():
     9d6. そして *note dict.values(): 9d5. メソッドはリストの代わりに
     "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(): 1a0. と *note filter(): a68. はイテレータを返します。
     もしも本物のリストが必要で、全ての入力シーケンスが同じ長さの場合で
     あれば、簡単に直すなら ‘map()’ を *note list(): 24f. で包みます。例
     えば ‘list(map(...))’ という具合。ですがより良いのは、大抵はリスト
     内包を使うことです (特に元々のコードが *note lambda: 14b9. を使って
     いる場合)。あるいはコードを、リストを全く必要としないように書き換え
     ましょう。とりわけトリッキーなのは、関数に副作用を起こさせるために
     呼び出される ‘map()’ です; この場合確実な変換は普通に *note for:
     348. ループを使うことです (そもそもリストを作ること自体が無駄遣いで
     しょう)。

     入力シーケンスの長さが同じとは限らないならば、 *note map(): 1a0. は
     最も短いシーケンスが消費されつくすと処理をやめます。Python 2.x での
     ‘map()’ 用法と全く互換にするにはシーケンスを *note
     itertools.zip_longest(): 14ba. で包んでください。例えば ‘map(func,
     *sequences)’ を ‘list(map(func,
     itertools.zip_longest(*sequences)))’ とします。

   * *note range(): b41. now behaves like ‘xrange()’ used to behave,
     except it works with values of arbitrary size.  The latter no
     longer exists.

   * *note zip(): 1a1. はイテレータを返します。


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: 199. を送出します。その結果
     、 不均一なリスト（訳注：比較不能な型からなる要素が混在するリスト）
     のソートは意味がなくなりました。 - 全ての要素は互いに比較できなけれ
     ばなりません。これは ‘==’ と ‘!=’ 演算子には適用されないことに注意
     してください: 別々の比較不可能な型のオブジェクトを比較すると常に、
     互いに等しくないと評価されます。

   * *note sorted(): dcb. and *note list.sort(): dcc. 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__(): 14bc.
     for sorting, *note __eq__(): cf6. with *note __hash__(): cf7, 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: 19c.  That
     is, there is only one built-in integral type, named ‘int’; 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: 13e1.
     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(): 1c3. はもはや末尾に ‘L’ を持ちません。そ
     のため、無条件に "L" を取り除くコードは代わりに最後の数字を取り除い
     てしまうでしょう。 (代わりに *note str(): 16a. を使用してください。
     )

   * 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: 16a. で、データには *note bytes:
     193. を使います。2.x での状況との最大の違いは、Python 3.0 でテキス
     トとデータを混ぜようとすれば *note TypeError: 199. となることです。
     Python 2.x では Unicode と 8 ビット文字列を混ぜたとすれば、8 ビット
     文字列がたまたま 7 ビット (ASCII) バイトだけから出来ていれば動くし
     非 ASCII バイトがあれば *note UnicodeDecodeError: c0c. となっていた
     でしょう。この、データ値に依存した振る舞いが、何年にも渡って夥しい
     数の悲劇を生み出していました。

   * 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: 16a. 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: 16a. 型と *note bytes: 193. 型を混ぜて使うことは出来ませ
     んから、それらはいつでも明示的に変換しなければいけません。 ‘str’ か
     ら ‘bytes’ にするには *note str.encode(): ad6. を使ってください。そ
     して ‘bytes’ から ‘str’ にするには *note bytes.decode(): ad7. を使
     います。それぞれ ‘bytes(s, encoding=...)’ 、 ‘str(b, encoding=...)’
     を使うことも出来ます。

   * Like *note str: 16a, the *note bytes: 193. type is immutable.
     There is a separate 'mutable' type to hold buffered binary data,
     *note bytearray: 342.  Nearly all APIs that accept ‘bytes’ also
     accept ‘bytearray’.  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: 16a. instead.  The ‘str’ and *note bytes: 193. 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 ‘str’.

   * テキストファイルとして開かれたファイル (これは従来どおり *note
     open(): 318. でのデフォルトのモード) は、 (メモリ内の) 文字列と (デ
     ィスクでの) バイト列との写像をするのに、常にエンコーディングを使い
     ます。バイナリファイル (モードに ‘b’ を付けて開いたもの) はメモリ内
     では常にバイト列を使います。このことで、もしもファイルが誤ったモー
     ドやエンコーディングで開かれようとすると、I/O はきっと口やかましく
     失敗します。こっそり正しくないデータを生み出すのではなく。それに加
     えて、ファイルを開く際には Unix ユーザでさえもこれからは、 (テキス
     トかバイナリかの) 正しいモードを選択する必要があるということです。
     プラットフォームにはそれ特有のデフォルトエンコーディングがあります
     。Unix 的プラットフォームではこれは環境変数 ‘LANG’ にセットされてい
     るかもしれません (あるいは時々ほかのプラットフォーム特有の、ロケー
     ルに関係した環境変数にもセットされています)。全てとは言いませんが多
     くの場合は、システムのデフォルトは UTF-8 です; ですが決してこのデフ
     ォルトを当てにすべきではありません。純粋な ASCII テキスト以上のもの
     を読み書きするどんなアプリケーションも、きっとエンコーディングをオ
     ーバライド出来る手段を持つべきです。 *note codecs: 1c. 内にあるエン
     コーディングを熟知したストリームを使うことは、今ではもう必要なくな
     りました。

   * *note sys.stdin: 75f, *note sys.stdout: cd1, *note sys.stderr: b37.
     の初期値はいまでは Unicode のみのテキストファイルです (つまりそれら
     は *note io.TextIOBase: 8a5. のインスタンスです)。バイト列データを
     それらのストリームで読み書きするには、 *note io.TextIOBase.buffer:
     14bf. 属性を使う必要があります。

   * ファイル名は、API へは (Unicode) 文字列を渡し、 (Unicode) 文字列が
     返ります。これにはプラットフォーム特有の問題があるかもしれません。
     というのも、いくつかのプラットフォームではファイル名は任意のバイト
     文字列だからです。(他方では、Windows ではファイル名はネイティブに
     Unicode で格納されています。) 次善策として、ほとんどの API (たとえ
     ば *note open(): 318. と *note os: a5. モジュール内の多くの関数) は
     ファイル名として、文字列だけでなく *note bytes: 193. を受け付け、そ
     して少しの API は ‘bytes’ を返すかどうかを要求出来る手段を持ってい
     ます。それゆえに *note os.listdir(): 1316. は引数が ‘bytes’ インス
     タンスであれば ‘bytes’ のリストで返し、 *note os.getcwdb(): c86. は
     カレントディレクトリを ‘bytes’ で返します。 ‘os.listdir()’ が文字列
     のリストで返す際、適切にデコード出来ないファイル名は *note
     UnicodeError: 460. とはせずに無視されることにご注意ください。

   * *note os.environ: 25b. や *note sys.argv: 1480. のようないくつかの
     システム API にも問題がありえます。システムにより利用可能とされるべ
     きバイト列がデフォルトエンコーディングで解釈不能な場合です。環境変
     数 ‘LANG’ をセットしてプログラムを再実行することが、おそらく最善の
     アプローチです。

   * PEP 3138(1): 文字列への *note repr(): 1c3. はもう非 ASCII 文字をエ
     スケープしません。ただし、制御文字、Unicode 標準で印字不可状態のコ
     ードポイントは今でもエスケープされます。

   * PEP 3120(2): ソースのエンコードのデフォルトが UTF-8 になりました。

   * PEP 3131(3): 非 ASCII 文字を識別子として使用することが出来るように
     なりました。 (そうはいっても標準ライブラリは、コメント内での貢献者
     の名前以外では ASCII だけのままです。)

   * ‘StringIO’ および ‘cStringIO’ モジュールは廃止されました。その代わ
     り *note io: 83. モジュールをインポートして、テキストやデータには
     *note io.StringIO: 112e. や *note io.BytesIO: 10a8. を使用してくだ
     さい。

   * *note Unicode HOWTO: 14c0. を参照してください。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__: 456. 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: 14c3. 文。 ‘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(): 14c4. が導入されました。

   * ‘b’ または ‘B’ で始まるバイトリテラルと、関連する新しい組み込み関数
     *note bytes(): 193. が導入されました。

   ---------- 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: 187. は予約語になりました。 (実際には 2.6 から)

   * ‘True’、‘False’、および ‘None’ が予約語になりました。(2.6 では既に
     ‘None’ が部分的に制限されていました)

   * Change from *note except: 1ac. '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: c82.)

   * リスト内包表記はもう ‘[... for VAR in ITEM1, ITEM2, ...]’ という構
     文形をサポートしません。代わりに ‘[... for VAR in (ITEM1, ITEM2,
     ...)]’ を使用してください。また、リスト内包表記は異なるセマンティク
     スを持つことに注意してください。リスト内包表記は *note list(): 24f.
     コンストラクタ内のジェネレータ式の糖衣構文に近く、特にループの制御
     変数はスコープ外ではもう使用することができません。

   * '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(): 1c3. を使用
     してください)。

   * ‘<>’ が削除されました (代わりに ‘!=’ を使用してください)。

   * 削除されたキーワード: *note exec(): 4a2. はキーワードでなくなりまし
     たが、関数として残りました。 (幸運にも関数のシンタックスは 2.x でも
     許容されています。) また、 ‘exec()’ はストリーム引数を受け取らなく
     なりました。‘exec(f)’ の代わりに ‘exec(f.read())’ を使うことができ
     ます。

   * ‘l’ または ‘L’ で終わる整数リテラルはサポートされません。

   * ‘u’ or ‘U’ で始まる文字列リテラルはサポートされません。(--訳注: こ
     の ‘u"..."’ は Python 3.3 で再び使えるようになりました。 --)

   * *note from: 14c7. '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: 14c9. 内の対
応するセクションにはもっと長い説明が書かれています。

   * *note PEP 343; "with" ステートメント: 14ca.  *note with: 187. 文は
     今では標準機能となったので、 *note __future__: 0. からインポートす
     る必要はもうありません。 *note コンテキストマネージャを書く: 14cb.
     と *note contextlib モジュール: 14cc. も見てください。

   * *note PEP 366; メインモジュールからの明示的相対インポート: 14cd.
     *note -m: 23e. オプションの有用性を強化します。パッケージ内にあるモ
     ジュールを参照している際に関係します。

   * *note PEP 370; ユーザごとの site-packages ディレクトリ: 14ce.

   * *note PEP 371; multiprocessing パッケージ: 14cf.

   * *note PEP 3101; 進化版文字列フォーマッティング: 14d0.  注意: 2.6 の
     記述では *note format(): 19a. メソッドが 8 ビット文字列と Unicode 文
     字列両方について述べていますが、3.0 では *note str: 16a. 型
     (Unicode サポートを持ったテキスト文字列) だけがこのメソッドをサポー
     トしています。 *note bytes: 193. 型にはありません。計画では最終的に
     はこれだけが唯一の文字列フォーマットの API になり、Python 3.1 では
     ‘%’ 演算子は非推奨扱いを開始する予定です。(-- 訳注: ‘%’ 演算子の撤
     廃は影響が大き過ぎるからか、現実には (ドキュメントでの軽い記述を除
     き) 実行時に特別に非推奨扱いされることは 3.5 になってさえもいまだあ
     りません。 --)

   * *note PEP 3105; print を関数にする: 14d1.  これはもはや標準機能とな
     ったので、 *note __future__: 0. からインポートする必要はありません
     。詳細はこのドキュメントの上の方に書いてあります。

   * *note PEP 3110; 例外処理の変更: 14d2.  The *note except: 1ac. '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; バイトリテラル: 14d3.  文字列リテラル ‘b"..."’ 表記
     (とそのお仲間 ‘b'...'’, ‘b"""..."""’, ‘br"..."’ など) は今では
     *note bytes: 193. 型です。

   * *note PEP 3116; 新しい I/O ライブラリ: 14d4.  The *note io: 83.
     module is now the standard way of doing file I/O. The built-in
     *note open(): 318. 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: 2ee, not *note IOError: 1262.  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; 改訂版バッファプロトコル: 14d5.  The old builtin
     ‘buffer()’ is now really gone; the new builtin *note memoryview():
     166. provides (mostly) similar functionality.

   * *note PEP 3119; 抽象基底クラス: 14d6.  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: 184. and *note list: 24f. conform
     to the *note collections.MutableMapping: 12c4. and *note
     collections.MutableSequence: 4bf. ABCs, respectively.

   * *note PEP 3127; 整数リテラルのサポートと文法: 14d7.  上述のとおり、
     新しい 8 進数リテラル表現だけが唯一の 8 進数リテラル表現となり、ま
     た、バイナリリテラルが追加されました。

   * *note PEP 3129; クラスデコレータ: 14d8.

   * *note PEP 3141; 数値の型階層: 14d9.  *note numbers: a2. が、もう一
     つの新しく ABC を使うモジュールで、Python の「数値塔 (numeric
     tower)」を定義しています。新しい *note fractions: 61. モジュールが
     *note numbers.Rational: 14da. を実装していることにも注目してくださ
     い。


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 ‘pickle’ / ‘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: 108.).  The target audience of ‘turtle’ doesn't really
          care about ‘tkinter’.  Also note that as of Python 2.6, the
          functionality of ‘turtle’ has been greatly enhanced.

        * *note urllib: 10f. (‘urllib’, ‘urllib2’, ‘urlparse’,
          ‘robotparse’).

        * *note xmlrpc: 134. (‘xmlrpclib’, ‘DocXMLRPCServer’,
          ‘SimpleXMLRPCServer’).

PEP 3108(6) で取り上げられていない標準ライブラリーの他の変更:

   * Killed ‘sets’.  Use the built-in *note set(): 185. 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(): 14dc. and *note
     tofile(): 14dd. 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(): 8a8. and *note
     release(): 14de. 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: 102. モジュールはバイトでも機能するように変更されま
     した。メインのエントリポイントは generate_tokens から *note
     tokenize.tokenize(): 700. になりました。

   * ‘string.letters’ and its friends (‘string.lowercase’ and
     ‘string.uppercase’) are gone.  Use *note string.ascii_letters:
     14df. 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 ‘builtins’, 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
     で既にあった変更: 14c8. での対応する記述に書いた訳注を参照。--)

   ---------- 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. を継承しなければなりません。 ‘BaseException’ は
     例外階層の根です。 これは勧告としては新しくありませんが、
     ‘BaseException’ 継承の '要求' は新しいです。 (Python 2.6 は依然とし
     て昔のクラスを送出するのを許容しており、捕捉するものについての制限
     はありません。) 結果として文字列例外は終に本当の意味で、完全になく
     なりました。

   * ほとんど全ての例外は、実際は *note Exception: bd1. を継承すべきです
     。 *note BaseException: 7d6. は最上位で扱われるべき例外、例えば
     *note SystemExit: f40. や *note KeyboardInterrupt: bc9. の基底クラ
     スとしてのみ使われるべきでしす。上記カテゴリーを除く全ての例外を処
     理するのに推奨されるイディオムは *note except: 1ac. ‘Exception’ で
     す。

   * ‘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__: 14e2. attribute (see below).

   * PEP 3110(3): 例外の捕捉。 ‘except SOMEEXCEPTION, VARIABLE’ ではなく
     ‘except SOMEEXCEPTION as VARIABLE’ としなければなりません。 その上
     *note except: 1ac. ブロックがある場合 '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: 1ac. or *note finally: 1b1.
     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__: 14e3. 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__: 14e4. attribute of the secondary exception.  The
     traceback printed when an unhandled exception occurs walks the
     chain of ‘__cause__’ and *note __context__: 14e3. 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__: 14e2. 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(): 89b.
     (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:
     1a3. を返さなければ）。

   * 「非束縛メソッド (unbound methods)」という概念は言語から削除されま
     した。クラス属性としてのメソッドを参照しても今では普通の関数オブジ
     ェクトが得られます。

   * ‘__getslice__()’, ‘__setslice__()’ and ‘__delslice__()’ were
     killed.  The syntax ‘a[i:j]’ now translates to
     ‘a.__getitem__(slice(i, j))’ (or *note __setitem__(): 14e7. or
     *note __delitem__(): 14e8, when used as an assignment or deletion
     target, respectively).

   * PEP 3114(1): *note next(): 9dc. 標準メソッドは *note __next__():
     14e9. に改名されました。

   * The ‘__oct__()’ and ‘__hex__()’ special methods are removed - *note
     oct(): 14ea. and *note hex(): 14eb. use *note __index__(): 19f. 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__:
     14ec, *note __code__: 59d, *note __defaults__: 14ed, *note
     __dict__: 14ee, *note __doc__: 13f5, *note __globals__: 14ef, *note
     __name__: 14f0, respectively.

   * ‘__nonzero__()’ is now *note __bool__(): 14f1.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3114/


File: python.info,  Node: 組み込み,  Prev: 演算子と特殊メソッド,  Up: その他の変更<2>

1.15.7.2 組み込み
.................

   * PEP 3135(1): 新しくなった *note super(): 1a7. 。今では ‘super()’ は
     引数なしで呼び出せます。(これが *note class: 14f3. 内で定義される通
     常のインスタンスメソッド内であると仮定して) 正しいクラスとインスタ
     ンスが自動的に選択されます。引数ありの場合の ‘super()’ の振る舞いに
     は変更はありません。

   * PEP 3111(2): ‘raw_input()’ was renamed to *note input(): 14f4.
     That is, the new ‘input()’ function reads a line from *note
     sys.stdin: 75f. and returns it with the trailing newline stripped.
     It raises *note EOFError: 14f5. if the input is terminated
     prematurely.  To get the old behavior of ‘input()’, use
     ‘eval(input())’.

   * 新しい組み込み関数 *note next(): 9dc. が追加されました。 オブジェク
     トの *note __next__(): 14e9. メソッドを呼び出します。

   * *note round(): 14f6. 関数の丸めの戦略と戻り値の型が変更されました。
     ど真ん中の場合に、四捨五入ではなく最近接偶数への丸めをするようにな
     りました。(例えば ‘round(2.5)’ は今では ‘2’ を返します。 ‘3’ ではな
     く。) (--訳注: 丸めモードについては Wikipedia(3) 参照。--)
     ‘round(x[, n])’ は常に浮動小数点数の結果を返す代わりに、
     ‘x.__round__([n])’ に処理を委譲するようになりました。これは一般的に
     、単一引数で呼ばれた際に整数を返し、二つの引数で呼ばれた場合は ‘x’
     と同じ型の値として返します。

   * Moved ‘intern()’ to *note sys.intern(): 14f7.

   * Removed: ‘apply()’.  Instead of ‘apply(f, args)’ use ‘f(*args)’.

   * Removed *note callable(): 13e2.  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(): 318.  There are now
     several different kinds of streams that open can return in the
     *note io: 83. module.

   * Removed ‘reduce()’.  Use *note functools.reduce(): 21c. if you
     really need it; however, 99 percent of the time an explicit *note
     for: 348. loop is more readable.

   * Removed ‘reload()’.  Use ‘imp.reload()’.

   * Removed.  ‘dict.has_key()’ - use the *note in: 349. 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: 14f9. を標準的な C に一致。

   * 制限付き実行 の C API サポートはこれ以上されません。

   * ‘PyNumber_Coerce()’, ‘PyNumber_CoerceEx()’, ‘PyMember_Get()’, and
     ‘PyMember_Set()’ C APIs are removed.

   * New C API *note PyImport_ImportModuleNoBlock(): 3d9, works like
     *note PyImport_ImportModule(): 3da. but won't block on the import
     lock (returning an error instead).

   * ブール変換の 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
への拡張モジュール移植: 14fc. を参照してください。


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: 200. クラスでもいろい
ろな点で改良されました、標準ライブラリにいくつかの有用な追加が行われまし
た。 *note unittest: 10d. モジュールが大幅に改良され、コマンドラインオプ
ション解析の *note argparse: 7. モジュールが追加され、 *note
collections: 1e. モジュールに便利な *note OrderedDict: 7f3. と *note
Counter: 12a7. が追加され、他にもたくさんの改良が行われています。

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 メンテナンスリリースで追加された新機能: 1502. セクション
     で言及されます。

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: 1a4. とそれを継承した警告は、指定されな
い限りは無視され、アプリケーションのユーザーがその警告を見ないですむよう
になりました。この変更は Python 3.2 ブランチにも適用されました。
(stdlib-sig で討議され、 bpo-7319(1) になりました)

以前のリリースでは、 *note DeprecationWarning: 1a4. メッセージはデフォル
トで有効になっており、 Python 開発者に、将来のバージョンの Python でその
コードのどこが動かなくなるかを明確に知らせていました。

しかし、 Python で開発されたアプリケーションの利用者であって開発には携わ
っていない人がどんどん増えてきました。 *note DeprecationWarning: 1a4. メ
ッセージはそれらのユーザーには無関係で、彼らをアプリケーションが本当に正
しく動いているのか不安にさせ、ユーザーの質問に応えるための開発者の負担も
増やしていました。

*note DeprecationWarning: 1a4. メッセージの表示を有効にするには、 *note
-Wdefault: aca. (短い形式: ‘-Wd’) スイッチか、Python を実行する前に
*note PYTHONWARNINGS: da7. 環境変数を ‘"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: 187. 文で複数のコンテキストマネージャを扱えるよう
     に。

   * *note io: 83. ライブラリの新バージョン。パフォーマンスのためにC言語
     で描き直されています。

   * *note PEP 372; collections に順序付き辞書を追加: 1505. で解説されて
     いる順序付き辞書

   * *note PEP 378; 1000区切りのための書式指定子: 1506. で解説されている
     新しい ‘","’ フォーマット指定子

   * *note memoryview: 166. オブジェクト

   * *note importlib: 7b. モジュールの小さいサブセット。 *note
     下に説明があります: 1507.

   * float ‘x’ の *note repr(): 1c3. が多くの場合に短くなりました。これ
     は ‘x’ に戻せることが保証される最小の10進文字列です。以前のバージョ
     ンの Python では、 ‘float(repr(x))’ が ‘x’ になることだけが保証され
     ていました。

   * float から文字列、文字列から float への変換が正しく丸められるように
     なりました。 *note round(): 14f6. 関数も正しく丸めるようになりまし
     た。

   * 拡張モジュールが C API を提供するための、 *note PyCapsule: 148e. 型

   * *note PyLong_AsLongAndOverflow(): 1481. 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(): 1509. メソッドは、オプションの '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(): bd8. 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: f47. 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. モジュールを使うことで、複数
の区切り文字 (北米では "," で、ヨーロッパでは ".")  を使ったり、複数のグ
ループの大きさを使うことができます。しかし、 ‘locale’ の利用方法は複雑で
すし、スレッドごとに異なるロケールの出力を行うプログラムでは利用すること
ができません。

そのため、シンプルなカンマによるグループ化機構が *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 ‘getopt’ 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. ‘optparse’ 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 ‘argparse’ API consistent with ‘optparse’'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: 30e. を指定することで、自動で
ファイルを開き、 ‘'-'’ が指定されたときに標準入出力だと判断することがで
きます。

参考
....

*note argparse: 7. のドキュメント

     argparse モジュールのドキュメント

*note Migrating optparse code to argparse: 13ca.

     *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(): d4c. 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(): 13cc. 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 環境設定のための関数: 150d.

以下は、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: 86d. クラスは TCP 経由の syslog をサポートしま
     す。コンストラクタの 'socktype' 引数は使用するソケットの種類として
     、 UDP を使う *note socket.SOCK_DGRAM: 150e. と TCP を使う *note
     socket.SOCK_STREAM: 150f. のどちらかを取ります。デフォルトはUDPのま
     まです。

   * *note Logger: d4a. インスタンスに *note getChild(): 1510. メソッド
     が追加されました。これは、相対パスで下位の logger を返します。 例え
     ば、 ‘log = getLogger('app')’ として logger を取得した後、
     ‘log.getChild('network.listen')’ は
     ‘getLogger('app.network.listen')’ と同じになります。

   * The *note LoggerAdapter: 1511. class gained an *note
     isEnabledFor(): 1512. 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(): 9d4, *note values(): 9d5, *note items(): 9d6. メソ
ッドは Python 3.x では動作が代わり、完全に実体化されたリストの代わりに、
'view' と呼ばれるオブジェクトを返すようになりました。

It's not possible to change the return values of *note keys(): 9d4,
*note values(): 9d5, and *note items(): 9d6. 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(): 9d4, *note values(): 9d5, *note items(): 9d6. メソッドに書
き換えてくれます。

参考
....

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: 166. オブジェクトは、他のオブジェクトのメモリの内容に
対する *note bytes: 193. 型のインターフェースに合わせた 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: 166. オブジェクトは、対象となる背後のオブジェクトが変
更可能 (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: 187. 文が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(): 16a. 関数の適用、 *note
     float: 197. や *note complex: 198. コンストラクタ、数値フォーマット
     、 *note marshal: 91, *note pickle: ab, *note json: 86. モジュール
     を使ってのシリアライズとデシリアライズ、 Python コード中の float や
     imaginary リテラルの解析、 *note Decimal: 200. から float への変換
     などです。

     これに関連して、浮動小数点数 'x' の *note repr(): 1c3. は、
     (round-half-to-even 丸めモードで)正しく丸め処理をした場合に元の 'x'
     に戻せる最小の 10進文字列になりました。以前は 'x' を17桁の10進文字
     列に丸めていました。

     丸めライブラリが、この改善が Windows や gcc, icc, suncc を使った
     Unix 環境で動かす役目をおっています。このライブラリの正確な動作が保
     証できない少しの環境があるので、そういったシステムではこのライブラ
     リは利用されません。 *note sys.float_repr_style: 1516. が ‘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. メソッドは置換フィールドに対する自動ナンバ
     リングをサポートするようになりました。これにより ‘str.format()’ を
     より ‘%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(): 19a. をサポートするようになりました。デフ
     ォルトでは右寄せになります。精度やカンマ区切りの指定は、実部と虚部
     のそれぞれに対して適用されます。アラインの指定は ‘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: ac9. if it's passed a
     format string, because the ‘__format__()’ method for *note object:
     c82. 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(): 19c. 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: 342. 型の *note translate(): 1517. メソッドが第一
     引数に ‘None’ を受け入れるようになりました。 (Fixed by Georg
     Brandl; bpo-4759(15).)

   * When using *note @classmethod: 48e. and *note @staticmethod: 451.
     to wrap methods as class or static methods, the wrapper object now
     exposes the wrapped function as their *note __func__: 1518.
     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: 1262. 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: da7. を使って警告を制御できるように
なりました。この環境変数には、 *note -W: aca. スイッチに使われる警告の設
定を、カンマ区切りの文字列として指定します。 (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:
     187. statements, looking up the *note __enter__(): 7e4. and *note
     __exit__(): 151c. 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: 342. 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: 2d7. に、
     モジュールをスキップする機能が追加されました。コンストラクタは
     ‘django.*’ のような glob スタイルのパターンをもった iterable を引数
     として受け取ります。デバッガはパターンのどれかにマッチするスタック
     フレームにステップインしません。 (Contributed by Maru Newby after a
     suggestion by Senthil Kumaran; bpo-5142(1).)

   * *note binascii: 11. モジュールが buffer API をサポートするようにな
     り、 *note memoryview: 166. インスタンスやその他のバッファオブジェ
     クトともに利用できるようになりました。 (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: a6a. がコンテキストマネ
     ージャープロトコルをサポートするようになりました。これにより、
     ‘with bz2.BZ2File(...) as f:’ といった書き方ができます。
     (Contributed by Hagen Fürstenau; bpo-3860(5).)

   * *note collections: 1e. モジュールの新しい *note Counter: 12a7. クラ
     スは、データの数え上げをするときに便利です。 ‘Counter’ インスタンス
     は辞書のように振る舞いますが、キーが存在しなかったときに *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: 12a7. には追加の3つのメソッドがあります。 *note
     most_common(): 151e. はカウントが最も多い N 要素とそのカウントを返
     します。 *note elements(): 151f. はカウントしている要素を、そのカウ
     ント数だけ繰り返すイテレータを返します。 *note subtract(): 13fb. は
     イテレート可能型を受け取り、その各要素を足すのではなく引いて行きま
     す。引数が辞書か他の ‘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 に順序付き辞書を追加: 1505. で紹介しました。

     メソッドが追加されました。*note deque: 7f4. データ型の *note
     count(): 13fd. メソッドは、引数で指定された 'x' と等しい要素が何個
     入っているかを返します。 *note reverse(): 13fe. メソッドは deque 内
     の要素をインプレースで逆順にします。 ‘deque’ はまた、最大長を返す読
     み出し専用の属性 *note maxlen: 1520. を持ちます。 (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: acb. abstract base class now returns
     *note NotImplemented: 1a3. 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: 187.
     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(): d69. 関数が、束縛ず
     みインスタンスメソッドを正しくコピーするようになりました。
     (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:
     bc7. クラスに *note total_seconds(): 1521. メソッドが追加されました
     。これはその期間の秒数を返します。(Contributed by Brian Quinlan;
     bpo-5788(15).)

   * New method: the *note Decimal: 200. class gained a *note
     from_float(): 1421. 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: 200. 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: 200. のコンストラクタが浮動小数点数を受け入れるよう
     になりました。 (added by Raymond Hettinger; bpo-8257(18)) また、ア
     ラビア・インド数字などの、ヨーロッパ以外の Unicode 文字も受け入れる
     ようになりました。 (contributed by Mark Dickinson; bpo-6595(19)).

     *note Context: 12c7. クラスのほとんどのメソッドが *note Decimal:
     200. インスタンスと同じく整数を受け入れるようになりました。例外は
     *note canonical(): 1522. と *note is_canonical(): 1523. メソッドだ
     けです。 (Patch by Juan José Conti; bpo-7633(20).)

     *note Decimal: 200. インスタンスを文字列の *note format(): 833. メ
     ソッドで利用した場合、デフォルトのアライメントが左揃えから、数値型
     に適した右揃えに変更されました。 (Changed by Mark Dickinson;
     bpo-6857(21).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 12c0. 例外を発生さ
     せるようになりました。 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:
     1524. 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: 215. クラスが、コンストラクタの引数として、 1つの
     float 値、 *note Decimal: 200. インスタンス、 2つの有理数を受け入れ
     るようになりました。(Implemented by Mark Dickinson; rationals added
     in bpo-5812(27), and float/decimal in bpo-8294(28).)

     fraction と complex 数の間の順序比較演算 (‘<’, ‘<=’, ‘>’, ‘>=’)が
     *note TypeError: 199. 例外を発生させるようになりました。これは過失
     を修正し、 *note Fraction: 215. を他の数値型とマッチさせます。

   * 新しいクラス: *note FTP_TLS: afb. が *note ftplib: 62. に追加されま
     した。認証とその後の制御・データ転送をTLSカプセル化することでセキュ
     アなFTP接続を提供します。 (Contributed by Giampaolo Rodola;
     bpo-2054(29).)

     バイナリデータのアップロードを行う *note storbinary(): 1525. に
     'rest' 引数が追加され、アップロードのリスタートができるようになりま
     した。 (patch by Pablo Mouzo; bpo-6845(30).)

   * New class decorator: *note total_ordering(): 1148. in the *note
     functools: 63. module takes a class that defines an *note __eq__():
     cf6. method and one of *note __lt__(): 14bc, *note __le__(): 1526,
     *note __gt__(): 1527, or *note __ge__(): 1528, 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(): 13f6. 関数は、古いスタイルの2引数を
     受け取る比較関数を受け取り、 *note sorted(): dcb, *note min():
     110f, *note max(): 1110. などの 'key' 引数に利用できる呼び出し可能
     オブジェクトを返します。この関数の主な目的は、古いコードを Python
     3.x へ対応させるのを手助けすることです。(Added by Raymond
     Hettinger.)

   * 新しい関数: *note gc: 64. モジュールに *note is_tracked(): 1529. 関
     数が追加されました。渡されたオブジェクトが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: 8a4. ABC を実装してい
     ます。なので、より高速な処理のために *note io.BufferedReader: 142b.
     でラップすることができます。 (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: 12e9. 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: d39. and *note HTTPSConnection: d3a.
     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(): 10c2. 関数が追
     加されました。 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: 8a5. class now
     has an *note errors: 152a. attribute giving the error setting used
     for encoding and decoding errors (one of ‘'strict'’, ‘'replace'’,
     ‘'ignore'’).

     *note io.FileIO: 152b. クラスは、無効なファイルディスクリプタを渡さ
     れたときに *note OSError: 2c2. を送出するようになりました。
     (Implemented by Benjamin Peterson; bpo-4991(42).)  *note
     truncate(): 152c. メソッドは、ファイル位置を保存するようになりまし
     た。以前は、ファイル位置を新しいファイルの末尾に変更しました。
     (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(): 152d. とは異なり、生成された組合せに個別の要
     素が繰り返し出現できます:

          itertools.combinations_with_replacement('abc', 2) =>
            ('a', 'a'), ('a', 'b'), ('a', 'c'),
            ('b', 'b'), ('b', 'c'), ('c', 'c')

     なお要素は、実際の値ではなく、その入力内での位置に依って一意である
     とみなされます。

     *note itertools.count(): 149f. 関数は、1 以外の値を増分できるように
     、 'step' 引数を追加しました。 ‘count()’ はまた、キーワード引数に対
     応し、さらに浮動小数点数や *note Decimal: 200. インスタンスのような
     、非整数の値を使えるようになりました。(Implemented by Raymond
     Hettinger; bpo-5032(44).)

     *note itertools.combinations(): 152d. および *note
     itertools.product(): 152e. は、以前は入力のイテレート可能オブジェク
     トより大きい 'r' に *note ValueError: 2ee. を返していました。これは
     仕様エラーと認められ、空のイテレータを返すようになりました。(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(): eb6. はオプションとして、任意のオブジェクトリテ
     ラルに対して呼び出され、ペアのリストにデコードする
     '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(): dd7. および *note erfc(): dd8. 、 ‘e**x - 1’ を *note
     exp(): 152f. から 1 を引くのよりも高い精度で計算する *note expm1():
     1409. 、ガンマ関数 *note gamma(): 140a. 、そしてガンマ関数の自然対
     数 *note lgamma(): 140b. を追加しました。 (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: 1171. 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(): 1530. と *note getresuid(): 1531. 、 real,
     effective, および saved GID と UID を新しく設定する、 *note
     setresgid(): 1532. と *note setresuid(): 1533. 、現在のプロセスにグ
     ループアクセスリストを初期化する *note initgroups(): 1534. 。
     (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 における ‘fork()’ がスレッ
     ドから呼び出された時の問題を修正します。(Fixed by Zsolt Cserna;
     bpo-7242(56).)

   * *note os.path: a6. モジュールの、 *note normpath(): 1535. および
     *note abspath(): 1536. 関数は、Unicode を保存するようになりました。
     入力パスが Unicode なら、戻り値も Unicode 文字列になります。 (*note
     normpath(): 1535. fixed by Matt Giuca in bpo-5827(57); *note
     abspath(): 1536. 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 のコマンドラインが明示的なパス名を処理する方法を真似たい
     ようなスクリプトに、 ‘runpy’ のより多くの機構が利用できるようになり
     ます。 (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(): c52. および *note
     copytree(): c22. 関数は、名前付きパイプのコピーを求められたときに
     *note SpecialFileError: 1537. 例外を送出する様になりました。以前は
     、コードは、名前付きパイプを、通常のファイルのように読み込み用に開
     いて扱い、いつまでもブロックしていました。 (Fixed by Antoine
     Pitrou; bpo-3002(61).)

   * *note signal: cb. モジュールは、シグナルハンドラを本当に必要でない
     限り再インストールしなくなりました。これで、EINTR シグナルを確実に
     捕えられないバグが修正されました。(Fixed by Charles-Francois
     Natali; bpo-8354(62).)

   * 新しい関数: *note site: cc. モジュールの、新しい関数群は様々なサイ
     トおよびユーザに特有のパスを返します。 *note getsitepackages():
     145a. は、全てのグローバル site-packages ディレクトリを含むリストを
     返します。 *note getusersitepackages(): 145c. は、ユーザの
     site-packages ディレクトリのパスを返します。そして、 *note
     getuserbase(): 145b. は、データの保存に使えるディレクトリへのパスを
     与える、 *note USER_BASE: 1538. 環境変数の値を返します。
     (Contributed by Tarek Ziadé; bpo-6693(63).)

     *note site: cc. モジュールは *note sitecustomize: cd. モジュールが
     import されたときに例外を報告するようになり、 *note
     KeyboardInterrupt: bc9. 例外が捕捉されて飲み込まれることはなくなり
     ました。 (Fixed by Victor Stinner; bpo-3137(64).)

   * *note create_connection(): 883. 関数は、接続に使われるソースアドレ
     スを与える ‘(host, port)’ の 2-タプル、 'source_address' パラメタを
     追加しました。 (Contributed by Eldon Ziegler; bpo-3972(65).)

     *note recv_into(): 1539. および *note recvfrom_into(): 153a. メソッ
     ドは、バッファ API をサポートするオブジェクト、最も便利なのは *note
     bytearray: 342. や *note memoryview: 166. 、に書きこむようになりま
     した。 (Implemented by Antoine Pitrou; bpo-8104(66).)

   * The *note SocketServer: d2. module's *note TCPServer: 153b. 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: 153c. 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(): 153d. will be called and *note handle_request():
     153e. 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: aeb. 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: 143b. (a string), *note
     ssl.OPENSSL_VERSION_INFO: 143c. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 143d. (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: 153f. exception.  (Changed by Mark Dickinson;
     bpo-1523(76).)  The *note pack(): 1492. function will also attempt
     to use *note __index__(): 19f. to convert and pack non-integers
     before trying the *note __int__(): 19e. method or reporting an
     error.  (Changed by Mark Dickinson; bpo-8300(77).)

   * 新しい関数: *note subprocess: dc. モジュールの *note
     check_output(): 11c8. は、指定された引数群でコマンドを実行し、コマ
     ンドがエラーを起こさずに実行したらコマンドの出力を文字列として返し
     、そうでなければ *note CalledProcessError: 1540. 例外を送出します。

          >>> 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: f8b. signal.  (Reported by
     several people; final patch by Gregory P. Smith in
     bpo-1068268(78).)

   * 新しい関数: *note symtable: de. モジュールの *note
     is_declared_global(): 1541. は、明示的に 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: 8b0. 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(): ee7. 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:
     142e. オブジェクトのフィルタリングをサポートするようになりました。
     *note add(): df2. を呼び出したとき、オプションの呼び出し可能オブジ
     ェクトである 'filter' 引数を与えることができます。 'filter' オブジ
     ェクトには、ファイルが追加される度に ‘TarInfo’ を渡され、これを変形
     して返せます。このオブジェクトが ‘None’ を返したら、そのファイルは
     結果のアーカイブから除かれます。これは既存の 'exclude' 引数より強力
     で、それゆえこれは非推奨となります。(Added by Lars Gustäbel;
     bpo-6856(83).)  *note TarFile: 142d. クラスはまた、コンテキストマネ
     ージャプロトコルもサポートするようになりました。(Added by Lars
     Gustäbel; bpo-7232(84).)

   * *note threading.Event: 1374. クラスの *note wait(): 1542. メソッド
     は、終了時に内部フラグを返すようになりました。 ‘wait()’ は内部フラ
     グが真になるまでブロックすることを想定されているため、この関数は通
     常真を返すことになります。この戻り値は、タイムアウトが与えられ、オ
     ペレーションがタイムアウトした時のみ偽になります。 (Contributed by
     Tim Lesher; bpo-1674032(85).)

   * *note unicodedata: 10c. モジュールに提供される 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: 111. module's *note urlsplit(): f3e. 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: 111. 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: 11b. モジュールの *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: 12c. 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:
     135. and *note SimpleXMLRPCServer: 136. 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: 1543, 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: 138. モジュールの *note ZipFile: 8d4. は、コンテキス
     トマネジメントプロトコルをサポートし、 ‘with zipfile.ZipFile(...)
     as f:’ と書けるようになりました。 (Contributed by Brian Curtin;
     bpo-5511(93).)

     *note zipfile: 138. 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(): 1544. and *note readline(): 1545. now
     works correctly.  (Contributed by Nir Aides; bpo-7610(95).)

     *note is_zipfile(): 1546. 関数は、以前受け付けられていたパス名に加
     え、ファイルオブジェクトも受け付けるようになりました。 (Contributed
     by Gabriel Genellina; bpo-4756(96).)

     *note writestr(): 2ce. メソッドは、 *note ZipFile: 8d4. コンストラ
     クタで指定されたデフォルトの圧縮メソッドをオーバライドする、オプシ
     ョンの '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.  ‘importlib’ 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 ‘importlib’ 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 パッケージから引き抜かれ、新
しいトップレベルモジュールになりました。 ‘sysconfig’ は、Python のビルド
プロセスについての以下の情報を得るための関数群を提供しています。コンパイ
ラスイッチ、インストレーションパス、プラットフォーム名、そして Python が
ソースディレクトリから実行されているかどうかです。

モジュールの関数のいくつかを紹介すると:

   * *note get_config_var(): 175. は、Python の Makefile と ‘pyconfig.h’
     ファイルから変数を返します。

   * *note get_config_vars(): 29a. は、すべての環境設定変数を含む辞書を
     返します。

   * *note get_path(): 1549. は、特定のタイプのモジュール、つまり標準ラ
     イブラリ、サイト特有のモジュール、プラットフォーム特有のライブフラ
     リなど、への設定されたパスを返します。

   * *note is_python_build(): 32b. は、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: 100. 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: 100. 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: 10d. 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: 10d. モジュールのドキュメントを参照してください
。 (Developed in bpo-6001(4).)

*note main(): 11e9. 関数は、その他幾つかの新しいオプションを提供します:

   * *note -b: 154d. や ‘--buffer’ は、標準出力や標準エラーストリームを
     それぞれのテストの間バッファに入れます。テストが通れば、結果の出力
     は全て捨てられます。失敗したら、バッファに入れられた出力が表示され
     ます。

   * *note -c: 154e. や ‘--catch’ は、control-C による中断をより上品にし
     ます。テストプロセスを即座に中断するのではなく、現在実行中のテスト
     は完了させ、中断までの部分的な結果は報告されます。待ちきれなければ
     、control-C をもう一度押せば、即座に中断されます。

     この control-C ハンドラは、コードがテストされているときや、実行され
     ているテストが独自のシグナルハンドラを定義したとき、シグナルハンド
     ラがすでに設定されていてそして呼び出されたということを知らせること
     で、問題を起こさないようにします。これがまずいなら、 *note
     removeHandler(): 154f. デコレータを使って、テストが control-C ハン
     ドリングを無効にするべきであると示せます。

   * *note -f: 1550. や ‘--failfast’ は、テストが失敗したとき、他のテス
     トを続けるのではなく、テストの実行を即座に停止します。 (Suggested
     by Cliff Dyer and implemented by Michael Foord; bpo-8074(5).)

進捗メッセージは、verbose モードで実行したとき、期待された失敗に 'x' を
、期待されない成功に 'u' を表示するようになりました。(Contributed by
Benjamin Peterson.)

テストケースは、テストをスキップするために *note SkipTest: 11ea. 例外を
送出します。(bpo-1034053(6)).

*note assertEqual(): 74c, *note assertTrue(): 74a, および *note
assertFalse(): 74b. 失敗のメッセージは、提供する情報量が増えました。
*note TestCase: 2b5. クラスの *note longMessage: 1551. 属性を真に設定す
ると、失敗時に、標準のエラーメッセージと追加して提供したメッセージの両方
が表示されます。(Added by Michael Foord; bpo-5663(7).)

*note assertRaises(): 750. メソッドは、実行する呼び出し可能オブジェクト
を与えずに呼び出されたとき、コンテキストハンドラを返すようになりました。
例えば、こう書くことができます:

     with self.assertRaises(KeyError):
         {}['foo']

(Implemented by Antoine Pitrou; bpo-4444(8).)

モジュールレベルおよびクラスレベルの設定と、ティアダウンフィクスチャがサ
ポートされました。モジュールは、 *note setUpModule(): c46. および *note
tearDownModule(): 1552. 関数を含むことができます。クラスは *note
setUpClass(): c47. および *note tearDownClass(): 1553. メソッドを含むこ
とができ、これらは (‘@classmethod’ や透過なものを使って) クラスメソッド
として定義しなければなりません。これらの関数とメソッドは、テストランナー
が別のモジュールやクラスのテストケースに切り替えるときに呼び出されます。

メソッド *note addCleanup(): c78. および *note doCleanups(): 1554. が追
加されました。 ‘addCleanup()’ で、無条件に呼び出されるクリーンアップ関数
を (*note setUp(): 1555. が失敗したら ‘setUp()’ の後に、そうでなければ
*note tearDown(): 1556. の後に) 追加できるようにします。これにより、テス
ト中のリソースの配置と解放が簡潔になります。(bpo-5679(9)).

より特化したテストを提供するメソッドがいくつか追加されました。これらのメ
ソッドの多くは、Google のエンジニアたちによってそのテストスイートのため
に書かれました。Gregory P. Smith, Michael Foord, and GvR が、これを
*note unittest: 10d. の Python 版にマージしました。

   * *note assertIsNone(): 14a6. および *note assertIsNotNone(): 14a7. は
     ひとつの式を取り、その結果が ‘None’ であるか、またはないかを確かめ
     ます。

   * *note assertIs(): 1557. および *note assertIsNot(): 1558. は、2 つ
     の値を取り、その評価が同一のオブジェクトであるか、またはないかを確
     かめます。 (Added by Michael Foord; bpo-2578(10).)

   * *note assertIsInstance(): 1559. および *note assertNotIsInstance():
     155a. は、結果のオブジェクトが特定のクラス、またはタプルにあるクラ
     スのいずれかのインスタンスであるかを調べます。(Added by Georg
     Brandl; bpo-7031(11).)

   * *note assertGreater(): 155b, *note assertGreaterEqual(): 155c,
     *note assertLess(): 155d, および *note assertLessEqual(): 155e. は
     、二つの量を比較します。

   * *note assertMultiLineEqual(): 155f. は 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(): 1560. および *note assertNotIn(): 1561. は、
     'first' が 'second' に属するか、または属さないかを調べます。

   * *note assertItemsEqual(): 1446. tests whether two provided
     sequences contain the same elements.

   * *note assertSetEqual(): 14a1. は、2 つの集合が等しいか比較し、エラ
     ーの場合のみ、集合間の差分を報告します。

   * 同様に、 *note assertListEqual(): 14a3. および *note
     assertTupleEqual(): 14a4. は、指定された型を比較し、差分を説明しま
     すが、完全な値を表示するとはかぎりません。これらのメソッドは、リス
     トやタプルを *note assertEqual(): 74c. で比較するときにデフォルトで
     使われるようになりました。より一般的には、 *note
     assertSequenceEqual(): 14a5. は 2 つのシーケンスを比較し、必要なら
     両方のシーケンスが特定の型であるかを調べます。

   * *note assertDictEqual(): 14a2. 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(): 1562. は、 *note TestLoader: 593. の
     *note suiteClass: 1563. 属性を適切に受け入れます。(Fixed by Mark
     Roddy; bpo-6866(13).)

   * 新しいフックにより、 *note assertEqual(): 74c. メソッドを拡張して新
     しいデータ型を扱わせられます。 *note addTypeEqualityFunc(): 1564. メ
     ソッドは型オブジェクトと関数を取ります。この関数は、比較される両方
     のオブジェクトが特定の型であるときに使われます。この関数は、2 つの
     オブジェクトを比較し、マッチしなければ例外を送出するべきです。この
     関数が、新しいシーケンス比較メソッドがするように、2 つのオブジェク
     トがなぜマッチしないのかについて追加の情報を提供するのがいいアイデ
     アです。

*note unittest.main(): 11e9. はオプションの ‘exit’ 引数を取るようになり
ました。偽の場合、 ‘main()’ は *note sys.exit(): 279. を呼び出さず、これ
により対話型インタプリタから ‘main()’ が使えるようになります。
(Contributed by J. Pablo Fernández; bpo-3379(14).)

*note TestResult: 1383. に、テストランの直前と直後に呼び出される *note
startTestRun(): 1565. および *note stopTestRun(): 1566. が追加されました
。 (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: c4d. インスタンスを与え
     る 'parser' キーワード引数を取るようになりました。これにより、ファ
     イルの内部エンコーディングをオーバーライドできるようになりました:

          p = ET.XMLParser(encoding='utf-8')
          t = ET.XML("""<root/>""", parser=p)

     Errors in parsing XML now raise a *note ParseError: 1493.
     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(): c90. 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: 1569. 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(): 13ee.  In
     XML mode, you can use the true/false 'xml_declaration' parameter to
     suppress the XML declaration.

   * 新しい *note Element: 361. メソッド: *note extend(): 13ef. はシーケ
     ンスから項目の子に要素を追加します。要素それ自体はシーケンスのよう
     に振る舞うので、子をある要素から別の要素に移すのが簡単です:

          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: 361. method: *note iter(): 156a. 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: 361. method: *note itertext(): 13f1. 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(): b7c. はスレッドセーフになり、ワーカスレ
     ッドがメイン Python スレッドに通知を投入することができるようになり
     ました。これは特に、非同時性の IO 処理に便利です。(Contributed by
     Kristján Valur Jónsson; bpo-4293(4).)

   * New function: *note PyCode_NewEmpty(): 156c. 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(): 1484. は、既存の
     *note PyErr_NewException(): 1485. と同じように新しい例外クラスを生
     成しますが、新しい例外クラスの docstring を含む、追加の ‘char *’ 引
     数を取ります。(Added by 'lekma' on the Python bug tracker;
     bpo-7033(5).)

   * 新しい関数: *note PyFrame_GetLineNumber(): 992. はフレームオブジェ
     クトを取り、そのフレームが現在実行している行番号を返します。以前は
     、コードは現在実行しているバイトコード命令のインデクスを得て、それ
     からそのアドレスに対応する行番号を探索する必要がありました。(Added
     by Jeffrey Yasskin.)

   * New functions: *note PyLong_AsLongAndOverflow(): 1481. and *note
     PyLong_AsLongLongAndOverflow(): 1482. 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(): 14b1. 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: 156d, *note Py_ISALPHA: 156e, *note Py_ISDIGIT:
     156f, *note Py_ISLOWER: 1570, *note Py_ISSPACE: 1571, *note
     Py_ISUPPER: 1572, *note Py_ISXDIGIT: 1573, *note Py_TOLOWER: 1574,
     および *note Py_TOUPPER: 1575. 。これらすべての関数は、文字を分類す
     る 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(): 10b5. 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 つだけで生成され、そ
     のスレッドが ‘os.fork()’ を処理するからです。他のスレッドが、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(): 45d. 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: 12d. 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: 148e. を追加しました。カプセルは、本質的には C の ‘void *’ ポ
インタのホルダであり、モジュール属性として利用できるようになります。例え
ば、 *note socket: d1. モジュールの API は ‘socket.CAPI’ として公開され
ていて、 *note unicodedata: 10c. は ‘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(): 1578. は不適合な名前を検知し、偽を
返します。これらのオブジェクトの使用について、より詳しい情報は、 *note
拡張モジュールに C API を提供する: 1579. を参照してください。

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: ac9, 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: 157b, *note
     VC_ASSEMBLY_PUBLICKEYTOKEN: 157c, and *note
     LIBRARIES_ASSEMBLY_NAME_PREFIX: 157d.  (Contributed by David
     Cournapeau; bpo-4365(1).)

   * The *note _winreg: 11d. module for accessing the registry now
     implements the *note CreateKeyEx(): 157e. and *note DeleteKeyEx():
     157f. functions, extended versions of previously supported
     functions that take several extra arguments.  The *note
     DisableReflectionKey(): 1580, *note EnableReflectionKey(): 1581,
     and *note QueryReflectionKey(): 1582. 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(): 1583. function now works on Windows.  The
     signal value can be the constants *note CTRL_C_EVENT: 1584, *note
     CTRL_BREAK_EVENT: 1585, 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(): 1316. 関数は、空のパスに対してちゃんと失敗する
     ようになりました。 (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():
     fa5. methods *note getsockopt(): ed4./*note setsockopt(): ed5. 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(): 318. によって返された組み込みファイル
     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: 1589. 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(): b41. function processes its arguments more
     consistently; it will now call *note __int__(): 19e. on non-float,
     non-integer arguments that are supplied to it.  (Fixed by Alexander
     Belopolsky; bpo-1533(1).)

   * 文字列 *note format(): 19a. メソッドは浮動小数点数および複素数に使
     われるデフォルトの精度を、 *note str(): 16a. で使われる精度に合わせ
     、小数第 6 位から 12 位に変更しました。 (Changed by Eric Smith;
     bpo-5920(2).)

   * Because of an optimization for the *note with: 187. statement, the
     special methods *note __enter__(): 7e4. and *note __exit__(): 151c.
     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: c82.) and C extension types.  (bpo-6101(3).)

   * Due to a bug in Python 2.6, the 'exc_value' parameter to *note
     __exit__(): 151c. 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: a85. を送出しないことがあ
     りました。このようなエラーはより注意深く調べられ、例外を送出するよ
     うになりました。(Reported by Mark Leander, patch by Anand B. Pillai
     and Alexander Belopolsky; bpo-7150(6).)

   * *note Decimal: 200. インスタンスを文字列の *note format(): 19a. メ
     ソッドに使うとき、デフォルトの揃えは以前は左揃えでした。これは右揃
     えに変更され、プログラムの出力が変わるかもしれません。(Changed by
     Mark Dickinson; bpo-6857(7).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 12c0. 例外を発生さ
     せるようになりました。 Quiet NaN (あるいは ‘NAN’) はハッシュ可能に
     なりました。 (Fixed by Mark Dickinson; bpo-7279(8).)

   * The *note xml.etree.ElementTree: 12c. 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: 112e. 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: 111. module's *note urlsplit(): f3e. 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: 1a4. を引き起こすのではなく、 *note
     TypeError: 199. 例外を送出するようになりました。(bpo-5080(14))

   * Use the new *note PyOS_string_to_double(): 14b1. 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(): 12e4. が 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. モジュールのほとんどがバックポートされ
     ました。つまり ‘ssl’ は今や、Server Name Indication, TLS1.x 設定,
     platform certificate store へのアクセス, *note SSLContext: 355. ク
     ラス, その他機能が使えます (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: 158f. と *note
     hashlib.algorithms_available: 1590. が 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: 10fa. では ‘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 モジュールのインストール: 10fc. と
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++ 拡張のビルド: 10fd. and *note setuptools による C および
C++ 拡張のビルド: 10fe.

参考
....

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: 112. and *note xmlrpclib: 135, 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():
     21c. の追加。

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(): 14c4. 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: 187.' 文が ‘from __future__ import
with_statement’ ディレクティブで有効に出来るオプションの機能として追加さ
れました。2.6 では '‘with’' 文は特別に有効化する必要なく、もういつでもそ
こにあります。このセクションの残りの部分は "What's New in Python 2.5" の
対応するセクションからの丸々コピーですので、2.5 で '‘with’' 文に馴染んで
いるなら読み飛ばしてもらって結構です。

'*note with: 187.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 187.' ステートメントは基本構造が以下となる制御フロー構造で
す:

     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__(): 151c. 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__(): 151c. method is called, even if the block raised an
exception, and can therefore run clean-up code.

いくつかの Python 標準オブジェクトが既にコンテキスト管理プロトコルをサポ
ートしていて、 '*note with: 187.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 348. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     318, because *note __enter__(): 7e4. returns 'self'.

*note threading: f3. モジュールのロック・条件変数でも '*note with: 187.'
ステートメントの恩恵にあずかれます:

     lock = threading.Lock()
     with lock:
         # Critical section of code
         ...

ブロックが実行される前にロックが獲得されて、ブロックが完了するやいなや必
ず解放されます。

The *note localcontext(): 15a2. 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: 187.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘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__(): 151c. 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__(): 151c. method is called with three arguments, the
     exception details (‘type, value, traceback’, the same values
     returned by *note sys.exc_info(): 89b, 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: 187.' statement will never realize
     anything went wrong.

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 151c.
     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: 187.' 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__(): 151c. 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:
1b0. 文を書いてもよろしいです:

     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: 187.' ステートメントで
使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提供してい
ます。

The decorator is called *note contextmanager(): 141f, 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: bc6. 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: 187.' statement's ‘as’ clause, if
any.  The code after the ‘yield’ will be executed in the *note
__exit__(): 151c. 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: 187.' を書く必要性をなくしてくれます。この例では
、単一の '‘with’' でデータベーストランザクション開始とスレッドのロック獲
得の両方をやってのけています:

     lock = threading.Lock()
     with nested (db_transaction(db), lock) as (cursor, locked):
         ...

Finally, the *note closing(): 15a5. 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: 187.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*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: 23e. で、モジュールをスクリプトとして実行
出来ます。パッケージ内のモジュールを実行する際に、相対インポートが正しく
動作していませんでした。

The fix for Python 2.6 adds a *note module.__package__: 325. attribute.
When this attribute is present, relative imports will be relative to the
value of this attribute instead of the *note __name__: 15a7. attribute.

PEP 302-style importers can then set *note __package__: 325. as
necessary.  The *note runpy: c3. module that implements the *note -m:
23e. 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: 15a9. 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: 15aa. オプションを付けるか、環境変
数 *note PYTHONNOUSERSITE: 15ab. をセットすることで完全に無効に出来ます
。

参考
....

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: 254, which is passed a callable object and a collection
of arguments.  The *note start(): 15ad. method sets the callable running
in a subprocess, after which you can call the *note is_alive(): 15ae.
method to check whether the subprocess is still running and the *note
join(): 15af. 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: 15b0. が factorial の結果を通信して返すのに使われています。
‘Queue’ オブジェクトはグローバル変数に格納されています。子プロセスは、子
プロセスが作成された時点のその変数の値を使うことになります; ‘Queue’ なの
で、親子はそのオブジェクトを通信のために使うことが出来ます。(プロセス作
成後に親がグローバル変数 queue を差し替えても、子の値は左右されませんし
、逆もしかりです。)

Two other classes, *note Pool: 1171. and *note Manager: 252, provide
higher-level interfaces.  ‘Pool’ will create a fixed number of worker
processes, and requests can then be distributed to the workers by
calling *note apply(): 15b1. or *note apply_async(): 15b2. to add a
single request, and *note map(): 12ff. or *note map_async(): 1300. to
add a number of requests.  The following code uses a ‘Pool’ 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: 252. 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(): 184. method; the worker
processes then insert values into the dictionary.  (Locking is not done
for you automatically, which doesn't matter in this example.
‘Manager’'s methods also include *note Lock(): 15b3, *note RLock():
15b4, and *note Semaphore(): 15b5. 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(): 19a.  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: 15b7. を調べてみてください。以下はその一部です:

‘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(): 19a. 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 Format string syntax: 15b7.

     リファレンスドキュメント。

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(): 117b. 関数になります。
‘print()’ が関数になることで、 ‘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: 199. 例外と *note ValueError:
2ee. 例外の両方とっつかまえてやろうと思ったのでしょうが、このコードは実
際にはちょっと違ったことをします: ‘TypeError’ を捕捉したらこれを
‘"ValueError"’ というローカル名の例外オブジェクトに束縛します…。
‘ValueError’ 例外は決して捕捉されません。正しくは、例外のタプルで指定し
ます:

     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:
193. のコンストラクタを用います。前方互換のために、Python 2.6 は *note
str: 16a. 型に対する別名として ‘bytes’ を追加のうえで、 ‘b''’ 記法もサポ
ートします。

2.6 の *note str: 16a. 型は 3.0 の *note bytes: 193. 型とは色んな意味で
違います; 一番顕著なのは、コンストラクタがまったく異なることです。3.0 で
の ‘bytes([65, 66, 67])’ は 3 つのバイトで ‘ABC’ を構築しますが、2.6 で
の ‘bytes([65, 66, 67])’ は引数のリストを *note str(): 16a. で文字列化し
た 12 バイト文字列を返します。

2.6 での *note bytes: 193. の主な使いみちはオブジェクトの型のテストに
‘isinstance(x, bytes)’ とすることでしょう。またこれは、 2.x コードが文字
列として ASCII 文字と 8 ビットバイトのどちらを意図しているのか知ることが
出来ない 2to3 コンバータの助けになります; あなたは今や ‘bytes’ と *note
str: 16a. の区別を、あなたの意図を正確に表現するのに使えます。そして結果
のコードは 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: 999.
Python 2.6 uses ‘#define’ to support using the names *note
PyBytesObject(): 999, *note PyBytes_Check(): 15bb, *note
PyBytes_FromStringAndSize(): 15bc, and all the other functions and
macros used with strings.

*note bytes: 193. 型のインスタンスは単に文字列と同じで *note immutable:
15bd. です。 *note bytearray: 342. 型が、バイト列を *note mutable: 15be.
シーケンスとして格納するものとして新しく追加されました:

     >>> 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(): 15bf./*note endswith(): 15c0, *note find(): 15c1./*note
rfind(): 15c2, and some of the methods of lists, such as *note append():
15c3, *note pop(): 15c4, and *note reverse(): 15c5.

     >>> b = bytearray('ABC')
     >>> b.append('d')
     >>> b.append(ord('e'))
     >>> b
     bytearray(b'ABCde')

対応する C API もあります。 *note PyByteArray_FromObject(): 15c6, *note
PyByteArray_FromStringAndSize(): 15c7. や色々その他関数です。

参考
....

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: 12eb. defines raw I/O operations: *note read():
     1021, *note readinto(): 1022, *note write(): 15c9, *note seek():
     14a8, *note tell(): 15ca, *note truncate(): 152c, and *note
     close(): 506.  Most of the methods of this class will often map to
     a single system call.  There are also *note readable(): 15cb, *note
     writable(): 15cc, and *note seekable(): 15cd. methods for
     determining what operations a given object will allow.

     Python 3.0 はこのクラスのファイルとソケットに対する具象実装を持って
     いますが、Python 2.6 はファイル、ソケットオブジェクトのこの方法での
     再構築はしていません。

   * *note BufferedIOBase: 8a4. 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: 12eb, and adds a *note raw: 15ce. attribute
     holding the underlying raw object.

     There are five concrete classes implementing this ABC. *note
     BufferedWriter: 15cf. and *note BufferedReader: 142b. are for
     objects that support write-only or read-only usage that have a
     *note seek(): 14a8. method for random access.  *note
     BufferedRandom: 15d0. objects support read and write access upon
     the same underlying stream, and *note BufferedRWPair: 15d1. is for
     objects such as TTYs that have both read and write operations
     acting upon unconnected streams of data.  The *note BytesIO: 10a8.
     class supports reading, writing, and seeking over an in-memory
     buffer.

   * *note TextIOBase: 8a5.: Provides functions for reading and writing
     strings (remember, strings will be Unicode in Python 3.0), and
     supporting *note universal newlines: f39.  ‘TextIOBase’ defines the
     *note readline(): bf. method and supports iteration upon objects.

     There are two concrete implementations.  *note TextIOWrapper: 9c2.
     wraps a buffered I/O object, supporting all of the methods for text
     I/O and adding a *note buffer: 14bf. attribute for access to the
     underlying object.  *note StringIO: 112e. simply buffers everything
     in memory without ever writing anything to disk.

     (In Python 2.6, *note io.StringIO: 112e. 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: 15d3. indicates that the memory must be
     writable.

   * ‘PyBUF_LOCK’ requests a read-only or exclusive lock on the memory.

   * *note PyBUF_C_CONTIGUOUS: 15d4. and *note PyBUF_F_CONTIGUOUS: 15d5.
     requests a C-contiguous (last dimension varies the fastest) or
     Fortran-contiguous (first dimension varies the fastest) array
     layout.

*note PyArg_ParseTuple(): 3bf. のための 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: 1120, special handling of
this metaclass by the *note isinstance(): 2af. and *note issubclass():
9c8. 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__(): e6d, and ‘Container’ means the
class defines a *note __contains__(): 15d7. 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(): 129e. method:

     import collections

     class Storage:
         ...

     collections.MutableMapping.register(Storage)

For classes that you write, deriving from the ABC is probably clearer.
The *note register(): 129e. 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: 129b. 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(): 14ea. はまだ先行ゼロ形式での表現を返します。
新しいビルトイン関数 *note bin(): 14c4. は数値の 2 進数表現を返します:

     >>> oct(42)
     '052'
     >>> future_builtins.oct(42)
     '0o52'
     >>> bin(173)
     '0b10101101'

ビルトイン *note int(): 19c, ‘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:
14da. と名前が衝突するのを避けるためです。)

‘Integral’ 数は ‘Rational’ からの派生で、シフト演算 ‘<<’, ‘>>’ が出来て
、 ‘&’ や ‘|’ のようなビット演算で混ぜ合わせることができて、また、配列の
インデクスとスライスの境界として使えます。

Python 3.0 では、その PEP は少し既存のビルトイン *note round(): 14f6,
*note math.floor(): 15db, *note math.ceil(): 15dc. を再定義していて、ま
た、Python 2.6 にバックポートされている新しい *note math.trunc(): 15dd.
を追加しています。 ‘math.trunc()’ はゼロに向かう方向の丸めで、引数とゼロ
の間で一番近い ‘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: bc9. と
     *note SystemExit: f40. まで捕まえるべきではなかったのです。Python
     2.6 では ‘hasattr()’ はもはやそれら例外に出会ってもそれを捨てません
     。 (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: df9. 例外を起こします。 (Backported in bpo-2719(5).)

   * Tuples now have *note index(): 15e0. and *note count(): 15e1.
     methods matching the list type's *note index(): 15e2. and *note
     count(): 15e3. 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(): 197. 関
     数は文字列 ‘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(): 14eb. メソッドを持ち、また、
     ‘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(): 198. コンス
     トラクタがゼロの符号を維持するようになりました。 (Fixed by Mark T.
     Dickinson; bpo-1507(9).)

   * ‘__hash__()’ メソッドを親クラスから継承するクラスは、ハッシュ出来な
     いことを示すのに ‘__hash__ = None’ をセット出来ます。これにより
     ‘hash(obj)’ は *note TypeError: 199. を起こし、そのクラスは
     ‘Hashable’ ABC を実装していないことを示します。

     ‘__cmp__()’ か ‘__eq__()’ を定義するのにその比較にオブジェクトの身
     元ではなくその値を使ったならば、あなたはこれをすべきです。全てのオ
     ブジェクトはその値として ‘id(obj)’ を使うデフォルトのハッシュ化メソ
     ッドを持っています。親クラスから継承した ‘__hash__()’ を削除する整
     理された方法はありません。ですのでオーバライドとしての ‘None’ の代
     入が実装されました。 C API のレベルでは、拡張は ‘tp_hash’ に *note
     PyObject_HashNotImplemented(): 15e4. をセット出来ます。 (Fixed by
     Nick Coghlan and Amaury Forgeot d'Arc; bpo-2235(10).)

   * *note GeneratorExit: 15e5. 例外が *note Exception: bd1. ではなく
     *note BaseException: 7d6. のサブクラスになっています。 ‘except
     Exception:’ をする例外ハンドラが意図せず ‘GeneratorExit’ 捕捉してし
     まうことがなくなります。 (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(): 198. コンストラクタが括弧で囲まれた複素数表現文字
     列を受け付けるようになっています。 ‘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__()’ メソッドをチェックするようになりました。このメソッドは
     そのオブジェクトで妥当な属性名を含む文字列のリストを返さなければな
     りません。これにより ‘dir()’ が生成する値を制御出来ます。
     ‘__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__: 15e6, and ‘im_func’ is also available as *note
     __func__: 1518.  The old names are still supported in Python 2.6,
     but are gone in 3.0.

   * 目立たない変更: *note locals(): 46f. 関数を *note class: 14f3. ステ
     ートメント内で使う際、結果の辞書はもはや自由変数を返しません。(この
     場合、自由変数は ‘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: 119. モジュールが 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’
     フィールドに明示的に *note Py_TPFLAGS_HAVE_VERSION_TAG: 15e8. を追
     加しなければなりません。(このメソッドキャッシュに対して互換であるた
     めには、拡張モジュールのコードは、それが実装するどんな型についても
     ‘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__(): 151c. 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: 170. 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: 15eb. スイッチを渡すか、インタプリタ実行
前に環境変数 *note PYTHONDONTWRITEBYTECODE: 15ec. をセットするかのどちら
かで、 ‘.pyc’ や ‘.pyo’ が作られないようにすることが出来るようになりまし
た。この設定は Python プログラムから ‘sys.dont_write_bytecode’ 変数とし
て利用可能で、Python コードはこの変数を変更してインタプリタの振る舞いを
変えることが出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)

標準入力、標準出力、標準エラー出力に使うエンコーディングを、インタプリタ
起動前に環境変数 *note PYTHONIOENCODING: 1210. を設定することで指定出来
るようになりました。値は ‘<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: 111. module.  The
     versions still available in the ‘cgi’ module will trigger *note
     PendingDeprecationWarning: ac9. 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: e02. objects now
     support an *note httponly: 15ee. 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: afa. クラスのコンストラクタと ‘connect()’ メソッ
     ドに省略可能 ‘timeout’ パラメータが追加されました。タイムアウトを秒
     で指定します。(Added by Facundo Batista.)  また、 ‘FTP’ クラスの
     ‘storbinary()’ と ‘storlines()’ メソッドが 'callback' パラメータを
     新たに受け取ります。これはデータが送信されたあとでデータの各ブロッ
     クごとに呼び出されます。 (Contributed by Phil Schwartz;
     bpo-1221598(9).)

   * ビルトイン関数の ‘reduce()’ が *note functools: 63. モジュールでも
     利用可能です。Python 3.0 ではビルトイン関数は削除されて ‘functools’
     のものだけが使えます; 現在のところ 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. は以前使っていた「以下(‘<=’)」比較ではなく「より小
     さい(‘<’)」比較だけを使って実装されています。これにより ‘heapq’ に
     格納する型の要件が *note list.sort(): dcc. メソッドに合致します。
     (Contributed by Raymond Hettinger.)

   * An optional ‘timeout’ parameter, specifying a timeout measured in
     seconds, was added to the *note httplib.HTTPConnection: d39. and
     *note HTTPSConnection: d3a. 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(): 15ef. と *note isnan(): 15f0. は与えられた浮動
          小数点数が、順に、(正または負の) 無限大であるかどうか、非数
          (NaN=Not a Number) であるかどうかを返します。

        * *note copysign(): 15f1. は IEEE 754 数の符号ビットをコピーしま
          す。 'x' の絶対値と 'y' の符号ビットを組み合わせたものを返しま
          す。例えば ‘math.copysign(1, -0.0)’ は -1.0 を返します。
          (Contributed by Christian Heimes.)

        * *note factorial(): b45. は階乗を計算します。 (Contributed by
          Raymond Hettinger; bpo-2138(12).)

        * *note fsum(): 15f2. はイテラブルからの数列を、部分和の計算を通
          じて精度の損失を避けながら積み上げた合計の計算をします。
          (Contributed by Jean Brouwers, Raymond Hettinger, and Mark
          Dickinson; bpo-2819(13).)

        * *note acosh(): 15f3, *note asinh(): 15f4, *note atanh(): 15f5.
          は逆双曲線関数を計算します。

        * *note log1p(): 15f6. は '1+x' の自然対数 (底 'e' の対数) を返
          します。

        * ‘trunc()’ はゼロに向かう方向に丸めを行い、与えられた引数とゼロ
          に最も近い ‘Integral’ を返します。これは *note PEP 3141;
          数値の型階層: 14d9. のバックポートの一部として追加されました。

   * *note math: 92. モジュールは、特に浮動小数点例外と IEEE 754 の特殊
     値の処理において、プラットフォーム間に渡る振る舞いの一貫性をさらに
     高めるように改善されました。

     可能な場合にはいつでもこのモジュールは 754 の特殊値について、C99 標
     準の勧告に従います。例えば、 ‘sqrt(-1.)’ は今ではほとんど全てのプラ
     ットフォームで *note ValueError: 2ee. となるはずで、
     ‘sqrt(float('NaN'))’ は全ての IEEE 754 プラットフォームで NaN を返
     すはずです。C99 標準の付録 'F' で 'divide-by-zero' または 'invalid'
     を伝えることを勧告している箇所では Python は ‘ValueError’ を投げま
     す。C99 標準の付録 'F' で 'overflow' を伝えることを勧告している箇所
     では Python は *note OverflowError: a85. を投げます。 (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(): 25e. を使って環境変数
     を未設定にするようになりました。 (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(): 15f7. が "%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(): 15f8. が、トレースバックが与えられない場合に
     *note sys.exc_info(): 89b. からの戻り値のトレースバックを使うように
     なりました。 (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(): c22. が省略可能引数 '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(): 15f9. もあります。
     同じくファイルデスクリプタを渡します。

     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(): 153d. method after a span of
     inactivity specified by the server's *note timeout: 153c.
     attribute.  (Contributed by Michael Pomraning.)  The *note
     serve_forever(): 135b. 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(): 15fa, *note kill(): 15fb, and
     *note send_signal(): 15fc. methods.  On Windows, ‘send_signal()’
     only supports the *note SIGTERM: 15fd. 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: 15eb. スイッチ付きで起動するか環境変数
     *note PYTHONDONTWRITEBYTECODE: 15ec. をセットすることで初期設定され
     ます。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():
     15fe. と *note sys.gettrace(): 15ff. で知ることが出来るようになりま
     した。 (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():
     1600. 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: 108. モジュールが
     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: 309. function and the ‘urllib.ftpwrapper’ class
     constructor, as well as the ‘urllib2.urlopen’ 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: 10c. モジュールで提供される Unicode データベース
     が、バージョン 5.1.0 に更新されました。 (Updated by Martin von
     Löwis; bpo-3811(54).)

   * *note warnings: 119. モジュールの ‘formatwarning()’ と
     ‘showwarning()’ に省略可能な 'line' 引数が追加されました。ソースコ
     ードの行番号を与えることが出来ます。 (Added as part of
     bpo-1631171(55), which re-implemented part of the ‘warnings’ module
     in C code.)

     新しい関数 ‘catch_warnings()’ はコンテキストマネージャで、テスト目
     的で警告フィルタを一時的に変更して元に戻すのに使えます。
     (bpo-3781(56)).

   * The XML-RPC *note SimpleXMLRPCServer: 136. and ‘DocXMLRPCServer’
     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: 135. module no longer automatically converts
     *note datetime.date: 1fc. and *note datetime.time: 1fd. to the
     *note xmlrpclib.DateTime: 1601. type; the conversion semantics were
     not necessarily correct for all applications.  Code using
     ‘xmlrpclib’ should convert ‘date’ and ‘time’ 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: 138. モジュールの ‘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(): 318, ‘read()’, ‘extract()’ メソッドはファイル名か
     ‘ZipInfo’ オブジェクトのどちらかを受け取れるようになっています。こ
     れは誤って重複したファイル名を含んでいるアーカイブで有用でしょう。
     (Contributed by Graham Horler; bpo-1775025(62).)

     最後に、 *note zipfile: 138. がアーカイブするファイルのファイル名と
     して 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(): 1c3. と同じことをします。Python
     3.0 では ‘repr()’ は Unicode 文字列を返すようになっていて、一方
     *note ascii(): 1604. は純粋な ASCII バイト文字列を返します。

   * ‘filter(predicate, iterable)’, ‘map(func, iterable1, ...)’: 3.0 と
     同じようにイテレータを返し、これは 2.x のビルトインがリストで返すの
     とは違っています。

   * ‘hex(value)’, ‘oct(value)’: ‘__hex__()’ と ‘__oct__()’ メソッドを呼
     び出すのではなく、 ‘__index__()’ メソッドを呼び出した結果を
     hexadecimal または octal に変換します。こちらのバージョンの *note
     oct(): 14ea. は新しい ‘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 as dt

     # Create data structure
     data_struct = dict(lastAccessed=dt.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: 199. を起こします。

   * Changes to the *note Exception: bd1. 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():
     160a. 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: 185. 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 改訂版バッファプロトコル: 15d2. で前述の新しいバッフ
     ァインターフェイスのために、 *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.)

   * Importing modules simultaneously in two different threads no longer
     deadlocks; it will now raise an *note ImportError: 65b.  A new API
     function, *note PyImport_ImportModuleNoBlock(): 3d9, will look for
     a module in ‘sys.modules’ first, then try to import it after
     acquiring an import lock.  If the import lock is held by another
     thread, an ‘ImportError’ is raised.  (Contributed by Christian
     Heimes.)

   * Several functions return information about the platform's
     floating-point support.  *note PyFloat_GetMax(): 160c. returns the
     maximum representable floating-point value, and *note
     PyFloat_GetMin(): 160d. returns the minimum positive value.  *note
     PyFloat_GetInfo(): 160e. 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(): 160f. を使う 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: 1610. と *note PyModule_AddIntMacro():
     1611. です。 (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(): 989, ‘Py_Type()’ became *note Py_TYPE(): 3c7, and
     ‘Py_Refcnt()’ became *note Py_REFCNT(): 2d1.  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(): 1613.
     function reads a keypress and returns a Unicode value, as does the
     *note getwche(): 1614. function.  The *note putwch(): 1615.
     function takes a Unicode character and writes it to the console.
     (Contributed by Christian Heimes.)

   * *note os.path.expandvars(): 15f7. は "%var%" 形式を環境変数で置換し
     、 "~user" をユーザのホームディレクトリパスに置換します(--訳注: 上
     のほうの訳注参照。--)。 (Contributed by Josiah Carlson;
     bpo-957650(1).)

   * The *note socket: d1. module's socket objects now have an *note
     ioctl(): ed2. method that provides a limited interface to the
     ‘WSAIoctl()’ system interface.

   * The *note _winreg: 11d. module now has a function, *note
     ExpandEnvironmentStrings(): 1616, 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: 187. statements.  (Contributed by
     Christian Heimes.)

     *note _winreg: 11d. also has better support for x64 systems,
     exposing the *note DisableReflectionKey(): 1580, *note
     EnableReflectionKey(): 1581, and *note QueryReflectionKey(): 1582.
     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: 199. を起こします。

   * *note collections.deque: 7f4. の ‘__init__()’ メソッドが、イテラブ
     ルから要素を追加する前に全ての deque の既存の内容をクリアするように
     なっています。この変更は ‘list.__init__()’ の振る舞いと一致します
     (--訳注: 当たり前のことにしか思えないのですが詳細がわかりません。こ
     れ以前のバージョンでは deque はシングルトンのように振舞っていたので
     しょうか。--)。

   * *note object.__init__(): 8c0. は以前は任意の引数とキーワード引数を
     受け取り、そして無視していました。Python 2.6 ではもうこれは許されま
     せん。 *note TypeError: 199. を起こします。これは結果的に *note
     object: c82. の対応するメソッドを呼ぶ(おそらく *note super(): 1a7.
     を介して) ‘__init__()’ メソッドに影響します。 bpo-1683368(1) の議論
     を参照して下さい。

   * ‘Decimal’ のコンストラクタは今では先頭と末尾の空白が含まれる文字列
     を許容します。以前は ‘InvalidOperation’ となっていました。他方で、
     ‘Context’ オブジェクトの ‘create_decimal()’ メソッドは余分な空白を
     明示的に拒絶するようになり、 ‘ConversionSyntax’ を投げます。

   * 実装上の誤り(事故)で、ビルトインの *note __import__(): ad5. 関数に
     ファイルパスを渡すと指定したファイルをインポート出来ていました。し
     かしながらこれは決して意図した振る舞いではありませんでした。実装は
     今ではこのケースを明示的にチェックし、 *note ImportError: 65b. を起
     こします。

   * C API: *note PyImport_Import(): 161a. と *note
     PyImport_ImportModule(): 3da. 関数がデフォルトで、相対インポートで
     はなく絶対インポートをするようになっています。これはほかのモジュー
     ルをインポートする C 拡張に影響します。

   * C API: ハッシュされるべきではない拡張データ型は、 ‘tp_hash’ スロッ
     トを *note PyObject_HashNotImplemented(): 15e4. と定義すべきです。

   * *note socket: d1. モジュールの例外 *note socket.error: 1265. が
     *note IOError: 1262. 派生になっています。以前は ‘StandardError’ の
     サブクラスではありませんでしたが今は ‘IOError’ を通じてそれのサブク
     ラスです。 (Implemented by Gregory P. Smith; bpo-1706815(2).)

   * The *note xmlrpclib: 135. module no longer automatically converts
     *note datetime.date: 1fc. and *note datetime.time: 1fd. to the
     *note xmlrpclib.DateTime: 1601. type; the conversion semantics were
     not necessarily correct for all applications.  Code using
     ‘xmlrpclib’ should convert ‘date’ and ‘time’ instances.
     (bpo-1330538(3))

   * (3.0 警告モード) *note Exception: bd1. クラスはスライスやインデクス
     アクセスで警告を出します; ‘Exception’ のタプルのような振る舞いはの
     ちに取り除かれます。

   * (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): 1620. のセク
ションを参照してください。新しい '*note with: 187.' 文は後始末のコードを
書くのを簡単にします(*note PEP 343; "with" ステートメント: 1621. セクシ
ョン)。ジェネレータに値を返すことが出来るようになりました(*note PEP 342;
ジェネレータの新機能: 1622. セクション)。インポートが、絶対パス、相対パ
スのどちらかで可視に出来るようになりました(*note PEP 328;
絶対インポート、相対インポート: 1623. セクション)。例外ハンドリングのい
くつかの境界のケースで、より良いハンドリングを行えるようになりました
(*note PEP 341; try/except/finally の一体化: 1624. セクション)。これらの
どの改善も価値が高いですが、それらは言語機能を限定的に改善するものであっ
て、いずれも 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: 23e. スイッチが、少し能力を高めました。Python インタプリタ内での C 実
装に代わり、これの実現には新しいモジュール *note runpy: c3. を使うように
なっています。

*note runpy: c3. モジュールはインポートのメカニズムをより洗練された方法
で実装しているので、今では ‘pychecker.checker’ のようにパッケージ内のモ
ジュールも実行出来ます。このモジュールは異なるインポートメカニズム、例え
ば *note zipimport: 139. モジュールもサポートします。このことにより、
‘sys.path’ に .zip アーカイブのパスを追加して、 *note -m: 23e. スイッチ
でアーカイブ内のコードを実行する、といったことも出来ます。

参考
....

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: 8f9. statement came in two flavours.
You could use a *note finally: 1b1. block to ensure that code is always
executed, or one or more *note except: 1ac. 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: 1ac. ブロックと *note finally: 1b1. ブロックを組み合わ
せるのと等価なものをサポートしています。そしてこの作業が、このステートメ
ントがどういう意味であるべきかを明らかにしたのです。Python 2.5 では、あ
なたは今ではこう書くことが出来ます:

     try:
         block-1 ...
     except Exception1:
         handler-1 ...
     except Exception2:
         handler-2 ...
     else:
         else-block
     finally:
         final-block

'block-1' 内のコードが実行されます。そのコードが例外を投げた場合、個々の
*note except: 1ac. ブロックがテストされます: その例外が ‘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: bc6. 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(): 9dc. method, picking up
after the ‘yield’ statement.

In Python 2.3, *note yield: bc6. 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: bc6. 式の周りには括弧は付けておいた
ほうがいいと思います、この例でのように。括弧はべつに必要はないのですが、
どんな場合に必要かを憶えるよりは、いつでも付けるのが簡単でしょう。

( PEP 342(1) がその規則を正確に説明していますが、それによると *note
yield: bc6. 式は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を
付ける必要があります。つまり ‘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: bc6.
expression returns the specified 'value'.  If the regular *note next():
9dc. method is called, the ‘yield’ returns *note None: 886.

以下は前のと同じ例ですが、内部カウンタの値の変更を許す修正をしました:

     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: bc6. が *note None: 886. を返すことはよくあるのですから、そ
うなっていないかどうか必ずチェックしておくべきです。ジェネレータ関数を再
開するために使うメソッドが ‘send()’ しかないのだと確信してるのでない限り
、式の値をそのまま使ってはいけません。

ジェネレータには、 ‘send()’ のほかにも新しいメソッドが二つあります

   * ‘throw(type, value=None, traceback=None)’ はジェネレータ内で例外を
     投げるために使います; その例外はジェネレータの実行が停止したところ
     の *note yield: bc6. 式によって投げられます。

   * ‘close()’ はジェネレータ内で *note GeneratorExit: 15e5. 例外を投げ
     てイテレートを終了させます。この例外を受け取ったジェネレータのコー
     ドは ‘GeneratorExit’ か *note StopIteration: df9. を投げなくてはい
     けません; この例外を捕捉して何かほかのことをしようとするのは規則違
     反であり、 *note RuntimeError: 246. を引き起こします; 関数が何かほ
     かの例外を投げると、その例外は呼び出し元に伝播します。 ‘close()’ は
     ジェネレータのガーベージコレクトによっても呼ばれます。

     *note GeneratorExit: 15e5. が起こったときにクリーンアップ作業をする
     必要があるなら、 ‘GeneratorExit’ を捕捉するのではなく ‘try: ...
     finaly:’ するようお勧めします。

これらの変更の合わせ技で、ジェネレータは情報の一方的な生産者から、生産者
かつ消費者という存在に変貌を遂げたのです。

ジェネレータは 'コルーチン' という、より一般化された形式のサブルーチンに
もなります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所
(*note return: 1b0. 文) から出るだけですが、コルーチンはいろいろな場所
(*note yield: bc6. 文) から入ったり出たり再開したりできるのです。わたし
たちは 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: 1b1. clause will now always get a chance to run.  The syntactic
restriction that you couldn't mix *note yield: bc6. 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: 187.
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: 187.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 187.' ステートメントは基本構造が以下となる新しい制御フロー
構造です:

     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__(): 151c. 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__(): 151c. 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: 187.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 348. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     318, because *note __enter__(): 7e4. returns 'self'.

*note threading: f3. モジュールのロック・条件変数でも '*note with: 187.'
ステートメントの恩恵にあずかれます:

     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: 187.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘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__(): 151c. 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(): 89b. が返す
     値と同じで、例外が起こらなければ ‘None’ です)。そのメソッドの戻り値
     は例外を再送出するかどうかを制御します: 全ての偽の値ではその例外が
     再送出され、 ‘True’ では揉み消します。例外を揉み消すなど滅多なこと
     では欲しいと思わないでしょう。もしそうしてしまったら、 '*note with:
     187.' ステートメントを含んだコードの作者は何か間違ったことが起こっ
     たことに決して気付かないですから。

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 151c.
     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: 187.' 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__(): 151c. 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:
1b0. 文を書いてもよろしいです:

     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: 187.' ステート
メントで使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提
供しています。

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: bc6.
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: 187.' statement's ‘as’ clause, if any.  The
code after the ‘yield’ will be executed in the *note __exit__(): 151c.
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: 187.' を書く必要性をなくしてくれます。この例では
、単一の '‘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: 187.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*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: bd1. クラスと全ての標準組み込み例外
(*note NameError: 450, *note ValueError: 2ee, など) が今では新スタイルク
ラスです。

例外の継承階層が少し再編成されました。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: bc9. と *note
SystemExit: f40. はエラーではありませんが、普通は ‘Control’-‘C’ をユーザ
が叩いたか、コードが *note sys.exit(): 279. を呼び出したかのような明示的
なアクションを表します。剥き出しの ‘except:’ はまさに全ての例外を捕捉し
ますから、一般に、再送出のために ‘KeyboardInterrupt’ と ‘SystemExit’ は
リストする必要があります。お決まりのパターンはこんなです:

     try:
         ...
     except (KeyboardInterrupt, SystemExit):
         raise
     except:
         # Log error...
         # Continue running program...

Python 2.5 では同じ結果を得るのにもう ‘except Exception’ と書いても良い
です。これは普通はエラーを示す例外全てを捕捉しつつも *note
KeyboardInterrupt: bc9. と *note SystemExit: f40. は置き去りにします。無
論かつてまでのバージョン同様、剥き身の ‘except:’ は全例外を捕捉します。

Python 3.0 での目標は、例外として raise される全てのクラスが *note
BaseException: 7d6. からの、もしくは ‘BaseException’ のある子孫であるこ
とを要求することであり、Python 2.x シリーズの将来のリリースにおいてはこ
の制約の強制を始めるかもしれません。ですからあなたの全ての例外は、今から
すぐに *note Exception: bd1. 派生にするのが肝要です。捕捉例外を特定しな
い ‘except:’ は Python 3.0 から取り除かれるべきであることが提案されてい
ますが、Guido van Rossum はこれをどうするかまだ決めていません。 (--訳注:
2.7 では raise は「新スタイルクラスであれば」 ‘BaseException’ 派生である
ことを要求されますが、旧スタイルクラスであればなんでも許されてしまう点で
はあまり変わっていません。これについての警告は ‘-3’ などで受けることが出
来ます。Python 3.0 でようやく全ての例外が ‘BaseException’ 派生であること
が強制されるようになりました。 また、 ‘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:
c59. 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: c59. を使うようになっています。 *note PyList_Size(): 1638. の
ような関数は ‘Py_ssize_t’ を返します。拡張モジュール内のコードでは、です
ので、ある程度の変数の ‘Py_ssize_t’ への変更が必要でしょう。

The *note PyArg_ParseTuple(): 3bf. and *note Py_BuildValue(): 3c0.
functions have a new conversion code, ‘n’, for *note Py_ssize_t: c59.
‘PyArg_ParseTuple()’'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 ‘Py_ssize_t’.

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:
199. を送出します。

A corresponding *note nb_index: 163b. slot was added to the C-level
*note PyNumberMethods: 163c. 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: 184. 型に新たなフックが追加されています。サブクラスが、
     辞書に含まれないキーに対してデフォルトを提供出来るようにするもので
     す。キーが見つからない場合、辞書の ‘__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(): 110f. と *note max(): 1110. に、
     ‘sort()’ における ‘key’ に似たキーワード引数 ‘key’ が追加されました
     。このパラメータには関数を与えます。これは一つの引数を取り、リスト
     内の全ての値に対して呼び出されます; ‘min()’/‘max()’ はこの関数を全
     要素に適用したもののなかでの最小値/最大値を返します。例えば、リスト
     中の最長の文字列を探すにはこのように出来ます:

          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(): 163f. と *note all(): 1640.
     は、イテレータがいくつか真を含むかどうかを評価します。 ‘any()’ はイ
     テレータのいずれかが返す値が真と評価される場合に *note True: e0b. を
     返し、そうでなければ *note False: d2f. を返します。 ‘all()’ はイテ
     レータが返す値の評価が真のみの場合に ‘True’ を返します。 (Suggested
     by Guido van Rossum, and implemented by Raymond Hettinger.)

   * クラスの ‘__hash__()’ メソッドが返す値として、長整数と整数のどちら
     でも良くなりました。長整数が返されれば、その値のハッシュから取られ
     ます。以前のバージョンではこれは普通の整数であることが要求されてい
     ましたが、2.5 ではビルトイン関数 *note id(): 1641. が変更されて常に
     非負数が返り、ユーザはしばしば ‘__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: 1642. が引き起こされるようになっています。比較結果
     は偽です:

          >>> 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: c0c. を起こしていましたので
     、2.5 でのこれは辞書のアクセス時に悩ましい問題をもたらしました。キ
     ーとして使われている ‘unichr(128)’ や ‘chr(128)’ を探そうとすると
     ‘UnicodeDecodeError’ 例外が起こっていたでしょう。2.5 での、 辞書を
     実装している ‘dictobject.c’ のほかの変更により、これは揉み消すので
     はなく、引き続き例外を起こします(訳注: 原文では this exception とい
     っているので ‘UnicodeDecodeError’ が起こるように読めるのですが、2.5
     時点での振る舞いは確認出来ていませんが 2.7 では *note
     UnicodeWarning: 1642. とともに *note KeyError: 5e7. が発生する、の
     ようになるはずです。2.6 以降の What's New でのこれに関する言及はあ
     りませんが変更があったのかもしれません)。

     この種の比較で例外を起こすのは完全に正しいことではあるものの、その
     変更はコードを破壊するかもしれないので、必要に応じて警告に出来るよ
     う導入されたのが *note UnicodeWarning: 1642. です。

     (Implemented by Marc-André Lemburg.)

   * Python プログラマがよくしでかす間違いとして、パッケージディレクトリ
     に ‘__init__.py’ を入れ忘れる、というものがあります。この間違いのデ
     バッグはややこしく、大抵 Python を *note -v: 1643. スイッチ付きで起
     動して、パス検索全てをログ出力するハメになります。Python 2.5 ではパ
     ッケージディレクトリに ‘__init__.py’ がないことが検出されると新たに
     *note ImportWarning: 71e. 警告を出すようになりました。デフォルトで
     はこの警告は黙って無視されます; これを出したければ、 *note -Wd:
     aca. スイッチをつけて 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: f1b. を受け付けるようになりました。Windows の場合はヘルプメッ
セージを出力するのに *note /?: 1646. オプションも受け付けます。
(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: 185. と *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: 2ee. 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’ を持ちます。漸増的コーデックは入力を
     受け取って出力するのを複数チャンクに分けて行えます; 出力は非漸増的
     コーデックに一回で入力全体を渡したものと同じになります。詳細は
     ‘codecs’ モジュールのドキュメントを参照して下さい。 (Designed and
     implemented by Walter Dörwald.)

   * *note collections: 1e. モジュールに新たに追加された ‘defaultdict’ 型
     は、標準 *note dict: 184. のサブクラスです。この新しい型はほとんど
     辞書と同じに振る舞い、ただし、キーを要求された際にそのキーが存在し
     ていなかった場合に、自動的に辞書にデフォルト値を追加します。

     ‘defaultdict’ のコンストラクタの最初の引数は、キーが要求されて存在
     しない場合に呼び出されるファクトリ関数です。ファクトリ関数は引数を
     取りません。つまりこれに該当する *note list(): 24f. や *note int():
     19c. のようなビルトイン型のコンストラクタも使えます。例えば、その頭
     文字を基準に語の索引をこのように作ることが出来ます:

          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: 2ee. が送出されます。
     (Contributed by Raymond Hettinger.)

   * 新規モジュール: *note contextlib: 27. モジュールには '*note with:
     187.' ステートメントで使えるヘルパ関数が含まれています。詳細は
     *note contextlib モジュール: 1632. をみてください。

   * New module: The *note cProfile: 2b. module is a C implementation of
     the existing *note profile: b4. module that has much lower
     overhead.  The module's interface is the same as ‘profile’: you run
     ‘cProfile.run('main()')’ to profile a function, can save profile
     data to a file, etc.  It's not yet known if the Hotshot profiler,
     which is also written in C but doesn't match the ‘profile’ module's
     interface, will continue to be maintained in future versions of
     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(): 164b. and *note
     time.strftime(): 1406.:

          import datetime as dt

          ts = dt.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(): 14f4. function to allow
     opening files in binary or *note universal newlines: f39. mode.
     Another new parameter, 'openhook', lets you use a function other
     than *note open(): 318. to open the input files.  Once you're
     iterating over the set of files, the ‘FileInput’ object's new *note
     fileno(): 164c. returns the file descriptor for the currently
     opened file.  (Contributed by Georg Brandl.)

   * *note gc: 64. モジュールに、新しい関数 ‘get_count()’ が追加されてい
     ます。これは GC 3 世代についての現在の検出を含む 3 要素タプルを返し
     ます。これはガーベージコレクタの決算情報です; これらの数が指定され
     た閾値に到達すると、ガーベージコレクトのスイープが起こります。既存
     の *note gc.collect(): 1b5. 関数は省略可能な 'generation' 引数を取
     るようになっていて、これはどの世代を検出するかを指定する 0、1、2 で
     す。 (Contributed by Barry Warsaw.)

   * *note heapq: 6d. モジュールの ‘nsmallest()’ 関数と ‘nlargest()’ 関
     数がキーワードパラメータ ‘key’ をサポートするようになっています。こ
     れは *note min(): 110f./*note max(): 1110. 関数と ‘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(): d47. 関数が 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(): 19a. 関数が更新され
     、2 つの関数 ‘format_string()’ と ‘currency()’ が追加されました。

     *note format(): 19a. 関数の 'val' パラメータは以前は一つ以上の %文
     字指定子が現れる文字列が許されていました; 今はこのパラメータは正確
     に一つの %文字指定子を含む、周りに囲むテキストのない文字列でなけれ
     ばなりません。省略可能な 'monetary' パラメータも追加されています。
     これが ‘True’ の場合、通貨の書式化の 3 桁ごとに区切るセパレータに、
     ロケールのルールを使います。

     複数 %文字指定子を含む文字列をフォーマットするには、 *note
     format(): 19a. のように働き、任意のテキストと %文字指定子を混ぜた文
     字列をサポートする新しい ‘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(): 26f. が時刻の値を浮動小数点数で返すということです
     。(ただし必ずしも ‘os.stat()’ が秒の端数が正確な値を返すという意味
     ではありません; 全てのシステムがそのような精度をサポートしてはいま
     せん。)

     Constants named *note os.SEEK_SET: 14a9, *note os.SEEK_CUR: 14aa,
     and *note os.SEEK_END: 14ab. have been added; these are the
     parameters to the *note os.lseek(): 1333. function.  Two new
     constants for locking are *note os.O_SHLOCK: 164d. and *note
     os.O_EXLOCK: 164e.

     2 つの新しい関数 ‘wait3()’ と ‘wait4()’ が追加されています。これら
     は ‘waitpid()’ 関数に似ています。これは子プロセスが終了するのを待っ
     てプロセス ID とその終了コードを返しますが、 ‘wait3()’ と ‘wait4()’
     は追加の情報を返します。 ‘wait3()’ はプロセス ID を入力に取りません
     ので任意の子プロセス終了を待ち、 *note resource.getrusage(): 164f.
     関数から返る 'process-id', 'exit-status', 'resource-usage' の 3 要
     素タプルを返します。 ‘wait4(pid)’ はプロセス ID を取ります。
     (Contributed by Chad J. Schroeder.)

     FreeBSD では、 *note os.stat(): 26f. 関数がナノ秒精度の時刻を返し、
     また、返却オブジェクトが ‘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__(): bca. 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: 15b0. 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: 136. and ‘DocXMLRPCServer’ 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(): 1650. 関数を使っても
     得ることが出来ます。これはビルド情報についての文字列を返し、例えば
     ‘"trunk:45355:45356M, Apr 13 2006, 07:42:19"’ のような値です。
     (Contributed by Barry Warsaw.)

   * もう一つの新規関数 *note sys._current_frames(): 1651. は、実行スレ
     ッドについての現在スタックフレームを、各スレッドの識別子がキーの辞
     書として返します。辞書の値は、関数が呼ばれた時点のそのスレッドで現
     在アクティブになっているスタックフレームの一番上です。(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: 10c. 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: 1652.

   * 新モジュール: *note uuid: 117. モジュールは 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: 11b. モジュールの ‘WeakKeyDictionary’ 型と
     ‘WeakValueDictionary’ 型に、辞書内に含まれる弱参照を巡回する新たな
     メソッドが追加されています。 ‘iterkeyrefs()’ と ‘keyrefs()’ が
     ‘WeakKeyDictionary’ に追加され、 ‘itervaluerefs()’ と ‘valuerefs()’
     が ‘WeakValueDictionary’ に追加されました。(Contributed by Fred L.
     Drake, Jr.)

   * The *note webbrowser: 11c. 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(): 318. 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: 135. module now supports returning *note
     datetime: 4e2. objects for the XML-RPC date type.  Supply
     ‘use_datetime=True’ to the *note loads(): 1653. function or the
     ‘Unmarshaller’ class to enable this feature.  (Contributed by Skip
     Montanaro.)

   * *note zipfile: 138. モジュールが ZIP64 バージョンのフォーマットをサ
     ポートしました。これで 4GiB を超える zip 書庫を作れ、4GiB を超える
     ファイルを書庫に含めることが出来ます。 (Contributed by Ronald
     Oussoren.)

   * *note zlib: 13a. モジュールの ‘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.  ‘ctypes’ 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 ‘ctypes’ 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: 15bd. である
ことを前提としているからです; この規則を犯すことは頭を掻き毟るバグを引き
起こすでしょう。更新可能なメモリ領域が必要な場合は
‘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: 1f5. 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(): 1f5.; if it's omitted you end up
with a segmentation fault.

*note ctypes: 2e. が周辺ライブラリとして登場してしばらく経ちますが、
‘ctypes’ が存在していることに依存できないとなれば人々はまだハードコード
された拡張モジュールを書いて配布します。 ‘ctypes’ が Python 中核に含めら
れた今、おそらく開発者たちは、拡張モジュールの代わりに ‘ctypes’ を介して
アクセスするライブラリの上に 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.  ‘hashlib’ 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: 11f. パッケージは 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: c59. type
     definition instead of int.  See the earlier section *note PEP 353;
     添え字型に ssize_t を使う: 1636. 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(): e63, *note PyMem_Realloc(): 1237, and *note
     PyMem_Free(): 1660. are one family that allocates raw memory, while
     *note PyObject_Malloc(): e66, *note PyObject_Realloc(): 1661, and
     *note PyObject_Free(): e64. 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(): 1662. か *note PyFrozenSet_New(): 1663. を
     、要素の追加には *note PySet_Add(): 1664. 、削除には *note
     PySet_Discard(): 1665. 、 *note PySet_Contains(): 1666. と *note
     PySet_Size(): 1667. で集合オブジェクトの状態を調べます。
     (Contributed by Raymond Hettinger.)

   * C コードから Python インタプリタの正確なリビジョンについての情報を
     取得出来るようになりました。 *note Py_GetBuildInfo(): 1650. 関数を
     呼び出すことでビルド情報についての文字列が ‘"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: 1668. declares the function as returning a
     value of the specified 'type' and uses a fast-calling qualifier.
     *note Py_LOCAL_INLINE: 1669. 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(): 166a, 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; ジェネレータの新機能: 1622. で説明した PEP
     342(1) での変更により、 ‘gi_frame’ は ‘None’ になりえます。

   * Unicode 文字列とデフォルトの ASCII エンコーディングで Unicode に変
     換出来ない 8 ビット文字列との比較を試みると、新しい警告 *note
     UnicodeWarning: 1642. が引き起こされるようになっています。以前はそ
     のような比較では *note UnicodeDecodeError: c0c. 例外を起こしていま
     した。

   * ライブラリ: *note csv: 2d. モジュールは引用符内のマルチラインをより
     厳密に扱うようになっています。フィールド内に改行を埋め込んでいるフ
     ァイルがある場合は、その入力は改行文字を残すやり方で行分解されるは
     ずです。

   * ライブラリ: *note locale: 8a. モジュールの *note format(): 19a. 関
     数は、以前は %文字指定子が一つを超えてさえいなければ任意の文字列を
     受け付けていたかもしれませんが、Python 2.5 からは正確に一つの、ほか
     に周りをテキストで囲まれていない %文字指定子でなければなりません。

   * Library: The *note pickle: ab. and ‘cPickle’ modules no longer
     accept a return value of ‘None’ from the *note __reduce__(): bca.
     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: 136. and ‘DocXMLRPCServer’
     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: c59. 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 を使う: 1636. 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(): 185. の *note immutable: 15bd.
版です。 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: 2ee. を喰らい、問題を直すだけの
ことです。ですが、例えば 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: 1678. でメソ
ッドは普通に書いたのち、新型メソッドとしての関数へ仕立て上げる *note
staticmethod(): 451. または *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(): 451, とその仲間
たちが関数オブジェクトに追加的な情報を保存することから着想を得たものです
; それらは関数をより多くの詳細で 'デコレート (修飾) している' というわけ
です。

記法は 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: 14f0. 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(): a69. は読みやすく、実行が高速で、大体の場合はメモリ使用が少
なく済みます。

*note reversed(): a69. は任意のイテレータは受け付けず、シーケンスのみ受
け付けることに注意してください。イテレータを逆順にしたければ、最初に
*note list(): 24f. でリストに変換してください:

     >>> 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(): 167b.
と同じことをします。)

'stdin', 'stdout', 'stderr' はサブプロセスの入力・出力・エラーのストリー
ムを指定します。ファイルオブジェクトかファイル記述子を渡すことが出来ます
。あるいは定数 ‘subprocess.PIPE’ を渡してサブプロセスと親とのパイプを作
成することが出来ます。

コンストラクタには多くの便利なオプションがあります:

   * 'close_fds' はサブプロセス実行前に全てのファイル記述子をクローズす
     ることを要求します。

   * 'cwd' はサブプロセスを実行する作業ディレクトリを指定します (デフォ
     ルトは親の作業ディレクトリです)。

   * 'env' は環境変数を指定する辞書です。

   * 'preexec_fn' は子が開始する前に呼び出される関数です。

   * 'universal_newlines' で、子の入出力を、Python の *note universal
     newlines: f39. 機能で開きます。

‘Popen’ インスタンスを作ってしまえば、あとはサブプロセスが終了するまで停
止するために ‘wait()’ メソッド呼び出すことが出来、停止することなく終了を
チェックするのに ‘poll()’ メソッドを呼び出すことが出来、あるいは
‘communicate(data)’ を呼び出して、子の標準入力に 'data' を送信することが
出来ます。 ‘communicate(data)’ はサブプロセスが送信する標準出力と標準エ
ラー出力を読み込み、タプル ‘(stdout_data, stderr_data)’ を返します。

‘call()’ は ‘Popen’ コンストラクタにその引数を流し込むショートカットで、
コマンドが終了するまで待ち、サブプロセスの終了コードを返します。これは
*note os.system(): 167b. に対する安全な置き換えとなりえます:

     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: 15bd. です。 ‘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(): 185. 型と *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(): 1683. メソッドが *note dict: 184. コンストラク
     タと同じ形式の引数を取れるようになりました。これには任意のマッピン
     グ、キー/値ペアのイテラブルとキーワード引数を含みます。
     (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: 14b9. 関数を避
     けて非束縛メソッドを使えます。例えば上記の大文字小文字によらない並
     べ替えはこのように書くのが最善です:

          >>> 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(): dcc. と似た振る舞いをしますが、式内で使
     えます。違いは:

   * 入力には任意のイテラブルを取れます;

   * 新しく構築されたコピーをソートし、オリジナルは無傷のままにします; そ
     して

   * 式として新しいソート済みコピーを返します。

          >>> 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: 23e. スイッチが加わりました。これは
     名前を取り、 ‘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(): 1a1. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に空リストを返すようになりました。以前は *note
     TypeError: 199. 例外でした。これにより可変引数リストをこなしやすく
     なります:

          >>> 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: 886. が定数になっています。 ‘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(): 24f, *note tuple(): 614, *note map(): 1a0, *note
     filter(): a68, and *note zip(): 1a1. 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(): 1686. method now returns a list of the files that
     were successfully parsed, and the *note set(): 1488. method raises
     *note TypeError: 199. 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(): 24f. を代
     わりに使うほうが良いかもしれません。イテレータたちが相互に近い場所
     を追跡する場合は ‘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(): 1a0. や *note
     sorted(): dcb. とともに使う際の優れたデータ抽出器になります。例えば
     :

          >>> 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(): 1687. を通して 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: 1688. 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: 246. を投げようと
     しましたが、ある種のパターンではチェックをすり抜けてしまって、運が
     悪いとセグメンテーション違反を起こしていました。Python 2.4 の正規表
     現エンジンではこのパターンと問題を起こすことなくマッチ出来ます。

   * *note signal: cb. モジュールで、 *note signal.signal(): 1350. への
     パラメータのエラーチェックを厳しくしています。例えば ‘SIGKILL’ シグ
     ナルへのハンドラはセット出来ません。以前のバージョンの Python では
     これを黙って受け容れていましたが、2.4 では *note RuntimeError: 246.
     を投げます。

   * *note socket: d1. モジュールに 2 つ新しい関数が追加されています。
     ‘socketpair()’ 関数は接続したソケットのペアを返し、
     ‘getservbyport(port)’ は与えたポート番号からサービス名を探して返し
     ます。(Contributed by Dave Cole and Barry Warsaw.)

   * ‘sys.exitfunc()’ 関数は非推奨となりました。コードは既存の *note
     atexit: d. モジュールを使うべきです。これは複数の終了関数呼び出しを
     正しく処理出来ます。結果的には ‘sys.exitfunc()’ は純粋に ‘atexit’ の
     みから使われる内部インターフェイスとなるでしょう。

   * *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: 11b. モジュールがサポートするオブジェクトが非常に幅
     広くなりました。これには Python 関数、クラスインスタンス, set,
     frozenset, deque, array と正規表現パターンオブジェクトが含まれます
     。(Contributed by Raymond Hettinger.)

   * The *note xmlrpclib: 135. 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: 112. 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(): 168b. を実行するすることで行えますが、リファク
タリングはモジュールの操作をカスタマイズする色々な手段を提供してくれます
。

新規クラス ‘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: 168c. オプションフラグは、出力の期待値内での省略記号
(‘...’) と任意文字列を一致するとみなし、瑣末な部分が変化するような出力に
簡単に適合するように出来ます:

     def o (n):
         """>>> o(1)
     <__main__.C instance at 0x...>
     >>>
     """

もう一つの特殊文字列 ‘<BLANKLINE>’ は空行に合致します:

     def p (n):
         """>>> p(1)
     <BLANKLINE>
     >>>
     """

もう一つの新機能は出力の diff スタイル出力で、オプションフラグに *note
doctest.REPORT_UDIFF: 168d. (unified diffs), *note doctest.REPORT_CDIFF:
168e. (context diffs), *note doctest.REPORT_NDIFF: 168f. (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:
168d. 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: 1691, *note Py_RETURN_TRUE:
     1692, *note Py_RETURN_FALSE: 1693. (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: 1694.(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: 1695, allows a function
     defined in slots to co-exist with a *note PyCFunction: 1696. 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(): 1a1. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に、 *note TypeError: 199. 例外を起こすのではなく空リ
     ストを返すようになりました。

   * 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: 199.

   * ‘dircache.listdir()’ now passes exceptions to the caller instead of
     returning empty lists.

   * ‘LexicalHandler.startDTD()’ はパブリックでシステムの ID を間違った
     順序で受け取っていました。これは修正されました; この間違った順序に
     依存したアプリケーションは修正しなければなりません。

   * *note fcntl.ioctl(): 1699. は '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: 886. が定数になっています。 ‘None’ という名前に新しい値
     を割り当てようとするコードは、今では構文エラーになります。

   * ‘signals.signal()’ 関数は、ある種の不正な値では *note RuntimeError:
     246. を投げるようになっています。以前はこれらエラーは黙って通してい
     ました。例えばもう ‘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(): 169f.
のような、新たなビルトイン関数が少し追加されました。 *note in: 349. 演算
子がサブストリングの検索に使えるようになりました (例えば ‘"ab" in "abc"’
は *note True: e0b. を返します)。

たくさんのライブラリ新機能…、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: 15be. の集合のためのクラ
スで、メンバの追加と削除が出来ます。 ‘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(): 16a1. and *note intersection(): 16a2. 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(): 16a3.

     >>> 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(): 16a4.

     >>> 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: bc6. と
して、いつでもそこにあります。このセクションの残りの部分は "What's New
in Python 2.2" のジェネレータの記述からの丸々コピーですので、2.2 のとき
に読んだなら読み飛ばしてもらって結構です。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が *note return: 1b0. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: bc6. がジェネレータのために導入されました
。 ‘yield’ ステートメントを含むどんな関数もジェネレータ関数です; Python
バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳しま
す。 (--訳注: Python 2.5 の PEP 342 も参照して下さい。この 2.2 で導入時
点の ‘yield’ はステートメントではなく式に変更されています。--)

ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対
応したオブジェクトを返します。上の例で ‘yield’ を実行したとき、ジェネレ
ータは ‘return’ 文のようにして ‘i’ の値を生成します。 ‘yield’ と
‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレータの実行状
態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレー
タの ‘.next()’ メソッドを呼ぶと、 ‘yield’ の直後から関数が実行を再開しま
す。(複雑な理由により、 ‘yield’ は ‘try’...*note finally: 1b1. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: 8f9...‘finally’ 内に置けないという制
約はなくなりました。また、 ‘try’...‘finally’ の ‘try’ 、とここであえて特
定しているのは、同じく 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: 1b0. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: df9. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): 9dc. メ
ソッドが ‘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: 182. 文内では ‘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:
1a4. を引き起こします; 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: 139. が、ZIP フォーマットの書庫からモ
ジュールのインポートをサポートします。 ‘zipimport’ を明示的にインポート
する必要はありません; ‘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;
     新たなインポートフック: 16aa. をみてください。

   ---------- 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(): 318. 組み込み関数をはじめとするファイル名が期待される
全ての関数で許容します。 *note os.listdir(): 1316. に 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: 460. to be raised.  Applications can test whether
arbitrary Unicode strings are supported as file names by checking *note
os.path.supports_unicode_filenames: 16ac, a Boolean value.

MacOS では、 *note os.listdir(): 1316. は 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: f39. モードを使った
読み込みとしてファイルを開きます。これで ‘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(): 169f. はある種のループ処理を少し簡
潔にするものです。 '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(): 169f. を使ってこのように書き換えることが出来ま
す:

     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: d4a. が最も重要なクラスです。ほとんどのアプリケーションコ
ードは一つかそれ以上の ‘Logger’ オブジェクトを扱い、それぞれ一つはそのア
プリケーションの特定のサブシステムで使われるでしょう。それぞれの
‘Logger’ は名前で識別され、名前は ‘.’ をコンポーネントのセパレータとして
使う階層で体系化されます。例えば、 ‘server’, ‘server.auth’,
‘server.network’ といった名前の ‘Logger’ インスタンスを持つといった具合
です。この例の後ろ 2 つは階層で ‘server’ の下にあります。 ‘server’ への
冗長性を見つけた場合や ‘server’ メッセージを直接異なるハンドラに向けた場
合、変更は ‘server.auth’ と ‘server.network’ へのログ記録にも適用される
ということです。全てのほかのロガーの親となる、ルート ‘Logger’ もあります
。

単純な用法のために、 *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(): 16b1. method on the root logger.

Notice the *note warning(): 352. 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(): 16b2. 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: d4a. can prevent this by setting its *note propagate: 16b3.
attribute to *note False: d2f.

There are more classes provided by the *note logging: 8b. package that
can be customized.  When a *note Logger: d4a. instance is told to log a
message, it creates a *note LogRecord: 11ec. instance that is sent to
any number of different *note Handler: 16b4. instances.  Loggers and
handlers can also have an attached list of filters, and each filter can
cause the ‘LogRecord’ to be ignored or can modify the record before
passing it along.  When they're finally output, ‘LogRecord’ instances
are converted to text by a *note Formatter: 16b5. 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: e0b. and *note False: d2f.
(‘True’ and ‘False’ 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: 3c1. です; これのコンス
トラクタは任意の Python 値を取り、 *note True: e0b. または *note False:
d2f. に変換します:

     >>> 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: 182. ステートメントの式が必ず Boolean の結果に評
価されなければならないことを要求するでしょう。 Python はこの厳しさを今持
ちませんし、 PEP 285(1) が名言するように、未来永劫持つことはありません。
このことは、 ‘if’ ステートメントにこれからも任意の式を書けることを意味し
ますし、リストやらタプルやら何かほかのデタラメなオブジェクトに評価される
ものでも良いことを意味します。Boolean 型は *note int: 19c. クラスのサブ
クラスであって、Boolean の算術演算はこれからも動作します:

     >>> True + 1
     2
     >>> False + 1
     1
     >>> False * 75
     0
     >>> True * 75
     75

*note True: e0b. と *note False: d2f. はぶっちゃけて言えば…: これらは整
数値 1 と 0 の別名だけれども唯一異なるのは *note str(): 16a. と *note
repr(): 1c3. が ‘'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: 460. を発生させる)、 "ignore" (その文字を
スキップする)、 "replace" (出力文字列ではクエッションマークに置換する)、
のいずれか一つを指定出来て、 "strict" がデフォルトの振る舞いになっていま
す。その種のエラーのために、ほかの代わりとなる処理が望ましいかもしれませ
ん。例えば XML や HTML の実体参照に置き換えるなどの。

Python は今や、異なる処理戦略を追加する柔軟なフレームワークを手にしまし
た。新しいエラーハンドラを *note codecs.register_error(): 16b9. で追加出
来、コーデックは *note codecs.lookup_error(): 16ba. を使ってそのエラーハ
ンドラにアクセス出来ます。等価な 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(): 16c2. 関数はずっと長い間、テキストとするのかバイナリとす
るのかについてはサポートしていました。2.3 ではこのフラグは Boolean から
整数に再定義されました: 0 は旧式のテキストモード pickle フォーマット、1
が同じく旧式のバイナリフォーマット、そして 2 が今回の 2.3 から特有のフォ
ーマットです。新しく追加された定数 *note pickle.HIGHEST_PROTOCOL: 16c3.
を指定すると、最も望ましいものが選択されます。

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__(): bcb, and *note
__getnewargs__(): fd8.  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: 199. を起こしていました。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: 15be. なシーケンスに対して、拡張スラ
イスを代入や削除に使えますが、拡張スライスと普通のスライスではいくつかの
違いがあります。普通のスライスで代入を行えば、シーケンスの長さを変更出来
ます (--訳注: 念のため。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(): b41.  ‘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: 19c, *note str: 16a. などに対して行わ
れた同じ目的の修正と一貫しています。


File: python.info,  Node: その他の言語変更<18>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>,  Prev: 拡張スライス,  Up: What's New in Python 2 3

1.20.16 その他の言語変更
------------------------

以下が、Python 2.3 言語コアに加えられた全ての変更点です。

   * *note yield: bc6. 文がこのドキュメントの *note PEP 255;
     単純なジェネレータ: 16a6. で述べた通り、キーワードになっています。

   * 新たな組み込み関数 *note enumerate(): 169f. が追加されました。この
     ドキュメントの *note PEP 279; enumerate(): 16af. で述べた通りです。

   * 新たな定数 *note True: e0b, *note False: d2f. がビルトイン *note
     bool: 3c1. 型の追加に伴い追加されました。このドキュメントの *note
     PEP 285; Boolean 型: 16b7. で述べた通りです。

   * *note int(): 19c. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: a85. を投げる
     のではなく長整数を返すようになっています。これは
     ‘isinstance(int(expression), int)’ が偽を返すかもしれないという逆説
     的な結果をもたらし得ますが、これが実際に問題を起こすとはあまり思え
     ません。

   * ビルトイン型が拡張スライス構文をサポートするようになりました。この
     ドキュメントの *note 拡張スライス: 16c5. で述べた通りです。

   * 新規組み込み関数 ‘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(): 184. コンストラクタは小さな辞書を簡単に構築出
     来るよう、キーワード引数を受け付けるようになりました:

          >>> dict(red=1, blue=2, green=3, black=4)
          {'blue': 2, 'black': 4, 'green': 3, 'red': 1}

     (Contributed by Just van Rossum.)

   * *note assert: b64. ステートメントが ‘__debug__’ フラグをチェックす
     ることはもうありません。このため、 ‘__debug__’ に代入することによっ
     てアサーションを無効にすることは出来ません。Python を *note -O:
     18d. スイッチで起動により全てのアサーションが実行されない点は、以前
     と変わりません。

   * ほとんどの型オブジェクトが今では呼び出し可能であり、なので関数、ク
     ラス、モジュールのようなオブジェクトを新たに構築するのにそれを使え
     ます。 (‘new’ モジュールはこれにより将来のバージョンの Python で撤
     廃される可能性があります。 *note types: 10a. モジュール内の型オブジ
     ェクトが使えるからです。 --訳注: 2.6 で実際に撤廃されています。--)
     例えば、新規モジュールオブジェクトは以下コードで構築出来ます:

          >>> import types
          >>> m = types.ModuleType('abc','docstring')
          >>> m
          <module 'abc' (built-in)>
          >>> m.__doc__
          'docstring'

   * 新たな警告 *note PendingDeprecationWarning: ac9. が、将来廃止される
     予定のある機能であることを示すために追加されました。この警告はデフ
     ォルトで '出力されません' 。将来において廃止される予定の機能の使用
     をチェックするにはコマンドラインから *note
     -Walways;;PendingDeprecationWarning;;: aca. を与えるか、 *note
     warnings.filterwarnings(): 16c7. を使います。

   * 文字列ベースの例外、例えば ‘raise "Error occurred"’ のようなもの、
     これは廃止のための過程を開始しています。文字列を例外として投げると
     *note PendingDeprecationWarning: ac9. が発行されます。

   * ‘None’ を変数名に使うと *note SyntaxWarning: 1af. 警告を出すように
     なっています。将来バージョンの 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:
     16c8, 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__:
     16c9. and *note __bases__: 16ca. 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__: 16cb. 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: 349. 演算子が文字列に対して違った振る舞いをするようになり
     ました。以前は 'X' と 'Y' が文字列の場合の ‘X in Y’ は、 'X' は単一
     文字でなければなりませんでした。これが 'X' はどんな長さでも良くなり
     、 ‘X in Y’ は 'X' が 'Y' のサブストリングであれば *note True: e0b.
     を返すように変更されました。 'X' が空文字列の場合は結果は常に
     ‘True’ になります。

          >>> 'ab' in 'abcd'
          True
          >>> 'ad' in 'abcd'
          False
          >>> '' in 'abcd'
          True

     これはサブストリングの開始位置を教えてくれるわけではないので、その
     情報が必要であれば *note find(): 10ac. 文字列メソッドを使ってくださ
     い。

   * *note strip(): 16cd, *note lstrip(): 16ce, *note rstrip(): 16cf. に
     、剥ぎ取る文字を指定する省略可能な引数が追加されています。デフォル
     トは従来通り全ての空白文字を削除します。:

          >>> '   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(): 10cf. and *note endswith(): 10d0. string
     methods now accept negative numbers for the 'start' and 'end'
     parameters.

   * Another new string method is *note zfill(): 16d0, originally a
     function in the *note string: d8. module.  ‘zfill()’ 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
     ‘zfill()’.

          >>> '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: e0b. 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(): dcc. 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 その他の変更と修正: 16d2. 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: 13a. 圧縮データ
     よりも小さくなります。 (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:
     16d4, *note CFLAGS: 16d5, ‘CPP’, *note LDFLAGS: 16d6, and *note
     CPPFLAGS: 16d7. 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():
     ff8. function creates a *note unittest.TestSuite: ff9. object from
     a set of ‘doctest’ tests.

   * 新しい関数 ‘gc.get_referents(object)’ は 'object' により参照されて
     いる全てのオブジェクトのリストを返します。

   * The *note getopt: 65. module gained a new function, *note
     gnu_getopt(): 16d8, that supports the same arguments as the
     existing *note getopt(): 16d9. function but uses GNU-style scanning
     mode.  The existing ‘getopt()’ 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(): 16da. and
     *note heappop(): 16db. 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: e0b, 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)’ は、ラジアンと度の間の変換を行います。 ‘math’ モジ
     ュールの *note math.sin(): 16dc. や *note math.cos(): 16dd. などは
     常にラジアンでの入力が必要です。 *note math.log(): 16de. 関数には底
     を指定するオプショナルの '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: 16df. 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: 12d. 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: 16e0. attribute to
     *note True: e0b. 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(): 951.
     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(): 16e1, *note
     get_current_history_length(): 16e2, and *note redisplay(): 16e3.

   * The ‘rexec’ and ‘Bastion’ modules have been declared dead, and
     attempts to import them will fail with a *note RuntimeError: 246.
     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: a39. 例外を投げま
     す。

     オリジナルのタイムアウト実装は 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(): 16e4. is built on top of *note wrap(): 16e5.  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: 11d3. class that
     actually implements the text wrapping strategy.  Both the
     ‘TextWrapper’ class and the *note wrap(): 16e5. and *note fill():
     16e4. 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: 182. 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(): 164b. 関数は長いこと
     混乱の元でした。それがプラットフォームの C 関数 ‘strptime()’ を使い
     、異なったプラットフォームごとに時折おかしなバグを持っていたからで
     す。Brett Cannon は pure Python で、全てのプラットフォームで全く同
     じに振舞うように書き直した実装を寄稿しました。

   * 新規モジュール *note timeit: f5. は、Python コードの断片 (スニペッ
     ト) を実行するのにかかる時間を計測します。ファイル ‘timeit.py’ は直
     接コマンドラインから実行出来ますし、モジュールの *note Timer: 16e6.
     クラスをインポートして直接使うことも出来ます。以下に、空の 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__():
     14e7, *note __delitem__(): 14e8, ‘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: 129. can now
     generate XML output in a particular encoding by providing an
     optional encoding argument to the *note toxml(): c8e. and *note
     toprettyxml(): c8f. 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: 10f. は
     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: 1fc. は年・月・日を表現し、
*note time: 1fd. は時・分・秒を、 *note datetime: 4e2. が ‘date’ と
‘time’ の両方の属性すべてを持ちます。また、 *note timedelta: bc7. は 2 つ
の時刻の差を表現し、タイムゾーンのロジックは抽象クラス *note tzinfo:
7f6. から派生したクラスにより実装されます。

You can create instances of *note date: 1fc. and *note time: 1fd. 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(): 16e8. class
method returns the current local date.

構築後の日付時刻クラスのインスタンスは全て *note immutable: 15bd. です。
オブジェクトから書式文字列を生成する数多くのメソッドがあります:

     >>> import datetime as dt
     >>> now = dt.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(): 16e9. method allows modifying one or more fields of
a *note date: 1fc. or *note datetime: 4e2. instance, returning a new
instance:

     >>> d = dt.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(): d29. メソッドのものと同じです)。 と *note datetime:
4e2. はお互いに減算演算が可能で、 *note timedelta: bc7. インスタンスを加
算することも出来ます。最も大きな不足機能としては、文字列を解析して *note
date: 1fc. や ‘datetime’ へ戻すための標準ライブラリサポートはありません
。(--訳注: 2 点。「比較可能」の意味は 2.3 から 2.4 で意味が変わっていま
す。2.4 で ‘date’ と ‘datetime’ の比較は出来なくなりました。2.3 では出来
ていました。文字列からの ‘datetime’ 構築は 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 以降は ‘optparse’ よりも新
しい *note argparse: 7. を使ってください。--)

*note OptionParser: 16eb. インスタンスを作ることから始め、プログラムのオ
プションがどんなであるかそれに対して教えてやります:

     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(): 16ec. メソッドを呼び出すこと
で行います

     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(): e66. を使って獲得したメモリは ‘free()’ で
はなく *note PyObject_Free(): e64. を使って解放する必要があります。
Python に含まれるいくつかのモジュールがまさにこれに抵触し、修正の必要が
ありました。間違いなく多くのサードパーティモジュールが同じ問題を抱えてい
るでしょう。

この変更の一環として、メモリアロケーションのためのこんがらかった複数イン
ターフェイスが統合されて 2 つの API ファミリになりました。一方のファミリ
で獲得されたメモリは他方の関数で操作されることは許されません。一方のファ
ミリはメモリの塊を獲得するためのもので、もう一方は Python オブジェクトの
獲得に特殊化されたものです。

   * 何某かの区別のないメモリの塊を獲得・解放するのには「生メモリ」ファ
     ミリを使います: *note PyMem_Malloc(): e63, *note PyMem_Realloc():
     1237, *note PyMem_Free(): 1660.

   * 「オブジェクトメモリ」ファミリは上述の pymalloc 機構へのインターフ
     ェイスであり、多数の「小さな」獲得をするための特化がされています:
     *note PyObject_Malloc(): e66, *note PyObject_Realloc(): 1661, *note
     PyObject_Free(): e64.

   * Python オブジェクトの獲得と解放には「オブジェクト」ファミリ *note
     PyObject_New: b80, *note PyObject_NewVar: b81, *note
     PyObject_Del(): 16ef. を使います。

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:
     16f1. を使って宣言されなければならなくなりました。

   * ‘configure’ スクリプトに ‘--without-doc-strings’ オプションを与える
     ことで、ビルトイン関数とモジュールが docstring を持たないインタプリ
     タとしてコンパイル出来るようになりました。これは Python の実行形式
     ファイルを 10% 小さくしますが、もちろん Python ビルトインのヘルプが
     取得できないことにもなります。 (Contributed by Gustavo Niemeyer.)

   * ‘PyArg_NoArgs()’ マクロが非推奨となったので、これを使っているコード
     は修正しなければなりません。Python 2.2 以降ではメソッド定義テーブル
     では引数を持たず、引数チェックを省けることを示すのに *note
     METH_NOARGS: 16f2. フラグが使えます。2.2 以前の Python バージョンと
     の互換性が重要な場合には ‘PyArg_ParseTuple(args, "")’ を代わりに使
     えますが、 ‘METH_NOARGS’ を使うより遅いです。

   * *note PyArg_ParseTuple(): 3bf. に符号なし整数の色々なサイズのための
     フォーマット文字が追加されました: 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: 16f3. or
     *note METH_STATIC: 16f4. flags in a method's *note PyMethodDef:
     16f5. 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__: 16c9. 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: 16f8. をセットしておくと、Python イン
     タプリタが Python プログラム実行後に対話モードに入ります。これは
     Python を *note -i: 16f9. で起動するのと同じです。環境変数は 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: 18d. なし
     で Python を実行する際のわずかなスピードアップを別とすれば、困難か
     もしれません。

     フレームオブジェクトの *note f_lineno: 9b3. フィールドにアクセスし
     ている C 拡張は、代わりに ‘PyCode_Addr2Line(f->f_code, f->f_lasti)’
     を呼び出すべきです。これは以前の Python バージョンでも "python -O"
     のもとでコードが動作するのにも望ましい効果を持つでしょう。

     気の利いた新機能としては、トレース関数は、今ではフレームオブジェク
     トの *note f_lineno: 9b3. 属性を、次に実行される行に変更してセット
     します。 *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: bc6. は今では常にキーワードです。変数名として使ってい
     たならば、別の名前を選ぶ必要があります。

   * 文字列 'X' と 'Y' について、 ‘X in Y’ は 'X' が一文字以上の場合でも
     動作するようになりました。

   * *note int(): 19c. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: a85. を投げる
     のではなく長整数を返すようになっています。

   * 8 ビット文字を含んだ Unicode 文字列をソースコードに埋め込む場合、フ
     ァイルのエンコーディング (UTF-8, Latin-1, あるいはほか何か) を、フ
     ァイルの先頭のコメントに宣言しなければなりません。 *note PEP 263;
     ソースコードのエンコーディング: 16a8. を参照してください。

   * ‘_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: 1af. 警告を出すように
     なっています。

   * 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: 1702. 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 関連リンク: 1703. を参照してください。

* 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: c82. という名の新スタイルクラスは全ての組み込み
型の基底クラスとして既に追加されていて、相応しい組み込み型がなければ単に
‘object’ をサブクラス化すれば良いです:

     class C(object):
         def __init__ (self):
             ...
         ...

This means that *note class: 14f3. 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: c82.)

組み込み型(ビルトイン型)のための型オブジェクトは、クレバーなトリックを使
って名付けられた組み込み(ビルトイン)として利用可能です。Python は既に組
み込み関数 *note int(): 19c, *note float(): 197, *note str(): 16a. を持
っていました。2.2 にはその関数はなくなり、型オブジェクトは呼び出されると
ファクトリとして振舞います:

     >>> int
     <type 'int'>
     >>> int('123')
     123

To make the set of types complete, new type objects such as *note
dict(): 184. 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__: 1276. は属性の名前です。

   * *note __doc__: b25. 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__: 1706. 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(): 451. 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():
1a7, 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(): 1a7. は ‘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__(): dcf. 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__: 1709. を使うと、オブジェ
クトで参照出来る属性リストを制約することが出来ます。Python オブジェクト
は普通非常に動的で、どんなときにもインスタンスに対して単に
‘obj.new_attr=1’ とするだけで新しい属性を定義出来ます。新スタイルクラス
は ‘__slots__’ という名前のクラス属性を定義出来、これにより適正な属性名
集合を特定の集合に制限出来ます。実例をみるのが早いです:

     >>> 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__: 1709. リストに含めなかった属性への代入を試みて *note
AttributeError: 5f0. になっていることに注目してください。


File: python.info,  Node: 関連リンク,  Prev: 属性アクセス,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.5 関連リンク
...................

このセクションは新機能について、あなたがプログラミングを始める説明として
は十分な簡単な概要だけ示しました。ですが、多くの詳細は、単純化したり無視
しています。もっと完全な光景を眺めたければ、どこに行けば良いでしょうか?

The *note デスクリプタ ガイド: 170b. 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: 348. 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
‘__getitem__()’ calls will be made with 'index' incrementing by one each
time.  In other words, the presence of the ‘__getitem__()’ 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: 170d. function in order to return an
iterator, and extension types that want to behave as iterators can
define a *note tp_iternext: 170e. function.

それでは、結局のところイテレータは実際どんなでしょうか?  これに必要なメ
ソッドは一つ、 *note next(): 9dc. です (--訳注: Python 3 で ‘__next__’ に
変更されています--)。これは引数を取らず、次の値を返します。返すべき値が
なくなったら、 ‘next()’ 呼び出しは *note StopIteration: df9. 例外を送出
しなければなりません:

     >>> 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: 348. statement no longer expects a sequence;
it expects something for which *note iter(): 9db. 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: 170d. 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(): 9db. を呼び出すと、キーの反復をするイテレー
タが返ります:

     >>> 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: 349. 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(): 9dc. メソッドのみ
です。

参考
....

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: 1b0. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: bc6. がジェネレータのために導入されました
。 ‘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: 1b1. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: 8f9...‘finally’ 内に置けないという制
約はなくなりました。また、 ‘try’...‘finally’ の ‘try’ 、とここであえて特
定しているのは、同じく 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: 1b0. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: df9. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): 9dc. メ
ソッドが ‘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: 182. 文内では ‘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: 199. 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: a85. となっていたような多くの演算が
、今ではその結果として長整数を返します。例えば:

     >>> 1234567890123
     1234567890123L
     >>> 2 ** 64
     18446744073709551616L

ほとんどのケースで、今や整数と長整数は同じものとして扱われるでしょう。
*note type(): f48. ビルトインで今でも区別出来ますが、ほとんど必要ないで
しょう (-- 訳注: 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__(): 1094. and
     *note __floordiv__(): 1712. to overload the two division operators.
     At the C level, there are also slots in the *note PyNumberMethods:
     163c. 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: 2ee.
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: 13a. モジュールでの圧縮のためのエ
ンコーディングが追加されています:

     >>> 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: 450. 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: 14b9. 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: 1678. 、 *note class: 14f3. または *note
import: 7f8. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細は PEP で参照でき
ます。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 14b9. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 18f. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     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: 135. 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: 136. 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:
     1716.  The enhanced functions include *note stat(): 26f, *note
     fstat(): f90, *note statvfs(): 1318, and *note fstatvfs(): f91. in
     the *note os: a5. module, and *note localtime(): 1717, *note
     gmtime(): 13dc, and *note strptime(): 164b. 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(): ad8. ビルトインが追
     加されています。これは Python 2.1 で導入された *note pydoc: ba. モ
     ジュールを用いて対話的なヘルプを提供します。 ‘help(object)’ で
     'object' について手に入る任意のヘルプを表示します。 ‘help()’ を引数
     なしで起動するとオンラインのヘルプユーティリティに入ります。ここか
     ら関数名やクラス名、モジュール名をタイプすることで、それらのヘルプ
     テキストを読むことが出来ます。 (Contributed by Guido van Rossum,
     using Ka-Ping Yee's ‘pydoc’ 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():
     1718. 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 トラフィックが可
     能になりました。 ‘smtplib’ は 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: 1719. class, which takes a list of filenames to be
     parsed.  (Contributed by Fred L. Drake, Jr.)

   * A *note Timer: 1375. 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(): 171b. と *note
     PyEval_SetTrace(): 663. が Python API に追加されました。既存の
     *note sys.setprofile(): 171c. 関数、 *note sys.settrace(): 2e3. 関
     数はそのまま存在し、単純に新規 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(): 171d. and *note
     PyInterpreterState_Next(): 171e. let a caller walk through all the
     existing interpreter objects; *note
     PyInterpreterState_ThreadHead(): 171f. and *note
     PyThreadState_Next(): 1720. 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: 985.

   * 
     オブジェクトのアロケートには *note PyObject_GC_New(): c9d. または *note PyObject_GC_NewVar(): c9e. を使ってください。

          そしてオブジェクトのデアロケートには *note PyObject_GC_Del():
          1721. を使ってください。

   * Rename ‘PyObject_GC_Init()’ to *note PyObject_GC_Track(): 1722. and
     ‘PyObject_GC_Fini()’ to *note PyObject_GC_UnTrack(): 1723.

   * Remove ‘PyGC_HEAD_SIZE’ from object size calculations.

   * Remove calls to ‘PyObject_AS_GC()’ and ‘PyObject_FROM_GC()’.

   * *note PyArg_ParseTuple(): 3bf. に新たな書式化シーケンス ‘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():
     1724, 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: 16f2. and *note METH_O: 1725. 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: 1726.  Also, the old ‘METH_OLDARGS’
     style of writing C methods is now officially deprecated.

   * Two new wrapper functions, *note PyOS_snprintf(): 1727. and *note
     PyOS_vsnprintf(): 1728. 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(): 1729. 関数の未使用パラメータを取り除いたの
     で、今後は 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:
     199. 例外を励起するようになりました。

   * Python 2.1 で拡張モジュールとして追加された弱参照は、今では Python
     中核の一部です。これは新スタイルクラスの実装のために使われるからで
     す。このため *note weakref: 11b. モジュールにいた *note
     ReferenceError: 172b. 例外をビルトイン例外に移動しました。

   * 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: 349. 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(): 172c. 関数と *note sys.setdlopenflags():
     133b. 関数でセット出来るようになりました。 (Contributed by Bram
     Stolk.)

   * The *note pow(): 1a5. 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: 199. 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: 450. 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: 14b9. 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.1の最も重要な変更点は、この問題を解決するために静的なスコープが
追加されたことです。最初の効果として、‘name=name’ という例ではデフォルト
の引数は必要ありません。簡単に言えば、指定された引数名が関数内の値に割り
当てられない場合(*note def: 1678.、*note class: 14f3. または *note
import: 7f8. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細はPEPで参照できま
す。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 14b9. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 18f. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     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__(): 14bc.
                
                
‘<=’            *note __le__(): 1526.
                
                
‘>’             *note __gt__(): 1527.
                
                
‘>=’            *note __ge__(): 1528.
                
                
‘==’            *note __eq__(): cf6.
                
                
‘!=’            *note __ne__(): 1735.
                

(特殊メソッドは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: 119. モジュールを追加します。サードパーティーのモジュールはま
た、彼らがサポート対象外にしたい古い機能を非推奨と知らしめるのにこのフレ
ームワークを利用できます。

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(): 1737. 関数を呼び出すことで発行できます:

     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: 1a4. 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: 11b. モジュールを通して利用出来る弱参照(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: 11b. 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__: 13f5. 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__: 14ee.  Unlike the *note __dict__: e5b. attribute of
class instances, in functions you can actually assign a new dictionary
to ‘__dict__’, 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: b59. をセットすることで要求出来ます。


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(): 1c3. 関数が使われます。Python 2.1 ではこの
‘repr()’ の代わりに呼び出される呼び出し可能オブジェクトを、 *note
sys.displayhook(): 173d. 変数にセット出来ます。たとえば特別な 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:
199. が送出されます。Python で書かれた数値メソッドも ‘Py_NotImplemented’
を返せます。この場合インタプリタはメソッドが存在しないものとして振舞いま
す。 (おそらく ‘TypeError’ が投げられたり、オブジェクトのほかの数値メソ
ッドが試されます。)

参考
....

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: 121f, 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: 127.
     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(): a10. には呼び出し可能オブジェクトをセ
     ット出来ます。例外がどの *note try: 8f9...*note except: 1ac. にも捕
     捉されない場合に、例外は ‘sys.excepthook()’ に通されて、そこで好き
     なことを何でも出来ます。9 回目の Python カンファレンスにおいて、
     Ping はこのフックを使ったアプリケーションのデモを行いました。そこで
     は、スタックフレームを列挙するだけでなくそれぞれのフレームでの関数
     の引数とローカル変数の列挙も行う拡張トレースバックの表示をしていま
     した。

   * Various functions in the *note time: f4. module, such as *note
     asctime(): 1404. and *note localtime(): 1717, 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 パッケージがファ
     イル取得に ‘ftplib’ を使い、ファイアウォールの元で動作しなかったの
     です。このことが誰かの問題になるとは思えません。Netscape のデフォル
     トがパッシブモードですし、苦情を言う人々も稀でした。ですがもしもパ
     ッシブモードがあなたのアプリケーションやネットワーク構成にとって不
     適切である場合には、FTP オブジェクトの ‘set_pasv(0)’ を呼び出して、
     パッシブモードを無効にしてください。

   * *note socket: d1. モジュールに、Grant Edwards により寄稿された、生
     のソケットへのアクセスのサポートが追加されました。

   * *note pstats: b5. モジュールに、Python プログラムの時間計測プロファ
     イルを表示する単純な対話的統計ブラウザが含まれるようになり、これは
     モジュールがスクリプトとして実行された場合に呼び出されます。Eric S.
     Raymond によって寄稿されました。

   * 実装依存の関数ですが ‘sys._getframe([depth])’ が、現在の呼び出しス
     タックより、指定したフレームオブジェクトを返すものとして追加されま
     した。 *note sys._getframe(): 8f1. は呼び出しスタックの一番上のフレ
     ームを返します。オプショナルな整数引数 '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:
     1742, it has to be freed using *note PyMem_Del(): 1743, 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(): 1744, 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(): 1c3. を適用するとこれまでは表示出来ない文字
     について、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(): 3da, 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: 15bd. なシ
ーケンス型です。添え字でアクセス出来、スライス出来ますが、インプレイスに
変更することは出来ません。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: 10c. は、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(): 1a0. 関数、 *note filter(): a68. 関数がこの目的
のためには使えますが、それらにはその引数の一つに関数が必要です。何か既存
のビルトイン関数で直接渡せるものがあればよいのですが、これがない場合その
必要とされる仕事をする小さな関数を作る必要があって、また、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: 14b9. 式で作っている匿名関
数にデフォルト引数を使い、これに検索対象の部分文字列を渡しています。リス
ト内包表記はこれを明快にします:

     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: 182. 節はオプショナルです。これがあれば '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: 15bd. だということです。ですの
で文字列メソッドは新しい文字列を返し、それが操作する文字列を変更しません
。

古い *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(): 1c3. を挿入します。これは対称性の検討からも考えられまし
た。今の場合は既存の '%s' が引数の *note str(): 16a. を挿入することに呼
応するものです。例えば ‘'%r %s' % ('abc', 'abc')’ は文字列 ‘'abc' abc’ を
返します。

Previously there was no way to implement a class that overrode Python's
built-in *note in: 349. 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: 1753. 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: 450. 例外はよく混乱するものであり、この欠点を軽減する試みがな
されました。例えば下に挙げるコードは ‘print’ 文で 1.5.2 と 2.0 の両方で
例外が発生しますが、1.5.2 は ‘NameError’ 例外が、2.0 では新規の例外
*note UnboundLocalError: 1754. が投げられます。 ‘UnboundLocalError’ は
‘NameError’ のサブクラスですので ‘NameError’ が投げられることを想定する
既存のコードはそのまま動作するはずです。:

     def f():
         print "i=",i
         i = i + 1
     f()

2 つの新規例外 *note TabError: 765. と *note IndentationError: 1755. が
導入されました。これらはともに *note SyntaxError: 18f. のサブクラスで、
Python コードに不適切なインデントが見つかると送出されます。


File: python.info,  Node: ビルトイン関数の変更,  Prev: 言語のマイナー変更,  Up: その他の言語コアの変更

1.23.9.2 ビルトイン関数の変更
.............................

新しいビルトイン関数 ‘zip(seq1, seq2, ...)’ が追加されました。 *note
zip(): 1a1. はタプルのリストを返します。それぞれは、引数のシーケンスのそ
れぞれの i 番目要素たちを含むタプルです。 ‘zip()’ と ‘map(None, seq1,
seq2)’ の違いは、 *note map(): 1a0. はシーケンスが同じ長さを持たない場合
に ‘None’ が埋められるのに対し、 ‘zip()’ は返すリストの長さを、引数のシ
ーケンスの最も短い長さに切り詰めます。

The *note int(): 19c. 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: 199. 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(): 8dd. and *note insert(): 13b4.  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:
199. 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(): 3bf, 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: 1758. と *note socket.bind: 12db. も同じようにおおら
かです。2.0alpha1 がそれら関数を厳しくしたのですが、ドキュメントが実際に
は複数引数を取る形式で誤って書かれたために、多くの人々がその厳しくなった
チェックに違反してしまうコードを書いてしまいました。GvR はその変更を、市
民たちの反応を受けて元に戻し、 ‘socket’ モジュールについてはドキュメント
は修正されて、複数引数形式は非推奨としてマークするに留められました。将来
バージョンの Python においてこれはもう一度厳しく 'なります' 。 (--訳注:
What's New からは読み取れませんが少なくとも 2.7 では単一引数でしか渡せま
せん。つまり明示的にタプルにして渡す必要があります。--)

文字列リテラル内の ‘\x’ エスケープは、正確に 2 桁の 16 進表記文字になり
ました。以前は 'x' に続く 16 進表記文字全てを消費して最後の 8 ビットを使
っていたため、 ‘\x123456’ は ‘\x56’ と同じでした。

例外 *note AttributeError: 5f0. と *note NameError: 450. がよりフレンド
リなエラーメッセージを持つようになっています。それらのテキストは ‘'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: 199.  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(): 16a. してももは
や末尾の 'L' 文字が付かないことです。 *note repr(): 1c3. では今でも付く
のにも関わらずです。 'L' は長整数を普通の整数と全く同じように印字したい
多くの人々を悩ませてきました。それを各々自分なりの手段で取り除く必要があ
ったからです。これはもう 2.0 では問題でなくなりましたが、 'L' が付くこと
をあてにして ‘str(longval)[:-1]’ とするコードが今度は数値の最後の桁を失
ってしまいます。

Taking the *note repr(): 1c3. of a float now uses a different formatting
precision than *note str(): 16a.  ‘repr()’ uses ‘%.17g’ format string
for C's ‘sprintf()’, while ‘str()’ uses ‘%.12g’ as before.  The effect
is that ‘repr()’ may occasionally show more decimal places than ‘str()’,
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(): 2af. and *note issubclass(): 9c8.  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(): 175a, and
*note PyModule_AddStringConstant(): 175b.  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(): 175c. でシグナルハンドラを取得し、 *note PyOS_setsig():
175d. で新しいハンドラをセットします。


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: 127. 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(): 1761.
and *note endElement(): 1762. methods are called for every starting and
end tag encountered by the parser, the *note characters(): 1763. 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: 129. 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: 127. package.

結論として、Python 2.0 の *note xml: 127. パッケージは PyXML と互換性が
ありません。ですが、直近バージョンの PyXML をインストールすることで互換
性を持たせることができます。 多くのアプリケーションは Python 2.0 に含ま
れる XML サポートで十分ですが、より複雑なアプリケーションは完全なPyXML パ
ッケージをインストールする必要があります。 インストールされた PyXML バー
ジョン 0.6.0 以上は、Python に同梱されている ‘xml’ パッケージを置き換え
、標準パッケージの厳密なスーパーセットとなり、多くの追加機能が追加されま
す。 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,
‘readline’, ‘xmllib’, ‘aifc’, ‘chunk’, *note wave: 11a, *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 ‘socket’ module: ‘socket.ssl(socket, keyfile,
certfile)’, which takes a socket object and returns an SSL socket.  The
*note httplib: 72. and *note urllib: 10f. 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’ に直接セットしてきたコードは
     ‘atexit’ モジュールを代わりに用いるように修正してください。
     ‘atexit’ をインポートし、 *note atexit.register(): a82. で終了時に
     呼び出す関数を登録します。(Contributed by Skip Montanaro.)

   * *note codecs: 1c, ‘encodings’, *note unicodedata: 10c.: 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: 15be. な文字列であるかのように振る舞い、これによ
     り読み書き出来ます。それらは例えば *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: 114.: 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: 11c.: 指定した URL で、プラットフォームに依存しな
     い方法でウェブブラウザを起動するモジュールです。個々のプラットフォ
     ームにおいて様々なブラウザが特定の順序で試されます。ユーザはどのブ
     ラウザを起動するかを環境変数 'BROWSER' をセットすることで変更出来ま
     す。(元々は Eric S. Raymond による *note urllib: 10f. への、同じ機
     能追加をするパッチに触発されましたが、最終的なモジュールは Fred
     Drake が元々 ‘Tools/idle/BrowserControl.py’ として実装したものに由
     来し、Fred が標準ライブラリに適合させました。)

   * *note _winreg: 11d.: 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: 138.: 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.6 final: Python 3 14 6 final.
* Python 3.14.5 final: Python 3 14 5 final.
* Python 3.14.5 release candidate 1: Python 3 14 5 release candidate 1.
* Python 3.14.4 final: Python 3 14 4 final.
* 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 6 final,  Up: 変更履歴

1.24.1 Python next
------------------

'Release date: XXXX-XX-XX'

* Menu:

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


File: python.info,  Node: テスト,  Next: セキュリティ,  Up: Python next

1.24.1.1 テスト
...............

   - gh-148853(1): Fix tests failing on FreeBSD in test.support's
     in_systemd_nspawn_sync_suppressed() due to unreadable /run
     directory.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148853


File: python.info,  Node: セキュリティ,  Next: ライブラリ,  Prev: テスト,  Up: Python next

1.24.1.2 セキュリティ
.....................

   - gh-151981(1): In *note tarfile: e4, seeking a stream now stops when
     end of the stream is reached.

   - gh-151544(2): ‘Modules/Setup.local’ is no longer used as a landmark
     to discover whether Python is running in a source tree, as it could
     potentially affect actual installs.  The ‘pybuilddir.txt’ file is
     now the sole indicator of running in a source tree.

   - gh-151558(3): Fixed an vulnerability in the *note tarfile: e4.
     ‘data’ and ‘tar’ extraction filters where crafted archives could
     create a symlink pointing outside the destination directory.  This
     was a bypass of CVE 2025-4330(4).

   - gh-143927(5): Normalize all line endings (CR, CRLF, and LF) to
     LF+TAB when writing multi-line configparser values.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151981

   (2) https://github.com/python/cpython/issues/151544

   (3) https://github.com/python/cpython/issues/151558

   (4) https://www.cve.org/CVERecord?id=CVE-2025-4330

   (5) https://github.com/python/cpython/issues/143927


File: python.info,  Node: ライブラリ,  Next: ドキュメント<2>,  Prev: セキュリティ,  Up: Python next

1.24.1.3 ライブラリ
...................

   - gh-151842(1): Fix a crash in ‘_interpreters.capture_exception()’
     when *note MemoryError: 1772. happens.  Patch by Amrutha Modela.

   - gh-78335(2): Update the docstrings of *note tkinter: f6. and *note
     tkinter.ttk: 100. widget classes to list all supported widget
     options, including options added in Tk 9.0 and 9.1.
     ‘tkinter.Menubutton’ and ‘tkinter.Message’ previously had no option
     list at all.

   - gh-151126(3): Fix two crashes in *note tkinter: f6. and *note
     socket: d1. modules initialization under a memory pressure.  Sets
     missing *note MemoryError: 1772.

   - gh-71880(4): *note curses.textpad.Textbox: 1773. now lets the
     lower-right cell of the window be edited.  Writing it with *note
     addch(): 1774. would move the cursor past the end of the window,
     raising an error and scrolling a scrollable window, so it is now
     written with *note insch(): 1775, which keeps the cursor in place.

   - gh-152305(5): Fix the pure-Python *note datetime.time.strftime():
     1776. implementation raising *note AttributeError: 5f0. for the
     year directives.  Patch by tonghuaroot.

   - gh-88758(6): ‘tkinter.Misc.focus_get()’, ‘focus_displayof()’,
     ‘focus_lastfor()’ and ‘winfo_containing()’ now return ‘None’
     instead of raising *note KeyError: 5e7. when the widget was not
     created by *note tkinter: f6. (for example a torn-off menu).

   - gh-38464(7): ‘tkinter.Misc.nametowidget()’ now resolves the
     auto-generated names of cloned menus (a menu used as a menubar or a
     cascade) back to the original widget.

   - gh-80937(8): Fix a memory leak in *note tkinter: f6. when a Tcl
     command created with ‘createcommand’ was not explicitly removed
     before the interpreter was deleted.  The command no longer keeps
     the interpreter alive through a reference cycle.

   - gh-152246(9): Fix the pure-Python *note zoneinfo: 13b. parser
     accepting an invalid POSIX TZ transition rule with a non-period
     separator.  Patch by tonghuaroot.

   - gh-139816(10): Fix a hang in *note tkinter: f6. on interactive
     Python built without *note readline: bf.  An exception raised in a
     callback no longer causes the event loop to stop and wait for the
     user to press Enter; pending callbacks now keep running until input
     is actually available on stdin.

   - gh-139145(11): Fix a busy loop in *note tkinter: f6. on interactive
     Python.  When a Tcl command running its own event loop (such as
     ‘vwait’ or ‘wait_variable()’) was active and input arrived on
     stdin, the event loop kept spinning at 100% CPU. The stdin file
     handler is now removed as soon as input is available.  Based on a
     patch by Michiel de Hoon.

   - gh-152212(12): Fix the pure-Python *note zoneinfo: 13b. parser
     accepting a POSIX TZ string with a ‘std’ abbreviation but no
     offset.  This is invalid per POSIX and now raises *note ValueError:
     2ee, matching the C accelerator.  Patch by tonghuaroot.

   - gh-152156(13): Fix a possible crash in *note
     concurrent.interpreters.create(): 1777. under limited memory
     conditions.

   - gh-151763(14): Fix crash in ‘_interpqueues.create()’ whe *note
     MemoryError: 1772. happens on queue creation.

   - gh-105895(15): Add *note match: a12. and *note case: 1778. to the
     list of supported topics by *note help(): ad8.

   - gh-152079(16): Fix *note datetime.datetime.fromisoformat(): 82a. in
     the C implementation dropping the sub-second part of a UTC offset
     whose whole-second part is zero, matching the pure-Python
     implementation.

   - gh-152052(17): The *note json: 86. C accelerator now correctly
     reports an unterminated string for a ‘\uXXXX’ escape at the end of
     the input.

   - gh-126219(18): Fixed a crash in *note tkinter.Tk: 1779. when
     'className' contains a non-BMP character and tkinter is built
     against Tcl/Tk 8.x.  Such a name is now rejected with a *note
     ValueError: 2ee.

   - gh-151814(19): Fix unbounded memory growth in *note
     io.TextIOWrapper: 9c2. when repeatedly writing an empty string.

   - gh-151770(20): Fix *note datetime.datetime.fromisoformat(): 82a.
     raising *note AssertionError: 8b9. instead of *note ValueError:
     2ee. for an out-of-range month combined with a ‘24:00’ time.

   - gh-151665(21): *note inspect.signature(): 231. now works on the
     lazy evaluators of type aliases and type parameters instead of
     raising *note ValueError: 2ee.

   - gh-151695(22): Fix a use-after-free in the *note curses: 2f.
     module.  The encoding of the initial screen, used by *note
     curses.unctrl(): 177a. and *note curses.ungetch(): 177b. to encode
     non-ASCII characters, is now kept as a private copy instead of a
     borrowed pointer to a window object that may be deallocated.

   - gh-151596(23): Add missing ‘size’ positional argument to the
     pure-Python implementation of *note io.TextIOBase.readline(): 177c.

   - gh-151497(24): Opening a *note tarfile: e4. archive no longer
     attempts to pre-allocate a huge buffer when a crafted or truncated
     member claims an oversized extended header (a GNU long name/link or
     a pax header).  The extended header is now read in bounded chunks,
     so its size field can no longer trigger memory exhaustion.

   - gh-151403(25): Fixed a crash in *note subprocess.Popen: 4b7. (and
     ‘_posixsubprocess.fork_exec’) when an ‘argv’ item's *note
     __fspath__(): e50. concurrently mutates the ‘args’ sequence being
     converted.

   - gh-151390(26): Colorize ‘match’ in the *note REPL: 491. when
     followed by a unary ‘+’ or ‘-’ operator.  Patch by Bartosz
     Sławecki.

   - gh-151126(27): Fix crash on unset *note MemoryError: 1772. on
     allocation failure in *note ctypes.get_errno(): 177d.

   - gh-151337(28): Avoid possible memory leak in ‘tkinter.c’ on
     Windows.

   - gh-151126(29): Fix a crash when *note MemoryError: 1772. in
     ‘os._path_splitroot()’ was not set properly.

   - gh-151126(30): Fix a crash, when there's no memory left on a
     device, which happened in ‘_interpchannels’ module.

     Now it raises proper *note MemoryError: 1772. errors.

   - gh-151295(31): Fixed a crash (use-after-free) in *note
     bytes.join(): 177e. and *note bytearray.join(): 177f. that could
     occur if an item's *note __buffer__(): 68c. concurrently mutates
     the sequence being joined.  The mutation is now reported as a *note
     RuntimeError: 246. instead.

   - gh-109940(32): Fix Windows *note venv: 118. activation in ‘cmd.exe’
     to respect ‘VIRTUAL_ENV_DISABLE_PROMPT’.

   - gh-150484(33): Fix *note unittest.mock.mock_open(): 11ed.
     ‘__exit__’ raising ‘TypeError’ when used with *note
     contextlib.ExitStack: d22.

   - gh-143988(34): Fixed crashes in *note socket.socket.sendmsg(): 6a1.
     and *note socket.socket.recvmsg_into(): 1356. that could occur if
     buffer sequences are concurrently mutated.

   - gh-130796(35): Undeprecate the *note locale.getdefaultlocale():
     92f. function.  Patch by Victor Stinner.

   - gh-120665(36): Fixed an issue where ‘unittest’ loaders would load
     and instantiate *note unittest.TestCase: 2b5.-derived subclasses
     that are also abstract base classes, which can't be instantiated.

   - gh-101267(37): When a worker process terminates unexpectedly, *note
     concurrent.futures.ProcessPoolExecutor: 1d8. now sets a separate
     *note BrokenProcessPool: 1780. exception on each pending future
     instead of sharing a single instance among them all.  Sharing one
     exception produced malformed tracebacks: each *note
     Future.result(): 1781. call re-raised the same object, appending
     another copy of the traceback to it.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151842

   (2) https://github.com/python/cpython/issues/78335

   (3) https://github.com/python/cpython/issues/151126

   (4) https://github.com/python/cpython/issues/71880

   (5) https://github.com/python/cpython/issues/152305

   (6) https://github.com/python/cpython/issues/88758

   (7) https://github.com/python/cpython/issues/38464

   (8) https://github.com/python/cpython/issues/80937

   (9) https://github.com/python/cpython/issues/152246

   (10) https://github.com/python/cpython/issues/139816

   (11) https://github.com/python/cpython/issues/139145

   (12) https://github.com/python/cpython/issues/152212

   (13) https://github.com/python/cpython/issues/152156

   (14) https://github.com/python/cpython/issues/151763

   (15) https://github.com/python/cpython/issues/105895

   (16) https://github.com/python/cpython/issues/152079

   (17) https://github.com/python/cpython/issues/152052

   (18) https://github.com/python/cpython/issues/126219

   (19) https://github.com/python/cpython/issues/151814

   (20) https://github.com/python/cpython/issues/151770

   (21) https://github.com/python/cpython/issues/151665

   (22) https://github.com/python/cpython/issues/151695

   (23) https://github.com/python/cpython/issues/151596

   (24) https://github.com/python/cpython/issues/151497

   (25) https://github.com/python/cpython/issues/151403

   (26) https://github.com/python/cpython/issues/151390

   (27) https://github.com/python/cpython/issues/151126

   (28) https://github.com/python/cpython/issues/151337

   (29) https://github.com/python/cpython/issues/151126

   (30) https://github.com/python/cpython/issues/151126

   (31) https://github.com/python/cpython/issues/151295

   (32) https://github.com/python/cpython/issues/109940

   (33) https://github.com/python/cpython/issues/150484

   (34) https://github.com/python/cpython/issues/143988

   (35) https://github.com/python/cpython/issues/130796

   (36) https://github.com/python/cpython/issues/120665

   (37) https://github.com/python/cpython/issues/101267


File: python.info,  Node: ドキュメント<2>,  Next: Core and Builtins,  Prev: ライブラリ,  Up: Python next

1.24.1.4 ドキュメント
.....................

   - gh-86726(1): Greatly expand the *note tkinter: f6. documentation to
     cover the full public API of the package and its submodules.  The
     descriptions are oriented towards Python rather than Tcl/Tk, with
     corrected return types and ‘versionadded’/‘versionchanged’
     information.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/86726


File: python.info,  Node: Core and Builtins,  Next: C API,  Prev: ドキュメント<2>,  Up: Python next

1.24.1.5 Core and Builtins
..........................

   - gh-152235(1): Defer GC tracking of *note set.intersection(): 1784,
     *note set.difference(): 1785, *note set.symmetric_difference():
     1786, *note set.union(): 1787. and ‘set.__sub__’.  Patch by Donghee
     Na.

   - gh-152235(2): Defer GC tracking of a *note set: 185. or *note
     frozenset: 7f2. to the end of its construction from iterable.
     Patch by Donghee Na.

   - gh-151763(3): Fixes possible crash on *note types.CodeType: 32d.
     deallocation.

   - gh-152020(4): On the free-threaded build, *note
     asyncio.all_tasks(): b53. no longer loses eager-started tasks when
     called from a thread other than the one running the event loop.

   - gh-151905(5): Fix OOM error handling in *note PyFrame_GetBack():
     98d. to propagate exceptions instead of masking them as None.

   - gh-151773(6): Fix a crash in *note contextvars.ContextVar.set():
     1788. when memory allocation fails.

   - gh-151126(7): Fix a crash when sharing *note memoryview: 166.
     objects between interpreters fails due to running out of memory.
     It now raises a proper *note MemoryError: 1772.

   - gh-151126(8): Avoid possible crash in ‘_winapi.c’ where a device
     has no memory left.  Now it properly raises a *note MemoryError:
     1772.  Patch by Ivy Xu.

   - gh-151546(9): Fix the stack limit check if Python is linked to musl
     (ex: Alpine Linux).  Use the stack size set by the linker to
     compute the stack limits.  Patch by Victor Stinner.

   - gh-151461(10): Fix direct execution of files with invalid source
     encodings to report the underlying codec lookup or decoding error
     instead of the generic ‘SyntaxError: encoding problem’ message.
     Patch by Bartosz Sławecki.

   - gh-151218(11): *note PyConfig_Set(): 37b. and *note
     sys.set_int_max_str_digits(): 1789. now replace *note sys.flags:
     89d. (create a new object), instead of modifying ‘sys.flags’
     in-place.  Patch by Victor Stinner.

   - gh-151253(12): If ‘import encodings’ (first import) fails at Python
     startup, dump the Python path configuration to help users debugging
     their configuration.  Patch by Victor Stinner.

   - gh-151238(13): Fix a crash when compiling a concatenated f-string
     or t-string if an error occurs when processing one of it's parts.

   - gh-151126(14): Fix a crash, when there's no memory left on a
     device, which happened in ‘_interpchannels’ module.

     Now it raises proper *note MemoryError: 1772. errors.

   - gh-150902(15): Apply an existing optimization of PyCriticalSection
     (single mutex) to PyCriticalSection2: avoid acquiring the same
     locks that the current CS has already acquired.

   - gh-151065(16): Fix memory leak when using the *note mimalloc memory
     allocator: 178a.

   - gh-151029(17): On Linux, fix *note sys.remote_exec(): 16e. unable
     to find remote writable memory when ‘libpython’ replaced on disk.

   - gh-150988(18): Fix a reference leak in *note OSError: 2c2. when
     attributes are set before ‘super().__init__()’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/152235

   (2) https://github.com/python/cpython/issues/152235

   (3) https://github.com/python/cpython/issues/151763

   (4) https://github.com/python/cpython/issues/152020

   (5) https://github.com/python/cpython/issues/151905

   (6) https://github.com/python/cpython/issues/151773

   (7) https://github.com/python/cpython/issues/151126

   (8) https://github.com/python/cpython/issues/151126

   (9) https://github.com/python/cpython/issues/151546

   (10) https://github.com/python/cpython/issues/151461

   (11) https://github.com/python/cpython/issues/151218

   (12) https://github.com/python/cpython/issues/151253

   (13) https://github.com/python/cpython/issues/151238

   (14) https://github.com/python/cpython/issues/151126

   (15) https://github.com/python/cpython/issues/150902

   (16) https://github.com/python/cpython/issues/151065

   (17) https://github.com/python/cpython/issues/151029

   (18) https://github.com/python/cpython/issues/150988


File: python.info,  Node: C API,  Next: ビルド,  Prev: Core and Builtins,  Up: Python next

1.24.1.6 C API
..............

   - gh-123619(1): *note PyUnstable_Object_EnableDeferredRefcount():
     3c3. now returns ‘0’ if the object is not tracked by the garbage
     collector: if *note gc.is_tracked(): 1529. is false.  Patch by
     Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123619


File: python.info,  Node: ビルド,  Prev: C API,  Up: Python next

1.24.1.7 ビルド
...............

   - gh-148260(1): On Linux when Python is linked to the musl C library,
     use a thread stack size of at least 1 MiB instead of musl default
     which is 128 kiB. Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148260


File: python.info,  Node: Python 3 14 6 final,  Next: Python 3 14 5 final,  Prev: Python next,  Up: 変更履歴

1.24.2 Python 3.14.6 final
--------------------------

'Release date: 2026-06-10'

* Menu:

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


File: python.info,  Node: セキュリティ<2>,  Next: Core and Builtins<2>,  Up: Python 3 14 6 final

1.24.2.1 セキュリティ
.....................

   - gh-151159(1): Update Android and iOS installers to use OpenSSL
     3.5.7.

   - gh-150599(2): Fix a possible stack buffer overflow in *note bz2:
     14. when a *note bz2.BZ2Decompressor: 178f. is reused after a
     decompression error.  The decompressor now becomes unusable after
     libbz2 reports an error.

   - gh-149835(3): *note shutil.move(): c55. now resolves symlinks via
     *note os.path.realpath(): 264. when checking whether the
     destination is inside the source directory, preventing a
     symlink-based bypass of that guard.

   - gh-149698(4): Update bundled libexpat(5) to version 2.8.1 for the
     fix for CVE 2026-45186(6).

   - gh-87451(7): The *note ftplib: 62. module's undocumented ‘ftpcp’
     function no longer trusts the IPv4 address value returned from the
     source server in response to the ‘PASV’ command by default,
     completing the fix for CVE-2021-4189.  As with *note ftplib.FTP:
     afa, the former behavior can be re-enabled by setting the
     ‘trust_server_pasv_ipv4_address’ attribute on the source
     ‘ftplib.FTP’ instance to ‘True’.  Thanks to Qi Deng at Aurascape AI
     for the report.

   - gh-149486(8): *note tarfile.data_filter(): 29c. now validates link
     targets using the same normalised value that is written to disk,
     strips trailing separators from the member name when resolving a
     symlink's directory, and rejects link members that would replace
     the destination directory itself.  This closes several
     path-traversal bypasses of the ‘data’ extraction filter.

   - gh-149079(9): Fix a potential denial of service in *note
     unicodedata.normalize(): 8e5.  The canonical ordering step of
     Unicode normalization used a quadratic-time insertion sort for
     reordering combining characters, which could be exploited with
     crafted input containing many combining characters in non-canonical
     order.  Replaced with a linear-time counting sort for long runs.

   - gh-149018(10): Improved protection against XML hash-flooding
     attacks in *note xml.parsers.expat: 12d. and *note
     xml.etree.ElementTree: 12c. when Python is compiled with libExpat
     2.8.0 or later.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151159

   (2) https://github.com/python/cpython/issues/150599

   (3) https://github.com/python/cpython/issues/149835

   (4) https://github.com/python/cpython/issues/149698

   (5) https://libexpat.github.io/

   (6) https://www.cve.org/CVERecord?id=CVE-2026-45186

   (7) https://github.com/python/cpython/issues/87451

   (8) https://github.com/python/cpython/issues/149486

   (9) https://github.com/python/cpython/issues/149079

   (10) https://github.com/python/cpython/issues/149018


File: python.info,  Node: Core and Builtins<2>,  Next: ライブラリ<2>,  Prev: セキュリティ<2>,  Up: Python 3 14 6 final

1.24.2.2 Core and Builtins
..........................

   - gh-151112(1): Fix a crash in the compiler that could occur when
     running out of memory.

   - gh-151126(2): Fix a crash, when there's no memory left on a device,
     which happened in:

        - code compilation - ‘_winapi.CreateProcess()’

     Now these places raise proper *note MemoryError: 1772. errors.

   - gh-150700(3): Fix a *note SystemError: 795. when compiling a
     class-scope comprehension containing a ‘lambda’ that references
     ‘__class__’, ‘__classdict__’, or ‘__conditional_annotations__’.
     Patch by Bartosz Sławecki.

   - gh-150633(4): Fix the frozen importer accepting module names with
     embedded null bytes, which caused it to bypass the *note
     sys.modules: 1791. cache and create duplicate module objects.

   - gh-148613(5): Fix a data race in the free-threaded build between
     *note gc.set_threshold(): 2dc. and garbage collection scheduling
     during object allocation.

   - gh-149156(6): Fix an intermittent crash after *note os.fork(): 4b5.
     when perf trampoline profiling is enabled and the child returns
     through trampoline frames inherited from the parent process.

   - gh-149449(7): Fix a use-after-free crash when the *note
     unicodedata: 10c. module was removed from *note sys.modules: 1791.
     and garbage-collected between calls that decode ‘\N{...}’ escapes
     or use the ‘namereplace’ codec error handler.

   - gh-150207(8): Fix a crash when a memory allocation fails during
     tokenizer initialization.  A proper *note MemoryError: 1772. is now
     raised instead.

   - gh-150107(9): *note asyncio: b.: ‘sendfile()’ and ‘sock_sendfile()’
     event loop methods now call ‘file.seek(offset)’ if 'file' has a
     ‘seek()’ method, even if 'offset' is ‘0’ (default value).

   - gh-150146(10): Fix a crash on a complex type variable substitution.

     ‘from typing import TypeVar;
     memoryview[TypeVar("")][*typing.Mapping[..., ...]]’ used to fail
     due to missing ‘NULL’ check on ‘_unpack_args’ C function call.

   - gh-149590(11): Fix crash when faulthandler is imported more than
     once.

   - gh-149816(12): Fix a race condition in ‘_PyBytes_FromList’ in
     free-threading mode.

   - gh-149816(13): Fix a race condition in *note memoryview: 166. with
     free-threading.

   - gh-149805(14): Fix a *note SystemError: 795. when compiling a
     compiling ‘__classdict__’ class annotation.  Found by OSS-Fuzz in
     #512907042(15).

   - gh-149738(16): *note sqlite3: d4.: Disallow removing ‘row_factory’
     and ‘text_factory’ attributes of a connection to prevent a crash on
     a query.

   - gh-139808(17): Add branch protections for AArch64 (BTI/PAC) in
     assembly code used by *note -X perf_jit: 170. (Linux perf profiler
     integration).

   - gh-148450(18): Fix ‘abc.register()’ so it invalidates type version
     tags for registered classes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151112

   (2) https://github.com/python/cpython/issues/151126

   (3) https://github.com/python/cpython/issues/150700

   (4) https://github.com/python/cpython/issues/150633

   (5) https://github.com/python/cpython/issues/148613

   (6) https://github.com/python/cpython/issues/149156

   (7) https://github.com/python/cpython/issues/149449

   (8) https://github.com/python/cpython/issues/150207

   (9) https://github.com/python/cpython/issues/150107

   (10) https://github.com/python/cpython/issues/150146

   (11) https://github.com/python/cpython/issues/149590

   (12) https://github.com/python/cpython/issues/149816

   (13) https://github.com/python/cpython/issues/149816

   (14) https://github.com/python/cpython/issues/149805

   (15) https://issues.oss-fuzz.com/issues/512907042

   (16) https://github.com/python/cpython/issues/149738

   (17) https://github.com/python/cpython/issues/139808

   (18) https://github.com/python/cpython/issues/148450


File: python.info,  Node: ライブラリ<2>,  Next: ドキュメント<3>,  Prev: Core and Builtins<2>,  Up: Python 3 14 6 final

1.24.2.3 ライブラリ
...................

   - gh-151039(1): Fix a crash when static *note datetime: 34. types
     outlive the ‘_datetime’ module.

   - gh-150913(2): Fix *note sqlite3.Blob: 893. slice assignment to
     raise *note TypeError: 199. and *note IndexError: 1753. for type
     and size mismatches respectively, even when the target slice is
     empty.

   - gh-143008(3): Fix race conditions when re-initializing a *note
     io.TextIOWrapper: 9c2. object.

   - gh-150750(4): Fix a race condition in *note
     collections.deque.index(): fd4. with free-threading.

   - gh-150685(5): Update bundled pip to 26.1.2

   - gh-150406(6): Fix a possible crash occurring during *note socket:
     d1. module initialization when the system is out of memory on
     platforms without a reentrant ‘gethostbyname’.

   - gh-150372(7): *note readline: bf.: Fix a potential crash during tab
     completion caused by an out-of-memory error during module
     initialization.

   - gh-150157(8): Fix a crash in free-threaded builds that occurs when
     pickling by name objects without a ‘__module__’ attribute while
     *note sys.modules: 1791. is concurrently being modified.

   - gh-150175(9): Fix race condition in *note
     unittest.mock.ThreadingMock: 1793. where concurrent calls could
     lose increments to ‘call_count’ and other attributes due to a
     missing lock in ‘_increment_mock_call’.

   - gh-84353(10): Preserve non-UTF-8 encoded filenames when appending
     to a *note zipfile.ZipFile: 8d4.  Previously, non-ASCII names
     stored in a legacy encoding (without the UTF-8 flag bit set) could
     be corrupted when the central directory was rewritten: they were
     decoded as cp437 and then re-stored as UTF-8.

   - gh-149816(11): Fix race condition in *note
     ssl.SSLContext.sni_callback: 1794.

   - gh-149995(12): Update various docstrings in *note typing: 10b.

   - gh-88726(13): The *note email: 3f. package now uses standard MIME
     charset names "gb2312" and "big5" instead of non-standard names
     "eucgb2312_cn" and "big5_tw".

   - gh-149571(14): Fix the C implementation of *note
     xml.etree.ElementTree.Element.itertext(): 13f1.: it no longer emits
     text for comments and processing instructions.

   - gh-149921(15): Fix reference leaks in error paths of the
     ‘_interpchannels’ and ‘_interpqueues’ extension modules.

   - gh-149816(16): Fix a race condition in ‘_random.Random.__init__’
     method in free-threading mode.

   - gh-149801(17): Add IANA registered names and aliases with leading
     zeros before number (like IBM00858, CP00858, IBM01140, CP01140) for
     corresponding codecs.

   - gh-149701(18): Fix bad return code from Lib/venv/bin/activate if
     hashing is disabled

   - gh-112821(19): In the REPL, autocompletion might run arbitrary code
     in the getter of a descriptor.  If that getter raised an exception,
     autocompletion would fail to present any options for the entire
     object.  Autocompletion now works as expected for these objects.

   - gh-149489(20): Fix *note ElementTree: 12c. serialization to HTML.
     The content of elements "xmp", "iframe", "noembed", "noframes", and
     "plaintext" is no longer escaped.  The "plaintext" element no
     longer have the closing tag.

   - gh-149231(21): In *note tomllib: 103, the number of parts in TOML
     keys is now limited.

   - gh-149046(22): *note io: 83.: Fix *note io.StringIO: 112e.
     serialization: no longer call ‘str(obj)’ on *note str: 16a.
     subclasses.  Patch by Thomas Kowalski.

   - gh-148954(23): Fix XML injection vulnerability in *note
     xmlrpc.client.dumps(): 1795. where the ‘methodname’ was not being
     escaped before interpolation into the XML body.

   - gh-148441(24): *note xml.parsers.expat: 12d.: prevent a crash in
     *note CharacterDataHandler(): 1796. when the character data size
     exceeds the parser's *note buffer size: 1797.

   - gh-146452(25): Fix segfault in *note pickle: ab. when pickling a
     dictionary concurrently mutated by another thread in the
     free-threaded build.

   - gh-142831(26): Fix a crash in the *note json: 86. module where a
     use-after-free could occur if the object being encoded is modified
     during serialization.

   - gh-90949(27): Add *note
     SetBillionLaughsAttackProtectionActivationThreshold(): 1798. and
     *note SetBillionLaughsAttackProtectionMaximumAmplification(): 1799.
     to *note xmlparser: 179a. objects to tune protections against
     billion laughs(28) attacks.  Patch by Bénédikt Tran.

   - gh-134261(29): zip: On reproducible builds, ZipFile uses UTC
     instead of the local time when writing file datetimes to avoid
     underflows.

   - gh-128110(30): Fix bug in the parsing of *note email: 3f. address
     headers that could result in extraneous spaces in the decoded text
     when using a modern email policy.  Space between pairs of adjacent
     RFC 2047(31) encoded-words is now ignored, per section 6.2 (and
     consistent with existing parsing of unstructured headers like
     'Subject').

   - gh-107398(32): Fix *note tarfile: e4. stream mode exception when
     process the file with the gzip extra field.

   - gh-123853(33): Update the table of Windows language code
     identifiers (LCIDs) used by *note locale.getdefaultlocale(): 92f.
     on Windows to protocol version 16.0 (2024-04-23).

   - gh-91099(34): *note imaplib.IMAP4.login(): 179b. now raises
     exceptions with *note str: 16a. instead of *note bytes: 193.  Patch
     by Florian Best.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151039

   (2) https://github.com/python/cpython/issues/150913

   (3) https://github.com/python/cpython/issues/143008

   (4) https://github.com/python/cpython/issues/150750

   (5) https://github.com/python/cpython/issues/150685

   (6) https://github.com/python/cpython/issues/150406

   (7) https://github.com/python/cpython/issues/150372

   (8) https://github.com/python/cpython/issues/150157

   (9) https://github.com/python/cpython/issues/150175

   (10) https://github.com/python/cpython/issues/84353

   (11) https://github.com/python/cpython/issues/149816

   (12) https://github.com/python/cpython/issues/149995

   (13) https://github.com/python/cpython/issues/88726

   (14) https://github.com/python/cpython/issues/149571

   (15) https://github.com/python/cpython/issues/149921

   (16) https://github.com/python/cpython/issues/149816

   (17) https://github.com/python/cpython/issues/149801

   (18) https://github.com/python/cpython/issues/149701

   (19) https://github.com/python/cpython/issues/112821

   (20) https://github.com/python/cpython/issues/149489

   (21) https://github.com/python/cpython/issues/149231

   (22) https://github.com/python/cpython/issues/149046

   (23) https://github.com/python/cpython/issues/148954

   (24) https://github.com/python/cpython/issues/148441

   (25) https://github.com/python/cpython/issues/146452

   (26) https://github.com/python/cpython/issues/142831

   (27) https://github.com/python/cpython/issues/90949

   (28) https://en.wikipedia.org/wiki/Billion_laughs_attack

   (29) https://github.com/python/cpython/issues/134261

   (30) https://github.com/python/cpython/issues/128110

   (31) https://datatracker.ietf.org/doc/html/rfc2047.html

   (32) https://github.com/python/cpython/issues/107398

   (33) https://github.com/python/cpython/issues/123853

   (34) https://github.com/python/cpython/issues/91099


File: python.info,  Node: ドキュメント<3>,  Next: テスト<2>,  Prev: ライブラリ<2>,  Up: Python 3 14 6 final

1.24.2.4 ドキュメント
.....................

   - gh-150319(1): Generic builtin and standard library types now
     document the meaning of their type parameters.

   - gh-109503(2): Fix documentation for *note shutil.move(): c55. on
     usage of *note os.rename(): 130d. since nonatomic move might be
     used even if the files are on the same filesystem.  Patch by Fang
     Li

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/150319

   (2) https://github.com/python/cpython/issues/109503


File: python.info,  Node: テスト<2>,  Next: ビルド<2>,  Prev: ドキュメント<3>,  Up: Python 3 14 6 final

1.24.2.5 テスト
...............

   - gh-151130(1): Add more tests for ‘PyWeakref_*’ C API.

   - gh-149776(2): Fix test_socket on Linux kernel 7.1 and newer: skip
     UDP Lite tests if it's not supported.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151130

   (2) https://github.com/python/cpython/issues/149776


File: python.info,  Node: ビルド<2>,  Next: Windows,  Prev: テスト<2>,  Up: Python 3 14 6 final

1.24.2.6 ビルド
...............

   - gh-148294(1): Corrected the use of ‘AC_PATH_TOOL’ in ‘configure.ac’
     to allow a C++ compiler to be found on ‘PATH’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148294


File: python.info,  Node: Windows,  Next: macOS,  Prev: ビルド<2>,  Up: Python 3 14 6 final

1.24.2.7 Windows
................

   - gh-151159(1): Updated bundled version of OpenSSL to 3.5.7.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151159


File: python.info,  Node: macOS,  Next: IDLE<3>,  Prev: Windows,  Up: Python 3 14 6 final

1.24.2.8 macOS
..............

   - gh-151159(1): Update macOS installer to use OpenSSL 3.5.7.

   - gh-150644(2): When system logging is enabled (with
     ‘config.use_system_logger’, messages are now tagged as public.
     This allows the macOS 26 system logger to view messages without
     special configuration.

   - gh-115119(3): Update macOS installer to use libmpdecimal 4.0.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/151159

   (2) https://github.com/python/cpython/issues/150644

   (3) https://github.com/python/cpython/issues/115119


File: python.info,  Node: IDLE<3>,  Next: C API<2>,  Prev: macOS,  Up: Python 3 14 6 final

1.24.2.9 IDLE
.............

   - bpo-6699(1): Warn the user if a file will be overwritten when
     saving.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6699


File: python.info,  Node: C API<2>,  Prev: IDLE<3>,  Up: Python 3 14 6 final

1.24.2.10 C API
...............

   - gh-150907(1): Fix ‘dynamic_annotations.h’ header file when built
     with C++ and Valgrind: add ‘extern "C++" scope’ for the C++
     template.  Patch by Victor Stinner.

   - gh-145235(2): Made *note PyDict_AddWatcher(): 3ce, *note
     PyDict_ClearWatcher(): 17a3, *note PyDict_Watch(): 784, and *note
     PyDict_Unwatch(): 17a4. thread-safe on the *note free threaded:
     1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/150907

   (2) https://github.com/python/cpython/issues/145235


File: python.info,  Node: Python 3 14 5 final,  Next: Python 3 14 5 release candidate 1,  Prev: Python 3 14 6 final,  Up: 変更履歴

1.24.3 Python 3.14.5 final
--------------------------

'Release date: 2026-05-10'

* Menu:

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


File: python.info,  Node: セキュリティ<3>,  Next: Core and Builtins<3>,  Up: Python 3 14 5 final

1.24.3.1 セキュリティ
.....................

   - gh-148178(1): Hardened ‘_remote_debugging’ by validating remote
     debug offset tables before using them to size memory reads or
     interpret remote layouts.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148178


File: python.info,  Node: Core and Builtins<3>,  Next: ライブラリ<3>,  Prev: セキュリティ<3>,  Up: Python 3 14 5 final

1.24.3.2 Core and Builtins
..........................

   - gh-146270(1): Fix a sequential consistency bug in ‘structmember.c’.

   - gh-137293(2): Fix *note SystemError: 795. when searching ELF Files
     in *note sys.remote_exec(): 16e.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/146270

   (2) https://github.com/python/cpython/issues/137293


File: python.info,  Node: ライブラリ<3>,  Next: テスト<3>,  Prev: Core and Builtins<3>,  Up: Python 3 14 5 final

1.24.3.3 ライブラリ
...................

   - gh-149388(1): Make ‘asyncio.windows_utils.PipeHandle’ closing
     idempotent.

   - gh-149377(2): Update bundled pip to 26.1.1

   - gh-138907(3): Support RFC 9309(4) in *note urllib.robotparser: 114.

   - gh-148615(5): Fix *note pdb: aa. to accept standard - end of
     options separator.  Reported by haampie.  Patched by Shrey
     Naithani.

   - gh-130750(6): Restore quoting of choices in *note argparse: 7.
     error messages for improved clarity and consistency with
     documentation.

   - gh-141449(7): Improve tests and documentation for non-function
     callables as *note annotate functions: 15e.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149388

   (2) https://github.com/python/cpython/issues/149377

   (3) https://github.com/python/cpython/issues/138907

   (4) https://datatracker.ietf.org/doc/html/rfc9309.html

   (5) https://github.com/python/cpython/issues/148615

   (6) https://github.com/python/cpython/issues/130750

   (7) https://github.com/python/cpython/issues/141449


File: python.info,  Node: テスト<3>,  Next: macOS<2>,  Prev: ライブラリ<3>,  Up: Python 3 14 5 final

1.24.3.4 テスト
...............

   - gh-149425(1): Increase time delta in
     ‘test.test_zipfile.test_core.OtherTests.test_write_without_source_date_epoch’

   - gh-145736(2): Fix test_tkinter test_configure_values test case
     backport miss for Tk 9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149425

   (2) https://github.com/python/cpython/issues/145736


File: python.info,  Node: macOS<2>,  Prev: テスト<3>,  Up: Python 3 14 5 final

1.24.3.5 macOS
..............

   - gh-142295(1): For Python macOS framework builds, update Info.plist
     files to be more compliant with current Apple guidelines.  Original
     patch contributed by Martinus Verburg.

   - gh-124111(2): Update macOS installer to use Tcl/Tk 9.0.3.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142295

   (2) https://github.com/python/cpython/issues/124111


File: python.info,  Node: Python 3 14 5 release candidate 1,  Next: Python 3 14 4 final,  Prev: Python 3 14 5 final,  Up: 変更履歴

1.24.4 Python 3.14.5 release candidate 1
----------------------------------------

'Release date: 2026-05-04'

* Menu:

* セキュリティ: セキュリティ<4>.
* Core and Builtins: Core and Builtins<4>.
* ライブラリ: ライブラリ<4>.
* ドキュメント: ドキュメント<4>.
* ビルド: ビルド<3>.
* Windows: Windows<2>.
* macOS: macOS<3>.


File: python.info,  Node: セキュリティ<4>,  Next: Core and Builtins<4>,  Up: Python 3 14 5 release candidate 1

1.24.4.1 セキュリティ
.....................

   - gh-149254(1): Update Android and iOS installer to use OpenSSL
     3.0.20.

   - gh-149017(2): Update bundled libexpat(3) to version 2.8.0.

   - gh-90309(4): Base64-encode values when embedding cookies to
     JavaScript using the *note http.cookies.BaseCookie.js_output():
     17ad. method to avoid injection and escaping.

   - gh-148808(5): Added buffer boundary check when using ‘nbytes’
     parameter with ‘asyncio.AbstractEventLoop.sock_recvfrom_into()’.
     Only relevant for Windows and the *note asyncio.ProactorEventLoop:
     81d.

   - gh-148395(6): Fix a dangling input pointer in *note
     lzma.LZMADecompressor: 17ae, *note bz2.BZ2Decompressor: 178f, and
     internal ‘zlib._ZlibDecompressor’ when memory allocation fails with
     *note MemoryError: 1772, which could let a subsequent
     ‘decompress()’ call read or write through a stale pointer to the
     already-released caller buffer.

   - gh-148169(7): A bypass in *note webbrowser: 11c. allowed URLs
     prefixed with ‘%action’ to pass the dash-prefix safety check.

   - gh-146581(8): Fix vulnerability in *note shutil.unpack_archive():
     696. for ZIP files on Windows which allowed to write files outside
     of the destination tree if the patch in the archive contains a
     Windows drive prefix.  Now such invalid paths will be skipped.
     Files containing ".."  in the name (like "foo..bar") are no longer
     skipped.

   - gh-146333(9): Fix quadratic backtracking in *note
     configparser.RawConfigParser: 116a. option parsing regexes
     (‘OPTCRE’ and ‘OPTCRE_NV’).  A crafted configuration line with many
     whitespace characters could cause excessive CPU usage.

   - gh-146211(10): Reject CR/LF characters in tunnel request headers
     for the HTTPConnection.set_tunnel() method.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149254

   (2) https://github.com/python/cpython/issues/149017

   (3) https://libexpat.github.io/

   (4) https://github.com/python/cpython/issues/90309

   (5) https://github.com/python/cpython/issues/148808

   (6) https://github.com/python/cpython/issues/148395

   (7) https://github.com/python/cpython/issues/148169

   (8) https://github.com/python/cpython/issues/146581

   (9) https://github.com/python/cpython/issues/146333

   (10) https://github.com/python/cpython/issues/146211


File: python.info,  Node: Core and Builtins<4>,  Next: ライブラリ<4>,  Prev: セキュリティ<4>,  Up: Python 3 14 5 release candidate 1

1.24.4.2 Core and Builtins
..........................

   - gh-149122(1): Fix a crash in optimized calls to *note all(): 1640,
     *note any(): 163f, *note tuple(): 614, *note list(): 24f, and *note
     set(): 185. with an async generator expression argument (for
     example, ‘tuple(await x for x in y)’).  These calls now correctly
     raise ‘TypeError’ instead of crashing.

   - gh-113956(2): Fix a data race in *note sys.intern(): 14f7. in the
     free-threaded build when interning a string owned by another
     thread.  An interned copy owned by the current thread is used
     instead when it is not safe to immortalize the original.

   - gh-148820(3): Fix a race in ‘_PyRawMutex’ on the free-threaded
     build where a ‘Py_PARK_INTR’ return from ‘_PySemaphore_Wait’ could
     let the waiter destroy its semaphore before the unlocking thread's
     ‘_PySemaphore_Wakeup’ completed, causing a fatal ‘ReleaseSemaphore’
     error.

   - gh-148653(4): Forbid *note marshalling: 91. recursive code objects
     and *note slice: 694. objects which cannot be correctly
     unmarshalled.

   - gh-142516(5): Forward-port the generational cycle garbage collector
     to the default 3.14 build, replacing the incremental collector
     while leaving the free-threaded collector unchanged.

   - gh-148390(6): Fix an undefined behavior in *note memoryview: 166.
     when using the native boolean format (‘?’) in *note cast(): 1251.
     Previously, on some common platforms, calling
     ‘memoryview(b).cast("?").tolist()’ incorrectly returned ‘[False]’
     instead of ‘[True]’ for any even byte 'b'.  Patch by Bénédikt Tran.

   - gh-148418(7): Fix a possible reference leak in a corrupted
     ‘TYPE_CODE’ marshal stream.

   - gh-148393(8): Fix data races between *note PyDict_Watch(): 784. /
     *note PyDict_Unwatch(): 17a4. and concurrent dict mutation in the
     *note free-threaded build: 17b0.

   - gh-148284(9): Fix high stack consumption in Python's interpreter
     loop on Clang 22 by setting function limits for inlining when
     building with computed gotos.

   - gh-148037(10): Remove critical section from ‘PyCode_Addr2Line()’ in
     free-threading.

   - gh-148222(11): Fix vectorcall support in *note types.GenericAlias:
     9f0. when the underlying type does not support the vectorcall
     protocol.  Fix possible leaks in ‘types.GenericAlias’ and *note
     types.UnionType: 2a9. in case of memory error.

   - gh-148208(12): Fix recursion depth leak in *note PyObject_Print():
     17b1.

   - gh-137814(13): Fix the ‘__qualname__’ attribute of ‘__annotate__’
     functions on functions.

   - gh-147998(14): Fixed a memory leak in interpreter helper calls so
     cleanup works when an operation falls across interpreter
     boundaries.  Patch by Maurycy Pawłowski-Wieroński.

   - gh-146455(15): Fix O(N²) compile-time regression in constant
     folding after it was moved from AST to CFG optimizer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149122

   (2) https://github.com/python/cpython/issues/113956

   (3) https://github.com/python/cpython/issues/148820

   (4) https://github.com/python/cpython/issues/148653

   (5) https://github.com/python/cpython/issues/142516

   (6) https://github.com/python/cpython/issues/148390

   (7) https://github.com/python/cpython/issues/148418

   (8) https://github.com/python/cpython/issues/148393

   (9) https://github.com/python/cpython/issues/148284

   (10) https://github.com/python/cpython/issues/148037

   (11) https://github.com/python/cpython/issues/148222

   (12) https://github.com/python/cpython/issues/148208

   (13) https://github.com/python/cpython/issues/137814

   (14) https://github.com/python/cpython/issues/147998

   (15) https://github.com/python/cpython/issues/146455


File: python.info,  Node: ライブラリ<4>,  Next: ドキュメント<4>,  Prev: Core and Builtins<4>,  Up: Python 3 14 5 release candidate 1

1.24.4.3 ライブラリ
...................

   - gh-149221(1): Catch rare math domain error for *note
     random.binomialvariate(): 6d7.

   - gh-149117(2): Fix *note runpy.run_module(): 17b3. and *note
     runpy.run_path(): 4a4. to set the *note name: 17b4. attribute on
     the *note ImportError: 65b. they raise.

   - gh-149148(3): *note ensurepip: 59.: Upgrade bundled pip to 26.1.
     This version fixes the CVE 2026-3219(4) vulnerability.  Patch by
     Victor Stinner.

   - gh-148093(5): Fix an out-of-bounds read of one byte in *note
     binascii.a2b_uu(): 17b5.  Raise *note binascii.Error: 122b, instead
     of reading past the buffer end.

   - gh-148914(6): Fix memoization of in-band *note PickleBuffer: 17b6.
     in the Python implementation of *note pickle: ab.  Previously,
     identical ‘PickleBuffer’s did not preserve identity, and empty
     writable ‘PickleBuffer’ memoized an empty bytearray object in place
     of ‘b''’, so the following references to ‘b''’ were unpickled as an
     empty bytearray object.

   - gh-148947(7): Fix crash in *note @dataclasses.dataclass: 4e1. with
     ‘slots=True’ that occurred when a function found within the class
     had an empty ‘__class__’ cell.

   - gh-148680(8): ‘ForwardRef’ objects that contain internal names to
     represent known objects now show the ‘type_repr’ of the known
     object rather than the internal ‘__annotationlib_name_x__’ name
     when evaluated as strings.

   - gh-148801(9): *note xml.etree.ElementTree: 12c.: Fix a crash in
     *note Element.__deepcopy__: 17b7. on deeply nested trees.

   - gh-148735(10): *note xml.etree.ElementTree: 12c.: Fix a
     use-after-free in *note Element.findtext: 17b8. when the element
     tree is mutated concurrently during the search.

   - gh-148740(11): Fix usage for *note uuid: 117. command-line
     interface to support a custom namespace be provided for uuid3 and
     uuid5.

   - gh-148651(12): Fix reference leak in *note
     compression.zstd.ZstdDecompressor: 17b9. when an invalid option key
     is passed.

   - gh-146553(13): Fix infinite loop in *note typing.get_type_hints():
     8c1. when ‘__wrapped__’ forms a cycle.  Patch by Shamil Abdulaev.

   - gh-148508(14): An intermittent timing error when running SSL tests
     on iOS has been resolved.

   - gh-148518(15): If an email containing an address header that ended
     in an open double quote was parsed with a non-‘compat32’ policy,
     accessing the ‘username’ attribute of the mailbox accessed through
     that header object would result in an ‘IndexError’.  It now
     correctly returns an empty string as the result.

   - gh-148464(16): Add missing ‘__ctype_le/be__’ attributes for *note
     c_float_complex: 1ef. and *note c_double_complex: 1f0.  Patch by
     Sergey B Kirpichev.

   - gh-148370(17): *note configparser: 26.: prevent quadratic behavior
     when a *note ParsingError: 729. is raised after a parser fails to
     parse multiple lines.  Patch by Bénédikt Tran.

   - gh-148254(18): Use singular "sec" instead of "secs" in *note
     timeit: f5. verbose output for consistency with other time units.

   - gh-148192(19): ‘email.generator.Generator._make_boundary’ could
     fail to detect a duplicate boundary string if linesep was not n.
     It now correctly detects boundary strings when linesep is rn as
     well.

   - gh-146313(20): Fix a deadlock in *note multiprocessing: 98.'s
     resource tracker where the parent process could hang indefinitely
     in *note os.waitpid(): f9e. during interpreter shutdown if a child
     created via *note os.fork(): 4b5. still held the resource tracker's
     pipe open.

   - gh-145831(21): Fix ‘email.quoprimime.decode()’ leaving a stray ‘\r’
     when ‘eol='\r\n'’ by stripping the full 'eol' string instead of one
     character.

   - gh-145105(22): Fix crash in *note csv: 2d. reader when iterating
     with a re-entrant iterator that calls *note next(): 9dc. on the
     same reader from within ‘__next__’.

   - gh-105936(23): Attempting to mutate non-field attributes of *note
     dataclasses: 33. with both 'frozen' and 'slots' being ‘True’ now
     raises *note FrozenInstanceError: 17ba. instead of *note TypeError:
     199.  Their non-dataclass subclasses can now freely mutate
     non-field attributes, and the original non-slotted class can be
     garbage collected.

   - gh-140287(24): The *note asyncio: b. REPL now handles exceptions
     when executing *note PYTHONSTARTUP: 1ba. scripts.  Patch by Bartosz
     Sławecki.

   - gh-132631(25): Fix "I/O operation on closed file" when parsing JSON
     Lines file with *note JSON CLI: 87.

   - gh-70039(26): Fixed bug where *note smtplib.SMTP.starttls(): 1354.
     could fail if *note smtplib.SMTP.connect(): 17bb. is called
     explicitly rather than implicitly.

   - gh-83281(27): *note email: 3f.: improve handling trailing garbage
     in address lists to avoid throwing AttributeError in certain edge
     cases

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149221

   (2) https://github.com/python/cpython/issues/149117

   (3) https://github.com/python/cpython/issues/149148

   (4) https://www.cve.org/CVERecord?id=CVE-2026-3219

   (5) https://github.com/python/cpython/issues/148093

   (6) https://github.com/python/cpython/issues/148914

   (7) https://github.com/python/cpython/issues/148947

   (8) https://github.com/python/cpython/issues/148680

   (9) https://github.com/python/cpython/issues/148801

   (10) https://github.com/python/cpython/issues/148735

   (11) https://github.com/python/cpython/issues/148740

   (12) https://github.com/python/cpython/issues/148651

   (13) https://github.com/python/cpython/issues/146553

   (14) https://github.com/python/cpython/issues/148508

   (15) https://github.com/python/cpython/issues/148518

   (16) https://github.com/python/cpython/issues/148464

   (17) https://github.com/python/cpython/issues/148370

   (18) https://github.com/python/cpython/issues/148254

   (19) https://github.com/python/cpython/issues/148192

   (20) https://github.com/python/cpython/issues/146313

   (21) https://github.com/python/cpython/issues/145831

   (22) https://github.com/python/cpython/issues/145105

   (23) https://github.com/python/cpython/issues/105936

   (24) https://github.com/python/cpython/issues/140287

   (25) https://github.com/python/cpython/issues/132631

   (26) https://github.com/python/cpython/issues/70039

   (27) https://github.com/python/cpython/issues/83281


File: python.info,  Node: ドキュメント<4>,  Next: ビルド<3>,  Prev: ライブラリ<4>,  Up: Python 3 14 5 release candidate 1

1.24.4.4 ドキュメント
.....................

   - gh-148663(1): Document that *note calendar.IllegalMonthError: 17bd.
     is a subclass of both *note ValueError: 2ee. and *note IndexError:
     1753. since Python 3.12.

   - gh-146646(2): Document that *note glob.glob(): 5a0, *note
     glob.iglob(): a0c, *note pathlib.Path.glob(): 537, and *note
     pathlib.Path.rglob(): 538. silently suppress *note OSError: 2c2.
     exceptions raised from scanning the filesystem.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/148663

   (2) https://github.com/python/cpython/issues/146646


File: python.info,  Node: ビルド<3>,  Next: Windows<2>,  Prev: ドキュメント<4>,  Up: Python 3 14 5 release candidate 1

1.24.4.5 ビルド
...............

   - gh-149351(1): Avoid possible broken macOS framework install names
     when DESTDIR is specified during builds.

   - gh-146475(2): Block Apple Clang from being used to build the JIT as
     it ships without required LLVM tools.

   - gh-148535(3): No longer use the ‘gcc -fprofile-update=atomic’ flag
     on i686.  The flag has been added to fix a random GCC internal
     error on PGO build (gh-145801(4)) caused by corruption of profile
     data (.gcda files).  The problem is that it makes the PGO build way
     slower (up to 47x slower) on i686.  Since the GCC internal error
     was not seen on i686 so far, don't use ‘-fprofile-update=atomic’ on
     i686 anymore.  Patch by Victor Stinner.

   - gh-146264(5): Fix static module builds on non-WASI targets by
     linking HACL dependencies as static libraries when
     ‘MODULE_BUILDTYPE=static’, preventing duplicate ‘_Py_LibHacl_*’
     symbol errors at link time.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149351

   (2) https://github.com/python/cpython/issues/146475

   (3) https://github.com/python/cpython/issues/148535

   (4) https://github.com/python/cpython/issues/145801

   (5) https://github.com/python/cpython/issues/146264


File: python.info,  Node: Windows<2>,  Next: macOS<3>,  Prev: ビルド<3>,  Up: Python 3 14 5 release candidate 1

1.24.4.6 Windows
................

   - gh-149254(1): Updated bundled version of OpenSSL to 3.0.20.

   - gh-146458(2): Fix incorrect REPL height and width tracking on
     console window resize on Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149254

   (2) https://github.com/python/cpython/issues/146458


File: python.info,  Node: macOS<3>,  Prev: Windows<2>,  Up: Python 3 14 5 release candidate 1

1.24.4.7 macOS
..............

   - gh-149254(1): Update macOS installer to use OpenSSL 3.0.20.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/149254


File: python.info,  Node: Python 3 14 4 final,  Next: Python 3 14 3 final,  Prev: Python 3 14 5 release candidate 1,  Up: 変更履歴

1.24.5 Python 3.14.4 final
--------------------------

'Release date: 2026-04-07'

* Menu:

* セキュリティ: セキュリティ<5>.
* Core and Builtins: Core and Builtins<5>.
* ライブラリ: ライブラリ<5>.
* ドキュメント: ドキュメント<5>.
* テスト: テスト<4>.
* ビルド: ビルド<4>.
* Windows: Windows<3>.
* macOS: macOS<4>.
* C API: C API<3>.


File: python.info,  Node: セキュリティ<5>,  Next: Core and Builtins<5>,  Up: Python 3 14 4 final

1.24.5.1 セキュリティ
.....................

   - gh-145986(1): *note xml.parsers.expat: 12d.: Fixed a crash caused
     by unbounded C recursion when converting deeply nested XML content
     models with *note ElementDeclHandler(): 17c3.  This addresses CVE
     2026-4224(2).

   - gh-145599(3): Reject control characters in *note
     http.cookies.Morsel: e02. *note update(): 10cd. and *note
     js_output(): 17ad.  This addresses CVE 2026-3644(4).

   - gh-145506(5): Fixes CVE 2026-2297(6) by ensuring that
     ‘SourcelessFileLoader’ uses *note io.open_code(): 17c4. when
     opening ‘.pyc’ files.

   - gh-144370(7): Disallow usage of control characters in status in
     *note wsgiref.handlers: 120. to prevent HTTP header injections.
     Patch by Benedikt Johannes.

   - gh-143930(8): Reject leading dashes in URLs passed to *note
     webbrowser.open(): 17c5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/145986

   (2) https://www.cve.org/CVERecord?id=CVE-2026-4224

   (3) https://github.com/python/cpython/issues/145599

   (4) https://www.cve.org/CVERecord?id=CVE-2026-3644

   (5) https://github.com/python/cpython/issues/145506

   (6) https://www.cve.org/CVERecord?id=CVE-2026-2297

   (7) https://github.com/python/cpython/issues/144370

   (8) https://github.com/python/cpython/issues/143930


File: python.info,  Node: Core and Builtins<5>,  Next: ライブラリ<5>,  Prev: セキュリティ<5>,  Up: Python 3 14 4 final

1.24.5.2 Core and Builtins
..........................

   - gh-148157(1): Fix an unlikely crash when parsing an invalid type
     comments for function parameters.  Found by OSS Fuzz in
     #492782951(2).

   - gh-148144(3): Initialize ‘_PyInterpreterFrame.visited’ when copying
     interpreter frames so incremental GC does not read an uninitialized
     byte from generator and frame-object copies.

   - gh-146615(4): Fix a crash in *note __get__(): 1706. for *note
     METH_METHOD: b6c. descriptors when an invalid (non-type) object is
     passed as the second argument.  Patch by Steven Sun.

   - gh-146308(5): Fixed several error handling issues in the
     ‘_remote_debugging’ module, including safer validation of remote
     ‘int’ objects, clearer asyncio task chain failures, and cache
     cleanup fixes that avoid leaking or double-freeing metadata on
     allocation failure.  Patch by Pablo Galindo.

   - gh-146128(6): Fix a bug which could cause constant values to be
     partially corrupted in AArch64 JIT code.  This issue is
     theoretical, and hasn't actually been observed in unmodified Python
     interpreters.

   - gh-146250(7): Fixed a memory leak in *note SyntaxError: 18f. when
     re-initializing it.

   - gh-146245(8): Fixed reference leaks in *note socket: d1. when audit
     hooks raise exceptions in *note socket.getaddrinfo(): 17c7. and
     ‘socket.sendto()’.

   - gh-146196(9): Fix potential Undefined Behavior in *note
     PyUnicodeWriter_WriteASCII(): 3b7. by adding a zero-length check.
     Patch by Shamil Abdulaev.

   - gh-146227(10): Fix wrong type in ‘_Py_atomic_load_uint16’ in the
     C11 atomics backend (‘pyatomic_std.h’), which used a 32-bit atomic
     load instead of 16-bit.  Found by Mohammed Zuhaib.

   - gh-146056(11): Fix *note repr(): 1c3. for lists and tuples
     containing ‘NULL’s.

   - gh-146092(12): Handle properly memory allocation failures on str
     and float opcodes.  Patch by Victor Stinner.

   - gh-146041(13): Fix free-threading scaling bottleneck in *note
     sys.intern(): 14f7. and *note PyObject_SetAttr(): 17c8. by avoiding
     the interpreter-wide lock when the string is already interned and
     immortalized.

   - gh-145990(14): ‘python --help-env’ sections are now sorted by
     environment variable name.

   - gh-145990(15): ‘python --help-xoptions’ is now sorted by ‘-X’
     option name.

   - gh-145376(16): Fix GC tracking in ‘structseq.__replace__()’.

   - gh-145792(17): Fix out-of-bounds access when invoking faulthandler
     on a CPython build compiled without support for VLAs.

   - gh-142183(18): Avoid a pathological case where repeated calls at a
     specific stack depth could be significantly slower.

   - gh-145779(19): Improve scaling of *note classmethod(): 48e. and
     *note staticmethod(): 451. calls in the free-threaded build by
     avoiding the descriptor ‘__get__’ call.

   - gh-145783(20): Fix an unlikely crash in the parser when certain
     errors were erroneously not propagated.  Found by OSS Fuzz in
     #491369109(21).

   - gh-145685(22): Improve scaling of type attribute lookups in the
     *note free-threaded build: 17b0. by avoiding contention on the
     internal type lock.

   - gh-145701(23): Fix *note SystemError: 795. when ‘__classdict__’ or
     ‘__conditional_annotations__’ is in a class-scope inlined
     comprehension.  Found by OSS Fuzz in #491105000(24).

   - gh-145713(25): Make *note bytearray.resize(): 17c9. thread-safe in
     the free-threaded build by using a critical section and calling the
     lock-held variant of the resize function.

   - gh-145615(26): Fixed a memory leak in the *note free-threaded
     build: 17b0. where mimalloc pages could become permanently
     unreclaimable until the owning thread exited.

   - gh-145566(27): In the free threading build, skip the stop-the-world
     pause when reassigning ‘__class__’ on a newly created object.

   - gh-145335(28): Fix a crash in *note os.pathconf(): 1317. when
     called with ‘-1’ as the path argument.

   - gh-145036(29): In free-threaded build, fix race condition when
     calling ‘__sizeof__()’ on a *note list: 24f.

   - gh-145376(30): Fix reference leaks in various unusual error
     scenarios.

   - gh-145234(31): Fixed a ‘SystemError’ in the parser when an encoding
     cookie (for example, UTF-7) decodes to carriage returns (‘\r’).
     Newlines are now normalized after decoding in the string tokenizer.

     Patch by Pablo Galindo.

   - gh-130555(32): Fix use-after-free in *note dict.clear(): 17ca. when
     the dictionary values are embedded in an object and a destructor
     causes re-entrant mutation of the dictionary.

   - gh-145187(33): Fix compiler assertion fail when a type parameter
     bound contains an invalid expression in a conditional block.

   - gh-145142(34): Fix a crash in the free-threaded build when the
     dictionary argument to *note str.maketrans(): fdd. is concurrently
     modified.

   - gh-144872(35): Fix heap buffer overflow in the parser found by
     OSS-Fuzz.

   - gh-144766(36): Fix a crash in fork child process when perf support
     is enabled.

   - gh-144759(37): 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(38): 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(39): Fix crash when importing a module whose ‘PyInit’
     function raises an exception from a subinterpreter.

   - gh-144438(40): Align the QSBR thread state array to a 64-byte cache
     line boundary to avoid false sharing in the *note free-threaded
     build: 17b0.

   - gh-144513(41): Fix potential deadlock when using critical sections
     during stop-the-world pauses in the free-threaded build.

   - gh-144446(42): Fix data races in the free-threaded build when
     reading frame object attributes while another thread is executing
     the frame.

   - gh-143636(43): Fix a crash when calling *note
     SimpleNamespace.__replace__(): 4e5. on non-namespace instances.
     Patch by Bénédikt Tran.

   - gh-143650(44): Fix race condition in *note importlib: 7b. where a
     thread could receive a stale module reference when another thread's
     import fails.

   - gh-141732(45): Ensure the *note __repr__(): 82f. for *note
     ExceptionGroup: 4d2. and *note BaseExceptionGroup: 566. does not
     change when the exception sequence that was original passed in to
     its constructor is subsequently mutated.

   - gh-140594(46): Fix an out of bounds read when a single NUL
     character is read from the standard input.  Patch by Shamil
     Abdulaev.

   - gh-91636(47): While performing garbage collection, clear weakrefs
     to unreachable objects that are created during running of
     finalizers.  If those weakrefs were are not cleared, they could
     reveal unreachable objects.

   - gh-130327(48): Fix erroneous clearing of an object's *note
     __dict__: 77d. if overwritten at runtime.

   - gh-80667(49): 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/148157

   (2) https://issues.oss-fuzz.com/issues/492782951

   (3) https://github.com/python/cpython/issues/148144

   (4) https://github.com/python/cpython/issues/146615

   (5) https://github.com/python/cpython/issues/146308

   (6) https://github.com/python/cpython/issues/146128

   (7) https://github.com/python/cpython/issues/146250

   (8) https://github.com/python/cpython/issues/146245

   (9) https://github.com/python/cpython/issues/146196

   (10) https://github.com/python/cpython/issues/146227

   (11) https://github.com/python/cpython/issues/146056

   (12) https://github.com/python/cpython/issues/146092

   (13) https://github.com/python/cpython/issues/146041

   (14) https://github.com/python/cpython/issues/145990

   (15) https://github.com/python/cpython/issues/145990

   (16) https://github.com/python/cpython/issues/145376

   (17) https://github.com/python/cpython/issues/145792

   (18) https://github.com/python/cpython/issues/142183

   (19) https://github.com/python/cpython/issues/145779

   (20) https://github.com/python/cpython/issues/145783

   (21) https://issues.oss-fuzz.com/issues/491369109

   (22) https://github.com/python/cpython/issues/145685

   (23) https://github.com/python/cpython/issues/145701

   (24) https://issues.oss-fuzz.com/issues/491105000

   (25) https://github.com/python/cpython/issues/145713

   (26) https://github.com/python/cpython/issues/145615

   (27) https://github.com/python/cpython/issues/145566

   (28) https://github.com/python/cpython/issues/145335

   (29) https://github.com/python/cpython/issues/145036

   (30) https://github.com/python/cpython/issues/145376

   (31) https://github.com/python/cpython/issues/145234

   (32) https://github.com/python/cpython/issues/130555

   (33) https://github.com/python/cpython/issues/145187

   (34) https://github.com/python/cpython/issues/145142

   (35) https://github.com/python/cpython/issues/144872

   (36) https://github.com/python/cpython/issues/144766

   (37) https://github.com/python/cpython/issues/144759

   (38) https://github.com/python/cpython/issues/144563

   (39) https://github.com/python/cpython/issues/144601

   (40) https://github.com/python/cpython/issues/144438

   (41) https://github.com/python/cpython/issues/144513

   (42) https://github.com/python/cpython/issues/144446

   (43) https://github.com/python/cpython/issues/143636

   (44) https://github.com/python/cpython/issues/143650

   (45) https://github.com/python/cpython/issues/141732

   (46) https://github.com/python/cpython/issues/140594

   (47) https://github.com/python/cpython/issues/91636

   (48) https://github.com/python/cpython/issues/130327

   (49) https://github.com/python/cpython/issues/80667


File: python.info,  Node: ライブラリ<5>,  Next: ドキュメント<5>,  Prev: Core and Builtins<5>,  Up: Python 3 14 4 final

1.24.5.3 ライブラリ
...................

   - gh-144503(1): Fix a regression introduced in 3.14.3 and 3.13.12
     where the *note multiprocessing: 98. ‘forkserver’ start method
     would fail with *note BrokenPipeError: 126b. when the parent
     process had a very large *note sys.argv: 1480.  The argv is now
     passed to the forkserver as separate command-line arguments rather
     than being embedded in the ‘-c’ command string, avoiding the
     operating system's per-argument length limit.

   - gh-146613(2): *note itertools: 85.: Fix a crash in *note
     itertools.groupby(): 17cc. when the grouper iterator is
     concurrently mutated.

   - gh-146080(3): *note ssl: d5.: fix a crash when an SNI callback
     tries to use an SSL object that has already been garbage-collected.
     Patch by Bénédikt Tran.

   - gh-146556(4): Fix *note annotationlib.get_annotations(): 457.
     hanging indefinitely when called with ‘eval_str=True’ on a callable
     that has a circular ‘__wrapped__’ chain (e.g.  ‘f.__wrapped__ =
     f’).  Cycle detection using an id-based visited set now stops the
     traversal and falls back to the globals found so far, mirroring the
     approach of *note inspect.unwrap(): 1162.

   - gh-146090(5): *note sqlite3: d4.: fix a crash when *note
     sqlite3.Connection.create_collation(): 887. fails with
     SQLITE_BUSY(6).  Patch by Bénédikt Tran.

   - gh-146090(7): *note sqlite3: d4.: properly raise *note MemoryError:
     1772. instead of *note SystemError: 795. when a context callback
     fails to be allocated.  Patch by Bénédikt Tran.

   - gh-145633(8): Fix ‘struct.pack('f', float)’: use *note
     PyFloat_Pack4(): 96e. to raise *note OverflowError: a85.  Patch by
     Sergey B Kirpichev and Victor Stinner.

   - gh-146310(9): The *note ensurepip: 59. module no longer looks for
     ‘pip-*.whl’ wheel packages in the current directory.

   - gh-146083(10): Update bundled libexpat(11) to version 2.7.5.

   - gh-146076(12): *note zoneinfo: 13b.: fix crashes when deleting
     ‘_weak_cache’ from a *note zoneinfo.ZoneInfo: ae0. subclass.

   - gh-146054(13): Limit the size of *note encodings.search_function():
     17cd. cache.  Found by OSS Fuzz in #493449985(14).

   - gh-146004(15): All *note -X: 170. options from the Python command
     line are now propagated to child processes spawned by *note
     multiprocessing: 98, not just a hard-coded subset.  This makes the
     behavior consistent between default "spawn" and "forkserver" start
     methods and the old "fork" start method.  The options that were
     previously not propagated are: ‘context_aware_warnings’,
     ‘cpu_count’, ‘disable-remote-debug’, ‘int_max_str_digits’,
     ‘lazy_imports’, ‘no_debug_ranges’, ‘pathconfig_warnings’, ‘perf’,
     ‘perf_jit’, ‘presite’, ‘pycache_prefix’, ‘thread_inherit_context’,
     and ‘warn_default_encoding’.

   - gh-145883(16): *note zoneinfo: 13b.: Fix heap buffer overflow reads
     from malformed TZif data.  Found by OSS Fuzz, issues #492245058(17)
     and #492230068(18).

   - gh-145754(19): Request signature during mock autospec with
     ‘FORWARDREF’ annotation format.  This prevents runtime errors when
     an annotation uses a name that is not defined at runtime.

   - gh-145750(20): Avoid undefined behaviour from signed integer
     overflow when parsing format strings in the *note struct: db.
     module.  Found by OSS Fuzz in #488466741(21).

   - gh-145492(22): Fix infinite recursion in *note
     collections.defaultdict: 13d8. ‘__repr__’ when a ‘defaultdict’
     contains itself.  Based on analysis by KowalskiThomas in
     gh-145492(23).

   - gh-145623(24): Fix crash in *note struct: db. when calling *note
     repr(): 1c3. or ‘__sizeof__()’ on an uninitialized *note
     struct.Struct: 17ce. object created via ‘Struct.__new__()’ without
     calling ‘__init__()’.

   - gh-145616(25): Detect Android sysconfig ABI correctly on 32-bit ARM
     Android on 64-bit ARM kernel

   - gh-145551(26): Fix InvalidStateError when cancelling process
     created by *note asyncio.create_subprocess_exec(): c6f. or *note
     asyncio.create_subprocess_shell(): c70.  Patch by Daan De Meyer.

   - gh-145446(27): Now *note functools: 63. is safer in free-threaded
     build when using keywords in *note functools.partial(): 219.

   - gh-145417(28): *note venv: 118.: Prevent incorrect preservation of
     SELinux context when copying the ‘Activate.ps1’ script.  The script
     inherited the SELinux security context of the system template
     directory, rather than the destination project directory.

   - gh-145376(29): Fix double free and null pointer dereference in
     unusual error scenarios in *note hashlib: 6c. and *note hmac: 6e.
     modules.

   - gh-145301(30): *note hmac: 6e.: fix a crash when the initialization
     of the underlying C extension module fails.

   - gh-145301(31): *note hashlib: 6c.: fix a crash when the
     initialization of the underlying C extension module fails.

   - gh-145264(32): Base64 decoder (see *note binascii.a2b_base64():
     17cf, *note base64.b64decode(): 17d0, etc) no longer ignores excess
     data after the first padded quad in non-strict (default) mode.
     Instead, in conformance with RFC 4648(33), section 3.3, it now
     ignores the pad character, "=", if it is present before the end of
     the encoded data.

   - gh-145158(34): Avoid undefined behaviour from signed integer
     overflow when parsing format strings in the *note struct: db.
     module.

   - gh-144984(35): Fix crash in *note
     xml.parsers.expat.xmlparser.ExternalEntityParserCreate(): 17d1.
     when an allocation fails.  The error paths could dereference NULL
     ‘handlers’ and double-decrement the parent parser's reference
     count.

   - gh-88091(36): Fix *note unicodedata.decomposition(): 17d2. for
     Hangul characters.

   - gh-144986(37): Fix a memory leak in *note atexit.register(): a82.
     Patch by Shamil Abdulaev.

   - gh-144777(38): Fix data races in *note
     io.IncrementalNewlineDecoder: 17d3. in the *note free-threaded
     build: 17b0.

   - gh-144809(39): Make *note collections.deque: 7f4. copy atomic in
     the *note free-threaded build: 17b0.

   - gh-144835(40): Added missing explanations for some parameters in
     *note glob.glob(): 5a0. and *note glob.iglob(): a0c.

   - gh-144833(41): 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(42): Fix *note argparse.ArgumentParser: 1bf. to be *note
     pickleable: ab.

   - gh-144259(43): Fix inconsistent display of long multiline pasted
     content in the REPL.

   - gh-144156(44): Fix the folding of headers by the *note email: 3f.
     library when RFC 2047(45) encoded words are used.  Now whitespace
     is correctly preserved and also correctly added between adjacent
     encoded words.  The latter property was broken by the fix for
     gh-92081(46), which mostly fixed previous failures to preserve
     whitespace.

   - gh-66305(47): Fixed a hang on Windows in the *note tempfile: e6.
     module when trying to create a temporary file or subdirectory in a
     non-writable directory.

   - gh-140814(48): *note multiprocessing.freeze_support(): 17d4. no
     longer sets the default start method as a side effect, which
     previously caused a subsequent *note
     multiprocessing.set_start_method(): 24d. call to raise *note
     RuntimeError: 246.

   - gh-144475(49): Calling *note repr(): 1c3. on *note
     functools.partial(): 219. is now safer when the partial object's
     internal attributes are replaced while the string representation is
     being generated.

   - gh-144538(50): Bump the version of pip bundled in ensurepip to
     version 26.0.1

   - gh-144494(51): Fix performance regression in *note
     asyncio.all_tasks(): b53. on *note free-threaded builds: 17b0.
     Patch by Kumar Aditya.

   - gh-144316(52): Fix crash in ‘_remote_debugging’ that caused
     ‘test_external_inspection’ to intermittently fail.  Patch by
     Taegyun Kim.

   - gh-144363(53): Update bundled libexpat(54) to 2.7.4

   - gh-143637(55): Fixed a crash in socket.sendmsg() that could occur
     if ancillary data is mutated re-entrantly during argument parsing.

   - gh-143543(56): Fix a crash in itertools.groupby that could occur
     when a user-defined *note __eq__(): cf6. method re-enters the
     iterator during key comparison.

   - gh-140652(57): Fix a crash in ‘_interpchannels.list_all()’ after
     closing a channel.

   - gh-143698(58): Allow 'scheduler' and 'setpgroup' arguments to be
     explicitly *note None: 886. when calling *note os.posix_spawn():
     52e. or *note os.posix_spawnp(): 17d5.  Patch by Bénédikt Tran.

   - gh-143698(59): Raise *note TypeError: 199. instead of *note
     SystemError: 795. when the 'scheduler' in *note os.posix_spawn():
     52e. or *note os.posix_spawnp(): 17d5. is not a tuple.  Patch by
     Bénédikt Tran.

   - gh-142516(60): *note ssl: d5.: fix reference leaks in *note
     ssl.SSLContext: 355. objects.  Patch by Bénédikt Tran.

   - gh-143304(61): Fix *note ctypes.CDLL: be0. to honor the ‘handle’
     parameter on POSIX systems.

   - gh-142781(62): *note zoneinfo: 13b.: fix a crash when instantiating
     *note ZoneInfo: ae0. objects for which the internal class-level
     cache is inconsistent.

   - gh-142763(63): Fix a race condition between *note
     zoneinfo.ZoneInfo: ae0. creation and *note
     zoneinfo.ZoneInfo.clear_cache(): 17d6. that could raise *note
     KeyError: 5e7.

   - gh-142787(64): Fix assertion failure in *note sqlite3: d4. blob
     subscript when slicing with indices that result in an empty slice.

   - gh-142352(65): Fix *note asyncio.StreamWriter.start_tls(): 819. to
     transfer buffered data from *note StreamReader: 17d7. to the SSL
     layer, preventing data loss when upgrading a connection to TLS
     mid-stream (e.g., when implementing PROXY protocol support).

   - gh-141707(66): Don't change *note tarfile.TarInfo: 142e. type from
     ‘AREGTYPE’ to ‘DIRTYPE’ when parsing GNU long name or link headers.

   - gh-139933(67): Improve *note AttributeError: 5f0. suggestions for
     classes with a custom *note __dir__(): 17d8. method returning a
     list of unsortable values.  Patch by Bénédikt Tran.

   - gh-137335(68): Get rid of any possibility of a name conflict for
     named pipes in *note multiprocessing: 98. and *note asyncio: b. on
     Windows, no matter how small.

   - gh-80667(69): Support lookup for Tangut Ideographs in *note
     unicodedata: 10c.

   - bpo-40243(70): Fix ‘unicodedata.ucd_3_2_0.numeric()’ for
     non-decimal values.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144503

   (2) https://github.com/python/cpython/issues/146613

   (3) https://github.com/python/cpython/issues/146080

   (4) https://github.com/python/cpython/issues/146556

   (5) https://github.com/python/cpython/issues/146090

   (6) https://sqlite.org/rescode.html#busy

   (7) https://github.com/python/cpython/issues/146090

   (8) https://github.com/python/cpython/issues/145633

   (9) https://github.com/python/cpython/issues/146310

   (10) https://github.com/python/cpython/issues/146083

   (11) https://libexpat.github.io/

   (12) https://github.com/python/cpython/issues/146076

   (13) https://github.com/python/cpython/issues/146054

   (14) https://issues.oss-fuzz.com/issues/493449985

   (15) https://github.com/python/cpython/issues/146004

   (16) https://github.com/python/cpython/issues/145883

   (17) https://issues.oss-fuzz.com/issues/492245058

   (18) https://issues.oss-fuzz.com/issues/492230068

   (19) https://github.com/python/cpython/issues/145754

   (20) https://github.com/python/cpython/issues/145750

   (21) https://issues.oss-fuzz.com/issues/488466741

   (22) https://github.com/python/cpython/issues/145492

   (23) https://github.com/python/cpython/issues/145492

   (24) https://github.com/python/cpython/issues/145623

   (25) https://github.com/python/cpython/issues/145616

   (26) https://github.com/python/cpython/issues/145551

   (27) https://github.com/python/cpython/issues/145446

   (28) https://github.com/python/cpython/issues/145417

   (29) https://github.com/python/cpython/issues/145376

   (30) https://github.com/python/cpython/issues/145301

   (31) https://github.com/python/cpython/issues/145301

   (32) https://github.com/python/cpython/issues/145264

   (33) https://datatracker.ietf.org/doc/html/rfc4648.html

   (34) https://github.com/python/cpython/issues/145158

   (35) https://github.com/python/cpython/issues/144984

   (36) https://github.com/python/cpython/issues/88091

   (37) https://github.com/python/cpython/issues/144986

   (38) https://github.com/python/cpython/issues/144777

   (39) https://github.com/python/cpython/issues/144809

   (40) https://github.com/python/cpython/issues/144835

   (41) https://github.com/python/cpython/issues/144833

   (42) https://github.com/python/cpython/issues/144782

   (43) https://github.com/python/cpython/issues/144259

   (44) https://github.com/python/cpython/issues/144156

   (45) https://datatracker.ietf.org/doc/html/rfc2047.html

   (46) https://github.com/python/cpython/issues/92081

   (47) https://github.com/python/cpython/issues/66305

   (48) https://github.com/python/cpython/issues/140814

   (49) https://github.com/python/cpython/issues/144475

   (50) https://github.com/python/cpython/issues/144538

   (51) https://github.com/python/cpython/issues/144494

   (52) https://github.com/python/cpython/issues/144316

   (53) https://github.com/python/cpython/issues/144363

   (54) https://libexpat.github.io/

   (55) https://github.com/python/cpython/issues/143637

   (56) https://github.com/python/cpython/issues/143543

   (57) https://github.com/python/cpython/issues/140652

   (58) https://github.com/python/cpython/issues/143698

   (59) https://github.com/python/cpython/issues/143698

   (60) https://github.com/python/cpython/issues/142516

   (61) https://github.com/python/cpython/issues/143304

   (62) https://github.com/python/cpython/issues/142781

   (63) https://github.com/python/cpython/issues/142763

   (64) https://github.com/python/cpython/issues/142787

   (65) https://github.com/python/cpython/issues/142352

   (66) https://github.com/python/cpython/issues/141707

   (67) https://github.com/python/cpython/issues/139933

   (68) https://github.com/python/cpython/issues/137335

   (69) https://github.com/python/cpython/issues/80667

   (70) https://bugs.python.org/issue?@action=redirect&bpo=40243


File: python.info,  Node: ドキュメント<5>,  Next: テスト<4>,  Prev: ライブラリ<5>,  Up: Python 3 14 4 final

1.24.5.4 ドキュメント
.....................

   - gh-126676(1): Expand *note argparse: 7. documentation for
     ‘type=bool’ with a demonstration of the surprising behavior and
     pointers to common alternatives.

   - gh-145649(2): Fix text wrapping and formatting of ‘-X’ option
     descriptions in the ‘python(1)(3)’ man page by using proper roff
     markup.

   - gh-145450(4): Document missing public *note wave.Wave_write: 335.
     getter methods.

   - gh-136246(5): 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/126676

   (2) https://github.com/python/cpython/issues/145649

   (3) https://manpages.debian.org/python(1)

   (4) https://github.com/python/cpython/issues/145450

   (5) https://github.com/python/cpython/issues/136246


File: python.info,  Node: テスト<4>,  Next: ビルド<4>,  Prev: ドキュメント<5>,  Up: Python 3 14 4 final

1.24.5.5 テスト
...............

   - gh-144418(1): The Android testbed's emulator RAM has been increased
     from 2 GB to 4 GB.

   - gh-146202(2): Fix a race condition in regrtest: make sure that the
     temporary directory is created in the worker process.  Previously,
     temp_cwd() could fail on Windows if the "build" directory was not
     created.  Patch by Victor Stinner.

   - gh-144739(3): When Python was compiled with system expat older then
     2.7.2 but tests run with newer expat, still skip
     ‘test.test_pyexpat.MemoryProtectionTest’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144418

   (2) https://github.com/python/cpython/issues/146202

   (3) https://github.com/python/cpython/issues/144739


File: python.info,  Node: ビルド<4>,  Next: Windows<3>,  Prev: テスト<4>,  Up: Python 3 14 4 final

1.24.5.6 ビルド
...............

   - gh-146541(1): The Android testbed can now be built for 32-bit ARM
     and x86 targets.

   - gh-146498(2): The iOS XCframework build script now ensures
     libpython isn't included in installed app content, and is more
     robust in identifying standard library binary content that requires
     processing.

   - gh-146450(3): The Android build script was modified to improve
     parity with other platform build scripts.

   - gh-146446(4): The clean target for the Apple/iOS XCframework build
     script is now more selective when targeting a single architecture.

   - gh-145801(5): When Python build is optimized with GCC using PGO,
     use ‘-fprofile-update=atomic’ option to use atomic operations when
     updating profile information.  This option reduces the risk of gcov
     Data Files (.gcda) corruption which can cause random GCC crashes.
     Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/146541

   (2) https://github.com/python/cpython/issues/146498

   (3) https://github.com/python/cpython/issues/146450

   (4) https://github.com/python/cpython/issues/146446

   (5) https://github.com/python/cpython/issues/145801


File: python.info,  Node: Windows<3>,  Next: macOS<4>,  Prev: ビルド<4>,  Up: Python 3 14 4 final

1.24.5.7 Windows
................

   - gh-145307(1): Defers loading of the ‘psapi.dll’ module until it is
     used by *note ctypes.util.dllist(): 1f2.

   - gh-144551(2): Updated bundled version of OpenSSL to 3.0.19.

   - gh-140131(3): Fix REPL cursor position on Windows when module
     completion suggestion line hits console width.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/145307

   (2) https://github.com/python/cpython/issues/144551

   (3) https://github.com/python/cpython/issues/140131


File: python.info,  Node: macOS<4>,  Next: C API<3>,  Prev: Windows<3>,  Up: Python 3 14 4 final

1.24.5.8 macOS
..............

   - gh-144551(1): Update macOS installer to use OpenSSL 3.0.19.

   - gh-137586(2): Invoke ‘osascript’ with absolute path in *note
     webbrowser: 11c. and ‘turtledemo’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144551

   (2) https://github.com/python/cpython/issues/137586


File: python.info,  Node: C API<3>,  Prev: macOS<4>,  Up: Python 3 14 4 final

1.24.5.9 C API
..............

   - gh-146056(1): *note PyUnicodeWriter_WriteRepr(): 3b9. now supports
     ‘NULL’ argument.

   - gh-145010(2): Use GCC dialect alternatives for inline assembly in
     ‘object.h’ so that the Python headers compile correctly with
     ‘-masm=intel’.

   - gh-144981(3): Made *note PyUnstable_Code_SetExtra(): 17df, *note
     PyUnstable_Code_GetExtra(): 17e0, and *note
     PyUnstable_Eval_RequestCodeExtraIndex(): 17e1. thread-safe on the
     *note free threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/146056

   (2) https://github.com/python/cpython/issues/145010

   (3) https://github.com/python/cpython/issues/144981


File: python.info,  Node: Python 3 14 3 final,  Next: Python 3 14 2 final,  Prev: Python 3 14 4 final,  Up: 変更履歴

1.24.6 Python 3.14.3 final
--------------------------

'Release date: 2026-02-03'

* Menu:

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


File: python.info,  Node: Windows<4>,  Next: Tools/Demos,  Up: Python 3 14 3 final

1.24.6.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: テスト<5>,  Prev: Windows<4>,  Up: Python 3 14 3 final

1.24.6.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: テスト<5>,  Next: セキュリティ<6>,  Prev: Tools/Demos,  Up: Python 3 14 3 final

1.24.6.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: セキュリティ<6>,  Next: ライブラリ<6>,  Prev: テスト<5>,  Up: Python 3 14 3 final

1.24.6.4 セキュリティ
.....................

   - gh-144125(1): *note BytesGenerator: 13eb. 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: e02. 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: ライブラリ<6>,  Next: IDLE<4>,  Prev: セキュリティ<6>,  Up: Python 3 14 3 final

1.24.6.5 ライブラリ
...................

   - gh-144380(1): Improve performance of *note io.BufferedReader: 142b.
     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(): 1367. 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():
     1452. and *note inspect.getcoroutinestate(): 101e. could fail for
     generators wrapped by *note types.coroutine(): 108c. in the
     suspended state.

   - gh-143831(7): *note annotationlib.ForwardRef: 17e8. 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(): 219. in
     the *note free threading: 1f6. build.

   - gh-143706(10): Fix *note multiprocessing: 98. forkserver so that
     *note sys.argv: 1480. is correctly set before ‘__main__’ is
     preloaded.  Previously, ‘sys.argv’ 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:
     c17. and *note pickle.Unpickler: 17e9. 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: 246.

   - gh-78724(12): Raise *note RuntimeError: 246.'s when user attempts
     to call methods on half-initialized *note Struct: 17ce. 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(): 17ea. now raises *note
     ValueError: 2ee. if the stack size is too small.  Patch by Victor
     Stinner.

   - gh-143602(15): Fix a inconsistency issue in *note write(): 15c9.
     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 ‘sys.unraisablehook()’: hold a
     strong reference to the old hook.  Patch by Victor Stinner.

   - gh-143517(17): *note annotationlib.get_annotations(): 457. no
     longer raises a *note SyntaxError: 18f. 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:
     10a8. object is concurrently mutated during *note write(): 15c9. or
     *note writelines(): 17eb.

   - 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: 24f. 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(): 1315. 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: 17b6. 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: 13b.: fix infinite loop in *note
     ZoneInfo.from_file: 17ec. 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: 12c.: fix
     use-after-free crashes in *note __getitem__(): 588. and *note
     __setitem__(): 14e7. methods of *note Element: 361. 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(): 1055. 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(): 17ed. 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: 17ee.).
     Patch by Bartosz Sławecki.

   - gh-140648(34): The *note asyncio: b. REPL now respects the *note
     -I: b5b. flag (isolated mode).  Previously, it would load and
     execute *note PYTHONSTARTUP: 1ba. 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(): 17ef.

   - gh-112127(38): Fix possible use-after-free in *note
     atexit.unregister(): 17ef. 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: 129. 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(): 17f0. 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__: 19f. or *note
     i.__float__: bc5. mutates the array.

   - gh-142594(43): Fix crash in ‘TextIOWrapper.close()’ when the
     underlying buffer's ‘closed’ property calls *note detach(): 17f1.

   - gh-142451(44): *note hmac: 6e.: Ensure that the *note
     HMAC.block_size: 1150. attribute is correctly copied by *note
     HMAC.copy: 17f2.  Patch by Bénédikt Tran.

   - gh-142495(45): *note collections.defaultdict: 13d8. now prioritizes
     *note __setitem__(): 14e7. 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: 10e.: fix a thread safety issue
     where *note Mock.call_count: 17f3. 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 ‘argparse’.

   - gh-142282(55): Fix *note winreg.QueryValueEx(): 17f4. 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: 17f5.

   - gh-142006(59): Fix a bug in the *note email.policy.default: 12d0.
     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(): a86.
     leaving underlying cancelled asyncio task running.

   - gh-139971(61): *note pydoc: ba.: Ensure that the link to the online
     documentation of a *note stdlib: 17f6. 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: 17f7./*note copyright:
     17f8./*note credits: 17f9. 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: 17fa. 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<4>,  Next: ドキュメント<6>,  Prev: ライブラリ<6>,  Up: Python 3 14 3 final

1.24.6.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: ドキュメント<6>,  Next: Core and Builtins<6>,  Prev: IDLE<4>,  Up: Python 3 14 3 final

1.24.6.7 ドキュメント
.....................

   - gh-140806(1): Add documentation for *note enum.bin(): 17fd.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140806


File: python.info,  Node: Core and Builtins<6>,  Next: C API<4>,  Prev: ドキュメント<6>,  Up: Python 3 14 3 final

1.24.6.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: 185. 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: 16a. 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__: cf7. 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__: f85. 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():
     f6a. and *note memoryview.hex(): f6b. when the separator's *note
     __len__(): 17ff. 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: 1f6. build.

   - gh-143135(14): Set *note sys.flags.inspect: 1800. to ‘1’ when *note
     PYTHONINSPECT: 16f8. 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(): 1801. 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(): db3.
     and *note PyTraceMalloc_Untrack(): db4. when *note tracemalloc:
     106. 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: 178. comparison when a custom ‘__eq__’ method
     modifies the context via *note set(): 1788.

   - gh-142766(20): Clear the frame of a generator when *note
     generator.close(): 1802. 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(): b9d. 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: 342.
     search-like methods (*note find(): 15c1, *note count(): 1803, *note
     index(): 1804, *note rindex(): 1805, and *note rfind(): 15c2.) by
     marking the storage as exported which causes reallocation attempts
     to raise *note BufferError: 1806.  For *note contains(): adb, *note
     split(): 1807, and *note rsplit(): 1808. the *note buffer protocol:
     262. 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:
     16b, 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(): ad8. 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<4>,  Next: ビルド<5>,  Prev: Core and Builtins<6>,  Up: Python 3 14 3 final

1.24.6.9 C API
..............

   - gh-142589(1): Fix *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 3c5. 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: ビルド<5>,  Prev: C API<4>,  Up: Python 3 14 3 final

1.24.6.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.7 Python 3.14.2 final
--------------------------

'Release date: 2025-12-05'

* Menu:

* セキュリティ: セキュリティ<7>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<7>.
* ライブラリ: ライブラリ<8>.


File: python.info,  Node: セキュリティ<7>,  Next: ライブラリ<7>,  Up: Python 3 14 2 final

1.24.7.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: 1772, 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: ライブラリ<7>,  Next: Core and Builtins<7>,  Prev: セキュリティ<7>,  Up: Python 3 14 2 final

1.24.7.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<7>,  Next: ライブラリ<8>,  Prev: ライブラリ<7>,  Up: Python 3 14 2 final

1.24.7.3 Core and Builtins
..........................

   - gh-142218(1): Fix crash when inserting into a split table
     dictionary with a non *note str: 16a. key that matches an existing
     key.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142218


File: python.info,  Node: ライブラリ<8>,  Prev: Core and Builtins<7>,  Up: Python 3 14 2 final

1.24.7.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.8 Python 3.14.1 final
--------------------------

'Release date: 2025-12-02'

* Menu:

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


File: python.info,  Node: Windows<5>,  Next: Tools/Demos<2>,  Up: Python 3 14 1 final

1.24.8.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: テスト<6>,  Prev: Windows<5>,  Up: Python 3 14 1 final

1.24.8.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: テスト<6>,  Next: セキュリティ<8>,  Prev: Tools/Demos<2>,  Up: Python 3 14 1 final

1.24.8.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: 10d. 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(): c47. 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: セキュリティ<8>,  Next: ライブラリ<9>,  Prev: テスト<6>,  Up: Python 3 14 1 final

1.24.8.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: 1815. and reject
     negative values for *note Cursor.arraysize: 1816.  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: a7b.

   - 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(): 15f7.

   - 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: 1772,
     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: 1772, 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: ライブラリ<9>,  Next: IDLE<5>,  Prev: セキュリティ<8>,  Up: Python 3 14 1 final

1.24.8.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(): 1818. instead of leaving the class
     in an inconsistent state.

   - gh-87512(2): Fix *note subprocess.Popen.communicate(): 1818.
     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(): 1818. was
     called with 'input' and a 'timeout' and is called for a second time
     after a *note TimeoutExpired: 1819. 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: 181a. raising *note
     OSError: 2c2. from *note fileno(): 181b. 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(): 181c. and *note IPv6Network.hosts(): 181d.
     always return an iterator.

   - gh-140938(9): The *note statistics.stdev(): 8e4. and *note
     statistics.pstdev(): 181e. functions now raise a *note ValueError:
     2ee. 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(): 353.
     ‘after_in_parent=’ callback (re)starts a thread.

   - gh-141314(12): Fix assertion failure in *note
     io.TextIOWrapper.tell(): 181f. 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: 10a8.

   - gh-141141(14): Fix a thread safety issue with *note
     base64.b85decode(): 1128.  Contributed by Benel Tayar.

   - gh-137969(15): Fix *note annotationlib.ForwardRef.evaluate(): 1820.
     returning *note ForwardRef: 17e8. 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: fd7. 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: 1821. when *note
     socket.if_nametoindex(): c27. or *note socket.if_indextoname():
     c28. raise an *note OSError: 2c2.  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: a7b. 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: 112, 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(): c6f. or *note
     asyncio.create_subprocess_shell(): c70.  Patch by Kumar Aditya.

   - gh-120057(26): Add *note os.reload_environ(): 25a. 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: 12d.: Fix a memory leak
     that could affect users with *note ElementDeclHandler(): 17c3. set
     to a custom element declaration handler.  Patch by Sebastian
     Pipping.

   - gh-140607(33): Inside *note io.RawIOBase.read(): 1021, validate
     that the count of bytes returned by *note io.RawIOBase.readinto():
     1022. is valid (inside the provided buffer).

   - gh-138162(34): Fix *note logging.LoggerAdapter: 1511. with
     ‘merge_extra=True’ and without the 'extra' argument.

   - gh-138774(35): *note ast.unparse(): ae6. now generates full source
     code when handling *note ast.Interpolation: 1822. 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: 16a. 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: 2aa. 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: 1823. 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(): 1824. 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(): e15. 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: 12e6.
     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(): 1825.  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
     ‘rlcompleter’.

   - gh-139246(55): fix: paste zero-width in default repl width is
     wrong.

   - gh-90949(56): Add *note SetAllocTrackerActivationThreshold(): 1826.
     and *note SetAllocTrackerMaximumAmplification(): 1827. to *note
     xmlparser: 179a. objects to tune protections against
     disproportional amounts of dynamic memory usage 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(): 1777. 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: 268. 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: 17f9. 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(): 1828.
     due to a platform bug on macOS.

   - gh-138859(69): Fix generic type parameterization raising a *note
     TypeError: 199. when omitting a ‘ParamSpec’ that has a default
     which is not a list of types.

   - gh-138764(70): Prevent *note
     annotationlib.call_annotate_function(): 1829. 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: 182a. field of the *note os.stat_result: 16df.
     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: 114. 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:
     114. 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: 17e8. objects which rely on names defined
     as globals.

   - gh-138432(78): *note zoneinfo.reset_tzpath(): 182b. will now
     convert any *note os.PathLike: e4f. 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 ‘os.PathLike’ 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: 182c.  Patch by Dung Nguyen.

   - gh-60462(80): Fix *note locale.strxfrm(): 1828. 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(): 231. 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: 13b. module if the
     C implementation of the *note datetime: 34. module is not
     available.

   - gh-137490(87): Handle *note ECANCELED: 182d. in the same way as
     *note EINTR: f8b. in *note signal.sigwaitinfo(): faf. on NetBSD.

   - gh-137477(88): Fix ‘inspect.getblock()’, *note
     inspect.getsourcelines(): 1824. and *note inspect.getsource():
     182e. for generator expressions.

   - gh-137044(89): Return large limit values as positive integers
     instead of negative integers in *note resource.getrlimit(): 182f.
     Accept large values and reject negative values (except *note
     RLIM_INFINITY: 1830.) for limits in *note resource.setrlimit():
     1831.

   - gh-75989(90): *note tarfile.TarFile.extractall(): 29d. and *note
     tarfile.TarFile.extract(): 29e. 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: b4a. to remain
     ‘True’ until the underlying OS thread is fully cleaned up.  This
     avoids false negatives in edge cases involving thread monitoring or
     premature ‘threading.Thread.is_alive’ calls.

   - gh-137273(93): Fix debug assertion failure in *note
     locale.setlocale(): 930. on Windows.

   - gh-137239(94): *note heapq: 6d.: Update ‘heapq.__all__’ with
     ‘*_max’ functions.

   - gh-81325(95): *note tarfile.TarFile: 142d. 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: 1832.
     for objects decorated with *note functools.cache(): 1833. or *note
     functools.cached_property: 763.

   - gh-136912(99): *note hmac.digest(): d36. 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: be0. without
     name when passing a handle as an argument.

   - gh-136234(101): Fix *note asyncio.WriteTransport.writelines():
     1834. to be robust to connection failure, by using the same
     behavior as *note write(): 1835.

   - 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(): 1818.
     ‘input=’ handling of *note memoryview: 166. 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: 355. or *note ssl.SSLSocket: aeb. 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: 10a8. safe in *note
     free-threaded: 1f6. 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: 12c7.

   - 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(): 1325. and *note
     os.sched_get_priority_max(): 1324. 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<5>,  Next: ドキュメント<7>,  Prev: ライブラリ<9>,  Up: Python 3 14 1 final

1.24.8.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: ドキュメント<7>,  Next: Core and Builtins<8>,  Prev: IDLE<5>,  Up: Python 3 14 1 final

1.24.8.7 ドキュメント
.....................

   - gh-141994(1): *note xml.sax.handler: 131.: Make Documentation of
     *note xml.sax.handler.feature_external_ges: 1838. 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: 94d. 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<8>,  Next: ライブラリ<10>,  Prev: ドキュメント<7>,  Up: Python 3 14 1 final

1.24.8.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: ライブラリ<10>,  Next: Core and Builtins<9>,  Prev: Core and Builtins<8>,  Up: Python 3 14 1 final

1.24.8.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<9>,  Next: ライブラリ<11>,  Prev: ライブラリ<10>,  Up: Python 3 14 1 final

1.24.8.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(): 183c. 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: ライブラリ<11>,  Next: Core and Builtins<10>,  Prev: Core and Builtins<9>,  Up: Python 3 14 1 final

1.24.8.11 ライブラリ
....................

   - gh-116738(1): Make csv module thread-safe on the *note free
     threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<10>,  Next: ライブラリ<12>,  Prev: ライブラリ<11>,  Up: Python 3 14 1 final

1.24.8.12 Core and Builtins
...........................

   - gh-140939(1): Fix memory leak when *note bytearray: 342. or *note
     bytes: 193. is formated with the ‘%*b’ format with a large width
     that results in a *note MemoryError: 1772.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140939


File: python.info,  Node: ライブラリ<12>,  Next: Core and Builtins<11>,  Prev: Core and Builtins<10>,  Up: Python 3 14 1 final

1.24.8.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<11>,  Next: ライブラリ<13>,  Prev: ライブラリ<12>,  Up: Python 3 14 1 final

1.24.8.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: 184. if *note
     dict.clear(): 17ca. 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(): 1a0. 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:
     1841. containing non-*note str: 16a.

   - gh-140431(7): Fix a crash in Python's *note garbage collector:
     1842. due to partially initialized *note coroutine: 6b9. objects
     when coroutine origin tracking depth is enabled (*note
     sys.set_coroutine_origin_tracking_depth(): d89.).

   ---------- 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: ライブラリ<13>,  Next: Core and Builtins<12>,  Prev: Core and Builtins<11>,  Up: Python 3 14 1 final

1.24.8.15 ライブラリ
....................

   - gh-140398(1): Fix memory leaks in *note readline: bf. functions
     *note read_init_file(): 1844, *note read_history_file(): 1845,
     *note write_history_file(): 1846, and *note append_history_file():
     1055. when *note PySys_Audit(): 613. fails.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140398


File: python.info,  Node: Core and Builtins<12>,  Next: ライブラリ<14>,  Prev: ライブラリ<13>,  Up: Python 3 14 1 final

1.24.8.16 Core and Builtins
...........................

   - gh-140406(1): Fix memory leak when an object's *note __hash__():
     cf7. method returns an object that isn't an *note int: 19c.

   - 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: 2b0,
     *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: 2aa. 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(): 167b.  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(): 1c4. 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: ライブラリ<14>,  Next: Core and Builtins<13>,  Prev: Core and Builtins<12>,  Up: Python 3 14 1 final

1.24.8.17 ライブラリ
....................

   - gh-116738(1): Make *note mmap: 94. thread-safe on the *note free
     threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<13>,  Next: ライブラリ<15>,  Prev: ライブラリ<14>,  Up: Python 3 14 1 final

1.24.8.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: 18f. 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__(): 184a, *note
     __deepcopy__(): 17b7, and *note __bases__: 16ca. from the *note
     __dir__(): 17d8. entries of *note types.GenericAlias: 9f0.

   - 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: ライブラリ<15>,  Next: Core and Builtins<14>,  Prev: Core and Builtins<13>,  Up: Python 3 14 1 final

1.24.8.19 ライブラリ
....................

   - gh-116738(1): Make *note cProfile: 2b. thread-safe on the *note
     free threaded: 1f6. 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<14>,  Next: C API<5>,  Prev: ライブラリ<15>,  Up: Python 3 14 1 final

1.24.8.20 Core and Builtins
...........................

   - gh-137433(1): Fix a potential deadlock in the *note free threading:
     1f6. 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: 1f6. 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<5>,  Next: ビルド<6>,  Prev: Core and Builtins<14>,  Up: Python 3 14 1 final

1.24.8.21 C API
...............

   - gh-137422(1): Fix *note free threading: 1f6. 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: 1791.

   - 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(): 96d. and *note
     PyFloat_Pack4(): 96e, 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: 184e. 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(): 2d1. definition on limited C
     API 3.11-3.13.  Patch by Victor Stinner.

   - gh-139653(6): Add *note
     PyUnstable_ThreadState_SetStackProtection(): 464. and *note
     PyUnstable_ThreadState_ResetStackProtection(): 465. 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: ビルド<6>,  Prev: C API<5>,  Up: Python 3 14 1 final

1.24.8.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.9 Python 3.14.0 final
--------------------------

'Release date: 2025-10-07'

* Menu:

* macOS: macOS<5>.
* Windows: Windows<6>.
* Tools/Demos: Tools/Demos<3>.
* セキュリティ: セキュリティ<9>.
* ライブラリ: ライブラリ<16>.


File: python.info,  Node: macOS<5>,  Next: Windows<6>,  Up: Python 3 14 0 final

1.24.9.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<6>,  Next: Tools/Demos<3>,  Prev: macOS<5>,  Up: Python 3 14 0 final

1.24.9.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: セキュリティ<9>,  Prev: Windows<6>,  Up: Python 3 14 0 final

1.24.9.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: セキュリティ<9>,  Next: ライブラリ<16>,  Prev: Tools/Demos<3>,  Up: Python 3 14 0 final

1.24.9.4 セキュリティ
.....................

   - gh-139400(1): *note xml.parsers.expat: 12d.: Make sure that parent
     Expat parsers are only garbage-collected once they are no longer
     referenced by subparsers created by *note
     ExternalEntityParserCreate(): 17d1.  Patch by Sebastian Pipping.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139400


File: python.info,  Node: ライブラリ<16>,  Prev: セキュリティ<9>,  Up: Python 3 14 0 final

1.24.9.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.10 Python 3.14.0 release candidate 3
-----------------------------------------

'Release date: 2025-09-18'

* Menu:

* Windows: Windows<7>.
* Tools/Demos: Tools/Demos<4>.
* セキュリティ: セキュリティ<10>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<15>.


File: python.info,  Node: Windows<7>,  Next: Tools/Demos<4>,  Up: Python 3 14 0 release candidate 3

1.24.10.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: セキュリティ<10>,  Prev: Windows<7>,  Up: Python 3 14 0 release candidate 3

1.24.10.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: セキュリティ<10>,  Next: ライブラリ<17>,  Prev: Tools/Demos<4>,  Up: Python 3 14 0 release candidate 3

1.24.10.3 セキュリティ
......................

   - gh-135661(1): Fix CDATA section parsing in *note
     html.parser.HTMLParser: a7b. 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: ライブラリ<17>,  Next: Core and Builtins<15>,  Prev: セキュリティ<10>,  Up: Python 3 14 0 release candidate 3

1.24.10.4 ライブラリ
....................

   - gh-138998(1): Update bundled libexpat to 2.7.2

   - gh-118803(2): Add back *note collections.abc.ByteString: 340. and
     *note typing.ByteString: 343.  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(): 8c1. calls on
     generic *note typing.TypedDict: 330. classes defined with string
     annotations.

   - gh-138804(4): Raise *note TypeError: 199. 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: 2ee. when a multi-character
     string is passed to the 'echo_char' parameter of *note
     getpass.getpass(): 21f.  Patch by Benjamin Johnson.

   - gh-138515(7): *note email: 3f. is added to Emscripten build.

   - gh-99948(8): *note ctypes.util.find_library(): f49. 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: 15b0. 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():
     185b. on Alpine Linux if compiled with -strip-all.

   - gh-136134(13): ‘SMTP.auth_cram_md5()’ now raises an *note
     SMTPException: 11a7. instead of a *note ValueError: 2ee. if Python
     has been built without MD5 support.  In particular, *note SMTP:
     b2b. 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: 185c. now raises an
     *note IMAP4.error: 185d. 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<15>,  Prev: ライブラリ<17>,  Up: Python 3 14 0 release candidate 3

1.24.10.5 Core and Builtins
...........................

   - gh-71810(1): Raise *note OverflowError: a85. 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: 185f. 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: 1af. emitted for erroneous
     subscript expressions involving *note template string literals:
     1860.  Patch by Brian Schubert.

   - gh-138318(5): The default REPL now avoids highlighting built-in
     names (for instance *note set: 185. or *note format(): 19a.) 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: 119.
     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: 1ba. 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.11 Python 3.14.0 release candidate 2
-----------------------------------------

'Release date: 2025-08-14'

* Menu:

* macOS: macOS<6>.
* Windows: Windows<8>.
* ライブラリ: ライブラリ<18>.
* ドキュメント: ドキュメント<8>.
* Core and Builtins: Core and Builtins<16>.
* C API: C API<6>.
* ビルド: ビルド<7>.


File: python.info,  Node: macOS<6>,  Next: Windows<8>,  Up: Python 3 14 0 release candidate 2

1.24.11.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<8>,  Next: ライブラリ<18>,  Prev: macOS<6>,  Up: Python 3 14 0 release candidate 2

1.24.11.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: ライブラリ<18>,  Next: ドキュメント<8>,  Prev: Windows<8>,  Up: Python 3 14 0 release candidate 2

1.24.11.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(): 1820. 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: 199. 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(): 2bf.
     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 ‘dataclasses’.

   ---------- 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: ドキュメント<8>,  Next: Core and Builtins<16>,  Prev: ライブラリ<18>,  Up: Python 3 14 0 release candidate 2

1.24.11.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<16>,  Next: C API<6>,  Prev: ドキュメント<8>,  Up: Python 3 14 0 release candidate 2

1.24.11.5 Core and Builtins
...........................

   - gh-137400(1): Fix a crash in the *note free threading: 1f6. 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: 17f. statement to ensure that the node's body is
     never empty.  There was a *note ValueError: 2ee. 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<6>,  Next: ビルド<7>,  Prev: Core and Builtins<16>,  Up: Python 3 14 0 release candidate 2

1.24.11.6 C API
...............

   - gh-137573(1): Mark ‘_PyOptimizer_Optimize’ as *note Py_NO_INLINE:
     1868. to prevent stack overflow crashes on macOS.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137573


File: python.info,  Node: ビルド<7>,  Prev: C API<6>,  Up: Python 3 14 0 release candidate 2

1.24.11.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.12 Python 3.14.0 release candidate 1
-----------------------------------------

'Release date: 2025-07-22'

* Menu:

* Tools/Demos: Tools/Demos<5>.
* セキュリティ: セキュリティ<11>.
* ライブラリ: ライブラリ<19>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<19>.
* C API: C API<7>.
* ビルド: ビルド<8>.


File: python.info,  Node: Tools/Demos<5>,  Next: セキュリティ<11>,  Up: Python 3 14 0 release candidate 1

1.24.12.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: セキュリティ<11>,  Next: ライブラリ<19>,  Prev: Tools/Demos<5>,  Up: Python 3 14 0 release candidate 1

1.24.12.2 セキュリティ
......................

   - gh-135661(1): Fix parsing attributes with whitespaces around the
     ‘=’ separator in *note html.parser.HTMLParser: a7b. according to
     the HTML5 standard.

   - gh-118350(2): Fix support of escapable raw text mode (elements
     "textarea" and "title") in *note html.parser.HTMLParser: a7b.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135661

   (2) https://github.com/python/cpython/issues/118350


File: python.info,  Node: ライブラリ<19>,  Next: Core and Builtins<17>,  Prev: セキュリティ<11>,  Up: Python 3 14 0 release candidate 1

1.24.12.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(): 2bf.

   - gh-130645(4): Enable color help by default in *note argparse: 7.

   - gh-136549(5): Fix signature of *note threading.excepthook(): a4f.

   - gh-136523(6): Fix *note wave.Wave_write: 335. 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: 1d4.'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: fb9.

   - gh-136380(11): Raises *note AttributeError: 5f0. when accessing
     *note concurrent.futures.InterpreterPoolExecutor: 1d4. and
     subinterpreters are not available.

   - gh-134759(12): Fix *note UnboundLocalError: 1754. in *note
     email.message.Message.get_payload(): 13e9. when the payload to
     decode is a *note bytes: 193. 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<17>,  Next: ライブラリ<20>,  Prev: ライブラリ<19>,  Up: Python 3 14 0 release candidate 1

1.24.12.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: ライブラリ<20>,  Next: Core and Builtins<18>,  Prev: Core and Builtins<17>,  Up: Python 3 14 0 release candidate 1

1.24.12.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<18>,  Next: ライブラリ<21>,  Prev: ライブラリ<20>,  Up: Python 3 14 0 release candidate 1

1.24.12.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: 13de. 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: 16a.  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: ライブラリ<21>,  Next: Core and Builtins<19>,  Prev: Core and Builtins<18>,  Up: Python 3 14 0 release candidate 1

1.24.12.7 ライブラリ
....................

   - gh-116738(1): Make functions in *note grp: 6a. thread-safe on the
     *note free threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<19>,  Next: C API<7>,  Prev: ライブラリ<21>,  Up: Python 3 14 0 release candidate 1

1.24.12.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: 1f6. build when a large dictionary or list is resized
     and accessed by multiple threads.

   - gh-91153(3): Fix a crash when a *note bytearray: 342. 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<7>,  Next: ビルド<8>,  Prev: Core and Builtins<19>,  Up: Python 3 14 0 release candidate 1

1.24.12.9 C API
...............

   - gh-112068(1): Revert support of nullable arguments in *note
     PyArg_Parse(): 1874.

   - 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(): 461. 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: ビルド<8>,  Prev: C API<7>,  Up: Python 3 14 0 release candidate 1

1.24.12.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.13 Python 3.14.0 beta 4
----------------------------

'Release date: 2025-07-08'

* Menu:

* Tools/Demos: Tools/Demos<6>.
* テスト: テスト<7>.
* セキュリティ: セキュリティ<12>.
* ライブラリ: ライブラリ<22>.
* ドキュメント: ドキュメント<9>.
* Core and Builtins: Core and Builtins<20>.
* C API: C API<8>.
* ビルド: ビルド<9>.


File: python.info,  Node: Tools/Demos<6>,  Next: テスト<7>,  Up: Python 3 14 0 beta 4

1.24.13.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: テスト<7>,  Next: セキュリティ<12>,  Prev: Tools/Demos<6>,  Up: Python 3 14 0 beta 4

1.24.13.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: セキュリティ<12>,  Next: ライブラリ<22>,  Prev: テスト<7>,  Up: Python 3 14 0 beta 4

1.24.13.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: a7b. 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:
     a7b. 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: ライブラリ<22>,  Next: ドキュメント<9>,  Prev: セキュリティ<12>,  Up: Python 3 14 0 beta 4

1.24.13.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(): 187b.

   - gh-85702(3): If ‘zoneinfo._common.load_tzdata’ is given a package
     without a resource a *note zoneinfo.ZoneInfoNotFoundError: 187c. is
     raised rather than a *note PermissionError: f42.  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(): 164b.
     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(): 164b. 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: 1f6. builds, when several threads were
     calling its *note __repr__(): 82f. method at the same time.

   - gh-135836(9): Fix *note IndexError: 1753. in *note
     asyncio.loop.create_connection(): 818. that could occur when
     non-*note OSError: 2c2. exception is raised during connection and
     socket's ‘close()’ raises ‘OSError’.

   - gh-135836(10): Fix *note IndexError: 1753. 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: 199. 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(): 187d. 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(): c90. 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: 450. exceptions in
     *note annotationlib.ForwardRef.evaluate(): 1820.

   - gh-135557(16): Fix races on *note heapq: 6d. updates and *note
     list: 24f. reads on the *note free threaded: 1f6. build.

   - gh-119180(17): Only fetch globals and locals if necessary in *note
     annotationlib.get_annotations(): 457.

   - 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(): 187e. 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: 200. formatting, for example
     ‘format(Decimal(1.25), '.016f')’.

   - gh-130662(23): Accept leading zeros in precision and width fields
     for *note Fraction: 215. 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: 215.'s formatting.
     Patch by Sergey B Kirpichev.

   - gh-87790(25): Support underscore and comma as thousands separators
     in the fractional part for *note Decimal: 200.'s formatting.  Patch
     by Sergey B Kirpichev.

   - gh-130664(26): Handle corner-case for *note Fraction: 215.'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:
     197.'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: ドキュメント<9>,  Next: Core and Builtins<20>,  Prev: ライブラリ<22>,  Up: Python 3 14 0 beta 4

1.24.13.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<20>,  Next: C API<8>,  Prev: ドキュメント<9>,  Up: Python 3 14 0 beta 4

1.24.13.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: 1f6. 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: 11b. races in an
     object's destructor on the *note free threaded: 1f6. 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(): 16e. 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<8>,  Next: ビルド<9>,  Prev: Core and Builtins<20>,  Up: Python 3 14 0 beta 4

1.24.13.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: ビルド<9>,  Prev: C API<8>,  Up: Python 3 14 0 beta 4

1.24.13.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.14 Python 3.14.0 beta 3
----------------------------

'Release date: 2025-06-17'

* Menu:

* Windows: Windows<9>.
* テスト: テスト<8>.
* セキュリティ: セキュリティ<13>.
* ライブラリ: ライブラリ<23>.
* ドキュメント: ドキュメント<10>.
* Core and Builtins: Core and Builtins<21>.
* ライブラリ: ライブラリ<24>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<24>.
* C API: C API<9>.
* ビルド: ビルド<10>.


File: python.info,  Node: Windows<9>,  Next: テスト<8>,  Up: Python 3 14 0 beta 3

1.24.14.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: テスト<8>,  Next: セキュリティ<13>,  Prev: Windows<9>,  Up: Python 3 14 0 beta 3

1.24.14.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: セキュリティ<13>,  Next: ライブラリ<23>,  Prev: テスト<8>,  Up: Python 3 14 0 beta 3

1.24.14.3 セキュリティ
......................

   - gh-135462(1): Fix quadratic complexity in processing specially
     crafted input in *note html.parser.HTMLParser: a7b.  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: ライブラリ<23>,  Next: ドキュメント<10>,  Prev: セキュリティ<13>,  Up: Python 3 14 0 beta 3

1.24.14.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(): 1888. 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: c43. 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: 117.: 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(): da5. and
     *note uuid6(): 2c4.

   - gh-134970(11): Fix the "unknown action" exception in *note
     argparse.ArgumentParser.add_argument_group(): 2ed. to correctly
     replace the action class.

   - gh-134718(12): *note ast.dump(): ae5. 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: 10d.  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: 1f6.

   - 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(): 1889. 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: 199. in *note
     email.utils.decode_params(): 188a. when sorting RFC 2231(21)
     continuations that contain an unnumbered section.

   - gh-134210(22): *note curses.window.getch(): 188b. 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(): 1213. can now generate
     more that 2^31 bits.  *note random.randbytes(): 188c. can now
     generate more that 256 MiB.

   - gh-132813(25): Improve error messages for incorrect types and
     values of *note csv.Dialect: 188d. attributes.

   - gh-132969(26): Prevent the *note ProcessPoolExecutor: 1d8. executor
     thread, which remains running when *note shutdown(wait=False): aee,
     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(): f44.
     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: ドキュメント<10>,  Next: Core and Builtins<21>,  Prev: ライブラリ<23>,  Up: Python 3 14 0 beta 3

1.24.14.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<21>,  Next: ライブラリ<24>,  Prev: ドキュメント<10>,  Up: Python 3 14 0 beta 3

1.24.14.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: ライブラリ<24>,  Next: Core and Builtins<22>,  Prev: Core and Builtins<21>,  Up: Python 3 14 0 beta 3

1.24.14.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<22>,  Next: ライブラリ<25>,  Prev: ライブラリ<24>,  Up: Python 3 14 0 beta 3

1.24.14.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: ライブラリ<25>,  Next: Core and Builtins<23>,  Prev: Core and Builtins<22>,  Up: Python 3 14 0 beta 3

1.24.14.9 ライブラリ
....................

   - gh-116738(1): Make methods in *note heapq: 6d. thread-safe on the
     *note free threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<23>,  Next: ライブラリ<26>,  Prev: ライブラリ<25>,  Up: Python 3 14 0 beta 3

1.24.14.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: ライブラリ<26>,  Next: Core and Builtins<24>,  Prev: Core and Builtins<23>,  Up: Python 3 14 0 beta 3

1.24.14.11 ライブラリ
.....................

   - gh-134908(1): Fix crash when iterating over lines in a text file on
     the *note free threaded: 1f6. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134908


File: python.info,  Node: Core and Builtins<24>,  Next: C API<9>,  Prev: ライブラリ<26>,  Up: Python 3 14 0 beta 3

1.24.14.12 Core and Builtins
............................

   - gh-132617(1): Fix *note dict.update(): 1683. 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: 1f6. 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<9>,  Next: ビルド<10>,  Prev: Core and Builtins<24>,  Up: Python 3 14 0 beta 3

1.24.14.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(): 1897. and *note
     PyObject_DelAttrString(): 1898. as macros in the limited C API 3.12
     and older.  Patch by Victor Stinner.

   - gh-133968(3): Add *note PyUnicodeWriter_WriteASCII(): 3b7. function
     to write an ASCII string into a *note PyUnicodeWriter: 3b1.  The
     function is faster than *note PyUnicodeWriter_WriteUTF8(): 3bd, 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: ビルド<10>,  Prev: C API<9>,  Up: Python 3 14 0 beta 3

1.24.14.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: 189a. 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.15 Python 3.14.0 beta 2
----------------------------

'Release date: 2025-05-26'

* Menu:

* Windows: Windows<10>.
* Tools/Demos: Tools/Demos<7>.
* テスト: テスト<9>.
* セキュリティ: セキュリティ<14>.
* ライブラリ: ライブラリ<27>.
* Core and Builtins: Core and Builtins<25>.
* C API: C API<10>.
* ビルド: ビルド<11>.


File: python.info,  Node: Windows<10>,  Next: Tools/Demos<7>,  Up: Python 3 14 0 beta 2

1.24.15.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(): 264. 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(): 175. 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: テスト<9>,  Prev: Windows<10>,  Up: Python 3 14 0 beta 2

1.24.15.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: テスト<9>,  Next: セキュリティ<14>,  Prev: Tools/Demos<7>,  Up: Python 3 14 0 beta 2

1.24.15.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: セキュリティ<14>,  Next: ライブラリ<27>,  Prev: テスト<9>,  Up: Python 3 14 0 beta 2

1.24.15.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: ライブラリ<27>,  Next: Core and Builtins<25>,  Prev: セキュリティ<14>,  Up: Python 3 14 0 beta 2

1.24.15.5 ライブラリ
....................

   - gh-132710(1): If possible, ensure that *note uuid.getnode(): da4.
     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(): 17d4. 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(): 18a1. 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():
     18a2. and *note curses.window.getstr(): 18a3. 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: 1754. 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: 18a4. handling when using HTTPS.

   - gh-62184(14): Remove import of C implementation of *note io.FileIO:
     152b. 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:
     13df. is not closed explicitly in the presence of multiple I/O
     layers.

   - gh-133890(16): The *note tarfile: e4. module now handles *note
     UnicodeEncodeError: 888. in the same way as *note OSError: 2c2.
     when cannot extract a member.

   - gh-134097(17): Fix interaction of the new *note REPL: 491. and
     *note -X showrefcount: 170. command line option.

   - gh-133889(18): The generated directory listing page in *note
     http.server.SimpleHTTPRequestHandler: d3c. 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: d3c.

   - 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: 1d6. start method.  Patch by Bénédikt
     Tran.

   - gh-134062(21): *note ipaddress: 84.: fix collisions in *note
     __hash__(): cf7. 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: 2ee. in *note open(): 318. 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(): 187b.  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: 1bf. 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(): be6.
     under free-threading.

   - gh-133783(28): Fix bug with applying *note copy.replace(): 1c2. 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():
     457. 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: a7b.

   - 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: 330. 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(): ae6. 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(): 231.

   - gh-132876(38): ‘ldexp()’ on Windows doesn't round subnormal results
     before Windows 11, but should.  Python's *note math.ldexp(): 18a5.
     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: 12c.: Fix a crash in
     *note Element.__deepcopy__: 17b7. 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: 218. cannot be passed
     to *note functools.partial(): 219. 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(): 18a6. no longer
     loses data when the ‘<script>’ tag is not closed.  Patch by Waylan
     Limberg.

   - gh-69426(44): Fix *note html.parser.HTMLParser: a7b. 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(): 1546.

   - gh-134381(46): Fix *note RuntimeError: 246. when using a
     not-started *note threading.Thread: 177. 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<25>,  Next: C API<10>,  Prev: ライブラリ<27>,  Up: Python 3 14 0 beta 2

1.24.15.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(): 9dc. 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: 1791. after its initial import.
     Patch by Nico-Posada.

   - gh-133999(8): Fix *note SyntaxError: 18f. regression in *note
     except: 1ac. parsing after gh-123440(9).

   - gh-133886(10): Fix *note sys.remote_exec(): 16e. 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__: 18a8. attributes of classes defined under ‘from
     __future__ import annotations’ had no effect.

   - gh-132762(13): *note fromkeys(): 250. 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: 2ee. when constants ‘True’,
     ‘False’ or ‘None’ are used as an identifier after NFKC
     normalization.

   - gh-132542(16): Update *note Thread.native_id: c37. 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<10>,  Next: ビルド<11>,  Prev: Core and Builtins<25>,  Up: Python 3 14 0 beta 2

1.24.15.7 C API
...............

   - gh-134144(1): Fix crash when calling *note Py_EndInterpreter():
     18aa. with a *note thread state: 18ab. that isn't the initial
     thread for the interpreter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134144


File: python.info,  Node: ビルド<11>,  Prev: C API<10>,  Up: Python 3 14 0 beta 2

1.24.15.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.16 Python 3.14.0 beta 1
----------------------------

'Release date: 2025-05-06'

* Menu:

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


File: python.info,  Node: Windows<11>,  Next: Tools/Demos<8>,  Up: Python 3 14 0 beta 1

1.24.16.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():
     29a. 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: テスト<10>,  Prev: Windows<11>,  Up: Python 3 14 0 beta 1

1.24.16.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: テスト<10>,  Next: セキュリティ<15>,  Prev: Tools/Demos<8>,  Up: Python 3 14 0 beta 1

1.24.16.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: セキュリティ<15>,  Next: ライブラリ<28>,  Prev: テスト<10>,  Up: Python 3 14 0 beta 1

1.24.16.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: ライブラリ<28>,  Next: IDLE<6>,  Prev: セキュリティ<15>,  Up: Python 3 14 0 beta 1

1.24.16.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(): 1410.

   - gh-130645(3): Add color to stdlib argparse CLIs.  Patch by Hugo van
     Kemenade.

   - gh-119180(4): Make *note annotationlib.get_annotations(): 457.
     succeed with the ‘FORWARDREF’ format if evaluating the annotations
     throws an exception other than *note NameError: 450. 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: 18b3. 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(): 18b4. 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: 1bf.'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_: 18b5. 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 ‘pdb’.

   - gh-133139(16): Add the *note curses.assume_default_colors(): 1f8.
     function, a refinement of the *note curses.use_default_colors():
     1f9. function which allows to change the color pair ‘0’.

   - gh-133089(17): Use original timeout value for *note
     subprocess.TimeoutExpired: 1819. when the func *note
     subprocess.run(): d83. 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(): 317. is now deprecated.  Use
     *note open(): 318. instead.  Contributed by Inada Naoki.

   - gh-132987(19): Many builtin and extension functions which accept an
     unsigned integer argument, now use *note __index__(): 19f. 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(): 107b. 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(): 18b6. and *note fcntl.ioctl():
     1699. 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(): 18b7.
     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: 2aa. 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(): 18b6. now supports arbitrary
     *note bytes-like objects: 194, not only *note bytes: 193.  *note
     fcntl.ioctl(): 1699. 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(): 1820.  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: 8b9. raised on *note
     ctypes.Structure: 1e7. 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: 18b8. and *note
     multiprocessing.RLock: 18b9. classes.

   - gh-121468(42): Add *note pdb.set_trace_async(): 27b. function to
     support *note await: 18e. statements in *note pdb: aa.

   - gh-132493(43): *note typing.Protocol: 56b. now uses *note
     annotationlib.get_annotations(): 457. when checking whether or not
     an instance implements the protocol with *note isinstance(): 2af.
     This enables support for ‘isinstance’ checks against classes with
     deferred annotations.

   - gh-132536(44): Do not disable *note PY_THROW: 18ba. 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:
     283. 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(): 130b. 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(): 18bb. and provide better handling for
     function objects.

   - gh-132426(50): Add *note
     annotationlib.get_annotate_from_class_namespace(): 459. 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: 283.).

   - gh-131913(52): Add a shortcut function *note
     multiprocessing.Process.interrupt(): 253. alongside the existing
     *note multiprocessing.Process.terminate(): 18bc. and *note
     multiprocessing.Process.kill(): d53. 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: 245. now raises a *note
     RuntimeError: 246. 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: 1f5.
     returns ‘NULL’.

   - gh-132385(57): Fix instance error suggestions trigger potential
     exceptions in *note object.__getattr__(): 6fa. in *note traceback:
     105.

   - gh-125866(58): Add optional 'add_scheme' argument to *note
     urllib.request.pathname2url(): 2c1.; when set to true, a complete
     URL is returned.  Likewise add optional 'require_scheme' argument
     to *note url2pathname(): 2bf.; 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: 18bd. *note Exception: bd1, 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: 17e8.
     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(): 457. now uses
     the ‘__annotate__’ attribute if it is present, even if
     ‘__annotations__’ is not present.  Additionally, the function now
     raises a *note TypeError: 199. 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: 200.'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: 1d8. and *note
     concurrent.futures.ThreadPoolExecutor: 94d.

   - gh-132106(68): *note logging.handlers.QueueListener: 244. now
     implements the context manager protocol, allowing it to be used in
     a *note with: 187. 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(): 231.  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: 284. in sockets on
     FreeBSD.

   - gh-131757(74): Make *note functools.lru_cache(): be6. 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(): 164b.

   - gh-131524(77): Add help message to *note platform: af. command-line
     interface.  Contributed by Harry Lees.

   - gh-100926(78): Move *note ctypes.POINTER(): 1f3. types cache from a
     global internal cache (‘_pointer_type_cache’) to the *note
     ctypes._CData.__pointer_type__: 1f4. 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: 1268.

   - gh-123471(80): Make concurrent iterations over *note
     itertools.repeat: 18be. 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(): 223, *note heapq.heappush_max(): 224, *note
     heapq.heappop_max(): 225, and *note heapq.heapreplace_max(): 226.
     public.  Previous underscored naming is kept for backwards
     compatibility.  Additionally, the missing function *note
     heapq.heappushpop_max(): 227. 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(): 21f. for optional visual keyboard feedback
     support.  Patch by Semyon Moroz.

   - gh-130317(89): Fix *note PyFloat_Pack2(): 96d. and *note
     PyFloat_Unpack2(): 970. for NaN's with payload.  This corrects
     round-trip for *note struct.unpack(): 18bf. and *note
     struct.pack(): 1492. 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(): 2d9.
     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: 17a. use a
     context variable for holding the warning filtering state if the
     *note sys.flags.context_aware_warnings: 18b. 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: 170. command-line option or by
     the *note PYTHON_CONTEXT_AWARE_WARNINGS: 18c0. 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: 1a4. for *note
     sys._clear_type_cache(): 294.  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(): 1cc.

   - gh-127604(97): Add support for printing the C stack trace on
     systems that support it via *note faulthandler.dump_c_stack(): 210.
     or via the 'c_stack' argument in *note faulthandler.enable(): 211.

   - 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(): 2bf, and fix handling of file URLs
     with authorities.

   - gh-82129(100): Fix *note NameError: 450. when calling *note
     typing.get_type_hints(): 8c1. on a *note dataclasses.dataclass():
     4e1. created by *note dataclasses.make_dataclass(): 18c1. with
     un-annotated fields.

   - gh-122559(101): Remove ‘__reduce__()’ and ‘__reduce_ex__()’ methods
     that always raise *note TypeError: 199. in the C implementation of
     *note io.FileIO: 152b, *note io.BufferedReader: 142b, *note
     io.BufferedWriter: 15cf. and *note io.BufferedRandom: 15d0. 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: 237. 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(): 201. 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: 11c.: 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(): 31b.  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<6>,  Next: ドキュメント<11>,  Prev: ライブラリ<28>,  Up: Python 3 14 0 beta 1

1.24.16.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: ドキュメント<11>,  Next: Core and Builtins<26>,  Prev: IDLE<6>,  Up: Python 3 14 0 beta 1

1.24.16.7 ドキュメント
......................

   - gh-107006(1): Move documentation and example code for *note
     threading.local: 18c4. 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<26>,  Next: ライブラリ<29>,  Prev: ドキュメント<11>,  Up: Python 3 14 0 beta 1

1.24.16.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(): 96e. and *note PyFloat_Unpack4(): 971. on RISC-V.

   - gh-133197(7): Improve *note SyntaxError: 18f. error messages for
     incompatible string / bytes prefixes.

   - gh-133231(8): Add new utilities of observing JIT compilation: *note
     sys._jit.is_available(): 44d, *note sys._jit.is_enabled(): 44e, and
     *note sys._jit.is_active(): 18c6.

   ---------- 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: ライブラリ<29>,  Next: Core and Builtins<27>,  Prev: Core and Builtins<26>,  Up: Python 3 14 0 beta 1

1.24.16.9 ライブラリ
....................

   - gh-133194(1): *note ast.parse(): 1c4. 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<27>,  Next: ライブラリ<30>,  Prev: ライブラリ<29>,  Up: Python 3 14 0 beta 1

1.24.16.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: 184. and *note set: 185.  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__(): 1706. of a
     *note method: 18c9. with a *note None: 886. 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: ライブラリ<30>,  Next: Core and Builtins<28>,  Prev: Core and Builtins<27>,  Up: Python 3 14 0 beta 1

1.24.16.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<28>,  Next: ライブラリ<31>,  Prev: ライブラリ<30>,  Up: Python 3 14 0 beta 1

1.24.16.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: 119. filters.

   - gh-132457(6): Make *note staticmethod(): 451. 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__: 18cc. was not
     deleted, when *note type.__annotations__: 18a8. 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
     ‘Py_DECREF()’ 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: 186. (resp.  *note with: 187.)
     instead of ‘with’ (resp.  ‘async with’).  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(): 1a5. now try calling
     *note __rpow__(): 1a6. 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: 176.
     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: 177. will, by default,
          use a copy of the *note contextvars.Context: 178. from the
          caller of *note threading.Thread.start(): 179. rather than
          using an empty context.

        * Add the *note -X thread_inherit_context: 170. command-line
          option and *note PYTHON_THREAD_INHERIT_CONTEXT: 18cd.
          environment variable, which set the *note
          thread_inherit_context: 176. flag.

        * Add the ‘context’ keyword parameter to *note Thread: 177.  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: 18f. message for using
     ‘import ... as’ and ‘from ... import ... as’ with not a name.

   - gh-102567(34): *note -X importtime: 170. 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: 199.
     occurs during *note dict.update(): 1683.

   - gh-103997(36): String arguments passed to "-c" are now
     automatically dedented as if by *note textwrap.dedent(): 1aa.  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: ライブラリ<31>,  Next: C API<11>,  Prev: Core and Builtins<28>,  Up: Python 3 14 0 beta 1

1.24.16.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<11>,  Next: ビルド<12>,  Prev: ライブラリ<31>,  Up: Python 3 14 0 beta 1

1.24.16.14 C API
................

   - gh-133166(1): Fix regression where *note PyType_GetModuleByDef():
     635. returns NULL without setting *note TypeError: 199. when a
     static type is passed.

   - gh-133164(2): Add *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 3c5. 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(): 2d1. 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():
     3c4. as a replacement for ‘Py_REFNCT(op) == 1’ on *note free
     threaded: 1f6. builds of Python.

   - gh-131747(4): On non-Windows platforms, deprecate using *note
     ctypes.Structure._pack_: 319. to use a Windows-compatible layout on
     non-Windows platforms.  The layout should be specified explicitly
     by setting *note ctypes.Structure._layout_: 1e9. to ‘'ms'’.

   - gh-128972(5): For non-free-threaded builds, the memory layout of
     *note PyASCIIObject: 1391. 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(): 1874.
     now support the *note __index__(): 19f. special method, like all
     other integer formats.

   - gh-132909(8): Fix an overflow when handling the *note K: 18d0.
     format in *note Py_BuildValue(): 3c0.  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: 1ea. with a
     'byte_size' that does not match the actual type size now raises a
     *note ValueError: 2ee. instead of crashing the interpreter.

   - gh-112068(11): [Reverted in gh-136991(12)] Add support of nullable
     arguments in *note PyArg_Parse(): 1874. 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(): 3bf. and
     other *note argument parsing: 3d3. functions if 'items' contains
     format units which store a *note borrowed buffer: 3d4. or a *note
     borrowed reference: 3d5.

   ---------- 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: ビルド<12>,  Prev: C API<11>,  Up: Python 3 14 0 beta 1

1.24.16.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.17 Python 3.14.0 alpha 7
-----------------------------

'リリース日: 2025-04-08'

* Menu:

* macOS: macOS<7>.
* Windows: Windows<12>.
* Tools/Demos: Tools/Demos<9>.
* テスト: テスト<11>.
* セキュリティ: セキュリティ<16>.
* ライブラリ: ライブラリ<32>.
* ドキュメント: ドキュメント<12>.
* Core and Builtins: Core and Builtins<29>.
* ライブラリ: ライブラリ<33>.
* Core and Builtins: Core and Builtins<30>.
* C API: C API<12>.
* ビルド: ビルド<13>.


File: python.info,  Node: macOS<7>,  Next: Windows<12>,  Up: Python 3 14 0 alpha 7

1.24.17.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<12>,  Next: Tools/Demos<9>,  Prev: macOS<7>,  Up: Python 3 14 0 alpha 7

1.24.17.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: 11e.

   - gh-91349(3): Replaces our copy of ‘zlib’ with ‘zlib-ng’, for
     performance improvements in *note zlib: 13a.

   - 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: テスト<11>,  Prev: Windows<12>,  Up: Python 3 14 0 alpha 7

1.24.17.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: テスト<11>,  Next: セキュリティ<16>,  Prev: Tools/Demos<9>,  Up: Python 3 14 0 alpha 7

1.24.17.4 テスト
................

   - gh-131277(1): Allow to unset one or more environment variables at
     once via *note EnvironmentVarGuard.unset(): 18d7.  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: セキュリティ<16>,  Next: ライブラリ<32>,  Prev: テスト<11>,  Up: Python 3 14 0 alpha 7

1.24.17.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: ライブラリ<32>,  Next: ドキュメント<12>,  Prev: セキュリティ<16>,  Up: Python 3 14 0 alpha 7

1.24.17.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: 1f5. type now supports
     subscription, making it a *note generic type: 1a2.

   - 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: 8d4. 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: 18da. with weird unahashable string names.

   - gh-131938(11): *note xml.etree.ElementTree: 12c.: update the error
     message when an element to remove via *note Element.remove: 18db.
     is not found.  Patch by Bénédikt Tran.

   - gh-115942(12): Add *note threading.RLock.locked(): 18a1, *note
     multiprocessing.Lock.locked(): 18dc, *note
     multiprocessing.RLock.locked(): 18dd, and allow *note
     multiprocessing.managers.SyncManager.Lock(): 15b3. and *note
     multiprocessing.managers.SyncManager.RLock(): 15b4. to proxy
     ‘locked()’ call.

   - gh-131974(13): Fix several thread-safety issues in *note ctypes:
     2e. on the *note free threaded: 1f6. build.

   - gh-118761(14): Improve the import time of the *note ast: 9. module
     by extracting the *note unparse(): ae6. 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():
     1aa. 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():
     242.

   - 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(): 144b.

   - 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(): 2bf. and *note pathname2url(): 2c1.
     instead.

   - gh-126367(23): Fix issue where *note urllib.request.url2pathname():
     2bf. raised *note OSError: 2c2. 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(): 185b. can now detect and
     report the version of ‘musl’ on Alpine Linux.

   - gh-129843(28): Fix incorrect argument passing in *note
     warnings.warn_explicit(): f01.

   - 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():
     221. 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: 2c9.

   - gh-126895(32): Fix *note readline: bf. in *note free-threaded: 1f6.
     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(): ae6. when *note
     ast.Interactive: 18de. 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: 22a.  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: 17e8. now use all attributes on the
     object.  Two ‘ForwardRef’ objects are equal only if all attributes
     are equal.

   - gh-128593(38): *note annotationlib.ForwardRef: 17e8. objects no
     longer cache their value when they are successfully evaluated.
     Successive calls to *note annotationlib.ForwardRef.evaluate():
     1820. may return different values.

   - gh-117779(39): Fix reading duplicated entries in *note zipfile:
     138. 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: 1e7./*note Union: 1e8.
     field descriptors is now available as *note CField: 1ea, 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: 12c.: Fix a crash in
     *note Element.find: 18df, *note Element.findtext: 17b8. and *note
     Element.findall: 18e0. when the tag to find implements an *note
     __eq__(): cf6. 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__(): 18e1. or *note
     email.message.Message.add_header(): 18e2, the field name is now
     validated according to RFC 5322, Section 2.2(44) and a *note
     ValueError: 2ee. is raised if the field name contains any invalid
     characters.

   - gh-123599(45): Deprecate ‘pathlib.PurePath.as_uri()’; use *note
     pathlib.Path.as_uri(): 31e. instead.

   - gh-126033(46): *note xml.etree.ElementTree: 12c.: Fix a crash in
     *note Element.remove: 18db. 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(): 213. 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: ドキュメント<12>,  Next: Core and Builtins<29>,  Prev: ライブラリ<32>,  Up: Python 3 14 0 alpha 7

1.24.17.7 ドキュメント
......................

   - gh-131417(1): Mention *note asyncio.Future: dca. and *note
     asyncio.Task: 1c9. in generic classes list.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131417


File: python.info,  Node: Core and Builtins<29>,  Next: ライブラリ<33>,  Prev: ドキュメント<12>,  Up: Python 3 14 0 alpha 7

1.24.17.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(): 8dd. as
     an unbound method.

   - gh-131998(3): Fix a crash when using an unbound method *note
     descriptor: 18e5. 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(): 16e.
     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: 1f6. build.

   - gh-131670(13): Fix *note anext(): 9da. failing on sync *note
     __anext__(): 18e6. 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(): 3a1, *note PyLong_FromUInt32(): 3a3,
     *note PyLong_FromInt64(): 3a2. and *note PyLong_FromUInt64(): 3a4.
     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: ライブラリ<33>,  Next: Core and Builtins<30>,  Prev: Core and Builtins<29>,  Up: Python 3 14 0 alpha 7

1.24.17.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<30>,  Next: C API<12>,  Prev: ライブラリ<33>,  Up: Python 3 14 0 alpha 7

1.24.17.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: f40. 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: b41. 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<12>,  Next: ビルド<13>,  Prev: Core and Builtins<30>,  Up: Python 3 14 0 alpha 7

1.24.17.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: ビルド<13>,  Prev: C API<12>,  Up: Python 3 14 0 alpha 7

1.24.17.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.18 Python 3.14.0 alpha 6
-----------------------------

'Release date: 2025-03-14'

* Menu:

* macOS: macOS<8>.
* Windows: Windows<13>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<12>.
* セキュリティ: セキュリティ<17>.
* ライブラリ: ライブラリ<34>.
* ドキュメント: ドキュメント<13>.
* Core and Builtins: Core and Builtins<31>.
* ライブラリ: ライブラリ<35>.
* Core and Builtins: Core and Builtins<32>.
* ライブラリ: ライブラリ<36>.
* Core and Builtins: Core and Builtins<33>.
* C API: C API<13>.
* ビルド: ビルド<14>.


File: python.info,  Node: macOS<8>,  Next: Windows<13>,  Up: Python 3 14 0 alpha 6

1.24.18.1 macOS
...............

   - gh-128540(1): Ensure web browser is launched by *note
     webbrowser.open(): 17c5. on macOS, even for ‘file://’ URLs.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128540


File: python.info,  Node: Windows<13>,  Next: Tools/Demos<10>,  Prev: macOS<8>,  Up: Python 3 14 0 alpha 6

1.24.18.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: テスト<12>,  Prev: Windows<13>,  Up: Python 3 14 0 alpha 6

1.24.18.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: テスト<12>,  Next: セキュリティ<17>,  Prev: Tools/Demos<10>,  Up: Python 3 14 0 alpha 6

1.24.18.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: 18b9.

   - 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: セキュリティ<17>,  Next: ライブラリ<34>,  Prev: テスト<12>,  Up: Python 3 14 0 alpha 6

1.24.18.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: ライブラリ<34>,  Next: ドキュメント<13>,  Prev: セキュリティ<17>,  Up: Python 3 14 0 alpha 6

1.24.18.6 ライブラリ
....................

   - gh-131204(1): Use monospace font from System Font Stack for
     cross-platform support in *note difflib.HtmlDiff: 203.

   - gh-131196(2): Improve performance of *note uuid.UUID.hex: 18f2. 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(): 8ad. 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: 1d2. 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(): 18f3. call.

   - gh-130608(15): Remove 'dirs_exist_ok' argument from *note
     pathlib.Path.copy(): 269. and *note copy_into(): 26a.  These
     methods are new in Python 3.14.

   - gh-130461(16): Remove ‘.. index::’ directives from the *note uuid:
     117. module documentation.  These directives previously created
     entries in the general index for *note getnode(): da4. as well as
     the *note uuid1(): da5, *note uuid3(): 2e7, *note uuid4(): 2e9,
     *note uuid5(): 2e8, and *note uuid8(): 2c6. 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(): 273. or
     *note pdb.set_trace(): 274. 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(): 269. or *note move(): 26b. has fresh *note
     info: 26d.

   - 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: 269. by making better use
     of *note info: 26d. internally.

   - gh-130285(23): Fix corner case for *note random.sample(): 951.
     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: 27a. when ‘pdb’ is started from an
     interactive console using *note breakpoint(): 273. or *note
     pdb.set_trace(): 274.

   - 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: 139. modules
     on *note pdb: aa.

   - gh-130230(29): Fix crash in *note pow(): 1a5. with only *note
     Decimal: 200. 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: be9. methods and descriptors.

   - gh-128520(32): Apply type conversion consistently in *note
     pathlib.PurePath: 6cd. and *note Path: 268. methods can accept a
     path object as an argument, such as *note match(): 6d3. and *note
     rename(): 18f4.  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: 199. in
     *note inspect.Signature.bind(): 18f5. 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(): 1c4. 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(): 1a7. and ‘__class__’ *note
     closure variable: 18f6. in user-defined methods of *note
     typing.NamedTuple: 32f. 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: 11b.

   - gh-127750(43): Remove broken *note
     functools.singledispatchmethod(): be9. caching introduced in
     gh-85160(44).  Achieve the same performance using different
     optimization.

   - gh-129948(45): Add support for shared *note set: 185. to *note
     multiprocessing.managers.SyncManager: 18f7. via *note
     SyncManager.set(): 251.

   - 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: 1e4.  Patch by Andrew Svetlov.

   - gh-97850(48): Update the deprecation warning of *note
     importlib.abc.Loader.load_module(): a6d.

   - gh-129678(49): *note configparser.ConfigParser: 4de.: do not write
     an empty unnamed section

   - gh-128641(50): Restore *note configparser.ConfigParser.read():
     1686. performance.

   - gh-129569(51): Fix *note unicodedata.normalize(): 8e5. to always
     return a built-in *note str: 16a. object when given an input of a
     ‘str’ 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(): 1085. 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(): 18f8. and *note
     readinto1(): 1020. implementations, avoiding unnecessary
     allocations.  Patch by Chris Markiewicz.

   - gh-128184(57): Improve display of *note annotationlib.ForwardRef:
     17e8. object within *note inspect.Signature: 4e3. representations.
     This also fixes a *note NameError: 450. 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(): 1dc.
     and *note concurrent.futures.ProcessPoolExecutor.kill_workers():
     1dd. 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: 238. and *note
     io.Writer: 239. as alternatives to *note typing.IO: 23a, *note
     typing.TextIO: 23b, and *note typing.BinaryIO: 23c.

   - 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(): 336. removal time to 3.15.
     Use *note zipimport.zipimporter.exec_module(): 337. instead.

   - gh-74028(63): Add the optional ‘buffersize’ parameter to *note
     concurrent.futures.Executor.map(): 1de. 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(): 2c5. for generating UUIDv7
     objects as specified in RFC 9562(67).  Patch by Bénédikt Tran.

   - gh-89083(68): Add *note uuid.uuid6(): 2c4. 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(): 318. on platforms where *note os.fstat():
     f90. 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: 2a9. an alias for *note
     typing.Union: 2aa.  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: ドキュメント<13>,  Next: Core and Builtins<31>,  Prev: ライブラリ<34>,  Up: Python 3 14 0 alpha 6

1.24.18.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(): 18fa, *note
     PyUnicode_Partition(): 18fb. and *note PyUnicode_RPartition():
     18fc.

   ---------- 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<31>,  Next: ライブラリ<35>,  Prev: ドキュメント<13>,  Up: Python 3 14 0 alpha 6

1.24.18.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(): 171c. and *note
     sys.settrace(): 2e3. 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: 1f6. build
     when constructing a *note code: 1b. object with *note co_consts:
     18fe. 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: 1f6.
     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: 342. functions for
     *note free threading: 1f6.

   - 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: d41.

   - gh-129107(26): Make *note bytearray: 342. iterator safe under *note
     free threading: 1f6.

   - 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: ライブラリ<35>,  Next: Core and Builtins<32>,  Prev: Core and Builtins<31>,  Up: Python 3 14 0 alpha 6

1.24.18.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<32>,  Next: ライブラリ<36>,  Prev: ライブラリ<35>,  Up: Python 3 14 0 alpha 6

1.24.18.10 Core and Builtins
............................

   - gh-129967(1): Fix a race condition in the *note free threading:
     1f6. 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: 182.
     or after an *note else: 17d. keyword.

   - gh-129349(4): *note bytes.fromhex(): 191. and *note
     bytearray.fromhex(): 192. now accepts ASCII *note bytes: 193. and
     *note bytes-like objects: 194.

   - gh-129149(5): Add fast path for medium-size integers in *note
     PyLong_FromSsize_t(): 1901.  Patch by Chris Eibl.

   - gh-129107(6): Make the *note bytearray: 342. safe under *note free
     threading: 1f6.

   - gh-128974(7): Fix a crash in *note UnicodeError.__str__: 830. when
     custom attributes implement ‘__str__()’ with side-effects.  Patch
     by Bénédikt Tran.

   - gh-126085(8): *note typing.TypeAliasType: 2b0. 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(): 169f. 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(): 19a. or *note
     f-strings: 19b.).  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(): a69. for use in the
     free-threading build.  The ‘reversed()’ 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: ライブラリ<36>,  Next: Core and Builtins<33>,  Prev: Core and Builtins<32>,  Up: Python 3 14 0 alpha 6

1.24.18.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<33>,  Next: C API<13>,  Prev: ライブラリ<36>,  Up: Python 3 14 0 alpha 6

1.24.18.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<13>,  Next: ビルド<14>,  Prev: Core and Builtins<33>,  Up: Python 3 14 0 alpha 6

1.24.18.13 C API
................

   - gh-111178(1): Fix *note PyCMethod: 96c. API: replace ‘size_t nargs’
     with ‘Py_ssize_t nargs’ in ‘PyCMethod’.  Patch by Victor Stinner.

   - gh-130947(2): Add again *note PySequence_Fast(): 1905. 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): 3b2.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b5.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b4.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3b8.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3ba.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bb.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bd.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bd.

        * ‘_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(): 3c0. that allows to take a C integer and produce a
     Python *note bool: 3c1. 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: ビルド<14>,  Prev: C API<13>,  Up: Python 3 14 0 alpha 6

1.24.18.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: 442.  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.19 Python 3.14.0 alpha 5
-----------------------------

'Release date: 2025-02-11'

* Menu:

* macOS: macOS<9>.
* Tools/Demos: Tools/Demos<11>.
* テスト: テスト<13>.
* セキュリティ: セキュリティ<18>.
* ライブラリ: ライブラリ<37>.
* IDLE: IDLE<7>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<34>.
* ライブラリ: ライブラリ<38>.
* Core and Builtins: Core and Builtins<35>.
* ライブラリ: ライブラリ<39>.
* Core and Builtins: Core and Builtins<36>.
* ライブラリ: ライブラリ<40>.
* C API: C API<14>.
* ビルド: ビルド<15>.


File: python.info,  Node: macOS<9>,  Next: Tools/Demos<11>,  Up: Python 3 14 0 alpha 5

1.24.19.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: テスト<13>,  Prev: macOS<9>,  Up: Python 3 14 0 alpha 5

1.24.19.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: テスト<13>,  Next: セキュリティ<18>,  Prev: Tools/Demos<11>,  Up: Python 3 14 0 alpha 5

1.24.19.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: セキュリティ<18>,  Next: ライブラリ<37>,  Prev: テスト<13>,  Up: Python 3 14 0 alpha 5

1.24.19.4 セキュリティ
......................

   - gh-105704(1): When using *note urllib.parse.urlsplit(): f3e. and
     *note urllib.parse.urlparse(): 360. 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: 1772. 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: ライブラリ<37>,  Next: IDLE<7>,  Prev: セキュリティ<18>,  Up: Python 3 14 0 alpha 5

1.24.19.5 ライブラリ
....................

   - gh-129939(1): Comparison pages with highlighted changes generated
     by the *note difflib.HtmlDiff: 203. class now support dark mode.

   - gh-129928(2): Raise *note sqlite3.ProgrammingError: 307. 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: 119, 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:
     190d. API. Patch by Hugo van Kemenade.

   - gh-129603(8): Fix bugs where *note sqlite3.Row: 1075. objects could
     segfault if their inherited *note description: 190e. was set to
     ‘None’.  Patch by Erlend Aasland.

   - gh-129559(9): Add *note bytearray.resize(): 17c9. method so *note
     bytearray: 342. 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(): a10. and not setting *note sys.last_exc: 6e5. and
     other variables.

   - gh-129403(11): Corrected *note ValueError: 2ee. message for *note
     asyncio.Barrier: 816. and *note threading.Barrier: 1400.

   - 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: 86d.

   - 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(): 261.

   - gh-129195(18): Support reporting call graph information from
     ‘asyncio.staggered.staggered_race()’.

   - gh-129205(19): Add *note os.readinto(): 261. to read into a *note
     buffer object: 262. 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(): 32b. to Python 3.15.

   - gh-129064(23): Deprecate ‘sysconfig.expand_makefile_vars()’, in
     favor of using *note sysconfig.get_paths(): 33e. 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: 138. by up to 20%, by removing unnecessary imports to
     *note typing: 10b.  Patch by Bénédikt Tran.

   - gh-128978(27): Fix a *note NameError: 450. 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: 103. by
     removing ‘typing’, ‘string’, and ‘tomllib._types’ imports.  Patch
     by Taneli Hukkinen.

   - gh-128679(32): *note tracemalloc: 106.: Fix race conditions when
     *note tracemalloc.stop(): 190f. 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(): 1910. under *note free
     threading: 1f6.

   - 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(): 1cc, *note
     asyncio.create_task(): 1cb. and *note
     asyncio.TaskGroup.create_task(): 1cd, by passing on all 'kwargs' to
     the task factory set by *note asyncio.loop.set_task_factory(): 1ca.

   - gh-118761(39): Improve the performance of *note base64.b16decode():
     2d5. 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: 25b. 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: 119. to avoid some
     data races when free-threading is used.  Change
     ‘_warnings_runtime_state.mutex’ to be a recursive mutex and expose
     it to ‘warnings’, 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(): 291. for identifying
     *note immortal: 292. objects at runtime.

   - gh-128479(45): Fix ‘asyncio.staggered.staggered_race()’ leaking
     tasks and issuing an unhandled exception.

   - gh-128427(46): *note uuid.NIL: 2c7. and *note uuid.MAX: 2c8. are
     now available to represent the Nil and Max UUID formats as defined
     by RFC 9562(47).

   - gh-91279(48): *note zipfile.ZipFile.writestr(): 2ce. 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: 1911.  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():
     ae6. 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: 1912, *note
     importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES: 1913, *note
     importlib.machinery.WindowsRegistryFinder: f2a, *note
     importlib.abc.ResourceLoader: de6, *note
     importlib.abc.SourceLoader.path_mtime(): 13a6.

   - 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: 26d. attribute, which
     stores an object implementing the *note pathlib.types.PathInfo:
     26e. protocol (also new).  The object supports querying the file
     type and internally caching *note stat(): 26f. results.  Path
     objects generated by *note iterdir(): 270. 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: 1914.

   - 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(): 1915.

   - gh-91048(62): Add *note asyncio.capture_call_graph(): 1ce. and
     *note asyncio.print_call_graph(): 1cf. 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(): 1f2. 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(): bfd, *note math.log():
     16de. and *note math.atanh(): 15f5. were modified as examples).
     Patch by Charlie Zhao and Sergey B Kirpichev.

   - gh-81340(69): Use *note os.copy_file_range(): 1916. in *note
     shutil.copy(): c53, *note shutil.copy2(): c54, and *note
     shutil.copyfile(): c52. 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: 10c1. 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<7>,  Next: ドキュメント<14>,  Prev: ライブラリ<37>,  Up: Python 3 14 0 alpha 5

1.24.19.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: ドキュメント<14>,  Next: Core and Builtins<34>,  Prev: IDLE<7>,  Up: Python 3 14 0 alpha 5

1.24.19.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: 1919. is not
     printable in the POSIX sense.  In particular, *note
     string.printable.isprintable(): fdc. returns *note False: d2f.
     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<34>,  Next: ライブラリ<38>,  Prev: ドキュメント<14>,  Up: Python 3 14 0 alpha 5

1.24.19.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: 189a. instead).

   - gh-129715(4): Improve JIT performance for generators.

   - gh-129643(5): Fix thread safety of *note PyList_Insert(): 191b. in
     free-threading builds.

   - gh-129668(6): Fix race condition when raising *note MemoryError:
     1772. in the free threaded build.

   - gh-129643(7): Fix thread safety of *note PyList_SetItem(): 191c. 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: 293. 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: ライブラリ<38>,  Next: Core and Builtins<35>,  Prev: Core and Builtins<34>,  Up: Python 3 14 0 alpha 5

1.24.19.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<35>,  Next: ライブラリ<39>,  Prev: ライブラリ<38>,  Up: Python 3 14 0 alpha 5

1.24.19.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(): 191f, *note
     PyLong_FromUnsignedLongLong(): 1920. and *note PyLong_FromSize_t():
     1921.

   - 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: 1922. and
     *note UnicodeError.end: 1923. values in the *note
     codecs.replace_errors(): 1924. error handler.  Patch by Bénédikt
     Tran.

   - gh-126004(20): Fix handling of *note UnicodeError.start: 1922. and
     *note UnicodeError.end: 1923. values in the *note
     codecs.backslashreplace_errors(): 1925. error handler.  Patch by
     Bénédikt Tran.

   - gh-126004(21): Fix handling of *note UnicodeError.start: 1922. and
     *note UnicodeError.end: 1923. values in the *note
     codecs.xmlcharrefreplace_errors(): 1926. error handler.  Patch by
     Bénédikt Tran.

   - gh-127119(22): Slightly optimize the *note int: 19c. 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: ライブラリ<39>,  Next: Core and Builtins<36>,  Prev: Core and Builtins<35>,  Up: Python 3 14 0 alpha 5

1.24.19.11 ライブラリ
.....................

   - gh-126349(1): Add *note turtle.fill(): 2a5, *note turtle.poly():
     2a6. and *note turtle.no_animation(): 2a7. 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<36>,  Next: ライブラリ<40>,  Prev: ライブラリ<39>,  Up: Python 3 14 0 alpha 5

1.24.19.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: f42.  Patch by Alex Willmer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115911


File: python.info,  Node: ライブラリ<40>,  Next: C API<14>,  Prev: Core and Builtins<36>,  Up: Python 3 14 0 alpha 5

1.24.19.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<14>,  Next: ビルド<15>,  Prev: ライブラリ<40>,  Up: Python 3 14 0 alpha 5

1.24.19.14 C API
................

   - gh-129533(1): Update *note PyGC_Enable(): aa8, *note
     PyGC_Disable(): aa9, *note PyGC_IsEnabled(): aaa. to use atomic
     operation for thread-safety at free-threading build.  Patch by
     Donghee Na.

   - gh-89188(2): Implement *note PyUnicode_KIND(): 1399. and *note
     PyUnicode_DATA(): 1395. 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(): 1905. from the limited
     C API, since this function has to be used with *note
     PySequence_Fast_GET_ITEM: 3c9. which never worked in the limited C
     API. Patch by Victor Stinner.

   - gh-128509(4): Add *note PyUnstable_IsImmortal(): 3c2. for
     determining whether an object is *note immortal: 292.

   - gh-129033(5): Remove ‘_PyInterpreterState_GetConfigCopy()’ and
     ‘_PyInterpreterState_SetConfig()’ private functions.  Use instead
     *note PyConfig_Get(): 37a. and *note PyConfig_Set(): 37b, 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: 3cf. added to Python 3.8 by PEP
     587(8).  Patch by Victor Stinner.

   - gh-128844(9): Add *note PyUnstable_TryIncRef(): 192b. and *note
     PyUnstable_EnableTryIncRef(): 192c. 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(): 394. and
     *note PyImport_ImportModuleAttrString(): 395. 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(): 381.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 41f.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 420.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 398.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3a8.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 421.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 422.

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 423.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 391.

     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: 200. 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: ビルド<15>,  Prev: C API<14>,  Up: Python 3 14 0 alpha 5

1.24.19.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.20 Python 3.14.0 alpha 4
-----------------------------

'Release date: 2025-01-14'

* Menu:

* macOS: macOS<10>.
* Tools/Demos: Tools/Demos<12>.
* テスト: テスト<14>.
* ライブラリ: ライブラリ<41>.
* Core and Builtins: Core and Builtins<37>.
* ライブラリ: ライブラリ<42>.
* Core and Builtins: Core and Builtins<38>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<39>.
* C API: C API<15>.
* ビルド: ビルド<16>.


File: python.info,  Node: macOS<10>,  Next: Tools/Demos<12>,  Up: Python 3 14 0 alpha 4

1.24.20.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: テスト<14>,  Prev: macOS<10>,  Up: Python 3 14 0 alpha 4

1.24.20.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: テスト<14>,  Next: ライブラリ<41>,  Prev: Tools/Demos<12>,  Up: Python 3 14 0 alpha 4

1.24.20.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: ライブラリ<41>,  Next: Core and Builtins<37>,  Prev: テスト<14>,  Up: Python 3 14 0 alpha 4

1.24.20.4 ライブラリ
....................

   - gh-128731(1): Fix *note ResourceWarning: 54c. in *note
     urllib.robotparser.RobotFileParser.read(): 1933.

   - gh-71339(2): Add new assertion methods for *note unittest: 10d.:
     *note assertHasAttr(): 2b6, *note assertNotHasAttr(): 2b7, *note
     assertIsSubclass(): 2b8, *note assertNotIsSubclass(): 2b9. *note
     assertStartsWith(): 2ba, *note assertNotStartsWith(): 2bb, *note
     assertEndsWith(): 2bc. and *note assertNotEndsWith(): 2bd.

   - 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(): 187b. 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(): 1cc. and *note
     asyncio.TaskGroup.create_task(): 1cd. 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(): cff. for thread safe
     cancellation.

   - gh-128182(9): Fix crash when using *note ctypes: 2e. pointers
     concurrently on the *note free threaded: 1f6. build.

   - gh-128400(10): Only show the current thread in *note faulthandler:
     5c. on the *note free threaded: 1f6. build to prevent races.

   - gh-128400(11): Fix crash when using *note
     faulthandler.dump_traceback(): 1003. while other threads are active
     on the *note free threaded: 1f6. 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: 2aa.
     and *note types.UnionType: 2a9.: ‘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: c5a. 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:
     1934. objects concurrently on the *note free threaded: 1f6. build.

   - gh-128062(20): Revert the font of *note turtledemo: 109.'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: 25f. and *note
     SCHED_NORMAL: 260. constants to the *note os: a5. module.

   - gh-83662(30): Add missing ‘__class_getitem__’ method to the Python
     implementation of *note functools.partial(): 219, 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: 1171. 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(): 13e9. 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: 126c. in a loop.  This
     improves performance on OpenBSD.

   - gh-127360(34): When a descriptive error message cannot be provided
     for an *note ssl.SSLError: 1495, 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: 1935.
     of Expat >=2.6.4 in *note xml.parsers.expat.errors: 12e.

   - 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: 1936. 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(): 2cc.
     setting default properties on *note ZipInfo: 2cd. objects.  Patch
     by Bénédikt Tran and Jason R. Coombs.

   - gh-121676(43): Deprecate calling the Python implementation of *note
     functools.reduce(): 21c. with a ‘function’ or ‘sequence’ as a *note
     keyword argument: f12.  This will be forbidden in Python 3.16 in
     order to match the C implementation.

   - gh-112015(44): *note ctypes.memoryview_at(): 1ed. now exists to
     create a *note memoryview: 166. object that refers to the supplied
     pointer and length.  This works like *note ctypes.string_at(): 1ee.
     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<37>,  Next: ライブラリ<42>,  Prev: ライブラリ<41>,  Up: Python 3 14 0 alpha 4

1.24.20.5 Core and Builtins
...........................

   - gh-128078(1): Fix a *note SystemError: 795. when using *note
     anext(): 9da. 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: 1f6. 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: 1391. 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: ライブラリ<42>,  Next: Core and Builtins<38>,  Prev: Core and Builtins<37>,  Up: Python 3 14 0 alpha 4

1.24.20.6 ライブラリ
....................

   - gh-128192(1): Upgrade HTTP digest authentication algorithm for
     *note urllib.request: 112. 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<38>,  Next: ライブラリ<43>,  Prev: ライブラリ<42>,  Up: Python 3 14 0 alpha 4

1.24.20.7 Core and Builtins
...........................

   - gh-126868(1): Increase usage of freelist for *note int: 19c.
     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*: 1ad. does not properly
     check the return value of an *note ExceptionGroup: 4d2.'s *note
     split(): 193a. function, leading to a crash in some cases.  Now
     when ‘split()’ returns an invalid object, ‘except*’ raises a *note
     TypeError: 199. with the original raised ‘ExceptionGroup’ 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: ライブラリ<43>,  Next: Core and Builtins<39>,  Prev: Core and Builtins<38>,  Up: Python 3 14 0 alpha 4

1.24.20.8 ライブラリ
....................

   - gh-128035(1): Indicate through *note ssl.HAS_PHA: 288. 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<39>,  Next: C API<15>,  Prev: ライブラリ<43>,  Up: Python 3 14 0 alpha 4

1.24.20.9 Core and Builtins
...........................

   - gh-127274(1): Add a new flag, ‘CO_METHOD’, to *note co_flags: 193d.
     that indicates whether the code object belongs to a function
     defined in class scope.

   - gh-66409(2): During the *note path initialization: 193e, 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: 3e4. 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: 193f.

   - 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<15>,  Next: ビルド<16>,  Prev: Core and Builtins<39>,  Up: Python 3 14 0 alpha 4

1.24.20.10 C API
................

   - gh-128400(1): *note Py_FatalError(): b7e. no longer shows all
     threads on the *note free threaded: 1f6. build to prevent crashes.

   - gh-128629(2): Add macros *note Py_PACK_VERSION(): 37d. and *note
     Py_PACK_FULL_VERSION(): 37e. for bit-packing Python version
     numbers.

   - gh-128008(3): Add *note PyWeakref_IsDead(): 1941. function, which
     tests if a weak reference is dead.

   - gh-127350(4): Add *note Py_fopen(): 391. 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(): 392. 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: ビルド<16>,  Prev: C API<15>,  Up: Python 3 14 0 alpha 4

1.24.20.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.21 Python 3.14.0 alpha 3
-----------------------------

'Release date: 2024-12-17'

* Menu:

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


File: python.info,  Node: Windows<14>,  Next: Tools/Demos<13>,  Up: Python 3 14 0 alpha 3

1.24.21.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: 108. 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: テスト<15>,  Prev: Windows<14>,  Up: Python 3 14 0 alpha 3

1.24.21.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: テスト<15>,  Next: セキュリティ<19>,  Prev: Tools/Demos<13>,  Up: Python 3 14 0 alpha 3

1.24.21.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: セキュリティ<19>,  Next: ライブラリ<44>,  Prev: テスト<15>,  Up: Python 3 14 0 alpha 3

1.24.21.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():
     1834.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127655


File: python.info,  Node: ライブラリ<44>,  Next: ドキュメント<15>,  Prev: セキュリティ<19>,  Up: Python 3 14 0 alpha 3

1.24.21.5 ライブラリ
....................

   - gh-126907(1): Fix crash when using *note atexit: d. concurrently on
     the *note free-threaded: 1f6. 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(): 29a, *note
     sysconfig.get_paths(): 33e, and siblings, returning outdated cached
     data if the value of *note sys.prefix: 3e5. or *note
     sys.exec_prefix: 3e9. changes.  Overwriting ‘sys.prefix’ or
     ‘sys.exec_prefix’ 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(): 1038.
     thread-safe and re-entrant safe.

   - gh-127321(12): *note pdb.set_trace(): 274. 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: 20b. 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(): 270.

   - gh-127257(16): In *note ssl: d5, system call failures that OpenSSL
     reports using ‘ERR_LIB_SYS’ are now raised as *note OSError: 2c2.

   - gh-59705(17): On Linux, *note threading.Thread: 177. now sets the
     thread name to the operating system.  Patch by Victor Stinner.

   - gh-127303(18): Publicly expose *note EXACT_TOKEN_TYPES: 1949. 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(): 29a. 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(): 1ec. function is now
     public.  Previously, this was private and only available in
     ‘_ctypes’.

   - gh-127182(24): Fix ‘io.StringIO.__setstate__()’ crash, when *note
     None: 886. was passed as the first value.

   - gh-127217(25): Fix *note urllib.request.pathname2url(): 2c1. for
     paths starting with multiple slashes on Posix.

   - gh-125866(26): *note urllib.request.pathname2url(): 2c1. 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: 10d. 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(): 2c1. and *note
     url2pathname(): 2bf. no longer convert Windows drive letters to
     uppercase.

   - gh-127078(31): Fix issue where *note urllib.request.url2pathname():
     2bf. 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():
     2bf. failed to discard any 'localhost' authority present in the
     URL.

   - gh-127065(33): Fix crash when calling a *note
     operator.methodcaller(): 1038. instance from multiple threads in
     the free threading build.

   - gh-127090(34): Fix value of *note urllib.response.addinfourl.url:
     194a. for ‘file:’ URLs that express relative paths and absolute
     Windows paths.  The canonical URL generated by *note
     urllib.request.pathname2url(): 2c1. 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(): ec2. 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(): 194b.
     thread-safe by adding a mutex.  Patch by Victor Stinner.

   - gh-126618(38): Fix the representation of *note itertools.count:
     149f. objects when the count value is *note sys.maxsize: 13e1.

   - gh-126615(39): The *note COMError: 1eb. 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: 13c4.), *note sys.prefix:
     3e5. and *note sys.base_prefix: 3e4. will now point to the virtual
     environment, instead of the base installation.

   - gh-112192(41): In the *note trace: 104. 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: 199. in
     ‘_pydatetime.timedelta.__new__()’ if the passed arguments are not
     *note int: 19c. or *note float: 197, so that the Python
     implementation is in line with the C implementation.

   - gh-126946(44): Improve the *note GetoptError: 194c. error message
     when a long option prefix matches multiple accepted options in
     *note getopt.getopt(): 16d9. and *note getopt.gnu_getopt(): 16d8.

   - 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():
     2bf. and *note pathname2url(): 2c1. 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(): 1535. for
     drive-relative paths on Windows.

   - gh-126775(48): Make *note linecache.checkcache(): 194d. thread safe
     and GC re-entrancy safe.

   - gh-126601(49): Fix issue where *note urllib.request.pathname2url():
     2c1. raised *note OSError: 2c2. 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: 20d. error code to *note errno:
     5b.

   - gh-118201(52): Fixed intermittent failures of *note os.confstr:
     194e, *note os.pathconf: 1317. and *note os.sysconf: 194f. on iOS
     and Android.

   - gh-86463(53): The ‘usage’ parameter of *note
     argparse.ArgumentParser: 1bf. 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(): 1055. now
     raises a *note ValueError: 2ee. when given a negative value.

   - gh-122356(59): Guarantee that the position of a file-like object
     passed to *note zipfile.is_zipfile(): 1546. is left untouched after
     the call.  Patch by Bénédikt Tran.

   - gh-122288(60): Improve the performances of *note
     fnmatch.translate(): 18b4. by a factor 1.7.  Patch by Bénédikt
     Tran.

   - gh-88110(61): Fixed *note multiprocessing.Process: 254. reporting a
     ‘.exitcode’ of 1 even on success when using the ‘"fork"’ start
     method while using a *note concurrent.futures.ThreadPoolExecutor:
     94d.

   - 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: ドキュメント<15>,  Next: Core and Builtins<40>,  Prev: ライブラリ<44>,  Up: Python 3 14 0 alpha 3

1.24.21.6 ドキュメント
......................

   - gh-127347(1): Publicly expose *note traceback.print_list(): 1951.
     in ‘traceback.__all__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127347


File: python.info,  Node: Core and Builtins<40>,  Next: ライブラリ<45>,  Prev: ドキュメント<15>,  Up: Python 3 14 0 alpha 3

1.24.21.7 Core and Builtins
...........................

   - gh-127740(1): Fix error message in *note bytes.fromhex(): 191. 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: 166. object on the *note free-threaded: 1f6. build.

   - gh-127238(9): Correct error message for *note
     sys.set_int_max_str_digits(): 1789.

   - gh-113841(10): Fix possible undefined behavior division by zero in
     *note complex: 198.'s *note _Py_c_pow(): 1953.

   ---------- 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: ライブラリ<45>,  Next: Core and Builtins<41>,  Prev: Core and Builtins<40>,  Up: Python 3 14 0 alpha 3

1.24.21.8 ライブラリ
....................

   - gh-127133(1): Calling *note
     argparse.ArgumentParser.add_argument_group(): 2ed. on an argument
     group, and calling ‘argparse.ArgumentParser.add_argument_group()’
     or *note argparse.ArgumentParser.add_mutually_exclusive_group():
     2ef. 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<41>,  Next: C API<16>,  Prev: ライブラリ<45>,  Up: Python 3 14 0 alpha 3

1.24.21.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(): 980, *note PyCode_GetVarnames(): 981, *note
     PyCode_GetCellvars(): 982, or *note PyCode_GetFreevars(): 983. 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: 342.
     crashing when *note READ: 1956. or *note WRITE: 1957. are passed as
     flags.

   - gh-126937(5): Fix *note TypeError: 199. when a *note
     ctypes.Structure: 1e7. has a field size that doesn't fit into an
     unsigned 16-bit integer.  Instead, the maximum number of 'bits' is
     *note sys.maxsize: 13e1.

   - gh-126868(6): Increase performance of *note int: 19c. 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(): 1958. to *note
     memoryview: 166. objects.  Patch by Bénédikt Tran.

   - gh-125420(12): Add *note memoryview.count(): 1959. to *note
     memoryview: 166. 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<16>,  Next: ビルド<17>,  Prev: Core and Builtins<41>,  Up: Python 3 14 0 alpha 3

1.24.21.10 C API
................

   - gh-127896(1): The previously undocumented function *note
     PySequence_In(): 3d6. is *note soft deprecated: 23f.  Use *note
     PySequence_Contains(): 3d7. instead.

   - gh-127791(2): Fix loss of callbacks after more than one call to
     *note PyUnstable_AtExit(): 195b.

   - gh-127691(3): The *note Unicode Exception Objects: 45f. C API now
     raises a *note TypeError: 199. if its exception argument is not a
     *note UnicodeError: 460. object.  Patch by Bénédikt Tran.

   - gh-123378(4): Ensure that the value of *note
     UnicodeEncodeError.end: 1923. retrieved by *note
     PyUnicodeEncodeError_GetEnd(): 195c. lies in ‘[min(1, objlen),
     max(min(1, objlen), objlen)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 195d.  Similar arguments apply to *note
     UnicodeDecodeError: c0c. and *note UnicodeTranslateError: 195e. 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: 1f6. build.

   - gh-123378(6): Ensure that the value of *note
     UnicodeEncodeError.start: 1922. retrieved by *note
     PyUnicodeEncodeError_GetStart(): 195f. lies in ‘[0, max(0, objlen -
     1)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 195d.  Similar arguments apply to *note
     UnicodeDecodeError: c0c. and *note UnicodeTranslateError: 195e. 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: 237. if the operation cannot
     immediately return bytes.

   - gh-102471(8): Add a new import and export API for Python *note int:
     19c. objects ( PEP 757(9)):

        * *note PyLong_GetNativeLayout(): 3a5.;

        * *note PyLong_Export(): 3a6.;

        * *note PyLong_FreeExport(): 3a7.;

        * *note PyLongWriter_Create(): 3a8.;

        * *note PyLongWriter_Finish(): 3a9.;

        * *note PyLongWriter_Discard(): 3aa.

     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: ビルド<17>,  Prev: C API<16>,  Up: Python 3 14 0 alpha 3

1.24.21.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.22 Python 3.14.0 alpha 2
-----------------------------

'Release date: 2024-11-19'

* Menu:

* Windows: Windows<15>.
* Tools/Demos: Tools/Demos<14>.
* テスト: テスト<16>.
* セキュリティ: セキュリティ<20>.
* ライブラリ: ライブラリ<46>.
* ドキュメント: ドキュメント<16>.
* Core and Builtins: Core and Builtins<42>.
* ライブラリ: ライブラリ<47>.
* Core and Builtins: Core and Builtins<43>.
* ライブラリ: ライブラリ<48>.
* Core and Builtins: Core and Builtins<44>.
* ライブラリ: ライブラリ<49>.
* C API: C API<17>.
* ビルド: ビルド<18>.


File: python.info,  Node: Windows<15>,  Next: Tools/Demos<14>,  Up: Python 3 14 0 alpha 2

1.24.22.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():
     279. 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: テスト<16>,  Prev: Windows<15>,  Up: Python 3 14 0 alpha 2

1.24.22.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: テスト<16>,  Next: セキュリティ<20>,  Prev: Tools/Demos<14>,  Up: Python 3 14 0 alpha 2

1.24.22.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: セキュリティ<20>,  Next: ライブラリ<46>,  Prev: テスト<16>,  Up: Python 3 14 0 alpha 2

1.24.22.4 セキュリティ
......................

   - gh-126623(1): Upgrade libexpat to 2.6.4

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126623


File: python.info,  Node: ライブラリ<46>,  Next: ドキュメント<16>,  Prev: セキュリティ<20>,  Up: Python 3 14 0 alpha 2

1.24.22.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(): 29a. incorrectly having the same value
     as *note sys.base_prefix: 3e4. and *note sys.base_exec_prefix: 3e8,
     respectively, inside virtual environments.  They now accurately
     reflect *note sys.prefix: 3e5. and *note sys.exec_prefix: 3e9.

   - 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(): 29a, *note sysconfig.get_paths(): 33e,
     and their siblings when the *note site: cc. initialization happens
     after *note sysconfig: e1. has built a cache for
     ‘sysconfig.get_config_vars()’.

   - gh-126188(6): Update bundled pip to 24.3.1

   - gh-126766(7): Fix issue where *note urllib.request.url2pathname():
     2bf. failed to discard two leading slashes introducing an empty
     authority section.

   - gh-126705(8): Allow *note os.PathLike: e4f. to be a base for
     Protocols.

   - gh-126699(9): Allow *note collections.abc.AsyncIterator: fe2. 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(): 1096. or *note unittest.mock.patch.object():
     1967.) more than once without stopping it

   - gh-126595(12): Fix a crash when instantiating *note
     itertools.count: 149f. with an initial count of *note sys.maxsize:
     13e1. on debug builds.  Patch by Bénédikt Tran.

   - gh-120423(13): Fix issue where *note urllib.request.pathname2url():
     2c1. mishandled Windows paths with embedded forward slashes.

   - gh-126565(14): Improve performances of *note zipfile.Path.open():
     1968. 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: 3e2. during the importing of *note
     multiprocessing.set_forkserver_preload(): 1969. modules in the same
     manner as ‘sys.path’ 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: 3e2. during forkserver preload imports instead of the
     absolute path from *note os.getcwd(): 196a. 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: 18b8. and *note
     multiprocessing.RLock: 18b9. ‘repr’ values no longer say "unknown"
     on macOS.

   - gh-126476(18): Raise *note calendar.IllegalMonthError: 17bd. (now a
     subclass of *note IndexError: 1753.) for *note calendar.month():
     196b. 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(): 196c. for the
     result of ‘persistent_id()’.

   - gh-126451(20): Register the *note contextvars.Context: 178. type to
     *note collections.abc.Mapping: acb.

   - gh-126175(21): Add ‘msg’, ‘doc’, ‘pos’, ‘lineno’ and ‘colno’
     attributes to *note tomllib.TOMLDecodeError: 196d.  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: 12c4. 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(): 16d8.

   - 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: 268. object for the pattern.

   - gh-126353(28): *note asyncio.get_event_loop(): 2f4. now does not
     implicitly creates an event loop.  It now raises a *note
     RuntimeError: 246. if there is no set event loop.  Patch by Kumar
     Aditya.

   - gh-126313(29): Fix an issue in *note curses.napms(): 196e. when
     *note curses.initscr(): 196f. has not yet been called.  Patch by
     Bénédikt Tran.

   - gh-126303(30): Fix pickling and copying of *note os.sched_param:
     1970. objects.

   - gh-126138(31): Fix a use-after-free crash on *note asyncio.Task:
     1c9. objects whose underlying coroutine yields an object that
     implements an evil *note __getattribute__(): dcf.  Patch by Nico
     Posada.

   - gh-120057(32): Replace the ‘os.environ.refresh()’ method with a new
     *note os.reload_environ(): 25a. 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():
     2c1. and *note url2pathname(): 2bf. removed slashes from Windows
     DOS drive paths and URLs.

   - gh-126223(35): Raise a *note UnicodeEncodeError: 888. 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():
     2c1. generated URLs beginning with four slashes (rather than two)
     when given a Windows UNC path.

   - gh-126156(37): Improved performances of creating *note Morsel: e02.
     objects by a factor of 3.8x.

   - gh-126105(38): Fix a crash in *note ast: 9. when the *note
     ast.AST._fields: 1841. 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:
     1c9. objects for which the underlying event loop implements an evil
     *note __getattribute__(): dcf.  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: 1c9.
     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(): c58.

   - gh-125984(45): Fix use-after-free crashes on *note asyncio.Future:
     dca. objects for which the underlying event loop implements an evil
     *note __getattribute__(): dcf.  Reported by Nico-Posada.  Patch by
     Bénédikt Tran.

   - gh-125926(46): Fix *note urllib.parse.urljoin(): 109a. 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(): cfe. 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(): 1971.  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(): 21c. 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(): 1972. and *note
     email.policy.Compat32.header_source_parse(): 1973. 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(): cfb.

        * 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: 1a7. 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: 112.  They had previously raised *note
     DeprecationWarning: 1a4. 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: 196c.
     and *note persistent_load: 1974. 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(): b52. conforming to the JSON specification.

   - gh-125660(64): Reject invalid unicode escapes for Python
     implementation of *note json.loads(): b52.

   - gh-52551(65): Use ‘wcsftime()’ to implement *note time.strftime():
     1406. on Windows.

   - gh-125259(66): Fix the notes removal logic for errors thrown in
     enum initialization.

   - gh-125633(67): Add function *note inspect.ispackage(): 234. to
     determine whether an object is a *note package: 235. or not.

   - gh-125614(68): In the *note FORWARDREF: 160. format of *note
     annotationlib: 6, fix bug where nested expressions were not
     returned as *note annotationlib.ForwardRef: 17e8. 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():
     2ed.

   - gh-125541(72): Pressing ‘Ctrl’-‘C’ while blocked in *note
     threading.Lock.acquire(): 8a8, *note threading.RLock.acquire():
     107f, and *note threading.Thread.join(): 1401. now interrupts the
     function call and raises a *note KeyboardInterrupt: bc9. 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: 1d8. 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: 118. 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(): 1406,
     the *note strftime(): e92. method of the *note datetime: 34.
     classes *note datetime: 4e2, *note date: 1fc. and *note time: 1fd.
     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: 118.
     activation scripts.

   - gh-124694(81): We've added *note
     concurrent.futures.InterpreterPoolExecutor: 1d4, 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: 30e. 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(): 2c6. for generating UUIDv8
     objects as specified in RFC 9562(90).  Patch by Bénédikt Tran

   - gh-122549(91): Add *note platform.invalidate_caches(): 27f. to
     invalidate cached results.

   - gh-120754(92): Update unbounded ‘read’ calls in *note zipfile: 138.
     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():
     12f0. 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: 1269. 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(): 1536. 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: 111. functions *note parse_qsl(): 320. and *note
     parse_qs(): 321. 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: 1171.

   - bpo-46128(102): Strip *note unittest.IsolatedAsyncioTestCase: 35f.
     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: ドキュメント<16>,  Next: Core and Builtins<42>,  Prev: ライブラリ<46>,  Up: Python 3 14 0 alpha 2

1.24.22.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: c82. 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<42>,  Next: ライブラリ<47>,  Prev: ドキュメント<16>,  Up: Python 3 14 0 alpha 2

1.24.22.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: 2ee. is raised instead of *note
     SystemError: 795. when trying to iterate over a released *note
     memoryview: 166. 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: ライブラリ<47>,  Next: Core and Builtins<43>,  Prev: Core and Builtins<42>,  Up: Python 3 14 0 alpha 2

1.24.22.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<43>,  Next: ライブラリ<48>,  Prev: ライブラリ<47>,  Up: Python 3 14 0 alpha 2

1.24.22.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: ライブラリ<48>,  Next: Core and Builtins<44>,  Prev: Core and Builtins<43>,  Up: Python 3 14 0 alpha 2

1.24.22.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(): 1737.  Patch by
     Daehee Kim.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126209


File: python.info,  Node: Core and Builtins<44>,  Next: ライブラリ<49>,  Prev: ライブラリ<48>,  Up: Python 3 14 0 alpha 2

1.24.22.11 Core and Builtins
............................

   - gh-126312(1): Fix crash during garbage collection on an object
     frozen by *note gc.freeze(): d32. 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: 18fe.

   - 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: fb1. with an unknown future feature.

   - gh-126072(7): Add a new attribute in *note co_flags: 193d. to
     indicate whether the first item in *note co_consts: 18fe. 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: 106. 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(): 197b. when passing
     a non-string as first argument and Python was compiled in debug
     mode.

   - gh-126012(11): The *note memoryview: 166. type now supports
     subscription, making it a *note generic type: 1a2.

   - gh-125837(12): Adds *note LOAD_SMALL_INT: 36c. and *note
     LOAD_CONST_IMMORTAL: 373. 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: cd1. was changed from ‘surrogateescape’ to
     ‘backslashreplace’.

   - gh-125859(14): Fix a crash in the free threading build when *note
     gc.get_objects(): a08. or *note gc.get_referrers(): a09. 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: 106. 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: 451. 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(): 1a0. built-in now has an optional
     keyword-only 'strict' flag like *note zip(): 1a1. 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: ライブラリ<49>,  Next: C API<17>,  Prev: Core and Builtins<44>,  Up: Python 3 14 0 alpha 2

1.24.22.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<17>,  Next: ビルド<18>,  Prev: ライブラリ<49>,  Up: Python 3 14 0 alpha 2

1.24.22.13 C API
................

   - gh-126554(1): Fix error handling in *note ctypes.CDLL: be0. objects
     which could result in a crash in rare situations.

   - gh-126061(2): Add *note PyLong_IsPositive(): 399, *note
     PyLong_IsNegative(): 39a. and *note PyLong_IsZero(): 39b. for
     checking if a *note PyLongObject: 39c. 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(): 3c3. function for
     enabling PEP 703(5) deferred reference counting.

   - gh-121654(6): Add *note PyType_Freeze(): 3ad. function to make a
     type immutable.  Patch by Victor Stinner.

   - gh-120026(7): The ‘Py_HUGE_VAL’ macro is *note soft deprecated:
     23f.

   ---------- 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: ビルド<18>,  Prev: C API<17>,  Up: Python 3 14 0 alpha 2

1.24.22.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.23 Python 3.14.0 alpha 1
-----------------------------

'Release date: 2024-10-15'

* Menu:

* macOS: macOS<11>.
* Windows: Windows<16>.
* Tools/Demos: Tools/Demos<15>.
* テスト: テスト<17>.
* セキュリティ: セキュリティ<21>.
* ライブラリ: ライブラリ<50>.
* IDLE: IDLE<8>.
* ドキュメント: ドキュメント<17>.
* 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>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<55>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<57>.
* Core and Builtins: Core and Builtins<52>.
* C API: C API<18>.
* ビルド: ビルド<19>.


File: python.info,  Node: macOS<11>,  Next: Windows<16>,  Up: Python 3 14 0 alpha 1

1.24.23.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<16>,  Next: Tools/Demos<15>,  Prev: macOS<11>,  Up: Python 3 14 0 alpha 1

1.24.23.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: テスト<17>,  Prev: Windows<16>,  Up: Python 3 14 0 alpha 1

1.24.23.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: テスト<17>,  Next: セキュリティ<21>,  Prev: Tools/Demos<15>,  Up: Python 3 14 0 alpha 1

1.24.23.4 テスト
................

   - gh-125041(1): Re-enable skipped tests for *note zlib: 13a. 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(): 1984.
     Patch by Andreas Stocker.

   - gh-99242(8): *note os.getloadavg(): 1985. may throw *note OSError:
     2c2. 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():
     1986.  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: セキュリティ<21>,  Next: ライブラリ<50>,  Prev: テスト<17>,  Up: Python 3 14 0 alpha 1

1.24.23.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: ライブラリ<50>,  Next: IDLE<8>,  Prev: セキュリティ<21>,  Up: Python 3 14 0 alpha 1

1.24.23.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(): 164b. 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: 1989. and *note
     WeakValueDictionary: 198a. 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:
     ae0. 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: 1bf.
     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 ‘PurePath’ 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: 1b8. environment
     variable is set, the *note site: cc. module no longer imports the
     ‘_pyrepl’ module.  Moreover, the ‘site’ module now respects *note
     -E: b5a. and *note -I: b5b. command line options: ignore
     ‘PYTHON_BASIC_REPL’ 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(): 452. 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: dca.

   - gh-53203(18): Fix *note time.strptime(): 164b. 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(): c56. 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(): c07. and *note
     os.path.lexists(): c08. 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(): e15. 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: 102, *note venv: 118.) 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(): d12. when used with
     ‘happy_eyeballs_delay’

   - gh-124390(29): Fixed *note AssertionError: 8b9. 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: 198b. 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(): 198c. raise *note
     TypeError: 199. not *note AttributeError: 5f0. on bad input types
     that do not have the ‘replace’ attribute.  Improve error message
     when *note bytes: 193. 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: 2b0. with incorrect
     ‘type_params’ argument.  Now it raises a *note TypeError: 199. 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: 1be. default value for *note
     argparse.ArgumentParser: 1bf.  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(): 231.  Add an 'quote_annotation_strings'
     parameter to *note inspect.Signature.format(): 233.  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: 178.  Contributed by Bartosz Sławecki.

   - gh-61181(39): Fix support of *note choices: 198d. 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(): 198e.
     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():
     a0a. 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(): 198f. and *note curses.resize_term(): 1990.

   - gh-124498(45): Fix *note typing.TypeAliasType: 2b0. not to be
     generic, when ‘type_params’ is an empty tuple.

   - gh-53834(46): Fix support of arguments with *note choices: 198d. in
     *note argparse: 7.  Positional arguments with *note nargs: 1991.
     equal to ‘'?'’ or ‘'*'’ no longer check *note default: 1992.
     against ‘choices’.  Optional arguments with ‘nargs’ equal to ‘'?'’
     no longer check *note const: 1993. 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(): 1406. no longer accepts negative years on Android.

   - gh-123014(49): *note os.pidfd_open(): 6a4. and *note
     signal.pidfd_send_signal(): b29. 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(): 1994.  Now
     ‘create_autospec’ will check for potential dataclasses and use
     *note dataclasses.fields(): 1995. 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: 1991. 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:
     1991. equal to ‘'?'’ or ‘'*'’ if it is preceded by an option and
     another positional argument.

   - gh-100980(58): The *note _fields_: 1996. attribute of *note
     ctypes.Structure: 1e7. and *note Union: 1e8. 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(): dd1.

   - 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: 118. 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(): b34. and
     *note time.thread_time_ns(): d8e. on NetBSD.

   - gh-123934(69): Fix *note unittest.mock.MagicMock: 1093. resetting
     magic methods return values after ‘.reset_mock(return_value=True)’
     was called.

   - gh-124016(70): Update *note unicodedata: 10c. 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: a46.
     Patch by Victor Stinner.

   - gh-84808(75): Fix error handling in *note socket: fa5. method *note
     connect_ex(): 1758. on platforms where ‘errno’ can be negative.

   - gh-123756(76): Added a new argument ‘mode’ to *note pdb.Pdb: 275.
     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: 118. was sourced with a custom prompt
     containing unpaired quotes or newlines.

   - gh-123657(78): Fix crash and memory leak in *note
     decimal.getcontext(): 1997.  It crashed when using a thread-local
     context by ‘--with-decimal-contextvar=no’.

   - gh-123339(79): Fix *note inspect.getsource(): 182e. for classes in
     *note collections.abc: 1f. and *note decimal: 3a. (for pure Python
     implementation) modules.  *note inspect.getcomments(): 1998. 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(): ec2.

   - 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: 199.
     when *note csv.reader(): 6ae, *note csv.writer(): 6af, or *note
     csv.register_dialect(): 1999. 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:
     199a. 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: 199b. oparg
     in *note dis: 3c. output.  Patch by Alexandr153.

   - gh-123341(89): Add *note __class_getitem__(): 947. to
     ‘tkinter.Event’ for type subscript support at runtime.  Patch by
     Adonis Rakateli.

   - gh-123340(90): Show string value of *note IS_OP: 199c. oparg in
     *note dis: 3c. output.

   - gh-119518(91): Speed up normalization of *note pathlib.PurePath:
     6cd. and *note Path: 268. objects by not interning string parts.

   - gh-123270(92): Applied a more surgical fix for malformed payloads
     in *note zipfile.Path: 8d9. causing infinite loops (gh-122905(93))
     without breaking contents using legitimate characters.

   - gh-73991(94): Add *note pathlib.Path.copy_into(): 26a. and *note
     move_into(): 26c, 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(): 16a.  Patch by Sergey B Kirpichev.

   - gh-123240(96): Raise audit events for the *note input(): 14f4. in
     the new REPL.

   - gh-76960(97): Fix *note urllib.parse.urljoin(): 109a. and *note
     urllib.parse.urldefrag(): 1463. 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: 199d. 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(): 13ef.
     and *note Element: 361. 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(): 199e. and *note
     urllib.parse.urlunparse(): 199f.

   - gh-123165(103): Add support for rendering *note Positions: 19a0. 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: 246.

   - 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: 17fa. in
     *note configparser.ConfigParser.add_section(): 1489.

   - 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(): 182e. 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: 8d9. objects now sanitize names
     from the zipfile.

   - gh-122873(113): Enable *note json: 86. module to work as a script
     using the *note -m: 23e. switch: ‘python -m json’.  See the *note
     JSON command-line interface: 240. documentation.  Patch by Trey
     Hunner.

   - gh-122858(114): Deprecate ‘asyncio.iscoroutinefunction()’ in favor
     of *note inspect.iscoroutinefunction(): 30f.

   - gh-116263(115): *note logging.handlers.RotatingFileHandler: 19a1.
     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: 19a2. is now raised more often instead of
     *note UnicodeEncodeError: 888, *note ValueError: 2ee. 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(): 18c1. 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: 19a3. with non-default *note
     sys.excepthook(): a10.  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: 19a4. 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: 19a3, handle
     exceptions caused by calling a non-default *note sys.excepthook():
     a10.  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(): e92. 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: 2ee.s raised by *note
     os.stat(): 26f. in *note filecmp.dircmp: 1146. and *note
     filecmp.cmpfiles(): 19a5.  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():
     bd3. when using an eager task factory.

   - gh-105733(135): *note ctypes.ARRAY(): 59e. is now *note soft
     deprecated: 23f.: 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: 2b0.

        * ‘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: 2ee.s raised by *note
     os.stat(): 26f. 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(): 13cc.
     accept any object implementing the Queue public API. See the *note
     queue configuration: 19a6. 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: 19a7. 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(): 30f. 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(): 26b, 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(): 31f, 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: 18f. raised in new repl.  Patch by Sergey B Kirpichev.

   - gh-121797(155): Add alternative *note Fraction: 215. constructor
     *note Fraction.from_number(): 216.

   - gh-121798(156): Add alternative *note Decimal: 200. constructor
     *note Decimal.from_number(): 1ff.

   - 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:
     1146. (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(): bfc, *note
     log(): 16de, *note log2(): 12f7. and *note log10(): 19a8. 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: 1400. constructor.  Patch by Clinton Christian
     (pygeek).

   - gh-121450(164): Hard-coded breakpoints (*note breakpoint(): 273.
     and *note pdb.set_trace(): 274.) 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: 139. supports now namespace
     packages when no directory entry exists.

   - gh-119004(168): Fix a crash in *note OrderedDict.__eq__: 19a9. 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: 12fc. 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: 1a4.  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(): 1c1.  Patch by Bénédikt Tran.

   - gh-121163(173): Add support for ‘all’ as an valid ‘action’ for
     *note warnings.simplefilter(): 8d1. and *note
     warnings.filterwarnings(): 16c7.

   - 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(): 1c2. to AST
     nodes.  Patch by Bénédikt Tran.

   - gh-87744(176): Fix waitpid race while calling *note send_signal():
     19aa. in asyncio.  Patch by Kumar Aditya.

   - gh-121027(177): Add a future warning in
     ‘functools.partial.__get__()’.  In future Python versions *note
     functools.partial: 219. will be a method descriptor.

   - gh-121027(178): Make the *note functools.partial: 219. 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: 21a.  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: 1ef, *note c_double_complex: 1f0. and *note
     c_longdouble_complex: 1f1. 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(): 19ab.

   - gh-120782(189): Fix wrong references of the *note datetime: 34.
     types after reloading the module.

   - gh-120713(190): *note datetime.datetime.strftime(): e92. 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(): 19ac. and *note
     datetime.date.strptime(): 1fb.  Contributed by Wannes Boeykens.

   - gh-120743(194): *note Soft deprecate: 23f. *note os.popen(): 31c.
     and *note os.spawn*: 31d. 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:
     c43. object when using *note unittest.mock.create_autospec(): 1994.

   - 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: 11ec, 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(): 19ad. 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(): ad8. 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: 10d. returns something other than ‘None’.  Now we
     show the returned object type and optional asyncio-related tip.

   - gh-120381(205): Correct *note inspect.ismethoddescriptor(): 19ae.
     to check also for the lack of *note __delete__(): 19af.  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: 102. 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: 330, and *note typing.NamedTuple: 32f.

   - gh-119600(211): Fix *note unittest.mock.patch(): 1096. 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: 215.

   - gh-114053(214): Fix edge-case bug where *note
     typing.get_type_hints(): 8c1. 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: 450. when calling
     *note inspect.get_annotations(): a18. 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(): dd1. 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():
     274. which allows users to send debugger commands from the source
     file.

   - gh-120211(220): Fix *note tkinter.ttk: 100. with Tcl/Tk 9.0.

   - gh-71587(221): Fix crash in C version of *note
     datetime.datetime.strptime(): 19b0. 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(): 31f. and
     document its behaviour.  Patch by Bénédikt Tran.

   - gh-120121(226): Add *note concurrent.futures.InvalidStateError:
     19b1. to module's ‘__all__’.

   - gh-119933(227): Add the *note symtable.SymbolTableType: 19b2.
     enumeration to represent the possible outputs of the *note
     symtable.SymbolTable.get_type: 19b3. method.  Patch by Bénédikt
     Tran.

   - gh-120029(228): Expose *note symtable.Symbol: 28b. methods *note
     is_free_class(): 28e, *note is_comp_iter(): 28d. and *note
     is_comp_cell(): 28c.  Patch by Bénédikt Tran.

   - gh-120108(229): Fix calling *note copy.deepcopy(): d69. 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(): 25b. method
     to update ‘os.environ’ with changes to the environment made by
     *note os.putenv(): 25d, by *note os.unsetenv(): 25e, or made
     outside Python in the same process.  Patch by Victor Stinner.

   - gh-120029(233): Expose *note symtable.Symbol.is_type_parameter():
     19b4. 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(): 19b5. 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:
     215. and complex, the fraction is now converted to *note float:
     197. instead of *note complex: 198.

   - gh-119770(242): Make *note termios: e7. ‘ioctl()’ constants
     positive.  Patch by Victor Stinner.

   - gh-89727(243): Fix issue with *note shutil.rmtree(): 354. where a
     *note RecursionError: f6c. is raised on deep directory trees.

   - gh-119577(244): The *note DeprecationWarning: 1a4. emitted when
     testing the truth value of an *note xml.etree.ElementTree.Element:
     361. 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(): 354.
     where a *note RecursionError: f6c. 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:
     102. module by caching the ‘line’ token attribute and calculating
     the column offset more efficiently.

   - gh-89727(248): Fix issue with *note os.fwalk(): d56. where a *note
     RecursionError: f6c. 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: 18f. 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():
     219. objects now support placeholders via *note
     functools.Placeholder: 218.

   - gh-113892(256): Now, the method ‘sock_connect’ of *note
     asyncio.ProactorEventLoop: 81d. raises a *note ValueError: 2ee. 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(): 1699. 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(): 1a5.
     with *note Fraction: 215. 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(): 19b6. didn't raise *note TypeError:
     199. 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(): 269, 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: 19b7. and related attributes and methods.
     For example, the *note suffixes: 19b8. of ‘PurePath('foo.bar.')’
     are now ‘['.bar', '.']’ rather than ‘[]’.  This brings file
     extension splitting in line with *note os.path.splitext(): 19b9.

   - 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:
     199.

   - 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: 111.  It had previously raised a *note
     DeprecationWarning: 1a4. since Python 3.11.  Patch by Nikita
     Sobolev.

   - gh-118824(282): Remove deprecated ‘pty.master_open()’ and
     ‘pty.slave_open()’.  Use *note pty.openpty(): 303. 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: 1a4. since Python 3.12.

   - gh-118798(287): The 'isdst' parameter has been removed from *note
     email.utils.localtime(): 2f9.  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: 268.

   - gh-101357(291): Suppress all *note OSError: 2c2. exceptions from
     *note pathlib.Path.exists(): c0f. and ‘is_*()’ methods, rather than
     a selection of more common errors.  The new behaviour is consistent
     with *note os.path.exists(): c07, *note os.path.isdir(): c09, etc.
     Use *note pathlib.Path.stat(): a28. to retrieve the file status
     without suppressing exceptions.

   - gh-78707(292): Drop support for passing additional positional
     arguments to *note pathlib.PurePath.relative_to(): 2ff. and *note
     is_relative_to(): 300.

   - gh-118507(293): Fix *note os.path.isfile(): c0a. on Windows for
     pipes.  Speedup *note os.path.isjunction(): 6ca. and *note
     os.path.lexists(): c08. 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(): 264. now suppresses any
     *note OSError: 2c2. from *note os.readlink(): b1e. when 'strict'
     mode is disabled (the default).

   - gh-118263(298): Speed up *note os.path.splitroot(): 6cb. & *note
     os.path.normpath(): 1535. 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: 1823.

   - gh-117766(301): Always use *note str(): 16a. 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(): 257. and *note
     operator.is_not_none(): 258. functions.

   - gh-114264(306): Improve performance of *note copy.deepcopy(): d69.
     by adding a fast path for atomic types.

   - gh-113878(307): Add 'doc' parameter to *note dataclasses.field():
     19ba, 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__: 1709. dict.  Otherwise, the
     supplied string is only available in the corresponding *note
     dataclasses.Field: 19bb. object.

     In order to support this feature we are changing the ‘__slots__’
     format in dataclasses from *note tuple: 614. to *note dict: 184.
     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(): 19bc.
     and *note ssl.SSLSocket.get_unverified_chain(): 19bd. methods.

     Contributed by Mateusz Nowak.

   - gh-105623(312): Fix performance degradation in *note
     logging.handlers.RotatingFileHandler: 19a1.  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: 104.
     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: 3c1, *note str: 16a, *note bytearray: 342, or *note
     int: 19c.

   - gh-87106(317): Fixed handling in *note inspect.Signature.bind():
     18f5. 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: 24e.
     in the ‘multiprocessing’ module:

        * ‘clear()’ and ‘copy()’ for proxies of *note list: 24f.

        * *note fromkeys(): 250, ‘reversed(d)’, ‘d | {}’, ‘{} | d’, ‘d
          |= {'b': 2}’ for proxies of *note dict: 184.

   - bpo-45767(319): Fix integer conversion in *note os.major(): 19be,
     *note os.minor(): 19bf, and *note os.makedev(): 19c0.  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: 1bf.

   - bpo-41843(321): Solaris now uses *note os.sendfile(): d09.
     fast-copy syscall for more efficient *note shutil: ca. file copy
     related functions.

   - bpo-15987(322): Implemented *note ast.compare(): 1c1. for comparing
     two ASTs.  Patch by Batuhan Taskaya with some help from Jeremy
     Hylton.

   - gh-67693(323): Fix *note urllib.parse.urlunparse(): 199f. and *note
     urllib.parse.urlunsplit(): 199e. 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<8>,  Next: ドキュメント<17>,  Prev: ライブラリ<50>,  Up: Python 3 14 0 alpha 1

1.24.23.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: ドキュメント<17>,  Next: Core and Builtins<45>,  Prev: IDLE<8>,  Up: Python 3 14 0 alpha 1

1.24.23.8 ドキュメント
......................

   - gh-124872(1): Added definitions for *note context: 19c3, *note
     current context: 19c4, and *note context management protocol: 19c5,
     updated related definitions to be consistent, and expanded the
     documentation for *note contextvars.Context: 178.

   - 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(): 19c6. 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(): 19c7.

   - gh-121749(10): Fix documentation for *note PyModule_AddObjectRef():
     60a.

   - gh-120012(11): Clarify the behaviours of *note
     multiprocessing.Queue.empty(): 19c8. and *note
     multiprocessing.SimpleQueue.empty(): 19c9. 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(): e22. 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<45>,  Next: ライブラリ<51>,  Prev: ドキュメント<17>,  Up: Python 3 14 0 alpha 1

1.24.23.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__(): 19cb. 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: ライブラリ<51>,  Next: Core and Builtins<46>,  Prev: Core and Builtins<45>,  Up: Python 3 14 0 alpha 1

1.24.23.10 ライブラリ
.....................

   - gh-125008(1): Fix *note tokenize.untokenize(): 1915. 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<46>,  Next: ライブラリ<52>,  Prev: ライブラリ<51>,  Up: Python 3 14 0 alpha 1

1.24.23.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: 460. objects when the *note UnicodeError.start:
     1922. and *note UnicodeError.end: 1923. 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: 19ce. 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: 166.
     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: ライブラリ<52>,  Next: Core and Builtins<47>,  Prev: Core and Builtins<46>,  Up: Python 3 14 0 alpha 1

1.24.23.12 ライブラリ
.....................

   - gh-123614(1): Add *note turtle.save(): 19d0. 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<47>,  Next: ライブラリ<53>,  Prev: ライブラリ<52>,  Up: Python 3 14 0 alpha 1

1.24.23.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: 18f. 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: 199. when
     builtin magic methods are used without the required args.

   - gh-123440(7): Improve *note SyntaxError: 18f. 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(): 1a1. iterator safe under free-threading.

   - gh-123275(14): Support *note -X gil=1: 170. 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: 18f. 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: 19d2. 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: 18f. 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(): 45e. from a non-main thread.

   - gh-118093(26): Add three specializations for *note CALL_KW: 370.:

        * ‘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: 19d3.
     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: 170.

   - 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: b82. now accounts for non-sequence
     fields that aren't included in the *note Py_SIZE: 989. 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: 348. loops from correctly firing *note RAISE: 19d4. 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: 24f, *note tuple: 614. or *note
     dict: 184. 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: 18d. 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(): 19d5. is used, instead of *note
     PyLong_AsLongAndOverflow(): 1481.  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: 367. instead.

   - gh-122029(44): Emit ‘c_call’ events in *note sys.setprofile():
     171c. 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: ライブラリ<53>,  Next: Core and Builtins<48>,  Prev: Core and Builtins<47>,  Up: Python 3 14 0 alpha 1

1.24.23.14 ライブラリ
.....................

   - gh-121999(1): The default extraction filter for the *note tarfile:
     e4. module is now set to *note 'data': 29c.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121999


File: python.info,  Node: Core and Builtins<48>,  Next: ライブラリ<54>,  Prev: ライブラリ<53>,  Up: Python 3 14 0 alpha 1

1.24.23.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: 18f. message if the
     user tries to use *note yield from: bc6. 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: 18e. or
     asynchronous comprehensions in code removed by the *note -O: 18d.
     option was not flagged by the Python compiler.  Now, such code
     raises *note SyntaxError: 18f.  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: 2ee. messages for *note
     list.index(): 15e2, *note range.index(): 19d8, ‘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(): 19d9. and
     *note remove(): 19da. 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: ライブラリ<54>,  Next: Core and Builtins<49>,  Prev: Core and Builtins<48>,  Up: Python 3 14 0 alpha 1

1.24.23.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<49>,  Next: ライブラリ<55>,  Prev: ライブラリ<54>,  Up: Python 3 14 0 alpha 1

1.24.23.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__(): 19f. methods by default.  The
     ‘Py_ASNATIVEBYTES_ALLOW_INDEX’ flag has been added to allow it.

   - gh-120838(3): *note Py_Finalize(): 45d. and *note Py_FinalizeEx():
     f15. 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: 36d. instruction.
     Generate code for ‘with’ and ‘async with’ statements using the new
     instruction.

   - gh-113993(15): Strings interned with *note sys.intern(): 14f7. are
     again garbage-collected when no longer used, as per the
     documentation.  Strings interned with the C function *note
     PyUnicode_InternInPlace(): ab2. are still immortal.  Internals of
     the string interning mechanism have been changed.  This may affect
     performance and identities of *note str: 16a. 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: ライブラリ<55>,  Next: Core and Builtins<50>,  Prev: Core and Builtins<49>,  Up: Python 3 14 0 alpha 1

1.24.23.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<50>,  Next: ライブラリ<56>,  Prev: ライブラリ<55>,  Up: Python 3 14 0 alpha 1

1.24.23.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: ライブラリ<56>,  Next: Core and Builtins<51>,  Prev: Core and Builtins<50>,  Up: Python 3 14 0 alpha 1

1.24.23.20 ライブラリ
.....................

   - gh-120380(1): Fix Python implementation of *note pickle.Pickler:
     c17. for *note bytes: 193. and *note bytearray: 342. 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<51>,  Next: ライブラリ<57>,  Prev: ライブラリ<56>,  Up: Python 3 14 0 alpha 1

1.24.23.21 Core and Builtins
............................

   - gh-120397(1): Improve the throughput by up to two times for the
     *note str.count(): 19e1, *note bytes.count(): 19e2. and *note
     bytearray.count(): 1803. 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: 1b8. 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: 18f. 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():
     451. now wrap the *note __annotations__: 456. and *note
     __annotate__: 19e3. 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(): 19c. to *note __trunc__(): 19d.

   - gh-119689(22): Generate stack effect metadata for pseudo
     instructions from bytecodes.c.

   - gh-109218(23): *note complex(): 198. 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(): fdb.

   - 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: 368. and add support for *note
     NotImplementedError: 369.

   - 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: df9.
     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: 119. module had not yet been
     imported.

   - gh-119057(42): Improve *note ZeroDivisionError: b43. 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: 1a3. in a boolean
     context now raises *note TypeError: 199.  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: ライブラリ<57>,  Next: Core and Builtins<52>,  Prev: Core and Builtins<51>,  Up: Python 3 14 0 alpha 1

1.24.23.22 ライブラリ
.....................

   - gh-115801(1): Raise ‘TypeError’ when passing a string to *note
     difflib.unified_diff(): 19e5. and *note difflib.context_diff():
     19e6.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115801


File: python.info,  Node: Core and Builtins<52>,  Next: C API<18>,  Prev: ライブラリ<57>,  Up: Python 3 14 0 alpha 1

1.24.23.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(): 45d. now deletes all interned
     strings.

   - gh-84978(6): Add class methods *note float.from_number(): 195. and
     *note complex.from_number(): 196.

   - 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<18>,  Next: ビルド<19>,  Prev: Core and Builtins<52>,  Up: Python 3 14 0 alpha 1

1.24.23.24 C API
................

   - gh-123961(1): Convert the *note curses.window: 19e9. static type
     exposed by the ‘PyCursesWindow_Type’ macro in ‘Include/py_curses.h’
     to a *note heap type: b62.  Patch by Bénédikt Tran.

   - gh-124502(2): Add *note PyUnicode_Equal(): 3b0. 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(): 3ae. and *note
     Py_tp_token: 3af. 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(): 2d1. 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(): 385.

        * *note PyInitConfig_Free(): 386.

        * *note PyInitConfig_GetError(): 388.

        * *note PyInitConfig_GetExitCode(): 389.

        * *note PyInitConfig_HasOption(): 38d.

        * *note PyInitConfig_GetInt(): 38a.

        * *note PyInitConfig_GetStr(): 38b.

        * *note PyInitConfig_GetStrList(): 38c.

        * *note PyInitConfig_FreeStrList(): 387.

        * *note PyInitConfig_SetInt(): 38e.

        * *note PyInitConfig_SetStr(): 38f.

        * *note PyInitConfig_SetStrList(): 390.

        * *note PyInitConfig_AddModule(): 379.

        * *note Py_InitializeFromInitConfig(): 384.

     Patch by Victor Stinner.

   - gh-107954(15): Add functions to get and set the current runtime
     Python configuration:

        * *note PyConfig_Get(): 37a.

        * *note PyConfig_GetInt(): 382.

        * *note PyConfig_Set(): 37b.

        * *note PyConfig_Names(): 383.

     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: 19ea. 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(): 393. 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: 17b1. 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(): 396. to replace *note
     PyIter_Next(): 397, 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): 381.
     function, similar to ‘sep.join(iterable)’ in Python.  Patch by
     Victor Stinner.

   - gh-89364(24): Export the *note PySignal_SetWakeupFd(): 15f9.
     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(): ab2. 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(): 19eb, *note PyDict_SetItemString():
     19ec, *note PyObject_SetAttrString(): 19ed, *note
     PyObject_DelAttrString(): 1898, ‘PyUnicode_InternFromString()’, 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(): 19ee. 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: 19c.:

        * *note PyLong_FromInt32(): 3a1.

        * *note PyLong_FromUInt32(): 3a3.

        * *note PyLong_FromInt64(): 3a2.

        * *note PyLong_FromUInt64(): 3a4.

        * *note PyLong_AsInt32(): 39d.

        * *note PyLong_AsUInt32(): 39f.

        * *note PyLong_AsInt64(): 39e.

        * *note PyLong_AsUInt64(): 3a0.

     Patch by Victor Stinner.

   - gh-120600(32): In the limited C API 3.14 and newer, *note
     Py_TYPE(): 3c7. 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(): 1953. on
     overflows.  Patch by Sergey B Kirpichev.

   - gh-119182(35): Add a new *note PyUnicodeWriter: 3b1. API to create
     a Python *note str: 16a. object:

        * *note PyUnicodeWriter_Create(): 3b2.

        * *note PyUnicodeWriter_Discard(): 3b4.

        * *note PyUnicodeWriter_Finish(): 3b5.

        * *note PyUnicodeWriter_WriteChar(): 3b8.

        * *note PyUnicodeWriter_WriteUTF8(): 3bd.

        * *note PyUnicodeWriter_WriteUCS4(): 3bc.

        * *note PyUnicodeWriter_WriteWideChar(): 3be.

        * *note PyUnicodeWriter_WriteStr(): 3ba.

        * *note PyUnicodeWriter_WriteRepr(): 3b9.

        * *note PyUnicodeWriter_WriteSubstring(): 3bb.

        * *note PyUnicodeWriter_Format(): 3b6.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 3b3.

     Patch by Victor Stinner.

   - gh-119613(36): Soft deprecate the *note Py_MEMCPY: 19ef. macro: use
     directly ‘memcpy()’ instead.  Patch by Victor Stinner.

   - gh-119775(37): Creating *note immutable types: 3cd. with mutable
     bases was deprecated since 3.12 and now raises a *note TypeError:
     199.

   - 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(): 19f0. that calls back into
     ‘PyGILState_Ensure()’ and *note PyGILState_Release(): 64b.  This
     might occur when in the free-threaded build or when using
     thread-local variables whose destructors call
     ‘PyGILState_Ensure()’.

   - gh-119613(39): Macros ‘Py_IS_NAN’, ‘Py_IS_INFINITY’ and
     ‘Py_IS_FINITE’ are *note soft deprecated: 23f.

   - 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(): 19f1. and *note
     PyContext_ClearWatcher(): 19f2. 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: 19f3. 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(): 19f4, 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(): 398. 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: ビルド<19>,  Prev: C API<18>,  Up: Python 3 14 0 alpha 1

1.24.23.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: 19f6.
     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: 266. 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.24 Python 3.13.0 beta 1
----------------------------

'Release date: 2024-05-08'

* Menu:

* セキュリティ: セキュリティ<22>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<59>.
* ドキュメント: ドキュメント<18>.
* ビルド: ビルド<20>.
* Windows: Windows<17>.
* macOS: macOS<12>.
* IDLE: IDLE<9>.
* C API: C API<19>.


File: python.info,  Node: セキュリティ<22>,  Next: Core and Builtins<53>,  Up: Python 3 13 0 beta 1

1.24.24.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<53>,  Next: ライブラリ<58>,  Prev: セキュリティ<22>,  Up: Python 3 13 0 beta 1

1.24.24.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: ライブラリ<58>,  Next: Core and Builtins<54>,  Prev: Core and Builtins<53>,  Up: Python 3 13 0 beta 1

1.24.24.3 ライブラリ
....................

   - gh-95382(1): Improve performance of *note json.dumps(): f45. and
     *note json.dump(): f44. when using the argument 'indent'.
     Depending on the data the encoding using ‘json.dumps()’ 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<54>,  Next: ライブラリ<59>,  Prev: ライブラリ<58>,  Up: Python 3 13 0 beta 1

1.24.24.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: 1754. 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(): 19fc. not to be
     partially set when raising *note TypeError: 199.

   - 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: 1b7. 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: 18f. 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: 18f. 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: 193. and *note bytearray: 342. methods by adapting them to
     the *note METH_FASTCALL: 19fd. calling convention:

        * ‘count()’

        * ‘find()’

        * ‘index()’

        * ‘rfind()’

        * ‘rindex()’

   - gh-117709(32): Speed up calls to *note str(): 16a. 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(): 2e3.

   - 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: 106. module does.  Patch by Pablo
     Galindo

   - gh-107674(41): Improved the performance of *note sys.settrace():
     2e3. 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: ライブラリ<59>,  Next: ドキュメント<18>,  Prev: Core and Builtins<54>,  Up: Python 3 13 0 beta 1

1.24.24.5 ライブラリ
....................

   - gh-118418(1): A *note DeprecationWarning: 1a4. 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: e8f. and *note typing.AsyncContextManager:
     19ff, representing the return types of *note __exit__(): 151c. and
     *note __aexit__(): 1a00. 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: 1a01. and *note typing.AsyncGenerator: 1a02.

   - 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(): 231. for
     non-comparable callables.

   - gh-118402(12): Fix *note inspect.signature(): 231. for the result
     of the *note functools.cmp_to_key(): 13f6. call.

   - gh-116622(13): On Android, *note sysconfig.get_platform: 145e. 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: 1037, *note
     operator.itemgetter: c5b, and *note operator.methodcaller: 1038.
     instances.

   - gh-118314(16): Fix an edge case in *note binascii.a2b_base64():
     17cf. 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: 1a03. 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(): a1a. 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(): 1994. to
     configure parent mock with keyword arguments.

   - gh-118168(25): Fix incorrect argument substitution when *note
     typing.Unpack: 1a04. is used with the builtin *note tuple: 614.
     ‘typing.Unpack’ now raises *note TypeError: 199. 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: 139. reading of ZIP64 files
     with file entries that are too big or offset too far.

   - gh-102511(28): Fix *note os.path.normpath(): 1535. 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: 119.
     from ‘sys’ to ‘<sys>’ to clarify that it's not a real filename.

   - gh-114053(30): Fix erroneous *note NameError: 450. when calling
     *note typing.get_type_hints(): 8c1. 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(): 1a05.

   - gh-117995(33): Don't raise *note DeprecationWarning: 1a4. 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(): 13e9. 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,
     ‘glob()’ can no longer raise *note OSError: 2c2.

   - 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(): 270. by using
     *note os.scandir(): c58. 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: 1a06.
     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(): 1041. 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(): 1a07.

   - 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(): 1a08.
     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(): 264.
     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: 18e, 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(): c0d. on Posix.

   - gh-117394(64): *note os.path.ismount(): c0b. 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: 23f.

   - 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(): ae5. 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: 138.  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(): 231. 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__(): 947. to *note
     types.GeneratorType: 1a09. and *note types.CoroutineType: 108d. 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: 1779. 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: ドキュメント<18>,  Next: ビルド<20>,  Prev: ライブラリ<59>,  Up: Python 3 13 0 beta 1

1.24.24.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: ビルド<20>,  Next: Windows<17>,  Prev: ドキュメント<18>,  Up: Python 3 13 0 beta 1

1.24.24.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<17>,  Next: macOS<12>,  Prev: ビルド<20>,  Up: Python 3 13 0 beta 1

1.24.24.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<12>,  Next: IDLE<9>,  Prev: Windows<17>,  Up: Python 3 13 0 beta 1

1.24.24.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<9>,  Next: C API<19>,  Prev: macOS<12>,  Up: Python 3 13 0 beta 1

1.24.24.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<19>,  Prev: IDLE<9>,  Up: Python 3 13 0 beta 1

1.24.24.11 C API
................

   - gh-118124(1): Fix *note Py_BUILD_ASSERT: 1a10. and *note
     Py_BUILD_ASSERT_EXPR: 1a11. 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(): 1a12.

        * *note Py_SetProgramName(): 1a13.

        * *note PySys_SetArgvEx(): 1a14.

        * *note PySys_SetArgv(): 1a15.

     Patch by Victor Stinner.

   - gh-117929(4): Restore removed *note PyEval_InitThreads(): 1a16.
     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.25 Python 3.13.0 alpha 6
-----------------------------

'Release date: 2024-04-09'

* Menu:

* Core and Builtins: Core and Builtins<55>.
* ライブラリ: ライブラリ<60>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<61>.
* ドキュメント: ドキュメント<19>.
* テスト: テスト<18>.
* ビルド: ビルド<21>.
* Windows: Windows<18>.
* C API: C API<20>.


File: python.info,  Node: Core and Builtins<55>,  Next: ライブラリ<60>,  Up: Python 3 13 0 alpha 6

1.24.25.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:
     193. and *note bytearray: 342. methods by adapting them to the
     *note METH_FASTCALL: 19fd. calling convention:

        * ‘endswith()’

        * ‘startswith()’

   - gh-117431(4): Improve the performance of the following *note str:
     16a. methods by adapting them to the *note METH_FASTCALL: 19fd.
     calling convention:

        * *note count(): 19e1.

        * *note endswith(): 10d0.

        * *note find(): 10ac.

        * *note index(): 1a19.

        * *note rfind(): 10ad.

        * *note rindex(): 1473.

        * *note startswith(): 10cf.

   - 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: 1a1a.
     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: 1a1a.

   - 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: ライブラリ<60>,  Next: Core and Builtins<56>,  Prev: Core and Builtins<55>,  Up: Python 3 13 0 alpha 6

1.24.25.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<56>,  Next: ライブラリ<61>,  Prev: ライブラリ<60>,  Up: Python 3 13 0 alpha 6

1.24.25.3 Core and Builtins
...........................

   - bpo-24612(1): Improve the *note SyntaxError: 18f. 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: ライブラリ<61>,  Next: ドキュメント<19>,  Prev: Core and Builtins<56>,  Up: Python 3 13 0 alpha 6

1.24.25.4 ライブラリ
....................

   - gh-117648(1): Improve performance of *note os.path.join(): 1a07.
     and *note os.path.expanduser(): c0d.

   - gh-117584(2): Raise *note TypeError: 199. for non-paths in *note
     posixpath.relpath: 6d1.

   - gh-117467(3): Preserve mailbox ownership when rewriting in *note
     mailbox.mbox.flush: 1a1e.  Patch by Tony Mountifield.

   - gh-114848(4): Raise *note FileNotFoundError: 266. 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: a3a.
     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(): d1f. 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: 1018.

   - gh-117084(22): Fix *note zipfile: 138. extraction for directory
     entries with the name containing backslashes on Windows.

   - gh-117114(23): Make *note os.path.isdevdrive(): 1a1f. 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: 8bc. 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(): 19b0. and *note
     time.strptime(): 164b. which always fails to parse a date string
     with a *note ValueError: 2ee. 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(): ee4. 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: 111. functions *note parse_qs(): 321. and *note
     parse_qsl(): 320.  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: 1a20. (see these docs
          for details)

        * *note ipaddress.IPv4Address.is_global: 1165.

        * *note ipaddress.IPv6Address.is_private: 1a21.

        * *note ipaddress.IPv6Address.is_global: 1a22.

     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(): 1a23, 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 *note
     tkinter.Checkbutton: 1a24. widget names to avoid collisions with
     automatically generated *note tkinter.ttk.Checkbutton: 1a25. 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(): d56. and *note
     shutil.rmtree(): 354. on opening named pipe.

   - gh-71052(47): Implement *note ctypes.util.find_library(): f49. 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: 117.: ‘_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(): 264. 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: c6e. termination with *note
     shutdown(): 4cc. method.

   - gh-89739(59): The *note zipimport: 139. 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():
     1a26.'s iteration pattern.  Patch by Justin Arthur.

   - bpo-27578(61): *note inspect.getsource(): 182e. (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(): 11eb. 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: ドキュメント<19>,  Next: テスト<18>,  Prev: ライブラリ<61>,  Up: Python 3 13 0 alpha 6

1.24.25.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: テスト<18>,  Next: ビルド<21>,  Prev: ドキュメント<19>,  Up: Python 3 13 0 alpha 6

1.24.25.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: ビルド<21>,  Next: Windows<18>,  Prev: テスト<18>,  Up: Python 3 13 0 alpha 6

1.24.25.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<18>,  Next: C API<20>,  Prev: ビルド<21>,  Up: Python 3 13 0 alpha 6

1.24.25.8 Windows
.................

   - gh-117267(1): Ensure ‘DirEntry.stat().st_ctime’ behaves
     consistently with *note os.stat(): 26f. 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(): 1a2b. 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<20>,  Prev: Windows<18>,  Up: Python 3 13 0 alpha 6

1.24.25.9 C API
...............

   - gh-117642(1): Fix PEP 737(2) implementation for ‘%#T’ and ‘%#N’.

   - gh-87193(3): *note _PyBytes_Resize(): 1a2d. 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(): 1a2e.
     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.26 Python 3.13.0 alpha 5
-----------------------------

'Release date: 2024-03-12'

* Menu:

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


File: python.info,  Node: セキュリティ<23>,  Next: Core and Builtins<57>,  Up: Python 3 13 0 alpha 5

1.24.26.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(): 11b2. and
     *note ssl.SSLContext.get_ca_certs(): 11b3. now correctly lock
     access to the certificate store, when the *note ssl.SSLContext:
     355. 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<57>,  Next: ライブラリ<62>,  Prev: セキュリティ<23>,  Up: Python 3 13 0 alpha 5

1.24.26.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: 24f. 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: 18f. 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(): 1801. is called with a *note str: 16a. 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: ライブラリ<62>,  Next: Core and Builtins<58>,  Prev: Core and Builtins<57>,  Up: Python 3 13 0 alpha 5

1.24.26.3 ライブラリ
....................

   - gh-115154(1): Fix a bug that was causing the *note
     tokenize.untokenize(): 1915. 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<58>,  Next: ライブラリ<63>,  Prev: ライブラリ<62>,  Up: Python 3 13 0 alpha 5

1.24.26.4 Core and Builtins
...........................

   - gh-112433(1): Add ability to force alignment of *note
     ctypes.Structure: 1e7. by way of the new ‘_align_’ attribute on the
     class.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112433


File: python.info,  Node: ライブラリ<63>,  Next: Core and Builtins<59>,  Prev: Core and Builtins<58>,  Up: Python 3 13 0 alpha 5

1.24.26.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<59>,  Next: ライブラリ<64>,  Prev: ライブラリ<63>,  Up: Python 3 13 0 alpha 5

1.24.26.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: ライブラリ<64>,  Next: ドキュメント<20>,  Prev: Core and Builtins<59>,  Up: Python 3 13 0 alpha 5

1.24.26.7 ライブラリ
....................

   - gh-116600(1): Fix *note repr(): 1c3. for global *note Flag: 835.
     members.

   - gh-116349(2): *note platform.java_ver(): 32a. 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: 10b.: implement PEP 705(5) which adds
     *note typing.ReadOnly: 48a. support to *note typing.TypedDict: 330.

   - gh-116325(6): *note typing: 10b.: raise *note SyntaxError: 18f.
     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: 11c. to check desktop.  Prefer it to the
     deprecated ‘GNOME_DESKTOP_SESSION_ID’ for GNOME detection.

   - gh-75988(17): Fixed *note unittest.mock.create_autospec(): 1994. to
     pass the call through to the wrapped object to return the real
     result.

   - gh-115881(18): Fix issue where *note ast.parse(): 1c4. 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:
     1a37.

   - 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: 111. functions *note parse_qs():
     321. and *note parse_qsl(): 320. 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(): ae6. 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():
     1a38, *note setter(): 1a39. and *note deleter(): 1a3a.

   - 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(): 1162. for types with the
     ‘__wrapper__’ data descriptor.  Fix *note
     inspect.Signature.from_callable(): 946. for builtins *note
     classmethod(): 48e. and *note staticmethod(): 451.

   - 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(): 946.

   - 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: eaf. 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: 2ee. exception when passed an empty iterable.
     Previously, *note IndexError: 1753. was raised.

     ‘posixpath.commonpath()’ now raises a *note TypeError: 199.
     exception when passed ‘None’.  Previously, *note ValueError: 2ee.
     was raised.

   - gh-114610(43): Fix bug where *note pathlib.PurePath.with_stem():
     1a3b. converted a non-empty path suffix to a stem when given an
     empty 'stem' argument.  It now raises *note ValueError: 2ee, just
     like *note pathlib.PurePath.with_suffix(): 19b6. 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: 9c9. for *note
     typing.Annotated: b3b. 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(): 1686. 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: 14b9. function, which has an ‘__annotations__’
     dictionary attribute with a ‘"return"’ key.

   - gh-57141(50): Add option for 'non-shallow' comparisons to *note
     filecmp.dircmp: 1146. like *note filecmp.cmp(): 1a3c.  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: 1a3d. name in the
     *note repr(): 1c3. of *note functools.partial(): 219. 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: 1167. 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(): 1a3e. 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(): be9. now throws a TypeError
     instead of hitting an index out of bounds internally.

   - bpo-40818(66): The asyncio REPL now runs *note
     sys.__interactivehook__: 11ce. on startup.  The default
     implementation of ‘sys.__interactivehook__’ 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: ドキュメント<20>,  Next: テスト<19>,  Prev: ライブラリ<64>,  Up: Python 3 13 0 alpha 5

1.24.26.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: 117. 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: テスト<19>,  Next: ビルド<22>,  Prev: ドキュメント<20>,  Up: Python 3 13 0 alpha 5

1.24.26.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: ビルド<22>,  Next: Windows<19>,  Prev: テスト<19>,  Up: Python 3 13 0 alpha 5

1.24.26.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: 293. 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<19>,  Next: macOS<13>,  Prev: ビルド<22>,  Up: Python 3 13 0 alpha 5

1.24.26.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<13>,  Next: IDLE<10>,  Prev: Windows<19>,  Up: Python 3 13 0 alpha 5

1.24.26.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<10>,  Next: Tools/Demos<16>,  Prev: macOS<13>,  Up: Python 3 13 0 alpha 5

1.24.26.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<21>,  Prev: IDLE<10>,  Up: Python 3 13 0 alpha 5

1.24.26.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<21>,  Prev: Tools/Demos<16>,  Up: Python 3 13 0 alpha 5

1.24.26.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: 1a47, *note PyHASH_BITS:
     1a48, *note PyHASH_INF: 1a49. and *note PyHASH_IMAG: 1a4a. 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.27 Python 3.13.0 alpha 4
-----------------------------

'Release date: 2024-02-15'

* Menu:

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


File: python.info,  Node: セキュリティ<24>,  Next: Core and Builtins<60>,  Up: Python 3 13 0 alpha 4

1.24.27.1 セキュリティ
......................

   - gh-115399(1): Update bundled libexpat to 2.6.0

   - gh-115243(2): Fix possible crashes in *note
     collections.deque.index(): fd4. 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<60>,  Next: ライブラリ<65>,  Prev: セキュリティ<24>,  Up: Python 3 13 0 alpha 4

1.24.27.2 Core and Builtins
...........................

   - gh-112087(1): For an empty reverse iterator for list will be
     reduced to *note reversed(): a69.  Patch by Donghee Na

   - gh-114570(2): Add *note PythonFinalizationError: 47a. exception.
     This exception derived from *note RuntimeError: 246. 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(): 362, which
     clears all internal performance-related caches (and deprecate the
     less-general *note sys._clear_type_cache(): 294. function).

   - gh-114828(4): Fix compilation crashes in uncommon code examples
     using *note super(): 1a7. inside a comprehension in a class body.

   - gh-112069(5): Adapt *note set: 185. 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__(): 19f. method as for *note int: 19c.

   - gh-114887(7): Changed socket type validation in *note
     create_datagram_endpoint(): 940. 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(): 1a4e. builtin function now always
     raises *note ValueError: 2ee. for values outside the valid range.
     Previously it raised *note OverflowError: a85. 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: 19c. to
     an attribute that corresponds to a C struct member of *note type:
     1a4f. T_UINT and T_ULONG. Fix a double ‘RuntimeWarning’ 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: d65. 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: f48. 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: ライブラリ<65>,  Next: ドキュメント<21>,  Prev: Core and Builtins<60>,  Up: Python 3 13 0 alpha 4

1.24.27.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(): 19a. bugs when using the
     C implementation of *note Decimal: 200.: * 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:
     215. and *note complex: 198.

   - gh-115165(4): Most exceptions are now ignored when attempting to
     set the ‘__orig_class__’ attribute on objects returned when calling
     *note typing: 10b. generic aliases (including generic aliases
     created using *note typing.Annotated: b3b.).  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: 11f9. 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: 138.

   - gh-115060(10): Speed up *note pathlib.Path.glob(): 537. by removing
     redundant regex matching.

   - gh-97928(11): Partially revert the behavior of *note
     tkinter.Text.count(): 1a51.  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: 1fc.-*note datetime: 4e2. comparison.
     Now the special comparison methods like ‘__eq__’ and ‘__lt__’
     return *note NotImplemented: 1a3. 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: 199.  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: 200. 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: aeb. creation.

   - gh-77749(25): *note email.policy.EmailPolicy.fold(): 1a52. now
     always encodes non-ASCII characters in headers if *note utf8: ffd.
     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
     ‘dbm.dumb’ 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: 12d9.  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(): 1a53.
     reproducible on Alpine Linux.  Previously it could leave a random
     garbage in some fields.

   - gh-114315(32): Make *note threading.Lock: 1a54. 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: 2c2. 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(): f49. 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(): 1a55. and new *note
     tty.cfmakecbreak(): 1a56. 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: 2c2. 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():
     1a57. 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 *note
     tkinter.Text: 1a58. and *note tkinter.Canvas: 1a59. 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:
     188d. constructor.  *note ValueError: 2ee. 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: 1a5a. 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(): 16e9,
     *note datetime.date.replace(): 1a5b. and *note
     datetime.time.replace(): 1a5c.

   - 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: 104.  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: 1a5d.
     and *note mailbox.MMDF: 1a5e.

   - gh-106233(69): Fix stacklevel in ‘InvalidTZPathWarning’ during
     *note zoneinfo: 13b. module import.

   - gh-105102(70): Allow *note ctypes.Union: 1e8. to be nested in *note
     ctypes.Structure: 1e7. 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: 15b0. 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(): 1a5f, *note os.grantpt(): 1a60, *note
     os.unlockpt(): 1a61, and *note os.ptsname(): 1a62.

   - 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(): 329, which identifies
     reserved pathnames such as "NUL", "AUX" and "CON". This function is
     only available on Windows.

     Deprecate *note pathlib.PurePath.is_reserved(): 328.

   - 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: ドキュメント<21>,  Next: テスト<20>,  Prev: ライブラリ<65>,  Up: Python 3 13 0 alpha 4

1.24.27.4 ドキュメント
......................

   - gh-115233(1): Fix an example for *note LoggerAdapter: 1511. 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: テスト<20>,  Next: ビルド<23>,  Prev: ドキュメント<21>,  Up: Python 3 13 0 alpha 4

1.24.27.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: ビルド<23>,  Next: Windows<20>,  Prev: テスト<20>,  Up: Python 3 13 0 alpha 4

1.24.27.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<20>,  Next: macOS<14>,  Prev: ビルド<23>,  Up: Python 3 13 0 alpha 4

1.24.27.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<14>,  Next: IDLE<11>,  Prev: Windows<20>,  Up: Python 3 13 0 alpha 4

1.24.27.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(): 1a68.

   - 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<11>,  Next: Tools/Demos<17>,  Prev: macOS<14>,  Up: Python 3 13 0 alpha 4

1.24.27.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<22>,  Prev: IDLE<11>,  Up: Python 3 13 0 alpha 4

1.24.27.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: 1a6b. 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<22>,  Prev: Tools/Demos<17>,  Up: Python 3 13 0 alpha 4

1.24.27.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(): 968. now raises a *note
     SystemError: 795. if called with *note PyBUF_READ: 1a6d. or *note
     PyBUF_WRITE: 1a6e. 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: 1a6d. or *note
     PyBUF_WRITE: 1a6e. 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: 3d5.

   - 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(): 1289, 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.28 Python 3.13.0 alpha 3
-----------------------------

'Release date: 2024-01-17'

* Menu:

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<66>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<21>.
* ビルド: ビルド<24>.
* Windows: Windows<21>.
* macOS: macOS<15>.
* IDLE: IDLE<12>.
* C API: C API<23>.


File: python.info,  Node: セキュリティ<25>,  Next: Core and Builtins<61>,  Up: Python 3 13 0 alpha 3

1.24.28.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<61>,  Next: ライブラリ<66>,  Prev: セキュリティ<25>,  Up: Python 3 13 0 alpha 3

1.24.28.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: 1a7. 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(): 1c4.  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(): 110f. and
     *note max(): 1110.

   - gh-112943(25): Correctly compute end column offsets for multiline
     tokens in the *note tokenize: 102. module.  Patch by Pablo Galindo

   - gh-112125(26): Fix ‘None.__ne__(None)’ returning ‘NotImplemented’
     instead of ‘False’.

   - gh-74616(27): *note input(): 14f4. 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(): 1a72. and *note binascii.crc32():
     1a73. could produce incorrect results on multi-gigabyte inputs.
     Including when using *note zipfile: 138. 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(): 101e. and *note
     getgeneratorstate(): 1452. 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(): 1a74./*note
     PyComplex_ImagAsDouble(): 1a75. now tries to convert an object to a
     *note complex: 198. 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: ライブラリ<66>,  Next: ドキュメント<22>,  Prev: Core and Builtins<61>,  Up: Python 3 13 0 alpha 3

1.24.28.3 ライブラリ
....................

   - gh-114077(1): Fix possible *note OverflowError: a85. in *note
     socket.socket.sendfile(): 1061. 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: 215. 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: 2cd. 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: 1a77, *note
     mmap.MAP_NOEXTEND: 1a78, *note mmap.MAP_HASSEMAPHORE: 1a79, *note
     mmap.MAP_NOCACHE: 1a7a, *note mmap.MAP_JIT: 1a7b, *note
     mmap.MAP_RESILIENT_CODESIGN: 1a7c, *note mmap.MAP_RESILIENT_MEDIA:
     1a7d, *note mmap.MAP_32BIT: 1a7e, *note
     mmap.MAP_TRANSLATED_ALLOW_EXECUTE: 1a7f, *note mmap.MAP_UNIX03:
     1a80. and *note mmap.MAP_TPRO: 1a81.  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: a3a. 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(): 1a82. now re-raises
     the same ‘CancelledError’ instance that may have caused it to be
     interrupted.  Fixed race condition in *note
     asyncio.Semaphore.acquire(): 1a83. 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: 138. 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: 888. 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(): b4d.

   - gh-89850(22): Add default implementations of *note
     pickle.Pickler.persistent_id(): 196c. and *note
     pickle.Unpickler.persistent_load(): 1974. methods in the C
     implementation.  Calling ‘super().persistent_id()’ and
     ‘super().persistent_load()’ in subclasses of the C implementation
     of *note pickle.Pickler: c17. and *note pickle.Unpickler: 17e9.
     classes no longer causes infinite recursion.

   - gh-113569(23): Indicate if there were no actual calls in unittest
     *note assert_has_calls(): 1a84. failure.

   - gh-101225(24): Increase the backlog for *note
     multiprocessing.connection.Listener: 1a85. 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: 12fc.
     to them.

   - gh-113568(25): Raise audit events from *note pathlib.Path: 268. 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: 10e. 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: df9. into *note RuntimeError: 246.
     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: 1a5a. 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(): 1a86. and *note
     shutil.copystat(): 134a. 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(): 1350. and *note
     signal.getsignal(): 1a87. no longer call ‘repr’ on callable
     handlers.  *note asyncio.run(): 2f5. and *note
     asyncio.Runner.run(): 19ad. 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: 205. instance rather than
     creating fake ‘Instruction’ 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(): 1450. cleanup on Windows.

   - gh-94692(59): *note shutil.rmtree(): 354. 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(): 1a88.  Patch
     by Barney Gale.

   - gh-74690(62): Speedup *note issubclass(): 9c8. checks against
     simple *note runtime-checkable protocols: 675. by around 6%.  Patch
     by Alex Waygood.

   - gh-74690(63): Speedup *note isinstance(): 2af. checks by roughly
     20% for *note runtime-checkable protocols: 675. that only have one
     callable member.  Speedup *note issubclass(): 9c8. checks for these
     protocols by roughly 10%.  Patch by Alex Waygood.

   - gh-112645(64): Remove deprecation error on passing ‘onerror’ to
     *note shutil.rmtree(): 354.

   - gh-112640(65): Add ‘kwdefaults’ parameter to *note
     types.FunctionType: a87. to set default keyword argument values.

   - gh-112622(66): Ensure ‘name’ parameter is passed to event loop in
     *note asyncio.create_task(): 1cb.

   - gh-112618(67): Fix a caching bug relating to *note
     typing.Annotated: b3b.  ‘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(): c28.
     with specific value (UINT_MAX). Fix an integer overflow in
     ‘socket.if_indextoname()’ on 64-bit non-Windows platforms.

   - gh-112578(71): Fix a spurious *note RuntimeWarning: 4d7. when
     executing the *note zipfile: 138. module.

   - gh-112516(72): Update the bundled copy of pip to version 23.3.1.

   - gh-112510(73): Add *note readline.backend: 1a89. 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: 330.  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(): 1c3. on a module that had been imported using a custom
     *note loader: 1a8a. could fail with *note AttributeError: 5f0.
     Patch by Alex Waygood.

   - gh-112358(79): Revert change to *note struct.Struct: 17ce.
     initialization that broke some cases of subclassing.

   - gh-112405(80): Optimize *note pathlib.PurePath.relative_to(): 2ff.
     Patch by Alex Waygood.

   - gh-94722(81): Fix bug where comparison between instances of *note
     DocTest: 1a8b. 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(): 9c8. 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(): 1a8c.
     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: 32f. class,
     ensure *note __set_name__(): e4c. 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: 215.

   - gh-111049(101): Fix crash during garbage collection of the *note
     io.BytesIO: 10a8. 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(): 1a8d. now cleans docstrings
     with *note inspect.cleandoc(): 1a8e. before writing them.  Patch by
     Filip Łapkiewicz.

   - gh-82300(106): Add ‘track’ parameter to *note
     multiprocessing.shared_memory.SharedMemory: 1a37. 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: 138. 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: a1a.

   - 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: 1a8f. 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:
     1450. 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: 2c2. 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(): 354. function now
     ignores errors when calling *note os.close(): d6f. when
     'ignore_errors' is ‘True’, and ‘os.close()’ no longer retried after
     error.

   - bpo-35928(124): *note io.TextIOWrapper: 9c2. now correctly handles
     the decoding buffer after ‘read()’ and ‘write()’.

   - bpo-26791(125): *note shutil.move(): c55. 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: c17.
     and *note pickle.Unpickler: 17e9. 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(): 16c7. and *note
     warnings.simplefilter(): 8d1. now raise appropriate exceptions
     instead of ‘AssertionError’.  Patch contributed by Rémi Lapeyre.

   - bpo-37260(130): Fixed a race condition in *note shutil.rmtree():
     354. 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: ドキュメント<22>,  Next: テスト<21>,  Prev: ライブラリ<66>,  Up: Python 3 13 0 alpha 3

1.24.28.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: テスト<21>,  Next: ビルド<24>,  Prev: ドキュメント<22>,  Up: Python 3 13 0 alpha 3

1.24.28.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: 138a. 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: ビルド<24>,  Next: Windows<21>,  Prev: テスト<21>,  Up: Python 3 13 0 alpha 3

1.24.28.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(): 19be, *note os.makedev(): 19c0,
     and *note os.minor(): 19bf. 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<21>,  Next: macOS<15>,  Prev: ビルド<24>,  Up: Python 3 13 0 alpha 3

1.24.28.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(): 26f. 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():
     33c.  Use *note PYTHONLEGACYWINDOWSFSENCODING: 33d. 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<15>,  Next: IDLE<12>,  Prev: Windows<21>,  Up: Python 3 13 0 alpha 3

1.24.28.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(): f9d. 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<12>,  Next: C API<23>,  Prev: macOS<15>,  Up: Python 3 13 0 alpha 3

1.24.28.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<23>,  Prev: IDLE<12>,  Up: Python 3 13 0 alpha 3

1.24.28.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(): 3bf.-like
     functions.

   - gh-111545(3): Add *note Py_HashPointer(): 423. 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.29 Python 3.13.0 alpha 2
-----------------------------

'Release date: 2023-11-22'

* Menu:

* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<67>.
* テスト: テスト<22>.
* ビルド: ビルド<25>.
* Windows: Windows<22>.
* macOS: macOS<16>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<24>.


File: python.info,  Node: Core and Builtins<62>,  Next: ライブラリ<67>,  Up: Python 3 13 0 alpha 2

1.24.29.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(): 1a99,
     *note BaseExceptionGroup.subgroup(): 1a9a, and *note
     BaseExceptionGroup.split(): 193a. 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: 18f. 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: 1af.
     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: 170. 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: 1ac. block is rejected when the global is used in
     the *note else: 17d. 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: 1772. exceptions using the *note traceback: 105.
     module.  Patch by Pablo Galindo

   - gh-109894(35): Fixed crash due to improperly initialized static
     *note MemoryError: 1772. 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 ‘classmethod’, 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: ライブラリ<67>,  Next: テスト<22>,  Prev: Core and Builtins<62>,  Up: Python 3 13 0 alpha 2

1.24.29.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(): 1a9c.

   - gh-109538(3): Issue warning message instead of having *note
     RuntimeError: 246. be displayed when event loop has already been
     closed at ‘StreamWriter.__del__()’.

   - gh-111942(4): Fix crashes in *note io.TextIOWrapper.reconfigure():
     d44. when pass invalid arguments, e.g.  non-string encoding.

   - gh-111460(5): *note curses: 2f.: restore wide character support
     (including *note curses.unget_wch(): 12ae. and *note get_wch():
     12ad.) on macOS, which was unavailable due to a regression in
     Python 3.12.

   - gh-103791(6): *note contextlib.suppress: 112d. 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(): 25d. and *note os.unsetenv(): 25e.
     on Windows.

   - gh-111768(10): *note wsgiref.util.is_hop_by_hop(): 1a9d. is now
     exposed correctly in ‘__all__’.

   - gh-80731(11): Avoid executing the default function in *note
     cmd.Cmd: 18b3. in an except block

   - gh-111541(12): Fix *note doctest: 3e. for *note SyntaxError: 18f.
     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():
     137a. and *note time.clock_gettime_ns(): cdf. 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(): d13. 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(): 1a9e, *note
     io.DEFAULT_BUFFER_SIZE: 1a9f, and *note
     io.IncrementalNewlineDecoder: 17d3. 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(): 2ff.
     and *note is_relative_to(): 300.

   - 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(): a52, which allows to format
     *note ExceptionGroup: 4d2. instances.

   - gh-79033(24): Another attempt at fixing *note
     asyncio.Server.wait_closed(): 1aa0.  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(): 140e.
     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: 1aa1.  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(): 1049.  Patch by Junya Okabe.

   - gh-84583(38): Make *note pdb: aa. enter post-mortem mode even for
     *note SyntaxError: 18f.

   - gh-80675(39): Set ‘f_trace_lines = True’ on all frames upon *note
     pdb.set_trace(): 274.

   - 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: 2f7.
     loop_factory kwarg in *note unittest.IsolatedAsyncioTestCase: 35f.

   - gh-110392(42): Fix *note tty.setraw(): 1aa2. and *note
     tty.setcbreak(): 1a55.: previously they returned partially modified
     list of the original tty attributes.  *note tty.cfmakeraw(): 1aa3.
     and *note tty.cfmakecbreak(): 1a56. 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(): 1aa4. 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: 28b.

   - 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: 8c2. 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(): 1aa5,
     *note mailbox.Maildir.set_info(): 1aa6, *note
     mailbox.Maildir.get_flags(): 1aa7, *note
     mailbox.Maildir.set_flags(): 1aa8, *note
     mailbox.Maildir.add_flag(): 1aa9, *note
     mailbox.Maildir.remove_flag(): 1aaa.  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(): 18f3. to prevent ‘exit()’ and ‘quit’ from closing
     ‘sys.stdin’ and raise ‘SystemExit’.

   - gh-97928(58): Change the behavior of *note tkinter.Text.count():
     1a51.  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: テスト<22>,  Next: ビルド<25>,  Prev: ライブラリ<67>,  Up: Python 3 13 0 alpha 2

1.24.29.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: ビルド<25>,  Next: Windows<22>,  Prev: テスト<22>,  Up: Python 3 13 0 alpha 2

1.24.29.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<22>,  Next: macOS<16>,  Prev: ビルド<25>,  Up: Python 3 13 0 alpha 2

1.24.29.5 Windows
.................

   - gh-111856(1): Fixes *note fstat(): f90. on file systems that do not
     support file ID requests.  This includes FAT32 and exFAT.

   - gh-111293(2): Fix *note os.DirEntry.inode: 1aae. 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<16>,  Next: IDLE<13>,  Prev: Windows<22>,  Up: Python 3 13 0 alpha 2

1.24.29.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(): 1779. 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<13>,  Next: Tools/Demos<18>,  Prev: macOS<16>,  Up: Python 3 13 0 alpha 2

1.24.29.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<24>,  Prev: IDLE<13>,  Up: Python 3 13 0 alpha 2

1.24.29.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<24>,  Prev: Tools/Demos<18>,  Up: Python 3 13 0 alpha 2

1.24.29.9 C API
...............

   - gh-112026(1): Add again the private ‘_PyThreadState_UncheckedGet()’
     function as an alias to the new public *note
     PyThreadState_GetUnchecked(): 421. 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(): 420. 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(): aac. 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.30 Python 3.13.0 alpha 1
-----------------------------

'Release date: 2023-10-13'

* Menu:

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<63>.
* ライブラリ: ライブラリ<68>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<23>.
* ビルド: ビルド<26>.
* Windows: Windows<23>.
* macOS: macOS<17>.
* IDLE: IDLE<14>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<25>.


File: python.info,  Node: セキュリティ<26>,  Next: Core and Builtins<63>,  Up: Python 3 13 0 alpha 1

1.24.30.1 セキュリティ
......................

   - gh-108310(1): Fixed an issue where instances of *note
     ssl.SSLSocket: aeb. 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: 39c. 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<63>,  Next: ライブラリ<68>,  Prev: セキュリティ<26>,  Up: Python 3 13 0 alpha 1

1.24.30.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: 105. 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: 185, 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: 170. enabled.

   - gh-110514(8): Add ‘PY_THROW’ to *note sys.setprofile(): 171c.
     events

   - gh-110489(9): Optimise *note math.ceil(): 15dc. 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: 170. 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: 1ab6.

   - 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: 367.

   - 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: 18f.

   - 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: 370. 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: 170. 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: 91b.
     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(): 1c4. 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: 170. 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: 16f2.
     and *note METH_O: 1725. 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(): 1ab7. and
     *note ctypes.POINTER(): 1f3.

   - gh-105848(70): Modify the bytecode so that the actual callable for
     a *note CALL: 916. 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: 16a. objects by
     *note int: 19c. 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: 1ab8, *note
     ctypes.c_wchar_p: 1ab9. and *note ctypes.c_void_p: 1aba.

   - 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: 170.
     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(): 1c4.

   - gh-106917(94): Fix classmethod-style *note super(): 1a7. method
     calls (i.e., where the second argument to ‘super()’, 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: 170. 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: 1abb. 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(): 1abc.
     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: 1abd. node for it instead of an one-element
     ‘ast.JoinedStr’ with an empty string *note ast.Constant: 2f1.

   - 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: 886. 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(): e57. and *note
     sys.getfilesystemencodeerrors: ee6. 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: 1abe. is now a pseudo-op.

   - gh-105730(117): Allow any callable other than type objects as the
     condition predicate in *note BaseExceptionGroup.split(): 193a. and
     *note BaseExceptionGroup.subgroup(): 1a9a.

   - gh-105979(118): Fix crash in ‘_imp.get_frozen_object()’ due to
     improper exception handling.

   - gh-106003(119): Add a new *note TO_BOOL: 1abf. instruction, which
     performs boolean conversions for *note POP_JUMP_IF_TRUE: 1ac0,
     *note POP_JUMP_IF_FALSE: 1ac1, and *note UNARY_NOT: 1ac2. (which
     all expect exact *note bool: 3c1. values now).  Also, modify the
     oparg of *note COMPARE_OP: b65. to include an optional "boolean
     conversion" flag.

   - gh-98931(120): Ensure custom *note SyntaxError: 18f. 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: 1af. 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: 2ee. if the ‘delay’
     argument to *note asyncio.sleep(): c68. is a NaN (matching *note
     time.sleep(): 8ad.).

   - 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: 102. 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(): 1ac3. 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: 18f. 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: 102. module.  Patch
     by Pablo Galindo

   - gh-104635(142): Eliminate redundant *note STORE_FAST: 1ac4.
     instructions in the compiler.  Patch by Donghee Na and Carl Meyer.

   - gh-105324(143): Fix the main function of the *note tokenize: 102.
     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: a12. 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: 199. 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(): 1a7. calls on types with custom
     *note tp_getattro: 1ac5. 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(): 182e.  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: 102. 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: 102. module are
     always correct.  Patch by Pablo Galindo

   - gh-104955(162): Fix signature for the new *note
     __release_buffer__(): 1ac6. 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: 102. 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(): 1802.

   - gh-89091(167): Raise *note RuntimeWarning: 4d7. for unawaited async
     generator methods like *note asend(): ada, *note athrow(): 71d. and
     *note aclose(): ad9.  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__(): 19cb. or
     *note __reduce__(): bca. to ‘None’, pickling will result in a *note
     TypeError: 199.

   - 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: ライブラリ<68>,  Next: ドキュメント<23>,  Prev: Core and Builtins<63>,  Up: Python 3 13 0 alpha 1

1.24.30.3 ライブラリ
....................

   - gh-110786(1): *note sysconfig: e1.'s CLI now ignores *note
     BrokenPipeError: 126b, 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: 1ac8. for use with the
     *note asyncio.run(): 2f5. '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(): 1ac9.: 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:
     199. would be overwritten by *note OverflowError: a85. 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: 200.  It was not documented and only supported in
     the C implementation.

   - gh-110378(11): *note contextmanager(): 141f. and *note
     asynccontextmanager(): d23. 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(): 1aca. 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:
     119. within those modules.  Patch by Alex Waygood.

   - gh-110273(15): *note dataclasses.replace(): 1acb. 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(): 1c2.  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: f42. and get the process exit code.
     If the process is still running, raise again the ‘PermissionError’.
     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(): 29a. on Windows: ‘LIBRARY’,
     ‘LDLIBRARY’, ‘LIBDIR’, ‘SOABI’, and ‘Py_NOGIL’.

   - gh-109631(26): *note re: be. functions such as *note re.findall():
     122f, *note re.split(): 5a2, *note re.search(): 1448. 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(): 1410. 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: 246.  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(): c09.
     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
     ‘shutil.which()’ 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: 10b. 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(): 26f. and *note
     os.DirEntry.stat(): 1acc.: 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(): 19bc.
     and *note ssl.SSLSocket.get_unverified_chain(): 19bd. methods.

     Contributed by Mateusz Nowak.

   - gh-109559(41): Update *note unicodedata: 10c. database to Unicode
     15.1.0.

   - gh-109543(42): Remove unnecessary *note hasattr(): 6f9. check
     during *note typing.TypedDict: 330. 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: 327. 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: 1acd. object has been
     made copyable and pickleable.  Patched by Robert Lehmann and Furkan
     Onder.

   - gh-109187(51): *note pathlib.Path.resolve(): 1ace. now treats
     symlink loops like other errors: in strict mode, *note OSError:
     2c2. 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(): 1c2.

   - 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(): ae6. when
     unparsing f-strings containing many quote types.

   - gh-108469(60): *note ast.unparse(): ae6. now supports new *note
     f-string: 66b. syntax introduced in Python 3.12.  Note that the
     f-string quotes are reselected for simplicity under the new syntax.
     (Patch by Steven Sun)

   - gh-108751(61): Add *note copy.replace(): 1c2. 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: 199. 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(): 8ad. 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():
     1969. to check the given list of modules names.  Patch by Donghee
     Na.

   - gh-106242(82): Fixes *note os.path.normpath(): 1535. to handle
     embedded null characters without truncating the path.

   - gh-81555(83): *note xml.dom.minidom: 129. now only quotes ‘"’ in
     attributes.

   - gh-50002(84): *note xml.dom.minidom: 129. 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: 1511.

   - gh-107913(87): Fix possible losses of ‘errno’ and ‘winerror’ values
     in *note OSError: 2c2. exceptions if they were cleared or modified
     by the cleanup code before creating the exception object.

   - gh-107845(88): *note tarfile.data_filter(): 29c. 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: 108.

   - 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(): 1acf.

   - gh-107715(94): Fix *note doctest.DocTestFinder.find(): 1ad0. 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: 1ad1. 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(): 1410.

   - gh-107406(105): Implement new ‘__repr__()’ method for *note
     struct.Struct: 17ce.  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(): 270.
     did not raise *note OSError: 2c2. 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(): bec. search plural
     definitions when translation is not found.

   - gh-107089(110): Shelves opened with *note shelve.open(): 1ad2. 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(): d09. implementation.

   - gh-83006(112): Document behavior of *note shutil.disk_usage():
     1349. 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: 13b9. 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: 2ee. 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(): 182e. 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: e8e. and *note
     contextlib.AbstractAsyncContextManager: d24. 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: 118. activation, even when ‘VIRTUAL_ENV_DISABLE_PROMPT’
     is set.

   - gh-106530(136): Revert a change to *note colorsys.rgb_to_hls():
     1ad3. 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: 9cd, *note
     typing.ParamSpecKwargs: 9ce, 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 ‘functools.cached_property()’ 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():
     331.  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():
     e51. 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: 199. when *note issubclass(): 9c8. 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 ‘TypeError’ 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: 369. 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(): 1136. 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(): ae6. 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: 330. 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(): bd4. 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(): 1ad4. 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: 13b. 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: 32f.
     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: b3b. 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:
     10b. 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: 887. callback.

   - gh-105382(199): Remove 'cafile', 'capath' and 'cadefault'
     parameters of the *note urllib.request.urlopen(): 309. 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(): 1ad5. method,
     ‘logging.LoggerAdapter.warning()’ method and *note
     logging.warning(): 352. 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(): a52. 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(): 231.

   - gh-105144(209): Fix a recent regression in the *note typing: 10b.
     module.  The regression meant that doing ‘class Foo(X,
     typing.Protocol)’, where ‘X’ was a class that had *note
     abc.ABCMeta: 1120. as its metaclass, would then cause subsequent
     ‘isinstance(1, X)’ calls to erroneously raise *note TypeError: 199.
     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: 11a.: Deprecate the ‘getmark()’,
     ‘setmark()’ and ‘getmarkers()’ methods of the *note wave.Wave_read:
     334. and *note wave.Wave_write: 335. 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: 1ad6. 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: 1823.
     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__: 1709. to *note
     os.PathLike: e4f.

   - 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: 330.
     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
     ‘typing.Protocol’.  Patch by Jelle Zijlstra.

   - gh-104874(254): Document the ‘__name__’ and ‘__supertype__’
     attributes of *note typing.NewType: ef5.  Patch by Jelle Zijlstra.

   - gh-104835(255): Removed the following *note unittest: 10d.
     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: 11c. ‘MacOSX’ class, deprecated in Python 3.11.  Patch
     by Hugo van Kemenade.

   - gh-83863(257): Support for using *note pathlib.Path: 268. 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: 1ad7, *note
     ast.AsyncFunctionDef: 1ad8, and *note ast.FunctionDef: 1ad9. 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: 341.  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(): c58. 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: 205.

   - 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: 9f0. 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(): ad8. 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(): 32c.

   - 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: 2b5. and *note
     unittest.FunctionTestCase: 1ada. 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: 266. or *note NotADirectoryError: 1269.
     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: 1a4. for *note array:
     8.'s ‘'u'’ type code, deprecated in docs since Python 3.3.

   - gh-94924(293): *note unittest.mock.create_autospec(): 1994. now
     properly returns coroutine functions compatible with *note
     inspect.iscoroutinefunction(): 30f.

   - 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: 10b. 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(): 1038. using the PEP 590(299) ‘vectorcall’
     convention.  Patch by Anthony Lee and Pieter Eendebak.

   - bpo-44185(300): *note unittest.mock.mock_open(): 11ed. 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: be9. by caching the generated
     dispatch wrapper.  Optimization suggested by frederico.  Patch by
     @mental32, Alex Waygood and Pieter Eendebak.

   - bpo-41768(302): *note unittest.mock: 10e. 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: 10e.
     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: ドキュメント<23>,  Next: テスト<23>,  Prev: ライブラリ<68>,  Up: Python 3 13 0 alpha 1

1.24.30.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: ff0. and *note COLS: ff1.

   - 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(): be6. 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: 32f.

   - 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: 197.

   - 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: テスト<23>,  Next: ビルド<26>,  Prev: ドキュメント<23>,  Up: Python 3 13 0 alpha 1

1.24.30.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: 107.

   - 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():
     8ad. 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(): 148f.
     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(): 1add.

   - 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: ビルド<26>,  Next: Windows<23>,  Prev: テスト<23>,  Up: Python 3 13 0 alpha 1

1.24.30.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: 1adf. 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<23>,  Next: macOS<17>,  Prev: ビルド<26>,  Up: Python 3 13 0 alpha 1

1.24.30.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(): 264. 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(): 264. to behave consistently
     when passed a path containing an embedded null character on
     Windows.  In strict mode, it now raises *note OSError: 2c2. instead
     of the unexpected *note ValueError: 2ee, 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(): c54. 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(): 26f. 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(): 1a1f. 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<17>,  Next: IDLE<14>,  Prev: Windows<23>,  Up: Python 3 13 0 alpha 1

1.24.30.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<14>,  Next: Tools/Demos<19>,  Prev: macOS<17>,  Up: Python 3 13 0 alpha 1

1.24.30.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<25>,  Prev: IDLE<14>,  Up: Python 3 13 0 alpha 1

1.24.30.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<25>,  Prev: Tools/Demos<19>,  Up: Python 3 13 0 alpha 1

1.24.30.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: 199. 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(): 1ae5. now sets
     RuntimeError if it fails to get *note sys.path_hooks: 1229. 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(): 421.
     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(): 1ae6, *note
     PyErr_SetExcFromWindowsErrWithFilename(): 1ae7. and *note
     PyErr_SetFromWindowsErrWithFilename(): 1ae8. save now the error
     code before calling *note PyUnicode_DecodeFSDefault(): 1ae9.

   - 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: 1a4. for uses of
     *note PyType_Spec: 1aea. with metaclasses that have custom
     ‘tp_new’.

   - gh-107249(23): Implement the *note Py_UNUSED: 1aeb. 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(): 422.  It was kept for backward
     compatibility with Python 3.0 - 3.2.  The ‘PyUnicode_AsUTF8()’ is
     available since Python 3.3.  The *note PyUnicode_AsUTF8String():
     13aa. function can be used to keep compatibility with Python 3.2
     and older.  Patch by Victor Stinner.

   - gh-106572(26): Convert *note PyObject_DelAttr(): 1897. and *note
     PyObject_DelAttrString(): 1898. 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(): 41f. functions: similar to *note
     PyDict_GetItemWithError(): 5e1. but returning a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d5.  Patch
     by Victor Stinner.

   - gh-105927(36): Deprecate the *note PyWeakref_GetObject(): 3db. and
     *note PyWeakref_GET_OBJECT(): 3dc. functions: use the new *note
     PyWeakref_GetRef(): 3dd. function instead.  Patch by Victor
     Stinner.

   - gh-105927(37): Add *note PyWeakref_GetRef(): 3dd. function: similar
     to *note PyWeakref_GetObject(): 3db. 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: 3d5.  Patch
     by Victor Stinner.

   - gh-105227(39): The new *note PyType_GetDict(): 1aec. provides the
     dictionary for the given type object that is normally exposed by
     ‘cls.__dict__’.  Normally it's sufficient to use *note tp_dict:
     1aed, 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(): 1aee. 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():
     3d9. function which is just an alias to *note
     PyImport_ImportModule(): 3da. 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(): 3f2.

        * *note Py_GetExecPrefix(): 3e7.

        * *note Py_GetPath(): 3e1.

        * *note Py_GetPrefix(): 3e3.

        * *note Py_GetProgramFullPath(): 3ea.

        * *note Py_GetProgramName(): 3ec.

        * *note Py_GetPythonHome(): 3ed.

     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*: 1ad.

   - gh-104922(55): ‘PY_SSIZE_T_CLEAN’ is no longer required to use
     ‘'#'’ formats in APIs like *note PyArg_ParseTuple(): 3bf. and *note
     Py_BuildValue(): 3c0.  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(): 3c0. 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.31 Python 3.12.0 beta 1
----------------------------

'Release date: 2023-05-22'

* Menu:

* セキュリティ: セキュリティ<27>.
* ライブラリ: ライブラリ<69>.
* Core and Builtins: Core and Builtins<64>.
* ライブラリ: ライブラリ<70>.
* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<71>.
* ドキュメント: ドキュメント<24>.
* テスト: テスト<24>.
* ビルド: ビルド<27>.
* Windows: Windows<24>.
* macOS: macOS<18>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<26>.


File: python.info,  Node: セキュリティ<27>,  Next: ライブラリ<69>,  Up: Python 3 12 0 beta 1

1.24.31.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(): f3e. 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: ライブラリ<69>,  Next: Core and Builtins<64>,  Prev: セキュリティ<27>,  Up: Python 3 12 0 beta 1

1.24.31.2 ライブラリ
....................

   - gh-102856(1): Implement PEP 701 changes in the *note tokenize: 102.
     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<64>,  Next: ライブラリ<70>,  Prev: ライブラリ<69>,  Up: Python 3 12 0 beta 1

1.24.31.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: 24f. 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: e0b, *note False: d2f, and *note None: 886.) in the
     main interpreter loop.

   - gh-103899(22): Provide a helpful hint in the *note TypeError: 199.
     message when accidentally calling a *note module: 1a3d. object that
     has a callable attribute of the same name (such as *note dis.dis():
     207. 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: ライブラリ<70>,  Next: Core and Builtins<65>,  Prev: Core and Builtins<64>,  Up: Python 3 12 0 beta 1

1.24.31.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<65>,  Next: ライブラリ<71>,  Prev: ライブラリ<70>,  Up: Python 3 12 0 beta 1

1.24.31.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*: 1ad.

   - gh-103492(7): Clarify *note SyntaxWarning: 1af. 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: 246.  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(): 135f. 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: 909. entries
     for *note CALL: 916.

   - 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: 11f6.

   - gh-98003(26): Complex function calls are now faster and consume no
     C stack space.

   - bpo-39610(27): ‘len()’ for 0-dimensional *note memoryview: 166.
     objects (such as ‘memoryview(ctypes.c_uint8(42))’) now raises a
     *note TypeError: 199.  Previously this returned ‘1’, which was not
     consistent with ‘mem_0d[0]’ raising an *note IndexError: 1753.

   ---------- 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: ライブラリ<71>,  Next: ドキュメント<24>,  Prev: Core and Builtins<65>,  Up: Python 3 12 0 beta 1

1.24.31.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(): 1227. 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(): 9c8. check
     comparing a class ‘X’ against a *note runtime-checkable protocol:
     675. ‘Y’ with non-callable members would not cause *note TypeError:
     199. to be raised if an *note isinstance(): 2af. 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: 10b.

   - gh-102613(13): Fix issue where *note pathlib.Path.glob(): 537.
     raised *note RecursionError: f6c. when walking deep directory
     trees.

   - gh-103000(14): Improve performance of *note dataclasses.asdict():
     1af6. 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(): 1a9c. 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: 2c2. 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: f42.  This method now suppresses all *note
     OSError: 2c2. 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: 1af7. 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: 1a04.
     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(): 1af8. to the *note
     turtle: 108. 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(): 17c4. for files to be
     executed instead of raw *note open(): 318.

   - gh-68968(40): Fixed garbled output of *note assertEqual(): 74c.
     when an input lacks final newline.

   - gh-100370(41): Fix potential *note OverflowError: a85. in *note
     sqlite3.Connection.blobopen(): 892. 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(): f3e. 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(): 34f.
     and *note datetime.datetime.utcfromtimestamp(): 350.  (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: 112d. 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(): be4.
     in the implementation of *note datetime.datetime.strptime(): 19b0,
     which should now accept only valid ISO dates.  (Patch by Paul
     Ganssle)

   - gh-103685(54): Prepare *note tkinter.Menu.index(): 1af9. 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: 1afa. 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(): 17c4.  The new method
     would also call into the hook set by *note
     PyFile_SetOpenCodeHook(): 1afb.

   - 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(): 1a88. and *note cwd(): 1afc. by joining
     paths only when necessary.  Also improve performance of *note
     pathlib.PurePath.is_absolute(): 1afd. 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: 268.

   - 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: d39. by closing the proxy /
     tunnel's CONNECT response explicitly.

   - gh-103462(75): Fixed an issue with using *note writelines(): 1834.
     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(): fab. 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: 16b5.
     ‘defaults’ parameter to *note logging.config.dictConfig(): 13cc.
     and *note logging.config.fileConfig(): d4c.  Patch by Bar Harel.

   - gh-103092(80): Adapt the *note winreg: 11d. extension module to PEP
     687(81).

   - gh-74690(82): The performance of *note isinstance(): 2af. 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: 10b. 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(): bcf.

   - 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: 11e. extension module to
     PEP 687(91).

   - gh-93910(92): Remove deprecation of enum ‘member.member’ access.

   - gh-102978(93): Fixes *note unittest.mock.patch(): 1096. 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: 1afe.  Subclasses may override this method
     to share information between path objects.

   - gh-103220(97): Fix issue where *note os.path.join(): 1a07. 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():
     1aff. and *note dataclasses.asdict(): 1af6. 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: 340.

   - gh-101362(111): Speed up *note pathlib.Path: 268. 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: 10d. 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(): 1aa3. and *note
     tty.cfmakecbreak(): 1a56. to *note tty: 107. and modernize, the
     behavior of *note tty.setraw(): 1aa2. and *note tty.setcbreak():
     1a55. 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: 1bf. now catches
     errors when writing messages, such as when *note sys.stderr: b37.
     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: d39.
     ‘.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 *note tkinter.Canvas.coords():
     1b00.  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: 138,
     ‘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: 11c. 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(): 1ad4. 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(): 1b01. 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: ドキュメント<24>,  Next: テスト<24>,  Prev: ライブラリ<71>,  Up: Python 3 12 0 beta 1

1.24.31.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: テスト<24>,  Next: ビルド<27>,  Prev: ドキュメント<24>,  Up: Python 3 12 0 beta 1

1.24.31.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: 13b.
     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*: 31d. 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: ビルド<27>,  Next: Windows<24>,  Prev: テスト<24>,  Up: Python 3 12 0 beta 1

1.24.31.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<24>,  Next: macOS<18>,  Prev: ビルド<27>,  Up: Python 3 12 0 beta 1

1.24.31.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(): 134a. 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: 199. 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<18>,  Next: IDLE<15>,  Prev: Windows<24>,  Up: Python 3 12 0 beta 1

1.24.31.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<15>,  Next: Tools/Demos<20>,  Prev: macOS<18>,  Up: Python 3 12 0 beta 1

1.24.31.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<26>,  Prev: IDLE<15>,  Up: Python 3 12 0 beta 1

1.24.31.13 Tools/Demos
......................

   - gh-104389(1): Argument Clinic C converters now accept the ‘unused’
     keyword, for wrapping a parameter with *note Py_UNUSED: 1aeb.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104389


File: python.info,  Node: C API<26>,  Prev: Tools/Demos<20>,  Up: Python 3 12 0 beta 1

1.24.31.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():
     1b0a. 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():
     1b0b, *note PyUnstable_PerfMapState_Init(): 1b0c. and *note
     PyUnstable_PerfMapState_Fini(): 1b0d.  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: 1b0e. 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: 1b0f. 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.32 Python 3.12.0 alpha 7
-----------------------------

'Release date: 2023-04-04'

* Menu:

* Core and Builtins: Core and Builtins<66>.
* ライブラリ: ライブラリ<72>.
* Core and Builtins: Core and Builtins<67>.
* ビルド: ビルド<28>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<73>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<25>.
* ビルド: ビルド<29>.
* Windows: Windows<25>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<27>.


File: python.info,  Node: Core and Builtins<66>,  Next: ライブラリ<72>,  Up: Python 3 12 0 alpha 7

1.24.32.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: 909. 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: b65.

   - gh-102701(7): Fix overflow when creating very large dict.

   - gh-102755(8): Add *note PyErr_DisplayException(): 433. 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: 909. entries
     used by *note LOAD_GLOBAL: 1abb.

   ---------- 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: ライブラリ<72>,  Next: Core and Builtins<67>,  Prev: Core and Builtins<66>,  Up: Python 3 12 0 alpha 7

1.24.32.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<67>,  Next: ビルド<28>,  Prev: ライブラリ<72>,  Up: Python 3 12 0 alpha 7

1.24.32.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: ビルド<28>,  Next: Core and Builtins<68>,  Prev: Core and Builtins<67>,  Up: Python 3 12 0 alpha 7

1.24.32.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<68>,  Next: ライブラリ<73>,  Prev: ビルド<28>,  Up: Python 3 12 0 alpha 7

1.24.32.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: ライブラリ<73>,  Next: ドキュメント<25>,  Prev: Core and Builtins<68>,  Up: Python 3 12 0 alpha 7

1.24.32.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(): 866. will not
     warn deprecation.

   - gh-103068(4): It's no longer possible to register conditional
     breakpoints in *note Pdb: 275. that raise *note SyntaxError: 18f.
     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(): 2af. 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: 275. that raise *note SyntaxError: 18f.
     Patch by Tian Gao.

   - gh-102947(10): Improve traceback when *note dataclasses.fields():
     1995. is called on a non-dataclass.  Patch by Alex Waygood

   - gh-102780(11): The *note asyncio.Timeout: 1aa1. 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: 1b17. in such cases.

   - gh-102871(12): Remove support for obsolete browsers from *note
     webbrowser: 11c.  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(): 16de.
     arguments handling by removing the argument clinic.

   - gh-102828(14): Add the ‘onexc’ arg to *note shutil.rmtree(): 354,
     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: 268. 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(): bd3. 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(): 18c1. 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(): 10f2.
     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: 1450.

   - gh-48330(36): Added ‘--durations’ command line option, showing the
     N slowest test cases.  *note unittest.TextTestRunner: 1b18. 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(): 1b19. method and *note
     unittest.TestResult.collectedDurations: 1add. attribute.

     (Contributed by Giampaolo Rodola)

   - gh-98169(37): Fix *note dataclasses.astuple(): 1aff. crash when
     *note collections.defaultdict: 13d8. is present in the attributes.

   - gh-96931(38): Fix incorrect results from *note
     ssl.SSLSocket.shared_ciphers(): 1070.

   - 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: 1b1a, matching the behavior in previous versions of
     OpenSSL. The *note options: a3d. attribute on *note SSLContext:
     355. also no longer includes *note OP_IGNORE_UNEXPECTED_EOF: a3c.
     by default.  This option may be set to specify the previous OpenSSL
     3.0 behavior.

   - gh-94684(40): Now *note uuid.uuid3(): 2e7. and *note uuid.uuid5():
     2e8. functions support *note bytes: 193. 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(): 2f9.

   - 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: ドキュメント<25>,  Next: テスト<25>,  Prev: ライブラリ<73>,  Up: Python 3 12 0 alpha 7

1.24.32.7 ドキュメント
......................

   - gh-103112(1): Add docstring to *note
     http.client.HTTPResponse.read(): 1911. to fix ‘pydoc’ output.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103112


File: python.info,  Node: テスト<25>,  Next: ビルド<29>,  Prev: ドキュメント<25>,  Up: Python 3 12 0 alpha 7

1.24.32.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: ビルド<29>,  Next: Windows<25>,  Prev: テスト<25>,  Up: Python 3 12 0 alpha 7

1.24.32.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<25>,  Next: Tools/Demos<21>,  Prev: ビルド<29>,  Up: Python 3 12 0 alpha 7

1.24.32.10 Windows
..................

   - gh-102690(1): Update *note webbrowser: 11c. 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<27>,  Prev: Windows<25>,  Up: Python 3 12 0 alpha 7

1.24.32.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<27>,  Prev: Tools/Demos<21>,  Up: Python 3 12 0 alpha 7

1.24.32.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.33 Python 3.12.0 alpha 6
-----------------------------

'Release date: 2023-03-07'

* Menu:

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


File: python.info,  Node: セキュリティ<28>,  Next: Core and Builtins<69>,  Up: Python 3 12 0 alpha 6

1.24.33.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<69>,  Next: ライブラリ<74>,  Prev: セキュリティ<28>,  Up: Python 3 12 0 alpha 6

1.24.33.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: 1b24.
     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: 17c7. no longer raises
     *note OverflowError: a85. for *note int: 19c. '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: 1b25. ‘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: 106. 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: ライブラリ<74>,  Next: ドキュメント<26>,  Prev: Core and Builtins<69>,  Up: Python 3 12 0 alpha 6

1.24.33.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(): 1b27. now has boolean
     default arguments.

   - gh-81652(4): Add *note mmap.MAP_ALIGNED_SUPER: 1b28. FreeBSD and
     *note mmap.MAP_CONCEAL: 1b29. OpenBSD constants to *note mmap: 94.
     Patch by Yeojin Kim.

   - gh-102179(5): Fix *note os.dup2(): d5e. 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:
     10a8. if *note HTTPError: 11e4. 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: df9.

   - 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: 215. for small
     components.  The private argument ‘_normalize’ of the
     ‘fractions.Fraction’ constructor has been removed.

   - gh-101693(19): In *note sqlite3.Cursor.execute(): 5b0, *note
     DeprecationWarning: 1a4. 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: 184.  Starting
     from Python 3.14, using named placeholders with parameters supplied
     as a sequence will raise a *note ProgrammingError: 307.  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:
     268. argument is supplied, we use its string representation rather
     than joining its parts with *note os.path.join(): 1a07.

   - gh-101362(22): Speed up *note pathlib.PurePath: 6cd. construction
     by calling *note os.path.join(): 1a07. only when two or more
     arguments are given.

   - gh-101362(23): Speed up *note pathlib.Path: 268. construction by
     running the path flavour compatibility check only when pathlib is
     imported.

   - gh-85984(24): Refactored the implementation of *note pty.fork():
     1b2a. to use *note os.login_tty(): 1b2b.

     A *note DeprecationWarning: 1a4. 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(): 303.

   - 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(): 1a88.  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: 13b.  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: 17ae. and *note bz2.BZ2Decompressor: 178f.
     objects without calling ‘__init__()’, and fix leakage of locks and
     internal buffers when calling the ‘__init__()’ methods of
     ‘lzma.LZMADecompressor’, *note lzma.LZMACompressor: 1b2c, *note
     bz2.BZ2Compressor: 1b2d, and ‘bz2.BZ2Decompressor’ 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: ドキュメント<26>,  Next: テスト<26>,  Prev: ライブラリ<74>,  Up: Python 3 12 0 alpha 6

1.24.33.4 ドキュメント
......................

   - gh-85417(1): Update *note cmath: 19. documentation to clarify
     behaviour on branch cuts.

   - gh-97725(2): Fix *note asyncio.Task.print_stack(): 1b2f.
     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: テスト<26>,  Next: ビルド<30>,  Prev: ドキュメント<26>,  Up: Python 3 12 0 alpha 6

1.24.33.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: ビルド<30>,  Next: Windows<26>,  Prev: テスト<26>,  Up: Python 3 12 0 alpha 6

1.24.33.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: 1b32.  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<26>,  Next: macOS<19>,  Prev: ビルド<30>,  Up: Python 3 12 0 alpha 6

1.24.33.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<19>,  Next: C API<28>,  Prev: Windows<26>,  Up: Python 3 12 0 alpha 6

1.24.33.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<28>,  Prev: macOS<19>,  Up: Python 3 12 0 alpha 6

1.24.33.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(): 427. and *note
     PyErr_SetRaisedException(): 42a. 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(): 426. and *note PyErr_Restore():
     429.  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.34 Python 3.12.0 alpha 5
-----------------------------

'Release date: 2023-02-07'

* Menu:

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<70>.
* ライブラリ: ライブラリ<75>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<27>.
* ビルド: ビルド<31>.
* Windows: Windows<27>.


File: python.info,  Node: セキュリティ<29>,  Next: Core and Builtins<70>,  Up: Python 3 12 0 alpha 5

1.24.34.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<70>,  Next: ライブラリ<75>,  Prev: セキュリティ<29>,  Up: Python 3 12 0 alpha 5

1.24.34.2 Core and Builtins
...........................

   - gh-92173(1): Fix the ‘defs’ and ‘kwdefs’ arguments to *note
     PyEval_EvalCodeEx(): 1b39. 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: 181. or *note break: 180. which are not in a loop.  Patch
     by Donghee Na.

   - gh-101372(4): Fix *note is_normalized(): c40. to properly handle
     the UCD 3.2.0 cases.  Patch by Donghee Na.

   - gh-101266(5): Fix *note sys.getsizeof(): 1b3a. reporting for *note
     int: 19c. 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: 1772.  Patch by Pablo Galindo

   - gh-101037(8): Fix potential memory underallocation issue for
     instances of *note int: 19c. 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: b65. instruction and embed the mask into the oparg.

   - gh-100892(13): Fix race while iterating over thread states in
     clearing *note threading.local: 18c4.  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: ライブラリ<75>,  Next: ドキュメント<27>,  Prev: Core and Builtins<70>,  Up: Python 3 12 0 alpha 5

1.24.34.3 ライブラリ
....................

   - bpo-32780(1): Inter-field padding is now inserted into the PEP3118
     format strings obtained from *note ctypes.Structure: 1e7. 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: 1b3c.
     in ‘asyncio.base_events.BaseEventLoop._add_callback’.

   - gh-101144(11): Make *note zipfile.Path.open(): 1968. and *note
     zipfile.Path.read_text(): 1b3d. 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: 199.

   - 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(): 8c1. 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(): 1737. 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: 1e7. with ‘from_param()’ results larger than a C
     pointer.

   - gh-67790(21): Add float-style formatting support for *note
     fractions.Fraction: 215. 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(): 1b3e.

   - gh-88597(24): *note uuid: 117. now has a command line interface.
     Try ‘python -m uuid -h’.

   - gh-60580(25): ‘ctypes.wintypes.BYTE’ definition changed from *note
     c_byte: 1b3f. to *note c_ubyte: 1b40. 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: 12c. module now
     emits *note DeprecationWarning: 1a4. when testing the truth value
     of an *note xml.etree.ElementTree.Element: 361.  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: 268. accepted
     and ignored keyword arguments.  Patch provided by Yurii Karabas.

   - gh-77772(30): *note ctypes.CDLL: be0, *note ctypes.OleDLL: 1b41,
     *note ctypes.WinDLL: 1b42, and *note ctypes.PyDLL: 1b43. 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: ドキュメント<27>,  Next: テスト<27>,  Prev: ライブラリ<75>,  Up: Python 3 12 0 alpha 5

1.24.34.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: テスト<27>,  Next: ビルド<31>,  Prev: ドキュメント<27>,  Up: Python 3 12 0 alpha 5

1.24.34.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: ビルド<31>,  Next: Windows<27>,  Prev: テスト<27>,  Up: Python 3 12 0 alpha 5

1.24.34.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<27>,  Prev: ビルド<31>,  Up: Python 3 12 0 alpha 5

1.24.34.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.35 Python 3.12.0 alpha 4
-----------------------------

'Release date: 2023-01-10'

* Menu:

* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<76>.
* Core and Builtins: Core and Builtins<72>.
* ライブラリ: ライブラリ<77>.
* Core and Builtins: Core and Builtins<73>.
* ライブラリ: ライブラリ<78>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<28>.
* ビルド: ビルド<32>.
* Windows: Windows<28>.
* macOS: macOS<20>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<29>.


File: python.info,  Node: Core and Builtins<71>,  Next: ライブラリ<76>,  Up: Python 3 12 0 alpha 4

1.24.35.1 Core and Builtins
...........................

   - gh-100776(1): Fix misleading default value in *note input():
     14f4.'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 ‘CALL_INTRINSIC_1’ 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: 18f. 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(): 1b4a. to improve duck
     type compatibility between *note int: 19c. and *note float: 197.

   - 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: ライブラリ<76>,  Next: Core and Builtins<72>,  Prev: Core and Builtins<71>,  Up: Python 3 12 0 alpha 4

1.24.35.2 ライブラリ
....................

   - gh-100374(1): Fix incorrect result and delay in *note
     socket.getfqdn(): 1b4c.  Patch by Dominic Socular.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100374


File: python.info,  Node: Core and Builtins<72>,  Next: ライブラリ<77>,  Prev: ライブラリ<76>,  Up: Python 3 12 0 alpha 4

1.24.35.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():
     34e. by emitting only one entry for each line range.

   - gh-90043(3): Handle NaNs when specializing *note COMPARE_OP: b65.
     for *note float: 197. 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(): 1b4e.

   - 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: 139. 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: ライブラリ<77>,  Next: Core and Builtins<73>,  Prev: Core and Builtins<72>,  Up: Python 3 12 0 alpha 4

1.24.35.4 ライブラリ
....................

   - gh-89051(1): Add *note ssl.OP_LEGACY_SERVER_CONNECT: 1b50.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89051


File: python.info,  Node: Core and Builtins<73>,  Next: ライブラリ<78>,  Prev: ライブラリ<77>,  Up: Python 3 12 0 alpha 4

1.24.35.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: ライブラリ<78>,  Next: ドキュメント<28>,  Prev: Core and Builtins<73>,  Up: Python 3 12 0 alpha 4

1.24.35.6 ライブラリ
....................

   - gh-100833(1): Speed up *note math.fsum(): 15f2. by removing
     defensive ‘volatile’ qualifiers.

   - gh-100805(2): Modify *note random.choice(): 144c. 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__():
     1b53. twice as fast.

   - gh-91851(5): Microoptimizations for *note
     fractions.Fraction.__round__(): 1b54, *note
     fractions.Fraction.__ceil__(): 1b55. and *note
     fractions.Fraction.__floor__(): 1b56.

   - 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(): 2af. 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(): d12. 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(): 1a88. by nearly 2x.  This comes at the
     cost of a performance regression in *note pathlib.Path.cwd(): 1afc,
     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():
     d9e. with *note unittest.mock.AsyncMock: c42.

   - gh-100488(19): Add ‘Fraction.is_integer()’ to check whether a *note
     fractions.Fraction: 215. is an integer.  This improves duck type
     compatibility with *note float: 197. and *note int: 19c.

   - 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(): d05. 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: 1a4. 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: 141b.

   - 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(): 1776. 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: 11e4. 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: f6c. would occur on deep directory structures by
     adjusting the implementation of ‘os.walk()’ to be iterative instead
     of recursive.

   - gh-94943(37): Add *note データクラスのサポート: 1b57. to the *note
     Enum: 842. *note __repr__(): 1b58.  When inheriting from a *note
     dataclass: 4e1, only show the field names in the value section of
     the member *note repr(): 1c3, and not the dataclass' class name.

   - gh-83035(38): Fix *note inspect.getsource(): 182e. 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():
     231.'s handling of ‘__text_signature’.  - Fixes a case where
     ‘inspect.signature()’ dropped parameters - Fixes a case where
     ‘inspect.signature()’ raised *note tokenize.TokenError: 764. -
     Allows ‘inspect.signature()’ to understand defaults involving
     binary operations of constants - ‘inspect.signature()’ is
     documented as only raising *note TypeError: 199. or *note
     ValueError: 2ee, but sometimes raised *note RuntimeError: 246.
     These cases now raise ‘ValueError’ - 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(): 1b59. and *note
     urllib.parse.unquote_to_bytes(): 1b5a. 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():
     d23, which caused it to propagate exceptions with incorrect
     tracebacks and fix a 3.11 regression in *note contextmanager():
     141f, which caused it to propagate exceptions with incorrect
     tracebacks for *note StopIteration: df9.

   - gh-78707(51): Deprecate passing more than one positional argument
     to *note pathlib.PurePath.relative_to(): 2ff. and *note
     is_relative_to(): 300.

   - gh-92122(52): Fix reStructuredText syntax errors in docstrings in
     the *note enum: 5a. module.

   - gh-91851(53): Optimize the *note Fraction: 215. arithmetics for
     small components.

   - bpo-24132(54): Make *note pathlib.PurePath: 6cd. and *note Path:
     268. 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: e4f. (such as *note
     pathlib.Path: 268.) in the ‘stripdir’ arguments of *note
     compileall.compile_file(): fe5. and *note compileall.compile_dir():
     d1f.

   - bpo-36880(56): Fix a reference counting issue when a *note ctypes:
     2e. callback with return type *note py_object: 1f5. 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: ドキュメント<28>,  Next: テスト<28>,  Prev: ライブラリ<78>,  Up: Python 3 12 0 alpha 4

1.24.35.7 ドキュメント
......................

   - gh-100616(1): Document existing ‘attr’ parameter to *note
     curses.window.vline(): 1b5c. 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(): d1f. and *note compileall.compile_file():
     fe5. could be *note bytes: 193.

   - 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: テスト<28>,  Next: ビルド<32>,  Prev: ドキュメント<28>,  Up: Python 3 12 0 alpha 4

1.24.35.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: ビルド<32>,  Next: Windows<28>,  Prev: テスト<28>,  Up: Python 3 12 0 alpha 4

1.24.35.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<28>,  Next: macOS<20>,  Prev: ビルド<32>,  Up: Python 3 12 0 alpha 4

1.24.35.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():
     1b60. receives an immutable *note bytes: 193. object (as
     documented), instead of *note bytearray: 342.

   - bpo-43984(5): *note winreg.SetValueEx(): 1b61. 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: 2c2.

   ---------- 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<20>,  Next: Tools/Demos<22>,  Prev: Windows<28>,  Up: Python 3 12 0 alpha 4

1.24.35.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<29>,  Prev: macOS<20>,  Up: Python 3 12 0 alpha 4

1.24.35.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<29>,  Prev: Tools/Demos<22>,  Up: Python 3 12 0 alpha 4

1.24.35.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.36 Python 3.12.0 alpha 3
-----------------------------

'リリース日: 2022-12-06'

* Menu:

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<79>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<80>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<29>.
* ビルド: ビルド<33>.
* Windows: Windows<29>.
* macOS: macOS<21>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<30>.


File: python.info,  Node: セキュリティ<30>,  Next: Core and Builtins<74>,  Up: Python 3 12 0 alpha 3

1.24.36.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<74>,  Next: ライブラリ<79>,  Prev: セキュリティ<30>,  Up: Python 3 12 0 alpha 3

1.24.36.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: ライブラリ<79>,  Next: Core and Builtins<75>,  Prev: Core and Builtins<74>,  Up: Python 3 12 0 alpha 3

1.24.36.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<75>,  Next: ライブラリ<80>,  Prev: ライブラリ<79>,  Up: Python 3 12 0 alpha 3

1.24.36.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(): 984. 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: b41. object iterator.  It
     is now smaller, faster iteration of ranges containing large
     numbers.  Smaller pickles, faster unpickling.

   - bpo-31718(8): Raise *note ValueError: 2ee. instead of *note
     SystemError: 795. when methods of uninitialized *note
     io.IncrementalNewlineDecoder: 17d3. objects are called.  Patch by
     Oren Milman.

   - bpo-38031(9): Fix a possible assertion failure in *note io.FileIO:
     152b. 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: ライブラリ<80>,  Next: ドキュメント<29>,  Prev: Core and Builtins<75>,  Up: Python 3 12 0 alpha 3

1.24.36.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(): 1aa0. 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: 2b5.  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():
     2f5. to allow specifying a custom event loop factory.  Patch by
     Kumar Aditya.

   - gh-99341(11): Fix *note ast.increment_lineno(): 1b6b. to also cover
     *note ast.TypeIgnore: 1b6c. 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: 1753. 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(): 2ff. 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(): 2f4. and many other
     *note asyncio: b. functions like *note asyncio.ensure_future():
     e75, *note asyncio.shield(): c69. or *note asyncio.gather(): 813,
     and also the ‘get_event_loop()’ method of
     ‘asyncio.BaseDefaultEventLoopPolicy’ now raise a *note
     RuntimeError: 246. 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: 1a4. is no longer emitted if there is no
     running event loop but the current event loop was set.

   - gh-97966(23): On *note os.uname_result: 1b6d, restored expectation
     that ‘_fields’ and ‘_asdict’ would include all six properties
     including ‘processor’.

   - gh-98248(24): Provide informative error messages in *note
     struct.pack(): 1492. 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: 1a20. 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: 1b6e. 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(): d12. 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(): e93. 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: ドキュメント<29>,  Next: テスト<29>,  Prev: ライブラリ<80>,  Up: Python 3 12 0 alpha 3

1.24.36.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: 3c1.

   - 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*: f9c. family of functions, and improved the docs for *note
     os.waitid(): f9d. 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: テスト<29>,  Next: ビルド<33>,  Prev: ドキュメント<29>,  Up: Python 3 12 0 alpha 3

1.24.36.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: ビルド<33>,  Next: Windows<29>,  Prev: テスト<29>,  Up: Python 3 12 0 alpha 3

1.24.36.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<29>,  Next: macOS<21>,  Prev: ビルド<33>,  Up: Python 3 12 0 alpha 3

1.24.36.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: 1a37. 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<21>,  Next: Tools/Demos<23>,  Prev: Windows<29>,  Up: Python 3 12 0 alpha 3

1.24.36.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<30>,  Prev: macOS<21>,  Up: Python 3 12 0 alpha 3

1.24.36.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<30>,  Prev: Tools/Demos<23>,  Up: Python 3 12 0 alpha 3

1.24.36.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(): 1b76. 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.37 Python 3.12.0 alpha 2
-----------------------------

'Release date: 2022-11-14'

* Menu:

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<76>.
* ビルド: ビルド<34>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<81>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<30>.
* ビルド: ビルド<35>.
* Windows: Windows<30>.
* macOS: macOS<22>.
* C API: C API<31>.


File: python.info,  Node: セキュリティ<31>,  Next: Core and Builtins<76>,  Up: Python 3 12 0 alpha 2

1.24.37.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: 10f. 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<76>,  Next: ビルド<34>,  Prev: セキュリティ<31>,  Up: Python 3 12 0 alpha 2

1.24.37.2 Core and Builtins
...........................

   - gh-81057(1): The docs clearly say that *note PyImport_Inittab:
     1b7a, *note PyImport_AppendInittab(): 1b7b, and *note
     PyImport_ExtendInittab(): 1b7c. should not be used after *note
     Py_Initialize(): 45e. has been called.  We now enforce this for the
     two functions.  Additionally, the runtime now uses an internal copy
     of ‘PyImport_Inittab’, 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: 994.
     and *note PyInterpreterState: abe. 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*: 1ad. 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: 18f. for a *note
     try: 8f9. block with both *note except: 1ac. and *note except*:
     1ad.

   - 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: 1b7d.  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:
     450. exceptions for instances.  Now if a ‘NameError’ 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: 1af, instead of *note DeprecationWarning: 1a4.  In a
     future Python version they will be eventually a *note SyntaxError:
     18f.  Patch by Victor Stinner.

   - gh-98401(14): A backslash-character pair that is not a valid escape
     sequence now generates a *note SyntaxWarning: 1af, instead of *note
     DeprecationWarning: 1a4.  For example, ‘re.compile("\d+\.\d+")’ now
     emits a ‘SyntaxWarning’ (‘"\d"’ is an invalid escape sequence), use
     raw strings for regular expression: ‘re.compile(r"\d+\.\d+")’.  In
     a future Python version, *note SyntaxError: 18f. will eventually be
     raised, instead of ‘SyntaxWarning’.  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: 18f. 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: 1b24. for
     generators.  Saves multiple layers of dispatch and checking to get
     from the ‘FOR_ITER’ instruction in the caller to the *note RESUME:
     5bb. in the generator.

   - gh-98762(22): Fix source locations of *note match: a12.
     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__: 1709.) could behave incorrectly or crash
     instead of raising a *note TypeError: 199. 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:
     886. to any fast locals that are left unbound after jumps or *note
     del: 1b7e. statements executed while tracing.

   - gh-96421(27): When calling into Python code from C code, through
     *note PyEval_EvalFrameEx(): 1233. 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: 1b7f, *note YIELD_VALUE: 5ba, and *note
     RETURN_GENERATOR: 90c, 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: ビルド<34>,  Next: Core and Builtins<77>,  Prev: Core and Builtins<76>,  Up: Python 3 12 0 alpha 2

1.24.37.3 ビルド
................

   - gh-98415(1): Fix detection of MAC addresses for *note uuid: 117. on
     certain OSs.  Patch by Chaim Sanders

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98415


File: python.info,  Node: Core and Builtins<77>,  Next: ライブラリ<81>,  Prev: ビルド<34>,  Up: Python 3 12 0 alpha 2

1.24.37.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: 1b24. 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: 1b82. and some of the *note
     ETHERTYPE_* constants: 1b83. 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: ライブラリ<81>,  Next: ドキュメント<30>,  Prev: Core and Builtins<77>,  Up: Python 3 12 0 alpha 2

1.24.37.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(): 360. 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():
     1b85.

   - gh-74044(5): Fixed bug where *note inspect.signature(): 231.
     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: c31. 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(): bf9. 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: 105. 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: 1b86. 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: 105. 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: 1b87. without
     the "else" branch.

   - gh-98703(25): Fix *note asyncio.StreamWriter.drain(): 1b88. 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: 1a2.

   - gh-98284(28): Improved *note TypeError: 199. message for undefined
     abstract methods of a *note abc.ABC: 111f. 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 ‘imaplib’) 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(): 175. to incorrectly return *note None:
     886. in multi-threaded programs.

   - gh-91803(39): Fix an error when using a method of objects mocked
     with *note unittest.mock.create_autospec(): 1994. after it was
     sealed with *note unittest.mock.seal(): d9e. function.

   - bpo-38523(40): *note shutil.copytree(): c22. now applies the
     'ignore_dangling_symlinks' argument recursively.

   - bpo-40358(41): Add walk_up argument in *note
     pathlib.PurePath.relative_to(): 2ff.

   - bpo-36267(42): Fix IndexError in *note argparse.ArgumentParser:
     1bf. 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: ドキュメント<30>,  Next: テスト<30>,  Prev: ライブラリ<81>,  Up: Python 3 12 0 alpha 2

1.24.37.6 ドキュメント
......................

   - gh-98832(1): Changes wording of docstring for *note
     pathlib.Path.iterdir(): 270.

   - 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: テスト<30>,  Next: ビルド<35>,  Prev: ドキュメント<30>,  Up: Python 3 12 0 alpha 2

1.24.37.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: 10b. 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: ビルド<35>,  Next: Windows<30>,  Prev: テスト<30>,  Up: Python 3 12 0 alpha 2

1.24.37.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: 1b8c. 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<30>,  Next: macOS<22>,  Prev: ビルド<35>,  Up: Python 3 12 0 alpha 2

1.24.37.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<22>,  Next: C API<31>,  Prev: Windows<30>,  Up: Python 3 12 0 alpha 2

1.24.37.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<31>,  Prev: macOS<22>,  Up: Python 3 12 0 alpha 2

1.24.37.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(): 1b90.

   - 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.38 Python 3.12.0 alpha 1
-----------------------------

'Release date: 2022-10-25'

* Menu:

* セキュリティ: セキュリティ<32>.
* 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>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<85>.
* ライブラリ: ライブラリ<89>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<91>.
* ドキュメント: ドキュメント<31>.
* テスト: テスト<31>.
* ビルド: ビルド<36>.
* Windows: Windows<31>.
* macOS: macOS<23>.
* IDLE: IDLE<16>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<32>.


File: python.info,  Node: セキュリティ<32>,  Next: Core and Builtins<78>,  Up: Python 3 12 0 alpha 1

1.24.38.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: 1d7. 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<78>,  Next: ライブラリ<82>,  Prev: セキュリティ<32>,  Up: Python 3 12 0 alpha 1

1.24.38.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: 450. 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: ライブラリ<82>,  Next: Core and Builtins<79>,  Prev: Core and Builtins<78>,  Up: Python 3 12 0 alpha 1

1.24.38.3 ライブラリ
....................

   - gh-96078(1): *note os.sched_yield(): 132d. now release the GIL
     while calling sched_yield(2).  Patch by Donghee Na.

   - gh-97955(2): Migrate *note zoneinfo: 13b. 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<79>,  Next: ライブラリ<83>,  Prev: ライブラリ<82>,  Up: Python 3 12 0 alpha 1

1.24.38.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(): 1b96.
     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:
     1b97. to gather statistics on Python opcodes.  Patch by Victor
     Stinner.

   - gh-94526(13): Fix the Python path configuration used to initialized
     *note sys.path: 3e2. 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: 18f. when
     parsing source code containing null bytes.  Patch by Pablo Galindo

   - gh-96975(15): Fix a crash occurring when *note PyEval_GetFrame():
     1b98. 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: 170. option with no value (invalid) when the
     *note PYTHONINTMAXSTRDIGITS: 1b99. 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: ライブラリ<83>,  Next: Core and Builtins<80>,  Prev: Core and Builtins<79>,  Up: Python 3 12 0 alpha 1

1.24.38.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<80>,  Next: ライブラリ<84>,  Prev: ライブラリ<83>,  Up: Python 3 12 0 alpha 1

1.24.38.6 Core and Builtins
...........................

   - gh-96821(1): Fix undefined behaviour in ‘_testcapimodule.c’.

   - gh-95778(2): When *note ValueError: 2ee. is raised if an integer is
     larger than the limit, mention the *note
     sys.set_int_max_str_digits(): 1789. 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: 166. 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: ライブラリ<84>,  Next: Core and Builtins<81>,  Prev: Core and Builtins<80>,  Up: Python 3 12 0 alpha 1

1.24.38.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<81>,  Next: ライブラリ<85>,  Prev: ライブラリ<84>,  Up: Python 3 12 0 alpha 1

1.24.38.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__(): dcf.  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(): 984. 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: 1b9e. is now mapped to
     *note PermissionError: f42.  The *note errno: 5b. modules exposes
     the new error number.  ‘getpath.py’ now ignores ‘PermissionError’
     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: 8f9./*note except: 1ac.
     blocks to handle exceptions raised during *note close(): 1802. or
     *note throw(): 71c. calls through a suspended frame.

   - gh-95977(27): Optimized calling *note __get__(): 1706. 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(): 995.

   - 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: 197.

   - 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: 24f. from *note
     str.split(): 10ae. and *note str.rsplit(): 1471.  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(): 1723. 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: f6c. 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: 2ee. 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: 1b7d. 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: ライブラリ<85>,  Next: Core and Builtins<82>,  Prev: Core and Builtins<81>,  Up: Python 3 12 0 alpha 1

1.24.38.9 ライブラリ
....................

   - gh-95023(1): Implement *note os.setns(): 1ba0. and *note
     os.unshare(): 1ba1. for Linux.  Patch by Noam Cohen.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95023


File: python.info,  Node: Core and Builtins<82>,  Next: ライブラリ<86>,  Prev: ライブラリ<85>,  Up: Python 3 12 0 alpha 1

1.24.38.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: ライブラリ<86>,  Next: Core and Builtins<83>,  Prev: Core and Builtins<82>,  Up: Python 3 12 0 alpha 1

1.24.38.11 ライブラリ
.....................

   - gh-94996(1): *note ast.parse(): 1c4. 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<83>,  Next: ライブラリ<87>,  Prev: ライブラリ<86>,  Up: Python 3 12 0 alpha 1

1.24.38.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: ライブラリ<87>,  Next: Core and Builtins<84>,  Prev: Core and Builtins<83>,  Up: Python 3 12 0 alpha 1

1.24.38.13 ライブラリ
.....................

   - gh-94949(1): *note ast.parse(): 1c4. 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(): 1c4. 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<84>,  Next: ライブラリ<88>,  Prev: ライブラリ<87>,  Up: Python 3 12 0 alpha 1

1.24.38.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: 342. 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: 9f0. 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: ライブラリ<88>,  Next: Core and Builtins<85>,  Prev: Core and Builtins<84>,  Up: Python 3 12 0 alpha 1

1.24.38.15 ライブラリ
.....................

   - gh-93461(1): *note importlib.invalidate_caches(): e0e. 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<85>,  Next: ライブラリ<89>,  Prev: ライブラリ<88>,  Up: Python 3 12 0 alpha 1

1.24.38.16 Core and Builtins
............................

   - gh-93621(1): Change order of bytecode instructions emitted for
     *note with: 187. and *note async with: 186. 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(): 980.
     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: ライブラリ<89>,  Next: Core and Builtins<86>,  Prev: Core and Builtins<85>,  Up: Python 3 12 0 alpha 1

1.24.38.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<86>,  Next: ライブラリ<90>,  Prev: ライブラリ<89>,  Up: Python 3 12 0 alpha 1

1.24.38.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: ライブラリ<90>,  Next: Core and Builtins<87>,  Prev: Core and Builtins<86>,  Up: Python 3 12 0 alpha 1

1.24.38.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<87>,  Next: ライブラリ<91>,  Prev: ライブラリ<90>,  Up: Python 3 12 0 alpha 1

1.24.38.20 Core and Builtins
............................

   - gh-91432(1): Specialized the *note FOR_ITER: 1b24. 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: 24f.
     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: ライブラリ<91>,  Next: ドキュメント<31>,  Prev: Core and Builtins<87>,  Up: Python 3 12 0 alpha 1

1.24.38.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): *note tkinter.Text.count(): 1a51. 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: 342. and *note memoryview: 166. types:
     only the exact *note bytes: 193. 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(): 86c. method was added to *note
     SysLogHandler: 86d.

   - gh-96035(7): Fix bug in *note urllib.parse.urlparse(): 360. 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(): 171c. and *note
     sys.settrace(): 2e3. 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: 118. 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 ‘syslog.syslog()’ 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:
     10d. 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(): 11c8. is used with argument ‘input=None’
     and either of the arguments 'encoding' or 'errors' are used.

   - gh-97008(24): *note NameError: 450. and *note AttributeError: 5f0.
     spelling suggestions provided since gh-82711(25) are now also
     emitted by the pure Python *note traceback: 105. 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():
     a18. 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(): 1971. 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 *note
     tkinter.Checkbutton: 1a24.  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(): 1bae. called before the *note
     pipe_data_received(): 1baf. 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(): 1bb0.
     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: 10c. database to Unicode
     15.0.0.

   - gh-96735(42): Fix undefined behaviour in *note struct.unpack():
     18bf.

   - 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: 14da.'s
     to *note float: 197.

   - 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: 10b, 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:
     fa5.'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(): 1bb1. method to *note
     logging.Logger: d4a, 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: 129.

   - 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(): 1bb2. 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: 1bb3.

   - gh-95899(69): Fix *note asyncio.Runner: 2f7. to call *note
     asyncio.set_event_loop(): 1bb4. only once to avoid calling
     ‘attach_loop()’ multiple times on child watchers.  Patch by Kumar
     Aditya.

   - gh-95736(70): Fix *note unittest.IsolatedAsyncioTestCase: 35f. to
     set event loop before calling setup functions.  Patch by Kumar
     Aditya.

   - gh-95865(71): Speed up *note urllib.parse.quote_from_bytes(): 1bb0.
     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: b00. 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: 18f5. 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: 1bb5. or *note
     ENOSYS: 1bb6. 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(): 2f5. for *note asyncio.Task:
     1c9. 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:
     1bb7, *note os.EFD_NONBLOCK: 1bb8. and *note os.EFD_SEMAPHORE:
     1bb9. flags on older kernel versions where these flags are not
     present.  Patch by Kumar Aditya.

   - gh-95166(89): Fix *note concurrent.futures.Executor.map(): 1de. 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: 1aa1. 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():
     1c4, 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(): 1b88. to
     be awaited concurrently by multiple tasks.  Patch by Kumar Aditya.

   - gh-87822(106): When called with ‘capture_locals=True’, the *note
     traceback: 105. 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: 10b.  Previously an error message saying ‘Some
     type variables ... are not listed in Generic[...]’ was shown.
     ‘typing’ 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(): 2f5. and *note
     unittest.IsolatedAsyncioTestCase: 35f. 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: 17ce. 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(): 171c.
     and *note sys.settrace(): 2e3. now raise *note RuntimeError: 246.
     Patch by Pablo Galindo.

   - gh-92336(119): Fix bug where *note linecache.getline(): 242. fails
     on bad files with *note UnicodeDecodeError: c0c. or *note
     SyntaxError: 18f.  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: 139.: 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: c17. 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: 355. 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
     ‘pbkdf2_hmac()’ 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(): 318. instead.
     The ‘open()’ (*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: edd.
     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(): 30f, *note
     inspect.isgeneratorfunction(): 1bba, and *note
     inspect.isasyncgenfunction(): 1bbb. now properly return ‘True’ for
     duck-typed function-like objects like instances of *note
     unittest.mock.AsyncMock: c42.

     This makes *note inspect.iscoroutinefunction(): 30f. 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:
     11b. classes *note ReferenceType: 1bbc, *note ProxyType: 1bbd,
     *note CallableProxyType: 1bbe.  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():
     d69. 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: 1bbf. 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(): 130c. 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: 199.

   - gh-93297(176): Make asyncio task groups prevent child tasks from
     being GCed

   - gh-85308(177): Changed *note argparse.ArgumentParser: 1bf. 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: a25.
     sequence of an absolute path using negative index values produced
     incorrect results.

   - gh-93162(179): Add the ability for *note
     logging.config.dictConfig(): 13cc. to usefully configure *note
     QueueHandler: 1bc0. and *note QueueListener: 244. as a pair, and
     add *note logging.getHandlerByName(): 1bc1. and *note
     logging.getHandlerNames(): 1acf. 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: c6c. 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(): ae6. when
     ‘ImportFrom.level’ is ‘None’

   - gh-92932(193): Now *note dis(): 207. 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: 268. arguments in addition to *note str: 16a. paths.
     Patch by David Foster.

   - gh-87901(195): Removed the ‘encoding’ argument from *note
     os.popen(): 31c. 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: 1bc2. 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(): 1bc3. on
     WASI.

   - gh-89325(200): Removed many old deprecated *note unittest: 10d.
     features: *note TestCase: 2b5. method aliases, undocumented and
     broken ‘TestCase’ 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(): ae6. for empty tuples in
     the assignment target context.

   - gh-91581(203): *note utcfromtimestamp(): 350. 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: 1bc4.  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: 11ec. instance so that filters attached to *note
     logging.Handler: 16b4.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(): 1bc5.

   - 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: 268. deprecated method
     ‘link_to’ has been removed.  Use 3.10's *note hardlink_to(): a26.
     method instead as its semantics are consistent with that of *note
     symlink_to(): a27.

   - 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__(): 947. to *note
     csv.DictReader: bdc. and *note csv.DictWriter: 141b, 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: b4b. method *note write(): c90.
     and function *note tostring(): 11fb. 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(): df3. 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: 1d8. 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: 1bc6. 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: 8d4. now raises *note
     zipfile.BadZipFile: 1bc7. 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: 141b. and
     *note DictReader: bdc. now coerce the ‘fieldnames’ argument to a
     *note list: 24f. if it is an iterator.

   - bpo-35540(231): Fix *note dataclasses.asdict(): 1af6. crash when
     *note collections.defaultdict: 13d8. 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: 193. on *note
     sys.path: 3e2.

   - bpo-46951(234): Order the contents of zipapp archives, to make
     builds more reproducible.

   - bpo-42777(235): Implement *note pathlib.Path.is_mount(): c10. 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(): ad8. 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: 1832. to ‘None’
     when an object does not have *note __doc__: b25.

   - 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:
     10d.: methods *note enterContext(): 8c9. and *note
     enterClassContext(): 8ca. of class *note TestCase: 2b5, method
     *note enterAsyncContext(): 8cb. of class *note
     IsolatedAsyncioTestCase: 35f. and function *note
     unittest.enterModuleContext(): 8cc.

   - 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(): c36. 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__(): 13d9. when a value is not found.  This matches
     the behavior of *note dict: 184.  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(): ae8.  The default value
     is ‘None’, which means the executor will be given an unlimited
     amount of time.  When called from *note asyncio.Runner: 2f7. or
     *note asyncio.run(): 2f5, 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: 11a. module.

   - bpo-26253(254): Allow adjustable compression level for tarfile
     streams in *note tarfile.open(): 107b.

   ---------- 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: ドキュメント<31>,  Next: テスト<31>,  Prev: ライブラリ<91>,  Up: Python 3 12 0 alpha 1

1.24.38.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(): e16. 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: 1bc9. 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: 1bca.

   - 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)コンテキストマネージャの使い方: 1bcb.

   - 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: aca. and *note PYTHONWARNINGS:
     da7. are matched literally and case-insensitively, rather than as
     regular expressions, in *note warnings: 119.

   - 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(): bf1, *note
     inspect.getmodule(): 1bcc, and *note inspect.getsourcefile(): 1bcd.
     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 エラーハンドラ: 1bce.
     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: テスト<31>,  Next: ビルド<36>,  Prev: ドキュメント<31>,  Up: Python 3 12 0 alpha 1

1.24.38.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: 1bd0. ("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(): 1bd1.

   - 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(): 1bd2.
     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(): 1b3a. 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 ‘os.chmod()’.

   - 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: ビルド<36>,  Next: Windows<31>,  Prev: テスト<31>,  Up: Python 3 12 0 alpha 1

1.24.38.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: 10e.

   - 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(): 1531, *note getresgid():
     1530, 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(): e64. 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<31>,  Next: macOS<23>,  Prev: ビルド<36>,  Up: Python 3 12 0 alpha 1

1.24.38.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 ‘multiprocessing’ 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(): 167b. 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(): a43. *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: 138. 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(): 131e. 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():
     1bd5. 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<23>,  Next: IDLE<16>,  Prev: Windows<31>,  Up: Python 3 12 0 alpha 1

1.24.38.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(): f94. or *note os.mknod(): f95. 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<16>,  Next: Tools/Demos<24>,  Prev: macOS<23>,  Up: Python 3 12 0 alpha 1

1.24.38.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<32>,  Prev: IDLE<16>,  Up: Python 3 12 0 alpha 1

1.24.38.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<32>,  Prev: Tools/Demos<24>,  Up: Python 3 12 0 alpha 1

1.24.38.29 C API
................

   - gh-98393(1): The *note PyUnicode_FSDecoder(): 797. function no
     longer accepts bytes-like paths, like *note bytearray: 342. and
     *note memoryview: 166. types: only the exact *note bytes: 193. 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(): 1bda.

   - 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 ‘Py_TPFLAGS_HAVE_VECTORCALL’ flag.

   - gh-95388(12): Creating *note immutable types: 3cd. 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(): 981, *note
     PyCode_GetCellvars(): 982. and *note PyCode_GetFreevars(): 983. 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(): 98c.

        * *note PyFrame_GetBack(): 98d.

        * *note PyFrame_GetBuiltins(): 973.

        * *note PyFrame_GetGenerator(): 974.

        * *note PyFrame_GetGlobals(): 975.

        * *note PyFrame_GetLasti(): 976.

        * *note PyFrame_GetLocals(): 661.

        * *note PyFrame_Type: 98e.

     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: b82. 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: 408, in the documentation: the *note
     Py_InitializeFromConfig(): 3f4. API should be instead.  Patch by
     Victor Stinner.

   - gh-77782(26): Deprecate global configuration variable like *note
     Py_IgnoreEnvironmentFlag: 408.: the *note
     Py_InitializeFromConfig(): 3f4. 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.39 Python 3.11.0 beta 1
----------------------------

'Release date: 2022-05-06'

* Menu:

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<92>.
* Core and Builtins: Core and Builtins<89>.
* ビルド: ビルド<37>.
* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<93>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<32>.
* ビルド: ビルド<38>.
* Windows: Windows<32>.
* macOS: macOS<24>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<33>.


File: python.info,  Node: セキュリティ<33>,  Next: Core and Builtins<88>,  Up: Python 3 11 0 beta 1

1.24.39.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: 3e2.  Patch by Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/57684


File: python.info,  Node: Core and Builtins<88>,  Next: ライブラリ<92>,  Prev: セキュリティ<33>,  Up: Python 3 11 0 beta 1

1.24.39.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: 2a9. 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: 1a4.  In a future Python
     version they will be a *note SyntaxWarning: 1af. and eventually a
     *note SyntaxError: 18f.

   - 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(): 2af. and *note
     issubclass(): 9c8. checks for *note types.UnionType: 2a9.  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: 990. 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, ‘BaseException’ 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: 1ac0, *note
     POP_JUMP_IF_FALSE: 1ac1, *note POP_JUMP_IF_NONE: 1bde. and *note
     POP_JUMP_IF_NOT_NONE: 1bdf. 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: ライブラリ<92>,  Next: Core and Builtins<89>,  Prev: Core and Builtins<88>,  Up: Python 3 11 0 beta 1

1.24.39.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<89>,  Next: ビルド<37>,  Prev: ライブラリ<92>,  Up: Python 3 11 0 beta 1

1.24.39.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(): 1a5, 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: 17b6, ‘testcapi.RecursingInfinitelyError’, and
     *note types.GenericAlias: 9f0.

     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:
     1be2. constructor.  Patch by Oleg Iarygin.

   - bpo-46764(6): Fix wrapping bound methods with @classmethod

   - bpo-43464(7): Optimize *note set.intersection(): 1784. for non-set
     arguments.

   - bpo-46721(8): Optimize *note set.issuperset(): 1be3. 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: ビルド<37>,  Next: Core and Builtins<90>,  Prev: Core and Builtins<89>,  Up: Python 3 11 0 beta 1

1.24.39.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<90>,  Next: ライブラリ<93>,  Prev: ビルド<37>,  Up: Python 3 11 0 beta 1

1.24.39.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: ライブラリ<93>,  Next: ドキュメント<32>,  Prev: Core and Builtins<90>,  Up: Python 3 11 0 beta 1

1.24.39.7 ライブラリ
....................

   - gh-87901(1): Add the 'encoding' parameter to *note os.popen(): 31c.

   - 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: 35e. (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():
     141f, 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__(): 947. to *note
     logging.LoggerAdapter: 1511. and *note logging.StreamHandler: 1415,
     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: 2ee. 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: 9f0.  Patch by Jelle Zijlstra.

   - gh-88089(19): Add support for generic *note typing.NamedTuple: 32f.

   - 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(): 11c9. and *note
     subprocess.getstatusoutput(): 11ca.

   - bpo-47029(24): Always close the read end of the pipe used by *note
     multiprocessing.Queue: 1be7. 'after' the last write of buffered
     data to the write end of the pipe to avoid *note BrokenPipeError:
     126b. at garbage collection and at *note
     multiprocessing.Queue.close(): 1be8. 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: 1be9. 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:
     1bea. 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: 8b0.

   - gh-84461(35): Add *note -enable-wasm-pthreads: 1beb. 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: 1bec.
     named tuple with build-time and run-time information about
     Emscripten platform.

   - gh-90623(41): *note signal.raise_signal(): 1bed. and *note
     os.kill(): 1583. 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(): 8b7.  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(): 8c1. for *note
     collections.abc.Callable: 9ef.  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(): 118c.
     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(): 883. 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: 88e. instead of *note
     ProgrammingError: 307.  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: 893.  Patch by Aviv Palivoda and Erlend E. Aasland.

   - gh-69093(68): Add *note context manager: 1e3. support to *note
     sqlite3.Blob: 893.  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(): 17a. now accepts
     arguments for *note warnings.simplefilter(): 8d1, 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(): 866. to get the
     current locale encoding.  It is similar to
     ‘locale.getpreferredencoding(False)’ but ignores the *note Python
     UTF-8 Mode: 867.

   - bpo-42012(85): Add *note wsgiref.types: 123, 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(): 15a2. 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(): 8be. and *note
     typing.clear_overloads(): 8bf.  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:
     1d8. exception memory leak

   - bpo-46720(95): Add support for path-like objects to *note
     multiprocessing.set_executable(): 1bee. 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 ‘http.server’).
     Patch by Géry Ogam.

   - bpo-44791(100): Accept ellipsis as the last argument of *note
     typing.Concatenate: 9cb.

   - 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: 8a4.
     or *note io.TextIOBase: 8a5. interface for *note
     tempfile.SpooledTemporaryFile: 8a3. 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: 330. subclasses to also
     include *note Generic: 1823. 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(): 891. 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(): 1bef, *note csv.get_dialect(): 1bf0,
     *note csv.unregister_dialect(): 1bf1. and *note
     csv.list_dialects(): 1bf2.

   - 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: 307. 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: 355.

   - bpo-22276(119): *note Path: 268. methods *note glob(): 537. and
     *note rglob(): 538. return only directories if 'pattern' ends with
     a pathname components separator (‘/’ or *note sep: 87b.).  Patch by
     Eisuke Kawashima.

   - bpo-24905(120): Add *note blobopen(): 892. to *note
     sqlite3.Connection: 54d.  *note sqlite3.Blob: 893. 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: ドキュメント<32>,  Next: テスト<32>,  Prev: ライブラリ<93>,  Up: Python 3 11 0 beta 1

1.24.39.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(): c22.

   - 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: 1bf4. 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():
     17b3. 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: テスト<32>,  Next: ビルド<38>,  Prev: ドキュメント<32>,  Up: Python 3 11 0 beta 1

1.24.39.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: 10d. times to ‘ctypes.test’
     location and structure.  Patch by Oleg Iarygin.

   - bpo-29890(8): Add tests for *note ipaddress.IPv4Interface: 1bf6.
     and *note ipaddress.IPv6Interface: 1bf7. 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: ビルド<38>,  Next: Windows<32>,  Prev: テスト<32>,  Up: Python 3 11 0 beta 1

1.24.39.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<32>,  Next: macOS<24>,  Prev: ビルド<38>,  Up: Python 3 11 0 beta 1

1.24.39.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(): 26f. 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<24>,  Next: Tools/Demos<25>,  Prev: Windows<32>,  Up: Python 3 11 0 beta 1

1.24.39.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<33>,  Prev: macOS<24>,  Up: Python 3 11 0 beta 1

1.24.39.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<33>,  Prev: Tools/Demos<25>,  Up: Python 3 11 0 beta 1

1.24.39.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(): 980. 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(): 1b39.

   - 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(): 2d1, *note Py_TYPE(): 3c7, *note
     Py_SIZE(): 989. and *note Py_IS_TYPE(): 1bfd. 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(): 1bfe. is now exported in
     the Stable ABI on Windows.

   - bpo-47169(12): *note PyThread_get_thread_native_id(): 1bff. is
     excluded from the stable ABI on platforms where it doesn't exist
     (like Solaris).

   - bpo-46343(13): Added *note PyErr_GetHandledException(): 977. and
     *note PyErr_SetHandledException(): 978. as simpler alternatives to
     *note PyErr_GetExcInfo(): 97a. and *note PyErr_SetExcInfo(): 979.

     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.40 Python 3.11.0 alpha 7
-----------------------------

'Release date: 2022-04-05'

* Menu:

* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<94>.
* Core and Builtins: Core and Builtins<92>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<96>.
* ドキュメント: ドキュメント<33>.
* テスト: テスト<33>.
* ビルド: ビルド<39>.
* Windows: Windows<33>.
* macOS: macOS<25>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<34>.


File: python.info,  Node: Core and Builtins<91>,  Next: ライブラリ<94>,  Up: Python 3 11 0 alpha 7

1.24.40.1 Core and Builtins
...........................

   - bpo-47212(1): Raise *note IndentationError: 1755. instead of *note
     SyntaxError: 18f. for a bare ‘except’ with no following indent.
     Improve ‘SyntaxError’ 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: 912. + 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: 91a. + jump.

   - bpo-47120(5): Replace the absolute jump opcode *note
     JUMP_NO_INTERRUPT: 1c02. by the relative *note
     JUMP_BACKWARD_NO_INTERRUPT: 90f.

   - 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: 2c2.  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: 91b.

   - 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: 990. 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: ライブラリ<94>,  Next: Core and Builtins<92>,  Prev: Core and Builtins<91>,  Up: Python 3 11 0 alpha 7

1.24.40.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<92>,  Next: ライブラリ<95>,  Prev: ライブラリ<94>,  Up: Python 3 11 0 alpha 7

1.24.40.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: 193. and *note
     bytearray: 342. by 30%.  Patch by Kumar Aditya.

   - bpo-47009(4): Improved the performance of *note list.append(): 8dd.
     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: ライブラリ<95>,  Next: Core and Builtins<93>,  Prev: Core and Builtins<92>,  Up: Python 3 11 0 alpha 7

1.24.40.4 ライブラリ
....................

   - bpo-46829(1): Deprecate passing a message into *note
     asyncio.Future.cancel(): 1c06. and *note asyncio.Task.cancel():
     4d3.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46829


File: python.info,  Node: Core and Builtins<93>,  Next: ライブラリ<96>,  Prev: ライブラリ<95>,  Up: Python 3 11 0 alpha 7

1.24.40.5 Core and Builtins
...........................

   - bpo-46993(1): Speed up *note bytearray: 342. creation from *note
     list: 24f. 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: 19fd. calling convention.  Patch by Kumar Aditya.

   - bpo-46841(4): Modify *note STORE_SUBSCR: 1c08. 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: 916,
     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: 1a38, *note setter:
     1a39, and *note deleter: 1a3a. 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: ライブラリ<96>,  Next: ドキュメント<33>,  Prev: Core and Builtins<93>,  Up: Python 3 11 0 alpha 7

1.24.40.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: 1c9.

   - 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(): fcc. to only
     resolve names for *note socket.AF_INET: 1c0a. or *note
     socket.AF_INET6: 1c0b. families.  Resolution may not make sense for
     other families, like *note socket.AF_BLUETOOTH: 1c0c. and *note
     socket.AF_UNIX: 1c0d.

   - 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: 1590. 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(): 89b. 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(): 1448, *note re.split():
     5a2, *note re.findall(): 122f, *note re.finditer(): 1718. and *note
     re.sub(): 5a3. for regular expressions starting with ‘\A’ or ‘^’.

   - bpo-23691(20): Protect the *note re.finditer(): 1718. 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: 8d4. constructor and the ‘--metadata-encoding’
     option in the *note zipfile: 138. CLI to allow reading zipfiles
     using non-standard codecs to encode the filenames within the
     archive.

   - bpo-47000(24): Make *note io.text_encoding(): 1a9e. 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(): 1a73. 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(): 1a73. release the GIL when
     computing on larger inputs as *note zlib.crc32(): 1a72. and *note
     hashlib: 6c. do.

     This also boosts performance on Windows as it now uses the zlib
     crc32 implementation for *note binascii.crc32(): 1a73. 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: 2f7. 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: c6c. 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(): fa4. 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: 8bc.  Patch
     by Shantanu Jain.

   - bpo-46995(47): Deprecate missing *note asyncio.Task.set_name():
     bd4. 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(): 1cb. and *note asyncio.loop.create_task():
     1cc.

   - 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: 874. value is now always
     available.  Patch by Victor Stinner.

   - bpo-46955(54): Expose ‘asyncio.base_events.Server’ as *note
     asyncio.Server: d0c.  Patch by Stefan Zabka.

   - bpo-23325(55): The *note signal: cb. module no longer assumes that
     *note SIG_IGN: 1c0e. and *note SIG_DFL: 1c0f. 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(): c0d. returns the path when the ‘pwd’ module
     is not available.

   - bpo-40059(58): PEP 680(59), the *note tomllib: 103. module.  Adds
     support for parsing TOML.

   - bpo-464471(60): *note asyncio.timeout(): 814. and *note
     asyncio.timeout_at(): 1c10. 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: b3b. to wrap *note
     typing.ParamSpecArgs: 9cd. and *note dataclasses.InitVar: 1c11.
     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: 447. 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: 118. 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(): 1c12. and *note
     sysconfig.get_preferred_scheme(): 8a0. 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(): 8c1. now supports
     evaluating strings as forward references in *note PEP 585 generic
     aliases: 8c2.

   - bpo-46607(69): Add *note DeprecationWarning: 1a4. 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(): 8bb.  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(): 354.

   - 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: ef5.

   - 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(): 1737.

   - bpo-24959(81): Fix bug where *note unittest: 10d. 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: 88e. instead of *note
          ProgrammingError: 307. for ‘SQLITE_MISUSE’ errors.

        * Don't overwrite *note BufferError: 1806. with *note
          ValueError: 2ee. when conversion to BLOB fails.

        * Raise *note ProgrammingError: 307. instead of *note Warning:
          1c13. if user tries to *note execute(): 5b0. more than one SQL
          statement.

        * Raise *note ProgrammingError: 307. instead of *note
          ValueError: 2ee. 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(): 88f. and *note deserialize():
     890. support to *note sqlite3: d4.  Patch by Erlend E. Aasland.

   - bpo-33178(86): Added *note ctypes.BigEndianUnion: 1c14. and *note
     ctypes.LittleEndianUnion: 1c15. 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: ドキュメント<33>,  Next: テスト<33>,  Prev: ライブラリ<96>,  Up: Python 3 11 0 alpha 7

1.24.40.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(): 1a73. / *note zlib.adler32(): 1c17. /
     *note zlib.crc32(): 1a72. functions.

   - bpo-46033(5): Clarify ‘for’ statement execution in its doc.

   - bpo-45790(6): Adjust inaccurate phrasing in *note 拡張の型の定義;
     チュートリアル: 1c18. about the ‘ob_base’ field and the macros used
     to access its contents.

   - bpo-42340(7): Document that in some circumstances *note
     KeyboardInterrupt: bc9. 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: テスト<33>,  Next: ビルド<39>,  Prev: ドキュメント<33>,  Up: Python 3 11 0 alpha 7

1.24.40.8 テスト
................

   - bpo-47205(1): Skip test for *note sched_getaffinity(): 1326. and
     *note sched_setaffinity(): 132a. error case on FreeBSD.

   - bpo-46126(2): Restore 'descriptions' when running tests internally.

   - bpo-47104(3): Rewrite *note asyncio.to_thread(): ae9. tests to use
     *note unittest.IsolatedAsyncioTestCase: 35f.

   - 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(): d09. 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: ビルド<39>,  Next: Windows<33>,  Prev: テスト<33>,  Up: Python 3 11 0 alpha 7

1.24.40.9 ビルド
................

   - bpo-40280(1): Add configure option *note
     -enable-wasm-dynamic-linking: 1c1b. 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<33>,  Next: macOS<25>,  Prev: ビルド<39>,  Up: Python 3 11 0 alpha 7

1.24.40.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<25>,  Next: Tools/Demos<26>,  Prev: Windows<33>,  Up: Python 3 11 0 alpha 7

1.24.40.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: 118. 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<34>,  Prev: macOS<25>,  Up: Python 3 11 0 alpha 7

1.24.40.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<34>,  Prev: Tools/Demos<26>,  Up: Python 3 11 0 alpha 7

1.24.40.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(): 1c20. 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(): d88.
     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(): 1c21. and *note
     sys.set_asyncgen_hooks(): 19fc. 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(): 96d, *note
     PyFloat_Pack4(): 96e, *note PyFloat_Pack8(): 96f, *note
     PyFloat_Unpack2(): 970, *note PyFloat_Unpack4(): 971. and *note
     PyFloat_Unpack8(): 972.  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.41 Python 3.11.0 alpha 6
-----------------------------

'Release date: 2022-03-07'

* Menu:

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<97>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<98>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<99>.
* Core and Builtins: Core and Builtins<97>.
* ライブラリ: ライブラリ<100>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<34>.
* ビルド: ビルド<40>.
* Windows: Windows<34>.
* IDLE: IDLE<17>.
* C API: C API<35>.


File: python.info,  Node: Core and Builtins<94>,  Next: ライブラリ<97>,  Up: Python 3 11 0 alpha 6

1.24.41.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: 364.

   - bpo-46841(5): Use an oparg to simplify the construction of helpful
     error messages in *note GET_AWAITABLE: 1c24.

   - 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: b65. followed by *note EXTENDED_ARG: 1b7d.

   - 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: 1c25.

   - bpo-46841(10): Use inline cache for ‘BINARY_SUBSCR’.

   - bpo-46841(11): Use inline caching for *note COMPARE_OP: b65.

   - 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: 1c26.

   - 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: 1abb.

   - 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: 364. caches inline using a
     new *note CACHE: 909. 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: 1c25. instructions.

   - bpo-46729(24): Add number of sub-exceptions to
     ‘BaseException.__str__()’.

   - bpo-45885(25): Don't un-adapt *note COMPARE_OP: b65. 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: ライブラリ<97>,  Next: Core and Builtins<95>,  Prev: Core and Builtins<94>,  Up: Python 3 11 0 alpha 6

1.24.41.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<95>,  Next: ライブラリ<98>,  Prev: ライブラリ<97>,  Up: Python 3 11 0 alpha 6

1.24.41.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__(): 14f1.
     method.  Patch by Jelle Zijlstra.

   - bpo-46072(10): Add more detailed specialization failure statistics
     for *note BINARY_OP: 364.

   - 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: ライブラリ<98>,  Next: Core and Builtins<96>,  Prev: Core and Builtins<95>,  Up: Python 3 11 0 alpha 6

1.24.41.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<96>,  Next: ライブラリ<99>,  Prev: ライブラリ<98>,  Up: Python 3 11 0 alpha 6

1.24.41.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: 1c26. for *note
     tuple: 614. and *note list: 24f. 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: ライブラリ<99>,  Next: Core and Builtins<97>,  Prev: Core and Builtins<96>,  Up: Python 3 11 0 alpha 6

1.24.41.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<97>,  Next: ライブラリ<100>,  Prev: ライブラリ<99>,  Up: Python 3 11 0 alpha 6

1.24.41.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(): 1c2d, and added a fast path for
     single-digit integers to *note PyLong_FromLongLong(): 1c2e.

   ---------- 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: ライブラリ<100>,  Next: ドキュメント<34>,  Prev: Core and Builtins<97>,  Up: Python 3 11 0 alpha 6

1.24.41.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(): 1c30. in
     *note unittest: 10d.  Patch by Kumar Aditya.

   - bpo-46848(3): For performance, use the optimized string-searching
     implementations from *note find(): 1c31. and *note rfind(): 1c32.
     for ‘find()’ and ‘rfind()’.

   - bpo-46736(4): *note SimpleHTTPRequestHandler: d3c. now uses HTML5
     grammar.  Patch by Donghee Na.

   - bpo-44886(5): Inherit asyncio proactor datagram transport from
     *note asyncio.DatagramTransport: 1b86.

   - bpo-46827(6): Support UDP sockets in *note
     asyncio.loop.sock_connect(): fcc. 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: 199. if *note ssl.SSLSocket:
     aeb. 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(): 354. 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(): 1c33. and
     *note
     urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated():
     1c34. 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(): 1c35. and *note
     random.normalvariate(): 1c36. 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:
     1c37. now includes the ‘module’ parameter of ‘typing.ForwardRef’
     when it is set.

   - bpo-46643(18): In *note typing.get_type_hints(): 8c1, 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: 330. 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: 94f. and
     *note calendar.LocaleHTMLCalendar: 950. classes now use *note
     locale.getlocale(): 931, instead of using *note
     locale.getdefaultlocale(): 92f, if no locale is specified.  Patch
     by Victor Stinner.

   - bpo-46659(25): The *note locale.getdefaultlocale(): 92f. function
     is deprecated and will be removed in Python 3.13.  Use *note
     locale.setlocale(): 930, *note locale.getpreferredencoding(False):
     75c. and *note locale.getlocale(): 931. functions instead.  Patch
     by Victor Stinner.

   - bpo-46655(26): In *note typing.get_type_hints(): 8c1, 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: 12c. module.  Now, instantiating an
     *note xml.etree.ElementTree.XMLParser: c4d. with a ‘target=None’
     keyword provides a default *note xml.etree.ElementTree.TreeBuilder:
     c4e. 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(): 8c4.

     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: 268. 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: 8b8. and *note
     typing.assert_never(): 8b7.  Patch by Jelle Zijlstra.

   - bpo-46333(37): The ‘__eq__()’ and ‘__hash__()’ methods of *note
     typing.ForwardRef: 1c37. now honor the ‘module’ parameter of
     ‘typing.ForwardRef’.  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(): 8c1. 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(): 1c38. method
     when using 'fileobj' argument: position in the 'fileobj' was
     advanced forward which made it unreadable with *note
     tarfile.TarFile.open(): 1c39.

   - 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: 199. if the ‘interpolation’
     parameter is not of type ‘configparser.Interpolation’

   - bpo-29418(47): Implement *note inspect.ismethodwrapper(): 85a. and
     fix *note inspect.isroutine(): 1c3a. 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: ドキュメント<34>,  Next: テスト<34>,  Prev: ライブラリ<100>,  Up: Python 3 11 0 alpha 6

1.24.41.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: テスト<34>,  Next: ビルド<40>,  Prev: ドキュメント<34>,  Up: Python 3 11 0 alpha 6

1.24.41.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: ビルド<40>,  Next: Windows<34>,  Prev: テスト<34>,  Up: Python 3 11 0 alpha 6

1.24.41.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: 97d.  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<34>,  Next: IDLE<17>,  Prev: ビルド<40>,  Up: Python 3 11 0 alpha 6

1.24.41.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<17>,  Next: C API<35>,  Prev: Windows<34>,  Up: Python 3 11 0 alpha 6

1.24.41.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<35>,  Prev: IDLE<17>,  Up: Python 3 11 0 alpha 6

1.24.41.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: 990. 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.42 Python 3.11.0 alpha 5
-----------------------------

'Release date: 2022-02-03'

* Menu:

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


File: python.info,  Node: Core and Builtins<98>,  Next: ライブラリ<101>,  Up: Python 3 11 0 alpha 5

1.24.42.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: 1a7. 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(): 19c. to ‘__trunc__()’
     is now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not ‘__int__()’ or ‘__index__()’ now raises a
     *note DeprecationWarning: 1a4.

   - bpo-46458(5): Reorder code emitted by the compiler for a *note try:
     8f9.-*note except: 1ac. block so that the *note else: 17d. block's
     code immediately follows the ‘try’ 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(): 169f. 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: 918. and *note SWAP: 919.
     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(): 1c43. 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: ライブラリ<101>,  Next: Core and Builtins<99>,  Prev: Core and Builtins<98>,  Up: Python 3 11 0 alpha 5

1.24.42.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<99>,  Next: ライブラリ<102>,  Prev: ライブラリ<101>,  Up: Python 3 11 0 alpha 5

1.24.42.3 Core and Builtins
...........................

   - bpo-46361(1): Ensure that "small" integers created by *note
     int.from_bytes(): 1c46. and *note decimal.Decimal: 200. 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: ライブラリ<102>,  Next: ビルド<41>,  Prev: Core and Builtins<99>,  Up: Python 3 11 0 alpha 5

1.24.42.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: ビルド<41>,  Next: Core and Builtins<100>,  Prev: ライブラリ<102>,  Up: Python 3 11 0 alpha 5

1.24.42.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<100>,  Next: ライブラリ<103>,  Prev: ビルド<41>,  Up: Python 3 11 0 alpha 5

1.24.42.6 Core and Builtins
...........................

   - bpo-44024(1): Improve the *note TypeError: 199. message for
     non-string second arguments passed to the built-in functions *note
     getattr(): dce. and *note hasattr(): 6f9.  Patch by Géry Ogam.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44024


File: python.info,  Node: ライブラリ<103>,  Next: ドキュメント<35>,  Prev: Core and Builtins<100>,  Up: Python 3 11 0 alpha 5

1.24.42.7 ライブラリ
....................

   - bpo-46624(1): Restore support for non-integer arguments of *note
     random.randrange(): a6f. and *note random.randint(): 144b.

   - 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(): 8c1, support
     evaluating bare stringified ‘ClassVar’ annotations.  Patch by
     Gregory Beauregard.

   - bpo-46544(5): Don't leak ‘x’ & ‘uspace’ intermediate vars in *note
     textwrap.TextWrapper: 11d3.

   - 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: 10d. 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(): 8c1, support
     evaluating stringified ‘ClassVar’ and ‘Final’ annotations inside
     ‘Annotated’.  Patch by Gregory Beauregard.

   - bpo-46510(10): Add missing test for *note types.TracebackType: cee.
     and *note types.FrameType: 1c4b.  Calculate them directly from the
     caught exception without calling *note sys.exc_info(): 89b.

   - bpo-46491(11): Allow *note typing.Annotated: b3b. to wrap *note
     typing.Final: 56e. and *note typing.ClassVar: 56d.  Patch by
     Gregory Beauregard.

   - bpo-46483(12): Remove *note __class_getitem__(): 947. 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: 199.
     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: 9f0. 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(): 13cc.

   - 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__: 1c4c. 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(): 8ba.  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(): 270. by
     removing an unnecessary check for special entries.

   - bpo-29688(27): Document *note pathlib.Path.absolute(): 1a88. (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(): bfc. 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(): 231. 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(): e75. did not close the coroutine.  Patch
     by Kumar Aditya.

   - bpo-21987(33): Fix an issue with *note tarfile.TarFile.getmember():
     1c4d. getting a directory name with a trailing slash.

   - bpo-46124(34): Update *note zoneinfo: 13b. to rely on
     importlib.resources traversable API.

   - bpo-46103(35): Now *note inspect.getmembers(): 1c4e. 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: 1c4f. 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: 9cb. 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: ドキュメント<35>,  Next: テスト<35>,  Prev: ライブラリ<103>,  Up: Python 3 11 0 alpha 5

1.24.42.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: テスト<35>,  Next: ビルド<42>,  Prev: ドキュメント<35>,  Up: Python 3 11 0 alpha 5

1.24.42.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: f6c.: 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: ビルド<42>,  Next: Windows<35>,  Prev: テスト<35>,  Up: Python 3 11 0 alpha 5

1.24.42.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<35>,  Next: macOS<26>,  Prev: ビルド<42>,  Up: Python 3 11 0 alpha 5

1.24.42.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<26>,  Next: IDLE<18>,  Prev: Windows<35>,  Up: Python 3 11 0 alpha 5

1.24.42.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<18>,  Next: C API<36>,  Prev: macOS<26>,  Up: Python 3 11 0 alpha 5

1.24.42.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<36>,  Prev: IDLE<18>,  Up: Python 3 11 0 alpha 5

1.24.42.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: 960. 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.43 Python 3.11.0 alpha 4
-----------------------------

'リリース日: 2022-01-13'

* Menu:

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<104>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<105>.
* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<106>.
* Core and Builtins: Core and Builtins<104>.
* ライブラリ: ライブラリ<107>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<36>.
* ビルド: ビルド<43>.
* Windows: Windows<36>.
* macOS: macOS<27>.
* C API: C API<37>.


File: python.info,  Node: Core and Builtins<101>,  Next: ライブラリ<104>,  Up: Python 3 11 0 alpha 4

1.24.43.1 Core and Builtins
...........................

   - bpo-46070(1): *note Py_EndInterpreter(): 18aa. 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(): 1723. 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: ライブラリ<104>,  Next: Core and Builtins<102>,  Prev: Core and Builtins<101>,  Up: Python 3 11 0 alpha 4

1.24.43.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<102>,  Next: ライブラリ<105>,  Prev: ライブラリ<104>,  Up: Python 3 11 0 alpha 4

1.24.43.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: ライブラリ<105>,  Next: Core and Builtins<103>,  Prev: Core and Builtins<102>,  Up: Python 3 11 0 alpha 4

1.24.43.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<103>,  Next: ライブラリ<106>,  Prev: ライブラリ<105>,  Up: Python 3 11 0 alpha 4

1.24.43.5 Core and Builtins
...........................

   - bpo-46055(1): Speed up shifting operation involving integers less
     than *note PyLong_BASE: 1c5d.  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: 18f. 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: 1bdf. and *note
     POP_JUMP_IF_NONE: 1bde. 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: ライブラリ<106>,  Next: Core and Builtins<104>,  Prev: Core and Builtins<103>,  Up: Python 3 11 0 alpha 4

1.24.43.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<104>,  Next: ライブラリ<107>,  Prev: ライブラリ<106>,  Up: Python 3 11 0 alpha 4

1.24.43.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: 18f. 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: 185. needs to define a ‘__init__()’ method if it defines a
     ‘__new__()’ method with additional keyword parameters.

   - bpo-43931(7): Added the *note Py_Version: 37f. constant which bears
     the same value as *note PY_VERSION_HEX: 380.  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: ライブラリ<107>,  Next: ドキュメント<36>,  Prev: Core and Builtins<104>,  Up: Python 3 11 0 alpha 4

1.24.43.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(): 89c. method which
     returns the active exception instance.

   - bpo-46307(3): Add *note string.Template.is_valid(): 897. and *note
     string.Template.get_identifiers(): 896. methods.

   - bpo-46306(4): Assume that *note types.CodeType: 32d. 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__(): 1c61.

   - 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: 118. 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(): 8e0.

   - 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(): a0c. to match hidden files and directories when
     using special characters like ‘*’, ‘**’, ‘?’ and ‘[]’.

   - bpo-20369(23): *note concurrent.futures.wait(): 1c62. 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: 2ee.
     with clear message when trying to render usage for an empty
     mutually exclusive group.  Previously it raised a cryptic *note
     IndexError: 1753.

   - bpo-45615(29): Functions in the *note traceback: 105. module raise
     *note TypeError: 199. 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(): 1409. 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: 10b. 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: 1c63. objects, patch by Kumar Aditya.

   - bpo-45643(42): Added *note signal.SIGSTKFLT: 1c64. on platforms
     where this signal is defined.

   - bpo-44092(43): Fetch across rollback no longer raises *note
     InterfaceError: 88e.  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: a3a, 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: ドキュメント<36>,  Next: テスト<36>,  Prev: ライブラリ<107>,  Up: Python 3 11 0 alpha 4

1.24.43.9 ドキュメント
......................

   - bpo-46196(1): Document method *note cmd.Cmd.columnize(): 1c66.

   - bpo-46120(2): State that ‘|’ is preferred for readability over
     ‘Union’ in the *note typing: 10b. 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():
     1c67. 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: テスト<36>,  Next: ビルド<43>,  Prev: ドキュメント<36>,  Up: Python 3 11 0 alpha 4

1.24.43.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: 35f. 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: ビルド<43>,  Next: Windows<36>,  Prev: テスト<36>,  Up: Python 3 11 0 alpha 4

1.24.43.11 ビルド
.................

   - bpo-44133(1): When Python is configured with *note
     -without-static-libpython: a92, 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:
     a67, 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(): 119a.

   - 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<36>,  Next: macOS<27>,  Prev: ビルド<43>,  Up: Python 3 11 0 alpha 4

1.24.43.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<27>,  Next: C API<37>,  Prev: Windows<36>,  Up: Python 3 11 0 alpha 4

1.24.43.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<37>,  Prev: macOS<27>,  Up: Python 3 11 0 alpha 4

1.24.43.14 C API
................

   - bpo-46236(1): Fix a bug in *note PyFunction_GetAnnotations(): 1b96.
     that caused it to return a ‘tuple’ instead of a ‘dict’.

   - bpo-46140(2): *note PyBuffer_GetPointer(): 961, *note
     PyBuffer_FromContiguous(): 964, *note PyBuffer_ToContiguous(): 963.
     and *note PyMemoryView_FromBuffer(): 969. now take buffer info by
     ‘const Py_buffer *’ instead of ‘Py_buffer *’, as they do not need
     mutability.  ‘PyBuffer_FromContiguous()’ also now takes the source
     buffer as ‘const void *’, and similarly ‘PyBuffer_GetPointer()’
     takes the strides as ‘const Py_ssize_t *’.

   - bpo-45855(3): Document that the 'no_block' argument to *note
     PyCapsule_Import(): 1c6d. is a no-op now.

   - bpo-45855(4): Replaced deprecated usage of *note
     PyImport_ImportModuleNoBlock(): 3d9. with *note
     PyImport_ImportModule(): 3da. 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.44 Python 3.11.0 alpha 3
-----------------------------

'Release date: 2021-12-08'

* Menu:

* Core and Builtins: Core and Builtins<105>.
* ライブラリ: ライブラリ<108>.
* Core and Builtins: Core and Builtins<106>.
* ライブラリ: ライブラリ<109>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<37>.
* ビルド: ビルド<44>.
* Windows: Windows<37>.
* macOS: macOS<28>.
* C API: C API<38>.


File: python.info,  Node: Core and Builtins<105>,  Next: ライブラリ<108>,  Up: Python 3 11 0 alpha 3

1.24.44.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: 18f. 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: 1c70. 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(): 89b. and
     *note PyErr_GetExcInfo(): 97a. if the exception instance is
     modified while the exception is handled, as well as *note
     PyErr_SetExcInfo(): 979, 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: ライブラリ<108>,  Next: Core and Builtins<106>,  Prev: Core and Builtins<105>,  Up: Python 3 11 0 alpha 3

1.24.44.2 ライブラリ
....................

   - bpo-45614(1): Fix *note traceback: 105. 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<106>,  Next: ライブラリ<109>,  Prev: ライブラリ<108>,  Up: Python 3 11 0 alpha 3

1.24.44.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: 90e. 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: 364.
     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: 364. 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: ライブラリ<109>,  Next: ドキュメント<37>,  Prev: Core and Builtins<106>,  Up: Python 3 11 0 alpha 3

1.24.44.4 ライブラリ
....................

   - bpo-27946(1): Fix possible crash when getting an attribute of *note
     xml.etree.ElementTree.Element: 361. 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(): 426, and before they
     are stored as an exc_info triplet.  This brings ‘asyncio’ 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: 1b18. flush now the output stream more
     often.

   - bpo-45917(5): Added *note math.exp2(): 871.:, 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(): a36.

   - 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: 1b7d. 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: 3e2. location while the program is running, calling
     the *note importlib.invalidate_caches(): e0e. 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(): d99. and *note
     types.new_class(): 137d. for *note types.GenericAlias: 9f0.
     instance as a base.

   - bpo-45663(23): Fix *note dataclasses.is_dataclass(): 1c74. for
     dataclasses which are subclasses of *note types.GenericAlias: 9f0.

   - bpo-45662(24): Fix the repr of *note dataclasses.InitVar: 1c11.
     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(): 8ad. now uses a
     waitable timer which supports high-resolution timers.  Patch by
     Donghee Na and Eryk Sun.

   - bpo-37295(27): Optimize *note math.comb(): 8e0. and *note
     math.perm(): 8e1.

   - 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: ae2.

   - bpo-44733(32): Add ‘max_tasks_per_child’ to *note
     concurrent.futures.ProcessPoolExecutor: 1d8.  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: ドキュメント<37>,  Next: テスト<37>,  Prev: ライブラリ<109>,  Up: Python 3 11 0 alpha 3

1.24.44.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: f48. 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(): 1aff. and *note asdict():
     1af6. 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: テスト<37>,  Next: ビルド<44>,  Prev: ドキュメント<37>,  Up: Python 3 11 0 alpha 3

1.24.44.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(): be6. 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: ビルド<44>,  Next: Windows<37>,  Prev: テスト<37>,  Up: Python 3 11 0 alpha 3

1.24.44.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: 13a, *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<37>,  Next: macOS<28>,  Prev: ビルド<44>,  Up: Python 3 11 0 alpha 3

1.24.44.8 Windows
.................

   - bpo-46105(1): Fixed calculation of *note sys.path: 3e2. 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<28>,  Next: C API<38>,  Prev: Windows<37>,  Up: Python 3 11 0 alpha 3

1.24.44.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<38>,  Prev: macOS<28>,  Up: Python 3 11 0 alpha 3

1.24.44.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.45 Python 3.11.0 alpha 2
-----------------------------

'リリース日: 2021-11-05'

* Menu:

* Core and Builtins: Core and Builtins<107>.
* ライブラリ: ライブラリ<110>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<38>.
* ビルド: ビルド<45>.
* Windows: Windows<38>.
* macOS: macOS<29>.
* IDLE: IDLE<19>.
* C API: C API<39>.


File: python.info,  Node: Core and Builtins<107>,  Next: ライブラリ<110>,  Up: Python 3 11 0 alpha 2

1.24.45.1 Core and Builtins
...........................

   - bpo-45716(1): Improve the *note SyntaxError: 18f. 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: a46. 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 値の比較:
     1c7d. 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: 170. 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: ライブラリ<110>,  Next: ドキュメント<38>,  Prev: Core and Builtins<107>,  Up: Python 3 11 0 alpha 2

1.24.45.2 ライブラリ
....................

   - bpo-45679(1): Fix caching of multi-value *note typing.Literal: a59.
     ‘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: 88d. 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: 1772. if the underlying SQLite API signals
     memory error.  Patch by Erlend E. Aasland.

   - bpo-45557(7): *note pprint.pprint(): a2d. now handles
     'underscore_numbers' correctly.  Previously it was always setting
     it to ‘False’.

   - bpo-44019(8): Add *note operator.call(): 1c7f. to
     ‘operator.__all__’.  Patch by Kreusada.

   - bpo-42174(9): *note shutil.get_terminal_size(): 131f. 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: 115c. is now public, and
     implements the *note importlib.abc.InspectLoader: 115a. interface.
     ‘_NamespaceLoader’ is kept for backward compatibility.

   - bpo-45515(11): Add references to *note zoneinfo: 13b. 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: a6a, and *note
     lzma.LZMAFile: 1212. (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: 1c37. 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(): 1c80.
     crashing with *note UnboundLocalError: 1754. 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():
     1c81. 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: c6b. with
     explicit *note asyncio.Lock: c6a. 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: 188d.  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(): 1bcc. 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: 135. 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: 188d.
     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: d39. to work
     properly in OSs that don't support the ‘TCP_NODELAY’ socket option.

   - bpo-45243(34): Add *note setlimit(): 88b. and *note getlimit():
     88c. 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(): 231. or *note
               inspect.getfullargspec(): 945. instead.

        * the ‘formatargspec’ function, deprecated since Python 3.5; use
          the *note inspect.signature(): 231. 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(): 946. 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: 1c82.  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: 215. instance ‘f’ passes an ‘isinstance(f,
     typing.SupportsInt)’ check.

   - bpo-40321(42): Adds support for HTTP 308 redirects to *note urllib:
     10f.  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: ドキュメント<38>,  Next: テスト<38>,  Prev: ライブラリ<110>,  Up: Python 3 11 0 alpha 2

1.24.45.3 ドキュメント
......................

   - bpo-45726(1): Improve documentation for *note
     functools.singledispatch(): 84b. and *note
     functools.singledispatchmethod: be9.

   - 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: 1c84. 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: テスト<38>,  Next: ビルド<45>,  Prev: ドキュメント<38>,  Up: Python 3 11 0 alpha 2

1.24.45.4 テスト
................

   - bpo-45678(1): Add tests for scenarios in which *note
     functools.singledispatchmethod: be9. 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(): 208.

   - 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: ビルド<45>,  Next: Windows<38>,  Prev: テスト<38>,  Up: Python 3 11 0 alpha 2

1.24.45.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<38>,  Next: macOS<29>,  Prev: ビルド<45>,  Up: Python 3 11 0 alpha 2

1.24.45.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<29>,  Next: IDLE<19>,  Prev: Windows<38>,  Up: Python 3 11 0 alpha 2

1.24.45.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<19>,  Next: C API<39>,  Prev: macOS<29>,  Up: Python 3 11 0 alpha 2

1.24.45.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<39>,  Prev: IDLE<19>,  Up: Python 3 11 0 alpha 2

1.24.45.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(): 3dc. 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: 98b.  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(): 99d.

        * *note PyMarshal_WriteObjectToFile(): 99e.

        * *note PyMarshal_ReadObjectFromString(): 99f.

        * *note PyMarshal_WriteObjectToString(): 9a0.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: 9a1.

     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(): 95e, and
     *note PyThreadState_LeaveTracing(): 95f. functions to the limited C
     API to suspend and resume tracing and profiling.  Patch by Victor
     Stinner.

   - bpo-44220(14): *note PyStructSequence_UnnamedField: b7d. 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.46 Python 3.11.0 alpha 1
-----------------------------

'Release date: 2021-10-05'

* Menu:

* セキュリティ: セキュリティ<34>.
* 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>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<119>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<120>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<39>.
* ビルド: ビルド<46>.
* Windows: Windows<39>.
* macOS: macOS<30>.
* IDLE: IDLE<20>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<40>.


File: python.info,  Node: セキュリティ<34>,  Next: Core and Builtins<108>,  Up: Python 3 11 0 alpha 1

1.24.46.1 セキュリティ
......................

   - bpo-42278(1): Replaced usage of *note tempfile.mktemp(): 1c8d. with
     *note TemporaryDirectory: 1450. to avoid a potential race
     condition.

   - bpo-44600(2): Fix incorrect line numbers while tracing some failed
     patterns in *note match: a12. 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<108>,  Next: ライブラリ<111>,  Prev: セキュリティ<34>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 9f0.
     objects.

   - bpo-45155(6): *note int.to_bytes(): 1c8f. and *note
     int.from_bytes(): 1c46. now take a default value of ‘"big"’ for the
     ‘byteorder’ argument.  ‘int.to_bytes()’ 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: ライブラリ<111>,  Next: Core and Builtins<109>,  Prev: Core and Builtins<108>,  Up: Python 3 11 0 alpha 1

1.24.46.3 ライブラリ
....................

   - bpo-44219(1): Release the GIL while performing ‘isatty’ system
     calls on arbitrary file descriptors.  In particular, this affects
     *note os.isatty(): 1c91, *note os.device_encoding(): 1c92. and
     *note io.TextIOWrapper: 9c2.  By extension, *note io.open(): 740.
     in text mode is also affected.  This change solves a deadlock in
     ‘os.isatty()’.  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<109>,  Next: ライブラリ<112>,  Prev: ライブラリ<111>,  Up: Python 3 11 0 alpha 1

1.24.46.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: ライブラリ<112>,  Next: Core and Builtins<110>,  Prev: Core and Builtins<109>,  Up: Python 3 11 0 alpha 1

1.24.46.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<110>,  Next: ライブラリ<113>,  Prev: ライブラリ<112>,  Up: Python 3 11 0 alpha 1

1.24.46.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: f6c. 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(): 318, *note io.open(): 740, *note
     codecs.open(): 317. and *note fileinput.FileInput: 944. 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: 105. 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: ライブラリ<113>,  Next: Core and Builtins<111>,  Prev: Core and Builtins<110>,  Up: Python 3 11 0 alpha 1

1.24.46.7 ライブラリ
....................

   - bpo-45012(1): In *note posix: b2, release GIL during ‘stat()’,
     ‘lstat()’, and ‘fstatat()’ syscalls made by *note
     os.DirEntry.stat(): 1acc.  Patch by Stanisław Skonieczny.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45012


File: python.info,  Node: Core and Builtins<111>,  Next: ライブラリ<114>,  Prev: ライブラリ<113>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 18f. is now raised when trying
     to delete *note __debug__: 9de.  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: ライブラリ<114>,  Next: Core and Builtins<112>,  Prev: Core and Builtins<111>,  Up: Python 3 11 0 alpha 1

1.24.46.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<112>,  Next: ライブラリ<115>,  Prev: ライブラリ<114>,  Up: Python 3 11 0 alpha 1

1.24.46.10 Core and Builtins
............................

   - bpo-24234(1): Implement the ‘__bytes__()’ special method on the
     *note bytes: 193. 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: 198. 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: ライブラリ<115>,  Next: Core and Builtins<113>,  Prev: Core and Builtins<112>,  Up: Python 3 11 0 alpha 1

1.24.46.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<113>,  Next: ライブラリ<116>,  Prev: ライブラリ<115>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 197. or *note complex:
     198.

   - bpo-44895(3): A debug variable *note PYTHONDUMPREFSFILE: 1c9c. 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: 18f. 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: 10b. 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: 1a3.

   - 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: ライブラリ<116>,  Next: Core and Builtins<114>,  Prev: Core and Builtins<113>,  Up: Python 3 11 0 alpha 1

1.24.46.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<114>,  Next: ライブラリ<117>,  Prev: ライブラリ<116>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 18f. 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: ライブラリ<117>,  Next: Core and Builtins<115>,  Prev: Core and Builtins<114>,  Up: Python 3 11 0 alpha 1

1.24.46.15 ライブラリ
.....................

   - bpo-44490(1): *note typing: 10b. 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<115>,  Next: ライブラリ<118>,  Prev: ライブラリ<117>,  Up: Python 3 11 0 alpha 1

1.24.46.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(): 1721. in
     error path when initializing *note types.GenericAlias: 9f0.

   ---------- 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: ライブラリ<118>,  Next: Core and Builtins<116>,  Prev: Core and Builtins<115>,  Up: Python 3 11 0 alpha 1

1.24.46.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<116>,  Next: ライブラリ<119>,  Prev: ライブラリ<118>,  Up: Python 3 11 0 alpha 1

1.24.46.18 Core and Builtins
............................

   - bpo-43908(1): Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE:
     3cd. flag can now inherit the PEP 590(2) vectorcall protocol.
     Previously, this was only possible for *note static types: 987.
     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: c4a. 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: 199. is now raised instead of an
     *note AttributeError: 5f0. in *note with: 187. and *note async
     with: 186. statements for objects which do not support the *note
     context manager: 1e3. 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: ライブラリ<119>,  Next: Core and Builtins<117>,  Prev: Core and Builtins<116>,  Up: Python 3 11 0 alpha 1

1.24.46.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<117>,  Next: ライブラリ<120>,  Prev: ライブラリ<119>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 24f, *note frozenset: 7f2.) no
     longer accept arbitrary keyword arguments.  [reverted in 3.11a4]
     Subclass of *note set: 185. 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(): f48. 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:
     f6c.

   - 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: ライブラリ<120>,  Next: ドキュメント<39>,  Prev: Core and Builtins<117>,  Up: Python 3 11 0 alpha 1

1.24.46.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(): 8a8. method now uses the monotonic clock
     (*note time.CLOCK_MONOTONIC: 8a9.) for the timeout, rather than
     using the system clock (*note time.CLOCK_REALTIME: 8aa.), 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():
     1401. 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(): 8ad.
     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(): 8ad. 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(): 1ca6. raises now a
     *note unittest.SkipTest: 11ea. 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(): c52, *note
     copy(): c53, *note copy2(): c54. raising *note FileNotFoundError:
     266. when source is a directory, which should raise *note
     IsADirectoryError: 1268.

   - 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(): 207. 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(): 8ad.
     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(): 8e5.  Patch by Donghee Na.

   - bpo-35474(21): Calling *note mimetypes.guess_all_extensions():
     1ca7. 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(): 8c1. now works with
     *note Final: 56e. wrapped in *note ForwardRef: 1c37.

   - bpo-45162(23): Remove many old deprecated *note unittest: 10d.
     features:

        * "‘fail*’" and "‘assert*’" aliases of *note TestCase: 2b5.
          methods.

        * Broken from start *note TestCase: 2b5. 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: 942, *note
     wsgiref.util.FileWrapper: 943. and *note fileinput.FileInput: 944,
     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(): 940, 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: 1383. methods *note
     addFailure(): 1ca8, *note addError(): 1ca9, *note addSkip(): 1caa.
     and *note addSubTest(): 1cab. 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: 10d. 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(): 941. 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(): 8b3.  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(): 1382. now always return a *note
     TestResult: 1383. 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: 10d.:

        * Functions registered with *note addModuleCleanup(): c44. were
          not called unless the user defines ‘tearDownModule()’ in their
          test module.

        * Functions registered with *note addClassCleanup(): c45. were
          not called if ‘tearDownClass’ is set to ‘None’.

        * Buffering in *note TestResult: 1383. 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: 10e.  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(): 142a. by compressing and decompressing at
     once in memory instead of in a streamed fashion.

   - bpo-37596(46): Ensure that *note set: 185. 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: 11c. itself.  Patch by Donghee Na.

   - bpo-44955(49): Method *note stopTestRun(): 1566. is now always
     called in pair with method *note startTestRun(): 1565. for *note
     TestResult: 1383. objects implicitly created in *note run(): 1382.
     Previously it was not called for test methods and classes decorated
     with a skipping decorator.

   - bpo-39039(50): tarfile.open raises *note ReadError: 1cac. 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: 35f. 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: 1c4f.'s
     default value is no longer printed twice when used with *note
     argparse.ArgumentDefaultsHelpFormatter: 1cad.

   - bpo-44860(56): Fix the ‘posix_user’ scheme in *note sysconfig: e1.
     to not depend on *note sys.platlibdir: b36.

   - bpo-44859(57): Improve error handling in *note sqlite3: d4. and
     raise more accurate exceptions.

        * *note MemoryError: 1772. is now raised instead of *note
          sqlite3.Warning: 1c13. 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: 1c13. when the statement contains surrogate
          characters in ‘Connection.__call__()’ and ‘Cursor.execute()’.

        * *note TypeError: 199. is now raised instead of *note
          ValueError: 2ee. for non-string script argument in
          ‘Cursor.executescript()’.

        * *note ValueError: 2ee. 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(): 1102. function
     on FreeBSD 14 for file descriptor opened with the *note O_PATH:
     1178. flag: ignore the *note EBADF: b58. 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: 1772. raised in user-defined
     functions will now produce a ‘MemoryError’ in *note sqlite3: d4.
     *note OverflowError: a85. will now be converted to *note DataError:
     1cae.  Previously *note OperationalError: 1caf. was produced in
     these cases.

   - bpo-44822(63): *note sqlite3: d4. user-defined functions and
     aggregators returning *note strings: 16a. 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(): 1509. 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(): dce. 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: 1cb0. 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(): fe5.
     when ‘sys.stdout’ is redirected.  Patch by Stefan Hölzl.

   - bpo-44688(77): *note sqlite3.Connection.create_collation(): 887.
     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: a85. 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(): 231.  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(): 182e. when examining a class in the
     interactive session.  Instead of *note TypeError: 199, it should be
     *note OSError: 2c2. 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(): be6.) was bumped up
     from 256 to 32768, affecting functions: *note fnmatch.fnmatch():
     1cb1, *note fnmatch.fnmatchcase(): 1cb2, *note fnmatch.filter():
     1cb3.

   - bpo-41928(92): Update *note shutil.copyfile(): c52. to raise *note
     FileNotFoundError: 266. instead of confusing *note
     IsADirectoryError: 1268. when a path ending with a ‘os.path.sep’
     does not exist; *note shutil.copy(): c53. and *note shutil.copy2():
     c54. are also affected.

   - bpo-44569(93): Added the ‘StackSummary.format_frame()’ function in
     *note traceback: 105.  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(): adc. 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:
     1185. 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(): 1cb4. 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(): 8c1. 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: 886. to *note set_authorizer():
     5a9.  Patch by Erlend E. Aasland.

   - bpo-43977(106): Set the proper *note Py_TPFLAGS_MAPPING: 1cb5. and
     *note Py_TPFLAGS_SEQUENCE: 1cb6. flags for subclasses created
     before a parent has been registered as a *note
     collections.abc.Mapping: acb. or *note collections.abc.Sequence:
     13e0.

   - 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: 199. 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: 1e3. 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: 1088.

   - 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:
     985. flag.  Patch by Victor Stinner.

   - bpo-44422(118): The *note threading.enumerate(): 1cb7. 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: 199.

   - bpo-44389(121): Fix deprecation of *note ssl.OP_NO_TLSv1_3: 1cb8.

   - 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(): 872.

   - 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(): 86a.

   - bpo-44260(136): The *note random.Random: 1cb9. 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:
     93e. 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: 215. 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: 1a21.
     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(): ae6. 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: 8d9. now supports *note
     zipfile.Path.stem: 8d6, *note zipfile.Path.suffixes: 8d8, and *note
     zipfile.Path.suffix: 8d7. 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: 10b. 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(): ae6. 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(): f4b. with a list of *note
     pathlib.Path: 268. objects

   - bpo-44059(163): Register the SerenityOS Browser in the *note
     webbrowser: 11c. 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: 111. 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: 111. ‘Quoted’ class
     API is now deprecated, for removal in 3.14.

   - bpo-43972(169): When *note http.server.SimpleHTTPRequestHandler:
     d3c. 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:
          1772.

     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: 1772. 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__(): 127d.

   - 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: 94d. 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(): a53, *note
     traceback.format_exception(): a51. and *note
     traceback.format_exception_only(): a52.

   - bpo-33809(183): Add the *note traceback.TracebackException.print():
     8b4. method which prints the formatted exception information.

   - bpo-42862(184): *note sqlite3: d4. now utilizes *note
     functools.lru_cache(): be6. 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(): 11c8. now raises
     *note ValueError: 2ee. when the invalid keyword argument 'check' is
     passed by user code.  Previously such use would fail later with a
     *note TypeError: 199.  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():
     1cba. when called with binary data and ‘7bit’ content transfer
     encoding.

   - bpo-32695(192): The 'compresslevel' and 'preset' keyword arguments
     of *note tarfile.open(): 107b. 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: 1372, *note
     BoundedSemaphore: 1373, *note Event: 1374. and *note Barrier: 1400.

   - bpo-5846(195): Deprecated the following *note unittest: 10d.
     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(): d23. to match *note
     contextlib.contextmanager(): 141f. 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: 1cbb. 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: ドキュメント<39>,  Next: テスト<39>,  Prev: ライブラリ<120>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 1cbd.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():
     1c8f. and *note int.from_bytes(): 1c46. 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(): 1a3c. 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(): add. to the behavior of its c implementation.

   - bpo-44544(20): List all kwargs for *note textwrap.wrap(): 16e5,
     *note textwrap.fill(): 16e4, and *note textwrap.shorten(): 11d6.
     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: 138. 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(): 1549.

   - 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: 13d8.
     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: テスト<39>,  Next: ビルド<46>,  Prev: ドキュメント<39>,  Up: Python 3 11 0 alpha 1

1.24.46.23 テスト
.................

   - bpo-40173(1): Fix *note
     test.support.import_helper.import_fresh_module(): 1cbf.

   - bpo-45280(2): Add a test case for empty *note typing.NamedTuple:
     32f.

   - 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():
     d9e. 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: b36.
     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(): 1b5. 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(): 1641. is
     preserved when ‘obj * 1’ is used on *note str: 16a. and *note
     bytes: 193. 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: 1cc0. 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(): bfd.
     function.

   - bpo-43921(29): Fix test_ssl.test_wrong_cert_tls13(): use
     ‘suppress_ragged_eofs=False’, since ‘read()’ can raise *note
     ssl.SSLEOFError: 1b1a. 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: ビルド<46>,  Next: Windows<39>,  Prev: テスト<39>,  Up: Python 3 11 0 alpha 1

1.24.46.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<39>,  Next: macOS<30>,  Prev: ビルド<46>,  Up: Python 3 11 0 alpha 1

1.24.46.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():
     8a8. or *note threading.Condition.wait(): 1cc3.

   - 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<30>,  Next: IDLE<20>,  Prev: Windows<39>,  Up: Python 3 11 0 alpha 1

1.24.46.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(): f49. 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<20>,  Next: Tools/Demos<27>,  Prev: macOS<30>,  Up: Python 3 11 0 alpha 1

1.24.46.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: a12. statement's *note
     soft keywords: a11.: *note match: a12, ‘case’, and *note _: a13.
     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<40>,  Prev: IDLE<20>,  Up: Python 3 11 0 alpha 1

1.24.46.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<40>,  Prev: Tools/Demos<27>,  Up: Python 3 11 0 alpha 1

1.24.46.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: 2ee. when the entire file has already been buffered.

   - bpo-45116(3): Add the *note Py_ALWAYS_INLINE: 1cc8. 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: 1868. macro to disable
     inlining on a function.  Patch by Victor Stinner.

   - bpo-45061(5): Add a deallocator to the *note bool: 3c1. 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(): 95d. 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(): bc0. now resets *note
     PyImport_Inittab: 1b7a. to its initial value at exit.  It must be
     possible to call *note PyImport_AppendInittab(): 1b7b. or *note
     PyImport_ExtendInittab(): 1b7c. 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: 994.
     members like ‘_tstate->trash_delete_nesting’, whereas the
     ‘PyThreadState’ 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の内容: 9a1. now shows
     the public name *note PyFrameObject: 990. rather than ‘_frame’.
     The non-existing entry ‘_node’ no longer appears in the list.

   - bpo-44378(15): *note Py_IS_TYPE(): 1bfd. no longer uses *note
     Py_TYPE(): 3c7. to avoid a compiler warning: no longer cast ‘const
     PyObject*’ to ‘PyObject*’.  Patch by Victor Stinner.

   - bpo-39573(16): Convert the *note Py_TYPE(): 3c7. and *note
     Py_SIZE(): 989. macros to static inline functions.  The *note
     Py_SET_TYPE(): 988. and *note Py_SET_SIZE(): 98a. functions must
     now be used to set an object type and size.  Patch by Victor
     Stinner.

   - bpo-44263(17): The *note PyType_Ready(): 984. function now raises
     an error if a type is defined with the *note Py_TPFLAGS_HAVE_GC:
     985. flag set but has no traverse function (*note
     PyTypeObject.tp_traverse: 986.).  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: 3f5. 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(): a9b. 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(): 95c. 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.47 Python 3.10.0 beta 1
----------------------------

'リリース日: 2021-05-03'

* Menu:

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<121>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<123>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<40>.
* ビルド: ビルド<47>.
* Windows: Windows<40>.
* macOS: macOS<31>.
* IDLE: IDLE<21>.
* C API: C API<41>.


File: python.info,  Node: セキュリティ<35>,  Next: Core and Builtins<118>,  Up: Python 3 10 0 beta 1

1.24.47.1 セキュリティ
......................

   - bpo-43434(1): Creating *note sqlite3.Connection: 54d. objects now
     also produces ‘sqlite3.connect’ and ‘sqlite3.connect/handle’ *note
     auditing events: 1ccb.  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: 355. 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(): 111. 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(): a43, 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(): a0c.

   - 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(): b5e. treats leading
     zeros as octal notation.  glibc implementation of modern *note
     inet_pton(): b5f. does not accept any leading zeros.  For a while
     the ‘ipaddress’ module used to accept ambiguous leading zeros.

   - bpo-43075(9): Fix Regular Expression Denial of Service (ReDoS)
     vulnerability in *note urllib.request.AbstractBasicAuthHandler:
     1ccc.  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<118>,  Next: ライブラリ<121>,  Prev: セキュリティ<35>,  Up: Python 3 10 0 beta 1

1.24.47.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: 1cce. 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: ライブラリ<121>,  Next: Core and Builtins<119>,  Prev: Core and Builtins<118>,  Up: Python 3 10 0 beta 1

1.24.47.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<119>,  Next: ライブラリ<122>,  Prev: ライブラリ<121>,  Up: Python 3 10 0 beta 1

1.24.47.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: 18f. 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: 1755. 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: 450. 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: 1cd1. 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: 451.) 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__: 1cd2. 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: ライブラリ<122>,  Next: Core and Builtins<120>,  Prev: Core and Builtins<119>,  Up: Python 3 10 0 beta 1

1.24.47.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<120>,  Next: ライブラリ<123>,  Prev: ライブラリ<122>,  Up: Python 3 10 0 beta 1

1.24.47.6 Core and Builtins
...........................

   - bpo-43682(1): Static methods (*note @staticmethod: 451.) 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: f6c. 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: ライブラリ<123>,  Next: ドキュメント<40>,  Prev: Core and Builtins<120>,  Up: Python 3 10 0 beta 1

1.24.47.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: 1cd6. 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(): 320.  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(): 8c1. receives
     no namespace dictionary arguments, ‘typing.get_type_hints()’ 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: 108. 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(): 10f2.
     now returns a consistent error message when cadata contains no
     valid certificate.

   - bpo-43607(15): *note urllib: 10f. can now convert Windows paths
     with ‘\\?\’ prefixes into URL paths.

   - bpo-43817(16): Add *note inspect.get_annotations(): a18, 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.  ‘inspect.get_annotations()’ can also correctly un-stringize
     stringized annotations.

     *note inspect.signature(): 231, ‘inspect.from_callable()’, and
     ‘inspect.from_function()’ now call *note inspect.get_annotations():
     a18. to retrieve annotations.  This means ‘inspect.signature()’ 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: f40. 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: a6a,
     *note gzip.GzipFile: 65c, and *note lzma.LZMAFile: 1212.  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(): 8c1. 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: 268, 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(): 2af.) and builtin assert functions (e.g.
     assert_called_once_with) will unconditionally pass.

   - bpo-43794(37): Add *note ssl.OP_IGNORE_UNEXPECTED_EOF: a3c.
     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: 10b.
     module by adding ‘TypeGuard’.

   - bpo-25264(43): *note os.path.realpath(): 264. now accepts a
     'strict' keyword-only argument.  When set to ‘True’, *note OSError:
     2c2. 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: 9cd. and *note typing.ParamSpecKwargs: 9ce,
     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(): a04. and *note fileinput.FileInput: 944.

   - 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__: 1cd2.
     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(): 35c.

        - ‘activeCount’ => *note threading.active_count(): 35d.

        - ‘Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 357.

        - ‘Event.isSet’ => *note threading.Event.is_set(): 358.

        - ‘Thread.setName’ => *note threading.Thread.name: 2a2.

        - ‘thread.getName’ => *note threading.Thread.name: 2a2.

        - ‘Thread.isDaemon’ => *note threading.Thread.daemon: 35a.

        - ‘Thread.setDaemon’ => *note threading.Thread.daemon: 35a.

     Patch by Jelle Zijlstra.

   - bpo-2135(53): Deprecate find_module() and find_loader()
     implementations in importlib and zipimport.

   - bpo-43534(54): *note turtle.textinput(): 1cd7. and *note
     turtle.numinput(): 1cd8. 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:
     d7a.  OpenSSL does not copy hostflags from 'struct SSL_CTX' to
     'struct SSL'.

   - bpo-8978(57): Improve error message for *note tarfile.open(): 107b.
     when *note lzma: 8e. / *note bz2: 14. are unavailable.  Patch by
     Anthony Sottile.

   - bpo-42967(58): Allow *note bytes: 193. ‘separator’ argument in
     ‘urllib.parse.parse_qs’ and ‘urllib.parse.parse_qsl’ when parsing
     *note str: 16a. 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: 1772.  Patch by Erlend E. Aasland.

   - bpo-43312(60): New functions *note
     sysconfig.get_preferred_scheme(): 8a0. and *note
     sysconfig.get_default_scheme(): 1c12. are added to query a platform
     for its preferred "user", "home", and "prefix" (default) scheme
     names.

   - bpo-43265(61): Improve *note sqlite3.Connection.backup(): d77.
     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(): 8c1. 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():
     2f4. without running event loop.  Emit deprecation warning for
     *note asyncio: b. functions which implicitly create a *note Future:
     dca. or *note Task: 1c9. objects if there is no running event loop
     and no explicit 'loop' argument is passed: *note ensure_future():
     e75, *note wrap_future(): 1cd9, *note gather(): 813, *note
     shield(): c69, *note as_completed(): 4c6. and constructors of
     ‘Future’, ‘Task’, *note StreamReader: 17d7, ‘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: 13a. 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(): a41.
     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():
     1acb.  Patch by Claudiu Popa.

   - bpo-40849(76): Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag

   - bpo-35114(77): *note ssl.RAND_status(): 1cda. now returns a boolean
     value (as documented) instead of ‘1’ or ‘0’.

   - bpo-39906(78): *note pathlib.Path.stat(): a28. and *note chmod():
     a29. 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(): c0d. 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(): 1046. and *note home(): 1047. now
     consistently raise *note RuntimeError: 246. 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(): a41.

   - 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: 1ab9. type: embedded null characters would cause
     a *note ValueError: 2ee. 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: ドキュメント<40>,  Next: テスト<40>,  Prev: ライブラリ<123>,  Up: Python 3 10 0 beta 1

1.24.47.8 ドキュメント
......................

   - bpo-43987(1): Add "Annotations Best Practices" document as a new
     HOWTO.

   - bpo-43977(2): Document the new *note Py_TPFLAGS_MAPPING: 1cb5. and
     *note Py_TPFLAGS_SEQUENCE: 1cb6. 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: テスト<40>,  Next: ビルド<47>,  Prev: ドキュメント<40>,  Up: Python 3 10 0 beta 1

1.24.47.9 テスト
................

   - bpo-43961(1): Fix test_logging.test_namer_rotator_inheritance() on
     Windows: use *note os.replace(): 130e. rather than *note
     os.rename(): 130d.  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(): a4f.  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: ビルド<47>,  Next: Windows<40>,  Prev: テスト<40>,  Up: Python 3 10 0 beta 1

1.24.47.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<40>,  Next: macOS<31>,  Prev: ビルド<47>,  Up: Python 3 10 0 beta 1

1.24.47.11 Windows
..................

   - bpo-35306(1): Adds additional arguments to *note os.startfile():
     1cdf. function.

   - bpo-43538(2): Avoid raising errors from *note
     pathlib.Path.exists(): c0f. when passed an invalid filename.

   - bpo-38822(3): Fixed *note os.stat(): 26f. 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(): c07. and *note os.path.isdir(): c09.

   - bpo-26227(4): Fixed decoding of host names in *note
     socket.gethostbyaddr(): 1ce0. and *note socket.gethostbyname_ex():
     1ce1.

   - 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<31>,  Next: IDLE<21>,  Prev: Windows<40>,  Up: Python 3 10 0 beta 1

1.24.47.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<21>,  Next: C API<41>,  Prev: macOS<31>,  Up: Python 3 10 0 beta 1

1.24.47.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<41>,  Prev: IDLE<21>,  Up: Python 3 10 0 beta 1

1.24.47.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(): aa8, *note PyGC_Disable():
     aa9, *note PyGC_IsEnabled(): aaa, corresponding to the functions in
     the *note gc: 64. module.

   - bpo-43908(5): Introduce *note Py_TPFLAGS_IMMUTABLETYPE: 3cd. flag
     for immutable type objects, and modify *note PyType_Ready(): 984.
     to set it for static types.  Patch by Erlend E. Aasland.

   - bpo-43795(6): *note PyMem_Calloc(): 10b1. 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): aa4. 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(): aa5, *note Py_IsTrue(): aa6, *note
     Py_IsFalse(): aa7. 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.48 Python 3.10.0 alpha 7
-----------------------------

'Release date: 2021-04-05'

* Menu:

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<124>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<125>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<41>.
* ビルド: ビルド<48>.
* Windows: Windows<41>.
* IDLE: IDLE<22>.
* C API: C API<42>.


File: python.info,  Node: セキュリティ<36>,  Next: Core and Builtins<121>,  Up: Python 3 10 0 alpha 7

1.24.48.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: afa. instances to ‘True’ to re-enable it.

   - bpo-43439(4): Add audit hooks for *note gc.get_objects(): a08,
     *note gc.get_referrers(): a09. and *note gc.get_referents(): a0a.
     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<121>,  Next: ライブラリ<124>,  Prev: セキュリティ<36>,  Up: Python 3 10 0 alpha 7

1.24.48.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: ライブラリ<124>,  Next: Core and Builtins<122>,  Prev: Core and Builtins<121>,  Up: Python 3 10 0 alpha 7

1.24.48.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<122>,  Next: ライブラリ<125>,  Prev: ライブラリ<124>,  Up: Python 3 10 0 alpha 7

1.24.48.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: 18f.
     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(): dc4. 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: 13db.  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__(): 151c. 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: ライブラリ<125>,  Next: ドキュメント<41>,  Prev: Core and Builtins<122>,  Up: Python 3 10 0 alpha 7

1.24.48.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: c50. no longer
     ignores query and fragment in the URL of the server.

   - bpo-31956(3): The *note index(): 9e5. 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: 355.
     debug callback with *note ssl.SSLContext.sni_callback(): 1794.

   - 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: 9c3. 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(): a2d. 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(): 1ceb. 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:
     a46.  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(): 1450. 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:
     215. 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: 1772. 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(): 19b0. 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(): 1cec. 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(): c55. 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: 1ced. 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():
     1cee. and *note tempfile.gettempdirb(): 1cef. functions 'always'
     return ‘str’ and ‘bytes’ respectively.

   - bpo-39342(44): Expose ‘X509_V_FLAG_ALLOW_PROXY_CERTS’ as *note
     VERIFY_ALLOW_PROXY_CERTS: 1cf0. 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: ドキュメント<41>,  Next: テスト<41>,  Prev: ライブラリ<125>,  Up: Python 3 10 0 alpha 7

1.24.48.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(): c7e, *note time.process_time():
     c7f, or *note time.thread_time(): b34. 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: テスト<41>,  Next: ビルド<48>,  Prev: ドキュメント<41>,  Up: Python 3 10 0 alpha 7

1.24.48.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: ビルド<48>,  Next: Windows<41>,  Prev: テスト<41>,  Up: Python 3 10 0 alpha 7

1.24.48.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<41>,  Next: IDLE<22>,  Prev: ビルド<48>,  Up: Python 3 10 0 alpha 7

1.24.48.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<22>,  Next: C API<42>,  Prev: Windows<41>,  Up: Python 3 10 0 alpha 7

1.24.48.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<42>,  Prev: IDLE<22>,  Up: Python 3 10 0 alpha 7

1.24.48.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: aa3. 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.49 Python 3.10.0 alpha 6
-----------------------------

'Release date: 2021-03-01'

* Menu:

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<126>.
* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<128>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<42>.
* ビルド: ビルド<49>.
* Windows: Windows<42>.
* macOS: macOS<32>.
* IDLE: IDLE<23>.
* C API: C API<43>.


File: python.info,  Node: セキュリティ<37>,  Next: Core and Builtins<123>,  Up: Python 3 10 0 alpha 6

1.24.49.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<123>,  Next: ライブラリ<126>,  Prev: セキュリティ<37>,  Up: Python 3 10 0 alpha 6

1.24.49.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(): aa1. function to
     the C-API to check if an object is an instance of *note set: 185.
     but not an instance of a subtype.  Patch by Pablo Galindo.

   - bpo-42990(5): The *note types.FunctionType: a87. 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: 18f. 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: ライブラリ<126>,  Next: Core and Builtins<124>,  Prev: Core and Builtins<123>,  Up: Python 3 10 0 alpha 6

1.24.49.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<124>,  Next: ライブラリ<127>,  Prev: ライブラリ<126>,  Up: Python 3 10 0 alpha 6

1.24.49.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: ライブラリ<127>,  Next: Core and Builtins<125>,  Prev: Core and Builtins<124>,  Up: Python 3 10 0 alpha 6

1.24.49.5 ライブラリ
....................

   - bpo-40692(1): In the *note concurrent.futures.ProcessPoolExecutor:
     1d8, 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<125>,  Next: ライブラリ<128>,  Prev: ライブラリ<127>,  Up: Python 3 10 0 alpha 6

1.24.49.6 Core and Builtins
...........................

   - bpo-38302(1): If *note object.__ipow__(): 9d7. returns *note
     NotImplemented: 1a3, the operator will correctly fall back to *note
     object.__pow__(): 9d8. and *note object.__rpow__(): 1a6. as
     expected.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38302


File: python.info,  Node: ライブラリ<128>,  Next: ドキュメント<42>,  Prev: Core and Builtins<125>,  Up: Python 3 10 0 alpha 6

1.24.49.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(): a53. and *note format_exception(): a51.

   - 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:
     1772.  Patch by Erlend E. Aasland.

   - bpo-40956(7): Fix segfault in *note sqlite3.Connection.backup():
     d77. 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(): 1cff. and *note
     readline.get_endidx(): 1d00. 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: 105. 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: a1f, *note O_FSYNC: a20,
     *note O_SYMLINK: a21. and *note O_NOFOLLOW_ANY: a22. for macOS.
     Patch by Donghee Na.

   - bpo-42960(14): Adds *note resource.RLIMIT_KQUEUES: 1d01. constant
     from FreeBSD to the *note resource: c1. module.

   - bpo-42151(15): Make the pure Python implementation of *note
     xml.etree.ElementTree: 12c. 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: ドキュメント<42>,  Next: テスト<42>,  Prev: ライブラリ<128>,  Up: Python 3 10 0 alpha 6

1.24.49.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: テスト<42>,  Next: ビルド<49>,  Prev: ドキュメント<42>,  Up: Python 3 10 0 alpha 6

1.24.49.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: ビルド<49>,  Next: Windows<42>,  Prev: テスト<42>,  Up: Python 3 10 0 alpha 6

1.24.49.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<42>,  Next: macOS<32>,  Prev: ビルド<49>,  Up: Python 3 10 0 alpha 6

1.24.49.11 Windows
..................

   - bpo-43155(1): *note PyCMethod_New(): 1d06. is now present in
     ‘python3.lib’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43155


File: python.info,  Node: macOS<32>,  Next: IDLE<23>,  Prev: Windows<42>,  Up: Python 3 10 0 alpha 6

1.24.49.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<23>,  Next: C API<43>,  Prev: macOS<32>,  Up: Python 3 10 0 alpha 6

1.24.49.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<43>,  Prev: IDLE<23>,  Up: Python 3 10 0 alpha 6

1.24.49.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(): 1d0a. 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: 98b.

   - 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: 98b.

   - bpo-40170(5): *note PyExceptionClass_Name(): c5f. is now always
     declared as a function, in order to hide implementation details.
     The macro accessed *note PyTypeObject.tp_name: 1d0b. directly.
     Patch by Erlend E. Aasland.

   - bpo-43239(6): The *note PyCFunction_New(): 1d0c. function is now
     exported in the ABI when compiled with ‘-fvisibility=hidden’.

   - bpo-40170(7): *note PyIter_Check(): 1d0d. is now always declared as
     a function, in order to hide implementation details.  The macro
     accessed *note PyTypeObject.tp_iternext: 170e. directly.  Patch by
     Erlend E. Aasland.

   - bpo-40170(8): Convert *note PyDescr_IsData(): 1d0e. macro to a
     function to hide implementation details: The macro accessed *note
     PyTypeObject.tp_descr_set: 1d0f. directly.  Patch by Erlend E.
     Aasland.

   - bpo-43181(9): Convert *note PyObject_TypeCheck(): 1d10. 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.50 Python 3.10.0 alpha 5
-----------------------------

'Release date: 2021-02-02'

* Menu:

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<129>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<130>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<43>.
* ビルド: ビルド<50>.
* Windows: Windows<43>.
* macOS: macOS<33>.
* IDLE: IDLE<24>.
* C API: C API<44>.


File: python.info,  Node: セキュリティ<38>,  Next: Core and Builtins<126>,  Up: Python 3 10 0 alpha 5

1.24.50.1 セキュリティ
......................

   - bpo-42938(1): Avoid static buffers when computing the repr of *note
     ctypes.c_double: 1d13. and *note ctypes.c_longdouble: 1d14. values.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42938


File: python.info,  Node: Core and Builtins<126>,  Next: ライブラリ<129>,  Prev: セキュリティ<38>,  Up: Python 3 10 0 alpha 5

1.24.50.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(): b7e. 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(): 45e. / *note
     Py_Finalize(): 45d. 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: 18f. 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: ライブラリ<129>,  Next: Core and Builtins<127>,  Prev: Core and Builtins<126>,  Up: Python 3 10 0 alpha 5

1.24.50.3 ライブラリ
....................

   - bpo-37324(1): Remove deprecated aliases to *note
     コレクション抽象基底クラス: a7c. from the *note collections: 1e.
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37324


File: python.info,  Node: Core and Builtins<127>,  Next: ライブラリ<130>,  Prev: ライブラリ<129>,  Up: Python 3 10 0 alpha 5

1.24.50.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: ライブラリ<130>,  Next: ドキュメント<43>,  Prev: Core and Builtins<127>,  Up: Python 3 10 0 alpha 5

1.24.50.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: 102. 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: a46, 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: 1383. 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(): b7e. 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: 126b.

   - 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: ドキュメント<43>,  Next: テスト<43>,  Prev: ライブラリ<130>,  Up: Python 3 10 0 alpha 5

1.24.50.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: テスト<43>,  Next: ビルド<50>,  Prev: ドキュメント<43>,  Up: Python 3 10 0 alpha 5

1.24.50.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: ビルド<50>,  Next: Windows<43>,  Prev: テスト<43>,  Up: Python 3 10 0 alpha 5

1.24.50.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<43>,  Next: macOS<33>,  Prev: ビルド<50>,  Up: Python 3 10 0 alpha 5

1.24.50.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<33>,  Next: IDLE<24>,  Prev: Windows<43>,  Up: Python 3 10 0 alpha 5

1.24.50.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<24>,  Next: C API<44>,  Prev: macOS<33>,  Up: Python 3 10 0 alpha 5

1.24.50.11 IDLE
...............

   - bpo-43008(1): Make IDLE invoke *note sys.excepthook(): a10. 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<44>,  Prev: IDLE<24>,  Up: Python 3 10 0 alpha 5

1.24.50.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(): 1d20. 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.51 Python 3.10.0 alpha 4
-----------------------------

'Release date: 2021-01-04'

* Menu:

* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<131>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<133>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<44>.
* ビルド: ビルド<51>.
* macOS: macOS<34>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<45>.


File: python.info,  Node: Core and Builtins<128>,  Next: ライブラリ<131>,  Up: Python 3 10 0 alpha 4

1.24.51.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: 1a9. 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: ライブラリ<131>,  Next: Core and Builtins<129>,  Prev: Core and Builtins<128>,  Up: Python 3 10 0 alpha 4

1.24.51.2 ライブラリ
....................

   - bpo-42639(1): Make the *note atexit: d. module state
     per-interpreter.  It is now safe have more than one ‘atexit’ 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<129>,  Next: ライブラリ<132>,  Prev: ライブラリ<131>,  Up: Python 3 10 0 alpha 4

1.24.51.3 Core and Builtins
...........................

   - bpo-32381(1): Fix encoding name when running a ‘.pyc’ file on
     Windows: *note PyRun_SimpleFileExFlags(): 1d25. now uses the
     correct encoding to decode the filename.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32381


File: python.info,  Node: ライブラリ<132>,  Next: Core and Builtins<130>,  Prev: Core and Builtins<129>,  Up: Python 3 10 0 alpha 4

1.24.51.4 ライブラリ
....................

   - bpo-42195(1): The ‘__args__’ of the parameterized generics for
     *note typing.Callable: 9cc. and *note collections.abc.Callable:
     9ef. are now consistent.  The ‘__args__’ for
     ‘collections.abc.Callable’ are now flattened while
     ‘typing.Callable’'s have not changed.  To allow this change, *note
     types.GenericAlias: 9f0. 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<130>,  Next: ライブラリ<133>,  Prev: ライブラリ<132>,  Up: Python 3 10 0 alpha 4

1.24.51.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: ライブラリ<133>,  Next: ドキュメント<44>,  Prev: Core and Builtins<130>,  Up: Python 3 10 0 alpha 4

1.24.51.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 *note tkinter.Variable:
     1d29. and *note tkinter.font.Font: 1d2a.  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(): 2ae. and *note
     typing.get_origin(): 2ad. 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: ff.), message boxes (*note
     tkinter.messagebox: fd.) 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
     *note NoDefaultRoot(): 1d2b. 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(): 1d2c.

   - bpo-35728(14): Added a root parameter to *note
     tkinter.font.nametofont(): 1d2d.

   - 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(): 1d2e.).  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: 246. with
     descriptive message instead of obscure *note AttributeError: 5f0.
     or *note NameError: 450. 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: b37. 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(): a82. 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: 10b.  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(): e16. adds line number
     information (if available) in error message for malformed nodes.

   - bpo-42470(39): *note random.sample(): 951. 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: 105. and
     the interpreter in formatting of SyntaxError with lineno not set
     (‘traceback’ was changed to match interpreter).

   - bpo-42393(43): Raise *note OverflowError: a85. instead of silent
     truncation in *note socket.ntohs(): a84. and *note socket.htons():
     a83.  Silent truncation was deprecated in Python 3.7.  Patch by
     Erlend E. Aasland

   - bpo-42222(44): Harmonized *note random.randrange(): a6f. argument
     handling to match *note range(): b41.

        * The integer test and conversion in ‘randrange()’ now uses
          *note operator.index(): 1d2f.

        * 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 *note os.uname_result:
     1b6d. 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: 330. 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(): 231. and *note
     inspect.Signature.from_callable(): 946.

   - 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(): 103e. support for
     VxWorks RTOS.

   - bpo-40219(56): Lowered *note tkinter.ttk.LabeledScale: 1d30. 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: ドキュメント<44>,  Next: テスト<44>,  Prev: ライブラリ<133>,  Up: Python 3 10 0 alpha 4

1.24.51.7 ドキュメント
......................

   - bpo-17140(1): Add documentation for the *note
     multiprocessing.pool.ThreadPool: 1d32. 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: テスト<44>,  Next: ビルド<51>,  Prev: ドキュメント<44>,  Up: Python 3 10 0 alpha 4

1.24.51.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: ビルド<51>,  Next: macOS<34>,  Prev: テスト<44>,  Up: Python 3 10 0 alpha 4

1.24.51.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<34>,  Next: Tools/Demos<28>,  Prev: ビルド<51>,  Up: Python 3 10 0 alpha 4

1.24.51.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<45>,  Prev: macOS<34>,  Up: Python 3 10 0 alpha 4

1.24.51.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<45>,  Prev: Tools/Demos<28>,  Up: Python 3 10 0 alpha 4

1.24.51.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.52 Python 3.10.0 alpha 3
-----------------------------

'リリース日: 2020-12-07'

* Menu:

* セキュリティ: セキュリティ<39>.
* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<134>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<135>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<137>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<45>.
* ビルド: ビルド<52>.
* Windows: Windows<44>.
* macOS: macOS<35>.
* IDLE: IDLE<25>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<46>.


File: python.info,  Node: セキュリティ<39>,  Next: Core and Builtins<131>,  Up: Python 3 10 0 alpha 3

1.24.52.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<131>,  Next: ライブラリ<134>,  Prev: セキュリティ<39>,  Up: Python 3 10 0 alpha 3

1.24.52.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: 1842.:

        - *note collections.OrderedDict.items(): 7f3.

        - *note dict.items(): 9d6.

        - *note enumerate(): 169f.

        - *note functools.reduce(): 21c.

        - *note itertools.combinations(): 152d.

        - *note itertools.combinations_with_replacement(): 149d.

        - *note itertools.permutations(): 1d3b.

        - *note itertools.product(): 152e.

        - *note itertools.zip_longest(): 14ba.

        - *note zip(): 1a1.

     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: ライブラリ<134>,  Next: Core and Builtins<132>,  Prev: Core and Builtins<131>,  Up: Python 3 10 0 alpha 3

1.24.52.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<132>,  Next: ライブラリ<135>,  Prev: ライブラリ<134>,  Up: Python 3 10 0 alpha 3

1.24.52.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: abf. 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: 9f0. 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: ライブラリ<135>,  Next: Core and Builtins<133>,  Prev: Core and Builtins<132>,  Up: Python 3 10 0 alpha 3

1.24.52.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<133>,  Next: ライブラリ<136>,  Prev: ライブラリ<135>,  Up: Python 3 10 0 alpha 3

1.24.52.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: ライブラリ<136>,  Next: Core and Builtins<134>,  Prev: Core and Builtins<133>,  Up: Python 3 10 0 alpha 3

1.24.52.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<134>,  Next: ライブラリ<137>,  Prev: ライブラリ<136>,  Up: Python 3 10 0 alpha 3

1.24.52.8 Core and Builtins
...........................

   - bpo-42233(1): Allow ‘GenericAlias’ objects to use *note union type
     expressions: 9c9.  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: ライブラリ<137>,  Next: ドキュメント<45>,  Prev: Core and Builtins<134>,  Up: Python 3 10 0 alpha 3

1.24.52.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: 2c2.
     instead of *note IndexError: 1753. 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(): 182e.

   - 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(): a2b.
     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: 1146. respect
     subclassing.  Now the *note filecmp.dircmp.subdirs: 1d43. behaves
     as expected when subclassing dircmp.

   - bpo-42413(19): The exception *note socket.timeout: a39. is now an
     alias of *note TimeoutError: a3a.

   - 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__(): ad5. 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():
     c7e. 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(): 1d44.  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(): c7e. 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():
     ce2. and *note time.monotonic_ns(): ce1. 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: 177. 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__: a4e. to allow
     retrieving the original value of *note threading.excepthook(): a4f.
     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:
     16a.  It is now deprecated, scheduled for removal in Python 3.12.

   - bpo-42251(40): Added *note threading.gettrace(): a4a. and *note
     threading.getprofile(): a4b. to retrieve the functions set by *note
     threading.settrace(): a4c. and *note threading.setprofile(): a4d.
     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(): 1c92.
     function now returns ‘'UTF-8'’ rather than the device encoding if
     the *note Python UTF-8 Mode: 867. 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(): a51, *note
     traceback.format_exception_only(): a52, and *note
     traceback.print_exception(): a53. 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(): 1d45.
     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(): a1e. in
     the *note os: a5. module.  Patch by Pablo Galindo

   - bpo-34215(55): Clarify the error message for *note
     asyncio.IncompleteReadError: 1d46. when ‘expected’ is ‘None’.

   - bpo-41543(56): Add async context manager support for
     contextlib.nullcontext.

   - bpo-21041(57): *note pathlib.PurePath.parents: a25. 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: 112. 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(): a1d. 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:
     a25.

   ---------- 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: ドキュメント<45>,  Next: テスト<45>,  Prev: ライブラリ<137>,  Up: Python 3 10 0 alpha 3

1.24.52.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: テスト<45>,  Next: ビルド<52>,  Prev: ドキュメント<45>,  Up: Python 3 10 0 alpha 3

1.24.52.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: ビルド<52>,  Next: Windows<44>,  Prev: テスト<45>,  Up: Python 3 10 0 alpha 3

1.24.52.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<44>,  Next: macOS<35>,  Prev: ビルド<52>,  Up: Python 3 10 0 alpha 3

1.24.52.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<35>,  Next: IDLE<25>,  Prev: Windows<44>,  Up: Python 3 10 0 alpha 3

1.24.52.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<25>,  Next: Tools/Demos<29>,  Prev: macOS<35>,  Up: Python 3 10 0 alpha 3

1.24.52.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<46>,  Prev: IDLE<25>,  Up: Python 3 10 0 alpha 3

1.24.52.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<46>,  Prev: Tools/Demos<29>,  Up: Python 3 10 0 alpha 3

1.24.52.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(): 3c7. and *note Py_SIZE():
     989. 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: abf.  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(): 3e1, *note Py_GetPrefix(): 3e3,
     *note Py_GetExecPrefix(): 3e7, *note Py_GetProgramFullPath(): 3ea,
     *note Py_GetPythonHome(): 3ed. and *note Py_GetProgramName(): 3ec.
     functions now return ‘NULL’ if called before *note Py_Initialize():
     45e. (before Python is initialized).  Use the new *note Python
     Initialization Configuration API: 646. to get the *note Python Path
     Configuration.: aae.  Patch by Victor Stinner.

   - bpo-42260(28): The *note PyConfig_Read(): 997. function now only
     parses *note PyConfig.argv: 3ef. arguments once: *note
     PyConfig.parse_argv: 1d4f. is set to ‘2’ after arguments are
     parsed.  Since Python arguments are strippped from ‘PyConfig.argv’,
     parsing arguments twice would parse the application options as
     Python options.

   - bpo-42262(29): Added *note Py_NewRef(): a9e. and *note
     Py_XNewRef(): a9f. functions to increment the reference count of an
     object and return the object.  Patch by Victor Stinner.

   - bpo-42260(30): When *note Py_Initialize(): 45e. is called twice,
     the second call now updates more *note sys: df. attributes for the
     configuration, rather than only *note sys.argv: 1480.  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: 19fd. calling convention is
     added to the limited API. The functions *note PyModule_AddType():
     b70, *note PyType_FromModuleAndSpec(): 773, *note
     PyType_GetModule(): b6a. and *note PyType_GetModuleState(): b6b.
     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(): aa0. can now accept static
     types.

   - bpo-30459(36): *note PyList_SET_ITEM(): 62f, *note
     PyTuple_SET_ITEM(): 62e. and *note PyCell_SET(): aaf. 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.53 Python 3.10.0 alpha 2
-----------------------------

'Release date: 2020-11-03'

* Menu:

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<138>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<139>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<46>.
* ビルド: ビルド<53>.
* Windows: Windows<45>.
* macOS: macOS<36>.
* IDLE: IDLE<26>.
* C API: C API<47>.


File: python.info,  Node: セキュリティ<40>,  Next: Core and Builtins<135>,  Up: Python 3 10 0 alpha 2

1.24.53.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<135>,  Next: ライブラリ<138>,  Prev: セキュリティ<40>,  Up: Python 3 10 0 alpha 2

1.24.53.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: 18f. 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: 198. class.
     They always raised a *note TypeError: 199.

   - bpo-41902(16): Micro optimization when compute *note sq_item: 1d53.
     and *note mp_subscript: 1d54. of *note range: b41.  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: ライブラリ<138>,  Next: Core and Builtins<136>,  Prev: Core and Builtins<135>,  Up: Python 3 10 0 alpha 2

1.24.53.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<136>,  Next: ライブラリ<139>,  Prev: ライブラリ<138>,  Up: Python 3 10 0 alpha 2

1.24.53.4 Core and Builtins
...........................

   - bpo-38605(1): Enable ‘from __future__ import annotations’ ( PEP
     563(2)) by default.  The values found in *note __annotations__:
     456. 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: ライブラリ<139>,  Next: ドキュメント<46>,  Prev: Core and Builtins<136>,  Up: Python 3 10 0 alpha 2

1.24.53.5 ライブラリ
....................

   - bpo-35455(1): On Solaris, *note thread_time(): b34. 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(): 1c3. of *note typing: 10b. types
     containing *note Generic Alias Types: 8c2. 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: 1cb0. class now keeps
     a reference to the builtin *note open(): 318. 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: 10c. 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: 1d58. and *note
     RecursionError: f6c. 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: 1fd.
     subclasses.  Patch by Dean Inwood.

   - bpo-19270(16): *note sched.scheduler.cancel(): 1d59. 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(): 16e5. 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(): f49. 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: 9d0. 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(): a01. 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: a33. 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: ドキュメント<46>,  Next: テスト<46>,  Prev: ライブラリ<139>,  Up: Python 3 10 0 alpha 2

1.24.53.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: 1d5b. and *note types: 1d5c. 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: 8c2. and *note
     types.GenericAlias: 9f0.  Also added an entry in glossary for *note
     generic types: 1a2.

   - 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: テスト<46>,  Next: ビルド<53>,  Prev: ドキュメント<46>,  Up: Python 3 10 0 alpha 2

1.24.53.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: ビルド<53>,  Next: Windows<45>,  Prev: テスト<46>,  Up: Python 3 10 0 alpha 2

1.24.53.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<45>,  Next: macOS<36>,  Prev: ビルド<53>,  Up: Python 3 10 0 alpha 2

1.24.53.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<36>,  Next: IDLE<26>,  Prev: Windows<45>,  Up: Python 3 10 0 alpha 2

1.24.53.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<26>,  Next: C API<47>,  Prev: macOS<36>,  Up: Python 3 10 0 alpha 2

1.24.53.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<47>,  Prev: IDLE<26>,  Up: Python 3 10 0 alpha 2

1.24.53.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: 16f5.'s lifetime is
     managed through the ‘self’ argument of a *note PyCFunction: 1696.

   - 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(): 1d63. 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.54 Python 3.10.0 alpha 1
-----------------------------

'Release date: 2020-10-05'

* Menu:

* セキュリティ: セキュリティ<41>.
* 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>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<151>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<152>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<153>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<154>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<47>.
* ビルド: ビルド<54>.
* Windows: Windows<46>.
* macOS: macOS<37>.
* IDLE: IDLE<27>.
* C API: C API<48>.


File: python.info,  Node: セキュリティ<41>,  Next: Core and Builtins<137>,  Up: Python 3 10 0 alpha 1

1.24.54.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<137>,  Next: ライブラリ<140>,  Prev: セキュリティ<41>,  Up: Python 3 10 0 alpha 1

1.24.54.2 Core and Builtins
...........................

   - bpo-41909(1): Fixed stack overflow in *note issubclass(): 9c8. and
     *note isinstance(): 2af. 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: ライブラリ<140>,  Next: Core and Builtins<138>,  Prev: Core and Builtins<137>,  Up: Python 3 10 0 alpha 1

1.24.54.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<138>,  Next: ライブラリ<141>,  Prev: ライブラリ<140>,  Up: Python 3 10 0 alpha 1

1.24.54.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: 9f0.
     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: ライブラリ<141>,  Next: Core and Builtins<139>,  Prev: Core and Builtins<138>,  Up: Python 3 10 0 alpha 1

1.24.54.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<139>,  Next: ライブラリ<142>,  Prev: ライブラリ<141>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<142>,  Next: Core and Builtins<140>,  Prev: Core and Builtins<139>,  Up: Python 3 10 0 alpha 1

1.24.54.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<140>,  Next: ライブラリ<143>,  Prev: ライブラリ<142>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<143>,  Next: Core and Builtins<141>,  Prev: Core and Builtins<140>,  Up: Python 3 10 0 alpha 1

1.24.54.9 ライブラリ
....................

   - bpo-41675(1): The implementation of *note signal.siginterrupt():
     1351. 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<141>,  Next: ライブラリ<144>,  Prev: ライブラリ<143>,  Up: Python 3 10 0 alpha 1

1.24.54.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: 1772.  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: ライブラリ<144>,  Next: Core and Builtins<142>,  Prev: Core and Builtins<141>,  Up: Python 3 10 0 alpha 1

1.24.54.11 ライブラリ
.....................

   - bpo-1635741(1): Port the *note zlib: 13a. 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<142>,  Next: ライブラリ<145>,  Prev: ライブラリ<144>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<145>,  Next: Core and Builtins<143>,  Prev: Core and Builtins<142>,  Up: Python 3 10 0 alpha 1

1.24.54.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<143>,  Next: ライブラリ<146>,  Prev: ライブラリ<145>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<146>,  Next: Core and Builtins<144>,  Prev: Core and Builtins<143>,  Up: Python 3 10 0 alpha 1

1.24.54.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<144>,  Next: ライブラリ<147>,  Prev: ライブラリ<146>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<147>,  Next: Core and Builtins<145>,  Prev: Core and Builtins<144>,  Up: Python 3 10 0 alpha 1

1.24.54.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<145>,  Next: ライブラリ<148>,  Prev: ライブラリ<147>,  Up: Python 3 10 0 alpha 1

1.24.54.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(): 14f6. with integer argument is now
     faster (9-60%).

   - bpo-41334(6): Constructors *note str(): 16a, *note bytes(): 193.
     and *note bytearray(): 342. 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: ライブラリ<148>,  Next: Core and Builtins<146>,  Prev: Core and Builtins<145>,  Up: Python 3 10 0 alpha 1

1.24.54.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<146>,  Next: ライブラリ<149>,  Prev: ライブラリ<148>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<149>,  Next: Core and Builtins<147>,  Prev: Core and Builtins<146>,  Up: Python 3 10 0 alpha 1

1.24.54.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<147>,  Next: ライブラリ<150>,  Prev: ライブラリ<149>,  Up: Python 3 10 0 alpha 1

1.24.54.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:
     18f.

   - 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: ライブラリ<150>,  Next: Core and Builtins<148>,  Prev: Core and Builtins<147>,  Up: Python 3 10 0 alpha 1

1.24.54.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<148>,  Next: ライブラリ<151>,  Prev: ライブラリ<150>,  Up: Python 3 10 0 alpha 1

1.24.54.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(): 1a1. now supports PEP 618(3)'s ‘strict’
     parameter, which raises a *note ValueError: 2ee. 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: 18f.
     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: ライブラリ<151>,  Next: Core and Builtins<149>,  Prev: Core and Builtins<148>,  Up: Python 3 10 0 alpha 1

1.24.54.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<149>,  Next: ライブラリ<152>,  Prev: ライブラリ<151>,  Up: Python 3 10 0 alpha 1

1.24.54.26 Core and Builtins
............................

   - bpo-40947(1): The Python *note Path Configuration: aae. now takes
     *note PyConfig.platlibdir: 1d7f. 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: 18f. for valid input due to this.  For example,
     an empty line following a line continuation character was
     interpreted as a ‘SyntaxError’.

   - 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: 2ee. when validating custom
     AST's where the constants ‘True’, ‘False’ and ‘None’ are used
     within a *note ast.Name: 1d80. node.

   - bpo-40854(11): Allow overriding *note sys.platlibdir: b36. via a
     new *note PYTHONPLATLIBDIR: 1d81. 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: 349. operator
     and functions *note contains(): adb, *note indexOf(): adc. and
     *note countOf(): add. of the *note operator: a3. module.

   - bpo-40792(16): Attributes ‘start’, ‘stop’ and ‘step’ of the *note
     range: b41. object now always has exact type *note int: 19c.
     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: 18f. in the
     expression part of an fstring, the filename attribute of the
     ‘SyntaxError’ 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(): 3c7. 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: 199. messages about missing
     or extra arguments now include the function's *note qualified name:
     1d82.  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: ライブラリ<152>,  Next: Core and Builtins<150>,  Prev: Core and Builtins<149>,  Up: Python 3 10 0 alpha 1

1.24.54.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<150>,  Next: ライブラリ<153>,  Prev: ライブラリ<152>,  Up: Python 3 10 0 alpha 1

1.24.54.28 Core and Builtins
............................

   - bpo-37999(1): Builtin and extension functions that take integer
     arguments no longer accept *note Decimal: 200.s, *note Fraction:
     215.s and other objects that can be converted to integers only with
     a loss (e.g.  that have the *note __int__(): 19e. method but do not
     have the *note __index__(): 19f. method).

   - bpo-29882(2): Add *note int.bit_count(): 9d3, 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: ライブラリ<153>,  Next: Core and Builtins<151>,  Prev: Core and Builtins<150>,  Up: Python 3 10 0 alpha 1

1.24.54.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(): 9fa. 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<151>,  Next: ライブラリ<154>,  Prev: ライブラリ<153>,  Up: Python 3 10 0 alpha 1

1.24.54.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: ライブラリ<154>,  Next: ドキュメント<47>,  Prev: Core and Builtins<151>,  Up: Python 3 10 0 alpha 1

1.24.54.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(): e16.  Also document stripping of spaces and
     tabs for *note eval(): 4a3.

   - bpo-41773(3): Note in documentation that *note random.choices():
     ec5. doesn't support non-finite weights, raise *note ValueError:
     2ee. 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(): 9ed. 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: 16e6.  It now accepts "empty" statements (only
     whitespaces and comments) and rejects misindentent statements.

   - bpo-41833(8): The *note threading.Thread: 177. 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: a55, *note
     types.NotImplementedType: a57. and *note types.NoneType: a56. 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:
     166.

   - 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():
     2f5.  This allows setting ‘PYTHONASYNCIODEBUG’ or ‘-X dev’ to
     enable asyncio debug mode when using ‘asyncio.run()’.

   - 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: 307.

   - bpo-39010(29): Restarting a ‘ProactorEventLoop’ on Windows no
     longer logs spurious ‘ConnectionResetErrors’.

   - bpo-41638(30): *note ProgrammingError: 307. 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: 126b.):
     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: 117.

   - bpo-35328(51): Set the environment variable ‘VIRTUAL_ENV_PROMPT’ at
     *note venv: 118. 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(): 135e.

   - 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:
     1823.

   - 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: 2c2. to ignore
     error if the filesystem is read-only, instead of only ignoring
     *note FileNotFoundError: 266. and *note PermissionError: f42.

   - 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: 104. 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(): 21c.

   - 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(): 1d88. 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: ae0. from being subclassed.

   - bpo-35018(81): Add the *note xml.sax.handler.LexicalHandler: a60.
     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: a45. 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: 16b5, 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: 1d89. 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 ‘functools’ 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(): 1d2f. now
     always has exact type *note int: 19c.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-40767(107): *note webbrowser: 11c. 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(): 1d8a.

   - bpo-16995(110): Add *note base64.b32hexencode(): 9e8. and *note
     base64.b32hexdecode(): 9e9. 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: 1d8b. flag for *note
     os.pwritev(): d5b.

   - 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(): 1b6b.

   - 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(): 1d8c. passed ‘usedforsecurity’
     to OpenSSL EVP constructor ‘_hashlib.new()’.  test_hashlib and
     test_smtplib handle strict security policy better.

   - bpo-40614(121): *note ast.parse(): 1c4. 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(): 17c7. 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 ‘socket.getaddrinfo()’.  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(): b70.

   - bpo-32309(126): Added a new *note coroutine: 6b9. *note
     asyncio.to_thread(): ae9.  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(): aea. that can directly take keyword arguments.

   - bpo-36543(127): Restored the deprecated ‘xml.etree.cElementTree’
     module.

   - bpo-40611(128): *note MAP_POPULATE: 1d8d. 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: 153f. 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: 199. 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(): 1380. 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: a7b. 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: ドキュメント<47>,  Next: テスト<47>,  Prev: ライブラリ<154>,  Up: Python 3 10 0 alpha 1

1.24.54.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: 1d8f.

   - 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: テスト<47>,  Next: ビルド<54>,  Prev: ドキュメント<47>,  Up: Python 3 10 0 alpha 1

1.24.54.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__(): 1d91. to ‘not_exported’.

   - bpo-41477(5): Make ctypes optional in test_genericalias.

   - bpo-41085(6): Fix integer overflow in the *note
     array.array.index(): 9e5. 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(): 1d92.
     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: ビルド<54>,  Next: Windows<46>,  Prev: テスト<47>,  Up: Python 3 10 0 alpha 1

1.24.54.34 ビルド
.................

   - bpo-38249(1): Update *note Py_UNREACHABLE: db2. 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: 13b. 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<46>,  Next: macOS<37>,  Prev: ビルド<54>,  Up: Python 3 10 0 alpha 1

1.24.54.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<37>,  Next: IDLE<27>,  Prev: Windows<46>,  Up: Python 3 10 0 alpha 1

1.24.54.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<27>,  Next: C API<48>,  Prev: macOS<37>,  Up: Python 3 10 0 alpha 1

1.24.54.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<48>,  Prev: IDLE<27>,  Up: Python 3 10 0 alpha 1

1.24.54.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: abe. structure.

   - bpo-41692(2): The ‘PyUnicode_InternImmortal()’ function is now
     deprecated and will be removed in Python 3.12: use *note
     PyUnicode_InternInPlace(): ab2. instead.  Patch by Victor Stinner.

   - bpo-41842(3): Add *note PyCodec_Unregister(): a9b. 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: abe. 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(): 1d98. and *note
     PyOS_mystricmp(): 1d99. 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(): a99. and
     *note PyDateTime_TIME_GET_TZINFO(): a9a. macros for accessing the
     ‘tzinfo’ attributes of *note datetime.datetime: 4e2. and *note
     datetime.time: 1fd. objects.

   - bpo-40170(9): Revert *note PyType_HasFeature(): 1d9a. change: it
     reads again directly the *note PyTypeObject.tp_flags: 1cce. member
     when the limited C API is not used, rather than always calling
     *note PyType_GetFlags(): 1d9b. 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(): 1d9c. and *note
     PyObject_INIT_VAR(): 1d9d. macros become aliases to, respectively,
     *note PyObject_Init(): c64. and *note PyObject_InitVar(): 1d9e.
     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(): 3bf. and *note Py_BuildValue(): 3c0.
     formats which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’
     and ‘Z#’.  See *note Parsing arguments and building values: 3d3.
     and the PEP 353(20).

   - bpo-40910(21): Export explicitly the *note Py_GetArgcArgv(): 1d9f.
     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: 165. held had been allowed for historical reason.  It is no
     longer allowed.

   - bpo-40826(25): *note PyOS_InterruptOccurred(): 1da0. now fails with
     a fatal error if it is called with the GIL released.

   - bpo-40792(26): The result of *note PyNumber_Index(): a97. now
     always has exact type *note int: 19c.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-39573(27): Convert *note Py_REFCNT(): 2d1. and *note Py_SIZE():
     989. macros to static inline functions.  They cannot be used as
     l-value anymore: use *note Py_SET_REFCNT(): aac. and *note
     Py_SET_SIZE(): 98a. 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.55 Python 3.9.0 beta 1
---------------------------

'リリース日: 2020-05-19'

* Menu:

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<48>.
* テスト: テスト<48>.
* ビルド: ビルド<55>.
* Windows: Windows<47>.
* macOS: macOS<38>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<49>.


File: python.info,  Node: セキュリティ<42>,  Next: Core and Builtins<152>,  Up: Python 3 9 0 beta 1

1.24.55.1 セキュリティ
......................

   - bpo-40501(1): *note uuid: 117. 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<152>,  Next: ライブラリ<155>,  Prev: セキュリティ<42>,  Up: Python 3 9 0 beta 1

1.24.55.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(): 1da4. 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(): 1bb2. 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(): a69. to *note weakref.proxy: c4a. 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():
     b40. 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: ライブラリ<155>,  Next: ドキュメント<48>,  Prev: Core and Builtins<152>,  Up: Python 3 9 0 beta 1

1.24.55.3 ライブラリ
....................

   - bpo-40662(1): Fixed *note ast.get_source_segment(): bcf. 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(): 1da6. function
     to the *note zoneinfo: 13b. module.  Patch by Paul Ganssle.

   - bpo-40645(4): The *note hmac.HMAC: d37. 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(): bf1.

   - 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: 13b. 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: 1c9. 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(): be6. objects can now be
     the targets of weakrefs.

   - bpo-40559(23): Fix possible memory leak in the C implementation of
     *note asyncio.Task: 1c9.

   - 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():
     e16. in the presence of malformed *note ast.Dict: 1da7. 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(): 1da8. now produces
     correct 'ptype' strings instead of empty strings.

   - bpo-39435(30): The first argument of *note pickle.loads(): f11. 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(): 1da9.

   - 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(): b15. method to the *note
     SimpleQueue: b14. class to explicitly close the queue.

   - bpo-39966(39): Revert bpo-25597(40).  *note
     unittest.mock.MagicMock: 1093. 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(): b07. 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(): b34. 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:
     1fc. 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: ドキュメント<48>,  Next: テスト<48>,  Prev: ライブラリ<155>,  Up: Python 3 9 0 beta 1

1.24.55.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():
     f11. 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: テスト<48>,  Next: ビルド<55>,  Prev: ドキュメント<48>,  Up: Python 3 9 0 beta 1

1.24.55.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: ビルド<55>,  Next: Windows<47>,  Prev: テスト<48>,  Up: Python 3 9 0 beta 1

1.24.55.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<47>,  Next: macOS<38>,  Prev: ビルド<55>,  Up: Python 3 9 0 beta 1

1.24.55.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<38>,  Next: Tools/Demos<30>,  Prev: Windows<47>,  Up: Python 3 9 0 beta 1

1.24.55.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<49>,  Prev: macOS<38>,  Up: Python 3 9 0 beta 1

1.24.55.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<49>,  Prev: Tools/Demos<30>,  Up: Python 3 9 0 beta 1

1.24.55.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(): 995. function now
     returns a strong reference to the frame.

   - bpo-40428(6): Remove the following functions from the C API. Call
     *note PyGC_Collect(): b89. 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(): 98d. function: get the
     frame next outer frame.

   - bpo-40421(8): New *note PyFrame_GetCode(): 991. 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: 986.).  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.56 Python 3.9.0 alpha 6
----------------------------

'リリース日: 2020-04-27'

* Menu:

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


File: python.info,  Node: セキュリティ<43>,  Next: Core and Builtins<153>,  Up: Python 3 9 0 alpha 6

1.24.56.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:
     1ccc. class of the *note urllib.request: 112. 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<153>,  Next: ライブラリ<156>,  Prev: セキュリティ<43>,  Up: Python 3 9 0 alpha 6

1.24.56.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(): 19f0.
     ‘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: ライブラリ<156>,  Next: ドキュメント<49>,  Prev: Core and Builtins<153>,  Up: Python 3 9 0 alpha 6

1.24.56.3 ライブラリ
....................

   - bpo-40398(1): *note typing.get_args(): 2ae. now always returns an
     empty tuple for special generic aliases.

   - bpo-40396(2): Functions *note typing.get_origin(): 2ad, *note
     typing.get_args(): 2ae. and *note typing.get_type_hints(): 8c1.
     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():
     f9e. 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: 10d. only when the *note assertLogs(): a5d.
     assertion is used.

   - bpo-40275(10): The *note asyncio: b. package is now imported lazily
     in *note unittest: 10d. only when the *note
     IsolatedAsyncioTestCase: 35f. 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: 10b. 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(): bf1. 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(): 188c. function and
     *note random.Random.randbytes(): b27. 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(): 17c4. 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: 1d8. 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: 32f. class.

   - bpo-36517(32): Multiple inheritance with *note typing.NamedTuple:
     32f. 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(): b1b.
     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: 32c. and
     *note threading.Condition: 1371. 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: 1374. to ‘_at_fork_reinit()’.

   - bpo-25780(39): Expose *note CAN_RAW_JOIN_FILTERS: b2f. in the *note
     socket: d1. module.

   - bpo-39503(40): *note AbstractBasicAuthHandler: 1ccc. of *note
     urllib.request: 112. 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: 1791, 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: 1db5. 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: 198a.

   - bpo-36144(49): Added PEP 584(50) operators to *note
     weakref.WeakKeyDictionary: 1989.

   - bpo-38891(51): Fix linear runtime behaviour of the ‘__getitem__’
     and ‘__setitem__’ methods in *note
     multiprocessing.shared_memory.ShareableList: 1db6.  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: e1a.

   - 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(): 197b. failures in
     *note sys.set_asyncgen_hooks(): 19fc.

   - 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(): 182e. 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: ドキュメント<49>,  Next: テスト<49>,  Prev: ライブラリ<156>,  Up: Python 3 9 0 alpha 6

1.24.56.4 ドキュメント
......................

   - bpo-27635(1): The pickle documentation incorrectly claimed that
     ‘__new__’ isn't called by default when unpickling.

   - bpo-39879(2): Updated *note データモデル: 1db8. docs to include
     *note dict(): 184. insertion order preservation.  Patch by Furkan
     Onder and Samy Lahfa.

   - bpo-38387(3): Document *note PyDoc_STRVAR: 1db9. 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: テスト<49>,  Next: ビルド<56>,  Prev: ドキュメント<49>,  Up: Python 3 9 0 alpha 6

1.24.56.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(): 1dbb.
     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: afa. and *note
     ftplib.FTP_TLS: afb. 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: ビルド<56>,  Next: Windows<48>,  Prev: テスト<49>,  Up: Python 3 9 0 alpha 6

1.24.56.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<48>,  Next: macOS<39>,  Prev: ビルド<56>,  Up: Python 3 9 0 alpha 6

1.24.56.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<39>,  Next: IDLE<28>,  Prev: Windows<48>,  Up: Python 3 9 0 alpha 6

1.24.56.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<28>,  Next: Tools/Demos<31>,  Prev: macOS<39>,  Up: Python 3 9 0 alpha 6

1.24.56.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<50>,  Prev: IDLE<28>,  Up: Python 3 9 0 alpha 6

1.24.56.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(): b1b. to convert *note os.system():
     167b. 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<50>,  Prev: Tools/Demos<31>,  Up: Python 3 9 0 alpha 6

1.24.56.11 C API
................

   - bpo-40241(1): Move the ‘PyGC_Head’ structure to the internal C API.

   - bpo-40170(2): Convert *note PyObject_IS_GC(): b7f. macro to a
     function to hide implementation details.

   - bpo-40241(3): Add the functions *note PyObject_GC_IsTracked(): b71.
     and *note PyObject_GC_IsFinalized(): b72. 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(): b80. macro, and the ‘PyObject_NEW_VAR()’
     macro becomes an alias to the *note PyObject_NewVar(): b81. macro,
     to hide implementation details.  They no longer access directly the
     *note PyTypeObject.tp_basicsize: b82. member.

   - bpo-40170(5): *note PyType_HasFeature(): 1d9a. now always calls
     *note PyType_GetFlags(): 1d9b. to hide implementation details.
     Previously, it accessed directly the *note PyTypeObject.tp_flags:
     1cce. 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: b83. 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: b84. member.

   - bpo-40170(8): Always declare *note PyIndex_Check(): b85. as an
     opaque function to hide implementation details: remove
     ‘PyIndex_Check()’ macro.  The macro accessed directly the *note
     PyTypeObject.tp_as_number: b86. member.

   - bpo-39947(9): Add *note PyThreadState_GetID(): b6e. 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.57 Python 3.9.0 alpha 5
----------------------------

'リリース日: 2020-03-23'

* Menu:

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


File: python.info,  Node: セキュリティ<44>,  Next: Core and Builtins<154>,  Up: Python 3 9 0 alpha 5

1.24.57.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<154>,  Next: ライブラリ<157>,  Prev: セキュリティ<44>,  Up: Python 3 9 0 alpha 5

1.24.57.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(): b7c.), 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(): b7c. 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(): 45d.
     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: 197.  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: 93e. 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(): 422. and *note
     PyUnicode_AsUTF8AndSize(): a9d. 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: 1a3. 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: ライブラリ<157>,  Next: ドキュメント<50>,  Prev: Core and Builtins<154>,  Up: Python 3 9 0 alpha 5

1.24.57.3 ライブラリ
....................

   - bpo-39830(1): Add *note zipfile.Path: 8d9. to ‘__all__’ in the
     *note zipfile: 138. 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(): da4. 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: 1dc6. has call objects in
     the order of awaited arguments instead of using *note
     unittest.mock.Mock.call_args: 1dc7. which has the last value of the
     call.  Patch by Karthikeyan Singaravelan.

   - bpo-36144(15): Updated *note os.environ: 25b. and *note
     os.environb: 25c. 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(): 1dc8. method
     when a *note bool: 3c1. 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:
     1a85. 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(): ae5. 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(): ae6. 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: 126b.  Patch by Donghee Na.

   - bpo-13487(24): Avoid a possible '"RuntimeError: dictionary changed
     size during iteration"' from *note inspect.getmodule(): 1bcc. when
     it tried to loop through *note sys.modules: 1791.

   - 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: 13d8. 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: 1d8. 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(): d1f. 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: b59. environment variable when the *note -E:
     b5a. or *note -I: b5b. 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: 1dc9. 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: b00.  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(): 1dca. 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: ドキュメント<50>,  Next: テスト<50>,  Prev: ライブラリ<157>,  Up: Python 3 9 0 alpha 5

1.24.57.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: 101. 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: テスト<50>,  Next: ビルド<57>,  Prev: ドキュメント<50>,  Up: Python 3 9 0 alpha 5

1.24.57.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: 3e2. 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: ビルド<57>,  Next: Windows<49>,  Prev: テスト<50>,  Up: Python 3 9 0 alpha 5

1.24.57.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 ‘subprocess’ 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: b36. 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<49>,  Next: macOS<40>,  Prev: ビルド<57>,  Up: Python 3 9 0 alpha 5

1.24.57.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<40>,  Next: IDLE<29>,  Prev: Windows<49>,  Up: Python 3 9 0 alpha 5

1.24.57.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<29>,  Next: Tools/Demos<32>,  Prev: macOS<40>,  Up: Python 3 9 0 alpha 5

1.24.57.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<51>,  Prev: IDLE<29>,  Up: Python 3 9 0 alpha 5

1.24.57.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<51>,  Prev: Tools/Demos<32>,  Up: Python 3 9 0 alpha 5

1.24.57.11 C API
................

   - bpo-40024(1): Add *note PyModule_AddType(): b70. 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(): 995. 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(): b6d.: 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(): 171b. 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(): 1dd3. and *note
     PyCFunction_NewEx(): 1dd4. 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: db2. is now implemented with
     ‘__builtin_unreachable()’ and analogs in release mode.

   - bpo-38643(13): *note PyNumber_ToBase(): 1bd2. now raises a *note
     SystemError: 795. instead of crashing when called with invalid
     base.

   - bpo-39882(14): The *note Py_FatalError(): b7e. 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: b75, *note
     m_clear: b76. and *note m_free: b77. functions of *note
     PyModuleDef: b78. 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: b79. function).  More precisely, these
     functions are not called if *note m_size: b7a. is greater than 0
     and the module state (as returned by *note PyModule_GetState():
     b7b.) 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(): 1dd5. and *note
     _PyInterpreterState_SetEvalFrameFunc(): 1dd6. C functions.  The
     *note _PyFrameEvalFunction: 97e. 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.58 Python 3.9.0 alpha 4
----------------------------

'Release date: 2020-02-25'

* Menu:

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<51>.
* ビルド: ビルド<58>.
* Windows: Windows<50>.
* IDLE: IDLE<30>.
* C API: C API<52>.


File: python.info,  Node: セキュリティ<45>,  Next: Core and Builtins<155>,  Up: Python 3 9 0 alpha 4

1.24.58.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<155>,  Next: ライブラリ<158>,  Prev: セキュリティ<45>,  Up: Python 3 9 0 alpha 4

1.24.58.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(): 1bfd.
     Patch by Donghee Na.

   - bpo-39619(3): Enable use of *note os.chroot(): 1dda. on HP-UX
     systems.

   - bpo-39573(4): Add *note Py_IS_TYPE(): 1bfd. 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(): 1717. 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: b42. of float operation now
     has a better performance.  Also the message of *note
     ZeroDivisionError: b43. 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: 184. (and *note collections.UserDict:
     1ddb.) 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: ライブラリ<158>,  Next: ドキュメント<51>,  Prev: Core and Builtins<155>,  Up: Python 3 9 0 alpha 4

1.24.58.3 ライブラリ
....................

   - bpo-30566(1): Fix *note IndexError: 1753. 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(): b10. and *note math.lcm():
     b11. 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: 1ddd. in
     ‘io.BufferedReader.truncate()’ when it is called on a read-only
     *note io.BufferedReader: 142b. instance.

   - bpo-39479(6): Add *note math.lcm(): b11. 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: 104. 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: 215. if
     the numerator and/or the denominator is an *note int: 19c.
     subclass.  The *note math.gcd(): b10. function is now used to
     normalize the 'numerator' and 'denominator'.  ‘math.gcd()’ always
     return a ‘int’ type.  Previously, the GCD type depended on
     'numerator' and 'denominator'.

   - bpo-39567(18): Added audit for *note os.walk(): 6d0, *note
     os.fwalk(): d56, *note pathlib.Path.glob(): 537. and *note
     pathlib.Path.rglob(): 538.

   - bpo-39559(19): Remove unused, undocumented argument ‘getters’ from
     *note uuid.getnode(): da4.

   - bpo-38149(20): *note sys.audit(): 197b. is now called only once per
     call of *note glob.glob(): 5a0. and *note glob.iglob(): a0c.

   - bpo-39546(21): Fix a regression in *note ArgumentParser: 1bf. 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(): 941. function is no
     longer deprecated.

   - bpo-39493(25): Mark ‘typing.IO.closed’ as a property

   - bpo-39491(26): Add *note typing.Annotated: b3b. and
     ‘include_extras’ parameter to *note typing.get_type_hints(): 8c1.
     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():
     1994. 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(): aee. 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: 1093, 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: ドキュメント<51>,  Next: テスト<51>,  Prev: ライブラリ<158>,  Up: Python 3 9 0 alpha 4

1.24.58.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: テスト<51>,  Next: ビルド<58>,  Prev: ドキュメント<51>,  Up: Python 3 9 0 alpha 4

1.24.58.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(): 1717. fails with *note OverflowError: a85.  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: ビルド<58>,  Next: Windows<50>,  Prev: テスト<51>,  Up: Python 3 9 0 alpha 4

1.24.58.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<50>,  Next: IDLE<30>,  Prev: ビルド<58>,  Up: Python 3 9 0 alpha 4

1.24.58.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(): 1047. and *note expanduser(): 1046. 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(): c0d, 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<30>,  Next: C API<52>,  Prev: Windows<50>,  Up: Python 3 9 0 alpha 4

1.24.58.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: bc9. 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<52>,  Prev: IDLE<30>,  Up: Python 3 9 0 alpha 4

1.24.58.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(): 98a. function to set the
     size of an object.

   - bpo-39500(4): *note PyUnicode_IsIdentifier(): 1de4. does not call
     *note Py_FatalError(): b7e. anymore if the string is not ready.

   - bpo-39573(5): Add *note Py_SET_TYPE(): 988. function to set the
     type of an object.

   - bpo-39573(6): Add a *note Py_SET_REFCNT(): aac. function to set the
     reference counter of an object.

   - bpo-39542(7): Convert *note PyType_HasFeature(): 1d9a, *note
     PyType_Check(): 1de5. and *note PyType_CheckExact(): 1de6. 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(): c64. and *note PyObject_InitVar(): 1d9e. 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(): 19f0. function now
     calls the ‘PyThreadState.on_delete’ callback.  Previously, that
     happened in *note PyThreadState_Delete(): 1de7.

   - 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.59 Python 3.9.0 alpha 3
----------------------------

'Release date: 2020-01-24'

* Menu:

* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<159>.
* ドキュメント: ドキュメント<52>.
* ビルド: ビルド<59>.
* IDLE: IDLE<31>.
* C API: C API<53>.


File: python.info,  Node: Core and Builtins<156>,  Next: ライブラリ<159>,  Up: Python 3 9 0 alpha 3

1.24.59.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(): afd. 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(): 110f. or *note max(): 1110. with no arguments.  Patch by
     Donghee Na.

   - bpo-39200(16): Correct the error message when trying to construct
     *note range: b41. 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(): 1dea.

   - 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: 1deb. command-line
     option or setting the *note PYTHONUNBUFFERED: 1dec. 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(): 1dea.

   - 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: ライブラリ<159>,  Next: ドキュメント<52>,  Prev: Core and Builtins<156>,  Up: Python 3 9 0 alpha 3

1.24.59.2 ライブラリ
....................

   - bpo-39430(1): Fixed race condition in lazy imports in *note
     tarfile: e4.

   - bpo-39413(2): The *note os.unsetenv(): 25e. function is now also
     available on Windows.

   - bpo-39390(3): Fixed a regression with the ‘ignore’ callback of
     *note shutil.copytree(): c22.  The argument types are now ‘str’ and
     ‘List[str]’ again.

   - bpo-39395(4): The *note os.putenv(): 25d. and *note os.unsetenv():
     25e. functions are now always available.

   - bpo-39406(5): If ‘setenv()’ C function is available, *note
     os.putenv(): 25d. 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(): 1c38. to be used
     with file and file-like objects, like *note zipfile.is_zipfile():
     1546.  Patch by William Woodruff.

   - bpo-39377(8): Removed ‘encoding’ option from *note json.loads():
     b52.  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: a6a.  Since Python 3.0, it was ignored and using it
     was emitting *note DeprecationWarning: 1a4.  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(): 941.

   - bpo-39351(13): Remove ‘base64.encodestring()’ and
     ‘base64.decodestring()’, aliases deprecated since Python 3.1: use
     *note base64.encodebytes(): b50. and *note base64.decodebytes():
     b51. instead.

   - bpo-39350(14): Remove ‘fractions.gcd()’ function, deprecated since
     Python 3.5 (bpo-22486(15)): use *note math.gcd(): b10. instead.

   - bpo-39329(16): *note LMTP: b2d. 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: afb. and ‘FTP_TLS’ now raise a *note
     ValueError: 2ee. 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: b2b. and *note SMTP_SSL: b2c. now raise
     a *note ValueError: 2ee. 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(): b12.: 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:
     2ee. 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: b21. and *note POP3_SSL: b22. now raise
     a *note ValueError: 2ee. 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(): b57. method no
     longer ignores the *note EBADF: b58. 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(): 17d0. 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: 8a3.

   - 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: e4f. to
     return a correct result upon inheritance.  Patch by Bar Harel.

   - bpo-38615(45): *note IMAP4: b03. and *note IMAP4_SSL: b04. now have
     an optional 'timeout' parameter for their constructors.  Also, the
     *note open(): b05. method now has an optional 'timeout' parameter
     with this change.  The overridden methods of ‘IMAP4_SSL’ and *note
     IMAP4_stream: b06. 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(): 15fc.
     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: c87. 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(): d69. 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: ドキュメント<52>,  Next: ビルド<59>,  Prev: ライブラリ<159>,  Up: Python 3 9 0 alpha 3

1.24.59.3 ドキュメント
......................

   - bpo-39381(1): Mention in docs that *note asyncio.get_event_loop():
     2f4. 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
     型とメンバー: 1def. 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: ビルド<59>,  Next: IDLE<31>,  Prev: ドキュメント<52>,  Up: Python 3 9 0 alpha 3

1.24.59.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<31>,  Next: C API<53>,  Prev: ビルド<59>,  Up: Python 3 9 0 alpha 3

1.24.59.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<53>,  Prev: IDLE<31>,  Up: Python 3 9 0 alpha 3

1.24.59.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.60 Python 3.9.0 alpha 2
----------------------------

'Release date: 2019-12-18'

* Menu:

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<160>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<52>.
* ビルド: ビルド<60>.
* Windows: Windows<51>.
* macOS: macOS<41>.
* IDLE: IDLE<32>.
* C API: C API<54>.


File: python.info,  Node: セキュリティ<46>,  Next: Core and Builtins<157>,  Up: Python 3 9 0 alpha 2

1.24.60.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(): 940. 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<157>,  Next: ライブラリ<160>,  Prev: セキュリティ<46>,  Up: Python 3 9 0 alpha 2

1.24.60.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(): a10.
     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:
     24f. and *note set: 185. displays.  Patch by Brandt Bucher.

   - bpo-38707(15): ‘MainThread.native_id’ is now correctly reset in
     child processes spawned using *note multiprocessing.Process: 254,
     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: ライブラリ<160>,  Next: ドキュメント<53>,  Prev: Core and Builtins<157>,  Up: Python 3 9 0 alpha 2

1.24.60.3 ライブラリ
....................

   - bpo-39033(1): Fix *note NameError: 450. in *note zipimport: 139.
     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: 1267.: 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(): 8c1. properly handles
     functions decorated with *note functools.wraps(): 1163.

   - bpo-38870(24): Expose *note ast.unparse(): ae6. 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 ‘ast.AST’ 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: 330. 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(): 11be. 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(): 130b. is missing.  Patch by Toke
     Høiland-Jørgensen.

   - bpo-38686(31): Added support for multiple ‘qop’ values in *note
     urllib.request.AbstractDigestAuthHandler: 1dc9.

   - bpo-38712(32): Add the Linux-specific *note
     signal.pidfd_send_signal(): b29. 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: ドキュメント<53>,  Next: テスト<52>,  Prev: ライブラリ<160>,  Up: Python 3 9 0 alpha 2

1.24.60.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(): 19b0. 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: テスト<52>,  Next: ビルド<60>,  Prev: ドキュメント<53>,  Up: Python 3 9 0 alpha 2

1.24.60.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: 1df9,
     *note INTERNET_TIMEOUT: 1dfa, *note SHORT_TIMEOUT: 1cc0. and *note
     LONG_TIMEOUT: 1dfb.  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(): 15f2. 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: f42.  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: 199. when passing target as a
     string with *note unittest.mock.patch.object(): 1967.

   - 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: ビルド<60>,  Next: Windows<51>,  Prev: テスト<52>,  Up: Python 3 9 0 alpha 2

1.24.60.6 ビルド
................

   - bpo-37404(1): *note asyncio: b. now raises *note TypeError: 199.
     when calling incompatible methods with an *note ssl.SSLSocket: aeb.
     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<51>,  Next: macOS<41>,  Prev: ビルド<60>,  Up: Python 3 9 0 alpha 2

1.24.60.7 Windows
.................

   - bpo-39007(1): Add auditing events to functions in *note winreg:
     11d.

   - 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<41>,  Next: IDLE<32>,  Prev: Windows<51>,  Up: Python 3 9 0 alpha 2

1.24.60.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<32>,  Next: C API<54>,  Prev: macOS<41>,  Up: Python 3 9 0 alpha 2

1.24.60.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<54>,  Prev: IDLE<32>,  Up: Python 3 9 0 alpha 2

1.24.60.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.61 Python 3.9.0 alpha 1
----------------------------

'Release date: 2019-11-19'

* Menu:

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<158>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<53>.
* ビルド: ビルド<61>.
* Windows: Windows<52>.
* macOS: macOS<42>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<55>.


File: python.info,  Node: セキュリティ<47>,  Next: Core and Builtins<158>,  Up: Python 3 9 0 alpha 1

1.24.61.1 セキュリティ
......................

   - bpo-38722(1): *note runpy: c3. now uses *note io.open_code(): 17c4.
     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(): 167b. to be
     named ‘os.system’.

   - bpo-38243(4): Escape the server title of *note
     xmlrpc.server.DocXMLRPCServer: 1e03. 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 コマンドラインと環境: 1e04.).

   - 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: 11c, as well as *note
     os.listdir(): 1316, *note os.scandir(): c58. and *note
     breakpoint(): 273.

   - bpo-37364(13): *note io.open_code(): 17c4. 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<158>,  Next: ライブラリ<161>,  Prev: セキュリティ<47>,  Up: Python 3 9 0 alpha 1

1.24.61.2 Core and Builtins
...........................

   - bpo-38631(1): Replace ‘Py_FatalError()’ call with a regular *note
     RuntimeError: 246. exception in ‘float.__getformat__()’.

   - bpo-38639(2): Optimized *note math.floor(): 15db, *note
     math.ceil(): 15dc. and *note math.trunc(): 15dd. 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: 193. and *note bytearray: 342. 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: 342, *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(): 1722. 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: 184. constructor and the
     *note update(): 1683. 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(): 2f5. 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(): c40.
     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(): b60. to normalize the
     encoding name the same way than *note
     encodings.normalize_encoding(): a01, except that ‘codecs.lookup()’
     also converts the name to lower case.

   - bpo-37830(45): Fixed compilation of *note break: 180. and *note
     continue: 181. in the *note finally: 1b1. block when the
     corresponding *note try: 8f9. block contains *note return: 1b0.
     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:
     1d53. of *note bytearray: 342.  Patch by Sergey Fedoseev.

   - bpo-37802(48): Slightly improve performance of *note
     PyLong_FromUnsignedLong(): 191f, *note
     PyLong_FromUnsignedLongLong(): 1920. and *note PyLong_FromSize_t():
     1921.  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: 1af. instead of *note DeprecationWarning: 1a4. 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: 18f. 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(): f9a.

   - 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: b64. statement now works properly
     if the *note AssertionError: 8b9. 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__(): 127d.

   - 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(): a10. 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(): 1801. 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(): b47. and *note
     sys.setswitchinterval(): b48. 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(): 318, *note
     str.encode(): ad6. and *note bytes.decode(): ad7.

     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(): 318, *note io.open(): 740, *note
     codecs.open(): 317. and *note fileinput.FileInput: 944. 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(): 962.
     function (previously documented but not implemented): call *note
     struct.calcsize(): 1e06.  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(): c36. now also
     supports NetBSD.

   - bpo-37077(87): Add *note threading.get_native_id(): c36. 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: ライブラリ<161>,  Next: ドキュメント<54>,  Prev: Core and Builtins<158>,  Up: Python 3 9 0 alpha 1

1.24.61.3 ライブラリ
....................

   - bpo-36589(1): The *note curses.update_lines_cols(): fef. function
     now returns ‘None’ instead of ‘1’ on success.

   - bpo-38807(2): Update *note TypeError: 199. messages for *note
     os.path.join(): 1a07. to include *note os.PathLike: e4f. 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(): 17c4.
     to trigger auditing events.

   - bpo-27805(7): Allow opening pipes and other non-seekable files in
     append mode with *note open(): 318.

   - 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: b1a. constant, which may be
     passed to *note os.waitid(): f9d. 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(): af0, *note
     curses.set_escdelay(): af1, *note curses.get_tabsize(): af2, and
     *note curses.set_tabsize(): af3. functions - by Anthony Sottile.

   - bpo-38586(17): Now *note fileConfig(): d4c. 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: b18. and *note CLD_STOPPED:
     b19. 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():
     d09. 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:
     1c11. to support typing objects, patch by Samuel Colvin.

   - bpo-38109(30): Add missing *note stat.S_IFDOOR: 11c1, *note
     stat.S_IFPORT: 11c2, *note stat.S_IFWHT: 11c3, *note
     stat.S_ISDOOR(): 1e08, *note stat.S_ISPORT(): 1e09, and *note
     stat.S_ISWHT(): 1e0a. 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: 32f.
     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: 1e0b. 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():
     d5a. to accept *note Py_ssize_t: c59. 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: 32f. and *note
     TypedDict: 330. 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: 1075. 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(): ef8. exceptions.  Patch by
     Abraham Toriz Cruz.

   - bpo-38175(56): Fix a memory leak in comparison of *note
     sqlite3.Row: 1075. 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(): 2f5. 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: d3c. 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: 10b, 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:
     eb1. 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(): ae5.
     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(): ae5. 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(): c67. 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(): 17bb. 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: 10a8. 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(): db0. 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: bc7.
     and *note datetime.timezone: 12d9.

   - 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(): 12ae. 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():
     1e0c. 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: 1a3. for
     unsupported type of the other operand.  This allows the other
     operand to play role (for example the equality comparison with
     *note ANY: 1e0d. 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: 12d9. 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: 1a3. in Python
     implementation of ‘__eq__’ for *note timedelta: bc7. and *note
     time: 1fd. 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: 1e0e. 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(): 132a. now correctly
     handles errors that arise during iteration over its ‘mask’
     argument.  Patch by Brandt Bucher.

   - bpo-37412(171): The *note os.getcwdb(): c86. 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: 1bf. 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(): 1e0f. 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():
     1acb. 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(): b45.

   - 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(): 1e10. 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: 246. raised by *note
     asyncio.all_tasks(): b53. 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(): d83. 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: c6a.

   - 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(): b31. 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: 1e11. now
     lowercases the keys of the passed dictionary.

   - bpo-26185(221): Fix *note repr(): 1c3. 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: 1e12. 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(): 17cf. 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(): b1d.  Patch by Girts
     Folkmanis.

   - bpo-32498(248): Made *note urllib.parse.unquote(): 1b59. 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(): c55. 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: ドキュメント<54>,  Next: テスト<53>,  Prev: ライブラリ<161>,  Up: Python 3 9 0 alpha 1

1.24.61.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: 246. 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():
     2e3. docs.

   - bpo-37878(14): Make *note PyThreadState_DeleteCurrent(): 1e14.
     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: 112.

   - 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(): 19b0, 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: テスト<53>,  Next: ビルド<61>,  Prev: ドキュメント<54>,  Up: Python 3 9 0 alpha 1

1.24.61.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: 1df9, *note INTERNET_TIMEOUT: 1dfa, *note
     SHORT_TIMEOUT: 1cc0. and *note LONG_TIMEOUT: 1dfb.

   - 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(): 1e16. and *note os.killpg():
     1e17. 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: 177. exception
     using *note threading.excepthook(): a4f.

   - 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():
     1e18. 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():
     1e19.: 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(): 1e1a. 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: ビルド<61>,  Next: Windows<52>,  Prev: テスト<53>,  Up: Python 3 9 0 alpha 1

1.24.61.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: 16a. and by the *note unicodedata: 10c. 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(): 1e1c. 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<52>,  Next: macOS<42>,  Prev: ビルド<61>,  Up: Python 3 9 0 alpha 1

1.24.61.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(): 264.
     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(): 26f. failing for block
     devices on Windows

   - bpo-38020(20): Fixes potential crash when calling *note
     os.readlink(): b1e. (or indirectly through *note realpath(): 264.)
     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(): 1e1e. no longer fails for standard
     streams on Windows 7.

   - bpo-1311(23): The ‘nul’ file on Windows now returns True from *note
     exists(): c07. and a valid result from *note os.stat(): 26f. 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(): 26f.

   - 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: 3eb. 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(): 1e1e. 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: 1e1f. 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<42>,  Next: IDLE<33>,  Prev: Windows<52>,  Up: Python 3 9 0 alpha 1

1.24.61.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<33>,  Next: Tools/Demos<33>,  Prev: macOS<42>,  Up: Python 3 9 0 alpha 1

1.24.61.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<55>,  Prev: IDLE<33>,  Up: Python 3 9 0 alpha 1

1.24.61.10 Tools/Demos
......................

   - bpo-38118(1): Update Valgrind suppression file to ignore a false
     alarm in *note PyUnicode_Decode(): 1e23. 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<55>,  Prev: Tools/Demos<33>,  Up: Python 3 9 0 alpha 1

1.24.61.11 C API
................

   - bpo-37633(1): Re-export some function compatibility wrappers for
     macros in ‘pythonrun.h’.

   - bpo-38644(2): Provide *note Py_EnterRecursiveCall(): 3d0. and *note
     Py_LeaveRecursiveCall(): b6f. 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: b7d. is now a constant and refers to
     a constant string.

   - bpo-38540(4): Fixed possible leak in *note PyArg_Parse(): 1874. 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: c4a. 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: 3eb. to
     the program full path (*note Py_GetProgramFullPath(): 3ea.) rather
     than to the program name (*note Py_GetProgramName(): 3ec.).

   - 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(): db2. macro now calls
     *note Py_FatalError(): b7e.

   - 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(): 1e25.
     function.

   - bpo-37337(26): Add fast functions for calling methods:
     ‘_PyObject_VectorcallMethod()’, ‘_PyObject_CallMethodNoArgs()’ and
     ‘_PyObject_CallMethodOneArg()’.

   - bpo-28805(27): The *note METH_FASTCALL: 19fd. 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(): 1e26.

   - 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.62 Python 3.8.0 beta 1
---------------------------

'Release date: 2019-06-04'

* Menu:

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


File: python.info,  Node: セキュリティ<48>,  Next: Core and Builtins<159>,  Up: Python 3 8 0 beta 1

1.24.62.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: 112.

   - 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<159>,  Next: ライブラリ<162>,  Prev: セキュリティ<48>,  Up: Python 3 8 0 beta 1

1.24.62.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: 19c, *note float: 197. and
     *note complex: 198. will now use the *note __index__(): 19f.
     special method, if available and the corresponding method *note
     __int__(): 19e, *note __float__(): bc5. 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(): c02.

   - bpo-37032(13): Added new ‘replace()’ method to the code type (*note
     types.CodeType: 32d.).

   - bpo-37007(14): Implement *note socket.if_nameindex(): c26, *note
     socket.if_nametoindex(): c27, and *note socket.if_indextoname():
     c28. 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(): 428. and *note
     PyException_SetTraceback(): 1e2a. 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: 18f. 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: 3c1, *note int: 19c, *note float: 197, *note complex:
     198. and few classes from the standard library.  They now inherit
     ‘__str__()’ from *note object: c82.

   - 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: 89d. and *note
     sys.float_info: 1e2b. 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: ライブラリ<162>,  Next: ドキュメント<55>,  Prev: Core and Builtins<159>,  Up: Python 3 8 0 beta 1

1.24.62.3 ライブラリ
....................

   - bpo-37128(1): Added *note math.perm(): 8e1.

   - 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(): c6f.
     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(): a10,
     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: c42. setup for autospeccing.  Document
     newly implemented async methods in *note unittest.mock.MagicMock:
     1093.

   - 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(): 1e2d. 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(): a4f.
     function which handles uncaught *note threading.Thread.run(): c35.
     exception.  It can be overridden to control how uncaught
     ‘threading.Thread.run()’ exceptions are handled.

   - bpo-36996(25): Handle *note unittest.mock.patch(): 1096. used as a
     decorator on async functions.

   - bpo-37008(26): Add support for calling *note next(): 9dc. with the
     mock resulting from *note unittest.mock.mock_open(): 11ed.

   - 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(): a04. and *note
     fileinput.FileInput: 944. '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
     ‘collections’ 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: 450. 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(): 134a. now ignores *note
     errno.EINVAL: 1e2e. on *note os.setxattr(): 1323. 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: 17d7. and *note asyncio.StreamWriter: 1ad1.
     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(): c70. and *note
     asyncio.create_subprocess_exec(): c6f. to use ‘asyncio.Stream’
     instead of deprecated ‘StreamReader’ and ‘StreamWriter’.  Deprecate
     ‘asyncio.StreamReader’ and ‘asyncio.StreamWriter’.  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(): bfc. 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(): 1b5.).

   - 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: 244. 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: bee. 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(): c1e. now supports silent
     mode.  Patch by Joannah Nanjekye

   - bpo-29183(72): Fix double exceptions in *note
     wsgiref.handlers.BaseHandler: 1e2f. 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(): 141c. 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(): 11ed. results now
     respects the argument of read([size]).  Patch contributed by Rémi
     Lapeyre.

   - bpo-35431(88): Implement *note math.comb(): 8e0. 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:
     1450. 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(): 21c. is
     slightly improved.  Patch by Sergey Fedoseev.

   - bpo-33361(95): Fix a bug in *note codecs.StreamRecoder: 1e30. 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(): c20, 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 path-like object.
     The 'cwd' parameter now accepts a bytes object.  Based on patch by
     Anders Lorentsen.

   - bpo-33123(100): *note pathlib.Path.unlink: 1e31. now accepts a
     'missing_ok' parameter to avoid a *note FileNotFoundError: 266.
     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(): bff.).

   - 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(): 19c7. 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: ドキュメント<55>,  Next: テスト<54>,  Prev: ライブラリ<162>,  Up: Python 3 8 0 beta 1

1.24.62.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: テスト<54>,  Next: ビルド<62>,  Prev: ドキュメント<55>,  Up: Python 3 8 0 beta 1

1.24.62.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(): 1e19. rather than
     *note test.support.captured_stderr(): 1e34.

   - 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():
     1e19.: 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: ビルド<62>,  Next: Windows<53>,  Prev: テスト<54>,  Up: Python 3 8 0 beta 1

1.24.62.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<53>,  Next: macOS<43>,  Prev: ビルド<62>,  Up: Python 3 8 0 beta 1

1.24.62.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(): c9f. 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<43>,  Next: IDLE<34>,  Prev: Windows<53>,  Up: Python 3 8 0 beta 1

1.24.62.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<34>,  Next: Tools/Demos<34>,  Prev: macOS<43>,  Up: Python 3 8 0 beta 1

1.24.62.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<56>,  Prev: IDLE<34>,  Up: Python 3 8 0 beta 1

1.24.62.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<56>,  Prev: Tools/Demos<34>,  Up: Python 3 8 0 beta 1

1.24.62.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(): 1e3b. 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(): 42e. 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.63 Python 3.8.0 alpha 4
----------------------------

'Release date: 2019-05-06'

* Menu:

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<163>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<55>.
* ビルド: ビルド<63>.
* Windows: Windows<54>.
* macOS: macOS<44>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<57>.


File: python.info,  Node: セキュリティ<49>,  Next: Core and Builtins<160>,  Up: Python 3 8 0 alpha 4

1.24.63.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, ‘shutil.which()’ 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<160>,  Next: ライブラリ<163>,  Prev: セキュリティ<49>,  Up: Python 3 8 0 alpha 4

1.24.63.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: 106. 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: 293. 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(): c83, 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(): 149f.

   - 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(): 1722. 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: ライブラリ<163>,  Next: ドキュメント<56>,  Prev: Core and Builtins<160>,  Up: Python 3 8 0 alpha 4

1.24.63.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: 944. 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:
     3eb. is ‘None’ or an empty string: use *note os.getcwd(): 196a. to
     initialize ‘project_base’.  Fix also the distutils build command:
     don't use ‘sys.executable’ 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: 1e40, if the ‘PATH’
     environment variable is not set.  Moreover, don't use
     ‘os.confstr("CS_PATH")’ nor ‘os.defpath’ 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: 170. ‘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(): 1405. 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(): 1096. object will now return ‘None’ instead
     of raising *note RuntimeError: 246, 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(): be3. and *note
     datetime.datetime.fromisocalendar(): be4, 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: 1e41. 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(): c24. and *note
     has_dualstack_ipv6(): c25. 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(): 451. to *note unittest.mock.create_autospec():
     1994.  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 *note
     tkinter.PhotoImage: 1e42.  Patch by Zackery Spytz.

   - bpo-35082(47): Don't return deleted attributes when calling dir on
     a *note unittest.mock.Mock: c43.

   - bpo-34547(48): *note wsgiref.handlers.BaseHandler: 1e2f. now
     handles abrupt client connection terminations gracefully.  Patch by
     Petter Strandmark.

   - bpo-31658(49): *note xml.sax.parse(): 1e43. 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: ドキュメント<56>,  Next: テスト<55>,  Prev: ライブラリ<163>,  Up: Python 3 8 0 alpha 4

1.24.63.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: 11f.  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: 11f. 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: テスト<55>,  Next: ビルド<63>,  Prev: ドキュメント<56>,  Up: Python 3 8 0 alpha 4

1.24.63.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: 1e46. error.

   - bpo-36611(8): Fix ‘test_sys.test_getallocatedblocks()’ when *note
     tracemalloc: 106. 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: ビルド<63>,  Next: Windows<54>,  Prev: テスト<55>,  Up: Python 3 8 0 alpha 4

1.24.63.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(): 290. function and the *note PYTHONDUMPREFS: ba2.
     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<54>,  Next: macOS<44>,  Prev: ビルド<63>,  Up: Python 3 8 0 alpha 4

1.24.63.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(): be1.

   - 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<44>,  Next: IDLE<35>,  Prev: Windows<54>,  Up: Python 3 8 0 alpha 4

1.24.63.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<35>,  Next: Tools/Demos<35>,  Prev: macOS<44>,  Up: Python 3 8 0 alpha 4

1.24.63.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<57>,  Prev: IDLE<35>,  Up: Python 3 8 0 alpha 4

1.24.63.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<57>,  Prev: Tools/Demos<35>,  Up: Python 3 8 0 alpha 4

1.24.63.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: 1e4d.(name) and *note PyDoc_STRVAR:
     1db9.(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(): e68. 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():
     dc4. before *note Py_Initialize(): 45e. 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(): 1e4e.
     function were incorrectly interpreted as a single timestamp rather
     than an arguments tuple, which causes existing code to start
     raising *note TypeError: 199.  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.64 Python 3.8.0 alpha 3
----------------------------

'Release date: 2019-03-25'

* Menu:

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<57>.
* テスト: テスト<56>.
* ビルド: ビルド<64>.
* Windows: Windows<55>.
* IDLE: IDLE<36>.
* Tools/Demos: Tools/Demos<36>.
* C API: C API<58>.


File: python.info,  Node: セキュリティ<50>,  Next: Core and Builtins<161>,  Up: Python 3 8 0 alpha 3

1.24.64.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: 1e51. 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<161>,  Next: ライブラリ<164>,  Prev: セキュリティ<50>,  Up: Python 3 8 0 alpha 3

1.24.64.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: 3e2. 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(): f10, *note
     marshal.load(): 1e53, 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__(): 19f. special method will be
     used instead of *note __int__(): 19e. 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: ライブラリ<164>,  Next: ドキュメント<57>,  Prev: Core and Builtins<161>,  Up: Python 3 8 0 alpha 3

1.24.64.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(): 1e55.
     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(): 12fb.
     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(): 1994. 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: ドキュメント<57>,  Next: テスト<56>,  Prev: ライブラリ<164>,  Up: Python 3 8 0 alpha 3

1.24.64.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: テスト<56>,  Next: ビルド<64>,  Prev: ドキュメント<57>,  Up: Python 3 8 0 alpha 3

1.24.64.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: ビルド<64>,  Next: Windows<55>,  Prev: テスト<56>,  Up: Python 3 8 0 alpha 3

1.24.64.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<55>,  Next: IDLE<36>,  Prev: ビルド<64>,  Up: Python 3 8 0 alpha 3

1.24.64.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<36>,  Next: Tools/Demos<36>,  Prev: Windows<55>,  Up: Python 3 8 0 alpha 3

1.24.64.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<58>,  Prev: IDLE<36>,  Up: Python 3 8 0 alpha 3

1.24.64.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<58>,  Prev: Tools/Demos<36>,  Up: Python 3 8 0 alpha 3

1.24.64.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.65 Python 3.8.0 alpha 2
----------------------------

'Release date: 2019-02-25'

* Menu:

* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<57>.
* Windows: Windows<56>.
* IDLE: IDLE<37>.


File: python.info,  Node: Core and Builtins<162>,  Next: ライブラリ<165>,  Up: Python 3 8 0 alpha 2

1.24.65.1 Core and Builtins
...........................

   - bpo-36052(1): Raise a *note SyntaxError: 18f. 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: e4f. 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(): dcc. 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: ライブラリ<165>,  Next: ドキュメント<58>,  Prev: Core and Builtins<162>,  Up: Python 3 8 0 alpha 2

1.24.65.2 ライブラリ
....................

   - bpo-35512(1): *note unittest.mock.patch.dict(): 19c7. 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(): 19ba. 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(): 1e60.
     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(): 1448, *note re.findall(): 122f, *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: 11b.: 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(): bfb. 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:
     bc7. now returns an object of the same type as the
     ‘datetime.datetime’ subclass.  As a result, *note
     datetime.datetime.astimezone(): bc8. 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: c50, ‘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: ドキュメント<58>,  Next: テスト<57>,  Prev: ライブラリ<165>,  Up: Python 3 8 0 alpha 2

1.24.65.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: テスト<57>,  Next: Windows<56>,  Prev: ドキュメント<58>,  Up: Python 3 8 0 alpha 2

1.24.65.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<56>,  Next: IDLE<37>,  Prev: テスト<57>,  Up: Python 3 8 0 alpha 2

1.24.65.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<37>,  Prev: Windows<56>,  Up: Python 3 8 0 alpha 2

1.24.65.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.66 Python 3.8.0 alpha 1
----------------------------

'Release date: 2019-02-03'

* Menu:

* セキュリティ: セキュリティ<51>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<166>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<58>.
* ビルド: ビルド<65>.
* Windows: Windows<57>.
* macOS: macOS<45>.
* IDLE: IDLE<38>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<59>.


File: python.info,  Node: セキュリティ<51>,  Next: Core and Builtins<163>,  Up: Python 3 8 0 alpha 1

1.24.66.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: b5b. 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: b5a. and *note -s: 15aa. options (enabled by ‘-I’)
     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(): d09. 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<163>,  Next: ライブラリ<166>,  Prev: セキュリティ<51>,  Up: Python 3 8 0 alpha 1

1.24.66.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(): 19a. 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(): 1e68. 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: 139.  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: 2ee. instead of *note
     OverflowError: a85. in case of a negative ‘_length_’ in a *note
     ctypes.Array: 1e69. subclass.  Also raise *note TypeError: 199.
     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: 1af. raised as an exception at
     code generation time will be now replaced with a *note SyntaxError:
     18f. for better error reporting.

   - bpo-34983(38): Expose *note symtable.Symbol.is_nonlocal(): 1e6a. in
     the symtable module.  Patch by Pablo Galindo.

   - bpo-34974(39): *note bytes: 193. and *note bytearray: 342.
     constructors no longer convert unexpected exceptions (e.g.  *note
     MemoryError: 1772. and *note KeyboardInterrupt: bc9.) to *note
     TypeError: 199.

   - 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(): 193. when the *note
     list: 24f. 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: 1af. is now emitted instead
     of a *note DeprecationWarning: 1a4. 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:
     1af. 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(): 290.  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(): 318. 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: 1e6b. 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(): 1d25. before calling *note
     PyErr_Print(): 1d8a.  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(): 1d0d, *note
     PyIndex_Check(): b85. and *note PyExceptionClass_Name(): c5f. 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: 13dd. list.  *note PyGC_Collect(): b89. 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: 246. is now raised when the
     custom metaclass doesn't provide the ‘__classcell__’ entry in the
     namespace passed to ‘type.__new__’.  A *note DeprecationWarning:
     1a4. was emitted in Python 3.6-3.7.

   - bpo-33499(108): Add *note PYTHONPYCACHEPREFIX: b9f. environment
     variable and *note -X: 170. ‘pycache_prefix’ command-line option to
     set an alternate root directory for writing module bytecode cache
     files.

   - bpo-25711(109): The *note zipimport: 139. 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: ca4. and
     fixes the following issues:

        * Setting global *note StopAsyncIteration: 1e6c. 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: 181. statement is now allowed in
     the *note finally: 1b1. 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: 180, *note
     continue: 181. and *note return: 1b0.

     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: ライブラリ<166>,  Next: ドキュメント<59>,  Prev: Core and Builtins<163>,  Up: Python 3 8 0 alpha 1

1.24.66.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(): 17d5. 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(): 17d5. 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: c3b. 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(): ad8. 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(): b9d. function on *note fractions.Fraction: 215.
     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(): da5. now calls *note
     time.time_ns(): ce4. rather than ‘int(time.time() * 1e9)’.

   - bpo-35513(34): ‘TextTestRunner’ of ‘unittest.runner’ now uses *note
     time.perf_counter(): c7e. rather than *note time.time(): 55d. to
     measure the execution time of a test: ‘time.time()’ can go
     backwards, whereas ‘time.perf_counter()’ is monotonic.

   - bpo-35502(35): Fixed reference leaks in *note
     xml.etree.ElementTree.TreeBuilder: c4e. 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(): 1a68. 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: c43. 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(): 1e6e.: 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(): 185b. 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(): fa4. 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.  ‘select.select()’ 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(): 1e6f. now redirects ‘stderr’
     to *note os.devnull: 1e70. 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(): 31c.
     instead.

   - bpo-35344(61): On macOS, *note platform.platform(): 1b27. now uses
     *note platform.mac_ver(): 1e71, 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(): dfc. 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: 1e0f. 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: 17d3.'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(): 135b.
     now exits immediately if it's *note shutdown(): 1e72. 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: 1093. now supports
     the ‘__fspath__’ method (from *note os.PathLike: e4f.).

   - bpo-35008(88): Fixed references leaks when call the
     ‘__setstate__()’ method of *note xml.etree.ElementTree.Element:
     361. 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(): 30f, *note
     inspect.isgeneratorfunction(): 1bba. and *note
     inspect.isasyncgenfunction(): 1bbb. work with *note
     functools.partial(): 219.  Patch by Pablo Galindo.

   - bpo-34521(92): Use *note socket.CMSG_SPACE(): 1e73. to calculate
     ancillary data size instead of *note socket.CMSG_LEN(): 1e74. 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(): 1e75. 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: 12c. module
     are now able to find children which are instances of ‘Element’
     subclasses.

   - bpo-32680(102): *note smtplib.SMTP: b2b. 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(): 1e76.
     and *note hexdigest(): 1e77. 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(): 1ca6. 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(): c1e, 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(): 1e78. 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: 139.

   - bpo-32892(126): The parser now represents all constants as *note
     ast.Constant: 2f1. 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: efa.
     on mock instances with deleted attributes

   - bpo-34672(134): Add a workaround, so the ‘'Z'’ *note
     time.strftime(): 1406. 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(): c44. and *note
     addClassCleanup(): c45. to unittest to support cleanups for *note
     setUpModule(): c46. and *note setUpClass(): c47.  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: 1e40. 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: 2ee. is
     now raised by *note multiprocessing.Queue.put(): 1e79. and *note
     multiprocessing.Queue.get(): 1e7a. instead of *note AssertionError:
     8b9. and *note OSError: 2c2, 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: 138.  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: 104. 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(): 9c8.  Patch by Alexey Izbyshev.

   - bpo-34427(168): Fix infinite loop in ‘a.extend(a)’ for
     ‘MutableSequence’ subclasses.

   - bpo-34412(169): Make *note signal.strsignal(): 1e7b. 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(): b1e. now accepts *note
     path-like: 5a1. and *note bytes: 193. objects on Windows.

   - bpo-22602(173): The UTF-7 decoder now raises *note
     UnicodeDecodeError: c0c. for ill-formed sequences starting with "+"
     (as specified in RFC 2152).  Patch by Zackery Spytz.

   - bpo-2122(174): The *note mmap.flush(): c93. 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(): 19b6. when formatting an error
     message.

   - bpo-18540(177): The *note imaplib.IMAP4: b03. and *note
     imaplib.IMAP4_SSL: b04. 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(): 1380. and *note
     assertWarnsRegex(): 1381. 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: 942, *note
     wsgiref.util.FileWrapper: 943. and *note fileinput.FileInput: 944.

   - 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(): 1e7c. and
     *note dbm.ndbm.open(): 1e7d. 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(): 105e. 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(): bd5. and *note set_name(): bd4.) and is visible in the
     *note repr(): 1c3. output.  An initial name can also be set using
     the new ‘name’ keyword argument to *note asyncio.create_task():
     1cb. 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(): 131f. 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: 3c1. instances instead of integers 0 or 1.

   - bpo-32788(200): Errors other than *note TypeError: 199. 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(): 122a. 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: 100. 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(): d59,
     *note os.writev(): d5c, *note os.preadv(): d58. and *note
     os.pwritev(): d5b. and in *note os.sendfile(): d09. with 'headers'
     or 'trailers' arguments (on BSD-based OSes and macOS).

   - bpo-25007(226): Add *note copy.copy(): 757. and *note
     copy.deepcopy(): d69. 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(): c22. uses *note
     os.scandir(): c58. function and all copy functions depending from
     it use cached *note os.stat(): 26f. 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
     ‘os.stat()’ syscalls is reduced by 38% making ‘shutil.copytree()’
     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(): c07, *note lexists(): c08, *note
     isdir(): c09, *note isfile(): c0a, *note islink(): c05, and *note
     ismount(): c0b, and *note pathlib.Path: 268. methods that return a
     boolean result like *note exists(): c0f, *note is_dir(): 53a, *note
     is_file(): 539, *note is_mount(): c10, *note is_symlink(): c11,
     *note is_block_device(): c12, *note is_char_device(): c13, *note
     is_fifo(): c14, *note is_socket(): c15. now return ‘False’ instead
     of raising *note ValueError: 2ee. or its subclasses *note
     UnicodeEncodeError: 888. and *note UnicodeDecodeError: c0c. for
     paths that contain characters or bytes unrepresentable at the OS
     level.

   - bpo-26544(237): Fixed implementation of *note platform.libc_ver():
     185b.  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: 199. 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:
     11c. 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(): c52, *note shutil.copy():
     c53, *note shutil.copy2(): c54, *note shutil.copytree(): c22. and
     *note shutil.move(): c55. use platform-specific fast-copy syscalls
     on Linux and macOS in order to copy the file more efficiently.  On
     Windows ‘shutil.copyfile()’ uses a bigger default buffer size (1
     MiB instead of 16 KiB) and a *note memoryview(): 166.-based variant
     of *note shutil.copyfileobj(): c56. 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(): da5. 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: 1093. now supports
     the ‘__round__’ magic method.

   - bpo-28612(298): Added support for Site Maps to urllib's
     ‘RobotFileParser’ as *note RobotFileParser.site_maps(): 1e7e.
     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: 184. 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: c4d.  The
     ‘doctype()’ method defined in a subclass will no longer be called.
     Deprecated methods ‘getchildren()’ and ‘getiterator()’ in the *note
     ElementTree: 12c. module emit now a *note DeprecationWarning: 1a4.
     instead of *note PendingDeprecationWarning: ac9.

   - 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(): 11ed. now supports
     iteration over the file contents.  Patch by Tony Flury.

   - bpo-33217(317): Raise *note TypeError: 199. 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():
     1136.

   - bpo-27485(323): Rename and deprecate undocumented functions in
     *note urllib.parse(): 111.

   - 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(): 1e7f. are not included in the
     resulting output.

   - bpo-33329(326): Fix multiprocessing regression on newer glibcs

   - bpo-33334(327): *note dis.stack_effect(): 1136. now supports all
     defined opcodes including NOP and EXTENDED_ARG.

   - bpo-991266(328): Fix quoting of the ‘Comment’ attribute of *note
     http.cookies.SimpleCookie: 1e80.

   - 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:
     12f5. 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: 23e. 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:
     3e2. 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(): 1e81.

   - 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: 11a. 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: 2ee. 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(): 18b4. 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(): c91. 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: 100.
     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(): 1e82. 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: bde.

   - 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: 1fc. and *note time: 1fd. pickled by Python 2.
     ‘encoding='latin1'’ should be used for successful decoding.

   - bpo-27645(434): *note sqlite3.Connection: 54d. now exposes a *note
     backup: d77. 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: ドキュメント<59>,  Next: テスト<58>,  Prev: ライブラリ<166>,  Up: Python 3 8 0 alpha 1

1.24.66.4 ドキュメント
......................

   - bpo-21257(1): Document *note http.client.parse_headers(): 1e84.

   - 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(): d12, *note asyncio.start_server(): d13.
     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: 137. 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: 1a4. 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: テスト<58>,  Next: ビルド<65>,  Prev: ドキュメント<59>,  Up: Python 3 8 0 alpha 1

1.24.66.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: ビルド<65>,  Next: Windows<57>,  Prev: テスト<58>,  Up: Python 3 8 0 alpha 1

1.24.66.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(): 1e87.: 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<57>,  Next: macOS<45>,  Prev: ビルド<65>,  Up: Python 3 8 0 alpha 1

1.24.66.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: 2c2. 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(): b1e. 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<45>,  Next: IDLE<38>,  Prev: Windows<57>,  Up: Python 3 8 0 alpha 1

1.24.66.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<38>,  Next: Tools/Demos<37>,  Prev: macOS<45>,  Up: Python 3 8 0 alpha 1

1.24.66.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: 1ba.; ‘-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<59>,  Prev: IDLE<38>,  Up: Python 3 8 0 alpha 1

1.24.66.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<59>,  Prev: Tools/Demos<37>,  Up: Python 3 8 0 alpha 1

1.24.66.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(): 1a2d. for empty bytes
     objects.

   - bpo-35322(3): Fix memory leak in *note PyUnicode_EncodeLocale():
     dc7. and *note PyUnicode_EncodeFSDefault(): 1e8d. 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(): c5e, *note Py_XDECREF(): 996, *note
     PyObject_INIT(): 1d9c, *note PyObject_INIT_VAR(): 1d9d.

   - 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(): f15.
     (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(): 17b1. 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():
     1e8e.

   - 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():
     1e8f, *note PySequence_GetItem(): 1e90, *note PySequence_SetItem():
     1e91. and *note PySequence_DelItem(): 1e92. called with a mapping
     and *note PyMapping_Size(): 1e93. called with a sequence.

   - bpo-33818(19): *note PyExceptionClass_Name(): c5f. 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(): 1e94. and *note
     PyUnicode_AsWideCharString(): abd. 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.67 Python 3.7.0 final
--------------------------

'Release date: 2018-06-27'

* Menu:

* ライブラリ: ライブラリ<167>.
* C API: C API<60>.


File: python.info,  Node: ライブラリ<167>,  Next: C API<60>,  Up: Python 3 7 0 final

1.24.67.1 ライブラリ
....................

   - bpo-33851(1): Fix *note ast.get_docstring(): 1e97. for a node that
     lacks a docstring.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33851


File: python.info,  Node: C API<60>,  Prev: ライブラリ<167>,  Up: Python 3 7 0 final

1.24.67.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.68 Python 3.7.0 release candidate 1
----------------------------------------

'Release date: 2018-06-12'

* Menu:

* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<168>.
* ドキュメント: ドキュメント<60>.
* ビルド: ビルド<66>.
* Windows: Windows<58>.
* IDLE: IDLE<39>.


File: python.info,  Node: Core and Builtins<164>,  Next: ライブラリ<168>,  Up: Python 3 7 0 release candidate 1

1.24.68.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: ライブラリ<168>,  Next: ドキュメント<60>,  Prev: Core and Builtins<164>,  Up: Python 3 7 0 release candidate 1

1.24.68.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: 199. 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: ドキュメント<60>,  Next: ビルド<66>,  Prev: ライブラリ<168>,  Up: Python 3 7 0 release candidate 1

1.24.68.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(): d12, *note asyncio.start_server(): d13.
     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: ビルド<66>,  Next: Windows<58>,  Prev: ドキュメント<60>,  Up: Python 3 7 0 release candidate 1

1.24.68.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<58>,  Next: IDLE<39>,  Prev: ビルド<66>,  Up: Python 3 7 0 release candidate 1

1.24.68.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<39>,  Prev: Windows<58>,  Up: Python 3 7 0 release candidate 1

1.24.68.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.69 Python 3.7.0 beta 5
---------------------------

'Release date: 2018-05-30'

* Menu:

* Core and Builtins: Core and Builtins<165>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<59>.
* ビルド: ビルド<67>.
* macOS: macOS<46>.
* IDLE: IDLE<40>.


File: python.info,  Node: Core and Builtins<165>,  Next: ライブラリ<169>,  Up: Python 3 7 0 beta 5

1.24.69.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: 13dd. list.  *note PyGC_Collect(): b89. 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: ライブラリ<169>,  Next: ドキュメント<61>,  Prev: Core and Builtins<165>,  Up: Python 3 7 0 beta 5

1.24.69.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(): da5. 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: ドキュメント<61>,  Next: テスト<59>,  Prev: ライブラリ<169>,  Up: Python 3 7 0 beta 5

1.24.69.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: テスト<59>,  Next: ビルド<67>,  Prev: ドキュメント<61>,  Up: Python 3 7 0 beta 5

1.24.69.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: ビルド<67>,  Next: macOS<46>,  Prev: テスト<59>,  Up: Python 3 7 0 beta 5

1.24.69.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<46>,  Next: IDLE<40>,  Prev: ビルド<67>,  Up: Python 3 7 0 beta 5

1.24.69.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<40>,  Prev: macOS<46>,  Up: Python 3 7 0 beta 5

1.24.69.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.70 Python 3.7.0 beta 4
---------------------------

'Release date: 2018-05-02'

* Menu:

* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<60>.
* ビルド: ビルド<68>.
* Windows: Windows<59>.
* macOS: macOS<47>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<38>.


File: python.info,  Node: Core and Builtins<166>,  Next: ライブラリ<170>,  Up: Python 3 7 0 beta 4

1.24.70.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: ライブラリ<170>,  Next: ドキュメント<62>,  Prev: Core and Builtins<166>,  Up: Python 3 7 0 beta 4

1.24.70.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: 1e80.

   - 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:
     12f5. 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: 23e. 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: 3e2. 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: 199. 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(): 1e81.

   - 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: ドキュメント<62>,  Next: テスト<60>,  Prev: ライブラリ<170>,  Up: Python 3 7 0 beta 4

1.24.70.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: テスト<60>,  Next: ビルド<68>,  Prev: ドキュメント<62>,  Up: Python 3 7 0 beta 4

1.24.70.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: ビルド<68>,  Next: Windows<59>,  Prev: テスト<60>,  Up: Python 3 7 0 beta 4

1.24.70.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<59>,  Next: macOS<47>,  Prev: ビルド<68>,  Up: Python 3 7 0 beta 4

1.24.70.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<47>,  Next: IDLE<41>,  Prev: Windows<59>,  Up: Python 3 7 0 beta 4

1.24.70.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<41>,  Next: Tools/Demos<38>,  Prev: macOS<47>,  Up: Python 3 7 0 beta 4

1.24.70.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<41>,  Up: Python 3 7 0 beta 4

1.24.70.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.71 Python 3.7.0 beta 3
---------------------------

'Release date: 2018-03-29'

* Menu:

* セキュリティ: セキュリティ<52>.
* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<61>.
* ビルド: ビルド<69>.
* Windows: Windows<60>.
* macOS: macOS<48>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<61>.


File: python.info,  Node: セキュリティ<52>,  Next: Core and Builtins<167>,  Up: Python 3 7 0 beta 3

1.24.71.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<167>,  Next: ライブラリ<171>,  Prev: セキュリティ<52>,  Up: Python 3 7 0 beta 3

1.24.71.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: ライブラリ<171>,  Next: ドキュメント<63>,  Prev: Core and Builtins<167>,  Up: Python 3 7 0 beta 3

1.24.71.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: 11a. 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: 2ee. 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: d77. 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: ドキュメント<63>,  Next: テスト<61>,  Prev: ライブラリ<171>,  Up: Python 3 7 0 beta 3

1.24.71.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: 137. 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: テスト<61>,  Next: ビルド<69>,  Prev: ドキュメント<63>,  Up: Python 3 7 0 beta 3

1.24.71.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: ビルド<69>,  Next: Windows<60>,  Prev: テスト<61>,  Up: Python 3 7 0 beta 3

1.24.71.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<60>,  Next: macOS<48>,  Prev: ビルド<69>,  Up: Python 3 7 0 beta 3

1.24.71.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<48>,  Next: IDLE<42>,  Prev: Windows<60>,  Up: Python 3 7 0 beta 3

1.24.71.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<42>,  Next: Tools/Demos<39>,  Prev: macOS<48>,  Up: Python 3 7 0 beta 3

1.24.71.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: 1ba.; ‘-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<61>,  Prev: IDLE<42>,  Up: Python 3 7 0 beta 3

1.24.71.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<61>,  Prev: Tools/Demos<39>,  Up: Python 3 7 0 beta 3

1.24.71.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.72 Python 3.7.0 beta 2
---------------------------

'Release date: 2018-02-27'

* Menu:

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<62>.
* ビルド: ビルド<70>.
* Windows: Windows<61>.
* macOS: macOS<49>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<40>.


File: python.info,  Node: セキュリティ<53>,  Next: Core and Builtins<168>,  Up: Python 3 7 0 beta 2

1.24.72.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<168>,  Next: ライブラリ<172>,  Prev: セキュリティ<53>,  Up: Python 3 7 0 beta 2

1.24.72.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: ライブラリ<172>,  Next: ドキュメント<64>,  Prev: Core and Builtins<168>,  Up: Python 3 7 0 beta 2

1.24.72.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: 1a4. 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(): 18b4. 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: 100.
     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: ドキュメント<64>,  Next: テスト<62>,  Prev: ライブラリ<172>,  Up: Python 3 7 0 beta 2

1.24.72.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: 1a4. 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: テスト<62>,  Next: ビルド<70>,  Prev: ドキュメント<64>,  Up: Python 3 7 0 beta 2

1.24.72.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: ビルド<70>,  Next: Windows<61>,  Prev: テスト<62>,  Up: Python 3 7 0 beta 2

1.24.72.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<61>,  Next: macOS<49>,  Prev: ビルド<70>,  Up: Python 3 7 0 beta 2

1.24.72.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(): b1e. 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<49>,  Next: IDLE<43>,  Prev: Windows<61>,  Up: Python 3 7 0 beta 2

1.24.72.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<43>,  Next: Tools/Demos<40>,  Prev: macOS<49>,  Up: Python 3 7 0 beta 2

1.24.72.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<43>,  Up: Python 3 7 0 beta 2

1.24.72.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.73 Python 3.7.0 beta 1
---------------------------

'Release date: 2018-01-30'

* Menu:

* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<65>.
* テスト: テスト<63>.
* ビルド: ビルド<71>.
* Windows: Windows<62>.
* macOS: macOS<50>.
* C API: C API<62>.


File: python.info,  Node: Core and Builtins<169>,  Next: ライブラリ<173>,  Up: Python 3 7 0 beta 1

1.24.73.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: ライブラリ<173>,  Next: ドキュメント<65>,  Prev: Core and Builtins<169>,  Up: Python 3 7 0 beta 1

1.24.73.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:
     16df. 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():
     d06. and *note asyncio.StreamWriter.is_closing(): d07. 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: 1fc. 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: de6. 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
     path-like object as well.

   - bpo-31900(44): The *note locale.localeconv(): dfc. 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: 19c, *note float:
     197, ‘float’ 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: ドキュメント<65>,  Next: テスト<63>,  Prev: ライブラリ<173>,  Up: Python 3 7 0 beta 1

1.24.73.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: テスト<63>,  Next: ビルド<71>,  Prev: ドキュメント<65>,  Up: Python 3 7 0 beta 1

1.24.73.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: ビルド<71>,  Next: Windows<62>,  Prev: テスト<63>,  Up: Python 3 7 0 beta 1

1.24.73.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<62>,  Next: macOS<50>,  Prev: ビルド<71>,  Up: Python 3 7 0 beta 1

1.24.73.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<50>,  Next: C API<62>,  Prev: Windows<62>,  Up: Python 3 7 0 beta 1

1.24.73.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<62>,  Prev: macOS<50>,  Up: Python 3 7 0 beta 1

1.24.73.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.74 Python 3.7.0 alpha 4
----------------------------

'Release date: 2018-01-08'

* Menu:

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


File: python.info,  Node: Core and Builtins<170>,  Next: ライブラリ<174>,  Up: Python 3 7 0 alpha 4

1.24.74.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: 1ed4. option now turns on hash
     randomization when the *note PYTHONHASHSEED: 128d. 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: ライブラリ<174>,  Next: ドキュメント<66>,  Prev: Core and Builtins<170>,  Up: Python 3 7 0 alpha 4

1.24.74.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(): f3e. 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: 1d8. 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: ドキュメント<66>,  Next: テスト<64>,  Prev: ライブラリ<174>,  Up: Python 3 7 0 alpha 4

1.24.74.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: テスト<64>,  Next: Windows<63>,  Prev: ドキュメント<66>,  Up: Python 3 7 0 alpha 4

1.24.74.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<63>,  Next: Tools/Demos<41>,  Prev: テスト<64>,  Up: Python 3 7 0 alpha 4

1.24.74.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<63>,  Prev: Windows<63>,  Up: Python 3 7 0 alpha 4

1.24.74.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<63>,  Prev: Tools/Demos<41>,  Up: Python 3 7 0 alpha 4

1.24.74.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.75 Python 3.7.0 alpha 3
----------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<65>.
* ビルド: ビルド<72>.
* Windows: Windows<64>.
* macOS: macOS<51>.
* IDLE: IDLE<44>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<64>.


File: python.info,  Node: Core and Builtins<171>,  Next: ライブラリ<175>,  Up: Python 3 7 0 alpha 3

1.24.75.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: ライブラリ<175>,  Next: ドキュメント<67>,  Prev: Core and Builtins<171>,  Up: Python 3 7 0 alpha 3

1.24.75.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: 1ede. flag

   - bpo-32154(9): The ‘asyncio.windows_utils.socketpair()’ function has
     been removed: use directly *note socket.socketpair(): df4. 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(): c0d. to find the
     ‘~/.netrc’ file in *note netrc.netrc: 1cd6.  If it does not exist,
     *note FileNotFoundError: 266. 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(): 1edf. 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: 1a4, *note
     PendingDeprecationWarning: ac9. 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:
     1ee0.  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: d8b, *note time.CLOCK_PROF: d8c. and *note
     time.CLOCK_UPTIME: d8d.

   - 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(): 1ee1. 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(): cdf, *note clock_settime_ns(): ce0, *note
     monotonic_ns(): ce1, *note perf_counter_ns(): ce2, *note
     process_time_ns(): ce3, *note time_ns(): ce4.

   - 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(): 1686.  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: b00.  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: ドキュメント<67>,  Next: テスト<65>,  Prev: ライブラリ<175>,  Up: Python 3 7 0 alpha 3

1.24.75.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: テスト<65>,  Next: ビルド<72>,  Prev: ドキュメント<67>,  Up: Python 3 7 0 alpha 3

1.24.75.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: ビルド<72>,  Next: Windows<64>,  Prev: テスト<65>,  Up: Python 3 7 0 alpha 3

1.24.75.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<64>,  Next: macOS<51>,  Prev: ビルド<72>,  Up: Python 3 7 0 alpha 3

1.24.75.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<51>,  Next: IDLE<44>,  Prev: Windows<64>,  Up: Python 3 7 0 alpha 3

1.24.75.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<44>,  Next: Tools/Demos<42>,  Prev: macOS<51>,  Up: Python 3 7 0 alpha 3

1.24.75.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<64>,  Prev: IDLE<44>,  Up: Python 3 7 0 alpha 3

1.24.75.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<64>,  Prev: Tools/Demos<42>,  Up: Python 3 7 0 alpha 3

1.24.75.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.76 Python 3.7.0 alpha 2
----------------------------

'Release date: 2017-10-16'

* Menu:

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<68>.
* ビルド: ビルド<73>.
* IDLE: IDLE<45>.
* C API: C API<65>.


File: python.info,  Node: Core and Builtins<172>,  Next: ライブラリ<176>,  Up: Python 3 7 0 alpha 2

1.24.76.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: cf1. 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: ライブラリ<176>,  Next: ドキュメント<68>,  Prev: Core and Builtins<172>,  Up: Python 3 7 0 alpha 2

1.24.76.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: 1d8. constructor.  Also,
     free job resources in ‘concurrent.futures.ProcessPoolExecutor’
     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: ドキュメント<68>,  Next: ビルド<73>,  Prev: ライブラリ<176>,  Up: Python 3 7 0 alpha 2

1.24.76.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: ビルド<73>,  Next: IDLE<45>,  Prev: ドキュメント<68>,  Up: Python 3 7 0 alpha 2

1.24.76.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<45>,  Next: C API<65>,  Prev: ビルド<73>,  Up: Python 3 7 0 alpha 2

1.24.76.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<65>,  Prev: IDLE<45>,  Up: Python 3 7 0 alpha 2

1.24.76.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.77 Python 3.7.0 alpha 1
----------------------------

'Release date: 2017-09-19'

* Menu:

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<177>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<66>.
* ビルド: ビルド<74>.
* Windows: Windows<65>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<66>.


File: python.info,  Node: セキュリティ<54>,  Next: Core and Builtins<173>,  Up: Python 3 7 0 alpha 1

1.24.77.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<173>,  Next: ライブラリ<177>,  Prev: セキュリティ<54>,  Up: Python 3 7 0 alpha 1

1.24.77.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: a85.

   - 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(): 171c. 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: ライブラリ<177>,  Next: ドキュメント<69>,  Prev: Core and Builtins<173>,  Up: Python 3 7 0 alpha 1

1.24.77.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: 16a.
     instead of *note bytes: 193.

   - 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: ドキュメント<69>,  Next: テスト<66>,  Prev: ライブラリ<177>,  Up: Python 3 7 0 alpha 1

1.24.77.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(): 193. and *note
     bytearray(): 342. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     1ef6. and *note bytearray: 1ef7. 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: テスト<66>,  Next: ビルド<74>,  Prev: ドキュメント<69>,  Up: Python 3 7 0 alpha 1

1.24.77.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: ビルド<74>,  Next: Windows<65>,  Prev: テスト<66>,  Up: Python 3 7 0 alpha 1

1.24.77.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<65>,  Next: IDLE<46>,  Prev: ビルド<74>,  Up: Python 3 7 0 alpha 1

1.24.77.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<46>,  Next: Tools/Demos<43>,  Prev: Windows<65>,  Up: Python 3 7 0 alpha 1

1.24.77.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<66>,  Prev: IDLE<46>,  Up: Python 3 7 0 alpha 1

1.24.77.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<66>,  Prev: Tools/Demos<43>,  Up: Python 3 7 0 alpha 1

1.24.77.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.78 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.79 Python 3.6.6 release candidate 1
----------------------------------------

'Release date: 2018-06-11'

* Menu:

* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<67>.
* ビルド: ビルド<75>.
* Windows: Windows<66>.
* macOS: macOS<52>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<67>.


File: python.info,  Node: Core and Builtins<174>,  Next: ライブラリ<178>,  Up: Python 3 6 6 release candidate 1

1.24.79.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: 13dd. list.  *note PyGC_Collect(): b89. 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: ライブラリ<178>,  Next: ドキュメント<70>,  Prev: Core and Builtins<174>,  Up: Python 3 6 6 release candidate 1

1.24.79.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: 199. 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: 1e80.

   - 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(): 1e81.

   - 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: ドキュメント<70>,  Next: テスト<67>,  Prev: ライブラリ<178>,  Up: Python 3 6 6 release candidate 1

1.24.79.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: 137. 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: テスト<67>,  Next: ビルド<75>,  Prev: ドキュメント<70>,  Up: Python 3 6 6 release candidate 1

1.24.79.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: ビルド<75>,  Next: Windows<66>,  Prev: テスト<67>,  Up: Python 3 6 6 release candidate 1

1.24.79.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<66>,  Next: macOS<52>,  Prev: ビルド<75>,  Up: Python 3 6 6 release candidate 1

1.24.79.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<52>,  Next: IDLE<47>,  Prev: Windows<66>,  Up: Python 3 6 6 release candidate 1

1.24.79.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<47>,  Next: Tools/Demos<44>,  Prev: macOS<52>,  Up: Python 3 6 6 release candidate 1

1.24.79.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<67>,  Prev: IDLE<47>,  Up: Python 3 6 6 release candidate 1

1.24.79.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<67>,  Prev: Tools/Demos<44>,  Up: Python 3 6 6 release candidate 1

1.24.79.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.80 Python 3.6.5 final
--------------------------

'Release date: 2018-03-28'

* Menu:

* テスト: テスト<68>.
* ビルド: ビルド<76>.


File: python.info,  Node: テスト<68>,  Next: ビルド<76>,  Up: Python 3 6 5 final

1.24.80.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: ビルド<76>,  Prev: テスト<68>,  Up: Python 3 6 5 final

1.24.80.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.81 Python 3.6.5 release candidate 1
----------------------------------------

'Release date: 2018-03-13'

* Menu:

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


File: python.info,  Node: セキュリティ<55>,  Next: Core and Builtins<175>,  Up: Python 3 6 5 release candidate 1

1.24.81.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<175>,  Next: ライブラリ<179>,  Prev: セキュリティ<55>,  Up: Python 3 6 5 release candidate 1

1.24.81.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: ライブラリ<179>,  Next: ドキュメント<71>,  Prev: Core and Builtins<175>,  Up: Python 3 6 5 release candidate 1

1.24.81.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: 2ee. 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(): f3e. 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(): dfc. 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: 19c, *note float:
     197, ‘float’ 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: ドキュメント<71>,  Next: テスト<69>,  Prev: ライブラリ<179>,  Up: Python 3 6 5 release candidate 1

1.24.81.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: 1a4. 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: テスト<69>,  Next: ビルド<77>,  Prev: ドキュメント<71>,  Up: Python 3 6 5 release candidate 1

1.24.81.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: ビルド<77>,  Next: Windows<67>,  Prev: テスト<69>,  Up: Python 3 6 5 release candidate 1

1.24.81.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<67>,  Next: macOS<53>,  Prev: ビルド<77>,  Up: Python 3 6 5 release candidate 1

1.24.81.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(): b1e. 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<53>,  Next: IDLE<48>,  Prev: Windows<67>,  Up: Python 3 6 5 release candidate 1

1.24.81.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<48>,  Next: Tools/Demos<45>,  Prev: macOS<53>,  Up: Python 3 6 5 release candidate 1

1.24.81.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: 1ba.; ‘-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<68>,  Prev: IDLE<48>,  Up: Python 3 6 5 release candidate 1

1.24.81.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<68>,  Prev: Tools/Demos<45>,  Up: Python 3 6 5 release candidate 1

1.24.81.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.82 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.83 Python 3.6.4 release candidate 1
----------------------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<180>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<70>.
* ビルド: ビルド<78>.
* Windows: Windows<68>.
* macOS: macOS<54>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<46>.
* C API: C API<69>.


File: python.info,  Node: Core and Builtins<176>,  Next: ライブラリ<180>,  Up: Python 3 6 4 release candidate 1

1.24.83.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: ライブラリ<180>,  Next: ドキュメント<72>,  Prev: Core and Builtins<176>,  Up: Python 3 6 4 release candidate 1

1.24.83.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(): 1edf. 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: ドキュメント<72>,  Next: テスト<70>,  Prev: ライブラリ<180>,  Up: Python 3 6 4 release candidate 1

1.24.83.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: テスト<70>,  Next: ビルド<78>,  Prev: ドキュメント<72>,  Up: Python 3 6 4 release candidate 1

1.24.83.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: ビルド<78>,  Next: Windows<68>,  Prev: テスト<70>,  Up: Python 3 6 4 release candidate 1

1.24.83.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<68>,  Next: macOS<54>,  Prev: ビルド<78>,  Up: Python 3 6 4 release candidate 1

1.24.83.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<54>,  Next: IDLE<49>,  Prev: Windows<68>,  Up: Python 3 6 4 release candidate 1

1.24.83.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<49>,  Next: Tools/Demos<46>,  Prev: macOS<54>,  Up: Python 3 6 4 release candidate 1

1.24.83.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<69>,  Prev: IDLE<49>,  Up: Python 3 6 4 release candidate 1

1.24.83.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<69>,  Prev: Tools/Demos<46>,  Up: Python 3 6 4 release candidate 1

1.24.83.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.84 Python 3.6.3 final
--------------------------

'Release date: 2017-10-03'

* Menu:

* ライブラリ: ライブラリ<181>.
* ビルド: ビルド<79>.


File: python.info,  Node: ライブラリ<181>,  Next: ビルド<79>,  Up: Python 3 6 3 final

1.24.84.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: ビルド<79>,  Prev: ライブラリ<181>,  Up: Python 3 6 3 final

1.24.84.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.85 Python 3.6.3 release candidate 1
----------------------------------------

'Release date: 2017-09-18'

* Menu:

* セキュリティ: セキュリティ<56>.
* Core and Builtins: Core and Builtins<177>.
* ライブラリ: ライブラリ<182>.
* ドキュメント: ドキュメント<73>.
* テスト: テスト<71>.
* ビルド: ビルド<80>.
* Windows: Windows<69>.
* IDLE: IDLE<50>.
* Tools/Demos: Tools/Demos<47>.


File: python.info,  Node: セキュリティ<56>,  Next: Core and Builtins<177>,  Up: Python 3 6 3 release candidate 1

1.24.85.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<177>,  Next: ライブラリ<182>,  Prev: セキュリティ<56>,  Up: Python 3 6 3 release candidate 1

1.24.85.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: ライブラリ<182>,  Next: ドキュメント<73>,  Prev: Core and Builtins<177>,  Up: Python 3 6 3 release candidate 1

1.24.85.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: ドキュメント<73>,  Next: テスト<71>,  Prev: ライブラリ<182>,  Up: Python 3 6 3 release candidate 1

1.24.85.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: テスト<71>,  Next: ビルド<80>,  Prev: ドキュメント<73>,  Up: Python 3 6 3 release candidate 1

1.24.85.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: ビルド<80>,  Next: Windows<69>,  Prev: テスト<71>,  Up: Python 3 6 3 release candidate 1

1.24.85.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<69>,  Next: IDLE<50>,  Prev: ビルド<80>,  Up: Python 3 6 3 release candidate 1

1.24.85.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<50>,  Next: Tools/Demos<47>,  Prev: Windows<69>,  Up: Python 3 6 3 release candidate 1

1.24.85.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<50>,  Up: Python 3 6 3 release candidate 1

1.24.85.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.86 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.87 Python 3.6.2 release candidate 2
----------------------------------------

'Release date: 2017-07-07'

* Menu:

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


File: python.info,  Node: セキュリティ<57>,  Up: Python 3 6 2 release candidate 2

1.24.87.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.88 Python 3.6.2 release candidate 1
----------------------------------------

'Release date: 2017-06-17'

* Menu:

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<183>.
* IDLE: IDLE<51>.
* C API: C API<70>.
* ビルド: ビルド<81>.
* ドキュメント: ドキュメント<74>.
* Tools/Demos: Tools/Demos<48>.
* テスト: テスト<72>.
* Windows: Windows<70>.


File: python.info,  Node: セキュリティ<58>,  Next: Core and Builtins<178>,  Up: Python 3 6 2 release candidate 1

1.24.88.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<178>,  Next: ライブラリ<183>,  Prev: セキュリティ<58>,  Up: Python 3 6 2 release candidate 1

1.24.88.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: a85.

   - 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: ライブラリ<183>,  Next: IDLE<51>,  Prev: Core and Builtins<178>,  Up: Python 3 6 2 release candidate 1

1.24.88.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<51>,  Next: C API<70>,  Prev: ライブラリ<183>,  Up: Python 3 6 2 release candidate 1

1.24.88.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<70>,  Next: ビルド<81>,  Prev: IDLE<51>,  Up: Python 3 6 2 release candidate 1

1.24.88.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: ビルド<81>,  Next: ドキュメント<74>,  Prev: C API<70>,  Up: Python 3 6 2 release candidate 1

1.24.88.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: ドキュメント<74>,  Next: Tools/Demos<48>,  Prev: ビルド<81>,  Up: Python 3 6 2 release candidate 1

1.24.88.7 ドキュメント
......................

   - bpo-30176(1): Add missing attribute related constants in curses
     documentation.

   - bpo-30052(2): the link targets for *note bytes(): 193. and *note
     bytearray(): 342. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     1ef6. and *note bytearray: 1ef7. 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: テスト<72>,  Prev: ドキュメント<74>,  Up: Python 3 6 2 release candidate 1

1.24.88.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: テスト<72>,  Next: Windows<70>,  Prev: Tools/Demos<48>,  Up: Python 3 6 2 release candidate 1

1.24.88.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<70>,  Prev: テスト<72>,  Up: Python 3 6 2 release candidate 1

1.24.88.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.89 Python 3.6.1 final
--------------------------

'Release date: 2017-03-21'

* Menu:

* Core and Builtins: Core and Builtins<179>.
* ビルド: ビルド<82>.


File: python.info,  Node: Core and Builtins<179>,  Next: ビルド<82>,  Up: Python 3 6 1 final

1.24.89.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: ビルド<82>,  Prev: Core and Builtins<179>,  Up: Python 3 6 1 final

1.24.89.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.90 Python 3.6.1 release candidate 1
----------------------------------------

'Release date: 2017-03-04'

* Menu:

* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<184>.
* IDLE: IDLE<52>.
* Windows: Windows<71>.
* C API: C API<71>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<73>.
* ビルド: ビルド<83>.


File: python.info,  Node: Core and Builtins<180>,  Next: ライブラリ<184>,  Up: Python 3 6 1 release candidate 1

1.24.90.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: ライブラリ<184>,  Next: IDLE<52>,  Prev: Core and Builtins<180>,  Up: Python 3 6 1 release candidate 1

1.24.90.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<52>,  Next: Windows<71>,  Prev: ライブラリ<184>,  Up: Python 3 6 1 release candidate 1

1.24.90.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<71>,  Next: C API<71>,  Prev: IDLE<52>,  Up: Python 3 6 1 release candidate 1

1.24.90.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<71>,  Next: ドキュメント<75>,  Prev: Windows<71>,  Up: Python 3 6 1 release candidate 1

1.24.90.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: ドキュメント<75>,  Next: テスト<73>,  Prev: C API<71>,  Up: Python 3 6 1 release candidate 1

1.24.90.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: テスト<73>,  Next: ビルド<83>,  Prev: ドキュメント<75>,  Up: Python 3 6 1 release candidate 1

1.24.90.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: ビルド<83>,  Prev: テスト<73>,  Up: Python 3 6 1 release candidate 1

1.24.90.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.91 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.92 Python 3.6.0 release candidate 2
----------------------------------------

'Release date: 2016-12-16'

* Menu:

* Core and Builtins: Core and Builtins<181>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<72>.
* ビルド: ビルド<84>.


File: python.info,  Node: Core and Builtins<181>,  Next: Tools/Demos<49>,  Up: Python 3 6 0 release candidate 2

1.24.92.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<72>,  Prev: Core and Builtins<181>,  Up: Python 3 6 0 release candidate 2

1.24.92.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<72>,  Next: ビルド<84>,  Prev: Tools/Demos<49>,  Up: Python 3 6 0 release candidate 2

1.24.92.3 Windows
.................

   - bpo-28896(1): Deprecate WindowsRegistryFinder.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28896


File: python.info,  Node: ビルド<84>,  Prev: Windows<72>,  Up: Python 3 6 0 release candidate 2

1.24.92.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.93 Python 3.6.0 release candidate 1
----------------------------------------

'Release date: 2016-12-06'

* Menu:

* Core and Builtins: Core and Builtins<182>.
* ライブラリ: ライブラリ<185>.
* C API: C API<72>.
* ドキュメント: ドキュメント<76>.
* Tools/Demos: Tools/Demos<50>.


File: python.info,  Node: Core and Builtins<182>,  Next: ライブラリ<185>,  Up: Python 3 6 0 release candidate 1

1.24.93.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: ライブラリ<185>,  Next: C API<72>,  Prev: Core and Builtins<182>,  Up: Python 3 6 0 release candidate 1

1.24.93.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<72>,  Next: ドキュメント<76>,  Prev: ライブラリ<185>,  Up: Python 3 6 0 release candidate 1

1.24.93.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: ドキュメント<76>,  Next: Tools/Demos<50>,  Prev: C API<72>,  Up: Python 3 6 0 release candidate 1

1.24.93.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: ドキュメント<76>,  Up: Python 3 6 0 release candidate 1

1.24.93.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.94 Python 3.6.0 beta 4
---------------------------

'Release date: 2016-11-21'

* Menu:

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<186>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<74>.
* ビルド: ビルド<85>.


File: python.info,  Node: Core and Builtins<183>,  Next: ライブラリ<186>,  Up: Python 3 6 0 beta 4

1.24.94.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: ライブラリ<186>,  Next: ドキュメント<77>,  Prev: Core and Builtins<183>,  Up: Python 3 6 0 beta 4

1.24.94.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: ドキュメント<77>,  Next: テスト<74>,  Prev: ライブラリ<186>,  Up: Python 3 6 0 beta 4

1.24.94.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: テスト<74>,  Next: ビルド<85>,  Prev: ドキュメント<77>,  Up: Python 3 6 0 beta 4

1.24.94.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: ビルド<85>,  Prev: テスト<74>,  Up: Python 3 6 0 beta 4

1.24.94.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.95 Python 3.6.0 beta 3
---------------------------

'Release date: 2016-10-31'

* Menu:

* Core and Builtins: Core and Builtins<184>.
* ライブラリ: ライブラリ<187>.
* Windows: Windows<73>.
* ビルド: ビルド<86>.
* テスト: テスト<75>.


File: python.info,  Node: Core and Builtins<184>,  Next: ライブラリ<187>,  Up: Python 3 6 0 beta 3

1.24.95.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: ライブラリ<187>,  Next: Windows<73>,  Prev: Core and Builtins<184>,  Up: Python 3 6 0 beta 3

1.24.95.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<73>,  Next: ビルド<86>,  Prev: ライブラリ<187>,  Up: Python 3 6 0 beta 3

1.24.95.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: ビルド<86>,  Next: テスト<75>,  Prev: Windows<73>,  Up: Python 3 6 0 beta 3

1.24.95.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: テスト<75>,  Prev: ビルド<86>,  Up: Python 3 6 0 beta 3

1.24.95.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.96 Python 3.6.0 beta 2
---------------------------

'Release date: 2016-10-10'

* Menu:

* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<188>.
* Windows: Windows<74>.
* C API: C API<73>.
* ビルド: ビルド<87>.
* テスト: テスト<76>.


File: python.info,  Node: Core and Builtins<185>,  Next: ライブラリ<188>,  Up: Python 3 6 0 beta 2

1.24.96.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: ライブラリ<188>,  Next: Windows<74>,  Prev: Core and Builtins<185>,  Up: Python 3 6 0 beta 2

1.24.96.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<74>,  Next: C API<73>,  Prev: ライブラリ<188>,  Up: Python 3 6 0 beta 2

1.24.96.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<73>,  Next: ビルド<87>,  Prev: Windows<74>,  Up: Python 3 6 0 beta 2

1.24.96.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: ビルド<87>,  Next: テスト<76>,  Prev: C API<73>,  Up: Python 3 6 0 beta 2

1.24.96.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: テスト<76>,  Prev: ビルド<87>,  Up: Python 3 6 0 beta 2

1.24.96.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.97 Python 3.6.0 beta 1
---------------------------

'Release date: 2016-09-12'

* Menu:

* Core and Builtins: Core and Builtins<186>.
* ライブラリ: ライブラリ<189>.
* IDLE: IDLE<53>.
* C API: C API<74>.
* テスト: テスト<77>.
* ビルド: ビルド<88>.
* Tools/Demos: Tools/Demos<51>.
* Windows: Windows<75>.


File: python.info,  Node: Core and Builtins<186>,  Next: ライブラリ<189>,  Up: Python 3 6 0 beta 1

1.24.97.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: ライブラリ<189>,  Next: IDLE<53>,  Prev: Core and Builtins<186>,  Up: Python 3 6 0 beta 1

1.24.97.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(): ebd. 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<53>,  Next: C API<74>,  Prev: ライブラリ<189>,  Up: Python 3 6 0 beta 1

1.24.97.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<74>,  Next: テスト<77>,  Prev: IDLE<53>,  Up: Python 3 6 0 beta 1

1.24.97.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: テスト<77>,  Next: ビルド<88>,  Prev: C API<74>,  Up: Python 3 6 0 beta 1

1.24.97.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: ビルド<88>,  Next: Tools/Demos<51>,  Prev: テスト<77>,  Up: Python 3 6 0 beta 1

1.24.97.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<75>,  Prev: ビルド<88>,  Up: Python 3 6 0 beta 1

1.24.97.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<75>,  Prev: Tools/Demos<51>,  Up: Python 3 6 0 beta 1

1.24.97.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.98 Python 3.6.0 alpha 4
----------------------------

'Release date: 2016-08-15'

* Menu:

* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<190>.
* IDLE: IDLE<54>.
* テスト: テスト<78>.
* Windows: Windows<76>.
* ビルド: ビルド<89>.


File: python.info,  Node: Core and Builtins<187>,  Next: ライブラリ<190>,  Up: Python 3 6 0 alpha 4

1.24.98.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: ライブラリ<190>,  Next: IDLE<54>,  Prev: Core and Builtins<187>,  Up: Python 3 6 0 alpha 4

1.24.98.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<54>,  Next: テスト<78>,  Prev: ライブラリ<190>,  Up: Python 3 6 0 alpha 4

1.24.98.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: テスト<78>,  Next: Windows<76>,  Prev: IDLE<54>,  Up: Python 3 6 0 alpha 4

1.24.98.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<76>,  Next: ビルド<89>,  Prev: テスト<78>,  Up: Python 3 6 0 alpha 4

1.24.98.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: ビルド<89>,  Prev: Windows<76>,  Up: Python 3 6 0 alpha 4

1.24.98.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.99 Python 3.6.0 alpha 3
----------------------------

'Release date: 2016-07-11'

* Menu:

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<191>.
* IDLE: IDLE<55>.
* C API: C API<75>.
* ビルド: ビルド<90>.
* Tools/Demos: Tools/Demos<52>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<79>.


File: python.info,  Node: セキュリティ<59>,  Next: Core and Builtins<188>,  Up: Python 3 6 0 alpha 3

1.24.99.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<188>,  Next: ライブラリ<191>,  Prev: セキュリティ<59>,  Up: Python 3 6 0 alpha 3

1.24.99.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: ライブラリ<191>,  Next: IDLE<55>,  Prev: Core and Builtins<188>,  Up: Python 3 6 0 alpha 3

1.24.99.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<55>,  Next: C API<75>,  Prev: ライブラリ<191>,  Up: Python 3 6 0 alpha 3

1.24.99.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<75>,  Next: ビルド<90>,  Prev: IDLE<55>,  Up: Python 3 6 0 alpha 3

1.24.99.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: ビルド<90>,  Next: Tools/Demos<52>,  Prev: C API<75>,  Up: Python 3 6 0 alpha 3

1.24.99.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: ドキュメント<78>,  Prev: ビルド<90>,  Up: Python 3 6 0 alpha 3

1.24.99.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: ドキュメント<78>,  Next: テスト<79>,  Prev: Tools/Demos<52>,  Up: Python 3 6 0 alpha 3

1.24.99.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: テスト<79>,  Prev: ドキュメント<78>,  Up: Python 3 6 0 alpha 3

1.24.99.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.100 Python 3.6.0 alpha 2
-----------------------------

'Release date: 2016-06-13'

* Menu:

* セキュリティ: セキュリティ<60>.
* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<192>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<80>.
* Windows: Windows<77>.
* ビルド: ビルド<91>.
* C API: C API<76>.
* Tools/Demos: Tools/Demos<53>.


File: python.info,  Node: セキュリティ<60>,  Next: Core and Builtins<189>,  Up: Python 3 6 0 alpha 2

1.24.100.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<189>,  Next: ライブラリ<192>,  Prev: セキュリティ<60>,  Up: Python 3 6 0 alpha 2

1.24.100.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: ライブラリ<192>,  Next: IDLE<56>,  Prev: Core and Builtins<189>,  Up: Python 3 6 0 alpha 2

1.24.100.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<56>,  Next: ドキュメント<79>,  Prev: ライブラリ<192>,  Up: Python 3 6 0 alpha 2

1.24.100.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: ドキュメント<79>,  Next: テスト<80>,  Prev: IDLE<56>,  Up: Python 3 6 0 alpha 2

1.24.100.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: テスト<80>,  Next: Windows<77>,  Prev: ドキュメント<79>,  Up: Python 3 6 0 alpha 2

1.24.100.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<77>,  Next: ビルド<91>,  Prev: テスト<80>,  Up: Python 3 6 0 alpha 2

1.24.100.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: ビルド<91>,  Next: C API<76>,  Prev: Windows<77>,  Up: Python 3 6 0 alpha 2

1.24.100.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<76>,  Next: Tools/Demos<53>,  Prev: ビルド<91>,  Up: Python 3 6 0 alpha 2

1.24.100.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<76>,  Up: Python 3 6 0 alpha 2

1.24.100.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.101 Python 3.6.0 alpha 1
-----------------------------

'Release date: 2016-05-16'

* Menu:

* セキュリティ: セキュリティ<61>.
* Core and Builtins: Core and Builtins<190>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<57>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<81>.
* ビルド: ビルド<92>.
* Windows: Windows<78>.
* Tools/Demos: Tools/Demos<54>.
* C API: C API<77>.


File: python.info,  Node: セキュリティ<61>,  Next: Core and Builtins<190>,  Up: Python 3 6 0 alpha 1

1.24.101.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<190>,  Next: ライブラリ<193>,  Prev: セキュリティ<61>,  Up: Python 3 6 0 alpha 1

1.24.101.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(): e63.
     domain (*note PYMEM_DOMAIN_MEM: e67.) now use the *note pymalloc
     allocator: f0f. rather than system ‘malloc()’.  Applications
     calling ‘PyMem_Malloc()’ 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(): e63. family
     are called without holding the GIL.

   - bpo-26564(25): On error, the debug hooks on Python memory
     allocators now use the *note tracemalloc: 106. module to get the
     traceback where a memory block was allocated.

   - bpo-26558(26): The debug hooks on Python memory allocator *note
     PyObject_Malloc(): e66. now detect when functions are called
     without holding the GIL.

   - bpo-26516(27): Add *note PYTHONMALLOC: e62. environment variable to
     set the Python memory allocators and/or install debug hooks.

   - bpo-26516(28): The *note PyMem_SetupDebugHooks(): e68. function can
     now also be used on Python compiled in release mode.

   - bpo-26516(29): The *note PYTHONMALLOCSTATS: 1f93. 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: ライブラリ<193>,  Next: IDLE<57>,  Prev: Core and Builtins<190>,  Up: Python 3 6 0 alpha 1

1.24.101.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(): 131f, catch *note AttributeError: 5f0.
     instead of *note NameError: 450.  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: 199. if *note
     __import__(): ad5. is tried during the Python shutdown process but
     *note sys.path: 3e2. is already cleared (set to ‘None’).

   - bpo-21925(60): *note warnings.formatwarning(): 1e55. now catches
     exceptions when calling *note linecache.getline(): 242. and *note
     tracemalloc.get_object_traceback(): 1f95. 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: 106. 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():
     f17. 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(): a30. and *note
     pyclbr.readmodule_ex(): a31. 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<57>,  Next: ドキュメント<80>,  Prev: ライブラリ<193>,  Up: Python 3 6 0 alpha 1

1.24.101.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: ドキュメント<80>,  Next: テスト<81>,  Prev: IDLE<57>,  Up: Python 3 6 0 alpha 1

1.24.101.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: テスト<81>,  Next: ビルド<92>,  Prev: ドキュメント<80>,  Up: Python 3 6 0 alpha 1

1.24.101.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: ビルド<92>,  Next: Windows<78>,  Prev: テスト<81>,  Up: Python 3 6 0 alpha 1

1.24.101.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<78>,  Next: Tools/Demos<54>,  Prev: ビルド<92>,  Up: Python 3 6 0 alpha 1

1.24.101.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<77>,  Prev: Windows<78>,  Up: Python 3 6 0 alpha 1

1.24.101.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<77>,  Prev: Tools/Demos<54>,  Up: Python 3 6 0 alpha 1

1.24.101.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.102 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.103 Python 3.5.5 release candidate 1
-----------------------------------------

'Release date: 2018-01-23'

* Menu:

* セキュリティ: セキュリティ<62>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<194>.


File: python.info,  Node: セキュリティ<62>,  Next: Core and Builtins<191>,  Up: Python 3 5 5 release candidate 1

1.24.103.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<191>,  Next: ライブラリ<194>,  Prev: セキュリティ<62>,  Up: Python 3 5 5 release candidate 1

1.24.103.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: ライブラリ<194>,  Prev: Core and Builtins<191>,  Up: Python 3 5 5 release candidate 1

1.24.103.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.104 Python 3.5.4 final
---------------------------

'Release date: 2017-08-07'

* Menu:

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


File: python.info,  Node: ライブラリ<195>,  Up: Python 3 5 4 final

1.24.104.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.105 Python 3.5.4 release candidate 1
-----------------------------------------

'Release date: 2017-07-23'

* Menu:

* セキュリティ: セキュリティ<63>.
* Core and Builtins: Core and Builtins<192>.
* ライブラリ: ライブラリ<196>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<82>.
* ビルド: ビルド<93>.
* Windows: Windows<79>.
* C API: C API<78>.


File: python.info,  Node: セキュリティ<63>,  Next: Core and Builtins<192>,  Up: Python 3 5 4 release candidate 1

1.24.105.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<192>,  Next: ライブラリ<196>,  Prev: セキュリティ<63>,  Up: Python 3 5 4 release candidate 1

1.24.105.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: a85.

   - 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: ライブラリ<196>,  Next: ドキュメント<81>,  Prev: Core and Builtins<192>,  Up: Python 3 5 4 release candidate 1

1.24.105.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: ドキュメント<81>,  Next: テスト<82>,  Prev: ライブラリ<196>,  Up: Python 3 5 4 release candidate 1

1.24.105.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: テスト<82>,  Next: ビルド<93>,  Prev: ドキュメント<81>,  Up: Python 3 5 4 release candidate 1

1.24.105.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: ビルド<93>,  Next: Windows<79>,  Prev: テスト<82>,  Up: Python 3 5 4 release candidate 1

1.24.105.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<79>,  Next: C API<78>,  Prev: ビルド<93>,  Up: Python 3 5 4 release candidate 1

1.24.105.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<78>,  Prev: Windows<79>,  Up: Python 3 5 4 release candidate 1

1.24.105.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.106 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.107 Python 3.5.3 release candidate 1
-----------------------------------------

'Release date: 2017-01-02'

* Menu:

* セキュリティ: セキュリティ<64>.
* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<197>.
* IDLE: IDLE<58>.
* C API: C API<79>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<83>.
* Tools/Demos: Tools/Demos<55>.
* Windows: Windows<80>.
* ビルド: ビルド<94>.


File: python.info,  Node: セキュリティ<64>,  Next: Core and Builtins<193>,  Up: Python 3 5 3 release candidate 1

1.24.107.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<193>,  Next: ライブラリ<197>,  Prev: セキュリティ<64>,  Up: Python 3 5 3 release candidate 1

1.24.107.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: ライブラリ<197>,  Next: IDLE<58>,  Prev: Core and Builtins<193>,  Up: Python 3 5 3 release candidate 1

1.24.107.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<58>,  Next: C API<79>,  Prev: ライブラリ<197>,  Up: Python 3 5 3 release candidate 1

1.24.107.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<79>,  Next: ドキュメント<82>,  Prev: IDLE<58>,  Up: Python 3 5 3 release candidate 1

1.24.107.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: ドキュメント<82>,  Next: テスト<83>,  Prev: C API<79>,  Up: Python 3 5 3 release candidate 1

1.24.107.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: テスト<83>,  Next: Tools/Demos<55>,  Prev: ドキュメント<82>,  Up: Python 3 5 3 release candidate 1

1.24.107.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<80>,  Prev: テスト<83>,  Up: Python 3 5 3 release candidate 1

1.24.107.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<80>,  Next: ビルド<94>,  Prev: Tools/Demos<55>,  Up: Python 3 5 3 release candidate 1

1.24.107.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: ビルド<94>,  Prev: Windows<80>,  Up: Python 3 5 3 release candidate 1

1.24.107.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.108 Python 3.5.2 final
---------------------------

'Release date: 2016-06-26'

* Menu:

* Core and Builtins: Core and Builtins<194>.
* テスト: テスト<84>.
* IDLE: IDLE<59>.


File: python.info,  Node: Core and Builtins<194>,  Next: テスト<84>,  Up: Python 3 5 2 final

1.24.108.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: テスト<84>,  Next: IDLE<59>,  Prev: Core and Builtins<194>,  Up: Python 3 5 2 final

1.24.108.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<59>,  Prev: テスト<84>,  Up: Python 3 5 2 final

1.24.108.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.109 Python 3.5.2 release candidate 1
-----------------------------------------

'Release date: 2016-06-12'

* Menu:

* セキュリティ: セキュリティ<65>.
* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<198>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<83>.
* テスト: テスト<85>.
* ビルド: ビルド<95>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<56>.


File: python.info,  Node: セキュリティ<65>,  Next: Core and Builtins<195>,  Up: Python 3 5 2 release candidate 1

1.24.109.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<195>,  Next: ライブラリ<198>,  Prev: セキュリティ<65>,  Up: Python 3 5 2 release candidate 1

1.24.109.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: ライブラリ<198>,  Next: IDLE<60>,  Prev: Core and Builtins<195>,  Up: Python 3 5 2 release candidate 1

1.24.109.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(): 131f, catch *note AttributeError: 5f0.
     instead of *note NameError: 450.  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(): 1e55. 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(): a30. and *note
     pyclbr.readmodule_ex(): a31. 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<60>,  Next: ドキュメント<83>,  Prev: ライブラリ<198>,  Up: Python 3 5 2 release candidate 1

1.24.109.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: ドキュメント<83>,  Next: テスト<85>,  Prev: IDLE<60>,  Up: Python 3 5 2 release candidate 1

1.24.109.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: テスト<85>,  Next: ビルド<95>,  Prev: ドキュメント<83>,  Up: Python 3 5 2 release candidate 1

1.24.109.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: ビルド<95>,  Next: Windows<81>,  Prev: テスト<85>,  Up: Python 3 5 2 release candidate 1

1.24.109.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<81>,  Next: Tools/Demos<56>,  Prev: ビルド<95>,  Up: Python 3 5 2 release candidate 1

1.24.109.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<81>,  Up: Python 3 5 2 release candidate 1

1.24.109.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.110 Python 3.5.1 final
---------------------------

'Release date: 2015-12-06'

* Menu:

* Core and Builtins: Core and Builtins<196>.
* Windows: Windows<82>.


File: python.info,  Node: Core and Builtins<196>,  Next: Windows<82>,  Up: Python 3 5 1 final

1.24.110.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<82>,  Prev: Core and Builtins<196>,  Up: Python 3 5 1 final

1.24.110.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.111 Python 3.5.1 release candidate 1
-----------------------------------------

'Release date: 2015-11-22'

* Menu:

* Core and Builtins: Core and Builtins<197>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<84>.
* テスト: テスト<86>.
* ビルド: ビルド<96>.
* Windows: Windows<83>.
* Tools/Demos: Tools/Demos<57>.


File: python.info,  Node: Core and Builtins<197>,  Next: ライブラリ<199>,  Up: Python 3 5 1 release candidate 1

1.24.111.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: ライブラリ<199>,  Next: IDLE<61>,  Prev: Core and Builtins<197>,  Up: Python 3 5 1 release candidate 1

1.24.111.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<61>,  Next: ドキュメント<84>,  Prev: ライブラリ<199>,  Up: Python 3 5 1 release candidate 1

1.24.111.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: ドキュメント<84>,  Next: テスト<86>,  Prev: IDLE<61>,  Up: Python 3 5 1 release candidate 1

1.24.111.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: テスト<86>,  Next: ビルド<96>,  Prev: ドキュメント<84>,  Up: Python 3 5 1 release candidate 1

1.24.111.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: ビルド<96>,  Next: Windows<83>,  Prev: テスト<86>,  Up: Python 3 5 1 release candidate 1

1.24.111.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<83>,  Next: Tools/Demos<57>,  Prev: ビルド<96>,  Up: Python 3 5 1 release candidate 1

1.24.111.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<83>,  Up: Python 3 5 1 release candidate 1

1.24.111.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.112 Python 3.5.0 final
---------------------------

'Release date: 2015-09-13'

* Menu:

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


File: python.info,  Node: ビルド<97>,  Up: Python 3 5 0 final

1.24.112.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.113 Python 3.5.0 release candidate 4
-----------------------------------------

'Release date: 2015-09-09'

* Menu:

* ライブラリ: ライブラリ<200>.
* ビルド: ビルド<98>.


File: python.info,  Node: ライブラリ<200>,  Next: ビルド<98>,  Up: Python 3 5 0 release candidate 4

1.24.113.1 ライブラリ
.....................

   - bpo-25029(1): Fixes MemoryError in test_strptime.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25029


File: python.info,  Node: ビルド<98>,  Prev: ライブラリ<200>,  Up: Python 3 5 0 release candidate 4

1.24.113.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.114 Python 3.5.0 release candidate 3
-----------------------------------------

'Release date: 2015-09-07'

* Menu:

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


File: python.info,  Node: Core and Builtins<198>,  Next: ライブラリ<201>,  Up: Python 3 5 0 release candidate 3

1.24.114.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: ライブラリ<201>,  Prev: Core and Builtins<198>,  Up: Python 3 5 0 release candidate 3

1.24.114.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.115 Python 3.5.0 release candidate 2
-----------------------------------------

'Release date: 2015-08-25'

* Menu:

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


File: python.info,  Node: Core and Builtins<199>,  Next: ライブラリ<202>,  Up: Python 3 5 0 release candidate 2

1.24.115.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: ライブラリ<202>,  Prev: Core and Builtins<199>,  Up: Python 3 5 0 release candidate 2

1.24.115.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.116 Python 3.5.0 release candidate 1
-----------------------------------------

'Release date: 2015-08-09'

* Menu:

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


File: python.info,  Node: Core and Builtins<200>,  Next: ライブラリ<203>,  Up: Python 3 5 0 release candidate 1

1.24.116.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: ライブラリ<203>,  Next: IDLE<62>,  Prev: Core and Builtins<200>,  Up: Python 3 5 0 release candidate 1

1.24.116.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<62>,  Next: ドキュメント<85>,  Prev: ライブラリ<203>,  Up: Python 3 5 0 release candidate 1

1.24.116.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: ドキュメント<85>,  Next: テスト<87>,  Prev: IDLE<62>,  Up: Python 3 5 0 release candidate 1

1.24.116.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: テスト<87>,  Prev: ドキュメント<85>,  Up: Python 3 5 0 release candidate 1

1.24.116.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.117 Python 3.5.0 beta 4
----------------------------

'Release date: 2015-07-26'

* Menu:

* Core and Builtins: Core and Builtins<201>.
* ライブラリ: ライブラリ<204>.
* ビルド: ビルド<99>.


File: python.info,  Node: Core and Builtins<201>,  Next: ライブラリ<204>,  Up: Python 3 5 0 beta 4

1.24.117.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: ライブラリ<204>,  Next: ビルド<99>,  Prev: Core and Builtins<201>,  Up: Python 3 5 0 beta 4

1.24.117.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: ビルド<99>,  Prev: ライブラリ<204>,  Up: Python 3 5 0 beta 4

1.24.117.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.118 Python 3.5.0 beta 3
----------------------------

'Release date: 2015-07-05'

* Menu:

* Core and Builtins: Core and Builtins<202>.
* ライブラリ: ライブラリ<205>.
* テスト: テスト<88>.
* ドキュメント: ドキュメント<86>.
* ビルド: ビルド<100>.


File: python.info,  Node: Core and Builtins<202>,  Next: ライブラリ<205>,  Up: Python 3 5 0 beta 3

1.24.118.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: ライブラリ<205>,  Next: テスト<88>,  Prev: Core and Builtins<202>,  Up: Python 3 5 0 beta 3

1.24.118.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: テスト<88>,  Next: ドキュメント<86>,  Prev: ライブラリ<205>,  Up: Python 3 5 0 beta 3

1.24.118.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: ドキュメント<86>,  Next: ビルド<100>,  Prev: テスト<88>,  Up: Python 3 5 0 beta 3

1.24.118.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: ビルド<100>,  Prev: ドキュメント<86>,  Up: Python 3 5 0 beta 3

1.24.118.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.119 Python 3.5.0 beta 2
----------------------------

'Release date: 2015-05-31'

* Menu:

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<206>.


File: python.info,  Node: Core and Builtins<203>,  Next: ライブラリ<206>,  Up: Python 3 5 0 beta 2

1.24.119.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: ライブラリ<206>,  Prev: Core and Builtins<203>,  Up: Python 3 5 0 beta 2

1.24.119.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.120 Python 3.5.0 beta 1
----------------------------

'Release date: 2015-05-24'

* Menu:

* Core and Builtins: Core and Builtins<204>.
* ライブラリ: ライブラリ<207>.
* IDLE: IDLE<63>.
* テスト: テスト<89>.
* ドキュメント: ドキュメント<87>.
* Tools/Demos: Tools/Demos<58>.


File: python.info,  Node: Core and Builtins<204>,  Next: ライブラリ<207>,  Up: Python 3 5 0 beta 1

1.24.120.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: ライブラリ<207>,  Next: IDLE<63>,  Prev: Core and Builtins<204>,  Up: Python 3 5 0 beta 1

1.24.120.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<63>,  Next: テスト<89>,  Prev: ライブラリ<207>,  Up: Python 3 5 0 beta 1

1.24.120.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: テスト<89>,  Next: ドキュメント<87>,  Prev: IDLE<63>,  Up: Python 3 5 0 beta 1

1.24.120.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: ドキュメント<87>,  Next: Tools/Demos<58>,  Prev: テスト<89>,  Up: Python 3 5 0 beta 1

1.24.120.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: ドキュメント<87>,  Up: Python 3 5 0 beta 1

1.24.120.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.121 Python 3.5.0 alpha 4
-----------------------------

'Release date: 2015-04-19'

* Menu:

* Core and Builtins: Core and Builtins<205>.
* ライブラリ: ライブラリ<208>.
* ビルド: ビルド<101>.
* テスト: テスト<90>.
* Tools/Demos: Tools/Demos<59>.
* C API: C API<80>.


File: python.info,  Node: Core and Builtins<205>,  Next: ライブラリ<208>,  Up: Python 3 5 0 alpha 4

1.24.121.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: ライブラリ<208>,  Next: ビルド<101>,  Prev: Core and Builtins<205>,  Up: Python 3 5 0 alpha 4

1.24.121.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(): fac. 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(): fa7. now waits until
     the connection completes instead of raising *note InterruptedError:
     f8c. if the connection is interrupted by signals, signal handlers
     don't raise an exception and the socket is blocking or has a
     timeout.  ‘socket.socket.connect()’ still raise ‘InterruptedError’
     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: ビルド<101>,  Next: テスト<90>,  Prev: ライブラリ<208>,  Up: Python 3 5 0 alpha 4

1.24.121.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: テスト<90>,  Next: Tools/Demos<59>,  Prev: ビルド<101>,  Up: Python 3 5 0 alpha 4

1.24.121.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<80>,  Prev: テスト<90>,  Up: Python 3 5 0 alpha 4

1.24.121.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<80>,  Prev: Tools/Demos<59>,  Up: Python 3 5 0 alpha 4

1.24.121.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.122 Python 3.5.0 alpha 3
-----------------------------

'Release date: 2015-03-28'

* Menu:

* Core and Builtins: Core and Builtins<206>.
* ライブラリ: ライブラリ<209>.
* ビルド: ビルド<102>.
* テスト: テスト<91>.
* Tools/Demos: Tools/Demos<60>.


File: python.info,  Node: Core and Builtins<206>,  Next: ライブラリ<209>,  Up: Python 3 5 0 alpha 3

1.24.122.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: ライブラリ<209>,  Next: ビルド<102>,  Prev: Core and Builtins<206>,  Up: Python 3 5 0 alpha 3

1.24.122.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(): faf. and *note
     signal.sigtimedwait(): fae. 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: ビルド<102>,  Next: テスト<91>,  Prev: ライブラリ<209>,  Up: Python 3 5 0 alpha 3

1.24.122.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: テスト<91>,  Next: Tools/Demos<60>,  Prev: ビルド<102>,  Up: Python 3 5 0 alpha 3

1.24.122.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: テスト<91>,  Up: Python 3 5 0 alpha 3

1.24.122.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.123 Python 3.5.0 alpha 2
-----------------------------

'Release date: 2015-03-09'

* Menu:

* Core and Builtins: Core and Builtins<207>.
* ライブラリ: ライブラリ<210>.
* ビルド: ビルド<103>.
* C API: C API<81>.
* Windows: Windows<84>.


File: python.info,  Node: Core and Builtins<207>,  Next: ライブラリ<210>,  Up: Python 3 5 0 alpha 2

1.24.123.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: ライブラリ<210>,  Next: ビルド<103>,  Prev: Core and Builtins<207>,  Up: Python 3 5 0 alpha 2

1.24.123.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: ビルド<103>,  Next: C API<81>,  Prev: ライブラリ<210>,  Up: Python 3 5 0 alpha 2

1.24.123.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<81>,  Next: Windows<84>,  Prev: ビルド<103>,  Up: Python 3 5 0 alpha 2

1.24.123.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<84>,  Prev: C API<81>,  Up: Python 3 5 0 alpha 2

1.24.123.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.124 Python 3.5.0 alpha 1
-----------------------------

'Release date: 2015-02-08'

* Menu:

* Core and Builtins: Core and Builtins<208>.
* ライブラリ: ライブラリ<211>.
* IDLE: IDLE<64>.
* ビルド: ビルド<104>.
* C API: C API<82>.
* ドキュメント: ドキュメント<88>.
* テスト: テスト<92>.
* Tools/Demos: Tools/Demos<61>.
* Windows: Windows<85>.


File: python.info,  Node: Core and Builtins<208>,  Next: ライブラリ<211>,  Up: Python 3 5 0 alpha 1

1.24.124.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: ライブラリ<211>,  Next: IDLE<64>,  Prev: Core and Builtins<208>,  Up: Python 3 5 0 alpha 1

1.24.124.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(): c84. 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(): c59. 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: cd1. 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<64>,  Next: ビルド<104>,  Prev: ライブラリ<211>,  Up: Python 3 5 0 alpha 1

1.24.124.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: ビルド<104>,  Next: C API<82>,  Prev: IDLE<64>,  Up: Python 3 5 0 alpha 1

1.24.124.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<82>,  Next: ドキュメント<88>,  Prev: ビルド<104>,  Up: Python 3 5 0 alpha 1

1.24.124.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():
     dc4, rename ‘_Py_wchar2char()’ to *note Py_EncodeLocale(): dc5, 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: ドキュメント<88>,  Next: テスト<92>,  Prev: C API<82>,  Up: Python 3 5 0 alpha 1

1.24.124.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: テスト<92>,  Next: Tools/Demos<61>,  Prev: ドキュメント<88>,  Up: Python 3 5 0 alpha 1

1.24.124.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<85>,  Prev: テスト<92>,  Up: Python 3 5 0 alpha 1

1.24.124.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<85>,  Prev: Tools/Demos<61>,  Up: Python 3 5 0 alpha 1

1.24.124.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 標準ライブラリ: 14a.
を参照してください。 また、正式な言語定義は、 *note Python
言語リファレンス: 14b. にあります。 C 言語や C++ 言語で拡張モジュールを
書くなら、 *note Python インタプリタの拡張と埋め込み: 2019. や *note
Python/C API reference manual: 201a. を参照してください。Python の解説書
も販売されています。

このチュートリアルは、Python全体を対象とした、包括的な解説書ではありませ
ん。よく使われる機能に限っても、全ては紹介していません。その代わり、この
チュートリアルでは、Pythonのもっとも特徴的な機能を中心に紹介して、この言
語の持ち味や、スタイルを感じられるようにしています。このチュートリアルを
読み終えると、Python のモジュールやプログラムを読み書きできるようになっ
ているでしょう。また、*note Python 標準ライブラリ: 14a. のさまざまな
Python ライブラリモジュールを、詳しく調べられるようになっているはずです
。

*note 用語集: 201b. にも目を通しておくと良いでしょう。

* Menu:

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


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 ストア: 2025. からPythonのインストールを行った Windows マ
シンでは、 ‘python3.14’ コマンドが利用できます。 *note py.exe ランチャ:
7da. をインストールした場合、 ‘py’ コマンドが使えます。 Python を起動す
る他の方法については *note Python install manager: 2026. を参照してくだ
さい。

ファイル終端文字 (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 対話入力編集と履歴置換: 2027. 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: 1a9. オプションと同じように、
'command' に指定した文を実行します。 Python 文には、スペースなどのシェル
にとって特殊な意味をもつ文字がしばしば含まれるので、 'command' 全体をク
ォート(訳注: ‘'’)で囲っておいたほうが良いでしょう。

Python のモジュールには、スクリプトとしても便利に使えるものがあります。
‘python -m module [arg] ...’ のように起動すると、 'module' のソースファ
イルを、フルパスを指定して起動したかのように実行できます。

スクリプトファイルを使用する場合、スクリプトの実行が完了した後、そのまま
対話モードに入れると便利なことがあります。これには *note -i: 16f9. をス
クリプト名の前に追加します。

全てのコマンドラインオプションは *note コマンドラインと環境: 1e04. で説
明されています。

* 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: 1a9. 'command' を使うと、
‘sys.argv[0]’ は ‘'-c'’ になります。 *note -m: 23e. 'module' を使った場
合、 ‘sys.argv[0]’ はモジュールのフルパスになります。 Python インタープ
リタは、‘-c’ 'command' や ‘-m’ '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: 182.
文は継続行を使用します

     >>> 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" 行: 202f. で始まる場合には、'先頭行'
のルールは当てはまりません。 この場合には、エンコーディングの宣言はファ
イルの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: 19c. 型であり、小数部を
持つ数 (例えば、 ‘5.0’ 、 ‘1.6’) は *note float: 197. 型です。数値型につ
いては後のチュートリアルでさらに見ていきます。

除算 (‘/’) は常に浮動小数点数を返します。 ‘//’ 演算子は *note 整数除算:
b42. を行い、整数値を返します; 剰余は、‘%’ で求めます。:

     >>> 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: 19c. と *note float: 197. に加え、 Python は *note Decimal:
200. や *note Fraction: 215. などの他の数値型もサポートしています。
*note 複素数: 2038. も組み込み型としてサポートしており、 ‘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:
16a. 型によって表現されます) を扱うことができます。 ‘!’ のような文字や
‘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(): 117b. 関数を使うと、両端のクォ
ートがなくなり、エスケープされた文字や特殊文字が表示されるため、より読み
やすい形で出力できます。

     >>> 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:\this\name')  # here \t means tab, \n means newline
     C:      his
     ame
     >>> print(r'C:\this\name')  # note the r before the quote
     C:\this\name

raw文字列には微妙な面があります: raw文字列は奇数個の'''' 文字では終了で
きません。詳細と解決方法については *note the FAQ entry: 203b. を参照して
ください。

文字列リテラルは複数行にまたがって書けます。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 不変: 15bd. です。従って
、文字列のインデックスで指定したある場所に代入を行うとエラーが発生します
:

     >>> 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: 203c.

     文字列は代表的な 'シーケンス型' で、シーケンス型でサポートされてい
     る共通の操作をサポートしています。

*note 文字列メソッド: 203d.

     文字列は、基本的な変換や検索を行うための数多くのメソッドをサポート
     しています。

*note f-strings: 19b.

     式の埋め込みをサポートした文字列リテラル

*note Format string syntax: 15b7.

     *note str.format(): 833. を使った文字列のフォーマットについての情報
     があります。

*note printf 形式の文字列書式化: 8dc.

     文字列が ‘%’ 演算子の左オペランドである場合に呼び出される古いフォー
     マット操作について、詳しく記述されています。

   ---------- 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 不変: 15bd. な文字列とは違って、リストは *note 可変: 15be. 型です
ので、要素を入れ替えられます:

     >>> 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(): 8dd. 'メソッド' を使って、リストの末尾に新しい要素
を追加できます (メソッドについては後で詳しく見ていきます):

     >>> 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 浅いコピー: 2040. を返します。:

     >>> 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: 19d3. は、条件 (ここでは '' a < 10'') が真である限り実
     行を繰り返し (ループし) ます。Python では、C 言語と同様に、ゼロでな
     い整数値は真となり、ゼロは偽です。条件式には、文字列値やリスト値な
     ども使えます。それ以外のシーケンスも、条件式として使用できます。長
     さが 1 以上のシーケンスは真で、空のシーケンスは偽になります。サンプ
     ルで使われている条件テストはシンプルな比較です。標準的な比較演算子
     は C 言語と同様です: すなわち、 ‘<’ (より小さい)、 ‘>’ (より大きい
     )、 ‘==’ (等しい)、 ‘<=’ (より小さいか等しい)、 ‘>=’ (より大きいか
     等しい)、および ‘!=’ (等しくない)、です。

   * ループの '本体 (body)' は、 'インデント (indent, 字下げ)' されてい
     ます: インデントは Python において、実行文をグループにまとめる方法
     です。対話的プロンプトでは、インデントされた各行を入力するにはタブ
     や (複数個の) スペースを使わなければなりません。実用的には、もっと
     複雑な処理を入力する場合はテキストエディタを使うことになるでしょう
     。 ほとんどのテキストエディタは、自動インデント機能を持っています。
     複合文を対話的に入力するときには、入力完了のしるしとして最後に空行
     を入力します。これは、パーザはどれが最後の行を入力なのか、判断でき
     ないためです。基本的なブロック内では、全ての行は同じだけインデント
     されていなければならないので注意してください。

   * *note print(): 117b. 関数は、与えられた引数の値を書き出します。これ
     は (前に電卓の例でやったような) 単に出力したい式を書くのとは、複数
     の引数や浮動小数点量や文字列に対する扱い方が違います。‘print()’ 関
     数では、文字列は引用符無しで出力され、要素の間に空白が挿入されて、
     このように出力の書式が整えられます:

          >>> 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: 19d3. 文の他にも、 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: 182. 文でしょう。例えば:

     >>> 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: 17c. 部を使うことができ、 *note else: 17d. 部を
付けることもできます。キーワード '‘elif’' は 'else if' を短くしたもので
、過剰なインデントを避けるのに役立ちます。一連の ‘if’ ...  ‘elif’ ...
‘elif’ ...  は、他の言語における ‘switch’ 文や ‘case’ 文の代用となります
。

いくつかの定数と同じ値かを比較する場合や、特定の型や属性かを確認する場合
には、‘match’ 文が便利です。詳細は *note match 文: 2049. を参照してくだ
さい。


File: python.info,  Node: for 文,  Next: range 関数,  Prev: if 文,  Up: その他の制御フローツール

2.4.2 ‘for’ 文
--------------

Python の *note for: 348. 文は、読者が C 言語や Pascal 言語で使いなれて
いるかもしれない ‘for’ 文とは少し違います。 (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(): b41.
が便利です。この関数は算術型の数列を生成します:

     >>> 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(): b41.
と *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(): 169f. 関数を使う方が便利です。
*note ループのテクニック: 204e. を参照してください。

range を直接出力すると変なことになります:

     >>> range(10)
     range(0, 10)

*note range(): b41. が返すオブジェクトは、いろいろな点でリストであるかの
ように振る舞いますが、本当はリストではありません。これは、イテレートした
時に望んだ数列の連続した要素を返すオブジェクトです。しかし実際にリストを
作るわけではないので、スペースの節約になります。

このようなオブジェクトは *note イテラブル: 12f5. と呼ばれます。 これらは
関数や構成物のターゲットとして、あるだけの項目を逐次与えるのに適していま
す。 *note for: 348. 文がそのような構成物であることはすでに見てきており
、イテラブルを受け取る関数の例には *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 データ構造: 204f, we will
discuss *note list(): 24f. in more detail.


File: python.info,  Node: break 文と continue 文,  Next: ループの else 節,  Prev: range 関数,  Up: その他の制御フローツール

2.4.4 ‘break’ 文と ‘continue’ 文
--------------------------------

*note break: 180. 文は、その ‘break’ 文を内包している最も内側にある
*note for: 348. 文または *note while: 19d3. 文から抜け出すことができます
:

     >>> 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: 181. 文はループの次のイテレーションを実行します:

     >>> 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: 348. 文の場合、 ‘else’ 節はループ処理の最後のイテレーションが
実行されたあと、つまりbreakが発生しなかった場合に実行されます。

*note while: 19d3. 文の場合は、ループ条件が偽となったあとに実行されます
。

どちらのループでも、ループが *note break: 180. によって終了した場合は
‘else’ 句は '実行されません'。当然、 *note return: 1b0. や例外の発生によ
ってループが途中で終了した場合にも、*note else: 17d. 節の実行はスキップ
されます。

その例として、素数を探索する ‘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: 8f9. 文の
‘else’ に似ています。 文の ‘else’ 句は例外が発生しなかった時に実行され、
ループの ‘else’ 句は ‘break’ されなかった場合に実行されます。 ‘try’ 文と
例外についての詳細は *note 例外を処理する: 2055. を参照してください。


File: python.info,  Node: pass 文,  Next: match 文,  Prev: ループの else 節,  Up: その他の制御フローツール

2.4.6 ‘pass’ 文
---------------

*note pass: 17f. 文は何もしません。 ‘pass’ は、文を書くことが構文上要求
されているが、プログラム上何の動作もする必要がない時に使われます:

     >>> while True:
     ...     pass  # キーボード割り込み(Ctrl+C)のためのビジーウェイト
     ...

これは最小のクラスを作るときによく使われる方法です:

     >>> class MyEmptyClass:
     ...     pass
     ...

*note pass: 17f. のもう 1 つの使い道は、新しいコードを書いているときの関
数や条件文の仮置きの本体としてです。こうすることで、より抽象的なレベルで
考え続けられます。 ‘pass’ は何事も無く無視されます

     >>> def initlog(*args):
     ...     pass   # ここを忘れずに実装すること!
     ...

この最後の例で、多くの人は ‘pass’ ではなく省略記号リテラル ‘...’ を使い
ます。 この使い方は Python に対して特別な意味はなく、言語定義の一部でも
ありません（ここにはどんな定数式でも使えます）が、 ‘...’ は慣例的にプレ
ースホルダ本体としても使われています。 *note Ellipsis オブジェクト:
2058. を参照してください。


File: python.info,  Node: match 文,  Next: 関数を定義する,  Prev: pass 文,  Up: その他の制御フローツール

2.4.7 ‘match’ 文
----------------

*note match: a12. 文は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: 1678. は関数の '定義 (definition)' を導くキーワードです。
‘def’ の後には、関数名と仮引数を丸括弧で囲んだリストを続けなければなりま
せん。関数の実体を構成する実行文は次の行から始め、インデントされていなけ
ればなりません。

関数の本体の記述する文の最初の行は文字列リテラルにすることもできます。そ
の場合、この文字列は関数のドキュメンテーション文字列 (documentation
string)、または 'docstring' と呼ばれます。 (docstring については *note
ドキュメンテーション文字列: 205c. でさらに扱っています。) ドキュメンテー
ション文字列を使ったツールには、オンライン文書や印刷文書を自動的に生成し
たり、ユーザが対話的にコードから直接閲覧できるようにするものがあります。
自分が書くコードにドキュメンテーション文字列を入れるのはよい習慣です。書
く癖をつけてください。

関数を '実行 (execution)' するとき、関数のローカル変数のために使われる新
たなシンボルテーブル (symbol table) が用意されます。 もっと正確にいうと
、関数内で変数への代入を行うと、その値はすべてこのローカルなシンボルテー
ブルに記憶されます。 一方、変数の参照を行うと、まずローカルなシンボルテ
ーブルが検索され、次にさらに外側の関数のローカルなシンボルテーブルを検索
し、その後グローバルなシンボルテーブルを調べ、最後に組み込みの名前テーブ
ルを調べます。 従って、関数の中では (グローバル変数が *note global: 4ac.
文で指定されていたり、外側の関数の変数が *note nonlocal: 14c3. 文で指定
されていない限り) グローバル変数や外側の関数の変数に直接値を代入できませ
んが、参照することはできます。

関数を呼び出す際の実際の引数 (実引数) は、関数が呼び出されるときに関数の
ローカルなシンボルテーブル内に取り込まれます。そうすることで、実引数は
'値渡し (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: 1b0. 文を持たない関数もややつまらない値ですが値を返してい
ます。この値は ‘None’ と呼ばれます (これは組み込みの名前です)。 ‘None’ だ
けを書き出そうとすると、インタプリタは通常出力を抑制します。本当に出力し
たいのなら、以下のように *note print(): 117b. を使うと見ることができます
:

     >>> 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: 1b0. 文では、関数から一つ値を返します。 ‘return’ の引
     数となる式がない場合、 ‘None’ が返ります。関数が終了したときにも
     ‘None’ が返ります。

   * 文 ‘result.append(a)’ では、リストオブジェクト ‘result’ の 'メソッ
     ド (method)' を呼び出しています。メソッドとは、オブジェクトに '属し
     ている' 関数のことで、 ‘obj’ を何らかのオブジェクト (式であっても構
     いません)、 ‘methodname’ をそのオブジェクトで定義されているメソッド
     名とすると、 ‘obj.methodname’ と書き表されます。異なる型は異なるメ
     ソッドを定義しています。異なる型のメソッドで同じ名前のメソッドを持
     つことができ、あいまいさを生じることはありません。 ('クラス
     (class)' を使うことで、自前のオブジェクト型とメソッドを定義すること
     もできます。 *note クラス: 205d. 参照) 例で示されているメソッド
     ‘append()’ は、リストオブジェクトで定義されています; このメソッドは
     リストの末尾に新たな要素を追加します。この例での *note append():
     8dd. は ‘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: 349. キーワードが導入されています。このキーワードは
シーケンスが特定の値を含んでいるかどうか調べるのに使われます。

デフォルト値は、関数が定義された時点で、関数を '定義している' 側のスコー
プ (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 キーワード引数: f12. を使って呼
び出すこともできます。例えば、以下の関数:

     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 Mapping Types --
dict: cc1. を参照) を受け取ります。 ‘**name’ は ‘*name’ の形式をとる、仮
引数のリストを超えた位置引数の入った *note タプル: 2064. を受け取る引数
(次の小節で述べます) と組み合わせられます。 (‘*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
タプルとシーケンス: 2064. を参照) に格納されます。可変個の引数の前に、ゼ
ロ個かそれ以上の引数があっても構いません。

     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(): b41. は引数 '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: 14b9. を使うと、名前のない小さな関数を生成でき
ます。例えば ‘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():
dcc. はソートキー関数 '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 関数アノテーション: 2074. はユーザ定義関数で使用される型についての
完全にオプションなメタデータ情報です (詳細は PEP 3107(1) と PEP 484(2) を
参照してください)。

*note アノテーション: 2075. は関数の *note __annotations__: 456. 属性に
辞書として格納され、関数の他の部分には何も影響を与えません。パラメータア
ノテーションは、パラメータ名の後にコロンを続けることによって定義され、そ
の後にアノテーションの値として評価される式が置かれます。戻り値アノテーシ
ョンは、パラメータリストと *note def: 1678. 文の終わりを表すコロンの間に
置かれたリテラル ‘->’ によって定義され、その後に式が続きます。次の例は必
須の引数とオプション引数、そして戻り値のアノテーションを持っています:

     >>> 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 クラス初見: 2078. を見よ) とし
     て使うこと。

   * あなたのコードを世界中で使ってもらうつもりなら、風変りなエンコーデ
     ィングは使わないこと。どんな場合でも、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: 207e. 型には、他にもいくつかメソッドがあります。リストオブジ
ェクトのすべてのメソッドを以下に示します:

 -- メソッド: list.append (value, /)

     リストの末尾に要素を一つ追加します。‘a[len(a):] = [x]’ と同様です。

 -- メソッド: list.extend (iterable, /)

     イテラブルのすべての要素を対象のリストに追加し、リストを拡張します
     。‘a[len(a):] = iterable’ と同様です。

 -- メソッド: list.insert (index, value, /)

     指定した位置に要素を挿入します。第 1 引数は、リストのインデクスで、
     そのインデクスを持つ要素の直前に挿入が行われます。従って、
     ‘a.insert(0, x)’ はリストの先頭に挿入を行います。また
     ‘a.insert(len(a), x)’ は ‘a.append(x)’ と等価です。

 -- メソッド: list.remove (value, /)

     Remove the first item from the list whose value is equal to
     'value'.  It raises a *note ValueError: 2ee. if there is no such
     item.

 -- メソッド: list.pop (index=-1, /)

     指定された位置の要素をリストから取り除き、それを返します。インデッ
     クスが指定されていない場合、 ‘a.pop()’ はリスト末尾の要素を取り除い
     て返します。リストが空であるか、インデックスがリストの範囲外の場合
     は、*note IndexError: 1753. を送出します。

 -- メソッド: list.clear ()

     リスト中の全ての要素を削除します。‘del a[:]’ と同様です。

 -- メソッド: list.index (value[, start[, stop]])

     Return zero-based index of the first occurrence of 'value' in the
     list.  Raises a *note ValueError: 2ee. if there is no such item.

     任意の引数である 'start' と 'end' はスライス記法として解釈され、リ
     ストの探索範囲を指定できます。返される添字は、'start' 引数からの相
     対位置ではなく、リスト全体の先頭からの位置になります。

 -- メソッド: list.count (value, /)

     Return the number of times 'value' appears in the list.

 -- メソッド: list.sort (*, key=None, reverse=False)

     リストの項目を、インプレース演算 (in place、元のデータを演算結果で
     置き換えるやりかた) でソートします。引数はソート方法のカスタマイズ
     に使えます。 *note sorted(): dcb. の説明を参照してください。

 -- メソッド: 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(): 8dd. を
使います。スタックの一番上から要素を取り出すには *note pop(): 2081. をイ
ンデックスを指定せずに使います。例えば以下のようにします:

     >>> 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: 348. と *note if: 182. 文が両方のコードで同じ順序になっている
ことに注目してください。

式がタプルの場合 (例: 上の例で式が ‘(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: 348. のコン
テキストの中で評価されます。そのため、この例は次のコードと等価です:

     >>> 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(): 1a1. 関数が良い仕事をしてくれるでしょう:

     >>> list(zip(*matrix))
     [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]

この行にあるアスタリスクの詳細については *note 引数リストのアンパック:
206d. を参照してください。


File: python.info,  Node: del 文,  Next: タプルとシーケンス,  Prev: リスト型についてもう少し,  Up: データ構造

2.5.2 ‘del’ 文
--------------

リストから要素を削除する際、値を指定する代わりにインデックスを指定する方
法があります。それが *note del: 1b7e. 文です。これは *note pop(): 2081.
メソッドと違い、値を返しません。 ‘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: 1b7e. は変数全体の削除にも使えます:

     >>> del a

この文の後で名前 ‘a’ を参照すると、(別の値を ‘a’ に代入するまで) エラー
になります。 *note del: 1b7e. の別の用途についてはまた後で取り上げます。


File: python.info,  Node: タプルとシーケンス,  Next: 集合型,  Prev: del 文,  Up: データ構造

2.5.3 タプルとシーケンス
------------------------

リストや文字列には、インデクスやスライスを使った演算のように、数多くの共
通の性質があることを見てきました。これらは 'シーケンス (sequence)' デー
タ型 (*note シーケンス型 -- list, tuple, range: 208a. を参照) の二つの例
です。 Python はまだ進歩の過程にある言語なので、他のシーケンスデータ型が
追加されるかもしれません。標準のシーケンス型はもう一つあります: 'タプル
(tuple)' 型です。

タプルはコンマで区切られたいくつかの値からなります。例えば以下のように書
きます:

     >>> t = 12345, 54321, 'hello!'
     >>> t[0]
     12345
     >>> t
     (12345, 54321, 'hello!')
     >>> # Tuples may be nested:
     >>> u = t, (1, 2, 3, 4, 5)
     >>> u
     ((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))
     >>> # Tuples are immutable:
     >>> t[0] = 88888
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: 'tuple' object does not support item assignment
     >>> # but they can contain mutable objects:
     >>> v = ([1, 2, 3], [3, 2, 1])
     >>> v
     ([1, 2, 3], [3, 2, 1])

ご覧のとおり、タプルの表示には常に丸括弧がついていて、タプルのネストが正
しく解釈されるようになっています。タプルを書くときは必ずしも丸括弧で囲ま
なくてもいいですが、(タプルが大きな式の一部だった場合は) 丸括弧が必要な
場合もあります。タプルの要素を代入することはできません。しかし、タプルに
リストのような変更可能型を含めることはできます。

タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されま
す。タプルは *note 不変: 15bd. で、複数の型の要素からなることもあり、要
素はアンパック(この節の後半に出てきます)操作やインデックス (あるいは
*note namedtuples: 4e0. の場合は属性)でアクセスすることが多いです。一方
、リストは *note 可変: 15be. で、要素はたいてい同じ型のオブジェクトであ
り、たいていイテレートによってアクセスします。

問題は 0 個または 1 個の項目からなるタプルの構築です。これらの操作を行う
ため、構文には特別な細工がされています。空のタプルは空の丸括弧ペアで構築
できます。一つの要素を持つタプルは、値の後ろにコンマを続ける (単一の値を
丸括弧で囲むだけでは不十分です) ことで構築できます。美しくはないけれども
、効果的です。例えば以下のようにします:

     >>> empty = ()
     >>> singleton = 'hello',    # <-- 末尾にカンマがあることに注意
     >>> len(empty)
     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: 208d. を扱うためのデータ型もあります。集合とは
、重複する要素をもたない、順序づけられていない要素の集まりです。 Set オ
ブジェクトは、和 (union)、積 (intersection)、差 (difference)、対称差
(symmetric difference)といった数学的な演算もサポートしています。

中括弧、または *note set(): 185. 関数は set を生成するために使用すること
ができます。注: 空集合を作成するためには ‘set()’ を使用しなければなりま
せん (‘{}’ ではなく)。後者は空の辞書を作成します。辞書は次のセクションで
議論するデータ構造です。

Because sets are unordered, iterating over them or printing them can
produce the elements in a different order than you expect.

簡単なデモンストレーションを示します:

     >>> 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'}

Similarly to *note list comprehensions: 2085, set comprehensions are
also supported:

     >>> 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 Mapping Types -- dict: cc1. を参照)です。辞書は他の
言語にも "連想記憶 (associated memory)" や "連想配列 (associative
array)" という名前で存在することがあります。ある範囲の数でインデックス化
されているシーケンスと異なり、辞書は 'キー (key)' でインデックス化されて
います。このキーは何らかの変更不能な型になります。文字列、数値は常にキー
にすることができます。タプルは、文字列、数値、その他のタプルのみを含む場
合はキーにすることができます。直接、あるいは間接的に変更可能なオブジェク
トを含むタプルはキーにできません。リストをキーとして使うことはできません
。これは、リストにスライスやインデックス指定の代入を行ったり、 *note
append(): 8dd. や *note extend(): 602. のようなメソッドを使うと、インプ
レースで変更することができるためです。

辞書は 'キー(key): 値(value)' のペアの集合であり、キーが (辞書の中で)一
意でなければならない、と考えるとよいでしょう。波括弧 (brace) のペア:
‘{}’ は空の辞書を生成します。カンマで区切られた key: value のペアを波括
弧ペアの間に入れると、辞書の初期値となる key: value が追加されます; この
表現方法は出力時に辞書が書き出されるのと同じ方法です。

辞書での主な操作は、ある値を何らかのキーを付けて記憶することと、キーを指
定して値を取り出すことです。 ‘del’ で key: value のペアを削除することも
できます。すでに使われているキーを使って値を記憶すると、以前そのキーに関
連づけられていた値は忘れ去られてしまいます。

存在しないキーの値をインデックス指定(‘d[key]’)で取り出すと *note
KeyError: 5e7. が発生します。存在しない可能性のあるキーへのアクセス時に
このエラーを回避するには、代わりに *note get(): 2090. メソッドを使用しま
す。このメソッドは辞書にキーが存在しない場合に ‘None’ (または指定された
デフォルト値)を返します。

辞書オブジェクトに対し ‘list(d)’ を実行すると、辞書で使われている全ての
キーからなるリストをキーが挿入された順番で返します (ソートされたリストが
欲しい場合は、代わりに ‘sorted(d)’ を使ってください)。ある単一のキーが辞
書にあるかどうか調べるには、 *note in: 349. キーワードを使います。

以下に、辞書を使った簡単な例を示します:

     >>> 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(): 184. コンストラクタは、キーと値のペアのタプルを含むリスト
から辞書を生成します:

     >>> 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(): 9d6. メソッドを使うと、キー
とそれに対応する値を同時に取り出せます。

     >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
     >>> for k, v in knights.items():
     ...     print(k, v)
     ...
     gallahad the pure
     robin the brave

シーケンスにわたるループを行う際、 *note enumerate(): 169f. 関数を使うと
、要素のインデックスと要素を同時に取り出すことができます。

     >>> for i, v in enumerate(['tic', 'tac', 'toe']):
     ...     print(i, v)
     ...
     0 tic
     1 tac
     2 toe

二つまたはそれ以上のシーケンス型を同時にループするために、関数 *note
zip(): 1a1. を使って各要素をひと組みにすることができます。

     >>> 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(): a69. を呼び出します。

     >>> for i in reversed(range(1, 10, 2)):
     ...     print(i)
     ...
     9
     7
     5
     3
     1

シーケンスをソートされた順序でループするには、 *note sorted(): dcb. 関数
を使います。この関数は元の配列を変更せず、ソート済みの新たな配列を返しま
す。

     >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
     >>> for i in sorted(basket):
     ...     print(i)
     ...
     apple
     apple
     banana
     orange
     orange
     pear

シーケンスに *note set(): 185. を使うと、重複要素が除去されます。 シーケ
ンスに ‘set()’ を使った上で、 *note sorted(): dcb. を使うという組み合わ
せ方は、順番が整列されているシーケンスで、同一要素に 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 セイウチ演算子: 2094.
‘:=’ を使用して明示的に行う必要があることに注意してください。これにより
、 ‘==’ が意図されていたところに ‘=’ を入力してしまうという、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: 199. 例外を発生させます。

脚注
....


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:
209b. (詳細は *note Python のスコープと名前空間: 209c. を参照してくださ
い)に追加することはありません。単にモジュール名 ‘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: 14c7. が付いていても使え、同じ効果が得
られます:

     >>> 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: 20a3. にあります。見つからなかった場合は、
‘spam.py’ という名前のファイルを *note sys.path: 3e2. にあるディレクトリ
のリストから探します。 ‘sys.path’ は以下の場所に初期化されます:

   * 入力されたスクリプトのあるディレクトリ (あるいはファイルが指定され
     なかったときはカレントディレクトリ)。

   * *note PYTHONPATH: 1223. (ディレクトリ名のリスト。シェル変数の
     ‘PATH’ と同じ構文)。

   * インストール方法に依存したデフォルト（慣例として ‘site-packages’ デ
     ィレクトリーが含まれ、*note site: cc. モジュールによって処理される
     ）。

詳細は *note sys.path モジュール検索パスの初期化: 193e. を参照してくださ
い。

     注釈: シンボリックリンクをサポートするファイルシステム上では、入力
     されたスクリプトのあるディレクトリはシンボリックリンクをたどった後
     に計算されます。言い換えるとシンボリックリンクを含むディレクトリは
     モジュール検索パスに追加 'されません'。

初期化された後、 Python プログラムは *note sys.path: 3e2. を修正すること
ができます。スクリプトファイルを含むディレクトリが検索パスの先頭、標準ラ
イブラリパスよりも前に追加されます。なので、ライブラリのディレクトリにあ
るファイルよりも、そのディレクトリにある同じ名前のスクリプトが優先してイ
ンポートされます。これは、標準ライブラリを意図して置き換えているのでない
限りは間違いのもとです。より詳しい情報は *note 標準モジュール: 20a4. を
参照してください。


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: 18d. または *note -OO: fb9. スイッチを使うことができま
     す。‘-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: 11d. モジュールは 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:
1223. から得たデフォルトパスに、 ‘PYTHONPATH’ が設定されていなければ組み
込みのデフォルト値に設定されます。標準的なリスト操作で変更することができ
ます:

     >>> 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. は、あるモジュールがどんな名前を定義してい
るか調べるために使われます。 ‘dir()’ はソートされた文字列のリストを返し
ます:

     >>> 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:
2b4. を使う場合を除く)。 これにより、 ‘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__: 20b0. をサポートし
ています。この属性は、パッケージの ‘__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(): 117b. 関数が出てきました。 (第三はファイルオブジェクトの
*note write(): 20b7. メソッドを使う方法です。標準出力を表すファイルは
‘sys.stdout’ で参照できます。詳細はライブラリリファレンスを参照してくだ
さい。)

単に空白区切りで値を並べただけの出力よりも、フォーマットを制御したいと思
うことはよくあることでしょう。 出力をフォーマットする方法はいくつかあり
ます。

   * *note フォーマット済み文字列リテラル: 20b8. を使うには、開き引用符
     や三重の開き引用符の前に ‘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 Format specification mini-language: 4f9. を参照してください。
     )

   * 最後に、文字列のスライス操作や結合操作を使い、全ての文字列を自分で
     処理し、思い通りのレイアウトを作成できます。 文字列型には、文字列の
     間隔を調整して指定されたカラム幅に揃えるのに便利な操作を行うメソッ
     ドがいくつかあります。

凝った出力である必要は無いけれど、デバッグ目的で変数をすばやく表示したい
ときは、 *note repr(): 1c3. 関数か *note str(): 16a. 関数でどんな値も文
字列に変換できます。

*note str(): 16a. 関数は値の人間に読める表現を返すためのもので、 *note
repr(): 1c3. 関数はインタープリタに読める (あるいは同値となる構文がない
場合は必ず *note SyntaxError: 18f. になるような) 表現を返すためのもので
す。人間が読むのに適した特定の表現を持たないオブジェクトにおいては、
‘str()’ は ‘repr()’ と同じ値を返します。数値や、リストや辞書を始めとする
データ構造など、多くの値がどちらの関数に対しても同じ表現を返します。一方
、文字列は、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: 898.
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 フォーマット済み文字リテラル: 19b. (短くして 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(): 1604. を、 ‘'!s'’ は *note str(): 16a. を、 ‘'!r'’ は
*note repr(): 1c3. を適用します:

     >>> 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: ba3. を参
照してください。 フォーマットについての仕様は *note Format specification
mini-language: 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. メソッドに渡されたオブジェクトに置換されます。括弧の
中の数字は ‘str.format()’ メソッドに渡されたオブジェクトの位置を表すのに
使えます。

     >>> 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(): 1e7f. と
組み合わせると特に便利です。

     >>> 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
Format string syntax: 15b7. を参照してください。


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(): 117b. の動作で追加されて
いることに注意してください。 ‘print()’ は常に引数間に空白を追加します。)

文字列オブジェクトの *note str.rjust(): 20bd. メソッドは、指定された幅の
フィールド内に文字列が右寄せで入るように左側に空白を追加します。 同様の
メソッドとして、 *note str.ljust(): 20be. と *note str.center(): 20bf. が
あります。 これらのメソッドは何か出力を行うわけではなく、ただ新しい文字
列を返します。 入力文字列が長すぎる場合、文字列を切り詰めることはせず、
値をそのまま返します。この仕様のためにカラムのレイアウトが滅茶苦茶になる
かもしれませんが、嘘の値が代わりに書き出されるよりはましです。 (本当に切
り詰めを行いたいのなら、全てのカラムに ‘x.ljust(n)[:n]’ のようにスライス
表記を加えることもできます。)

もう一つのメソッド、 *note str.zfill(): 16d0. は、数値文字列の左側をゼロ
詰めします。このメソッドは正と負の符号を正しく扱います:

     >>> '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 形式の文字列書式化: 8dc. にあります。


File: python.info,  Node: ファイルを読み書きする,  Prev: 出力を見やすくフォーマットする,  Up: 入力と出力

2.7.2 ファイルを読み書きする
----------------------------

*note open(): 318. は *note file object: 13df. を返します。大抵、
‘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(): 318. を参照してください)。UTF-8は現在の事実上の標準のため
、異なるエンコーディングを指定したい場合以外は ‘encoding="utf-8"’ の指定
がおすすめです。モードに ‘'b'’ をつけるとファイルを 'binary mode' で開き
ます。バイナリーモードでのデータは *note bytes: 193. オブジェクトで読み
書きします。ファイルをバイナリーモードで開くときは 'エンコーディング' は
指定できません。

テキストモードの読み取りでは、プラットフォーム固有の行末記号 (Unix では
‘\n’ 、Windows では ‘\r\n’) をただの ‘\n’ に変換するのがデフォルトの動作
です。テキストモードの書き込みでは、 ‘\n’ が出てくる箇所をプラットフォー
ム固有の行末記号に戻すのがデフォルトの動作です。この裏で行われるファイル
データの変換はテキストファイルには上手く働きますが、 ‘JPEG’ ファイルや
‘EXE’ ファイルのようなバイナリデータを破壊する恐れがあります。そのような
ファイルを読み書きする場合には注意して、バイナリモードを使うようにしてく
ださい。

ファイルオブジェクトを扱うときに *note with: 187. キーワードを使うのは良
い習慣です。 その利点は、処理中に例外が発生しても必ず最後にファイルをち
ゃんと閉じることです。 ‘with’ を使うと、同じことを *note try: 8f9.-*note
finally: 1b1. ブロックを使って書くよりずっと簡潔に書けます:

     >>> with open('workfile', encoding="utf-8") as f:
     ...     read_data = f.read()

     >>> # ファイルが自動でクローズされたことが確認できる
     >>> f.closed
     True

もし *note with: 187. キーワードを使用しない場合は、ファイルを閉じ、この
ファイルのために利用されたシステムのリソースを直ちに解放するために
‘f.close()’ を呼び出してください。

     警告: ‘f.write()’ を ‘with’ キーワードや ‘f.close()’ を使わずに呼び
     出した場合、プログラムが正常に終了した場合でも、 ‘f.write()’ の実引
     数がディスクに完全に '書き込まれないことがあります' 。

*note with: 187. 文や ‘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(): 20c5. や *note
truncate(): 152c. といった、あまり使われないメソッドがあります。ファイル
オブジェクトについての完全なガイドは、ライブラリリファレンスを参照してく
ださい。


File: python.info,  Node: json による構造化されたデータの保存,  Prev: ファイルオブジェクトのメソッド,  Up: ファイルを読み書きする

2.7.2.2 ‘json’ による構造化されたデータの保存
.............................................

文字列は簡単にファイルに読み書きできます。数値の場合には少し努力が必要で
す。というのも、 *note read(): 20c8. メソッドは文字列しか返さないため、
*note int(): 19c. のような関数にその文字列を渡して、たとえば文字列
‘'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(): f45. に似た関数に、*note dump(): f44. があり、こちらは単
純にオブジェクトを *note text file: 20c9. にシリアライズします。‘f’ が書
き込み用に開かれた text file だとすると、次のように書くことができます:

     json.dump(x, f)

逆にデシリアライズするには、‘f’ が読み込み用に開かれた *note binary
file: 20ca. か *note text file: 20c9. だとすると、次のようになります:

     x = json.load(f)

     注釈: JSONファイルは必ずUTF-8でエンコードします。JSONファイルを
     *note text file: 20c9. として読み込み、書き込みで開くときには、
     ‘encoding="utf-8"’ を指定します。

このような単純なシリアライズをする手法は、リストや辞書を扱うことはできま
すが、任意のクラス・インスタンスを JSON にシリアライズするにはもう少し努
力しなくてはなりません。*note json: 86. モジュールのリファレンスにこれに
ついての解説があります。

参考
....

*note pickle: ab. - pickle モジュール

*note JSON: 20c7. とは対照的に、 '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(): 117b. のところで検出されており、これはその前にコロン (‘':'’) が
抜けているためです。

ファイルに書かれたコードの場合、ファイル名 (上の例では ‘<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: b43, *note NameError: 450, *note
TypeError: 199. です。例外型として出力される文字列は、発生した例外の組み
込み名です。これは全ての組み込み例外について成り立ちますが、ユーザ定義の
例外では (成り立つようにするのは有意義な慣習ですが) 必ずしも成り立ちませ
ん。標準例外の名前は組み込みの識別子です (予約語ではありません)。

残りの行は例外の詳細で、その例外の型と何が起きたかに依存します。

エラーメッセージの先頭部分では、例外が発生した実行コンテキスト (context)
を、スタックのトレースバック (stack traceback) の形式で示しています。一
般には、この部分にはソースコード行をリストしたトレースバックが表示されま
す。しかし、標準入力から読み取られたコードは表示されません。

*note 組み込み例外: 1c84. には、組み込み例外とその意味がリストされていま
す。


File: python.info,  Node: 例外を処理する,  Next: 例外を送出する,  Prev: 例外,  Up: エラーと例外

2.8.3 例外を処理する
--------------------

例外を選別して処理するようなプログラムを書くことができます。以下の例を見
てください。この例では、有効な文字列が入力されるまでユーザに入力を促しま
すが、ユーザがプログラムに (‘Control’-‘C’ か、またはオペレーティングシス
テムがサポートしている何らかのキーを使って) 割り込みをかけてプログラムを
中断させることができるようにしています。ユーザが生成した割り込みは、
*note KeyboardInterrupt: bc9. 例外が送出されることで通知されるということ
に注意してください。

     >>> while True:
     ...     try:
     ...         x = int(input("数字を入力してください: "))
     ...         break
     ...     except ValueError:
     ...         print("おっと!それは数字ではないようです。もう一度入力してください...")
     ...

*note try: 8f9. 文は下記のように動作します。

   * まず、 'try 節 (try clause)' (キーワード *note try: 8f9. と *note
     except: 1ac. の間の文) が実行されます。

   * 何も例外が発生しなければ、 'except 節' をスキップして *note try:
     8f9. 文の実行を終えます。

   * *note try: 8f9. 節内の実行中に例外が発生すると、その節の残りは飛ば
     されます。次に、例外型が *note except: 1ac. キーワードの後に指定さ
     れている例外に一致する場合、except 節が実行された後、 try/except ブ
     ロックの後ろへ実行が継続されます。

   * もしも 'except 節' で指定された例外と一致しない例外が発生すると、そ
     の例外は *note try: 8f9. 文の外側に渡されます。例外に対するハンドラ
     (handler、処理部) がどこにもなければ、 '処理されない例外 (unhandled
     exception)' となり、エラーメッセージを出して実行を停止します。

A *note try: 8f9. statement may have more than one 'except clause', to
specify handlers for different exceptions.  At most one handler will be
executed.  Handlers only handle exceptions that occur in the
corresponding 'try clause', not in other handlers of the same ‘try’
statement.  An 'except clause' may name multiple exceptions, for
example:

     ... except RuntimeError, TypeError, NameError:
     ...     pass

*note except: 1ac. 節 内のクラスは、そのクラスや派生クラスのインスタンス
である例外とマッチします（その逆はありません -- 派生クラスが書かれた
'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: bd1. は、致命的でない例外すべての
基底クラスです。 ‘Exception’ のサブクラスではない例外は、一般的にプログ
ラムが終了することを示すために使われているため処理されません。例えば、
*note sys.exit(): 279. によって送出される *note SystemExit: f40. や、ユ
ーザーがプログラムを中断させたいときに送出される *note
KeyboardInterrupt: bc9. があります。

*note Exception: bd1. はほぼすべての例外を捕捉するワイルドカードとして使
えます。しかし良い例外処理の手法とは、処理対象の例外の型をできる限り詳細
に書き、予期しない例外はそのまま伝わるようにすることです。

*note Exception: bd1. に対する最も一般的な例外処理のパターンでは、例外を
表示あるいはログ出力してから再度送出します(呼び出し側でも例外を処理でき
るようにします):

     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: 8f9. ...  *note except: 1ac. 文には、オプションで 'else 節
(else clause)' を設けることができます。 *note else: 17d. 節を設ける場合
、全ての ‘except’ 節よりも後ろに置かなければなりません。 ‘else’ 節は
'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: 8f9. 節よりも ‘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: bd1. やそのサブクラス)でなければなりません。 例
外クラスが渡された場合は、引数無しのコンストラクタが呼び出され、暗黙的に
インスタンス化されます:

     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: 1ac. 節の中で未処理の例外が発生した場合、その未処理の例外
は処理された例外のエラーメッセージに含まれます:

     >>> 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. 文にオプションの ‘from’ 句を指定します:

     # 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 組み込み例外: 1c84. を参照し
てください。


File: python.info,  Node: ユーザー定義例外,  Next: クリーンアップ動作を定義する,  Prev: 例外の連鎖,  Up: エラーと例外

2.8.6 ユーザー定義例外
----------------------

プログラム上で新しい例外クラスを作成することで、独自の例外を指定すること
ができます (Python のクラスについては *note クラス: 205d. 参照)。例外は
、典型的に *note Exception: bd1. クラスから、直接または間接的に派生した
ものです。

例外クラスでは、普通のクラスができることなら何でも定義することができます
が、通常は単純なものにしておきます。大抵は、いくつかの属性だけを提供し、
例外が発生したときにハンドラがエラーに関する情報を取り出せるようにする程
度にとどめます。

ほとんどの例外は、標準の例外の名前付けと同様に、"Error" で終わる名前で定
義されています。

多くの標準モジュールでは、モジュールで定義されている関数内で発生する可能
性のあるエラーを報告させるために、独自の例外を定義しています。


File: python.info,  Node: クリーンアップ動作を定義する,  Next: 定義済みクリーンアップ処理,  Prev: ユーザー定義例外,  Up: エラーと例外

2.8.7 クリーンアップ動作を定義する
----------------------------------

*note try: 8f9. 文にはもう一つオプションの節があります。この節はクリーン
アップ動作を定義するためのもので、どんな状況でも必ず実行されます。例を示
します:

     >>> 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: 1b1. 節がある場合、 *note try: 8f9. 文が終わる前の最
後の処理を、 ‘finally’ 節が実行します。 ‘try’ 文が例外を発生させるか否か
に関わらず、 ‘finally’ 節は実行されます。以下では、例外が発生するという
更に複雑なケースを議論します:

   * もし ‘try’ 文の実行中に例外が発生したら、その例外は *note except:
     1ac. 節によって処理されるでしょう。もしその例外が ‘except’ 節によっ
     て処理されなければ、 ‘finally’ 節が実行された後に、その例外が再送出
     されます。

   * ‘except’ 節または ‘else’ 節の実行中に例外が発生することがあり得ます
     。その場合も、 ‘finally’ 節が実行された後に例外が再送出されます。

   * If the ‘finally’ clause executes a *note break: 180, *note
     continue: 181. or *note return: 1b0. statement, exceptions are not
     re-raised.  This can be confusing and is therefore discouraged.
     From version 3.14 the compiler emits a *note SyntaxWarning: 1af.
     for it (see PEP 765(1)).

   * もし ‘try’ 文が *note break: 180. 文、 *note continue: 181. 文また
     は *note return: 1b0. 文のいずれかに達すると、その ‘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: 1af.
     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: 1b1. 節はどの場合にも実行されています
。 文字列で割り算をすることで発生した *note TypeError: 199. は *note
except: 1ac. 節で処理されていないので、 ‘finally’ 節実行後に再度送出され
ています。

実世界のアプリケーションでは、 *note finally: 1b1. 節は(ファイルやネット
ワーク接続などの)外部リソースを、利用が成功したかどうかにかかわらず解放
するために便利です。

   ---------- 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: 187. 文はファイルの
ようなオブジェクトが常に、即座に正しくクリーンアップされることを保証しま
す。

     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'>: there were problems (2 sub-exceptions)
     >>>

‘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: Brief tour of the standard library,  Prev: エラーと例外,  Up: Python チュートリアル

2.9 クラス
==========

クラスはデータと機能を組み合わせる方法を提供します。 新規にクラスを作成
することで、新しいオブジェクトの '型' を作成し、その型を持つ新しい 'イン
スタンス' が作れます。 クラスのそれぞれのインスタンスは自身の状態を保持
する属性を持てます。 クラスのインスタンスは、その状態を変更するための (そ
のクラスが定義する) メソッドも持てます。

Python は、他のプログラミング言語と比較して、最小限の構文と意味付けを使
ってクラスを言語に追加しています。Python のクラスは、C++ と Modula-3 の
クラスメカニズムを混ぜたものです。Python のクラス機構はオブジェクト指向
プログラミングの標準的な機能を全て提供しています。クラスの継承メカニズム
は、複数の基底クラスを持つことができ、派生クラスで基底クラスの任意のメソ
ッドをオーバライドすることができます。メソッドでは、基底クラスのメソッド
を同じ名前で呼び出すことができます。オブジェクトには任意の種類と数のデー
タを格納することができます。モジュールと同じく、クラス機構も Python の動
的な性質に従うように設計されています。クラスは実行時に生成され、生成後に
変更することができます。

C++ の用語で言えば、通常のクラスメンバ (データメンバも含む) は (*note
プライベート変数: 20e5. に書かれている例外を除いて) '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():
20e9. 等の関数や組込み例外名)、モジュール内のグローバルな名前、関数を呼
び出したときのローカルな名前があります。オブジェクトの属性からなる集合も
また、ある意味では名前空間です。名前空間について知っておくべき重要なこと
は、異なった名前空間にある名前の間には全く関係がないということです。例え
ば、二つの別々のモジュールの両方で関数 ‘maximize’ という関数を定義するこ
とができ、定義自体は混同されることはありません -- モジュールのユーザは名
前の前にモジュール名をつけなければなりません。

ところで、 '属性' という言葉は、ドットに続く名前すべてに対して使っていま
す -- 例えば式 ‘z.real’ で、 ‘real’ はオブジェクト ‘z’ の属性です。厳密
にいえば、モジュール内の名前に対する参照は属性の参照です。式
‘modname.funcname’ では、 ‘modname’ はあるモジュールオブジェクトで、
‘funcname’ はその属性です。この場合には、モジュールの属性とモジュールの
中で定義されているグローバル名の間には、直接的な対応付けがされます。これ
らの名前は同じ名前空間を共有しているのです！ (1)

属性は読取り専用にも、書込み可能にもできます。書込み可能であれば、属性に
代入することができます。モジュール属性は書込み可能で、
‘modname.the_answer = 42’ と書くことができます。書込み可能な属性は、
*note del: 1b7e. 文で削除することもできます。例えば、 ‘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:
14c3. 文が使えます。nonlocal と宣言されなかった変数は、全て読み出し専用
となります (そのような変数に対する書き込みは、単に '新しい' ローカル変数
をもっとも内側のスコープで作成し、外部のスコープの値は変化しません)。

通常、ローカルスコープは (プログラムテキスト上の) 現在の関数のローカルな
名前を参照します。関数の外側では、ローカルスコープはグローバルな名前空間
と同じ名前空間、モジュールの名前空間を参照します。クラス定義では、ローカ
ルスコープの中にもう一つ名前空間が置かれます。

スコープはテキスト上で決定されていると理解することが重要です。モジュール
内で定義される関数のグローバルなスコープは、関数がどこから呼び出されても
、どんな別名をつけて呼び出されても、そのモジュールの名前空間になります。
反対に、実際の名前の検索は実行時に動的に行われます -- とはいえ、言語の定
義は、"コンパイル" 時の静的な名前解決の方向に進化しているので、動的な名
前解決に頼ってはいけません！ (事実、ローカルな変数は既に静的に決定されて
います。)

Python の特徴として、*note global: 4ac. や *note nonlocal: 14c3. 文が有
効でない場合は、名前に対する参照は常に最も内側のスコープに対して有効にな
ります。 代入はデータをコピーしません。オブジェクトを名前に束縛するだけ
です。削除も同様で、‘del x’ は、ローカルスコープの名前空間から ‘x’ に対
する拘束を取り除きます。 つまるところ、新しい名前を与えるようなすべての
操作は、ローカルスコープを使って行われます。 *note import: 7f8. 文、関数
の定義は、モジュールや関数名をローカルスコープの名前に拘束します。

*note global: 4ac. 文を使うと、特定の変数がグローバルスコープに存在し、
そこで再束縛されることを指示できます。 *note nonlocal: 14c3. 文は、特定
の変数が外側のスコープに存在し、そこで再束縛されることを指示します。

* Menu:

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

   ---------- Footnotes ----------

   (1) 例外が一つあります。モジュールオブジェクトには、秘密の読取り専用
の属性 *note __dict__: 77d. があり、モジュールの名前空間を実装するために
使われている辞書を返します; ‘__dict__’ という名前は属性ですが、グローバ
ルな名前ではありません。この属性を利用すると名前空間の実装に対する抽象化
を侵すことになるので、プログラムを検死するデバッガのような用途に限るべき
です。


File: python.info,  Node: スコープと名前空間の例,  Up: Python のスコープと名前空間

2.9.2.1 スコープと名前空間の例
..............................

異なるスコープと名前空間がどのように参照されるか、また *note global:
4ac. および *note nonlocal: 14c3. が変数の束縛にどう影響するか、この例で
実演します:

     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: 14c3. 代入は '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: 1678. 文) と同様、クラス定義が効果をもつにはまず実
行しなければなりません。 (クラス定義を *note if: 182. 文の分岐先や関数内
部に置くことも、考え方としてはありえます。)

実際には、クラス定義の内側にある文は、通常は関数定義になりますが、他の文
を書くこともでき、それが役に立つこともあります -- これについては後で述べ
ます。クラス内の関数定義は通常、メソッドの呼び出し規約で決められた独特の
形式の引数リストを持ちます -- これについても後で述べます。

クラス定義に入ると、新たな名前空間が作成され、ローカルな名前空間として使
われます -- 従って、ローカルな変数に対する全ての代入はこの新たな名前空間
に入ります。特に、関数定義を行うと、新たな関数の名前はこの名前空間に結び
付けられます。

クラス定義から普通に (定義の終端に到達して) 抜けると、 'クラスオブジェク
ト (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__: 20f1. も有効な属性で、そのクラスに属
しているドキュメンテーション文字列(docstring) 、この場合は ‘"A simple
example class"’ を返します。

クラスの 'インスタンス化 (instantiation)' には関数記法を使います。クラス
オブジェクトのことを、クラスの新しいインスタンスを返す、引数のない関数の
ように扱ってください。上記クラスで例示すると:

     x = MyClass()

は、クラスの新しい 'インスタンス (instance)' を生成し、そのオブジェクト
をローカル変数 ‘x’ へ代入します。

インスタンス化操作 (クラスオブジェクトの "呼出し") では、空のオブジェク
トが作られます。多くのクラスでは、特定の初期状態にカスタマイズされたオブ
ジェクトを作りたいです。そのために、クラスには *note __init__(): 8c0. と
いう名前の特殊メソッドを定義できます。例えば次のようにします:

     def __init__(self):
         self.data = []

クラスが *note __init__(): 8c0. メソッドを定義している場合、クラスをイン
スタンス化すると、新しく作られたクラスインスタンスに対して自動的に
‘__init__()’ を呼び出します。 従って この例では、新たな初期済みインスタ
ンスを次のようにして得られます:

     x = MyClass()

もちろん、より大きな柔軟性を持たせるために、 *note __init__(): 8c0. メソ
ッドに複数の引数をもたせることができます。その場合、次の例のように、クラ
スのインスタンス化操作に渡された引数は ‘__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 名前とオブジェクトについて: 20e7, shared data can
have possibly surprising effects involving *note mutable: 15be. 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(): 2af. を使うとインスタンスの型が調べられます。
     ‘isinstance(obj, int)’ は ‘obj.__class__’ が *note int: 19c. や
     ‘int’ の派生クラスの場合に限り ‘True’ になります。

   * *note issubclass(): 9c8. を使うとクラスの継承関係が調べられます。
     *note bool: 3c1. は *note int: 19c. のサブクラスなので
     ‘issubclass(bool, int)’ は ‘True’ です。しかし、 *note float: 197.
     は ‘int’ のサブクラスではないので ‘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(): 1a7. の
呼び出しのためにメソッドの解決順序は動的に変更されます。このアプローチは
他の多重継承のある言語で call-next-method として知られており、単一継承し
かない言語の super 呼び出しよりも強力です。

動的順序付けが必要なのは、すべての多重継承で１つ以上のダイヤモンド継承
(少なくとも 1 つの祖先クラスに対して最下位クラスから到達する経路が複数あ
る状態) が見られるためです。例えば、全ての新形式のクラスは *note object:
c82. を継承しているので、どの多重継承でも ‘object’ への到達経路が複数あ
ります。基底クラスが複数回アクセスされないようにするために、動的アルゴリ
ズムで検索順序を線形化します。それは、各クラスで指定されている左から右へ
の順序は崩さず、各々の祖先クラスを一度だけ呼び出し、かつ単調になる (つま
り祖先クラスの検索順序に影響を与えずにクラスをサブクラス化できる) ように
行います。まとめると、これらの特徴のおかげで信頼性と拡張性のある多重継承
したクラスを設計することができるのです。詳細は、 *note The Python 2.3
Method Resolution Order: 16c8. を見てください。


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: 20ff. 。

名前マングリングは、サブクラスが内部のメソッド呼び出しを壊さずにメソッド
をオーバーライドするのに便利です。例えば:

     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(): 20c8. と *note readline(): 177c. を持つクラスを定義して、ファイ
ルではなく文字列バッファからデータを取得するようにしておき、引数として渡
すことができます。

*note Instance method objects: 2102. にも属性があります。 *note
m.__self__: 15e6. はメソッド ‘m()’ の属しているインスタンスオブジェクト
で、*note m.__func__: 1518. はそのメソッドに対応する *note function
object: 59c. です。


File: python.info,  Node: イテレータ iterator,  Next: ジェネレータ generator,  Prev: 残りのはしばし,  Up: クラス

2.9.8 イテレータ (iterator)
---------------------------

すでに気づいているでしょうが、 *note for: 348. 文を使うとほとんどのコン
テナオブジェクトにわたってループを行うことができます:

     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(): 9db. 関数を呼んでいます。関数
は、コンテナの中の要素に1つずつアクセスする *note __next__(): 14e9. メソ
ッドが定義されているイテレータオブジェクトを返します。これ以上要素が無い
場合は、 ‘__next__()’ メソッドは *note StopIteration: df9. 例外を送出し
、その通知を受け *note for: 348. ループは終了します。組み込みの *note
next(): 9dc. 関数を使って ‘__next__()’ メソッドを直接呼ぶこともできます;
この例は関数がどう働くのかを示しています:

     >>> 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__(): 14e9. メ
ソッドを持つオブジェクトを返す *note __iter__(): 2105. メソッドを定義す
るのです。クラスが ‘__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 ジェネレータ: 1270. は、イテレータを作成するための簡潔で強力なツー
ルです。ジェネレータは通常の関数のように書かれますが、何らかのデータを返
すときには *note yield: bc6. 文を使います。そのジェネレータに対して
*note next(): 9dc. が呼び出されるたびに、ジェネレータは以前に中断した処
理を再開します (ジェネレータは、全てのデータ値と最後にどの文が実行された
かを記憶しています)。以下の例を見れば、ジェネレータがとても簡単に作成で
きることがわかります:

     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__():
2108. メソッドと *note __next__(): 2109. メソッドが自動で作成されるから
です。

ジェネレータのもう一つの重要な機能は、呼び出しごとにローカル変数と実行状
態が自動的に保存されるということです。これにより、 ‘self.index’ や
‘self.data’ といったインスタンス変数を使ったアプローチよりも簡単に関数を
書くことができるようになります。

メソッドを自動生成したりプログラムの実行状態を自動保存するほかに、ジェネ
レータは終了時に自動的に *note StopIteration: df9. を送出します。これら
の機能を組み合わせると、通常の関数を書くのと同じ労力で、簡単にイテレータ
を生成できます。


File: python.info,  Node: ジェネレータ式,  Prev: ジェネレータ generator,  Up: クラス

2.9.10 ジェネレータ式
---------------------

単純なジェネレータなら式として簡潔にコーディングできます。 その式はリス
ト内包表記に似た構文を使いますが、角括弧ではなく丸括弧で囲います。 ジェ
ネレータ式は、関数の中でジェネレータをすぐに使いたいような状況のために用
意されています。 ジェネレータ式は完全なジェネレータの定義よりコンパクト
ですが、ちょっと融通の効かないところがあります。 同じ内容を返すリスト内
包表記よりはメモリに優しいことが多いという利点があります。

例:

     >>> sum(i*i for i in range(10))                 # sum of squares
     285

     >>> xvec = [10, 20, 30]
     >>> yvec = [7, 5, 3]
     >>> sum(x*y for x,y in zip(xvec, yvec))         # dot product
     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: Brief tour of the standard library,  Next: Brief tour of the standard library --- part II,  Prev: クラス,  Up: Python チュートリアル

2.10 Brief tour of the standard library
=======================================

* Menu:

* Operating system interface::
* File wildcards::
* Command-line arguments::
* Error output redirection and program termination::
* String pattern matching::
* 数学::
* Internet access::
* Dates and times::
* Data compression::
* Performance measurement::
* Quality control::
* Batteries included::


File: python.info,  Node: Operating system interface,  Next: File wildcards,  Up: Brief tour of the standard library

2.10.1 Operating system interface
---------------------------------

*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(): 318. が
*note os.open(): f96. で遮蔽されるのを避けられます。

組み込み関数 *note dir(): 844. および *note help(): ad8. は、 *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: File wildcards,  Next: Command-line arguments,  Prev: Operating system interface,  Up: Brief tour of the standard library

2.10.2 File wildcards
---------------------

*note glob: 68. モジュールでは、ディレクトリのワイルドカード検索からファ
イルのリストを生成するための関数を提供しています:

     >>> import glob
     >>> glob.glob('*.py')
     ['primes.py', 'random.py', 'quote.py']


File: python.info,  Node: Command-line arguments,  Next: Error output redirection and program termination,  Prev: File wildcards,  Up: Brief tour of the standard library

2.10.3 Command-line arguments
-----------------------------

一般的なユーティリティスクリプトでは、よくコマンドライン引数を扱う必要が
あります。コマンドライン引数は モジュールの '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: Error output redirection and program termination,  Next: String pattern matching,  Prev: Command-line arguments,  Up: Brief tour of the standard library

2.10.4 Error output redirection and program termination
-------------------------------------------------------

*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: String pattern matching,  Next: 数学,  Prev: Error output redirection and program termination,  Up: Brief tour of the standard library

2.10.5 String pattern matching
------------------------------

*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: Internet access,  Prev: String pattern matching,  Up: Brief tour of the standard library

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: Internet access,  Next: Dates and times,  Prev: 数学,  Up: Brief tour of the standard library

2.10.7 Internet access
----------------------

インターネットにアクセスしたりインターネットプロトコルを処理したりするた
めの多くのモジュールがあります。最も単純な2つのモジュールは、 URL からデ
ータを取得するための *note urllib.request: 112. と、メールを送るための
*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: Dates and times,  Next: Data compression,  Prev: Internet access,  Up: Brief tour of the standard library

2.10.8 Dates and times
----------------------

*note datetime: 34. モジュールは、日付や時刻を操作するためのクラスを、単
純な方法と複雑な方法の両方で提供しています。日付や時刻に対する算術がサポ
ートされている一方、実装では出力のフォーマットや操作のための効率的なデー
タメンバ抽出に重点を置いています。このモジュールでは、タイムゾーンに対応
したオブジェクトもサポートしています。

     >>> # dates are easily constructed and formatted
     >>> import datetime as dt
     >>> now = dt.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.'

     >>> # dates support calendar arithmetic
     >>> birthday = dt.date(1964, 7, 31)
     >>> age = now - birthday
     >>> age.days
     14368


File: python.info,  Node: Data compression,  Next: Performance measurement,  Prev: Dates and times,  Up: Brief tour of the standard library

2.10.9 Data compression
-----------------------

一般的なデータアーカイブと圧縮形式は、以下のようなモジュールによって直接
的にサポートされます: *note zlib: 13a, *note gzip: 6b, *note bz2: 14,
*note lzma: 8e, *note zipfile: 138, *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: Performance measurement,  Next: Quality control,  Prev: Data compression,  Up: Brief tour of the standard library

2.10.10 Performance measurement
-------------------------------

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: Quality control,  Next: Batteries included,  Prev: Performance measurement,  Up: Brief tour of the standard library

2.10.11 Quality control
-----------------------

高い品質のソフトウェアを開発するための一つのアプローチは、各関数に対して
開発と同時にテストを書き、開発の過程で頻繁にテストを走らせるというもので
す。

*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: 10d. モジュールは *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: Batteries included,  Prev: Quality control,  Up: Brief tour of the standard library

2.10.12 Batteries included
--------------------------

Python には "バッテリー同梱 (batteries included)" 哲学があります。この哲
学は、洗練され、安定した機能を持つ Python の膨大なパッケージ群に如実に表
れています。例えば:

   * *note xmlrpc.client: 135. および *note xmlrpc.server: 136. モジュー
     ルは、遠隔手続き呼び出し (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: 12c.、*note
     xml.dom: 128. ならびに *note xml.sax: 130. パッケージは 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: Brief tour of the standard library --- part II,  Next: 仮想環境とパッケージ,  Prev: Brief tour of the standard library,  Up: Python チュートリアル

2.11 Brief tour of the standard library -- part II
==================================================

ツアーの第2部では、プロフェッショナルプログラミングを支えるもっと高度な
モジュールをカバーします。ここで挙げるモジュールは、小さなスクリプトの開
発ではほとんど使いません。

* Menu:

* Output formatting::
* 文字列テンプレート::
* Working with binary data record layouts::
* マルチスレッディング: マルチスレッディング<2>.
* ログ記録::
* Weak references::
* Tools for working with lists::
* Decimal floating-point arithmetic::


File: python.info,  Node: Output formatting,  Next: 文字列テンプレート,  Up: Brief tour of the standard library --- part II

2.11.1 Output formatting
------------------------

*note reprlib: c0. モジュールは、大きなコンテナや、深くネストしたコンテ
ナを省略して表示するバージョンの *note repr(): 1c3. を提供しています:

     >>> 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. モジュールは、文化により異なるデータ表現形式のデータベ
ースにアクセスします。 ‘locale’ の *note format(): 19a. 関数の 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: Working with binary data record layouts,  Prev: Output formatting,  Up: Brief tour of the standard library --- part II

2.11.2 文字列テンプレート
-------------------------

*note string: d8. モジュールには、柔軟で、エンドユーザが簡単に編集できる
簡単な構文を備えた *note Template: 898. クラスが入っています。このクラス
を使うと、ユーザがアプリケーションを修正することなしにアプリケーションの
出力をカスタマイズできるようになります。

テンプレートでは、‘$’ と有効な 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(): 2130. メソッドは、プレースホルダに相当する値が辞書や
キーワード引数にない場合に *note KeyError: 5e7. を送出します。メールマー
ジ機能のようなアプリケーションの場合、ユーザが入力するデータは不完全なこ
とがあるので、欠落したデータがあるとプレースホルダをそのままにして出力す
る *note safe_substitute(): 2131. メソッドを使う方が適切かもしれません:

     >>> 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: 898. のサブクラスを
派生すると変更することができます。例えば、画像ブラウザ用に一括で名前を変
更するユーティリティを作っていたとして、現在の日付や画像のシーケンス番号
、ファイル形式といったプレースホルダにパーセント記号を使うことにしたら、
次のようになります:

     >>> 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: Working with binary data record layouts,  Next: マルチスレッディング<2>,  Prev: 文字列テンプレート,  Up: Brief tour of the standard library --- part II

2.11.3 Working with binary data record layouts
----------------------------------------------

*note struct: db. モジュールでは、様々な長さのバイナリレコード形式を操作
する *note pack(): 1492. や *note unpack(): 18bf. といった関数を提供して
います。 以下の例では、 *note zipfile: 138. モジュールを使わずに、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: Working with binary data record layouts,  Up: Brief tour of the standard library --- part II

2.11.4 マルチスレッディング
---------------------------

スレッド処理 (threading) とは、順序的な依存関係にない複数のタスクを分割
するテクニックです。スレッドは、ユーザの入力を受け付けつつ、背後で別のタ
スクを動かすようなアプリケーションの応答性を高めます。同じような使用例と
して、I/O を別のスレッドの計算処理と並列して動作させるというものがありま
す。

以下のコードでは、高水準のモジュール *note threading: f3. でメインのプロ
グラムを動かしながら背後で別のタスクを動作させられるようにする方法を示し
ています:

     import threading, zipfile

     class AsyncZip(threading.Thread):
         def __init__(self, infile, outfile):
             super().__init__()
             self.infile = infile
             self.outfile = outfile

         def run(self):
             with zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) as f:
                 f.write(self.infile)
             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: 15b0. オブジェク
トを使うと、設計が容易になり、可読性が高まり、信頼性が増します。


File: python.info,  Node: ログ記録,  Next: Weak references,  Prev: マルチスレッディング<2>,  Up: Brief tour of the standard library --- part II

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(): 2138. と *note debug(): 102f. による出力は
抑制され、出力は標準エラーに送信されます。選択可能な送信先には、email、
データグラム、ソケット、HTTP サーバへの送信などがあります。新たにフィル
タを作成すると、*note DEBUG: 2139.、*note INFO: 213a.、*note WARNING:
213b.、*note ERROR: 213c.、*note CRITICAL: 213d. といったメッセージのプ
ライオリティによって異なる送信先を選択することができます。

ログ記録システムは Python から直接設定することもできますし、アプリケーシ
ョンを変更しなくてもカスタマイズできるよう、ユーザが編集可能な設定ファイ
ルによって設定することもできます。


File: python.info,  Node: Weak references,  Next: Tools for working with lists,  Prev: ログ記録,  Up: Brief tour of the standard library --- part II

2.11.6 Weak references
----------------------

Python は自動的にメモリを管理します (ほとんどのオブジェクトは参照カウン
ト方式で管理し、 *note ガベージコレクション: 1842. で循環参照を除去しま
す)。オブジェクトに対する最後の参照がなくなってしばらくするとメモリは解
放されます。

このようなアプローチはほとんどのアプリケーションでうまく動作しますが、中
にはオブジェクトをどこか別の場所で利用している間だけ追跡しておきたい場合
もあります。残念ながら、オブジェクトを追跡するだけでオブジェクトに対する
恒久的な参照を作ることになってしまいます。 *note weakref: 11b. モジュー
ルでは、オブジェクトへの参照を作らずに追跡するためのツールを提供していま
す。弱参照オブジェクトが不要になると、弱参照 (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: Tools for working with lists,  Next: Decimal floating-point arithmetic,  Prev: Weak references,  Up: Brief tour of the standard library --- part II

2.11.7 Tools for working with lists
-----------------------------------

多くのデータ構造は、組み込みリスト型を使った実装で事足ります。とはいえ、
時には組み込みリストとは違うパフォーマンス上のトレードオフを持つような実
装が必要になこともあります。

*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: Decimal floating-point arithmetic,  Prev: Tools for working with lists,  Up: Brief tour of the standard library --- part II

2.11.8 Decimal floating-point arithmetic
----------------------------------------

*note decimal: 3a. モジュールでは、 10 進浮動小数の算術演算をサポートす
る *note Decimal: 200. データ型を提供しています。組み込みの 2 進浮動小数
の実装である *note float: 197. に比べて、このクラスがとりわけ便利なのは
、以下の場合です

   * 財務アプリケーションやその他の正確な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: 200. を使った計算では、末尾桁のゼロが保存されて
おり、有効数字2桁の被乗数から自動的に有効数字を 4 桁と判断しています。
‘Decimal’ は手計算と 同じ方法で計算を行い、2 進浮動小数が 10 進小数成分
を正確に表現できないことに よって起きる問題を回避しています。

*note Decimal: 200. クラスは厳密な値を表現できるため、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: Brief tour of the standard library --- part II,  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 仮想環境: 2149. を作ることです。仮想環境とは、
特定のバージョンの 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: 118. と呼ばれま
す。 ‘venv’ は、コマンドが実行された Python のバージョン (*note
-version: f1b. オプションで表示される) をインストールします。例えば、
‘python3.12’ でコマンドを実行すると、バージョン 3.12 がインストールされ
ます。

仮想環境を作るには、仮想環境を置くディレクトリを決めて、 そのディレクト
リのパスを指定して、 *note venv: 118. をスクリプトとして実行します:

     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']
     >>>

Note that the activated virtual environment does not alter the
‘PYTHONPATH’ variable in any way.  This may lead to unexpected results
if the path includes references to code which is incompatible with the
Python version the virtual environment is using.  The best practice is
to ‘unset PYTHONPATH’ in bash or the equivalent for the shell you are
using.

仮想環境を無効化するには、ターミナルに:

     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
モジュールのインストール: 10fc. ガイドを参照してください。)

パッケージ名を指定してそのパッケージの最新版をインストールすることができ
ます:

     (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 モジュールのインストール: 10fc. を参照してください。パッケ
ージを作成してそれを 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 標準ライブラリ: 14a.:

     このマニュアルをざっと眺めておくと便利です。このマニュアルは型、関
     数、標準ライブラリのモジュールについての完全なリファレンスです。標
     準的なPython配布物は 'たくさんの' 追加コードを含んでいます。Unix メ
     ールボックスの読み込み、HTTPによるドキュメント取得、乱数の生成、コ
     マンドラインオプションの構文解析、データ圧縮やその他たくさんのタス
     クのためのモジュールがあります。ライブラリリファレンスをざっと見る
     ことで、何が利用できるかのイメージをつかむことができます。

   * *note Python モジュールのインストール: 10fc. は、他のPythonユーザに
     よって書かれた追加モジュールをどうやってインストールするかを説明し
     ています。

   * *note Python 言語リファレンス: 14b.: 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 よくある質問: 2150. (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
自動的に有効化されます: 11cf. 。 従って ‘Tab’ キーは補完機能を呼び出し、
Python の文の名前、現在のローカル変数、および利用可能なモジュール名を検
索します。 ‘string.a’ のようなドットで区切られた式については、最後の
‘'.'’ までの式を評価し、結果として得られたオブジェクトの属性から補完候補
を示します。 *note __getattr__(): 6fa. メソッドを持ったオブジェクトが式
に含まれている場合、 ‘__getattr__()’ がアプリケーション定義のコードを実
行するかもしれないので注意してください。デフォルトの設定ではあなたのユー
ザーディレクトリの ‘.python_history’ という名前のファイルに履歴を保存し
ます。 履歴は次回の対話的なインタプリタのセッションで再び利用することが
できます。


File: python.info,  Node: 対話的インタープリタの代替,  Prev: タブ補完と履歴編集,  Up: 対話入力編集と履歴置換

2.14.2 対話的インタープリタの代替
---------------------------------

この機能は、初期の版のインタープリタに比べれば大きな進歩です。とはいえ、
まだいくつかの要望が残されています。例えば、行を継続するときに正しいイン
デントが提示されたら快適でしょう (パーサは次の行で *note INDENT: 2158. ト
ークンが必要かどうかを知っています)。補完機構がインタープリタのシンボル
テーブルを使ってもよいかもしれません。括弧やクォートなどの対応をチェック
する (あるいは指示する) コマンドも有用でしょう。

より優れた対話的インタープリタの代替の一つに 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(): 1c3. ビルトイン関数は 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(): 14f6. 関数を使って計算前に丸めを行なって
も意味がありません:

     >>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)
     False

数値を意図した正確な値に近づけることはできませんが、 *note
math.isclose(): fb4. 関数は不正確な値を比べるのに便利です:

     >>> math.isclose(0.1 + 0.1 + 0.1, 0.3)
     True

あるいは、 *note round(): 14f6. 関数を粗い近似値比較に使うこともできます
:

     >>> 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(): 16a. で十分ですが
、きめ細かな制御をしたければ、 *note Format string syntax: 15b7. にある
*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(): 215d. メソッドは
float の値を有理数として表現します:

     >>> x = 3.14159
     >>> x.as_integer_ratio()
     (3537115888337719, 1125899906842624)

この分数は正確なので、元の値を完全に復元することができます:

     >>> x == 3537115888337719 / 1125899906842624
     True

*note float.hex(): 215e. メソッドは 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(): 15f2. 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 色の制御: 1b9. 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:
1b8. で無効にできます。

* Menu:

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


File: python.info,  Node: エラー処理,  Next: 実行可能な Python スクリプト,  Up: 対話モード<2>

2.16.1.1 エラー処理
...................

エラーが発生すると、インタープリタはエラーメッセージとスタックトレースを
表示します。対話モードでは、それから元のプロンプトに戻ります; ファイルか
ら実行した場合は、スタックトレースを表示してゼロ以外の終了ステータスで終
了します（*note try: 8f9. 文の *note except: 1ac. 節で処理された例外は、
ここでいうエラーにはあたりません。）一部のエラーは無条件に致命的であり、
ゼロ以外の終了ステータスで終了します; これは内部の不整合やある種のメモリ
不足の場合に適用されます。エラーメッセージは全て標準エラー出力に書き込ま
れます; これに対して、通常は実行した命令から出力される内容は標準出力に書
き込まれます。

割り込み文字 (interrupt character、普通は ‘Control’-‘C’ か ‘Delete’) を
一次または二次プロンプトに対してタイプすると、入力が取り消されて一次プロ
ンプトに戻ります。 (1) コマンドの実行中に割り込み文字をタイプすると
*note KeyboardInterrupt: bc9. 例外が送出されます。この例外は *note try:
8f9. 文で処理できます。

   ---------- 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: 1ba. と呼ばれる環境変数を、インタプリタ起動時に実行
されるコマンドが入ったファイル名に設定します。この機能は 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: 15aa. オプションを使わない限り、全ての 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の実装: 2173. を参照してください。

* 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.

   * ファイル名引数か、標準入力としてファイルを渡された場合、そのファイ
     ルからスクリプトを読み込んで実行します。

   * ディレクトリ名を引数に受け取った場合、そのディレクトリから適切な名
     前のスクリプトファイルを読み込んで実行します。

   * When called with ‘-c command’, it executes the Python statement(s)
     given as 'command'.  Here 'command' may contain multiple statements
     separated by newlines.  Leading whitespace is significant in Python
     statements!

   * When called with ‘-m module-name’, the given module is located
     using the standard import mechanism and executed as a script.

非インタラクティブモードでは、入力の全体が実行前にパースされます。

インタプリタによって消費されるオプションリストが終了したあと、継続する全
ての引数は *note sys.argv: 1480. に渡ります。 - ただし、添字 0 の先頭要
素(‘sys.argv[0]’) はプログラムのソース自体を示す文字列です。

 -- Option: -c <command>

     'command' 内の Python コードを実行します。 'command' は改行によって
     区切られた1行以上の文です。通常のモジュールのコードと同じく、行頭の
     空白文字は意味を持ちます。

     このオプションが指定された場合、 *note sys.argv: 1480. の最初の要素
     は ‘"-c"’ になり、カレントディレクトリが *note sys.path: 3e2. の先
     頭に追加されます (そのディレクトリにあるモジュールをトップレベルモ
     ジュールとして import 出来るようになります)。

     引数 ‘command’ を指定して *note 監査イベント: 1ccb.
     ‘cpython.run_command’ を送出します。

     バージョン 3.14 で変更: 'command' is automatically dedented before
     execution.

 -- Option: -m <module-name>

     Locate the module using the standard import mechanism and execute
     its contents as the *note __main__: 1. module.

     引数は 'module' 名なので、拡張子 (‘.py’) を含めてはいけません。モジ
     ュール名は有効な Python の絶対モジュール名 (absolute module name) で
     あるべきですが、実装がそれを強制しているとは限りません (例えば、ハ
     イフンを名前に含める事を許可するかもしれません)。

     パッケージ名 (名前空間パッケージも含む) でも構いません。通常のモジ
     ュールの代わりにパッケージ名が与えられた場合、インタプリタは
     ‘<pkg>.__main__’ を main モジュールとして実行します。この挙動はスク
     リプト引数として渡されたディレクトリや zip ファイルをインタプリタが
     処理するのと意図的に同じにしています。

          注釈: このオプションは組み込みモジュールや C で書かれた拡張モ
          ジュールには利用できません。 Python モジュールファイルを持って
          いないからです。しかし、コンパイル済みのモジュールは、たとえ元
          のソースファイルがなくても利用可能です。

     このオプションが指定された場合、 *note sys.argv: 1480. の最初の要素
     はモジュールファイルのフルパスになります (モジュールファイルを検索
     している間、最初の要素は ‘"-m"’ に設定されます)。 *note -c: 1a9. オ
     プションと同様に、カレントディレクトリが *note sys.path: 3e2. の先
     頭に追加されます。

     *note -I: b5b. option can be used to run the script in isolated
     mode where *note sys.path: 3e2. 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 監査イベント: 1ccb.
     ‘cpython.run_module’ を送出します。

     参考
     ....

     *note runpy.run_module(): 17b3.

          Python コードで直接使える等価な機能

     PEP 338(1) - モジュールをスクリプトとして実行する

     バージョン 3.1 で変更: ‘__main__’ サブモジュールを実行するパッケー
     ジ名が提供されました。

     バージョン 3.4 で変更: 名前空間パッケージもサポートされました

 -- Describe: -

     標準入力 (*note sys.stdin: 75f.) からコマンドを読み込みます。標準入
     力がターミナルだった場合、暗黙的に *note -i: 16f9. オプションが指定
     されます。

     このオプションが指定された場合、 *note sys.argv: 1480. の最初の要素
     は ‘"-"’ で、カレントディレクトリが *note sys.path: 3e2. の先頭に追
     加されます。

     引数無しで *note 監査イベント: 1ccb. ‘cpython.run_stdin’ を送出しま
     す。

 -- Describe: <script>

     'script' 内の Python コードを実行します。 'script' は、Python ファ
     イル、 ‘__main__.py’ ファイルがあるディレクトリ、 ‘__main__.py’ フ
     ァイルがある zip ファイルのいずれかの、ファイルシステム上の (絶対ま
     たは相対) パスでなければなりません。

     このオプションが指定された場合、 *note sys.argv: 1480. の最初の要素
     はコマンドラインで指定されたスクリプト名になります。

     スクリプト名が Python ファイルを直接指定していた場合、そのファイル
     を含むディレクトリが *note sys.path: 3e2. の先頭に追加され、そのフ
     ァイルは *note __main__: 1. モジュールとして実行されます。

     スクリプト名がディレクトリか zip ファイルを指定していた場合、スクリ
     プト名が *note sys.path: 3e2. に追加され、その中の ‘__main__.py’ フ
     ァイルが *note __main__: 1. モジュールとして実行されます。

     *note -I: b5b. option can be used to run the script in isolated
     mode where *note sys.path: 3e2. contains neither the script's
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.

     引数 ‘filename’ を指定して *note 監査イベント: 1ccb.
     ‘cpython.run_file’ を送出します。

     参考
     ....

     *note runpy.run_path(): 4a4.

          Python コードで直接使える等価な機能

インターフェイスオプションが与えられなかった場合、*note -i: 16f9. が暗黙
的に指定され、‘sys.argv[0]’ が空の文字列 (‘""’) になり、 現在のディレク
トリが *note sys.path: 3e2. の先頭に追加されます。また、利用可能であれば
タブ補完と履歴編集が自動的に有効化されます (*note readline の設定: 11cf.
を参照してください)。

参考
....

*note インタプリタを起動する: 2024.

バージョン 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: 170.
     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: 193. or *note
     bytearray: 342. to *note str: 16a. without specifying encoding or
     comparing ‘bytes’ or ‘bytearray’ with ‘str’ or ‘bytes’ with *note
     int: 19c.  Issue an error when the option is given twice (‘-bb’).

     バージョン 3.5 で変更: Affects also comparisons of *note bytes:
     193. with *note int: 19c.

 -- Option: -B

     与えられた場合、Python はソースモジュールのインポート時に ‘.pyc’ フ
     ァイルの作成を試みません。 *note PYTHONDONTWRITEBYTECODE: 15ec. 環
     境変数も参照してください。

 -- 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: 217f. 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:
     1223. and *note PYTHONHOME: 3ee, that might be set.

     See also the *note -P: 7c1. and *note -I: b5b. (isolated) options.

 -- Option: -i

     Enter interactive mode after execution.

     Using the *note -i: 16f9. option will enter interactive mode in any
     of the following circumstances:

        * When a script is passed as first argument

        * When the *note -c: 1a9. option is used

        * When the *note -m: 23e. option is used

     Interactive mode will start even when *note sys.stdin: 75f. does
     not appear to be a terminal.  The *note PYTHONSTARTUP: 1ba. file is
     not read.

     このオプションはグローバル変数や、スクリプトが例外を発生させるとき
     にそのスタックトレースを調べるのに便利です。 *note PYTHONINSPECT:
     16f8. も参照してください。

 -- Option: -I

     Python を隔離モードで実行します。*note -E: b5a.、*note -P: 7c1.、お
     よび *note -s: 15aa. オプションも暗黙的に指定されます。

     In isolated mode *note sys.path: 3e2. 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__: 9de.  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: 2180.

     バージョン 3.5 で変更: PEP 488(2) に従って ‘.pyc’ ファイル名を変更
     します。

 -- Option: -OO

     Do *note -O: 18d. 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: 3e2.:

        * ‘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: b5a. and *note -I: b5b. (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: 128d. 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__(): cf7. 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 ‘https://ocert.org/advisories/ocert-2011-003.html’
     for details.

     *note PYTHONHASHSEED: 128d. によってハッシュシードの固定値を秘密に
     することが出来ます。

     Added in version 3.2.3.

     バージョン 3.7 で変更: このオプションが無視されなくなりました.

 -- Option: -s

     *note ユーザのサイトパッケージのディレクトリ: 2181. を *note
     sys.path: 3e2. に追加しません。

     See also *note PYTHONNOUSERSITE: 15ab.

     参考
     ....

     PEP 370(5) - ユーザごとの ‘site-packages’ ディレクトリ

 -- Option: -S

     *note site: cc. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 3e2. への操作を無効にします。後で
     ‘site’ を明示的に import しても、これらの操作は実行されません (実行
     したい場合は、 *note site.main(): 2182. を呼び出してください)。

 -- Option: -u

     Force the stdout and stderr streams to be unbuffered.  This option
     has no effect on the stdin stream.

     *note PYTHONUNBUFFERED: 1dec. も参照してください。

     バージョン 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: 2183. も参照してください。

 -- Option: -W arg

     警告制御。 Python の警告機構はデフォルトでは警告メッセージを *note
     sys.stderr: b37. に表示します。

     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: aca. オプションを指定することができます。警告が1つ
     以上のオプションとマッチしたときは、最後にマッチしたオプションのア
     クションが有効になります。不正な ‘-W’ オプションは無視されます (最
     初の警告が発生したときに、不正なオプションに対する警告メッセージが
     表示されます)。

     Warnings can also be controlled using the *note PYTHONWARNINGS:
     da7. environment variable and from within a Python program using
     the *note warnings: 119. module.  For example, the *note
     warnings.filterwarnings(): 16c7. function can be used to use a
     regular expression on the warning message.

     詳しくは *note 警告フィルタ: 1b2. と *note Describing Warning
     Filters: 2185. を参照してください。

 -- Option: -x

     Unix 以外の形式の ‘#!cmd’ を使うために、ソースの最初の行をスキップ
     します。これは、DOS専用のハックのみを目的としています。

 -- Option: -X

     様々な実装固有のオプションのために予約されています。現在のところ
     CPython は以下の値を定義しています:

        * ‘-X faulthandler’ to enable *note faulthandler: 5c.  See also
          *note PYTHONFAULTHANDLER: 1295.

          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: 106. 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():
          2187. and *note PYTHONTRACEMALLOC: 2188. 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: 1b99.

          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: cf1.

          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: ceb.

          Added in version 3.7.

        * ‘-X utf8’ enables the *note Python UTF-8 Mode: 867.  ‘-X
          utf8=0’ explicitly disables *note Python UTF-8 Mode: 867.
          (even when it would otherwise activate automatically).  See
          also *note PYTHONUTF8: cd3.

          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: b9f.

          Added in version 3.8.

        * ‘-X warn_default_encoding’ issues a *note EncodingWarning:
          2189. when the locale-specific default encoding is used for
          opening files.  See also *note PYTHONWARNDEFAULTENCODING: 9c3.

          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: 16f. 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(): 1175.  '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 ‘__main__’.  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: 218a.

          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: 177. 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: 18cd.

          Added in version 3.14.

        * ‘-X context_aware_warnings=0,1’ causes the *note
          warnings.catch_warnings: 17a. context manager to use a *note
          ContextVar: 18da. 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: 18c0.

          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: 218b.

          Added in version 3.14.

     任意の値を渡し、 *note sys._xoptions: 218c. 辞書から取り出すことも
     出来ます。

     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: 3ee. が1つのディレクトリに設定されている場合、そ
     の値は ‘`prefix'’ と ‘`exec_prefix'’ の両方を置き換えます。それらに
     別々の値を指定したい場合は、 ‘PYTHONHOME’ を
     ‘`prefix':`exec_prefix'’ のように指定します。

 -- 環境変数: PYTHONPATH

     モジュールファイルのデフォルトの検索パスを追加します。この環境変数
     のフォーマットはシェルの ‘PATH’ と同じで、 *note os.pathsep: 218f.
     (Unix ならコロン、 Windows ならセミコロン) で区切られた1つ以上のデ
     ィレクトリパスです。存在しないディレクトリは警告なしに無視されます
     。

     通常のディレクトリに加えて、 *note PYTHONPATH: 1223. のエントリはピ
     ュアPython モジュール(ソース形式でもコンパイルされた形式でも) を含
     む zip ファイルを参照することもできます。拡張モジュールは zip ファ
     イルの中から import することはできません。

     デフォルトの検索パスはインストール依存ですが、通常は
     ‘`prefix'/lib/python`version'’ で始まります。 (上の *note
     PYTHONHOME: 3ee. を参照してください。) これは '常に' *note
     PYTHONPATH: 1223. に追加されます。

     上の *note インターフェイスオプション: 2176. で説明されているように
     、追加の検索パスディレクトリが *note PYTHONPATH: 1223. の手前に追加
     されます。検索パスは Python プログラムから *note sys.path: 3e2. 変
     数として操作することができます。

 -- 環境変数: PYTHONSAFEPATH

     If this is set to a non-empty string, don't prepend a potentially
     unsafe path to *note sys.path: 3e2.: 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: b36. value.

     Added in version 3.9.

 -- 環境変数: PYTHONSTARTUP

     この変数が読み込み可能なファイル名の場合、対話モードで最初のプロン
     プトが表示される前にそのファイルの Python コマンドが実行されます。
     ファイル内で定義されているオブジェクトやインポートされたオブジェク
     トを対話セッションで修飾せずに使用するために、ファイルは対話的なコ
     マンドと同じ名前空間で実行されます。 このファイルの中で、プロンプト
     *note sys.ps1: 2190. や *note sys.ps2: 2191.、ならびにフック *note
     sys.__interactivehook__: 11ce. も変更できます。

     Raises an *note auditing event: 1ccb. ‘cpython.run_startup’ with
     the filename as the argument when called on startup.

 -- 環境変数: PYTHONOPTIMIZE

     この変数に空でない文字列を設定するのは *note -O: 18d. オプションを
     指定するのと等価です。整数を設定した場合、 ‘-O’ を複数回指定したの
     と同じになります。

 -- 環境変数: 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(): cd5. which itself is called by built-in *note
     breakpoint(): 273.  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
     ‘sys.breakpointhook()’ to do nothing but return immediately.

     Added in version 3.7.

 -- 環境変数: PYTHONDEBUG

     この変数に空でない文字列を設定するのは *note -d: 217e. オプションを
     指定するのと等価です。整数を指定した場合、 ‘-d’ を複数回指定したの
     と同じになります。

     This environment variable requires a *note debug build of Python:
     509, otherwise it's ignored.

 -- 環境変数: PYTHONINSPECT

     この変数に空でない文字列を設定するのは *note -i: 16f9. オプションを
     指定するのと等価です。

     この変数は Python コードから *note os.environ: 25b. を使って変更し
     て、プログラム終了時のインスペクトモードを強制することができます。

     引数無しで *note 監査イベント: 1ccb. ‘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: 1ba. is also executed.  Emits audit events.

 -- 環境変数: PYTHONUNBUFFERED

     この変数に空でない文字列を設定するのは *note -u: 1deb. オプションを
     指定するのと等価です。

 -- 環境変数: PYTHONVERBOSE

     この変数に空でない文字列を設定するのは *note -v: 1643. オプションを
     指定するのと等価です。整数を設定した場合、 ‘-v’ を複数回指定したの
     と同じになります。

 -- 環境変数: PYTHONCASEOK

     この環境変数が設定されている場合、 Python は *note import: 7f8. 文
     で大文字/小文字を区別しません。 これは Windows と macOS でのみ動作
     します。

 -- 環境変数: PYTHONDONTWRITEBYTECODE

     この変数に空でない文字列を設定した場合、 Python はソースモジュール
     のインポート時に ‘.pyc’ ファイルを作成しようとはしなくなります。
     *note -B: 15eb. オプションを指定するのと等価です。

 -- 環境変数: 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: 170. ‘pycache_prefix=PATH’ option.

     Added in version 3.8.

 -- 環境変数: PYTHONHASHSEED

     この変数が設定されていない場合や ‘random’ に設定された場合、乱数値
     が str、bytes オブジェクトのハッシュのシードに使われます。

     *note PYTHONHASHSEED: 128d. が整数値に設定された場合、その値はハッ
     シュランダム化が扱う型の 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(): ad6. と
     同じ意味を持ちます。

     標準エラー出力の場合、‘:errorhandler’ の部分は無視されます; ハンド
     ラは常に ‘'backslashreplace'’ です。

     バージョン 3.4 で変更: ‘encodingname’ の部分が任意になりました。

     バージョン 3.6 で変更: On Windows, the encoding specified by this
     variable is ignored for interactive console buffers unless *note
     PYTHONLEGACYWINDOWSSTDIO: e59. is also specified.  Files and pipes
     redirected through the standard streams are not affected.

 -- 環境変数: PYTHONNOUSERSITE

     If this is set, Python won't add the *note user site-packages
     directory: 2181. to *note sys.path: 3e2.

     参考
     ....

     PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

 -- 環境変数: PYTHONUSERBASE

     Defines the *note user base directory: 1538, which is used to
     compute the path of the *note user site-packages directory: 2181.
     and *note installation paths: 2192. 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: aca. option.  If set to a comma
     separated string, it is equivalent to specifying ‘-W’ 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 警告フィルタ: 1b2. と *note Describing Warning
     Filters: 2185. を参照してください。

 -- 環境変数: PYTHONFAULTHANDLER

     If this environment variable is set to a non-empty string, *note
     faulthandler.enable(): 211. is called at startup: install a handler
     for *note SIGSEGV: 1290, *note SIGFPE: 1291, *note SIGABRT: 1292,
     *note SIGBUS: 1293. and *note SIGILL: 1294. signals to dump the
     Python traceback.  This is equivalent to *note -X: 170.
     ‘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: 106.
     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(): 2187. function for more information.
     This is equivalent to setting the *note -X: 170. ‘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: 170. ‘importtime’ option.

     Added in version 3.7.

     バージョン 3.14 で変更: Added ‘PYTHONPROFILEIMPORTTIME=2’ to also
     trace imports of loaded modules.

 -- 環境変数: PYTHONASYNCIODEBUG

     この環境変数が空でない文字列に設定された場合、*note asyncio: b. モ
     ジュールの *note デバッグモード: 2195. が有効化されます。

     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: 2196.

        * ‘malloc’: use the ‘malloc()’ function of the C library for all
          domains (*note PYMEM_DOMAIN_RAW: 2197, *note PYMEM_DOMAIN_MEM:
          e67, *note PYMEM_DOMAIN_OBJ: e65.).

        * ‘pymalloc’: use the *note pymalloc allocator: f0f. for *note
          PYMEM_DOMAIN_MEM: e67. and *note PYMEM_DOMAIN_OBJ: e65.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 2197. domain.

        * ‘mimalloc’: use the *note mimalloc allocator: 178a. for *note
          PYMEM_DOMAIN_MEM: e67. and *note PYMEM_DOMAIN_OBJ: e65.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 2197. domain.

     Install *note debug hooks: 2198.:

        * ‘debug’: install debug hooks on top of the *note default
          memory allocators: 2196.

        * ‘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.

          注釈: In the *note free-threaded: 1f6. build, the ‘malloc’,
          ‘malloc_debug’, ‘pymalloc’, and ‘pymalloc_debug’ values are
          not supported.  Only ‘default’, ‘debug’, ‘mimalloc’, and
          ‘mimalloc_debug’ are accepted.

     Added in version 3.6.

     バージョン 3.7 で変更: Added the ‘"default"’ allocator.

 -- 環境変数: PYTHONMALLOCSTATS

     If set to a non-empty string, Python will print statistics of the
     *note pymalloc memory allocator: f0f. or the *note mimalloc memory
     allocator: 178a. (whichever is in use) every time a new object
     arena is created, and on shutdown.

     This variable is ignored if the *note PYTHONMALLOC: e62.
     environment variable is used to force the ‘malloc()’ allocator of
     the C library, or if Python is configured without both ‘pymalloc’
     and ‘mimalloc’ 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(): 33c.

     *note Availability: 2199.: 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: 2199.: 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():
     92f.).

     Configuring one of these locales (either explicitly or via the
     above implicit locale coercion) automatically enables the
     ‘surrogateescape’ *note error handler: 1bce. for *note sys.stdin:
     75f. and *note sys.stdout: cd1. (*note sys.stderr: b37. continues
     to use ‘backslashreplace’ as it does in any other locale).  This
     stream handling behavior can be overridden using *note
     PYTHONIOENCODING: 1210. 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: cd3. 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: 2199.: 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: 170. ‘dev’ option.

     Added in version 3.7.

 -- 環境変数: PYTHONUTF8

     If set to ‘1’, enable the *note Python UTF-8 Mode: 867.

     If set to ‘0’, disable the *note Python UTF-8 Mode: 867.

     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: 2189. when the locale-specific default
     encoding is used.

     詳細は *note Opt-in EncodingWarning: 219a. を参照してください。

     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: 170. 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: 170. 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: 170. 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: 170. 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: 170. 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 色の制御: 1b9.

     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 REPL.

     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: 170. 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: 177. 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: 170.

     Added in version 3.14.

 -- 環境変数: PYTHON_CONTEXT_AWARE_WARNINGS

     If set to ‘1’ then the *note warnings.catch_warnings: 17a. context
     manager will use a *note ContextVar: 18da. 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:
     170.

     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: 170. 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
     ‘__main__’.

     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: 170. 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: 21a6.

ビルド手順は通常のコマンドで行います

     ./configure
     make
     make install

*note Configure のオプション: 21a7. や特定の 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:
21a9. と *note exec_prefix: 21aa. はインストール状況に依存していて、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: 21b4. 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: 121b,
                                                                            *note turtle: 108.
                                                                            
                                                                            
zlib(17)                              1.2.2.1                               *note zlib: 13a, *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: 11d. 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: 1b8c. allows building with an external
     libexpat(20) library.

   * *note サードパーティ依存関係のオプション: 21b7.

バージョン 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: 21b5. for choosing the backend for the
*note readline: bf. module.

   (9) https://linux.die.net/man/3/libuuid

   (10) The *note uuid: 117. 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: 21b6. 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(): a43. メソッドを参照して
     ください。

     Added in version 3.6.

 -- Option: --disable-ipv6

     IPv6サポートを無効にします(サポートされている場合はデフォルトで有効
     )、 *note socket: d1. モジュールを参照してください。

 -- Option: --enable-big-digits=[15|30]

     Python *note int: 19c. の桁の大きさをビット単位で定義します: 15ビッ
     トまたは30ビットです。

     デフォルトでは、桁の大きさは30です。

     ‘PYLONG_BITS_IN_DIGIT’ を ‘15’ または ‘30’ に定義します。

     *note sys.int_info.bits_per_digit: 14af. を参照してください。

 -- 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: 21c0. に
     設定します。*note zoneinfo: 13b. モジュールの *note Compile-time
     configuration: 21c1. を参照してください。

     デフォルト:
     ‘/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo’

     *note os.pathsep: 218f. パスセパレータを参照してください。

     Added in version 3.9.

 -- Option: --without-decimal-contextvar

     コルーチンローカルコンテキスト(デフォルト)ではなく、スレッドローカ
     ルコンテキストを使用して ‘_decimal’ 拡張モジュールをビルドします。
     *note decimal: 3a. モジュールを参照してください。

     *note decimal.HAVE_CONTEXTVAR: 21c3. および *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: cd0. および PEP 538(1) を参照してくださ
     い。

 -- Option: --with-platlibdir=DIRNAME

     Python のライブラリディレクトリ名(デフォルトは ‘lib’ )。

     Fedora と SuSE は64ビットプラットフォームで ‘lib64’ を使用します。

     *note sys.platlibdir: b36. を参照してください。

     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: 170. 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: 17b0.

     Defines the ‘Py_GIL_DISABLED’ macro and adds ‘"t"’ to *note
     sys.abiflags: c5d.

     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: 15a.

        * ‘no’: Don't build the JIT.

        * ‘yes’: Enable the JIT. To disable it at runtime, set the
          environment variable *note PYTHON_JIT=0: 44b.

        * ‘yes-off’: Build the JIT, but disable it by default.  To
          enable it at runtime, set the environment variable *note
          PYTHON_JIT=1: 44b.

        * ‘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: 44b.

     ‘--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: 117.
     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: 3e5. を使って取得することがで
     きます。

     例として、 ‘--prefix="$HOME/.local/"’ を使用すると、 Python をその
     ホームディレクトリにインストールすることができます。

 -- Option: --exec-prefix=EPREFIX

     アーキテクチャ依存のファイルを EPREFIX にインストールします。デフォ
     ルトは *note -prefix: 21a9. です。

     この値は、実行時に *note sys.exec_prefix: 3e9. を使って取得すること
     ができます。

 -- 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: 1adf. を使用して 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: 16d5.

     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: a66.) 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: 178a. allocator (enabled by
     default).

     This option cannot be used together with *note -disable-gil: 499.
     because the *note free-threaded: 1f6. build requires mimalloc.

     See also *note PYTHONMALLOC: e62. environment variable.

 -- Option: --without-pymalloc

     Disable the specialized Python memory allocator *note pymalloc:
     f0f. (enabled by default).

     See also *note PYTHONMALLOC: e62. 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: 171.

          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: 119. module.

   * Add ‘d’ to *note sys.abiflags: c5d.

   * Add ‘sys.gettotalrefcount()’ function.

   * Add *note -X showrefcount: 170. command line option.

   * Add *note -d: 217e. command line option and *note PYTHONDEBUG:
     217f. 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: 2196. 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(): 1b5. 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 are now ABI compatible with debug
builds: defining the ‘Py_DEBUG’ macro no longer implies the
‘Py_TRACE_REFS’ macro (see the *note -with-trace-refs: 636. option).
However, debug builds still expose more symbols than release builds and
code built against a debug build is not necessarily compatible with a
release build.


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(): 290. function.

        * Add *note PYTHONDUMPREFS: ba2. environment variable.

     The *note PYTHONDUMPREFS: ba2. environment variable can be used to
     dump objects and reference counts still alive at Python exit.

     *note Statically allocated objects: 987. 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: 2201.
     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: e6a.

     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: 21fb. 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’.

     バージョン 3.13 で非推奨、バージョン 3.16 で削除予定: A copy of the
     ‘mpdecimal’ library sources will no longer be distributed with
     Python 3.16.

     参考
     ....

     *note LIBMPDEC_CFLAGS: 21e0. and *note LIBMPDEC_LIBS: 21e1.

 -- 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: 220e. 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: b67. が指定された場合のみ有効です。

     オプション:

        * ‘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: 2214. が指定された場合のみ有効です (デフォルトで
     は ‘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: a66. 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: 21b8.


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: 16f1.
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: 16d7. 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: 16d7. and *note LDFLAGS: 16d6. 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: 2238. is used for building the interpreter and
     stdlib C extensions.  Use it when a compiler flag should 'not' be
     part of *note CFLAGS: 16d5. once Python is installed (gh-65320(1)).

     In particular, *note CFLAGS: 16d5. 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: 16d5. 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: 16d5. variable passed to the ‘./configure’
     script.

     Added in version 3.2.

 -- 環境変数: CONFIGURE_CFLAGS_NODIST

     Value of *note CFLAGS_NODIST: 2238. 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.

 -- 環境変数: CFLAGS_CEVAL

     Flags used to compile ‘Python/ceval.c’.

     Added in version 3.14.5.

 -- 環境変数: 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: a67. 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: 16d6. variable passed to the ‘./configure’
     script.

     Avoid assigning *note CFLAGS: 16d5, *note LDFLAGS: 16d6, 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: 224b. is used in the same manner as *note
     CFLAGS_NODIST: 2238.  Use it when a linker flag should 'not' be
     part of *note LDFLAGS: 16d6. once Python is installed
     (gh-65320(1)).

     In particular, *note LDFLAGS: 16d6. 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: 16d6. would take precedence
          over user- and package-supplied ‘-L’ flags.

 -- 環境変数: CONFIGURE_LDFLAGS_NODIST

     Value of *note LDFLAGS_NODIST: 224b. 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: 16d7. and *note LDFLAGS: 16d6. 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:
2146. 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: 2256. 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 パッケージ: 2257. 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 埋め込み可能なパッケージ: 2258. 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::
* Index signatures::
* 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: 2256. 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:
225c. 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: 225e. environment variable, or a configuration
file.  See *note Configuration: 225f. 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: 2260. 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: 225f.
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: 2264.

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.

Passing ‘--refresh’ will update all registrations for installed
runtimes.  This will recreate Start menu shortcuts, registry keys, and
global aliases (such as ‘python3.14.exe’ or for any installed scripts).
These are automatically refreshed on installation of any runtime, but
may need to be manually refreshed after installing packages.

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: 2265.), 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.
                                                                            
                                                                            
‘shebang_templates’                   (none)                                Mapping from shebang line template
                                                                            to alternative command, such as ‘py
                                                                            -V:<tag>’ or a substitute string.
                                                                            See *note Shebang lines: 2260. for
                                                                            more details.
                                                                            
                                                                            
‘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.
                                                                            
                                                                            
‘install.enable_entrypoints’          (none)                                True to generate global commands
                                                                            for installed packages (such as
                                                                            ‘pip.exe’).  These are defined by
                                                                            the packages themselves.  If set to
                                                                            false, only the Python interpreter
                                                                            has global commands created.  By
                                                                            default, true.  You should run ‘py
                                                                            install --refresh’ after changing
                                                                            this setting.
                                                                            
                                                                            
‘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’
                                                                            and ‘pip.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: 225f. 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.

Since version 26.3 of the Python install manager, custom shebang
templates may be added to your configuration file.  Add the
‘shebang_templates’ object with one member for each template (the string
to match) and the command to use when the template is matched.  Most
commands should be ‘py -V:<tag>’ (or ‘pyw’) to launch one of your
installed runtimes.  The ‘py -3.<version>’ form is also allowed, as is a
plain ‘py’ to launch the default.  No other arguments are supported.

     {
         "shebang_templates": {
             "/usr/bin/python": "py",
             "/usr/bin/my_custom_python": "py -V:MyCustomPython/3"
         }
     }

If the substitute command is not ‘py’ or ‘pyw’, it will be written back
into the shebang and regular handling continues.  If launching arbitrary
executables is permitted, then providing a full path will allow you to
redirect from Python to any executable.  The template should match
either the entire line (ignoring leading and trailing whitespace), or up
to the first space in the shebang line.

     注釈: 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: 2264.
and *note Administrative configuration: 226b. 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’.
                                                       
                                                       
‘install.hard_link_entrypoints’                        True to use hard links for global shortcuts to save
                                                       disk space.  If false, each shortcut executable is
                                                       copied instead.  After changing this setting, you
                                                       must run ‘py install --refresh --force’ to update
                                                       existing commands.  By default, true.  Disabling
                                                       this may be necessary for troubleshooting or systems
                                                       that have issues with file links.
                                                       
                                                       
‘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.
                                                       
                                                       
‘source_settings’                                      A mapping from source URL to settings specific to
                                                       that index.  When multiple configuration files
                                                       include this section, URL settings are added or
                                                       overwritten, but individual settings are not merged.
                                                       These settings are currently only for
                                                       *note index signatures: 226d.
                                                       


File: python.info,  Node: Installing free-threaded binaries,  Next: Index signatures,  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: Index signatures,  Next: Troubleshooting,  Prev: Installing free-threaded binaries,  Up: Python install manager

3.4.1.13 Index signatures
.........................

Added in version 26.2.

Index files may be signed to detect tampering.  A signature is a catalog
file at the same URL as the index with ‘.cat’ added to the filename.
The catalog file should contain the hash of its matching index file, and
should be signed with a valid Authenticode signature.  This allows
standard tooling (on Windows) to generate a signature, and any
certificate may be used as long as the client operating system already
trusts its certification authority (root CA).

Index signatures are only downloaded and checked when the local
configuration's ‘source_settings’ section includes the index URL and
‘requires_signature’ is true, or the index JSON contains
‘requires_signature’ set to true.  When the setting exists in local
configuration, even when false, settings in the index are ignored.

As well as requiring a valid signature, the ‘required_root_subject’ and
‘required_publisher_subject’ settings can further restrict acceptable
signatures based on the certificate Subject fields.  Any attribute
specified in the configuration must match the attribute in the
certificate (additional attributes in the certificate are ignored).
Typical attributes are ‘CN=’ for the common name, ‘O=’ for the
organizational unit, and ‘C=’ for the publisher's country.

Finally, the ‘required_publisher_eku’ setting allows requiring that a
specific Enhanced Key Usage (EKU) has been assigned to the publisher
certificate.  For example, the EKU ‘1.3.6.1.5.5.7.3.3’ indicates that
the certificate was intended for code signing (as opposed to server or
client authentication).  In combination with a specific root CA, this
provides another mechanism to verify a legitimate signature.

This is an example ‘source_settings’ section from a configuration file.
In this case, the publisher of the feed is uniquely identified by the
combination of the Microsoft Identity Verification root and the EKU
assigned by that root.  The signature for this case would be found at
‘https://www.python.org/ftp/python/index-windows.json.cat’.

     {
       "source_settings": {
         "https://www.python.org/ftp/python/index-windows.json": {
           "requires_signature": true,
           "required_root_subject": "CN=Microsoft Identity Verification Root Certificate Authority 2020",
           "required_publisher_subject": "CN=Python Software Foundation",
           "required_publisher_eku": "1.3.6.1.4.1.311.97.608394634.79987812.305991749.578777327"
         }
       }
     }

The same settings could be specified in the ‘index.json’ file instead.
In this case, the root and EKU are omitted, meaning that the signature
must be valid and have a specific common name in the publisher's
certificate, but no other checks are used.

     {
       "requires_signature": true,
       "required_publisher_subject": "CN=Python Software Foundation",
       "versions": [
         // ...
       ]
     }

When settings from inside a feed are used, the user is notified and the
settings are shown in the log file or verbose output.  It is recommended
to copy these settings into a local configuration file for feeds that
will be used frequently, so that unauthorised modifications to the feed
cannot disable verification.

It is not possible to override the location of the signature file in the
feed or through a configuration file.  Administrators can provide their
own ‘source_settings’ in a mandatory configuration file (see *note
Administrative configuration: 226b.).

If signature validation fails, you will be notified and prompted to
continue.  When interactive confirmation is not allowed (for example,
because ‘--yes’ was specified), it will always abort.  To use a feed
with invalid configuration in this scenario, you must provide a
configuration file that disables signature checking for that feed.

     "source_settings": {
       "https://www.example.com/feed-with-invalid-signature.json": {
         "requires_signature": false
       }
     }


File: python.info,  Node: Troubleshooting,  Prev: Index signatures,  Up: Python install manager

3.4.1.14 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: 2259.?
                                                       
                                                       
                                                       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: 2259.?
                                                       
                                                       
                                                       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: 225e.
                                                       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.  Running ‘py
                                                       install --refresh’ and ensuring that the global
                                                       shortcuts directory is on ‘PATH’ (it will be shown
                                                       in the command output if it is not) should make
                                                       commands such as ‘pip’ (and other installed
                                                       packages) available.
                                                       
                                                       
I installed a package with ‘pip’ but its command is    Have you activated a virtual environment?  Run the
not found.                                             ‘.venv\Scripts\activate’ script in your terminal to
                                                       activate.
                                                       
                                                       
                                                       New packages do not automatically have global
                                                       shortcuts created by the Python install manager.
                                                       Similarly, uninstalled packages do not have their
                                                       shortcuts removed.  Run ‘py install --refresh’ to
                                                       update the global shortcuts for newly installed
                                                       packages.
                                                       
                                                       
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: 225c.
                                                       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: 225f. 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 モジュールの検索: e1e.).  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(): 318. 関数や *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(): 866.).

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: 867. to change the default text
encoding to UTF-8.  You can enable the *note Python UTF-8 Mode: 867. via
the ‘-X utf8’ command line option, or the ‘PYTHONUTF8=1’ environment
variable.  See *note PYTHONUTF8: cd3. for enabling UTF-8 mode, and *note
Python install manager: 2026. for how to modify environment variables.

When the *note Python UTF-8 Mode: 867. 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
モジュール検索パスの初期化: 193e. with detailed Windows notes.

‘._pth’ ファイルが見付からなかったときは、 Windows では *note sys.path:
3e2. は次のように設定されます:

   * 最初に空のエントリが追加されます。これはカレントディレクトリを指し
     ています。

   * その次に、 *note PYTHONPATH: 1223. 環境変数が存在するとき、 *note
     環境変数: 807. で解説されているように追加されます。 Windows ではド
     ライブ識別子 (‘C:\’ など)と区別するために、この環境変数に含まれるパ
     スの区切り文字はセミコロンでなければならない事に注意してください。

   * 追加で "アプリケーションのパス" を ‘HKEY_CURRENT_USER’ か
     ‘HKEY_LOCAL_MACHINE’ の中の
     ‘\SOFTWARE\Python\PythonCore{version}\PythonPath’ のサブキーとして
     登録することができます。サブキーはデフォルト値としてセミコロンで区
     切られたパス文字列を持つことができ、書くパスが *note sys.path: 3e2.
     に追加されます。 (既存のインストーラーはすべて HKLM しか利用しない
     ので、 HKCU は通常空です)

   * *note PYTHONHOME: 3ee. が設定されている場合、それが "Python Home" と
     して扱われます。 それ以外の場合、 "Python Home" を推定するために
     Python の実行ファイルのパスから "目印ファイル" (‘Lib\os.py’ または
     ‘pythonXY.zip’) が探されます。 Python home が見つかった場合、そこか
     らいくつかのサブディレクトリ (‘Lib’, ‘plat-win’ など) が *note
     sys.path: 3e2. に追加されます。 見つからなかった場合、コアとなる
     Python path はレジストリに登録された PythonPath から構築されます。

   * Python Home が見つからず、環境変数 *note PYTHONPATH: 1223. が指定さ
     れず、レジストリエントリが見つからなかった場合、関連するデフォルト
     のパスが利用されます (例: ‘.\Lib;.\plat-win’ など)。

メインの実行ファイルと同じ場所か一つ上のディレクトリに ‘pyvenv.cfg’ があ
る場合、以下の異なった規則が適用されます:

   * *note PYTHONHOME: 3ee. が設定されておらず、 ‘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(): 3f4.

   * 自身のアプリケーションから ‘python.exe’ を起動する前に、 *note
     PYTHONPATH: 1223. をクリアしたり上書きし、 *note PYTHONHOME: 3ee. を
     セットしてください。

   * 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: f2a.  This finder is enabled
on Windows in 3.6.0 and earlier, but may need to be explicitly added to
*note sys.meta_path: f2b. in the future.


File: python.info,  Node: 追加のモジュール,  Next: Windows 上で Python をコンパイルする,  Prev: モジュールの検索,  Up: Windows で Python を使う

3.4.9 追加のモジュール
----------------------

Python は全プラットフォーム互換を目指していますが、 Windows にしかないユ
ニークな機能もあります。標準ライブラリと外部のライブラリの両方で、幾つか
のモジュールと、そういった機能を使うためのスニペットがあります。

Windows 固有の標準モジュールは、 *note MS Windows 固有のサービス: 227c.
に書かれています。

* 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++
拡張モジュールのビルド: 2280. を参照してください。

   ---------- 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: 2259. 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: 2284. を参照して下さい。

インストーラを開始すると、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(): 318. 関数や *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:
2284. 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: 2257.

   ---------- 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: 118. モジュールか外部ツール ‘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: 2291.  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: 229e. 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 コマンドラインと環境: 1e04.).  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 のエディタとシェル: 121b. 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: 22a4. 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: 22a0. 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: 22ad, may not be ready for use in a
free-threaded build, and will re-enable the *note GIL: 165.  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:
     2146.  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: 2176. 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: 19f6. 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:
22b7. を使用して Python コードを呼び出すことです。 それにより、完全な
Python インタープリタ、標準ライブラリ、及び Python のコードが、アプリに
パッケージ化され、独自の私的用途に使用されます。

Python の 標準ライブラリには、 Android におけるいくつかの重要な省略や制
限があります。詳細は *note API 利用可能性ガイド: 22b8. を参照してくださ
い。

* Menu:

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


File: python.info,  Node: Android アプリに Python を追加する,  Next: Android 向けの Python パッケージをビルドする,  Up: Android で Python を使う

3.6.1 Android アプリに Python を追加する
----------------------------------------

ほとんどのアプリ開発者は、次のツールの一つを使用するべきです。これにより
、はるかに簡単な体験が提供されます:

   * Briefcase(1), from the BeeWare project

   * 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.beeware.org

   (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: 22b7.
を使用して 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: 221e. オプションを使用して指定できます。デフォルトでは、
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(): 22c2. を使用して取得できます。 *note
platform.system(): 22c3. は、デバイスにより ‘iOS’ または ‘iPadOS’ を報告
します。

*note os.uname(): 1332. は、カーネルレベルの詳細を報告します。これは
‘Darwin’ の名前を報告します。


File: python.info,  Node: 標準ライブラリの利用可能性,  Next: バイナリ拡張モジュール,  Prev: プラットフォームの識別,  Up: iOS ランタイムでの Python

3.7.1.3 標準ライブラリの利用可能性
..................................

Python の 標準ライブラリには、 iOS におけるいくつかの重要な省略や制限が
あります。詳細は *note iOS 向けの API 利用可能性ガイド: 22b8. を参照して
ください。


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
を追加する: 22c6. のガイドを参照してください。

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: 22c7. を
インストールします。インポートされると、バイナリモジュールの ‘__file__’
属性は ‘.fwork’ ファイルの場所を返します。一方、読み込まれたモジュールの
*note ModuleSpec: 22c8. はフレームワークフォルダのバイナリの場所として
‘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: 41b.) が '有効' に
          なっていること

        * Buffered stdio (*note PyConfig.buffered_stdio: 40f.) が '無効'
          になっていること

        * バイトコードの書き込み (*note PyConfig.write_bytecode: 40b.) が
          '無効' になっていること

        * シグナルハンドラ (*note PyConfig.install_signal_handlers:
          abf.) が '有効' になっていること

        * システムログ (*note PyConfig.use_system_logger: 22cd.) が '有
          効' になっていること (オプションですが、強く推奨され、デフォル
          トで有効化されています)

        * インタープリタの *note PYTHONHOME: 3ee. がアプリバンドルの
          ‘python’ サブフォルダを指すように構成されていること

        * インタープリタの *note PYTHONPATH: 1223. が次のものを含むこと

             - アプリのバンドルの ‘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: 1223. 設定の一つとして追加されていることを確認
     してください。

   * サードパーティパッケージを含むフォルダが ‘.pth’ ファイルを含む場合
     、直接 *note PYTHONPATH: 1223. や *note sys.path: 3e2. に追加するの
     ではなく、そのフォルダを (*note site.addsitedir(): 22ce. を使用して
     ) サイトディレクトリとして追加する必要があります。

   ---------- 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: 21a3.  For more
information see the *note IDLE docs: 121b.


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 標準ライブラリ: 14a. で述べられています。形式ばらない Python 言語
入門には、 *note Python チュートリアル: 2018. を参照してください。 C 言
語あるいはC++プログラマ向けには、このマニュアルとは別に二つのマニュアル
があります。 *note Python インタプリタの拡張と埋め込み: 2019. では、
Python 拡張モジュールを書くための高レベルな様式について述べています。ま
た、 *note Python/C API reference manual: 201a. では、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 標準ライブラリ: 14a. でドキュメン
ト化されています。いくつかの組み込みモジュールについては、言語定義と重要
なかかわりをもっているときについて触れています。

* 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: 22e2. (*note letter: 22e2. | *note digit: 22e3. | "_")*
     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: 22e4.  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: 22e5.

        * ‘"case"’: A name in double quotes denotes a *note
          soft-keyword: a11.

        * ‘'@'’: A non-letter symbol in single quotes denotes an *note
          OP: 22e6. token, that is, a *note delimiter: 22e7. or *note
          operator: 22e8.

   * ‘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: 22e9.

   * ‘"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: 22ee. operates on the individual characters of
the input source, while the 'parser' (syntactic analyzer) operates on
the stream of *note tokens: 22e4. 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: 22ef. all whitespace that is not converted to tokens like
*note token.INDENT: 2158. or *note NEWLINE: 22f0.  '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 字句解析:
22f1.) 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: 22e4, 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: 22f5.
(UTF-8 by default), and decodes the text into *note source characters:
22f6.  If the text cannot be decoded, a *note SyntaxError: 18f. 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: 22ef.
                                                       
   * タブ

   * formfeed

   * CR, LF                                               * *note New line: 22f7.
                                                       
                                                          * *note Indentation: 22f8.
                                                       
                                                       
   * backslash (‘\’)                                      * *note Explicit line joining: 22f9.
                                                       
                                                          * (Also significant in
                                                            *note string escape sequences: 687.)
                                                       
                                                       
   * hash (‘#’)                                           * *note Comment: 22fa.
                                                       
                                                       
   * quote (‘'’, ‘"’)                                     * *note String literal: 22fb.
                                                       
                                                       
   * ASCII letter (‘a’-‘z’, ‘A’-‘Z’)                      * *note Name: 22fc.
                                                       
   * non-ASCII character                                  * Prefixed *note string or bytes literal: 22fb.
                                                       
                                                       
   * underscore (‘_’)                                     * *note Name: 22fc.
                                                       
                                                          * (Can also be part of
                                                            *note numeric literals: 22fd.)
                                                       
                                                       
   * number (‘0’-‘9’)                                     * *note Numeric literal: 22fd.
                                                       
                                                       
   * dot (‘.’)                                            * *note Numeric literal: 22fd.
                                                       
                                                          * *note Operator: 22e8.
                                                       
                                                       
   * question mark (‘?’)                                  * Error (outside string literals and comments)
                                                       
   * dollar (‘$’)

   * 
     backquote (‘​`​’)

   * control character

   * other printing character                             * *note Operator or delimiter: 22e8.
                                                       
                                                       
   * end of file                                          * *note End marker: 22fe.
                                                       

* 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:
22f0.  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: 22f9. or *note implicit: 2302.
'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: 22fb.)  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 標準エンコーディング: fbc. を参照し
てください)。宣言されたエンコーディングは、例えば文字列リテラル、コメン
ト、識別子などの、全ての字句解析に使われます。 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: 22f0. 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: 2158. and *note DEDENT: 230e. 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: 2312. token.


File: python.info,  Node: その他のトークン,  Next: Names identifiers and keywords,  Prev: 行構造,  Up: 字句解析

4.2.2 その他のトークン
----------------------

Besides *note NEWLINE: 22f0, *note INDENT: 2158. and *note DEDENT: 230e,
the following categories of tokens exist: 'identifiers' and 'keywords'
(*note NAME: 2315.), 'literals' (such as *note NUMBER: 2316. and *note
STRING: 2317.), and other symbols ('operators' and 'delimiters', *note
OP: 22e6.).  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: 2315. 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: 2319. 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: 231b. *note name_continue: 231c.*
     name_start:    "a"..."z" | "A"..."Z" | "_" | <non-ASCII character>
     name_continue: name_start | "0"..."9"
     identifier:    <*note NAME: 231a, except keywords>

Note that not all names matched by this grammar are valid; see *note
Non-ASCII characters in names: 2319. 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: a12.
     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: a12. statement, ‘_’ is a
     *note soft keyword: a11. that denotes a *note wildcard: a13.

     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 特殊メソッド名: e6c. などで話
     題に挙げられています。 Python の将来のバージョンではより多くの名前
     が定義されることになります。このドキュメントで明記されている用法に
     従わない、 'あらゆる' ‘__*__’ の名前は、いかなるコンテキストにおけ
     る利用でも、警告無く損害を引き起こすことがあります。

‘__*’

     クラスプライベート (class-private) な名前です。このカテゴリに属する
     名前は、クラス定義のコンテキスト上で用いられた場合、基底クラスと派
     生クラスの "プライベートな" 属性間で名前衝突が起こるのを防ぐために
     書き直されます。 *note 識別子 (identifier、または名前 (name)):
     2322. を参照してください。


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: 22fc.
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(): 1c67. 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 are 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: 10c. 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: 22fb. and
*note numeric: 22fd. literals.

Other "literals" are lexically denoted using *note keywords: 22e5.
(‘None’, ‘True’, ‘False’) and the special *note ellipsis token: 2326.
(‘...’).


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: 232a.

   * ‘r’: *note Raw string: 232b.

   * ‘f’: *note Formatted string literal: 19b. ("f-string")

   * ‘t’: *note Template string literal: 1860. ("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": 19b. and *note "t-strings":
1860, are described by the following lexical definitions.

These definitions use *note negative lookaheads: 22ea. (‘!’) to indicate
that an ending quote ends the literal.

     STRING:          [*note stringprefix: 232e.] (*note stringcontent: 232f.)
     stringprefix:    <("r" | "u" | "b" | "br" | "rb"), case-insensitive>
     stringcontent:
        | "'''" ( !"'''" *note longstringitem: 2330.)* "'''"
        | '"""' ( !'"""' *note longstringitem: 2330.)* '"""'
        | "'" ( !"'" *note stringitem: 2331.)* "'"
        | '"' ( !'"' *note stringitem: 2331.)* '"'
     stringitem:      *note stringchar: 2332. | *note stringescapeseq: 2333.
     stringchar:      <any *note source_character: 2308, except backslash and newline>
     longstringitem:  *note stringitem: 2331. | newline
     stringescapeseq: "\" <any *note source_character: 2308.>

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: 2335.
                                                       
                                                       
‘\\’                                                   *note Backslash: 2336.
                                                       
                                                       
‘\'’                                                   *note Single quote: 2336.
                                                       
                                                       
‘\"’                                                   *note Double quote: 2336.
                                                       
                                                       
‘\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: 2337.
                                                       
                                                       
‘\xHH’                                                 *note Hexadecimal character: 2338.
                                                       
                                                       
‘\N{NAME}’                                             *note Named Unicode character: 2339.
                                                       
                                                       
‘\uXXXX’                                               *note Hexadecimal Unicode character: 233a.
                                                       
                                                       
‘\UXXXXXXXX’                                           *note Hexadecimal Unicode character: 233a.
                                                       

* 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: 22fb,
or parentheses and *note string literal concatenation: 233c.


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: 232b. 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: 1a4.

バージョン 3.12 で変更: Octal escapes with value larger than ‘0o377’
(255) produce a *note SyntaxWarning: 1af.  In a future Python version
they will raise a *note SyntaxError: 18f.


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: 232a.

バージョン 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: 232a.


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: 1a4.

バージョン 3.12 で変更: Unrecognized escape sequences produce a *note
SyntaxWarning: 1af.  In a future Python version they will raise a *note
SyntaxError: 18f.


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: 193. type instead of the *note str: 16a.
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: 2338. or *note Octal character:
2337.):

     >>> 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: 18e. and *note async for: ca5.
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: 14b9. 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: 2347. for details
on how these fields are evaluated.

As that section explains, 'format specifiers' are passed as the second
argument to the *note format(): 19a. 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: 2348, 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: 19b.  For differences in
evaluation rules, see the *note Standard Library section on t-strings:
234b.


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: 22ee, which
produces the tokens *note FSTRING_START: 234d, *note FSTRING_MIDDLE:
234e. and *note FSTRING_END: 234f, 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: 22e9.

Whitespace is significant in these situations:

   * There may be no whitespace in *note FSTRING_START: 234d. (between
     the prefix and quote).

   * Whitespace in *note FSTRING_MIDDLE: 234e. 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: 22ea.
(‘!’) to indicate special characters (backslash, newline, ‘{’, ‘}’) and
sequences (‘f_quote’).

     fstring:    *note FSTRING_START: 2351. *note fstring_middle: 2352.* *note FSTRING_END: 2353.

     FSTRING_START:      *note fstringprefix: 2354. ("'" | '"' | "'''" | '"""')
     FSTRING_END:        *note f_quote: 2355.
     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: 2357.
        | *note FSTRING_MIDDLE: 2358.
     FSTRING_MIDDLE:
        | (!"\" !*note newline: 2305. !'{' !'}' !*note f_quote: 2355.) *note source_character: 2308.
        | *note stringescapeseq: 2333.
        | "{{"
        | "}}"
        | <newline, in triple-quoted f-strings only>
     fstring_replacement_field:
        | '{' *note f_expression: 2359. [*note f_debug_specifier: 2356.] [*note fstring_conversion: 235a.]
              [*note fstring_full_format_spec: 235b.] '}'
     fstring_conversion:
        | "!" ("s" | "r" | "a")
     fstring_full_format_spec:
        | ':' *note fstring_format_spec: 235c.*
     fstring_format_spec:
        | *note FSTRING_MIDDLE: 2358.
        | *note fstring_replacement_field: 2357.
     f_expression:
        | ','.(*note conditional_expression: 235d. | "*" *note or_expr: 235e.)+ [","]
        | *note yield_expression: 235f.

     注釈: 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: 2316. tokens represent numeric literals, of which there
are three types: integers, floating-point numbers, and imaginary
numbers.

     NUMBER: *note integer: 2363. | *note floatnumber: 2364. | *note imagnumber: 2365.

The numeric value of a numeric literal is the same as if it were passed
as a string to the *note int: 19c, *note float: 197. or *note complex:
198. 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: 2368. | *note bininteger: 2369. | *note octinteger: 236a. | *note hexinteger: 236b. | *note zerointeger: 236c.
     decinteger:   *note nonzerodigit: 236d. (["_"] *note digit: 236e.)*
     bininteger:   "0" ("b" | "B") (["_"] *note bindigit: 236f.)+
     octinteger:   "0" ("o" | "O") (["_"] *note octdigit: 2370.)+
     hexinteger:   "0" ("x" | "X") (["_"] *note hexdigit: 2371.)+
     zerointeger:  "0"+ (["_"] "0")*
     nonzerodigit: "1"..."9"
     digit:        "0"..."9"
     bindigit:     "0" | "1"
     octdigit:     "0"..."7"
     hexdigit:     *note digit: 236e. | "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: 2374.

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: 2375. "." [*note digitpart: 2375.] [*note exponent: 2376.]
        | "." *note digitpart: 2375. [*note exponent: 2376.]
        | *note digitpart: 2375. *note exponent: 2376.
     digitpart: *note digit: 236e. (["_"] *note digit: 236e.)*
     exponent:  ("e" | "E") ["+" | "-"] *note digitpart: 2375.

バージョン 3.6 で変更: グループ化を目的としたリテラル中のアンダースコア
が許されるようになりました。


File: python.info,  Node: 虚数 imaginary リテラル,  Prev: Floating-point literals,  Up: 数値リテラル

4.2.6.3 虚数 (imaginary) リテラル
.................................

Python has *note complex number: 2038. 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: 2367. ‘3’,
the *note operator: 22e8. '‘+’', and the *note imaginary literal: 2377.
‘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: 2364. | *note digitpart: 2375.) ("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: 22e6. token type.  A *note list of these
tokens and their names: 237a. 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:
     2383, 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(): dce. operator and the function call
     operator(s).

     Some of Python's operators, like ‘and’, ‘or’, and ‘not in’, use
     *note keyword: 22e5. tokens rather than "symbols" (operator
     tokens).

A sequence of three consecutive periods (‘...’) has a special meaning as
an *note Ellipsis: 2384. 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: 34a. 演算子は2つのオブジ
ェクトの同一性を比較します。 *note id(): 1641. 関数は同一性を表す整数を
返します。

CPython では、‘id(x)’ は ‘x’ が格納されているメモリ上のアドレスを返しま
す。

オブジェクトの型はオブジェクトがサポートする操作 (例: *note len(): 840.
をサポートするか) と、オブジェクトが取りうる値を決定します。 *note
type(): f48. 関数はオブジェクトの型 (型自体もオブジェクトです) を返しま
す。同一性と同じく、オブジェクトの型('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: 8f9...*note
except: 1ac. 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:
8f9...*note finally: 1b1. statement and the *note with: 187. 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: 19c. 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:
1a3.  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 算術演算の実装: 238e. を参照してください。

バージョン 3.9 で変更: Evaluating *note NotImplemented: 1a3. in a
boolean context was deprecated.

バージョン 3.14 で変更: Evaluating *note NotImplemented: 1a3. in a
boolean context now raises a *note TypeError: 199.  It previously
evaluated to *note True: e0b. and emitted a *note DeprecationWarning:
1a4. 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: 19c.)

     無制限の範囲の数を表現しますが、利用可能な (仮想) メモリサイズの制
     限のみを受けます。シフト演算やマスク演算のために2進数表現を持つと想
     定されます。負の数は符号ビットが左に無限に延びているような錯覚を与
     える 2 の補数表現の変型で表されます。

ブール値 (*note bool: 3c1.)

     真偽値の 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: 1753. 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: 886, 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: 16a.) 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(): 2397. converts a code point from
     its string form to an integer in the range ‘0’ to ‘0x10FFFF’; *note
     chr(): 1a4e. converts an integer in the range ‘0’ to ‘0x10FFFF’ to
     the corresponding length ‘1’ string object.  *note str.encode():
     ad6. can be used to convert a *note str: 16a. to *note bytes: 193.
     using the given text encoding, and *note bytes.decode(): ad7. 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: 193. 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(): 193.
     constructor can be used to create bytes objects.  Also, bytes
     objects can be decoded to strings via the *note decode(): ad7.
     method.


File: python.info,  Node: 変更可能なシーケンス型 mutable sequence,  Prev: 変更不能なシーケンス immutable sequence,  Up: シーケンス型 sequence

4.3.2.10 変更可能なシーケンス型 (mutable sequence)
..................................................

変更可能なシーケンスは、作成した後で変更することができます。変更可能なシ
ーケンスでは、添字表記やスライス表記を使って指定された要素に代入を行うこ
とができ、 *note del: 1b7e. (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(): 342. コンストラクタによって作成されます。変更可能なこ
     とを除けば (つまりハッシュ化できない)、 byte array は変更不能な
     *note bytes: 193. オブジェクトと同じインターフェースと機能を提供し
     ます。


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(): 185. コンストラクタで作成
     され、後から *note add(): 239a. などのいくつかのメソッドで更新でき
     ます。

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: 1b7e. 文の対象にすることができます。組み込み関数 *note len(): 840.
は、マッピング内の要素数を返します。

There is currently a single intrinsic mapping type:

* 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 辞書表示: f83.).

拡張モジュール *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): f81. 参照) を行うことができる型
です:

* 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
関数定義: 2074. 参照)。関数は、仮引数 (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: 184. that holds
                                                       the function's builtins namespace.
                                                       
                                                       Added in version 3.10.
                                                       
                                                       
 -- の属性: function.__globals__                       A reference to the *note dictionary: 184. that holds
                                                       the function's *note global variables: 23a2. - 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: 23a3. 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: 1276.
                                                       
                                                       
 -- の属性: function.__qualname__                      The function's *note qualified name: 1d82.  See
                                                       also: *note __qualname__ attributes: 1275.
                                                       
                                                       Added in version 3.3.
                                                       
                                                       
 -- の属性: function.__module__                        関数が定義されているモジュールの名前です。モジュール
                                                       名がない場合は ‘None’ になります。
                                                       
                                                       
 -- の属性: function.__defaults__                      A *note tuple: 614. containing default
                                                       *note parameter: 23a7. 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: 184. containing annotations of
                                                       *note parameters: 23a7.  The keys of the dictionary
                                                       are the parameter names, and ‘'return'’ for the
                                                       return annotation, if provided.  See also:
                                                       *note object.__annotations__: 456.
                                                       
                                                       バージョン 3.14 で変更: Annotations are now
                                                       *note lazily evaluated: 685.  See PEP 649(1).
                                                       
                                                       
 -- の属性: function.__annotate__                      The *note annotate function: 15e. for this function,
                                                       or ‘None’ if the function has no annotations.  See
                                                       *note object.__annotate__: 19e3.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: function.__kwdefaults__                    A *note dictionary: 184. containing defaults for
                                                       keyword-only *note parameters: 23a7.
                                                       
                                                       
 -- の属性: 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: 23aa. 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: 23ac.
                                                       
                                                       
 -- の属性: method.__func__                            Refers to the original *note function object: 59c.
                                                       
                                                       
 -- の属性: method.__doc__                             The method's documentation (same as
                                                       *note method.__func__.__doc__: 13f5.).  A
                                                       *note string: 16a. if the original function had a
                                                       docstring, else ‘None’.
                                                       
                                                       
 -- の属性: method.__name__                            The name of the method (same as
                                                       *note method.__func__.__name__: 14f0.)
                                                       
                                                       
 -- の属性: 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__: 15e6. attribute is the instance, and the
method object is said to be 'bound'.  The new method's *note __func__:
1518. 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__:
15e6. attribute is the class itself, and its *note __func__: 1518.
attribute is the function object underlying the class method.

When an instance method object is called, the underlying function (*note
__func__: 1518.) is called, inserting the class instance (*note
__self__: 15e6.) 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__: 15e6. 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: bc6. 文 (*note yield 文: bc6. の節を参照) を使う関数もしく
はメソッドは 'ジェネレータ関数' と呼ばれます。 そのような関数が呼び出さ
れたときは常に、関数の本体を実行するのに使える *note イテレータ: 4c8. オ
ブジェクトを返します: イテレータの *note iterator.__next__(): 14e9. メソ
ッドを呼び出すと、 ‘yield’ 文を使って値が提供されるまで関数を実行します
。 関数の *note return: 1b0. 文を実行するか終端に達したときは、 *note
StopIteration: df9. 例外が送出され、イテレータが返すべき値の最後まで到達
しています。


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: 186. や *note async for: ca5. 文だけでなく *note await: 18e.
式を持つことが出来ます。 *note コルーチンオブジェクト: 23b2. を参照して
ください。


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: bc6. 文を使用して
いる関数やメソッドを 'asynchronous generator function' と呼びます。 その
ような関数は、呼び出されたとき、*note 非同期イテレータ: 4c7. オブジェク
トを返します。 このオブジェクトは *note async for: ca5. 文で関数の本体を
実行するのに使えます。

非同期イテレータの *note aiterator.__anext__: 18e6. メソッドを呼び出すと
、他の処理が待たされているときに、 *note yield: bc6. 式を使い値を提供す
るところまで処理を進める *note awaitable: 4c9. を返します。 その関数が空
の *note return: 1b0. 文を実行する、もしくは処理の終わりに到達したときは
、 *note StopAsyncIteration: 1e6c. 例外が送出され、非同期イテレータは出
力すべき値の最後に到達したことになります。


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(): 16dc.
(*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__: 13f5.

   * ‘__name__’ is the function's name.  See *note function.__name__:
     14f0.

   * ‘__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__: 23a6.


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: 15e6.)


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__():
8c0. 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: 23bc. 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__(): ad5.  A
module object has a namespace implemented by a *note dictionary: 184.
object (this is the dictionary referenced by the *note __globals__:
14ef. 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: 23bc.  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: 23bf, before the *note loader: 1a8a.
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(): 1017, which
will set the various import-controlled attributes to appropriate values.
It's also possible to use the *note types.ModuleType: 1018. 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__: 15a7, it is 'strongly'
     recommended that you rely on *note __spec__: 23c0. 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: 23c1.

 -- の属性: module.__spec__

     A record of the module's import-system-related state.

     Set to the *note module spec: 22c8. that was used when importing
     the module.  See *note Module specs: 23c2. for more details.

     Added in version 3.4.

 -- の属性: module.__package__

     The *note package: 235. 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__: 15a7. if the
     module itself is a package).  See PEP 366(1) for further details.

     This attribute is used instead of *note __name__: 15a7. to
     calculate explicit relative imports for main modules.  It defaults
     to ‘None’ for modules created dynamically using the *note
     types.ModuleType: 1018. constructor; use *note
     importlib.util.module_from_spec(): 1017. instead to ensure the
     attribute is set to a *note str: 16a.

     It is 'strongly' recommended that you use *note
     module.__spec__.parent: 326. instead of ‘module.__package__’.
     *note __package__: 325. 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: 1018.
     constructor.  Previously the attribute was optional.

     バージョン 3.6 で変更: The value of ‘__package__’ is expected to be
     the same as *note __spec__.parent: 326.  *note __package__: 325. 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: 326.

     バージョン 3.12 で変更: Raise *note DeprecationWarning: 1a4.
     instead of *note ImportWarning: 71e. when falling back to
     ‘__package__’ during import resolution.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: ‘__package__’
     will cease to be set or taken into consideration by the import
     system or standard library.

 -- の属性: module.__loader__

     The *note loader: 1a8a. 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: 1018. constructor; use *note
     importlib.util.module_from_spec(): 1017. instead to ensure the
     attribute is set to a *note loader: 1a8a. object.

     It is 'strongly' recommended that you use *note
     module.__spec__.loader: 33a. instead of ‘module.__loader__’.

     バージョン 3.4 で変更: This attribute now defaults to ‘None’ for
     modules created dynamically using the *note types.ModuleType: 1018.
     constructor.  Previously the attribute was optional.

     バージョン 3.12 で非推奨、バージョン 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: 23c3. for more details.

     It is 'strongly' recommended that you use *note
     module.__spec__.submodule_search_locations: 23c4. 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: 16a.
     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: 23bc. 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: 1a8a. is what makes use of the module spec provided by the
     *note finder: 23c6. (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: 324. instead of ‘module.__cached__’.

     バージョン 3.13 で非推奨、バージョン 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: b25.

 -- の属性: module.__annotations__

     A dictionary containing *note variable annotations: f55. 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: 15e. for this module, or ‘None’ if the
     module has no annotations.  See also: *note __annotate__: 19e3.
     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 クラス定義: 14f3.).  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: 16c8.

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__: 15e6. attribute is ‘C’.  When it would yield a
*note staticmethod: 451. object, it is transformed into the object
wrapped by the static method object.  See section *note デスクリプタ
(descriptor) の実装: e4d. 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: 1276.
                                                       
                                                       
 -- の属性: type.__qualname__                          The class's *note qualified name: 1d82.  See also:
                                                       *note __qualname__ attributes: 1275.
                                                       
                                                       
 -- の属性: 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: 23d1. 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: f55. collected during
                                                       class body execution.  See also:
                                                       *note __annotations__ attributes: 456.
                                                       
                                                       For best practices on working with
                                                       *note __annotations__: 456, please see
                                                       *note annotationlib: 6.  Use
                                                       *note annotationlib.get_annotations(): 457. 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: 15e. for this class, or
                                                       ‘None’ if the class has no annotations.  See also:
                                                       *note __annotate__ attributes: 19e3.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: type.__type_params__                       A *note tuple: 614. containing the
                                                       *note type parameters: 5ad. of a
                                                       *note generic class: 23d3.
                                                       
                                                       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__: 23d4.

 -- メソッド: 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__: 15e6.
attribute is the instance.  Static method and class method objects are
also transformed; see above under "Classes".  See section *note
デスクリプタ (descriptor) の実装: e4d. 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__(): 23d8. や *note
__delattr__(): 23d9. メソッドが定義されている場合、直接インスタンスの辞
書を更新する代わりにこれらのメソッドが呼び出されます。

クラスインスタンスは、ある特定の名前のメソッドを持っている場合、数値型や
シーケンス型、あるいはマップ型のように振舞うことができます。 *note
特殊メソッド名: e6c. を参照してください。

* 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__: 23db. 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: 13df. は開かれたファイルを表します。ファイルオブジェ
クトを作るための様々なショートカットがあります: *note open(): 318. 組み
込み関数、 *note os.popen(): 31c. 、 *note os.fdopen(): 23dd. 、ソケット
オブジェクトの *note makefile(): 13bb. メソッド (あるいは拡張モジュール
から提供される他の関数やメソッド) 。

File objects implement common methods, listed below, to simplify usage
in generic code.  They are expected to be *note
with文とコンテキストマネージャ: 23de.

オブジェクト ‘sys.stdin’ 、 ‘sys.stdout’ および ‘sys.stderr’ は、インタ
プリタの標準入力、標準出力、および標準エラー出力ストリームに対応するファ
イルオブジェクトに初期化されます。これらはすべてテキストモードで開かれ、
*note io.TextIOBase: 8a5. 抽象クラスによって定義されたインターフェースに
従います。

 -- メソッド: file.read (size=-1, /)

     Retrieve up to 'size' data from the file.  As a convenience if
     'size' is unspecified or -1 retrieve all data available.

 -- メソッド: file.write (data, /)

     Store 'data' to the file.

 -- メソッド: file.close ()

     Flush any buffers and close the underlying file.


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: 23a7. (including positional-only
                                                       parameters and parameters with default values) that
                                                       the function has
                                                       
                                                       
 -- の属性: codeobject.co_posonlyargcount              The number of positional-only
                                                       *note parameters: 23a7. (including arguments with
                                                       default values) that the function has
                                                       
                                                       
 -- の属性: codeobject.co_kwonlyargcount               The number of keyword-only *note parameters: 23a7.
                                                       (including arguments with default values) that the
                                                       function has
                                                       
                                                       
 -- の属性: codeobject.co_nlocals                      The number of *note local variables: 23a2. 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: 23a2. that are referenced
                                                       from at least one *note nested scope: 23ed. inside
                                                       the function
                                                       
                                                       
 -- の属性: codeobject.co_freevars                     A *note tuple: 614. containing the names of
                                                       *note free (closure) variables: 18f6. that a
                                                       *note nested scope: 23ed. references in an outer
                                                       scope.  See also *note function.__closure__: 14ec.
                                                       
                                                       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: 19c. encoding a number of flags
                                                       for the interpreter.
                                                       

The following flag bits are defined for *note co_flags: 193d.: 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: 23f2. 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: 193d. to indicate whether a
code object was compiled with a particular feature enabled.  See *note
compiler_flag: 23f3.

Other bits in *note co_flags: 193d. are reserved for internal use.

If a code object represents a function and has a docstring, the *note
CO_HAS_DOCSTRING: 23f4. bit is set in *note co_flags: 193d. and the
first item in *note co_consts: 18fe. 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: 170. ‘no_debug_ranges’.

        - Loading a pyc file compiled while using *note -X: 170.
          ‘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: 886.

     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: 170.
          ‘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: 19c.) represents the offset (inclusive)
          of the start of the *note bytecode: 4aa. range

        * ‘end’ (an *note int: 19c.) represents the offset (exclusive)
          of the end of the *note bytecode: 4aa. range

        * ‘lineno’ is an *note int: 19c. 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(): 1c2.

     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: cf0, 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: 1ccb. ‘object.__getattr__’
                                                       with arguments ‘obj’ and ‘"f_code"’.
                                                       
                                                       
 -- の属性: frame.f_locals                             The mapping used by the frame to look up
                                                       *note local variables: 23a2.  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: 23a2.
                                                       
                                                       
 -- の属性: frame.f_builtins                           The dictionary used by the frame to look up
                                                       *note built-in (intrinsic) names: 23a2.
                                                       
                                                       
 -- の属性: 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: 1270. 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: dda.).
                                                       
                                                       
 -- の属性: frame.f_trace_lines                        Set this attribute to *note False: d2f. to disable
                                                       triggering a tracing event for each source line.
                                                       
                                                       
 -- の属性: frame.f_trace_opcodes                      Set this attribute to *note True: e0b. 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: 23a2.
     held by the frame.  Also, if the frame belonged to a *note
     generator: 1270, the generator is finalized.  This helps break
     reference cycles involving frame objects (for example when catching
     an *note exception: 1c84. and storing its *note traceback: cf0. for
     later use).

     *note RuntimeError: 246. 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: 246. (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: 20ce.
A traceback object is implicitly created when an exception occurs, and
may also be explicitly created by calling *note types.TracebackType:
cee.

バージョン 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 文: 8f9.)  It is accessible as the third item of
the tuple returned by *note sys.exc_info(): 89b, and as the *note
__traceback__: 14e2. 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: cef. attributes should be
linked to form a full stack trace.

Special read-only attributes:

 -- の属性: traceback.tb_frame                         Points to the execution *note frame: 8f0. of the
                                                       current level.
                                                       
                                                       Accessing this attribute raises an
                                                       *note auditing event: 1ccb. ‘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: 8f0. if the exception
occurred in a *note try: 8f9. statement with no matching except clause
or with a *note finally: 1b1. 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: 2405. は下限です; *note stop: 2406.
は上限です; *note step: 2407. はステップの値です; それぞれ省略された場合
は ‘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(): 451. で生成されます。


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":
2102.  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: 199.) が送出されます。

特殊メソッドに ‘None’ を設定することは、それに対応する演算が利用できない
ことを意味します。 例えば、クラスの *note __iter__(): e6d. を ‘None’ に
設定した場合、そのクラスはイテラブルにはならず、そのインスタンスに対し
*note iter(): 9db. を呼び出すと (*note __getitem__(): 588. に処理が戻さ
れずに) *note TypeError: 199. を送出します。 (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:
240b. interface in the W3C's Document Object Model.)

* Menu:

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

   ---------- Footnotes ----------

   (1) The *note __hash__(): cf7, *note __iter__(): e6d, *note
__reversed__(): e8a, *note __contains__(): 15d7, *note
__class_getitem__(): 947. and *note __fspath__(): e50. methods have
special handling for this.  Others will still raise a *note TypeError:
199, 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. は静的メソッドで (このメソッドは特別扱いされている
     ので、明示的に静的メソッドと宣言する必要はありません)、インスタンス
     を生成するよう要求されているクラスを第一引数にとります。残りの引数
     はオブジェクトのコンストラクタの式 (クラスの呼び出し文) に渡されま
     す。 ‘__new__()’ の戻り値は新しいオブジェクトのインスタンス (通常は
     'cls' のインスタンス) でなければなりません。

     典型的な実装では、クラスの新たなインスタンスを生成するときには
     ‘super().__new__(cls[, ...])’ に適切な引数を指定してスーパクラスの
     *note __new__(): 7a0. メソッドを呼び出し、新たに生成されたインスタ
     ンスに必要な変更を加えてから返します。

     もし *note __new__(): 7a0. が オブジェクトの作成中に呼び出され、
     'cls' のインスタンスを返した場合には、 ‘__init__(self[, ...])’ のよ
     うにして新しいインスタンスの *note __init__(): 8c0. が呼び出されま
     す。このとき、 'self' は新たに生成されたインスタンスで、残りの引数
     はオブジェクトコンストラクタに渡された引数と同じになります。

     *note __new__(): 7a0. が 'cls' のインスタンスを返さない場合、インス
     タンスの *note __init__(): 8c0. メソッドは呼び出されません。

     *note __new__(): 7a0. の主な目的は、変更不能な型 (int, str, tuple な
     ど) のサブクラスでインスタンス生成をカスタマイズすることにあります
     。また、クラス生成をカスタマイズするために、カスタムのメタクラスで
     よくオーバーライドされます。

 -- メソッド: object.__init__ (self[, ...])

     インスタンスが (*note __new__(): 7a0. によって) 生成された後、それ
     が呼び出し元に返される前に呼び出されます。引数はクラスのコンストラ
     クタ式に渡したものです。基底クラスとその派生クラスがともに *note
     __init__(): 8c0. メソッドを持つ場合、派生クラスの ‘__init__()’ メソ
     ッドは基底クラスの ‘__init__()’ メソッドを明示的に呼び出して、イン
     スタンスの基底クラス部分が適切に初期化されること保証しなければなり
     ません。例えば、 ‘super().__init__([args...])’ 。

     *note __new__(): 7a0. と *note __init__(): 8c0. は連携してオブジェ
     クトを構成する (‘__new__()’ が作成し、 ‘__init__()’ がそれをカスタ
     マイズする) ので、 ‘__init__()’ から非 ‘None’ 値を返してはいけませ
     ん; そうしてしまうと、実行時に *note TypeError: 199. が送出されてし
     まいます。

 -- メソッド: object.__del__ (self)

     インスタンスが破棄されるときに呼び出されます。 これはファイナライザ
     や (適切ではありませんが) デストラクタとも呼ばれます。 基底クラスが
     *note __del__(): 1203. メソッドを持っている場合は、派生クラスの
     ‘__del__()’ メソッドは何であれ、基底クラスの ‘__del__()’ メソッドを
     明示的に呼び出して、インスタンスの基底クラス部分をきちんと確実に削
     除しなければなりません。

     *note __del__(): 1203. メソッドが破棄しようとしているインスタンスへ
     の新しい参照を作り、破棄を送らせることは (推奨されないものの) 可能
     です。 これはオブジェクトの '復活' と呼ばれます。 復活したオブジェ
     クトが再度破棄される直前に ‘__del__()’ が呼び出されるかどうかは実装
     依存です; 現在の *note CPython: 906. の実装では最初の一回しか呼び出
     されません。

     It is not guaranteed that ‘__del__()’ methods are called for
     objects that still exist when the interpreter exits.  *note
     weakref.finalize: c73. 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: 1842.  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__(): 1203. は不安定な状況で呼び出さ
          れるため、実行中に発生した例外は無視され、代わりに
          ‘sys.stderr’ に警告が表示されます。特に:

             * *note __del__(): 1203. は、任意のコードが実行されていると
               きに、任意のスレッドから呼び出せます。 ‘__del__()’ で、ロ
               ックを取ったり、ブロックするリソースを呼び出したりする必
               要がある場合、 ‘__del__()’ の実行により中断されたコードに
               より、そのリソースが既に取得されていて、デッドロックが起
               きるかもしれません。

             * *note __del__(): 1203. は、インタプリタのシャットダウン中
               に実行できます。 従って、(他のモジュールも含めた) アクセ
               スする必要があるグローバル変数はすでに削除されているか、
               ‘None’ に設定されているかもしれません。 Python は、単一の
               アンダースコアで始まる名前のグローバルオブジェクトは、他
               のグローバル変数が削除される前にモジュールから削除される
               ことを保証します; そのようなグローバル変数への他からの参
               照が存在しない場合、‘__del__()’ メソッドが呼ばれた時点で
               、インポートされたモジュールがまだ利用可能であることを保
               証するのに役立つかもしれません。

 -- メソッド: object.__repr__ (self)

     *note repr(): 1c3. 組み込み関数によって呼び出され、オブジェクトを表
     す「公式の (official)」文字列を計算します。可能なら、これは (適切な
     環境が与えられれば) 同じ値のオブジェクトを再生成するのに使える、有
     効な Python 式のようなものであるべきです。できないなら、 ‘<...some
     useful description...>’ 形式の文字列が返されるべきです。戻り値は文
     字列オブジェクトでなければなりません。クラスが *note __repr__():
     82f. を定義していて *note __str__(): 830. は定義していなければ、そ
     のクラスのインスタンスの「非公式の (informal)」文字列表現が要求され
     たときにも ‘__repr__()’ が使われます。

     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: c82. class itself.

 -- メソッド: object.__str__ (self)

     Called by *note str(object): 16a, the default *note __format__():
     831. implementation, and the built-in function *note print(): 117b,
     to compute the "informal" or nicely printable string representation
     of an object.  The return value must be a *note str: 203c. object.

     *note __str__(): 830. が有効な Python 表現を返すことが期待されない
     という点で、このメソッドは *note object.__repr__(): 82f. とは異なり
     ます: より便利な、または簡潔な表現を使用することができます。

     組み込み型 *note object: c82. によって定義されたデフォルト実装は、
     *note object.__repr__(): 82f. を呼び出します。

 -- メソッド: object.__bytes__ (self)

     Called by *note bytes: 1ef6. to compute a byte-string
     representation of an object.  This should return a *note bytes:
     193. object.  The *note object: c82. class itself does not provide
     this method.

 -- メソッド: object.__format__ (self, format_spec)

     *note format(): 19a. 組み込み関数、さらには *note
     フォーマット済み文字列リテラル: 19b. の評価、 *note str.format():
     833. メソッドによって呼び出され、オブジェクトの "フォーマット化され
     た (formatted)" 文字列表現を作ります。 'format_spec' 引数は、 必要
     なフォーマット化オプションの記述を含む文字列です。 'format_spec' 引
     数の解釈は、 *note __format__(): 831. を実装する型によりますが、 ほ
     とんどのクラスは組み込み型のいずれかにフォーマット化を委譲したり、
     同じようなフォーマット化オプション構文を使います。

     標準のフォーマット構文の解説は、 *note Format specification
     mini-language: 4f9. を参照してください。

     戻り値は文字列オブジェクトでなければなりません。

     The default implementation by the *note object: c82. class should
     be given an empty 'format_spec' string.  It delegates to *note
     __str__(): 830.

     バージョン 3.4 で変更: 空でない文字列が渡された場合 ‘object’ 自身の
     __format__ メソッドは *note TypeError: 199. を送出します。

     バージョン 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: 1a3. 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(): 3c1. on the value to determine if
     the result is true or false.

     By default, ‘object’ implements ‘__eq__()’ by using ‘is’, returning
     *note NotImplemented: 1a3. in the case of a false comparison: ‘True
     if x is y else NotImplemented’.  For ‘__ne__()’, by default it
     delegates to ‘__eq__()’ 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(): 1148.

     By default, the *note object: c82. class provides implementations
     consistent with *note 値の比較: 1c7d.: equality compares according
     to object identity, and order comparisons raise *note TypeError:
     199.  Each default method may generate these results directly, but
     may also return *note NotImplemented: 1a3.

     カスタムの比較演算をサポートしていて、辞書のキーに使うことができる
     *note ハッシュ可能: 824. オブジェクトを作るときの重要な注意点につい
     て、 *note __hash__(): cf7. のドキュメント内に書かれているので参照
     してください。

     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, ‘__lt__()’ and ‘__gt__()’ are each other's
     reflection, ‘__le__()’ and ‘__ge__()’ are each other's reflection,
     and ‘__eq__()’ and ‘__ne__()’ 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: 1a3, the ‘==’ and ‘!=’ operators will fall back to
     ‘is’ and ‘is not’, respectively.

 -- メソッド: object.__hash__ (self)

     Called by built-in function *note hash(): 801. and for operations
     on members of hashed collections including *note set: 185, *note
     frozenset: 7f2, and *note dict: 184.  The ‘__hash__()’ method
     should return an integer.  The only required property is that
     objects which compare equal have the same hash value; it is advised
     to mix together the hash values of the components of the object
     that also play a part in comparison of objects by packing them into
     a tuple and hashing the tuple.  Example:

          def __hash__(self):
              return hash((self.name, self.nick, self.color))

          注釈: *note hash(): 801. はオブジェクト独自の *note
          __hash__(): cf7. メソッドが返す値を *note Py_ssize_t: c59. の
          サイズに切り詰めます。 これは 64-bit でビルドされていると 8 バ
          イトで、 32-bit でビルドされていると 4 バイトです。 オブジェク
          トの ‘__hash__()’ が異なる bit サイズのビルドでも可搬性が必要
          である場合は、必ず全てのサポートするビルドの bit 幅をチェック
          してください。 そうする簡単な方法は ‘python -c "import sys;
          print(sys.hash_info.width)"’ を実行することです。

     クラスが *note __eq__(): cf6. メソッドを定義していないなら、 *note
     __hash__(): cf7. メソッドも定義してはなりません; クラスが
     ‘__eq__()’ を定義していても ‘__hash__()’ を定義していないなら、その
     インスタンスはハッシュ可能コレクションの要素として使えません。クラ
     スがミュータブルなオブジェクトを定義しており、 ‘__eq__()’ メソッド
     を実装しているなら、 ‘__hash__()’ を定義してはなりません。これは、
     *note ハッシュ可能: 824. コレクションの実装においてキーのハッシュ値
     がイミュータブルであることが要求されているからです (オブジェクトの
     ハッシュ値が変化すると、誤ったハッシュバケツ: hash bucket に入って
     しまいます)。

     User-defined classes have *note __eq__(): cf6. and ‘__hash__()’
     methods by default (inherited from the *note object: c82. 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__(): cf6. をオーバーライドしていて *note __hash__():
     cf7. を定義していないクラスでは、 ‘__hash__()’ は暗黙的に ‘None’ に
     設定されます。 クラスの ‘__hash__()’ メソッドが ‘None’ の場合、その
     クラスのインスタンスのハッシュ値を取得しようとすると適切な *note
     TypeError: 199. が送出され、 ‘isinstance(obj,
     collections.abc.Hashable)’ でチェックするとハッシュ不能なものとして
     正しく認識されます。

     *note __eq__(): cf6. をオーバーライドしたクラスが親クラスからの
     *note __hash__(): cf7. の 実装を保持したいなら、明示的に ‘__hash__
     = <ParentClass>.__hash__’ を設定することで、それをインタプリタに伝
     えなければなりません。

     *note __eq__(): cf6. をオーバーライドしていないクラスがハッシュサポ
     ートを抑制したい場合、クラス定義に ‘__hash__ = None’ を含めてくださ
     い。クラス自身で明示的に *note TypeError: 199. を送出する *note
     __hash__(): cf7. を定義すると、 ‘isinstance(obj,
     collections.abc.Hashable)’ 呼び出しで誤ってハッシュ可能と識別される
     でしょう。

          注釈: デフォルトでは、文字列とバイト列の *note __hash__():
          cf7. 値は予測不可能なランダム値で "ソルト" されます。 ハッシュ
          値は単独の 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
          ‘https://ocert.org/advisories/ocert-2011-003.html’ for
          details.

          ハッシュ値の変更は、集合のイテレーション順序に影響します。
          Python はこの順序付けを保証していません (そして通常 32-bit と
          64-bit の間でも異なります)。

          *note PYTHONHASHSEED: 128d. も参照してください。

     バージョン 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__(): 17ff. 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: c82. 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__(): dcf. raises
     an ‘AttributeError’ because 'name' is not an instance attribute or
     an attribute in the class tree for ‘self’; or *note __get__():
     1706. of a 'name' property raises ‘AttributeError’).  This method
     should either return the (computed) attribute value or raise an
     ‘AttributeError’ exception.  The *note object: c82. class itself
     does not provide this method.

     Note that if the attribute is found through the normal mechanism,
     ‘__getattr__()’ is not called.  (This is an intentional asymmetry
     between ‘__getattr__()’ and *note __setattr__(): 23d8.)  This is
     done both for efficiency reasons and because otherwise
     ‘__getattr__()’ 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__(): dcf. method below for a way to actually
     get total control over attribute access.

 -- メソッド: object.__getattribute__ (self, name)

     クラスのインスタンスに対する属性アクセスを実装するために、無条件に
     呼び出されます。クラスが *note __getattr__(): 6fa. も定義している場
     合、 ‘__getattr__()’ は、 *note __getattribute__(): dcf. で明示的に
     呼び出すか、 *note AttributeError: 5f0. 例外を送出しない限り呼ばれ
     ません。このメソッドは (計算された) 属性値を返すか、
     ‘AttributeError’ 例外を送出します。このメソッドが再帰的に際限なく呼
     び出されてしまうのを防ぐため、実装の際には常に、必要な属性全てへの
     アクセスで、例えば ‘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: 23aa.  See *note
          特殊メソッド検索: 2411.

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性アクセスは *note 監査イベント:
     1ccb. を送出します。

 -- メソッド: object.__setattr__ (self, name, value)

     属性の代入が試みられた際に呼び出されます。これは通常の代入の過程 (す
     なわち、インスタンス辞書への値の代入) の代わりに呼び出されます。
     'name' は属性名で、'value' はその属性に代入する値です。

     *note __setattr__(): 23d8. の中でインスタンス属性への代入が必要なら
     、基底クラスのこれと同じ名前のメソッドを呼び出さなければなりません
     。例えば、 ‘object.__setattr__(self, name, value)’ とします。

     セキュリティに関わるような ‘obj’ と ‘name’ と ‘value’ を渡しての
     ‘object.__setattr__’ を使った属性のアサインは *note 監査イベント:
     1ccb. を送出します。

 -- メソッド: object.__delattr__ (self, name)

     *note __setattr__(): 23d8. に似ていますが、代入ではなく値の削除を行
     います。このメソッドを実装するのは、オブジェクトにとって ‘del
     obj.name’ が意味がある場合だけにしなければなりません。

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性の削除は *note 監査イベント: 1ccb.
     を送出します。

 -- メソッド: object.__dir__ (self)

     Called when *note dir(): 844. is called on the object.  An iterable
     must be returned.  ‘dir()’ 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__(): dcf. で見付からなかった場合は、
‘AttributeError’ を送出する前に、モジュールの ‘__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: 1018. のサブクラスが設定できます。 例えば次のようにな
ります:

     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: c82. 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__(): 1706. は1つや2つの引数を持つ呼び出し
     可能オブジェクトであると定義しています。Pythonの組み込みのデスクリ
     プタはこの仕様をサポートしていますが、サードパーティ製のツールの中
     には両方の引数を必要とするものもあります。Pythonの *note
     __getattribute__(): dcf. 実装は必要かどうかに関わらず、両方の引数を
     常に渡します。

 -- メソッド: object.__set__ (self, instance, value)

     オーナークラスのインスタンス 'instance' 上の属性を新たな値 'value'
     に設定する際に呼び出されます。

     *note __set__(): 2415. あるいは *note __delete__(): 19af. を追加す
     ると、デスクリプタは「データデスクリプタ」に変わります。詳細は
     *note デスクリプタの呼び出し: 2416. を参照してください。

 -- メソッド: 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__(): 1706, *note
__set__(): 2415, および *note __delete__(): 19af. を使って、属性アクセス
をオーバーライドしているものです。これらのメソッドのいずれかがオブジェク
トに対して定義されている場合、オブジェクトはデスクリプタであるといいます
。

属性アクセスのデフォルトの動作は、オブジェクトの辞書から値を取り出したり
、値を設定したり、削除したりするというものです。例えば、 ‘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__(): 1706, *note __set__(): 2415. and *note
__delete__(): 19af.  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: 451.
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:
     11b.) はサポートされません。弱参照のサポートが必要なら、
     '__slots__' を宣言する際に ‘'__weakref__'’ を変数名のシーケンスに追
     加してください。

   * '__slots__' は、クラスのレベルで各変数に対する *note デスクリプタ:
     e4d. を使って実装されます。その結果、 '__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: 199. will be raised if nonempty '__slots__' are
     defined for a class derived from a *note "variable-length" built-in
     type: 241b. such as *note int: 19c, *note bytes: 193, and *note
     tuple: 614.

   * Any non-string *note iterable: 12f5. may be assigned to
     '__slots__'.

   * If a *note dictionary: 184. 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(): bf1. and displayed in
     the output of *note help(): ad8.

   * *note __class__: 16cb. assignment works only if both classes have
     the same '__slots__'.

   * *note Multiple inheritance: 20fd. with multiple slotted parent
     classes can be used, but only one parent is allowed to have
     attributes created by slots (the other bases must have empty slot
     layouts) - violations raise *note TypeError: 199.

   * もし '__slots__' に対して *note イテレータ: 4c8. を使用すると、イテ
     レータの値ごとに *note デスクリプタ: 18e5. が作られます。しかし、
     '__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__(): e4c. 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,
     ‘__set_name__()’ will not be called automatically.  If needed,
     ‘__set_name__()’ 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 クラスオブジェクトの作成: e48. を参照してください。

     Added in version 3.6.

* Menu:

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


File: python.info,  Node: メタクラス,  Next: MRO エントリの解決,  Up: クラス生成をカスタマイズする

4.3.3.8 メタクラス
..................

デフォルトでは、クラスは *note type(): f48. を使って構築されます。 クラ
ス本体は新しい名前空間で実行され、クラス名が ‘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: f48, 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(): d99.

     Dynamically resolve bases that are not instances of *note type:
     f48.

*note types.get_original_bases(): 6f5.

     Retrieve a class's "original bases" prior to modifications by *note
     __mro_entries__(): ce7.

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():
     f48. が使われます;

   * 明示的なメタクラスが与えられていて、それが *note type(): f48. のイ
     ンスタンス 'ではない' 場合、それをメタクラスとして直接使います;

   * 明示的なメタクラスとして *note type(): f48. のインスタンスが与えら
     れたか、基底が定義されていた場合は、最も派生した (継承関係で最も下
     の) メタクラスが使われます。

最も派生的なメタクラスは、(もしあれば) 明示的に指定されたメタクラスと、
指定されたすべてのベースクラスのメタクラスから選ばれます。最も派生的なメ
タクラスは、これらのメタクラス候補のすべてのサブタイプであるようなもので
す。メタクラス候補のどれもその基準を満たさなければ、クラス定義は
‘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(): 1a7. の無引数形式によって参照
されるものです。 ‘__class__’ は、クラス本体中のメソッドが ‘__class__’ ま
たは ‘super’ のいずれかを参照している場合に、コンパイラによって作成され
る暗黙のクロージャー参照です。これは、メソッドに渡された最初の引数に基づ
いて現在の呼び出しを行うために使用されるクラスまたはインスタンスが識別さ
れる一方、 ‘super()’ の無引数形式がレキシカルスコープに基づいて定義され
ているクラスを正確に識別することを可能にします。

CPython 3.6 以降では、 ‘__class__’ セルは、クラス名前空間にある
‘__classcell__’ エントリーとしてメタクラスに渡されます。 ‘__class__’ セ
ルが存在していた場合は、そのクラスが正しく初期化されるために、
‘type.__new__’ の呼び出しに到達するまで上に伝搬されます。 失敗した場合は
、Python 3.8 では *note RuntimeError: 246. になります。

デフォルトのメタクラス *note type: f48. や最終的には ‘type.__new__’ を呼
び出すメタクラスを使っているときは、クラスオブジェクトを作成した後に次の
カスタム化の手順が起動されます:

  1. ‘type.__new__’ メソッドが *note __set_name__(): e4c. が定義されてい
     るクラスの名前空間にある全ての属性を収集します;

  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__: e5b. 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(): 2af. と *note
issubclass(): 9c8. のデフォルトの動作を上書きするのに利用します。

特に、 *note abc.ABCMeta: 1120. メタクラスは、抽象基底クラス (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(): 2af.
     and *note issubclass(): 9c8. behavior through *note
     __instancecheck__(): 2426. and *note __subclasscheck__(): 2427,
     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: 15d, it is often useful to
'parameterize' a *note generic type: 1a2. using Python's square-brackets
notation.  For example, the annotation ‘list[int]’ might be used to
signify a *note list: 24f. in which all the elements are of type *note
int: 19c.

参考
....

PEP 484(1) - 型ヒント

     Introducing Python's framework for type annotations

*note Generic Alias Types: 8c2.

     Documentation for objects representing parameterized generic
     classes

*note ジェネリクス: 2429, *note user-defined generics: 6f6. and *note typing.Generic: 1823.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

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__(): 947. is to allow runtime
parameterization of standard-library generic classes in order to more
easily apply *note type hints: 242b. 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__(): 947, or inherit from *note typing.Generic: 1823,
which has its own implementation of ‘__class_getitem__()’.

Custom implementations of *note __class_getitem__(): 947. 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: 242e. 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__(): 947. may be
called instead.  ‘__class_getitem__()’ should return a *note
GenericAlias: 8c2. object if it is properly defined.

Presented with the *note expression: 242f. ‘obj[x]’, the Python
interpreter follows something like the following process to decide
whether *note __getitem__(): 588. or *note __class_getitem__(): 947.
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: 2430, and
most classes have the *note type: f48. class as their metaclass.  ‘type’
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__(): 947. 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__(): 947, and outlining when a
     *note subscription: 242e. 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: c82. 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: c82. class itself.
Containers usually are *note sequences: 716. (such as *note lists: 24f.
or *note tuples: 614.) or *note mappings: 13d7. (like *note
dictionaries: 2435.), 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: 184. objects.
The *note collections.abc: 1f. module provides a *note MutableMapping:
12c4. *note abstract base class: 13d2. to help create those methods from
a base set of *note __getitem__(): 588, *note __setitem__(): 14e7, *note
__delitem__(): 14e8, and ‘keys()’.

Mutable sequences should provide methods *note append(): 2436, *note
clear(): 2437, *note count(): 2438, *note extend(): 2439, *note index():
19d9, *note insert(): 243a, *note pop(): 243b, *note remove(): 19da, and
*note reverse(): 243c, like Python standard *note list: 24f. objects.
Finally, sequence types should implement addition (meaning
concatenation) and multiplication (meaning repetition) by defining the
methods *note __add__(): 243d, *note __radd__(): 243e, *note __iadd__():
243f, *note __mul__(): 2440, *note __rmul__(): 2441. and *note
__imul__(): 2442. described below; they should not define other
numerical operators.

It is recommended that both mappings and sequences implement the *note
__contains__(): 15d7. 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__(): e6d. 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__(): 14f1. 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: 13e1.  If the length is larger than
     ‘sys.maxsize’ some features (such as *note len(): 840.) may raise
     *note OverflowError: a85.  To prevent raising ‘OverflowError’ by
     truth value testing, an object must define a *note __bool__():
     14f1. method.

 -- メソッド: object.__length_hint__ (self)

     Called to implement *note operator.length_hint(): 1173.  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: 1a3, 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.

 -- メソッド: object.__getitem__ (self, subscript)

     Called to implement 'subscription', that is, ‘self[subscript]’.
     See *note Subscriptions and slicings: 242e. 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:
          2443.) should be an integer or a *note slice: 694. object.
          See the *note sequence documentation: 2394. for the expected
          behavior, including handling ‘slice’ objects and negative
          indices.

        - 'mappings', where 'subscript' is also called the *note key:
          2444.  See *note mapping documentation: 239b. for the expected
          behavior.

     If 'subscript' is of an inappropriate type, ‘__getitem__()’ should
     raise *note TypeError: 199.  If 'subscript' has an inappropriate
     value, ‘__getitem__()’ should raise an *note LookupError: 2445. or
     one of its subclasses (*note IndexError: 1753. for sequences; *note
     KeyError: 5e7. for mappings).

          注釈: Slicing is handled by ‘__getitem__()’, *note
          __setitem__(): 14e7, and *note __delitem__(): 14e8.  A call
          like

               a[1:2] = b

          次のように翻訳され

               a[slice(1, 2, None)] = b

          and so forth.  Missing slice items are always filled in with
          ‘None’.

          注釈: The sequence iteration protocol (used, for example, in
          *note for: 348. loops), expects that an *note IndexError:
          1753. will be raised for illegal indexes to allow proper
          detection of the end of a sequence.

          注釈: When *note subscripting: 242e. a 'class', the special
          class method *note __class_getitem__(): 947. may be called
          instead of ‘__getitem__()’.  See *note __class_getitem__
          versus __getitem__: 242d. for more details.

 -- メソッド: object.__setitem__ (self, key, value)

     ‘self[key]’ に対する代入を実装するために呼び出されます。 *note
     __getitem__(): 588. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、あるキーに対する値の変更をサポートしているか、新た
     なキーを追加できるようなマップの場合と、ある要素を置き換えることが
     できるシーケンスの場合だけです。不正な 'key' に対しては、
     ‘__getitem__()’ メソッドと同様の例外の送出を行わなければなりません
     。

 -- メソッド: object.__delitem__ (self, key)

     ‘self[key]’ の削除を実装するために呼び出されます。 *note
     __getitem__(): 588. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、キーの削除をサポートしているマップの場合と、要素を
     削除できるシーケンスの場合だけです。不正な 'key' に対しては、
     ‘__getitem__()’ メソッドと同様の例外の送出を行わなければなりません
     。

 -- メソッド: object.__missing__ (self, key)

     ‘self[key]’ の実装において辞書内にキーが存在しなかった場合に、 dict
     のサブクラスのために *note dict: 184.*note __getitem__(): 588. によ
     って呼び出されます。

 -- メソッド: object.__iter__ (self)

     このメソッドは、コンテナに対して *note イテレータ: 4c8. が要求され
     た際に呼び出されます。このメソッドは、コンテナ内の全てのオブジェク
     トに渡って反復処理できるような、新たなイテレータオブジェクトを返さ
     なければなりません。マッピングでは、コンテナ内のキーに渡って反復処
     理しなければなりません。

 -- メソッド: object.__reversed__ (self)

     *note reversed(): a69. 組み込み関数が逆方向イテレーションを実装する
     ために、(存在すれば)呼び出します。コンテナ内の全要素を逆順にイテレ
     ートする、新しいイテレータを返すべきです。

     *note __reversed__(): e8a. メソッドが定義されていない場合、 *note
     reversed(): a69. 組込み関数は sequence プロトコル (*note __len__():
     17ff. と *note __getitem__(): 588.) を使った方法にフォールバックし
     ます。 sequence プロトコルをサポートしたオブジェクトは、
     ‘reversed()’ よりも効率のいい実装を提供できる場合にのみ
     ‘__reversed__()’ を定義するべきです。

帰属テスト演算子 (*note in: 349. および *note not in: 841.) は通常、コン
テナの要素に対する反復処理のように実装されます。しかし、コンテナオブジェ
クトで以下の特殊メソッドを定義して、より効率的な実装を行ったり、オブジェ
クトがイテラブルでなくてもよいようにできます。

 -- メソッド: object.__contains__ (self, item)

     帰属テスト演算を実装するために呼び出されます。 'item' が 'self' 内
     に存在する場合には真を、そうでない場合には偽を返さなければなりませ
     ん。マップオブジェクトの場合、値やキーと値の組ではなく、キーに対す
     る帰属テストを考えなければなりません。

     *note __contains__(): 15d7. を定義しないオブジェクトに対しては、メ
     ンバシップテストはまず、 *note __iter__(): e6d. を使った反復を試み
     ます、次に古いシーケンス反復プロトコル *note __getitem__(): 588. を
     使います、 *note 言語レファレンスのこの節: 2446. を参照して下さい。


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():
     b9d, *note pow(): 1a5, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’).  For
     instance, to evaluate the expression ‘x + y’, where 'x' is an
     instance of a class that has an ‘__add__()’ method,
     ‘type(x).__add__(x, y)’ is called.  The ‘__divmod__()’ method
     should be the equivalent to using ‘__floordiv__()’ and ‘__mod__()’;
     it should not be related to ‘__truediv__()’.  Note that ‘__pow__()’
     should be defined to accept an optional third argument if the
     three-argument version of the built-in ‘pow()’ function is to be
     supported.

     If one of those methods does not support the operation with the
     supplied arguments, it should return *note NotImplemented: 1a3.

 -- メソッド: 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():
     b9d, *note pow(): 1a5, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’) 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 ‘__rsub__()’ method, ‘type(y).__rsub__(y, x)’ is
     called if ‘type(x).__sub__(x, y)’ returns *note NotImplemented:
     1a3. or ‘type(y)’ is a subclass of ‘type(x)’.  (3)

     Note that ‘__rpow__()’ should be defined to accept an optional
     third argument if the three-argument version of the built-in *note
     pow(): 1a5. function is to be supported.

     バージョン 3.14 で変更: Three-argument *note pow(): 1a5. now try
     calling ‘__rpow__()’ 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: 1a3, the augmented assignment falls back to the
     normal methods.  For instance, if 'x' is an instance of a class
     with an ‘__iadd__()’ method, ‘x += y’ is equivalent to ‘x =
     x.__iadd__(y)’ .  If ‘__iadd__()’ 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'] は例外を送出するのですか?: 2462.), 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(): 20e9. および ‘~’) を
     実装します。

 -- メソッド: object.__complex__ (self)
 -- メソッド: object.__int__ (self)
 -- メソッド: object.__float__ (self)

     組み込み関数の *note complex(): 198, *note int(): 19c, *note
     float(): 197. の実装から呼び出されます。 適切な型の値を返さなければ
     なりません。

 -- メソッド: object.__index__ (self)

     呼び出して *note operator.index(): 1d2f. を実装します。 Python が数
     値オブジェクトを整数オブジェクトに損失なく変換する必要がある場合 (た
     とえばスライシングや、組み込みの *note bin(): 14c4. 、 *note hex():
     14eb. 、 *note oct(): 14ea. 関数) は常に呼び出されます。 このメソッ
     ドがあるとその数値オブジェクトが整数型であることが示唆されます。 整
     数を返さなければなりません。

     もし *note __int__(): 19e, *note __float__(): bc5, *note
     __complex__(): 7fd. が定義されていない場合、組み込み関数の *note
     int(): 19c, *note float(): 197, *note complex(): 198. は *note
     __index__(): 19f. にフォールバックします。

 -- メソッド: object.__round__ (self[, ndigits])
 -- メソッド: object.__trunc__ (self)
 -- メソッド: object.__floor__ (self)
 -- メソッド: object.__ceil__ (self)

     組み込み関数の *note round(): 14f6. と *note math: 92. モジュール関
     数の *note trunc(): 15dd, *note floor(): 15db, *note ceil(): 15dc.
     の実装から呼び出されます。 'ndigits' が ‘__round__()’ に渡されない
     限りは、これらの全てのメソッドは *note Integral: 246a. (たいていは
     *note int: 19c.) に切り詰められたオブジェクトの値を返すべきです。

     バージョン 3.14 で変更: *note int(): 19c. no longer delegates to
     the ‘__trunc__()’ method.

   ---------- Footnotes ----------

   (1) "Does not support" here means that the class has no such method,
or the method returns *note NotImplemented: 1a3.  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__(): 243d.) 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: 187. 文の実
行時にランタイムコンテキストを定義するオブジェクトです。コンテキストマネ
ージャは、コードブロックを実行するために必要な入り口および出口の処理を扱
います。コンテキストマネージャは通常、 ‘with’ 文（ *note with 文: 187. の
章を参照）により起動されますが、これらのメソッドを直接呼び出すことで起動
することもできます。

コンテキストマネージャの代表的な使い方としては、様々なグローバル情報の保
存および更新、リソースのロックとアンロック、ファイルのオープンとクローズ
などが挙げられます。

For more information on context managers, see *note
コンテキストマネージャ型: 246c.  The *note object: c82. class itself
does not provide the context manager methods.

 -- メソッド: object.__enter__ (self)

     コンテキストマネージャのの入り口で実行される処理です。 *note with:
     187. 文は、文の ‘as’ 節で規定された値を返すこのメソッドを呼び出しま
     す。

 -- メソッド: object.__exit__ (self, exc_type, exc_value, traceback)

     コンテキストマネージャの出口で実行される処理です。パラメータは、コ
     ンテキストが終了した原因となった例外について説明しています。コンテ
     キストが例外を送出せず終了した場合は、全ての引き数に *note None:
     886. が設定されます。

     もし、例外が送出され、かつメソッドが例外を抑制したい場合（すなわち
     、例外が伝播されるのを防ぎたい場合）、このメソッドは True を返す必
     要があります。そうでなければ、このメソッドの終了後、例外は通常通り
     伝播することになります。

     Note that ‘__exit__()’ methods should not reraise the passed-in
     exception; this is the caller's responsibility.

参考
....

PEP 343(1) - "with" ステートメント

     Python の *note with: 187. 文の仕様、背景、および例が記載されていま
     す。

   ---------- 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: 199. を送出します。

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: 262. 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: 193. and *note
memoryview: 166, 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: 166. 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 ‘memoryview’ object.

     'Thread safety:' In *note free-threaded: 1f6. Python,
     implementations must manage any internal export counter using
     atomic operations.  The method must be safe to call concurrently
     from multiple threads, and the returned buffer's underlying data
     must remain valid until the corresponding *note
     __release_buffer__(): 1ac6. call completes.  See *note Thread
     safety for memoryview objects: 2471. for details.

 -- メソッド: object.__release_buffer__ (self, buffer)

     Called when a buffer is no longer needed.  The 'buffer' argument is
     a *note memoryview: 166. object that was previously returned by
     *note __buffer__(): 68c.  The method must release any resources
     associated with the buffer.  This method should return ‘None’.

     'Thread safety:' In *note free-threaded: 1f6. Python, any export
     counter decrement must use atomic operations.  Resource cleanup
     must be thread-safe, as the final release may race with concurrent
     releases from other threads.

     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: 341.

     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: 15d,
which are a way to associate information (usually *note type hints:
242b.) 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: 15e.  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: 232. 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: 369.  Annotate functions must
     always support *note VALUE: 15f. format; they must not raise *note
     NotImplementedError(): 369. when called with this format.

     When called with *note VALUE: 15f. format, an annotate function may
     raise *note NameError: 450.; it must not raise ‘NameError’ when
     called requesting any other format.

     If an object does not have any annotations, *note __annotate__:
     19e3. 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__(): cf7. と *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__(): dcf. メソ
ッドもバイパスします:

     >>> 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__(): dcf. 機構をバイパスすることで、特殊
メソッドの扱いに関するある程度の自由度と引き換えに (特殊メソッドはインタ
プリタから一貫して実行されるためにクラスオブジェクトに設定 'しなければな
らない')、インタープリタを高速化するための大きな余地が手に入ります。


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__(): f79. メ
ソッドが実装されています。 *note async def: 7ed. 関数が返す *note
Coroutineオブジェクト: 6b9. は待機可能です。

     注釈: *note types.coroutine(): 108c. デコレータでデコレータが付けら
     れたジェネレータから返される *note generator iterator: ddd. オブジ
     ェクトも待機可能ですが、 *note __await__(): f79. は実装されていませ
     ん。

 -- メソッド: object.__await__ (self)

     Must return an *note iterator: 4c8.  Should be used to implement
     *note awaitable: 4c9. objects.  For instance, *note asyncio.Future:
     dca. implements this method to be compatible with the *note await:
     18e. expression.  The *note object: c82. 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__(): f79. を呼び出し、その返り値に対し反復処理をする
ことでコルーチンの実行を制御できます。コルーチンの実行が完了し制御を戻し
たとき、イテレータは *note StopIteration: df9. を送出し、その例外の
*note value: 2477. 属性に返り値を持たせます。コルーチンが例外を送出した
場合は、イテレータにより伝搬されます。コルーチンから ‘StopIteration’ 例
外を外に送出すべきではありません。

コルーチンには以下に挙げるメソッドもあり、これらはジェネレータのメソッド
からの類似です (*note ジェネレータ-イテレータメソッド: 2478. を参照して
ください)。 ただし、ジェネレータと違って、コルーチンは反復処理を直接はサ
ポートしていません。

Coroutines are *note generic: 2429. over the types of their yield, send,
and return values, respectively.

バージョン 3.5.2 で変更: コルーチンで2回以上待機 (await) すると *note
RuntimeError: 246. となります。

 -- メソッド: 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__(): f79.  If 'value' is not ‘None’, this method
     delegates to the *note send(): 1271. method of the iterator that
     caused the coroutine to suspend.  The result (return value, *note
     StopIteration: df9, 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: df9. かその他の例外) は
     、上で解説したような *note __await__(): f79. の返り値に対して反復処
     理を行ったときと同じです。 例外がコルーチンの中で捕捉されなかった場
     合、呼び出し元へ伝搬されます。

     バージョン 3.12 で変更: The second signature (type[, value[,
     traceback]]) is deprecated and may be removed in a future version
     of Python.

 -- メソッド: coroutine.close ()

     コルーチンが自分自身の後片付けをし終了します。 コルーチンが一時停止
     している場合は、コルーチンを一時停止させたイテレータに *note
     close(): 1802. メソッドがあれば、まずはそれに処理を委任します。 そ
     して一時停止した地点から *note GeneratorExit: 15e5. が送出され、た
     だちにコルーチンが自分自身の後片付けを行います。 最後に、実行が開始
     されていなかった場合でも、コルーチンに実行が完了した印を付けます。

     コルーチンオブジェクトが破棄されるときには、上記の手順を経て自動的
     に閉じられます。


File: python.info,  Node: 非同期イテレータ Asynchronous Iterator,  Next: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: コルーチンオブジェクト,  Up: コルーチン

4.3.4.3 非同期イテレータ (Asynchronous Iterator)
................................................

'非同期イテレータ' の ‘__anext__’ メソッドからは非同期のコードが呼べます
。

非同期イテレータは *note async for: ca5. 文の中で使えます。

The *note object: c82. class itself does not provide these methods.

 -- メソッド: object.__aiter__ (self)

     '非同期イテレータ' オブジェクトを返さなくてはなりません。

 -- メソッド: object.__anext__ (self)

     イテレータの次の値を返す '待機可能オブジェクト' を返さなければなり
     ません。 反復処理が終了したときには *note StopAsyncIteration: 1e6c.
     エラーを送出すべきです。

非同期イテラブルオブジェクトの例:

     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__(): dfa. は
*note 非同期イテレータ: 4c7. になる 'awaitable' を返せました。

Python 3.7 からは、 *note __aiter__(): dfa. は非同期イテレータオブジェク
トを返さなければなりません。 それ以外のものを返すと *note TypeError:
199. になります。


File: python.info,  Node: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: 非同期イテレータ Asynchronous Iterator,  Up: コルーチン

4.3.4.4 非同期コンテキストマネージャ (Asynchronous Context Manager)
...................................................................

'非同期コンテキストマネージャ' は、 ‘__aenter__’ メソッドと ‘__aexit__’
メソッド内部で実行を一時停止できる 'コンテキストマネージャ' です。

非同期コンテキストマネージャは *note async with: 186. 文の中で使えます。

The *note object: c82. 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__(): 151c, 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: 1a9. オプションで指定されたコマンド) もコー
ドブロックです。 引数 *note -m: 23e. を使用して、コマンドラインからトッ
プレベルスクリプト(すなわちモジュール ‘__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: 2487. that are identifiers if occurring in an
     assignment:

        + *note for: 348. loop header,

        + after ‘as’ in a *note with: 187. statement, *note except: 1ac.
          clause, *note except*: 1ad. 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: 1b7e. 文で指定される対象は、(‘del’ の意味付けは、実際は名前の
解放 (unbind) ですが) 文の目的上、束縛済みのものとみなされます。

代入文や import 文はいずれも、クラスや関数定義、モジュールレベル (トップ
レベルのコードブロック) 内で起こります。

If a name is bound in a block, it is a local variable of that block,
unless declared as *note nonlocal: 14c3. 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: 2488.

プログラムテキスト中に名前が出現するたびに、その名前が使われている最も内
側の関数ブロック中で作成された '束縛 (binding)' を使って名前の参照が行わ
れます。


File: python.info,  Node: 名前解決,  Next: Annotation scopes,  Prev: 名前の束縛,  Up: 名前づけと束縛 naming and binding

4.4.2.2 名前解決
................

スコープ ('scope') は、ブロック内の名前の可視性を決めます。 ローカル変数
があるブロック内で定義されている場合、変数のスコープはそのブロックを含み
ます。 関数ブロック内で名前の定義を行った場合、その中のブロックが名前に
別の束縛を行わない限り、定義ブロック内の全てのブロックを含むようにスコー
プが拡張されます。

ある名前がコードブロック内で使われると、その名前を最も近傍から囲うような
スコープ (最内スコープ: nearest enclosing scope) を使って束縛の解決を行
います。こうしたスコープからなる、あるコードブロック内で参照できるスコー
プ全ての集合は、ブロックの環境('environment')と呼ばれます。

名前が全く見付からなかったときは、 *note NameError: 450. 例外が送出され
ます。 現在のスコープが関数のもので、名前が使われる場所でローカル変数が
まだ値に束縛されていない場合、 *note UnboundLocalError: 1754. 例外が送出
されます。 ‘UnboundLocalError’ は ‘NameError’ の子クラスです。

ある名前がコードブロック内のどこかで束縛操作されていたら、そのブロック内
で使われるその名前はすべて、現在のブロックへの参照として扱われます。この
ため、ある名前がそのブロック内で束縛される前に使われるとエラーにつながり
ます。この規則は敏感です。Python には宣言がなく、コードブロックのどこで
も名前束縛操作ができます。あるコードブロックにおけるローカル変数は、ブロ
ックのテキスト全体から名前束縛操作を走査することで決定されます。例は
*note UnboundLocalError についての FAQ 項目: 248b. を参照してください。

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: 14c3. statement causes corresponding names to refer
to previously bound variables in the nearest enclosing function scope.
*note SyntaxError: 18f. 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: 15d, *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: 2075.

   * *note Variable annotations: f55.

   * 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: 23d3.  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: bc6,
     ‘yield from’, *note await: 18e, or *note ;=: 248d. expressions.
     (These expressions are allowed in other scopes contained within the
     annotation scope.)

   * Names defined in annotation scopes cannot be rebound with *note
     nonlocal: 14c3. 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: 1d82. of objects defined
     within the scope.  Instead, the *note __qualname__: 1275. 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__’ は ‘builtins’ モジュール自身の辞書のエイリアスです。


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) ‘exec()’ と ‘eval()’ 関数にはオプションの引数
があり、グローバルとローカル名前空間をオーバライドできます。名前空間が一
つしか指定されなければ、両方の名前空間として使われます。

   ---------- 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: 8f9. ...  *note except: 1ac. 文で指定することができます。
‘try’ 文の *note finally: 1b1. 節を使うとクリーンアップコード (cleanup
code) を指定できます。このコードは例外は処理しませんが、先行するコードブ
ロックで例外が起きても起きなくても実行されます。

Python は、エラー処理に "プログラムの終了 (termination)" モデルを用いて
います: 例外ハンドラは、プログラムに何が発生したかを把握することができ、
ハンドラの外側のレベルに処理を継続することはできますが、(問題のあったコ
ード部分を最初から実行しなおすのでない限り) エラーの原因を修復したり、実
行に失敗した操作をやり直すことはできません。

例外が全く処理されないとき、インタプリタはプログラムの実行を終了させるか
、対話メインループに処理を戻します。 どちらの場合も、例外が *note
SystemExit: f40. でなければ、スタックのトレースバックを出力します。

例外は、クラスインスタンスによって識別されます。 *note except: 1ac. 節は
インスタンスのクラスにもとづいて選択されます: これはインスタンスのクラス
か、その *note 非仮想基底クラス: 13d2. を参照します。このインスタンスは
ハンドラによって受け取られ、例外条件に関する追加情報を伝えることができま
す。

     注釈: 例外のメッセージは、Python API 仕様には含まれていません。メッ
     セージの内容は、ある Python のバージョンと次のバージョンの間で警告
     なしに変更される可能性があるので、複数バージョンのインタプリタで動
     作するようなコードは、例外メッセージの内容に依存させるべきではあり
     ません。

*note try: 8f9. 文については、 *note try 文: 8f9. 節、 *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: 1791.  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: 1791.

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: 1a3d. にある Python コードから他のモジュールを
*note インポート: 249c. することで、そこにあるコードへアクセスできるよう
になります。 *note import: 7f8. 文はインポート機構を動かす最も一般的な方
法ですが、それが唯一の方法ではありません。 *note
importlib.import_module(): 73c. や組み込みの *note __import__(): ad5. と
いった関数を使っても、インポート機構を動かすことができます。

*note import: 7f8. 文は 2 つの処理を連続して行っています; ある名前のモジ
ュールを探し、その検索結果をローカルスコープの名前に束縛します。
‘import’ 文の検索処理は、適切な引数で *note __import__(): ad5. 関数を呼
び出すこととして定義されています。 ‘__import__()’ の戻り値は ‘import’ 文
の名前束縛処理の実行で使われます。名前束縛処理の厳密な詳細は ‘import’ 文
を参照してください。

*note __import__(): ad5. を直接呼び出すとモジュールの検索のみが行われ、
見つかった場合、モジュールの作成処理が行われます。親パッケージのインポー
トや (*note sys.modules: 1791. を含む) 様々なキャッシュの更新などの副作
用は起きるかもしれませんが、 *note import: 7f8. 文のみが名前束縛処理を行
います。

*note import: 7f8. 文が実行されるときには、標準の組み込み関数 *note
__import__(): ad5. が呼ばれます。インポートシステムを呼び出すその他の
(*note importlib.import_module(): 73c. 関数のような) メカニズムは、
‘__import__()’ の呼び出しをバイパスして独自のインポート・セマンティクス
を実装している可能性があります。

モジュールが初めてインポートされるとき、 Python はそのモジュールを検索し
、見付かった場合、モジュールオブジェクトを作成し、初期化します (1) 。そ
の名前のモジュールが見付からなかった場合、 *note ModuleNotFoundError:
d41. が送出されます。 Python には、インポート機構が実行されたときに名前
からモジュールを検索する様々な戦略が実装されています。これらの戦略は、こ
れ以降の節で解説される様々なフックを使って、修正したり拡張したりできます
。

バージョン 3.3 で変更: インポートシステムが PEP 302(2) の第 2 フェーズの
完全な実装へ更新されました。もはや暗黙的なインポート機構はありません - イ
ンポート機構全体は *note sys.meta_path: f2b. を通して公開されています。
加えて、ネイティブの名前空間パッケージのサポートは実装されています ( PEP
420(3) を参照) 。

* Menu:

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

   ---------- Footnotes ----------

   (1) *note types.ModuleType: 1018. を参照してください。

   (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__(): ad5. よりもシ
ンプルで推奨される API を提供します。より詳細なことは ‘importlib’ ライブ
ラリのドキュメントを参照してください。


File: python.info,  Node: パッケージ<2>,  Next: 検索,  Prev: importlib<10>,  Up: インポートシステム

4.5.2 パッケージ
----------------

Python にはモジュールオブジェクトの種類は 1 種類しかなく、 Python 、 C 、
それ以外のもののどれで実装されているかに関係なく、すべてのモジュールはこ
の種類になります。モジュールの組織化を助け、名前階層を提供するために、
Python には *note パッケージ: 235. という概念があります。

パッケージはファイルシステムのディレクトリ、モジュールはディレクトリにあ
るファイルと考えることができますが、パッケージやモジュールはファイルシス
テムから生まれる必要はないので、この比喩を額面通りに受け取ってはいけませ
ん。この文書の目的のために、ディレクトリとファイルという便利な比喩を使う
ことにします。ファイルシステムのディレクトリのように、パッケージは階層構
造を成し、通常のモジュールだけでなく、サブパッケージを含むこともあります
。

すべてのパッケージはモジュールですが、すべてのモジュールがパッケージとは
限らないことを心に留めておくのが重要です。もしくは他の言い方をすると、パ
ッケージは単なる特別な種類のモジュールであると言えます。特に、‘__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 通常のパッケージ: 24a0. と *note 名前空間パッケージ:
2b4. の 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’ が実行されます。

A subdirectory inside a regular package that does not contain an
‘__init__.py’ file is treated as an implicit *note namespace package:
24a1. (a "namespace subpackage") rooted in that parent.  See PEP 420(1)
for the underlying specification.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/


File: python.info,  Node: 名前空間パッケージ,  Prev: 通常のパッケージ,  Up: パッケージ<2>

4.5.2.2 名前空間パッケージ
..........................

名前空間パッケージは様々な *note ポーション: 24a3. を寄せ集めたもので、
それぞれのポーションはサブパッケージを親パッケージに提供します。ポーショ
ンはファイルシステムの別々の場所にあることもあります。ポーションは、 zip
ファイルの中やネットワーク上や、それ以外のインポート時に Python が探すど
こかの場所で見つかることもあります。名前空間パッケージはファイルシステム
上のオブジェクトに対応することもあるし、そうでないこともあります; それら
は実際の実体のない仮想モジュールです。

名前空間パッケージは、 ‘__path__’ 属性に普通のリストは使いません。その代
わりに独自の iterable 型を使っていて、ポーションの親パッケージのパス (も
しくは最上位パッケージのための *note sys.path: 3e2.) が変わった場合、そ
のパッケージでの次のインポートの際に、新たに自動でパッケージポーションを
検索します。

名前空間パッケージには ‘parent/__init__.py’ ファイルはありません。それど
ころか、異なるポーションがそれぞれ提供する複数の ‘parent’ ディレクトリが
インポート検索の際に見つかることもあります。したがって ‘parent/one’ は物
理的に ‘parent/two’ の隣りにあるとは限りません。その場合、そのパッケージ
かサブパッケージのうち 1 つがインポートされたとき、Python は最上位の
‘parent’ パッケージのための名前空間パッケージを作成します。

Namespace packages may also be nested inside a regular package.  When
the import system searches a regular package's ‘__path__’ and encounters
a subdirectory that does not contain an ‘__init__.py’ file, that
subdirectory becomes a *note portion: 24a3. contributing to a namespace
subpackage of the enclosing regular package.

名前空間パッケージの仕様については PEP 420(1) も参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/


File: python.info,  Node: 検索,  Next: ロード,  Prev: パッケージ<2>,  Up: インポートシステム

4.5.3 検索
----------

検索を始めるためには、 Python はインポートされるモジュール (もしくはパッ
ケージですが、ここでの議論の目的においてはささいな違いです) の *note
完全修飾: 1d82. 名を必要とします。この名前は、 *note import: 7f8. 文の様
々な引数や *note importlib.import_module(): 73c. および *note
__import__(): ad5. 関数のパラメータから得られます。

この名前はインポート検索の様々なフェーズで使われ、これは例えば
‘foo.bar.baz’ のようなドットで区切られたサブモジュールへのパスだったりし
ます。この場合、 Python は最初に ‘foo’ を、次に ‘foo.bar’ 、そして最後に
‘foo.bar.baz’ をインポートしようとします。中間のいずれかのインポートに失
敗した場合は、 *note ModuleNotFoundError: d41. が送出されます。

* Menu:

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


File: python.info,  Node: モジュールキャッシュ,  Next: ファインダーとローダー,  Up: 検索

4.5.3.1 モジュールキャッシュ
............................

インポート検索で最初に調べる場所は *note sys.modules: 1791. です。このマ
ッピングは、中間のパスを含む、これまでにインポートされたすべてのモジュー
ルのキャッシュを提供します。なので ‘foo.bar.baz’ がインポート済みの場合
、 ‘sys.modules’ は ‘foo’ 、 ‘foo.bar’ 、 ‘foo.bar.baz’ のエントリーを含
みます。それぞれのキーはその値として対応するモジュールオブジェクトを持ち
ます。

インポートではモジュール名は *note sys.modules: 1791. から探され、存在し
た場合は、対応する値がインポートされるべきモジュールであり、この処理は完
了します。しかし値が ‘None’ だった場合、 *note ModuleNotFoundError: d41.
が送出されます。モジュール名が見付からなかった場合は、 Python はモジュー
ルの検索を続けます。

*note sys.modules: 1791. は書き込み可能です。キーの削除は対応するモジュ
ールを破壊しない (他のモジュールがそのモジュールへの参照を持っている) か
もしれませんが、指定されたモジュールのキャッシュされたエントリーを無効に
し、それが次にインポートされたとき Python にそのモジュールを改めて検索さ
せることになります。キーを ‘None’ に対応付けることもできますが、次にその
モジュールがインポートされるときに *note ModuleNotFoundError: d41. とな
ってしまいます。

たとえモジュールオブジェクトへの参照を保持しておいて、 *note
sys.modules: 1791. にキャッシュされたエントリーを無効にし、その指定した
モジュールを再インポートしたとしても、 2 つのモジュールオブジェクトは同
じでは 'ない' ことに注意してください。それとは対照的に、 *note
importlib.reload(): 73d. は '同じ' モジュールオブジェクトを再利用し、モ
ジュールのコードを再実行することで単にモジュールの内容を再初期化するだけ
です。


File: python.info,  Node: ファインダーとローダー,  Next: インポートフック,  Prev: モジュールキャッシュ,  Up: 検索

4.5.3.2 ファインダーとローダー
..............................

*note sys.modules: 1791. に指定されたモジュールが見つからなかった場合は
、 Python のインポートプロトコルが起動され、モジュールを見つけロードしま
す。このプロトコルは 2 つの概念的なオブジェクト、 *note ファインダー:
23c6. と *note ローダー: 1a8a. から成ります。ファインダーの仕事は、知っ
ている戦略を使って指定されたモジュールを見つけられるかどうか判断すること
です。両方のインターフェースを実装しているオブジェクトは *note
インポーター: 24a8. と呼ばれます - インポーターは要求されたモジュールが
ロードできると分かったとき、自分自身を返します。

Python にはデフォルトのファインダーとインポーターがいくつかあります。 1
つ目のものは組み込みモジュールの見つけ方を知っていて、 2 つ目のものは凍
結されたモジュール (訳注: freeze ツールで処理されたモジュールのこと。
*note プログラミング FAQ: 24a9. の「どうしたら Python スクリプトからスタ
ンドアロンバイナリを作れますか？」の項目を参照) の見つけ方を知っています
。 3 つ目のものは *note インポートパス: 24aa. からモジュールを探します。
インポートパス はファイルシステムのパスや zip ファイルの位置を示すリスト
です。このリストは、 URL で特定できるもののような、位置を示すことのでき
る任意のリソースの検索にまで拡張することもできます。

インポート機構は拡張可能なので、モジュール検索の範囲とスコープを拡張する
ために新しいファインダーを付け加えることができます。

ファインダーは実際にはモジュールをロードしません。指定されたモジュールが
見つかった場合、ファインダーは 'module spec' (モジュール仕様)、すなわち
モジュールのインポート関連の情報をカプセル化したものを返します。モジュー
ルのロード時にインポート機構はそれを利用します。

次の節では、インポート機構を拡張するための新しいファインダーやローダーの
作成と登録を含め、ファインダーとローダーのプロトコルについてより詳しく解
説します。

バージョン 3.4 で変更: Python の以前のバージョンでは、ファインダーは直接
*note ローダー: 1a8a. を返していましたが、現在はローダーを '含む' モジュ
ール仕様を返します。ローダーはインポート中はまだ使われていますが、責任は
減りました。


File: python.info,  Node: インポートフック,  Next: メタパス,  Prev: ファインダーとローダー,  Up: 検索

4.5.3.3 インポートフック
........................

インポート機構は拡張可能なように設計されています; その主となる仕組みは
'インポートフック' です。インポートフックには 2 種類あります: 'メタフッ
ク' と 'インポートパスフック' です。

メタフックはインポート処理の最初、 *note sys.modules: 1791. キャッシュの
検索以外のインポート処理より前に呼び出されます。これにより、 *note
sys.path: 3e2. の処理や凍結されたモジュールや組み込みのモジュールでさえ
も、メタフックで上書きすることができます。メタフックは以下で解説するよう
に、 *note sys.meta_path: f2b. に新しいファインダーオブジェクトを追加す
ることで登録されます。

インポートパスフックは、 *note sys.path: 3e2. (もしくは
‘package.__path__’) の処理の一部として、対応するパス要素を取り扱うところ
で呼び出されます。インポートパスフックは以下で解説するように、新しい呼び
出し可能オブジェクトを *note sys.path_hooks: 1229. に追加することで登録
されます。


File: python.info,  Node: メタパス,  Prev: インポートフック,  Up: 検索

4.5.3.4 メタパス
................

When the named module is not found in *note sys.modules: 1791, Python
next searches *note sys.meta_path: f2b, 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(): a6c. 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: f2b. に対する処理が spec を
返さずにリストの末尾に到達してしまった場合は、 *note
ModuleNotFoundError: d41. を送出します。その他の送出された例外はそのまま
呼び出し元に伝播され、インポート処理を異常終了させます。

The *note find_spec(): a6c. 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: d41. 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: f2b. は 3 つのパスファインダ
ーを持っています。組み込みモジュールのインポートの方法を知っているもの、
凍結されたモジュールのインポートの方法を知っているもの、 *note
インポートパス: 24aa. からのモジュールのインポートの方法を知っているもの
(つまり *note パスベース・ファインダー: 24ad.) があります。

バージョン 3.4 で変更: The *note find_spec(): a6c. 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 ‘find_spec()’.

バージョン 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(): a6c. 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: 1791. の中に与えられた名前を持つ既存のモジュール
     オブジェクトがあるなら、 import は既にそれを返しているでしょう。

   * モジュールは、ローダーがモジュールコードを実行する前に *note
     sys.modules: 1791. に存在しています。 モジュールコードが (直接的ま
     たは間接的に) 自分自身をインポートする可能性があるので、これは重要
     です; モジュールを ‘sys.modules’ に追加することで、最悪のケースでは
     無限の再帰が、そして最良のケースでは複数回のロードが、前もって防止
     されます。

   * ロード処理に失敗した場合、その失敗したモジュールは - そして、そのモ
     ジュールだけが - *note sys.modules: 1791. から取り除かれます。
     ‘sys.modules’ キャッシュに既に含まれていたすべてのモジュールと、副
     作用としてロードに成功したすべてのモジュールは、常にキャッシュに残
     されます。これはリロードとは対照的で、リロードの場合は失敗したモジ
     ュールも ‘sys.modules’ に残されます。

   * *note 後のセクション: 23bd. で要約されるように、モジュールが作られ
     てから実行されるまでの間にインポート機構はインポート関連のモジュー
     ル属性を設定します (上記擬似コード例の "_init_module_attrs")。

   * モジュール実行はモジュールの名前空間が構築されるロードの重要な瞬間
     です。実行はローダーに完全に委任され、ローダーは何をどのように構築
     するかを決定することになります。

   * ロードの間に作成されて exec_module() に渡されたモジュールは、インポ
     ートの終わりに返されるものとは異なるかもしれません (1)。

バージョン 3.4 で変更: The import system has taken over the boilerplate
responsibilities of loaders.  These were previously performed by the
*note importlib.abc.Loader.load_module(): a6d. method.

* Menu:

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

   ---------- Footnotes ----------

   (1) importlib の実装は、戻り値を直接使うことは避けています。その代わ
りに、モジュール名を調べて *note sys.modules: 1791. からモジュールオブジ
ェクトを得ます。こうすることの間接的な効果は、インポートされたモジュール
が ‘sys.modules’ にいる自分自身を置き換えることがあるということです。こ
れは実装依存の動作であり、他の Python 実装では保証されていない動作です。


File: python.info,  Node: ローダー,  Next: サブモジュール,  Up: ロード

4.5.4.1 ローダー
................

モジュールローダーは、ロードの重要な機能であるモジュール実行機能を提供し
ます。インポート機構は、実行しようとするモジュールオブジェクトを単一の引
数として *note importlib.abc.Loader.exec_module(): a6e. メソッドを呼び出
します。 ‘importlib.abc.Loader.exec_module()’ から返された任意の値は無視
されます。

ローダーは以下の仕様を満たしていなければいけません:

   * モジュールが (組み込みモジュールや動的に読み込まれる拡張モジュール
     ではなくて) Python モジュールだった場合、ローダーはモジュールのグロ
     ーバル名前空間 (‘module.__dict__’) で、モジュールのコードを実行すべ
     きです。

   * *note exec_module(): a6e. の呼び出し中に *note ImportError: 65b. 以
     外の例外が送出され、伝播されてきたとしても、モジュールをロードでき
     ない場合は ‘ImportError’ を送出すべきです。

多くの場合、ファインダーとローダーは同じオブジェクトで構いません; そのよ
うな場合では *note find_spec(): a6c. メソッドは単に ‘self’ (訳注: オブジ
ェクト自身) を返すだけです。

モジュールローダーは、 *note create_module(): eb0. メソッドを実装するこ
とでロード中にモジュールオブジェクトを作成することを選択できます。このメ
ソッドは、モジュール仕様を引数に取って、ロード中に使う新しいモジュールオ
ブジェクトを返します。 ‘create_module()’ はモジュールオブジェクトに属性
を設定する必要はありません。もしこのメソッドが ‘None’ を返すなら、インポ
ート機構は新しいモジュールを自身で作成します。

Added in version 3.4: ローダーの *note create_module(): eb0. メソッド。

バージョン 3.4 で変更: The *note load_module(): a6d. method was replaced
by *note exec_module(): a6e. and the import machinery assumed all the
boilerplate responsibilities of loading.

既存のローダーとの互換性のため、もしローダーに ‘load_module()’ メソッド
が存在し、かつローダーが ‘exec_module()’ を実装していなければ、インポー
ト機構はローダーの ‘load_module()’ メソッドを使います。しかし、
‘load_module()’ は deprecated であり、ローダーは代わりに ‘exec_module()’
を実装すべきです。

‘load_module()’ メソッドは、モジュールを実行することに加えて上記で説明さ
れたすべての定型的なロード機能を実施しなければなりません。同じ制約が適用
されます。以下は追加の明確化です:

   * *note sys.modules: 1791. に与えられた名前のモジュールが存在している
     場合、ローダーはその既存のモジュールを使わなければいけません。 (そ
     うしないと *note importlib.reload(): 73d. は正しく動かないでしょう
     。) 指定されたモジュールが ‘sys.modules’ に存在しない場合、ローダー
     は新しいモジュールオブジェクトを作成し、 ‘sys.modules’ に追加しなけ
     ればいけません。

   * 無限の再帰または複数回のロードを防止するために、ローダーがモジュー
     ルコードを実行する前にモジュールは *note sys.modules: 1791. に存在
     しなければなりません ('must')。

   * ロード処理に失敗した場合、ローダーは *note sys.modules: 1791. に追
     加したモジュールを取り除かなければいけませんが、それはロードに失敗
     したモジュール 'のみ' を、そのモジュールがローダー自身に明示的にロ
     ードされた場合に限り、除去しなければなりません。

バージョン 3.5 で変更: ‘exec_module()’ が定義されていて
‘create_module()’ が定義されていない場合、 *note DeprecationWarning:
1a4. が送出されるようになりました。

バージョン 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__: 23c0.  Setting
‘__spec__’ appropriately applies equally to *note modules initialized
during interpreter startup: 24b2.  The one exception is ‘__main__’,
where ‘__spec__’ is *note set to None in some cases: 24b3.

See *note ModuleSpec: 22c8. 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__: 20b0. 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: 235.

A package's *note __path__: 20b0. attribute is used during imports of
its subpackages.  Within the import machinery, it functions much the
same as *note sys.path: 3e2, 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: 3e2. also apply to a package's
‘__path__’.  *note sys.path_hooks: 1229. (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__: 20b0. 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: 217d. 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 パスベース・ファインダー:
24ad. (*note PathFinder: 1228.) と呼ばれ、 *note パスエントリ: 24b8. の
リストである *note インポートパス: 24aa. を検索します。それぞれのパスエ
ントリは、モジュールを探す場所を指しています。

パスベース・ファインダー自体は何かのインポート方法を知っているわけではあ
りません。その代わりに、個々のパスエントリを走査し、それぞれに特定の種類
のパスの扱いを知っているパスエントリ・ファインダーを関連付けます。

デフォルトのパスエントリ・ファインダーは、ファイルシステム上のモジュール
を見つけるためのすべてのセマンティクスを実装しています。それは Python ソ
ースコード (‘.py’ ファイル) 、Python バイトコード (‘.pyc’ ファイル) 、共
有ライブラリ (例えば ‘.so’ ファイル) などの特別なファイルタイプを処理し
ます。標準ライブラリの *note zipimport: 139. モジュールによってサポート
される場合は、デフォルトのパスエントリ・ファインダーは (共有ライブラリ以
外の) すべてのファイルタイプの zip ファイルからのロードも扱います。

パスエントリはファイルシステム上の場所に限定される必要はありません。URL
やデータベースクエリやその他文字列で指定できる場所を参照することも可能で
す。

パスベース・ファインダーにはフックやプロトコルを追加することができ、それ
によって検索可能なパスエントリの種類を拡張し、カスタマイズすることができ
ます。例えば、ネットワーク上の URL をパスエントリとしてサポートしたい場
合、 web 上のモジュールを見つけるために HTTP の取り扱い方を実装したフッ
クを書くことができます。この (呼び出し可能オブジェクトである) フックは、
下で解説するプロトコルをサポートする *note パスエントリ・ファインダー:
1281. を返します。このプロトコルは web からモジュールのローダーを取得す
るのに使われます。

警告の言葉: この節と前の節の両方で 'ファインダー' という言葉が、 *note
メタパス・ファインダー: 1280. と *note パスエントリ・ファインダー: 1281.
という用語で区別されて使われています。これら 2 種類のファインダーは非常
に似ており、似たプロトコルをサポートし、インポート処理で同じように機能し
ますが、微妙に異なっているのを心に留めておくのは重要です。特に、メタパス
・ファインダーはインポート処理の開始時、 *note sys.meta_path: f2b. の走
査が動くときに動作します。

それとは対照的に、パスエントリ・ファインダーはある意味でパスベース・ファ
インダーの実装詳細であり、実際 *note sys.meta_path: f2b. からパスベース
・ファインダーが取り除かれた場合、パスエントリ・ファインダーの実装は何も
実行されないでしょう。

* Menu:

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


File: python.info,  Node: パスエントリ・ファインダー,  Next: パスエントリ・ファインダー・プロトコル,  Up: パスベース・ファインダー

4.5.5.1 パスエントリ・ファインダー
..................................

*note パスベース・ファインダー: 24ad. には、文字列 *note パスエントリ:
24b8. で指定された場所の Python モジュールや Python パッケージを見つけ、
ロードする責任があります。ほとんどのパスエントリはファイルシステム上の場
所を指定していますが、そこに制限される必要はありません。

メタパス・ファインダーとして、 *note パスベース・ファインダー: 24ad. に
は前に解説した *note find_spec(): a6c. プロトコルが実装されていますが、
これに加えて *note インポートパス: 24aa. からモジュールを見つけ、ロード
する方法をカスタマイズするために使えるフックを提供しています。

*note パスベース・ファインダー: 24ad. は *note sys.path: 3e2. 、 *note
sys.path_hooks: 1229. 、 *note sys.path_importer_cache: 7fa. という 3 つ
の変数を使います。さらにパッケージオブジェクトの ‘__path__’ 属性も使いま
す。これらによって、インポート処理をカスタマイズする方法が提供されます。

*note sys.path: 3e2. contains a list of strings providing search
locations for modules and packages.  It is initialized from the *note
PYTHONPATH: 1223. environment variable and various other installation-
and implementation-specific defaults.  Entries in ‘sys.path’ 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 ‘sys.path’; all other data types are ignored.

*note パスベース・ファインダー: 24ad. は *note メタパス・ファインダー:
1280. なので、インポート機構は、前で解説したパスベース・ファインダーの
*note find_spec(): 1217. メソッドを呼び出すことで *note インポートパス:
24aa. の検索を始めます。 ‘path’ 引数が ‘find_spec()’ に渡されたときは、
それは走査するパス文字列のリスト - 典型的にはそのパッケージの中でインポ
ートしているパッケージの ‘__path__’ 属性になります。 ‘path’ 引数が
‘None’ だった場合、それは最上位のインポートであることを示していて、
*note sys.path: 3e2. が使われます。

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:
1281. (*note PathEntryFinder: a73.) 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: 24a8. objects).  In this way, the expensive search for a
particular *note path entry: 24b8. location's path entry finder need
only be done once.  User code is free to remove cache entries from
‘sys.path_importer_cache’ forcing the path based finder to perform the
path entry search again.

path entry がキャッシュの中に無かった場合、 path based finder は *note
sys.path_hooks: 1229. の中の呼び出し可能オブジェクトを全て辿ります。 こ
のリストのそれぞれの *note path entry フック: 24ba. は、検索する path
entry という引数 1 つを渡して呼び出されます。 その呼び出し可能オブジェク
トは path entry を扱える *note path entry finder: 1281. を返すか、 *note
ImportError: 65b. を送出します。 ‘ImportError’ は、フックが *note path
entry: 24b8. のための path entry finder を探せないことを報せるために
path based finder が使います。 この例外は処理されず、 *note import path:
24aa. を辿っていく処理が続けられます。 フックは引数として文字列またはバ
イト列オブジェクトを期待します; バイト列オブジェクトのエンコーディングは
フックに任されていて (例えば、ファイルシステムのエンコーディングの UTF-8
やそれ以外などです) 、フックが引数をデコードできなかった場合は
‘ImportError’ を送出すべきです。

*note sys.path_hooks: 1229. を辿る処理が *note
パスエントリ・ファインダー: 1281. を何も返さずに終わった場合、パスベース
・ファインダーの *note find_spec(): 1217. メソッドは、 *note
sys.path_importer_cache: 7fa. に (このパスエントリに対するファインダーが
存在しないことを示すために) ‘None’ を保存し、 *note
メタパス・ファインダー: 1280. はモジュールが見つからなかったことを伝える
ために ‘None’ を返します。

*note sys.path_hooks: 1229. 上の *note パスエントリフック: 24ba. 呼び出
し可能オブジェクトの戻り値のいずれかが *note パスエントリ・ファインダー:
1281. 'であった' 場合、後で出てくるモジュール仕様を探すためのプロトコル
が使われ、それがモジュールをロードするために使われます。

The current working directory - denoted by an empty string - is handled
slightly differently from other entries on *note sys.path: 3e2.  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
‘sys.path_importer_cache’ and returned by *note
importlib.machinery.PathFinder.find_spec(): 1217. 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(): a70. メソッドを実装しなければいけません。

*note find_spec(): a70. は 2 つの引数を取ります。インポートしようとして
いるモジュールの完全修飾名と、 (オプションの) 対象モジュールです。
‘find_spec()’ はモジュールに対応する完全に初期化 (populated) された仕様
を返します。この仕様は (1つの例外を除いて) 常に "loader" セットを持って
います。

To indicate to the import machinery that the spec represents a namespace
*note portion: 24a3, the path entry finder sets
‘submodule_search_locations’ to a list containing the portion.

バージョン 3.4 で変更: *note find_spec(): a70. 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: 24a3.

他のインポート機構の実装に対する後方互換性のために、多くのパスエントリ・
ファインダーは、メタパス・ファインダーがサポートするのと同じ伝統的な
‘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: f2b. のデフォルトの内容を削除し、全部をカスタムのメタパス
フックで置き換えるものです。

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__(): ad5. function may be
sufficient.

(標準のインポートシステム全体を停止するのではなく) すでにメタパスにいる
フックからあるモジュールのインポートを選択的に防ぐためには、 *note
find_spec(): a6c. から ‘None’ を返す代わりに、直接 *note
ModuleNotFoundError: d41. を送出するだけで十分です。 ‘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 他の場所: 24b2. で言及されているように、
‘__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: 23e. オプションを付けて実行された場合には、
‘__spec__’ は対応するモジュールまたはパッケージのモジュール仕様に設定さ
れます。また、ディレクトリや zip ファイル、または他の *note sys.path:
3e2. エントリを実行する処理の一部として ‘__main__’ モジュールがロードさ
れる場合にも ‘__spec__’ が生成 (populate) されます。

*note それ以外のケース: 2176. では、 ‘__main__.__spec__’ は ‘None’ に設
定されます。これは、 *note __main__: 1. を生成 (populate) するために使わ
れたコードがインポート可能なモジュールと直接一致していないためです:

   - 対話プロンプト

   - *note -c: 1a9. オプション

   - stdin から起動された場合

   - ソースファイルやバイトコードファイルから直接起動された場合

最後のケースでは、たとえ技術的にはファイルがモジュールとして直接インポー
トできた 'としても' ‘__main__.__spec__’ は常に ‘None’ になることに注意し
てください。もし *note __main__: 1. において有効なモジュールメタデータが
必要なら *note -m: 23e. スイッチを使ってください。

‘__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: f2b. の仕様は PEP 302(2) で、その後継
となる拡張が PEP 420(3) です。

PEP 420(4) introduced *note namespace packages: 2b4. 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: 22e0. 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: 24c9. 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: 22fc. 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: 231d.
        | *note literal: 24cd.
        | *note enclosure: 24ce.
     enclosure:
        | *note parenth_form: 24cf.
        | *note list_display: 24d0.
        | *note dict_display: 24d1.
        | *note set_display: 24d2.
        | *note generator_expression: 24d3.
        | *note yield_atom: 24d4.

* Menu:

* Built-in constants::
* 識別子 (identifier、または名前 (name)): 識別子 identifier、または名前 name.
* リテラル: リテラル<2>.
* Parenthesized forms::
* Displays for lists, sets and dictionaries: Displays for lists sets and dictionaries.
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<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:
24d7.  The token ‘...’ names the *note Ellipsis: 2384. 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:
     22e5.  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): 22fc. 節を、名前付けや
束縛については *note 名前づけと束縛 (naming and binding): 23a2. 節を参照
してください。

名前があるオブジェクトに束縛されている場合、名前 atom を評価するとそのオ
ブジェクトになります。名前が束縛されていない場合、 atom を評価しようとす
ると *note NameError: 450. 例外を送出します。

* 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: 14f3.

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__: 1276. 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 forms,  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: 19b. and
*note template strings: 1860. are treated as string literals.

Numeric literals consist of a single *note NUMBER: 2362. token, which
names an integer, floating-point number, or an imaginary number.  See
the *note 数値リテラル: 22fd. section in Lexical analysis documentation
for details.

String and bytes literals may consist of several tokens.  See section
*note 文字列リテラルの結合 (concatenation): 233c. for details.

Note that negative and complex numbers, like ‘-3’ or ‘3+4.2j’, are
syntactically not literals, but *note unary: 24dc. or *note binary:
24dd. arithmetic operations involving the ‘-’ or ‘+’ operator.

Evaluation of a literal yields an object of the given type (*note int:
19c, *note float: 197, *note complex: 198, *note str: 16a, *note bytes:
193, or *note Template: 16b.) 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: 24de. | *note NUMBER: 2362.

* 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: 1af. 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 演算子での同一性テストが頼れますか？: 24e0. for
     more information.

*note Template strings: 1860. are immutable but may reference mutable
objects as *note Interpolation: 16c. 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: 232d. | *note fstring: 2350.)+ | *note tstring: 2360.+


File: python.info,  Node: Parenthesized forms,  Next: Displays for lists sets and dictionaries,  Prev: リテラル<2>,  Up: アトム、原子的要素 atom

4.6.2.7 Parenthesized forms
...........................

A parenthesized form is an optional expression list enclosed in
parentheses:

     parenth_form: "(" [*note starred_expression: 24e4.] ")"

A parenthesized expression list yields whatever that expression list
yields: if the list contains at least one comma, it yields a tuple;
otherwise, it yields the single expression that makes up the expression
list.

An empty pair of parentheses yields an empty tuple object.  Since tuples
are immutable, the same rules as for literals apply (i.e., two
occurrences of the empty tuple may or may not yield the same object).

Note that tuples are not formed by the parentheses, but rather by use of
the comma.  The exception is the empty tuple, for which parentheses
'are' required -- allowing unparenthesized "nothing" in expressions
would cause ambiguities and allow common typos to pass uncaught.


File: python.info,  Node: Displays for lists sets and dictionaries,  Next: リスト表示,  Prev: Parenthesized forms,  Up: アトム、原子的要素 atom

4.6.2.8 Displays for lists, sets and dictionaries
.................................................

For constructing a list, a set or a dictionary Python provides special
syntax called "displays", each of them in two flavors:

   * either the container contents are listed explicitly, or

   * they are computed via a set of looping and filtering instructions,
     called a 'comprehension'.

Common syntax elements for comprehensions are:

     comprehension: *note assignment_expression: 248d. *note comp_for: 24e7.
     comp_for:      ["async"] "for" *note target_list: 24e8. "in" *note or_test: 24e9. [*note comp_iter: 24ea.]
     comp_iter:     *note comp_for: 24e7. | *note comp_if: 24eb.
     comp_if:       "if" *note or_test: 24e9. [*note comp_iter: 24ea.]

The comprehension consists of a single expression followed by at least
one ‘for’ clause and zero or more ‘for’ or ‘if’ clauses.  In this case,
the elements of the new container are those that would be produced by
considering each of the ‘for’ or ‘if’ clauses a block, nesting from left
to right, and evaluating the expression to produce an element each time
the innermost block is reached.

However, aside from the iterable expression in the leftmost ‘for’
clause, the comprehension is executed in a separate implicitly nested
scope.  This ensures that names assigned to in the target list don't
"leak" into the enclosing scope.

The iterable expression in the leftmost ‘for’ clause is evaluated
directly in the enclosing scope and then passed as an argument to the
implicitly nested scope.  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)]’.

内包表記が常に適切な型のコンテナになるのを保証するために、 ‘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:
18e. 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: Asynchronous comprehensions were introduced.

バージョン 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: Displays for lists sets and dictionaries,  Up: アトム、原子的要素 atom

4.6.2.9 リスト表示
..................

A list display is a possibly empty series of expressions enclosed in
square brackets:

     list_display: "[" [*note flexible_expression_list: 24ee. | *note comprehension: 24e6.] "]"

A list display yields a new list object, the contents being specified by
either a list of expressions or a comprehension.  When a comma-separated
list of expressions is supplied, its elements are evaluated from left to
right and placed into the list object in that order.  When a
comprehension is supplied, the list is constructed from the elements
resulting from the comprehension.


File: python.info,  Node: 集合表示,  Next: 辞書表示,  Prev: リスト表示,  Up: アトム、原子的要素 atom

4.6.2.10 集合表示
.................

A set display is denoted by curly braces and distinguishable from
dictionary displays by the lack of colons separating keys and values:

     set_display: "{" (*note flexible_expression_list: 24ee. | *note comprehension: 24e6.) "}"

A set display yields a new mutable set object, the contents being
specified by either a sequence of expressions or a comprehension.  When
a comma-separated list of expressions is supplied, its elements are
evaluated from left to right and added to the set object.  When a
comprehension is supplied, the set is constructed from the elements
resulting from the comprehension.

An empty set cannot be constructed with ‘{}’; this literal constructs an
empty dictionary.


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: 24f2. | *note dict_comprehension: 24f3.] "}"
     dict_item_list:     *note dict_item: 24f4. ("," *note dict_item: 24f4.)* [","]
     dict_item:          *note expression: 183. ":" *note expression: 183. | "**" *note or_expr: 235e.
     dict_comprehension: *note expression: 183. ":" *note expression: 183. *note comp_for: 24e7.

A dictionary display yields a new dictionary object.

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: 13d7.  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) で提案され
ました。

A dict comprehension, in contrast to list and set comprehensions, needs
two expressions separated with a colon followed by the usual "for" and
"if" clauses.  When the comprehension is run, the resulting key and
value elements are inserted in the new dictionary in the order they are
produced.

Restrictions on the types of the key values are listed earlier in
section *note 標準型の階層: 238b.  (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 ジェネレータ式
.......................

The syntax for 'generator expressions' is the same as for list *note
comprehensions: 7ec, except that they are enclosed in parentheses
instead of brackets.  For example:

     >>> iterator = (x ** 2 for x in range(10))
     >>> iterator
     <generator object <genexpr> at ...>

At runtime, a generator expression evaluates to a *note generator
iterator: ddd. which yields the same values as the corresponding list
comprehension:

     >>> list(iterator)
     [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Thus, the example above is roughly equivalent to defining and calling
the following generator function:

     def make_generator_of_squares(iterator):
         for x in iterator:
             yield x ** 2

     make_generator_of_squares(iter(range(10)))

The enclosing parentheses can be omitted in calls when the generator
expression is the only positional argument and there are no keyword
arguments.  See the *note Calls section: f81. for details.  For example:

     # The parentheses after `sum` are part of the call syntax:
     >>> sum(x ** 2 for x in range(10))
     285

     # The generator needs its own parentheses if it's not the only argument:
     >>> sum((x ** 2 for x in range(10)), start=1000)
     1285

The iterable expression in the leftmost ‘for’ clause is evaluated
immediately, so that an error raised by this expression will be emitted
at the point where the generator expression is defined, rather than at
the point where the first value is retrieved:

     >>> (x ** 2 for x in nonexistent_iterable)
     Traceback (most recent call last):
       ...
     NameError: name 'nonexistent_iterable' is not defined

After the expression is evaluated, an iterator is created from the
result, as if *note iter(): 9db. was called on it.  Any error raised
when creating the iterator is also emitted immediately:

     >>> (x ** 2 for x in None)
     Traceback (most recent call last):
       ...
     TypeError: 'NoneType' object is not iterable

All other expressions are evaluated lazily, in the same fashion as
normal generators (that is, when the iterator is asked to yield a
value):

     >>> iterator = (nonexistent_value for x in range(10))
     >>> iterator
     <generator object <genexpr> at ...>
     >>> list(iterator)
     Traceback (most recent call last):
       ...
     NameError: name 'nonexistent_value' is not defined

     >>> iterator = (x * y for x in range(10) for y in nonexistent_iterable)
     >>> iterator
     <generator object <genexpr> at ...>
     >>> list(iterator)
     Traceback (most recent call last):
       ...
     NameError: name 'nonexistent_iterable' is not defined

To avoid interfering with the expected operation of the generator
expression itself, ‘yield’ and ‘yield from’ expressions are prohibited
inside the implicitly nested scope.

If a generator expression contains either ‘async for’ clauses or *note
await: 18e. expressions it is called an 'asynchronous generator
expression'.  An asynchronous generator expression returns a new
asynchronous generator object, which is an asynchronous iterator (see
*note 非同期イテレータ (Asynchronous Iterator): f7b.).

The formal grammar for generator expressions is:

     generator_expression: "(" *note expression: 183. *note comp_for: 24e7. ")"

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: 235f. ")"
     yield_from:       "yield" "from" *note expression: 183.
     yield_expression: "yield" *note yield_list: 24fa. | *note yield_from: 24f9.

yield 式は *note ジェネレータ: 1270. 関数や *note 非同期ジェネレータ:
24fb. 関数を定義するときに使われます。従って、関数定義の本体でのみ使えま
す。 関数の本体で 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):
24fc. 節に分けて説明されています。

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: 24fa. to the generator's caller, or ‘None’ if ‘yield_list’
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__(): 2109. is used (typically via either a
*note for: 348. or the *note next(): 9dc. builtin) then the result is
*note None: 886.  Otherwise, if *note send(): 1271. is used, then the
result will be the value passed in to that method.

これまで説明した内容から、ジェネレータ関数はコルーチンにとてもよく似てい
ます。ジェネレータ関数は何度も生成し、1つ以上のエントリポイントを持ち、
その実行は一時停止されます。ジェネレータ関数は yield した後で実行の継続
を制御できないことが唯一の違いです。その制御は常にジェネレータの呼び出し
元へ移されます。

yield 式は *note try: 8f9. 構造内で使用できます。ジェネレータの (参照カ
ウントがゼロに達するか、ガベージコレクションによる) 完了前に再開されない
場合、ジェネレータ-イテレータの *note close(): 1802. メソッドが呼ばれ、
*note finally: 1b1. 節が実行されます。

‘yield from <expr>’ を使用した場合、与えられた式はイテラブルでなければな
りません。そのイテラブルをイテレートすることで生成された値は現在のジェネ
レータのメソッドの呼び出し元へ直接渡されます。*note send(): 1271. で渡さ
れたあらゆる値と *note throw(): 71c. で渡されたあらゆる例外は根底のイテ
レータに適切なメソッドがあれば渡されます。適切なメソッドがない場合、
‘send()’ は *note AttributeError: 5f0. か *note TypeError: 199. を、
‘throw()’ は渡された例外を即座に送出します。

根底のイテレータの完了時、引き起こされた *note StopIteration: df9. イン
スタンスの *note value: 2477. 属性はその yield 式の値となります。
‘StopIteration’ を起こす際に明示的にセットされるか、サブイテレータがジェ
ネレータであれば (サブイテレータからかえる値で) 自動的にセットされるかの
どちらかです。

バージョン 3.3 で変更: サブイテレータに制御フローを委譲するために ‘yield
from <expr>’ が追加されました。

yield 式が代入文の単独の右辺式であるとき、括弧は省略できます。

参考
....

PEP 255(1) - 単純なジェネレータ

     Python へのジェネレータと *note yield: bc6. 文の導入提案。

PEP 342(2) - 拡張されたジェネレータを用いたコルーチン

     シンプルなコルーチンとして利用できるように、ジェネレータの構文と
     API を拡張する提案。

PEP 380(3) - サブジェネレータへの委譲構文

     サブジェネレータの委譲を簡単にするための、 *note yield_from: 24f9.
     構文の導入提案。

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: 2ee. 例外を送出する点に注意してください。

 -- メソッド: 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__(): 2109. method, the current yield
     expression always evaluates to *note None: 886.  The execution then
     continues to the next yield expression, where the generator is
     suspended again, and the value of the *note yield_list: 24fa. is
     returned to *note __next__(): 2109.'s caller.  If the generator
     exits without yielding another value, a *note StopIteration: df9.
     exception is raised.

     このメソッドは通常、例えば *note for: 348. ループや組み込みの *note
     next(): 9dc. 関数によって暗黙に呼び出されます。

 -- メソッド: generator.send (value)

     ジェネレータ関数の内部へ値を "送り"、実行を再開します。引数の
     'value' はその時点の yield 式の結果になります。 *note send(): 1271.
     メソッドは次にジェネレータが生成した値を返し、ジェネレータが次の値
     を生成することなく終了すると *note StopIteration: df9. を送出します
     。 ‘send()’ が呼び出されてジェネレータが開始するときは、値を受け取
     る yield 式が存在しないので、 *note None: 886. を引数として呼び出さ
     なければなりません。

 -- メソッド: generator.throw (value)

 -- メソッド: generator.throw (type[, value[, traceback]])

     ジェネレータが中断した位置で例外を発生させて、そのジェネレータ関数
     が生成する次の値を返します。ジェネレータが値を生成することなく終了
     すると *note StopIteration: df9. が発生します。ジェネレータ関数が渡
     された例外を捕捉しない、もしくは違う例外を発生させるなら、その例外
     は呼び出し元へ伝搬されます。

     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__: 14e2. 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: 15e5. 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 ‘close()’.  If the generator function is already
     closed, or raises ‘GeneratorExit’ (by not catching the exception),
     ‘close()’ returns *note None: 886.  If the generator yields a
     value, a *note RuntimeError: 246. 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,
     ‘close()’ returns ‘None’ and has no other effect.

     バージョン 3.13 で変更: If a generator returns a value upon being
     closed, the value is returned by ‘close()’.


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;
サブジェネレータへの委譲構文: 123f. を参照してください。


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 非同期ジェネレータ: 24fb. 関数として定義されます
。

非同期ジェネレータ関数が呼び出されると、非同期ジェネレータオブジェクトと
呼ばれる非同期イテレータが返されます。 そして、そのオブジェクトはジェネ
レータ関数の実行を制御します。 通常、非同期ジェネレータオブジェクトは、
コルーチン関数内の *note async for: ca5. 文で使われ、これはジェネレータ
オブジェクトが *note for: 348. 文で使われる様子に類似します。

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: 24fa. 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__(): 2500. is used then the result is *note
None: 886.  Otherwise, if *note asend(): ada. 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: 180,
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(): ad9. method to finalize the generator and ultimately detach it
from the event loop.

非同期ジェネレータ関数では、 *note try: 8f9. 構造内の任意の場所で yield
式が使用できます。 ただし、非同期ジェネレータが、(参照カウントがゼロに達
するか、ガベージコレクションによる) 終了処理より前に再開されない場合、
‘try’ 構造内の yield 式は失敗となり、実行待ちだった *note finally: 1b1.
節が実行されます。 このケースでは、非同期ジェネレータが作動しているイベ
ントループやスケジューラの責務は、非同期ジェネレータの *note aclose():
ad9. メソッドを呼び出し、残りのコルーチンオブジェクトを実行し、それによ
って実行待ちだった ‘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(): ad9. and
executes the coroutine.  This 'finalizer' may be registered by calling
*note sys.set_asyncgen_hooks(): 19fc.  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__(): 2500. method, the current yield
     expression always evaluates to *note None: 886. in the returned
     awaitable, which when run will continue to the next yield
     expression.  The value of the *note yield_list: 24fa. of the yield
     expression is the value of the *note StopIteration: df9. exception
     raised by the completing coroutine.  If the asynchronous generator
     exits without yielding another value, the awaitable instead raises
     a *note StopAsyncIteration: 1e6c. exception, signalling that the
     asynchronous iteration has completed.

     このメソッドは通常、 *note for: 348. ループによって暗黙に呼び出され
     ます。

 -- メソッド: async agen.asend (value)

     Returns an awaitable which when run resumes the execution of the
     asynchronous generator.  As with the *note send(): 1271. 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 ‘asend()’
     method will return the next value yielded by the generator as the
     value of the raised *note StopIteration: df9, or raises *note
     StopAsyncIteration: 1e6c. if the asynchronous generator exits
     without yielding another value.  When ‘asend()’ is called to start
     the asynchronous generator, it must be called with *note None: 886.
     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: df9. exception.  If the asynchronous
     generator exits without yielding another value, a *note
     StopAsyncIteration: 1e6c. 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: 15e5. 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
     ‘GeneratorExit’ (by not catching the exception), then the returned
     awaitable will raise a *note StopIteration: df9. exception.  Any
     further awaitables returned by subsequent calls to the asynchronous
     generator will raise a *note StopAsyncIteration: 1e6c. exception.
     If the asynchronous generator yields a value, a *note RuntimeError:
     246. 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 ‘aclose()’ will
     return an awaitable that does nothing.


File: python.info,  Node: プライマリ,  Next: Await 式,  Prev: アトム、原子的要素 atom,  Up: 式 expression

4.6.3 プライマリ
----------------

プライマリは、言語において最も結合の強い操作を表します。文法は以下のよう
になります:

     primary: *note atom: 24cc. | *note attributeref: 2506. | *note subscription: 2507. | *note call: 2508.

* Menu:

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


File: python.info,  Node: 属性参照,  Next: Subscriptions and slicings,  Up: プライマリ

4.6.3.1 属性参照
................

属性参照は、プライマリの後ろにピリオドと名前を連ねたものです:

     attributeref: *note primary: 2505. "." *note identifier: 231d.

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__(): dcf. 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: 2434. - for example, to get a value from a *note
dict: 184.:

     >>> 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: 2504. - 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: 2444. (for mappings), *note index: 2443.
(for sequences), or 'type argument' (for *note generic types: 1a2.).
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__(): 947. *note special method: 1cbd. with the subscript
as argument.  For more details on which of these methods is called, see
*note __class_getitem__ versus __getitem__: 242d.

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: 2487. or
*note deletion: 1b7e. statements.  In these cases, the interpreter will
call the subscripted object's *note __setitem__(): 14e7. or *note
__delitem__(): 14e8. *note special method: 1cbd, 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: 2394.  In this form, the
subscript is a *note slice: 250e.: 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: 2405, *note stop: 2406. and *note step:
2407. attributes, respectively, are the results of the expressions
between the colons.  Any missing expression evaluates to *note None:
886.  This ‘slice’ object is then passed to the *note __getitem__():
588. or *note __class_getitem__(): 947. *note special method: 1cbd, 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__(): 947. *note special method: 1cbd, 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__(): 947.:

     # 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: 2505. '[' *note subscript: 2512. ']'
     subscript:        *note single_subscript: 2513. | *note tuple_subscript: 2514.
     single_subscript: *note proper_slice: 2515. | *note assignment_expression: 248d.
     proper_slice:     [*note expression: 183.] ":" [*note expression: 183.] [ ":" [*note expression: 183.] ]
     tuple_subscript:  ','.(*note single_subscript: 2513. | *note starred_expression: 24e4.)+ [',']

Recall that the ‘|’ operator *note denotes ordered choice: 22e0.
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: 2517.) を
*note arguments: 67b. の系列とともに呼び出します。系列は空の系列であって
もかまいません:

     call:                 *note primary: 2505. "(" [*note argument_list: 2518. [","] | *note comprehension: 24e6.] ")"
     argument_list:        *note positional_arguments: 2519. ["," *note starred_and_keywords: 251a.]
                             ["," *note keywords_arguments: 251b.]
                           | *note starred_and_keywords: 251a. ["," *note keywords_arguments: 251b.]
                           | *note keywords_arguments: 251b.
     positional_arguments: *note positional_item: 251c. ("," *note positional_item: 251c.)*
     positional_item:      *note assignment_expression: 248d. | "*" *note expression: 183.
     starred_and_keywords: ("*" *note expression: 183. | *note keyword_item: 251d.)
                           ("," "*" *note expression: 183. | "," *note keyword_item: 251d.)*
     keywords_arguments:   (*note keyword_item: 251d. | "**" *note expression: 183.)
                           ("," *note keyword_item: 251d. | "," "**" *note expression: 183.)*
     keyword_item:         *note identifier: 231d. "=" *note expression: 183.

最後の位置引数やキーワード引数の後にカンマをつけてもかまいません。構文の
意味付けに影響を及ぼすことはありません。

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 関数定義: 2074. for
the syntax of formal *note parameter: 23a7. lists.

キーワード引数が存在する場合、以下のようにして最初に位置引数 (positional
argument) に変換されます。まず、値の入っていないスロットが仮引数に対して
生成されます。N 個の位置引数がある場合、位置引数は先頭の N スロットに配
置されます。次に、各キーワード引数について、識別子を使って対応するスロッ
トを決定します (識別子が最初の仮引数名と同じなら、最初のスロットを使う、
といった具合です)。スロットがすでにすべて埋まっていたなら *note
TypeError: 199. 例外が送出されます。それ以外の場合、引数をスロットに埋め
ていきます。 (式が ‘None’ であっても、その式でスロットを埋めます)。全て
の引数が処理されたら、まだ埋められていないスロットをそれぞれに対応する関
数定義時のデフォルト値で埋めます。(デフォルト値は、関数が定義されたとき
に一度だけ計算されます; 従って、リストや辞書のような変更可能なオブジェク
トがデフォルト値として使われると、対応するスロットに引数を指定しない限り
、このオブジェクトが全ての呼び出しから共有されます; このような状況は通常
避けるべきです。) デフォルト値が指定されていない、値の埋められていないス
ロットが残っている場合 ‘TypeError’ 例外が送出されます。そうでない場合、
値の埋められたスロットからなるリストが呼び出しの引数として使われます。

実装では、名前を持たない位置引数を受け取る組み込み関数を提供されるかもし
れません。そういった引数がドキュメント化のために '名付けられて' いたとし
ても、実際には名付けられていないのでキーワードでは提供されません。
CPython では、C 言語で実装された関数の、名前を持たない位置引数をパースす
るために *note PyArg_ParseTuple(): 3bf. を使用します。

仮引数スロットの数よりも多くの位置引数がある場合、構文 ‘*identifier’ を
使って指定された仮引数がないかぎり、 *note TypeError: 199. 例外が送出さ
れます; 仮引数 ‘*identifier’ がある場合、この仮引数は余分な位置引数が入
ったタプル (もしくは、余分な位置引数がない場合には空のタプル) を受け取り
ます。

キーワード引数のいずれかが仮引数名に対応しない場合、構文 ‘**identifier’
を使って指定された仮引数がない限り、 *note TypeError: 199. 例外が送出さ
れます; 仮引数 ‘**identifier’ がある場合、この仮引数は余分なキーワード引
数が入った (キーワードをキーとし、引数値をキーに対応する値とした) 辞書を
受け取ります。余分なキーワード引数がない場合には、空の (新たな) 辞書を受
け取ります。

関数呼び出しに ‘*expression’ という構文が現れる場合は、 ‘expression’ の
評価結果は *note イテラブル: 12f5. でなければなりません。 そのイテラブル
の要素は、追加の位置引数であるかのように扱われます。 ‘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 マッピング: 13d7. でなければなりません。その内容は追加のキー
ワード引数として扱われます。 キーにマッチする引数が (明示的なキーワード
引数によって、あるいは他のアンパックの中で) 既に値を与えられていたなら、
*note TypeError: 199. 例外が送出されます。

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: 199. 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 関数定義: 2074.  When the code block executes a *note return:
     1b0. statement, this specifies the return value of the function
     call.  If execution reaches the end of the code block without
     executing a ‘return’ statement, the return value is ‘None’.

組み込み関数またはメソッド:

     結果はインタプリタに依存します; 組み込み関数やメソッドの詳細は
     *note 組み込み関数: 1478. を参照してください。

クラスオブジェクト:

     そのクラスの新しいインスタンスが返されます。

クラスインスタンスメソッド:

     対応するユーザ定義の関数が呼び出されます。このとき、呼び出し時の引
     数リストより一つ長い引数リストで呼び出されます: インスタンスが引数
     リストの先頭に追加されます。

クラスインスタンス:

     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: f77. 内でのみ使用できます。

     await_expr: "await" *note primary: 2505.

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: 251f. | *note primary: 2505.) ["**" *note u_expr: 2523.]

従って、べき乗演算子と単項演算子からなる演算列が丸括弧で囲われていない場
合、演算子は右から左へと評価されます (この場合は演算子の評価順序を強制し
ません。つまり ‘-1**2’ は ‘-1’ になります)。

The power operator has the same semantics as the built-in *note pow():
1a5. 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: 24c9, and the result is of
that type.

整数の被演算子では、第二引数が負でない限り、結果は被演算子と同じ型になり
ます; 第二引数が負の場合、全ての引数は浮動小数点型に変換され、浮動小数点
型が返されます。例えば ‘10**2’ は ‘100’ を返しますが、‘10**-2’ は ‘0.01’
を返します。

‘0.0’ を負の数でべき乗すると *note ZeroDivisionError: b43. を送出します
。負の数を小数でべき乗した結果は複素数 (*note complex: 198. number) にな
ります。 (以前のバージョンでは *note ValueError: 2ee. を送出していました
)

This operation can be customized using the special *note __pow__(): 9d8.
and *note __rpow__(): 1a6. 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: 2522. | "-" *note u_expr: 2523. | "+" *note u_expr: 2523. | "~" *note u_expr: 2523.

The unary ‘-’ (minus) operator yields the negation of its numeric
argument; the operation can be overridden with the *note __neg__():
2463. special method.

The unary ‘+’ (plus) operator yields its numeric argument unchanged; the
operation can be overridden with the *note __pos__(): 2464. 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__(): 2466. special method.

上記の三つはいずれも、引数が正しい型でない場合には *note TypeError: 199.
例外が送出されます。


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: 2523. | *note m_expr: 2526. "*" *note u_expr: 2523. | *note m_expr: 2526. "@" *note m_expr: 2526. |
             *note m_expr: 2526. "//" *note u_expr: 2523. | *note m_expr: 2526. "/" *note u_expr: 2523. |
             *note m_expr: 2526. "%" *note u_expr: 2523.
     a_expr: *note m_expr: 2526. | *note a_expr: 2527. "+" *note m_expr: 2526. | *note a_expr: 2527. "-" *note m_expr: 2526.

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: 24c9. 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__():
2440. and *note __rmul__(): 2441. 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__():
f7d. and *note __rmatmul__(): f7e. 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: 24c9.  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: b43.
exception.

The division operation can be customized using the special *note
__truediv__(): 1094. and *note __rtruediv__(): 2451. methods.  The floor
division operation can be customized using the special *note
__floordiv__(): 1712. and *note __rfloordiv__(): 2452. 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: 24c9.  A zero right argument raises the
*note ZeroDivisionError: b43. 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(): b9d.:
‘divmod(x, y) == (x//y, x%y)’ とも関係しています。 (2) 。

‘%’ 演算子は、数値に対する剰余演算を行うのに加えて、文字列 (string) オブ
ジェクトにオーバーロードされ、旧式の文字列の書式化 (いわゆる補間) を行い
ます。文字列の書式化の構文は Python ライブラリリファレンス *note printf
形式の文字列書式化: 8dc. 節を参照してください。

The 'modulo' operation can be customized using the special *note
__mod__(): 244a. and *note __rmod__(): fd9. methods.

The floor division operator, the modulo operator, and the *note
divmod(): b9d. function are not defined for complex numbers.  Instead,
convert to a floating-point number using the *note abs(): 20e9. 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: 24c9. and then added together.  In the latter case, the
sequences are concatenated.

This operation can be customized using the special *note __add__():
243d. and *note __radd__(): 243e. 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:
24c9.

This operation can be customized using the special *note __sub__():
2449. and *note __rsub__(): 2450. 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(): 2528. は、最
初の引数と符号が一致するような値を返すので、上記の場合には ‘-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: 2527. | *note shift_expr: 252b. ("<<" | ">>") *note a_expr: 2527.

これらは整数を引数にとります。引数は共通の型に変換されます。シフト演算は
第一引数を、第二引数で与えられたビット数だけ、左または右にビットシフトし
ます。

The left shift operation can be customized using the special *note
__lshift__(): 244b. and *note __rlshift__(): 2454. methods.  The right
shift operation can be customized using the special *note __rshift__():
244c. and *note __rrshift__(): 2455. 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: 252b. | *note and_expr: 252e. "&" *note shift_expr: 252b.
     xor_expr: *note and_expr: 252e. | *note xor_expr: 252f. "^" *note and_expr: 252e.
     or_expr:  *note xor_expr: 252f. | *note or_expr: 235e. "|" *note xor_expr: 252f.

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__(): 244d. or *note __rand__(): 2456. 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__(): 244e. or *note __rxor__(): 2457. 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__(): 244f. or *note __ror__(): 2458. 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: 235e. (*note comp_operator: 2533. *note or_expr: 235e.)*
     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(): 3c1. 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 オブジェクト、値、および型: 2388. の章では、オブジェクトは (型や
id に加えて) 値を持つことを述べています。 オブジェクトの値は Python では
やや抽象的な概念です: 例えば、オブジェクトの値にアクセスする正統な方法は
ありません。 また、その全てのデータ属性から構成されるなどの特定の方法で
、オブジェクトの値を構築する必要性もありません。 比較演算子は、オブジェ
クトの値とは何かについての特定の概念を実装しています。 この比較の実装に
よって、間接的にオブジェクトの値を定義していると考えることもできます。

Because all types are (direct or indirect) subtypes of *note object:
c82, they inherit the default comparison behavior from ‘object’.  Types
can customize their comparison behavior by implementing 'rich comparison
methods' like *note __lt__(): 14bc, described in *note
基本的なカスタマイズ: 240d.

等価比較 (‘==’ および ‘!=’) のデフォルトの振る舞いは、オブジェクトの同一
性に基づいています。 従って、同一のインスタンスの等価比較の結果は等しい
となり、同一でないインスタンスの等価比較の結果は等しくないとなります。 デ
フォルトの振る舞いをこのようにしたのは、全てのオブジェクトを反射的
(reflexive つまり ‘x is y’ ならば ‘x == y’) なものにしたかったからです。

デフォルトの順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は提供されません; 比較しよう
とすると *note TypeError: 199. が送出されます。 この振る舞いをデフォルト
の振る舞いにした動機は、等価性と同じような不変性が欠けているからです。

同一でないインスタンスは常に等価でないとする等価比較のデフォルトの振る舞
いは、型が必要とするオブジェクトの値や値に基づいた等価性の実用的な定義と
は対照的に思えるでしょう。 そのような型では比較の振る舞いをカスタマイズ
する必要が出てきて、実際にたくさんの組み込み型でそれが行われています。

次のリストでは、最重要の組み込み型の比較の振る舞いを解説しています。

   * いくつかの組み込みの数値型 (*note 数値型 int, float, complex:
     2038.) と標準ライブラリの型 *note fractions.Fraction: 215. および
     *note decimal.Decimal: 200. は、これらの型の範囲で異なる型とも比較
     できますが、複素数では順序比較がサポートされていないという制限があ
     ります。 関わる型の制限の範囲内では、精度のロス無しに数学的に (アル
     ゴリズム的に) 正しい比較が行われます。

     非数値である ‘float('NaN')’ と ‘decimal.Decimal('NaN')’ は特別です
     。 数と非数値との任意の順序比較は偽です。 直観に反する帰結として、
     非数値は自分自身と等価ではないことになります。 例えば ‘x =
     float('NaN')’ ならば、 ‘3 < x’, ‘x < 3’, ‘x == x’ は全て偽で、‘x !=
     x’ は真です。 この振る舞いは IEEE 754 に従ったものです。

   * ‘None’ and *note NotImplemented: 1a3. 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: 193. または *note bytearray: 342.
     のインスタンス) は、これらの型の範囲で異なる型とも比較できます。 比
     較は要素の数としての値を使った辞書式順序で行われます。

   * 文字列 (*note str: 16a. のインスタンス) の比較は、文字の Unicode の
     コードポイントの数としての値 (組み込み関数 *note ord(): 2397. の返
     り値) を使った辞書式順序で行われます。 (2)

     文字列とバイナリシーケンスは直接には比較できません。

   * シーケンス (*note tuple: 614, *note list: 24f, or *note range: b41.
     のインスタンス) の比較は、同じ型どうしでしか行えず、 range は順序比
     較をサポートしていません。 異なる型どうしの等価比較の結果は等価でな
     いとなり、異なる型どうしの順序比較は *note TypeError: 199. を送出し
     ます。

     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: 184. のインスタンス) の比較の結果が等価とな
     るのは、同じ ‘(key, value)’ を持っているときかつそのときに限ります
     。 キーと値の等価比較では反射性が強制されます。

     順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は *note TypeError: 199. を送出しま
     す。

   * 集合 (*note set: 185. または *note frozenset: 7f2. のインスタンス)
     の比較は、これらの型の範囲で異なる型とも行えます。

     集合には、部分集合あるいは上位集合かどうかを基準とする順序比較が定
     義されています。 この関係は全順序を定義しません (例えば、 ‘{1,2}’ と
     ‘{2,3}’ という2つの集合は片方がもう一方の部分集合でもなく上位集合で
     もありません)。 従って、集合は全順序性に依存する関数の引数として適
     切ではありません (例えば、 *note min(): 110f, *note max(): 1110,
     *note sorted(): dcb. は集合のリストを入力として与えると未定義な結果
     となります)。

     集合の比較では、その要素の反射性が強制されます。

   * 他の組み込み型のほとんどは比較メソッドが実装されておらず、デフォル
     トの比較の振る舞いを継承します。

比較の振る舞いをカスタマイズしたユーザ定義クラスは、可能なら次の一貫性の
規則に従う必要があります:

   * 等価比較は反射的でなければなりません。 つまり、同一のオブジェクトは
     等しくなければなりません:

          ‘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(): 1148. デコレータも参照してください。

   * *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(): 8e5. を使ってください。


File: python.info,  Node: 所属検査演算,  Next: 同一性の比較,  Prev: 値の比較,  Up: 比較

4.6.10.2 所属検査演算
.....................

演算子 *note in: 349. および *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__(): 15d7.
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__(): 15d7.
but do define *note __iter__(): e6d, ‘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: 349. 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: 1753. exception.
(If any other exception is raised, it is as if *note in: 349. raised
that exception).

演算子 *note not in: 841. は *note in: 349. の真理値を反転した値として定
義されています。


File: python.info,  Node: 同一性の比較,  Prev: 所属検査演算,  Up: 比較

4.6.10.3 同一性の比較
.....................

演算子 *note is: 34a. および *note is not: 2537. は、オブジェクトの同一
性に対するテストを行います: ‘x is y’ は、 'x' と 'y' が同じオブジェクト
を指すとき、かつそのときに限り真になります。 オブジェクトの同一性は
*note id(): 1641. 関数を使って判定されます。 ‘x is not y’ は ‘is’ の真値
を反転したものになります。 (1)

   ---------- Footnotes ----------

   (1) 自動的なガベージコレクション、フリーリスト、ディスクリプタの動的
特性のために、インスタンスメソッドや定数の比較を行うようなときに *note
is: 34a. 演算子の利用は、一見すると普通ではない振る舞いだと気付くかもし
れません。詳細はそれぞれのドキュメントを確認してください。


File: python.info,  Node: ブール演算 boolean operation,  Next: 代入式<2>,  Prev: 比較,  Up: 式 expression

4.6.11 ブール演算 (boolean operation)
-------------------------------------

     or_test:  *note and_test: 253b. | *note or_test: 24e9. "or" *note and_test: 253b.
     and_test: *note not_test: 253c. | *note and_test: 253b. "and" *note not_test: 253c.
     not_test: *note comparison: 2532. | "not" *note not_test: 253c.

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__():
14f1. method.

演算子 *note not: 253a. は、引数が偽である場合には ‘True’ を、それ以外の
場合には ‘False’ になります。

式 ‘x and y’ は、まず 'x' を評価します; 'x' が偽なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

式 ‘x or y’ は、まず 'x' を評価します; 'x' が真なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

なお、 *note and: 347. も *note or: 34b. も、返す値を ‘True’ や ‘False’
に制限せず、最後に評価した引数を返します。 この仕様が便利なときもありま
す。例えば ‘s’ が文字列で、空文字列ならデフォルトの値に置き換えたいとき
、式 ‘s or 'foo'’ は望んだ値を与えます。 *note not: 253a. は必ず新しい値
を作成するので、引数の型に関係なくブール値を返します (例えば、 ‘not
'foo'’ は ‘''’ ではなく ‘False’ になります)。


File: python.info,  Node: 代入式<2>,  Next: 条件式 Conditional Expressions,  Prev: ブール演算 boolean operation,  Up: 式 expression

4.6.12 代入式
-------------

     assignment_expression: [*note identifier: 231d. ":="] *note expression: 183.

An assignment expression (sometimes also called a "named expression" or
"walrus") assigns an *note expression: 183. to an *note identifier:
231d, while also returning the value of the ‘expression’.

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: 24e9. ["if" *note or_test: 24e9. "else" *note expression: 183.]
     expression:             *note conditional_expression: 235d. | *note lambda_expr: 2540.

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: 2543.] ":" *note expression: 183.

ラムダ式 (ラムダ形式とも呼ばれます) は無名関数を作成するのに使います。 式
‘lambda parameters: expression’ は関数オブジェクトになります。 この無名
オブジェクトは以下に定義されている関数オブジェクト同様に動作します:

     def <lambda>(parameters):
         return expression

引数の一覧の構文は *note 関数定義: 2074. を参照してください。ラムダ式で
作成された関数は文やアノテーションを含むことができない点に注意してくださ
い。


File: python.info,  Node: 式のリスト,  Next: 評価順序,  Prev: ラムダ lambda,  Up: 式 expression

4.6.15 式のリスト
-----------------

     starred_expression:       "*" *note or_expr: 235e. | *note expression: 183.
     flexible_expression:      *note assignment_expression: 248d. | *note starred_expression: 24e4.
     flexible_expression_list: *note flexible_expression: 2545. ("," *note flexible_expression: 2545.)* [","]
     starred_expression_list:  *note starred_expression: 24e4. ("," *note starred_expression: 24e4.)* [","]
     expression_list:          *note expression: 183. ("," *note expression: 183.)* [","]
     yield_list:               *note expression_list: 2547. | *note starred_expression: 24e4. "," [*note starred_expression_list: 2546.]

リスト表示や辞書表示の一部になっているものを除き、少なくとも一つのカンマ
を含む式のリストはタプルになります。 タプルの長さは、リストにある式の数
に等しくなります。 式は左から右へ評価されます。

An asterisk ‘*’ denotes 'iterable unpacking'.  Its operand must be an
*note iterable: 12f5.  The iterable is expanded into a sequence of
items, which are included in the new tuple, list, or set, at the site of
the unpacking.

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 比較: 2530. 節で述べられているように、比較、所属、同一性のテストは
全てが同じ優先順位を持っていて、左から右に連鎖するという特徴を持っている
ことに注意してください。

演算子                                              説明
                                                    
----------------------------------------------------------------------------------------------
                                                    
‘(expressions...)’,                                 結合式または括弧式、リスト表示、辞書表
                                                    示、集合表示
‘[expressions...]’, ‘{key: value...}’,              
‘{expressions...}’

‘x[index]’, ‘x[index:index]’ ‘x(arguments...)’,     Subscription (including slicing), call,
‘x.attribute’                                       attribute reference
                                                    
                                                    
*note await x: 18e.                                 Await 式
                                                    
                                                    
‘**’                                                べき乗 (1)
                                                    
                                                    
‘+x’, ‘-x’, ‘~x’                                    正数、負数、ビット単位 NOT
                                                    
                                                    
‘*’, ‘@’, ‘/’, ‘//’, ‘%’                            乗算、行列乗算、除算、切り捨て除算、剰
                                                    余 (2)
                                                    
                                                    
‘+’, ‘-’                                            加算および減算
                                                    
                                                    
‘<<’, ‘>>’                                          シフト演算
                                                    
                                                    
‘&’                                                 ビット単位 AND
                                                    
                                                    
‘^’                                                 ビット単位 XOR
                                                    
                                                    
‘|’                                                 ビット単位 OR
                                                    
                                                    
*note in: 349, *note not in: 841, *note is: 34a,    所属や同一性のテストを含む比較
*note is not: 2537, ‘<’, ‘<=’, ‘>’, ‘>=’, ‘!=’,     
‘==’

*note not x: 253a.                                  ブール演算 NOT
                                                    
                                                    
*note and: 347.                                     ブール演算 AND
                                                    
                                                    
*note or: 34b.                                      ブール演算 OR
                                                    
                                                    
*note if: 17e. - ‘else’                             条件式
                                                    
                                                    
*note lambda: 14b9.                                 ラムダ式
                                                    
                                                    
‘:=’                                                代入式
                                                    

脚注
....

   ---------- 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: 2551.
                  | *note assert_stmt: 2552.
                  | *note assignment_stmt: 2553.
                  | *note augmented_assignment_stmt: 2554.
                  | *note annotated_assignment_stmt: 2555.
                  | *note pass_stmt: 2556.
                  | *note del_stmt: 2557.
                  | *note return_stmt: 2558.
                  | *note yield_stmt: 2559.
                  | *note raise_stmt: 255a.
                  | *note break_stmt: 255b.
                  | *note continue_stmt: 255c.
                  | *note import_stmt: 255d.
                  | *note future_stmt: 255e.
                  | *note global_stmt: 255f.
                  | *note nonlocal_stmt: 2560.
                  | *note type_stmt: 2561.

* 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: 24e4.

式文は式のリスト (単一の式のこともあります) を値評価します。

対話モードでは、値が ‘None’ でなければ、値を組み込み関数 *note repr():
1c3. で文字列に変換して、その結果の文字列を標準出力に一行使って書き出し
ます。 (‘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: 24e8. "=")+ (*note starred_expression: 24e4. | *note yield_expression: 235f.)
     target_list:     *note target: 2565. ("," *note target: 2565.)* [","]
     target:          *note identifier: 231d.
                      | "(" [*note target_list: 24e8.] ")"
                      | "[" [*note target_list: 24e8.] "]"
                      | *note attributeref: 2506.
                      | *note subscription: 2507.
                      | "*" *note target: 2565.

(See section *note プライマリ: 2504. 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 標準型の階層: 238b.).

ターゲットリストは、丸括弧や角括弧で囲まれていてもよく、それに対するオブ
ジェクトの代入は、以下のように再帰的に定義されています。

   * ターゲットリストのターゲットが1つだけでコンマが続いておらず、任意に
     丸括弧で囲われている場合、オブジェクトはそのターゲットに代入されま
     す。

   * その他:

        * "星付き"のターゲットと呼ばれる、頭にアスタリスクが一つ付いたタ
          ーゲットがターゲットリストに一つだけ含まれている場合: オブジェ
          クトはイテラブルで、少なくともターゲットリストのターゲットの数
          よりも一つ少ない要素を持たなければなりません。 星付きのターゲ
          ットより前のターゲットに、イテラブルの先頭の要素が左から右へ代
          入されます。 星付きのターゲットより後ろのターゲットに、イテラ
          ブルの末尾の要素が代入されます。 星付きのターゲットに、イテラ
          ブルの残った要素のリストが代入されます (リスト空でもかまいませ
          ん)。

        * そうでない場合: オブジェクトは、ターゲットリストのターゲットと
          同じ数の要素を持つイテラブルでなければならず、要素は左から右へ
          対応するターゲットに代入されます。

単一のターゲットへの単一のオブジェクトの代入は、以下のようにして再帰的に
定義されています。

   * ターゲットが識別子 (名前) の場合:

        * 名前が現在のコードブロック内の *note global: 4ac. や *note
          nonlocal: 14c3. 文に書かれていないければ: 名前は現在のローカル
          名前空間内のオブジェクトに束縛されます。

        * そうでなければ: 名前はそれぞれグローバル名前空間内か、 *note
          nonlocal: 14c3. で決められた外側の名前空間内のオブジェクトに束
          縛されます。

     名前がすでに束縛済みの場合、再束縛 (rebind) がおこなわれます。再束
     縛によって、以前その名前に束縛されていたオブジェクトの参照カウント
     (reference count) がゼロになった場合、オブジェクトは解放
     (deallocate) され、デストラクタ (destructor) が (存在すれば) 呼び出
     されます。

   * ターゲットが属性参照の場合: 参照されている一次語の式が値評価されま
     す。値は代入可能な属性を伴うオブジェクトでなければなりません; そう
     でなければ、 *note TypeError: 199. が送出されます。次に、このオブジ
     ェクトに対して、被代入オブジェクトを指定した属性に代入してよいか問
     い合わせます; 代入を実行できない場合、例外 (通常は *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__(): 14e7. method
     is called with two arguments: the subscript and the assigned
     object.

     Typically, *note __setitem__(): 14e7. is defined on mutable
     sequence objects (such as lists) and mapping objects (such as
     dictionaries), and behaves as follows.

     一次語が (リストのような) ミュータブルなシーケンスオブジェクトであ
     れば、添字表記は整数を与えなければなりません。整数が負なら、シーケ
     ンスの長さが加算されます。整数は最終的に、シーケンスの長さよりも小
     さな非負の整数でなくてはならず、シーケンスは、そのインデクスに持つ
     要素に被代入オブジェクトを代入してよいか問い合わせられます。インデ
     クスが範囲外なら、 *note IndexError: 1753. が送出されます (添字指定
     されたシーケンスに代入を行っても、リスト要素の新たな追加はできませ
     ん)。

     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: 12f5.  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: 2569. *note augop: 256a. (*note expression_list: 2547. | *note yield_expression: 235f.)
     augtarget:                 *note identifier: 231d. | *note attributeref: 2506. | *note subscription: 2507.
     augop:                     "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="
                                | ">>=" | "<<=" | "&=" | "^=" | "|="

(最後の3つの構文定義については *note プライマリ: 2504. を参照してくださ
い。)

累算代入文は、ターゲット (通常の代入文と違って、アンパックは起こりません
) と式リストを評価し、それら二つの被演算子間で特定の累算代入型の二項演算
を行い、結果をもとのターゲットに代入します。ターゲットは一度しか評価され
ません。

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
クラス属性とインスタンス属性についての注意: 2566. と同様に通常の代入が適
用されます。


File: python.info,  Node: 注釈付き代入文 annotated assignment statements,  Prev: 累算代入文 augmented assignment statement,  Up: 代入文 assignment statement

4.7.2.2 注釈付き代入文 (annotated assignment statements)
........................................................

*note 注釈: f55. 代入は、1 つの文の中で変数や属性のアノテーションとオプ
ションの代入文を組み合わせたものです:

     annotated_assignment_stmt: *note augtarget: 2569. ":" *note expression: 183.
                                ["=" (*note starred_expression: 24e4. | *note yield_expression: 235f.)]

通常の *note 代入文 (assignment statement): 2487. との違いは、代入先が 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__: 456. 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__(): 14e7. or
*note __setattr__(): 23d8. call.

参考
....

PEP 526(1) - Syntax for Variable Annotations

     (クラス変数やインスタンス変数を含んだ) 変数の型注釈を付ける、コメン
     トで表現するのではない文法の追加提案。

PEP 484(2) - Type hints

     *note typing: 10b. モジュールを追加し、静的解析ツールや 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: 183. ["," *note expression: 183.]

単純な形式 ‘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__: 9de. and *note
AssertionError: 8b9. 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: 18d.).  The current code
generator emits no code for an *note assert: b64. 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__: 9de. への代入は不正な操作です。組み込み変数の値は、イン
タプリタが開始するときに決定されます。


File: python.info,  Node: pass 文<2>,  Next: del 文<2>,  Prev: assert 文,  Up: 単純文 simple statement

4.7.4 ‘pass’ 文
---------------

     pass_stmt: "pass"

*note pass: 17f. はヌル操作 (null operation) です -- ‘pass’ が実行されて
も、何も起きません。 ‘pass’ は、構文法的には文が必要だが、コードとしては
何も実行したくない場合のプレースホルダとして有用です。例えば:

     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: 24e8.

オブジェクトの削除 (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: 450. 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: 2547.]

*note return: 1b0. は、関数定義内で構文法的にネストして現れますが、ネス
トしたクラス定義内には現れません。

式リストがある場合、リストが値評価されます。それ以外の場合は ‘None’ で置
き換えられます。

*note return: 1b0. を使うと、式リスト (または ‘None’) を戻り値として、現
在の関数呼び出しから抜け出します。

*note return: 1b0. によって、 *note finally: 1b1. 節をともなう *note
try: 8f9. 文の外に処理が引き渡されると、実際に関数から抜ける前に
‘finally’ 節が実行されます。

ジェネレータ関数では、 *note return: 1b0. 文はジェネレータの終わりを示し
、 *note StopIteration: df9. 例外を送出させます。返された値は (あれば)、
‘StopIteration’ を構成する引数に使われ、 *note StopIteration.value:
2477. 属性になります。

非同期ジェネレータ関数では、引数無しの *note return: 1b0. 文は非同期ジェ
ネレータの終わりを示し、 *note StopAsyncIteration: 1e6c. を送出させます
。 引数ありの ‘return’ 文は、非同期ジェネレータ関数では文法エラーです。


File: python.info,  Node: yield 文,  Next: raise 文,  Prev: return 文,  Up: 単純文 simple statement

4.7.7 ‘yield’ 文
----------------

     yield_stmt: *note yield_expression: 235f.

A *note yield: bc6. statement is semantically equivalent to a *note
yield expression: 24f8.  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: 1270. function, and are only used in the body of the
generator function.  Using *note yield: bc6. in a function definition is
sufficient to cause that definition to create a generator function
instead of a normal function.

*note yield: bc6. の意味の完全な説明は、 *note Yield 式: 24f8. 節を参照
してください。


File: python.info,  Node: raise 文,  Next: break 文,  Prev: yield 文,  Up: 単純文 simple statement

4.7.8 ‘raise’ 文
----------------

     raise_stmt: "raise" [*note expression: 183. ["from" *note expression: 183.]]

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: 246. 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__: 14e2.
attribute.  You can create an exception and set your own traceback in
one step using the *note with_traceback(): 2573. 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__: 14e4. 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: 1ac. or *note finally: 1b1. clause, or a *note with:
187. statement, is used.  The previous exception is then attached as the
new exception's *note __context__: 14e3. 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: 886. 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 例外: 2493. 節にあります。また、例外処理に
関する情報は *note try 文: 8f9. 節にあります。

バージョン 3.3 で変更: *note None: 886. が ‘raise X from Y’ の ‘Y’ とし
て使えるようになりました。

Added the *note __suppress_context__: 2574. attribute to suppress
automatic display of the exception context.

バージョン 3.11 で変更: If the traceback of the active exception is
modified in an *note except: 1ac. 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: 180. 文は、構文としては *note for: 348. ループや *note
while: 19d3. ループの内側でのみ出現することができますが、ループ内の関数
定義やクラス定義の内側には出現できません。

*note break: 180. 文は、文を囲う最も内側のループを終了させ、ループにオプ
ションの ‘else’ 節がある場合にはそれをスキップします。

*note for: 348. ループを *note break: 180. によって終了すると、ループ制
御ターゲットはその時の値を保持します。

*note break: 180. が *note finally: 1b1. 節を伴う *note try: 8f9. 文の外
側に処理を渡す際には、ループを実際に抜ける前にその ‘finally’ 節が実行さ
れます。


File: python.info,  Node: continue 文,  Next: import 文,  Prev: break 文,  Up: 単純文 simple statement

4.7.10 ‘continue’ 文
--------------------

     continue_stmt: "continue"

*note continue: 181. 文は *note for: 348. ループや *note while: 19d3. ル
ープ内のネストで構文法的にのみ現れますが、ループ内の関数定義やクラス定義
の中には現れません。 ‘continue’ 文は、文を囲う最も内側のループの次の周期
に処理を継続します。

*note continue: 181. が *note finally: 1b1. 句を持った *note try: 8f9. 文
を抜けるとき、その ‘finally’ 句が次のループサイクルを始める前に実行され
ます。


File: python.info,  Node: import 文,  Next: global 文,  Prev: continue 文,  Up: 単純文 simple statement

4.7.11 ‘import’ 文
------------------

     import_stmt:     "import" *note module: 2578. ["as" *note identifier: 231d.] ("," *note module: 2578. ["as" *note identifier: 231d.])*
                      | "from" *note relative_module: 2579. "import" *note identifier: 231d. ["as" *note identifier: 231d.]
                      ("," *note identifier: 231d. ["as" *note identifier: 231d.])*
                      | "from" *note relative_module: 2579. "import" "(" *note identifier: 231d. ["as" *note identifier: 231d.]
                      ("," *note identifier: 231d. ["as" *note identifier: 231d.])* [","] ")"
                      | "from" *note relative_module: 2579. "import" "*"
     module:          (*note identifier: 231d. ".")* *note identifier: 231d.
     relative_module: "."* *note module: 2578. | "."+

(*note from: 14c7. 節が無い) 基本の import 文は 2 つのステップで実行され
ます:

  1. モジュールを見付け出し、必要であればロードし初期化する

  2. define a name or names in the current namespace for the scope where
     the *note import: 7f8. statement occurs, just as an assignment
     statement would (including *note global: 4ac. and *note nonlocal:
     14c3. semantics).

文が (カンマで区切られた) 複数の節を含んでいるときは、ちょうどその節が個
別の import 文に分割されたかのように、2つのステップが節ごとに個別に実行
されます。

モジュールを見付け、ロードする 1 つ目のステップの詳細については、 *note
インポートシステム: 23bc. の節により詳しく書かれています。そこでは、イン
ポートシステムの動作をカスタマイズするのに使える全てのフックの仕組みだけ
でなく、様々な種類のインポートできるパッケージとモジュールについても解説
されています。このステップが失敗するということは、おそらくモジュールが見
付からないか、 'あるいは' モジュールにあるコードの実行を含め、モジュール
の初期化の途中でエラーが起きるかのどちらかが起きていることに注意してくだ
さい。

要求したモジュールが無事に取得できた場合、次の 3 つのうちの 1 つの方法で
ローカル名前空間で使えるようになります:

   * モジュール名の後に ‘as’ が続いていた場合は、 ‘as’ の後ろの名前を直
     接、インポートされたモジュールが束縛します。

   * 他の名前が指定されておらず、インポートされているモジュールが最上位
     のモジュールだった場合、そのモジュール名がインポートされたモジュー
     ルへの参照として、ローカル名前空間で束縛されます

   * インポートされているモジュールが最上位のモジュール 'でない' 場合、
     モジュールを含む最上位のパッケージ名が、そのパッケージへの参照とし
     て、ローカル名前空間で束縛されます。インポートされたモジュールには
     、直接ではなく完全修飾名を使ってアクセスしなければなりません

*note from: 14c7. 形式ではもう少し複雑な手順を踏みます:

  1. *note from: 14c7. 節で指定されたモジュールを見付け出し、必要であれ
     ばロードし初期化する;

  2. *note import: 7f8. 節で指定されたそれぞれの識別子に対し以下の処理を
     行う:

       1. インポートされたモジュールがその識別子名の属性を持っているかを
          確認する

       2. その識別子名の属性を持っていなかった場合は、その識別子名でサブ
          モジュールのインポートを試み、インポートされたモジュールにその
          属性があるか再度確認する

       3. 属性が見付からない場合は、 *note ImportError: 65b. を送出する
          。

       4. otherwise, a reference to that value is stored in the current
          namespace, using the name in the ‘as’ clause if it is present,
          otherwise using the attribute name

例:

     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:
2319. 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: 18f. が送出されます。

インポートするモジュールを指定するとき、そのモジュールの絶対名 (absolute
name) を指定する必要はありません。モジュールやパッケージが他のパッケージ
に含まれている場合、共通のトップパッケージからそのパッケージ名を記述する
ことなく相対インポートすることができます。 *note from: 14c7. の後に指定
されるモジュールやパッケージの先頭に複数個のドットを付けることで、正確な
名前を指定することなしに現在のパッケージ階層からいくつ上の階層へ行くかを
指定することができます。先頭のドットが 1 つの場合、 import をおこなって
いるモジュールが存在する現在のパッケージを示します。 3 つのドットは 2 つ
上のレベルを示します。なので、 ‘pkg’ パッケージの中のモジュールで ‘from
. import mod’ を実行すると、 ‘pkg.mod’ をインポートすることになります。
‘pkg.subpkg1’ の中から ‘from ..subpkg2 import mod’ を実行すると、
‘pkg.subpkg2.mod’ をインポートします。相対インポートの仕様は *note
Package Relative Imports: 24be. の節に含まれています。

どのモジュールがロードされるべきかを動的に決めたいアプリケーションのため
に、組み込み関数 *note importlib.import_module(): 73c. が提供されていま
す。

Raises an *note auditing event: 1ccb. ‘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: 257b. ["as" *note identifier: 231d.]
                  ("," *note feature: 257b. ["as" *note identifier: 231d.])*
                  | "from" "__future__" "import" "(" *note feature: 257b. ["as" *note identifier: 231d.]
                  ("," *note feature: 257b. ["as" *note identifier: 231d.])* [","] ")"
     feature:     *note identifier: 231d.

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. があり、これについては後で述べます。
‘__future__’ は、 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 ‘compile()’ -- see the documentation of that function for details.

対話的インタプリタのプロンプトでタイプ入力した future 文は、その後のイン
タプリタセッション中で有効になります。インタプリタを *note -i: 16f9. オ
プションで起動して実行すべきスクリプト名を渡し、スクリプト中に 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: 231d. ("," *note identifier: 231d.)*

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: 18f. 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: 231d. ("," *note identifier: 231d.)*

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: 14c3. 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: 18f. is raised.

The *note nonlocal: 14c3. statement applies to the entire scope of a
function or class body.  A *note SyntaxError: 18f. 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: 14c3. 文の詳細。

'Programmer's note:' *note nonlocal: 14c3. 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: 231d. [*note type_params: 257f.] "=" *note expression: 183.

The ‘type’ statement declares a type alias, which is an instance of
*note typing.TypeAliasType: 2b0.

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: a11.

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: 182. 、 *note while: 19d3. 、および *note for: 348. 文は、伝統
的な制御フロー構成を実現します。 *note try: 8f9. は例外処理および/または
一連の文に対するクリーンアップコードを指定します。それに対して、 *note
with: 187. 文はコードのかたまりの前後でコードの初期化と終了処理を実行で
きるようにします。関数とクラス定義もまた、構文的には複合文です。

複合文は、一つ以上の '節 (clause)' からなります。節は、ヘッダと 'スイー
ト (suite)' からなります。一つの複合文を成す各節のヘッダは、全て同じイン
デントレベルに置かれます。各節のヘッダは一意に識別するキーワードで始まり
、コロンで終わります。スイートは、節によって制御される文の集まりです。ス
イートは、ヘッダがある行のコロンの後にセミコロンで区切って置かれた一つ以
上の単純文、または、ヘッダに続く行で一つ多くインデントされた文の集まりで
す。後者の形式のスイートに限り、さらに複合文をネストできます; 以下の文は
、 *note else: 17d. 節がどちらの *note if: 182. 節に属するかがはっきりし
ないなどの理由から不正になります:

     if test1: if test2: print(x)

また、このコンテキスト中では、セミコロンによる結合はコロンより強いです。
従って、以下の例では、 *note print(): 117b. の呼び出しはは全て実行される
か、全く実行されないかのどちらかです:

     if x < y < z: print(x); print(y); print(z)

まとめると、以下のようになります:

     compound_stmt: *note if_stmt: 2585.
                    | *note while_stmt: 2586.
                    | *note for_stmt: 2587.
                    | *note try_stmt: 2588.
                    | *note with_stmt: 2589.
                    | *note match_stmt: 258a.
                    | *note funcdef: 258b.
                    | *note classdef: 258c.
                    | *note async_with_stmt: 258d.
                    | *note async_for_stmt: 258e.
                    | *note async_funcdef: 258f.
     suite:         *note stmt_list: 2591. NEWLINE | NEWLINE INDENT *note statement: 2592.+ DEDENT
     statement:     *note stmt_list: 2591. NEWLINE | *note compound_stmt: 2584.
     stmt_list:     *note simple_stmt: 2550. (";" *note simple_stmt: 2550.)* [";"]

なお、文は常に ‘NEWLINE’ か、その後に ‘DEDENT’ が続いたもので終了します
。また、オプションの継続節は必ず、文を開始できない予約語で始まるので、曖
昧さは存在しません。 (Python では、 'ぶら下がり (dangling) *note else:
17d.' 問題は、ネストされた *note if: 182. 文をインデントさせることで解決
されます)。

以下の節における文法規則の記述方式は、明確さのために、各節を別々の行に書
くようにしています。
* 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: 182. 文は、条件分岐を実行するために使われます:

     if_stmt: "if" *note assignment_expression: 248d. ":" *note suite: 2590.
              ("elif" *note assignment_expression: 248d. ":" *note suite: 2590.)*
              ["else" ":" *note suite: 2590.]

*note if: 182. 文は、式を一つ一つ評価してゆき、真になるまで続けて、真に
なった節のスイートだけを選択します (真: true と偽: false の定義について
は、 *note ブール演算 (boolean operation): 2538. 節を参照してください);
次に、選択したスイートを実行します (そして、 ‘if’ 文の他の部分は、実行や
評価をされません)。全ての式が偽になった場合、 *note else: 17d. 節があれ
ば、そのスイートが実行されます。


File: python.info,  Node: while 文,  Next: for 文<2>,  Prev: if 文<2>,  Up: 複合文 compound statement

4.8.2 ‘while’ 文
----------------

*note while: 19d3. 文は、式の値が真である間、実行を繰り返すために使われ
ます:

     while_stmt: "while" *note assignment_expression: 248d. ":" *note suite: 2590.
                 ["else" ":" *note suite: 2590.]

*note while: 19d3. 文は式を繰り返し真偽評価し、真であれば最初のスイート
を実行します。式が偽であれば (最初から偽になっていることもありえます)、
‘else’ 節がある場合にはそれを実行し、ループを終了します。

最初のスイート内で *note break: 180. 文が実行されると、 ‘else’ 節のスイ
ートを実行することなくループを終了します。 *note continue: 181. 文が最初
のスイート内で実行されると、スイート内にある残りの文の実行をスキップして
、式の真偽評価に戻ります。


File: python.info,  Node: for 文<2>,  Next: try 文,  Prev: while 文,  Up: 複合文 compound statement

4.8.3 ‘for’ 文
--------------

*note for: 348. 文は、シーケンス (文字列、タプルまたはリスト) や、その他
の反復可能なオブジェクト (iterable object) 内の要素に渡って反復処理を行
うために使われます:

     for_stmt: "for" *note target_list: 24e8. "in" *note starred_expression_list: 2546. ":" *note suite: 2590.
               ["else" ":" *note suite: 2590.]

The *note starred_expression_list: 2546. expression is evaluated once;
it should yield an *note iterable: 12f5. 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): 2487.), 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: 180. 文が実行されると、 ‘else’ 節のス
イートを実行することなくループを終了します。 *note continue: 181. 文が最
初のスイート内で実行されると、スイート内にある残りの文の実行をスキップし
て、次の要素の処理に移るか、これ以上次の要素が無い場合は ‘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(): b41. は、 整数の不変算術列を表します。例えば、 ‘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: 2597. | *note try2_stmt: 2598. | *note try3_stmt: 2599.
     try1_stmt: "try" ":" *note suite: 2590.
                ("except" [*note expression: 183. ["as" *note identifier: 231d.]] ":" *note suite: 2590.)+
                ["else" ":" *note suite: 2590.]
                ["finally" ":" *note suite: 2590.]
     try2_stmt: "try" ":" *note suite: 2590.
                ("except" "*" *note expression: 183. ["as" *note identifier: 231d.] ":" *note suite: 2590.)+
                ["else" ":" *note suite: 2590.]
                ["finally" ":" *note suite: 2590.]
     try3_stmt: "try" ":" *note suite: 2590.
                "finally" ":" *note suite: 2590.

例外に関するその他の情報は *note 例外: 2493. 節にあります。また、 *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: 8f9. 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:
13d2. of the exception object, or to a tuple that contains such a class.

例外がどの ‘except’ 節にも合致しなかった場合、現在のコードを囲うさらに外
側、そして呼び出しスタックへと検索を続けます。 (1)

‘except’ 節のヘッダにある式を値評価するときに例外が発生すると、元々のハ
ンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在の
*note except: 1ac. 節の外側のコードや呼び出しスタックに対して行います
(*note try: 8f9. 文全体が例外を発行したかのように扱われます)。

対応する ‘except’ 節が見つかると、‘except’ 節のスイートが実行されます。
その際、 ‘as’ キーワードが ‘except’ 節に存在すれば、その後で指定されてい
るターゲットに例外が代入されます。全ての ‘except’ 節は実行可能なブロック
を持っていなければなりません。このブロックの末尾に到達すると、通常は
*note try: 8f9. 文全体の直後から実行を継続します。(このことは、ネストさ
れた二つの例外ハンドラが同じ例外に対して存在し、内側のハンドラ内の ‘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(): 89c. を呼
び出す事によってこの例外にアクセスすることができます。 例外ハンドラを抜
けると、 ‘sys’ モジュールに格納されている例外の値が、一つ前の値に戻りま
す:

     >>> 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: 1b1. 節が無い場合
にのみ呼び出しスタックへ伝わります。新しい例外によって、古い例外は失われ
ます。


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:
8f9. statement can have either *note except: 1ac. 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: 199.
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(): 193a.) 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(): 89c.) 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: 8f9. 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: 180, *note continue: 181. and *note return: 1b0. 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: 8f9. スイート
を抜け、例外が送出されず、 *note return: 1b0. 文、 *note continue: 181.
文、 *note break: 180. 文のいずれもが実行されなかった場合に実行されます
。 ‘else’ 節で起きた例外は、手前にある *note except: 1ac. 節では処理され
ません。


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: 8f9. clause is executed, including any *note except: 1ac. and *note
else: 259d. 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: 1b0, *note
break: 180. or *note continue: 181. statement, the saved exception is
discarded.  For example, this function returns 42.

     def f():
         try:
             1/0
         finally:
             return 42

‘finally’ 節を実行している間は、プログラムからは例外情報は利用できません
。

*note try: 8f9...‘finally’ 文の ‘try’ スイート内で *note return: 1b0. 、
*note break: 180. 、または *note continue: 181. 文が実行された場合、
‘finally’ 節も、この文を '抜け出る途中に' 実行されます。

The return value of a function is determined by the last *note return:
1b0. 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: 181. 文は不正でした。

バージョン 3.14 で変更: The compiler emits a *note SyntaxWarning: 1af.
when a *note return: 1b0, *note break: 180. or *note continue: 181.
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: 187. 文は、ブロックの実行を、コンテキストマネージャによって
定義されたメソッドでラップするために使われます (*note
with文とコンテキストマネージャ: 23de. セクションを参照してください)。こ
れにより、よくある *note try: 8f9...*note except: 1ac...*note finally:
1b1. 利用パターンをカプセル化して便利に再利用することができます。

     with_stmt:          "with" ( "(" *note with_stmt_contents: 25a1. ","? ")" | *note with_stmt_contents: 25a1. ) ":" *note suite: 2590.
     with_stmt_contents: *note with_item: 25a2. ("," *note with_item: 25a2.)*
     with_item:          *note expression: 183. ["as" *note target: 2565.]

一つの "要素" を持つ *note with: 187. 文の実行は以下のように進行します:

  1. コンテキスト式 (*note with_item: 25a2. で与えられた式) を評価するこ
     とで、コンテキストマネージャを取得します。

  2. コンテキストマネージャの *note __enter__(): 7e4. メソッドが、後で使
     うためにロードされます。

  3. コンテキストマネージャの *note __exit__(): 151c. メソッドが、後で使
     うためにロードされます。

  4. コンテキストマネージャの *note __enter__(): 7e4. メソッドが呼ばれま
     す。

  5. *note with: 187. 文にターゲットが含まれていたら、それに *note
     __enter__(): 7e4. からの戻り値が代入されます。

          注釈: *note with: 187. 文は、 *note __enter__(): 7e4. メソッド
          がエラーなく終了した場合には *note __exit__(): 151c. が常に呼
          ばれることを保証します。ですので、もしターゲットリストへの代入
          中にエラーが発生した場合には、これはそのスイートの中で発生した
          エラーと同じように扱われます。以下のステップ 7 を参照してくだ
          さい。

  6. スイートが実行されます。

  7. コンテキストマネージャの *note __exit__(): 151c. メソッドが呼ばれま
     す。スイートが例外によって終了されたのなら、その例外の型、値、トレ
     ースバックが ‘__exit__()’ に引数として渡されます。そうでなければ、
     3 つの *note None: 886. 引数が与えられます。

     スイートが例外により終了され、 *note __exit__(): 151c. メソッドから
     の戻り値が偽（false）ならば、例外が再送出されます。この戻り値が真（
     true）ならば例外は抑制され、実行は *note with: 187. 文の次の文から
     続きます。

     もしそのスイートが例外でない何らかの理由で終了した場合、その *note
     __exit__(): 151c. からの戻り値は無視されて、実行は発生した終了の種
     類に応じた通常の位置から継続します。

以下のコード:

     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: 2411. is used for
*note __enter__(): 7e4. and *note __exit__(): 151c.

複数の要素があるとき、コンテキストマネージャは複数の *note with: 187. 文
がネストされたかのように進行します:

     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: 187. 文の仕様、背景、および例が記載されていま
     す。

   ---------- 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: 25a4. ":" NEWLINE INDENT *note case_block: 25a5.+ DEDENT
     subject_expr: *note flexible_expression: 2545. "," [*note flexible_expression_list: 24ee. [',']]
                   | *note assignment_expression: 248d.
     case_block:   'case' *note patterns: 25a6. [*note guard: 25a7.] ":" *note suite: 2590.

     注釈: このセクションでは、一重引用符で囲まれているものは *note
     ソフトキーワード: a11. を表します。

パターンマッチングは、パターン (‘case’ の後ろ) とマッチング対象の値
(‘match’ の後ろ)を入力とします。 パターン (サブパターンを含みうる) は、
マッチング対象の値に対して、マッチするかどうかの判定が行われます。結果と
して次のことが起こります:

   * マッチ成功、もしくはマッチ失敗 (パターン成功・失敗とも呼ばれます)。

   * マッチした値の名前への束縛。必要な条件は後述します。

‘match’ と ‘case’ キーワードは *note ソフトキーワード: a11. です。

参考
....

   * 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 通常のルール: 25a9. に
     従ってタプルが作成されます。

  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" *note assignment_expression: 248d.

‘guard’ (‘case’ 一部として現れる) が成功してはじめて、その ‘case’ ブロッ
クのコードが実行されます。 ガードは *note if: 182. の後に式を書く形で表
記されます。

‘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 パターン: 25ad.

   * 含まれるパターンのうち少なくとも一つが論駁不可能である *note OR
     パターン: 25ae.

   * *note キャプチャパターン: 25af.

   * *note ワイルドカードパターン: a13.

   * 括弧で囲われた、論駁不可能なパターン


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: 25b1. | *note pattern: 25b2.
     pattern:        *note as_pattern: 25b3. | *note or_pattern: 25b4.
     closed_pattern: | *note literal_pattern: 25b6.
                     | *note capture_pattern: 25b7.
                     | *note wildcard_pattern: 25b8.
                     | *note value_pattern: 25b9.
                     | *note group_pattern: 25ba.
                     | *note sequence_pattern: 25bb.
                     | *note mapping_pattern: 25bc.
                     | *note class_pattern: 25bd.

以下の説明では分かりやすさのため、パターンの振る舞いを簡単に言い表した場
合の説明を「簡単に言うと」の後に書いています (そのほとんどは、Raymond
Hettinger 氏のドキュメントに影響を受けてのものです)。 ただし、これはあく
まで理解を助けるためのであり、内部的な実装を必ずしも反映したものでは 'あ
りません' 。 また、使用可能なすべてのパターン構造を網羅しているわけでは
ありません。

* Menu:

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


File: python.info,  Node: OR パターン,  Next: AS パターン,  Up: パターン

4.8.6.5 OR パターン
...................

OR パターンは、縦線 ‘|’ で区切られた複数のパターンからなります。 構文:

     or_pattern: "|".*note closed_pattern: 25b5.+

最後のサブパターン以外、 *note 論駁不可能: 25ab. であってはいけません。
また、曖昧さ回避のため、各サブパターンが束縛する名前の組み合わせは、すべ
て同じである必要があります。

OR パターンでは、サブジェクト値に対して順に各サブパターンのマッチングが
行われます。 マッチが成功するとそこで終了し、この OR パターンは成功した
とみなされます。 一方、どのサブパターンも成功しなければ、この OR パター
ンは失敗したことになります。

簡単に言うと、 ‘P1 | P2 | ...’ というパターンは ‘P1’ をマッチしようとし
、失敗すれば ‘P2’ を試します。 いずれかのパターンがマッチが成功すれば直
ちに成功となり、それ以外の場合は失敗となります。


File: python.info,  Node: AS パターン,  Next: リテラルパターン,  Prev: OR パターン,  Up: パターン

4.8.6.6 AS パターン
...................

AS パターンはサブジェクト値に対して、 *note as: 259f. キーワードの左側に
ある OR パターンをマッチさせます。 構文:

     as_pattern: *note or_pattern: 25b4. "as" *note capture_pattern: 25b7.

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 リテラル: 2325. に対応し
ます。 構文:

     literal_pattern: *note signed_number: 25c2.
                      | *note signed_number: 25c2. "+" NUMBER
                      | *note signed_number: 25c2. "-" NUMBER
                      | *note strings: 24de.
                      | "None"
                      | "True"
                      | "False"
     signed_number:   ["-"] NUMBER

The rule ‘strings’ and the token ‘NUMBER’ are defined in the *note
standard Python grammar: 25c3.  Triple-quoted strings are supported.
Raw strings and byte strings are supported.  *note f-strings: 19b. and
*note t-strings: 1860. are not supported.

‘signed_number '+' NUMBER’ と ‘signed_number '-' NUMBER’ という構文は
*note 複素数: 2377. を表現するためのものです。 そのため、左側には実数、
右側には虚数を書く必要があります。 例: ‘3 + 4j’ 。

簡単に言うと、 ‘LITERAL’ は ‘<subject> == LITERAL’ であるときのみ成功す
るパターンです。 シングルトンである ‘None’ と ‘True’ 、 ‘False’ は *note
is: 34a. 演算子を使って比較されます。


File: python.info,  Node: キャプチャパターン,  Next: ワイルドカードパターン,  Prev: リテラルパターン,  Up: パターン

4.8.6.8 キャプチャパターン
..........................

キャプチャパターンは、サブジェクト値を名前に束縛します。 構文:

     capture_pattern: !'_' NAME

アンダースコア一文字の ‘_’ はキャプチャパターンではありません (‘!'_'’ が
表しているのはこの条件です) 。 *note wildcard_pattern: 25b8. として扱わ
れます。

パターン一つの中で、一つの名前は一度しか束縛することができません。 例え
ば、 ‘case x, x: ...’ は間違いですが、 ‘case [x] | x: ...’ は正しいです
。

キャプチャパターンは常に成功します。 束縛された名前のスコープは、 PEP
572(1) で確立された代入式演算子のスコープルールと同じです。 すなわち、当
てはまる *note global: 4ac. 文 か *note nonlocal: 14c3. 文がない限り、そ
の局所変数のスコープは、該当の 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 ソフトキーワード: a11.
です。 しかし、パターンの中でない場合はソフトキーワードではありません。
たとえサブジェクト式や ‘guard’ 、 ‘case’ ブロックの中でも、通常の変数と
なります。

簡単に言うと、 ‘_’ は常に成功します。


File: python.info,  Node: 値パターン,  Next: グループパターン,  Prev: ワイルドカードパターン,  Up: パターン

4.8.6.10 値パターン
...................

値パターンは Python で名前の付けられた値を表します。 構文:

     value_pattern: *note attr: 25c8.
     attr:          *note name_or_attr: 25c9. "." NAME
     name_or_attr:  *note attr: 25c8. | NAME

ドットがついたこの名前は、Python 標準の *note 名前解決ルール: 248a. によ
って解決されます。 このパターンは、解決された値がサブジェクト値と等しい
(比較演算子 ‘==’ に基づく) ときに成功となります。

簡単に言うと、 ‘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: 25b2. ")"

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: 25ce.] "]"
                             | "(" [*note open_sequence_pattern: 25b1.] ")"
     open_sequence_pattern:  *note maybe_star_pattern: 25cf. "," [*note maybe_sequence_pattern: 25ce.]
     maybe_sequence_pattern: ",".*note maybe_star_pattern: 25cf.+ ","?
     maybe_star_pattern:     *note star_pattern: 25d0. | *note pattern: 25b2.
     star_pattern:           "*" (*note capture_pattern: 25b7. | *note wildcard_pattern: 25b8.)

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: 25ca.  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__(): 17ff. protocol).
          This length may be cached by the interpreter in a similar
          manner as *note value patterns: 25c7.

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: 13e0. を継承したクラス。

   * *note collections.abc.Sequence: 13e0. として登録されたPythonクラス
     。

   * a builtin class that has its (CPython) *note Py_TPFLAGS_SEQUENCE:
     1cb6. 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: 24f.

   * *note memoryview: 166.

   * *note range: b41.

   * *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: 25d3.] "}"
     items_pattern:       ",".*note key_value_pattern: 25d4.+ ","?
     key_value_pattern:   (*note literal_pattern: 25b6. | *note value_pattern: 25b9.) ":" *note pattern: 25b2.
                          | *note double_star_pattern: 25d5.
     double_star_pattern: "**" *note capture_pattern: 25b7.

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: 18f.  Two keys that otherwise have
the same value will raise a *note ValueError: 2ee. 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: 18f. is raised for
     duplicate literal values; or a *note ValueError: 2ee. 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__(): 13d9. 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: acb.

   * a Python class that has been registered as *note
     collections.abc.Mapping: acb.

   * a builtin class that has its (CPython) *note Py_TPFLAGS_MAPPING:
     1cb5. bit set

   * a class that inherits from any of the above

The standard library classes *note dict: 184. 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: 25c9. "(" [*note pattern_arguments: 25d8. ","?] ")"
     pattern_arguments:   *note positional_patterns: 25d9. ["," *note keyword_patterns: 25da.]
                          | *note keyword_patterns: 25da.
     positional_patterns: ",".*note pattern: 25b2.+
     keyword_patterns:    ",".*note keyword_pattern: 25db.+
     keyword_pattern:     NAME "=" *note pattern: 25b2.

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:
     f48. , raise *note TypeError: 199.

  2. If the subject value is not an instance of ‘name_or_attr’ (tested
     via *note isinstance(): 2af.), 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__: 1cd2. 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: 199. is raised.

             * If there are more positional patterns than
               ‘len(cls.__match_args__)’, *note TypeError: 199. 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: 199. is raised.

             * If there are duplicate keywords, *note TypeError: 199. is
               raised.

          参考
          ....

          *note クラスパターンマッチの位置引数のカスタマイズ: 246d.

       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: 3c1.

        * *note bytearray: 342.

        * *note bytes: 193.

        * *note dict: 184.

        * *note float: 197.

        * *note frozenset: 7f2.

        * *note int: 19c.

        * *note list: 24f.

        * *note set: 185.

        * *note str: 16a.

        * *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 標準型の階層:
238b. 節参照):

     funcdef:                   [*note decorators: 25dd.] "def" *note funcname: 25de. [*note type_params: 257f.] "(" [*note parameter_list: 2543.] ")"
                                ["->" *note expression: 183.] ":" *note suite: 2590.
     decorators:                *note decorator: 25df.+
     decorator:                 "@" *note assignment_expression: 248d. NEWLINE
     parameter_list:            *note defparameter: 25e0. ("," *note defparameter: 25e0.)* "," "/" ["," [*note parameter_list_no_posonly: 25e1.]]
                                  | *note parameter_list_no_posonly: 25e1.
     parameter_list_no_posonly: *note defparameter: 25e0. ("," *note defparameter: 25e0.)* ["," [*note parameter_list_starargs: 25e2.]]
                                | *note parameter_list_starargs: 25e2.
     parameter_list_starargs:   "*" [*note star_parameter: 25e3.] ("," *note defparameter: 25e0.)* ["," [*note parameter_star_kwargs: 25e4.]]
                                | "*" ("," *note defparameter: 25e0.)+ ["," [*note parameter_star_kwargs: 25e4.]]
                                | *note parameter_star_kwargs: 25e4.
     parameter_star_kwargs:     "**" *note parameter: 25e5. [","]
     parameter:                 *note identifier: 231d. [":" *note expression: 183.]
     star_parameter:            *note identifier: 231d. [":" ["*"] *note expression: 183.]
     defparameter:              *note parameter: 25e5. ["=" *note expression: 183.]
     funcname:                  *note identifier: 231d.

関数定義は実行可能な文です。関数定義を実行すると、現在のローカルな名前空
間内で関数名を関数オブジェクト (関数の実行可能コードをくるむラッパー) に
束縛します。この関数オブジェクトには、関数が呼び出された際に使われるグロ
ーバルな名前空間として、現在のグローバルな名前空間への参照が入っています
。

関数定義は関数本体を実行しません; 関数本体は関数が呼び出された時にのみ実
行されます。 (1)

関数定義は一つ以上の *note デコレータ: 93e. 式でラップできます。デコレー
タ式は関数を定義するとき、関数定義の入っているスコープで評価されます。そ
の結果は、関数オブジェクトを唯一の引数にとる呼び出し可能オブジェクトでな
ければなりません。関数オブジェクトの代わりに、返された値が関数名に束縛さ
れます。複数のデコレータはネストして適用されます。例えば、以下のようなコ
ード:

     @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: 248d.  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__: 23a9. attribute.  See *note
Generic functions: 682. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

1 つ以上の *note 仮引数: 23a7. が '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): f81. 節で
述べられています。 関数呼び出しを行うと、パラメタリストに記述された全て
のパラメタに、位置引数、キーワード引数、デフォルト値のいずれかから値が代
入されます。 "‘*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: 2075. 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: 25e6. for more information on annotations.

バージョン 3.11 で変更: Parameters of the form "‘*identifier’" may have
an annotation "‘: *expression’".  See PEP 646(4).

式を即時に使用するために、無名関数 (名前に束縛されていない関数) を作成す
ることもできます。 これは *note ラムダ (lambda): 14b9. の節で解説されて
いるラムダ式を使います。 ラムダ式は簡略化された関数定義の簡略表現に過ぎ
ないことに注意してください; "*note def: 1678." 文で定義された関数もラム
ダ式で作成された関数のように、引数として渡せたり、他の名前に割り当てるこ
とができます。 複数の式とアノテーションが実行できるので、 "‘def’" 形式の
方がより強力です。

'プログラマへのメモ:' 関数は第一級オブジェクトです。関数定義内で実行され
た "‘def’" 文は、返り値や引数として渡せるローカル関数を定義します。ネス
トした関数内で使われる自由変数は、 def を含んでいる関数のローカル変数に
アクセスできます。詳細は *note 名前づけと束縛 (naming and binding):
23a2. 節を参照してください。

参考
....

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__: 13f5. attribute
and therefore the function's *note docstring: 2348.

   (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 標準型の階層: 238b.
節参照):

     classdef:    [*note decorators: 25dd.] "class" *note classname: 25e8. [*note type_params: 257f.] [*note inheritance: 25e9.] ":" *note suite: 2590.
     inheritance: "(" [*note argument_list: 2518.] ")"
     classname:   *note identifier: 231d.

クラス定義は実行可能な文です。継承リストは通常、基底クラスリストを与えま
す (より高度な使い方は、 *note メタクラス: 241e. を参照してください)。で
すから、リストのそれぞれの要素の評価はサブクラス化しても良いクラスである
べきです。継承リストのないクラスは、デフォルトで、基底クラス *note
object: c82. を継承するので:

     class Foo:
         pass

は、以下と同等です

     class Foo(object):
         pass

次にクラスのスイートが、新たな実行フレーム (*note 名前づけと束縛 (naming
and binding): 23a2. を参照してください) 内で、新たに作られたローカル名前
空間と元々のグローバル名前空間を使って実行されます (通常、このスイートに
は主に関数定義が含まれます)。クラスのスイートが実行し終えると、実行フレ
ームは破棄されますが、ローカルな名前空間は保存されます。(1) 次に、継承リ
ストを基底クラスに、保存されたローカル名前空間を属性値辞書に、それぞれ使
ってクラスオブジェクトが生成されます。最後に、もとのローカル名前空間にお
いて、クラス名がこのクラスオブジェクトに束縛されます。

The order in which attributes are defined in the class body is preserved
in the new class's *note __dict__: e5b.  Note that this is reliable only
right after the class is created and only for classes that were defined
using the definition syntax.

クラス作成は、 *note メタクラス: 241e. を利用して大幅にカスタマイズでき
ます。

関数をデコレートするのと同じように、クラスもデコレートすることが出来ます
、

     @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: 248d.  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__: 23d2. attribute.
See *note Generic classes: 23d3. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

'プログラマのための注釈:' クラス定義内で定義された変数はクラス属性であり
、全てのインスタンス間で共有されます。インスタンス属性は、メソッドの中で
‘self.name = value’ とすることで設定できます。クラス属性もインスタンス属
性も "‘self.name’" 表記でアクセスでき、この表記でアクセスしたとき、イン
スタンス属性は同名のクラス属性を隠蔽します。クラス属性は、インスタンス属
性のデフォルト値として使えますが、そこにミュータブルな値を使うと予期せぬ
結果につながります。 *note 記述子: e4d. を使うと、詳細な実装が異なるイン
スタンス変数を作成できます。

参考
....

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__: 20f1. item and
therefore the class's *note docstring: 2348.

   (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: 25dd.] "async" "def" *note funcname: 25de. "(" [*note parameter_list: 2543.] ")"
                    ["->" *note expression: 183.] ":" *note suite: 2590.

Python で実行しているコルーチンは多くの時点で一時停止と再開ができます
(*note coroutine: 6b9. を参照)。*note await: 18e. 式である *note async
for: ca5. と *note async with: 186. はコルーチン関数の本体でしか使えませ
ん。

Functions defined with ‘async def’ syntax are always coroutine
functions, even if they do not contain ‘await’ or ‘async’ keywords.

コルーチン関数の本体の中で ‘yield from’ 式を使用すると *note
SyntaxError: 18f. になります。

コルーチン関数の例:

     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: 2587.

*note asynchronous iterable: f78. は、その ‘__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: 2411. is used for
*note __aiter__(): dfa. and *note __anext__(): 18e6.

コルーチン関数の本体の外で ‘async for’ 文を使用すると *note SyntaxError:
18f. になります。


File: python.info,  Node: async with 文,  Prev: async for 文,  Up: コルーチン<2>

4.8.9.3 ‘async with’ 文
.......................

     async_with_stmt: "async" *note with_stmt: 2589.

*note asynchronous context manager: 7f0. は、 'enter' メソッドと 'exit'
メソッド内部で実行を一時停止できる *note context manager: 1e3. です。

以下のコード:

     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: 2411. is used for
*note __aenter__(): 247d. and *note __aexit__(): 1a00.

コルーチン関数の本体の外で ‘async with’ 文を使用すると *note
SyntaxError: 18f. になります。

参考
....

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: 25ef. ("," *note type_param: 25ef.)* "]"
     type_param:   *note typevar: 25f0. | *note typevartuple: 25f1. | *note paramspec: 25f2.
     typevar:      *note identifier: 231d. (":" *note expression: 183.)? ("=" *note expression: 183.)?
     typevartuple: "*" *note identifier: 231d. ("=" *note expression: 183.)?
     paramspec:    "**" *note identifier: 231d. ("=" *note expression: 183.)?

*note Functions: 1678. (including *note coroutines: 7ed.), *note
classes: 14f3. 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__: 25f3. 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: 10b. 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: 1823.  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: 15d,
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: 242b, 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: 45b. ‘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(): 457. and *note typing.get_type_hints():
8c1. 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 つを除く全てのモジュールが初期化されて
いない状態で動作します。 ‘__main__’ は、完全なプログラムを実行する際に、
ローカルおよびグローバルな名前空間を提供するために用いられます。

完全な Python プログラムの構文は、下の節で述べるファイル入力のためのもの
です。

インタプリタは、対話的モード (interactive mode) で起動されることもありま
す; この場合、インタプリタは完全なプログラムを読んで実行するのではなく、
一度に単一の実行文 (複合文のときもあります) を読み込んで実行します。初期
状態の環境は、完全なプログラムを実行するときの環境と同じです; 各実行文は
、 *note __main__: 1. の名前空間内で実行されます。

完全なプログラムは3つの形式でインタープリタに渡せます: *note -c: 1a9.
'string' コマンドラインオプションで、コマンドラインの第 1 引数で渡される
ファイル、あるいは標準入力として渡します。 ファイルや標準入力が tty デバ
イスだった場合、インタープリタは対話モードに入ります。 それ以外の場合は
、ファイルを完全なプログラムとして実行します。


File: python.info,  Node: ファイル入力,  Next: 対話的入力,  Prev: 完全な Python プログラム,  Up: トップレベル要素

4.9.2 ファイル入力
------------------

非対話的なファイルから読み出された入力は、全て同じ形式:

     file_input: (NEWLINE | *note statement: 2592.)* ENDMARKER

をとります。この構文法は、以下の状況で用いられます:

   * (ファイルや文字列内の) 完全な Python プログラムを構文解析するとき;

   * モジュールを構文解析するとき;

   * *note exec(): 4a2. で渡された文字列を構文解析するとき;


File: python.info,  Node: 対話的入力,  Next: 式入力,  Prev: ファイル入力,  Up: トップレベル要素

4.9.3 対話的入力
----------------

対話モードでの入力は、以下の文法の下に構文解析されます:

     interactive_input: [*note stmt_list: 2591.] NEWLINE | *note compound_stmt: 2584. NEWLINE | ENDMARKER

対話モードでは、(トップレベルの) 複合文の最後に空白行を入れなくてはなら
ないことに注意してください; これは、複合文の終端をパーザが検出するための
手がかりとして必要です。


File: python.info,  Node: 式入力,  Prev: 対話的入力,  Up: トップレベル要素

4.9.4 式入力
------------

式入力には *note eval(): 4a3. が使われます。これは先頭の空白を無視します
。 ‘eval()’ に対する文字列引数は、以下の形式をとらなければなりません:

     eval_input: *note expression_list: 2547. 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: 22e0. 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 言語リファレンス: 14b. ではプログラミング言語 Python の厳密
な構文とセマンティクスについて説明されていますが、このライブラリリファレ
ンスマニュアルでは Python とともに配付されている標準ライブラリについて説
明します。また Python 配布物に収められていることの多いオプションのコンポ
ーネントについても説明します。

Python の標準ライブラリはとても拡張性があり、下の長い目次のリストで判る
ように幅広いものを用意しています。このライブラリには、例えばファイル I/O
のように、Python プログラマが直接アクセスできないシステム機能へのアクセ
ス機能を提供する (Cで書かれた) 組み込みモジュールや、日々のプログラミン
グで生じる多くの問題に標準的な解決策を提供するPython で書かれたモジュー
ルが入っています。これら数多くのモジュールには、プラットフォーム固有の事
情をプラットフォーム独立な API へと昇華させることにより、Pythonプログラ
ムに移植性を持たせ、それを高めるという明確な意図があります。

Windows 向けの Python インストーラはたいてい標準ライブラリのすべてを含み
、しばしばそれ以外の追加のコンポーネントも含んでいます。Unix 系のオペレ
ーティングシステムの場合は Python は一揃いのパッケージとして提供されるの
が普通で、オプションのコンポーネントを手に入れるにはオペレーティングシス
テムのパッケージツールを使うことになるでしょう。

標準ライブラリに加えて、数10万のコンポーネントが (独立したプログラムやモ
ジュールからパッケージ、アプリケーション開発フレームワークまで) 活動して
いるコレクションとしてPython Package Index(1) から入手可能です。

* Menu:

* はじめに: はじめに<6>.
* 組み込み関数::
* 組み込み定数::
* 組み込み型::
* 組み込み例外::
* Thread Safety Guarantees::
* テキスト処理サービス::
* バイナリデータ処理::
* データ型::
* 数値と数学モジュール::
* 関数型プログラミング用モジュール::
* ファイルとディレクトリへのアクセス::
* データの永続化::
* データ圧縮とアーカイブ::
* ファイルフォーマット::
* 暗号関連のサービス::
* 汎用オペレーティングシステムサービス::
* コマンドラインインターフェースライブラリ::
* 並行実行::
* ネットワーク通信とプロセス間通信::
* インターネット上のデータの操作::
* 構造化マークアップツール::
* インターネットプロトコルとサポート::
* マルチメディアサービス::
* 国際化::
* Graphical user interfaces with Tk::
* 開発ツール::
* Debugging and Profiling::
* ソフトウェア・パッケージと配布::
* Python ランタイムサービス::
* カスタム Python インタプリタ::
* モジュールのインポート::
* Python言語サービス::
* MS Windows 固有のサービス::
* Unix-specific services::
* モジュールのコマンドラインインターフェース (CLI): モジュールのコマンドラインインターフェース CLI.
* Superseded Modules::
* 削除されたモジュール::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<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 組み込み関数: 1478. の章から始めるとよいでしょう。マニュアル
の他の部分は、この節の内容について知っているものとして書かれているからで
す。

それでは、ショーの始まりです！

* 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(): 8ad. のような他のブロッキング操作は、ブラウザーのイベ
ントループをブロックします。

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():
     1315.) 、プロセスを待機 (*note waitpid(): f9e.) 、シグナルを送信
     (*note kill(): 1583.) 、もしくはプロセスと通信する 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: 22b7.  For more details, see
     *note Android で Python を使う: 22b5. and *note iOS で Python
     を使う: 22bd.

   * サブプロセス:

        * 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(): 20e9.            *note enumerate(): 169f.     *note len(): 840.          *note range(): 261b.
     *note aiter(): 9d9.           *note eval(): 4a3.          *note list(): 2619.         *note repr(): 1c3.
     *note all(): 1640.            *note exec(): 4a2.          *note locals(): 46f.        *note reversed(): a69.
     *note anext(): 9da.                                                                   *note round(): 14f6.
     *note any(): 163f.            'F'                         'M'                         
     *note ascii(): 1604.          *note filter(): a68.        *note map(): 1a0.           'S'
                                   *note float(): 197.         *note max(): 1110.          *note set(): 261c.
     'B'                           *note format(): 19a.        *note memoryview(): 261a.     *note setattr(): 261d.
     *note bin(): 14c4.            *note frozenset(): 2618.     *note min(): 110f.         *note slice(): 694.
     *note bool(): 3c1.                                                                    *note sorted(): dcb.
     *note breakpoint(): 273.      'G'                         'N'                         *note staticmethod(): 451.
     *note bytearray(): 1ef7.      *note getattr(): dce.       *note next(): 9dc.          *note str(): 261e.
     *note bytes(): 1ef6.          *note globals(): 1c67.                                  *note sum(): 695.
                                                               'O'                         *note super(): 1a7.
     'C'                           'H'                         *note object(): c82.        
     *note callable(): 13e2.       *note hasattr(): 6f9.       *note oct(): 14ea.          'T'
     *note chr(): 1a4e.            *note hash(): 801.          *note open(): 318.          *note tuple(): 261f.
     *note classmethod(): 48e.     *note help(): ad8.          *note ord(): 2397.          *note type(): f48.
     *note compile(): 4b1.         *note hex(): 14eb.                                      
     *note complex(): 198.                                     'P'                         'V'
                                   'I'                         *note pow(): 1a5.           *note vars(): 1e7f.
     'D'                           *note id(): 1641.           *note print(): 117b.        
     *note delattr(): 2616.        *note input(): 14f4.        *note property(): 4b3.      'Z'
     *note dict(): 2617.           *note int(): 19c.                                       *note zip(): 1a1.
     *note dir(): 844.             *note isinstance(): 2af.                                
     *note divmod(): b9d.          *note issubclass(): 9c8.                                '_'
                                   *note iter(): 9db.                                      *note __import__(): ad5.
                                                                                      

 -- の関数: abs (number, /)

     数の絶対値を返します。引数は整数、浮動小数点数または *note
     __abs__(): 2465. が実装されたオブジェクトです。引数が複素数なら、そ
     の絶対値 (magnitude) が返されます。

 -- の関数: aiter (async_iterable, /)

     *note asynchronous iterable: f78. から *note asynchronous iterator:
     4c7. を返します。 ‘x.__aiter__()’ を呼び出すのと等価です。

     なお、 *note iter(): 9db. とは異なり、 *note aiter(): 9d9. は第二引
     数を持ちません。

     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(): 9dc. 関数の非同期版であり、同じよう
     に動作します。

     これは 'async_iterator' の *note __anext__(): 18e6. メソッドを呼び
     出し、待ち受け可能オブジェクト (*note awaitable: 4c9.) を返します。
     待ち受けることによりイテレータの次の値を返します。 'default' が与え
     られた場合、イテレータが枯渇したときにその値が返されます。
     'default' が与えられない場合は *note StopAsyncIteration: 1e6c. が送
     出されます。

     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(): 1c3. と同様、オブジェクトの印字可能な表現を含む文字列
     を返しますが、‘repr()’ によって返された文字列中の非 ASCII 文字は
     ‘\x’ 、 ‘\u’ 、 ‘\U’ エスケープを使ってエスケープされます。これは
     Python 2 の ‘repr()’ によって返されるのと同じ文字列を作ります。

 -- の関数: bin (integer, /)

     整数を先頭に "0b" が付いた 2 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     19c. オブジェクトでない場合、整数を返す *note __index__(): 19f. メ
     ソッドが定義されていなければなりません。 いくつかの例を示します:

          >>> bin(3)
          '0b11'
          >>> bin(-10)
          '-0b1010'

     先頭に "0b" が付いて欲しい、もしくは付いて欲しくない場合には、次の
     方法のどちらでも使えます。

          >>> format(14, '#b'), format(14, 'b')
          ('0b1110', '1110')
          >>> f'{14:#b}', f'{14:b}'
          ('0b1110', '1110')

     負の数値を 2 の補数として表現するには、 *note enum.bin(): 17fd. も
     参照してください。

     より詳しいことは *note format(): 19a. も参照してください。

 -- クラス: bool (object=False, /)

     真偽値、すなわち ‘True’ か ‘False’ のいずれかを返します。引数は標準
     の *note 真偽値判定手続き: 18bd. を用いて変換されます。引数が偽かま
     たは省略された場合、この関数は ‘False’ を返します。それ以外の場合は
     ‘True’ を返します。 *note bool: 3c1. クラスは *note int: 19c. クラ
     スの派生クラスです (*note 数値型 int, float, complex: 2038. を参照
     してください)。このクラスからさらに派生することはできません。このク
     ラスのインスタンスは ‘False’ と ‘True’ のみです (*note ブーリアン型
     - bool: 2620. を参照してください)。

     バージョン 3.7 で変更: 引数は位置専用になりました。

 -- の関数: breakpoint (*args, **kws)

     この関数は、呼び出された箇所にて処理をデバッガに移行します。具体的
     には、 *note sys.breakpointhook(): cd5. を呼び出し、 ‘args’ と
     ‘kws’ をそのまま渡します。デフォルトでは、 ‘sys.breakpointhook()’ は
     引数なしで *note pdb.set_trace(): 274. を呼び出すだけです。その場合
     、これは単なる便利関数でデバッガに入るために *note pdb: aa. を明示
     的にインポートしたり多くのコードを書いたりせずに済むだけです。です
     が、 ‘sys.breakpointhook()’ は別の関数に設定でき、 *note
     breakpoint(): 273. はそれを自動で呼び出すため、自分好みのデバッガに
     処理を移行させることができます。 ‘sys.breakpointhook()’ にアクセス
     できない場合、この関数は *note RuntimeError: 246. を送出します。

     デフォルトでは、環境変数 *note PYTHONBREAKPOINT: cd6. をセットする
     ことで *note breakpoint(): 273. の動作を変えることができます。 使い
     方の詳細は *note sys.breakpointhook(): cd5. を参照してください。

     ただし、 *note sys.breakpointhook(): cd5. が別の関数で置き換えられ
     ている場合、上記の環境変数によって必ずしも動作を変えることができな
     いことに注意してください。

     引数 ‘breakpointhook’ 付きで *note 監査イベント: 1ccb.
     ‘builtins.breakpoint’ を送出します。

     Added in version 3.7.

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     新しいバイト配列を返します。*note bytearray: 342. クラスは0 <= x <
     256の範囲の整数からなる変更可能な配列です。*note
     ミュータブルなシーケンス型: 2621. に記述されている変更可能な配列に
     対する普通のメソッドの大半を備えています。また、*note bytes: 193. 型
     が持つメソッドの大半も備えています（see *note bytes と bytearray
     の操作: 2622.)。

     オプションの 'source' 引数は、配列を異なる方法で初期化するのに使わ
     れます:

        * '文字列' の場合、 'encoding' (と、オプションの 'errors') 引数
          も与えなければなりません。このとき *note bytearray(): 342. は
          文字列を *note str.encode(): ad6. でバイトに変換して返します。

        * '整数' の場合、配列はそのサイズになり、null バイトで初期化され
          ます。

        * *note バッファインターフェース: 262. に適合するオブジェクトの
          場合、そのオブジェクトの読み出し専用バッファがバイト配列の初期
          化に使われます。

        * 'イテラブル' の場合、範囲 ‘0 <= x < 256’ 内の整数のイテラブル
          でなければならず、それらが配列の初期の内容として使われます。

     引数がなければ、長さ 0 の配列が生成されます。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 2623. と
     *note bytearray オブジェクト: 2624. も参照してください。

 -- クラス: bytes (source=b'')

 -- クラス: bytes (source, encoding, errors='strict')

     範囲 ‘0 <= x < 256’ の整数のイミュータブルなシーケンスである
     "bytes" オブジェクトを返します。 *note bytes: 193. は *note
     bytearray: 342. のイミュータブル版であり、オブジェクトを変化させな
     いメソッドや、インデックス指定、オブジェクトのスライスについてのふ
     るまいは同じです。

     従って、コンストラクタ引数は *note bytearray(): 342. のものと同様に
     解釈されます。

     バイト列オブジェクトはリテラルでも生成できます。 *note
     文字列およびバイト列リテラル: 22fb. を参照してください。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 2623,
     *note バイトオブジェクト: 2625, *note bytes と bytearray の操作:
     2622. も参照してください。

 -- の関数: callable (object, /)

     'object' 引数が呼び出し可能オブジェクトであれば *note True: e0b. を
     、そうでなければ *note False: d2f. を返します。この関数が ‘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(): 2397. の逆です。

     引数の有効な範囲は 0 から 1,114,111 (16 進数で 0x10FFFF) です。引数
     が範囲外の場合 *note ValueError: 2ee. が送出されます。

 -- の関数: @classmethod

     メソッドをクラスメソッドへ変換します。

     クラスメソッドは、インスタンスメソッドが暗黙の第一引数としてインス
     タンスをとるように、第一引数としてクラスをとります。クラスメソッド
     を宣言するには、以下のイディオムを使います:

          class C:
              @classmethod
              def f(cls, arg1, arg2): ...

     ‘@classmethod’ 形式は関数 *note デコレータ: 93e. です。詳しくは
     *note 関数定義: 2074. を参照してください。

     クラスメソッドは、(‘C.f()’ のように) クラスから呼び出すことも、
     (‘C().f()’ のように) インスタンスから呼び出すこともできます。 イン
     スタンスはそのクラスが何であるかを除いて無視されます。 クラスメソッ
     ドが派生クラスから呼び出される場合は、その派生クラスオブジェクトが
     暗黙の第一引数として渡されます。

     クラスメソッドは C++ や Java の静的メソッドとは異なります。静的メソ
     ッドは、この節の *note staticmethod(): 451. を参照してください。ク
     ラスメソッドについてより詳しいことは *note 標準型の階層: 238b. を参
     照してください。

     バージョン 3.9 で変更: クラスメソッドは *note property(): 4b3. など
     、他の *note デスクリプタ: 18e5. をラップすることができるようになり
     ました。

     バージョン 3.10 で変更: クラスメソッドはメソッド属性 (*note
     __module__: 23a6, *note __name__: 14f0, *note __qualname__: 23a5,
     *note __doc__: 13f5. と *note __annotations__: 13f4.) を継承するよ
     うになりました。また、新たに ‘__wrapped__’ 属性を持つようになりまし
     た。

     バージョン 3.11 で非推奨、バージョン 3.13 で削除: クラスメソッドは
     *note property(): 4b3. など、他の *note デスクリプタ: 18e5. をラッ
     プすることができなくなりました。

 -- の関数: 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
     コンパイラオプション: 2626. を有効化するか、 *note 将来の機能: 45b.
     のどれを許可するかを制御します。どちらの引数も存在しない (またはど
     ちらもゼロである) 場合は、 *note compile(): 4b1. の呼び出し元のコー
     ドに作用したものと同じフラグでコンパイルされます。 'flags' 引数が与
     えられて 'dont_inherit' が与えられない (またはゼロ) の場合、上記に
     加えて 'flags' 引数で与えられたコンパイラオプションと future 文が使
     われます。 'dont_inherit' がゼロでない整数の場合、 'flags' 引数で指
     定されたオプションだけが有効です - 呼び出し元コードに適用されたフラ
     グ (将来の機能とコンパイラオプション) は無視されます。

     有効化するコンパイラオプションと future 文はビットフィールドで指定
     可能で、ビット単位の OR をとることで複数のオプションを一緒に指定す
     ることができます。特定の future 機能を指定するために必要なビットフ
     ィールドの情報は、 *note __future__: 0. モジュールにおける *note
     _Feature: 2627. インスタンスの *note compiler_flag: 23f3. 属性で得
     ることができます。 *note コンパイラフラグ: 2626. の情報は *note
     ast: 9. モジュールの ‘PyCF_’ で始まるフラグで得ることができます。

     引数 'optimize' は、コンパイラの最適化レベルを指定します; デフォル
     トの値 ‘-1’ は、インタプリタの *note -O: 18d. オプションで与えられ
     るのと同じ最適化レベルを選びます。明示的なレベルは、 ‘0’ (最適化な
     し、 ‘__debug__’ は真)、 ‘1’ (assert は取り除かれ、 ‘__debug__’ は
     偽)、 ‘2’ (docstring も取り除かれる) です。

     この関数は、コンパイルされたソースが不正である場合 *note
     SyntaxError: 18f. または *note ValueError: 2ee. を送出します。

     Python コードをパースしてその AST 表現を得たいのであれば、 *note
     ast.parse(): 1c4. を参照してください。

     引数 ‘source’ と ‘filename’ を指定して *note 監査イベント: 1ccb.
     ‘compile’ を送出します。これは、暗黙に行われるコンパイルでも送出さ
     れる可能性があります。

          注釈: 複数行に渡るコードの文字列を ‘'single'’ や ‘'eval'’ モー
          ドでコンパイルするとき、入力は一つ以上の改行文字で終端されなけ
          ればなりません。これは、 *note code: 1b. モジュールで不完全な
          文と完全な文を検知しやすくするためです。

          警告: AST オブジェクトにコンパイルしているときに、十分に大きい
          文字列や複雑な文字列によって Python の抽象構文木コンパイラのス
          タックが深さの限界を越えることで、 Python インタプリタをクラッ
          シュさせられます。

     バージョン 3.2 で変更: Windows や Mac の改行も受け付けます。また
     ‘'exec'’ モードでの入力が改行で終わっている必要もありません。
     'optimize' 引数が追加されました。

     バージョン 3.5 で変更: 以前は 'source' にヌルバイトがあったときに
     *note TypeError: 199. を送出していました。

     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(): 197. と同じ形式）、虚数
     部（同様の形式で ‘'j'’ または ‘'J'’ 接尾辞）どちらか、あるいは両方
     （この場合、虚数部の符号は必須）を含まなければなりません。文字列 は
     空白や括弧 ‘'('’ と''')''' で囲むこともできますが、無視されます。文
     字列は、 ‘'+'’ 、‘'-'’ 、 ‘'j'’ または ‘'J'’ 接尾辞 、そして10進数
     の間に空白を含んではなりません。たとえば ‘complex('1+2j')’ はよいで
     すが、 ‘complex('1 + 2j')’ は *note ValueError: 2ee. を送出します。
     より正確には、入力は括弧および先頭と末尾の空白文字を除去した後、以
     下の文法における *note complexvalue: 2628. の生成規則を満たす必要が
     あります:

          complexvalue: *note floatvalue: 2629. |
                        *note floatvalue: 2629. ("j" | "J") |
                        *note floatvalue: 2629. *note sign: 262a. *note absfloatvalue: 262b. ("j" | "J")

     引数が数値の場合、コンストラクタは *note int: 19c. や *note float:
     197. のように数値変換します。一般的な Python オブジェクト ‘x’ では
     、 ‘complex(x)’ は ‘x.__complex__()’ に委譲します。 *note
     __complex__(): 7fd. が定義されていない場合は *note __float__():
     bc5. にフォールバックします。 ‘__float__()’ も定義されていない場合
     には、 *note __index__(): 19f. にフォールバックします。

     ２引数が指定されるかキーワード引数が使われている場合、各引数は任意
     の数値型（複素数を含む）となります。両方の引数が実数の場合には、実
     数成分 'real' と虚数成分 'imag' を持つ複素数を返します。引数が両方
     とも複素数の場合、実数成分 ‘real.real-imag.imag’ と虚数成分
     ‘real.imag+imag.real’ を持つ複素数を返します。引数の片方が実数の場
     合、前述の式ではその実数成分のみ使われます。

     数値を一つだけ引数にとる *note complex.from_number(): 196. も参照し
     てください。

     引数がすべて省略された場合は、 ‘0j’ を返します。

     複素数型については *note 数値型 int, float, complex: 2038. に説明が
     あります。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.8 で変更: *note __complex__(): 7fd. と *note
     __float__(): bc5. が定義されていない場合、 *note __index__(): 19f.
     へフォールバックします。

     バージョン 3.14 で非推奨: 複素数を 'real' 引数または 'imag' 引数と
     して渡せる機能は非推奨となりました。単一の位置引数として渡してくだ
     さい。

 -- の関数: delattr (object, name, /)

     *note setattr(): 261d. の親戚です。引数はオブジェクトと文字列です。
     文字列はオブジェクトの属性名のいずれかでなければなりません。対象の
     オブジェクトが許可する場合に限り、この関数は指定された名前の属性を
     削除します。たとえば、 ‘delattr(x, 'foobar')’ は ‘del x.foobar’ と
     等価です。 'name' は Python の識別子である必要はありません
     (‘setattr()’ を参照してください)。

 -- クラス: dict (**kwargs)

 -- クラス: dict (mapping, /, **kwargs)

 -- クラス: dict (iterable, /, **kwargs)

     Create a new dictionary.  The *note dict: 184. object is the
     dictionary class.  See also *note Mapping Types -- dict: cc1. for
     documentation about this class.

     For other containers see the built-in *note list: 24f, *note set:
     185, and *note tuple: 614. classes, as well as the *note
     collections: 1e. module.

 -- の関数: dir ()

 -- の関数: dir (object, /)

     引数がない場合、現在のローカルスコープにある名前のリストを返します
     。引数がある場合、そのオブジェクトの有効な属性のリストを返そうと試
     みます。

     オブジェクトが *note __dir__(): 17d8. という名のメソッドを持つなら
     、そのメソッドが呼び出され、属性のリストを返さなければなりません。
     これにより、カスタムの *note __getattr__(): 6fa. や *note
     __getattribute__(): dcf. 関数を実装するオブジェクトは、*note dir():
     844. が属性を報告するやり方をカスタマイズできます。

     オブジェクトが *note __dir__(): 17d8. を提供しない場合、その型オブ
     ジェクトと、定義されていればオブジェクトの *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(): 169f. によ
     って返されたイテレータの *note __next__(): 14e9. メソッドは、 (デフ
     ォルトでは 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: 16a. | *note code object: 4e6.) - Python
          式。

        * ‘globals’ (*note dict: 184. | ‘None’) - グローバル名前空間
          (default: ‘None’) 。

        * ‘locals’ (*note mapping: 13d7. | ‘None’) - ローカル名前空間
          (default: ‘None’) 。


     戻り値: 評価された式の結果。


     例外: 構文エラーは例外として報告されます。

          警告: This function executes arbitrary code.  Calling it with
          untrusted user-supplied input will lead to security
          vulnerabilities.

     The 'source' argument is parsed and evaluated as a Python
     expression (technically speaking, a condition list) using the
     'globals' and 'locals' mappings as global and local namespace.  If
     the 'globals' dictionary is present and does not contain a value
     for the key ‘__builtins__’, a reference to the dictionary of the
     built-in module *note builtins: 13. is inserted under that key
     before 'source' is parsed.  Overriding ‘__builtins__’ can be used
     to restrict or change the available names, but this is 'not' a
     security mechanism: the executed code can still access all
     builtins.  If the 'locals' mapping is omitted it defaults to the
     'globals' dictionary.  If both mappings are omitted, the source is
     executed with the 'globals' and 'locals' in the environment where
     *note eval(): 4a3. is called.  Note, 'eval()' will only have access
     to the *note nested scopes: 23ed. (non-locals) in the enclosing
     environment if they are already referenced in the scope that is
     calling ‘eval()’ (e.g.  via a *note nonlocal: 14c3. statement).

     例:

          >>> x = 1
          >>> eval('x+1')
          2

     この関数は (*note compile(): 4b1. で生成されるような) 任意のコード
     オブジェクトを実行するのにも利用できます。この場合、文字列の代わり
     にコードオブジェクトを渡してください。このコードオブジェクトが、引
     数 'mode' を ‘'exec'’ としてコンパイルされている場合、 *note
     eval(): 4a3. の戻り値は ‘None’ になります。

     ヒント: *note exec(): 4a2. 関数により文の動的な実行がサポートされて
     います。*note globals(): 1c67. および *note locals(): 46f. 関数は、
     それぞれ現在のグローバルおよびローカルな辞書を返すので、それらを
     *note eval(): 4a3. や ‘exec()’ に渡して使うことができます。

     ソースコードとして文字列が与えられた場合、先頭と末尾の空白文字およ
     びタブは取り去られます。

     See *note ast.literal_eval(): e16. for a function to evaluate
     strings with expressions containing only literals.

     コードオブジェクトを引数として *note 監査イベント: 1ccb. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

     バージョン 3.13 で変更: 'globals' と 'locals' 引数 はキーワードとし
     て渡せるようになった。

     バージョン 3.13 で変更: デフォルトの 'locals' 名前空間のセマンティ
     クスは、 組み込み *note locals(): 46f. の説明のように調整された。

 -- の関数: exec (source, /, globals=None, locals=None, *, closure=None)

          警告: This function executes arbitrary code.  Calling it with
          untrusted user-supplied input will lead to security
          vulnerabilities.

     この関数は Python コードの動的な実行をサポートします。 'source' は
     文字列かコードオブジェクトでなければなりません。文字列の場合、その
     文字列は一連の Python 文として解析され、そして (構文エラーにならな
     い限り) 実行されます。 (1) コードオブジェクトの場合は、単純に実行さ
     れます。どの場合でも、実行されるコードはファイル入力形式として有効
     であることが期待されます (リファレンスマニュアルの *note
     ファイル入力: 25fd. 節を参照してください)。 *note nonlocal: 14c3,
     *note yield: bc6, および *note return: 1b0. 文は、 *note exec():
     4a2. 関数に渡されたコードの文脈中でさえ、関数定義の外側で使うことは
     できません。戻り値は ‘None’ です。

     どの場合でも、オプションの部分が省略されると、コードは現在のスコー
     プ内で実行されます。 'globals' だけが与えられた場合、その値は辞書で
     なければならず (かつ辞書のサブクラスであってはならず)、グローバル変
     数とローカル変数の両方に使われます。 'globals' と 'locals' の両方が
     与えられた場合、それぞれグローバル変数とローカル変数に使われます。
     'locals' を指定する場合、その値はマップ型オブジェクトでなければなり
     ません。モジュールレベルでは globals と locals は同じ辞書であること
     に留意してください。

          注釈: ‘exec’ が 'globals' と 'locals' 2つ別々のオブジェクトを
          取る場合、コードはクラス定義に埋め込まれたかのように実行されま
          す。これは、実行されたコードで定義された関数とクラスが、トップ
          レベルで割り当てられた変数にアクセスできないことを意味します（
          「トップレベル」変数はクラス定義にてクラス変数として扱われるた
          め）。

     If the 'globals' dictionary does not contain a value for the key
     ‘__builtins__’, a reference to the dictionary of the built-in
     module *note builtins: 13. is inserted under that key.  Overriding
     ‘__builtins__’ can be used to restrict or change the available
     names, but this is 'not' a security mechanism: the executed code
     can still access all 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: 18f6.  The length of the tuple must
     exactly match the length of the code object's *note co_freevars:
     23a3. attribute.

     コードオブジェクトを引数として *note 監査イベント: 1ccb. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

          注釈: 組み込み関数 *note globals(): 1c67. および *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(): 262d.
     を参照してください。 '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: 2629. の生成規則に従う必要があります:

          sign:          "+" | "-"
          infinity:      "Infinity" | "inf"
          nan:           "nan"
          digit:         <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
          digitpart:     *note digit: 2630. (["_"] *note digit: 2630.)*
          number:        [*note digitpart: 2631.] "." *note digitpart: 2631. | *note digitpart: 2631. ["."]
          exponent:      ("e" | "E") [*note sign: 262a.] *note digitpart: 2631.
          floatnumber:   *note number: 2632. [*note exponent: 2633.]
          absfloatvalue: *note floatnumber: 2634. | *note infinity: 262e. | *note nan: 262f.
          floatvalue:    [*note sign: 262a.] *note absfloatvalue: 262b.

     大文字と小文字は重要ではないので、例えば、 "inf", "Inf",
     "INFINITY", "iNfINity" はすべて正の無限大を表す綴りとして受け入れら
     れます。

     また、引数が整数または浮動小数点数なら、 (Python の浮動小数点数の精
     度で) 同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点
     数の範囲外なら、 *note OverflowError: a85. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): bc5. が定義されて
     いない場合、*note __index__(): 19f. へフォールバックします。

     数値型の値のみ引数にとる *note float.from_number(): 195. も参照して
     ください。

     引数が与えられなければ、‘0.0’ が返されます。

     浮動小数点数型については、 *note 数値型 int, float, complex: 2038.
     も参照してください。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 引数は位置専用になりました。

     バージョン 3.8 で変更: *note __float__(): bc5. が定義されていない場
     合、 *note __index__(): 19f. へフォールバックします。

 -- の関数: format (value, format_spec='', /)

     'value' を 'format_spec' で指示された通りに "整形" した文字列表現に
     変換します。 'format_spec' の解釈は 'value' 引数の型に依存しますが
     、ほとんどの組み込み型で使われる標準的な構文が存在します: *note
     Format specification mini-language: 4f9.。

     デフォルトの 'format_spec' は空の文字列です。それは通常 *note
     str(value): 16a. の呼び出しと同じ結果になります。

     ‘format(value, format_spec)’ の呼び出しは、
     ‘type(value).__format__(value, format_spec)’ に翻訳され、これは
     value の *note __format__(): 831. メソッドの検索をするとき、インス
     タンス辞書を回避します。このメソッドの探索が *note object: c82. に
     到達しても 'format_spec' が空にならなかったり、 'format_spec' や返
     り値が文字列でなかったりした場合、 *note TypeError: 199. が送出され
     ます。

     バージョン 3.4 で変更: 'format_spec' が空の文字列でない場合
     ‘object().__format__(format_spec)’ は *note TypeError: 199. を送出
     します。

 -- クラス: frozenset (iterable=(), /)

     Return a new *note frozenset: 7f2. object, optionally with elements
     taken from 'iterable'.  ‘frozenset’ is a built-in class.  See also
     *note set（集合）型 -- set, frozenset: 208d. for documentation
     about this class.

     他のコンテナについては、ビルトインクラス *note set: 185, *note
     list: 24f, *note tuple: 614, *note dict: 184. や *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(): 261d. を参照してくださ
     い)。

          注釈: *note プライベートな名前のマングリング: 20ff. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note getattr(): dce.
          で取り出すためには、属性名を手動でマングリングする必要がありま
          す。

 -- の関数: globals ()

     現在のモジュールの名前空間を実装した辞書を返します。関数内のコード
     に対しては、関数が定義されるときに辞書が設定され、その関数がどこか
     ら呼ばれたかにかかわらず同じ内容になります。

 -- の関数: hasattr (object, name, /)

     引数はオブジェクトと文字列です。文字列がオブジェクトの属性名の一つ
     であった場合 ‘True’ を、そうでない場合 ‘False’ を返します。 (この関
     数は、 ‘getattr(object, name)’ を呼び出して *note AttributeError:
     5f0. を送出するかどうかを見ることで実装されています。)

 -- の関数: hash (object, /)

     オブジェクトのハッシュ値を (存在すれば) 返します。ハッシュ値は整数
     です。これらは辞書を検索する際に辞書のキーを高速に比較するために使
     われます。等しい値となる数値は等しいハッシュ値を持ちます (1 と 1.0
     のように型が異なっていてもです)。

          注釈: 独自の *note __hash__(): cf7. メソッドを実装したオブジェ
          クトを使う場合、*note hash(): 801. が実行するマシンのビット幅
          に合わせて戻り値を切り捨てることに注意してください。

 -- の関数: help ()

 -- の関数: help (request)

     組み込みヘルプシステムを起動します。(この関数は対話的な使用のための
     ものです。) 引数が与えられていない場合、対話的ヘルプシステムはイン
     タプリタコンソール上で起動します。引数が文字列の場合、文字列はモジ
     ュール、関数、クラス、メソッド、キーワード、またはドキュメントの項
     目名として検索され、ヘルプページがコンソール上に印字されます。引数
     がその他のオブジェクトの場合、そのオブジェクトに関するヘルプページ
     が生成されます。

     *note help(): ad8. を呼び出したときに関数の引数リストにスラッシュ
     (/) が現れた場合は、スラッシュより前の引数が位置専用引数だという意
     味であることに注意してください。より詳しい情報は、 *note
     位置専用引数についての FAQ の項目: 2635. を参照してください。

     この関数は、 *note site: cc. モジュールから、組み込みの名前空間に移
     されました。

     バージョン 3.4 で変更: *note pydoc: ba. と *note inspect: 82. への
     変更により、呼び出し可能オブジェクトの報告されたシグニチャがより包
     括的で一貫性のあるものになりました。

 -- の関数: hex (integer, /)

     整数を先頭に "0x" が付いた小文字の 16 進文字列に変換します。
     'integer' が Python の *note int: 19c. オブジェクトでない場合、整数
     を返す *note __index__(): 19f. メソッドが定義されていなければなりま
     せん。 いくつかの例を示します:

          >>> 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(): 19a. も参照してください。

     16を底として16進数文字列を整数に変換するには *note int(): 19c. も参
     照してください。

          注釈: 浮動小数点数の16進文字列表記を得たい場合には、 *note
          float.hex(): 215e. メソッドを使って下さい。

 -- の関数: id (object, /)

     オブジェクトの "識別値" を返します。この値は整数で、このオブジェク
     トの有効期間中は一意かつ定数であることが保証されています。有効期間
     が重ならない 2 つのオブジェクトは同じ *note id(): 1641. 値を持つか
     もしれません。

     これはオブジェクトのメモリアドレスです。

     引数 ‘id’ を指定して *note 監査イベント: 1ccb. ‘builtins.id’ を送出
     します。

 -- の関数: input ()

 -- の関数: input (prompt, /)

     引数 'prompt' が存在すれば、それが末尾の改行を除いて標準出力に書き
     出されます。次に、この関数は入力から 1 行を読み込み、文字列に変換し
     て (末尾の改行を除いて) 返します。 EOF が読み込まれたとき、 *note
     EOFError: 14f5. が送出されます。例:

          >>> s = input('--> ')
          --> Monty Python's Flying Circus
          >>> s
          "Monty Python's Flying Circus"

     *note readline: bf. モジュールが読み込まれていれば、 *note input():
     14f4. はそれを使って精緻な行編集やヒストリ機能を提供します。

     入力を読み込む前に、引数 ‘prompt’ 付きで *note 監査イベント: 1ccb.
     ‘builtins.input’ を送出します。

     入力の読み込みに成功した後に、その結果付きで *note 監査イベント:
     1ccb. ‘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__(): 19e. が定義されている場合は、 ‘int(x)’ は
     ‘x.__int__()’ を返します。引数に *note __index__(): 19f. が定義され
     ている場合は、 ‘x.__index__()’ を返します。浮動小数点数については、
     これは 0 に近い側へ切り捨てます。

     引数が数値でないか、または 'base' が与えられた場合、引数は 'base' を
     基数とした整数を表現する文字列、 *note bytes: 193. インスタンス、ま
     たは *note bytearray: 342. インスタンスのいずれかでなければなりませ
     ん。文字列は先頭に ‘+’ または ‘-’ を伴ったり (符号と数値の間に空白
     文字を入れてはいけません)、数値の先頭に任意の数のゼロを付けたり、前
     後に空白文字を付けたり、各桁を単一の下線で区切ったりしても有効です
     。

     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
     コードにおける整数リテラル: 2367. と同じように解釈されます。すなわ
     ち、プレフィックスによって基数が2, 8, 10, または 16 のどれになるか
     が決まります。基数を0にした場合先頭にゼロを追加することはできません
     : すなわち ‘int('010', 0)’ は基数を0に指定しているため不正ですが、
     ‘int('010')’ や ‘int('010', 8)’ は有効です。

     整数型については、 *note 数値型 int, float, complex: 2038. も参照し
     てください。

     バージョン 3.4 で変更: 'base' が *note int: 19c. のインスタンスでな
     く、'base' オブジェクトが *note base.__index__: 19f. メソッドを持っ
     ている場合、そのメソッドを呼んで底に対する整数を得ることができます
     。以前のバージョンでは ‘base.__index__’ ではなく *note
     base.__int__: 19e. を使用していました。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 第1引数は位置専用になりました。

     バージョン 3.8 で変更: *note __int__(): 19e. が定義されていない場合
     、 *note __index__(): 19f. へフォールバックします。

     バージョン 3.11 で変更: *note int: 19c. への文字列入力やその文字列
     表現は、サービス拒否攻撃 (DoS 攻撃) を避けるために制限されることが
     あります。文字列を ‘int’ に変換したり ‘int’ を文字列に変換したりす
     る際にその制限を超えた場合、 *note ValueError: 2ee. が送出されます
     。詳しくは *note 整数文字列の変換における長さ制限: 80b. を参照して
     ください。

     バージョン 3.14 で変更: *note int(): 19c. no longer delegates to
     the *note __trunc__(): 19d. method.

 -- の関数: isinstance (object, classinfo, /)

     'object' 引数が 'classinfo' 引数に指定した型、またはその (直接、間
     接、または *note 仮想: 13d2. の) サブクラスのインスタンスである場合
     に ‘True’ を返します。 'object' が与えられた型のオブジェクトでない
     場合、この関数は常に ‘False’ を返します。 'classinfo' が型オブジェ
     クトのタプル (または再帰的にそのようなタプルを含むタプル) や複数の
     型の *note Union 型: 9c9. である場合、 'object' がそれらの型のいず
     れかのインスタンスであれば ‘True’ を返します。 'classinfo' が型や型
     からなるタプルまたは再帰的タプルのいずれでもない場合、 *note
     TypeError: 199. 例外が送出されます。タプルの中で先行する型に対する
     チェックが成功した場合、後続の不正な型に対して ‘TypeError’ が送出さ
     れないことがあります。

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: 9c9. を指定
     できるようになりました。

 -- の関数: issubclass (class, classinfo, /)

     Return ‘True’ if 'class' is a subclass (direct, indirect, or *note
     virtual: 13d2.) of 'classinfo'.  A class is considered a subclass
     of itself.  'classinfo' may be a tuple of class objects (or
     recursively, other such tuples) or a *note Union 型: 9c9, in which
     case return ‘True’ if 'class' is a subclass of any entry in
     'classinfo'.  In any other case, a *note TypeError: 199. exception
     is raised.

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: 9c9. を指定
     できるようになりました。

 -- の関数: iter (iterable, /)

 -- の関数: iter (callable, sentinel, /)

     *note iterator: 4c8. オブジェクトを返します。第二引数があるかどうか
     によって第一引数の解釈は大きく異なります。第二引数がない場合、単一
     の引数は *note iterable: 12f5. プロトコル (*note __iter__(): e6d. メ
     ソッド) をサポートするコレクションオブジェクトか、またはシーケンス
     プロトコル (‘0’ から始まる整数を引数にとる *note __getitem__():
     588. メソッド) をサポートするオブジェクトでなければなりません。第一
     引数がどちらのプロトコルもサポートしない場合は *note TypeError:
     199. 例外が送出されます。第二引数 'sentinel' が与えられた場合、第一
     引数は呼び出し可能オブジェクトでなければなりません。この場合に生成
     されるイテレータは *note __next__(): 14e9. メソッドを呼び出すごとに
     引数なしで 'callable' を呼び出します; 戻り値が 'sentinel' と等しけ
     れば、 *note StopIteration: df9. が送出されます。それ以外の場合は戻
     り値がそのまま返されます。

     *note イテレータ型: 2636. も見てください。

     2引数形式の *note iter(): 9db. の便利な利用方法の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): b41. のような、 *note
     sys.maxsize: 13e1. を超える長さに対して *note OverflowError: a85. を
     送出します。

 -- クラス: list (iterable=(), /)

     *note list: 24f. は、実際には関数ではなくミュータブルなシーケンス型
     で、 *note リスト型 (list): 207e. と *note シーケンス型 -- list,
     tuple, range: 208a. にドキュメント化されています。

 -- の関数: locals ()

     現在のローカル シンボル テーブルを表すマッピング オブジェクトを返し
     ます。これは変数名をキーとし、現在バインドされている参照を値としま
     す。

     モジュール スコープでは、単一の名前空間で *note exec(): 4a2. や
     *note eval(): 4a3. を使う場合と同じく、この関数は *note globals():
     1c67. と同じ名前空間を返します。

     クラス スコープでは、メタクラス コンストラクタに渡された名前空間を
     返します。

     ‘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)

     'function' を 'iterable' の全ての要素に適用した結果を返していくイテ
     レータを返します。追加で 'iterables' 引数が渡された場合、
     'function' はその数だけの引数を取らなければならず、全てのイテラブル
     から並行して取り出された要素に適用されます。複数のイテラブルがある
     とき、このイテレータはその中の最短のイテラブルが尽きた時点で止まり
     ます。 'strict' が ‘True’ の場合は、ある iterable が他の iterable よ
     り先に尽きると *note ValueError: 2ee. 例外が発生します。関数の入力
     がすでに引数のタプルの形で渡される場合は、 *note
     itertools.starmap(): 12fe. を使用してください。

     バージョン 3.14 で変更: 'strict' パラメータが追加されました。

 -- の関数: max (iterable, /, *, key=None)

 -- の関数: max (iterable, /, *, default, key=None)

 -- の関数: max (arg1, arg2, /, *args, key=None)

     iterable の中で最大の要素、または2つ以上の引数の中で最大のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     12f5. でなくてはいけません。その iterable の最大の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最大のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): dcc. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 2ee. が送出されます。

     最大の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘sorted(iterable, key=keyfunc, reverse=True)[0]’ や
     ‘heapq.nlargest(1, iterable, key=keyfunc)’ のような、他のソート安定
     性を維持するツールと両立します。

     バージョン 3.4 で変更: キーワード専用引数 'default' が追加されまし
     た。

     バージョン 3.8 で変更: 'key' 引数が ‘None’ であることを許容します。

 -- クラス: memoryview (object)

     与えられたオブジェクトから作られた "メモリビュー" オブジェクトを返
     します。詳しくは *note メモリビュー: 2637. を参照してください。

 -- の関数: min (iterable, /, *, key=None)

 -- の関数: min (iterable, /, *, default, key=None)

 -- の関数: min (arg1, arg2, /, *args, key=None)

     iterable の中で最小の要素、または2つ以上の引数の中で最小のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     12f5. でなくてはいけません。その iterable の最小の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最小のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): dcc. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 2ee. が送出されます。

     最小の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘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__(): 14e9. メソッドを呼び出す
     ことにより、次の要素を取得します。イテレータが使い尽くされた場合、
     'default' が与えられていればその値が返されます。そうでない場合は
     *note StopIteration: df9. が送出されます。

 -- クラス: object

     これが、あらゆるクラスに継承される大本のベースクラスです。このクラ
     スが持つメソッドは、どの Python クラスのインスタンスにもあります。
     コンストラクタを呼び出すと、まっさらなオブジェクトが返ります。コン
     ストラクタに引数は指定できません。

          注釈: *note object: c82. インスタンスは *note __dict__: 77d. 属
          性を '持たない' ので、 ‘object’ クラスのインスタンスに任意の属
          性を代入することはできません。

 -- の関数: oct (integer, /)

     整数を先頭に "0o" が付いた 8 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     19c. オブジェクトでない場合、整数を返す *note __index__(): 19f. メ
     ソッドが定義されていなければなりません。 例えば、次のようになります
     :

          >>> 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(): 19a. も参照してください。

 -- の関数: open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     'file' を開き、対応する *note ファイルオブジェクト: 13df. を返しま
     す。ファイルを開くことができなければ、*note OSError: 2c2. が送出さ
     れます。 この関数の利用例について、 *note ファイルを読み書きする:
     20c2. を参照してください。

     'file' は *note path-like object: 5a1. で、開くファイルのパス名 (絶
     対パスまたは現在の作業ディレクトリからの相対パス) あるいはラップす
     るファイルの整数のファイルデスクリプタを与えます。 (ファイルデスク
     リプタが与えられた場合、 'closefd' が ‘False’ に設定されていないか
     ぎり、この関数が返す I/O オブジェクトがクローズされるときにファイル
     デスクリプタもクローズされます。)

     'mode' オプション文字列はファイルが開かれる際のモードを指定します。
     デフォルトは ‘'r'’ で、読み込み用にテキストモードで開くという意味で
     す。その他によく使われるモードとして、書き込み用の ‘'w'’ (ファイル
     が既に存在する場合は上書きします) 、排他的な生成をあらわす ‘'x'’ 、
     そして追記用の ‘'a'’ ( 'いくつかの' Unix システムでは、 'すべての'
     書き込みは現在のシーク位置にかかわらずファイルの末尾に追記する、と
     いう意味です) です。テキストモードで 'encoding' が指定されない場合
     に使われるエンコーディングは、プラットフォーム依存です: 現在のロケ
     ールエンコーディングを取得するために *note locale.getencoding():
     866. が呼ばれます。 (生のバイトデータを読み書きする際にはバイナリモ
     ードを使い、 'encoding' は指定しません。) 指定できるモードは以下の
     通りです:

     文字          意味
                   
     ----------------------------------------------------------------------------------
                   
     ‘'r'’         読み込み用に開く (デフォルト)
                   
                   
     ‘'w'’         書き込み用に開き、まずファイルを切り詰める
                   
                   
     ‘'x'’         排他的な生成に開き、ファイルが存在する場合は失敗する
                   
                   
     ‘'a'’         書き込み用に開き、ファイルが存在する場合には末尾に追記する
                   
                   
     ‘'b'’         バイナリモード
                   
                   
     ‘'t'’         テキストモード (デフォルト)
                   
                   
     ‘'+'’         更新用に開く (読み込み・書き込み用)
                   

     デフォルトのモードは ‘'r'’ (テキストの読み込み用に開く、 ‘'rt'’ と
     同義) です。 ‘'w+'’ と ‘'w+b'’ はファイルを開いて上書きします。
     ‘'r+'’ と ‘'r+b'’ はファイルを上書きせずに開きます。

     *note 概要: 2639. で触れられているように、Python はバイナリとテキス
     トの I/O を区別します。('mode' 引数に ‘'b'’ を含めて) バイナリモー
     ドで開かれたファイルは、内容をいかなるデコーディングもせずに *note
     bytes: 193. オブジェクトとして返します。(デフォルトや、 'mode' 引数
     に ‘'t'’ が含まれたときの) テキストモードでは、ファイルの内容は
     *note str: 16a. として返され、バイト列はまず、プラットフォーム依存
     のエンコーディングか、'encoding' が指定された場合は指定されたエンコ
     ーディングを使ってデコードされます。

          注釈: Python は、下層のオペレーティングシステムがテキストファ
          イルをどう認識するかには依存しません; すべての処理は Python 自
          身で行われ、よってプラットフォーム非依存です。

     'buffering' はオプションの整数で、バッファリングのポリシーを設定す
     るために使われます。 バッファリングを無効化するためには0を渡してく
     ださい (バイナリモードでのみ設定可能です)。また行単位でのバッファリ
     ングには1を設定してください (テキストモードでの書き込み時のみ有効で
     す)。固定サイズのチャンクバッファに対するサイズをバイト単位で指定し
     たい場合は、1より大きい整数を渡してください。この形式でバッファサイ
     ズを指定した場合、バイナリ形式でバッファリングをサポートする I/O
     (buffered I/O) にはそのまま適用されますが、 ‘TextIOWrapper’ (すなわ
     ち ‘mode='r+'’ のモードでオープンされたファイル) では別のバッファリ
     ングを行うかもしれません。 ‘TextIOWrapper’ でバッファリングを無効化
     するには、 *note io.TextIOWrapper.reconfigure(): d44. で
     ‘write_through’ フラグを使うことを検討してください。 'buffering' 引
     数が与えられなかった場合、デフォルトのバッファリングポリシーは以下
     のように動作します:

        * バイナリモードでは、固定サイズのチャンクバッファが使われます。
          バッファのサイズは、デバイスのブロックサイズが取得できる場合は
          ‘max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)’ です。ほとん
          どの環境では、このバッファは通常 128 キロバイトです。

        * 「対話的な」テキストファイル (*note isatty(): 20c5. が ‘True’
          を返すファイル) は行バッファリングを使用します。 その他のテキ
          ストファイルは、上で説明したバイナリファイル用の方針を使用しま
          す。

     'encoding' はファイルのエンコードやデコードに使われる *note text
     encoding: 263a. の名前です。このオプションはテキストモードでのみ使
     用してください。デフォルトエンコーディングはプラットフォーム依存
     (*note locale.getencoding(): 866. が返すもの) ですが、Pythonでサポ
     ートされているエンコーディングはどれでも使えます。詳しくは *note
     codecs: 1c. モジュール内のサポートしているエンコーディングのリスト
     を参照してください。

     'errors' is an optional string that specifies how encoding and
     decoding errors are to be handled—this cannot be used in binary
     mode.  A variety of standard error handlers are available (listed
     under *note エラーハンドラ: 1bce.), though any error handling name
     that has been registered with *note codecs.register_error(): 16b9.
     is also valid.  The standard names include:

        * ‘'strict'’ to raise a *note ValueError: 2ee. exception if
          there is an encoding error.  The default value of ‘None’ has
          the same effect.

        * ‘'ignore'’ ignores errors.  Note that ignoring encoding errors
          can lead to data loss.

        * ‘'replace'’ causes a replacement marker (such as ‘'?'’) to be
          inserted where there is malformed data.

        * ‘'surrogateescape'’ will represent any incorrect bytes as low
          surrogate code units ranging from U+DC80 to U+DCFF. These
          surrogate code units will then be turned back into the same
          bytes when the ‘surrogateescape’ error handler is used when
          writing data.  This is useful for processing files in an
          unknown encoding.

        * ‘'xmlcharrefreplace'’ is only supported when writing to a
          file.  Characters not supported by the encoding are replaced
          with the appropriate XML character reference ‘&#NNN;’.

        * ‘'backslashreplace'’ replaces malformed data by Python's
          backslashed escape sequences.

        * ‘'namereplace'’ (also only supported when writing) replaces
          unsupported characters with ‘\N{...}’ escape sequences.

     'newline' はストリームから受け取った改行文字をどのようにパースする
     かを決定します。 ‘None’, ‘''’, ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のい
     ずれかを指定できます。これは以下のように動作します:

        * ストリームからの入力の読み込み時、'newline' が ‘None’ の場合、
          ユニバーサル改行モードが有効になります。入力中の行は ‘'\n'’,
          ‘'\r'’, または ‘'\r\n'’ で終わり、呼び出し元に返される前に
          ‘'\n'’ に変換されます。 ‘''’ の場合、ユニバーサル改行モードは
          有効になりますが、行末は変換されずに呼び出し元に返されます。そ
          の他の正当な値の場合、入力行は与えられた文字列でのみ終わり、行
          末は変換されずに呼び出し元に返されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 263b. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     'closefd' が ‘False’ で、ファイル名ではなくてファイル記述子が与えら
     れた場合、下層のファイル記述子はファイルが閉じられた後も開いたまま
     となります。 ファイル名が与えられた場合、'closefd' は ‘True’ (デフ
     ォルト値) でなければなりません。 そうでない場合エラーが送出されます
     。

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの下層のファイル記
     述子は、'opener' を ('file', 'flags') で呼び出して得られます。
     'opener' は開いたファイル記述子を返さなければなりません。 (*note
     os.open: f96. を 'opener' として渡すと、‘None’ を渡したのと同様の機
     能になります)。

     新たに作成されたファイルは *note 継承不可: 1100. です。

     次の例は *note os.open(): f96. 関数の *note dir_fd: 1306. 引数を使
     い、与えられたディレクトリからの相対パスで指定されたファイルを開き
     ます:

          >>> 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(): 318. 関数が返す *note file object: 13df. の型はモード
     に依存します。 ‘open()’ をファイルをテキストモード (‘'w'’, ‘'r'’,
     ‘'wt'’, ‘'rt'’, など) で開くのに使ったときは *note io.TextIOBase:
     8a5. (特に *note io.TextIOWrapper: 9c2.) のサブクラスを返します。 フ
     ァイルをバッファリング付きのバイナリモードで開くのに使ったときは
     *note io.BufferedIOBase: 8a4. のサブクラスを返します。 実際のクラス
     は様々です。 読み込みバイナリモードでは *note io.BufferedReader:
     142b. を返します。 書き込みバイナリモードや追記バイナリモードでは
     *note io.BufferedWriter: 15cf. を返します。 読み書きモードでは
     *note io.BufferedRandom: 15d0. を返します。 バッファリングが無効な
     ときはrawストリーム、すなわち *note io.RawIOBase: 12eb. のサブクラ
     スである *note io.FileIO: 152b. を返します。

     *note fileinput: 5f. 、(*note open(): 318. が宣言された場所である)
     *note io: 83. 、 *note os: a5. 、 *note os.path: a6. 、 *note
     tempfile: e6. 、 *note shutil: ca. などの、ファイル操作モジュールも
     参照してください。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1ccb.
     ‘open’ を送出します。

     ‘mode’ と ‘flags’ の2つの引数は呼び出し時の値から修正されたり、推量
     により設定されたりする可能性があります。

     バージョン 3.3 で変更:

        * 'opener' 引数を追加しました。

        * ‘'x'’ モードを追加しました。

        * 以前は *note IOError: 1262. が送出されました; それは現在 *note
          OSError: 2c2. のエイリアスです。

        * 既存のファイルを 排他的生成モード(‘'x'’)で開いた場合、 *note
          FileExistsError: 1225. を送出するようになりました。

     バージョン 3.4 で変更:

        * ファイルが継承不可になりました。

     バージョン 3.5 で変更:

        * システムコールが中断されシグナルハンドラが例外を送出しなかった
          場合、この関数は *note InterruptedError: f8c. 例外を送出する代
          わりにシステムコールを再試行するようになりました (論拠について
          は PEP 475(4) を参照してください)。

        * ‘'namereplace'’ エラーハンドラが追加されました。

     バージョン 3.6 で変更:

        * *note os.PathLike: e4f. を実装したオブジェクトを受け入れるよう
          になりました。

        * Windowsでは、コンソールバッファのオープンは、*note io.FileIO:
          152b. ではなく、*note io.RawIOBase: 12eb. のサブクラスを返すで
          しょう。

     バージョン 3.11 で変更: ‘'U'’ モードは削除されました。

 -- の関数: ord (character, /)

     文字の番号を返します。

     引数が１文字の文字列の場合は、その文字の Unicode コードポイントを返
     します。例えば ‘ord('a')’ は ‘97’ 、 ‘ord('€')’ (ユーロ) は ‘8364’
     になります。 *note chr(): 1a4e. と反対の操作です。

     引数が 長さ１の *note bytes: 193. または *note bytearray: 342. であ
     る場合は、そのバイト値を返します。例えば、 ‘ord(b'a')’ は ‘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: 19c. 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 ‘int’ or
     *note float: 197. 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 ‘int’ or ‘float’ with
     an integral exponent, a float result is delivered.  For example,
     ‘pow(-9, 2.0)’ returns ‘81.0’.

     'base' と 'exp' が *note int: 19c. オペランドで '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: 19c. オペランドに対して、三引数形
     式の ‘pow’ で第二引数に負の値を取ることができるようになりました。こ
     れによりモジュラ逆数の計算が可能になります。

     バージョン 3.8 で変更: キーワード引数を取ることができるようになりま
     した。以前は位置引数だけがサポートされていました。

 -- の関数: print (*objects, sep=' ', end='\n', file=None, flush=False)

     'objects' を 'sep' で区切りながらテキストストリーム 'file' に表示し
     、最後に 'end' を表示します。'sep' 、 'end' 、 'file' 、 'flush' を
     与える場合、キーワード引数として与える必要があります。

     キーワードなしの引数はすべて、 *note str(): 16a. がするように文字列
     に変換され、 'sep' で区切られながらストリームに書き出され、最後に
     'end' が続きます。 'sep' と 'end' の両方とも、文字列でなければなり
     ません。これらを ‘None’ にすると、デフォルトの値が使われます。
     'objects' が与えられなければ、 *note print(): 117b. は 'end' だけを
     書き出します。

     'file' 引数は、 ‘write(string)’ メソッドを持つオブジェクトでなけれ
     ばなりません。指定されないか、 ‘None’ である場合、 *note
     sys.stdout: cd1. が使われます。表示される引数は全てテキスト文字列に
     変換されますから、 *note print(): 117b. はバイナリモードファイルオ
     ブジェクトには使用できません。代わりに ‘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
     デコレータ: 93e. として使えば、読み出し専用 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: b41. は、実際には関数ではなくイミュータブルなシーケン
     ス型で、 *note range: 263c. と *note シーケンス型 -- list, tuple,
     range: 208a. にドキュメント化されています。

 -- の関数: repr (object, /)

     オブジェクトの印字可能な表現を含む文字列を返します。この関数は多く
     の型について、 *note eval(): 4a3. に渡されたときと同じ値を持つよう
     なオブジェクトを表す文字列を生成しようとします。そうでない場合は、
     山括弧に囲まれたオブジェクトの型の名前と追加の情報 (大抵の場合はオ
     ブジェクトの名前とアドレスを含みます) を返します。クラスは、 *note
     __repr__(): 82f. メソッドを定義することで、この関数によりそのクラス
     のインスタンスが返すものを制御することができます。*note
     sys.displayhook(): 173d. にアクセスできない場合、この関数は *note
     RuntimeError: 246. を送出します。

     このクラスは、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__(): e8a. メソッドを持つか、シーケ
     ンス型プロトコル ( *note __len__(): 17ff. メソッド、および、 ‘0’ 以
     上の整数を引数とする *note __getitem__(): 588. メソッド) をサポート
     するオブジェクトでなければなりません。

 -- の関数: round (number, ndigits=None)

     'number' を小数点以下 'ndigits' 桁の精度で丸めた値を返します。
     'ndigits' が省略されたり、‘None’ だった場合、入力値に最も近い整数を
     返します。

     *note round(): 14f6. をサポートする組み込み型では、値は 10 のマイナ
     ス 'ndigits' 乗の倍数の中で最も近いものに丸められます; 二つの倍数が
     同じだけ近いなら、偶数を選ぶ方に (そのため、例えば ‘round(0.5)’ と
     ‘round(-0.5)’ は両方とも ‘0’ に、 ‘round(1.5)’ は ‘2’ に) 丸められ
     ます。 'ndigits' には任意の整数値が有効となります (正の整数、ゼロ、
     負の整数)。 返り値は 'ndigits' が指定されていないか ‘None’ の場合は
     整数、そうでなければ返り値は 'number' と同じ型です。

     一般的な Python オブジェクト ‘number’ に対して、‘round’ は処理を
     ‘number.__round__’ に移譲します。

          注釈: 浮動小数点数に対する *note round(): 14f6. の振る舞いは意
          外なものかもしれません: 例えば、 ‘round(2.675, 2)’ は予想通り
          の ‘2.68’ ではなく ‘2.67’ を与えます。これはバグではありません
          : これはほとんどの小数が浮動小数点数で正確に表せないことの結果
          です。詳しくは *note 浮動小数点演算、その問題と制限: 215c. を
          参照してください。

 -- クラス: set (iterable=(), /)

     Return a new *note set: 185. object, optionally with elements taken
     from 'iterable'.  ‘set’ is a built-in class.  See also *note
     set（集合）型 -- set, frozenset: 208d. for documentation about this
     class.

     他のコンテナについては *note collections: 1e. モジュールや組み込み
     の *note frozenset: 7f2. 、 *note list: 24f. 、 *note tuple: 614. 、
     *note dict: 184. クラスを参照してください。

 -- の関数: setattr (object, name, value, /)

     *note getattr(): dce. の相方です。引数はオブジェクト、文字列、それ
     から任意の値です。文字列は既存の属性または新たな属性の名前にできま
     す。この関数は指定したオブジェクトが許せば、値を属性に関連付けます
     。例えば、 ‘setattr(x, 'foobar', 123)’ は ‘x.foobar = 123’ と等価で
     す。

     *note __getattribute__(): dcf. のカスタマイズや *note __slots__:
     1709. を通じてオブジェクトが強制していない限り、 'name' は *note
     Names (identifiers and keywords): 22fc. で定義されている Python 識
     別子である必要はありません。属性名が識別子でない場合、ドットを使っ
     た属性へのアクセスはできませんが、 *note getattr(): dce. などを通じ
     てアクセス可能です。

          注釈: *note プライベートな名前のマングリング: 20ff. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note setattr():
          261d. でセットするためには、属性名を手動でマングリングする必要
          があります。

 -- クラス: slice (stop, /)

 -- クラス: slice (start, stop, step=None, /)

     ‘range(start, stop, step)’ で指定されたインデックスのセットを表す
     *note slice: 250e. オブジェクトを返します。 引数 'start' と 'step'
     のデフォルトは ‘None’ です。

     slice オブジェクトは *note スライス表記: 250d. を使用したときにも作
     られます。例えば ‘a[start:stop:step]’ や ‘a[start:stop, i]’ です。

     *note iterator: 4c8. 版として *note itertools.islice(): d47. 関数が
     あります。

      -- の属性: start
      -- の属性: stop
      -- の属性: step

          これらの属性は読み取り専用で、引数として渡された値 (またはデフ
          ォルト値) にセットされます。値を格納する以外に他に直接的な機能
          はありません。ただし、Numpy などのサードパーティパッケージが使
          用します。

     バージョン 3.12 で変更: スライスオブジェクトが *note hashable: 824.
     (ハッシュ可能) となりました (ただし、属性 *note start: 2405. 、
     *note stop: 2406. 、 *note step: 2407. がすべてハッシュ可能である場
     合に限ります)。

 -- の関数: sorted (iterable, /, *, key=None, reverse=False)

     'iterable' の要素を並べ替えた新たなリストを返します。

     2 つのオプション引数があり、これらはキーワード引数として指定されな
     ければなりません。

     'key' には 1 引数関数を指定します。これは 'iterable' の各要素から比
     較キーを展開するのに使われます (例えば、 ‘key=str.lower’ のように指
     定します)。 デフォルト値は ‘None’ です (要素を直接比較します)。

     'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要素は
     個々の比較が反転したものとして並び替えられます。

     旧式の 'cmp' 関数を 'key' 関数に変換するには *note
     functools.cmp_to_key(): 13f6. を使用してください。

     組み込みの *note sorted(): dcb. 関数は安定なことが保証されています
     。同等な要素の相対順序を変更しないことが保証されていれば、ソートは
     安定です。これは複数のパスでソートを行なうのに役立ちます（例えば部
     署でソートしてから給与の等級でソートする場合）。

     ソートアルゴリズムは、要素間の比較に ‘<’ 演算子だけを使います。した
     がってソートのためには *note __lt__(): 14bc. メソッドを定義すれば十
     分なはずですが、 PEP 8(5) は6つの *note 比較演算子: 2530. を全て実
     装することを推奨しています。これにより、異なるメソッドを必要とする
     *note max(): 1110. のような他のソートツールを、同じデータに対して適
     用することによって起こりうるバグを避ける助けになります。6つの比較演
     算子を全て実装することは、リフレクションによって *note __gt__():
     1527. メソッドを呼び出す可能性のある型混合の比較での混乱を避けるこ
     とにも役立ちます。

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f7.
     を参照して下さい。

 -- の関数: @staticmethod

     メソッドを静的メソッドへ変換します。

     静的メソッドは暗黙の第一引数を受け取りません。静的メソッドを宣言す
     るには、このイディオムを使ってください:

          class C:
              @staticmethod
              def f(arg1, arg2, argN): ...

     ‘@staticmethod’ 形式は関数 *note デコレータ: 93e. です。詳しくは
     *note 関数定義: 2074. を参照してください。

     静的メソッドは (‘C.f()’ のように) クラスに対して呼び出すことも、
     (‘C().f()’ のように) インスタンスに対して呼び出すこともできます。さ
     らに、静的メソッド *note descriptor: 18e5. は呼び出し可能でもあるた
     め、(‘f()’ のように) クラス定義の中でも使用できます。

     Python における静的メソッドは Java や C++ における静的メソッドと類
     似しています。クラスコンストラクタの代替を生成するのに役立つ変種、
     *note classmethod(): 48e. も参照してください。

     あらゆるデコレータと同じく、 ‘staticmethod’ は普通の関数のように呼
     べ、その返り値で処理が行えます。 この機能は、クラス本体から関数を参
     照する必要があり、かつ、インスタンスメソッドに自動変換されるのを避
     けたいケースで必要になります。 そのようなケースでは、このイディオム
     が使えます:

          def regular_function():
              ...

          class C:
              method = staticmethod(regular_function)

     静的メソッドについて詳しい情報は *note 標準型の階層: 238b. を参照し
     てください。

     バージョン 3.10 で変更: Static methods now inherit the method
     attributes (*note __module__: 23a6, *note __name__: 14f0, *note
     __qualname__: 23a5, *note __doc__: 13f5. and *note __annotations__:
     13f4.), 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: 16a. 版を返します。詳細は *note str(): 16a.
     を参照してください。

     ‘str’ は組み込みの文字列 *note クラス: 1d5b. です。文字列に関する一
     般的な情報は、*note テキストシーケンス型 -- str: 203c. を参照してく
     ださい。

 -- の関数: sum (iterable, /, start=0)

     'start' と 'iterable' の要素を左から右へ合計し、総和を返します。
     'iterable' の要素は通常は数値で、start の値は文字列であってはなりま
     せん。

     使う場面によっては、 *note sum(): 695. よりもいい選択肢があります。
     文字列からなるシーケンスを結合する高速かつ望ましい方法は
     ‘''.join(sequence)’ を呼ぶことです。浮動小数点数値を拡張された精度
     で加算するには、 *note math.fsum(): 15f2. を参照してください。一連
     のイテラブルを連結するには、 *note itertools.chain(): 263d. の使用
     を考えてください。

     バージョン 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: 263e. (メソッド解決順序) を決定します。検索は 'type' 直後の
     クラスから開始します。

     例えば 'object_or_type' の *note __mro__: 23d4. 属性が ‘D -> B -> C
     -> A -> object’ であり、 'type' の値が ‘B’ だとすると、 *note
     super(): 1a7. は ‘C -> A -> object’ の順番でメソッドを検索します。

     The *note __mro__: 23d4. attribute of the class corresponding to
     'object_or_type' lists the method resolution search order used by
     both *note getattr(): dce. and *note super(): 1a7.  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(): 1a7. は属性のルック
     アップに対しても同様に動作します。考えうる用途のひとつは親クラスや
     兄弟クラスの *note descriptors: 18e5. (デスクリプタ) を呼び出すこと
     です。

     なお、*note super(): 1a7. は ‘super().__getitem__(name)’ のような明
     示的なドット表記属性探索の束縛処理の一部として実装されています。こ
     れは、 *note __getattribute__(): dcf. メソッドを予測可能な順序でク
     ラスを検索するように実装し、協調的な多重継承をサポートすることで実
     現されています。従って、 ‘super()’ は文や ‘super()[name]’ のような
     演算子を使った暗黙の探索向けには定義されていません。

     また、 *note super(): 1a7. の使用は引数無しの形式を除きメソッド内部
     に限定されないことにも注目して下さい。2引数の形式は、必要な要素を正
     確に指定するので、適当な参照を作ることができます。クラス定義中にお
     ける引数無しの形式は、定義されているクラスを取り出すのに必要な詳細
     を、通常の方法で現在のインスタンスにアクセスするようにコンパイラが
     埋めるのではたらきます。

     *note super(): 1a7. を用いて協調的なクラスを設計する方法の実践的な
     提案は、 guide to using super()(6) を参照してください。

     バージョン 3.14 で変更: *note super: 1a7. オブジェクトは pickle 可
     能 かつ コピー可能 になりました。

 -- クラス: tuple (iterable=(), /)

     *note tuple: 614. は、実際は関数ではなくイミュータブルなシーケンス
     型で、*note タプル型 (tuple): 25a9. と *note シーケンス型 -- list,
     tuple, range: 208a. にドキュメント化されています。

 -- クラス: type (object, /)

 -- クラス: type (name, bases, dict, /, **kwargs)

     引数が1つだけの場合、'object' の型を返します。返り値は型オブジェク
     トで、一般に *note object.__class__: 16cb. によって返されるのと同じ
     オブジェクトです。

     オブジェクトの型の判定には、 *note isinstance(): 2af. 組み込み関数
     を使うことが推奨されます。これはサブクラスを考慮するからです。

     引数が3つの場合、新しい型オブジェクトを返します。これは本質的には
     *note class: 14f3. 文の動的な書式です。 'name' 文字列はクラス名で、
     *note __name__: 16c9. 属性になります。 'bases' 基底クラスのタプルで
     、 *note __bases__: 16ca. 属性になります; 空の場合は全てのクラスの
     基底クラスである *note object: c82. が追加されます。 'dict' は、ク
     ラス本体の属性とメソッドの定義を含む辞書です; 辞書は *note
     __dict__: e5b. 属性になる前にコピーされたり、ラップされることがあり
     ます。以下の2つの文は同じ ‘type’ オブジェクトを生成します:

          >>> class X:
          ...     a = 1
          ...
          >>> X = type('X', (), dict(a=1))

     下記を参照してください。

        * *note Documentation on attributes and methods on classes:
          23cc.

        * *note 型オブジェクト: 263f.

     三引数形式の呼び出しに与えられたキーワード引数は、('metaclass' を除
     く) クラス定義におけるキーワード引数と同様に、適切なメタクラスの機
     構 (通常は *note __init_subclass__(): 843.) に渡されます。

     *note クラス生成をカスタマイズする: e49. も参照してください。

     バージョン 3.6 で変更: ‘type.__new__’ をオーバーライドしていない
     ‘type’ のサブクラスは、オブジェクトの型を得るのに１引数形式を利用す
     ることができません。

 -- の関数: vars ()

 -- の関数: vars (object, /)

     モジュール、クラス、インスタンス、あるいはそれ以外の ‘__dict__’ 属
     性を持つオブジェクトの、 *note __dict__: 77d. 属性を返します。

     モジュールやインスタンスのようなオブジェクトは、更新可能な *note
     __dict__: 77d. 属性を持っています。ただし、それ以外のオブジェクトで
     は ‘__dict__’ 属性への書き込みが制限されている場合があります。書き
     込みに制限がある例としては、辞書を直接更新されることを防ぐために
     *note types.MappingProxyType: 698. を使っているクラスがあります。

     引数がない場合 *note vars(): 1e7f. は *note locals(): 46f. のように
     動作します。

     指定されたオブジェクトに *note __dict__: 77d. 属性がない場合 (たと
     えばそのクラスが *note __slots__: 1709. 属性を定義している場合)、
     *note TypeError: 199. 例外が送出されます。

     バージョン 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(): 1a1. は、 'i' 番目のタプルが 引数に与
     えた各イテラブルの 'i' 番目の要素を含むような、タプルのイテレータを
     返します。

     *note zip(): 1a1. に対する別の考え方は、この関数は行を列に、また列
     を行に変換するということです。これは 行列の転置(7) とよく似ています
     。

     *note zip(): 1a1. は遅延評価です: イテラブルが ‘for’ ループに渡され
     たり、 *note list: 24f. でラップされたりするなどして反復処理される
     まで、要素が実際に処理されることはありません。

     ここで考慮すべきことは、 *note zip(): 1a1. に渡されるイテラブルが異
     なる長さを持つことがあるという点です; ときには意図的な場合もあり、
     またときにはイテラブルを準備するコードにおけるバグのこともあるでし
     ょう。 Python はこの問題に対して3つの異なるアプローチを提供します:

        * デフォルトでは、 *note zip(): 1a1. は最も短いイテラブルが消費
          しきった時点で停止します。より繰り返し数の長いイテラブルの残り
          の要素は無視して、結果を最も短いイテラブルの長さに切り詰めます
          :

               >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))
               [(0, 'fee'), (1, 'fi'), (2, 'fo')]

        * *note zip(): 1a1. は、しばしば受け取ったイテラブルが全て同じ長
          さであるという想定の下で使われます。そのような場合、
          ‘strict=True’ オプションの利用が推奨されます。その出力は通常の
          ‘zip()’ と同じです:

               >>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))
               [('a', 1), ('b', 2), ('c', 3)]

          しかし、デフォルトの動作と異なり、あるイテラブルが他のイテラブ
          ルよりも先に消費しきった場合に *note ValueError: 2ee. 例外を送
          出します:

               >>> 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(): 14ba. で提供されます。

     エッジケース: 引数としてイテラブルをひとつだけ渡した場合、 *note
     zip(): 1a1. は 1 タプルのイテレータを返します。引数なしの場合は空の
     イテレータを返します。

     ヒントとコツ:

        * イテラブルの左から右への評価順序は保証されています。そのため
          ‘zip(*[iter(s)]*n, strict=True)’ を使ってデータ系列を長さ n の
          グループにクラスタリングするイディオムが使えます。これは、各出
          力タプルがイテレータを ‘n’ 回呼び出した結果となるよう、 '同じ'
          イテレータを ‘n’ 回繰り返します。これは入力を長さ n のチャンク
          に分割する効果があります。

        * *note zip(): 1a1. に続けて ‘*’ 演算子を使うと、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__(): ad5. を
     直接使用することも推奨されず、 *note importlib.import_module():
     73c. の方が好まれます。

     この関数は、モジュール 'name' をインポートし、 'globals' と
     'locals' が与えられれば、パッケージのコンテキストで名前をどう解釈す
     るか決定するのに使います。 'fromlist' は 'name' で与えられるモジュ
     ールからインポートされるべきオブジェクトまたはサブモジュールの名前
     を与ます。標準の実装では 'locals' 引数はまったく使われず、
     'globals' は *note import: 7f8. 文のパッケージコンテキストを決定す
     るためにのみ使われます。

     'level' は絶対と相対どちらのインポートを使うかを指定します。 ‘0’ (デ
     フォルト) は絶対インポートのみ実行します。正の 'level' の値は、
     *note __import__(): ad5. を呼び出したディレクトリから検索対象となる
     親ディレクトリの数を示します (詳細は 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__(): ad5. がどのように最上位モジュールを返し
     ているかに注意して下さい。 *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__(): ad5. から ‘spam.ham’ モジュールが返され
     ます。このオブジェクトから、インポートされる名前が取り出され、それ
     ぞれの名前として代入されます。

     単純に名前からモジュール (パッケージの範囲内であるかも知れません) を
     インポートしたいなら、 *note importlib.import_module(): 73c. を使っ
     てください。

     バージョン 3.3 で変更: 負の 'level' の値はサポートされなくなりまし
     た (デフォルト値の 0 に変更されます)。

     バージョン 3.9 で変更: コマンドラインオプション *note -E: b5a. or
     *note -I: b5b. が指定された場合、環境変数 *note PYTHONCASEOK: b59.
     は無視されるようになりました。

脚注
....

   ---------- 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: 3c1. 型の偽値です。‘False’ への代入は不正で、*note
     SyntaxError: 18f. を送出します。

 -- データ: True

     *note bool: 3c1. 型の真値です。‘True’ への代入は不正で、*note
     SyntaxError: 18f. を送出します。

 -- データ: None

     An object frequently used to represent the absence of a value, as
     when default arguments are not passed to a function.  Assignments
     to ‘None’ are illegal and raise a *note SyntaxError: 18f.  ‘None’
     is the sole instance of the *note NoneType: a56. type.

 -- データ: NotImplemented

     A special value which should be returned by the binary special
     methods (e.g.  *note __eq__(): cf6, *note __lt__(): 14bc, *note
     __add__(): 243d, *note __rsub__(): 2450, etc.)  to indicate that
     the operation is not implemented with respect to the other type;
     may be returned by the in-place binary special methods (e.g.  *note
     __imul__(): 2442, *note __iand__(): 245f, etc.)  for the same
     purpose.  It should not be evaluated in a boolean context.
     ‘NotImplemented’ is the sole instance of the *note
     types.NotImplementedType: a57. type.

          注釈: 二項演算の (あるいはインプレースの) メソッドが
          ‘NotImplemented’ を返した場合、インタープリタはもう一方の型で
          定義された対の演算で代用を試みます (あるいは演算によっては他の
          代替手段も試みます)。試行された演算全てが ‘NotImplemented’ を
          返した場合、インタープリタは適切な例外を送出します。
          ‘NotImplemented’ を正しく返さないと、誤解を招きかねないエラー
          メッセージになったり、 ‘NotImplemented’ が Python コードに返さ
          れるようなことになります。

          例として *note 算術演算の実装: 238e. を参照してください。

          注意: ‘NotImplemented’ and ‘NotImplementedError’ are not
          interchangeable.  This constant should only be used as
          described above; see *note NotImplementedError: 369. 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: 199.  It previously evaluated
     to *note True: e0b. and emitted a *note DeprecationWarning: 1a4.
     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: 18f.
     ‘Ellipsis’ is the sole instance of the *note types.EllipsisType:
     a55. type.

 -- データ: __debug__

     この定数は、Python が *note -O: 18d. オプションを有効にして開始され
     たのでなければ真です。 *note assert: b64. 文も参照して下さい。

     注釈: 名前 *note None: 886. 、 *note False: d2f. 、 *note True:
     e0b. 、 *note __debug__: 9de. は再代入できない (これらに対する代入
     は、たとえ属性名としてであっても *note SyntaxError: 18f. が送出され
     ます) ので、これらは「真の」定数であると考えられます。

* Menu:

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


File: python.info,  Node: site モジュールで追加される定数,  Up: 組み込み定数

5.3.1 ‘site’ モジュールで追加される定数
---------------------------------------

*note site: cc. モジュール (*note -S: 13c4. コマンドラインオプションが指
定されない限り、スタートアップ時に自動的にインポートされます) は組み込み
名前空間にいくつかの定数を追加します。それらは対話的インタープリタシェル
で有用ですが、プログラム中では使うべきではありません。

 -- データ: 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: f40. 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(): ad8.).

 -- データ: 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(): 1c3. 関数
や、わずかに異なる *note str(): 16a. 関数によって) 文字列に変換できます
。オブジェクトが *note print(): 117b. 関数で印字されるとき、文字列に変換
する関数が暗黙に使われます。

* 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
* Mapping Types: Mapping Types --- dict. dict
* コンテキストマネージャ型::
* 型アノテーション型: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン. ジェネリックエイリアス 、 ユニオン
* その他の組み込み型::
* 特殊属性::
* 整数と文字列の変換での長さ制限::


File: python.info,  Node: 真理値判定,  Next: ブール演算 --- and or not,  Up: 組み込み型

5.4.1 真理値判定
----------------

どのようなオブジェクトでも真理値として判定でき、 *note if: 182. や *note
while: 19d3. の条件あるいは以下のブール演算の被演算子として使えます。

By default, an object is considered true unless its class defines either
a *note __bool__(): 14f1. method that returns ‘False’ or a *note
__len__(): 17ff. 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: 1a3.).  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 基本的なカスタマイズ: 240d.) を参照してください。


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: 34a. と同等になります。 ‘<’,
‘<=’, ‘>’ および ‘>=’ 演算子は、それらの意味が明快である場合に限って定義
されます; たとえば、オペランドのいずれかが複素数である場合、これらの演算
子は *note TypeError: 199. 例外を送出します。

あるクラスの同一でないインスタンスは、通常等価でないとされますが、そのク
ラスが *note __eq__(): cf6. メソッドを定義している場合は除きます。

クラスのインスタンスは、そのクラスがメソッド *note __lt__(): 14bc. 、
*note __le__(): 1526. 、 *note __gt__(): 1527. 、 *note __ge__(): 1528.
のうち十分なものを定義していない限り、同じクラスの別のインスタンスや他の
型のオブジェクトとは順序付けできません (一般に、比較演算子の通常の意味を
求めるなら、 ‘__lt__()’ と *note __eq__(): cf6. だけで十分です)。

*note is: 34a. および *note is not: 2537. 演算子の振る舞いはカスタマイズ
できません。また、これらはいかなる 2 つのオブジェクトにも適用でき、決し
て例外を送出しません。

*note in: 349. と *note not in: 841. という構文上で同じ優先度を持つ演算
子がさらに 2 つあり、 *note iterable: 12f5. または *note __contains__():
15d7. を実装した型でサポートされています。


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: 1e2b. から入手可能です。複素数は実部と虚部を持ち、それぞ
れが浮動小数点数です。複素数 'z' から実部および虚部を取り出すには、
‘z.real’ および ‘z.imag’ を使ってください。 (標準ライブラリには、さらに
分数のための数値型 *note fractions.Fraction: 215. や、ユーザによる精度の
定義が可能な浮動小数点数のための *note decimal.Decimal: 200. があります
。)

数値は、数値リテラルによって、あるいは組み込み関数や演算子の戻り値として
生成されます。 (十六進、八進、二進数を含む) 修飾のない整数リテラルは、整
数を生成します。小数点または指数表記を含む数値リテラルは浮動小数点数を生
成します。数値リテラルに ‘'j'’ または ‘'J'’ をつけると純虚数 (実部がゼロ
の複素数) を生成し、それに整数や浮動小数点数を加えることにより実部と虚部
を持つ複素数を得ることができます。

コンストラクタ *note int(): 19c. 、 *note float(): 197. 、 *note
complex(): 198. で、特定の型の数を生成できます。

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;

   * それ以外場合は、両方の引数は整数でなければならず、変換の必要はあり
     ません。

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 演算子の優先順位: 254b. を参照してください):

演算                      結果                                  注釈          完全なドキュメント
                                                                              
-------------------------------------------------------------------------------------------------------
                                                                              
‘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(): 20e9.
                                                                              
                                                                              
‘int(x)’                  'x' の整数への変換                    (3)(6)        *note int(): 19c.
                                                                              
                                                                              
‘float(x)’                'x' の浮動小数点数への変換            (4)(6)        *note float(): 197.
                                                                              
                                                                              
‘complex(re, im)’         実部 're', 虚部 'im' の複素数。       (6)           *note complex(): 198.
                          'im' の既定値はゼロ。                               
                          
                                                                              
‘c.conjugate()’           複素数 'c' の共役複素数
                          
                                                                              
‘divmod(x, y)’            ‘(x // y, x % y)’ からなるペア        (2)           *note divmod(): b9d.
                                                                              
                                                                              
‘pow(x, y)’               'x' の 'y' 乗                         (5)           *note pow(): 1a5.
                                                                              
                                                                              
‘x ** y’                  'x' の 'y' 乗                         (5)
                                                                

注釈:

  1. 整数の除算とも呼ばれます。 *note int: 19c. 型のオペランドに対しては
     、結果は ‘int’ 型になります。 *note float: 197. 型のオペランドに対
     しては、結果は ‘float’ 型になります。一般に結果の型は必ずしも ‘int’
     型ではありませんが、結果は常に整数です。結果は常に負の無限大の方向
     に丸められます: ‘1//2’ は ‘0’ 、 ‘(-1)//2’ は ‘-1’ 、 ‘1//(-2)’ は
     ‘-1’ 、そして ‘(-1)//(-2)’ は ‘0’ です。

  2. 複素数型には使えません。適用可能な場合には代わりに *note abs():
     20e9. で浮動小数点型に変換してください。

  3. 
     *note float: 197. から *note int: 19c. への変換は小数点以下を切り捨
     てます。別の変換方法については関数 *note math.floor(): 15db. や
     *note math.ceil(): 15dc. を参照してください。

  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: 2651. 型 (*note int: 19c. 、 *note float:
197.) は以下の演算も含みます:

演算                     結果
                         
---------------------------------------------------------------------------
                         
*note math.trunc(x): 15dd.'x' を *note Integral: 246a. (整数) に切り捨て
                         ます
                         
                         
*note round(x[, n]): 14f6.'x' を 'n' 桁に丸めます。丸め方は偶数丸めです。
                         'n' が省略されれば 0 がデフォルトとなります。
                         
                         
*note math.floor(x): 15db.'x' 以下の最大の *note Integral: 246a. (整数) を
                         返します
                         
                         
*note math.ceil(x): 15dc.'x' 以上の最小の *note Integral: 246a. (整数) を
                         返します
                         

その他の数値演算は、 *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: 2ee. が送出されます
     。

  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: 246a. *note 抽象基底クラス: 13d2. を実
装します。さらに、追加のメソッドをいくつか提供します:

 -- メソッド: 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: a85. が送出
     されます。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。

     'signed' 引数は、整数を表すのに 2 の補数を使うかどうかを決定します
     。 'signed' が ‘False’ で、負の整数が与えられたなら、 *note
     OverflowError: a85. が送出されます。 'signed' のデフォルト値は
     ‘False’ です。

     上記のデフォルト値は整数を 1 バイトのオブジェクトに適切に変換するの
     に使うことができます:

          >>> (65).to_bytes()
          b'A'

     ただし、デフォルト引数で 255 より大きな整数を変換しないでください。
     そうでなければ *note OverflowError: a85. 例外を引き起こします。

     次と等価です:

          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: 194. か、または bytes を生
     成する iterable でなければなりません。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。ホストシステムにネイ
     ティブのバイトオーダーを要求するには、 *note sys.byteorder: 2656. を
     バイトオーダーの値として使ってください。

     '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(): 2657. に対するダ
     ックタイピングの互換性のために存在しています。

     Added in version 3.12.


File: python.info,  Node: 浮動小数点数に対する追加のメソッド,  Next: 複素数に対する追加のメソッド,  Prev: 整数型における追加のメソッド,  Up: 数値型 int float complex

5.4.4.3 浮動小数点数に対する追加のメソッド
..........................................

浮動小数点数型は、 *note numbers.Real: 2651. *note 抽象基底クラス: 13d2.
を実装しています。浮動小数点型はまた、以下の追加のメソッドを持ちます。

 -- メソッド: classmethod float.from_number (x)

     数 'x' から生成された浮動小数点数を返すクラスメソッドです。

     引数が整数または浮動小数点数の場合、(Python の浮動小数点数の精度で)
     同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点数の範
     囲外なら、 *note OverflowError: a85. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float.from_number(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): bc5. が定義されて
     いない場合、*note __index__(): 19f. へフォールバックします。

     Added in version 3.14.

 -- メソッド: float.as_integer_ratio ()

     比が厳密に元の浮動小数点数であるような一対の整数を返します。比は既
     約分数として与えられ、分母は正の値です。無限大に対しては *note
     OverflowError: a85. を、非数 (NaN) に対しては *note ValueError:
     2ee. を送出します。

 -- メソッド: 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(): 2659. はクラスメソッドですが、 *note float.hex():
215e. はインスタンスメソッドであることに注意して下さい。

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(): 215e. の出力は C や Java コード中で、浮動小数点数の 16 進表
記として役に立つでしょう。また、 C の ‘%a’ 書式や、 Java の
‘Double.toHexString’ で書きだされた文字列は *note float.fromhex(): 2659.
で受け付けられます。

なお、指数部は 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: 265b. *note 抽象基底クラス:
13d2. を実装しています。‘complex’ 型はまた、以下の追加のメソッドを持ちま
す。

 -- メソッド: classmethod complex.from_number (x)

     数値を複素数に変換するクラスメソッドです。

     一般的な Python オブジェクト ‘x’ に対して、
     ‘complex.from_number(x)’ は ‘x.__complex__()’ に処理を委譲します。
     *note __complex__(): 7fd. が定義されていない場合は *note
     __float__(): bc5. にフォールバックします。 ‘__float__()’ も定義され
     ていない場合は *note __index__(): 19f. にフォールバックします。

     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__():
cf7. メソッドドキュメントを参照してください)。実装の簡単さと 複数の数値
型 (*note int: 19c. 、 *note float: 197. 、 *note decimal.Decimal: 200.
、 *note fractions.Fraction: 215. を含みます) 間の効率のため、Python の
数値型に対するハッシュ値はある単一の数学的関数に基づいていて、 その関数
はすべての有理数に対し定義されているため、 ‘int’ と ‘fractions.Fraction’
のすべてのインスタンスと、 ‘float’ と ‘decimal.Decimal’ のすべての有限な
インスタンスに 対して適用されます。本質的には、この関数は定数の素数 ‘P’
に対して ‘P’ を法とする還元で与えられます。 値 ‘P’ は、 *note
sys.hash_info: 1205. の *note modulus: 265e. 属性として 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: 198.) 数 ‘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: 197. や、 *note
complex: 198. のハッシュを計算する組み込みのハッシュと等価な 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: 3c1. 型はただ2つの定数イ
ンスタンス ‘True’ と ‘False’ を持ちます。

組み込み関数 *note bool(): 3c1. は、もしその値が真理値として解釈可能なら
ば、任意の値を真偽値に変換します (上記 *note 真理値判定: 18bd. 節を参照
してください)。

論理演算には *note ブーリアン演算子: 264c. ‘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: 3c1. は *note int: 19c. のサブクラスです (*note 数値型 int,
float, complex: 2038. を参照してください)。多くの数値的なコンテキストに
おいて、 ‘False’ と ‘True’ はそれぞれ整数 0 と 1 であるかのように振る舞
います。しかし、そのような振る舞いを信頼することは推奨されません; *note
int(): 19c. を使って明示的に整数値に変換してください。


File: python.info,  Node: イテレータ型,  Next: シーケンス型 --- list tuple range,  Prev: ブーリアン型 - bool,  Up: 組み込み型

5.4.6 イテレータ型
------------------

Python はコンテナでの反復処理の概念をサポートしています。この概念は 2 つ
の別々のメソッドを使って実装されています; これらのメソッドを使ってユーザ
定義のクラスで反復を行えるようにできます。後に詳しく述べるシーケンスは、
必ず反復処理メソッドをサポートしています。

コンテナオブジェクトが *note イテラブル: 12f5. のサポートを提供するため
には、一つのメソッドが定義されていなければなりません:

 -- メソッド: container.__iter__ ()

     *note iterator: 4c8. オブジェクトを返します。オブジェクトは後述する
     イテレータプロトコルをサポートする必要があります。もしコンテナが異
     なる種類の反復処理をサポートするなら、それぞれの反復処理のためのイ
     テレータを要求するメソッドをそれぞれ提供しても構いません 。(複数の
     形式の反復処理を提供するオブジェクトの例として、幅優先探索と深さ優
     先探索をサポートする木構造が挙げられます。)このメソッドは Python/C
     API での Python オブジェクトの型構造体の *note tp_iter: 170d. スロ
     ットに対応します。

イテレータオブジェクト自体は以下の 2 つのメソッドをサポートする必要があ
ります。これらのメソッドは 2 つ合わせて 'iterator protocol': (イテレータ
プロトコル) を成します:

 -- メソッド: iterator.__iter__ ()

     *note iterator: 4c8. オブジェクト自体を返します。このメソッドはコン
     テナとイテレータの両方を *note for: 348. および *note in: 349. 文で
     使えるようにするために必要です。このメソッドは Python/C API におい
     て Python オブジェクトを表す型構造体の *note tp_iter: 170d. スロッ
     トに対応します。

 -- メソッド: iterator.__next__ ()

     *note iterator: 4c8. の次のアイテムを返します。もしそれ以上アイテム
     が無ければ *note StopIteration: df9. 例外を送出します。 このメソッ
     ドは Python/C APIでのPythonオブジェクトの型構造体の *note
     tp_iternext: 170e. スロットに対応します。

Python では、いくつかのイテレータオブジェクトを定義して、一般のシーケン
ス型、特殊なシーケンス型、辞書型、その他の特殊な形式に渡って反復をサポー
トしています。特殊型は、イテレータプロトコルの実装以外では重要ではありま
せん。

イテレータの *note __next__(): 14e9. メソッドが一旦 *note StopIteration:
df9. を送出したなら、以降の呼び出しでも例外を送出し続けなければなりませ
ん。この特性に従わない実装は壊れているとみなされます。

* Menu:

* ジェネレータ型::


File: python.info,  Node: ジェネレータ型,  Up: イテレータ型

5.4.6.1 ジェネレータ型
......................

Python における *note generator: 1270. (ジェネレータ) は、イテレータプロ
トコルを実装する便利な方法を提供します。コンテナオブジェクトの *note
__iter__(): e6d. メソッドがジェネレータとして実装されていれば、そのメソ
ッドは *note __iter__(): 2108. および *note __next__(): 2109. メソッドを
提供するイテレータオブジェクト (厳密にはジェネレータオブジェクト) を自動
的に返します。ジェネレータに関する詳細な情報は、 *note yield
式のドキュメント: 24f8. にあります。


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 バイナリデータ: 2623. や *note テキスト文字列: 203c. を処理
するように仕立てられたシーケンス型は、セクションを割いて解説します。

* Menu:

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


File: python.info,  Node: 共通のシーケンス演算,  Next: イミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.1 共通のシーケンス演算
............................

以下の表にある演算は、ほとんどのミュータブル、イミュータブル両方のシーケ
ンスでサポートされています。カスタムのシーケンス型にこれらの演算を完全に
実装するのが簡単になるように、 *note collections.abc.Sequence: 13e0. 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 比較: 2530. を参照してく
ださい。)

ミュータブルなシーケンスに対する前方および逆方向イテレータはインデックス
を使って要素にアクセスします。インデックスは、仮に参照するシーケンスが変
化したとしても前方 (または後方) に進み続けます。イテレータは *note
IndexError: 1753. または *note StopIteration: df9. に出会った場合 (また
はインデックスがゼロより小さくなった場合) にのみ終了します。

注釈:

  1. ‘in’ および ‘not in’ 演算は、一般に単純な包含判定にのみ使われますが
     、(*note str: 16a, *note bytes: 193, *note bytearray: 342. のような
     ) 特殊なシーケンスでは部分シーケンス判定にも使われます:

          >>> "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
     多次元のリストを作るにはどうしますか？: 2667. にあります。

  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: 16a. オブジェクトを結合するには、リストを構築して最
          後に *note str.join(): 2668. を使うか、 *note io.StringIO:
          112e. インスタンスに書き込んで完成してから値を取得してください

        * *note bytes: 193. オブジェクトを結合するなら、同様に *note
          bytes.join(): 177e. や *note io.BytesIO: 10a8. を使うか、
          *note bytearray: 342. オブジェクトでインプレースに結合できます
          。 ‘bytearray’ オブジェクトはミュータブルで、効率のいい割り当
          て超過機構を備えています

        * *note tuple: 614. オブジェクトを結合するなら、代わりに *note
          list: 24f. を拡張してください

        * その他の型については、関連するクラスのドキュメントを調べてくだ
          さい

  7. シーケンス型には、 (*note range: b41. のように) 特殊なパターンに従
     う項目のシーケンスのみをサポートするものがあり、それらはシーケンス
     の結合や繰り返しをサポートしません。

  8. An *note IndexError: 1753. 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: 2ee. を
     送出します。

     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: 184. のキーとして使え、 *note set: 185. や
*note frozenset: 7f2. インスタンスに保存できます。

ハッシュ不可能な値を含むイミュータブルなシーケンスをハッシュ化しようとす
ると、 *note TypeError: 199. となります。


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: 342. は値の制限 ‘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__(): 19f. を実装したオブジェク
     トです。 'n' の値がゼロまたは負数の場合、シーケンスをクリアします。
     *note 共通のシーケンス演算: 2666. で ‘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: 111f, 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: 2ee. を
     送出します。

 -- メソッド: 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(): dcb. などい
     ろいろあります。

     Lists are *note generic: 2429. over the types of their items.

     リストは *note 共通の: 2666. および *note ミュータブルの: 2621. シ
     ーケンス演算をすべて実装します。リストは、更に以下のメソッドも提供
     します:

      -- メソッド: sort (*, key=None, reverse=False)

          このメソッドは、項目間の ‘<’ 比較のみを用いてリストをインプレ
          ースにソートします。例外は抑制されません。比較演算がどこかで失
          敗したら、ソート演算自体が失敗します (そしてリストは部分的に変
          更された状態で残されるでしょう)。

          *note sort(): dcc. は、キーワードでしか渡せない 2 つの引数
          (*note キーワード専用引数: 5a5.) を受け付けます:

          'key' は一引数をとる関数を指定し、リストのそれぞれの要素から比
          較キーを取り出すのに使います (例えば、 ‘key=str.lower’)。それ
          ぞれの項目に対応するキーは一度計算され、ソート処理全体に使われ
          ます。デフォルトの値 ‘None’ は、別のキー値を計算せず、リストの
          値が直接ソートされることを意味します。

          2.x 形式の 'cmp' 関数を 'key' 関数に変換するために、*note
          functools.cmp_to_key(): 13f6. ユーティリティが利用できます。

          'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要
          素は個々の比較が反転したものとして並び替えられます。

          このメソッドは、大きなシーケンスをソートするときの容量の節約の
          ため、シーケンスをインプレースに変化させます。副作用としてこの
          演算が行われることをユーザに気づかせるために、これはソートした
          シーケンスを返しません (新しいリストインスタンスを明示的に要求
          するには *note sorted(): dcb. を使ってください)。

          *note sort(): dcc. メソッドは安定していることが保証されていま
          す。ソートは、等しい要素の相対順序が変更されないことが保証され
          ていれば、安定しています。これは複数パスのソートを行なう (例え
          ば部署でソートして、それから給与の等級でソートする) のに役立ち
          ます。

          ソートの例と簡単なチュートリアルは *note ソートのテクニック:
          13f7. を参照して下さい。

          リストがソートされている間、または変更しようとする試みの影響中
          、あるいは検査中でさえ、リストは未定義です。Python の C 実装で
          は、それらが続いている間、リストは空として出力され、リストがソ
          ート中に変更されていることを検知できたら *note ValueError:
          2ee. を送出します。

参考
....

For detailed information on thread-safety guarantees for *note list:
24f. objects, see *note Thread safety for list objects: 2672.


File: python.info,  Node: タプル型 tuple,  Next: range,  Prev: リスト型 list<2>,  Up: シーケンス型 --- list tuple range

5.4.7.5 タプル型 (tuple)
........................

タプルはイミュータブルなシーケンスで、一般的に異種のデータの集まり (組み
込みの *note enumerate(): 169f. で作られた 2-タプルなど) を格納するため
に使われます。タプルはまた、同種のデータのイミュータブルなシーケンスが必
要な場合 (*note set: 185. インスタンスや *note dict: 184. インスタンスに
保存できるようにするためなど) にも使われます。

 -- クラス: 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 共通の: 2666. シーケンス演算をすべて実装します。

     Tuples are *note generic: 2429. over the types of their contents.
     For more information, refer to *note the typing documentation on
     annotating tuples: 2674.

異種のデータの集まりで、インデックスによってアクセスするよりも名前によっ
てアクセスしたほうが明確になるものには、単純なタプルオブジェクトよりも
*note collections.namedtuple(): 4e0. が向いているかもしれません。


File: python.info,  Node: range,  Prev: タプル型 tuple,  Up: シーケンス型 --- list tuple range

5.4.7.6 range
.............

*note range: b41. 型は、数のイミュータブルなシーケンスを表し、一般に
*note for: 348. ループにおいて特定の回数のループに使われます。

 -- クラス: range (stop, /)

 -- クラス: range (start, stop, step=1, /)

     range コンストラクタの引数は整数 (組み込みの *note int: 19c. または
     *note __index__(): 19f. 特殊メソッドを実装するオブジェクト) でなけ
     ればなりません。'step' 引数が省略された場合のデフォルト値は ‘1’ で
     す。'start' 引数が省略された場合のデフォルト値は ‘0’ です。 'step'
     が 0 の場合、*note ValueError: 2ee. が送出されます。

     '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: 13e1. より大きい絶対値を含むことができ
     ますが、いくつかの機能 (*note len(): 840. など) は *note
     OverflowError: a85. を送出することがあります。

     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 共通の: 2666. シーケンス演算を、結合と繰り返し以外す
     べて実装します (range オブジェクトは厳格なパターンに従うシーケンス
     のみを表せ、繰り返しと結合はたいていそのパターンを破るという事実に
     よります)。

      -- の属性: start

          引数 'start' の値 (この引数が与えられていない場合は ‘0’)

      -- の属性: stop

          引数 'stop' の値

      -- の属性: step

          引数 'step' の値 (この引数が与えられていない場合は ‘1’)

*note range: b41. 型が通常の *note list: 24f. や *note tuple: 614. にま
さる点は、‘range’ オブジェクトがサイズや表す範囲にかかわらず常に一定の
(小さな) 量のメモリを使うことです (‘start’、‘stop’、‘step’ の値のみを保
存し、後は必要に応じて個々の項目や部分 range を計算するためです)。

range オブジェクトは *note collections.abc.Sequence: 13e0. ABC を実装し
、包含判定、要素インデックス検索、スライシングのような機能を提供し、負の
インデックスをサポートします (*note シーケンス型 -- list, tuple, range:
208a. を参照):

     >>> 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: 2676, *note stop: 2677. および *note
step: 2678. 属性を持つことがあります。例えば ‘range(0) == range(2, 1,
3)’ や ‘range(0, 3, 2) == range(0, 4, 2)’。)

バージョン 3.2 で変更: シーケンス ABC を実装。スライスと負のインデックス
のサポート。*note int: 19c. オブジェクトの帰属判定を、すべてのアイテムを
イテレートする代わりに、定数時間で行います。

バージョン 3.3 で変更: (オブジェクトの同一性に基づいて比較する代わりに)
range オブジェクトをそれらが定義する値のシーケンスに基づいて比較するよう
に '==' と '!=' を定義しました。

属性 *note start: 2676, *note stop: 2677. および *note step: 2678. が追
加。

参考
....

   * 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: 16a. メソ                                        *note bytes: 193. また
                               ッド                                                        は
                                                                                           *note bytearray: 342.
                                                                                           メソッド
                                                                                           
---------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                              
Formatting                     *note str.format(): 833.
                               
                                                                                                                         
*note str.format_map(): fdb.

*note f-strings: 19b.

*note printf 形式の文字列書式化: 8dc.                           *note printf 形式での bytes の書式化: f85.
                                                                
                                                                                                                              
Searching and Replacing        *note str.find(): 10ac.*note str.rfind(): 10ad.             *note bytes.find(): 1c31.*note bytes.rfind(): 1c32.
                                                                                                                    
                                                                                                                         
*note str.index(): 1a19.       *note str.rindex(): 1473.        *note bytes.index(): 267b. *note bytes.rindex(): 267c.
                                                                                           
                                                                                                                         
*note str.startswith(): 10cf.                                   *note bytes.startswith(): 267d.
                                                                
                                                                                                                         
*note str.endswith(): 10d0.                                     *note bytes.endswith(): 267e.
                                                                
                                                                                                                         
*note str.count(): 19e1.                                        *note bytes.count(): 19e2.
                                                                
                                                                                                                         
*note str.replace(): 4b8.                                       *note bytes.replace(): 267f.
                                                                
                                                                                                                              
Splitting and Joining          *note str.split(): 10ae.    *note str.rsplit(): 1471.       *note bytes.split(): 2680.    *note bytes.rsplit(): 2681.
                                                                                                                         
                                                                                                                         
*note str.splitlines(): 1472.                                   *note bytes.splitlines(): 2682.
                                                                
                                                                                                                         
*note str.partition(): 10af.                                    *note bytes.partition(): 2683.
                                                                
                                                                                                                         
*note str.rpartition(): 1474.                                   *note bytes.rpartition(): 2684.
                                                                
                                                                                                                         
*note str.join(): 2668.                                         *note bytes.join(): 177e.
                                                                
                                                                                                                              
String Classification          *note str.isalpha(): 2685.                                  *note bytes.isalpha(): 2686.
                                                                                           
                                                                                                                         
*note str.isdecimal(): 2687.

*note str.isdigit(): 2688.                                      *note bytes.isdigit(): 2689.
                                                                
                                                                                                                         
*note str.isnumeric(): 268a.

*note str.isalnum(): 268b.                                      *note bytes.isalnum(): 268c.
                                                                
                                                                                                                         
*note str.isidentifier(): 1da4.

*note str.islower(): 268d.                                      *note bytes.islower(): 268e.
                                                                
                                                                                                                         
*note str.isupper(): 268f.                                      *note bytes.isupper(): 2690.
                                                                
                                                                                                                         
*note str.istitle(): 2691.                                      *note bytes.istitle(): 2692.
                                                                
                                                                                                                         
*note str.isspace(): 2693.                                      *note bytes.isspace(): 2694.
                                                                
                                                                                                                         
*note str.isprintable(): fdc.

Case Manipulation              *note str.lower(): 1bd5.                                    *note bytes.lower(): 2695.
                                                                                           
                                                                                                                         
*note str.upper(): 2696.                                        *note bytes.upper(): 2697.
                                                                
                                                                                                                         
*note str.casefold(): fda.

*note str.capitalize(): 2698.                                   *note bytes.capitalize(): 2699.
                                                                
                                                                                                                         
*note str.title(): 269a.                                        *note bytes.title(): 269b.
                                                                
                                                                                                                         
*note str.swapcase(): 269c.                                     *note bytes.swapcase(): 269d.
                                                                
                                                                                                                              
Padding and Stripping          *note str.ljust(): 20be.    *note str.rjust(): 20bd.        *note bytes.ljust(): 269e.    *note bytes.rjust(): 269f.
                                                                                                                         
                                                                                                                         
*note str.center(): 20bf.                                       *note bytes.center(): 26a0.
                                                                
                                                                                                                         
*note str.expandtabs(): 26a1.                                   *note bytes.expandtabs(): 26a2.
                                                                
                                                                                                                         
*note str.strip(): 16cd.                                        *note bytes.strip(): 26a3.
                                                                
                                                                                                                         
*note str.lstrip(): 16ce.                                  *note str.rstrip(): 16cf.*note bytes.lstrip(): 26a4.          *note bytes.rstrip(): 26a5.
                                                                                                                         
                                                                                                                              
Translation and Encoding       *note str.translate(): 26a6.                                *note bytes.translate(): 26a7.
                                                                                           
                                                                                                                         
*note str.maketrans(): fdd.                                     *note bytes.maketrans(): 1490.
                                                                
                                                                                                                         
*note str.encode(): ad6.

                                                                *note bytes.decode(): ad7.
                                                                


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: 16a. オブジェクト、すなわち '文字列
' として扱われます。文字列は Unicode コードポイントのイミュータブルな
*note シーケンス: 208a. です。文字列リテラルには様々な記述方法があります
:

   * シングルクォート: ‘'"ダブル" クォートを埋め込むことができます'’

   * ダブルクォート: ‘"'シングル' クォートを埋め込むことができます"’。

   * 三重引用符: ‘'''三つのシングルクォート'''’, ‘"""三つのダブルクォー
     ト"""’

三重引用符文字列は、複数行に分けることができます。関連付けられる空白はす
べて文字列リテラルに含まれます。

単式の一部であり間に空白のみを含む文字列リテラルは、一つの文字列リテラル
に暗黙に変換されます。つまり、‘("spam " "eggs") == "spam eggs"’ です。

サポートされている *note エスケープシーケンス: 687. や、ほとんどのエスケ
ープシーケンスの処理を無効化する ‘r’ ("raw") 接頭辞など、文字列リテラル
のさまざまな形式についての詳細は *note 文字列およびバイト列リテラル:
22fb. を参照してください。

文字列は他のオブジェクトに *note str: 16a. コンストラクタを使うことでも
生成できます。

"character" 型が特別に用意されているわけではないので、文字列のインデック
ス指定を行うと長さ 1 の文字列を作成します。つまり、空でない文字列 's' に
対し、‘s[0] == s[0:1]’ です。

ミュータブルな文字列型もありませんが、ミュータブルな断片から効率よく文字
列を構成するのに *note str.join(): 2668. や *note io.StringIO: 112e. が
使えます。

バージョン 3.3 で変更: Python 2 シリーズとの後方互換性のため、文字列リテ
ラルの ‘u’ 接頭辞が改めて許可されました。それは文字列リテラルとしての意
味には影響がなく、 ‘r’ 接頭辞と結合することはできません。

 -- クラス: str (*, encoding='utf-8', errors='strict')

 -- クラス: str (object)

 -- クラス: str (object, encoding, errors='strict')

 -- クラス: str (object, *, errors)

     'object' の *note 文字列: 203c. 版を返します。 'object' が与えられ
     なかった場合、空文字列が返されます。それ以外の場合 ‘str()’ の動作は
     、 'encoding' や 'errors' が与えられたかどうかによって次のように変
     わります。

     'encoding' も 'errors' も与えられない場合、 ‘str(object)’ は "形式
     ばらず"、 表示用にきれいに整えられた 'object' の文字列表現である
     *note type(object).__str__(object): 830. を返します。文字列オブジェ
     クトに対しては、文字列そのものです。 'object' が ‘__str__()’ メソッ
     ドを持たない場合、 *note str(): 16a. は代わりに *note repr(object):
     1c3. の結果を返します。

     'encoding' か 'errors' の少なくとも一方が与えられた場合、 'object'
     は *note bytes-like object: 194. (たとえば *note bytes: 193. や
     *note bytearray: 342.) でなくてはなりません。'object' が ‘bytes’ (も
     しくは ‘bytearray’) オブジェクトである場合は、 ‘str(bytes,
     encoding, errors)’ は *note bytes.decode(encoding, errors): ad7. と
     等価です。そうでない場合は、 ‘bytes.decode()’ が呼ばれる前に buffer
     オブジェクトの下層にある bytes オブジェクトが取得されます。 buffer
     オブジェクトについて詳しい情報は、 *note バイナリシーケンス型 --
     bytes, bytearray, memoryview: 2623. や *note バッファプロトコル
     (buffer Protocol): 262. を参照してください。

     'encoding' 引数や 'errors' 引数無しに *note bytes: 193. オブジェク
     トを *note str(): 16a. に渡すと、略式の文字列表現を返す 1 つ目の場
     合に該当します。(Python のコマンドラインオプション *note -b: 7f9. も
     参照してください) 例えば:

          >>> str(b'Zoot!')
          "b'Zoot!'"

     ‘str’ クラスとそのメソッドについて詳しくは、 *note
     テキストシーケンス型 — str: 203c. や *note 文字列メソッド: 203d. の
     節を参照してください。フォーマットされた文字列を出力するには、
     *note f-strings: 19b. と *note Custom string formatting: 26a9. の節
     を参照してください。加えて、 *note テキスト処理サービス: 26aa. の節
     も参照してください。

* 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 共通の: 2666. シーケンス演算全てに加え、以下に述べるメソ
ッドを実装します。

文字列は、二形式の文字列書式化をサポートします。一方は柔軟さが高くカスタ
マイズできます (*note str.format(): 833.、 *note Format string syntax:
15b7. 、および *note Custom string formatting: 26a9. を参照してください
)。他方は C 言語の ‘printf’ 形式の書式化に基づいてより狭い範囲と型を扱う
もので、正しく扱うのは少し難しいですが、扱える場合ではたいていこちらのほ
うが高速です (*note printf 形式の文字列書式化: 8dc.)。

標準ライブラリの *note テキスト処理サービス: 26ac. 節は、その他テキスト
に関する様々なユーティリティ (*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(): 1bd5. would do
     nothing to ‘'ß'’; ‘casefold()’ 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: 193. にエンコードされた文字列を返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: fbc. を参照してください。

     'errors' はエンコーディングエラーをどのように取り扱うかを制御します
     。 ‘'strict'’ (デフォルト) では *note UnicodeError: 460. 例外が送出
     されます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’,
     ‘'xmlcharrefreplace'’, ‘'backslashreplace'’ と、そして *note
     codecs.register_error(): 16b9. で登録された名前です。詳しくは *note
     エラーハンドラ: 1bce. を参照してください。

     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(): 10cf. and *note removesuffix(): ad1.

 -- メソッド: 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(): 10ad. and *note index(): 1a19.

          注釈: *note find(): 10ac. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列であるかどうかのみ
          を調べるには、 *note in: 349. 演算子を使ってください:

               >>> '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
     Format string syntax: 15b7. を参照してください。

          注釈: 数値 (*note int: 19c, *note float: 197, *note complex:
          198, *note decimal.Decimal: 200. とサブクラス) を ‘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:
     184. にコピーされず、直接使われます。これは例えば ‘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(): 10ac, but raise *note ValueError: 2ee. 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(): 1473.

 -- メソッド: 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:

          >>> '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 プロパティ: 26ad.

 -- メソッド: 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 ()

     Return ‘True’ if all characters in the string are digits and there
     is at least one character, ‘False’ otherwise.  Digits include
     decimal characters and digits that need special handling, such as
     the compatibility superscript digits.  This covers digits which
     cannot be used to form numbers in base 10, like the Kharosthi
     numbers(3).  Formally, a digit is a character that has the property
     value Numeric_Type=Digit or Numeric_Type=Decimal.

     例えば:

          >>> '0123456789'.isdigit()
          True
          >>> '٠١٢٣٤٥٦٧٨٩'.isdigit()  # Arabic-Indic digits zero to nine
          True
          >>> '⅕'.isdigit()  # Vulgar fraction one fifth
          False
          >>> '²'.isdecimal(), '²'.isdigit(),  '²'.isnumeric()
          (False, True, True)

     See also *note isdecimal(): 2687. and *note isnumeric(): 268a.

 -- メソッド: str.isidentifier ()

     文字列が、 *note Names (identifiers and keywords): 22fc. 節の言語定
     義における有効な識別子であれば ‘True’ を返します。

     *note keyword.iskeyword(): 26ae. は、文字列 ‘s’ が *note def: 1678.
     や *note class: 14f3. のような予約済みの識別子かどうかを調べるのに
     使うことができます。

     例:

          >>> from keyword import iskeyword

          >>> 'hello'.isidentifier(), iskeyword('hello')
          (True, False)
          >>> 'def'.isidentifier(), iskeyword('def')
          (True, True)

 -- メソッド: str.islower ()

     文字列中の大小文字の区別のある文字 (4) 全てが小文字で、かつ大小文字
     の区別のある文字が 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 digits zero to nine
          True
          >>> '⅕'.isnumeric()  # Vulgar fraction one fifth
          True
          >>> '²'.isdecimal(), '²'.isdigit(),  '²'.isnumeric()
          (False, True, True)

     See also *note isdecimal(): 2687. and *note isdigit(): 2688.

 -- メソッド: 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():
     1c3. to use in its output; "non-printable" means that ‘repr()’ on
     built-in types will hex-escape the character.  It has no bearing on
     the handling of strings written to *note sys.stdout: cd1. or *note
     sys.stderr: b37.

     The printable characters are those which in the Unicode character
     database (see *note unicodedata: 10c.) 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)

     See also *note isspace(): 2693.

 -- メソッド: str.isspace ()

     文字列が空白文字だけからなり、かつ 1 文字以上ある場合には ‘True’ を
     返し、そうでない場合は ‘False’ を返します。

     例えば:

          >>> ''.isspace()
          False
          >>> ' '.isspace()
          True
          >>> '\t\n'.isspace() # TAB and BREAK LINE
          True
          >>> '\u3000'.isspace() # IDEOGRAPHIC SPACE
          True

     Unicode 文字データベース (*note unicodedata: 10c. を参照) で一般カ
     テゴリが ‘Zs’ ("Seperator, space") であるか、 双方向クラスが　
     ‘WS’、‘B’、 ‘S’ のいずれかである場合、その文字は '空白文字
     (whitespace)' です。

     See also *note isprintable(): fdc.

 -- メソッド: str.istitle ()

     文字列がタイトルケース文字列であり、かつ 1 文字以上ある場合、例えば
     大文字は大小文字の区別のない文字の後にのみ続き、小文字は大小文字の
     区別のある文字の後ろにのみ続く場合には ‘True’ を返します。そうでな
     い場合は ‘False’ を返します。

     例えば:

          >>> 'Spam, Spam, Spam'.istitle()
          True
          >>> 'spam, spam, spam'.istitle()
          False
          >>> 'SPAM, SPAM, SPAM'.istitle()
          False

     See also *note title(): 269a.

 -- メソッド: str.isupper ()

     文字列中の大小文字の区別のある文字 (5) 全てが大文字で、かつ大小文字
     の区別のある文字が 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: 199. will be raised if there are
     any non-string values in 'iterable', including *note bytes: 193.
     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(): 10ae.

 -- メソッド: 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(): 20bd.

 -- メソッド: str.lower ()

     Return a copy of the string with all the cased characters (6)
     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(7).

 -- メソッド: str.lstrip (chars=None, /)

     文字列の先頭の文字を除去したコピーを返します。引数 'chars' は除去さ
     れる文字の集合を指定する文字列です。 'chars' が省略されるか ‘None’
     の場合、空白文字が除去されます。 'chars' 文字列は接頭辞ではなく、そ
     の値に含まれる文字の組み合わせ全てがはぎ取られます:

          >>> '   spacious   '.lstrip()
          'spacious   '
          >>> 'www.example.com'.lstrip('cmowz.')
          'example.com'

     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note str.removeprefix(): ad0. を参照してく
     ださい。使用例:

          >>> 'Arthur: three!'.lstrip('Arthur: ')
          'ee!'
          >>> 'Arthur: three!'.removeprefix('Arthur: ')
          'three!'

 -- メソッド: static str.maketrans (dict, /)

 -- メソッド: static str.maketrans (from, to, remove='', /)

     この静的メソッドは *note str.translate(): 26a6. に使える変換テーブ
     ルを返します。

     引数を 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(): 1474.

 -- メソッド: 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(): ad1. and *note startswith(): 10cf.

 -- メソッド: 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(): ad0. and *note endswith(): 10d0.

 -- メソッド: 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(): 10ac. and *note rindex(): 1473.

 -- メソッド: str.rindex (sub[, start[, end]])

     Like *note rfind(): 10ad. but raises *note ValueError: 2ee. 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(): 1a19. and *note find(): 10ac.

 -- メソッド: str.rjust (width, fillchar=' ', /)

     'width' の長さをもつ右寄せした文字列を返します。パディングには
     'fillchar' で指定された文字(デフォルトでは ASCII スペース)が使われ
     ます。 'width' が ‘len(s)’ 以下の場合、元の文字列が返されます。

     例えば:

          >>> 'Python'.rjust(10)
          '    Python'
          >>> 'Python'.rjust(10, '.')
          '....Python'
          >>> 'Monty Python'.rjust(10, '.')
          'Monty Python'

     See also *note ljust(): 20be. and *note zfill(): 16d0.

 -- メソッド: 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(): 10af.

 -- メソッド: str.rsplit (sep=None, maxsplit=-1)

     'sep' を区切り文字とした、文字列中の単語のリストを返します。
     'maxsplit' が与えられた場合、文字列の '右端' から最大 'maxsplit' 回
     分割を行います。'sep' が指定されていない、あるいは ‘None’ のとき、
     全ての空白文字が区切り文字となります。右から分割していくことを除け
     ば、 *note rsplit(): 1471. は後ほど詳しく述べる *note split():
     10ae. と同様に振る舞います。

 -- メソッド: 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(): ad1. 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(): 16cd.

 -- メソッド: 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(): 2668. and *note rsplit(): 1471.

 -- メソッド: str.splitlines (keepends=False)

     文字列を改行部分で分解し、各行からなるリストを返します。 'keepends'
     に真が与えらない限り、返されるリストに改行は含まれません。

     このメソッドは以下の行境界で分解します。特に、以下の境界は *note
     universal newlines: f39. のスーパーセットです。

     表現                        説明
                                 
     --------------------------------------------------------------
                                 
     ‘\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(): 10ae. とは違って、デリミタ文字列 '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(): 10d0. and *note removeprefix(): ad0.

 -- メソッド: 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.

     Whitespace characters are defined by *note str.isspace(): 2693.

     例えば:

          >>> '   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(): 16cf.

 -- メソッド: str.swapcase ()

     Return a copy of the string with uppercase characters converted to
     lowercase and vice versa.  For example:

          >>> 'Hello World'.swapcase()
          'hELLO wORLD'

     Note that it is not necessarily true that ‘s.swapcase().swapcase()
     == s’.  For example:

          >>> 'straße'.swapcase().swapcase()
          'strasse'

     See also *note str.lower(): 1bd5. and *note str.upper(): 2696.

 -- メソッド: 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(): 26b0. 関数は単語をスペースでのみ分割するた
     め、この問題はありません。

     または、正規表現を使うことでアポストロフィに対応できます:

          >>> 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(): 2691.

 -- メソッド: str.translate (table, /)

     与えられた変換テーブルに基づいて文字列を構成する各文字をマッピング
     し、マッピング後の文字列のコピーを返します。変換テーブルは、*note
     __getitem__(): 588. によるインデックス指定を実装するオブジェクトで
     ある必要があります。一般的には、 *note mapping: 13d7. または *note
     sequence: 716. です。Unicode 序数 (整数) でインデックス指定する場合
     、変換テーブルのオブジェクトは次のいずれも行うことができます。
     Unicode 序数または文字列を返して文字を 1 文字以上の別の文字にマッピ
     ングすること、‘None’ を返して返り値の文字列から指定した文字を削除す
     ること、例外 *note LookupError: 2445. を送出して文字をその文字自身
     にマッピングすること。

     文字から文字への異なる形式のマッピングから変換マップを作成するため
     に、 *note str.maketrans(): fdd. が使えます。

     文字のマッピングを好みに合わせてより柔軟に変更する方法については、
     *note codecs: 1c. モジュールも参照してください。

 -- メソッド: str.upper ()

     全ての大小文字の区別のある文字 (8) が大文字に変換された、文字列のコ
     ピーを返します。なお ‘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(9).

 -- メソッド: str.zfill (width, /)

     長さが 'width' になるよう ASCII ‘'0'’ で左詰めした文字列のコピーを
     返します。先頭が符号接頭辞 (‘'+'’/‘'-'’) だった場合、 ‘'0'’ は符号
     の前ではなく '後' に挿入されます。'width' が ‘len(s)’ 以下の場合元
     の文字列を返します。

     例えば:

          >>> "42".zfill(5)
          '00042'
          >>> "-42".zfill(5)
          '-0042'

     See also *note rjust(): 20bd.

   ---------- 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) https://en.wikipedia.org/wiki/Kharosthi#Numerals

   (4) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (5) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (6) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (7) 
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G33992

   (8) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (9) 
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: 18e. and *note async for: ca5.
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: 19b. 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(): 16a.:

     >>> 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(): 1c3.:

     >>> f'{one_third = }'
     'one_third = Fraction(1, 3)'

The conversion can be specified explicitly using one of these
specifiers:

   * ‘!s’ for *note str(): 16a.

   * ‘!r’ for *note repr(): 1c3.

   * ‘!a’ for *note ascii(): 1604.

例えば:

     >>> 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():
19a. 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: 2347, with for the following differences:

   * Rather than evaluating to a ‘str’ object, template string literals
     evaluate to a *note string.templatelib.Template: 16b. object.

   * The *note format(): 19a. protocol is not used.  Instead, the format
     specifier and conversions (if any) are passed to a new *note
     Interpolation: 16c. object that is created for each evaluated
     expression.  It is up to code that processes the resulting *note
     Template: 16b. 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: 16c. 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: 26b6. will be set to '‘r’' (*note repr(): 1c3.)
     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: 19b, the *note str.format():
     833. interface, or *note string.Template: 898. 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(): 1c3. で変換   (5)
                 します)。                                                 
                 
                                                                           
‘'s'’            文字列 (Python オブジェクトを *note str(): 16a. で変換    (5)
                 します)。                                                 
                 
                                                                           
‘'a'’            文字列 (Python オブジェクトを *note ascii(): 1604. で変   (5)
                 換します)。                                               
                 
                                                                           
‘'%'’            引数を変換せず、返される文字列中では文字 ‘'%'’ になりま
                 す。
                 

For floating-point formats, the result should be correctly rounded to a
given precision ‘p’ of digits after the decimal point.  The rounding
mode matches that of the *note round(): 14f6. builtin.

注釈:

  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: 193. および
*note bytearray: 342. です。これらは、別のバイナリオブジェクトのメモリに
コピーを作成すること無くアクセスするための *note バッファプロトコル:
262. を利用する *note memoryview: 166. でサポートされています。

*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 文字列およびバイト列リテラル: 22fb. を参照してください。

     bytesリテラルと repr 出力は ASCII テキストをベースにしたものですが
     、 bytes オブジェクトは、各値が ‘0 <= x < 256’ の範囲に収まるような
     整数 (この制限に違反しようとすると *note ValueError: 2ee. が発生し
     ます) の不変なシーケンスとして振る舞います。多くのバイナリフォーマ
     ットがASCIIテキストを元にした要素を持っていたり何らかのテキスト操作
     アルゴリズムによって操作されるものの、任意のバイナリデータが一般に
     テキストになっているわけではないことを強調するためにこのように設計
     されました (何も考えずにテキスト操作アルゴリズムをASCII非互換なバイ
     ナリデータフォーマットに対して行うとデータを破壊することがあります
     )。

     リテラル以外に、幾つかの方法で bytes オブジェクトを作ることができま
     す:

        * 指定された長さの、0で埋められた bytes オブジェクト:
          ‘bytes(10)’

        * 整数の iterable から: ‘bytes(range(20))’

        * 既存のバイナリデータからバッファプロトコルでコピーする:
          ‘bytes(obj)’

     *note bytes: 1ef6. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytes 型
     にはその形式でデータを読み取るための追加のクラスメソッドがあります
     。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytes: 193. のクラスメソッドは、与えられた文字列オ
          ブジェクトをデコードして bytes オブジェクトを返します。それぞ
          れのバイトを 16 進数 2 桁で表現した文字列を指定しなければなり
          ません。ASCII 空白文字は無視されます。

               >>> bytes.fromhex('2Ef0 F1f2  ')
               b'.\xf0\xf1\xf2'

          バージョン 3.7 で変更: *note bytes.fromhex(): 191. は文字列に
          ある空白だけでなく、 ASCII の空白文字全てをスキップするように
          なりました。

          バージョン 3.14 で変更: ‘bytes.fromhex()’ now accepts ASCII
          *note bytes: 193. and *note bytes-like objects: 194. 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(): f69. が、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: 342. オブジェクトは *note bytes: 193. オブジェクトの可
変なバージョンです。

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     bytearray に専用のリテラル構文はないので、コンストラクタを使って作
     成します:

        * 空のインスタンスを作る: ‘bytearray()’

        * 指定された長さの0で埋められたインスタンスを作る:
          ‘bytearray(10)’

        * 整数の iterable から: ‘bytearray(range(20))’

        * 既存のバイナリデータからバッファプロトコルを通してコピーする:
          ‘bytearray(b'Hi!')’

     bytearray オブジェクトは可変なので、 *note bytes と bytearray
     の操作: 2622. で解説されている bytes オブジェクトと共通の操作に加え
     て、 *note mutable: 2621. シーケンス操作もサポートしています。

     *note bytearray: 1ef7. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytearray
     型にはその形式でデータを読み取るための追加のクラスメソッドがありま
     す。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytearray: 342. のクラスメソッドは、与えられた文字
          列オブジェクトをデコードして bytearray オブジェクトを返します
          。それぞれのバイトを 16 進数 2 桁で表現した文字列を指定しなけ
          ればなりません。ASCII 空白文字は無視されます。

               >>> bytearray.fromhex('2Ef0 F1f2  ')
               bytearray(b'.\xf0\xf1\xf2')

          バージョン 3.7 で変更: *note bytearray.fromhex(): 192. は文字
          列にある空白だけでなく、 ASCII の空白文字全てをスキップするよ
          うになりました。

          バージョン 3.14 で変更: ‘bytearray.fromhex()’ now accepts
          ASCII *note bytes: 193. and *note bytes-like objects: 194. 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(): f69. と同様に、
          *note bytearray.hex(): f6a. が、16進数出力の各バイトを分割する
          セパレータを挿入するためのオプションパラメータ 'sep' と
          'bytes_per_sep' をサポートするようになりました。

      -- メソッド: resize (size, /)

          Resize the ‘bytearray’ to contain 'size' bytes.  'size' must
          be greater than or equal to 0.

          If the ‘bytearray’ needs to shrink, bytes beyond 'size' are
          truncated.

          If the ‘bytearray’ 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)’ で整数のリス
トに変換できます。

参考
....

For detailed information on thread-safety guarantees for *note
bytearray: 342. objects, see *note Thread safety for bytearray objects:
26bb.


File: python.info,  Node: bytes と bytearray の操作,  Next: printf 形式での bytes の書式化,  Prev: bytearray オブジェクト,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.3 bytes と bytearray の操作
..................................

bytes と bytearray は両方共 *note 一般のシーケンス操作: 2666. をサポート
しています。また、両方とも *note bytes-like object: 194. をサポートして
いる任意のオブジェクトを対象に操作することもできます。この柔軟性により
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: 194. ま
     たは 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: 194. にできます。

          注釈: 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: 194. にできます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

     Added in version 3.9.

 -- メソッド: bytes.decode (encoding='utf-8', errors='strict')
 -- メソッド: bytearray.decode (encoding='utf-8', errors='strict')

     *note str: 16a. にデコードされたbytesを返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: fbc. を参照してください。

     'errors' はデコーディングエラーをどのように取り扱うかを制御します。
     ‘'strict'’ (デフォルト) では *note UnicodeError: 460. 例外が送出さ
     れます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’ と、そして
     *note codecs.register_error(): 16b9. で登録された名前です。詳しくは
     *note エラーハンドラ: 1bce. を参照してください。

     パフォーマンス上の理由から、 'errors' の値の妥当性は、デコーディン
     グエラーが実際に発生するか、 *note Python 開発モード: 508. が有効に
     なっているか、もしくは *note デバッグビルド: 509. が使われていない
     限りチェックされません。

          注釈: 引数 'encoding' を *note str: 16a. に渡すと *note
          bytes-like object: 194. を直接デコードすることができます。つま
          り、一時的な ‘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:
     194. にできます。

 -- メソッド: bytes.find (sub[, start[, end]])
 -- メソッド: bytearray.find (sub[, start[, end]])

     スライス ‘s[start:end]’ に部分シーケンス 'sub' が含まれる場合、デー
     タ中のその 'sub' の最小のインデックスを返します。オプション引数
     'start' および 'end' はスライス表記と同様に解釈されます。 'sub' が
     見つからなかった場合、 ‘-1’ を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 194. ま
     たは 0 から 255 の範囲の整数にできます。

          注釈: *note find(): 1c31. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列 (訳注: おそらく原
          文の誤り、正しくは部分シーケンス) であるかどうかのみを調べるに
          は、 *note in: 349. 演算子を使ってください:

               >>> b'Py' in b'Python'
               True

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.index (sub[, start[, end]])
 -- メソッド: bytearray.index (sub[, start[, end]])

     *note find(): 1c31. と同様ですが、部分シーケンスが見つからなかった
     場合 *note ValueError: 2ee. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 194. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.join (iterable, /)
 -- メソッド: bytearray.join (iterable, /)

     'iterable' 中のバイナリデータを結合した bytes または bytearray オブ
     ジェクトを返します。 'iterable' に *note str: 16a. オブジェクトなど
     *note bytes-like objects: 194. ではない値が含まれている場合、 *note
     TypeError: 199. が送出されます。なお要素間のセパレータは、このメソ
     ッドを提供する bytes または bytearray オブジェクトとなります。

 -- メソッド: static bytes.maketrans (from, to, /)
 -- メソッド: static bytearray.maketrans (from, to, /)

     この静的メソッドは、 *note bytes.translate(): 26a7. に渡すのに適し
     た変換テーブルを返します。このテーブルは、 'from' 中の各バイトを
     'to' の同じ位置にあるバイトにマッピングします。 'from' と 'to' は両
     方とも同じ長さの *note bytes-like objects: 194. でなければなりませ
     ん。

     Added in version 3.1.

 -- メソッド: bytes.partition (sep, /)
 -- メソッド: bytearray.partition (sep, /)

     区切り 'sep' が最初に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切りが見つからなければ、タプルには元のシーケンスのコピーと
     、その後ろに二つの空の bytes または bytearray オブジェクトが入りま
     す。

     検索する区切りとしては、任意の *note bytes-like object: 194. を指定
     できます。

 -- メソッド: bytes.replace (old, new, count=-1, /)
 -- メソッド: bytearray.replace (old, new, count=-1, /)

     Return a copy of the sequence with all occurrences of subsequence
     'old' replaced by 'new'.  If the optional argument 'count' is
     given, only the first 'count' occurrences are replaced.

     検索する部分シーケンスおよび置換後の部分シーケンスとしては、任意の
     *note bytes-like object: 194. を指定できます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rfind (sub[, start[, end]])
 -- メソッド: bytearray.rfind (sub[, start[, end]])

     シーケンス中の領域 ‘s[start:end]’ に 'sub' が含まれる場合、その最大
     のインデックスを返します。オプション引数 'start' および 'end' はス
     ライス表記と同様に解釈されます。 'sub' が見つからなかった場合 ‘-1’
     を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 194. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rindex (sub[, start[, end]])
 -- メソッド: bytearray.rindex (sub[, start[, end]])

     *note rfind(): 1c32. と同様ですが、部分シーケンス 'sub' が見つから
     なかった場合 *note ValueError: 2ee. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 194. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rpartition (sep, /)
 -- メソッド: bytearray.rpartition (sep, /)

     区切り 'sep' が最後に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切れなければ、タプルには二つの空の bytes または bytearray オ
     ブジェクトと、その後ろに元のシーケンスのコピーが入ります。

     検索する区切りとしては、任意の *note bytes-like object: 194. を指定
     できます。

 -- メソッド: bytes.startswith (prefix[, start[, end]])
 -- メソッド: bytearray.startswith (prefix[, start[, end]])

     バイナリデータが指定された 'prefix' で始まる場合は ‘True’ を、そう
     でなければ ‘False’ を返します。 'prefix' は見つけたい複数の接頭語の
     タプルでも構いません。オプションの 'start' が指定されている場合、そ
     の位置から判定を開始します。オプションの 'end' が指定されている場合
     、その位置で比較を終了します。

     検索対象の接頭語 (複数も可) は、任意の *note bytes-like object:
     194. にできます。

 -- メソッド: bytes.translate (table, /, delete=b'')
 -- メソッド: bytearray.translate (table, /, delete=b'')

     オプション引数 'delete' に現れるすべてのバイトを除去し、残ったバイ
     トを与えられた変換テーブルに従ってマップした、バイト列やバイト配列
     オブジェクトのコピーを返します。変換テーブルは長さ 256 のバイト列オ
     ブジェクトでなければなりません。

     変換テーブルの作成に、 *note bytes.maketrans(): 1490. メソッドを使
     うこともできます。

     文字を削除するだけの変換には、 '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: 193. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.ljust (width, fillbyte=b' ', /)
 -- メソッド: bytearray.ljust (width, fillbyte=b' ', /)

     長さ 'width' の左寄せされたシーケンスのコピーを返します。パディング
     には 'fillbyte' で指定された値 (デフォルトでは ASCII スペース) が使
     われます。 *note bytes: 193. オブジェクトの場合、 '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: 194. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note removeprefix(): 26bd. を参照してくださ
     い。使用例:

          >>> 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: 193. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rsplit (sep=None, maxsplit=-1)
 -- メソッド: bytearray.rsplit (sep=None, maxsplit=-1)

     'sep' を区切りとして、同じ型の部分シーケンスに分割します。
     'maxsplit' が与えられた場合、シーケンスの '右端' から最大
     'maxsplit' 回だけ分割を行います。 'sep' が指定されていないか ‘None’
     のとき、 ASCII 空白文字の組み合わせで作られる部分シーケンスすべてが
     区切りとなります。右から分割していくことを除けば、 *note rsplit():
     1808. は後ほど詳しく述べる *note split(): 1807. と同様に振る舞いま
     す。

 -- メソッド: 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: 194. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接尾辞として削除す
     るメソッドについては、 *note removesuffix(): 26bf. を参照してくださ
     い。使用例:

          >>> 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: 194. を指定できます。

     例えば:

          >>> 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: 194. を指定できます。

          注釈: 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(): 269b. を参照してく
     ださい。

     例えば:

          >>> 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: f39. アプローチ
     で行を分割します。 '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(): 2680. とは違って、空シーケンスに対して区切り '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(): 269c, 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: 193. オブジェ
     クトの場合、 '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: 262. をサポ    (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: 166. オブジェクトは、Python コードが *note
バッファプロトコル: 262. をサポートするオブジェクトの内部データへ、コピ
ーすることなくアクセスすることを可能にします。

 -- クラス: memoryview (object)

          'object' を参照する *note memoryview: 166. を作成します。
          'object' はバッファプロトコルをサポートしていなければなりませ
          ん。バッファプロトコルをサポートする組み込みオブジェクトには、
          *note bytes: 193. 、 *note bytearray: 342. などがあります。

          *note memoryview: 166. は元となる 'object' が扱うメモリーの最
          小単位を '要素' として扱います。多くの単純なオブジェクト、例え
          ば *note bytes: 193. や *note bytearray: 342. では、要素は単バ
          イトになりますが、他の *note array.array: 4be. 等の型では、要
          素はより大きくなりえます。

          ‘memoryview’s are *note generic: 2429. over the type of their
          underlying data.

          ‘len(view)’ is equal to the length of *note tolist: 26df,
          which is the nested list representation of the view.  If
          ‘view.ndim = 1’, this is equal to the number of elements in
          the view.

          バージョン 3.12 で変更: ‘view.ndim == 0’ で ‘len(view)’ の場合
          、1の代わりに *note TypeError: 199. を返すようになりました。

          *note itemsize: 26e0. 属性は各要素のバイト数を与えます。

          *note memoryview: 166. はスライスおよびインデックス指定で内容
          を取得できます。一次元のスライスは部分ビューになります:

               >>> v = memoryview(b'abcefg')
               >>> v[1]
               98
               >>> v[-1]
               103
               >>> v[1:4]
               <memory at 0x7f3ddc9f4350>
               >>> bytes(v[1:4])
               b'bce'

          もしメモリビューの *note format: 1250. が *note struct: db. モ
          ジュールによって定義されているネイティブのフォーマット指定子で
          あれば、整数または整数のタプルでのインデックス指定により適切な
          型の '要素1つ' を得ることができます。一次元のメモリビューでは
          、整数または整数 1 つのタプルでインデックス指定できます。多次
          元のメモリビューでは、その次元数を 'ndim' としたとき、ちょうど
          'ndim' 個の整数からなるタプルでインデックス指定できます。ゼロ
          次元のメモリビューでは、空のタプルでインデックス指定できます。

          *note format: 1250. が単バイト単位ではない例を示します:

               >>> 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: 13e0. へ登録されるようになりました。

          バージョン 3.5 で変更: メモリビューは整数のタプルでインデック
          ス指定できるようになりました。

          バージョン 3.14 で変更: memoryview is now a *note generic
          type: 1a2.

          *note memoryview: 166. にはいくつかのメソッドがあります:

           -- メソッド: __eq__ (exporter)

               memoryview と PEP 3118(1) エクスポーターは、 shape が同じ
               で、 *note struct: db. のフォーマットで解釈したときの値が
               同じ場合に同値になります。

               *note tolist(): 26df. がサポートしている *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: 193. コンストラクタを呼び
               出すのと同等です。

                    >>> m = memoryview(b"abc")
                    >>> m.tobytes()
                    b'abc'
                    >>> bytes(m)
                    b'abc'

               連続でない配列については、結果はすべての要素がバイトに変
               換されたものを含むフラットなリスト表現に等しくなります。
               *note tobytes(): 26e2. は、 *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(): f69. と同様に、
               *note memoryview.hex(): f6b. は、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(): 26df. が *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: 342. は大きさの変更を一時的に禁止します)。です
               から、release() を呼び出すことは、これらの制約をできるだ
               け早く取り除く (そしてぶら下がったリソースをすべて解放す
               る) のに便利です。

               After this method has been called, any further operation
               on the view raises a *note ValueError: 2ee. (except
               ‘release()’ 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: 1252.）。

               キャスト後のフォーマットは単一要素のネイティブフォーマッ
               トに限定され、 *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: 2ee. 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(): 26df.) はネイティブの単一要素フォーマットに制限
               されます。

               バージョン 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: 1254. の整数のタプルです。

               バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく
               空のタプルとなるよう変更されました。

           -- の属性: strides

               配列のそれぞれの次元に対して、それぞれの要素にアクセスす
               るのに必要なバイト数を表す、長さ *note ndim: 1254. の整数
               のタプルです。

               バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく
               空のタプルとなるよう変更されました。

           -- の属性: suboffsets

               PILスタイルの配列の内部で利用している値。この値はただの情
               報として公開されています。

           -- の属性: c_contiguous

               メモリーが C 形式の順序で連続しているかどうかを示す真偽値
               （参考: *note contiguous: 1252. ）。

               Added in version 3.3.

           -- の属性: f_contiguous

               メモリーがFortran形式の順序で連続しているかどうかを示す真
               偽値（参考: *note contiguous: 1252. ）。

               Added in version 3.3.

           -- の属性: contiguous

               メモリーが連続しているかどうかを示す真偽値（参考: *note
               contiguous: 1252. ）。

               Added in version 3.3.

For information on the thread safety of *note memoryview: 166. objects
in the *note free-threaded build: 17b0, see *note Thread safety for
memoryview objects: 2471.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: set（集合）型 --- set frozenset,  Next: Mapping Types --- dict,  Prev: バイナリシーケンス型 --- bytes bytearray memoryview,  Up: 組み込み型

5.4.11 set（集合）型 -- ‘set’, ‘frozenset’
------------------------------------------

'set' オブジェクトは、固有の *note hashable: 824. オブジェクトの順序なし
コレクションです。通常の用途には、帰属テスト、シーケンスからの重複除去、
積集合、和集合、差集合、対称差 (排他的論理和) のような数学的演算の計算が
含まれます。(他のコンテナについては組み込みの *note dict: 184, *note
list: 24f, *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: 185. and *note
frozenset: 7f2.  The ‘set’ type is mutable -- the contents can be
changed using methods like *note add(): 239a. and *note remove(): 26eb.
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 ‘frozenset’ 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: 185. (*note frozenset: 7f2. ではない) は、‘set’ コン
ストラクタに加え、要素を波括弧中にカンマで区切って列挙することでも生成で
きます。例: ‘{'jack', 'sjoerd'}’。

どちらのクラスのコンストラクタも同様に働きます:

 -- クラス: set (iterable=(), /)
 -- クラス: frozenset (iterable=(), /)

     'iterable' から要素を取り込んだ、新しい *note set: 185. もしくは
     *note frozenset: 7f2. オブジェクトを返します。 集合の要素は *note
     ハッシュ可能: 824. なものでなくてはなりません。集合の集合を表現する
     ためには、内側の集合は ‘frozenset’ オブジェクトでなくてはなりません
     。'iterable' が指定されない場合、新しい空の集合が返されます。

集合はいくつかの方法で生成できます:

   * 波括弧内にカンマ区切りで要素を列挙する: ‘{'jack', 'sjoerd'}’

   * 集合内包表記を使う: ‘{c for c in 'abracadabra' if c not in 'abc'}’

   * 型コンストラクタを使う: ‘set()’, ‘set('foobar')’, ‘set(['a', 'b',
     'foo'])’

*note set: 185. および *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(): 16a1, *note
intersection(): 16a2, *note difference(): 26f1, *note
symmetric_difference(): 26f2, *note issubset(): 26ee, and *note
issuperset(): 26f0. 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: 185. と *note frozenset: 7f2. のどちらも、集合同士の比較をサ
ポートします。二つの集合は、それぞれの集合の要素全てが他方にも含まれてい
る (互いに他方の部分集合である) とき、かつそのときに限り等しいです。一方
の集合が他方の集合の真部分集合である (部分集合であるが等しくない) とき、
かつそのときに限り一方の集合は他方の集合より小さいです。一方の集合が他方
の集合の真上位集合である (上位集合であるが等しくない) とき、かつそのとき
に限り一方の集合は他方の集合より大きいです。

*note set: 185. のインスタンスは、 *note frozenset: 7f2. のインスタンス
と、要素に基づいて比較されます。例えば、 ‘set('abc') ==
frozenset('abc')’ や ‘set('abc') in set([frozenset('abc')])’ は ‘True’ を
返します。

部分集合と等価性の比較は全順序付けを行う関数へと一般化することはできませ
ん。例えば、互いに素である二つの非空集合は、等しくなく、他方の部分集合で
もありませんから、以下の 'すべて' に ‘False’ を返します: ‘a<b’, ‘a==b’,
そして ‘a>b’.

集合は半順序（部分集合関係）しか定義しないので、集合のリストにおける
*note list.sort(): dcc. メソッドの出力は未定義です。

集合の要素は、辞書のキーのように、 *note ハッシュ可能: 824. でなければな
りません。

*note set: 185. インスタンスと *note frozenset: 7f2. インスタンスを取り
混ぜての二項演算は、第一被演算子の型を返します。例えば: ‘frozenset('ab')
| set('bc')’ は ‘frozenset’ インスタンスを返します。

以下の表に挙げる演算は *note set: 185. に適用されますが、*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(): 26f5, *note
intersection_update(): 16a3, *note difference_update(): 26f6, and *note
symmetric_difference_update(): 16a4. methods will accept any iterable as
an argument.

Note, the 'elem' argument to the *note __contains__(): 15d7, *note
remove(): 26eb, and *note discard(): 26f7. methods may be a set.  To
support searching for an equivalent frozenset, a temporary one is
created from 'elem'.

参考
....

For detailed information on thread-safety guarantees for *note set: 185.
objects, see *note Thread safety for set objects: 26fa.

Sets and frozensets are *note generic: 2429. over the type of their
elements.


File: python.info,  Node: Mapping Types --- dict,  Next: コンテキストマネージャ型,  Prev: set（集合）型 --- set frozenset,  Up: 組み込み型

5.4.12 Mapping Types -- ‘dict’
------------------------------

A *note mapping: 13d7. object maps *note hashable: 824. values to
arbitrary objects.  Mappings are mutable objects.  There is currently
only one standard mapping type, the 'dictionary'.  (For other containers
see the built-in *note list: 24f, *note set: 185, and *note tuple: 614.
classes, and the *note collections: 1e. module.)

辞書のキーには、 'ほぼ' どんな値も使うことができます。 キーとして使えな
いのは、 *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: 12f5. 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: 199.  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 の実装詳細でした。

     Dictionaries are *note generic: 2429. over two types, signifying
     (respectively) the types of the dictionary's keys and values.

     以下は辞書型がサポートする操作です (それゆえ、カスタムのマップ型も
     これらの操作をサポートするべきです):

      -- 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__():
          13d9. 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 ‘__missing__()’.  If ‘__missing__()’ is not
          defined, *note KeyError: 5e7. is raised.  ‘__missing__()’ 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: 12a7.  A different ‘__missing__()’ method
          is used by *note collections.defaultdict: 13d8.

      -- 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(): 250. は新しい辞書を返すクラスメソッドです。
          'value' はデフォルトで ‘None’ となります。 作られる辞書内のす
          べての値が同一のインスタンスを指すことになるため、'value' にミ
          ュータブルなオブジェクト (例えば空のリスト) を指定しても通常意
          味はありません。 別々の値を指すようにしたい場合は、代わりに
          *note 辞書内包表記: f83. を使用してください。

      -- メソッド: get (key, default=None, /)

          'key' が辞書にあれば 'key' に対する値を、そうでなければ
          'default' を返します。 'default' が与えられなかった場合、デフ
          ォルトでは ‘None’ となります。そのため、このメソッドは *note
          KeyError: 5e7. を送出することはありません。

      -- メソッド: items ()

          辞書の項目 (‘(key, value)’ 対) の新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 26fc. を参照してください。

      -- メソッド: keys ()

          辞書のキーの新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 26fc. を参照してください。

      -- メソッド: pop (key, /)

      -- メソッド: pop (key, default, /)

          'key' が辞書に存在すればその値を辞書から消去して返し、そうでな
          ければ 'default' を返します。 'default' が与えられず、かつ
          'key' が辞書に存在しなければ *note KeyError: 5e7. を送出します
          。

      -- メソッド: popitem ()

          任意の ‘(key, value)’ 対を辞書から消去して返します。 対は LIFO
          (後入れ、先出し) の順序で返却されます。

          集合のアルゴリズムで使われるのと同じように、 *note popitem():
          1744. は辞書に繰り返し適用して消去するのに便利です。辞書が空で
          あれば、 ‘popitem()’ の呼び出しは *note KeyError: 5e7. を送出
          します。

          バージョン 3.7 で変更: LIFO 順序が保証されるようになりました。
          以前のバージョンでは、 *note popitem(): 1744. は任意の
          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’.

          ‘update()’ 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
          ビューオブジェクトのドキュメント: 26fc. を参照してください。

          ‘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
          マッピング: 13d7. か、またはキーと値のペアの *note イテラブル:
          12f5. です。 '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 types.MappingProxyType: 698. can be used to create a read-only
view of a *note dict: 184.

参考
....

For detailed information on thread-safety guarantees for *note dict:
184. objects, see *note Thread safety for dict objects: 26fd.

* Menu:

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


File: python.info,  Node: 辞書ビューオブジェクト,  Up: Mapping Types --- dict

5.4.12.1 辞書ビューオブジェクト
...............................

*note dict.keys(): 9d4, *note dict.values(): 9d5, *note dict.items():
9d6. によって返されるオブジェクトは、 'ビューオブジェクト' です。これら
は、辞書の項目の動的なビューを提供し、辞書が変更された時、ビューはその変
更を反映します。

辞書ビューは、イテレートすることで対応するデータを yield できます。また
、帰属判定をサポートします:

 -- Describe: len(dictview)

     辞書の項目数を返します。

 -- Describe: iter(dictview)

     辞書のキー、値、または (‘(key, value)’ のタプルとして表される) 項目
     に渡るイテレータを返します。

     キーと値は挿入順序で反復されます。 これにより、 ‘(value, key)’ の対
     の列を ‘pairs = zip(d.values(), d.keys())’ のように *note zip():
     1a1. で作成できます。 同じリストを作成する他の方法は、 ‘pairs =
     [(v, k) for (k, v) in d.items()]’ です。

     辞書の項目の追加や削除中にビューをイテレートすると、 *note
     RuntimeError: 246. を送出したり、すべての項目に渡ってイテレートでき
     なかったりします。

     バージョン 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: 26ff. 抽象基底クラスで定義された全ての演算が利用可
能です (たとえば ‘==’, ‘<’ や ‘^’ など)。 集合演算に対しては、集合はオペ
ランドとして集合しか取ることができないのに対して、これら集合の特性を持つ
ビューはオペランドとして任意のイテラブルを取ることができます。

辞書ビューの使用法の例:

     >>> 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: Mapping Types --- dict,  Up: 組み込み型

5.4.13 コンテキストマネージャ型
-------------------------------

Python の *note with: 187. 文は、コンテキストマネージャによって定義され
る実行時コンテキストの概念をサポートします。これは、文の本体が実行される
前に進入し文の終わりで脱出する実行時コンテキストを、ユーザ定義クラスが定
義できるようにする一対のメソッドで実装されます:

 -- メソッド: contextmanager.__enter__ ()

     実行時コンテキストに入り、このオブジェクトまたは他の実行時コンテキ
     ストに関連したオブジェクトを返します。このメソッドが返す値はこのコ
     ンテキストマネージャを使う *note with: 187. 文の ‘as’ 節の識別子に
     束縛されます。

     自分自身を返すコンテキストマネージャの例として *note
     ファイルオブジェクト: 13df. があります。ファイルオブジェクトは
     __enter__() から自分自身を返し、 *note open(): 318. が *note with:
     187. 文のコンテキスト式として使われるようにします。

     関連オブジェクトを返すコンテキストマネージャの例としては *note
     decimal.localcontext(): 15a2. が返すものがあります。このマネージャ
     はアクティブな10進数コンテキストをオリジナルのコンテキストのコピー
     にセットしてそのコピーを返します。こうすることで, *note with: 187.
     文の本体の内部で、‘with’ 文の外側のコードに影響を与えずに、 10進数
     コンテキストを変更できます。

 -- メソッド: contextmanager.__exit__ (exc_type, exc_val, exc_tb)

     実行時コンテキストから抜け、(発生していた場合) 例外を抑制するかどう
     かを示すブール値フラグを返します。 *note with: 187. 文の本体の実行
     中に例外が発生した場合、引数にはその例外の型と値とトレースバック情
     報を渡します。そうでない場合、引数は全て ‘None’ となります。

     Returning a true value from this method will cause the *note with:
     187. 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: 187. block, the new exception is
     raised, and the original exception is stored in its *note
     __context__: 14e3. attribute.

     渡された例外を明示的に再送出すべきではありません。その代わりに、こ
     のメソッドが偽の値を返すことでメソッドの正常終了と送出された例外を
     抑制しないことを伝えるべきです。このようにすればコンテキストマネー
     ジャは *note __exit__(): 151c. メソッド自体が失敗したのかどうかを簡
     単に見分けることができます。

Python は、易しいスレッド同期、ファイルなどのオブジェクトの即時クローズ
、アクティブな小数算術コンテキストの単純な操作をサポートするために、いく
つかのコンテキストマネージャを用意しています。各型はコンテキスト管理プロ
トコルを実装しているという以上の特別の取り扱いを受けるわけではありません
。例については *note contextlib: 27. モジュールを参照してください。

Python の *note ジェネレータ: 1270. と *note contextlib.contextmanager:
141f. *note デコレータ: 93e. はこのプロトコルの簡便な実装方法を提供しま
す。ジェネレータ関数を ‘contextlib.contextmanager’ デコレータでデコレー
トすると、デコレートされないジェネレータ関数が作成するイテレータの代わり
に、必要な *note __enter__(): 2701. および *note __exit__(): 2702. メソ
ッドを実装したコンテキストマネージャを返すようになります。

これらのメソッドのために Python/C API の中の Python オブジェクトの型構造
体に特別なスロットが作られたわけではないことに注意してください。これらの
メソッドを定義したい拡張型はこれらを通常の Python からアクセスできるメソ
ッドとして提供しなければなりません。実行時コンテキストを準備するオーバー
ヘッドに比べたら、一回のクラス辞書の探索のオーバーヘッドは無視できます。


File: python.info,  Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Next: その他の組み込み型,  Prev: コンテキストマネージャ型,  Up: 組み込み型

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

*note 型アノテーション: 15d. の中心となる組み込みの型は *note
ジェネリックエイリアス: 8c2. と *note ユニオン: 9c9. です。

* Menu:

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


File: python.info,  Node: ジェネリックエイリアス型,  Next: Union 型,  Up: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン

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

‘GenericAlias’ オブジェクトは一般的に、クラスに *note 添字表記: 242e. を
することで作られます。 *note list: 24f. や *note dict: 184. のような
*note コンテナ系のクラス: 2434. に対して使われることがほとんどです。 例
えば、 ‘list[int]’ は ‘list’ クラスに *note int: 19c. という引数を与えた
添字表記をすることで作られる ‘GenericAlias’ オブジェクトです。
‘GenericAlias’ オブジェクトは主に *note 型アノテーション: 15d. の用途で
使われます。

     注釈: 一般に、クラスへの添字表記は、そのクラスが特殊メソッド *note
     __class_getitem__(): 947. を実装しているときに限り可能です。

‘GenericAlias’ オブジェクトは 'パラメータ付きジェネリック型' を実装した
ジェネリック型 (*note generic type: 1a2.) の代用として振る舞います。

コンテナクラスに対してクラスの *note 添字表記: 242e. に与えられた単一ま
たは複数の引数は、そのオブジェクトが包含する要素の型をあらわします。たと
えば ‘set[bytes]’ という表記は、全ての要素が *note bytes: 193. であるよ
うな *note set: 185. をあらわす型アノテーションとして使うことができます
。

*note __class_getitem__(): 947. メソッドを定義しているけれどもコンテナで
ないクラスに対しては、クラスの添字表記に与えられた単一または複数の引数は
、しばしばオブジェクトに定義された単一または複数のメソッドの戻り値の型を
あらわします。たとえば、 *note 正規表現操作: be. は *note str: 16a. と
*note bytes: 193. の両方のデータ型に対して使うことができます:

   * ‘x = re.search('foo', 'foo')’ とした場合、 ‘x’ は *note re.Match:
     118e. オブジェクトとなり、 ‘x.group(0)’ と ‘x[0]’ の戻り値はどちら
     も *note str: 16a. となります。このようなオブジェクトは、
     ‘GenericAlias’ を使った型アノテーション ‘re.Match[str]’ で表現する
     ことができます。

   * ‘y = re.search(b'bar', b'bar')’ (ここで ‘b’ は *note bytes: 193. 型
     をあらわします) とした場合、‘y’ もまた ‘re.Match’ のインスタンスと
     なりますが、 ‘y.group(0)’ と ‘y[0]’ の戻り値はどちらも ‘bytes’ 型に
     なります。型アノテーションでは、このような *note re.Match: 118e. オ
     ブジェクトは ‘re.Match[bytes]’ と表現することになるでしょう。

‘GenericAlias’ objects are instances of the class *note
types.GenericAlias: 9f0, which can also be used to create ‘GenericAlias’
objects directly.  Specializations of user-defined *note generic
classes: 23d3. may not be instances of ‘types.GenericAlias’, but they
provide similar functionality.

 -- Describe: T[X, Y, ...]

     型 "X", "Y", またはさらに多くの引数でパラメータ化される型 ‘T’ を表
     現する ‘GenericAlias’ を生成します。引数の数は ‘T’ の使われ方によっ
     て決まります。たとえば、 *note float: 197. 型の要素を含む *note
     list: 24f. を引数にとる関数の型アノテーションは次のようになります:

          def average(values: list[float]) -> float:
              return sum(values) / len(values)

     もうひとつの例として *note mapping: 13d7. オブジェクトの場合を示し
     ます。ここではキーと値の2つの型をパラメータとするジェネリック型であ
     る *note dict: 184. を使っています。この例では、関数はキーが *note
     str: 16a. 型、値が *note int: 19c. 型であるような ‘dict’ を引数にと
     ります:

          def send_post_request(url: str, body: dict[str, int]) -> None:
              ...

組み込み関数 *note isinstance(): 2af. と *note issubclass(): 9c8. は第二
引数として ‘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 型アノテーション: 15d. は強制されません。この性
質はジェネリック型とその型パラメータにもおよびます。 ‘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'>

Instances of ‘GenericAlias’ are not classes at runtime, even though they
behave like classes (they can be instantiated and subclassed):

     >>> import inspect
     >>> inspect.isclass(list[int])
     False

This is true for *note user-defined generics: 6f6. also.

*note repr(): 1c3. や *note str(): 16a. のジェネリック型に対する呼び出し
は、パラメータ型を表示します:

     >>> 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 型変数: 2429. が使われた場合は有効です。添字の
数は''GenericAlias'' オブジェクトの *note __args__: 2705. 属性における型
変数の数と同じでなければなりません:

     >>> 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: 24f.

   * *note dict: 184.

   * *note set: 185.

   * *note frozenset: 7f2.

   * *note type: f48.

   * *note asyncio.Future: dca.

   * *note asyncio.Task: 1c9.

   * *note collections.deque: 7f4.

   * *note collections.defaultdict: 13d8.

   * *note collections.OrderedDict: 7f3.

   * *note collections.Counter: 12a7.

   * *note collections.ChainMap: e1a.

   * ’’*note collections.abc.Awaitable: fe0.

   * *note collections.abc.Coroutine: fe1.

   * *note collections.abc.AsyncIterable: fe3.

   * *note collections.abc.AsyncIterator: fe2.

   * *note collections.abc.AsyncGenerator: e8b.

   * *note collections.abc.Iterable: 2707.

   * *note collections.abc.Iterator: 2708.

   * *note collections.abc.Generator: fdf.

   * *note collections.abc.Reversible: e89.

   * *note collections.abc.Container: 2709.

   * *note collections.abc.Collection: e88.

   * *note collections.abc.Callable: 9ef.

   * *note collections.abc.Set: 26ff.

   * *note collections.abc.MutableSet: 270a.

   * *note collections.abc.Mapping: acb.

   * *note collections.abc.MutableMapping: 12c4.

   * *note collections.abc.Sequence: 13e0.

   * *note collections.abc.MutableSequence: 4bf.

   * *note collections.abc.ByteString: 340.

   * *note collections.abc.MappingView: 270b.

   * *note collections.abc.KeysView: 270c.

   * *note collections.abc.ItemsView: 270d.

   * *note collections.abc.ValuesView: 270e.

   * *note contextlib.AbstractContextManager: e8e.

   * *note contextlib.AbstractAsyncContextManager: d24.

   * *note dataclasses.Field: 19bb.

   * *note functools.cached_property: 763.

   * *note functools.partialmethod: 21a.

   * *note os.PathLike: e4f.

   * *note queue.LifoQueue: 270f.

   * *note queue.Queue: 15b0.

   * *note queue.PriorityQueue: 2710.

   * *note queue.SimpleQueue: d65.

   * *note re.Pattern: 118d.

   * *note re.Match: 118e.

   * *note shelve.BsdDbShelf: 2711.

   * *note shelve.DbfilenameShelf: 2712.

   * *note shelve.Shelf: 11a1.

   * *note types.MappingProxyType: 698.

   * *note weakref.WeakKeyDictionary: 1989.

   * *note weakref.WeakMethod: 11f5.

   * *note weakref.WeakSet: 7f5.

   * *note weakref.WeakValueDictionary: 198a.


File: python.info,  Node: GenericAlias オブジェクトの特別な属性,  Prev: 標準ジェネリッククラス,  Up: ジェネリックエイリアス型

5.4.14.3 ‘GenericAlias’ オブジェクトの特別な属性
................................................

全てのパラメータ付きジェネリック型は、下記に示す読み出し専用の属性を実装
しています。

 -- の属性: genericalias.__origin__

     この属性は、対応するパラメータ付きでないジェネリッククラスを指しま
     す:

          >>> list[int].__origin__
          <class 'list'>

 -- の属性: genericalias.__args__

     この属性は、ジェネリッククラスの元の *note __class_getitem__():
     947. に渡された *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__’
          を持たない可能性があります。これは ‘typing.ParamSpec’ が主に静
          的な型チェックを目的としているためです。

 -- の属性: genericalias.__unpacked__

     これは、型エイリアスが ‘*’ 演算子を使って取り出された場合に真となる
     真偽値です (*note TypeVarTuple: 488. を参照してください)。

     Added in version 3.11.

参考
....

PEP 484(1) - 型ヒント

     型アノテーションのための Python のフレームワークへの導入です。

PEP 585(2) - 標準コレクション型の型ヒントにおける総称型 (generics) の使用

     特殊なクラスメソッド *note __class_getitem__(): 947. を実装している
     場合に、標準ライブラリのクラスに対してネイティブにパラメータ表記を
     可能にする機能への導入です。

*note ジェネリクス: 2429, *note ユーザー定義のジェネリック型: 6f6, および *note typing.Generic: 1823.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

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: 263f.  These types are intended primarily
for *note type annotations: 15d.  The union type expression enables
cleaner type hinting syntax compared to subscripting *note typing.Union:
2aa.

 -- Describe: X | Y | ...

     'X' と 'Y' などの型を保持するUnionオブジェクトを定義すします。‘X |
     Y’ はXとYのいずれかを意味します。これは ‘typing.Union[X, Y]’ と等価
     です。たとえば、以下の関数は引数として *note int: 19c. 型または
     *note float: 197. 型を想定しています。:

          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: 2aa.:

               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(): 2af. と *note issubclass(): 9c8. の呼び出しはど
     ちらもUnionオブジェクトをサポートしています。

          >>> isinstance("", int | str)
          True

     しかし、Unionオブジェクトの中の *note parameterized generics: 8c2.
     はチェックできません:

          >>> 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: 2aa. and used for *note isinstance(): 2af. 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: 2aa.  Previously, they were instances of *note
types.UnionType: 2a9, which remains an alias for ‘typing.Union’.

   ---------- 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. です。これはモジュ
ールのシンボルテーブルを含む辞書です。この辞書を書き換えると実際にモジュ
ールのシンボルテーブルを変更することができますが、‘__dict__’ 属性を直接
代入することはできません (‘m.__dict__['a'] = 1’ と書いて ‘m.a’ を ‘1’ に
定義することはできますが、‘m.__dict__ = {}’ と書くことはできません)。
‘__dict__’ を直接書き換えることは推奨されません。

インタプリタ内に組み込まれたモジュールは、 ‘<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 オブジェクト、値、および型: 2388. および *note
クラス定義: 14f3. を参照してください。


File: python.info,  Node: 関数,  Next: メソッド,  Prev: クラスおよびクラスインスタンス,  Up: その他の組み込み型

5.4.15.3 関数
.............

関数オブジェクトは関数定義によって生成されます。関数オブジェクトに対する
唯一の操作は、それを呼び出すことです: ‘func(argument-list)’ 。

関数オブジェクトには実際には二種類あります: 組み込み関数とユーザ定義関数
です。どちらも同じ操作 (関数の呼び出し) をサポートしますが、実装は異なる
ので、オブジェクトの型も異なります。

詳細は、 *note 関数定義: 2074. を参照してください。


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: 23b6. (such as *note
append(): 8dd. on lists) and *note class instance method: 2102.
Built-in methods are described with the types that support them.

インスタンスを通してメソッド (クラスの名前空間内で定義された関数) にアク
セスすると、特殊なオブジェクトが得られます。それは束縛メソッド ('bound
method') オブジェクトで、インスタンスメソッド (*note instance method:
2102.) とも呼ばれます。呼び出された時、引数リストに ‘self’ 引数が追加さ
れます。束縛メソッドには 2 つの特殊読み出し専用属性があります。 *note
m.__self__: 15e6. はそのメソッドが操作するオブジェクトで、*note
m.__func__: 1518. はそのメソッドを実装している関数です。 ‘m(arg-1,
arg-2, ..., arg-n)’ の呼び出しは、 ‘m.__func__(m.__self__, arg-1, arg-2,
..., arg-n)’ の呼び出しと完全に等価です。

*note function objects: 59c. と同様に、メソッドオブジェクトは任意の属性
の取得をサポートしています。しかし、メソッド属性は実際には下層の関数オブ
ジェクト (*note method.__func__: 1518.) に記憶されているので、バインドさ
れるメソッドにメソッド属性を設定することは許されていません。メソッドに属
性を設定しようとすると *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 インスタンスメソッド: 2102. を参照してください。


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 監査イベント: 1ccb. を送出します
。

コードオブジェクトは、組み込み関数 *note exec(): 4a2. や *note eval():
4a3. に (ソース文字列の代わりに) 渡すことで、実行や評価できます。

詳細は、 *note 標準型の階層: 238b. を参照してください。


File: python.info,  Node: 型オブジェクト,  Next: ヌルオブジェクト,  Prev: コードオブジェクト<2>,  Up: その他の組み込み型

5.4.15.6 型オブジェクト
.......................

型オブジェクトは様々なオブジェクト型を表します。オブジェクトの型は組み込
み関数 *note type(): f48. でアクセスされます。型オブジェクトには特有の操
作はありません。標準モジュール *note types: 10a. には全ての組み込み型名
が定義されています。

型はこのように書き表されます: ‘<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: 2384. (a built-in name).  ‘type(Ellipsis)()’
produces the ‘Ellipsis’ 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: 2728. or
     *note tuple elements: 2674.

   - As the body of a function instead of a *note pass statement: 2057.

   - 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: 168c, as a pattern for missing content.

   - The default Python prompt of the *note interactive: 1b7. 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 比較: 2530. を参照して
ください。 *note NotImplemented: 1a3. オブジェクトは一つだけです。
‘type(NotImplemented)()’ はこの単一のインスタンスを作成します。

‘NotImplemented’ と書き表されます。


File: python.info,  Node: 内部オブジェクト,  Prev: NotImplemented オブジェクト,  Up: その他の組み込み型

5.4.15.10 内部オブジェクト
..........................

この情報は *note 標準型の階層: 238b. を参照してください。*note stack
frame objects: 8f0.、*note traceback objects: cf0.、スライスオブジェクト
について記述されています。


File: python.info,  Node: 特殊属性,  Next: 整数と文字列の変換での長さ制限,  Prev: その他の組み込み型,  Up: 組み込み型

5.4.16 特殊属性
---------------

実装は、いくつかのオブジェクト型に対して、適切な場合には特殊な読み出し専
用の属性を追加します。そのうちいくつかは *note dir(): 844. 組込み関数で
報告されません。

 -- の属性: definition.__name__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの名
     前です。

 -- の属性: definition.__qualname__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの
     *note 修飾名: 1d82. です。

     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: 19c. と *note
str: 16a. の間の変換に全体的な制限を設けました。この制限は10進数や2のべ
き乗以外の基数に 'のみ' 適用されます。16進数、8進数と2進数は制限がありま
せん。上限値は設定できます。

CPython の *note int: 19c. 型は、任意の長さの数をバイナリ形式で保存した
ものです (一般に "bignum" または多倍長整数として知られています)。基数が
2のべき乗でない限り、線形の時間で文字列をバイナリ整数に、あるいはバイナ
リ整数を文字列に変換できるアルゴリズムは存在しません。10進数に対するアル
ゴリズムでは、最もよく知られているものでさえ、2次に近い (sub-quadratic)
複雑さになります。高速な CPU でも、 ‘int('1' * 500_000)’ のような大きな
数の変換は1秒以上かかる可能性があります。

変換するサイズを制限することは、 CVE 2020-10735(1) を回避する実践的な方
法を提供します。

制限は、非線形な変換アルゴリズムが必要とされる場合に、入力または出力文字
列の桁数に対して適用されます。アンダースコアや正負の符号はカウントされま
せん。

演算の結果が制限を超えると、*note ValueError: 2ee. が送出されます:

     >>> 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: 14af. で定義されています。設定可能
な最小の上限値は 640 桁で、 ‘sys.int_info.str_digits_check_threshold’ で
定義されています。

確認:

     >>> 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: 19c. と *note str: 16a. または *note bytes: 193. の間
での変換で時間がかかる可能性があると適用されます:

   * ‘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(): 1c46. と *note int.to_bytes(): 1c8f. 。

   * *note hex(): 14eb, *note oct(): 14ea, *note bin(): 14c4.

   * *note Format specification mini-language: 4f9. での16進数、8進数、
     2進数での表現。

   * *note str: 16a. から *note float: 197.。

   * *note str: 16a. から *note decimal.Decimal: 200.。


File: python.info,  Node: 上限値を設定する,  Next: 推奨設定,  Prev: 影響のあるAPI,  Up: 整数と文字列の変換での長さ制限

5.4.17.2 上限値を設定する
.........................

Pythonを起動する前に環境変数またはインタープリタのコマンドラインのフラグ
で上限値を設定できます。

   * *note PYTHONINTMAXSTRDIGITS: 1b99.、たとえば
     ‘PYTHONINTMAXSTRDIGITS=640 python3’ は上限値を640に設定し、
     ‘PYTHONINTMAXSTRDIGITS=0 python3’ は制限を無効化します。

   * *note -X int_max_str_digits: 170.、たとえば ‘python3 -X
     int_max_str_digits=640’

   * *note sys.flags.int_max_str_digits: 2733. には *note
     PYTHONINTMAXSTRDIGITS: 1b99. または *note -X int_max_str_digits:
     170. の値が設定されます。環境変数と ‘-X’ オプションの両方が指定され
     た場合は ‘-X’ オプションが優先されます。 '-1' という値はどちらも未
     設定であることを表し、その場合は *note
     sys.int_info.default_max_str_digits: 2734. の値が初期化時に使用され
     ます。

コードでは、以下の *note sys: df. APIを使用して現在の上限値を調べ、新し
い値を設定できます。

   * *note sys.get_int_max_str_digits(): 187e. と *note
     sys.set_int_max_str_digits(): 1789. はインタープリタ全体での上限値
     を取得、設定できます。サブインタープリタはそれぞれの上限値を持ちま
     す。

デフォルト値と最小値に関する情報は *note sys.int_info: 14af. で参照でき
ます:

   * *note sys.int_info.default_max_str_digits: 14af. はコンパイル時のデ
     フォルト上限値です。

   * *note sys.int_info.str_digits_check_threshold: 14af. は上限値として
     指定できる最低の値です(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: 2734. は、ほとん
どのアプリケーションで適切な値であると期待されます。もしあなたのアプリケ
ーションが異なる制限値を必要とする場合は、メインのエントリーポイントから
、 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: Thread Safety Guarantees,  Prev: 組み込み型,  Up: Python 標準ライブラリ

5.5 組み込み例外
================

Python において、すべての例外は *note BaseException: 7d6. から派生したク
ラスのインスタンスでなければなりません。特定のクラスを言及する *note
except: 1ac. 節を伴う *note try: 8f9. 文において、その節はそのクラスから
派生した例外クラスも処理しますが、そのクラスの派生 '元' の例外クラスは処
理しません。サブクラス化の関係にない 2 つの例外クラスは、それらが同じ名
前だった場合でも等しくなりえません。

この章で挙げる組み込み例外は、インタプリタや組み込み関数によって生成され
ます。特に注記しないかぎり、これらはエラーの詳しい原因を示す "関連値
(associated value)" を持ちます。この値は、複数の情報 (エラーコードや、そ
のコードを説明する文字列など) の文字列かタプルです。関連値は通常、例外ク
ラスのコンストラクタに引数として渡されます。

ユーザによるコードも組み込み例外を送出できます。これを使って、例外ハンド
ラをテストしたり、インタプリタが同じ例外を送出する状況と "ちょうど同じよ
うな" エラー条件であることを報告したりできます。しかし、ユーザのコードが
適切でないエラーを送出するのを妨げる方法はないので注意してください。

組み込み例外クラスは新たな例外を定義するためにサブクラス化することができ
ます。新しい例外は、*note Exception: bd1. クラスかそのサブクラスの一つか
ら派生することをお勧めします。 *note BaseException: 7d6. からは派生しな
いで下さい。例外を定義する上での詳しい情報は、 Python チュートリアルの
*note ユーザー定義例外: 20d8. の項目にあります。

* 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: 1ac. or *note finally: 1b1. clause,
     or a *note with: 187. 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: 886. かつ
     ‘__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: bd1. を使って
     ください)。このクラスのインスタンスに *note str(): 16a. が呼ばれた
     場合、インスタンスへの引数の表現か、引数が無い場合には空文字列が返
     されます。

      -- の属性: args

          例外コンストラクタに与えられた引数のタプルです。組み込み例外は
          普通、エラーメッセージを与える一つの文字列だけを引数として呼ば
          れますが、中には (*note OSError: 2c2. など) いくつかの引数を必
          要とし、このタプルの要素に特別な意味を込めるものもあります。

      -- メソッド: 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: cf0.
          associated with this exception.  See also: *note raise 文:
          803.

      -- メソッド: add_note (note)

          例外のノートとして文字列 ‘note’ を追加します。ノートは標準のト
          レースバックで例外文字列の後に表示されます。‘note’ が文字列以
          外の場合 *note TypeError: 199. が送出されます。

          Added in version 3.11.

      -- の属性: __notes__

          *note add_note(): 7d7. で追加された例外のノートのリスト。この
          属性は ‘add_note()’ を呼び出すと生成されます。

          Added in version 3.11.

 -- 例外: Exception

     システム終了以外の全ての組み込み例外はこのクラスから派生しています
     。全てのユーザ定義例外もこのクラスから派生させるべきです。

 -- 例外: ArithmeticError

     算術上の様々なエラーに対して送出される組み込み例外 *note
     OverflowError: a85, *note ZeroDivisionError: b43, *note
     FloatingPointError: 273e. の基底クラスです。

 -- 例外: BufferError

     *note バッファ: 262. に関連する操作が行えなかったときに送出されます
     。

 -- 例外: LookupError

     マッピングまたはシーケンスで使われたキーやインデクスが無効な場合に
     送出される例外 *note IndexError: 1753. および *note KeyError: 5e7.
     の基底クラスです。 *note codecs.lookup(): b60. によって直接送出され
     ることもあります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3134/


File: python.info,  Node: 具象例外,  Next: 警告,  Prev: 基底クラス,  Up: 組み込み例外

5.5.4 具象例外
--------------

以下の例外は、通常送出される例外です。

 -- 例外: AssertionError

     *note assert: b64. 文が失敗した場合に送出されます。

 -- 例外: AttributeError

     属性参照 (*note 属性参照: 2509. を参照) や代入が失敗した場合に送出
     されます (オブジェクトが属性の参照や属性の代入をまったくサポートし
     ていない場合には *note TypeError: 199. が送出されます)。

     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: 2740. および *note obj: 2741. 属
     性が追加されました。

 -- 例外: EOFError

     Raised when the *note input(): 14f4. function hits an end-of-file
     condition (EOF) without reading any data.  (Note: the *note
     io.TextIOBase.read(): 20c8. and *note io.IOBase.readline(): 1545.
     methods return an empty string when they hit EOF.)

 -- 例外: FloatingPointError

     現在は使われていません。

 -- 例外: GeneratorExit

     *note ジェネレータ: 1270. や *note コルーチン: 6b9. が閉じられたと
     きに送出されます。 *note generator.close(): 1802. と *note
     coroutine.close(): 247a. を参照してください。この例外は厳密に言えば
     エラーではないので、 *note Exception: bd1. ではなく *note
     BaseException: 7d6. を直接継承しています。

 -- 例外: ImportError

     *note import: 7f8. 文でモジュールをロードしようとして問題が発生する
     と送出されます。 ‘from ... import’ の中の"from list" (訳注：‘...’ の
     部分)の名前が見つからないときにも送出されます。

     オブションのキーワード専用引数 'name' と 'path' は、対応する属性に
     設定されます:

      -- の属性: name

          インポートを試みたモジュールの名前。

      -- の属性: path

          例外を引き起こしたファイルのパス。

     バージョン 3.3 で変更: *note name: 17b4. および *note path: 2742. 属
     性が追加されました。

 -- 例外: ModuleNotFoundError

     *note ImportError: 65b. のサブクラスで、*note import: 7f8. 文でモジ
     ュールが見つからない場合に送出されます。また、 *note sys.modules:
     1791. に ‘None’ が含まれる場合にも送出されます。

     Added in version 3.6.

 -- 例外: IndexError

     シーケンスの添字が範囲外の場合に送出されます。 (スライスのインデク
     スはシーケンスの範囲に収まるように暗黙のうちに調整されます; インデ
     クスが整数でない場合、 *note TypeError: 199. が送出されます。)

 -- 例外: KeyError

     マッピング (辞書) のキーが、既存のキーの集合内に見つからなかった場
     合に送出されます。

 -- 例外: KeyboardInterrupt

     ユーザが割り込みキー (通常は ‘Control’-‘C’ または ‘Delete’) を押し
     た場合に送出されます。実行中、割り込みは定期的に監視されます。*note
     Exception: bd1. を捕捉するコードに誤って捕捉されてインタプリタの終
     了が阻害されないように、この例外は *note BaseException: 7d6. を継承
     しています。

          注釈: Catching a ‘KeyboardInterrupt’ 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 ‘KeyboardInterrupt’ to end the program as quickly as
          possible or avoid raising it entirely.  (See *note Note on
          Signal Handlers and Exceptions: 2743.)

 -- 例外: 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: 2744. 属性が追加されました。

 -- 例外: NotImplementedError

     この例外は *note RuntimeError: 246. から派生しています。ユーザ定義
     の基底クラスにおいて、抽象メソッドが派生クラスでオーバライドされる
     ことを要求する場合にこの例外を送出しなくてはなりません。またはクラ
     スは実装中であり本来の実装を追加する必要があることを示します。

          注釈: 演算子やメソッドがサポートされていないことを示す目的でこ
          の例外を使用するべきではありません。そのようなケースではオペレ
          ータやメソッドを未定義のままとするか、サブクラスの場合は *note
          None: 886. を設定してください。

          注意: ‘NotImplementedError’ and ‘NotImplemented’ are not
          interchangeable.  This exception should only be used as
          described above; see *note NotImplemented: 1a3. 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: 886. です。後方互換性
     のために、引数が3つ渡された場合、*note args: 78d. 属性は最初の2つの
     要素のみからなるタプルを持ちます。

     コンストラクタは実際には、 *note OS exceptions: 2745. で述べられて
     いる *note OSError: 2c2. のサブクラスを返すことがよくあります。特定
     のサブクラスは最終的な *note errno: 1821. 値によります。この挙動は
     ‘OSError’ を直接またはエイリアスで構築し、サブクラス化時に継承され
     なかった場合にのみ発生します。

      -- の属性: errno

          C 変数 ‘errno’ に由来する数値エラーコードです。

      -- の属性: winerror

          Windows において、ネイティブ Windows エラーコードを与えます。
          そして *note errno: 1821. 属性は POSIX でいうネイティブエラー
          コードへのおよその翻訳です。

          Windows では、'winerror' コンストラクタ引数が整数の場合 *note
          errno: 1821. 属性は Windows エラーコードから決定され、'errno'
          引数は無視されます。他のプラットフォームでは 'winerror' 引数は
          無視され、 *note winerror: 2746. 属性は存在しません。

      -- の属性: 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():
          318. や *note os.unlink(): 1311.) の場合、*note filename:
          2748. は関数に渡されたファイル名です。 ファイルシステムパスが
          2つ関与する関数 (例えば *note os.rename(): 130d.) の場合、
          *note filename2: 2749. は関数に渡された2つ目のファイル名です。

     バージョン 3.3 で変更: *note EnvironmentError: 1263, *note IOError:
     1262, *note WindowsError: 1264, *note socket.error: 1265, *note
     select.error: 1266. and ‘mmap.error’ have been merged into *note
     OSError: 2c2, and the constructor may return a subclass.

     バージョン 3.4 で変更: *note filename: 2748. 属性が *note
     filesystem encoding and error handler: 75d. のエンコーディングでエ
     ンコードやデコードされた名前から、関数に渡された元々のファイル名に
     なりました。 また、'filename2' コンストラクタ引数が追加されました。

 -- 例外: OverflowError

     算術演算の結果が表現できない大きな値になった場合に送出されます。こ
     れは整数では起こりません (むしろ *note MemoryError: 1772. が送出さ
     れることになるでしょう)。しかし、歴史的な理由のため、要求された範囲
     の外の整数に対して OverflowError が送出されることがあります。C の浮
     動小数点演算の例外処理は標準化されていないので、ほとんどの浮動小数
     点演算もチェックされません。

 -- 例外: PythonFinalizationError

     This exception is derived from *note RuntimeError: 246.  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
     ‘PythonFinalizationError’ during the Python finalization:

        * Creating a new Python thread.

        * *note Joining: 1401. a running daemon thread.

        * *note os.fork(): 4b5.

     *note sys.is_finalizing(): c84. 関数も参照してください。

     Added in version 3.13: 以前は *note RuntimeError: 246. をそのまま送
     出していました。

     バージョン 3.14 で変更: *note threading.Thread.join(): 1401. can
     now raise this exception.

 -- 例外: RecursionError

     この例外は *note RuntimeError: 246. を継承しています。インタープリ
     タが最大再帰深度 (*note sys.getrecursionlimit(): 6eb. を参照) の超
     過を検出すると送出されます。

     Added in version 3.5: 以前は *note RuntimeError: 246. をそのまま送
     出していました。

 -- 例外: ReferenceError

     *note weakref.proxy(): c4a. によって生成された弱参照 (weak
     reference) プロキシを使って、ガーベジコレクションによって回収された
     後の参照対象オブジェクトの属性にアクセスした場合に送出されます。弱
     参照については *note weakref: 11b. モジュールを参照してください。

 -- 例外: RuntimeError

     他のカテゴリに分類できないエラーが検出された場合に送出されます。関
     連値は、何が問題だったのかをより詳細に示す文字列です。

 -- 例外: StopIteration

     組込み関数 *note next(): 9dc. と *note iterator: 4c8. の *note
     __next__(): 14e9. メソッドによって、そのイテレータが生成するアイテ
     ムがこれ以上ないことを伝えるために送出されます。

      -- の属性: value

          この例外オブジェクトには一つの属性 ‘value’ があり、例外を構成
          する際に引数として与えられ、デフォルトは *note None: 886. です
          。

     *note generator: 1270. や *note coroutine: 6b9. 関数が返るとき、新
     しい *note StopIteration: df9. インスタンスが送出されます。 関数の
     返り値は例外のコンストラクタの *note value: 2477. 引数として使われ
     ます。

     ジェネレータのコードが直接的あるいは間接的に *note StopIteration:
     df9. を送出する場合は、 *note RuntimeError: 246. に変換されます
     (‘StopIteration’ は変換後の例外の原因として保持されます)。

     バージョン 3.3 で変更: ‘value’ 属性とジェネレータ関数が値を返すため
     にそれを使う機能が追加されました。

     バージョン 3.5 で変更: ‘from __future__ import generator_stop’ によ
     る RuntimeError への変換が導入されました。 PEP 479(1) を参照してく
     ださい。

     バージョン 3.7 で変更: PEP 479(2) が全てのコードでデフォルトで有効
     化されました: ジェネレータから送出された *note StopIteration: df9.
     は *note RuntimeError: 246. に変換されます。

 -- 例外: StopAsyncIteration

     イテレーションを停止するために、 *note asynchronous iterator: 4c7.
     オブジェクトの *note __anext__(): 18e6. メソッドによって返される必
     要があります。

     Added in version 3.5.

 -- 例外: SyntaxError (message, details)

     パーザが構文エラーに遭遇した場合に送出されます。この例外は *note
     import: 7f8. 文、組み込み関数 *note compile(): 4b1.、*note exec():
     4a2. や *note eval(): 4a3. 、初期化スクリプトの読み込みや標準入力で
     (対話的な実行時にも) 起こる可能性があります。

     例外インスタンスの *note str(): 16a. はエラーメッセージのみを返しま
     す。詳細はタプルで、個々の属性としても利用できます。

      -- の属性: 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: 274e. および *note
     end_offset: 274f. 属性が追加されました。

 -- 例外: IndentationError

     正しくないインデントに関する構文エラーの基底クラスです。これは
     *note SyntaxError: 18f. のサブクラスです。

 -- 例外: TabError

     タブとスペースを一貫しない方法でインデントに使っているときに送出さ
     れます。これは *note IndentationError: 1755. のサブクラスです。

 -- 例外: 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: 906, 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(): 279. function.
     It inherits from *note BaseException: 7d6. instead of *note
     Exception: bd1. so that it is not accidentally caught by code that
     catches ‘Exception’.  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 ‘sys.exit()’.  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(): 279. は、クリーンアップのための処理 (*note try:
     8f9. 文の *note finally: 1b1. 節) が実行されるようにするため、また
     デバッガが制御不能になるリスクを冒さずにスクリプトを実行できるよう
     にするために例外に変換されます。即座に終了することが真に強く必要で
     あるとき (例えば、*note os.fork(): 4b5. を呼んだ後の子プロセス内) に
     は *note os._exit(): 2750. 関数を使うことができます。

      -- の属性: code

          コンストラクタに渡された終了ステータス又はエラーメッセージ。
          (デフォルトは ‘None’)

 -- 例外: TypeError

     組み込み演算または関数が適切でない型のオブジェクトに対して適用され
     た際に送出されます。関連値は型の不整合に関して詳細を述べた文字列で
     す。

     この例外は、そのオブジェクトで実行しようとした操作がサポートされて
     おらず、その予定もない場合にユーザーコードから送出されるかもしれま
     せん。オブジェクトでその操作をサポートするつもりだが、まだ実装を提
     供していないのであれば、送出する適切な例外は *note
     NotImplementedError: 369. です。

     誤った型の引数が渡された場合は (例えば、*note int: 19c. が期待され
     るのに、*note list: 24f. が渡された) *note TypeError: 199. となるべ
     きです。しかし、誤った値(例えば、期待する範囲外の数)が引数として渡
     された場合は、 *note ValueError: 2ee. となるべきです。

 -- 例外: UnboundLocalError

     関数やメソッド内のローカルな変数に対して参照を行ったが、その変数に
     は値が代入されていなかった場合に送出されます。 *note NameError:
     450. のサブクラスです。

 -- 例外: UnicodeError

     Unicode に関するエンコードまたはデコードのエラーが発生した際に送出
     されます。 *note ValueError: 2ee. のサブクラスです。

     *note UnicodeError: 460. はエンコードまたはデコードのエラーの説明を
     属性として持っています。例えば、 ‘err.object[err.start:err.end]’ は
     、無効な入力のうちコーデックが処理に失敗した箇所を表します。

      -- の属性: encoding

          エラーを送出したエンコーディングの名前です。

      -- の属性: reason

          そのコーデックエラーを説明する文字列です。

      -- の属性: object

          コーデックがエンコードまたはデコードしようとしたオブジェクトで
          す。

      -- の属性: start

          *note object: c82. の最初の無効なデータのインデクスです。

          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: c82. の最後の無効なデータの次のインデクスです。

          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: 460. のサブクラスです。

 -- 例外: UnicodeDecodeError

     Unicode 関連のエラーがデコード中に発生した際に送出されます。 *note
     UnicodeError: 460. のサブクラスです。

 -- 例外: UnicodeTranslateError

     Unicode 関連のエラーが変換中に発生した際に送出されます。 *note
     UnicodeError: 460. のサブクラスです。

 -- 例外: ValueError

     演算子や関数が、正しい型だが適切でない値を持つ引数を受け取ったとき
     や、 *note IndexError: 1753. のようなより詳細な例外では記述できない
     状況で送出されます。

 -- 例外: ZeroDivisionError

     除算や剰余演算の第二引数が 0 であった場合に送出されます。関連値は文
     字列で、その演算における被演算子と演算子の型を示します。

以下の例外は、過去のバージョンとの後方互換性のために残されています;
Python 3.3 より、これらは *note OSError: 2c2. のエイリアスです。

 -- 例外: 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: 2c2. のサブクラスで、システムエラーコードに
依存して送出されます。

 -- 例外: BlockingIOError

     ある操作が、ノンブロッキング操作に設定されたオブジェクト (例えばソ
     ケット) をブロックしそうになった場合に送出されます。‘errno’ *note
     EAGAIN: 2754, *note EALREADY: 2755, *note EWOULDBLOCK: 2756. および
     *note EINPROGRESS: 2757. に対応します。

     *note BlockingIOError: 237. は、 *note OSError: 2c2. の属性に加えて
     一つの属性を持ちます:

      -- の属性: 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:
     2759. に対応します。

 -- 例外: ConnectionError

     コネクション関係の問題の基底クラス。

     サブクラスは *note BrokenPipeError: 126b, *note
     ConnectionAbortedError: 126c, *note ConnectionRefusedError: 126d,
     *note ConnectionResetError: 126e. です。

 -- 例外: BrokenPipeError

     *note ConnectionError: 100f. のサブクラスで、もう一方の端が閉じられ
     たパイプに書き込こもうとするか、書き込みのためにシャットダウンされ
     たソケットに書き込こもうとした場合に発生します。 ‘errno’ *note
     EPIPE: 275a. と *note ESHUTDOWN: 275b. に対応します。

 -- 例外: ConnectionAbortedError

     *note ConnectionError: 100f. のサブクラスで、接続の試行が通信相手に
     よって中断された場合に発生します。 ‘errno’ *note ECONNABORTED:
     275c. に対応します。

 -- 例外: ConnectionRefusedError

     *note ConnectionError: 100f. のサブクラスで、接続の試行が通信相手に
     よって拒否された場合に発生します。 ‘errno’ *note ECONNREFUSED:
     275d. に対応します。

 -- 例外: ConnectionResetError

     *note ConnectionError: 100f. のサブクラスで、接続が通信相手によって
     リセットされた場合に発生します。 ‘errno’ *note ECONNRESET: 275e. に
     対応します。

 -- 例外: FileExistsError

     すでに存在するファイルやディレクトリを作成しようとした場合に送出さ
     れます。‘errno’ *note EEXIST: 275f. に対応します。

 -- 例外: FileNotFoundError

     要求されたファイルやディレクトリが存在しない場合に送出されます。
     ‘errno’ *note ENOENT: 2760. に対応します。

 -- 例外: InterruptedError

     システムコールが入力信号によって中断された場合に送出されます。
     ‘errno’ *note EINTR: f8b. に対応します。

     バージョン 3.5 で変更: シグナルハンドラが例外を送出せず、システムコ
     ールが信号で中断された場合 Python は *note InterruptedError: f8c. を
     送出する代わりにシステムコールを再試行するようになりました (論拠に
     ついては PEP 475(1) を参照してください) 。

 -- 例外: IsADirectoryError

     ディレクトリに (*note os.remove(): 130c. などの) ファイル操作が要求
     された場合に送出されます。‘errno’ *note EISDIR: 2761. に対応します
     。

 -- 例外: NotADirectoryError

     ディレクトリへの操作(たとえば *note os.listdir(): 1316.)をディレク
     トリ以外に対して要求された場合に送出されます。多くのPOSIXプラットフ
     ォームではディレクトリではないファイルをディレクトリとして開いたり
     移動するときにも発生する場合があります。‘errno’ *note ENOTDIR:
     2762. に対応します。

 -- 例外: PermissionError

     十分なアクセス権、例えばファイルシステム権限のない操作が試みられた
     場合に送出されます。‘errno’ *note EACCES: 2763.、*note EPERM: 1bb5.
     および *note ENOTCAPABLE: 1b9e. に対応します。

     バージョン 3.11.1 で変更: WASIの *note ENOTCAPABLE: 1b9e. は *note
     PermissionError: f42. にマップされました。

 -- 例外: ProcessLookupError

     与えられたプロセスが存在しない場合に送出されます。‘errno’ *note
     ESRCH: 2764. に対応します。

 -- 例外: TimeoutError

     システム関数がシステムレベルでタイムアウトした場合に送出されます。
     ‘errno’ *note ETIMEDOUT: 2765. に対応します。

Added in version 3.3: 上記のすべての *note OSError: 2c2. サブクラスが追
加されました。

参考
....

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
警告カテゴリ: 2768. のドキュメントを参照してください。

 -- 例外: 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: 1a4. が望ましいです。

     デフォルトの警告フィルターで無効化されています。*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: 219a. を参照してください。

     Added in version 3.10.

 -- 例外: BytesWarning

     *note bytes: 193. や *note bytearray: 342. に関連した警告の基底クラ
     スです。

 -- 例外: 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: 1ac. で処
理できます。また、*note except*: 1ad. によって判別でき、例外グループに含
まれている例外の型に基づいてサブグループにマッチします。

 -- 例外: ExceptionGroup (msg, excs)

 -- 例外: BaseExceptionGroup (msg, excs)

     この2つの例外型は一連の例外 ‘excs’ を包含します。‘msg’ 引数は文字列
     の必要があります。2つのクラスの異なる点は、*note BaseException:
     7d6. は *note BaseExceptionGroup: 566. を拡張して任意の例外を含めら
     れますが、*note ExceptionGroup: 4d2. は *note Exception: bd1. を拡
     張して ‘Exception’ のサブクラスのみを含められます。この設計により
     ‘except Exception’ は ‘ExceptionGroup’ をキャッチしますが、
     ‘BaseExceptionGroup’ はキャッチしません。

     *note BaseExceptionGroup: 566. のコンストラクターは含まれる例外がす
     べて *note Exception: bd1. の場合は ‘BaseExceptionGroup’ ではなく
     *note ExceptionGroup: 4d2. を返すように自動的に選択されます。一方
     ‘ExceptionGroup’ コンストラクタは、‘Exception’ サブクラス以外の例外
     を含む場合は *note TypeError: 199. を送出します。

     Exception groups are *note generic: 2429. over the type of their
     contained exceptions.

     'CPython 実装の詳細:' The ‘excs’ parameter may be any sequence, but
     lists and tuples are specifically processed more efficiently here.
     For optimal performance, pass a tuple as ‘excs’.

      -- の属性: 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: 276d,
          *note __traceback__: 14e2, *note __cause__: 14e4, *note
          __context__: 14e3. and *note __notes__: 273c. 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(): 1a9a. と似てますが ‘(match, rest)’ のペアを
          返します。‘match’ は ‘subgroup(condition)’ で ‘rest’ は残りの
          マッチしない部分です。

      -- メソッド: derive (excs)

          同じ *note message: 276d. の例外グループを返しますが、‘excs’ の
          例外を含んでいます。

          This method is used by *note subgroup(): 1a9a. and *note
          split(): 193a, which are used in various contexts to break up
          an exception group.  A subclass needs to override it in order
          to make ‘subgroup()’ and ‘split()’ return instances of the
          subclass rather than *note ExceptionGroup: 4d2.

          *note subgroup(): 1a9a. と *note split(): 193a. は *note
          __traceback__: 14e2.、*note __cause__: 14e4.、*note
          __context__: 14e3. と *note __notes__: 273c. フィールドを元の
          例外グループから *note derive(): 1a99. が返す例外グループにコ
          ピーするため、‘derive()’ ではこれらのフィールドを更新する必要
          がありません。

               >>> 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 ‘BaseExceptionGroup’ defines *note __new__(): 7a0, so
     subclasses that need a different constructor signature need to
     override that rather than *note __init__(): 8c0.  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
     ‘BaseExceptionGroup’ which is also a subclass of *note Exception:
     bd1. can only wrap instances of ‘Exception’.

     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: Thread Safety Guarantees,  Next: テキスト処理サービス,  Prev: 組み込み例外,  Up: Python 標準ライブラリ

5.6 Thread Safety Guarantees
============================

This page documents thread-safety guarantees for built-in types in
Python's free-threaded build.  The guarantees described here apply when
using Python with the *note GIL: 165. disabled (free-threaded mode).
When the GIL is enabled, most operations are implicitly serialized.

For general guidance on writing thread-safe code in free-threaded
Python, see *note Python support for free threading: 2774.

* Menu:

* Thread safety levels::
* Thread safety for list objects::
* Thread safety for dict objects::
* Thread safety for set objects::
* Thread safety for bytearray objects::
* Thread safety for memoryview objects::


File: python.info,  Node: Thread safety levels,  Next: Thread safety for list objects,  Up: Thread Safety Guarantees

5.6.1 Thread safety levels
--------------------------

The C API documentation uses the following levels to describe the thread
safety guarantees of each function.  The levels are listed from least to
most safe.

* Menu:

* Incompatible::
* Compatible::
* Safe on distinct objects::
* Safe on shared objects::
* Atomic::


File: python.info,  Node: Incompatible,  Next: Compatible,  Up: Thread safety levels

5.6.1.1 Incompatible
....................

A function or operation that cannot be made safe for concurrent use even
with external synchronization.  Incompatible code typically accesses
global state in an unsynchronized way and must only be called from a
single thread throughout the program's lifetime.

Example: a function that modifies process-wide state such as signal
handlers or environment variables, where concurrent calls from any
threads, even with external locking, can conflict with the runtime or
other libraries.


File: python.info,  Node: Compatible,  Next: Safe on distinct objects,  Prev: Incompatible,  Up: Thread safety levels

5.6.1.2 Compatible
..................

A function or operation that is safe to call from multiple threads
'provided' the caller supplies appropriate external synchronization, for
example by holding a *note lock: 277b. for the duration of each call.
Without such synchronization, concurrent calls may produce *note race
conditions: 277c. or *note data races: 277d.

Example: a function that reads from or writes to an object whose
internal state is not protected by a lock.  Callers must ensure that no
two threads access the same object at the same time.


File: python.info,  Node: Safe on distinct objects,  Next: Safe on shared objects,  Prev: Compatible,  Up: Thread safety levels

5.6.1.3 Safe on distinct objects
................................

A function or operation that is safe to call from multiple threads
without external synchronization, as long as each thread operates on a
'different' object.  Two threads may call the function at the same time,
but they must not pass the same object (or objects that share underlying
state) as arguments.

Example: a function that modifies fields of a struct using non-atomic
writes.  Two threads can each call the function on their own struct
instance safely, but concurrent calls on the 'same' instance require
external synchronization.


File: python.info,  Node: Safe on shared objects,  Next: Atomic,  Prev: Safe on distinct objects,  Up: Thread safety levels

5.6.1.4 Safe on shared objects
..............................

A function or operation that is safe for concurrent use on the 'same'
object.  The implementation uses internal synchronization (such as *note
per-object locks: 2782. or *note critical sections: 2783.) to protect
shared mutable state, so callers do not need to supply their own
locking.

Example: *note PyList_GetItemRef(): 5fe. can be called from multiple
threads on the same *note PyListObject: 2784. - it uses internal
synchronization to serialize access.


File: python.info,  Node: Atomic,  Prev: Safe on shared objects,  Up: Thread safety levels

5.6.1.5 Atomic
..............

A function or operation that appears *note atomic: 2787. with respect to
other threads - it executes instantaneously from the perspective of
other threads.  This is the strongest form of thread safety.

Example: *note PyMutex_IsLocked(): 461. performs an atomic read of the
mutex state and can be called from any thread at any time.


File: python.info,  Node: Thread safety for list objects,  Next: Thread safety for dict objects,  Prev: Thread safety levels,  Up: Thread Safety Guarantees

5.6.2 Thread safety for list objects
------------------------------------

Reading a single element from a *note list: 24f. is *note atomic: 2787.:

     lst[i]   # list.__getitem__

The following methods traverse the list and use *note atomic: 2787.
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:
2782.  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:
2782.

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:
2787. 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: 2787.:

     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: 2787.  Other
threads cannot observe elements being removed.

The *note sort(): dcc. method is not *note atomic: 2787.  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: 2789. 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(): 1abc. method may allow concurrent modifications
since element comparison may execute arbitrary Python code (via *note
__eq__(): cf6.).

*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: 24f, a *note tuple: 614, a *note set: 185, a *note frozenset: 7f2,
a *note dict: 184. or a *note dictionary view object: 26fc. (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: 24f. (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: 24f.
instances across threads.


File: python.info,  Node: Thread safety for dict objects,  Next: Thread safety for set objects,  Prev: Thread safety for list objects,  Up: Thread Safety Guarantees

5.6.3 Thread safety for dict objects
------------------------------------

Creating a dictionary with the *note dict: 184. constructor is atomic
when the argument to it is a ‘dict’ or a *note tuple: 614.  When using
the *note dict.fromkeys(): 250. method, dictionary creation is atomic
when the argument is a ‘dict’, ‘tuple’, *note set: 185. or *note
frozenset: 7f2.

The following operations and functions are *note lock-free: 2789. and
*note atomic: 2787.

     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: 2782.

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__(): cf6, which can
execute arbitrary Python code.  During such comparisons, the dictionary
may be modified by another thread.  For built-in types like *note str:
16a, *note int: 19c, and *note float: 197, that implement ‘__eq__()’ 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: 2782. 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(): 17ca. method holds the lock for its duration.  Other
threads cannot observe elements being removed.

The following operations lock both dictionaries.  For *note update():
1683. and ‘|=’, this applies only when the other operand is a *note
dict: 184. that uses the standard dict iterator (but not subclasses that
override iteration).  For equality comparison, this applies to ‘dict’
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__(): cf6,
so for non-built-in types the lock may be released during comparison.

*note fromkeys(): 250. locks both the new dictionary and the iterable
when the iterable is exactly a *note dict: 184, *note set: 185, 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: 184.
instances across threads.


File: python.info,  Node: Thread safety for set objects,  Next: Thread safety for bytearray objects,  Prev: Thread safety for dict objects,  Up: Thread Safety Guarantees

5.6.4 Thread safety for set objects
-----------------------------------

The *note len(): 840. function is lock-free and *note atomic: 2787.

The following read operation is lock-free.  It does not block concurrent
modifications and may observe intermediate states from operations that
hold the per-object lock:

     elem in s    # set.__contains__

This operation may compare elements using *note __eq__(): cf6, which can
execute arbitrary Python code.  During such comparisons, the set may be
modified by another thread.  For built-in types like *note str: 16a,
*note int: 19c, and *note float: 197, ‘__eq__()’ does not release the
underlying lock during comparisons and this is not a concern.

All other operations from here on hold the per-object lock.

Adding or removing a single element is safe to call from multiple
threads and will not corrupt the set:

     s.add(elem)      # add element
     s.remove(elem)   # remove element, raise if missing
     s.discard(elem)  # remove element if present
     s.pop()          # remove and return arbitrary element

These operations also compare elements, so the same *note __eq__(): cf6.
considerations as above apply.

The *note copy(): 26f4. method returns a new object and holds the
per-object lock for the duration so that it is always atomic.

The *note clear(): 26f9. method holds the lock for its duration.  Other
threads cannot observe elements being removed.

The following operations only accept *note set: 185. or *note frozenset:
7f2. as operands and always lock both objects:

     s |= other                   # other must be set/frozenset
     s &= other                   # other must be set/frozenset
     s -= other                   # other must be set/frozenset
     s ^= other                   # other must be set/frozenset
     s & other                    # other must be set/frozenset
     s | other                    # other must be set/frozenset
     s - other                    # other must be set/frozenset
     s ^ other                    # other must be set/frozenset

*note set.update(): 26f5, *note set.union(): 1787, *note
set.intersection(): 1784. and *note set.difference(): 1785. can take
multiple iterables as arguments.  They all iterate through all the
passed iterables and do the following:

        * 
          *note set.update(): 26f5. and *note set.union(): 1787. lock both objects only when

               the other operand is a *note set: 185, *note frozenset:
               7f2, or *note dict: 184.

        * 
          *note set.intersection(): 1784. and *note set.difference(): 1785. always try to lock

               all objects.

*note set.symmetric_difference(): 1786. tries to lock both objects.

The update variants of the above methods also have some differences
between them:

        * 
          *note set.difference_update(): 26f6. and *note set.intersection_update(): 16a3. try

               to lock all objects one-by-one.

        * 
          *note set.symmetric_difference_update(): 16a4. only locks the arguments if it is

               of type *note set: 185, *note frozenset: 7f2, or *note
               dict: 184.

The following methods always try to lock both objects:

     s.isdisjoint(other)          # both locked
     s.issubset(other)            # both locked
     s.issuperset(other)          # both locked

Operations that involve multiple accesses, as well as iteration, are
never atomic:

     # NOT atomic: check-then-act
     if elem in s:
           s.remove(elem)

     # NOT thread-safe: iteration while modifying
     for elem in s:
           process(elem)  # another thread may modify s

Consider external synchronization when sharing *note set: 185. instances
across threads.  See *note Python support for free threading: 2774. for
more information.


File: python.info,  Node: Thread safety for bytearray objects,  Next: Thread safety for memoryview objects,  Prev: Thread safety for set objects,  Up: Thread Safety Guarantees

5.6.5 Thread safety for bytearray objects
-----------------------------------------

     The *note len(): 840. function is lock-free and *note atomic: 2787.

     Concatenation and comparisons use the buffer protocol, which
     prevents resizing but does not hold the per-object lock.  These
     operations may observe intermediate states from concurrent
     modifications:

          ba + other    # may observe concurrent writes
          ba == other   # may observe concurrent writes
          ba < other    # may observe concurrent writes

     All other operations from here on hold the per-object lock.

     Reading a single element or slice is safe to call from multiple
     threads:

          ba[i]        # bytearray.__getitem__
          ba[i:j]      # slice

     The following operations are safe to call from multiple threads and
     will not corrupt the bytearray:

          ba[i] = x         # write single byte
          ba[i:j] = values  # write slice
          ba.append(x)      # append single byte
          ba.extend(other)  # extend with iterable
          ba.insert(i, x)   # insert single byte
          ba.pop()          # remove and return last byte
          ba.pop(i)         # remove and return byte at index
          ba.remove(x)      # remove first occurrence
          ba.reverse()      # reverse in place
          ba.clear()        # remove all bytes

     Slice assignment locks both objects when 'values' is a *note
     bytearray: 342.:

          ba[i:j] = other_bytearray  # both locked

     The following operations return new objects and hold the per-object
     lock for the duration:

          ba.copy()     # returns a shallow copy
          ba * n        # repeat into new bytearray

     The membership test holds the lock for its duration:

          x in ba       # bytearray.__contains__

     All other bytearray methods (such as *note find(): 15c1, *note
     replace(): 26c3, *note split(): 1807, *note decode(): 26c1, etc.)
     hold the per-object lock for their duration.

     Operations that involve multiple accesses, as well as iteration,
     are never atomic:

          # NOT atomic: check-then-act
          if x in ba:
              ba.remove(x)

          # NOT thread-safe: iteration while modifying
          for byte in ba:
              process(byte)  # another thread may modify ba

     To safely iterate over a bytearray that may be modified by another
     thread, iterate over a copy:

          # Make a copy to iterate safely
          for byte in ba.copy():
              process(byte)

     Consider external synchronization when sharing *note bytearray:
     342. instances across threads.  See *note Python support for free
     threading: 2774. for more information.


File: python.info,  Node: Thread safety for memoryview objects,  Prev: Thread safety for bytearray objects,  Up: Thread Safety Guarantees

5.6.6 Thread safety for memoryview objects
------------------------------------------

*note memoryview: 166. objects provide access to the internal data of an
underlying object without copying.  Thread safety depends on both the
memoryview itself and the underlying buffer exporter.

The memoryview implementation uses atomic operations to track its own
exports in the *note free-threaded build: 17b0.  Creating and releasing
a memoryview are thread-safe.  Attribute access (e.g., *note shape:
1255, *note format: 1250.) reads fields that are immutable for the
lifetime of the memoryview, so concurrent reads are safe as long as the
memoryview has not been released.

However, the actual data accessed through the memoryview is owned by the
underlying object.  Concurrent access to this data is only safe if the
underlying object supports it:

   * For immutable objects like *note bytes: 193, concurrent reads
     through multiple memoryviews are safe.

   * For mutable objects like *note bytearray: 342, reading and writing
     the same memory region from multiple threads without external
     synchronization is not safe and may result in data corruption.
     Note that even read-only memoryviews of mutable objects do not
     prevent data races if the underlying object is modified from
     another thread.

     # NOT safe: concurrent writes to the same buffer
     data = bytearray(1000)
     view = memoryview(data)
     # Thread 1: view[0:500] = b'x' * 500
     # Thread 2: view[0:500] = b'y' * 500

     # Safe: use a lock for concurrent access
     import threading
     lock = threading.Lock()
     data = bytearray(1000)
     view = memoryview(data)

     with lock:
         view[0:500] = b'x' * 500

Resizing or reallocating the underlying object (such as calling *note
bytearray.resize(): 17c9.) while a memoryview is exported raises *note
BufferError: 1806.  This is enforced regardless of threading.


File: python.info,  Node: テキスト処理サービス,  Next: バイナリデータ処理,  Prev: Thread Safety Guarantees,  Up: Python 標準ライブラリ

5.7 テキスト処理サービス
========================

この章で説明するモジュールは幅広い文字列操作や様々なテキスト処理サービス
を提供しています。

*note codecs: 1c. モジュールはテキスト処理と高い関連性を持った *note
バイナリデータ処理: 2791. のなかで説明されています。加えて Python の組み
込み文字列型の *note テキストシーケンス型 -- str: 203c. のドキュメントも
参照して下さい。

* 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.7.1 ‘string’ -- 一般的な文字列操作
------------------------------------

'Source code:' Lib/string/__init__.py(1)

__________________________________________________________________

参考
....

*note テキストシーケンス型 -- str: 203c.

*note 文字列メソッド: 203d.

* Menu:

* 文字列定数::
* Custom string formatting::
* Format string syntax::
* 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: Custom string formatting,  Up: string --- 一般的な文字列操作

5.7.1.1 文字列定数
..................

このモジュールで定義されている定数は以下の通りです:

 -- データ: string.ascii_letters

     後述の *note ascii_lowercase: 2795. と *note ascii_uppercase: 2796.
     を合わせたもの。この値はロケールに依存しません。

 -- データ: 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: 2797, *note
     ascii_letters: 14df, *note punctuation: 279a, and *note whitespace:
     279b.

          注釈: By design, *note string.printable.isprintable(): fdc.
          returns *note False: d2f.  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: Custom string formatting,  Next: Format string syntax,  Prev: 文字列定数,  Up: string --- 一般的な文字列操作

5.7.1.2 Custom string formatting
................................

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: 10c1. class in the
‘string’ module allows you to create and customize your own string
formatting behaviors using the same implementation as the built-in
‘format()’ method.

 -- クラス: string.Formatter

     *note Formatter: 10c1. クラスは、以下のメソッドを持ちます:

      -- メソッド: format (format_string, /, *args, **kwargs)

          主要な API メソッドです。書式文字列と、任意の位置引数およびキ
          ーワード引数のセットを取ります。これは、*note vformat(): 279d.
          を呼び出す単なるラッパーです。

          バージョン 3.7 で変更: 書式文字列は *note 位置専用: c7c. の引
          数となりました。

      -- メソッド: vformat (format_string, args, kwargs)

          この関数はフォーマットの実際の仕事をします。この関数は、
          ‘*args’ および ‘**kwargs’ シンタックスを使用して、辞書を個々の
          引数として unpack してから再度 pack するのではなく、引数として
          あらかじめ用意した辞書を渡したい場合のために、独立した関数とし
          て公開されます。 *note vformat(): 279d. は、書式文字列を文字デ
          ータと置換フィールドに分解する仕事をします。それは、以下に記述
          する様々なメソッドを呼び出します。

     さらに、 *note Formatter: 10c1. ではサブクラスによって置き換えられ
     ることを意図した次のようないくつかのメソッドが定義されています。

      -- メソッド: parse (format_string)

          format_stringを探査し、タプル、 ('literal_text', 'field_name',
          'format_spec', 'conversion') のイテラブルを返します。これは
          *note vformat(): 279d. が文字列を文字としての文字データや置換
          フィールドに展開するために使用されます。

          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(): 279d.

      -- メソッド: 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():
          279e. is done by *note vformat(): 279d. 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 ‘vformat()’.  The return value 'used_key' has the same
          meaning as the 'key' parameter to *note get_value(): 27a0.

      -- メソッド: get_value (key, args, kwargs)

          与えられたフィールドの値を取り出します。 'key' 引数は整数でも
          文字列でも構いません。整数の場合は、位置引数 'args' のインデッ
          クス番号を示します。文字列の場合は、名前付きの引数 'kwargs' を
          意味します。

          'args' 引数は、 *note vformat(): 279d. への位置引数のリストに
          設定され、 'kwargs' 引数は、キーワード引数の辞書に設定されます
          。

          フィールド名が (ピリオドで区切られた) いくつかの要素からなって
          いる場合、最初の要素のみがこれらの関数に渡されます。残りの要素
          に関しては、通常の属性またはインデックスアクセスと同様に処理さ
          れます。

          つまり、例えば、フィールドが '0.name' と表現されるとき、 *note
          get_value(): 27a0. は、 'key' 引数が 0 として呼び出されます。
          属性 ‘name’ は、組み込みの *note getattr(): dce. 関数が呼び出
          され、 ‘get_value()’ が返されたのちに検索されます。

          インデックスまたはキーワードが存在しないアイテムを参照した場合
          、 *note IndexError: 1753. または *note KeyError: 5e7. が送出
          されます。

      -- メソッド: check_unused_args (used_args, args, kwargs)

          希望に応じて未使用の引数がないか確認する機能を実装します。この
          関数への引数は、書式指定文字列で実際に参照されるすべての引数の
          キーの set (位置引数の整数、名前付き引数の文字列) と、vformat
          に渡される 'args' と 'kwargs' への参照です。使用されない引数の
          set は、これらのパラメータから計算されます。 *note
          check_unused_args(): 27a1. は、確認の結果が偽である場合に例外
          を送出するものとみなされます。

      -- メソッド: format_field (value, format_spec)

          *note format_field(): 27a2. は単純に組み込みのグローバル関数
          *note format(): 19a. を呼び出します。このメソッドは、サブクラ
          スをオーバーライドするために提供されます。

      -- メソッド: convert_field (value, conversion)

          (*note get_field(): 279f. が返す) 値を (*note parse(): 279e. メ
          ソッドが返すタプルの形式で) 与えられた変換タイプとして変換しま
          す。デフォルトバージョンは '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: Format string syntax,  Next: Template strings $-strings,  Prev: Custom string formatting,  Up: string --- 一般的な文字列操作

5.7.1.3 Format string syntax
............................

The *note str.format(): 833. method and the *note Formatter: 10c1. class
share the same syntax for format strings (although in the case of
‘Formatter’, subclasses can define their own format string syntax).  The
syntax is related to that of *note formatted string literals: 19b. and
*note template string literals: 1860, but it is less sophisticated and,
in particular, does not support arbitrary expressions in interpolations.

書式指定文字列は波括弧 ‘{}’ に囲まれた "置換フィールド" を含みます。波括
弧に囲まれた部分以外は全て単純な文字として扱われ、変更を加えることなく出
力へコピーされます。波括弧を文字として扱う必要がある場合は、二重にするこ
とでエスケープすることができます: ‘{{’ および ‘}}’ 。

置換フィールドの文法は以下です:

     replacement_field: "{" [*note field_name: 27a6.] ["!" *note conversion: 27a7.] [":" *note format_spec: 27a8.] "}"
     field_name:        *note arg_name: 27a9. ("." *note attribute_name: 27aa. | "[" *note element_index: 27ab. "]")*
     arg_name:          [*note identifier: 231d. | *note digit: 236e.+]
     attribute_name:    *note identifier: 231d.
     element_index:     *note digit: 236e.+ | *note index_string: 27ac.
     index_string:      <any source character except "]"> +
     conversion:        "r" | "s" | "a"
     format_spec:       *note format-spec;format_spec: 27ad.

もっと簡単にいうと、置換フィールドは 'field_name' で始められます。これに
よって指定したオブジェクトの値が、置換フィールドの代わりに書式化され出力
に挿入されます。'field_name' の後に、感嘆符 ‘'!'’ を挟んで 'conversion'
フィールドを続けることができます。最後にコロン ‘':'’ を挟んで、
'format_spec' を書くことができます。これは、置換される値の非デフォルトの
書式を指定します。

*note Format specification mini-language: 4f9. 節も参照して下さい。

'field_name' それ自身は、数かキーワードのいずれかである 'arg_name' から
始まります。それが数である場合、位置引数を参照します。また、それがキーワ
ードである場合、指定されたキーワード引数を参照します。文字列に対して
*note str.isdecimal(): 2687. を呼び出した結果が真の場合、 'arg_name' は
数として扱われます。書式文字列中で数の arg_names が順に 0, 1, 2, ...  で
ある場合、それらはすべて (いくつかではありません) 省略することができます
。そして数 0, 1, 2, ...  は、自動的にその順で挿入されます。 'arg_name' は
引用符で区切られていないので、書式文字列内の任意の辞書キー (例えば文字列
‘'10'’ や ‘':-]'’ など) を指定することはできません。 'arg_name' の後に任
意の数のインデックス式または属性式を続けることができます。 ‘'.name'’ 形
式の式は *note getattr(): dce. を使用して指定された属性を選択します。一
方、 ‘'[index]'’ 形式の式は *note __getitem__(): 588. を使用してインデッ
クス参照を行います。

バージョン 3.1 で変更: *note str.format(): 833. を使い、位置引数指定を省
略することができます。 ‘'{} {}'.format(a, b)’ は ‘'{0} {1}'.format(a,
b)’ と同じになります。

バージョン 3.4 で変更: *note Formatter: 10c1. を使い、位置引数指定を省略
することができます。

簡単な書式指定文字列の例を挙げます:

     "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. によって実施されます。
しかしながら、場合によっては、文字列として変換することを強制したり、書式
指定の定義をオーバーライドしたくなることもあります。 ‘__format__()’ の呼
び出し前に値を文字列に変換すると、通常の書式変換の処理は飛ばされます。

現在 3つの変換フラグがサポートされています: 値に対して *note str(): 16a.
を呼ぶ ‘'!s'’ 、 *note repr(): 1c3. を呼ぶ ‘'!r'’ 、 *note ascii():
1604. を呼ぶ ‘'!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 書式指定例: 27af. のいくつかの例も参照して下さい。

* Menu:

* Format specification mini-language::
* 書式指定例::


File: python.info,  Node: Format specification mini-language,  Next: 書式指定例,  Up: Format string syntax

5.7.1.4 Format specification mini-language
..........................................

"Format specifications" are used within replacement fields contained
within a format string to define how individual values are presented
(see *note Format string syntax: 15b7, *note f-strings: 19b, and *note
t-strings: 1860.).  They can also be passed directly to the built-in
*note format(): 19a. function.  Each formattable type may define how the
format specification is to be interpreted.

多くの組み込み型は、書式指定に関して以下のオプションを実装します。しかし
ながら、いくつかの書式指定オプションは数値型でのみサポートされます。

一般的な取り決めとして、空の書式指定は、値に対して *note str(): 16a. を
呼び出したときと同じ結果を与えます。通常、空でない書式指定はその結果を変
更します。

一般的な書式指定子 ('standard format specifier') の書式は以下です:

     format_spec:             [*note options: 27b1.][*note width_and_precision: 27b2.][*note type: 27b3.]
     options:                 [[*note fill: 27b4.]*note align: 27b5.][*note sign: 27b6.]["z"]["#"]["0"]
     fill:                    <any character>
     align:                   "<" | ">" | "=" | "^"
     sign:                    "+" | "-" | " "
     width_and_precision:     [*note width_with_grouping: 27b7.][*note precision_with_grouping: 27b8.]
     width_with_grouping:     [*note width: 27b9.][*note grouping: 27ba.]
     precision_with_grouping: "." [*note precision: 27bb.][*note grouping: 27ba.] | "." *note grouping: 27ba.
     width:                   *note digit: 236e.+
     precision:               *note digit: 236e.+
     grouping:                "," | "_"
     type:                    "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g"
                              | "G" | "n" | "o" | "s" | "x" | "X" | "%"

有効な 'align' 値を指定する場合、その前に 'fill' 文字を付けることができ
ます。 この文字には任意の文字を指定でき、省略された場合はデフォルトの空
白文字となります。 *note formatted string literal: 19b. の中や *note
str.format(): 833. メソッドを使う場合はリテラルの波括弧 ("‘{’" と "‘}’")
を 'fill' 文字として使えないことに注意してください。 ただし、波括弧を入
れ子になった置換フィールド内に挿入することはできます。 この制限は *note
format(): 19a. 関数には影響しません。

様々な 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: 198.  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: 198.  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'’ *note float presentation
type: 27bc. or *note integer presentation type: 27bd. 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'’ になります
                   
                   Number.  This is the same as ‘'d'’, except that it uses the
     ‘'n'’         current locale setting to insert the appropriate digit group
                   separators.  Note that the default locale is not the system
                   locale.  Depending on your use case, you may wish to set
                   *note LC_NUMERIC: 27be. with *note locale.setlocale(): 930.
                   before using ‘'n'’.
                   
                   
     None          ‘'d'’ と同じです。
                   

これらの表現型に加えて、整数は (‘'n'’ と ‘None’ を除く) 以下の浮動小数点
数の表現型で書式指定できます。 そうすることで整数は書式変換される前に
*note float(): 197. を使って浮動小数点数に変換されます。

利用可能な *note float: 197. と *note Decimal: 200. の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'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: 197, and shows all coefficient digits
                   for *note Decimal: 200.  If ‘p=0’, the decimal point is
                   omitted unless the ‘#’ option is used.
                   
                   For *note float: 197, 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: 197, and uses a precision large enough to show
                   all coefficient digits for *note Decimal: 200.  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: 200. に対しては
                   -6 です。それ以外の場合、数値は書式 ‘'e'’ 型および精度 ‘p-1’
                   桁でフォーマットされます。どちらの場合でも、仮数部の有効でな
                   い末尾のゼロは取り除かれます。また小数点以下に表示する桁が無
                   い場合、 ‘'#'’ オプションが使われた場合をのぞき、小数点は除
                   去されます。
                   
                   精度が指定されない場合、 *note float: 197. に対しては有効桁
                   数として ‘6’ 桁を適用します。 *note Decimal: 200. では、フォ
                   ーマット結果の係数部は実際の値の桁数によって決まります; 絶対
                   値が ‘1e-6’ より小さい値や、最下位桁の値が1より大きい値では
                   科学的表記が使われます。それ以外の場合は固定小数点表記が使わ
                   れます。
                   
                   正と負の無限大と 0 および NaN は精度に関係なくそれぞれ
                   ‘inf’, ‘-inf’, ‘0’, ‘-0’ および ‘nan’ となります。
                   
                   
     ‘'G'’         汎用フォーマットです。数値が大きくなったとき、 ‘'E'’ に切り
                   替わることを除き、 ‘'g'’ と同じです。無限大と NaN の表示も大
                   文字になります。
                   
                   Number.  This is the same as ‘'g'’, except that it uses the
     ‘'n'’         current locale setting to insert the appropriate digit group
                   separators for the integral part of a number.  Note that the
                   default locale is not the system locale.  Depending on your
                   use case, you may wish to set *note LC_NUMERIC: 27be. with
                   *note locale.setlocale(): 930. before using ‘'n'’.
                   
                   
     ‘'%'’         パーセンテージです。数値は 100 倍され、固定小数点数フォーマ
                   ット (‘'f'’) でパーセント記号付きで表示されます。
                   
                   
     None          For *note float: 197. 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: 200. に対しては、現在の decimal コンテキスト
                   における ‘context.capitals’ の値に応じて、 ‘'g'’ か ‘'G'’ の
                   どちらかと同じになります。
                   
                   全体として、他の書式修正指定によって変更された
                   *note str(): 16a. の出力に一致するような結果になります。
                   

The result should be correctly rounded to a given precision ‘p’ of
digits after the decimal point.  The rounding mode for *note float: 197.
matches that of the *note round(): 14f6. builtin.  For *note Decimal:
200, the rounding mode of the current *note context: 27bf. will be used.

The available presentation types for *note complex: 198. are the same as
those for *note float: 197. (‘'%'’ 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(): 16a. (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: Format specification mini-language,  Up: Format string syntax

5.7.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 as dt
     >>> d = dt.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: Format string syntax,  Up: string --- 一般的な文字列操作

5.7.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:
     19b, and *note template string literals: 27c3.

     It is unrelated to template string literals (t-strings), which were
     introduced in Python 3.14.  These evaluate to *note
     string.templatelib.Template: 16b. 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: 2ee. を送出
します。

The ‘string’ module provides a *note Template: 898. class that
implements these rules.  The methods of ‘Template’ are:

 -- クラス: string.Template (template)

     コンストラクタはテンプレート文字列になる引数を一つだけ取ります。

      -- メソッド: substitute (mapping={}, /, **kwds)

          テンプレート置換を行い、新たな文字列を生成して返します。
          'mapping' はテンプレート中のプレースホルダに対応するキーを持つ
          ような任意の辞書類似オブジェクトです。辞書を指定する代わりに、
          キーワード引数も指定でき、その場合にはキーワードをプレースホル
          ダ名に対応させます。'mapping' と 'kwds' の両方が指定され、内容
          が重複した場合には、'kwds' に指定したプレースホルダを優先しま
          す。

      -- メソッド: safe_substitute (mapping={}, /, **kwds)

          *note substitute(): 2130. と同じですが、プレースホルダに対応す
          るものを 'mapping' や 'kwds' から見つけられなかった場合に、
          *note KeyError: 5e7. 例外を送出する代わりにもとのプレースホル
          ダがそのまま入ります。また、 ‘substitute()’ とは違い、規則外の
          書き方で ‘$’ を使った場合でも、 *note ValueError: 2ee. を送出
          せず単に ‘$’ を返します。

          その他の例外も発生し得る一方で、このメソッドが「安全 (safe) 」
          と呼ばれているのは、置換操作は常に、例外を送出する代わりに利用
          可能な文字列を返そうとするからです。別の見方をすれば、 *note
          safe_substitute(): 2131. は区切り間違いによるぶら下がり
          (dangling delimiter) や波括弧の非対応、 Python の識別子として
          無効なプレースホルダ名を含むような不正なテンプレートを何も警告
          せずに無視するため、安全とはいえないのです。

      -- メソッド: is_valid ()

          Returns ‘False’ if the template has invalid placeholders that
          will cause *note substitute(): 2130. to raise *note
          ValueError: 2ee.

          Added in version 3.11.

      -- メソッド: get_identifiers ()

          テンプレート内の有効な識別子のリストを、その識別子が最初に現れ
          る順番で返します。不正な識別子は無視されます。

          Added in version 3.11.

     *note Template: 898. のインスタンスは、次のような 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: 898. のサブクラスを派生して、プレー
スホルダの書式、区切り文字、テンプレート文字列の解釈に使われている正規表
現全体をカスタマイズできます。こうした作業には、以下のクラス属性をオーバ
ライドします:

   * 'delimiter' - プレースホルダの開始を示すリテラル文字列です。 デフォ
     ルトの値は ‘$’ です。 実装系はこの文字列に対して必要に応じて *note
     re.escape(): e07. を呼び出すので、正規表現になってしまうような文字
     列にしては 'なりません' 。 さらにクラスを作成した後に 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: 2ee. を送出
します。

   ---------- 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.7.1.7 ヘルパー関数
....................

 -- の関数: string.capwords (s, sep=None)

     *note str.split(): 10ae. を使って引数を単語に分割し、 *note
     str.capitalize(): 2698. を使ってそれぞれの単語の先頭の文字を大文字
     に変換し、 *note str.join(): 2668. を使ってつなぎ合わせます。オプシ
     ョンの第2引数 'sep' が与えられないか ‘None’ の場合、この置換処理は
     文字列中の連続する空白文字をスペース一つに置き換え、先頭と末尾の空
     白を削除します、それ以外の場合には 'sep' は split と join に使われ
     ます。


File: python.info,  Node: string templatelib --- テンプレート文字列リテラルのサポート,  Next: re --- 正規表現操作,  Prev: string --- 一般的な文字列操作,  Up: テキスト処理サービス

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

'ソースコード:' Lib/string/templatelib.py(1)

__________________________________________________________________

参考
....

   * *note フォーマット済み文字列リテラル: 19b.

   * *note テンプレート文字列リテラル(t-string)の構文: 1860.

   * 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.7.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: 19b, but return a
*note Template: 16b. 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.7.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: 1860.  This syntax is
     identical to that of *note f-strings: 19b, 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: 27cb.
     and dynamic *note interpolations: 27cc.  A *note values: 27cd.
     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: 16a, ...]

          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:
               16c, ...]

          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: c82, ...]

          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: 27cb.
          attribute.  For example, the following code creates a
          ‘Template’ 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: 27cb. 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: 16c. 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: a12.:

          >>> 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

     Interpolations are *note generic: 2429. over the types of their
     values.

     属性
     ....

      -- の属性: value: *note object: c82.

          The evaluated value of the interpolation.

               >>> t'{1 + 2}'.interpolations[0].value
               3

      -- の属性: expression: *note str: 16a.

          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: a59.['a', 'r', 's'] | *note
               None: 886.

          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(): 27d1. function can be
               used to mimic f-string conversion semantics.

      -- の属性: format_spec: *note str: 16a.

          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(): 19a.
               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 ‘format()’ 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: 15b7. 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.7.2.3 ヘルパー関数
....................

 -- の関数: string.templatelib.convert (obj, /, conversion)

     Applies formatted string literal *note conversion: 27ae. 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(): 16a. on the value (like ‘!s’),

        * ‘'r'’ which calls *note repr(): 1c3. (like ‘!r’), and

        * ‘'a'’ which calls *note ascii(): 1604. (like ‘!a’).

     If the conversion flag is ‘None’, 'obj' is returned unchanged.


File: python.info,  Node: re --- 正規表現操作,  Next: difflib --- 差分の計算の補助,  Prev: string templatelib --- テンプレート文字列リテラルのサポート,  Up: テキスト処理サービス

5.7.3 ‘re’ -- 正規表現操作
--------------------------

'ソースコード:' Lib/re/(1)

__________________________________________________________________

このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供
します。

パターンおよび検索される文字列には、Unicode 文字列 (*note str: 16a.) や
8 ビット文字列 (*note bytes: 193.) を使います。ただし、Unicode 文字列と
8 ビット文字列の混在はできません。つまり、Unicode 文字列にバイト列のパタ
ーンでマッチングしたり、その逆はできません。同様に、置換時の置換文字列は
パターンおよび検索文字列の両方と同じ型でなくてはなりません。

正規表現では、特殊な形式を表すためや、特殊文字をその特殊な意味を発動させ
ず使うために、バックスラッシュ文字 (‘'\'’) を使います。こうしたバックス
ラッシュの使い方は、 Python の文字列リテラルにおける同じ文字の使い方と衝
突します。例えば、リテラルのバックスラッシュにマッチさせるには、パターン
文字列として ‘'\\\\'’ と書かなければなりません。なぜなら、正規表現は
‘\\’ でなければならないうえ、それぞれのバックスラッシュは標準の Python 文
字列リテラルで ‘\\’ と表現せねばならないからです。 Python の文字列リテラ
ルにおいて、バックスラッシュの使用による不正なエスケープ文字がある場合は
、*note SyntaxWarning: 1af. が発生し、将来的には *note SyntaxError: 18f.
になることにも注意してください。この動作は、正規表現として有効な文字列に
対しても同様です。

これを解決するには、正規表現パターンに Python の raw 文字列記法を使いま
す。 ‘'r'’ を前置した文字列リテラル内ではバックスラッシュが特別扱いされ
ません。従って ‘"\n"’ が改行一文字からなる文字列であるのに対して、
‘r"\n"’ は ‘'\'’ と ‘'n'’ の二文字からなる文字列です。通常、 Python コー
ド中では、パターンをこの raw 文字列記法を使って表現します。

重要なこととして、大抵の正規表現操作は、モジュールレベルの関数としても、
*note コンパイル済み正規表現: 118d. のメソッドとしても利用できます。関数
は正規表現オブジェクトを前もってコンパイルする必要がない近道ですが、微調
整のための変数が減ります。

参考
....

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:

* Regular Expression Syntax::
* Module Contents::
* Regular Expression Objects::
* Match Objects::
* Regular Expression Examples::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/re/

   (2) https://pypi.org/project/regex/


File: python.info,  Node: Regular Expression Syntax,  Next: Module Contents,  Up: re --- 正規表現操作

5.7.3.1 Regular Expression Syntax
.................................

正規表現 (または RE) は、その表現にマッチ (match) する文字列の集合を指定
します。このモジュールの関数を使えば、ある文字列が与えられた正規表現にマ
ッチするか (または、与えられた正規表現がある文字列にマッチするか、と言い
換えても同じことになります) を検査できます。

正規表現を連結することで新しい正規表現を作れます。'A' と 'B' がともに正
規表現であれば 'AB' も正規表現です。一般的に、ある文字列 'p' が 'A' にマ
ッチし、別の文字列 'q' が 'B' にマッチするなら、文字列 'pq' は AB にマッ
チします。ただし、 'A' または 'B' に優先度の低い演算が含まれる場合や、
'A' と 'B' との間に境界条件がある場合や、番号付けされたグループ参照をし
ている場合、を除きます。こうして、ここで述べるような簡単な基本表現から、
複雑な表現を容易に構築できます。正規表現に関する理論と実装の詳細について
は Friedl 本 *note [Frie09]: 27d9. か、コンパイラの構築に関するテキスト
を参照してください。

以下で正規表現の形式を簡単に説明します。詳細な情報ややさしい説明は、
*note Regular expression HOWTO: 27da. を参照してください。

正規表現には、特殊文字と通常文字の両方を含められます。 ‘'A'’ 、 ‘'a'’ 、
または ‘'0'’ のようなほとんどの通常文字は、最も単純な正規表現です。これ
は単純に、その文字自体にマッチします。通常文字は連結できるので、 ‘last’
は文字列 ‘'last'’ にマッチします。 (この節では以降、正規表現は一般にクオ
ートを使わず ‘この特殊スタイルで’ 表記し、マッチ対象の文字列は、 ‘'シン
グルクオートで括って'’ 表記します。)

‘'|'’ や ‘'('’ といったいくつかの文字は特殊です。特殊文字は通常文字の種
別を表したり、周辺の通常文字に対する解釈方法に影響します。

繰り返しの演算子または修飾子 (‘*’、 ‘+’、 ‘?’、 ‘{m,n}’ など) は直接入れ
子にはできません。これは、非貪欲な修飾子の接尾辞 ‘?’ や他の実装での他の
修飾子との曖昧さを回避します。内側で繰り返したものをさらに繰り返すには、
丸括弧が使えます。例えば、正規表現 ‘(?:a{6})*’ は 6 の倍数個の ‘'a'’ 文
字にマッチします。

特殊文字を以下に示します:

‘.’

     (ドット) デフォルトのモードでは改行以外の任意の文字にマッチします。
     *note DOTALL: 27db. フラグが指定されていれば改行も含む全ての文字に
     マッチします。‘(?s:.)’ はフラグにかかわらず全ての文字にマッチします
     。

‘^’

     (キャレット) 文字列の先頭にマッチし、 *note MULTILINE: 27dc. モード
     では各改行の直後にもマッチします。

‘$’

     文字列の末尾、あるいは文字列の末尾の改行の直前にマッチし、 *note
     MULTILINE: 27dc. モードでは改行の前にもマッチします。 ‘foo’ は
     'foo' と 'foobar' の両方にマッチしますが、正規表現 ‘foo$’ は 'foo'
     だけにマッチします。興味深いことに、 ‘'foo1\nfoo2\n'’ を ‘foo.$’ で
     検索した場合、通常は 'foo2' だけにマッチしますが、 ‘MULTILINE’ モー
     ドでは '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: 27dd. (ASCIIのみにマッチ)

        * *note re.I: 27de. (大文字小文字を無視)

        * *note re.L: 27df. (ロケール依存)

        * *note re.M: 27e0. (マルチライン)

        * *note re.S: 27e1. (ドットはすべてにマッチ)

        * *note re.U: 27e2. (Unicodeマッチ)

        * *note re.X: 27e3. (冗長)

     (The flags are described in *note Module Contents: 27e4.)  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(): dd2. 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: 27dd. (ASCIIのみにマッチ)

        * *note re.I: 27de. (大文字小文字を無視)

        * *note re.L: 27df. (ロケール依存)

        * *note re.M: 27e0. (マルチライン)

        * *note re.S: 27e1. (ドットはすべてにマッチ)

        * *note re.U: 27e2. (Unicodeマッチ)

        * *note re.X: 27e3. (冗長)

     (The flags are described in *note Module Contents: 27e4.)

     文字 ‘'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: 193. パターンでは
     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: 193. パターンではグループの '名
     前' に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():
     1449. 関数ではなく *note search(): 1448. 関数を使う方が望ましいでし
     ょう:

          >>> 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: 193. パターンではグループの '名前' に
     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: d67. 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: d67. フラグが使われてい
     るなら単語の境界は現在のロケールによって決定されます。

     バージョン 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(): 2693.).  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():
          268b.), as well as the underscore (‘_’).

          *note ASCII: 83e. フラグを使用すると ‘[a-zA-Z0-9_]’ にマッチし
          ます。

     8 ビット (bytes) パターンでは:

          ASCII 文字セットで英数字と見なされる文字にマッチします。これは
          ‘[a-zA-Z0-9_]’ と等価です。*note LOCALE: d67. フラグが使われて
          いるなら、現在のロケールで英数字と見なされる文字およびアンダー
          スコアにマッチします。

‘\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(): 268b. returns ‘False’.

     *note ASCII: 83e. フラグを使用すると ‘[^a-zA-Z0-9_]’ にマッチします
     。

     If the *note LOCALE: d67. 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: Module Contents,  Next: Regular Expression Objects,  Prev: Regular Expression Syntax,  Up: re --- 正規表現操作

5.7.3.2 Module Contents
.......................

このモジュールはいくつかの関数、定数、例外を定義します。このうちいくつか
の関数は、コンパイル済み正規表現がそなえる完全な機能のメソッドを簡易にし
たものです。些細なものを除くほとんどのアプリケーションは常にコンパイル済
み形式を使います。

* Menu:

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


File: python.info,  Node: フラグ,  Next: 関数<2>,  Up: Module Contents

5.7.3.3 フラグ
..............

バージョン 3.6 で変更: フラグ定数は、*note enum.IntFlag: e9e. のサブクラ
スである *note RegexFlag: 83f. のインスタンスになりました。

 -- クラス: re.RegexFlag

     An *note enum.IntFlag: e9e. 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: 27e2. 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: d68. 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: d67. flag is also
     used.

     インラインフラグの ‘(?i)’ に相当します。

     Unicode パターン ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1af7.
     フラグとあわせて使われたとき、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: d67. はバイト列パターンにのみ
     使え、*note ASCII: 83e. と互換ではありません。

     バージョン 3.7 で変更: *note LOCALE: d67. フラグがあるコンパイル済
     み正規表現オブジェクトはコンパイル時のロケールに依存しなくなりまし
     た。マッチング時のロケールのみがマッチングの結果に影響します。

 -- データ: 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: Module Contents

5.7.3.4 関数
............

 -- の関数: re.compile (pattern, flags=0)

     Compile a regular expression pattern into a *note regular
     expression object: 118d, which can be used for matching using its
     *note match(): 27ec, *note search(): 27ed. and other methods,
     described below.

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 27e7. variables,
     combined using bitwise OR (the ‘|’ operator).

     シーケンス

          prog = re.compile(pattern)
          result = prog.match(string)

     は、以下と同等です

          result = re.match(pattern, string)

     が、 *note re.compile(): dd2. を使い、結果の正規表現オブジェクトを
     保存して再利用するほうが、一つのプログラムでその表現を何回も使うと
     きに効率的です。

          注釈: *note re.compile(): dd2. やモジュールレベルのマッチング
          関数に渡された最新のパターンはコンパイル済みのものがキャッシュ
          されるので、一度に正規表現を少ししか使わないプログラムでは正規
          表現をコンパイルする必要はありません。

 -- の関数: re.search (pattern, string, flags=0)

     'string' 全体を走査して、正規表現 'pattern' がマッチを発生する最初
     の位置を探して、対応する *note Match: ec7. を返します。もし文字列内
     に、そのパターンとマッチする位置がないならば、 ‘None’ を返します；
     これは、文字列内のある点で長さゼロのマッチを探すこととは異なること
     に注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 27e7. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.match (pattern, string, flags=0)

     もし 'string' の先頭で 0 個以上の文字が正規表現 'pattern' とマッチ
     すれば、対応する *note Match: ec7. を返します。もし文字列がパターン
     とマッチしなければ、 ‘None’ を返します；これは長さゼロのマッチとは
     異なることに注意して下さい。

     Note that even in *note MULTILINE: 27dc. mode, *note re.match():
     1449. will only match at the beginning of the string and not at the
     beginning of each line.

     'string' 中のどこででもマッチさせたいなら、代わりに *note search():
     1448. を使ってください (*note search() vs.  match(): 27ee. も参照し
     てください)。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 27e7. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.fullmatch (pattern, string, flags=0)

     'string' 全体が正規表現 'pattern' にマッチするなら、対応する *note
     Match: ec7. を返します。文字列がパターンにマッチしないなら ‘None’ を
     返します。これは長さ 0 のマッチとは異なることに注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 27e7. 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: 27e7. 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: 27e7. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.7 で変更: 空でないマッチが前の空マッチの直後から始めら
     れるようになりました。

 -- の関数: re.finditer (pattern, string, flags=0)

     'string' 中の正規表現 'pattern' の重複しないマッチ全てに渡る *note
     Match: ec7. オブジェクトを yield する *note イテレータ: 4c8. を返し
     ます。 'string' は左から右へ走査され、マッチは見つかった順で返され
     ます。空マッチは結果に含まれます。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 27e7. 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: ec7. 引数を取り、
     置換文字列を返します。例えば:

          >>> 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: 1bc6. でも構いません。

     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: 27e7. 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: 193. 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: 27e7. 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: Module Contents

5.7.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: Regular Expression Objects,  Next: Match Objects,  Prev: Module Contents,  Up: re --- 正規表現操作

5.7.3.6 Regular Expression Objects
..................................

 -- クラス: re.Pattern

     Compiled regular expression object returned by *note re.compile():
     dd2.

     Patterns are *note generic: 2429. over the type of string they
     handle (*note str: 16a. or *note bytes: 193.).

     バージョン 3.9 で変更: ‘re.Pattern’ supports ‘[]’ to indicate a
     Unicode (str) or bytes pattern.  See *note
     ジェネリックエイリアス型: 8c2.

 -- メソッド: Pattern.search (string[, pos[, endpos]])

     'string' 全体を走査して、この正規表現がマッチを発生する最初の位置を
     探して、対応する *note Match: ec7. を返します。もし文字列内に、その
     パターンとマッチする位置がないならば、 ‘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: ec7. を返します。もし文字列がパターンとマッチ
     しなければ、 ‘None’ を返します；これは長さゼロのマッチとは異なるこ
     とに注意して下さい。

     オプションの 'pos' および 'endpos' 引数は *note search(): 27ed. メ
     ソッドのものと同じ意味です。

          >>> 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():
     27ed. を使ってください (*note search() vs.  match(): 27ee. も参照し
     てください)。

 -- メソッド: Pattern.fullmatch (string[, pos[, endpos]])

     'string' 全体がこの正規表現にマッチするなら、対応する *note Match:
     ec7. を返します。文字列がパターンにマッチしないなら ‘None’ を返しま
     す。これは長さ 0 のマッチとは異なることに注意して下さい。

     オプションの 'pos' および 'endpos' 引数は *note search(): 27ed. メ
     ソッドのものと同じ意味です。

          >>> 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(): 122f. 関数にこのコンパイル済みパターンを使うのと似
     ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 1448. のように検索範囲を制限できます。

 -- メソッド: Pattern.finditer (string[, pos[, endpos]])

     *note finditer(): 1718. 関数にこのコンパイル済みパターンを使うのと
     似ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 1448. のように検索範囲を制限できます。

 -- メソッド: Pattern.sub (repl, string, count=0)

     *note sub(): 5a3. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- メソッド: Pattern.subn (repl, string, count=0)

     *note subn(): 5a4. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- の属性: Pattern.flags

     正規表現のマッチングフラグです。これは *note compile(): dd2. に与え
     られたフラグ、パターン中の ‘(?...)’ インラインフラグ、およびパター
     ンが Unicode 文字列だった時の *note UNICODE: d68. のような暗黙のフ
     ラグの組み合わせです。

 -- の属性: Pattern.groups

     パターン中のキャプチャグループの数です。

 -- の属性: Pattern.groupindex

     ‘(?P<id>)’ で定義されたあらゆるシンボリックグループ名をグループ番号
     へ写像する辞書です。シンボリックグループがパターン中で全く使われて
     いなければ、この辞書は空です。

 -- の属性: Pattern.pattern

     パターンオブジェクトがコンパイルされた元のパターン文字列です。

バージョン 3.7 で変更: *note copy.copy(): 757. および *note
copy.deepcopy(): d69. をサポートするようになりました。コンパイル済み正規
表現オブジェクトはアトミックであると見なされます。


File: python.info,  Node: Match Objects,  Next: Regular Expression Examples,  Prev: Regular Expression Objects,  Up: re --- 正規表現操作

5.7.3.7 Match Objects
.....................

マッチオブジェクトのブール値は常に ‘True’ です。 *note match(): 27ec. お
よび *note search(): 27ed. はマッチがないとき ‘None’ を返すので、マッチ
があるか単純な ‘if’ 文で判定できます。

     match = re.search(pattern, string)
     if match:
         process(match)

 -- クラス: re.Match

     Match object returned by successful ‘match’es and ‘search’es.

     Matches are *note generic: 2429. over the type of string which was
     matched (*note str: 16a. or *note bytes: 193.).

     バージョン 3.9 で変更: ‘re.Match’ supports ‘[]’ to indicate a
     Unicode (str) or bytes match.  See *note ジェネリックエイリアス型:
     8c2.

 -- メソッド: Match.expand (template)

     Return the string obtained by doing backslash substitution on the
     template string 'template', as done by the *note sub(): 27f5.
     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, ...])

     Returns one or more subgroups of the match.  If there is a single
     argument, the result is a single string; if there are multiple
     arguments, the result is a tuple with one item per argument.
     Without arguments, 'group1' defaults to zero (the whole match is
     returned).  If a 'groupN' argument is zero, the corresponding
     return value is the entire matching string; if it is a positive
     integer, it is the string matching the corresponding parenthesized
     group.  If a group number is negative or larger than the number of
     groups defined in the pattern, an *note IndexError: 1753. exception
     is raised.  If a group is contained in a part of the pattern that
     did not match, the corresponding result is ‘None’.  If a group is
     contained in a part of the pattern that matched multiple times, the
     last match is returned.

          >>> 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: 1753. 例外
     が送出されます。

     やや複雑な例:

          >>> 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: 1753. 例外を発生します。

     メールアドレスから '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 正規表現オブジェクト: 118d. の *note search(): 27ed. や *note
     match(): 27ec. に渡された 'pos' の値です。これは正規表現エンジンが
     マッチを探し始める位置の文字列のインデックスです。

 -- の属性: Match.endpos

     *note 正規表現オブジェクト: 118d. の *note search(): 27ed. や *note
     match(): 27ec. に渡された 'endpos' の値です。これは正規表現エンジン
     がそれ以上は進まない文字列のインデックスです。

 -- の属性: Match.lastindex

     最後にマッチしたキャプチャグループの整数インデックスです。どのグル
     ープも全くマッチしなければ ‘None’ です。例えば、表現 ‘(a)b’ 、
     ‘((a)(b))’ や ‘((ab))’ が ‘'ab'’ に適用されると ‘lastindex == 1’ と
     なり、同じ文字列に ‘(a)(b)’ が適用されると ‘lastindex == 2’ となり
     ます。

 -- の属性: Match.lastgroup

     最後にマッチしたキャプチャグループの名前です。そのグループに名前が
     ないか、どのグループも全くマッチしていなければ ‘None’ です。

 -- の属性: Match.re

     このマッチインスタンスを生じさせた *note match(): 27ec. または
     *note search(): 27ed. メソッドの属する *note 正規表現オブジェクト:
     118d. です。

 -- の属性: Match.string

     *note match(): 27ec. や *note search(): 27ed. へ渡された文字列です
     。

バージョン 3.7 で変更: *note copy.copy(): 757. および *note
copy.deepcopy(): d69. をサポートするようになりました。マッチオブジェクト
はアトミックであると見なされます。


File: python.info,  Node: Regular Expression Examples,  Prev: Match Objects,  Up: re --- 正規表現操作

5.7.3.8 Regular Expression Examples
...................................

* Menu:

* Checking for a Pair::
* scanf() をシミュレートする: scanf をシミュレートする.
* search() vs. match(): search vs match.
* Making a Phonebook::
* Text Munging::
* Finding all Adverbs::
* Finding all Adverbs and their Positions::
* Raw String Notation::
* Writing a Tokenizer::


File: python.info,  Node: Checking for a Pair,  Next: scanf をシミュレートする,  Up: Regular Expression Examples

5.7.3.9 Checking for a Pair
...........................

この例では、マッチオブジェクトをより美しく表示するために、この補助関数を
使用します:

     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(): 1230. メソッドを使えます:

     >>> 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: Checking for a Pair,  Up: Regular Expression Examples

5.7.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]+’
                                     

To extract the filename and numbers from a string like

     /usr/sbin/sendmail - 0 errors, 4 warnings

you would use a ‘scanf()’ format like

     %s - %d errors, %d warnings

The equivalent regular expression would be

     (\S+) - (\d+) errors, (\d+) warnings


File: python.info,  Node: search vs match,  Next: Making a Phonebook,  Prev: scanf をシミュレートする,  Up: Regular Expression Examples

5.7.3.11 search() vs. match()
.............................

Python offers different primitive operations based on regular
expressions:

   + *note re.match(): 1449. checks for a match only at the beginning of
     the string

   + *note re.search(): 1448. checks for a match anywhere in the string
     (this is what Perl does by default)

   + *note re.fullmatch(): 118b. 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(): 1448. で使って、マッチを文字列
の先頭でのみに制限できます:

     >>> 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 however that in *note MULTILINE: 27dc. mode *note match(): 1449.
only matches at the beginning of the string, whereas using *note
search(): 1448. with a regular expression beginning with ‘'^'’ will
match at the beginning of each line.

     >>> 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: Making a Phonebook,  Next: Text Munging,  Prev: search vs match,  Up: Regular Expression Examples

5.7.3.12 Making a Phonebook
...........................

*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: Text Munging,  Next: Finding all Adverbs,  Prev: Making a Phonebook,  Up: Regular Expression Examples

5.7.3.13 Text Munging
.....................

*note sub(): 5a3. は出現する各パターンを文字列で、または関数の返り値で置
き換えます。この例ではテキストを「秘匿」する関数と合わせて ‘sub()’ を使
うところを実演します。具体的には、文中の各単語について、最初と最後の文字
を除く全ての文字をランダムに並び替えます:

     >>> 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: Finding all Adverbs,  Next: Finding all Adverbs and their Positions,  Prev: Text Munging,  Up: Regular Expression Examples

5.7.3.14 Finding all Adverbs
............................

*note search(): 1448. は最初のパターンにのみマッチしますが、 *note
findall(): 122f. は出現する '全ての' パターンにマッチします。例えば、ラ
イターがあるテキストの全ての副詞を見つけたいなら、以下のように
‘findall()’ を使えます:

     >>> text = "He was carefully disguised but captured quickly by police."
     >>> re.findall(r"\w+ly\b", text)
     ['carefully', 'quickly']


File: python.info,  Node: Finding all Adverbs and their Positions,  Next: Raw String Notation,  Prev: Finding all Adverbs,  Up: Regular Expression Examples

5.7.3.15 Finding all Adverbs and their Positions
................................................

パターンの全てのマッチについて、マッチしたテキスト以上の情報が必要なら、
文字列ではなく *note Match: ec7. を返す *note finditer(): 1718. が便利で
す。先の例に続いて、ライターがあるテキストの全ての副詞 'およびその位置'
を見つけたいなら、以下のように ‘finditer()’ を使えます:

     >>> 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 String Notation,  Next: Writing a Tokenizer,  Prev: Finding all Adverbs and their Positions,  Up: Regular Expression Examples

5.7.3.16 Raw String Notation
............................

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: Writing a Tokenizer,  Prev: Raw String Notation,  Up: Regular Expression Examples

5.7.3.17 Writing a Tokenizer
............................

トークナイザやスキャナ(1) は文字列を解析し、文字のグループにカテゴリ分け
します。これはコンパイラやインタプリタを書くうえで役立つ第一段階です。

テキストのカテゴリは正規表現で指定されます。この技法では、それらを一つの
マスター正規表現に結合し、マッチの連続についてループします:

     from typing import NamedTuple
     import re

     class Token(NamedTuple):
         type: str
         value: int | float | 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.7.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: 121f. オブジェ
     クトでは、最悪のケースで2乗、期待値は比較されるシーケンス中に共通に
     現れる要素数に非常にややこしく依存しています。最良の場合は線形時間
     になります。

     '自動 junk ヒューリスティック:' *note SequenceMatcher: 121f. は、シ
     ーケンスの特定の要素を自動的に junk として扱うヒューリスティックを
     サポートしています。このヒューリスティックは、各個要素がシーケンス
     内に何回現れるかを数えます。ある要素の重複数が (最初のものは除いて)
     合計でシーケンスの 1% 以上になり、そのシーケンスが 200 要素以上なら
     、その要素は "popular" であるものとしてマークされ、シーケンスのマッ
     チングの目的からは junk として扱われます。このヒューリスティックは
     、 ‘SequenceMatcher’ の作成時に ‘autojunk’ パラメタを ‘False’ に設
     定することで無効化できます。

     バージョン 3.2 で変更: Added the 'autojunk' parameter.

 -- クラス: difflib.Differ

     テキスト行からなるシーケンスを比較するクラスです。人が読むことので
     きる差分を作成します。 Differ クラスは *note SequenceMatcher: 121f.
     クラスを利用して、行からなるシーケンスを比較したり、(ほぼ)同一の行
     内の文字を比較したりします。

     *note Differ: 2815. クラスによる差分の各行は、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: 203. のインスタンスを初期化します。

          'tabsize' はオプションのキーワード引数で、タブストップ幅を指定
          します。デフォルトは ‘8’ です。

          'wrapcolumn' はオプションのキーワード引数で、テキストを折り返
          すカラム幅を指定します。デフォルトは ‘None’ で折り返しを行いま
          せん。

          'linejunk' および 'charjunk' はオプションのキーワード引数で、
          *note ndiff(): 2817. (*note HtmlDiff: 203. はこの関数を使って
          左右のテキストの差分を HTML で生成します) に渡されます。それぞ
          れの引数のデフォルト値および説明は ‘ndiff()’ のドキュメントを
          参照してください。

     以下のメソッドが 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(): ff4. メソッドの引数
          と同じです。

 -- の関数: difflib.context_diff (a, b, fromfile='', tofile='',
          fromfiledate='', tofiledate='', n=3, lineterm='\n')

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 1270.) を、 context diff のフォーマット(以下「
     コンテキスト形式」)で返します。

     コンテキスト形式は、変更があった行に前後数行を加えてある、コンパク
     トな表現方法です。変更箇所は、変更前/変更後に分けて表します。コンテ
     キスト (変更箇所前後の行) の行数は 'n' で指定し、デフォルト値は 3 で
     す。

     デフォルトで、 diff 制御行 (‘***’ や ‘---’ を含む行) は改行付きで生
     成されます。 *note io.IOBase.readlines(): 2819. で作られた入力が
     *note io.IOBase.writelines(): 17eb. で扱うのに適した 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 のコマンドラインインターフェース:
     281a. を参照してください。

 -- の関数: 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 ジェネレータ: 1270.) を、 *note Differ: 2815. のスタイルで返
     します。

     オプションのキーワード引数 '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(): 2d9, which filters out lines without visible
     characters, except for at most one hash character (‘'#'’) - however
     the underlying *note SequenceMatcher: 121f. 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(): 281c. であり、これは空
     白文字類 (空白またはタブ、改行文字をこれに含めてはいけません) をフ
     ィルタして排除します。

          >>> 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(): 281e. または *note ndiff(): 2817. によって
     生成された '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 ジェネレータ: 1270.) を、 unified diff フォーマット(以下「ユ
     ニファイド形式」)で返します。

     ユニファイド形式は変更があった行にコンテキストとなる前後数行を加え
     た、コンパクトな表現方法です。変更箇所は (変更前/変更後を分離したブ
     ロックではなく) インラインスタイルで表されます。コンテキストの行数
     は、'n' で指定し、デフォルト値は 3 です。

     デフォルトで、 diff 制御行 (‘---’, ‘+++’, ‘@@’ を含む行) は改行付き
     で生成されます。 *note io.IOBase.readlines(): 2819. で作られた入力
     が *note io.IOBase.writelines(): 17eb. で扱うのに適した 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 のコマンドラインインターフェース:
     281a. を参照してください。

 -- の関数: 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(): 19e5. または *note
     context_diff(): 19e6. です。

     未知のエンコーディングまたは一貫性のないエンコーディングのデータ同
     士を比較できます。'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(): 2817. の引数 'linejunk' にデフ
     ォルトで使用されました。

 -- の関数: difflib.IS_CHARACTER_JUNK (ch)

     無視できる文字のとき ‘True’ を返します。文字 'ch' が空白、またはタ
     ブ文字のときには無視できます。それ以外の時には無視できません。
     *note ndiff(): 2817. の引数 '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 objects::
* SequenceMatcher examples::
* Differ objects::
* Differ example::
* 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 objects,  Next: SequenceMatcher examples,  Up: difflib --- 差分の計算の補助

5.7.4.1 SequenceMatcher objects
...............................

*note SequenceMatcher: 121f. クラスには、以下のようなコンストラクタがあ
ります:

 -- クラス: 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(): 2821. または *note set_seq2(): 2822. で 'b' がリ
     セットされる場合は常にリセットされます。

     Added in version 3.2: 'bjunk' および 'bpopular' 属性。

     *note SequenceMatcher: 121f. オブジェクトは以下のメソッドを持ちます
     :

      -- メソッド: set_seqs (a, b)

          比較される2つの文字列を設定します。

     *note SequenceMatcher: 121f. オブジェクトは、2つ目のシーケンスにつ
     いての詳細な情報を計算し、キャッシュします。 1つのシーケンスをいく
     つものシーケンスと比較する場合、まず *note set_seq2(): 2822. を使っ
     て文字列を設定しておき、別の文字列を1つずつ比較するために、繰り返し
     *note set_seq1(): 2823. を呼び出します。

      -- メソッド: 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(): 1da9. は ‘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 ジェネレータ: 1270. を返します。

          このメソッドは、 *note get_opcodes(): 2825. で返されるグループ
          の中から、似たような差異のかたまりに分け、間に挟まっている変更
          の無い部分を省きます。

          グループは *note get_opcodes(): 2825. と同じ書式で返されます。

      -- メソッド: ratio ()

          [0, 1] の範囲の浮動小数点数で、シーケンスの類似度を測る値を返
          します。

          T が2つのシーケンスの要素数の総計だと仮定し、M をマッチした数
          とすると、この値は 2.0*M / T であらわされます。もしシーケンス
          がまったく同じ場合、値は ‘1.0’ となり、まったく異なる場合には
          ‘0.0’ となります。

          このメソッドは *note get_matching_blocks(): 2824. または *note
          get_opcodes(): 2825. がまだ呼び出されていない場合には非常にコ
          ストが高いです。この場合、上限を素早く計算するために、 *note
          quick_ratio(): 2828. もしくは *note real_quick_ratio(): 2829.
          を最初に試してみる方がいいかもしれません。

               注釈: 注意: *note ratio(): 2827. の呼び出しの結果は引数の
               順序に依存します。例えば次の通りです:

                    >>> SequenceMatcher(None, 'tide', 'diet').ratio()
                    0.25
                    >>> SequenceMatcher(None, 'diet', 'tide').ratio()
                    0.5

      -- メソッド: quick_ratio ()

          *note ratio(): 2827. の上界を、より高速に計算します。

      -- メソッド: real_quick_ratio ()

          *note ratio(): 2827. の上界を、非常に高速に計算します。

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(): 2828. and *note real_quick_ratio(): 2829.
are always at least as large as *note ratio(): 2827.:

     >>> 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 examples,  Next: Differ objects,  Prev: SequenceMatcher objects,  Up: difflib --- 差分の計算の補助

5.7.4.2 SequenceMatcher examples
................................

この例は2つの文字列を比較します。空白を "junk" とします:

     >>> s = SequenceMatcher(lambda x: x == " ",
     ...                     "private Thread currentThread;",
     ...                     "private volatile Thread currentThread;")

*note ratio(): 2827. returns a float in [0, 1], measuring the similarity
of the sequences.  As a rule of thumb, a ‘ratio()’ 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(): 2824. 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(): 2824.
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(): 2825.:

     >>> 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: 121f. を使った、シンプルで使えるコードを知る
     には、このモジュールの関数 *note get_close_matches(): 281b. を参照
     してください。

   * Simple version control recipe(1) for a small application built with
     *note SequenceMatcher: 121f.

   ---------- Footnotes ----------

   (1) 
https://code.activestate.com/recipes/576729-simple-version-control/


File: python.info,  Node: Differ objects,  Next: Differ example,  Prev: SequenceMatcher examples,  Up: difflib --- 差分の計算の補助

5.7.4.3 Differ objects
......................

*note Differ: 2815. オブジェクトによって生成された差分が '最小' であるな
どとは言いません。むしろ、最小の差分はしばしば直観に反しています。その理
由は、どこでもできるとなれば一致を見いだしてしまうからで、ときには思いが
けなく100ページも離れたマッチになってしまうのです。一致点を互いに隣接し
たマッチに制限することで、場合によって長めの差分を出力するというコストを
掛けることにはなっても、ある種の局所性を保つことができるのです。

*note Differ: 2815. は、以下のようなコンストラクタを持ちます:

 -- クラス: difflib.Differ (linejunk=None, charjunk=None)

     オプションのキーワードパラメータ 'linejunk' と 'charjunk' は、フィ
     ルタ関数を渡します (使わないときは ‘None’):

     'linejunk': ひとつの文字列引数を受け取る関数です。文字列が junk の
     ときに真を返します。デフォルトでは、‘None’ であり、どんな行であって
     も junk とは見なされません。

     'charjunk': この関数は文字(長さ1の文字列)を引数として受け取り、文字
     が junk であるときに真を返します。デフォルトは ‘None’ であり、どん
     な文字も junk とは見なされません。

     これらの junk フィルター関数により、差分を発見するマッチングが高速
     化し、差分の行や文字が無視されることがなくなります。説明については
     、 *note find_longest_match(): 1da9. メソッドの 'isjunk' 引数の説明
     をご覧ください。

     *note Differ: 2815. オブジェクトは、以下の1つのメソッドを通して利用
     されます。（差分を生成します）:

      -- メソッド: compare (a, b)

          文字列からなる2つのシーケンスを比較し、差分（を表す文字列から
          なるシーケンス）を生成します。

          各シーケンスの要素は、改行で終わる独立した単一行からなる文字列
          でなければなりません。そのようなシーケンスは、ファイル風オブジ
          ェクトの *note readlines(): 2819. メソッドによって得ることがで
          きます。（得られる）差分は改行文字で終了する文字列のシーケンス
          として得られ、ファイル風オブジェクトの *note writelines():
          17eb. メソッドによって出力できる形になっています。


File: python.info,  Node: Differ example,  Next: difflib のコマンドラインインターフェース,  Prev: Differ objects,  Up: difflib --- 差分の計算の補助

5.7.4.4 Differ example
......................

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(): 2819. 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: 2815. オブジェクトをインスタンス化するとき、行 junk
と文字 junk をフィルタリングする関数を渡すことができます。詳細は *note
Differ(): 2815. コンストラクタを参照してください。

最後に、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 example,  Up: difflib --- 差分の計算の補助

5.7.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
     import datetime as dt

     def file_mtime(path):
         t = dt.datetime.fromtimestamp(os.stat(path).st_mtime,
                                       dt.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.7.4.6 ndiff example
.....................

This example shows how to use *note difflib.ndiff(): 2817.

     """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.7.5 ‘textwrap’ -- テキストの折り返しと詰め込み
------------------------------------------------

'ソースコード:' Lib/textwrap.py(1)

__________________________________________________________________

The ‘textwrap’ module provides some convenience functions, as well as
*note TextWrapper: 11d3, 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 ‘TextWrapper’ 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:
     11d3. のインスタンス属性に対応しています。

     *note wrap(): 16e5. の動作についての詳細は *note
     TextWrapper.wrap(): 2835. メソッドを参照してください。

 -- の関数: 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(): 16e4. はこれの省略表現です

          "\n".join(wrap(text, ...))

     特に、 *note fill(): 16e4. は *note wrap(): 16e5. とまったく同じ名
     前のキーワード引数を受け取ります。

 -- の関数: 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:
     11d3. インスタンスの属性に対応します。文字列が ‘TextWrapper’ の
     *note fill(): 16e4. 関数に渡される前に、空白が折りたたまれます。そ
     のため、*note tabsize: 2836.、*note expand_tabs: 2837.、*note
     drop_whitespace: 2838.、*note replace_whitespace: 2839. の値を変更
     しても、意味がありません。

     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(): 16e5.、*note fill(): 16e4.、*note shorten(): 11d6. は
*note TextWrapper: 11d3. インスタンスを作成し、その一つのメソッドを呼び
出すことで機能します。そのインスタンスは再利用されません。したがって、
‘wrap()’ や ‘fill()’ を使用して多くのテキスト文字列を処理するアプリケー
ションについては、独自の ‘TextWrapper’ オブジェクトを作成する方が効率が
良い方法でしょう。

テキストはなるべく空白か、ハイフンを含む語のハイフンの直後で折り返されま
す。 *note TextWrapper.break_long_words: 283a. が偽に設定されていなけれ
ば、必要な場合に長い語が分解されます。

 -- クラス: textwrap.TextWrapper (**kwargs)

     *note TextWrapper: 11d3. コンストラクタはたくさんのオプションのキー
     ワード引数を受け取ります。それぞれのキーワード引数は一つのインスタ
     ンス属性に対応します。したがって、例えば

          wrapper = TextWrapper(initial_indent="* ")

     はこれと同じです

          wrapper = TextWrapper()
          wrapper.initial_indent = "* "

     同じ *note TextWrapper: 11d3. オブジェクトは何回も再利用できます。
     また、使用中にインスタンス属性へ代入することでそのオプションのどれ
     でも変更できます。

     *note TextWrapper: 11d3. インスタンス属性(とコンストラクタのキーワ
     ード引数)は以下の通りです:

      -- の属性: width

          (デフォルト: ‘70’) 折り返しが行われる行の最大の長さ。入力行に
          *note width: 283b. より長い単一の語が無い限り、 *note
          TextWrapper: 11d3. は ‘width’ 文字より長い出力行が無いことを保
          証します。

      -- の属性: expand_tabs

          (デフォルト: ‘True’) もし真ならば、そのときは 'text' 内のすべ
          てのタブ文字は 'text' の *note expandtabs(): 26a1. メソッドを
          用いて空白に展開されます。

      -- の属性: tabsize

          (デフォルト: ‘8’) *note expand_tabs: 2837. が真の場合、 'text'
          の中のすべてのTAB文字は tabsize と現在のカラムに応じて、ゼロ以
          上のスペースに展開されます。

          Added in version 3.3.

      -- の属性: replace_whitespace

          (デフォルト: ‘True’) 真の場合、 *note wrap(): 16e5. メソッドは
          タブの展開の後、 wrap 処理の前に各種空白文字をスペース1文字に
          置換します。置換される空白文字は: TAB, 改行, 垂直TAB, FF, CR
          (‘'\t\n\v\f\r'’) です。

               注釈: *note expand_tabs: 2837. が偽で *note
               replace_whitespace: 2839. が真ならば、各タブ文字は1つの空
               白に置き換えられます。それはタブ展開と同じでは 'ありませ
               ん' 。

               注釈: *note replace_whitespace: 2839. が偽の場合、改行が
               行の途中で現れることで出力がおかしくなることがあります。
               このため、テキストを(*note str.splitlines(): 1472. などを
               使って)段落ごとに分けて別々に wrap する必要があります。

      -- の属性: drop_whitespace

          (デフォルト: ‘True’) 真の場合、(wrap 処理のあとインデント処理
          の前に) 各行の最初と最後の空白文字を削除します。ただし、段落の
          最初の空白については、次の文字が空白文字でない場合は削除されま
          せん。削除される空白文字が行全体に及ぶ場合は、行自体を削除しま
          す。

      -- の属性: initial_indent

          (default: ‘''’) wrap の出力の最初の行の先頭に付与する文字列。
          最初の行の長さに加算されます。空文字列の場合インデントされませ
          ん。

      -- の属性: subsequent_indent

          (デフォルト: ‘''’) 一行目以外の折り返しが行われる出力のすべて
          の行の先頭に付けられる文字列。一行目以外の各行の折り返しまでの
          長さにカウントされます。

      -- の属性: fix_sentence_endings

          (デフォルト: ‘False’) もし真ならば、 *note TextWrapper: 11d3.
          は文の終わりを見つけようとし、確実に文がちょうど二つの空白で常
          に区切られているようにします。これは一般的に固定スペースフォン
          トのテキストに対して望ましいです。しかし、文の検出アルゴリズム
          は完全ではありません: 文の終わりには、後ろに空白がある ‘'.'’,
          ‘'!'’ または ‘'?'’ の中の一つ、ことによると ‘'"'’ あるいは
          ‘"'"’ が付随する小文字があると仮定しています。このアルゴリズム
          に伴う一つの問題は下記の"Dr."と

               [...] Dr. Frankenstein's monster [...]

          下記の"Spot."の間の差異を検出できないことです

               [...] See Spot. See Spot run [...]

          *note fix_sentence_endings: 283e. はデフォルトで偽です。

          文検出アルゴリズムは"小文字"の定義のために ‘string.lowercase’
          に依存し、同一行の文を区切るためにピリオドの後に二つの空白を使
          う慣習に依存しているため、英文テキストに限定されたものです。

      -- の属性: break_long_words

          (デフォルト: ‘True’) もし真ならば、そのとき *note width: 283b.
          より長い行が確実にないようにするために、 ‘width’ より長い語は
          切られます。偽ならば、長い語は切られないでしょう。そして、
          ‘width’ より長い行があるかもしれません。 (‘width’ を超える分を
          最小にするために、長い語は単独で一行に置かれるでしょう。)

      -- の属性: break_on_hyphens

          (デフォルト: ‘True’) 真の場合、英語で一般的なように、ラップ処
          理は空白か合成語に含まれるハイフンの直後で行われます。偽の場合
          、空白だけが改行に適した位置として判断されます。ただし、本当に
          語の途中で改行が行われないようにするためには、 *note
          break_long_words: 283a. 属性を真に設定する必要があります。過去
          のバージョンでのデフォルトの振る舞いは、常にハイフンの直後での
          改行を許していました。

      -- の属性: max_lines

          (デフォルト ‘None’) ‘None’ 以外の場合、出力は行数 'max_lines'
          を超えないようにされ、切り詰める際には出力の最後の行を
          'placeholder' に置き換えます。

          Added in version 3.4.

      -- の属性: placeholder

          (デフォルト: ‘' [...]'’) 切り詰める場合に出力の最後の行に置く
          文字列です。

          Added in version 3.4.

     *note TextWrapper: 11d3. はモジュールレベルの簡易関数に類似したいく
     つかの公開メソッドも提供します:

      -- メソッド: wrap (text)

          1段落の文字列 'text' を、各行が *note width: 283b. 文字以下に
          なるように wrap します。 wrap のすべてのオプションは *note
          TextWrapper: 11d3. インスタンスの属性から取得します。結果の、
          行末に改行のない行のリストを返します。出力の内容が空になる場合
          は、返すリストも空になります。

      -- メソッド: 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.7.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).

The module uses the same names and symbols as defined by Unicode
Standard Annex #44, "Unicode Character Database"(2).  It defines the
following functions:

参考
....

The *note Unicode HOWTO: 14c0. 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: 2ee. 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: 2ee. 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: 2ee. 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: 2ee. 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.

In addition, the module exposes the following constant:

 -- データ: unicodedata.unidata_version

     このモジュールで使われている Unicode データベースのバージョン。

 -- データ: unicodedata.ucd_3_2_0

     This is an object that has the same methods as the entire module,
     but uses the Unicode database version 3.2 instead, for applications
     that require this specific version of the Unicode database (such as
     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.7.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.7.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(): 14f4. function.

readline のキーバインディングは初期化ファイルで設定できます。 このファイ
ルは、たいていはホームディレクトリに ‘.inputrc’ という名前で置いてありま
す。 GNU Readline マニュアルの Readline Init File(1) を参照して、そのフ
ァイルの形式や可能な構成、 Readline ライブラリ全体の機能を知ってください
。

*note Availability: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

*note Availability: 2199.: 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: 1a89. 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.7.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: 1ccb.
     ‘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.7.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.7.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: 1ccb.
     ‘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: 1ccb. ‘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: 1ccb.
     ‘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(): 1846. 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.7.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():
     286c. は履歴ファイルに書かれる最大行数を返します。)

 -- の関数: 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.7.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.7.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.7.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: 1ba. 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 対話モード: 441. で実行される時、このコードは実際には自
動的に実行されます ( *note readline の設定: 11cf. を参照してください)。

次の例では上記と同じ目的を達成できますが、ここでは新規の履歴のみを追加す
ることで、並行して対話セッションがサポートされます:

     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: 287e. クラスを拡張し、履歴の保
存・復旧をサポートします。

     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: 1b8. environment variable.


File: python.info,  Node: rlcompleter --- GNU readline の補完機能,  Prev: readline --- GNU readline のインターフェース,  Up: テキスト処理サービス

5.7.9 ‘rlcompleter’ -- GNU readline の補完機能
----------------------------------------------

'ソースコード:' Lib/rlcompleter.py(1)

__________________________________________________________________

The ‘rlcompleter’ module defines a completion function suitable to be
passed to *note set_completer(): 2877. 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: 1d89. class is
automatically created and its *note complete(): 2882. method is set as
the *note readline completer: 2876.  The method provides completion of
valid Python *note identifiers and keywords: 22fc.

以下はプログラム例です:

     >>> 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: 441.  Unless Python is run with the *note -S: 13c4.
option, the module is automatically imported and configured (see *note
readline の設定: 11cf.).

*note readline: bf. のないプラットフォームでも、このモジュールで定義され
る *note Completer: 1d89. クラスは独自の目的に使えます。

 -- クラス: 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: 886. is returned.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/rlcompleter.py


File: python.info,  Node: バイナリデータ処理,  Next: データ型,  Prev: テキスト処理サービス,  Up: Python 標準ライブラリ

5.8 バイナリデータ処理
======================

この章で紹介されているモジュールはバイナリデータを扱うための基本的な処理
を提供しています。ファイルフォーマットやネットワークプロトコルなど、その
他のバイナリデータ処理については、それぞれの節で解説されています。

*note テキスト処理サービス: 26ac. で紹介する一部のライブラリには、 ASCII
互換のバイナリフォーマットで利用できるもの (例: *note re: be.) や 、すべ
てのバイナリデータで利用できるもの (例: *note difflib: 3b.) があります。

加えて、 *note バイナリシーケンス型 -- bytes, bytearray, memoryview:
2623. に書かれているPythonビルトインデータ型についても参照してください。

* Menu:

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


File: python.info,  Node: struct --- バイト列をパックされたバイナリデータとして解釈する,  Next: codecs --- codec レジストリと基底クラス,  Up: バイナリデータ処理

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

'ソースコード:' Lib/struct.py(1)

__________________________________________________________________

This module converts between Python values and C structs represented as
Python *note bytes: 193. objects.  Compact *note format strings: 2889.
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
     バイトオーダ、サイズ、アラインメント: 288a. for details.

Several ‘struct’ functions (and methods of *note Struct: 17ce.) take a
'buffer' argument.  This refers to objects that implement the *note
バッファプロトコル (buffer Protocol): 262. and provide either a readable
or read-writable buffer.  The most common types used for that purpose
are *note bytes: 193. and *note bytearray: 342, 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
‘bytes’ object.

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/struct.py


File: python.info,  Node: 関数と例外,  Next: 書式文字列,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.8.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(): 1e06. の返り値である書式文字列が要求するサイズと一致し
     なければなりません。

 -- の関数: struct.unpack_from (format, /, buffer, offset=0)

     バッファ 'buffer' を、 'offset' の位置から書式文字列 'format' に従
     ってアンパックします。 値が一つしかない場合を含め、結果はタプルで返
     されます。 'offset' を始点とするバッファのバイトサイズは、少なくと
     も *note calcsize(): 1e06. の返り値である書式文字列が要求するサイズ
     でなければなりません。

 -- の関数: struct.iter_unpack (format, buffer)

     バッファ 'buffer' を、書式文字列 'format' に従ってイテレータ形式で
     アンパックします。 この関数が返すイテレータは、すべての内容を読み終
     わるまでバッファから一定の大きさのチャンクを読み取ります。 バッファ
     のバイトサイズは、 *note calcsize(): 1e06. の返り値である書式文字列
     が要求するサイズの倍数でなければなりません。

     イテレーション毎に書式文字列で指定されたタプルを yield します。

     Added in version 3.4.

 -- の関数: struct.calcsize (format)

     書式文字列 'format' に従って、構造体 (それと ‘pack(format, ...)’ に
     よって作成されるバイト列オブジェクト) のサイズを返します。


File: python.info,  Node: 書式文字列,  Next: アプリケーション,  Prev: 関数と例外,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.8.1.2 書式文字列
..................

Format strings describe the data layout when packing and unpacking data.
They are built up from *note format characters: 124f, which specify the
type of data being packed/unpacked.  In addition, special characters
control the *note byte order, size and alignment: 288a.  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.8.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: 2656. を使って調べて下さい。

ネイティブのサイズおよびアラインメントは C コンパイラの ‘sizeof’ 式で決
定されます。ネイティブのサイズおよびアラインメントはネイティブのバイトオ
ーダと同時に使われます。

標準のサイズはフォーマット文字だけで決まります。 *note 書式指定文字:
124f. の表を参照して下さい。

‘'@'’ と ‘'='’ の違いに注意してください: 両方ともネイティブのバイトオー
ダですが、後者のバイトサイズとアラインメントは標準のものに合わせてありま
す。

The form ‘'!'’ represents the network byte order which is always
big-endian as defined in IETF RFC 1700(1).

バイトオーダに関して、「(強制的にバイトスワップを行う)ネイティブの逆」を
指定する方法はありません。‘'<'’ または ‘'>'’ のうちふさわしい方を選んで
ください。

注釈:

  1. パディングは構造体のメンバの並びの中にだけ自動で追加されます。最初
     や最後にパディングが追加されることはありません。

  2. ネイティブでないサイズおよびアラインメントが使われる場合にはパディ
     ングは行われません (たとえば '<', '>', '=', '!'  を使った場合です
     )。

  3. 特定の型によるアラインメント要求に従うように構造体の末端をそろえる
     には、繰り返し回数をゼロにした特定の型でフォーマットを終端します。
     *note 使用例: 2890. を参照して下さい。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1700


File: python.info,  Node: 書式指定文字,  Next: 使用例<3>,  Prev: バイトオーダ、サイズ、アラインメント,  Up: 書式文字列

5.8.1.4 書式指定文字
....................

フォーマット文字 (format character) は以下の意味を持っています; C と
Python の間の変換では、値は正確に以下に指定された型でなくてはなりません:
「標準のサイズ」列は standard サイズ使用時にパックされた値が何バイトかを
示します。つまり、フォーマット文字列が ‘'<'’, ‘'>'’, ‘'!'’, ‘'='’ のいず
れかで始まっている場合のものです。native サイズ使用時にはパックされた値
の大きさはプラットフォーム依存です。

フォーマッ   C の型                         Python の型              標準のサイズ         注釈
ト                                                                                        

-----------------------------------------------------------------------------------------------------------
                                                                                          
‘x’          パディングバイト               値なし                                        (7)
                                                                                          
                                                                                          
‘c’          char                           長さ 1 のバイト列        1
                                                                     
                                                                                          
‘b’          signed char                    整数                     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’                      整数                                          (2), (3)
                                                                                          
                                                                                          
‘N’          ‘size_t’                       整数                                          (2), (3)
                                                                                          
                                                                                          
‘e’          _Float16                       浮動小数点数             2                    (4), (6)
                                                                                          
                                                                                          
‘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*                          整数                                          (2), (5)
                                                                                          

バージョン 3.3 で変更: ‘'n'’ および ‘'N'’ フォーマットのサポートが追加さ
れました。

バージョン 3.6 で変更: ‘'e'’ フォーマットのサポートが追加されました。

バージョン 3.14 で変更: Added support for the ‘'F'’ and ‘'D'’ formats.

参考
....

The *note array: 8. and *note ctypes: 2892. modules, as well as
third-party modules like numpy(1), use similar - but slightly different
- type codes.

注釈:

  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__(): 19f.
     method then that method is called to convert the argument to an
     integer before packing.

     バージョン 3.2 で変更: Added use of the *note __index__(): 19f.
     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. The IEEE 754 binary16 "half precision" type was introduced in the
     2008 revision of the IEEE 754 standard(2).  It has a sign bit, a
     5-bit exponent and 11-bit precision (with 10 bits explicitly
     stored), and can represent numbers between approximately ‘6.1e-05’
     and ‘6.5e+04’ at full precision.  This type is not widely supported
     by C compilers: it's available as _Float16 type, if the compiler
     supports the Annex H of the C23 standard.  On a typical machine, an
     unsigned short can be used for storage, but not for math
     operations.  See the Wikipedia page on the half-precision
     floating-point format(3) for more information.

  7. When packing, ‘'x'’ inserts one NUL byte.

  8. The ‘'p'’ format character encodes a "Pascal string", meaning a
     short variable-length string stored in a 'fixed number of bytes',
     given by the count.  The first byte stored is the length of the
     string, or 255, whichever is smaller.  The bytes of the string
     follow.  If the byte string passed in to *note pack(): 1492. is too
     long (longer than the count minus 1), only the leading ‘count-1’
     bytes of the string are stored.  If the byte string is shorter than
     ‘count-1’, it is padded with null bytes so that exactly count bytes
     in all are used.  Note that for *note unpack(): 18bf, the ‘'p'’
     format character consumes ‘count’ bytes, but that the ‘bytes’
     object returned can never contain more than 255 bytes.  When
     packing, arguments of types *note bytes: 193. and *note bytearray:
     342. are accepted.

  9. For the ‘'s'’ format character, the count is interpreted as the
     length of the byte string, 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 使用例: 2890. for a concrete demonstration of the
     difference.)  If a count is not given, it defaults to 1.  For
     packing, the byte 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 byte string (while
     ‘'0c'’ means 0 characters).  When packing, arguments of types *note
     bytes: 193. and *note bytearray: 342. are accepted.

  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: 153f. が送出
されます。

バージョン 3.1 で変更: 以前は、いくつかの整数フォーマットが適切な範囲に
ない値を覆い隠して、 *note struct.error: 153f. の代わりに *note
DeprecationWarning: 1a4. を送出していました。

‘'?'’ フォーマット文字では、返り値は *note True: e0b. または *note
False: d2f. です。パックするときには、引数オブジェクトの論理値としての値
が使われます。 0 または 1 のネイティブや標準の真偽値表現でパックされ、ア
ンパックされるときはゼロでない値は ‘True’ になります。

   ---------- Footnotes ----------

   (1) 
https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__

   (2) https://en.wikipedia.org/wiki/IEEE_754-2008_revision

   (3) 
https://en.wikipedia.org/wiki/Half-precision_floating-point_format


File: python.info,  Node: 使用例<3>,  Prev: 書式指定文字,  Up: 書式文字列

5.8.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.8.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: 2896.), and data
interchange between applications using agreed upon data layout (*note
standard formats: 2897.).  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.8.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.8.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.8.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 ‘Struct’ instance.

     コンパイルされた Struct オブジェクトは以下のメソッドと属性をサポー
     トします:

      -- メソッド: pack (v1, v2, ...)

          *note pack(): 1492. 関数と同じ、コンパイルされたフォーマットを
          利用するメソッドです。 (‘len(result)’ は *note size: 289d. と
          等しいでしょう)

      -- メソッド: pack_into (buffer, offset, v1, v2, ...)

          *note pack_into(): 288c. 関数と同じ、コンパイルされたフォーマ
          ットを利用するメソッドです。

      -- メソッド: unpack (buffer)

          *note unpack(): 18bf. 関数と同じ、コンパイルされたフォーマット
          を利用するメソッドです。 (buffer のバイト数は *note size:
          289d. と等しくなければなりません)。

      -- メソッド: unpack_from (buffer, offset=0)

          *note unpack_from(): 288d. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 ('offset' を始点とする buffer の
          バイト数は少なくとも *note size: 289d. 以上でなければなりませ
          ん)。

      -- メソッド: iter_unpack (buffer)

          *note iter_unpack(): 11c5. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 (buffer のバイト数は *note
          size: 289d. の倍数でなければなりません)。

          Added in version 3.4.

      -- の属性: format

          この Struct オブジェクトを作成する時に利用されたフォーマット文
          字列です。

          バージョン 3.7 で変更: The format string type is now *note
          str: 16a. instead of *note bytes: 193.

      -- の属性: size

          *note format: 19a. 属性に対応する構造体の (従って *note
          pack(): 1492. メソッドによって作成されるバイト列オブジェクトの
          ) サイズです。

     バージョン 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.8.2 ‘codecs’ -- codec レジストリと基底クラス
----------------------------------------------

'ソースコード:' Lib/codecs.py(1)

__________________________________________________________________

このモジュールは、標準的な Python codec (エンコーダとデコーダ) 用の基底
クラスを定義し、codec とエラー処理検索プロセスを管理する内部の Python
codec レジストリへのアクセスを提供します。多くの codec はテキストをバイ
トにエンコードする (そしてバイトをテキストにデコードする) *note
テキストエンコーディング: 263a. ですが、テキストをテキストに、またはバイ
トをバイトにエンコードする codec も提供されています。カスタムの codec は
任意の型間でエンコードとデコードを行えますが、一部のモジュール機能は テ
キストエンコーディング か *note bytes: 193. へのエンコードのみに制限され
ています。

このモジュールでは、任意の codec でエンコードやデコードを行うための、以
下の関数が定義されています。

 -- の関数: codecs.encode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をエンコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラ (エラー処理関数) は ‘'strict'’ です。これは
     エンコードエラーは *note ValueError: 2ee. (もしくは *note
     UnicodeEncodeError: 888. のような、より codec に固有のサブクラス) を
     送出することを意味します。codec エラー処理についてのより詳しい情報
     は *note Codec 基底クラス: 28a4. を参照してください。

 -- の関数: codecs.decode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をデコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラは ‘'strict'’ です。これはデコードエラーは
     *note ValueError: 2ee. (もしくは *note UnicodeDecodeError: c0c. の
     ような、より codec に固有のサブクラス) を送出することを意味します。
     codec エラー処理についてのより詳しい情報は *note Codec 基底クラス:
     28a4. を参照してください。

 -- の関数: codecs.charmap_build (string)

     Return a mapping suitable for encoding with a custom single-byte
     encoding.  Given a *note str: 16a. 'string' of up to 256 characters
     representing a decoding table, returns either a compact internal
     mapping object ‘EncodingMap’ or a *note dictionary: 184. mapping
     character ordinals to byte values.  Raises a *note TypeError: 199.
     on invalid input.

各 codec についての詳細も、次のようにして直接調べることができます。

 -- の関数: codecs.lookup (encoding, /)

     Python codec レジストリから codec 情報を探し、以下で定義するような
     *note CodecInfo: 1acd. オブジェクトを返します。

     Encodings are first looked up in the registry's cache.  If not
     found, the list of registered search functions is scanned.  If no
     *note CodecInfo: 1acd. object is found, a *note LookupError: 2445.
     is raised.  Otherwise, the ‘CodecInfo’ object is stored in the
     cache and returned to the caller.

 -- クラス: codecs.CodecInfo (encode, decode, streamreader=None,
          streamwriter=None, incrementalencoder=None,
          incrementaldecoder=None, name=None)

     codec レジストリ内を検索する場合の、codec の詳細です。コントラクタ
     引数は、次の同名の属性に保存されます。

      -- の属性: name

          エンコーディングの名前です。

      -- の属性: encode
      -- の属性: decode

          ステートレスなエンコーディングとデコーディングの関数です。これ
          らは、Codec インスタンスの *note encode(): 28a9. メソッドと
          *note decode(): 28aa. メソッドと同じインターフェースを持ってい
          る必要があります (see *note Codec のインターフェース: 28ab. を
          参照)。この関数またはメソッドは、ステートレスモードで動作する
          ことが想定されています。

      -- の属性: incrementalencoder
      -- の属性: incrementaldecoder

          インクリメンタル・エンコーダとデコーダのクラスまたはファクトリ
          関数です。これらは、基底クラスの *note IncrementalEncoder:
          28ae. と *note IncrementalDecoder: 28af. が定義するインターフ
          ェースをそれぞれ提供する必要があります。インクリメンタルな
          codec は、ステート (内部状態) を保持することができます。

      -- の属性: streamwriter
      -- の属性: streamreader

          ストリームライターとリーダーのクラスまたはファクトリ関数です。
          これらは、基底クラスの *note StreamWriter: 28b2. と *note
          StreamReader: 28b3. が定義するインターフェースをそれぞれ提供す
          る必要があります。ストリーム codec は、ステートを保持すること
          ができます。

さまざまな codec 構成要素へのアクセスを簡便化するために、このモジュール
は以下のような関数を提供しています。これらの関数は、 codec の検索に
*note lookup(): b60. を使います:

 -- の関数: codecs.getencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、エンコーダ関数を
     返します。

     エンコーディングが見つからなければ *note LookupError: 2445. を送出
     します。

 -- の関数: codecs.getdecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、デコーダ関数を返
     します。

     エンコーディングが見つからなければ *note LookupError: 2445. を送出
     します。

 -- の関数: codecs.getincrementalencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・エンコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・エンコ
     ーダをサポートしなければ *note LookupError: 2445. を送出します。

 -- の関数: codecs.getincrementaldecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・デコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・デコー
     ダをサポートしなければ *note LookupError: 2445. を送出します。

 -- の関数: codecs.getreader (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamReader: 28b3. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 2445. を送出
     します。

 -- の関数: codecs.getwriter (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamWriter: 28b2. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 2445. を送出
     します。

次のように、適切な 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: 1acd. 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():
318. とそれに関連付けられた *note io: 83. モジュールの使用が推奨されてい
ますが、このモジュールは追加のユーティリティ関数とクラスを提供し、バイナ
リファイルを処理する場合に幅広い codecs を利用できるようにします。

 -- の関数: codecs.open (filename, mode='r', encoding=None,
          errors='strict', buffering=-1)

     エンコードされたファイルを 'mode' を使って開き、透過的なエンコード
     /デコードを提供する *note StreamReaderWriter: 28bb. のインスタンス
     を返します。デフォルトのファイルモードは ‘'r'’ 、つまり、読み出しモ
     ードでファイルを開きます。

          注釈: 'encoding' が ‘None’ でなければ、下層のエンコードされた
          ファイルは、常にバイナリモードで開きます。読み書き時に、
          ‘'\n'’ の自動変換は行われません。'mode' 引数は、組み込みの
          *note open(): 318. 関数が受け入れる任意のバイナリモードにする
          ことができます。‘'b'’ が自動的に付加されます。

     'encoding' は、そのファイルに対して使用されるエンコーディングを指定
     します。バイトにエンコードする、あるいはバイトからデコードするすべ
     てのエンコーディングが許可されます。ファイルメソッドがサポートする
     データ型は、使用される codec によって異なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 2ee. を送出します。

     'buffering' has the same meaning as for the built-in ‘open()’
     function.  It defaults to -1 which means that the default buffer
     size will be used.

     バージョン 3.11 で変更: ‘'U'’ モードは削除されました。

     バージョン 3.14 で非推奨: ‘codecs.open()’ has been superseded by
     ‘open()’.

 -- の関数: codecs.EncodedFile (file, data_encoding, file_encoding=None,
          errors='strict')

     透過的なエンコード変換を行うファイルのラップされたバージョンである
     、*note StreamRecoder: 1e30. インスタンスを返します。元のファイルは
     、ラップされたバージョンが閉じられる時に、閉じられます。

     ラップされたファイルに書き込まれたデータは、指定された
     'data_encoding' に従ってデコードされ、次に 'file_encoding' を使用し
     て元のファイルにバイトとして書き出されます。元のファイルから読み出
     されたバイトは、'file_encoding' に従ってデコードされ、結果は
     'data_encoding' を使用してエンコードされます。

     'file_encoding' が与えられなければ、'data_encoding' がデフォルトに
     なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 2ee. を送出します。

 -- の関数: codecs.iterencode (iterator, encoding, errors='strict',
          **kwargs)

     Uses an incremental encoder to iteratively encode the input
     provided by 'iterator'.  'iterator' must yield *note str: 16a.
     objects.  This function is a *note generator: 1270.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental encoder.

     この関数では、コーデックはエンコードするテキストの *note str: 16a.
     オブジェクトを受け付ける必要があります。 従って、 ‘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: 193.
     objects.  This function is a *note generator: 1270.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental decoder.

     この関数では、コーデックはエンコードする *note bytes: 193. オブジェ
     クトを受け付ける必要があります。 従って、 ‘rot_13’ のようなテキスト
     からテキストへのエンコーダが *note iterencode(): 28bd. で同等に使え
     るとしても、この関数ではサポートしていません。

 -- の関数: codecs.readbuffer_encode (buffer, errors=None, /)

     Return a *note tuple: 614. containing the raw bytes of 'buffer', a
     *note buffer-compatible object: 262. or *note str: 16a. (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:
     28c4. は、プラットフォームのネイティブバイトオーダによって *note
     BOM_UTF16_BE: 28c5. または *note BOM_UTF16_LE: 28c6. です。 *note
     BOM: 28c0. は ‘BOM_UTF16’ のエイリアスです。同様に、 *note BOM_LE:
     28c2. は ‘BOM_UTF16_LE’ の、 *note BOM_BE: 28c1. は ‘BOM_UTF16_BE’
     のエイリアスです。その他の定数は 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.8.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.8.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
標準エンコーディング: fbc. codecs:

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'strict'’                    *note UnicodeError: 460. (または、そのサブクラス)
                              を送出します。これがデフォルトの動作です。
                              *note strict_errors(): 28cd. で実装されています。
                              
                              
‘'ignore'’                    不正な形式のデータを無視し、何も通知することなく
                              処理を継続します。*note ignore_errors(): 28ce. で
                              実装されています。
                              
                              
‘'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(): 1924.
                              
                              
‘'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(): 1925.
                              
                              
‘'surrogateescape'’           デコード時には、バイト列を ‘U+DC80’ から ‘U+DCFF’
                              の範囲の個々のサロゲートコードで置き換えます。デ
                              ータのエンコード時に ‘'surrogateescape'’ エラーハ
                              ンドラが使用されると、このコードは同じバイト列に
                              戻されます。 (詳しくは PEP 383(1) を参照。)
                              

The following error handlers are only applicable to encoding (within
*note text encodings: 263a.):

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'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(): 1926.
                              
                              
‘'namereplace'’               Replace with ‘\N{...}’ escape sequences, what
                              appears in the braces is the Name property from
                              Unicode Character Database.  Implemented in
                              *note namereplace_errors(): 28cf.
                              

さらに、次のエラーハンドラは与えられた 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: 16a. 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: 888. インスタンスとともに呼び出されます。エラー
     処理関数はこの例外を送出するか、別の例外を送出するか、入力のエンコ
     ードできなかった部分の代替文字列とエンコードを再開する場所が入った
     タプルを返す必要があります。代替文字列は *note str: 16a. または
     *note bytes: 193. のいずれかにすることができます。代替文字列がバイ
     ト列である場合、エンコーダは単に出力バッファにそれをコピーします。
     代替文字列が文字列である場合、エンコーダは代替文字列をエンコードし
     ます。元の入力中の指定位置からエンコードが再開されます。位置を負の
     値にすると、入力文字列の末端からの相対位置として扱われます。境界の
     外側にある位置を返した場合には *note IndexError: 1753. が送出されま
     す。

     デコードと翻訳の動作は似ていますが、エラーハンドラに渡されるのが
     *note UnicodeDecodeError: c0c. か *note UnicodeTranslateError:
     195e. である点と、エラーハンドラの置換した内容が直接出力されるとい
     う点が異なります。

登録済みのエラーハンドラ (標準エラーハンドラを含む) は、次のようにその名
前で検索することができます。

 -- の関数: codecs.lookup_error (name, /)

     名前 'name' で登録済みのエラーハンドラを返します。

     エラーハンドラが見つからなければ *note LookupError: 2445. を送出し
     ます。

以下の標準エラーハンドラも、モジュールレベルの関数として利用できます。

 -- の関数: codecs.strict_errors (exception)

     Implements the ‘'strict'’ error handling.

     Each encoding or decoding error raises a *note UnicodeError: 460.

 -- の関数: 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: 263a. 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: 263a. 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.8.2.3 ステートレスなエンコードとデコード
..........................................

基底の *note Codec: 28d1. クラスは以下のメソッドを定義します。これらのメ
ソッドは、内部状態を持たないエンコーダ／デコーダ関数のインターフェースを
定義します:

 -- クラス: codecs.Codec

      -- メソッド: encode (input, errors='strict')

          オブジェクト 'input' エンコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 263a. は文字列オブジェクトを特有の文
          字セット (例えば ‘cp1252’ や ‘iso-8859-1’) を用いてバイト列オ
          ブジェクトに変換します。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは *note Codec: 28d1. に内部状態を保存してはなりま
          せん。効率よくエンコードするために状態を保持しなければならない
          ような codecs には *note StreamWriter: 28b2. を使ってください
          。

          エンコーダは長さが 0 の入力を処理できなければなりません。この
          場合、空のオブジェクトを出力オブジェクトとして返さなければなり
          ません。

      -- メソッド: decode (input, errors='strict')

          オブジェクト 'input' をデコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 263a. は、特定の文字集合エンコーディ
          ングでエンコードされたバイト列オブジェクトを文字列オブジェクト
          に変換します。

          テキストエンコーディングとバイト列からバイト列への codec では
          、'input' は bytes オブジェクト、または読み出し専用のバッファ
          インターフェースを提供するオブジェクトである必要があります。例
          えば、buffer オブジェクトやメモリマップドファイルでなければな
          りません。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは、 *note Codec: 28d1. インスタンスに内部状態を保
          存してはなりません。効率よくエンコード／デコードするために状態
          を保持しなければならないような codecs には *note StreamReader:
          28b3. を使ってください。

          デコーダは長さが 0 の入力を処理できなければなりません。この場
          合、空のオブジェクトを出力オブジェクトとして返さなければなりま
          せん。


File: python.info,  Node: インクリメンタルなエンコードとデコード,  Next: ストリームのエンコードとデコード,  Prev: ステートレスなエンコードとデコード,  Up: Codec 基底クラス

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

*note IncrementalEncoder: 28ae. クラスおよび *note IncrementalDecoder:
28af. クラスはそれぞれインクリメンタル・エンコードおよびデコードのための
基本的なインターフェースを提供します。エンコード／デコードは内部状態を持
たないエンコーダ／デコーダを一度呼び出すことで行なわれるのではなく、イン
クリメンタル・エンコーダ／デコーダの *note encode(): 28d3./*note
decode(): 28d4. メソッドを複数回呼び出すことで行なわれます。インクリメン
タル・エンコーダ／デコーダはメソッド呼び出しの間エンコード／デコード処理
の進行を管理します。

*note encode(): 28d3./*note decode(): 28d4. メソッド呼び出しの出力結果を
まとめたものは、入力をひとまとめにして内部状態を持たないエンコーダ／デコ
ーダでエンコード／デコードしたものと同じになります。

* Menu:

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


File: python.info,  Node: IncrementalEncoder オブジェクト,  Next: IncrementalDecoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.8.2.5 IncrementalEncoder オブジェクト
.......................................

*note IncrementalEncoder: 28ae. クラスは入力を複数ステップでエンコードす
るのに使われます。全てのインクリメンタル・エンコーダが Python codec レジ
ストリと互換性を持つために定義すべきメソッドとして、このクラスには以下の
メソッドが定義されています。

 -- クラス: codecs.IncrementalEncoder (errors='strict')

     *note IncrementalEncoder: 28ae. インスタンスのコンストラクタ。

     全てのインクリメンタル・エンコーダはこのコンストラクタインターフェ
     ースを提供しなければなりません。さらにキーワード引数を付け加えるの
     は構いませんが、Python codec レジストリで利用されるのはここで定義さ
     れているものだけです。

     *note IncrementalEncoder: 28ae. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1bce. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalEncoder: 28ae. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: encode (object, final=False)

          'object' を(エンコーダの現在の状態を考慮に入れて)エンコードし
          、得られたエンコードされたオブジェクトを返します。 *note
          encode(): 1108. 呼び出しがこれで最後という時には 'final' は真
          でなければなりません(デフォルトは偽です)。

      -- メソッド: reset ()

          エンコーダを初期状態にリセットします。出力は破棄されます。
          ‘.encode(object, final=True)’ を呼び出して、必要に応じて空バイ
          ト列またはテキスト文字列を渡すことにより、エンコーダをリセット
          し、出力を取得します。

      -- メソッド: getstate ()

          エンコーダの現在の状態を返します。それは必ず整数でなければなり
          ません。実装は、‘0’ が最も一般的な状態であることを保証すべきで
          す。 (整数より複雑な状態は、状態を marshal/pickle して生じた文
          字列のバイトを整数にコード化することによって整数に変換すること
          ができます。)

      -- メソッド: setstate (state)

          エンコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 28d8. によって返されたエンコーダ状態でなければなり
          ません。


File: python.info,  Node: IncrementalDecoder オブジェクト,  Prev: IncrementalEncoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.8.2.6 IncrementalDecoder オブジェクト
.......................................

*note IncrementalDecoder: 28af. クラスは入力を複数ステップでデコードする
のに使われます。全てのインクリメンタル・デコーダが Python codec レジスト
リと互換性を持つために定義すべきメソッドとして、このクラスには以下のメソ
ッドが定義されています。

 -- クラス: codecs.IncrementalDecoder (errors='strict')

     *note IncrementalDecoder: 28af. インスタンスのコンストラクタ。

     全てのインクリメンタル・デコーダはこのコンストラクタインターフェー
     スを提供しなければなりません。さらにキーワード引数を付け加えるのは
     構いませんが、Python codec レジストリで利用されるのはここで定義され
     ているものだけです。

     *note IncrementalDecoder: 28af. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1bce. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalDecoder: 28af. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: decode (object, final=False)

          'object' を(デコーダの現在の状態を考慮に入れて)デコードし、得
          られたデコードされたオブジェクトを返します。 *note decode():
          1109. 呼び出しがこれで最後という時には 'final' は真でなければ
          なりません(デフォルトは偽です)。もし 'final' が真ならばデコー
          ダは入力をデコードし切り全てのバッファをフラッシュしなければな
          りません。そうできない場合(たとえば入力の最後に不完全なバイト
          列があるから)、デコーダは内部状態を持たない場合と同じようにエ
          ラーの取り扱いを開始しなければなりません(例外を送出するかもし
          れません)。

      -- メソッド: reset ()

          デコーダを初期状態にリセットします。

      -- メソッド: getstate ()

          デコーダの現在の状態を返します。これは2要素を含むタプルでなけ
          ればなりません。1番目はまだデコードされていない入力を含むバッ
          ファです。2番目は整数で、付加的な状態情報です (実装は ‘0’ が最
          も一般的な付加的な状態情報であることを保証すべきです)。この付
          加的な状態情報が ‘0’ である場合、デコーダを入力がバッファされ
          ていない状態に戻して、付加的な状態情報を ‘0’ にセットすること
          が可能でなければなりません。その結果、以前バッファされた入力を
          デコーダに与えることで、何の出力もせずにデコーダを前の状態に戻
          します。 (整数より複雑な付加的な状態情報は、情報を
          marshal/pickle して、結果として生じる文字列のバイト列を整数に
          エンコードすることで、整数に変換することができます。)

      -- メソッド: setstate (state)

          デコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 28dd. によって返されたデコーダの状態でなければなり
          ません。


File: python.info,  Node: ストリームのエンコードとデコード,  Prev: インクリメンタルなエンコードとデコード,  Up: Codec 基底クラス

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

The *note StreamWriter: 28b2. and *note StreamReader: 28b3. 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.8.2.8 StreamWriter オブジェクト
.................................

*note StreamWriter: 28b2. クラスは *note Codec: 28d1. のサブクラスで、以
下のメソッドを定義しています。全てのストリームライタは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamWriter (stream, errors='strict')

     *note StreamWriter: 28b2. インスタンスのコンストラクタです。

     全てのストリームライタはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの書き込みが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamWriter: 28b2. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1bce. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamWriter: 28b2. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

      -- メソッド: write (object)

          'object' の内容をエンコードしてストリームに書き出します。

      -- メソッド: writelines (list)

          Writes the concatenated iterable of strings to the stream
          (possibly by reusing the *note write(): 28e2. method).
          Infinite or very large iterables are not supported.  The
          standard bytes-to-bytes codecs do not support this method.

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          このメソッドが呼び出された場合、出力先データをきれいな状態にし
          、わざわざストリーム全体を再スキャンして状態を元に戻さなくても
          新しくデータを追加できるようにしなければなりません。

ここまでで挙げたメソッドの他にも、 *note StreamWriter: 28b2. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReader オブジェクト,  Next: StreamReaderWriter オブジェクト,  Prev: StreamWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.9 StreamReader オブジェクト
.................................

*note StreamReader: 28b3. クラスは *note Codec: 28d1. のサブクラスで、以
下のメソッドを定義しています。全てのストリームリーダは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamReader (stream, errors='strict')

     *note StreamReader: 28b3. インスタンスのコンストラクタです。

     全てのストリームリーダはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの読み出しが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamReader: 28b3. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1bce. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamReader: 28b3. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

     'errors' 引数に許される値の集合は *note register_error(): 16b9. で
     拡張できます。

      -- メソッド: read (size=-1, chars=-1, firstline=False)

          ストリームからのデータをデコードし、デコード済のオブジェクトを
          返します。

          'chars' 引数は、いくつのデコードされたコードポイントまたはバイ
          ト列を返すかを表します。 *note read(): 28e7. メソッドは、要求
          された数以上のデータを返すことはありませんが、データがそれより
          少ない場合には要求された数未満のデータを返す場合があります。

          'size' 引数は、デコード用に読み込むエンコードされたバイト列ま
          たはコードポイントの、およその最大バイト数を表します。デコーダ
          はこの値を適切な値に変更できます。デフォルト値 -1 の場合、可能
          な限り多くのデータを読み込みます。この引数の目的は、巨大なファ
          イルの一括デコードを防ぐことにあります。

          'firstline' フラグは、1行目さえ返せばその後の行でデコードエラ
          ーがあっても無視して十分だ、ということを示します。

          このメソッドは貪欲な読み込み戦略を取るべきです。すなわち、エン
          コーディング定義と size の値が許す範囲で、できるだけ多くのデー
          タを読むべきだということです。たとえば、ストリーム上にエンコー
          ディングの終端や状態の目印があれば、それも読み込みます。

      -- メソッド: readline (size=None, keepends=True)

          入力ストリームから1行読み込み、デコード済みのデータを返します
          。

          'size' が与えられた場合、ストリームの *note read(): 28e7. メソ
          ッドに size 引数として渡されます。

          'keepends' が偽の場合には行末の改行が削除された行が返ります。

      -- メソッド: readlines (sizehint=None, keepends=True)

          入力ストリームから全ての行を読み込み、行のリストとして返します
          。

          'keepends' が真なら、改行は、codec の *note decode(): 1109. メ
          ソッドを使って実装され、リスト要素の中に含まれます。

          'sizehint' が与えられた場合、ストリームの *note read(): 28e7.
          メソッドに 'size' 引数として渡されます。

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          ストリームの読み位置を再設定してはならないので注意してください
          。このメソッドはデコードの際にエラーから復帰できるようにするた
          めのものです。

ここまでで挙げたメソッドの他にも、 *note StreamReader: 28b3. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReaderWriter オブジェクト,  Next: StreamRecoder オブジェクト,  Prev: StreamReader オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.10 StreamReaderWriter オブジェクト
........................................

*note StreamReaderWriter: 28bb. は、読み書き両方に使えるストリームをラッ
プできる便利なクラスです。

*note lookup(): b60. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: codecs.StreamReaderWriter (stream, Reader, Writer,
          errors='strict')

     *note StreamReaderWriter: 28bb. インスタンスを生成します。 'stream'
     はファイル類似のオブジェクトです。 'Reader' と 'Writer' は、それぞ
     れ *note StreamReader: 28b3. と *note StreamWriter: 28b2. インター
     フェースを提供するファクトリ関数かファクトリクラスでなければなりま
     せん。エラー処理は、ストリームリーダとライタで定義したものと同じよ
     うに行われます。

*note StreamReaderWriter: 28bb. インスタンスは、 *note StreamReader:
28b3. クラスと *note StreamWriter: 28b2. クラスを合わせたインターフェー
スを継承します。元になるストリームからは、他のメソッドや属性を継承します
。


File: python.info,  Node: StreamRecoder オブジェクト,  Prev: StreamReaderWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.8.2.11 StreamRecoder オブジェクト
...................................

*note StreamRecoder: 1e30. はデータをあるエンコーディングから別のエンコ
ーディングに変換します。異なるエンコーディング環境を扱うとき、便利な場合
があります。

*note lookup(): b60. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: codecs.StreamRecoder (stream, encode, decode, Reader,
          Writer, errors='strict')

     Creates a ‘StreamRecoder’ instance which implements a two-way
     conversion: 'encode' and 'decode' work on the frontend — the data
     visible to code calling *note read(): 28e7. and *note write():
     28e2, while 'Reader' and 'Writer' work on the backend — the data in
     'stream'.

     これらのオブジェクトを使って、たとえば、 Latin-1 から UTF-8 への変
     換、あるいは逆向きの変換を、透過的に行うことができます。

     'stream' 引数はファイルライクオブジェクトでなくてはなりません。

     'encode' 引数と 'decode' 引数は *note Codec: 28d1. のインターフェー
     スに忠実でなくてはなりません。'Reader' と 'Writer' は、それぞれ
     *note StreamReader: 28b3. と *note StreamWriter: 28b2. のインターフ
     ェースを提供するオブジェクトのファクトリ関数かクラスでなくてはなり
     ません。

     エラー処理はストリーム・リーダやライタで定義されている方法と同じよ
     うに行われます。

*note StreamRecoder: 1e30. インスタンスは、 *note StreamReader: 28b3. と
*note StreamWriter: 28b2. クラスを合わせたインターフェースを定義します。
また、元のストリームのメソッドと属性も継承します。


File: python.info,  Node: エンコーディングと Unicode,  Next: 標準エンコーディング,  Prev: Codec 基底クラス,  Up: codecs --- codec レジストリと基底クラス

5.8.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: 888. が送出されます
(エラーメッセージの細かところは異なる場合があります。):
‘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.8.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(): a01.  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, IBM00858                        西ヨーロッパ言語
                                                           
                                                           
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                IBM01140                             西ヨーロッパ言語
                                                           
                                                           
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.8.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.8.2.15 テキストエンコーディング
.................................

次の codec では、 Unicode におけるテキストエンコーディングと同様に、
*note str: 16a. から *note bytes: 193. へのエンコードと、 *note
bytes-like object: 194. から ‘str’ へのデコードを提供します。

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 は、サポート
                                       されません。
                                       
                                            警告: The decoding and
                                            encoding algorithms
                                            scale poorly, so limit
                                            the length of untrusted
                                            input.
                                       
                                       
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.8.2.16 バイナリ変換 (Binary Transforms)
.........................................

以下の codec は、*note bytes-like object: 194. から *note bytes: 193. マ
ッピングへのバイナリ変換を提供します。*note bytes.decode(): ad7. はこの
変換をサポートしておらず、 *note str: 16a. を出力するだけです。

Codec                      別名                   意味                               エンコーダ / デコーダ
                                                                                     
------------------------------------------------------------------------------------------------------------------------
                                                                                     
base64_codec (1)           base64, base_64        被演算子をマルチラインの MIME      *note base64.encodebytes(): b50.
                                                  base64 に変換します (結果は常に    /
                                                  末尾の ‘'\n'’ を含みます)。        *note base64.decodebytes(): b51.
                                                                                     
                                                  バージョン 3.4 で変更: 任意の
                                                  *note bytes-like object: 194. を
                                                  エンコードとデコード用の入力とし
                                                  て受け取ります。
                                                  
                                                                                     
bz2_codec                  bz2                    被演算子をbz2を使って圧縮します    *note bz2.compress(): 28f5. /
                                                  。                                 *note bz2.decompress(): 12a4.
                                                                                     
                                                                                     
hex_codec                  hex                    被演算子をバイトあたり 2 桁の 16   *note binascii.b2a_hex(): 28f6.
                                                  進数の表現に変換します。           /
                                                                                     *note binascii.a2b_hex(): 28f7.
                                                                                     
                                                                                     
quopri_codec               quopri,                被演算子を MIME quoted printable   ‘quotetabs=True’ を指定した
                           quotedprintable,       形式に変換します。                 *note quopri.encode(): 28f8. /
                           quoted_printable                                          *note quopri.decode(): 28f9.
                                                                                     
                                                                                     
uu_codec                   uu                     被演算子を uuencode を用いて変換
                                                  します。
                                                  
                                                                                     
zlib_codec                 zip, zlib              被演算子を gzip を用いて圧縮しま   *note zlib.compress(): 84f. /
                                                  す。                               *note zlib.decompress(): f0d.
                                                                                     

Added in version 3.2: バイナリ変換が復活しました。(訳注: 2.x にはあった
ものが 3.0 で削除されていた。)

バージョン 3.4 で変更: バイナリ変換のエイリアスが復活しました。(訳注:
2.x にはあったエイリアス。3.2 でエイリアスは復活しなかった。)

   ---------- Footnotes ----------

   (1) *note バイト様オブジェクト: 194. に加えて、‘'base64_codec'’ も
*note str: 16a. の ASCII のみのインスタンスをデコード用に受け入れるよう
になりました


File: python.info,  Node: Standalone Codec Functions,  Next: テキスト変換 Text Transforms,  Prev: バイナリ変換 Binary Transforms,  Up: Python 特有のエンコーディング

5.8.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(): 1108. or *note codecs.decode(): 1109.  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(): 1c3. on bytes produces escaped byte values.

     'input' must be a *note bytes: 193. object.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     193. 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: 194.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     193. object and 'length' is the number of bytes consumed.


File: python.info,  Node: テキスト変換 Text Transforms,  Prev: Standalone Codec Functions,  Up: Python 特有のエンコーディング

5.8.2.18 テキスト変換 (Text Transforms)
.......................................

以下の codec は、*note str: 16a. から ‘str’ マッピングへのテキスト変換を
提供します。*note str.encode(): ad6. はこの変換をサポートしておらず、
*note bytes: 193. を出力するだけです。

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.8.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(): b60. 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(): a01, 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: 1acd. 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: 1acd. object for it.

     *note Availability: 2199.: 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.8.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 に透過的に変換するため、アプリケーショ
ンはホスト名を ‘socket’ モジュールに渡す際にホスト名の変換に煩わされるこ
とがありません。その上で、ホスト名を関数パラメタとして持つ、 *note
http.client: 73. や *note ftplib: 62. のようなモジュールでは Unicode ホ
スト名を受理します (‘http.client’ でもまた、 ‘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.8.2.21 ‘encodings.mbcs’ -- Windows ANSI codepage
..................................................

This module implements the ANSI codepage (CP_ACP).

*note Availability: 2199.: 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.8.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.9 データ型
============

この章で解説されるモジュールは日付や時間、型が固定された配列、ヒープキュ
ー、両端キュー、列挙型のような種々の特殊なデータ型を提供します。

Python にはその他にもいくつかの組み込みデータ型があります。特に、 *note
dict: 184. 、 *note list: 24f. 、 *note set: 185. 、 *note frozenset:
7f2. 、そして *note tuple: 614. があります。 *note str: 16a. クラスは
Unicode データを扱うことができ、 *note bytes: 193. と *note bytearray:
342. クラスはバイナリデータを扱うことができます。

この章では以下のモジュールが記述されています:

* 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.9.1 ‘datetime’ -- 基本的な日付と時間の型
------------------------------------------

'ソースコード:' Lib/datetime.py(1)

__________________________________________________________________

‘datetime’ モジュールは、日付や時刻を操作するためのクラスを提供していま
す。

日付や時刻に対する算術がサポートされている一方、実装では出力のフォーマッ
トや操作のための効率的な属性の抽出に重点を置いています。

     Tip: *note 書式コード: 290e. に飛ぶ。

参考
....

*note calendar: 15. モジュール

     汎用のカレンダー関連関数。

*note time: f4. モジュール

     時刻へのアクセスと変換。

*note zoneinfo: 13b. モジュール

     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.9.1.1 Aware and naive objects
...............................

日時のオブジェクトは、それらがタイムゾーンの情報を含んでいるかどうかによ
って "aware" あるいは "naive" に分類されます。

タイムゾーンや夏時間の情報のような、アルゴリズム的で政治的な適用可能な時
間調節に関する知識を持っているため、 'aware' オブジェクトは他の aware オ
ブジェクトとの相対関係を特定できます。 aware オブジェクトは解釈の余地の
ない特定の実時刻を表現します。 (1)

'naive' オブジェクトには他の日付時刻オブジェクトとの相対関係を把握するの
に足る情報が含まれません。あるプログラム内の数字がメートルを表わしている
のか、マイルなのか、それとも質量なのかがプログラムによって異なるように、
naive オブジェクトが協定世界時 (UTC) なのか、現地時間なのか、それとも他
のタイムゾーンなのかはそのプログラムに依存します。Naive オブジェクトはい
くつかの現実的な側面を無視してしまうというコストを無視すれば、簡単に理解
でき、うまく利用することができます。

For applications requiring aware objects, *note datetime: 4e2. and *note
time: 1fd. objects have an optional time zone information attribute,
‘tzinfo’, that can be set to an instance of a subclass of the abstract
‘tzinfo’ class.  These *note tzinfo: 7f6. objects capture information
about the offset from UTC time, the time zone name, and whether daylight
saving time is in effect.

ただ一つの具象 *note tzinfo: 7f6. クラスである *note timezone: 12d9. ク
ラスが ‘datetime’ モジュールで提供されています。 ‘timezone’ クラスは、
UTCからのオフセットが固定である単純なタイムゾーン（例えばUTCそれ自体）、
および北アメリカにおける東部標準時（EST）／東部夏時間（EDT）のような単純
ではないタイムゾーンの両方を表現できます。より深く詳細までタイムゾーンを
サポートするかはアプリケーションに依存します。世界中の時刻の調整を決める
ルールは合理的というよりかは政治的なもので、頻繁に変わり、UTC を除くと都
合のよい基準というものはありません。

   ---------- Footnotes ----------

   (1) If, that is, we ignore the effects of relativity.


File: python.info,  Node: 定数,  Next: Available types,  Prev: Aware and naive objects,  Up: datetime --- 基本的な日付と時間の型

5.9.1.2 定数
............

‘datetime’ モジュールでは以下の定数を公開しています:

 -- データ: datetime.MINYEAR

     *note date: 1fc. や *note datetime: 4e2. オブジェクトで許されている
     、年を表現する最小の数字です。 *note MINYEAR: 2912. は1です。

 -- データ: datetime.MAXYEAR

     *note date: 1fc. や *note datetime: 4e2. オブジェクトで許されている
     、年を表現する最大の数字です。 *note MAXYEAR: 2913. は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.9.1.3 Available types
.......................

 -- クラス: datetime.date

     理想的な naive な日付で、これまでもこれからも現在のグレゴリオ暦
     (Gregorian calender) が有効であることを仮定しています。 属性は
     *note year: 2915, *note month: 2916,および *note day: 2917. です。

 -- クラス: datetime.time

     理想的な時刻で、特定の日から独立しており、毎日が厳密に 24*60*60 秒
     であると仮定しています。("うるう秒: leap seconds" の概念はありませ
     ん。) 属性は *note hour: 2918, *note minute: 2919, *note second:
     291a, *note microsecond: 291b, および *note tzinfo: 291c. です。

 -- クラス: datetime.datetime

     日付と時刻を組み合わせたものです。 属性は *note year: 291d, *note
     month: 291e, *note day: 291f, *note hour: 2920, *note minute: 2921,
     *note second: 2922, *note microsecond: 2923, および *note tzinfo:
     2924. です。

 -- クラス: datetime.timedelta

     *note datetime: 4e2. あるいは *note date: 1fc. クラスの二つのインス
     タンス間の時間差をマイクロ秒精度で表す経過時間値です。

 -- クラス: datetime.tzinfo

     タイムゾーン情報オブジェクトの抽象基底クラスです。 *note datetime:
     4e2. および *note time: 1fd. クラスで用いられ、カスタマイズ可能な時
     刻修正の概念 (たとえばタイムゾーンや夏時間の計算) を提供します。

 -- クラス: 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.9.1.4 Common properties
.........................

*note date: 1fc. 型、*note datetime: 4e2. 型、*note time: 1fd. 型、*note
timezone: 12d9. 型には共通する特徴があります:

   - これらの型のオブジェクトは変更不可能 (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.9.1.5 Determining if an object is aware or naive
..................................................

*note date: 1fc. 型のオブジェクトは常に naive です。

*note time: 1fd. 型あるいは *note datetime: 4e2. 型のオブジェクトは
aware か naive のどちらかです。

次の条件を両方とも満たす場合、 *note datetime: 4e2. オブジェクト ‘d’ は
aware です:

  1. ‘d.tzinfo’ が ‘None’ でない

  2. ‘d.tzinfo.utcoffset(d)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘d’ は naive です。

次の条件を両方とも満たす場合、 *note time: 1fd. オブジェクト ‘t’ は
aware です:

  1. ‘t.tzinfo’ が ‘None’ でない

  2. ‘t.tzinfo.utcoffset(None)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘t’ は naive です。

aware なオブジェクトと naive なオブジェクトの区別は *note timedelta:
bc7. オブジェクトにはあてはまりません。


File: python.info,  Node: timedelta objects,  Next: date objects,  Prev: Available types,  Up: datetime --- 基本的な日付と時間の型

5.9.1.6 ‘timedelta’ objects
...........................

*note timedelta: bc7. オブジェクトは経過時間、すなわち二つの *note
datetime: 4e2. または *note date: 1fc. のインスタンスの差を表します。

 -- クラス: 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つの属性に正規化されるかの説明をしています
     :

          >>> import datetime as dt
          >>> delta = dt.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)

          Tip: ‘import datetime as dt’ instead of ‘import datetime’ or
          ‘from datetime import datetime’ to avoid confusion between the
          module and the class.  See How I Import Python’s datetime
          Module(1).

     引数のいずれかが浮動小数点であり、小数のマイクロ秒が存在する場合、
     小数のマイクロ秒は全ての引数から一度取り置かれ、それらの和は最近接
     偶数のマイクロ秒に丸められます。浮動小数点の引数がない場合、値の変
     換と正規化の過程は厳密な (失われる情報がない) ものとなります。

     日の値を正規化した結果、指定された範囲の外側になった場合には、
     *note OverflowError: a85. が送出されます。

     負の値を正規化すると、最初は混乱するような値になります。例えば:

          >>> import datetime as dt
          >>> d = dt.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: bc7. オブジェクトで、
     ‘timedelta(-999999999)’ です。

 -- の属性: timedelta.max

     最大の値を表す *note timedelta: bc7. オブジェクトで、
     ‘timedelta(days=999999999, hours=23, minutes=59, seconds=59,
     microseconds=999999)’ です。

 -- の属性: timedelta.resolution

     *note timedelta: bc7. オブジェクトが等しくならない最小の時間差で、
     ‘timedelta(microseconds=1)’ です。

正規化のために、 ‘timedelta.max’ は ‘-timedelta.min’ より大きいことに注
意してください。 ‘-timedelta.max’ は *note timedelta: bc7. オブジェクト
として表現することができません。

インスタンスの属性 (読み出しのみ):

 -- の属性: 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(): 1521. value instead:

               >>> import datetime as dt
               >>> duration = dt.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: 197. オブジェクトを返します。
                                     
                                     
‘t1 = t2 / f’ または ‘t1 = t2 / i’   時間差を浮動小数点や整数で除したもの。結果は最近
                                     接偶数への丸めを利用して最も近い
                                     timedelta.resolution の倍数に丸められます。
                                     
                                     
‘t1 = t2 // i’ または ‘t1 = t2 //    floor が計算され、余りは (もしあれば) 捨てられま
t3’                                  す。後者の場合、整数が返されます。(3)
                                     
                                     
‘t1 = t2 % t3’                       剰余が *note timedelta: bc7. オブジェクトとして計
                                     算されます。(3)
                                     
                                     
‘q, r = divmod(t1, t2)’              商と剰余が計算されます: ‘q = t1 // t2’ (3) と ‘r
                                     = t1 % t2’ 。‘q’ は整数で ‘r’ は
                                     *note timedelta: bc7. オブジェクトです。
                                     
                                     
‘+t1’                                同じ値を持つ *note timedelta: bc7. オブジェクトを
                                     返します。(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: bc7. オブジェクトの文字列表現を
                                     返します。その文字列は、正規の属性値を持つコンス
                                     トラクタ呼び出しのコードになっています。
                                     

注釈:

  1. この演算は正確ですが、オーバフローするかもしれません。

  2. この演算は正確であり、オーバフローし得ません。

  3. 0 による除算は *note ZeroDivisionError: b43. を送出します。

  4. ‘-timedelta.max’ は *note timedelta: bc7. オブジェクトで表現するこ
     とができません。

  5. *note timedelta: bc7. オブジェクトの文字列表現は内部表現に類似した
     形に正規化されます。そのため負の 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: bc7. オブジェクトは *note date:
1fc. および *note datetime: 4e2. オブジェクトとの間で加減算をサポートし
ています (下を参照してください)。

バージョン 3.2 で変更: Floor division and true division of a *note
timedelta: bc7. object by another ‘timedelta’ object are now supported,
as are remainder operations and the *note divmod(): b9d. function.  True
division and multiplication of a ‘timedelta’ object by a *note float:
197. object are now supported.

*note timedelta: bc7. オブジェクトは等価性と順序の比較をサポートします。

ブール演算コンテキストでは、 *note timedelta: bc7. オブジェクトは
‘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.

   ---------- Footnotes ----------

   (1) 
https://adamj.eu/tech/2019/09/12/how-i-import-pythons-datetime-module/


File: python.info,  Node: Examples of usage timedelta,  Up: timedelta objects

5.9.1.7 Examples of usage: ‘timedelta’
......................................

正規化の追加の例です:

     >>> # Components of another_year add up to exactly 365 days
     >>> import datetime as dt
     >>> year = dt.timedelta(days=365)
     >>> another_year = dt.timedelta(weeks=40, days=84, hours=23,
     ...                             minutes=50, seconds=600)
     >>> year == another_year
     True
     >>> year.total_seconds()
     31536000.0

*note timedelta: bc7. の計算の例です:

     >>> import datetime as dt
     >>> year = dt.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.9.1.8 ‘date’ objects
......................

*note date: 1fc. オブジェクトは、両方向に無期限に拡張された現在のグレゴ
リオ暦という理想化された暦の日付 (年月日) を表します。

1 年 1 月 1 日は日番号 1、1 年 1 月 2 日は日番号 2 と呼ばれ、他も同様で
す。 (1)

 -- クラス: datetime.date (year, month, day)

     全ての引数が必須です。 引数は整数で、次の範囲に収まっていなければな
     りません:

        * ‘MINYEAR <= year <= MAXYEAR’

        * ‘1 <= month <= 12’

        * ‘1 <= day <= 指定された月と年における日数’

     範囲を超えた引数を与えた場合、 *note ValueError: 2ee. が送出されま
     す。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: 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: a85. を送出するか
     もしれません。また ‘localtime()’ 呼び出しが失敗した場合には *note
     OSError: 2c2. を送出するかもしれません。この範囲は通常は 1970 年か
     ら 2038 年までに制限されています。タイムスタンプの表記にうるう秒を
     含める非 POSIX なシステムでは、うるう秒は *note fromtimestamp():
     dd1. では無視されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 2ee. ではなく *note OverflowError: a85. を送出するよう
     になりました。 ‘localtime()’ の呼び出し失敗で ‘ValueError’ ではなく
     *note OSError: 2c2. を送出するようになりました。

 -- メソッド: 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: 2ee. が送出されます。 任意の日付 ‘d’ に対し、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: classmethod date.fromisoformat (date_string)

     以下の例外を除く、有効な ISO 8601 フォーマットで与えられた
     'date_string' に対応する *note date: 1fc. を返します :

       1. 精度の低い日付は現在サポートされていません(‘YYYY-MM’, ‘YYYY’)。

       2. 拡張された日付表現は現在サポートされていません
          (‘±YYYYYY-MM-DD’)。

       3. 序数の日付は現在サポートされていません(‘YYYY-OOO’)。

     例:

          >>> import datetime as dt
          >>> dt.date.fromisoformat('2019-12-04')
          datetime.date(2019, 12, 4)
          >>> dt.date.fromisoformat('20191204')
          datetime.date(2019, 12, 4)
          >>> dt.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: 1fc. corresponding to the ISO calendar date
     specified by 'year', 'week' and 'day'.  This is the inverse of the
     function *note date.isocalendar(): af5.

     Added in version 3.8.

 -- メソッド: classmethod date.strptime (date_string, format)

     Return a *note date: 1fc. 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(): 164b. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 2ee. を送出します。*note strftime() and strptime()
     behavior: 1bb3. および *note date.fromisoformat(): 828. も参照して
     ください。

          注釈: If 'format' specifies a day of month without a year a
          *note DeprecationWarning: 1a4. 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:

               >>> import datetime as dt
               >>> date_string = "02/29"
               >>> when = dt.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: 2912. から *note MAXYEAR: 2913. までの
     値です。

 -- の属性: 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: 2912. になってしまったり、 *note MAXYEAR: 2913. より大きく
     なってしまう場合には *note OverflowError: a85. が送出されます。

  2. ‘timedelta.seconds’ と ‘timedelta.microseconds’ は無視されます。

  3. この演算は厳密で、オーバフローしません。‘timedelta.seconds’ および
     ‘timedelta.microseconds’ は 0 で、演算後には ‘date2 + timedelta ==
     date1’ となります。

  4. 同じ日を表す *note date: 1fc. オブジェクトは等しいです。

     *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 *note date: 1fc. object that is not also
     a *note datetime: 4e2. instance and a ‘datetime’ object raises
     *note TypeError: 199.

バージョン 3.13 で変更: Comparison between *note datetime: 4e2. object
and an instance of the *note date: 1fc. 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: 1fd. オブジェクトは真とみ
なされます。

インスタンスメソッド:

 -- メソッド: date.replace (year=self.year, month=self.month,
          day=self.day)

     Return a new *note date: 1fc. object with the same values, but with
     specified parameters updated.

     以下はプログラム例です:

          >>> import datetime as dt
          >>> d = dt.date(2002, 12, 31)
          >>> d.replace(day=26)
          datetime.date(2002, 12, 26)

     The generic function *note copy.replace(): 1c2. also supports *note
     date: 1fc. objects.

 -- メソッド: date.timetuple ()

     *note time.localtime(): 1717. が返すような *note time.struct_time:
     eea. を返します。

     時分秒が 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: 1fc. オブジェクト ‘d’ について、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: date.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).weekday() == 2’ であり、水曜日を示します。 *note
     isoweekday(): 2938. も参照してください。

 -- メソッド: date.isoweekday ()

     月曜日を 1,日曜日を 7 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).isoweekday() == 3’ であり、水曜日を示します。
     *note weekday(): 2937, *note isocalendar(): af5. も参照してください
     。

 -- メソッド: 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 日、日曜日に終わりま
     す

          >>> import datetime as dt
          >>> dt.date(2003, 12, 29).isocalendar()
          datetime.IsoCalendarDate(year=2004, week=1, weekday=1)
          >>> dt.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’ で表した文字列を返します:

          >>> import datetime as dt
          >>> dt.date(2002, 12, 4).isoformat()
          '2002-12-04'

 -- メソッド: date.__str__ ()

     *note date: 1fc. オブジェクト ‘d’ において、‘str(d)’ は
     ‘d.isoformat()’ と等価です。

 -- メソッド: date.ctime ()

     日付を表す文字列を返します:

          >>> import datetime as dt
          >>> dt.date(2002, 12, 4).ctime()
          'Wed Dec  4 00:00:00 2002'

     ‘d.ctime()’ は次の式と等価です:

          time.ctime(time.mktime(d.timetuple()))

     これが等価になるのは、 (*note time.ctime(): 293c. に呼び出され、
     *note date.ctime(): 293b. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: date.strftime (format)

     明示的な書式文字列で制御された、日付を表現する文字列を返します。 時
     間、分、秒を表す書式コードは値 0 になります。 *note strftime() and
     strptime() behavior: 1bb3. および *note date.isoformat(): 2939. も
     参照してください。

 -- メソッド: date.__format__ (format)

     *note date.strftime(): e93. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19b. の中や *note str.format():
     833. を使っているときに *note date: 1fc. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1bb3. およ
     び *note date.isoformat(): 2939. も参照してください。

* 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.9.1.9 Examples of usage: ‘date’
.................................

イベントまでの日数を数える例を示します:

     >>> import time
     >>> import datetime as dt
     >>> today = dt.date.today()
     >>> today
     datetime.date(2007, 12, 5)
     >>> today == dt.date.fromtimestamp(time.time())
     True
     >>> my_birthday = dt.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: 1fc. を使う例:

     >>> import datetime as dt
     >>> d = dt.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.9.1.10 ‘datetime’ objects
...........................

*note datetime: 4e2. オブジェクトは *note date: 1fc. オブジェクトおよび
*note time: 1fd. オブジェクトの全ての情報が入っている単一のオブジェクト
です。

Like a *note date: 1fc. object, *note datetime: 4e2. assumes the current
Gregorian calendar extended in both directions; like a *note time: 1fd.
object, ‘datetime’ assumes there are exactly 3600*24 seconds in every
day.

以下にコンストラクタを示します:

 -- クラス: 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: 2ee. が送出されま
     す。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: classmethod datetime.today ()

     *note tzinfo: 2924. が ‘None’ である現在のローカルの日付および時刻
     を返します。

     次と等価です:

          datetime.fromtimestamp(time.time())

     *note now(): 711, *note fromtimestamp(): 712. も参照してください。

     このメソッドの機能は *note now(): 711. と等価ですが、 ‘tz’ 引数はあ
     りません。

 -- メソッド: classmethod datetime.now (tz=None)

     現在のローカルな日時を返します。

     オプションの引数 'tz' が ‘None’ であるか指定されていない場合、この
     メソッドは *note today(): 2941. と同様ですが、可能ならば *note
     time.time(): 55d. タイムスタンプを通じて得ることができる、より高い
     精度で時刻を提供します (例えば、プラットフォームが C 関数
     ‘gettimeofday()’ をサポートする場合には可能なことがあります)。

     'tz' が ‘None’ でない場合、 'tz' は *note tzinfo: 7f6. のサブクラス
     のインスタンスでなければならず、現在の日付および時刻は 'tz' のタイ
     ムゾーンに変換されます。

     *note today(): 2941. および *note utcnow(): 34f. よりもこの関数を使
     う方が好ましいです。

          注釈: Subsequent calls to ‘datetime.now()’ may return the same
          instant depending on the precision of the underlying clock.

 -- メソッド: classmethod datetime.utcnow ()

     *note tzinfo: 2924. が ‘None’ である現在の UTC の日付および時刻を返
     します。

     このメソッドは *note now(): 711. と似ていますが、 naive な *note
     datetime: 4e2. オブジェクトとして現在の UTC 日付および時刻を返しま
     す。 aware な現在の UTC datetime は ‘datetime.now(timezone.utc)’ を
     呼び出すことで取得できます。 ‘now()’ も参照してください。

          警告: 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: a85. を送出することが
     あります。この範囲はよく 1970 年から 2038 年に制限されています。 ま
     た ‘localtime()’ や ‘gmtime()’ が失敗した際は *note OSError: 2c2. を
     送出します。 うるう秒がタイムスタンプの概念に含まれている非 POSIX シ
     ステムでは、 ‘fromtimestamp()’ はうるう秒を無視します。 このため、
     秒の異なる二つのタイムスタンプが同一の *note datetime: 4e2. オブジ
     ェクトとなることが起こり得ます。 *note utcfromtimestamp(): 350. よ
     りも、このメソッドの方が好ましいです。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ もしくは ‘gmtime()’ のサポートする値の範囲から外れて
     いた場合、 *note ValueError: 2ee. ではなく *note OverflowError:
     a85. を送出するようになりました。 ‘localtime()’ もしくは ‘gmtime()’
     の呼び出し失敗で ‘ValueError’ ではなく *note OSError: 2c2. を送出す
     るようになりました。

     バージョン 3.6 で変更: *note fromtimestamp(): 712. は *note fold:
     e55. を1にしてインスタンスを返します。

 -- メソッド: classmethod datetime.utcfromtimestamp (timestamp)

     POSIX タイムスタンプに対応する、*note tzinfo: 2924. が ‘None’ の
     UTC での *note datetime: 4e2. を返します。(返されるオブジェクトは
     naive です。)

     タイムスタンプがプラットフォームにおける C 関数 ‘localtime()’ でサ
     ポートされている範囲を超えている場合には *note OverflowError: a85.
     を、‘gmtime()’ が失敗した場合には *note OSError: 2c2. を送出します
     。 これはたいてい 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: 2912. から *note
     MAXYEAR: 2913. を含みます) をサポートします。

          警告: naive な ‘datetime’ オブジェクトは多くの ‘datetime’ メソ
          ッドでローカルな時間として扱われるため、 aware な datetime を
          使って UTC の時刻を表すのが好ましいです。 そのため、 UTC での
          ある特定のタイムスタンプを表すオブジェクトの作成では
          ‘datetime.fromtimestamp(timestamp, tz=timezone.utc)’ を呼び出
          す方法が推奨されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘gmtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 2ee. ではなく *note OverflowError: a85. を送出するよう
     になりました。 ‘gmtime()’ の呼び出し失敗で ‘ValueError’ ではなく
     *note OSError: 2c2. を送出するようになりました。

     バージョン 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: 2ee. が送出
     されます。 返されるオブジェクトの時間、分、秒、およびマイクロ秒はす
     べて 0 で、 *note tzinfo: 2924. は ‘None’ となっています。

 -- メソッド: classmethod datetime.combine (date, time,
          tzinfo=time.tzinfo)

     Return a new *note datetime: 4e2. object whose date components are
     equal to the given *note date: 1fc. object's, and whose time
     components are equal to the given *note time: 1fd. object's.  If
     the 'tzinfo' argument is provided, its value is used to set the
     *note tzinfo: 2924. attribute of the result, otherwise the *note
     tzinfo: 291c. attribute of the 'time' argument is used.  If the
     'date' argument is a ‘datetime’ object, its time components and
     ‘tzinfo’ attributes are ignored.

     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’)。

     例:

          >>> import datetime as dt
          >>> dt.datetime.fromisoformat('2011-11-04')
          datetime.datetime(2011, 11, 4, 0, 0)
          >>> dt.datetime.fromisoformat('20111104')
          datetime.datetime(2011, 11, 4, 0, 0)
          >>> dt.datetime.fromisoformat('2011-11-04T00:05:23')
          datetime.datetime(2011, 11, 4, 0, 5, 23)
          >>> dt.datetime.fromisoformat('2011-11-04T00:05:23Z')
          datetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)
          >>> dt.datetime.fromisoformat('20111104T000523')
          datetime.datetime(2011, 11, 4, 0, 5, 23)
          >>> dt.datetime.fromisoformat('2011-W01-2T00:05:23.283')
          datetime.datetime(2011, 1, 4, 0, 5, 23, 283000)
          >>> dt.datetime.fromisoformat('2011-11-04 00:05:23.283')
          datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)
          >>> dt.datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')
          datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone.utc)
          >>> dt.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(): 2939. or
     *note datetime.isoformat(): d29.

 -- メソッド: 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(): af6.

     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(): 164b. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 2ee. を送出します。*note strftime() and strptime()
     behavior: 1bb3. および *note datetime.fromisoformat(): 82a. も参照
     してください。

     バージョン 3.13 で変更: If 'format' specifies a day of month
     without a year a *note DeprecationWarning: 1a4. 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:

          >>> import datetime as dt
          >>> date_string = "02/29"
          >>> when = dt.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: 2912. から *note MAXYEAR: 2913. までの
     値です。

 -- の属性: 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: 2924. 属
     性を持ち、演算後には ‘datetime2 - datetime1 == timedelta’ となりま
     す。 ‘datetime2.year’ が *note MINYEAR: 2912. よりも小さいか、
     *note MAXYEAR: 2913. より大きい場合には *note OverflowError: a85. が
     送出されます。 入力が aware なオブジェクトの場合でもタイムゾーン修
     正は全く行われません。

  2. ‘datetime2 + timedelta == datetime1’ となるような ‘datetime2’ を計
     算します。 ちなみに、結果は入力の datetime と同じ *note tzinfo:
     2924. 属性を持ち、入力が aware だとしてもタイムゾーン修正は全く行わ
     れません。

  3. Subtraction of a *note datetime: 4e2. from a ‘datetime’ is defined
     only if both operands are naive, or if both are aware.  If one is
     aware and the other is naive, *note TypeError: 199. is raised.

     If both are naive, or both are aware and have the same *note
     tzinfo: 2924. attribute, the ‘tzinfo’ attributes are ignored, and
     the result is a *note timedelta: bc7. 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: 2924.
     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 *note datetime: 4e2. objects are never equal.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: e55. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 2924. attributes, the comparison acts as
     comparands were first converted to UTC datetimes except that the
     implementation never overflows.  *note datetime: 4e2. 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: 199.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: e55. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 2924. 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 な ‘datetime’ インスタンスの等価比較では *note TypeError: 199. は
送出されません。

バージョン 3.13 で変更: Comparison between *note datetime: 4e2. object
and an instance of the *note date: 1fc. 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: 1fc. オブジェクトを返します。

 -- メソッド: datetime.time ()

     同じhour、minute、second、microsecond 及び foldを持つ *note time:
     1fd. オブジェクトを返します。 *note tzinfo: 2924. は ‘None’ です。
     *note timetz(): 2947. も参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 1fd. オブジェ
     クトにコピーされます。

 -- メソッド: datetime.timetz ()

     同じhour、minute、second、microsecond、fold および tzinfo 属性を持
     つ *note time: 1fd. オブジェクトを返します。 *note time(): f4. メソ
     ッドも参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 1fd. オブジェ
     クトにコピーされます。

 -- メソッド: 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(): 1c2. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: datetime.astimezone (tz=None)

     'tz' を新たに *note tzinfo: 2924. 属性 として持つ *note datetime:
     4e2. オブジェクトを返します。 日付および時刻データを調整して、返り
     値が 'self' と同じ UTC 時刻を持ち、 'tz' におけるローカルな時刻を表
     すようにします。

     もし与えられた場合、 'tz' は *note tzinfo: 7f6. のサブクラスのイン
     スタンスでなければならず、 インスタンスの *note utcoffset(): 2948.
     および *note dst(): 2949. メソッドは ‘None’ を返してはなりません。
     もし 'self' が naive ならば、おそらくシステムのタイムゾーンで時間を
     表現します。

     引数無し (もしくは ‘tz=None’ の形 ) で呼び出された場合、システムの
     ローカルなタイムゾーンが変更先のタイムゾーンだと仮定されます。 変換
     後の datetime インスタンスの ‘.tzinfo’ 属性には、 OS から取得したゾ
     ーン名とオフセットを持つ *note timezone: 12d9. インスタンスが設定さ
     れます。

     ‘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: 12d9. オブジェクト 'tz' を *note datetime: 34.
     オブジェクト 'dt' に追加したいだけで、日付や時刻データへの調整を行
     わないのなら、‘dt.replace(tzinfo=tz)’ を使ってください。単に aware
     な ‘datetime’ オブジェクト 'dt' から ‘timezone’ オブジェクトを除去
     したいだけで、日付や時刻データの変換を行わないのなら、
     ‘dt.replace(tzinfo=None)’ を使ってください。

     デフォルトの *note tzinfo.fromutc(): 294a. メソッドを *note tzinfo:
     7f6. のサブクラスで上書きして, *note astimezone(): bc8. が返す結果
     に影響を及ぼすことができます。エラーの場合を無視すると、
     ‘astimezone()’ は以下のように動作します:

          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(): bc8. メ
     ソッドを naive なインスタンスに対して呼び出せるようになりました。こ
     れは、システムのローカルな時間を表現していると想定されます。

 -- メソッド: datetime.utcoffset ()

     *note tzinfo: 2924. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(self)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: bc7. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.dst ()

     *note tzinfo: 2924. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(self)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: bc7. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.tzname ()

     *note tzinfo: 2924. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.tzname(self)’ を返します。 後者の式が ‘None’ か文
     字列オブジェクトのいずれかを返さない場合には例外を送出します。

 -- メソッド: datetime.timetuple ()

     *note time.localtime(): 1717. が返すような *note time.struct_time:
     eea. を返します。

     ‘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: 294d. フラグは *note dst(): 2949. メソッドに従っ
     て設定されます: *note tzinfo: 2924. が ‘None’ か ‘dst()’ が ‘None’
     を返す場合、 ‘tm_isdst’ は ‘-1’ に設定されます; そうでない場合、
     ‘dst()’ がゼロでない値を返すと ‘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: 294d. 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: eea. for the
     normalized time is returned.  ‘tm_isdst’ is forced to 0.  Note that
     an *note OverflowError: a85. 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(): 294e. は誤解を招きやすい返り値を返す
          かもしれません。 UTC を表す naive な ‘datetime’ があった場合、
          *note datetime.timetuple(): 294c. が使えるところでは
          ‘datetime.replace(tzinfo=timezone.utc)’ で aware にします。

 -- メソッド: datetime.toordinal ()

     先発グレゴリオ暦における日付序数を返します。
     ‘self.date().toordinal()’ と同じです。

 -- メソッド: datetime.timestamp ()

     *note datetime: 4e2. インスタンスに対応する POSIX タイムスタンプを
     返します。 返り値は *note time.time(): 55d. で返される値に近い
     *note float: 197. です。

     Naive *note datetime: 4e2. instances are assumed to represent local
     time and this method relies on the platform C ‘mktime()’ function
     to perform the conversion.  Since ‘datetime’ supports wider range
     of values than ‘mktime()’ on many platforms, this method may raise
     *note OverflowError: a85. or *note OSError: 2c2. for times far in
     the past or far in the future.

     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 ‘timestamp()’ method uses the *note
     fold: e55. attribute to disambiguate the times during a repeated
     interval.

 -- メソッド: datetime.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。
     ‘self.date().weekday()’ と同じです。 *note isoweekday(): 2951. も参
     照してください。

 -- メソッド: datetime.isoweekday ()

     月曜日を 1、日曜日を 7 として、曜日を整数で返します。
     ‘self.date().isoweekday()’ と等価です。 *note weekday(): 2950. 、
     *note isocalendar(): af6. も参照してください。

 -- メソッド: datetime.isocalendar ()

     ‘year’、‘week’、‘weekday’ の3つで構成された *note named tuple: 85e.
     を返します。 ‘self.date().isocalendar()’ と等価です。

 -- メソッド: datetime.isoformat (sep='T', timespec='auto')

     日時を ISO 8601 書式で表した文字列で返します:

        - *note microsecond: 2923. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff’

        - *note microsecond: 2923. が 0 の場合は ‘YYYY-MM-DDTHH:MM:SS’

     *note utcoffset(): 2948. が ‘None’ を返さない場合は、文字列の後ろに
     UTC オフセットが追記されます:

        - *note microsecond: 2923. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 2923. が 0 の場合は
          ‘YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]’

     例:

          >>> import datetime as dt
          >>> dt.datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()
          '2019-05-18T15:17:08.132263'
          >>> dt.datetime(2019, 5, 18, 15, 17, tzinfo=dt.timezone.utc).isoformat()
          '2019-05-18T15:17:00+00:00'

     オプションの引数 'sep' (デフォルトでは ‘'T'’ です) は 1 文字のセパ
     レータで、結果の文字列の日付と時刻の間に置かれます。例えば:

          >>> import datetime as dt
          >>> class TZ(dt.tzinfo):
          ...     """A time zone with an arbitrary, constant -06:39 offset."""
          ...     def utcoffset(self, when):
          ...         return dt.timedelta(hours=-6, minutes=-39)
          ...
          >>> dt.datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
          '2002-12-25 00:00:00-06:39'
          >>> dt.datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()
          '2009-11-27T00:00:00.000100-06:39'

     オプション引数 'timespec' は、含める追加の時間の要素の数を指定しま
     す(デフォルトでは ‘'auto'’ です)。以下の内一つを指定してください。

        - ‘'auto'’: *note microsecond: 2923. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 2920. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 2920. および *note minute: 2921. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 2920. 、 *note minute: 2921. 、 *note
          second: 2922. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 2ee. があげられます:

          >>> import datetime as dt
          >>> dt.datetime.now().isoformat(timespec='minutes')
          '2002-12-25T00:00'
          >>> my_datetime = dt.datetime(2015, 1, 1, 12, 30, 59, 0)
          >>> my_datetime.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 ()

     日付および時刻を表す文字列を返します:

          >>> import datetime as dt
          >>> dt.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(): 293c. に呼び出され、
     *note datetime.ctime(): 2953. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: datetime.strftime (format)

     明示的な書式文字列で制御された、日付および時刻を表現する文字列を返
     します。*note strftime() and strptime() behavior: 1bb3. および
     *note datetime.isoformat(): d29. も参照してください。

 -- メソッド: datetime.__format__ (format)

     *note datetime.strftime(): e92. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19b. の中や *note str.format():
     833. を使っているときに *note datetime: 4e2. オブジェクトの書式文字
     列を指定できます。 *note strftime() and strptime() behavior: 1bb3.
     および *note datetime.isoformat(): d29. も参照してください。

* Menu:

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


File: python.info,  Node: Examples of usage datetime,  Up: datetime objects

5.9.1.11 Examples of usage: ‘datetime’
......................................

*note datetime: 4e2. オブジェクトを使う例:

     >>> import datetime as dt

     >>> # Using datetime.combine()
     >>> d = dt.date(2005, 7, 14)
     >>> t = dt.time(12, 30)
     >>> dt.datetime.combine(d, t)
     datetime.datetime(2005, 7, 14, 12, 30)

     >>> # Using datetime.now()
     >>> dt.datetime.now()
     datetime.datetime(2007, 12, 6, 16, 29, 43, 79043)   # GMT +1
     >>> dt.datetime.now(dt.timezone.utc)
     datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone.utc)

     >>> # Using datetime.strptime()
     >>> my_datetime = dt.datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
     >>> my_datetime
     datetime.datetime(2006, 11, 21, 16, 30)

     >>> # Using datetime.timetuple() to get tuple of all attributes
     >>> tt = my_datetime.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 = my_datetime.isocalendar()
     >>> for it in ic:
     ...     print(it)
     ...
     2006    # ISO year
     47      # ISO week
     2       # ISO weekday

     >>> # Formatting a datetime
     >>> my_datetime.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(my_datetime, "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. のサブクラスを定義しています:

     import datetime as dt

     class KabulTz(dt.tzinfo):
         # Kabul used +4 until 1945, when they moved to +4:30
         UTC_MOVE_DATE = dt.datetime(1944, 12, 31, 20, tzinfo=dt.timezone.utc)

         def utcoffset(self, when):
             if when.year < 1945:
                 return dt.timedelta(hours=4)
             elif (1945, 1, 1, 0, 0) <= when.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 when falls in the imaginary range, use fold to decide how
                 # to resolve. See PEP 495.
                 return dt.timedelta(hours=4, minutes=(30 if when.fold else 0))
             else:
                 return dt.timedelta(hours=4, minutes=30)

         def fromutc(self, when):
             # Follow same validations as in datetime.tzinfo
             if not isinstance(when, dt.datetime):
                 raise TypeError("fromutc() requires a datetime argument")
             if when.tzinfo is not self:
                 raise ValueError("when.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 when.replace(tzinfo=dt.timezone.utc) >= self.UTC_MOVE_DATE:
                 return when + dt.timedelta(hours=4, minutes=30)
             else:
                 return when + dt.timedelta(hours=4)

         def dst(self, when):
             # Kabul does not observe daylight saving time.
             return dt.timedelta(0)

         def tzname(self, when):
             if when >= self.UTC_MOVE_DATE:
                 return "+04:30"
             return "+04"

上に出てきた ‘KabulTz’ の使い方:

     >>> tz1 = KabulTz()

     >>> # Datetime before the change
     >>> dt1 = dt.datetime(1900, 11, 21, 16, 30, tzinfo=tz1)
     >>> print(dt1.utcoffset())
     4:00:00

     >>> # Datetime after the change
     >>> dt2 = dt.datetime(2006, 6, 14, 13, 0, tzinfo=tz1)
     >>> print(dt2.utcoffset())
     4:30:00

     >>> # Convert datetime to another time zone
     >>> dt3 = dt2.astimezone(dt.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.9.1.12 ‘time’ objects
.......................

*note time: 1fd. オブジェクトは (ローカルの) 日中時刻を表現します。 この
時刻表現は特定の日の影響を受けず、 *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: 2ee. が送出され
     ます。 'tzinfo' のデフォルト値が ‘None’ である以外のデフォルト値は
     0です。

以下にクラス属性を示します:

 -- の属性: time.min

     表現できる最も古い *note time: 1fd. で、 ‘time(0, 0, 0, 0)’ です。

 -- の属性: time.max

     表現できる最も新しい *note time: 1fd. で、 ‘time(23, 59, 59,
     999999)’ です。

 -- の属性: time.resolution

     等しくない *note time: 1fd. オブジェクト間の最小の差で、
     ‘timedelta(microseconds=1)’ ですが, ‘time’ オブジェクト間の四則演算
     はサポートされていないので注意してください。

インスタンスの属性 (読み出しのみ):

 -- の属性: time.hour

     in ‘range(24)’ を満たします。

 -- の属性: time.minute

     in ‘range(60)’ を満たします。

 -- の属性: time.second

     in ‘range(60)’ を満たします。

 -- の属性: time.microsecond

     in ‘range(1000000)’ を満たします。

 -- の属性: time.tzinfo

     *note time: 1fd. コンストラクタに 'tzinfo' 引数として与えられたオブ
     ジェクトになり、何も渡されなかった場合には ‘None’ になります。

 -- の属性: time.fold

     ‘[0, 1]’ のどちらかです。 繰り返し期間中の実時間の曖昧さ除去に使わ
     れます。 (繰り返し期間は、夏時間の終わりに時計が巻き戻るときや、現
     在のゾーンの UTC オフセットが政治的な理由で減少するときに発生します
     。) 0または1という値は、同じ実時間で表現される 2 つの時刻のうちのそ
     れぞれ早い方または遅い方を表します。

     Added in version 3.6.

*note time: 1fd. 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: 199.

比較対象が両方とも aware であり、同じ *note tzinfo: 291c. 属性を持つ場合
、 ‘tzinfo’ と ‘fold’ 属性は無視され時間だけで比較が行われます。比較対象
が両方とも aware であり、異なる ‘tzinfo’ 属性を持つ場合、まず最初に
(‘self.utcoffset()’ で取得できる) それぞれの UTC オフセットを引く調整が
行われます。

バージョン 3.3 で変更: aware な インスタンスと naive な *note time: 1fd.
インスタンスの等価比較では *note TypeError: 199. は送出されません。

ブール値の文脈では、 *note time: 1fd. オブジェクトは常に真とみなされます
。

バージョン 3.5 で変更: Before Python 3.5, a *note time: 1fd. 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: 1fd. を返します :

       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. 少数の時と分はサポートされていません。

     例:

          >>> import datetime as dt
          >>> dt.time.fromisoformat('04:23:01')
          datetime.time(4, 23, 1)
          >>> dt.time.fromisoformat('T04:23:01')
          datetime.time(4, 23, 1)
          >>> dt.time.fromisoformat('T042301')
          datetime.time(4, 23, 1)
          >>> dt.time.fromisoformat('04:23:01.000384')
          datetime.time(4, 23, 1, 384)
          >>> dt.time.fromisoformat('04:23:01,000384')
          datetime.time(4, 23, 1, 384)
          >>> dt.time.fromisoformat('04:23:01+04:00')
          datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))
          >>> dt.time.fromisoformat('04:23:01Z')
          datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)
          >>> dt.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(): 295b.

 -- メソッド: classmethod time.strptime (date_string, format)

     Return a *note time: 1fd. corresponding to 'date_string', parsed
     according to 'format'.

     'format' がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価
     です:

          time(*(time.strptime(date_string, format)[3:6]))

     *note ValueError: 2ee. is raised if the 'date_string' and 'format'
     cannot be parsed by ‘time.strptime()’ or if it returns a value
     which is not a time tuple.  See also *note strftime() and
     strptime() behavior: 1bb3. 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: 1fd. with the same values, but with
     specified parameters updated.  Note that ‘tzinfo=None’ can be
     specified to create a naive ‘time’ from an aware ‘time’, without
     conversion of the time data.

     *note time: 1fd. オブジェクトは汎用的な関数 *note copy.replace():
     1c2. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: time.isoformat (timespec='auto')

     時刻を ISO 8601 書式で表した次の文字列のうち1つを返します:

        - *note microsecond: 291b. が 0 でない場合は ‘HH:MM:SS.ffffff’

        - *note microsecond: 291b. が 0 の場合は ‘HH:MM:SS’

        - *note utcoffset(): 295c. が ‘None’ を返さない場合、
          ‘HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 291b. が 0 で *note utcoffset(): 295c. が
          ‘None’ を返さない場合、 ‘HH:MM:SS+HH:MM[:SS[.ffffff]]’

     オプション引数 'timespec' は、含める追加の時間の要素の数を指定しま
     す(デフォルトでは ‘'auto'’ です)。以下の内一つを指定してください。

        - ‘'auto'’: *note microsecond: 291b. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 2918. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 2918. および *note minute: 2919. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 2918. 、 *note minute: 2919. 、 *note
          second: 291a. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 2ee. があげられます。

     以下はプログラム例です:

          >>> import datetime as dt
          >>> dt.time(hour=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes')
          '12:34'
          >>> my_time = dt.time(hour=12, minute=34, second=56, microsecond=0)
          >>> my_time.isoformat(timespec='microseconds')
          '12:34:56.000000'
          >>> my_time.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: 1bb3. および *note
     time.isoformat(): 295b. も参照してください。

 -- メソッド: time.__format__ (format)

     *note time.strftime(): 1776. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19b. の中や *note str.format():
     833. を使っているときに *note time: 1fd. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1bb3. およ
     び *note time.isoformat(): 295b. も参照してください。

 -- メソッド: time.utcoffset ()

     *note tzinfo: 291c. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(None)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: bc7. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.dst ()

     *note tzinfo: 291c. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(None)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: bc7. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.tzname ()

     *note tzinfo: 291c. が ‘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.9.1.13 Examples of usage: ‘time’
..................................

*note time: 1fd. オブジェクトを使う例:

     >>> import datetime as dt
     >>> class TZ1(dt.tzinfo):
     ...     def utcoffset(self, when):
     ...         return dt.timedelta(hours=1)
     ...     def dst(self, when):
     ...         return dt.timedelta(0)
     ...     def tzname(self, when):
     ...         return "+01:00"
     ...     def  __repr__(self):
     ...         return f"{self.__class__.__name__}()"
     ...
     >>> t = dt.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.9.1.14 ‘tzinfo’ objects
.........................

 -- クラス: datetime.tzinfo

     This is an *note abstract base class: 13d2, meaning that this class
     should not be instantiated directly.  Define a subclass of *note
     tzinfo: 7f6. to capture information about a particular time zone.

     An instance of (a concrete subclass of) *note tzinfo: 7f6. can be
     passed to the constructors for *note datetime: 4e2. and *note time:
     1fd. objects.  The latter objects view their attributes as being in
     local time, and the ‘tzinfo’ object supports methods revealing
     offset of local time from UTC, the name of the time zone, and DST
     offset, all relative to a date or time object passed to them.

     You need to derive a concrete subclass, and (at least) supply
     implementations of the standard *note tzinfo: 7f6. methods needed
     by the *note datetime: 4e2. methods you use.  The ‘datetime’ module
     provides *note timezone: 12d9, a simple concrete subclass of
     ‘tzinfo’ which can represent time zones with fixed offset from UTC
     such as UTC itself or North American EST and EDT.

     pickle 化についての特殊な要求事項: *note tzinfo: 7f6. のサブクラス
     は引数なしで呼び出すことのできる *note __init__(): 8c0. メソッドを
     持たなければなりません。そうでなければ、 pickle 化することはできま
     すがおそらく unpickle 化することはできないでしょう。これは技術的な
     側面からの要求であり、将来緩和されるかもしれません。

     *note tzinfo: 7f6. の具体的なサブクラスでは、以下のメソッドを実装す
     る必要があります。厳密にどのメソッドが必要なのかは、 aware な
     ‘datetime’ オブジェクトがこのサブクラスのインスタンスをどのように使
     うかに依存します。不確かならば、単に全てを実装してください。

 -- メソッド: tzinfo.utcoffset (dt)

     ローカル時間の UTC からのオフセットを、 UTC から東向きを正とした
     *note timedelta: bc7. オブジェクトで返します。ローカル時間が UTC の
     西側にある場合、この値は負になります。

     このメソッドは UTC からのオフセットの '総計' を表しています。例えば
     、 *note tzinfo: 7f6. オブジェクトがタイムゾーンと DST 修正の両方を
     表現する場合、 *note utcoffset(): 2964. はそれらの合計を返さなけれ
     ばなりません。 UTC オフセットが未知である場合、 ‘None’ を返します。
     そうでない場合には、返される値は ‘-timedelta(hours=24)’ から
     ‘timedelta(hours=24)’ までの *note timedelta: bc7. 境界を含まないオ
     ブジェクトでなければなりません (オフセットの大きさは 1 日より短くな
     ければなりません)。 ほとんどの ‘utcoffset()’ 実装は、おそらく以下の
     二つのうちの一つに似たものになるでしょう:

          return CONSTANT                 # fixed-offset class
          return CONSTANT + self.dst(dt)  # daylight-aware class

     *note utcoffset(): 2964. が ‘None’ を返さない場合、 *note dst():
     2965. も ‘None’ を返してはなりません。

     *note utcoffset(): 2964. のデフォルトの実装は *note
     NotImplementedError: 369. を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.dst (dt)

     夏時間 (DST) 修正を、 *note timedelta: bc7. オブジェクトで返します
     。 DST 情報が未知の場合、 ‘None’ が返されます。

     DST が有効でない場合には ‘timedelta(0)’ を返します。 DST が有効の場
     合、オフセットは *note timedelta: bc7. オブジェクトで返します (詳細
     は *note utcoffset(): 2964. を参照してください)。 DST オフセットが
     利用可能な場合、この値は ‘utcoffset()’ が返す UTC からのオフセット
     には既に加算されているため、 DST を個別に取得する必要がない限り
     *note dst(): 2965. を使って問い合わせる必要はないので注意してくださ
     い。 例えば、 *note datetime.timetuple(): 294c. は *note tzinfo:
     2924. 属性の ‘dst()’ メソッドを呼んで *note tm_isdst: 294d. フラグ
     がセットされているかどうか判断し、 *note tzinfo.fromutc(): 294a. は
     ‘dst()’ タイムゾーンを移動する際に DST による変更があるかどうかを調
     べます。

     標準および夏時間の両方をモデル化している *note tzinfo: 7f6. サブク
     ラスのインスタンス 'tz' は以下の式:

     ‘tz.utcoffset(dt) - tz.dst(dt)’

     must return the same result for every *note datetime: 4e2. 'dt'
     with ‘dt.tzinfo == tz’.  For sane ‘tzinfo’ subclasses, this
     expression yields the time zone's "standard offset", which should
     not depend on the date or the time, but only on geographic
     location.  The implementation of *note datetime.astimezone(): bc8.
     relies on this, but cannot detect violations; it's the programmer's
     responsibility to ensure it.  If a ‘tzinfo’ subclass cannot
     guarantee this, it may be able to override the default
     implementation of *note tzinfo.fromutc(): 294a. to work correctly
     with ‘astimezone()’ regardless.

     ほとんどの *note dst(): 2965. 実装は、おそらく以下の二つのうちの一
     つに似たものになるでしょう:

          import datetime as dt

          def dst(self, when):
              # a fixed-offset class:  doesn't account for DST
              return dt.timedelta(0)

     もしくは:

          import datetime as dt

          def dst(self, when):
              # Code to set dston and dstoff to the time zone's DST
              # transition times based on the input when.year, and expressed
              # in standard local time.

              if dston <= when.replace(tzinfo=None) < dstoff:
                  return dt.timedelta(hours=1)
              else:
                  return dt.timedelta(0)

     デフォルトの *note dst(): 2965. 実装は *note NotImplementedError:
     369. を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.tzname (dt)

     Return the time zone name corresponding to the *note datetime: 4e2.
     object 'dt', as a string.  Nothing about string names is defined by
     the ‘datetime’ module, and there's no requirement that it mean
     anything in particular.  For example, ‘"GMT"’, ‘"UTC"’, ‘"-500"’,
     ‘"-5:00"’, ‘"EDT"’, ‘"US/Eastern"’, ‘"America/New York"’ are all
     valid replies.  Return ‘None’ if a string name isn't known.  Note
     that this is a method rather than a fixed string primarily because
     some *note tzinfo: 7f6. subclasses will wish to return different
     names depending on the specific value of 'dt' passed, especially if
     the ‘tzinfo’ class is accounting for daylight time.

     デフォルトの *note tzname(): 2966. 実装は *note
     NotImplementedError: 369. を送出します。

These methods are called by a *note datetime: 4e2. or *note time: 1fd.
object, in response to their methods of the same names.  A ‘datetime’
object passes itself as the argument, and a ‘time’ object passes ‘None’
as the argument.  A *note tzinfo: 7f6. subclass's methods should
therefore be prepared to accept a 'dt' argument of ‘None’, or of class
‘datetime’.

‘None’ が渡された場合、最良の応答方法を決めるのはクラス設計者次第です。
例えば、このクラスが *note tzinfo: 7f6. プロトコルと関係をもたないという
ことを表明させたければ、 ‘None’ が適切です。標準時のオフセットを見つける
他の手段がない場合には、標準 UTC オフセットを返すために
‘utcoffset(None)’ を使うともっと便利かもしれません。

When a *note datetime: 4e2. object is passed in response to a ‘datetime’
method, ‘dt.tzinfo’ is the same object as 'self'.  *note tzinfo: 7f6.
methods can rely on this, unless user code calls ‘tzinfo’ methods
directly.  The intent is that the ‘tzinfo’ methods interpret 'dt' as
being in local time, and not need worry about objects in other time
zones.

サブクラスでオーバーライドすると良い、もう 1 つの *note tzinfo: 7f6. の
メソッドがあります:

 -- メソッド: tzinfo.fromutc (dt)

     デフォルトの 実装で呼び出されます。 *note datetime.astimezone():
     bc8. から呼ばれた場合、 ‘dt.tzinfo’ は 'self' であり、 'dt' の日付
     および時刻データは UTC 時刻を表しているものとして見えます。 *note
     fromutc(): 294a. の目的は、 'self' のローカル時刻に等しい *note
     datetime: 34. オブジェクトを返すことにより日付と時刻データメンバを
     修正することにあります。

     ほとんどの *note tzinfo: 7f6. サブクラスではデフォルトの *note
     fromutc(): 294a. 実装を問題なく継承できます。デフォルトの実装は、固
     定オフセットのタイムゾーンや、標準時と夏時間の両方について記述して
     いるタイムゾーン、そして DST 移行時刻が年によって異なる場合でさえ、
     扱えるくらい強力なものです。デフォルトの ‘fromutc()’ 実装が全ての場
     合に対して正しく扱うことができないような例は、標準時の (UTCからの)
     オフセットが引数として渡された特定の日や時刻に依存するもので、これ
     は政治的な理由によって起きることがあります。デフォルトの *note
     astimezone(): bc8. や ‘fromutc()’ の実装は、結果が標準時オフセット
     の変化にまたがる何時間かの中にある場合、期待通りの結果を生成しない
     かもしれません。

     エラーの場合のためのコードを除き、デフォルトの *note fromutc():
     294a. の実装は以下のように動作します:

          import datetime as dt

          def fromutc(self, when):
              # raise ValueError error if when.tzinfo is not self
              dtoff = when.utcoffset()
              dtdst = when.dst()
              # raise ValueError if dtoff is None or dtdst is None
              delta = dtoff - dtdst  # this is self's standard offset
              if delta:
                  when += delta   # convert to standard local time
                  dtdst = when.dst()
                  # raise ValueError if dtdst is None
              if dtdst:
                  return when + dtdst
              else:
                  return when

次の ‘tzinfo_examples.py’ ファイルには、 *note tzinfo: 7f6. クラスの例が
いくつか載っています:

     import datetime as dt

     # 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

     ZERO = dt.timedelta(0)
     HOUR = dt.timedelta(hours=1)
     SECOND = dt.timedelta(seconds=1)

     STDOFFSET = dt.timedelta(seconds=-time.timezone)
     if time.daylight:
         DSTOFFSET = dt.timedelta(seconds=-time.altzone)
     else:
         DSTOFFSET = STDOFFSET

     DSTDIFF = DSTOFFSET - STDOFFSET


     class LocalTimezone(dt.tzinfo):

         def fromutc(self, when):
             assert when.tzinfo is self
             stamp = (when - 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 dt.datetime(*args, microsecond=when.microsecond,
                                tzinfo=self, fold=fold)

         def utcoffset(self, when):
             if self._isdst(when):
                 return DSTOFFSET
             else:
                 return STDOFFSET

         def dst(self, when):
             if self._isdst(when):
                 return DSTDIFF
             else:
                 return ZERO

         def tzname(self, when):
             return time.tzname[self._isdst(when)]

         def _isdst(self, when):
             tt = (when.year, when.month, when.day,
                   when.hour, when.minute, when.second,
                   when.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(when):
         days_to_go = 6 - when.weekday()
         if days_to_go:
             when += dt.timedelta(days_to_go)
         return when


     # 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 = dt.datetime(1, 3, 8, 2)
     # and ends at 2am (DST time) on the first Sunday of Nov.
     DSTEND_2007 = dt.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 = dt.datetime(1, 4, 1, 2)
     DSTEND_1987_2006 = dt.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 = dt.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 (dt.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(dt.tzinfo):

         def __init__(self, hours, reprname, stdname, dstname):
             self.stdoffset = dt.timedelta(hours=hours)
             self.reprname = reprname
             self.stdname = stdname
             self.dstname = dstname

         def __repr__(self):
             return self.reprname

         def tzname(self, when):
             if self.dst(when):
                 return self.dstname
             else:
                 return self.stdname

         def utcoffset(self, when):
             return self.stdoffset + self.dst(when)

         def dst(self, when):
             if when is None or when.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 when.tzinfo is self.
                 return ZERO
             assert when.tzinfo is self
             start, end = us_dst_range(when.year)
             # Can't compare naive to aware objects, so strip the timezone from
             # when first.
             when = when.replace(tzinfo=None)
             if start + HOUR <= when < end - HOUR:
                 # DST is in effect.
                 return HOUR
             if end - HOUR <= when < end:
                 # Fold (an ambiguous hour): use when.fold to disambiguate.
                 return ZERO if when.fold else HOUR
             if start <= when < start + HOUR:
                 # Gap (a non-existent hour): reverse the fold rule.
                 return HOUR if when.fold else ZERO
             # DST is off.
             return ZERO

         def fromutc(self, when):
             assert when.tzinfo is self
             start, end = us_dst_range(when.year)
             start = start.replace(tzinfo=self)
             end = end.replace(tzinfo=self)
             std_time = when + 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 年の春方向の移行では、次のような結果になり
ます:

     >>> import datetime as dt
     >>> from tzinfo_examples import HOUR, Eastern
     >>> u0 = dt.datetime(2016, 3, 13, 5, tzinfo=dt.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(): bc8. は 2 つの隣り合う UTC 時間を同じローカルの時間に対応
付けて、ローカルの時計の振る舞いを真似ます。 東部の例では、 5:MM および
6:MM という形式の UTC 時刻は両方とも東部時刻に変換された際に 1:MM に対応
付けられますが、それ以前の時間は *note fold: e55. 属性を 0 にし、以降の
時間では 1 にします。例えば、 2016 年での秋方向の移行では、次のような結
果になります:

     >>> import datetime as dt
     >>> from tzinfo_examples import HOUR, Eastern
     >>> u0 = dt.datetime(2016, 11, 6, 4, tzinfo=dt.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: e55. 属性が異なるだけの *note datetime: 4e2. インスタンスは
比較において等しいとみなされることに注意してください。

Applications that can't bear wall-time ambiguities should explicitly
check the value of the *note fold: e55. attribute or avoid using hybrid
*note tzinfo: 7f6. subclasses; there are no ambiguities when using *note
timezone: 12d9, or any other fixed-offset ‘tzinfo’ subclass (such as a
class representing only EST (fixed offset -5 hours), or only EDT (fixed
offset -4 hours)).

参考
....

     *note zoneinfo: 13b.

          ‘datetime’ モジュールには (UTC からの任意の固定オフセットを扱
          う) 基本的な *note timezone: 12d9. クラスと、(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.9.1.15 ‘timezone’ objects
...........................

*note timezone: 12d9. クラスは *note tzinfo: 7f6. のサブクラスで、各イン
スタンスは UTC からの固定されたオフセットで定義されたタイムゾーンを表し
ています。

このクラスのオブジェクトは、一年のうち異なる日に異なるオフセットが使われ
ていたり、常用時 (civil time) に歴史的な変化が起きた場所のタイムゾーン情
報を表すのには使えないので注意してください。

 -- クラス: datetime.timezone (offset, name=None)

     ローカル時刻と UTC の差分を表す *note timedelta: bc7. オブジェクト
     を 'offset' 引数に指定しなくてはいけません。これは
     ‘-timedelta(hours=24)’ から ‘timedelta(hours=24)’ までの両端を含ま
     ない範囲に収まっていなくてはなりません。そうでない場合 *note
     ValueError: 2ee. が送出されます。

     'name' 引数は必須ではありません。もし指定された場合、その値は *note
     datetime.tzname(): 294b. メソッドの返り値として使われる文字列でなけ
     ればなりません。

     Added in version 3.2.

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.utcoffset (dt)

     *note timezone: 12d9. インスタンスが構築されたときに指定された固定
     値を返します。

     'dt' 引数は無視されます。 返り値は、ローカル時刻と UTC の差分に等し
     い *note timedelta: bc7. インスタンスです。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.tzname (dt)

     *note timezone: 12d9. インスタンスが構築されたときに指定された固定
     値を返します。

     '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.9.1.16 ‘strftime()’ and ‘strptime()’ behavior
...............................................

*note date: 1fc, *note datetime: 4e2, *note time: 1fd. オブジェクトは全
て ‘strftime(format)’ メソッドをサポートし、時刻を表現する文字列を明示的
な書式文字列で統制して作成しています。

Conversely, the *note date.strptime(): 1fb, *note datetime.strptime():
19b0. and *note time.strptime(): 164b. class methods create an object
from a string representing the time and a corresponding format string.

下の表は *note strftime(): e92. と *note strptime(): 19b0. との高レベル
の対比を表しています。

                     ‘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.9.1.17 ‘strftime()’ and ‘strptime()’ format codes
...................................................

These methods accept format codes that can be used to parse and format
dates:

     >>> import datetime as dt
     >>> dt.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'

The following is a list of all the format codes that the 1989 C standard
requires, and these work on all platforms with a standard C
implementation.

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%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)        
                                                     
                                                                                  
‘%%’            文字 ‘'%'’ を表します。              %
                                                     

Several additional directives not required by the C89 standard are
included for convenience.  These parameters all correspond to ISO 8601
date values.

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%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
                れば空文字列)。                      
                

These may not be available on all platforms when used with the *note
strftime(): e92. method.  The ISO 8601 year and ISO 8601 week directives
are not interchangeable with the year and week number directives above.
Calling *note strptime(): 19b0. with incomplete or ambiguous ISO 8601
directives will raise a *note ValueError: 2ee.

Python はプラットフォームの C ライブラリの ‘strftime()’ 関数を呼び出して
いて、プラットフォームごとにその実装が異なるのはよくあることなので、サポ
ートされる書式コード全体はプラットフォームごとに様々です。 手元のプラッ
トフォームでサポートされているフォーマット記号全体を見るには、
‘strftime(3)(1)’ のドキュメントを参照してください。 サポートされていない
フォーマット指定子の扱いもプラットフォーム間で差異があります。

Added in version 3.6: ‘%G’, ‘%u’ および ‘%V’ が追加されました。

Added in version 3.12: ‘%:z’ was added.

   ---------- 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.9.1.18 Technical detail
.........................

大雑把にいうと、 ‘d.strftime(fmt)’ は *note time: f4. モジュールの
‘time.strftime(fmt, d.timetuple())’ のように動作します。ただし全てのオブ
ジェクトが *note timetuple(): 2935. メソッドをサポートしているわけではあ
りません。

For the *note datetime.strptime(): 19b0. and *note date.strptime(): 1fb.
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(): 19b0. and *note date.strptime(): 1fb. 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.

     >>> import datetime as dt
     >>> value = "2/29"
     >>> dt.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
     >>> dt.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: 1fd. オブジェクトには、年、月、日の値がないため、それらを書
式コードを使うことができません。 無理矢理使った場合、年は1900に置き換え
られ、月と日は1に置き換えられます。

*note date: 1fc. オブジェクトには、時、分、秒、マイクロ秒の値がないため
、それらの書式コードを使うことができません。 無理矢理使った場合、これら
の値は0に置き換えられます。

同じ理由で、現在のロケールの文字集合で表現できない Unicode コードポイン
トを含む書式文字列の対処もプラットフォーム依存です。 あるプラットフォー
ムではそういったコードポイントはそのまま出力に出される一方、他のプラット
フォームでは ‘strftime’ が *note UnicodeError: 460. を送出したり、その代
わりに空文字列を返したりするかもしれません。

注釈:

  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(): 19b0. メソッドは [1, 9999] の範囲の年数全てを構文
     解析できますが、 year < 1000 の範囲の年数は 0 埋めされた 4 桁の数字
     でなければなりません。

     バージョン 3.2 で変更: 以前のバージョンでは、 *note strftime():
     e92. メソッドは years >= 1900 の範囲の年数しか扱えませんでした。

     バージョン 3.3 で変更: バージョン 3.2 では、 *note strftime(): e92.
     メソッドは years >= 1000 の範囲の年数しか扱えませんでした。

  3. *note strptime(): 19b0. メソッドと共に使われた場合、 ‘%p’ 指定子は
     出力の時間フィールドのみに影響し、 ‘%I’ 指定子が使われたかのように
     振る舞います。

  4. *note time: f4. モジュールと違い、 ‘datetime’ モジュールはうるう秒
     をサポートしていません。

  5. *note strptime(): 19b0. メソッドと共に使われた場合、 ‘%f’ 指定子は
     1 桁から 6 桁の数字を受け付け、右側から0埋めされます。 ‘%f’ は C 標
     準規格の書式文字セットの拡張です (とは言え、 datetime モジュールの
     オブジェクトそれぞれに実装されているので、どれででも使えます)。

  6. naive オブジェクトでは、書式コード ‘%z’、‘%:z’ および ‘%Z’ は空文字
     列に置き換えられます。

     aware オブジェクトでは次のようになります:

     ‘%z’

          *note utcoffset(): 2948. は ‘±HHMM[SS[.ffffff]]’ 形式の文字列
          に変換されます。ここで、 ‘HH’ は UTC オフセットの時間を表す 2
          桁の文字列、 ‘MM’ は UTC オフセットの分数を表す 2 桁の文字列、
          ‘SS’ は UTC オフセットの秒数を表す 2 桁の文字列、 ‘ffffff’ は
          UTC オフセットのマイクロ秒数を表す 6 桁の文字列です。 オフセッ
          トに秒未満の端数が無いときは ‘ffffff’ 部分は省略され、オフセッ
          トに分未満の端数が無いときは ‘ffffff’ 部分も ‘SS’ 部分も省略さ
          れます。 例えば、 ‘utcoffset()’ が ‘timedelta(hours=-3,
          minutes=-30)’ を返す場合、 ‘%z’ は文字列 ‘'-0330'’ に置き換え
          られます。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

     バージョン 3.7 で変更: When the ‘%z’ directive is provided to the
     *note strptime(): 19b0. method, the UTC offsets can have a colon as
     a separator between hours, minutes and seconds.  For example,
     ‘'+01:00:00'’ will be parsed as an offset of one hour.  In
     addition, providing ‘'Z'’ is identical to ‘'+00:00'’.

     ‘%:z’

          Behaves exactly as ‘%z’, but has a colon separator added
          between hours, minutes and seconds.

     ‘%Z’

          In *note strftime(): e92, ‘%Z’ is replaced by an empty string
          if *note tzname(): 294b. returns ‘None’; otherwise ‘%Z’ is
          replaced by the returned value, which must be a string.

          *note strptime(): 19b0. は ‘%Z’ に特定の値のみを受け入れます:

            1. 使用しているマシンのロケールによる ‘time.tzname’ の任意の
               値

            2. ハードコードされた値 ‘UTC’ または ‘GMT’

          つまり、日本に住んでいる場合は ‘JST’, ‘UTC’ と ‘GMT’ が有効な
          値であり、 ‘EST’ はおそらく無効な値となります。無効な値の場合
          は ‘ValueError’ を送出します。

     バージョン 3.2 で変更: ‘%z’ 指定子が *note strptime(): 19b0. メソッ
     ドに与えられた場合、 aware な *note datetime: 4e2. オブジェクトが作
     成されます。返り値の ‘tzinfo’ は *note timezone: 12d9. インスタンス
     になっています。

  7. *note strptime(): 19b0. メソッドと共に使われた場合、 ‘%U’ と ‘%W’ 指
     定子は、曜日と年(‘%Y’)が指定された場合の計算でのみ使われます。

  8. ‘%U’ および ‘%W’ と同様に、 ‘%V’ は曜日と ISO 年 (‘%G’) が *note
     strptime(): 19b0. の書式文字列の中で指定された場合に計算でのみ使わ
     れます。 ‘%G’ と ‘%Y’ は互いに完全な互換性を持たないことにも注意し
     てください。

  9. *note strptime(): 19b0. メソッドと共に使われるとき、書式 ‘%d’,
     ‘%m’, ‘%H’, ‘%I’, ‘%M’, ‘%S’, ‘%j’, ‘%U’, ‘%W’, ‘%V’ では先行ゼロは
     任意です。 書式 ‘%y’ では先行ゼロは必須です。

  10. When parsing a month and day using *note strptime(): 19b0, 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"
          >>> dt.datetime.strptime(f"{month_day};1984", "%m/%d;%Y")  # No leap year bug.
          datetime.datetime(1984, 2, 29, 0, 0)

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: *note
     strptime(): 19b0. calls using a format string containing a day of
     month without a year now emit a *note DeprecationWarning: 1a4.  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.9.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: ae0. クラスを使用するように設計されたデータ型 *note
     time: 1fd. と *note datetime: 4e2. を提供します。

tzdata(4) パッケージ

     CPythonコアデベロッパーによってメンテナンスされているファーストパー
     ティーのパッケージ。タイムゾーンデータを供給し、PyPIで配布されてい
     る。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

* 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.9.2.1 ‘ZoneInfo’ を使用する
.............................

*note ZoneInfo: ae0. は *note datetime.tzinfo: 7f6. 抽象基底クラスの具体
的な実装であり、‘tzinfo’ に指定することを想定しています。コンストラクタ
、*note datetime.replace: 16e9. メソッド、*note datetime.astimezone:
bc8. メソッドのいずれかで指定します。

     >>> from zoneinfo import ZoneInfo
     >>> import datetime as dt

     >>> when = dt.datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(when)
     2020-10-31 12:00:00-07:00

     >>> when.tzname()
     'PDT'

Datetimes constructed in this way are compatible with datetime
arithmetic and handle daylight saving time transitions with no further
intervention:

     >>> when_add = when + dt.timedelta(days=1)

     >>> print(when_add)
     2020-11-01 12:00:00-08:00

     >>> when_add.tzname()
     'PST'

These time zones also support the *note fold: e55. 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:

     >>> when = dt.datetime(2020, 11, 1, 1, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(when)
     2020-11-01 01:00:00-07:00

     >>> print(when.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:

     >>> LOS_ANGELES = ZoneInfo("America/Los_Angeles")
     >>> when_utc = dt.datetime(2020, 11, 1, 8, tzinfo=dt.timezone.utc)

     >>> # Before the PDT -> PST transition
     >>> print(when_utc.astimezone(LOS_ANGELES))
     2020-11-01 01:00:00-07:00

     >>> # After the PDT -> PST transition
     >>> print((when_utc + dt.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.9.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: ae0. will raise *note ZoneInfoNotFoundError: 187c.

* Menu:

* Configuring the data sources::

   ---------- Footnotes ----------

   (1) https://pypi.org/project/tzdata/


File: python.info,  Node: Configuring the data sources,  Up: データソース

5.9.2.3 Configuring the data sources
....................................

When ‘ZoneInfo(key)’ is called, the constructor first searches the
directories specified in *note TZPATH: 21c0. 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: 21c0. when not otherwise specified can be
     configured at *note compile time: 21c1.

  2. *note TZPATH: 21c0. can be configured using *note an environment
     variable: 2977.

  3. At *note runtime: 2978, the search path can be manipulated using
     the *note reset_tzpath(): 182b. 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.9.2.4 Compile-time configuration
..................................

The default *note TZPATH: 21c0. 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: 21bf.), which should be a
string delimited by *note os.pathsep: 218f.

On all platforms, the configured value is available as the ‘TZPATH’ key
in *note sysconfig.get_config_var(): 175.


File: python.info,  Node: Environment configuration,  Next: Runtime configuration,  Prev: Compile-time configuration,  Up: Configuring the data sources

5.9.2.5 Environment configuration
.................................

When initializing *note TZPATH: 21c0. (either at import time or whenever
*note reset_tzpath(): 182b. 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: 218f.-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: 297c, 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.9.2.6 Runtime configuration
.............................

The TZ search path can also be configured at runtime using the *note
reset_tzpath(): 182b. 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.9.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(): 17d6, 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: 2ee. if a non-conforming key is passed.

     ‘key’ に一致するファイルが見つからない場合、コンストラクタは *note
     ZoneInfoNotFoundError: 187c. を送出します。

‘ZoneInfo’ クラスには2つの別のコンストラクターがあります:

 -- メソッド: classmethod ZoneInfo.from_file (file_obj, /, key=None)

     file-like オブジェクトが返すbytes（バイナリーモードで開いたファイル
     や *note io.BytesIO: 10a8. オブジェクト）から ‘ZoneInfo’ オブジェク
     トを構築します。一次コンストラクタと異なり、常に新規オブジェクトを
     構築します。

     The ‘key’ parameter sets the name of the zone for the purposes of
     *note __str__(): 830. and *note __repr__(): 82f.

     このコンストラクタで生成したオブジェクトはpickle化できません（*note
     pickling: 297f. を参照）。

     *note ValueError: 2ee. 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: 2982. 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.9.2.8 文字列表現
..................

The string representation returned when calling *note str: 16a. on a
*note ZoneInfo: ae0. object defaults to using the *note ZoneInfo.key:
2981. attribute (see the note on usage in the attribute documentation):

     >>> zone = ZoneInfo("Pacific/Kwajalein")
     >>> str(zone)
     'Pacific/Kwajalein'

     >>> when = dt.datetime(2020, 4, 1, 3, 15, tzinfo=zone)
     >>> f"{when.isoformat()} [{when.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(): 1c3.  ‘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.9.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.9.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: 2981.

 -- の関数: zoneinfo.reset_tzpath (to=None)

     Sets or resets the time zone search path (*note TZPATH: 21c0.) for
     the module.  When called with no arguments, ‘TZPATH’ is set to the
     default value.

     Calling ‘reset_tzpath’ will not invalidate the *note ZoneInfo: ae0.
     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: e4f. and not a string, all of which must be
     absolute paths.  *note ValueError: 2ee. will be raised if something
     other than an absolute path is passed.


File: python.info,  Node: Globals,  Next: 例外と警告,  Prev: 関数<3>,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.9.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(): 182b, 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: 2976.


File: python.info,  Node: 例外と警告,  Prev: Globals,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.9.2.12 例外と警告
...................

 -- 例外: zoneinfo.ZoneInfoNotFoundError

     Raised when construction of a *note ZoneInfo: ae0. 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: 297b. 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.9.3 ‘calendar’ -- 一般的なカレンダーに関係する機能群
------------------------------------------------------

'ソースコード:' Lib/calendar.py(1)

__________________________________________________________________

このモジュールは Unix の ‘cal’ プログラムのようなカレンダー出力を行い、
それに加えてカレンダーに関する有益な関数群を提供します。標準ではこれらの
カレンダーは（ヨーロッパの慣例に従って）月曜日を週の始まりとし、日曜日を
最後の日としています。 *note setfirstweekday(): 298b. を用いることで、日
曜日(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: 298c. オブジェクトを作ります。 'firstweekday' は整
     数で週の始まりの曜日を指定するものです。*note MONDAY: 298d. が ‘0’
     (デフォルト)、*note SUNDAY: 298e. なら ‘6’ です。

     *note Calendar: 298c. オブジェクトは整形されるカレンダーのデータを
     準備するために使えるいくつかのメソッドを提供しています。しかし整形
     機能そのものは提供していません。それはサブクラスの仕事なのです。

     *note Calendar: 298c. 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(): 2990. and *note getfirstweekday(): 2991.
          respectively.

      -- メソッド: getfirstweekday ()

          Return an *note int: 19c. for the current first weekday (0-6).

          Identical to reading the *note firstweekday: 298f. property.

      -- メソッド: setfirstweekday (firstweekday)

          Set the first weekday to 'firstweekday', passed as an *note
          int: 19c. (0-6).

          Identical to setting the *note firstweekday: 298f. property.

      -- メソッド: iterweekdays ()

          Return an iterator for the weekday 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: 298f. property.

      -- メソッド: itermonthdates (year, month)

          'year' 年 'month' (1-12) 月に対するイテレータを返します。 この
          イテレータはその月の全ての日、およびその月が始まる前の日とその
          月が終わった後の日のうち、週の欠けを埋めるために必要な日を
          (*note datetime.date: 1fc. オブジェクトとして) 返します。

      -- メソッド: itermonthdays (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e17, but not restricted by
          the *note datetime.date: 1fc. 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(): e17, but not restricted by
          the *note datetime.date: 1fc. range.  Days returned will be
          tuples consisting of a day of the month number and a weekday
          number.

      -- メソッド: itermonthdays3 (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e17, but not restricted by
          the *note datetime.date: 1fc. 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(): e17, but not restricted by
          the *note datetime.date: 1fc. 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: 1fc. オブジェクトからなるリストです。

      -- メソッド: monthdays2calendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字と曜日を表す数字のタプルからなるリストです。

      -- メソッド: monthdayscalendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字からなるリストです。

      -- メソッド: yeardatescalendar (year, width=3)

          指定された年のデータを整形に向く形で返します。返される値は月の
          並びのリストです。月の並びは最大で 'width' ヶ月(デフォルトは
          3ヶ月)分です。各月は4ないし6週からなり、各週は1ないし7日からな
          ります。各日は *note datetime.date: 1fc. オブジェクトです。

      -- メソッド: yeardays2calendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2998. と同様です)。週のリストの中が日付の
          数字と曜日の数字のタプルになります。月の範囲外の部分の日付はゼ
          ロです。

      -- メソッド: yeardayscalendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2998. と同様です)。週のリストの中が日付の
          数字になります。月の範囲外の日付はゼロです。

 -- クラス: calendar.TextCalendar (firstweekday=0)

     このクラスはプレインテキストのカレンダーを生成するのに使えます。

     *note TextCalendar: 190d. インスタンスには以下のメソッドがあります:

      -- メソッド: 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(): 298b.
          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(): 298b. メソッドでセットされた週の最初の曜日
          に依存します。

      -- メソッド: 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(): 299f. で返されるひと月分のカレンダーを出
          力します。

      -- メソッド: formatyear (theyear, w=2, l=1, c=6, m=3)

          'm' 列からなる一年間のカレンダーを複数行の文字列で返します。任
          意の引数 'w', 'l', 'c' はそれぞれ、日付列の表示幅、各週の行数
          及び月と月の間のスペースの数を変更するためのものです。 *note
          setfirstweekday(): 298b. メソッドでセットされた週の最初の曜日
          に依存します。カレンダーを出力できる最初の年はプラットフォーム
          に依存します。

      -- メソッド: pryear (theyear, w=2, l=1, c=6, m=3)

          *note formatyear(): 29a2. で返される一年間のカレンダーを出力し
          ます。

 -- クラス: 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)

          Return a year's calendar as a complete HTML page.  'width'
          (defaulting to 3) specifies the number of months per row.
          'css' is the name for the cascading style sheet to be used.
          *note None: 886. can be passed if no style sheet should be
          used.  'encoding' specifies the encoding to be used for the
          output (defaulting to the system default 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: 29a8.

          Added in version 3.7.

      -- の属性: cssclass_month_head

          The month's head CSS class (used by *note formatmonthname():
          29a7.).  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(): 29a4.).  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(): 29a5.).  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(): 29a5.).  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: 190d. 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: d1c. 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: 298d, *note TUESDAY: 29af, *note WEDNESDAY: 29b0, *note
     THURSDAY: 29b1, *note FRIDAY: 29b2, *note SATURDAY: 29b3. 及び
     *note SUNDAY: 298e. は便宜上提供されています。例えば、日曜日を週の
     開始日に設定するときは:

          import calendar
          calendar.setfirstweekday(calendar.SUNDAY)

 -- の関数: calendar.firstweekday ()

     現在設定されている週の最初の曜日を返します。

 -- の関数: calendar.isleap (year)

     'year' が閏年なら *note True: e0b. を、そうでなければ *note False:
     d2f. を返します。

 -- の関数: 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)

     Returns weekday of first day of the month and number of days in
     month, for the specified 'year' and 'month'.

 -- の関数: calendar.monthcalendar (year, month)

     月のカレンダーを行列で返します。各行が週を表し、月の範囲外の日は0に
     なります。それぞれの週は *note setfirstweekday(): 298b. で設定をし
     ていない限り月曜日から始まります。

 -- の関数: calendar.prmonth (theyear, themonth, w=0, l=0)

     *note month(): 196b. 関数によって返される月のカレンダーを出力します
     。

 -- の関数: calendar.month (theyear, themonth, w=0, l=0)

     Returns a month's calendar in a multi-line string using the *note
     formatmonth(): 299f. of the *note TextCalendar: 190d. 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(): 29a2. of the *note
     TextCalendar: 190d. class.

 -- の関数: calendar.timegm (tuple)

     An unrelated but handy function that takes a time tuple such as
     returned by the *note gmtime(): 13dc. function in the *note time:
     f4. module, and returns the corresponding Unix timestamp value,
     assuming an epoch of 1970, and the POSIX encoding.  In fact,
     ‘time.gmtime()’ and ‘timegm()’ are each other's inverse.

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: 298d. through *note SUNDAY: 298e.

     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: 34c. through *note DECEMBER: 29cc.

     Added in version 3.12.

The ‘calendar’ module defines the following exceptions:

 -- 例外: calendar.IllegalMonthError (month)

     A subclass of *note ValueError: 2ee. and *note IndexError: 1753,
     raised when the given month number is outside of the range 1-12
     (inclusive).

     バージョン 3.12 で変更: ‘IllegalMonthError’ is now also a subclass
     of *note ValueError: 2ee.  New code should avoid catching *note
     IndexError: 1753.

      -- の属性: month

          The invalid month number.

 -- 例外: calendar.IllegalWeekdayError (weekday)

     A subclass of *note ValueError: 2ee, 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.9.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: 29d5. is required
     if *note -locale: 29d3. 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: 29db. 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: 1b9.

'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.9.4 ‘collections’ -- コンテナデータ型
---------------------------------------

'ソースコード:' Lib/collections/__init__.py(1)

__________________________________________________________________

このモジュールは、汎用の Python 組み込みコンテナ *note dict: 184, *note
list: 24f, *note set: 185, および *note tuple: 614. に代わる、特殊なコン
テナデータ型を実装しています。

*note namedtuple(): 4e0.  名前付きフィールドを持つタプルのサブクラスを作成するファクトリ関数
                          
                          
*note deque: 7f4.         両端における append や pop を高速に行えるリスト風のコンテナ
                          
                          
*note ChainMap: e1a.      複数のマッピングの一つのビューを作成する辞書風のクラス
                          
                          
*note Counter: 12a7.      *note ハッシュ可能: 824. なオブジェクトを数え上げる辞書のサブクラス
                          
                          
*note OrderedDict: 7f3.   項目が追加された順序を記憶する辞書のサブクラス
                          
                          
*note defaultdict: 13d8.  ファクトリ関数を呼び出して存在しない値を供給する辞書のサブクラス
                          
                          
*note UserDict: 1ddb.     辞書のサブクラス化を簡単にする辞書オブジェクトのラッパ
                          
                          
*note UserList: 1702.     リストのサブクラス化を簡単にするリストオブジェクトのラッパ
                          
                          
*note UserString: fd7.    文字列のサブクラス化を簡単にする文字列オブジェクトのラッパ
                          

* 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.9.4.1 ‘ChainMap’ オブジェクト
...............................

Added in version 3.3.

*note ChainMap: e1a. クラスは、複数のマッピングを素早く連結し、一つの単
位として扱うために提供されています。これはたいてい、新しい辞書を作成して
*note update(): 1683. を繰り返すよりも早いです。

このクラスはネストされたスコープをシミュレートするのに使え、テンプレート
化に便利です。

 -- クラス: collections.ChainMap (*maps)

     *note ChainMap: e1a. は、複数の辞書やその他のマッピングをまとめて、
     一つの、更新可能なビューを作成します。 'maps' が指定されないなら、
     一つの空辞書が与えられますから、新しいチェーンは必ず一つ以上のマッ
     ピングをもちます。

     根底のマッピングはリストに保存されます。このリストはパブリックで、
     'maps' 属性を使ってアクセスや更新できます。それ以外に状態はありませ
     ん。

     探索は、根底のマッピングをキーが見つかるまで引き続き探します。対し
     て、書き込み、更新、削除は、最初のマッピングのみ操作します。

     *note ChainMap: e1a. は、根底のマッピングを参照によって組み込みます
     。ですから、根底のマッピングの一つが更新されると、その変更は
     ‘ChainMap’ に反映されます。

     通常の辞書のメソッドすべてがサポートされています。さらに、'maps' 属
     性、新しいサブコンテキストを作成するメソッド、最初のマッピング以外
     のすべてにアクセスするためのプロパティがあります:

      -- の属性: maps

          マッピングのユーザがアップデートできるリストです。このリストは
          最初に探されるものから最後に探されるものの順に並んでいます。こ
          れが唯一のソートされた状態であり、変更してマッピングが探される
          順番を変更できます。このリストは常に一つ以上のマッピングを含ん
          でいなければなりません。

      -- メソッド: new_child (m=None, **kwargs)

          新しいマッピングに現在のインスタンスが持つ全てのマッピングを追
          加したものを持つ新しい *note ChainMap: e1a. インスタンスを返し
          ます。 ‘m’ が指定された場合、新しいマッピングのリストの先頭部
          分になります; 指定されない場合は空の辞書が使われます。すなわち
          ‘d.new_child()’ は ‘ChainMap({}, *d.maps)’ と等価になります。
          キーワード引数が指定された場合、それらによって指定されたマッピ
          ングまたは空の辞書が更新されます。このメソッドは、元のマッピン
          グに変更を加えることなく値を更新できるサブコンテキストを生成す
          るのに使われます。

          バージョン 3.4 で変更: オプションの ‘m’ 引数が追加されました。

          バージョン 3.10 で変更: キーワード引数のサポートが追加されまし
          た。

      -- の属性: parents

          現在のインスタンスの最初のマッピング以外のすべてのマッピングを
          含む新しい *note ChainMap: e1a. を返すプロパティです。これは最
          初のマッピングを検索から飛ばすのに便利です。使用例は *note
          nonlocal: 14c3. キーワードを *note ネストされたスコープ: 23ed.
          に使う例と似ています。この使用例はまた、組み込み *note
          super(): 1a7. 関数にも似ています。 ‘d.parents’ への参照は
          ‘ChainMap(*d.maps[1:])’ と等価です。

     *note ChainMap: e1a. の反復順序は、マッピングを最後から最初へスキャ
     ンして決定されることに注意してください。

          >>> baseline = {'music': 'bach', 'art': 'rembrandt'}
          >>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}
          >>> list(ChainMap(adjustments, baseline))
          ['music', 'art', 'opera']

     これは、末尾のマッピングオブジェクトから始めた一連の *note
     dict.update(): 1683. の呼び出しと同じ順序になります。

          >>> 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(): 112a. メソッドや *note
     parents: 29ec. プロパティに似た 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.9.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: e1a. を使ってネストされたコンテキストをシミュレートする
パターンの例:

     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: e1a. クラスは、探索はチェーン全体に対して行いますが、更
新 (書き込みと削除) は最初のマッピングに対してのみ行います。しかし、深い
書き込みと削除を望むなら、チェーンの深いところで見つかったキーを更新する
サブクラスを簡単に作れます:

     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.9.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 (**kwargs)

 -- クラス: collections.Counter (iterable, /, **kwargs)

 -- クラス: collections.Counter (mapping, /, **kwargs)

     *note Counter: 12a7. は *note ハッシュ可能: 824. なオブジェクトをカ
     ウントする *note dict: 184. のサブクラスです。これは、要素を辞書の
     キーとして保存し、そのカウントを辞書の値として保存するコレクション
     です。カウントは、0 や負のカウントを含む整数値をとれます。
     ‘Counter’ クラスは、他の言語のバッグや多重集合のようなものです。

     要素は、 '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: 12a7. は *note dict: 184. の
     サブクラスとして要素の挿入順を維持する機能を継承しました。
     'Counter' オブジェクトに対する数学演算も順序を維持します。結果の順
     序はまず左の被演算子における要素の出現順に従い、その後右の被演算子
     において要素が出現する順序になります。

     カウンタオブジェクトは全ての辞書で利用できるメソッドに加えて、以下
     に示す追加のメソッドをサポートしています。

      -- メソッド: elements ()

          それぞれの要素を、そのカウント分の回数だけ繰り返すイテレータを
          返します。要素は挿入した順番で返されます。ある要素のカウントが
          1 未満なら、 *note elements(): 151f. はそれを無視します。

               >>> c = Counter(a=4, b=2, c=0, d=-2)
               >>> sorted(c.elements())
               ['a', 'a', 'a', 'a', 'b', 'b']

      -- メソッド: most_common (n=None)

          最も多い 'n' 要素を、カウントが多いものから少ないものまで順に
          並べたリストを返します。 'n' が省略されるか ‘None’ であれば、
          *note most_common(): 151e. はカウンタの 'すべての' 要素を返し
          ます。等しいカウントの要素は挿入順に並べられます:

               >>> Counter('abracadabra').most_common(3)
               [('a', 5), ('b', 2), ('r', 2)]

      -- メソッド: subtract (**kwargs)

      -- メソッド: subtract (iterable, /, **kwargs)

      -- メソッド: subtract (mapping, /, **kwargs)

          要素から 'iterable' の要素または 'mapping' の要素が引かれます
          。 *note dict.update(): 1683. に似ていますが、カウントを置き換
          えるのではなく引きます。入力も出力も、 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.

     The usual dictionary methods are available for *note Counter: 12a7.
     objects except for two which work differently for counters.

      -- メソッド: fromkeys (iterable)

          このクラスメソッドは *note Counter: 12a7. オブジェクトには実装
          されていません。

      -- メソッド: update (**kwargs)

      -- メソッド: update (iterable, /, **kwargs)

      -- メソッド: update (mapping, /, **kwargs)

          要素が 'iterable' からカウントされるか、別の 'mapping' (やカウ
          ンタ) が追加されます。 *note dict.update(): 1683. に似ています
          が、カウントを置き換えるのではなく追加します。また、
          '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: 12a7. オブジェクトを使ったよくあるパターン:

     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

Several mathematical operations are provided for combining *note
Counter: 12a7. objects to produce multisets (counters that have counts
greater than zero).  Addition and subtraction combine counters by adding
or subtracting the counts of corresponding elements.  Intersection and
union return the minimum and maximum of corresponding counts.  Equality
and inclusion compare corresponding counts.  Each operation can accept
inputs with signed counts, but the output will exclude results with
counts of zero or less.

     >>> 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: 12a7. クラス自体は辞書のサブクラスで、キーと値
          に制限はありません。値はカウントを表す数であることを意図してい
          ますが、値フィールドに任意のものを保存 'できます' 。

        * *note most_common(): 151e. メソッドが要求するのは、値が順序付
          け可能なことだけです。

        * ‘c[key] += 1’ のようなインプレース演算では、値の型に必要なのは
          足し算と引き算ができることだけです。よって分数、浮動小数点数、
          小数も使え、負の値がサポートされています。これと同じことが、 負
          や 0 の値を入力と出力に許す *note update(): 17ed. と *note
          subtract(): 13fb. メソッド にも言えます。

        * 多重集合メソッドは正の値を扱うユースケースに対してのみ設計され
          ています。入力は負や 0 に出来ますが、正の値の出力のみが生成さ
          れます。型の制限はありませんが、値の型は足し算、引き算、比較を
          サポートしている必要があります。

        * *note elements(): 151f. メソッドは整数のカウントを要求します。
          これは 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(): 149d. を参照してください
     :

          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.9.4.4 ‘deque’ オブジェクト
............................

 -- クラス: collections.deque ([iterable[, maxlen]])

     'iterable' で与えられるデータから、新しい deque オブジェクトを
     (*note append(): 29f2. をつかって) 左から右に初期化して返します。
     'iterable' が指定されない場合、新しい deque オブジェクトは空になり
     ます。

     Deque とは、スタックとキューを一般化したものです (この名前は「デッ
     ク」と発音され、これは「double-ended queue」の省略形です)。Deque は
     どちらの側からも append と pop が可能で、スレッドセーフでメモリ効率
     がよく、どちらの方向からもおよそ 'O'(1) のパフォーマンスで実行でき
     ます。

     *note list: 24f. オブジェクトでも同様の操作を実現できますが、これは
     高速な固定長の操作に特化されており、基礎のデータ表現形式のサイズと
     位置を両方変えるような ‘pop(0)’ や ‘insert(0, v)’ などの操作ではメ
     モリ移動のために 'O'('n') のコストを必要とします。

     'maxlen' が指定されなかったり ‘None’ だった場合、 deque は任意のサ
     イズまで大きくなります。 そうでない場合、 deque のサイズは指定され
     た最大長に制限されます。 長さが制限された deque がいっぱいになると
     、新しい要素を追加するときに追加した要素数分だけ追加したのと反対側
     から要素が捨てられます。 長さが制限された deque は Unix における
     ‘tail’ フィルタと似た機能を提供します。 トランザクションの tracking
     や最近使った要素だけを残したいデータプール (pool of data) などにも
     便利です。

     Deques are *note generic: 2429. over the type of their contents.

     Deque オブジェクトは以下のようなメソッドをサポートしています:

      -- メソッド: append (item, /)

          Add 'item' to the right side of the deque.

      -- メソッド: appendleft (item, /)

          Add 'item' to the left side of the deque.

      -- メソッド: clear ()

          deque からすべての要素を削除し、長さを 0 にします。

      -- メソッド: copy ()

          deque の浅いコピーを作成します。

          Added in version 3.5.

      -- メソッド: count (value, /)

          Count the number of deque elements equal to 'value'.

          Added in version 3.2.

      -- メソッド: extend (iterable, /)

          イテラブルな引数 iterable から得られる要素を deque の右側に追
          加し拡張します。

      -- メソッド: extendleft (iterable, /)

          イテラブルな引数 iterable から得られる要素を deque の左側に追
          加し拡張します。注意: 左から追加した結果は、イテラブルな引数の
          順序とは逆になります。

      -- メソッド: index (value[, start[, stop]])

          Return the position of 'value' in the deque (at or after index
          'start' and before index 'stop').  Returns the first match or
          raises *note ValueError: 2ee. if not found.

          Added in version 3.5.

      -- メソッド: insert (index, value, /)

          Insert 'value' into the deque at position 'index'.

          挿入によって、長さに制限のある deque の長さが 'maxlen' を超え
          る場合、*note IndexError: 1753. が発生します。

          Added in version 3.5.

      -- メソッド: pop ()

          deque の右側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 1753. を発生させま
          す。

      -- メソッド: popleft ()

          deque の左側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 1753. を発生させま
          す。

      -- メソッド: remove (value, /)

          'value' の最初に現れるものを削除します。要素が見付からないない
          場合は *note ValueError: 2ee. を送出します。

      -- メソッド: 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: 349. 演算子による包含の検
査, ‘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.9.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(): 29f8. で除去できます; そうでない場合は、 *note rotate():
1ceb. メソッドで末尾に回せます:

     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(): 1ceb. メソッドは、 *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(): 1ceb. によって deque の左端まで移動させ
てから、 *note popleft(): 29f8. で古い要素を削除します。そして、 *note
extend(): 29f5. で新しい要素を追加したのち、循環を逆にします。このアプロ
ーチをやや変えたものとして、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.9.4.6 ‘defaultdict’ オブジェクト
..................................

 -- クラス: collections.defaultdict (default_factory=None, /, **kwargs)

 -- クラス: collections.defaultdict (default_factory, mapping, /,
          **kwargs)

 -- クラス: collections.defaultdict (default_factory, iterable, /,
          **kwargs)

     新しい辞書に似たオブジェクトを返します。 *note defaultdict: 13d8. は
     組み込みの *note dict: 184. クラスのサブクラスです。これはメソッド
     をひとつオーバーライドし、書き込み可能なインスタンス変数をひとつ追
     加しています。それ以外の機能は ‘dict’ クラスと同じですので、ここで
     は説明しません。

     1つ目の引数は *note default_factory: 29fb. 属性の初期値です。デフォ
     ルトは ‘None’ です。残りの引数はキーワード引数も含め、 *note dict:
     184. のコンストラクタに与えられた場合と同様に扱われます。

     ‘defaultdict’s are *note generic: 2429. over two types, signifying
     (respectively) the types of the dictionary's keys and values.

     *note defaultdict: 13d8. オブジェクトは標準の *note dict: 184. に加
     えて、以下のメソッドを実装しています:

      -- メソッド: __missing__ (key, /)

          もし *note default_factory: 29fb. 属性が ‘None’ であれば、この
          メソッドは *note KeyError: 5e7. 例外を、 'key' を引数として発
          生させます。

          もし *note default_factory: 29fb. 属性が ‘None’ でない場合、こ
          のメソッドは引数なしで呼び出され、与えらえた 'key' に対応する
          デフォルト値を提供します。この値は、辞書内に 'key' に対応して
          登録され、最後に返されます。

          もし *note default_factory: 29fb. の呼出が例外を発生させた場合
          には、変更せずそのまま例外を投げます。

          このメソッドは *note dict: 184. クラスの *note __getitem__():
          588. メソッドで、キーが存在しなかった場合によびだされます。値
          を返すか例外を発生させるのどちらにしても、 ‘__getitem__()’ か
          らもそのまま値が返るか例外が発生します。

          なお、 *note __missing__(): 29fc. は *note __getitem__(): 588.
          以外のいかなる演算に対しても呼び出され 'ません' 。よって *note
          get(): 2090. は、普通の辞書と同様に、 *note default_factory:
          29fb. を使うのではなくデフォルトとして ‘None’ を返します。

     *note defaultdict: 13d8. オブジェクトは以下のインスタンス変数をサポ
     ートしています:

      -- の属性: default_factory

          この属性は *note __missing__(): 29fc. メソッドによって使われま
          す。これは存在すればコンストラクタの第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.9.4.7 ‘defaultdict’ の使用例
..............................

*note list: 24f. を *note default_factory: 29fb. とすることで、キー=値ペ
アのシーケンスをリストの辞書へ簡単にグループ化できます。:

     >>> 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: 29fb. 関数が返す空の *note list:
24f. を使って自動的に作成されます。 *note list.append(): 8dd. 操作は新し
いリストに紐付けられます。キーが再度出現した場合には、通常の参照動作が行
われます(そのキーに対応するリストが返ります)。そして ‘list.append()’ 操
作で別の値をリストに追加します。このテクニックは *note
dict.setdefault(): 1289. を使った等価なものよりシンプルで速いです:

     >>> 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: 29fb. を *note int: 19c. にすると、 *note
defaultdict: 13d8. を(他の言語の 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: 29fb. 関数が *note int(): 19c. を呼んでデフォルトのカウ
ント0を生成します。インクリメント操作が各文字を数え上げます。

常に0を返す *note int(): 19c. は特殊な関数でした。定数を生成するより速く
て柔軟な方法は、 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: 29fb. を *note set: 185. に設定することで、 *note
defaultdict: 13d8. をセットの辞書を作るために利用することができます:

     >>> 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.9.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: 12f5.
     が指定できます。 デフォルト値を持つフィールドはデフォルト値を持たな
     いフィールドより後ろに来なければならないので、 '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:
     29ff. 属性が追加されました。

     >>> # 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: 184. を
     返します:

          >>> p = Point(x=11, y=22)
          >>> p._asdict()
          {'x': 11, 'y': 22}

     バージョン 3.1 で変更: 通常の *note dict: 184. の代わりに *note
     OrderedDict: 7f3. を返すようになりました。

     バージョン 3.8 で変更: *note collections.OrderedDict: 7f3. ではなく
     *note dict: 184. を返すようになりました。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(): 1c2. にもサポー
     トされています。

     バージョン 3.13 で変更: キーワード引数が無効な場合は *note
     ValueError: 2ee. のかわりに *note TypeError: 199. が発生します。

 -- の属性: 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(): dce. 関数を使います:

     >>> getattr(p, 'x')
     11

辞書を名前付きタプルに変換するには、 ‘**’ 演算子 (double-star-operator,
*note 引数リストのアンパック: 206d. で説明しています) を使います。:

     >>> 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: 2a02. 属性を元に作成してください:

     >>> 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: 32f. を参照してください。 *note class: 14f3. キ
     ーワードを使った洗練された記法も紹介されています:

          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.9.4.9 ‘OrderedDict’ オブジェクト
..................................

順序付き辞書は普通の辞書のようですが、順序操作に関係する追加の機能があり
ます。 組み込みの *note dict: 184. クラスが挿入順序を記憶しておく機能 (こ
の新しい振る舞いは Python 3.7 で保証されるようになりました) を獲得した今
となっては、順序付き辞書の重要性は薄れました。

いまだ残っている *note dict: 184. との差分:

   * 通常の *note dict: 184. は対応付けに向いているように設計されました
     。 挿入順序の追跡は二の次です。

   * *note OrderedDict: 7f3. は並べ替え操作に向いているように設計されま
     した。 空間効率、反復処理の速度、更新操作のパフォーマンスは二の次で
     す。

   * *note OrderedDict: 7f3. のアルゴリズムは、頻繁な並べ替え処理を
     *note dict: 184. よりもうまく扱うことができます。後述のレシピに示さ
     れている通り、この性質はさまざまな種類の LRU キャッシュの実装に適し
     ています。

   * *note OrderedDict: 7f3. に対する等価演算は突き合わせ順序もチェック
     します。

     組み込みの *note dict: 184. では、順序を考慮した等価演算は ‘p == q
     and all(k1 == k2 for k1, k2 in zip(p, q))’ で実現することができます
     。

   * *note OrderedDict: 7f3. の *note popitem(): 1509. メソッドはシグネ
     チャが異なります。 どの要素を取り出すかを指定するオプション引数を受
     け付けます。

     組み込みの *note dict: 184. の場合、 OrderedDict の
     ‘od.popitem(last=True)’ と同じ機能は、最も右側の (最後の) 要素を取
     り出すことが保証されている ‘d.popitem()’ が果たします。

     組み込みの *note dict: 184. の場合、 OrderedDict の
     ‘od.popitem(last=False)’ は ‘(k := next(iter(d)), d.pop(k))’ で実現
     できます。これにより、該当する要素のうちで最も左側の (先頭の) もの
     を辞書から削除して返すことができます。

   * *note OrderedDict: 7f3. には、 効率的に要素を末尾に置き直す *note
     move_to_end(): 13fc. メソッドがあります。

     組み込みの *note dict: 184. の場合、キーと値のペアを最も右側 (末尾)
     に移動する OrderedDict の ‘od.move_to_end(k, last=True)’ は ‘d[k] =
     d.pop(k)’ で実現できます。

     組み込みの *note dict: 184. では、キーと値のペアを最も左側 (先頭) に
     移動する OrderedDict の ‘od.move_to_end(k, last=False)’ を実現する
     効率の良い方法はありません。

   * Python 3.8 以前は、 *note dict: 184. には *note __reversed__():
     e8a. メソッドが欠けています。

 -- クラス: collections.OrderedDict (**kwargs)

 -- クラス: collections.OrderedDict (mapping, /, **kwargs)

 -- クラス: collections.OrderedDict (iterable, /, **kwargs)

     辞書の順序を並べ直すためのメソッドを持つ *note dict: 184. のサブク
     ラスのインスタンスを返します。

     Added in version 3.1.

      -- メソッド: popitem (last=True)

          順序付き辞書の *note popitem(): 1509. メソッドは、(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(): a69.
による逆順の反復もサポートしています。 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: acb. objects are order-insensitive like regular dictionaries.
This allows ‘OrderedDict’ objects to be substituted anywhere a regular
dictionary is used.

バージョン 3.5 で変更: *note OrderedDict: 7f3. の項目、キー、値の *note
ビュー: 2a04. が *note reversed(): a69. による逆順の反復をサポートするよ
うになりました。

バージョン 3.6 で変更: PEP 468(1) の受理によって、*note OrderedDict:
7f3. のコンストラクタと、*note update(): 1683. メソッドに渡したキーワー
ド引数の順序は保持されます。

バージョン 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.9.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(): be6. の変種を実
装するのにも役に立ちます:

     from collections import OrderedDict
     from time import monotonic

     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 monotonic() - timestamp <= self.maxage:
                     return result
             result = self.func(*args)
             self.cache[args] = monotonic(), 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.9.4.11 ‘UserDict’ オブジェクト
................................

クラス *note UserDict: 1ddb. は、辞書オブジェクトのラッパとしてはたらき
ます。このクラスの必要性は、 *note dict: 184. から直接的にサブクラス化で
きる能力に部分的に取って代わられました; しかし、根底の辞書に属性としてア
クセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserDict (**kwargs)

 -- クラス: collections.UserDict (mapping, /, **kwargs)

 -- クラス: collections.UserDict (iterable, /, **kwargs)

     Class that simulates a dictionary.  The instance's contents are
     kept in a regular dictionary, which is accessible via the *note
     data: 2a07. attribute of ‘UserDict’ instances.  If arguments are
     provided, they are used to initialize ‘data’, like a regular
     dictionary.

     In addition to supporting the methods and operations of mappings,
     ‘UserDict’ instances provide the following attribute:

      -- の属性: data

          *note UserDict: 1ddb. クラスの内容を保存するために使われる実際
          の辞書です。


File: python.info,  Node: UserList オブジェクト,  Next: UserString オブジェクト,  Prev: UserDict オブジェクト,  Up: collections --- コンテナデータ型

5.9.4.12 ‘UserList’ オブジェクト
................................

このクラスはリストオブジェクトのラッパとしてはたらきます。これは独自のリ
スト風クラスの基底クラスとして便利で、既存のメソッドをオーバーライドした
り新しいメソッドを加えたりできます。こうして、リストに新しい振る舞いを加
えられます。

このクラスの必要性は、 *note list: 24f. から直接的にサブクラス化できる能
力に部分的に取って代わられました; しかし、根底のリストに属性としてアクセ
スできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserList ([list])

     リストをシミュレートするクラスです。インスタンスの内容は通常のリス
     トに保存され、 *note UserList: 1702. インスタンスの *note data:
     2a09. 属性を通してアクセスできます。インスタンスの内容は最初に
     'list' のコピーに設定されますが、デフォルトでは空リスト ‘[]’ です。
     'list' は何らかのイテラブル、例えば通常の Python リストや
     ‘UserList’ オブジェクト、です。

     ミュータブルシーケンスのメソッドと演算をサポートするのに加え、
     *note UserList: 1702. インスタンスは以下の属性を提供します:

      -- の属性: data

          *note UserList: 1702. クラスの内容を保存するために使われる実際
          の *note list: 24f. オブジェクトです。

'サブクラス化の要件:' *note UserList: 1702. のサブクラスは引数なしか、あ
るいは一つの引数のどちらかとともに呼び出せるコンストラクタを提供すること
が期待されています。新しいシーケンスを返すリスト演算は現在の実装クラスの
インスタンスを作成しようとします。そのために、データ元として使われるシー
ケンスオブジェクトである一つのパラメータとともにコンストラクタを呼び出せ
ると想定しています。

派生クラスがこの要求に従いたくないならば、このクラスがサポートしているす
べての特殊メソッドはオーバーライドされる必要があります。その場合に提供さ
れる必要のあるメソッドについての情報は、ソースを参考にしてください。


File: python.info,  Node: UserString オブジェクト,  Prev: UserList オブジェクト,  Up: collections --- コンテナデータ型

5.9.4.13 ‘UserString’ オブジェクト
..................................

クラス *note UserString: fd7. は、文字列オブジェクトのラッパとしてはたら
きます。このクラスの必要性は、 *note str: 16a. から直接的にサブクラス化
できる能力に部分的に取って代わられました; しかし、根底の文字列に属性とし
てアクセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserString (seq)

     文字列オブジェクトをシミュレートするクラスです。 インスタンスの内容
     は通常の文字列に保存され、 *note UserString: fd7. インスタンスの
     *note data: 2a0b. 属性を通してアクセスできます。 インスタンスの内容
     には最初に 'seq' のコピーが設定されます。 'seq' 引数は、組み込みの
     *note str(): 16a. 関数で文字列に変換できる任意のオブジェクトです。

     文字列のメソッドと演算をサポートするのに加え、 *note UserString:
     fd7. インスタンスは次の属性を提供します:

      -- の属性: data

          *note UserString: fd7. クラスの内容を保存するために使われる実
          際の *note str: 16a. オブジェクトです。

     バージョン 3.5 で変更: 新たなメソッド ‘__getnewargs__’, ‘__rmod__’,
     ‘casefold’, ‘format_map’, ‘isprintable’, ‘maketrans’。


File: python.info,  Node: collections abc --- コンテナの抽象基底クラス,  Next: heapq --- ヒープキューアルゴリズム,  Prev: collections --- コンテナデータ型,  Up: データ型

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

Added in version 3.3: 以前はこのモジュールは *note collections: 1e. モジ
ュールの一部でした。

'ソースコード:' Lib/_collections_abc.py(1)

__________________________________________________________________

このモジュールは、 *note 抽象基底クラス: 13d2. を提供します。抽象基底ク
ラスは、クラスが特定のインターフェースを提供しているか、例えば *note
ハッシュ可能: 824. であるかや *note マッピング: 13d7. であるかを判定しま
す。

*note issubclass(): 9c8. や *note isinstance(): 2af. を使ったインターフ
ェースに対するテストは、以下の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(): 9c8. or *note
     isinstance(): 2af. 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
     演算子: 2530, the *note 反復: 12f5. ロジック, および *note
     reversed(): a69. 関数は自動的に ‘__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: 886.):

          class E:
              def __iter__(self): ...
              def __next__(self): ...

          >>> issubclass(E, Iterable)
          True
          >>> isinstance(E(), Iterable)
          True

     複雑なインターフェースは、単に特定のメソッドが存在すること以上の定
     義を持つため、3番目のテクニックをサポートしていません。それらのイン
     ターフェースはメソッドの意味やメソッド間の関係まで指定するので、特
     定のメソッド名の存在からだけではインターフェースの推測ができません
     。たとえば、あるクラスが ‘__getitem__’, ‘__len__’, および
     ‘__iter__’ を提供するというだけでは、 *note Sequence: 13e0. と
     *note Mapping: acb. を区別するには不十分です。

Added in version 3.9: これらの抽象クラスは ‘[]’ をサポートするようになり
ました。 *note ジェネリックエイリアス型: 8c2. および 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.9.5.1 コレクション抽象基底クラス
..................................

collections モジュールは以下の *note ABC (抽象基底クラス): 13d2. を提供
します:

ABC                                継承しているクラス         抽象メソッド                mixin メソッド
                                                                                          
---------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note Container: 2709. (1)                                    ‘__contains__’
                                                              
                                                                                          
*note Hashable: 719. (2)                                      ‘__hash__’
                                                              
                                                                                          
*note Iterable: 2707. (3) (4)                                 ‘__iter__’
                                                              
                                                                                          
*note Iterator: 2708. (5)          *note Iterable: 2707.      ‘__next__’                  ‘__iter__’
                                                                                          
                                                                                          
*note Reversible: e89. (6)         *note Iterable: 2707.      ‘__reversed__’
                                                              
                                                                                          
*note Generator: fdf. (7)          *note Iterator: 2708.      ‘send’, ‘throw’             ‘close’, ‘__iter__’, ‘__next__’
                                                                                          
                                                                                          
*note Sized: 71a. (8)                                         ‘__len__’
                                                              
                                                                                          
*note Callable: 9ef. (9)                                      ‘__call__’
                                                              
                                                                                          
*note Collection: e88. (10)        *note Sized: 71a,          ‘__contains__’,
                                   *note Iterable: 2707,      ‘__iter__’, ‘__len__’
                                   *note Container: 2709.     
                                   
                                                                                          
*note Sequence: 13e0.              *note Reversible: e89,     ‘__getitem__’, ‘__len__’    ‘__contains__’, ‘__iter__’, ‘__reversed__’, ‘index’,
                                   *note Collection: e88.                                 ‘count’
                                                                                          
                                                                                          
*note MutableSequence: 4bf.        *note Sequence: 13e0.      ‘__getitem__’,              *note Sequence: 13e0. から継承したメソッドと、
                                                              ‘__setitem__’,              ‘append’, ‘clear’, ‘reverse’, ‘extend’, ‘pop’,
                                                              ‘__delitem__’, ‘__len__’,   ‘remove’, ‘__iadd__’
                                                              ‘insert’                    
                                                              
                                                                                          
*note ByteString: 340.             *note Sequence: 13e0.      ‘__getitem__’, ‘__len__’    *note Sequence: 13e0. から継承したメソッド
                                                                                          
                                                                                          
*note Set: 26ff.                   *note Collection: e88.     ‘__contains__’,             ‘__le__’, ‘__lt__’, ‘__eq__’, ‘__ne__’, ‘__gt__’,
                                                              ‘__iter__’, ‘__len__’       ‘__ge__’, ‘__and__’, ‘__or__’, ‘__sub__’, ‘__rsub__’,
                                                                                          ‘__xor__’, ‘__rxor__’ and ‘isdisjoint’
                                                                                          
                                                                                          
*note MutableSet: 270a.            *note Set: 26ff.           ‘__contains__’,             *note Set: 26ff. から継承したメソッドと、 ‘clear’,
                                                              ‘__iter__’, ‘__len__’,      ‘pop’, ‘remove’, ‘__ior__’, ‘__iand__’, ‘__ixor__’,
                                                              ‘add’, ‘discard’            ‘__isub__’
                                                                                          
                                                                                          
*note Mapping: acb.                *note Collection: e88.     ‘__getitem__’,              ‘__contains__’, ‘keys’, ‘items’, ‘values’, ‘get’,
                                                              ‘__iter__’, ‘__len__’       ‘__eq__’, ‘__ne__’
                                                                                          
                                                                                          
*note MutableMapping: 12c4.        *note Mapping: acb.        ‘__getitem__’,              *note Mapping: acb. から継承したメソッドと、 ‘pop’,
                                                              ‘__setitem__’,              ‘popitem’, ‘clear’, ‘update’, ‘setdefault’
                                                              ‘__delitem__’,              
                                                              ‘__iter__’, ‘__len__’
                                                              
                                                                                          
*note MappingView: 270b.           *note Sized: 71a.                                      ‘__init__’, ‘__len__’ and ‘__repr__’
                                                                                          
                                                                                          
*note ItemsView: 270d.             *note MappingView: 270b,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 26ff.                                       
                                   
                                                                                          
*note KeysView: 270c.              *note MappingView: 270b,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 26ff.                                       
                                   
                                                                                          
*note ValuesView: 270e.            *note MappingView: 270b,                               ‘__contains__’, ‘__iter__’
                                   *note Collection: e88.                                 
                                   
                                                                                          
*note Awaitable: fe0. (11)                                    ‘__await__’
                                                              
                                                                                          
*note Coroutine: fe1. (12)         *note Awaitable: fe0.      ‘send’, ‘throw’             ‘close’
                                                                                          
                                                                                          
*note AsyncIterable: fe3. (13)                                ‘__aiter__’
                                                              
                                                                                          
*note AsyncIterator: fe2. (14)     *note AsyncIterable: fe3.  ‘__anext__’                 ‘__aiter__’
                                                                                          
                                                                                          
*note AsyncGenerator: e8b. (15)    *note AsyncIterator: fe2.  ‘asend’, ‘athrow’           ‘aclose’, ‘__aiter__’, ‘__anext__’
                                                                                          
                                                                                          
*note Buffer: 341. (16)                                       ‘__buffer__’
                                                              

脚注
....

   ---------- Footnotes ----------

   (1) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (2) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (3) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (4) ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable:
2707. として登録されたクラスや *note __iter__(): 2105. メソッドを持つク
ラスを検出しますが、 *note __getitem__(): 588. メソッドにより反復処理を
行うクラスは検出しません。オブジェクトがイテラブル (*note iterable:
12f5.) かどうかを確認する唯一の信頼できる方法は ‘iter(obj)’ を呼び出すこ
とです。

   (5) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (6) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (7) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (8) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (9) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (10) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (11) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (12) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (13) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (14) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (15) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (16) これらの抽象基底クラスは *note __subclasshook__(): 2a10. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 886. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。


File: python.info,  Node: コレクションの抽象基底クラス -- 詳細な説明,  Next: 例とレシピ,  Prev: コレクション抽象基底クラス,  Up: collections abc --- コンテナの抽象基底クラス

5.9.5.2 コレクションの抽象基底クラス - 詳細な説明
.................................................

 -- クラス: collections.abc.Container

     *note __contains__(): 15d7. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Hashable

     *note __hash__(): cf7. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Sized

     *note __len__(): 17ff. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Callable

     *note __call__(): 77a. メソッドを提供するクラスの ABC です。

     ‘Callable’ を型アノテーションで使う方法の詳細は、 *note
     呼び出し可能オブジェクトのアノテーション: 2728. を参照してください
     。

 -- クラス: collections.abc.Iterable

     *note __iter__(): 2105. メソッドを提供するクラスの ABC です。

     ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable: 2707.
     として登録されたクラスや *note __iter__(): 2105. メソッドを持つクラ
     スを検出しますが、 *note __getitem__(): 588. メソッドにより反復処理
     を行うクラスは検出しません。オブジェクトがイテラブル (*note
     iterable: 12f5.) かどうかを確認する唯一の信頼できる方法は
     ‘iter(obj)’ を呼び出すことです。

 -- クラス: collections.abc.Collection

     サイズ付きのイテラブルなコンテナクラスの ABC です。

     Added in version 3.6.

 -- クラス: collections.abc.Iterator

     *note __iter__(): 2108. メソッドと *note __next__(): 14e9. メソッド
     を提供するクラスの ABC です。 *note iterator: 4c8. の定義も参照して
     ください。

 -- クラス: collections.abc.Reversible

     *note __reversed__(): e8a. メソッドを提供するイテラブルクラスの ABC
     です。

     Added in version 3.6.

 -- クラス: collections.abc.Generator

     PEP 342(1) で定義された、*note イテレータ: 4c8. を *note send():
     1271, *note throw(): 71c, *note close(): 1802. の各メソッドに拡張す
     るプロトコルを実装する、*note ジェネレータ: 1270. クラスの ABC です
     。

     ‘Generator’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 2a12. を参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.Sequence
 -- クラス: collections.abc.MutableSequence
 -- クラス: collections.abc.ByteString

     読み出し専用の *note シーケンス: 716. およびミュータブルな シーケン
     ス の ABC です。

     Implementation note: Some of the mixin methods, such as *note
     __iter__(): 2105, *note __reversed__(): e8a, and *note index():
     19d9. make repeated calls to the underlying *note __getitem__():
     588. method.  Consequently, if ‘__getitem__()’ 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: 2ee. if the value is not present.

          Supporting the 'start' and 'stop' arguments is optional, but
          recommended.

          バージョン 3.5 で変更: The *note index(): 19d9. method gained
          support for the 'stop' and 'start' arguments.

     バージョン 3.12 で非推奨、バージョン 3.17 で削除予定: The
     ‘ByteString’ ABC has been deprecated.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 262. at runtime.  For use in
     type annotations, either use *note Buffer: 341. 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: 193. and *note
     bytearray: 342.  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: 166. 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 集合: 208d. の ABC です。

 -- クラス: collections.abc.Mapping
 -- クラス: collections.abc.MutableMapping

     読み出し専用の *note マッピング: 13d7. およびミュータブルな マッピ
     ング の ABC です。

 -- クラス: collections.abc.MappingView
 -- クラス: collections.abc.ItemsView
 -- クラス: collections.abc.KeysView
 -- クラス: collections.abc.ValuesView

     マッピング、要素、キー、値の *note ビュー: 2a04. の ABC です。

 -- クラス: collections.abc.Awaitable

     *note await: 18e. で使用できる *note awaitable: 4c9. オブジェクトの
     ABC です。カスタムの実装は、*note __await__(): f79. メソッドを提供
     しなければなりません。

     *note Coroutine: fe1. ABC の *note Coroutine: 6b9. オブジェクトとイ
     ンスタンスは、すべてこの ABC のインスタンスです。

          注釈: In CPython, generator-based coroutines (*note
          generators: 1270. decorated with *note @types.coroutine:
          108c.) are 'awaitables', even though they do not have an *note
          __await__(): f79. method.  Using ‘isinstance(gencoro,
          Awaitable)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 101c. to detect them.

     Added in version 3.5.

 -- クラス: collections.abc.Coroutine

     *note コルーチン: 6b9. と互換性のあるクラスの ABC です。これらは、
     *note コルーチンオブジェクト: 23b2. で定義された *note send():
     2479, *note throw(): 71b, *note close(): 247a. のメソッドを実装しま
     す。カスタムの実装は、*note __await__(): f79. も実装しなければなり
     ません。*note Coroutine: fe1. のすべてのインスタンスは、 *note
     Awaitable: fe0. のインスタンスでもあります。

          注釈: In CPython, generator-based coroutines (*note
          generators: 1270. decorated with *note @types.coroutine:
          108c.) are 'awaitables', even though they do not have an *note
          __await__(): f79. method.  Using ‘isinstance(gencoro,
          Coroutine)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 101c. to detect them.

     ‘Coroutine’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 2a12. を参照してください。型パラメータの
     意味と順序は *note Generator: fdf. と同様です。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncIterable

     ‘__aiter__’ メソッドを提供するクラスの ABC です。*note asynchronous
     iterable: f78. の定義も参照してください。

     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
     非同期ジェネレータ: 24fb. クラスの ABC です。

     ‘AsyncGenerator’ を型アノテーションで使う方法の詳細は、 *note
     Annotating generators and coroutines: 2a12. を参照してください。

     Added in version 3.6.

 -- クラス: collections.abc.Buffer

     *note buffer protocol: 262. を実装する *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.9.5.3 例とレシピ
..................

抽象基底クラスは、クラスやインスタンスが特定の機能を提供しているかどうか
を調べることを可能にします。例えば:

     size = None
     if isinstance(myvar, collections.abc.Sized):
         size = len(myvar)

幾つかの ABC はコンテナ型 API を提供するクラスを開発するのを助ける mixin
型としても使えます。例えば、 *note Set: 26ff. API を提供するクラスを作る
場合、3つの基本になる抽象メソッド *note __contains__(): 15d7, *note
__iter__(): 2105, *note __len__(): 17ff. だけが必要です。ABC が残りの
‘__and__()’ や *note isdisjoint(): 26ec. といったメソッドを提供します:

     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: 26ff. と *note MutableSet: 270a. を mixin 型として利用すると
きの注意点:

  1. 幾つかの set の操作は新しい set を作るので、デフォルトの mixin メソ
     ッドは *note イテラブル: 12f5. から新しいインスタンスを作成する方法
     を必要とします。クラスのコンストラクタは ‘ClassName(iterable)’ の形
     のシグネチャを持つと仮定されます。内部の ‘_from_iterable()’ という
     *note classmethod: 48e. が ‘cls(iterable)’ を呼び出して新しい set を
     作る部分でこの仮定が使われています。コンストラクタのシグネチャが異
     なるクラスで *note Set: 26ff. を使う場合は、 iterable 引数から新し
     いインスタンスを生成できるクラスメソッドあるいは仕様に沿ったメソッ
     ドで ‘_from_iterable()’ をオーバーライドする必要があります。

  2. (たぶん意味はそのままに速度を向上する目的で)比較をオーバーライドす
     る場合、 *note __le__(): 1526. と *note __ge__(): 1528. だけを再定
     義すれば、その他の演算は自動的に追随します。

  3. The *note Set: 26ff. mixin provides a ‘_hash()’ method to compute a
     hash value for the set; however, *note __hash__(): cf7. is not
     defined because not all sets are *note hashable: 824. or immutable.
     To add set hashability using mixins, inherit from both ‘Set’ and
     *note Hashable: 719, then define ‘__hash__ = Set._hash’.

参考
....

   * *note MutableSet: 270a. を使った例として 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.9.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: 24f.

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(): dcc, 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():
2a18. or *note heapify_max(): 223. 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: 1753.
     is raised.  To access the smallest item without popping it, use
     ‘heap[0]’.

 -- の関数: heapq.heappushpop (heap, item)

     'item' を 'heap' に push した後、pop を行って 'heap' から最初の要素
     を返します。この一続きの動作を *note heappush(): 16da. に引き続いて
     *note heappop(): 16db. を別々に呼び出すよりも効率的に実行します。

 -- の関数: heapq.heapreplace (heap, item)

     'heap' から最小の要素を pop して返し、新たに 'item' を push します
     。ヒープのサイズは変更されません。ヒープが空の場合、 *note
     IndexError: 1753. が送出されます。

     この一息の演算は *note heappop(): 16db. に次いで *note heappush():
     16da. を送出するよりも効率的で、固定サイズのヒープを用いている場合
     にはより適しています。 pop/push の組み合わせは必ずヒープから要素を
     一つ返し、それを 'item' と置き換えます。

     返される値は加えられた 'item' よりも大きくなるかもしれません。それ
     を望まないなら、代わりに *note heappushpop(): 2a19. を使うことを考
     えてください。この 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: 1753. 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(): 224. followed by a separate call to *note
     heappop_max(): 225.

     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: 1753. is raised.

     The value returned may be smaller than the 'item' added.  Refer to
     the analogous function *note heapreplace(): 2a1a. 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: 100a. を指定します
     。この関数は、入力の各要素から比較のキーを取り出すのに使われます。
     デフォルト値は ‘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(): dcb. 関数の方が効率的です。さらに、 ‘n==1’ の時には
*note min(): 110f. および *note max(): 1110. 関数の方が効率的です。この
関数を繰り返し使うことが必要なら、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.9.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(): dcb. とは異な
り、この実装はステーブルソートではありません。

ヒープの要素はタプルに出来ます。これは、追跡される主レコードとは別に (タ
スクの優先度のような) 比較値を指定するときに便利です:

     >>> 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.9.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.9.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.9.6.4 理論
............

ヒープとは、全ての 'k' について、要素を 0 から数えたときに、‘a[k] <=
a[2*k+1]’ かつ ‘a[k] <= a[2*k+2]’ となる配列です。比較のために、存在しな
い要素を無限大と考えます。ヒープの興味深い属性は ‘a[0]’ が常に最小の要素
になることです。

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are 'k', not ‘a[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.9.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__(): cf6. method to determine whether a value has been found.
Instead, the functions only call the *note __lt__(): 14bc. 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(): 2a24. 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: 100a. 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(): 2a26. と似ていますが、 '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(): 2a26. to locate an
     insertion point.  Next, it runs the *note insert(): 243a. 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(): 2a24. と似ていますが、 'a' に含まれる 'x' のう
     ち、どのエントリーよりも後ろに 'x' を挿入します。

     This function first runs *note bisect_right(): 2a27. to locate an
     insertion point.  Next, it runs the *note insert(): 243a. 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.9.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(): 1833. 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.9.7.2 ソート済みリストの探索
..............................

上記の *note bisect 関数: 2a25. は挿入点を見つけるには便利ですが、一般的
な検索タスクに使うには厄介であったり、使いにくい場合があります。 以下の
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.9.7.3 使用例
..............

*note bisect(): 2a28. 関数は数値テーブルの探索に役に立ちます。この例では
、 ‘bisect()’ を使って、(たとえば)順序のついた数値の区切り点の集合に基づ
いて、試験の成績の等級を表す文字を調べます。区切り点は 90 以上は 'A'、
80 から 89 は 'B'、などです:

     >>> def grade(score):
     ...     i = bisect([60, 70, 80, 90], score)
     ...     return "FDCBA"[i]
     ...
     >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
     ['F', 'A', 'C', 'C', 'B', 'A', 'A']

*note bisect(): 2a28. と *note insort(): 2a2a. 関数もタプルのリストで動
作します。 引数 '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.9.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.

     バージョン 3.3 で非推奨、バージョン 3.16 で削除予定: Please migrate
     to ‘'w'’ typecode.

  2. 
     Added in version 3.13.

参考
....

The *note ctypes: 2892. and *note struct: 124f. modules, as well as
third-party modules like numpy(1), use similar - but slightly different
- type codes.

値の実際の表現はマシンアーキテクチャ (厳密に言うとCの実装) によって決ま
ります。値の実際のサイズは *note array.itemsize: 2a32. 属性から得られま
す。

このモジュールは以下の項目を定義しています:

 -- データ: array.typecodes

     A string with all available type codes.

このモジュールでは次の型を定義しています:

 -- クラス: 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: 193. or *note bytearray: 342. object, a Unicode
     string, or iterable over elements of the appropriate type.

     If given a *note bytes: 193. or *note bytearray: 342. object, the
     initializer is passed to the new array's *note frombytes(): 148d.
     method; if given a Unicode string, the initializer is passed to the
     *note fromunicode(): 2a34. method; otherwise, the initializer's
     iterator is passed to the *note extend(): 2a35. method to add
     initial items to the array.

     Array objects support the ordinary *note mutable: 2621. *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: 199. is raised.  Array objects also
     implement the buffer interface, and may be used wherever *note
     bytes-like objects: 194. are supported.

     Arrays are *note generic: 2429. over the type of their contents.

     引数 ‘typecode’, ‘initializer’ 付きで *note 監査イベント: 1ccb.
     ‘array.__new__’ を送出します。

      -- の属性: typecode

          アレイを作るときに使う型コード文字です。

      -- の属性: itemsize

          アレイの要素 1 つの内部表現に使われるバイト長です。

      -- メソッド: append (value, /)

          Append a new item with the specified value to the end of the
          array.

      -- メソッド: buffer_info ()

          アレイの内容を記憶するために使っているバッファの、現在のメモリ
          アドレスと要素数の入ったタプル ‘(address, length)’ を返します
          。バイト単位で表したメモリバッファの大きさは
          ‘array.buffer_info()[1] * array.itemsize’ で計算できます。例え
          ば ‘ioctl()’ 操作のような、メモリアドレスを必要とする低レベル
          な (そして、本質的に危険な) I/Oインターフェースを使って作業す
          る場合に、ときどき便利です。アレイ自体が存在し、長さを変えるよ
          うな演算を適用しない限り、有効な値を返します。

               注釈: C やC++ で書いたコードからアレイオブジェクトを使う
               場合 (‘buffer_info()’ の情報を使う意味のある唯一の方法で
               す) は、アレイオブジェクトでサポートしているバッファイン
               ターフェースを使う方がより理にかなっています。このメソッ
               ドは後方互換性のために保守されており、新しいコードでの使
               用は避けるべきです。バッファインターフェースの説明は
               *note バッファプロトコル (buffer Protocol): 262. にありま
               す。

      -- メソッド: byteswap ()

          "Byteswap" all items of the array.  This is only supported for
          values which are 1, 2, 4, or 8 bytes in size; for other types
          of values, *note RuntimeError: 246. is raised.  It is useful
          when reading data from a file written on a machine with a
          different byte order.

      -- メソッド: count (value, /)

          Return the number of occurrences of 'value' in the array.

      -- メソッド: extend (iterable, /)

          'iterable' から要素を取り出し、アレイの末尾に要素を追加します
          。 'iterable' が別のアレイ型である場合、二つのアレイは '全く'
          同じ型コードでなければなりません。それ以外の場合には *note
          TypeError: 199. を送出します。 'iterable' がアレイでない場合、
          アレイに値を追加できるような正しい型の要素からなるイテレーショ
          ン可能オブジェクトでなければなりません。

      -- メソッド: frombytes (buffer, /)

          Appends items from the *note bytes-like object: 194,
          interpreting its content as an array of machine values (as if
          it had been read from a file using the *note fromfile(): 14dc.
          method).

          Added in version 3.2: 明確化のため ‘fromstring()’ の名前が
          *note frombytes(): 148d. に変更されました。

      -- メソッド: fromfile (f, n, /)

          *note ファイルオブジェクト: 13df. 'f' から (マシンのデータ形式
          そのままで) 'n' 個の要素を読み出し、アレイの末尾に要素を追加し
          ます。 'n' 個未満の要素しか読めなかった場合は *note EOFError:
          14f5. を送出しますが、それまでに読み出せた値はアレイに追加され
          ます。

      -- メソッド: fromlist (list, /)

          リストから要素を追加します。型に関するエラーが発生した場合にア
          レイが変更されないことを除き、 ‘for x in list: a.append(x)’ と
          同じです。

      -- メソッド: fromunicode (ustr, /)

          Extends this array with data from the given Unicode string.
          The array must have type code ‘'u'’ or ‘'w'’; otherwise a
          *note ValueError: 2ee. is raised.  Use
          ‘array.frombytes(unicodestring.encode(enc))’ to append Unicode
          data to an array of some other type.

      -- メソッド: index (value[, start[, stop]])

          Return the smallest 'i' such that 'i' is the index of the
          first occurrence of 'value' in the array.  The optional
          arguments 'start' and 'stop' can be specified to search for
          'value' within a subsection of the array.  Raise *note
          ValueError: 2ee. if 'value' is not found.

          バージョン 3.10 で変更: Added optional 'start' and 'stop'
          parameters.

      -- メソッド: insert (index, value, /)

          Insert a new item 'value' in the array before position
          'index'.  Negative values are treated as being relative to the
          end of the array.

      -- メソッド: pop (index=-1, /)

          アレイからインデクスが 'i' の要素を取り除いて返します。オプシ
          ョンの引数はデフォルトで ‘-1’ になっていて、最後の要素を取り除
          いて返すようになっています。

      -- メソッド: remove (value, /)

          Remove the first occurrence of 'value' from the array.

      -- メソッド: clear ()

          Remove all elements from the array.

          Added in version 3.13.

      -- メソッド: reverse ()

          アレイの要素の順番を逆にします。

      -- メソッド: tobytes ()

          array をマシンの値の array に変換して、 bytes の形で返します
          (*note tofile(): 14dd. メソッドを使ってファイルに書かれるバイ
          ト列と同じです)。

          Added in version 3.2: ‘tostring()’ is renamed to ‘tobytes()’
          for clarity.

      -- メソッド: tofile (f, /)

          すべての要素を (マシンの値の形式で) *note file object: 13df.
          'f' に書き込みます。

      -- メソッド: tolist ()

          アレイを同じ要素を持つ普通のリストに変換します。

      -- メソッド: tounicode ()

          Convert the array to a Unicode string.  The array must have a
          type ‘'u'’ or ‘'w'’; otherwise a *note ValueError: 2ee. 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(2)

     NumPy パッケージは、別の配列型を定義しています。

   ---------- Footnotes ----------

   (1) 
https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__

   (2) https://numpy.org/


File: python.info,  Node: weakref --- Weak references,  Next: types --- 動的な型生成と組み込み型の名前,  Prev: array --- 効率的な数値配列,  Up: データ型

5.9.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: 1842. はリファレントを自由に破棄し、メモリを別のもの
に再利用することができます。しかし、オブジェクトへの強参照がなくても、オ
ブジェクトが実際に破棄されるまでは、弱参照はオブジェクトを返す場合があり
ます。

弱参照の主な用途は、巨大なオブジェクトを保持するキャッシュやマッピングを
実装することです。ここで、キャッシュやマッピングに保持されているからとい
う理由だけで、巨大なオブジェクトが生き続けることは望ましくありません。

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: 1989. and *note WeakValueDictionary: 198a.
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 ‘WeakValueDictionary’, 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: 1989. と *note WeakValueDictionary: 198a. はそ
の実装に弱参照を使用しており、キーや値がガーベジコレクションによって回収
されたことを弱参照辞書に通知するコールバック関数を設定しています。 *note
WeakSet: 7f5. は *note set: 185. インターフェースを実装していますが、
‘WeakKeyDictionary’ のように要素への弱参照を持ちます。

*note finalize: c73. は、オブジェクトのガベージコレクションの実行時にク
リーンアップ関数が呼び出されるように登録する、単純な方法を提供します。こ
れは、未加工の弱参照上にコールバック関数を設定するよりも簡単です。なぜな
ら、オブジェクトのコレクションが完了するまでファイナライザが生き続けるこ
とを、モジュールが自動的に保証するからです。

Most programs should find that using one of these weak container types
or *note finalize: c73. 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 オブジェクト: 13df. 、 *note generators: 1270. 型のオブジェク
ト、socket オブジェクト、array オジェクト、deque オブジェクト、正規表現
パターンオブジェクト、code オブジェクトです。

バージョン 3.2 で変更: thread.lock, threading.Lock, code オブジェクトの
サポートが追加されました。

*note list: 24f. や *note dict: 184. など、いくつかの組み込み型は弱参照
を直接サポートしませんが、以下のようにサブクラス化を行えばサポートを追加
できます:

     class Dict(dict):
         pass

     obj = Dict(red=1, green=2, blue=3)   # this object is weak referenceable

*note tuple: 614. や *note int: 19c. など、他の組み込み型はサブクラス化
しても弱参照をサポートしません。

拡張型は、簡単に弱参照をサポートできます。詳細については、 *note
弱参照(Weak Reference)のサポート: 2a45. を参照してください。

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: 23db. for details.

 -- クラス: weakref.ref (object[, callback])

     'object' への弱参照を返します。リファレントがまだ生きているならば、
     元のオブジェクトは参照オブジェクトの呼び出しで取り出せす。リファレ
     ントがもはや生きていないならば、参照オブジェクトを呼び出したときに
     *note None: 886. を返します。 'callback' に ‘None’ 以外の値を与えた
     場合、オブジェクトをまさに後始末処理しようとするときに呼び出します
     。このとき弱参照オブジェクトは '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__():
     1203. method.

     'object' が *note ハッシュ可能: 824. ならば、弱参照はハッシュ可能で
     す。それらは 'object' が削除された後でもそれらのハッシュ値を保持し
     ます。 'object' が削除されてから初めて *note hash(): 801. が呼び出
     された場合に、その呼び出しは *note TypeError: 199. を発生させます。

     弱参照は等価性のテストをサポートしていますが、順序をサポートしてい
     ません。参照がまだ生きているならば、 'callback' に関係なく二つの参
     照はそれらのリファレントと同じ等価関係を持ちます。リファレントのど
     ちらか一方が削除された場合、参照オブジェクトが同一である場合に限り
     、その参照は等価です。

     これはサブクラス化可能な型というよりファクトリ関数です。

     Weak references are *note generic: 2429. over the type of the
     object they reference.

      -- の属性: __callback__

          この読み出し専用の属性は、現在弱参照に関連付けられているコール
          バックを返します。コールバックが存在しないか、弱参照のリファレ
          ントが生きていない場合、この属性の値は ‘None’ になります。

     バージョン 3.4 で変更: *note __callback__: 11f7. 属性が追加されまし
     た。

 -- の関数: weakref.proxy (object[, callback])

     弱参照を使う 'object' へのプロキシを返します。弱参照オブジェクトを
     明示的な参照外しをしながら利用する代わりに、多くのケースでプロキシ
     を利用することができます。返されるオブジェクトは、 'object' が呼び
     出し可能かどうかによって、 ‘ProxyType’ または ‘CallableProxyType’ の
     どちらかの型を持ちます。プロキシオブジェクトはリファレントに関係な
     く *note ハッシュ可能: 824. ではありません。これによって、それらの
     基本的な変更可能という性質による多くの問題を避けています。そして、
     辞書のキーとしての利用を妨げます。 'callback' は *note ref(): 11f6.
     関数の同じ名前のパラメータと同じものです。(-- 訳注: リファレントが
     変更不能型であっても、プロキシはリファレントが消えるという状態の変
     更があるために、変更可能型です。--)

     Accessing an attribute of the proxy object after the referent is
     garbage collected raises *note ReferenceError: 172b.

     バージョン 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: 1989. オブジェクトは、追加のメソッドを持ちます
。このメソッドは、内部の参照を直接公開します。その参照は、利用される時に
生存しているとは限りません。なので、参照を利用する前に、その参照をチェッ
クする必要があります。これにより、必要なくなったキーの参照が残っているた
めに、ガベージコレクタがそのキーを削除できなくなる事態を避ける事ができま
す。

 -- メソッド: WeakKeyDictionary.keyrefs ()

     キーへの弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakValueDictionary ([dict])

     値を弱参照するマッピングクラス。値への強参照が存在しなくなったとき
     に、辞書のエントリは捨てられます。

     バージョン 3.9 で変更: PEP 584(3) で規定されている ‘|’ 演算子と
     ‘|=’ 演算子のサポートを追加しました。

*note WeakValueDictionary: 198a. objects have an additional method that
has the same issues as the *note WeakKeyDictionary.keyrefs(): 2a48.
method.

 -- メソッド: WeakValueDictionary.valuerefs ()

     値への弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakSet ([elements])

     要素への弱参照を持つ集合型。要素への強参照が無くなったときに、その
     要素は削除されます。

 -- クラス: weakref.WeakMethod (method[, callback])

     拡張された *note ref: 11f6. のサブクラスで、束縛されたメソッドへの
     弱参照をシミュレートします (つまり、クラスで定義され、インスタンス
     にあるメソッド)。 束縛されたメソッドは短命なので、標準の弱参照では
     保持し続けられません。 *note WeakMethod: 11f5. には、オブジェクトと
     元々の関数が死ぬまで束縛されたメソッドを再作成する特別なコードがあ
     ります:

          >>> 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(): 11f6. function.

     Added in version 3.4.

 -- クラス: weakref.finalize (obj, func, /, *args, **kwargs)

     'obj' がガベージコレクションで回収されるときに呼び出される、呼び出
     し可能なファイナライザオブジェクトを返します。 通常の弱参照とは異な
     り、ファイナライザは参照しているオブジェクトが回収されるまで必ず生
     き残り、そのおかげでライフサイクル管理が大いに簡単になります。

     ファイナライザは (直接もしくはガベージコレクションのときに) 呼び出
     されるまで '生きている' と見なされ、呼び出された後には '死んでいま
     す' 。 生きているファイナライザを呼び出すと、 ‘func(*arg,
     **kwargs)’ を評価した結果を返します。一方、死んでいるファイナライザ
     を呼び出すと *note None: 886. を返します。

     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__(): 1203. 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: 886.

      -- メソッド: __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: 886.

      -- メソッド: 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: 886.

      -- メソッド: peek ()

          If 'self' is alive then return the tuple ‘(obj, func, args,
          kwargs)’.  If 'self' is dead then return *note None: 886.

      -- の属性: 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: 2a4e. 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.9.9.1 弱参照オブジェクト
..........................

Weak reference objects have no methods and no attributes besides *note
ref.__callback__: 11f7.  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: 886. を返します:

     >>> 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: 11f6. オブジェクトの特殊なバージョンを
作成できます。これは *note WeakValueDictionary: 198a. の実装で使われてお
り、マップ内の各エントリによるメモリのオーバヘッドを減らしています。こう
した実装は、ある参照に追加情報を関連付けたい場合に便利ですし、リファレン
トを取り出すための呼び出し時に何らかの追加処理を行いたい場合にも使えます
。

以下の例では、 *note ref: 11f6. のサブクラスを使って、あるオブジェクトに
追加情報を保存し、リファレントがアクセスされたときにその値に作用をできる
ようにするための方法を示しています:

     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.9.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.9.9.3 ファイナライザオブジェクト
..................................

The main benefit of using *note finalize: c73. 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(): 2a4b. 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: 2a4e. attribute to *note False: d2f, 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.9.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__(): 1203.
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__(): 1203. methods no longer
prevent reference cycles from being garbage collected, and module
globals are no longer forced to *note None: 886. during *note
interpreter shutdown: 479.  So this code should work without any issues
on CPython.

However, handling of *note __del__(): 1203. 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(): a82, ‘try: ... finally: ...’ and ‘with: ...’ do
     not guarantee that cleanup occurs either.


File: python.info,  Node: types --- 動的な型生成と組み込み型の名前,  Next: copy --- 浅いコピーおよび深いコピー操作,  Prev: weakref --- Weak references,  Up: データ型

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

'ソースコード:' Lib/types.py(1)

__________________________________________________________________

このモジュールは新しい型の動的な生成を支援するユーティリティ関数を定義し
ます。

さらに、標準の Python インタプリタによって使用されているものの、 *note
int: 19c. や *note str: 16a. のように組み込みとして公開されていないよう
ないくつかのオブジェクト型の名前を定義しています。

最後に、組み込みになるほど基本的でないような追加の型関連のユーティリティ
と関数をいくつか提供しています。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/types.py


File: python.info,  Node: 動的な型生成,  Next: 標準的なインタプリタ型,  Up: types --- 動的な型生成と組み込み型の名前

5.9.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 メタクラス: 241e.

     これらの関数によってサポートされるクラス生成プロセスの完全な詳細

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: f48, and returns a tuple where each such object that
     has an *note __mro_entries__(): ce7. method is replaced with an
     unpacked result of calling this method.  If a 'bases' item is an
     instance of ‘type’, 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__(): ce7. 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__: 16ca. 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.9.10.2 標準的なインタプリタ型
...............................

このモジュールは、Python インタプリタを実装するために必要な多くの型に対
して名前を提供します。それは、‘listiterator’ 型のような、単に処理中に付
随的に発生するいくつかの型が含まれることを意図的に避けています。

これらの名前は典型的に *note isinstance(): 2af. や *note issubclass():
9c8. によるチェックに使われます。

これらのタイプのいずれかをインスタンス化する場合、シグネチャは Python の
バージョンによって異なる可能性があることに注意してください。

以下の型に対して標準的な名前が定義されています:

 -- クラス: types.NoneType

     *note None: 886. の型です。

     Added in version 3.10.

 -- データ: types.FunctionType
 -- データ: types.LambdaType

     ユーザ定義の関数と *note lambda: 14b9. 式によって生成された関数の型
     です。

     引数 ‘code’ を指定して *note 監査イベント: 1ccb. ‘function.__new__’
     を送出します。

     この監査イベントは、関数オブジェクトを直接インスタンス化した場合に
     のみ発生し、通常のコンパイル時には発生しません。

 -- データ: types.GeneratorType

     ジェネレータ関数によって生成された *note ジェネレータ: 1270. イテレ
     ータオブジェクトの型です。

 -- データ: types.CoroutineType

     *note async def: 7ed. 関数に生成される *note コルーチン: 6b9. オブ
     ジェクトです。

     Added in version 3.5.

 -- データ: types.AsyncGeneratorType

     非同期ジェネレータ関数によって作成された *note 非同期ジェネレータ:
     24fb. イテレータオブジェクトの型です。

     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
     監査イベント: 1ccb. ‘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: 18f6.

     Added in version 3.8.

 -- データ: types.MethodType

     ユーザー定義のクラスのインスタンスのメソッドの型です。

 -- データ: types.BuiltinFunctionType
 -- データ: types.BuiltinMethodType

     *note len(): 840. や *note sys.exit(): 279. のような組み込み関数や
     、組み込み型のメソッドの型です。 (ここでは "組み込み" という単語を
     "Cで書かれた" という意味で使っています)

 -- データ: types.WrapperDescriptorType

     The type of methods of some built-in data types and base classes
     such as *note object.__init__(): 8c0. or *note object.__lt__():
     14bc.

     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: 1a3. の型です。

     Added in version 3.10.

 -- データ: types.MethodDescriptorType

     The type of methods of some built-in data types such as *note
     str.join(): 2668.

     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: 1a3d. の型です。コンストラクタは生成するモジュールの
     名前と任意でその *note docstring: 2348. を受け取ります。

     参考
     ....

     *note Documentation on module objects: 23ba.

          Provides details on the special attributes that can be found
          on instances of ‘ModuleType’.

     *note importlib.util.module_from_spec(): 1017.

          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: 2384. の型です。

     Added in version 3.10.

 -- クラス: types.GenericAlias (t_origin, t_args)

     The type of *note parameterized generics: 8c2. 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: 8c2.

          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: 9c9.

     Added in version 3.10.

     バージョン 3.14 で変更: This is now an alias for *note
     typing.Union: 2aa.

 -- クラス: types.TracebackType (tb_next, tb_frame, tb_lasti, tb_lineno)

     ‘sys.exception().__traceback__’ に含まれるようなトレースバックオブ
     ジェクトの型です。

     See *note the language reference: cf0. for details of the available
     attributes and operations, and guidance on creating tracebacks
     dynamically.

 -- データ: types.FrameType

     The type of *note frame objects: 8f0. such as found in *note
     tb.tb_frame: 2401. 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__: 1709.
     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__: e5b.

     Pythonの他の実装では、この型は ‘GetSetDescriptorType’ と同じかもし
     れません。

 -- クラス: types.MappingProxyType (mapping)

     読み出し専用のマッピングのプロキシです。マッピングのエントリーに関
     する動的なビューを提供します。つまり、マッピングが変わった場合にビ
     ューがこれらの変更を反映するということです。

     ‘MappingProxyType’s are *note generic: 2429. over two types,
     signifying (respectively) the types of the underlying mapping's
     keys and values.

     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: 2a69.

     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.9.10.3 追加のユーティリティクラスと関数
.........................................

 -- クラス: types.SimpleNamespace

     名前空間への属性アクセスに加えて意味のある repr を提供するための、
     単純な *note object: c82. サブクラスです。

     Unlike *note object: c82, with ‘SimpleNamespace’ you can add and
     remove attributes.

     ‘SimpleNamespace’ objects may be initialized in the same way as
     *note dict: 184.: 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: 12f5.
     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():
     1c2.

     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.9.10.4 コルーチンユーティリティ関数
.....................................

 -- の関数: types.coroutine (gen_func)

     この関数は、 *note generator: 1270. 関数を、ジェネレータベースのコ
     ルーチンを返す *note coroutine function: f77. に変換します。返され
     るジェネレータベースのコルーチンは依然として *note generator
     iterator: ddd. ですが、同時に *note coroutine: 6b9. オブジェクトか
     つ *note awaitable: 4c9. であるとみなされます。ただし、必ずしも
     *note __await__(): f79. メソッドを実装する必要はありません。

     'gen_func' はジェネレータ関数で、インプレースに変更されます。

     'gen_func' がジェネレータ関数でない場合、この関数はラップされます。
     この関数が *note collections.abc.Generator: fdf. のインスタンスを返
     す場合、このインスタンスは 'awaitable' なプロキシオブジェクトにラッ
     プされます。それ以外のすべての型のオブジェクトは、そのまま返されま
     す。

     Added in version 3.5.


File: python.info,  Node: copy --- 浅いコピーおよび深いコピー操作,  Next: pprint --- データの整形表示,  Prev: types --- 動的な型生成と組み込み型の名前,  Up: データ型

5.9.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(): d69. 関数では、これらの問題を以下のようにして回避して
います:

   * 現時点でのコピー過程ですでにコピーされたオブジェクトの ‘memo’ 辞書
     を保持する。

   * ユーザ定義のクラスでコピー操作やコピーされる内容の集合を上書きでき
     るようにする。

このモジュールでは、モジュール、メソッド、スタックトレース、スタックフレ
ーム、ファイル、ソケット、ウィンドウ、その他これらに類似の型をコピーしま
せん。このモジュールでは元のオブジェクトを変更せずに返すことで関数とクラ
スを (浅くまたは深く)「コピー」します。これは *note pickle: ab. モジュー
ルでの扱われかたと同じです。

Shallow copies of many collections can be made using the corresponding
‘copy()’ method (such as *note list.copy(): 2a70, *note dict.copy():
dcd. or *note set.copy(): 26f4.), and of sequences (such as lists or
bytearrays) by making a slice of the entire sequence (‘sequence[:]’).
However, these methods and slicing can create an instance of the base
type when copying an instance of a subclass, whereas *note copy.copy():
757. normally returns an instance of the same type.

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__(): 184a. and *note __deepcopy__():
17b7.

 -- メソッド: 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(): d69. 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(): d69, 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.9.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.9.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(): 117b. 関数の代わりに使用されることがあります。Tips：
     さらに、スコープ内で使用するために ‘print = pprint.pp’ を再代入する
     ことができます)。


     パラメータ:

        * ‘object’ - The object to be printed.

        * ‘stream’ (*note file-like object: 181a. | None) - A file-like
          object to which the output will be written by calling its
          ‘write()’ method.  If ‘None’ (the default), *note sys.stdout:
          cd1. is used.

        * ‘indent’ (*note int: 19c.) - 入れ子レベルごとに追加されるイン
          デントの量を指定します。

        * ‘width’ (*note int: 19c.) - 出力の1行あたり最大文字数を指定し
          ます。構造が幅の制約の中で整形できない場合、最善の努力がなされ
          ます。

        * ‘depth’ (*note int: 19c.‘ | ’‘None’) - 表示される入れ子レベル
          の数を制御します。表示されるデータ構造が深すぎる場合、含まれる
          次のレベルは''...''で置き換えられます。‘None’ （デフォルト）の
          場合、フォーマットされるオブジェクトの深さに制約はありません。

        * ‘compact’ (*note bool: 3c1.) - 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: 3c1.) - Trueの場合、辞書は辞書のキー
          順にソートされて整形されます。そうでなければ挿入順に表示されま
          す（デフォルト）。

        * ‘underscore_numbers’ (*note bool: 3c1.) - 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(): c1c. with 'sort_dicts' set to ‘True’ by
     default, which would automatically sort the dictionaries' keys, you
     might want to use ‘pp()’ 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: 1185.
     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(): 2a78. below and may raise an *note RecursionError: f6c.
     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: 184, *note list: 24f. 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.9.12.2 PrettyPrinter オブジェクト
...................................

 -- クラス: pprint.PrettyPrinter (indent=1, width=80, depth=None,
          stream=None, *, compact=False, sort_dicts=True,
          underscore_numbers=False)

     Construct a ‘PrettyPrinter’ instance.

     Arguments have the same meaning as for *note pp(): c1c.  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: 1185. インスタンスには以下のメソッドがあります:

 -- メソッド: PrettyPrinter.pformat (object)

     'object' の書式化した表現を返します。これは *note PrettyPrinter:
     1185. のコンストラクタに渡されたオプションを考慮して書式化されます
     。

 -- メソッド: PrettyPrinter.pprint (object)

     'object' の書式化した表現を指定したストリームに出力し、最後に改行し
     ます。

以下のメソッドは、対応する同じ名前の関数と同じ機能を持っています。以下の
メソッドをインスタンスに対して使うと、新たに *note PrettyPrinter: 1185.
オブジェクトを作る必要がないのでちょっぴり効果的です。

 -- メソッド: PrettyPrinter.isreadable (object)

     'object' を書式化して出力できる（"readable"）か、あるいは *note
     eval(): 4a3. を使って値を再構成できるかを返します。これは再帰的なオ
     ブジェクトに対して ‘False’ を返すことに注意して下さい。もし *note
     PrettyPrinter: 1185. の 'depth' 引数が設定されていて、オブジェクト
     のレベルが設定よりも深かったら、 ‘False’ を返します。

 -- メソッド: PrettyPrinter.isrecursive (object)

     オブジェクトが再帰的な表現かどうかを返します。

このメソッドをフックとして、サブクラスがオブジェクトを文字列に変換する方
法を修正するのが可能になっています。デフォルトの実装では、内部で *note
saferepr(): 2a78. を呼び出しています。

 -- メソッド: PrettyPrinter.format (object, context, maxlevels, level)

     次の3つの値を返します。'object' をフォーマット化して文字列にしたも
     の、その結果が読み込み可能かどうかを示すフラグ、再帰が含まれている
     かどうかを示すフラグ。最初の引数は表示するオブジェクトです。 2つめ
     の引数はオブジェクトの *note id(): 1641. をキーとして含むディクショ
     ナリで、オブジェクトを含んでいる現在の（直接、間接に 'object' のコ
     ンテナとして表示に影響を与える）環境です。ディクショナリ 'context'
     の中でどのオブジェクトが表示されたか表示する必要があるなら、3つめの
     返り値は ‘True’ になります。 *note format(): 1d45. メソッドの再帰呼
     び出しではこのディクショナリのコンテナに対してさらにエントリを加え
     ます。 3つめの引数 'maxlevels' で再帰呼び出しのレベルを制限します。
     制限しない場合、 ‘0’ になります。この引数は再帰呼び出しでそのまま渡
     されます。 4つめの引数 'level' で現在のレベルを設定します。再帰呼び
     出しでは、現在の呼び出しより小さい値が渡されます。


File: python.info,  Node: 使用例<6>,  Prev: PrettyPrinter オブジェクト,  Up: pprint --- データの整形表示

5.9.12.3 使用例
...............

*note pp(): c1c. 関数のいくつかの用途とそのパラメータを実証するために、
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(): c1c. はオブジェクト全体を表示します:

     >>> 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.9.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(): 1c3. に似た関数を実装するために役に立つ
     フォーマット用サービスを提供します。 過度に長い表現を作り出さないよ
     うにするための大きさの制限をオブジェクト型ごとに設定できます。

     The keyword arguments of the constructor can be used as a shortcut
     to set the attributes of the ‘Repr’ instance.  Which means that the
     following initialization:

          aRepr = reprlib.Repr(maxlevel=3)

     は、次のコードと等しいです:

          aRepr = reprlib.Repr()
          aRepr.maxlevel = 3

     See section *note Repr Objects: 2a85. for more information about
     ‘Repr’ attributes.

     バージョン 3.12 で変更: Allow attributes to be set via keyword
     arguments.

 -- データ: reprlib.aRepr

     これは下で説明される *note repr(): 2a87. 関数を提供するために使われ
     る *note Repr: 2a84. のインスタンスです。このオブジェクトの属性を変
     更すると、 ‘repr()’ と Python デバッガが使うサイズ制限に影響します
     。

 -- の関数: reprlib.repr (obj)

     これは ‘aRepr’ の *note repr(): 2a88. メソッドです。同じ名前の組み
     込み関数が返す文字列と似ていますが、最大サイズに制限のある文字列を
     返します。

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.9.13.1 Reprオブジェクト
.........................

*note Repr: 2a84. インスタンスはオブジェクト型毎に表現する文字列のサイズ
を制限するために使えるいくつかの属性と、特定のオブジェクト型をフォーマッ
トするメソッドを提供します。

 -- の属性: 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: 2a8c. に対するデフォルトは ‘4’ で、 *note maxarray:
     2a92. は ‘5’ 、その他に対しては ‘6’ です。

 -- の属性: Repr.maxlong

     整数の表現のおける文字数の最大値。中央の数字が抜け落ちます。デフォ
     ルトは ‘40’ です。

 -- の属性: Repr.maxstring

     文字列の表現における文字数の制限。文字列の"通常の"表現は文字の「元
     」として使われることに注意してください。表現にエスケープシーケンス
     が必要とされる場合、表現が短縮されるときにこれらのエスケープシーケ
     ンスの形式は崩れます。デフォルトは ‘30’ です。

 -- の属性: Repr.maxother

     この制限は *note Repr: 2a84. オブジェクトに利用できる特定のフォーマ
     ットメソッドがないオブジェクト型のサイズをコントロールするために使
     われます。 *note maxstring: 2a94. と同じようなやり方で適用されます
     。デフォルトは ‘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(): 1c3.  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 ‘indent’ 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 ‘indent’ 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(): 1c3. と等価なもの。

 -- メソッド: Repr.repr1 (obj, level)

     *note repr(): 2a88. が使う再帰的な実装。 'obj' の型を使ってどのフォ
     ーマットメソッドを呼び出すかを決定し、それに 'obj' と 'level' を渡
     します。 再帰呼び出しにおいて 'level' の値に対して ‘level - 1’ を与
     える再帰的なフォーマットを実行するために、型に固有のメソッドは
     *note repr1(): 2a97. を呼び出します。

 -- メソッド: Repr.repr_TYPE (obj, level)

     型名に基づく名前をもつメソッドとして、特定の型に対するフォーマット
     メソッドは実装されます。メソッド名では、 'TYPE' は
     ‘'_'.join(type(obj).__name__.split())’ に置き換えられます。これらの
     メソッドへのディスパッチは *note repr1(): 2a97. によって処理されま
     す。再帰的に値をフォーマットする必要がある型固有のメソッドは、
     ‘self.repr1(subobj, level - 1)’ を呼び出します。


File: python.info,  Node: Reprオブジェクトをサブクラス化する,  Prev: Reprオブジェクト,  Up: reprlib --- もう一つの repr の実装

5.9.13.2 Reprオブジェクトをサブクラス化する
...........................................

The use of dynamic dispatching by *note Repr.repr1(): 2a97. allows
subclasses of *note Repr: 2a84. 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.9.14 ‘enum’ -- 列挙型のサポート
---------------------------------

Added in version 3.4.

'ソースコード:' Lib/enum.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 2a9d.

   * *note 上級チュートリアル: 2a9e.

   * *note Enum クックブック: 2a9f.

__________________________________________________________________

列挙型とは:

   * 一意の値に紐付けられたシンボリックな名前の集合です

   * 反復可能であり、定義順にその正規の（エイリアスでない）メンバーを返
     します

   * 値を渡してメンバーを返すために、 '呼び出し' 構文を使用します

   * 名前を受け取ってメンバーを返すために、 'インデックス' 構文を使用し
     ます

列挙型は、*note class: 14f3. 構文を使用するか、関数呼び出し構文を使用し
て作成されます:

     >>> 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: 14f3. 文を使用できるものの、Enum は通常の
Python クラスではありません。詳細は *note Enum はどう違うのか?: 2aa0. を
参照してください。

     注釈: 用語

        - クラス ‘Color’ は '列挙型' (または 'Enum') です

        - 属性 ‘Color.RED’, ‘Color.GREEN’ などは '列挙型のメンバー' (ま
          たは 'メンバー') で、機能的には定数です。

        - 列挙型のメンバーは '名前' と '値' を持ちます (‘Color.RED’ の名
          前は ‘RED’ 、 ‘Color.BLUE’ の値は ‘3’ など。)

__________________________________________________________________

* Menu:

* モジュールの内容::
* データ型: データ型<2>.
* Utilities and decorators::
* 注釈::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/enum.py


File: python.info,  Node: モジュールの内容,  Next: データ型<2>,  Up: enum --- 列挙型のサポート

5.9.14.1 モジュールの内容
.........................

     *note EnumType: 4f7.

          Enumおよびそのサブクラスのための ‘type’ です。

     *note Enum: 842.

          列挙型定数を作成する基底クラスです。

     *note IntEnum: edf.

          *note int: 19c. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2aa2.)

     *note StrEnum: 82d.

          *note str: 16a. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2aa2.)

     *note Flag: 835.

          列挙型定数を作成する基底クラスで、ビット演算を使って組み合わせ
          られ、その結果も *note Flag: 835. メンバーになります。

     *note IntFlag: e9e.

          列挙型定数を作成する基底クラスで、ビット演算子を使って組み合わ
          せられ、その結果も *note IntFlag: e9e. メンバーになります。
          ‘IntFlag’ は *note int: 19c. のサブクラスでもあります。(*note
          Notes: 2aa2.)

     *note ReprEnum: 82e.

          *note IntEnum: edf.、*note StrEnum: 82d.、および *note
          IntFlag: e9e. によって使用され、mix-inされた型の *note str():
          16a. を保持します。

     *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: 184. for use when subclassing *note
          EnumType: 4f7.

     *note auto: e9f.

          インスタンスは列挙型のメンバーに適切な値で置き換えられます。
          *note StrEnum: 82d. ではデフォルトの値がメンバー名を小文字にし
          たものですが、その他の列挙型のデフォルトは1から連番で増加する
          値となります。

     *note property(): 83b.

          メンバー名との競合を避けながら *note Enum: 842. メンバーに属性
          を持たせます。‘value’ 属性と ‘name’ 属性はこの方法で実装されま
          す。

     *note unique(): 2aa3.

          一つの名前だけがひとつの値に束縛されていることを保証する 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(): 16a. and *note repr(): 1c3. 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(): 2aa4.

          フラグに含まれる、全ての2の累乗の整数のリストを返します。

     *note enum.bin(): 17fd.

          Like built-in *note bin(): 14c4, 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: Utilities and decorators,  Prev: モジュールの内容,  Up: enum --- 列挙型のサポート

5.9.14.2 データ型
.................

 -- クラス: enum.EnumType

     'EnumType' は 'enum' 列挙型の *note メタクラス: 2430. です。
     'EnumType' のサブクラスを作成することが可能です - 詳細は *note
     EnumTypeのサブクラスを作る: 2aa6. を参照してください。

     ‘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: e9f. で使用さ
                    れます）。


                    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)

          Returns the number of members in '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__(): 2ab1.

               注釈: 列挙型のメンバー値

               メンバー値は何であっても構いません: *note int: 19c, *note
               str: 16a. などなど。 正確な値が重要でない場合は、 *note
               auto: e9f. インスタンスを使っておくと、適切な値が選ばれま
               す。 詳細は ‘auto’ を参照してください。

               While mutable/unhashable values, such as *note dict: 184,
               *note list: 24f. 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__(): 2ab1.

      -- の属性: _order_

          No longer used, kept for backward compatibility.  (class
          attribute, removed during class creation).

          The ‘_order_’ attribute can be provided to help keep Python 2
          / Python 3 code in sync.  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 ‘_order_’ attribute is
               necessary as definition order is lost before it can be
               recorded.

          Added in version 3.6.

      -- の属性: _ignore_

          ‘_ignore_’ は列挙の作成中にのみ使用され、作成が完了すると削除
          されます。

          ‘_ignore_’ は、メンバーにならず、作成された列挙から削除される
          名前のリストです。例については、*note TimePeriod: 2ab6. を参照
          してください。

          Added in version 3.7.

      -- メソッド: __dir__ (self)

          Returns ‘['__class__', '__doc__', '__module__', 'name',
          'value']’ and any public methods defined on 'self.__class__':

               >>> from enum import Enum
               >>> import datetime as dt
               >>> class Weekday(Enum):
               ...     MONDAY = 1
               ...     TUESDAY = 2
               ...     WEDNESDAY = 3
               ...     THURSDAY = 4
               ...     FRIDAY = 5
               ...     SATURDAY = 6
               ...     SUNDAY = 7
               ...     @classmethod
               ...     def today(cls):
               ...         print(f'today is {cls(dt.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: 定義済みの値のリスト。

          A 'staticmethod' that is used to determine the next value
          returned by *note auto: e9f.

               注釈: 標準の *note Enum: 842. クラスの場合、次の値として
               選択されるのは、定義された最大の値に1を加えたものです。

               *note Flag: 835. クラスでは、次に選ばれる値は、次の最大の
               2のべき乗となります。

          This method may be overridden, e.g.:

               >>> 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

          Added in version 3.6.

          バージョン 3.13 で変更: 以前のバージョンでは最大の値ではなく最
          後に定義された値を使っていました。

      -- メソッド: __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'>

          Added in version 3.6.

      -- メソッド: __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: e9f. を使用すると、 ‘1’
          から始まりインクリメントする整数が値となります。

     バージョン 3.12 で変更: Added *note データクラスのサポート: 1b57.

      -- メソッド: _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: 450. 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: 2ee. if the value is already linked with a different member.
               See *note MultiValueEnum: 2abd. for an example.

          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: edf. で *note auto: e9f. を使用すると、
          ‘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: 16a. instead of a ‘str’ 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: e9f. を使用すると、メ
          ンバー名を小文字に変換したものが値となります。

          注釈: *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():
          14eb. and *note oct(): 14ea.

          注釈: *note auto: e9f. と *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(): 1c3. of unnamed zero-valued flags has changed.
     It is now:

          >>> Color(0)
          <Color: 0>

          注釈: *note auto: e9f. と *note IntFlag: e9e. を一緒に使うと、
          ‘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(): 1b58. of *note Enum: 842, but the
     *note str(): 16a. of the mixed-in data type:

        * ‘int.__str__()’ for *note IntEnum: edf. and *note IntFlag:
          e9e.

        * ‘str.__str__()’ for *note StrEnum: 82d.

     ‘ReprEnum’ を継承することで、*note Enum: 842. デフォルトの *note
     str(): 834. を使用する代わりに、mix-inされたデータ型の *note str():
     16a. / *note format(): 19a. を使用します。

     Added in version 3.11.

 -- クラス: enum.EnumCheck

     'EnumCheck' には *note verify(): 837. デコレータやさまざまな制約を
     保証するために使用されるオプションが含まれています。制約に違反する
     と *note ValueError: 2ee. が発生します。

      -- の属性: 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(): e9f. によっ
          て生成される場合に便利です:

               >>> 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: 2ee. を送出します。これは *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: 19c.

               >>> 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:
          e9e.:

               >>> 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: 184. that is used as the
     namespace for defining enum classes (see *note
     クラスの名前空間の準備: e5c.).  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: 12c4. interface (*note
     __setitem__(): 14e7. and *note update(): 1683.) is overridden.  It
     may be possible to bypass the checks using other ‘dict’ operations
     like *note |=: 2461.

      -- の属性: 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.9.14.3 ‘__dunder__’ 名のサポート
..................................

*note __members__: 2aad. は読み込み専用の、 ‘member_name’:‘member’ を要
素とする順序付きマッピングです。これはクラスでのみ利用可能です。

*note __new__(): 2ab1, if specified, must create and return the enum
members; it is also a very good idea to set the member's *note _value_:
2ab3. appropriately.  Once all the members are created it is no longer
used.


File: python.info,  Node: _sunder_ 名のサポート,  Prev: __dunder__ 名のサポート,  Up: データ型<2>

5.9.14.4 ‘_sunder_’ 名のサポート
................................

   - *note _name_: 2ab2. - メンバー名

   - *note _value_: 2ab3. - メンバーの値; ‘__new__’ で設定できます

   - *note _missing_(): 2aba. - 値が見付からなかったときに使われる検索関
     数; オーバーライドされていることがあります

   - *note _ignore_: 2ab5. - 名前のリストで、 *note list: 24f. もしくは
     *note str: 16a. です。この名前の要素はメンバーへの変換が行われず、
     最終的なクラスから削除されます。

   - *note _order_: 2ab4. - no longer used, kept for backward
     compatibility (class attribute, removed during class creation)

   - *note _generate_next_value_(): 2ab7. - 列挙型のメンバーの適切な値を
     取得するのに使われます。オーバーライドされます。

   - *note _add_alias_(): 2abb. - adds a new name as an alias to an
     existing member.

   - *note _add_value_alias_(): 2abc. - 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: Utilities and decorators,  Next: 注釈,  Prev: データ型<2>,  Up: enum --- 列挙型のサポート

5.9.14.5 Utilities and decorators
.................................

 -- クラス: 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_(): 2ab7. to get an appropriate value.  For
     ‘Enum’ and *note IntEnum: edf. that appropriate value will be the
     last value plus one; for *note Flag: 835. and *note IntFlag: e9e.
     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' が使用する値をカスタマイズする
     ためにオーバーライドすることができる。

          注釈: in 3.13 the default ‘_generate_next_value_’ will always
          return the highest member value incremented by 1, and will
          fail if any member is an incompatible type.

 -- の関数: @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: 14f3. デコレーターです。列挙型の *note
     __members__: 2aad. に別名がないかどうか検索します; 見つかった場合、
     *note ValueError: 2ee. が詳細情報とともに送出されます:

          >>> 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: 14f3. デコレーターです。対象の列挙型に対
     してチェックを行う制約の指定には *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(): 16a. and *note repr(): 1c3.
     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 ‘bin()’, 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: Utilities and decorators,  Up: enum --- 列挙型のサポート

5.9.14.6 注釈
.............

*note IntEnum: edf. 、 *note StrEnum: 82d. 、 *note IntFlag: e9e.

     これらの3つの列挙型は、既存の整数ベースおよび文字列ベースの値の代替
     として設計されています。そのため、追加の制限があります:

        - ‘__str__’ は、列挙型のメンバーの名前ではなく値を使用します

        - ‘__format__’ は ‘__str__’ を使用するため、列挙型のメンバーの名
          前ではなく値を使用します

     もし、そのような制限が必要でない/望まない場合は、‘int’ または ‘str’
     タイプを継承して、カスタムの基底クラスを作成することができます:

          >>> from enum import Enum
          >>> class MyIntEnum(int, Enum):
          ...     pass

     または列挙型の中で適切な *note str(): 16a. などを再代入することもで
     きます:

          >>> from enum import Enum, IntEnum
          >>> class MyIntEnum(IntEnum):
          ...     __str__ = Enum.__str__


File: python.info,  Node: graphlib --- グラフ構造を操作する機能,  Prev: enum --- 列挙型のサポート,  Up: データ型

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

'ソースコード:' Lib/graphlib.py(1)

__________________________________________________________________

 -- クラス: graphlib.TopologicalSorter (graph=None)

     *note ハッシュ可能: 824. な頂点のグラフをトポロジカルソートする機能
     を提供します。

     トポロジカル順序はグラフの頂点の線形順序で、頂点 u から 頂点 v への
     有向辺 u-> v 全てについて、頂点 u が頂点 v よりも前にくるような順序
     です。例えば、グラフの頂点が実行するタスクを表し、その辺があるタス
     クが別のタスクよりも前に実行されなければならないという制約を表す場
     合、トポロジカル順序は制約を満たすタスクの実行順序のシーケンスにな
     ります。トポロジカル順序が得られるのは、グラフが有向閉路を持たない
     、つまり有向非巡回グラフである場合でかつその時に限ります。

     もしオプションの 'graph' 引数が与えられた場合、その値は有向非巡回グ
     ラフを表す辞書でなければならず、辞書はそのキーがノードで、その値は
     キーのノードの先行ノードのイテラブルとなります（言い換えると、辞書
     の値はそのキーのノードを指す辺を持つノードのイテラブルです） 辺
     *note add(): 2ad7. メソッドを使うことで、さらにノードを追加すること
     ができます。

     一般的に、与えられたグラフのソートの実行に必要なステップは以下のよ
     うになります:

        * *note TopologicalSorter: ae2. のインスタンスをオプションの初期
          グラフで生成します。

        * さらにノードをグラフに追加します。

        * *note prepare(): 221. をグラフ上で呼び出します。

        * *note is_active(): 2ad8. が ‘True’ の間、 *note get_ready():
          2ad9. によって返されたノード群をイテレートし、それらを処理しま
          す。ノードの処理が終わる都度、*note done(): 2ada. を呼び出しま
          す。

     すぐにグラフのノードをソートした結果が必要で、並行性が不要な場合、
     便利なメソッド *note TopologicalSorter.static_order(): 2adb. を直接
     呼び出すことができます:

          >>> 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(): 221. を呼び出した後にこのメソッドを呼び出すと
          、*note ValueError: 2ee. を送出します。

      -- メソッド: prepare ()

          Mark the graph as finished and check for cycles in the graph.
          If any cycle is detected, *note CycleError: 2adc. will be
          raised, but *note get_ready(): 2ad9. 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(): 2ad7.

          A *note ValueError: 2ee. will be raised if the sort has been
          started by *note static_order(): 2adb. or *note get_ready():
          2ad9.

          バージョン 3.14 で変更: ‘prepare()’ can now be called more
          than once as long as the sort has not started.  Previously
          this raised *note ValueError: 2ee.

      -- メソッド: 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():
          2ad9. or the number of nodes marked *note
          TopologicalSorter.done(): 2ada. is less than the number that
          have been returned by ‘TopologicalSorter.get_ready()’.

          The *note __bool__(): 14f1. method of this class defers to
          this function, so instead of:

               if ts.is_active():
                   ...

          このように簡単に記述できます:

               if ts:
                   ...

          前もって *note prepare(): 221. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 2ee. を送出します。

      -- メソッド: done (*nodes)

          Marks a set of nodes returned by *note
          TopologicalSorter.get_ready(): 2ad9. as processed, unblocking
          any successor of each node in 'nodes' for being returned in
          the future by a call to ‘TopologicalSorter.get_ready()’.

          Raises *note ValueError: 2ee. 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(): 2ad7, if called without calling *note
          prepare(): 221. or if node has not yet been returned by *note
          get_ready(): 2ad9.

      -- メソッド: 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(): 2ada, 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(): 221. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 2ee. を送出します。

      -- メソッド: static_order ()

          Returns an iterator object which will iterate over nodes in a
          topological order.  When using this method, *note prepare():
          221. and *note done(): 2ada. 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(): 2ad9.) and the order between them is
          determined by the order of insertion.

          If any cycle is detected, *note CycleError: 2adc. 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.9.15.1 例外
.............

The ‘graphlib’ module defines the following exception classes:

 -- 例外: graphlib.CycleError

     Subclass of *note ValueError: 2ee. raised by *note
     TopologicalSorter.prepare(): 221. 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.10 数値と数学モジュール
=========================

この章で記述されているモジュールは、数値に関するあるいは数学関係の関数と
データ型を提供します。 *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.10.1 ‘numbers’ -- 数の抽象基底クラス
--------------------------------------

'ソースコード:' Lib/numbers.py(1)

__________________________________________________________________

The ‘numbers’ module ( PEP 3141(2)) defines a hierarchy of numeric *note
abstract base classes: 13d2. 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.10.1.1 数値塔
...............

 -- クラス: numbers.Complex

     この型のサブクラスは複素数を表し、組み込みの *note complex: 198. 型
     を受け付ける演算を含みます。それらは: ‘complex’ および *note bool:
     3c1. への変換、 *note real: 2ae6, *note imag: 2ae7, ‘+’, ‘-’, ‘*’,
     ‘/’, ‘**’, *note abs(): 20e9, *note conjugate(): 2ae8, ‘==’, ‘!=’ で
     す。 ‘-’ と ‘!=’ 以外の全てのものは抽象メソッドや抽象プロパティです
     。

      -- の属性: real

          抽象プロパティ。この数の実部を取り出します。

      -- の属性: imag

          抽象プロパティ。この数の虚部を取り出します。

      -- メソッド: abstractmethod conjugate ()

          抽象プロパティ。複素共役を返します。たとえば、
          ‘(1+3j).conjugate() == (1-3j)’ です。

 -- クラス: numbers.Real

     To *note Complex: 265b, ‘Real’ adds the operations that work on
     real numbers.

     簡潔に言うとそれらは: *note float: 197. への変換, *note
     math.trunc(): 15dd, *note round(): 14f6, *note math.floor(): 15db,
     *note math.ceil(): 15dc, *note divmod(): b9d, ‘//’, ‘%’, ‘<’, ‘<=’,
     ‘>’ および ‘>=’ です。

     Real はまた *note complex(): 198, *note real: 2ae6, *note imag:
     2ae7. および *note conjugate(): 2ae8. のデフォルトを提供します。

 -- クラス: numbers.Rational

     *note Real: 2651. をサブタイプ化し *note numerator: 2ae9. と *note
     denominator: 2aea. のプロパティを加えたものです。これは *note
     float(): 197. のデフォルトも提供します。

     The *note numerator: 2ae9. and *note denominator: 2aea. values
     should be instances of *note Integral: 246a. and should be in
     lowest terms with ‘denominator’ positive.

      -- の属性: numerator

          Abstract.  The numerator of this rational number.

      -- の属性: denominator

          Abstract.  The denominator of this rational number.

 -- クラス: numbers.Integral

     *note Rational: 14da. をサブタイプ化し *note int: 19c. への変換が加
     わります。 *note float(): 197, *note numerator: 2ae9, *note
     denominator: 2aea. のデフォルトを提供します。法 (訳注: 割る数、除数
     のこと) を持つ *note pow(): 1a5. に対する抽象メソッドと、ビット列演
     算 ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’, ‘~’ を追加します。


File: python.info,  Node: Notes for type implementers,  Prev: 数値塔,  Up: numbers --- 数の抽象基底クラス

5.10.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:
215. 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.10.1.3 さらに数のABCを追加する
................................

数に対する ABC が他にも多く存在しうることは、言うまでもありません。それ
らの ABC を階層に追加する可能性が閉ざされるとしたら、その階層は貧相な階
層でしかありません。たとえば、 ‘MyFoo’ を *note Complex: 265b. と *note
Real: 2651. の間に付け加えるには、次のようにします:

     class MyFoo(Complex): ...
     MyFoo.register(Real)


File: python.info,  Node: 算術演算の実装,  Prev: さらに数のABCを追加する,  Up: Notes for type implementers

5.10.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: 246a, this
means that *note __add__(): 243d. and *note __radd__(): 243e. 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: 265b. のサブクラス間の混在型の演算が
あります。上のコードの中で ‘MyIntegral’ と ‘OtherTypeIKnowAbout’ に触れ
ない部分を "ボイラープレート" と呼ぶことにしましょう。 ‘a’ を ‘Complex’
のサブタイプである ‘A’ のインスタンス (‘a : A <: Complex’)、同様に ‘b :
B <: Complex’ として、 ‘a + b’ を考えます:

  1. If ‘A’ defines an *note __add__(): 243d. 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__(): 243d, we'd miss the possibility that
     ‘B’ defines a more intelligent *note __radd__(): 243e, so the
     boilerplate should return *note NotImplemented: 1a3. from
     ‘__add__()’.  (Or ‘A’ may not implement ‘__add__()’ at all.)

  3. Then ‘B’'s *note __radd__(): 243e. gets a chance.  If it accepts
     ‘a’, all is well.

  4. ここでボイラープレートに落ち込むならば、もう他に試すべきメソッドは
     ありませんので、デフォルト実装の出番です。

  5. もし ‘B <: A’ ならば、Python は ‘A.__add__’ の前に ‘B.__radd__’ を
     試します。これで良い理由は、 ‘A’ についての知識を持って実装しており
     、 *note Complex: 265b. に委ねる前にこれらのインスタンスを扱えるは
     ずだからです。

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: 198, and both *note __radd__(): 243e. s land there, so
‘a+b == b+a’.

ほとんどの演算はどのような型についても非常に良く似ていますので、与えられ
た演算子について順結合(forward)および逆結合(reverse)のメソッドを生成する
支援関数を定義することは役に立ちます。たとえば、 *note
fractions.Fraction: 215. では次のようなものを利用しています:

     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.10.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): 8e0.                                   Number of ways to choose 'k' items from 'n' items without repetition and without order
                                                         
                                                         
*note factorial(n): b45.                                 'n' の階乗
                                                         
                                                         
*note gcd(*integers): b10.                               整数引数の最大公約数
                                                         
                                                         
*note isqrt(n): bfc.                                     Integer square root of a nonnegative integer 'n'
                                                         
                                                         
*note lcm(*integers): b11.                               Least common multiple of the integer arguments
                                                         
                                                         
*note perm(n, k): 8e1.                                   Number of ways to choose 'k' items from 'n' items without repetition and with order
                                                         
                                                         
'Floating point arithmetic'

*note ceil(x): 15dc.                                     Ceiling of 'x', the smallest integer greater than or equal to 'x'
                                                         
                                                         
*note fabs(x): 2af1.                                     'x' の絶対値
                                                         
                                                         
*note floor(x): 15db.                                    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): 2528.                                  ‘x / y’ の剰余
                                                         
                                                         
*note modf(x): 2af2.                                     Fractional and integer parts of 'x'
                                                         
                                                         
*note remainder(x, y): d4e.                              Remainder of 'x' with respect to 'y'
                                                         
                                                         
*note trunc(x): 15dd.                                    'x' の整数部
                                                         
                                                         
'Floating point manipulation functions'

*note copysign(x, y): 15f1.                              Magnitude (absolute value) of 'x' with the sign of 'y'
                                                         
                                                         
*note frexp(x): 2af3.                                    Mantissa and exponent of 'x'
                                                         
                                                         
*note isclose(a, b, rel_tol, abs_tol): fb4.              Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
*note isfinite(x): 1408.                                 Check if 'x' is neither an infinity nor a NaN
                                                         
                                                         
*note isinf(x): 15ef.                                    Check if 'x' is a positive or negative infinity
                                                         
                                                         
*note isnan(x): 15f0.                                    Check if 'x' is a NaN (not a number)
                                                         
                                                         
*note ldexp(x, i): 18a5.                                 ‘x * (2**i)’, inverse of function *note frexp(): 2af3.
                                                         
                                                         
*note nextafter(x, y, steps): 6c0.                       Floating-point value 'steps' steps after 'x' towards 'y'
                                                         
                                                         
*note ulp(x): b12.                                       Value of the least significant bit of 'x'
                                                         
                                                         
'Power, exponential and logarithmic functions'

*note cbrt(x): 872.                                      'x' の立方根
                                                         
                                                         
*note exp(x): 152f.                                      'e' raised to the power 'x'
                                                         
                                                         
*note exp2(x): 871.                                      '2' raised to the power 'x'
                                                         
                                                         
*note expm1(x): 1409.                                    'e' raised to the power 'x', minus 1
                                                         
                                                         
*note log(x, base): 16de.                                Logarithm of 'x' to the given base ('e' by default)
                                                         
                                                         
*note log1p(x): 15f6.                                    Natural logarithm of '1+x' (base 'e')
                                                         
                                                         
*note log2(x): 12f7.                                     2を底とする 'x' の対数
                                                         
                                                         
*note log10(x): 19a8.                                    10を底とする 'x' の対数
                                                         
                                                         
*note pow(x, y): 873.                                    'x' の 'y' 乗
                                                         
                                                         
*note sqrt(x): bfd.                                      'x' の平方根
                                                         
                                                         
'Summation and product functions'

*note dist(p, q): bf9.                                   Euclidean distance between two points 'p' and 'q' given as an iterable of coordinates
                                                         
                                                         
*note fsum(iterable): 15f2.                              Sum of values in the input 'iterable'
                                                         
                                                         
*note hypot(*coordinates): bfa.                          Euclidean norm of an iterable of coordinates
                                                         
                                                         
*note prod(iterable, start): bfb.                        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): 2af4.                                  Convert angle 'x' from radians to degrees
                                                         
                                                         
*note radians(x): 2af5.                                  Convert angle 'x' from degrees to radians
                                                         
                                                         
'Trigonometric functions'

*note acos(x): 2af6.                                     'x' の逆余弦
                                                         
                                                         
*note asin(x): 2af7.                                     'x' の逆正弦
                                                         
                                                         
*note atan(x): 2af8.                                     'x' の逆正接
                                                         
                                                         
*note atan2(y, x): 2af9.                                 ‘atan(y / x)’
                                                         
                                                         
*note cos(x): 16dd.                                      'x' の余弦
                                                         
                                                         
*note sin(x): 16dc.                                      'x' の正弦
                                                         
                                                         
*note tan(x): 2afa.                                      'x' の正接
                                                         
                                                         
'Hyperbolic functions'

*note acosh(x): 15f3.                                    Inverse hyperbolic cosine of 'x'
                                                         
                                                         
*note asinh(x): 15f4.                                    Inverse hyperbolic sine of 'x'
                                                         
                                                         
*note atanh(x): 15f5.                                    Inverse hyperbolic tangent of 'x'
                                                         
                                                         
*note cosh(x): 2afb.                                     Hyperbolic cosine of 'x'
                                                         
                                                         
*note sinh(x): 2afc.                                     Hyperbolic sine of 'x'
                                                         
                                                         
*note tanh(x): 2afd.                                     Hyperbolic tangent of 'x'
                                                         
                                                         
'Special functions'

*note erf(x): dd7.                                       Error function(1) at 'x'
                                                         
                                                         
*note erfc(x): dd8.                                      Complementary error function(2) at 'x'
                                                         
                                                         
*note gamma(x): 140a.                                    Gamma function(3) at 'x'
                                                         
                                                         
*note lgamma(x): 140b.                                   Natural logarithm of the absolute value of the Gamma function(4) at 'x'
                                                         
                                                         
'定数'

*note pi: 2afe.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2aff.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: 2b00.                                         'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: e82.                                          正の無限大
                                                         
                                                         
*note nan: 874.                                          非数 "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.10.2.1 Number-theoretic functions
...................................

 -- の関数: math.comb (n, k)

     Return the number of ways to choose 'k' items from 'n' items
     without repetition and without order.

     Evaluates to ‘n! / (k! * (n - k)!)’ when ‘k <= n’ and evaluates to
     zero when ‘k > n’.

     Also called the binomial coefficient because it is equivalent to
     the coefficient of k-th term in polynomial expansion of ‘(1 + x)ⁿ’.

     Raises *note TypeError: 199. if either of the arguments are not
     integers.  Raises *note ValueError: 2ee. if either of the arguments
     are negative.

     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)

     Return the greatest common divisor of the specified integer
     arguments.  If any of the arguments is nonzero, then the returned
     value is the largest positive integer that is a divisor of all
     arguments.  If all arguments are zero, then the returned value is
     ‘0’.  ‘gcd()’ without arguments returns ‘0’.

     Added in version 3.5.

     バージョン 3.9 で変更: Added support for an arbitrary number of
     arguments.  Formerly, only two arguments were supported.

 -- の関数: math.isqrt (n)

     Return the integer square root of the nonnegative integer 'n'.
     This is the floor of the exact square root of 'n', or equivalently
     the greatest integer 'a' such that 'a'² ≤ 'n'.

     For some applications, it may be more convenient to have the least
     integer 'a' such that 'n' ≤ 'a'², or in other words the ceiling of
     the exact square root of 'n'.  For positive 'n', this can be
     computed using ‘a = 1 + isqrt(n - 1)’.

     Added in version 3.8.

 -- の関数: math.lcm (*integers)

     Return the least common multiple of the specified integer
     arguments.  If all arguments are nonzero, then the returned value
     is the smallest positive integer that is a multiple of all
     arguments.  If any of the arguments is zero, then the returned
     value is ‘0’.  ‘lcm()’ without arguments returns ‘1’.

     Added in version 3.9.

 -- の関数: math.perm (n, k=None)

     Return the number of ways to choose 'k' items from 'n' items
     without repetition and with order.

     Evaluates to ‘n! / (n - k)!’ when ‘k <= n’ and evaluates to zero
     when ‘k > n’.

     If 'k' is not specified or is ‘None’, then 'k' defaults to 'n' and
     the function returns ‘n!’.

     Raises *note TypeError: 199. if either of the arguments are not
     integers.  Raises *note ValueError: 2ee. if either of the arguments
     are negative.

     Added in version 3.8.


File: python.info,  Node: Floating point arithmetic,  Next: Floating point manipulation functions,  Prev: Number-theoretic functions,  Up: math --- 数学関数

5.10.2.2 Floating point arithmetic
..................................

 -- の関数: math.ceil (x)

     'x' の「天井」 ('x' 以上の最小の整数) を返します。 'x' が浮動小数点
     数でなければ、内部的に *note x.__ceil__: 2469. が実行され、 *note
     Integral: 246a. 値が返されます。

 -- の関数: math.fabs (x)

     'x' の絶対値を返します。

 -- の関数: math.floor (x)

     'x' の「床」 ('x' 以下の最大の整数) を返します。 'x' が浮動小数点数
     でなければ、内部的に *note x.__floor__: 2468. が実行され、 *note
     Integral: 246a. 値が返されます。

 -- の関数: 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 ‘fmod()’ 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 ‘modf()’ 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:
     2ee. を送出します。 剰余演算の結果がゼロの場合、そのゼロは '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(): 15db.
     に等しく、負の 'x' に対しては *note ceil(): 15dc. に等しいです。'x'
     が浮動小数点数でなければ、内部的に *note x.__trunc__: 19d. が実行さ
     れ、 *note Integral: 246a. 値が返されます。

*note ceil(): 15dc. 、 *note floor(): 15db. 、および *note modf(): 2af2.
関数については、非常に大きな浮動小数点数が '全て' 整数そのものになるとい
うことに注意してください。通常、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.10.2.3 Floating point manipulation functions
..............................................

 -- の関数: math.copysign (x, y)

     'x' の大きさ (絶対値) で 'y' と同じ符号の浮動小数点数を返します。符
     号付きのゼロをサポートしているプラットフォームでは、‘copysign(1.0,
     -0.0)’ は '-1.0' を返します。

 -- の関数: math.frexp (x)

     Return the mantissa and exponent of 'x' as the pair ‘(m, e)’.  If
     'x' is a finite nonzero number, then 'm' is a float with ‘0.5 <=
     abs(m) < 1.0’ and an integer 'e' is such that ‘x == m * 2**e’
     exactly.  Else, return ‘(x, 0)’.  This is used to "pick apart" the
     internal representation of a float in a portable way.

     Note that ‘frexp()’ 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(): 2af3. の逆関
     数です。

 -- の関数: 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(): b12. を参照してください。

     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: 1e2b. よりも小さい) 最小の正の表現可能な
          '非正規化' 浮動小数点数を返します。

        * '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:
     1e2b. も参照してください。

     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.10.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
     ‘expm1()’ 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(): 2655. は、その整数を二進法で表すのに何ビッ
     ト必要かを返す関数です。符号と先頭のゼロは無視されます。

 -- の関数: 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: 2ee.

     組み込みの ‘**’ 演算子と違って、 *note math.pow(): 873. は両方の引
     数を *note float: 197. 型に変換します。正確な整数の冪乗を計算するに
     は ‘**’ もしくは組み込みの *note pow(): 1a5. 関数を使ってください。

     バージョン 3.11 で変更: IEEE 754 との一貫性のため、特殊な例である
     ‘pow(0.0, -inf)’ および ‘pow(-0.0, -inf)’ は *note ValueError: 2ee.
     を送出する代わりに ‘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.10.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: 2ee. 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.10.2.6 角度変換
.................

 -- の関数: math.degrees (x)

     角 'x' をラジアンから度に変換します。

 -- の関数: math.radians (x)

     角 'x' を度からラジアンに変換します。


File: python.info,  Node: 三角関数,  Next: 双曲線関数,  Prev: 角度変換,  Up: math --- 数学関数

5.10.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(): 2af9. のポイン
     トは、両方の入力の符号が既知であるために、位相角の正しい象限を計算
     できることにあります。例えば、 ‘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.10.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.10.2.9 特殊関数
.................

 -- の関数: math.erf (x)

     'x' の 誤差関数(1) を返します。

     The ‘erf()’ 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.10.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(): 15f0. 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: 2ee. 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:
a85. 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.10.3 ‘cmath’ -- 複素数用の数学関数
------------------------------------

__________________________________________________________________

このモジュールは、複素数を扱う数学関数へのアクセスを提供しています。 こ
のモジュール中の関数は整数、浮動小数点数または複素数を引数にとります。 ま
た、 *note __complex__(): 7fd. または *note __float__(): bc5. どちらかの
メソッドを提供している 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(): 2b0e. 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): 2b0f.                                    Return the phase of 'z'
                                                         
                                                         
*note polar(z): 2b10.                                    Return the representation of 'z' in polar coordinates
                                                         
                                                         
*note rect(r, phi): 2b11.                                Return the complex number 'z' with polar coordinates 'r' and 'phi'
                                                         
                                                         
'Power and logarithmic functions'

*note exp(z): 2b12.                                      Return 'e' raised to the power 'z'
                                                         
                                                         
*note log(z[, base]): 2b13.                              Return the logarithm of 'z' to the given 'base' ('e' by default)
                                                         
                                                         
*note log10(z): 2b14.                                    Return the base-10 logarithm of 'z'
                                                         
                                                         
*note sqrt(z): 2b0e.                                     Return the square root of 'z'
                                                         
                                                         
'Trigonometric functions'

*note acos(z): 2b15.                                     Return the arc cosine of 'z'
                                                         
                                                         
*note asin(z): 2b16.                                     Return the arc sine of 'z'
                                                         
                                                         
*note atan(z): 2b17.                                     Return the arc tangent of 'z'
                                                         
                                                         
*note cos(z): 2b18.                                      Return the cosine of 'z'
                                                         
                                                         
*note sin(z): 2b19.                                      Return the sine of 'z'
                                                         
                                                         
*note tan(z): 2b1a.                                      Return the tangent of 'z'
                                                         
                                                         
'Hyperbolic functions'

*note acosh(z): 2b1b.                                    Return the inverse hyperbolic cosine of 'z'
                                                         
                                                         
*note asinh(z): 2b1c.                                    Return the inverse hyperbolic sine of 'z'
                                                         
                                                         
*note atanh(z): 2b1d.                                    Return the inverse hyperbolic tangent of 'z'
                                                         
                                                         
*note cosh(z): 2b1e.                                     Return the hyperbolic cosine of 'z'
                                                         
                                                         
*note sinh(z): 2b1f.                                     Return the hyperbolic sine of 'z'
                                                         
                                                         
*note tanh(z): 2b20.                                     Return the hyperbolic tangent of 'z'
                                                         
                                                         
'Classification functions'

*note isfinite(z): 2b21.                                 Check if all components of 'z' are finite
                                                         
                                                         
*note isinf(z): 2b22.                                    Check if any component of 'z' is infinite
                                                         
                                                         
*note isnan(z): 2b23.                                    Check if any component of 'z' is a NaN
                                                         
                                                         
*note isclose(a, b, *, rel_tol, abs_tol): fb5.           Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
'定数'

*note pi: 2b24.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2b25.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: e81.                                          'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: e83.                                          正の無限大
                                                         
                                                         
*note infj: e85.                                         Pure imaginary infinity
                                                         
                                                         
*note nan: e84.                                          非数 "Not a number" (NaN)
                                                         
                                                         
*note nanj: e86.                                         Pure imaginary NaN
                                                         

* Menu:

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


File: python.info,  Node: 極座標変換,  Next: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.10.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(): 20e9. 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.10.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(): 2b13.

 -- の関数: cmath.sqrt (z)

     Return the square root of 'z'.  This has the same branch cut as
     *note log(): 2b13.


File: python.info,  Node: 三角関数<2>,  Next: 双曲線関数<2>,  Prev: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.10.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(): 2b15.

 -- の関数: 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.10.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.10.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.10.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: 874.

     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.10.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: 197. 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’ になってしまいます。ゼロに近い値とはい
     え、この誤差は数値間の等価性テストの信頼性を阻害します。また、誤差
     が蓄積されることもあります。こうした理由から、数値間の等価性を厳し
     く保たなければならないようなアプリケーションを考えるなら、十進数に
     よる数値表現が望ましいということになります。

   * ‘decimal’ モジュールでは、有効桁数の表記が取り入れられており、例え
     ば ‘1.30 + 1.20’ は ‘2.50’ になります。すなわち、末尾のゼロは有効数
     字を示すために残されます。こうした仕様は通貨計算を行うアプリケーシ
     ョンでは慣例です。乗算の場合、「教科書的な」アプローチでは、乗算の
     被演算子すべての桁数を使います。例えば、 ‘1.3 * 1.2’ は ‘1.56’ にな
     り、 ‘1.30 * 1.20’ は ‘1.5600’ になります。

   * ハードウェアによる 2 進浮動小数点表現と違い、‘decimal’ モジュールで
     は計算精度をユーザが変更できます(デフォルトでは 28 桁です)。この桁
     数はほとんどの問題解決に十分な大きさです:

          >>> from decimal import *
          >>> getcontext().prec = 6
          >>> Decimal(1) / Decimal(7)
          Decimal('0.142857')
          >>> getcontext().prec = 28
          >>> Decimal(1) / Decimal(7)
          Decimal('0.1428571428571428571428571429')

   * 二進と十進の浮動小数点は、いずれも広く公開されている標準仕様のもと
     に実装されています。組み込みの浮動小数点型では、標準仕様で提唱され
     ている機能のほんのささやかな部分を利用できるにすぎませんが、
     ‘decimal’ では標準仕様が要求している全ての機能を利用できます。必要
     に応じて、プログラマは値の丸めやシグナル処理を完全に制御できます。
     この中には全ての不正確な操作を例外でブロックして正確な算術を遵守さ
     せるオプションもあります。

   * decimal モジュールは「偏見なく、正確な丸めなしの十進算術(固定小数点
     算術と呼ばれることもある)と丸めありの浮動小数点数算術」(十進数演算
     仕様より引用)をサポートするようにデザインされました。

このモジュールは、十進数型、算術コンテキスト (context for arithmetic)、
そしてシグナル (signal) という三つの概念を中心に設計されています。

十進数型は変更不能です。これは符号、係数部、そして指数を持ちます。有効桁
数を残すために、仮数部の末尾にあるゼロは切り詰められません。 ‘decimal’ で
は、 ‘Infinity’, ‘-Infinity’, および ‘NaN’ といった特殊な値も定義されて
います。標準仕様では ‘-0’ と ‘+0’ も区別します。

算術コンテキストとは、精度や値丸めの規則、指数部の制限を決めている環境で
す。この環境では、演算結果を表すためのフラグや、演算上発生した特定のシグ
ナルを例外として扱うかどうかを決めるトラップイネーブラも定義しています。
丸め規則には *note ROUND_CEILING: 2b2f, *note ROUND_DOWN: 2b30, *note
ROUND_FLOOR: 2b31, *note ROUND_HALF_DOWN: 2b32, *note ROUND_HALF_EVEN:
2b33, *note ROUND_HALF_UP: 2b34, *note ROUND_UP: 2b35, および *note
ROUND_05UP: 2b36. があります。

シグナルとは、演算の過程で生じる例外的条件です。個々のシグナルは、アプリ
ケーションそれぞれの要求に従って、無視されたり、単なる情報とみなされたり
、例外として扱われたりします。 ‘decimal’ モジュールには、 *note Clamped:
2b37, *note InvalidOperation: 12c0, *note DivisionByZero: 2b38, *note
Inexact: 2b39, *note Rounded: 2b3a, *note Subnormal: 2b3b, *note
Overflow: 2b3c, *note Underflow: 2b3d, および *note FloatOperation:
12b3. といったシグナルがあります。

各シグナルには、フラグとトラップイネーブラがあります。演算上何らかのシグ
ナルに遭遇すると、フラグは 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.10.4.1 Quick-start tutorial
.............................

普通、 ‘decimal’ を使うときには、モジュールをインポートし、現在の演算コ
ンテキストを *note getcontext(): 1997. で調べ、必要なら、精度、丸め、有
効なトラップを設定します:

     >>> 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: 200. インスタンスは、整数、文字列、浮動小数点数、またはタ
プルから構成できます。整数や浮動小数点数からの構成は、整数や浮動小数点数
の値を正確に変換します。 ‘Decimal’ は "非数 (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: 12b3. シグナルがトラップされる場合、コンストラクタ
や順序比較において誤って 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: 200. の有効桁数は入力の桁数だけで決まります。演算
コンテキストにおける精度や値丸めの設定が影響するのは算術演算の間だけです
。

     >>> 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: 12c0. を送出します:

     >>> 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(): 19a. built-in or *note
f-strings: 19b.) in fixed-point or scientific notation, using the same
formatting syntax (see *note Format specification mini-language: 4f9.)
as builtin *note float: 197. 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(): 12c8. メソッドは位を固定して数値を丸めます。このメソッ
ドは、結果を固定の桁数で丸めることがよくある、金融アプリケーションで便利
です:

     >>> 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(): 1997. 関数を使うと現在の演算コンテキ
ストにアクセスでき、設定を変更できます。ほとんどのアプリケーションはこの
アプローチで十分です。

For more advanced work, it may be useful to create alternate contexts
using the *note Context(): 12c7. constructor.  To make an alternate
active, use the *note setcontext(): 2b3f. function.

In accordance with the standard, the ‘decimal’ module provides two ready
to use standard contexts, *note BasicContext: 12bc. and *note
ExtendedContext: 12bd.  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(): 2b40. メソッドでフラグをクリアしておくのがベストです。

     >>> 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: 12c6. 属性に入っている辞書を使うと、個々のト
ラップをセットできます:

     >>> 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: 200. へ
の変換はループ内で一度だけキャストして行います。コンテキストを設定し、
‘Decimal’ オブジェクトを生成できたら、ほとんどのプログラムは他の Python
数値型と全く変わらないかのように ‘Decimal’ を操作できます。


File: python.info,  Node: Decimal オブジェクト,  Next: Context オブジェクト,  Prev: Quick-start tutorial,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.10.4.2 Decimal オブジェクト
.............................

 -- クラス: decimal.Decimal (value='0', context=None)

     'value' に基づいて新たな *note Decimal: 200. オブジェクトを構築しま
     す。

     'value' は整数、文字列、タプル、 *note float: 197. および他の *note
     Decimal: 200. オブジェクトにできます。 '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’)、仮数部を表す数字の ‘tuple’
     、そして指数を表す整数でなければなりません。例えば、 ‘Decimal((0,
     (1, 4, 1, 4), -3))’ は ‘Decimal('1.414')’ を返します。

     If 'value' is a *note float: 197, 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: 12c0. をトラップするようになっていれば、例外を送
     出します。それ以外の場合には、コンストラクタは値が ‘NaN’ の *note
     Decimal: 200. を返します。

     一度生成すると、 *note Decimal: 200. オブジェクトは変更不能
     (immutable) になります。

     バージョン 3.2 で変更: コンストラクタに対する引数に *note float:
     197. インスタンスも許されるようになりました。

     バージョン 3.3 で変更: *note FloatOperation: 12b3. トラップがセット
     されていた場合 *note float: 197. 引数は例外を送出します。デフォルト
     でトラップはオフです。

     バージョン 3.6 で変更: コード中の整数リテラルや浮動小数点リテラルと
     同様に、アンダースコアを用いて桁をグルーピングできます。

     Decimal floating-point objects share many properties with the other
     built-in numeric types such as *note float: 197. and *note int:
     19c.  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 ‘float’ or ‘int’).

     十進オブジェクトの算術演算と整数や浮動小数点数の算術演算には少々違
     いがあります。十進オブジェクトに対して剰余演算を適用すると、計算結
     果の符号は除数の符号ではなく '被除数' の符号と一致します:

          >>> (-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: 215. オブジェクトと組み合わせることができません
     。例えば、 *note Decimal: 200. に *note float: 197. を足そうとする
     と、 *note TypeError: 199. が送出されます。ただし、Python の比較演
     算子を使って ‘Decimal’ インスタンス ‘x’ と別の数 ‘y’ を比較すること
     ができます。これにより、異なる型の数間の等価比較の際に、紛らわしい
     結果を避けます。

     バージョン 3.2 で変更: *note Decimal: 200. インスタンスと他の数値型
     が混在する比較が完全にサポートされるようになりました。

     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: 200. インスタンスを、既約分数で分母
          が正数の分数として表現した整数のペア ‘(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: 200. インスタンスのエンコーディングは常に
          標準的なので、この操作は引数に手を加えずに返します。

      -- メソッド: compare (other, context=None)

          二つの Decimal インスタンスの値を比較します。 *note compare():
          2b46. は 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(): 2b46. とほとんど同じですが、全ての
          NaN がシグナルを送るところが異なります。すなわち、どちらの比較
          対象も発信 (signaling) NaN でないならば無言 (quiet) NaN である
          比較対象があたかも発信 NaN であるかのように扱われます。

      -- メソッド: compare_total (other, context=None)

          二つの対象を数値によらず抽象表現によって比較します。 *note
          compare(): 2b46. に似ていますが、結果は *note Decimal: 200. に
          全順序を与えます。この順序づけによると、数値的に等しくても異な
          った表現を持つ二つの ‘Decimal’ インスタンスの比較は等しくなり
          ません:

               >>> 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(): 2b48. のように数値によらず
          抽象表現によって比較しますが、両者の符号を無視します。
          ‘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: 2b33. 丸めモードで正しく丸められます。

               >>> 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: 197. or *note int: 19c.

          なお、‘Decimal.from_float(0.1)’ は ‘Decimal('0.1')’ と同じでは
          ありません。0.1 は二進浮動小数点数で正確に表せないので、その値
          は表現できる最も近い値、‘0x1.999999999999ap-4’ として記憶され
          ます。浮動小数点数での等価な値は
          ‘0.1000000000000000055511151231257827021181583404541015625’ で
          す。

               注釈: Python 3.2 以降では、 *note Decimal: 200. インスタ
               ンスは *note float: 197. から直接構成できるようになりまし
               た。

               >>> 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: 197, *note int: 19c. or ‘Decimal’, 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: e0b. を返し、そうで
          なければ *note False: d2f. を返します。現在のところ、 *note
          Decimal: 200. のインスタンスは常に標準的なのでこのメソッドの結
          果はいつでも ‘True’ です。

      -- メソッド: is_finite ()

          引数が有限の数値ならば *note True: e0b. を、無限大か NaN なら
          ば *note False: d2f. を返します。

      -- メソッド: is_infinite ()

          引数が正または負の無限大ならば *note True: e0b. を、そうでなけ
          れば *note False: d2f. を返します。

      -- メソッド: is_nan ()

          引数が (無言か発信かは問わず) NaN であれば *note True: e0b. を
          、そうでなければ *note False: d2f. を返します。

      -- メソッド: is_normal (context=None)

          引数が '正規(normal)' の有限数値ならば *note True: e0b. を返し
          ます。引数がゼロ、非正規(subnormal)、無限大または NaN であれば
          *note False: d2f. を返します。

      -- メソッド: is_qnan ()

          引数が無言 NaN であれば *note True: e0b. を、そうでなければ
          *note False: d2f. を返します。

      -- メソッド: is_signed ()

          引数に負の符号がついていれば *note True: e0b. を、そうでなけれ
          ば *note False: d2f. を返します。注意すべきはゼロや NaN なども
          符号を持ち得ることです。

      -- メソッド: is_snan ()

          引数が発信 NaN であれば *note True: e0b. を、そうでなければ
          *note False: d2f. を返します。

      -- メソッド: is_subnormal (context=None)

          引数が非正規数(subnormal)であれば *note True: e0b. を、そうで
          なければ *note False: d2f. を返します。

      -- メソッド: is_zero ()

          引数が(正または負の)ゼロであれば *note True: e0b. を、そうでな
          ければ *note False: d2f. を返します。

      -- メソッド: ln (context=None)

          演算対象の自然対数(底 e の対数)を返します。結果は *note
          ROUND_HALF_EVEN: 2b33. 丸めモードで正しく丸められます。

      -- メソッド: log10 (context=None)

          演算対象の底 10 の対数を返します。結果は *note
          ROUND_HALF_EVEN: 2b33. 丸めモードで正しく丸められます。

      -- メソッド: logb (context=None)

          非零の数値については、 *note Decimal: 200. インスタンスとして
          調整された指数を返します。演算対象がゼロだった場合、
          ‘Decimal('-Infinity')’ が返され *note DivisionByZero: 2b38. フ
          ラグが送出されます。演算対象が無限大だった場合、
          ‘Decimal('Infinity')’ が返されます。

      -- メソッド: logical_and (other, context=None)

          *note logical_and(): 2b5b. は二つの '論理引数' (*note
          論理引数: 2b5c. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの ‘and’ です。

      -- メソッド: logical_invert (context=None)

          *note logical_invert(): 2b5d. は論理演算です。結果は引数の数字
          ごとの反転です。

      -- メソッド: logical_or (other, context=None)

          *note logical_or(): 2b5e. は二つの '論理引数' (*note 論理引数:
          2b5c. 参照)を取る論理演算です。結果は二つの引数の数字ごとの
          ‘or’ です。

      -- メソッド: logical_xor (other, context=None)

          *note logical_xor(): 2b5f. は二つの '論理引数' (*note
          論理引数: 2b5c. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの排他的論理和です。

      -- メソッド: max (other, context=None)

          ‘max(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: max_mag (other, context=None)

          *note max(): 2b60. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: min (other, context=None)

          ‘min(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: min_mag (other, context=None)

          *note min(): 2b62. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: 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: 12c0. がシグナルされま
          す。これによりエラー条件がない限り打ち切られた指数が常に右側の
          引数と同じになることが保証されます。

          同様に、他の操作と違い、quantize は Underflow を、たとえ結果が
          非正規になったり不正確になったとしても、シグナルしません。

          二つ目の演算対象の指数が一つ目のそれよりも大きければ丸めが必要
          かもしれません。この場合、丸めモードは以下のように決められます
          。‘rounding’ 引数が与えられていればそれが使われます。そうでな
          ければ ‘context’ 引数で決まります。どちらの引数も渡されなけれ
          ば現在のスレッドのコンテキストの丸めモードが使われます。

          処理結果の指数が *note Emax: 12be. よりも大きい場合や *note
          Etiny(): 2b69. よりも小さい場合にエラーが返されます。

      -- メソッド: radix ()

          ‘Decimal(10)’ つまり *note Decimal: 200. クラスがその全ての算
          術を実行する基数を返します。仕様との互換性のために取り入れられ
          ています。

      -- メソッド: 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(): 2b73. メソッドと同じです。
          ‘to_integral’ の名前は古いバージョンとの互換性のために残されて
          います。

      -- メソッド: to_integral_exact (rounding=None, context=None)

          最近傍の整数に値を丸め、丸めが起こった場合には *note Inexact:
          2b39. または *note Rounded: 2b3a. のシグナルを適切に出します。
          丸めモードは以下のように決められます。 ‘rounding’ 引数が与えら
          れていればそれが使われます。そうでなければ ‘context’ 引数で決
          まります。どちらの引数も渡されなければ現在のスレッドのコンテキ
          ストの丸めモードが使われます。

      -- メソッド: to_integral_value (rounding=None, context=None)

          *note Inexact: 2b39. や *note Rounded: 2b3a. といったシグナル
          を出さずに最近傍の整数に値を丸めます。 'rounding' が指定されて
          いれば適用されます; それ以外の場合、値丸めの方法は 'context' の
          設定か現在のコンテキストの設定になります。

     Decimal numbers can be rounded using the *note round(): 14f6.
     function:

      -- Describe: round(number)

      -- Describe: round(number, ndigits)

          If 'ndigits' is not given or ‘None’, returns the nearest *note
          int: 19c. to 'number', rounding ties to even, and ignoring the
          rounding mode of the ‘Decimal’ context.  Raises *note
          OverflowError: a85. if 'number' is an infinity or *note
          ValueError: 2ee. if it is a (quiet or signaling) NaN.

          If 'ndigits' is an *note int: 19c, the context's rounding mode
          is respected and a ‘Decimal’ 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: 12c0. 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.10.4.3 論理引数
.................

*note logical_and(): 2b5b, *note logical_invert(): 2b5d, *note
logical_or(): 2b5e, および *note logical_xor(): 2b5f. メソッドはその引数
が '論理引数' であると想定しています。 '論理引数' とは *note Decimal:
200. インスタンスで指数と符号は共にゼロであり、各桁の数字が ‘0’ か ‘1’ で
あるものです。


File: python.info,  Node: Context オブジェクト,  Next: 定数<4>,  Prev: Decimal オブジェクト,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.10.4.4 Context オブジェクト
.............................

コンテキスト (context) とは、算術演算における環境設定です。コンテキスト
は計算精度を決定し、値丸めの方法を設定し、シグナルのどれが例外になるかを
決め、指数の範囲を制限しています。

多重スレッドで処理を行う場合には各スレッドごとに現在のコンテキストがあり
、 *note getcontext(): 1997. や *note setcontext(): 2b3f. といった関数で
アクセスしたり設定変更できます:

 -- の関数: decimal.getcontext ()

     アクティブなスレッドの現在のコンテキストを返します。

 -- の関数: decimal.setcontext (c, /)

     アクティブなスレッドのコンテキストを 'c' に設定します。

*note with: 187. 文と *note localcontext(): 15a2. 関数を使って実行するコ
ンテキストを一時的に変更することもできます。

 -- の関数: 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: 199. if 'kwargs' supplies an attribute that
     *note Context: 12c7. doesn't support.  Raises either ‘TypeError’ or
     *note ValueError: 2ee. if 'kwargs' supplies an invalid value for an
     attribute.

     バージョン 3.11 で変更: ‘localcontext()’ 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: 2b77.

     Added in version 3.14.

新たなコンテキストは、以下で説明する *note Context: 12c7. コンストラクタ
を使って生成できます。その他にも、 ‘decimal’ モジュールでは作成済みのコ
ンテキストを提供しています:

 -- データ: decimal.BasicContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_UP: 2b34. です
     。すべての演算結果フラグはクリアされています。 *note Inexact: 2b39,
     *note Rounded: 2b3a, *note Subnormal: 2b3b. を除く全ての演算エラー
     トラップが有効 (例外として扱う) になっています。

     多くのトラップが有効になっているので、デバッグの際に便利なコンテキ
     ストです。

 -- データ: decimal.ExtendedContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_EVEN: 2b33. で
     す。すべての演算結果フラグはクリアされています。トラップは全て無効
     (演算中に一切例外を送出しない) になっています。

     トラップが無効になっているので、エラーの伴う演算結果を ‘NaN’ や
     ‘Infinity’ にし、例外を送出しないようにしたいアプリケーションに向い
     たコンテキストです。このコンテキストを使うと、他の場合にはプログラ
     ムが停止してしまうような状況があっても実行を完了させられます。

 -- データ: decimal.DefaultContext

     *note Context: 12c7. コンストラクタが新たなコンテキストを作成するさ
     いに雛形にするコンテキストです。このコンテキストのフィールド (精度
     の設定など) を変更すると、 ‘Context’ コンストラクタが生成する新たな
     コンテキストに影響を及ぼします。

     このコンテキストは、主に多重スレッド環境で便利です。スレッドを開始
     する前に何らかのフィールドを変更しておくと、システム全体のデフォル
     ト設定に効果を及ぼすことができます。スレッドを開始した後にフィール
     ドを変更すると、競合条件を抑制するためにスレッドを同期化しなければ
     ならないので、推奨しません。

     単一スレッドの環境では、このコンテキストを使わないよう薦めます。下
     で述べるように明示的にコンテキストを作成してください。

     デフォルトの値は、 *note Context.prec: 2b78.=‘28’, *note
     Context.rounding: 2b79.=*note ROUND_HALF_EVEN: 2b33. で、トラップ
     *note Overflow: 2b3c, *note InvalidOperation: 12c0, および *note
     DivisionByZero: 2b38. が有効になっています。

上に挙げた三つのコンテキストに加え、 *note Context: 12c7. コンストラクタ
を使って新たなコンテキストを生成できます。

 -- クラス: decimal.Context (prec=None, rounding=None, Emin=None,
          Emax=None, capitals=None, clamp=None, flags=None, traps=None)

     新たなコンテキストを生成します。あるフィールドが定義されていないか
     *note None: 886. であれば、 *note DefaultContext: 12bb. からデフォ
     ルト値をコピーします。 'flags' フィールドが設定されていいか ‘None’
     の場合には、全てのフラグがクリアされます。

      -- の属性: prec

          An integer in the range [‘1’, *note MAX_PREC: 12b8.] that sets
          the precision for arithmetic operations in the context.

      -- の属性: rounding

          One of the constants listed in the section *note Rounding
          Modes: 2b7a.

      -- の属性: 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: 12ba, ‘0’],
          'Emax' in the range [‘0’, *note MAX_EMAX: 12b9.].

      -- の属性: 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: 200. 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 ‘Decimal’
          instance is at most *note Emax: 12be.  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: 12c7. クラスでは、いくつかの汎用のメソッドの他、現在
     のコンテキストで算術演算を直接行うためのメソッドを数多く定義してい
     ます。加えて、 *note Decimal: 200. の各メソッドについて(*note
     adjusted(): 2b43. および *note as_tuple(): 2b44. メソッドを例外とし
     て)対応する ‘Context’ のメソッドが存在します。たとえば、 ‘Context’
     インスタンス ‘C’ と ‘Decimal’ インスタンス ‘x’ に対して、
     ‘C.exp(x)’ は ‘x.exp(context=C)’ と等価です。それぞれの ‘Context’ メ
     ソッドは、Decimal インスタンスが受け付けられるところならどこでも、
     Python の整数 (*note int: 19c. のインスタンス) を受け付けます。

      -- メソッド: 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: 200. コンストラクタと違い、数
          値を変換する際にコンテキストの精度、値丸め方法、フラグ、トラッ
          プを適用します。

          定数値はしばしばアプリケーションの要求よりも高い精度を持ってい
          るため、このメソッドが役に立ちます。また、値丸めを即座に行うた
          め、例えば以下のように、入力値に値丸めを行わないために合計値に
          ゼロの加算を追加するだけで結果が変わってしまうといった、現在の
          精度よりも細かい値の影響が紛れ込む問題を防げるという恩恵もあり
          ます。以下の例は、丸められていない入力を使うということは和にゼ
          ロを加えると結果が変わり得るという見本です:

               >>> 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(): 1421. クラスメソッドとは違い、変換にコン
          テキストの精度、丸めメソッド、フラグ、そしてトラップが適用され
          ます。

               >>> 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: 2b69. に設定されます。

      -- メソッド: Etop ()

          ‘Emax - prec + 1’ に等しい値を返します。

     *note Decimal: 200. を使った処理を行う場合、通常は ‘Decimal’ インス
     タンスを生成して、算術演算を適用するというアプローチをとります。演
     算はアクティブなスレッドにおける現在のコンテキストの下で行われます
     。もう一つのアプローチは、コンテキストのメソッドを使った特定のコン
     テキスト下での計算です。コンテキストのメソッドは ‘Decimal’ クラスの
     メソッドに似ているので、ここでは簡単な説明にとどめます。

      -- メソッド: 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(): 2bab. を
          適切に丸められた *note exp(): 2b8d. および *note ln(): 2b98. 関
          数によって計算します。結果は 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.10.4.5 定数
.............

The constants in this section are only relevant for the C module.  They
are also included in the pure Python version for compatibility.

                                      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: 21c2, 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.10.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.10.4.7 シグナル
.................

シグナルは、計算中に生じた様々なエラー条件を表現します。各々のシグナルは
一つのコンテキストフラグと一つのトラップイネーブラに対応しています。

コンテキストフラグは、該当するエラー条件に遭遇するたびにセットされます。
演算後にフラグを調べれば、演算に関する情報 (例えば計算が厳密だったかどう
か) がわかります。フラグを調べたら、次の計算を始める前にフラグを全てクリ
アするようにしてください。

あるコンテキストのトラップイネーブラがあるシグナルに対してセットされてい
る場合、該当するエラー条件が生じると Python の例外を送出します。例えば、
*note DivisionByZero: 2b38. が設定されていると、エラー条件が生じた際に
*note DivisionByZero: 2b38. 例外を送出します。

 -- クラス: decimal.Clamped

     値の表現上の制限に沿わせるために指数部が変更されたことを通知します
     。

     通常、クランプ (clamp) は、指数部がコンテキストにおける指数桁の制限
     値 *note Emin: 12bf. および *note Emax: 12be. を越えた場合に発生し
     ます。可能な場合には、係数部にゼロを加えた表現に合わせて指数部を減
     らします。

 -- クラス: decimal.DecimalException

     他のシグナルの基底クラスで、 *note ArithmeticError: 273d. のサブク
     ラスです。

 -- クラス: 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:
     12be. より大きいことを示します。シグナルをトラップしない場合、演算
     結果は値丸めのモードにより、表現可能な最大の数値になるように内側へ
     引き込んで丸めを行った値か、 ‘Infinity’ になるように外側に丸めた値
     のいずれかになります。いずれの場合も、 *note Inexact: 2b39. および
     *note Rounded: 2b3a. が同時にシグナルされます。

 -- クラス: decimal.Rounded

     情報が全く失われていない場合も含み、値丸めが起きたときのシグナルで
     す。

     このシグナルは、値丸めによって桁がなくなると常に発生します。なくな
     った桁がゼロ (例えば ‘5.00’ を丸めて ‘5.0’ になった場合) であっても
     です。このシグナルをトラップしなければ、演算結果をそのまま返します
     。このシグナルは有効桁数の減少を検出する際に使います。

 -- クラス: decimal.Subnormal

     値丸めを行う前に指数部が *note Emin: 12bf. より小さかったことを示す
     シグナルです。

     演算結果が微小である場合 (指数が小さすぎる場合) に発生します。この
     シグナルをトラップしなければ、演算結果をそのまま返します。

 -- クラス: decimal.Underflow

     演算結果が値丸めによってゼロになった場合に生じる数値アンダフローで
     す。

     演算結果が微小なため、値丸めによってゼロになった場合に発生します。
     *note Inexact: 2b39. および *note Subnormal: 2b3b. シグナルも同時に
     発生します。

 -- クラス: decimal.FloatOperation

     float と Decimal の混合の厳密なセマンティクスを有効にします。

     シグナルがトラップされなかった場合 (デフォルト)、*note Decimal:
     200. コンストラクタ、 *note create_decimal(): 12c1. 、およびすべて
     の比較演算子において float と Decimal の混合が許されます。変換も比
     較も正確です。コンテキストフラグ内に *note FloatOperation: 12b3. を
     設定することで、混合操作は現れるたびに暗黙に記録されます。 *note
     from_float(): 1421. や *note create_decimal_from_float(): 2b7f. に
     よる明示的な変換はフラグを設定しません。

     そうでなければ (シグナルがトラップされれば)、等価性比較および明示的
     な変換のみが静かにに行われ、その他の混合演算は *note
     FloatOperation: 12b3. を送出します。

これらのシグナルの階層構造をまとめると、以下の表のようになります:

     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.10.4.8 Floating-point notes
.............................

* Menu:

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


File: python.info,  Node: 精度を上げて丸め誤差を抑制する,  Next: 特殊値,  Up: Floating-point notes

5.10.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.10.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: 2b38. をトラップせずにゼロで除算を行った場合にも出
てきます。同様に、 *note Overflow: 2b3c. シグナルをトラップしなければ、
表現可能な最大の数値の制限を越えた値を丸めたときに出てきます。

無限大には符号があり (アフィン: affine であり)、算術演算に使用でき、非常
に巨大で不確定の(indeterminate)値として扱われます。例えば、無限大に何ら
かの定数を加算すると、演算結果は別の無限大になります。

演算によっては結果が不確定になるものがあり、 ‘NaN’ を返します。ただし、
*note InvalidOperation: 12c0. シグナルをトラップするようになっていれば例
外を送出します。例えば、 ‘0/0’ は ‘NaN’ を返します。 ‘NaN’ は「非数値
(not a number)」を表します。このような ‘NaN’ は暗黙のうちに生成され、一
度生成されるとそれを他の計算にも流れてゆき、関係する個々の演算全てが個別
の ‘NaN’ を返すようになります。この挙動は、たまに入力値が欠けるような状
況で一連の計算を行う際に便利です -- 特定の計算に対しては無効な結果を示す
フラグを立てつつ計算を進められるからです。

一方、 ‘NaN’ の変種である ‘sNaN’ は関係する全ての演算で演算後にシグナル
を送出します。 ‘sNaN’ は、無効な演算結果に対して特別な処理を行うために計
算を停止する必要がある場合に便利です。

Python の比較演算は ‘NaN’ が関わってくると少し驚くようなことがあります。
等価性のテストの一方の対象が無言または発信 ‘NaN’ である場合いつでも
*note False: d2f. を返し(たとえ ‘Decimal('NaN')==Decimal('NaN')’ でも)、
一方で不等価をテストするといつでも *note True: e0b. を返します。二つの
Decimal を ‘<’, ‘<=’, ‘>’ または ‘>=’ を使って比較する試みは一方が ‘NaN’
である場合には *note InvalidOperation: 12c0. シグナルを送出し、このシグ
ナルをトラップしなければ結果は ‘False’ に終わります。汎用十進演算仕様は
直接の比較の振る舞いについて定めていないことに注意しておきましょう。ここ
での ‘NaN’ が関係する比較ルールは IEEE 854 標準から持ってきました
(section 5.7 の Table 3 を見て下さい)。厳格に標準遵守を貫くなら、 *note
compare(): 2b46. および *note compare_signal(): 2b47. メソッドを代わりに
使いましょう。

アンダフローの起きた計算は、符号付きのゼロ (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.10.4.11 スレッドを使った処理
..............................

関数 *note getcontext(): 1997. は、スレッド毎に別々の *note Context:
12c7. オブジェクトにアクセスします。別のスレッドコンテキストを持つという
ことは、複数のスレッドが互いに影響を及ぼさずに (‘getcontext().prec=10’ の
ような) 変更を適用できるということです。

同様に、*note setcontext(): 2b3f. 関数は自動的に引数のコンテキストを現在
のスレッドのコンテキストに設定します。

If *note setcontext(): 2b3f. has not been called before *note
getcontext(): 1997, then ‘getcontext()’ will automatically create a new
context for use in the current thread.  New context objects have default
values set from the *note decimal.DefaultContext: 12bb. object.

The *note sys.flags.thread_inherit_context: 176. 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(): 1997. 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(): 179.

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(): 1997.
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.10.4.12 レシピ
................

*note Decimal: 200. クラスの利用を実演している例をいくつか示します。これ
らはユーティリティ関数としても利用できます:

     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.10.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(): 12c8. method rounds to a fixed number of
decimal places.  If the *note Inexact: 2b39. 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(): 12c8.
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(): 12c8. の
段階を扱う関数を定義しておくと便利です:

     >>> 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(): 2b67. 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: 200.?

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(): 12c1. を使って生成時に
丸めてしまうこともできます:

     >>> 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: 12bf. and *note Emax: 12be. should always be set to the
maximum values, *note clamp: 13ba. should always be 0 (the default).
Setting *note prec: 2b78. requires some care.

The easiest approach for trying out bignum arithmetic is to use the
maximum value for *note prec: 2b78. 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: 12b8. 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: 2b78. 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:
2b39. 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.10.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: 14da. and returns a new
     ‘Fraction’ instance with a value equal to ‘numerator/denominator’.
     If 'denominator' is zero, it raises a *note ZeroDivisionError: b43.

     The second version requires that 'number' is an instance of *note
     numbers.Rational: 14da. or has the ‘as_integer_ratio()’ method
     (this includes *note float: 197. and *note decimal.Decimal: 200.).
     It returns a ‘Fraction’ 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
     浮動小数点演算、その問題と制限: 215c.), 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(): 2bcb. 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: 197. コンストラクタで受け付けら
     れる有限の値を表す文字列は、*note Fraction: 215. コンストラクタでも
     受け付けられます。どちらの形式でも、入力される文字列は前後に空白が
     あって構いません。以下に、いくつかの例を示します:

          >>> 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: 215. クラスは抽象基底クラス *note numbers.Rational:
     14da. を継承し、その全てのメソッドと演算を実装します。 ‘Fraction’ イ
     ンスタンスは *note ハッシュ可能: 824. で、不変 (immutable) であるも
     のとして扱われます。加えて、 ‘Fraction’ には以下のプロパティとメソ
     ッドがあります:

     バージョン 3.2 で変更: *note Fraction: 215. のコンストラクタが
     *note float: 197. および *note decimal.Decimal: 200. インスタンスを
     受け付けるようになりました。

     バージョン 3.9 で変更: The *note math.gcd(): b10. function is now
     used to normalize the 'numerator' and 'denominator'.  ‘math.gcd()’
     always returns an *note int: 19c. type.  Previously, the GCD type
     depended on 'numerator' and 'denominator'.

     バージョン 3.11 で変更: Underscores are now permitted when creating
     a ‘Fraction’ instance from a string, following PEP 515(2) rules.

     バージョン 3.11 で変更: ‘Fraction’ 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 で変更: ‘Fraction’ instances now support
     float-style formatting, with presentation types ‘"e"’, ‘"E"’,
     ‘"f"’, ‘"F"’, ‘"g"’, ‘"G"’ and ‘"%""’.

     バージョン 3.13 で変更: Formatting of ‘Fraction’ instances without
     a presentation type now supports fill, alignment, sign handling,
     minimum width and grouping.

     バージョン 3.14 で変更: The ‘Fraction’ 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: 197. or *note numbers.Integral: 246a.  Beware that
          ‘Fraction.from_float(0.3)’ is not the same value as
          ‘Fraction(3, 10)’.

               注釈: Python 3.2 以降では、 *note float: 197. から直接
               *note Fraction: 215. インスタンスを構築できるようになりま
               した。

      -- メソッド: classmethod from_decimal (dec)

          Alternative constructor which only accepts instances of *note
          decimal.Decimal: 200. or *note numbers.Integral: 246a.

               注釈: Python 3.2 以降では、 *note decimal.Decimal: 200. イ
               ンスタンスから直接 *note Fraction: 215. インスタンスを構
               築できるようになりました。

      -- メソッド: classmethod from_number (number)

          Alternative constructor which only accepts instances of *note
          numbers.Integral: 246a, *note numbers.Rational: 14da, *note
          float: 197. or *note decimal.Decimal: 200, 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: 215. を見付けて返します。このメソッドは与えられた浮
          動小数点数の有理数近似を見つけるのに役立ちます:

               >>> 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: 19c. ‘<= self’ を返します。このメソッドは
          *note math.floor(): 15db. 関数からでもアクセスできます:

               >>> from math import floor
               >>> floor(Fraction(355, 113))
               3

      -- メソッド: __ceil__ ()

          最小の *note int: 19c. ‘>= self’ を返します。このメソッドは
          *note math.ceil(): 15dc. 関数からでもアクセスできます。

      -- メソッド: __round__ ()

      -- メソッド: __round__ (ndigits)

          第一のバージョンは、 ‘self’ に最も近い *note int: 19c. を偶数
          丸めで返します。第二のバージョンは、このメソッドは ‘self’ に最
          も近い ‘Fraction(1, 10**ndigits)’ の倍数 (論理的に、 ‘ndigits’
          が負なら) を、これも偶数丸めで丸めます。 *note round(): 14f6.
          関数からでもアクセスできます。

      -- メソッド: __format__ (format_spec, /)

          Provides support for formatting of ‘Fraction’ instances via
          the *note str.format(): 833. method, the *note format(): 19a.
          built-in function, or *note Formatted string literals: 19b.

          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: 197. type in the *note Format specification
          mini-language: 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.10.6 ‘random’ -- 疑似乱数を生成する
-------------------------------------

'ソースコード:' Lib/random.py(1)

__________________________________________________________________

このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。

整数用に、ある範囲からの一様な選択があります。シーケンス用には、シーケン
スからのランダムな要素の一様な選択、リストのランダムな置換をインプレース
に生成する関数、順列を置換せずにランダムサンプリングする関数があります。

実数用としては、一様分布、正規分布 (ガウス分布)、対数正規分布、負の指数
分布、ガンマおよびベータ分布を計算する関数があります。角度の分布を生成す
るにはフォン・ミーゼス分布が利用できます。

ほとんど全てのモジュール関数は、基礎となる関数 *note random(): 953. に依
存します。この関数はランダムな浮動小数点数を半開区間 ‘0.0 <= X < 1.0’ 内
に一様に生成します。Python は中心となる乱数生成器としてメルセンヌツイス
タを使います。これは 53 ビット精度の浮動小数点を生成し、周期は
2**19937-1 です。本体は C で実装されていて、高速でスレッドセーフです。メ
ルセンヌツイスタは、現存する中で最も広範囲にテストされた乱数生成器のひと
つです。しかしながら、メルセンヌツイスタは完全に決定論的であるため、全て
の目的に合致しているわけではなく、暗号化の目的には全く向いていません。

このモジュールで提供されている関数は、実際には *note random.Random:
1cb9. クラスの隠蔽されたインスタンスのメソッドに束縛されています。内部状
態を共有しない生成器を取得するため、自分で *note Random: 1cb9. のインス
タンスを生成することができます。

Class *note Random: 1cb9. 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: 2bd4. 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: 1cb9. are thread-safe.  However, in the free-threaded
     build, concurrent calls to the global generator or to the same
     instance of ‘Random’ may encounter contention and poor performance.
     Consider using separate instances of ‘Random’ 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.10.6.1 保守 (bookkeeping) 関数
................................

 -- の関数: random.seed (a=None, version=2)

     乱数生成器を初期化します。

     'a' が省略されるか ‘None’ の場合、現在のシステム時刻が使用されます
     。乱数のソースがオペレーティングシステムによって提供される場合、シ
     ステム時刻の代わりにそれが使用されます (利用可能性についての詳細は
     *note os.urandom(): 746. 関数を参照)。

     'a' が int の場合は、その絶対値が直接使用されます。

     バージョン2 (デフォルト) では、 *note str: 16a, *note bytes: 193,
     *note bytearray: 342. オブジェクトは *note int: 19c. に変換され、そ
     のビットがすべて使用されます。

     バージョン1 (Python の古いバージョンでの乱数列を再現するために提供
     される) では、 *note str: 16a. と *note bytes: 193. に対して適用さ
     れるアルゴリズムは、より狭い範囲のシードを生成します。

     バージョン 3.2 で変更: 文字列シードのすべてのビットを使うバージョン
     2スキームに移行。

     バージョン 3.11 で変更: 'seed' は次の型の内のいずれかでなければなり
     ません: ‘None’、*note int: 19c.、*note float: 197.、*note str:
     16a.、*note bytes: 193.、*note bytearray: 342.。

 -- の関数: random.getstate ()

     乱数生成器の現在の内部状態を記憶したオブジェクトを返します。このオ
     ブジェクトを *note setstate(): 2bd7. に渡して内部状態を復元すること
     ができます。

 -- の関数: random.setstate (state)

     'state' は予め *note getstate(): 2bd6. を呼び出して得ておかなくては
     なりません。 *note setstate(): 2bd7. は ‘getstate()’ が呼び出された
     時の乱数生成器の内部状態を復元します。


File: python.info,  Node: バイト列用の関数,  Next: 整数用の関数,  Prev: 保守 bookkeeping 関数,  Up: random --- 疑似乱数を生成する

5.10.6.2 バイト列用の関数
.........................

 -- の関数: random.randbytes (n)

     'n' バイトのランダムなバイト列を生成します。

     セキュリティトークンを生成する目的で、このメソッドを使用しないでく
     ださい。代わりに *note secrets.token_bytes(): 2bd9. を使用してくだ
     さい。

     Added in version 3.9.


File: python.info,  Node: 整数用の関数,  Next: シーケンス用の関数,  Prev: バイト列用の関数,  Up: random --- 疑似乱数を生成する

5.10.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(): b41. 関数の引数と一致します。

     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(): a6f. がより洗練されました。以前は ‘int(random()*n)’ の
     ようなやや一様でない分布を生成するスタイルを使用していました。

     バージョン 3.12 で変更: 整数以外の型の自動変換はサポートされなくな
     りました。‘randrange(10.0)’ や ‘randrange(Fraction(10, 1))’ のよう
     な呼び出しは *note TypeError: 199. を送出します。

 -- の関数: random.randint (a, b)

     ‘a <= N <= b’ であるようなランダムな整数 'N' を返します。
     ‘randrange(a, b+1)’ のエイリアスです。

 -- の関数: random.getrandbits (k)

     'k' 桁の乱数ビットを持つ Python の整数を生成し、返します。このメソ
     ッドはメルセンヌツイスタ生成器で提供されており、その他の乱数生成器
     でもオプションの API として提供されている場合があります。*note
     getrandbits(): 1213. が使用可能な場合、*note randrange(): a6f. は任
     意の範囲の乱数を生成できるようになります。

     バージョン 3.9 で変更: 'k' の値として 0 が許されるようになりました
     。


File: python.info,  Node: シーケンス用の関数,  Next: Discrete distributions,  Prev: 整数用の関数,  Up: random --- 疑似乱数を生成する

5.10.6.4 シーケンス用の関数
...........................

 -- の関数: random.choice (seq)

     空でないシーケンス 'seq' からランダムに要素を返します。 'seq' が空
     のときは、 *note IndexError: 1753. が送出されます。

 -- の関数: random.choices (population, weights=None, *,
          cum_weights=None, k=1)

     'population' から重複ありで選んだ要素からなる大きさ 'k' のリストを
     返します。'population' が空の場合 *note IndexError: 1753. を送出し
     ます。

     'weights' シーケンスが与えられた場合、相対的な重みに基づいて要素が
     選ばれます。あるいは、'cum_weights' シーケンスが与えられた場合、累
     積的な重み (*note itertools.accumulate(): bf4. を用いて計算されるか
     もしれません) で要素が選ばれます。例えば、相対的な重み ‘[10, 5, 30,
     5]’ は累積的な重み ‘[10, 15, 45, 50]’ と等価です。内部的には、相対
     的な重みは要素選択の前に累積的な重みに変換されるため、累積的な重み
     を渡すと手間を省けます。

     'weights' および 'cum_weights' が与えられなかった場合、要素は同じ確
     率で選択されます。重みのシーケンスが与えられた場合、その長さは
     'population' シーケンスと同じでなければなりません。'weights' と
     'cum_weights' を同時に与えると *note TypeError: 199. が送出されます
     。

     'weights' や 'cum_weights' には *note random(): bd. が返す *note
     float: 197. 値と相互に変換できるような、任意の数値型を使用できます
     (int、float、fraction を含みますが、decimal は除きます)。重みには非
     負で有限の値を指定することが規定されます。全ての重みが 0 の場合、例
     外 *note ValueError: 2ee. が送出されます。

     与えられた種に対して、同じ重みを持つ *note choices(): ec5. 関数は、
     一般に *note choice(): 144c. を繰り返し呼び出す場合とは異なるシーケ
     ンスを生成します。 ‘choices()’ で使用されるアルゴリズムは、内部の一
     貫性とスピードのために浮動小数点演算を使用します。 ‘choice()’ で使
     われるアルゴリズムは、丸め誤差による小さな偏りを避けるために、デフ
     ォルトでは選択を繰り返す整数演算になっています。

     Added in version 3.6.

     バージョン 3.9 で変更: 全ての重みが 0 の場合、例外 *note
     ValueError: 2ee. を送出します。

 -- の関数: 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(): b41. オ
     ブジェクトを使用してください。大きな母集団の場合、これは特に速く、
     メモリ効率が良いです: ‘sample(range(10000000), k=60)’。

     サンプルの大きさが母集団の大きさより大きい場合 *note ValueError:
     2ee. が送出されます。

     バージョン 3.9 で変更: 'counts' 引数が追加されました。

     バージョン 3.11 で変更: 'population' 変数はシーケンスでなければなり
     ません。 setsのリストへの暗黙の型変換はサポートされていません。


File: python.info,  Node: Discrete distributions,  Next: 実数分布,  Prev: シーケンス用の関数,  Up: random --- 疑似乱数を生成する

5.10.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.10.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(): 1c36. より少しだけ高速です。

     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(): 1c36. 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.10.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: 19c, *note float:
     197, *note str: 16a, *note bytes: 193, *note bytearray: 342. に制限
     されています。

     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 ‘seed()’
          behaviour of ‘Random’ instances.

      -- メソッド: getstate ()

          Override this method in subclasses to customise the
          ‘getstate()’ behaviour of ‘Random’ instances.

      -- メソッド: setstate (state)

          Override this method in subclasses to customise the
          ‘setstate()’ behaviour of ‘Random’ instances.

      -- メソッド: random ()

          Override this method in subclasses to customise the ‘random()’
          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
          ‘getrandbits()’ behaviour of ‘Random’ instances.

      -- メソッド: randbytes (n)

          Override this method in subclasses to customise the
          ‘randbytes()’ behaviour of ‘Random’ instances.

 -- クラス: random.SystemRandom ([seed])

     オペレーティングシステムの提供する発生源によって乱数を生成する
     *note os.urandom(): 746. 関数を使うクラスです。すべてのシステムで使
     えるメソッドではありません。ソフトウェアの状態に依存してはいけませ
     んし、一連の操作は再現不能です。従って、 *note seed(): 148f. メソッ
     ドは何の影響も及ぼさず、無視されます。 *note getstate(): 2bd6. と
     *note setstate(): 2bd7. メソッドが呼び出されると、例外 *note
     NotImplementedError: 369. が送出されます。


File: python.info,  Node: 再現性について,  Next: 使用例<7>,  Prev: 他の生成器,  Up: random --- 疑似乱数を生成する

5.10.6.8 再現性について
.......................

疑似乱数生成器から与えられたシーケンスを再現できると便利なことがあります
。シード値を再利用することで、複数のスレッドが実行されていない限り、実行
ごとに同じシーケンスが再現できます。

random モジュールのアルゴリズムやシード処理関数のほとんどは、Python バー
ジョン間で変更される対象となりますが、次の二点は変更されないことが保証さ
れています:

   * 新しいシード処理メソッドが追加されたら、後方互換なシード処理器が提
     供されます。

   * 生成器の *note random(): 2bea. メソッドは、互換なシード処理器に同じ
     シードが与えられた場合、引き続き同じシーケンスを生成します。


File: python.info,  Node: 使用例<7>,  Next: レシピ<2>,  Prev: 再現性について,  Up: random --- 疑似乱数を生成する

5.10.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.10.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(): 953. 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: 2bde. 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(): 953.

   ---------- Footnotes ----------

   (1) https://allendowney.com/research/rand/downey07randfloat.pdf


File: python.info,  Node: コマンドラインでの使用<2>,  Next: コマンドラインの例,  Prev: レシピ<2>,  Up: random --- 疑似乱数を生成する

5.10.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(): 144c. を使用してランダムに選択して出力します。

 -- Option: -i <N>
 -- Option: --integer <N>

     *note randint(): 144b. を使用して1からNの間(Nを含む)のランダムな整
     数を出力します。

 -- Option: -f <N>
 -- Option: --float <N>

     *note uniform(): 2bdf. を使用して0からNの間(Nを含む)のランダムな浮
     動小数点数を出力します。

オプションが指定されない場合、出力は入力に依存します。

   * 文字列または複数: *note -choice: 2bf3. と同じ。

   * 整数: *note -integer: 2bf5. と同じ。

   * 浮動小数点数: *note -float: 2bf7. と同じ。


File: python.info,  Node: コマンドラインの例,  Prev: コマンドラインでの使用<2>,  Up: random --- 疑似乱数を生成する

5.10.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.10.7 ‘statistics’ -- 数学的統計関数
-------------------------------------

Added in version 3.4.

'ソースコード:' Lib/statistics.py(1)

__________________________________________________________________

このモジュールは、数値 (*note Real: 2651. 型) データを数学的に統計計算す
るための関数を提供します。

このモジュールは、 NumPy(2), SciPy(3) のような third-party ライブラリや
、Minitab、SAS、Matlab のようなプロ統計家向けのフル装備なプロプライエタ
リ統計パッケージと競合することを意図していません。グラフ関数電卓のレベル
を対象としています。

特に明記しない限り、これらの関数は *note int: 19c, *note float: 197,
*note Decimal: 200. そして *note Fraction: 215. をサポートします。他の型
(算術型及びそれ以外) は現在サポートされていません。型が混ざったコレクシ
ョンも未定義で実装依存です。入力データが複数の型からなる場合、*note
map(): 1a0. を使用すると正しい結果が得られるでしょう。 例: ‘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.10.7.1 平均及び中心位置の測度
...............................

これらの関数は母集団または標本の平均値や標準値を計算します。

*note mean(): 8e2.          データの算術平均 (いわゆる「平均」) 。
                            
                            
*note fmean(): c2d.         Fast, floating-point arithmetic mean, with optional weighting.
                            
                            
*note geometric_mean(): c2e.データの幾何平均。
                            
                            
*note harmonic_mean(): ee1. データの調和平均。
                            
                            
*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(): 2bfe.       データのメジアン(中央値)。
                            
                            
*note median_low(): 2bff.   データの low median。
                            
                            
*note median_high(): 2c00.  データの high median。
                            
                            
*note median_grouped(): 2c01.Median (50th percentile) of grouped data.
                            
                            
*note mode(): c89.          離散/名義尺度データの最頻値 (single mode) 。
                            
                            
*note multimode(): c2f.     離散/名義尺度データの最頻値 (list of modes) 。
                            
                            
*note quantiles(): c30.     データの等確率での分割。
                            


File: python.info,  Node: 分散の測度,  Next: 2入力間の関係の統計,  Prev: 平均及び中心位置の測度,  Up: statistics --- 数学的統計関数

5.10.7.2 分散の測度
...................

これらの関数は母集団または標本が標準値や平均値からどれくらい離れているか
について計算します。

*note pstdev(): 181e.       データの母標準偏差。
                            
                            
*note pvariance(): 2c03.    データの母分散。
                            
                            
*note stdev(): 8e4.         データの標本標準偏差。
                            
                            
*note variance(): 8e3.      データの標本標準分散。
                            


File: python.info,  Node: 2入力間の関係の統計,  Next: 関数の詳細,  Prev: 分散の測度,  Up: statistics --- 数学的統計関数

5.10.7.3 2入力間の関係の統計
............................

これらの関数は、2つの入力間の関係について統計量を計算します。

*note covariance(): a35.      2変数の標本共分散。
                              
                              
*note correlation(): 6e3.     ピアソンとスピアマンの相関係数。
                              
                              
*note linear_regression(): a36.単回帰の傾きと切片。
                              


File: python.info,  Node: 関数の詳細,  Next: 例外<5>,  Prev: 2入力間の関係の統計,  Up: statistics --- 数学的統計関数

5.10.7.4 関数の詳細
...................

註釈: 関数の引数となるデータをソートしておく必要はありません。例の多くが
ソートされているのは見やすさのためです。

 -- の関数: statistics.mean (data)

     シーケンス型またはイテラブルになり得る 'data' の標本算術平均を返し
     ます。

     算術平均はデータの総和をデータ数で除したものです。単に「平均」と呼
     ばれることも多いですが、数学における平均の一種に過ぎません。データ
     の中心位置の測度の一つです。

     'data' が空の場合 *note StatisticsError: 2c06. を送出します。

     使用例:

          >>> 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(): 2bfe. を参照してください。

          標本平均は真の母平均の不偏推定量のため、出来る限り多くの標本か
          ら平均を求めると、‘mean(sample)’ は真の母平均に収束します (訳
          注: 大数の法則)。'data' が標本ではなく母集団全体の場合、
          ‘mean(data)’ は真の母平均 μ を計算することと等価です。

 -- の関数: statistics.fmean (data, weights=None)

     'data' を float に変換し、算術平均を計算します。

     This runs faster than the *note mean(): 8e2. function and it always
     returns a *note float: 197.  The 'data' may be a sequence or
     iterable.  If the input dataset is empty, raises a *note
     StatisticsError: 2c06.

          >>> 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: 2ee. 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: 2c06. 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():
     8e2. の逆数です。例えば、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: 2c06. 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: 2c06. will be raised if the 'data'
     sequence is empty.

     Wikipedia has an example(6) where we can use ‘kde()’ 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: 2c06. will be raised if the 'data'
     sequence is empty.

     Continuing the example for *note kde(): 553, we can use
     ‘kde_random()’ 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: 2c06. が送出されます。'data' はシーケンス型または
     イテラブルにもなれます。

     中央値は外れ値の影響を受けにくいため、中心位置のロバストな測度です
     。データ数が奇数の場合は中央の値を返します:

          >>> median([1, 3, 5])
          3

     データ数が偶数の場合は、中央値は中央に最も近い2値の算術平均で補間さ
     れます:

          >>> median([1, 3, 5, 7])
          4.0

     データが離散的で、中央値がデータ点にない値でも構わない場合に適して
     います。

     もしあなたのデータが（注文操作をサポートする）序数で、（追加操作を
     サポートしない）数値でないならば、代わりに *note median_low():
     2bff. または *note median_high(): 2c00. の使用を検討してください。

 -- の関数: statistics.median_low (data)

     数値データの小さい方の中央値(low median)を返します。もし 'data' が
     空の場合、*note StatisticsError: 2c06. が送出されます。'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: 2c06. が送出されます。 '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(): 2bfe. 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
     ‘median_grouped()’:

          >>> 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: 2c06. 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: 185,
     consider casting to *note frozenset: 7f2.  To handle type *note
     list: 24f, 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: 2c06. 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(): 2c03. を参照してください。

          >>> 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(): 8e3. を使いましょう。

     'data' が空の場合 *note StatisticsError: 2c06. を送出します。

     例:

          >>> 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(): 8e3. を参照してください。

          >>> 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(): 2c03. を参照してください。

     'data' の値が2より少ない場合 *note StatisticsError: 2c06. を送出し
     ます。

     例:

          >>> 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(): 2c03. の引数 '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: 2c06. 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: 2c06. 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: 2c06. 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: 2c06. 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: 2c06. 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.10.7.5 例外
.............

例外が1つ定義されています:

 -- 例外: statistics.StatisticsError

     統計関係の例外。*note ValueError: 2ee. の派生クラス。


File: python.info,  Node: NormalDist オブジェクト,  Next: 例とレシピ<2>,  Prev: 例外<5>,  Up: statistics --- 数学的統計関数

5.10.7.6 ‘NormalDist’ オブジェクト
..................................

*note NormalDist: c31. 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: 2c06. を送出します。

      -- の属性: 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(): c2d.
          and *note stdev(): 8e4.

          The 'data' can be any *note iterable: 12f5. and should consist
          of values that can be converted to type *note float: 197.  If
          'data' does not contain at least two elements, raises *note
          StatisticsError: 2c06. 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: 24f. of *note float: 197.
          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(): 148f. and *note
          random.gauss(): 1c35.

      -- メソッド: 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 ‘NormalDist’ 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 ‘NormalDist’ 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 ‘NormalDist’.  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.10.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.10.7.8 Classic probability problems
.....................................

*note NormalDist: c31. 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.10.7.9 Monte Carlo inputs for simulations
...........................................

To estimate the distribution for a model that isn't easy to solve
analytically, *note NormalDist: c31. 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.10.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.10.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: c31.:

     >>> 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.11 関数型プログラミング用モジュール
=====================================

この章では、関数型プログラミングスタイルをサポートする呼び出し可能で汎用
な操作を実現する関数やクラスについて説明します。

この章では以下のモジュールが記述されています:

* Menu:

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


File: python.info,  Node: itertools --- 効率的なループ用のイテレータ生成関数群,  Next: functools --- 高階関数と呼び出し可能オブジェクトの操作,  Up: 関数型プログラミング用モジュール

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

__________________________________________________________________

このモジュールは *note イテレータ: 4c8. を構築する部品を実装しています。
プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に
適した形に修正されています。

このモジュールは、高速でメモリ効率に優れ、単独でも組合せても使用すること
のできるツールを標準化したものです。同時に、このツール群は "イテレータの
代数" を構成していて、pure Python で簡潔かつ効率的なツールを作れるように
しています。

例えば、SML の作表ツール ‘tabulate(f)’ は ‘f(0), f(1), ...’ のシーケンス
を作成します。同じことを Python では *note map(): 1a0. と *note count():
149f. を組合せて ‘map(f, count())’ という形で実現できます。

'General iterators:'

イテレータ                       引数                             結果                                                  使用例
                                                                                                                        
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                        
*note accumulate(): bf4.         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(): 263d.             p, q, ...                        p0, p1, ...  plast, q0, q1, ...                       ‘chain('ABC', 'DEF') → A B C D E F’
                                                                                                                        
                                                                                                                        
*note chain.from_iterable(): 2c1f.iterable                        p0, p1, ...  plast, q0, q1, ...                       ‘chain.from_iterable(['ABC', 'DEF']) → A B C D E F’
                                                                                                                        
                                                                                                                        
*note compress(): 149e.          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 count(): 149f.             [start[, step]]                  start, start+step, start+2*step, ...                  ‘count(10) → 10 11 12 13 14 ...’
                                                                                                                        
                                                                                                                        
*note cycle(): 2c20.             p                                p0, p1, ...  plast, p0, p1, ...                       ‘cycle('ABCD') → A B C D A B C D ...’
                                                                                                                        
                                                                                                                        
*note dropwhile(): 2c21.         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(): 262d.       predicate, seq                   elements of seq where predicate(elem) fails           ‘filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8’
                                                                                                                        
                                                                                                                        
*note groupby(): 17cc.           iterable[, key]                  key(v) の値でグループ化したサブイテレータ             ‘groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)’
                                                                                                                        
                                                                                                                        
*note islice(): d47.             seq, [start,] stop [, step]      seq[start:stop:step]                                  ‘islice('ABCDEFG', 2, None) → C D E F G’
                                                                                                                        
                                                                                                                        
*note pairwise(): a1a.           iterable                         (p[0], p[1]), (p[1], p[2])                            ‘pairwise('ABCDEFG') → AB BC CD DE EF FG’
                                                                                                                        
                                                                                                                        
*note repeat(): 18be.            elem [,n]                        elem, elem, elem, ...  無限もしくは n 回              ‘repeat(10, 3) → 10 10 10’
                                                                                                                        
                                                                                                                        
*note starmap(): 12fe.           func, seq                        func(*seq[0]), func(*seq[1]), ...                     ‘starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000’
                                                                                                                        
                                                                                                                        
*note takewhile(): 2c22.         predicate, seq                   seq[0], seq[1], until predicate fails                 ‘takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4’
                                                                                                                        
                                                                                                                        
*note tee(): 2c23.               it, n                            it1, it2 , ...  itn 一つのイテレータを n 個に分ける   ‘tee('ABC', 2) → A B C, A B C’
                                                                                                                        
                                                                                                                        
*note zip_longest(): 14ba.       p, q, ...                        (p[0], q[0]), (p[1], q[1]), ...                       ‘zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-’
                                                                                                                        

'組合せイテレータ:'

イテレータ                                         引数                     結果
                                                                            
----------------------------------------------------------------------------------------------------------------------------------------------
                                                                            
*note product(): 152e.                             p, q, ...  [repeat=1]    デカルト積、ネストしたforループと等価
                                                                            
                                                                            
*note permutations(): 1d3b.                        p[, r]                   長さrのタプル列、重複なしのあらゆる並び
                                                                            
                                                                            
*note combinations(): 152d.                        p, r                     長さrのタプル列、ソートされた順で重複なし
                                                                            
                                                                            
*note combinations_with_replacement(): 149d.       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.11.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(): 110f.
     For a running maximum, set 'function' to *note max(): 1110.  Or for
     a running product, set 'function' to *note operator.mul(): 2c26.
     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(): 21c. を見てください。

     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: 2ee. 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(): 263d. のためのもう一つのコンストラクタです。遅延評価
     される 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(): 152e. keeping only
     entries that are subsequences of the 'iterable'.  The length of the
     output is given by *note math.comb(): 8e0. 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(): 152e. 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(): 1a0. to generate
     consecutive data points or with *note zip(): 1a1. 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(): 17cc. の操作は Unix の ‘uniq’ フィルターと似ていま
     す。 key 関数の値が変わるたびに休止または新しいグループを生成します
     (このために通常同じ key 関数でソートしておく必要があるのです)。この
     動作は SQL の入力順に関係なく共通の要素を集約する GROUP BY とは違い
     ます。

     返されるグループはそれ自体がイテレータで、 *note groupby(): 17cc. と
     'iterable' を共有しています。もととなる 'iterable' を共有しているた
     め、 ‘groupby()’ オブジェクトの要素取り出しを先に進めると、それ以前
     の要素であるグループは見えなくなってしまいます。従って、データが後
     で必要な場合にはリストの形で保存しておく必要があります:

          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(): 17cc. はおよそ次と等価です:

          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(): 152e. where entries
     with repeated elements have been filtered out.  The length of the
     output is given by *note math.perm(): 8e1. 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(): 152e. は動作する前に、入力のイテラブルを完全に読み
     取り、直積を生成するためにメモリ内に値を蓄えます。したがって、入力
     が有限の場合に限り有用です。

 -- の関数: 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(): 1a0.
     when argument parameters have already been "pre-zipped" into
     tuples.

     The difference between *note map(): 1a0. and ‘starmap()’ 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(): 2c23. call.  This "flattening
     step" allows nested ‘tee()’ 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: 246. may
     be raised when simultaneously using iterators returned by the same
     *note tee(): 2c23. call, even if the original 'iterable' is
     threadsafe.

     *note tee(): 2c23. はかなり大きなメモリ領域を使用するかもしれません
     (使用するメモリ量はiterableの大きさに依存します)。一般には、一つの
     イテレータが他のイテレータよりも先にほとんどまたは全ての要素を消費
     するような場合には、 ‘tee()’ よりも *note list(): 24f. を使った方が
     高速です。

 -- の関数: 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
     ‘zip_longest()’ function should be wrapped with something that
     limits the number of calls (for example *note islice(): d47. or
     *note takewhile(): 2c22.).

   ---------- 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.11.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: 1270.
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 heapq import heappush, heappushpop, heappush_max, heappushpop_max
     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 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


     # ==== Running statistics ====

     def running_mean(iterable):
         "Average of values seen so far."
         # running_mean([37, 33, 38, 28]) → 37 35 36 34
         return map(truediv, accumulate(iterable), count(1))

     def running_min(iterable):
         "Smallest of values seen so far."
         # running_min([37, 33, 38, 28]) → 37 33 33 28
         return accumulate(iterable, func=min)

     def running_max(iterable):
         "Largest of values seen so far."
         # running_max([37, 33, 38, 28]) → 37 37 38 38
         return accumulate(iterable, func=max)

     def running_median(iterable):
         "Median of values seen so far."
         # running_median([37, 33, 38, 28]) → 37 35 37 35
         read = iter(iterable).__next__
         lo = []  # max-heap
         hi = []  # min-heap the same size as or one smaller than lo
         with suppress(StopIteration):
             while True:
                 heappush_max(lo, heappushpop(hi, read()))
                 yield lo[0]
                 heappush(hi, heappushpop_max(lo, read()))
                 yield (lo[0] + hi[0]) / 2

     def running_statistics(iterable):
         "Aggregate statistics for values seen so far."
         # Generate tuples:  (size, minimum, median, maximum, mean)
         t0, t1, t2, t3 = tee(iterable, 4)
         return zip(
             count(1),
             running_min(t0),
             running_median(t1),
             running_max(t2),
             running_mean(t3),
         )

   ---------- 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.11.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(): be6. 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 ‘cached_property()’ can
     also be achieved by stacking *note property(): 4b3. on top of *note
     lru_cache(): be6.  See *note メソッド呼び出しをキャッシュするには
     どうしたらいいですか？: 2c2b. for more details on how this differs
     from ‘cached_property()’.

     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: 100a. に変換します。
     key 関数を受け取るツール (*note sorted(): dcb, *note min(): 110f,
     *note max(): 1110, *note heapq.nlargest(): 2a1b, *note
     heapq.nsmallest(): 2a1c, *note itertools.groupby(): 17cc. など) と
     共に使用します。この関数は、主に比較関数を使っていた Python 2 から
     プログラムの移行のための変換ツールとして使われます。

     比較関数は2つの引数を受け取り、それらを比較し、 "より小さい" 場合は
     負の数を、同値の場合には 0 を、 "より大きい" 場合には正の数を返す、
     あらゆる呼び出し可能オブジェクトです。key 関数は呼び出し可能オブジ
     ェクトで、1つの引数を受け取り、ソートキーとして使われる値を返します
     。

     以下はプログラム例です:

          sorted(iterable, key=cmp_to_key(locale.strcoll))  # locale-aware sort order

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f7.
     を参照して下さい。

     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 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: 184. 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 メソッド呼び出しをキャッシュするには
     どうしたらいいですか？: 2c2b.

     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__(): 14bc, *note __le__():
     1526, *note __gt__(): 1527, or *note __ge__(): 1528.  In addition,
     the class should supply an *note __eq__(): cf6. 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(): 219. and *note
     partialmethod(): 21a.

     Added in version 3.14.

 -- の関数: functools.partial (func, /, *args, **keywords)

     新しい *note partial オブジェクト: 21b. を返します。このオブジェク
     トは呼び出されると位置引数 '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, ‘partial()’ can be used to create a callable that
     behaves like the *note int(): 19c. 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: 218. 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: 199,
     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: 218.
     in positional arguments.

 -- クラス: functools.partialmethod (func, /, *args, **keywords)

     *note partial: 219. と似た動作をする新しい *note partialmethod:
     21a. 記述子 (デスクリプタ) を返します。直接呼び出しではなく、メソッ
     ド定義としての使用が目的であることのみが、partial とは異なります。

     'func' は、*note descriptor: 18e5. または呼び出し可能オブジェクトで
     ある必要があります (通常の関数など、両方の性質を持つオブジェクトは
     記述子として扱われます。)

     When 'func' is a descriptor (such as a normal Python function,
     *note classmethod(): 48e, *note staticmethod(): 451, *note
     abstractmethod(): 129b. or another instance of ‘partialmethod’),
     calls to ‘__get__’ are delegated to the underlying descriptor, and
     an appropriate *note partial object: 21b. returned as the result.

     'func' が記述子以外の呼び出し可能オブジェクトである場合、適切な束縛
     メソッドが動的に作成されます。この func は、メソッドとして使用され
     た場合、Python の通常の関数と同様に動作します。 *note
     partialmethod: 21a. コンストラクタに '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(): bf4. を参照してください。

     バージョン 3.14 で変更: 'initial' is now supported as a keyword
     argument.

 -- の関数: @functools.singledispatch

     関数を *note シングルディスパッチ: be7. *note ジェネリック関数:
     be8. に変換します。

     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: 2aa. 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: 2c2f. and pre-existing
     functions, the *note register(): 2c2e. attribute can also be used
     in a functional form:

          >>> def nothing(arg, verbose=False):
          ...     print("Nothing.")
          ...
          >>> fun.register(type(None), nothing)

     The *note register(): 2c2e. 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:
     c82. 型に登録されます。これは、他によりよい実装が見つからないことを
     意味します。

     抽象基底クラス (*note abstract base class: 13d2.) に対して実装が登
     録されると、基底クラスの仮想サブクラスに対してもその実装がディスパ
     ッチされます:

          >>> 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(): 2c2e. attribute now
     supports using type annotations.

     バージョン 3.11 で変更: The *note register(): 2c2e. attribute now
     supports *note typing.Union: 2aa. as a type annotation.

 -- クラス: functools.singledispatchmethod (func)

     メソッドを *note シングルディスパッチ: be7. *note ジェネリック関数:
     be8. に変換します。

     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: 451, *note @~abc.abstractmethod: 129b, 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__: 23a6, *note __name__:
     14f0, *note __qualname__: 23a5, *note __annotations__: 13f4, *note
     __type_params__: 23a9, and *note __doc__: 13f5, the documentation
     string) and ‘WRAPPER_UPDATES’ (which updates the wrapper function's
     *note __dict__: 14ee, i.e.  the instance dictionary).

     内観や別の目的 (例えば、 *note lru_cache(): be6. のようなキャッシュ
     するデコレータの回避) のために元の関数にアクセスできるように、この
     関数はラップされている関数を参照するラッパーに自動的に
     ‘__wrapped__’ 属性を追加します。

     この関数は主に関数を包んでラッパーを返す *note デコレータ: 93e. 関
     数の中で使われるよう意図されています。もしラッパー関数がアップデー
     トされないとすると、返される関数のメタデータは元の関数の定義ではな
     くラッパー関数の定義を反映してしまい、これは通常あまり有益ではあり
     ません。

     *note update_wrapper(): 1227. は、関数以外の呼び出し可能オブジェク
     トにも使えます。 'assigned' または 'updated' で指名され、ラップされ
     るオブジェクトに存在しない属性は、すべて無視されます (すなわち、ラ
     ッパー関数にそれらの属性を設定しようとは試みられません)。しかし、
     'updated' で指名された属性がラッパー関数自身に存在しないなら *note
     AttributeError: 5f0. が送出されます。

     バージョン 3.2 で変更: The ‘__wrapped__’ attribute is now
     automatically added.  The *note __annotations__: 13f4. 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__: 23a9. attribute
     is now copied by default.

 -- の関数: @functools.wraps (wrapped, assigned=WRAPPER_ASSIGNMENTS,
          updated=WRAPPER_UPDATES)

     これはラッパー関数を定義するときに *note update_wrapper(): 1227. を
     関数デコレータとして呼び出す便宜関数です。これは
     ‘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.11.2.1 ‘partial’ オブジェクト
...............................

*note partial: 219. オブジェクトは、 *note partial(): 219. 関数によって
作られる呼び出し可能オブジェクトです。オブジェクトには読み出し専用の属性
が三つあります:

 -- の属性: partial.func

     呼び出し可能オブジェクトまたは関数です。 *note partial: 219. オブジ
     ェクトの呼び出しは新しい引数とキーワードと共に *note func: 2c31. に
     転送されます。

 -- の属性: partial.args

     最左の位置引数で、 *note partial: 219. オブジェクトの呼び出し時にそ
     の呼び出しの際の位置引数の前に追加されます。

 -- の属性: partial.keywords

     *note partial: 219. オブジェクトの呼び出し時に渡されるキーワード引
     数です。

*note partial: 219. 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__:
1276. and *note __doc__: b25. attributes are not created automatically.


File: python.info,  Node: operator --- 関数形式の標準演算子,  Prev: functools --- 高階関数と呼び出し可能オブジェクトの操作,  Up: 関数型プログラミング用モジュール

5.11.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 比較: 2530. を参照してください。

論理演算もまた全てのオブジェクトに対して適用でき、真理値判定、同一性判定
およびブール演算をサポートします:

 -- の関数: operator.not_ (obj)
 -- の関数: operator.__not__ (obj)

     *note not: 253a. 'obj' の結果を返します。(オブジェクトインスタンス
     には ‘__not__()’ メソッドは無いので注意してください; インタープリタ
     ーコアがこの演算を定義しているだけです。結果は *note __bool__():
     14f1. および *note __len__(): 17ff. メソッドに影響されます。)

 -- の関数: operator.truth (obj)

     'obj' が真の場合 *note True: e0b. を返し、そうでない場合 *note
     False: d2f. を返します。この関数は *note bool: 3c1. のコンストラク
     タ呼び出しと同等です。

 -- の関数: 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)

     Return ‘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: 19c. 型です。 以
     前は、結果は ‘int’ のサブクラスのインスタンスのこともありました。

 -- の関数: operator.inv (obj)
 -- の関数: operator.invert (obj)
 -- の関数: operator.__inv__ (obj)
 -- の関数: operator.__invert__ (obj)

     Return ‘~obj’.

 -- の関数: operator.lshift (a, b)
 -- の関数: operator.__lshift__ (a, b)

     Return ‘a << b’.

 -- の関数: operator.mod (a, b)
 -- の関数: operator.__mod__ (a, b)

     ‘a % b’ を返します。

 -- の関数: operator.mul (a, b)
 -- の関数: operator.__mul__ (a, b)

     Return ‘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)

     Return ‘a | b’.

 -- の関数: operator.pos (obj)
 -- の関数: operator.__pos__ (obj)

     Return ‘+obj’.

 -- の関数: operator.pow (a, b)
 -- の関数: operator.__pow__ (a, b)

     Return ‘a ** b’.

 -- の関数: operator.rshift (a, b)
 -- の関数: operator.__rshift__ (a, b)

     Return ‘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)

     Return ‘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__(): 1113. を使って概算の長さを、そして
     最後にデフォルトの値を返そうとします。

     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(): 1a0, *note sorted(): dcb, *note
itertools.groupby(): 17cc, 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(): c5b. を使って特定のフィールドをタプルレコードか
     ら取り出す例:

          >>> 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.11.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)’
                                                          
                                                          
Bitwise And, or             ‘a & b’                       ‘and_(a, b)’
Intersection                                              

Bitwise Exclusive Or, or    ‘a ^ b’                       ‘xor(a, b)’
Symmetric Difference                                      

Bitwise Inversion, or       ‘~ a’                         ‘invert(a)’
Complement                                                

Bitwise Or, or Union        ‘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.11.3.2 インプレース (in-place) 演算子
.......................................

多くの演算に「インプレース」版があります。 以下の関数はそうした演算子の
通常の文法に比べてより素朴な呼び出し方を提供します。たとえば、 *note 文:
2c78. ‘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.12 ファイルとディレクトリへのアクセス
=======================================

この章で説明されるモジュールはディスクのファイルやディレクトリを扱います
。たとえば、ファイルの属性を読むためのモジュール、ファイルパスを移植可能
な方式で操作する、テンポラリファイルを作成するためのモジュールです。この
章の完全な一覧は:

* 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.12.1 ‘pathlib’ -- オブジェクト指向のファイルシステムパス
----------------------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/pathlib/(1)

__________________________________________________________________

このモジュールはファイルシステムのパスを表すクラスを提供していて、様々な
オペレーティングシステムについての適切な意味論をそれらのクラスに持たせて
います。 Path クラスは *note 純粋パス: 2c9a. と *note 具象パス: 2c9b. か
らなります。 純粋パスは 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: 268. はきっとあなたに必
要なものでしょう。 ‘Path’ はコードが実行されているプラットフォーム用の
*note 具象パス: 2c9b. のインスタンスを作成します。

純粋パスは、以下のようないくつかの特殊なケースで有用です:

  1. Unix マシン上で Windows のパスを扱いたいとき (またはその逆)。Unix 上
     で実行しているときに *note WindowsPath: 2c9c. のインスタンスを作成
     することはできませんが、*note PureWindowsPath: 1ad6. なら可能になり
     ます。

  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.12.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.12.1.2 例外
.............

 -- 例外: pathlib.UnsupportedOperation

     *note NotImplementedError: 369. を継承した例外です。パスオブジェク
     トがサポートしていない操作を行おうとした時に送出されます。

     Added in version 3.13.


File: python.info,  Node: 純粋パス,  Next: 具象パス,  Prev: 例外<6>,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.12.1.3 純粋パス
.................

純粋パスオブジェクトは実際にファイルシステムにアクセスしないパス操作処理
を提供します。これらのクラスにアクセスするには 3 つの方法があり、それら
を 'フレーバー' と呼んでいます:

 -- クラス: pathlib.PurePath (*pathsegments)

     システムのパスのフレーバーを表すジェネリッククラスです (インスタン
     スを作成することで *note PurePosixPath: 2ca0. または *note
     PureWindowsPath: 1ad6. のどちらかが作成されます):

          >>> PurePath('setup.py')      # Running on a Unix machine
          PurePosixPath('setup.py')

     'pathsegments' の各要素は、パスの構成要素を表す文字列か、パスオブジ
     ェクトなどの、 *note os.PathLike: e4f. インターフェースを実装するオ
     ブジェクトである必要があります。 ‘os.PathLike’ インターフェースでは
     、 *note __fspath__(): e50. メソッドが文字列を返します:

          >>> 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(): 1a07. と同様):

          >>> 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: e4f. インターフェースを実
     装しており、そのインターフェースを受理する箇所ならどこでも使用する
     ことができます。

     バージョン 3.6 で変更: *note os.PathLike: e4f. インターフェースがサ
     ポートされました。

 -- クラス: 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.12.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.12.1.5 演算子
...............

スラッシュ演算子を使って、 *note os.path.join(): 1a07. のように子パスを
作成することができます。 スラッシュの右側が絶対パスである場合、左側のパ
スは無視されます。 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: e4f. を実装したオブジェクトが受理できる箇所ならどこで
も、パスオブジェクトが使用できます:

     >>> 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: 193. で呼び出すと、Raw ファイル
システムパスを *note os.fsencode(): e53. でエンコードされたバイト列オブ
ジェクトで返します:

     >>> bytes(p)
     b'/etc'

     注釈: *note bytes: 193. での呼び出しは Unix 上での使用のみ推奨しま
     す。Windows では Unicode 形式が標準的なファイルシステムパス表現にな
     ります。


File: python.info,  Node: 個別の構成要素へのアクセス,  Next: メソッドとプロパティ,  Prev: 演算子,  Up: 純粋パス

5.12.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.12.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: 2ca0. でパスの先頭が３つ以上の連続したスラッシ
     ュである場合、 余分なスラッシュは除去されます:

          >>> 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 スライス: 250e.
     と負のインデックスをサポートするようになりました。

 -- の属性: 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(): 1ace. を呼ぶことを推奨します。

 -- の属性: 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.

     バージョン 3.12 で非推奨、バージョン 3.14 で削除: 追加の引数指定は
     非推奨となりました。指定された場合は 'other' と連結されます。

 -- メソッド: PurePath.is_reserved ()

     With *note PureWindowsPath: 1ad6, return ‘True’ if the path is
     considered reserved under Windows, ‘False’ otherwise.  With *note
     PurePosixPath: 2ca0, ‘False’ is always returned.

     バージョン 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.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: This method
     is deprecated; use *note os.path.isreserved(): 329. 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: 2cad. ドキュメント。

     他のメソッドと同様に、大文字小文字の区別はプラットフォームの設定に
     従います:

          >>> 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: 2ee. 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: 2ee. が送出されます:

          >>> 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: 2ee. が送出されます。:

          >>> 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(): 1ace. first if necessary to resolve symlinks.

     バージョン 3.12 で変更: 'walk_up' 引数が追加されました（
     ‘walk_up=False’ を指定すると以前の動作と同じになります）。

     バージョン 3.12 で非推奨、バージョン 3.14 で削除: 追加の位置引数の
     指定は非推奨となりました。指定された場合は 'other' と連結されます。

 -- メソッド: PurePath.with_name (name)

     現在のパスの *note name: 2ca9. 部分を変更したパスを返します。オリジ
     ナルパスに ‘name’ 部分がない場合は 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: 2caa. 部分を変更したパスを返します。オリジ
     ナルパスに ‘stem’ 部分がない場合は 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: 19b7. を変更した新しいパスを返します。 元のパスに
     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: 2ee. 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: 1afe. and *note
     relative_to(): 2ff.  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.12.1.8 具象パス
.................

具象パスは純粋パスクラスのサブクラスです。純粋パスが提供する操作に加え、
パスオブジェクト上でシステムコールを呼ぶメソッドも提供しています。具象パ
スのインスタンスを作成するには 3 つの方法があります:

 -- クラス: pathlib.Path (*pathsegments)

     *note PurePath: 6cd. のサブクラスであり、システムのパスフレーバーの
     具象パスを表します (このインスタンスの作成で *note PosixPath: 2caf.
     か *note WindowsPath: 2c9c. のどちらかが作成されます):

          >>> Path('setup.py')
          PosixPath('setup.py')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

 -- クラス: pathlib.PosixPath (*pathsegments)

     *note Path: 268. および *note PurePosixPath: 2ca0. のサブクラスで、
     非 Windows ファイルシステムの具象パスを表します:

          >>> PosixPath('/etc/hosts')
          PosixPath('/etc/hosts')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

     バージョン 3.13 で変更: Windows では *note UnsupportedOperation:
     533. を送出します。以前のバージョンでは代わりに *note
     NotImplementedError: 369. を送出していました。

 -- クラス: pathlib.WindowsPath (*pathsegments)

     *note Path: 268. および *note PureWindowsPath: 1ad6. のサブクラスで
     、Windows ファイルシステムの具象パスを表します:

          >>> WindowsPath('c:/', 'Users', 'Ximénez')
          WindowsPath('c:/Users/Ximénez')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

     バージョン 3.13 で変更: Windows 以外のプラットフォームでは *note
     UnsupportedOperation: 533. を送出します。以前のバージョンでは代わり
     に *note NotImplementedError: 369. を送出していました。

インスタンスを作成できるのはシステムと一致するフレーバーのみです (互換性
のないパスフレーバーでのシステムコールの許可はバグやアプリケーションの異
常終了の原因になります):

     >>> 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: 2c2. 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.12.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: 2cb1.

 -- メソッド: 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: 2ee. 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: 2ee. is raised.

 -- メソッド: Path.as_uri ()

      'file' URI で表したパスを返します。絶対パスではない場合に *note
     ValueError: 2ee. を送出します。

          >>> p = PosixPath('/etc/passwd')
          >>> p.as_uri()
          'file:///etc/passwd'
          >>> p = WindowsPath('c:/Windows')
          >>> p.as_uri()
          'file:///c:/Windows'

     バージョン 3.14 で非推奨、バージョン 3.19 で削除予定: Calling this
     method from *note PurePath: 6cd. rather than *note Path: 268. is
     possible but deprecated.  The method's use of *note os.fsencode():
     e53. makes it strictly impure.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc8089.html


File: python.info,  Node: パスの展開と解決,  Next: ファイルの種類とステータスを問い合わせる,  Prev: URIのパースと生成,  Up: 具象パス

5.12.1.10 パスの展開と解決
..........................

 -- メソッド: classmethod Path.home ()

     ユーザーのホームディレクトリ (*note os.path.expanduser(): c0d. での
     ‘~’ の返り値) を表す新しいパスオブジェクトを返します。ホームディレ
     クトリが解決できない場合は、 *note RuntimeError: 246. を送出します
     。

          >>> Path.home()
          PosixPath('/home/antoine')

     Added in version 3.5.

 -- メソッド: Path.expanduser ()

     パス要素 ‘~’ および ‘~user’ を *note os.path.expanduser(): c0d. が
     返すように展開した新しいパスオブジェクトを返します。ホームディレク
     トリが解決できない場合は、 *note RuntimeError: 246. を送出します。

          >>> p = PosixPath('~/films/Monty Python')
          >>> p.expanduser()
          PosixPath('/home/eric/films/Monty Python')

     Added in version 3.5.

 -- メソッド: classmethod Path.cwd ()

     (*note os.getcwd(): 196a. が返す) 現在のディレクトリを表す新しいパ
     スオブジェクトを返します:

          >>> 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: 2c2. 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: 2c2. is raised in strict mode, and no
     exception is raised in non-strict mode.  In previous versions,
     *note RuntimeError: 246. is raised no matter the value of 'strict'.

 -- メソッド: Path.readlink ()

     ( *note os.readlink(): b1e. が返す) シンボリックリンクが指すパスを
     返します:

          >>> p = Path('mylink')
          >>> p.symlink_to('setup.py')
          >>> p.readlink()
          PosixPath('setup.py')

     Added in version 3.9.

     バージョン 3.13 で変更: *note os.readlink(): b1e. が利用できない場
     合 *note UnsupportedOperation: 533. を送出します。以前のバージョン
     では *note NotImplementedError: 369. を送出していました。


File: python.info,  Node: ファイルの種類とステータスを問い合わせる,  Next: ファイルを読み書きする<2>,  Prev: パスの展開と解決,  Up: 具象パス

5.12.1.11 ファイルの種類とステータスを問い合わせる
..................................................

バージョン 3.8 で変更: *note exists(): c0f, *note is_dir(): 53a, *note
is_file(): 539, *note is_mount(): c10, *note is_symlink(): c11, *note
is_block_device(): c12, *note is_char_device(): c13, *note is_socket():
c15. は、OSレベルで表現不能な文字を含むパスに対して、例外を送出する代わ
りに ‘False’ を返すようになりました。

バージョン 3.14 で変更: The methods given above now return ‘False’
instead of raising any *note OSError: 2c2. exception from the operating
system.  In previous versions, some kinds of ‘OSError’ exception are
raised, and others suppressed.  The new behaviour is consistent with
*note os.path.exists(): c07, *note os.path.isdir(): c09, etc.  Use *note
stat(): a28. to retrieve the file status without suppressing exceptions.

 -- メソッド: Path.stat (*, follow_symlinks=True)

     (*note os.stat(): 26f. と同様の) 現在のパスについて *note
     os.stat_result: 16df. オブジェクトが含む情報を返します。値はそれぞ
     れのメソッドを呼び出した時点のものになります。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクに対して stat したい場合は ‘follow_symlinks=False’ とするか、
     *note lstat(): 2cb4. を利用してください。

          >>> p = Path('setup.py')
          >>> p.stat().st_size
          956
          >>> p.stat().st_mtime
          1327883547.852554

     バージョン 3.10 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.lstat ()

     *note Path.stat(): a28. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身の情
     報を返します。

 -- メソッド: 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(): a28. 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(): a28. 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():
     a28. 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(): a28. 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(): a28. 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(): a28.
     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(): a28. 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(): a28. to distinguish between these cases.

 -- メソッド: Path.samefile (other_path)

     このパスが参照するファイルが 'other_path' (Path オブジェクトか文字
     列) と同じであれば ‘True’ を、異なるファイルであれば ‘False’ を返し
     ます。意味的には *note os.path.samefile(): 1177. および *note
     os.path.samestat(): 1176. と同じです。

     なんらかの理由でどちらかのファイルにアクセスできない場合は *note
     OSError: 2c2. が送出されます。

          >>> p = Path('spam')
          >>> q = Path('eggs')
          >>> p.samefile(q)
          False
          >>> p.samefile('spam')
          True

     Added in version 3.5.

 -- の属性: Path.info

     A *note PathInfo: 26e. 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(): 270. then this
     attribute is initialized with some information about the file type
     gleaned from scanning the parent directory.  Merely accessing
     ‘Path.info’ 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():
     c11. 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.12.1.12 ファイルを読み書きする
................................

 -- メソッド: Path.open (mode='r', buffering=-1, encoding=None,
          errors=None, newline=None)

     組み込み関数 *note open(): 318. のようにパスが指しているファイルを
     開きます:

          >>> 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(): 318. と同じです。

     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(): 318. と同じです。

     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.12.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:
     2c2. を送出します。

 -- メソッド: 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: 2cad. ドキュメント。

     デフォルトまたは 'case_sensitive' キーワード専用引数に ‘None’ を指
     定した場合、このメソッドはパスの一致判定にプラットフォームに依存し
     た大文字小文字のルールを使用します。一般的にPOSIXは大文字と小文字を
     区別し、Windowsは区別しません。'case_sensitive' を ‘True’ または
     ‘False’ に設定するとこの動作を上書きします。

     デフォルトまたは 'recurse_symlinks' キーワード専用引数が ‘False’ に
     設定された場合、このメソッドは "‘**’" ワイルドカードの展開時にシン
     ボリックリンクをたどりません。'recurse_symlinks' を ‘True’ に設定す
     ると、つねにシンボリックリンクをたどります。

          注釈: Any *note OSError: 2c2. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: f42. when accessing directories without read
          permission.

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1ccb.
     ‘pathlib.Path.glob’ を送出します。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

     バージョン 3.13 で変更: 'recurse_symlinks' パラメータが追加されまし
     た。

     バージョン 3.13 で変更: 'pattern' パラメタが *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.13 で変更: Any *note OSError: 2c2. 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.

          注釈: Any *note OSError: 2c2. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: f42. when accessing directories without read
          permission.

     参考
     ....

     *note Pattern language: 2cad. と *note Path.glob(): 537. のドキュメ
     ント。

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1ccb.
     ‘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: 268. 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: 1b7e. or slice assignment),
     and ‘Path.walk()’ 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
     ‘Path.walk()’ about directories the caller creates or renames
     before it resumes ‘Path.walk()’ again.  Modifying 'dirnames' when
     'top_down' is false has no effect on the behavior of ‘Path.walk()’
     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(): c58. 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:
     2c2. 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, ‘Path.walk()’ 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. はすでにたどったディ
          レクトリを管理したりはしません。

          注釈: ‘Path.walk()’ 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, ‘Path.walk()’ will still try to
          descend into it.  To prevent such behavior, remove directories
          from 'dirnames' as appropriate.

          注釈: Unlike *note os.walk(): 6d0, ‘Path.walk()’ 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(): 354.  Walking the tree bottom-up is essential as
     *note rmdir(): 2cb8. 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.12.1.14 ファイルとディレクトリの作成
......................................

 -- メソッド: Path.touch (mode=0o666, exist_ok=True)

     与えられたパスにファイルを作成します。'mode' が与えられた場合、プロ
     セスの ‘umask’ 値と組み合わせてファイルのモードとアクセスフラグが決
     定されます。ファイルがすでに存在した場合、'exist_ok' が真ならばこの
     関数は正常に終了します (そしてファイルの更新日付が現在の日時に変更
     されます)。その他の場合は *note FileExistsError: 1225. が送出されま
     す。

     参考
     ....

     The *note open(): 2cb6, *note write_text(): 1048. and *note
     write_bytes(): 104a. methods are often used to create files.

 -- メソッド: Path.mkdir (mode=0o777, parents=False, exist_ok=False)

     与えられたパスに新しくディレクトリを作成します。'mode' が与えられて
     いた場合、プロセスの ‘umask’ 値と組み合わせてファイルのモードとアク
     セスフラグを決定します。パスがすでに存在していた場合 *note
     FileExistsError: 1225. が送出されます。

     'parents' の値が真の場合、このパスの親ディレクトリを必要に応じて作
     成します; それらのアクセス制限はデフォルト値が取られ、'mode' は使用
     されません (POSIX の ‘mkdir -p’ コマンドを真似ています)。

     'parents' の値が偽の場合 (デフォルト)、親ディレクトリがないと *note
     FileNotFoundError: 266. を送出します。

     'exist_ok' の値が (デフォルトの) 偽の場合、対象のディレクトリがすで
     に存在すると *note FileExistsError: 1225. を送出します。

     If 'exist_ok' is true, *note FileExistsError: 1225. 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(): 1310. と
          は逆です。

     バージョン 3.13 で変更: *note os.symlink(): 1310. が利用できない場
     合 *note UnsupportedOperation: 533. を送出します。以前のバージョン
     では *note NotImplementedError: 369. を送出していました。

 -- メソッド: Path.hardlink_to (target)

     このパスを 'target' と同じファイルへのハードリンクにします。

          注釈: 引数の並び (link, target) は *note os.link(): 130b. とは
          逆です。

     Added in version 3.10.

     バージョン 3.13 で変更: *note os.link(): 130b. が利用できない場合
     *note UnsupportedOperation: 533. を送出します。以前のバージョンでは
     *note NotImplementedError: 369. を送出していました。


File: python.info,  Node: Copying moving and deleting,  Next: パーミッションと所有者,  Prev: ファイルとディレクトリの作成,  Up: 具象パス

5.12.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(): 269.  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: 1225. が送出されます。 '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(): 130d. 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: 2c2. is
     raised.

     If both paths are on the same filesystem, the move is performed
     with *note os.replace(): 130e.  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(): 2cb8. を使用してください。

     'missing_ok' の値が (デフォルトの) 偽の場合、対象のファイルが存在し
     ないと *note FileNotFoundError: 266. を送出します。

     'missing_ok' の値が真の場合、 *note FileExistsError: 1225. 例外を送
     出しません (POSIX の ‘rm -f’ コマンドの挙動と同じ)。

     バージョン 3.8 で変更: 'missing_ok' 引数が追加されました。

 -- メソッド: Path.rmdir ()

     現在のディレクトリを削除します。ディレクトリは空でなければなりませ
     ん。


File: python.info,  Node: パーミッションと所有者,  Prev: Copying moving and deleting,  Up: 具象パス

5.12.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: 369. を送出していました。

     バージョン 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: 369. を送出していました。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.chmod (mode, *, follow_symlinks=True)

     *note os.chmod(): 529. のようにファイルのモードとアクセス権限を変更
     します。

     このメソッドは通常シンボリックリンクをたどります。一部のUnixではシ
     ンボリックリンク自体のパーミッション変更をサポートしています。その
     ようなプラットフォームでは引数に''follow_symlinks=False'' を追加す
     るか、*note lchmod(): 2cbe. を使用してください。

          >>> 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(): a29. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身のモ
     ードが変更されます。


File: python.info,  Node: Pattern language,  Next: glob モジュールとの比較,  Prev: 具象パス,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.12.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: 87b. or *note altsep: 87c.)
returns only directories.


File: python.info,  Node: glob モジュールとの比較,  Next: os と os path モジュールの比較,  Prev: Pattern language,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.12.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: 268. 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.12.1.19 ‘os’ と ‘os.path’ モジュールの比較
............................................

pathlib implements path operations using *note PurePath: 6cd. and *note
Path: 268. 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: 1306.  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():
1536. eliminates "‘..’" segments from a path, which may change its
meaning if symlinks are involved, *note Path.absolute(): 1a88. 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.12.1.20 対応するツール
........................

下にあるのは、様々な *note os: a5. 関数とそれに相当する *note PurePath:
6cd. あるいは *note Path: 268. の同等のものとの対応表です。

*note os: a5. と *note os.path: a6.       ‘pathlib’
                                          
---------------------------------------------------------------------------------------------
                                          
*note os.path.dirname(): 2cc3.            *note PurePath.parent: 1afe.
                                          
                                          
*note os.path.basename(): 2cc4.           *note PurePath.name: 2ca9.
                                          
                                          
*note os.path.splitext(): 19b9.           *note PurePath.stem: 2caa,
                                          *note PurePath.suffix: 19b7.
                                          
                                          
*note os.path.join(): 1a07.               *note PurePath.joinpath(): 2cac.
                                          
                                          
*note os.path.isabs(): 531.               *note PurePath.is_absolute(): 1afd.
                                          
                                          
*note os.path.relpath(): 6d1.             *note PurePath.relative_to(): 2ff. (1)
                                          
                                          
*note os.path.expanduser(): c0d.          *note Path.expanduser(): 1046. (2)
                                          
                                          
*note os.path.realpath(): 264.            *note Path.resolve(): 1ace.
                                          
                                          
*note os.path.abspath(): 1536.            *note Path.absolute(): 1a88. (3)
                                          
                                          
*note os.path.exists(): c07.              *note Path.exists(): c0f.
                                          
                                          
*note os.path.isfile(): c0a.              *note Path.is_file(): 539.
                                          
                                          
*note os.path.isdir(): c09.               *note Path.is_dir(): 53a.
                                          
                                          
*note os.path.islink(): c05.              *note Path.is_symlink(): c11.
                                          
                                          
*note os.path.isjunction(): 6ca.          *note Path.is_junction(): 6d2.
                                          
                                          
*note os.path.ismount(): c0b.             *note Path.is_mount(): c10.
                                          
                                          
*note os.path.samefile(): 1177.           *note Path.samefile(): 1044.
                                          
                                          
*note os.getcwd(): 196a.                  *note Path.cwd(): 1afc.
                                          
                                          
*note os.stat(): 26f.                     *note Path.stat(): a28.
                                          
                                          
*note os.lstat(): 6c8.                    *note Path.lstat(): 2cb4.
                                          
                                          
*note os.listdir(): 1316.                 *note Path.iterdir(): 270.
                                          
                                          
*note os.walk(): 6d0.                     *note Path.walk(): 6cf. (4)
                                          
                                          
*note os.mkdir(): 52b,                    *note Path.mkdir(): 1045.
*note os.makedirs(): 52c.                 

*note os.link(): 130b.                    *note Path.hardlink_to(): a26.
                                          
                                          
*note os.symlink(): 1310.                 *note Path.symlink_to(): a27.
                                          
                                          
*note os.readlink(): b1e.                 *note Path.readlink(): b1d.
                                          
                                          
*note os.rename(): 130d.                  *note Path.rename(): 18f4.
                                          
                                          
*note os.replace(): 130e.                 *note Path.replace(): 2cbc.
                                          
                                          
*note os.remove(): 130c,                  *note Path.unlink(): 1e31.
*note os.unlink(): 1311.                  

*note os.rmdir(): 130f.                   *note Path.rmdir(): 2cb8.
                                          
                                          
*note os.chmod(): 529.                    *note Path.chmod(): a29.
                                          
                                          
*note os.lchmod(): 528.                   *note Path.lchmod(): 2cbe.
                                          

脚注
....

   ---------- Footnotes ----------

   (1) *note os.path.relpath(): 6d1. calls *note abspath(): 1536. to
make paths absolute and remove "‘..’" parts, whereas *note
PurePath.relative_to(): 2ff. is a lexical operation that raises *note
ValueError: 2ee. when its inputs' anchors differ (e.g.  if one path is
absolute and the other relative.)

   (2) *note os.path.expanduser(): c0d. returns the path unchanged if
the home directory can't be resolved, whereas *note Path.expanduser():
1046. raises *note RuntimeError: 246.

   (3) *note os.path.abspath(): 1536. removes "‘..’" components without
resolving symlinks, which may change the meaning of the path, whereas
*note Path.absolute(): 1a88. 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.12.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: 26d.
     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.12.2 ‘os.path’ -- 一般的なパス名操作
--------------------------------------

'ソースコード:' Lib/genericpath.py(1), Lib/posixpath.py(2) (POSIX) 、
Lib/ntpath.py(3) (Windows) 。

__________________________________________________________________

このモジュールはパス名を扱う際に便利な関数を実装しています。ファイルの読
み書きをする際は *note open(): 318. を、ファイルシステムにアクセスするに
は *note os: a5. モジュールをご参照ください。パスの引数は文字列、バイト
列、あるいは *note os.PathLike: e4f. プロトコルを実装するあらゆるオブジ
ェクトとして渡すことができます。

Unix シェルとは異なり、Python はあらゆるパス展開を '自動的には' 行いませ
ん。アプリケーションがシェルのようなパス展開を必要とした場合は、 *note
expanduser(): c0d. や *note expandvars(): 15f7. といった関数を明示的に呼
び出すことで行えます。(*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(): c07.、 *note lexists(): c08.、
*note isdir(): c09.、 *note isfile(): c0a.、 *note islink(): c05.、およ
び *note ismount(): c0b. は、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(): 1a07. and *note os.path.normpath(): 1535.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.basename (path, /)

     パス名 'path' の末尾のファイル名部分を返します。これは関数 *note
     split(): 2ccd. に 'path' を渡した時に返されるペアの 2 番めの要素で
     す。この関数が返すのは Unix の ‘basename’ とは異なります; Unix の
     ‘basename’ は ‘'/foo/bar/'’ に対して ‘'bar'’ を返しますが、関数
     *note basename(): 2cc4. は空文字列 (‘''’) を返します。

     バージョン 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: 2ee. if 'paths' contain both
     absolute and relative pathnames, if 'paths' are on different
     drives, or if 'paths' is empty.  Unlike *note commonprefix(): 1042,
     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(): 1041. 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():
     2ccd. に 'path' を渡した時に返されるペアの 1 番めの要素です。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.exists (path)

     'path' が実在するパスかオープンしているファイル記述子を参照している
     場合 ‘True’ を返します。壊れたシンボリックリンクについては ‘False’
     を返します。一部のプラットフォームでは、たとえ 'path' が物理的に存
     在していたとしても、要求されたファイルに対する *note os.stat():
     26f. の実行権がなければこの関数が ‘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(): c07. 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: 2c2. 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: 2c2.
     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: 2c2. を送出します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.getsize (path, /)

     'path' のサイズをバイト数で返します。ファイルが存在しない、あるいは
     アクセスできなかった場合は *note OSError: 2c2. を送出します。

     バージョン 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(): 1536.

     バージョン 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 存在する: c07. 一般ファイルなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): c05. と *note isfile(): c0a. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isdir (path, /)

     'path' が *note 存在する: c07. ディレクトリなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): c05. と *note isdir(): c09. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isjunction (path)

     Return ‘True’ if 'path' refers to an *note existing: c08. 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 存在する: c07. ディレクトリを指すシンボリックリンク
     なら ‘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: 2199.: 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(): 2cd2. を使用し
     てください。

          注釈: 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: 2c2.  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:
     266. is raised if 'path' does not exist, or another *note OSError:
     2c2. if it is otherwise inaccessible.

     If 'strict' is *note os.path.ALLOW_MISSING: 265, errors other than
     *note FileNotFoundError: 266. 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: 265. value for the
     'strict' parameter was added.

 -- データ: os.path.ALLOW_MISSING

     Special value used for the 'strict' argument in *note realpath():
     264.

     Added in version 3.14.

 -- の関数: os.path.relpath (path, start=os.curdir)

     カレントディレクトリあるいはオプションの 'start' ディレクトリからの
     'path' への相対パスを返します。これはパス計算で行っており、ファイル
     システムにアクセスして 'path' や 'start' の存在や性質を確認すること
     はありません。Windowsでは、 'path' と 'start' が異なるドライブの場
     合、 *note ValueError: 2ee. を送出します。

     'start' defaults to *note os.curdir: 2cd3.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.samefile (path1, path2, /)

     引数の両パス名が同じファイルまたはディレクトリを参照している場合、
     ‘True’ を返します。これは、デバイス番号と i-node 番号で決定されます
     。どちらかのパス名への *note os.stat(): 26f. 呼び出しが失敗した場合
     、例外が送出されます。

     バージョン 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(): f90. 、 *note
     os.lstat(): 6c8. あるいは *note os.stat(): 26f. の返り値で構いませ
     ん。この関数は *note samefile(): 1177. と *note sameopenfile():
     2cd4. を使用した比較に基いて実装しています。

     バージョン 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():
     1a07, *note dirname(): 2cc3. and *note basename(): 2cc4.

     バージョン 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.12.3 ‘stat’ -- ‘stat()’ の結果を解釈する
------------------------------------------

'ソースコード:' Lib/stat.py(1)

__________________________________________________________________

The ‘stat’ module defines constants and functions for interpreting the
results of *note os.stat(): 26f, *note os.fstat(): f90. 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: 11c1. 、 *note
     S_IFPORT: 11c2. 、 *note S_IFWHT: 11c3. をサポートしています。

以下の全ての変数は、 *note os.stat(): 26f. 、 *note os.fstat(): f90. 、
または *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(): 26f. 、 *note os.fstat(): f90. 、あるいは *note os.lstat():
6c8. を呼び出した時点で読み出し待ちであったデータのバイト数になります; こ
の値は時に有用で、特に上記の特殊なファイルを非ブロックモードで開いた後に
ポーリングを行いたいといった場合に便利です。他のキャラクタ型およびブロッ
ク型デバイスにおけるサイズフィールドの意味はさらに異なっていて、背後のシ
ステムコールの実装によります。

以下の変数は、 *note ST_MODE: 11c0. フィールドで使用されるフラグを定義し
ています。

最初に挙げる、以下のフラグを使うよりは、上記の関数を使うほうがポータブル
です:

 -- データ: 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: 11c1. 、 *note S_IFPORT: 11c2. 、または *note
     S_IFWHT: 11c3. は、プラットフォームがこれらのファイルタイプをサポー
     トしていない場合、0 として定義されます。

以下のフラグは、 *note os.chmod(): 529. の 'mode' 引数に使うこともできま
す:

 -- データ: stat.S_ISUID

     UID ビットを設定する。

 -- データ: stat.S_ISGID

     グループIDビットを設定する。このビットには幾つかの特殊ケースがあり
     ます。ディレクトリに対して設定されていた場合、 BSD のセマンティクス
     が利用される事を示しています。すなわち、そこに作成されるファイルは
     、作成したプロセスの有効グループID (effective group ID) ではなくそ
     のディレクトリのグループIDを継承し、そこに作成されるディレクトリに
     も *note S_ISGID: 2cf2. ビットが設定されます。グループ実行ビット
     (*note S_IXGRP: 2cf3.) が設定されていないファイルに対してこのビット
     が設定されていた場合、強制ファイル/レコードロックを意味します
     (*note S_ENFMT: 2cf4. も参照してください)。

 -- データ: 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: 2cf2. と共
     有されています。グループ実行ビット (*note S_IXGRP: 2cf3.) が設定さ
     れていないファイルでは、ファイル/レコードのロックが強制されます。

 -- データ: stat.S_IREAD

     *note S_IRUSR: 2cf7. の、 Unix V7 のシノニム。

 -- データ: stat.S_IWRITE

     *note S_IWUSR: 2cf8. の、 Unix V7 のシノニム。

 -- データ: stat.S_IEXEC

     *note S_IXUSR: 2cf9. の、 Unix V7 のシノニム。

以下のフラグを *note os.chflags(): 1309. の '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: 2199.: macOS

     Added in version 3.13.

 -- データ: stat.SF_SYNTHETIC

     All super-user read-only synthetic flags

     *note Availability: 2199.: 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(): 26f. が返す ‘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.12.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(): 26f. 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(): 26f. 情報が変更された場合、キャッシュの項目は無効
     化されます。*note clear_cache(): 1144. を使用して全キャッシュを削除
     することが出来ます。

 -- の関数: filecmp.cmpfiles (dir1, dir2, common, shallow=True)

     'dir1' と 'dir2' ディレクトリの中の、'common' で指定されたファイル
     を比較します。

     ファイル名からなる3つのリスト: 'match', 'mismatch', 'errors' を返し
     ます。'match' には双方のディレクトリで一致したファイルのリストが含
     まれ、'mismatch' にはそうでないファイル名のリストが入ります。そして
     'errors' は比較されなかったファイルが列挙されます。'errors' になる
     のは、片方あるいは両方のディレクトリに存在しなかった、ユーザーにそ
     のファイルを読む権限がなかった、その他何らかの理由で比較を完了する
     ことができなかった場合です。

     引数 'shallow' はその意味も標準の設定も *note filecmp.cmp(): 1a3c.
     と同じです。

     例えば、‘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.12.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: 1145.  'hide' is a
     list of names to hide, and defaults to ‘[os.curdir, os.pardir]’.

     The ‘dircmp’ class compares files by doing 'shallow' comparisons as
     described for *note filecmp.cmp(): 1a3c. by default using the
     'shallow' parameter.

     バージョン 3.13 で変更: Added the 'shallow' parameter.

     *note dircmp: 1146. クラスは以下のメソッドを提供しています:

      -- メソッド: report ()

          'a' と 'b' の比較を (*note sys.stdout: cd1. に) 表示します。

      -- メソッド: report_partial_closure ()

          'a' および 'b' およびそれらの直下にある共通のサブディレクトリ
          間での比較結果を出力します。

      -- メソッド: report_full_closure ()

          'a' および 'b' およびそれらの共通のサブディレクトリ間での比較
          結果を (再帰的に比較して) 出力します。

     *note dircmp: 1146. クラスは、比較されているディレクトリ階層に関す
     る様々な情報のビットを得るために使用することのできる、興味深い属性
     を数多く提供しています。

     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(): 26f. がエラーを報告するような名前です。

      -- の属性: same_files

          クラスのファイル比較オペレータを用いて 'a' と 'b' の両方におい
          て同一のファイルです。

      -- の属性: diff_files

          'a' と 'b' の両方に存在し、クラスのファイル比較オペレータに基
          づいて内容が異なるファイルです。

      -- の属性: funny_files

          'a' および 'b' 両方にあるが、比較されなかったファイルです。

      -- の属性: subdirs

          A dictionary mapping names in *note common_dirs: 2d3c. to
          ‘dircmp’ instances (or MyDirCmp instances if this instance is
          of type MyDirCmp, a subclass of ‘dircmp’).

          バージョン 3.10 で変更: Previously entries were always
          ‘dircmp’ instances.  Now entries are the same type as 'self',
          if 'self' is a subclass of ‘dircmp’.

 -- データ: filecmp.DEFAULT_IGNORES

     Added in version 3.4.

     デフォルトで *note dircmp: 1146. に無視されるディレクトリのリストで
     す。

これは ‘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.12.5 ‘tempfile’ -- 一時ファイルやディレクトリの作成
-----------------------------------------------------

'ソースコード:' Lib/tempfile.py(1)

__________________________________________________________________

このモジュールは一時ファイルやディレクトリを作成します。 サポートされて
いる全てのプラットフォームで動作します。 *note TemporaryFile: 2d45.、
*note NamedTemporaryFile: 6ed.、*note TemporaryDirectory: 1450.、 *note
SpooledTemporaryFile: 8a3. は自動的に後始末をし、*note context managers
コンテキストマネージャ: 1e3. として使うことの出来る高水準のインターフェ
イスです。 *note mkstemp(): 2d46. と *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:
     181a. を返します。 ファイルは *note mkstemp(): 2d46. と同じルールに
     より安全に作成されます。 オブジェクトは閉じられる (オブジェクトのガ
     ベージコレクションによる暗黙的なものも含みます) とすぐに破壊されま
     す。 Unix では、そのファイルのディレクトリエントリは全く作成されな
     いか、ファイル作成後すぐに削除されます。 これは他のプラットフォーム
     ではサポートされません。 よって、この関数で作成された一時ファイルが
     ファイルシステムで可視な名前を持つかどうかをコードで当てにすべきで
     はありません。

     返されたオブジェクトを :term:コンテキストマネージャ <context
     manager>'として使うことができます （*note 使用例: 2d47. を参照して
     ください）。 コンテキストの完了やファイルオブジェクトの破壊で、一時
     ファイルはファイルシステムから削除されます。

     作成されたファイルを閉じることなく読み書きできるように、 'mode' 引
     数のデフォルトは ‘'w+b'’ です。 保存されるデータに関わらず全てのプ
     ラットフォーム上で一貫して動作するようにバイナリモードが使用されま
     す。 'buffering'、'encoding'、'errors'、'newline' は、 *note
     open(): 318. に対する引数として解釈されます。

     'dir'、'prefix'、'suffix' 引数の意味とデフォルトは *note mkstemp():
     2d46. のものと同じです。

     返されたオブジェクトは、POSIXプラットフォームでは本物のファイルオブ
     ジェクトです。 それ以外のプラットフォームでは、‘file’ 属性が下層の
     本物のファイルであるファイル様オブジェクトです。

     *note os.O_TMPFILE: 1179. フラグは、利用可能で動作する場合に用いら
     れます (Linux 固有で、Linux kernel 3.11 以降)。

     プラットフォームが Posix でも Cygwin でもない場合は、TemporaryFile
     は NamedTemporaryFile の別名です。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1ccb.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.5 で変更: 利用可能であれば *note os.O_TMPFILE: 1179. フ
     ラグが使用されます。

     バージョン 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(): 2d45.
     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(): 2d45. 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: 181a. whose
     ‘file’ attribute is the underlying true file object.  This
     file-like object can be used in a *note with: 187. 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(): 2d45, 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: 181a. is finalized.  Deletion is not always
     guaranteed in this case (see *note object.__del__(): 1203.).  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: 187. 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(): f96. 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():
               318.) must be closed before exiting the context manager,
               else the *note os.unlink(): 1311. call on context manager
               exit will fail with a *note PermissionError: f42.

     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(): 1311. call on exit of the context manager will
     fail with a *note PermissionError: f42.  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 監査イベント: 1ccb.
     ‘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(): 181b. メソッドが呼ばれるまで、データがメモリにスプールさ
     れる点以外は *note TemporaryFile(): 2d45. と正確に同じことを行いま
     す。 上記条件を満たすと内容はディスクに書き込まれ、操作は
     ‘TemporaryFile()’ と同様に進みます。

      -- メソッド: rollover ()

          この関数が返すファイルは、追加で1つのメソッド ‘rollover()’ を
          持っています。このメソッドが呼ばれると、(サイズに関係なく)メモ
          リからディスクへのロールオーバーが実行されます。

     返されたオブジェクトはファイル様オブジェクトで、その ‘_file’ 属性は
     (バイナリかテキスト 'mode' が指定されたかどうかに依存して) *note
     io.BytesIO: 10a8. か *note io.TextIOWrapper: 9c2. オブジェクト、あ
     るいは *note rollover(): 2d48. が呼ばれたかどうかに依存して本物のフ
     ァイルオブジェクトになります。 このファイル様オブジェクトは、通常の
     ファイルオブジェクトと同じように *note with: 187. 文中で使用するこ
     とが出来ます。

     バージョン 3.3 で変更: truncate メソッドが 'size' 引数を受け取るよ
     うになりました。

     バージョン 3.8 で変更: 'errors' 引数が追加されました。

     バージョン 3.11 で変更: Fully implements the *note
     io.BufferedIOBase: 8a4. and *note io.TextIOBase: 8a5. 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
     コンテキストマネージャ: 1e3. として使用することができます (*note
     使用例: 2d47. を参照)。コンテキストの完了や一時ディレクトリオブジェ
     クトを破壊すると、新規作成された一時ディレクトリとその中身はファイ
     ルシステムから削除されます。

      -- の属性: name

          ディレクトリ名は返されたオブジェクトの ‘name’ 属性から取得でき
          ます。返されたオブジェクトが *note コンテキストマネージャ:
          1e3. として使用された場合、 ‘name’ は *note with: 187. 文内の
          ‘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: f42. 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 監査イベント: 1ccb.
     ‘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(): f96. の *note os.O_EXCL: 2d4b. フラグを正しく
     実装している限り、ファイルの作成で競合が起こることはありません。 作
     成したユーザのユーザ ID からのみファイルを読み書き出来ます。 プラッ
     トフォームがファイルが実行可能かどうかを示す許可ビットを使用してい
     る場合、ファイルは誰からも実行不可です。

     このファイル記述子は *note 子プロセスに継承されません: 1100.。

     *note TemporaryFile(): 2d45. と違って、 *note mkstemp(): 2d46. のユ
     ーザは用済みになった時に一時ファイルを削除しなければなりません。

     'suffix' が ‘None’ でない場合、ファイル名はその接尾辞で終わります。
     そうでない場合、接尾辞はありません。 *note mkstemp(): 2d46. はファ
     イル名と接尾辞の間にドットを追加しません。 必要であれば 'suffix' の
     先頭につけてください。

     'prefix' が ‘None’ でない場合、ファイル名はその接頭辞で始まります。
     そうでない場合、デフォルトの接頭辞が使われます。 必要に応じ、デフォ
     ルトは *note gettempprefix(): 2d4c. または *note gettempprefixb():
     2d4d. の返り値です。

     'dir' が ‘None’ でない場合、ファイルはそのディレクトリ下に作成され
     ます。 ‘None’ の場合、デフォルトのディレクトリが使われます。デフォ
     ルトのディレクトリはプラットフォームに依存するリストから選ばれます
     が、アプリケーションのユーザは 'TMPDIR'、'TEMP'、または 'TMP' 環境
     変数を設定することでディレクトリの場所を管理することができます。そ
     のため、生成されるファイル名が、‘os.popen()’ で外部コマンドにクォー
     ティング無しで渡すことができるなどといった、扱いやすい性質を持つ保
     証はありません。

     'suffix'、'prefix'、'dir' のいずれかが ‘None’ でない場合、それらは
     同じ型でなければなりません。 bytes の場合、返された名前は str でな
     はく bytes です。 他の挙動はデフォルトで返り値を bytes に強制的にし
     たい場合は ‘suffix=b''’ を渡してください。

     'text' に真を指定した場合は、ファイルはテキストモードで開かれます。
     そうでない場合(デフォルト)は、ファイルはバイナリモードで開かれます
     。

     *note mkstemp(): 2d46. は開かれたファイルを扱うための OS レベルのハ
     ンドル (*note os.open(): f96. が返すものと同じ) とファイルの絶対パ
     ス名が順番に並んだタプルを返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1ccb.
     ‘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(): 2d46. 関数のもの
     と同じです。

     *note mkdtemp(): 52d. は新たに生成されたディレクトリの絶対パス名を
     返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1ccb.
     ‘tempfile.mkdtemp’ を送出します。

     バージョン 3.5 で変更: 'suffix'、'prefix'、'dir' は bytes の返り値
     を得るために bytes で渡すことが出来ます。 それ以前は str のみ許され
     ていました。 適切なデフォルト値を使用するよう、'suffix' と 'prefix'
     は ‘None’ を受け入れ、デフォルトにするようになりました。

     バージョン 3.6 で変更: 'dir' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: ‘mkdtemp()’ 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: 1ced. の
     記述を参照してください。

     バージョン 3.10 で変更: Always returns a str.  Previously it would
     return any *note tempdir: 1ced. value regardless of type so long as
     it was not ‘None’.

 -- の関数: tempfile.gettempdirb ()

     *note gettempdir(): 1cee. と同じですが返り値は bytesです。

     Added in version 3.5.

 -- の関数: tempfile.gettempprefix ()

     一時ファイルを生成する際に使われるファイル名の接頭辞を返します。 こ
     れにはディレクトリ部は含まれません。

 -- の関数: tempfile.gettempprefixb ()

     *note gettempprefix(): 2d4c. と同じですが返り値は 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(): 1cee.  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():
     2d4c. を除く上記のいずれかの関数を呼び出す際は常に *note
     gettempdir(): 1cee. で述べられているアルゴリズムによって初期化され
     ます。

          注釈: Beware that if you set ‘tempdir’ to a bytes value, there
          is a nasty side effect: The global default return type of
          *note mkstemp(): 2d46. 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.12.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.12.5.2 非推奨の関数と変数
...........................

一時ファイルを作成する歴史的な手法は、まず *note mktemp(): 1c8d. 関数で
ファイル名を作り、その名前を使ってファイルを作成するというものでした。 残
念ながらこの方法は安全ではありません。 なぜなら、‘mktemp()’ の呼び出しと
最初のプロセスが続いてファイル作成を試みる間に、異なるプロセスがその名前
でファイルを同時に作成するかもしれないからです。 解決策は二つのステップ
を同時に行い、ファイルをすぐに作成するというものです。 この方法は *note
mkstemp(): 2d46. や上述している他の関数で使用されています。

 -- の関数: tempfile.mktemp (suffix='', prefix='tmp', dir=None)

     バージョン 2.3 で非推奨: 代わりに *note mkstemp(): 2d46. を使って下
     さい。

     呼び出し時には存在しなかった、ファイルの絶対パス名を返します。
     'prefix'、'suffix'、'dir' 引数は *note mkstemp(): 2d46. のものと似
     ていますが、bytes のファイル名、‘suffix=None’、そして ‘prefix=None’
     がサポートされていない点で異なります。

          警告: この関数を使うとプログラムのセキュリティホールになる可能
          性があります。この関数がファイル名を返した後、あなたがそのファ
          イル名を使って次に何かをしようとする段階に至る前に、誰か他の人
          間があなたを出し抜くことができてしまいます。 *note mktemp():
          1c8d. の利用は、 *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.12.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(): c58. and *note fnmatch.fnmatch():
1cb1. 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(): 1cb1. or *note
pathlib.Path.glob(): 537.  For tilde and shell variable expansion, use
*note os.path.expanduser(): c0d. and *note os.path.expandvars(): 15f7.

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

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
     ディレクトリ記述子への相対パス: 1306. をサポートしています。

     'recursive' が真の場合、パターン "‘**’" はあらゆるファイルや0個以上
     のディレクトリ、サブディレクトリおよびディレクトリへのシンボリック
     リンクにマッチします。パターンの末尾が *note os.sep: 87b. または
     *note os.altsep: 87c. の場合、ファイルは一致しません。

     'include_hidden' が真の場合、パターン "‘**’" は隠しディレクトリにマ
     ッチします。

     引数 ‘pathname’, ‘recursive’ を指定して *note 監査イベント: 1ccb.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘glob.glob/2’ を送出します。

          注釈: パターン "‘**’" を大きなディレクトリツリーで使用するとと
          てつもなく時間がかかるかもしれません。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

          注釈: Any *note OSError: 2c2. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: f42. when accessing directories without read
          permission.

     バージョン 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 監査イベント: 1ccb.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘glob.glob/2’ を送出します。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

          注釈: Any *note OSError: 2c2. exceptions raised from scanning
          the filesystem are suppressed.  This includes *note
          PermissionError: f42. when accessing directories without read
          permission.

     バージョン 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)

     Convert the given path specification to a regular expression for
     use with *note re.match(): 1449.  The path specification can
     contain shell-style wildcards.

     例えば:

          >>> 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(): 18b4. と違って、この関数ではパスの要素を
     区切るセパレータとセグメントには意味があります。デフォルトでは、ワ
     イルドカードはパスのセパレータにはマッチしません。また ‘*’ パターン
     のセグメントは厳密に単一のパスのセグメントにマッチします。

     'recursive' が真の場合、パターンセグメント "‘**’" は任意の数のパス
     セグメントにマッチします。

     'include_hidden' が真の場合、ワイルドカードはドット (‘.’) で始まる
     パスセグメントにもマッチします。

     パスの要素を区切るセパレータのシーケンスを 'seps' 引数に渡すことが
     できます。渡さない場合は *note os.sep: 87b. と (もしあれば) *note
     altsep: 87c. が使われます。

     参考
     ....

     *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.12.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.12.7 ‘fnmatch’ -- Unix のファイル名パターンマッチ
---------------------------------------------------

'ソースコード:' Lib/fnmatch.py(1)

__________________________________________________________________

このモジュールは Unix のシェル形式のワイルドカードに対応しています。これ
らは、 (*note re: be. モジュールでドキュメント化されている) 正規表現とは
'異なります' 。シェル形式のワイルドカードで使われる特殊文字は、次のとお
りです。

Pattern          意味
                 
----------------------------------------------------------
                 
‘*’              すべてにマッチします
                 
                 
‘?’              任意の一文字にマッチします
                 
                 
‘[seq]’          'seq' にある任意の文字にマッチします
                 
                 
‘[!seq]’         'seq' にない任意の文字にマッチします
                 

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

ファイル名の区切り文字 (Unixでは ‘'/'’) はこのモジュールに固有なものでは
'ない' ことに注意してください。パス名展開については、 *note glob: 68. モ
ジュールを参照してください (‘glob’ はパス名の部分にマッチさせるのに
*note filter(): 1cb3. を使っています)。同様に、ピリオドで始まるファイル
名はこのモジュールに固有ではなくて、 ‘*’ と ‘?’ のパターンでマッチします
。

Unless stated otherwise, "filename string" and "pattern string" either
refer to *note str: 16a. or ‘ISO-8859-1’ encoded *note bytes: 193.
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(): be6. with a 'maxsize' of
32768 is used to cache the (typed) compiled regex patterns in the
following functions: *note fnmatch(): 60, *note fnmatchcase(): 1cb2,
*note filter(): 1cb3, *note filterfalse(): 213.

 -- の関数: fnmatch.fnmatch (name, pat)

     ファイルの文字列 'name' がパターン文字列 'pat' にマッチするかテスト
     して、 ‘True’ または ‘False’ のいずれかを返します。どちらの引数とも
     *note os.path.normcase(): 2cd2. を使って、大文字、小文字が正規化さ
     れます。オペレーティングシステムが標準でどうなっているかに関係なく
     、大文字、小文字を区別して比較する場合には、 *note fnmatchcase():
     1cb2. が使用できます。

     次の例では、カレントディレクトリにある、拡張子が ‘.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(): 2cd2. は適用しません。

 -- の関数: fnmatch.filter (names, pat)

     Construct a list from those elements of the *note iterable: 12f5.
     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: 12f5.
     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(): 1449.  The pattern is
     expected to be a *note str: 16a.

     例:

          >>> 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.12.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: 105. module to retrieve source lines for inclusion in
the formatted traceback.

*note tokenize.open(): 2d5b. 関数は、ファイルを開くために使用されます。
この関数は、 *note tokenize.detect_encoding(): 1825. を使用してファイル
のエンコーディングを取得します。エンコーディングトークンが存在しない場合
、デフォルトの 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(): 242. を使って
     読み込んだファイルの行が必要でなくなったら、この関数を使ってくださ
     い。

 -- の関数: linecache.checkcache (filename=None)

     キャッシュが有効かどうかを確認します。キャッシュしたファイルがディ
     スク上で変更された可能性があり、更新後のバージョンが必要な場合にこ
     の関数を使用します。 'filename' が与えられない場合、全てのキャッシ
     ュエントリを確認します。

 -- の関数: linecache.lazycache (filename, module_globals)

     後々の呼び出しで 'module_globals' が ‘None’ となっていても、ファイ
     ルの形式でないモジュールの行を後から *note getline(): 242. で取得す
     るのに十分な詳細を把握しておきます。この関数により、モジュールの
     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.12.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(): c53, *note
     shutil.copy2(): c54.) でも、ファイルのメタデータの全てをコピーする
     ことはできません。

     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.12.9.1 ディレクトリとファイルの操作
.....................................

 -- の関数: shutil.copyfileobj (fsrc, fdst[, length])

     :term::‘file-like object <file object>’ 'fsrc' の内容を 'fdst' へコ
     ピーします。整数値 'length' は与えられた場合バッファサイズを表しま
     す。特に 'length' が負の場合、チャンク内のソースデータを繰り返し操
     作することなくデータをコピーします。デフォルトでは、制御不能なメモ
     リ消費を避けるためにデータはチャンク内に読み込まれます。 'fsrc' オ
     ブジェクトの現在のファイル位置が0でない場合、現在の位置からファイル
     終端までの内容のみがコピーされることに注意してください。

     ‘copyfileobj()’ 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(): 2d62. 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(): c53. を参照してください。
     'src' と 'dst' が同じファイルだった場合、 *note SameFileError:
     11a4. を送出します。

     'dst' は書き込み可能でなければなりません。そうでない場合、 *note
     OSError: 2c2. 例外を送出します。 'dst' がすでに存在する場合、そのフ
     ァイルは置き換えられます。キャラクタデバイスやブロックデバイスなど
     の特殊なファイルとパイプをこの関数でコピーすることはできません。

     'follow_symlinks' が偽で 'src' がシンボリックリンクの場合、 'src' の
     リンク先をコピーする代わりに新しいシンボリックリンクを作成します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copyfile’ を送出します。

     バージョン 3.3 で変更: 以前は *note OSError: 2c2. の代わりに *note
     IOError: 1262. が送出されていました。 'follow_symlinks' 引数が追加
     されました。 'dst' を返すようになりました。

     バージョン 3.4 で変更: *note Error: 11a3. の代わりに *note
     SameFileError: 11a4. を送出します。後者は前者のサブクラスなのでこの
     変更は後方互換です。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c57. を
     参照してください。

 -- 例外: shutil.SpecialFileError

     This exception is raised when *note copyfile(): c52. or *note
     copytree(): c22. attempt to copy a named pipe.

     Added in version 2.7.

 -- 例外: shutil.SameFileError

     *note copyfile(): c52. のコピー元と先が同じファイルの場合送出されま
     す。

     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(): 1a86. は (リンク先では
     なく) 'dst' 自体のモードを変更します。この機能は全てのプラットフォ
     ームで使えるわけではありません。詳しくは *note copystat(): 134a. を
     参照してください。シンボリックリンクの変更をしようとした時、
     ‘copymode()’ がローカルのプラットフォームでシンボリックリンクを変更
     できない場合は何もしません。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。

 -- の関数: shutil.copystat (src, dst, *, follow_symlinks=True)

     パーミッション、最終アクセス時間、最終変更時間、その他のフラグを
     'src' から 'dst' にコピーします。 Linux では、 *note copystat():
     134a. は可能なら "拡張属性" もコピーします。ファイルの内容、オーナ
     ー、グループには影響しません。 'src' と 'dst' は *note path-like
     object: 5a1. または文字列でファイルのパス名を指定します。

     'follow_symlinks' が偽の場合、 'src' と 'dst' の両方がシンボリック
     リンクであれば、 *note copystat(): 134a. はリンク先ではなくてシンボ
     リックリンク自体を操作します。 'src' からシンボリックリンクの情報を
     読み込み、 'dst' のシンボリックリンクにその情報を書き込みます。

          注釈: すべてのプラットフォームでシンボリックリンクの検査と変更
          ができるわけではありません。 Python はその機能が利用かどうかを
          調べる方法を用意しています。

             * ‘os.chmod in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 134a. はシンボリックリンクのパーミッ
               ションを変更できます。

             * ‘os.utime in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 134a. はシンボリックリンクの最終アク
               セス時間と最終変更時間を変更できます。

             * ‘os.chflags in os.supports_follow_symlinks’ が ‘True’ の
               場合 *note copystat(): 134a. はシンボリックリンクのフラグ
               を変更できます。 (‘os.chflags’ がないプラットフォームもあ
               ります。)

          機能の幾つか、もしくは全てが利用できないプラットフォームでシン
          ボリックリンクを変更しようとした場合、 *note copystat(): 134a.
          は可能な限り全てをコピーします。‘copystat()’ が失敗を返すこと
          はありません。

          より詳しい情報は *note os.supports_follow_symlinks: 1314. を参
          照して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘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(): c53. はファイルのデータとパーミッションをコピーします
     。 (*note os.chmod(): 529. を参照) その他の、ファイルの作成時間や変
     更時間などのメタデータはコピーしません。 コピー元のファイルのメタデ
     ータを保存したい場合は、 ‘copy2()’ を利用してください。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。新し
     く作成されたファイルのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c57. を
     参照してください。

 -- の関数: shutil.copy2 (src, dst, *, follow_symlinks=True)

     *note copy2(): c54. はファイルのメタデータを保持しようとすることを
     除けば *note copy(): c53. と等価です。

     'follow_symlinks' が偽でかつ 'src' がシンボリックリンクの場合、
     *note copy2(): c54. は 'src' シンボリックリンク全てのメタデータを新
     たに作成される 'dst' シンボリックリンクにコピーしようとします。しか
     し、この機能は全てのプラットフォームで利用可能なわけではありません
     。この機能の全部または一部が利用可能でないプラットフォームにおいて
     は、 ‘copy2()’ は可能な限りのメタデータを保存しようとしますが、一方
     で ‘copy2()’　はメタデータを保存できないことを理由とする例外を送出
     しません。

     *note copy2(): c54. はファイルのメタデータをコピーするために *note
     copystat(): 134a. を利用します。シンボリックリンクのメタデータを変
     更するためのプラットフォームサポートについては ‘copystat()’ を参照
     して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.copystat’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。 拡
     張ファイルシステム属性もコピーしようと試みます (現在は Linux のみ
     )。新しく作成されたファイルへのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c57. を
     参照してください。

 -- の関数: shutil.ignore_patterns (*patterns)

     このファクトリ関数は、 *note copytree(): c22. 関数の '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(): 134a. でコピーされます。それぞれのファイルは
     *note copy2(): c54. でコピーされます。

     'symlinks' が真の場合、ソースツリー内のシンボリックリンクは新しいツ
     リーでもシンボリックになり、元のシンボリックリンクのメタデータはプ
     ラットフォームが許す限りコピーされます。偽の場合や省略された場合、
     リンク先のファイルの内容とメタデータが新しいツリーにコピーされます
     。

     'symlinks' が偽の場合、リンク先のファイルが存在しなければ、コピー処
     理終了時に送出される *note Error: 11a3. 例外のエラーリストに例外が
     追加されます。オプションの 'ignore_dangling_symlinks' フラグを真に
     設定してこのエラーを送出させないこともできます。このオプションは
     *note os.symlink(): 1310. をサポートしていないプラットフォーム上で
     は効果がないことに注意してください。

     'ignore' は *note copytree(): c22. が走査しているディレクトリと
     *note os.listdir(): 1316. が返すその内容のリストを引数として受け取
     ることのできる呼び出し可能オブジェクトでなければなりません。
     ‘copytree()’ は再帰的に呼び出されるので、 'ignore' はコピーされる各
     ディレクトリ毎に呼び出されます。 'ignore' の戻り値はカレントディレ
     クトリに相対的なディレクトリ名およびファイル名のシーケンス（すなわ
     ち第二引数の項目のサブセット）でなければなりません。それらの名前は
     コピー中に無視されます。 *note ignore_patterns(): 2d63. を用いて
     glob 形式のパターンによって無視する呼び出し可能オブジェクトを作成す
     ることが出来ます。

     例外が発生した場合、理由のリストとともに *note Error: 11a3. を送出
     します。

     'copy_function' は各ファイルをコピーするために利用される呼び出し可
     能オブジェクトでなければなりません。'copy_function' はコピー元のパ
     スとコピー先のパスを引数に呼び出されます。デフォルトでは *note
     copy2(): c54. が利用されますが、同じ特徴を持つ関数 (*note
     shutil.copy(): c53. など) ならどれでも利用可能です。

     If 'dirs_exist_ok' is false (the default) and 'dst' already exists,
     a *note FileExistsError: 1225. 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 監査イベント: 1ccb.
     ‘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 プラットフォーム依存の効率的なコピー操作: c57. を
     参照してください。

     バージョン 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 ディレクトリ記述子への相対パス: 1306. をサポートし
     ています。

          注釈: 必要な fd ベースの関数をサポートしているプラットフォーム
          では、 シンボリックリンク攻撃に耐性のあるバージョンの *note
          rmtree(): 354. がデフォルトで利用されます。それ以外のプラット
          フォームでは、 ‘rmtree()’ の実装はシンボリックリンク攻撃の影響
          を受けます。適当なタイミングと環境で攻撃者はファイルシステム上
          のシンボリックリンクを操作して、それ以外の方法ではアクセス不可
          能なファイルを削除することが出来ます。アプリケーションは、どち
          らのバージョンの ‘rmtree()’ が利用されているかを知るために関数
          のデータ属性 *note rmtree.avoids_symlink_attacks: 2d64. を利用
          することができます。

     '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(): 89b.

     参考
     ....

     *note rmtree の例: 2d65. for an example of handling the removal of
     a directory tree that contains read-only files.

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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: 266. exceptions for all but the top-level path.
     Exceptions other than *note OSError: 2c2. and subclasses of
     ‘OSError’ are now always propagated to the caller.

      -- の属性: rmtree.avoids_symlink_attacks

          プラットフォームと実装がシンボリックリンク攻撃に耐性のあるバー
          ジョンの *note rmtree(): 354. を提供しているかどうかを示します
          。現在のところ、この属性は 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(): 130d. semantics.

     *note os.rename(): 130d. is preferably used internally when 'src'
     and the destination are on the same filesystem.  In case
     ‘os.rename()’ fails due to *note OSError: 2c2. (e.g.  the user has
     write permission to the destination file but not to its parent
     directory), this method falls back to using 'copy_function', in
     which case '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 in or 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(): 130d. cannot be
     used.  If the source is a directory, *note copytree(): c22. is
     called, passing it the 'copy_function'.  The default
     'copy_function' is *note copy2(): c54.  Using *note copy(): c53. 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 監査イベント: 1ccb.
     ‘shutil.move’ を送出します。

     バージョン 3.3 で変更: 異なるファイルシステムに対する明示的なシンボ
     リックリンク処理が追加されました。これにより GNU ‘mv’ の振る舞いに
     適応するようになります。 'dst' を返すようになりました。

     バージョン 3.5 で変更: キーワード引数 'copy_function' が追加されま
     した。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c57. を
     参照してください。

     バージョン 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: 2199.: Unix, Windows.

 -- の関数: shutil.chown (path, user=None, group=None, *, dir_fd=None,
          follow_symlinks=True)

     指定された 'path' のオーナー 'user' と/または 'group' を変更します
     。

     'user' はシステムのユーザー名か uid です。 'group' も同じです。少な
     くともどちらかの引数を指定する必要があります。

     内部で利用している *note os.chown(): 130a. も参照してください。

     引数 ‘path’, ‘user’, ‘group’ を指定して *note 監査イベント: 1ccb.
     ‘shutil.chown’ を送出します。

     *note Availability: 2199.: 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(): 1308. に渡すパーミッションマスクで、デ
     フォルトではファイルが存在して実行可能であることを確認します。

     'path' is a "‘PATH’ string" specifying the directories to look in,
     delimited by *note os.pathsep: 218f.  When no 'path' is specified,
     the ‘PATH’ environment variable is read from *note os.environ: 25b,
     falling back to *note os.defpath: 1e40. 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")’, ‘which()’ 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: 193. 型も使用できるようになりま
     した。 'cmd' が ‘bytes’ 型の場合、戻り値も ‘bytes’ 型です。

     バージョン 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

     This exception collects exceptions that are raised during a
     multi-file operation.  For *note copytree(): c22, the exception
     argument is a list of 3-tuples ('srcname', 'dstname', 'exception').

* Menu:

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


File: python.info,  Node: プラットフォーム依存の効率的なコピー操作,  Next: copytree の例,  Up: ディレクトリとファイルの操作

5.12.9.2 プラットフォーム依存の効率的なコピー操作
.................................................

Python 3.8 から、ファイルのコピーを伴う全ての関数 (*note copyfile():
c52, *note copy(): c53, *note copy2(): c54, *note copytree(): c22, およ
び *note move(): c55.) はより効率的なファイルのコピーのためにプラットフ
ォーム特有の "高速なコピー" を行うことがあります (bpo-33671(1) を参照し
てください).  ここで "高速なコピー" とは、 "‘outfd.write(infd.read())’"
のようにPython が管理するユーザー空間のバッファを利用することを避け、コ
ピー操作がカーネル空間内で行われることを意味します。

macOS では fcopyfile(2) がファイルの内容（メタデータを除く）をコピーする
ために利用されます。

Linux では *note os.copy_file_range(): 1916. または *note os.sendfile():
d09. が利用されます。

Solaris では *note os.sendfile(): d09. が利用されます。

On Windows *note shutil.copyfile(): c52. uses a bigger default buffer
size (1 MiB instead of 64 KiB) and a *note memoryview(): 166.-based
variant of *note shutil.copyfileobj(): c56. is used.

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(): c56. function internally.

バージョン 3.8 で変更.

バージョン 3.14 で変更: Solaris now uses *note os.sendfile(): d09.

バージョン 3.14 で変更: Copy-on-write or server-side copy may be used
internally via *note os.copy_file_range(): 1916. 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.12.9.3 copytree の例
......................

*note ignore_patterns(): 2d63. ヘルパ関数を利用する例です:

     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.12.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.12.9.5 アーカイブ化操作
.........................

Added in version 3.2.

バージョン 3.5 で変更: 'xztar' 形式のサポートが追加されました。

圧縮とアーカイブ化されているファイルの読み書きの高水準なユーティリティも
提供されています。これらは *note zipfile: 138. 、 *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:
     13a. module is available), "tar", "gztar" (if the ‘zlib’ 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' is a directory that will be the root directory of the
     archive, all paths in the archive will be relative to it; for
     example, we typically chdir into 'root_dir' before creating the
     archive.

     'base_dir' is the directory where we start archiving from; i.e.
     'base_dir' will be the common prefix of all files and directories
     in the archive.  'base_dir' must be given relative to 'root_dir'.
     See *note base_dir を使ったアーカイブ化の例: 2d6b. for how to use
     'base_dir' and 'root_dir' together.

     'root_dir' と 'base_dir' のどちらも、デフォルトはカレントディレクト
     リです。

     'dry_run' が真の場合、アーカイブは作成されませんが実行される操作は
     'logger' に記録されます。

     'owner' と 'group' は、tar アーカイブを作成するときに使われます。デ
     フォルトでは、カレントのオーナーとグループを使います。

     'logger' は PEP 282(1) に互換なオブジェクトでなければなりません。こ
     れは普通は *note logging.Logger: d4a. のインスタンスです。

     'verbose' 引数は使用されず、非推奨です。

     引数 ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’ を指定して *note
     監査イベント: 1ccb. ‘shutil.make_archive’ を送出します。

          注釈: This function is not thread-safe when custom archivers
          registered with *note register_archive_format(): 2d6c. 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: 13a. モジュールが利用可能な場
          合)。

        - 'tar': 非圧縮の tar ファイル。 POSIX.1-2001 pax 形式が使われま
          す。

        - 'gztar': gzip で圧縮された tar ファイル (*note zlib: 13a. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8e. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_archive_format(): 2d6c. を使って、新しいフォーマット
     を登録したり、既存のフォーマットに独自のアーカイバを提供したりでき
     ます。

 -- の関数: shutil.register_archive_format (name, function[,
          extra_args[, description]])

     アーカイバをフォーマット 'name' に登録します。

     'function' is the callable that will be used to create archives.
     The callable will receive the 'base_name' of the file to create,
     followed by the 'base_dir' (which defaults to *note os.curdir:
     2cd3.) to start archiving from.  Further arguments are passed as
     keyword arguments: 'owner', 'group', 'dry_run' and 'logger' (as
     passed in *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(): 2d6d. で使われます。デフォルトでは空の文字列
     です。

     バージョン 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(): 2d6f. で登録したその他のフォーマットのど
     れかです。 指定されなかった場合、 *note unpack_archive(): 696. はア
     ーカイブファイル名の拡張子に対して登録されたアンパッカーを利用しま
     す。 アンパッカーが見つからなかった場合、 *note ValueError: 2ee. を
     発生させます。

     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
     監査イベント: 1ccb. ‘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,
          for example, members that have absolute filenames or filenames
          with ".."  components.

          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:
          2d70. 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(): 2d71. 関数によって返されます。

 -- の関数: 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: 13a. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8e. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_unpack_format(): 2d6f. を使って新しいフォーマットや
     既存のフォーマットに対する別のアンパッカーを登録することができます
     。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0282/


File: python.info,  Node: アーカイブ化の例,  Next: base_dir を使ったアーカイブ化の例,  Up: アーカイブ化操作

5.12.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.12.9.7 'base_dir' を使ったアーカイブ化の例
............................................

この例では、 *note 上記の例: 2d74. と同じく *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.12.9.8 出力ターミナルのサイズの取得
.....................................

 -- の関数: shutil.get_terminal_size (fallback=(columns, lines))

     ターミナルウィンドウのサイズを取得します。

     幅と高さについて、それぞれ ‘COLUMNS’ と ‘LINES’ という環境変数をチ
     ェックします。その変数が定義されていて値が正の整数であればそれを利
     用します。

     典型的な ‘COLUMNS’ や ‘LINES’ が定義されていない場合には、 *note
     sys.__stdout__: 2d77. に接続されているターミナルに *note
     os.get_terminal_size(): 131e. を呼び出して問い合わせます。

     システムが対応していない場合やターミナルに接続していないなどの理由
     でターミナルサイズの問い合わせに失敗した場合、 ‘fallback’ 引数に与
     えられた値を利用します。 ‘fallback’ のデフォルト値は ‘(80, 24)’ で
     、これは多くのターミナルエミュレーターが利用しているデフォルトサイ
     ズです。

     戻り値は *note os.terminal_size: 2d78. 型の名前付きタプルです。

     参考: 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(): 131e. returns zeroes.

参考
....

*note os: a5. モジュール

     オペレーティングシステムのインターフェース、Python の *note
     ファイルオブジェクト: 13df. より低レベルでのファイル操作を含みます
     。

*note io: 83. モジュール

     Python 組み込みの I/O ライブラリで、抽象クラスとファイル I/O のよう
     ないくつかの具象クラスを含みます。

*note open(): 318. 組み込み関数

     Python で読み書きのためにファイルを開く標準的な方法です。

   ---------- Footnotes ----------

   (1) 
https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003


File: python.info,  Node: データの永続化,  Next: データ圧縮とアーカイブ,  Prev: ファイルとディレクトリへのアクセス,  Up: Python 標準ライブラリ

5.13 データの永続化
===================

この章で解説されるモジュール群は 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.13.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: 20ca. or *note bytes-like object: 194.) 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 との比較: 2d7f. を参照し
     てください。

* 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.13.1.1 他の Python モジュールとの関係
.......................................

* Menu:

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


File: python.info,  Node: marshal との比較,  Next: json との比較,  Up: 他の Python モジュールとの関係

5.13.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.  ‘marshal’ 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 pickled.

   * 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.13.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: 2d83. によって対応できます)。

   * pickleとは異なり、信頼できないJSONを復元するだけでは、任意のコード
     を実行できる脆弱性は発生しません。

参考
....

*note json: 86. モジュール: JSON への直列化および復元を行うための標準ラ
イブラリモジュール。

   ---------- Footnotes ----------

   (1) https://json.org


File: python.info,  Node: データストリームの形式,  Next: モジュールインターフェース,  Prev: 他の Python モジュールとの関係,  Up: pickle --- Python オブジェクトの直列化

5.13.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: 2d85. pickled data.

The module *note pickletools: ac. contains tools for analyzing data
streams generated by ‘pickle’.  ‘pickletools’ source code has extensive
comments about opcodes used by pickle protocols.

現在 pickle 化には 6 種類のプロトコルを使用できます。より高いプロトコル
を使用するほど、作成された pickle を読み込むためにより高い Python のバー
ジョンが必要になります。

   * プロトコルバージョン 0 はオリジナルの「人間に判読可能な」プロトコル
     で、Python の初期のバージョンとの後方互換性を持ちます。

   * プロトコルバージョン 1 は旧形式のバイナリフォーマットで、これも
     Python の初期バージョンと互換性があります。

   * プロトコルバージョン 2 は Python 2.3 で導入されました。このバージョ
     ンでは *note 新方式のクラス: 2d86. のより効率的な pickle 化を提供し
     ました。プロトコル 2 による改良に関する情報は PEP 307(1) を参照して
     ください。

   * プロトコルバージョン 3 は Python 3 で追加されました。 *note bytes:
     193. オブジェクトを明示的にサポートしており、 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.13.1.5 モジュールインターフェース
...................................

オブジェクト階層を直列化するには、*note dumps(): 16c2. 関数を呼ぶだけで
す。同様に、データストリームを復元するには、*note loads(): f11. 関数を呼
びます。しかし、直列化および復元に対してより多くのコントロールを行いたい
場合、それぞれ *note Pickler: c17. または *note Unpickler: 17e9. オブジ
ェクトを作成することができます。

The ‘pickle’ module provides the following constants:

 -- データ: pickle.HIGHEST_PROTOCOL

     利用可能なうち最も高い *note プロトコルバージョン: 27d. (整数)。こ
     の値は 'protocol' 値として関数 *note dump(): 2d88. および *note
     dumps(): 16c2. と、*note Pickler: c17. コンストラクターに渡すことが
     できます。

 -- データ: pickle.DEFAULT_PROTOCOL

     An integer, the default *note protocol version: 27d. used for
     pickling.  May be less than *note HIGHEST_PROTOCOL: 16c3.
     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
     ファイルオブジェクト: 13df. 'file' に書き込みます。‘Pickler(file,
     protocol).dump(obj)’ と等価です。

     引数 'file', 'protocol', 'fix_imports' および 'buffer_callback' は
     *note Pickler: c17. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.dumps (obj, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     ファイルに書く代わりに、*note bytes: 193. オブジェクトとしてオブジ
     ェクト 'obj' の pickle 表現を返します。

     引数 'protocol', 'fix_imports' および 'buffer_callback' は *note
     Pickler: c17. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.load (file, *, fix_imports=True, encoding='ASCII',
          errors='strict', buffers=None)

     あるオブジェクトの pickle 化表現を、オープンしている *note
     ファイルオブジェクト: 13df. 'file' から読み込み、その中で指定されて
     いるオブジェクト階層に再構成して返します。これは
     ‘Unpickler(file).load()’ と等価です。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'file', 'fix_imports', 'encoding', 'errors', 'strict' および
     'buffers' は *note Unpickler: 17e9. のコンストラクタと同じ意味にな
     ります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

 -- の関数: pickle.loads (data, /, *, fix_imports=True,
          encoding='ASCII', errors='strict', buffers=None)

     オブジェクトのピックル化表現 'data' から再構成されたオブジェクト階
     層を返します。 'data' は バイトライクオブジェクト (*note bytes-like
     object: 194.) でなければなりません。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'fix_imports', 'encoding', 'errors', 'strict' および 'buffers'
     は *note Unpickler: 17e9. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

The ‘pickle’ module defines three exceptions:

 -- 例外: pickle.PickleError

     他の pickle 化例外の共通基底クラス。*note Exception: bd1. を継承し
     ています。

 -- 例外: pickle.PicklingError

     *note Pickler: c17. が pickle 化不可能なオブジェクトに遭遇したとき
     に送出されるエラー。*note PickleError: 2d89. を継承しています。

     どんな種類のオブジェクトが pickle 化できるのか確認するには *note
     pickle 化、非 pickle 化できるもの: 2d8a. を参照してください。

 -- 例外: pickle.UnpicklingError

     データ破損やセキュリティ違反のような、オブジェクトを非 pickle 化す
     るのに問題がある場合に送出されるエラー。*note PickleError: 2d89. を
     継承します。

     非 picke 化の最中に他の例外が送出されることもあるので注意してくださ
     い。これには AttributeError, EOFError, ImportError, IndexError が含
     まれます (ただし必ずしもこれらに限定されません)。

The ‘pickle’ module exports three classes, *note Pickler: c17, *note
Unpickler: 17e9. and *note PickleBuffer: 17b6.:

 -- クラス: pickle.Pickler (file, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     pickle 化されたオブジェクトのデータストリームを書き込むためのバイナ
     リファイルを引数にとります。

     任意の引数 'protocol' は、整数で、pickle 化で使用するプロトコルを指
     定します; サポートされているプロトコルは 0 から *note
     HIGHEST_PROTOCOL: 16c3. までになります。指定されない場合、*note
     DEFAULT_PROTOCOL: a33. が使用されます。負数が与えられた場合、
     ‘HIGHEST_PROTOCOL’ が使用されます。

     引数 'file' は、1 バイトの引数一つを受け付ける write() メソッドを持
     たなければなりません。すなわち、'file' には、バイナリの書き込み用に
     オープンされたファイルオブジェクト、*note io.BytesIO: 10a8. オブジ
     ェクト、このインターフェースに適合するその他のカスタムオブジェクト
     をとることができます。

     'fix_imports' が真であり、かつ、'protocol' が 3 未満の場合、pickle
     は新しい Python 3 の名前と Python 2 で使用されていた古いモジュール
     名との対応付けを試みるので、pickle データストリームは Python 2 でも
     読み込み可能です。

     'buffer_callback' が ‘None’ (デフォルト) の場合、バッファビューはス
     トリームの一部として*file* 中に直列化されます。

     'buffer_callback' が ‘None’ でない場合、バッファビューを引数として
     何度でも呼び出すことができる関数です。コールバック関数が偽値
     (‘None’ など) を返すと、与えられたバッファは *note
     アウトオブバウンド管理 (out-of-band): 2d8c. となります; そうでない
     場合はインバンドで、すなわち pickle ストリーム内で、直列化されます
     。

     'buffer_callback' が ‘None’ でなく、かつ 'protocol' が ‘None’ また
     は 5 より小さい場合はエラーとなります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

      -- メソッド: dump (obj)

          'obj' の pickle 化表現を、コンストラクターで与えられた、すでに
          オープンしているファイルオブジェクトに書き込みます。

      -- メソッド: persistent_id (obj)

          デフォルトでは何もしません。このメソッドはサブクラスがオーバー
          ライドできるように存在します。

          *note persistent_id(): 196c. が ‘None’ を返す場合、通常通り
          'obj' が pickle 化されます。それ以外の値を返した場合、*note
          Pickler: c17. がその値を 'obj' のために永続的な ID として出力
          するようになります。この永続的な ID の意味は *note
          Unpickler.persistent_load(): 1974. によって定義されています。
          ‘persistent_id()’ によって返された値自身は永続的な ID を持つこ
          とができないことに注意してください。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2d8d. を参照してください。

          バージョン 3.13 で変更: Add the default implementation of this
          method in the C implementation of ‘Pickler’.

      -- の属性: dispatch_table

          pickler オブジェクトのディスパッチテーブルは *note
          copyreg.pickle(): 2d8e. を使用して宣言できる種類の 'reduction
          functions' のレジストリです。これはキーがクラスでその値が減少
          関数のマッピング型オブジェクトです。減少関数は関連するクラスの
          引数を 1 個とり、*note __reduce__(): bca. メソッドと同じインタ
          ーフェースでなければなりません。

          デフォルトでは、pickler オブジェクトは *note dispatch_table:
          133e. 属性を持たず、代わりに *note copyreg: 2a. モジュールによ
          って管理されるグローバルなディスパッチテーブルを使用します。し
          かし、特定の pickler オブジェクトによる pickle 化をカスタマイ
          ズするために ‘dispatch_table’ 属性に dict-like オブジェクトを
          設定することができます。あるいは、*note Pickler: c17. のサブク
          ラスが ‘dispatch_table’ 属性を持てば、そのクラスのインスタンス
          に対するデフォルトのディスパッチテーブルとして使用されます。

          使用例については *note ディスパッチテーブル: 2d8f. を参照して
          ください。

          Added in version 3.3.

      -- メソッド: reducer_override (obj)

          *note Pickler: c17. のサブクラスで定義可能な特殊なリデューサ
          (reducer) です。このメソッドは *note dispatch_table: 133e. 内
          のいかなるリデューサよりも優先されます。このメソッドは *note
          __reduce__(): bca. メソッドのインターフェースと適合していなけ
          ればなりません。また、メソッドが *note NotImplemented: 1a3. を
          返すことにより、 ‘dispatch_table’ に登録されたリデューサにフォ
          ールバックして ‘obj’ を直列化することもできます。

          詳細な例については、 *note
          型、関数、その他のオブジェクトに対するリダクションのカスタマイズ:
          2d90. を参照してください。

          Added in version 3.8.

      -- の属性: fast

          廃止予定です。真値が設定されれば高速モードを有効にします。高速
          モードは、メモの使用を無効にします。それにより余分な PUT 命令
          コードを生成しなくなるので pickle 化処理が高速化します。自己参
          照オブジェクトに対しては使用すべきではありません。さもなければ
          *note Pickler: c17. に無限再帰を起こさせるでしょう。

          よりコンパクトな pickle 化を必要とする場合は、*note
          pickletools.optimize(): 2d92. を使用してください。

      -- メソッド: 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: 8a4. のインターフェースと同
     様に、整数を引数にとる read() 、バッファを引数にとる readinto() 、
     引数を取らない readline() の3つのメソッドを持たなければなりません。
     したがって、 'file' はバイナリ読み込みモードでオープンされたディス
     ク上のファイル、 *note io.BytesIO: 10a8. オブジェクト、または上記イ
     ンターフェース要件を満たす任意のカスタムオブジェクトのいずれかです
     。

     オプション引数 '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: 1fc, *note time: 1fd. の各インスタンスを非 pickle 化す
     るためには ‘encoding='latin1'’ を使う必要があります。

     'buffers' が ‘None’ (デフォルト値) の場合、非直列化に必要な全てのデ
     ータは pickle ストリームに含まれている必要があります。これは *note
     Pickler: c17. がインスタンス化されたとき (または *note dump():
     2d88. や *note dumps(): 16c2. が呼び出されたとき) に
     'buffer_callback' 引数に ‘None’ を指定したことに相当します。

     'buffers' が ‘None’ でない場合、各イテレーションで *note
     アウトオブバウンド (out-of-band): 2d8c. のバッファビューを参照する
     pickle ストリームを消費する、バッファ対応のイテラブルでなければなり
     ません。ここに指定するバッファは Pickler オブジェクトの
     'buffer_callback' に順番に渡されたものです。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

      -- メソッド: load ()

          コンストラクターで与えられたオープンしたファイルオブジェクトか
          らオブジェクトの pickle 化表現を読み込み、その中で指定されたオ
          ブジェクト階層に再構成して返します。オブジェクトの pickle 化表
          現より後のバイト列は無視されます。

      -- メソッド: persistent_load (pid)

          デフォルトで *note UnpicklingError: 2d8b. を送出します。

          もし定義されていれば、*note persistent_load(): 1974. は永続的
          な ID 'pid' によって指定されたオブジェクトを返す必要があります
          。永続的な ID が無効な場合、*note UnpicklingError: 2d8b. を送
          出しなければなりません。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2d8d. を参照してください。

          バージョン 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: 16a. オブジェクトです。その名前が示唆することに反し
          て *note find_class(): 2d95. は関数を探すためにも使われること
          に注意してください。

          サブクラスは、どんな型のオブジェクトを、どのようにロードするか
          (潜在的にはセキュリティリスクの減少) に関する制御を得るために
          これをオーバーライドすることができます。詳細に関しては *note
          グローバル変数を制限する: 2d96. を参照してください。

          引数 ‘modulet’, ‘name’ を指定して *note 監査イベント: 1ccb.
          ‘pickle.find_class’ を送出します。

 -- クラス: pickle.PickleBuffer (buffer)

     pickle 可能なデータをあらわすバッファのラッパーです。 'buffer' はバ
     ッファライクなオブジェクト (*note bytes-like object: 194.) や N 次
     元配列のような *note バッファ機能を提供する: 262. オブジェクトでな
     ければなりません。

     *note PickleBuffer: 17b6. はそれ自身バッファ機能を提供します。した
     がってこのクラスのインスタンスを、バッファ機能を提供するオブジェク
     トを期待する *note memoryview: 166. など他の API に渡すことが可能で
     す。

     *note PickleBuffer: 17b6. オブジェクトはプロトコル 5 以上でのみ直列
     化可能で、 *note アウトオブバウンド (out-of-band) の直列化: 2d8c. に
     対応しています。

     Added in version 3.8.

      -- メソッド: raw ()

          このバッファの背後にあるメモリ領域への *note memoryview: 166.
          を返します。戻り値のオブジェクトはフォーマット ‘B’ (符号なしバ
          イト) の C-連続な1次元のメモリビューです。バッファが C-連続で
          も Fortran-連続でもない場合 *note BufferError: 1806. 例外が送
          出されます。

      -- メソッド: release ()

          PickleBuffer オブジェクトを通じてアクセスされる背後のバッファ
          を解放します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: pickle 化、非 pickle 化できるもの,  Next: クラスインスタンスの pickle 化,  Prev: モジュールインターフェース,  Up: pickle --- Python オブジェクトの直列化

5.13.1.6 pickle 化、非 pickle 化できるもの
..........................................

以下の型は pickle 化できます:

   * 組み込み定数(‘None’, ‘True’, ‘False’, ‘Ellipsis’, と *note
     NotImplemented: 1a3.)

   * 整数、浮動小数点数、複素数

   * 文字列、バイト列、バイト配列

   * pickle 化可能なオブジェクトからなるタプル、リスト、集合および辞書

   * モジュールのトップレベルで定義された関数 (*note def: 1678. で定義さ
     れたもののみで *note lambda: 14b9. で定義されたものは含まない)

   * モジュールのトップレベルで定義されているクラス

   * instances of such classes for which the result of calling *note
     __getstate__(): 7f1. is picklable (see section *note
     クラスインスタンスの pickle 化: 2d83. for details).

pickle 化できないオブジェクトを pickle 化しようとすると、*note
PicklingError: 19a2. 例外が送出されます。この例外が起きたとき、すでに元
のファイルには未知の長さのバイト列が書き込まれている場合があります。極端
に再帰的なデータ構造を pickle 化しようとした場合には再帰の深さ制限を越え
てしまうかもしれず、この場合には *note RecursionError: f6c. が送出されま
す。この制限は、*note sys.setrecursionlimit(): 6ea. で慎重に上げていくこ
とは可能です。

関数 (組込みおよびユーザー定義) は、値ではなく、完全 *note 修飾名: 1d82.
で 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__(): bcb. メソッドによって適切な変換が行われる
ようにオブジェクトのバージョン番号を入れておくとよいかもしれません。

   ---------- Footnotes ----------

   (1) なぜ *note lambda: 14b9. 関数を pickle 化できないかというと、すべ
ての ‘lambda’ 関数は同じ名前: ‘<lambda>’ を共有しているからです。

   (2) 送出される例外は *note ImportError: 65b. や *note AttributeError:
5f0. になるはずですが、他の例外も起こりえます。


File: python.info,  Node: クラスインスタンスの pickle 化,  Next: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ,  Prev: pickle 化、非 pickle 化できるもの,  Up: pickle --- Python オブジェクトの直列化

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

この節では、クラスインスタンスがどのように pickle 化または非 pickle 化さ
れるのかを定義したり、カスタマイズしたり、コントロールしたりするのに利用
可能な一般的機構について説明します。

ほとんどの場合、インスタンスを pickle 化できるようにするために追加のコー
ドは必要ありません。デフォルトで、pickle はインスタンスのクラスと属性を
内省によって検索します。クラスインスタンスが非 pickle 化される場合、通常
その *note __init__(): 8c0. メソッドは実行 'されません' 。デフォルトの振
る舞いは、最初に初期化されていないインスタンスを作成して、次に保存された
属性を復元します。次のコードはこの振る舞いの実装を示しています:

     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__(): 2d9b. 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
     ‘__new__()’ method upon unpickling.

     クラスの *note __new__(): 7a0. メソッドがキーワード専用引数を求める
     場合はこのメソッドを実装すべきです。 そうしない場合、互換性のため
     *note __getnewargs__(): fd8. メソッドの実装を推奨します。

     バージョン 3.6 で変更: *note __getnewargs_ex__(): 2d9b. がプロトコ
     ル 2 と 3 でも使われるようになりました。

 -- メソッド: object.__getnewargs__ ()

     このメソッドは *note __getnewargs_ex__(): 2d9b. と同じような機能を
     提供しますが、位置引数のみをサポートします。このメソッドは引数のタ
     プル ‘args’ を返さなければならず、戻り値は非 pickle 化に際して
     *note __new__(): 7a0. メソッドに渡されます。

     *note __getnewargs_ex__(): 2d9b. が定義されていると *note
     __getnewargs__(): fd8. は呼び出しません。

     バージョン 3.6 で変更: Python 3.6以前のプロトコル 2 と 3 では、
     *note __getnewargs_ex__(): 2d9b. の代わりに *note __getnewargs__():
     fd8. が呼び出されていました。

 -- メソッド: object.__getstate__ ()

     Classes can further influence how their instances are pickled by
     overriding the method ‘__getstate__()’.  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__: 1709, the default state is ‘None’.

        * For a class that has an instance *note __dict__: 77d. and no
          *note __slots__: 1709, the default state is ‘self.__dict__’.

        * For a class that has an instance *note __dict__: 77d. and
          *note __slots__: 1709, 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__: 1709. 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: c82. class.

 -- メソッド: object.__setstate__ (state)

     非 pickle 化に際して、クラスが *note __setstate__(): bcb. を定義し
     ている場合、それは非 pickle 化された状態とともに呼び出されます。そ
     の場合、状態オブジェクトが辞書でなければならないという要求はありま
     せん。そうでなければ、 pickle された状態は辞書で、その要素は新しい
     インスタンスの辞書に割り当てられます。

          注釈: If *note __reduce__(): bca. returns a state with value
          ‘None’ at pickling, the ‘__setstate__()’ method will not be
          called upon unpickling.

*note __getstate__(): 7f1. および *note __setstate__(): bcb. メソッドの
使い方に関する詳細な情報については *note 状態を持つオブジェクトの扱い:
2d9c. 節を参照してください。

     注釈: 非 pickle 化に際しては、 *note __getattr__(): 6fa, *note
     __getattribute__(): dcf, または *note __setattr__(): 23d8. といった
     メソッドがインスタンスに対して呼ばれることがあります。これらのメソ
     ッドが何らかの内部的な不変条件が成り立つことに依存する場合、その型
     は *note __new__(): 7a0. メソッドを実装してそのような不変条件が成り
     立つようにすべきです。なぜならばインスタンスの非 pickle 化において
     は *note __init__(): 8c0. メソッドは呼ばれないからです。

これらから見るように、pickle は上記のメソッドを直接使用しません。実際に
は、これらのメソッドは *note __reduce__(): bca. 特殊メソッドを実装するコ
ピープロトコルの一部です。コピープロトコルは、pickle 化とオブジェクトの
コピーに必要な、データを取得するための統一されたインターフェースを提供し
ます。 (1)

強力ですが、クラスに *note __reduce__(): bca. メソッドを直接実装すること
はエラーを起こしやすくなります。この理由のため、クラスの設計者は可能なか
ぎり高レベルインターフェース (*note __getnewargs_ex__(): 2d9b.、*note
__getstate__(): 7f1. および *note __setstate__(): bcb.) を使用するべきで
す。公開はしているものの、‘__reduce__()’ の使用は、あくまでオプションと
して、より効果的な pickle 化につながる場合、あるいはその両方の場合のみに
してください。

 -- メソッド: object.__reduce__ ()

     このインターフェースは現在、以下のように定義されています。 *note
     __reduce__(): bca. メソッドは引数を取らず、文字列あるいは (こちらの
     方が好まれますが) タプルのいずれかを返すべきです (返されたオブジェ
     クトは、しばしば "reduce value" と呼ばれます)。

     If a string is returned, the string should be interpreted as the
     name of a global variable.  It should be the object's local name
     relative to its module; the pickle module searches the module
     namespace to determine the object's module: for a given ‘obj’ to be
     pickled, the ‘__module__’ attribute is looked up on ‘obj’ directly,
     which falls back to a lookup on the type of ‘obj’ if no
     ‘__module__’ instance attribute is set.  This behaviour is
     typically useful for singletons.

     タプルが返された場合、それは 2〜6 要素長でなければなりません。オプ
     ションのアイテムは省略することができます。あるいはそれらの値として
     ‘None’ を渡すことができます。各要素の意味は順に:

        * オブジェクトの初期バージョンを作成するために呼ばれる呼び出し可
          能オブジェクト。

        * 呼出し可能オブジェクトに対する引数のタプル。呼出し可能オブジェ
          クトが引数を受け取らない場合、空のタプルが与えられなければなり
          ません。

        * 任意で、前述のオブジェクトの *note __setstate__(): bcb. メソッ
          ドに渡されるオブジェクトの状態。オブジェクトがそのようなメソッ
          ドを持たない場合、値は辞書でなければならず、それはオブジェクト
          の *note __dict__: 77d. 属性に追加されます。

        * 任意で、連続した要素を yield する (シーケンスではなく) イテレ
          ーター。これらの要素は ‘obj.append(item)’ を使用して、あるいは
          バッチでは ‘obj.extend(list_of_items)’ を使用して、オブジェク
          トに追加されます。これは主としてリストのサブクラスに対して使用
          されますが、適切なシグネチャを持つ *note append(): 2436. およ
          び *note extend(): 2439. メソッドがあるかぎり、他のクラスで使
          用することもできます。 (‘append()’ または ‘extend()’ のどちら
          が使用されるかは、どの pickle プロトコルバージョンが使われるか
          に加えて追加されるアイテムの数にも依存します。したがって、両方
          をサポートする必要があります)

        * 任意で、連続する key-value ペアを yield する (シーケンスでなく
          ) イテレーター。これらの要素は ‘obj[key] = value’ を使用して、
          オブジェクトに格納されます。これは主として辞書のサブクラスに対
          して使用されますが、*note __setitem__(): 14e7. を実装している
          かぎり他のクラスで使用することもできます。

        * 任意で、シグネチャが ‘(obj, state)’ である呼び出し可能オブジェ
          クト。このオブジェクトは、 ‘obj’ のスタティックな *note
          __setstate__(): bcb. メソッドの代わりに、ユーザーがオブジェク
          トの状態を更新する方法をプログラム的に制御することを許します。
          ‘None’ 以外の場合、この呼び出し可能オブジェクトは ‘obj’ の
          ‘__setstate__()’ メソッドに優先します。

          Added in version 3.8: 任意の6番目のタプル要素 ‘(obj, state)’ が
          追加されました。

 -- メソッド: object.__reduce_ex__ (protocol)

     別の方法として、*note __reduce_ex__(): 19cb. メソッドを定義すること
     もできます。唯一の違いは、このメソッドは単一の整数引数、プロトコル
     バージョンを取る必要があるということです。もし定義された場合、
     pickle は *note __reduce__(): bca. メソッドよりもこのメソッドを優先
     します。さらに、‘__reduce__()’ は自動的に拡張版の同義語になります。
     このメソッドの主な用途は、古い Python リリースに対して後方互換性の
     ある reduce value を提供することです。

* Menu:

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

   ---------- Footnotes ----------

   (1) *note copy: 29. モジュールは、浅いコピーと深いコピーの操作にこの
プロトコルを使用します。


File: python.info,  Node: 外部オブジェクトの永続化,  Next: ディスパッチテーブル,  Up: クラスインスタンスの pickle 化

5.13.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(): 196c. and *note
persistent_load(): 1974. respectively.

外部の永続的 ID を持つ pickle オブジェクトの pickler は、引数にオブジェ
クトを取り、‘None’ かオブジェクトの永続的 ID を返すカスタム *note
persistent_id(): 196c. メソッドを持たなくてはなりません。‘None’ を返す場
合、pickler は通常通りマーカーとともにオブジェクトを pickle 化するため、
unpickler はそれを永続的 ID として認識します。

外部オブジェクトを非 pickle 化するには、unpickler は永続的 ID オブジェク
トを取り被参照オブジェクトを返すカスタム *note persistent_load(): 1974.
メソッドを持たなくてはなりません。

これは、外部のオブジェクトを参照によって 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.13.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: c17. のインスタンスを作成します。あるいは、
次のコード

     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.13.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.13.1.11 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ
..........................................................................

Added in version 3.8.

*note dispatch_table: 133e. は、ときにその柔軟性が十分でないがことありま
す。特に、オブジェクトの型以外の別の条件で pickle 化をカスタマイズしたい
場合や、関数やクラスを使って pickle 化をカスタマイズしたい場合などです。

そのような場合、 *note Pickler: c17. クラスから派生したサブクラスで
*note reducer_override(): c18. メソッドを実装することができます。このメ
ソッドは任意のリダクション用タプルを返すことができます (*note
__reduce__(): bca. を参照してください)。もしくは、従来の振る舞いにフォー
ルバックするために *note NotImplemented: 1a3. を返すこともできます。

*note dispatch_table: 133e. と *note reducer_override(): c18. の両方が定
義されている場合、 ‘reducer_override()’ メソッドが優先されます。

     注釈: パフォーマンス上の理由により、次に挙げるオブジェクトに対して
     は *note reducer_override(): c18. が呼ばれないことがあります:
     ‘None’, ‘True’, ‘False’, および *note int: 19c, *note float: 197,
     *note bytes: 193, *note str: 16a, *note dict: 184, *note set: 185,
     *note frozenset: 7f2, *note list: 24f, *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.13.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.13.1.13 生産者 API
....................

pickle 化される大きなサイズのデータオブジェクトは、プロトコル5以上でサポ
ートされた *note __reduce_ex__(): 19cb. メソッドを実装しなければなりませ
ん。このメソッドは大きなデータに対して (*note bytes: 193. オブジェクトな
どの代わりに) *note PickleBuffer: 17b6. インスタンスを返します。

A *note PickleBuffer: 17b6. 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.13.1.14 消費者 API
....................

通信システムは、オブジェクトグラフを直列化するときに生成された *note
PickleBuffer: 17b6. オブジェクトのカスタマイズされた処理を有効化すること
ができます。

送信側は 'buffer_callback' 引数を *note Pickler: c17. (または *note
dump(): 2d88. や *note dumps(): 16c2. 関数) に渡す必要があります。この関
数はオブジェクトグラフを pickle 化するときに生成されるそれぞれの *note
PickleBuffer: 17b6. を引数として呼ばれます。 'buffer_callback' によって
蓄積されたバッファは、それが保持するデータのコピーを pickle ストリームに
送らず、軽量なマーカーが挿入されるだけです。

受信側は 'buffers' 引数を *note Unpickler: 17e9. (または *note load():
f10. や *note loads(): f11. 関数) に渡す必要があります。これは
'buffer_callback' に渡されたバッファのイテラブルです。このイテラブルは
'buffer_callback' に渡されたのと同じ順番でバッファを返さなければなりませ
ん。これらのバッファは、pickle 化処理によって *note PickleBuffer: 17b6.
オブジェクトを生成したオブジェクトの再構築処理で期待されるデータを提供し
ます。

送信側と受信側の間で、通信システムはアウトオブバウンドバッファの独自の転
送メカニズムを自由に実装することができます。見込みのある最適化としては、
共有メモリの利用や、データタイプ依存のデータ圧縮などが考えられます。


File: python.info,  Node: 使用例<10>,  Prev: 消費者 API,  Up: アウトオブバウンドバッファ

5.13.1.15 使用例
................

以下は、アウトオブバウンドのバッファを使った pickle 処理に関与することが
できるサブクラス *note bytearray: 342. を実装したささいな例です:

     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: 342. がそれ自身メモリを割り当てるという性質
による制限があります: すなわち、他のオブジェクトのメモリを参照する
‘bytearray’ を生成することはできません。しかし、 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.13.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(): 167b. 関数をインポートし
て、次に文字列の引数 "echo hello world" を適用しています。この例は無害で
すが、システムを破壊する例を想像するのは難しくありません。

この理由のため、*note Unpickler.find_class(): 2d95. をカスタマイズするこ
とで非 pickle 化で何を得るかを制御したくなるかもしれません。その名前が示
唆するのと異なり、‘Unpickler.find_class()’ はグローバル (クラスや関数) が
必要とした時にはいつでも呼びだされます。したがって、グローバルを完全に禁
止することも安全なサブセットに制限することも可能です。

これは、一部の安全なクラスについてのみ *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: 135. の
marshal API や、サードパーティのソリューションのような別の選択肢を考慮し
た方がよいでしょう。


File: python.info,  Node: 性能<2>,  Next: 使用例<11>,  Prev: グローバル変数を制限する,  Up: pickle --- Python オブジェクトの直列化

5.13.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.13.1.18 使用例
................

最も単純なコードでは、*note dump(): 2d88. および *note load(): f10. 関数
を使用してください。

     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.13.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: 2dab.

     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.13.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: 199. を発生します。

 -- の関数: copyreg.pickle (type, function, constructor_ob=None)

     'function' が型 'type' のオブジェクトに対する"リダクション"関数とし
     て使われるように宣言します。 'function' は文字列か、2要素から6要素
     を含んだタプルを返さなければなりません。 'function' のインターフェ
     ースについての詳細は *note dispatch_table: 133e. を参照してください
     。

     'constructor_ob' は古い機能で、現在は無視されますが、値を渡す場合は
     呼び出し可能 (callable) でなければなりません。

     pickler オブジェクトまたは *note pickle.Pickler: c17. のサブクラス
     の *note dispatch_table: 133e. 属性を、リダクション関数の宣言のため
     に使うこともできるということは覚えておいてください。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/copyreg.py


File: python.info,  Node: 使用例<12>,  Up: copyreg --- pickle サポート関数を登録する

5.13.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.13.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(): 1131. における 'flag' パラメータと同様に解釈されます。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     a33. are used to serialize values.  The version of the pickle
     protocol can be specified with the 'protocol' parameter.

     Python の意味論により、シェルフには永続的な辞書の可変エントリがいつ
     変更されたかを知る術がありません。 デフォルトでは、変更されたオブジ
     ェクトはシェルフに代入されたとき 'だけ' 書き込まれます (*note
     使用例: 2db5. 参照)。 オプションの 'writeback' パラメータが ‘True’
     に設定されている場合は、アクセスされたすべてのエントリはメモリ上に
     キャッシュされ、 *note sync(): 2db6. および *note close(): 2db7. を
     呼び出した際に書き戻されます; この機能は永続的な辞書上の可変の要素
     に対する変更を容易にしますが、多数のエントリがアクセスされた場合、
     膨大な量のメモリがキャッシュのために消費され、アクセスされた全ての
     エントリを書き戻す (アクセスされたエントリが可変であるか、あるいは
     実際に変更されたかを決定する方法は存在しないのです) ために、ファイ
     ルを閉じる操作が非常に低速になります。

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: a33. is now
     used as the default pickle protocol.

     バージョン 3.11 で変更: Accepts *note path-like object: 5a1. for
     filename.

          注釈: シェルフが自動的に閉じることに依存しないでください; それ
          がもう必要ない場合は常に *note close(): 2db7. を明示的に呼ぶか
          、 *note shelve.open(): 1ad2. をコンテキストマネージャとして使
          用してください:

               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 ()

     Write back all entries in the cache if the shelf was opened with
     'writeback' set to *note True: e0b.  Also empty the cache and
     synchronize the persistent dictionary on disk, if feasible.  This
     is called automatically when the shelf is closed with *note
     close(): 2db7.

 -- メソッド: Shelf.close ()

     永続的な '辞書' オブジェクトを同期して閉じます。既に閉じられている
     シェルフに対して呼び出すと *note ValueError: 2ee. を出し失敗します
     。

参考
....

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.13.3.1 制限事項
.................

   * どのデータベースパッケージが使われるか (例えば *note dbm.ndbm: 38.
     、 *note dbm.gnu: 37.) は、どのインターフェースが利用可能かに依存し
     ます。従って、データベースを *note dbm: 35. を使って直接開く方法は
     安全ではありません。データベースはまた、 ‘dbm’ が使われた場合 (不幸
     なことに) その制約に縛られます -- これはデータベースに記録されたオ
     ブジェクト (の 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: 12c4. のサブクラスで、 'dict'
     オブジェクト内にpickle化された値を保持します。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     a33. 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: 11a1. オブジェクトは、コンテキストマネージャとしても使
     用できます。この場合、 *note with: 187. ブロックが終了する際に、自
     動的に閉じられます。

     バージョン 3.2 で変更: 'keyencoding' パラメータを追加; 以前はキーは
     常に UTF-8 でエンコードされていました。

     バージョン 3.4 で変更: コンテキストマネージャーサポートが追加されま
     した。

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: a33. is now
     used as the default pickle protocol.

 -- クラス: shelve.BsdDbShelf (dict, protocol=None, writeback=False,
          keyencoding='utf-8')

     A subclass of *note Shelf: 11a1. 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
     ‘Shelf’ class.

 -- クラス: shelve.DbfilenameShelf (filename, flag='c', protocol=None,
          writeback=False)

     A subclass of *note Shelf: 11a1. which accepts a 'filename' instead
     of a dict-like object.  The underlying file will be opened using
     *note dbm.open(): 1131.  By default, the file will be created and
     opened for both read and write.  The optional 'flag' parameter has
     the same interpretation as for the *note open(): 1ad2. function.
     The optional 'protocol' and 'writeback' parameters have the same
     interpretation as for the ‘Shelf’ class.

   ---------- Footnotes ----------

   (1) https://www.jcea.es/programacion/pybsddb.htm


File: python.info,  Node: 使用例<13>,  Prev: 制限事項,  Up: shelve --- Python オブジェクトの永続化

5.13.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.13.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 ‘pickle’ 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: 19c, *note bool: 3c1, *note float: 197,
     *note complex: 198.

   * Strings (*note str: 16a.) and *note bytes: 193.  *note Bytes-like
     objects: 194. like *note bytearray: 342. are marshalled as ‘bytes’.

   * Containers: *note tuple: 614, *note list: 24f, *note set: 185,
     *note frozenset: 7f2, and (since *note version: 2dbe. 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 ‘version’ 3.

   * The singletons *note None: 886, *note Ellipsis: 2384. and *note
     StopIteration: df9.

   * *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 バイナリファイル: 20ca.
     である必要があります。

     If the value has (or contains an object that has) an unsupported
     type, a *note ValueError: 2ee. exception is raised -- but garbage
     data will also be written to the file.  The object will not be
     properly read back by *note load(): 1e53.  *note Code objects: 4e6.
     are only supported if 'allow_code' is true.

     'version' 引数は ‘dump’ が使用するデータフォーマットを指定します (下
     記を参照してください)。

     引数 ‘value’, ‘version’ を指定して *note 監査イベント: 1ccb.
     ‘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: 14f5, *note
     ValueError: 2ee. or *note TypeError: 199.  *note Code objects: 4e6.
     are only supported if 'allow_code' is true.  The file must be a
     readable *note binary file: 20ca.

     引数無しで *note 監査イベント: 1ccb. ‘marshal.load’ を送出します。

          注釈: サポートされていない型を含むオブジェクトが *note dump():
          2dbf. で整列化されている場合、 *note load(): 1e53. は整列化不
          能な値を ‘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: 2ee. 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 監査イベント: 1ccb.
     ‘marshal.dumps’ を送出します。

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

 -- の関数: marshal.loads (bytes, /, *, allow_code=True)

     Convert the *note bytes-like object: 194. to a value.  If no valid
     value is found, raise *note EOFError: 14f5, *note ValueError: 2ee.
     or *note TypeError: 199.  *note Code objects: 4e6. are only
     supported if 'allow_code' is true.  Extra bytes in the input are
     ignored.

     引数 ‘bytes’ を指定して *note 監査イベント: 1ccb. ‘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.13.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: 2dc4. という名前の例外が含まれます --
     ‘dbm.error’ が送出される場合、後者(訳注:タプルの ‘dbm.error’ ではな
     く例外 ‘dbm.error’)が使用されます。

 -- の関数: 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():
          2dc5. 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: 16a.) -

             * ‘'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: 19c.) - 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(): 1131. supports the basic
functionality of mutable *note mappings: 13d7.; keys and their
corresponding values can be stored, retrieved, and deleted, and
iteration, the *note in: 349. 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: 193.  This means that
when strings are used they are implicitly converted to the default
encoding before being stored.

これらのオブジェクトは、 *note with: 187. 文での使用にも対応しています。
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(): 1131.

バージョン 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.13.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 ‘sqlite3’, or any other SQLite
browser, including the SQLite CLI.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

 -- の関数: 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: 16a.) -

             * ‘'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: 13d7, 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: 187. 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.13.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: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

*note Availability: 2199.: 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(): 1e7c.
     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: 16a.) -

             * ‘'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: 2dca. member for a list of supported flag
          characters.

        * ‘mode’ (*note int: 19c.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.


     例外: *note error: c95. - 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: 13d7, 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: 187. 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(): 2dcd. 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.13.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: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

*note Availability: 2199.: 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: 16a.) -

             * ‘'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: 19c.) - 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: 13d7, 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: 187. 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.13.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: 184.-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: 16a.) -

             * ‘'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: 19c.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.

          警告: 十分に大きかったり複雑だったりするエントリーのあるデータ
          ベースを読み込んでいるときに、 Python の抽象構文木コンパイラの
          スタックの深さの限界を越えるせいで、 Python インタプリタをクラ
          ッシュさせることができます。

     バージョン 3.5 で変更: ‘open()’ 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: 13d7, 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: 187.
     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(): 2db6. 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.13.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: 21b4.  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
オプションのモジュールの要件: 21b2.

この文書には大きく分けて 4 つの節があります:

   * *note チュートリアル: 2dda. ‘sqlite3’ モジュールの使い方を学びます
     。

   * *note リファレンス: 2ddb. このモジュールが定義するクラスと関数につ
     いて説明します。

   * *note ハウツー・ガイド: 2ddc. 特定のタスクの処理方法について詳しく
     説明します。

   * *note 説明: 2ddd. トランザクション制御の背景をより深く掘り下げて説
     明します。

参考
....

‘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.13.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(): 2ddf. を呼び出して *note
Cursor: 2de0. を作成してください:

     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(): 2de1. を呼び出します:

     >>> 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
トランザクション制御: 2de2. 参照)。 トランザクションをコミットするために
接続オブジェクト(connection object)の *note con.commit(): 2de3. を呼び出
して下さい:

     con.commit()

‘SELECT’ クエリを実行することで、データが正しく挿入されたことを確認でき
ます。 結果のすべての行を返すには、おなじみの *note cur.execute(...):
5b0. を使用して結果を ‘res’ に代入し、 *note res.fetchall(): 2de4. を呼
び出して下さい:

     >>> res = cur.execute("SELECT score FROM movie")
     >>> res.fetchall()
     [(8.2,), (7.5,)]

結果は、2 つの ‘タプル’ の *note リスト: 24f. で、 それぞれのタプルにそ
の行の ‘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 文字列フォーマット: 20b6. の代わりにプレースホルダを使用してくださ
い(詳細は *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 ハウツー・ガイド: 2ddc. も参考にしてください:

        * *note プレースホルダを使用して SQL クエリに値を結び付ける方法:
          5b2.

        * *note カスタム Python 型を SQLite 値に適合させる方法: 2de5.

        * *note SQLite 値をカスタム Python 型に変換する方法: 2de6.

        * *note 接続(connection)コンテキストマネージャの使い方: 1bcb.

        * *note 行工場(row factories)の作成方法と使用方法: 2de7.

   * *note トランザクション制御: 2ddd. トランザクション制御の背景につい
     てより深く掘り下げた説明。

   ---------- 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.13.6.2 リファレンス
.....................

* Menu:

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


File: python.info,  Node: モジュール関数,  Next: モジュール定数,  Up: リファレンス

5.13.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: 197.) - テーブルがロックされている場合
          、 *note OperationalError: 1caf. を送出する前に接続を待機する
          秒数。 別の接続がテーブルを変更するためにトランザクションを開
          くと、そのテーブルはトランザクションがコミットされるまでロック
          されます。 デフォルトは 5 秒です。

        * ‘detect_types’ (*note int: 19c.) - Control whether and how
          data types not *note natively supported by SQLite: 2dec. are
          looked up to be converted to Python types, using the
          converters registered with *note register_converter(): 2ded.
          Set it to any combination (using ‘|’, bitwise or) of *note
          PARSE_DECLTYPES: 2dee. and *note PARSE_COLNAMES: 2def. 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: 16a.‘ | ’‘None’) - Control
          legacy transaction handling behaviour.  See *note
          Connection.isolation_level: 2df0. and *note isolation_level
          属性に依るトランザクション制御: 2df1. 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: 2df2. (the default).

        * ‘check_same_thread’ (*note bool: 3c1.) - ‘True’ (これがデフォ
          ルトです)なら、データベース接続を作成したスレッド以外のスレッ
          ドがデータベース接続を使用すると、 *note ProgrammingError:
          307. が送出されます。 ‘False’ なら、接続は複数のスレッドからア
          クセスできます。ただし、データの破損を避けるために、ユーザーに
          よる書き込み操作の直列化が必要になることがあります。詳細は
          *note threadsafety: 88d. を参照してください。

        * ‘factory’ (*note Connection: 54d.) - デフォルトの *note
          Connection: 54d. クラスでない場合に接続(connection)を作成する
          ‘Connection’ のカスタム・サブクラスです。

        * ‘cached_statements’ (*note int: 19c.) - ‘sqlite3’ がこの接続
          (connection)のために内部的にキャッシュするSQL文(statements)の
          数で、 パース時のオーバーヘッドを回避します。 デフォルトでは、
          128 文(statements)です。

        * ‘uri’ (*note bool: 3c1.) - ‘True’ に設定すると、 'database' は
          、ファイル・パス(path)とオプションのクエリ文字列を含む URI
          (Uniform Resource Identifier) として解釈されます。 スキームの
          部分は ‘"file:"’ でなければならず、パス(path)は相対パスまたは
          絶対パスにすることができます。 クエリ文字列により、 パラメータ
          ーを SQLite に渡すことができ、さまざまな *note SQLite URI
          の操作方法: 2df3. が有効になります。

        * ‘autocommit’ (*note bool: 3c1.) - 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: 2df2.  The default will change to
          ‘False’ in a future Python release.


     戻り値の型: *note Connection: 54d.

     引数 ‘database’ を指定して *note 監査イベント: 1ccb.
     ‘sqlite3.connect’ を送出します。

     引数 ‘connection_handle’ を指定して *note 監査イベント: 1ccb.
     ‘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: b37. のコールバックからトレースバックを取得します。 機
     能を再び無効にするには ‘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 呼び出し可能オブジェクト: 2df7. を登録して、 Python
     型の 'type' を SQLite の型に適合させます。適合関数(adapter)アダプタ
     ーは、 Python 型 'type' の Python オブジェクトを唯一の引数として使
     用して呼び出され、 *note SQLite がネイティブに理解する型: 2dec. の
     値を返す必要があります。

 -- の関数: sqlite3.register_converter (typename, converter, /)

     'converter' *note 呼び出し可能オブジェクト: 2df7. を登録して、
     'typename' 型の SQLite オブジェクトを指定の型の Python オブジェクト
     に変換します。変換関数(converter)、 'typename' 型のすべての SQLite
     値に対して呼び出されます。 変換関数には *note bytes: 193. オブジェ
     クトが渡され、目的の 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.13.6.4 モジュール定数
.......................

 -- データ: sqlite3.LEGACY_TRANSACTION_CONTROL

     古いスタイル (Python 3.12 より前) のトランザクション制御の振る舞い
     を選択するには、 *note autocommit: 6dd. に、この定数を設定します。
     詳細については *note isolation_level
     属性に依るトランザクション制御: 2df1. を参照してください。

 -- データ: 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: 2def. と組み合わせることができます。

          注釈: Generated fields (for example ‘MAX(p)’) are returned as
          *note str: 16a.  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: 2dee. と組み合わせることができます。

 -- データ: sqlite3.SQLITE_OK
 -- データ: sqlite3.SQLITE_DENY
 -- データ: sqlite3.SQLITE_IGNORE

     *note Connection.set_authorizer(): 5a9. に渡す *note
     呼び出し可能オブジェクト: 2df7. が返す必要のあるフラグ。これらは以
     下の意味です:

        * アクセスは許可されました(‘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 文字列: 16a. としての、ランタイム SQLite ライブラリのバージョ
     ン番号。

 -- データ: sqlite3.sqlite_version_info

     *note 整数: 19c. の *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

バージョン 3.12 で非推奨、バージョン 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.13.6.5 Connection オブジェクト
................................

 -- クラス: sqlite3.Connection

     開いた SQLite データベースの各々は、 *note sqlite3.connect(): 5a6.
     を使用して作成される ‘Connection’ オブジェクトによって表されます。
     ‘Connection’ オブジェクトの主な目的は *note Cursor: 2de0. オブジェ
     クトの作成と *note トランザクション制御: 2de2. です。

     参考
     ....

        * *note 接続(connection)ショートカット・メソッドの使い方: 2e12.

        * *note 接続(connection)コンテキストマネージャの使い方: 1bcb.

     バージョン 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: 2de0. オブジェクトを作成して返します。 cursor メ
          ソッドは、単一のオプション・パラメーター 'factory' を受け入れ
          ます。 'factory' を指定する場合、これは ‘Cursor’ またはそのサ
          ブクラスのインスタンスを返す *note 呼び出し可能オブジェクト:
          2df7. である必要があります。

      -- メソッド: blobopen (table, column, rowid, /, *, readonly=False,
               name='main')

          既存の BLOB (Binary Large OBject) への *note Blob: 893. ハンド
          ルを開きます。


          パラメータ:

             * ‘table’ (*note str: 16a.) - 当該 BLOB が配置されているテ
               ーブルの名前。

             * ‘column’ (*note str: 16a.) - 当該 BLOB が配置されている列
               (column)の名前。

             * ‘rowid’ (*note int: 19c.) - The row id where the blob is
               located.

             * ‘readonly’ (*note bool: 3c1.) - 書き込み権限なしで BLOB を
               開く必要がある場合は、 ‘True’ に設定します。 デフォルトは
               ‘False’ です。

             * ‘name’ (*note str: 16a.) - 当該 BLOB が配置されているデー
               タベース名。 デフォルトは ‘"main"’ です。


          例外: *note OperationalError: 1caf. - ‘WITHOUT ROWID’ テーブル
          で BLOB を開こうとしたとき。


          戻り値の型: *note Blob: 893.

               注釈: *note Blob: 893. クラスを使用して 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: 2df2. の場合、暗黙のトランザクショ
          ン制御は実行されませんので、保留中の変更が失われないように、デ
          ータベース接続を閉じる前に必ず *note commit(): 2de3. を行って
          ください。

      -- メソッド: execute (sql, parameters=(), /)

          新しい *note Cursor: 2de0. オブジェクトを作成し、指定の 'sql'
          と 'parameters' で *note execute(): 5b0. を呼び出します。新し
          いカーソル・オブジェクトを返します。

      -- メソッド: executemany (sql, parameters, /)

          新しい *note Cursor: 2de0. オブジェクトを作成し、与えられた
          'sql' と 'parameters' で *note executemany(): 5b1. を呼び出し
          ます。新しいカーソル・オブジェクトを返します。

      -- メソッド: executescript (sql_script, /)

          新しい *note Cursor: 2de0. オブジェクトを作成し、指定された
          'sql_script' で *note executescript(): 2e17. を呼び出します。
          新しいカーソル・オブジェクトを返します。

      -- メソッド: create_function (name, narg, func, *,
               deterministic=False)

          ユーザ定義 SQL 関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 16a.) - SQL 関数の名前。

             * ‘narg’ (*note int: 19c.) - SQL 関数が受け入れることができ
               る引数の数。 ‘-1’ を指定すると、任意の数の引数を取ること
               ができます。

             * ‘func’ (*note callback: 2e18. | None) - この SQL 関数が呼
               び出されたときに起動される *note
               呼び出し可能オブジェクト: 2df7. 。 この呼び出し可能オブジ
               ェクトは、 *note SQLite
               によってネイティブにサポートされる型: 2dec. を返すす必要
               があります。 既存の SQL 関数を削除するには、 ‘None’ に設
               定します。

             * ‘deterministic’ (*note bool: 3c1.) - ‘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: 16a.) - SQL 集計関数の名前。

             * ‘n_arg’ (*note int: 19c.) - SQL 集計関数が受け入れること
               ができる引数の数。 ‘-1’ を指定すると、任意の数の引数を取
               ることができます。

             * ‘aggregate_class’ (*note class: 1d5b. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 集計に行(row)を足し込みます。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2dec. として返し
                    ます。

               ‘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: 16a.) - 作成または削除する SQL 集計ウ
               インドウ関数の名前。

             * ‘num_params’ (*note int: 19c.) - SQL 集計ウィンドウ関数が
               受け入れることができる引数の数。 ‘-1’ を指定した場合、任
               意の数の引数を取ることができます。

             * ‘aggregate_class’ (*note class: 1d5b. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 現在のウィンドウに行を足し込みます。

                  * ‘value()’: 集計の現在の値を返します。

                  * ‘inverse()’: 現在のウインドウから指定の行(row)の分を
                    削除します。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2dec. として返し
                    ます。

               ‘step()’ メソッドと ‘value()’ メソッドが受け入れなければ
               ならない引数の数は 'num_params' によって制御されます。

               ‘None’ に設定すると、既存の SQL 集計ウィンドウ関数が削除
               されます。


          例外: *note NotSupportedError: 2e19. - 集計ウィンドウ関数をサ
          ポートしていない 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 文字列: 16a. 引数が渡され、*note 整数: 19c. を返す必要が
          あります:

             * 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: 1caf. を
          送出します。

      -- メソッド: set_authorizer (authorizer_callback)

          データベース内のテーブルの列(column)にアクセスしようとするたび
          に起動される *note 呼び出し可能オブジェクト: 2df7.
          'authorizer_callback' を登録します。 このコールバックは背後の
          SQLite ライブラリによって列(column)へのアクセスがどのように処
          理されるかを通知するために、 *note SQLITE_OK: 2dfa. または
          *note SQLITE_DENY: 2dfb. または *note SQLITE_IGNORE: 2dfc. の
          いずれかを返さなければなりません。

          コールバックの最初の引数は、承認(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 呼び出し可能オブジェクト: 2df7. 'progress_handler'
          を登録します。これは、 GUI の更新など、長時間実行される操作中
          に SQLite から呼び出されるようにしたい場合に便利です。

          以前にインストールした progress ハンドラーをクリアしたい場合は
          、 'progress_handler' に ‘None’ を指定してメソッドを呼び出しま
          す。

          ハンドラー関数からゼロ以外の値を返すと、現在実行中のクエリを終
          了(terminate)し、 *note DatabaseError: 2e1b. 例外を送出します
          。

          バージョン 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 呼び出し可能オブジェクト: 2df7. 'trace_callback' を
          登録します。

          コールバックに渡される唯一の引数は、(*note str: 16a. として渡
          される)実行中のSQL文です。 コールバックの戻り値は無視されます
          。 バックエンドは、 *note Cursor.execute(): 5b0. メソッドに渡
          されたSQL文を実行するだけではないことに注意してください。
          ‘sqlite3’ モジュールの *note トランザクション管理: 2de2. や、
          現在のデータベース内で定義されたトリガーの実行その他も行います
          。

          'trace_callback' として ‘None’ を渡すと、トレース・コールバッ
          クが無効になります。

               注釈: トレース・コールバックで送出した例外は伝播されませ
               ん。 開発およびデバッグの補助として、 *note
               enable_callback_tracebacks(): 2df5. を使用して、トレース
               ・コールバックで送出した例外からのトレースバックの出力を
               有効にします。

          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: 21bc. オプションを渡
               す必要があります。

          引数 ‘connection’, ‘enabled’ を指定して *note 監査イベント:
          1ccb. ‘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(): a43.
          で拡張機能の読み込みを有効にしてください。


          パラメータ:

             * ‘path’ (*note str: 16a.) - SQLite 拡張機能(extension)への
               パス(path)。

             * ‘entrypoint’ (*note str: 16a.‘ | ’‘None’) - エントリ・ポ
               イント名。 ‘None’ (デフォルト) の場合、 SQLite は自分自身
               でエントリ・ポイント名を推測します。 詳細については、
               SQLite ドキュメント Loading an Extension(2) を参照してく
               ださい。

          引数 ‘connection’, ‘path’ を指定して *note 監査イベント: 1ccb.
          ‘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: 16a.‘ | ’‘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: 2e1c.

          バージョン 3.13 で変更: 'filter' パラメータが追加されました。

      -- メソッド: backup (target, *, pages=-1, progress=None,
               name='main', sleep=0.250)

          SQLite データベースのバックアップを作成します。

          データベースが他のクライアントによってアクセスされている場合、
          または同一の接続によって並行にアクセスされている場合でも機能し
          ます。


          パラメータ:

             * ‘target’ (*note Connection: 54d.) - バックアップ先のデー
               タベース接続(connection)。

             * ‘pages’ (*note int: 19c.) - 一度にコピーするページ数。
               ‘0’ 以下の場合、データベース全体がワンステップでコピーさ
               れます。 デフォルトは ‘-1’ です。

             * ‘progress’ (*note callback: 2e18. | None) - *note
               呼び出し可能オブジェクト: 2df7. を設定すると、バックアッ
               プの指定ページ数単位の反復ごとに 3 つの整数引数で呼び出さ
               れます。 'status' は、最後の反復時のステータスで、
               'remaining' はまだコピーされていない残りのページ数で、
               'total' はコピーされるページの合計です。 デフォルトは
               ‘None’ です。

             * ‘name’ (*note str: 16a.) - バックアップするデータベース名
               。 ‘"main"’ (メイン・データベース。これがデフォルトです
               )、または ‘"temp"’ (一時データベース)、 または ‘ATTACH
               DATABASE’ SQL文を使用して取り付けられたカスタム・データベ
               ース名の、いずれかです。

             * ‘sleep’ (*note float: 197.) - バックアップの指定ページ数
               単位の反復ごとにスリープする秒数。

          例 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: 2e1c.

      -- メソッド: getlimit (category, /)

          接続(connection)の実行時制限を取得します。


          パラメータ: ‘category’ (*note int: 19c.) - 問い合わせを行う実
          行時制限カテゴリー(SQLite limit category(3))。


          戻り値の型: *note int: 19c.


          例外: *note ProgrammingError: 307. - '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: 19c.) - SQLite limit category(4) を
               設定する。

             * ‘limit’ (*note int: 19c.) - 新しい制限の値。 負数の場合、
               現在の制限は変更されません。


          戻り値の型: *note int: 19c.


          例外: *note ProgrammingError: 307. - '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: 19c.) - *note SQLITE_DBCONFIG
          code: 2dff. を指定します。


          戻り値の型: *note bool: 3c1.

          Added in version 3.12.

      -- メソッド: setconfig (op, enable=True, /)

          ブール値の接続構成オプションを設定します。


          パラメータ:

             * ‘op’ (*note int: 19c.) - *note SQLITE_DBCONFIG code:
               2dff. を指定します。

             * ‘enable’ (*note bool: 3c1.) - 設定オプションを有効にする
               必要がある場合は ‘True’ (デフォルト)。 無効にする場合は
               ‘False’ を指定します。

          Added in version 3.12.

      -- メソッド: serialize (*, name='main')

          データベースを *note bytes: 193. オブジェクトに直列化
          (serialize)します。 通常のディスク上のデータベース・ファイルの
          場合、 直列化はディスク・ファイルの単なるコピーです。 インメモ
          リ・データベースまたは "temp" データベースの場合、 直列化は、
          そのデータベースがディスクにバックアップされた場合にディスクに
          書き込まれるバイト・シーケンスと同じです。


          パラメータ: ‘name’ (*note str: 16a.) - 直列化するデータベース
          名。 デフォルトは ‘"main"’ です。


          戻り値の型: *note bytes: 193.

               注釈: このメソッドは、 背後の SQLite ライブラリに直列化
               API がある場合にのみ使用できます。

          Added in version 3.11.

      -- メソッド: deserialize (data, /, *, name='main')

          *note 直列化: 88f. されたデータベースを *note Connection: 54d.
          に、 脱直列化(deserialize)します。 このメソッドにより、 データ
          ベース接続はデータベース 'name' から切断され、そして、 'data'
          に含まれる直列化データに基づいて、 データベース 'name' がイン
          メモリ・データベースとして再度開かれます。


          パラメータ:

             * ‘data’ (*note bytes: 193.) - 直列化されたデータベース。

             * ‘name’ (*note str: 16a.) - 脱直列化(deserialize)したデー
               タを入れるデータベース名。 デフォルトは ‘"main"’ です。


          例外:

             * *note OperationalError: 1caf. - データベース接続が読み取
               りトランザクションやバックアップ操作中の場合。

             * *note DatabaseError: 2e1b. - 'data' に有効な SQLite デー
               タベースが含まれていない場合。

             * *note OverflowError: a85. - *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(): 2de3. や *note rollback():
               2e13. を使用します。

               これが ‘auto​​commit’ の推奨値です。

             * ‘True’: SQLite の autocommit mode(7) を使用します。このモ
               ードでは *note commit(): 2de3. や *note rollback(): 2e13.
               は効果がありません。

             * *note LEGACY_TRANSACTION_CONTROL: 2df2.: Python 3.12 より
               前( PEP 249(8) 非対応)のトランザクション制御。 詳細につい
               ては *note isolation_level: 2df0. を参照してください。

               これが、今のところは、 ‘auto​​commit’ のデフォルト値です。

          ‘auto​​commit’ を ‘False’ に変更すると新しいトランザクションが開
          き、 ‘True’ に変更すると保留中のトランザクションがコミットされ
          ます。

          詳細は *note autocommit 属性に依るトランザクション制御: 6de. を
          参照してください。

               注釈: *note isolation_level: 2df0. 属性は、 *note
               autocommit: 6dd. の値が *note LEGACY_TRANSACTION_CONTROL:
               2df2. でない限り、効果がありません。

          Added in version 3.12.

      -- の属性: in_transaction

          この読み取り専用属性は、低レベルの SQLite autocommit mode(9) に
          対応します。

          トランザクションがアクティブな場合 (コミットされていない変更が
          ある場合) は ‘True’ 、それ以外の場合は ‘False’ です。

          Added in version 3.2.

      -- の属性: isolation_level

          ‘sqlite3’ の *note 旧来のトランザクション処理モード: 2df1. を
          制御します。 ‘None’ に設定すると、トランザクションは暗黙に開か
          れることはありません。背後の SQLite の SQLite transaction
          behaviour(10) に対応する ‘"DEFERRED"’ または ‘"IMMEDIATE"’ ま
          たは ‘"EXCLUSIVE"’ のいずれかに設定すると、 *note
          暗黙のトランザクション管理: 2df1. が実行されます。

          *note connect(): 5a6. の 'isolation_level' パラメーターでオー
          バーライドされない場合、 デフォルトは ‘""’ で、 これは
          ‘"DEFERRED"’ の別名です。

               注釈: トランザクション処理を制御するには、
               ‘isolation_level’ を使用するよりも *note autocommit: 6dd.
               を使用することをお勧めします。 ‘autocommit’ が *note
               LEGACY_TRANSACTION_CONTROL: 2df2. (これがデフォルトです
               )に設定されていない限り、 ‘isolation_level’ は効果があり
               ません。

      -- の属性: row_factory

          この接続から作成された *note Cursor: 2de0. オブジェクトの初期
          *note row_factory: 2e1e. 。この属性に割り当てを行っても、 この
          接続に属する、すでに存在するカーソルの ‘row_factory’ には影響
          せず、 この属性に割り当てを行った後に作成する新しいカーソルの
          みに影響します。 デフォルトでは ‘None’ です。つまり、各行は
          *note タプル: 614. として返されます。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2de7.
          をご覧下さい。

          バージョン 3.14.6 で変更: Deleting the ‘row_factory’ attribute
          is no longer allowed.

      -- の属性: text_factory

          *note bytes: 193. のパラメータを受け取り、そのテキスト表現を返
          す *note 呼び出し可能オブジェクト: 2df7. です。呼び出し可能オ
          ブジェクトは ‘TEXT’ データ型である SQLite 値に対して呼び出され
          ます。 デフォルトでは、 この属性は *note str: 16a. に設定され
          ています。

          See *note How to handle non-UTF-8 text encodings: 2e1c. for
          more details.

          バージョン 3.14.6 で変更: Deleting the ‘text_factory’
          attribute is no longer allowed.

      -- の属性: 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.13.6.6 Cursor オブジェクト
............................

     ‘Cursor’ オブジェクトは、 SQL 文を実行し、 取得操作(fetch
     operation)のコンテキストを管理するために使用されるデータベース・カ
     ーソル(database cursor(1))を表します。カーソルは、 *note
     Connection.cursor(): 2ddf. または *note
     接続(connection)ショートカット・メソッド: 2e12. の、いずれかを使用
     して作成されます。

     カーソル・オブジェクトは *note イテレータ: 4c8. です。つまり、
     ‘SELECT’ クエリに対して *note execute(): 5b0. した場合、結果の行
     (rows)を取得するためには、カーソルを単純に反復(iterate)できます:

          for row in cur.execute("SELECT t FROM data"):
              print(row)

 -- クラス: sqlite3.Cursor

     *note Cursor: 2de0. インスタンスは以下の属性やメソッドを持ちます。

      -- メソッド: execute (sql, parameters=(), /)

          Execute a single SQL statement, optionally binding Python
          values using *note placeholders: 5b2.


          パラメータ:

             * ‘sql’ (*note str: 16a.) - 単一の SQL 文。

             * ‘parameters’ (*note dict: 184. | *note sequence: 716.) -
               'sql' のプレースホルダに結び付け(bind)する Python 値。 名
               前付きプレースホルダが使用されている場合は ‘dict’ です。
               名前のないプレースホルダが使用されている場合は sequence で
               す。 *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 5b2. を参照してください。


          例外: *note ProgrammingError: 307. - 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: 184.

          *note autocommit: 6dd. が *note LEGACY_TRANSACTION_CONTROL:
          2df2. で、かつ、 *note isolation_level: 2df0. が ‘None’ で無く
          、 かつ、 'sql' が ‘INSERT’ または ‘UPDATE’ または ‘DELETE’ ま
          たは ‘REPLACE’ 文で、かつ、開いているトランザクションがない場
          合、 'sql' を実行する前にトランザクションが暗黙に開かれます。

          バージョン 3.14 で変更: *note ProgrammingError: 307. is
          emitted if *note named placeholders: 5b2. are used and
          'parameters' is a sequence instead of a *note dict: 184.

          複数の SQL 文を実行するには *note executescript(): 2e17. を使
          用します。

      -- メソッド: executemany (sql, parameters, /)

          'parameters' のすべての item に対して、 *note パラメーター化:
          5b2. された DML (Data Manipulation Language) SQL 文である
          'sql' を繰り返し実行します。

          *note execute(): 5b0. と同一の暗黙のトランザクション処理を使用
          します。


          パラメータ:

             * ‘sql’ (*note str: 16a.) - 単一の DML 文。

             * ‘parameters’ (*note iterable: 12f5.) - 'sql' のプレースホ
               ルダに結び付け(bind)するためのパラメータの iterable 。
               *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 5b2. 参照。


          例外: *note ProgrammingError: 307. - 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: 184.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: 307. is
          emitted if *note named placeholders: 5b2. are used and the
          items in 'parameters' are sequences instead of *note dict:
          184.s.

      -- メソッド: executescript (sql_script, /)

          'sql_script' 内の複数のSQL文を実行します。 *note autocommit:
          6dd. が *note LEGACY_TRANSACTION_CONTROL: 2df2. で、かつ、保留
          中のトランザクションがある場合、暗黙の ‘COMMIT’ 文が最初に実行
          されます。その他の暗黙のトランザクション制御は実行されませんの
          で、トランザクション制御を 'sql_script' に追加しなければなりま
          せん。

          'sql_script' は *note 文字列: 16a. でなければなりません。

          例:

               # 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: 2e1e. が ‘None’ の場合、 次の行のクエリ結果
          セットを *note タプル: 614. として返します。それ以外の場合は、
          それを行工場(row factory)に渡し、 その結果を返します。 これ以
          上データが無い場合は ‘None’ を返します。

      -- メソッド: fetchmany (size=cursor.arraysize)

          クエリ結果の次の行セットを *note list: 24f. として返します。行
          がそれ以上ない場合は、空のリストを返します。

          呼び出しごとに取得する行数は、'size' パラメーターで指定されま
          す。 'size' が指定されていない場合、 *note arraysize: 1816. が
          取得する行数を決定します。有効な行の数が 'size' 未満の場合は、
          有効な数の行が返されます。

          'size' 引数とパフォーマンスの関係についての注意です。パフォー
          マンスを最適化するためには、大抵、 arraysize 属性を利用するの
          がベストです。 'size' 引数を利用したのであれば、次回の *note
          fetchmany(): 1815. の呼び出しでも 'size' 引数に同一の値を指定
          するのがのがベストです。

          バージョン 3.14.1 で変更: Negative 'size' values are rejected
          by raising *note ValueError: 2ee.

      -- メソッド: fetchall ()

          クエリ結果の(残りの)すべての行を *note list: 24f. として返しま
          す。 有効な行がない場合は、空のリストを返します。 *note
          arraysize: 1816. 属性は、この操作のパフォーマンスに影響を与え
          る可能性があることに注意してください。

      -- メソッド: close ()

          (‘__del__’ が呼び出される時ではなく、) 今すぐカーソルを閉じま
          す。

          この時点から、このカーソルは使用できなくなります。今後、このカ
          ーソルで何らかの操作を試みると、 *note ProgrammingError: 307.
          例外が送出されます。

      -- メソッド: setinputsizes (sizes, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- メソッド: setoutputsize (size, column=None, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- の属性: arraysize

          *note fetchmany(): 1815. によって返される行(row)数を制御する、
          読み取りと書き込みが可能な属性。 デフォルト値は 1 で、これは呼
          び出しごとに 1 行が取得されることを意味します。

          バージョン 3.14.1 で変更: Negative values are rejected by
          raising *note ValueError: 2ee.

      -- の属性: connection

          カーソルが属する SQLite データベース *note Connection: 54d. を
          提供する読み取り専用属性。 *note con.cursor(): 2ddf. と呼び出
          して作成した *note Cursor: 2de0. オブジェクトには、'con' を参
          照する *note connection: 2e26. 属性があります:

               >>> 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(): 2e17. の後や、 挿入が失敗
          した場合、 ‘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: 1075. に設定することもできます。 そしてまた
          、 *note Cursor: 2de0. オブジェクトと、 行の値の ‘タプル’ の、
          2 つの引数を受け取り、 SQLite の行(row)を表すカスタム・オブジ
          ェクトを返す、 *note 呼び出し可能オブジェクト: 2df7. に設定す
          ることもできます。

          ‘カーソル・オブジェクト’ の作成時に *note
          Connection.row_factory: 1a03. の値をこの属性のデフォルト値とし
          て設定します。この属性に割り当てても、親接続(parent
          connection)の ‘Connection.row_factory’ には影響しません。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2de7.
          をご覧下さい。

          バージョン 3.14.6 で変更: Deleting the ‘row_factory’ attribute
          is no longer allowed.

   ---------- 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.13.6.7 Row オブジェクト
.........................

 -- クラス: sqlite3.Row

     ‘Row’ インスタンスは、 *note Connection: 54d. オブジェクトの、高度
     に最適化された *note row_factory: 1a03. の役割をします。 反復
     (iteration)や、等しいかどうかのテスト(equality testing)や、 *note
     len(): 840. 関数や 、 列名(column name)とインデックスによる *note
     マッピング: 13d7. のアクセスを、サポートします。

     列名(column names)と値(values)が全く同一である 2 つの ‘Row’ オブジ
     ェクトを比較すると、等しいと見なされます。

     詳細は *note 行工場(row factories)の作成方法と使用方法: 2de7. をご
     覧下さい。

      -- メソッド: keys ()

          列名(column names)の *note リスト: 24f. を *note 文字列: 16a.
          として返します。 クエリの直後であれば、それは *note
          Cursor.description: 190e. の各タプルの最初のメンバーです。

     バージョン 3.5 で変更: スライスがサポートされました。


File: python.info,  Node: Blob オブジェクト,  Next: PrepareProtocol オブジェクト,  Prev: Row オブジェクト,  Up: リファレンス

5.13.6.8 Blob オブジェクト
..........................

 -- クラス: sqlite3.Blob

     Added in version 3.11.

     *note Blob: 893. インスタンスは、 SQLite の BLOB とデータを読み書き
     できる *note file-like object: 181a. です。 *note len(blob): 840. を
     呼び出して、 Blob のサイズ (バイト数) を取得します。 Blob データに
     直接アクセスするには、インデックスと *note スライス: 250e. を使用し
     ます。

     *note Blob: 893. を *note コンテキストマネージャ: 1e3. として使用し
     て、 使用後に 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: 1c82. (またはそのサブクラスの)
          例外を送出します。

      -- メソッド: read (length=-1, /)

          BLOB の現在のオフセット位置から 'length' バイトのデータを読み
          取り返ます。 BLOB の現在のオフセット位置から末尾までの残りが
          'length' バイトよりも少ない場合、末尾までのデータを読み取りま
          す。 'length' が指定されていない場合、 または負数の場合、
          *note read(): 2e2e. は BLOB の現在のオフセット位置から末尾まで
          のデータを読み取ります。

      -- メソッド: write (data, /)

          BLOB の現在のオフセット位置から 'data' を書き込みます。 この関
          数では BLOB の長さを変更できません。 BLOB の末尾を超えて書き込
          もうとすると *note ValueError: 2ee. を送出します。

      -- メソッド: 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: 14a9.
          (absolute blob positioning).  Other values for 'origin' are
          *note os.SEEK_CUR: 14aa. (seek relative to the current
          position) and *note os.SEEK_END: 14ab. (seek relative to the
          blob’s end).


File: python.info,  Node: PrepareProtocol オブジェクト,  Next: 例外<7>,  Prev: Blob オブジェクト,  Up: リファレンス

5.13.6.9 PrepareProtocol オブジェクト
.....................................

 -- クラス: sqlite3.PrepareProtocol

     PrepareProtocol 型の唯一の目的は、 *note SQLite
     でネイティブにサポートされている型: 2dec. に *note
     オブジェクト自身で適合(adapt): 2e33. できるオブジェクトの PEP
     246(1) スタイルの適合プロトコルとして機能することです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0246/


File: python.info,  Node: 例外<7>,  Next: SQLite と Python の型,  Prev: PrepareProtocol オブジェクト,  Up: リファレンス

5.13.6.10 例外
..............

例外の階層は DB-API 2.0 ( PEP 249(1)) で定義されています。

 -- 例外: sqlite3.Warning

     この例外は、現在 ‘sqlite3’ モジュールでは送出しませんが、ユーザー定
     義関数が挿入処理中にデータを切り捨てる場合など、‘sqlite3’ を使用す
     るアプリケーションによって送出されるる可能性があります。 ‘Warning’
     は *note Exception: bd1. のサブクラスです。

 -- 例外: sqlite3.Error

     このモジュールの他の例外の基底となるクラス。 これを使用すると、1 つ
     の *note except: 1ac. 文ですべてのエラーをキャッチできます。
     ‘Error’ は *note Exception: bd1. のサブクラスです。

     例外が 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: 1c82. のサブクラスです。

 -- 例外: sqlite3.DatabaseError

     データベースに関連するエラーに対して送出される例外。 これは、いくつ
     かの種類のデータベース・エラーの基底の例外として機能します。 これを
     特殊化(specialise)したサブクラスを介して暗黙的にのみ送出されます。
     ‘DatabaseError’ は *note Error: 1c82. のサブクラスです。

 -- 例外: sqlite3.DataError

     範囲外の数値や長すぎる文字列など、処理されたデータの問題によって発
     生したエラーに対して送出される例外。 ‘DataError’ は *note
     DatabaseError: 2e1b. のサブクラスです。

 -- 例外: sqlite3.OperationalError

     データベースの操作に関連し、必ずしもプログラマの制御下にないエラー
     に対して発生する例外。 たとえば、データベース・パスが見つからないと
     か、トランザクションを処理できませんでした等。 ‘OperationalError’ は
     *note DatabaseError: 2e1b. のサブクラスです。

 -- 例外: sqlite3.IntegrityError

     データベースの参照整合性が影響を受ける場合に発生する例外。 たとえば
     外部キーのチェック(foreign key check)が失敗したとき。 *note
     DatabaseError: 2e1b. のサブクラスです。

 -- 例外: sqlite3.InternalError

     SQLite が内部エラーに遭遇したときに発生する例外。 これが送出された
     場合、ランタイム SQLite ライブラリに問題があることを示している可能
     性があります。 ‘InternalError’ は *note DatabaseError: 2e1b. のサブ
     クラスです。

 -- 例外: sqlite3.ProgrammingError

     ‘sqlite3’ API プログラミング・エラーに対して送出される例外。たとえ
     ば、クエリに間違った数のバインディング(結び付け)を指定したり、閉じ
     た後の *note Connection: 54d. を操作しようとしたりしたとき。
     ‘ProgrammingError’ は *note DatabaseError: 2e1b. のサブクラスです。

 -- 例外: sqlite3.NotSupportedError

     メソッドまたはデータベース API が 背後の SQLite ライブラリでサポー
     トしていない場合に送出される例外。たとえば、背後の SQLite ライブラ
     リが決定論的関数(deterministic functions)をサポートしていない場合に
     、*note create_function(): 5a7. で 'deterministic' を ‘True’ に設定
     したとき。 ‘NotSupportedError’ は *note DatabaseError: 2e1b. のサブ
     クラスです。

   ---------- 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.13.6.11 SQLite と Python の型
...............................

SQLite は以下の型をネイティブにサポートします: ‘NULL’, ‘INTEGER’,
‘REAL’, ‘TEXT’, ‘BLOB’。

したがって、次の Python の型は問題なく SQLite に送り込めます:

Python の型                         SQLite の型
                                    
------------------------------------------------------
                                    
‘None’                              ‘NULL’
                                    
                                    
*note int: 19c.                     ‘INTEGER’
                                    
                                    
*note float: 197.                   ‘REAL’
                                    
                                    
*note str: 16a.                     ‘TEXT’
                                    
                                    
*note bytes: 193.                   ‘BLOB’
                                    

SQLite の型から Python の型へのデフォルトでの変換は以下の通りです:

SQLite の型       Python の型
                  
---------------------------------------------------------------------
                  
‘NULL’            ‘None’
                  
                  
‘INTEGER’         *note int: 19c.
                  
                  
‘REAL’            *note float: 197.
                  
                  
‘TEXT’            *note text_factory: 2e1f. に依存する。デフォルト
                  では *note str: 16a. 。
                  
                  
‘BLOB’            *note bytes: 193.
                  

‘sqlite3’ モジュールの型システムは 2 つの方法で拡張可能です。 *note
オブジェクト適合関数(adapter): 2de5. を介して SQLite データベースに追加
の Python 型を格納できます。 または、 *note 変換関数(converter): 2de6. を
介して ‘sqlite3’ モジュールが SQLite 型を Python 型に変換できます。


File: python.info,  Node: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨,  Next: コマンドライン・インターフェース<2>,  Prev: SQLite と Python の型,  Up: リファレンス

5.13.6.12 デフォルトの適合関数(adapters)とデフォルトの変換関数(converters)(非推奨)
..................................................................................

     注釈: デフォルトの適合関数(adapters)とデフォルトの変換関数
     (converters)は、 Python 3.12 以降非推奨になりました。代わりに、
     *note 適合関数と変換関数のレシピ集: 715. を利用して、あなたのニーズ
     に合わせて仕立てて下さい。

非推奨の、デフォルトの適合関数(adapters)とデフォルトの変換関数
(converters)は以下のもので構成されています:

   * *note datetime.date: 1fc. オブジェクトを ISO 8601(1) 形式の *note
     文字列: 16a. にする適合関数(adapter)。

   * *note datetime.datetime: 4e2. オブジェクトを ISO 8601 形式の文字列
     にする適合関数(adapter)。

   * "date" と *note 宣言された: 2de6. 型を *note datetime.date: 1fc. オ
     ブジェクトにする変換関数(converter)。

   * "timestamp" と宣言された型を *note datetime.datetime: 4e2. オブジェ
     クトにする変換関数(converter)。小数部分は 6 桁 (マイクロ秒の精度) に
     切り捨てられます。

     注釈: デフォルトの "timestamp" 変換関数は、データベース内の UTC オ
     フセットを無視し、常に素朴(naive)な *note datetime.datetime: 4e2. オ
     ブジェクトを返します。 timestamp で UTC オフセットを保持するには、
     変換関数を無効のままにするか、あるいは、オフセット対応の変換関数を
     *note register_converter(): 2ded. に登録します。

バージョン 3.12 で非推奨.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/ISO_8601


File: python.info,  Node: コマンドライン・インターフェース<2>,  Prev: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨,  Up: リファレンス

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

‘sqlite3’ モジュールは、単純な SQLite シェルを提供するために、インタプリ
タで *note -m: 23e. スイッチを使用してスクリプトとして呼び出すことができ
ます。引数は以下のとおりです:

     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.13.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.13.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: 307. を送出します。名前付きス
タイルの場合、 'parameters' は *note dict: 184. (またはそのサブクラス) の
インスタンスである必要があり、すべての名前付きパラメーターのキーが含まれ
ている必要があります。余分な項目は無視されます。両方のスタイルの例を以下
に示します。

     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.13.6.16 カスタム Python 型を SQLite 値に適合させる方法
........................................................

SQLite は、 限られたデータ型のみをネイティブにサポートします。 カスタム
Python 型を SQLite データベースに保存するには、 *note SQLite
がネイティブに理解できる Python 型: 2dec. のいずれかに '適合' (adapt)さ
せます。

Python オブジェクトを SQLite の型に適合させる方法は 2 つあります。それは
、オブジェクト自体を適合させる方法と、 'adapter callable' を使用する方法
です。 後者は前者よりも優先されます。 カスタム型をエクスポートするライブ
ラリの場合、 その型がそれ自体を適合させる事ができるようにすることが理に
かなっている場合があります。 アプリケーション開発者としては、カスタム適
合関数を登録して直接制御する方が理にかなっている場合もあります。

* Menu:

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


File: python.info,  Node: 適合可能オブジェクトの書き方,  Next: 適合用呼び出し可能オブジェクト adapter callables の登録方法,  Up: カスタム Python 型を SQLite 値に適合させる方法

5.13.6.17 適合可能オブジェクトの書き方
......................................

直交座標系(Cartesian coordinate system)で ‘x’ と ‘y’ のペアで座標を表す
、 ‘Point’ クラスがあるとします。 この ‘x’ と ‘y’ のペアはセミコロンで区
切られたテキスト文字列としてデータベースに保存されます。 これは、適合し
た値を返す ‘__conform__(self, protocol)’ メソッドを追加することで実装で
きます。 'protocol' に渡されるオブジェクトは、 *note PrepareProtocol:
1bca. 型になります。

     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.13.6.18 適合用呼び出し可能オブジェクト(adapter callables)の登録方法
.....................................................................

別の策としては、Python オブジェクトを SQLite 互換の型に変換する関数を作
成することが挙げられます。 この関数は、 *note register_adapter(): 2df6.
を使用して登録できます。

     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.13.6.19 SQLite 値をカスタム Python 型に変換する方法
.....................................................

適合関数(adapter)を使用すると、カスタム Python 型から SQLite 値に変換で
きます。SQLite 値 から カスタム Python 型に変換できるようにするためには
、 '変換関数' (converters)を使用します。

それでは ‘Point’ クラスの話に戻るとしましょう。 先程は x 座標と y 座標を
セミコロンで区切られた文字列として SQLite に格納しました。

まず、 文字列をパラメーターとして受け取り、そこから ‘Point’ オブジェクト
を構築する変換関数を定義します。

     注釈: 変換関数には、基になる SQLite データ型に関係なく、 '常に'
     *note bytes: 193. オブジェクトで渡されます。

     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: 2dee. と設定。

   * 明示的: 'detect_types' に *note PARSE_COLNAMES: 2def. と設定。

   * 両方: '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.13.6.20 適合関数と変換関数のレシピ集
......................................

この節では一般的な適合関数と変換関数のレシピを紹介します。

     import datetime as dt
     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(dt.date, adapt_date_iso)
     sqlite3.register_adapter(dt.datetime, adapt_datetime_iso)
     sqlite3.register_adapter(dt.datetime, adapt_datetime_epoch)

     def convert_date(val):
         """Convert ISO 8601 date to datetime.date object."""
         return dt.date.fromisoformat(val.decode())

     def convert_datetime(val):
         """Convert ISO 8601 datetime to datetime.datetime object."""
         return dt.datetime.fromisoformat(val.decode())

     def convert_timestamp(val):
         """Convert Unix epoch timestamp to datetime.datetime object."""
         return dt.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.13.6.21 接続(connection)ショートカット・メソッドの使い方
..........................................................

*note Connection: 54d. クラスのメソッド *note execute(): 2e14. と *note
executemany(): 2e15. と *note executescript(): 2e16. を使うことで、 (し
ばしば余計な) *note Cursor: 2de0. オブジェクトをわざわざ作り出さずに済む
ので、コードをより簡潔に書くことができます。 ‘Cursor’ オブジェクトは暗黙
裡に生成され、ショートカット・メソッドの戻り値として受け取ることができま
す。この方法を使えば、 ‘SELECT’ 文を実行してその結果について反復すること
が、 ‘Connection’ オブジェクトに対する呼び出し一つで行なえます。

     # 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.13.6.22 接続(connection)コンテキストマネージャの使い方
........................................................

*note Connection: 54d. オブジェクトは、コンテキスト・マネージャーとして
使用でき、コンテキスト・マネージャーとして使用すると、 *note with: 187.
ブロックを離れるときに、開いているトランザクションを自動的にコミットまた
はロールバックします。 ‘with’ 文のブロックが例外なく終了すると、トランザ
クションはコミットされます。このコミットが失敗した、または、 ‘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(): 15a5.

     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.13.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: 1caf. が送出されます:

     >>> 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.13.6.24 行工場(row factories)の作成方法と使用方法
...................................................

デフォルトでは、 ‘sqlite3’ は各行(row)を *note タプル: 614. として表しま
す。 ‘タプル’ があなたのニーズと合わない場合は、 *note sqlite3.Row:
1075. クラスまたはカスタム *note row_factory: 2e1e. を使用できます。

‘row_factory’ は *note Cursor: 2de0. と *note Connection: 54d. の両方に
属性として存在しますが、 その接続(connection)から作成されたすべてのカー
ソルが同一の行工場(row factory)を使用するようにするために、 *note
Connection.row_factory: 1a03. を設定することをお勧めします。

‘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: 184. として行を返す、カスタム
*note row_factory: 2e1e. を作成することもできます:

     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.13.6.25 How to handle non-UTF-8 text encodings
................................................

By default, ‘sqlite3’ uses *note str: 16a. 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: 2e1f. 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: 2e1f.:

     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: 14c0.:

     con.text_factory = lambda data: str(data, errors="surrogateescape")

     注釈: The ‘sqlite3’ module API does not support strings containing
     surrogates.

参考
....

*note Unicode HOWTO: 14c0.

   ---------- Footnotes ----------

   (1) https://www.sqlite.org/flextypegood.html


File: python.info,  Node: 説明,  Prev: ハウツー・ガイド,  Up: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース

5.13.6.26 説明
..............

* Menu:

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


File: python.info,  Node: トランザクション制御,  Up: 説明

5.13.6.27 トランザクション制御
..............................

‘sqlite3’ は、データベース・トランザクションを開くかどうか、いつ、どのよ
うに開くかを制御する複数の方法を提供します。 *note autocommit
属性に依るトランザクション制御: 6de. が推奨されますが、*note
isolation_level 属性に依るトランザクション制御: 2df1. は Python 3.12 よ
り前の動作を保持します。

* Menu:

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


File: python.info,  Node: autocommit 属性に依るトランザクション制御,  Next: isolation_level 属性に依るトランザクション制御,  Up: トランザクション制御

5.13.6.28 ‘autocommit’ 属性に依るトランザクション制御
.....................................................

トランザクションの動作を制御する推奨方法は、 *note
Connection.autocommit: 6dd. 属性を使用することです。 この属性は *note
connect(): 5a6. の 'autocommit' パラメータを使用して設定して頂けるとあり
がたいです。

'autocommit' を ‘False’ に設定することをお勧めします。そうすると PEP
249(1) 対応のトランザクション制御を行います。これは以下のことを意味しま
す:

   * ‘sqlite3’ はトランザクションが常に開いていることを保証します。その
     ため、 *note connect(): 5a6. や *note Connection.commit(): 2de3. や
     *note Connection.rollback(): 2e13. は暗黙に新しいトランザクションを
     開きます(1つ目については保留中のトランザクションを閉じた直後で、後
     の2つについてはその直後に、です)。 ‘sqlite3’ はトランザクションを開
     くときに ‘BEGIN DEFERRED’ 文を使用します。

   * トランザクションは、 ‘commit()’ を使用して明示的にコミットする必要
     があります。

   * トランザクションは、 ‘rollback()’ を使用して明示的にロールバックす
     る必要があります。

   * データベースの保留中に行った変更は *note close(): 54e. された場合、
     暗黙のロールバックが実行されます。

'autocommit' を ‘True’ に設定して、SQLite の autocommit mode(2) を有効に
します。このモードでは、 *note Connection.commit(): 2de3. と *note
Connection.rollback(): 2e13. は効果がありません。 SQLite の自動コミット
・モード(autocommit mode)は、 PEP 249(3) 対応の *note
Connection.autocommit: 6dd. 属性とは異なることに注意してください。 *note
Connection.in_transaction: 2e1d. を使用して、低レベル SQLite 自動コミッ
ト・モードを問い合わせします。

'autocommit' を *note LEGACY_TRANSACTION_CONTROL: 2df2. に設定して、トラ
ンザクション制御の振る舞いを *note Connection.isolation_level: 2df0. 属
性に任せます。詳細については *note isolation_level
属性に依るトランザクション制御: 2df1. を参照してください。

   ---------- 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.13.6.29 ‘isolation_level’ 属性に依るトランザクション制御
..........................................................

     注釈: 推奨のトランザクション制御方法は、 *note autocommit: 6dd. 属
     性を使用することです。 *note autocommit
     属性に依るトランザクション制御: 6de. を参照してください。

*note Connection.autocommit: 6dd. が *note LEGACY_TRANSACTION_CONTROL:
2df2. (これがデフォルトです)に設定されている場合、トランザクションの振る
舞いは *note Connection.isolation_level: 2df0. 属性を使用して制御されま
す。 ‘LEGACY_TRANSACTION_CONTROL’ 以外の場合、 ‘isolation_level’ は効果
がありません。

接続属性 *note isolation_level: 2df0. が ‘None’ で無いのなら、 *note
execute(): 5b0. や *note executemany(): 5b1. が ‘INSERT’ または ‘UPDATE’
または ‘DELETE’ または ‘REPLACE’ 文を実行する前に新しいトランザクション
が暗黙に開かれます。それ以外のSQL文では暗黙のトランザクション処理は行わ
れません。 *note commit(): 2de3. メソッドや *note rollback(): 2e13. メソ
ッドを使用して、 保留中のトランザクションをそれぞれコミットおよびロール
バックします。あなたは、背後にある SQLite ライブラリのトランザクションの
振る舞い(SQLite transaction behaviour(1)) — つまり、 sqlite3 が暗黙に実
行する ‘BEGIN’ 文の有無とその種類 – を、 ‘isolation_level’ 属性を介して
選択できます。

*note isolation_level: 2df0. が ‘None’ に設定されていると、トランザクシ
ョンは暗黙に開かれません。これにより、背後にある SQLite ライブラリを自動
コミット・モード(autocommit mode(2))にしたまま、 明示的な SQL 文を使用し
て、 ユーザが独自のトランザクション処理を行えるようにします。背後にある
SQLite ライブラリの自動コミット・モードは、 *note in_transaction: 2e1d.
属性を使用して問い合わせできます。

*note executescript(): 2e17. メソッドは、 *note isolation_level: 2df0. の
値に関係なく、与えられた 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.14 データ圧縮とアーカイブ
===========================

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 アーカイブ化操作: 1435.
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.14.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: 13a.

   * *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.14.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(): 2e58. function and *note ZstdFile: 2e59. class
     for reading and writing compressed files.

   * The *note ZstdCompressor: 2e5a. and *note ZstdDecompressor: 17b9.
     classes for incremental (de)compression.

   * 一度に圧縮・展開を行う *note compress(): 2e5b. および *note
     decompress(): 2e5c. 関数。

   * The *note train_dict(): 2e5d. and *note finalize_dict(): 2e5e.
     functions and the *note ZstdDict: 2e5f. class to train and manage
     Zstandard dictionaries.

   * The *note CompressionParameter: 2e60, *note DecompressionParameter:
     2e61, and *note Strategy: 2e62. classes for setting advanced
     (de)compression parameters.

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

* 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.14.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.14.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: 13df.

     The 'file' argument can be either a file name (given as a *note
     str: 16a, *note bytes: 193. 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: 2e61. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 2e5f. 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:
     2e60. 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: 2e5f. instance to be
     used during compression.

     In binary mode, this function is equivalent to the *note ZstdFile:
     2e59. constructor: ‘ZstdFile(file, mode, ...)’.  In this case, the
     'encoding', 'errors', and 'newline' parameters must not be
     provided.

     In text mode, a *note ZstdFile: 2e59. object is created, and
     wrapped in an *note io.TextIOWrapper: 9c2. 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 ‘ZstdFile’ can wrap an already-open *note file object: 13df, 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: 16a, *note bytes: 193. or *note path-like: 5a1.
     object).  If wrapping an existing file object, the wrapped file
     will not be closed when the ‘ZstdFile’ 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: 2e61. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 2e5f. 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:
     2e60. 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: 2e5f. instance to be
     used during compression.

     ‘ZstdFile’ supports all the members specified by *note
     io.BufferedIOBase: 8a4, except for *note detach(): 2e66. and *note
     truncate(): 152c.  Iteration and the *note with: 187. statement are
     supported.

     以下のメソッドと属性も提供されています:

      -- メソッド: peek (size=-1)

          ファイル上の現在位置を変更せずにバッファのデータを返します。
          EOF に達しない限り、少なくとも 1 バイトが返されます。返される
          正確なバイト数は規定されていません (引数 'size' は無視されます
          )。

               注釈: While calling ‘peek()’ does not change the file
               position of the ‘ZstdFile’, it may change the position of
               the underlying file object (for example, if the
               ‘ZstdFile’ was constructed by passing a file object for
               'file').

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

      -- の属性: name

          The name of the Zstandard file.  Equivalent to the *note name:
          2e6a. attribute of the underlying *note file object: 13df.


File: python.info,  Node: メモリ上での圧縮と展開,  Next: Zstandard dictionaries,  Prev: 圧縮ファイルへの読み書き,  Up: compression zstd --- Compression compatible with the Zstandard format

5.14.2.3 メモリ上での圧縮と展開
...............................

 -- の関数: compression.zstd.compress (data, level=None, options=None,
          zstd_dict=None)

     Compress 'data' (a *note bytes-like object: 194.), returning the
     compressed data as a *note bytes: 193. object.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 2e6c. in 'options'.  Use
     *note bounds(): 2e6d. on ‘compression_level’ 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: 2e60. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2e5f.
     containing trained data to improve compression efficiency.  The
     function *note train_dict(): 2e5d. can be used to generate a
     Zstandard dictionary.

 -- の関数: compression.zstd.decompress (data, zstd_dict=None,
          options=None)

     Decompress 'data' (a *note bytes-like object: 194.), returning the
     uncompressed data as a *note bytes: 193. 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: 2e61. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2e5f.
     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(): 2e5b.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 2e6c. in 'options'.  Use
     *note bounds(): 2e6d. on ‘compression_level’ 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: 2e60. documentation.

     The 'zstd_dict' argument is an optional instance of *note ZstdDict:
     2e5f. containing trained data to improve compression efficiency.
     The function *note train_dict(): 2e5d. can be used to generate a
     Zstandard dictionary.

      -- メソッド: compress (data, mode=ZstdCompressor.CONTINUE)

          Compress 'data' (a *note bytes-like object: 194.), returning a
          *note bytes: 193. 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(): 2e6f.  The returned data should be
          concatenated with the output of any previous calls to
          ‘compress()’.

          The 'mode' argument is a ‘ZstdCompressor’ attribute, either
          *note CONTINUE: 2e70, *note FLUSH_BLOCK: 2e71, or *note
          FLUSH_FRAME: 2e72.

          When all data has been provided to the compressor, call the
          *note flush(): 2e6f. method to finish the compression process.
          If ‘compress()’ is called with 'mode' set to *note
          FLUSH_FRAME: 2e72, ‘flush()’ should not be called, as it would
          write out a new empty frame.

      -- メソッド: flush (mode=ZstdCompressor.FLUSH_FRAME)

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 193. オブジェクトを返します。

          The 'mode' argument is a ‘ZstdCompressor’ attribute, either
          *note FLUSH_BLOCK: 2e71, or *note FLUSH_FRAME: 2e72.

      -- メソッド: 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: 2e74. 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: 2e75. is not *note FLUSH_FRAME: 2e72, a
          *note ValueError: 2ee. 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(): 2e6e, future
          calls to ‘compress()’ or *note flush(): 2e6f. may raise *note
          ZstdError: 2e64. and the last chunk of data may be lost.

          After *note flush(): 2e6f. or *note compress(): 2e6e. are
          called with mode *note FLUSH_FRAME: 2e72, 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(): 2e6e, improving compression.

      -- の属性: FLUSH_FRAME

          Complete and write out a frame.  Future data provided to *note
          compress(): 2e6e. will be written into a new frame and
          'cannot' reference past data.

      -- の属性: last_mode

          The last mode passed to either *note compress(): 2e6e. or
          *note flush(): 2e6f.  The value can be one of *note CONTINUE:
          2e70, *note FLUSH_BLOCK: 2e71, or *note FLUSH_FRAME: 2e72.
          The initial value is ‘FLUSH_FRAME’, 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():
     2e5c.

     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: 2e61. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2e5f.
     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(): 2e5c. function and *note ZstdFile: 2e59. class.
          To decompress a multi-frame input, you should use
          ‘decompress()’, ‘ZstdFile’ if working with a *note file
          object: 13df, or multiple ‘ZstdDecompressor’ instances.

      -- メソッド: decompress (data, max_length=-1)

          Decompress 'data' (a *note bytes-like object: 194.), 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: 2e77. attribute will be set to ‘False’.  In this
          case, the next call to ‘decompress()’ may provide 'data' as
          ‘b''’ to obtain more of the output.

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2e77. 属性は ‘True’ になります。

          Attempting to decompress data after the end of a frame will
          raise a *note ZstdError: 2e64.  Any data found after the end
          of the frame is ignored and saved in the *note unused_data:
          2e78. attribute.

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          Before the end of the stream is reached, this will be ‘b''’.

      -- の属性: needs_input

          ‘False’ if the *note decompress(): 2e76. 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.14.2.4 Zstandard dictionaries
...............................

 -- の関数: compression.zstd.train_dict (samples, dict_size)

     Train a Zstandard dictionary, returning a *note ZstdDict: 2e5f.
     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: 193. 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: 2e5f. instance with
     the *note dict_content: 2e7b. containing the raw dictionary
     contents.

     The 'samples' argument (an iterable of *note bytes: 193. 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():
     2e5d. 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(): 2e5d. if you need to train a new dictionary from
     sample data.

     The 'dict_content' argument (a *note bytes-like object: 194.), 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(): 2e5d. 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(): 2e7d. 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.14.2.5 Advanced parameter control
...................................

 -- クラス: compression.zstd.CompressionParameter

     An *note IntEnum: edf. containing the advanced compression
     parameter keys that can be used when compressing data.

     The *note bounds(): 2e6d. 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: 2e6c.:

          lower, upper = CompressionParameter.compression_level.bounds()

     Example setting the *note window_log: 2e81. 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: 2e6c, 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: 2e82.

      -- の属性: 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:
          2e84, and improve compression speed of strategies > ‘dfast’.

          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: 2e86. strategy.
          It's still useful when using *note dfast: 2e84. 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: 2e86. and *note dfast: 2e84.
          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: 2e89, the effective minimum
          is ‘4’; for all strategies > *note fast: 2e86, 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: 2e62.

          For strategies *note btopt: 2e89, *note btultra: 2e8b. and
          *note btultra2: 2e8c, 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: 2e86, 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: 2e62.

      -- の属性: 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:
          2e81. 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: 2e89.
          (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(): 2e5b. for one-shot compression

             * Providing all of the data to be compressed in the frame
               in a single *note ZstdCompressor.compress(): 2e6e. call,
               with the *note ZstdCompressor.FLUSH_FRAME: 2e72. mode.

             * Calling *note ZstdCompressor.set_pledged_input_size():
               2e73. with the exact amount of data that will be provided
               to the compressor prior to any calls to *note
               ZstdCompressor.compress(): 2e6e. 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: 2e64. exception is raised.

          ‘True’ or ‘1’ enable checksum generation while ‘False’ or ‘0’
          disable it.

      -- の属性: dict_id_flag

          When compressing with a *note ZstdDict: 2e5f, 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: 2e95. >= 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:
          2e95. >= 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: edf. 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(): 2e98. method can be used on any attribute to
     get the valid values for that parameter.

     Example setting the *note window_log_max: 2e99. 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: edf. 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.14.2.6 その他
...............

 -- の関数: compression.zstd.get_frame_info (frame_buffer)

     Retrieve a *note FrameInfo: 2e9f. 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.14.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.14.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: 21b4.  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
オプションのモジュールの要件: 21b2.

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: 2ea8.
     (‘1’), *note Z_BEST_COMPRESSION: 2ea9. (‘9’), *note
     Z_NO_COMPRESSION: 2eaa. (‘0’), and the default, *note
     Z_DEFAULT_COMPRESSION: 2eab. (‘-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:
     2ead.):

        * +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: 2ea7. 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: 2ea8. (‘1’), *note
     Z_BEST_COMPRESSION: 2ea9. (‘9’), *note Z_NO_COMPRESSION: 2eaa.
     (‘0’), and the default, *note Z_DEFAULT_COMPRESSION: 2eab. (‘-1’)
     for more information about these values.

     'method' は圧縮アルゴリズムです。現在、 *note DEFLATED: 2eaf. のみ
     サポートされています。

     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():
     2eac.

     'memLevel' 引数は内部圧縮状態用に使用されるメモリ量を制御します。有
     効な値は ‘1’ から ‘9’ です。大きい値ほど多くのメモリを消費しますが
     、より速く、より小さな出力を作成します。

     'strategy' is used to tune the compression algorithm.  Possible
     values are *note Z_DEFAULT_STRATEGY: 2eb0, *note Z_FILTERED: 2eb1,
     *note Z_HUFFMAN_ONLY: 2eb2, *note Z_RLE: 2eb3. and *note Z_FIXED:
     2eb4.

     'zdict' は定義済み圧縮辞書です。これは圧縮されるデータ内で繰り返し
     現れると予想されるサブシーケンスを含む (*note bytes: 193. オブジェ
     クトのような) バイト列のシーケンスです。最も一般的と思われるサブシ
     ーケンスは辞書の末尾に来なければなりません。

     バージョン 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: 2ea7. 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(): 2eae, 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: 2ea7. 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(): 2eb5.

     'zdict' パラメータには定義済み圧縮辞書を指定します。このパラメータ
     を指定する場合、展開するデータを圧縮した際に使用した辞書と同じもの
     でなければなりません。

          注釈: 'zdict' が (*note bytearray: 342. のような) 変更可能オブ
          ジェクトの場合、*note decompressobj(): 2eb6. の呼び出しとデコ
          ンプレッサの ‘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: 2eb9, *note Z_PARTIAL_FLUSH:
     2eba, *note Z_SYNC_FLUSH: 2ebb, *note Z_FULL_FLUSH: 2ebc, *note
     Z_BLOCK: 2ebd, or *note Z_FINISH: 2ebe, defaulting to ‘Z_FINISH’.
     Except ‘Z_FINISH’, all constants allow compressing further
     bytestrings of data, while ‘Z_FINISH’ finishes the compressed
     stream and prevents compressing any more data.  After calling
     ‘flush()’ with 'mode' set to ‘Z_FINISH’, 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(): d69. support to compression objects.

展開オブジェクトは以下のメソッドと属性をサポートしています:

 -- の属性: Decompress.unused_data

     圧縮データの末尾より後のバイト列が入ったバイト列オブジェクトです。
     すなわち、この値は圧縮データの入っているバイト列の最後の文字が利用
     可能になるまでは ‘b""’ のままとなります。入力バイト文字列すべてが圧
     縮データを含んでいた場合、この属性は ‘b""’ 、すなわち空バイト列にな
     ります。

 -- の属性: Decompress.unconsumed_tail

     展開されたデータを収めるバッファの長さ制限を超えたために、直近の
     *note decompress(): f0d. 呼び出しで処理しきれなかったデータを含むバ
     イト列オブジェクトです。このデータはまだ zlib 側からは見えていない
     ので、正しい展開出力を得るには以降の ‘decompress()’ メソッド呼び出
     しに (場合によっては後続のデータが追加された) データを差し戻さなけ
     ればなりません。

 -- の属性: Decompress.eof

     圧縮データストリームの終了に達したかどうかを示すブール値です。

     これは、正常な形式の圧縮ストリームと、不完全あるいは切り詰められた
     ストリームとを区別することを可能にします。

     Added in version 3.3.

 -- メソッド: Decompress.decompress (data, max_length=0)

     'data' を展開し、少なくとも 'string' の一部分に対応する展開されたデ
     ータを含むバイト列オブジェクトを返します。このデータは以前に *note
     decompress(): f0d. メソッドを呼んだ時に返された出力と結合することが
     できます。入力データの一部分が以後の処理のために内部バッファに保存
     されることもあります。

     If the optional parameter 'max_length' is non-zero then the return
     value will be no longer than 'max_length'.  This may mean that not
     all of the compressed input can be processed; and unconsumed data
     will be stored in the attribute *note unconsumed_tail: 2ec1.  This
     bytestring must be passed to a subsequent call to ‘decompress()’ if
     decompression is to continue.  If 'max_length' is zero then the
     whole input is decompressed, and ‘unconsumed_tail’ is empty.

     バージョン 3.6 で変更: 'max_length' can be used as a keyword
     argument.

 -- メソッド: Decompress.flush ([length])

     未処理の入力データをすべて処理し、最終的に圧縮されなかった残りの出
     力バイト列オブジェクトを返します。*note flush(): 2ec3. を呼んだ後、
     *note decompress(): f0d. を再度呼ぶべきではありません。このときでき
     る唯一の現実的な操作はオブジェクトの削除だけです。

     オプション引数 'length' には出力バッファの初期サイズを指定します。

 -- メソッド: Decompress.copy ()

     展開オブジェクトのコピーを返します。これを使うとデータストリームの
     途中にある展開オブジェクトの状態を保存でき、未来のある時点で行なわ
     れるストリームのランダムなシークをスピードアップするのに利用できま
     す。

バージョン 3.8 で変更: Added *note copy.copy(): 757. and *note
copy.deepcopy(): d69. 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: 138a. で確認できる、実行時
     に使用している実際の 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: 2ec8. and *note ZLIB_RUNTIME_VERSION: 138a. 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.14.4 ‘gzip’ -- ‘gzip’ ファイルのサポート
------------------------------------------

'ソースコード:' Lib/gzip.py(1)

__________________________________________________________________

このモジュールは、GNU の ‘gzip’ や ‘gunzip’ のようにファイルを圧縮、展開
するシンプルなインターフェイスを提供しています。

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

データ圧縮は *note zlib: 13a. モジュールで提供されています。

The ‘gzip’ module provides the *note GzipFile: 65c. class, as well as
the *note open(): 2ecd, *note compress(): 84e. and *note decompress():
142a. convenience functions.  The ‘GzipFile’ class reads and writes
‘gzip’-format files, automatically compressing or decompressing the data
so that it looks like an ordinary *note file object: 13df.

‘compress’ や ‘pack’ 等によって作成され、‘gzip’ や ‘gunzip’ が展開できる
他のファイル形式についてはこのモジュールは対応していないので注意してくだ
さい。

このモジュールは以下の項目を定義しています:

 -- の関数: gzip.open (filename, mode='rb', compresslevel=9,
          encoding=None, errors=None, newline=None)

     gzip 圧縮ファイルをバイナリまたはテキストモードで開き、*note
     ファイルオブジェクト: 13df. を返します。

     引数 'filename' には実際のファイル名 (*note str: 16a. または *note
     bytes: 193. オブジェクト) か、既存のファイルオブジェクトを指定しま
     す。

     引数 '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: 9c2. インスタンスにラップされます。

     バージョン 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: 2c2.  *note EOFError: 14f5. and *note zlib.error: 2ea7.
     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. クラスのコンストラクタです。‘GzipFile’ オブジ
     ェクトは *note truncate(): 152c. メソッドを除くほとんどの *note
     ファイルオブジェクト: 13df. のメソッドをシミュレートします。少なく
     とも 'fileobj' および 'filename' は有効な値でなければなりません。

     クラスの新しいインスタンスは、 'fileobj' に基づいて作成されます。
     'fileobj' は通常のファイル、 *note io.BytesIO: 10a8. オブジェクト、
     そしてその他ファイルをシミュレートできるオブジェクトでかまいません
     。 値はデフォルトでは '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(): 2ecd. (または
     *note GzipFile: 65c. を *note io.TextIOWrapper: 9c2. でラップしたオ
     ブジェクト) を使ってください。

     引数 '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: 2ece. attribute that is set when
     decompressing.

     圧縮したデータの後ろにさらに何か追加したい場合もあるので、*note
     GzipFile: 65c. オブジェクトの ‘close()’ メソッド呼び出しは
     'fileobj' を閉じません。 このため、書き込みのためにオープンした
     *note io.BytesIO: 10a8. オブジェクトを 'fileobj' として渡し、
     (‘GzipFile’ を ‘close()’ した後に) ‘io.BytesIO’ オブジェクトの
     *note getvalue(): 2ecf. メソッドを使って書き込んだデータの入ってい
     るメモリバッファを取得することができます。

     *note GzipFile: 65c. は、イテレーションと *note with: 187. 文を含む
     *note io.BufferedIOBase: 8a4. インターフェイスをサポートしています
     。*note truncate(): 152c. メソッドのみ実装されていません。

     *note GzipFile: 65c. は以下のメソッドと属性も提供しています:

      -- メソッド: peek (n)

          ファイル内の位置を移動せずに展開した 'n' バイトを読み込みます
          。返されるバイト数はほぼ要求した値になります。

               注釈: *note peek(): 1429. の呼び出しでは *note GzipFile:
               65c. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります。(e.g.  ‘GzipFile’ が
               '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: 16a. or
          *note bytes: 193.  Equivalent to the output of *note
          os.fspath(): e51. on the original input path, with no other
          normalization, resolution or expansion.

     バージョン 3.1 で変更: *note with: 187. 文がサポートされました。
     'mtime' コンストラクタ引数と *note mtime: 2ece. 属性が追加されまし
     た。

     バージョン 3.2 で変更: ゼロパディングされたファイルやシーク出来ない
     ファイルがサポートされました。

     バージョン 3.3 で変更: *note io.BufferedIOBase.read1(): 2ed1. メソ
     ッドを実装しました。

     バージョン 3.4 で変更: ‘'x'’ ならびに ‘'xb'’ モードがサポートされま
     した。

     バージョン 3.5 で変更: 任意の *note バイトライクオブジェクト: 194.
     の書き込みがサポートされました。 *note read(): 1544. メソッドが
     ‘None’ を引数として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.9 で非推奨: Opening ‘GzipFile’ 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: 193. 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: 193. 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(): f0d. 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.14.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: 13a. モジュール

     ‘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.14.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.14.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.14.5 ‘bz2’ -- ‘bzip2’ 圧縮のサポート
--------------------------------------

'ソースコード:' Lib/bz2.py(1)

__________________________________________________________________

このモジュールは、bzip2 アルゴリズムを用いて圧縮・展開を行う包括的なイン
ターフェイスを提供します。

The ‘bz2’ module contains:

   * 圧縮ファイルを読み書きするための *note open(): 12a3. 関数と *note
     BZ2File: a6a. クラス。

   * インクリメンタルにデータを圧縮・展開するための *note BZ2Compressor:
     1b2d. および *note BZ2Decompressor: 178f. クラス。

   * 一度に圧縮・展開を行う *note compress(): 28f5. および *note
     decompress(): 12a4. 関数。

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/bz2.py


File: python.info,  Node: ファイルの圧縮/解凍,  Next: 逐次圧縮および展開,  Up: bz2 --- bzip2 圧縮のサポート

5.14.5.1 ファイルの圧縮/解凍
............................

 -- の関数: bz2.open (filename, mode='rb', compresslevel=9,
          encoding=None, errors=None, newline=None)

     bzip2 圧縮されたファイルを、バイナリモードかテキストモードでオープ
     ンし、*note ファイルオブジェクト: 13df. を返します。

     *note BZ2File: a6a. のコンストラクタと同様に、引数 'filename' には
     実際のファイル名 (*note str: 16a. または *note bytes: 193. オブジェ
     クト) か、読み書きする既存のファイルオブジェクトを指定します。

     引数 'mode' には、バイナリモード用に ‘'r'’、‘'rb'’、‘'w'’、‘'wb'’、
     ‘'x'’、‘'xb'’、‘'a'’、あるいは ‘'ab'’、テキストモード用に ‘'rt'’、
     ‘'wt'’、‘'xt'’、あるいは ‘'at'’ を指定できます。デフォルトは ‘'rb'’
     です。

     引数 'compresslevel' には *note BZ2File: a6a. コンストラクタと同様
     に 1 から 9 の整数を指定します。

     バイナリモードでは、この関数は *note BZ2File: a6a. コンストラクタ
     ‘BZ2File(filename, mode, compresslevel=compresslevel)’ と等価です。
     この時、引数 'encoding'、'errors'、および 'newline' を指定してはい
     けません。

     テキストモードでは、*note BZ2File: a6a. オブジェクトが作成され、指
     定されたエンコーディング、エラーハンドラの挙動、および改行文字で
     *note io.TextIOWrapper: 9c2. にラップされます。

     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: 16a. あるいは *note bytes: 193. オブジェク
     トの場合、それを名前とするファイルを直接開きます。そうでない場合、
     'filename' は圧縮データを読み書きする *note ファイルオブジェクト:
     13df. でなくてはなりません。

     引数 'mode' は読み込みモードの ‘'r'’ (デフォルト)、上書きモードの
     ‘'w'’、排他的作成モードの ‘'x'’、あるいは追記モードの ‘'a'’ のいず
     れかを指定できます。これらはそれぞれ ‘'rb'’、‘'wb'’、‘'xb'’ および
     ‘'ab'’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘'w'’ はファイルを上書きせず、‘'a'’ と等価になります。

     'mode' が ‘'w'’ あるいは ‘'a'’ の場合、'compresslevel' に圧縮レベル
     を ‘1’ から ‘9’ の整数で指定できます。 圧縮率は ‘1’ が最低で、‘9’
     (デフォルト値) が最高です。

     'mode' の値が ‘'r'’ の場合、入力ファイルは複数の圧縮ストリームでも
     構いません。

     *note BZ2File: a6a. には、 *note io.BufferedIOBase: 8a4. で規定され
     ているメソッドや属性のうち、 *note detach(): 2e66. と *note
     truncate(): 152c. を除くすべてが備わっています。イテレーションと
     *note with: 187. 文をサポートしています。

     *note BZ2File: a6a. also provides the following methods and
     attributes:

      -- メソッド: peek ([n])

          ファイル上の現在位置を変更せずにバッファのデータを返します。こ
          のメソッドは少なくとも 1 バイトのデータを返します (EOF の場合
          を除く)。返される正確なバイト数は規定されていません。

               注釈: *note peek(): 2ee2. の呼び出しでは *note BZ2File:
               a6a. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります(e.g.  ‘BZ2File’ を
               '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: 2e6a.
          attribute of the underlying *note file object: 13df.

          Added in version 3.13.

     バージョン 3.1 で変更: *note with: 187. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'filename' が実際のファイル名でなく *note
     ファイルオブジェクト: 13df. だった場合のサポートが追加されました。

     ‘'a'’ (追記) モードが追加され、複数のストリームの読み込みがサポート
     されました。

     バージョン 3.4 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.5 で変更: *note read(): 1544. メソッドが ‘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.14.5.2 逐次圧縮および展開
...........................

 -- クラス: bz2.BZ2Compressor (compresslevel=9)

     新しくコンプレッサオブジェクトを作成します。このオブジェクトはデー
     タの逐次的な圧縮に使用できます。一度に圧縮したい場合は、*note
     compress(): 28f5. 関数を使ってください。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

      -- メソッド: compress (data)

          データをコンプレッサオブジェクトに渡します。戻り値は圧縮された
          データですが、圧縮データを返すことができない場合は空のバイト文
          字列を返します。

          コンプレッサオブジェクトにデータをすべて渡し終えたら、*note
          flush(): 2eed. メソッドを呼び出し、圧縮プロセスを完了させてく
          ださい。

      -- メソッド: flush ()

          圧縮プロセスを完了させ、内部バッファに残っている圧縮済みデータ
          を返します。

          このメソッドを呼び出すと、それ以後コンプレッサオブジェクトは使
          用できなくなります。

 -- クラス: bz2.BZ2Decompressor

     新しくデコンプレッサオブジェクトを作成します。このオブジェクトは逐
     次的なデータ展開に使用できます。一度に展開したい場合は、*note
     decompress(): 12a4. 関数を使ってください。

          注釈: このクラスは、*note decompress(): 12a4. や *note
          BZ2File: a6a. とは異なり、複数の圧縮レベルが混在しているデータ
          を透過的に扱うことができません。 *note BZ2Decompressor: 178f.
          クラスを用いて、複数のストリームからなるデータを展開する場合は
          、それぞれのストリームについてデコンプレッサオブジェクトを用意
          してください。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 194.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 12a4. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の ‘decompress()’
          の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 2eee. が ‘False’ に設定されます。この場合、
          *note decompress(): fce. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2eee. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 14f5. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 2eef. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

          Added in version 3.3.

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前には、この属性には ‘b''’ という値が
          収められています。

      -- の属性: needs_input

          *note decompress(): fce. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘False’ です。

          Added in version 3.5.


File: python.info,  Node: 一括圧縮/解凍,  Next: 使い方の例<2>,  Prev: 逐次圧縮および展開,  Up: bz2 --- bzip2 圧縮のサポート

5.14.5.3 一括圧縮/解凍
......................

 -- の関数: bz2.compress (data, compresslevel=9)

     *note バイト類オブジェクト: 194. の 'data' を圧縮します。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

     逐次的にデータを圧縮したい場合は、*note BZ2Compressor: 1b2d. を使っ
     てください。

 -- の関数: bz2.decompress (data)

     *note バイト類オブジェクト: 194. の 'data' を展開します。

     'data' が複数の圧縮ストリームから成る場合、そのすべてを展開します。

     逐次的に展開を行う場合は、*note BZ2Decompressor: 178f. を使ってくだ
     さい。

     バージョン 3.3 で変更: 複数ストリームの入力をサポートしました。


File: python.info,  Node: 使い方の例<2>,  Prev: 一括圧縮/解凍,  Up: bz2 --- bzip2 圧縮のサポート

5.14.5.4 使い方の例
...................

Below are some examples of typical usage of the ‘bz2’ module.

*note compress(): 28f5. と *note decompress(): 12a4. を使い、圧縮して展
開する実演をしています:

     >>> 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: 1b2d. を使い、逐次圧縮をしています:

     >>> 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.14.6 ‘lzma’ -- LZMA アルゴリズムを使用した圧縮
------------------------------------------------

Added in version 3.3.

'ソースコード:' Lib/lzma.py(1)

__________________________________________________________________

このモジュールは LZMA 圧縮アルゴリズムを使用したデータ圧縮および展開のた
めのクラスや便利な関数を提供しています。また、‘xz’ ユーティリティを使用
した ‘.xz’ およびレガシーな ‘.lzma’ ファイル形式へのファイルインターフェ
イスの他、RAW 圧縮ストリームもサポートしています。

このモジュールが提供するインターフェイスは *note bz2: 14. モジュールと非
常によく似ています。 *note LZMAFile: 1212. と *note bz2.BZ2File: a6a. は
スレッドセーフでは 'ない' 点に注意してください。 そのため、単一の
‘LZMAFile’ インスタンスを複数スレッドから使用する場合は、ロックで保護す
る必要があります。

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

 -- 例外: 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.14.6.1 圧縮ファイルへの読み書き
.................................

 -- の関数: lzma.open (filename, mode='rb', *, format=None, check=-1,
          preset=None, filters=None, encoding=None, errors=None,
          newline=None)

     LZMA 圧縮ファイルをバイナリまたはテキストモードでオープンし、*note
     ファイルオブジェクト: 13df. を返します。

     'filename' 引数には、ファイルをオープンする際には実際のファイル名
     (*note str: 16a.、 *note bytes: 193.、または *note path-like: 5a1.
     オブジェクトとして指定します)か、読み込みまたは書き込むためであれば
     、すでに存在するファイルオブジェクトを指定できます。

     引数 'mode' は、バイナリモードでは ‘"r"’、‘"rb"’、‘"w"’、‘"wb"’、
     ‘"x"’、‘"xb"’、‘"a"’、あるいは ‘"ab"’ の、テキストモードでは
     ‘"rt"’、‘"wt"’、‘"xt"’、あるいは ‘"at"’ のいずれかになります。デフ
     ォルトは ‘"rb"’ です。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 17ae. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1b2c. と同じ意味になります
     。

     バイナリモードでは、この関数は *note LZMAFile: 1212. コンストラクタ
     と等価になります (‘LZMAFile(filename, mode, ...)’)。この場合、引数
     'encoding'、'errors'、および 'newline' を指定しなければなりません。

     テキストモードでは、*note LZMAFile: 1212. オブジェクトが生成され、
     指定したエンコーディング、エラーハンドラの挙動、および改行コードで
     *note io.TextIOWrapper: 9c2. にラップされます。

     バージョン 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: 1212. はすでにオープンしている *note file object:
     13df. をラップ、または名前付きファイルを直接操作できます。引数
     'filename' にはラップするファイルオブジェクトかオープンするファイル
     名 (*note str: 16a. オブジェクトま、*note bytes: 193. オブジェクト
     、または *note path-like: 5a1. オブジェクト) を指定します。既存のフ
     ァイルオブジェクトをラップした場合、‘LZMAFile’ をクローズしてもラッ
     プしたファイルはクローズされません。

     引数 'mode' は読み込みモードの ‘"r"’ (デフォルト)、上書きモードの
     ‘"w"’、排他的生成モードの ‘"x"’、あるいは追記モードの ‘"a"’ のいず
     れかを指定できます。これらはそれぞれ ‘"rb"’、‘"wb"’、‘"xb"’、および
     ‘"ab"’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘"w"’ モードはファイルを上書きせず、‘"a"’ と等価になります。

     読み込みモードでファイルをオープンした時、入力ファイルは複数に分割
     された圧縮ストリームを連結したものでもかまいません。これらは透過的
     に単一論理ストリームとしてデコードされます。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 17ae. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1b2c. と同じ意味になります
     。

     *note LZMAFile: 1212. には、 *note io.BufferedIOBase: 8a4. で規定さ
     れているメソッドや属性のうち、 *note detach(): 2e66. と *note
     truncate(): 152c. を除くすべてが備わっています。イテレーションと
     *note with: 187. 文をサポートしています。

     以下のメソッドと属性も提供されています:

      -- メソッド: peek (size=-1)

          ファイル上の現在位置を変更せずにバッファのデータを返します。
          EOF に達しない限り、少なくとも 1 バイトが返されます。返される
          正確なバイト数は規定されていません (引数 'size' は無視されます
          )。

               注釈: *note peek(): 2efa. の呼び出しでは *note LZMAFile:
               1212. のファイル位置は変わりませんが、下層のファイルオブ
               ジェクトの位置が変わる惧れがあります。(e.g.  ‘LZMAFile’ を
               'filename' にファイルオブジェクトを渡して作成した場合)

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

          Added in version 3.13.

      -- の属性: name

          lzma ファイルの名前。基礎である *note file object: 13df. の
          *note name: 2e6a. 属性と同様です。

          Added in version 3.13.

     バージョン 3.4 で変更: ‘'x'’, ‘'xb'’ モードがサポートが追加されまし
     た。

     バージョン 3.5 で変更: *note read(): 1544. メソッドが ‘None’ を引数
     として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。


File: python.info,  Node: メモリ上での圧縮と展開<2>,  Next: その他<4>,  Prev: 圧縮ファイルへの読み書き<2>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.14.6.2 メモリ上での圧縮と展開
...............................

 -- クラス: lzma.LZMACompressor (format=FORMAT_XZ, check=-1,
          preset=None, filters=None)

     データをインクリメンタルに圧縮する圧縮オブジェクトを作成します。

     大量の単一データを圧縮する、より便利な方法については *note
     compress(): 2efe. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。以下の
     値が指定できます:

        * 
          ‘FORMAT_XZ’: The ‘.xz’ コンテナフォーマット。

               デフォルトのフォーマットです。

        * 
          ‘FORMAT_ALONE’: レガシーな ‘.lzma’ コンテナフォーマット。

               このフォーマットは ‘.xz’ より制限があります - インテグリ
               ティチェックや複数フィルタをサポートしていません。

        * 
          ‘FORMAT_RAW’: 特定のコンテナフォーマットを使わない、生のデータストリーム。

               このフォーマット指定子はインテグリティチェックをサポート
               しておらず、(圧縮および展開双方のために) 常にカスタムフィ
               ルタチェインを指定する必要があります。さらに、この方法で
               圧縮されたデータは ‘FORMAT_AUTO’ を使っても展開できません
               (*note LZMADecompressor: 17ae. を参照)。

     引数 'check' には圧縮データに組み込むインテグリティチェックのタイプ
     を指定します。このチェックは展開時に使用され、データが破損していな
     いことを保証します。以下の値が指定できます:

        * ‘CHECK_NONE’: インテグリティチェックなし。‘FORMAT_ALONE’ およ
          び ‘FORMAT_RAW’ のデフォルト (かつ唯一指定可能な値) です。

        * ‘CHECK_CRC32’: 32-bit 巡回冗長検査。

        * ‘CHECK_CRC64’: 64-bit 巡回冗長検査。‘FORMAT_XZ’ のデフォルトで
          す。

        * ‘CHECK_SHA256’: 256-bit セキュアハッシュアルゴリズム (SHA)。

     指定したチェック方法がサポートされていない場合、*note LZMAError:
     2ef7. が送出されます。

     圧縮設定はプリセット圧縮レベル (引数 'preset' で指定) またはカスタ
     ムフィルタチェイン (引数 'filters' で指定) のどちらかを指定します。

     引数 'preset' を指定する場合、‘0’ から ‘9’ までの整数値でなければな
     らず、オプションで定数 ‘PRESET_EXTREME’ を論理和指定できます。
     'preset' も 'filters' も指定されなかった場合、デフォルトの挙動とし
     て ‘PRESET_DEFAULT’ (プリセットレベル ‘6’) が使用されます。高いプリ
     セット値を指定すると圧縮率が上がりますが、圧縮にかかる時間が長くな
     ります。

          注釈: CPU の使用量が多いのに加えて、高いプリセットで圧縮を行う
          には、メモリをずっと多く必要とします (さらに、生成される出力も
          展開により多くのメモリを必要とします)。例えば、プリセットが
          ‘9’ の場合、*note LZMACompressor: 1b2c. オブジェクトのオーバー
          ヘッドは 800 MiB にまで高くなる場合があります。このため、通常
          はデフォルトのプリセットを使用するのがよいでしょう。

     引数 'filters' を指定する場合、フィルタチェイン指定子でなければなり
     ません。詳しくは *note カスタムフィルタチェインの指定: 2eff. を参照
     してください。

      -- メソッド: compress (data)

          'data' (*note bytes: 193. オブジェクト) を圧縮し、少なくともそ
          の一部が圧縮されたデータを格納する ‘bytes’ オブジェクトを返し
          ます。'data' の一部は、後で *note compress(): 2efe. および
          *note flush(): 2f01. の呼び出しに使用するため内部でバッファさ
          れている場合があります。返すデータは以前の ‘compress()’ 呼び出
          しの出力を連結したものです。

      -- メソッド: flush ()

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 193. オブジェクトを返します。

          コンプレッサはこのメソッドが呼び出された後は使用できません。

 -- クラス: lzma.LZMADecompressor (format=FORMAT_AUTO, memlimit=None,
          filters=None)

     データをインクリメンタルに展開するために使用できる展開オブジェクト
     を作成します。

     圧縮されたストリーム全体を一度に展開にする、より便利な方法について
     は、*note decompress(): 2f02. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。デフォ
     ルトは ‘FORMAT_AUTO’ で、‘.xz’ および ‘.lzma’ ファイルを展開できま
     す。その他に指定できる値は、‘FORMAT_XZ’、‘FORMAT_ALONE’、および
     ‘FORMAT_RAW’ です。

     引数 'memlimit' にはデコンプレッサが使用できるメモリ量をバイトで指
     定します。この引数を指定した場合、そのメモリ量で展開ができないと
     *note LZMAError: 2ef7. を送出します。

     引数 'filters' には展開されるストリームの作成に使用するフィルタチェ
     インを指定します。この引数を使用する際は、引数 'format' に
     ‘FORMAT_RAW’ を指定しなければなりません。フィルタチェインについての
     詳細は *note カスタムフィルタチェインの指定: 2eff. を参照してくださ
     い。

          注釈: このクラスは *note decompress(): 2f02. および *note
          LZMAFile: 1212. と異なり、複数の圧縮ストリームを含む入力を透過
          的に扱いません。 *note LZMADecompressor: 17ae. で複数ストリー
          ム入力を展開するには、各ストリームごとに新しいデコンプレッサを
          作成しなければなりません。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 194.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 2f02. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の ‘decompress()’
          の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 2f03. が ‘False’ に設定されます。この場合、
          *note decompress(): 1032. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2f03. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 14f5. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 2f04. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: check

          入力ストリームに使用されるインテグリティチェックの ID です。こ
          れは何のインテグリティチェックが使用されているか決定するために
          十分な入力がデコードされるまでは ‘CHECK_UNKNOWN’ になることが
          あります。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前は、これは ‘b""’ になります。

      -- の属性: needs_input

          *note decompress(): 1032. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘False’ です。

          Added in version 3.5.

 -- の関数: lzma.compress (data, format=FORMAT_XZ, check=-1,
          preset=None, filters=None)

     'data' (*note bytes: 193. オブジェクト) を圧縮し、圧縮データを
     ‘bytes’ オブジェクトとして返します。

     引数 'format'、'check'、'preset'、および 'filters' についての説明は
     上記の *note LZMACompressor: 1b2c. を参照してください。

 -- の関数: lzma.decompress (data, format=FORMAT_AUTO, memlimit=None,
          filters=None)

     'data' (*note bytes: 193. オブジェクト) を展開し、展開データを
     ‘bytes’ オブジェクトとして返します。

     'data' が複数の明確な圧縮ストリームの連結だった場合、すべてのストリ
     ームを展開し、結果の連結を返します。

     引数 'format'、'memlimit'、および 'filters' の説明は、上記 *note
     LZMADecompressor: 17ae. を参照してください。


File: python.info,  Node: その他<4>,  Next: カスタムフィルタチェインの指定,  Prev: メモリ上での圧縮と展開<2>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.14.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.14.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.14.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.14.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: 21b4. such
as *note zlib: 13a, *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
オプションのモジュールの要件: 21b2.

このモジュールは以下の項目を定義しています:

 -- 例外: zipfile.BadZipFile

     正常ではない ZIP ファイルに対して送出されるエラーです。

     Added in version 3.2.

 -- 例外: zipfile.BadZipfile

     *note BadZipFile: 1bc7. の別名です。過去のバージョンの Python との
     互換性のために用意されています。

     バージョン 3.2 で非推奨.

 -- 例外: zipfile.LargeZipFile

     ZIP ファイルが ZIP64 の機能を必要としているが、その機能が有効化され
     ていない場合に送出されるエラーです。

 -- クラス: zipfile.ZipFile

     ZIP ファイルの読み書きのためのクラスです。コンストラクタの詳細につ
     いては、*note ZipFile objects: 2f10. 節を参照してください。

 -- クラス: zipfile.Path

     *note pathlib.Path: 268. インターフェースの一部を実装したクラスです
     。 *note importlib.resources.abc.Traversable: 2fc. インターフェース
     は完全に実装しています。

     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(): 2f11.
     and *note infolist(): 2f12. methods of *note ZipFile: 8d4. 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: 2f13.

     バージョン 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(): 2ce.

          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: 13a. モ
     ジュールが必要です。

 -- データ: 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.14.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:
     1225. が発生します。 '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: 2f14, *note ZIP_DEFLATED:
     2f15, *note ZIP_BZIP2: 2f16, *note ZIP_LZMA: 2f17, or *note
     ZIP_ZSTANDARD: 2f18.; unrecognized values will cause *note
     NotImplementedError: 369. to be raised.  If ‘ZIP_DEFLATED’,
     ‘ZIP_BZIP2’, ‘ZIP_LZMA’, or ‘ZIP_ZSTANDARD’ is specified but the
     corresponding module (*note zlib: 13a, *note bz2: 14, *note lzma:
     8e, or *note compression.zstd: 23.) is not available, *note
     RuntimeError: 246. is raised.  The default is ‘ZIP_STORED’.

     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:
     2f14. or *note ZIP_LZMA: 2f17. it has no effect.  When using *note
     ZIP_DEFLATED: 2f15. integers ‘0’ through ‘9’ are accepted (see
     *note zlib: 2eae. for more information).  When using *note
     ZIP_BZIP2: 2f16. integers ‘1’ through ‘9’ are accepted (see *note
     bz2: a6a. for more information).  When using *note ZIP_ZSTANDARD:
     2f18. integers ‘-131072’ through ‘22’ are commonly accepted (see
     *note CompressionParameter.compression_level: 2e6c. 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 クローズ: 2f1a. された
     場合、空のアーカイブのための適切な ZIP 構造がファイルに書き込まれま
     す。

     ZipFile はコンテキストマネージャにもなっているので、*note with:
     187. 文をサポートしています。次の例では、'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: 8d4. をコンテキストマネージャ
     として使用できるようになりました。

     バージョン 3.3 で変更: *note bzip2: 14. および *note lzma: 8e. 圧縮
     をサポートしました。

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     バージョン 3.5 で変更: seek 出来ないストリームのサポートが追加され
     ました。‘'x'’ モードのサポートが追加されました。

     バージョン 3.6 で変更: Previously, a plain *note RuntimeError: 246.
     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(): 2f1a. はプログラ
     ムを終了する前に必ず呼び出さなければなりません。さもないとアーカイ
     ブ上の重要なレコードが書き込まれません。

 -- メソッド: ZipFile.getinfo (name)

     アーカイブメンバ 'name' に関する情報を持つ *note ZipInfo: 2cd. オブ
     ジェクトを返します。アーカイブに含まれないファイル名に対して *note
     getinfo(): 2f11. を呼び出すと、*note KeyError: 5e7. が送出されます
     。

 -- メソッド: ZipFile.infolist ()

     アーカイブに含まれる各メンバの *note ZipInfo: 2cd. オブジェクトから
     なるリストを返します。既存のアーカイブファイルを開いている場合、リ
     ストの順番は実際の 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: 2cd. 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: 193. object.

     *note open(): 65d. はコンテキストマネージャでもあるので *note with:
     187. 文をサポートしています:

          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(): 1544, *note
     readline(): 1545, *note readlines(): 2819, *note seek(): 14a8,
     *note tell(): 15ca, *note __iter__(): 2105, *note __next__(): 14e9.
     These objects can operate independently of the ZipFile.

     With ‘mode='w'’, a writable file handle is returned, which supports
     the *note write(): edb. method.  While a writable file handle is
     open, attempting to read or write other files in the ZIP file will
     raise a *note ValueError: 2ee.

     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: 2cd. object with *note
     file_size: 2f1c. set, and use that as the 'name' parameter.

          注釈: *note open(): 65d.、*note read(): 2f1d.、および *note
          extract(): 2f1e. メソッドには、ファイル名または *note ZipInfo:
          2cd. オブジェクトを指定できます。これは重複する名前のメンバを
          含む ZIP ファイルを読み込むときにそのメリットを享受できるでし
          ょう。

     バージョン 3.6 で変更: Removed support of ‘mode='U'’.  Use *note
     io.TextIOWrapper: 9c2. for reading compressed text files in *note
     universal newlines: f39. mode.

     バージョン 3.6 で変更: ‘ZipFile.open()’ can now be used to write
     files into the archive with the ‘mode='w'’ option.

     バージョン 3.6 で変更: Calling ‘open()’ on a closed ZipFile will
     raise a *note ValueError: 2ee.  Previously, a *note RuntimeError:
     246. 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: 2cd. 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 ‘ZipInfo’ object.  'pwd' is the password used
     for encrypted files as a *note bytes: 193. 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(): 2f1e. on a closed
     ZipFile will raise a *note ValueError: 2ee.  Previously, a *note
     RuntimeError: 246. 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(): 2f1b.  'pwd' is the password used for encrypted
     files as a *note bytes: 193. object.

          警告: Never extract archives from untrusted sources without
          prior inspection.  It is possible that files are created
          outside of 'path', for example, members that have absolute
          filenames or filenames with ".."  components.  This module
          attempts to prevent that.  See *note extract(): 2f1e. note.

     バージョン 3.6 で変更: Calling *note extractall(): 2f1f. on a
     closed ZipFile will raise a *note ValueError: 2ee.  Previously, a
     *note RuntimeError: 246. was raised.

     バージョン 3.6.2 で変更: 'path' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- メソッド: ZipFile.printdir ()

     アーカイブの内容の一覧を ‘sys.stdout’ に出力します。

 -- メソッド: ZipFile.setpassword (pwd)

     Set 'pwd' (a *note bytes: 193. 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: 2cd. object.
     The archive must be open for read or append.  'pwd' is the password
     used for encrypted files as a *note bytes: 193. object and, if
     specified, overrides the default password set with *note
     setpassword(): 2f21.  Calling ‘read()’ on a ZipFile that uses a
     compression method other than *note ZIP_STORED: 2f14, *note
     ZIP_DEFLATED: 2f15, *note ZIP_BZIP2: 2f16, *note ZIP_LZMA: 2f17, or
     *note ZIP_ZSTANDARD: 2f18. will raise a *note NotImplementedError:
     369.  An error will also be raised if the corresponding compression
     module is not available.

     バージョン 3.6 で変更: Calling ‘read()’ on a closed ZipFile will
     raise a *note ValueError: 2ee.  Previously, a *note RuntimeError:
     246. 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 ‘testzip()’ on a closed ZipFile will
     raise a *note ValueError: 2ee.  Previously, a *note RuntimeError:
     246. 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 ‘write()’ on a ZipFile created with
     mode ‘'r'’ or a closed ZipFile will raise a *note ValueError: 2ee.
     Previously, a *note RuntimeError: 246. 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: 16a. or a *note bytes: 193. instance; if it
     is a ‘str’, 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: 2cd. 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: 2cd. instance).
     Similarly, 'compresslevel' will override the constructor if given.

          注釈: *note ZipInfo: 2cd. インスタンスを引数
          'zinfo_or_arcname' として与えた場合、与えられた ‘ZipInfo’ イン
          スタンスのメンバーである 'compress_type' で指定された圧縮方法
          が使われます。デフォルトでは、‘ZipInfo’ コンストラクターが、こ
          のメンバーを *note ZIP_STORED: 2f14. に設定します。

     バージョン 3.2 で変更: 引数 'compress_type' を追加しました。

     バージョン 3.6 で変更: Calling ‘writestr()’ on a ZipFile created
     with mode ‘'r'’ or a closed ZipFile will raise a *note ValueError:
     2ee.  Previously, a *note RuntimeError: 246. was raised.

     バージョン 3.14 で変更: Now respects the ‘SOURCE_DATE_EPOCH’
     environment variable.  If set, it uses this value as the
     modification timestamp for the file written into the ZIP archive,
     instead of using the current time.

 -- メソッド: 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: 2cd. 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: 193. オブジェクトとして関連付けられたコ
     メントです。モード ‘'w'’ 、 ‘'x'’ または ‘'a'’ で作成された *note
     ZipFile: 8d4. インスタンスへコメントを割り当てる場合、文字列長は
     65535 バイトまでにしてください。その長さを超えたコメントは切り捨て
     られます。


File: python.info,  Node: Path objects,  Next: PyZipFile objects,  Prev: ZipFile objects,  Up: zipfile --- ZIP アーカイブの処理

5.14.7.2 Path objects
.....................

 -- クラス: zipfile.Path (root, at='')

     Construct a Path object from a ‘root’ zipfile (which may be a *note
     ZipFile: 8d4. instance or ‘file’ suitable for passing to the
     ‘ZipFile’ 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 ‘Path’ class does not sanitize filenames within the
          ZIP archive.  Unlike the *note ZipFile.extract(): 2f1e. and
          *note ZipFile.extractall(): 2f1f. methods, it is the caller's
          responsibility to validate or sanitize filenames to prevent
          path traversal vulnerabilities (for example, absolute paths or
          paths with ".."  components).  When handling untrusted
          archives, consider resolving filenames using *note
          os.path.abspath(): 1536. and checking against the target
          directory with *note os.path.commonpath(): 1041.

Path objects expose the following features of *note pathlib.Path: 268.
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: 9c2. when opened as text and
     ignored otherwise.  ‘pwd’ is the ‘pwd’ parameter to
     ‘ZipFile.open()’.

     バージョン 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: 199.
     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: 9c2.
     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 ‘Path.suffix’ property.

 -- データ: Path.stem

     The final path component, without its suffix.

     Added in version 3.11: Added ‘Path.stem’ property.

 -- データ: Path.suffixes

     A list of the path’s suffixes, commonly called file extensions.

     Added in version 3.11: Added ‘Path.suffixes’ property.

 -- メソッド: Path.read_text (*, **)

     Read the current file as unicode text.  Positional and keyword
     arguments are passed through to *note io.TextIOWrapper: 9c2.
     (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: 199.
     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: 9c2.
     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.14.7.3 PyZipFile objects
..........................

*note PyZipFile: 11fe. コンストラクタは *note ZipFile: 8d4. コンストラク
タと同じパラメータに加え、'optimize' パラメータをとります。

 -- クラス: zipfile.PyZipFile (file, mode='r', compression=ZIP_STORED,
          allowZip64=True, optimize=-1)

     バージョン 3.2 で変更: Added the 'optimize' parameter.

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     インスタンスは *note ZipFile: 8d4. オブジェクトのメソッドの他に、追
     加のメソッドを 1 個持ちます:

      -- メソッド: writepy (pathname, basename='', filterfunc=None)

          ‘*.py’ ファイルを探し、一致するファイルをアーカイブに追加しま
          す。

          *note PyZipFile: 11fe. に 'optimize' 引数が与えられない場合、
          あるいは ‘-1’ が指定された場合、対応するファイルは ‘*.pyc’ フ
          ァイルで、必要に応じてコンパイルします。

          *note PyZipFile: 11fe. の '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: 246. 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(): 11ff. メソッドは以下のようなファイル名でアー
          カイブを作成します:

               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.14.7.4 ZipInfo objects
........................

*note ZipInfo: 2cd. クラスのインスタンスは、*note ZipFile: 8d4. オブジェ
クトの *note getinfo(): 2f11. および *note infolist(): 2f12. メソッドに
よって返されます。各オブジェクトは ZIP アーカイブ内の 1 個のメンバに関す
る情報を格納します。

There is one classmethod to make a *note ZipInfo: 2cd. instance for a
filesystem file:

 -- メソッド: classmethod ZipInfo.from_file (filename, arcname=None, *,
          strict_timestamps=True)

     Construct a *note ZipInfo: 2cd. 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: 193.
     object.

 -- の属性: ZipInfo.extra

     拡張フィールドデータ。この *note bytes: 193. オブジェクトに含まれて
     いるデータの内部構成については、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.14.7.5 コマンドライン・インターフェース
.........................................

The ‘zipfile’ module provides a simple command-line interface to
interact with ZIP archives.

ZIP アーカイブを新規に作成したい場合、*note -c: 2f45. オプションの後にま
とめたいファイルを列挙してください:

     $ python -m zipfile -c monty.zip spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m zipfile -c monty.zip life-of-brian_1979/

ZIP アーカイブを特定のディレクトリに展開したい場合、*note -e: 2f46. オプ
ションを使用してください:

     $ python -m zipfile -e monty.zip target-dir/

ZIP アーカイブ内のファイル一覧を表示するには *note -l: 2f47. を使用して
ください:

     $ python -m zipfile -l monty.zip

* Menu:

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


File: python.info,  Node: コマンドラインオプション<2>,  Up: コマンドライン・インターフェース<4>

5.14.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: 2f47, *note -e:
     2f46. and *note -t: 2f4c.

     Added in version 3.11.


File: python.info,  Node: Decompression pitfalls,  Prev: コマンドライン・インターフェース<4>,  Up: zipfile --- ZIP アーカイブの処理

5.14.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.14.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.14.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.14.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.14.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.14.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.14.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: 138. module to read or write ‘.zip’ files, or the higher-level
functions in *note shutil: 1435.

いくつかの事実と形態:

   * モジュールが利用可能な場合、*note gzip: 6b.、*note bz2: 14.、*note
     compression.zstd: 23. ならびに *note lzma: 8e. で圧縮されたアーカイ
     ブを読み書きします。

     If any of these *note optional modules: 21b4. 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 オプションのモジュールの要件: 21b2.

   * 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:
29c, 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: 2f59.

バージョン 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: 142d. オブジェクトを返します。
     ‘TarFile’ オブジェクトと、利用できるキーワード引数に関する詳細な情
     報については、*note TarFile オブジェクト: 2f5a. 節を参照してくださ
     い。

     '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: 1225. 例外を送出します。
                            
                            
     ‘'x:gz'’               gzip 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1225. 例外を送
                            出します。
                            
                            
     ‘'x:bz2'’              bzip2 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1225. 例外を送
                            出します。
                            
                            
     ‘'x:xz'’               lzma 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1225. 例外を送
                            出します。
                            
                            
     ‘'x:zst'’              Zstandard 圧縮で tarfile を作成します。tarfile
                            が既存の場合 *note FileExistsError: 1225. 例外
                            を送出します。
                            
                            
     ‘'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: 1cac. が送出されます。これを
     防ぐには 'mode' ‘'r'’ を使って下さい。もし圧縮方式がサポートされて
     いなければ、*note CompressionError: 2f5b. が送出されます。

     もし 'fileobj' が指定されていれば、それは 'name' でバイナリモードで
     オープンされた *note ファイルオブジェクト: 13df. の代替として使うこ
     とができます。そのファイルオブジェクトの位置が 0 であることを前提に
     動作します。

     For modes ‘'w:gz'’, ‘'x:gz'’, ‘'w|gz'’, ‘'w:bz2'’, ‘'x:bz2'’,
     ‘'w|bz2'’, ‘tarfile.open()’ accepts the keyword argument
     'compresslevel' (default ‘9’) to specify the compression level of
     the file.

     ‘'w:xz'’、‘'x:xz'’ および ‘'w|xz'’ モードの場合、*note
     tarfile.open(): 107b. はファイルの圧縮レベルを指定するキーワード引
     数 'preset' を受け付けます。

     For modes ‘'w:zst'’, ‘'x:zst'’ and ‘'w|zst'’, ‘tarfile.open()’
     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: 2e60.  The keyword
     argument 'zstd_dict' can be passed to provide a *note ZstdDict:
     2e5f, a Zstandard dictionary used to improve compression of smaller
     amounts of data.

     For special purposes, there is a second format for 'mode':
     ‘'filemode|[compression]'’.  ‘tarfile.open()’ will return a *note
     TarFile: 142d. 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(): 1021. or *note
     write(): 15c9. 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: 13df. or a tape
     device.  However, such a ‘TarFile’ object is limited in that it
     does not allow random access, see *note 使用例: 2f5c.  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(): 107b. を使ってください。
     *note TarFile オブジェクト: 2f5a. を参照してください。

 -- の関数: tarfile.is_tarfile (name)

     Return *note True: e0b. if 'name' is a tar archive file, that the
     ‘tarfile’ module can read.  'name' may be a *note str: 16a, 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: 142d. オブジェクトで典型的な制限
     のために送出されます。

 -- 例外: tarfile.ExtractError

     *note TarFile.extract(): 29e. を使った時に '致命的でない' エラーに
     対して送出されます。ただし *note TarFile.errorlevel: 2a0.‘== 2’ の
     場合に限ります。

 -- 例外: tarfile.HeaderError

     *note TarInfo.frombuf(): 2f61. メソッドが取得したバッファーが不正だ
     ったときに送出されます。

 -- 例外: tarfile.FilterError

     Base class for members *note refused: 2f63. by filters.

      -- の属性: tarinfo

          Information about the member that the filter refused to
          extract, as *note TarInfo: 2f65.

 -- 例外: 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(): e57. の返り値です。

 -- データ: tarfile.REGTYPE
 -- データ: tarfile.AREGTYPE

     A regular file *note type: 2f6e.

 -- データ: tarfile.LNKTYPE

     A link (inside tarfile) *note type: 2f6e.

 -- データ: tarfile.SYMTYPE

     A symbolic link *note type: 2f6e.

 -- データ: tarfile.CHRTYPE

     A character special device *note type: 2f6e.

 -- データ: tarfile.BLKTYPE

     A block special device *note type: 2f6e.

 -- データ: tarfile.DIRTYPE

     A directory *note type: 2f6e.

 -- データ: tarfile.FIFOTYPE

     A FIFO special device *note type: 2f6e.

 -- データ: tarfile.CONTTYPE

     A contiguous file *note type: 2f6e.

 -- データ: tarfile.GNUTYPE_LONGNAME

     A GNU tar longname *note type: 2f6e.

 -- データ: tarfile.GNUTYPE_LONGLINK

     A GNU tar longlink *note type: 2f6e.

 -- データ: tarfile.GNUTYPE_SPARSE

     A GNU tar sparse file *note type: 2f6e.

Each of the following constants defines a tar archive format that the
‘tarfile’ module is able to create.  See section *note サポートしている
tar フォーマット: 2f79. 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: 2f7c. です。

     バージョン 3.8 で変更: 新しいアーカイブのデフォルトフォーマットが
     *note GNU_FORMAT: 2f7b. から *note PAX_FORMAT: 2f7c. に変更されまし
     た。

参考
....

*note zipfile: 138. モジュール

     *note zipfile: 138. 標準モジュールのドキュメント。

*note アーカイブ化操作: 1435.

     *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.14.8.1 TarFile オブジェクト
.............................

*note TarFile: 142d. オブジェクトは、tar アーカイブへのインターフェース
を提供します。tar アーカイブは一連のブロックです。アーカイブメンバー (保
存されたファイル) は、ヘッダーブロックとそれに続くデータブロックで構成さ
れています。一つの tar アーカイブにファイルを何回も保存することができま
す。各アーカイブメンバーは、*note TarInfo: 142e. オブジェクトで確認でき
ます。詳細については *note TarInfo オブジェクト: 2f65. を参照してくださ
い。

*note TarFile: 142d. オブジェクトは *note with: 187. 文のコンテキストマ
ネージャーとして利用できます。with ブロックが終了したときにオブジェクト
はクローズされます。例外が発生した時、内部で利用されているファイルオブジ
ェクトのみがクローズされ、書き込み用にオープンされたアーカイブのファイナ
ライズは行われないことに注意してください。*note 使用例: 2f5c. 節のユース
ケースを参照してください。

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: 142d. をクローズした時、'fileobj' はクロ
          ーズされません。

     'format' はアーカイブの書き込みフォーマットを制御します。モジュール
     レベルで定義されている、*note USTAR_FORMAT: 2f7a.、*note
     GNU_FORMAT: 2f7b.、あるいは *note PAX_FORMAT: 2f7c. のいずれかであ
     る必要があります。 読み出しのときは、1 つのアーカイブに異なるフォー
     マットが混在していたとしても、フォーマットは自動的に検知されます。

     'tarinfo' 引数を利用して、デフォルトの *note TarInfo: 142e. クラス
     を別のクラスで置き換えることができます。

     'dereference' が *note False: d2f. だった場合、シンボリックリンクや
     ハードリンクがアーカイブに追加されます。*note True: e0b. だった場合
     、リンクのターゲットとなるファイルの内容がアーカイブに追加されます
     。シンボリックリンクをサポートしていないシステムでは効果がありませ
     ん。

     'ignore_zeros' が *note False: d2f. だった場合、空ブロックをアーカ
     イブの終端として扱います。*note True: e0b. だった場合、空の (無効な
     ) ブロックをスキップして、可能な限り多くのメンバーを取得しようとし
     ます。このオプションは、連結されたり、壊れたアーカイブファイルを扱
     うときにのみ、意味があります。

     'debug' は ‘0’ (デバッグメッセージ無し) から ‘3’ (全デバッグメッセ
     ージ) まで設定できます。このメッセージは ‘sys.stderr’ に書き込まれ
     ます。

     'errorlevel' controls how extraction errors are handled, see *note
     the corresponding attribute: 2a0.

     引数 'encoding' および 'errors' にはアーカイブの読み書きやエラー文
     字列の変換に使用する文字エンコーディングを指定します。ほとんどのユ
     ーザーはデフォルト設定のままで動作します。詳細に関しては *note
     Unicode に関する問題: 2f7f. 節を参照してください。

     引数 'pax_headers' は、オプションの文字列辞書で、'format' が *note
     PAX_FORMAT: 2f7c. だった場合に pax グローバルヘッダーに追加されます
     。

     If 'stream' is set to *note True: e0b. 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(): 107b. 関数は、実際はこのクラスメソッドへのショート
     カットです。

 -- メソッド: TarFile.getmember (name)

     メンバー 'name' に対する *note TarInfo: 142e. オブジェクトを返しま
     す。'name' がアーカイブに見つからなければ、*note KeyError: 5e7. が
     送出されます。

          注釈: アーカイブ内にメンバーが複数ある場合は、最後に出現するも
          のが最新のバージョンとみなされます。

 -- メソッド: TarFile.getmembers ()

     *note TarInfo: 142e. アーカイブのメンバーをオブジェクトのリストとし
     て返します。このリストはアーカイブ内のメンバーと同じ順番です。

 -- メソッド: TarFile.getnames ()

     メンバーをその名前のリストを返します。これは *note getmembers():
     107d. で返されるリストと同じ順番です。

 -- メソッド: TarFile.list (verbose=True, *, members=None)

     内容の一覧を ‘sys.stdout’ に出力します。'verbose' が *note False:
     d2f. の場合、メンバー名のみ表示します。*note True: e0b. の場合、
     ‘ls -l’ に似た出力を生成します。オプションの 'members' を与える場合
     、 *note getmembers(): 107d. が返すリストのサブセットである必要があ
     ります。

     バージョン 3.5 で変更: 'members' 引数が追加されました。.

 -- メソッド: TarFile.next ()

     *note TarFile: 142d. が読み込み用にオープンされている時、アーカイブ
     の次のメンバーを *note TarInfo: 142e. オブジェクトとして返します。
     もしそれ以上利用可能なものがなければ、*note None: 886. を返します。

 -- メソッド: TarFile.extractall (path='.', members=None, *,
          numeric_owner=False, filter=None)

     すべてのメンバーをアーカイブから現在の作業ディレクトリまたは 'path'
     に抽出します。オプションの 'members' が与えられるときには、*note
     getmembers(): 107d. で返されるリストの一部でなければなりません。所
     有者、変更時刻、アクセス権限のようなディレクトリ情報はすべてのメン
     バーが抽出された後にセットされます。これは二つの問題を回避するため
     です。一つはディレクトリの変更時刻はその中にファイルが作成されるた
     びにリセットされるということ、もう一つはディレクトリに書き込み許可
     がなければその中のファイル抽出は失敗してしまうということです。

     'numeric_owner' が *note True: e0b. の場合、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: 29c.) 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: 142e. オブジェクトです。 'path' を
     使って別のディレクトリを指定することもできます。 'path' は　*note
     path-like object: 5a1. でも構いません。'set_attrs' が false でない
     限り、ファイルの属性 (所有者、最終更新時刻、モード) は設定されます
     。

     The 'numeric_owner' and 'filter' arguments are the same as for
     *note extractall(): 29d.

          注釈: *note extract(): 29e. メソッドはいくつかの展開に関する問
          題を扱いません。ほとんどの場合、*note extractall(): 29d. メソ
          ッドの利用を考慮するべきです。

          警告: Never extract archives from untrusted sources without
          prior inspection.  See the warning for *note extractall():
          29d. 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: 142e. オブジェクトでも構い
     ません。'member' が一般ファイルまたはリンクの場合、*note
     io.BufferedReader: 142b. オブジェクトが返されます。 存在するそれ以
     外のメンバーでは、 *note None: 886. が返されます。 それ以外の場合、
     ‘None’ が返されます。 アーカイブに 'member' が存在しない場合は
     *note KeyError: 5e7. が送出されます。

     バージョン 3.3 で変更: 戻り値が *note io.BufferedReader: 142b. オブ
     ジェクトになりました。

     バージョン 3.13 で変更: The returned *note io.BufferedReader: 142b.
     object has the ‘mode’ attribute which is always equal to ‘'rb'’.

 -- の属性: TarFile.errorlevel: *note int: 19c.

     If 'errorlevel' is ‘0’, errors are ignored when using *note
     TarFile.extract(): 29e. and *note TarFile.extractall(): 29d.
     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: 2c2. or *note FilterError:
     2f62. exceptions.  If ‘2’, all 'non-fatal' errors are raised as
     *note TarError: 2f5d. 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: 2f62. for 'fatal' errors and *note ExtractError: 2f5f.
     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(): 29e. and *note extractall():
     29d.

     The attribute may be ‘None’ or a callable.  String names are not
     allowed for this attribute, unlike the 'filter' argument to *note
     extract(): 29e.

     If ‘extraction_filter’ is ‘None’ (the default), extraction methods
     will use the *note data: 29c. 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(): 451.
     to prevent injection of a ‘self’ argument.

     バージョン 3.14 で変更: The default filter is set to *note data:
     29c, 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: 2f59.

 -- メソッド: TarFile.add (name, arcname=None, recursive=True, *,
          filter=None)

     ファイル 'name' をアーカイブに追加します。 'name' は、任意のファイ
     ルタイプ (ディレクトリ、fifo、シンボリックリンク等)です。 'arcname'
     が与えられている場合は、それはアーカイブ内のファイルの代替名を指定
     します。 デフォルトではディレクトリは再帰的に追加されます。 これは
     、 'recursive' を *note False: d2f. に設定すると避けられます。 再帰
     処理はソートされた順序でエントリーを追加します。 'filter' が与えら
     れた場合、それは *note TarInfo: 142e. オブジェクトを引数として受け
     取り、操作した ‘TarInfo’ オブジェクトを返す関数でなければなりません
     。 代わりに *note None: 886. を返した場合、 ‘TarInfo’ オブジェクト
     はアーカイブから除外されます。 *note 使用例: 2f5c. にある例を参照し
     てください。

     バージョン 3.2 で変更: 'filter' パラメータが追加されました。

     バージョン 3.7 で変更: 再帰処理はソートされた順序でエントリーを追加
     するようになりました。

 -- メソッド: TarFile.addfile (tarinfo, fileobj=None)

     Add the *note TarInfo: 142e. object 'tarinfo' to the archive.  If
     'tarinfo' represents a non zero-size regular file, the 'fileobj'
     argument should be a *note binary file: 20ca, and ‘tarinfo.size’
     bytes are read from it and added to the archive.  You can create
     ‘TarInfo’ objects directly, or by using *note gettarinfo(): 2f84.

     バージョン 3.13 で変更: 'fileobj' must be given for non-zero-sized
     regular files.

 -- メソッド: TarFile.gettarinfo (name=None, arcname=None, fileobj=None)

     *note os.stat(): 26f. の結果か、既存のファイルに相当するものから、
     *note TarInfo: 142e. オブジェクトを作成します。このファイルは、
     'name' で名付けられるか、ファイル記述子を持つ *note file object:
     13df. 'fileobj' として指定されます。'name' は *note path-like
     object: 5a1. でも構いません。 'arcname' が与えられた場合、アーカイ
     ブ内のファイルに対して代替名を指定します。与えられない場合、名前は
     'fileobj' の *note name: 2e6a. 属性 'name' 属性から取られます。名前
     はテキスト文字列にしてください。

     *note TarInfo: 142e. の属性の一部は、*note addfile(): 1a05. を使用
     して追加する前に修正できます。ファイルオブジェクトが、ファイルの先
     頭にある通常のファイルオブジェクトでない場合、 *note size: 2f85. な
     どの属性は修正が必要かもしれません。これは、 *note GzipFile: 65c. な
     どの属性に当てはまります。*note name: 2f86. も修正できるかもしれず
     、この場合、'arcname' はダミーの文字列にすることができます。

     バージョン 3.6 で変更: 'name' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- メソッド: TarFile.close ()

     *note TarFile: 142d. をクローズします。書き込みモードでは、完了ゼロ
     ブロックが 2 個アーカイブに追加されます。

 -- の属性: TarFile.pax_headers: *note dict: 184.

     pax グローバルヘッダーに含まれる key-value ペアの辞書です。


File: python.info,  Node: TarInfo オブジェクト,  Next: Extraction filters,  Prev: TarFile オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.14.8.2 TarInfo オブジェクト
.............................

*note TarInfo: 142e. オブジェクトは *note TarFile: 142d. の一つのメンバ
ーを表します。ファイルに必要なすべての属性 (ファイルタイプ、ファイルサイ
ズ、時刻、アクセス権限、所有者等のような) を保存する他に、そのタイプを決
定するのに役に立ついくつかのメソッドを提供します。これにはファイルのデー
タそのものは '含まれません' 。

*note TarInfo: 142e. objects are returned by *note TarFile: 142d.'s
methods *note getmember(): 1c4d, *note getmembers(): 107d. and *note
gettarinfo(): 2f84.

Modifying the objects returned by *note getmember(): 1c4d. or *note
getmembers(): 107d. 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(): 2f8a. 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: 142e. methods
handle ‘None’ differently:

   - The *note extract(): 29e. or *note extractall(): 29d. methods will
     ignore the corresponding metadata, leaving it set to a default.

   - *note addfile(): 1a05. will fail.

   - *note list(): 107c. will print a placeholder string.

 -- クラス: tarfile.TarInfo (name='')

     *note TarInfo: 142e. オブジェクトを作成します。

 -- メソッド: classmethod TarInfo.frombuf (buf, encoding, errors)

     *note TarInfo: 142e. オブジェクトを文字列バッファー 'buf' から作成
     して返します。

     バッファーが不正な場合 *note HeaderError: 2f60. を送出します。

 -- メソッド: classmethod TarInfo.fromtarfile (tarfile)

     *note TarFile: 142d. オブジェクトの 'tarfile' から、次のメンバーを
     読み込んで、それを *note TarInfo: 142e. オブジェクトとして返します
     。

 -- メソッド: TarInfo.tobuf (format=DEFAULT_FORMAT, encoding=ENCODING,
          errors='surrogateescape')

     *note TarInfo: 142e. オブジェクトから文字列バッファーを作成します。
     引数についての情報は、*note TarFile: 142d. クラスのコンストラクター
     を参照してください。

     バージョン 3.2 で変更: 引数 'errors' のデフォルトが
     ‘'surrogateescape'’ になりました。

‘TarInfo’ オブジェクトには以下のデータ属性があります:

 -- の属性: TarInfo.name: *note str: 16a.

     アーカイブメンバーの名前。

 -- の属性: TarInfo.size: *note int: 19c.

     バイト単位でのサイズ。

 -- の属性: TarInfo.mtime: *note int: 19c. | *note float: 197.

     Time of last modification in seconds since the *note epoch: 2f8e,
     as in *note os.stat_result.st_mtime: 2f8f.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.mode: *note int: 19c.

     Permission bits, as for *note os.chmod(): 529.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.type

     ファイルタイプ。'type' は通常、定数 *note REGTYPE: 2f6c.、*note
     AREGTYPE: 2f6d.、*note LNKTYPE: 2f6f.、*note SYMTYPE: 2f70.、*note
     DIRTYPE: 2f73.、*note FIFOTYPE: 2f74.、*note CONTTYPE: 2f75.、*note
     CHRTYPE: 2f71.、*note BLKTYPE: 2f72.、あるいは *note
     GNUTYPE_SPARSE: 2f78. のいずれかです。*note TarInfo: 142e. オブジェ
     クトのタイプをもっと簡単に解決するには、下記の ‘is*()’ メソッドを使
     って下さい。

 -- の属性: TarInfo.linkname: *note str: 16a.

     リンク先ファイルの名前。これはタイプ *note LNKTYPE: 2f6f. と *note
     SYMTYPE: 2f70. の *note TarInfo: 142e. オブジェクトにだけ存在します
     。

     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: 19c.

     ファイルメンバーを保存した元のユーザーのユーザー ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gid: *note int: 19c.

     ファイルメンバーを保存した元のユーザーのグループ ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.uname: *note str: 16a.

     ファイルメンバーを保存した元のユーザーのユーザー名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gname: *note str: 16a.

     ファイルメンバーを保存した元のユーザーのグループ名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29e. and *note extractall(): 29d, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.chksum: *note int: 19c.

     Header checksum.

 -- の属性: TarInfo.devmajor: *note int: 19c.

     Device major number.

 -- の属性: TarInfo.devminor: *note int: 19c.

     Device minor number.

 -- の属性: TarInfo.offset: *note int: 19c.

     The tar header starts here.

 -- の属性: TarInfo.offset_data: *note int: 19c.

     The file's data starts here.

 -- の属性: TarInfo.sparse

     Sparse member information.

 -- の属性: TarInfo.pax_headers: *note dict: 184.

     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: 142e. オブジェクトは便利な照会用のメソッドもいくつか提供
しています:

 -- メソッド: TarInfo.isfile ()

     Return *note True: e0b. if the *note TarInfo: 142e. object is a
     regular file.

 -- メソッド: TarInfo.isreg ()

     *note isfile(): 2f9d. と同じです。

 -- メソッド: TarInfo.isdir ()

     ディレクトリの場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.issym ()

     シンボリックリンクの場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.islnk ()

     ハードリンクの場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.ischr ()

     キャラクターデバイスの場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.isblk ()

     ブロックデバイスの場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.isfifo ()

     FIFO の場合に *note True: e0b. を返します。

 -- メソッド: TarInfo.isdev ()

     キャラクターデバイス、ブロックデバイスあるいは FIFO のいずれかの場
     合に *note True: e0b. を返します。


File: python.info,  Node: Extraction filters,  Next: コマンドラインインターフェイス,  Prev: TarInfo オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.14.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:
     2d70.

参考
....

PEP 706(1)

     Contains further motivation and rationale behind the design.

The 'filter' argument to *note TarFile.extract(): 29e. or *note
extractall(): 29d. 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():
     2fa7. 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(): 29c. for details.

   * ‘None’ (default): Use *note TarFile.extraction_filter: 2f83.

     If that is also ‘None’ (the default), the ‘'data'’ filter will be
     used.

          バージョン 3.14 で変更: The default filter is set to *note
          data: 29c.  Previously, the default was equivalent to *note
          fully_trusted: 2f59.

   * A callable which will be called for each extracted member with a
     *note TarInfo: 2f65. 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: 142e. 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: 2a0.  Note that when extraction
          is aborted, *note extractall(): 29d. 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.14.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: 87b.) from
          filenames.

        - *note Refuse: 2f63. 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:
          2f66.

        - *note Refuse: 2f63. to extract files whose absolute path
          (after following symlinks) would end up outside the
          destination.  This raises *note OutsideDestinationError: 2f67.

        - Clear high mode bits (setuid, setgid, sticky) and group/other
          write bits (*note S_IWGRP: 2cfc. | *note S_IWOTH: 2cff.).

     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: 2f91.) using
          *note os.path.normpath(): 1535.  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: 2f63. to extract links (hard or soft) that link
          to absolute paths, or ones that link outside the destination.

          This raises *note AbsoluteLinkError: 2f69. or *note
          LinkOutsideDestinationError: 2f6a.

          Note that such files are refused even on platforms that do not
          support symbolic links.

        - *note Refuse: 2f63. to extract device files (including pipes).
          This raises *note SpecialFileError: 2f68.

        - For regular files, including hard links:

             - Set the owner read and write permissions (*note S_IRUSR:
               2cf7. | *note S_IWUSR: 2cf8.).

             - Remove the group & other executable permission (*note
               S_IXGRP: 2cf3. | *note S_IXOTH: 2d00.) if the owner
               doesn’t have it (*note S_IXUSR: 2cf9.).

        - 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: 2d70. 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.14.8.5 Filter errors
......................

When a filter refuses to extract a file, it will raise an appropriate
exception, a subclass of *note FilterError: 2f62.  This will abort the
extraction if *note TarFile.errorlevel: 2a0. 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.14.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.14.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.14.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.14.8.9 コマンドラインインターフェイス
.......................................

Added in version 3.4.

The ‘tarfile’ module provides a simple command-line interface to
interact with tar archives.

tar アーカイブを新規に作成したい場合、*note -c: 2fae. オプションの後にま
とめたいファイル名のリストを指定してください:

     $ python -m tarfile -c monty.tar  spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m tarfile -c monty.tar life-of-brian_1979/

tar アーカイブをカレントディレクトリに展開したい場合、*note -e: 2faf. オ
プションを使用してください:

     $ python -m tarfile -e monty.tar

ディレクトリ名を渡すことで tar アーカイブを別のディレクトリに取り出すこ
ともできます:

     $ python -m tarfile -e monty.tar  other-dir/

tar アーカイブ内のファイル一覧を表示するには *note -l: 2fb0. を使用して
ください:

     $ python -m tarfile -l monty.tar

* Menu:

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


File: python.info,  Node: コマンドラインオプション<3>,  Up: コマンドラインインターフェイス

5.14.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.14.8.11 使用例
................

* Menu:

* Reading examples::
* Writing examples::


File: python.info,  Node: Reading examples,  Next: Writing examples,  Up: 使用例<16>

5.14.8.12 Reading examples
..........................

tar アーカイブから現在のディレクトリにすべて抽出する方法:

     import tarfile
     tar = tarfile.open("sample.tar.gz")
     tar.extractall(filter='data')
     tar.close()

tar アーカイブの一部を、リストの代わりにジェネレーター関数を利用して
*note TarFile.extractall(): 29d. で展開する方法:

     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.14.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: 187. 文を利用した同じ例:

     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: cd1. in the 'fileobj' parameter in *note
TarFile.add(): df2.:

     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(): df2. 関数の '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.14.8.14 サポートしている tar フォーマット
...........................................

There are three tar formats that can be created with the ‘tarfile’
module:

   * POSIX.1-1988 ustar format (*note USTAR_FORMAT: 2f7a.).  ファイル名
     の長さは256文字までで、リンク名の長さは100文字までです。最大のファ
     イルサイズは8GiBです。このフォーマットは古くて制限が多いですが、広
     くサポートされています。

   * The GNU tar format (*note GNU_FORMAT: 2f7b.).  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: 2f7c.).  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.14.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: 142d.
class.

'encoding' はアーカイブのメタデータに使用する文字エンコーディングを指定
します。デフォルト値は *note sys.getfilesystemencoding(): e57. で、フォ
ールバックとして ‘'ascii'’ が使用されます。アーカイブの読み書き時に、メ
タデータはそれぞれデコードまたはエンコードしなければなりません。
'encoding' に適切な値が設定されていない場合、その変換は失敗することがあ
ります。

引数 'errors' は文字を変換できない時の扱いを指定します。指定できる値は
*note エラーハンドラ: 1bce. 節を参照してください。デフォルトのスキームは
‘'surrogateescape'’ で、Python はそのファイルシステムの呼び出しも使用し
ます。*note ファイル名、コマンドライン引数、および環境変数: 2fbf. を参照
してください。

デフォルトの *note PAX_FORMAT: 2f7c. アーカイブでは、メタデータはすべて
'UTF-8' で格納されるため、'encoding' は通常指定する必要はありません。
'encoding' は、まれにある、バイナリの pax ヘッダーがデコードされた場合、
あるいはサロゲート文字を含む文字列が格納されていた場合に使用されます。


File: python.info,  Node: ファイルフォーマット,  Next: 暗号関連のサービス,  Prev: データ圧縮とアーカイブ,  Up: Python 標準ライブラリ

5.15 ファイルフォーマット
=========================

この章で説明されるモジュールはマークアップや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.15.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: bdc. and *note DictWriter:
141b. classes.

参考
....

PEP 305(3) - CSV File API

     Python へのこのモジュールの追加を提案している Python 改良案 (PEP:
     Python Enhancement Proposal)。

* Menu:

* モジュールコンテンツ::
* 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: モジュールコンテンツ,  Next: Dialect クラスと書式化パラメータ,  Up: csv --- CSV ファイルの読み書き

5.15.1.1 モジュールコンテンツ
.............................

The ‘csv’ module defines the following functions:

 -- の関数: csv.reader (csvfile, /, dialect='excel', **fmtparams)

     Return a *note reader object: 2fc8. 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: 188d. class or one of
     the strings returned by the *note list_dialects(): 1bf2. 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 クラスと書式化パラメータ: 2fc9.

     csv ファイルから読み込まれた各行は、文字列のリストとして返されます
     。*note QUOTE_NONNUMERIC: 19a7. フォーマットオプションが指定された
     場合を除き、データ型の変換が自動的に行われることはありません (この
     オプションが指定された場合、クォートされていないフィールドは浮動小
     数点数に変換されます)。

     短い利用例:

          >>> 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

     where ‘eggs.csv’ contains:

          Spam Spam Spam Spam Spam |Baked Beans|
          Spam |Lovely Spam| |Wonderful Spam|

 -- の関数: csv.writer (csvfile, /, dialect='excel', **fmtparams)

     ユーザが与えたデータをデリミタで区切られた文字列に変換し、与えられ
     たファイルオブジェクトに書き込むための writer オブジェクトを返しま
     す。 'csvfile' は *note write(): 20b7. メソッドを持つ任意のオブジェ
     クトです。 'csvfile' がファイルオブジェクトの場合、 ‘newline=''’ と
     して開くべきです (2) 。オプションとして 'dialect' 引数を与えること
     ができ、利用するCSV表現形式(dialect)を指定することができます。
     'dialect' パラメータは *note Dialect: 188d. クラスのサブクラスのイ
     ンスタンスか、 *note list_dialects(): 1bf2. 関数が返す文字列の1つに
     することができます。別のオプション引数である 'fmtparams' キーワード
     引数は、現在の表現形式における個々の書式パラメータを上書きするため
     に与えることができます。dialect と書式パラメータについての詳細は、
     *note Dialect クラスと書式化パラメータ: 2fc9. 節を参照してください
     。 DB API を実装するモジュールとのインターフェースを可能な限り容易
     にするために、 *note None: 886. は空文字列として書き込まれます。こ
     の処理は可逆な変換ではありませんが、SQL で NULL データ値を CSV にダ
     ンプする処理を、 ‘cursor.fetch*’ 呼び出しによって返されたデータを前
     処理することなく簡単に行うことができます。他の非文字列データは、書
     き出される前に *note str(): 16a. を使って文字列に変換されます。

     短い利用例:

          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'])

     which writes ‘eggs.csv’ containing:

          Spam Spam Spam Spam Spam |Baked Beans|
          Spam |Lovely Spam| |Wonderful Spam|

 -- の関数: csv.register_dialect (name, /, dialect='excel', **fmtparams)

     'dialect' を 'name' と関連付けます。 'name' は文字列でなければなり
     ません。表現形式(dialect)は *note Dialect: 188d. のサブクラスを渡す
     か、またはキーワード引数 'fmtparams' 、もしくは両方で指定できますが
     、キーワード引数の方が優先されます。表現形式と書式化パラメータにつ
     いての詳細は、 *note Dialect クラスと書式化パラメータ: 2fc9. 節を参
     照してください。

 -- の関数: csv.unregister_dialect (name)

     'name' に関連づけられた表現形式を表現形式レジストリから削除します。
     'name' が表現形式名でない場合には *note Error: 2fca. を送出します。

 -- の関数: csv.get_dialect (name)

     'name' に関連づけられた表現形式を返します。 'name' が表現形式名でな
     い場合には *note Error: 2fca. を送出します。この関数は不変の *note
     Dialect: 188d. を返します。

 -- の関数: 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:
     184. にマップするオブジェクトを生成します。マップのキーは省略可能な
     '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: 24f. に
     変換されます。

     バージョン 3.6 で変更: 返される行の型は ‘OrderedDict’ になりました
     。

     バージョン 3.8 で変更: 返される行の型は *note dict: 184. になりまし
     た。

     短い利用例:

          >>> 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'}

     where ‘names.csv’ contains:

          first_name,last_name
          Eric,Idle
          John,Cleese

 -- クラス: csv.DictWriter (f, fieldnames, restval='',
          extrasaction='raise', dialect='excel', *args, **kwds)

     通常の writer のように動作しますが、辞書を出力行にマップするオブジ
     ェクトを生成します。 'fieldnames' パラメータは、*note writerow():
     fed. メソッドに渡された辞書の値がどのような順番でファイル 'f' に書
     かれるかを指定するキーの *note sequence: 1f. です。 ‘writerow()’ メ
     ソッドに渡された辞書に 'fieldnames' には存在しないキーが含まれてい
     る場合、オプションの 'extrasaction' パラメータによってどんな動作を
     行うかが指定されます。この値がデフォルト値である ‘'raise'’ に設定さ
     れている場合、 *note ValueError: 2ee. が送出されます。 ‘'ignore'’ に
     設定されている場合、辞書の余分な値は無視されます。その他のパラメー
     タはベースになっている *note writer: 6af. インスタンスに渡されます
     。

     *note DictReader: bdc. クラスとは異なり、 *note DictWriter: 141b. の
     'fieldnames' パラメータは省略可能ではありません。

     'fieldnames' に渡された引数がイテレータの場合、 *note list: 24f. に
     変換されます。

     短い利用例:

          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'})

     which writes ‘names.csv’ containing:

          first_name,last_name
          Baked,Beans
          Lovely,Spam
          Wonderful,Spam

 -- クラス: csv.Dialect

     *note Dialect: 188d. クラスはコンテナクラスです。その属性に、ダブル
     クォート、空白文字、デリミタなどの扱い方に関する情報を含みます。CSV
     には厳密な規格がないため、アプリケーションによって生成される CSV デ
     ータはそれぞれ僅かに異なります。 ‘Dialect’ クラスのインスタンスは
     *note reader: 6ae. と *note writer: 6af. のインスタンスの挙動を定義
     します。

     All available ‘Dialect’ names are returned by *note
     list_dialects(): 1bf2, 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: 2fcb. クラスは Excel で生成される CSV ファイルの通常の
     プロパティを定義します。これは ‘'excel'’ という名前の dialect とし
     て登録されています。

 -- クラス: csv.excel_tab

     *note excel_tab: 2fcc. クラスは Excel で生成されるタブ分割ファイル
     の通常のプロパティを定義します。これは ‘'excel-tab'’ という名前の
     dialect として登録されています。

 -- クラス: csv.unix_dialect

     *note unix_dialect: 141a. クラスは UNIX システムで生成される CSV フ
     ァイルの通常のプロパティ (行終端記号として ‘'\n'’ を用い全てのフィ
     ールドをクォートするもの) を定義します。これは ‘'unix'’ という名前
     の dialect として登録されています。

     Added in version 3.2.

 -- クラス: csv.Sniffer

     *note Sniffer: 2fcd. クラスは CSV ファイルの書式を推理するために用
     いられるクラスです。

     *note Sniffer: 2fcd. クラスではメソッドを二つ提供しています:

      -- メソッド: sniff (sample, delimiters=None)

          与えられた 'sample' を解析し、発見されたパラメータを反映した
          *note Dialect: 188d. サブクラスを返します。オプションの
          'delimiters' パラメータを与えた場合、有効なデリミタ文字を含ん
          でいるはずの文字列として解釈されます。

      -- メソッド: has_header (sample)

          Analyze the sample text (presumed to be in CSV format) and
          return *note True: e0b. 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: e0b.
          is returned.

          注釈: このメソッドは大雑把なヒューリスティックであり、結果が偽
          陽性や偽陰性である可能性があります。

*note Sniffer: 2fcd. の利用例:

     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: 197. 型に変換するよう指示します。

          注釈: Some numeric types, such as *note bool: 3c1, *note
          Fraction: 215, or *note IntEnum: edf, have a string
          representation that cannot be converted to *note float: 197.
          They cannot be read in the ‘QUOTE_NONNUMERIC’ 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: 2fca.
     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: 2fd0, 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: 2fd0.

     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: 19a7, 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: 19a7.

     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: f39.) 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: f39.) newline handling.


File: python.info,  Node: Dialect クラスと書式化パラメータ,  Next: reader オブジェクト,  Prev: モジュールコンテンツ,  Up: csv --- CSV ファイルの読み書き

5.15.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: 188d. 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 ‘Dialect’ 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 ‘Dialect’ class.

Dialect は以下の属性をサポートしています:

 -- の属性: Dialect.delimiter

     フィールド間を分割するのに用いられる 1 文字からなる文字列です。デフ
     ォルトでは ‘','’ です。

 -- の属性: Dialect.doublequote

     フィールド内に現れた 'quotechar' のインスタンスで、クオートではない
     その文字自身でなければならない文字をどのようにクオートするかを制御
     します。 *note True: e0b. の場合、この文字は二重化されます。 *note
     False: d2f. の場合、 'escapechar' は 'quotechar' の前に置かれます。
     デフォルトでは ‘True’ です。

     出力においては、 'doublequote' が *note False: d2f. で 'escapechar'
     がセットされていない場合、フィールド内に 'quotechar' が現れると
     *note Error: 2fca. が送出されます。

 -- の属性: 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: 2fd2.;

             * the 'quotechar' is escaped if 'doublequote' is *note
               False: d2f.;

             * the 'escapechar' itself.

     On reading, the 'escapechar' removes any special meaning from the
     following character.  It defaults to *note None: 886, 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: 2fd2.

     バージョン 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: 2fcf. and defaults to *note QUOTE_MINIMAL: 2fd1. if
     'quotechar' is not ‘None’, and *note QUOTE_NONE: 2fd2. otherwise.

 -- の属性: Dialect.skipinitialspace

     When *note True: e0b, spaces immediately following the 'delimiter'
     are ignored.  The default is *note False: d2f.  When combining
     ‘delimiter=' '’ with ‘skipinitialspace=True’, unquoted empty fields
     are not allowed.

 -- の属性: Dialect.strict

     ‘True’ の場合、 不正な CSV 入力に対して *note Error: 2fca. を送出し
     ます。デフォルトでは ‘False’ です。


File: python.info,  Node: reader オブジェクト,  Next: writer オブジェクト,  Prev: Dialect クラスと書式化パラメータ,  Up: csv --- CSV ファイルの読み書き

5.15.1.3 reader オブジェクト
............................

reader オブジェクト(*note DictReader: bdc. インスタンス、および *note
reader(): 6ae. 関数によって返されたオブジェクト) は、以下の public なメ
ソッドを持っています:

 -- メソッド: csvreader.__next__ ()

     reader の反復可能なオブジェクトから、現在の表現形式 (*note Dialect:
     188d.) に基づいて次の行を解析してリスト（オブジェクトが *note
     reader(): 6ae. から返された場合）または辞書 （ *note DictReader:
     bdc. のインスタンスの場合）として返します。通常は ‘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.15.1.4 writer オブジェクト
............................

*note writer: 6af. オブジェクト(*note DictWriter: 141b. インスタンス、お
よび *note writer(): 6af. 関数によって返されたオブジェクト) は、以下の
public なメソッドを持っています: 'row' には、 ‘writer’ オブジェクトの場
合には文字列か数値のイテラブルを指定し、 ‘DictWriter’ オブジェクトの場合
はフィールド名をキーとして対応する文字列か数値を格納した辞書オブジェクト
を指定します(数値は *note str(): 16a. で変換されます)。複素数を出力する
場合、値をかっこで囲んで出力します。このため、CSV ファイルを読み込むアプ
リケーションで（そのアプリケーションが複素数をサポートしていたとしても）
問題が発生する場合があります。

 -- メソッド: csvwriter.writerow (row, /)

     現在の表現形式 (*note Dialect: 188d.)に沿ってフォーマットされた
     '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(): fed. call used internally.

     Added in version 3.2.

     バージョン 3.8 で変更: *note writeheader(): 141c. は内部的に利用し
     ている *note csvwriter.writerow(): fed. メソッドの返り値を返すよう
     になりました。


File: python.info,  Node: 使用例<17>,  Prev: writer オブジェクト,  Up: csv --- CSV ファイルの読み書き

5.15.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(): 318. が CSV ファイルの読み込みに使われるため、ファイルはデ
フォルトではシステムのデフォルトエンコーディングでユニコード文字列にデコ
ードされます (*note locale.getencoding(): 866. を参照)。他のエンコーディ
ングを用いてデコードするには、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.15.2 ‘configparser’ -- 設定ファイルのパーサー
-----------------------------------------------

'ソースコード:' Lib/configparser.py(1)

__________________________________________________________________

このモジュールは、 Microsoft Windows の INI ファイルに似た構造を持ったベ
ーシックな設定用言語を実装した *note ConfigParser: 4de. クラスを提供しま
す。このクラスを使ってユーザーが簡単にカスタマイズできる Python プログラ
ムを作ることができます。

     注釈: このライブラリでは、Windowsのレジストリ用に拡張された INI 文
     法はサポート 'していません' 。

参考
....

モジュール *note tomllib: 103.

     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.15.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:
2fea.  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 後に: 2feb. 説明しますが、このインターフェイスは辞書
に対して期待するのととても近い動作をします。

これで設定ファイルを作成して保存できました。次はこれを読み込み直して、中
のデータを取り出してみましょう。

     >>> 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(): 1686. call
with several files passed to the 'filenames' parameter.

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。


File: python.info,  Node: サポートされるデータ型,  Next: 代替値,  Prev: クイックスタート,  Up: configparser --- 設定ファイルのパーサー

5.15.2.2 サポートされるデータ型
...............................

Config parser は値のデータ型について何も推論せず、常に文字列のまま内部に
保存します。他のデータ型が必要な場合は自分で変換する必要があります:

     >>> int(topsecret['Port'])
     50022
     >>> float(topsecret['CompressionLevel'])
     9.0

このタスクはとても一般的なため、設定パーサーでは整数、浮動小数点数、真偽
値を扱うための手頃なゲッターメソッドが提供されています。真偽値の扱いは一
筋縄ではいきません。文字列を ‘bool()’ に渡しても、 ‘bool('False')’ が
‘True’ になってしまいます。そこで config parser は *note getboolean():
2fee. を提供しています。このメソッドは大文字小文字を区別せず、
‘'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(): 2fee. 以外に *note getint():
2fef. と *note getfloat(): 2ff0. メソッドも提供されています。独自のコン
バーターの登録、提供されたメソッドのカスタマイズもできます。 (2)

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。


File: python.info,  Node: 代替値,  Next: サポートするINI ファイルの構造,  Prev: サポートされるデータ型,  Up: configparser --- 設定ファイルのパーサー

5.15.2.3 代替値
...............

As with a dictionary, you can use a section's *note get(): 1487. 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():
1487. 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(): 2fef. 、 *note getfloat():
2ff0. と *note getboolean(): 2fee. メソッドでも使えます。例えば:

     >>> '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.15.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: 2ff2.

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:
17fa. 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: 2fec.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。

   (3) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。

   (4) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。

   (5) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2fec.
セクションを参照してください。


File: python.info,  Node: Unnamed Sections,  Next: 値の補間,  Prev: サポートするINI ファイルの構造,  Up: configparser --- 設定ファイルのパーサー

5.15.2.5 Unnamed Sections
.........................

The name of the first section (or unique) may be omitted and values
retrieved by the *note UNNAMED_SECTION: 17fa. 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.15.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: 2fec.
セクションを参照してください。


File: python.info,  Node: マップ型プロトコルアクセス,  Next: パーサーの振る舞いをカスタマイズする,  Prev: 値の補間,  Up: configparser --- 設定ファイルのパーサー

5.15.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: 12c4. 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: 2ee. が発生します。

        * ‘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: 2fec.
セクションを参照してください。


File: python.info,  Node: パーサーの振る舞いをカスタマイズする,  Next: レガシーな API の例,  Prev: マップ型プロトコルアクセス,  Up: configparser --- 設定ファイルのパーサー

5.15.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(): 2ff6. before you read the actual file.

   * 'dict_type', デフォルト値: *note dict: 184.

     このオプションはマップ型プロトコルの振る舞い方や書き込まれる設定フ
     ァイルの見た目に大きく影響します。標準の辞書では、全てのセクション
     はパーサーに加えられた順に並びます。同じことがセクション内のオプシ
     ョンにも言えます。

     セクションとオプションをライトバック時にソートするためなどに、別の
     辞書型も使えます。

     注意: 一度の操作でキー-値の対を複数追加する方法もあります。そのよう
     な操作に普通の辞書を使うと、キーの並びは挿入順になります。例えば:

          >>> 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(): 1e0. の '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(): 2ff7. or *note read_dict():
     2ff6.).  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
     特化したドキュメントのセクション: 2ff5. をご覧ください。 *note
     RawConfigParser: 116a. のデフォルト値は ‘None’ です。

   * 'converters', デフォルト値: 未設定

     Config parsers provide option value getters that perform type
     conversion.  By default *note getint(): 2fef, *note getfloat():
     2ff0, and *note getboolean(): 2fee. 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(): 2fee. を使うことで、設定パーサ
     ーは以下の値を ‘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.15.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.15.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: 148a. や *note DuplicateOptionError:
     148b. を送出します。 '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
     特化したドキュメントのセクション: 2ff5. を参照してください。

     補間に使われるすべてのオプション名は、他のオプション名参照と同様に
     、 *note optionxform(): 2ffc. メソッドを通して渡されます。例えば、
     ‘optionxform()’ のデフォルトの実装を使うと、値 ‘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: 2ff4.

     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(): 2ff6, 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: 184,
     since it now preserves insertion order.

     バージョン 3.13 で変更: Raise a *note MultilineContinuationError:
     2ffd. 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: 148a. が送出されます。 'default
          section' 名が渡されたら、 *note ValueError: 2ee. が送出されま
          す。セクションの名前は文字列でなければなりません。そうでなけれ
          ば、 *note TypeError: 199. が送出されます。

          バージョン 3.2 で変更: 文字列でないセクション名は *note
          TypeError: 199. を送出します。

      -- メソッド: has_section (section)

          指名された 'section' が設定中に存在するかを示します。'default
          section' は認識されません。

      -- メソッド: options (section)

          指定された 'section' 中で利用できるオプションのリストを返しま
          す。

      -- メソッド: has_option (section, option)

          与えられた 'section' が存在し、与えられた 'option' を含む場合
          、 *note True: e0b. を返します。それ以外の場合には、 *note
          False: d2f. を返します。指定された 'section' が *note None:
          886. または空文字列の場合、 DEFAULT が仮定されます。

      -- メソッド: read (filenames, encoding=None)

          ファイル名の iterable を読み込んでパースしようと試みます。正常
          にパースできたファイル名のリストを返します。

          もし 'filenames' が文字列か *note bytes: 193. オブジェクトか
          *note path-like object: 5a1. なら、この引数は1つのファイル名と
          して扱われます。 'filenames' 中に開けないファイルがある場合、
          そのファイルは無視されます。この挙動は、設定ファイルが置かれる
          可能性のある場所(例えば、 カレントディレクトリ、ホームディレク
          トリ、システム全体の設定を行うディレクトリ)のイテラブルを指定
          して、イテラブルの中で存在する全ての設定ファイルを読むことを想
          定して設計されています。

          どの設定ファイルも存在しなかった場合、 *note ConfigParser:
          4de. のインスタンスは 空のデータセットを持ちます。初期値の設定
          ファイルを先に読み込んでおく必要があるアプリケーションでは、 オ
          プションのファイルを読み込むために *note read(): 1686. を呼ぶ
          前に 、まず *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(): 318.

          バージョン 3.6.1 で変更: 'filenames' 引数が *note path-like
          object: 5a1. を受け入れるようになりました。

          バージョン 3.7 で変更: 'filenames' 引数が *note bytes: 193. オ
          ブジェクトを受け入れるようになりました。

      -- メソッド: 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(): 1487. を参照してください。

      -- メソッド: 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(): 1487. 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: 2ee. を送
          出します。 'raw', 'vars' および 'fallback' の説明は *note
          get(): 1487. を参照してください。

      -- メソッド: items (raw=False, vars=None)

      -- メソッド: items (section, raw=False, vars=None)

          'section' が与えられなければ、DEFAULTSECT を含めた
          'section_name', 'section_proxy' の対のリストを返します。

          与えられれば、与えられた 'section' 中のオプションの 'name',
          'value' の対のリストを返します。オプションの引数は *note
          get(): 1487. メソッドに与えるものと同じ意味を持ちます。

          バージョン 3.8 で変更: 'vars' に現れる項目は結果に表れなくなり
          ました。以前の挙動は、実際のパーサーオプションを補間のために与
          えられた変数と混合していました。

      -- メソッド: set (section, option, value)

          与えられたセクションが存在すれば、与えられたオプションを指定さ
          れた値に設定します。そうでなければ *note NoSectionError: 3004.
          を送出します。 'option' および 'value' は文字列でなければなり
          ません。そうでなければ *note TypeError: 199. が送出されます。

      -- メソッド: write (fileobject, space_around_delimiters=True)

          設定の表現を指定された *note file object: 13df. に書き込みます
          。 'fileobject' は (文字列を受け付ける) テキストモードで開かれ
          ていなければなりません。この表現は後で *note read(): 1686. を
          呼び出すことでパースできます。 'space_around_delimiters' が真
          なら、キーと値の間のデリミタはスペースで囲まれます。

          バージョン 3.14 で変更: Raises InvalidWriteError if this would
          write a representation which cannot be accurately parsed by a
          future *note read(): 1686. 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: 3004. を送出
          します。オプションが存在して削除されれば、 *note True: e0b. を
          返します。そうでなければ *note False: d2f. を返します。

      -- メソッド: remove_section (section)

          指定された 'section' を設定から削除します。セクションが実際に
          存在すれば、‘True’ を返します。そうでなければ ‘False’ を返しま
          す。

      -- メソッド: optionxform (option)

          入力ファイルに現れた、またはクライアントコードで渡されたオプシ
          ョン名 'option' を内部構造で実際に使われる形式に変換します。デ
          フォルトの実装では 'option' の小文字版を返します。派生クラスで
          これを上書きするか、クライアントコードでインスタンス上のこの名
          前の属性を設定して、この動作に影響を与えることができます。

          このメソッドを使うためにパーサーを派生クラス化させる必要はなく
          、インスタンス上で、これを文字列引数をとって文字列を返す関数に
          設定できます。例えば、これを ‘str’ に設定すると、オプション名
          に大文字小文字の区別をつけられます:

               cfgparser = ConfigParser()
               cfgparser.optionxform = str

          なお、設定ファイルを読み込むとき、オプション名の周りの空白は
          *note optionxform(): 2ffc. が呼び出される前に取り除かれます。

 -- データ: configparser.UNNAMED_SECTION

     A special object representing a section name used to reference the
     unnamed section (see *note Unnamed Sections: 2ff4.).

 -- データ: configparser.MAX_INTERPOLATION_DEPTH

     The maximum depth for recursive interpolation for *note get():
     1487. 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.15.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: 184,
     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: 17fa.
          to the instance.

          If the given section already exists, *note
          DuplicateSectionError: 148a. is raised.  If the 'default
          section' name is passed, *note ValueError: 2ee. is raised.  If
          *note UNNAMED_SECTION: 17fa. is passed and support is
          disabled, *note UnnamedSectionDisabledError: 300b. is raised.

          'section' の型は検査されないため、ユーザーは非文字列の名前付き
          セクションを作ることができます。この振る舞いはサポートされてお
          らず、内部エラーを起こす可能性があります。

     バージョン 3.14 で変更: Added support for *note UNNAMED_SECTION:
     17fa.

      -- メソッド: set (section, option, value)

          与えられたセクションが存在していれば、オプションを指定された値
          に設定します。セクションが存在しなければ *note NoSectionError:
          3004. を発生させます。 *note RawConfigParser: 116a. (あるいは
          'raw' パラメータをセットした *note ConfigParser: 4de.) を文字
          列型でない値の '内部的な' 格納場所として使うことは可能ですが、
          すべての機能 (置換やファイルへの出力を含む) がサポートされるの
          は文字列を値として使った場合だけです。

          ユーザーは、このメソッドを使って非文字列の値をキーに代入できま
          す。この振る舞いはサポートされておらず、非rawモードでの値の取
          得や、ファイルへの書き出しを試みた際にエラーの原因となりえます
          。このような代入を許さない 'マッピングプロトコルAPIを使用して
          ください'。


File: python.info,  Node: 例外<9>,  Prev: RawConfigParser オブジェクト,  Up: configparser --- 設定ファイルのパーサー

5.15.2.12 例外
..............

 -- 例外: configparser.Error

     Base class for all other ‘configparser’ exceptions.

 -- 例外: configparser.NoSectionError

     指定したセクションが見つからなかった時に起きる例外です。

 -- 例外: configparser.DuplicateSectionError

     Exception raised if *note add_section(): 1489. 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: 3007. を超えたため
     に文字列補間が完了しなかったときに送出される例外です。 *note
     InterpolationError: 3010. の派生クラスです。

 -- 例外: configparser.InterpolationMissingOptionError

     *note InterpolationError: 3010. の派生クラスで、値が参照しているオ
     プションが見つからない場合に発生する例外です。

 -- 例外: configparser.InterpolationSyntaxError

     置換がなされるソーステキストが要求された文法を満たさないときに送出
     される例外です。 *note InterpolationError: 3010. の派生クラスです。

 -- 例外: 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:
     17fa. without enabling it.

          Added in version 3.14.

 -- 例外: configparser.InvalidWriteError

     Exception raised when an attempted *note ConfigParser.write(): 1e0.
     would not be parsed accurately with a future *note
     ConfigParser.read(): 1686. call.

     Ex: Writing a key beginning with the *note ConfigParser.SECTCRE:
     2ff2. 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.15.3 ‘tomllib’ -- TOML ファイルの解析
---------------------------------------

Added in version 3.11.

'ソースコード:' Lib/tomllib(1)

__________________________________________________________________

This module provides an interface for parsing TOML 1.0.0 (Tom's Obvious
Minimal Language, https://toml.io(2)).  This module does not support
writing TOML.

     警告: Be cautious when parsing data from untrusted sources.  A
     malicious TOML string may cause the decoder to consume considerable
     CPU and memory resources.  Limiting the size of data to be parsed
     is recommended.

参考
....

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: 184. です。
     TOMLの型は *note conversion table: 3019. を使用してPythonのデータ型
     に変換されます。

     'parse_float' は、全てのデコードされる TOML の浮動小数点数文字列に
     対して呼ばれます。デフォルトでは、 ‘float(num_str)’ と等価です。こ
     れは TOML 浮動小数点数に対して他のデータ型やパーサ (たとえば *note
     decimal.Decimal: 200.) を使うのに使えます。呼び出し可能オブジェクト
     は *note dict: 184. や *note list: 24f. 以外を返す必要があり、そう
     でない場合は *note ValueError: 2ee. が送出されます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 196d. が送出
     されます。

 -- の関数: tomllib.loads (s, /, *, parse_float=float)

     *note str: 16a. からTOMLを読み込みます。戻り値は *note dict: 184. で
     す。TOMLの型は *note conversion table: 3019. を使用してPythonのデー
     タ型に変換されます。'parse_float'  引数は *note load(): 3018. と同
     じ意味を持ちます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 196d. が送出
     されます。

次の例外がサポートされています:

 -- 例外: tomllib.TOMLDecodeError (msg, doc, pos)

     *note ValueError: 2ee. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: doc

          パース対象の TOML ドキュメントです。

      -- の属性: pos

          'doc' の解析に失敗したインデクスです。

      -- の属性: lineno

          'pos' に対応する行です。

      -- の属性: colno

          'pos' に対応する列です。

     バージョン 3.14 で変更: Added the 'msg', 'doc' and 'pos'
     parameters.  Added the *note msg: 301a, *note doc: 301b, *note pos:
     301c, *note lineno: 301d. and *note colno: 301e. 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.15.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.15.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.15.4 ‘netrc’ -- netrc ファイルの処理
--------------------------------------

'ソースコード:' Lib/netrc.py(1)

__________________________________________________________________

*note netrc: 1cd6. クラスは、Unix ‘ftp’ プログラムや他の FTP クライアン
トで用いられる netrc ファイル形式を解析し、カプセル化 (encapsulate) しま
す。

 -- クラス: netrc.netrc ([file])

     A *note netrc: 1cd6. 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(): c0d. - will be read.  Otherwise, a *note
     FileNotFoundError: 266. exception will be raised.  Parse errors
     will raise *note NetrcParseError: 3024. 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:
     3024. 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(): 187d.

     バージョン 3.4 で変更: POSIX パーミッションのチェックが追加されまし
     た。

     バージョン 3.7 で変更: 引数で 'file' が渡されなかったときは、
     ‘.netrc’ ファイルの場所を探すのに *note os.path.expanduser(): c0d.
     が使われるようになりました。

     バージョン 3.10 で変更: *note netrc: 9f. は、ロケール固有のエンコー
     ディングを使用する前に、 UTF-8 でのエンコーディングを試みます。
     netrc ファイルのエントリがすべてのトークンを含む必要はなくなりまし
     た。欠落したトークンのデフォルト値は空文字列です。すべてのトークン
     とその値は空白や非 ASCII 文字のような任意の文字を使用できるようにな
     りました。ログイン名が匿名の場合、セキュリティチェックはトリガーし
     ません。

 -- 例外: netrc.NetrcParseError

     ソーステキストに構文上のエラーがある場合に、 *note netrc: 1cd6. ク
     ラスで発生する例外。この例外のインスタンスは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.15.4.1 netrc オブジェクト
...........................

*note netrc: 1cd6. インスタンスは以下のメソッドを持っています:

 -- メソッド: netrc.authenticators (host)

     'host' の認証情報として、三要素のタプル ‘(login, account,
     password)’ を返します。与えられた host に対するエントリが netrc フ
     ァイルにない場合、'default' エントリに関連付けられたタプルが返され
     ます。host に対応するエントリがなく、default エントリもない場合、
     ‘None’ を返します。

 -- メソッド: netrc.__repr__ ()

     クラスの持っているデータを netrc ファイルの書式に従った文字列で出力
     します。(コメントは無視され、エントリが並べ替えられる可能性がありま
     す。)

*note netrc: 1cd6. のインスタンスは以下の public なインスタンス変数を持
っています:

 -- の属性: netrc.hosts

     ホスト名を ‘(login, account, password)’ からなるタプルに対応づけて
     いる辞書です。'default' エントリがある場合、その名前の擬似ホスト名
     として表現されます。

 -- の属性: netrc.macros

     マクロ名を文字列のリストに対応付けている辞書です。


File: python.info,  Node: plistlib --- Apple plist ファイルを生成・解析する,  Prev: netrc --- netrc ファイルの処理,  Up: ファイルフォーマット

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

'ソースコード:' Lib/plistlib.py(1)

__________________________________________________________________

このモジュールは Apple (主に macOS と iOS) で使われる「プロパティーリス
ト」ファイルを読み書きするインターフェイスを提供します。このモジュールは
バイナリと XML の plist ファイルの両方をサポートします。

The property list (‘.plist’) file format is a simple serialization
supporting basic object types, like dictionaries, lists, numbers and
strings.  Usually the top level object is a dictionary.

plist ファイルを書き出したり解析したりするには *note dump(): b4e. や
*note load(): b4c. 関数を利用します。

バイトオブジェクトや文字列オブジェクトの plist データを扱うためには
*note dumps(): b4f. や *note loads(): b4d. を利用します。

値は文字列、整数、浮動小数点数、ブール型、タプル、リスト、辞書 (ただし文
字列だけがキーになれます)、 *note bytes: 193.、*note bytearray: 342. ま
たは *note datetime.datetime: 4e2. のオブジェクトです。

バージョン 3.4 で変更: 新しい API となり、古い API は非推奨となりました
。バイナリ形式の plist がサポートされました。

バージョン 3.8 で変更: バイナリの plist で NSKeyedArchiver や
NSKeyedUnarchiver によって使用される *note UID: c1a. トークンの読み込み
・書き込みのサポートが追加されました。

バージョン 3.9 で変更: 古い API が削除されました。

参考
....

PList マニュアルページ(2)

     このファイル形式の Apple の文書。

このモジュールは以下の関数を定義しています:

 -- の関数: plistlib.load (fp, *, fmt=None, dict_type=dict,
          aware_datetime=False)

     plist ファイルを読み込みます。'fp' は読み込み可能かつバイナリのファ
     イルオブジェクトです。展開されたルートオブジェクト (通常は辞書です)
     を返します。

     'fmt' はファイルの形式で、次の値が有効です。

        * *note None: 886.: ファイル形式を自動検出します

        * *note FMT_XML: 117f.: XML ファイル形式です

        * *note FMT_BINARY: 1180.: バイナリの plist 形式です

     'dict_type' は、 plist ファイルから読み出された辞書に使われる型です
     。

     When 'aware_datetime' is true, fields with type ‘datetime.datetime’
     will be created as *note aware object: 2910, with ‘tzinfo’ as *note
     datetime.UTC: 713.

     *note FMT_XML: 117f. 形式の XML データは *note xml.parsers.expat:
     12d. にある Expat パーサーを使って解析されます。不正な形式の XML に
     対して送出される可能性のある例外については、そちらの文書を参照して
     ください。plist 解析器では、未知の要素は単純に無視されます。

     The parser raises *note InvalidFileException: 1d58. 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(): b4c. を参照してください。

     Added in version 3.4.

     バージョン 3.13 で変更: 'fmt' が *note FMT_XML: 117f. の場合、
     '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: 117f.: XML 形式の plist ファイルです

        * *note FMT_BINARY: 1180.: バイナリ形式の plist ファイルです

     'sort_keys' が真 (デフォルト) の場合、辞書内のキーは、plist にソー
     トされた順序で書き込まれます。偽の場合、ディクショナリのイテレート
     の順序で書き込まれます。

     'skipkeys' が偽 (デフォルト) の場合、この関数は辞書のキーが文字列で
     ない場合に *note TypeError: 199. を送出します。真の場合、そのような
     キーは読み飛ばされます。

     When 'aware_datetime' is true and any field with type
     ‘datetime.datetime’ is set as an *note aware object: 2910, it will
     convert to UTC timezone before writing it.

     *note TypeError: 199. が、オブジェクトがサポート外の型のものであっ
     たりサポート外の型のオブジェクトを含むコンテナだった場合に、送出さ
     れます。

     (バイナリの) plist ファイル内で表現できない整数値に対しては、 *note
     OverflowError: a85. が送出されます。

     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(): b4e. を参照してくだ
     さい。

     Added in version 3.4.

以下のクラスが使用可能です:

 -- クラス: plistlib.UID (data)

     *note int: 19c. をラップします。これは 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.15.5.1 使用例
...............

plist を作ります:

     import datetime as dt
     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 = dt.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.16 暗号関連のサービス
=======================

この章で記述されているモジュールでは、暗号の本質に関わる様々なアルゴリズ
ムを実装しています。 これらは必要に応じてインストールすることで使用でき
ます。概要を以下に示します:

* Menu:

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


File: python.info,  Node: hashlib --- セキュアハッシュとメッセージダイジェスト,  Next: hmac --- メッセージ認証のための鍵付きハッシュ化,  Up: 暗号関連のサービス

5.16.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: 13a. モジュールで
     提供されています。

* 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.16.1.1 ハッシュアルゴリズム
.............................

各 'hash' の名前が付いたコンストラクタがあります。いずれも同一で簡単なイ
ンターフェイスのあるハッシュオブジェクトを返します。例えば、SHA-256 ハッ
シュオブジェクトを作るには *note sha256(): 1910. を使います。このオブジ
ェクトには *note update: 303b. メソッドを用いて *note bytes-like
オブジェクト: 194. (通常 *note bytes: 193.) を渡すことができます。*note
digest(): 303c. や *note hexdigest(): 303d. メソッドを用いて、それまでに
渡したデータを連結したものの 'digest' をいつでも要求することができます。

To allow multithreading, the Python *note GIL: 165. is released while
computing a hash supplied more than 2047 bytes of data at once in its
constructor or *note .update: 303b. method.

Constructors for hash algorithms that are always present in this module
are *note sha1(): 303e, *note sha224(): 303f, *note sha256(): 1910,
*note sha384(): 3040, *note sha512(): 3041, *note sha3_224(): ea4, *note
sha3_256(): ea5, *note sha3_384(): ea6, *note sha3_512(): ea7, *note
shake_128(): ea8, *note shake_256(): ea9, *note blake2b(): 852, and
*note blake2s(): 853.  *note md5(): 1889. 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: 158f.

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(): 1d8c.
See *note algorithms_available: 1590.

     警告: Some algorithms have known hash collision weaknesses
     (including MD5 and SHA1).  Refer to Attacks on cryptographic hash
     algorithms(1) and the *note hashlib-seealso: 3042. section at the
     end of this document.

Added in version 3.6: SHA3 (Keccak) and SHAKE constructors *note
sha3_224(): ea4, *note sha3_256(): ea5, *note sha3_384(): ea6, *note
sha3_512(): ea7, *note shake_128(): ea8, *note shake_256(): ea9. 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.16.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.16.1.3 コンストラクタ
.......................

 -- の関数: hashlib.new (name[, data], *, usedforsecurity=True)

     一般的なコンストラクタで、第一引数にアルゴリズム名を文字列 'name' で
     受け取ります。他にも、前述のハッシュアルゴリズムだけでなく OpenSSL
     ライブラリーが提供するような他のアルゴリズムにアクセスすることがで
     きます。

Using *note new(): 1d8c. 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(): 1d8c.


File: python.info,  Node: 属性,  Next: Hash Objects,  Prev: コンストラクタ,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.16.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(): 1d8c. に渡すことができます。
     *note algorithms_guaranteed: 158f. は常にサブセットです。この set の
     中に同じアルゴリズムが違う名前で複数回現れることがあります (OpenSSL
     由来)。

     Added in version 3.2.


File: python.info,  Node: Hash Objects,  Next: SHAKE 可変長ダイジェスト,  Prev: 属性,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.16.1.5 Hash Objects
.....................

コンストラクタが返すハッシュオブジェクトには、次のような定数属性が用意さ
れています:

 -- データ: hash.digest_size

     生成されたハッシュのバイト数。

 -- データ: hash.block_size

     内部で使われるハッシュアルゴリズムのブロックのバイト数。

ハッシュオブジェクトには次のような属性があります:

 -- の属性: hash.name

     このハッシュの正規名です。常に小文字で、*note new(): 1d8c. の引数と
     して渡してこのタイプの別のハッシュを生成することができます。

     バージョン 3.4 で変更: name 属性は CPython には最初からありましたが
     、Python 3.4 までは正式に明記されていませんでした。そのため、プラッ
     トフォームによっては存在しないかもしれません。

ハッシュオブジェクトには次のようなメソッドがあります:

 -- メソッド: hash.update (data)

     hash オブジェクトを *note bytes-like object: 194. で更新します。こ
     のメソッドの呼出しの繰り返しは、それらの引数を全て結合した引数で単
     一の呼び出しをした際と同じになります。すなわち ‘m.update(a);
     m.update(b)’ は ‘m.update(a + b)’ と等価です。

 -- メソッド: hash.digest ()

     これまで *note update(): 303b. メソッドに渡されたデータのダイジェス
     ト値を返します。これは *note digest_size: 3048. と同じ長さの、0 か
     ら 255 の範囲全てを含み得るバイトの列です。

 -- メソッド: hash.hexdigest ()

     *note digest(): 303c. と似ていますが、倍の長さの、16進形式文字列を
     返します。これは、電子メールなどの非バイナリ環境で値を交換する場合
     に便利です。

 -- メソッド: hash.copy ()

     ハッシュオブジェクトのコピー ("クローン") を返します。これは、最初
     の部分文字列が共通なデータのダイジェストを効率的に計算するために使
     用します。


File: python.info,  Node: SHAKE 可変長ダイジェスト,  Next: ファイルのハッシュ化,  Prev: Hash Objects,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.16.1.6 SHAKE 可変長ダイジェスト
.................................

 -- の関数: hashlib.shake_128 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.shake_256 ([data], *, usedforsecurity=True)

The *note shake_128(): ea8. and *note shake_256(): ea9. 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(): 303b. メソッドに渡されたデータのダイジェス
     ト値を返します。これは 'length' と同じ長さの、0 から 255 の範囲全て
     を含み得るバイトの列です。

 -- メソッド: shake.hexdigest (length)

     *note digest(): 1e76. と似ていますが、倍の長さの、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.16.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(): 318,
     *note BytesIO: 10a8. instances, SocketIO objects from *note
     socket.socket.makefile(): 13bb, and similar.  'fileobj' must be
     opened in blocking mode, otherwise a *note BlockingIOError: 237.
     may be raised.

     The function may bypass Python's I/O and use the file descriptor
     from *note fileno(): 181b. 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: 237. 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.16.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: 194. でなければな
     りません。アプリケーションとライブラリは、 '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.16.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.16.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: 194.  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: 3051. で利用でき
ます。

コンストラクタ関数は以下のツリーハッシングパラメタを受け付けます:

   * '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.16.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.16.1.12 使用例
................

* Menu:

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


File: python.info,  Node: 簡単なハッシュ化,  Next: Using different digest sizes,  Up: 使用例<20>

5.16.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(): 303b. on the object, and, finally, get the digest out of the
object by calling *note digest(): 303c. (or *note hexdigest(): 303d. 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(): 303b. 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.16.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.16.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.16.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.16.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.16.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.16.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.16.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(): 1d8c.  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(): c9a. と同じ意味を持ちます。

     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(): 114f. メソッドに渡されたバイト列のダイジェ
     スト値を返します。これはコンストラクタに与えられた 'digest_size' と
     同じ長さのバイト列で、 NUL バイトを含む非 ASCII 文字が含まれること
     があります。

          警告: When comparing the output of ‘digest()’ to an externally
          supplied digest during a verification routine, it is
          recommended to use the *note compare_digest(): 12e4. function
          instead of the ‘==’ operator to reduce the vulnerability to
          timing attacks.

 -- メソッド: HMAC.hexdigest ()

     *note digest(): d36. と似ていますが、返される文字列は倍の長さとなり
     、16進形式となります。これは、電子メールなどの非バイナリ環境で値を
     交換する場合に便利です。

          警告: When comparing the output of ‘hexdigest()’ to an
          externally supplied digest during a verification routine, it
          is recommended to use the *note compare_digest(): 12e4.
          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(): 3066. が
     返したような ASCII のみの) *note str: 16a. または *note bytes-like
     object: 194. のどちらか一方。

          注釈: '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.16.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.16.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: 2bd4. を参
     照してください。

 -- の関数: 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.16.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:
     3070. 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:
     3070. 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:
     3070. is used instead.

          >>> token_urlsafe(16)
          'Drmhze6EPcv0fN_81Bj-nA'

* Menu:

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


File: python.info,  Node: トークンは何バイト使うべきか？,  Up: トークンの生成

5.16.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:
19c. 引数で渡すことで、トークンに使用するランダムさを明示的に指定するこ
とができます。引数はランダムさのバイト数として使用されます。

Otherwise, if no argument is provided, or if the argument is ‘None’, the
‘token_*’ functions use *note DEFAULT_ENTROPY: 3070. 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.16.3.4 その他の関数
.....................

 -- の関数: secrets.compare_digest (a, b)

     文字列または *note bytes-like オブジェクト: 194. 'a' と 'b' が等し
     ければ ‘True’ を、そうでなければ ‘False’ を返します。比較は タイミ
     ング攻撃(1) のリスクを減らす "定数時間比較" の方法で行われます。詳
     細については *note hmac.compare_digest(): 12e4. を参照してください
     。

   ---------- Footnotes ----------

   (1) https://codahale.com/a-lesson-in-timing-attacks/


File: python.info,  Node: レシピとベストプラクティス,  Prev: その他の関数,  Up: secrets --- 機密を扱うために安全な乱数を生成する

5.16.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.17 汎用オペレーティングシステムサービス
=========================================

本章に記述されたモジュールは、ファイルの取り扱いや時間計測のような (ほぼ
)すべてのオペレーティングシステムで利用可能な機能にインターフェースを提
供します。これらのインターフェースは、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.17.1 ‘os’ -- 雑多なオペレーティングシステムインターフェース
-------------------------------------------------------------

'ソースコード:' Lib/os.py(1)

__________________________________________________________________

このモジュールは、 OS 依存の機能を利用するポータブルな方法を提供します。
単純なファイルの読み書きについては、 *note open(): 318. を参照してくださ
い。パス操作については、 *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(): 1315.) and
     resources (e.g.  *note nice(): 131d.) are not available.  Others
     like *note getuid(): 187d. and *note getpid(): 307c. are emulated
     or stubs.  WebAssembly platforms also lack support for signals
     (e.g.  *note kill(): 1583, *note wait(): f9c.).

     注釈: このモジュール内のすべての関数は、間違った、あるいはアクセス
     出来ないファイル名やファイルパス、その他型が合っていても OS が受理
     しない引数に対して、 *note OSError: 2c2. (またはそのサブクラス)を送
     出します。

 -- 例外: os.error

     組み込みの *note OSError: 2c2. 例外に対するエイリアスです。

 -- データ: os.name

     import されているオペレーティングシステムに依存するモジュールの名前
     です。現在次の名前が登録されています: ‘'posix'’, ‘'nt'’, ‘'java'’。

     参考
     ....

     *note sys.platform: 293. はより細かな粒度を持っています。 *note
     os.uname(): 1332. はシステム依存のバージョン情報を提供します。

     *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.17.1.1 ファイル名、コマンドライン引数、および環境変数
.......................................................

Python では、ファイル名、コマンドライン引数、および環境変数を表すのに文
字列型を使用します。一部のシステムでは、これらをオペレーティングシステム
に渡す前に、文字列からバイト列へ、またはその逆のデコードが必要です。
Python はこの変換を行うために *note filesystem encoding and error
handler: 75d. を使用します (*note sys.getfilesystemencoding(): e57. 参照
)。

term:‘ファイルシステムのエンコーディングとエラーハンドラ <filesystem
encoding and error handler>’ は、Pythonの開始時に:c:func:‘PyConfig_Read’
関数により設定されます。 *note PyConfig: 3f5. のメンバー *note
filesystem_encoding: 419. と *note filesystem_errors: 41a. を参照してく
ださい。

バージョン 3.1 で変更: 一部のシステムでは、ファイルシステムのエンコーデ
ィングを使用して変換すると失敗する場合があります。この場合、Python は
*note surrogateescape エンコーディングエラーハンドラー: 28cb. を使用しま
す。これは、デコード時にデコードできないバイト列は Unicode 文字 U+DC'xx'
に置き換えられ、それらはエンコード時に再び元のバイト列に変換されることを
意味します。

*note file system encoding: 75d. では、すべてが 128 バイト以下に正常にデ
コードされることが保証されなくてはなりません。ファイルシステムのエンコー
ディングでこれが保証されなかった場合は、API 関数が *note UnicodeError:
460. を送出します。

See also the *note locale encoding: 54a.


File: python.info,  Node: Python UTF-8 Mode,  Next: プロセスのパラメーター,  Prev: ファイル名、コマンドライン引数、および環境変数,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.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(): e57. returns ‘'utf-8'’.

   * *note locale.getpreferredencoding(): 75c. returns ‘'utf-8'’ (the
     'do_setlocale' argument has no effect).

   * *note sys.stdin: 75f, *note sys.stdout: cd1, and *note sys.stderr:
     b37. all use UTF-8 as their text encoding, with the
     ‘surrogateescape’ *note error handler: 1bce. being enabled for
     ‘sys.stdin’ and ‘sys.stdout’ (‘sys.stderr’ continues to use
     ‘backslashreplace’ as it does in the default locale-aware mode)

   * On Unix, *note os.device_encoding(): 1c92. returns ‘'utf-8'’ rather
     than the device encoding.

Note that the standard stream settings in UTF-8 mode can be overridden
by *note PYTHONIOENCODING: 1210. (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(): e52. and *note os.fsencode(): e53. use the
     UTF-8 encoding.

   * *note open(): 318, *note io.open(): 740, and *note codecs.open():
     317. 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: 867. is enabled if the LC_CTYPE locale is
‘C’ or ‘POSIX’ at Python startup (see the *note PyConfig_Read(): 997.
function).

It can be enabled or disabled using the *note -X utf8: 170. command line
option and the *note PYTHONUTF8: cd3. environment variable.

If the *note PYTHONUTF8: cd3. 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: cd0.), 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: 89d.

See also the *note UTF-8 mode on Windows: 2279. and the *note filesystem
encoding and error handler: 75d.

参考
....

PEP 686(2)

     Python 3.15 will make *note Python UTF-8 Mode: 867. 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.17.1.3 プロセスのパラメーター
...............................

これらの関数とデータアイテムは、現在のプロセスおよびユーザーに対する情報
提供および操作のための機能を提供しています。

 -- の関数: os.ctermid ()

     プロセスの制御端末に対応するファイル名を返します。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.environ

     A *note mapping: 13d7. 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 ‘os.environ’, except for changes made by modifying
     ‘os.environ’ directly.

     このマップ型オブジェクトは環境変数に対する変更に使うこともできます
     。 *note putenv(): 25d. はマップ型オブジェクトが修正される時に、自
     動的に呼ばれることになります。

     Unix では、キーと値に *note sys.getfilesystemencoding(): e57.、エラ
     ーハンドラーに ‘'surrogateescape'’ を使用します。異なるエンコーディ
     ングを使用したい場合は *note environb: 25c. を使用します。

     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(): 25d. を直接呼び出しても *note
          os.environ: 25b. の内容は変わらないので、 ‘os.environ’ を直接
          変更する方が良いです。

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。各システムのドキュメントで ‘putenv()’ の項目を参照してくだ
          さい。

     You can delete items in this mapping to unset environment
     variables.  *note unsetenv(): 25e. will be called automatically
     when an item is deleted from ‘os.environ’, and when one of the
     ‘pop()’ or ‘clear()’ methods is called.

     参考
     ....

     The *note os.reload_environ(): 25a. function.

     バージョン 3.9 で変更: 更新され PEP 584(1) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- データ: os.environb

     Bytes version of *note environ: 25b.: a *note mapping: 13d7. object
     where both keys and values are *note bytes: 193. objects
     representing the process environment.  ‘environ’ and ‘environb’ are
     synchronized (modifying ‘environb’ updates ‘environ’, and vice
     versa).

     *note environb: 25c. は *note supports_bytes_environ: 1432. が
     ‘True’ の場合のみ利用可能です。

     Added in version 3.2.

     バージョン 3.9 で変更: 更新され PEP 584(2) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- の関数: os.reload_environ ()

     The *note os.environ: 25b. and *note os.environb: 25c. 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(): 25d. or
     *note os.unsetenv(): 25e.  Use ‘os.reload_environ()’ to update
     ‘os.environ’ and ‘os.environb’ 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: 25b. or
          *note os.environb: 25c, or calling *note os.getenv(): 3084.
          while reloading, may return an empty result.

     Added in version 3.14.

 -- の関数: os.chdir (path)

 -- の関数: os.fchdir (fd)

 -- の関数: os.getcwd ()

     これらの関数は、 *note ファイルとディレクトリ: 3085. 節で説明されて
     います。

 -- の関数: os.fsencode (filename)

     *note path-like: 5a1. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. にエンコー
     ドします。未変更の *note bytes: 193. オブジェクトを返します。

     *note fsdecode(): e52. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: e4f. インターフェースを実
     装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fsdecode (filename)

     *note path-like: 5a1. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. からデコー
     ドします。未変更の *note str: 16a. オブジェクトを返します。

     *note fsencode(): e53. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: e4f. インターフェースを実
     装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fspath (path)

     path のファイルシステム表現を返します。

     もし *note str: 16a. か ‘bytes:’ のオブジェクトが渡された場合は、変
     更せずにそのまま返します。さもなければ、 *note __fspath__(): e50. が
     呼び出され、その戻り値が ‘str’ か *note bytes: 193. のオブジェクト
     であれば、その値を返します。他のすべてのケースでは *note TypeError:
     199. が送出されます。

     Added in version 3.6.

 -- クラス: os.PathLike

     ファイルシステムパスを表すオブジェクト(例: *note pathlib.PurePath:
     6cd.) 向けの *note abstract base class: 13d2. です。

     Added in version 3.6.

      -- メソッド: abstractmethod __fspath__ ()

          このオブジェクトが表現するファイルシステムパスを返します。

          このメソッドは *note str: 16a. か *note bytes: 193. のオブジェ
          クトのみを返す必要があります(‘str’ が好まれます)。

 -- の関数: os.getenv (key, default=None)

     環境変数 'key' が存在する場合はその値を文字列として返し、存在しなけ
     れば 'default' を返します。'key' は文字列です。注意すべき点として、
     *note getenv(): 3084. は内部的に *note os.environ: 25b. を使用する
     ため、‘getenv()’ のマップ型オブジェクトはインポート時に取得されます
     。そのため、それ以降に環境変数が変更されても、この関数の値にそれが
     反映されない可能性があります。

     Unix では、キーと値は *note sys.getfilesystemencoding(): e57.、エラ
     ーハンドラー ‘'surrogateescape'’ でデコードされます。異なるエンコー
     ディングを使用したい場合は *note os.getenvb(): 1433. を使用します。

     *note Availability: 2199.: Unix, Windows.

 -- の関数: os.getenvb (key, default=None)

     環境変数 'key' が存在する場合はその値を bytes として返し、存在しな
     ければ 'default' を返します。'key' はbytes である必要があります。注
     意すべき点として、*note getenvb(): 1433. は内部的に *note
     os.environb: 25c. を使用するため、‘getenvb()’ のマップ型オブジェク
     トはインポート時に取得されます。そのため、それ以降に環境変数が変更
     されても、この関数の値にそれが反映されない可能性があります。

     *note getenvb(): 1433. は *note supports_bytes_environ: 1432. が
     ‘True’ の場合のみ利用可能です。

     *note Availability: 2199.: Unix.

     Added in version 3.2.

 -- の関数: os.get_exec_path (env=None)

     プロセスを起動する時に名前付き実行ファイルを検索するディレクトリの
     リストを返します。 'env' が指定されると、それを環境変数の辞書とみな
     し、その辞書からキー PATH の値を探します。 デフォルトでは 'env' は
     ‘None’ であり、*note environ: 25b. が使用されます。

     Added in version 3.2.

 -- の関数: os.getegid ()

     現在のプロセスの実効グループ id を返します。この id は現在のプロセ
     スで実行されているファイルの "set id" ビットに対応します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.geteuid ()

     現在のプロセスの実効ユーザー id を返します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.getgid ()

     現在のプロセスの実グループ id を返します。

     *note Availability: 2199.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. 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: 2199.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.getgroups ()

     現在のプロセスに関連付けられた従属グループ id のリストを返します。

     *note Availability: 2199.: Unix, not WASI.

          注釈: On macOS, ‘getgroups()’ behavior differs somewhat from
          other Unix platforms.  If the Python interpreter was built
          with a deployment target of ‘10.5’ or earlier, ‘getgroups()’
          returns the list of effective group ids associated with the
          current user process; this list is limited to a system-defined
          number of entries, typically 16, and may be modified by calls
          to *note setgroups(): 308a. if suitably privileged.  If built
          with a deployment target greater than ‘10.5’, ‘getgroups()’
          returns the current group access list for the user associated
          with the effective user id of the process; the group access
          list may change over the lifetime of the process, it is not
          affected by calls to ‘setgroups()’, and its length is not
          limited to 16.  The deployment target value,
          ‘MACOSX_DEPLOYMENT_TARGET’, can be obtained with *note
          sysconfig.get_config_var(): 175.

 -- の関数: os.getlogin ()

     プロセスの制御端末にログインしているユーザー名を返します。ほとんど
     の場合、*note getpass.getuser(): 65a. を使う方が便利です。なぜなら
     、‘getpass.getuser()’ は、ユーザーを見つけるために、環境変数
     ‘LOGNAME’ や ‘USERNAME’ を調べ、さらには
     ‘pwd.getpwuid(os.getuid())[0]’ まで調べに行くからです。

     *note Availability: 2199.: Unix, Windows, not WASI.

 -- の関数: os.getpgid (pid)

     プロセス id 'pid' のプロセスのプロセスグループ id を返します。
     'pid' が 0 の場合、現在のプロセスのプロセスグループ id を返します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.getpgrp ()

     現在のプロセスグループの id を返します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.getpid ()

     現在のプロセス id を返します。

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. for more information.

 -- の関数: os.getppid ()

     親プロセスのプロセス id を返します。親プロセスが終了していた場合、
     Unix では init プロセスの id (1) が返され、Windows では親のプロセス
     id だったもの (別のプロセスで再利用されているかもしれない) がそのま
     ま返されます。

     *note Availability: 2199.: Unix, Windows, not WASI.

     バージョン 3.2 で変更: Windows サポートが追加されました。

 -- の関数: os.getpriority (which, who)

     プログラムのスケジューリング優先度を取得します。'which' の値は
     *note PRIO_PROCESS: 308d.、*note PRIO_PGRP: 308e.、あるいは *note
     PRIO_USER: 308f. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (‘PRIO_PROCESS’ であればプロセス識別子、‘PRIO_PGRP’ であ
     ればプロセスグループ識別子、そして ‘PRIO_USER’ であればユーザー
     ID)。'who' の値がゼロの場合、呼び出したプロセス、呼び出したプロセス
     のプロセスグループ、および呼び出したプロセスの実ユーザー id を (そ
     れぞれ) 意味します。

     *note Availability: 2199.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.PRIO_PROCESS
 -- データ: os.PRIO_PGRP
 -- データ: os.PRIO_USER

     *note getpriority(): 131b. と *note setpriority(): 131c. 用のパラメ
     ータです。

     *note Availability: 2199.: 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(): 131b. と *note setpriority(): 131c. 用のパラメ
     ータです。

     *note Availability: 2199.: macOS

     Added in version 3.12.

 -- の関数: os.getresuid ()

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を示す、 (ruid, euid, suid) のタプルを返します。

     *note Availability: 2199.: Unix, not WASI, not macOS, not iOS.

     Added in version 3.2.

 -- の関数: os.getresgid ()

     現在のプロセスの実グループ id 、実効グループ id 、および保存グルー
     プ id を示す、 (rgid, egid, sgid) のタプルを返します。

     *note Availability: 2199.: Unix, not WASI, not macOS, not iOS.

     Added in version 3.2.

 -- の関数: os.getuid ()

     現在のプロセスの実ユーザー id を返します。

     *note Availability: 2199.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. 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: 2199.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.putenv (key, value, /)

     'key' という名前の環境変数に文字列 'value' を設定します。このような
     環境変数の変更は、*note os.system(): 167b.、*note popen(): 31c.、ま
     たは *note fork(): 4b5. と *note execv(): 3094. で起動されたサブプ
     ロセスに影響を与えます。

     *note os.environ: 25b. の要素に代入すると、それは *note putenv():
     25d. の呼び出しに自動変換されます。 しかし、直接 ‘putenv()’ を呼び
     出しても ‘os.environ’ には反映されないため、‘os.environ’ の要素に代
     入する方がベターです。 *note getenv(): 3084. と *note getenvb():
     1433. についても、実装上それぞれ ‘os.environ’ と *note os.environb:
     25c. を使用するので、同様に注意が必要です。

     See also the *note os.reload_environ(): 25a. function.

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。 各システムのドキュメントで ‘putenv()’ の項目を参照してく
          ださい。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1ccb.
     ‘os.putenv’ を送出します。

     バージョン 3.9 で変更: 常に利用出来るようになりました。

 -- の関数: os.setegid (egid, /)

     現在のプロセスに実効グループ id をセットします。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.seteuid (euid, /)

     現在のプロセスに実効ユーザー id をセットします。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.setgid (gid, /)

     現在のプロセスにグループ id をセットします。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.setgroups (groups, /)

     現在のグループに関連付けられた従属グループ id のリストを 'groups' に
     設定します。 'groups' はシーケンス型でなくてはならず、各要素はグル
     ープを特定する整数でなくてはなりません。通常、この操作はスーパユー
     ザーしか利用できません。

     *note Availability: 2199.: Unix, not WASI.

          注釈: macOS では、 'groups' の長さはシステムで定義された実効グ
          ループ id の最大数 ( 通常は 16) を超えない場合があります。
          setgroups() 呼び出しで設定されたものと同じグループリストが返さ
          れないケースについては、 *note getgroups(): 3089. のドキュメン
          トを参照してください。

 -- の関数: 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:
     3098. 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: 3098, 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(): 181b. 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: 2199.: Linux >= 3.0 with glibc >= 2.14.

     Added in version 3.12.

     参考
     ....

     The *note unshare(): 1ba1. function.

 -- の関数: os.setpgrp ()

     システムコール ‘setpgrp()’ か ‘setpgrp(0, 0)’ のどちらか(実装されて
     いるもの)を呼び出します。機能については UNIX マニュアルを参照して下
     さい。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.setpgid (pid, pgrp, /)

     システムコール ‘setpgid()’ を呼び出してプロセス id 'pid' のプロセス
     のプロセスグループ id を 'pgrp' に設定します。この動作に関しては
     Unix のマニュアルを参照してください。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.setpriority (which, who, priority)

     プログラムのスケジューリング優先度を設定します。'which' は *note
     PRIO_PROCESS: 308d.、*note PRIO_PGRP: 308e.、あるいは *note
     PRIO_USER: 308f. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (‘PRIO_PROCESS’ であればプロセス識別子、‘PRIO_PGRP’ であ
     ればプロセスグループ識別子、そして ‘PRIO_USER’ であればユーザー
     ID)。'who' の値がゼロの場合、呼び出したプロセス、呼び出したプロセス
     のプロセスグループ、および呼び出したプロセスの実ユーザー id を (そ
     れぞれ) 意味します。'priority' は -20 から 19 の整数値で、デフォル
     トの優先度は 0 です。小さい数値ほど優先されるスケジューリングとなり
     ます。

     *note Availability: 2199.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.setregid (rgid, egid, /)

     現在のプロセスの実グループ id および実効グループ id を設定します。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.setresgid (rgid, egid, sgid, /)

     現在のプロセスの、実グループ id 、実効グループ id 、および保存グル
     ープ id を設定します。

     *note Availability: 2199.: Unix, not WASI, not Android, not macOS,
     not iOS.

     Added in version 3.2.

 -- の関数: os.setresuid (ruid, euid, suid, /)

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を設定します。

     *note Availability: 2199.: Unix, not WASI, not Android, not macOS,
     not iOS.

     Added in version 3.2.

 -- の関数: os.setreuid (ruid, euid, /)

     現在のプロセスの実ユーザー id および実効ユーザー id を設定します。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.getsid (pid, /)

     ‘getsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.setsid ()

     ‘setsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.setuid (uid, /)

     現在のプロセスのユーザー id を設定します。

     *note Availability: 2199.: Unix, not WASI, not Android.

 -- の関数: os.strerror (code, /)

     エラーコード 'code' に対応するエラーメッセージを返します。未知のエ
     ラーコードの対して ‘strerror()’ が ‘NULL’ を返すプラットフォームで
     は、 *note ValueError: 2ee. が送出されます。

 -- データ: 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
     プラットフォーム: 1bc9. for more information.

 -- の関数: os.uname ()

     Returns information identifying the current operating system.  The
     return value is a *note uname_result: 1b6d.

     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(): 1e6f. can be used to get the user-facing
     operating system name and version on iOS and Android.

     参考
     ....

     *note sys.platform: 293. which has finer granularity.

     *note platform: af. モジュールはシステムの詳細な識別情報をチェック
     する機能を提供しています。

     *note Availability: 2199.: Unix.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- クラス: os.uname_result

     Name and information about the system returned by *note os.uname():
     1332.  These attributes correspond to the members described in
     ‘uname(2)(5)’.

     For backwards compatibility, this object is also iterable, behaving
     like a five-tuple containing *note sysname: 30a1, *note nodename:
     30a2, *note release: 30a3, *note version: 30a4, and *note machine:
     30a5. in that order.

      -- の属性: sysname

          Operating system name.

      -- の属性: nodename

          Name of machine on network.  Some systems truncate ‘nodename’
          to 8 characters or to the leading component; a better way to
          get the hostname is *note socket.gethostname(): 30a6. or even
          ‘socket.gethostbyaddr(socket.gethostname())’.

      -- の属性: release

          Operating system release.

      -- の属性: version

          Operating system version.

      -- の属性: machine

          Hardware identifier.

 -- の関数: os.unsetenv (key, /)

     'key' という名前の環境変数を unset (削除) します。このような環境変
     数の変更は、*note os.system(): 167b.、*note popen(): 31c.、または
     *note fork(): 4b5. と *note execv(): 3094. で起動されたサブプロセス
     に影響を与えます。

     *note os.environ: 25b. のアイテムの削除を行うと、自動的に *note
     unsetenv(): 25e. の対応する呼び出しに変換されます。直接
     ‘unsetenv()’ を呼び出した場合 ‘os.environ’ は更新されないため、実際
     には ‘os.environ’ のアイテムを削除する方が望ましい操作です。

     See also the *note os.reload_environ(): 25a. function.

     引数 ‘key’ を指定して *note 監査イベント: 1ccb. ‘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)(6)’ man page
     for more details.  The 'flags' argument is a bit mask, combining
     zero or more of the *note CLONE_* constants: 3098, 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: 2199.: Linux >= 2.6.16.

     Added in version 3.12.

     参考
     ....

     *note setns(): 1ba0. 関数。

Flags to the *note unshare(): 1ba1. function, if the implementation
supports them.  See ‘unshare(2)(7)’ 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/uname(2)

   (6) https://manpages.debian.org/unshare(2)

   (7) https://manpages.debian.org/unshare(2)


File: python.info,  Node: ファイルオブジェクトの生成,  Next: ファイル記述子の操作,  Prev: プロセスのパラメーター,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.4 ファイルオブジェクトの生成
...................................

以下の関数は新しい *note ファイルオブジェクト: 13df. を作成します。(ファ
イル記述子のオープンについては *note open(): f96. も参照してください)

 -- の関数: os.fdopen (fd, *args, **kwargs)

     ファイル記述子 'fd' に接続し、オープンしたファイルオブジェクトを返
     します。これは組み込み関数 *note open(): 318. の別名であり、同じ引
     数を受け取ります。唯一の違いは *note fdopen(): 23dd. の第一引数が常
     に整数でなければならないことです。


File: python.info,  Node: ファイル記述子の操作,  Next: ファイルとディレクトリ,  Prev: ファイルオブジェクトの生成,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.5 ファイル記述子の操作
.............................

これらの関数は、ファイル記述子を使って参照されている I/O ストリームを操
作します。

ファイル記述子とは現在のプロセスで開かれたファイルに対応する小さな整数で
す。例えば、標準入力のファイル記述子は通常 0 で、標準出力は 1 、標準エラ
ーは 2 です。プロセスから開かれたその他のファイルには 3 、 4 、 5 と割り
振られていきます。「ファイル記述子」という名称は少し誤解を与えるものかも
しれません。Unix プラットフォームでは、ソケットやパイプもファイル記述子
によって参照されます。

*note fileno(): 181b. メソッドを使用して、必要な場合に *note file
object: 13df. に関連付けられているファイル記述子を取得することができます
。ファイル記述子を直接使用すると、ファイルオブジェクトのメソッドが使用さ
れないため、データの内部バッファなどの性質は無視されることに注意してくだ
さい。

 -- の関数: os.close (fd)

     ファイル記述子 'fd' をクローズします。

          注釈: この関数は低水準の I/O 向けのもので、 *note os.open():
          f96. や *note pipe(): 1bc3. が返すファイル記述子に対して使用し
          なければなりません。 組み込み関数 *note open(): 318. や *note
          popen(): 31c. 、 *note fdopen(): 23dd. が返す "ファイルオブジ
          ェクト" を閉じるには、オブジェクトの *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: 2c2. is raised with *note errno: 1821. set to *note
     errno.EXDEV: 30ba.

     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, ‘os.copy_file_range()’ 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: 2199.: Linux >= 4.5 with glibc >= 2.27.

     Added in version 3.8.

 -- の関数: os.device_encoding (fd)

     'fd' に関連付けられたデバイスが端末 (ターミナル) に接続されている場
     合に、そのデバイスのエンコーディングを表す文字列を返します。端末に
     接続されていない場合、 *note None: 886. を返します。

     On Unix, if the *note Python UTF-8 Mode: 867. 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
     継承不可: 1100. です。

     Windows では、標準ストリーム (0: 標準入力、1: 標準出力、2: 標準エラ
     ー出力) を複製する場合、新しいファイル記述子は *note 継承可能:
     1100. です。

     *note Availability: 2199.: not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.dup2 (fd, fd2, inheritable=True)

     ファイル記述子 'fd' を 'fd2' に複製し、必要な場合には後者を先に閉じ
     ます。 'fd2' が返ります。 新しいファイル記述子はデフォルトでは
     *note 継承可能: 1100. で、'inheritable' が ‘False’ の場合は継承不可
     です。

     *note Availability: 2199.: 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 監査イベント: 1ccb.
     ‘os.chmod’ を送出します。

     *note Availability: 2199.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. for more information.

     バージョン 3.13 で変更: Added support on Windows.

 -- の関数: os.fchown (fd, uid, gid)

     'fd' で指定されたファイルの所有者 id およびグループ id を数値 'uid'
     および 'gid' に変更します。いずれかの id を変更せずにおくにはその値
     として -1 を指定します。*note chown(): 130a. を参照してください。
     Python 3.3 以降では ‘os.chown(fd, uid, gid)’ と等価です。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1ccb. ‘os.chown’ を送出します。

     *note Availability: 2199.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. for more information.

 -- の関数: os.fdatasync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。メタデータの更新は強制しません。

     *note Availability: 2199.: Unix, not macOS, not iOS.

 -- の関数: os.fpathconf (fd, name, /)

     開いているファイルに関連するシステム設定情報を返します。 'name' は
     取得する設定名を指定します。これは、いくつかの標準 (POSIX.1 、 Unix
     95 、 Unix 98 その他 ) で定義された定義済みのシステム値名の文字列で
     ある場合があります。プラットフォームによっては別の名前も定義されて
     います。ホストオペレーティングシステムの関知する名前は
     ‘pathconf_names’ 辞書で与えられています。このマップ型オブジェクトに
     含まれていない構成変数については、 'name' に整数を渡してもかまいま
     せん。

     'name' が不明の文字列である場合、 *note ValueError: 2ee. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1e2e.
     をエラー番号として *note OSError: 2c2. を送出します。

     Python 3.3 以降では ‘os.pathconf(fd, name)’ と等価です。

     *note Availability: 2199.: Unix.

 -- の関数: os.fstat (fd)

     ファイル記述子 'fd' の状態を取得します。*note stat_result: 16df. オ
     ブジェクトを返します。

     Python 3.3 以降では ‘os.stat(fd)’ と等価です。

     参考
     ....

     *note stat(): 26f. 関数。

 -- の関数: os.fstatvfs (fd, /)

     Return information about the filesystem containing the file
     associated with file descriptor 'fd' in a *note statvfs_result:
     30bc, like *note statvfs(): 1318.  As of Python 3.3, this is
     equivalent to ‘os.statvfs(fd)’.

     *note Availability: 2199.: Unix.

 -- の関数: os.fsync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。 Unix では、ネイティブの ‘fsync()’ 関数を、 Windows では
     ‘_commit()’ 関数を呼び出します。

     Python の *note ファイルオブジェクト: 13df. 'f' を使う場合、'f' の
     内部バッファを確実にディスクに書き込むために、まず ‘f.flush()’ を、
     その後 ‘os.fsync(f.fileno())’ を実行してください。

     *note Availability: 2199.: Unix, Windows.

 -- の関数: os.ftruncate (fd, length, /)

     ファイル記述子 'fd' に対応するファイルを、サイズが最長で 'length' バ
     イトになるように切り詰めます。Python 3.3 以降では ‘os.truncate(fd,
     length)’ と等価です。

     引数 ‘fd’, ‘length’ を指定して *note 監査イベント: 1ccb.
     ‘os.truncate’ を送出します。

     *note Availability: 2199.: Unix, Windows.

     バージョン 3.5 で変更: Windows サポートを追加しました。

 -- の関数: os.get_blocking (fd, /)

     記述子のブロッキングモードを取得します。 *note O_NONBLOCK: 103f. フ
     ラグが設定されている場合は ‘False’ で、フラグがクリアされている場合
     は ‘True’ です。

     *note set_blocking(): 103e. および *note
     socket.socket.setblocking(): 30bd. も参照してください。

     *note Availability: 2199.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. 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: 2199.: 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: 30be.、*note F_TLOCK: 30bf.、*note
     F_ULOCK: 30c0.、あるいは *note F_TEST: 30c1. のいずれか一つ) を指定
     します。'len' にはロックするファイルのセクションを指定します。

     引数 ‘fd’, ‘cmd’, ‘len’ を指定して *note 監査イベント: 1ccb.
     ‘os.lockf’ を送出します。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- データ: os.F_LOCK
 -- データ: os.F_TLOCK
 -- データ: os.F_ULOCK
 -- データ: os.F_TEST

     *note lockf(): 132f. がとる動作を指定するフラグです。

     *note Availability: 2199.: 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: 2199.: 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: 14a9. or ‘0’ - set 'pos' relative to the
          beginning of the file

        * *note SEEK_CUR: 14aa. or ‘1’ - set 'pos' relative to the
          current file position

        * *note SEEK_END: 14ab. or ‘2’ - set 'pos' relative to the end
          of the file

        * *note SEEK_HOLE: 30c2. - set 'pos' to the next data location,
          relative to 'pos'

        * *note SEEK_DATA: 30c3. - 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(): 1333. function and the *note
     seek(): 14a8. method on *note file-like objects: 13df, for whence
     to adjust the file position indicator.

     *note SEEK_SET: 14a9.

          Adjust the file position relative to the beginning of the
          file.

     *note SEEK_CUR: 14aa.

          Adjust the file position relative to the current file
          position.

     *note SEEK_END: 14ab.

          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(): 1333. function and the *note
     seek(): 14a8. method on *note file-like objects: 13df, 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: 2199.: 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 継承不可: 1100. です
     。

     For a description of the flag and mode values, see the C run-time
     documentation; flag constants (like *note O_RDONLY: 30c4. and *note
     O_WRONLY: 30c5.) are defined in the ‘os’ module.  In particular, on
     Windows adding *note O_BINARY: 30c6. is needed to open files in
     binary mode.

     この関数は 'dir_fd' パラメタで *note
     ディレクトリ記述子への相対パス: 1306. をサポートしています。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1ccb.
     ‘open’ を送出します。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

          注釈: This function is intended for low-level I/O. For normal
          usage, use the built-in function *note open(): 318, which
          returns a *note file object: 13df. with *note read(): 1544.
          and *note write(): edb. methods.  To wrap a file descriptor in
          a file object, use *note fdopen(): 23dd.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f8c. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(1) を参照してください)。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

以下の定数は *note open(): f96. 関数の '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: 128c. が追加されました
     。

 -- データ: 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 ‘O_EVTONLY’, ‘O_FSYNC’, ‘O_SYMLINK’ and
     ‘O_NOFOLLOW_ANY’ 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: 1178. を、それをサポートするシ
     ステムで追加しました。また、 *note O_TMPFILE: 1179. を追加しました
     (Linux Kernel 3.11 以降でのみ利用可能です)。

 -- の関数: os.openpty ()

     新しい擬似端末のペアを開きます。pty および tty を表すファイル記述子
     のペア ‘(master, slave)’ を返します。新しいファイル記述子は *note
     継承不可: 1100. です。(若干) 可搬性の高いアプローチには *note pty:
     b6. を使用してください。

     *note Availability: 2199.: Unix, not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe ()

     パイプを作成します。読み込み、書き込みに使うことの出来るファイル記
     述子のペア ‘(r, w)’ を返します。新しいファイル記述子は *note
     継承不可: 1100. です。

     *note Availability: 2199.: Unix, Windows.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe2 (flags, /)

     'flags' を設定したパイプをアトミックに作成します。'flags' には値
     *note O_NONBLOCK: 103f. と *note O_CLOEXEC: 128c. を一つ以上論理和
     指定できます。読み込み、書き込みに使うことの出来るファイル記述子の
     ペア ‘(r, w)’ を返します。

     *note Availability: 2199.: Unix, not WASI, not macOS, not iOS.

     Added in version 3.3.

 -- の関数: os.posix_fallocate (fd, offset, len, /)

     'fd' で指定されたファイルに対し、開始位置 'offset' から 'len' バイ
     ト分割り当てるに十分なディスクスペースを確保します。

     *note Availability: 2199.: Unix, not macOS, not iOS.

     Added in version 3.3.

 -- の関数: os.posix_fadvise (fd, offset, len, advice, /)

     データへアクセスする意思を、パターンを指定して宣言します。これによ
     りカーネルが最適化を行えるようになります。'advice' は 'fd' で指定さ
     れたファイルに対し、開始位置 'offset' から 'len' バイト分の領域に適
     用されます。'advice' には *note POSIX_FADV_NORMAL: 30dc.、*note
     POSIX_FADV_SEQUENTIAL: 30dd.、*note POSIX_FADV_RANDOM: 30de.、*note
     POSIX_FADV_NOREUSE: 30df.、*note POSIX_FADV_WILLNEED: 30e0.、または
     *note POSIX_FADV_DONTNEED: 30e1. のいずれか一つを指定します。

     *note Availability: 2199.: Unix, not macOS, not iOS.

     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(): f97. において、使われるであろうアクセスパタ
     ーンを指定する 'advice' に使用できるフラグです。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- の関数: os.pread (fd, n, offset, /)

     ファイル記述子の位置 'offset' から最大で 'n' バイトを読み出します。
     ファイルオフセットは変化しません。

     読み込んだバイト分のバイト列を返します。 'fd' が参照しているファイ
     ルの終端に達した場合、空のバイト列が返されます。

     *note Availability: 2199.: 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: 1100.  If
     the value *note O_CLOEXEC: 128c. is available on the system, it is
     added to 'oflag'.

     *note Availability: 2199.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.preadv (fd, buffers, offset, flags=0, /)

     ファイル記述子 'fd' の 'offset' の位置から、可変な *note bytes-like
     オブジェクト: 194. 'buffers' にオフセットを変更せずに読み込みます。
     データをそれぞれのバッファがいっぱいになるまで移し、いっぱいになっ
     たらシーケンスの次のバッファに処理を移し、残りのデータを読み込ませ
     ます。

     flags 引数にはゼロあるいは次のフラグのバイトごとの OR を取った結果
     が保持されています。

        - *note RWF_HIPRI: 30e2.

        - *note RWF_NOWAIT: 30e3.

     実際に読み込んだ合計バイト数を返します。この値は、すべてのオブジェ
     クトの容量の総量よりも小さくなることがあります。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 194f. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.readv(): d59. と *note os.pread(): d5a. の機能を統合します
     。

     *note Availability: 2199.: 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: 2754.

     *note Availability: 2199.: Linux >= 4.14.

     Added in version 3.7.

 -- データ: os.RWF_HIPRI

     優先度の高い読み込み・書き込み (read/write) フラグです。ブロックス
     トレージに対して、追加のリソースを必要とする一方で低レイテンシなデ
     バイスのポーリングを使うことを許可します。

     現状、Linuxでは、ファイル記述子を *note O_DIRECT: 30d7. フラグを指
     定したオープンした場合でのみ、この機能を利用できます。

     *note Availability: 2199.: 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: 2199.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.pwrite (fd, str, offset, /)

     'str' 中のバイト文字列をファイル記述子 'fd' の 'offset' の位置に書
     き込みます。ファイルオフセットを変化しません。

     実際に書き込まれたバイト数を返します。

     *note Availability: 2199.: 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: 194.  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: 30e4.

        - *note RWF_SYNC: 30e5.

        - *note RWF_APPEND: 1d8b.

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 194f. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.writev(): d5c. と *note os.pwrite(): d5d. の機能を統合しま
     す。

     *note Availability: 2199.: 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(): f96. の *note O_DSYNC: 30cb. と同等
     の効果を提供するフラグです。このフラグはシステムコールによって書き
     込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 2199.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_SYNC

     書き込みごとに *note os.open(): f96. の *note O_SYNC: 30cd. と同等
     の効果を提供するフラグです。このフラグはシステムコールによって書き
     込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 2199.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_APPEND

     Provide a per-write equivalent of the *note O_APPEND: 30c8. *note
     os.open(): f96. flag.  This flag is meaningful only for *note
     os.pwritev(): d5b, 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: 2199.: Linux >= 4.16.

     Added in version 3.10.

 -- の関数: os.read (fd, n, /)

     ファイル記述子 'fd' から 最大 'n' バイトを読み込みます。

     読み込んだバイト分のバイト列を返します。 'fd' が参照しているファイ
     ルの終端に達した場合、空のバイト列が返されます。

          注釈: This function is intended for low-level I/O and must be
          applied to a file descriptor as returned by *note os.open():
          f96. or *note pipe(): 1bc3.  To read a "file object" returned
          by the built-in function *note open(): 318. or by *note
          popen(): 31c. or *note fdopen(): 23dd, or *note sys.stdin:
          75f, use its *note read(): 20c8. or *note readline(): 1545.
          methods.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f8c. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(4) を参照してください)。

 -- の関数: os.readinto (fd, buffer, /)

     Read from a file descriptor 'fd' into a mutable *note buffer
     object: 262. 'buffer'.

     The 'buffer' should be mutable and *note bytes-like: 194.  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():
          f96. or *note os.pipe(): 1bc3.  To read a "file object"
          returned by the built-in function *note open(): 318, or *note
          sys.stdin: 75f, use its member functions, for example *note
          io.BufferedIOBase.readinto(): 18f8, *note
          io.BufferedIOBase.read(): 1544, or *note io.TextIOBase.read():
          20c8.

     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(): d09. が定義されているすべてのプ
     ラットフォームでサポートされています。

     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: 2199.: Unix, not WASI.

          注釈: *note sendfile(): d09. のより高水準のラッパについては
          *note socket.socket.sendfile(): 1061. を参照してください。

     Added in version 3.3.

     バージョン 3.9 で変更: 引数 'out' と 'in' は 'out_fd' と 'in_fd' に
     名前が変更されました。

 -- データ: os.SF_NODISKIO
 -- データ: os.SF_MNOWAIT
 -- データ: os.SF_SYNC

     実装がサポートしている場合 *note sendfile(): d09. 関数に渡すパラメ
     ーターです。

     *note Availability: 2199.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.SF_NOCACHE

     Parameter to the *note sendfile(): d09. function, if the
     implementation supports it.  The data won't be cached in the
     virtual memory and will be freed afterwards.

     *note Availability: 2199.: Unix, not WASI.

     Added in version 3.11.

 -- の関数: os.set_blocking (fd, blocking, /)

     指定されたファイル記述子のブロッキングモードを設定します。 ブロッキ
     ングが ‘False’ の場合 *note O_NONBLOCK: 103f. フラグを設定し、そう
     でない場合はクリアします。

     *note get_blocking(): 103d. および *note
     socket.socket.setblocking(): 30bd. も参照してください。

     *note Availability: 2199.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. 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: 30ea. 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: 30eb. 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: 30ec. 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: 2c2. is raised with *note
     errno: 1821. set to *note errno.EXDEV: 30ba.

     このコピーは、カーネルからユーザースペースにデータを転送した後カー
     ネルに戻すという追加のコスト無しに完了します。 加えて、追加の最適化
     ができるファイルシステムもあります。 このコピーはファイルが両方とも
     バイナリファイルとして開かれたかのように行われます。

     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: 2199.: 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: 194. '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(): 194f. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- の関数: os.tcgetpgrp (fd, /)

     'fd' (*note os.open(): f96. が返すオープンしたファイル記述子 ) で与
     えられる端末に関連付けられたプロセスグループを返します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.tcsetpgrp (fd, pg, /)

     'fd' (*note os.open(): f96. が返すオープンしたファイル記述子 ) で与
     えられる端末に関連付けられたプロセスグループを 'pg' に設定します。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.ttyname (fd, /)

     ファイル記述子 'fd' に関連付けられている端末デバイスを特定する文字
     列を返します。 'fd' が端末に関連付けられていない場合、例外が送出さ
     れます。

     *note Availability: 2199.: 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: 2199.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.write (fd, str, /)

     'str' のバイト列をファイル記述子 'fd' に書き出します。

     実際に書き込まれたバイト数を返します。

          注釈: This function is intended for low-level I/O and must be
          applied to a file descriptor as returned by *note os.open():
          f96. or *note pipe(): 1bc3.  To write a "file object" returned
          by the built-in function *note open(): 318. or by *note
          popen(): 31c. or *note fdopen(): 23dd, or *note sys.stdout:
          cd1. or *note sys.stderr: b37, use its *note write(): 20b7.
          method.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f8c. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(6) を参照してください)。

 -- の関数: os.writev (fd, buffers, /)

     'buffers' の内容をファイル記述子 'fd' へ書き出します。 'buffers' は
     *note bytes-like オブジェクト: 194. のシーケンスでなければなりませ
     ん。バッファは配列の順番で処理されます。最初のバッファの内容全体は
     2 番目のバッファに進む前に書き込まれ、その次も同様です。

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 194f. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 2199.: 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.17.1.6 ターミナルのサイズの問い合わせ
.......................................

Added in version 3.3.

 -- の関数: os.get_terminal_size (fd=STDOUT_FILENO, /)

     ターミナル (端末) のサイズ ‘(columns, lines)’ を、*note
     terminal_size: 2d78. 型のタプルで返します。

     オプションの引数 ‘fd’ には問い合わせるファイル記述子を指定します (デ
     フォルトは ‘STDOUT_FILENO’、または標準出力)。

     ファイル記述子が接続されていなかった場合、 *note OSError: 2c2. が送
     出されます。

     通常は高水準関数である *note shutil.get_terminal_size(): 131f. を使
     用してください。‘os.get_terminal_size’ は低水準の実装です。

     *note Availability: 2199.: Unix, Windows.

 -- クラス: os.terminal_size

     ターミナルウィンドウのサイズ ‘(columns, lines)’ を保持するタプルの
     サブクラスです。

      -- の属性: columns

          ターミナルウィンドウの横幅 (文字数) です。

      -- の属性: lines

          ターミナルウィンドウの高さ (文字数) です。


File: python.info,  Node: ファイル記述子の継承,  Prev: ターミナルのサイズの問い合わせ,  Up: ファイル記述子の操作

5.17.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*: 31d. 関数を使う場合、全ての継承可能なハンドルと全ての継承
可能なファイル記述子は引き継がれます。 *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: 2199.: Windows.

 -- の関数: os.set_handle_inheritable (handle, inheritable, /)

     指定したハンドルの「継承可能 (inheritable)」フラグをセットします。

     *note Availability: 2199.: Windows.


File: python.info,  Node: ファイルとディレクトリ,  Next: プロセス管理,  Prev: ファイル記述子の操作,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.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: 1319. を使うことで、そのプラットフォーム上で
     'path' にファイル記述子を指定できるかどうかを確認することができます
     。この機能が利用可能でない場合、 ‘os.supports_fd’ の利用は *note
     NotImplementedError: 369. 例外を送出します。

     その関数が引数に '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: 1313. で確認できます。利用で
     きない場合 *note NotImplementedError: 369. が送出されます。

   * '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: 1314. で確認
     できます。利用できない場合 *note NotImplementedError: 369. が送出さ
     れます。

 -- の関数: 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: 30f6. にします。
     ファイルアクセス権限 ( パーミッション ) を調べるには、 *note R_OK:
     30f7, *note W_OK: 30f8, *note X_OK: 30f9. から一つまたはそれ以上の
     フラグを論理和指定でとることもできます。アクセスが許可されている場
     合 *note True: e0b. を、そうでない場合 *note False: d2f. を返します
     。詳細は ‘access(2)(1)’ の Unix マニュアルページを参照してください
     。

     この関数は *note ディレクトリ記述子への相対パス: 1306. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     'effective_ids' が ‘True’ の場合、*note access(): 1308. は実
     uid/gid ではなく実効 uid/gid を使用してアクセス権を調べます。プラッ
     トフォームによっては 'effective_ids' がサポートされていない場合があ
     ります; サポートされているかどうかは *note
     os.supports_effective_ids: 131a. で確認できます。利用できない場合
     *note NotImplementedError: 369. が送出されます。

          注釈: ユーザーが、例えばファイルを開く権限を持っているかどうか
          を調べるために実際に *note open(): 318. を行う前に *note
          access(): 1308. を使用することはセキュリティホールの原因になり
          ます。なぜなら、調べた時点とオープンした時点との時間差を利用し
          てそのユーザーがファイルを不当に操作してしまうかもしれないから
          です。その場合は *note EAFP: 30fa. テクニックを利用するのが望
          ましいやり方です。例えば

               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(): 1308. が成功を示した時でも失
          敗することがあります。特にネットワークファイルシステムが通常の
          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(): 1308. で 'path' をテストする時に 'mode' 引数に渡す
     値です。上からそれぞれ、ファイルの存在、読み込み許可、書き込み許可
     、および実行許可になります。

 -- の関数: os.chdir (path)

     現在の作業ディレクトリを 'path' に設定します。

     この関数は *note ファイル記述子の指定: d57. をサポートしています。
     記述子は、オープンしているファイルではなく、オープンしているディレ
     クトリを参照していなければなりません。

     この関数は *note OSError: 2c2. やそのサブクラスである *note
     FileNotFoundError: 266, *note PermissionError: f42, *note
     NotADirectoryError: 1269. などの例外を送出することがあります。

     引数 ‘path’ を指定して *note 監査イベント: 1ccb. ‘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: 2d05.

        * *note stat.UF_IMMUTABLE: 2d06.

        * *note stat.UF_APPEND: 2d07.

        * *note stat.UF_OPAQUE: 2d08.

        * *note stat.UF_NOUNLINK: 2d09.

        * *note stat.UF_COMPRESSED: 2d0a.

        * *note stat.UF_HIDDEN: 2d0d.

        * *note stat.SF_ARCHIVED: 2d11.

        * *note stat.SF_IMMUTABLE: 2d12.

        * *note stat.SF_APPEND: 2d13.

        * *note stat.SF_NOUNLINK: 2d15.

        * *note stat.SF_SNAPSHOT: 2d16.

     この関数は *note シンボリックリンクをたどらない: 1307. をサポートし
     ています。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1ccb.
     ‘os.chflags’ を送出します。

     *note Availability: 2199.: 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: 2cf1.

        * *note stat.S_ISGID: 2cf2.

        * *note stat.S_ENFMT: 2cf4.

        * *note stat.S_ISVTX: 2cf5.

        * *note stat.S_IREAD: 2d01.

        * *note stat.S_IWRITE: 2d02.

        * *note stat.S_IEXEC: 2d03.

        * *note stat.S_IRWXU: 2cf6.

        * *note stat.S_IRUSR: 2cf7.

        * *note stat.S_IWUSR: 2cf8.

        * *note stat.S_IXUSR: 2cf9.

        * *note stat.S_IRWXG: 2cfa.

        * *note stat.S_IRGRP: 2cfb.

        * *note stat.S_IWGRP: 2cfc.

        * *note stat.S_IXGRP: 2cf3.

        * *note stat.S_IRWXO: 2cfd.

        * *note stat.S_IROTH: 2cfe.

        * *note stat.S_IWOTH: 2cff.

        * *note stat.S_IXOTH: 2d00.

     この関数は *note ファイル記述子の指定: d57. 、 *note
     ディレクトリ記述子への相対パス: 1306. 、および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

          注釈: Although Windows supports ‘chmod()’, 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
          プラットフォーム: 1bc9. for more information.

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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 ファイル記述子の指定: d57. 、 *note
     ディレクトリ記述子への相対パス: 1306. 、および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     数値 id の他に名前でも受け取る高水準関数の *note shutil.chown():
     548. を参照してください。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1ccb. ‘os.chown’ を送出します。

     *note Availability: 2199.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. for more information.

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd' と 'follow_symlinks' を追加しまし
     た。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.chroot (path)

     現在のプロセスのルートディレクトリを 'path' に変更します。

     *note Availability: 2199.: Unix, not WASI, not Android.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.fchdir (fd)

     現在の作業ディレクトリをファイル記述子 'fd' が表すディレクトリに変
     更します。記述子はオープンしているファイルではなく、オープンしたデ
     ィレクトリを参照していなければなりません。Python 3.3 以降では
     ‘os.chdir(fd)’ と等価です。

     引数 ‘path’ を指定して *note 監査イベント: 1ccb. ‘os.chdir’ を送出
     します。

     *note Availability: 2199.: Unix.

 -- の関数: os.getcwd ()

     現在の作業ディレクトリを表す文字列を返します。

 -- の関数: os.getcwdb ()

     現在の作業ディレクトリを表すバイト列を返します。

     バージョン 3.8 で変更: この関数は Windows において ANSI コードペー
     ジ ではなく UTF-8 エンコーディングを使うようになりました: 変更の背
     景については PEP 529(2) をご覧ください。この関数は Windows において
     非推奨になりません。

 -- の関数: os.lchflags (path, flags)

     'path' のフラグを数値 'flags' に設定します。*note chflags(): 1309.
     に似ていますが、シンボリックリンクをたどりません。Python 3.3 以降で
     は ‘os.chflags(path, flags, follow_symlinks=False)’ と等価です。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1ccb.
     ‘os.chflags’ を送出します。

     *note Availability: 2199.: 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 監査イベント: 1ccb.
     ‘os.chmod’ を送出します。

     *note Availability: 2199.: 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 監査イベント:
     1ccb. ‘os.chown’ を送出します。

     *note Availability: 2199.: 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: 1306, and *note not following symlinks: 1307.  The
     default value of 'follow_symlinks' is ‘False’ on Windows.

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘os.link’ を送出します。

     *note Availability: 2199.: 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: e4f. インター
     フェースを介した) ‘bytes’ 型の場合、戻り値のファイル名も ‘bytes’ 型
     になります; それ以外の場合、ファイル名は ‘str’ 型です。

     この関数は *note ファイル記述子の指定: d57. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1ccb. ‘os.listdir’ を送
     出します。

          注釈: ‘文字列型’ のファイル名を ‘バイト列型’ にエンコードする
          には、*note fsencode(): e53. を使用します。

     参考
     ....

     ディレクトリエントリに加えてファイル属性情報も返す *note scandir():
     c58. 関数の方が、多くの一般的な用途では使い勝手が良くなります。

     バージョン 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: 2c2. if an error occurs collecting the
     drive names.

     Raises an *note auditing event: 1ccb. ‘os.listdrives’ with no
     arguments.

     *note Availability: 2199.: 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: 2c2. if the volume is not recognized or if an
     error occurs collecting the paths.

     Raises an *note auditing event: 1ccb. ‘os.listmounts’ with argument
     ‘volume’.

     *note Availability: 2199.: 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: 2c2. if an error occurs collecting the
     volumes.

     Raises an *note auditing event: 1ccb. ‘os.listvolumes’ with no
     arguments.

     *note Availability: 2199.: 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(): 26f, but does not follow symbolic
     links.  Return a *note stat_result: 16df. object.

     シンボリックリンクをサポートしていないプラットフォームでは *note
     stat(): 26f. の別名です。

     Python 3.3 以降では ‘os.stat(path, dir_fd=dir_fd,
     follow_symlinks=False)’ と等価です。

     この関数は *note ディレクトリ記述子への相対パス: 1306. もサポートす
     ることができます。

     参考
     ....

     *note stat(): 26f. 関数。

     バージョン 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(): 26f.

 -- の関数: os.mkdir (path, mode=0o777, *, dir_fd=None)

     ディレクトリ 'path' を数値モード 'mode' で作成します。

     If the directory already exists, *note FileExistsError: 1225. is
     raised.  If a parent directory in the path does not exist, *note
     FileNotFoundError: 266. 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 ディレクトリ記述子への相対パス: 1306. もサポートす
     ることができます。

     一時ディレクトリを作成することもできます : *note tempfile: e6. モジ
     ュールの *note tempfile.mkdtemp(): 52d. 関数を参照してください。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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: 30fd. for
     how it is interpreted.  To set the file permission bits of any
     newly created parent directories you can set the umask before
     invoking ‘makedirs()’.  The file permission bits of existing parent
     directories are not changed.

     'exist_ok' の値が ‘False’ の場合 (デフォルト)、対象のディレクトリが
     すでに存在すると *note FileExistsError: 1225. を送出します。

          注釈: 作成するパス要素に *note pardir: 30fe. (UNIX では "..")
          が含まれる場合、*note makedirs(): 52c. は混乱します。

     この関数は UNC パスを正しく扱えるようになりました。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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 ディレクトリ記述子への相対パス: 1306. もサポートす
     ることができます。

     FIFO は通常のファイルのようにアクセスできるパイプです。 FIFO は ( 例
     えば *note os.unlink(): 1311. を使って ) 削除されるまで存在しつづけ
     ます。一般的に、 FIFO は " クライアント " と " サーバー " 形式のプ
     ロセス間でランデブーを行うために使われます : この時、サーバーは
     FIFO を読み込み用に、クライアントは書き出し用にオープンします。
     *note mkfifo(): f94. は FIFO をオープンしない -- 単にランデブーポイ
     ントを作成するだけ -- なので注意してください。

     *note Availability: 2199.: Unix, not WASI.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.mknod (path, mode=0o600, device=0, *, dir_fd=None)

     Create a filesystem node (file, device special file or named pipe)
     named 'path'.  'mode' specifies both the permissions to use and the
     type of node to be created, being combined (bitwise OR) with one of
     ‘stat.S_IFREG’, ‘stat.S_IFCHR’, ‘stat.S_IFBLK’, and ‘stat.S_IFIFO’
     (those constants are available in *note stat: d6.).  For
     ‘stat.S_IFCHR’ and ‘stat.S_IFBLK’, 'device' defines the newly
     created device special file (probably using *note os.makedev():
     19c0.), otherwise it is ignored.

     この関数は *note ディレクトリ記述子への相対パス: 1306. もサポートす
     ることができます。

     *note Availability: 2199.: 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: 2ee. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1e2e.
     をエラー番号として *note OSError: 2c2. を送出します。

     この関数は *note ファイル記述子の指定: d57. をサポートしています。

     *note Availability: 2199.: Unix.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- データ: os.pathconf_names

     *note pathconf(): 1317. および *note fpathconf(): 30bb. が受理する
     システム設定名を、ホストオペレーティングシステムで定義されている整
     数値に対応付けている辞書です。この辞書はシステムでどの設定名が定義
     されているかを知るために利用できます。

     *note Availability: 2199.: 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: e4f. 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 ディレクトリ記述子への相対パス: 1306. もサポートす
     ることができます。

     When trying to resolve a path that may contain links, use *note
     realpath(): 264. to properly handle recursion and platform
     differences.

     *note Availability: 2199.: 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: 2c2. is raised.  Use *note rmdir(): 130f. to remove
     directories.  If the file does not exist, a *note
     FileNotFoundError: 266. is raised.

     この関数は *note ディレクトリ記述子への相対パス: 1306. をサポートし
     ています。

     Windows では、使用中のファイルを削除しようとすると例外を送出します;
     Unixでは、ディレクトリエントリは削除されますが、記憶装置上に割り当
     てられたファイル領域は元のファイルが使われなくなるまで残されます。

     この関数は意味論的に *note unlink(): 1311. と同一です。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘os.remove’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.removedirs (name)

     再帰的なディレクトリ削除関数です。 *note rmdir(): 130f. と同じよう
     に動作しますが、末端ディレクトリがうまく削除できるかぎり、 *note
     removedirs(): 3100. は 'path' に現れる親ディレクトリをエラーが送出
     されるまで ( このエラーは通常、指定したディレクトリの親ディレクトリ
     が空でないことを意味するだけなので無視されます ) 順に削除することを
     試みます。例えば、 ‘os.removedirs('foo/bar/baz')’ では最初にディレ
     クトリ ‘'foo/bar/baz'’ を削除し、次に ‘'foo/bar'’ さらに ‘'foo'’ を
     それらが空ならば削除します。末端のディレクトリが削除できなかった場
     合には *note OSError: 2c2. が送出されます。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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: 2c2. subclass in a
     number of cases:

     On Windows, if 'dst' exists a *note FileExistsError: 1225. is
     always raised.  The operation may fail if 'src' and 'dst' are on
     different filesystems.  Use *note shutil.move(): c55. 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: 1268. or a *note NotADirectoryError:
     1269. 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: 2c2. 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 ディレクトリ記述子への相対パス: 1306. をサポートしています
     。

     対象の上書きがクロスプラットフォームになる場合は *note replace():
     130e. を使用してください。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘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(): 130d. のように動作しますが、新たなパス名を持つファイルを
     配置するために必要な途中のディレクトリ構造をまず作成しようと試みま
     す。名前変更の後、元のファイル名のパス要素は *note removedirs():
     3100. を使って右側から順に削除されます。

          注釈: この関数はコピー元の末端のディレクトリまたはファイルを削
          除する権限がない場合には失敗します。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘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: 2c2. が送出されます。
     'dst' が存在し、かつファイルの場合、ユーザーの権限がある限り暗黙の
     うちに置き換えられます。'src' と 'dst' が異なるファイルシステム上に
     あると失敗することがあります。ファイル名の変更が成功する場合はアト
     ミック操作となります (これは POSIX 要求仕様です)。

     この関数は 'src_dir_fd' と 'dst_dir_fd' のどちらかまたは両方の指定
     に *note ディレクトリ記述子への相対パス: 1306. をサポートしています
     。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1ccb. ‘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: 266. or an *note
     OSError: 2c2. is raised respectively.  In order to remove whole
     directory trees, *note shutil.rmtree(): 354. can be used.

     この関数は *note ディレクトリ記述子への相対パス: 1306. をサポートし
     ています。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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(): 1316. の代わりに *note scandir(): c58. を使用する
     と、ファイルタイプや属性情報も必要とするコードのパフォーマンスが大
     幅に向上します。これは、オペレーティングシステムがディレクトリのス
     キャン中にこの情報を提供した場合、*note os.DirEntry: 6c3. オブジェ
     クトがその情報を公開するからです。すべての ‘os.DirEntry’ メソッドは
     システムコールを実行する場合がありますが、*note is_dir(): 3102. と
     *note is_file(): f88. は、通常はシンボリックリンクにしかシステムコ
     ールを必要としません。*note os.DirEntry.stat(): 1acc. は、Unix 上で
     は常にシステムコールを必要としますが、Windows ではシンボリックリン
     ク用にシステムコールを一つ必要とするだけです。

     'path' may be a *note path-like object: 5a1.  If 'path' is of type
     ‘bytes’ (directly or indirectly through the *note PathLike: e4f.
     interface), the type of the *note name: 3103. and *note path: 1a5a.
     attributes of each *note os.DirEntry: 6c3. will be ‘bytes’; in all
     other circumstances, they will be of type ‘str’.

     この関数は *note ファイル記述子の指定: d57. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1ccb. ‘os.scandir’ を送
     出します。

     *note scandir(): c58. イテレータは、 *note コンテキストマネージャ:
     1e3. プロトコルをサポートし、次のメソッドを持ちます。

      -- メソッド: scandir.close ()

          イテレータを閉じ、獲得した資源を開放します。

          この関数は、イテレータがすべて消費されるか、ガーベージコレクト
          された、もしくはイテレート中にエラーが発生した際に自動的に呼び
          出されます。しかし、 *note with: 187. 文を用いるか、明示的に呼
          び出すことを推奨します。

          Added in version 3.6.

     次の単純な例では、*note scandir(): c58. を使用して、指定した '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(): c58. 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:
     1e3. protocol and the *note close(): ebc. method.  If a *note
     scandir(): c58. 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 ファイル記述子の指定: d57. の
     サポートが追加されました。

 -- クラス: os.DirEntry

     ディレクトリエントリのファイルパスとその他のファイル属性を公開する
     ために、*note scandir(): c58. が yield するオブジェクトです。

     *note scandir(): c58. は、追加のシステムコールを実行することなく、
     この情報をできるだけ多く提供します。‘stat()’ または ‘lstat()’ シス
     テムコールが実行された場合、‘os.DirEntry’ オブジェクトは結果をキャ
     ッシュします。

     ‘os.DirEntry’ インスタンスは、寿命の長いデータ構造に保存されること
     は想定されていません。ファイルメタデータが変更された場合や、 *note
     scandir(): c58. が呼び出されてから長時間が経過した場合は、
     ‘os.stat(entry.path)’ を呼び出して最新の情報を取得してください。

     ‘os.DirEntry’ のメソッドはオペレーティングシステムコールを実行する
     場合があるため、それらは *note OSError: 2c2. も送出する場合がありま
     す。エラーを細かく制御する必要がある場合、 ‘os.DirEntry’ のメソッド
     の一つの呼び出し時に ‘OSError’ を捕捉して、適切な処理を行うことがで
     きます。

     To be directly usable as a *note path-like object: 5a1,
     ‘os.DirEntry’ implements the *note PathLike: e4f. interface.

     ‘DirEntry’ objects are *note generic: 2429. over the type of the
     path (*note str: 16a. or *note bytes: 193.).

     ‘os.DirEntry’ インスタンスの属性とメソッドは以下の通りです:

      -- の属性: name

          *note scandir(): c58. の 'path' 引数に対して相対的な、エントリ
          のベースファイル名です。

          The *note name: 307e. attribute will be ‘bytes’ if the *note
          scandir(): c58. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): e52. 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(): c58. 'path' argument.  The path is
          only absolute if the ‘scandir()’ 'path' argument was absolute.
          If the ‘scandir()’ 'path' argument was a *note file
          descriptor: d57, the *note path: a6. attribute is the same as
          the *note name: 307e. attribute.

          The *note path: a6. attribute will be ‘bytes’ if the *note
          scandir(): c58. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): e52. 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(): 2cd8. と共に *note os.stat(): 26f. を呼
          び出してください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、シンボリックリンク以外では、
          Windows も Unix もシステムコールを必要としません。ただし、
          ‘dirent.d_type == DT_UNKNOWN’ を返す、ネットワークファイルシス
          テムなどの特定の Unix ファイルシステムは例外です。項目がシンボ
          リックリンクの場合、'follow_symlinks' が ‘False’ の場合を除き
          、シンボリックリンクをたどるためにシステムコールが必要となりま
          す。

          このメソッドは *note PermissionError: f42. のような *note
          OSError: 2c2. を送出することがありますが、 *note
          FileNotFoundError: 266. は捕捉され送出されません。

      -- メソッド: is_file (*, follow_symlinks=True)

          この項目がファイルまたはファイルへのシンボリックリンクである場
          合、 ‘True’ を返します。項目がディレクトリやファイル以外の項目
          へのシンボリックリンクである場合や、もはや存在しない場合は
          ‘False’ を返します。

          'follow_symlinks' が ‘False’ の場合、項目がファイル (シンボリ
          ックリンクはたどりません) の場合にのみ ‘True’ を返します。項目
          がディレクトリやその他のファイル以外の項目である場合や、項目が
          もはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。キャッ
          シュ、システムコール、例外は、*note is_dir(): 3102. と同様に行
          われます。

      -- メソッド: is_symlink ()

          この項目がシンボリックリンクの場合 (たとえ破損していても)、
          ‘True’ を返します。項目がディレクトリやあらゆる種類のファイル
          の場合、またはもはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。 最新の
          情報をフェッチするには *note os.path.islink(): c05. を呼び出し
          てください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、Windows も Unix もシステムコ
          ールを必要としません。ただし、‘dirent.d_type == DT_UNKNOWN’ を
          返す、ネットワークファイルシステムなどの特定の Unix ファイルシ
          ステムは例外です。

          このメソッドは *note PermissionError: f42. のような *note
          OSError: 2c2. を送出することがありますが、 *note
          FileNotFoundError: 266. は捕捉され送出されません。

      -- メソッド: 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: 16df. オブジェクトを返します。こ
          のメソッドは、デフォルトでシンボリックリンクをたどります。シン
          ボリックリンクを開始するには、 ‘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: 16df. の ‘st_ino’ 、 ‘st_dev’
          、 ‘st_nlink’ 属性は常にゼロに設定されます。これらの属性を取得
          するには、 *note os.stat(): 26f. を呼び出します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。
          'follow_symlinks' が ‘True’ の場合と ‘False’ の場合とでは、別
          のオブジェクトにキャッシュされます。最新の情報を取得するには、
          *note os.stat(): 26f. を呼び出してください。

     Note that there is a nice correspondence between several attributes
     and methods of ‘os.DirEntry’ and of *note pathlib.Path: 268.  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: e4f. インターフェースをサポ
     ートしました。Windowsで *note bytes: 193. パスをサポートしました。

     バージョン 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: e4f. interface - or as an open file
     descriptor.  Return a *note stat_result: 16df. object.

     この関数は通常はシンボリックリンクをたどります。シンボリックリンク
     に対して stat したい場合は ‘follow_symlinks=False’ とするか、 *note
     lstat(): 6c8. を利用してください。

     この関数は *note ファイル記述子の指定: d57. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     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(): 264.
     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(): f90. と *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():
     26f, *note os.fstat(): f90. 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:
          310b, *note st_mtime: 2f8f, *note st_ctime: 310c. and *note
          st_birthtime: 3110. attributes depend on the operating system
          and the file system.  For example, on Windows systems using
          the FAT32 file systems, ‘st_mtime’ has 2-second resolution,
          and ‘st_atime’ has only 1-day resolution.  See your operating
          system documentation for details.

          Similarly, although *note st_atime_ns: 310d, *note
          st_mtime_ns: 310e, *note st_ctime_ns: 310f. and *note
          st_birthtime_ns: 3111. 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: 310b, *note st_mtime:
          2f8f, *note st_ctime: 310c. and *note st_birthtime: 3110.
          cannot preserve all of it, and as such will be slightly
          inexact.  If you need the exact timestamps you should always
          use ‘st_atime_ns’, ‘st_mtime_ns’, ‘st_ctime_ns’ and
          ‘st_birthtime_ns’.

     (Linux のような ) 一部の Unix システムでは、以下の属性が利用できる
     場合があります :

      -- の属性: st_blocks

          ファイルに対して割り当てられている 512 バイトのブロックの数で
          す。ファイルにホール (hole) が含まれている場合、*note st_size:
          310a./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: 103c. has the *note
          FILE_ATTRIBUTE_REPARSE_POINT: 2d25. set, this field contains
          the tag identifying the type of reparse point.  See the *note
          IO_REPARSE_TAG_*: 2d2a. 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 ‘stat_result’ 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: c03, *note st_ino: 3105, *note st_dev: 3106,
     *note st_nlink: 3107, *note st_uid: 3108, *note st_gid: 3109, *note
     st_size: 310a, *note st_atime: 310b, *note st_mtime: 2f8f, *note
     st_ctime: 310c.  More items may be added at the end by some
     implementations.  For compatibility with older Python versions,
     accessing ‘stat_result’ as a tuple always returns integers.

     バージョン 3.5 で変更: Windows now returns the file index as *note
     st_ino: 3105. when available.

     バージョン 3.7 で変更: Added the *note st_fstype: d5f. member to
     Solaris/derivatives.

     バージョン 3.8 で変更: Added the *note st_reparse_tag: c04. member
     on Windows.

     バージョン 3.8 で変更: On Windows, the *note st_mode: c03. member
     now identifies special files as ‘S_IFCHR’, ‘S_IFIFO’ or ‘S_IFBLK’
     as appropriate.

     バージョン 3.12 で変更: On Windows, *note st_ctime: 310c. 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: 3110. for the
     creation time.

     On Windows, *note st_ino: 3105. 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: 182a. no longer returns a value.
     Previously it would contain the same as *note st_dev: 3106, which
     was incorrect.

     Added the *note st_birthtime: 3110. member on Windows.

 -- の関数: os.statvfs (path)

     Perform a ‘statvfs(3)(9)’ system call on the given path.  The
     return value is a *note statvfs_result: 30bc. whose attributes
     describe the filesystem on the given path and correspond to the
     members of the ‘statvfs’ structure.

     この関数は *note ファイル記述子の指定: d57. をサポートしています。

     *note Availability: 2199.: Unix.

     バージョン 3.3 で変更: 'path' へのオープン・ファイル記述子の指定を
     サポートしました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- クラス: os.statvfs_result

     Filesystem statistics returned by *note os.statvfs(): 1318. and
     *note os.fstatvfs(): f91.  See ‘statvfs(3)(10)’ for more details.

      -- の属性: f_bsize

          Block size.

      -- の属性: f_frsize

          Fragment size.

      -- の属性: f_blocks

          Number of *note f_frsize: 311a. sized blocks the filesystem
          can contain.

      -- の属性: f_bfree

          Number of free blocks.

      -- の属性: f_bavail

          Number of free blocks for unprivileged users.

      -- の属性: f_files

          Number of file entries, inodes, the filesystem can contain.

      -- の属性: f_ffree

          Number of free files entries.

      -- の属性: f_favail

          Number of free file entries for unprivileged users.

      -- の属性: f_flag

          Bit-mask of mount flags.  The following flags are defined:
          *note ST_RDONLY: 3122, *note ST_NOSUID: 3123, *note ST_NODEV:
          3124, *note ST_NOEXEC: 3125, *note ST_SYNCHRONOUS: 3126, *note
          ST_MANDLOCK: 3127, *note ST_WRITE: 3128, *note ST_APPEND:
          3129, *note ST_IMMUTABLE: 312a, *note ST_NOATIME: 312b, *note
          ST_NODIRATIME: 312c, and *note ST_RELATIME: 312d.

      -- の属性: f_namemax

          Filesystem max filename length.  OS specific limitations such
          as *note Windows MAX_PATH: e3f. and those described in Linux
          ‘pathname(7)(11)’ may exist.

      -- の属性: f_fsid

          Filesystem ID.

          Added in version 3.7.

The following flags are used in *note statvfs_result.f_flag: 3121.

 -- データ: os.ST_RDONLY

     Read-only filesystem.

     Added in version 3.2.

 -- データ: os.ST_NOSUID

     Setuid/setgid bits are disabled or not supported.

     Added in version 3.2.

 -- データ: os.ST_NODEV

     Disallow access to device special files.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_NOEXEC

     Disallow program execution.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_SYNCHRONOUS

     Writes are synced at once.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_MANDLOCK

     Allow mandatory locks on an FS.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_WRITE

     Write on file/directory/symlink.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_APPEND

     Append-only file.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_IMMUTABLE

     Immutable file.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_NOATIME

     Do not update access times.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_NODIRATIME

     Do not update directory access times.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.ST_RELATIME

     Update atime relative to mtime/ctime.

     *note Availability: 2199.: Linux.

     Added in version 3.4.

 -- データ: os.supports_dir_fd

     A *note set: 185. 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(): 26f. 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: 185. object indicating whether *note os.access():
     1308. 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 ‘os.access()’; otherwise it will be
     empty.

     This expression evaluates to ‘True’ if *note os.access(): 1308.
     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: 185. 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: 185. 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(): 26f. 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 ディレクトリ記述子への相対パス: 1306. をサポートし
     ています。

          注釈: 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: 2c2. が送出されます。

     引数 ‘src’, ‘dst’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘os.symlink’ を送出します。

     *note Availability: 2199.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1bc9. 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: 2199.: Unix.

     Added in version 3.3.

 -- の関数: os.truncate (path, length)

     'path' に対応するファイルを、サイズが最大で 'length' バイトになるよ
     う切り詰めます。

     この関数は *note ファイル記述子の指定: d57. をサポートしています。

     引数 ‘path’, ‘length’ を指定して *note 監査イベント: 1ccb.
     ‘os.truncate’ を送出します。

     *note Availability: 2199.: 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(): 130c. と等価
     です。‘unlink’ の名前は伝統的な Unix の関数名です。詳細は
     ‘remove()’ のドキュメントを参照してください。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1ccb.
     ‘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(): 1312. は 2 つの任意引数 'times' と 'ns' をとります。
     これらは 'path' に設定する時刻を指定し、以下のように使用されます:

        - 'ns' を指定する場合、ナノ秒を表す整数値をメンバーとして使用し
          て、 ‘(atime_ns, mtime_ns)’ の形式の 2 要素タプルを指定する必
          要があります。

        - If 'times' is not ‘None’, it must be a 2-tuple of the form
          ‘(atime, mtime)’ where each member is an int or float
          expressing seconds.

        - 'times' が ‘None’ で、 'ns' が指定されていない場合、これは両方
          の時間を現在時刻として ‘ns=(atime_ns, mtime_ns)’ を指定するこ
          とと等価です。

     'times' と 'ns' の両方にタプルが指定されるとエラーになります。

     ここで設定した時刻が、後に *note stat(): 26f. の呼び出し時正確に返
     されない場合があります。これはオペレーティングシステムが記録するア
     クセスおよび修正時刻の精度に依存しています; ‘stat()’ を参照してくだ
     さい。正確な時刻を保持する最善の方法は、*note utime(): 1312. で
     'ns' 引数を指定し、‘os.stat()’ の返り値オブジェクトから
     'st_atime_ns' および 'st_mtime_ns' フィールドを使用することです。

     この関数は *note ファイル記述子の指定: d57. 、 *note
     ディレクトリ記述子への相対パス: 1306. 、および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     引数 ‘path’, ‘times’, ‘ns’, ‘dir_fd’ を指定して *note 監査イベント:
     1ccb. ‘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: 1b7e. やスライスを使った代入で )
     変更でき、 *note walk(): 6d0. は 'dirnames' に残っているサブディレ
     クトリ内のみを再帰します。これにより、検索を省略したり、特定の訪問
     順序を強制したり、呼び出し側が ‘walk()’ を再開する前に、呼び出し側
     が作った、または名前を変更したディレクトリを、 ‘walk()’ に知らせた
     りすることができます。 'topdown' が ‘False’ のときに 'dirnames' を
     変更しても効果はありません。ボトムアップモードでは 'dirpath' 自身が
     生成される前に 'dirnames' 内のディレクトリの情報が生成されるからで
     す。

     デフォルトでは、 *note scandir(): c58. 呼び出しからのエラーは無視さ
     れます。オプション引数の 'onerror' を指定する場合は関数でなければな
     りません ; この関数は単一の引数として *note OSError: 2c2. インスタ
     ンスを伴って呼び出されます。この関数でエラーを報告して走査を継続し
     たり、例外を送出して走査を中止したりできます。ファイル名は例外オブ
     ジェクトの ‘filename’ 属性として利用できます。

     デフォルトでは、 *note walk(): 6d0. はディレクトリへのシンボリック
     リンクをたどりません。 'followlinks' に ‘True’ を指定すると、ディレ
     クトリへのシンボリックリンクをサポートしているシステムでは、シンボ
     リックリンクの指しているディレクトリを走査します。

          注釈: 'followlinks' に ‘True’ を指定すると、シンボリックリンク
          が親ディレクトリを指していた場合に、無限ループになることに注意
          してください。 *note walk(): 6d0. はすでにたどったディレクトリ
          を管理したりはしません。

          注釈: 相対パスを渡した場合、 *note walk(): 6d0. が再開されるま
          での間に現在の作業ディレクトリを変更しないでください。
          ‘walk()’ はカレントディレクトリを変更しませんし、呼び出し側も
          カレントディレクトリを変更しないと仮定しています。

     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(): 354. の単純な実装) では、ツリーをボ
     トムアップで走査することが不可欠になります; *note rmdir(): 130f. は
     ディレクトリが空になるまで削除を許さないからです:

          # 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
     監査イベント: 1ccb. ‘os.walk’ を送出します。

     バージョン 3.5 で変更: この関数は、今では *note os.listdir(): 1316.
     ではなく *note os.scandir(): c58. を呼び出します。これにより、
     *note os.stat(): 26f. の呼び出し回数を削減でき、動作が高速化します
     。

     バージョン 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 ディレクトリ記述子への相対パス: 1306. および
     *note シンボリックリンクをたどらない: 1307. をサポートしています。
     ただし、他の関数と異なり、*note fwalk(): d56. での
     'follow_symlinks' のデフォルト値は ‘False’ になることに注意してくだ
     さい。

          注釈: *note fwalk(): d56. はファイル記述子を yield するため、
          それらが有効なのは次のイテレートステップまでです。それ以後も保
          持したい場合は *note dup(): 1e1e. などを使って複製して使用して
          ください。

     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(): 130f. はディレクトリが空になるまで削除を許さないから
     です

          # 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 監査イベント: 1ccb. ‘os.fwalk’ を送出します。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: Added support for *note bytes: 193. 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: 1100.

     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: 2199.: 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(): c02.

     *note Availability: 2199.: 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(): f99. and *note write(): f9f. with a
     buffer size of 8, *note select(): fa4, *note poll(): 3141. and
     similar.  See man page ‘eventfd(2)(12)’ for more information.  By
     default, the new file descriptor is *note non-inheritable: 1100.

     '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: 1bb7, *note
     EFD_NONBLOCK: 1bb8, and *note EFD_SEMAPHORE: 1bb9.

     If *note EFD_SEMAPHORE: 1bb9. is specified and the event counter is
     non-zero, *note eventfd_read(): 3142. returns 1 and decrements the
     counter by one.

     If *note EFD_SEMAPHORE: 1bb9. is not specified and the event
     counter is non-zero, *note eventfd_read(): 3142. returns the
     current event counter value and resets the counter to zero.

     If the event counter is zero and *note EFD_NONBLOCK: 1bb8. is not
     specified, *note eventfd_read(): 3142. blocks.

     *note eventfd_write(): 3143. 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: 2199.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.10.

 -- の関数: os.eventfd_read (fd)

     Read value from an *note eventfd(): a1d. file descriptor and return
     a 64 bit unsigned int.  The function does not verify that 'fd' is
     an ‘eventfd()’.

     *note Availability: 2199.: Linux >= 2.6.27

     Added in version 3.10.

 -- の関数: os.eventfd_write (fd, value)

     Add value to an *note eventfd(): a1d. file descriptor.  'value'
     must be a 64 bit unsigned int.  The function does not verify that
     'fd' is an ‘eventfd()’.

     *note Availability: 2199.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_CLOEXEC

     Set close-on-exec flag for new *note eventfd(): a1d. file
     descriptor.

     *note Availability: 2199.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_NONBLOCK

     Set *note O_NONBLOCK: 103f. status flag for new *note eventfd():
     a1d. file descriptor.

     *note Availability: 2199.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_SEMAPHORE

     Provide semaphore-like semantics for reads from an *note eventfd():
     a1d. file descriptor.  On read the internal counter is decremented
     by one.

     *note Availability: 2199.: 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/statvfs(3)

   (10) https://manpages.debian.org/statvfs(3)

   (11) https://manpages.debian.org/pathname(7)

   (12) https://manpages.debian.org/eventfd(2)


File: python.info,  Node: Timer File Descriptors,  Next: Linux 拡張属性,  Up: ファイルとディレクトリ

5.17.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 ‘timerfd_create()’ supports:

        - *note read(): f99.

        - *note select(): fa4.

        - *note poll(): 3141.

     The file descriptor's *note read(): f99. method can be called with
     a buffer size of 8.  If the timer has already expired one or more
     times, ‘read()’ returns the number of expirations with the host's
     endianness, which may be converted to an *note int: 19c. by
     ‘int.from_bytes(x, byteorder=sys.byteorder)’.

     *note select(): fa4. and *note poll(): 3141. can be used to wait
     until timer expires and the file descriptor is readable.

     'clockid' must be a valid *note clock ID: 3145, as defined in the
     *note time: f4. module:

        - *note time.CLOCK_REALTIME: 8aa.

        - *note time.CLOCK_MONOTONIC: 8a9.

        - *note time.CLOCK_BOOTTIME: d8b. (Since Linux 3.15 for
          timerfd_create)

     If 'clockid' is *note time.CLOCK_REALTIME: 8aa, 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: 8a9, 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: d8b, same as *note
     time.CLOCK_MONOTONIC: 8a9. 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():
     f99. blocks until the timer expires.  If it is set as a flag,
     ‘read()’ doesn't block, but If there hasn't been an expiration
     since the last call to read, ‘read()’ raises *note OSError: 2c2.
     with ‘errno’ is set to *note errno.EAGAIN: 2754.

     *note TFD_CLOEXEC: 525. is always set by Python automatically.

     The file descriptor must be closed with *note os.close(): d6f. when
     it is no longer needed, or else the file descriptor will be leaked.

     参考
     ....

     The ‘timerfd_create(2)(1)’ man page.

     *note Availability: 2199.: 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: 2c2.
     exception with ‘errno’ set to *note errno.EINVAL: 1e2e.

     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: 197.  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: 2c2. with ‘errno’ set to *note errno.EINVAL: 1e2e.

     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: 8aa, 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: 2199.: 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
     ‘timerfd_settime()’.

     *note Availability: 2199.: 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: 2199.: 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: 2199.: 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: 103f. status flag for the new timer file
     descriptor.  If *note TFD_NONBLOCK: 524. is not set as a flag,
     *note read(): f99. blocks.

     *note Availability: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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.17.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: e4f. interface).  If it is
     str, it is encoded with the filesystem encoding.

     この関数は *note ファイル記述子の指定: d57. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1ccb.
     ‘os.getxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 5a1. を受け付けるようになりました。

 -- の関数: os.listxattr (path=None, *, follow_symlinks=True)

     'path' の拡張ファイルシステム属性のリストを返します。リスト内の属性
     はファイルシステムのエンコーディングでデコードされた文字列で表され
     ます。'path' が ‘None’ の場合、*note listxattr(): 1321. はカレント
     ディレクトリを調べます。

     この関数は *note ファイル記述子の指定: d57. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     引数 ‘path’ を指定して *note 監査イベント: 1ccb. ‘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: e4f. interface).  If it is a string, it is
     encoded with the *note filesystem encoding and error handler: 75d.

     この関数は *note ファイル記述子の指定: d57. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1ccb.
     ‘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: e4f.
     interface).  If it is a str, it is encoded with the *note
     filesystem encoding and error handler: 75d.  'flags' may be *note
     XATTR_REPLACE: 3147. or *note XATTR_CREATE: 3148.  If
     ‘XATTR_REPLACE’ is given and the attribute does not exist,
     ‘ENODATA’ will be raised.  If ‘XATTR_CREATE’ is given and the
     attribute already exists, the attribute will not be created and
     ‘EEXISTS’ will be raised.

     この関数は *note ファイル記述子の指定: d57. および *note
     シンボリックリンクをたどらない: 1307. をサポートしています。

          注釈: Linux カーネル 2.6.39 以前では、バグのため一部のファイル
          システムで引数 flags が無視されます。

     引数 ‘path’, ‘attribute’, ‘value’, ‘flags’ を指定して *note
     監査イベント: 1ccb. ‘os.setxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 5a1. を受け付けるようになりました。

 -- データ: os.XATTR_SIZE_MAX

     拡張属性の値にできる最大サイズです。現在、Linux では 64 キロバイト
     です。

 -- データ: os.XATTR_CREATE

     *note setxattr(): 1323. の引数 flags に指定できる値です。その操作で
     属性を作成しなければならないことを意味します。

 -- データ: os.XATTR_REPLACE

     *note setxattr(): 1323. の引数 flags に指定できる値です。その操作で
     既存の属性を置き換えなければならないことを意味します。


File: python.info,  Node: プロセス管理,  Next: スケジューラーへのインターフェイス,  Prev: ファイルとディレクトリ,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.17.1.11 プロセス管理
......................

以下の関数はプロセスの生成や管理に利用できます。

さまざまな *note exec*: 314c. 関数は、プロセス内にロードされる新しいプロ
グラムに与えるための、引数のリストを取ります。どの関数の場合でも、新しい
プログラムに渡されるリストの最初の引数は、ユーザがコマンドラインで入力す
る引数ではなく、そのプログラム自体の名前です。 C プログラマならば、プロ
グラムの ‘main()’ に渡される ‘argv[0]’ だと考えれば良いでしょう。たとえ
ば、 ‘os.execv('/bin/echo', ['foo', 'bar'])’ が標準出力に出力するのは
‘bar’ だけで、 ‘foo’ は無視されたかのように見えることになります。

 -- の関数: os.abort ()

     Generate a ‘SIGABRT’ signal to the current process.  On Unix, the
     default behavior is to produce a core dump; on Windows, the process
     immediately returns an exit code of ‘3’.  Be aware that calling
     this function will not call the Python signal handler registered
     for ‘SIGABRT’ with *note signal.signal(): 1350.

 -- の関数: 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: 3e2.), and also by *note ctypes: 2e.

     Remove the directory by calling 'close()' on the returned object or
     using it in a *note with: 187. statement.

     See the Microsoft documentation(1) for more information about how
     DLLs are loaded.

     引数 ‘path’ を指定して *note 監査イベント: 1ccb.
     ‘os.add_dll_directory’ を送出します。

     *note Availability: 2199.: 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: c99. 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:
     2c2. 例外として報告されます。

     The current process is replaced immediately.  Open file objects and
     descriptors are not flushed, so if there may be data buffered on
     these open files, you should flush them using *note flush(): 2d62.
     or *note os.fsync(): f92. before calling an *note exec*: 314c.
     function.

     The "l" and "v" variants of the *note exec*: 314c. 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():
     314f, *note execlpe(): 3150, *note execvp(): 3151, and *note
     execvpe(): 3152.) will use the ‘PATH’ environment variable to
     locate the program 'file'.  When the environment is being replaced
     (using one of the *note exec*e: 314c. variants, discussed in the
     next paragraph), the new environment is used as the source of the
     ‘PATH’ variable.  The other variants, ‘execl()’, *note execle():
     314e, *note execv(): 3094, and *note execve(): 1315, 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(): 314e. 、 *note execlpe(): 3150. 、 *note execve():
     1315. 、および *note execvpe(): 3152. (すべて末尾に "e" がついてい
     ます) では、 'env' 引数は新たなプロセスで利用される環境変数を定義す
     るためのマップ型でなくてはなりません ( 現在のプロセスの環境変数の代
     わりに利用されます ); *note execl(): 314c. 、 *note execlp(): 314f.
     、 *note execv(): 3094. 、および *note execvp(): 3151. では、すべて
     新たなプロセスは現在のプロセスの環境を引き継ぎます。

     一部のプラットフォームの *note execve(): 1315. では、'path' はオー
     プンしているファイル記述子で指定することもできます。この機能をサポ
     ートしていないプラットフォームもあります; *note os.supports_fd:
     1319. を使うことで利用可能かどうか調べることができます。利用できな
     い場合、*note NotImplementedError: 369. が送出されます。

     引数 ‘path’, ‘args’, ‘env’ を指定して *note 監査イベント: 1ccb.
     ‘os.exec’ を送出します。

     *note Availability: 2199.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.3 で変更: Added support for specifying 'path' as an
     open file descriptor for *note execve(): 1315.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os._exit (n)

     終了ステータス 'n' でプロセスを終了します。この時クリーンアップハン
     ドラーの呼び出しや、標準入出力バッファのフラッシュなどは行いません
     。

          注釈: The standard way to exit is *note sys.exit(n): 279.
          ‘_exit()’ should normally only be used in the child process
          after a *note fork(): 4b5.

以下の終了コードは必須ではありませんが *note _exit(): 2750. で使うことが
できます。一般に、メールサーバーの外部コマンド配送プログラムのような、
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: 2199.: Unix, Windows.

 -- データ: os.EX_USAGE

     誤った個数の引数が渡された時など、コマンドが間違って使われたことを
     表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_DATAERR

     入力データが誤っていたことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_NOINPUT

     入力ファイルが存在しなかった、または、読み込み不可だったことを表す
     終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_NOUSER

     指定されたユーザーが存在しなかったことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_NOHOST

     指定されたホストが存在しなかったことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_UNAVAILABLE

     要求されたサービスが利用できないことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_SOFTWARE

     内部ソフトウェアエラーが検出されたことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_OSERR

     fork できない、 pipe の作成ができないなど、オペレーティングシステム
     のエラーが検出されたことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_OSFILE

     システムファイルが存在しなかった、開けなかった、あるいはその他のエ
     ラーが起きたことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_CANTCREAT

     ユーザーには作成できない出力ファイルを指定したことを表す終了コード
     。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_IOERR

     ファイルの I/O を行っている途中にエラーが発生した時の終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_TEMPFAIL

     一時的な失敗が発生したことを表す終了コード。これは、再試行可能な操
     作の途中に、ネットワークに接続できないというような、実際にはエラー
     ではないかも知れないことを意味します。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_PROTOCOL

     プロトコル交換が不正、不適切、または理解不能なことを表す終了コード
     。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_NOPERM

     操作を行うために十分な許可がなかった（ファイルシステムの問題を除く
     ）ことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_CONFIG

     設定エラーが起こったことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- データ: os.EX_NOTFOUND

     "an entry was not found" のようなことを表す終了コード。

     *note Availability: 2199.: Unix, not WASI.

 -- の関数: os.fork ()

     子プロセスを fork します。子プロセスでは ‘0’ が返り、親プロセスでは
     子プロセスの id が返ります。エラーが発生した場合は、 *note OSError:
     2c2. を送出します。

     FreeBSD 6.3 以下、Cygwinを含む一部のプラットフォームにおいて、
     ‘fork()’ をスレッド内から利用した場合に既知の問題があることに注意し
     てください。

     引数無しで *note 監査イベント: 1ccb. ‘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: 112.

     バージョン 3.8 で変更: Calling ‘fork()’ in a subinterpreter is no
     longer supported (*note RuntimeError: 246. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, ‘os.fork()’ now raises a *note
     DeprecationWarning: 1a4.

     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 ‘os.fork()’
     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: 2199.: POSIX, not WASI, not Android, not iOS.

 -- の関数: os.forkpty ()

     子プロセスを fork します。この時新しい擬似端末を子プロセスの制御端
     末として使います。親プロセスでは ‘(pid, fd)’ からなるペアが返り、
     'fd' は擬似端末のマスター側のファイル記述子となります。可搬性のある
     アプローチを取るには、 *note pty: b6. モジュールを利用してください
     。エラーが発生した場合は、 *note OSError: 2c2. を送出します。

     引数無しで *note 監査イベント: 1ccb. ‘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: 112.

     バージョン 3.8 で変更: Calling ‘forkpty()’ in a subinterpreter is
     no longer supported (*note RuntimeError: 246. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, this now raises a *note
     DeprecationWarning: 1a4.  See the longer explanation on *note
     os.fork(): 4b5.

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.kill (pid, sig, /)

     プロセス 'pid' にシグナル 'sig' を送ります。ホストプラットフォーム
     で利用可能なシグナルを特定する定数は *note signal: cb. モジュールで
     定義されています。

     Windows: The *note signal.CTRL_C_EVENT: 1584. and *note
     signal.CTRL_BREAK_EVENT: 1585. 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(): 134d. も参照してください。

     引数 ‘pid’, ‘sig’ を指定して *note 監査イベント: 1ccb. ‘os.kill’ を
     送出します。

     *note Availability: 2199.: Unix, Windows, not WASI, not iOS.

     バージョン 3.2 で変更: Windows サポートを追加しました。

 -- の関数: os.killpg (pgid, sig, /)

     プロセスグループ 'pgid' にシグナル 'sig' を送ります。

     引数 ‘pgid’, ‘sig’ を指定して *note 監査イベント: 1ccb. ‘os.killpg’
     を送出します。

     *note Availability: 2199.: Unix, not WASI, not iOS.

 -- の関数: os.nice (increment, /)

     プロセスの "nice 値 " に 'increment' を加えます。新たな nice 値を返
     します。

     *note Availability: 2199.: 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: 2199.: Linux >= 5.3, Android >= *note
     build-time: d87. 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: 2754. rather than blocking.

     *note Availability: 2199.: Linux >= 5.10

     Added in version 3.12.

 -- の関数: os.plock (op, /)

     プログラムのセグメントをメモリ内にロックします。 'op'
     (‘<sys/lock.h>’ で定義されています ) にはどのセグメントをロックする
     かを指定します。

     *note Availability: 2199.: Unix, not WASI, not macOS, not iOS.

 -- の関数: os.popen (cmd, mode='r', buffering=-1)

     コマンド 'cmd' への、または 'cmd' からのパイプ入出力を開きます。戻
     り値はパイプに接続されている開かれたファイルオブジェクトで、 'mode'
     が ‘'r'’ (デフォルト) または ‘'w'’ かによって読み出しまたは書き込み
     を行うことができます。引数 'bufsize' は、組み込み関数 *note open():
     318. における対応する引数と同じ意味を持ちます。 返されるファイルオ
     ブジェクトは、バイトではなくテキスト文字列を読み書きします。

     ‘close’ メソッドは、サブプロセスが正常に終了した場合は *note None:
     886. を返し、エラーが発生した場合にはサブプロセスの返りコードを返し
     ます。POSIX システムでは、返りコードが正の場合、そのコードは1バイト
     左にシフトしてプロセスが終了したことを示します。返りコードが負の場
     合、プロセスは返りコードの符号を変えた信号により終了します 。 (例え
     ば、サブプロセスが kill された場合、返り値は ‘- signal.SIGKILL’ と
     なる場合があります。) Windows システムでは、返り値には子プロセスか
     らの符号のついた整数の返りコードを含まれます。

     On Unix, *note waitstatus_to_exitcode(): b1b. 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: 2199.: not WASI, not Android, not iOS.

          注釈: The *note Python UTF-8 Mode: 867. affects encodings used
          for 'cmd' and pipe contents.

          ‘popen()’ is a simple wrapper around *note subprocess.Popen:
          4b7.  Use ‘subprocess.Popen’ or *note subprocess.run(): d83.
          to control options like encodings.

     *note Soft deprecated: 23f. since version 3.14: 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(): d83. を使うべきです。

     The positional-only arguments 'path', 'args', and 'env' are similar
     to *note execve(): 1315.  'env' is allowed to be ‘None’, in which
     case current process' environment is used.

     'path' には実行ファイルへのパスを指定します。 'path' はディレクトリ
     を含む形（実行ファイルへの絶対パスまたは相対パス）で指定する必要が
     あります。実行ファイル名のみを指定したい場合は *note
     posix_spawnp(): 17d5. を使ってください。

     '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: 369. 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: 1970. 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 監査イベント: 1ccb.
     ‘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: 2199.: 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 監査イベント: 1ccb.
     ‘os.posix_spawn’ を送出します。

     Added in version 3.8.

     *note Availability: 2199.: 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(): dbc, *note PyOS_AfterFork_Parent(): dbd. and
     *note PyOS_AfterFork_Child(): 42e.

     There is no way to unregister a function.

     *note Availability: 2199.: 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. モジュールが、新しいプロセスを実行して結果を
     取得するための、より強力な機能を提供しています。この関数の代わりに
     ‘subprocess’ モジュールを利用することが推奨されています。
     ‘subprocess’ モジュールのドキュメントの、 *note Replacing Older
     Functions with the subprocess Module: 13a4. セクションを参照してく
     ださい )

     'mode' が *note P_NOWAIT: 316f. の場合、この関数は新たなプロセスの
     プロセス ID を返します ; 'mode' が *note P_WAIT: 3170. の場合、子プ
     ロセスが正常に終了するとその終了コードが返ります。そうでない場合に
     はプロセスを kill したシグナル 'signal' に対して ‘-signal’ が返りま
     す。 Windows では、プロセス ID は実際にはプロセスハンドル値になるの
     で、 *note waitpid(): f9e. 関数で使えます。

     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 ‘spawn*’ 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(): 3169, *note spawnlpe():
     316a, *note spawnvp(): 316d, *note spawnvpe(): 316e.) は、プログラ
     ム 'file' を探すために環境変数 ‘PATH’ を利用します。環境変数が ( 次
     の段で述べる *note spawn*e: 31d. 型関数で ) 置き換えられる場合、環
     境変数は ‘PATH’ を決定する上の情報源として使われます。その他の型、
     ‘spawnl()’, *note spawnle(): 3168, *note spawnv(): 316b, および
     *note spawnve(): 316c. では、実行コードを探すために ‘PATH’ を使いま
     せん。 'path' には適切に設定された絶対パスまたは相対パスが入ってい
     なくてはなりません。

     *note spawnle(): 3168, *note spawnlpe(): 316a, *note spawnve():
     316c, および *note spawnvpe(): 316e. (すべて末尾に "e" がついていま
     す) では、 'env' 引数は新たなプロセスで利用される環境変数を定義する
     ためのマップ型でなくてはなりません ; *note spawnl(): 31d. 、 *note
     spawnlp(): 3169. 、 *note spawnv(): 316b. 、および *note spawnvp():
     316d. では、すべて新たなプロセスは現在のプロセスの環境を引き継ぎま
     す。 'env' 辞書のキーと値はすべて文字列である必要があります。不正な
     キーや値を与えると関数が失敗し、 ‘127’ を返します。

     例えば、以下の *note spawnlp(): 3169. および *note spawnvpe():
     316e. 呼び出しは等価です

          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 監査イベント:
     1ccb. ‘os.spawn’ を送出します。

     *note Availability: 2199.: Unix, Windows, not WASI, not Android,
     not iOS.

     *note spawnlp(): 3169. 、 *note spawnlpe(): 316a. 、 *note
     spawnvp(): 316d. 、および *note spawnvpe(): 316e. は Windows では利
     用できません。 *note spawnle(): 3168. および *note spawnve(): 316c.
     は Windows においてスレッドセーフではありません ; 代わりに *note
     subprocess: dc. モジュールの利用を推奨します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     *note Soft deprecated: 23f. since version 3.14: The *note
     subprocess: dc. module is recommended instead.

 -- データ: os.P_NOWAIT
 -- データ: os.P_NOWAITO

     Possible values for the 'mode' parameter to the *note spawn*: 31d.
     family of functions.  If either of these values is given, the
     ‘spawn*’ functions will return as soon as the new process has been
     created, with the process id as the return value.

     *note Availability: 2199.: Unix, Windows.

 -- データ: os.P_WAIT

     Possible value for the 'mode' parameter to the *note spawn*: 31d.
     family of functions.  If this is given as 'mode', the ‘spawn*’
     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: 2199.: Unix, Windows.

 -- データ: os.P_DETACH
 -- データ: os.P_OVERLAY

     *note spawn*: 31d. 関数ファミリに対する 'mode' パラメタとして取れる
     値です。これらの値は上の値よりもやや可搬性において劣っています。
     *note P_DETACH: 3172. は *note P_NOWAIT: 316f. に似ていますが、新た
     なプロセスは呼び出しプロセスのコンソールから切り離され (detach) ま
     す。 *note P_OVERLAY: 3173. が使われた場合、現在のプロセスは置き換
     えられます。したがって ‘spawn*’ は返りません。

     *note Availability: 2199.: 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.

     ‘startfile()’ 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(): 1535. 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: 369.
     will be raised.

     引数 ‘path’, ‘operation’ を指定して *note 監査イベント: 1ccb.
     ‘os.startfile’ を送出します。

     Raises an *note auditing event: 1ccb. ‘os.startfile/2’ with
     arguments ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’.

     *note Availability: 2199.: 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(): f9c.

     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: 13a4. section
     in the ‘subprocess’ documentation for some helpful recipes.

     On Unix, *note waitstatus_to_exitcode(): b1b. can be used to
     convert the result (exit status) into an exit code.  On Windows,
     the result is directly the exit code.

     引数 ‘command’ を指定して *note 監査イベント: 1ccb. ‘os.system’ を
     送出します。

     *note Availability: 2199.: 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: 2199.: Unix, Windows.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- の関数: os.wait ()

     子プロセスの実行完了を待機し、子プロセスの pid と終了コードインジケ
     ーター -- 16 ビットの数値で、下位バイトがプロセスを kill したシグナ
     ル番号、上位バイトが終了ステータス ( シグナル番号がゼロの場合 ) --
     の入ったタプルを返します ; コアダンプファイルが生成された場合、下位
     バイトの最上桁ビットが立てられます。

     If there are no children that could be waited for, *note
     ChildProcessError: 1267. is raised.

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b1b. を使うことができます。

     *note Availability: 2199.: 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(): f9e. 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: 3174, *note P_PGID: 3175, *note P_ALL:
     3176, or (on Linux) *note P_PIDFD: b1a.  The interpretation of 'id'
     depends on it; see their individual descriptions.

     'options' is an OR combination of flags.  At least one of *note
     WEXITED: 3177, *note WSTOPPED: 3178. or *note WCONTINUED: 3179. is
     required; *note WNOHANG: 317a. and *note WNOWAIT: 317b. 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: 317c.)

        * ‘si_status’ (the exit status or signal number, depending on
          ‘si_code’)

        * ‘si_code’ (see *note CLD_EXITED: 317d. for possible values)

     If *note WNOHANG: 317a. 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: 1267. is raised.

     *note Availability: 2199.: 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(): f9c. と同様にコード化
     された ) 終了ステータスインジケーターからなるタプルを返します。この
     関数の動作は 'options' によって変わります。通常の操作では ‘0’ にし
     ます。

     'pid' が ‘0’ よりも大きい場合、 *note waitpid(): f9e. は特定のプロ
     セスのステータス情報を要求します。 'pid' が ‘0’ の場合、現在のプロ
     セスグループ内の任意の子プロセスの状態に対する要求です。 'pid' が
     ‘-1’ の場合、現在のプロセスの任意の子プロセスに対する要求です。
     'pid' が ‘-1’ よりも小さい場合、プロセスグループ ‘-pid’ ( すなわち
     'pid' の絶対値 ) 内の任意のプロセスに対する要求です。

     'options' is an OR combination of flags.  If it contains *note
     WNOHANG: 317a. 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: 1267.
     is raised.  Other options that can be used are *note WUNTRACED:
     317e. and *note WCONTINUED: 3179.

     Windows では、プロセスハンドル 'pid' を指定してプロセスの終了を待っ
     て、 'pid' と、終了ステータスを 8bit 左シフトした値のタプルを返しま
     す。 ( シフトは、この関数をクロスプラットフォームで利用しやすくする
     ために行われます ) ‘0’ 以下の 'pid' は Windows では特別な意味を持っ
     ておらず、例外を発生させます。 'options' の値は効果がありません。
     'pid' は、子プロセスで無くても、プロセス ID を知っているどんなプロ
     セスでも参照することが可能です。 *note spawn*: 31d. 関数を *note
     P_NOWAIT: 316f. と共に呼び出した場合、適切なプロセスハンドルが返さ
     れます。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b1b. を使うことができます。

     *note Availability: 2199.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f8c. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(8) を参照してください)。

 -- の関数: os.wait3 (options)

     *note waitpid(): f9e. に似ていますが、プロセス id を引数に取らず、
     子プロセス id 、終了ステータスインジケータ、リソース使用情報の 3 要
     素からなるタプルを返します。リソース使用情報の詳しい情報は *note
     resource.getrusage(): 164f. を参照してください。'options' 引数は
     ‘waitpid()’ および *note wait4(): f9b. に渡されるものと同じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b1b. を使うことができます。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.wait4 (pid, options)

     *note waitpid(): f9e. に似ていますが、子プロセス id 、終了ステータ
     スインジケータ、リソース使用情報の 3 要素からなるタプルを返します。
     リソース使用情報の詳しい情報は *note resource.getrusage(): 164f. を
     参照してください。 *note wait4(): f9b. の引数は ‘waitpid()’ に与え
     られるものと同じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b1b. を使うことができます。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- データ: os.P_PID
 -- データ: os.P_PGID
 -- データ: os.P_ALL
 -- データ: os.P_PIDFD

     *note waitid(): f9d. の '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: 2199.: 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(): f9e, *note wait3(): f9a,
     *note wait4(): f9b, and *note waitid(): f9d. causes child processes
     to be reported if they have been continued from a job control stop
     since they were last reported.

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WEXITED

     This 'options' flag for *note waitid(): f9d. 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: 2199.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WSTOPPED

     This 'options' flag for *note waitid(): f9d. 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: 2199.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WUNTRACED

     This 'options' flag for *note waitpid(): f9e, *note wait3(): f9a,
     and *note wait4(): f9b. 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(): f9d.

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOHANG

     This 'options' flag causes *note waitpid(): f9e, *note wait3():
     f9a, *note wait4(): f9b, and *note waitid(): f9d. to return right
     away if no child process status is available immediately.

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOWAIT

     This 'options' flag causes *note waitid(): f9d. 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: 2199.: 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(): f9d. の返り値の ‘si_code’ に設定され得る値です。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

     バージョン 3.9 で変更: *note CLD_KILLED: b18. と *note CLD_STOPPED:
     b19. が追加されました。

 -- の関数: os.waitstatus_to_exitcode (status)

     待機ステータスを終了コードに変換します。

     Unix の場合:

        * 子プロセスが正常終了した場合 (‘WIFEXITED(status)``が真の場合
          )、子プロセスの終了ステータス (``WEXITSTATUS(status)’) を返し
          ます: 戻り値は0または正の整数です。

        * 子プロセスがシグナルによって終了した場合
          (‘WIFSIGNALED(status)``が真の場合)、子プロセスを終了したシグナ
          ルの番号に負符号をつけた ``-signum’ (‘-WTERMSIG(status)’) を返
          します: 戻り値は負の整数です。

        * それ以外の場合、 *note ValueError: 2ee. 例外を送出します。

     Windows の場合、 'status' を8ビット右にシフトした値を返します。

     Unix の場合、プロセスがトレースされているか *note waitpid(): f9e. が
     *note WUNTRACED: 317e. オプションをつけて実行されている場合、呼び出
     しもとは最初に ‘WIFSTOPPED(status)’ が真であるかを確認しなければな
     りません。この関数は ‘WIFSTOPPED(status)’ が真の場合呼び出してはい
     けません。

     参考
     ....

     *note WIFEXITED(): 3182, *note WEXITSTATUS(): 3183, *note
     WIFSIGNALED(): 3184, *note WTERMSIG(): 3185, *note WIFSTOPPED():
     3186, *note WSTOPSIG(): 3187. 関数。

     *note Availability: 2199.: Unix, Windows, not WASI, not Android,
     not iOS.

     Added in version 3.9.

以下の関数は *note system(): 167b. 、 *note wait(): f9c. 、あるいは
*note waitpid(): f9e. が返すプロセス状態コードを引数にとります。これらの
関数はプロセスの配置を決めるために利用できます。

 -- の関数: os.WCOREDUMP (status, /)

     プロセスに対してコアダンプが生成されていた場合には ‘True’ を、それ
     以外の場合は ‘False’ を返します。

     この関数は *note WIFSIGNALED(): 3184. が真である場合のみ使用される
     べきです。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFCONTINUED (status)

     Return ‘True’ if a stopped child has been resumed by delivery of
     *note SIGCONT: 318a. (if the process has been continued from a job
     control stop), otherwise return ‘False’.

     *note WCONTINUED: 3179. オプションを参照してください。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSTOPPED (status)

     プロセスがシグナルの送信によって中断させられた場合に ‘True’ を返し
     ます。それ以外の場合は ‘False’ を返します。

     *note WIFSTOPPED(): 3186. は *note waitpid(): f9e. が *note
     WUNTRACED: 317e. オプションを使って実行されたか、もしくはプロセスが
     トレースされている場合 (‘ptrace(2)(9)’ を参照してください) にのみ
     ‘True’ を返します。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSIGNALED (status)

     プロセスがシグナルによって終了させられた場合に ‘True’ を返します。
     そうでない場合は ‘False’ を返します。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFEXITED (status)

     プロセスが正常終了した場合、すなわち ‘exit()’ や ‘_exit()’ を呼び出
     したか、もしくは ‘main()’ から戻ることにより終了した場合に ‘True’ を
     返します。それ以外は ‘False’ を返します。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WEXITSTATUS (status)

     プロセスの終了ステータスを返します。

     この関数は *note WIFEXITED(): 3182. が真である場合のみ使用されるべ
     きです。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WSTOPSIG (status)

     プロセスを停止させたシグナル番号を返します。

     この関数は *note WIFSTOPPED(): 3186. が真である場合のみ使用されるべ
     きです。

     *note Availability: 2199.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WTERMSIG (status)

     プロセスを終了させたシグナルの番号を返します。

     この関数は *note WIFSIGNALED(): 3184. が真である場合のみ使用される
     べきです。

     *note Availability: 2199.: 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.17.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: 318d.

     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(): 132b.、*note
     sched_setscheduler(): 132c.、および *note sched_getparam(): 1327. で
     使用される、調節可能なスケジューリングパラメーターを表します。これ
     はイミュータブルです。

     現在、一つの引数のみ指定できます:

      -- の属性: 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: 1970. のインスタンスです。

 -- の関数: os.sched_getscheduler (pid, /)

     PID 'pid' のプロセスのスケジューリングポリシーを返します。'pid' が
     0 の場合、呼び出しプロセスを意味します。返り値は上記のスケジューリ
     ングポリシー定数の一つになります。

 -- の関数: os.sched_setparam (pid, param, /)

     PID 'pid' を持つプロセスのスケジューリングパラメータを設定します。
     'pid' を 0 とした場合呼び出しプロセスを意味します。 'param' は
     *note sched_param: 1970. インスタンスです。

 -- の関数: os.sched_getparam (pid, /)

     PID 'pid' のプロセスのスケジューリングパラメーターを *note
     sched_param: 1970. のインスタンスとして返します。'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.17.1.13 雑多なシステム情報
............................

 -- の関数: os.confstr (name, /)

     システム設定値を文字列で返します。 'name' には取得したい設定名を指
     定します ; この値は定義済みのシステム値名を表す文字列にすることがで
     きます ; 名前は多くの標準 (POSIX.1 、 Unix 95 、 Unix 98 その他 ) で
     定義されています。ホストオペレーティングシステムの関知する名前は
     ‘confstr_names’ 辞書のキーとして与えられています。このマップ型オブ
     ジェクトに入っていない設定変数については、 'name' に整数を渡しても
     かまいません。

     'name' に指定された設定値が定義されていない場合、 ‘None’ を返します
     。

     'name' が文字列で、かつ不明の場合、 *note ValueError: 2ee. を送出し
     ます。 'name' の指定値がホストシステムでサポートされておらず、
     ‘confstr_names’ にも入っていない場合、 *note errno.EINVAL: 1e2e. を
     エラー番号として *note OSError: 2c2. を送出します。

     *note Availability: 2199.: Unix.

 -- データ: os.confstr_names

     *note confstr(): 194e. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 2199.: 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: 170. is given or
     *note PYTHON_CPU_COUNT: 51e. is set, ‘cpu_count()’ returns the
     override value 'n'.

 -- の関数: os.getloadavg ()

     過去 1 分、 5 分、および 15 分間の、システムの実行キューの平均プロ
     セス数を返します。平均負荷が得られない場合には *note OSError: 2c2.
     を送出します。

     *note Availability: 2199.: 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: 170. is given or *note PYTHON_CPU_COUNT:
     51e. is set, ‘process_cpu_count()’ returns the override value 'n'.

     See also the *note sched_getaffinity(): 1326. function.

     Added in version 3.13.

 -- の関数: os.sysconf (name, /)

     整数値のシステム設定値を返します。 'name' で指定された設定値が定義
     されていない場合、 ‘-1’ が返されます。 'name' に関するコメントとし
     ては、 *note confstr(): 194e. で述べた内容が同様に当てはまります ;
     既知の設定名についての情報を与える辞書は ‘sysconf_names’ で与えられ
     ています。

     *note Availability: 2199.: Unix.

 -- データ: os.sysconf_names

     *note sysconf(): 194f. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 2199.: 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(): 2ccd. や *note os.path.join(): 1a07. を使用してく
     ださい -- が、たまに便利なこともあります。 *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*: 314c. や *note spawn*p*: 31d. において、環境変数辞書
     内に ‘'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(): 133b. 関数と *note getdlopenflags(): 172c.
     関数と一緒に使用するフラグ。それぞれのフラグの意味については、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.17.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: 319b. and
     *note GRND_NONBLOCK: 319c.

     Linux getrandom() manual page(1) も参照してください。

     *note Availability: 2199.: 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: 319c. フラグを
     使って) 非ブロッキングモードでランダムなバイトを取得したり、システ
     ムの urandom エントロピープールが初期化されるまでポーリングするため
     に *note getrandom(): ebd. 関数を利用することができます。

     Unix ライクなシステムでは、ランダムなバイトは ‘/dev/urandom’ デバイ
     スから読み込みます。 ‘/dev/urandom’ デバイスが利用できないか、もし
     くは読み取り不可のときは、 *note NotImplementedError: 369. 例外が送
     出されます。

     Windowsで、 ‘BCryptGenRandom()’ を使用します。

     参考
     ....

     *note secrets: c5. モジュールは高レベルの乱数生成機能を提供します。
     プラットフォームが提供する乱数生成器に対する簡便なインターフェース
     については、 *note random.SystemRandom: 2bd4. を参照してください。

     バージョン 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(): ebd. は ‘/dev/random’ から読み込
     んだときにランダムなバイトが存在しない場合や、 ‘/dev/urandom’ から
     読み込んだときにエントロピープールが初期化されていない場合に処理を
     ブロックします。

     *note GRND_NONBLOCK: 319c. フラグがセットされると、 *note
     getrandom(): ebd. はこれらの場合に処理をブロックせず、ただちに
     *note BlockingIOError: 237. 例外を送出します。

     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.17.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.17.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:
13df.  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: 16a. object to the ‘write()’ method of a
binary stream will raise a *note TypeError: 199.  So will giving a *note
bytes: 193. object to the ‘write()’ method of a text stream.

バージョン 3.3 で変更: 以前 *note IOError: 1262. を送出していた操作が
*note OSError: 2c2. を送出するようになりました。 ‘IOError’ は今は
‘OSError’ の別名です。

* Menu:

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


File: python.info,  Node: テキスト I/O,  Next: バイナリ I/O,  Up: 概要<2>

5.17.2.2 テキスト I/O
.....................

テキスト I/O は、 *note str: 16a. オブジェクトを受け取り、生成します。す
なわち、背後にあるストレージがバイト列 (例えばファイルなど) を格納すると
きは常に、透過的にデータのエンコード・デコードを行ない、オプションでプラ
ットフォーム依存の改行文字変換を行います。

テキストストリームを作る一番簡単な方法は、オプションでエンコーディングを
指定して、 *note open(): 318. を利用することです:

     f = open("myfile.txt", "r", encoding="utf-8")

*note StringIO: 112e. オブジェクトはインメモリーのテキストストリームです
:

     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:
     237. if the stream cannot perform the operation immediately.

テキストストリームの API は *note TextIOBase: 8a5. のドキュメントで詳し
く解説します。


File: python.info,  Node: バイナリ I/O,  Next: Raw I/O,  Prev: テキスト I/O,  Up: 概要<2>

5.17.2.3 バイナリ I/O
.....................

バイナリー I/O ('buffered I/O' とも呼ばれます) は *note bytes-like
オブジェクト: 194. を受け取り *note bytes: 193. オブジェクトを生成します
。エンコード、デコード、改行文字変換は一切行いません。このカテゴリのスト
リームは全ての非テキストデータや、テキストデータの扱いを手動で管理したい
場合に利用することができます。

バイナリーストリームを生成する一番簡単な方法は、 *note open(): 318. の
mode 文字列に ‘'b'’ を指定することです:

     f = open("myfile.jpg", "rb")

*note BytesIO: 10a8. はインメモリーのバイナリストリームです:

     f = io.BytesIO(b"some initial binary data: \x00\x01")

バイナリーストリーム API は *note BufferedIOBase: 8a4. のドキュメントで
詳しく解説します。

他のライブラリモジュールが、別のテキスト・バイナリーストリームを生成する
方法を提供しています。例えば *note socket.socket.makefile(): 13bb. など
です。


File: python.info,  Node: Raw I/O,  Prev: バイナリ I/O,  Up: 概要<2>

5.17.2.4 Raw I/O
................

Raw I/O ('unbuffered I/O' とも呼ばれます) は、バイナリーストリームやテキ
ストストリームの低水準の部品としてよく利用されます。ユーザーコードで直接
raw ストリームを扱うべき場面は滅多にありません。とはいえ、バッファリング
を無効にしてファイルをバイナリーモードで開くことで raw ストリームを作る
ことができます:

     f = open("myfile.jpg", "rb", buffering=0)

raw ストリーム API は *note RawIOBase: 12eb. のドキュメントで詳しく解説
します。

     警告: Raw I/O is a low-level interface and methods generally must
     have their return values checked and be explicitly retried to
     ensure an operation completes.  For instance *note write(): 15c9.
     returns the number of bytes written which may be less than the
     number of bytes provided (a partial write).  High-level I/O objects
     like *note バイナリ I/O: 31a4. and *note テキスト I/O: 31a2.
     implement retry behavior.


File: python.info,  Node: Text Encoding,  Next: 高水準のモジュールインターフェイス,  Prev: 概要<2>,  Up: io --- ストリームを扱うコアツール

5.17.2.5 Text Encoding
......................

The default encoding of *note TextIOWrapper: 9c2. and *note open(): 318.
is locale-specific (*note locale.getencoding(): 866.).

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: 867.

     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: 867. default.

* Menu:

* Opt-in EncodingWarning::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0686/


File: python.info,  Node: Opt-in EncodingWarning,  Up: Text Encoding

5.17.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: 170. command line option or set the
*note PYTHONWARNDEFAULTENCODING: 9c3. environment variable, which will
emit an *note EncodingWarning: 2189. when the default encoding is used.

If you are providing an API that uses *note open(): 318. or *note
TextIOWrapper: 9c2. and passes ‘encoding=None’ as a parameter, you can
use *note text_encoding(): 1a9e. so that callers of the API will emit an
*note EncodingWarning: 2189. 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.17.2.7 高水準のモジュールインターフェイス
...........................................

 -- データ: io.DEFAULT_BUFFER_SIZE

     このモジュールの buffered I/O クラスで利用されるデフォルトのバッフ
     ァーサイズを表す整数です。可能であれば、*note open(): 318. は file
     の blksize (*note os.stat(): 26f. で取得される) を利用します。

 -- の関数: io.open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     組み込みの *note open(): 318. 関数のエイリアスです。

     This function raises an *note auditing event: 1ccb. ‘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: 16a. and an absolute path.

     The behavior of this function may be overridden by an earlier call
     to the *note PyFile_SetOpenCodeHook(): 1afb.  However, assuming
     that 'path' is a *note str: 16a. 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(): 318.
     or *note TextIOWrapper: 9c2. 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:
     867.

     This function emits an *note EncodingWarning: 2189. if *note
     sys.flags.warn_default_encoding: 89d. 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: 2189. is emitted for the
     caller of ‘read_text()’.

     See *note Text Encoding: 9c4. for more information.

     Added in version 3.10.

     バージョン 3.11 で変更: ‘text_encoding()’ returns "utf-8" when
     UTF-8 mode is enabled and 'encoding' is ‘None’.

 -- 例外: io.BlockingIOError

     互換性のための、組み込みの *note BlockingIOError: 237. 例外のエイリ
     アスです。

 -- 例外: io.UnsupportedOperation

     *note OSError: 2c2. と *note ValueError: 2ee. を継承した例外です。
     ストリームがサポートしていない操作を行おうとした時に送出されます。

参考
....

*note sys: df.

     標準 IO ストリームを持っています: *note sys.stdin: 75f, *note
     sys.stdout: cd1, *note sys.stderr: b37.。


File: python.info,  Node: クラス階層,  Next: Static Typing,  Prev: 高水準のモジュールインターフェイス,  Up: io --- ストリームを扱うコアツール

5.17.2.8 クラス階層
...................

I/O ストリームの実装はクラス階層に分けて整理されています。まずストリーム
のカテゴリを分類するための *note 抽象基底クラス: 13d2. (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: 8a4.
     provides unoptimized implementations of ‘readinto()’ and
     ‘readline()’.

I/O 階層の最上位には抽象基底クラスの *note IOBase: 505. があります。
‘IOBase’ ではストリームに対して基本的なインターフェースを定義しています
。 しかしながら、ストリームに対する読み込みと書き込みが分離されていない
ことに注意してください。 実装においては与えられた操作をサポートしない場
合は *note UnsupportedOperation: 1ddd. を送出することが許されています。

*note RawIOBase: 12eb. ABC は *note IOBase: 505. を拡張します。このクラ
スはストリームからの bytes の読み書きを扱います。 *note FileIO: 152b. は
、 ‘RawIOBase’ を継承してマシンのファイルシステム中のファイルへのインタ
ーフェースを提供します。

The *note BufferedIOBase: 8a4. ABC extends *note IOBase: 505.  It deals
with buffering on a raw binary stream (*note RawIOBase: 12eb.).  Its
subclasses, *note BufferedWriter: 15cf, *note BufferedReader: 142b, and
*note BufferedRWPair: 15d1. buffer raw binary streams that are writable,
readable, and both readable and writable, respectively.  *note
BufferedRandom: 15d0. provides a buffered interface to seekable streams.
Another ‘BufferedIOBase’ subclass, *note BytesIO: 10a8, is a stream of
in-memory bytes.

*note TextIOBase: 8a5. ABC は *note IOBase: 505. を拡張します。このクラ
スはテキストをあらわすバイトストリームを対象とし、バイトデータと文字列の
間のエンコーディングやデコーディングを適切に行います。 *note
TextIOWrapper: 9c2. は ‘TextIOBase’ を拡張し、バッファリングされた生のス
トリーム (*note BufferedIOBase: 8a4.) に対するバッファリングされたテキス
トのインターフェースです。最後に、 *note StringIO: 112e. はメモリ上のテ
キストデータに対するストリームです。

引数名は規約に含まれていません。 そして *note open(): 318. の引数だけが
キーワード引数として用いられることが意図されています。

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: 12eb.        *note IOBase: 505.     ‘readinto’, ‘write’          *note IOBase: 505. から継承したメソッド、 ‘read’,
                                                                                  ‘readall’
                                                                                  
                                                                                  
*note BufferedIOBase: 8a4.    *note IOBase: 505.     ‘detach’, ‘read’, ‘read1’,   *note IOBase: 505. から継承したメソッド、
                                                     ‘write’                      ‘readinto’, ‘readinto1’
                                                                                  
                                                                                  
*note TextIOBase: 8a5.        *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.17.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: 2ee. (or *note
     UnsupportedOperation: 1ddd.) when operations they do not support
     are called.

     ファイルへのバイナリデータの読み書きに用いられる基本型は *note
     bytes: 193. です。 他の *note bytes-like オブジェクト: 194. もメソ
     ッドの引数として受け付けられます。 テキスト I/O クラスは *note str:
     16a. データを扱います。

     閉じられたストリームに対するメソッド呼び出しは (問い合わせであって
     も) 未定義です。この場合、実装は *note ValueError: 2ee. を送出する
     ことがあります。

     *note IOBase: 505. (とそのサブクラス) はイテレータプロトコルをサポ
     ートします。 ‘IOBase’ オブジェクトをイテレートすると、ストリーム内
     の行が yield されます。ストリーム内の行の定義は、そのストリームが
     (バイト列を yield する) バイナリストリームか (文字列を yield する)
     テキストストリームかによって、 少し異なります。下の *note
     readline(): 1545. を参照してください。

     *note IOBase: 505. はコンテキストマネージャでもあります。そのため
     *note with: 187. 構文をサポートします。 次の例では、 ‘with’ 構文が
     終わった後で--たとえ例外が発生した場合でも、 'file' は閉じられます
     。

          with open('spam.txt', 'w') as file:
              file.write('Spam and eggs!')

     *note IOBase: 505. は以下のデータ属性とメソッドを提供します:

      -- メソッド: close ()

          このストリームをフラッシュして閉じます。このメソッドはファイル
          が既に閉じられていた場合は特に何の効果もありません。いったんフ
          ァイルが閉じられると、すべてのファイルに対する操作 (例えば読み
          込みや書き込み) で *note ValueError: 2ee. が発生します。

          利便性のためにこのメソッドを複数回呼ぶことは許されています。し
          かし、効果があるのは最初の1回だけです。

      -- の属性: closed

          ストリームが閉じられていた場合 ‘True’ になります。

      -- メソッド: fileno ()

          ストリームが保持しているファイル記述子 (整数値) が存在する場合
          はそれを返します。もし IO オブジェクトがファイル記述子を使って
          いない場合は *note OSError: 2c2. が発生します。

      -- メソッド: flush ()

          適用可能であればストリームの書き込みバッファをフラッシュします
          。読み出し専用や非ブロッキングストリームでは何もしません。

      -- メソッド: isatty ()

          ストリームが対話的であれば (つまりターミナルや tty デバイスに
          つながっている場合) ‘True’ を返します。

      -- メソッド: readable ()

          Return ‘True’ if the stream can be read from.  If ‘False’,
          ‘read()’ will raise *note OSError: 2c2.

      -- メソッド: readline (size=-1, /)

          ストリームから 1 行読み込んで返します。もし 'size' が指定され
          た場合、最大で 'size' バイトが読み込まれます。

          バイナリファイルでは行末文字は常に ‘b'\n'’ となります。テキス
          トファイルでは、認識される行末文字を選択するために *note
          open(): 318. に対する '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: 14a9. or ‘0’ - start of the stream
               (the default); 'offset' should be zero or positive

             * *note os.SEEK_CUR: 14aa. or ‘1’ - current stream
               position; 'offset' may be negative

             * *note os.SEEK_END: 14ab. 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: 30c2. or *note
          os.SEEK_DATA: 30c3.  The valid values for a file could depend
          on it being open in text or binary mode.

      -- メソッド: seekable ()

          ストリームがランダムアクセスをサポートしている場合、 ‘True’ を
          返します。 ‘False’ の場合、 *note seek(): 14a8.、 *note
          tell(): 15ca.、 *note truncate(): 152c. を使用すると *note
          OSError: 2c2. を発生させます。

      -- メソッド: 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(): 152c. will raise *note
          OSError: 2c2.

      -- メソッド: 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: 12eb. は *note IOBase: 505. が提供するメソッドに加
     えて、以下のメソッドを提供します:

      -- メソッド: read (size=-1, /)

          Read up to 'size' bytes from the object and return them.  As a
          convenience, if 'size' is unspecified or -1, all bytes until
          EOF are returned.

          Attempts to make only one system call but will retry if
          interrupted and the signal handler does not raise an exception
          (see PEP 475(1) for the rationale).  This means fewer than
          'size' bytes may be returned if the operating system call
          returns fewer than 'size' bytes.

          'size' が 0 でないのに 0 バイトが返った場合、それはファイルの
          終端を表します。オブジェクトがノンブロッキングモードで、1 バイ
          トも読み込めなければ、‘None’ が返されます。

          デフォルトの実装は *note readall(): 31ad. と *note readinto():
          1022. に従います。

      -- メソッド: readall ()

          EOF までストリームからすべてのバイトを読み込みます。必要な場合
          はストリームに対して複数の呼び出しをします。

          If ‘0’ bytes are returned this indicates end of file.  If the
          object is in non-blocking mode and the underlying *note
          read(): 1021. returns ‘None’ indicating no bytes are
          available, ‘None’ is returned.

      -- メソッド: readinto (b, /)

          Read bytes into a pre-allocated, writable *note bytes-like
          object: 194. 'b', and return the number of bytes read.  For
          example, 'b' might be a *note bytearray: 342.

          If ‘0’ is returned and ‘len(b)’ is not ‘0’, this indicates end
          of file.  If the object is in non-blocking mode and no bytes
          are available, ‘None’ is returned.

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 194. 'b' を生ストリ
          ームに書き込み、書き込んだバイト数を返します。これは、根底の生
          ストリームの性質や、特にノンブロッキングである場合に、 'b' の
          バイト数より小さくなることがあります。生ストリームがブロックさ
          れないように設定されていて、かつ1バイトも即座に書き込むことが
          できなければ、 ‘None’ が返されます。このメソッドから返った後で
          呼び出し元は 'b' を解放したり変更したりするかもしれないので、
          実装はメソッド呼び出しの間だけ 'b' にアクセスすべきです。

               警告: This function does not ensure all bytes are written
               or an exception is thrown.  Callers may implement that
               behavior by checking the return value and, if it is less
               than the length of 'b', looping with additional write
               calls until all unwritten bytes are written.  High-level
               I/O objects like *note バイナリ I/O: 31a4. and *note
               テキスト I/O: 31a2. implement retry behavior.

 -- クラス: 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: 12eb. is that methods
     *note read(): 1544, *note readinto(): 18f8. and *note write(): edb.
     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(): edb. will raise
     *note BlockingIOError: 237. with *note
     BlockingIOError.characters_written: 2758. and *note read(): 1544.
     will return data read so far or ‘None’ if no data is available.

     さらに、 *note read(): 1544. メソッドは、 *note readinto(): 18f8. に
     従うデフォルト実装を持ちません。

     通常の *note BufferedIOBase: 8a4. 実装は *note RawIOBase: 12eb. 実
     装を継承せずに、 *note BufferedWriter: 15cf. と *note
     BufferedReader: 142b. がするようにこれをラップすべきです。

     *note BufferedIOBase: 8a4. は *note IOBase: 505. から継承した属性と
     メソッドに加えて、以下のデータ属性とメソッドを提供またはオーバーラ
     イドします:

      -- の属性: raw

          *note BufferedIOBase: 8a4. が扱う根底の生ストリーム (*note
          RawIOBase: 12eb. インスタンス) を返します。これは
          ‘BufferedIOBase’ API には含まれず、よって実装に含まれないこと
          があります。

      -- メソッド: detach ()

          根底の生ストリームをバッファから分離して返します。

          生ストリームが取り外された後、バッファは使用不能状態になります
          。

          バッファには、 *note BytesIO: 10a8. など、このメソッドで返され
          る単体のストリームという概念を持たないものがあります。これらは
          *note UnsupportedOperation: 1ddd. を送出します。

          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: 193. 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(): f99.
          and PEP 475(2) 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(): 31ad.), otherwise will read in a
          loop until read returns ‘None’, an empty *note bytes: 193, 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:
               237. 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():
          1022. which may retry if *note EINTR: f8b. is encountered per
          PEP 475(3).  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:
               237. or return ‘None’ if no data is available.  ‘io’
               implementations return ‘None’.

      -- メソッド: readinto (b, /)

          あらかじめ確保された書き込み可能な *note bytes 類オブジェクト:
          194. 'b' にバイト列を読み込み、読み込んだバイト数を返します。
          例えば、 'b' は *note bytearray: 342. です。

          *note read(): 1544. と同様に、下層の raw ストリームが対話的で
          ない限り、複数の読み込みは下層の raw ストリームに与えられるか
          もしれません。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 237. が
          送出されます。

      -- メソッド: readinto1 (b, /)

          根底の raw ストリームの *note read(): 1021. (または *note
          readinto(): 1022.) メソッドを高々 1 回呼び出し、あらかじめ確保
          された書き込み可能な *note bytes-like オブジェクト: 194. 'b' に
          バイト列を読み込みます。読み込んだバイト数を返します。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 237. が
          送出されます。

          Added in version 3.5.

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 194. 'b' を書き込み
          、書き込んだバイト数を返します (これは常に 'b' のバイト数と等
          しくなります。なぜなら、もし書き込みに失敗した場合は *note
          OSError: 2c2. が発生するからです)。実際の実装に依存して、これ
          らのバイト列は根底のストリームに即座に書き込まれることもあれば
          、パフォーマンスやレイテンシの関係でバッファに保持されることも
          あります。

          ノンブロッキングモードであるとき、バッファが満杯で根底の生スト
          リームが書き込み時点でさらなるデータを受け付けられない場合
          *note BlockingIOError: 237. が送出されます。

          このメソッドが戻った後で、呼び出し元は 'b' を解放、または変更
          するかもしれないので、実装はメソッド呼び出しの間だけ 'b' にア
          クセスすべきです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/

   (3) https://peps.python.org/pep-0475/


File: python.info,  Node: 生ファイルI/O,  Next: バッファ付きストリーム,  Prev: I/O 基底クラス,  Up: クラス階層

5.17.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: 12eb. and implements its
     low-level access design.  This means *note write(): 15c9. does not
     guarantee all bytes are written and *note read(): 1021. may read
     less bytes than requested even when more bytes may be present in
     the underlying file.  To get "write all" and "read at least"
     behavior, use *note バイナリ I/O: 31a4.

     'name' は、次の 2 つのいずれかです。

        * 開くファイルへのパスを表す文字列または *note bytes: 193. オブ
          ジェクト。 この場合、closefd は ‘True’ (デフォルト) でなければ
          なりません。 ‘True’ でない場合、エラーが送出されます。

        * 結果の *note FileIO: 152b. オブジェクトがアクセスを与える、既
          存の OS レベルファイル記述子の数を表す整数。FileIO オブジェク
          トが閉じられると、'closefd' が ‘False’ に設定されていない場合
          、この fd も閉じられます。

     'mode' は 読み込み（デフォルト）、書き込み、排他的作成、追記に対し
     ‘'r'’ 、 ‘'w'’ 、 ‘'x'’ 、 ‘'a'’ です。ファイルは書き込みや追記で開
     かれたときに存在しない場合作成されます。書き込みのときにファイルの
     内容は破棄されます。作成時に既に存在する場合は *note
     FileExistsError: 1225. が送出されます。作成のためにファイルを開くの
     は暗黙的に書き込みなので、このモードは ‘'w'’ と同じように振る舞いま
     す。読み込みと書き込みを同時に許可するにはモードに ‘'+'’ を加えてく
     ださい。

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの基底のファイルデ
     ィスクリプタは、'opener' を ('name', 'flags') で呼び出して得られま
     す。'opener' は開いたファイルディスクリプタを返さなければなりません
     。 (*note os.open: f96. を 'opener' として渡すと、‘None’ を渡したの
     と同様の機能になります。)

     新たに作成されたファイルは *note 継承不可: 1100. です。

     'opener' 引数を使う例については *note open(): 318. 組み込み関数を参
     照してください。

          警告: ‘FileIO’ is a low-level I/O object and members, such as
          *note read(): 1021. and *note write(): 15c9, need to have
          their return values checked explicitly in a retry loop to
          implement "write all" and "read at least" behavior.
          High-level I/O objects *note バイナリ I/O: 31a4. and *note
          テキスト I/O: 31a2. implement retry behavior.

     バージョン 3.3 で変更: 'opener' 引数が追加されました。‘'x'’ モード
     が追加されました。

     バージョン 3.4 で変更: ファイルが継承不可になりました。

     *note FileIO: 152b. は *note RawIOBase: 12eb. と *note IOBase: 505.
     から継承したデータ属性に加えて以下のデータ属性を提供します:

      -- の属性: mode

          コンストラクタに渡されたモードです。

      -- の属性: name

          ファイル名。コンストラクタに名前が渡されなかったときはファイル
          記述子になります。


File: python.info,  Node: バッファ付きストリーム,  Next: テキスト I/O<2>,  Prev: 生ファイルI/O,  Up: クラス階層

5.17.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: 8a4.  The buffer is discarded when the *note
     close(): 506. method is called.

     省略可能な引数 'initial_bytes' は、初期データを含んだ *note
     bytes-like オブジェクト: 194. です。

     *note BytesIO: 10a8. は *note BufferedIOBase: 8a4. または *note
     IOBase: 505. からのメソッドに加えて、以下のメソッドを提供もしくはオ
     ーバーライドします:

      -- メソッド: getbuffer ()

          バッファの内容をコピーすることなく、その内容の上に、読み込み及
          び書き込みが可能なビューを返します。また、このビューを変更する
          と、バッファの内容は透過的に更新されます:

               >>> b = io.BytesIO(b"abcdef")
               >>> view = b.getbuffer()
               >>> view[2:4] = b"56"
               >>> b.getvalue()
               b'ab56ef'

               注釈: ビューが存在する限り、*note BytesIO: 10a8. オブジェ
               クトはリサイズやクローズされません。

          Added in version 3.2.

      -- メソッド: getvalue ()

          バッファの全内容を含む *note bytes: 193. を返します。

      -- メソッド: read1 (size=-1, /)

          *note BytesIO: 10a8. においては、このメソッドは *note read():
          1544. と同じです。

          バージョン 3.7 で変更: 'size' 引数が任意になりました。

      -- メソッド: readinto1 (b, /)

          *note BytesIO: 10a8. においては、このメソッドは *note
          readinto(): 18f8. と同じです。

          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: 12eb. raw binary stream.
     It inherits from *note BufferedIOBase: 8a4.

     このオブジェクトからデータを読み出した時、背後にある生のストリーム
     からはより大きな量のデータの読み出しがリクエストされ、内部バッファ
     に読み出したデータが保持されることがあります。バッファされたデータ
     はその後の読み出し処理で直接返すことができます。

     このコンストラクタは与えられた 'raw' ストリームと 'buffer_size' に
     対し *note BufferedReader: 142b. を生成します。 'buffer_size' が省
     略された場合、代わりに *note DEFAULT_BUFFER_SIZE: 1a9f. が使われま
     す。

     *note BufferedReader: 142b. は *note BufferedIOBase: 8a4. または
     *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 ‘BufferedReader’ this is the same as *note
          io.BufferedIOBase.read(): 1544.

      -- メソッド: read1 (size=-1, /)

          In ‘BufferedReader’ this is the same as *note
          io.BufferedIOBase.read1(): 2ed1.

          バージョン 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: 12eb. raw binary stream.
     It inherits from *note BufferedIOBase: 8a4.

     このオブジェクトに対して書き込みを行なったとき、データは通常内部バ
     ッファに配置されます。バッファは以下に示すさまざまな条件で背後にあ
     る *note RawIOBase: 12eb. オブジェクトに書き込まれます:

        * 保留中の全データに対してバッファが足りなくなったとき;

        * when *note flush(): 31b6. is called;

        * when a *note seek(): 14a8. is requested (for *note
          BufferedRandom: 15d0. objects);

        * *note BufferedWriter: 15cf. オブジェクトが閉じられたり破棄され
          たりしたとき。

     このコンストラクタは与えられた書き込み可能な 'raw' ストリームに対し
     *note BufferedWriter: 15cf. を生成します。 'buffer_size' が省略され
     た場合、 *note DEFAULT_BUFFER_SIZE: 1a9f. がデフォルトになります。

     *note BufferedWriter: 15cf. は *note BufferedIOBase: 8a4. または
     *note IOBase: 505. からのメソッドに加えて、以下のメソッドを提供もし
     くはオーバーライドします:

      -- メソッド: flush ()

          バッファに保持されたバイト列を生ストリームに強制的に流し込みま
          す。生ストリームがブロックした場合 *note BlockingIOError: 237.
          が送出されます。

      -- メソッド: write (b, /)

          Write the *note bytes-like object: 194, 'b', and return the
          number of bytes written.  When in non-blocking mode, a *note
          BlockingIOError: 237. with *note
          BlockingIOError.characters_written: 2758. 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 implementing *note BufferedIOBase: 8a4.
     interfaces providing higher-level access to a seekable *note
     RawIOBase: 12eb. raw binary stream.

     このコンストラクタは第一引数として与えられるシーク可能な生ストリー
     ムに対し、リーダーおよびライターを作成します。 'buffer_size' が省略
     された場合、 *note DEFAULT_BUFFER_SIZE: 1a9f. がデフォルトになりま
     す。

     ‘BufferedRandom’ is capable of anything *note BufferedReader: 142b.
     or *note BufferedWriter: 15cf. can do.  In addition, *note seek():
     14a8. and *note tell(): 15ca. 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: 12eb. raw binary streams--one readable,
     the other writeable.  It inherits from *note BufferedIOBase: 8a4.

     'reader' と 'writer' はそれぞれ読み込み可能、書き込み可能な *note
     RawIOBase: 12eb. オブジェクトです。 'buffer_size' が省略された場合
     *note DEFAULT_BUFFER_SIZE: 1a9f. がデフォルトになります。

     *note BufferedRWPair: 15d1. は、 *note UnsupportedOperation: 1ddd.
     を送出する *note detach(): 2e66. を除く、 *note BufferedIOBase:
     8a4. の全てのメソッドを実装します。

          警告: *note BufferedRWPair: 15d1. は下層の生ストリームのアクセ
          スを同期しようとはしません。同じオブジェクトをリーダとライタと
          して渡してはいけません。その場合は代わりに *note
          BufferedRandom: 15d0. を使用してください。


File: python.info,  Node: テキスト I/O<2>,  Prev: バッファ付きストリーム,  Up: クラス階層

5.17.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: 8a5. は以下のデータ属性とメソッドを提供しています:

      -- の属性: encoding

          エンコーディング名で、ストリームのバイト列を文字列にデコードす
          るとき、また文字列をバイト列にエンコードするときに使われます。

      -- の属性: errors

          このエンコーダやデコーダのエラー設定です。

      -- の属性: newlines

          文字列、文字列のタプル、または ‘None’ で、改行がどのように読み
          換えられるかを指定します。実装や内部コンストラクタのフラグに依
          って、これは利用できないことがあります。

      -- の属性: buffer

          The underlying binary buffer (a *note BufferedIOBase: 8a4. or
          *note RawIOBase: 12eb. instance) that ‘TextIOBase’ deals with.
          This is not part of the ‘TextIOBase’ API and may not exist in
          some implementations.

      -- メソッド: detach ()

          根底のバイナリバッファを *note TextIOBase: 8a5. から分離して返
          します。

          根底のバッファが取り外された後、 *note TextIOBase: 8a5. は使用
          不能状態になります。

          *note TextIOBase: 8a5. 実装には、 *note StringIO: 112e. など、
          根底のバッファという概念を持たないものがあります。これらを呼び
          出すと *note UnsupportedOperation: 1ddd. を送出します。

          Added in version 3.1.

      -- メソッド: read (size=-1, /)

          最大 'size' 文字をストリームから読み込み、一つの *note str:
          16a. にして返します。 'size' が負の値または ‘None’ ならば、
          EOF まで読みます。

      -- メソッド: readline (size=-1, /)

          Read until newline or EOF and return a single *note str: 16a.
          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(): 31bc, 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: 8a4. buffered binary stream.  It inherits from
     *note TextIOBase: 8a5.

     'encoding' gives the name of the encoding that the stream will be
     decoded or encoded with.  In *note UTF-8 Mode: 867, this defaults
     to UTF-8.  Otherwise, it defaults to *note locale.getencoding():
     866.  ‘encoding="locale"’ can be used to specify the current
     locale's encoding explicitly.  See *note Text Encoding: 9c4. for
     more information.

     'errors' はオプションの文字列で、エンコードやデコードの際のエラーを
     どのように扱うかを指定します。エンコードエラーがあったときに *note
     ValueError: 2ee. 例外を送出させるには ‘'strict'’ を渡します (デフォ
     ルトの ‘None’ でも同じです)。エラーを無視させるには ‘'ignore'’ を渡
     します。 (エンコーディングエラーを無視するとデータを喪失する可能性
     があることに注意してください。) ‘'replace'’ は不正な形式の文字の代
     わりにマーカ (たとえば ‘'?'’) を挿入させます。‘'backslashreplace'’
     を指定すると、不正な形式のデータをバックスラッシュ付きのエスケープ
     シーケンスに置換します。書き込み時には ‘'xmlcharrefreplace'’ (適切
     な XML 文字参照に置換) や ‘'namereplace'’ (‘\N{...}’ エスケープシー
     ケンスに置換) も使えます。他にも *note codecs.register_error():
     16b9. で登録されたエラー処理名が有効です。

     'newline' は行末をどのように処理するかを制御します 。‘None’, ‘''’,
     ‘'\n'’, ‘'\r'’, ‘'\r\n'’ のいずれかです。これは以下のように動作しま
     す:

        * ストリームからの入力を読み込んでいるとき、もし 'newline' が
          ‘None’ ならば *note universal newlines: f39. モードが有効にな
          ります。入力中の行は ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のいずれ
          で終わってもよく、それらは呼び出し元に返される前に'''n''' に変
          換されます。 'newline' が ‘''’ の場合、 universal newlines モ
          ードは有効になりますが、行末のコードは変換されずに呼び出し元に
          返されます。 'newline' がその他の有効な値の場合は、入力行は与
          えられた文字列のみで終端され、行末は変換されずに呼び出し元に返
          されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 263b. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     If 'line_buffering' is ‘True’, *note flush(): 2d62. is implied when
     a call to write contains a newline character or a carriage return.

     If 'write_through' is ‘True’, calls to *note write(): edb. are
     guaranteed not to be buffered: any data written on the
     ‘TextIOWrapper’ object is immediately handled to its underlying
     binary 'buffer'.

     バージョン 3.3 で変更: 'write_through' 引数が追加されました。

     バージョン 3.3 で変更: 'encoding' の規定値が
     ‘locale.getpreferredencoding()’ から
     ‘locale.getpreferredencoding(False)’ になりました。 *note
     locale.setlocale(): 930. を用いてロケールのエンコーディングを一時的
     に変更してはいけません。ユーザが望むエンコーディングではなく現在の
     ロケールのエンコーディングを使用してください。

     バージョン 3.10 で変更: The 'encoding' argument now supports the
     ‘"locale"’ dummy encoding name.

          注釈: When the underlying raw stream is non-blocking, a *note
          BlockingIOError: 237. may be raised if a read operation cannot
          be completed immediately.

     *note TextIOWrapper: 9c2. は *note TextIOBase: 8a5. と *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: 19c.

          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():
               181f.

             * ‘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: 14a9, *note os.SEEK_CUR: 14aa, and *note
          os.SEEK_END: 14ab.

      -- メソッド: tell ()

          Return the stream position as an opaque number.  The return
          value of ‘tell()’ can be given as input to *note seek(): 31bf,
          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: 8a5.

     テキストバッファは *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(): 20b7.  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: 9c2. の同名の引数と同じように
     働きます。ただし、出力をストリームに書き込む時に 'newline' が
     ‘None’ の場合には、改行は全てのプラットフォームで ‘\n’ になります。

     *note TextIOBase: 8a5. と *note IOBase: 505. から継承したメソッドに
     加えて *note StringIO: 112e. は以下のメソッドを提供しています:

      -- メソッド: getvalue ()

          Return a *note str: 16a. containing the entire contents of the
          buffer.  Newlines are decoded as if by *note read(): 20c8,
          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:
     f39. mode.  It inherits from *note codecs.IncrementalDecoder: 28af.


File: python.info,  Node: Static Typing,  Next: 性能<3>,  Prev: クラス階層,  Up: io --- ストリームを扱うコアツール

5.17.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: 16a. or *note bytes: 193, 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: 16a. or *note bytes: 193, 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: 31c4. 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.17.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.17.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.17.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(): 31bc. and *note seek(): 31bb. are both quite
slow due to the reconstruction algorithm used.

しかし *note StringIO: 112e. は、ネイティブなインメモリ Unicode コンテナ
で、 *note BytesIO: 10a8. と同程度の速度を示します。


File: python.info,  Node: マルチスレッディング<3>,  Next: リエントラント性,  Prev: テキスト I/O<3>,  Up: 性能<3>

5.17.2.17 マルチスレッディング
..............................

*note FileIO: 152b. 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: 142b, *note
BufferedWriter: 15cf, *note BufferedRandom: 15d0. および *note
BufferedRWPair: 15d1. のインスタンス) は、その内部構造をロックを使って保
護します。このため、これらを複数のスレッドから同時に呼び出しても安全です
。

*note TextIOWrapper: 9c2. オブジェクトはスレッドセーフではありません。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/read(2)


File: python.info,  Node: リエントラント性,  Prev: マルチスレッディング<3>,  Up: 性能<3>

5.17.2.18 リエントラント性
..........................

バイナリバッファ付きオブジェクト (*note BufferedReader: 142b, *note
BufferedWriter: 15cf, *note BufferedRandom: 15d0. および *note
BufferedRWPair: 15d1. のインスタンス) は、リエントラント (再入可能) では
ありません。リエントラントな呼び出しは普通の状況では起こりませんが、 I/O
を *note signal: cb. ハンドラで行なっているときに起こりえます。スレッド
が、すでにアクセスしているバッファ付きオブジェクトに再び入ろうとすると
*note RuntimeError: 246. が送出されます。これは、バッファ付きオブジェク
トに複数のスレッドから入ることを禁止するわけではありません。

The above implicitly extends to text files, since the *note open(): 318.
function will wrap a buffered object inside a *note TextIOWrapper: 9c2.
This includes standard streams and therefore affects the built-in *note
print(): 117b. function as well.


File: python.info,  Node: time --- 時刻データへのアクセスと変換,  Next: logging --- Python 用のログ記録手段,  Prev: io --- ストリームを扱うコアツール,  Up: 汎用オペレーティングシステムサービス

5.17.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: 2f8e.) 以前ある
     いは遠い未来の日付や時刻を扱うことができません。将来カットオフ（関
     数が正しく日付や時刻を扱えなくなる）が起きる時点は、C ライブラリに
     よって決まります。32-bit システムではカットオフは通常 2038 年です。

   * 関数 *note strptime(): 164b. は ‘%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(): 8ad. は Unix の同等
     の関数よりましな精度を持っています。時刻は浮動小数点数で表され、
     ‘time()’ は可能なかぎり最も正確な時刻を (Unix の ‘gettimeofday()’ が
     あればそれを使って) 返します。また ‘sleep()’ にはゼロでない端数を与
     えることができます (Unix の ‘select()’ があれば、それを使って実装し
     ています)。

   * *note gmtime(): 13dc, *note localtime(): 1717, *note strptime():
     164b. が返す時刻値、および *note asctime(): 1404, *note mktime():
     1405, *note strftime(): 1406. がとる時刻値は 9 個の整数からなるシー
     ケンスです。‘gmtime()’, ‘localtime()’, ‘strptime()’ の戻り値は個々
     の値を属性名で取得することもできます。

     これらのオブジェクトについての解説は *note struct_time: eea. を参照
     してください。

     バージョン 3.3 で変更: *note struct_time: eea. オブジェクトは、プラ
     ットフォームが、対応する ‘struct tm’ メンバーをサポートしている場合
     、*note tm_gmtoff: 31cd. および *note tm_zone: 31ce. 属性が拡張され
     るようになりました。

     バージョン 3.6 で変更: *note struct_time: eea. の属性 *note
     tm_gmtoff: 31cd. および *note tm_zone: 31ce. が全てのプラットフォー
     ムで利用できるようになりました。

   * 時間の表現を変換するには、以下の関数を利用してください:

     対象                          変換先                        関数
                                                                 
     ------------------------------------------------------------------------------------------
                                                                 
     エポックからの秒数            UTC の                        *note gmtime(): 13dc.
                                   *note struct_time: eea.       
                                   
                                                                 
     エポックからの秒数            ローカル時間の                *note localtime(): 1717.
                                   *note struct_time: eea.       
                                   
                                                                 
     UTC の                        エポックからの秒数            *note calendar.timegm(): 29be.
     *note struct_time: eea.                                     

     ローカル時間の                エポックからの秒数            *note mktime(): 1405.
     *note struct_time: eea.                                     

* 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.17.3.1 関数
.............

 -- の関数: time.asctime ([t])

     Convert a tuple or *note struct_time: eea. representing a time as
     returned by *note gmtime(): 13dc. or *note localtime(): 1717. 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(): 1717. is used.  Locale information is not used by
     *note asctime(): 1404.

          注釈: 同名の C の関数と違って、*note asctime(): 1404. は末尾に
          改行文字を加えません。

 -- の関数: 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(): 1376. or the *note ident: 31d1.
     attribute of *note threading.Thread: 177. 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: 2199.: Unix

     更なる情報については ‘pthread_getcpuclockid(3)(1)’ の man を参照し
     てください。

     Added in version 3.7.

 -- の関数: time.clock_getres (clk_id)

     指定された 'clk_id' クロックの分解能(精度)を返します。 'clk_id' と
     して受け付けられる値の一覧は *note Clock ID Constants: 3145. を参照
     してください。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime (clk_id) -> float

     指定された 'clk_id' クロックの時刻を返します。 'clk_id' として受け
     付けられる値の一覧は *note Clock ID Constants: 3145. を参照してくだ
     さい。

     Use *note clock_gettime_ns(): cdf. to avoid the precision loss
     caused by the *note float: 197. type.

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime_ns (clk_id) -> int

     *note clock_gettime(): 137a. に似ていますが、ナノ秒単位の時刻を返し
     ます。

     *note Availability: 2199.: Unix.

     Added in version 3.7.

 -- の関数: time.clock_settime (clk_id, time: float)

     指定された 'clk_id' クロックの時刻を設定します。 現在、 *note
     CLOCK_REALTIME: 8aa. は 'clk_id' が受け付ける唯一の値です。

     Use *note clock_settime_ns(): ce0. to avoid the precision loss
     caused by the *note float: 197. type.

     *note Availability: 2199.: Unix, not Android, not iOS.

     Added in version 3.3.

 -- の関数: time.clock_settime_ns (clk_id, time: int)

     *note clock_settime(): 137b. に似ていますが、ナノ秒単位の時刻を設定
     します。

     *note Availability: 2199.: Unix, not Android, not iOS.

     Added in version 3.7.

 -- の関数: time.ctime ([secs])

     Convert a time expressed in seconds since the *note epoch: 2f8e. 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: 886. を指定した場合、*note
     time(): 55d. が返す値を現在の時刻として使用します。‘ctime(secs)’ は
     ‘asctime(localtime(secs))’ と等価です。ローカル情報は *note
     ctime(): 293c. には使用されません。

 -- の関数: time.get_clock_info (name)

     指定されたクロックの情報を名前空間オブジェクトとして取得します。サ
     ポートされているクロック名およびそれらの値を取得する関数は以下の通
     りです:

        * ‘'monotonic'’: *note time.monotonic(): 55c.

        * ‘'perf_counter'’: *note time.perf_counter(): c7e.

        * ‘'process_time'’: *note time.process_time(): c7f.

        * ‘'thread_time'’: *note time.thread_time(): b34.

        * ‘'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: 3145. を参照してください。

        - 'monotonic': クロック値が後戻りすることがない場合 ‘True’ が、
          そうでない場合は ‘False’ になります。

        - 'resolution': クロックの分解能を秒 (*note float: 197.) で表し
          ます。

     Added in version 3.3.

 -- の関数: time.gmtime ([secs])

     エポック (*note epoch: 2f8e.) からの経過時間で表現された時刻を、UTC
     で *note struct_time: eea. に変換します。このとき dst フラグは常に
     ゼロとして扱われます。'secs' を指定しないか *note None: 886. を指定
     した場合、*note time(): 55d. が返す値を現在の時刻として使用します。
     秒の端数は無視されます。‘struct_time’ オブジェクトについては前述の
     説明を参照してください。*note calendar.timegm(): 29be. はこの関数と
     逆の変換を行います。

 -- の関数: time.localtime ([secs])

     *note gmtime(): 13dc. に似ていますが、ローカル時間に変換します。
     'secs' を指定しないか *note None: 886. を指定した場合、*note
     time(): 55d. が返す値を現在の時刻として使用します。DST が適用されて
     いる場合は dst フラグには ‘1’ が設定されます。

     ‘localtime()’ may raise *note OverflowError: a85, if the timestamp
     is outside the range of values supported by the platform C
     ‘localtime()’ or ‘gmtime()’ functions, and *note OSError: 2c2. on
     ‘localtime()’ or ‘gmtime()’ failure.  It's common for this to be
     restricted to years between 1970 and 2038.

 -- の関数: time.mktime (t)

     *note localtime(): 1717. の逆を行う関数です。引数は *note
     struct_time: eea. か 9 個の要素すべての値を持つ完全なタプル (dst フ
     ラグも必要です; 時刻に DST が適用されるか不明の場合は ‘-1’ を使用し
     てください) で、UTC ではなく 'ローカル' 時間を指定します。戻り値は
     *note time(): 55d. との互換性のために浮動小数点数になります。入力し
     た値を正しい時刻として表現できない場合、例外 *note OverflowError:
     a85. または *note ValueError: 2ee. が送出されます (どちらが送出され
     るかは、無効な値を受け取ったのが 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(): ce1. to avoid the precision loss caused
     by the *note float: 197. 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(): ce2. to avoid the precision loss
     caused by the *note float: 197. 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(): c7e. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     Added in version 3.7.

 -- の関数: time.process_time () -> float

     現在のプロセスのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上プロセ
     スワイドです。戻り値の基準点は定義されていないので、二回の呼び出し
     の結果の差だけが有効です。

     Use *note process_time_ns(): ce3. to avoid the precision loss
     caused by the *note float: 197. type.

     Added in version 3.3.

 -- の関数: time.process_time_ns () -> int

     *note process_time(): c7f. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     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: 17f. instead of
          ‘time.sleep(0)’.

          To voluntarily relinquish the CPU, specify a real-time *note
          scheduling policy: 318c. and use *note os.sched_yield(): 132d.
          instead.

     引数 ‘secs’ を指定して *note 監査イベント: 1ccb. ‘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(): 13dc. や *note localtime(): 1717. が返す時刻値タプ
     ルまたは *note struct_time: eea. を、'format' で指定した文字列形式
     に変換します。't' が与えられていない場合、‘localtime()’ が返す値を
     現在の時刻として使用します。'format' は文字列でなくてはなりません。
     't' のいずれかのフィールドが許容範囲外の数値であった場合、*note
     ValueError: 2ee. を送出します。

     0 は時刻タプル内のいずれの位置の引数にも使用できます; それが一般に
     不正な値であれば、正しい値に強制的に置き換えられます。

     'format' 文字列には以下のディレクティブ (指示語) を埋め込むことがで
     きます。これらはフィールド長や精度のオプションを付けずに表され、
     *note strftime(): 1406. の結果の対応する文字列に置き換えられます:

     ディレクティ    意味                                                 注釈
     ブ                                                                   

     ---------------------------------------------------------------------------------
                                                                          
     ‘%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():
          164b, not to ‘strftime()’.  However, see also *note
          datetime.datetime.strptime(): 19b0. and *note
          datetime.datetime.strftime(): e92. where the ‘%f’ format
          directive *note applies to microseconds: 290e.

       2. *note strptime(): 164b. 関数で使う場合、‘%p’ ディレクティブが
          出力結果の時刻フィールドに影響を及ぼすのは、時刻を解釈するため
          に ‘%I’ を使ったときのみです。

       3. 値の幅は実際に ‘0’ から ‘61’ です; ‘60’ は うるう秒<leap
          seconds>(6) を表し、 ‘61’ は歴史的理由によりサポートされていま
          す。

       4. *note strptime(): 164b. 関数で使う場合、‘%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(): 13dc. や *note localtime(): 1717. が返すような *note
     struct_time: eea. です。

     'format' パラメーターは *note strftime(): 1406. で使うものと同じデ
     ィレクティブを使います; このパラメーターの値はデフォルトでは ‘"%a
     %b %d %H:%M:%S %Y"’ で、*note ctime(): 293c. が返すフォーマットに一
     致します。'string' が 'format' に従って解釈できなかった場合、例外
     *note ValueError: 2ee. が送出されます。解析しようとする 'string' が
     解析後に余分なデータを持っていた場合、‘ValueError’ が送出されます。
     欠落したデータについて、適切な値を推測できない場合はデフォルトの値
     で埋められ、その値は ‘(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(): 13dc, *note localtime(): 1717. および *note
     strptime(): 164b. が返す時刻値シーケンスの型です。これは *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): 31d2. in
                                                                                 *note strftime(): 1406.
                                                                                 
                                                                                 
     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(): 1405. の呼び出し時に、*note tm_isdst: 294d. は夏時
     間が有効な場合は 1、そうでない場合は 0 に設定されることがあります。
     値が -1 の場合は夏時間について不明なことを表していて、普通
     ‘tm_isdst’ は正しい状態に設定されます。

     *note struct_time: eea. を引数とする関数に正しくない長さの
     ‘struct_time’ や要素の型が正しくない ‘struct_time’ を与えた場合には
     、 *note TypeError: 199. が送出されます。

 -- の関数: time.time () -> float

     エポック (*note epoch: 2f8e.) からの秒数を浮動小数点数で返します。
     うるう秒 (leap seconds(10)) の扱いはプラットフォーム依存です。
     Windows とほとんどの Unix システムでは、うるう秒はエポック (*note
     epoch: 2f8e.) 秒の時間の勘定には入りません。 これは一般に Unix 時間
     (11) と呼ばれています。

     時刻は常に浮動小数点数で返されますが、すべてのシステムが 1 秒より高
     い精度で時刻を提供するとは限らないので注意してください。 この関数が
     返す値は通常減少していくことはありませんが、この関数を 2 回呼び出し
     、その呼び出しの間にシステムクロックの時刻を巻き戻して設定した場合
     には、以前の呼び出しよりも低い値が返ることがあります。

     *note time(): 55d. が返す数値は、 *note gmtime(): 13dc. 関数に渡さ
     れて UTC の、あるいは *note localtime(): 1717. 関数に渡されて現地時
     間の、より一般的な時間のフォーマット (つまり、年、月、日、時間など)
     に変換されているかもしれません。 どちらの場合でも *note
     struct_time: eea. オブジェクトが返され、このオブジェクトの属性とし
     てカレンダー日付の構成要素へアクセスできます。

     Clock:

        * On Windows, call ‘GetSystemTimePreciseAsFileTime()’.

        * Call ‘clock_gettime(CLOCK_REALTIME)’ if available.

        * Otherwise, call ‘gettimeofday()’.

     Use *note time_ns(): ce4. to avoid the precision loss caused by the
     *note float: 197. type.

バージョン 3.13 で変更: On Windows, calls
‘GetSystemTimePreciseAsFileTime()’ instead of
‘GetSystemTimeAsFileTime()’.

 -- の関数: time.time_ns () -> int

     *note time(): 55d. に似ていますが、時刻を *note epoch: 2f8e. を基点
     としたナノ秒単位の整数で返します。

     Added in version 3.7.

 -- の関数: time.thread_time () -> float

     現在のスレッドのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上スレッ
     ド固有です。戻り値の基準点は定義されていないので、同一スレッドにお
     ける二回の呼び出しの結果の差だけが有効です。

     Use *note thread_time_ns(): d8e. to avoid the precision loss caused
     by the *note float: 197. type.

     *note Availability: 2199.: Linux, Unix, Windows.

     Unix systems supporting ‘CLOCK_THREAD_CPUTIME_ID’.

     Added in version 3.7.

 -- の関数: time.thread_time_ns () -> int

     *note thread_time(): b34. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     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: 2199.: Unix.

          注釈: 多くの場合、環境変数 ‘TZ’ を変更すると、 *note tzset():
          31da. を呼ばない限り *note localtime(): 1717. のような関数の出
          力に影響を及ぼすため、値が信頼できなくなってしまいます。

          ‘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.17.3.2 Clock ID Constants
...........................

These constants are used as parameters for *note clock_getres(): 1379.
and *note clock_gettime(): 137a.

 -- データ: time.CLOCK_BOOTTIME

     Identical to *note CLOCK_MONOTONIC: 8a9, 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: 8aa, which may have discontinuities if the time is
     changed using ‘settimeofday()’ or similar.

     *note Availability: 2199.: Linux >= 2.6.39.

     Added in version 3.7.

 -- データ: time.CLOCK_HIGHRES

     Solaris OS は任意のハードウェアソースの使用を試み、ナノ秒レベルの分
     解能を提供する ‘CLOCK_HIGHRES’ タイマーを具備しています。
     ‘CLOCK_HIGHRES’ は変更不可で、高分解能のクロックです。

     *note Availability: 2199.: Solaris.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC

     設定不可で、モノトニック時刻 (不特定のエポックからの単調増加な時刻)
     を表します。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW

     *note CLOCK_MONOTONIC: 8a9. と似ていますが、NTP の影響を受けていな
     い、ハードウェアベースの時刻へのアクセスを提供します。

     *note Availability: 2199.: Linux >= 2.6.28, macOS >= 10.12.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW_APPROX

     Similar to *note CLOCK_MONOTONIC_RAW: 31dd, but reads a value
     cached by the system at context switch and hence has less accuracy.

     *note Availability: 2199.: macOS >= 10.12.

     Added in version 3.13.

 -- データ: time.CLOCK_PROCESS_CPUTIME_ID

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 2199.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_PROF

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 2199.: 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: 2199.: Linux.

     Added in version 3.9.

 -- データ: time.CLOCK_THREAD_CPUTIME_ID

     スレッド固有の CPU タイムクロックです。

     *note Availability: 2199.: 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: 2199.: 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: 2199.: macOS >= 10.12.

     Added in version 3.8.

 -- データ: time.CLOCK_UPTIME_RAW_APPROX

     Like *note CLOCK_UPTIME_RAW: c3b, but the value is cached by the
     system at context switches and therefore has less accuracy.

     *note Availability: 2199.: macOS >= 10.12.

     Added in version 3.13.

The following constant is the only parameter that can be sent to *note
clock_settime(): 137b.

 -- データ: time.CLOCK_REALTIME

     Real-time clock.  Setting this clock requires appropriate
     privileges.  The clock is the same for all processes.

     *note Availability: 2199.: 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.17.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: 31e4, *note
     daylight: 31e5, *note timezone: 31e6, and *note tzname: 31e7.), the
     value is determined by the timezone rules in effect at module load
     time or the last time *note tzset(): 31da. is called and may be
     incorrect for times in the past.  It is recommended to use the
     *note tm_gmtoff: 31cd. and *note tm_zone: 31ce. results from *note
     localtime(): 1717. to obtain timezone information.

参考
....

*note datetime: 34. モジュール

     日付と時刻に対する、よりオブジェクト指向のインターフェースです。

*note locale: 8a. モジュール

     国際化サービスです。ロケールの設定は *note strftime(): 1406. および
     *note strptime(): 164b. の多くの書式指定子の解釈に影響を及ぼします
     。

*note calendar: 15. モジュール

     一般的なカレンダーに関する関数群です。*note timegm(): 29be. はこの
     モジュールの *note gmtime(): 13dc. の逆を行う関数です。

脚注
....


File: python.info,  Node: logging --- Python 用のログ記録手段,  Next: logging config --- ログ記録の環境設定,  Prev: time --- 時刻データへのアクセスと変換,  Up: 汎用オペレーティングシステムサービス

5.17.4 ‘logging’ -- Python 用のログ記録手段
-------------------------------------------

'ソースコード:' Lib/logging/__init__.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 1412.

   * *note 上級チュートリアル: 1413.

   * *note ロギングクックブック: 1414.

__________________________________________________________________

このモジュールは、アプリケーションやライブラリのための柔軟なエラーログ記
録 (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(): bf7. は、多くのユースケースを上手に扱うことのできる簡便な
ルートロガーの構成方法を提供します。

このモジュールは、多くの機能性と柔軟性を提供します。ロギングに慣れていな
いなら、使い方を理解する最良の方法はチュートリアルを読むことです ('右上
のリンクを参照してください')。

モジュールで定義されている基本的なクラスと、その属性およびメソッドを以下
に列挙します。

   * ロガーは、アプリケーションコードが直接使うインターフェースを公開し
     ます。

   * ハンドラは、(ロガーによって生成された) ログ記録を適切な送信先に送り
     ます。

   * フィルタは、どのログ記録を出力するかを決定する、きめ細かい機能を提
     供します。

   * フォーマッタは、ログ記録が最終的に出力されるレイアウトを指定します
     。

* 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.17.4.1 ロガーオブジェクト
...........................

ロガーには以下のような属性とメソッドがあります。 ロガーを直接インスタン
ス化することは '絶対に' してはならず、常にモジュール関数
‘logging.getLogger(name)’ を介してインスタンス化することに注意してくださ
い。 同じ name で *note getLogger(): b5d. を複数回呼び出すと、常に同じロ
ガー・オブジェクトへの参照が返されます。

‘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(): b5d. を呼び出すときに渡された値です。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- の属性: level

          *note setLevel(): 16b1. メソッドで設定された、このロガーのしき
          い値です。

               注釈: この属性を直接設定しないでください - *note
               setLevel(): 16b1. は渡されたレベルをチェックする機能を持
               っていますので、常にこのメソッドを使うようにしてください
               。

      -- の属性: 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(): 31f1. と *note
               removeHandler(): 31f2. の2つのメソッドを介して変更されま
               す。これらのメソッドはスレッドセーフな処理を保証するため
               にロックを活用します。

      -- の属性: disabled

          この属性は、いかなるイベントの処理も作動しないようにします。イ
          ニシャライザはこの属性に ‘False’ を設定します。また、この属性
          はロギングを設定するコードによってのみ変更されます。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- メソッド: setLevel (level)

          このロガーの閾値を 'level' に設定します。 'level' よりも深刻で
          ないログメッセージは無視されます; 深刻さが 'level' 以上のログ
          メッセージは、ハンドラのレベルが 'level' より上に設定されてい
          ない限り、このロガーに取り付けられているハンドラによって投げら
          れます。

          ロガーが生成された際、レベルは *note NOTSET: 31f4. (これにより
          すべてのメッセージについて、ロガーがルートロガーであれば処理さ
          れる、そうでなくてロガーが非ルートロガーの場合には親ロガーに委
          譲させる) に設定されます。 ルートロガーは *note WARNING: 213b.
          レベルで生成されることに注意してください。

          「親ロガーに委譲」という用語の意味は、もしロガーのレベルが
          NOTSET ならば、祖先ロガーの系列の中を NOTSET 以外のレベルの祖
          先を見つけるかルートに到達するまで辿っていく、ということです。

          もし NOTSET 以外のレベルの祖先が見つかったなら、その祖先のレベ
          ルが探索を開始したロガーの実効レベルとして扱われ、ログイベント
          がどのように処理されるかを決めるのに使われます。

          ルートに到達した場合、ルートのレベルが NOTSET ならばすべてのメ
          ッセージは処理されます。そうでなければルートのレベルが実効レベ
          ルとして使われます。

          レベルの一覧については *note ロギングレベル: 86b. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          213a. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。ただし、レベルは内部で整数と
          して保存されますし、 *note getEffectiveLevel(): 31f5. や *note
          isEnabledFor(): 1512. といったメソッドは、整数を返し、また渡さ
          れるものと期待します。

      -- メソッド: isEnabledFor (level)

          深刻度が 'lvl' のメッセージが、このロガーで処理されることにな
          っているかどうかを示します。このメソッドはまず、
          ‘logging.disable(level)’ で設定されるモジュールレベルの深刻度
          レベルを調べ、次にロガーの実効レベルを *note
          getEffectiveLevel(): 31f5. で調べます。

      -- メソッド: getEffectiveLevel ()

          このロガーの実効レベルを示します。 *note NOTSET: 31f4. 以外の
          値が *note setLevel(): 16b1. で設定されていた場合、その値が返
          されます。そうでない場合、 ‘NOTSET’ 以外の値が見つかるまでロガ
          ーの階層をルートロガーの方向に追跡します。見つかった場合、その
          値が返されます。返される値は整数で、典型的には *note
          logging.DEBUG: 2139, *note logging.INFO: 213a. 等のうち一つで
          す。

      -- メソッド: 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: 2139. のメッセージをこのロガーで記録します
          。 'msg' はメッセージの書式文字列で、 'args' は 'msg' に文字列
          書式化演算子を使って取り込むための引数です。 (これは、書式化文
          字列の中でキーワードを使い、引数として単一の辞書を渡すことがで
          きる、ということを意味します。) 'args' が提供されない場合は
          'msg' の%フォーマットは実行されません。

          'kwargs' のうち、 'exc_info', 'stack_info', 'stacklevel',
          'extra' という4つのキーワード引数の中身を調べます。

          'exc_info' は、この値の評価値が false でない場合、例外情報がロ
          ギングメッセージに追加されます。もし例外情報をあらわすタプル
          (*note sys.exc_info(): 89b. 関数によって戻されるフォーマットに
          おいて)、または、例外情報をあらわすインスタンスが与えられてい
          れば、それが使用されることになります。それ以外の場合には、
          ‘sys.exc_info()’ を呼び出して例外情報を取得します。

          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:
          11ec. 内で行番号と関数名を算出する時に、指定されたスタックフレ
          ームの数をスキップします。これはログヘルパー内部で使われる場合
          、関数名、ファイル名、行番号はそのヘルパーの情報ではなく、その
          ヘルパーを呼び出した呼び出し元のものになります。このパラメータ
          の名前は *note warnings: 119. モジュールと同じものになります。

          4番目のキーワード引数は 'extra' で、ロギングイベントの際に作ら
          れる *note LogRecord: 11ec. の *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 属性: 31f6. の節を参照してください。)

          これらの属性をログメッセージに使うことにしたなら、少し注意が必
          要です。上の例では、 'clientip' と 'user' が *note LogRecord:
          11ec. の属性辞書に含まれていることを期待した書式文字列で *note
          Formatter: 16b5. がセットアップされています。もしこれらが欠け
          ていると、書式化例外が発生してしまうためメッセージはログに残り
          ません。したがってこの場合、常にこれらのキーを含む 'extra' 辞
          書を渡す必要があります。

          このようなことは煩わしいかもしれませんが、この機能は限定された
          場面で使われるように意図しているものなのです。たとえば同じコー
          ドがいくつものコンテキストで実行されるマルチスレッドのサーバで
          、興味のある条件が現れるのがそのコンテキストに依存している (上
          の例で言えば、リモートのクライアント IP アドレスや認証されたユ
          ーザ名など)、というような場合です。そういった場面では、それ用
          の *note Formatter: 16b5. が特定の *note Handler: 16b4. と共に
          使われるというのはよくあることです。

          このロガー (および *note Logger.propagate: 16b3. 属性を考慮し
          た上で実効的にイベントが伝播する祖先のロガー) にハンドラが接続
          されていない場合、メッセージは *note lastResort: 1417. に設定
          されたハンドラーに送られます。

          バージョン 3.2 で変更: 'stack_info' パラメータが追加されました
          。

          バージョン 3.5 で変更: 'exc_info' パラメータは例外インスタンス
          を受け入れることが可能です。

          バージョン 3.8 で変更: 'stacklevel' 引数が追加されました。

      -- メソッド: info (msg, *args, **kwargs)

          レベル *note INFO: 213a. のメッセージをこのロガーで記録します
          。引数は *note debug(): 31f7. と同じように解釈されます。

      -- メソッド: warning (msg, *args, **kwargs)

          レベル *note WARNING: 213b. のメッセージをこのロガーで記録しま
          す。引数は *note debug(): 31f7. と同じように解釈されます。

               注釈: ‘warning’ と機能的に等価な古いメソッド ‘warn’ があ
               ります。‘warn’ は廃止予定なので使わないでください - 代わ
               りに ‘warning’ を使ってください。

      -- メソッド: error (msg, *args, **kwargs)

          レベル *note ERROR: 213c. のメッセージをこのロガーで記録します
          。引数は *note debug(): 31f7. と同じように解釈されます。

      -- メソッド: critical (msg, *args, **kwargs)

          レベル *note CRITICAL: 213d. のメッセージをこのロガーで記録し
          ます。引数は *note debug(): 31f7. と同じように解釈されます。

      -- メソッド: log (level, msg, *args, **kwargs)

          整数で表したレベル 'level' のメッセージをこのロガーで記録しま
          す。その他の引数は *note debug(): 31f7. と同じように解釈されま
          す。

      -- メソッド: exception (msg, *args, **kwargs)

          レベル *note ERROR: 213c. のメッセージをこのロガーで記録します
          。引数は *note debug(): 31f7. と同じように解釈されます。例外情
          報がログメッセージに追加されます。このメソッドは例外ハンドラか
          らのみ呼び出されるべきです。

      -- メソッド: 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(): 31f7. や他のAPIを呼び
          出すコードから渡されます。もしこれが1よりも大きい場合は、その
          超過分は返す値を決定する前にスタックフレームをスキップする数と
          して利用されます。これは通常、ログAPIをヘルパーやラッパー経由
          で呼び出す場合に便利です。こうすることで、イベントログに記録さ
          れる情報はヘルパーやラッパーのコードではなく、それらを呼び出し
          ているコードのものとなります。

      -- メソッド: handle (record)

          レコードを、このロガーおよびその上位ロガー (ただし 'propagate'
          の値が false になったところまで) に関連付けられているすべての
          ハンドラに渡して処理します。このメソッドは、ローカルで生成され
          たレコードだけでなく、ソケットから受信した unpickle されたレコ
          ードに対しても同様に用いられます。 *note filter(): 31fb. によ
          って、ロガーレベルでのフィルタが適用されます。

      -- メソッド: makeRecord (name, level, fn, lno, msg, args,
               exc_info, func=None, extra=None, sinfo=None)

          このメソッドは、特殊な *note LogRecord: 11ec. インスタンスを生
          成するためにサブクラスでオーバライドできるファクトリメソッドで
          す。

      -- メソッド: hasHandlers ()

          このロガーにハンドラが設定されているかどうかを調べます。 その
          ために、このロガーとロガー階層における祖先からハンドラを探しま
          す。 ハンドラが見つかれば ‘True’ 、そうでなければ ‘False’ を返
          します。 このメソッドは、'propagate' 属性が偽に設定されたロガ
          ーを見つけると、さらに上位の探索をやめます。そのロガーが、ハン
          ドラが存在するかどうかチェックされる最後のロガーになります。

          Added in version 3.2.

     バージョン 3.7 で変更: ロガーの pickle 化と unpickle 化ができるよう
     になりました。


File: python.info,  Node: ロギングレベル,  Next: ハンドラオブジェクト,  Prev: ロガーオブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.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.17.4.3 ハンドラオブジェクト
.............................

ハンドラ (Handler) は以下の属性とメソッドを持ちます。 *note Handler:
16b4. は直接インスタンス化されることはありません; このクラスはより便利な
サブクラスの基底クラスとして働きます。しかしながら、サブクラスにおける
‘__init__()’ メソッドでは、 *note Handler.__init__(): 3203. を呼び出す必
要があります。

 -- クラス: logging.Handler

      -- メソッド: __init__ (level=NOTSET)

          レベルを設定して、 *note Handler: 16b4. インスタンスを初期化し
          ます。空のリストを使ってフィルタを設定し、 I/O 機構へのアクセ
          スを直列化するために (*note createLock(): 3204. を使って) ロッ
          クを生成します。

      -- メソッド: createLock ()

          スレッドセーフでない背後の I/O 機能に対するアクセスを直列化す
          るために用いられるスレッドロック (thread lock) を初期化します
          。

      -- メソッド: acquire ()

          *note createLock(): 3204. で生成されたスレッドロックを獲得しま
          す。

      -- メソッド: release ()

          *note acquire(): 3205. で獲得したスレッドロックを解放します。

      -- メソッド: setLevel (level)

          このハンドラに対する閾値を 'level' に設定します。 'level' より
          も深刻でないログメッセージは無視されます。 ハンドラが生成され
          た際、レベルは *note NOTSET: 31f4. (すべてのメッセージが処理さ
          れる) に設定されます。

          レベルの一覧については *note ロギングレベル: 86b. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          213a. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。

      -- メソッド: setFormatter (fmt)

          Sets the formatter for this handler to 'fmt'.  The 'fmt'
          argument must be a *note Formatter: 16b5. 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
          ‘close()’ methods.

      -- メソッド: handle (record)

          ハンドラに追加されたフィルタの条件に応じて、指定されたログレコ
          ードを出力します。このメソッドは I/O スレッドロックの獲得/解放
          を伴う実際のログ出力をラップします。

      -- メソッド: handleError (record)

          このメソッドは、 *note emit(): 3210. の呼び出し中に例外に遭遇
          した際にハンドラから呼び出されることを想定しています。モジュー
          ルレベルの属性 *note raiseExceptions: 1416. が ‘False’ の場合
          、例外は静かに無視されます。これは、ほとんどの場合でロギングシ
          ステムに期待される挙動です - なぜなら、ほとんどのユーザーはロ
          ギングシステムの中で起こったエラーなどに興味はなく、アプリケー
          ションエラーの方により関心があるからです。しかし、必要ならばこ
          の挙動を自作のハンドラで置き換えることができます。引数に指定さ
          れたレコードは例外発生時に処理されるものです。
          (‘raiseExceptions’ のデフォルト値は、開発中にはその方が便利な
          ので、 ‘True’ です)。

      -- メソッド: format (record)

          レコードに対する書式化を行います - フォーマッタが設定されてい
          れば、それを使います。そうでない場合、モジュールにデフォルト指
          定されたフォーマッタを使います。

      -- メソッド: emit (record)

          指定されたログ記録レコードを実際にログ記録する際のすべての処理
          を行います。このメソッドはサブクラスで実装されることを意図して
          おり、そのためこのクラスのバージョンは *note
          NotImplementedError: 369. を送出します。

               警告: このメソッドはハンドラレベルのロックを取得した後で
               呼び出されます。また、ロックはこのメソッドがリターンした
               後で解放されます。このメソッドをオーバーライドする場合、
               ロックを取得する可能性のある logging API の他の関数やメソ
               ッドの呼び出しに注意してください。そのような実装はデッド
               ロックを引き起こす可能性があります。特に以下の点に注意し
               てください:

                  * ロギングを構成するための API はモジュールレベルのロ
                    ックを取得し、その後ハンドラを構成する際に個々のハン
                    ドラに対してハンドラレベルのロックを取得します。

                  * 多くのロギング API はモジュールレベルのロックを取得
                    します。そのような API がこのメソッドから呼ばれた場
                    合、他のスレッドからロギングを構成するための API 呼
                    び出しが行われたときにデッドロックに陥る可能性があり
                    ます。これは他のスレッドがハンドラレベルのロックを取
                    得する '前に' モジュールレベルのロックを取得しようと
                    する一方で、 (このメソッドはハンドラレベルのロックが
                    既に取得された状態で呼び出されているため) このメソッ
                    ドを呼び出したスレッドはハンドラレベルのロックを取得
                    した '後で' モジュールレベルのロックを取得しようとす
                    るためです。

標準として含まれているハンドラについては、 *note logging.handlers: 8d. を
参照してください。


File: python.info,  Node: フォーマッタオブジェクト,  Next: フィルタオブジェクト,  Prev: ハンドラオブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.4.4 フォーマッタオブジェクト
.................................

 -- クラス: logging.Formatter (fmt=None, datefmt=None, style='%',
          validate=True, *, defaults=None)

     *note LogRecord: 11ec. を、人間または外部のシステムが解釈可能な出力
     文字列に変換する責任を持ちます。


     パラメータ:

        * ‘fmt’ (*note str: 16a.) - 'style' で指定された書式にもとづく、
          出力ログ全体に対する書式文字列です。マッピングのキーは *note
          LogRecord: 11ec. オブジェクトの *note LogRecord 属性: 31f6. か
          ら取り出されます。特に指定がない場合は、ログメッセージをあらわ
          す ‘'%(message)s'’ が使われます。

        * ‘datefmt’ (*note str: 16a.) - A format string for the
          date/time portion of the logged output.  If not specified, the
          default described in *note formatTime(): 3214. is used.

        * ‘style’ (*note str: 16a.) - ‘'%'’, または ‘'$'’ のいずれかで、
          書式文字列がログデータとどのようにマージされるかを決めます:
          *note printf 形式の文字列書式化: 8dc. (‘%’), *note
          str.format(): 833. (‘{’) または *note string.Template: 898. ()
          のいずれかを使います。この引数は 'fmt' だけに適用されます (た
          とえば ‘'%(message)s'’ に対して ‘'{message}'’) が、ロギングメ
          ソッドに渡された実際のログメッセージには適用されません。いっぽ
          う、 ‘'{'’ や ‘$’ を使ってログメッセージをフォーマットする
          *note 他の方法: 3215. も存在します。

        * ‘validate’ (*note bool: 3c1.) - ‘True’ が指定されると (デフォ
          ルト) 、 'fmt' と 'style' が不正な場合や、それらが不適切な組み
          合わせだった場合に *note ValueError: 2ee. 例外を送出します; た
          とえば ‘logging.Formatter('%(asctime)s - %(message)s',
          style='{')’ は例外となります。

        * ‘defaults’ (*note dict: 184.‘[’*note str: 16a.‘, ’‘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(): 3214. が呼び出
          され、イベントの発生時刻を書式化します。例外情報が存在する場合
          、 *note formatException(): 3217. を使って書式化され、メッセー
          ジに追加されます。ここで注意していただきたいのは、書式化された
          例外情報は 'exc_text' にキャッシュされるという点です。これが有
          用なのは例外情報がピックル化されて回線上を送ることができるから
          ですが、しかし二つ以上の *note Formatter: 16b5. サブクラスで例
          外情報の書式化をカスタマイズしている場合には注意が必要になりま
          す。この場合、フォーマッタが書式化を終えるごとにキャッシュをク
          リアして（ 'ext_text' 属性に ‘None’ を設定して）、次のフォーマ
          ッタがキャッシュされた値を使わずに新鮮な状態で再計算するように
          しなければならないことになります。

          スタック情報が利用可能な場合、(必要ならば *note formatStack():
          3218. を使って整形した上で) スタック情報が例外情報の後に追加さ
          れます。

      -- メソッド: formatTime (record, datefmt=None)

          このメソッドは、フォーマッタが書式化された時間を利用したい際に
          、 *note format(): 19a. から呼び出されます。 このメソッドは特
          定の要求を提供するためにフォーマッタで上書きすることができます
          が、基本的な振る舞いは以下のようになります: 'datefmt' (文字列)
          が指定された場合、レコードが生成された時刻を書式化するために
          *note time.strftime(): 1406. で使われます。 そうでない場合、
          '%Y-%m-%d %H:%M:%S,uuu' というフォーマットが使われます。 uuu 部
          分はミリ秒値で、それ以外の文字は ‘time.strftime()’ ドキュメン
          トに従います。 このフォーマットの時刻の例は ‘2003-01-23
          00:29:50,411’ です。 結果の文字列が返されます。

          この関数は、ユーザが設定できる関数を使って、生成時刻をタプルに
          変換します。デフォルトでは、 *note time.localtime(): 1717. が
          使われます。特定のフォーマッタインスタンスに対してこれを変更す
          るには、 ‘converter’ 属性を ‘time.localtime()’ や *note
          time.gmtime(): 13dc. と同じ署名をもつ関数に設定してください。
          すべてのフォーマッタインスタンスに対してこれを変更するには、例
          えば全てのロギング時刻を 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(): 89b. が返すような標
          準例外のタプル) を文字列として書式化します。デフォルトの実装は
          単に *note traceback.print_exception(): a53. を使います。結果
          の文字列が返されます。

      -- メソッド: formatStack (stack_info)

          指定されたスタック情報を文字列としてフォーマットします (*note
          traceback.print_stack(): 108a. によって返される文字列ですが、
          最後の改行が取り除かれています)。このデフォルト実装は、単に入
          力値をそのまま返します。

 -- クラス: logging.BufferingFormatter (linefmt=None)

     複数のレコードをまとめてフォーマットしたい場合のクラス定義に適した
     基底クラスです。各行 (単一のレコードに相当します) をフォーマットす
     るために使う *note Formatter: 16b5. インスタンスを渡すことができま
     す。特に指定がない場合はデフォルトのフォーマッタ (イベントのメッセ
     ージだけを出力するフォーマッタ) が使われます。

      -- メソッド: formatHeader (records)

          '複数のレコード' のリストに対するヘッダを返します。基底クラス
          の実装は単に空の文字列を返すだけです。レコード数やタイトルを表
          示したり、あるいはセパレータ行したいなど、ヘッダに対して特別な
          振る舞いが必要な場合はこのメソッドをオーバーライドする必要があ
          ります。

      -- メソッド: formatFooter (records)

          '複数のレコード' のリストに対するフッタを返します。基底クラス
          の実装は単に空の文字列を返すだけです。レコード数やセパレータ行
          の表示など、フッタに対して特別な振る舞いが必要な場合はこのメソ
          ッドをオーバーライドする必要があります。

      -- メソッド: format (records)

          '複数のレコード' のリストに対するフォーマット済みテキストを返
          します。基底クラスの実装は、レコードがなければ空の文字列を返し
          、レコードがある場合はヘッダ、単一のレコードをフォーマットする
          ためのラインフォーマッタで各レコードをフォーマットした文字列、
          そしてフッタを全て連結したものを返します。


File: python.info,  Node: フィルタオブジェクト,  Next: LogRecord オブジェクト,  Prev: フォーマッタオブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.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: 1418. クラスのインスタンスを返します。 'name' が指定
     されていれば、 'name' はロガーの名前を表します。指定されたロガーと
     その子ロガーのイベントがフィルタを通過できるようになります。 'name'
     が指定されなければ、すべてのイベントを通過させます。

      -- メソッド: filter (record)

          指定されたログレコードは記録されるでしょうか？答えが「いいえ」
          なら false を、「はい」なら true を返します。フィルタは受け取
          ったログレコードそのものを編集したり、その後のイベント処理にお
          いて元のログレコードに取って代わる、まったく異なるログレコード
          インスタンスを返す可能性があります。

ハンドラに対するフィルタはハンドラがイベントを発行する前に試され、一方で
はロガーに対するフィルタは、イベントが(*note debug(): 31f7, *note
info(): 3220. などによって)ロギングされる際には、ハンドラにイベントが送
信される前にはいつでも試されることに注意してください。そのフィルタがそれ
ら子孫ロガーにも適用されていない限り、子孫ロガーによって生成されたイベン
トはロガーのフィルタ設定によってフィルタされることはありません。

実際には、‘Filter’ をサブクラス化する必要はありません。同じ意味の
‘filter’ メソッドを持つ、すべてのインスタンスを通せます。

バージョン 3.2 で変更: 特殊な ‘Filter’ クラスを作ったり、 ‘filter’ メソ
ッドを持つ他のクラスを使う必要はありません: 関数 (あるいは他の callable)
をフィルタとして使用することができます。フィルタロジックは、フィルタオブ
ジェクトが ‘filter’ 属性を持っているかどうかチェックします: もし
‘filter’ 属性を持っていたら、それは ‘Filter’ であると仮定され、その
*note filter(): 321f. メソッドが呼び出されます。そうでなければ、それは
callable であると仮定され、レコードを単一のパラメータとして呼び出されま
す。返される値は ‘filter()’ によって返されるものと一致すべきです。

バージョン 3.12 で変更: 受け取ったログレコード自体を編集する代わりに、元
のログレコードに取って代わる別の *note LogRecord: 11ec. インスタンスを返
すことができるようになりました。これにより、 *note Handler: 16b4. にアタ
ッチされたフィルタが、他のハンドラへの副作用を伴うことなく、発行前にログ
レコードを編集することが可能になります。

フィルタは本来、レコードをレベルよりも洗練された基準に基づいてフィルタす
るために使われますが、それが取り付けられたハンドラやロガーによって処理さ
れるレコードをすべて監視します。これは、特定のロガーやハンドラに処理され
たレコードの数を数えたり、処理されている *note LogRecord: 11ec. の属性を
追加、変更、削除したりするときに便利です。もちろん、LogRecord を変更する
には注意が必要ですが、これにより、ログにコンテキスト情報を注入できます
(*note Filter を使ったコンテキスト情報の伝達: 3221. を参照してください
)。


File: python.info,  Node: LogRecord オブジェクト,  Next: LogRecord 属性,  Prev: フィルタオブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.4.6 LogRecord オブジェクト
...............................

*note LogRecord: 11ec. インスタンスは、何かをログ記録するたびに *note
Logger: d4a. によって生成されます。また、 *note makeLogRecord(): 3224. を
通して (例えば、ワイヤを通して受け取られた pickle 化されたイベントから)
手動で生成することも出来ます。

 -- クラス: logging.LogRecord (name, level, pathname, lineno, msg, args,
          exc_info, func=None, sinfo=None)

     ロギングされているイベントに適切なすべての情報を含みます。

     もっとも重要な情報は 'msg' と 'args' に渡され、 ‘msg % args’ で結合
     されてレコードの ‘message’ 属性を生成します。


     パラメータ:

        * ‘name’ (*note str: 16a.) - この ‘LogRecord’ であらわされるイベ
          ントを記録したロガーの名前です。 ‘LogRecord’ が持つロガーの名
          前は、たとえ異なる (祖先の) ロガーに接続されたハンドラから出力
          されたとしても、常に同じ値を持つことに注意してください。

        * ‘level’ (*note int: 19c.) - 記録されたイベントの *note
          数値であらわしたロギングレベル: 86b. (‘10’ が ‘DEBUG’, ‘20’ が
          ‘INFO’ など) です。このパラメータは LogRecord の '2つの' 属性
          に変換されることに注意してください: 数値は ‘levelno’ に、また
          対応するログレベルの名前は ‘levelname’ に保持されます。

        * ‘pathname’ (*note str: 16a.) - ロギングの呼び出しが行われたソ
          ースファイルへの完全なパス名をあらわす文字列です。

        * ‘lineno’ (*note int: 19c.) - ロギングの呼び出しが発せられたソ
          ース行番号。

        * ‘msg’ (*note Any: 8bc.) - イベントの説明メッセージ。様々なデー
          タのプレースホルダを含んだ %フォーマット文字列か、任意のオブジ
          ェクト (*note 任意のオブジェクトをメッセージに使用する: 3225.
          を参照)。

        * ‘args’ (*note tuple: 614.‘ | ’*note dict: 184.‘[’*note str:
          16a.‘, ’*note Any: 8bc.‘]’) - 'msg' 引数と組み合わせてイベント
          記述を得るための変数データです。

        * ‘exc_info’ (*note tuple: 614.‘[’*note type: f48.‘[’*note
          BaseException: 7d6.‘]’‘, ’‘BaseException’‘, ’*note
          types.TracebackType: cee.‘] ’‘| ’‘None’) - *note
          sys.exc_info(): 89b. によって返される現在の例外情報を含む例外
          タプルです。例外情報がない場合は ‘None’ です。

        * ‘func’ (*note str: 16a.‘ | ’‘None’) - ロギングの呼び出しを行っ
          た関数またはメソッドの名前です。

        * ‘sinfo’ (*note str: 16a.‘ | ’‘None’) - 現在のスレッドのスタッ
          クベースからログ呼び出しまでの間のスタック情報を表わすテキスト
          文字列。

      -- メソッド: getMessage ()

          ユーザが提供した引数をメッセージに交ぜた後、この *note
          LogRecord: 11ec. インスタンスへのメッセージを返します。ユーザ
          がロギングの呼び出しに与えた引数が文字列でなければ、その引数に
          *note str(): 16a. が呼ばれ、文字列に変換されます。これにより、
          ‘__str__’ メソッドが実際のフォーマット文字列を返せるようなユー
          ザ定義のクラスをメッセージとして使えます。

     バージョン 3.2 で変更: *note LogRecord: 11ec. の生成は、レコードを
     生成するために使用されるファクトリを提供することにより、さらに設定
     可能になりました。ファクトリは *note getLogRecordFactory(): 3227. と
     *note setLogRecordFactory(): 3228. を使用して設定することができます
     (ファクトリのシグネチャに関しては ‘setLogRecordFactory()’ を参照)。

     この機能を使うと *note LogRecord: 11ec. の生成時に独自の値を注入す
     ることができます。次のパターンが使えます:

          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.17.4.7 LogRecord 属性
.......................

LogRecord には幾つかの属性があり、そのほとんどはコンストラクタの引数から
得られます。(なお、LogRecord コンストラクタの引数と LogRecord 属性が常に
厳密に対応するわけではありません。) これらの属性は、レコードからのデータ
をフォーマット文字列に統合するのに使えます。以下のテーブルに、属性名、意
味、そして % 形式フォーマット文字列における対応するプレースホルダを (ア
ルファベット順に) 列挙します。

{}-フォーマット (*note str.format(): 833.) を使用していれば、書式文字列
の中でプレースホールダーとして ‘{attrname}’ を使うことができます。 $-フ
ォーマット (*note string.Template: 898.) を使用している場合は、
‘${attrname}’ 形式にしてください。もちろん、両方の場合で ‘attrname’ は使
用したい実際の属性名に置き換えてください。

{}-フォーマットの場合には、属性名の後にフォーマットフラグを指定すること
ができます。属性名とフォーマットフラグの間はコロンで分割します。例: プレ
ースホールダー ‘{msecs:03.0f}’ は、ミリセカンド値 ‘4’ を ‘004’ としてフ
ォーマットします。利用可能なオプション上の全詳細に関しては *note
str.format(): 833. ドキュメンテーションを参照してください。

属性名               フォーマット                  説明
                                                   
-------------------------------------------------------------------------------------------------------
                                                   
‘args’               このフォーマットを自分で使    ‘msg’ に組み合わせて ‘message’ を生成するための引
                     う必要はないでしょう。        数のタプル、または、マージに用いられる辞書(引数が
                                                   一つしかなく、かつそれが辞書の場合)。
                                                   
                                                   
asctime              ‘%(asctime)s’                 *note LogRecord: 11ec. が生成された時刻を人間が読
                                                   める書式で表したもの。デフォルトでは "2003-07-08
                                                   16:49:45,896" 形式 (コンマ以降の数字は時刻のミリ
                                                   秒部分) です。
                                                   
                                                   
created              ‘%(created)f’                 *note LogRecord: 11ec. が生成された時刻です
                                                   (*note time.time_ns(): ce4. / 1e9 で返される形式
                                                   で)。
                                                   
                                                   
exc_info             このフォーマットを自分で使    (‘sys.exc_info’ 風の) 例外タプルか、例外が起こっ
                     う必要はないでしょう。        ていない場合は ‘None’。
                                                   
                                                   
exc_text             このフォーマットを自分で使    Exception information formatted as a string.
                     う必要はないでしょう。        This is set when *note Formatter.format(): 3216.
                                                   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: 2139, *note INFO: 213a,
                                                   *note WARNING: 213b, *note ERROR: 213c,
                                                   *note CRITICAL: 213d.)。
                                                   
                                                   
lineno               ‘%(lineno)d’                  ロギングの呼び出しが発せられたソース行番号 (利用
                                                   できる場合のみ)。
                                                   
                                                   
message              ‘%(message)s’                 ‘msg % args’ として求められた、ログメッセージ。
                                                   *note Formatter.format(): 3216. が呼び出されたと
                                                   きに設定されます。
                                                   
                                                   
module               ‘%(module)s’                  モジュール (‘filename’ の名前部分)。
                                                   
                                                   
msecs                ‘%(msecs)d’                   *note LogRecord: 11ec. が生成された時刻のミリ秒部
                                                   分。
                                                   
                                                   
msg                  このフォーマットを自分で使    元のロギングの呼び出しで渡されたフォーマット文字
                     う必要はないでしょう。        列。 ‘args’ と合わせて、 ‘message’ 、または任意の
                                                   オブジェクトを生成します
                                                   (*note 任意のオブジェクトをメッセージに使用する: 3225.
                                                   参照)。
                                                   
                                                   
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: 1c9. 名 (利用可能な場合のみ
                                                   )。
                                                   

バージョン 3.1 で変更: 'processName' が追加されました。

バージョン 3.12 で変更: 'taskName' が追加されました。


File: python.info,  Node: LoggerAdapter オブジェクト,  Next: スレッドセーフ性,  Prev: LogRecord 属性,  Up: logging --- Python 用のログ記録手段

5.17.4.8 LoggerAdapter オブジェクト
...................................

*note LoggerAdapter: 1511. インスタンスは文脈情報をログ記録呼び出しに渡
すのを簡単にするために使われます。使い方の例は *note
コンテキスト情報をログ記録出力に付加する: 322c. を参照してください。

 -- クラス: logging.LoggerAdapter (logger, extra=None,
          merge_extra=False)

     Returns an instance of ‘LoggerAdapter’ initialized with an
     underlying *note Logger: d4a. 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 ‘LoggerAdapter’ extra.  The default
     behavior is to ignore the 'extra' argument of individual log calls
     and only use the one of the ‘LoggerAdapter’ instance

      -- メソッド: process (msg, kwargs)

          文脈情報を挿入するために、ログ記録呼び出しに渡されたメッセージ
          および/またはキーワード引数に変更を加えます。ここでの実装は
          'extra' としてコンストラクタに渡されたオブジェクトを取り、
          'extra' キーを使って 'kwargs' に加えます。返り値は ('msg',
          'kwargs') というタプルで、(変更されているはずの) 渡された引数
          を含みます。

      -- の属性: manager

          背後にある 'logger' の ‘manager’ メソッドを代理で呼び出します
          。

      -- の属性: _log

          背後にある 'logger' の ‘_log()’ メソッドを代理で呼び出します。

     *note LoggerAdapter: 1511. は上記に加え *note Logger: d4a. のメソッ
     ド *note debug(): 102f, *note info(): 2138, *note warning(): 1ad5,
     *note error(): 31f8, *note exception(): 102d, *note critical():
     102e, *note log(): 102c, *note isEnabledFor(): 1512, *note
     getEffectiveLevel(): 31f5, *note setLevel(): 16b1, *note
     hasHandlers(): 31ff. をサポートします。これらは ‘Logger’ の対応する
     メソッドと同じシグニチャを持つため、2つのインスタンスは区別せずに利
     用出来ます。

     バージョン 3.2 で変更: *note isEnabledFor(): 1512, *note
     getEffectiveLevel(): 31f5, *note setLevel(): 16b1, *note
     hasHandlers(): 31ff. が *note LoggerAdapter: 1511. に追加されました
     。これらメソッドは元のロガーに処理を委譲します。

     バージョン 3.6 で変更: 基底のロガーに移譲し、アダプターをネストでき
     るようにするために ‘manager’ 属性と ‘_log()’ メソッドが追加されまし
     た。

     バージョン 3.10 で変更: 'extra' 引数が任意になりました。

     バージョン 3.13 で変更: 'merge_extra' 引数が追加されました。


File: python.info,  Node: スレッドセーフ性,  Next: モジュールレベルの関数,  Prev: LoggerAdapter オブジェクト,  Up: logging --- Python 用のログ記録手段

5.17.4.9 スレッドセーフ性
.........................

logging モジュールは、クライアントで特殊な作業を必要としない限りスレッド
セーフになっています。このスレッドセーフ性はスレッドロックによって達成さ
れています; モジュールの共有データへのアクセスを直列化するためのロックが
一つ存在し、各ハンドラでも背後にある I/O へのアクセスを直列化するために
ロックを生成します。

*note signal: cb. モジュールを使用して非同期シグナルハンドラを実装してい
る場合、そのようなハンドラからはログ記録を使用できないかもしれません。こ
れは、 *note threading: f3. モジュールにおけるロック実装が常にリエントラ
ントではなく、そのようなシグナルハンドラから呼び出すことができないからで
す。


File: python.info,  Node: モジュールレベルの関数,  Next: モジュールレベル属性,  Prev: スレッドセーフ性,  Up: logging --- Python 用のログ記録手段

5.17.4.10 モジュールレベルの関数
................................

上で述べたクラスに加えて、いくつかのモジュールレベルの関数が存在します。

 -- の関数: logging.getLogger (name=None)

     指定された名前のロガーを返します。名前が ‘None’ であれば、ロガーの
     階層構造におけるルートロガーを返します。名前を指定する場合は、典型
     的には ''a"、 ''a.b" または ''a.b.c.d" のようなドット区切りの階層的
     な名前にします。名前の付け方は完全にログ機能を使う開発者次第ですが
     、 *note ロガーオブジェクト: 31eb. で言及されている通り、特に理由が
     なければ ‘__name__’ を使うことが推奨されます。

     与えられた名前に対して、この関数はどの呼び出しでも同じロガーインス
     タンスを返します。したがって、ロガーインスタンスをアプリケーション
     の各部でやりとりする必要はありません。

 -- の関数: logging.getLoggerClass ()

     標準の *note Logger: d4a. クラスか、最後に *note setLoggerClass():
     3233. に渡したクラスを返します。この関数は、新たなクラス定義の中で
     呼び出して、カスタマイズした ‘Logger’ クラスのインストールが既に他
     のコードで適用したカスタマイズを取り消さないことを保証するために使
     われることがあります。例えば以下のようにします:

          class MyLogger(logging.getLoggerClass()):
              # ... override behaviour here

 -- の関数: logging.getLogRecordFactory ()

     *note LogRecord: 11ec. を生成するのに使われる callable を返します。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 11ec. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note setLogRecordFactory(): 3228. とともに提供されま
     した。

     このファクトリがどのように呼ばれるかに関する詳細は *note
     setLogRecordFactory(): 3228. を参照してください。

 -- の関数: logging.debug (msg, *args, **kwargs)

     ルートロガーの *note Logger.debug(): 102f. メソッドを呼び出す便利関
     数です。引数の取り扱いはあらゆる点で当該メソッドと同じです。

     唯一の違いはルートロガーがハンドラを持たない場合で、この場合はルー
     トロガーの ‘debug’ メソッドを呼び出す前に *note basicConfig(): bf7.
     が呼ばれます。

     非常に短いスクリプトや ‘logging’ の機能についての簡単なデモに対して
     は、 ‘debug’ やその他のモジュールレベル関数は便利でしょう。しかしな
     がら、ほとんどのプログラムはロギングの設定を慎重かつ明示的に制御し
     たいはずです。したがって、このドキュメントの最初に書かれているとお
     り、モジュールレベルのロガーを生成してそのロガーに対する *note
     Logger.debug(): 102f. メソッド (または他のログレベル固有のメソッド)
     を呼び出す方を好むでしょう。

 -- の関数: logging.info (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note INFO: 213a. でメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 31f7. と
     同じです。

 -- の関数: logging.warning (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note WARNING: 213b. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     31f7. と同じです。

          注釈: ‘warning’ と機能的に等価な古い関数 ‘warn’ があります。
          ‘warn’ は廃止予定なので使わないでください - 代わりに ‘warning’
          を使ってください。

 -- の関数: logging.error (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 213c. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 31f7.
     と同じです。

 -- の関数: logging.critical (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note CRITICAL: 213d. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     31f7. と同じです。

 -- の関数: logging.exception (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 213c. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 31f7.
     と同じです。例外情報がログメッセージに追加されます。この関数は例外
     ハンドラからのみ呼び出されるべきです。

 -- の関数: logging.log (level, msg, *args, **kwargs)

     ルートロガーに対して 'level' で指定したログレベルでメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 31f7. と
     同じです。

 -- の関数: 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: 16b5. でメッセージを書式化する
     際のように、数字のレベルをテキスト表現に対応付ける際に用いられます
     。この関数は自作のレベルを定義するために使うこともできます。使われ
     るレベルに対する唯一の制限は、レベルは正の整数でなくてはならず、メ
     ッセージの深刻度が上がるに従ってレベルの数も上がらなくてはならない
     ということです。

          注釈: 独自のレベルを定義したい場合、 *note カスタムレベル:
          3239. のセクションを参照してください。

 -- の関数: logging.getLevelNamesMapping ()

     ログレベルの名前と対応するログレベルのマッピングを返します。例えば
     、文字列 "CRITICAL" は *note CRITICAL: 213d. にマップされます。この
     関数が返すマッピングオブジェクトは、関数呼び出しのたびに内部のマッ
     ピングをコピーしたものです。

     Added in version 3.11.

 -- の関数: logging.getLevelName (level)

     テキストまたは数値表現でログレベル 'level' を返してください。

     'level' が定義済みのレベル *note CRITICAL: 213d, *note ERROR: 213c,
     *note WARNING: 213b, *note INFO: 213a, *note DEBUG: 2139. のいずれ
     かである場合、対応する文字列が返されます。 *note addLevelName():
     3238. を使ってレベルに名前を関連付けていた場合、 'level' に関連付け
     られた名前が返されます。定義済みのレベルに対応する数値を指定した場
     合、レベルに対応した文字列表現を返します。

     'level' パラメータは、 *note INFO: 213a. のような整数定数の代わりに
     'INFO' のようなレベルの文字列表現も受け付けます。この場合、この関数
     は関連するレベルの数値表現を返します。

     もし渡された数値や文字列がマッチしなければ、 'Level %s' % level が
     返されます。

          注釈: レベルは内部的には整数です(これはロギングのロジックが大
          小比較をする必要があるからです)。この関数は、数値のレベルを、
          書式記述子 ‘%(levelname)s’ (*note LogRecord 属性: 31f6. 参照
          )によって書式化されるログ出力の表示用レベル名に変換するなどの
          用途に使用されます。

     バージョン 3.4 で変更: In Python versions earlier than 3.4, this
     function could also be passed a text level, and would return the
     corresponding numeric value of the level.  This undocumented
     behaviour was considered a mistake, and was removed in Python 3.4,
     but reinstated in 3.4.2 due to retain backward compatibility.

 -- の関数: logging.getHandlerByName (name)

     'name' に指定した名前のハンドラを返します。指定した名前のハンドラが
     ない場合は ‘None’ を返します。

     Added in version 3.12.

 -- の関数: logging.getHandlerNames ()

     全ての既知のハンドラ名の、イミュータブルな集合を返します。

     Added in version 3.12.

 -- の関数: logging.makeLogRecord (attrdict)

     属性が 'attrdict' で定義された、新しい *note LogRecord: 11ec. イン
     スタンスを生成して返します。この関数は、 pickle された ‘LogRecord’
     属性の辞書をソケットを介して送信し、受信端で ‘LogRecord’ インスタン
     スとして再構成する場合に便利です。

 -- の関数: logging.basicConfig (**kwargs)

     Does basic configuration for the logging system by creating a *note
     StreamHandler: 1415. with a default *note Formatter: 16b5. and
     adding it to the root logger.  The functions *note debug(): 31f7,
     *note info(): 3220, *note warning(): 352, *note error(): 3234. and
     *note critical(): 3235. will call ‘basicConfig()’ automatically if
     no handlers are defined for the root logger.

     この関数は 'force' キーワード引数に ‘True’ が設定されない限り、ルー
     トロガーに設定されたハンドラがあれば何もしません。

          注釈: この関数は、他のスレッドが開始される前にメインスレッドか
          ら呼び出されるべきです。Python の 2.7.1 や 3.2 以前のバージョ
          ンでは、この関数が複数のスレッドから呼ばれると(珍しい状況下と
          はいえ)ハンドラがルートロガーに複数回加えられることがあり、ロ
          グ内のメッセージが重複するという予期しない結果をもたらすことが
          あります。

     以下のキーワード引数がサポートされます。

     フォーマット       説明
                        
     ---------------------------------------------------------------------
                        
     'filename'         *note StreamHandler: 1415. ではなく指定された名
                        前で *note FileHandler: 1cb0. が作られます。
                        
                        
     'filemode'         'filename' が指定された場合、この
                        *note モード: 2638. でファイルが開かれます。 デ
                        フォルトは ‘'a'’ です。
                        
                        
     'format'           ハンドラーで指定されたフォーマット文字列を使い
                        ます。デフォルトは ‘levelname’, ‘name’,
                        ‘message’ 属性をコロン区切りにしたものです。
                        
                        
     'datefmt'          指定された日時の書式で
                        *note time.strftime(): 1406. が受け付けるものを
                        使います。
                        
                        
     'style'            'format' が指定された場合、書式文字列にこのスタ
                        イルを仕様します。 ‘'%'’, ‘'{'’, ‘'$'’ のうち
                        1つで、それぞれ *note printf-style: 8dc,
                        *note str.format(): 833,
                        *note string.Template: 898. に対応します。 デフ
                        ォルトは ‘'%'’ です。
                        
                        
     'level'            ルートロガーのレベルを指定された
                        *note レベル: 86b. に設定します。
                        
                        
     'stream'           指定されたストリームを
                        *note StreamHandler: 1415. の初期化に使います。
                        この引数は 'filename' と同時には使えないことに
                        注意してください。 両方が指定されたときには
                        ‘ValueError’ が送出されます。
                        
                        
     'handlers'         もし指定されれば、 これは root ロガーに追加され
                        る既に作られたハンドラのイテラブルになります。
                        まだフォーマッタがセットされていないすべてのハ
                        ンドラは、この関数で作られたデフォルトフォーマ
                        ッタが割り当てられることになります。この引数は
                        'filename' や 'stream' と互換性がないことに注意
                        してください。両方が存在する場合 ‘ValueError’ が
                        上げられます。
                        
                        
     'force'            このキーワード引数が真に設定されている場合、ル
                        ートのロガーに取り付けられたハンドラは全て取り
                        除かれ、他の引数によって指定された設定が有効に
                        なる前に閉じられます。
                        
                        
     'encoding'         もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1cb0. が作成
                        されるときにこの値が利用され、出力ファイルを開
                        く時に使用されます。
                        
                        
     'errors'           もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1cb0. が作成
                        されるときのこの値が使用され、出力ファイルを開
                        く時に使われます。もし指定されなかった場合、
                        'backslashreplace' が使用されます。もし ‘None’
                        が指定されると *note open(): 318. のように渡さ
                        れ、'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(): b5d.
     API を使用してロガーを取得してください。

 -- の関数: logging.setLogRecordFactory (factory)

     *note LogRecord: 11ec. を生成するのに使われる callable をセットしま
     す。


     パラメータ: ‘factory’ - ログレコードを生成するファクトリとして振舞
     う callable。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 11ec. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note getLogRecordFactory(): 3227. とともに提供されま
     した。

     ファクトリは以下のようなシグネチャを持っています:

     ‘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(): 108a. で提供されるような
          、呼び出し階層を示すスタックトレースバック。


          ‘kwargs’: 追加のキーワード引数。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28524


File: python.info,  Node: モジュールレベル属性,  Next: warnings モジュールとの統合,  Prev: モジュールレベルの関数,  Up: logging --- Python 用のログ記録手段

5.17.4.11 モジュールレベル属性
..............................

 -- データ: logging.lastResort

     「最後の手段のハンドラ」が、この属性で利用可能です。これは *note
     StreamHandler: 1415. が ‘sys.stderr’ に ‘WARNING’ レベルで書き出し
     ているのがそうですし、ロギングの設定がなにか不在のロギングイベント
     を扱う場合に使われます。最終的な結果は、メッセージを単に
     ‘sys.stderr’ に出力することです。これはかつて「logger XYZ について
     のハンドラが見つかりません」と言っていたエラーメッセージを置き換え
     ています。もしも何らかの理由でその昔の振る舞いが必要な場合は、
     ‘lastResort’ に ‘None’ をセットすれば良いです。

     Added in version 3.2.

 -- データ: logging.raiseExceptions

     ログメッセージの処理中に発生した例外を伝播させるかどうかを調べるた
     めに使われます。

     デフォルト: ‘True’.

     *note raiseExceptions: 1416. が ‘False’ の場合、発生した例外は静か
     に無視されます。これはほとんどのログシステムにおいて望ましい動作で
     す - ほとんどのユーザーはログシステムのエラーには興味がなく、アプリ
     ケーションのエラーにより強い関心を持つでしょう。


File: python.info,  Node: warnings モジュールとの統合,  Prev: モジュールレベル属性,  Up: logging --- Python 用のログ記録手段

5.17.4.12 warnings モジュールとの統合
.....................................

The *note captureWarnings(): 323e. function can be used to integrate
‘logging’ with the *note warnings: 119. module.

 -- の関数: logging.captureWarnings (capture)

     この関数は、logging による警告の補足を、有効にまたは無効にします。

     'capture' が ‘True’ なら、 *note warnings: 119. モジュールに発せら
     れた警告は、ロギングシステムにリダイレクトされるようになります。具
     体的には、警告が *note warnings.formatwarning(): 1e55. でフォーマッ
     ト化され、結果の文字列が ‘'py.warnings'’ という名のロガーに、 *note
     WARNING: 213b. の重大度でロギングされるようになります。

     '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.17.5 ‘logging.config’ -- ログ記録の環境設定
---------------------------------------------

'ソースコード:' Lib/logging/config.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 1412.

   * *note 上級チュートリアル: 1413.

   * *note ロギングクックブック: 1414.

__________________________________________________________________

この節は、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.17.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 ‘logging’ or *note
logging.handlers: 8d.

 -- の関数: logging.config.dictConfig (config)

     辞書からロギング環境設定を取得します。この辞書の内容は、以下の
     *note 環境設定辞書スキーマ: 3243. で記述されています。

     環境設定中にエラーに遭遇すると、この関数は適宜メッセージを記述しつ
     つ *note ValueError: 2ee, *note TypeError: 199, *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(): 13cc. は ‘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 ‘dictConfig()’ 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 環境設定ファイルの書式: 3244. で
     記述されているとおりにしなければなりません。この関数はアプリケーシ
     ョンから何度も呼び出すことができ、これによって、 (設定を選択し、選
     択された設定を読み出す機構をデベロッパが提供していれば) 複数の準備
     済みの設定からエンドユーザが選択するようにできます。

     It will raise *note FileNotFoundError: 266. if the file doesn't
     exist and *note RuntimeError: 246. if the file is invalid or empty.


     パラメータ:

        * ‘fname’ - A filename, or a file-like object, or an instance
          derived from *note RawConfigParser: 116a.  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(): 1686.

        * ‘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: 116a.
     のサブクラスのインスタンスが渡せ得るようになっています。これによっ
     てこのようなことが容易になります:

             * ロギングの設定が、アプリケーション全体の設定における単な
               る一部であるような設定ファイルの使用。

             * ファイルから設定を読み込み、 ‘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(): 13cc. あるいは *note fileConfig(): d4c. で処理できる
     ファイルとして送信されます。 *note Thread: 177. インスタンスを返し
     、このインスタンスの *note start(): 179. を呼び出してサーバを起動し
     、適切なところで *note join(): 1401. を呼び出すことができます。サー
     バを停止するには、 *note stopListening(): 3245. を呼び出します。

     ‘verify’ 引数を指定する場合は、これはソケットを通して受け取ったバイ
     ト文字列が妥当であるか、処理すべきであるかどうかを検査する callable
     である必要があります。ソケットを通じて、暗号化または署名あるいはそ
     の両方を受け取ることがあります。そのような場合に、 ‘verify’
     callable が署名の正当性検査または暗号化の復号あるいはその両方を実施
     することが出来ます。 ‘verify’ callable は単一引数で呼び出されます -
     ソケットを通じて受け取ったバイト文字列です - そして処理すべきバイト
     文字列、または捨て去られるべきであることを示すための ‘None’ を返す
     必要があります。返却されるバイト文字列は(たとえば正当性検査だけが行
     われて)渡されたものと同じかもしれませんし、あるいは(おそらく暗号化
     の復号が行われて)まったく異なるものかもしれません。

     ソケットに設定を送るには、まず設定ファイルを読み、それを
     ‘struct.pack('>L', n)’ を使って長さ 4 バイトのバイナリにパックした
     ものを前に付けたバイト列としてソケットに送ります。
          注釈: 設定の一部は *note eval(): 4a3. を通じて渡されるため、こ
          の関数を利用することはユーザーをセキュリティ上のリスクにさらす
          可能性があります。この関数は ‘localhost’ のソケットだけにバイ
          ンドされており、リモートマシンからの接続を受け付けませんが、そ
          れでも *note listen(): 116b. を呼び出したプロセスのアカウント
          のもとで信頼できないコードが実行されうるシナリオが存在します。
          特に、 ‘listen()’ を呼び出したプロセスが複数のユーザーが利用す
          るマシン上で実行されており、ユーザー同士が互いに信頼できない場
          合、悪意あるユーザーが被害者ユーザーのプロセス上で本質的に任意
          のコードを実行するように計画する可能性があります。攻撃は、単に
          被害者ユーザーの ‘listen()’ ソケットに接続して、被害者ユーザー
          のプロセス上で攻撃者が実行したいコードが実行されるような設定を
          送り込むだけです。この攻撃はデフォルトのポートが使われている場
          合きわめて容易であり、異なるポートが使われている場合でもそれほ
          ど難しくはありません。このような事象が発生するリスクを回避する
          ためには、 ‘listen()’ の ‘verify’ 引数を使って不正な設定が適用
          されるのを防ぐようにしてください。

     バージョン 3.4 で変更: ‘verify’ 引数が追加されました。

          注釈: 既存のロガーを無効にしない構成をリスナーに送信する場合は
          、設定にはJSONフォーマットを使用する必要があります。これは、設
          定に *note dictConfig(): 13cc. を使用します。 このメソッドを使
          用すると、 ‘disable_existing_loggers’ に ‘False’ を指定した設
          定を送信できます。

 -- の関数: logging.config.stopListening ()

     *note listen(): 116b. を呼び出して作成された、待ち受け中のサーバを
     停止します。通常 ‘listen()’ の戻り値に対して ‘join()’ が呼ばれる前
     に呼び出します。


File: python.info,  Node: セキュリティで考慮すべき点,  Next: 環境設定辞書スキーマ,  Prev: 環境設定のための関数,  Up: logging config --- ログ記録の環境設定

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

logging の設定機能は便利さを提供します。その便利さの一部は設定ファイル内
のテキストを logging の設定に使われる Python オブジェクトに変換する機能
を提供することによって実現されています - たとえば、 *note
ユーザ定義オブジェクト: 3248. で説明されているような機能です。しかし、ま
さにこのメカニズム (実行可能オブジェクトをユーザー定義モジュールからイン
ポートし、設定ファイルから読み込んだパラメータを使ってそれらを呼び出すこ
と) が任意のコードを呼び出すことに利用できる可能性があります。そして、こ
の理由により、信頼できない情報源から取得した設定ファイルは '細心の注意'
を払って取り扱わなければなりません。そのようなファイルをロードする場合、
そのファイルがいかなる問題も起こさないと確認した上で実際にファイルをロー
ドしてください。


File: python.info,  Node: 環境設定辞書スキーマ,  Next: 環境設定ファイルの書式,  Prev: セキュリティで考慮すべき点,  Up: logging config --- ログ記録の環境設定

5.17.5.3 環境設定辞書スキーマ
.............................

ロギング設定を記述するには、生成するさまざまなオブジェクトと、それらのつ
ながりを列挙しなければなりません。例えば、 'console' という名前のハンド
ラを生成し、'startup' という名前のロガーがメッセージを 'console' ハンド
ラに送るというようなことを記述します。これらのオブジェクトは、 *note
logging: 8b. モジュールによって提供されるものに限らず、独自のフォーマッ
タやハンドラクラスを書くことも出来ます。このクラスへのパラメータは、
‘sys.stderr’ のような外部オブジェクトを必要とすることもあります。これら
のオブジェクトとつながりを記述する構文は、以下の *note
オブジェクトの接続: 324a. で定義されています。

* Menu:

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


File: python.info,  Node: 辞書スキーマの詳細,  Next: 増分設定,  Up: 環境設定辞書スキーマ

5.17.5.4 辞書スキーマの詳細
...........................

*note dictConfig(): 13cc. に渡される辞書は、以下のキーを含んでいなければ
なりません:

   * 'version' - スキーマのバージョンを表す整数値に設定されます。現在有
     効な値は 1 だけですが、このキーがあることで、このスキーマは後方互換
     性を保ちながら発展できます。

その他すべてのキーは省略可能ですが、与えられたなら以下に記述するように解
釈されます。以下のすべての場合において、 '環境設定辞書' と記載されている
所では、その辞書に特殊な ‘'()'’ キーがあるかを調べることで、カスタムのイ
ンスタンス化が必要であるか判断されます。その場合は、以下の *note
ユーザ定義オブジェクト: 3248. で記述されている機構がインスタンス生成に使
われます。そうでなければ、インスタンス化するべきものを決定するのにコンテ
キストが使われます。

   * 'formatters' - 対応する値は辞書で、そのそれぞれのキーがフォーマッタ
     id になり、それぞれの値が対応する *note Formatter: 16b5. インスタン
     スをどのように環境設定するかを記述する辞書になります。

     設定辞書は *note Formatter: 16b5. オブジェクトを作成するときの引数
     に対応する、次のようなオプションキーがないか探索されます。

        * ‘format’

        * ‘datefmt’

        * ‘style’

        * ‘validate’ (バージョン3.8以降)

        * ‘defaults’ (since version >=3.12)

     オプションの ‘class’ キーはフォーマッタークラスの名前を表します（モ
     ジュールとクラス名をドットで繋げる）。インスタンス化時の引数は
     *note Formatter: 16b5. と同じであるため、このキーは ‘Formatter’ を
     カスタマイズしたサブクラスのインスタンス化に使うのがもっとも便利で
     す。例えばトレースバックにさらに情報を付加したり、情報を要約代替ク
     ラスを実装するといったことが想定されます。もし、自作のフォーマッタ
     ーが異なる引数や追加の設定引数を持つ場合は、 *note
     ユーザ定義オブジェクト: 3248. を使うべきです。

   * 'filters' - 対応する値は辞書で、そのそれぞれのキーがフィルタ id に
     なり、それぞれの値が対応する Filter インスタンスをどのように環境設
     定するかを記述する辞書になります。

     環境設定辞書は、(デフォルトが空文字列の) キー ‘name’ を検索され、そ
     れらが *note logging.Filter: 1418. インスタンスを構成するのに使われ
     ます。

   * '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: 1415. としてインスタンス化さ
     れます。id が ‘file’ であるハンドラが、 ‘filename='logconfig.log',
     maxBytes=1024, backupCount=3’ をキーワード引数にして、 *note
     logging.handlers.RotatingFileHandler: 19a1. としてインスタンス化さ
     れます。

   * 'loggers' - 対応する値は辞書で、そのそれぞれのキーがロガー名になり
     、それぞれの値が対応する Logger インスタンスをどのように環境設定す
     るかを記述する辞書になります。

     環境設定辞書は、以下のキーを検索されます:

        * ‘level’ (任意)。ロガーのレベルです。

        * ‘propagate’ (任意)。ロガーの伝播の設定です。

        * ‘filters’ (任意)。このロガーへのフィルタの id のリストです。

          バージョン 3.11 で変更: ‘filters’ は id に加えてフィルタのイン
          スタンスを受け取ることができるようになりました。

        * ‘handlers’ (任意)。このロガーへのハンドラの id のリストです。

     指定されたロガーは、指定されたレベル、伝播、ハンドラに従って環境設
     定されます。

   * 'root' - これは、ルートロガーへの設定になります。この環境設定の進行
     は、‘propagate’ 設定が適用されないことを除き、他のロガーと同じです
     。

   * 'incremental' - この環境設定が既存の環境設定に対する増分として解釈
     されるかどうかです。この値のデフォルトは ‘False’ で、指定された環境
     設定は、既存の *note fileConfig(): d4c. API によって使われているの
     と同じ意味上で、既存の環境設定を置き換えます。

     指定された値が ‘True’ なら、環境設定は *note 増分設定: 324d. の節で
     記述されているように進行します。

   * 'disable_existing_loggers' - 既存の非ルートロガーをすべて無効にする
     べきかどうかです。この設定は、 *note fileConfig(): d4c. における同
     じ名前のパラメータと同じです。設定されていなければ、このパラメータ
     のデフォルトは ‘True’ です。この値は、 'incremental' が ‘True’ なら
     無視されます。


File: python.info,  Node: 増分設定,  Next: オブジェクトの接続,  Prev: 辞書スキーマの詳細,  Up: 環境設定辞書スキーマ

5.17.5.5 増分設定
.................

増分設定に完全な柔軟性を提供するのは難しいです。例えば、フィルタやフォー
マッタのようなオブジェクトは匿名なので、一旦環境設定がなされると、設定を
拡張するときにそのような匿名オブジェクトを参照することができません。

さらに、一旦環境設定がなされた後、実行時にロガー、ハンドラ、フィルタ、フ
ォーマッタのオブジェクトグラフを任意に変えなければならない例もありません
。ロガーとハンドラの冗長性は、レベル (または、ロガーの場合には、伝播フラ
グ) を設定することによってのみ制御できます。安全な方法でオブジェクトグラ
フを任意に変えることは、マルチスレッド環境で問題となります。不可能ではな
いですが、その効用は実装に加えられる複雑さに見合いません。

従って、環境設定辞書の ‘incremental’ キーが与えられ、これが ‘True’ であ
るとき、システムは ‘formatters’ と ‘filters’ の項目を完全に無視し、
‘handlers’ の項目の ‘level’ 設定と、‘loggers’ と ‘root’ の項目の ‘level’
と ‘propagate’ 設定のみを処理します。

環境設定辞書の値を使うことで、設定は pickle 化された辞書としてネットワー
クを通してソケットリスナに送ることができます。これにより、長時間起動する
アプリケーションのロギングの冗長性を、アプリケーションを止めて再起動する
必要なしに、いつでも変更することができます。


File: python.info,  Node: オブジェクトの接続,  Next: ユーザ定義オブジェクト,  Prev: 増分設定,  Up: 環境設定辞書スキーマ

5.17.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.17.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: 16b5. インスタンスです。 2 つ目は、id が ‘default’ で
、長いフォーマットを持ち、時間フォーマットも定義していて、結果はその 2 つ
のフォーマット文字列で初期化された ‘logging.Formatter’ になります。
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: 16b5.
インスタンスが生成されます。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.17.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.17.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.17.5.10 内部オブジェクトへのアクセス
......................................

外部オブジェクトと同様、環境設定内部のオブジェクトへのアクセスを必要とす
ることもあります。これは、その各オブジェクトを司る環境設定システムによっ
て暗黙に行われます。例えば、ロガーやハンドラの ‘level’ に対する文字列値
‘'DEBUG'’ は、自動的に値 ‘logging.DEBUG’ に変換されますし、‘handlers’,
‘filters’ および ‘formatter’ の項目は、オブジェクト id を取って、適切な
送信先オブジェクトを決定します。

しかし、ユーザ定義モジュールには、 *note logging: 8b. モジュールには分か
らないような、より一般的な機構が必要です。例えば、 *note
logging.handlers.MemoryHandler: 3257. があって、委譲する先の別のハンドラ
である ‘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.17.5.11 インポート解決とカスタムインポーター
..............................................

インポート解決は、デフォルトではインポートを行うために *note
__import__(): ad5. 組み込み関数を使用します。これを独自のインポートメカ
ニズムに置き換えたいと思うかもしれません: もしそうなら、
‘DictConfigurator’ あるいはその上位クラスである ‘BaseConfigurator’ クラ
スの ‘importer’ 属性を置換することができます。ただし、この関数はクラスか
らディスクリプタ経由でアクセスされる点に注意する必要があります。インポー
トを行うために Python callable を使用していて、それをインスタンスレベル
ではなくクラスレベルで定義したければ、 *note staticmethod(): 451. でそれ
をラップする必要があります。例えば:

     from importlib import import_module
     from logging.config import BaseConfigurator

     BaseConfigurator.importer = staticmethod(import_module)

configurator 'インスタンス' に対してインポート callable をセットする場合
は、 *note staticmethod(): 451. でラップする必要はありません。


File: python.info,  Node: Configuring QueueHandler and QueueListener,  Prev: インポート解決とカスタムインポーター,  Up: 環境設定辞書スキーマ

5.17.5.12 Configuring QueueHandler and QueueListener
....................................................

If you want to configure a *note QueueHandler: 1bc0, noting that this is
normally used in conjunction with a *note QueueListener: 244, you can
configure both together.  After the configuration, the ‘QueueListener’
instance will be available as the *note listener: 325b. attribute of the
created handler, and that in turn will be available to you using *note
getHandlerByName(): 1bc1. 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: 325c. and *note
     Queue.get: 325d. public API. For instance, this may be an actual
     instance of *note queue.Queue: 15b0. or a subclass thereof, or a
     proxy obtained by *note
     multiprocessing.managers.SyncManager.Queue(): 325e.

     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: 15b0. 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 ユーザ定義オブジェクト: 3248.  The result of
     this construction should be a *note queue.Queue: 15b0. instance.

If the ‘queue’ key is absent, a standard unbounded *note queue.Queue:
15b0. 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: 244.  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 ユーザ定義オブジェクト: 3248.  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:
244. 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: 1bc0. and
*note QueueListener: 244.

Added in version 3.12.


File: python.info,  Node: 環境設定ファイルの書式,  Prev: 環境設定辞書スキーマ,  Up: logging config --- ログ記録の環境設定

5.17.5.13 環境設定ファイルの書式
................................

*note fileConfig(): d4c. が解釈できる環境設定ファイルの形式は、 *note
configparser: 26. の機能に基づいています。ファイルには、 ‘[loggers]’,
‘[handlers]’, ‘[formatters]’ といったセクションが入っていなければならず
、各セクションではファイル中で定義されている各タイプのエンティティを名前
で指定しています。こうしたエンティティの各々について、そのエンティティを
どう設定するかを示した個別のセクションがあります。すなわち、 ‘log01’ と
いう名前の ‘[loggers]’ セクションにあるロガーに対しては、対応する詳細設
定がセクション ‘[logger_log01]’ に収められています。同様に、 ‘hand01’ と
いう名前の ‘[handlers]’ セクションにあるハンドラは ‘[handler_hand01]’ と
呼ばれるセクションに設定をもつことになり、 ‘[formatters]’ セクションにあ
る ‘form01’ は ‘[formatter_form01]’ というセクションで設定が指定されてい
ます。ルートロガーの設定は ‘[logger_root]’ と呼ばれるセクションで指定さ
れていなければなりません。

     注釈: *note fileConfig(): d4c. API は *note dictConfig(): 13cc. API
     よりも古く、ロギングのある種の側面についてカバーする機能に欠けてい
     ます。たとえば ‘fileConfig()’ では数値レベルを超えたメッセージを単
     に拾うフィルタリングを行う *note Filter: 1418. オブジェクトを構成出
     来ません。 ‘Filter’ のインスタンスをロギングの設定において持つ必要
     があるならば、 ‘dictConfig()’ を使う必要があるでしょう。設定の機能
     における将来の拡張は ‘dictConfig()’ に対して行われることに注意して
     ください。ですから、そうするのが便利であるときに新しい 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 評価:
262c. されます。

‘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 評価:
262c. される時点では、ハンドラークラスのコンストラクタのための引数のリス
トです。典型的なコンストラクタの引数が生成される方法については、各ハンド
ラのコンストラクタまたは下記の例を参照してください。指定されなければデフ
ォルトは ‘()’ になります。

オプションの ‘kwargs’ は、 ‘logging’ パッケージの名前空間のコンテキスト
で *note 評価: 262c. される時点では、ハンドラークラスのコンストラクタの
ためのキーワード引数の辞書です。指定されなければデフォルトは ‘{}’ になり
ます。

     [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 フォーマッターのセクション: 324c. の辞書スキーマと同じキーを持つ、
フォーマッター設定の引数です。

The ‘defaults’ entry, when *note evaluated: 262c. 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(): 116b. を使用しているこ
     とに起因する潜在的なセキュリティリスクがあります。そのリスクは、相
     互に信頼できない多数のユーザが同じマシン上でコードを実行する場合に
     制限されています; 詳細は ‘listen()’ ドキュメンテーションを参照して
     ください。

参考
....

*note logging: 8b. モジュール

     logging モジュールの API リファレンス。

*note logging.handlers: 8d. モジュール

     logging モジュールに含まれる、便利なハンドラです。


File: python.info,  Node: logging handlers --- ログ記録ハンドラー,  Next: platform --- 実行中プラットフォームの固有情報を参照する,  Prev: logging config --- ログ記録の環境設定,  Up: 汎用オペレーティングシステムサービス

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

'ソースコード:' Lib/logging/handlers.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 1412.

   * *note 上級チュートリアル: 1413.

   * *note ロギングクックブック: 1414.

__________________________________________________________________

このパッケージでは、以下の便利なハンドラが提供されています。なお、これら
のハンドラのうち、3 つ (*note StreamHandler: 1415, *note FileHandler:
1cb0. および *note NullHandler: 14a0.) は、実際には *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.17.6.1 StreamHandler
......................

*note logging: 8b. コアパッケージに含まれる *note StreamHandler: 1415. ク
ラスは、ログ出力を 'sys.stdout', 'sys.stderr' あるいは何らかのファイル風
(file-like) オブジェクト (あるいは、より正確に言えば ‘write()’ および
‘flush()’ メソッドをサポートする何らかのオブジェクト) といったストリーム
に送信します。

 -- クラス: logging.StreamHandler (stream=None)

     *note StreamHandler: 1415. クラスの新たなインスタンスを返します。
     'stream' が指定された場合、インスタンスはログ出力先として指定された
     ストリームを使います; そうでない場合、 'sys.stderr' が使われます。

      -- メソッド: emit (record)

          フォーマッタが指定されていれば、フォーマッタを使ってレコードを
          書式化します。 次に、レコードが *note terminator: 3266. ととも
          にストリームに書き込まれます。 例外情報が存在する場合、 *note
          traceback.print_exception(): a53. を使って書式化され、 ストリ
          ームの末尾につけられます。

      -- メソッド: flush ()

          ストリームの *note flush(): 3267. メソッドを呼び出してバッファ
          をフラッシュします。 ‘close()’ メソッドは *note Handler: 16b4.
          から継承しているため何も出力を行わないので、 ‘flush()’ 呼び出
          しを明示的に行う必要があるかもしれません。

      -- メソッド: 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.17.6.2 FileHandler
....................

*note logging: 8b. コアパッケージに含まれる *note FileHandler: 1cb0. ク
ラスは、ログ出力をディスク上のファイルに送信します。このクラスは出力機能
を *note StreamHandler: 1415. から継承しています。

 -- クラス: logging.FileHandler (filename, mode='a', encoding=None,
          delay=False, errors=None)

     Returns a new instance of the *note FileHandler: 1cb0. 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(): 326a.  By default, the file grows indefinitely.  If
     'errors' is specified, it's used to determine how encoding errors
     are handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 268. オブジェク
     トも '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.17.6.3 NullHandler
....................

Added in version 3.1.

*note logging: 8b. コアパッケージに含まれる *note NullHandler: 14a0. ク
ラスは、いかなる書式化も出力も行いません。これは本質的には、ライブラリ開
発者に使われる 'no-op' ハンドラです。

 -- クラス: logging.NullHandler

     *note NullHandler: 14a0. クラスの新しいインスタンスを返します。

      -- メソッド: emit (record)

          このメソッドは何もしません。

      -- メソッド: handle (record)

          このメソッドは何もしません。

      -- メソッド: createLock ()

          アクセスが特殊化される必要がある I/O が下にないので、このメソ
          ッドはロックに対して ‘None’ を返します。

*note NullHandler: 14a0. の使い方の詳しい情報は、 *note
ライブラリのためのロギングの設定: 3271. を参照してください。


File: python.info,  Node: WatchedFileHandler,  Next: BaseRotatingHandler,  Prev: NullHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.4 WatchedFileHandler
...........................

The *note WatchedFileHandler: 3274. 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(): 26f. はこの値として常に 0 を返します。

 -- クラス: logging.handlers.WatchedFileHandler (filename, mode='a',
          encoding=None, delay=False, errors=None)

     Returns a new instance of the *note WatchedFileHandler: 3274.
     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(): 3275.  By default, the file grows indefinitely.
     If 'errors' is provided, it determines how encoding errors are
     handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 268. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: reopenIfNeeded ()

          ファイルが変更されていないかチェックします。 もし変更されてい
          れば、手始めにレコードをファイルに出力し、既存のストリームはフ
          ラッシュして閉じられ、ファイルが再度開かれます。

          Added in version 3.6.

      -- メソッド: emit (record)

          レコードをファイルに出力しますが、最初に *note
          reopenIfNeeded(): eb8. を呼び出して、変更があった場合はファイ
          ルを再度開きます。


File: python.info,  Node: BaseRotatingHandler,  Next: RotatingFileHandler,  Prev: WatchedFileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.5 BaseRotatingHandler
............................

The *note BaseRotatingHandler: 3278. class, located in the
‘logging.handlers’ module, is the base class for the rotating file
handlers, *note RotatingFileHandler: 19a1. and *note
TimedRotatingFileHandler: 1167.  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(): 327a. メソッドはこの callable に委譲され
          ます。 callable に渡されるパラメータは ‘rotation_filename()’ に
          渡されたものです。

               注釈: namer 関数はロールオーバー中にかなりの回数呼ばれま
               す。そのため、できるだけ単純で、速くあるべきです。さらに
               、それは与えられた入力に対しては常に同じ出力を返すべきで
               す。そうでなければ、ロールオーバーの振る舞いは期待通りに
               動かないかもしれません。

               namer 属性にローテーションの際に使われるファイル名に埋め
               込むための特定の属性を保持しようとする場合に注意が必要な
               ことは、注意喚起しておくべきでしょう。たとえば *note
               RotatingFileHandler: 19a1. は、ローテーションが期待通りに
               動作するために、名前に連続した番号を含むようなファイル名
               のリストを持つことを期待します。また *note
               TimedRotatingFileHandler: 1167. は (ハンドラの初期化時に
               渡された ‘backupCount’ にもとづいて) 削除すべき古いファイ
               ルを決定しながら、古いログファイルを削除します。この仕組
               みが動作するためには、ファイル名は名前に含まれる日付や時
               刻でソート可能である必要があり、 namer はそれを尊重しなけ
               ればなりません (namer がこの規則を尊重したくない場合、そ
               のような namer は *note getFilesToDelete(): 327b. メソッ
               ドが特定の命名規則に適合するようにオーバーライドされた
               ‘TimedRotatingFileHandler’ の派生クラス内で使う必要がある
               でしょう)。

          Added in version 3.3.

      -- の属性: rotator

          この属性に callable がセットされた場合、 *note rotate(): 327d.
          メソッドはこの callable に委譲されます。 callable に渡されるパ
          ラメータは ‘rotate()’ に渡されたものです。

          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: 19a1. と *note TimedRotatingFileHandler:
1167. のインスタンスに対して同じ callable が使えます。もし namer や
rotator callable が例外を上げれば、 ‘emit()’ 呼び出しで発生した他の例外
と同じ方法で、つまりハンドラの ‘handleError()’ メソッドによって扱われま
す。

ローテート処理に大幅な変更を加える必要があれば、メソッドをオーバーライド
することができます。

例えば、 *note rotator と namer
を使ってログローテートをカスタマイズする: 327e. を参照してください。


File: python.info,  Node: RotatingFileHandler,  Next: TimedRotatingFileHandler,  Prev: BaseRotatingHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.6 RotatingFileHandler
............................

The *note RotatingFileHandler: 19a1. 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: 19a1. クラスの新たなインスタンスを返しま
     す。 指定されたファイルが開かれ、ログ記録のためのストリームとして使
     われます。 'mode' が指定されなかった場合、 ‘'a'’ が使われます。
     'encoding' が ‘None’ でない場合、その値はファイルを開くときのエンコ
     ーディングとして使われます。 'delay' が真ならば、ファイルを開くのは
     最初の *note emit(): 3281. 呼び出しまで遅らせられます。 デフォルト
     では、ファイルは無制限に大きくなりつづけます。 '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: 268. オブジェク
     トも '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.17.6.7 TimedRotatingFileHandler
.................................

The *note TimedRotatingFileHandler: 1167. 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: 1167. クラスの新たなインスタンスを
     返します。 '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(): 3286. の最初
     の呼び出しまで延期されます。

     'atTime' が ‘None’ でない場合、それは ‘datetime.time’ インスタンス
     でなければなりません。ロールオーバーが「夜中」「特定の曜日」に設定
     されていて、ロールが発生する時刻を指定します。 'atTime' の値は '初
     期' のロールオーバーの計算に使われますが、後続のロールオーバーは通
     常の間隔の計算で算出されます。

     'errors' が指定されると、エンコーディングエラーの取り扱い方法を決定
     します。

          注釈: 最初のロールオーバーの計算はハンドラーが初期化されたとき
          に行われます。後続のロールオーバーは、ロールオーバーが発生し、
          ロールオーバーが出力した時にのみ行われます。これを念頭に置いて
          おかないと混乱する可能性があります。例えば、インターバルが '毎
          分' に設定されていて、1分ごとにログファイルが常に生成されると
          は限りません。アプリケーションが実行されている間、1分に1回以上
          のログ出力されて 'いるとすると' 毎分、分割されたログファイルが
          出力されますが、そうでなく、5分ごとに出力される場合は、出力さ
          れずにロールオーバーが実行されなかった時間分のギャップが生じま
          す。

     バージョン 3.4 で変更: 'atTime' パラメータが追加されました。

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 268. オブジェク
     トも '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.17.6.8 SocketHandler
......................

The *note SocketHandler: 1168. 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: 1168. クラスのインスタンスを生成し
     て返します。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は TCP ソケ
     ットが作られます。

      -- メソッド: close ()

          ソケットを閉じます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          11ec. にするには、 *note makeLogRecord(): 3224. 関数を使ってく
          ださい。

      -- メソッド: handleError ()

          *note emit(): 328c. の処理中に発生したエラーを処理します。よく
          ある原因は接続の消失です。次のイベント発生時に再試行できるよう
          にソケットを閉じます。

      -- メソッド: makeSocket ()

          サブクラスで必要なソケット形式を詳細に定義できるようにするため
          のファクトリメソッドです。デフォルトの実装では、 TCP ソケット
          (*note socket.SOCK_STREAM: 150f.) を生成します。

      -- メソッド: 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(): 328f. の
          ドキュメントで解説されています。

          この関数はネットワークがビジーの時に発生する部分的送信に対応し
          ています。

      -- メソッド: 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.17.6.9 DatagramHandler
........................

The *note DatagramHandler: 1169. class, located in the
‘logging.handlers’ module, inherits from *note SocketHandler: 1168. to
support sending logging messages over UDP sockets.

 -- クラス: logging.handlers.DatagramHandler (host, port)

     アドレスが 'host' および 'port' で与えられた遠隔のマシンと通信する
     ようにした *note DatagramHandler: 1169. クラスのインスタンスを生成
     して返します。

          注釈: UDP はストリーミングプロトコルではないため、このハンドラ
          のインスタンスと 'host' に指定したホストとの間に持続的なコネク
          ションはありません。この理由から、ネットワークソケットを使う場
          合、イベントがログされるごとに DNS のルックアップを行わなけれ
          ばならないかもしれず、それによりシステムにある程度の待ち時間を
          もたらす可能性があります。この待ち時間が問題になる場合、自身で
          ルックアップを行い、ホスト名の代わりにルックアップの結果得られ
          た IP アドレスを使ってハンドラを初期化することができます。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は UDP ソケ
     ットが作られます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          11ec. にするには、 *note makeLogRecord(): 3224. 関数を使ってく
          ださい。

      -- メソッド: makeSocket ()

          ここで *note SocketHandler: 1168. のファクトリメソッドをオーバ
          ライドして、 UDP ソケット (*note socket.SOCK_DGRAM: 150e.) を
          生成しています。

      -- メソッド: send (s)

          pickle したバイト文字列をソケットに送信します。 送信するバイト
          文字列のフォーマットは、 *note SocketHandler.makePickle():
          328f. のドキュメントで解説されています。


File: python.info,  Node: SysLogHandler,  Next: NTEventLogHandler,  Prev: DatagramHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.10 SysLogHandler
.......................

The *note SysLogHandler: 86d. 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 ‘SysLogHandler’ 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: 150e. 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: 150f.  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: 86d. が正常に動作していないように見える場合がありま
     す。その場合、ドメインソケットに使うべきアドレスを調べてください。
     そのアドレスはシステムによって異なります。例えば、Linux システムで
     は通常 '/dev/log' ですが、 OS X では '/var/run/syslog' です。プラッ
     トフォームを確認し、適切なアドレスを使う必要があります (アプリケー
     ションを複数のプラットフォーム上で動作させる必要がある場合、実行時
     に確認する必要があるかもしれません)。Windows では、多くの場合、UDP
     オプションを使用する必要があります。

          注釈: macOS 12.x (Monterey) でApple社はsyslogデーモンの振る舞
          いを変更し、デーモンはドメインソケットを待ち受けなくなりました
          。したがってこのシステム上では *note SysLogHandler: 86d. が動
          作することは期待できません。

          より詳細な情報は 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: 86d. で定義さ
          れています。これは ‘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.17.6.11 NTEventLogHandler
...........................

The *note NTEventLogHandler: 329e. 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: 329e. クラスの新たなインスタンスを返します
     。 '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.17.6.12 SMTPHandler
.....................

The *note SMTPHandler: 1914. 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: 1914. クラスのインスタンスを返します。イ
     ンスタンスは email の from および to アドレス行、および subject 行
     とともに初期化されます。 'toaddrs' は文字列からなるリストでなければ
     なりません。非標準の SMTP ポートを指定するには、 'mailhost' 引数に
     (host, port) のタプル形式を指定します。文字列を使った場合、標準の
     SMTP ポートが使われます。もし SMTP サーバが認証を必要とするならば、
     (username, password) のタプル形式を 'credentials' 引数に指定するこ
     とができます。

     セキュアプロトコル (TLS) の使用を指定するには 'secure' 引数にタプル
     を渡してください。これは認証情報が渡された場合のみ使用されます。タ
     プルは、空のタプルか、キーファイルの名前を持つ1要素のタプルか、また
     はキーファイルと証明書ファイルの名前を持つ2要素のタプルのいずれかで
     なければなりません。 (このタプルは *note smtplib.SMTP.starttls():
     1354. メソッドに渡されます。)

     SMTP サーバとのコミュニケーションのために、 'timeout' 引数を使用し
     てタイムアウトを指定することができます。

     バージョン 3.3 で変更: 'timeout' 引数が追加されました。

      -- メソッド: emit (record)

          レコードを書式化し、指定されたアドレスに送信します。

      -- メソッド: getSubject (record)

          レコードに応じたサブジェクト行を指定したいなら、このメソッドを
          オーバライドしてください。


File: python.info,  Node: MemoryHandler,  Next: HTTPHandler,  Prev: SMTPHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.13 MemoryHandler
.......................

The *note MemoryHandler: 3257. 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: 3257. はより一般的な抽象クラス、 *note
BufferingHandler: 32aa. のサブクラスです。この抽象クラスでは、ログ記録す
るレコードをメモリ上にバッファリングします。各レコードがバッファに追加さ
れる毎に、 ‘shouldFlush()’ を呼び出してバッファをフラッシュすべきかどう
か調べます。フラッシュする必要がある場合、 ‘flush()’ がフラッシュ処理を
行うものと想定されます。

 -- クラス: logging.handlers.BufferingHandler (capacity)

     容量つきのバッファーを設定してハンドラーが初期化されます。
     'capacity' はバッファ可能なログレコード数を意味します。

      -- メソッド: emit (record)

          レコードをバッファに追加します。 *note shouldFlush(): 32ac. が
          true を返す場合、バッファを処理するために *note flush(): 32ad.
          を呼び出します。

      -- メソッド: flush ()

          For a ‘BufferingHandler’ 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: 3257. クラスの新たなインスタンスを返します。 イ
     ンスタンスはサイズ 'capacity' （バッファされるレコード数）のバッフ
     ァとともに初期化されます。 'flushLevel' が指定されていない場合、
     ‘ERROR’ が使われます。 'target' が指定されていない場合、ハンドラが
     何らかの意味のある処理を行う前に *note setTarget(): 32ae. でターゲ
     ットを指定する必要があります。 'flushOnClose' が ‘False’ に指定され
     ていた場合、ハンドラが閉じられるときにバッファはフラッシュ 'されま
     せん' 。 'flushOnClose' が指定されていないか ‘True’ に指定されてい
     た場合、ハンドラが閉じられるときのバッファのフラッシュは以前の挙動
     になります。

     バージョン 3.6 で変更: 'flushOnClose' パラメータが追加されました。

      -- メソッド: close ()

          *note flush(): 32b0. を呼び出し、ターゲットを ‘None’ に設定し
          てバッファを消去します。

      -- メソッド: flush ()

          For a ‘MemoryHandler’ 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.17.6.14 HTTPHandler
.....................

The *note HTTPHandler: 1030. 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: 1030. クラスの新たなインスタンスを返します。特別
     なポートを使う必要がある場合、'host' は ‘host:port’ の形式で使うこ
     とができます。 'method' が指定されない場合、 ‘GET’ が使われます。
     'secure' が真の場合、HTTPS 接続が使われます。 HTTPS 接続で使用する
     SSL 設定のために 'context' 引数を *note ssl.SSLContext: 355. のイン
     スタンスに設定することができます。 'credentials' を指定する場合、
     BASIC 認証の際の HTTP 'Authorization' ヘッダに使われるユーザIDとパ
     スワードからなる 2要素タプルを渡してください。 credentials を指定す
     る場合、ユーザIDとパスワードが通信中に平文として剥き出しにならない
     よう、secure=True も指定すべきです。

     バージョン 3.5 で変更: 'context' パラメータが追加されました。

      -- メソッド: mapLogRecord (record)

          URL エンコードされて Web サーバに送信することになる、 ‘record’
          に基づく辞書を供給します。デフォルトの実装では単に
          ‘record.__dict__’ を返します。例えば *note LogRecord: 11ec. の
          サブセットのみを Web サーバに送信する場合や、 サーバーに送信す
          る内容を特別にカスタマイズする必要がある場合には、このメソッド
          をオーバライドできます。

      -- メソッド: emit (record)

          レコードを URL エンコードされた辞書形式で Web サーバに送信しま
          す。レコードを送信のために辞書に変換するために *note
          mapLogRecord(): 32b4. が呼び出されます。

          注釈: Web server に送信するためのレコードを準備することは一般
          的な書式化操作とは同じではありませんので、 *note
          setFormatter(): 3208. を使って *note Formatter: 16b5. を指定す
          ることは、 *note HTTPHandler: 1030. には効果はありません。
          *note format(): 3211. を呼び出す代わりに、このハンドラは *note
          mapLogRecord(): 32b4. を呼び出し、その後その返却辞書を Web
          server に送信するのに適した様式にエンコードするために *note
          urllib.parse.urlencode(): 1099. を呼び出します。


File: python.info,  Node: QueueHandler,  Next: QueueListener,  Prev: HTTPHandler,  Up: logging handlers --- ログ記録ハンドラー

5.17.6.15 QueueHandler
......................

Added in version 3.2.

The *note QueueHandler: 1bc0. 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: 244. クラスとともに *note QueueHandler: 1bc0. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 1914.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueHandler (queue)

     *note QueueHandler: 1bc0. クラスの新しいインスタンスを返します。イ
     ンスタンスは、キューにメッセージを送るように初期化されます。キュー
     は任意のキューのようなオブジェクトが可能です; それはそのまま *note
     enqueue(): 32b8. メソッドによって使用されます。そのメソッドはメッセ
     ージを送る方法を知っている必要があります。もしタスクのトラッキング
     APIにキューが必要でない場合はキューとして *note SimpleQueue: d65. の
     インスタンスが使用できます。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: d65. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1be7. を使ってください。

          警告: The *note multiprocessing: 98. module uses an internal
          logger created and accessed via *note get_logger(): 32b9.
          *note multiprocessing.Queue: 1be7. will log ‘DEBUG’ level
          messages upon items being queued.  If those log messages are
          processed by a ‘QueueHandler’ using the same
          ‘multiprocessing.Queue’ 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(): 320f. method is called to handle the
          error.  This can result in the record silently being dropped
          (if *note logging.raiseExceptions: 1416. is ‘False’) or a
          message printed to ‘sys.stderr’ (if ‘logging.raiseExceptions’
          is ‘True’).

      -- メソッド: prepare (record)

          キューに追加するためレコードを準備します。このメソッドが返した
          オブジェクトがキューに追加されます。

          基底の実装はレコードがメッセージや引数と、またもし存在すれば、
          発生した例外およびスタック情報と統合されるようにフォーマットし
          ます。またこの実装では非 pickle 化不可能な要素をレコードから削
          除します。特に、この実装はレコードの ‘msg’ と ‘message’ 属性を
          (ハンドラの *note format(): 19a. メソッドを呼び出すことによっ
          て得られる) 統合されたメッセージで上書きし、同時に ‘args’,
          ‘exc_info’, ‘exc_text’ の3つの属性値をすべて ‘None’ に設定しま
          す。

          レコードを dict や JSON 文字列に変換したい場合や、オリジナルの
          レコードを変更せずに修正済のコピーを送りたい場合は、このメソッ
          ドをオーバーライドすると良いでしょう。

               注釈: 基底の実装は、レコードを pickle 化可能にしつつ、さ
               らなるフォーマット処理を防ぐために、メッセージを引数でフ
               ォーマットしてフォーマットされたメッセージを ‘message’ と
               ‘msg’ 属性に設定し、同時に ‘args’ と ‘exc_text’ 属性を
               ‘None’ に設定します。このことは、 *note QueueListener:
               244. 側のハンドラが必要なフォーマット処理を行う、たとえば
               例外のフォーマット処理を行う、ための必要な情報が得られな
               いかもしれないことを意味します。そのため、 ‘QueueHandler’
               の派生クラスにおいてこのメソッドを、たとえば ‘exc_text’ 属
               性が ‘None’ に設定されないように、オーバーライドしたいと
               考えるかもしれません。この場合、 ‘message’ / ‘msg’ /
               ‘args’ といった属性の変更はレコードが pickle 化可能である
               ことを保証することと関係しており、元の ‘args’ の値が
               pickle 化可能かどうかによって、これらの属性の変更が避けら
               れないかもしれないということに注意してください (この点に
               ついては、自分のコードだけでなく依存するライブラリのコー
               ドも考慮しなければならないことにも注意してください)

      -- メソッド: enqueue (record)

          キューにレコードを ‘put_nowait()’ を使ってエンキューします; ブ
          ロッキングやタイムアウト、あるいはなにか特別なキューの実装を使
          いたければ、これをオーバライドしてみてください。

      -- の属性: listener

          When created via configuration using *note dictConfig(): 13cc,
          this attribute will contain a *note QueueListener: 244.
          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.17.6.16 QueueListener
.......................

Added in version 3.2.

The *note QueueListener: 244. 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 ‘QueueListener’ is not itself a handler, it is documented here
because it works hand-in-hand with *note QueueHandler: 1bc0.

*note QueueHandler: 1bc0. クラスとともに *note QueueListener: 244. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 1914.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueListener (queue, *handlers,
          respect_handler_level=False)

     *note QueueListener: 244. クラスの新しいインスタンスを返します。イ
     ンスタンスは、メッセージを送るためのキューと、キューに格納されたエ
     ントリーを処理するハンドラーのリストが設定されて初期化されます。キ
     ューは任意のキューのようなオブジェクトが可能です; それはそのまま
     *note dequeue(): 32be. メソッドによって使用されます。そのメソッドは
     メッセージを送る方法を知っている必要があります。もしタスクのトラッ
     キングAPIにキューが必要でない場合はキューとして *note SimpleQueue:
     d65. のインスタンスが使用できます（トラッキングAPIが使用可能な場合
     は使用されます）。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: d65. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1be7. を使ってください。

     もし ‘respect_handler_level’ が ‘True’ なら、メッセージをハンドラー
     に渡すか決める時に（メッセージのレベルに比べて）ハンドラーのレベル
     が尊重されます。そうでない場合は依然のPythonバージョンと同様にすべ
     てのメッセージは常にハンドラーに渡されます。

     バージョン 3.5 で変更: The ‘respect_handler_level’ argument was
     added.

     バージョン 3.14 で変更: ‘QueueListener’ can now be used as a
     context manager via *note with: 187.  When entering the context,
     the listener is started.  When exiting the context, the listener is
     stopped.  *note __enter__(): 2701. returns the ‘QueueListener’
     object.

      -- メソッド: dequeue (block)

          キューからレコードを取り除き、それを返します。ブロッキングする
          ことがあります。

          ベース実装は ‘get()’ を使用します。タイムアウトを有効にしたい
          場合や、カスタムのキュー実装を使いたい場合は、このメソッドをオ
          ーバーライドすると良いでしょう。

      -- メソッド: prepare (record)

          レコードを扱うための準備をします。

          この実装は渡されたレコードをそのまま返します。その値をハンドラ
          に渡す前に何らかのカスタムな整列化 (marshalling) あるいはレコ
          ードに対する操作を行う必要があれば、このメソッドをオーバーライ
          ドすると良いでしょう。

      -- メソッド: handle (record)

          レコードを処理します。

          これは、ハンドラをループしてそれらに処理すべきレコードを渡しま
          す。ハンドラに渡される実際のオブジェクトは、 *note prepare():
          32bf. から返されたものです。

      -- メソッド: start ()

          リスナーを開始します。

          これは、 LogRecord を処理するキューを監視するために、バックグ
          ラウンドスレッドを開始します。

          バージョン 3.14 で変更: Raises *note RuntimeError: 246. 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.17.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.17.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: 13e1. の方が信頼できます:

               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(): 32c9. で実装されています。

     'terse' が真なら、プラットフォームを特定するために最低限必要な情報
     だけを返します。

     バージョン 3.8 で変更: macOSでは、 *note mac_ver(): 1e71. が空でな
     いリリース文字列を返すとき、darwin のバージョンではなく macOS のバ
     ージョンを取得するために、この関数は ‘mac_ver()’ を使うようになりま
     した。

 -- の関数: platform.processor ()

     ‘'amdk6'’ のような、（現実の）プロセッサ名を返します。

     不明な場合は空文字列を返します。NetBSDのようにこの情報を提供しない
     、または *note machine(): 32c7. と同じ値しか返さないプラットフォー
     ムも多く存在しますので、注意してください。

 -- の関数: 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(): 1332.

 -- の関数: 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(): 1332.

 -- の関数: platform.uname ()

     極めて可搬性の高い uname インターフェースです。 *note system: 22c3,
     *note node: 32c8, *note release: 32d2, *note version: 32d3, *note
     machine: 32c7, *note processor: 32ca. の6つの属性を持った *note
     namedtuple(): 4e0. を返します。

     *note processor: 32ca. is resolved late, on demand.

     Note: the first two attribute names differ from the names presented
     by *note os.uname(): 1332, where they are named ‘sysname’ and
     ‘nodename’.

     不明な項目は ‘''’ となります。

     バージョン 3.3 で変更: 結果が タプル から *note namedtuple(): 4e0.
     へ変更されました。

     バージョン 3.9 で変更: *note processor: 32ca. is resolved late
     instead of immediately.

 -- の関数: platform.invalidate_caches ()

     Clear out the internal cache of information, such as the *note
     uname(): 1e6f.  This is typically useful when the platform's *note
     node(): 32c8. 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.17.7.2 Java platform
......................

 -- の関数: platform.java_ver (release='', vendor='', vminfo=('', '',
          ''), osinfo=('', '', ''))

     Version interface for Jython.

     Returns a tuple ‘(release, vendor, vminfo, osinfo)’ with 'vminfo'
     being a tuple ‘(vm_name, vm_release, vm_vendor)’ and 'osinfo' being
     a tuple ‘(os_name, os_version, os_arch)’.  Values which cannot be
     determined are set to the defaults given as parameters (which all
     default to ‘''’).

     バージョン 3.13 で非推奨、バージョン 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.17.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(): 32d6. によって返された Windows のエディショ
     ンが IoT エディションの時 ‘True’ を返します。

     Added in version 3.8.


File: python.info,  Node: macOS platform,  Next: iOS platform,  Prev: Windows platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.17.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.17.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.17.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.17.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: 2c2. 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.17.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():
          d87.

        * ‘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.17.7.9 コマンドラインでの使用
...............................

‘platform’ can also be invoked directly using the *note -m: 23e. 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(): 1b27. 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(): 1b27. 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.17.8 ‘errno’ -- 標準の errno システムシンボル
-----------------------------------------------

__________________________________________________________________

このモジュールから標準の ‘errno’ システムシンボルを取得することができま
す。個々のシンボルの値は ‘errno’ に対応する整数値です。これらのシンボル
の名前は、 ‘linux/include/errno.h’ から借用されており、網羅的なはずです
。

 -- データ: errno.errorcode

     errno 値を背後のシステムにおける文字列表現に対応付ける辞書です。例
     えば、‘errno.errorcode[errno.EPERM]’ は ‘'EPERM'’ に対応付けられま
     す。

数値のエラーコードをエラーメッセージに変換するには、 *note
os.strerror(): 309f. を使ってください。

以下のリストの内、現在のプラットフォームで使われていないシンボルはモジュ
ール上で定義されていません。定義されているシンボルだけを挙げたリストは
‘errno.errorcode.keys()’ として取得することができます。取得できるシンボ
ルには以下のようなものがあります:

 -- データ: errno.EPERM

     Operation not permitted.  This error is mapped to the exception
     *note PermissionError: f42.

 -- データ: errno.ENOENT

     No such file or directory.  This error is mapped to the exception
     *note FileNotFoundError: 266.

 -- データ: errno.ESRCH

     No such process.  This error is mapped to the exception *note
     ProcessLookupError: 126a.

 -- データ: errno.EINTR

     Interrupted system call.  This error is mapped to the exception
     *note InterruptedError: f8c.

 -- データ: 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: 1267.

 -- データ: errno.EAGAIN

     Try again.  This error is mapped to the exception *note
     BlockingIOError: 237.

 -- データ: errno.ENOMEM

     空きメモリがありません (Out of memory)

 -- データ: errno.EACCES

     Permission denied.  This error is mapped to the exception *note
     PermissionError: f42.

 -- データ: 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: 1225.

 -- データ: errno.EXDEV

     デバイスをまたいだリンクです (Cross-device link)

 -- データ: errno.ENODEV

     そのようなデバイスはありません (No such device)

 -- データ: errno.ENOTDIR

     Not a directory.  This error is mapped to the exception *note
     NotADirectoryError: 1269.

 -- データ: errno.EISDIR

     Is a directory.  This error is mapped to the exception *note
     IsADirectoryError: 1268.

 -- データ: 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: 126b.

 -- データ: 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: 237.

 -- データ: 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: 126c.

 -- データ: errno.ECONNRESET

     Connection reset by peer.  This error is mapped to the exception
     *note ConnectionResetError: 126e.

 -- データ: 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: 126b.

 -- データ: errno.ETOOMANYREFS

     参照が多すぎます: 接続できません (Too many references: cannot
     splice)

 -- データ: errno.ETIMEDOUT

     Connection timed out.  This error is mapped to the exception *note
     TimeoutError: a3a.

 -- データ: errno.ECONNREFUSED

     Connection refused.  This error is mapped to the exception *note
     ConnectionRefusedError: 126d.

 -- データ: 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: 237.

 -- データ: errno.EINPROGRESS

     Operation now in progress.  This error is mapped to the exception
     *note BlockingIOError: 237.

 -- データ: 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: f42.

     *note Availability: 2199.: 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.17.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: 21b4.  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
オプションのモジュールの要件: 21b2.

     警告: ‘ctypes’ provides low-level access to native libraries and
     the process's memory, bypassing Python's safety mechanisms and
     allowing execution of arbitrary native code.  Incorrect use can
     corrupt data and objects, reveal sensitive information, cause
     crashes, or otherwise compromise the running process.

* 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.17.9.1 ctypes チュートリアル
..............................

注意: いくつかのコードサンプルで ctypes の *note c_int: 3369. 型を参照し
ています。 ‘sizeof(long) == sizeof(int)’ であるようなプラットフォームで
は、この型は *note c_long: 336a. のエイリアスです。そのため、 ‘c_int’ 型
を想定しているときに ‘c_long’ が表示されたとしても、混乱しないようにして
ください -- 実際には同じ型なのです。

* 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.17.9.2 動的リンクライブラリをロードする
.........................................

‘ctypes’ exports the *note cdll: 336d, and on Windows *note windll:
336e. and *note oledll: 336f. 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.  *note oledll: 336f. 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: 2c2. exception when the function call fails.

バージョン 3.3 で変更: Windows エラーは以前は *note WindowsError: 1264.
を送出していましたが、これは現在では *note OSError: 2c2. の別名になって
います。

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’ モジュールをインポートして使用してくださ
     い。

Other systems require the filename 'including' the extension to load a
library, so attribute access can not be used to load libraries.  Either
the *note LoadLibrary(): 3370. method of the dll loaders should be used,
or you should load the library by creating an instance of *note CDLL:
be0. by calling the constructor.

For example, on Linux:

     >>> cdll.LoadLibrary("libc.so.6")
     <CDLL 'libc.so.6', handle ... at ...>
     >>> libc = CDLL("libc.so.6")
     >>> libc
     <CDLL 'libc.so.6', handle ... at ...>
     >>>

On macOS:

     >>> cdll.LoadLibrary("libc.dylib")
     <CDLL 'libc.dylib', handle ... at ...>
     >>> libc = CDLL("libc.dylib")
     >>> libc
     <CDLL 'libc.dylib', handle ... at ...>


File: python.info,  Node: ロードしたdllから関数にアクセスする,  Next: 関数を呼び出す,  Prev: 動的リンクライブラリをロードする,  Up: ctypes チュートリアル

5.17.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(): dce. を使わなければなりません。:

     >>> 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.17.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: 2ee. が送出されます。逆の場合も同様です:

     >>> 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
     >>>

The *note faulthandler: 5c. module can help debug crashes, such as
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.17.9.5 基本データ型
.....................

‘ctypes’ defines a number of primitive C compatible data types:

ctypes の型                   C の型                        Python の型                   *note _type_: 3376.
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note c_bool: 3377.           _Bool                         *note bool: 3c1.              ‘'?'’
                                                                                          
                                                                                          
*note c_char: 3378.           char                          1-character                   ‘'c'’
                                                            *note bytes: 193.             
                                                            
                                                                                          
*note c_wchar: 3379.          ‘wchar_t’                     1-character *note str: 16a.   ‘'u'’
                                                                                          
                                                                                          
*note c_byte: 1b3f.           char                          *note int: 19c.               ‘'b'’
                                                                                          
                                                                                          
*note c_ubyte: 1b40.          unsigned char                 *note int: 19c.               ‘'B'’
                                                                                          
                                                                                          
*note c_short: 337a.          short                         *note int: 19c.               ‘'h'’
                                                                                          
                                                                                          
*note c_ushort: 337b.         unsigned short                *note int: 19c.               ‘'H'’
                                                                                          
                                                                                          
*note c_int: 3369.            int                           *note int: 19c.               ‘'i'’ *
                                                                                          
                                                                                          
*note c_int8: 337c.           ‘int8_t’                      *note int: 19c.               *
                                                                                          
                                                                                          
*note c_int16: 337d.          ‘int16_t’                     *note int: 19c.               *
                                                                                          
                                                                                          
*note c_int32: 337e.          ‘int32_t’                     *note int: 19c.               *
                                                                                          
                                                                                          
*note c_int64: 337f.          ‘int64_t’                     *note int: 19c.               *
                                                                                          
                                                                                          
*note c_uint: 3380.           unsigned int                  *note int: 19c.               ‘'I'’ *
                                                                                          
                                                                                          
*note c_uint8: 3381.          ‘uint8_t’                     *note int: 19c.               *
                                                                                          
                                                                                          
*note c_uint16: 3382.         ‘uint16_t’                    *note int: 19c.               *
                                                                                          
                                                                                          
*note c_uint32: 3383.         ‘uint32_t’                    *note int: 19c.               *
                                                                                          
                                                                                          
*note c_uint64: 3384.         ‘uint64_t’                    *note int: 19c.               *
                                                                                          
                                                                                          
*note c_long: 336a.           long                          *note int: 19c.               ‘'l'’
                                                                                          
                                                                                          
*note c_ulong: 3385.          unsigned long                 *note int: 19c.               ‘'L'’
                                                                                          
                                                                                          
*note c_longlong: 3386.       long long                     *note int: 19c.               ‘'q'’ *
                                                                                          
                                                                                          
*note c_ulonglong: 3387.      unsigned long long            *note int: 19c.               ‘'Q'’ *
                                                                                          
                                                                                          
*note c_size_t: 3388.         ‘size_t’                      *note int: 19c.               *
                                                                                          
                                                                                          
*note c_ssize_t: 1458.        *note Py_ssize_t: c59.        *note int: 19c.               *
                                                                                          
                                                                                          
*note c_time_t: 1bc2.         ‘time_t’                      *note int: 19c.               *
                                                                                          
                                                                                          
*note c_float: 3389.          float                         *note float: 197.             ‘'f'’
                                                                                          
                                                                                          
*note c_double: 1d13.         double                        *note float: 197.             ‘'d'’
                                                                                          
                                                                                          
*note c_longdouble: 1d14.     long double                   *note float: 197.             ‘'g'’ *
                                                                                          
                                                                                          
*note c_char_p: 1ab8.         char* (NUL 終端)              *note bytes: 193. or ‘None’   ‘'z'’
                                                                                          
                                                                                          
*note c_wchar_p: 1ab9.        wchar_t* (NUL 終端)           *note str: 16a. or ‘None’     ‘'Z'’
                                                                                          
                                                                                          
*note c_void_p: 1aba.         void*                         *note int: 19c. or ‘None’     ‘'P'’
                                                                                          
                                                                                          
*note py_object: 1f5.         *note PyObject: 5df.*         *note object: c82.            ‘'O'’
                                                                                          
                                                                                          
*note VARIANT_BOOL: 338a.     short int                     *note bool: 3c1.              ‘'v'’
                                                                                          

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 _type_: 3376.
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note c_float_complex: 1ef.   float complex                 *note complex: 198.           ‘'F'’
                                                                                          
                                                                                          
*note c_double_complex: 1f0.  double complex                *note complex: 198.           ‘'D'’
                                                                                          
                                                                                          
*note c_longdouble_complex: 1f1.long double complex         *note complex: 198.           ‘'G'’
                                                                                          

これら全ての型はその型を呼び出すことによって作成でき、オプションとして型
と値が合っている初期化子を指定することができます:

     >>> c_int()
     c_long(0)
     >>> c_wchar_p("Hello, World")
     c_wchar_p(140018365411392)
     >>> c_ushort(-3)
     c_ushort(65533)
     >>>

The constructors for numeric types will convert input using *note
__bool__(): 14f1, *note __index__(): 19f. (for ‘int’), *note
__float__(): bc5. or *note __complex__(): 7fd.  This means *note c_bool:
3377. accepts any object with a truth value:

     >>> empty_list = []
     >>> c_bool(empty_list)
     c_bool(False)

これらの型は変更可能であり、値を後で変更することもできます:

     >>> 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:
1ab8, *note c_wchar_p: 1ab9, and *note c_void_p: 1aba. 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(): 338b. 関数があり、いろいろ
な方法で作成することできます。現在のメモリブロックの内容は ‘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(): 338b. 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(): 1e10. function.


File: python.info,  Node: 続・関数を呼び出す,  Next: Calling variadic functions,  Prev: 基本データ型,  Up: ctypes チュートリアル

5.17.9.6 続・関数を呼び出す
...........................

printf は *note sys.stdout: cd1. では 'なく' 、本物の標準出力チャンネル
へプリントすることに注意してください。したがって、これらの例はコンソール
プロンプトでのみ動作し、 '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.17.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: 182c.
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: 182c. for all variadic
functions.


File: python.info,  Node: 自作のデータ型とともに関数を呼び出す,  Next: 要求される引数の型を指定する 関数プロトタイプ,  Prev: Calling variadic functions,  Up: ctypes チュートリアル

5.17.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.17.9.9 要求される引数の型を指定する (関数プロトタイプ)
........................................................

It is possible to specify the required argument types of functions
exported from DLLs by setting the *note argtypes: 182c. attribute.

*note argtypes: 182c. 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(): 3394. class method for them
to be able to use them in the *note argtypes: 182c. sequence.  The
‘from_param()’ 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.17.9.10 戻り値の型
....................

By default functions are assumed to return the C int type.  Other return
types can be specified by setting the *note restype: 3397. 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: 182c.:

     >>> 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"): 2397. calls above, you can set
the *note argtypes: 182c. 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: 3397. 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(): 3398. を呼び
出します。

Please note that a much more powerful error checking mechanism is
available through the *note errcheck: 3399. attribute; see the reference
manual for details.


File: python.info,  Node: ポインタを渡す または、パラメータの参照渡し,  Next: 構造体と共用体,  Prev: 戻り値の型,  Up: ctypes チュートリアル

5.17.9.11 ポインタを渡す(または、パラメータの参照渡し)
......................................................

時には、 C api 関数がパラメータのデータ型として 'ポインタ' を想定してい
ることがあります。おそらくパラメータと同一の場所に書き込むためか、もしく
はそのデータが大きすぎて値渡しできない場合です。これは 'パラメータの参照
渡し' としても知られています。

‘ctypes’ exports the *note byref(): 339c. function which is used to pass
parameters by reference.  The same effect can be achieved with the *note
pointer(): 1ab7. function, although ‘pointer()’ does a lot more work
since it constructs a real pointer object, so it is faster to use
‘byref()’ 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.17.9.12 構造体と共用体
........................

Structures and unions must derive from the *note Structure: 1e7. and
*note Union: 1e8. base classes which are defined in the ‘ctypes’ module.
Each subclass must define a *note _fields_: 1996. 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: 3369, 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: 18e5.s can be retrieved from the 'class', they
are useful for debugging because they can provide useful information.
See *note CField: 1ea.:

     >>> 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.17.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_: 1e9. 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_:
319. 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: 33a1, *note LittleEndianStructure: 33a2, *note
BigEndianUnion: 1c14, and *note LittleEndianUnion: 1c15. 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.17.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_: 1996. 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_: 1e9. attribute for details on the default behavior and how to
change it.


File: python.info,  Node: 配列<2>,  Next: ポインタ,  Prev: 構造体と共用体におけるビットフィールド,  Up: ctypes チュートリアル

5.17.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.17.9.16 ポインタ
..................

Pointer instances are created by calling the *note pointer(): 1ab7.
function on a ‘ctypes’ type:

     >>> from ctypes import *
     >>> i = c_int(42)
     >>> pi = pointer(i)
     >>>

次のように、ポインタインスタンスは、ポインタが指すオブジェクト (上の例で
は ‘i’) を返す *note contents: 33a8. 属性を持ちます:

     >>> 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: 3369. インスタンスがポインタの 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(): 1ab7. function does more than
simply create pointer instances, it has to create pointer 'types' first.
This is done with the *note POINTER(): 1f3. 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.17.9.17 Thread safety without the GIL
.......................................

From Python 3.13 onward, the *note GIL: 165. can be disabled on the
*note free-threaded build: 17b0.  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: 1a54. 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.17.9.18 型変換
................

Usually, ctypes does strict type checking.  This means, if you have
‘POINTER(c_int)’ in the *note argtypes: 182c. 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: 182c, an
object of the pointed type (‘c_int’ in this case) can be passed to the
function.  ctypes will apply the required *note byref(): 339c.
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(): 33ad.
function which can be used in the same way.  The ‘Bar’ structure defined
above accepts ‘POINTER(c_int)’ pointers or *note c_int: 3369. 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(): 33ad. 関数が便利です。

*note cast(): 33ad. 関数は ctypes インスタンスを異なる ctypes データ型を
指すポインタへキャストするために使えます。 ‘cast()’ は二つのパラメータ、
ある種のポインタかそのポインタへ変換できる ctypes オブジェクトと、
ctypes ポインタ型を取ります。そして、第二引数のインスタンスを返します。
このインスタンスは第一引数と同じメモリブロックを参照しています:

     >>> a = (c_byte * 4)()
     >>> cast(a, POINTER(c_int))
     <ctypes.LP_c_long object at ...>
     >>>

したがって、 *note cast(): 33ad. を ‘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.17.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_: 1996. 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.17.9.20 コールバック関数
..........................

‘ctypes’ allows creating C callable function pointers from Python
callables.  These are sometimes called 'callback functions'.

最初に、コールバック関数のためのクラスを作る必要があります。そのクラスに
は呼び出し規約、戻り値の型およびこの関数が受け取る引数の数と型についての
情報があります。

*note CFUNCTYPE(): 33b1. ファクトリ関数は通常の ‘cdecl’ 呼び出し規約を用
いてコールバック関数のための型を作成します。 Windows では、 *note
WINFUNCTYPE(): 33b2. ファクトリ関数が ‘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(): 33b1.
     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: 18c4. で格納された値は異なるコールバックをまたいで
     生存は 'しません' 。


File: python.info,  Node: dllからエクスポートされた値へアクセスする,  Next: びっくり仰天,  Prev: コールバック関数,  Up: ctypes チュートリアル

5.17.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: 37f, Python runtime version number encoded in a single
constant integer.

‘ctypes’ can access values like this with the *note in_dll(): 33b5.
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: 33b6. ポインタにアクセスします。

この値のドキュメントから引用すると:

     このポインタは *note _frozen: 97d. のレコードからなり、終端の要素の
     メンバが ‘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: 97d. データ型を定義済みなので、このテーブルを指
すポインタを得ることができます。:

     >>> 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.17.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: 1ab8. からインスタンス化されたオブジェクトは
     、bytes または整数に設定された値しか持てません。

なぜ ‘False’ と表示されるのでしょうか?  ctypes インスタンスはメモリと、
メモリの内容にアクセスするいくつかの *note descriptor: 18e5. (記述子)を
含むオブジェクトです。メモリブロックに Python オブジェクトを保存してもオ
ブジェクト自身が保存される訳ではなく、オブジェクトの ‘contents’ が保存さ
れます。その contents に再アクセスすると新しい Python オブジェクトがその
度に作られます。


File: python.info,  Node: 可変サイズのデータ型,  Prev: びっくり仰天,  Up: ctypes チュートリアル

5.17.9.23 可変サイズのデータ型
..............................

‘ctypes’ provides some support for variable-sized arrays and structures.

*note resize(): 33bb. 関数は既存の ctypes オブジェクトのメモリバッファの
サイズを変更したい場合に使えます。この関数は第一引数にオブジェクト、第二
引数に要求されたサイズをバイト単位で指定します。メモリブロックはオブジェ
クト型で指定される通常のメモリブロックより小さくすることはできません。こ
れをやろうとすると、 *note ValueError: 2ee. が送出されます。:

     >>> 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.17.9.24 ctypesリファレンス
............................

* Menu:

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


File: python.info,  Node: 共有ライブラリを見つける,  Next: Listing loaded shared libraries,  Up: ctypesリファレンス

5.17.9.25 共有ライブラリを見つける
..................................

When programming in a compiled language, shared libraries are accessed
when compiling/linking a program, and when the program is run.

The purpose of the *note find_library(): f49. 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)

     Try to find a library and return a pathname.  'name' is the library
     name without any prefix like 'lib', suffix like ‘.so’, ‘.dylib’ or
     version number (this is the form used for the posix linker option
     ‘-l’).  If no library can be found, returns ‘None’.

The exact functionality is system dependent.

On Linux, *note find_library(): f49. 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(): f49. 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(): f49. 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(): f49. to
locate the library at runtime.


File: python.info,  Node: Listing loaded shared libraries,  Next: 共有ライブラリをロードする,  Prev: 共有ライブラリを見つける,  Up: ctypesリファレンス

5.17.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(): 1f2. 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.17.9.27 共有ライブラリをロードする
....................................

There are several ways to load shared libraries into the Python process.
One way is to instantiate *note CDLL: be0. or one of its subclasses:

 -- クラス: ctypes.CDLL (name, mode=DEFAULT_MODE, handle=None,
          use_errno=False, use_last_error=False, winmode=None)

     Represents a loaded shared library.

     Functions in this library use the standard C calling convention,
     and are assumed to return int.  The Python *note global interpreter
     lock: 474. is released before calling any function exported by
     these libraries, and reacquired afterwards.  For different function
     behavior, use a subclass: *note OleDLL: 1b41, *note WinDLL: 1b42,
     or *note PyDLL: 1b43.

     If you have an existing *note handle: 33c4. to an already loaded
     shared library, it can be passed as the 'handle' argument to wrap
     the opened library in a new ‘CDLL’ object.  In this case, 'name' is
     only used to set the *note _name: 33c5. attribute, but it may be
     adjusted and/or validated.

     If 'handle' is ‘None’, the underlying platform's ‘dlopen(3)(1)’ or
     ‘LoadLibrary()’ function is used to load the library into the
     process, and to get a handle to it.

     'name' is the pathname of the shared library to open.  If 'name'
     does not contain a path separator, the library is found in a
     platform-specific way.

     On non-Windows systems, 'name' can be ‘None’.  In this case,
     ‘dlopen()’ is called with ‘NULL’, which opens the main program as a
     "library".  (Some systems do the same is 'name' is empty;
     ‘None’/‘NULL’ is more portable.)

          CPython implementation detail: Since CPython is linked to
          ‘libc’, a ‘None’ 'name' is often used to access the C standard
          library:

               >>> printf = ctypes.CDLL(None).printf
               >>> printf.argtypes = [ctypes.c_char_p]
               >>> printf(b"hello\n")
               hello
               6

          To access the Python C API, prefer *note ctypes.pythonapi:
          33c6. which works across platforms.

     '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 ‘errno’ variable; if you call foreign functions
     created with ‘use_errno=True’ then the ‘errno’ value before the
     function call is swapped with the ctypes private copy, the same
     happens immediately after the function call.

     *note ctypes.get_errno(): 177d. 関数は ctypes のプライベートコピー
     の値を返します。そして、 *note ctypes.set_errno(): 33c7. 関数は
     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(): 3398. and ‘SetLastError()’ Windows API functions;
     *note ctypes.get_last_error(): 33c8. and *note
     ctypes.set_last_error(): 33c9. 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.

     On Windows creating a ‘CDLL’ instance may fail even if the DLL name
     exists.  When a dependent DLL of the loaded DLL is not found, a
     *note OSError: 2c2. 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.

     参考
     ....

     Microsoft DUMPBIN tool(3) - A tool to find DLL dependents.

     バージョン 3.8 で変更: 'winmode' 引数が追加されました。

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 5a1.

     Instances of this class have no public methods.  Functions exported
     by the shared library can be accessed as attributes or by index.
     Please note that accessing the function through an attribute caches
     the result and therefore accessing it repeatedly returns the same
     object each time.  On the other hand, accessing it through an index
     returns a new object each time:

          >>> from ctypes import CDLL
          >>> libc = CDLL("libc.so.6")  # On Linux
          >>> libc.time == libc.time
          True
          >>> libc['time'] == libc['time']
          False

     The following public attributes are available.  Their name starts
     with an underscore to not clash with exported function names:

      -- の属性: _handle

          ライブラリへのアクセスに用いられるシステムハンドル。

      -- の属性: _name

          コンストラクタに渡されたライブラリの名前。

 -- クラス: ctypes.OleDLL

     See *note CDLL: be0, the superclass, for common information.

     Functions in this library use the ‘stdcall’ calling convention, and
     are assumed to return the windows specific *note HRESULT: 33ca.
     code.  ‘HRESULT’ 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:
     2c2. is automatically raised.

     *note Availability: 2199.: Windows

     バージョン 3.3 で変更: *note WindowsError: 1264. used to be raised,
     which is now an alias of *note OSError: 2c2.

 -- クラス: ctypes.WinDLL

     See *note CDLL: be0, the superclass, for common information.

     Functions in these libraries use the ‘stdcall’ calling convention,
     and are assumed to return int by default.

     *note Availability: 2199.: Windows

 -- クラス: ctypes.PyDLL

     See *note CDLL: be0, the superclass, for common information.

     When functions in this library are called, the Python GIL is 'not'
     released during the function call, and after the function execution
     the Python error flag is checked.  If the error flag is set, a
     Python exception is raised.

     Thus, this is only useful to call Python C API functions directly.

 -- データ: ctypes.RTLD_GLOBAL

     'mode' パラメータとして使うフラグ。このフラグが利用できないプラット
     フォームでは、整数のゼロと定義されています。

 -- データ: ctypes.RTLD_LOCAL

     'mode' パラメータとして使うフラグ。これが利用できないプラットフォー
     ムでは、 'RTLD_GLOBAL' と同様です。

 -- データ: ctypes.DEFAULT_MODE

     共有ライブラリをロードするために使われるデフォルトモード。 OSX 10.3
     では 'RTLD_GLOBAL' であり、そうでなければ 'RTLD_LOCAL' と同じです。

Shared libraries can also be loaded by using one of the prefabricated
objects, which are instances of the *note LibraryLoader: 33ce. class,
either by calling the *note LoadLibrary(): 3370. method, or by
retrieving the library as attribute of the loader instance.

 -- クラス: ctypes.LibraryLoader (dlltype)

     共有ライブラリをロードするクラス。 'dlltype' は *note CDLL: be0. 、
     *note PyDLL: 1b43. 、 *note WinDLL: 1b42. もしくは *note OleDLL:
     1b41. 型の一つであるべきです。

     ‘__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: be0. インスタンスを作ります。

 -- データ: ctypes.windll

     Creates *note WinDLL: 1b42. instances.

     *note Availability: 2199.: Windows

 -- データ: ctypes.oledll

     Creates *note OleDLL: 1b41. instances.

     *note Availability: 2199.: Windows

 -- データ: ctypes.pydll

     *note PyDLL: 1b43. インスタンスを作ります。

For accessing the C Python api directly, a ready-to-use Python shared
library object is available:

 -- データ: ctypes.pythonapi

     An instance of *note PyDLL: 1b43. 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: 1ccb. ‘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://manpages.debian.org/dlopen(3)

   (2) https://manpages.debian.org/dlopen(3)

   (3) 
https://learn.microsoft.com/en-us/cpp/build/reference/dumpbin-reference?view=msvc-170


File: python.info,  Node: 外部関数,  Next: 関数プロトタイプ,  Prev: 共有ライブラリをロードする,  Up: ctypesリファレンス

5.17.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: 1934. 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: 3399. attribute.

      -- の属性: argtypes

          関数が受け取る引数の型を指定するために ctypes 型のタプルを代入
          します。‘stdcall’ 呼び出し規約を使う関数はこのタプルの長さと同
          じ数の引数で呼び出されます。C 呼び出し規約を使う関数は、追加の
          不特定の引数も取ります。

          When a foreign function is called, each actual argument is
          passed to the *note from_param(): 3394. class method of the
          items in the *note argtypes: 182c. tuple, this method allows
          adapting the actual argument to an object that the foreign
          function accepts.  For example, a *note c_char_p: 1ab8. item
          in the ‘argtypes’ 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():
          3394. 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.17.9.29 関数プロトタイプ
..........................

外部関数は関数プロトタイプをインスタンス化することによって作成されます。
関数プロトタイプは C の関数プロトタイプと似ています。実装は定義せずに、
関数 (返り値の型、引数の型、呼び出し規約) を記述します。 ファクトリ関数
は、その関数に要求される返り値の型と引数の型とともに呼び出されます。そし
てこの関数はデコレータファクトリとしても使え、 ‘@wrapper’ 構文で他の関数
に適用できます。 例については *note コールバック関数: 33b0. を参照してく
ださい。

 -- の関数: ctypes.CFUNCTYPE (restype, *argtypes, use_errno=False,
          use_last_error=False)

     返された関数プロトタイプは標準 C 呼び出し規約をつかう関数を作成しま
     す。関数は呼び出されている間 GIL を解放します。 'use_errno' が真に
     設定されれば、呼び出しの前後で System 変数 *note errno: 5b. の
     ctypesプライベートコピーは本当の ‘errno’ の値と交換されます。
     '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: 2199.: 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: 2c2. is raised if the
     COM method call fails.  If 'iid' is specified, a *note COMError:
     1eb. 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: 2199.: Windows

オプションの 'paramflags' パラメータは上述した機能より多機能な外部関数ラ
ッパーを作成します。

'paramflags' must be a tuple of the same length as *note argtypes: 182c.

このタプルの個々の要素はパラメータについてのより詳細な情報を持ち、 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: 3399.
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: 3399. 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.17.9.30 ユーティリティー関数
..............................

 -- の関数: ctypes.addressof (obj)

     メモリバッファのアドレスを示す整数を返します。 'obj' は ctypes 型の
     インスタンスでなければなりません。

     引数 ‘obj’ を指定して *note 監査イベント: 1ccb. ‘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: 2199.: 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: 3378. の ctypes 配列です。

     If 'size' is given (and not ‘None’), it must be an *note int: 19c.
     It specifies the size of the returned array.

     If the 'init' argument is given, it must be *note bytes: 193.  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 監査イベント: 1ccb.
     ‘ctypes.create_string_buffer’ を送出します。

 -- の関数: ctypes.create_unicode_buffer (init, size=None)

 -- の関数: ctypes.create_unicode_buffer (size)

     この関数は変更可能な Unicode 文字バッファを作成します。返されるオブ
     ジェクトは *note c_wchar: 3379. の ctypes 配列です。

     The function takes the same arguments as *note
     create_string_buffer(): 338b. except 'init' must be a string and
     'size' counts *note c_wchar: 3379.

     引数 ‘init’, ‘size’ を指定して *note 監査イベント: 1ccb.
     ‘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: 2199.: 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: 2199.: Windows

 -- の関数: ctypes.util.find_library (name)

     Try to find a library and return a pathname.  'name' is the library
     name without any prefix like ‘lib’, suffix like ‘.so’, ‘.dylib’ or
     version number (this is the form used for the posix linker option
     ‘-l’).  If no library can be found, returns ‘None’.

     The exact functionality is system dependent.

     See *note 共有ライブラリを見つける: 33be. 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: 2199.: 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: 2c2. 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: 2199.: 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(): 3398.

     *note Availability: 2199.: 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: 2199.: Windows

 -- の関数: ctypes.get_errno ()

     システムの *note errno: 5b. 変数の、スレッドローカルなプライベート
     コピーを返します。

     引数無しで *note 監査イベント: 1ccb. ‘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: 2199.: Windows

     引数無しで *note 監査イベント: 1ccb. ‘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 監査イベント: 1ccb.
     ‘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: 2199.: Windows

     引数 ‘error’ を指定して *note 監査イベント: 1ccb.
     ‘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: 1ccb. ‘ctypes.string_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.WinError (code=None, descr=None)

     Creates an instance of *note OSError: 2c2.  If 'code' is not
     specified, *note GetLastError(): 3398. is called to determine the
     error code.  If 'descr' is not specified, *note FormatError():
     33dc. is called to get a textual description of the error.

     *note Availability: 2199.: Windows

     バージョン 3.3 で変更: An instance of *note WindowsError: 1264.
     used to be created, which is now an alias of *note OSError: 2c2.

 -- の関数: 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: 1ccb. ‘ctypes.wstring_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.memoryview_at (ptr, size, readonly=False)

     Return a *note memoryview: 166. 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(): 1ee. 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(): 33e2. only takes integers, 'ptr' can also be given
     as a *note ctypes.POINTER: 1f3. or a *note byref(): 339c. object.)

     Raises an *note auditing event: 1ccb. ‘ctypes.memoryview_at’ with
     arguments ‘address’, ‘size’, ‘readonly’.

     Added in version 3.14.


File: python.info,  Node: データ型<3>,  Next: 基本データ型<2>,  Prev: ユーティリティー関数,  Up: ctypesリファレンス

5.17.9.31 データ型
..................

 -- クラス: ctypes._CData

     この非公開クラスはすべての ctypes データ型の共通のベースクラスです
     。他のことはさておき、すべての ctypes 型インスタンスは C 互換データ
     を保持するメモリブロックを内部に持ちます。このメモリブロックのアド
     レスは *note addressof(): 33d7. ヘルパー関数が返します。別のインス
     タンス変数が *note _objects: 33e6. として公開されます。これはメモリ
     ブロックがポインタを含む場合に存続し続ける必要のある他の Python オ
     ブジェクトを含んでいます。

     ctypes データ型の共通メソッド、すべてのクラスメソッドが存在します
     (正確には、 *note メタクラス: 2430. のメソッドです):

      -- メソッド: from_buffer (source[, offset])

          このメソッドは 'source' オブジェクトのバッファを共有する
          ctypes のインスタンスを返します。 'source' オブジェクトは書き
          込み可能バッファインターフェースをサポートしている必要がありま
          す。オプションの 'offset' 引数では 'source' バッファのオフセッ
          トをバイト単位で指定します。デフォルトではゼロです。もし
          'source' バッファが十分に大きくなければ、 *note ValueError:
          2ee. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1ccb. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_buffer_copy (source[, offset])

          このメソッドは 'source' オブジェクトの読み出し可能バッファをコ
          ピーすることで、ctypes のインスタンスを生成します。オプション
          の 'offset' 引数では 'source' バッファのオフセットをバイト単位
          で指定します。デフォルトではゼロです。もし 'source' バッファが
          十分に大きくなければ、 *note ValueError: 2ee. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1ccb. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_address (address)

          このメソッドは 'address' で指定されたメモリを使って ctypes 型
          のインスタンスを返します。 'address' は整数でなければなりませ
          ん。

          This method, and others that indirectly call this method,
          raises an *note auditing event: 1ccb. ‘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:
          182c. 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():
          1f3. 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_: 33e9. 読み出し専用属性は、メモリブロ
          ックを保持する ctypes の基底オブジェクトです。

      -- の属性: _b_needsfree_

          この読み出し専用の変数は、 ctypes データインスタンスが、それ自
          身に割り当てられたメモリブロックを持つとき true になります。そ
          れ以外の場合は false になります。

      -- の属性: _objects

          このメンバは ‘None’ 、または、メモリブロックの内容が正しく保つ
          ために、生存させておかなくてはならない Python オブジェクトを持
          つディクショナリです。このオブジェクトはデバッグでのみ使われま
          す。決してディクショナリの内容を変更しないで下さい。


File: python.info,  Node: 基本データ型<2>,  Next: 構造化データ型,  Prev: データ型<3>,  Up: ctypesリファレンス

5.17.9.32 基本データ型
......................

 -- クラス: ctypes._SimpleCData

     この非公開クラスは、全ての基本的な ctypes データ型の基底クラスです
     。これは基本的な ctypes データ型に共通の属性を持っているので、ここ
     で触れておきます。 *note _SimpleCData: 33ed. は *note _CData: 33e5.
     の子クラスなので、そのメソッドと属性を継承しています。ポインタでな
     いかポインタを含まない 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.

     Each subclass has a class attribute:

      -- の属性: _type_

          Class attribute that contains an internal type code, as a
          single-character string.  See *note 基本データ型: 2892. for a
          summary.

          Types marked * in the summary may be (or always are) aliases
          of a different ‘_SimpleCData’ subclass, and will not
          necessarily use the listed type code.  For example, if the
          platform's long, long long and time_t C types are the same,
          then *note c_long: 336a, *note c_longlong: 3386. and *note
          c_time_t: 1bc2. all refer to a single class, ‘c_long’, whose
          *note _type_: 3376. code is ‘'l'’.  The ‘'L'’ code will be
          unused.

          参考
          ....

          The *note array: 8. and *note struct: 124f. modules, as well
          as third-party modules like numpy(1), use similar - but
          slightly different - type codes.

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: 3397. of *note c_char_p: 1ab8,
you will always receive a Python bytes object, 'not' a ‘c_char_p’
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:
1aba, 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: 1d13. の
     別名です。

 -- クラス: ctypes.c_float

     C float データ型を表します。コンストラクタはオプションの浮動小数点
     数初期化子を受け取ります。

 -- クラス: ctypes.c_double_complex

     Represents the C double complex datatype, if available.  The
     constructor accepts an optional *note complex: 198. 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: 198. 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: 198. initializer.

     Added in version 3.14.

 -- クラス: ctypes.c_int

     C signed int データ型を表します。コンストラクタはオプションの整数初
     期化子を受け取ります。オーバーフローのチェックは行われません。
     ‘sizeof(int) == sizeof(long)’ であるプラットフォームでは、 *note
     c_long: 336a. の別名です。

 -- クラス: ctypes.c_int8

     Represents the C 8-bit signed int datatype.  It is an alias for
     *note c_byte: 1b3f.

 -- クラス: ctypes.c_int16

     C 16-bit signed int データ型を表します。たいていは、 *note c_short:
     337a. の別名です。

 -- クラス: ctypes.c_int32

     C 32-bit signed int データ型を表します。たいていは、 *note c_int:
     3369. の別名です。

 -- クラス: ctypes.c_int64

     C 64-bit signed int データ型を表します。たいていは、 *note
     c_longlong: 3386. の別名です。

 -- クラス: ctypes.c_long

     C signed long データ型を表します。コンストラクタはオプションの整数
     初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_longlong

     Represents the C signed long long datatype.  The constructor
     accepts an optional integer initializer; no overflow checking is
     done.  On platforms where ‘sizeof(long long) == sizeof(long)’ it is
     an alias to *note c_long: 336a.

 -- クラス: ctypes.c_short

     C signed short データ型を表します。コンストラクタはオプションの整数
     初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_size_t

     Represents the C ‘size_t’ datatype.  Usually an alias for another
     unsigned integer type.

 -- クラス: ctypes.c_ssize_t

     Represents the *note Py_ssize_t: c59. datatype.  This is a signed
     version of ‘size_t’; that is, the POSIX ‘ssize_t’ type.  Usually an
     alias for another integer type.

     Added in version 3.2.

 -- クラス: ctypes.c_time_t

     Represents the C ‘time_t’ datatype.  Usually an alias for another
     integer type.

     Added in version 3.12.

 -- クラス: ctypes.c_ubyte

     C の unsigned char データ型を表し、小さな整数として値を解釈します。
     コンストラクタはオプションの整数初期化子を受け取ります; オーバーフ
     ローのチェックは行われません。

 -- クラス: ctypes.c_uint

     C の unsigned int データ型を表します。コンストラクタはオプションの
     整数初期化子を受け取ります; オーバーフローのチェックは行われません
     。これは、 ‘sizeof(int) == sizeof(long)’ であるプラットフォームでは
     *note c_ulong: 3385. の別名です。

 -- クラス: ctypes.c_uint8

     Represents the C 8-bit unsigned int datatype.  It is an alias for
     *note c_ubyte: 1b40.

 -- クラス: ctypes.c_uint16

     C 16-bit unsigned int データ型を表します。たいていは、 *note
     c_ushort: 337b. の別名です。

 -- クラス: ctypes.c_uint32

     C 32-bit unsigned int データ型を表します。たいていは、 *note
     c_uint: 3380. の別名です。

 -- クラス: ctypes.c_uint64

     C 64-bit unsigned int データ型を表します。たいていは、 *note
     c_ulonglong: 3387. の別名です。

 -- クラス: ctypes.c_ulong

     C unsigned long データ型を表します。コンストラクタはオプションの整
     数初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_ulonglong

     Represents the C unsigned long long datatype.  The constructor
     accepts an optional integer initializer; no overflow checking is
     done.  On platforms where ‘sizeof(long long) == sizeof(long)’ it is
     an alias to *note c_long: 336a.

 -- クラス: 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: 2199.: Windows

 -- クラス: ctypes.py_object

     C *note PyObject: 5df.* データ型を表します。引数なしでこれを呼び出
     すと ‘NULL’ PyObject* ポインタを作成します。

     バージョン 3.14 で変更: ‘py_object’ is now a *note generic type:
     1a2.

The ‘ctypes.wintypes’ module provides quite some other Windows specific
data types, for example ‘HWND’, ‘WPARAM’, ‘VARIANT_BOOL’ or ‘DWORD’.
Some useful structures like ‘MSG’ or ‘RECT’ are also defined.

   ---------- Footnotes ----------

   (1) 
https://numpy.org/doc/stable/reference/arrays.interface.html#object.__array_interface__


File: python.info,  Node: 構造化データ型,  Next: 配列とポインタ,  Prev: 基本データ型<2>,  Up: ctypesリファレンス

5.17.9.33 構造化データ型
........................

 -- クラス: ctypes.Union (*args, **kw)

     ネイティブのバイトオーダーでの共用体のための抽象ベースクラス。

     Unions share common attributes and behavior with structures; see
     *note Structure: 1e7. 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_: 1996.
     class variable.  ‘ctypes’ will create *note descriptor: 18e5.s
     which allow reading and writing the fields by direct attribute
     accesses.  These are the

      -- の属性: _fields_

          構造体のフィールドを定義するシーケンス。要素は2要素タプルか3要
          素タプルでなければなりません。第一要素はフィールドの名前です。
          第二要素はフィールドの型を指定します。それはどんな ctypes デー
          タ型でも構いません。

          *note c_int: 3369. のような整数型のために、オプションの第三要
          素を与えることができます。フィールドのビット幅を定義する正の小
          整数である必要があります。

          一つの構造体と共用体の中で、フィールド名はただ一つである必要が
          あります。これはチェックされません。名前が繰り返しでてきたとき
          にアクセスできるのは一つのフィールドだけです。

          Structure サブクラスを定義するクラス文の '後で' 、 *note
          _fields_: 1996. クラス変数を定義することができます。これにより
          、次のように自身を直接または間接的に参照するデータ型を作成でき
          るようになります:

               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(): 33df. 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_: 1996. 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_: 1e9.).

          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_: 1996. is
          assigned, otherwise it will have no effect.

          バージョン 3.14 で非推奨、バージョン 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_: 1e9. 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_: 1996.
          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_: 319. 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_: 319. is specified: ‘"ms"’.  (This is
               deprecated; see ‘_pack_’ documentation.)

             - Otherwise: ‘"gcc-sysv"’

          ‘_layout_’ must already be defined when *note _fields_: 1996.
          is assigned, otherwise it will have no effect.

          Added in version 3.14.

      -- の属性: _anonymous_

          無名 (匿名) フィールドの名前が並べあげられたオプションのシーケ
          ンス。 *note _fields_: 1996. が代入されたとき、 *note
          _anonymous_: 33f1. がすでに定義されていなければなりません。そ
          うでなければ、何ら影響はありません。

          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_: 1996. 変
     数がある場合は、この中で指定されたフィールドは基底クラスのフィール
     ドへ追加されます。

     構造体と共用体のコンストラクタは位置引数とキーワード引数の両方を受
     け取ります。位置引数は *note _fields_: 1996. の中に現れたのと同じ順
     番でメンバーフィールドを初期化するために使われます。コンストラクタ
     のキーワード引数は属性代入として解釈され、そのため、同じ名前をもつ
     ‘_fields_’ を初期化するか、 ‘_fields_’ に存在しない名前に対しては新
     しい属性を作ります。

 -- クラス: ctypes.CField (*args, **kw)

     Descriptor for fields of a *note Structure: 1e7. and *note Union:
     1e8.  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_: 1996.; 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: 33e3.

      -- の属性: 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: 33f6.

      -- の属性: 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: 33f7.

          For bitfields, this contains a backwards-compatible bit-packed
          value that combines *note bit_size: 33f9. and *note
          bit_offset: 33f6.  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: 33f7. bytes of memory starting at
          *note byte_offset: 33f5.

          To get the field's value, read the storage unit as an integer,
          *note shift left: 2529. 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.17.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_: 33fe. and *note _type_: 33ff. 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
     ‘Array’.

     Arrays are *note generic: 2429. over the type of their elements.

      -- の属性: _length_

          配列の要素数を指定する正の整数。範囲外の添え字を指定すると、
          *note IndexError: 1753. が送出されます。*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: 23f. in favor of
     multiplication.  There are no plans to remove it.

 -- クラス: ctypes._Pointer

     ポインタのためのプライベートな抽象基底クラスです。

     具象ポインタ型は、ポイント先の型を持つ *note POINTER(): 1f3. を呼び
     出すことで、作成できます。これは、 *note pointer(): 1ab7. により自
     動的に行われます。

     ポインタが配列を指す場合、その配列の要素は、標準の添え字とスライス
     によるアクセスを使用して読み書きが行えます。ポインタオブジェクトに
     は、サイズがないため、 *note len(): 840. 関数は *note TypeError:
     199. を送出します。負の添え字は、(C と同様に) ポインタの '前' のメ
     モリから読み込み、範囲外の添え字はおそらく (幸運な場合でも) アクセ
     ス違反によりクラッシュを起こします。

      -- の属性: _type_

          ポイント先の型を指定します。

      -- の属性: contents

          ポインタが指すオブジェクトを返します。この属性に割り当てると、
          ポインタが割り当てられたオブジェクトを指すようになります。


File: python.info,  Node: 例外<10>,  Prev: 配列とポインタ,  Up: ctypesリファレンス

5.17.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: 2199.: Windows

     Added in version 3.14.


File: python.info,  Node: コマンドラインインターフェースライブラリ,  Next: 並行実行,  Prev: 汎用オペレーティングシステムサービス,  Up: Python 標準ライブラリ

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

この章で説明されているモジュールは、アプリケーション向けのコマンドライン
やターミナルインターフェースの実装を支援します。

概要は以下のとおりです:

* 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.18.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:
     340d. 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
チュートリアル: 340e. では、コマンドラインの解析についてより優しく説明し
ています。

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:
1480.  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: 1bf.  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(): 340f. メソッドはパーサーを実行し、抽
出したデータを *note argparse.Namespace: 3410. オブジェクト内に配置しま
す:

     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: 13ca.

* 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.18.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: 1bf. オブジェクトを生成します。すべて
     の引数はキーワード引数として渡すべきです。各引数についてはあとで詳
     しく説明しますが、簡単に言うと:

        * *note prog: 1be. - The name of the program (default: generated
          from the ‘__main__’ module attributes and ‘sys.argv[0]’)

        * *note usage: 3412. - プログラムの利用方法を記述する文字列 (デ
          フォルト: パーサーに追加された引数から生成されます)

        * *note description: 3413. - 引数のヘルプの前に表示されるテキス
          ト (デフォルトはテキストなしです)

        * *note epilog: 3414. - 引数のヘルプの後に表示されるテキスト (デ
          フォルトはテキストなしです)

        * *note parents: 3415. - *note ArgumentParser: 1bf. オブジェクト
          のリストで、このオブジェクトの引数が追加されます

        * *note formatter_class: 3416. - ヘルプ出力をカスタマイズするた
          めのクラス

        * *note prefix_chars: 3417. - オプションの引数の prefix になる文
          字集合 (デフォルト: '-')

        * *note fromfile_prefix_chars: 3418. - 追加の引数を読み込むファ
          イルの prefix になる文字集合 (デフォルト: ‘None’)

        * *note argument_default: 3419. - 引数のグローバルなデフォルト値
          (デフォルト: ‘None’)

        * *note conflict_handler: 341a. - 衝突するオプションを解決する方
          法 (通常は不要)

        * *note add_help: 341b. - ‘-h/--help’ オプションをパーサーに追加
          する (デフォルト: ‘True’)

        * *note allow_abbrev: fc2. - Allows long options to be
          abbreviated if the abbreviation is unambiguous (default:
          ‘True’)

        * *note exit_on_error: 341c. - Determines whether or not
          ‘ArgumentParser’ exits with error info when an error occurs.
          (default: ‘True’)

        * *note suggest_on_error: 341d. - Enables suggestions for
          mistyped argument choices and subparser names (default:
          ‘False’)

        * *note color: 341e. - 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.18.1.2 ‘prog’
...............

By default, *note ArgumentParser: 1bf. calculates the name of the
program to display in help messages depending on the way the Python
interpreter was run:

   * The *note base name: 2cc4. 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: 23e. 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:
1bf.:

     >>> 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.18.1.3 usage
..............

By default, *note ArgumentParser: 1bf. 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(): e15. 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.18.1.4 description
....................

Most calls to the *note ArgumentParser: 1bf. 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: 3416. 引数を参照してください。


File: python.info,  Node: epilog,  Next: parents,  Prev: description,  Up: ArgumentParser オブジェクト

5.18.1.5 epilog
...............

いくつかのプログラムは、プログラムについての追加の説明を引数の説明の後に
表示します。このテキストは *note ArgumentParser: 1bf. の ‘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: 3413. 引数と同じく、‘epilog=’ テキストもデフォルトで
折り返され、*note ArgumentParser: 1bf. の *note formatter_class: 3416. 引
数で動作を調整できます。


File: python.info,  Node: parents,  Next: formatter_class,  Prev: epilog,  Up: ArgumentParser オブジェクト

5.18.1.6 parents
................

ときどき、いくつかのパーサーが共通の引数セットを共有することがあります。
それらの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサー
を *note ArgumentParser: 1bf. の ‘parents=’ 引数に渡すことができます。
‘parents=’ 引数は ‘ArgumentParser’ オブジェクトのリストを受け取り、すべ
ての位置アクションとオプションのアクションをそれらから集め、そのアクショ
ンを構築中の ‘ArgumentParser’ オブジェクトに追加します:

     >>> 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: 1bf. は2つの ‘-h/--help’ オプ
ションを与えられる (1つは親から、もうひとつは子から) ことになり、エラー
を発生します。

     注釈: ‘parents=’ に渡す前にパーサーを完全に初期化する必要があります
     。子パーサーを作成してから親パーサーを変更した場合、その変更は子パ
     ーサーに反映されません。


File: python.info,  Node: formatter_class,  Next: prefix_chars,  Prev: parents,  Up: ArgumentParser オブジェクト

5.18.1.7 formatter_class
........................

*note ArgumentParser: 1bf. オブジェクトは代わりのフォーマットクラスを指
定することでヘルプのフォーマットをカスタマイズできます。現在、4つのフォ
ーマットクラスがあります:

 -- クラス: argparse.RawDescriptionHelpFormatter
 -- クラス: argparse.RawTextHelpFormatter
 -- クラス: argparse.ArgumentDefaultsHelpFormatter
 -- クラス: argparse.MetavarTypeHelpFormatter

*note RawDescriptionHelpFormatter: 3422. と *note RawTextHelpFormatter:
3423. はどのようにテキストの説明を表示するかを指定できます。デフォルトで
は *note ArgumentParser: 1bf. オブジェクトはコマンドラインヘルプの中の
*note description: 3413. と *note epilog: 3414. を折り返して表示します:

     >>> 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: 3422. を渡した
場合、 *note description: 3413. と *note epilog: 3414. は整形済みとされ
改行されません:

     >>> 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: 3423. 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: 1cad. は各引数のデフォルト値を自動
的にヘルプに追加します:

     >>> 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: 3424. は、各引数の値の表示名に *note
type: 3425. 引数の値を使用します (通常は *note dest: 3426. の値が使用さ
れます):

     >>> 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.18.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: 1bf. 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.18.1.9 fromfile_prefix_chars
..............................

ときどき、非常に長い引数リストを扱う場合に、その引数リストを毎回コマンド
ラインにタイプする代わりにファイルに置いておきたい場合があります。*note
ArgumentParser: 1bf. のコンストラクターに ‘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(): 3427.) 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']’.

     注釈: Each line is treated as a single argument, so an empty line
     is read as an empty string (‘''’).

*note ArgumentParser: 1bf. uses *note filesystem encoding and error
handler: 75d. to read the file containing arguments.

‘fromfile_prefix_chars=’ 引数のデフォルト値は ‘None’ で、引数がファイル
参照として扱われることがないことを意味しています。

バージョン 3.12 で変更: *note ArgumentParser: 1bf. 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.18.1.10 argument_default
..........................

一般的には、引数のデフォルト値は *note add_argument(): 4bc. メソッドにデ
フォルト値を渡すか、*note set_defaults(): 3428. メソッドに名前と値のペア
を渡すことで指定します。しかしまれに、1つのパーサー全体に適用されるデフ
ォルト引数が便利なことがあります。これを行うには、 *note ArgumentParser:
1bf. に ‘argument_default=’ キーワード引数を渡します。例えば、全体で
*note parse_args(): 340f. メソッド呼び出しの属性の生成を抑制するには、
‘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.18.1.11 allow_abbrev
......................

通常、*note ArgumentParser: 1bf. の *note parse_args(): 340f. に引数のリ
ストを渡すとき、長いオプションは *note 短縮しても認識されます: fc3.。

この機能は、‘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.18.1.12 conflict_handler
..........................

*note ArgumentParser: 1bf. オブジェクトは同じオプション文字列に対して複
数のアクションを許可していません。 デフォルトでは、‘ArgumentParser’ オブ
ジェクトは、すでに利用されているオプション文字列を使って新しい引数をつく
ろうとしたときに例外を送出します:

     >>> 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: 3415. を利用する場合など)、古い引数を同
じオプション文字列で上書きするほうが便利な場合があります。この動作をする
には、*note ArgumentParser: 1bf. の ‘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: 1bf. オブジェクトは、すべてのオプション文字列が上
書きされた場合にだけアクションを削除することに注目してください。上の例で
は、 ‘--foo’ オプション文字列だけが上書きされているので、古い ‘-f/--foo’
アクションは ‘-f’ アクションとして残っています。


File: python.info,  Node: add_help,  Next: exit_on_error,  Prev: conflict_handler,  Up: ArgumentParser オブジェクト

5.18.1.13 add_help
..................

By default, *note ArgumentParser: 1bf. 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: 1bf. の ‘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.18.1.14 exit_on_error
.......................

Normally, when you pass an invalid argument list to the *note
parse_args(): 340f. method of an *note ArgumentParser: 1bf, it will
print a 'message' to *note sys.stderr: b37. 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.18.1.15 suggest_on_error
..........................

By default, when a user passes an invalid argument choice or subparser
name, *note ArgumentParser: 1bf. 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(suggest_on_error=True)
     >>> parser.add_argument('--action', choices=['debug', 'dryrun'])
     >>> parser.parse_args(['--action', 'debugg'])
     usage: tester.py [-h] [--action {debug,dryrun}]
     tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun)

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.18.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: 1b9, 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.18.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: 342b. - Either a name or a list of option
          strings, e.g.  ‘'foo'’ or ‘'-f', '--foo'’.

        * *note action: 198b. - コマンドラインにこの引数があったときのア
          クション。

        * *note nargs: 1991. - 受け取るべきコマンドライン引数の数。

        * *note const: 1993. - 一部の *note action: 198b. と *note
          nargs: 1991. の組み合わせで利用される定数。

        * *note default: 1992. - コマンドラインに対応する引数が存在せず
          、さらに namespace オブジェクトにも存在しない場合に利用される
          値。

        * *note type: 3425. - コマンドライン引数が変換されるべき型。

        * *note choices: 198d. - 引数として許される値のシーケンス。

        * *note required: 342c. - コマンドラインオプションが省略可能かど
          うか (オプション引数のみ)。

        * *note help: 342d. - 引数が何なのかを示す簡潔な説明。

        * *note metavar: 342e. - 使用法メッセージの中で使われる引数の名
          前。

        * *note dest: 3426. - *note parse_args(): 340f. が返すオブジェク
          トに追加される属性名。

        * *note deprecated: 342f. - Whether or not use of the argument
          is deprecated.

     The method returns an *note Action: 1bea. object representing the
     argument.

以下の節では各オプションの利用方法を説明します。

* 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.18.1.18 name または flags
...........................

*note add_argument(): 4bc. メソッドは、指定されている引数が ‘-f’ や
‘--foo’ のようなオプション引数なのか、ファイル名リストなどの位置引数なの
かを知る必要があります。 そのため、 ‘add_argument()’ に初めに渡される引
数は、一連のフラグか、単一の引数名のどちらかになります。

たとえば、オプション引数は次のように作成します:

     >>> parser.add_argument('-f', '--foo')

一方、位置引数は次のように作成します:

     >>> parser.add_argument('bar')

*note parse_args(): 340f. が呼ばれたとき、オプション引数は接頭辞 ‘-’ に
より識別され、それ以外の引数は位置引数として扱われます:

     >>> 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: 3426. and *note metavar: 342e. parameters.  For optional
arguments, the *note dest: 3426. parameter defaults to the argument
name, with underscores ‘_’ replacing hyphens ‘-’.  The *note metavar:
342e. 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.18.1.19 action
................

*note ArgumentParser: 1bf. オブジェクトはコマンドライン引数にアクション
を割り当てます。このアクションは、割り当てられたコマンドライン引数に関し
てどんな処理でもできますが、ほとんどのアクションは単に *note
parse_args(): 340f. が返すオブジェクトに属性を追加するだけです。‘action’
キーワード引数は、コマンドライン引数がどう処理されるかを指定します。提供
されているアクションは:

   * ‘'store'’ - This just stores the argument's value.  This is the
     default action.

   * ‘'store_const'’ - このアクションは *note const: 1993. キーワード引
     数で指定された値を格納します。*note const: 1993. キーワード引数のデ
     フォルト値は ‘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: 1993. keyword argument to a list; note that the *note const:
     1993. 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: 1991. keyword argument value ‘'+'’ or ‘'*'’.  Note that when
     *note nargs: 1991. 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: 1bf. を参照してください。

   * ‘'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:
1bea. subclass (e.g.  *note BooleanOptionalAction: 1c4f.) 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:
1bea, overriding the ‘__call__()’ method and optionally the ‘__init__()’
and ‘format_usage()’ methods.  You can also register custom actions
using the *note register(): 3432. 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: 1bea. を参照してください。


File: python.info,  Node: nargs,  Next: const,  Prev: action,  Up: add_argument メソッド

5.18.1.20 nargs
...............

*note ArgumentParser: 1bf. 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 多義性のある引数の指定: 3434.  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:
     1992. の値が生成されます。オプション引数の場合、さらにオプション引
     数が指定され、その後にコマンドライン引数がないというケースもありえ
     ます。この場合は *note const: 1993. の値が生成されます。この動作の
     例です:

          >>> 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: 198b.  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.18.1.21 const
...............

*note add_argument(): 4bc. の ‘const’ 引数は、コマンドライン引数から読み
込まれないけれども *note ArgumentParser: 1bf. のいくつかのアクションで必
要とされる値のために使われます。この引数のよくある2つの使用法は:

   * *note add_argument(): 4bc. が ‘action='store_const'’ か
     ‘action='append_const'’ で呼び出されたとき、これらのアクションは
     ‘const’ の値を *note parse_args(): 340f. が返すオブジェクトの属性に
     追加します。サンプルは *note action: 198b. の説明を参照してください
     。‘const’ が ‘add_argument()’ に与えられなければ、‘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: 1991. 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.18.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: 3410. の属性を設
定する前に、*note type: 3425. 変換引数が与えられていればそれらを適用しま
す。そうでない場合、パーサーは値をそのまま使用します:

     >>> 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: 1991. が ‘?’ か ‘*’ である位置引数では、コマンドライン引数
が指定されなかった場合 ‘default’ の値が使われます。例えば:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('foo', nargs='?', default=42)
     >>> parser.parse_args(['a'])
     Namespace(foo='a')
     >>> parser.parse_args([])
     Namespace(foo=42)

Because ‘nargs='*'’ gathers any supplied values into a list, an absent
positional argument yields an empty list (‘[]’).  Only a non-‘None’
'default' overrides this (so ‘default=None’ still gives ‘[]’).

For *note required: 342c. arguments, the ‘default’ value is ignored.
For example, this applies to positional arguments with *note nargs:
1991. 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.18.1.23 type
..............

デフォルトでは、パーサーはコマンドライン引数を単なる文字列として読み込み
ます。しかし、それらの文字列を *note float: 197, *note int: 19c. など別
の型として扱うべき事がよくあります。*note add_argument(): 4bc. の ‘type’
キーワード引数に指定する type converter により、必要な型チェックと型変換
を行うことができます。

もし *note type: 3425. キーワードが *note default: 1992. キーワードとと
もに使用された場合、*note default: 1992. の値が文字列のときのみ、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(): 3432.) If the
function raises *note ArgumentTypeError: 3438, *note TypeError: 199, or
*note ValueError: 2ee, 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')

The *note bool(): 3c1. function is not recommended as a type converter.
All it does is convert empty strings to ‘False’ and non-empty strings to
‘True’.  This is usually not what is desired:

     >>> parser = argparse.ArgumentParser()
     >>> _ = parser.add_argument('--verbose', type=bool)
     >>> parser.parse_args(['--verbose', 'False'])
     Namespace(verbose=True)

See *note BooleanOptionalAction: 1c4f. or ‘action='store_true'’ for
common alternatives.

一般論として、‘type’ キーワードに指定するものは、せいぜい上記の3種類の例
外を発生するくらいの、お手軽な変換に限るべきです。より複雑な
(interesting) エラー処理、またはリソース管理を伴うものは、引数を解析した
あとに別個の処理として行うべきです。

たとえば、JSON または YAML からの変換は複雑なエラーケースを持つので、
‘type’ がサポートする以上のエラー表示を必要とするでしょう。(JSON デコー
ダが発生しうる) *note JSONDecodeError: 1026. は適切に整形されて表示され
ません。また、*note FileNotFoundError: 266. が発生しても parser は何も処
理しません。

Even *note FileType: 30e. has its limitations for use with the ‘type’
keyword.  If one argument uses ‘FileType’ 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: 187.-statement to manage the files.

なお、引数が、あらかじめ決められた値の候補のいずれかに一致するかをチェッ
クしたいだけの場合には、代わりに *note choices: 198d. キーワードの使用を
検討してください。


File: python.info,  Node: choices,  Next: required,  Prev: type,  Up: add_argument メソッド

5.18.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:
24f. オブジェクト、 *note tuple: 614. オブジェクト、カスタムシーケンスは
すべてサポートされています。

ただし、*note enum.Enum: 842. を渡すことは推奨されません。使用方法、ヘル
プ、エラーメッセージなどでどのように表示されるかを制御することが難いから
です。

Note that 'choices' are checked after any *note type: 3425. conversions
have been performed, so objects in 'choices' should match the *note
type: 3425. 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: 3425. and handle
conversion in your application code.

ヘルプテキストにおいて整形された choices の値は、通常 'dest' から生成さ
れるデフォルトの 'metavar' に優先します。ユーザーは 'dest' パラメータを
目にすることがないため、この振る舞いは基本的には望ましいものです。もしこ
の表示方法が望ましくない場合 (おそらく多くの選択肢がある場合など) は、
*note metavar: 342e. を明示的に指定してください。


File: python.info,  Node: required,  Next: help,  Prev: choices,  Up: add_argument メソッド

5.18.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():
340f. はそのフラグがコマンドラインに存在しないときにエラーを表示します。

     注釈: ユーザーは、通常 'フラグ' の指定は '任意' であると認識してい
     るため、必須にするのは一般的には悪いやり方で、できる限り避けるべき
     です。


File: python.info,  Node: help,  Next: metavar,  Prev: required,  Up: add_argument メソッド

5.18.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: 1992. などを繰り
返し記述するのを避けるためのフォーマット指定子を含めることができます。利
用できる指定子には、プログラム名 ‘%(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.18.1.27 metavar
.................

When *note ArgumentParser: 1bf. generates help messages, it needs some
way to refer to each expected argument.  By default, ‘ArgumentParser’
objects use the *note dest: 3426. value as the "name" of each object.
By default, for positional argument actions, the *note dest: 3426. value
is used directly, and for optional argument actions, the *note dest:
3426. 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(): 340f. の返すオブジェクトの属性名は *note dest: 3426.
の値のままです。

‘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.18.1.28 dest
..............

ほとんどの *note ArgumentParser: 1bf. のアクションは *note parse_args():
340f. が返すオブジェクトに対する属性として値を追加します。この属性の名前
は *note add_argument(): 4bc. の ‘dest’ キーワード引数によって決定されま
す。位置引数のアクションについては、 ‘dest’ は通常 ‘add_argument()’ の第
一引数として渡します:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('bar')
     >>> parser.parse_args(['XXX'])
     Namespace(bar='XXX')

For optional argument actions, the value of ‘dest’ is normally inferred
from the option strings.  *note ArgumentParser: 1bf. generates the value
of ‘dest’ by taking the first long option string and stripping away the
initial ‘--’ string.  If no long option strings were supplied, ‘dest’
will be derived from the first short option string by stripping the
initial ‘-’ character.  Any internal ‘-’ characters will be converted to
‘_’ characters to make sure the string is a valid attribute name.  The
examples below illustrate this behavior:

     >>> 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')

Multiple arguments may share the same ‘dest’.  By default, the value
from the last such argument given on the command line wins.  Use
‘action='append'’ to collect values from all of them into a list
instead.  For conflicting 'option strings' rather than ‘dest’ names, see
*note conflict_handler: 341a.


File: python.info,  Node: deprecated,  Next: Action クラス,  Prev: dest,  Up: add_argument メソッド

5.18.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: b37. 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.18.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: 1bf. 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: 1bf. object which
               contains this action.

             * 'namespace' - The *note Namespace: 3410. object that will
               be returned by *note parse_args(): 340f.  Most actions
               add an attribute to this object using *note setattr():
               261d.

             * 'values' - The associated command-line arguments, with
               any type conversions applied.  Type conversions are
               specified with the *note type: 3425. 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: 1bea. 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.18.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: 3443. - 解析する文字列のリスト。デフォルトでは
          *note sys.argv: 1480. から取得されます。

        * *note namespace: 3444. - 属性を代入するオブジェクト。デフォル
          トでは、新しい空の *note Namespace: 3410. オブジェクトです。

* Menu:

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


File: python.info,  Node: オプション値の文法,  Next: 不正な引数,  Up: parse_args メソッド

5.18.1.32 オプション値の文法
............................

*note parse_args(): 340f. メソッドは、オプションの値がある場合、そのオプ
ションの値の指定に複数の方法をサポートしています。もっとも単純な場合には
、オプションとその値は次のように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.18.1.33 不正な引数
....................

*note parse_args(): 340f. は、コマンドラインの解析中に、曖昧なオプション
、不正な型、不正なオプション、位置引数の数の不一致などのエラーを検証しま
す。それらのエラーが発生した場合、エラーメッセージと使用法メッセージを表
示して終了します:

     >>> 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.18.1.34 ‘-’ を含む引数
........................

*note parse_args(): 340f. メソッドは、ユーザーが明らかなミスをした場合は
エラーを表示しますが、いくつか本質的に曖昧な場面があります。例えば、コマ
ンドライン引数 ‘-1’ は、オプションの指定かもしれませんし位置引数かもしれ
ません。‘parse_args()’ メソッドはこれを次のように扱います: 負の数として
解釈でき、パーサーに負の数のように解釈できるオプションが存在しない場合に
のみ、‘-’ で始まる位置引数になりえます:

     >>> 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(): 340f. にそれ以降のすべてが
位置引数だと教えることができます:

     >>> parser.parse_args(['--', '-f'])
     Namespace(foo='-f', one=None)

See also *note the argparse howto on ambiguous arguments: 3434. for more
details.


File: python.info,  Node: 引数の短縮形 先頭文字でのマッチング,  Next: sys argv 以外,  Prev: - を含む引数,  Up: parse_args メソッド

5.18.1.35 引数の短縮形 (先頭文字でのマッチング)
...............................................

*note parse_args(): 340f. メソッドは、*note デフォルトで: fc2.、長いオプ
ションに曖昧さがない (先頭文字列が一意である) かぎり、先頭文字列に短縮し
て指定できます:

     >>> 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: fc2. に ‘False’ を指定することで無効に
できます。


File: python.info,  Node: sys argv 以外,  Next: Namespace オブジェクト,  Prev: 引数の短縮形 先頭文字でのマッチング,  Up: parse_args メソッド

5.18.1.36 ‘sys.argv’ 以外
.........................

Sometimes it may be useful to have an *note ArgumentParser: 1bf. parse
arguments other than those of *note sys.argv: 1480.  This can be
accomplished by passing a list of strings to *note parse_args(): 340f.
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.18.1.37 Namespace オブジェクト
................................

 -- クラス: argparse.Namespace

     *note parse_args(): 340f. が属性を格納して返すためのオブジェクトに
     デフォルトで使用されるシンプルなクラスです。

     このクラスはシンプルに設計されており、単に読みやすい文字列表現を持
     った *note object: c82. のサブクラスです。もし属性を辞書のように扱
     える方が良ければ、標準的な Python のイディオム *note vars(): 1e7f.
     を利用できます:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo')
          >>> args = parser.parse_args(['--foo', 'BAR'])
          >>> vars(args)
          {'foo': 'BAR'}

     *note ArgumentParser: 1bf. が、新しい *note Namespace: 3410. オブジ
     ェクトではなく、既存のオブジェクトに属性を設定する方が良い場合があ
     ります。これは ‘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.18.1.38 その他のユーティリティ
................................

* Menu:

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


File: python.info,  Node: Subcommands,  Next: FileType オブジェクト,  Up: その他のユーティリティ

5.18.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:
     1bf. 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: 1bf.)

        * *note action: 198b. - コマンドラインにこの引数があったときの基
          本のアクション。

        * *note dest: 3426. - name of the attribute under which
          subcommand name will be stored; by default ‘None’ and no value
          is stored

        * *note required: 342c. - サブコマンドが必須であるかどうかを指定
          し、デフォルトは ‘False’ です。(3.7 より追加)

        * *note help: 342d. - ヘルプ出力に表示されるサブパーサーグループ
          のヘルプです。デフォルトは ‘None’ です

        * *note metavar: 342e. - 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 that the object returned by *note parse_args(): 340f. will
     only contain attributes for the main parser and the subparser that
     was selected by the command line (and not any other subparsers).
     So in the example above, when the ‘a’ command is specified, only
     the ‘foo’ and ‘bar’ attributes are present, and when the ‘b’
     command is specified, only the ‘foo’ and ‘baz’ attributes are
     present.

     If a subparser defines an argument with the same ‘dest’ as the
     parent parser, the two share a single namespace attribute, so the
     parent's value won't be retained.  Users should give them distinct
     ‘dest’ values to keep both.

     同じように、サブパーサーにヘルプメッセージが要求された場合は、その
     パーサーに対するヘルプだけが表示されます。ヘルプメッセージには親パ
     ーサーや兄弟パーサーのヘルプメッセージを表示しません。 (ただし、各
     サブパーサーコマンドのヘルプメッセージは、上の例にもあるように
     ‘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

     The ‘add_subparsers()’ method also supports ‘title’ and
     ‘description’ keyword arguments.  When either is present, the
     subparser's commands will appear in their own group in the help
     output.  For example:

          >>> 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 ‘add_subparsers()’ method with calls to
     *note set_defaults(): 3428. 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))

     This way, you can let *note parse_args(): 340f. do the job of
     calling the appropriate function after argument parsing is
     complete.  Associating functions with actions like this is
     typically the easiest way to handle the different actions for each
     of your subparsers.  However, if it is necessary to check the name
     of the subparser that was invoked, the ‘dest’ keyword argument to
     the ‘add_subparsers()’ call will work:

          >>> 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.18.1.40 FileType オブジェクト
...............................

 -- クラス: argparse.FileType (mode='r', bufsize=-1, encoding=None,
          errors=None)

     *note FileType: 30e. ファクトリは *note
     ArgumentParser.add_argument(): 4bc. の type 引数に渡すことができる
     オブジェクトを生成します。 type が ‘FileType’ オブジェクトである引
     数はコマンドライン引数を、指定されたモード、バッファーサイズ、エン
     コーディング、エラー処理でファイルとして開きます (詳細は *note
     open(): 318. 関数を参照してください。):

          >>> 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: 30e. であれば *note sys.stdin: 75f. を、書き込み用の
     ‘FileType’ であれば *note sys.stdout: cd1. に変換します:

          >>> 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: 187.-statement to
          manage the files.

     バージョン 3.4 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。

     バージョン 3.14 で非推奨.


File: python.info,  Node: 引数グループ,  Next: 相互排他,  Prev: FileType オブジェクト,  Up: その他のユーティリティ

5.18.1.41 引数グループ
......................

 -- メソッド: ArgumentParser.add_argument_group (title=None,
          description=None, *[, argument_default][, conflict_handler])

     By default, *note ArgumentParser: 1bf. 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 ‘add_argument_group()’ method returns an argument group object
     which has an *note add_argument(): 4bc. method just like a regular
     *note ArgumentParser: 1bf.  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: 3419.
     and *note conflict_handler: 341a. allow for finer-grained control
     of the behavior of the argument group.  These parameters have the
     same meaning as in the *note ArgumentParser: 1bf. constructor, but
     apply specifically to the argument group rather than the entire
     parser.

     ユーザー定義グループにないすべての引数は通常の "位置引数" と "オプ
     ション引数" セクションに表示されます。

     Within each argument group, arguments are displayed in help output
     in the order in which they are added.

     バージョン 3.11 で非推奨、バージョン 3.14 で削除: Calling
     ‘add_argument_group()’ 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: 3417. to
     ‘add_argument_group()’ is now deprecated.


File: python.info,  Node: 相互排他,  Next: パーサーのデフォルト値,  Prev: 引数グループ,  Up: その他のユーティリティ

5.18.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(): 2ef. メソッドの引数
     '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(): 2ed.  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

     バージョン 3.11 で非推奨、バージョン 3.14 で削除: Calling *note
     add_argument_group(): 2ed. or ‘add_mutually_exclusive_group()’ 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.18.1.43 パーサーのデフォルト値
................................

 -- メソッド: ArgumentParser.set_defaults (**kwargs)

     ほとんどの場合、 *note parse_args(): 340f. が返すオブジェクトの属性
     はコマンドライン引数の内容と引数のアクションによってのみ決定されま
     す。 *note set_defaults(): 3428. を使うと与えられたコマンドライン引
     数の内容によらず追加の属性を決定することが可能です:

          >>> 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(): 3428. 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(): e15. メソッドを
     参照してください。

 -- メソッド: ArgumentParser.get_default (dest)

     *note add_argument(): 4bc. か *note set_defaults(): 3428. によって
     指定された、 namespace の属性のデフォルト値を取得します:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', default='badger')
          >>> parser.get_default('foo')
          'badger'


File: python.info,  Node: ヘルプの表示,  Next: 部分解析,  Prev: パーサーのデフォルト値,  Up: その他のユーティリティ

5.18.1.44 ヘルプの表示
......................

ほとんどの典型的なアプリケーションでは、*note parse_args(): 340f. が使用
法やエラーメッセージのフォーマットと表示について面倒を見ます。しかし、い
くつかのフォーマットメソッドが利用できます:

 -- メソッド: ArgumentParser.print_usage (file=None)

     *note ArgumentParser: 1bf. がコマンドラインからどう実行されるべきか
     の短い説明を表示します。 'file' が ‘None’ の時は、 *note
     sys.stdout: cd1. に出力されます。

 -- メソッド: ArgumentParser.print_help (file=None)

     プログラムの使用法と *note ArgumentParser: 1bf. に登録された引数に
     ついての情報を含むヘルプメッセージを表示します。 'file' が ‘None’ の
     時は、 *note sys.stdout: cd1. に出力されます。

これらのメソッドの、表示する代わりにシンプルに文字列を返すバージョンもあ
ります:

 -- メソッド: ArgumentParser.format_usage ()

     *note ArgumentParser: 1bf. がコマンドラインからどう実行されるべきか
     の短い説明を格納した文字列を返します。

 -- メソッド: ArgumentParser.format_help ()

     プログラムの使用法と *note ArgumentParser: 1bf. に登録された引数に
     ついての情報を含むヘルプメッセージを格納した文字列を返します。


File: python.info,  Node: 部分解析,  Next: ファイル解析のカスタマイズ,  Prev: ヘルプの表示,  Up: その他のユーティリティ

5.18.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
     ‘parse_known_args()’ method can be useful.

     This method works similarly to *note parse_args(): 340f, 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 先頭文字でのマッチング: fc3. ルールは *note
     parse_known_args(): 3457. にも適用されます。たとえ既知のオプション
     の先頭文字に過ぎない場合でも、パーサは引数リストに残さずに、オプシ
     ョンを受け取る場合があります。


File: python.info,  Node: ファイル解析のカスタマイズ,  Next: 終了メソッド,  Prev: 部分解析,  Up: その他のユーティリティ

5.18.1.46 ファイル解析のカスタマイズ
....................................

 -- メソッド: ArgumentParser.convert_arg_line_to_args (arg_line)

     ファイルから引数を読み込む場合 (*note ArgumentParser: 1bf. コンスト
     ラクターの 'fromfile_prefix_chars' キーワード引数を参照)、1行につき
     1つの引数を読み込みます。 *note convert_arg_line_to_args(): 3427. を
     変更することでこの動作をカスタマイズできます。

     このメソッドは、引数ファイルから読まれた文字列である1つの引数
     'arg_line' を受け取ります。そしてその文字列を解析した結果の引数のリ
     ストを返します。このメソッドはファイルから1行読みこむごとに、順番に
     呼ばれます。

     このメソッドをオーバーライドすると便利なこととして、スペースで区切
     られた行の単語1つ1つを別々の引数として扱えます。次の例でその方法を
     示します:

          class MyArgumentParser(argparse.ArgumentParser):
              def convert_arg_line_to_args(self, arg_line):
                  return arg_line.split()

     Note that with this override an argument can no longer contain
     spaces, since each space-separated word becomes a separate
     argument.


File: python.info,  Node: 終了メソッド,  Next: 混在した引数の解析,  Prev: ファイル解析のカスタマイズ,  Up: その他のユーティリティ

5.18.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:
     b37. 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: b37. and terminates the program with a status
     code of 2.


File: python.info,  Node: 混在した引数の解析,  Next: Registering custom types or actions,  Prev: 終了メソッド,  Up: その他のユーティリティ

5.18.1.48 混在した引数の解析
............................

 -- メソッド: ArgumentParser.parse_intermixed_args (args=None,
          namespace=None)

 -- メソッド: ArgumentParser.parse_known_intermixed_args (args=None,
          namespace=None)

     多くの Unix コマンドは、オプション引数と位置引数を混在させることを
     許しています。 *note parse_intermixed_args(): cfb. と *note
     parse_known_intermixed_args(): 345d. メソッドは、このような方法での
     解析をサポートしています。

     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(): 3457. と *note
     parse_intermixed_args(): cfb. の違いを表しています: 前者は ‘['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(): 345d. は、解析した内容を含む名
     前空間と、残りの引数を含んだリストの、2つの要素を持つタプルを返しま
     す。 *note parse_intermixed_args(): cfb. は、解析されない引数が残さ
     れた場合にはエラーを送出します。

     Added in version 3.7.


File: python.info,  Node: Registering custom types or actions,  Prev: 混在した引数の解析,  Up: その他のユーティリティ

5.18.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.18.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.18.1.51 Argparse チュートリアル
.................................


author: Tshepang Mbambo

このチュートリアルでは、*note argparse: 7. を丁寧に説明します。
‘argparse’ は、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.18.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.18.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.18.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(): 340f. メソッドは指定されたオプションを、この場
     合は ‘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. は与えられ
たオプションを文字列として扱います。 ‘argparse’ にオプションの値を整数と
して扱うように伝えましょう:

     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.18.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:
     182. 文による真偽テストに失敗した理由です。

   * ヘルプメッセージが少し変わりました。

   * ‘--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.18.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.18.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: 199. 例外となる）ことを思い出してください。

こうなりました:

     $ python prog.py 4
     16

ここまで学んできたことだけで、さまざまな事が実現できます。しかしまだ表面
をなぞっただけです。 *note argparse: 7. モジュールはとても強力ですので、
チュートリアルを終える前にもう少しだけ探検してみましょう.


File: python.info,  Node: もうちょっとだけ学ぶ,  Next: argparse の出力を翻訳するには,  Prev: 位置引数とOptional引数の併用,  Up: Argparse チュートリアル

5.18.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.18.1.59 多義性のある引数の指定
................................

ある引数の解釈について、位置引数なのか、ある引数に対する追加の引数なのか
、あいまいさがあるときは、 ‘--’ を使うことで *note parse_args(): 340f. に
対してこれ以降は位置引数であることを伝えることができます:

     >>> 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.18.1.60 競合するオプション
............................

これまでのところ、 *note argparse.ArgumentParser: 1bf. インスタンスの2つ
のメソッドについて学んできました。ここで3つめのメソッドとして *note
add_mutually_exclusive_group(): 2ef. を導入しましょう。このメソッドは互
いに対立する引数の指定を可能にします。また、新しい機能として理解しやすい
ように、プログラムの残りの部分を変更しましょう: 以下では ‘--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.18.1.61 argparse の出力を翻訳するには
.......................................

ヘルプテキストやエラーメッセージなどの *note argparse: 7. モジュールの出
力は、すべて *note gettext: 67. モジュールを使って訳せるように作られてい
ます。これにより、 ‘argparse’ によって生成されたメッセージを簡単にローカ
ライズできます。 *note プログラムやモジュールを国際化する: 346d. も参照
してください。

たとえば、この *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.18.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: 3410.
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.18.1.63 結び
..............

*note argparse: 7. モジュールはここで学んだことより多くの機能を提供しま
す。モジュールのドキュメントはとても詳細で、綿密で、そしてたくさんの例が
あります。このチュートリアルの体験したことで、気がめいることなくそれらの
他の機能を会得できるに違いありません。


File: python.info,  Node: Migrating optparse code to argparse,  Prev: Argparse チュートリアル,  Up: 例外<11>

5.18.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: 340d,
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(): 3474. の呼び出し
     を、*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(): 3475. を、
     *note parse_args(): 340f. ではなく *note parse_intermixed_args():
     cfb. で置き換える。

   * コールバック・アクションと ‘callback_*’ キーワード引数を ‘type’ や
     ‘action’ 引数に置き換える。

   * ‘type’ キーワード引数に渡していた文字列の名前を、それに応じたオブジ
     ェクト (例: int, float, complex, ...)  に置き換える。

   * *note optparse.Values: 3476. を *note Namespace: 3410. に置き換え、
     *note optparse.OptionError: 3477. と *note
     optparse.OptionValueError: 3478. を *note ArgumentError: 3460. に置
     き換える。

   * ‘%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.18.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.18.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.18.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: 16eb, 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(): 16ec. based on
user-supplied command-line values.  When ‘parse_args()’ 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.18.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.18.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.18.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.18.2.6 位置引数とは何か
.........................

位置引数とは、プログラムを動作させる上で絶対的に必要な情報となる引数です
。

よいユーザインターフェースとは、絶対に必要だとされるものが可能な限り少な
いものです。プログラムを正しく動作させるために 17 個もの別個の情報が必要
だとしたら、その '方法' はさして問題にはなりません --ユーザはプログラム
を正しく動作させられないうちに諦め、立ち去ってしまうからです。ユーザイン
ターフェースがコマンドラインでも、設定ファイルでも、GUI やその他の何であ
っても同じです: 多くの要求をユーザに押し付ければ、ほとんどのユーザはただ
音をあげてしまうだけなのです。

要するに、ユーザが絶対に提供しなければならない情報だけに制限する -- そし
て可能な限りよく練られたデフォルト設定を使うよう試みてください。もちろん
、プログラムには適度な柔軟性を持たせたいとも望むはずですが、それこそがオ
プションの果たす役割です。繰り返しますが、設定ファイルのエントリであろう
が、GUI でできた「環境設定」ダイアログ上のウィジェットであろうが、コマン
ドラインオプションであろうが関係ありません -- より多くのオプションを実装
すればプログラムはより柔軟性を持ちますが、実装はより難解になるのです。高
すぎる柔軟性はユーザを閉口させ、コードの維持をより難しくするのです。


File: python.info,  Node: チュートリアル<2>,  Next: リファレンスガイド,  Prev: 背景,  Up: optparse --- Parser for command line options

5.18.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: 16eb. クラスを import しておかなければなりませ
ん。次に、プログラムの冒頭で ‘OptionParser’ インスタンスを生成しておきま
す:

     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(): 3474. 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(): 16ec. に自作の引数リストを渡してもかま
いません。とはいえ、実際にはそうした必要はほとんどないでしょう:
‘optionparser’ はデフォルトで ‘sys.argv[1:]’ を使うからです。)

*note parse_args(): 16ec. は二つの値を返します:

   * 全てのオプションに対する値の入ったオブジェクト ‘options’ -- 例えば
     、‘--file’ が単一の文字列引数をとる場合、‘options.file’ はユーザが
     指定したファイル名になります。オプションを指定しなかった場合には
     ‘None’ になります

   * オプションの解析後に残った位置引数からなるリスト ‘args’

このチュートリアルの節では、最も重要な四つのオプション属性: *note
action: 3488, *note type: 3489, *note dest: 348a. (destination), *note
help: 348b. についてしか触れません。このうち最も重要なのは ‘action’ です
。

* Menu:

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


File: python.info,  Node: オプション・アクションを理解する,  Next: store アクション,  Up: チュートリアル<2>

5.18.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: 348e.  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.18.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(): 16ec, ‘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: 348e.


File: python.info,  Node: ブール値 フラグ オプションの処理,  Next: その他のアクション,  Prev: store アクション,  Up: チュートリアル<2>

5.18.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.18.2.11 その他のアクション
............................

Some other actions supported by ‘optparse’ are:

‘"store_const"’

     store a constant value, pre-set via *note Option.const: 3495.

‘"append"’

     オプションの引数を指定のリストに追加します

‘"count"’

     指定のカウンタを 1 増やします

‘"callback"’

     指定の関数を呼び出します

これらのアクションについては、 *note リファレンスガイド: 3496. 節および
*note オプション処理コールバック: 3497. 節で触れます。


File: python.info,  Node: デフォルト値,  Next: ヘルプの生成,  Prev: その他のアクション,  Up: チュートリアル<2>

5.18.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: 16eb. の
‘set_defaults()’ メソッドを使います。このメソッドは *note parse_args():
16ec. を呼び出す前ならいつでも使えます:

     parser.set_defaults(verbose=True)
     parser.add_option(...)
     (options, args) = parser.parse_args()

前の例と同様、あるオプションの値の保存先に対するデフォルトの値は最後に指
定した値になります。コードを読みやすくするため、デフォルト値を設定すると
きには両方のやり方を混ぜるのではなく、片方だけを使うようにしましょう。


File: python.info,  Node: ヘルプの生成,  Next: バージョン番号の出力,  Prev: デフォルト値,  Up: チュートリアル<2>

5.18.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: 348b. 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(): 16a. 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.18.2.14 オプションをグループ化する
....................................

たくさんのオプションを扱う場合、オプションをグループ分けするとヘルプ出力
が見やすくなります。 *note OptionParser: 16eb. は、複数のオプションをま
とめたオプショングループを複数持つことができます。

オプションのグループは、 *note OptionGroup: 349d. を使って作成します:

 -- クラス: optparse.OptionGroup (parser, title, description=None)

     ここでは:

        * 'parser' は、このグループが属する *note OptionParser: 16eb. の
          インスタンスです

        * 'title' はグループのタイトルです

        * 'description' はオプションで、グループの長い説明です

*note OptionGroup: 349d. は (*note OptionParser: 16eb. のように)
‘OptionContainer’ を継承していて、オプションをグループに追加するために
‘add_option()’ メソッドを利用できます。

全てのオプションを定義したら、 *note OptionParser: 16eb. の
‘add_option_group()’ メソッドを使ってグループを定義済みのパーサーに追加
します。

前のセクションで定義したパーサーに、続けて *note OptionGroup: 349d. を追
加します:

     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: 349d. を返しま
     す。そのような ‘OptionGroup’ が無い場合は、 ‘None’ を返します。


File: python.info,  Node: バージョン番号の出力,  Next: How optparse handles errors,  Prev: ヘルプの生成,  Up: チュートリアル<2>

5.18.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(): 34a2. と同じく、
     ‘self.version’ の中の全ての ‘%prog’ が現在のプログラム名に置き換え
     られます。 ‘self.version’ が空文字列だだったり未定義だったときは何
     もしません。

 -- メソッド: OptionParser.get_version ()

     *note print_version(): 34a1. と同じですが、バージョン文字列を表示す
     る代わりに返します。


File: python.info,  Node: How optparse handles errors,  Next: 全てをつなぎ合わせる,  Prev: バージョン番号の出力,  Up: チュートリアル<2>

5.18.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(): 3474, 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: 3477. or *note TypeError: 199.) 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.18.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.18.2.18 リファレンスガイド
............................

* Menu:

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


File: python.info,  Node: parserを作る,  Next: パーザへのオプション追加,  Up: リファレンスガイド

5.18.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(): 3474. を使って追加してください
          。

     ‘option_class’ (デフォルト: optparse.Option)

          *note add_option(): 3474. でパーザにオプションを追加するときに
          使用されるクラス。

     ‘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 オプション間の衝突: 34ab.
          節を参照して下さい。

     ‘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.18.2.20 パーザへのオプション追加
..................................

パーザにオプションを加えていくにはいくつか方法があります。推奨するのは
*note チュートリアル: 3486. 節で示したような *note
OptionParser.add_option(): 3474. を使う方法です。 ‘add_option()’ は以下
の二つのうちいずれかの方法で呼び出せます:

   * (‘make_option()’ などが返す) *note Option: 34ae. インスタンスを渡し
     ます

   * ‘make_option()’ に (すなわち *note Option: 34ae. のコンストラクタに
     ) 位置引数とキーワード引数の組み合わせを渡して、 ‘Option’ インスタ
     ンスを生成させます

もう一つの方法は、あらかじめ作成しておいた *note Option: 34ae. インスタ
ンスからなるリストを、以下のようにして *note OptionParser: 16eb. のコン
ストラクタに渡すというものです:

     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.18.2.21 オプションの定義
..........................

各々の *note Option: 34ae. インスタンス、は ‘-f’ や ‘--file’ といった同
義のコマンドラインオプションからなる集合を表現しています。一つの
‘Option’ には任意の数のオプションを短い形式でも長い形式でも指定できます
。ただし、少なくとも一つは指定しなければなりません。

正しい方法で *note Option: 34ae. インスタンスを生成するには、 *note
OptionParser: 16eb. の ‘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: 3488, 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: 3477. 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: 3495.

     ‘"store_true"’

          store ‘True’

     ‘"store_false"’

          store ‘False’

     ‘"append"’

          オプションの引数を指定のリストに追加します

     ‘"append_const"’

          append a constant value to a list, pre-set via *note
          Option.const: 3495.

     ‘"count"’

          指定のカウンタを 1 増やします

     ‘"callback"’

          指定の関数を呼び出します

     ‘"help"’

          全てのオプションとそのドキュメントの入った使用法メッセージを出
          力します

     (アクションを指定しない場合、デフォルトは ‘"store"’ になります。こ
     のアクションでは、 *note type: 3489. および *note dest: 348a. オプ
     ション属性を指定できます。 *note 標準的なオプション・アクション:
     34b1. を参照してください。)

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: 3476.

 -- クラス: optparse.Values

     An object holding parsed argument names and values as attributes.
     Normally created by calling when calling *note
     OptionParser.parse_args(): 16ec, and can be overridden by a custom
     subclass passed to the 'values' argument of
     ‘OptionParser.parse_args()’ (as described in *note 引数を解析する:
     34b2.).

Option arguments (and various other values) are stored as attributes of
this object, according to the *note dest: 348a. (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: 3489. および *note dest: 348a. オプション属性は *note
action: 3488. と同じくらい重要ですが、 '全ての' オプションで意味をなすの
は ‘action’ だけなのです。


File: python.info,  Node: オプション属性,  Next: 標準的なオプション・アクション,  Prev: オプションの定義,  Up: リファレンスガイド

5.18.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(): 3474. rather than directly, and can be
     overridden by a custom class via the 'option_class' argument to
     *note OptionParser: 16eb.

The following option attributes may be passed as keyword arguments to
*note OptionParser.add_option(): 3474.  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: 3477.

 -- の属性: Option.action

     (デフォルト: ‘"store"’)

     Determines ‘optparse’'s behaviour when this option is seen on the
     command line; the available options are documented *note here:
     34b1.

 -- の属性: Option.type

     (デフォルト: ‘"string"’)

     このオプションに与えられる引数の型 (たとえば ‘"string"’ や ‘"int"’)
     です。取りうるオプションについては *note こちら: 34b5. を参照してく
     ださい。

 -- の属性: Option.dest

     (デフォルト: オプション文字列を使う)

     If the option's action implies writing or modifying a value
     somewhere, this tells ‘optparse’ where to write it: ‘dest’ names an
     attribute of the ‘options’ object that ‘optparse’ builds as it
     parses the command line.

 -- の属性: Option.default

     コマンドラインに指定がなかったときにこのオプションの対象に使われる
     値です。 *note OptionParser.set_defaults(): 34b7. も参照してくださ
     い。

 -- の属性: Option.nargs

     (デフォルト: 1)

     How many arguments of type *note type: 3489. should be consumed
     when this option is seen.  If > 1, ‘optparse’ will store a tuple of
     values to *note dest: 348a.

 -- の属性: Option.const

     定数を格納する動作のための、その定数です。

 -- の属性: Option.choices

     ‘"choice"’ 型オプションに対してユーザが選べる選択肢となる文字列のリ
     ストです。

 -- の属性: Option.callback

     アクションが ‘"callback"’ であるオプションに対し、このオプションが
     あったときに呼ばれる呼び出し可能オブジェクトです。呼び出し時に渡さ
     れる引数の詳細については、 *note オプション処理コールバック: 3497.
     を参照してください。

 -- の属性: Option.callback_args
 -- の属性: Option.callback_kwargs

     ‘callback’ に渡される標準的な4つのコールバック引数の後ろに追加する
     、位置引数とキーワード引数。

 -- の属性: Option.help

     ユーザが *note help: 348b. オプション(‘--help’ のような)を指定した
     ときに表示される、使用可能な全オプションのリストの中のこのオプショ
     ンに関する説明文です。説明文を提供しておかなければ、オプションは説
     明文なしで表示されます。オプションを隠すには特殊な値
     ‘optparse.SUPPRESS_HELP’ を使います。

 -- の属性: Option.metavar

     (デフォルト: オプション文字列を使う)

     説明文を表示する際にオプションの引数の身代わりになるものです。例は
     *note チュートリアル: 3486. 節を参照してください。


File: python.info,  Node: 標準的なオプション・アクション,  Next: 標準のオプション型,  Prev: オプション属性,  Up: リファレンスガイド

5.18.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: 3489, *note dest: 348a, *note nargs:
     34b8, *note choices: 34b9.]

     オプションの後には必ず引数が続きます。引数は *note type: 3489. に従
     って値に変換されて *note dest: 348a. に保存されます。 *note nargs:
     34b8. > 1 の場合、複数の引数をコマンドラインから取り出します。引数
     は全て ‘type’ に従って変換され、 ‘dest’ にタプルとして保存されます
     。 *note 標準のオプション型: 34b5. 節を参照してください。

     *note choices: 34b9. を(文字列のリストかタプルで) 指定した場合、型
     のデフォルト値は ‘"choice"’ になります。

     *note type: 3489. を指定しない場合、デフォルトの値は ‘"string"’ で
     す。

     If *note dest: 348a. 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: 3495.; 関連: *note dest: 348a.]

     値 *note const: 3495. を *note dest: 348a. に保存します。

     以下はプログラム例です:

          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: 348a.]

     A special case of ‘"store_const"’ that stores ‘True’ to *note dest:
     348a.

   * ‘"store_false"’ [関連: *note dest: 348a.]

     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: 3489, *note dest: 348a, *note nargs:
     34b8, *note choices: 34b9.]

     The option must be followed by an argument, which is appended to
     the list in *note dest: 348a.  If no default value for ‘dest’ is
     supplied, an empty list is automatically created when ‘optparse’
     first encounters this option on the command-line.  If *note nargs:
     34b8. > 1, multiple arguments are consumed, and a tuple of length
     ‘nargs’ is appended to ‘dest’.

     *note type: 3489. および *note dest: 348a. のデフォルト値は
     ‘"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: 3495.; 関連: *note dest:
     348a.]

     ‘"store_const"’ と同様ですが、 *note const: 3495. の値は *note
     dest: 348a. に追加(append)されます。 ‘"append"’ の場合と同じように
     ‘dest’ のデフォルトは ‘None’ ですがこのオプションを最初にみつけた時
     点で空のリストを自動的に生成します。

   * ‘"count"’ [関連: *note dest: 348a.]

     *note dest: 348a. に保存されている整数値をインクリメントします。
     ‘dest’ は (デフォルトの値を指定しない限り) 最初にインクリメントを行
     う前にゼロに設定されます。

     以下はプログラム例です:

          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: 34ba.; 関連: *note type: 3489,
     *note nargs: 34b8, *note callback_args: 34bb, *note
     callback_kwargs: 34bc.]

     *note callback: 34ba. に指定された関数を次のように呼び出します

          func(option, opt_str, value, parser, *args, **kwargs)

     詳細は、 *note オプション処理コールバック: 3497. 節を参照してくださ
     い。

   * ‘"help"’

     現在のオプションパーザ内の全てのオプションに対する完全なヘルプメッ
     セージを出力します。ヘルプメッセージは *note OptionParser: 16eb. の
     コンストラクタに渡した ‘usage’ 文字列と、各オプションに渡した *note
     help: 348b. 文字列から生成します。

     オプションに *note help: 348b. 文字列が指定されていなくても、オプシ
     ョンはヘルプメッセージ中に列挙されます。オプションを完全に表示させ
     ないようにするには、特殊な値 ‘optparse.SUPPRESS_HELP’ を使ってくだ
     さい。

     ‘optparse’ automatically adds a *note help: 348b. 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: 348b. options, you will rarely
     create ‘version’ options, since ‘optparse’ automatically adds them
     when needed.


File: python.info,  Node: 標準のオプション型,  Next: 引数を解析する,  Prev: 標準的なオプション・アクション,  Up: リファレンスガイド

5.18.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: 348e.

文字列オプションの引数はチェックや変換を一切受けません: コマンドライン上
のテキストは保存先にそのまま保存されます (またはコールバックに渡されます
)。

整数引数 (‘"int"’ 型) は次のように解析されます:

   * 数が ‘0x’ から始まるならば、16進数として読み取られます

   * 数が ‘0’ から始まるならば、8進数として読み取られます

   * 数が ‘0b’ から始まるならば、2進数として読み取られます

   * それ以外の場合、数は10進数として読み取られます

The conversion is done by calling *note int(): 19c. 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(): 197.
や *note complex(): 198. で変換されます。エラーは同様の扱いです。

‘"choice"’ オプションは ‘"string"’ オプションのサブタイプです。 *note
choices: 34b9. オプションの属性 (文字列からなるシーケンス) には、利用で
きるオプション引数のセットを指定します。 ‘optparse.check_choice()’ はユ
ーザの指定したオプション引数とマスタリストを比較して、無効な文字列が指定
された場合には *note OptionValueError: 3478. を送出します。


File: python.info,  Node: 引数を解析する,  Next: オプション解析器への問い合わせと操作,  Prev: 標準のオプション型,  Up: リファレンスガイド

5.18.2.25 引数を解析する
........................

OptionParser を作成してオプションを追加していく上で大事なポイントは、
*note parse_args(): 16ec. メソッドの呼び出しです。

 -- メソッド: 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: 3476. のオブジェクト (デ
          フォルト: 新しい ‘Values’ のインスタンス) - 既存のオブジェクト
          を指定した場合、オプションのデフォルトは初期化されません

     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(): 261d. の呼び出し (大
雑把に言うと保存される各オプション引数につき一回ずつ) で更新されていき、
*note parse_args(): 16ec. で返されます。

*note parse_args(): 16ec. が引数リストでエラーに遭遇した場合、
OptionParser の ‘error()’ メソッドを適切なエンドユーザ向けのエラーメッセ
ージとともに呼び出します。この呼び出しにより、最終的に終了ステータス 2
(伝統的な Unix におけるコマンドラインエラーの終了ステータス) でプロセス
を終了させることになります。


File: python.info,  Node: オプション解析器への問い合わせと操作,  Next: オプション間の衝突,  Prev: 引数を解析する,  Up: リファレンスガイド

5.18.2.26 オプション解析器への問い合わせと操作
..............................................

オプションパーザのデフォルトの振る舞いは、ある程度カスタマイズすることが
できます。また、オプションパーザの中を調べることもできます。*note
OptionParser: 16eb. は幾つかのヘルパーメソッドを提供しています:

 -- メソッド: 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():
     3475. メソッドを呼び出してください。古典的な Unix システムのように
     、最初のオプションでない引数を見つけたときにオプションの解析を止め
     るようになります。

     別のコマンドを実行するコマンドをプロセッサを作成する際、別のコマン
     ドのオプションと自身のオプションが混ざるのを防ぐために利用すること
     ができます。例えば、各コマンドがそれぞれ異なるオプションのセットを
     持つ場合などに有効です。

 -- メソッド: OptionParser.enable_interspersed_args ()

     オプションで無い最初の引数を見つけてもパースを止めないように設定し
     ます。オプションとコマンド引数の順序が混ざっても良いようになります
     。これはデフォルトの動作です。

 -- メソッド: OptionParser.get_option (opt_str)

     オプション文字列 'opt_str' に対する *note Option: 34ae. インスタン
     スを返します。該当するオプションがなければ ‘None’ を返します。

 -- メソッド: OptionParser.has_option (opt_str)

     *note OptionParser: 16eb. に(‘-q’ や ‘--verbose’ のような) オプショ
     ン 'opt_str' がある場合、‘True’ を返します。

 -- メソッド: OptionParser.remove_option (opt_str)

     *note OptionParser: 16eb. に 'opt_str' に対応するオプションがある場
     合、そのオプションを削除します。該当するオプションに他のオプション
     文字列が指定されていた場合、それらのオプション文字列は全て無効にな
     ります。 'opt_str' がこの ‘OptionParser’ オブジェクトのどのオプショ
     ンにも属さない場合、 *note ValueError: 2ee. を送出します。


File: python.info,  Node: オプション間の衝突,  Next: クリーンアップ,  Prev: オプション解析器への問い合わせと操作,  Up: リファレンスガイド

5.18.2.27 オプション間の衝突
............................

注意が足りないと、衝突するオプションを定義してしまうことがあります:

     parser.add_option("-n", "--dry-run", ...)
     ...
     parser.add_option("-n", "--noisy", ...)

(とりわけ、*note OptionParser: 16eb. から標準的なオプションを備えた自前
のサブクラスを定義してしまった場合にはよく起きます。)

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: 34c8. を送出します

     ‘"resolve"’

          オプション間の衝突をインテリジェントに解決します (下記参照)

一例として、衝突をインテリジェントに解決する *note OptionParser: 16eb. を
定義し、衝突を起こすようなオプションを追加してみましょう:

     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.18.2.28 クリーンアップ
........................

OptionParser インスタンスはいくつかの循環参照を抱えています。このことは
Python のガーベジコレクタにとって問題になるわけではありませんが、使い終
わった OptionParser に対して ‘destroy()’ を呼び出すことでこの循環参照を
意図的に断ち切るという方法を選ぶこともできます。この方法は特に長時間実行
するアプリケーションで OptionParser から大きなオブジェクトグラフが到達可
能になっているような場合に有用です。


File: python.info,  Node: その他のメソッド,  Prev: クリーンアップ,  Up: リファレンスガイド

5.18.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(): 34a2. と同じですが、使用法メッセージを表示する
     代わりに文字列として返します。

 -- メソッド: OptionParser.set_defaults (dest=value, ...)

     幾つかの保存先に対してデフォルト値をまとめてセットします。 *note
     set_defaults(): 34b7. を使うのは複数のオプションにデフォルト値をセ
     ットする好ましいやり方です。複数のオプションが同じ保存先を共有する
     ことがあり得るからです。たとえば幾つかの "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(): 34b7. を使います:

          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.18.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.18.2.31 callbackオプションの定義
..................................

callback オプションを最も簡単に定義するには、 *note
OptionParser.add_option(): 3474. メソッドを使います。 *note action:
3488. の他に指定しなければならない属性は ‘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: 34bb. and *note callback_kwargs: 34bc.  Thus, the minimal
callback function signature is:

     def my_callback(option, opt, value, parser):

コールバックの四つの引数については後で説明します。

callback オプションを定義する場合には、他にもいくつかオプション属性を指
定できます:

*note type: 3489.

     has its usual meaning: as with the ‘"store"’ or ‘"append"’ actions,
     it instructs ‘optparse’ to consume one argument and convert it to
     *note type: 3489.  Rather than storing the converted value(s)
     anywhere, though, ‘optparse’ passes it to your callback function.

*note nargs: 34b8.

     also has its usual meaning: if it is supplied and > 1, ‘optparse’
     will consume *note nargs: 34b8. arguments, each of which must be
     convertible to *note type: 3489.  It then passes a tuple of
     converted values to your callback.

*note callback_args: 34bb.

     その他の位置引数からなるタプルで、コールバックに渡されます

*note callback_kwargs: 34bc.

     その他のキーワード引数からなる辞書で、コールバックに渡されます


File: python.info,  Node: コールバック関数はどのように呼び出されるか,  Next: コールバック中で例外を送出する,  Prev: callbackオプションの定義,  Up: オプション処理コールバック

5.18.2.32 コールバック関数はどのように呼び出されるか
....................................................

コールバックは全て以下の形式で呼び出されます:

     func(option, opt_str, value, parser, *args, **kwargs)

ここでは:

‘option’

     コールバックを呼び出している *note Option: 34ae. のインスタンスです

‘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: 3489. is
     set; the type of ‘value’ will be the type implied by the option's
     type.  If ‘type’ for this option is ‘None’ (no argument expected),
     then ‘value’ will be ‘None’.  If *note nargs: 34b8. > 1, ‘value’
     will be a tuple of values of the appropriate type.

‘parser’

     現在のオプション解析の全てを駆動している *note OptionParser: 16eb.
     インスタンスです。この変数が有用なのは、この値を介してインスタンス
     属性としていくつかの興味深いデータにアクセスできるからです:

     ‘parser.largs’

          現在放置されている引数、すなわち、すでに消費されたものの、オプ
          ションでもオプション引数でもない引数からなるリストです。
          ‘parser.largs’ は自由に変更でき、たとえば引数を追加したりでき
          ます (このリストは ‘args’ 、すなわち *note parse_args(): 16ec.
          の二つ目の戻り値になります)

     ‘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: 34bb. オプション属性で与えられた任意の位置引数
     からなるタプルです。

‘kwargs’

     *note callback_kwargs: 34bc. オプション属性で与えられた任意のキーワ
     ード引数からなるタプルです。


File: python.info,  Node: コールバック中で例外を送出する,  Next: コールバックの例 1 ありふれたコールバック,  Prev: コールバック関数はどのように呼び出されるか,  Up: オプション処理コールバック

5.18.2.33 コールバック中で例外を送出する
........................................

The callback function should raise *note OptionValueError: 3478. 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.18.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.18.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.18.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.18.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.18.2.38 コールバックの例5: 固定引数
.....................................

決まった数の引数をとるようなコールパックオプションを定義するなら、問題は
やや興味深くなってきます。引数をとるようコールバックに指定するのは、
‘"store"’ や ‘"append"’ オプションの定義に似ています。 *note type: 3489.
を定義していれば、そのオプションは引数を受け取ったときに該当する型に変換
できなければなりません。さらに *note nargs: 34b8. を指定すれば、オプショ
ンは ‘nargs’ 個の引数を受け取ります。

標準の ‘"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.18.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.18.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.18.2.41 新しい型の追加
........................

To add new types, you need to define your own subclass of ‘optparse’'s
*note Option: 34ae. class.  This class has a couple of attributes that
define ‘optparse’'s types: *note TYPES: 34e5. and *note TYPE_CHECKER:
34e6.

 -- の属性: Option.TYPES

     *note TYPES: 34e5. は型名のタプルです。新しく作るサブクラスでは、タ
     プル ‘TYPES’ を単純に標準のものを利用して新しく定義すると良いでしょ
     う。

 -- の属性: Option.TYPE_CHECKER

     ‘TYPE_CHECKER’ は辞書で型名を型チェック関数に対応付けるものです。型
     チェック関数は以下のようなシグネチャを持ちます:

          def check_mytype(option, opt, value)

     ここで ‘option’ は *note Option: 34ae. のインスタンスであり、 ‘opt’
     はオプション文字列(たとえば ‘-f’)で、 ‘value’ は望みの型としてチェ
     ックされ変換されるべくコマンドラインで与えられる文字列です。
     ‘check_mytype()’ は想定されている型 ‘mytype’ のオブジェクトを返さな
     ければなりません。型チェック関数から返される値は *note
     OptionParser.parse_args(): 16ec. で返されるOptionValues インスタン
     スに収められるか、またはコールバックに ‘value’ パラメータとして渡さ
     れます。

     型チェック関数は何か問題に遭遇したら *note OptionValueError: 3478.
     を送出しなければなりません。 ‘OptionValueError’ は文字列一つを引数
     に取り、それはそのまま *note OptionParser: 16eb. の ‘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: 34e6. クラス属性の中で) 参
照されることになります:

     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:
34e6, we would end up modifying the ‘TYPE_CHECKER’ 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.18.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: 348a. attribute to be supplied to the Option constructor.

"typed" アクション

     コマンドラインから引数を受け取り、それがある型であることが期待され
     ているアクションです。もう少しはっきり言えば、その型に変換される文
     字列を受け取るものです。この種類のオプションは Option のコンストラ
     クタに *note type: 3489. 属性を与えることが要求されます。

この分類には重複する部分があります。デフォルトの "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: 34ec.

実際に新しいアクションを実装するには、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: 34ea. と *note
     TYPED_ACTIONS: 34eb. の両方に入ります。

   * to ensure that ‘optparse’ assigns the default type of ‘"string"’ to
     ‘"extend"’ actions, we put the ‘"extend"’ action in *note
     ALWAYS_TYPED_ACTIONS: 34ec. 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(): dce. です
     。次のように呼び出します

          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.18.2.43 例外
..............

 -- 例外: optparse.OptionError

     Raised if an *note Option: 34ae. instance is created with invalid
     or inconsistent arguments.

 -- 例外: optparse.OptionConflictError

     Raised if conflicting options are added to an *note OptionParser:
     16eb.

 -- 例外: 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.18.3 ‘getpass’ -- 可搬性のあるパスワード入力機構
--------------------------------------------------

'ソースコード:' Lib/getpass.py(1)

__________________________________________________________________

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

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: 34f3. 警告を発生させます。

          注釈: 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: 276a. のサブクラスで、入力がエコーされてしまった
     場合に発生します。

 -- の関数: getpass.getuser ()

     ユーザーの "ログイン名"を返します。

     この関数は環境変数 ‘LOGNAME’ ‘USER’ ‘LNAME’ ‘USERNAME’ の順序でチェ
     ックして、最初の空ではない文字列が設定された値を返します。もし、な
     にも設定されていない場合は *note pwd: b7. モジュールが提供するシス
     テム上のパスワードデータベースから返します。それ以外の場合は、
     *note OSError: 2c2. が送出されます。

     In general, this function should be preferred over *note
     os.getlogin(): 1888.

     バージョン 3.13 で変更: 以前は *note OSError: 2c2. だけでなく、様々
     な例外が送出されていました。

   ---------- 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.18.4 ‘fileinput’ -- 複数の入力ストリームをまたいだ行を反復する
----------------------------------------------------------------

'ソースコード:' Lib/fileinput.py(1)

__________________________________________________________________

このモジュールは標準入力やファイルの並びにまたがるループを素早く書くため
のヘルパークラスと関数を提供しています。単一のファイルを読み書きしたいだ
けなら、 *note open(): 318. を参照してください。

典型的な使い方は以下の通りです:

     import fileinput
     for line in fileinput.input(encoding="utf-8"):
         process(line)

このスクリプトは ‘sys.argv[1:]’ に列挙されている全てのファイルの行に渡っ
て反復処理を行います。もし列挙されているものがなければ、 ‘sys.stdin’ が
デフォルトとして扱われます。 ファイル名として ‘'-'’ が与えられた場合も、
‘sys.stdin’ に置き換えられ、 'mode' と 'openhook' は無視されます。 別の
ファイル名リストを使いたい時には、そのリストを *note input(): a04. の最
初の引数に与えます。 ファイル名が 1 つでも受け付けます。

全てのファイルはデフォルトでテキストモードでオープンされます。しかし、
*note input(): a04. や *note FileInput: 944. をコールする際に 'mode' パ
ラメータを指定すれば、これをオーバーライドすることができます。オープン中
あるいは読み込み中にI/Oエラーが発生した場合には、 *note OSError: 2c2. が
発生します。

バージョン 3.3 で変更: 以前は *note IOError: 1262. が送出されました; そ
れは現在 *note OSError: 2c2. のエイリアスです。

‘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(): a04. or *note
FileInput(): 944.  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(): a05. to support compressed files.

以下の関数がこのモジュールの基本的なインターフェースです:

 -- の関数: fileinput.input (files=None, inplace=False, backup='', *,
          mode='r', openhook=None, encoding=None, errors=None)

     *note FileInput: 944. クラスのインスタンスを作ります。生成されたイ
     ンスタンスは、このモジュールの関数群が利用するグローバルな状態とし
     て利用されます。この関数への引数は ‘FileInput’ クラスのコンストラク
     タへ渡されます。

     *note FileInput: 944. のインスタンスは *note with: 187. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘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(): a04. 関数によって作られたグローバ
ルな状態を利用します。アクティブな状態が無い場合には、 *note
RuntimeError: 246. が発生します。

 -- の関数: 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: 944. クラスはモジュールの関数に対応するメソッド
     *note filename(): 34f7. 、 *note fileno(): 164c. 、 *note lineno():
     34f8. 、 *note filelineno(): 34f9. 、 *note isfirstline(): 34fa. 、
     *note isstdin(): 34fb. 、 *note nextfile(): 34fc. および *note
     close(): 34fd. を実装しています。*note イテラブル: 12f5. であること
     に加えて、次の入力行を返す *note readline(): 177c. メソッドがありま
     す。シーケンスはシーケンシャルに読み込むことしかできません。つまり
     ランダムアクセスと ‘readline()’ を混在させることはできません。

     'mode' を使用すると、 *note open(): 318. に渡すファイルモードを指定
     することができます。これは ‘'r'’ および ‘'rb'’ のうちのいずれかとな
     ります。

     'openhook' を指定する場合は、ふたつの引数 'filename' と 'mode' をと
     る関数でなければなりません。この関数の返り値は、オープンしたファイ
     ルオブジェクトとなります。'inplace' と 'openhook' を同時に使うこと
     はできません。

     You can specify 'encoding' and 'errors' that is passed to *note
     open(): 318. or 'openhook'.

     *note FileInput: 944. のインスタンスは *note with: 187. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘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(): a04. か *note FileInput: 944.
クラスのコンストラクタに渡された場合には、入力ファイルはバックアップファ
イルに移動され、標準出力が入力ファイルに設定されます(バックアップファイ
ルと同じ名前のファイルが既に存在していた場合には、警告無しに置き替えられ
ます)。これによって入力ファイルをその場で書き替えるフィルタを書くことが
できます。キーワード引数 '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(): 318. をコールする際に伸長を行いません)。

     The 'encoding' and 'errors' values are passed to *note
     io.TextIOWrapper: 9c2. 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(): 318. でオープンするフックを返します。指
     定した '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(): a04. and *note FileInput: 944. 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.18.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: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

This is an *note optional module: 21b4.  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
オプションのモジュールの要件: 21b2.

*note Availability: 2199.: 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 プログラミング: 3501.

     Andrew Kuchling および Eric Raymond によって書かれた、curses を
     Python で使うためのチュートリアルです。

* Menu:

* 関数: 関数<6>.
* Window objects::
* 定数: 定数<6>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/curses


File: python.info,  Node: 関数<6>,  Next: Window objects,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.1 関数
.............

The module ‘curses’ defines the following exception:

 -- 例外: curses.error

     curses ライブラリ関数がエラーを返した際に送出される例外です。

     注釈: 関数やメソッドにおけるオプションの引数 'x' および 'y' がある
     場合、デフォルト値は常に現在のカーソルになります。オプションの
     'attr' がある場合、デフォルト値は *note A_NORMAL: 3505. です。

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)’.

     This is an ncurses extension.

     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(): 350a. を呼び出し、次いで
     *note cbreak(): 3509. を呼び出すと、端末を cbreak モードにします。

 -- の関数: curses.color_content (color_number)

     Return the intensity of the red, green, and blue (RGB) components
     in the color 'color_number', which must be between ‘0’ and ‘COLORS
     - 1’.  Return a 3-tuple, containing the R,G,B values for the given
     color, which will be between ‘0’ (no component) and ‘1000’ (maximum
     amount of component).  Raise an exception if the color is not
     supported.

 -- の関数: 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: 350c, *note
     A_REVERSE: 350d, and the other ‘A_*’ attributes.  *note
     pair_number(): 350e. is the counterpart to this function.

 -- の関数: curses.curs_set (visibility)

     カーソルの状態を設定します。'visibility' は ‘0’ 、 ‘1``または ``2’
     に設定され、それぞれ不可視、通常、または非常に可視、を意味します。
     要求された可視属性を端末がサポートしている場合、以前のカーソル状態
     が返されます; そうでなければ例外が送出されます。多くの端末では、"可
     視 (通常)" モードは下線カーソルで、"非常に可視" モードはブロックカ
     ーソルです。

 -- の関数: curses.def_prog_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使う際のモードであ
     る "プログラム" モードとして保存します。(このモードの反対は、プログ
     ラムが curses を使わない "シェル" モードです。) その後 *note
     reset_prog_mode(): 3511. を呼ぶとこのモードを復旧します。

 -- の関数: curses.def_shell_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使っていないときの
     モードである "シェル" モードとして保存します。(このモードの反対は、
     プログラムが curses 機能を利用している "プログラム" モードです。) そ
     の後 *note reset_shell_mode(): 3513. を呼ぶとこのモードを復旧します
     。

 -- の関数: curses.delay_output (ms)

     出力に 'ms' ミリ秒の一時停止を入れます。

 -- の関数: curses.doupdate ()

     Update the physical screen.  The curses library keeps two data
     structures, one representing the current physical screen contents
     and a virtual screen representing the desired next state.  The
     *note doupdate(): 3515. function updates the physical screen to
     match the virtual screen.

     仮想スクリーンは *note addstr(): 3516. のような書き込み操作をウィン
     ドウに行った後に *note noutrefresh(): 3517. を呼び出して更新するこ
     とができます。通常の: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 ()

     The ‘filter()’ routine, if used, must be called before *note
     initscr(): 196f. is called.  The effect is that, during the
     initialization, ‘LINES’ is set to ‘1’; the capabilities ‘clear’,
     ‘cup’, ‘cud’, ‘cud1’, ‘cuu1’, ‘cuu’, ‘vpa’ are disabled; and the
     ‘home’ string is set to the value of ‘cr’.  The effect is that the
     cursor is confined to the current line, and so are screen updates.
     This may be used for enabling character-at-a-time line editing
     without touching the rest of the screen.

 -- の関数: curses.flash ()

     スクリーンを点滅します。すなわち、画面を色反転して、短時間でもとに
     もどします。人によっては、*note beep(): 3507. で生成される注意音よ
     りも、このような "目に見えるベル" を好みます。

 -- の関数: curses.flushinp ()

     すべての入力バッファをフラッシュします。この関数は、ユーザによって
     すでに入力されているが、まだプログラムによって処理されていないすべ
     ての先行入力文字を破棄します。

 -- の関数: curses.getmouse ()

     *note getch(): 188b. が *note KEY_MOUSE: 351f. を返してマウスイベン
     トを通知した後、この関数を呼んで待ち行列上に置かれているマウスイベ
     ントを取得しなければなりません。イベントは ‘(id, x, y, z, bstate)’
     の 5 要素のタプルで表現されています。'id' は複数のデバイスを区別す
     るための ID 値で、'x', 'y', 'z' はイベントの座標値です。(現在 'z' は
     使われていません) 'bstate' は整数値で、その各ビットはイベントのタイ
     プを示す値に設定されています。この値は以下に示す定数のうち一つまた
     はそれ以上のビット単位 OR になっています。以下の定数の 'n' は 1 か
     ら 5 のボタン番号を示します: *note BUTTONn_PRESSED: 3520, *note
     BUTTONn_RELEASED: 3521, *note BUTTONn_CLICKED: 3522, *note
     BUTTONn_DOUBLE_CLICKED: 3523, *note BUTTONn_TRIPLE_CLICKED: 3524,
     *note BUTTON_SHIFT: 3525, *note BUTTON_CTRL: 3526, *note
     BUTTON_ALT: 3527.。

     バージョン 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(): 352a. call.  The routine then creates and
     initializes a new window using that data, returning the new window
     object.  The 'file' argument must be a file object opened for
     reading in binary mode.

 -- の関数: 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 (for example,
     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(): 3530. を使います。

 -- の関数: curses.init_color (color_number, r, g, b)

     色の定義を変更します。変更したい色番号と、その後に 3 つ組みの RGB 値
     (赤、緑、青の成分の大きさ) をとります。'color_number' の値は ‘0’ か
     ら ‘COLORS - 1’ の間でなければなりません。'r', 'g', 'b' の値は ‘0’
     から ‘1000’ の間でなければなりません。*note init_color(): 9f7. を使
     うと、スクリーン上でカラーが使用されている部分はすべて新しい設定に
     即時変更されます。この関数はほとんどの端末で何も行いません; *note
     can_change_color(): 3508. が ‘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(): 1f9.
     and *note assume_default_colors(): 1f8.).  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
     ウィンドウ: 19e9. オブジェクトを返します。

          注釈: 端末のオープン時にエラーが発生した場合、curses ライブラ
          リによってインタープリタが終了される場合があります。

 -- の関数: curses.intrflush (flag)

     If 'flag' is ‘True’, pressing an interrupt key (interrupt, break,
     or quit) will flush all output in the terminal driver queue.  If
     'flag' is ‘False’, no flushing is done.

 -- の関数: curses.is_term_resized (nlines, ncols)

     *note resize_term(): 1990. によってウィンドウ構造が変更されている場
     合に ‘True’ を、そうでない場合は ‘False’ を返します。

 -- の関数: curses.isendwin ()

     *note endwin(): 3519. がすでに呼び出されている (すなわち、curses ラ
     イブラリが非初期化されてしまっている) 場合に ‘True’ を返します。

 -- の関数: curses.keyname (k)

     bytes オブジェクト 'k' に番号付けされているキーの名前を返します。 印
     字可能な ASCII 文字を生成するキーの名前はそのキーの文字自体になりま
     す。 コントロールキーと組み合わせたキーの名前は、キャレット
     (‘b'^'’)の後に対応する ASCII 文字が続く 2 バイトの bytes オブジェク
     トになります。 Alt キーと組み合わせたキー (128-255) の名前は、先頭
     に ‘b'M-'’ が付き、その後に対応する ASCII 文字が続く bytes オブジェ
     クトになります。

     Raise a *note ValueError: 2ee. if 'k' is negative.

 -- の関数: 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(): 196f. 呼び出しの後でのみ定義さ
     れています。

 -- の関数: curses.meta (flag)

     'flag' が ‘True’ の場合、8 ビット文字の入力を許可します。'flag' が
     ‘False’ の場合、7 ビット文字だけを許可します。

 -- の関数: curses.mouseinterval (interval)

     Set the maximum time in milliseconds that can elapse between press
     and release events in order for them to be recognized as a click,
     and return the previous interval value.  The default value is 166
     milliseconds, or one sixth of a second.  Use a negative 'interval'
     to obtain the interval value without changing it.

 -- の関数: curses.mousemask (mousemask)

     Set the mouse events to be reported, and return a tuple
     ‘(availmask, oldmask)’.  'availmask' indicates which of the
     specified mouse events can be reported; on complete failure it
     returns ‘0’.  'oldmask' is the previous value of the mouse event
     mask.  If this function is never called, no mouse events are ever
     reported.

 -- の関数: curses.napms (ms)

     'ms' ミリ秒間スリープします。

 -- の関数: curses.newpad (nlines, ncols)

     与えられた行とカラム数を持つパッド (pad) データ構造を生成し、そのポ
     インタを返します。パッドはウィンドウオブジェクトとして返されます。

     A pad is like a window, except that it is not restricted by the
     screen size, and is not necessarily associated with a particular
     part of the screen.  Pads can be used when a large window is
     needed, and only a part of the window will be on the screen at one
     time.  Automatic refreshes of pads (such as from scrolling or
     echoing of input) do not occur.  The *note refresh(): 353b. and
     *note noutrefresh(): 3517. methods of a pad require 6 arguments to
     specify the part of the pad to be displayed and the location on the
     screen to be used for the display.  The arguments are 'pminrow',
     'pmincol', 'sminrow', 'smincol', 'smaxrow', 'smaxcol'; the 'p'
     arguments refer to the upper-left corner of the pad region to be
     displayed and the 's' arguments define a clipping box on the screen
     within which the pad region is to be displayed.

 -- の関数: curses.newwin (nlines, ncols)

 -- の関数: curses.newwin (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ で、高さ/幅が 'nlines' / 'ncols' の
     新規 *note ウィンドウ: 19e9. を返します。

     デフォルトでは、ウィンドウは指定された位置からスクリーンの右下まで
     広がります。

 -- の関数: curses.nl (flag=True)

     newlime モードに入ります。このモードはリターンキーを入力中の改行と
     して変換し、出力時に改行文字を復帰 (return) と改行 (line-feed) に変
     換します。newline モードは初期化時にはオンになっています。

     If 'flag' is ‘False’, the effect is the same as calling *note
     nonl(): 353e.

 -- の関数: 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():
     350b. はこの関数の逆に相当します。

 -- の関数: curses.putp (str)

     ‘tputs(str, 1, putchar)’ と等価です; 現在の端末における、指定された
     terminfo 機能の値を出力します。*note putp(): 3542. の出力は常に標準
     出力に送られるので注意して下さい。

     *note setupterm(): 3543. (or *note initscr(): 196f.) must be called
     first.

 -- の関数: curses.qiflush ([flag])

     'flag' が ‘False’ なら、*note noqiflush(): 3540. を呼ぶのとと同じ効
     果です。'flag' が ‘True’ か、引数が与えられていない場合、制御文字が
     読み出された最にキューはフラッシュされます。

 -- の関数: curses.raw ()

     raw モードに入ります。raw モードでは、通常の行バッファリングと割り
     込み (interrupt)、終了 (quit)、一時停止 (suspend)、およびフロー制御
     キーはオフになります; 文字は curses 入力関数に一文字づつ渡されます
     。

 -- の関数: curses.reset_prog_mode ()

     端末を "program" モードに復旧し、あらかじめ *note def_prog_mode():
     3510. で保存した内容に戻します。

 -- の関数: curses.reset_shell_mode ()

     端末を "shell" モードに復旧し、あらかじめ *note def_shell_mode():
     3512. で保存した内容に戻します。

 -- の関数: curses.resetty ()

     端末モードの状態を最後に *note savetty(): 3546. を呼び出した時の状
     態に戻します。

 -- の関数: curses.resize_term (nlines, ncols)

     *note resizeterm(): 198f. で使用されるバックエンド関数で、ウィンド
     ウサイズを変更する時、*note resize_term(): 1990. は拡張された領域を
     埋めます。呼び出したアプリケーションはそれらの領域を適切なデータで
     埋めなくてはなりません。‘resize_term()’ 関数はすべてのウィンドウの
     サイズ変更を試みます。ただし、パッド呼び出しの慣例により、アプリケ
     ーションとの追加のやり取りを行わないサイズ変更は行えません。

 -- の関数: curses.resizeterm (nlines, ncols)

     現在の標準ウィンドウのサイズを指定された寸法に変更し、curses ライブ
     ラリが使用する、その他のウィンドウサイズを記憶しているデータ (特に
     SIGWINCH ハンドラ) を調整します。

 -- の関数: curses.savetty ()

     *note resetty(): 3545. で使用される、バッファ内の端末モードの現在の
     状態を保存します。

 -- の関数: curses.get_escdelay ()

     Retrieves the value set by *note set_escdelay(): af1.

     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(): af3.

     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’ のファイル記述子が使用されます。

     Raise a *note curses.error: 3504. if the terminal could not be
     found or its terminfo database entry could not be read.  If the
     terminal has already been initialized, this function has no effect.

 -- の関数: curses.start_color ()

     プログラマがカラーを利用したい場合で、かつ他の何らかのカラー操作ル
     ーチンを呼び出す前に呼び出さなくてはなりません。この関数は *note
     initscr(): 196f. を呼んだ直後に呼ぶようにしておくとよいでしょう。

     ‘start_color()’ initializes eight basic colors (black, red, green,
     yellow, blue, magenta, cyan, and white), and two global variables
     in the ‘curses’ module, *note COLORS: 3549. and *note COLOR_PAIRS:
     354a, 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’ を返します。

     *note setupterm(): 3543. (or *note initscr(): 196f.) must be called
     first.

 -- の関数: curses.tigetnum (capname)

     terminfo 機能名 'capname' に対応する数値の機能値を整数で返します。
     'capname' が数値で表せる機能値でない場合 ‘-2’ を返し、機能がキャン
     セルされているか、端末記述上に見つからない場合 ‘-1’ を返します。

     *note setupterm(): 3543. (or *note initscr(): 196f.) must be called
     first.

 -- の関数: 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.

     *note setupterm(): 3543. (or *note initscr(): 196f.) must be called
     first.

 -- の関数: curses.tparm (str[, ...])

     Instantiate the bytes object 'str' with the supplied parameters,
     where 'str' should be a parameterized string obtained from the
     terminfo database.  For example, ‘tparm(tigetstr("cup"), 5, 3)’
     could result in ‘b'\033[6;4H'’, the exact result depending on
     terminal type.  Up to nine integer parameters may be supplied.

     *note setupterm(): 3543. (or *note initscr(): 196f.) must be called
     first.

 -- の関数: 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(): 188b. を呼び出した時にその値
     が返るようにします。

          注釈: ‘getch()’ を呼び出すまでは 'ch' は一つしかプッシュできま
          せん。

 -- の関数: curses.update_lines_cols ()

     Update the *note LINES: ff0. and *note COLS: ff1. module variables.
     Useful for detecting manual screen resize.

     Added in version 3.5.

 -- の関数: curses.unget_wch (ch)

     'ch' をプッシュし、次に *note get_wch(): 12ad. を呼び出した時にその
     値が返るようにします。

          注釈: ‘get_wch()’ を呼び出すまでは 'ch' は一つしかプッシュでき
          ません。

     Added in version 3.3.

 -- の関数: curses.ungetmouse (id, x, y, z, bstate)

     与えられた状態データが関連付けられた *note KEY_MOUSE: 351f. イベン
     トを入力キューにプッシュします。

 -- の関数: curses.use_env (flag)

     この関数を使う場合、*note initscr(): 196f. または 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 objects,  Next: 定数<6>,  Prev: 関数<6>,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.2 Window objects
.......................

 -- クラス: curses.window

     上記の *note initscr(): 196f. や *note newwin(): 353c. が返すウィン
     ドウは、以下のメソッドと属性を持ちます:

 -- メソッド: 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: 3504.  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: 3504.  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, the backend for this Python module,
               could cause segfaults when resizing windows.  This was
               fixed in ncurses-6.1-20190511.  If you are stuck with an
               earlier ncurses, you can avoid triggering it by not
               calling ‘addstr()’ with a 'str' that has embedded
               newlines; instead, call ‘addstr()’ 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: 355c.
                                               
                                               
     'rs'            右側                      *note ACS_VLINE: 355c.
                                               
                                               
     'ts'            上側                      *note ACS_HLINE: 355d.
                                               
                                               
     'bs'            下側                      *note ACS_HLINE: 355d.
                                               
                                               
     'tl'            左上の角                  *note ACS_ULCORNER: 355e.
                                               
                                               
     'tr'            右上の角                  *note ACS_URCORNER: 355f.
                                               
                                               
     'bl'            左下の角                  *note ACS_LLCORNER: 3560.
                                               
                                               
     'br'            右下の角                  *note ACS_LRCORNER: 3561.
                                               

 -- メソッド: window.box ([vertch, horch])

     *note border(): 355b. と同様ですが、'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(): 3564. method so that the contents will be
     redisplayed by the next window refresh.

 -- メソッド: window.clear ()

     *note erase(): 3566. に似ていますが、次に *note refresh(): 353b. が
     呼び出された際にすべてのウィンドウを再描画するようにします。

 -- メソッド: window.clearok (flag)

     'flag' が ‘True’ ならば、次の *note refresh(): 353b. はウィンドウを
     完全に消去します。

 -- メソッド: window.clrtobot ()

     カーソルの位置からウィンドウの端までを消去します: カーソル以降のす
     べての行が削除されるため、*note clrtoeol(): 3569. と等価です。

 -- メソッド: window.clrtoeol ()

     カーソル位置から行末までを消去します。

 -- メソッド: window.cursyncup ()

     ウィンドウのすべての親ウィンドウについて、現在のカーソル位置を反映
     するよう更新します。

 -- メソッド: window.delch ([y, x])

     Delete the character under the cursor, or at ‘(y, x)’ if specified.
     All characters to the right on the same line are shifted one
     position left.

 -- メソッド: window.deleteln ()

     カーソルの下にある行を削除します。後続の行はすべて 1 行上に移動しま
     す。

 -- メソッド: window.derwin (begin_y, begin_x)

 -- メソッド: window.derwin (nlines, ncols, begin_y, begin_x)

     "derive window (ウィンドウを派生する)" の短縮形です。*note
     derwin(): 356d. は *note subwin(): 356e. と同じですが、'begin_y' お
     よび 'begin_x' はスクリーン全体の原点ではなく、ウィンドウの原点から
     の相対位置です。派生したウィンドウオブジェクトが返されます。

 -- メソッド: window.echochar (ch[, attr])

     文字 'ch' に属性 'attr' を付与し、即座に *note refresh(): 353b. を
     ウィンドウに対して呼び出します。

 -- メソッド: 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(): 356e. などでサブウィ
     ンドウを生成した時、エンコーディング属性は親ウィンドウから継承しま
     す。デフォルトでは、現在のロケールのエンコーディングが使用されます
     (*note locale.getencoding(): 866. 参照)。

     Added in version 3.3.

 -- メソッド: window.erase ()

     ウィンドウをクリアします。

 -- メソッド: window.getbegyx ()

     Return a tuple ‘(y, x)’ of coordinates of upper-left corner.

 -- メソッド: window.getbkgd ()

     Return the given window's current background character/attribute
     pair.  Its components can be extracted like those of *note inch():
     3572.

 -- メソッド: 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(): 188b. が返すような整数ではなく文
     字列を返します。ファンクションキー、キーパッドのキー、およびその他
     特殊キーはキー名を含む複数文字を返します。無遅延モードでは、入力が
     ない場合例外を送出します。

 -- メソッド: 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.  At most 'n' characters are read; 'n' defaults to and
     cannot exceed 2047.

     バージョン 3.14 で変更: The maximum value for 'n' was increased
     from 1023 to 2047.

 -- メソッド: window.getyx ()

     ウィンドウの左上角からの相対で表した現在のカーソル位置をタプル ‘(y,
     x)’ で返します。

 -- メソッド: window.hline (ch, n[, attr])

 -- メソッド: window.hline (y, x, ch, n[, attr])

     Display a horizontal line starting at ‘(y, x)’ with length 'n'
     consisting of the character 'ch' with attributes 'attr'.  The line
     stops at the right edge of the window if fewer than 'n' cells are
     available.

 -- メソッド: window.idcok (flag)

     'flag' が ‘False’ の場合、curses は端末のハードウェアによる文字挿入
     /削除機能を使おうとしなくなります; 'flag' が ‘True’ ならば、文字挿
     入/削除は有効にされます。curses が最初に初期化された際には文字挿入
     /削除はデフォルトで有効になっています。

 -- メソッド: window.idlok (flag)

     If 'flag' is ‘True’, ‘curses’ will try to use hardware line editing
     facilities.  Otherwise, curses will not use them.

 -- メソッド: window.immedok (flag)

     'flag' が ‘True’ ならば、ウィンドウイメージ内における何らかの変更が
     あるとウィンドウを更新するようになります; すなわち、*note
     refresh(): 353b. を自分で呼ばなくても良くなります。とはいえ、
     wrefresh を繰り返し呼び出すことになるため、この操作はかなりパフォー
     マンスを低下させます。デフォルトでは無効になっています。

 -- メソッド: window.inch ([y, x])

     Return the character at the given position in the window.  The
     bottom 8 bits are the character proper and the upper bits are the
     attributes; extract them with the *note A_CHARTEXT: 357b. and *note
     A_ATTRIBUTES: 357c. bit-masks, and the color pair with *note
     pair_number(): 350e.

 -- メソッド: window.insch (ch[, attr])

 -- メソッド: window.insch (y, x, ch[, attr])

     Insert character 'ch' with attributes 'attr' before the character
     under the cursor, or at ‘(y, x)’ if specified.  All characters to
     the right of the cursor are shifted one position right, with the
     rightmost character on the line being lost.  The cursor position
     does not change.

 -- メソッド: 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, and stopping at the end of the line.  Attributes and
     color information are stripped from the characters.  If 'n' is
     specified, ‘instr()’ 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(): 353b. を呼んだ時から変更され
     ている場合に ‘True’ を返します; そうでない場合には ‘False’ を返しま
     す。'line' が現在のウィンドウ上の有効な行でない場合、*note
     curses.error: 3504. 例外を送出します。

 -- メソッド: window.is_wintouched ()

     指定したウィンドウが、最後に *note refresh(): 353b. を呼んだ時から
     変更されている場合に ‘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)

     If 'flag' is ‘True’, cursor is left where it is on update, instead
     of being at "cursor position."  This reduces cursor movement where
     possible.

     '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)’ になるように移動します。

     Moving the window so that any part of it would be off the screen is
     an error: the window is not moved and *note curses.error: 3504. is
     raised.

 -- メソッド: window.nodelay (flag)

     'flag' が ‘True’ の場合、*note getch(): 188b. は非ブロックで動作し
     ます。

 -- メソッド: window.notimeout (flag)

     'flag' が ‘True’ の場合、エスケープシーケンスはタイムアウトしなくな
     ります。

     'flag' が ‘False’ の場合、数ミリ秒間の間エスケープシーケンスは解釈
     されず、入力ストリーム中にそのままの状態で残されます。

 -- メソッド: window.noutrefresh ()

 -- メソッド: window.noutrefresh (pminrow, pmincol, sminrow, smincol,
          smaxrow, smaxcol)

     更新をマークはしますが待機します。この関数はウィンドウのデータ構造
     を表現したい内容を反映するように更新しますが、物理スクリーン上に反
     映させるための強制更新を行いません。更新を行うためには *note
     doupdate(): 3515. を呼び出します。

     The 6 arguments can only be specified, and are then required, when
     the window is a pad created with *note newpad(): 353a.; they have
     the same meaning as for *note refresh(): 353b.

 -- メソッド: window.overlay (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     ウィンドウを 'destwin' の上に重ね書き (overlay) します。ウィンドウ
     は同じサイズである必要はなく、重なっている領域だけが複写されます。
     この複写は非破壊的です。これは現在の背景文字が 'destwin' の内容を上
     書きしないことを意味します。

     複写領域をきめ細かく制御するために、*note overlay(): 358a. の第二形
     式を使うことができます。'sminrow' および 'smincol' は元のウィンドウ
     の左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.overwrite (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     'destwin' の上にウィンドウの内容を上書き (overwrite) します。ウィン
     ドウは同じサイズである必要はなく、重なっている領域だけが複写されま
     す。この複写は破壊的です。これは現在の背景文字が 'destwin' の内容を
     上書きすることを意味します。

     複写領域をきめ細かく制御するために、*note overwrite(): 358b. の第二
     形式を使うことができます。'sminrow' および 'smincol' は元のウィンド
     ウの左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.putwin (file)

     ウィンドウに関連付けられているすべてのデータを与えられたファイルオ
     ブジェクトに書き込みます。この情報は後に *note getwin(): 3529. 関数
     を使って取得することができます。

 -- メソッド: window.redrawln (beg, num)

     'beg' 行から始まる 'num' スクリーン行の表示内容が壊れており、次の
     *note refresh(): 353b. 呼び出しで完全に再描画されなければならないこ
     とを通知します。

 -- メソッド: window.redrawwin ()

     ウィンドウ全体を更新 (touch) し、次の *note refresh(): 353b. 呼び出
     しで完全に再描画されるようにします。

 -- メソッド: window.refresh ([pminrow, pmincol, sminrow, smincol,
          smaxrow, smaxcol])

     ディスプレイを即時更新し (実際のウィンドウとこれまでの描画/削除メソ
     ッドの内容とを同期し) ます。

     The 6 arguments can only be specified, and are then required, when
     the window is a pad created with *note newpad(): 353a.  The
     additional parameters are needed to indicate what part of the pad
     and screen are involved.  'pminrow' and 'pmincol' specify the
     upper-left corner of the rectangle to be displayed in the pad.
     'sminrow', 'smincol', 'smaxrow', and 'smaxcol' specify the edges of
     the rectangle to be displayed on the screen.  The lower-right
     corner of the rectangle to be displayed in the pad is calculated
     from the screen coordinates, since the rectangles must be the same
     size.  Both rectangles must be entirely contained within their
     respective structures.  Negative values of 'pminrow', 'pmincol',
     'sminrow', or 'smincol' are treated as if they were zero.

 -- メソッド: window.resize (nlines, ncols)

     curses ウィンドウの記憶域を、指定値のサイズに調整するため再割当てし
     ます。サイズが現在の値より大きい場合、ウィンドウのデータは現在の背
     景設定 (*note bkgdset(): 355a. で設定) で埋められマージされます。

 -- メソッド: window.scroll ([lines=1])

     Scroll the screen or scrolling region.  Scroll upward by 'lines'
     lines if 'lines' is positive, or downward if it is negative.
     Scrolling has no effect unless it has been enabled for the window
     with *note scrollok(): 3590.

 -- メソッド: window.scrollok (flag)

     ウィンドウのカーソルが、最下行で改行を行ったり最後の文字を入力した
     りした結果、ウィンドウやスクロール領域の縁からはみ出して移動した際
     の動作を制御します。'flag' が ‘False’ の場合、カーソルは最下行にそ
     のままにしておかれます。'flag' が ‘True’ の場合、ウィンドウは 1 行
     上にスクロールします。端末の物理スクロール効果を得るためには *note
     idlok(): 3579. も呼び出す必要があるので注意してください。

 -- メソッド: 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)

     Return a sub-pad, whose upper-left corner is at ‘(begin_y,
     begin_x)’, and whose width/height is 'ncols'/'nlines'.  The
     coordinates are relative to the parent pad (unlike *note subwin():
     356e, which uses screen coordinates).  This method is only
     available for pads created with *note newpad(): 353a.

 -- メソッド: window.subwin (begin_y, begin_x)

 -- メソッド: window.subwin (nlines, ncols, begin_y, begin_x)

     Return a sub-window, whose upper-left corner is at the
     screen-relative coordinates ‘(begin_y, begin_x)’, and whose
     width/height is 'ncols'/'nlines'.

     デフォルトでは、サブウィンドウは指定された場所からウィンドウの右下
     角まで広がります。

 -- メソッド: window.syncdown ()

     このウィンドウの上位のウィンドウのいずれかで更新(touch)された各場所
     をこのウィンドウ内でも更新します。このルーチンは *note refresh():
     353b. から呼び出されるので、手動で呼び出す必要はほとんどないはずで
     す。

 -- メソッド: window.syncok (flag)

     'flag' が ‘True’ の場合、ウィンドウが変更された際は常に *note
     syncup(): 3597. を自動的に呼ぶようになります。

 -- メソッド: window.syncup ()

     ウィンドウ内で更新 (touch) した場所を、上位のすべてのウィンドウ内で
     も更新します。

 -- メソッド: window.timeout (delay)

     ウィンドウのブロックまたは非ブロック読み込み動作を設定します。
     'delay' が負の場合、ブロック読み出しが使われ、入力を無期限で待ち受
     けます。'delay' がゼロの場合、非ブロック読み出しが使われ、入力待ち
     の文字がない場合 *note getch(): 188b. は ‘-1’ を返します。'delay' が
     正の値であれば、‘getch()’ は 'delay' ミリ秒間ブロックし、ブロック後
     の時点で入力がない場合には ‘-1’ を返します。

 -- メソッド: window.touchline (start, count[, changed])

     'start' から始まる 'count' 行が変更されたかのように振舞わせます。も
     し 'changed' が与えられた場合、その引数は指定された行が変更された
     ('changed'‘=True’)か、変更されていないか('changed')を指定します。

 -- メソッド: window.touchwin ()

     描画を最適化するために、すべてのウィンドウが変更されたかのように振
     舞わせます。

 -- メソッド: window.untouchwin ()

     ウィンドウ内のすべての行を、最後に *note refresh(): 353b. を呼んだ
     際から変更されていないものとしてマークします。

 -- メソッド: 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'.


File: python.info,  Node: 定数<6>,  Prev: Window objects,  Up: curses --- 文字セル表示のターミナル処理

5.18.5.3 定数
.............

The ‘curses’ module defines the following data members:

 -- データ: curses.ERR

     *note getch(): 188b. のような整数を返す curses ルーチンのいくつかは
     、失敗した際に *note ERR: 359c. を返します。

 -- データ: curses.OK

     *note napms(): 196e. のような整数を返す curses ルーチンのいくつかは
     、成功した際に *note OK: 359d. を返します。

 -- データ: 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(): 3548.

 -- データ: curses.COLOR_PAIRS

     The maximum number of color pairs the terminal can support.  It is
     defined only after the call to *note start_color(): 3548.

 -- データ: curses.COLS

     The width of the screen, that is, the number of columns.  It is
     defined only after the call to *note initscr(): 196f.  Updated by
     *note update_lines_cols(): fef, *note resizeterm(): 198f. and *note
     resize_term(): 1990.

 -- データ: curses.LINES

     The height of the screen, that is, the number of lines.  It is
     defined only after the call to *note initscr(): 196f.  Updated by
     *note update_lines_cols(): fef, *note resizeterm(): 198f. and *note
     resize_term(): 1990.

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: 35b7,
‘KEY_F2’, ‘KEY_F3’, ‘KEY_F4’) available, and the arrow keys mapped to
*note KEY_UP: 35b1, *note KEY_DOWN: 35b0, *note KEY_LEFT: 35b2. and
*note KEY_RIGHT: 35b3. 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(): 196f. が呼び出された後でしか利用で
     きません。

ACS コード                   意味
                             
----------------------------------------------------------------------------
                             
 -- データ:                  alternate name for upper-right corner
          curses.ACS_BBSS    

 -- データ:                  黒四角ブロック
          curses.ACS_BLOCK   

 -- データ:                  白四角ブロック
          curses.ACS_BOARD   

 -- データ:                  水平線の別名
          curses.ACS_BSBS    

 -- データ:                  alternate name for upper-left corner
          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  

 -- データ:                  lower-left corner
          curses.ACS_LLCORNER

 -- データ:                  lower-right corner
          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
                             
                             
 -- データ:                  alternate name for lower-right corner
          curses.ACS_SBBS    

 -- データ:                  垂直線の別名
          curses.ACS_SBSB    

 -- データ:                  右向き T 字罫線の別名
          curses.ACS_SBSS    

 -- データ:                  alternate name for lower-left corner
          curses.ACS_SSBB    

 -- データ:                  下向き T 字罫線の別名
          curses.ACS_SSBS    

 -- データ:                  左向き T 字罫線の別名
          curses.ACS_SSSB    

 -- データ:                  交差罫線または大プラス記号の別名
          curses.ACS_SSSS    

 -- データ:                  ポンドスターリング記号
          curses.ACS_STERLING

 -- データ:                  上向き T 字罫線
          curses.ACS_TTEE    

 -- データ:                  上向き矢印
          curses.ACS_UARROW  

 -- データ:                  upper-left corner
          curses.ACS_ULCORNER

 -- データ:                  upper-right corner
          curses.ACS_URCORNER

 -- データ:                  垂直線
          curses.ACS_VLINE   

The following table lists mouse button constants used by *note
getmouse(): 351e.:

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          Alt 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.18.6 ‘curses.textpad’ -- Text input widget for curses programs
----------------------------------------------------------------

The ‘curses.textpad’ module provides a *note Textbox: 1773. 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)

     Draw a rectangle.  The first argument must be a window object; the
     remaining arguments are coordinates relative to that window.  The
     second and third arguments are the y and x coordinates of the
     upper-left corner of the rectangle to be drawn; the fourth and
     fifth arguments are the y and x coordinates of the lower-right
     corner.  The rectangle will be drawn using VT100/IBM PC forms
     characters on terminals that make this possible (including xterm
     and most other software terminal emulators).  Otherwise it will be
     drawn with ASCII dashes, vertical bars, and plus signs.

* Menu:

* Textbox オブジェクト::


File: python.info,  Node: Textbox オブジェクト,  Up: curses textpad --- Text input widget for curses programs

5.18.6.1 Textbox オブジェクト
.............................

以下のような *note Textbox: 1773. オブジェクトをインスタンス生成すること
ができます:

 -- クラス: curses.textpad.Textbox (win, insert_mode=False)

     Return a textbox widget object.  The 'win' argument should be a
     curses *note window: 19e9. object in which the textbox is to be
     contained.  If 'insert_mode' is true, the textbox inserts typed
     characters, shifting existing text to the right, rather than
     overwriting it.  The edit cursor of the textbox is initially
     located at the upper-left corner of the containing window, with
     coordinates ‘(0, 0)’.  The instance's *note stripspaces: 363d. flag
     is initially on.

     *note Textbox: 1773. オブジェクトは以下のメソッドを持ちます:

      -- メソッド: edit (validate=None)

          This is the entry point you will normally use.  It accepts
          editing keystrokes until one of the termination keystrokes is
          entered.  If 'validate' is supplied, it must be a function.
          It will be called for each keystroke entered with the
          keystroke as a parameter; command dispatch is done on the
          result.  If it returns a false value, the keystroke is
          ignored.  This method returns the window contents as a string;
          whether blanks in the window are included is affected by the
          *note stripspaces: 363d. attribute.

      -- メソッド: do_command (ch)

          Process a single command keystroke.  Returns ‘1’ to continue
          editing, or ‘0’ if a termination keystroke was processed.
          Here are the supported special keystrokes:

          キーストローク         動作
                                 
          -----------------------------------------------------------------------
                                 
          ‘Control’-‘A’          ウィンドウの左端に移動します。
                                 
                                 
          ‘Control’-‘B’          カーソルを左へ移動し、必要なら前の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘D’          カーソル下の文字を削除します。
                                 
                                 
          ‘Control’-‘E’          右端 (stripspaces がオフのとき) または行末
                                 (stripspaces がオンのとき) に移動します。
                                 
                                 
          ‘Control’-‘F’          カーソルを右に移動し、必要なら次の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘G’          ウィンドウを終了し、その内容を返します。
                                 
                                 
          ‘Control’-‘H’          逆方向に文字を削除します。
                                 
                                 
          ‘Control’-‘J’          Terminate if the window is 1 line, otherwise
                                 move to the start of the next line.
                                 
                                 
          ‘Control’-‘K’          行が空白行ならその行全体を削除し、そうでなけ
                                 ればカーソル以降行末までを消去します。
                                 
                                 
          ‘Control’-‘L’          スクリーンを更新します。
                                 
                                 
          ‘Control’-‘N’          カーソルを下に移動します; 1 行下に移動します
                                 。
                                 
                                 
          ‘Control’-‘O’          カーソルの場所に空行を 1 行挿入します。
                                 
                                 
          ‘Control’-‘P’          カーソルを上に移動します; 1 行上に移動します
                                 。
                                 

          移動操作は、カーソルがウィンドウの縁にあって移動ができない場合
          には何も行いません。場合によっては、以下のような同義のキースト
          ロークがサポートされています:

          定数                                 キーストローク
                                               
          ------------------------------------------------------------
                                               
          *note KEY_LEFT: 35b2.                ‘Control’-‘B’
                                               
                                               
          *note KEY_RIGHT: 35b3.               ‘Control’-‘F’
                                               
                                               
          *note KEY_UP: 35b1.                  ‘Control’-‘P’
                                               
                                               
          *note KEY_DOWN: 35b0.                ‘Control’-‘N’
                                               
                                               
          *note KEY_BACKSPACE: 35b5.           ‘Control’-‘h’
                                               

          他のキーストロークは、与えられた文字を挿入し、(行折り返し付き
          で) 右に移動するコマンドとして扱われます。

      -- メソッド: gather ()

          ウィンドウの内容を文字列として返します; ウィンドウ内の空白が含
          められるかどうかは *note stripspaces: 363d. メンバ変数で決めら
          れます。

      -- の属性: stripspaces

          この属性はウィンドウ内の空白領域の解釈方法を制御するためのフラ
          グです。フラグがオンに設定されている場合、各行の末端にある空白
          領域は無視されます; すなわち、末端空白領域にカーソルが入ると、
          その場所の代わりに行の末尾にカーソルが移動します。また、末端の
          空白領域はウィンドウの内容を取得する際に剥ぎ取られます。


File: python.info,  Node: curses ascii --- ASCII 文字のユーティリティー,  Next: curses panel --- curses のためのパネルスタック拡張,  Prev: curses textpad --- Text input widget for curses programs,  Up: コマンドラインインターフェースライブラリ

5.18.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: 364a. フロー制御時に使用
          curses.ascii.ENQ

 -- データ:         肯定応答
          curses.ascii.ACK

 -- データ:         ベル
          curses.ascii.BEL

 -- データ:         一文字後退
          curses.ascii.BS

 -- データ:         タブ
          curses.ascii.TAB

 -- データ:         *note TAB: 364d. の別名: "水平タブ"
          curses.ascii.HT

 -- データ:         改行
          curses.ascii.LF

 -- データ:         *note LF: 364f. の別名: "改行"
          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)

     Checks for an ASCII blank character; space or horizontal tab.

 -- の関数: curses.ascii.iscntrl (c)

     ASCII 制御文字 (0x00 から 0x1f の範囲または 0x7f) かどうかを調べま
     す。

 -- の関数: curses.ascii.isdigit (c)

     ASCII 10 進数字、すなわち ‘'0'’ から ‘'9'’ までの文字かどうかを調べ
     ます。‘c in string.digits’ と等価です。

 -- の関数: curses.ascii.isgraph (c)

     Checks for any ASCII printable character except space.

 -- の関数: curses.ascii.islower (c)

     ASCII 小文字かどうかを調べます。

 -- の関数: curses.ascii.isprint (c)

     空白文字を含め、ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.ispunct (c)

     Checks for any ASCII printable character which is not a space or an
     alphanumeric character.

 -- の関数: curses.ascii.isspace (c)

     ASCII 余白文字、すなわち空白、改行、復帰、改頁、水平タブ、垂直タブ
     かどうかを調べます。

 -- の関数: curses.ascii.isupper (c)

     ASCII 大文字かどうかを調べます。

 -- の関数: curses.ascii.isxdigit (c)

     ASCII 16 進数字かどうかを調べます。‘c in string.hexdigits’ と等価で
     す。

 -- の関数: curses.ascii.isctrl (c)

     Checks for an ASCII control character (ordinal values 0 to 31).
     Unlike *note iscntrl(): 366c, this does not include the delete
     character (0x7f).

 -- の関数: curses.ascii.ismeta (c)

     非 ASCII 文字 (0x80 またはそれ以上の値) かどうかを調べます。

これらの関数は数字も 1 文字の文字列も使えます; 引数を文字列にした場合、
組み込み関数 *note ord(): 2397. を使って変換されます。

これらの関数は全て、関数に渡した文字列の文字から得られたビット値を調べる
ので注意してください; 関数はホスト計算機で使われている文字列エンコーディ
ングについて何ら関知しません。

以下の 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.18.8 ‘curses.panel’ -- curses のためのパネルスタック拡張
----------------------------------------------------------

__________________________________________________________________

パネルは深さ (depth) の機能が追加されたウィンドウです。これにより、ウィ
ンドウをお互いに重ね合わせることができ、各ウィンドウの可視部分だけが表示
されます。パネルはスタック中に追加したり、スタック内で上下移動させたり、
スタックから除去することができます。

* Menu:

* 関数: 関数<7>.
* Panel objects::


File: python.info,  Node: 関数<7>,  Next: Panel objects,  Up: curses panel --- curses のためのパネルスタック拡張

5.18.8.1 関数
.............

The module ‘curses.panel’ defines the following functions:

 -- の関数: curses.panel.bottom_panel ()

     パネルスタックの最下層のパネルを返します。

 -- の関数: curses.panel.new_panel (win)

     Returns a panel object, associating it with the given window 'win'
     and placing the new panel on top of the panel stack.  Be aware that
     you need to keep the returned panel object referenced explicitly.
     If you don't, the panel object is garbage collected and removed
     from the panel stack.

 -- の関数: curses.panel.top_panel ()

     パネルスタックの最上層のパネルを返します。

 -- の関数: curses.panel.update_panels ()

     仮想スクリーンをパネルスタック変更後の状態に更新します。この関数で
     は *note curses.doupdate(): 3515. を呼ばないので、ユーザは自分で呼
     び出す必要があります。


File: python.info,  Node: Panel objects,  Prev: 関数<7>,  Up: curses panel --- curses のためのパネルスタック拡張

5.18.8.2 Panel objects
......................

Panel objects, as returned by *note new_panel(): 3682. above, are
windows with a stacking order.  There's always a window associated with
a panel which determines the content, while the panel methods are
responsible for the window's depth in the panel stack.

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 ()

     Display the panel (which might have been hidden), placing it on top
     of the panel stack.

 -- メソッド: Panel.top ()

     パネルをスタックの最上層にプッシュします。

 -- メソッド: Panel.userptr ()

     パネルのユーザポインタを返します。任意の Python オブジェクトです。

 -- メソッド: Panel.window ()

     パネルに関連付けられているウィンドウオブジェクトを返します。


File: python.info,  Node: cmd --- 行指向のコマンドインタープリターのサポート,  Prev: curses panel --- curses のためのパネルスタック拡張,  Up: コマンドラインインターフェースライブラリ

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

'ソースコード:' Lib/cmd.py(1)

__________________________________________________________________

*note Cmd: 18b3. クラスでは、行指向のコマンドインタープリタを書くための
簡単なフレームワークを提供します。テストハーネスや管理ツール、そして、後
により洗練されたインターフェイスでラップするプロトタイプとして、こうした
インタープリタはよく役に立ちます。

 -- クラス: cmd.Cmd (completekey='tab', stdin=None, stdout=None)

     *note Cmd: 18b3. インスタンス、あるいはサブクラスのインスタンスは、
     行指向のインタープリタ・フレームワークです。 ‘Cmd’ 自身をインスタン
     ス化することはありません。むしろ、 ‘Cmd’ のメソッドを継承したり、ア
     クションメソッドをカプセル化するために、あなたが自分で定義するイン
     タープリタクラスのスーパークラスとしての便利です。

     オプション引数 'completekey' は、補完キーの *note readline: bf. 名
     です。デフォルトは ‘Tab’ です。 'completekey' が *note None: 886. で
     なく、 ‘readline’ が利用できるならば、コマンド補完は自動的に行われ
     ます。

     The default, ‘'tab'’, is treated specially, so that it refers to
     the ‘Tab’ key on every *note readline.backend: 1a89.  Specifically,
     if ‘readline.backend’ 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: cd1. が使用さ
     れます。

     引数に渡した 'stdin' を使いたい場合は、インスタンスの *note
     use_rawinput: 3696. 属性を ‘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.18.9.1 Cmdオブジェクト
........................

*note Cmd: 18b3. インスタンスは、次のメソッドを持ちます:

 -- メソッド: Cmd.cmdloop (intro=None)

     プロンプトを繰り返し出力し、入力を受け取り、受け取った入力から取り
     去った先頭の語を解析し、その行の残りを引数としてアクションメソッド
     へディスパッチします。

     オプションの引数は、最初のプロンプトの前に表示されるバナーあるいは
     イントロ用の文字列です (これはクラス属性 *note intro: 369a. をオー
     バーライドします)。

     *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(): 1a8d.  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(): 369b. method
     returns a true value.  The 'stop' argument to ‘postcmd()’ 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: 18b3. 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(): 369d. and *note postcmd(): 369b.
     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(): 369e. 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:
     18b3. 内のスタブであって、サブクラスでオーバーライドされるために存
     在します。戻り値は *note onecmd(): 369c. メソッドが実行するコマンド
     として使われます。 *note precmd(): 369d. の実装では、コマンドを書き
     換えるかもしれないし、あるいは単に変更していない 'line' を返すかも
     しれません。

 -- メソッド: Cmd.postcmd (stop, line)

     コマンドディスパッチが終わった直後に実行されるフックメソッド。この
     メソッドは *note Cmd: 18b3. 内のスタブで、サブクラスでオーバーライ
     ドされるために存在します。 'line' は実行されたコマンド行で、 'stop'
     は *note postcmd(): 369b. の呼び出しの後に実行を停止するかどうかを
     示すフラグです。これは *note onecmd(): 369c. メソッドの戻り値です。
     このメソッドの戻り値は、 'stop' に対応する内部フラグの新しい値とし
     て使われます。偽を返すと、実行を続けます。

 -- メソッド: Cmd.preloop ()

     *note cmdloop(): 3699. が呼び出されたときに一度だけ実行されるフック
     メソッド。このメソッドは *note Cmd: 18b3. 内のスタブであって、サブ
     クラスでオーバーライドされるために存在します。

 -- メソッド: Cmd.postloop ()

     *note cmdloop(): 3699. が戻る直前に一度だけ実行されるフックメソッド
     。このメソッドは *note Cmd: 18b3. 内のスタブであって、サブクラスで
     オーバーライドされるために存在します。

*note Cmd: 18b3. のサブクラスのインスタンスは、公開されたインスタンス変
数をいくつか持っています:

 -- の属性: Cmd.prompt

     入力を求めるために表示されるプロンプト。

 -- の属性: Cmd.identchars

     コマンドの先頭の語として受け入れられる文字の文字列。

 -- の属性: Cmd.lastcmd

     最後の空でないコマンド接頭辞。

 -- の属性: Cmd.cmdqueue

     キューに入れられた入力行のリスト。cmdqueue リストは新たな入力が必要
     な際に *note cmdloop(): 3699. 内でチェックされます; これが空でない
     場合、その要素は、あたかもプロンプトから入力されたかのように順に処
     理されます。

 -- の属性: Cmd.intro

     イントロあるいはバナーとして表示される文字列。 *note cmdloop():
     3699. メソッドに引数を与えるために、オーバーライドされるかもしれま
     せん。

 -- の属性: 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(): 3699. uses
     *note input(): 14f4. to display a prompt and read the next command;
     if false, *note sys.stdout.write(): cd1. 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.18.9.2 Cmd の例
.................

The ‘cmd’ module is mainly useful for building custom shells that let a
user work with a program interactively.

この節では、*note turtle: 108. モジュールのいくつかのコマンドを持ったシ
ェルの作成方法の簡単な例を示します。

Basic turtle commands such as *note forward(): 36ad. are added to a
*note Cmd: 18b3. 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(): 369d. 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: 36a6. 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.19 並行実行
=============

この章で記述されているモジュールは、コードの並行実行のサポートを提供しま
す。ツールの適切な選択は、実行されるタスク(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.19.1 ‘threading’ -- スレッドベースの並列処理
----------------------------------------------

'ソースコード:' Lib/threading.py(1)

__________________________________________________________________

このモジュールでは、高水準のスレッドインターフェースをより低水準 な
*note _thread: 2. モジュールの上に構築しています。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

* 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.19.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: 177.:

     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: 94d. 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: 1d8. の利用をお勧めします。 ただ
し、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.19.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: 1f6. 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.19.1.3 リファレンス
.....................

このモジュールは以下の関数を定義しています:

 -- の関数: threading.active_count ()

     生存中の *note Thread: 177. オブジェクトの数を返します。この数は
     *note enumerate(): 1cb7. の返すリストの長さと同じです。

     関数''activeCount''はこの関数の非推奨エイリアスです。

 -- の関数: threading.current_thread ()

     Return the current *note Thread: 177. 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(): c35. で発生したキャッチされない例外を処理する。

     (実) 引数*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: f40, the exception is silently
     ignored.  Otherwise, the exception is printed out on *note
     sys.stderr: b37.

     If this function raises an exception, *note sys.excepthook(): a10.
     is called to handle it.

     ‘threading.excepthook()’ can be overridden to control how uncaught
     exceptions raised by *note Thread.run(): c35. 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(): a10. handles uncaught exceptions.

     Added in version 3.8.

 -- データ: threading.__excepthook__

     Holds the original value of *note threading.excepthook(): a4f.  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: 2199.: 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: 177. オブジェクト全てのリストを返
     します。リストには、デーモンスレッド (daemonic thread)、 *note
     current_thread(): 35c. の生成するダミースレッドオブジェクトが入りま
     す。終了したスレッドとまだ開始していないスレッドは入りません。しか
     し、主スレッドは、たとえ終了しても、常に結果に含まれます。

 -- の関数: threading.main_thread ()

     main *note Thread: 177. オブジェクトを返します。通常の条件では、メ
     インスレッドは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(): 2e3.
     for each thread, before its *note run(): c35. 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(): 2e3. for each
     thread, before its *note run(): c35. method is called.

     Added in version 3.12.

 -- の関数: threading.gettrace ()

     *note settrace(): a4c. 関数で設定したトレース関数を取得します。

     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(): 171c.
     for each thread, before its *note run(): c35. 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(): 171c. for each
     thread, before its *note run(): c35. method is called.

     Added in version 3.12.

 -- の関数: threading.getprofile ()

     *note setprofile(): a4d. 関数で設定したプロファイラ関数を取得します
     。

     Added in version 3.10.

 -- の関数: threading.stack_size ([size])

     新しいスレッドを作るときのスレッドスタックサイズを返します。オプシ
     ョンの 'size' 引数にはこれ以降に作成するスレッドのスタックサイズを
     指定し、0 (プラットフォームのデフォルト値または設定されたデフォルト
     値) か、 32,768 (32 KiB) 以上の正の整数でなければなりません。'size'
     が指定されない場合 0 が使われます。スレッドのスタックサイズの変更が
     サポートされていない場合、 *note RuntimeError: 246. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 2ee. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 2199.: Windows, pthreads.

     Unix platforms with POSIX threads support.

このモジュールでは以下の定数も定義しています:

 -- データ: threading.TIMEOUT_MAX

     ブロックする関数 (*note Lock.acquire(): 8a8, *note RLock.acquire():
     107f, *note Condition.wait(): 1cc3. など) の 'timeout' 引数に許され
     る最大値。これ以上の値を timeout に指定すると *note OverflowError:
     a85. が発生します。

     Added in version 3.2.

このモジュールは多くのクラスを定義しています。それらは下記のセクションで
詳しく説明されます。

このモジュールのおおまかな設計は Java のスレッドモデルに基づいています。
とはいえ、 Java がロックと条件変数を全てのオブジェクトの基本的な挙動にし
ているのに対し、 Python ではこれらを別個のオブジェクトに分けています。
Python の *note Thread: 177. クラスがサポートしているのは 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.19.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: 18c4.
object and use its attributes:

     >>> mydata = local()
     >>> mydata.number = 42
     >>> mydata.number
     42

You can also access the *note local: 18c4.-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: 18c4. 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: 18c4. objects by subclassing the
‘local’ 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__(): 8c0.
method, it will be called each time the *note local: 18c4. object is
used in a separate thread.  This is necessary to initialize each
thread's dictionary.

Now if we create a *note local: 18c4. 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.19.1.5 Thread objects
.......................

The *note Thread: 177. 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(): c35. 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 ‘run()’ methods of this class.

ひとたびスレッドオブジェクトを生成すると、スレッドの *note start(): 179.
メソッドを呼び出して活動を開始しなければなりません。 ‘start()’ メソッド
はそれぞれのスレッドの *note run(): c35. メソッドを起動します。

スレッドの活動が始まると、スレッドは '生存中 (alive)' とみなされます。 ス
レッドは、通常 *note run(): c35. メソッドが終了するまで、もしくは捕捉さ
れない例外が送出されるまで生存中となります。 *note is_alive(): b4a. メソ
ッドは、スレッドが生存中であるかどうか調べます。

スレッドは他のスレッドの *note join(): 1401. メソッドを呼び出すことがで
きます。このメソッドは、 ‘join()’ メソッドを呼ばれたスレッドが終了するま
でメソッドの呼び出し元のスレッドをブロックします。

スレッドは名前を持っています。名前はコンストラクタに渡すことができ、
*note name: 2a2. 属性を通して読み出したり変更したりできます。

*note run(): c35. メソッドが例外を発生させた場合、*note
threading.excepthook(): a4f. が呼び出され、例外を処理します。デフォルト
では、‘threading.excepthook()’ は *note SystemExit: f40. を黙殺します。

スレッドには "デーモンスレッド (daemon thread)" であるというフラグを立て
られます。 このフラグには、残っているスレッドがデーモンスレッドだけにな
った時に Python プログラム全体を終了させるという意味があります。フラグの
初期値はスレッドを生成したスレッドから継承します。フラグの値は *note
daemon: 35a. プロパティまたは 'daemon' コンストラクタ引数を通して設定で
きます。

     注釈: デーモンスレッドは終了時にいきなり停止されます。デーモンスレ
     ッドで使われたリソース (開いているファイル、データベースのトランザ
     クションなど) は適切に解放されないかもしれません。きちんと
     (gracefully) スレッドを停止したい場合は、スレッドを非デーモンスレッ
     ドにして、*note Event: 1374. のような適切なシグナル送信機構を使用し
     てください。

スレッドには "主スレッド (main thread)" オブジェクトがあります。主スレッ
ドは Python プログラムを最初に制御していたスレッドです。主スレッドはデー
モンスレッドではありません。

"ダミースレッドオブジェクト (dummy thread objects)" が作成される場合があ
ります。ダミースレッドは、 "外来スレッド (alien thread)" に相当するスレ
ッドオブジェクトです。ダミースレッドは、C コードから直接生成されたスレッ
ドのような、 ‘threading’ モジュールの外で開始された処理スレッドです。ダ
ミースレッドオブジェクトには限られた機能しかなく、常に生存中、かつデーモ
ンスレッドであるとみなされ、 *note join: 36bc. できません。また、外来ス
レッドの終了を検出するのは不可能なので、ダミースレッドは削除できません。

 -- クラス: threading.Thread (group=None, target=None, name=None,
          args=(), kwargs={}, *, daemon=None, context=None)

     コンストラクタは常にキーワード引数を使って呼び出さなければなりませ
     ん。各引数は以下の通りです:

     'group' must be ‘None’ as it is reserved for future extension when
     a ‘ThreadGroup’ class is implemented.

     'target' は *note run(): c35. メソッドによって起動される呼び出し可
     能オブジェクトです。デフォルトでは何も呼び出さないことを示す ‘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: 178. value to use when starting the
     thread.  The default value is ‘None’ which indicates that the *note
     sys.flags.thread_inherit_context: 176. flag controls the behaviour.
     If the flag is true, threads will start with a copy of the context
     of the caller of *note start(): 179.  If false, they will start
     with an empty context.  To explicitly start with an empty context,
     pass a new instance of *note Context(): 178.  To explicitly start
     with a copy of the current context, pass the value from *note
     copy_context(): 36bd.  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(): 179. は、オブジェクトの *note
          run(): c35. メソッドが個別の処理スレッド中で呼び出されるように
          調整します。

          同じスレッドオブジェクトに対し、このメソッドを2回以上呼び出し
          た場合、 *note RuntimeError: 246. を送出します。

          If supported, set the operating system thread name to *note
          threading.Thread.name: 2a2.  The name can be truncated
          depending on the operating system thread name limits.

          バージョン 3.14 で変更: Set the operating system thread name.

      -- メソッド: run ()

          スレッドの活動をもたらすメソッドです。

          このメソッドはサブクラスでオーバライドできます。標準の *note
          run(): c35. メソッドでは、オブジェクトのコンストラクタの
          'target' 引数に呼び出し可能オブジェクトを指定した場合、 'args'
          および 'kwargs' の位置引数およびキーワード引数とともに呼び出し
          ます。

          *note Thread: 177. に渡される '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(): 1401. を呼ばれたスレッドが正常終了あるいは処理されない
          例外によって終了するか、オプションのタイムアウトが発生するまで
          、メソッドの呼び出し元のスレッドをブロックします。

          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 ‘join()’
          always returns ‘None’, you must call *note is_alive(): b4a.
          after ‘join()’ to decide whether a timeout happened - if the
          thread is still alive, the ‘join()’ call timed out.

          'timeout' が指定されないかまたは ‘None’ であるときは、この操作
          はスレッドが終了するまでブロックします。

          1つのスレッドは何回も join されることができます。

          現在のスレッドに対して *note join(): 1401. を呼び出そうとする
          と、デッドロックを引き起こすため *note RuntimeError: 246. が送
          出されます。 スレッドが開始される前に ‘join()’ を呼び出すこと
          も同様のエラーのため、同じ例外が送出されます。

          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: 2a2. に対する非推奨 getter/setter API; 代わりにプ
          ロパティを直接使用してください。

          バージョン 3.10 で非推奨.

      -- の属性: ident

          'スレッド識別子' 、または、スレッドが開始されていなければ
          ‘None’ です。非ゼロの整数です。 *note get_ident(): 1376. 関数
          を参照下さい。スレッド識別子は、スレッドが終了した後、新たなス
          レッドが生成された場合、再利用され得ます。スレッド識別子は、ス
          レッドが終了した後でも利用できます。

      -- の属性: 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():
          c36. 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: 2199.: Windows, FreeBSD, Linux, macOS,
          OpenBSD, NetBSD, AIX, DragonFlyBSD.

          Added in version 3.8.

      -- メソッド: is_alive ()

          スレッドが生存中かどうかを返します。

          このメソッドは、 *note run(): c35. メソッドが起動する直前から
          ‘run()’ メソッドが終了する直後までの間 ‘True’ を返します。モジ
          ュール関数 *note enumerate(): 1cb7. は、全ての生存中のスレッド
          のリストを返します。

      -- の属性: daemon

          このスレッドがデーモンスレッドか (‘True’) か否か (‘False’) を
          示すブール値。この値は *note start(): 179. の呼び出し前に設定
          されなければなりません。さもなければ *note RuntimeError: 246.
          が送出されます。初期値は生成側のスレッドから継承されます; メイ
          ンスレッドはデーモンスレッドではないので、メインスレッドで作成
          されたすべてのスレッドは、デフォルトで *note daemon: 35a. =
          ‘False’ になります。

          デーモンでない生存中のスレッドが全てなくなると、 Python プログ
          ラム全体が終了します。

      -- メソッド: isDaemon ()
      -- メソッド: setDaemon ()

          *note daemon: 35a. に対する非推奨 getter/setter API; 代わりに
          プロパティを直接使用してください。

          バージョン 3.10 で非推奨.


File: python.info,  Node: Lock objects,  Next: RLock objects,  Prev: Thread objects,  Up: リファレンス<2>

5.19.1.6 Lock objects
.....................

プリミティブロックとは、ロックが生じた際に特定のスレッドによって所有され
ない同期プリミティブです。 Python では現在のところ拡張モジュール *note
_thread: 2. で直接実装されている最も低水準の同期プリミティブを使えます。

プリミティブロックは2つの状態、 "ロック" または "アンロック" があります
。ロックはアンロック状態で作成されます。ロックには基本となる二つのメソッ
ド、 *note acquire(): 8a8. と *note release(): 14de. があります。ロック
の状態がアンロックである場合、 ‘acquire()’ は状態をロックに変更して即座
に処理を戻します。 状態がロックの場合、 ‘acquire()’ は他のスレッドが
‘release()’ を呼び出してロックの状態をアンロックに変更するまでブロックし
ます。その後、 ‘acquire()’ 呼び出しは状態を再度ロックに設定してから処理
を戻します。 ‘release()’ メソッドを呼び出すのはロック状態のときでなけれ
ばなりません; このメソッドはロックの状態をアンロックに変更して、即座に処
理を戻します。 アンロックの状態のロックを解放しようとすると *note
RuntimeError: 246. が送出されます。

ロックは *note コンテキストマネージメントプロトコル: 36c2. もサポートし
ます。

複数のスレッドにおいて *note acquire(): 8a8. がアンロック状態への遷移を
待っているためにブロックが起きている時に *note release(): 14de. を呼び出
してロックの状態をアンロックにすると、一つのスレッドだけが処理を進行でき
ます。 どのスレッドが処理を進行できるのかは定義されておらず、実装によっ
て異なるかもしれません。

全てのメソッドはアトミックに実行されます。

 -- クラス: 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’ を返します。

          When invoked with the floating-point 'timeout' argument set to
          a positive value, block for at most the number of seconds
          specified by 'timeout' and as long as the lock cannot be
          acquired.  A 'timeout' argument of ‘-1’ specifies an unbounded
          wait.  It is forbidden to specify a 'timeout' when 'blocking'
          is ‘False’.

          ロックを獲得すると ‘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: 246. が送出されます。

          戻り値はありません。

      -- メソッド: locked ()

          ロック状態のとき ‘True’ を返します。


File: python.info,  Node: RLock objects,  Next: Condition objects,  Prev: Lock objects,  Up: リファレンス<2>

5.19.1.7 RLock objects
......................

再入可能ロック (reentrant lock) とは、同じスレッドが複数回獲得できるよう
な同期プリミティブです。再入可能ロックの内部では、プリミティブロックの使
うロック／アンロック状態に加え、 "所有スレッド (owning thread)" と "再帰
レベル (recursion level)" という概念を用いています。ロック状態では何らか
のスレッドがロックを所有しており、アンロック状態ではいかなるスレッドもロ
ックを所有していません。

Threads call a lock's *note acquire(): 107f. method to lock it, and its
*note release(): 14de. method to unlock it.

     注釈: Reentrant locks support the *note context management
     protocol: 36c2, so it is recommended to use *note with: 187.
     instead of manually calling *note acquire(): 107f. and *note
     release(): 36c6. to handle acquiring and releasing the lock for a
     block of code.

RLock's *note acquire(): 107f./*note release(): 36c6. call pairs may be
nested, unlike Lock's *note acquire(): 8a8./*note release(): 14de.  Only
the final ‘release()’ (the ‘release()’ of the outermost pair) resets the
lock to an unlocked state and allows another thread blocked in
‘acquire()’ to proceed.

*note acquire(): 107f./*note release(): 36c6. 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: 36c2.

               Recommended over manual ‘acquire()’ and *note release():
               36c6. 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: 1a54. and ‘RLock’;
                    ‘Lock’ 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():
          36c6. 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: 246. 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.19.1.8 Condition objects
..........................

条件変数 (condition variable) は、常にある種のロックに関連付けられていま
す; このロックは明示的に渡すことも、デフォルトで生成させることもできます
。複数の条件変数で同じロックを共有しなければならない場合には、引渡しによ
る関連付けが便利です。ロックは条件オブジェクトの一部です: それを別々に扱
う必要はありません。

条件変数は *note コンテキスト管理プロトコル: 36c2. に従います: ‘with’ 文
を使って囲まれたブロックの間だけ関連付けられたロックを獲得することができ
ます。 *note acquire(): 36c9. メソッドと *note release(): 36ca. メソッド
は、さらに関連付けられたロックの対応するメソッドを呼び出します。

他のメソッドは、関連付けられたロックを保持した状態で呼び出さなければなり
ません。 *note wait(): 1cc3. メソッドはロックを解放します。そして別のス
レッドが *note notify(): 1bc5. または *note notify_all(): 357. を呼ぶこ
とによってスレッドを起こすまでブロックします。一旦起こされたなら、
‘wait()’ は再びロックを得て戻ります。タイムアウトを指定することも可能で
す。

*note notify(): 1bc5. メソッドは条件変数待ちのスレッドを1つ起こします。
*note notify_all(): 357. メソッドは条件変数待ちの全てのスレッドを起こし
ます。

注意: *note notify(): 1bc5. と *note notify_all(): 357. はロックを解放し
ません; 従って、スレッドが起こされたとき、 *note wait(): 1cc3. の呼び出
しは即座に処理を戻すわけではなく、 ‘notify()’ または ‘notify_all()’ を呼
び出したスレッドが最終的にロックの所有権を放棄したときに初めて処理を返す
のです。

条件変数を使う典型的なプログラミングスタイルでは、何らかの共有された状態
変数へのアクセスを同期させるためにロックを使います; 状態変数が特定の状態
に変化したことを知りたいスレッドは、自分の望む状態になるまで繰り返し
*note wait(): 1cc3. を呼び出します。その一方で、状態変更を行うスレッドは
、前者のスレッドが待ち望んでいる状態であるかもしれないような状態へ変更を
行ったときに *note notify(): 1bc5. や *note notify_all(): 357. を呼び出
します。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者
-消費者問題です:

     # 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(): 1cc3. が任意の長時間の後で返り、 *note notify(): 1bc5.
呼び出しを促した条件がもはや真でないことがありえるからです。これはマルチ
スレッドプログラミングに固有です。条件チェックを自動化するために *note
wait_for(): 36cb. メソッドを使うことができ、それはタイムアウトの計算を簡
略化します:

     # Consume an item
     with cv:
         cv.wait_for(an_item_is_available)
         get_an_available_item()

*note notify(): 1bc5. と *note notify_all(): 357. のどちらを使うかは、そ
の状態の変化に興味を持っている待ちスレッドが一つだけなのか、あるいは複数
なのかで考えます。例えば、典型的な生産者-消費者問題では、バッファに1つの
要素を加えた場合には消費者スレッドを 1 つしか起こさなくてかまいません。

 -- クラス: threading.Condition (lock=None)

     このクラスは条件変数 (condition variable) オブジェクトを実装します
     。条件変数を使うと、1つ以上のスレッドを別のスレッドの通知があるまで
     待機させておけます。

     'lock' に ‘None’ でない値を指定した場合、その値は *note Lock: 1a54.
     または *note RLock: 32c. オブジェクトでなければなりません。 この場
     合、 'lock' は根底にあるロックオブジェクトとして使われます。 それ以
     外の場合には、 ‘RLock’ オブジェクトを新しく作成して使います。

     バージョン 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: 246. が送出されます。

          このメソッドは根底にあるロックを解放し、他のスレッドが同じ条件
          変数に対して *note notify(): 1bc5. または *note notify_all():
          357. を呼び出して現在のスレッドを起こすか、オプションのタイム
          アウトが発生するまでブロックします。一度スレッドが起こされると
          、再度ロックを獲得して処理を戻します。

          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: 32c. である場合、 *note
          release(): 36ca. メソッドではロックは解放されません。というの
          も、ロックが再帰的に複数回獲得されている場合には、 ‘release()’
          によって実際にアンロックが行われないかもしれないからです。その
          代わり、ロックが再帰的に複数回獲得されていても確実にアンロック
          を行える ‘RLock’ クラスの内部インターフェースを使います。その
          後ロックを再獲得する時に、もう一つの内部インターフェースを使っ
          てロックの再帰レベルを復帰します。

          与えられた 'timeout' が過ぎていなければ返り値は ‘True’ です。
          タイムアウトした場合には ‘False’ が返ります。

          バージョン 3.2 で変更: 以前は、このメソッドは常に ‘None’ を返
          していました。

      -- メソッド: wait_for (predicate, timeout=None)

          条件が真と判定されるまで待ちます。 'predicate' は呼び出し可能
          オブジェクトでなければならず、その結果はブール値として解釈され
          ます。 最大の待ち時間を指定する 'timeout' を与えることができま
          す。

          このユーティリティメソッドは、述語が満たされるかタイムアウトが
          発生するまで *note wait(): 1cc3. を繰り返し呼び出す場合があり
          ます。戻り値は述語の最後の戻り値で、もしメソッドがタイムアウト
          すれば、 ‘False’ と評価されます。

          タイムアウト機能を無視すれば、このメソッドの呼び出しは以下のよ
          うに書くのとほぼ等価です:

               while not predicate():
                   cv.wait()

          したがって、 *note wait(): 1cc3. と同じルールが適用されます: 呼
          び出された時にロックを保持していなければならず、戻るときにロッ
          クが再度獲得されます。述語はロックを保持した状態で評価されます
          。

          Added in version 3.2.

      -- メソッド: notify (n=1)

          デフォルトで、この条件変数を待っている1つのスレッドを起こしま
          す。 呼び出し側のスレッドがロックを獲得していないときにこのメ
          ソッドを呼び出すと *note RuntimeError: 246. が送出されます。

          何らかの待機中スレッドがある場合、そのうち 'n' スレッドを起こ
          します。待機中のスレッドがなければ何もしません。

          現在の実装では、少なくとも 'n' スレッドが待機中であれば、ちょ
          うど 'n' スレッドを起こします。とはいえ、この挙動に依存するの
          は安全ではありません。将来、実装の最適化によって、複数のスレッ
          ドを起こすようになるかもしれないからです。

          注意: 起こされたスレッドは実際にロックを再獲得できるまで *note
          wait(): 1cc3. 呼び出しから戻りません。 *note notify(): 1bc5. は
          ロックを解放しないので、 ‘notify()’ 呼び出し側は明示的にロック
          を解放しなければなりません。

      -- メソッド: notify_all ()

          この条件を待っているすべてのスレッドを起こします。このメソッド
          は *note notify(): 1bc5. のように動作しますが、 1 つではなくす
          べての待ちスレッドを起こします。呼び出し側のスレッドがロックを
          獲得していない場合、 *note RuntimeError: 246. が送出されます。

          関数''notifyAll''はこの関数の非推奨エイリアスです。


File: python.info,  Node: Semaphore objects,  Next: Semaphore example,  Prev: Condition objects,  Up: リファレンス<2>

5.19.1.9 Semaphore objects
..........................

セマフォ (semaphore) は、計算機科学史上最も古い同期プリミティブの一つ で
、草創期のオランダ計算機科学者 Edsger W. Dijkstra によって発明されました
(彼は *note acquire(): 146f. と *note release(): 36cf. の代わりに ‘P()’
と ‘V()’ を使いました)。

セマフォは *note acquire(): 146f. でデクリメントされ *note release():
36cf. でインクリメントされるような内部カウンタを管理します。 カウンタは
決してゼロより小さくはなりません; ‘acquire()’ は、カウンタがゼロになって
いる場合、他のスレッドが ‘release()’ を呼び出すまでブロックします。

セマフォは *note コンテキストマネージメントプロトコル: 36c2. もサポート
します。

 -- クラス: threading.Semaphore (value=1)

     このクラスはセマフォ (semaphore) オブジェクトを実装します。セマフォ
     は、 *note release(): 36cf. を呼び出した数から *note acquire():
     146f. を呼び出した数を引き、初期値を足した値を表す極小のカウンタを
     管理します。 ‘acquire()’ メソッドは、カウンタの値を負にせずに処理を
     戻せるまで必要ならば処理をブロックします。 'value' を指定しない場合
     、デフォルトの値は 1 になります。

     オプションの引数には、内部カウンタの初期値を指定します。デフォルト
     は ‘1’ です。与えられた 'value' が 0 より小さい場合、 *note
     ValueError: 2ee. が送出されます。

     バージョン 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(): 36cf.  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 ‘release()’.  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: 2ee. を送出します。た
     いていの場合、セマフォは限られた容量のリソースを保護するために使わ
     れるものです。従って、あまりにも頻繁なセマフォの解放はバグが生じて
     いるしるしです。 'value' を指定しない場合、デフォルトの値は 1 にな
     ります。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。


File: python.info,  Node: Semaphore example,  Next: Event objects,  Prev: Semaphore objects,  Up: リファレンス<2>

5.19.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.19.1.11 Event objects
.......................

イベントは、あるスレッドがイベントを発信し、他のスレッドはそれを待つとい
う、スレッド間で通信を行うための最も単純なメカニズムの一つです。

イベントオブジェクトは内部フラグを管理します。このフラグは *note set():
36d4. メソッドで値を true に、 *note clear(): 36d5. メソッドで値を false
にリセットします。 *note wait(): 1542. メソッドはフラグが true になるま
でブロックします。

 -- クラス: threading.Event

     イベントオブジェクトを実装しているクラスです。イベントは *note
     set(): 36d4. メソッドを使うと *note True: e0b. に、 *note clear():
     36d5. メソッドを使うと *note False: d2f. にセットされるようなフラグ
     を管理します。 *note wait(): 1542. メソッドは、全てのフラグが true
     になるまでブロックするようになっています。フラグの初期値は false で
     す。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: is_set ()

          内部フラグが真のとき ‘True’ を返します。

          メソッド ‘isSet’ はこのメソッドの非推奨エイリアスです。

      -- メソッド: set ()

          内部フラグの値を true にセットします。フラグの値が true になる
          のを待っている全てのスレッドを起こします。一旦フラグが true に
          なると、スレッドが *note wait(): 1542. を呼び出しても全くブロ
          ックしなくなります。

      -- メソッド: clear ()

          内部フラグの値を false にリセットします。以降は、 *note set():
          36d4. を呼び出して再び内部フラグの値を true にセットするまで、
          *note wait(): 1542. を呼び出したスレッドはブロックするようにな
          ります。

      -- メソッド: 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.19.1.12 Timer objects
.......................

このクラスは、一定時間経過後に実行される活動、すなわちタイマ活動を表現し
ます。 *note Timer: 1375. は *note Thread: 177. のサブクラスであり、自作
のスレッドを構築した一例でもあります。

Timers are started, as with threads, by calling their *note Timer.start:
179. method.  The timer can be stopped (before its action has begun) by
calling the *note cancel(): 36d8. 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.19.1.13 Barrier objects
.........................

Added in version 3.2.

このクラスは、互いを待つ必要のある固定の数のスレッドで使用するための単純
な同期プリミティブを提供します。それぞれのスレッドは *note wait(): 36da.
メソッドを呼ぶことによりバリアを通ろうとしてブロックします。すべてのスレ
ッドがそれぞれの ‘wait()’ メソッドを呼び出した時点で、すべてのスレッドが
同時に解放されます。

バリアは同じ数のスレッドに対して何度でも再利用することができます。

例として、クライアントとサーバの間でスレッドを同期させる単純な方法を紹介
します:

     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(): 36da. メソッドに対して 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: 1402. 例外を送
          出するかもしれません。

      -- メソッド: reset ()

          バリアをデフォルトの空の状態に戻します。そのバリアの上で待って
          いるすべてのスレッドは *note BrokenBarrierError: 1402. 例外を
          受け取ります。

          状態が未知の他のスレッドがある場合、この関数を使用するのに何ら
          かの外部同期を必要とするかもしれないことに注意してください。バ
          リアが broken な場合、単にそれをそのままにして新しいものを作成
          する方がよいでしょう。

      -- メソッド: abort ()

          バリアを broken な状態にします。これによって、現在または将来の
          *note wait(): 36da. 呼び出しが *note BrokenBarrierError: 1402.
          とともに失敗するようになります。これを使うと、例えばスレッドが
          異常終了する必要がある場合にアプリケーションがデッドロックする
          のを避けることができます。

          スレッドのうちの1つが返ってこないことに対して自動的に保護する
          ように、単純に常識的な 'timeout' 値でバリアを作成することは望
          ましいかもしれません。

      -- の属性: parties

          バリアを通るために要求されるスレッドの数。

      -- の属性: n_waiting

          現在バリアの中で待っているスレッドの数。

      -- の属性: broken

          バリアが broken な状態である場合に ‘True’ となるブール値。

 -- 例外: threading.BrokenBarrierError

     *note Barrier: 1400. オブジェクトがリセットされるか broken な場合に
     、この例外 (*note RuntimeError: 246. のサブクラス) が送出されます。


File: python.info,  Node: with 文でのロック・条件変数・セマフォの使い方,  Prev: リファレンス<2>,  Up: threading --- スレッドベースの並列処理

5.19.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: 187.
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: 1a54. 、 *note RLock: 32c. 、 *note
Condition: 1371. 、 *note Semaphore: 1372. 、 *note BoundedSemaphore:
1373. を *note with: 187. 文のコンテキストマネージャとして使うことができ
ます。


File: python.info,  Node: multiprocessing --- プロセスベースの並列処理,  Next: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ,  Prev: threading --- スレッドベースの並列処理,  Up: 並行実行

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

'ソースコード:' Lib/multiprocessing/(1)

__________________________________________________________________

*note Availability: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

* 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.19.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: 1171.
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 ‘Pool’,

     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: 18bc, *note interrupt: 253. or *note kill: d53. a running
process.

参考
....

*note concurrent.futures.ProcessPoolExecutor: 1d8. 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:
1171. 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.19.2.2 ‘Process’ クラス
.........................

In ‘multiprocessing’, processes are spawned by creating a *note Process:
254. object and then calling its *note start(): 15ad. method.  ‘Process’
follows the API of *note threading.Thread: 177.  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
プログラミングガイドライン: 36e6. を参照してください。

The arguments to *note Process: 254. usually need to be picklable so
they can be passed to 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.19.2.3 コンテキストと開始方式
...............................

Depending on the platform, ‘multiprocessing’ supports three ways to
start a process.  These 'start methods' are

     'spawn'

          親プロセスは新たに Python インタープリタープロセスを開始します
          。子プロセスはプロセスオブジェクトの *note run(): 36e8. メソッ
          ドの実行に必要なリソースのみ継承します。特に、親プロセスからの
          不要なファイル記述子とハンドルは継承されません。この方式を使用
          したプロセスの開始は '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(): 24c. or *note
          set_start_method(): 24d.

          バージョン 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: 1a4.  Use a different start method.
          See the ‘os.fork()’ 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: 1a37.
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(): 24d. によって指定します。以下に例を示します:

     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(): 24d. はプログラム内で複数回使用してはいけ
ません。

もうひとつの方法として、*note get_context(): 24c. を使用してコンテキスト
オブジェクトを取得することができます。コンテキストオブジェクトは
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: 1d8.
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.19.2.4 プロセス間でのオブジェクト交換
.......................................

‘multiprocessing’ supports two types of communication channel between
processes:

'キュー (Queue)'

     *note Queue: 1be7. クラスは *note queue.Queue: 15b0. クラスとほとん
     ど同じように使うことができます。以下に例を示します:

          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(): 36ea. 関数はパイプで繋がれたコネクションオブジェクト
     のペアを返します。デフォルトでは双方向性パイプを返します。以下に例
     を示します:

          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(): 36ea. 関数から返されます。各コネクションオブジェクトには、
     ‘send()’、 ‘recv()’、その他のメソッドがあります。2つのプロセス (ま
     たはスレッド) がパイプの '同じ' 端で同時に読み込みや書き込みを行う
     と、パイプ内のデータが破損してしまうかもしれないことに注意してくだ
     さい。もちろん、各プロセスがパイプの別々の端を同時に使用するならば
     、データが破壊される危険性はありません。

     The ‘send()’ method serializes the object and ‘recv()’ re-creates
     the object.


File: python.info,  Node: プロセス間の同期,  Next: プロセス間での状態の共有,  Prev: プロセス間でのオブジェクト交換,  Up: はじめに<9>

5.19.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.19.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: 36ed. クラス、も
     しくは *note Array: 36ee. クラスを使用することができます。以下のサ
     ンプルコードを使って、この機能についてみていきましょう

          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(): 252. 関数により生成されたマネージャーオブジェクト
     はサーバープロセスを管理します。マネージャーオブジェクトは Python の
     オブジェクトを保持して、他のプロセスがプロキシ経由でその Python オ
     ブジェクトを操作することができます。

     A manager returned by *note Manager(): 252. will support types
     *note list: 24f, *note dict: 184, *note set: 185, *note Namespace:
     36ef, *note Lock: 18b8, *note RLock: 18b9, *note Semaphore: 36f0,
     *note BoundedSemaphore: 36f1, *note Condition: 36f2, *note Event:
     1c63, *note Barrier: 36f3, *note Queue: 1be7, *note Value: 36ed.
     and *note Array: 36ee.  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.19.2.7 ワーカープロセスのプールを使用
.......................................

*note Pool: 1171. クラスは、ワーカープロセスをプールする機能を備えていま
す。このクラスには、異なる方法でワーカープロセスへタスクを割り当てるいく
つかのメソッドがあります。

例えば:

     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 プログラミングガイドライン: 36e6. で触れていますが
     、ここであらためて強調しておきます。なぜかというと、いくつかのサン
     プルコード、例えば *note multiprocessing.pool.Pool: 1171. のサンプ
     ルはインタラクティブシェル上では動作しないからです。以下に例を示し
     ます:

          >>> 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.19.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.19.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.19.2.10 ‘Process’ クラスと例外
................................

 -- クラス: multiprocessing.Process (group=None, target=None, name=None,
          args=(), kwargs={}, *, daemon=None)

     Process オブジェクトは各プロセスの処理を表します。 *note Process:
     254. クラスは *note threading.Thread: 177. クラスのすべてのメソッド
     と同じインターフェースを提供します。

     The constructor should always be called with keyword arguments.
     'group' should always be ‘None’; it exists solely for compatibility
     with *note threading.Thread: 177.  'target' is the callable object
     to be invoked by the *note run(): 36e8. method.  It defaults to
     ‘None’, meaning nothing is called.  'name' is the process name (see
     *note name: 36f9. 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: 36fa. 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 ‘Process’ must be
          picklable.  This is frequently observed when trying to create
          a ‘Process’ or use a *note
          concurrent.futures.ProcessPoolExecutor: 1d8. 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 の場合: 36fb.
          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 コンテキストと開始方式: 1d7.  See
          also gh-132898(1).

     バージョン 3.3 で変更: Added the 'daemon' parameter.

      -- メソッド: run ()

          プロセスが実行する処理を表すメソッドです。

          このメソッドはサブクラスでオーバーライドすることができます。標
          準の *note run(): 36e8. メソッドは、コンストラクターの target
          引数として渡された呼び出し可能オブジェクトを呼び出します。もし
          コンストラクターに 'args' もしくは 'kwargs' 引数が渡されていれ
          ば、呼び出すオブジェクトにこれらの引数を渡します。

          *note Process: 254. に渡される '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(): 36e8.
          メソッドを呼び出す準備を行います。

      -- メソッド: join ([timeout])

          オプションの引数 'timeout' が ‘None’ (デフォルト) の場合、
          *note join(): 15af. メソッドが呼ばれたプロセスは処理が終了する
          までブロックします。 'timeout' が正の数である場合、最大
          'timeout' 秒ブロックします。 プロセスが終了あるいはタイムアウ
          トした場合、メソッドは ‘None’ を返すことに注意してください。 プ
          ロセスの *note exitcode: 36fc. を確認し終了したかどうかを判断
          してください。

          1つのプロセスは何回も join されることができます。

          プロセスは自分自身を join することはできません。それはデッドロ
          ックを引き起こすことがあるからです。プロセスが start される前
          に join しようとするとエラーが発生します。

      -- の属性: name

          プロセスの名前。名前は識別のためだけに使用される文字列です。そ
          れ自体には特別な意味はありません。複数のプロセスに同じ名前が与
          えられても構いません。

          最初の名前はコンストラクターによってセットされます。コンストラ
          クターに明示的な名前が渡されない場合、
          'Process-N[1]:N[2]:...:N[k]' 形式の名前が構築されます。ここで
          それぞれの N[k] はその親のN番目の子供です。

      -- メソッド: is_alive ()

          プロセスが実行中かを判別します。

          おおまかに言って、プロセスオブジェクトは *note start(): 15ad.
          メソッドを呼び出してから子プロセス終了までの期間が実行中となり
          ます。

      -- の属性: daemon

          デーモンプロセスであるかのフラグであり、ブール値です。この属性
          は *note start(): 15ad. が呼び出される前に設定されている必要が
          あります。

          初期値は作成するプロセスから継承します。

          あるプロセスが終了するとき、そのプロセスはその子プロセスである
          デーモンプロセスすべてを終了させようとします。

          デーモンプロセスは子プロセスを作成できないことに注意してくださ
          い。もし作成できてしまうと、そのデーモンプロセスの親プロセスが
          終了したときにデーモンプロセスの子プロセスが孤児になってしまう
          場合があるからです。さらに言えば、デーモンプロセスはUnix デー
          モンやサービスでは 'なく' 通常のプロセスであり、非デーモンプロ
          セスが終了すると終了されます (そして join されません)。

     *note threading.Thread: 177. クラスの API に加えて *note Process:
     254. クラスのオブジェクトには以下の属性およびメソッドがあります:

      -- の属性: 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(): 36e8. method returned normally,
          the exit code will be 0.  If it terminated via *note
          sys.exit(): 279. with an integer argument 'N', the exit code
          will be 'N'.

          If the child terminated due to an exception not caught within
          *note run(): 36e8, 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: 254. クラスのオブジェクトの作成時にその親プロセ
          スから認証キーを継承します。もしくは *note authkey: 36fe. に別
          のバイト文字列を設定することもできます。

          詳細は *note 認証キー: 36ff. を参照してください。

      -- の属性: sentinel

          プロセスが終了するときに "ready" となるシステムオブジェクトの
          数値ハンドル。

          You can use this value if you want to wait on several events
          at once using *note multiprocessing.connection.wait(): 12fb.
          Otherwise calling *note join(): 15af. 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:
          255. signal.  Behavior on Windows is undefined.

          By default, this terminates the child process by raising *note
          KeyboardInterrupt: bc9.  This behavior can be altered by
          setting the respective signal handler in the child process
          *note signal.signal(): 1350. for *note SIGINT: 255.

          Note: if the child process catches and discards *note
          KeyboardInterrupt: bc9, the process will not be terminated.

          Note: the default behavior will also set *note exitcode: 36fc.
          to ‘1’ as if an uncaught exception was raised in the child
          process.  To have a different ‘exitcode’ you may simply catch
          *note KeyboardInterrupt: bc9. and call ‘exit(your_code)’.

          Added in version 3.14.

      -- メソッド: terminate ()

          Terminate the process.  On POSIX this is done using the *note
          SIGTERM: 15fd. signal; on Windows ‘TerminateProcess()’ is
          used.  Note that exit handlers and finally clauses, etc., will
          not be executed.

          このメソッドにより終了するプロセスの子孫プロセスは、終了 'しま
          せん' 。そういった子孫プロセスは単純に孤児になります。

               警告: このメソッドの使用時に、関連付けられたプロセスがパ
               イプやキューを使用している場合には、使用中のパイプやキュ
               ーが破損して他のプロセスから使用できなくなる可能性があり
               ます。同様に、プロセスがロックやセマフォなどを取得してい
               る場合には、このプロセスが終了してしまうと他のプロセスの
               デッドロックの原因になるでしょう。

      -- メソッド: kill ()

          Same as *note terminate(): 18bc. but using the ‘SIGKILL’
          signal on POSIX.

          Added in version 3.7.

      -- メソッド: close ()

          *note Process: 254. オブジェクトを閉じ、関連付けられていたすべ
          てのリソースを開放します。中のプロセスが実行中であった場合、
          *note ValueError: 2ee. を送出します。*note close(): d52. が成
          功した場合、‘Process’ オブジェクトの他のメソッドや属性は、ほと
          んどが ‘ValueError’ を送出します。

          Added in version 3.7.

     プロセスオブジェクトが作成したプロセスのみが *note start(): 15ad,
     *note join(): 15af, *note is_alive(): 15ae, *note terminate():
     18bc. と *note exitcode: 36fc. のメソッドを呼び出すべきです。

     以下の例では *note Process: 254. のメソッドの使い方を示しています:

          >>> 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: 3701. のインスタンスであるとすると、
     ‘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.19.2.11 パイプ (Pipe) とキュー (Queue)
........................................

複数のプロセスを使う場合、一般的にはメッセージパッシングをプロセス間通信
に使用し、ロックのような同期プリミティブを使用しないようにします。

メッセージのやりとりのために *note Pipe(): 36ea. (2つのプロセス間の通信
用)、もしくはキュー (複数のメッセージ生成プロセス (producer)、消費プロセ
ス (consumer) の実現用) を使うことができます。

*note Queue: 1be7, *note SimpleQueue: b14. と *note JoinableQueue: 3705.
型は複数プロセスから生成/消費を行う FIFO キューです。これらのキューは標
準ライブラリの *note queue.Queue: 15b0. を模倣しています。 ‘Queue’ には
Python 2.5 の ‘queue.Queue’ クラスで導入された *note task_done(): 3706.
と *note join(): 3707. メソッドがないことが違う点です。

もし *note JoinableQueue: 3705. を使用するなら、キューから削除される各タ
スクのために *note JoinableQueue.task_done(): 3708. を呼び出さなければ
'なりません' 。さもないと、いつか完了していないタスクを数えるためのセマ
フォがオーバーフローし、例外を発生させるでしょう。

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 マネージャー: 3709. を参照してください。

     注釈: ‘multiprocessing’ uses the usual *note queue.Empty: 370a. and
     *note queue.Full: 370b. 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: 3709. を使ってキューを作成することができるからです。

       1. 空のキューの中にオブジェクトを追加した後、キューの *note
          empty(): 19c8. メソッドが *note False: d2f. を返すまでの間にご
          くわずかな遅延が起きることがあり、*note get_nowait(): 370c. が
          *note queue.Empty: 370a. を発生させることなく制御が呼び出し元
          に返ってしまうことがあります。

       2. 複数のプロセスがオブジェクトをキューに詰めている場合、キューの
          反対側ではオブジェクトが詰められたのとは違う順序で取得される可
          能性があります。ただし、同一のプロセスから詰め込まれたオブジェ
          クトは、それらのオブジェクト間では、必ず期待どおりの順序になり
          ます。

     警告: *note Queue: 1be7. を利用しようとしている最中にプロセスを
     *note Process.terminate(): 18bc. や *note os.kill(): 1583. で終了さ
     せる場合、キューにあるデータは破損し易くなります。終了した後で他の
     プロセスがキューを利用しようとすると、例外を発生させる可能性があり
     ます。

     警告: 上述したように、もし子プロセスがキューへ要素を追加するなら (か
     つ *note JoinableQueue.cancel_join_thread: 370d. を使用しないなら)
     そのプロセスはバッファーされたすべての要素がパイプへフラッシュされ
     るまで終了しません。

     これは、そのプロセスを join しようとする場合、キューに追加されたす
     べての要素が消費されたことが確実でないかぎり、デッドロックを発生さ
     せる可能性があることを意味します。似たような現象で、子プロセスが非
     デーモンプロセスの場合、親プロセスは終了時に非デーモンのすべての子
     プロセスを join しようとしてハングアップする可能性があります。

     マネージャーを使用して作成されたキューではこの問題はありません。詳
     細は *note プログラミングガイドライン: 36e6. を参照してください。

プロセス間通信におけるキューの使用例を知りたいなら *note 使用例: 370e. を
参照してください。

 -- の関数: multiprocessing.Pipe (duplex=True)

     パイプの両端を表す *note Connection: 12fc. オブジェクトのペア
     ‘(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: 36f6. for more details.

     標準ライブラリの *note queue: bb. モジュールの通常の *note
     queue.Empty: 370a. や *note queue.Full: 370b. 例外がタイムアウトを
     伝えるために送出されます。

     *note Queue: 1be7. implements all the methods of *note queue.Queue:
     15b0. except for *note task_done(): 3706, *note join(): 3707, and
     *note shutdown(): 542.

      -- メソッド: qsize ()

          おおよそのキューのサイズを返します。マルチスレッディング/マル
          チプロセスの特性上、この数値は信用できません。

          Note that this may raise *note NotImplementedError: 369. on
          platforms like macOS where ‘sem_getvalue()’ is not
          implemented.

      -- メソッド: empty ()

          キューが空っぽなら ‘True’ を、そうでなければ ‘False’ を返しま
          す。マルチスレッディング/マルチプロセシングの特性上、これは信
          用できません。

          May raise an *note OSError: 2c2. on closed queues.  (not
          guaranteed)

      -- メソッド: full ()

          キューがいっぱいなら ‘True’ を、そうでなければ ‘False’ を返し
          ます。マルチスレッディング/マルチプロセシングの特性上、これは
          信用できません。

      -- メソッド: put (obj[, block[, timeout]])

          キューの中へ obj を追加します。オプションの引数 'block' が
          ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) なら
          、空きスロットが利用可能になるまで必要であればブロックします。
          'timeout' が正の数なら、最大 'timeout' 秒ブロックして、その時
          間内に空きスロットが利用できなかったら *note queue.Full: 370b.
          例外を発生させます。それ以外 ('block' が ‘False’) で、空きスロ
          ットがすぐに利用可能な場合はキューに要素を追加します。そうでな
          ければ ‘queue.Full’ 例外が発生します(その場合 'timeout' は無視
          されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 2ee. is raised instead of *note AssertionError:
          8b9.

      -- メソッド: put_nowait (obj)

          ‘put(obj, False)’ と等価です。

      -- メソッド: get ([block[, timeout]])

          キューから要素を取り出して削除します。オプションの引数 'block'
          が ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) な
          ら、要素が取り出せるまで必要であればブロックします。 'timeout'
          が正の数なら、最大 'timeout' 秒ブロックして、その時間内に要素
          が取り出せなかったら *note queue.Empty: 370a. 例外を発生させま
          す。それ以外 ('block' が ‘False’) で、要素がすぐに取り出せる場
          合は要素を返します。そうでなければ ‘queue.Empty’ 例外が発生し
          ます(その場合 'timeout' は無視されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 2ee. is raised instead of *note OSError: 2c2.

      -- メソッド: get_nowait ()

          ‘get(False)’ と等価です。

     *note multiprocessing.Queue: 1be7. は *note queue.Queue: 15b0. には
     ない追加メソッドがあります。 これらのメソッドは通常、ほとんどのコー
     ドに必要ありません:

      -- メソッド: close ()

          Close the queue: release internal resources.

          A queue must not be used anymore after it is closed.  For
          example, *note get(): 1e7a, *note put(): 1e79. and *note
          empty(): 19c8. 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(): 1be8. が呼び出された後でのみ使用されます。バッファー
          されたすべてのデータがパイプへフラッシュされるのを保証するため
          、バックグラウンドスレッドが終了するまでブロックします。

          デフォルトでは、あるプロセスがキューを作成していない場合、終了
          時にキューのバックグラウンドスレッドを join しようとします。そ
          のプロセスは *note join_thread(): 3712. が何もしないように
          *note cancel_join_thread(): 370d. を呼び出すことができます。

      -- メソッド: cancel_join_thread ()

          *note join_thread(): 3712. がブロッキングするのを防ぎます。特
          にこれはバックグラウンドスレッドがそのプロセスの終了時に自動的
          に join されるのを防ぎます。詳細は ‘join_thread()’ を参照して
          ください。

          このメソッドは ‘allow_exit_without_flush()’ という名前のほうが
          よかったかもしれません。キューに追加されたデータが失われてしま
          いがちなため、このメソッドを使う必要はほぼ確実にないでしょう。
          本当にこれが必要になるのは、キューに追加されたデータを下位層の
          パイプにフラッシュすることなくカレントプロセスを直ちに終了する
          必要があり、かつ失われるデータに関心がない場合です。

          注釈: このクラスに含まれる機能には、ホストとなるオペレーティン
          グシステム上で動作している共有セマフォ (shared semaphore) を使
          用しているものがあります。これが使用できない場合には、このクラ
          スが無効になり、 *note Queue: 1be7. をインスタンス化する時に
          *note ImportError: 65b. が発生します。詳細は bpo-3770(1) を参
          照してください。同様のことが、以下に列挙されている特殊なキュー
          でも成り立ちます。

 -- クラス: multiprocessing.SimpleQueue

     単純化された *note Queue: 1be7. 型です。ロックされた *note Pipe:
     36ea. と非常に似ています。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. 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(): 3713, *note put(): 3714. and *note
          empty(): 19c9. methods must no longer be called.

          Added in version 3.9.

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

          Always raises an *note OSError: 2c2. if the SimpleQueue is
          closed.

      -- メソッド: get ()

          キューから要素を削除して返します。

      -- メソッド: put (item)

          'item' をキューに追加します。

 -- クラス: multiprocessing.JoinableQueue ([maxsize])

     *note JoinableQueue: 3705. は *note Queue: 1be7. のサブクラスであり
     、 *note task_done(): 3708. や *note join(): 3715. メソッドが追加さ
     れているキューです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

      -- メソッド: task_done ()

          以前にキューへ追加されたタスクが完了したことを表します。キュー
          のコンシューマによって使用されます。 タスクをフェッチするため
          に使用されるそれぞれの *note get(): 1e7a. に対して、 後続の
          *note task_done(): 3708. 呼び出しはタスクの処理が完了したこと
          をキューへ伝えます。

          もし *note join(): 3707. がブロッキング状態なら、 すべての要素
          が処理されたときに復帰します( *note task_done(): 3708. 呼び出
          しが すべての要素からキュー内へ *note put(): 1e79. されたと受
          け取ったことを意味します)。

          キューにある要素より多く呼び出された場合 *note ValueError:
          2ee. が発生します。

      -- メソッド: join ()

          キューにあるすべてのアイテムが取り出されて処理されるまでブロッ
          クします。

          キューに要素が追加されると未完了タスク数が増えます。コンシュー
          マがキューの要素が取り出されてすべての処理が完了したことを表す
          *note task_done(): 3708. を呼び出すと数が減ります。 未完了タス
          ク数がゼロになると *note join(): 3707. はブロッキングを解除し
          ます。

   ---------- 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.19.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: 369. 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: 170. 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: 254. オブジェクトを返しま
     す。

     *note threading.current_thread(): 35c. とよく似た関数です。

 -- の関数: multiprocessing.parent_process ()

     Return the *note Process: 254. object corresponding to the parent
     process of the *note current_process(): 3718.  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: 246. を発生させます。

     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 コンテキストと開始方式: 1d7.

     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: 36f6. for more
     details.  Otherwise 'method' should be ‘'fork'’, ‘'spawn'’,
     ‘'forkserver'’.  *note ValueError: 2ee. is raised if the specified
     start method is not available.  See *note コンテキストと開始方式:
     1d7.

     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: 36f6. for more details.

     The return value can be ‘'fork'’, ‘'spawn'’, ‘'forkserver'’ or
     ‘None’.  See *note コンテキストと開始方式: 1d7.

     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: 3eb. 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: 254.).

     Only meaningful when using the ‘'forkserver'’ start method.  See
     *note コンテキストと開始方式: 1d7.

     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: 246. 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 コンテキストと開始方式: 1d7.

     Added in version 3.4.

     注釈: ‘multiprocessing’ contains no analogues of *note
     threading.active_count(): 35d, *note threading.enumerate(): 1cb7,
     *note threading.settrace(): a4c, *note threading.setprofile(): a4d,
     *note threading.Timer: 1375, or *note threading.local: 18c4.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33725


File: python.info,  Node: Connection オブジェクト<2>,  Next: 同期プリミティブ,  Prev: その他<5>,  Up: リファレンス<3>

5.19.2.13 Connection オブジェクト
.................................

Connection オブジェクトは pickle でシリアライズ可能なオブジェクトか文字
列を送ったり、受け取ったりします。そういったオブジェクトはメッセージ指向
の接続ソケットと考えられます。

Connection オブジェクトは通常は *note Pipe: 36ea. を使用して作成されます
。 詳細は *note リスナーとクライアント: 371b. も参照してください。

 -- クラス: multiprocessing.connection.Connection

      -- メソッド: send (obj)

          コネクションの相手側へ *note recv(): 371d. を使用して読み込む
          オブジェクトを送ります。

          オブジェクトは pickle でシリアライズ可能でなければなりません。
          pickle が極端に大きすぎる (OS にも依りますが、およそ 32 MiB+)
          と、 *note ValueError: 2ee. 例外が送出されることがあります。

      -- メソッド: recv ()

          コネクションの相手側から *note send(): 371c. を使用して送られ
          たオブジェクトを返します。 何か受け取るまでブロックします。何
          も受け取らずにコネクションの相手側でクローズされた場合 *note
          EOFError: 14f5. が発生します。

      -- メソッド: fileno ()

          コネクションが使用するハンドラーか、ファイル記述子を返します。

      -- メソッド: close ()

          コネクションをクローズします。

          コネクションがガベージコレクトされるときに自動的に呼び出されま
          す。

      -- メソッド: poll ([timeout])

          読み込み可能なデータがあるかどうかを返します。

          'timeout' が指定されていなければすぐに返します。 'timeout' に
          数値を指定すると、最大指定した秒数をブロッキングします。
          'timeout' に ‘None’ を指定するとタイムアウトせずにずっとブロッ
          キングします。

          *note multiprocessing.connection.wait(): 12fb. を使って複数の
          コネクションオブジェクトを同時にポーリングできることに注意して
          ください。

      -- メソッド: send_bytes (buf[, offset[, size]])

          *note bytes-like object: 194. から完全なメッセージとしてバイト
          データを送ります。

          If 'offset' is given then data is read from that position in
          'buf'.  If 'size' is given then that many bytes will be read
          from 'buf'.  Very large buffers (approximately 32 MiB+, though
          it depends on the OS) may raise a *note ValueError: 2ee.
          exception

      -- メソッド: recv_bytes ([maxlength])

          コネクションの相手側から送られたバイトデータの完全なメッセージ
          を文字列として返します。何か受け取るまでブロックします。受け取
          るデータが何も残っておらず、相手側がコネクションを閉じていた場
          合、 *note EOFError: 14f5. が送出されます。

          'maxlength' を指定していて、かつメッセージが 'maxlength' より
          長い場合、 *note OSError: 2c2. が発生してコネクションからそれ
          以上読めなくなります。

          バージョン 3.3 で変更: この関数は以前は *note IOError: 1262. を
          送出していました。今では *note OSError: 2c2. の別名です。

      -- メソッド: recv_bytes_into (buf[, offset])

          Read into 'buf' a complete message of byte data sent from the
          other end of the connection and return the number of bytes in
          the message.  Blocks until there is something to receive.
          Raises *note EOFError: 14f5. if there is nothing left to
          receive and the other end was closed.

          'buf' must be a writable *note bytes-like object: 194.  If
          'offset' is given then the message will be written into the
          buffer from that position.  Offset must be a non-negative
          integer less than the length of 'buf' (in bytes).

          バッファーがあまりに小さいと ‘BufferTooShort’ 例外が発生します
          。 ‘e’ が例外インスタンスとすると完全なメッセージは
          ‘e.args[0]’ で確認できます。

     バージョン 3.3 で変更: *note Connection.send(): 371c. と *note
     Connection.recv(): 371d. を使用して Connection オブジェクト自体をプ
     ロセス間で転送できるようになりました。

     Connection objects also now support the context management protocol
     - see *note コンテキストマネージャ型: 246c.  *note __enter__():
     2701. returns the connection object, and *note __exit__(): 2702.
     calls *note close(): 371f.

例えば:

     >>> 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(): 371d. メソッドは受信したデータを自動
     的に unpickle 化します。それはメッセージを送ったプロセスが信頼でき
     る場合を除いてセキュリティリスクになります。

     そのため ‘Pipe()’ を使用してコネクションオブジェクトを生成する場合
     を除いて、何らかの認証処理を実行した後で *note recv(): 371d. や
     *note send(): 371c. メソッドのみを使用すべきです。詳細は *note
     認証キー: 36ff. を参照してください。

     警告: もしプロセスがパイプの読み込みまたは書き込み中に kill される
     と、メッセージの境界がどこなのか分からなくなってしまうので、そのパ
     イプ内のデータは破損してしまいがちです。


File: python.info,  Node: 同期プリミティブ,  Next: 共有 ctypes オブジェクト,  Prev: Connection オブジェクト<2>,  Up: リファレンス<3>

5.19.2.14 同期プリミティブ
..........................

一般的にマルチプロセスプログラムは、マルチスレッドプログラムほどは同期プ
リミティブを必要としません。詳細は *note threading: f3. モジュールのドキ
ュメントを参照してください。

マネージャーオブジェクトを使用して同期プリミティブを作成できることも覚え
ておいてください。詳細は *note マネージャー: 3709. を参照してください。

 -- クラス: multiprocessing.Barrier (parties[, action[, timeout]])

     バリアーオブジェクト: *note threading.Barrier: 1400. のクローンです
     。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     Added in version 3.3.

 -- クラス: multiprocessing.BoundedSemaphore ([value])

     有限セマフォオブジェクト: *note threading.BoundedSemaphore: 1373. の
     類似物です。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     よく似た *note threading.BoundedSemaphore: 1373. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 3726. と一致しています。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

          注釈: macOS では ‘sem_getvalue()’ が実装されていないので *note
          Semaphore: 36f0. と区別がつきません。

 -- クラス: multiprocessing.Condition ([lock])

     状態変数: *note threading.Condition: 1371. の別名です。

     If 'lock' is specified then it should be a *note Lock: 18b8. or
     *note RLock: 18b9. object from ‘multiprocessing’.

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     バージョン 3.3 で変更: *note wait_for(): 36cb. メソッドが追加されま
     した。

 -- クラス: multiprocessing.Event

     *note threading.Event: 1374. のクローンです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

 -- クラス: multiprocessing.Lock

     再帰しないロックオブジェクトで、 *note threading.Lock: 1a54. 相当の
     ものです。プロセスやスレッドがロックをいったん獲得 (acquire) すると
     、それに続くほかのプロセスやスレッドが獲得しようとする際、それが解
     放 (release) されるまではブロックされます。解放はどのプロセス、スレ
     ッドからも行えます。スレッドに対して適用される ‘threading.Lock’ の
     コンセプトと振る舞いは、特筆すべきものがない限り、プロセスとスレッ
     ドに適用される *note multiprocessing.Lock: 18b8. に引き継がれていま
     す。

     *note Lock: 18b8. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     *note Lock: 18b8. は *note context manager: 1e3. プロトコルをサポー
     トしています。つまり *note with: 187. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          引数 'block' を ‘True’ (デフォルト) に設定して呼び出した場合、
          ロックがアンロック状態になるまでブロックします。ブロックから抜
          けるとそれをロック状態にしてから ‘True’ を返します。 *note
          threading.Lock.acquire(): 8a8. の最初の引数とは名前が違ってい
          るので注意してください。

          引数 'block' の値を ‘False’ にして呼び出すとブロックしません。
          現在ロック状態であれば、直ちに ‘False’ を返します。それ以外の
          場合には、ロックをロック状態にして ‘True’ を返します。

          'timeout' として正の浮動小数点数を与えて呼び出すと、ロックが獲
          得できない限り、指定された秒数だけブロックします。 'timeout' 値
          に負数を与えると、ゼロを与えた場合と同じになります。 'timeout'
          値の ‘None’ (デフォルト) を与えると、無限にブロックします。
          'timeout' 引数の負数と ‘None’ の扱いは、 *note
          threading.Lock.acquire(): 8a8. に実装された動作と異なるので注
          意してください。 'block' が ‘False’ の場合、 'timeout' は実際
          的な意味を持たなくなるので無視されます。ロックを獲得した場合は
          ‘True’ 、タイムアウトした場合は ‘False’ で戻ります。

      -- メソッド: release ()

          ロックを解放します。これはロックを獲得したプロセスやスレッドだ
          けでなく、任意のプロセスやスレッドから呼ぶことができます。

          *note threading.Lock.release(): 14de. と同じように振舞いますが
          、ロックされていない場合に呼び出すと *note ValueError: 2ee. と
          なる点だけが違います。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.RLock

     再帰ロックオブジェクトで、 *note threading.RLock: 32c. 相当のもので
     す。再帰ロックオブジェクトはそれを獲得 (acquire) したプロセスやスレ
     ッドが解放 (release) しなければなりません。プロセスやスレッドがロッ
     クをいったん獲得すると、同じプロセスやスレッドはブロックされずに再
     度獲得出来ます。そのプロセスやスレッドは獲得した回数ぶん解放しなけ
     ればなりません。

     *note RLock: 18b9. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     *note RLock: 18b9. は *note context manager: 1e3. プロトコルをサポ
     ートしています。つまり *note with: 187. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          'block' 引数を ‘True’ にして呼び出した場合、ロックが既にカレン
          トプロセスもしくはカレントスレッドが既に所有していない限りは、
          アンロック状態 (どのプロセス、スレッドも所有していない状態) に
          なるまでブロックします。ブロックから抜けるとカレントプロセスも
          しくはカレントスレッドが (既に持っていなければ) 所有権を得て、
          再帰レベルをインクリメントし、 ‘True’ で戻ります。 *note
          threading.RLock.acquire(): 107f. の実装とはこの最初の引数の振
          る舞いが、その名前自身を始めとしていくつか違うので注意してくだ
          さい。

          'block' 引数を ‘False’ にして呼び出した場合、ブロックしません
          。ロックが他のプロセスもしくはスレッドにより獲得済み (つまり所
          有されている) であれば、カレントプロセスまたはカレントスレッド
          は所有権を得ず、再帰レベルも変更せずに、 ‘False’ で戻ります。
          ロックがアンロック状態の場合、カレントプロセスもしくはカレント
          スレッドは所有権を得て再帰レベルがインクリメントされ、 ‘True’
          で戻ります。(--訳注: 'block' の True/False 関係なくここでの説
          明では「所有権を持っている場合の2度目以降の aquire」の説明が欠
          けています。2度目以降の acquire では再帰レベルがインクリメント
          されて即座に返ります。全体読めばわかるとは思いますが一応。--)

          'timeout' 引数の使い方と振る舞いは *note Lock.acquire(): 3726.
          と同じです。 'timeout' 引数の振る舞いがいくつかの点で *note
          threading.RLock.acquire(): 107f. と異なるので注意してください
          。

      -- メソッド: release ()

          再帰レベルをデクリメントしてロックを解放します。デクリメント後
          に再帰レベルがゼロになった場合、ロックの状態をアンロック (いか
          なるプロセス、いかなるスレッドにも所有されていない状態) にリセ
          ットし、ロックの状態がアンロックになるのを待ってブロックしてい
          るプロセスもしくはスレッドがある場合にはその中のただ一つだけが
          処理を進行できるようにします。デクリメント後も再帰レベルがゼロ
          でない場合、ロックの状態はロックのままで、呼び出し側のプロセス
          もしくはスレッドに所有されたままになります。

          このメソッドは呼び出しプロセスあるいはスレッドがロックを所有し
          ている場合に限り呼び出してください。所有者でないプロセスもしく
          はスレッドによって呼ばれるか、あるいはアンロック (未所有) 状態
          で呼ばれた場合、 *note AssertionError: 8b9. が送出されます。同
          じ状況での *note threading.RLock.release(): 36c6. 実装とは例外
          の型が異なるので注意してください。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.Semaphore ([value])

     セマフォオブジェクト: *note threading.Semaphore: 1372. のクローンで
     す。

     Instantiating this class may set the global start method.  See
     *note Global start method: 36f6. for more details.

     よく似た *note threading.BoundedSemaphore: 1373. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 3726. と一致しています。

      -- メソッド: get_value ()

          Return the current value of semaphore.

          Note that this may raise *note NotImplementedError: 369. 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.19.2.15 共有 ‘ctypes’ オブジェクト
....................................

子プロセスにより継承される共有メモリを使用する共有オブジェクトを作成する
ことができます。

 -- の関数: multiprocessing.Value (typecode_or_type, *args, lock=True)

     共有メモリから割り当てられた *note ctypes: 2e. オブジェクトを返しま
     す。 デフォルトでは、返り値は実際のオブジェクトの同期ラッパーです。
     オブジェクトそれ自身は、 *note Value: 36ed. の 'value' 属性によって
     アクセスできます。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     に再帰的なロックオブジェクトが作成されます。 'lock' が *note Lock:
     18b8. か *note RLock: 18b9. なら値への同期アクセスに使用されます。
     '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: 2892. 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: 3378.  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: 18b8. か
     *note RLock: 18b9. なら値への同期アクセスに使用されます。 'lock' が
     ‘False’ なら、返されたオブジェクトへのアクセスはロックにより自動的
     に保護されません。そのため、必ずしも "プロセスセーフ" ではありませ
     ん。

     'lock' はキーワード引数としてのみ利用可能なことに注意してください。

     Note that an array of *note ctypes.c_char: 3378. has 'value' and
     'raw' attributes which can both be used to store and retrieve byte
     strings.  While 'raw' allows interaction with a *note bytes: 193.
     object the full size of the array, reading 'value' will terminate
     after a null byte, like most programming languages handle strings.

* Menu:

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


File: python.info,  Node: The multiprocessing sharedctypes module,  Up: 共有 ctypes オブジェクト

5.19.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(): 3730. を使用してください。

 -- の関数: multiprocessing.sharedctypes.RawValue (typecode_or_type,
          *args)

     共有メモリから割り当てられた ctypes オブジェクトを返します。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     値を取得したり設定したりすることは潜在的に非アトミックであることに
     注意してください。ロックを使用して自動的に同期化されたアクセスを保
     証するには *note Value(): 3732. を使用してください。

     *note ctypes.c_char: 3378. の配列は文字列を格納して取り出せる
     ‘value’ と ‘raw’ 属性を持っていることを覚えておいてください。詳細は
     *note ctypes: 2e. を参照してください。

 -- の関数: multiprocessing.sharedctypes.Array (typecode_or_type,
          size_or_initializer, *, lock=True, ctx=None)

     *note RawArray(): 372f. と同様ですが、 'lock' の値によっては ctypes
     配列をそのまま返す代わりに、プロセスセーフな同期ラッパーが返されま
     す。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 18b8. か
     *note RLock: 18b9. なら値への同期アクセスに使用されます。 '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: 36f6. 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(): 3731. と同様ですが、 'lock' の値によっては ctypes
     オブジェクトをそのまま返す代わりに、プロセスセーフな同期ラッパーが
     返されます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 18b8. か
     *note RLock: 18b9. なら値への同期アクセスに使用されます。 '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: 36f6. 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: 18b9. オブジェクトが自動
     的に作成されます。

     '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: 36f6. for more details.

     同期ラッパーがラップするオブジェクトに加えて2つのメソッドがあります
     。 ‘get_obj()’ はラップされたオブジェクトを返します。 ‘get_lock()’
     は同期のために使用されるロックオブジェクトを返します。

     ラッパー経由で ctypes オブジェクトにアクセスすることは raw ctypes オ
     ブジェクトへアクセスするよりずっと遅くなることに注意してください。

     バージョン 3.5 で変更: synchronized オブジェクトは *note
     コンテキストマネージャ: 1e3. プロトコルをサポートしています。

次の表は通常の ctypes 構文で共有メモリから共有 ctypes オブジェクトを作成
するための構文を比較します。 (‘MyStruct’ テーブル内には *note
ctypes.Structure: 1e7. のサブクラスがあります。)

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.19.2.17 マネージャー
......................

マネージャーは異なるプロセス間で共有されるデータの作成方法を提供します。
これには別のマシン上で走るプロセス間のネットワーク越しの共有も含まれます
。マネージャーオブジェクトは '共有オブジェクト' を管理するサーバープロセ
スを制御します。他のプロセスはプロキシ経由で共有オブジェクトへアクセスす
ることができます。

 -- の関数: multiprocessing.Manager ()

     プロセス間でオブジェクトを共有するために使用される *note
     SyncManager: 18f7. オブジェクトを返します。返されたマネージャーオブ
     ジェクトは生成される子プロセスに対応付けられ、共有オブジェクトを作
     成するメソッドや、共有オブジェクトに対応するプロキシを返すメソッド
     を持ちます。

マネージャープロセスは親プロセスが終了するか、ガベージコレクトされると停
止します。マネージャークラスは *note multiprocessing.managers: 9b. モジ
ュールで定義されています:

 -- クラス: multiprocessing.managers.BaseManager (address=None,
          authkey=None, serializer='pickle', ctx=None, *,
          shutdown_timeout=1.0)

     BaseManager オブジェクトを作成します。

     作成後、*note start(): 3736. または ‘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: 135.
     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: 36f6. 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():
     3737. 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: 3739. 属性も持っています。

      -- メソッド: connect ()

          ローカルからリモートのマネージャーオブジェクトへ接続します:

               >>> from multiprocessing.managers import BaseManager
               >>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')
               >>> m.connect()

      -- メソッド: shutdown ()

          マネージャーが使用するプロセスを停止します。これはサーバープロ
          セスを開始するために *note start(): 3736. が使用された場合のみ
          有効です。

          これは複数回呼び出すことができます。

      -- メソッド: register (typeid[, callable[, proxytype[, exposed[,
               method_to_typeid[, create_method]]]]])

          マネージャークラスで呼び出し可能オブジェクト(callable)や型を登
          録するために使用されるクラスメソッドです。

          'typeid' は特に共有オブジェクトの型を識別するために使用される
          "型識別子" です。これは文字列でなければなりません。

          'callable' はこの型識別子のオブジェクトを作成するために使用さ
          れる呼び出し可能オブジェクトです。マネージャーインスタンスが
          *note connect(): 373a. メソッドを使ってサーバーに接続されてい
          るか、 'create_method' 引数が ‘False’ の場合は、 ‘None’ でも構
          いません。

          'proxytype' はこの 'typeid' で共有オブジェクトのプロキシを作成
          するために使用される *note BaseProxy: 373c. のサブクラスです。
          ‘None’ の場合、プロキシクラスは自動的に作成されます。

          'exposed' は *note BaseProxy._callmethod(): 373d. を使用したア
          クセスが許されるべき 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: 3735. インスタンスも読み出し専用属性を1つ持って
     います:

      -- の属性: address

          マネージャーが使用するアドレスです。

     バージョン 3.3 で変更: マネージャーオブジェクトはコンテキストマネー
     ジメント・プロトコルをサポートします - *note
     コンテキストマネージャ型: 246c. を参照してください。 *note
     __enter__(): 2701. は (まだ開始していない場合) サーバープロセスを開
     始してから、マネージャーオブジェクトを返します。 *note __exit__():
     2702. は *note shutdown(): 3737. を呼び出します。

     旧バージョンでは、 *note __enter__(): 2701. はマネージャーのサーバ
     ープロセスがまだ開始していなかった場合でもプロセスを開始しませんで
     した。

 -- クラス: multiprocessing.managers.SyncManager

     プロセス間の同期のために使用される *note BaseManager: 3735. のサブ
     クラスです。 *note multiprocessing.Manager(): 252. はこの型のオブジ
     ェクトを返します。

     Its methods create and return *note Proxy オブジェクト: 24e. 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: 1400. オブジェクトを作成して、そ
          のプロキシを返します。

          Added in version 3.3.

      -- メソッド: BoundedSemaphore ([value])

          共有 *note threading.BoundedSemaphore: 1373. オブジェクトを作
          成して、そのプロキシを返します。

      -- メソッド: Condition ([lock])

          共有 *note threading.Condition: 1371. オブジェクトを作成して、
          そのプロキシを返します。

          'lock' が提供される場合 *note threading.Lock: 1a54. か *note
          threading.RLock: 32c. オブジェクトのためのプロキシになります。

          バージョン 3.3 で変更: *note wait_for(): 36cb. メソッドが追加
          されました。

      -- メソッド: Event ()

          共有 *note threading.Event: 1374. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Lock ()

          共有 *note threading.Lock: 1a54. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Namespace ()

          共有 *note Namespace: 36ef. オブジェクトを作成して、そのプロキ
          シを返します。

      -- メソッド: Queue ([maxsize])

          共有 *note queue.Queue: 15b0. オブジェクトを作成して、そのプロ
          キシを返します。

      -- メソッド: RLock ()

          共有 *note threading.RLock: 32c. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Semaphore ([value])

          共有 *note threading.Semaphore: 1372. オブジェクトを作成して、
          そのプロキシを返します。

      -- メソッド: Array (typecode, sequence)

          配列を作成して、そのプロキシを返します。

      -- メソッド: Value (typecode, value)

          書き込み可能な ‘value’ 属性を作成して、そのプロキシを返します
          。

      -- メソッド: dict ()

      -- メソッド: dict (mapping)

      -- メソッド: dict (sequence)

          共有 *note dict: 184. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: list ()

      -- メソッド: list (sequence)

          共有 *note list: 24f. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: set ()

      -- メソッド: set (sequence)

      -- メソッド: set (mapping)

          Create a shared *note set: 185. object and return a proxy for
          it.

          Added in version 3.14: *note set: 185. support was added.

     バージョン 3.6 で変更: 共有オブジェクトは入れ子もできます。 例えば
     、共有リストのような共有コンテナオブジェクトは、 *note SyncManager:
     18f7. がまとめて管理し同期を取っている他の共有オブジェクトを保持で
     きます。

 -- クラス: multiprocessing.managers.Namespace

     *note SyncManager: 18f7. に登録することのできる型です。

     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.19.2.18 カスタマイズされたマネージャー
........................................

独自のマネージャーを作成するには、*note BaseManager: 3735. のサブクラス
を作成して、 マネージャークラスで呼び出し可能なオブジェクトか新たな型を
登録するために *note register(): 373b. クラスメソッドを使用します。例え
ば:

     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.19.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.19.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(): 16a. を適用すると参照対象のオブジェクト表現を返
すのに対して、 *note repr(): 1c3. を適用するとプロキシのオブジェクト表現
を返すことに注意してください。

プロキシオブジェクトの重要な機能は pickle 化ができることで、これによりプ
ロセス間での受け渡しができます。 そのため、参照対象が *note Proxy
オブジェクト: 24e. を持てます。 これによって管理されたリスト、辞書、その
他 *note Proxy オブジェクト: 24e. をネストできます:

     >>> 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: 24f. オブジェクトや *note dict: 184.
オブジェクトが参照対象に含まれていた場合、それらの可変な値の変更はマネー
ジャーからは伝搬されません。 というのも、プロキシには参照対象の中に含ま
れる値がいつ変更されたかを知る術が無いのです。 しかし、コンテナプロキシ
に値を保存する (これはプロキシオブジェクトの ‘__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 オブジェクト: 24e. 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: 373c. のサブクラスのインス
     タンスです。

      -- メソッド: _callmethod (methodname[, args[, kwds]])

          プロキシの参照対象のメソッドの実行結果を返します。

          ‘proxy’ がプロキシで、プロキシ内の参照対象が ‘obj’ ならこの式

               proxy._callmethod(methodname, args, kwds)

          はこの式を評価します

               getattr(obj, methodname)(*args, **kwds)

          (マネージャープロセス内の)。

          返される値はその呼び出し結果のコピーか、新たな共有オブジェクト
          に対するプロキシになります。詳細は *note
          BaseManager.register(): 373b. の 'method_to_typeid' 引数のドキ
          ュメントを参照してください。

          その呼び出しによって例外が発生した場合、*note _callmethod():
          373d. によってその例外は再送出されます。他の例外がマネージャー
          プロセスで発生したなら、‘RemoteError’ 例外に変換されたものが
          ‘_callmethod()’ によって送出されます。

          特に 'methodname' が '公開' されていない場合は例外が発生するこ
          とに注意してください。

          *note _callmethod(): 373d. の使用例になります:

               >>> 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.19.2.21 クリーンアップ
........................

プロキシオブジェクトは弱参照(weakref)コールバックを使用します。プロキシ
オブジェクトがガベージコレクトされるときにその参照対象が所有するマネージ
ャーからその登録を取り消せるようにするためです。

共有オブジェクトはプロキシが参照しなくなったときにマネージャープロセスか
ら削除されます。


File: python.info,  Node: プロセスプール,  Next: リスナーとクライアント,  Prev: Proxy オブジェクト,  Up: リファレンス<3>

5.19.2.22 プロセスプール
........................

*note Pool: 1171. クラスでタスクを実行するプロセスのプールを作成すること
ができます。

 -- クラス: 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(): 1171. 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(): 374f. and *note terminate(): 3750. 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__(): 1203. 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: 1171. 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
          ‘Pool’ exposes this ability to the end user.

      -- メソッド: apply (func[, args[, kwds]])

          引数 'args' とキーワード引数 'kwds' を伴って 'func' を呼びます
          。結果が準備できるまでブロックします。このブロックがあるため、
          *note apply_async(): 15b2. の方が並行作業により適しています。
          加えて、 'func' は、プール内の1つのワーカーだけで実行されます
          。

      -- メソッド: apply_async (func[, args[, kwds[, callback[,
               error_callback]]]])

          *note apply(): 15b1. メソッドの派生版で *note AsyncResult:
          3751. オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: map (func, iterable[, chunksize])

          *note map(): 1a0. 組み込み関数の並列版です ('iterable' な引数
          を1つだけサポートするという違いはあります。もしも複数のイテラ
          ブルを使いたいのならば *note starmap(): 1301. を参照)。結果が
          出るまでブロックします。

          このメソッドはイテラブルをいくつものチャンクに分割し、プロセス
          プールにそれぞれ独立したタスクとして送ります。(概算の) チャン
          クサイズは 'chunksize' を正の整数に設定することで指定できます
          。

          Note that it may cause high memory usage for very long
          iterables.  Consider using *note imap(): 3752. or *note
          imap_unordered(): 3753. with explicit 'chunksize' option for
          better efficiency.

      -- メソッド: map_async (func, iterable[, chunksize[, callback[,
               error_callback]]])

          *note map(): 12ff. メソッドの派生版で *note AsyncResult: 3751.
          オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: imap (func, iterable[, chunksize])

          *note map(): 12ff. の遅延評価版です。

          'chunksize' 引数は *note map(): 12ff. メソッドで使用されるもの
          と同じです。 引数 iterable がとても長いなら 'chunksize' に大き
          な値を指定して使用する方がデフォルト値の ‘1’ を使用するよりも
          ジョブの完了が 'かなり' 速くなります。

          また 'chunksize' が ‘1’ の場合 *note imap(): 3752. メソッドが
          返すイテレーターの ‘next()’ メソッドはオプションで 'timeout' パ
          ラメーターを持ちます。 ‘next(timeout)’ は、その結果が
          'timeout' 秒以内に返されないときに *note
          multiprocessing.TimeoutError: 3703. を発生させます。

      -- メソッド: imap_unordered (func, iterable[, chunksize])

          イテレーターが返す結果の順番が任意の順番で良いと見なされること
          を除けば *note imap(): 3752. と同じです。 (ワーカープロセスが
          1つしかない場合のみ "正しい" 順番になることが保証されます。)

      -- メソッド: starmap (func, iterable[, chunksize])

          'iterable' の要素が、引数として unpack されるイテレート可能オ
          ブジェクトであると期待される以外は、 *note map(): 12ff. と似て
          います。

          そのため、'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(): 1301. と *note map_async(): 1300. の組み合わ
          せです。 イテレート可能オブジェクトの 'iterable' をイテレート
          して、 unpack したイテレート可能オブジェクトを伴って 'func' を
          呼び出します。結果オブジェクトを返します。

          Added in version 3.3.

      -- メソッド: close ()

          これ以上プールでタスクが実行されないようにします。すべてのタス
          クが完了した後でワーカープロセスが終了します。

      -- メソッド: terminate ()

          実行中の処理を完了させずにワーカープロセスをすぐに停止します。
          プールオブジェクトがガベージコレクトされるときに *note
          terminate(): 3750. が呼び出されます。

      -- メソッド: join ()

          ワーカープロセスが終了するのを待ちます。 *note join(): 3754. を
          使用する前に *note close(): 374f. か *note terminate(): 3750.
          を呼び出さなければなりません。

     バージョン 3.3 で変更: Pool オブジェクトがコンテキストマネージメン
     ト・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 246c. を参照してください。 *note
     __enter__(): 2701. は Pool オブジェクトを返します。また *note
     __exit__(): 2702. は *note terminate(): 3750. を呼び出します。

 -- クラス: multiprocessing.pool.AsyncResult

     *note Pool.apply_async(): 15b2. や *note Pool.map_async(): 1300. で
     返される結果のクラスです。

      -- メソッド: get ([timeout])

          結果を受け取ったときに返します。 'timeout' が ‘None’ ではなく
          て、その結果が 'timeout' 秒以内に受け取れない場合 *note
          multiprocessing.TimeoutError: 3703. が発生します。リモートの呼
          び出しが例外を発生させる場合、その例外は *note get(): 3755. が
          再発生させます。

      -- メソッド: wait ([timeout])

          その結果が有効になるか 'timeout' 秒経つまで待ちます。

      -- メソッド: ready ()

          その呼び出しが完了しているかどうかを返します。

      -- メソッド: successful ()

          その呼び出しが例外を発生させることなく完了したかどうかを返しま
          す。その結果が返せる状態でない場合 *note ValueError: 2ee. が発
          生します。

          バージョン 3.7 で変更: If the result is not ready, *note
          ValueError: 2ee. is raised instead of *note AssertionError:
          8b9.

次の例はプールの使用例を紹介します:

     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.19.2.23 リスナーとクライアント
................................

通常、プロセス間でメッセージを渡すにはキューを使用するか *note Pipe():
36ea. が返す *note Connection: 12fc. オブジェクトを使用します。

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: 3702. を発生させます。

 -- の関数: multiprocessing.connection.answer_challenge (connection,
          authkey)

     メッセージを受信して、そのキーとして 'authkey' を使用するメッセージ
     のダイジェストを計算し、ダイジェストを送り返します。

     歓迎メッセージを受け取れない場合 *note AuthenticationError: 3702. が
     発生します。

 -- の関数: multiprocessing.connection.Client (address[, family[,
          authkey]])

     'address' で渡したアドレスを使用するリスナーに対してコネクションを
     確立しようとして *note Connection: 12fc. を返します。

     コネクション種別は 'family' 引数で決定しますが、一般的には
     'address' のフォーマットから推測できるので、これは指定されません。
     (*note アドレスフォーマット: 375d. を参照してください)

     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: 3702. is raised if authentication fails.
     See *note 認証キー: 36ff.

 -- クラス: 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 アドレスフォーマット: 375d. を参照し
     てください。 'family' が ‘'AF_UNIX'’ で 'address' が ‘None’ の場合
     *note tempfile.mkstemp(): 2d46. を使用して作成されたプライベートな
     一時ディレクトリにソケットが作成されます。

     リスナーオブジェクトがソケットを使用する場合、ソケットに束縛される
     ときに 'backlog' (デフォルトでは1つ) がソケットの *note listen():
     1062. メソッドに対して渡されます。

     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: 3702. is raised if authentication fails.
     See *note 認証キー: 36ff.

      -- メソッド: accept ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケット上でコ
          ネクションを 受け付けて *note Connection: 12fc. オブジェクトを
          返します。 認証が失敗した場合 *note AuthenticationError: 3702.
          が発生します。

      -- メソッド: close ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケットをクロ
          ーズします。これはリスナーがガベージコレクトされるときに自動的
          に呼ばれます。そうは言っても、明示的に close() を呼び出す方が
          望ましいです。

     リスナーオブジェクトは次の読み出し専用属性を持っています:

      -- の属性: address

          リスナーオブジェクトが使用中のアドレスです。

      -- の属性: last_accepted

          最後にコネクションを受け付けたアドレスです。有効なアドレスがな
          い場合は ‘None’ になります。

     バージョン 3.3 で変更: Listener オブジェクトがコンテキストマネージ
     メント・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 246c. を参照してください。 *note
     __enter__(): 2701. はリスナーオブジェクトを返します。また *note
     __exit__(): 2702. は *note close(): 375e. を呼び出します。

 -- の関数: 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: 12fc. オブジェクト;

        * 接続された読み取り可能な *note socket.socket: fa5. オブジェク
          ト; または

        * *note Process: 254. オブジェクトの *note sentinel: 12fd. 属性
          。

     読み取ることのできるデータがある場合、あるいは相手側の端が閉じられ
     ている場合、コネクションまたはソケットオブジェクトは準備ができてい
     ます。

     'POSIX': ‘wait(object_list, timeout)’ almost equivalent
     ‘select.select(object_list, [], [], timeout)’.  The difference is
     that, if *note select.select(): fa4. is interrupted by a signal, it
     can raise *note OSError: 2c2. with an error number of ‘EINTR’,
     whereas ‘wait()’ 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(): 181b. 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(): 12fb. を使って複数のプロセスからのメッセージ
を同時に待ちます:

     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.19.2.24 アドレスフォーマット
..............................

   * ‘'AF_INET'’ アドレスは ‘(hostname, port)’ のタプルになります。
     'hostname' は文字列で 'port' は整数です。

   * ‘'AF_UNIX'’ アドレスはファイルシステム上のファイル名の文字列です。

   * ‘'AF_PIPE'’ アドレスは ‘r'\\.\pipe\PIPENAME'’ という形式の文字列で
     す。 'ServerName' という名前のリモートコンピューター上の名前付きパ
     イプに接続するために *note Client(): 375c. を使用するには、代わりに
     ‘r'\\SERVERNAME\pipe\PIPENAME'’ 形式のアドレスを使用する必要があり
     ます。

デフォルトでは、2つのバックスラッシュで始まる文字列は ‘'AF_UNIX'’ よりも
‘'AF_PIPE'’ として推測されることに注意してください。


File: python.info,  Node: 認証キー,  Next: ログ記録<2>,  Prev: リスナーとクライアント,  Up: リファレンス<3>

5.19.2.25 認証キー
..................

‘Connection.recv’ を使用するとき、データは自動的に unpickle されて受信し
ます。 信頼できない接続元からのデータを unpickle することはセキュリティ
リスクがあります。 そのため *note Listener: 1a85. や *note Client():
375c. はダイジェスト認証を提供するために *note hmac: 6e. モジュールを使
用します。

認証キーはパスワードとして見なされるバイト文字列です。コネクションが確立
すると、双方の終点で正しい接続先であることを証明するために 知っているお
互いの認証キーを要求します。(双方の終点が同じキーを使用して通信しようと
しても、コネクション上でそのキーを送信することは 'できません'。)

認証が要求されているにもかかわらず認証キーが指定されていない場合
‘current_process().authkey’ の返す値が使用されます。 (詳細は *note
Process: 254. を参照してください。) この値はカレントプロセスを作成する
‘Process’ オブジェクトによって自動的に継承されます。 これは(デフォルトで
は)複数プロセスのプログラムの全プロセスが相互にコネクションを 確立すると
きに使用される1つの認証キーを共有することを意味します。

適当な認証キーを *note os.urandom(): 746. を使用して生成することもできま
す。

This authentication protects *note Listener: 1a85. and *note Client():
375c. connections, which are reachable by address.  It is not applied to
the anonymous pipes created by *note Pipe(): 36ea. or used internally by
*note Queue: 1be7.  ‘multiprocessing’ treats all local processes running
as the same user as trusted; on most operating systems such processes
can access each other's pipe file descriptors regardless.  Applications
that require isolation between processes of the same user must arrange
it at the operating-system level - for example, by running workers under
a different user account or in a sandbox.


File: python.info,  Node: ログ記録<2>,  Next: The multiprocessing dummy module,  Prev: 認証キー,  Up: リファレンス<3>

5.19.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: 31f4.
     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(): 32b9. に対する呼び出しを実行しますが
     、 get_logger によって作成されるロガーを返すことに加えて、
     ‘'[%(levelname)s/%(processName)s] %(message)s'’ のフォーマットを使
     用して *note sys.stderr: b37. へ出力を送るハンドラーを追加します。
     ‘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.19.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: 1d32, which is a subclass of
*note Pool: 1171. 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.  ‘ThreadPool’ instances are fully
     interface compatible with *note Pool: 1171. instances, and their
     resources must also be properly managed, either by using the pool
     as a context manager or by calling *note close(): 374f. and *note
     terminate(): 3750. 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: 1171, 'maxtasksperchild' and 'context' cannot be
     provided.

          注釈: A ‘ThreadPool’ shares the same interface as *note Pool:
          1171, 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: 3751, that is not understood by any other
          libraries.

          Users should generally prefer to use *note
          concurrent.futures.ThreadPoolExecutor: 94d, which has a
          simpler interface that was designed around threads from the
          start, and which returns *note concurrent.futures.Future:
          13ce. instances that are compatible with many other libraries,
          including *note asyncio: b.


File: python.info,  Node: プログラミングガイドライン,  Next: 使用例<21>,  Prev: リファレンス<3>,  Up: multiprocessing --- プロセスベースの並列処理

5.19.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.19.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(): 3717. is called) all
     completed processes which have not yet been joined will be joined.
     Also calling a finished process's *note Process.is_alive: 15ae.
     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: 18bc. メソッ
     ドを使用すると、そのプロセスが現在使用されている (ロック、セマフォ
     、パイプやキューのような) 共有リソースを破壊したり他のプロセスから
     利用できない状態を引き起こし易いです。

     そのため、共有リソースを使用しないプロセスでのみ *note
     Process.terminate: 18bc. を使用することを考慮することがおそらく最善
     の方法です。

キューを使用するプロセスを join する

     キューに要素を追加するプロセスは、すべてのバッファーされた要素が
     "feeder" スレッドによって下位層のパイプに対してフィードされるまで終
     了を待つということを覚えておいてください。 (子プロセスはこの動作を
     避けるためにキューの *note Queue.cancel_join_thread: 370d. メソッド
     を呼ぶことができます。)

     これはキューを使用するときに、キューに追加されたすべての要素が最終
     的にそのプロセスが 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.19.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: 254. are picklable.
     Also, if you subclass ‘Process.__init__’, you must make sure that
     instances will be picklable when the *note Process.start: 15ad.
     method is called.

グローバル変数

     子プロセスで実行されるコードがグローバル変数にアクセスしようとする
     場合、子プロセスが見るその値は *note Process.start: 15ad. が呼ばれ
     たときの親プロセスの値と同じではない可能性があります。

     しかし、単にモジュールレベルの定数であるグローバル変数なら問題には
     なりません。
メインモジュールの安全なインポート

     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: 246. で失敗します:

          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.19.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: 1171. を使用する例です:

     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.19.3 ‘multiprocessing.shared_memory’ -- プロセス間で直接アクセス可能な共有メモリ
----------------------------------------------------------------------------------

'ソースコード' Lib/multiprocessing/shared_memory.py(1)

Added in version 3.8.

__________________________________________________________________

このモジュールは、マルチコアもしくは対称型マルチプロセッサ(SMP) を持つマ
シン上で実行される、ひとつ以上のプロセスから参照される共有メモリの確保、
管理を行うための *note SharedMemory: 1a37. クラスを提供します。共有メモ
リのライフサイクル管理、とりわけ複数のプロセスにわたる場合のために、
*note multiprocessing.managers: 9b. モジュールでは *note BaseManager:
3735. のサブクラス *note SharedMemoryManager: 376e. も提供されます。

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(): 376f.
     method should be called.  When a shared memory block is no longer
     needed by any process, the *note unlink(): 3770. method should be
     called to ensure proper cleanup.


     パラメータ:

        * ‘name’ (*note str: 16a.‘ | ’‘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: 3c1.) - Control whether a new shared
          memory block is created (‘True’) or an existing shared memory
          block is attached (‘False’).

        * ‘size’ (*note int: 19c.) - 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: 3c1.) - 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.  ‘close()’ 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(): 3770.
          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.  ‘unlink()’
          and *note close(): 376f. can be called in any order, but
          trying to access data inside a shared memory block after
          ‘unlink()’ 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:
1a37. 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: 1a37. 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: 3735.
     which can be used for the management of shared memory blocks across
     processes.

     A call to *note start(): 3736. 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(): 3737. on the
     instance.  This triggers a *note unlink(): 3770. call on all of the
     *note SharedMemory: 3774. 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: 3774. instances and for creating a list-like object
     (*note ShareableList: 3775.) backed by shared memory.

     Refer to *note BaseManager: 3735. 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: 3774. object with
          the specified 'size' in bytes.

      -- メソッド: ShareableList (sequence)

          Create and return a new *note ShareableList: 3775. object,
          initialized by the values from the input 'sequence'.

The following example demonstrates the basic mechanisms of a *note
SharedMemoryManager: 376e.:

     >>> 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: 376e. objects via the *note with: 187.
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: 376e. in a *note with: 187.
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: 19c. (signed 64-bit)

        * *note float: 197.

        * *note bool: 3c1.

        * *note str: 16a. (less than 10M bytes each when encoded as
          UTF-8)

        * *note bytes: 193. (less than 10M bytes each)

        * ‘None’

     It also notably differs from the built-in *note list: 24f. 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: 1a37.  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: 193. and *note
          str: 16a. 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: 2ee. 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: 1a37. instance where the values are
          stored.

以下に *note ShareableList: 1db6. インスタンスの利用例を示します。

     >>> 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: 1db6. 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: 1db6. (and
underlying *note SharedMemory: 1a37.) 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.19.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.19.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: 94d. or *note InterpreterPoolExecutor: 1d4, or
separate processes, using *note ProcessPoolExecutor: 1d8.  Each
implements the same interface, which is defined by the abstract *note
Executor: 3780. class.

*note concurrent.futures.Future: 13ce. must not be confused with *note
asyncio.Future: dca, which is designed for use with *note asyncio: b.
tasks and coroutines.  See the *note asyncio's Future: 3781.
documentation for a detailed comparison of the two.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

* 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.19.5.1 Executor オブジェクト
..............................

 -- クラス: concurrent.futures.Executor

     非同期呼び出しを実行するためのメソッドを提供する抽象クラスです。こ
     のクラスを直接使ってはならず、具象サブクラスを介して使います。

      -- メソッド: submit (fn, /, *args, **kwargs)

          呼び出し可能オブジェクト 'fn' を、 ‘fn(*args, **kwargs)’ とし
          て実行するようにスケジュールし、呼び出し可能オブジェクトの実行
          を表現する *note Future: 13ce. オブジェクトを返します。

               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): 1a0. 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__(): 14e9. が呼ばれその結果が元々の *note
          Executor.map(): 1de. の呼び出しから 'timeout' 秒経った後も利用
          できない場合、返されるイテレータは *note TimeoutError: a3a. を
          送出します。'timeout' は整数または浮動小数点数です。もし
          'timeout' が指定されないか の場合、待ち時間に制限はありません
          。

          もし 'fn' の呼び出しが例外を送出した場合、その例外はイテレータ
          から値を受け取る時に送出されます。

          When using *note ProcessPoolExecutor: 1d8, 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: 94d.
          and *note InterpreterPoolExecutor: 1d4, 'chunksize' has no
          effect.

          バージョン 3.5 で変更: 'chunksize' 引数が追加されました。

          バージョン 3.14 で変更: 'buffersize' 引数が追加されました。

      -- メソッド: shutdown (wait=True, *, cancel_futures=False)

          executor に対して、現在保留中のフューチャーが実行された後で、
          使用中のすべての資源を解放するように伝えます。シャットダウンに
          より後に *note Executor.submit(): c79. と *note
          Executor.map(): 1de. を呼び出すと *note RuntimeError: 246. が
          送出されます。

          '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: 1e3. via the *note
          with: 187. statement, which will shutdown the ‘Executor’
          (waiting as if ‘Executor.shutdown()’ 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.19.5.2 ThreadPoolExecutor
...........................

*note ThreadPoolExecutor: 94d. はスレッドのプールを使用して非同期に呼び
出しを行う、 *note Executor: 3780. のサブクラスです。

*note Future: 13ce. に関連づけられた呼び出し可能オブジェクトが、別の
‘Future’ の結果を待つ時にデッドロックすることがあります。例:

     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)
     future = executor.submit(wait_on_future)
     # Note: calling future.result() would also cause a deadlock because
     # the single worker thread is already waiting for wait_on_future().

 -- クラス: concurrent.futures.ThreadPoolExecutor (max_workers=None,
          thread_name_prefix='', initializer=None, initargs=())

     最大で 'max_workers' 個のスレッドを非同期実行に使う *note Executor:
     3780. のサブクラスです。

     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: 3784,
     as well as any attempt to submit more jobs to the pool.

     バージョン 3.5 で変更: 'max_workers' が ‘None’ か指定されない場合の
     デフォルト値はマシンのプロセッサの数に 5 を掛けたものになります。こ
     れは、 *note ThreadPoolExecutor: 94d. は CPU の処理ではなく I/O を
     オーバーラップするのによく使用されるため、 *note
     ProcessPoolExecutor: 1d8. のワーカーの数よりもこのワーカーの数を増
     やすべきであるという想定に基づいています。

     バージョン 3.6 で変更: 'thread_name_prefix' 引数が追加され、デバッ
     グしやすくなるようにプールから作られたワーカスレッド *note
     threading.Thread: 177. の名前を管理できるようになりました。

     バージョン 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.19.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.19.5.4 InterpreterPoolExecutor
................................

Added in version 3.14.

The *note InterpreterPoolExecutor: 1d4. class uses a pool of
interpreters to execute calls asynchronously.  It is a *note
ThreadPoolExecutor: 94d. 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: cd1. 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: 1bc3.

 -- クラス: concurrent.futures.InterpreterPoolExecutor
          (max_workers=None, thread_name_prefix='', initializer=None,
          initargs=())

     A *note ThreadPoolExecutor: 94d. 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: 3787.

     Other caveats from parent *note ThreadPoolExecutor: 94d. apply
     here.

*note submit(): c79. and *note map(): 1de. 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: 3787. 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
‘ExecutionFailed’ instance instead.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0734/


File: python.info,  Node: ProcessPoolExecutor,  Next: Future オブジェクト,  Prev: InterpreterPoolExecutor,  Up: concurrent futures --- 並列タスク実行

5.19.5.5 ProcessPoolExecutor
............................

*note ProcessPoolExecutor: 1d8. はプロセスプールを使って非同期呼び出しを
実施する *note Executor: 3780. のサブクラスです。‘ProcessPoolExecutor’ は
*note multiprocessing: 98. モジュールを利用します。このため *note Global
Interpreter Lock: 474. を回避することができますが、pickle 化できるオブジ
ェクトしか実行したり返したりすることができません。

‘__main__’ モジュールはワーカサブプロセスでインポート可能でなければなり
ません。 すなわち、 *note ProcessPoolExecutor: 1d8. は対話的インタープリ
タでは動きません。

*note ProcessPoolExecutor: 1d8. に渡された呼び出し可能オブジェクトから
*note Executor: 3780. や *note Future: 13ce. メソッドを呼ぶとデッドロッ
クに陥ります。

Note that the restrictions on functions and arguments needing to
picklable as per *note multiprocessing.Process: 254. apply when using
*note submit(): c79. and *note map(): 1de. on a *note
ProcessPoolExecutor: 1d8.  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: 3780. 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: 2ee. will be raised.  On
     Windows, 'max_workers' must be less than or equal to ‘61’.  If it
     is not then ‘ValueError’ 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
     ‘multiprocessing’ context is used.  See *note
     コンテキストと開始方式: 1d7.

     '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: 1780,
     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
          ‘ProcessPoolExecutor’ hanging in some circumstances.  Follow
          its eventual resolution in gh-115634(1).

     バージョン 3.3 で変更: ワーカプロセスの1つが突然終了した場合、*note
     BrokenProcessPool: 1780. エラーが送出されるようになりました。 以前
     は挙動は未定義でしたが、 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: 1a4.  Pass a 'mp_context' configured to use a
     different start method.  See the ‘os.fork()’ 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
     コンテキストと開始方式: 1d7.) changed away from 'fork'.  If you
     require the 'fork' start method for ‘ProcessPoolExecutor’ 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: 18bc. on each of them.
          Internally, it will also call *note Executor.shutdown(): aee.
          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: d53. on each of them.  Internally,
          it will also call *note Executor.shutdown(): aee. 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.19.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.19.5.7 Future オブジェクト
............................

*note Future: 13ce. クラスは呼び出し可能オブジェクトの非同期実行をカプセ
ル化します。 ‘Future’ のインスタンスは *note Executor.submit(): c79. に
よって生成されます。

 -- クラス: concurrent.futures.Future

     呼び出し可能オブジェクトの非同期実行をカプセル化します。 *note
     Future: 13ce. インスタンスは *note Executor.submit(): c79. で生成さ
     れ、テストを除いて直接生成すべきではありません。

      -- メソッド: 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: a3a. が送出されます。 'timeout' はintかfloatを指
          定できます。もし 'timeout' が指定されていないか、 ‘None’ であ
          れば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: bd2. が送出されます。

          If the call raised an exception, this method will raise the
          same exception.

      -- メソッド: exception (timeout=None)

          呼び出しによって送出された例外を返します。もし呼び出しがまだ完
          了されていなければ、このメソッドは 'timeout' 秒だけ待機します
          。もし呼び出しが 'timeout' 秒の間に完了しなければ、 *note
          TimeoutError: a3a. が送出されます。 'timeout' にはintかfloatを
          指定できます。 'timeout' が指定されていないか、 ‘None’ であれ
          ば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: bd2. が送出されます。

          呼び出しが例外を送出することなく完了した場合、‘None’ を返しま
          す。

      -- メソッド: add_done_callback (fn)

          呼び出し可能な 'fn' オブジェクトを future にアタッチします。
          futureがキャンセルされたか、実行を終了した際に、future をその
          ただ一つの引数として 'fn' が呼び出されます。

          追加された呼び出し可能オブジェクトは、追加された順番で呼びださ
          れ、追加を行ったプロセスに属するスレッド中で呼び出されます。も
          し呼び出し可能オブジェクトが *note Exception: bd1. のサブクラ
          スを送出した場合、それはログに記録され無視されます。呼び出し可
          能オブジェクトが *note BaseException: 7d6. のサブクラスを送出
          した場合の動作は未定義です。

          もしfutureがすでに完了しているか、キャンセル済みであれば、'fn'
          は即座に実行されます。

     以下の *note Future: 13ce. メソッドは、ユニットテストでの使用と
     *note Executor: 3780. を実装することを意図しています。

      -- メソッド: set_running_or_notify_cancel ()

          このメソッドは、*note Future: 13ce. に関連付けられたワークやユ
          ニットテストによるワークの実行前に、 *note Executor: 3780. の
          実装によってのみ呼び出してください。

          このメソッドが ‘False’ を返す場合、 *note Future: 13ce. はキャ
          ンセルされています。つまり、 *note Future.cancel(): 378b. が呼
          び出されて ‘True’ が返っています。‘Future’ の完了を (*note
          as_completed(): 1a26. または *note wait(): 1c62. により) 待機
          するすべてのスレッドが起動します。

          このメソッドが ‘True’ を返す場合、 *note Future: 13ce. はキャ
          ンセルされて、実行状態に移行されています。つまり、 *note
          Future.running(): 378d. を呼び出すと ‘True’ が返ります。

          このメソッドは、一度だけ呼び出すことができ、*note
          Future.set_result(): 3792. または *note
          Future.set_exception(): 3793. がキャンセルされた後には呼び出す
          ことができません。

      -- メソッド: set_result (result)

          *note Future: 13ce. に関連付けられたワークの結果を 'result' に
          設定します。

          このメソッドは、 *note Executor: 3780. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 19b1. if the ‘Future’ is
          already done.

      -- メソッド: set_exception (exception)

          *note Future: 13ce. に関連付けられたワークの結果を *note
          Exception: bd1. 'exception' に設定します。

          このメソッドは、 *note Executor: 3780. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 19b1. if the ‘Future’ is
          already done.


File: python.info,  Node: モジュール関数<2>,  Next: 例外クラス,  Prev: Future オブジェクト,  Up: concurrent futures --- 並列タスク実行

5.19.5.8 モジュール関数
.......................

 -- の関数: concurrent.futures.wait (fs, timeout=None,
          return_when=ALL_COMPLETED)

     Wait for the *note Future: 13ce. instances (possibly created by
     different *note Executor: 3780. 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: 3797.
                                                            
                                                            
      -- データ: concurrent.futures.ALL_COMPLETED           すべてのフューチャが終了したかキャンセルされたときに
                                                            返します。
                                                            

 -- の関数: concurrent.futures.as_completed (fs, timeout=None)

     Returns an iterator over the *note Future: 13ce. instances
     (possibly created by different *note Executor: 3780. 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
     ‘as_completed()’ is called will be yielded first.  The returned
     iterator raises a *note TimeoutError: a3a. if *note __next__():
     14e9. is called and the result isn't available after 'timeout'
     seconds from the original call to ‘as_completed()’.  '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.19.5.9 例外クラス
...................

 -- 例外: concurrent.futures.CancelledError

     future がキャンセルされたときに送出されます。

 -- 例外: concurrent.futures.TimeoutError

     A deprecated alias of *note TimeoutError: a3a, raised when a future
     operation exceeds the given timeout.

     バージョン 3.11 で変更: このクラスは *note TimeoutError: a3a. のエ
     イリアスになりました。

 -- 例外: concurrent.futures.BrokenExecutor

     Derived from *note RuntimeError: 246, 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: 379a, this exception class is
     raised when one of the workers of a *note ThreadPoolExecutor: 94d.
     has failed initializing.

     Added in version 3.7.

 -- 例外: concurrent.futures.interpreter.BrokenInterpreterPool

     Derived from *note BrokenThreadPool: 3784, this exception class is
     raised when one of the workers of a *note InterpreterPoolExecutor:
     1d4. has failed initializing.

     Added in version 3.14.

 -- 例外: concurrent.futures.process.BrokenProcessPool

     Derived from *note BrokenExecutor: 379a. (formerly *note
     RuntimeError: 246.), this exception class is raised when one of the
     workers of a *note ProcessPoolExecutor: 1d8. 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.19.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: 379f.

参考
....

*note InterpreterPoolExecutor: 1d4.

     Combines threads with interpreters in a familiar interface.

*note 拡張モジュールを分離する: 167.

     How to update an extension module to support multiple interpreters.

PEP 554(2)

PEP 734(3)

PEP 684(4)

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

* 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.19.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: 37a1., 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.19.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: 37a1. 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.19.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.19.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: 37a6.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.19.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: 165, 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.19.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: 15b0. implementation, available through *note
create_queue(): 37a9.


File: python.info,  Node: "Sharing" Objects,  Prev: Communication Between Interpreters,  Up: はじめに<10>

5.19.6.7 "Sharing" Objects
..........................

Any data actually shared between interpreters loses the thread-safety
provided by the *note GIL: 165.  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: 886.

   * *note bool: 3c1. (*note True: e0b. and *note False: d2f.)

   * *note bytes: 193.

   * *note str: 16a.

   * *note int: 19c.

   * *note float: 197.

   * *note tuple: 614. (of similarly supported objects)

There is a small number of Python types that actually share mutable data
between interpreters:

   * *note memoryview: 166.

   * *note Queue: 37ac.


File: python.info,  Node: リファレンス<4>,  Next: 基本的な使い方<3>,  Prev: はじめに<10>,  Up: concurrent interpreters --- Multiple interpreters in the same process

5.19.6.8 リファレンス
.....................

このモジュールは以下の関数を定義しています:

 -- の関数: concurrent.interpreters.list_all ()

     Return a *note list: 24f. of *note Interpreter: 37af. objects, one
     for each existing interpreter.

 -- の関数: concurrent.interpreters.get_current ()

     Return an *note Interpreter: 37af. object for the currently running
     interpreter.

 -- の関数: concurrent.interpreters.get_main ()

     Return an *note Interpreter: 37af. 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: 37af. object for it.

 -- の関数: concurrent.interpreters.create_queue ()

     Initialize a new cross-interpreter queue and return a *note Queue:
     37ac. object for it.

* Menu:

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


File: python.info,  Node: Interpreter objects,  Next: 例外<13>,  Up: リファレンス<4>

5.19.6.9 Interpreter objects
............................

 -- クラス: concurrent.interpreters.Interpreter (id)

     A single interpreter in the current process.

     Generally, ‘Interpreter’ shouldn't be called directly.  Instead,
     use *note create(): 1777. 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: 37aa.

      -- メソッド: 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.19.6.10 例外
..............

 -- 例外: concurrent.interpreters.InterpreterError

     This exception, a subclass of *note Exception: bd1, is raised when
     an interpreter-related error happens.

 -- 例外: concurrent.interpreters.InterpreterNotFoundError

     This exception, a subclass of *note InterpreterError: 37bb, is
     raised when the targeted interpreter no longer exists.

 -- 例外: concurrent.interpreters.ExecutionFailed

     This exception, a subclass of *note InterpreterError: 37bb, 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: 199, is raised when
     an object cannot be sent to another interpreter.


File: python.info,  Node: Communicating Between Interpreters,  Prev: 例外<13>,  Up: リファレンス<4>

5.19.6.11 Communicating Between Interpreters
............................................

 -- クラス: concurrent.interpreters.Queue (id)

     A wrapper around a low-level, cross-interpreter queue, which
     implements the *note queue.Queue: 15b0. interface.  The underlying
     queue can only be created through *note create_queue(): 37a9.

     Some objects are actually shared and some are copied efficiently,
     but most are copied via *note pickle: ab.  See *note "Sharing"
     Objects: 37aa.

      -- の属性: id

          (read-only)

          The queue's ID.

 -- 例外: concurrent.interpreters.QueueEmptyError

     This exception, a subclass of *note queue.Empty: 370a, 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: 370b, 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.19.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.19.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: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

* 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.19.7.1 Using the ‘subprocess’ Module
......................................

サブプロセスを起動するために推奨される方法は、すべての用法を扱える *note
run(): d83. 関数を使用することです。より高度な用法では下層の *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: 1077. インスタンスを返します。

     上記の引数は、もっともよく使われるものだけ示しており、後述の *note
     よく使われる引数: 37c8. で説明されています (そのためここではキーワ
     ード専用引数の表記に省略されています)。関数の完全な使用法を説明して
     も大部分が *note Popen: 4b7. コンストラクターの内容と同じになります
     - この関数のほとんどの引数は ‘Popen’ インターフェイスに渡されます。
     ('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: d84.
     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 ‘PIPE’ and 'stderr' to *note
     STDOUT: 37c9, instead of using 'capture_output'.

     A 'timeout' may be specified in seconds, it is internally passed on
     to *note Popen.communicate(): 1818.  If the timeout expires, the
     child process will be killed and waited for.  The *note
     TimeoutExpired: 1819. 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(): 1818.
     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: d84, and
     the 'stdin' argument may not be used as well.

     'check' に真を指定した場合、プロセスが非ゼロの終了コードで終了する
     と *note CalledProcessError: 1540. 例外が送出されます。 この例外の
     属性には、引数、終了コード、標準出力および標準エラー出力が捕捉でき
     た場合に格納されます。

     'encoding' または 'errors' 引数が指定されるか、'text' 引数が true で
     ある場合、stdin, stdout および stderr のためのファイルオブジェクト
     はテキストモードでオープンされます。 その際には指定された
     'encoding' および 'errors' が使われるか、デフォルトの *note
     io.TextIOWrapper: 9c2. になります。'universal_newlines' 引数は
     'text' 引数と等価であり、後方互換性のために提供されています。そうで
     ない場合、デフォルトでこれらのファイルオブジェクトはバイナリモード
     でオープンされます。

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。 *note Popen: 4b7. に直接渡されます。あらゆるプラットフォ
     ームで *note os.environ: 25b. のように文字列から文字列へ、またPOSIX
     プラットフォームにおいては *note os.environb: 25c. のようにバイトか
     らバイトへも、定義すること出来ます。

     例:

          >>> 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(): d83. の戻り値。プロセスが終了したことを表します。

      -- の属性: args

          プロセスを起動するときに使用された引数。1 個のリストか 1 個の
          文字列になります。

      -- の属性: returncode

          子プロセスの終了コード。一般に、終了ステータス 0 はプロセスが
          正常に終了したことを示します。

          負の値 ‘-N’ は子プロセスがシグナル ‘N’ により中止させられたこ
          とを示します (POSIX のみ)。

      -- の属性: stdout

          子プロセスから補足された標準出力です。バイト列、もしくは *note
          run(): d83. でエンコーディングが指定された場合、エラーの場合、
          text=True が指定された場合は文字列です。標準出力が補足できなか
          ったら ‘None’ になります。

          プロセスが ‘stderr=subprocess.STDOUT’ で実行された場合、標準出
          力と標準エラー出力が混合されたものがこの属性に格納され、*note
          stderr: 37cd. は ‘None’ になります。

      -- の属性: stderr

          子プロセスから補足された標準エラー出力です。バイト列、もしくは
          *note run(): d83. でエンコーディングが指定された場合、エラーの
          場合、text=True が指定された場合は文字列です。標準エラー出力が
          補足できなかったら ‘None’ になります。

      -- メソッド: check_returncode ()

          *note returncode: 37cb. が非ゼロの場合、*note
          CalledProcessError: 1540. が送出されます。

     Added in version 3.5.

 -- データ: subprocess.DEVNULL

     *note Popen: 4b7. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     入出力を *note os.devnull: 1e70. から入出力するように指定するための
     特殊値です。

     Added in version 3.3.

 -- データ: subprocess.PIPE

     *note Popen: 4b7. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     ストリームに対するパイプを開くことを指定するための特殊値です。*note
     Popen.communicate(): 1818. に非常に有用です。

 -- データ: subprocess.STDOUT

     *note Popen: 4b7. の 'stderr' 引数に渡して、標準エラー出力が標準出
     力と同じハンドルに出力されるように指定するための特殊値です。

 -- 例外: subprocess.SubprocessError

     このモジュールの他のすべての例外のための基底クラスです。

     Added in version 3.3.

 -- 例外: subprocess.TimeoutExpired

     *note SubprocessError: 37cf. のサブクラスです。子プロセスの終了を待
     機している間にタイムアウトが発生した場合に送出されます。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: timeout

          タイムアウト秒数。

      -- の属性: output

          *note run(): d83. にまたは *note check_output(): 11c8. によっ
          て捕捉された場合は、子プロセスの出力となり、それ以外の場合は
          ‘None’ となります。‘text=True’ の設定に関係なく、出力が捕捉さ
          れた場合は常に *note bytes: 193. となります。出力がない場合は
          ‘b''’ の代わりに''None'' のままになることがあります。

      -- の属性: stdout

          output の別名。*note stderr: 37d4. と対になります。

      -- の属性: stderr

          *note run(): d83. によって捕捉された場合、子プロセスの標準エラ
          ー出力が表示され、それ以外の場合は ‘None’ となります。
          ‘text=True’ の設定に関係なく、標準エラー出力を捕捉した場合は常
          に *note bytes: 193. となります。標準エラー出力がない場合は、
          ‘b''’ の代わりに ‘None’ のままになることがあります。

     Added in version 3.3.

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

 -- 例外: subprocess.CalledProcessError

     *note SubprocessError: 37cf. のサブクラスです。*note check_call():
     37d5. または *note check_output(): 11c8. 、 ‘check=True’ であるとき
     の *note run(): d83. 、によって実行されたプロセスが非ゼロの終了ステ
     ータスを返した場合に送出されます。

      -- の属性: returncode

          子プロセスの終了ステータスです。もしプロセスがシグナルによって
          終了したなら、これは負のシグナル番号になります。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: output

          *note run(): d83. または *note check_output(): 11c8. によって
          捕捉された子プロセスの出力。捕捉されなかったら ‘None’ になりま
          す。

      -- の属性: stdout

          output の別名。*note stderr: 37da. と対になります。

      -- の属性: stderr

          *note run(): d83. によって捕捉された子プロセスの標準エラー出力
          。捕捉されなかったら ‘None’ になります。

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

* Menu:

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


File: python.info,  Node: よく使われる引数,  Next: Popen コンストラクター,  Up: Using the subprocess Module

5.19.7.2 よく使われる引数
.........................

幅広い使用例をサポートするために、*note Popen: 4b7. コンストラクター (と
その他の簡易関数) は、多くのオプション引数を受け付けます。一般的な用法に
ついては、これらの引数の多くはデフォルト値のままで問題ありません。通常必
要とされる引数は以下の通りです:

     'args' はすべての呼び出しに必要で、文字列あるいはプログラム引数のシ
     ーケンスでなければなりません。一般に、引数のシーケンスを渡す方が望
     ましいです。なぜなら、モジュールが必要な引数のエスケープやクオート
     (例えばファイル名中のスペースを許すこと) の面倒を見ることができるた
     めです。単一の文字列を渡す場合、'shell' は *note True: e0b. でなけ
     ればなりません (以下を参照)。もしくは、その文字列は引数を指定せずに
     実行される単なるプログラムの名前でなければなりません。

     '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: d84, *note
     DEVNULL: 136a, an existing file descriptor (a positive integer),
     and an existing *note file object: 13df. with a valid file
     descriptor.  With the default settings of ‘None’, no redirection
     will occur.  ‘PIPE’ indicates that a new pipe to the child should
     be created.  ‘DEVNULL’ indicates that the special file *note
     os.devnull: 1e70. will be used.  Additionally, 'stderr' can be
     *note STDOUT: 37c9, 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: 9c2.

     'stdin' については、入力での行末文字 ‘'\n'’ はデフォルトの行セパレ
     ーター *note os.linesep: 263b. に変換されます。'stdout' と 'stderr'
     については、出力での行末はすべて ‘'\n'’ に変換されます。詳細は
     *note io.TextIOWrapper: 9c2. クラスのドキュメントでコンストラクター
     の引数 '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: 37dc.、*note
          Popen.stdout: 37dd. ならびに *note Popen.stderr: 37de. の改行
          属性は *note Popen.communicate(): 1818. メソッドで更新されませ
          ん。

     'shell' が ‘True’ なら、指定されたコマンドはシェルによって実行され
     ます。あなたが Python を主として (ほとんどのシステムシェル以上の) 強
     化された制御フローのために使用していて、さらにシェルパイプ、ファイ
     ル名ワイルドカード、環境変数展開、‘~’ のユーザーホームディレクトリ
     への展開のような他のシェル機能への簡単なアクセスを望むなら、これは
     有用かもしれません。しかしながら、Python 自身が多くのシェル的な機能
     の実装を提供していることに注意してください (特に *note glob: 68,
     *note fnmatch: 60, *note os.walk(): 6d0, *note
     os.path.expandvars(): 15f7, *note os.path.expanduser(): c0d, *note
     shutil: ca.)。

     バージョン 3.3 で変更: 'universal_newlines' が ‘True’ の場合、クラ
     スはエンコーディング ‘locale.getpreferredencoding()’ の代わりに
     *note locale.getpreferredencoding(False): 75c. を使用します。この変
     更についての詳細は、 *note io.TextIOWrapper: 9c2. クラスを参照して
     ください。

          注釈: ‘shell=True’ を使う前に *note
          セキュリティで考慮すべき点: 37df. を読んでください。

これらのオプションは、他のすべてのオプションとともに *note Popen: 4b7. コ
ンストラクターのドキュメントの中でより詳細に説明されています。


File: python.info,  Node: Popen コンストラクター,  Next: 例外<14>,  Prev: よく使われる引数,  Up: Using the subprocess Module

5.19.7.3 Popen コンストラクター
...............................

このモジュールの中で、根底のプロセス生成と管理は *note Popen: 4b7. クラ
スによって扱われます。簡易関数によってカバーされないあまり一般的でないケ
ースを開発者が扱えるように、‘Popen’ クラスは多くの柔軟性を提供しています
。

 -- クラス: 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(): 3152.
     のような挙動を使用します。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: 3eb. 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(): 3152, 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
     における引数シーケンスから文字列への変換: 37e1. に記述された方法で
     文字列に変換されます。これは根底の ‘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
          セキュリティで考慮すべき点: 37df. を読んでください。

     'bufsize' は標準入力/標準出力/標準エラー出力パイプファイルオブジェ
     クトを生成するときに *note open(): 318. 関数の対応する引数に渡され
     ます:

        - ‘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: d84, *note
     DEVNULL: 136a, an existing file descriptor (a positive integer),
     and an existing *note file object: 13df. with a valid file
     descriptor.  With the default settings of ‘None’, no redirection
     will occur.  ‘PIPE’ indicates that a new pipe to the child should
     be created.  ‘DEVNULL’ indicates that the special file *note
     os.devnull: 1e70. will be used.  Additionally, 'stderr' can be
     *note STDOUT: 37c9, 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(): 1e16. or *note os.setpgid(): 309a. 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: 246.  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 ファイル記述子の継承: 1100.

     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: e0c, or
     by standard handle redirection.

     バージョン 3.2 で変更: 'close_fds' のデフォルトは、*note False:
     d2f. から上記のものに変更されました。

     バージョン 3.7 で変更: On Windows the default for 'close_fds' was
     changed from *note False: d2f. to *note True: e0b. when redirecting
     the standard handles.  It's now possible to set 'close_fds' to
     ‘True’ when redirecting the standard handles.

     'pass_fds' はオプションで、親と子の間で開いたままにしておくファイル
     記述子のシーケンスを指定します。何らかの 'pass_fds' を渡した場合、
     'close_fds' は強制的に *note True: e0b. になります。(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: 2199.: 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: 2199.: 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(): 37e2. and the value in ‘gr_gid’ will be used.  If
     the value is an integer, it will be passed verbatim.  (POSIX only)

     *note Availability: 2199.: 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(): 37e2. and the values in ‘gr_gid’ will be
     used.  Integer values will be passed verbatim.  (POSIX only)

     *note Availability: 2199.: 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(): 37e3. and the value in ‘pw_uid’ will be used.  If
     the value is an integer, it will be passed verbatim.  (POSIX only)

          注釈: Specifying 'user' will not drop existing supplementary
          group memberships!  The caller must also pass
          ‘extra_groups=()’ to reduce the group membership of the child
          process for security purposes.

     *note Availability: 2199.: 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: 2199.: POSIX

     Added in version 3.9.

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。あらゆるプラットフォームで *note os.environ: 25b. のよう
     に文字列から文字列へ、またPOSIX プラットフォームにおいては *note
     os.environb: 25c. のようにバイトからバイトへも、定義すること出来ま
     す。

          注釈: 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 よく使われる引数: 37c8.  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: 37e4. 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: 37e5.

        * *note CREATE_NEW_PROCESS_GROUP: 37e6.

        * *note ABOVE_NORMAL_PRIORITY_CLASS: 37e7.

        * *note BELOW_NORMAL_PRIORITY_CLASS: 37e8.

        * *note HIGH_PRIORITY_CLASS: 37e9.

        * *note IDLE_PRIORITY_CLASS: 37ea.

        * *note NORMAL_PRIORITY_CLASS: 37eb.

        * *note REALTIME_PRIORITY_CLASS: 37ec.

        * *note CREATE_NO_WINDOW: 37ed.

        * *note DETACHED_PROCESS: 37ee.

        * *note CREATE_DEFAULT_ERROR_MODE: 37ef.

        * *note CREATE_BREAKAWAY_FROM_JOB: 37f0.

     'pipesize' can be used to change the size of the pipe when *note
     PIPE: d84. 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: 187. 文によってコンテキストマネー
     ジャーとしてサポートされます: 終了時には標準ファイル記述子が閉じら
     れ、プロセスを待機します:

          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: 1ccb. ‘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
     ‘os.posix_spawn()’ no longer raise an exception on errors like
     missing program, but the child process fails with a non-zero *note
     returncode: c87.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Side-by-Side_Assembly


File: python.info,  Node: 例外<14>,  Prev: Popen コンストラクター,  Up: Using the subprocess Module

5.19.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: 2c2.  This occurs,
for example, when trying to execute a non-existent file.  Applications
should prepare for ‘OSError’ exceptions.  Note that, when ‘shell=True’,
‘OSError’ 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: 2ee. が
発生します。

呼び出されたプロセスが非ゼロのリターンコードを返した場合 *note
check_call(): 37d5. や *note check_output(): 11c8. は *note
CalledProcessError: 1540. を送出します。

All of the functions and methods that accept a 'timeout' parameter, such
as *note run(): d83. and *note Popen.communicate(): 1818. will raise
*note TimeoutExpired: 1819. if the timeout expires before the process
exits.

このモジュールで定義されたすべての例外は *note SubprocessError: 37cf. を
継承しています。

Added in version 3.3: *note SubprocessError: 37cf. 基底クラスが追加され
ました。


File: python.info,  Node: セキュリティで考慮すべき点<2>,  Next: Popen オブジェクト,  Prev: Using the subprocess Module,  Up: subprocess --- サブプロセス管理

5.19.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: 37f3, 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.19.7.6 Popen オブジェクト
...........................

*note Popen: 4b7. クラスのインスタンスには、以下のようなメソッドがありま
す:

 -- メソッド: Popen.poll ()

     子プロセスが終了しているかどうかを調べます。 *note returncode: c87.
     属性を設定して返します。そうでなければ ‘None’ を返します。

 -- メソッド: Popen.wait (timeout=None)

     子プロセスが終了するまで待ちます。*note returncode: c87. 属性を設定
     して返します。

     プロセスが 'timeout' 秒後に終了してない場合、*note TimeoutExpired:
     1819. 例外を送出します。この例外を捕捉して wait を再試行するのは安
     全です。

          注釈: ‘stdout=PIPE’ や ‘stderr=PIPE’ を使っていて、より多くの
          データを受け入れるために OS のパイプバッファーをブロックしてい
          るパイプに子プロセスが十分な出力を生成した場合、デッドロックが
          発生します。これを避けるには *note Popen.communicate(): 1818.
          を使用してください。

          注釈: 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: c6f.

     バージョン 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: c87. 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.

     ‘communicate()’ 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: 1819. exception will be raised.  Catching this
     exception and retrying communication will not lose any output.
     Supplying 'input' to a subsequent post-timeout ‘communicate()’ 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 ‘communicate()’ raises *note TimeoutExpired: 1819,
     do not call *note wait(): ee4.  Use an additional ‘communicate()’
     call to finish handling pipes and populate the *note returncode:
     c87. attribute.

          注釈: 受信したデータはメモリにバッファーされます。そのため、返
          されるデータが大きいかあるいは制限がないような場合はこのメソッ
          ドを使うべきではありません。

     バージョン 3.3 で変更: 'timeout' が追加されました

 -- メソッド: Popen.send_signal (signal)

     'signal' シグナルを子プロセスに送ります。

     Do nothing if the process completed.

          注釈: Windows では、SIGTERM は *note terminate(): 15fa. の別名
          です。CTRL_C_EVENT と CTRL_BREAK_EVENT を、
          ‘CREATE_NEW_PROCESS_GROUP’ を含む 'creationflags' で始まった、
          プロセスに送れます。

 -- メソッド: Popen.terminate ()

     Stop the child.  On POSIX OSs the method sends *note SIGTERM: 15fd.
     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(): 15fb. は *note
     terminate(): 15fa. の別名です。

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: d84, this attribute is a
     writeable stream object as returned by *note open(): 318.  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 ‘PIPE’, this attribute is ‘None’.

 -- の属性: Popen.stdout

     If the 'stdout' argument was *note PIPE: d84, this attribute is a
     readable stream object as returned by *note open(): 318.  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 ‘PIPE’, this attribute is ‘None’.

 -- の属性: Popen.stderr

     If the 'stderr' argument was *note PIPE: d84, this attribute is a
     readable stream object as returned by *note open(): 318.  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 ‘PIPE’, this attribute is ‘None’.

     警告: *note .stdin.write: 37dc, *note .stdout.read: 37dd, *note
     .stderr.read: 37de. を利用すると、別のパイプの OS パイプバッファー
     がいっぱいになってデッドロックが発生する恐れがあります。これを避け
     るためには *note communicate(): 1818. を利用してください。

 -- の属性: Popen.pid

     子プロセスのプロセス ID が入ります。

     'shell' 引数を ‘True’ に設定した場合は、生成されたシェルのプロセス
     ID になります。

 -- の属性: Popen.returncode

     The child return code.  Initially ‘None’, *note returncode: c87. is
     set by a call to the *note poll(): 37f5, *note wait(): ee4, or
     *note communicate(): 1818. 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 のみ)。

     When ‘shell=True’, the return code reflects the exit status of the
     shell itself (e.g.  ‘/bin/sh’), which may map signals to codes such
     as ‘128+N’.  See the documentation of the shell (for example, the
     Bash manual's Exit Status) for details.


File: python.info,  Node: Windows Popen ヘルパー,  Next: 古い高水準 API,  Prev: Popen オブジェクト,  Up: subprocess --- サブプロセス管理

5.19.7.7 Windows Popen ヘルパー
...............................

*note STARTUPINFO: 37e4. クラスと以下の定数は、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: 37e4. の属性が、プロセスがウィンドウ
          を生成するときに使われるかを決定するビットフィールドです:

               si = subprocess.STARTUPINFO()
               si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW

      -- の属性: hStdInput

          *note dwFlags: 37f9. が *note STARTF_USESTDHANDLES: 37fb. を指
          定すれば、この属性がプロセスの標準入力処理です。
          ‘STARTF_USESTDHANDLES’ が指定されなければ、標準入力のデフォル
          トはキーボードバッファーです。

      -- の属性: hStdOutput

          *note dwFlags: 37f9. が *note STARTF_USESTDHANDLES: 37fb. を指
          定すれば、この属性がプロセスの標準出力処理です。そうでなければ
          、この属性は無視され、標準出力のデフォルトはコンソールウィンド
          ウのバッファーです。

      -- の属性: hStdError

          *note dwFlags: 37f9. が *note STARTF_USESTDHANDLES: 37fb. を指
          定すれば、この属性がプロセスの標準エラー処理です。そうでなけれ
          ば、この属性は無視され、標準エラー出力のデフォルトはコンソール
          ウィンドウのバッファーです。

      -- の属性: wShowWindow

          *note dwFlags: 37f9. が *note STARTF_USESHOWWINDOW: 37ff. を指
          定すれば、この属性は ShowWindow(2) 関数の ‘nCmdShow’ 引数で指
          定された値なら、 ‘SW_SHOWDEFAULT’ 以外の任意のものにできます。
          しかし、この属性は無視されます。

          この属性には *note SW_HIDE: 3800. が提供されています。これは、
          *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(): 1104. when passed to the
               *note Popen: 4b7. constructor, else *note OSError: 2c2.
               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(): 167b.  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.19.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: 37fa, *note
     STARTUPINFO.hStdOutput: 37fc, および *note STARTUPINFO.hStdError:
     37fd. 属性を指定します。

 -- データ: subprocess.STARTF_USESHOWWINDOW

     追加情報を保持する、 *note STARTUPINFO.wShowWindow: 37fe. 属性を指
     定します。

 -- データ: subprocess.STARTF_FORCEONFEEDBACK

     A *note STARTUPINFO.dwFlags: 37f9. 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: 37f9. 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(): 1583. を使うのに必要です。

     *note CREATE_NEW_CONSOLE: 37e5. が指定されていたら、このフラグは無
     視されます。

 -- データ: 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.19.7.9 古い高水準 API
.......................

Python 3.5 より前のバージョンでは、サブプロセスに対して以下の 3 つの関数
からなる高水準 API が用意されていました。現在多くの場合 *note run():
d83. の使用で済みますが、既存の多くのコードではこれらの関数が使用されて
います。

 -- の関数: subprocess.call (args, *, stdin=None, stdout=None,
          stderr=None, shell=False, cwd=None, timeout=None,
          **other_popen_kwargs)

     'args' で指定されたコマンドを実行します。コマンドの終了を待ち、
     *note returncode: c87. 属性を返します。

     Code needing to capture stdout or stderr should use *note run():
     d83. instead:

          run(...).returncode

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     136a.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *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: 1540.  The ‘CalledProcessError’ object will
     have the return code in the *note returncode: 37d6. attribute.  If
     ‘check_call()’ 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():
     d83. instead:

          run(..., check=True)

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     136a.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *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:
     1540. 例外が送出されます。‘CalledProcessError’ オブジェクトには、リ
     ターンコードが *note returncode: 37d6. 属性に、コマンドからの出力が
     *note output: 37d8. 属性に、それぞれ格納されています。

     これは次と等価です:

          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(): d83.
     - most arguments are passed directly through to that interface.
     One API deviation from ‘run()’ 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
     よく使われる引数: 37c8. and *note run(): d83.

     標準エラー出力も結果に含めるには、‘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(): d83. 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.19.7.10 Replacing Older Functions with the ‘subprocess’ Module
................................................................

この節では、 "a becomes b" と書かれているものは a の代替として b が使え
るということを表します。

     注釈: この節で紹介されている "a" 関数は全て、実行するプログラムが見
     つからないときは (おおむね) 静かに終了します。それに対して "b" 代替
     手段は *note OSError: 2c2. 例外を送出します。

     また、要求された操作が非ゼロの終了コードを返した場合、*note
     check_output(): 11c8. を使用した置き換えは *note
     CalledProcessError: 1540. で失敗します。その出力は、送出された例外
     の *note output: 37d8. 属性として利用可能です。

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.19.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.19.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.19.7.13 ‘os.system()’ を置き換える
....................................

     sts = os.system("mycmd" + " myarg")
     # becomes
     retcode = call("mycmd" + " myarg", shell=True)

注釈:

   * このプログラムは普通シェル経由で呼び出す必要はありません。

   * The *note call(): d85. return value is encoded differently to that
     of *note os.system(): 167b.

   * The *note os.system(): 167b. 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.19.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.19.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.19.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():
     11c8. and return a 2-tuple ‘(exitcode, output)’.  'encoding' and
     'errors' are used to decode output; see the notes on *note
     よく使われる引数: 37c8. 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: 2199.: 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: c87.

     バージョン 3.11 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。

 -- の関数: subprocess.getoutput (cmd, *, encoding=None, errors=None)

     シェル中の 'cmd' を実行して出力 (stdout と stderr) を返します。

     *note getstatusoutput(): 11ca. に似ていますが、終了コードは無視され
     、コマンドの出力のみを返します。例えば:

          >>> subprocess.getoutput('ls /bin/ls')
          '/bin/ls'

     *note Availability: 2199.: Unix, Windows.

     バージョン 3.3.4 で変更: Windowsで利用可能になりました

     バージョン 3.11 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。


File: python.info,  Node: 注釈<2>,  Prev: レガシーなシェル呼び出し関数,  Up: subprocess --- サブプロセス管理

5.19.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.19.7.18 Timeout Behavior
..........................

When using the ‘timeout’ parameter in functions like *note run(): d83,
*note Popen.wait(): ee4, or *note Popen.communicate(): 1818, 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: 1819. 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.19.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.19.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.19.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: 1343. クラスはイベントをスケジュールするための一般
     的なインターフェースを定義します。それは "外の世界" を実際に扱うた
     めの2つの関数を必要とします -- 'timefunc' は引数なしで呼ばれて 1 つ
     の数値を返す callable オブジェクトでなければなりません (戻り値は任
     意の単位で「時間」を表します)。 'delayfunc' は 1 つの引数を持つ
     callable オブジェクトでなければならず、その時間だけ遅延する必要があ
     ります (引数は 'timefunc' の出力と互換)。 'delayfunc' は、各々のイ
     ベントが実行された後に引数 ‘0’ で呼ばれることがあります。これは、マ
     ルチスレッドアプリケーションの中で他のスレッドが実行する機会を与え
     るためです。

     バージョン 3.3 で変更: 'timefunc' と 'delayfunc' がオプション引数に
     なりました。

     バージョン 3.3 で変更: *note scheduler: 1343. クラスをマルチスレッ
     ド環境で安全に使用出来るようになりました。

以下はプログラム例です:

     >>> 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.19.8.1 スケジューラオブジェクト
.................................

*note scheduler: 1343. インスタンスは以下のメソッドと属性を持っています:

 -- メソッド: scheduler.enterabs (time, priority, action, argument=(),
          kwargs={})

     新しいイベントをスケジュールします。 引数 'time' は、コンストラクタ
     へ渡された 'timefunc' の戻り値と互換な数値型でなければいけません。
     同じ 'time' によってスケジュールされたイベントは、それらの
     'priority' によって実行されます。 数値の小さい方が高い優先度となり
     ます。

     イベントを実行することは、 ‘action(*argument, **kwargs)’ を実行する
     ことを意味します。 'argument' は 'action' のための位置引数を保持す
     るシーケンスでなければいけません。 'kwargs' は 'action' のためのキ
     ーワード引数を保持する辞書でなければいけません。

     戻り値は、後にイベントをキャンセルする時に使われる可能性のあるイベ
     ントです (*note cancel(): 1d59. を参照)。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.enter (delay, priority, action, argument=(),
          kwargs={})

     時間単位以上の 'delay' でイベントをスケジュールします。相対的時間以
     外の、引数、効果、戻り値は、 *note enterabs(): 1345. に対するものと
     同じです。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.cancel (event)

     キューからイベントを消去します。もし 'event' がキューにある現在のイ
     ベントでないならば、このメソッドは *note ValueError: 2ee. を送出し
     ます。

 -- メソッド: scheduler.empty ()

     もしイベントキューが空ならば、 ‘True’ を返します。

 -- メソッド: scheduler.run (blocking=True)

     すべてのスケジュールされたイベントを実行します。このメソッドは次の
     イベントを待ち、それを実行し、スケジュールされたイベントがなくなる
     まで同じことを繰り返します。(イベントの待機は、 コンストラクタへ渡
     された関数 'delayfunc' を使うことで行います。)

     If 'blocking' is false, immediately executes all events in the
     queue which have a time value less than or equal to the current
     'timefunc' value (if any) and returns the difference between the
     current 'timefunc' value and the time value of the next scheduled
     event in the scheduler's event queue.  If the queue is empty,
     returns ‘None’.

     'action' あるいは 'delayfunc' は例外を投げることができます。いずれ
     の場合も、スケジューラは一貫した状態を維持し、例外を伝播するでしょ
     う。例外が 'action' によって投げられる場合、イベントは *note run():
     1342. への呼出しを未来に行なわないでしょう。

     イベントのシーケンスが、次イベントの前に、利用可能時間より実行時間
     が長いと、スケジューラは単に遅れることになるでしょう。イベントが落
     ちることはありません; 呼出しコードはもはや適切でないキャンセルイベ
     ントに対して責任があります。

     バージョン 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.19.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: 15b0. 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: d65, 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.

     Simple queues are *note generic: 2429. over the type of their
     items.

     Added in version 3.7.

 -- 例外: queue.Empty

     空の *note Queue: 15b0. オブジェクトで、非ブロックメソッド *note
     get(): 325d. (または *note get_nowait(): 3820.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.Full

     満杯の *note Queue: 15b0. オブジェクトで、非ブロックメソッド *note
     put(): 3821. (または *note put_nowait(): 325c.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.ShutDown

     Exception raised when *note put(): 3821. or *note get(): 325d. is
     called on a *note Queue: 15b0. 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.19.9.1 キューオブジェクト
...........................

キューオブジェクト(*note Queue: 15b0, *note LifoQueue: 270f, *note
PriorityQueue: 2710.)は、以下の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: 370b. を送出します。 そうでない場
     合 ('block' が偽) は、空きスロットが直ちに利用できるならば、キュー
     にアイテムを置きます。 できないならば、例外 ‘Full’ を送出します (こ
     の場合 '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:
     370a. を送出します。 そうでない場合 ('block' が偽) は、直ちにアイテ
     ムが取り出せるならば、それを返します。 できないならば、例外 ‘Empty’
     を送出します (この場合 '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: bc9.

     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(): 325d. の後に *note task_done(): 3706. を呼び出すと、取り出し
     たタスクに対する処理が完了した事をキューに教えます。

     *note join(): 3707. がブロックされていた場合、全itemが処理された (キ
     ューに *note put(): 3821. された全てのitemに対して *note
     task_done(): 3706. が呼び出されたことを意味します) 時に復帰します。

     キューにある要素より多く呼び出された場合 *note ValueError: 2ee. が
     発生します。

 -- メソッド: Queue.join ()

     キューにあるすべてのアイテムが取り出されて処理されるまでブロックし
     ます。

     未完了のタスクのカウント値はキューにアイテムが追加されるときは常に
     加算され、コンシューマースレッドが *note task_done(): 3706. を呼び
     出してアイテムの回収とその全処理の完了が示されるときは常に減算され
     ます。未完了のタスクのカウント値がゼロになった場合、*note join():
     3707. のブロックが解除されます。

* Menu:

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


File: python.info,  Node: Waiting for task completion,  Next: Terminating queues,  Up: キューオブジェクト

5.19.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.19.9.3 Terminating queues
...........................

When no longer needed, *note Queue: 15b0. objects can be wound down
until empty or terminated immediately with a hard shutdown.

 -- メソッド: Queue.shutdown (immediate=False)

     Put a *note Queue: 15b0. instance into a shutdown mode.

     The queue can no longer grow.  Future calls to *note put(): 3821.
     raise *note ShutDown: 543.  Currently blocked callers of ‘put()’
     will be unblocked and will raise ‘ShutDown’ in the formerly blocked
     thread.

     If 'immediate' is false (the default), the queue can be wound down
     normally with *note get(): 325d. calls to extract tasks that have
     already been loaded.

     And if *note task_done(): 3706. is called for each remaining task,
     a pending *note join(): 3707. will be unblocked normally.

     Once the queue is empty, future calls to *note get(): 325d. 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(): 3707. are unblocked.  Also,
     blocked callers of *note get(): 325d. are unblocked and will raise
     *note ShutDown: 543. because the queue is empty.

     Use caution when using *note join(): 3707. 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.19.9.4 SimpleQueue オブジェクト
.................................

*note SimpleQueue: d65. オブジェクトは以下の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():
     3821.

     '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: 11b. callbacks.

 -- メソッド: SimpleQueue.put_nowait (item)

     ‘put(item, block=False)’ と等価です。*note Queue.put_nowait():
     325c. との互換性のためのメソッドです。

 -- メソッド: SimpleQueue.get (block=True, timeout=None)

     キューからアイテムを取り除き、それを返します。 オプション引数
     'block' が真で 'timeout' が ‘None’ (デフォルト) の場合は、必要であ
     ればアイテムが取り出せるようになるまでブロックします。 もし
     'timeout' が正の数の場合は、最大で 'timeout' 秒間ブロックし、その時
     間内でアイテムが取り出せるようにならなければ、例外 *note Empty:
     370a. を送出します。 そうでない場合 ('block' が偽) は、直ちにアイテ
     ムが取り出せるならば、それを返します。 できないならば、例外 ‘Empty’
     を送出します (この場合 'timeout' は無視されます)。

 -- メソッド: SimpleQueue.get_nowait ()

     ‘get(False)’ と等価です。

参考
....

*note multiprocessing.Queue: 1be7. クラス

     (マルチスレッドではなく) マルチプロセスの文脈で使用されるキュークラ
     ス。

*note collections.deque: 7f4. is an alternative implementation of
unbounded queues with fast atomic *note append(): 29f2. and *note
popleft(): 29f8. operations that do not require locking and also support
indexing.


File: python.info,  Node: contextvars --- コンテキスト変数,  Next: _thread --- 低水準なスレッド API,  Prev: queue --- 同期キュークラス,  Up: 並行実行

5.19.10 ‘contextvars’ -- コンテキスト変数
-----------------------------------------

__________________________________________________________________

このモジュールは、コンテキストローカルな状態を管理し、保持し、アクセスす
るための API を提供します。 *note ContextVar: 18da. クラスは 'コンテキス
ト変数' を宣言し、取り扱うために使われます。 非同期フレームワークで現時
点のコンテキストを管理するのには、 *note copy_context(): 36bd. 関数と
*note Context: 178. クラスを使うべきです。

Context managers that have state should use Context Variables instead of
*note threading.local(): 18c4. 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.19.10.1 コンテキスト変数
..........................

 -- クラス: contextvars.ContextVar (name[, *, default])

     このクラスは新しいコンテキスト変数を宣言するのに使われます。例えば
     、次の通りです:

          var: ContextVar[int] = ContextVar('var', default=42)

     必須のパラメータの 'name' は内観やデバッグの目的で使われます。

     オプションのキーワード専用引数 'default' は、現在のコンテキストにそ
     の変数の値が見付からなかったときに *note ContextVar.get(): 3834. か
     ら返されます。

     '重要:' コンテキスト変数は、モジュールのトップレベルで生成する必要
     があり、クロージャの中で作成すべきではありません。*note Context:
     178. オブジェクトはコンテキスト変数への強参照を持っており、コンテキ
     スト変数がガーベジコレクトされるのを防ぎます。

     ‘ContextVar’s are *note generic: 2429. over the type of their
     contained value.

      -- の属性: name

          変数の名前。読み出し専用のプロパティです。

          Added in version 3.7.1.

      -- メソッド: get ([default])

          現在のコンテキストのコンテキスト変数の値を返します。

          現在のコンテキストのコンテキスト変数に値がなければ、メソッドは
          :

             * メソッドの 'default' 引数に値が指定されていればその値を返
               します。さもなければ

             * コンテキスト変数が生成された時にデフォルト値が渡されてい
               れば、その値を返します。さもなければ

             * *note LookupError: 2445. を送出します。

      -- メソッド: set (value)

          現在のコンテキストのコンテキスト変数に新しい値を設定する際に呼
          び出します。

          'value' は必須の引数で、コンテキスト変数の新しい値を指定します
          。

          *note Token: 1e4. オブジェクトを返します。このオブジェクトを
          *note ContextVar.reset(): 3836. メソッドに渡すことで、以前の値
          に戻すことができます。

          For convenience, the token object can be used as a context
          manager to avoid calling *note ContextVar.reset(): 3836.
          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(): 1788. が呼び出される前の値にリセットします。

          例えば:

               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(): 1788.
     method.  They can be passed to the *note ContextVar.reset(): 3836.
     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: 23de. to
     automatically reset context variables.  See *note ContextVar.set():
     1788.

     Tokens are *note generic: 2429. over the same type as the *note
     ContextVar: 18da. which created them.

     Added in version 3.14: Added support for usage as a context
     manager.

      -- の属性: var

          読み出し専用のプロパティです。トークンを生成した *note
          ContextVar: 18da. オブジェクトを指します。

      -- の属性: old_value

          読み出し専用のプロパティです。このトークンを作成した *note
          ContextVar.set(): 1788. メソッドの呼び出しの前に持っていた値に
          設定されています。もし呼び出しの前に値が設定されていなければ
          *note Token.MISSING: 185f. を指します。

      -- の属性: MISSING

          *note Token.old_value: 3838. で利用されるマーカーオブジェクト
          です。


File: python.info,  Node: マニュアルでのコンテキスト管理,  Next: asyncio サポート,  Prev: コンテキスト変数,  Up: contextvars --- コンテキスト変数

5.19.10.2 マニュアルでのコンテキスト管理
........................................

 -- の関数: contextvars.copy_context ()

     現在の *note Context: 178. オブジェクトのコピーを返します。

     次のスニペットは、現在のコンテキストのコピーを取得し、コンテキスト
     に設定されているすべての変数とその値を表示します:

          ctx: Context = copy_context()
          print(list(ctx.items()))

     この関数の複雑性は 'O'(1) です。つまり、少数のコンテキスト変数を持
     つコンテキストと多くの変数を持つコンテキストで同程度の速度で動作し
     ます。

 -- クラス: contextvars.Context

     ‘ContextVars’ とその値の対応付け。

     ‘Context()’ は、値を持たない空のコンテキストを生成します。現在のコ
     ンテキストのコピーを得るには、*note copy_context(): 36bd. 関数を利
     用します。

     Each thread has its own effective stack of ‘Context’ objects.  The
     *note current context: 19c4. 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():
     19ab. 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(): 19ab. 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:
     18da. objects behave in a similar fashion to *note
     threading.local(): 18c4. when values are assigned in different
     threads.

     Attempting to enter an already entered context, including contexts
     entered in other threads, raises a *note RuntimeError: 246.

     After exiting a context, it can later be re-entered (from any
     thread).

     Any changes to *note ContextVar: 18da. values via the *note
     ContextVar.set(): 1788. method are recorded in the current context.
     The *note ContextVar.get(): 3834. 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: acb. インターフェースを
     実装します。

      -- メソッド: 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: 18da. '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.19.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.19.11 ‘_thread’ -- 低水準なスレッド API
-----------------------------------------

__________________________________________________________________

このモジュールはマルチスレッド (別名 '軽量プロセス' ('light-weight
processes')または 'タスク' ('tasks')) に用いられる低水準プリミティブを提
供します -- グローバルデータ空間を共有するマルチスレッドを制御します。同
期のための単純なロック (別名 'mutexes' またはバイナリセマフォ ('binary
semaphores'))が提供されています。 *note threading: f3. モジュールは、こ
のモジュール上で、より使い易く高級なスレッディングの API を提供します。

バージョン 3.7 で変更: このモジュールは以前はオプションでしたが、常に利
用可能なモジュールとなりました。

このモジュールでは以下の定数および関数を定義しています:

 -- 例外: _thread.error

     スレッド固有の例外です。

     バージョン 3.3 で変更: 現在は組み込みの *note RuntimeError: 246. の
     別名です。

 -- の関数: _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: f40. exception, it is
     silently ignored.

     Raises an *note auditing event: 1ccb. ‘_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: 255. is simulated.

     If the given signal isn't handled by Python (it was set to *note
     signal.SIG_DFL: 1c0f. or *note signal.SIG_IGN: 1c0e.), 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(): 1bed.

 -- の関数: _thread.exit ()

     *note SystemExit: f40. を送出します。それが捕えられないときは、静か
     にスレッドを終了させます。

 -- の関数: _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: 2199.: 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: 246. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 2ee. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 2199.: Windows, pthreads.

     Unix platforms with POSIX threads support.

 -- データ: _thread.TIMEOUT_MAX

     The maximum value allowed for the 'timeout' parameter of *note
     Lock.acquire: 8a8.  Specifying a timeout greater than this value
     will raise an *note OverflowError: a85.

     Added in version 3.2.

 -- クラス: _thread.LockType

     これはロックオブジェクトのタイプです。

     ロックオブジェクトは次のようなメソッドを持っています:

      -- メソッド: 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.

      -- メソッド: release ()

          ロックを解放します。そのロックは既に獲得されたものでなければな
          りませんが、しかし同じスレッドによって獲得されたものである必要
          はありません。

      -- メソッド: locked ()

          ロックの状態を返します: 同じスレッドによって獲得されたものなら
          ‘True’ 、違うのなら ‘False’ を返します。

     これらのメソッドに加えて、ロックオブジェクトは *note with: 187. 文
     を通じて以下の例のように使うこともできます。

          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: bc9. exception will be received by that thread.)

   * *note sys.exit(): 279. を呼び出す、あるいは *note SystemExit: f40.
     例外を送出することは、 *note _thread.exit(): 3844. を呼び出すことと
     同じです。

   * メインスレッドが終了したとき、他のスレッドが生き残るかどうかは、シ
     ステムに依存します。多くのシステムでは、 *note try: 8f9. ...  *note
     finally: 1b1. 節や、オブジェクトデストラクタを実行せずに終了されま
     す。


File: python.info,  Node: ネットワーク通信とプロセス間通信,  Next: インターネット上のデータの操作,  Prev: 並行実行,  Up: Python 標準ライブラリ

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

この章で解説しているモジュールはネットワーク通信とプロセス間通信の仕組み
を提供しています。

例えば *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.20.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: 3853.

     asyncio の基本が解説されています。

asyncio は次の目的で '高レベル' API を提供しています:

   * 並行に *note Python コルーチンを起動: 3854. し、実行全体を管理する

   * *note ネットワーク IO と IPC: 3855. を執り行う

   * *note subprocesses: 3856. を管理する

   * *note キュー: 3857. を使ってタスクを分散する

   * 並列処理のコードを *note 同期: 3858. させる

これに加えて、 'ライブラリやフレームワークの開発者' が次のことをするため
の '低レベル' API があります:

   * *note ネットワーク通信: 3859. 、 *note サブプロセス: 385a. の実行、
     *note OS シグナル: 385b. の取り扱いなどのための非同期 API を提供す
     る *note イベントループ: f7a. の作成と管理を行う

   * *note Transport: 385c. を使った効率的な protocol を実装します

   * コールバックを用いたライブラリと async/await 構文を使ったコードの
     *note 橋渡し: 385d.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

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:
1b8.  It is recommended that the default REPL is used for full
functionality and the latest features.

引数無しで *note 監査イベント: 1ccb. ‘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: 1ba. is also executed.  Emits audit events.

リファレンス
............

* Menu:

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


File: python.info,  Node: Runners,  Next: Coroutines and tasks,  Up: asyncio --- 非同期 I/O

5.20.1.1 Runners
................

'ソースコード:' Lib/asyncio/runners.py(1)

この節では、asyncio のコードを実行するための高レベルの asyncio のプリミ
ティブの概略を解説します。

これらは *note イベントループ: f7a. の上に構築されており、一般的な広く普
及しているシナリオでの非同期コードの使用を簡素化することを目的としていま
す。

* 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.20.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 デバッグモード: 2195. 設定を尊重するために ‘None’ が使用され
     ます。

     If 'loop_factory' is not ‘None’, it is used to create a new event
     loop; otherwise *note asyncio.new_event_loop(): 3862. 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:
     1ac8. 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(): ae8.
     メソッドを使うように更新されました。

     バージョン 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.20.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: f7a. and *note contextvars.Context: 178.

     'debug' が ‘True’ の場合、イベントループはデバッグモードで実行され
     ます。‘False’ は明示的にデバッグモードを無効化します。 グローバルな
     *note デバッグモード: 2195. 設定を尊重するために ‘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():
     3862. is used and set as current event loop with *note
     asyncio.set_event_loop(): 1bb4. if 'loop_factory' is ‘None’.

     Basically, *note asyncio.run(): 2f5. 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: 178. 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: 178.

      -- メソッド: get_loop ()

          Return the event loop associated with the runner instance.

          注釈: ‘Runner’ uses the lazy initialization strategy, its
          constructor doesn't initialize underlying low-level
          structures.

          Embedded 'loop' and 'context' are created at the *note with:
          187. body entering or the first call of *note run(): 2f5. or
          *note get_loop(): 3865.


File: python.info,  Node: Handling Keyboard Interruption,  Prev: Runner context manager,  Up: Runners

5.20.1.4 Handling Keyboard Interruption
.......................................

Added in version 3.11.

When *note signal.SIGINT: 255. is raised by ‘Ctrl’-‘C’, *note
KeyboardInterrupt: bc9. 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:
255. as follows:

  1. *note asyncio.Runner.run(): 19ad. installs a custom *note
     signal.SIGINT: 255. handler before any user code is executed and
     removes it when exiting from the function.

  2. The *note Runner: 2f7. creates the main task for the passed
     coroutine for its execution.

  3. When *note signal.SIGINT: 255. 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(): 19ad. raises *note KeyboardInterrupt:
     bc9.

  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: bc9. without cancelling the main task.


File: python.info,  Node: Coroutines and tasks,  Next: ストリーム,  Prev: Runners,  Up: asyncio --- 非同期 I/O

5.20.1.5 Coroutines and tasks
.............................

この節では、コルーチンと Task を利用する高レベルの asyncio の API の概略
を解説します。

* Menu:

* コルーチン: コルーチン<3>.
* Awaitable::
* Creating tasks::
* Task cancellation::
* Task groups::
* スリープ::
* Running tasks concurrently::
* Eager task factory::
* Shielding from cancellation::
* タイムアウト::
* Waiting primitives::
* Running in threads::
* Scheduling from other threads::
* イントロスペクション::
* Task object::


File: python.info,  Node: コルーチン<3>,  Next: Awaitable,  Up: Coroutines and tasks

5.20.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(): 2f5. 関数 (上の例を参照してください。)

   * コルーチンを 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: 1c9. としてコルーチンを並行して走らせる
     *note asyncio.create_task(): 1cb. 関数。

     上のコード例を編集して、ふたつの ‘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(): 1cb.  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: Creating tasks,  Prev: コルーチン<3>,  Up: Coroutines and tasks

5.20.1.7 Awaitable
..................

あるオブジェクトを *note await: 18e. 式の中で使うことができる場合、その
オブジェクトを '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(): 1cb. のような関数で、コルーチンが '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: dca. は、非同期処理の '最終結果' を表現する特別な '低レベ
ルの' 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(): aea. です。


File: python.info,  Node: Creating tasks,  Next: Task cancellation,  Prev: Awaitable,  Up: Coroutines and tasks

5.20.1.8 Creating tasks
.......................

'ソースコード:' Lib/asyncio/tasks.py(1)

__________________________________________________________________

 -- の関数: asyncio.create_task (coro, *, name=None, context=None,
          eager_start=None, **kwargs)

     'coro' *note coroutine: 3854. を *note Task: 1c9. でラップし、その
     実行をスケジュールします。 Task オブジェクトを返します。

     The full function signature is largely the same as that of the
     *note Task: 1c9. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 178. を指定できます。
     '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(): 1ca. will be used.

     その Task オブジェクトは *note get_running_loop(): d05. から返され
     たループの中で実行されます。現在のスレッドに実行中のループが無い場
     合は、 *note RuntimeError: 246. が送出されます。

          注釈: *note asyncio.TaskGroup.create_task(): 1cd. 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: Task cancellation,  Next: Task groups,  Prev: Creating tasks,  Up: Coroutines and tasks

5.20.1.9 Task cancellation
..........................

タスクは簡単に、そして安全にキャンセルできます。タスクがキャンセルされた
場合、*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.  ‘asyncio.CancelledError’ 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 ‘asyncio.CancelledError’ is truly desired, it is
necessary to also call ‘uncancel()’ to completely remove the
cancellation state.


File: python.info,  Node: Task groups,  Next: スリープ,  Prev: Task cancellation,  Up: Coroutines and tasks

5.20.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():
     1cb.  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(): 1cb.  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(): 1cc.

以下はプログラム例です:

     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__(): 1a00. hasn't been called yet),
the task directly containing the ‘async with’ statement is also
cancelled.  The resulting ‘asyncio.CancelledError’ 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: bc9. or *note SystemExit: f40, the task group still
cancels the remaining tasks and waits for them, but then the initial
‘KeyboardInterrupt’ or ‘SystemExit’ 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__(): 1a00. 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
‘__aexit__()’, unless it is *note asyncio.CancelledError: 4d4, is also
included in the exception group.  The same special case is made for
*note KeyboardInterrupt: bc9. and *note SystemExit: f40. as in the
previous paragraph.

Task groups are careful not to mix up the internal cancellation used to
"wake up" their *note __aexit__(): 1a00. 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:
18e, 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.20.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())

Expected output:

     Task 1: start
     Task 2: start
     Task 1: done


File: python.info,  Node: スリープ,  Next: Running tasks concurrently,  Prev: Task groups,  Up: Coroutines and tasks

5.20.1.12 スリープ
..................

 -- の関数: async asyncio.sleep (delay, result=None)

     'delay' 秒だけ停止します。

     'result' が提供されている場合は、コルーチン完了時にそれが呼び出し元
     に返されます。

     ‘sleep()’ は常に現在の Task を一時中断し、他の Task が実行されるの
     を許可します。

     delay を 0 に設定することで、他のタスクを実行可能にする最適な方針を
     提供します。この方法は、実行時間の長い関数が、その実行時間全体にわ
     たってイベントループをブロックしないようにするために利用できます。
     現在の時刻を5秒間、毎秒表示するコルーチンの例:

          import asyncio
          import datetime as dt

          async def display_date():
              loop = asyncio.get_running_loop()
              end_time = loop.time() + 5.0
              while True:
                  print(dt.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: 2ee. if 'delay' is
     *note nan: 874.


File: python.info,  Node: Running tasks concurrently,  Next: Eager task factory,  Prev: スリープ,  Up: Coroutines and tasks

5.20.1.13 Running tasks concurrently
....................................

 -- の関数: awaitable asyncio.gather (*aws, return_exceptions=False)

     'aws' シーケンスにある *note awaitable オブジェクト: 386b. を '並行
     ' 実行します。

     '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: Shielding from cancellation,  Prev: Running tasks concurrently,  Up: Coroutines and tasks

5.20.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): 1ca.),
     coroutines begin execution synchronously during *note Task: 1c9.
     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: 1c9.

     'custom_task_constructor' must be a 'callable' with the signature
     matching the signature of *note Task.__init__: 1c9.  The callable
     must return a *note asyncio.Task: 1c9.-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):
     1ca.).

     Added in version 3.12.


File: python.info,  Node: Shielding from cancellation,  Next: タイムアウト,  Prev: Eager task factory,  Up: Coroutines and tasks

5.20.1.15 Shielding from cancellation
.....................................

 -- の関数: awaitable asyncio.shield (aw)

     *note キャンセル: 4d3. から *note awaitable オブジェクト: 386b. を
     保護します。

     '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: Waiting primitives,  Prev: Shielding from cancellation,  Up: Coroutines and tasks

5.20.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(): 387a.

     以下はプログラム例です:

          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: a3a. 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: a3a, which means the ‘TimeoutError’ can
          only be caught 'outside' of the context manager.

     Example of catching *note TimeoutError: a3a.:

          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(): 1c10. 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: 386b. が、完了するかタイムアウトになるのを待
     ちます。

     'aw' がコルーチンだった場合、自動的に Task としてスケジュールされま
     す。

     'timeout' には ‘None’ もしくは待つ秒数の浮動小数点数か整数を指定で
     きます。 'timeout' が ‘None’ の場合、 Future が完了するまで待ちます
     。

     If a timeout occurs, it cancels the task and raises *note
     TimeoutError: a3a.

     Task の *note キャンセル: 4d3. を避けるためには、 *note shield():
     c69. の中にラップしてください。

     この関数は 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: a3a. immediately.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: Raises *note TimeoutError: a3a. instead of
     *note asyncio.TimeoutError: 1b17.


File: python.info,  Node: Waiting primitives,  Next: Running in threads,  Prev: タイムアウト,  Up: Coroutines and tasks

5.20.1.17 Waiting primitives
............................

 -- の関数: async asyncio.wait (aws, *, timeout=None,
          return_when=ALL_COMPLETED)

     Run *note Future: dca. and *note Task: 1c9. 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: a3a.
     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: 3881.
                                                            
                                                            
      -- データ: 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: 386b. 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: a3a. 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: Running in threads,  Next: Scheduling from other threads,  Prev: Waiting primitives,  Up: Coroutines and tasks

5.20.1.18 Running in threads
............................

 -- の関数: async asyncio.to_thread (func, /, *args, **kwargs)

     別のスレッドで非同期的に関数 'func' を実行します。

     この関数に渡された *args と **kwargs は関数 'func' に直接渡されます
     。また、イベントループスレッドのコンテキスト変数に関数を実行するス
     レッドからアクセスできるように、現在の *note contextvars.Context:
     178. も伝播されます。

     関数 '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: 165, ‘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: Scheduling from other threads,  Next: イントロスペクション,  Prev: Running in threads,  Up: Coroutines and tasks

5.20.1.19 Scheduling from other threads
.......................................

 -- の関数: asyncio.run_coroutine_threadsafe (coro, loop)

     与えられたイベントループにコルーチンを送ります。 この処理は、スレッ
     ドセーフです。

     他の OS スレッドから結果を待つための *note
     concurrent.futures.Future: 13ce. を返します。

     この関数は、イベントループが動作しているスレッドとは異なる 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 並行処理とマルチスレッド処理: 3884. 節を参
     照してください。

     他の asyncio 関数とは異なり、この関数は明示的に渡される 'loop' 引数
     を必要とします。

     Added in version 3.5.1.


File: python.info,  Node: イントロスペクション,  Next: Task object,  Prev: Scheduling from other threads,  Up: Coroutines and tasks

5.20.1.20 イントロスペクション
..............................

 -- の関数: asyncio.current_task (loop=None)

     現在実行中の *note Task: 1c9. インスタンスを返します。実行中の Task
     が無い場合は ‘None’ を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): d05. が現在のル
     ープを取得するのに使われます。

     Added in version 3.7.

 -- の関数: asyncio.all_tasks (loop=None)

     ループで実行された *note Task: 1c9. オブジェクトでまだ完了していな
     いものの集合を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): d05. は現在のル
     ープを取得するのに使われます。

     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 object,  Prev: イントロスペクション,  Up: Coroutines and tasks

5.20.1.21 Task object
.....................

 -- クラス: asyncio.Task (coro, *, loop=None, name=None, context=None,
          eager_start=False)

     Python *note コルーチン: 3854. を実行する *note Future 類: dca. オ
     ブジェクトです。 スレッドセーフではありません。

     Task はイベントループのコルーチンを実行するのに使われます。 Future
     でコルーチンが待機している場合、 Task は自身のコルーチンの実行を一
     時停止させ、 Future の完了を待ちます。 Future が '完了' したら、
     Task が内包しているコルーチンの実行を再開します。

     イベントループは協調スケジューリングを使用します。つまり、イベント
     ループは同時に 1 つの Task のみ実行します。 Task が Future の完了を
     待っているときは、イベントループは他の Task やコールバックを動作さ
     せるか、 IO 処理を実行します。

     Task を作成するには高レベルの *note asyncio.create_task(): 1cb. 関
     数、あるいは低レベルの *note loop.create_task(): 1cc. 関数や *note
     ensure_future(): e75. 関数を使用してください。 手作業での Task の実
     装は推奨されません。

     To cancel a running Task use the *note cancel(): 4d3. method.
     Calling it will cause the Task to throw a *note CancelledError:
     4d4. exception into the wrapped coroutine.  If a coroutine is
     awaiting on a Future object during cancellation, the Future object
     will be cancelled.

     *note cancelled(): 3888. は、タスクがキャンセルされたかを調べるのに
     使用できます。タスクを内包するコルーチンで *note CancelledError:
     4d4. 例外が抑制されておらず、かつタスクが実際にキャンセルされている
     場合に、このメソッドは ‘True’ を変えます。

     *note asyncio.Task: 1c9. は、*note Future.set_result(): 3889. と
     *note Future.set_exception(): e7c. を除いて、*note Future: dca. の
     API をすべて継承しています。

     An optional keyword-only 'context' argument allows specifying a
     custom *note contextvars.Context: 178. 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: 1c9. 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.

     Tasks are *note generic: 2429. over the return type of their
     wrapped coroutines.

     バージョン 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: 388c. exception.

      -- メソッド: exception ()

          Task の例外を返します。

          ラップされたコルーチンが例外を送出した場合、その例外が返されま
          す。ラップされたコルーチンが正常終了した場合、このメソッドは
          ‘None’ を返します。

          Task が 'キャンセル' されている場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          Task がまだ '完了' していない場合、このメソッドは *note
          InvalidStateError: 388c. 例外を送出します。

      -- メソッド: add_done_callback (callback, *, context=None)

          Task が '完了' したときに実行されるコールバックを追加します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.add_done_callback(): d02. のドキュ
          メントを参照してください。

      -- メソッド: remove_done_callback (callback)

          コールバックリストから 'callback' を削除します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.remove_done_callback(): 1971. のド
          キュメントを参照してください。

      -- メソッド: get_stack (*, limit=None)

          このタスクのスタックフレームのリストを返します。

          コルーチンが完了していない場合、これはサスペンドされた時点での
          スタックを返します。コルーチンが正常に処理を完了したか、キャン
          セルされていた場合は空のリストを返します。コルーチンが例外で終
          了した場合はトレースバックフレームのリストを返します。

          フレームは常に古いものから新しい物へ並んでいます。

          サスペンドされているコルーチンの場合スタックフレームが 1 個だ
          け返されます。

          オプション引数 'limit' は返すフレームの最大数を指定します; デ
          フォルトでは取得可能な全てのフレームを返します。返されるリスト
          の順番は、スタックが返されるか、トレースバックが返されるかによ
          って変わります: スタックでは新しい順に並んだリストが返されます
          が、トレースバックでは古い順に並んだリストが返されます（これは
          traceback モジュールの振る舞いと一致します）。

      -- メソッド: print_stack (*, limit=None, file=None)

          このタスクのスタックまたはトレースバックを出力します。

          このメソッドは *note get_stack(): 3890. によって取得されるフレ
          ームに対し、 traceback モジュールと同じような出力を生成します
          。

          引数 'limit' は *note get_stack(): 3890. にそのまま渡されます
          。

          The 'file' argument is an I/O stream to which the output is
          written; by default output is written to *note sys.stdout:
          cd1.

      -- メソッド: get_coro ()

          *note Task: 1c9. がラップしているコルーチンオブジェクトを返し
          ます。

               注釈: This will return ‘None’ for Tasks which have
               already completed eagerly.  See the *note Eager Task
               Factory: 3876.

          Added in version 3.8.

          バージョン 3.12 で変更: Newly added eager task execution means
          result may be ‘None’.

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 178. 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():
          1c3. メソッドの出力で確認できます。

          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: 8f9.
          ...  ...  ‘except CancelledError’ ...  *note finally: 1b1.
          block.  Therefore, unlike *note Future.cancel(): 1c06,
          ‘Task.cancel()’ 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 ‘uncancel()’ 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: 3870. 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 ‘uncancel()’.
          *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(): 3888. 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: Coroutines and tasks,  Up: asyncio --- 非同期 I/O

5.20.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 使用例: 3897. 節も参照してください。

ストリーム関数
..............

以下の 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: 17d7.
     と *note StreamWriter: 1ad1. クラスのインスタンスです。

     'limit' は戻り値の *note StreamReader: 17d7. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_connection(): 818. に渡されます
     。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1ad1. created.  To close the socket,
          call its *note close(): 3898. 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: 17d7. と *note StreamWriter: 1ad1. クラスのインスタン
     スのペア ‘(reader, writer)’ を2つの引数として受け取ります。

     'client_connected_cb' には単純な呼び出し可能オブジェクトか、または
     *note コルーチン関数: 3854. を指定します; コルーチン関数が指定され
     た場合、コールバックの呼び出しは自動的に *note Task: 1c9. としてス
     ケジュールされます。

     'limit' は戻り値の *note StreamReader: 17d7. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_server(): d0d. に渡されます。

          注釈: The 'sock' argument transfers ownership of the socket to
          the server created.  To close the socket, call the server's
          *note close(): 3899. 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(): d12. と似ていますが Unix ソケッ
     トに対して動作します。

     *note loop.create_unix_connection(): 389b. のドキュメントも参照して
     ください。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1ad1. created.  To close the socket,
          call its *note close(): 3898. method.

     *note Availability: 2199.: 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(): d13. と似ていますが 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(): 3899. method.

     *note Availability: 2199.: 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.20.1.23 StreamReader
......................

 -- クラス: asyncio.StreamReader

     Represents a reader object that provides APIs to read data from the
     IO stream.  As an *note asynchronous iterable: f78, the object
     supports the *note async for: ca5. statement.

     'StreamReader' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): d12. や *note
     start_server(): d13. を使ってください。

      -- メソッド: feed_eof ()

          EOF の肯定応答を行います。

      -- メソッド: async read (n=-1)

          ストリームから最大 'n' バイト読み込みます。

          'n' が指定されないか ‘-1’ が指定されていた場合 EOF になるまで
          読み込み、読み込まれた全ての *note bytes: 193. を返します。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: 1d46. を送出します。部分的に読み出したデ
          ータを取得するには *note IncompleteReadError.partial: 38a1. 属
          性を使ってください。

      -- メソッド: async readuntil (separator=b'\n')

          'separator' が見つかるまでストリームからデータを読み出します。

          成功時には、データと区切り文字は内部バッファから削除されます
          (消費されます)。返されるデータの最後には区切り文字が含まれます
          。

          読み出したデータの量が設定したストリームの上限を超えると *note
          LimitOverrunError: 38a2. 例外が送出されます。このときデータは
          内部バッファーに残され、再度読み出すことができます。

          完全な区切り文字が見つかる前に EOF に達すると *note
          IncompleteReadError: 1d46. 例外が送出され、内部バッファーがリ
          セットされます。このとき *note IncompleteReadError.partial:
          38a1. 属性は区切り文字の一部を含むかもしれません。

          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: 38a2, 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(): 389e. が呼ばれていた場合
          ‘True’ を返します。


File: python.info,  Node: StreamWriter,  Next: 使用例<22>,  Prev: StreamReader,  Up: ストリーム

5.20.1.24 StreamWriter
......................

 -- クラス: asyncio.StreamWriter

     IO ストリームにデータを書き込むための API を提供するライターオブジ
     ェクトを表します。

     'StreamWriter' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): d12. や *note
     start_server(): d13. を使ってください。

      -- メソッド: 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(): 38a8. メソッドを
          サポートしている場合 ‘True’ を返し、そうでない場合は ‘False’ を
          返します。

      -- メソッド: write_eof ()

          バッファーされた書き込みデータを全て書き込んでから、ストリーム
          の書き込み側終端をクローズします。

      -- の属性: transport

          背後にある asyncio トランスポートを返します。

      -- メソッド: get_extra_info (name, default=None)

          オプションのトランスポート情報にアクセスします。詳細は *note
          BaseTransport.get_extra_info(): c97. を参照してください。

      -- メソッド: async drain ()

          ストリームへの書き込み再開に適切な状態になるまで待ちます。使用
          例:

               writer.write(data)
               await writer.drain()

          このメソッドは背後にある IO 書き込みバッファーとやりとりを行う
          フロー制御メソッドです。バッファーのサイズが最高水位点に達した
          場合、'drain()' はバッファのサイズが最低水位点を下回るまで減量
          され、書き込み再開可能になるまで書き込みをブロックします。待ち
          受けの必要がない場合、 *note drain(): 1b88. は即座にリターンし
          ます。

      -- メソッド: 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: 355. インスタ
               ンスです。

             * '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(): 3898. 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.20.1.25 使用例
................

* Menu:

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


File: python.info,  Node: ストリームを使った TCP Echo クライアント,  Next: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.20.1.26 ストリームを使った TCP Echo クライアント
..................................................

*note asyncio.open_connection(): d12. 関数を使った 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 エコークライアントプロトコル: 38ad. の例は低水準の *note
loop.create_connection(): 818. メソッドを使っています。


File: python.info,  Node: ストリームを使った TCP Echo サーバー,  Next: HTTP ヘッダーの取得,  Prev: ストリームを使った TCP Echo クライアント,  Up: 使用例<22>

5.20.1.27 ストリームを使った TCP Echo サーバー
..............................................

*note asyncio.start_server(): d13. 関数を使った 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 エコーサーバープロトコル: 38b0. の例は *note
loop.create_server(): d0d. メソッドを使っています。


File: python.info,  Node: HTTP ヘッダーの取得,  Next: ストリームを使ってデータを待つオープンソケットの登録,  Prev: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.20.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.20.1.29 ストリームを使ってデータを待つオープンソケットの登録
..............................................................

*note open_connection(): d12. 関数を使ってソケットがデータを受信するまで
待つコルーチンです:

     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
プロトコルを使ってオープンしたソケットをデータ待ち受けのために登録する:
38b4. 例では、低水準のプロトコルと *note loop.create_connection(): 818.
メソッドを使っています。

*note ファイル記述子の読み出しイベントを監視する: 38b5. 例では、低水準の
*note loop.add_reader(): 38b6. メソッドを使ってファイル記述子を監視して
います。


File: python.info,  Node: 同期プリミティブ<2>,  Next: サブプロセス,  Prev: ストリーム,  Up: asyncio --- 非同期 I/O

5.20.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: c6a.

   * *note Event: 2f6.

   * *note Condition: c6b.

   * *note Semaphore: c6c.

   * *note BoundedSemaphore: c6d.

   * *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.20.1.31 Lock
..............

 -- クラス: asyncio.Lock

     asyncio タスクのためのミューテックスロックを実装しています。スレッ
     ドセーフではありません。

     asyncio ロックは、共有リソースに対する排他的なアクセスを保証するた
     めに使うことができます。

     Lock の望ましい使用方法は、 *note async with: 186. 文と組み合わせて
     使うことです:

          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(): 38bb. メソッドによりロック
          の解除を待ち受けている場合、最終的にただひとつのコルーチンが実
          行されます。

          ロックの獲得は '公平' です: すなわちロックを獲得して実行される
          コルーチンは、最初にロックの待ち受けを開始したコルーチンです。

      -- メソッド: release ()

          ロックを解放します。

          ロックが 'ロック状態' の場合、 ロックを '解除状態' にしてリタ
          ーンします。

          ロックが '解除状態' の場合、 *note RuntimeError: 246. 例外が送
          出されます。

      -- メソッド: locked ()

          'ロック状態' の場合に ‘True’ を返します。


File: python.info,  Node: Event,  Next: Condition,  Prev: Lock,  Up: 同期プリミティブ<2>

5.20.1.32 Event
...............

 -- クラス: asyncio.Event

     イベントオブジェクトです。スレッドセーフではありません。

     asyncio イベントは、複数の asyncio タスクに対して何らかのイベントが
     発生したことを通知するために使うことができます。

     Event オブジェクトは内部フラグを管理します。フラグの値は *note
     set(): 38bf. メソッドにより 'true' に、また *note clear(): 38c0. メ
     ソッドにより 'false' に設定することができます。 *note wait(): 38c1.
     メソッドはフラグが '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(): 38bf. メソッドを呼び出すまで
          処理をブロックします。

      -- メソッド: set ()

          イベントをセットします。

          イベントがセットされるまで待機している全てのタスクは、即座に通
          知を受けて実行を再開します。

      -- メソッド: clear ()

          イベントをクリア (アンセット) します

          Subsequent tasks awaiting on *note wait(): 38c1. will now
          block until the *note set(): 38bf. method is called again.

      -- メソッド: is_set ()

          イベントがセットされている場合 ‘True’ を返します。


File: python.info,  Node: Condition,  Next: Semaphore,  Prev: Event,  Up: 同期プリミティブ<2>

5.20.1.33 Condition
...................

 -- クラス: asyncio.Condition (lock=None)

     条件変数オブジェクトです。スレッドセーフではありません。

     asyncio 条件プリミティブは何らかのイベントが発生するのを待ち受け、
     そのイベントを契機として共有リソースへの排他的なアクセスを得るため
     に利用することができます。

     本質的に、 Condition オブジェクトは *note Event: 2f6. と a *note
     Lock: c6a. の2つのクラスの機能を組み合わせたものです。複数の
     Condition オブジェクトが単一の Lock を共有することでができます。こ
     れにより、共有リソースのそれぞれの状態に関連する異なるタスクの間で
     、そのリソースへの排他的アクセスを調整することが可能になります。

     オプション引数 'lock' は *note Lock: c6a. または ‘None’ でなければ
     なりません。後者の場合自動的に新しい Lock オブジェクトが生成されま
     す。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     Condition の望ましい使用方法は *note async with: 186. 文と組み合わ
     せて使うことです:

          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: 246. 例外が送出されます。

      -- メソッド: locked ()

          下層のロックを獲得していれば ‘True’ を返します。

      -- メソッド: notify_all ()

          この条件を待ち受けている全てのタスクを起動します。

          このメソッドは *note notify(): 1a57. と同じように振る舞います
          が、待ち受けている全てのタスクを起動します。

          このメソッドが呼び出される前にロックを獲得しておかなければなり
          ません。また、メソッド呼び出し後速やかにロックを解除しなければ
          なりません。 '解除された' ロックとと共に呼び出された場合、
          *note RuntimeError: 246. 例外が送出されます。

      -- メソッド: release ()

          下層のロックを解除します。

          アンロック状態のロックに対して呼び出された場合、*note
          RuntimeError: 246. が送出されます。

      -- メソッド: async wait ()

          通知を受けるまで待機します。

          このメソッドが呼び出された時点で呼び出し元のタスクがロックを獲
          得していない場合、 *note RuntimeError: 246. 例外が送出されます
          。

          このメソッドは下層のロックを解除し、その後 *note notify():
          1a57. または *note notify_all(): 38c7. の呼び出しによって起動
          されるまで処理をブロックします。いったん起動されると、
          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 ‘wait()’ again.  For this reason, you may prefer
          to use *note wait_for(): 38c9. 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(): 1a82. 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.20.1.34 Semaphore
...................

 -- クラス: asyncio.Semaphore (value=1)

     セマフォオブジェクトです。スレッドセーフではありません。

     セマフォは内部のカウンターを管理しています。カウンターは *note
     acquire(): 1a83. メソッドの呼び出しによって減算され、 *note
     release(): 38cb. メソッドの呼び出しによって加算されます。カウンター
     がゼロを下回ることはありません。 ‘acquire()’ メソッドが呼び出された
     時にカウンターがゼロになっていると、セマフォは処理をブロックし、他
     のタスクが ‘release()’ メソッドを呼び出すまで待機します。

     オプション引数 'value' は内部カウンターの初期値を与えます (デフォル
     トは ‘1’ です)。 指定された値が ‘0’ より小さい場合、 *note
     ValueError: 2ee. 例外が送出されます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     セマフォの望ましい使用方法は、 *note async with: 186. 文と組み合わ
     せて使うことです:

          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(): 38cb. が呼び出されるまで待機してから ‘True’ を返し
          ます。

      -- メソッド: locked ()

          セマフォを直ちに獲得できない場合 ‘True’ を返します。

      -- メソッド: release ()

          セマフォを解放し、内部カウンターを1つ加算します。セマフォ待ち
          をしているタスクを起動する可能性があります。

          *note BoundedSemaphore: c6d. と異なり、 *note Semaphore: c6c.
          は ‘release()’ を ‘acquire()’ よりも多く呼び出すことを許容しま
          す。


File: python.info,  Node: BoundedSemaphore,  Next: Barrier,  Prev: Semaphore,  Up: 同期プリミティブ<2>

5.20.1.35 BoundedSemaphore
..........................

 -- クラス: asyncio.BoundedSemaphore (value=1)

     有限セマフォオブジェクトです。スレッドセーフではありません。

     有限セマフォは *note Semaphore: c6c. の一種で、 *note release():
     38cb. メソッドの呼び出しにより内部カウンターが '初期値' よりも増加
     してしまう場合は *note ValueError: 2ee. 例外を送出します。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。


File: python.info,  Node: Barrier,  Prev: BoundedSemaphore,  Up: 同期プリミティブ<2>

5.20.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(): 38cf. method and would be blocked until
     the specified number of tasks end up waiting on ‘wait()’.  At that
     point all of the waiting tasks would unblock simultaneously.

     *note async with: 186. can be used as an alternative to awaiting on
     *note wait(): 38cf.

     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(): 38cf. 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: 246. のサブクラス) が送出されます。

__________________________________________________________________

バージョン 3.9 で変更: ‘await lock’ や ‘yield from lock’ およびそれらと
*note with: 187. 文との組み合わせ (すなわち ‘with await lock’ や ‘with
(yield from lock)’) によるロックの獲得は削除されました。代わりに ‘async
with lock’ を使ってください。


File: python.info,  Node: サブプロセス,  Next: キュー,  Prev: 同期プリミティブ<2>,  Up: asyncio --- 非同期 I/O

5.20.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 使用例: 38da. 節も参照してください。

* 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.20.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:
     17d7. wrappers for *note stdout: 38dc. and *note stderr: 38dd. (if
     *note subprocess.PIPE: d84. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 38de. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_exec(): 38df. を参照
     してください。

     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:
     17d7. wrappers for *note stdout: 38dc. and *note stderr: 38dd. (if
     *note subprocess.PIPE: d84. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 38de. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_shell(): 38e0. のド
     キュメントを参照してください。

     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
     におけるサブプロセスのサポート: 38e1. を参照してください。

参考
....

asyncio は以下に挙げるサブプロセスと協調するための '低水準の' API も持っ
ています: *note loop.subprocess_exec(): 38df, *note
loop.subprocess_shell(): 38e0, *note loop.connect_read_pipe(): 38e2,
*note loop.connect_write_pipe(): 38e3. および *note Subprocess
Transports: 38e4. と *note Subprocess Protocols: 38e5.。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Shell_injection#Shell_injection


File: python.info,  Node: 定数<7>,  Next: サブプロセスとやりとりする,  Prev: サブプロセスの生成,  Up: サブプロセス

5.20.1.39 定数
..............

 -- データ: asyncio.subprocess.PIPE

     'stdin', 'stdout' または 'stderr' に渡すことができます。

     If 'PIPE' is passed to 'stdin' argument, the *note Process.stdin:
     38e8. attribute will point to a *note StreamWriter: 1ad1. instance.

     If 'PIPE' is passed to 'stdout' or 'stderr' arguments, the *note
     Process.stdout: 38dc. and *note Process.stderr: 38dd. attributes
     will point to *note StreamReader: 17d7. instances.

 -- データ: asyncio.subprocess.STDOUT

     'stderr' 引数に対して利用できる特殊な値で、標準エラー出力が標準出力
     にリダイレクトされることを意味します。

 -- データ: asyncio.subprocess.DEVNULL

     プロセスを生成する関数の 'stdin', 'stdout' または 'stderr' 引数に利
     用できる特殊な値です。対応するサブプロセスのストリームに特殊なファ
     イル *note os.devnull: 1e70. が使われることを意味します。


File: python.info,  Node: サブプロセスとやりとりする,  Prev: 定数<7>,  Up: サブプロセス

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

*note create_subprocess_exec(): c6f. と *note create_subprocess_shell():
c70. の2つの関数はどちらも 'Process' クラスのインスタンスを返します。
'Process' クラスはサブプロセスと通信したり、サブプロセスの完了を監視した
りするための高水準のラッパーです。

 -- クラス: asyncio.subprocess.Process

     An object that wraps OS processes created by the *note
     create_subprocess_exec(): c6f. and *note create_subprocess_shell():
     c70. functions.

     このクラスは *note subprocess.Popen: 4b7. クラスと同様の API を持つ
     ように設計されていますが、いくつかの注意すべき違いがあります:

        * Popen と異なり、 Process インスタンスは *note poll(): 37f5. メ
          ソッドに相当するメソッドを持っていません;

        * the *note communicate(): 1b01. and *note wait(): 38ec. methods
          don't have a 'timeout' parameter: use the *note wait_for():
          815. function;

        * *note subprocess.Popen.wait(): ee4. メソッドが同期処理のビジー
          ループとして実装されているのに対して、 *note Process.wait():
          38ec. メソッドは非同期処理です;

        * 'universal_newlines' パラメータはサポートされていません。

     このクラスは *note スレッド安全ではありません: 3884.。

     *note サブプロセスとスレッド: 38ed. 節も参照してください。

      -- メソッド: async wait ()

          子プロセスが終了するのを待ち受けます。

          *note returncode: 38ee. 属性を設定し、その値を返します。

               注釈: ‘stdout=PIPE’ または ‘stderr=PIPE’ を使っており、OS
               パイプバッファがさらなるデータを受け付けるようになるまで
               子プロセスをブロックするほど大量の出力を生成場合、このメ
               ソッドはデッドロックする可能性があります。この条件を避け
               るため、パイプを使用する場合は *note communicate(): 1b01.
               メソッドを使ってください。

      -- メソッド: async communicate (input=None)

          プロセスとのやりとりを行います:

            1. 'stdin' にデータを送信します ('input' が ‘None’ でない場
               合);

            2. 'stdin' を閉じます;

            3. EOF に達するまで 'stdout' および 'stderr' からデータを読
               み出します;

            4. プロセスが終了するまで待ち受けます。

          'input' オプション引数は子プロセスに送信されるデータ (*note
          bytes: 193. オブジェクト) です。

          ‘(stdout_data, stderr_data)’ のタプルを返します。

          'input' を標準入力 'stdin' nに書き込んでいる時に *note
          BrokenPipeError: 126b. または *note ConnectionResetError:
          126e. 例外が送出された場合、例外は無視されます。このような条件
          は、全てのデータが '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: 15fd. is an alias for
               *note terminate(): 38ef.  ‘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: 15fd. 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: d54. to the
          child process.

          Windows では、このメソッドは *note terminate(): 38ef. のエイリ
          アスです。

      -- の属性: stdin

          Standard input stream (*note StreamWriter: 1ad1.) or ‘None’ if
          the process was created with ‘stdin=None’.

      -- の属性: stdout

          Standard output stream (*note StreamReader: 17d7.) or ‘None’
          if the process was created with ‘stdout=None’.

      -- の属性: stderr

          Standard error stream (*note StreamReader: 17d7.) or ‘None’ if
          the process was created with ‘stderr=None’.

          警告: Use the *note communicate(): 1b01. method rather than
          *note process.stdin.write(): 38e8, *note await
          process.stdout.read(): 38dc. or *note await
          process.stderr.read(): 38dd.  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(): c70. function, this attribute is
          the PID of the spawned shell.

      -- の属性: returncode

          プロセスが終了した時の終了ステータスを返します。

          この属性が ‘None’ であることは、プロセスがまだ終了していないこ
          とを示しています。

          For processes created with *note create_subprocess_exec():
          c6f, a negative value ‘-N’ indicates that the child was
          terminated by signal ‘N’ (POSIX only).

          For processes created with *note create_subprocess_shell():
          c70, the return code reflects the exit status of the shell
          itself (e.g.  ‘/bin/sh’), which may map signals to codes such
          as ‘128+N’.  See the documentation of the shell (for example,
          the Bash manual's Exit Status) for details.

* Menu:

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


File: python.info,  Node: サブプロセスとスレッド,  Next: 使用例<23>,  Up: サブプロセスとやりとりする

5.20.1.41 サブプロセスとスレッド
................................

標準的な asyncio のイベントループは、異なるスレッドからサブプロセスを実
行するのをデフォルトでサポートしています。

Windows のサブプロセスは *note ProactorEventLoop: 81d. (デフォルト) のみ
提供され、 *note SelectorEventLoop: 316. はサブプロセスをサポートしてい
ません。

標準で提供されない別のイベントループ実装の場合、固有の制限がある可能性が
あります; それぞれの実装のドキュメントを参照してください。

参考
....

*note 並行処理とマルチスレッド処理: 3884.


File: python.info,  Node: 使用例<23>,  Prev: サブプロセスとスレッド,  Up: サブプロセスとやりとりする

5.20.1.42 使用例
................

サブプロセスの制御のために *note Process: 38de. クラスを使い、サブプロセ
スの標準出力を読み出すために *note StreamReader: 17d7. を使う例です。 サ
ブプロセスは *note create_subprocess_exec(): c6f. 関数により生成されます
:

     import asyncio
     import sys

     async def get_date():
         code = 'import datetime as dt; print(dt.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 同様の例: 38f4. も参照してください。


File: python.info,  Node: キュー,  Next: 例外<16>,  Prev: サブプロセス,  Up: asyncio --- 非同期 I/O

5.20.1.43 キュー
................

'ソースコード:' Lib/asyncio/queues.py(1)

__________________________________________________________________

asyncio キューは *note queue: bb. モジュールのクラス群と同じ形になるよう
に設計されています。 asyncio キューはスレッドセーフではありませんが、そ
れらは async/await コードから使われるために特別に設計されています。

asyncio キューのメソッドは 'timeout' パラメータを持たないことに注意して
ください; タイムアウトを伴うキューを使った処理を行うには *note
asyncio.wait_for(): 815. 関数を使ってください。

下記の *note 使用例: 38f8. 節も参照してください。

* 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.20.1.44 Queue
...............

 -- クラス: asyncio.Queue (maxsize=0)

     先入れ先出し (FIFO) キューです。

     'maxsize' がゼロ以下の場合、キューは無限長になります。 ‘0’ より大き
     い整数の場合、キューが 'maxsize' に達すると ‘await put()’ は *note
     get(): 38fa. によってキューの要素が除去されるまでブロックします。

     標準ライブラリにおけるスレッドベースの *note queue: bb. モジュール
     と異なり、キューのサイズは常に既知であり、 *note qsize(): 38fb. メ
     ソッドを呼び出すことによって取得することができます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     このクラスは *note スレッド安全ではありません: 3884.。

      -- の属性: maxsize

          キューに追加できるアイテム数です。

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

      -- メソッド: full ()

          キューに要素が *note maxsize: 38fc. 個あれば ‘True’ を返します
          。

          If the queue was initialized with ‘maxsize=0’ (the default),
          then ‘full()’ 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: 3900. を返します。

      -- メソッド: async join ()

          キューにある全ての要素が取得され、処理されるまでブロックします
          。

          未完了のタスクのカウント値は、キューにアイテムが追加されるとき
          は常に加算され、キューの要素を消費するコルーチンが要素を取り出
          し、処理を完了したことを通知するために *note task_done(): fcb.
          を呼び出すと減算されます。未完了のタスクのカウント値がゼロにな
          ると、 *note join(): fca. のブロックは解除されます。

      -- メソッド: async put (item)

          要素をキューに入力します。キューが満杯の場合、要素を追加する前
          に空きスロットが利用できるようになるまで待機します。

          Raises *note QueueShutDown: 4cd. if the queue has been shut
          down.

      -- メソッド: put_nowait (item)

          ブロックせずにアイテムをキューに追加します。

          直ちに利用できるスロットがない場合、*note QueueFull: 3903. を
          送出します。

      -- メソッド: qsize ()

          キュー内の要素数を返します。

      -- メソッド: shutdown (immediate=False)

          Put a *note Queue: c6e. instance into a shutdown mode.

          The queue can no longer grow.  Future calls to *note put():
          3901. raise *note QueueShutDown: 4cd.  Currently blocked
          callers of ‘put()’ will be unblocked and will raise
          ‘QueueShutDown’ in the formerly awaiting task.

          If 'immediate' is false (the default), the queue can be wound
          down normally with *note get(): 38fa. calls to extract tasks
          that have already been loaded.

          And if *note task_done(): fcb. is called for each remaining
          task, a pending *note join(): fca. will be unblocked normally.

          Once the queue is empty, future calls to *note get(): 38fa.
          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(): fca. are
          unblocked.  Also, blocked callers of *note get(): 38fa. are
          unblocked and will raise *note QueueShutDown: 4cd. because the
          queue is empty.

          Use caution when using *note join(): fca. 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(): 38fa. used to
          fetch a work item, a subsequent call to *note task_done():
          fcb. tells the queue that the processing on the work item is
          complete.

          *note join(): fca. が現在ブロック中だった場合、全アイテムが処
          理されたとき (*note put(): 3901. でキューに追加された全アイテ
          ムの *note task_done(): fcb. の呼び出しを受信したとき) に再開
          します。

          キューに追加されているアイテム数以上の呼び出しが行われたときに
          *note ValueError: 2ee. を送出します。


File: python.info,  Node: 優先度付きのキュー,  Next: LIFO キュー,  Prev: Queue,  Up: キュー

5.20.1.45 優先度付きのキュー
............................

 -- クラス: asyncio.PriorityQueue

     *note Queue: c6e. の変種です; 優先順位にしたがって要素を取り出しま
     す (最低順位が最初に取り出されます)。

     項目は典型的には ‘(priority_number, data)’ 形式のタプルです。


File: python.info,  Node: LIFO キュー,  Next: 例外<15>,  Prev: 優先度付きのキュー,  Up: キュー

5.20.1.46 LIFO キュー
.....................

 -- クラス: asyncio.LifoQueue

     *note Queue: c6e. の変種で、最後に追加された項目を最初に取り出しま
     す (後入れ先出し、またはスタック)。


File: python.info,  Node: 例外<15>,  Next: 使用例<24>,  Prev: LIFO キュー,  Up: キュー

5.20.1.47 例外
..............

 -- 例外: asyncio.QueueEmpty

     この例外は *note get_nowait(): 38ff. メソッドが空のキューに対して呼
     ばれたときに送出されます。

 -- 例外: asyncio.QueueFull

     サイズが 'maxsize' に達したキューに対して *note put_nowait(): 3902.
     メソッドが 呼ばれたときに送出される例外です。

 -- 例外: asyncio.QueueShutDown

     Exception raised when *note put(): 3901. or *note get(): 38fa. is
     called on a queue which has been shut down.

     Added in version 3.13.


File: python.info,  Node: 使用例<24>,  Prev: 例外<15>,  Up: キュー

5.20.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.20.1.49 例外
..............

'ソースコード:' Lib/asyncio/exceptions.py(1)

__________________________________________________________________

 -- 例外: asyncio.TimeoutError

     操作が指定された期限を超えたときに送出される、非推奨な *note
     TimeoutError: a3a. のエイリアス。

     バージョン 3.11 で変更: このクラスは *note TimeoutError: a3a. のエ
     イリアスになりました。

 -- 例外: asyncio.CancelledError

     処理がキャンセルされました。

     asyncio タスクがキャンセルされた場合の処理をカスタマイズするために
     、この例外を一旦キャッチすることができます。 ほとんどの場合、キャッ
     チした例外は再度送出しなければなりません。

     バージョン 3.8 で変更: *note CancelledError: 4d4. は *note
     Exception: bd1. ではなく *note BaseException: 7d6. のサブクラスにな
     りました。

 -- 例外: asyncio.InvalidStateError

     *note Task: 1c9. または *note Future: dca. の内部状態が不正になりま
     した。

     すでに結果の値が設定されている 'Future' オブジェクトに対してさらに
     結果の値を再び設定しようとする場合などに送出されることがあります。

 -- 例外: asyncio.SendfileNotAvailableError

     与えられたソケットまたはファイルタイプに対して "sendfile" システム
     コールが利用可能ではありません。

     *note RuntimeError: 246. の派生クラスです。

 -- 例外: asyncio.IncompleteReadError

     要求された読み込み処理が完了できませんでした。

     *note asyncio ストリーム API: 3855. から送出されます。

     この例外は *note EOFError: 14f5. の派生クラスです。

      -- の属性: expected

          期待される総バイト数 (*note int: 19c.) です。

      -- の属性: partial

          ストリームの終端に達するまでに読み込んだ *note bytes: 193. 文
          字列です。

 -- 例外: asyncio.LimitOverrunError

     区切り文字を探している間にバッファサイズの上限に到達しました。

     *note asyncio ストリーム API: 3855. から送出されます。

      -- の属性: consumed

          未消費のバイトの合計数です。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/exceptions.py


File: python.info,  Node: Call Graph Introspection,  Next: Event loop,  Prev: 例外<16>,  Up: asyncio --- 非同期 I/O

5.20.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: 1c9. or *note Future: dca.

     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: cd1.

     '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(): 1cf, 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: 1c9. or *note Future: dca.

     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: dca. or
               a *note Task: 1c9. (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.20.1.51 Low level utility functions
.....................................

To introspect an async call graph asyncio requires cooperation from
control flow structures, such as *note shield(): c69. or *note
TaskGroup: 4d1.  Any time an intermediate *note Future: dca. object with
low-level APIs like *note Future.add_done_callback(): d02. 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: dca.
     or *note Task: 1c9. 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(): 3918.
     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: dca.
     or *note Task: 1c9. or their subclasses, otherwise the call would
     have no effect.


File: python.info,  Node: Event loop,  Next: Future,  Prev: Call Graph Introspection,  Up: asyncio --- 非同期 I/O

5.20.1.52 Event loop
....................

'ソースコード:' Lib/asyncio/profile.py(1) と Lib/asyncio/pstats.py(2)

__________________________________________________________________

まえがき
........

イベントループは全ての asyncio アプリケーションの中核をなす存在です。イ
ベントループは非同期タスクやコールバックを実行し、ネットワーク I/O を処
理し、サブプロセスを実行します。

アプリケーション開発者は通常 *note asyncio.run(): 2f5. のような高水準の
ayncio 関数だけを利用し、ループオブジェクトを参照したり、ループオブジェ
クトのメソッドを呼び出したりすることはほとんどありません。この節は、イベ
ントループの振る舞いに対して細かい調整が必要な、低水準のコード、ライブラ
リ、フレームワークの開発者向けです。

イベントループの取得
....................

以下の低水準関数はイベントループの取得、設定、生成するために使います:

 -- の関数: asyncio.get_running_loop ()

     現在の OS スレッドで実行中のイベントループを取得します。

     Raise a *note RuntimeError: 246. 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(): 2f4. よりも *note get_running_loop(): d05. を使う
     ほうが好ましいと考えられます。

     As noted above, consider using the higher-level *note
     asyncio.run(): 2f5. function, instead of using these lower level
     functions to manually create and close an event loop.

     バージョン 3.14 で変更: Raises a *note RuntimeError: 246. 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(): 1bb4.

 -- の関数: asyncio.set_event_loop (loop)

     'loop' を OS スレッドの現在のイベントループに設定します。

 -- の関数: asyncio.new_event_loop ()

     新しいイベントループオブジェクトを生成して返します。

*note get_event_loop(): 2f4, *note set_event_loop(): 1bb4, および *note
new_event_loop(): 3862. 関数の振る舞いは、 *note
カスタムイベントループポリシーを設定する: 391c. ことにより変更することが
できます。

内容
....

このページは以下の節から構成されます:

   * *note イベントループのメソッド: 391d. 節は、イベントループ API のリ
     ファレンスです。

   * *note コールバックハンドル: 391e. 節は *note loop.call_soon(): cfe.
     や *note loop.call_later(): d00. などのスケジューリングメソッドが返
     す *note Handle: 1ee0. や *note TimerHandle: 1b3c. インスタンスにつ
     いて解説しています。

   * *note サーバーオブジェクト: 391f. 節は *note loop.create_server():
     d0d. のようなメソッドが返す型について解説しています。

   * *note イベントループの実装: 3920. 節は *note SelectorEventLoop:
     316. と *note ProactorEventLoop: 81d. の2つのクラスについて解説して
     います。

   * *note 使用例: 3921. 節ではイベントループ API の具体的な使い方を紹介
     しています。

* Menu:

* Event loop methods::
* Callback handles::
* Server objects::
* Event loop implementations::
* 使用例: 使用例<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: Event loop methods,  Next: Callback handles,  Up: Event loop

5.20.1.53 Event loop methods
............................

イベントループは以下の '低水準な' API を持っています:

* Menu:

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


File: python.info,  Node: ループの開始と停止,  Next: コールバックのスケジューリング,  Up: Event loop methods

5.20.1.54 ループの開始と停止
............................

 -- メソッド: loop.run_until_complete (future)

     'フューチャー' (*note Future: dca. インスタンス) が完了するまで実行
     します。

     引数が *note コルーチンオブジェクト: 3854. の場合、暗黙のうちに
     *note asyncio.Task: 1c9. として実行されるようにスケジュールされます
     。

     Future の結果を返すか、例外を送出します。

 -- メソッド: loop.run_forever ()

     *note stop(): e7b. が呼び出されるまでイベントループを実行します。

     *note run_forever(): 3924. メソッドが呼ばれるより前に *note stop():
     e7b. メソッドが呼ばれた場合、イベントループはタイムアウトをゼロにし
     て一度だけ I/O セレクタの問い合わせ処理を行い、 I/O イベントに対し
     てスケジュールされた全てのコールバック (および既にスケジュール済み
     のコールバック) を実行したのち、終了します。

     *note run_forever(): 3924. メソッドを実行中に *note stop(): e7b. メ
     ソッドが呼び出された場合、イベントループは現在処理されているすべて
     のコールバックを実行してから終了します。 この場合、コールバックによ
     り新たにスケジュールされるコールバックは実行されないことに注意して
     ください; これら新たにスケジュールされたコールバックは、次に
     ‘run_forever()’ または *note run_until_complete(): e76. が呼び出さ
     れたときに実行されます。

 -- メソッド: loop.stop ()

     イベントループを停止します。

 -- メソッド: loop.is_running ()

     イベントループが現在実行中の場合 ‘True’ を返します。

 -- メソッド: loop.is_closed ()

     イベントループが閉じられていた場合 ‘True’ を返します。

 -- メソッド: loop.close ()

     イベントループをクローズします。

     この関数が呼び出される時点で、イベントループが実行中であってはいけ
     ません。保留中のコールバックはすべて破棄されます。

     このメソッドは全てのキューをクリアし、エグゼキューターが実行完了す
     るのを待たずにシャットダウンします。

     このメソッドはべき等 (何回実行しても結果は同じ) であり取り消せませ
     ん。イベントループがクローズされた後、他のいかなるメソッドも呼び出
     すべきではありません。

 -- メソッド: async loop.shutdown_asyncgens ()

     現在オープンになっているすべての *note asynchronous generator:
     24fb. (非同期ジェネレータ) オブジェクトをスケジュールし、 *note
     aclose(): ad9. メソッドを呼び出すことでそれらをクローズします。 こ
     のメソッドの呼び出し後に新しい非同期ジェネレータがイテレートされる
     と、イベントループは警告を発します。このメソッドはスケジュールされ
     たすべての非同期ジェネレータの終了処理を確実に行うために使用すべき
     です。

     *note asyncio.run(): 2f5. を使った場合はこの関数を呼び出す必要はあ
     りません。

     以下はプログラム例です:

          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: 94d.  Once
     this method has been called, using the default executor with *note
     loop.run_in_executor(): aea. will raise a *note RuntimeError: 246.

     The 'timeout' parameter specifies the amount of time (in *note
     float: 197. 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():
          2f5, as the latter handles default executor shutdown
          automatically.

     Added in version 3.9.

     バージョン 3.12 で変更: 'timeout' 引数が追加されました。


File: python.info,  Node: コールバックのスケジューリング,  Next: 遅延コールバックのスケジューリング,  Prev: ループの開始と停止,  Up: Event loop methods

5.20.1.55 コールバックのスケジューリング
........................................

 -- メソッド: loop.call_soon (callback, *args, context=None)

     イベントループの次のイテレーションで 'callback' に指定したコールバ
     ック (*note callback: 2e18.) を 'args' 引数で呼び出すようにスケジュ
     ールします。

     *note asyncio.Handle: 1ee0. のインスタンスを返します。このインスタ
     ンスを使ってスケジュールしたコールバックをキャンセルすることができ
     ます。

     コールバックは登録された順に呼び出されます。各コールバックは厳密に
     1回だけ呼び出されます。

     The optional keyword-only 'context' argument specifies a custom
     *note contextvars.Context: 178. for the 'callback' to run in.
     Callbacks use the current context when no 'context' is provided.

     Unlike *note call_soon_threadsafe(): cff, this method is not
     thread-safe.

 -- メソッド: loop.call_soon_threadsafe (callback, *args, context=None)

     A thread-safe variant of *note call_soon(): cfe.  When scheduling
     callbacks from another thread, this function 'must' be used, since
     ‘call_soon()’ 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: 246. 例外を送出します。これはメインアプ
     リケーションが終了しているにもかかわらずセカンダリスレッドでメソッ
     ドが呼び出されるといった場合に起こりえます。

     このドキュメントの *note 並行処理とマルチスレッド処理: 3884. 節を参
     照してください。

     バージョン 3.7 で変更: キーワード引数 'context' が追加されました。
     詳細は PEP 567(1) を参照してください。

     注釈: ほとんどの *note asyncio: b. モジュールのスケジューリング関数
     は、キーワード引数をコールバックに渡すことを許していません。キーワ
     ード引数を渡すためには *note functools.partial(): 219. を使ってくだ
     さい:

          # 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: Creating futures and tasks,  Prev: コールバックのスケジューリング,  Up: Event loop methods

5.20.1.56 遅延コールバックのスケジューリング
............................................

イベントループは、コールバック関数を未来のある時点で呼び出されるようにス
ケジュールする仕組みを提供します。イベントループは時刻が戻らない単調な時
計 (monotonic clock) を使って時刻を追跡します。

 -- メソッド: loop.call_later (delay, callback, *args, context=None)

     'delay' 秒経過後にコールバック関数 'callback' を呼び出すようにスケ
     ジュールします。 'delay' には整数または浮動小数点数を指定します。

     *note asyncio.TimerHandle: 1b3c. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

     'callback' は厳密に一度だけ呼び出されます。2つのコールバックが完全
     に同じ時間にスケジュールされた場合、呼び出しの順序は未定義です。

     The optional positional 'args' will be passed to the callback when
     it is called.  Use *note functools.partial(): 219. *note to pass
     keyword arguments: 3928. to 'callback'.

     オプションのキーワード引数 'context' を使って、コールバック
     *callback* を実行する際のコンテキスト *note contextvars.Context:
     178. を設定することができます。コンテキスト 'context' が指定されな
     い場合は現在のコンテキストが使われます。

          注釈: For performance, callbacks scheduled with
          ‘loop.call_later()’ 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(): 392b. と同じ参照時
     刻を使用します。

     このメソッドの振る舞いは *note call_later(): d00. と同じです。

     *note asyncio.TimerHandle: 1b3c. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

          注釈: For performance, callbacks scheduled with
          ‘loop.call_at()’ 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: 197. 値で返します。時刻はイベントループが
     内部で参照している時刻が戻らない単調な時計 (monotonic clock) に従い
     ます。

     注釈: 
     バージョン 3.8 で変更: Python 3.7 またはそれ以前のバージョンでは、
     タイムアウト (相対値 'delay' もしくは絶対値 'when') は1日を超えるこ
     とができませんでした。この問題は Python 3.8 で修正されました。

参考
....

関数 *note asyncio.sleep(): c68.。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/

   (2) https://peps.python.org/pep-0567/


File: python.info,  Node: Creating futures and tasks,  Next: ネットワーク接続の確立,  Prev: 遅延コールバックのスケジューリング,  Up: Event loop methods

5.20.1.57 Creating futures and tasks
....................................

 -- メソッド: loop.create_future ()

     イベントループに接続した *note asyncio.Future: dca. オブジェクトを
     生成します。

     asyncio でフューチャーオブジェクトを作成するために推奨される方法で
     す。このメソッドにより、サードパーティ製のイベントループがFutures ク
     ラスの(パフォーマンスや計測方法が優れた) 代替実装を提供することを可
     能にします。

     Added in version 3.5.2.

 -- メソッド: loop.create_task (coro, *, name=None, context=None,
          eager_start=None, **kwargs)

     *note コルーチン: 3854. 'coro' の実行をスケジュールします。 *note
     Task: 1c9. オブジェクトを返します。

     サードパーティのイベントループは相互運用のための自身の *note Task:
     1c9. のサブクラスを使用できます。この場合、結果は ‘Task’ のサブクラ
     スになります。

     The full function signature is largely the same as that of the
     *note Task: 1c9. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     'name' 引数が指定され、値が ‘None’ でない場合、 *note
     Task.set_name(): bd4. メソッドにより 'name' がタスクの名前として設
     定されます。

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 178. を指定できます。
     '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(): 1ca. 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(): 1cc. が使用するタスクファクトリーを設定し
     ます。

     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: 1c9.-compatible object.

     バージョン 3.13.3 で変更: Required that all 'kwargs' are passed on
     to *note asyncio.Task: 1c9.

     バージョン 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: Creating futures and tasks,  Up: Event loop methods

5.20.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: 1c0a. か *note AF_INET6: 1c0b.
     のいずれかを指定します。

     ソケットタイプは *note SOCK_STREAM: 150f. になります。

     'protocol_factory' は *note asyncio プロトコル: 392e. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     このメソッドはバックグラウンドで接続の確立を試みます。成功した場合
     、メソッドは ‘(transport, protocol)’ のペアを返します。

     時系列での下層処理の概要は以下のとおりです:

       1. 接続を確立し、その接続に対する *note トランスポート: 392f. が
          生成されます。

       2. 'protocol_factory' が引数なしで呼び出され、ファクトリが *note
          プロトコル: 392e. インスタンスを返すよう要求します。

       3. プロトコルインスタンスが *note connection_made(): 3930. メソッ
          ドを呼び出すことにより、トランスポートと紐付けられます。

       4. 成功すると ‘(transport, protocol)’ タプルが返されます。

     作成されたトランスポートは実装依存の双方向ストリームです。

     その他の引数:

        * 'ssl': 偽値以外が与えられた場合、SSL/TLS トランスポートが作成
          されます (デフォルトでは暗号化なしの TCP トランスポートが作成
          されます)。 'ssl' が *note ssl.SSLContext: 355. オブジェクトの
          場合、このコンテキストがトランスポートを作成するために使用され
          ます; 'ssl' が *note True: e0b. の場合、 *note
          ssl.create_default_context(): 480. が返すデフォルトのコンテキ
          ストが使われます。

          参考
          ....

          *note SSL/TLS セキュリティについての考察: 3931.

        * '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(): e12. が返す順番にした
          がってアドレスへの接続を試行します。正の整数が指定されると、ア
          ドレスはアドレスファミリに応じてインターリーブされます。このと
          き、与えられた整数は RFC 8305(2) で定義される "最初のアドレス
          ファミリカウント (First Address Family Count)" として解釈され
          ます。デフォルト値は、 'happy_eyeballs_delay' が指定されない場
          合は ‘0’ であり、指定された場合は ‘1’ です。

        * 'sock' を与える場合、トランスポートに使用される、既存の、かつ
          接続済の *note socket.socket: fa5. オブジェクトを指定します。
          '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(): 3932. 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: d70. が設定されるようになりま
     した。

     バージョン 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(): d12. 関数は高水準の代替 API です。この関数
     は(*note StreamReader: 17d7, *note StreamWriter: 1ad1.) のペアを返
     し、 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: 1c0a.、 *note AF_INET6: 1c0b.、
     *note AF_UNIX: 1c0d. のいずれかを指定します。

     ソケットタイプは *note SOCK_DGRAM: 150e. になります。

     'protocol_factory' は *note asyncio プロトコル: 392e. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     その他の引数:

        * 'local_addr' が指定される場合、ソケットをローカルにバインドす
          るための ‘(local_host, local_port)’ のタプルを指定します。
          'local_host' と 'local_port' は *note getaddrinfo(): e12. メソ
          ッドを使用して検索されます。

               注釈: On Windows, when using the proactor event loop with
               ‘local_addr=None’, an *note OSError: 2c2. with
               ‘errno.WSAEINVAL’ will be raised when running it.

        * 'remote_addr' が指定される場合、‘(remote_host, remote_por)’ の
          タプルで、ソケットをリモートアドレスに束縛するために使用されま
          す。'remote_host' と 'remote_port' は *note getaddrinfo():
          e12. を使用して検索されます。

        * 'family', 'proto', 'flags' は任意のアドレスファミリです。これ
          らのファミリ、プロトコル、フラグは、'host' 解決のため *note
          getaddrinfo(): e12. 経由でオプションで渡されます。これらのオプ
          ションを指定する場合、すべて *note socket: d1. モジュール定数
          に従った整数でなければなりません。

        * 'reuse_port' は、同じポートにバインドされた既存の端点すべてが
          このフラグを設定して生成されている場合に限り、この端点を既存の
          端点と同じポートにバインドすることを許可するよう、カーネルに指
          示します（訳註: ソケットのオプション SO_REUSEPORT を使用します
          ）。このオプションは、Windows やいくつかの UNIX システムではサ
          ポートされていません。*note socket.SO_REUSEPORT: d70. 定数が定
          義されていなければ、この機能はサポートされません。

        * 'allow_broadcast' は、カーネルに、このエンドポイントがブロード
          キャストアドレスにメッセージを送信することを許可するように指示
          します。

        * オプションの 'sock' を指定することで、既存の、すでに接続されて
          いる *note socket.socket: fa5. をトランスポートで使用すること
          ができます。このオプションを使用する場合、'local_addr' と
          'remote_addr' は省略してください (*note None: 886. でなければ
          なりません)。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3932. method.

     *note UDP echo クライアントプロトコル: 3933. および *note UDP echo
     サーバープロトコル: 3934. の例を参照してください。

     バージョン 3.4.4 で変更: 'family', 'proto', 'flags',
     'reuse_address', 'reuse_port', 'allow_broadcast', 'sock' パラメータ
     が追加されました。

     バージョン 3.8 で変更: Windows サポートが追加されました。

     バージョン 3.8.1 で変更: *note socket.SO_REUSEADDR: d70. の利用が
     UDP に対して重大なセキュリティ上の懸念をもたらすため、
     'reuse_address' パラメータはサポートされなくなりました。明示的に
     ‘reuse_address=True’ を設定すると例外を送出します。

     ‘SO_REUSEADDR’ を使って、同一の UDP ソケットアドレスに対して複数の
     プロセスが異なる UID でソケットを割り当てている場合、受信パケットは
     複数のソケット間にランダムに分散する可能性があります。

     サポートされているプラットフォームでは、 'reuse_port' が同様の機能
     に対する代用品として利用できます。 'reuse_port' は代替機能として
     *note socket.SO_REUSEPORT: d70. を使っており、複数のプロセスが異な
     る 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: 1c0d. になります; また、ソケッ
     トタイプは *note SOCK_STREAM: 150f. になります。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 16a.、 *note
     bytes: 193.、 and *note Path: 268. 形式でのパスがサポートされていま
     す。

     このメソッドの引数についての詳細は *note loop.create_connection():
     818. メソッドのドキュメントを参照してください。

     *note Availability: 2199.: 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: Event loop methods

5.20.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: 150f.)
     listening on 'port' of the 'host' address.

     *note Server: d0c. オブジェクトを返します。

     引数:

        * 'protocol_factory' は *note asyncio プロトコル: 392e. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * '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: 1c0a. or
          *note AF_INET6: 1c0b. 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: 3936.).

        * 'flags' は *note getaddrinfo(): e12. のためのビットマスクにな
          ります。

        * サーバーで既存のソケットオブジェクトを使用するために、オプショ
          ンの引数 '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(): 3899. method.

        * 'backlog' は *note listen(): 1062. に渡される、キューに入るコ
          ネクションの最大数になります (デフォルトは 100)。

        * 確立した接続の上で TLS を有効化するために、 'ssl' に *note
          SSLContext: 355. のインスタンスを指定することができます。

        * '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(): d0e. または *note
          Server.serve_forever(): d0f. を待ち受け (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: d70. is set by default for all TCP connections.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     参考
     ....

     *note start_server(): d13. 関数は高水準の代替 API です。この関数は
     *note StreamReader: 17d7. と *note StreamWriter: 1ad1. のペアを返し
     、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(): d0d. but works with the
     *note AF_UNIX: 1c0d. socket family.

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 16a.、 *note
     bytes: 193.、 and *note Path: 268. 形式でのパスがサポートされていま
     す。

     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(): d0d.
     メソッドのドキュメントを参照してください。

     *note Availability: 2199.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' and
     'start_serving' parameters.  The 'path' parameter can now be a
     *note Path: 268. 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 プロトコル: 392e. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * 'sock' は *note socket.accept: fa6. メソッドが返す既存のソケッ
          トオブジェクトです。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3932. method.

        * 'ssl' には *note SSLContext: 355. を指定できます。指定すると、
          受け付けたコネクション上での 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 upgrade,  Prev: ネットワークサーバの生成,  Up: Event loop methods

5.20.1.60 ファイルの転送
........................

 -- メソッド: async loop.sendfile (transport, file, offset=0,
          count=None, *, fallback=True)

     'transport' を通じて 'file' を送信します。送信したデータの総バイト
     数を返します。

     このメソッドは、もし利用可能であれば高性能な *note os.sendfile():
     d09. を利用します。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 15ca. メソッドで
     取得することができます。

     'fallback' を ‘True’ に指定することで、 asyncio がプラットフォーム
     が sendfile システムコールをサポートしていない場合 (たとえば
     Windows や Unix の SSL ソケットなど) に別の方法でファイルの読み込み
     と送信を行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     390e. 例外を送出します。

     Added in version 3.7.


File: python.info,  Node: TLS upgrade,  Next: ファイル記述子の監視,  Prev: ファイルの転送,  Up: Event loop methods

5.20.1.61 TLS upgrade
.....................

 -- メソッド: 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(): d0d. や
          *note create_connection(): 818. が返すものと同等のインスタンス
          を指定します。

        * 'sslcontext': 構成済みの *note SSLContext: 355. インスタンスで
          す。

        * (*note create_server(): d0d. で生成されたような) サーバーサイ
          ドの接続をアップグレードする場合は '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 upgrade,  Up: Event loop methods

5.20.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 キーワード引数を渡す: 3928. 場合は
     *note functools.partial(): 219. を使ってください。

 -- メソッド: loop.remove_writer (fd)

     Stop monitoring the 'fd' file descriptor for write availability.
     Returns ‘True’ if 'fd' was previously being monitored for writes.

これらのメソッドに対する制限事項については *note
プラットフォームのサポート状況: 393e. 節も参照してください。


File: python.info,  Node: ソケットオブジェクトと直接やりとりする,  Next: DNS,  Prev: ファイル記述子の監視,  Up: Event loop methods

5.20.1.63 ソケットオブジェクトと直接やりとりする
................................................

一般に、 *note loop.create_connection(): 818. や *note
loop.create_server(): d0d. のようなトランスポートベースの API を使ったプ
ロトコルの実装はソケットと直接やり取りする実装に比べて高速です。しかしな
がら、パフォーマンスが重要でなく、直接 *note socket: fa5. オブジェクトと
やりとりした方が便利なユースケースがいくつかあります。

 -- メソッド: async loop.sock_recv (sock, nbytes)

     'nbytes' で指定したバイト数までのデータをソケット 'sock' から受信し
     ます。 このメソッドは *note socket.recv(): fa8. の非同期版です。

     受信したデータをバイトオブジェクトとして返します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dca. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

 -- メソッド: async loop.sock_recv_into (sock, buf)

     ソケット 'sock' からデータを受信してバッファ 'buf' に格納します。ブ
     ロッキングコードの *note socket.recv_into(): 1539. メソッドをモデル
     としています。

     バッファに書き込んだデータのバイト数を返します。

     '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(): fa9.

     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(): 153a.

     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(): fac. メソッドの非同期版です。

     このメソッドは 'data' をすべて送信し終えるか、またはエラーが起きる
     までデータをソケットに送信し続けます。送信に成功した場合 ‘None’ を
     返します。エラーの場合は例外が送出されます。エラーとなった場合、接
     続の受信側で正しく処理されたデータの総量を特定する方法はありません
     。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dca. オブジェクトを返していました。 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(): fad.

     Return the number of bytes sent.

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.11.

 -- メソッド: async loop.sock_connect (sock, address)

     ソケット 'sock' をアドレス 'address' のリモートソケットに接続します
     。

     *note socket.connect(): fa7. の非同期版です。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.5.2 で変更: ‘address’ を名前解決する必要はなくなりまし
     た。 ‘sock_connect’ は *note socket.inet_pton(): b5f. を呼び出して
     'address' が解決済みかどうかを確認します。未解決の場合、 'address'
     の名前解決には *note loop.getaddrinfo(): e12. メソッドが使われます
     。

     参考
     ....

     *note loop.create_connection(): 818. および *note
     asyncio.open_connection(): d12.。

 -- メソッド: async loop.sock_accept (sock)

     接続を受け付けます。ブロッキングコールの *note socket.accept():
     fa6. メソッドをモデルとしています。

     ソケットはアドレスに束縛済みで、接続を listen 中である必要がありま
     す。戻り値は ‘(conn, address)’ のペアで、'conn' は接続を通じてデー
     タの送受信を行うための '新しい' ソケットオブジェクト、'address' は
     接続先の端点でソケットに束縛されているアドレスを示します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dca. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

     参考
     ....

     *note loop.create_server(): d0d. および *note start_server(): d13.。

 -- メソッド: async loop.sock_sendfile (sock, file, offset=0,
          count=None, *, fallback=True)

     ファイルを送信します。利用可能なら高性能な *note os.sendfile: d09.
     を使います。送信したデータの総バイト数を返します。

     *note socket.sendfile(): 1061. メソッドの非同期版です。

     'sock' は *note socket.SOCK_STREAM: 150f. タイプのノンブロッキング
     な *note socket: fa5. でなければなりません。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 15ca. メソッドで
     取得することができます。

     'fallback' が ‘True’ に設定された場合、 プラットフォームが sendfile
     システムコールをサポートしていない場合 (たとえば Windows や Unix の
     SSL ソケットなど) に asyncio が別の方法でファイルの読み込みと送信を
     行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     390e. 例外を送出します。

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.7.


File: python.info,  Node: DNS,  Next: パイプとやりとりする,  Prev: ソケットオブジェクトと直接やりとりする,  Up: Event loop methods

5.20.1.64 DNS
.............

 -- メソッド: async loop.getaddrinfo (host, port, *, family=0, type=0,
          proto=0, flags=0)

     *note socket.getaddrinfo(): 17c7. の非同期版です。

 -- メソッド: async loop.getnameinfo (sockaddr, flags=0)

     *note socket.getnameinfo(): 1a9c. の非同期版です。

     注釈: 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: dca. オ
ブジェクトを返していました。 Python 3.7 からはどちらのメソッドもコルーチ
ンになりました。


File: python.info,  Node: パイプとやりとりする,  Next: Unix シグナル,  Prev: DNS,  Up: Event loop methods

5.20.1.65 パイプとやりとりする
..............................

 -- メソッド: async loop.connect_read_pipe (protocol_factory, pipe)

     イベントループの読み込み側終端に 'pipe' を登録します。

     'protocol_factory' は *note asyncio プロトコル: 392e. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' には *note file-like オブジェクト: 13df. を指定します。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note ReadTransport: 3942. のインターフェースをサポートし、
     'protocol' は 'protocol_factory' ファクトリでインスタンス化されたオ
     ブジェクトです。

     *note SelectorEventLoop: 316. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

 -- メソッド: async loop.connect_write_pipe (protocol_factory, pipe)

     'pipe' の書き込み側終端をイベントループに登録します。

     'protocol_factory' は *note asyncio プロトコル: 392e. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' は *note file-like オブジェクト: 13df. です。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note WriteTransport: 3943. のインスタンスであり、 'protocol' は
     'protocol_factory' ファクトリでインスタンス化されたオブジェクトです
     。

     *note SelectorEventLoop: 316. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

     注釈: *note SelectorEventLoop: 316. は Windows 上で上記のメソッドを
     サポートしていません。 Windowsでは代わりに *note ProactorEventLoop:
     81d. を使ってください。

参考
....

*note loop.subprocess_exec(): 38df. および *note
loop.subprocess_shell(): 38e0. メソッド。


File: python.info,  Node: Unix シグナル,  Next: スレッドまたはプロセスプールでコードを実行する,  Prev: パイプとやりとりする,  Up: Event loop methods

5.20.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(): 1350. を使って登録されたシグナルハンドラと異なり、
     この関数で登録されたコールバックはイベントループと相互作用すること
     が可能です。

     シグナルナンバーが誤っているか捕捉不可能な場合 *note ValueError:
     2ee. が送出されます。ハンドラーの設定に問題があった場合 *note
     RuntimeError: 246. が送出されます。

     コールバック 'callback' に *note キーワード引数を渡す: 3928. 場合は
     *note functools.partial(): 219. を使ってください。

     *note signal.signal(): 1350. と同じく、この関数はメインスレッドから
     呼び出されなければなりません。

 -- メソッド: loop.remove_signal_handler (sig)

     シグナル 'sig' に対するハンドラを削除します。

     シグナルハンドラが削除された場合 ‘True’ を返します。シグナルに対し
     てハンドラが設定されていない場合には ‘False’ を返します。

     *note Availability: 2199.: Unix.

参考
....

*note signal: cb. モジュール。


File: python.info,  Node: スレッドまたはプロセスプールでコードを実行する,  Next: Error handling API,  Prev: Unix シグナル,  Up: Event loop methods

5.20.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: 3780. instance.  The default executor
     is used if 'executor' is ‘None’.  The default executor can be set
     by *note loop.set_default_executor(): 94e, otherwise, a *note
     concurrent.futures.ThreadPoolExecutor: 94d. will be
     lazy-initialized and used by *note run_in_executor(): aea. 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:
     1d8.  See *note Safe importing of main module: 3769.

     このメソッドは *note asyncio.Future: dca. オブジェクトを返します。

     関数 'func' に *note キーワード引数を渡す: 3928. 場合は *note
     functools.partial(): 219. を使ってください。

     バージョン 3.5.3 で変更: *note loop.run_in_executor(): aea. は内部
     で生成するスレッドプールエグゼキュータの ‘max_workers’ を設定せず、
     代わりにスレッドプールエグゼキュータ (*note ThreadPoolExecutor:
     94d.) にデフォルト値を設定させるようになりました。

 -- メソッド: loop.set_default_executor (executor)

     Set 'executor' as the default executor used by *note
     run_in_executor(): aea.  'executor' must be an instance of *note
     ThreadPoolExecutor: 94d, which includes *note
     InterpreterPoolExecutor: 1d4.

     バージョン 3.11 で変更: 'executor' must be an instance of *note
     ThreadPoolExecutor: 94d.


File: python.info,  Node: Error handling API,  Next: デバッグモードの有効化,  Prev: スレッドまたはプロセスプールでコードを実行する,  Up: Event loop methods

5.20.1.68 Error handling API
............................

イベントループ内での例外の扱い方をカスタマイズできます。

 -- メソッド: loop.set_exception_handler (handler)

     'handler' を新しいイベントループ例外ハンドラーとして設定します。

     'handler' が ‘None’ の場合、デフォルトの例外ハンドラが設定されます
     。そうでなければ、 'handler' は ‘(loop, context)’ に一致する関数シ
     グネチャを持った呼び出し可能オブジェクトでなければなりません。ここ
     で ‘loop’ はアクティブなイベントループへの参照であり、 ‘context’ は
     例外の詳細な記述からなる ‘dict’ オブジェクトです ('context' につい
     ての詳細は *note call_exception_handler(): 394a. メソッドのドキュメ
     ントを参照してください)。

     If the handler is called on behalf of a *note Task: 1c9. or *note
     Handle: 1ee0, it is run in the *note contextvars.Context: 178. of
     that task or callback handle.

     バージョン 3.12 で変更: The handler may be called in the *note
     Context: 178. 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(): 394a. と同
     じです。

 -- メソッド: loop.call_exception_handler (context)

     現在のイベントループ例外ハンドラーを呼び出します。

     'context' は以下のキーを含む ‘dict’ オブジェクトです (将来の Python
     バージョンで新しいキーが追加される可能性があります):

        * 'message': エラーメッセージ;

        * 'exception' (任意): 例外オブジェクト;

        * 'future' (任意): *note asyncio.Future: dca. インスタンス;

        * 'task' (optional): *note asyncio.Task: 1c9. instance;

        * 'handle' (任意): *note asyncio.Handle: 1ee0. インスタンス;

        * 'protocol' (任意): *note プロトコル: 392e. インスタンス;

        * 'transport' (任意): *note トランスポート: 392f. インスタンス;

        * 'socket' (optional): *note socket.socket: fa5. 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(): 3949. method.


File: python.info,  Node: デバッグモードの有効化,  Next: Running subprocesses,  Prev: Error handling API,  Up: Event loop methods

5.20.1.69 デバッグモードの有効化
................................

 -- メソッド: loop.get_debug ()

     イベントループのデバッグモード (*note bool: 3c1.) を取得します。

     環境変数 *note PYTHONASYNCIODEBUG: 2194. に空でない文字列が設定され
     ている場合のデフォルト値は ‘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 のデバッグモード: 2195.。


File: python.info,  Node: Running subprocesses,  Prev: デバッグモードの有効化,  Up: Event loop methods

5.20.1.70 Running subprocesses
..............................

この節で解説しているのは低水準のメソッドです。通常の async/await コード
では、高水準の関数である *note asyncio.create_subprocess_shell(): c70. や
*note asyncio.create_subprocess_exec(): c6f. を代わりに使うことを検討し
てください。

     注釈: On Windows, the default event loop *note ProactorEventLoop:
     81d. supports subprocesses, whereas *note SelectorEventLoop: 316.
     does not.  See *note Subprocess Support on Windows: 38e1. for
     details.

 -- メソッド: async loop.subprocess_exec (protocol_factory, *args,
          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
          stderr=subprocess.PIPE, **kwargs)

     'args' で指定されたひとつの、または複数の文字列引数からサブプロセス
     を生成します。

     'args' は下記のいずれかに当てはまる文字列のリストでなければなりませ
     ん:

        * *note str: 16a.;

        * または *note ファイルシステムのエンコーディング: 2cb1. にエン
          コードされた *note bytes: 193.

     引数の最初の文字列はプログラムの実行ファイルを指定します。それに続
     く残りの文字列は引数を指定し、そのプログラムに対する ‘argv’ を構成
     します。

     このメソッドは標準ライブラリの *note subprocess.Popen: 4b7. クラス
     を、 ‘shell=False’ かつ最初の引数に文字列のリストを渡して呼び出した
     場合に似ています。しかし、 ‘Popen’ クラスは文字列のリストを引数とし
     てひとつだけ取るのに対して、 'subprocess_exec' は複数の文字列引数を
     とることができます。

     'protocol_factory' は *note asyncio.SubprocessProtocol: 394f. クラ
     スの派生クラスを返す呼び出し可能オブジェクトでなければなりません。

     その他の引数:

        * 'stdin' は下記のいずれかをとることができます:

             * a file-like object

             * an existing file descriptor (a positive integer), for
               example those created with *note os.pipe(): 1bc3.

             * デフォルト値は *note subprocess.PIPE: d84. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 136a. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e70. を使います。

        * 'stdout' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: d84. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 136a. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e70. を使います。

        * 'stderr' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: d84. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 136a. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e70. を使います。

             * *note subprocess.STDOUT: 37c9. 定数を設定すると、標準エラ
               ー出力ストリームをプロセスの標準出力ストリームに接続しま
               す。

        * その他のすべてのキーワード引数は解釈されずにそのまま *note
          subprocess.Popen: 4b7. に渡されます。ただし、 'bufsize'、
          'universal_newlines'、 'shell'、 'text'、 'encoding' および
          'errors' は指定してはいけません。

          ‘asyncio’ のサブプロセス API はストリームからテキストへのデコ
          ードをサポートしていません。ストリームからテキストに変換するに
          は *note bytes.decode(): ad7. 関数を使ってください。

     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(): 38e3. or *note
     connect_read_pipe(): 38e2. for use with the event loop.

     他の引数についての詳細は *note subprocess.Popen: 4b7. クラスのコン
     ストラクタを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note asyncio.SubprocessTransport: 3950. 基底クラスに適合するオブジ
     ェクトで、 '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: 16a. 文字列もしくは
     *note ファイルシステムのエンコーディング: 2cb1. でエンコードされた
     *note bytes: 193. 文字列です。

     これは標準ライブラリの *note subprocess.Popen: 4b7. クラスを
     ‘shell=True’ で呼び出した場合と似ています。

     'protocol_factory' は *note SubprocessProtocol: 394f. の派生クラス
     を返す呼び出し可能オブジェクトでなければなりません。

     その他の引数についての詳細は *note subprocess_exec(): 38df. メソッ
     ドを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note SubprocessTransport: 3950. 基底クラスに適合するオブジェクトで
     、 '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: Callback handles,  Next: Server objects,  Prev: Event loop methods,  Up: Event loop

5.20.1.71 Callback handles
..........................

 -- クラス: asyncio.Handle

     *note loop.call_soon(): cfe. や *note loop.call_soon_threadsafe():
     cff. が返すコールバックのラッパーです。

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 178. 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(): d00,
     and *note loop.call_at(): d01.

     このクラスは *note Handle: 1ee0. の派生クラスです。

      -- メソッド: when ()

          コールバックのスケジュール時刻を秒単位の *note float: 197. で
          返します。

          戻り値の時刻は絶対値で、 *note loop.time(): 392b. と同じ参照時
          刻を使って定義されています。

          Added in version 3.7.


File: python.info,  Node: Server objects,  Next: Event loop implementations,  Prev: Callback handles,  Up: Event loop

5.20.1.72 Server objects
........................

Server オブジェクトは *note loop.create_server(): d0d.、 *note
loop.create_unix_server(): 4ca.、 *note start_server(): d13. および
*note start_unix_server(): 389c. 関数により生成されます。

Do not instantiate the *note Server: d0c. 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: e14. 属性に ‘None’ を設定します。

          既存の受信中のクライアントとの接続を表すソケットはオープンのま
          まです。

          The server is closed asynchronously; use the *note
          wait_closed(): 1aa0. 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(): 3932. on all associated transports.

          *note close(): 3899. should be called before ‘close_clients()’
          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(): 3953. on all associated transports.

          *note close(): 3899. should be called before ‘abort_clients()’
          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(): d0d. や *note asyncio.start_server():
          d13. メソッドに対して使用することにより、初期に接続を受け付け
          ない Server オブジェクトを生成することができます。この場合
          ‘Server.start_serving()’ または *note Server.serve_forever():
          d0f. メソッドを使ってオブジェクトが接続の受け付けを開始するよ
          うにすることができます。

          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(): 3899. 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: Event loop implementations,  Next: 使用例<25>,  Prev: Server objects,  Up: Event loop

5.20.1.73 Event loop implementations
....................................

asyncio は2つの異なるイベントループの実装、 *note SelectorEventLoop:
316. と *note ProactorEventLoop: 81d.、 を提供します:

By default asyncio is configured to use *note EventLoop: 1ac8.

 -- クラス: asyncio.SelectorEventLoop

     A subclass of *note AbstractEventLoop: b5c. 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: 2199.: Unix, Windows.

 -- クラス: asyncio.ProactorEventLoop

     A subclass of *note AbstractEventLoop: b5c. for Windows that uses
     "I/O Completion Ports" (IOCP).

     *note Availability: 2199.: Windows.

     参考
     ....

     MSDN documentation on I/O Completion Ports(1).

 -- クラス: asyncio.EventLoop

          An alias to the most efficient available subclass of *note
          AbstractEventLoop: b5c. for the given platform.

          It is an alias to *note SelectorEventLoop: 316. on Unix and
          *note ProactorEventLoop: 81d. on Windows.

     Added in version 3.13.

 -- クラス: asyncio.AbstractEventLoop

     asyncio に適合するイベントループの抽象基底クラスです。

     The *note Event loop methods: 3922. 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: Event loop implementations,  Up: Event loop

5.20.1.74 使用例
................

この節の全ての使用例は '意図的に' *note loop.run_forever(): 3924. や
*note loop.call_soon(): cfe. のような 低水準のイベントループ API の使用
法を示しています。一方で現代的な asyncio アプリケーションはここに示すよ
うな方法をほとんど必要としません。 *note asyncio.run(): 2f5. のような高
水準の関数の使用を検討してください。

* 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.20.1.75 call_soon() を使った Hello World
..........................................

*note loop.call_soon(): cfe. メソッドを使ってコールバックをスケジュール
する例です。コールバックは ‘"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(): 2f5. 関数を使用した同じような *note Hello
World: 3854. の例。


File: python.info,  Node: call_later で現在の日時を表示する,  Next: 読み込みイベント用ファイル記述子の監視,  Prev: call_soon を使った Hello World,  Up: 使用例<25>

5.20.1.76 call_later() で現在の日時を表示する
.............................................

毎秒現在時刻を表示するコールバックの例です。コールバックは *note
loop.call_later(): d00. メソッドを使って自身を5秒後に実行するよう再スケ
ジュールし、イベントループを停止します:

     import asyncio
     import datetime as dt

     def display_date(end_time, loop):
         print(dt.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(): 2f5. 関数を使用した同じような *note
現在時刻出力: 3873. の例。


File: python.info,  Node: 読み込みイベント用ファイル記述子の監視,  Next: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: call_later で現在の日時を表示する,  Up: 使用例<25>

5.20.1.77 読み込みイベント用ファイル記述子の監視
................................................

ファイル記述子が *note loop.add_reader(): 38b6. メソッドを使って何らかの
データを受信するまで待機し、その後イベントループをクローズします:

     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 例: 38b4.。

   * 高水準の *note asyncio.open_connection(): d12. 関数とストリームを使
     用したもうひとつの *note 実装例: 38b2.。


File: python.info,  Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: 読み込みイベント用ファイル記述子の監視,  Up: 使用例<25>

5.20.1.78 SIGINT および SIGTERM 用のシグナルハンドラーの設定
............................................................

(This ‘signal’ example only works on Unix.)

Register handlers for signals *note SIGINT: 255. and *note SIGTERM:
15fd. using the *note loop.add_signal_handler(): 3945. 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: Event loop,  Up: asyncio --- 非同期 I/O

5.20.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.20.1.80 Future の関数
.......................

 -- の関数: asyncio.isfuture (obj)

     オブジェクト 'obj' が下記のいずれかであれば ‘True’ を返します:

        * *note asyncio.Future: dca. クラスのインスタンス

        * *note asyncio.Task: 1c9. クラスのインスタンス

        * ‘_asyncio_future_blocking’ 属性を持った Future 的なオブジェク
          ト

     Added in version 3.5.

 -- の関数: asyncio.ensure_future (obj, *, loop=None)

     下記のいずれかを返します:

        * 'obj' が *note Future: dca. オブジェクト、 *note Task: 1c9. オ
          ブジェクト、または Future 的なオブジェクト (*note isfuture():
          3960. 関数を使って検査します) である場合には 'obj' そのもの

        * 引数 'obj' がコルーチンである (*note iscoroutine(): 6a6. 関数
          を使って検査します) 場合には 'obj' をラップした *note Task:
          1c9. オブジェクト; この場合コルーチンは ‘ensure_future()’ によ
          りスケジュールされます。

        * 引数 'obj' が awaitable である (*note inspect.isawaitable():
          101c. 関数を使って検査します) 場合には 'obj' を await する
          *note Task: 1c9. オブジェクト

     引数 'obj' が上記のいずれにもあてはまらない場合は *note TypeError:
     199. 例外を送出します。

          重要: Save a reference to the result of this function, to
          avoid a task disappearing mid-execution.

          See also the *note create_task(): 1cb. 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: 13ce. オブジェクトを *note
     asyncio.Future: dca. オブジェクトでラップします。

     バージョン 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.20.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: 385c. を使って実装されたプロトコル) が
     高水準の async/await と相互運用することを可能にするために利用されま
     す。

     経験則は Future オブジェクトをユーザー向けの API であらわに利用しな
     いことです。推奨される Future オブジェクトの生成方法は *note
     loop.create_future(): e78. を呼び出すことです。これによりイベントル
     ープの代替実装は、自身に最適化された Future オブジェクトの実装を合
     わせて提供することができます。

     Futures are *note generic: 2429. over the type of their results.

     バージョン 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(): 3889. メソッド
          により設定された結果を持っている場合は結果の値を返します。

          Future が '完了' していて、 *note set_exception(): e7c. メソッ
          ドにより設定された例外を持っている場合はその例外を送出します。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          If the Future's result isn't yet available, this method raises
          an *note InvalidStateError: 388c. exception.

      -- メソッド: set_result (result)

          Future を '完了' とマークし、結果を設定します。

          Raises an *note InvalidStateError: 388c. error if the Future
          is already 'done'.

      -- メソッド: set_exception (exception)

          Future を '完了' とマークし、例外を設定します。

          Raises an *note InvalidStateError: 388c. error if the Future
          is already 'done'.

      -- メソッド: done ()

          Future が '完了' しているなら ‘True’ を返します。

          Future は 'キャンセルされた' か、または *note set_result():
          3889. メソッドや *note set_exception(): e7c. メソッドの呼び出
          しにより結果や例外が設定された場合に '完了' とみなされます。

      -- メソッド: 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(): cfe. メソッドに
          よりスケジュールされます。

          オプションのキーワード引数 'context' を使って、コールバック
          *callback* を実行する際のコンテキスト *note
          contextvars.Context: 178. を設定することができます。コンテキス
          ト 'context' が指定されない場合は現在のコンテキストが使われま
          す。

          コールバックにパラメータを渡すには、次の例のように *note
          functools.partial(): 219. を使うことができます:

               # 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’ を返しま
          す。

          The optional string argument 'msg' is passed as the argument
          to the *note CancelledError: 4d4. exception raised when a
          cancelled Future is awaited.

          バージョン 3.9 で変更: Added the 'msg' parameter.

      -- メソッド: exception ()

          この Future オブジェクトに設定された例外を返します。

          例外 (または例外が設定されていないときは ‘None’) は Future が
          '完了' している場合のみ返されます。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          Future が '未完了' の場合、このメソッドは *note
          InvalidStateError: 388c. 例外を送出します。

      -- メソッド: 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: 13ce.
     を模倣してデザインされました。両者の重要な違いは以下の通りです:

        - asyncio の Futures と異なり、 *note concurrent.futures.Future:
          13ce. インスタンスは待ち受けできません。

        - *note asyncio.Future.result(): 3963. と *note
          asyncio.Future.exception(): 3966. は 'timeout' 引数を取りませ
          ん。

        - *note asyncio.Future.result(): 3963. と *note
          asyncio.Future.exception(): 3966. は Future が '未完了' の場合
          に *note InvalidStateError: 388c. 例外を送出します。

        - *note asyncio.Future.add_done_callback(): d02. メソッドによっ
          て登録されたコールバックは、即座に呼び出されません。代わりにコ
          ールバックは *note loop.call_soon(): cfe. によりスケジュールさ
          れます。

        - asyncio の Future は *note concurrent.futures.wait(): 1c62. お
          よび *note concurrent.futures.as_completed(): 1a26. との互換性
          がありません。

        - *note asyncio.Future.cancel(): 1c06. accepts an optional ‘msg’
          argument, but *note concurrent.futures.Future.cancel(): 378b.
          does not.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: トランスポートとプロトコル,  Next: ポリシー,  Prev: Future,  Up: asyncio --- 非同期 I/O

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

まえがき
........

トランスポートとプロトコルは *note loop.create_connection(): 818. のよう
な '低水準の' イベントループ API から使われます。これらはコールバックに
基づくプログラミングスタイルを使うことでネットワークや IPC プロトコル
(HTTP など) の高性能な実装を可能にします。

基本的にトランスポートとプロトコルはライブラリやフレームワークからのみ使
われるべきであり、高水準の asyncio アプリケーションから使われるものでは
ありません。

このドキュメントは *note Transports: 396b. と *note Protocols: 396c. を
扱います。

はじめに
........

最上位の観点からは、トランスポートは 'どのように' バイトデータを送信する
かに影響を与え、いっぽうプロトコルは 'どの' バイトデータを送信するかを決
定します (また、ある程度は 'いつ' も決定します) 。

同じことを違う言い方で表現します: トランスポートはソケット (または同様の
I/O 端点) の抽象化であり、プロトコルはトランスポートから見たときのアプリ
ケーションの抽象化です。

さらにもう一つの見方として、トランスポートとプロトコルの2つのインターフ
ェースは、協調してネットワーク I/O やプロセス間 I/O の抽象インターフェー
スを定義しています。

トランスポートオブジェクトとプロトコルオブジェクトの間には常に1対1の関係
があります: プロトコルはデータを送信するためにトランスポートのメソッドを
呼び出し、トランスポートは受信したデータを渡すためにプロトコルのメソッド
を呼び出します。

ほとんどの接続に基づくイベントループメソッド (*note
loop.create_connection(): 818. など) は通常 'protocol_factory' 引数を受
け取り、 'Transport' オブジェクトで表現される確立した接続に対する
'Protocol' オブジェクトを生成するために使います。そのようなメソッドは通
常 ‘(transport, protocol)’ タプルを返します。

内容
....

このページは以下の節から構成されます:

   * *note Transports: 396b. 節は asyncio の *note BaseTransport: 396d,
     *note ReadTransport: 3942, *note WriteTransport: 3943, *note
     Transport: 396e, *note DatagramTransport: 1b86, および *note
     SubprocessTransport: 3950. クラスについて記述しています。

   * *note Protocols: 396c. 節は asyncio の *note BaseProtocol: 396f,
     *note Protocol: 3970, *note BufferedProtocol: c98, *note
     DatagramProtocol: 8df, および *note SubprocessProtocol: 394f. クラ
     スについて記述しています。

   * *note Examples: 3971. 節はトランスポート、プロトコル、および低水準
     のイベントループ API の利用方法を紹介しています。

* Menu:

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


File: python.info,  Node: トランスポート,  Next: プロトコル<2>,  Up: トランスポートとプロトコル

5.20.1.83 トランスポート
........................

'ソースコード:' Lib/asyncio/transports.py(1)

__________________________________________________________________

トランスポートはさまざまな通信方法を抽象化するために *note asyncio: b. が
提供するクラス群です。

トランスポートオブジェクトは常に *note asyncio イベントループ: f7a. によ
ってインスタンス化されます。

asyncio は TCP, UDP, SSL, およびサブプロセスパイプのトランスポートを実装
しています。利用可能なトランスポートのメソッドはトランスポートの種類に依
存します。

トランスポートクラスは *note スレッド安全ではありません: 3884.。

* Menu:

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

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/transports.py


File: python.info,  Node: トランスポートのクラス階層構造,  Next: 基底トランスポート,  Up: トランスポート

5.20.1.84 トランスポートのクラス階層構造
........................................

 -- クラス: asyncio.BaseTransport

     全てのトランスポートの基底クラスです。すべての asyncio トランスポー
     トが共有するメソッドを含んでいます。

 -- クラス: asyncio.WriteTransport (BaseTransport)

     書き込み専用の接続に対する基底トランスポートクラスです。

     'WriteTransport' クラスのインスタンスは *note
     loop.connect_write_pipe(): 38e3. イベントループメソッドから返され、
     *note loop.subprocess_exec(): 38df. のようなサブプロセスに関連する
     メソッドから利用されます。

 -- クラス: asyncio.ReadTransport (BaseTransport)

     読み込み専用の接続に対する基底トランスポートクラスです。

     Instances of the 'ReadTransport' class are returned from the *note
     loop.connect_read_pipe(): 38e2. event loop method and are also used
     by subprocess-related methods like *note loop.subprocess_exec():
     38df.

 -- クラス: asyncio.Transport (WriteTransport, ReadTransport)

     TCP 接続のような、読み出しと書き込みの双方向のトランスポートを表現
     するインターフェースです。

     ユーザーはトランスポートを直接インスタンス化することはありません; ユ
     ーザーは、ユーティリティ関数にプロトコルファクトリとその他トランス
     ポートとプロトコルを作成するために必要な情報を渡して呼び出します。

     'Transport' クラスのインスタンスは、*note loop.create_connection():
     818, *note loop.create_unix_connection(): 389b, *note
     loop.create_server(): d0d, *note loop.sendfile(): 3938. などのイベ
     ントループメソッドから返されたり、これらのメソッドから利用されたり
     します。

 -- クラス: asyncio.DatagramTransport (BaseTransport)

     データグラム (UDP) 接続のためのトランスポートです。

     'DatagramTransport' クラスのインスタンスは *note
     loop.create_datagram_endpoint(): 940. イベントループメソッドから返
     されます。

 -- クラス: asyncio.SubprocessTransport (BaseTransport)

     親プロセスとその子プロセスの間の接続を表現する抽象クラスです。

     'SubprocessTransport' クラスのインスタンスは *note
     loop.subprocess_shell(): 38e0. と *note loop.subprocess_exec():
     38df. の2つのイベントループメソッドから返されます。


File: python.info,  Node: 基底トランスポート,  Next: 読み出し専用のトランスポート,  Prev: トランスポートのクラス階層構造,  Up: トランスポート

5.20.1.85 基底トランスポート
............................

 -- メソッド: BaseTransport.close ()

     トランスポートをクローズします。

     トランスポートが発信データのバッファーを持っていた場合、バッファー
     されたデータは非同期にフラッシュされます。それ以降データは受信され
     ません。バッファーされていたデータがすべてフラッシュされた後、その
     プロトコルの *note protocol.connection_lost(): 3974. メソッドが引数
     *note None: 886. で呼び出されます。一度閉じたトランスポートは、使用
     されるべきではありません。

 -- メソッド: 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(): 3975. の結果になりま
               す (エラーのときは ‘None’)

             - ‘'socket'’: *note socket.socket: fa5. のインスタンスにな
               ります

             - ‘'sockname'’: ソケット自身のアドレスで、*note
               socket.socket.getsockname(): 286. の結果になります

        * SSL ソケット:

             - ‘'compression'’: 圧縮アルゴリズムで、*note
               ssl.SSLSocket.compression(): 1361. の結果になります。圧縮
               されていないときは ‘None’ になります

             - ‘'cipher'’: 3 個の値 (使用されている暗号アルゴリズムの名
               称、使用が定義されている SSL プロトコルのバージョン、およ
               び使用されている秘密鍵のビット数) からなるタプルで、*note
               ssl.SSLSocket.cipher(): 3976. の結果になります

             - ‘'peercert'’: ピアの証明書で、*note
               ssl.SSLSocket.getpeercert(): 11be. の結果になります

             - ‘'sslcontext'’: *note ssl.SSLContext: 355. のインスタンス
               になります

             - ‘'ssl_object'’: *note ssl.SSLObject: d7e. または *note
               ssl.SSLSocket: aeb. インスタンス

        * パイプ:

             - ‘'pipe'’: パイプオブジェクトです

        * サブプロセス:

             - ‘'subprocess'’: *note subprocess.Popen: 4b7. のインスタン
               スになります

 -- メソッド: BaseTransport.set_protocol (protocol)

     トランスポートに新しいプロトコルを設定します。

     プロトコルの切り替えは、両方のプロトコルのドキュメントで切り替えが
     サポートされている場合にのみ行うべきです。

 -- メソッド: BaseTransport.get_protocol ()

     現在のプロトコルを返します。


File: python.info,  Node: 読み出し専用のトランスポート,  Next: 書き込み専用のトランスポート,  Prev: 基底トランスポート,  Up: トランスポート

5.20.1.86 読み出し専用のトランスポート
......................................

 -- メソッド: ReadTransport.is_reading ()

     トランスポートが新しいデータを受信中の場合 ‘True’ を返します。

     Added in version 3.7.

 -- メソッド: ReadTransport.pause_reading ()

     トランスポートの受信側を一時停止します。 *note resume_reading():
     d16. メソッドが呼び出されるまでプロトコルの *note
     protocol.data_received(): 1b60. メソッドにデータは渡されません。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでに停止していたりクローズしていても呼び出すことができます
     。

 -- メソッド: ReadTransport.resume_reading ()

     受信を再開します。データが読み込み可能になるとプロトコルの *note
     protocol.data_received(): 1b60. メソッドが再び呼び出されるようにな
     ります。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでにデータを読み込み中であっても呼び出すことができます。


File: python.info,  Node: 書き込み専用のトランスポート,  Next: データグラムトランスポート,  Prev: 読み出し専用のトランスポート,  Up: トランスポート

5.20.1.87 書き込み専用のトランスポート
......................................

 -- メソッド: WriteTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 3974. メソッドが引数 *note None: 886. で
     呼び出されます。

 -- メソッド: WriteTransport.can_write_eof ()

     トランスポートが *note write_eof(): 397c. メソッドをサポートしてい
     る場合 *note True: e0b. を返し、そうでない場合は *note False: d2f.
     を返します。

 -- メソッド: WriteTransport.get_write_buffer_size ()

     トランスポートで使用されている出力バッファーの現在のサイズを返しま
     す。

 -- メソッド: WriteTransport.get_write_buffer_limits ()

     書き込みフロー制御の '最高' および '最低' 水位点を取得します。
     ‘(low, high)’ タプルを返します。ここで 'low' と 'high' はバイト数を
     あらわす正の整数です。

     水位点の設定は *note set_write_buffer_limits(): 397e. で行います。

     Added in version 3.4.2.

 -- メソッド: WriteTransport.set_write_buffer_limits (high=None,
          low=None)

     書き込みフロー制御の '最高' および '最低' 水位点を設定します。

     (バイト数をあらわす) これら2つの値はプロトコルの *note
     protocol.pause_writing(): 397f. と *note protocol.resume_writing():
     3980. の2つのメソッドがいつ呼ばれるかを制御します。指定する場合、
     'low' は 'high' と等しいかまたは 'high' より小さくなければなりませ
     ん。また、 'high' も 'low' も負の値を指定することはできません。

     *note pause_writing(): 397f. はバッファーサイズが 'high' の値以上に
     なった場合に呼び出されます。書き込みが一時停止している場合、バッフ
     ァーサイズが 'low' の値以下になると *note resume_writing(): 3980. メ
     ソッドが呼び出されます。

     デフォルト値は実装固有になります。 'high' のみ与えられた場合、
     'low' は 'high' 以下の実装固有のデフォルト値になります。 'high' を
     ゼロに設定すると 'low' も強制的にゼロになり、バッファーが空でなくな
     るとすぐに *note pause_writing(): 397f. メソッドが呼び出されるよう
     になります。 'low' をゼロに設定すると、バッファーが空にな *note
     resume_writing(): 3980. が呼び出されるようになります。どちらかにゼ
     ロを設定することは I/O と計算を並行に実行する機会を減少させるため、
     一般に最適ではありません。

     上限値と下限値を取得するには *note get_write_buffer_limits(): fc8.
     メソッドを使ってください。

 -- メソッド: WriteTransport.write (data)

     トランスポートにバイト列 'data' を書き込みます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

 -- メソッド: WriteTransport.writelines (list_of_data)

     バイト列のデータのリスト (またはイテラブル) をトランスポートに書き
     込みます。この振る舞いはイテラブルを yield して各要素で *note
     write(): 1835. を呼び出すことと等価ですが、より効率的な実装となる場
     合があります。

 -- メソッド: WriteTransport.write_eof ()

     バッファーされた全てのデータをフラッシュした後トランスポートの送信
     側をクローズします。送信側をクローズした後もデータを受信することは
     可能です。

     このメソッドはトランスポート (例えば SSL) がハーフクローズドな接続
     をサポートしていない場合 *note NotImplementedError: 369. を送出しま
     す。


File: python.info,  Node: データグラムトランスポート,  Next: サブプロセス化されたトランスポート,  Prev: 書き込み専用のトランスポート,  Up: トランスポート

5.20.1.88 データグラムトランスポート
....................................

 -- メソッド: DatagramTransport.sendto (data, addr=None)

     リモートピア 'addr' (トランスポート依存の対象アドレス) にバイト列
     'data' を送信します。'addr' が *note None: 886. の場合、データはト
     ランスポートの作成時に指定された送信先に送られます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

     バージョン 3.13 で変更: このメソッドは、長さがゼロのデータグラムを
     送信するために、空のバイトオブジェクトで呼び出すこともできます。フ
     ロー制御に使用されるバッファサイズ計算も、データグラムヘッダーを考
     慮するように更新されました。

 -- メソッド: DatagramTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 3974. メソッドが引数 *note None: 886. で
     呼び出されます。


File: python.info,  Node: サブプロセス化されたトランスポート,  Prev: データグラムトランスポート,  Up: トランスポート

5.20.1.89 サブプロセス化されたトランスポート
............................................

 -- メソッド: SubprocessTransport.get_pid ()

     サブプロセスのプロセス ID (整数) を返します。

 -- メソッド: SubprocessTransport.get_pipe_transport (fd)

     整数のファイル記述子 'fd' に該当する通信パイプのトランスポートを返
     します:

        * ‘0’: writable streaming transport of the standard input
          ('stdin'), or *note None: 886. if the subprocess was not
          created with ‘stdin=PIPE’

        * ‘1’: readable streaming transport of the standard output
          ('stdout'), or *note None: 886. if the subprocess was not
          created with ‘stdout=PIPE’

        * ‘2’: readable streaming transport of the standard error
          ('stderr'), or *note None: 886. if the subprocess was not
          created with ‘stderr=PIPE’

        * その他の 'fd': *note None: 886.

 -- メソッド: SubprocessTransport.get_returncode ()

     サブプロセスのリターンコードを整数で返します。サブプロセスがリター
     ンしなかった場合は *note None: 886. を返します。 *note
     subprocess.Popen.returncode: c87. 属性と同じです。

 -- メソッド: SubprocessTransport.kill ()

     サブプロセスを強制終了 (kill) します。

     POSIX システムでは、この関数はサブプロセスに SIGKILL を送信します。
     Windows では、このメソッドは *note terminate(): 3988. の別名です。

     *note subprocess.Popen.kill(): 15fb. も参照してください。

 -- メソッド: SubprocessTransport.send_signal (signal)

     サブプロセスにシグナル 'signal' を送信します。*note
     subprocess.Popen.send_signal(): 15fc. と同じです。

 -- メソッド: SubprocessTransport.terminate ()

     サブプロセスを停止します。

     POSIX システムでは、このメソッドはサブプロセスに *note SIGTERM:
     15fd. を送信します。Windows では、Windows API 関数
     ‘TerminateProcess()’ がサブプロセスを停止するために呼び出されます。

     *note subprocess.Popen.terminate(): 15fa. も参照してください。

 -- メソッド: SubprocessTransport.close ()

     *note kill(): 3987. メソッドを呼び出すことでサブプロセスを強制終了
     します。

     サブプロセスがまだリターンしていない場合、 'stdin', 'stdout', およ
     び 'stderr' の各パイプのトランスポートをクローズします。


File: python.info,  Node: プロトコル<2>,  Next: 使用例<26>,  Prev: トランスポート,  Up: トランスポートとプロトコル

5.20.1.90 プロトコル
....................

'ソースコード:' Lib/asyncio/protocols.py(1)

__________________________________________________________________

asyncio はネットワークプロトコルを実装するために使う抽象基底クラス群を提
供します。これらのクラスは *note トランスポート: 392f. と組み合わせて使
うことが想定されています。

抽象基底プロトコルクラスの派生クラスはメソッドの一部または全てを実装する
ことができます。これらのメソッドは全てコールバックです: それらは、データ
を受信した、などの決まったイベントに対してトランスポートから呼び出されま
す。基底プロトコルメソッドは対応するトランスポートから呼び出されるべきで
す。

* 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.20.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.20.1.92 基底プロトコル
........................

全ての asyncio プロトコルは基底プロトコルのコールバックを実装することが
できます。

通信のコールバック
..................

コネクションコールバックは全てのプロトコルから、成功したコネクションそれ
ぞれにつきただ一度だけ呼び出されます。その他の全てのプロトコルコールバッ
クはこれら2つのメソッドの間に呼び出すことができます。

 -- メソッド: BaseProtocol.connection_made (transport)

     コネクションが作成されたときに呼び出されます。

     引数 'transport' はコネクションをあらわすトランスポートです。プロト
     コルはトランスポートへの参照を保存する責任を負います。

 -- メソッド: BaseProtocol.connection_lost (exc)

     コネクションが失われた、あるいはクローズされたときに呼び出されます
     。

     引数は例外オブジェクトまたは *note None: 886. になります。‘None’ の
     とき、通常の EOF が受信されたか、あるいはコネクションがこちら側から
     中止またはクローズされたことを意味します。

フロー制御コールバック
......................

フロー制御コールバックは、プロトコルによって実行される書き込み処理を停止
または再開するためにトランスポートから呼び出されます。

詳しくは *note set_write_buffer_limits(): 397e. メソッドのドキュメントを
参照してください。

 -- メソッド: BaseProtocol.pause_writing ()

     トランスポートのバッファーサイズが最高水位点 (high watermark) を超
     えたときに呼び出されます。

 -- メソッド: BaseProtocol.resume_writing ()

     トランスポートのバッファーサイズが最低水位点 (low watermark) に達し
     たきに呼び出されます。

バッファーサイズが最高水位点と等しい場合、 *note pause_writing(): 397f.
は呼び出されません: バッファーサイズは必ず制限値を超えなければなりません
。

それに対して、 *note resume_writing(): 3980. はバッファーサイズが最低水
位点と等しいかそれよりも小さい場合に呼び出されます。これらの境界条件は、
どちらの基準値もゼロである場合の処理が期待通りとなることを保証するために
重要です。


File: python.info,  Node: ストリーミングプロトコル,  Next: バッファリングされたストリーミングプロトコル,  Prev: 基底プロトコル<2>,  Up: プロトコル<2>

5.20.1.93 ストリーミングプロトコル
..................................

*note loop.create_server(): d0d, *note loop.create_unix_server(): 4ca,
*note loop.create_connection(): 818, *note
loop.create_unix_connection(): 389b, *note
loop.connect_accepted_socket(): 9e2, *note loop.connect_read_pipe():
38e2, そして *note loop.connect_write_pipe(): 38e3. などのイベントメソッ
ドはストリーミングプロトコルを返すファクトリを受け付けます。

 -- メソッド: Protocol.data_received (data)

     データを受信したときに呼び出されます。'data' は受信したデータを含む
     空ではないバイト列オブジェクトになります。

     データがバッファーされるか、チャンキングされるか、または再構築され
     るかはトランスポートに依存します。一般には、特定のセマンティクスを
     信頼するべきではなく、代わりにデータのパースを全般的かつ柔軟に行う
     べきです。ただし、データは常に正しい順序で受信されます。

     このメソッドは、コネクションがオープンである間は何度でも呼び出すこ
     とができます。

     いっぽうで、 *note protocol.eof_received(): 398e. メソッドは最大で
     も一度だけ呼び出されます。いったん ‘eof_received()’ が呼び出される
     と、それ以降 ‘data_received()’ は呼び出されません。

 -- メソッド: Protocol.eof_received ()

     コネクションの相手方がこれ以上データを送信しないことを伝えてきたと
     き (例えば相手方が asyncio を使用しており、 *note
     transport.write_eof(): 397c. を呼び出した場合) に呼び出されます。

     このメソッドは (‘None’ を含む) 偽値 を返すことがあり、その場合トラ
     ンスポートは自身をクローズします。一方メソッドが真値を返す場合は、
     利用しているプロトコルがトランスポートをクローズするかどうかを決め
     ます。デフォルトの実装は ‘None’ を返すため、コネクションは暗黙のう
     ちにクローズされます。

     SSL を含む一部のトランスポートはハーフクローズ接続をサポートしませ
     ん。そのような場合このメソッドが真値を返すとコネクションはクローズ
     されます。

ステートマシン:

     start -> connection_made
         [-> data_received]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: バッファリングされたストリーミングプロトコル,  Next: データグラムプロトコル,  Prev: ストリーミングプロトコル,  Up: プロトコル<2>

5.20.1.94 バッファリングされたストリーミングプロトコル
......................................................

Added in version 3.7.

バッファー付きプロトコルは *note ストリーミングプロトコル: 398d. をサポ
ートするイベントループメソッドで利用することができます。

‘BufferedProtocol’ 実装は受信バッファーの手動での明示的な割り当てや制御
を可能にします。イベントループはプロトコルにより提供されるバッファを利用
することにより不要なデータのコピーを避けることができます。これにより大量
のデータを受信するプロトコルにおいて顕著なパフォーマンスの向上をもたらし
ます。精巧なプロトコル実装によりバッファー割り当ての数を劇的に減少させる
ことができます。

以下に示すコールバックは *note BufferedProtocol: c98. インスタンスに対し
て呼び出されます:

 -- メソッド: BufferedProtocol.get_buffer (sizehint)

     新しい受信バッファを割り当てるために呼び出します。

     'sizehint' は返されるバッファーの推奨される最小サイズです。
     'sizehint' によって推奨された値より小さい、または大きいサイズのバッ
     ファーを返すことは容認されています。 -1 がセットされた場合、バッフ
     ァーサイズは任意となります。サイズがゼロのバッファーを返すとエラー
     になります。

     ‘get_buffer()’ は *note バッファープロトコル: 262. を実装したオブジ
     ェクトを返さなければなりません。

 -- メソッド: BufferedProtocol.buffer_updated (nbytes)

     受信データによりバッファが更新された場合に呼び出されます。

     'nbytes' はバッファに書き込まれた総バイト数です。

 -- メソッド: BufferedProtocol.eof_received ()

     *note protocol.eof_received(): 398e. メソッドのドキュメントを参照し
     てください。

コネクションの間、 *note get_buffer(): 3990. は何度でも呼び出すことがで
きます。しかし *note protocol.eof_received(): 398e. が呼び出されるのは最
大でも1回で、もし呼び出されると、それ以降 ‘get_buffer()’ と *note
buffer_updated(): 3991. が呼び出されることはありません。

ステートマシン:

     start -> connection_made
         [-> get_buffer
             [-> buffer_updated]?
         ]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: データグラムプロトコル,  Next: サブプロセスプロトコル,  Prev: バッファリングされたストリーミングプロトコル,  Up: プロトコル<2>

5.20.1.95 データグラムプロトコル
................................

データグラムプロトコルのインスタンスは *note
loop.create_datagram_endpoint(): 940. メソッドに渡されたプロトコルファク
トリによって生成されるべきです。

 -- メソッド: DatagramProtocol.datagram_received (data, addr)

     データグラムを受信したときに呼び出されます。'data' は受信データを含
     むバイトオブジェクトです。'addr' はデータを送信するピアのアドレスで
     す; 正確な形式はトランスポートに依存します。

 -- メソッド: DatagramProtocol.error_received (exc)

     直前の送信あるいは受信が *note OSError: 2c2. を送出したときに呼び出
     されます。'exc' は ‘OSError’ のインスタンスになります。

     このメソッドが呼ばれるのは、トランスポート (UDP など) がデータグラ
     ムを受信側に配信できなかったことが検出されたなどの、まれな場合にお
     いてのみです。ほとんどの場合、データグラムが配信できなければそのま
     ま通知されることなく破棄されます。

     注釈: BSD システム (macOS, FreeBSD など) ではフロー制御はサポートさ
     れていません。これは非常に多くのパケットを書き込もうとしたことによ
     る送信の失敗を検出する信頼できる方法が存在しないためです。

     ソケットは常に '準備ができた状態' のように振る舞いますが、超過した
     パケットは破棄されます。この場合 ‘errno’ を *note errno.ENOBUFS:
     1bd0. に設定した *note OSError: 2c2. 例外が送出されることがあります
     。もし例外が送出された場合は *note
     DatagramProtocol.error_received(): 3995. に通知されますが、送出され
     ない場合は単に無視されます。


File: python.info,  Node: サブプロセスプロトコル,  Prev: データグラムプロトコル,  Up: プロトコル<2>

5.20.1.96 サブプロセスプロトコル
................................

サブプロセスプロトコルのインスタンスは *note loop.subprocess_exec():
38df. と *note loop.subprocess_shell(): 38e0. メソッドに渡されたプロトコ
ルファクトリにより生成されるべきです。

 -- メソッド: SubprocessProtocol.pipe_data_received (fd, data)

     子プロセスが標準出力または標準エラー出力のパイプにデータを書き込ん
     だ時に呼び出されます。

     'fd' はパイプのファイル記述子を表す整数です。

     'data' は受信データを含む空でないバイトオブジェクトです。

 -- メソッド: SubprocessProtocol.pipe_connection_lost (fd, exc)

     子プロセスと通信するパイプのいずれかがクローズされたときに呼び出さ
     れます。

     'fd' はクローズされたファイル記述子を表す整数です。

 -- メソッド: SubprocessProtocol.process_exited ()

     子プロセスが終了したときに呼び出されます。

     これは、 *note pipe_data_received(): 1baf. と *note
     pipe_connection_lost(): 3997. メソッドの前に呼び出すことができます
     。


File: python.info,  Node: 使用例<26>,  Prev: プロトコル<2>,  Up: トランスポートとプロトコル

5.20.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.20.1.98 TCP エコーサーバー
............................

*note loop.create_server(): d0d. メソッドを使って 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 エコーサーバー: 38ae. の例では高水準の
*note asyncio.start_server(): d13. 関数を使っています。


File: python.info,  Node: TCP エコークライアント,  Next: UDP エコーサーバー,  Prev: TCP エコーサーバー,  Up: 使用例<26>

5.20.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 エコークライアント: 38ab. の例では高水準の
*note asyncio.open_connection(): d12. 関数を使っています。


File: python.info,  Node: UDP エコーサーバー,  Next: UDP エコークライアント,  Prev: TCP エコークライアント,  Up: 使用例<26>

5.20.1.100 UDP エコーサーバー
.............................

*note loop.create_datagram_endpoint(): 940. メソッドを使った 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.20.1.101 UDP エコークライアント
.................................

*note loop.create_datagram_endpoint(): 940. メソッドを使った 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.20.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 ファイル記述子の読み込みイベントを監視する: 38b5. 例では低レベルの
*note loop.add_reader(): 38b6. メソッドを使ってファイル記述子 (FD) を登
録しています。

*note ストリームを使ってデータを待ち受けるオープンなソケットを登録する:
38b2. 例ではコルーチン内で *note open_connection(): d12. 関数によって生
成されたストリームを使っています。


File: python.info,  Node: loop subprocess_exec と SubprocessProtocol,  Prev: 既存のソケットへの接続,  Up: 使用例<26>

5.20.1.103 loop.subprocess_exec() と SubprocessProtocol
.......................................................

サブプロセスからの出力を受け取り、サブプロセスが終了するまで待機するため
に使われるサブプロセスプロトコルの例です。

サブプロセスは *note loop.subprocess_exec(): 38df. メソッドにより生成さ
れます:

     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 as dt; print(dt.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 同様の例: 38f3. も参照してください。


File: python.info,  Node: ポリシー,  Next: プラットフォームでのサポート,  Prev: トランスポートとプロトコル,  Up: asyncio --- 非同期 I/O

5.20.1.104 ポリシー
...................

     警告: Policies are deprecated and will be removed in Python 3.16.
     Users are encouraged to use the *note asyncio.run(): 2f5. function
     or the *note asyncio.Runner: 2f7. 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: f7a, as well as create new event loops.  The default
policy can be *note replaced: 39a1. with *note built-in alternatives:
39a2. to use different event loop implementations, or substituted by a
*note custom policy: 39a3. that can override these behaviors.

The *note policy object: 39a4. 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(): 2f4, *note set_event_loop(): 1bb4, and *note
new_event_loop(): 3862.

ポリシーオブジェクトは *note AbstractEventLoopPolicy: 310. 抽象基底クラ
スで定義された API を実装しなければなりません。

* Menu:

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


File: python.info,  Node: ポリシーの取得と設定,  Next: ポリシーオブジェクト,  Up: ポリシー

5.20.1.105 ポリシーの取得と設定
...............................

以下の関数は現在のプロセスに対するポリシーの取得や設定をするために使われ
ます:

 -- の関数: asyncio.get_event_loop_policy ()

     プロセス全体にわたる現在のポリシーを返します。

     バージョン 3.14 で非推奨: The ‘get_event_loop_policy()’ function is
     deprecated and will be removed in Python 3.16.

 -- の関数: asyncio.set_event_loop_policy (policy)

     プロセス全体にわたる現在のポリシーを 'policy' に設定します。

     'policy' が ‘None’ の場合、デフォルトポリシーが現在のポリシーに戻さ
     れます。

     バージョン 3.14 で非推奨: The ‘set_event_loop_policy()’ function is
     deprecated and will be removed in Python 3.16.


File: python.info,  Node: ポリシーオブジェクト,  Next: ポリシーのカスタマイズ,  Prev: ポリシーの取得と設定,  Up: ポリシー

5.20.1.106 ポリシーオブジェクト
...............................

イベントループポリシーの抽象基底クラスは以下のように定義されています:

 -- クラス: asyncio.AbstractEventLoopPolicy

     asyncio ポリシーの抽象基底クラスです。

      -- メソッド: get_event_loop ()

          現在のコンテキストのイベントループを取得します。

          *note AbstractEventLoop: b5c. のインターフェースを実装したイベ
          ントループオブジェクトを返します。

          このメソッドは ‘None’ を返してはいけません。

          バージョン 3.6 で変更.

      -- メソッド: set_event_loop (loop)

          現在のコンテキストにイベントループ 'loop' を設定します。

      -- メソッド: new_event_loop ()

          新しいイベントループオブジェクトを生成して返します。

          このメソッドは ‘None’ を返してはいけません。

     バージョン 3.14 で非推奨: The ‘AbstractEventLoopPolicy’ class is
     deprecated and will be removed in Python 3.16.

asyncio は以下の組み込みポリシーを提供します:

 -- クラス: asyncio.DefaultEventLoopPolicy

     デフォルトの asyncio ポリシーです。Unix では *note
     SelectorEventLoop: 316. 、Windows では *note ProactorEventLoop:
     81d. を使います。

     デフォルトのポリシーを手動でインストールする必要はありません。
     asyncio はデフォルトポリシーを使うように自動的に構成されます。

     バージョン 3.8 で変更: Windows では *note ProactorEventLoop: 81d. が
     デフォルトで使われるようになりました。

     バージョン 3.14 で変更: The *note get_event_loop(): 2f4. method of
     the default asyncio policy now raises a *note RuntimeError: 246. if
     there is no set event loop.

     バージョン 3.14 で非推奨: The ‘DefaultEventLoopPolicy’ class is
     deprecated and will be removed in Python 3.16.

 -- クラス: asyncio.WindowsSelectorEventLoopPolicy

     *note SelectorEventLoop: 316. イベントループ実装を使った別のイベン
     トループポリシーです。

     *note Availability: 2199.: Windows.

     バージョン 3.14 で非推奨: The ‘WindowsSelectorEventLoopPolicy’
     class is deprecated and will be removed in Python 3.16.

 -- クラス: asyncio.WindowsProactorEventLoopPolicy

     *note ProactorEventLoop: 81d. イベントループ実装を使った別のイベン
     トループポリシーです。

     *note Availability: 2199.: Windows.

     バージョン 3.14 で非推奨: The ‘WindowsProactorEventLoopPolicy’
     class is deprecated and will be removed in Python 3.16.


File: python.info,  Node: ポリシーのカスタマイズ,  Prev: ポリシーオブジェクト,  Up: ポリシー

5.20.1.107 ポリシーのカスタマイズ
.................................

新しいイベントループのポリシーを実装するためには、以下に示すように *note
DefaultEventLoopPolicy: 311. を継承して振る舞いを変更したいメソッドをオ
ーバーライドすることが推奨されます。:

     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.20.1.108 プラットフォームでのサポート
.......................................

*note asyncio: b. モジュールは可搬的であるようにデザインされていますが、
いくつかのプラットフォームでは、その根底にあるアーキテクチャや性能による
微妙な動作の違いや制限があります。

* Menu:

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


File: python.info,  Node: 全てのプラットホーム,  Next: Windows<86>,  Up: プラットフォームでのサポート

5.20.1.109 全てのプラットホーム
...............................

   * *note loop.add_reader(): 38b6. と *note loop.add_writer(): 393c. を
     ファイル I/O を監視するためには使えません。


File: python.info,  Node: Windows<86>,  Next: macOS<55>,  Prev: 全てのプラットホーム,  Up: プラットフォームでのサポート

5.20.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(): 389b. と *note
     loop.create_unix_server(): 4ca. はサポートされません。 *note
     socket.AF_UNIX: 1c0d. ソケットファミリーは Unix 固有です。

   * *note loop.add_signal_handler(): 3945. と *note
     loop.remove_signal_handler(): 3946. はサポートされていません。

*note SelectorEventLoop: 316. は以下の制限があります:

   * *note SelectSelector: 39b0. はソケットイベントの待ち受けに使われま
     す: このクラスはソケットをサポートしますが 512 ソケットまでに制限さ
     れています。

   * *note loop.add_reader(): 38b6. と *note loop.add_writer(): 393c. は
     ソケットハンドルのみを受け付けます (たとえばパイプファイル記述子は
     サポートされていません)。

   * パイプはサポートされていません。従って *note
     loop.connect_read_pipe(): 38e2. と *note loop.connect_write_pipe():
     38e3. の2つのメソッドは未実装です。

   * *note Subprocesses: 3856. はサポートされていません。すなわち *note
     loop.subprocess_exec(): 38df. と *note loop.subprocess_shell():
     38e0. の2つのメソッドは未実装です。

*note ProactorEventLoop: 81d. は以下の制限があります:

   * *note loop.add_reader(): 38b6. と *note loop.add_writer(): 393c. は
     サポートされていません。

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<86>

5.20.1.111 Windows におけるサブプロセスのサポート
.................................................

Windows において、デフォルトのイベントループ *note ProactorEventLoop:
81d. はサブプロセスをサポートしますが、 *note SelectorEventLoop: 316. は
サポートしません。


File: python.info,  Node: macOS<55>,  Prev: Windows<86>,  Up: プラットフォームでのサポート

5.20.1.112 macOS
................

最近の macOS バージョンは完全にサポートされています。

10.8 以前の macOS
.................

macOS 10.6, 10.7 および 10.8 では、デフォルトイベントループは *note
selectors.KqueueSelector: 39b3. をしていますが、このクラスはこれらの
macOS バージョンのキャラクターデバイスをサポートしていません。これらの
macOS バージョンでキャラクターデバイスをサポートするためには *note
SelectorEventLoop: 316. で *note SelectSelector: 39b0. または *note
PollSelector: dd5. を使うように手動で設定します。以下はその例です:

     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.20.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.20.1.114 Writing a Custom Event Loop
......................................

*note asyncio.AbstractEventLoop: b5c. 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.20.1.115 Future and Task private constructors
...............................................

*note asyncio.Future: dca. and *note asyncio.Task: 1c9. should be never
created directly, please use corresponding *note loop.create_future():
e78. and *note loop.create_task(): 1cc, or *note asyncio.create_task():
1cb. 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(): 1cc. description.

     バージョン 3.11 で変更: 'context' argument is added.


File: python.info,  Node: Task lifetime support,  Prev: Future and Task private constructors,  Up: Extending

5.20.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(): b53. 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(): 2479. 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(): 2479. or *note
     coroutine.throw(): 71b. execution.


File: python.info,  Node: 高水準の API インデックス,  Next: 低水準の API インデックス,  Prev: Extending,  Up: asyncio --- 非同期 I/O

5.20.1.117 高水準の API インデックス
....................................

このページには、すべての高水準の 非同期/待機 可能な asyncio API が一覧に
なっています。

* Menu:

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


File: python.info,  Node: Task,  Next: キュー<2>,  Up: 高水準の API インデックス

5.20.1.118 Task
...............

ユーティリティは asyncio プログラムを実行し、タスクを作成し、タイムアウ
トのある複数の機能を待っています。

*note run(): 2f5.                                      イベントループを作成し、コルーチンを実行し、ループを
                                                       閉じます。
                                                       
                                                       
*note Runner: 2f7.                                     複数の非同期関数呼び出しをシンプルにするコンテキスト
                                                       マネージャ。
                                                       
                                                       
*note Task: 1c9.                                       Task オブジェクト
                                                       
                                                       
*note TaskGroup: 4d1.                                  タスクのグループを保持するコンテキストマネージャ。グ
                                                       ループに属するすべてのタスクが完了するのを待つのに便
                                                       利で信頼性のある方法を提供します。
                                                       
                                                       
*note create_task(): 1cb.                              asyncio タスクを開始し、それを返します。
                                                       
                                                       
*note current_task(): 6a5.                             現在のタスクを返します。
                                                       
                                                       
*note all_tasks(): b53.                                イベントループのまだ終了していないすべてのタスクを返
                                                       します。
                                                       
                                                       
‘await’ *note sleep(): c68.                            数秒間スリープします。
                                                       
                                                       
‘await’ *note gather(): 813.                           並行してスケジュールして、待ちます。
                                                       
                                                       
‘await’ *note wait_for(): 815.                         タイムアウトで実行します。
                                                       
                                                       
‘await’ *note shield(): c69.                           取り消しから保護します。
                                                       
                                                       
‘await’ *note wait(): 6a7.                             完了かどうかを監視します。
                                                       
                                                       
*note timeout(): 814.                                  タイムアウト付きで実行します。 ‘wait_for’ が適してい
                                                       ない場合に有用です。
                                                       
                                                       
*note to_thread(): ae9.                                別の OS スレッドで非同期的に関数を実行します。
                                                       
                                                       
*note run_coroutine_threadsafe(): a86.                 別の OS スレッドからコルーチンの実行をスケジュールし
                                                       ます。
                                                       
                                                       
‘for in’ *note as_completed(): 4c6.                    ‘for’ ループ向けにコルーチンの完了を監視します。
                                                       

使用例
......

   * *note asyncio.gather() を使って複数の処理を並列に実行する: 3875. 。

   * *note asyncio.wait_for() を使って強制的にタイムアウトする: 387d. 。

   * *note 非同期処理をキャンセルする: 3892. 。

   * *note asyncio.sleep() を使う: 3873. 。

   * *note Tasks のドキュメント: 3854. も参照してください。


File: python.info,  Node: キュー<2>,  Next: サブプロセス<2>,  Prev: Task,  Up: 高水準の API インデックス

5.20.1.119 キュー
.................

キューは複数の非同期タスクの分散処理、コネクションプールやpub/subパター
ンの実装に適しています。

*note Queue: c6e.                                      FIFO キューです。
                                                       
                                                       
*note PriorityQueue: 3905.                             優先度付きのキューです。
                                                       
                                                       
*note LifoQueue: 3907.                                 LIFO キュー (スタック) です。
                                                       

使用例
......

   * *note asyncio.Queue を使って複数のタスクを分散処理する: 3909.

   * *note Queue のドキュメント: 3857. も参照してください。


File: python.info,  Node: サブプロセス<2>,  Next: ストリーム<2>,  Prev: キュー<2>,  Up: 高水準の API インデックス

5.20.1.120 サブプロセス
.......................

サブプロセスを生成したり、シェルコマンドを実行するためのユーティリティで
す。

‘await’ *note create_subprocess_exec(): c6f.           サブプロセスを作成します。
                                                       
                                                       
‘await’ *note create_subprocess_shell(): c70.          シェルコマンドを実行します。
                                                       

使用例
......

   * *note シェルコマンドを実行する: 38d9.。

   * *note サブプロセス API: 3856. のドキュメントも参照してください。


File: python.info,  Node: ストリーム<2>,  Next: 同期,  Prev: サブプロセス<2>,  Up: 高水準の API インデックス

5.20.1.121 ストリーム
.....................

ネットワーク IO を利用するための高水準の APIs です。

‘await’ *note open_connection(): d12.                  TCP コネクションを確立します。
                                                       
                                                       
‘await’ *note open_unix_connection(): 389a.            Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note start_server(): d13.                     TCP サーバーを起動します。
                                                       
                                                       
‘await’ *note start_unix_server(): 389c.               Unix のソケットサーバーを起動します。
                                                       
                                                       
*note StreamReader: 17d7.                              ネットワークからデータを受信するための高水準の
                                                       async/await オブジェクトです。
                                                       
                                                       
*note StreamWriter: 1ad1.                              ネットワークにデータを送信するための高水準の
                                                       async/await オブジェクトです。
                                                       

使用例
......

   * *note TCPクライアントの例: 3896.

   * *note ストリーム API: 3855. のドキュメントも参照してください。


File: python.info,  Node: 同期,  Next: 例外<17>,  Prev: ストリーム<2>,  Up: 高水準の API インデックス

5.20.1.122 同期
...............

タスク内で利用できるスレッド並列処理に似た同期プリミティブです。

*note Lock: c6a.                                       ミューテックスロックです。
                                                       
                                                       
*note Event: 2f6.                                      イベントオブジェクトです。
                                                       
                                                       
*note Condition: c6b.                                  条件変数オブジェクトです。
                                                       
                                                       
*note Semaphore: c6c.                                  セマフォ (semaphore) です。
                                                       
                                                       
*note BoundedSemaphore: c6d.                           有限セマフォ (bounded semaphore) です。
                                                       
                                                       
*note Barrier: 816.                                    バリアーオブジェクト。
                                                       

使用例
......

   * *note asyncio.Event の使用例: 38c2. 。

   * *note asyncio.Barrier を使う: 38d0.。

   * asyncio の *note 同期プリミティブ: 3858. についてのドキュメントも参
     照してください。


File: python.info,  Node: 例外<17>,  Prev: 同期,  Up: 高水準の API インデックス

5.20.1.123 例外
...............

*note asyncio.CancelledError: 4d4.                     タスクがキャンセルされた場合に送出されます。
                                                       *note Task.cancel(): 4d3. も参照してください。
                                                       
                                                       
*note asyncio.BrokenBarrierError: 817.                 バリアーが破壊された場合に送出されます。
                                                       *note Barrier.wait(): 38cf. も参照してください。
                                                       

使用例
......

   * *note CancelledError
     を処理してキャンセル要求に対応するコードを実行する: 3892.

   * *note asyncio に特有な例外の完全なリスト: 390b. も参照してください
     。


File: python.info,  Node: 低水準の API インデックス,  Next: asyncio での開発,  Prev: 高水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.20.1.124 低水準の API インデックス
....................................

このページでは低水準の asyncio API を全てリストしています。

* Menu:

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


File: python.info,  Node: イベントループの取得,  Next: イベントループのメソッド,  Up: 低水準の API インデックス

5.20.1.125 イベントループの取得
...............................

*note asyncio.get_running_loop(): d05.                 実行中のイベントループを取得するために '利用が推奨さ
                                                       れる' 関数です。
                                                       
                                                       
*note asyncio.get_event_loop(): 2f4.                   Get an event loop instance (running or current via
                                                       the current policy).
                                                       
                                                       
*note asyncio.set_event_loop(): 1bb4.                  ポリシーに基づいて引数のイベントループを "カレント"
                                                       (current event loop) に設定します。
                                                       
                                                       
*note asyncio.new_event_loop(): 3862.                  新しいイベントループのインスタンスを生成します。
                                                       

使用例
......

   * *note asyncio.get_running_loop() を使う: 3967.。


File: python.info,  Node: イベントループのメソッド,  Next: トランスポート<2>,  Prev: イベントループの取得,  Up: 低水準の API インデックス

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

See also the main documentation section about the *note Event loop
methods: 3922.

ライフサイクル
..............

*note loop.run_until_complete(): e76.                  Future/Task/awaitable が完了するまで実行します。
                                                       
                                                       
*note loop.run_forever(): 3924.                        イベントループを永久に実行します。
                                                       
                                                       
*note loop.stop(): e7b.                                イベントループを停止します。
                                                       
                                                       
*note loop.close(): 3926.                              イベントループをクローズします。
                                                       
                                                       
*note loop.is_running(): 3925.                         イベントループが実行中の場合 ‘True’ を返します。
                                                       
                                                       
*note loop.is_closed(): fc7.                           イベントループがクローズされている場合 ‘True’ を返し
                                                       ます。
                                                       
                                                       
‘await’ *note loop.shutdown_asyncgens(): e7d.          非同期ジェネレータをクローズします。
                                                       

デバッグ
........

*note loop.set_debug(): fc5.                           デバッグモードを有効化または無効化します。
                                                       
                                                       
*note loop.get_debug(): fc6.                           現在のデバッグモードを取得します。
                                                       

コールバックのスケジューリング
..............................

*note loop.call_soon(): cfe.                           コールバックを即座に実行します。
                                                       
                                                       
*note loop.call_soon_threadsafe(): cff.                *note loop.call_soon(): cfe. のスレッドセーフ版です
                                                       。
                                                       
                                                       
*note loop.call_later(): d00.                          与えられた遅延時間の '経過後' にコールバックを実行し
                                                       ます。
                                                       
                                                       
*note loop.call_at(): d01.                             '与えられた時刻に' コールバックを実行します。
                                                       

Thread/Interpreter/Process Pool
...............................

‘await’ *note loop.run_in_executor(): aea.             CPUバウンドなブロッキング関数、またはその他のブロッ
                                                       キング関数を *note concurrent.futures: 24. 実行オブ
                                                       ジェクト (executor) 上で実行します。
                                                       
                                                       
*note loop.set_default_executor(): 94e.                *note loop.run_in_executor(): aea. のデフォルト実行
                                                       オブジェクト (executor) を設定します。
                                                       

タスクとフューチャー
....................

*note loop.create_future(): e78.                       *note Future: dca. オブジェクトを生成します。
                                                       
                                                       
*note loop.create_task(): 1cc.                         コルーチンを *note Task: 1c9. としてスケジュールしま
                                                       す。
                                                       
                                                       
*note loop.set_task_factory(): 1ca.                    *note loop.create_task(): 1cc. が *note Tasks: 1c9.
                                                       を生成する際に使われるファクトリを設定します。
                                                       
                                                       
*note loop.get_task_factory(): fc9.                    *note loop.create_task(): 1cc. が *note Tasks: 1c9.
                                                       を生成するファクトリを取得します。
                                                       

DNS
...

‘await’ *note loop.getaddrinfo(): e12.                 *note socket.getaddrinfo(): 17c7. の非同期版です。
                                                       
                                                       
‘await’ *note loop.getnameinfo(): e13.                 *note socket.getnameinfo(): 1a9c. の非同期版です。
                                                       

ネットワークとプロセス間通信 (IPC)
..................................

‘await’ *note loop.create_connection(): 818.           TCP接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_server(): d0d.               TCPサーバーを起動します。
                                                       
                                                       
‘await’ *note loop.create_unix_connection(): 389b.     Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_unix_server(): 4ca.          Create a Unix socket server.
                                                       
                                                       
‘await’ *note loop.connect_accepted_socket(): 9e2.     *note socket: fa5. を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       
                                                       
‘await’ *note loop.create_datagram_endpoint(): 940.    データグラム (UDP) 接続を確立します。
                                                       
                                                       
‘await’ *note loop.sendfile(): 3938.                   確立した接続 (transport) を通じてファイルを送信しま
                                                       す。
                                                       
                                                       
‘await’ *note loop.start_tls(): d03.                   既存の接続を TLS にアップグレードします。
                                                       
                                                       
‘await’ *note loop.connect_read_pipe(): 38e2.          パイプの読み出し側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       
                                                       
‘await’ *note loop.connect_write_pipe(): 38e3.         パイプの書き込み側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       

ソケット
........

‘await’ *note loop.sock_recv(): e0f.                   *note socket: fa5. からデータを受信します。
                                                       
                                                       
‘await’ *note loop.sock_recv_into(): d04.              *note socket: fa5. からデータを受信し、バッファに送
                                                       信します。
                                                       
                                                       
‘await’ *note loop.sock_recvfrom(): 81b.               Receive a datagram from the *note socket: fa5.
                                                       
                                                       
‘await’ *note loop.sock_recvfrom_into(): 81c.          Receive a datagram from the *note socket: fa5. into
                                                       a buffer.
                                                       
                                                       
‘await’ *note loop.sock_sendall(): e10.                *note socket: fa5. にデータを送信します。
                                                       
                                                       
‘await’ *note loop.sock_sendto(): 81a.                 Send a datagram via the *note socket: fa5. to the
                                                       given address.
                                                       
                                                       
‘await’ *note loop.sock_connect(): fcc.                *note socket: fa5. を接続します。
                                                       
                                                       
‘await’ *note loop.sock_accept(): e11.                 *note socket: fa5. の接続を受け入れます。
                                                       
                                                       
‘await’ *note loop.sock_sendfile(): d08.               Send a file over the *note socket: fa5.
                                                       
                                                       
*note loop.add_reader(): 38b6.                         ファイル記述子が読み込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_reader(): 393b.                      ファイル記述子が読み込み可能かどうかの監視を停止しま
                                                       す。
                                                       
                                                       
*note loop.add_writer(): 393c.                         ファイル記述子が書き込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_writer(): 393d.                      ファイル記述子が書き込み可能かどうかの監視を停止しま
                                                       す。
                                                       

Unix シグナル
.............

*note loop.add_signal_handler(): 3945.                 *note signal: cb. 用のハンドラーを追加します。
                                                       
                                                       
*note loop.remove_signal_handler(): 3946.              *note signal: cb. 用のハンドラーを削除します。
                                                       

サブプロセス
............

*note loop.subprocess_exec(): 38df.                    サブプロセスを生成します。
                                                       
                                                       
*note loop.subprocess_shell(): 38e0.                   シェルコマンドからサブプロセスを生成します。
                                                       

エラー処理
..........

*note loop.call_exception_handler(): 394a.             例外ハンドラを呼び出します。
                                                       
                                                       
*note loop.set_exception_handler(): 3949.              新しい例外ハンドラーを設定します。
                                                       
                                                       
*note loop.get_exception_handler(): e79.               現在の例外ハンドラーを取得します。
                                                       
                                                       
*note loop.default_exception_handler(): 394b.          デフォルトの例外ハンドラー実装です。
                                                       

使用例
......

   * *note Using asyncio.new_event_loop() and loop.run_forever(): 3956.

   * *note loop.call_later() を使う: 3958.。

   * ‘loop.create_connection()’ を使って *note an echo-client: 38ad. を
     実装する。

   * ‘loop.create_connection()’ を使って *note ソケットに接続する:
     38b4.。

   * *note add_reader()
     を使ってファイルデスクリプタの読み込みイベントを監視する: 38b5.。

   * *note loop.add_signal_handler() を使う: 395b.。

   * *note loop.subprocess_exec() を使う: 38f4.。


File: python.info,  Node: トランスポート<2>,  Next: プロトコル<3>,  Prev: イベントループのメソッド,  Up: 低水準の API インデックス

5.20.1.127 トランスポート
.........................

全てのトランスポートは以下のメソッドを実装します:

*note transport.close(): 3932.                         トランスポートをクローズします。
                                                       
                                                       
*note transport.is_closing(): e77.                     トランスポートを閉じている最中か閉じていた場合
                                                       ‘True’ を返します。
                                                       
                                                       
*note transport.get_extra_info(): c97.                 トランスポートについての情報をリクエストします。
                                                       
                                                       
*note transport.set_protocol(): 3977.                  トランスポートに新しいプロトコルを設定します。
                                                       
                                                       
*note transport.get_protocol(): 3978.                  現在のプロトコルを返します。
                                                       

データを受信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
818, *note loop.create_unix_connection(): 389b, *note
loop.connect_read_pipe(): 38e2. などの戻り値です:

読み込みトランスポート
......................

*note transport.is_reading(): d15.                     トランスポートがデータを受信中の場合 ‘True’ を返しま
                                                       す。
                                                       
                                                       
*note transport.pause_reading(): d17.                  データの受信を停止します。
                                                       
                                                       
*note transport.resume_reading(): d16.                 データの受信を再開します。
                                                       

データを送信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
818, *note loop.create_unix_connection(): 389b, *note
loop.connect_write_pipe(): 38e3. などの戻り値です:

トランスポートにデータを書き込みます。
......................................

*note transport.write(): 1835.                         トランスポートにデータを書き込みます。
                                                       
                                                       
*note transport.writelines(): 1834.                    トランスポートにバッファの内容を書き込みます。
                                                       
                                                       
*note transport.can_write_eof(): 397b.                 トランスポートが 終端 (EOF) の送信をサポートしている
                                                       場合 *note True: e0b. を返します。
                                                       
                                                       
*note transport.write_eof(): 397c.                     バッファに残っているデータをフラッシュしてから終端
                                                       (EOF) を送信して、トランスポートをクローズします。
                                                       
                                                       
*note transport.abort(): 3953.                         トランスポートを即座にクローズします。
                                                       
                                                       
*note transport.get_write_buffer_size(): 397d.         Return the current size of the output buffer.
                                                       
                                                       
*note transport.get_write_buffer_limits(): fc8.        書き込みフロー制御の高水位点と低水位点を取得します。
                                                       
                                                       
*note transport.set_write_buffer_limits(): 397e.       書き込みフロー制御の高水位点と低水位点を設定します。
                                                       

*note loop.create_datagram_endpoint(): 940. が返すトランスポート:

データグラムトランスポート
..........................

*note transport.sendto(): 4cb.                         リモートピアにデータを送信します。
                                                       
                                                       
*note transport.abort(): 3982.                         トランスポートを即座にクローズします。
                                                       

サブプロセスに対するトランスポートの低レベルな抽象化です。 *note
loop.subprocess_exec(): 38df. や *note loop.subprocess_shell(): 38e0. の
戻り値です:

サブプロセス化されたトランスポート
..................................

*note transport.get_pid(): 3984.                       サブプロセスのプロセス ID を返します。
                                                       
                                                       
*note transport.get_pipe_transport(): 3985.            リクエストされた通信パイプ (標準入力 'stdin', 標準出
                                                       力 'stdout', または標準エラー出力 'stderr') のための
                                                       トランスポートを返します。
                                                       
                                                       
*note transport.get_returncode(): 3986.                サブプロセスの終了ステータスを返します。
                                                       
                                                       
*note transport.kill(): 3987.                          サブプロセスを強制終了 (kill) します。
                                                       
                                                       
*note transport.send_signal(): 3989.                   サブプロセスにシグナルを送信します。
                                                       
                                                       
*note transport.terminate(): 3988.                     サブプロセスを停止します。
                                                       
                                                       
*note transport.close(): 398a.                         サブプロセスを強制終了 (kill) し、全てのパイプをクロ
                                                       ーズします。
                                                       


File: python.info,  Node: プロトコル<3>,  Next: イベントループのポリシー,  Prev: トランスポート<2>,  Up: 低水準の API インデックス

5.20.1.128 プロトコル
.....................

プロトコルクラスは以下の 'コールバックメソッド' を実装することができます
:

‘callback’ *note connection_made(): 3930.              コネクションが作成されたときに呼び出されます。
                                                       
                                                       
‘callback’ *note connection_lost(): 3974.              コネクションが失われた、あるいはクローズされたときに
                                                       呼び出されます。
                                                       
                                                       
‘callback’ *note pause_writing(): 397f.                トランスポートのバッファーサイズが最高水位点
                                                       (High-Water Mark) を超えたときに呼び出されます。
                                                       
                                                       
‘callback’ *note resume_writing(): 3980.               トランスポートのバッファーサイズが最低水位点
                                                       (Low-Water Mark) に達したきに呼び出されます。
                                                       

ストリーミングプロトコル (TCP, Unix ソケット, パイプ)
.....................................................

‘callback’ *note data_received(): 1b60.                データを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note eof_received(): 398e.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

バッファリングされたストリーミングプロトコル
............................................

‘callback’ *note get_buffer(): 3990.                   新しい受信バッファを割り当てるために呼び出します。
                                                       
                                                       
‘callback’ *note buffer_updated(): 3991.               受信データによりバッファが更新された場合に呼び出され
                                                       ます。
                                                       
                                                       
‘callback’ *note eof_received(): 3992.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

データグラムプロトコル
......................

‘callback’ *note datagram_received(): 3994.            データグラムを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note error_received(): 3995.               直前の送信あるいは受信が *note OSError: 2c2. を送出
                                                       したときに呼び出されます。
                                                       

サブプロセスプロトコル
......................

‘callback’ *note pipe_data_received(): 1baf.           子プロセスが標準出力 ('stdout') または標準エラー出力
                                                       ('stderr') のパイプにデータを書き込んだときに呼び出
                                                       されます。
                                                       
                                                       
‘callback’ *note pipe_connection_lost(): 3997.         子プロセスと通信するパイプのいずれかがクローズされた
                                                       ときに呼び出されます。
                                                       
                                                       
‘callback’ *note process_exited(): 1bae.               Called when the child process has exited.  It can be
                                                       called before *note pipe_data_received(): 1baf. and
                                                       *note pipe_connection_lost(): 3997. methods.
                                                       


File: python.info,  Node: イベントループのポリシー,  Prev: プロトコル<3>,  Up: 低水準の API インデックス

5.20.1.129 イベントループのポリシー
...................................

ポリシーは *note asyncio.get_event_loop(): 2f4. などの関数の振る舞いを変
更する低レベルなメカニズムです。詳細は *note
ポリシーについてのセクション: 391c. を参照してください。

ポリシーへのアクセス
....................

*note asyncio.get_event_loop_policy(): 314.            プロセス全体にわたる現在のポリシーを返します。
                                                       
                                                       
*note asyncio.set_event_loop_policy(): 315.            新たなプロセス全体にわたるポリシーを設定します。
                                                       
                                                       
*note AbstractEventLoopPolicy: 310.                    ポリシーオブジェクトの基底クラスです。
                                                       


File: python.info,  Node: asyncio での開発,  Next: asyncio and free-threaded Python,  Prev: 低水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.20.1.130 asyncio での開発
...........................

非同期プログラミングは伝統的な "同期的" プログラミングとは異なります。

このページはよくある間違いや落とし穴を列挙し、それらを回避する方法を説明
します。

* Menu:

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


File: python.info,  Node: デバッグモード,  Next: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.20.1.131 デバッグモード
.........................

asyncio はデフォルトで本運用モードで実行されます。いっぽう、開発を容易に
するために asyncio は "デバッグモード" を持っています。

asyncio のデバッグモードを有効化する方法はいくつかあります:

   * *note PYTHONASYNCIODEBUG: 2194. 環境変数の値を ‘1’ に設定する。

   * *note Python 開発モード: 508. を使う。

   * *note asyncio.run(): 2f5. 実行時に ‘debug=True’ を設定する。

   * *note loop.set_debug(): fc5. を呼び出す。

デバッグモードを有効化することに加え、以下も検討してください:

   * *note asyncio ロガー: 39d5. のログレベルを *note logging.DEBUG:
     2139. に設定します。例えばアプリケーションの起動時に以下を実行しま
     す:

          logging.basicConfig(level=logging.DEBUG)

   * *note warnings: 119. モジュールが *note ResourceWarning: 54c. 警告
     を表示するように設定します。やり方のひとつは *note -W: aca.
     ‘default’ コマンドラインオプションを使うことです。

デバッグモードが有効化されたときの動作:

   * スレッドセーフでない asyncio APIs の多く (*note loop.call_soon():
     cfe. や *note loop.call_at(): d01. など) は、誤ったスレッドから呼び
     出されたときに例外を送出します。

   * I/O セレクタが I/O 処理を実行する時間が長すぎる場合、その実行時間が
     記録されます。

   * 実行時間が100ミリ秒を超えるコールバックは記録されます。 "遅い" の判
     断基準となる実行時間の最小値は *note loop.slow_callback_duration:
     394d. 属性で設定できます。


File: python.info,  Node: 並行処理とマルチスレッド処理,  Next: ブロッキングコードの実行,  Prev: デバッグモード,  Up: asyncio での開発

5.20.1.132 並行処理とマルチスレッド処理
.......................................

イベントループはスレッド（典型的にはメインスレッド）内で動作し、すべての
コールバックとタスクをそのスレッド内で実行します。ひとつのタスクがイベン
トループ内で実行される間、他のタスクを同じスレッド内で実行することはでき
ません。タスクが ‘await’ 式を実行すると、実行中のタスクはサスペンドされ
、イベントループは次のタスクを実行します。

別の OS スレッドからのコールバック (*note callback: 2e18.) をスケジュー
ルする場合、 *note loop.call_soon_threadsafe(): cff. メソッドを使ってく
ださい。例:

     loop.call_soon_threadsafe(callback, *args)

ほぼ全ての非同期オブジェクトはスレッドセーフではありませんが、タスクやコ
ールバックの外側で非同期オブジェクトを使うコードが存在しない限り、それが
問題にはなることはほとんどありません。もしそのような目的で低レベルの
asyncio API を呼び出すようなコードを書く必要がある場合、 *note
loop.call_soon_threadsafe(): cff. メソッドを使ってください。例:

     loop.call_soon_threadsafe(fut.cancel)

別の OS スレッドからコルーチンオブジェクトをスケジュールする場合は、
*note run_coroutine_threadsafe(): a86. メソッドを使ってください。
‘run_coroutine_threadsafe()’ は結果にアクセスするための *note
concurrent.futures.Future: 13ce. オブジェクトを返します:

     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(): aea. method can be used with a *note
concurrent.futures.ThreadPoolExecutor: 94d. or *note
InterpreterPoolExecutor: 1d4. to execute blocking code in a different OS
thread without blocking the OS thread that the event loop runs in.

現在のところ、 (たとえば *note multiprocessing: 98. で開始したような) 別
のプロセスからコルーチンやコールバックを直接スケジュールすることはできま
せん。 *note Event loop methods: 3922. 節では、イベントループをブロック
することなくパイプからの読み込みやファイルデスクリプタの監視ができる API
のリストを掲載しています。さらに、 asyncio の *note サブプロセス: 3856.
API はイベントループからプロセスを開始したりプロセスと通信したりする方法
を提供します。 最後に、前述の *note loop.run_in_executor(): aea. メソッ
ドは *note concurrent.futures.ProcessPoolExecutor: 1d8. とともに使用する
ことで、別のプロセス内でコードを実行することもできます。


File: python.info,  Node: ブロッキングコードの実行,  Next: ログ記録<3>,  Prev: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.20.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(): aea. method for more details.


File: python.info,  Node: ログ記録<3>,  Next: 待ち受け処理を伴わないコルーチンの検出,  Prev: ブロッキングコードの実行,  Up: asyncio での開発

5.20.1.134 ログ記録
...................

asyncio は *note logging: 8b. モジュールを利用し、 全てのログ記録は
‘"asyncio"’ ロガーを通じて行われます。

デフォルトのログレベルは *note logging.INFO: 213a. ですが、これは簡単に
調節できます:

     logging.getLogger("asyncio").setLevel(logging.WARNING)

ネットワークログ記録は、イベントループをブロックし得ます。ログ処理のスレ
ッドを分離するか、ノンブロッキング IO を使用することを推奨します。例えば
、 *note ブロックする handler を扱う: 39da. を見てください。


File: python.info,  Node: 待ち受け処理を伴わないコルーチンの検出,  Next: 回収されない例外の検出,  Prev: ログ記録<3>,  Up: asyncio での開発

5.20.1.135 待ち受け処理を伴わないコルーチンの検出
.................................................

コルーチンが呼び出されただけで、待ち受け処理がない場合 (たとえば ‘await
coro()’ のかわりに ‘coro()’ と書いてしまった場合) 、またはコルーチンが
*note asyncio.create_task(): 1cb. を使わずにスケジュールされた場合、
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(): 1cb. 関数を呼び出すことです:

     async def main():
         await test()


File: python.info,  Node: 回収されない例外の検出,  Next: Asynchronous generators best practices,  Prev: 待ち受け処理を伴わないコルーチンの検出,  Up: asyncio での開発

5.20.1.136 回収されない例外の検出
.................................

もし *note Future.set_exception(): e7c. メソッドが呼び出されても、その
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 デバッグモードを有効化して:
2195. トレースバックを取得してください:

     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


File: python.info,  Node: Asynchronous generators best practices,  Prev: 回収されない例外の検出,  Up: asyncio での開発

5.20.1.137 Asynchronous generators best practices
.................................................

Writing correct and efficient asyncio code requires awareness of certain
pitfalls.  This section outlines essential best practices that can save
you hours of debugging.

* Menu:

* Close asynchronous generators explicitly::
* Create asynchronous generators only when the event loop is running::
* Avoid concurrent iteration and closure of the same generator::


File: python.info,  Node: Close asynchronous generators explicitly,  Next: Create asynchronous generators only when the event loop is running,  Up: Asynchronous generators best practices

5.20.1.138 Close asynchronous generators explicitly
...................................................

It is recommended to manually close the *note asynchronous generator:
39e0.  If a generator exits early - for example, due to an exception
raised in the body of an ‘async for’ loop - its asynchronous cleanup
code may run in an unexpected context.  This can occur after the tasks
it depends on have completed, or during the event loop shutdown when the
async-generator's garbage collection hook is called.

To avoid this, explicitly close the generator by calling its *note
aclose(): ad9. method, or use the *note contextlib.aclosing(): 9f2.
context manager:

     import asyncio
     import contextlib

     async def gen():
       yield 1
       yield 2

     async def func():
       async with contextlib.aclosing(gen()) as g:
         async for x in g:
           break  # Don't iterate until the end

     asyncio.run(func())

As noted above, the cleanup code for these asynchronous generators is
deferred.  The following example demonstrates that the finalization of
an asynchronous generator can occur in an unexpected order:

     import asyncio
     work_done = False

     async def cursor():
         try:
             yield 1
         finally:
             assert work_done

     async def rows():
         global work_done
         try:
             yield 2
         finally:
             await asyncio.sleep(0.1) # immitate some async work
             work_done = True


     async def main():
         async for c in cursor():
             async for r in rows():
                 break
             break

     asyncio.run(main())

For this example, we get the following output:

     unhandled exception during asyncio.run() shutdown
     task: <Task finished name='Task-3' coro=<<async_generator_athrow without __name__>()> exception=AssertionError()>
     Traceback (most recent call last):
       File "example.py", line 6, in cursor
         yield 1
     asyncio.exceptions.CancelledError

     During handling of the above exception, another exception occurred:

     Traceback (most recent call last):
       File "example.py", line 8, in cursor
         assert work_done
                ^^^^^^^^^
     AssertionError

The ‘cursor()’ asynchronous generator was finalized before the ‘rows’
generator - an unexpected behavior.

The example can be fixed by explicitly closing the ‘cursor’ and ‘rows’
async-generators:

     async def main():
         async with contextlib.aclosing(cursor()) as cursor_gen:
             async for c in cursor_gen:
                 async with contextlib.aclosing(rows()) as rows_gen:
                     async for r in rows_gen:
                         break
                 break


File: python.info,  Node: Create asynchronous generators only when the event loop is running,  Next: Avoid concurrent iteration and closure of the same generator,  Prev: Close asynchronous generators explicitly,  Up: Asynchronous generators best practices

5.20.1.139 Create asynchronous generators only when the event loop is running
.............................................................................

It is recommended to create *note asynchronous generators: 39e0. only
after the event loop has been created.

To ensure that asynchronous generators close reliably, the event loop
uses the *note sys.set_asyncgen_hooks(): 19fc. function to register
callback functions.  These callbacks update the list of running
asynchronous generators to keep it in a consistent state.

When the *note loop.shutdown_asyncgens(): e7d. function is called, the
running generators are stopped gracefully and the list is cleared.

The asynchronous generator invokes the corresponding system hook during
its first iteration.  At the same time, the generator records that the
hook has been called and does not call it again.

Therefore, if iteration begins before the event loop is created, the
event loop will not be able to add the generator to its list of active
generators because the hooks are set after the generator attempts to
call them.  Consequently, the event loop will not be able to terminate
the generator if necessary.

次に示す例について考えてみてください。:

     import asyncio

     async def agenfn():
         try:
             yield 10
         finally:
             await asyncio.sleep(0)


     with asyncio.Runner() as runner:
         agen = agenfn()
         print(runner.run(anext(agen)))
         del agen

出力:

     10
     Exception ignored while closing generator <async_generator object agenfn at 0x000002F71CD10D70>:
     Traceback (most recent call last):
       File "example.py", line 13, in <module>
         del agen
             ^^^^
     RuntimeError: async generator ignored GeneratorExit

This example can be fixed as follows:

     import asyncio

     async def agenfn():
         try:
             yield 10
         finally:
             await asyncio.sleep(0)

     async def main():
         agen = agenfn()
         print(await anext(agen))
         del agen

     asyncio.run(main())


File: python.info,  Node: Avoid concurrent iteration and closure of the same generator,  Prev: Create asynchronous generators only when the event loop is running,  Up: Asynchronous generators best practices

5.20.1.140 Avoid concurrent iteration and closure of the same generator
.......................................................................

Async generators may be reentered while another *note __anext__(): 2500.
/ *note athrow(): 71d. / *note aclose(): ad9. call is in progress.  This
may lead to an inconsistent state of the async generator and can cause
errors.

Let's consider the following example:

     import asyncio

     async def consumer():
         for idx in range(100):
             await asyncio.sleep(0)
             message = yield idx
             print('received', message)

     async def amain():
         agenerator = consumer()
         await agenerator.asend(None)

         fa = asyncio.create_task(agenerator.asend('A'))
         fb = asyncio.create_task(agenerator.asend('B'))
         await fa
         await fb

     asyncio.run(amain())

出力:

     received A
     Traceback (most recent call last):
       File "test.py", line 38, in <module>
         asyncio.run(amain())
         ~~~~~~~~~~~^^^^^^^^^
       File "Lib/asyncio/runners.py", line 204, in run
         return runner.run(main)
                ~~~~~~~~~~^^^^^^
       File "Lib/asyncio/runners.py", line 127, in run
         return self._loop.run_until_complete(task)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
       File "Lib/asyncio/base_events.py", line 719, in run_until_complete
         return future.result()
                ~~~~~~~~~~~~~^^
       File "test.py", line 36, in amain
         await fb
     RuntimeError: anext(): asynchronous generator is already running

Therefore, it is recommended to avoid using asynchronous generators in
parallel tasks or across multiple event loops.


File: python.info,  Node: asyncio and free-threaded Python,  Prev: asyncio での開発,  Up: asyncio --- 非同期 I/O

5.20.1.141 asyncio and free-threaded Python
...........................................

asyncio uses an event loop as a scheduler to enable highly efficient
concurrency by switching between tasks to allow non-blocking I/O
operations.  This results in better performance for I/O-bound use cases.
It also allows off-loading CPU-bound work to a thread or process pool,
but that is still limited by the *note global interpreter lock: 474. in
CPython.

However, in *note free-threaded Python: 2774, the GIL is disabled and
Python can run true multi-threaded code.  This means that asyncio can
now take advantage of multiple CPU cores without the limitations imposed
by the GIL.

Since Python 3.14, asyncio has first-class support for free-threaded
Python, and the implementation of asyncio is safe to use in a
multi-threaded environment.

A single event loop on one core can handle many connections
concurrently, but the Python code that runs to handle each one still
executes serially.  Once requests involve a non-trivial amount of
per-request computation, that handling becomes the bottleneck, and a
single core can no longer keep up.  Combining asyncio with threads is
most useful here: by running an event loop per thread, the handling of
different requests can run in parallel across multiple CPU cores.  It is
also useful when you need to run blocking or CPU-bound code from an
asyncio application.

参考
....

Scaling asyncio on Free-Threaded Python(1), a blog post by Kumar Aditya
which explains the internal changes that make asyncio safe and efficient
under free-threaded Python, together with benchmarks of the resulting
improvements.

* Menu:

* Thread safety considerations::
* Using asyncio with threads::
* Producer/consumer across threads::

   ---------- Footnotes ----------

   (1) 
https://labs.quansight.org/blog/scaling-asyncio-on-free-threaded-python


File: python.info,  Node: Thread safety considerations,  Next: Using asyncio with threads,  Up: asyncio and free-threaded Python

5.20.1.142 Thread safety considerations
.......................................

While asyncio is designed to be thread-safe in a free-threaded Python
environment, there are still some considerations to keep in mind when
using asyncio with threads:

  1. 'Event loop': Each thread should have its own event loop which
     should not be shared across threads.  This ensures that the event
     loop can manage its own tasks and callbacks without interference
     from other threads.

  2. 'Task management': Tasks and futures created in one thread should
     not be awaited or manipulated from another thread.

  3. 'Thread-safe APIs': When interacting with asyncio from multiple
     threads, it's important to use thread-safe APIs provided by
     asyncio, such as *note asyncio.run_coroutine_threadsafe(): a86. for
     submitting coroutines to an event loop from another thread.  If you
     need to call a callback from a different thread, you can use *note
     loop.call_soon_threadsafe(): cff. to schedule it safely.

  4. 'Synchronization': The synchronization primitives provided by
     asyncio (like *note asyncio.Lock: c6a. and *note asyncio.Event:
     2f6.) are not designed to be used across threads.  If you need to
     synchronize between threads, you should use the synchronization
     primitives from the *note threading: f3. module instead.


File: python.info,  Node: Using asyncio with threads,  Next: Producer/consumer across threads,  Prev: Thread safety considerations,  Up: asyncio and free-threaded Python

5.20.1.143 Using asyncio with threads
.....................................

asyncio supports running one event loop per thread, which allows you to
take advantage of multiple CPU cores in a free-threaded Python
environment.  Each thread can run its own event loop, and tasks can be
scheduled on those loops independently.

Here's an example of how to use asyncio with threads:

     import asyncio
     import threading

     async def worker(name: str) -> None:
         print(f"Worker {name} starting")
         await asyncio.sleep(1)
         print(f"Worker {name} done")

     def run_loop(name: str) -> None:
         asyncio.run(worker(name))

     threads = [
         threading.Thread(target=run_loop, args=(f"T{i}",))
         for i in range(4)
     ]
     for t in threads:
         t.start()
     for t in threads:
         t.join()

In this example, each thread creates its own event loop with *note
asyncio.run(): 2f5. and runs a coroutine on it.  The threads execute
concurrently, and in a free-threaded build they can run on separate CPU
cores in parallel.


File: python.info,  Node: Producer/consumer across threads,  Prev: Using asyncio with threads,  Up: asyncio and free-threaded Python

5.20.1.144 Producer/consumer across threads
...........................................

When a regular (non-asyncio) thread needs to hand work to an asyncio
event loop running in another thread, use a thread-safe primitive such
as *note queue.Queue: 15b0. rather than *note asyncio.Queue: c6e, which
is only safe within a single event loop.:

     import asyncio
     import queue
     import threading

     def producer(q: queue.Queue[int]) -> None:
         for i in range(5):
             print(f"Producing {i}")
             q.put(i)
         q.shutdown()

     async def consumer(q: queue.Queue[int]) -> None:
         while True:
             try:
                 item = q.get_nowait()
             except queue.Empty:
                 await asyncio.sleep(0.1)
                 continue
             except queue.ShutDown:
                 break
             print(f"Consumed {item}")
             await asyncio.sleep(item)

     q: queue.Queue[int] = queue.Queue()
     consumer_thread = threading.Thread(
         target=lambda: asyncio.run(consumer(q))
     )
     consumer_thread.start()
     producer(q)
     consumer_thread.join()

The producer runs on the main thread while the consumer runs inside an
event loop on its own thread, yet they communicate safely through
‘queue.Queue’.  When the queue is empty the consumer sleeps briefly and
tries again.  When the producer is done it calls *note shutdown(): 542,
which causes subsequent *note get_nowait(): 3820. calls to raise *note
queue.ShutDown: 543. so the consumer can exit cleanly.

     注釈: 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.20.2 ‘socket’ -- 低水準ネットワークインターフェース
-----------------------------------------------------

'ソースコード:' Lib/socket.py(1)

__________________________________________________________________

このモジュールはBSDの 'ソケット(socket)' インターフェイスへのアクセスを
提供します。これは、近代的なUnixシステム、Windows、MacOS、その他多くのプ
ラットフォームで動作します。

     注釈: いくつかの挙動はプラットフォームに依存します。オペレーティン
     グシステムのソケットAPIを呼び出しているためです。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

Pythonインターフェースは、Unixのソケット用システムコールとライブラリイン
ターフェースを、そのままPythonのオブジェクト指向スタイルに変換したもので
す。各種ソケット関連のシステムコールは、 *note socket(): fa5. 関数で生成
される 'socket オブジェクト' のメソッドとして実装されています。 メソッド
の引数は C のインターフェイスよりも多少高水準で、例えばファイルに対する
‘read()’ や ‘write()’ メソッドと同様に、 受信時のバッファ確保は自動的に
処理され、送信時のバッファ長は暗黙的に決まります。

参考
....

Module *note socketserver: d2.

     ネットワークサーバの開発を省力化するためのクラス群。

Module *note ssl: d5.

     ソケットオブジェクトに対する TLS/SSL ラッパー.

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/socket.py


File: python.info,  Node: ソケットファミリー,  Next: モジュールの内容<2>,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.1 ソケットファミリー
...........................

どのシステムで実行するかとビルドオプションに依存しますが、このモジュール
によって多様なソケットファミリーをサポートします。

特定のソケットオブジェクトによって必要とされるアドレスフォーマットは、ソ
ケットオブジェクトが生成されたときに指定されたアドレスファミリーを元に自
動的に選択されます。ソケットアドレスは次の通りです。

   - ファイルシステム上のノードに束縛された *note AF_UNIX: 1c0d. ソケッ
     トのアドレスは、ファイルシステムエンコーディングと
     ‘'surrogateescape'’ エラーハンドラ ( PEP 383(1) を参照) を使って文
     字列として表現されます。 Linux の抽象名前空間のアドレスは、先頭が
     null バイトとなる *note bytes-like object: 194. として返されます。
     この名前空間のソケットは通常のファイルシステム上のソケットと通信で
     きるので、 Linux 上で動作することを意図したプログラムは両方のアドレ
     スを扱う必要がある可能性があります。文字列と bytes-like オブジェク
     トはどちらのタイプのアドレスにも引数として渡すことができます。

     バージョン 3.3 で変更: これまでは *note AF_UNIX: 1c0d. ソケットパス
     は UTF-8 エンコーディングを使用するものとされていました。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 194.
     を使用できるようになりました。

   - *note AF_INET: 1c0a. アドレスファミリーには、 ‘(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: 1c0b. 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: 39f0. アドレスファミリーには ‘(interface, )’ というタ
     プルを利用します。 'interface' は ‘'can0'’ のようなネットワークイン
     ターフェース名を表す文字列です。このファミリーの全てのネットワーク
     インターフェースからパケットを受信するために、ネットワークインター
     フェース名 ‘''’ を利用できます。

        - *note CAN_ISOTP: 39f1. 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: b30. 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: 1c0c. は以下のプロトコルとアドレスフォーマット
     をサポートしています。

        - *note BTPROTO_L2CAP: 285. 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: 39f2. (default),
               *note BDADDR_LE_PUBLIC: 39f3, *note BDADDR_LE_RANDOM:
               39f4.

          バージョン 3.14 で変更: Added ‘cid’ and ‘bdaddr_type’ fields.

        - *note BTPROTO_RFCOMM: 39f5. は ‘(bdaddr, channel)’ を受け取り
          ます。 ‘bdaddr’ は Bluetooth アドレスを表す文字列で、
          ‘channel’ は整数です。

        - *note BTPROTO_HCI: 283. 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: 39f6. 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: 284. accepts ‘bdaddr’ where ‘bdaddr’ is the
          Bluetooth address as a string or a *note bytes: 193. object.
          (ex.  ‘'12:23:34:45:56:67'’ or ‘b'12:23:34:45:56:67'’)

          バージョン 3.14 で変更: FreeBSD support added.

   - *note AF_ALG: ed6. はカーネル暗号へのソケットベースのインターフェイ
     スで、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: 2199.: Linux >= 2.6.38.

     一部のアルゴリズムタイプでは、さらに新しいカーネルが必要です。

     Added in version 3.6.

   - *note AF_VSOCK: d71. 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: 2199.: Linux >= 3.9

     See ‘vsock(7)(2)’

     Added in version 3.7.

   - *note AF_PACKET: 39f7. 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: 1b82. to capture all protocols, one of the *note
          ETHERTYPE_* constants: 1b83. 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: 2199.: Linux >= 2.2.

   - *note AF_QIPCRTR: 39f8. 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: 2199.: 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: 2199.: Linux >= 2.6.20, FreeBSD >= 10.1

     Added in version 3.9.

   - *note AF_HYPERV: 39f9. 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: 2c2.
またはそのサブクラスが発生します。

*note setblocking(): 30bd. メソッドで、非ブロッキングモードを使用するこ
とができます。また、より汎用的に *note settimeout(): 39fa. メソッドでタ
イムアウトを指定する事ができます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/

   (2) https://manpages.debian.org/vsock(7)


File: python.info,  Node: モジュールの内容<2>,  Next: socket オブジェクト,  Prev: ソケットファミリー,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.2 モジュールの内容
.........................

The module ‘socket’ exports the following elements.

* Menu:

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


File: python.info,  Node: 例外<18>,  Next: 定数<8>,  Up: モジュールの内容<2>

5.20.2.3 例外
.............

 -- 例外: socket.error

     *note OSError: 2c2. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c2. のエイリアスになりました。

 -- 例外: socket.herror

     *note OSError: 2c2. のサブクラス。この例外はアドレス関連のエラー、
     つまり *note gethostbyname_ex(): 1ce1. と *note gethostbyaddr():
     1ce0. などの、 POSIX C API の 'h_errno' を利用する関数のために利用
     されます。例外に付随する ‘(h_errno, string)’ ペアはライブラリの呼び
     出しによって返されたエラーを表します。 'h_errno' は数値で、
     'string' は、 ‘hstrerror()’ C関数によって返される 'h_errno' を説明
     する文字列です。

     バージョン 3.3 で変更: このクラスは *note OSError: 2c2. のサブクラ
     スになりました。

 -- 例外: socket.gaierror

     A subclass of *note OSError: 2c2, this exception is raised for
     address-related errors by *note getaddrinfo(): 17c7. and *note
     getnameinfo(): 1a9c.  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: 2c2. のサブクラ
     スになりました。

 -- 例外: socket.timeout

     *note TimeoutError: a3a. の非推奨のエイリアスです。

     *note OSError: 2c2. のサブクラスです。この例外は、あらかじめ *note
     settimeout(): 39fa. を呼び出して (あるいは *note
     setdefaulttimeout(): 39fe. を利用して暗黙に) タイムアウトを有効にし
     てあるソケットでタイムアウトが生じた際に送出されます。 例外に付属す
     る値は文字列で、その内容は現状では常に "timed out" となります。

     バージョン 3.3 で変更: このクラスは *note OSError: 2c2. のサブクラ
     スになりました。

     バージョン 3.10 で変更: このクラスは *note TimeoutError: a3a. のエ
     イリアスになりました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: 定数<8>,  Next: 関数<8>,  Prev: 例外<18>,  Up: モジュールの内容<2>

5.20.2.4 定数
.............

AF_* 定数と SOCK_* 定数は、 ‘AddressFamily’ と ‘SocketKind’ *note
IntEnum: edf. 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(): fa5.  If the *note
     AF_UNIX: 1c0d. constant is not defined then this protocol is
     unsupported.  More constants may be available depending on the
     system.

 -- データ: socket.AF_UNSPEC

     *note AF_UNSPEC: 3936. means that *note getaddrinfo(): 17c7. 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(): fa5.  More constants may be available
     depending on the system.  (Only *note SOCK_STREAM: 150f. and *note
     SOCK_DGRAM: 150e. appear to be generally useful.)

 -- データ: socket.SOCK_CLOEXEC
 -- データ: socket.SOCK_NONBLOCK

     この2つの定数が定義されていた場合、ソケットタイプと組み合わせていく
     つかの flags をアトミックに設定することができます (別の呼び出しを不
     要にして競合状態を避ける事ができます)。

     参考
     ....

     より完全な説明は Secure File Descriptor Handling(1) を参照してくだ
     さい。

     *note Availability: 2199.: 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(): ed5. and *note getsockopt(): ed4. 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: FreeBSD >= 14.0.

     Added in version 3.12.

 -- データ: socket.AF_PACKET
 -- データ: socket.PF_PACKET

 -- データ: PACKET_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 2199.: Linux >= 2.2.

 -- データ: socket.ETH_P_ALL

     ‘ETH_P_ALL’ can be used in the *note socket: fa5. constructor as
     'proto' for the *note AF_PACKET: 39f7. family in order to capture
     every packet, regardless of protocol.

     For more information, see the ‘packet(7)(2)’ manpage.

     *note Availability: 2199.: Linux.

     Added in version 3.12.

 -- データ: socket.AF_RDS
 -- データ: socket.PF_RDS
 -- データ: socket.SOL_RDS

 -- データ: RDS_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 2199.: 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(): ed2. メソッドに引数として渡されます。

     バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されました。

 -- データ: TIPC_*

     TIPC 関連の定数で、C のソケットAPIが公開しているものにマッチします
     。詳しい情報は TIPC のドキュメントを参照してください。

 -- データ: socket.AF_ALG
 -- データ: socket.SOL_ALG

 -- データ: ALG_*

     Linux カーネル暗号用の定数です。

     *note Availability: 2199.: 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: 2199.: Linux >= 4.8.

     Added in version 3.7.

 -- データ: socket.AF_LINK

     *note Availability: 2199.: 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: 3a0f. を使用すると、 *note
     BTPROTO_RFCOMM: 39f5. で束縛ソケットを指定する際に、任意のアドレス
     を指し示すことができます。

 -- データ: 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: 285. socket.

     *note Availability: 2199.: 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(): ed5. and
     *note getsockopt(): ed4. methods of Bluetooth socket objects.

     *note SOL_BLUETOOTH: 3a15. 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(): ed5. and *note getsockopt(): ed4. methods of
     Bluetooth socket objects.

     ‘BT_*’ and *note L2CAP_LM: 3a16. 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: 283.  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: 2199.: 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: 283.
     address.

     *note Availability: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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: 2199.: 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(): 3a37. method of
     socket objects.

     *note Availability: 2199.: 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: モジュールの内容<2>

5.20.2.5 関数
.............

* Menu:

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


File: python.info,  Node: ソケットの作成,  Next: その他の関数<2>,  Up: 関数<8>

5.20.2.6 ソケットの作成
.......................

以下の関数は全て *note socket object: 3a3a. を生成します。

The *note socket: fa5. class constructor creates a new socket directly;
see *note socket オブジェクト: 3a3a. for its parameters and full
description.

 -- の関数: 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(): fa5.
     function.  The default family is *note AF_UNIX: 1c0d. if defined on
     the platform; otherwise, the default is *note AF_INET: 1c0a.

     新たに作成されたソケットは *note 継承不可: 1100. です。

     バージョン 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(): fa7. を高級にした関数です。 'host' が数値でないホ
     スト名の場合、 *note AF_INET: 1c0a. と *note AF_INET6: 1c0b. の両方
     で名前解決を試み、得られた全てのアドレスに対して成功するまで接続を
     試みます。この関数を使って IPv4 と IPv6 に両対応したクライアントを
     簡単に書くことができます。

     オプションの 'timeout' 引数を指定すると、接続を試みる前にソケットオ
     ブジェクトのタイムアウトを設定します。 'timeout' が指定されない場合
     、 *note getdefaulttimeout(): 3a3b. が返すデフォルトのタイムアウト
     設定値を利用します。

     '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: 1c0a. or *note AF_INET6:
     1c0b.  'backlog' is the queue size passed to *note socket.listen():
     1062.; 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: 1c0b. and
     the platform supports it the socket will be able to accept both
     IPv4 and IPv6 connections, else it will raise *note ValueError:
     2ee.  Most POSIX platforms and Windows are supposed to support this
     functionality.  When this functionality is enabled the address
     returned by *note socket.getpeername(): 3975. 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(): c25.:

          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(): 181b. method) and build a socket
     object from the result.  Address family, socket type and protocol
     number are as for the *note socket(): fa5. function.  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 継承不可: 1100. です。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

 -- の関数: socket.fromshare (data)

     *note socket.share(): e06. メソッドから取得した data からソケットオ
     ブジェクトを生成します。ソケットはブロッキングモードだと仮定されま
     す。

     *note Availability: 2199.: Windows.

     Added in version 3.3.


File: python.info,  Node: その他の関数<2>,  Prev: ソケットの作成,  Up: 関数<8>

5.20.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():
     d6f, but for sockets.  On some platforms (most notably Windows)
     ‘os.close()’ 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:
     3936, 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(): fa5. 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: 1c0a, a ‘(address,
     port, flowinfo, scope_id)’ 4-tuple for *note AF_INET6: 1c0b.), and
     is meant to be passed to the *note socket.connect(): fa7. 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: 150f. or *note SOCK_DGRAM: 150e.) 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
     監査イベント: 1ccb. ‘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(): 1ce0. 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():
     30a6. is returned.

 -- の関数: socket.gethostbyname (hostname)

     ホスト名を ‘'100.50.200.5'’ のようなIPv4形式のアドレスに変換します
     。ホスト名としてIPv4アドレスを指定した場合、その値は変換せずにその
     まま返ります。 *note gethostbyname(): 3a3e. APIへのより完全なインタ
     ーフェイスが必要であれば、 *note gethostbyname_ex(): 1ce1. を参照し
     てください。 ‘gethostbyname()’ は、IPv6名前解決をサポートしていませ
     ん。IPv4/ v6のデュアルスタックをサポートする場合は *note
     getaddrinfo(): 17c7. を使用します。

     引数 ‘hostname’ を指定して *note 監査イベント: 1ccb.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 2199.: 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).
     ‘gethostbyname_ex()’ does not support IPv6 name resolution, and
     *note getaddrinfo(): 17c7. should be used instead for IPv4/v6 dual
     stack support.

     引数 ‘hostname’ を指定して *note 監査イベント: 1ccb.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 2199.: not WASI.

 -- の関数: socket.gethostname ()

     Pythonインタープリタを現在実行しているマシンのホスト名を含む文字列
     を返します。

     引数無しで *note 監査イベント: 1ccb. ‘socket.gethostname’ を送出し
     ます。

     注意: *note gethostname(): 30a6. は完全修飾ドメイン名を返すとは限り
     ません。完全修飾ドメイン名が必要であれば、*note getfqdn(): 1b4c. を
     使用してください。

     *note Availability: 2199.: 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(): 1b4c.
     ‘gethostbyaddr()’ supports both IPv4 and IPv6.

     引数 ‘ip_address’ を指定して *note 監査イベント: 1ccb.
     ‘socket.gethostbyaddr’ を送出します。

     *note Availability: 2199.: 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 監査イベント: 1ccb.
     ‘socket.getnameinfo’ を送出します。

     *note Availability: 2199.: 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(): fa5. function.  This is usually only needed for
     sockets opened in "raw" mode (*note SOCK_RAW: 3a00.); for the
     normal socket modes, the correct protocol is chosen automatically
     if the protocol is omitted or zero.

     *note Availability: 2199.: not WASI.

 -- の関数: socket.getservbyname (servicename[, protocolname])

     インターネットサービス名とプロトコルから、そのサービスのポート番号
     を取得します。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ の
     どちらかを指定することができます。指定がなければどちらのプロトコル
     にもマッチします。

     引数 ‘servicename’, ‘protocolname’ を指定して *note 監査イベント:
     1ccb. ‘socket.getservbyname’ を送出します。

     *note Availability: 2199.: not WASI.

 -- の関数: socket.getservbyport (port[, protocolname])

     インターネットポート番号とプロトコル名から、サービス名を取得します
     。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ のどちらかを指
     定することができます。指定がなければどちらのプロトコルにもマッチし
     ます。

     引数 ‘port’, ‘protocolname’ を指定して *note 監査イベント: 1ccb.
     ‘socket.getservbyport’ を送出します。

     *note Availability: 2199.: not WASI.

 -- の関数: socket.ntohl (x)

     32ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は4バイトのスワップを行います。

 -- の関数: socket.ntohs (x)

     16ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は2バイトのスワップを行います。

     バージョン 3.10 で変更: Raises *note OverflowError: a85. 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: a85. 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(): b5e. はドットが 3 個以下の文字列も受け取ります;
     詳細については Unix のマニュアル ‘inet(3)(3)’ を参照してください。

     IPv4アドレス文字列が不正であれば、 *note OSError: 2c2. が発生します
     。このチェックは、この関数で使用しているCの実装 ‘inet_aton()’ で行
     われます。

     *note inet_aton(): b5e. は、IPv6をサポートしません。IPv4/v6のデュア
     ルスタックをサポートする場合は *note inet_pton(): b5f. を使用します
     。

 -- の関数: socket.inet_ntoa (packed_ip)

     32 ビットにパックされた IPv4 アドレス (長さ 4 バイトの *note
     bytes-like object: 194.) を、標準的なドット記法による 4 桁の文字列
     ('123.45.67.89' など) に変換します。この関数は、‘in_addr’ 型、つま
     りこの関数が引数として受け取る 32 ビットにパックされたバイナリデー
     タに対する C の型、を使用する標準 C ライブラリのプログラムとやりと
     りする場合に便利です。

     この関数に渡すバイトシーケンスの長さが4バイト以外であれば、 *note
     OSError: 2c2. が発生します。 *note inet_ntoa(): 3a44. は、IPv6をサ
     ポートしません。IPv4/v6のデュアルスタックをサポートする場合は *note
     inet_ntop(): 11ab. を使用します。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 194.
     を使用できるようになりました。

 -- の関数: socket.inet_pton (address_family, ip_string)

     IPアドレスを、アドレスファミリ固有の文字列からパックしたバイナリ形
     式に変換します。 *note inet_pton(): b5f. は、 ‘in_addr’ 型 (*note
     inet_aton(): b5e. と同様)や ‘in6_addr’ を使用するライブラリやネット
     ワークプロトコルを呼び出す際に使用することができます。

     現在サポートされている 'address_family' は、 *note AF_INET: 1c0a. と
     *note AF_INET6: 1c0b. です。 'ip_string' に不正なIPアドレス文字列を
     指定すると、 *note OSError: 2c2. が発生します。有効な 'ip_string' は
     、 'address_family' と ‘inet_pton()’ の実装によって異なります。

     *note Availability: 2199.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

 -- の関数: socket.inet_ntop (address_family, packed_ip)

     パックしたIPアドレス (数バイトからなる *note bytes-like
     オブジェクト: 194. ) を、 ‘'7.10.0.5'’ や ‘'5aef:2b::8'’ などの標準
     的な、アドレスファミリ固有の文字列形式に変換します。 *note
     inet_ntop(): 11ab. は (*note inet_ntoa(): 3a44. と同様に)、
     ‘in_addr’ 型や ‘in6_addr’ 型のオブジェクトを返すライブラリやネット
     ワークプロトコル等で使用することができます。

     現在サポートされている 'address_family' の値は、 *note AF_INET:
     1c0a. と *note AF_INET6: 1c0b. です。バイトオブジェクトの
     'packed_ip' の長さが、指定したアドレスファミリで適切な長さでない場
     合、 *note ValueError: 2ee. が発生します。 *note inet_ntop(): 11ab.
     の呼び出しでエラーが起こると、 *note OSError: 2c2. が発生します。

     *note Availability: 2199.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 194.
     を使用できるようになりました。

 -- の関数: socket.CMSG_LEN (length)

     指定された 'length' にある制御メッセージ（CMSG）から、末尾のパディ
     ングを除いた全体の長さを返します。この値は多くの場合、 *note
     recvmsg(): faa. が制御メッセージの一連の要素を受信するためのバッフ
     ァサイズとして使用できますが、バッファの末尾が要素である場合であっ
     てもパディングは含まれるので、バッファサイズを取得するには RFC
     3542(4) で求められているように、 *note CMSG_SPACE(): 1e73. を使用し
     た移植可能なアプリケーションが必要です。通常 'length' は定数であり
     、許容範囲外の値が指定された場合は *note OverflowError: a85. 例外が
     送出されます。

     *note Availability: 2199.: Unix, not WASI.

     Unix プラットフォーム。

     Added in version 3.3.

 -- の関数: socket.CMSG_SPACE (length)

     指定された 'length' の制御メッセージ（CMSG）の要素を *note
     recvmsg(): faa. が受信するために必要な、パディングを含めたバッファ
     サイズを返します。複数の項目を受信するために必要なバッファスペース
     は、 *note CMSG_SPACE(): 1e73. が返すそれぞれの要素の長さの合計です
     。通常 'length' は定数であり、許容範囲外の値が指定された場合は
     *note OverflowError: a85. 例外が送出されます。

     一部のシステムではこの関数を提供せずに制御メッセージをサポートする
     可能性があることに注意してください。また、この関数の返り値を使用し
     て設定するバッファサイズは、受信する制御メッセージの量を正確に規定
     しないことがあり、その後に受信するデータがパディング領域に合う場合
     があることに注意してください。

     *note Availability: 2199.: Unix, not WASI.

     most Unix platforms.

     Added in version 3.3.

 -- の関数: socket.getdefaulttimeout ()

     新規に生成されたソケットオブジェクトの、デフォルトのタイムアウト値
     を浮動小数点形式の秒数で返します。タイムアウトを使用しない場合には
     ‘None’ を返します。最初に socket モジュールがインポートされた時の初
     期値は ‘None’ です。

 -- の関数: socket.setdefaulttimeout (timeout)

     Set the default timeout in seconds (float) for new socket objects.
     When the socket module is first imported, the default is ‘None’.
     See *note settimeout(): 39fa. for possible values and their
     respective meanings.

 -- の関数: socket.sethostname (name)

     マシンのホスト名を 'name' に設定します。必要な権限がない場合は
     *note OSError: 2c2. を送出します。

     引数 ‘name’ を指定して *note 監査イベント: 1ccb.
     ‘socket.sethostname’ を送出します。

     *note Availability: 2199.: Unix, not Android.

     Added in version 3.3.

 -- の関数: socket.if_nameindex ()

     ネットワークインターフェース情報 (index int, name string)のタプルを
     返します。システムコールが失敗した場合、 *note OSError: 2c2. 例外を
     送出します。

     *note Availability: 2199.: 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: 2c2. 例外を送出します。

     *note Availability: 2199.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     c26.

 -- の関数: socket.if_indextoname (if_index)

     インターフェースインデックス番号 'if_index' に対応するネットワーク
     インターフェース名を返します。対応するインターフェースが存在しない
     場合は *note OSError: 2c2. 例外を送出します。

     *note Availability: 2199.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     c26.

 -- の関数: socket.send_fds (sock, buffers, fds[, flags[, address]])

     Send the list of file descriptors 'fds' over an *note AF_UNIX:
     1c0d. socket 'sock'.  The 'fds' parameter is a sequence of file
     descriptors.  Consult *note sendmsg(): 6a1. for the documentation
     of these parameters.

     *note Availability: 2199.: 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:
     1c0d. socket 'sock'.  Return ‘(msg, list(fds), flags, addr)’.
     Consult *note recvmsg(): faa. for the documentation of these
     parameters.

     *note Availability: 2199.: Unix, not WASI.

     Unix platforms supporting *note recvmsg(): faa. 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: モジュールの内容<2>,  Up: socket --- 低水準ネットワークインターフェース

5.20.2.8 socket オブジェクト
............................

 -- クラス: socket.socket (family=AF_INET, type=SOCK_STREAM, proto=0,
          fileno=None)

     アドレスファミリー、ソケットタイプ、プロトコル番号を指定してソケッ
     トを作成します。アドレスファミリーには *note AF_INET: 1c0a. (デフォ
     ルト値), *note AF_INET6: 1c0b, *note AF_UNIX: 1c0d, *note AF_CAN:
     39f0, *note AF_PACKET: 39f7, *note AF_RDS: 3a07. を指定することがで
     きます。ソケットタイプには *note SOCK_STREAM: 150f. (デフォルト値),
     *note SOCK_DGRAM: 150e, *note SOCK_RAW: 3a00. または他の ‘SOCK_’ 定
     数の何れかを指定します。プロトコル番号は通常省略するか、または0を指
     定しますが、アドレスファミリーに ‘AF_CAN’ を指定した場合は、プロト
     コル番号には const:‘CAN_RAW’, *note CAN_BCM: 11a9, *note CAN_ISOTP:
     39f1, *note CAN_J1939: b30. のいずれかを指定すべきです。

     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(): 3975. but not the actual OS resource.  Unlike
     *note socket.fromfd(): 3a3c, 'fileno' will return the same socket
     and not a duplicate.  This may help close a detached socket using
     *note socket.close(): d6e.

     新たに作成されたソケットは *note 継承不可: 1100. です。

     引数 ‘self’, ‘family’, ‘type’, ‘protocol’ 付きで *note
     監査イベント: 1ccb. ‘socket.__new__’ を送出します。

     バージョン 3.3 で変更: AF_CAN, AF_RDS ファミリーが追加されました。

     バージョン 3.4 で変更: CAN_BCMプロトコルが追加されました。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

     バージョン 3.7 で変更: CAN_ISOTP プロトコルが追加されました。

     バージョン 3.7 で変更: When *note SOCK_NONBLOCK: e08. or *note
     SOCK_CLOEXEC: e09. bit flags are applied to 'type' they are
     cleared, and *note socket.type: e0a. 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 プロトコルが追加されました。

     ソケットオブジェクトは以下のメソッドを持ちます。 *note makefile():
     13bb. 以外のメソッドは、Unixのソケット用システムコールに対応してい
     ます。

     バージョン 3.2 で変更: *note context manager: 1e3. プロトコルのサポ
     ートが追加されました。コンテキストマネージャを終了することは、
     *note close(): d6e. を呼ぶことと同一です。

      -- メソッド: accept ()

          接続を受け付けます。ソケットはアドレスにbind済みで、listen中で
          ある必要があります。戻り値は ‘(conn, address)’ のペアで、
          'conn' は接続を通じてデータの送受信を行うための '新しい' ソケ
          ットオブジェクト、 'address' は接続先でソケットにbindしている
          アドレスを示します。

          新たに作成されたソケットは *note 継承不可: 1100. です。

          バージョン 3.4 で変更: ソケットが *note 継承不可: 1100. になり
          ました。

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(1) を参照し
          てください)。

      -- メソッド: bind (address)

          Bind the socket to 'address'.  The socket must not already be
          bound.  The format of 'address' depends on the address family
          -- see *note ソケットファミリー: 39ed.

          引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1ccb.
          ‘socket.bind’ を送出します。

          *note Availability: 2199.: not WASI.

      -- メソッド: close ()

          Mark the socket closed.  The underlying system resource (e.g.
          a file descriptor) is also closed when all file objects from
          *note makefile(): 13bb. 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(): d6e. するか、 *note with: 187. 文
          の中でソケットを使うことを推奨します。

          バージョン 3.6 で変更: *note OSError: 2c2. is now raised if an
          error occurs when the underlying ‘close()’ call is made.

               注釈: ‘close()’ 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(): 3a37. before
               ‘close()’.

      -- メソッド: connect (address)

          Connect to a remote socket at 'address'.  The format of
          'address' depends on the address family -- see *note
          ソケットファミリー: 39ed.

          If the connection is interrupted by a signal, the method waits
          until the connection completes, or raises a *note
          TimeoutError: a3a. 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: f8c. exception if the connection is
          interrupted by a signal (or the exception raised by the signal
          handler).

          引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1ccb.
          ‘socket.connect’ を送出します。

          バージョン 3.5 で変更: このメソッドは、接続が信号によって中断
          され、信号ハンドラが例外を送出せず、ソケットがブロックであるか
          タイムアウトが設定されている場合、*note InterruptedError:
          f8c. 例外を送出する代わりに、接続を完了するまで待機するように
          なりました (論拠については PEP 475(2) を参照してください)。

          *note Availability: 2199.: not WASI.

      -- メソッド: connect_ex (address)

          Like ‘connect(address)’, but return an error indicator instead
          of raising an exception for errors returned by the C-level
          ‘connect()’ call (other problems, such as "host not found,"
          can still raise exceptions).  The error indicator is ‘0’ if
          the operation succeeded, otherwise the value of the ‘errno’
          variable.  This is useful to support, for example,
          asynchronous connects.

          引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1ccb.
          ‘socket.connect’ を送出します。

          *note Availability: 2199.: not WASI.

      -- メソッド: detach ()

          実際にファイル記述子を閉じることなく、ソケットオブジェクトを閉
          じた状態にします。ファイル記述子は返却され、他の目的に再利用す
          ることができます。

          Added in version 3.2.

      -- メソッド: dup ()

          ソケットを複製します。

          新たに作成されたソケットは *note 継承不可: 1100. です。

          バージョン 3.4 で変更: ソケットが *note 継承不可: 1100. になり
          ました。

          *note Availability: 2199.: not WASI.

      -- メソッド: fileno ()

          ソケットのファイル記述子を短い整数型で返します。失敗時には、-1
          を返します。ファイル記述子は、 *note select.select(): fa4. な
          どで使用します。

          Windowsではこのメソッドで返された小整数をファイル記述子を扱う
          箇所 (*note os.fdopen(): 23dd. など) で利用できません。 Unix に
          はこの制限はありません。

      -- メソッド: get_inheritable ()

          ソケットのファイル記述子またはソケットのハンドルの *note
          継承可能フラグ: 1100. を取得します。ソケットが子プロセスへ継承
          可能なら ‘True’ 、継承不可なら ‘False’ を返します。

          Added in version 3.4.

      -- メソッド: getpeername ()

          Return the remote address to which the socket is connected.
          This is useful to find out the port number of a remote IPv4/v6
          socket, for instance.  The format of the address returned
          depends on the address family -- see *note ソケットファミリー:
          39ed.  On some systems this function is not supported.

      -- メソッド: getsockname ()

          Return the socket's own address.  This is useful to find out
          the port number of an IPv4/v6 socket, for instance.  The
          format of the address returned depends on the address family
          -- see *note ソケットファミリー: 39ed.

      -- メソッド: 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.: d70.) 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: 2199.: not WASI.

      -- メソッド: 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.

      -- メソッド: gettimeout ()

          ソケットに指定されたタイムアウト値を取得します。タイムアウト値
          が設定されている場合には浮動小数点型で秒数が、設定されていなけ
          れば ‘None’ が返ります。この値は、最後に呼び出された *note
          setblocking(): 30bd. または *note settimeout(): 39fa. によって
          設定されます。

      -- メソッド: ioctl (control, option)

          *note ioctl(): ed2. メソッドは WSAIoctl システムインターフェー
          スへの制限されたインターフェースです。詳しい情報については、
          Win32 documentation(4) を参照してください。

          他のプラットフォームでは一般的な *note fcntl.fcntl(): 18b6. と
          *note fcntl.ioctl(): 1699. が使われるでしょう; これらの関数は
          第 1 引数としてソケットオブジェクトを取ります。

          現在、以下のコントロールコードのみがサポートされています。
          ‘SIO_RCVALL’, ‘SIO_KEEPALIVE_VALS’, ‘SIO_LOOPBACK_FAST_PATH’。

          *note Availability: 2199.: Windows

          バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されまし
          た。

      -- メソッド: listen ([backlog])

          サーバーを有効にして、接続を受け付けるようにします。'backlog'
          が指定されている場合、少なくとも 0 以上でなければなりません (そ
          れより低い場合、0 に設定されます)。システムが新しい接続を拒否
          するまでに許可する未受付の接続の数を指定します。指定しない場合
          、デフォルトの妥当な値が選択されます。

          *note Availability: 2199.: not WASI.

          バージョン 3.5 で変更: 'backlog' 引数が任意になりました。

      -- メソッド: makefile (mode='r', buffering=None, *, encoding=None,
               errors=None, newline=None)

          Return a *note file object: 13df. associated with the socket.
          The exact returned type depends on the arguments given to
          *note makefile(): 13bb.  These arguments are interpreted the
          same way as by the built-in *note open(): 318. function,
          except the only supported 'mode' values are ‘'r'’ (default),
          ‘'w'’, ‘'b'’, or a combination of those.

          ソケットはブロッキングモードでなければなりません。タイムアウト
          を設定することはできますが、タイムアウトが発生すると、ファイル
          オブジェクトの内部バッファが矛盾した状態になることがあります。

          *note makefile(): 13bb. でファイルオブジェクトにソケットを関連
          づけた場合、ソケットを閉じるには、関連づけられたすべてのファイ
          ルオブジェクトを閉じたあとで、元のソケットの *note
          socket.close(): d6e. を呼び出さなければなりません。

               注釈: Windows では *note subprocess.Popen(): 4b7. の
               stream 引数などファイルディスクリプタつき file オブジェク
               トが期待されている場所では、 *note makefile(): 13bb. によ
               って作成される file-like オブジェクトは使用できません。

      -- メソッド: 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: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(6) を参照し
          てください)。

      -- メソッド: recvfrom (bufsize[, flags])

          Receive data from the socket.  The return value is a pair
          ‘(bytes, address)’ where 'bytes' is a bytes object
          representing the data received and 'address' is the address of
          the socket sending the data.  See the Unix manual page
          ‘recv(2)(7)’ for the meaning of the optional argument 'flags';
          it defaults to zero.  The format of 'address' depends on the
          address family -- see *note ソケットファミリー: 39ed.

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については 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(): 1a9c.

      -- メソッド: recvmsg (bufsize[, ancbufsize[, flags]])

          ソケットから通常のデータ (最大 'bufsize' バイト) と補助的なデ
          ータを受信します。'ancbufsize' 引数により、補助的なデータの受
          信に使用される内部バッファのバイト数として、サイズが設定されま
          す。このデフォルトは 0 で、補助的なデータを受信しないことを意
          味します。*note CMSG_SPACE(): 1e73. または *note CMSG_LEN():
          1e74. を使用して、補助的なデータの適切なサイズを計算することが
          でき、バッファ内に収まらないアイテムは、短縮されるか破棄されま
          す。'flags' 引数はデフォルトでは 0 で、*note recv(): fa8. での
          意味と同じ意味を持ちます。

          戻り値は 4 要素のタプル ‘(data, ancdata, msg_flags, address)’
          です。'data' アイテムは、受信した非付属的データを保持する
          *note bytes: 193. オブジェクトです。'ancdata' アイテムは、ゼロ
          以上のタプル ‘(cmsg_level, cmsg_type, cmsg_data)’ からなるリス
          トで、受信する付属的なデータ (制御メッセージ) を表します。
          'cmsg_level' と 'cmsg_type' はそれぞれ、プロトコルレベルとプロ
          トコル固有のタイプを指定する整数で、'cmsg_data' は関連するデー
          タを保持する ‘bytes’ オブジェクトです。'msg_flags' アイテムは
          、受信したメッセージの条件を示す様々なフラグのビット OR です。
          詳細は、システムのドキュメントを参照してください。受信ソケット
          が接続されていない場合、'address' は、送信ソケットが利用できる
          場合にはそのアドレスで、利用できない場合、その値は未指定になり
          ます。

          一部のシステムでは、*note sendmsg(): 6a1. と *note recvmsg():
          faa. を使用して、プロセス間で *note AF_UNIX: 1c0d. ソケットを
          経由してファイル記述子を渡すことができます。この機能を使用する
          場合 (しばしば *note SOCK_STREAM: 150f. ソケットに限定されます
          )、‘recvmsg()’ は、付属的なデータ中に、‘(socket.SOL_SOCKET,
          socket.SCM_RIGHTS, fds)’ という形式のアイテムを返します。ここ
          で、'fds' は、新しいファイル記述子をネイティブ C の int 型のバ
          イナリ配列として表す *note bytes: 193. オブジェクトです。シス
          テムコールが返った後 ‘recvmsg()’ が例外を送出する場合、まずこ
          のメカニズムを経由して受信したファイル記述子を全て閉じようと試
          みます。

          一部のシステムでは、部分的に受信した付属的なデータアイテムの短
          縮された長さが示されません。アイテムがバッファの末尾を超えてい
          るようである場合、*note recvmsg(): faa. は *note
          RuntimeWarning: 4d7. を送出し、関連するデータの開始位置より前
          で途切れていない場合、バッファ内の付属的なデータの一部を返しま
          す。

          On systems which support the ‘SCM_RIGHTS’ mechanism, the
          following function will receive up to 'maxfds' file
          descriptors, returning the message data and a list containing
          the descriptors (while ignoring unexpected conditions such as
          unrelated control messages being received).  See also *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: 2199.: Unix.

          Unix プラットフォーム。

          Added in version 3.3.

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(9) を参照し
          てください)。

      -- メソッド: recvmsg_into (buffers[, ancbufsize[, flags]])

          *note recvmsg(): faa. と同様に動作してソケットから通常のデータ
          と付属的なデータを受信しますが、非付属的データは新しいバイトオ
          ブジェクトとして返すのではなく、一連のバッファとして返します。
          'buffers' 引数は書き込み可能なバッファをエクスポートするオブジ
          ェクトのイテラブルでなければなりません (例: *note bytearray:
          342. オブジェクト)。これらは、全てに書き込まれるか、残りバッフ
          ァがなくなるまで、非付属的データの連続チャンクで埋められます。
          オペレーティングシステムによって、使用できるバッファの数が制限
          (*note sysconf(): 194f. 値 ‘SC_IOV_MAX’) されている場合があり
          ます。'ancbufsize' 引数と 'flags' 引数は、‘recvmsg()’ での意味
          と同じ意味を持ちます。

          戻り値は 4 要素のタプル ‘(nbytes, ancdata, msg_flags,
          address)’ です。ここで、'nbytes' はバッファに書き込まれた非付
          属的データの総数で、'ancdata'、'msg_flags'、'address' は *note
          recvmsg(): faa. と同様です。

          以下はプログラム例です:

               >>> 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: 2199.: Unix.

          Unix プラットフォーム。

          Added in version 3.3.

      -- メソッド: recvfrom_into (buffer[, nbytes[, flags]])

          Receive data from the socket, writing it into 'buffer' instead
          of creating a new bytestring.  The return value is a pair
          ‘(nbytes, address)’ where 'nbytes' is the number of bytes
          received and 'address' is the address of the socket sending
          the data.  See the Unix manual page ‘recv(2)(10)’ for the
          meaning of the optional argument 'flags'; it defaults to zero.
          The format of 'address' depends on the address family -- see
          *note ソケットファミリー: 39ed.

      -- メソッド: recv_into (buffer[, nbytes[, flags]])

          'nbytes' バイトまでのデータをソケットから受信して、そのデータ
          を新しいバイト文字列にするのではなく 'buffer' に保存します。
          'nbytes' が指定されない(あるいは0が指定された)場合、 'buffer'
          の利用可能なサイズまで受信します。受信したバイト数を返り値とし
          て返します。オプション引数 'flags' (デフォルト:0) の意味につい
          ては、 Unix マニュアルページ ‘recv(2)(11)’ を参照してください
          。

      -- メソッド: send (bytes[, flags])

          Send data to the socket.  The socket must be connected to a
          remote socket.  The optional 'flags' argument has the same
          meaning as for *note recv(): fa8.  Returns the number of bytes
          sent.  Applications are responsible for checking that all data
          has been sent; if only some of the data was transmitted, the
          application needs to attempt delivery of the remaining data.
          For further information on this topic, consult the *note
          ソケットプログラミング HOWTO: 3a49.

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(12) を参照
          してください)。

      -- メソッド: sendall (bytes[, flags])

          Send data to the socket.  The socket must be connected to a
          remote socket.  The optional 'flags' argument has the same
          meaning as for *note recv(): fa8.  Unlike *note send(): fab,
          this method continues to send data from 'bytes' until either
          all data has been sent or an error occurs.  ‘None’ is returned
          on success.  On error, an exception is raised, and there is no
          way to determine how much data, if any, was successfully sent.

          バージョン 3.5 で変更: ソケットのタイムアウトは、データが正常
          に送信される度にリセットされなくなりました。ソケットのタイムア
          ウトは、すべてのデータを送る最大の合計時間となります。

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(13) を参照
          してください)。

      -- メソッド: sendto (bytes, address)

      -- メソッド: sendto (bytes, flags, address)

          Send data to the socket.  The socket should not be connected
          to a remote socket, since the destination socket is specified
          by 'address'.  The optional 'flags' argument has the same
          meaning as for *note recv(): fa8.  Return the number of bytes
          sent.  The format of 'address' depends on the address family
          -- see *note ソケットファミリー: 39ed.

          引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1ccb.
          ‘socket.sendto’ を送出します。

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(14) を参照
          してください)。

      -- メソッド: sendmsg (buffers[, ancdata[, flags[, address]]])

          非付属的なデータを一連のバッファから集め、単一のメッセージにま
          とめることで、通常のデータと付属的なデータをソケットに送信しま
          す。'buffers' 引数は、非付属的なデータを *note bytes-like
          objects: 194. (例: *note bytes: 193. オブジェクト) のイテラブ
          ルとして指定します。オペレーティングシステムによって、使用でき
          るバッファの数が制限 (*note sysconf(): 194f. 値 ‘SC_IOV_MAX’)
          されている場合があります。'ancdata' 引数は付属的なデータ (制御
          メッセージ) をゼロ以上のタプル ‘(cmsg_level, cmsg_type,
          cmsg_data)’ のイテラブルとして指定します。ここで、'cmsg_level'
          と 'cmsg_type' はそれぞれプロトコルレベルとプロトコル固有のタ
          イプを指定する整数で、'cmsg_data' は関連データを保持するバイト
          ライクオブジェクトです。一部のシステム (特に *note
          CMSG_SPACE(): 1e73. を持たないシステム) では、一度の呼び出しで
          一つの制御メッセージの送信しかサポートされていない場合がありま
          す。'flags' 引数のデフォルトは 0 であり、*note send(): fab. で
          の意味と同じ意味を持ちます。‘None’ 以外の 'address' が渡された
          場合、メッセージの目的地のアドレスを設定します。戻り値は、送信
          された非付属的データのバイト数です。

          The following function sends the list of file descriptors
          'fds' over an *note AF_UNIX: 1c0d. socket, on systems which
          support the ‘SCM_RIGHTS’ mechanism.  See also *note recvmsg():
          faa.

               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: 2199.: Unix, not WASI.

          Unix プラットフォーム。

          引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1ccb.
          ‘socket.sendmsg’ を送出します。

          Added in version 3.3.

          バージョン 3.5 で変更: システムコールが中断されシグナルハンド
          ラが例外を送出しなかった場合、このメソッドは *note
          InterruptedError: f8c. 例外を送出する代わりにシステムコールを
          再試行するようになりました (論拠については PEP 475(15) を参照
          してください)。

      -- メソッド: sendmsg_afalg ([msg], *, op[, iv[, assoclen[,
               flags]]])

          *note sendmsg(): 6a1. の *note AF_ALG: ed6. ソケット用に特化し
          たバージョンです。‘AF_ALG’ ソケットの、モード、IV、AEAD に関連
          づけられたデータ長、フラグを設定します。

          *note Availability: 2199.: Linux >= 2.6.38.

          Added in version 3.6.

      -- メソッド: sendfile (file, offset=0, count=None)

          高性能の *note os.sendfile: d09. を使用して、ファイルを EOF ま
          で送信し、送信されたバイトの総数を返します。'file' は、バイナ
          リモードで開かれた標準的なファイルオブジェクトです。
          ‘os.sendfile’ が使用できない場合 (例: Windows)、または 'file'
          が標準的なファイルでない場合、代わりに *note send(): fab. が使
          用されます。'offset' は、ファイルの読み出し開始位置を指定しま
          す。'count' が指定されている場合、ファイルを EOF まで送信する
          のではなく、転送するバイトの総数を指定します。ファイルの位置は
          、返る時に更新されます。あるいは、エラー時には *note
          file.tell(): 15ca.  を使用して送信されたバイトの数を確認するこ
          とができます。ソケットは *note SOCK_STREAM: 150f. タイプでなけ
          ればなりません。非ブロックソケットはサポートされていません。

          Added in version 3.5.

      -- メソッド: set_inheritable (inheritable)

          ソケットのファイル記述子、またはソケットのハンドルの、 *note
          継承可能フラグ: 1100. を立てます。

          Added in version 3.4.

      -- メソッド: setblocking (flag)

          ソケットをブロッキングモード、または非ブロッキングモードに設定
          します。'flag' が False の場合にはソケットは非ブロッキングモー
          ドになり、True の場合にはブロッキングモードになります。

          このメソッドは、次の *note settimeout(): 39fa. 呼び出しの省略
          表記です:

             * ‘sock.setblocking(True)’ は ‘sock.settimeout(None)’ と等
               価です

             * ‘sock.setblocking(False)’ は ‘sock.settimeout(0.0)’ と等
               価です

          バージョン 3.7 で変更: The method no longer applies *note
          SOCK_NONBLOCK: e08. flag on *note socket.type: e0a.

      -- メソッド: settimeout (value)

          Set a timeout on blocking socket operations.  The 'value'
          argument can be a nonnegative real number expressing seconds,
          or ‘None’.  If a non-zero value is given, subsequent socket
          operations will raise a *note timeout: a39. 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 ソケットタイムアウトの注意事項: 3a4a. を参照し
          てください。

          バージョン 3.7 で変更: The method no longer toggles *note
          SOCK_NONBLOCK: e08. flag on *note socket.type: e0a.

      -- メソッド: setsockopt (level, optname, value: int | Buffer)

      -- メソッド: 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: 194. 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:
          194. を使用できるようになりました。

          バージョン 3.6 で変更: setsockopt(level, optname, None,
          optlen: int) の形式が追加されました。

          *note Availability: 2199.: not WASI.

      -- メソッド: shutdown (how)

          接続の片方向、または両方向を切断します。 'how' が *note
          SHUT_RD: 3a34. の場合、以降は受信を行えません。 'how' が *note
          SHUT_WR: 3a35. の場合、以降は送信を行えません。 'how' が *note
          SHUT_RDWR: 3a36. の場合、以降は送受信を行えません。

          *note Availability: 2199.: not WASI.

      -- メソッド: share (process_id)

          ソケットを複製し、対象のプロセスと共有するための bytes オブジ
          ェクトを返します。対象のプロセスを 'process_id' で指定しなけれ
          ばなりません。戻り値の bytes オブジェクトは、何らかのプロセス
          間通信を使って対象のプロセスに伝えます。対象のプロセス側では、
          *note fromshare(): e05. を使って複製されたソケットをとらえます
          。オペレーティング・システムは対象のプロセスに対してソケットを
          複製するため、このメソッドを呼び出した後であれば、元のソケット
          をクローズしても、対象のプロセスに渡ったソケットには影響があり
          ません。

          *note Availability: 2199.: Windows.

          Added in version 3.3.

     Note that there are no methods ‘read()’ or ‘write()’; use *note
     recv(): fa8. and *note send(): fab. without 'flags' argument
     instead.

     ソケットオブジェクトには以下の *note socket: fa5. コンストラクタに
     渡された値に対応した (読み出し専用) 属性があります。

      -- の属性: family

          ソケットファミリー。

      -- の属性: type

          ソケットタイプ。

      -- の属性: proto

          ソケットプロトコル。

 -- クラス: socket.SocketType

     The base class of the *note socket: fa5. type, re-exported from
     ‘_socket’.  An instance check such as ‘isinstance(socket(...),
     SocketType)’ is true, but ‘SocketType’ is not the same as
     ‘type(socket(...))’, which is ‘socket’ itself.

   ---------- 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.20.2.9 ソケットタイムアウトの注意事項
.......................................

ソケットオブジェクトは、ブロッキングモード、非ブロッキングモード、タイム
アウトモードのうち、いずれか1つのモードをとります。デフォルトでは、ソケ
ットは常にブロッキングモードで作成されますが、 *note
setdefaulttimeout(): 39fe. で標準のモードを変更することができます。

   * 'ブロッキングモード' での操作は、完了するか、または（接続がタイムア
     ウトするなどして）システムがエラーを返すまで、ブロックされます。

   * '非ブロッキングモード' での操作は、ただちに完了できない場合、例外を
     送出して失敗します。この場合の例外の種類は、システムに依存するため
     、ここに記すことができません。 *note select: c6. モジュールの関数を
     使って、ソケットの読み書きが利用可能かどうか、可能な場合はいつ利用
     できるかを調べることができます。

   * 'タイムアウトモード' での操作は、指定されたタイムアウトの時間内に完
     了しなければ、 *note timeout: a39. 例外を送出します。タイムアウトの
     時間内にシステムがエラーを返した場合は、そのエラーを返します。

     注釈: 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(): 3a47. of a socket.

* Menu:

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


File: python.info,  Node: タイムアウトと connect メソッド,  Next: タイムアウトと accept メソッド,  Up: ソケットタイムアウトの注意事項

5.20.2.10 タイムアウトと ‘connect’ メソッド
...........................................

*note connect(): fa7. もタイムアウト設定に従います。一般的に、 *note
settimeout(): 39fa. を ‘connect()’ の前に呼ぶか、 *note
create_connection(): 883. にタイムアウト引数を渡すことが推奨されます。た
だし、システムのネットワークスタックが Python のソケットタイムアウトの設
定を無視して、自身の接続タイムアウトエラーを返すこともあります。


File: python.info,  Node: タイムアウトと accept メソッド,  Prev: タイムアウトと connect メソッド,  Up: ソケットタイムアウトの注意事項

5.20.2.11 タイムアウトと ‘accept’ メソッド
..........................................

*note getdefaulttimeout(): 3a3b. が *note None: 886. でない場合、 *note
accept(): fa6. メソッドが返すソケットでは、そのタイムアウトが継承されま
す。 ‘None’ である場合、待機中のソケットの設定によって動作は異なります。

   * 待機中のソケットが 'ブロッキングモード' または 'タイムアウトモード'
     である場合、*note accept(): fa6. が返すソケットは、'ブロッキングモ
     ード' になります。

   * 待機中のソケットが '非ブロッキングモード' である場合、*note
     accept(): fa6. が返すソケットは、オペレーティングシステムによってブ
     ロッキングモードまたは非ブロッキングモードになります。クロスプラッ
     トフォームの動作を確保したい場合、この設定を手動でオーバーライドす
     ることをお勧めします。


File: python.info,  Node: 使用例<27>,  Prev: ソケットタイムアウトの注意事項,  Up: socket --- 低水準ネットワークインターフェース

5.20.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(): fa5, *note bind(): 12db, *note listen(): 1062,
*note accept(): fa6. (possibly repeating the ‘accept()’ to service more
than one client), while a client only needs the sequence ‘socket()’,
*note connect(): fa7.  Also note that the server does not *note
sendall(): fac./*note recv(): fa8. on the socket it is listening on but
on the new socket returned by ‘accept()’.

次のクライアントとサーバは、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: 11a9.) 接続を行ったあ
と、ソケットオブジェクトで *note socket.send(): fab. と *note
socket.recv(): fa8. 操作 (とそのカウンターパート) を通常通りに使用するこ
とができます。

最後の例では、特権が必要になるかもしれません:

     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.20.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: 21b4.  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
オプションのモジュールの要件: 21b2.

     注釈: 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 セキュリティで考慮すべき点: 3931. を読まずにこのモジュ
     ールを使用しないでください。SSL のデフォルト設定はアプリケーション
     に十分ではないので、読まない場合はセキュリティに誤った意識を持って
     しまうかもしれません。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

このセクションでは、 ‘ssl’ モジュールのオブジェクトと関数を解説します。
TLS, SSL, 証明書に関するより一般的な情報は、末尾にある "See Also" のセク
ションを参照してください。

This module provides a class, *note ssl.SSLSocket: aeb, which is derived
from the *note socket.socket: fa5. 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: 355. クラ
スが設定と証明書の管理の助けとなるでしょう。それは *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:

* Functions, constants, and exceptions: Functions constants and exceptions.
* SSL sockets::
* SSL contexts::
* 証明書::
* 使用例: 使用例<28>.
* ノンブロッキングソケットについての注意事項::
* Memory BIO support::
* 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: Functions constants and exceptions,  Next: SSL sockets,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.1 Functions, constants, and exceptions
.............................................

* Menu:

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


File: python.info,  Node: ソケットの作成<2>,  Next: コンテキストの作成,  Up: Functions constants and exceptions

5.20.3.2 ソケットの作成
.......................

Instances of *note SSLSocket: aeb. 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: Functions constants and exceptions

5.20.3.3 コンテキストの作成
...........................

コンビニエンス関数が、共通の目的で使用される *note SSLContext: 355. オブ
ジェクトを作成するのに役立ちます。

 -- の関数: ssl.create_default_context (purpose=Purpose.SERVER_AUTH, *,
          cafile=None, capath=None, cadata=None)

     Return a new *note SSLContext: 355. 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 ‘SSLContext’ constructor directly.

     'cafile', 'capath', 'cadata' は証明書の検証で信用するオプションの
     CA 証明書で、 *note SSLContext.load_verify_locations(): 10f2. のも
     のと同じです。これら 3 つすべてが *note None: 886. であれば、この関
     数は代わりにシステムのデフォルトの CA 証明書を信用して選択すること
     ができます。

     The settings are: *note PROTOCOL_TLS_CLIENT: a76. or *note
     PROTOCOL_TLS_SERVER: a77, *note OP_NO_SSLv2: a3e, and *note
     OP_NO_SSLv3: a3f. with high encryption cipher suites without RC4
     and without unauthenticated cipher suites.  Passing *note
     SERVER_AUTH: 11b9. as 'purpose' sets *note verify_mode: 3a59. to
     *note CERT_REQUIRED: 3a5a. and either loads CA certificates (when
     at least one of 'cafile', 'capath' or 'cadata' is given) or uses
     *note SSLContext.load_default_certs(): 11b8. to load default CA
     certificates.

     When *note keylog_filename: 3a5b. is supported and the environment
     variable ‘SSLKEYLOGFILE’ is set, ‘create_default_context()’ 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: 355. を作って自分自身で設定を適用すべきです
          。

          注釈: ある種の古いクライアントやサーバが接続しようと試みてきた
          場合に、この関数で作られた *note SSLContext: 355. が "Protocol
          or cipher suite mismatch" で始まるエラーを起こすのを目撃したら
          それは、この関数が *note OP_NO_SSLv3: a3f. を使って除外してい
          る 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: a76. or *note PROTOCOL_TLS_SERVER: a77.
     protocol instead of generic *note PROTOCOL_TLS: 3a5c.

     バージョン 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: Functions constants and exceptions

5.20.3.4 例外
.............

 -- 例外: ssl.SSLError

     (現在のところ OpenSSL ライブラリによって提供されている)下層の SSL 実
     装からのエラーを伝えるための例外です。このエラーは、低レベルなネッ
     トワークの上に載っている、高レベルな暗号化と認証レイヤーでの問題を
     通知します。このエラーは *note OSError: 2c2. のサブタイプです。
     *note SSLError: 1495. インスタンスのエラーコードとメッセージは
     OpenSSL ライブラリによるものです。

     バージョン 3.3 で変更: *note SSLError: 1495. は以前は *note
     socket.error: 1265. のサブタイプでした。

      -- の属性: 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: 1495. サブク
     ラス例外です。これは下層の転送(read TCP)が閉じたことは意味しないこ
     とに注意してください。

     Added in version 3.3.

 -- 例外: ssl.SSLWantReadError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送で受け取る必要があるデータが不足した場合に
     *note non-blocking SSL socket: 3a5f. によって送出される *note
     SSLError: 1495. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLWantWriteError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送が送信する必要があるデータが不足した場合に
     *note non-blocking SSL socket: 3a5f. によって送出される *note
     SSLError: 1495. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLSyscallError

     SSL ソケット上で操作を遂行しようとしていてシステムエラーが起こった
     場合に送出される *note SSLError: 1495. サブクラス例外です。残念なが
     ら元となった errno 番号を調べる簡単な方法はありません。

     Added in version 3.3.

 -- 例外: ssl.SSLEOFError

     SSL コネクションが唐突に打ち切られた際に送出される *note SSLError:
     1495. サブクラス例外です。一般的に、このエラーが起こったら下層の転
     送を再利用しようと試みるべきではありません。

     Added in version 3.3.

 -- 例外: ssl.SSLCertVerificationError

     A subclass of *note SSLError: 1495. 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: d79. の別名です。

     バージョン 3.7 で変更: 例外は *note SSLCertVerificationError: d79.
     の別名になりました。


File: python.info,  Node: 乱数生成,  Next: 証明書の取り扱い,  Prev: 例外<19>,  Up: Functions constants and exceptions

5.20.3.5 乱数生成
.................

 -- の関数: ssl.RAND_bytes (num, /)

     暗号学的に強固な擬似乱数の 'num' バイトを返します。擬似乱数生成器に
     十分なデータでシードが与えられていない場合や、現在の RANDOM メソッ
     ドに操作がサポートされていない場合は *note SSLError: 1495. を送出し
     ます。 *note RAND_status(): 1cda. を使って擬似乱数生成器の状態をチ
     ェックできます。 *note RAND_add(): 3a65. を使って擬似乱数生成器にシ
     ードを与えることができます。

     ほとんどすべてのアプリケーションでは *note os.urandom(): 746. が望
     ましいです。

     暗号論的に強い擬似乱数生成器に要求されることについては Wikipedia の
     記事 Cryptographically secure pseudorandom number generator
     (CSPRNG)(1) (日本語版: 暗号論的擬似乱数生成器(2)) を参照してくださ
     い。

     Added in version 3.3.

 -- の関数: ssl.RAND_status ()

     Return ‘True’ if the SSL pseudo-random number generator has been
     seeded with 'enough' randomness, and ‘False’ otherwise.  You can
     use ‘ssl.RAND_egd()’ and *note ssl.RAND_add(): 3a65. to increase
     the randomness of the pseudo-random number generator.

 -- の関数: 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: 194.
     を使用できるようになりました。

   ---------- 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: Functions constants and exceptions

5.20.3.6 証明書の取り扱い
.........................

 -- の関数: ssl.cert_time_to_seconds (cert_time)

     Return the time in seconds since the epoch, given the ‘cert_time’
     string representing the "notBefore" or "notAfter" date from a
     certificate in ‘"%b %d %H:%M:%S %Y %Z"’ strptime format (C locale).

     例です。 :

          >>> import ssl
          >>> import datetime as dt
          >>> timestamp = ssl.cert_time_to_seconds("Jan  5 09:34:43 2018 GMT")
          >>> timestamp
          1515144883
          >>> print(dt.datetime.fromtimestamp(timestamp, dt.UTC))
          2018-01-05 09:34:43+00:00

     "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(): 10f2.  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: 3a67. から *note
     PROTOCOL_TLS: 3a5c. に変更されました。

     バージョン 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(): 11b1. で
     使われるものと同じです。戻り値は *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: 2199.: 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: 2199.: Windows.

     Added in version 3.4.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5280.html


File: python.info,  Node: 定数<9>,  Prev: 証明書の取り扱い,  Up: Functions constants and exceptions

5.20.3.7 定数
.............

     すべての定数が *note enum.IntEnum: edf. コレクションまたは *note
     enum.IntFlag: e9e. コレクションになりました。

     Added in version 3.6.

 -- データ: ssl.CERT_NONE

     Possible value for *note SSLContext.verify_mode: 3a59.  Except for
     *note PROTOCOL_TLS_CLIENT: a76, 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 セキュリティで考慮すべき点:
     3931. に関する議論を参照してください。

 -- データ: ssl.CERT_OPTIONAL

     Possible value for *note SSLContext.verify_mode: 3a59.  In client
     mode, *note CERT_OPTIONAL: 3a6c. has the same meaning as *note
     CERT_REQUIRED: 3a5a.  It is recommended to use ‘CERT_REQUIRED’ 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(): 10f2.

 -- データ: ssl.CERT_REQUIRED

     Possible value for *note SSLContext.verify_mode: 3a59.  In this
     mode, certificates are required from the other side of the socket
     connection; an *note SSLError: 1495. 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: 3a6d. must be enabled
     as well to verify the authenticity of a cert.  *note
     PROTOCOL_TLS_CLIENT: a76. uses *note CERT_REQUIRED: 3a5a. and
     enables ‘check_hostname’ 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(): 10f2.

 -- クラス: ssl.VerifyMode

     CERT_* 定数の *note enum.IntEnum: edf. コレクションです。

     Added in version 3.6.

 -- データ: ssl.VERIFY_DEFAULT

     *note SSLContext.verify_flags: 11b4. に渡せる値です。このモードでは
     、証明書失効リスト(CRLs)はチェックされません。デフォルトでは
     OpenSSL は CRLs を必要ともしませんし検証にも使いません。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_LEAF

     *note SSLContext.verify_flags: 11b4. に渡せる値です。このモードでは
     、接続先の証明書のみがチェックされ、仲介の CA 証明書はチェックされ
     ません。接続先証明書の発行者(その CA の直接の祖先)によって署名され
     た妥当な CRL が必要です。 *note SSLContext.load_verify_locations:
     10f2. で相応しい CRL をロードしていなければ、検証は失敗します。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_CHAIN

     *note SSLContext.verify_flags: 11b4. に渡せる値です。このモードでは
     、接続先の証明書チェイン内のすべての証明書についての CRLs がチェッ
     クされます。

     Added in version 3.4.

 -- データ: ssl.VERIFY_X509_STRICT

     *note SSLContext.verify_flags: 11b4. に渡せる値で、壊れた X.509 証
     明書に対するワークアラウンドを無効にします。

     Added in version 3.4.

 -- データ: ssl.VERIFY_ALLOW_PROXY_CERTS

     Possible value for *note SSLContext.verify_flags: 11b4. to enables
     proxy certificate verification.

     Added in version 3.10.

 -- データ: ssl.VERIFY_X509_TRUSTED_FIRST

     *note SSLContext.verify_flags: 11b4. に渡せる値です。OpenSSL に対し
     、証明書検証のために信頼チェインを構築する際、信頼できる証明書を選
     ぶように指示します。これはデフォルトで有効にされています。

     Added in version 3.4.4.

 -- データ: ssl.VERIFY_X509_PARTIAL_CHAIN

     Possible value for *note SSLContext.verify_flags: 11b4.  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: e9e. コレクションです。

     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: a76. and *note PROTOCOL_TLS_SERVER: a77.

 -- データ: 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: 3a5a. and
     *note check_hostname: 3a6d. 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: 3a5c. のエイリアスです。

     バージョン 3.6 で非推奨: 代わりに *note PROTOCOL_TLS: 3a5c. を使用
     してください。

 -- データ: 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: a77. or *note PROTOCOL_TLS_CLIENT: a76. with
     *note SSLContext.minimum_version: a74. and *note
     SSLContext.maximum_version: a75. 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: 3a5c. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv2 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv2 は非推奨です

 -- データ: ssl.OP_NO_SSLv3

     SSLv3 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3a5c. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv3 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv3 は非推奨です

 -- データ: ssl.OP_NO_TLSv1

     TLSv1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3a5c. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして TLSv1 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0, use the new *note SSLContext.minimum_version: a74. and *note
     SSLContext.maximum_version: a75. instead.

 -- データ: ssl.OP_NO_TLSv1_1

     TLSv1.1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 3a5c. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして 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: 3a5c. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして 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: 3a5c.  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: e9e. コレクションです。

 -- データ: 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: d7a. 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(): 356. メソッドで提示することが
     できます。

     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(): 1360. の引
     数に渡せます。

     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(): 11bd. でのコールバック
     関数の戻り値として使われます。

     Added in version 3.4.

 -- クラス: ssl.AlertDescription

     ALERT_DESCRIPTION_* 定数の *note enum.IntEnum: edf. コレクションで
     す。

     Added in version 3.6.

 -- データ: Purpose.SERVER_AUTH

     *note create_default_context(): 480. と *note
     SSLContext.load_default_certs(): 11b8. に渡すオプションです。この値
     はコンテキストが web サーバの認証に使われることを示します (ですので
     、クライアントサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- データ: Purpose.CLIENT_AUTH

     *note create_default_context(): 480. と *note
     SSLContext.load_default_certs(): 11b8. に渡すオプションです。この値
     はコンテキストが web クライアントの認証に使われることを示します (で
     すので、サーバサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- クラス: ssl.SSLErrorNumber

     SSL_ERROR_* 定数の *note enum.IntEnum: edf. コレクションです。

     Added in version 3.6.

 -- クラス: ssl.TLSVersion

     *note enum.IntEnum: edf. collection of SSL and TLS versions for
     *note SSLContext.maximum_version: a75. and *note
     SSLContext.minimum_version: a74.

     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: 3a8c. members
     except *note TLSVersion.TLSv1_2: 3a92. and ‘TLSVersion.TLSv1_3’ 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 sockets,  Next: SSL contexts,  Prev: Functions constants and exceptions,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.8 SSL sockets
....................

 -- クラス: ssl.SSLSocket (socket.socket)

     SSL ソケットは *note socket オブジェクト: 3a3a. の以下のメソッドを
     提供します:

        - *note accept(): fa6.

        - *note bind(): 12db.

        - *note close(): f43.

        - *note connect(): fa7.

        - *note detach(): 1439.

        - *note fileno(): 3a47.

        - *note getpeername(): 3975, *note getsockname(): 286.

        - *note getsockopt(): ed4, *note setsockopt(): ed5.

        - *note gettimeout(): 3a48, *note settimeout(): 39fa, *note
          setblocking(): 30bd.

        - *note listen(): 1062.

        - *note makefile(): 13bb.

        - *note recv(): fa8, *note recv_into(): 1539. (but passing a
          non-zero ‘flags’ argument is not allowed)

        - *note send(): fab, *note sendall(): fac. (with the same
          limitation)

        - *note sendfile(): 1061. (but *note os.sendfile: d09. will be
          used for plain-text sockets only, else *note send(): fab. will
          be used)

        - *note shutdown(): 3a37.

     SSL(およびTLS)プロトコルは TCP の上に独自の枠組みを持っているので、
     SSLソケットの抽象化は、いくつかの点で通常の OSレベルのソケットの仕
     様から逸脱することがあります。特に *note
     ノンブロッキングソケットについての注釈: 3a5f. を参照してください。

     *note SSLSocket: aeb. のインスタンスは *note
     SSLContext.wrap_socket(): 748. メソッドを使用して作成されなければな
     りません。

     バージョン 3.5 で変更: ‘sendfile()’ メソッドが追加されました。

     バージョン 3.5 で変更: ‘shutdown()’ は、バイトが送受信されるたびに
     ソケットのタイムアウトをリセットしません。ソケットのタイムアウトは
     、シャットダウンの最大合計時間になりました。

     バージョン 3.6 で非推奨: *note SSLSocket: aeb. インスタンスを直接作
     成することは非推奨です。ソケットをラップするために *note
     SSLContext.wrap_socket(): 748. を使用してください。

     バージョン 3.7 で変更: ‘SSLSocket’ instances must be 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: 3a5f. で読み出しがブロックすると、
     *note SSLWantReadError: 106d. もしくは *note SSLWantWriteError:
     106e. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note read(): 1072. の呼び
     出しは書き込み操作も引き起こしえます。

     バージョン 3.5 で変更: ソケットのタイムアウトは、バイトが送受信され
     るたびにリセットされなくなりました。ソケットのタイムアウトは、最大
     'len' バイトを読むのにかかる最大合計時間になりました。

     バージョン 3.6 で非推奨: *note read(): 1072. の代わりに ‘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: 3a5f. で書き込みがブロックすると、
     *note SSLWantReadError: 106d. もしくは *note SSLWantWriteError:
     106e. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note write(): 1073. の呼
     び出しは読み出し操作も引き起こしえます。

     バージョン 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(): 1073. の代わりに ‘send()’ を
     使用してください。

     注釈: *note read(): 1072, *note write(): 1073. メソッドは下位レベル
     のメソッドであり、暗号化されていないアプリケーションレベルのデータ
     を読み書きし、それを復号/暗号化して暗号化された書き込みレベルのデー
     タにします。これらのメソッドはアクティブな SSL 接続つまり、ハンドシ
     ェイクが完了していて、 *note SSLSocket.unwrap(): 3a95. が呼ばれてい
     ないことを必要とします。

     通常はこれらのメソッドの代わりに *note recv(): fa8. や *note
     send(): fab. のようなソケット API メソッドを使うべきです。

 -- メソッド: SSLSocket.do_handshake (block=False)

     SSL セットアップのハンドシェイクを実行します。

     If 'block' is true and the timeout obtained by *note gettimeout():
     3a48. 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: 3a6d. attribute
     of the socket's *note context: 3a96. 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: 2ee. が送出されます。

     ‘binary_form’ が *note False: d2f. で接続先から証明書を取得した場合
     、このメソッドは *note dict: 184. のインスタンスを返します。証明書
     が認証されていない場合、辞書は空です。証明書が認証されていた場合い
     くつかのキーを持った辞書を返し、 ‘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: e0b. だった場合、証明書が渡されて
     いればこのメソッドはDERエンコードされた証明書全体をバイト列として返
     し、接続先が証明書を提示しなかった場合は *note None: 886. を返しま
     す。接続先が証明書を提供するかどうかは SSL ソケットの役割に依存しま
     す:

        * クライアント SSL ソケットでは、認証が要求されているかどうかに
          関わらず、サーバは常に証明書を提供します。

        * サーバ SSL ソケットでは、クライアントはサーバによって認証が要
          求されている場合にのみ証明書を提供します。したがって、 (*note
          CERT_OPTIONAL: 3a6c. や *note CERT_REQUIRED: 3a5a. ではなく)
          *note CERT_NONE: 3a6b. を使用した場合 *note getpeercert():
          11be. は *note None: 886. を返します。

     See also *note SSLContext.check_hostname: 3a6d.

     バージョン 3.2 で変更: 返される辞書に ‘issuer’, ‘notBefore’ のよう
     な追加アイテムを含むようになりました。

     バージョン 3.4 で変更: ハンドシェイクが済んでいなければ *note
     ValueError: 2ee. を投げるようになりました。返される辞書に
     ‘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(): 19bd.

     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(): 1070. は ‘None’ を返します。

     Added in version 3.5.

 -- メソッド: SSLSocket.compression ()

     使われている圧縮アルゴリズムを文字列で返します。接続が圧縮されてい
     なければ ‘None’ を返します。

     上位レベルのプロトコルが自身で圧縮メカニズムをサポートする場合、SSL
     レベルでの圧縮を *note OP_NO_COMPRESSION: 1362. を使って無効にでき
     ます。

     Added in version 3.3.

 -- メソッド: SSLSocket.get_channel_binding (cb_type='tls-unique')

     現在の接続におけるチャネルバインディングのデータを取得します。未接
     続あるいはハンドシェイクが完了していなければ ‘None’ を返します。

     'cb_type' パラメータにより、望みのチャネルバインディングのタイプを
     選択できます。チャネルバインディングのタイプの妥当なものは *note
     CHANNEL_BINDING_TYPES: 3a87. でリストされています。現在のところは
     RFC 5929(2) で定義されている 'tls-unique' のみがサポートされていま
     す。未サポートのチャネルバインディングのタイプが要求された場合、
     *note ValueError: 2ee. を送出します。

     Added in version 3.3.

 -- メソッド: SSLSocket.selected_alpn_protocol ()

     TLS ハンドシェイクで選択されたプロトコルを返します。 *note
     SSLContext.set_alpn_protocols(): 1068. が呼ばれていない場合、相手側
     が ALPN をサポートしていない場合、クライアントが提案したプロトコル
     のどれもソケットがサポートしない場合、あるいはハンドシェイクがまだ
     行われていない場合には、 ‘None’ が返されます。

     Added in version 3.5.

 -- メソッド: SSLSocket.selected_npn_protocol ()

     TLS/SSL ハンドシェイクで選択された上位レベルのプロトコルを返します
     。 *note SSLContext.set_npn_protocols(): 356. が呼ばれていない場合
     、相手側が 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:
     c2a.

     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: 1495. is raised.

          注釈: Only available with OpenSSL 1.1.1 and TLS 1.3 enabled.
          Without TLS 1.3 support, the method raises *note
          NotImplementedError: 369.

     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: 355. 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: 16a. 型、またはサーバサイドのソケット
     の場合とコンストラクタで 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: edd. です。このセッションは
     、TLS ハンドシェイクの実行後、クライアントサイドとサーバサイドのソ
     ケットで使用できます。クライアントソケットでは、このセッションを
     *note do_handshake(): 1071. が呼ばれる前に設定して、セッションを再
     利用できます。

     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 contexts,  Next: 証明書,  Prev: SSL sockets,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.9 SSL contexts
.....................

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: 3a5c.; 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: 1362, *note
     OP_CIPHER_SERVER_PREFERENCE: 1365, *note OP_SINGLE_DH_USE: 3a78,
     *note OP_SINGLE_ECDH_USE: 3a79, *note OP_NO_SSLv2: a3e, and *note
     OP_NO_SSLv3: a3f. (except for *note PROTOCOL_SSLv3: 3a67.) are set
     by default.  The initial cipher suite list contains only ‘HIGH’
     ciphers, no ‘NULL’ ciphers and no ‘MD5’ ciphers.

     バージョン 3.10 で非推奨: ‘SSLContext’ without protocol argument is
     deprecated.  The context class will either require *note
     PROTOCOL_TLS_CLIENT: a76. or *note PROTOCOL_TLS_SERVER: a77.
     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: 3a5c,
     *note PROTOCOL_TLS_CLIENT: a76, and *note PROTOCOL_TLS_SERVER: a77.
     use TLS 1.2 as minimum TLS version.

          注釈: ‘SSLContext’ 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.

          注釈: ‘SSLContext’ 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: 355. オブジェクトは以下のメソッドと属性を持っています:

 -- メソッド: 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 証明書: 3a9b. の議論を参照し
     てください。

     'password' 引数に、秘密鍵を復号するためのパスワードを返す関数を与え
     ることができます。その関数は秘密鍵が暗号化されていて、なおかつパス
     ワードが必要な場合にのみ呼び出されます。その関数は引数なしで呼び出
     され、string, bytes, または bytearray を返さなければなりません。戻
     り値が string の場合は鍵を復号化するのに使う前に UTF-8 でエンコード
     されます。string の代わりに bytes や bytearray を返した場合は
     'password' 引数に直接供給されます。秘密鍵が暗号化されていなかったり
     パスワードを必要としない場合は、指定は無視されます。

     'password' が与えられず、そしてパスワードが必要な場合には、OpenSSL
     組み込みのパスワード問い合わせメカニズムが、ユーザに対話的にパスワ
     ードを問い合わせます。

     秘密鍵が証明書に合致しなければ、 *note SSLError: 1495. が送出されま
     す。

     バージョン 3.3 で変更: 新しいオプション引数 'password'。

 -- メソッド: SSLContext.load_default_certs
          (purpose=Purpose.SERVER_AUTH)

     デフォルトの場所から "認証局" (CA=certification authority) 証明書フ
     ァイル一式をロードします。Windows では、CA 証明書はシステム記憶域の
     ‘CA’ と ‘ROOT’ からロードします。全てのシステムでは、この関数は
     *note SSLContext.set_default_verify_paths(): 11b1. を呼び出します。
     将来的にはこのメソッドは、他の場所からも CA 証明書をロードするかも
     しれません。

     The 'purpose' flag specifies what kind of CA certificates are
     loaded.  The default settings *note Purpose.SERVER_AUTH: 11b9.
     loads certificates, that are flagged and trusted for TLS web server
     authentication (client side sockets).  *note Purpose.CLIENT_AUTH:
     11ba. 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: 3a59. が *note CERT_NONE: 3a6b. でない場合に接続
     先の証明書ファイルの正当性検証に使われる "認証局" (CA=certification
     authority) 証明書ファイル一式をロードします。少なくとも 'cafile' か
     'capath' のどちらかは指定しなければなりません。

     このメソッドは PEM または DER フォーマットの証明書失効リスト
     (CRLs=certification revocation lists)もロードできます。CRLs のため
     に使うには、 *note SSLContext.verify_flags: 11b4. を適切に設定しな
     ければなりません。

     'cafile' を指定する場合は、PEM フォーマットで CA 証明書が結合された
     ファイルへのパスを指定してください。このファイル内で証明書をどのよ
     うに編成すれば良いのかについての詳しい情報については、 *note
     証明書: 3a9b. の議論を参照してください。

     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: 194. オブジェクトのどちらかを指定してください。PEM エンコー
     ドの証明書の周囲の余分な行は無視されますが、少なくとも一つの証明書
     が含まれている必要があります。

     バージョン 3.4 で変更: 新しいオプション引数 'cadata' 。

 -- メソッド: SSLContext.get_ca_certs (binary_form=False)

     ロードされた "認証局" (CA=certification authority) 証明書のリストを
     取得します。 ‘binary_form’ 引数が *note False: d2f. である場合、リ
     ストのそれぞれのエントリは *note SSLSocket.getpeercert(): 11be. が
     出力するような辞書になります。True である場合、このメソッドは、DER
     エンコード形式の証明書のリストを返します。返却されるリストには、
     SSL 接続によって証明書がリクエストおよびロードされない限り、
     'capath' からの証明書は含まれません。

          注釈: capath ディレクトリ内の証明書は一度でも使われない限りは
          ロードされません。

     Added in version 3.4.

 -- メソッド: SSLContext.get_ciphers ()

     有効な暗号化のリストを取得します。リストは暗号化優先度順に並びます
     。*note SSLContext.set_ciphers(): 3a9c. を参照してください。

     以下はプログラム例です:

          >>> 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: 1495. will be raised.

          注釈: when connected, the *note SSLSocket.cipher(): 3976.
          method of SSL sockets will give the currently selected cipher.

          TLS 1.3 cipher suites cannot be disabled with ‘set_ciphers()’.

 -- メソッド: SSLContext.set_alpn_protocols (alpn_protocols)

     SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定しま
     す。 ‘['http/1.1', 'spdy/2']’ のような推奨順に並べた ASCII 文字列の
     リストでなければなりません。プロトコルの選択は RFC 7301(9) に従いハ
     ンドシェイク中に行われます。ハンドシェイクが正常に終了した後、
     *note SSLSocket.selected_alpn_protocol(): 1069. メソッドは合意され
     たプロトコルを返します。

     このメソッドは *note HAS_ALPN: 106a. が ‘False’ の場合 *note
     NotImplementedError: 369. を送出します。

     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():
     1069. メソッドは合意されたプロトコルを返します。

     このメソッドは *note HAS_NPN: 3a80. が ‘False’ の場合 *note
     NotImplementedError: 369. を送出します。

     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: aeb, the second is a string
     that represents the server name that the client is intending to
     communicate (or *note None: 886. if the TLS Client Hello does not
     contain a server name) and the third argument is the original *note
     SSLContext: 355.  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: aeb. の
     *note SSLSocket.context: 3a96. 属性を、サーバ名に合致する証明書チェ
     インを持つ新しい *note SSLContext: 355. オブジェクトに変更すること
     です。

     Due to the early negotiation phase of the TLS connection, only
     limited methods and attributes are usable like *note
     SSLSocket.selected_alpn_protocol(): 1069. and *note
     SSLSocket.context: 3a96.  The *note SSLSocket.getpeercert(): 11be,
     *note SSLSocket.get_verified_chain(): 19bc, *note
     SSLSocket.get_unverified_chain(): 19bd. *note SSLSocket.cipher():
     3976. and *note SSLSocket.compression(): 1361. 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_*: 3a89. を返してください。ここ
     にない値を返すと、致命エラー ‘ALERT_DESCRIPTION_INTERNAL_ERROR’ を
     引き起こします。

     'sni_callback' 関数が例外を送出した場合、TLS 接続は TLS の致命的ア
     ラートメッセージ *note ALERT_DESCRIPTION_HANDSHAKE_FAILURE: 3a88. と
     ともに終了します。

     このメソッドは OpenSSL ライブラリが OPENSSL_NO_TLSEXT を定義してビ
     ルドされている場合、 *note NotImplementedError: 369. を送出します。

     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: 1794. 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:
     3a89. 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: 3a78. オプションも利用でき
     ます。

     Added in version 3.3.

 -- メソッド: SSLContext.set_ecdh_curve (curve_name, /)

     楕円曲線ディフィー・ヘルマン(ECDH)鍵交換の曲線名を指定します。ECDH
     はもとの DH に較べて、ほぼ間違いなく同程度に安全である一方で、顕著
     に高速です。 'curve_name' パラメータは既知の楕円曲線を表す文字列で
     なければなりません。例えば ‘prime256v1’ が広くサポートされている曲
     線です。

     この設定はクライアントソケットには適用されません。さらにセキュリテ
     ィを改善するのに *note OP_SINGLE_ECDH_USE: 3a79. オプションも利用で
     きます。

     このメソッドは *note HAS_ECDH: 3a7e. が ‘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: 3a9d. (default *note SSLSocket:
     aeb.).  The returned SSL socket is tied to the context, its
     settings and certificates.  'sock' must be a *note SOCK_STREAM:
     150f. socket; other socket types are unsupported.

     ‘server_side’ 引数は真偽値で、このソケットがサーバサイドとクライア
     ントサイドのどちらの動作をするのかを指定します。

     クライアントサイドソケットにおいて、コンテキストの生成は遅延されま
     す。つまり、低レイヤのソケットがまだ接続されていない場合、コンテキ
     ストの生成はそのソケットの ‘connect()’ メソッドが呼ばれた後に行われ
     ます。サーバサイドソケットの場合、そのソケットに接続先が居なければ
     それは listen 用ソケットだと判断されます。 ‘accept()’ メソッドで生
     成されるクライアント接続に対してのサーバサイド SSLラップは自動的に
     行われます。メソッドは *note SSLError: 1495. を送出することがありま
     す。

     クライアントからの接続では、 'server_hostname' で接続先サービスのホ
     スト名を指定できます。これは HTTP バーチャルホストにかなり似て、シ
     ングルサーバで複数の SSL ベースのサービスを別々の証明書でホストして
     いるようなサーバに対して使えます。 'server_side' が True の場合に
     'server_hostname' を指定すると *note ValueError: 2ee. を送出します
     。

     ‘do_handshake_on_connect’ 引数は、 ‘socket.connect()’ の後に自動的
     に SSLハンドシェイクを行うか、それともアプリケーションが明示的に
     *note SSLSocket.do_handshake(): 1071. メソッドを実行するかを指定し
     ます。 ‘SSLSocket.do_handshake()’ を明示的に呼びだすことで、ハンド
     シェイクによるソケットI/Oのブロッキング動作を制御できます。

     ‘suppress_ragged_eofs’ 引数は、 ‘SSLSocket.recv()’ メソッドが、接続
     先から予期しないEOF を受け取った時に通知する方法を指定します。
     *note True: e0b. (デフォルト) の場合、下位のソケットレイヤーから予
     期せぬEOFエラーが来た場合、通常のEOF (空のバイト列オブジェクト)を返
     します。 *note False: d2f. の場合、呼び出し元に例外を投げて通知しま
     す。

     'session', *note session: 199d. を参照してください。

     To wrap an *note SSLSocket: aeb. in another ‘SSLSocket’, use *note
     SSLContext.wrap_bio(): d7f.

     バージョン 3.5 で変更: OpenSSL が SNI をサポートしなくても
     server_hostname を許容するようになりました。

     バージョン 3.6 で変更: 'session' 引数が追加されました。

     バージョン 3.7 で変更: The method returns an instance of *note
     SSLContext.sslsocket_class: 3a9d. instead of hard-coded *note
     SSLSocket: aeb.

 -- の属性: SSLContext.sslsocket_class

     The return type of *note SSLContext.wrap_socket(): 748, defaults to
     *note SSLSocket: aeb.  The attribute can be assigned to on
     instances of *note SSLContext: 355. in order to return a custom
     subclass of ‘SSLSocket’.

     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: 3a9e. (default *note
     SSLObject: d7e.).  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: 3a9e. instead of hard-coded *note
     SSLObject: d7e.

 -- の属性: SSLContext.sslobject_class

     The return type of *note SSLContext.wrap_bio(): d7f, defaults to
     *note SSLObject: d7e.  The attribute can be overridden on instance
     of class in order to return a custom subclass of ‘SSLObject’.

     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(): 1071.  The context's *note verify_mode:
     3a59. must be set to *note CERT_OPTIONAL: 3a6c. or *note
     CERT_REQUIRED: 3a5a, and you must pass 'server_hostname' to *note
     wrap_socket(): 748. in order to match the hostname.  Enabling
     hostname checking automatically sets ‘verify_mode’ from *note
     CERT_NONE: 3a6b. to ‘CERT_REQUIRED’.  It cannot be set back to
     ‘CERT_NONE’ as long as hostname checking is enabled.  The *note
     PROTOCOL_TLS_CLIENT: a76. 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: 3a59. is now
     automatically changed to *note CERT_REQUIRED: 3a5a. when hostname
     checking is enabled and ‘verify_mode’ is *note CERT_NONE: 3a6b.
     Previously the same operation would have failed with a *note
     ValueError: 2ee.

 -- の属性: 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: 3a8c. enum member representing the highest
     supported TLS version.  The value defaults to *note
     TLSVersion.MAXIMUM_SUPPORTED: 3a8e.  The attribute is read-only for
     protocols other than *note PROTOCOL_TLS: 3a5c, *note
     PROTOCOL_TLS_CLIENT: a76, and *note PROTOCOL_TLS_SERVER: a77.

     The attributes ‘maximum_version’, *note minimum_version: a74. and
     *note SSLContext.options: a3d. all affect the supported SSL and TLS
     versions of the context.  The implementation does not prevent
     invalid combinations.  For example a context with *note
     OP_NO_TLSv1_2: 3a76. in ‘options’ and ‘maximum_version’ set to
     *note TLSVersion.TLSv1_2: 3a92. will not be able to establish a TLS
     1.2 connection.

     Added in version 3.7.

 -- の属性: SSLContext.minimum_version

     Like *note SSLContext.maximum_version: a75. except it is the lowest
     supported version or *note TLSVersion.MINIMUM_SUPPORTED: 3a8d.

     Added in version 3.7.

 -- の属性: SSLContext.num_tickets

     Control the number of TLS 1.3 session tickets of a *note
     PROTOCOL_TLS_SERVER: a77. 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: 3a73. ですが、 *note OP_NO_SSLv2: a3e. の
     ような他の値をビット OR 演算で指定できます。

     バージョン 3.6 で変更: *note SSLContext.options: a3d. は次のように
     *note Options: 3a7b. のフラグを返します。

          >>> 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: a74. and *note
     SSLContext.maximum_version: a75. 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:
     3a59. must be set to *note CERT_OPTIONAL: 3a6c. or *note
     CERT_REQUIRED: 3a5a, too.  The actual client cert exchange is
     delayed until *note SSLSocket.verify_client_post_handshake(): c2b.
     is called and some I/O is performed.

     Added in version 3.8.

 -- の属性: SSLContext.protocol

     コンテキストの構築時に選択されたプロトコルバージョン。この属性は読
     み出し専用です。

 -- の属性: SSLContext.hostname_checks_common_name

     Whether *note check_hostname: 3a6d. 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:
     11b6. などのフラグをビット OR 演算でセットできます。デフォルトでは
     OpenSSL は証明書失効リスト (CRLs) を必要としませんし検証にも使いま
     せん。

     Added in version 3.4.

     バージョン 3.6 で変更: *note SSLContext.verify_flags: 11b4. は次の
     ように *note VerifyFlags: 3a70. のフラグを返します。

          >>> ssl.create_default_context().verify_flags
          <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>

 -- の属性: SSLContext.verify_mode

     接続先の証明書の検証を試みるかどうか、また、検証が失敗した場合にど
     のように振舞うべきかを制御します。この属性は *note CERT_NONE: 3a6b,
     *note CERT_OPTIONAL: 3a6c, *note CERT_REQUIRED: 3a5a. のうちどれか
     一つでなければなりません。

     バージョン 3.6 で変更: *note SSLContext.verify_mode: 3a59. は次のよ
     うに *note VerifyMode: 3a6e. 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: 194. representing the pre-shared key.
     Return a zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: 886. removes any existing
     callback.

          注釈: When using TLS 1.3:

             - the ‘hint’ parameter is always *note None: 886.

             - 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: 369. if *note
     HAS_PSK: 3a86. 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: 194. representing the pre-shared key.  Return a
     zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: 886. 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: 369. if *note
     HAS_PSK: 3a86. is ‘False’.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 3a5c.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (2) *note SSLContext: 355. では、デフォルトで *note OP_NO_SSLv2: a3e.
によりSSLv2 が無効になっています。

   (3) *note SSLContext: 355. では、デフォルトで *note OP_NO_SSLv3: a3f.
により SSLv3 が無効になっています。

   (4) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 3a5c.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (5) *note SSLContext: 355. では、デフォルトで *note OP_NO_SSLv2: a3e.
によりSSLv2 が無効になっています。

   (6) *note SSLContext: 355. では、デフォルトで *note OP_NO_SSLv3: a3f.
により 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 contexts,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.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.20.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.20.3.12 CA 証明書
...................

もし相手から送られてきた証明書の認証をしたい場合、信頼している各発行者の
証明書チェインが入った "CA certs" ファイルを提供する必要があります。繰り
返しますが、このファイルは単純に、各チェインを結合しただけのものです。認
証のために、Pythonはそのファイルの中の最初にマッチしたチェインを利用しま
す。*note SSLContext.load_default_certs(): 11b8. を呼び出すことでプラッ
トフォームの証明書ファイルも使われますが、これは *note
create_default_context(): 480. によって自動的に行われます。


File: python.info,  Node: 秘密鍵と証明書の組み合わせ,  Next: 自己署名証明書,  Prev: CA 証明書,  Up: 証明書

5.20.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.20.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.20.3.15 使用例
................

* Menu:

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


File: python.info,  Node: SSLサポートをテストする,  Next: クライアントサイドの処理,  Up: 使用例<28>

5.20.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.20.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: a76. protocol configures the context for
cert validation and hostname verification.  *note verify_mode: 3a59. is
set to *note CERT_REQUIRED: 3a5a. and *note check_hostname: 3a6d. 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:
3a5a. and *note check_hostname: 3a6d. 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 セキュリティで考慮すべき点: 3931. に
関する議論を参照してください。


File: python.info,  Node: サーバサイドの処理,  Prev: クライアントサイドの処理,  Up: 使用例<28>

5.20.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 ノンブロッキングモード: 3a5f. にし、イベントループを使
うでしょう。)


File: python.info,  Node: ノンブロッキングソケットについての注意事項,  Next: Memory BIO support,  Prev: 使用例<28>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.19 ノンブロッキングソケットについての注意事項
....................................................

SSL ソケットはノンブロッキングモードにおいては、普通のソケットとは少し違
った振る舞いをします。ですのでノンブロッキングソケットとともに使う場合、
いくつか気をつけなければならない事項があります:

   - ほとんどの *note SSLSocket: aeb. のメソッドは I/O 操作がブロックす
     ると *note BlockingIOError: 237. ではなく *note SSLWantWriteError:
     106e. か *note SSLWantReadError: 106d. のどちらかを送出します。
     ‘SSLWantReadError’ は下層のソケットで読み出しが必要な場合に送出され
     、 ‘SSLWantWriteError’ は下層のソケットで書き込みが必要な場合に送出
     されます。SSL ソケットに対して '書き込み' を試みると下層のソケット
     から最初に '読み出す' 必要があるかもしれず、SSL ソケットに対して '読
     み出し' を試みると下層のソケットに先に '書き込む' 必要があるかもし
     れないことに注意してください。

     バージョン 3.5 で変更: 以前の Python バージョンでは、
     ‘SSLSocket.send()’ メソッドは *note SSLWantWriteError: 106e. または
     *note SSLWantReadError: 106d. を送出するのではなく、ゼロを返してい
     ました。

   - *note select(): fa4. 呼び出しは OS レベルでのソケットが読み出し可能
     (または書き込み可能)になったことを教えてくれますが、上位の SSL レイ
     ヤーでの十分なデータがあることを意味するわけではありません。例えば
     、SSL フレームの一部が届いただけかもしれません。ですから、
     ‘SSLSocket.recv()’ と ‘SSLSocket.send()’ の失敗を処理することに備え
     、ほかの ‘select()’ 呼び出し後にリトライしなければなりません。

   - 反対に、SSL レイヤーは独自の枠組みを持っているため、*note select():
     fa4. が気付かない読み出し可能なデータを SSL ソケットが持っている場
     合があります。したがって、入手可能な可能性のあるデータをすべて引き
     出すために最初に ‘SSLSocket.recv()’ を呼び出し、次にそれでもまだ必
     要な場合にだけ ‘select()’ 呼び出しでブロックすべきです。

     (当然のことながら、ほかのプリミティブ、例えば *note poll(): 3141. や
     *note selectors: c7. モジュール内のものを使う際にも似た但し書きが付
     きます)

   - SSL ハンドシェイクそのものがノンブロッキングになります: *note
     SSLSocket.do_handshake(): 1071. メソッドは成功するまでリトライしな
     ければなりません。 *note select(): fa4. を用いてソケットの準備が整
     うのを待つためには、およそ以下のようにします:

          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:
3a5f. and provides a higher level *note Streams API: 3855.  It polls for
events using the *note selectors: c7. module and handles *note
SSLWantWriteError: 106e, *note SSLWantReadError: 106d. and *note
BlockingIOError: 237. exceptions.  It runs the SSL handshake
asynchronously as well.


File: python.info,  Node: Memory BIO support,  Next: SSL セッション,  Prev: ノンブロッキングソケットについての注意事項,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.20 Memory BIO support
............................

Added in version 3.5.

Python 2.6 で SSL モジュールが導入されて以降、*note SSLSocket: aeb. クラ
スは、以下の互いに関連するが別々の機能を提供してきました。

   - SSL プロトコル処理

   - ネットワーク IO

ネットワーク IO API は、*note socket.socket: fa5. が提供するものと同じで
す。*note SSLSocket: aeb. も、そのクラスから継承しています。これにより、
SSL ソケットは標準のソケットをそっくりそのまま置き換えるものとして使用で
きるため、既存のアプリケーションを SSL に対応させるのが非常に簡単になり
ます。

SSL プロトコルの処理とネットワーク IO を組み合わせた場合、通常は問題なく
動作しますが、問題が発生する場合があります。一例を挙げると、非同期 IO フ
レームワークが別の多重化モデルを使用する場合、これは *note
socket.socket: fa5. と内部 OpenSSL ソケット IO ルーティンが想定する「フ
ァイル記述子上の select/poll」モデル（準備状態ベース）とは異なります。こ
れは、このモデルが非効率的になる Windows などのプラットフォームに主に該
当します。そのため、スコープを限定した *note SSLSocket: aeb. の変種、
*note SSLObject: d7e. が提供されています。

 -- クラス: ssl.SSLObject

     ネットワーク IO メソッドを含まない SSL プロトコルインスタンスを表す
     、スコープを限定した *note SSLSocket: aeb. の変種です。一般的にこ、
     のクラスを使用するのは、メモリバッファを通じて SSL のための非同期
     IO を実装するフレームワーク作成者です。

     このクラスは、OpenSSL が実装する低水準 SSL オブジェクトの上にインタ
     ーフェースを実装します。このオブジェクトは SSL 接続の状態をキャプチ
     ャしますが、ネットワーク IO 自体は提供しません。IO は、OpenSSL の
     IO 抽象レイヤである別の「BIO」オブジェクトを通じて実行する必要があ
     ります。

     このクラスには公開されたコンストラクタがありません。*note
     SSLObject: d7e. インスタンスは、 *note wrap_bio(): d7f. メソッドを
     使用して作成しなければなりません。このメソッドは、‘SSLObject’ イン
     スタンスを作成し、2 つの BIO に束縛します。'incoming' BIO は、
     Python から SSL プロトコルインスタンスにデータを渡すために使用され
     、'outgoing' BIO は、データを反対向きに渡すために使用されます。

     次のメソッドがサポートされています:

        - *note context: 3a96.

        - *note server_side: 3a98.

        - *note server_hostname: d7c.

        - *note session: 199d.

        - *note session_reused: 3a99.

        - *note read(): 1072.

        - *note write(): 1073.

        - *note getpeercert(): 11be.

        - *note get_verified_chain(): 19bc.

        - *note get_unverified_chain(): 19bd.

        - *note selected_alpn_protocol(): 1069.

        - *note selected_npn_protocol(): a78.

        - *note cipher(): 3976.

        - *note shared_ciphers(): 1070.

        - *note compression(): 1361.

        - *note pending(): 3a97.

        - *note do_handshake(): 1071.

        - *note verify_client_post_handshake(): c2b.

        - *note unwrap(): 3a95.

        - *note get_channel_binding(): 1360.

        - *note version(): 106c.

     *note SSLSocket: aeb. と比較すると、このオブジェクトでは以下の機能
     が不足しています。

        - Any form of network IO; ‘recv()’ and ‘send()’ read and write
          only to the underlying *note MemoryBIO: 1066. buffers.

        - 'do_handshake_on_connect' 機構はありません。必ず手動で *note
          do_handshake(): 1071. を呼んで、ハンドシェイクを開始する必要が
          あります。

        - 'suppress_ragged_eofs' は処理されません。プロトコルに違反する
          ファイル末尾状態は、 *note SSLEOFError: 1b1a. 例外を通じて報告
          されます。

        - *note unwrap(): 3a95. メソッドの呼び出しは、下層のソケットを返
          す SSL ソケットとは異なり、何も返しません。

        - *note SSLContext.set_servername_callback(): 11bd. に渡される
          'server_name_callback' コールバックは、1 つ目の引数として
          *note SSLSocket: aeb. インスタンスではなく *note SSLObject:
          d7e. インスタンスを受け取ります。

     *note SSLObject: d7e. の使用に関する注意:

        - *note SSLObject: d7e. 上のすべての IO は *note non-blocking:
          3a5f. です。例えば、*note read(): 1072. は入力 BIO が持つデー
          タよりも多くのデータを必要とする場合、*note SSLWantReadError:
          106d. を送出します。

     バージョン 3.7 で変更: ‘SSLObject’ instances must be created with
     *note wrap_bio(): d7f.  In earlier versions, it was possible to
     create instances directly.  This was never documented or officially
     supported.

SSLObject は、メモリバッファを使用して外界と通信します。*note MemoryBIO:
1066. クラスは、以下のように 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(): 3ab3. を呼ぶことはできません。*note
          eof: 3ab1. 属性は、バッファ内のすべてのデータが読み出された後
          に True になります。


File: python.info,  Node: SSL セッション,  Next: セキュリティで考慮すべき点<3>,  Prev: Memory BIO support,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.3.21 SSL セッション
........................

Added in version 3.6.

 -- クラス: ssl.SSLSession

     *note session: 199d. が使用するセッションオブジェクトです。

      -- の属性: id

      -- の属性: time

      -- の属性: timeout

      -- の属性: ticket_lifetime_hint

      -- の属性: has_ticket


File: python.info,  Node: セキュリティで考慮すべき点<3>,  Next: TLS 1 3,  Prev: SSL セッション,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

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

* Menu:

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


File: python.info,  Node: 最善のデフォルト値,  Next: 手動での設定,  Up: セキュリティで考慮すべき点<3>

5.20.3.23 最善のデフォルト値
............................

'クライアントでの使用' では、セキュリティポリシーによる特殊な要件がない
限りは、 *note create_default_context(): 480. 関数を使用して SSL コンテ
キストを作成することを強くお勧めします。この関数は、システムの信頼済み
CA 証明書をロードし、証明書の検証とホスト名のチェックを有効化し、十分に
セキュアなプロトコルと暗号を選択しようとします。

例として、 *note smtplib.SMTP: b2b. クラスを使用して 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: 355. クラスのコンストラクタを呼び
出すことによって SSL コンテキストを作ると、デフォルトでは証明書検証もホ
スト名チェックも有効になりません。自分で設定を行う場合は、十分なセキュリ
ティレベルを達成するために、以下のパラグラフをお読みください。


File: python.info,  Node: 手動での設定,  Next: マルチプロセス化,  Prev: 最善のデフォルト値,  Up: セキュリティで考慮すべき点<3>

5.20.3.24 手動での設定
......................

* Menu:

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


File: python.info,  Node: 証明書の検証,  Next: プロトコルのバージョン,  Up: 手動での設定

5.20.3.25 証明書の検証
......................

When calling the *note SSLContext: 355. constructor directly, *note
CERT_NONE: 3a6b. 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: 3a5a.  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(): 11be, 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: 3a6d. is enabled.

バージョン 3.7 で変更: Hostname matchings is now performed by OpenSSL.
Python no longer uses ‘match_hostname()’.

サーバモードにおいて、(より上位のレベルでの認証メカニズムではなく) SSL レ
イヤーを使ってあなたのクライアントを認証したいならば、 *note
CERT_REQUIRED: 3a5a. を指定して同じようにクライアントの証明書を検証すべ
きでしょう。


File: python.info,  Node: プロトコルのバージョン,  Next: 暗号の選択,  Prev: 証明書の検証,  Up: 手動での設定

5.20.3.26 プロトコルのバージョン
................................

SSL バージョン 2 と 3 は安全性に欠けると考えられており、使用するのは危険
です。クライアントとサーバ間の互換性を最大限に確保したい場合、プロトコル
バージョンとして *note PROTOCOL_TLS_CLIENT: a76. または *note
PROTOCOL_TLS_SERVER: a77. を使用してください。 SSLv2 と SSLv3 はデフォル
トで無効になっています。

     >>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
     >>> client_context.minimum_version = ssl.TLSVersion.TLSv1_2
     >>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3

The SSL client context created above will only allow TLSv1.2 and TLSv1.3
(if supported by your system) connections to a server.  *note
PROTOCOL_TLS_CLIENT: a76. implies certificate validation and hostname
checks by default.  You have to load certificates into the context.


File: python.info,  Node: 暗号の選択,  Prev: プロトコルのバージョン,  Up: 手動での設定

5.20.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(): 3a9c. 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(): ede. 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.20.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(): 3a65. or *note
RAND_bytes(): 747. is sufficient.


File: python.info,  Node: TLS 1 3,  Prev: セキュリティで考慮すべき点<3>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.20.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(): 3a9c. cannot enable or disable any TLS
     1.3 ciphers yet, but *note SSLContext.get_ciphers(): ede. returns
     them.

   - Session tickets are no longer sent as part of the initial handshake
     and are handled differently.  *note SSLSocket.session: 199d. and
     *note SSLSession: edd. 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: fa5. クラス

     下位レイヤーの *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.20.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 ‘selectors’ module
     instead, unless they want precise control over the OS-level
     primitives used.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

このモジュールは以下を定義します:

 -- 例外: select.error

     *note OSError: 2c2. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c2. のエイリアスになりました。

 -- の関数: select.devpoll ()

     Returns a ‘/dev/poll’ polling object; see section *note /dev/poll
     polling objects: 3ac6. below for the methods supported by devpoll
     objects.

     ‘devpoll()’ オブジェクトはインスタンス化時に許されるファイル記述子
     の数にリンクされます。プログラムがこの値を減らす場合 ‘devpoll()’ は
     失敗します。プログラムがこの値を増やす場合 ‘devpoll()’ は有効なファ
     イル記述子の不完全なリストを返すことがあります。

     新しいファイル記述子は *note 継承不可: 1100. です。

     Added in version 3.3.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

     *note Availability: 2199.: Solaris.

 -- の関数: select.epoll (sizehint=-1, flags=0)

     Return an edge polling object, which can be used as Edge or Level
     Triggered interface for I/O events.

     '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
     Edge and level trigger polling (epoll) objects: 3ac7. 節を参照して
     ください。

     ‘epoll’ オブジェクトはコンテキストマネジメントプロトコルをサポート
     しています。 *note with: 187. 文内で使用された場合、新たなファイル
     記述子はブロックの最後で自動的に閉じられます。

     新しいファイル記述子は *note 継承不可: 1100. です。

     バージョン 3.3 で変更: 'flags' 引数が追加されました。

     バージョン 3.4 で変更: *note with: 187. 文のサポートが追加されまし
     た。新しいファイル記述子が継承不可になりました。

     バージョン 3.4 で非推奨: 'flags' パラメータ。 現在ではデフォルトで
     ‘select.EPOLL_CLOEXEC’ が使われます。 ファイルディスクリプタを継承
     可能にするには *note os.set_inheritable(): 1102. を使ってください。

     *note Availability: 2199.: Linux >= 2.5.44.

 -- の関数: select.poll ()

     Returns a polling object, which supports registering and
     unregistering file descriptors, and then polling them for I/O
     events; see section *note Polling objects: 3ac8. below for the
     methods supported by polling objects.

     *note Availability: 2199.: Unix.

 -- の関数: select.kqueue ()

     Returns a kernel queue object; see section *note Kqueue objects:
     3ac9. below for the methods supported by kqueue objects.

     新しいファイル記述子は *note 継承不可: 1100. です。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

     *note Availability: 2199.: BSD, macOS.

 -- の関数: select.kevent (ident, filter=KQ_FILTER_READ,
          flags=KQ_EV_ADD, fflags=0, data=0, udata=0)

     Returns a kernel event object; see section *note Kevent objects:
     3acb. below for the methods supported by kevent objects.

     *note Availability: 2199.: BSD, macOS.

 -- の関数: 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(): 181b. 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
     ファイルオブジェクト: 13df. (例えば ‘sys.stdin’ や、 *note open():
     318. または *note os.popen(): 31c. が返すオブジェクト)、 *note
     socket.socket(): fa5. が返すソケットオブジェクトです。 'ラッパー
     <wrapper>' クラスを自分で定義することもできます。この場合、適切な
     (まったくデタラメな数ではなく本物のファイル記述子を返す) *note
     fileno(): 181b. メソッドを持つ必要があります。

          注釈: 
          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: f8c. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については 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(): fa4, ‘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: 2199.: Unix

     Added in version 3.2.

* Menu:

* /dev/poll polling objects::
* Edge and level trigger polling (epoll) objects: Edge and level trigger polling epoll objects.
* Polling objects::
* Kqueue objects::
* Kevent objects::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/

   (2) https://peps.python.org/pep-0475/


File: python.info,  Node: /dev/poll polling objects,  Next: Edge and level trigger polling epoll objects,  Up: select --- I/O 完了の待機

5.20.4.1 ‘/dev/poll’ polling objects
....................................

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(): 3141. メソッド呼び出しでは、そのファイル記述子に処理
     待ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整
     数値を返す *note fileno(): 181b. メソッドを持つオブジェクトを取りま
     す。ファイルオブジェクトも ‘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(): 3acf. followed by a *note
     register(): 3acd.  It is (a bit) more efficient than doing the same
     explicitly.

 -- メソッド: devpoll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3acd. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 181b. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子の削除を試みるのは安全に無視されます
     。

 -- メソッド: devpoll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、 -1 であったり、ある
     いは *note None: 886. の場合、そのポーリングオブジェクトが監視して
     いる何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f8c. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: Edge and level trigger polling epoll objects,  Next: Polling objects,  Prev: /dev/poll polling objects,  Up: select --- I/O 完了の待機

5.20.4.2 Edge and level trigger polling (epoll) objects
.......................................................

     ‘https://linux.die.net/man/4/epoll’

     The 'eventmask' is a bit mask using the following constants:

     定数                          意味
                                   
     -----------------------------------------------------------------------------------
                                   
     ‘EPOLLIN’                     Available for read.
                                   
                                   
     ‘EPOLLOUT’                    Available for write.
                                   
                                   
     ‘EPOLLPRI’                    Urgent data for read.
                                   
                                   
     ‘EPOLLERR’                    Error condition happened on the associated fd.
                                   
                                   
     ‘EPOLLHUP’                    Hang up happened on the associated fd.
                                   
                                   
     ‘EPOLLET’                     Set Edge Trigger behavior, the default is Level
                                   Trigger behavior.
                                   
                                   
     ‘EPOLLONESHOT’                Set one-shot behavior.  After one event is pulled
                                   out, the fd is internally disabled.
                                   
                                   
     ‘EPOLLEXCLUSIVE’              Wake only one epoll object when the associated fd
                                   has an event.  The default (if this flag is not
                                   set) is to wake all epoll objects polling on an
                                   fd.
                                   
                                   
     ‘EPOLLRDHUP’                  ストリームソケットの他端が接続を切断したか、接続の
                                   書き込み側のシャットダウンを行った。
                                   
                                   
     ‘EPOLLRDNORM’                 ‘EPOLLIN’ と同じ
                                   
                                   
     ‘EPOLLRDBAND’                 優先データバンドを読み込める。
                                   
                                   
     ‘EPOLLWRNORM’                 Equivalent to ‘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])

     Register a file descriptor 'fd' with the epoll object.

 -- メソッド: epoll.modify (fd, eventmask)

     Modify a registered file descriptor 'fd'.

 -- メソッド: epoll.unregister (fd)

     epoll オブジェクトから登録されたファイル記述子 'fd' を削除します。

     バージョン 3.9 で変更: The method no longer ignores the *note
     EBADF: b58. error.

 -- メソッド: epoll.poll (timeout=None, maxevents=-1)

     Wait for events.  timeout in seconds (float)

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f8c. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: Polling objects,  Next: Kqueue objects,  Prev: Edge and level trigger polling epoll objects,  Up: select --- I/O 完了の待機

5.20.4.3 Polling objects
........................

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(): 3141. メソッド呼び出しでは、そのファイル記述子に処理
     待ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整
     数値を返す *note fileno(): 181b. メソッドを持つオブジェクトを取りま
     す。ファイルオブジェクトも ‘fileno()’ を実装しているので、引数とし
     て使うことができます。

     'eventmask' はオプションのビットマスクで、どの種類の I/O イベントを
     監視したいかを記述します。この値は以下の表で述べる定数 ‘POLLIN’ 、
     ‘POLLPRI’ 、および ‘POLLOUT’ の組み合わせにすることができます。ビッ
     トマスクを指定しない場合、標準の値が使われ、 3 種類のイベント全てに
     対して監視が行われます。

     定数                    意味
                             
     ------------------------------------------------------------------------
                             
     ‘POLLIN’                There is data to read.
                             
                             
     ‘POLLPRI’               There is urgent data to read.
                             
                             
     ‘POLLOUT’               Ready for output: writing will not block.
                             
                             
     ‘POLLERR’               Error condition of some sort.
                             
                             
     ‘POLLHUP’               Hung up.
                             
                             
     ‘POLLRDHUP’             Stream socket peer closed connection, or shut
                             down writing half of connection.
                             
                             
     ‘POLLNVAL’              Invalid request: descriptor not open.
                             

     登録済みのファイル記述子を登録してもエラーにはならず、一度だけ登録
     した場合と同じ効果になります。

 -- メソッド: poll.modify (fd, eventmask)

     登録されているファイル記述子 'fd' を変更する。これは、
     ‘register(fd, eventmask)’ と同じ効果を持ちます。登録されていないフ
     ァイル記述子に対してこのメソッドを呼び出すと、 errno ‘ENOENT’ で
     *note OSError: 2c2. 例外が発生します。

 -- メソッド: poll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3ad7. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 181b. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子を登録解除しようとすると *note
     KeyError: 5e7. 例外が送出されます。

 -- メソッド: poll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、負の値であったり、あ
     るいは *note None: 886. の場合、そのポーリングオブジェクトが監視し
     ている何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f8c. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: Kqueue objects,  Next: Kevent objects,  Prev: Polling objects,  Up: select --- I/O 完了の待機

5.20.4.4 Kqueue objects
.......................

 -- メソッド: 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: f8c. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: Kevent objects,  Prev: Kqueue objects,  Up: select --- I/O 完了の待機

5.20.4.5 Kevent objects
.......................

‘https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2’

 -- の属性: kevent.ident

     イベントを特定するための値。この値は、フィルタにもよりますが、大抵
     の場合はファイル記述子です。コンストラクタでは、 ident として、整数
     値か *note fileno(): 181b. メソッドを持ったオブジェクトを渡せます。
     kevent は内部で整数値を保存します。

 -- の属性: kevent.filter

     カーネルフィルタの名前。

     定数                            意味
                                     
     ----------------------------------------------------------------------------------
                                     
     ‘KQ_FILTER_READ’                Takes a descriptor and returns whenever there
                                     is data available to read.
                                     
                                     
     ‘KQ_FILTER_WRITE’               Takes a descriptor and returns whenever there
                                     is data available to write.
                                     
                                     
     ‘KQ_FILTER_AIO’                 AIO requests.
                                     
                                     
     ‘KQ_FILTER_VNODE’               Returns when one or more of the requested
                                     events watched in 'fflag' occurs.
                                     
                                     
     ‘KQ_FILTER_PROC’                Watch for events on a process ID.
                                     
                                     
     ‘KQ_FILTER_NETDEV’              Watch for events on a network device (not
                                     available on macOS).
                                     
                                     
     ‘KQ_FILTER_SIGNAL’              Returns whenever the watched signal is
                                     delivered to the process.
                                     
                                     
     ‘KQ_FILTER_TIMER’               Establishes an arbitrary timer.
                                     

 -- の属性: kevent.flags

     フィルタアクション。

     定数                            意味
                                     
     -----------------------------------------------------------------------------------
                                     
     ‘KQ_EV_ADD’                     Adds or modifies an event.
                                     
                                     
     ‘KQ_EV_DELETE’                  Removes an event from the queue.
                                     
                                     
     ‘KQ_EV_ENABLE’                  Permits control() to return the event.
                                     
                                     
     ‘KQ_EV_DISABLE’                 Disables event.
                                     
                                     
     ‘KQ_EV_ONESHOT’                 Removes event after first occurrence.
                                     
                                     
     ‘KQ_EV_CLEAR’                   Reset the state after an event is retrieved.
                                     
                                     
     ‘KQ_EV_SYSFLAGS’                Internal event.
                                     
                                     
     ‘KQ_EV_FLAG1’                   Internal event.
                                     
                                     
     ‘KQ_EV_EOF’                     Filter-specific EOF condition.
                                     
                                     
     ‘KQ_EV_ERROR’                   See return values.
                                     

 -- の属性: kevent.fflags

     Filter-specific flags.

     ‘KQ_FILTER_READ’ と ‘KQ_FILTER_WRITE’ フィルタのフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_LOWAT’                  Low water mark of a socket buffer.
                                      

     ‘KQ_FILTER_VNODE’ フィルタのフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_DELETE’                 'unlink()' was called.
                                      
                                      
     ‘KQ_NOTE_WRITE’                  A write occurred.
                                      
                                      
     ‘KQ_NOTE_EXTEND’                 The file was extended.
                                      
                                      
     ‘KQ_NOTE_ATTRIB’                 An attribute was changed.
                                      
                                      
     ‘KQ_NOTE_LINK’                   The link count has changed.
                                      
                                      
     ‘KQ_NOTE_RENAME’                 The file was renamed.
                                      
                                      
     ‘KQ_NOTE_REVOKE’                 Access to the file was revoked.
                                      

     ‘KQ_FILTER_PROC’ フィルタフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_EXIT’                   The process has exited.
                                      
                                      
     ‘KQ_NOTE_FORK’                   The process has called 'fork()'.
                                      
                                      
     ‘KQ_NOTE_EXEC’                   The process has executed a new process.
                                      
                                      
     ‘KQ_NOTE_PCTRLMASK’              Internal filter flag.
                                      
                                      
     ‘KQ_NOTE_PDATAMASK’              Internal filter flag.
                                      
                                      
     ‘KQ_NOTE_TRACK’                  Follow a process across 'fork()'.
                                      
                                      
     ‘KQ_NOTE_CHILD’                  Returned on the child process for
                                      'NOTE_TRACK'.
                                      
                                      
     ‘KQ_NOTE_TRACKERR’               Unable to attach to a child.
                                      

     ‘KQ_FILTER_NETDEV’ フィルタフラグ (macOS では利用不可):

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_LINKUP’                 Link is up.
                                      
                                      
     ‘KQ_NOTE_LINKDOWN’               Link is down.
                                      
                                      
     ‘KQ_NOTE_LINKINV’                Link state is invalid.
                                      

 -- の属性: kevent.data

     Filter-specific data.

 -- の属性: kevent.udata

     User-defined value.


File: python.info,  Node: selectors --- 高水準の I/O 多重化,  Next: signal --- 非同期イベントにハンドラーを設定する,  Prev: select --- I/O 完了の待機,  Up: ネットワーク通信とプロセス間通信

5.20.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.20.5.1 はじめに
.................

このモジュールにより、*note select: c6. モジュールプリミティブに基づく高
水準かつ効率的な I/O の多重化が行えます。OS 水準のプリミティブを使用した
正確な制御を求めない限り、このモジュールの使用が推奨されます。

このモジュールは *note BaseSelector: 3aea. 抽象基底クラスと、いくつかの
具象実装 (*note KqueueSelector: 39b3, *note EpollSelector: dd4...)  を定
義しており、これらは複数のファイルオブジェクトの I/O の準備状況の通知の
待機に使用できます。以下では、 "ファイルオブジェクト" は、*note
fileno(): 181b. メソッドを持つあらゆるオブジェクトか、あるいは Raw ファ
イル記述子を意味します。*note ファイルオブジェクト: 13df. を参照してくだ
さい。

*note DefaultSelector: 3aeb. は、現在のプラットフォームで利用できる、も
っとも効率的な実装の別名になります: これはほとんどのユーザーにとってのデ
フォルトの選択になるはずです。

     注釈: プラットフォームごとにサポートされているファイルオブジェクト
     のタイプは異なります: Windows ではソケットはサポートされますが、パ
     イプはされません。Unix では両方がサポートされます (その他の fifo や
     スペシャルファイルデバイスなどのタイプもサポートされます)。

参考
....

*note select: c6.

     低水準の I/O 多重化モジュールです。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。


File: python.info,  Node: クラス<4>,  Next: 使用例<29>,  Prev: はじめに<11>,  Up: selectors --- 高水準の I/O 多重化

5.20.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: 3aef. はそれの下層のファイルディスクリプタ、選択
     したイベントマスク、および付属データへのファイルオブジェクトの関連
     付けに使用される *note namedtuple: 4e0. です。いくつかの *note
     BaseSelector: 3aea. メソッドを返します。

      -- の属性: fileobj

          登録されたファイルオブジェクトです。

      -- の属性: fd

          下層のファイル記述子です。

      -- の属性: events

          このファイルオブジェクトで待機しなければならないイベントです。

      -- の属性: data

          このファイルオブジェクトに関連付けられたオプションの不透明型
          (Opaque) データです。例えば、これはクライアントごとのセッショ
          ン ID を格納するために使用できます。

 -- クラス: selectors.BaseSelector

     *note BaseSelector: 3aea. は複数のファイルオブジェクトの I/O イベン
     トの準備状況の待機に使用されます。これはファイルストリームを登録、
     登録解除、およびこれらのストリームでの I/O イベントを待機 (オプショ
     ンでタイムアウト) するメソッドをサポートします。これは抽象基底クラ
     スであるため、インスタンスを作成できません。使用する実装を明示的に
     指定したい、そしてプラットフォームがそれをサポートしている場合は、
     代わりに *note DefaultSelector: 3aeb. を使用するか、*note
     SelectSelector: 39b0. や *note KqueueSelector: 39b3. などの一つを使
     用します。‘BaseSelector’ とその具象実装は *note
     コンテキストマネージャー: 1e3. プロトコルをサポートしています。

      -- メソッド: abstractmethod register (fileobj, events, data=None)

          I/O イベントを監視するファイルオブジェクトをセレクションに登録
          します。

          'fileobj' は監視するファイルオブジェクトです。これは整数のファ
          イル記述子か、‘fileno()’ メソッドを持つオブジェクトのどちらか
          になります。'events' は監視するイベントのビット幅マスクになり
          ます。'data' は不透明型 (Opaque) オブジェクトです。

          これは新しい *note SelectorKey: 3aef. インスタンスを返します。
          不正なイベントマスク化ファイル記述子のときは *note ValueError:
          2ee. が、ファイルオブジェクトがすでに登録済みのときは *note
          KeyError: 5e7. が送出されます。

      -- メソッド: abstractmethod unregister (fileobj)

          ファイルオブジェクトのセレクション登録を解除し、監視対象から外
          します。ファイルオブジェクトの登録解除はそのクローズより前に行
          われます。

          'fileobj' は登録済みのファイルオブジェクトでなければなりません
          。

          関連付けられた *note SelectorKey: 3aef. インスタンスを返します
          。'fileobj' が登録されていない場合 *note KeyError: 5e7. を送出
          します。'fileobj' が不正な場合 (例えば 'fileobj' に ‘fileno()’
          メソッドが無い場合や ‘fileno()’ メソッドの戻り値が不正な場合)
          *note ValueError: 2ee. を送出します。

      -- メソッド: modify (fileobj, events, data=None)

          登録されたファイルオブジェクトの監視されたイベントや付属データ
          を変更します。

          より効率的に実装できる点を除けば、
          ‘BaseSelector.unregister(fileobj)’ に続けて
          ‘BaseSelector.register(fileobj, events, data)’ を行うのと等価
          です。

          新たな *note SelectorKey: 3aef. インスタンスを返します。 イベ
          ントマスクやファイル記述子が不正な場合は *note ValueError:
          2ee. を、ファイルオブジェクトが登録されていない場合は *note
          KeyError: 5e7. を送出します。

      -- メソッド: abstractmethod select (timeout=None)

          登録されたいくつかのファイルオブジェクトが準備できたか、タイム
          アウトするまで待機します。

          ‘timeout > 0’ の場合、最大待機時間を秒で指定します。 ‘timeout
          <= 0’ の場合、この関数の呼び出しはブロックせず、 現在準備でき
          ているファイルオブジェクトを報告します。 'timeout' が ‘None’ の
          場合、監視しているファイルオブジェクトの一つが準備できるまでブ
          ロックします。

          この関数は ‘(key, events)’ タプルのリストを返します。準備でき
          たファイルオブジェクトにつき1タプルです。

          'key' は準備状態のファイルオブジェクトに対応する *note
          SelectorKey: 3aef. インスタンスです。 'events' はそのファイル
          オブジェクトで準備が完了したイベントのビットマスクです。

               注釈: このメソッドは、現在のプロセスで信号を受信した場合
               、どのファイルオブジェクトも準備完了にならないうちに、ま
               たはタイムアウトが経過する前に返ることがあります。その場
               合、空のリストが返されます。

          バージョン 3.5 で変更: このセレクタは、シグナルによって中断さ
          れた時に、シグナルハンドラが例外を起こさなかった場合、空のイベ
          ントリストを返すのではなく、再計算されたタイムアウトによってリ
          トライするようになりました (この論拠については PEP 475(1) を参
          照してください)。

      -- メソッド: close ()

          セレクタを閉じます。

          下層のリソースがすべて解放されたことを確かめるために呼ばれなけ
          ればなりません。一旦閉じられたセレクタは使ってはいけません。

      -- メソッド: get_key (fileobj)

          登録されたファイルオブジェクトに関連付けられたキーを返します。

          そのファイルオブジェクトに関連付けられた *note SelectorKey:
          3aef. インスタンスを返します。そのファイルオブジェクトが登録さ
          れていない場合 *note KeyError: 5e7. を送出します。

      -- メソッド: abstractmethod get_map ()

          ファイルオブジェクトからセレクタキーへのマッピングを返します。

          これは、登録済みのファイルオブジェクトを、それらに関連づけられ
          た *note SelectorKey: 3aef. インスタンスにマッピングする *note
          Mapping: acb. のインスタンスを返します。

 -- クラス: selectors.DefaultSelector

     デフォルトの selector クラスで、現在のプラットフォームで利用できる
     最も効率的な実装を使用しています。大半のユーザはこれをデフォルトに
     すべきです。

 -- クラス: selectors.SelectSelector

     *note select.select(): fa4. を基底とするセレクタです。

 -- クラス: selectors.PollSelector

     *note select.poll(): 3141. を基底とするセレクタです。

 -- クラス: selectors.EpollSelector

     *note select.epoll(): 119a. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.epoll(): 119a. オブジェクトが使用している
          ファイル記述子を返します。

 -- クラス: selectors.DevpollSelector

     *note select.devpoll(): 119c. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.devpoll(): 119c. オブジェクトが使用してい
          るファイル記述子を返します。

     Added in version 3.5.

 -- クラス: selectors.KqueueSelector

     *note select.kqueue(): 1aa4. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.kqueue(): 1aa4. オブジェクトが使用している
          ファイル記述子を返します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: 使用例<29>,  Prev: クラス<4>,  Up: selectors --- 高水準の I/O 多重化

5.20.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.20.6 ‘signal’ -- 非同期イベントにハンドラーを設定する
-------------------------------------------------------

'ソースコード:' Lib/signal.py(1)

__________________________________________________________________

このモジュールでは Python でシグナルハンドラを使うための機構を提供します
。

* Menu:

* 一般的なルール::
* モジュールの内容: モジュールの内容<3>.
* 使用例: 使用例<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: モジュールの内容<3>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.1 一般的なルール
.......................

*note signal.signal(): 1350. 関数を使って、シグナルを受信した時に実行さ
れるハンドラを定義することができます。 Python は標準でごく少数のシグナル
ハンドラをインストールしています: *note SIGPIPE: 3b02. は無視され (した
がって、 pipe や socket に対する書き込みで生じたエラーは通常の Python 例
外として報告されます)、 *note SIGINT: 255. は *note KeyboardInterrupt:
bc9. 例外に変換されます。親プロセスが変更していない場合は、これらはどれ
も上書きすることができます。

特定のシグナルに対するハンドラが一度設定されると、明示的にリセットしない
かぎり設定されたままになります (Python は背後の実装系に関係なく BSD 形式
のインターフェースをエミュレートします)。例外は *note SIGCHLD: 317c. の
ハンドラで、この場合は背後の実装系の仕様に従います。

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.20.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: 3b04. 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: 1291. or *note SIGSEGV: 1290. 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: 2743. for a
     discussion.


File: python.info,  Node: シグナルとスレッド,  Prev: Python のシグナルハンドラの実行,  Up: 一般的なルール

5.20.6.3 シグナルとスレッド
...........................

Python のシグナルハンドラは、もしシグナルを受け取ったのが別のスレッドだ
ったとしても、常にメインインタープリターの Python のメインスレッドで実行
されます。このためシグナルをスレッド間通信に使うことはできません。代わり
に *note threading: f3. モジュールが提供している同期プリミティブを利用で
きます。

また、メインインタープリターのメインスレッドだけが新しいシグナルハンドラ
を登録できます。

     警告: Synchronization primitives such as *note threading.Lock:
     1a54. should not be used within signal handlers.  Doing so can lead
     to unexpected deadlocks.


File: python.info,  Node: モジュールの内容<3>,  Next: 使用例<30>,  Prev: 一般的なルール,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.4 モジュールの内容
.........................

バージョン 3.5 で変更: signal (SIG*), handler (*note SIG_DFL: 1c0f,
*note SIG_IGN: 1c0e.) and sigmask (*note SIG_BLOCK: 3b08, *note
SIG_UNBLOCK: 3b09, *note SIG_SETMASK: 3b0a.) related constants listed
below were turned into *note enums: edf. (*note Signals: 3b0b, *note
Handlers: 3b0c. and *note Sigmasks: 3b0d. respectively).  *note
getsignal(): 1a87, *note pthread_sigmask(): 134c, *note sigpending():
134e. and *note sigwait(): 134f. functions return human-readable ‘enums’
as ‘Signals’ objects.

The signal module defines three enums:

 -- クラス: signal.Signals

     *note enum.IntEnum: edf. collection of SIG* constants and the
     CTRL_* constants.

     Added in version 3.5.

 -- クラス: signal.Handlers

     *note enum.IntEnum: edf. collection of the constants *note SIG_DFL:
     1c0f. and *note SIG_IGN: 1c0e.

     Added in version 3.5.

 -- クラス: signal.Sigmasks

     *note enum.IntEnum: edf. collection of the constants *note
     SIG_BLOCK: 3b08, *note SIG_UNBLOCK: 3b09. and *note SIG_SETMASK:
     3b0a.

     *note Availability: 2199.: 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: 3b0e. に対する標準の動作はコアダンプと終了で、 *note
     SIGCHLD: 317c. に対する標準の動作は単にシグナルの無視です。

 -- データ: signal.SIG_IGN

     もう一つの標準シグナル処理オプションで、受け取ったシグナルを単に無
     視します。

 -- データ: signal.SIGABRT

     Abort signal from ‘abort(3)(3)’.

 -- データ: signal.SIGALRM

     Timer signal from ‘alarm(2)(4)’.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGBREAK

     Interrupt from keyboard (CTRL + BREAK).

     *note Availability: 2199.: Windows.

 -- データ: signal.SIGBUS

     Bus error (bad memory access).

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGCHLD

     Child process stopped or terminated.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGCLD

     *note SIGCHLD: 317c. のエイリアスです。

     *note Availability: 2199.: not macOS.

 -- データ: signal.SIGCONT

     Continue the process if it is currently stopped

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGFPE

     Floating-point exception.  For example, division by zero.

     参考
     ....

     *note ZeroDivisionError: b43. 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: 2199.: Unix.

 -- データ: signal.SIGILL

     Illegal instruction.

 -- データ: signal.SIGINT

     Interrupt from keyboard (CTRL + C).

     Default action is to raise *note KeyboardInterrupt: bc9.

 -- データ: signal.SIGKILL

     Kill signal.

     It cannot be caught, blocked, or ignored.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGPIPE

     Broken pipe: write to pipe with no readers.

     Default action is to ignore the signal.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGPROF

     Profiling timer expired.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGQUIT

     Terminal quit signal.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGSEGV

     Segmentation fault: invalid memory reference.

 -- データ: signal.SIGSTOP

     Stop executing (cannot be caught or ignored).

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGSTKFLT

     Stack fault on coprocessor.  The Linux kernel does not raise this
     signal: it can only be raised in user space.

     *note Availability: 2199.: 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: 2199.: Unix.

 -- データ: signal.SIGUSR2

     User-defined signal 2.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGVTALRM

     Virtual timer expired.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGWINCH

     Window resize signal.

     *note Availability: 2199.: Unix.

 -- データ: signal.SIGXCPU

     CPU time limit exceeded.

     *note Availability: 2199.: Unix.

 -- データ: SIG*

     All the signal numbers are defined symbolically.  For example, the
     hangup signal is defined as *note signal.SIGHUP: 3b12.; 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(): 1583. でだけ利用できます。

     *note Availability: 2199.: Windows.

     Added in version 3.2.

 -- データ: signal.CTRL_BREAK_EVENT

     ‘CTRL’+‘BREAK’ キーストロークに該当するシグナル。このシグナルは
     *note os.kill(): 1583. でだけ利用できます。

     *note Availability: 2199.: Windows.

     Added in version 3.2.

 -- データ: signal.NSIG

     One more than the number of the highest signal number.  Use *note
     valid_signals(): 3b1a. to get valid signal numbers.

 -- データ: signal.ITIMER_REAL

     実時間でデクリメントするインターバルタイマーです。タイマーが発火し
     たときに *note SIGALRM: 3b0f. を送ります。

 -- データ: signal.ITIMER_VIRTUAL

     プロセスの実行時間だけデクリメントするインターバルタイマーです。タ
     イマーが発火したときに *note SIGVTALRM: 3b17. を送ります。

 -- データ: signal.ITIMER_PROF

     プロセスの実行中と、システムがそのプロセスのために実行している時間
     だけデクリメントするインターバルタイマーです。ITIMER_VIRTUAL と組み
     合わせて、このタイマーはよくアプリケーションがユーザー空間とカーネ
     ル空間で消費した時間のプロファイリングに利用されます。タイマーが発
     火したときに *note SIGPROF: 3b13. を送ります。

 -- データ: signal.SIG_BLOCK

     *note pthread_sigmask(): 134c. の 'how' 引数に渡せる値で、シグナル
     がブロックされることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_UNBLOCK

     *note pthread_sigmask(): 134c. の 'how' 引数に渡せる値で、シグナル
     がブロック解除されることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_SETMASK

     *note pthread_sigmask(): 134c. の 'how' 引数に渡せる値で、シグナル
     が置換されることを意味します。

     Added in version 3.3.

The ‘signal’ module defines one exception:

 -- 例外: signal.ItimerError

     背後の *note setitimer(): 3b1f. または *note getitimer(): 3b20. 実
     装からエラーを通知するために送出されます。無効なインタバルタイマー
     や負の時間が ‘setitimer()’ に渡された場合、このエラーを予期してくだ
     さい。このエラーは *note OSError: 2c2. を継承しています。

     Added in version 3.3: このエラーは以前は *note IOError: 1262. のサ
     ブタイプでしたが、 *note OSError: 2c2. のエイリアスになりました。

The ‘signal’ module defines the following functions:

 -- の関数: signal.alarm (time)

     'time' がゼロでない値の場合、この関数は 'time' 秒後頃に *note
     SIGALRM: 3b0f. をプロセスに送るように要求します。それ以前にスケジュ
     ールしたアラームはキャンセルされます (常に一つのアラームしかスケジ
     ュールできません)。この場合、戻り値は以前に設定されたアラームシグナ
     ルが通知されるまであと何秒だったかを示す値です。 'time' がゼロの場
     合、アラームは一切スケジュールされず、現在スケジュールされているア
     ラームがキャンセルされます。戻り値がゼロの場合、現在アラームがスケ
     ジュールされていないことを示します。

     *note Availability: 2199.: Unix.

     See the man page ‘alarm(2)(8)’ for further information.

 -- の関数: signal.getsignal (signalnum)

     シグナル 'signalnum' に対する現在のシグナルハンドラを返します。戻り
     値は呼び出し可能な Python オブジェクトか、 *note signal.SIG_IGN:
     1c0e.、 *note signal.SIG_DFL: 1c0f.、および *note None: 886. といっ
     た特殊な値のいずれかです。ここで ‘signal.SIG_IGN’ は以前そのシグナ
     ルが無視されていたことを示し、 ‘signal.SIG_DFL’ は以前そのシグナル
     の標準の処理方法が使われていたことを示し、 ‘None’ はシグナルハンド
     ラがまだ Python によってインストールされていないことを示します。

 -- の関数: signal.strsignal (signalnum)

     Returns the description of signal 'signalnum', such as "Interrupt"
     for *note SIGINT: 255.  Returns *note None: 886. if 'signalnum' has
     no description.  Raises *note ValueError: 2ee. 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: 2199.: Unix.

     See the man page ‘signal(2)(9)’ for further information.

     *note sigwait(): 134f, *note sigwaitinfo(): faf, *note
     sigtimedwait(): fae. *note sigpending(): 134e. も参照してください。

 -- の関数: 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: 2199.: Linux >= 5.1, Android >= *note
     build-time: d87. 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:
     3b06.  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: f8c.

     Use *note threading.get_ident(): 1376. or the *note ident: 31d1.
     attribute of *note threading.Thread: 177. 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 監査イベント: 1ccb.
     ‘signal.pthread_kill’ を送出します。

     *note Availability: 2199.: Unix.

     See the man page ‘pthread_kill(3)(11)’ for further information.

     *note os.kill(): 1583. を参照してください。

     Added in version 3.3.

 -- の関数: signal.pthread_sigmask (how, mask)

     これを呼び出すスレッドにセットされているシグナルマスクを取り出した
     り変更したりします。シグナルマスクは、呼び出し側のために現在どのシ
     グナルの配送がブロックされているかを示す集合 (set) です。呼び出し前
     のもとのシグナルマスクを集合として返却します。

     この関数の振る舞いは 'how' に依存して以下のようになります。

        * *note SIG_BLOCK: 3b08.: 'mask' で指定されるシグナルが現時点の
          シグナルマスクに追加されます。

        * *note SIG_UNBLOCK: 3b09.: 'mask' で指定されるシグナルが現時点
          のシグナルマスクから取り除かれます。もともとブロックされていな
          いシグナルをブロック解除しようとしても問題ありません。

        * *note SIG_SETMASK: 3b0a.: シグナルマスク全体を 'mask' としてセ
          ットします。

     'mask' はシグナル番号の集合です (例えば {*note signal.SIGINT: 255,
     *note signal.SIGTERM: 15fd.})。全てのシグナルを含む全集合として
     *note valid_signals(): 3b1a. を使うことが出来ます。

     呼び出しスレッドにセットされたシグナルマスクを問い合わせるには例え
     ば ‘signal.pthread_sigmask(signal.SIG_BLOCK, [])’ とします。

     *note SIGKILL: d54. and *note SIGSTOP: 3b14. cannot be blocked.

     *note Availability: 2199.: Unix.

     See the man page ‘sigprocmask(2)(12)’ and ‘pthread_sigmask(3)(13)’
     for further information.

     *note pause(): 3b22, *note sigpending(): 134e, *note sigwait():
     134f. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.setitimer (which, seconds, interval=0.0)

     Sets given interval timer (one of *note signal.ITIMER_REAL: 3b1b,
     *note signal.ITIMER_VIRTUAL: 3b1c. or *note signal.ITIMER_PROF:
     3b1d.) specified by 'which' to fire after 'seconds' (float is
     accepted, different from *note alarm(): 3b21.) and after that every
     'interval' seconds (if 'interval' is non-zero).  The interval timer
     specified by 'which' can be cleared by setting 'seconds' to zero.

     インターバルタイマーが起動したとき、シグナルがプロセスに送られます
     。送られるシグナルは利用されたタイマーの種類に依存します。 *note
     signal.ITIMER_REAL: 3b1b. の場合は *note SIGALRM: 3b0f. が、 *note
     signal.ITIMER_VIRTUAL: 3b1c. の場合は *note SIGVTALRM: 3b17. が、
     *note signal.ITIMER_PROF: 3b1d. の場合は *note SIGPROF: 3b13. が送
     られます。

     The old values are returned as a tuple: (delay, interval).

     無効なインターバルタイマーを渡すと *note ItimerError: 3b1e. 例外が
     発生します。

     *note Availability: 2199.: Unix.

 -- の関数: signal.getitimer (which)

     'which' で指定されたインターバルタイマーの現在の値を返します。

     *note Availability: 2199.: 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
     メインインタープリターのメインスレッド: 3b06. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 2ee. 例外が発生します。

     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: d2f. の場合、 'signalnum' シグナルに中断されたシステムコール
     は再実行されます。それ以外の場合、システムコールは中断されます。戻
     り値はありません。

     *note Availability: 2199.: 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: 1c0e. あるいは *note
     signal.SIG_DFL: 1c0f. といった特殊な値にすることができます。以前に
     使われていたシグナルハンドラが返されます (上記の *note getsignal():
     1a87. の記述を参照してください)。 (さらに詳しい情報については Unix
     マニュアルページ ‘signal(2)(15)’ を参照してください。)

     スレッドが有効な場合、この関数は *note
     メインインタープリターのメインスレッド: 3b06. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 2ee. 例外が発生します。

     'handler' は二つの引数とともに呼び出されます: シグナル番号、および
     現在のスタックフレーム (‘None’ またはフレームオブジェクト; フレーム
     オブジェクトについての記述は *note 標準型の階層における説明: 8f0. か
     、 *note inspect: 82. モジュールの属性の説明を参照してください)。

     On Windows, ‘signal()’ can only be called with *note SIGABRT: 1292,
     *note SIGFPE: 1291, *note SIGILL: 1294, *note SIGINT: 255, *note
     SIGSEGV: 1290, *note SIGTERM: 15fd, or *note SIGBREAK: 3b10.  A
     *note ValueError: 2ee. 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: 2199.: Unix.

     See the man page ‘sigpending(2)(16)’ for further information.

     *note pause(): 3b22, *note pthread_sigmask(): 134c, *note
     sigwait(): 134f. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.sigwait (sigset)

     'sigset' 集合で指定されたシグナルのうちどれか一つが届くまで呼び出し
     スレッドを一時停止します。この関数はそのシグナルを受け取ると (それ
     を保留シグナルリストから取り除いて) そのシグナル番号を返します。

     *note Availability: 2199.: Unix.

     See the man page ‘sigwait(3)(17)’ for further information.

     *note pause(): 3b22, *note pthread_sigmask(): 134c, *note
     sigpending(): 134e, *note sigwaitinfo(): faf, *note sigtimedwait():
     fae. も参照して下さい。

     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: f8c. 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: 2199.: Unix.

     See the man page ‘sigwaitinfo(2)(18)’ for further information.

     *note pause(): 3b22, *note sigwait(): 134f, *note sigtimedwait():
     fae. も参照して下さい。

     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(): faf, but takes an additional 'timeout'
     argument specifying a timeout.  If 'timeout' is specified as ‘0’, a
     poll is performed.  Returns *note None: 886. if a timeout occurs.

     *note Availability: 2199.: Unix.

     See the man page ‘sigtimedwait(2)(20)’ for further information.

     *note pause(): 3b22, *note sigwait(): 134f, *note sigwaitinfo():
     faf. も参照して下さい。

     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: モジュールの内容<3>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.20.6.5 使用例
...............

以下は最小限のプログラム例です。この例では *note alarm(): 3b21. を使って
ファイルを開く処理を待つのに費やす時間を制限します; 例えば、電源の入って
いないシリアルデバイスを開こうとすると、通常 *note os.open(): f96. は未
定義の期間ハングアップしてしまいますが、この方法はそうした場合に便利です
。ここではファイルを開くまで 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.20.6.6 Note on SIGPIPE
........................

Piping output of your program to tools like ‘head(1)(1)’ will cause a
*note SIGPIPE: 3b02. 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: 3b02.'s disposition to *note SIG_DFL: 1c0f. in
order to avoid *note BrokenPipeError: 126b.  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.20.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:
bc9. may appear at any point during execution.  Most Python code,
including the standard library, cannot be made robust against this, and
so a ‘KeyboardInterrupt’ (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: bc9, 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 ‘KeyboardInterrupt’ as
a means of gracefully shutting down.  Instead, they should install their
own *note SIGINT: 255. handler.  Below is an example of an HTTP server
that avoids ‘KeyboardInterrupt’:

     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.20.7 ‘mmap’ -- メモリマップファイルのサポート
-----------------------------------------------

__________________________________________________________________

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

メモリにマップされたファイルオブジェクトは、 *note bytearray: 342. と
*note ファイルオブジェクト: 13df. の両方のように振舞います。しかし通常の
文字列オブジェクトとは異なり、これらは可変です。 ‘bytearray’ が期待され
るほとんどの場所で mmap オブジェクトを利用できます。例えば、メモリマップ
ファイルを探索するために *note re: be. モジュールを使うことができます。
それらは可変なので、 ‘obj[index] = 97’ のように文字を変換できますし、ス
ライスを使うことで ‘obj[i1:i2] = b'...'’ のように部分文字列を変換するこ
とができます。現在のファイル位置をデータの始めとする読込みや書込み、ファ
イルの異なる位置へ ‘seek()’ することもできます。

メモリマップドファイルは Unix と Windows で異なる *note mmap: 519. コン
ストラクタで生成されます。どちらの場合も、更新用に開かれたファイル記述子
を渡さなければなりません。既存の Python ファイルオブジェクトをマップした
ければ、 *note fileno(): 181b. メソッドを使って 'fileno' パラメータの正
しい値を取得してください。そうでなければ、 *note os.open(): f96. 関数を
使ってファイルを開けます。この関数はファイルディスクリプタを直接返します
(処理が終わったら、やはりファイルを閉じる必要があります)。

     注釈: 書き込み可能でバッファされたファイルへのメモリマップファイル
     を作りたいのであれば、まず最初にファイルの *note flush(): 2d62. を
     呼び出すべきです。これはバッファへのローカルな修正がマッピングで実
     際に利用可能になることを保障するために必要です。

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: 199. 例外を送出します
。 ‘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 version)' Maps 'length' bytes from the file specified by
     the file handle 'fileno', and creates a mmap object.  If 'length'
     is larger than the current size of the file, the file is extended
     to contain 'length' bytes.  If 'length' is ‘0’, the maximum length
     of the map is the current size of the file, except that if the file
     is empty Windows raises an exception (you cannot create an empty
     mapping on Windows).

     'tagname' は、 ‘None’ 以外で指定された場合、マップのタグ名を与える
     文字列となります。 Windows は同じファイルに対する様々なマップを持つ
     ことを可能にします。既存のタグの名前を指定すればそのタグがオープン
     され、そうでなければこの名前の新しいタグが作成されます。もしこのパ
     ラメータを省略したり ‘None’ を与えたりしたならば、マップは名前なし
     で作成されます。 "tagname" パラメータの使用の回避は、あなたのコード
     を Unix と Windows の間で移植可能にしておくのを助けてくれるでしょう
     。

     'offset' は非負整数のオフセットとして指定できます。mmap の参照はフ
     ァイルの先頭からのオフセットに相対的になります。'offset' のデフォル
     トは 0 です。'offset' は ‘ALLOCATIONGRANULARITY’ の倍数でなければな
     りません。

     引数 ‘fileno’, ‘length’, ‘access’, ‘offset’ 付きで *note
     監査イベント: 1ccb. ‘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:
     3b2a. 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: 3b2b. creates a mapping that's shared with all
     other processes mapping the same areas of the file.  The default
     value is ‘MAP_SHARED’.  Some systems have additional possible flags
     with the full list specified in *note MAP_* constants: 3b2c.

     '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(): 3b2d. and *note resize(): 3b2e. 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: 187. 文の中でコンテキストマネージャ
     としても使えます:

          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
     監査イベント: 1ccb. ‘mmap.__new__’ を送出します。

     メモリマップファイルオブジェクトは以下のメソッドをサポートしていま
     す:

      -- メソッド: close ()

          メモリマップファイルを閉じます。この呼出しの後にオブジェクトの
          他のメソッドの呼出すことは、 *note ValueError: 2ee. 例外の送出
          を引き起こします。このメソッドは開いたファイルのクローズはしま
          せん。

      -- の属性: closed

          ファイルが閉じている場合 ‘True’ となります。

          Added in version 3.2.

      -- メソッド: find (sub[, start[, end]])

          オブジェクト内の ['start', 'end'] の範囲に含まれている部分シー
          ケンス 'sub' が見つかった場所の最も小さいインデックスを返しま
          す。オプションの引数 'start' と 'end' はスライスに使われるとき
          のように解釈されます。失敗したときには ‘-1’ を返します。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          194. を使用できるようになりました。

      -- メソッド: 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: 3b32. 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: 199. 例外を発生させます。

      -- メソッド: read ([n])

          現在のファイル位置からの最大 'n' バイトを含む *note bytes:
          193. を返します。引数が省略されるか、 ‘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: 199. exception.
          Resizing a map created with 'trackfd' set to ‘False’, will
          raise a *note ValueError: 2ee. exception.

          'On Windows': Resizing the map will raise an *note OSError:
          2c2. 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:
          194. を使用できるようになりました。

      -- メソッド: 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 ()

          Return the length of the file, which can be larger than the
          size of the memory-mapped area.

      -- メソッド: tell ()

          ファイルポインタの現在位置を返します。

      -- メソッド: write (bytes)

          メモリ内のファイルポイントの現在位置に 'bytes' のバイト列を書
          き込み、書き込まれたバイト数を返します(もし書き込みが失敗した
          ら *note ValueError: 2ee. が送出されるため、‘len(bytes)’ より
          少なくなりません)。ファイル位置はバイト列が書き込まれた位置に
          更新されます。もしmmapが ‘ACCESS_READ’ とともに作成されていた
          場合は、書き込みは *note TypeError: 199. 例外を送出するでしょ
          う。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          194. を使用できるようになりました。

          バージョン 3.6 で変更: 書きこまれたバイト数を返すようになりま
          した。

      -- メソッド: write_byte (byte)

          メモリ内のファイル・ポインタの現在位置に整数 'byte' を書き込み
          ます。ファイル位置は ‘1’ だけ進みます。もし mmap が
          ‘ACCESS_READ’ で作成されていた場合、書き込み時に *note
          TypeError: 199. 例外を発生させるでしょう。

* Menu:

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


File: python.info,  Node: MADV_* 定数,  Next: MAP_* 定数,  Up: mmap --- メモリマップファイルのサポート

5.20.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(): bff.  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.20.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.  ‘MAP_ALIGNED_SUPER’ is only available at FreeBSD
     and ‘MAP_CONCEAL’ is only available at OpenBSD. Note that some
     options might not be present on some systems.

     バージョン 3.10 で変更: Added ‘MAP_POPULATE’ constant.

     Added in version 3.11: Added ‘MAP_STACK’ constant.

     Added in version 3.12: Added ‘MAP_ALIGNED_SUPER’ and ‘MAP_CONCEAL’
     constants.

     Added in version 3.13: Added ‘MAP_32BIT’, ‘MAP_HASSEMAPHORE’,
     ‘MAP_JIT’, ‘MAP_NOCACHE’, ‘MAP_NOEXTEND’, ‘MAP_NORESERVE’,
     ‘MAP_RESILIENT_CODESIGN’, ‘MAP_RESILIENT_MEDIA’, ‘MAP_TPRO’,
     ‘MAP_TRANSLATED_ALLOW_EXECUTE’, and ‘MAP_UNIX03’ constants.


File: python.info,  Node: インターネット上のデータの操作,  Next: 構造化マークアップツール,  Prev: ネットワーク通信とプロセス間通信,  Up: Python 標準ライブラリ

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

この章ではインターネット上で一般的に利用されているデータ形式の操作をサポ
ートするモジュール群について記述します。

* 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.21.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 ‘EmailMessage’
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 ‘policy’ object that controls its behavior.
Usually an application only needs to specify the policy when an
‘EmailMessage’ is created, either by directly instantiating an
‘EmailMessage’ to create a new email, or by parsing an input stream
using a ‘parser’.  But the policy can be changed when the message is
serialized using a ‘generator’.  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: e9b. API that deals much more
directly with the details of how email messages are represented.  The
‘compat32’ 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: e9b. API for
backward compatibility reasons.

バージョン 3.6 で変更: Docs reorganized and rewritten to promote the new
*note EmailMessage: 580./*note EmailPolicy: 12cf. 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.21.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 ‘email’ object model.  ‘EmailMessage’ 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: 12d0. 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: 3b62. 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: 13ea.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *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: 13ea. 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: ffd. 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(): 3b61.

      -- メソッド: 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: 13eb.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *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: 13eb. for
          a more flexible API for serializing messages.

      -- メソッド: __bytes__ ()

          Equivalent to *note as_bytes(): 3b64.  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
          ‘is_multipart()’ returns ‘False’, the payload should be a
          string object (which might be a CTE encoded binary payload).
          Note that ‘is_multipart()’ 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 ‘EmailMessage’ is
          of type ‘message/rfc822’.

      -- メソッド: set_unixfrom (unixfrom)

          Set the message's envelope header to 'unixfrom', which should
          be a string.  (See *note mboxMessage: 3b68. 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(): 3b6a, 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(): 3b6e. 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: 3b6f.

      -- メソッド: __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: 2ee. 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__(): 3b70. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_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(): 3b78.  If the ‘Content-Type’ header is
          invalid, return ‘text/plain’.

          (According to RFC 2045(10), messages always have a default
          type, ‘get_content_type()’ 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(): 3b77. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3b77. によって返さ
          れる文字列の ‘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: 3b7d. 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(): 3b80. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3b80. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3b82. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3b83. が発生します。

          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(): 3b75, because
          ‘set_boundary()’ 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(): 3b87. との一貫
          性のために、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(): 3b89. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての part および subpart
          をわたり歩くのに使えます。順序は深さ優先です。おそらく典型的な
          用法は、 ‘walk()’ を ‘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(): 3b66. 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(): 3b89.)

      -- メソッド: get_content (*args, content_manager=None, **kw)

          Call the *note get_content(): 3b8e. 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(): 3b8f. 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():
          1cba. method, and *note attach(): 3b94. it to the ‘multipart’.
          If the message is a non-‘multipart’, call *note
          make_related(): 3b90. and then proceed as above.  If the
          message is any other type of ‘multipart’, raise a *note
          TypeError: 199.  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(): 1cba. method, and *note attach(): 3b94. it to
          the ‘multipart’.  If the message is a non-‘multipart’ or
          ‘multipart/related’, call *note make_alternative(): 3b91. and
          then proceed as above.  If the message is any other type of
          ‘multipart’, raise a *note TypeError: 199.  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():
          1cba. method, and *note attach(): 3b94. it to the ‘multipart’.
          If the message is a non-‘multipart’, ‘multipart/related’, or
          ‘multipart/alternative’, call *note make_mixed(): 3b92. 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: 13b9. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 13ea. がある
          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: 3b99, 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(): 1cba. 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: 1247.
Docs for legacy message class moved to *note email.message.Message;
compat32 API を使用した電子メールメッセージの表現: 3b60.

   (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: e9b. policy does not support these methods and should not be
used with ‘EmailMessage’.

   (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.21.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(): 1cba. 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(): 3b66. method, and the subparts can be accessed via the
payload manipulation methods, such as *note get_body(): 3b8a, *note
iter_parts(): 3b8c, and *note walk(): 3b89.

There are actually two parser interfaces available for use, the *note
Parser: 13b9. API and the incremental *note FeedParser: 17f5. API. The
‘Parser’ 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.
‘FeedParser’ 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 ‘FeedParser’ 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: 12cb.
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.21.1.3 FeedParser API
.......................

The *note BytesFeedParser: 13e7, 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
‘BytesFeedParser’ can of course be used to parse an email message fully
contained in a *note bytes-like object: 194, string, or file, but the
*note BytesParser: 13e8. API may be more convenient for such use cases.
The semantics and results of the two parser APIs are identical.

*note BytesFeedParser: 13e7. API は簡単です。まずインスタンスをつくり、
それに bytes を (それ以上 bytes が必要なくなるまで) 流しこみます。その後
パーザを close すると根っこ (root) のメッセージオブジェクトが返されます
。標準に従ったメッセージを解析する場合、 ‘BytesFeedParser’ は非常に正確
であり、標準に従っていないメッセージでもちゃんと動きます。そのさい、これ
はメッセージがどのように壊れていると認識されたかについての情報を残します
。これはメッセージオブジェクトの *note defects: 3b9b. 属性にリストとして
現れ、メッセージ中に発見された問題が記録されます。パーザが検出できる障害
(defect) については *note email.errors: 43. モジュールを参照してください
。

以下は *note BytesFeedParser: 13e7. の API です:

 -- クラス: email.parser.BytesFeedParser (_factory=None, *,
          policy=policy.compat32)

     Create a ‘BytesFeedParser’ instance.  Optional '_factory' is a
     no-argument callable; if not specified use the *note
     message_factory: e9a. 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: 12cc. 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: 12d0. 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: 194. を渡します。渡される行は完結
          していなくてもよく、その場合パーサーは部分的な行を適切につなぎ
          合わせます。各行は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(): 3ba0. is called after this method has been called.

 -- クラス: email.parser.FeedParser (_factory=None, *,
          policy=policy.compat32)

     Works like *note BytesFeedParser: 13e7. except that the input to
     the *note feed(): 3ba0. 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: ffd. 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.21.1.4 Parser API
...................

The *note BytesParser: 13e8. 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: 194. or file.  The ‘email.parser’ module also provides *note
Parser: 13b9. for parsing strings, and header-only parsers, *note
BytesHeaderParser: 12d5. and *note HeaderParser: 12d6, which can be used
if you're only interested in the headers of the message.
‘BytesHeaderParser’ and ‘HeaderParser’ 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 ‘BytesParser’ instance.  The '_class' and 'policy'
     arguments have the same meaning and semantics as the '_factory' and
     'policy' arguments of *note BytesFeedParser: 13e7.

     Note: 'The policy keyword should always be specified'; The default
     will change to *note email.policy.default: 12d0. 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(): 1545. and the *note read():
          1544. methods.

          The bytes contained in 'fp' must be formatted as a block of
          RFC 5322(1) (or, if *note utf8: ffd. 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(): 3ba3. method, except it takes a
          *note bytes-like object: 194. instead of a file-like object.
          Calling this method on a bytes-like object is equivalent to
          wrapping 'bytes' in a *note BytesIO: 10a8. instance first and
          calling ‘parse()’.

          オプション引数 'headersonly' は *note parse(): 3ba3. メソッド
          と同じです。

     Added in version 3.2.

 -- クラス: email.parser.BytesHeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note BytesParser: 13e8, 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: 13e8, 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(): 177c.
          および *note read(): 20c8. 両方のメソッドをサポートしている必
          要があります。

          Other than the text mode requirement, this method operates
          like *note BytesParser.parse(): 3ba3.

      -- メソッド: parsestr (text, headersonly=False)

          *note parse(): 3ba5. メソッドに似ていますが、ファイルなどのス
          トリーム形式のかわりに文字列を引数としてとるところが違います。
          文字列に対してこのメソッドを呼ぶことは、 'text' を *note
          StringIO: 112e. インスタンスとして作成して ‘parse()’ を適用す
          るのと同じです。

          オプション引数 'headersonly' は *note parse(): 3ba5. メソッド
          と同じです。

 -- クラス: email.parser.HeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note Parser: 13b9, except that 'headersonly' defaults
     to ‘True’.

ファイルや文字列からメッセージオブジェクト構造を作成するのはかなりよくお
こなわれる作業なので、便宜上次のような 4つの関数が提供されています。これ
らは *note email: 3f. パッケージのトップレベルの名前空間で使用できます。

 -- の関数: email.message_from_bytes (s, _class=None, *,
          policy=policy.compat32)

     *note bytes-like オブジェクト: 194. からメッセージオブジェクト構造
     を作成して返します。これは ‘BytesParser().parsebytes(s)’ と同じです
     。オプション引数 '_class' および 'policy' は *note BytesParser:
     13e8. クラスのコンストラクタと同様に解釈されます。

     Added in version 3.2.

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_binary_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされたバイナリ *note file object: 13df. からメッセージオブ
     ジェクト構造を作成して返します。これは ‘BytesParser().parse(fp)’ と
     同じです。 '_class' および 'policy' は *note BytesParser: 13e8. ク
     ラスのコンストラクタと同様に解釈されます。

     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: 13b9. クラスのコンストラクタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされた *note file object: 13df. からメッセージオブジェクト
     構造を作成して返します。これは ‘Parser().parse(fp)’ と同じです。
     '_class' および 'policy' は *note Parser: 13b9. クラスのコンストラ
     クタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

     バージョン 3.6 で変更: '_class' defaults to the policy
     ‘message_factory’.

対話的な Python プロンプトで *note message_from_bytes(): 13e5. を使用す
るとすれば、このようになります:

     >>> 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.21.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(): 3b66, and *note iter_parts(): 3b8c. 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(): 3b66, and *note iter_parts(): 3b8c. 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(): 3b66. method will return ‘True’.  The single
     element yielded by *note iter_parts(): 3b8c. will be a sub-message
     object.

   * いくつかの標準的でないメッセージは、 ‘multipart’ の使い方に統一がと
     れていない場合があります。このようなメッセージは ‘Content-Type’ ヘ
     ッダに ‘multipart’ を指定しているものの、その *note is_multipart():
     3b66. メソッドは ‘False’ を返すことがあります。もしこのようなメッセ
     ージが *note FeedParser: 17f5. によって解析されると、その 'defects'
     属性のリスト中には *note MultipartInvariantViolationDefect: 3baa. ク
     ラスのインスタンスが現れます。詳しい情報については *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.21.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(): 105d, 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: 13e8. class and
then regenerating the serialized byte stream using *note BytesGenerator:
13eb. 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 ‘EmailMessage’ object as defaults
are filled in.)

The *note Generator: 13ea. 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: 13ea. 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 ‘BytesGenerator’ object that will write any message
     provided to the *note flatten(): 3baf. method, or any
     surrogateescape encoded text provided to the *note write(): 3bb0.
     method, to the *note file-like object: 181a. '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_:
     ffb. setting of the 'policy' (which is ‘True’ for the *note
     compat32: e9b. 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: 13eb. イ
          ンスタンスが作成されたときに指定されたものが使われます。

          If the *note policy: 53. option *note cte_type: 3bb1. 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 ‘BytesGenerator’ 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 ‘BytesGenerator’'s constructor.

As a convenience, *note EmailMessage: 580. provides the methods *note
as_bytes(): 3b64. and ‘bytes(aMessage)’ (a.k.a.  *note __bytes__():
3b65.), 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: 13ea.
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 ‘Generator’ serializing to an I/O stream that
is not "8 bit clean".  In other words, most applications will want to be
using *note BytesGenerator: 13eb, and not ‘Generator’.

 -- クラス: email.generator.Generator (outfp, mangle_from_=None,
          maxheaderlen=None, *, policy=None)

     Return a ‘Generator’ object that will write any message provided to
     the *note flatten(): 3bb3. method, or any text provided to the
     *note write(): 3bb4. method, to the *note file-like object: 181a.
     '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_:
     ffb. setting of the 'policy' (which is ‘True’ for the *note
     compat32: e9b. 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: 13ea. インス
          タンスが作成されたときに指定されたものが使われます。

          If the *note policy: 53. option *note cte_type: 3bb1. 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 ‘Generator’ 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
          ‘Generator’'s constructor.  This provides just enough
          file-like API for ‘Generator’ instances to be used in the
          *note print(): 117b. function.

As a convenience, *note EmailMessage: 580. provides the methods *note
as_string(): 3b61. and ‘str(aMessage)’ (a.k.a.  *note __str__(): 3b63.),
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: e99, which is like the *note Generator: 13ea. 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: 13ea, except that for any subpart of the
     message passed to *note Generator.flatten(): 3bb3, 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: 13ea. 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:
3bae. 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.21.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: 12cb. object encapsulates a set of attributes and
methods that control the behavior of various components of the email
package during use.  ‘Policy’ 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: 12cc. policy, via its corresponding pre-defined instance *note
compat32: e9b.  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: 12cf. policy, via its pre-defined instance
*note default: 12d0.

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 ‘parser’ module.

The first part of this documentation covers the features of *note
Policy: 12cb, an *note abstract base class: 13d2. that defines the
features that are common to all policy objects, including *note
compat32: e9b.  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: 12cf. and *note Compat32: 12cc, which
implement the hooks that provide the standard behavior and the backward
compatible behavior and features, respectively.

*note Policy: 12cb. instances are immutable, but they can be cloned,
accepting the same keyword arguments as the class constructor and
returning a new ‘Policy’ 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: 13eb. 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(): 113d. 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: 13d2. 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(): 12cd. 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: 886. の場合は行の折り返しを全くしないべ
          きであるということを示します。

      -- の属性: 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(): 3bba. and *note utf8: ffd. 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: e0b, any defects encountered will be raised as
          errors.  If *note False: d2f. (the default), defects will be
          passed to the *note register_defect(): 3bbc. method.

      -- の属性: mangle_from_

          If *note True: e0b, 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: d2f.

          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: 3bbd. 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: 12cc. policy.  For backwards compatible,
          but unsafe, behavior, it must be set to ‘False’ explicitly.

          Added in version 3.13.

     The following ‘Policy’ method is intended to be called by code
     using the email library to create policy instances with custom
     settings:

      -- メソッド: clone (**kw)

          Return a new ‘Policy’ 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 ‘Policy’ 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: 3bbf.

          The default implementation checks the *note raise_on_defect:
          3bbb. 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(): 3bbc.

      -- メソッド: register_defect (obj, defect)

          Register a 'defect' on 'obj'.  In the email package, 'defect'
          will always be a subclass of *note MessageDefect: 3bbf.

          The default implementation calls the ‘append’ method of the
          ‘defects’ attribute of 'obj'.  When the email package calls
          *note handle_defect: 3bbe, '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: 2ee. 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: 3bb9. 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(): 3bc4. と同じです。

          'value' はサロゲートエスケープされたバイナリデータを持つことが
          あります。これらは返されたbytesオブジェクト内でバイナリデータ
          に変換されることがあります。

 -- クラス: email.policy.EmailPolicy (**kw)

     This concrete *note Policy: 12cb. 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: e9a. 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(): 3b8d. or *note
          set_content(): 1cba. 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: 3bc6.

          Added in version 3.4.

     このクラスは *note Policy: 12cb. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: header_max_count (name)

          Returns the value of the *note max_count: 3bc8. 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: 3bae.
          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():
          1472.  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: 3bb1. が
          ‘7bit’ の場合は *note fold(): 1a52. と同じです。

          If *note cte_type: 3bb1. 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: 12cf. 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: ffd. 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(): 105e. 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: 12cf, 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: 12cb. 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: e9b, 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: 12cb. デフォルトとは異なる値を持ちます:

      -- の属性: mangle_from_

          デフォルトは ‘True’ です。

     このクラスは *note Policy: 12cb. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: 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: 1cbb. object using the ‘unknown-8bit’ charset.
          Otherwise it is returned unmodified.

      -- メソッド: fold (name, value)

          Headers are folded using the *note Header: 1cbb. 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: 1cbb. 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: 12cc. のインスタンスで、Python 3.2 の email パッケ
     ージの挙動との後方互換性を提供します。

          注釈: The *note compat32: e9b. 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
          ‘compat32’ 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: 1247.

   (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.21.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: bd1. クラスから派生しており
     、追加のメソッドは定義されていません。

 -- 例外: email.errors.MessageParseError

     This is the base class for exceptions raised by the *note Parser:
     13b9. class.  It is derived from *note MessageError: 3bd7.  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: 3bd8.  The *note set_boundary(): 3b82. method
     will raise this error if the content type is unknown when the
     method is called.  *note Header: 1cbb. 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(): 3b94. method is called on an instance
     of a class derived from *note MIMENonMultipart: 3bdb. (e.g.  *note
     MIMEImage: 3bdc.).  ‘MultipartConversionError’ multiply inherits
     from *note MessageError: 3bd7. and the built-in *note TypeError:
     199.

 -- 例外: 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: 2ee.

 -- 例外: email.errors.HeaderDefect

     This is the base class for all defects found when parsing email
     headers.  It is derived from *note MessageDefect: 3bbf.

以下は *note FeedParser: 17f5. がメッセージの解析中に検出する障害
(defect) の一覧です。これらの障害は、問題が見つかったメッセージに追加さ
れるため、たとえば ‘multipart/alternative’ 内にあるネストしたメッセージ
が異常なヘッダをもっていた場合には、そのネストしたメッセージが障害を持っ
ているが、その親メッセージには障害はないとみなされることに注意してくださ
い。

すべての障害クラスは *note email.errors.MessageDefect: 3bbf. のサブクラ
スです。

 -- 例外: 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():
     3b87. 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.21.1.9 ‘email.headerregistry’: Custom Header Objects
......................................................

'ソースコード:' Lib/email/headerregistry.py(1)

__________________________________________________________________

Added in version 3.6: (2)

ヘッダーは *note str: 16a. のカスタマイズされたサブクラスで表現されます
。 与えられたヘッダーを表現するために使用される特定のクラスは、ヘッダー
が作成されるときに有効な *note policy: 53. の *note header_factory:
3bc5. で決定されます。 このセクションでは、email ライブラリが RFC
5322(3) に準拠したメールメッセージを扱うために実装している、特定の
‘header_factory’ について説明します。このヘッダーは、様々なヘッダータイ
プに対してカスタマイズされたヘッダーオブジェクトを提供するだけでなく、ア
プリケーションが独自のカスタムヘッダータイプを追加できるような拡張メカニ
ズムも備えています。

*note EmailPolicy: 12cf. から派生したポリシーオブジェクトのいずれかを使
用する場合、すべてのヘッダーは *note HeaderRegistry: 3bec. によって生成
され、最終的な基底クラスとして *note BaseHeader: 3b6f. を有します。 各ヘ
ッダクラスには、ヘッダの種類によって決まる追加のベースクラスがあります。
例えば、多くのヘッダーは *note UnstructuredHeader: 3bed. というクラスを
もうひとつの基底クラスとして持っています。 ヘッダーに特化した第二のクラ
スは、ヘッダーの名前によって決定され、 ‘HeaderRegistry’ に格納されたルッ
クアップテーブルを使用します。 これらすべては、典型的なアプリケーション
プログラムに対しては透過的に管理されますが、より複雑なアプリケーションで
使用するためにデフォルトの動作を変更するためのインタフェースが提供されて
います。

以下のセクションでは、まずヘッダーの基本クラスとその属性を説明し、次に
*note HeaderRegistry: 3bec. の動作を変更するための API、そして最後に構造
化ヘッダーからパースされたデータを表現するためのサポートクラスについて説
明します。

 -- クラス: email.headerregistry.BaseHeader (name, value)

     'name' と 'value' は *note header_factory: 3bc5. 呼び出しから
     ‘BaseHeader’ に渡されます。 どのヘッダーオブジェクトの文字列値も、
     完全にユニコードにデコードされた 'value' です。

     基底クラスは以下の読み出し専用属性を定義しています:

      -- の属性: name

          ヘッダーの名前(フィールドの':'の前の部分)。これは *note
          header_factory: 3bc5. の 'name' の呼び出しで渡された値と全く同
          じです; つまり、大文字・小文字が保持されます。

      -- の属性: defects

          パース中に見つかったRFCのコンプライアンス問題を報告する *note
          HeaderDefect: 3bdd. インスタンスのタプルです。 email パッケー
          ジはコンプライアンスに関する問題を完全に検出するように努めてい
          ます。 報告されるかもしれない欠陥の種類の議論については、
          *note errors: 43. モジュールを参照してください。

      -- の属性: max_count

          このタイプのヘッダーで、同じ ‘name’ を持つことができる最大数。
          値として ‘None’ を指定すると、無制限になります。 この属性の
          ‘BaseHeader’ の値は ‘None’ です; 特殊な header クラスでは、必
          要に応じてこの値をオーバーライドすることが期待されます。

     ‘BaseHeader’ は以下のメソッドも提供します。このメソッドはemail ライ
     ブラリのコードから呼び出され、一般にアプリケーションプログラムから
     は呼び出されません：

      -- メソッド: fold (*, policy)

          ヘッダを 'policy' に従って正しく折りたたむために必要な *note
          linesep: 3bb9. 文字を含む文字列を返します。 ヘッダには任意のバ
          イナリデータを含めることができないため、 *note cte_type: 3bb1.
          が ‘8bit’ の場合は ‘7bit’ と同じように扱われます。 もし *note
          utf8: ffd. が ‘False’ であれば、非ASCIIデータは RFC 2047(4) で
          エンコードされます。

     ‘BaseHeader’ 自身はヘッダーオブジェクトを生成するために使用すること
     はできません。このクラスは、それぞれの特殊化ヘッダーがヘッダーオブ
     ジェクトを生成するために協力するプロトコルを定義しています。 具体的
     には、 ‘BaseHeader’ は ‘parse’ という名前の *note classmethod():
     48e. を特殊化されたクラスが提供することを要求しています。このメソッ
     ドは以下のように呼び出されます:

          parse(string, kwds)

     ‘kwds’ is a dictionary containing one pre-initialized key,
     ‘defects’.  ‘defects’ is an empty list.  The parse method should
     append any detected defects to this list.  On return, the ‘kwds’
     dictionary 'must' contain values for at least the keys ‘decoded’,
     ‘defects’ and ‘parse_tree’.  ‘decoded’ should be the string value
     for the header (that is, the header value fully decoded to
     unicode).  ‘parse_tree’ is set to the parse tree obtained from
     parsing the header.  The parse method should assume that 'string'
     may contain content-transfer-encoded parts, but should correctly
     handle all valid unicode characters as well so that it can parse
     un-encoded header values.

     その後、 ‘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: 3bf2. will be a naive ‘datetime’.  If a
          specific timezone offset is found (including ‘+0000’), then
          ‘datetime’ will contain an aware ‘datetime’ that uses *note
          datetime.timezone: 12d9. 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(): 2f9.
     関数を使用することです:

          msg['Date'] = utils.localtime()

     この例では、現在のタイムゾーンオフセットを使用して、日付ヘッダーを
     現在の時刻と日付に設定します。

 -- クラス: email.headerregistry.AddressHeader

     アドレスヘッダは最も複雑な構造のヘッダタイプの1つです。
     ‘AddressHeader’ クラスは、あらゆるアドレスヘッダに対する汎用的なイ
     ンターフェースを提供します。

     このヘッダ型は以下の属性も提供しています:

      -- の属性: groups

          ヘッダー値に含まれるアドレスとグループをエンコードした *note
          Group: 3bf5. オブジェクトのタプルです。 グループに属さないアド
          レスは、このリストでは *note display_name: 3bf6. が ‘None’ で
          あるシングルアドレスの ‘Groups’ として表現されます。

      -- の属性: addresses

          ヘッダー値に含まれる全ての個別アドレスをエンコードした *note
          Address: 3bf8. オブジェクトのタプルです。 ヘッダ値にグループが
          含まれている場合、そのグループに含まれる個々のアドレスは、ヘッ
          ダ値でグループが出現した時点でリストに含まれます (つまり、アド
          レスのリストは一次元のリストに「フラット化」されます)。

     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:
     26af. the *note str: 16a. value of the elements of the ‘groups’
     attribute with ‘', '’.

     A list of *note Address: 3bf8. and *note Group: 3bf5. 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: 3bf3. の派生クラスです:

      -- の属性: 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:
          2ee.

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: 3bc8. 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: 3bff. ク
     ラスです。

      -- の属性: content_type

          The content type string, in the form ‘maintype/subtype’.

      -- の属性: maintype

      -- の属性: subtype

 -- クラス: email.headerregistry.ContentDispositionHeader

     ‘Content-Disposition’ ヘッダを扱う *note ParameterizedMIMEHeader:
     3bff. クラスです。

      -- の属性: 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: 12cf. 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__:
     16ca. 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: 3bf8. 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: 1247.

   (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.21.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:
          199.; otherwise look up a handler function based on the type
          of 'obj' (see next paragraph), call *note clear_content():
          3b98. 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: 23cf. (‘typ.__qualname__’)

             * the type's *note name: 16c9. (‘typ.__name__’).

          If none of the above match, repeat all of the checks above for
          each of the types in the *note MRO: 193f. (*note typ.__mro__:
          23d4.).  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: 1141.).

      -- メソッド: add_get_handler (key, handler)

          Record the function 'handler' as the handler for 'key'.  For
          the possible values of 'key', see *note get_content(): 3c17.

      -- メソッド: 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():
          3c19.  For the possible values of 'typekey', see
          ‘set_content()’.

* 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: 1247.


File: python.info,  Node: Content Manager Instances,  Up: email contentmanager Managing MIME Content

5.21.1.11 Content Manager Instances
...................................

Currently the email package provides only one concrete content manager,
*note raw_data_manager: 3bc6, although more may be added in the future.
‘raw_data_manager’ is the *note content_manager: 1140. provided by *note
EmailPolicy: 12cf. 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 ‘Message’ 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: 199. 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: 2ee.

             * For ‘str’ objects, if 'cte' is not set use heuristics to
               determine the most compact encoding.  Prior to encoding,
               *note str.splitlines(): 1472. is used to normalize all
               line boundaries, ensuring that each line of the payload
               is terminated by the current policy's *note linesep:
               3bb9. 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: 13eb.
               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.21.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.21.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
‘EmailMessage’ 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: 12cc.  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 ‘Message’ 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: 12cc. policy, which maintains backward
     compatibility with the Python 3.2 version of the email package.
     For more information see the ‘policy’ 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: 13ea. instance and
          use its *note flatten(): 3bb3. 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(): 113d. and *note BytesGenerator: 13eb.)

          バージョン 3.4 で変更: 'policy' キーワード引数が追加されました
          。

      -- メソッド: __str__ ()

          Equivalent to *note as_string(): 113c.  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: 13eb.
          instance and use its *note flatten(): 3baf. 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(): 113d.  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
          ‘is_multipart()’ returns ‘False’, the payload should be a
          string object (which might be a CTE encoded binary payload).
          (Note that ‘is_multipart()’ 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 ‘Message’ is of
          type ‘message/rfc822’.)

      -- メソッド: set_unixfrom (unixfrom)

          メッセージのエンベロープヘッダを 'unixfrom' に設定します。これ
          は文字列でなければなりません。

      -- メソッド: get_unixfrom ()

          メッセージのエンベロープヘッダを返します。エンベロープヘッダが
          設定されていない場合は ‘None’ が返されます。

      -- メソッド: attach (payload)

          与えられた 'payload' を現在のペイロードに追加します。この時点
          でのペイロードは ‘None’ か、あるいは *note Message: 581. オブ
          ジェクトのリストである必要があります。このメソッドの実行後、ペ
          イロードは必ず ‘Message’ オブジェクトのリストになります。ペイ
          ロードにスカラーオブジェクト (文字列など) を格納したい場合は、
          かわりに *note set_payload(): 3c24. を使ってください。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by *note set_content():
          1cba. and the related ‘make’ and ‘add’ methods.

      -- メソッド: get_payload (i=None, decode=False)

          現在のペイロードへの参照を返します。これは *note
          is_multipart(): 3b87. が ‘True’ の場合 *note Message: 581. オ
          ブジェクトのリストになり、 ‘is_multipart()’ が ‘False’ の場合
          は文字列になります。ペイロードがリストの場合、リストを変更する
          ことはそのメッセージのペイロードを変更することになります。

          オプション引数の 'i' がある場合、 *note is_multipart(): 3b87.
          が ‘True’ ならば *note get_payload(): 13e9. はペイロード中で 0
          から数えて 'i' 番目の要素を返します。 'i' が 0 より小さい場合
          、あるいはペイロードの個数以上の場合は *note IndexError: 1753.
          が発生します。ペイロードが文字列 (つまり ‘is_multipart()’ が
          ‘False’) にもかかわらず 'i' が与えられたときは *note
          TypeError: 199. が発生します。

          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: 3be5. or *note
          InvalidBase64CharactersDefect: 3be6, 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():
          3b8d. and *note iter_parts(): 3b8c.

      -- メソッド: set_payload (payload, charset=None)

          メッセージオブジェクト全体のペイロードを 'payload' に設定しま
          す。クライアントはペイロードを変更してはいけません。オプション
          の 'charset' はメッセージのデフォルト文字セットを設定します。
          詳しくは *note set_charset(): 3c25. を参照してください。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by *note set_content():
          1cba.

      -- メソッド: set_charset (charset)

          ペイロードの文字セットを 'charset' に変更します。これは *note
          Charset: fff. インスタンス (*note email.charset: 40. 参照)、文
          字セット名を表す文字列、あるいは ‘None’ のいずれかです。文字列
          を指定した場合は ‘Charset’ インスタンスに変換されます。
          'charset' が ‘None’ の場合、 ‘charset’ 引数は ‘Content-Type’ ヘ
          ッダから除去されます (それ以外にメッセージは変更されません)。
          これら以外のものを文字セットとして指定した場合、 *note
          TypeError: 199. を送出します。

          ‘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: fff. を使って 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(): 1cba.
          method.

      -- メソッド: get_charset ()

          そのメッセージ中のペイロードの *note Charset: fff. インスタン
          スを返します。

          This is a legacy method.  On the *note EmailMessage: 580.
          class it always returns ‘None’.

     以下のメソッドは、メッセージの RFC 2822(2) ヘッダにアクセスするため
     のマップ (辞書) 形式のインタフェイスを実装したものです。これらのメ
     ソッドと、通常のマップ (辞書) 型はまったく同じ意味をもつわけではな
     いことに注意してください。たとえば辞書型では、同じキーが複数あるこ
     とは許されていませんが、ここでは同じメッセージヘッダが複数ある場合
     があります。また、辞書型では *note keys(): 3c27. で返されるキーの順
     序は保証されていませんが、 *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:
     1cbb. 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(): 3c2a. メソッドを使ってください。

      -- メソッド: __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__(): 18e1. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_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(): 3c31. が返す値によっ
          て与えられます。 RFC 2045(5) によればメッセージはつねにデフォ
          ルトの content-type をもっているので、 *note
          get_content_type(): 3c30. はつねになんらかの値を返すはずです。

          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(): 3c30. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3c30. によって返さ
          れる文字列の ‘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(): 3c36. で説明されている形式になります。また、オプ
          ション引数 '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(): 3c37. に *note
          get_param(): 3c36. の返り値を渡して呼び出すことで、このパラメ
          ータをひとつにまとめることができます。この値がタプルならばこの
          関数は適切にデコードされた 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: 2ee. が発生します。

          このメソッドは ‘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(): 3b80. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3b80. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3c3c. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3b83. が発生します。

          注意: このメソッドを使うのは、古い ‘Content-Type’ ヘッダを削除
          して新しい boundary をもったヘッダを *note add_header(): 18e2.
          で足すのとは少し違います。 *note set_boundary(): 3c3c. は一連
          のヘッダ中での ‘Content-Type’ ヘッダの位置を保つからです。しか
          し、これは元の ‘Content-Type’ ヘッダ中に存在していた連続する行
          の順番までは '保ちません' 。

      -- メソッド: get_content_charset (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘charset’ パ
          ラメータの値を返します。値はすべて小文字に変換されます。メッセ
          ージ中に ‘Content-Type’ がなかったり、このヘッダ中に
          ‘charaset’ パラメータがない場合には 'failobj' が返されます。

          注意: これは *note get_charset(): 3c26. メソッドとは異なります
          。こちらのほうは文字列のかわりに、そのメッセージボディのデフォ
          ルトエンコーディングの *note Charset: fff. インスタンスを返し
          ます。

      -- メソッド: 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(): 3c3f. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての part および subpart
          をわたり歩くのに使えます。順序は深さ優先です。おそらく典型的な
          用法は、 ‘walk()’ を ‘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(): 3b87. 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: 13b9. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 13ea. がある
          MIME メッセージからプレーンテキスト形式を生成するときメッセー
          ジが 'preamble' 属性を持つことが発見されれば、これはそのテキス
          トをヘッダと最初の MIME 境界の間に挿入します。詳細は *note
          email.parser: 52. および *note email.generator: 44. を参照して
          ください。

          注意: そのメッセージに preamble がない場合、'preamble' 属性に
          は ‘None’ が格納されます。

      -- の属性: epilogue

          'epilogue' 属性はメッセージの最後の MIME 境界文字列からメッセ
          ージ末尾までのテキストを含むもので、それ以外は 'preamble' 属性
          と同じです。

          *note Generator: 13ea. でファイル終端に改行を出力するため、
          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.21.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. を手で作成することさえできます。実際には、すでに存在するメ
ッセージオブジェクト構造をとってきて、そこに新たな ‘Message’ オブジェク
トを追加したり、あるものを別のところへ移動させたりできます。これは 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: 3c46. のインスタンスを直接作成す
     ることは (可能ではありますが) ふつうはしないでしょう。 ‘MIMEBase’ は
     単により特化された MIME 用サブクラスのための便宜的な基底クラスとし
     て提供されています。

     '_maintype' は ‘Content-Type’ の主形式 (maintype) であり (‘text’ や
     ‘image’ など)、 '_subtype' は ‘Content-Type’ の副形式 (subtype) で
     す (‘plain’ や ‘gif’ など)。 '_params' は各パラメータのキーと値を格
     納した辞書であり、これは直接 *note Message.add_header: 18e2. に渡さ
     れます。

     If 'policy' is specified, (defaults to the *note compat32: 12cc.
     policy) it will be passed to *note Message: 581.

     *note MIMEBase: 3c46. クラスはつねに ('_maintype' 、 '_subtype' 、
     および '_params' にもとづいた) ‘Content-Type’ ヘッダと、
     ‘MIME-Version’ ヘッダ (必ず ‘1.0’ に設定される) を追加します。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.nonmultipart.MIMENonMultipart

     モジュール: *note email.mime.nonmultipart: 50.

     *note MIMEBase: 3c46. のサブクラスで、これは ‘multipart’ 形式でない
     MIME メッセージのための中間的な基底クラスです。このクラスのおもな目
     的は、通常 ‘multipart’ 形式のメッセージに対してのみ意味をなす *note
     attach(): 3b94. メソッドの使用をふせぐことです。もし ‘attach()’ メ
     ソッドが呼ばれた場合、これは *note MultipartConversionError: 3bda.
     例外を発生します。

 -- クラス: email.mime.multipart.MIMEMultipart (_subtype='mixed',
          boundary=None, _subparts=None, *, policy=compat32, **_params)

     モジュール: *note email.mime.multipart: 4f.

     *note MIMEBase: 3c46. のサブクラスで、これは ‘multipart’ 形式の
     MIME メッセージのための中間的な基底クラスです。オプション引数
     '_subtype' はデフォルトでは ‘mixed’ になっていますが、そのメッセー
     ジの副形式 (subtype) を指定するのに使うことができます。メッセージオ
     ブジェクトには ‘multipart/_subtype’ という値をもつ ‘Content-Type’ ヘ
     ッダとともに、 ‘MIME-Version’ ヘッダが追加されるでしょう。

     オプション引数 'boundary' は multipart の境界文字列です。これが
     ‘None’ の場合 (デフォルト)、境界は必要に応じて計算されます（例えば
     メッセージがシリアライズされるときなど）。

     '_subparts' はそのペイロードの subpart の初期値からなるシーケンスで
     す。このシーケンスはリストに変換できるようになっている必要がありま
     す。新しい subpart はつねに *note Message.attach: 3b94. メソッドを
     使ってそのメッセージに追加できるようになっています。

     Optional 'policy' argument defaults to *note compat32: 12cc.

     ‘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: 3bdb, the ‘MIMEApplication’
     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:
     3c48. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 13e9. と *note set_payload(): 3c24. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 42.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 12cc.

     '_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: 3bdb, the ‘MIMEAudio’ 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: 199. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、オーディオデータの転送に使う実際のエンコード処理を行います。こ
     の呼び出し可能なオブジェクトは引数を 1 つ取り、それは *note
     MIMEAudio: 3c49. のインスタンスです。ペイロードをエンコードされた形
     式に変更するために *note get_payload(): 13e9. と *note
     set_payload(): 3c24. を使い、必要に応じて
     ‘Content-Transfer-Encoding’ やその他のヘッダをメッセージオブジェク
     トに追加するべきです。デフォルトのエンコードは base64 です。組み込
     みのエンコーダの一覧は *note email.encoders: 42. モジュールを見てく
     ださい。

     Optional 'policy' argument defaults to *note compat32: 12cc.

     '_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: 3bdb, the ‘MIMEImage’ 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: 199. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、画像データの転送に使う実際のエンコード処理を行います。この呼び
     出し可能なオブジェクトは引数を 1 つ取り、それは *note MIMEImage:
     3bdc. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 13e9. と *note set_payload(): 3c24. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 42.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 12cc.

     '_params' は *note MIMEBase: 3c46. コンストラクタに直接渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.message.MIMEMessage (_msg, _subtype='rfc822', *,
          policy=compat32)

     モジュール: *note email.mime.message: 4e.

     *note MIMEMessage: 3c4a. クラスは *note MIMENonMultipart: 3bdb. の
     サブクラスで、主形式 (maintype) が ‘message’ の MIME オブジェクトを
     作成するのに使われます。ペイロードとして使われるメッセージは '_msg'
     になります。これは *note Message: 581. クラス (あるいはそのサブクラ
     ス) のインスタンスでなければいけません。そうでない場合、この関数は
     *note TypeError: 199. を発生します。

     オプション引数 '_subtype' はそのメッセージの副形式 (subtype) を設定
     します。デフォルトではこれは ‘rfc822’ になっています。

     Optional 'policy' argument defaults to *note compat32: 12cc.

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.text.MIMEText (_text, _subtype='plain',
          _charset=None, *, policy=compat32)

     モジュール: *note email.mime.text: 51.

     *note MIMEText: ffe. クラスは *note MIMENonMultipart: 3bdb. のサブ
     クラスで、主形式 (maintype) が ‘text’ の MIME オブジェクトを作成す
     るのに使われます。ペイロードの文字列は '_text' になります。
     '_subtype' には副形式 (subtype) を指定し、デフォルトは ‘plain’ です
     。 '_charset' はテキストの文字セットで、 ‘MIMENonMultipart’ コンス
     トラクタに引数として渡されます。この値は、文字列が ‘ascii’ コードポ
     イントのみを含む場合 ‘us-ascii’ 、それ以外は ‘utf-8’ がデフォルトに
     なっています。 '_charset' パラメータは、文字列と *note Charset:
     fff. インスタンスの両方を受け付けます。

     ‘_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: 12cc.

     バージョン 3.5 で変更: '_charset' は *note Charset: fff. インスタン
     スも受け取ります。

     バージョン 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.21.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: 1cbb.
class and assign the field in the *note Message: 581. object to an
instance of ‘Header’ instead of using a string for the header value.
Import the ‘Header’ 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: 1cbb. インスタンスを作成することによって実現しています。のちにこ
の *note Message: 581. インスタンスからフラットなテキストを生成する際に
、この ‘Subject’ フィールドは RFC 2047(10) 準拠の適切な形式にエンコード
されます。MIME 機能のあるメーラなら、このヘッダに埋めこまれた ISO-8859-1
文字を正しく表示するでしょう。

以下は *note Header: 1cbb. クラスの説明です:

 -- クラス: email.header.Header (s=None, charset=None, maxlinelen=None,
          header_name=None, continuation_ws=' ', errors='strict')

     別の文字集合の文字列を含む MIME 準拠なヘッダを作成します。

     オプション引数 's' はヘッダの値の初期値です。これが ‘None’ の場合
     (デフォルト)、ヘッダの初期値は設定されません。この値はあとから
     *note append(): 3c4e. メソッドを呼びだすことによって追加することが
     できます。 's' は *note bytes: 193. または *note str: 16a. のインス
     タンスにできます。このセマンティクスについては ‘append()’ の項を参
     照してください。

     オプション引数 'charset' には 2 つの目的があります。ひとつは *note
     append(): 3c4e. メソッドにおける 'charset' 引数と同じものです。もう
     ひとつは、これ以降 'charset' 引数を省略した ‘append()’ メソッド呼び
     出しすべてにおける、デフォルト文字集合を決定するものです。コンスト
     ラクタに 'charset' が与えられない場合 (デフォルト)、初期値の 's' お
     よび以後の ‘append()’ 呼び出しにおける文字集合として ‘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(): 3c4e. メソッドにそのま
     ま渡されます。

      -- メソッド: append (s, charset=None, errors='strict')

          この MIME ヘッダに文字列 's' を追加します。

          オプション引数 'charset' がもし与えられた場合、これは *note
          Charset: fff. インスタンス (*note email.charset: 40. を参照) か
          、あるいは文字集合の名前でなければなりません。この場合は
          ‘Charset’ インスタンスに変換されます。この値が ‘None’ の場合
          (デフォルト)、コンストラクタで与えられた 'charset' が使われま
          す。

          's' は *note bytes: 193. または *note str: 16a. のインスタンス
          です。 ‘bytes’ のインスタンスの場合、 'charset' はその文字列の
          エンコーディングであり、この文字セットでデコードできないときは
          *note UnicodeError: 460. が発生します。

          's' が *note str: 16a. のインスタンスの場合、 'charset' はその
          文字列の文字セットを決定するためのヒントとして使われます。

          いずれの場合でも、 RFC 2822(12) 準拠のヘッダを RFC 2047(13) の
          規則を用いて生成する際、文字列は指定された文字セットの出力コー
          デックを用いてエンコードされます。出力コーデックを用いて文字列
          がエンコードできないときは *note UnicodeError: 460. が発生しま
          す。

          オプションの '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: 1cbb. クラスは、標準の演算子や組み込み関数をサポート
     するためのメソッドもいくつか提供しています。

      -- メソッド: __str__ ()

          *note Header: 1cbb. の概要を文字列として返します。無制限の行長
          を使用します。すべての箇所は、指定されたエンコーディングを使用
          してUnicodeに変換され、適切に結合されます。文字セット
          ‘'unknown-8bit'’ を持つ箇所は、 ‘'replace'’ エラーハンドラを使
          ってASCIIとしてデコードされます。

          バージョン 3.2 で変更: ‘'unknown-8bit'’ 文字集合の処理が追加さ
          れました。

      -- メソッド: __eq__ (other)

          このメソッドは、ふたつの *note Header: 1cbb. インスタンスどう
          しが等しいかどうか判定するのに使えます。

      -- メソッド: __ne__ (other)

          このメソッドは、ふたつの *note Header: 1cbb. インスタンスどう
          しが異なっているかどうかを判定するのに使えます。

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: 193, 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: 16a.

     An *note email.errors.HeaderParseError: 3b83. 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: 3bec.

 -- の関数: email.header.make_header (decoded_seq, maxlinelen=None,
          header_name=None, continuation_ws=' ')

     *note decode_header(): 12d2. によって返される 2要素タプルのリストか
     ら *note Header: 1cbb. インスタンスを作成します。

     *note decode_header(): 12d2. はヘッダの値をとってきて、
     ‘(decoded_string, charset)’ という形式の 2要素タプルからなるリスト
     を返します。ここで 'decoded_string' はデコードされた文字列、
     'charset' はその文字集合です。

     この関数はこれらのリストの項目から、 *note Header: 1cbb. インスタン
     スを返します。オプション引数 'maxlinelen' 、 'header_name' および
     'continuation_ws' は ‘Header’ コンストラクタに与えるものと同じです
     。

          注釈: 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.21.1.16 ‘email.charset’: 文字集合の表現
.........................................

'ソースコード:' Lib/email/charset.py(1)

__________________________________________________________________

このモジュールは、レガシーな (‘Compat32’) email API の一部分です。 新し
い API では別名の表のみ使われています。

この節の以降のテキストはモジュールの元々のドキュメントです。

このモジュールは文字集合の表現および電子メールメッセージの文字集合の変換
を行う *note Charset: fff. クラスに加え、文字集合のレジストリとそれを操
作する簡易メソッドを提供しています。 ‘Charset’ インスタンスは *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: fff. インスタンスは以下のようなデータ属性をもってい
     ます:

      -- の属性: 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: fff. インスタンスは、以下のメソッドも持っています:

      -- メソッド: 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(): 3c5e. と似ていますが、与えられた
          引数 'maxlengths' に従って、行の最大長に合うように文字列が調整
          されるところが異なります。 'maxlengths' はイテレータでなければ
          なりません: このイテレータが返す要素は次の行の最大長を表します
          。

      -- メソッド: body_encode (string)

          文字列 'string' をメッセージ本体用にエンコードします。

          エンコーディングの形式 (base64 または quoted-printable) は、
          'body_encoding' 属性に基づきます。

     *note Charset: fff. クラスには、標準的な演算と組み込み関数をサポー
     トするいくつかのメソッドがあります。

      -- メソッド: __str__ ()

          'input_charset' を小文字に変換された文字列型として返します。
          ‘__repr__()’ は、 ‘__str__()’ の別名となっています。

      -- メソッド: __eq__ (other)

          このメソッドは、2つの *note Charset: fff. インスタンスが同じか
          どうかをチェックするのに使います。

      -- メソッド: __ne__ (other)

          このメソッドは、2つの *note Charset: fff. インスタンスが異なる
          かどうかをチェックするのに使います。

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(): 3c65. を使ってください。より詳しい情報については
     *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:
     16a. の *note encode(): ad6. メソッドの第 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.21.1.17 ‘email.encoders’: エンコーダー
........................................

'ソースコード:' Lib/email/encoders.py(1)

__________________________________________________________________

このモジュールは、レガシーな (‘Compat32’) email APIの一部です。新しい
APIでは、この機能は *note set_content(): 1cba. メソッドの*cte*パラメータ
によって提供されます。

このモジュールはPython3で非推奨になりました。 *note MIMEText: ffe. クラ
スはクラスのインスタンス化中に渡された '_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: 3c49. and *note MIMEImage: 3bdc. 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: 199. が発生します。

提供されているエンコーディング関数は以下のとおりです:

 -- の関数: 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(): 3c6a. を使ってエンコードすると、デー
タ中のタブ文字や空白文字もエンコードされます。


File: python.info,  Node: email utils Miscellaneous utilities,  Next: email iterators イテレータ,  Prev: email encoders エンコーダー,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.21.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.

     バージョン 3.12 で非推奨、バージョン 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:
     16a. か *note Charset: fff. のインスタンスで、デフォルトは ‘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: 3c2a.

     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(): 3c73. は正しく推測しようとします。 'date' は
     ‘"Mon, 20 Nov 1995 19:12:08 -0500"’ のような RFC 2822(5) 形式の日付
     を含む文字列です。 日付の解析に成功した場合、 ‘parsedate()’ は関数
     *note time.mktime(): 1405. に直接渡せる形式の 9 要素からなるタプル
     を返します。 失敗した場合は ‘None’ を返します。 返されるタプルの 6、
     7、8番目の添字は使用不可なので注意してください。

 -- の関数: email.utils.parsedate_tz (date)

     Performs the same function as *note parsedate(): 3c73, 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(): 1405, 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(): 12d7.  Performs the same
     function as *note parsedate(): 3c73, 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: 12d9. *note tzinfo: 7f6.

     Added in version 3.3.

 -- の関数: email.utils.mktime_tz (tuple)

     *note parsedate_tz(): 1c80. が返す 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(): 13dc. and *note time.localtime():
     1717, 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: 3c36. は 3 要素からなるタプルを返すことが
     あります。ここには、そのパラメータの文字セット、言語、および値の順
     に格納されています。 *note collapse_rfc2231_value(): 3c37. はこのパ
     ラメータをひとつの Unicode 文字列にまとめます。オプション引数
     'errors' は *note str: 16a. の *note encode(): ad6. メソッドの引数
     'errors' に渡されます。このデフォルト値は ‘'replace'’ となっていま
     す。オプション引数 'fallback_charset' は、もし RFC 2231(11) ヘッダ
     の使用している文字セットが Python の知っているものではなかった場合
     の非常用文字セットとして使われます。デフォルトでは、この値は
     ‘'us-ascii'’ です。

     便宜上、 *note collapse_rfc2231_value(): 3c37. に渡された引数
     '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.21.1.19 ‘email.iterators’: イテレータ
.......................................

'ソースコード:' Lib/email/iterators.py(1)

__________________________________________________________________

Iterating over a message object tree is fairly easy with the *note
Message.walk: 3c3f. 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(): 177c. を使っ
     て、ファイルからメッセージを (ヘッダだけとばして) フラットなテキス
     トとして読むのにいくぶん似ているかもしれません。

     オプション引数 'decode' は、 *note Message.get_payload: 13e9. にそ
     のまま渡されます。

 -- の関数: email.iterators.typed_subpart_iterator (msg,
          maintype='text', subtype=None)

     このイテレータは 'msg' 中のすべてのサブパートをたどり、それらの中で
     指定されたMIME 形式 'maintype' と 'subtype' をもつようなパートのみ
     を返します。

     'subtype' は省略可能であることに注意してください。これが省略された
     場合、サブパートの MIME 形式は maintype のみがチェックされます。じ
     つは 'maintype' も省略可能で、その場合にはデフォルトは ‘text’ です
     。

     つまり、デフォルトでは *note typed_subpart_iterator(): 3c7b. は
     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(): 117b. 関数が対応できるようになって
     いる必要があります。 '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.21.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: f46. の拡張:

     >>> 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 コマンドライン・インターフェース: 240. を参照してく
ださい。

     注釈: 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.21.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への変換表: 3c81. を使って、 'obj' を JSON
     形式の 'fp' (‘.write()’ がサポートされている *note file-like
     object: 181a.) へのストリームとして直列化します。

          注釈: *note pickle: ab. や *note marshal: 91. とは異なり JSON
          はフレーム付きのプロトコルではないので、同じ 'fp' に対し繰り返
          し *note dump(): f44. を呼び、複数のオブジェクトを直列化しよう
          とすると、不正な JSON ファイルが作られてしまいます。


     パラメータ:

        * ‘obj’ (*note object: c82.) - The Python object to be
          serialized.

        * ‘fp’ (*note file-like object: 181a.) - The file-like object
          'obj' will be serialized to.  The ‘json’ module always
          produces *note str: 16a. objects, not *note bytes: 193.
          objects, therefore ‘fp.write()’ must support ‘str’ input.

        * ‘skipkeys’ (*note bool: 3c1.) - If ‘True’, keys that are not
          of a basic type (*note str: 16a, *note int: 19c, *note float:
          197, ‘bool’, ‘None’) will be skipped instead of raising a
          *note TypeError: 199.  Default ‘False’.

        * ‘ensure_ascii’ (*note bool: 3c1.) - 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: 3c1.) - If ‘False’, the circular
          reference check for container types is skipped and a circular
          reference will result in a *note RecursionError: f6c. (or
          worse).  Default ‘True’.

        * ‘allow_nan’ (*note bool: 3c1.) - If ‘False’, serialization of
          out-of-range *note float: 197. values (‘nan’, ‘inf’, ‘-inf’)
          will result in a *note ValueError: 2ee, in strict compliance
          with the JSON specification.  If ‘True’ (the default), their
          JavaScript equivalents (‘NaN’, ‘Infinity’, ‘-Infinity’) are
          used.

        * ‘cls’ (a *note JSONEncoder: f46. subclass) - If set, a custom
          JSON encoder with the *note default(): 3c82. method
          overridden, for serializing into custom datatypes.  If ‘None’
          (the default), ‘JSONEncoder’ is used.

        * ‘indent’ (*note int: 19c.‘ | ’*note str: 16a.‘ | ’‘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), no newlines are inserted.

        * ‘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: 2df7. | 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: 199.  If ‘None’ (the default), ‘TypeError’
          is raised.

        * ‘sort_keys’ (*note bool: 3c1.) - 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 変換表: 3c81. を使って、'obj' を JSON 形式の *note str:
     16a. オブジェクトに直列化します。引数は *note dump(): f44. と同じ意
     味です。

          注釈: JSON のキー値ペアのキーは、常に *note str: 16a. 型です。
          辞書が 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: 3c83.


     パラメータ:

        * ‘fp’ (*note file-like object: 181a.) - A ‘.read()’-supporting
          *note text file: 20c9. or *note binary file: 20ca. containing
          the JSON document to be deserialized.

        * ‘cls’ (a *note JSONDecoder: f47. 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: 2df7. | None) - If set, a
          function that is called with the result of any JSON object
          literal decoded (a *note dict: 184.).  The return value of
          this function will be used instead of the ‘dict’.  This
          feature can be used to implement custom decoders, for example
          JSON-RPC(1) class hinting.  Default ‘None’.

        * ‘object_pairs_hook’ (*note callable: 2df7. | 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:
          184.  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: 2df7. | 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: 200.

        * ‘parse_int’ (*note callable: 2df7. | 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: 197.

        * ‘parse_constant’ (*note callable: 2df7. | 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: 1026. - When the data being
          deserialized is not a valid JSON document.

        * *note UnicodeDecodeError: c0c. - 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: 20ca. 型も使えるようになりました
          。入力のエンコーディングは UTF-8, UTF-16, UTF-32 のいずれかで
          なければなりません。

     バージョン 3.11 で変更: デフォルトの 'parse_int' である *note
     int(): 19c. は、インタープリタの *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(): eb6, but instead of a file-like object,
     deserialize 's' (a *note str: 16a, *note bytes: 193. or *note
     bytearray: 342. instance containing a JSON document) to a Python
     object using this *note conversion table: 3c83.

     バージョン 3.6 で変更: 's' には *note bytes: 193. 型と *note
     bytearray: 342. 型も使えるようになりました。 入力エンコーディングは
     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.21.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: 184.  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: 184.  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:
     200.).

     '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: 197.).

     '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: 1026. が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 5a5.
     になりました。

      -- メソッド: decode (s)

          's' (*note str: 16a. インスタンスで JSON 文書を含むもの) の
          Python 表現を返します。

          不正な JSON ドキュメントが与えられた場合、 *note
          JSONDecodeError: 1026. が送出されます。

      -- メソッド: raw_decode (s)

          's' (*note str: 16a. インスタンスで 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(): 3c82. メソッドを次のように実装しま
     す。もう一つ別のメソッドでオブジェクト ‘o’ に対する直列化可能なオブ
     ジェクトを返すものを呼び出すようにします。変換できない時はスーパー
     クラスの実装を (*note TypeError: 199. を送出させるために) 呼ばなけ
     ればなりません。

     If 'skipkeys' is false (the default), a *note TypeError: 199. will
     be raised when trying to encode keys that are not *note str: 16a,
     *note int: 19c, *note float: 197, *note bool: 3c1. 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: f6c. を引き起こし
     ます) を防止します。 ‘True’ でない場合は、そういったチェックは施さ
     れません。

     'allow_nan' が true (デフォルト) ならば、 ‘NaN’, ‘Infinity’,
     ‘-Infinity’ はそのままエンコードされます。この振る舞いは JSON 仕様
     に従っていませんが、大半の JavaScript ベースのエンコーダ、デコーダ
     と矛盾しません。 ‘True’ でない場合は、そのような浮動小数点数をエン
     コードすると *note ValueError: 2ee. が送出されます。

     '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: 199. を送出しなければなりません。 指定しない場
     合は、 ‘TypeError’ が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 5a5.
     になりました。

      -- メソッド: default (o)

          このメソッドをサブクラスで実装する際には 'o' に対して直列化可
          能なオブジェクトを返すか、基底クラスの実装を (*note TypeError:
          199. を送出するために) 呼び出すかします。

          例えば、任意のイテレータをサポートする場合、 *note default():
          3c82. をこのように実装できます

               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.21.2.3 例外
.............

 -- 例外: json.JSONDecodeError (msg, doc, pos)

     *note ValueError: 2ee. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: 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.21.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: f46. and *note JSONDecoder: f47.
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.21.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 文字列: 16a. の間の変換において厳密に定義されていて、それ
以外のパラメータで文字エンコーディングに直接的に関わるものはありません。

RFC は JSON テキストの最初にバイトオーダマーク(BOM)を追加することを禁止
していますので、このモジュールはその出力に BOM を追加しません。RFC は
JSON デシリアライザが入力の一番最初の BOM を無視することを、許容はします
が求めてはいません。このモジュールのデシリアライザは一番最初の BOM を見
つけると *note ValueError: 2ee. を送出します。

RFC は JSON 文字列に正当な Unicode 文字に対応付かないバイト列(例えばペア
にならない UTF-16 サロゲートのかたわれ)が含まれることを明示的に禁止して
はおらず、もちろんこれは相互運用性の問題を引き起こします。デフォルトでは
、このモジュールは(オリジナルの *note str: 16a. にある場合)そのようなシ
ーケンスのコードポイントを受け取り、出力します。


File: python.info,  Node: 無限および NaN の数値,  Next: オブジェクト中に重複した名前の扱い,  Prev: 文字エンコーディング,  Up: 標準への準拠と互換性

5.21.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.21.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.21.2.8 トップレベルの非オブジェクト、非配列の値の扱い
.......................................................

廃止された RFC 4627(1) によって規定された古いバージョンの JSON では、
JSON テキストのトップレベルの値は JSON オブジェクトか配列(Python での
*note dict: 184. か *note list: 24f.)であることを要求していて、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.21.2.9 実装の制限
...................

いくつかの JSON デシリアライザの実装は、以下の制限を設定することがありま
す。

   * 受け入れられる JSON テキストのサイズ

   * JSON オブジェクトと配列のネストの最大の深さ

   * JSON 数値の範囲と精度

   * JSON 文字列の内容と最大の長さ

このモジュールは関連する Python データ型や Python インタプリタ自身の制約
の世界を超えたそのような制約を強要はしません。

JSON にシリアライズする際には、あなたの JSON を消費する側のアプリケーシ
ョンが持つ当該制約に思いを馳せてください。とりわけJSON 数値を IEEE 754 倍
精度浮動小数にデシリアライズする際の問題はありがちで、すなわちその有効桁
数と精度の制限の影響を受けます。これは、極端に大きな値を持った Python
*note int: 19c. をシリアライズするとき、あるいは *note decimal.Decimal:
200. のような "風変わりな" 数値型をシリアライズするとき、に特に関係があ
ります。


File: python.info,  Node: コマンドライン・インターフェース<5>,  Prev: 標準への準拠と互換性,  Up: json --- JSON エンコーダーとデコーダー

5.21.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: cd1. が使用されます。

     $ 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: 3c96. オ
プションを使ってください。

バージョン 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.21.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: cd1. に書き込みます。

 -- Option: --sort-keys

     辞書の出力を、キーのアルファベット順にソートします。

     Added in version 3.5.

 -- Option: --no-ensure-ascii

     非 ASCII 文字のエスケープを無効化します。より詳しくは *note
     json.dumps(): f45. を参照してください。

     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.21.3 ‘mailbox’ -- 様々な形式のメールボックスを操作する
--------------------------------------------------------

'ソースコード:' Lib/mailbox.py(1)

__________________________________________________________________

このモジュールでは二つのクラス *note Mailbox: 1467. および *note
Message: 146c. をディスク上のメールボックスとそこに収められたメッセージ
へのアクセスと操作のために定義しています。 ‘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.21.3.1 ‘Mailbox’ オブジェクト
...............................

 -- クラス: mailbox.Mailbox

     メールボックス。内容を確認したり変更したりできます。

     ‘Mailbox’ クラスはインターフェースを定義するもので、インスタンス化
     されることは想定していません。代わりに、‘Mailbox’ から継承した形式
     ごとのサブクラスを作り、コードでは特定のサブクラスをインスタンス化
     するべきです。

     ‘Mailbox’ のインターフェースは辞書風で、小さなキーがメッセージに対
     応します。キーは対象となる ‘Mailbox’ インスタンスが発行するもので、
     その ‘Mailbox’ インスタンスに対してのみ意味を持ちます。一つのキーは
     一つのメッセージにひも付けられ、その対応はメッセージが他のメッセー
     ジで置き換えられるような更新をされたあとも続きます。

     メッセージを ‘Mailbox’ インスタンスに追加するには集合風のメソッド
     *note add(): 1468. を使います。また削除は ‘del’ 文または集合風の
     *note remove(): 3ca7. や *note discard(): 3ca8. を使って行ないます
     。

     ‘Mailbox’ インターフェースのセマンティクスと辞書のそれとは注意すべ
     き違いがあります。メッセージは、要求されるたびに新しい表現(典型的に
     は *note Message: 146c. インスタンス)が現在のメールボックスの状態に
     基づいて生成されます。同様に、メッセージが ‘Mailbox’ インスタンスに
     追加される時も、渡されたメッセージ表現の内容がコピーされます。どち
     らの場合も ‘Mailbox’ インスタンスにメッセージ表現への参照は保たれま
     せん。

     デフォルトの ‘Mailbox’ *note イテレータ: 4c8. はメッセージ表現ごと
     に繰り返すもので、*note 辞書: 184. のイテレータのようにキーごとの繰
     り返しではありません。さらに、繰り返し中のメールボックスを変更する
     ことは安全であり整合的に定義されています。イテレータが作られた後に
     メールボックスに追加されたメッセージはそのイテレータからは見えませ
     ん。そのイテレータが yield するまえにメールボックスから削除されたメ
     ッセージは黙ってスキップされますが、イテレータからのキーを使ったと
     きにはそのキーに対応するメッセージが削除されているならば *note
     KeyError: 5e7. を受け取ることになります。

          警告: 十分な注意を、何か他のプロセスによっても同時に変更される
          可能性のあるメールボックスを更新する時は、払わなければなりませ
          ん。そのようなタスクをこなすのに最も安全なメールボックス形式は
          *note Maildir: 65e. で、 *note mbox: 1a5d. のような単一ファイ
          ルの形式を並行した書き込みに利用するのは避けるように努力しまし
          ょう。メールボックスを更新する場面では、 '必ず' *note lock():
          3ca9. と *note unlock(): 3caa. メソッドを、ファイル内のメッセ
          ージを読んだり書き込んだり削除したりといった操作をする '前' に
          、呼び出してロックします。メールボックスをロックし損なうと、メ
          ッセージを失ったりメールボックス全体をぐちゃぐちゃにしたりする
          羽目に陥ります。

     ‘Mailbox’ インスタンスには次のメソッドがあります:

      -- メソッド: add (message)

          メールボックスに 'message' を追加し、それに割り当てられたキー
          を返します。

          引数 'message' は *note Message: 146c. インスタンス、 *note
          email.message.Message: 581. インスタンス、文字列、バイト文字列
          、ファイル風オブジェクト (バイナリモードで開かれていなければな
          りません) を使えます。 'message' が適切な形式に特化した
          ‘Message’ サブクラスのインスタンス (例えばメールボックスが
          *note mbox: 1a5d. インスタンスのときの *note mboxMessage:
          3b68. インスタンス) であれば、形式ごとの情報が利用されます。そ
          うでなければ、形式ごとに必要な情報は適当なデフォルトが使われま
          す。

          バージョン 3.2 で変更: バイナリ入力のサポートが追加されました
          。

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          メールボックスから 'key' に対応するメッセージを削除します。

          対応するメッセージが無い場合、メソッドが *note remove(): 3ca7.
          または *note __delitem__(): 3cab. として呼び出されている時は
          *note KeyError: 5e7. 例外が送出されます。しかし、 *note
          discard(): 3ca8. として呼び出されている場合は例外は発生しませ
          ん。基づいているメールボックス形式が別のプロセスからの平行した
          変更をサポートしているならば、この ‘discard()’ の振る舞いの方
          が好まれるかもしれません。

      -- メソッド: __setitem__ (key, message)

          'key' に対応するメッセージを 'message' で置き換えます。 'key'
          に対応しているメッセージが既に無くなっている場合 *note
          KeyError: 5e7. 例外が送出されます。

          *note add(): 1468. と同様に、引数の 'message' には *note
          Message: 146c. インスタンス、 *note email.message.Message:
          581. インスタンス、文字列、バイト文字列、ファイル風オブジェク
          ト (バイナリモードで開かれていなければなりません) を使えます。
          'message' が適切な形式に特化した ‘Message’ サブクラスのインス
          タンス (例えばメールボックスが *note mbox: 1a5d. インスタンス
          のときの *note mboxMessage: 3b68. インスタンス) であれば、形式
          ごとの情報が利用されます。そうでなければ、現在 'key' に対応す
          るメッセージの形式ごとの情報が変更されずに残ります。

      -- メソッド: iterkeys ()

          Return an *note iterator: 4c8. over all keys

      -- メソッド: keys ()

          The same as *note iterkeys(): 3cad, except that a *note list:
          24f. is returned rather than an *note iterator: 4c8.

      -- メソッド: itervalues ()
      -- メソッド: __iter__ ()

          全てのメッセージの表現についての *note イテレータ: 4c8. を返し
          ます。メッセージは適切な形式ごとの *note Message: 146c. サブク
          ラスのインスタンスとして表現されるのが普通ですが、 ‘Mailbox’ イ
          ンスタンスが初期化されるときに指定すればお好みのメッセージファ
          クトリを使うこともできます。

               注釈: *note __iter__(): 3cb0. は辞書のそれのようにキーに
               ついてのイテレータではありません。

      -- メソッド: values ()

          The same as *note itervalues(): 3caf, except that a *note
          list: 24f. is returned rather than an *note iterator: 4c8.

      -- メソッド: iteritems ()

          ('key', 'message') ペア、ただし 'key' はキーで 'message' はメ
          ッセージ表現、のイテレータを返します。メッセージは適切な形式ご
          との *note Message: 146c. サブクラスのインスタンスとして表現さ
          れるのが普通ですが、 ‘Mailbox’ インスタンスが初期化されるとき
          に指定すればお好みのメッセージファクトリを使うこともできます。

      -- メソッド: items ()

          The same as *note iteritems(): 3cb2, except that a *note list:
          24f. of pairs is returned rather than an *note iterator: 4c8.
          of pairs.

      -- メソッド: get (key, default=None)
      -- メソッド: __getitem__ (key)

          'key' に対応するメッセージの表現を返します。対応するメッセージ
          が存在しない場合、 *note get(): 3cb4. として呼び出されたなら
          'default' を返しますが、 ‘__getitem__()’ として呼び出されたな
          ら *note KeyError: 5e7. 例外が送出されます。メッセージは適切な
          形式ごとの *note Message: 146c. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ スタンスが初期化されると
          きに指定すればお好みのメッセージファクトリを使うこともできます
          。

      -- メソッド: get_message (key)

          'key' に対応するメッセージの表現を形式ごとの *note Message:
          146c. サブクラスのインスタンスとして返します。もし対応するメッ
          セージが存在しなければ *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 ファイル風: 181a. 表
          現として返します。もし対応するメッセージが存在しなければ *note
          KeyError: 5e7. 例外が送出されます。ファイル風オブジェクトはバ
          イナリモードで開かれているように振る舞います。このファイルは必
          要がなくなったら閉じなければなりません。

          バージョン 3.2 で変更: ファイルオブジェクトは実際は *note
          バイナリファイル: 20ca. です; 以前は誤ってテキストモードで返さ
          れていました。 また、現在 *note ファイル風オブジェクト: 181a.
          は *note コンテキストマネージャ: 1e3. プロトコルをサポートして
          います: *note with: 187. 文を用いることで自動的にファイルを閉
          じることができます。

               注釈: 他の表現方法とは違い、*note ファイル風: 181a. 表現
               はそれを作り出した ‘Mailbox’ インスタンスやそれが基づいて
               いるメールボックスと独立である必要がありません。より詳細
               な説明は各サブクラスごとにあります。

      -- メソッド: __contains__ (key)

          'key' がメッセージに対応していれば ‘True’ を、そうでなければ
          ‘False’ を返します。

      -- メソッド: __len__ ()

          メールボックス中のメッセージ数を返します。

      -- メソッド: clear ()

          メールボックスから全てのメッセージを削除します。

      -- メソッド: pop (key, default=None)

          'key' に対応するメッセージの表現を返します。メッセージは適切な
          形式ごとの *note Message: 146c. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ インスタンスが初期化され
          るときに指定すればお好みのメッセージファクトリを使うこともでき
          ます。

      -- メソッド: popitem ()

          任意に選んだ ('key', 'message') ペアを返します。ただしここで
          'key' はキーで 'message' はメッセージ表現です。もしメールボッ
          クスが空ならば、 *note KeyError: 5e7. 例外を送出します。メッセ
          ージは適切な形式ごとの *note Message: 146c. サブクラスのインス
          タンスとして表現されるのが普通ですが、 ‘Mailbox’ インスタンス
          が初期化されるときに指定すればお好みのメッセージファクトリを使
          うこともできます。

      -- メソッド: update (arg)

          引数 'arg' は 'key' から 'message' へのマッピングまたは
          ('key', 'message') ペアのイテレート可能オブジェクトでなければ
          なりません。メールボックスは、各 'key' と 'message' のペアにつ
          いて *note __setitem__(): 3cac. を使ったかのように 'key' に対
          応するメッセージが 'message' になるように更新されます。
          ‘__setitem__()’ と同様に、 'key' は既存のメールボックス中のメ
          ッセージに対応しているものでなければならず、そうでなければ
          *note KeyError: 5e7. が送出されます。ですから、一般的には
          'arg' に ‘Mailbox’ インスタンスを渡すのは間違いです。

               注釈: 辞書と違い、キーワード引数はサポートされていません
               。

      -- メソッド: flush ()

          保留されている変更をファイルシステムに書き込みます。 *note
          Mailbox: 1467. のサブクラスによっては変更はいつも直ちにファイ
          ルに書き込まれ ‘flush()’ は何もしないということもありますが、
          それでもこのメソッドを呼ぶように習慣付けておきましょう。

      -- メソッド: lock ()

          メールボックスの排他的アドバイザリロックを取得し、他のプロセス
          が変更しないようにします。ロックが取得できない場合 *note
          ExternalClashError: 3cbd. が送出されます。ロック機構はメールボ
          ックス形式によって変わります。メールボックスの内容に変更を加え
          るときは 'いつも' ロックを掛けるべきです。

      -- メソッド: unlock ()

          メールボックスのロックが存在する場合は解放します。

      -- メソッド: close ()

          メールボックスをフラッシュし、必要ならばアンロックし、開いてい
          るファイルを閉じます。 ‘Mailbox’ サブクラスによっては何もしな
          いこともあります。

* Menu:

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


File: python.info,  Node: Maildir オブジェクト,  Next: mbox オブジェクト,  Up: Mailbox オブジェクト

5.21.3.2 ‘Maildir’ オブジェクト
...............................

 -- クラス: mailbox.Maildir (dirname, factory=None, create=True)

     Maildir 形式のメールボックスのための *note Mailbox: 1467. のサブク
     ラス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモ
     ードで開かれているかのように振る舞う)ファイル風メッセージ表現を受け
     付けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MaildirMessage: 3cc1. がデフォルトのメッセージ表現として使われます
     。 '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 で変更: ‘Maildir’ now ignores files with a leading
     dot.

     ‘Maildir’ インスタンスには *note Mailbox: 1467. の全てのメソッドに
     加え以下のメソッドもあります:

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          名前が 'folder' であるフォルダを表わす ‘Maildir’ インスタンス
          を返します。そのようなフォルダが存在しなければ *note
          NoSuchMailboxError: 3cc5. 例外が送出されます。

      -- メソッド: add_folder (folder)

          名前が 'folder' であるフォルダを作り、それを表わす ‘Maildir’ イ
          ンスタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3cc8. 例外
          が送出されフォルダは削除されません。

      -- メソッド: 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: 3cc1. object, use its
          *note get_flags(): 3cca. method instead, because changes made
          by the message's *note set_flags(): 3ccb, *note add_flag():
          3ccc. and *note remove_flag(): 3ccd. methods are not reflected
          here until the mailbox's *note __setitem__(): 3cce. 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: 3cc1. object, use its
          *note set_flags(): 3ccb. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_flags(): 3cca.

          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(): 3ccc. method are similar to those
          for *note set_flags(): 1aa8.; 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(): 3ccd. method are similar to
          those for *note set_flags(): 1aa8.; 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: 3cc1. object, use its
          *note get_info(): 3ccf. method instead, because changes made
          by the message's *note set_info(): 3cd0. method are not
          reflected here until the mailbox's *note __setitem__(): 3cce.
          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: 3cc1. object, use its
          *note set_info(): 3cd0. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_info(): 3ccf.

          Added in version 3.13.

     ‘Maildir’ で実装された *note Mailbox: 1467. のいくつかのメソッドに
     は特別な注意が必要です:

      -- メソッド: 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.21.3.3 ‘mbox’ オブジェクト
............................

 -- クラス: mailbox.mbox (path, factory=None, create=True)

     mbox 形式のメールボックスのための *note Mailbox: 1467. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     mboxMessage: 3b68. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     mbox 形式は Unixシステム上でメールを保存する古くからある形式です。
     mbox メールボックスでは全てのメッセージが一つのファイルに保存されて
     おりそれぞれのメッセージは "From " という5文字で始まる行を先頭に付
     けられています。

     mbox 形式には幾つかのバリエーションがあり、それぞれオリジナルの形式
     にあった欠点を克服すると主張しています。互換性のために、 ‘mbox’ は
     オリジナルの(時に 'mboxo' と呼ばれる) 形式を実装しています。すなわ
     ち、 ‘Content-Length’ ヘッダはもしあっても無視され、メッセージのボ
     ディにある行頭の "From " はメッセージを保存する際に ">From " に変換
     されますが、この ">From " は読み出し時にも "From " に変換されません
     。

     ‘mbox’ で実装された *note Mailbox: 1467. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: 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(): 1a1e. や
          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.21.3.4 ‘MH’ オブジェクト
..........................

 -- クラス: mailbox.MH (path, factory=None, create=True)

     MH 形式のメールボックスのための *note Mailbox: 1467. のサブクラス。
     パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモードで
     開かれているかのように振る舞う)ファイル風メッセージ表現を受け付けて
     好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MHMessage: 3ce1. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MH はディレクトリに基づいたメールボックス形式で MH Message Handling
     System というメールユーザエージェントのために発明されました。 MH メ
     ールボックス中のそれぞれのメッセージは一つのファイルとして収められ
     ています。 MH メールボックスにはメッセージの他に別の MH メールボッ
     クス ('フォルダ' と呼ばれます)を含んでもかまいません。フォルダは無
     限にネストできます。 MH メールボックスにはもう一つ 'シーケンス' と
     いう名前付きのリストでメッセージをサブフォルダに移動することなく論
     理的に分類するものがサポートされています。シーケンスは各フォルダの
     ‘.mh_sequences’ というファイルで定義されます。

     ‘MH’ クラスは MH メールボックスを操作しますが、 ‘mh’ の動作の全てを
     模倣しようとはしていません。特に、 ‘mh’ が状態と設定を保存する
     ‘context’ や ‘.mh_profile’ といったファイルは書き換えませんし影響も
     受けません。

     ‘MH’ インスタンスには *note Mailbox: 1467. の全てのメソッドの他に次
     のメソッドがあります:

     バージョン 3.13 で変更: Supported folders that don't contain a
     ‘.mh_sequences’ file.

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          'folder' という名前のフォルダを表わす ‘MH’ インスタンスを返し
          ます。もしフォルダが存在しなければ *note NoSuchMailboxError:
          3cc5. 例外が送出されます。

      -- メソッド: add_folder (folder)

          'folder' という名前のフォルダを作成し、それを表わす ‘MH’ イン
          スタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3cc8. 例外
          が送出されフォルダは削除されません。

      -- メソッド: get_sequences ()

          シーケンス名をキーのリストに対応付ける辞書を返します。シーケン
          スが一つもなければ空の辞書を返します。

      -- メソッド: set_sequences (sequences)

          メールボックス中のシーケンスを *note get_sequences(): 3ce6. で
          返されるような名前とキーのリストを対応付ける辞書 'sequences' に
          基づいて再定義します。

      -- メソッド: pack ()

          番号付けの間隔を詰める必要に応じてメールボックス中のメッセージ
          の名前を付け替えます。シーケンスのリストのエントリもそれに応じ
          て更新されます。

               注釈: 既に発行されたキーはこの操作によって無効になるので
               それ以降使ってはなりません。

     ‘MH’ で実装された *note Mailbox: 1467. のいくつかのメソッドには特別
     な注意が必要です:

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          これらのメソッドはメッセージを直ちに削除します。名前の前にコン
          マを付加してメッセージに削除の印を付けるという MH の規約は使い
          ません。

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。 MH メー
          ルボックスに対するロックとは ‘.mh_sequences’ のロックと、それ
          が影響を与える操作中だけの個々のメッセージファイルに対するロッ
          クを意味します。

      -- メソッド: get_file (key)

          ホストプラットフォームにより、ファイルが開かれたままの場合はメ
          ッセージを削除することができない場合があります。

      -- メソッド: flush ()

          MH メールボックスへの変更は即時に適用されますのでこのメソッド
          は何もしません。

      -- メソッド: close ()

          ‘MH’ インスタンスは開いたファイルを保持しませんのでこのメソッ
          ドは *note unlock(): 3ced. と同じです。

参考
....

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.21.3.5 ‘Babyl’ オブジェクト
.............................

 -- クラス: mailbox.Babyl (path, factory=None, create=True)

     Babyl 形式のメールボックスのための *note Mailbox: 1467. のサブクラ
     ス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモー
     ドで開かれているかのように振る舞う)ファイル風メッセージ表現を受け付
     けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     BabylMessage: 3cf4. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     Babyl は単一ファイルのメールボックス形式で Emacs に付属している
     Rmail メールユーザエージェントで使われているものです。メッセージの
     開始は Control-Underscore (‘'\037'’) および Control-L (‘'\014'’) の
     二文字を含む行で示されます。メッセージの終了は次のメッセージの開始
     または最後のメッセージの場合には Control-Underscore を含む行で示さ
     れます。

     Babyl メールボックス中のメッセージには二つのヘッダのセット、オリジ
     ナルヘッダといわゆる可視ヘッダ、があります。可視ヘッダは典型的には
     オリジナルヘッダの一部を分り易いように再整形したり短くしたりしたも
     のです。 Babyl メールボックス中のそれぞれのメッセージには 'ラベル'
     というそのメッセージについての追加情報を記録する短い文字列のリスト
     を伴い、メールボックス中に見出されるユーザが定義した全てのラベルの
     リストは Babyl オプションセクションに保持されます。

     ‘Babyl’ インスタンスには *note Mailbox: 1467. の全てのメソッドの他
     に次のメソッドがあります:

      -- メソッド: get_labels ()

          メールボックスで使われているユーザが定義した全てのラベルのリス
          トを返します。

               注釈: メールボックスにどのようなラベルが存在するかを決め
               るのに、Babyl オプションセクションのリストを参考にせず、
               実際のメッセージを捜索しますが、Babyl セクションもメール
               ボックスが変更されたときにはいつでも更新されます。

     ‘Babyl’ で実装された *note Mailbox: 1467. のいくつかのメソッドには
     特別な注意が必要です:

      -- メソッド: get_file (key)

          Babyl メールボックスにおいて、メッセージのヘッダはボディと繋が
          って格納されていません。ファイル風の表現を生成するために、ヘッ
          ダとボディがファイルと同じ API を持つ *note io.BytesIO: 10a8.
          インスタンスに一緒にコピーされます。その結果、ファイル風オブジ
          ェクトは元にしているメールボックスとは真に独立していますが、文
          字列表現と比べてメモリーを節約することにはなりません。

      -- メソッド: 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.21.3.6 ‘MMDF’ オブジェクト
............................

 -- クラス: mailbox.MMDF (path, factory=None, create=True)

     MMDF 形式のメールボックスのための *note Mailbox: 1467. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MMDFMessage: 3cfb. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MMDF は単一ファイルのメールボックス形式で Multichannel Memorandum
     Distribution Facility というメール転送エージェント用に発明されたも
     のです。各メッセージは mbox と同様の形式で収められますが、前後を4つ
     の Control-A (‘'\001'’) を含む行で挟んであります。mbox 形式と同じよ
     うにそれぞれのメッセージの開始は "From " の5文字を含む行で示されま
     すが、それ以外の場所での "From " は格納の際 ">From " には変えられま
     せん。それは追加されたメッセージ区切りによって新たなメッセージの開
     始と見間違うことが避けられるからです。

     ‘MMDF’ で実装された *note Mailbox: 1467. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: 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(): 1a1e. や
          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.21.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: 1467. インスタンスを使って取得したメッセージを表現す
     るのに ‘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.21.3.8 ‘MaildirMessage’ オブジェクト
......................................

 -- クラス: mailbox.MaildirMessage (message=None)

     Maildir 固有の動作をするメッセージ。引数 'message' は *note
     Message: 146c. のコンストラクタと同じ意味を持ちます。

     通常、メールユーザエージェントは ‘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: 3b68. や *note
MMDFMessage: 3cfb. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3b68. または
                         *note MMDFMessage: 3cfb. の状態
                         
----------------------------------------------------------------------------
                         
"cur" サブディレクトリ   O フラグ
                         
                         
F フラグ                 F フラグ
                         
                         
R フラグ                 A フラグ
                         
                         
S フラグ                 R フラグ
                         
                         
T フラグ                 D フラグ
                         

‘MaildirMessage’ インスタンスが *note MHMessage: 3ce1. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note MHMessage: 3ce1. の状
                                    態
                                    
-------------------------------------------------------------------
                                    
"cur" サブディレクトリ              "unseen" シーケンス
                                    
                                    
"cur" サブディレクトリおよび S フ   "unseen" シーケンス無し
ラグ                                

F フラグ                            "flagged" シーケンス
                                    
                                    
R フラグ                            "replied" シーケンス
                                    

‘MaildirMessage’ インスタンスが *note BabylMessage: 3cf4. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note BabylMessage: 3cf4. の状態
                                    
------------------------------------------------------------------------
                                    
"cur" サブディレクトリ              "unseen" ラベル
                                    
                                    
"cur" サブディレクトリおよび S フ   "unseen" ラベル無し
ラグ                                

P フラグ                            "forwarded" または "resent" ラベ
                                    ル
                                    
                                    
R フラグ                            "answered" ラベル
                                    
                                    
T フラグ                            "deleted" ラベル
                                    


File: python.info,  Node: mboxMessage オブジェクト,  Next: MHMessage オブジェクト,  Prev: MaildirMessage オブジェクト,  Up: Message オブジェクト

5.21.3.9 ‘mboxMessage’ オブジェクト
...................................

 -- クラス: mailbox.mboxMessage (message=None)

     mbox 固有の動作をするメッセージ。引数 'message' は *note Message:
     146c. のコンストラクタと同じ意味を持ちます。

     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: eea. インスタンス、 *note time.strftime():
          1406. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 13dc. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: 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: 3cc1. インスタンスに
基づいて生成されるとき、 ‘MaildirMessage’ インスタンスの配送日時に基づい
て "From " 行が作り出され、次の変換が行われます:

結果の状態            *note MaildirMessage: 3cc1. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

‘mboxMessage’ インスタンスが *note MHMessage: 3ce1. インスタンスに基づい
て生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3ce1. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘mboxMessage’ インスタンスが *note BabylMessage: 3cf4. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3cf4. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘mboxMessage’ インスタンスが *note MMDFMessage: 3cfb. インスタンスに基づ
いて生成されるとき、"From " 行はコピーされ全てのフラグは直接対応します:

結果の状態            *note MMDFMessage: 3cfb. の状
                      態
                      
-------------------------------------------------------
                      
R フラグ              R フラグ
                      
                      
O フラグ              O フラグ
                      
                      
D フラグ              D フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              A フラグ
                      


File: python.info,  Node: MHMessage オブジェクト,  Next: BabylMessage オブジェクト,  Prev: mboxMessage オブジェクト,  Up: Message オブジェクト

5.21.3.10 ‘MHMessage’ オブジェクト
..................................

 -- クラス: mailbox.MHMessage (message=None)

     MH 固有の動作をするメッセージ。引数 'message' は *note Message:
     146c. のコンストラクタと同じ意味を持ちます。

     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: 3cc1. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態               *note MaildirMessage: 3cc1. の状
                         態
                         
-------------------------------------------------------------
                         
"unseen" シーケンス      S フラグ無し
                         
                         
"replied" シーケンス     R フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note mboxMessage: 3b68. や *note
MMDFMessage: 3cfb. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3b68. または
                         *note MMDFMessage: 3cfb. の状態
                         
----------------------------------------------------------------------------
                         
"unseen" シーケンス      R フラグ無し
                         
                         
"replied" シーケンス     A フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note BabylMessage: 3cf4. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態               *note BabylMessage: 3cf4. の状
                         態
                         
-----------------------------------------------------------
                         
"unseen" シーケンス      "unseen" ラベル
                         
                         
"replied" シーケンス     "answered" ラベル
                         


File: python.info,  Node: BabylMessage オブジェクト,  Next: MMDFMessage オブジェクト,  Prev: MHMessage オブジェクト,  Up: Message オブジェクト

5.21.3.11 ‘BabylMessage’ オブジェクト
.....................................

 -- クラス: mailbox.BabylMessage (message=None)

     Babyl 固有の動作をするメッセージ。引数 'message' は *note Message:
     146c. のコンストラクタと同じ意味を持ちます。

     ある種のメッセージラベルは 'アトリビュート' と呼ばれ、規約により特
     別な意味が与えられています。アトリビュートは以下の通りです:

     ラベル          説明
                     
     ---------------------------------------------------------------
                     
     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: 146c. インスタンスを返します。

      -- メソッド: set_visible (visible)

          メッセージの可視ヘッダを 'visible' のヘッダと同じにセットしま
          す。引数 'visible' は *note Message: 146c. インスタンスまたは
          *note email.message.Message: 581. インスタンス、文字列、ファイ
          ル風オブジェクト(テキストモードで開かれてなければなりません)の
          いずれかです。

      -- メソッド: update_visible ()

          ‘BabylMessage’ インスタンスのオリジナルヘッダが変更されたとき
          、可視ヘッダは自動的に対応して変更されるわけではありません。こ
          のメソッドは可視ヘッダを以下のように更新します。対応するオリジ
          ナルヘッダのある可視ヘッダはオリジナルヘッダの値がセットされま
          す。対応するオリジナルヘッダの無い可視ヘッダは除去されます。そ
          して、オリジナルヘッダにあって可視ヘッダに無い ‘Date’ 、
          ‘From’ 、 ‘Reply-To’ 、 ‘To’ 、 ‘CC’ 、 ‘Subject’ は可視ヘッダ
          に追加されます。

‘BabylMessage’ インスタンスが *note MaildirMessage: 3cc1. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態              *note MaildirMessage: 3cc1. の状
                        態
                        
------------------------------------------------------------
                        
"unseen" ラベル         S フラグ無し
                        
                        
"deleted" ラベル        T フラグ
                        
                        
"answered" ラベル       R フラグ
                        
                        
"forwarded" ラベル      P フラグ
                        

‘BabylMessage’ インスタンスが *note mboxMessage: 3b68. や *note
MMDFMessage: 3cfb. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態             *note mboxMessage: 3b68. または
                       *note MMDFMessage: 3cfb. の状態
                       
--------------------------------------------------------------------------
                       
"unseen" ラベル        R フラグ無し
                       
                       
"deleted" ラベル       D フラグ
                       
                       
"answered" ラベル      A フラグ
                       

‘BabylMessage’ インスタンスが *note MHMessage: 3ce1. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態             *note MHMessage: 3ce1. の状
                       態
                       
------------------------------------------------------
                       
"unseen" ラベル        "unseen" シーケンス
                       
                       
"answered" ラベル      "replied" シーケンス
                       


File: python.info,  Node: MMDFMessage オブジェクト,  Prev: BabylMessage オブジェクト,  Up: Message オブジェクト

5.21.3.12 ‘MMDFMessage’ オブジェクト
....................................

 -- クラス: mailbox.MMDFMessage (message=None)

     MMDF 固有の動作をするメッセージ。引数 'message' は *note Message:
     146c. のコンストラクタと同じ意味を持ちます。

     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: 3b68. インスタンス
     と同一の以下のメソッドを提供します:

      -- メソッド: get_from ()

          mbox メールボックスのメッセージの開始を示す "From " 行を表わす
          文字列を返します。先頭の "From " および末尾の改行は含まれませ
          ん。

      -- メソッド: set_from (from_, time_=None)

          "From " 行を 'from_' にセットします。 'from_' は先頭の "From "
          や末尾の改行を含まない形で指定しなければなりません。利便性のた
          めに、 'time_' を指定して適切に整形して 'from_' に追加させるこ
          とができます。 'time_' を指定する場合、それは *note
          time.struct_time: eea. インスタンス、 *note time.strftime():
          1406. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 13dc. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: 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: 3cc1. インスタンスに
基づいて生成されるとき、"From"行が ‘MaildirMessage’ インスタンスの配信日
をもとに生成され、以下の変換が行われます:

結果の状態            *note MaildirMessage: 3cc1. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

 ‘MMDFMessage’ インスタンスが *note MHMessage: 3ce1. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3ce1. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘MMDFMessage’ インスタンスが *note BabylMessage: 3cf4. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3cf4. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘MMDFMessage’ インスタンスが *note mboxMessage: 3b68. インスタンスに基づ
いて生成されるとき、"From"行がコピーされ、全てのフラグが直接対応します:

結果の状態            *note mboxMessage: 3b68. の状
                      態
                      
-------------------------------------------------------
                      
R フラグ              R フラグ
                      
                      
O フラグ              O フラグ
                      
                      
D フラグ              D フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              A フラグ
                      


File: python.info,  Node: 例外<21>,  Next: 使用例<31>,  Prev: Message オブジェクト,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.21.3.13 例外
..............

‘mailbox’ モジュールでは以下の例外クラスが定義されています:

 -- 例外: mailbox.Error

     The base class for all other module-specific exceptions.

 -- 例外: mailbox.NoSuchMailboxError

     メールボックスがあると思っていたが見つからなかった場合に送出されま
     す。これはたとえば *note Mailbox: 1467. のサブクラスを存在しないパ
     スでインスタンス化しようとしたとき(かつ '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: 1a8f. イン
     スタンスが壊れた ‘.mh_sequences’ ファイルを読もうと試みた場合などに
     送出されます。


File: python.info,  Node: 使用例<31>,  Prev: 例外<21>,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.21.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.21.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(): 3d2f. がセットアップする情報に依存していれば、これらの関数
は、 ‘init()’ を呼びます。

 -- の関数: 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.

     *note Soft deprecated: 23f. since version 3.13: Passing a file path
     instead of URL is soft deprecated.  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: 3d31. から取られます。 Windows であれば、現在のレ
     ジストリの設定が読み込まれます。 'files' あるいは ‘knownfiles’ 内の
     各ファイル名は、それ以前に現れる名前より優先されます。繰り返し
     *note init(): 3d2f. を呼び出すことは許されています。

     '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(): 3d2f. により ‘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.21.4.1 MimeTypes objects
..........................

The *note MimeTypes: 1719. 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(): 3d3a. あるいは
     *note readfp(): 3d3b. メソッドを使って、データベースにロードするこ
     とで拡張されます。マッピング辞書も、もしデフォルトのデータが望むも
     のでなければ、追加のデータをロードする前にクリアされます。

     省略可能な 'filenames' パラメータは、追加のファイルを、デフォルトデ
     ータベースの"トップに"ロードさせるのに使うことができます。

      -- の属性: suffix_map

          サフィックスをサフィックスにマップする辞書。これは、符号化方式
          と型が同一拡張子で示されるような符号化ファイルが認識できるよう
          に使用されます。例えば、 ‘.tgz’ 拡張子は、符号化方式と型が別個
          に認識できるように ‘.tar.gz’ に対応づけられます。これは、最初
          はモジュールで定義されたグローバルな *note suffix_map: 3d34. の
          コピーです。

      -- の属性: encodings_map

          ファイル名拡張子を符号化型にマッピングする辞書。これは、最初は
          モジュールで定義されたグローバルな *note encodings_map: 3d35.
          のコピーです。

      -- の属性: types_map

          ファイル名拡張子を MIME 型にマッピングする 2 種類の辞書のタプ
          ル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期状態で
          はそれぞれ *note common_types: 3d37. と *note types_map: 3d36.
          です。

      -- の属性: types_map_inv

          MIME 型をファイル名拡張子のリストにマッピングする 2 種類の辞書
          のタプル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期
          状態ではそれぞれ *note common_types: 3d37. と *note types_map:
          3d36. です。

      -- メソッド: guess_extension (type, strict=True)

          *note guess_extension(): 3d30. 関数と同様ですが、オブジェクト
          に保存されたテーブルを使用します。

      -- メソッド: 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(): 1ca7. と同様ですが、オブジェクト
          に保存されたテーブルを参照します。

      -- メソッド: read (filename, strict=True)

          MIME 情報を、 'filename' という名のファイルからロードします。
          これはファイルを解析するのに *note readfp(): 3d3b. を使用しま
          す。

          '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: 2199.: 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 型に追加されます。

          バージョン 3.14 で非推奨、バージョン 3.16 で削除予定: Invalid,
          undotted extensions will raise a *note ValueError: 2ee. in
          Python 3.16.


File: python.info,  Node: コマンドラインでの使用<4>,  Next: コマンドラインの例<2>,  Prev: MimeTypes objects,  Up: mimetypes --- ファイル名を MIME タイプへマップする

5.21.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 output stream and exits with the return code ‘1’.


File: python.info,  Node: コマンドラインの例<2>,  Prev: コマンドラインでの使用<4>,  Up: mimetypes --- ファイル名を MIME タイプへマップする

5.21.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: media type unknown for 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: media type unknown for filename.xxx
     type: text/plain encoding: None

     $ # 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.21.5 ‘base64’ -- Base16, Base32, Base64, Base85 データのエンコード
--------------------------------------------------------------------

'ソースコード:' Lib/base64.py(1)

__________________________________________________________________

This module provides functions for encoding binary data to printable
ASCII characters and decoding such encodings back to binary data.  This
includes the *note encodings specified in: 3d4f. RFC 4648(2) (Base64,
Base32 and Base16), the *note Base85 encoding: 3d50. specified in PDF
2.0(3), and non-standard variants of Base85 used elsewhere.

このモジュールは、2つのインターフェースを提供します。このモダンなインタ
ーフェースは、*note bytes-like object: 194. を ASCII *note bytes: 193. に
エンコードし、bytes-like object か ASCII 文字列を、‘bytes’ にデコードす
ることができます。 RFC 4648(4) に定義されている base-64 アルファベット
(一般の、URL あるいはファイルシステムセーフなもの) の両方が使用できます
。

*note 従来のインターフェース: 3d51. は文字列からのデコードができませんが
、*note file object: 13df. との間のエンコードとデコードが可能な関数を提
供します。これは標準の base64 アルファベットのみをサポートし、 RFC
2045(5) の規定にあるように、76文字ごとに改行されます。 RFC 2045(6) のサ
ポートのためには、代わりに *note email: 3f. パッケージを参照する必要があ
るかもしれません。

バージョン 3.3 で変更: モダンなインターフェイスのデコード関数が ASCII の
みの Unicode 文字列を受け付けるようになりました。

バージョン 3.4 で変更: このモジュールのすべてのエンコード・デコード関数
が任意の *note bytes-like オブジェクト: 194. を受け取るようになりました
。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://pdfa.org/resource/iso-32000-2/

   (4) https://datatracker.ietf.org/doc/html/rfc4648.html

   (5) https://datatracker.ietf.org/doc/html/rfc2045.html

   (6) https://datatracker.ietf.org/doc/html/rfc2045.html


File: python.info,  Node: RFC 4648 エンコーディング,  Next: Base85 エンコーディング,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.21.5.1 RFC 4648 エンコーディング
..................................

RFC 4648(1) エンコーディングは、email で安全に送信したり、 URL の一部と
して使ったり、あるいは HTTP POST リクエストの一部に含めるために用いるの
に適しています。

 -- の関数: base64.b64encode (s, altchars=None)

     Base64 を使って *note bytes-like object: 194. の 's' をエンコードし
     、エンコードされた *note bytes: 193. を返します。

     オプション引数 'altchars' は長さ 2 の *note bytes-like object: 194.
     で 、‘+’ と ‘/’ の代わりに使われる代替アルファベットを指定します。
     これにより、アプリケーションはたとえば URL やファイルシステムの影響
     を受けない Base64 文字列を生成できます。デフォルトは ‘None’ で、標
     準の Base64 アルファベットが使われます。

     May assert or raise a *note ValueError: 2ee. if the length of
     'altchars' is not 2.  Raises a *note TypeError: 199. if 'altchars'
     is not a *note bytes-like object: 194.

 -- の関数: base64.b64decode (s, altchars=None, validate=False)

     Base64 エンコードされた *note bytes-like object: 194. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 193. を返しま
     す。

     オプション引数の 'altchars' は長さ 2 の *note bytes-like object:
     194. または ASCII 文字列で、‘+’ と ‘/’ の代わりに使われる代替アルフ
     ァベットを指定します。

     's' が正しくパディングされていない場合は *note binascii.Error:
     122b. 例外を発生させます。

     If 'validate' is ‘False’ (the default), characters that are neither
     in the normal base-64 alphabet nor the alternative alphabet are
     discarded prior to the padding check.  If 'validate' is ‘True’,
     these non-alphabet characters in the input result in a *note
     binascii.Error: 122b.

     厳密な base64 チェックのについての詳細は *note
     binascii.a2b_base64(): 17cf. を参照してください

     May assert or raise a *note ValueError: 2ee. if the length of
     'altchars' is not 2.

 -- の関数: base64.standard_b64encode (s)

     標準の base64 アルファベットを使用して *note bytes-like object:
     194. の 's' をエンコードし、エンコードされた *note bytes: 193. を返
     します。

 -- の関数: base64.standard_b64decode (s)

     標準の base64 アルファベットを使用した *note bytes-like object:
     194. または ASCII 文字列 's' をデコードし、デコードされた *note
     bytes: 193. を返します。

 -- の関数: base64.urlsafe_b64encode (s)

     Encode *note bytes-like object: 194. 's' using the URL- and
     filesystem-safe alphabet, which substitutes ‘-’ instead of ‘+’ and
     ‘_’ instead of ‘/’ in the standard Base64 alphabet, and return the
     encoded *note bytes: 193.  The result can still contain ‘=’.

 -- の関数: base64.urlsafe_b64decode (s)

     *note bytes-like object: 194. または ASCII 文字列 's' を URLとファ
     イルシステムセーフなアルファベットを利用してデコードし、デコードさ
     れた *note bytes: 193. を返します。標準 base64 アルファベットに比べ
     て、‘+’ の替わりに ‘-’ を、‘/’ の替わりに ‘_’ を置換します。

 -- の関数: base64.b32encode (s)

     Base32 を使って *note bytes-like object: 194. の 's' をエンコードし
     、エンコードされた *note bytes: 193. を返します。

 -- の関数: base64.b32decode (s, casefold=False, map01=None)

     Base32 エンコードされた *note bytes-like object: 194. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 193. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     RFC 4648(2) は付加的なマッピングとして、数字の 0 (零) をアルファベ
     ットの O (オー) に、数字の 1 (壱) をアルファベットの I (アイ) また
     は L (エル) に対応させることを許しています。オプション引数は
     'map01' は、 ‘None’ でないときは、数字の 1 をどの文字に対応づけるか
     を指定します ('map01' が ‘None’ でないとき、数字の 0 はつねにアルフ
     ァベットの O (オー) に対応づけられます)。セキュリティ上の理由により
     、これはデフォルトでは ‘None’ になっているため、 0 および 1 は入力
     として許可されていません。

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 122b. 例外を発生
     させます。

 -- の関数: 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: 194. の 's' をエンコードし
     、エンコードされた *note bytes: 193. を返します。

 -- の関数: base64.b16decode (s, casefold=False)

     Base16 エンコードされた *note bytes-like object: 194. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 193. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 122b. 例外を発生
     させます。

   ---------- 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.21.5.2 Base85 エンコーディング
................................

Base85 encoding is a family of algorithms which represent four bytes
using five ASCII characters.  Originally implemented in the Unix
‘btoa(1)’ utility, a version of it was later adopted by Adobe in the
PostScript language and is standardized in PDF 2.0 (ISO 32000-2).  This
version, in both its ‘btoa’ and PDF variants, is implemented by *note
a85encode(): 1125.

A separate version, using a different output character set, was defined
as an April Fool's joke in RFC 1924(1) but is now used by Git and other
software.  This version is implemented by *note b85encode(): 1127.

Finally, a third version, using yet another output character set
designed for safe inclusion in programming language strings, is defined
by ZeroMQ and implemented here by *note z85encode(): 47b.

The functions present in this module differ in how they handle the
following:

   * Whether to include and expect enclosing ‘<~’ and ‘~>’ markers.

   * Whether to fold the input into multiple lines.

   * The set of ASCII characters used for encoding.

   * Compact encodings of sequences of spaces and null bytes.

   * The encoding of zero-padding bytes applied to the input.

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: 194. の 'b' をエンコード
     し、エンコードされた *note bytes: 193. を返します。

     'foldspaces' is an optional flag that uses the special short
     sequence 'y' instead of 4 consecutive spaces (ASCII 0x20) as
     supported by 'btoa'.  This feature is not supported by the standard
     encoding used in PDF.

     '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' controls whether zero-padding applied to the end of the input
     is fully retained in the output encoding, as done by ‘btoa’,
     producing an exact multiple of 5 bytes of output.  This is not part
     of the standard encoding used in PDF, as it does not preserve the
     length of the data.

     'adobe' controls whether the encoded byte sequence is framed with
     ‘<~’ and ‘~>’, as in a PostScript base-85 string literal.  Note
     that while ASCII85Decode streams in PDF documents 'must' be
     terminated with ‘~>’, they 'must not' use a leading ‘<~’.

     Added in version 3.4.

 -- の関数: base64.a85decode (b, *, foldspaces=False, adobe=False,
          ignorechars=b' \t\n\r\x0b')

     Ascii85 エンコードされた *note bytes-like object: 194. または ASCII
     文字列 'b' をデコードし、デコードされた *note bytes: 193. を返しま
     す。

     'foldspaces' is a flag that specifies whether the 'y' short
     sequence should be accepted as shorthand for 4 consecutive spaces
     (ASCII 0x20).  This feature is not supported by the standard
     Ascii85 encoding used in PDF and PostScript.

     'adobe' controls whether the ‘<~’ and ‘~>’ markers are present.
     While the leading ‘<~’ is not required, the input must end with
     ‘~>’, or a *note ValueError: 2ee. is raised.

     '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: 194. の 'b' をエンコードし、エ
     ンコードされた *note bytes: 193. を返します。

     The input is padded with ‘b'\0'’ so its length is a multiple of 4
     bytes before encoding.  If 'pad' is true, all the resulting
     characters are retained in the output, which will always be a
     multiple of 5 bytes, and thus the length of the data may not be
     preserved on decoding.

     Added in version 3.4.

 -- の関数: base64.b85decode (b)

     Decode the base85-encoded *note bytes-like object: 194. or ASCII
     string 'b' and return the decoded *note bytes: 193.

     Added in version 3.4.

 -- の関数: base64.z85encode (s)

     Encode the *note bytes-like object: 194. 's' using Z85 (as used in
     ZeroMQ) and return the encoded *note bytes: 193.

     The ZeroMQ specification(2) requires the length of Z85-encoded data
     to be a multiple of 5 bytes.  To produce compliant data frames, you
     must pad the input data to this function to a multiple of 4 bytes.

     Added in version 3.13.

 -- の関数: base64.z85decode (s)

     Decode the Z85-encoded *note bytes-like object: 194. or ASCII
     string 's' and return the decoded *note bytes: 193.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1924.html

   (2) https://rfc.zeromq.org/spec/32/


File: python.info,  Node: レガシーインターフェース,  Next: セキュリティで考慮すべき点<4>,  Prev: Base85 エンコーディング,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.21.5.3 レガシーインターフェース
.................................

 -- の関数: base64.decode (input, output)

     'input' ファイルの中身をデコードし、結果のバイナリデータを 'output'
     ファイルに出力します。 'input' 、 'output' ともに *note file
     objects: 13df. でなければなりません。 'input' は ‘input.readline()’
     が空バイト列を返すまで読まれます。

 -- の関数: base64.decodebytes (s)

     *note bytes-like object: 194. 's' をデコードし、デコードされた
     *note bytes: 193. を返します。 's' には一行以上の base64 形式でエン
     コードされたデータが含まれている必要があります。

     Added in version 3.1.

 -- の関数: base64.encode (input, output)

     バイナリの 'input' ファイルの中身を base64 形式でエンコードした結果
     を 'output' ファイルに出力します。 'input' 、 'output' ともに *note
     file objects: 13df. でなければなりません。 'input' は
     ‘input.read()’ が空バイト列を返すまで読まれます。 *note encode():
     3d5d. は76バイトの出力ごとに改行文字(‘b'\n'’)を挿入し、 RFC 2045(1)
     (MIME) の規定にあるように常に出力が新しい行で終わることを保証します
     。

 -- の関数: base64.encodebytes (s)

     *note bytes-like object: 194. 's' (任意のバイナリデータを含むことが
     できます) を、 RFC 2045(2) (MIME) に規定されるように末尾に新しい行
     のある、76バイトの出力ごとに新しい行 (‘b'\n'’) が挿入された、base64
     形式でエンコードしたデータを含む *note bytes: 193. を返します。

     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.21.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.

ISO 32000-2 Portable document format - Part 2: PDF 2.0(3)

     Section 7.4.3, "ASCII85Decode Filter," provides the definition of
     the Ascii85 encoding used in PDF and PostScript, including the
     output character set and the details of data length preservation
     using zero-padding and partial output groups.

ZeroMQ RFC 32/Z85(4)

     The "Formal Specification" section provides the character set used
     in Z85.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4648.html

   (2) https://datatracker.ietf.org/doc/html/rfc1521.html

   (3) https://pdfa.org/resource/iso-32000-2/

   (4) https://rfc.zeromq.org/spec/32/


File: python.info,  Node: binascii --- バイナリ と ASCII 間の変換,  Next: quopri --- MIME quoted-printable データのエンコードとデコード,  Prev: base64 --- Base16 Base32 Base64 Base85 データのエンコード,  Up: インターネット上のデータの操作

5.21.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: 193. や *note bytearray: 342. または
     バッファープロトコルをサポートするその他のオブジェクトのような)
     *note bytes-like オブジェクト: 194. だけを受け取ります。

     バージョン 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: 122b.

     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)

     Convert binary data to a line of ASCII characters in base64 coding.
     The return value is the converted line, including a newline char if
     'newline' is true.  The output of this function conforms to 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(): f69. 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(): 28f6. の逆です。 'hexstr' は 16進数字 (大文字
     でも小文字でも構いません) を偶数個含んでいなければなりません。そう
     でない場合、例外 *note Error: 122b. が送出されます。

     Similar functionality (but more liberal towards whitespace) is also
     accessible using the *note bytes.fromhex(): 191. 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.21.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 バイナリファイルオブジェクト: 13df. でなければなりません。オ
     プション引数 '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 バイナリファイルオブジェクト: 13df. でなけ
     ればなりません。 'quotetabs' は、内容に含まれている空白とタブ文字を
     エンコードするかどうかを制御する必須のフラグで、真のときは空白文字
     をエンコードし、偽のときはエンコードしないままにしておきます。 RFC
     1521(4) に従って、行末にある空白とタブ文字は常にエンコードされるこ
     とに注意してください。 'header' は、空白を RFC 1522(5) に従ってアン
     ダースコアにエンコードするかどうかを制御するフラグです。

 -- の関数: quopri.decodestring (s, header=False)

     *note decode(): 28f9. に似ていますが、ソース *note bytes: 193. を受
     け取り、対応するデコードされた ‘bytes’ を返します。

 -- の関数: quopri.encodestring (s, quotetabs=False, header=False)

     *note encode(): 28f8. に似ていますが、ソース *note bytes: 193. を受
     け取り、対応するエンコードされた ‘bytes’ を返します。 デフォルトで
     は、 ‘encode()’ 関数の '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.22 構造化マークアップツール
=============================

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.22.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: 12ed. を対象としま
     す。

     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.22.2 ‘html.parser’ -- HTML と XHTML のシンプルなパーサー
----------------------------------------------------------

'ソースコード:' Lib/html/parser.py(1)

__________________________________________________________________

このモジュールでは *note HTMLParser: a7b. クラスを定義します。このクラス
は 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: a7b. インスタンスは、HTML データが入力されると、
     開始タグ、終了タグ、およびその他の要素が見つかる度にハンドラーメソ
     ッドを呼び出します。各メソッドの挙動を実装するには ‘HTMLParser’ サ
     ブクラスを使ってそれぞれを上書きして行います。

     このパーサーは終了タグが開始タグと一致しているか調べたり、外側のタ
     グ要素が閉じるときに内側で明示的に閉じられていないタグ要素のタグ終
     了ハンドラーを呼び出したりはしません。

     バージョン 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.22.2.1 HTML パーサーアプリケーションの例
..........................................

As a basic example, below is a simple HTML parser that uses the *note
HTMLParser: a7b. 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.22.2.2 ‘HTMLParser’ メソッド
..............................

*note HTMLParser: a7b. インスタンスは以下のメソッドを提供します:

 -- メソッド: HTMLParser.feed (data)

     パーサーにテキストを入力します。入力が完全なタグ要素で構成されてい
     る場合に限り処理が行われます; 不完全なデータであった場合、新たにデ
     ータが入力されるか、*note close(): 18a6. が呼び出されるまでバッファ
     ーされます。 'data' は *note str: 16a. でなければなりません。

 -- メソッド: HTMLParser.close ()

     全てのバッファーされているデータについて、その後にファイル終端マー
     クが続いているとみなして強制的に処理を行います。このメソッドは入力
     データの終端で行う追加処理を定義するために、派生クラスで再定義する
     ことができます。しかし、再定義されたバージョンでは、常に *note
     HTMLParser: a7b. 基底クラスのメソッド *note close(): 18a6. を呼び出
     さなくてはなりません。

 -- メソッド: HTMLParser.reset ()

     インスタンスをリセットします。未処理のデータはすべて失われます。イ
     ンスタンス化の際に暗黙的に呼び出されます。

 -- メソッド: HTMLParser.getpos ()

     現在の行番号およびオフセット値を返します。

 -- メソッド: HTMLParser.get_starttag_text ()

     最も最近開かれた開始タグのテキスト部分を返します。このテキストは必
     ずしも元データを構造化する上で必須ではありませんが、 "広く知られて
     いる (as deployed)" HTML を扱ったり、入力を最小限の変更で再生成 (属
     性間の空白をそのままにする、など) したりする場合に便利なことがあり
     ます。

以下のメソッドはデータまたはマークアップ要素が見つかる度に呼び出されます
。これらはサブクラスで上書きされることを想定されています。基底クラスの実
装は (*note handle_startendtag(): 3d7b. を除き) 何もしません:

 -- メソッド: HTMLParser.handle_starttag (tag, attrs)

     このメソッドは要素の開始タグを扱うために呼び出されます (例: ‘<div
     id="main">’)。

     The 'tag' argument is the name of the tag converted to lower case.
     The 'attrs' argument is a list of ‘(name, value)’ pairs containing
     the attributes found inside the tag's ‘<>’ brackets.  The 'name'
     will be translated to lower case, and quotes in the 'value' have
     been removed, and character and entity references have been
     replaced.  For empty attributes, 'value' is ‘None’.

     例えば、タグ ‘<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(): 3d7c. と似ていますが、パーサーが XHTML 形
     式の空タグ (‘<img ... />’) を見つける度に呼び出されます。この特定の
     字句情報が必要な場合にこのメソッドをサブクラスで上書きすることがで
     きます; 既定の実装では、単に ‘handle_starttag()’ および *note
     handle_endtag(): 3d7d. を呼び出します。

 -- メソッド: 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: a7b. クラスでは、処理指令に SGML の構
          文を使用します。末尾に ‘'?'’ がある XHTML の処理指令では、
          ‘'?'’ が 'data' に含まれることになります。

 -- メソッド: HTMLParser.unknown_decl (data)

     このメソッドはパーサーが未知の宣言を読み込んだ時に呼び出されます。

     パラメータ 'data' は ‘<![...]>’ マークアップ内の宣言の内容全体にな
     ります。 これは派生クラスで上書きする時に役立つことがあります。 基
     底クラスの実装では何もしません。


File: python.info,  Node: 使用例<32>,  Prev: HTMLParser メソッド,  Up: html parser --- HTML と XHTML のシンプルなパーサー

5.22.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

Attribute names are converted to lowercase, quotes from attribute values
removed, and ‘None’ is returned as 'value' for empty attributes (such as
‘checked’):

     >>> parser.feed("<input TYPE='checkbox' checked required='' disabled=disabled>")
     Start tag: input
          attr: ('type', 'checkbox')
          attr: ('checked', None)
          attr: ('required', '')
          attr: ('disabled', 'disabled')

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(): 3d77. works, but *note
handle_data(): 3d7e. 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.22.3 ‘html.entities’ -- HTML 一般実体の定義
---------------------------------------------

'ソースコード:' Lib/html/entities.py(1)

__________________________________________________________________

このモジュールは 4 つの辞書、*note html5: 12ed.、*note name2codepoint:
3d8a.、*note codepoint2name: 3d8b.、および *note entitydefs: 3d8c. を定
義しています。

 -- データ: html.entities.html5

     HTML5 名前付き文字参照 (2) と Unicode 文字とを対応付ける辞書です (例
     : ‘html5['gt;'] == '>'’)。末尾のセミコロンは名前に含まれますが (例:
     ‘'gt;'’)、一部の名前はセミコロンなしでも標準で受け付けます。この場
     合、‘';'’ ありの名前と ‘';'’ なしの名前が両方存在します。 *note
     html.unescape(): b54. も参照してください。

     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.22.4 XMLを扱うモジュール群
----------------------------

'ソースコード:' Lib/xml/(1)

__________________________________________________________________

PythonのXMLを扱うインターフェースは ‘xml’ パッケージにまとめられています
。

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3d91.

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: 12d.
module will always be available.

*note xml.dom: 128. および *note xml.sax: 130. パッケージのドキュメント
は Python による DOM および SAX インターフェースへのバインディングに関す
る定義です。

XML に関連するサブモジュール:

   * *note xml.etree.ElementTree: 12c.: ElementTree API、シンプルで軽量
     な XML プロセッサ

   * *note xml.dom: 128.: DOM API の定義

   * *note xml.dom.minidom: 129.: 最小限の DOM の実装

   * *note xml.dom.pulldom: 12a.: 部分的な DOM ツリー構築のサポート

   * *note xml.sax: 130.: SAX2 基底クラスと便利関数群

   * *note xml.parsers.expat: 12d.: 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.22.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: 1b8c. in your
environment.  Python may be vulnerable if it uses such older versions of
Expat.  Check ‘pyexpat.EXPAT_VERSION’.

*note xmlrpc: 134. 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.22.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: 3d91.

* 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.22.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.22.5.2 XML 木構造と要素
.........................

XML は本質的に階層データ形式で、木構造で表すのが最も自然な方法です。‘ET’
はこの目的のために 2 つのクラス - XML 文書全体を木で表す *note
ElementTree: b4b. および木構造内の単一ノードを表す *note Element: 361. -
を持っています。文書全体とのやりとり (ファイルの読み書き) は通常
‘ElementTree’ レベルで行います。単一 XML 要素およびその子要素とのやりと
りは ‘Element’ レベルで行います。


File: python.info,  Node: XML の解析,  Next: 非ブロックパースのためのプル API,  Prev: XML 木構造と要素,  Up: チュートリアル<3>

5.22.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(): 3d9b. は XML を文字列から *note Element: 361. に直接
パースします。‘Element’ はパースされた木のルート要素です。他のパース関数
は *note ElementTree: b4b. を作成するかもしれません。ドキュメントをきち
んと確認してください。

*note Element: 361. として、‘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: c4d. コ
     ンストラクタにカスタムの *note TreeBuilder: c4e. インスタンスを渡す
     ことで、アクセスすることができます。


File: python.info,  Node: 非ブロックパースのためのプル API,  Next: 関心ある要素の検索,  Prev: XML の解析,  Up: チュートリアル<3>

5.22.5.4 非ブロックパースのためのプル API
.........................................

このモジュールが提供するパース関数のほとんどは、結果を返す前に、ドキュメ
ント全体を読む必要があります。 *note XMLParser: c4d. を使用して、インク
リメンタルにデータを渡すことは可能ではありますが、それはコールバック対象
のメソッドを呼ぶプッシュ API であり、多くの場合、低水準すぎて不便です。
ユーザーが望むのは、完全に出来上がった *note Element: 361. オブジェクト
を便利に使いながら、操作をブロックすることなく XML のパースをインクリメ
ンタルに行えることです。

これを行うための最も強力なツールは、 *note XMLPullParser: 11f9. です。
XML データを取得するためにブロックするような読み込みは必要なく、 *note
XMLPullParser.feed(): 3d9d. を呼び出して、インクリメンタルにデータを読み
ます。パースされた XML 要素を取得するには、*note
XMLPullParser.read_events(): 3d9e. を呼び出します。以下に、例を示します
。

     >>> 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: 11f9. は柔軟性が非常に高いため、単純に使用したいユ
ーザーにとっては不便かもしれません。アプリケーションにおいて、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.22.5.5 関心ある要素の検索
...........................

*note Element: 361. は、例えば、*note Element.iter(): 156a. などの、配下
(その子ノードや孫ノードなど) の部分木全体を再帰的にイテレートするいくつ
かの役立つメソッドを持っています:

     >>> 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(): 18e0. はタグで現在の要素の直接の子要素のみ検索
します。 *note Element.find(): 18df. は特定のタグで '最初の' 子要素を検
索し、 *note Element.text: 3da0. は要素のテキストコンテンツにアクセスし
ます。 *note Element.get(): 3da1. は要素の属性にアクセスします:

     >>> 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: daa. を使用すると、より洗練された方法で、検索したい要素を指
定することができます。


File: python.info,  Node: XML ファイルの編集,  Next: XML 文書の構築,  Prev: 関心ある要素の検索,  Up: チュートリアル<3>

5.22.5.6 XML ファイルの編集
...........................

*note ElementTree: b4b. は XML 文書を構築してファイルに出力する簡単な方
法を提供しています。*note ElementTree.write(): c90. メソッドはこの目的に
適います。

*note Element: 361. オブジェクトを作成すると、そのフィールドの直接変更
(*note Element.text: 3da0. など) や、属性の追加および変更 (*note
Element.set(): 3da3. メソッド)、あるいは新しい子ノードの追加 (例えば
*note Element.append(): 3da4. など) によってそれを操作できます。

例えば各 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(): 18db. を使って要素を削除することが出来ます。例え
ば 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.22.5.7 XML 文書の構築
.......................

*note SubElement(): 3da6. 関数は、与えられた要素に新しい子要素を作成する
便利な手段も提供しています:

     >>> 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.22.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(): 18df. や *note findall(): 18e0. に渡す 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.22.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.22.5.10 使用例
................

以下はこのモジュールの XPath 機能の一部を紹介する例です。*note XML
の解析: 3d99. 節から 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.22.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.22.5.12 リファレンス
......................

* Menu:

* 関数: 関数<9>.


File: python.info,  Node: 関数<9>,  Up: リファレンス<5>

5.22.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: c4d. は、入力に含まれるコメントを読み飛ばし、コメ
     ントオブジェクトは作成しません。*note ElementTree: b4b. は、*note
     Element: 361. メソッドの 1 つを使用して木内に挿入されたコメントノー
     ドのみを含みます。

 -- の関数: xml.etree.ElementTree.dump (elem)

     要素の木もしくは要素の構造を sys.stdout に出力します。この関数はデ
     バッグ目的のみに使用してください。

     出力される形式の正確なところは実装依存です。このバージョンでは、通
     常の XML ファイルとして出力されます。

     'elem' は要素の木もしくは個別の要素です。

     バージョン 3.8 で変更: *note dump(): 3daf. 関数はユーザーが指定した
     属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.fromstring (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。 *note XML(): 3db0. と
     同じです。 'text' には XML データを含む文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: c4d. パーザを使用します。
     *note Element: 361. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.fromstringlist (sequence, parser=None)

     文字列フラグメントのシーケンスから XML ドキュメントを解析します。
     'sequence' は XML データのフラグメントを格納した、リストかその他の
     シーケンスです。 'parser' はオプションのパーザインスタンスです。パ
     ーザが指定されない場合、標準の *note XMLParser: c4d. パーザが使用さ
     れます。 *note Element: 361. インスタンスを返します。

     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: 13df. 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: c4d. parser is used.  'parser' must
     be a subclass of ‘XMLParser’ and can only use the default *note
     TreeBuilder: c4e. 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:
     11f9. を参照してください。

          注釈: *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: c4d. パーザが使用されます。 *note
     ElementTree: b4b. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.ProcessingInstruction (target,
          text=None)

     PI 要素のファクトリです。このファクトリ関数は XML の処理命令として
     シリアライズされた特別な要素を作成します。'target' は PI ターゲット
     を含んだ文字列です。'text' を指定する場合は PI コンテンツを含む文字
     列にします。PI を表わす要素インスタンスを返します。

     Note that *note XMLParser: c4d. skips over processing instructions
     in the input instead of creating PI objects for them.  An *note
     ElementTree: b4b. will only contain processing instruction nodes if
     they have been inserted into to the tree using one of the *note
     Element: 361. 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: 361. のインスタンスです。 'encoding'
     (2) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 'xml_declaration', 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): c90. での意
     味と同じ意味を持ちます。 XML データを含んだ (オプションで) エンコー
     ドされた文字列を返します。

     バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しました。

     バージョン 3.8 で変更: Added the 'xml_declaration' and
     'default_namespace' parameters.

     バージョン 3.8 で変更: The ‘tostring()’ 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: 361. のインスタンスです。 'encoding'
     (3) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 xml_declaration*, 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): c90. での意
     味と同じ意味を持ちます。 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(): 11fc. 関数はユーザーが
     指定した属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.XML (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。この関数は Python コー
     ドに "XML リテラル" を埋め込むのに使えます。 'text' には XML データ
     を含む文字列を指定します。 'parser' はオプションで、パーザのインス
     タンスを指定します。指定されなかった場合、標準の *note XMLParser:
     c4d. パーザを使用します。 *note Element: 361. インスタンスを返しま
     す。

 -- の関数: xml.etree.ElementTree.XMLID (text, parser=None)

     文字列定数で与えられた XML 断片を解析し、要素 ID と要素を対応付ける
     辞書を返します。 'text' には XMLデータを含んだ文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: c4d. パーザを使用します。
     *note Element: 361. のインスタンスと辞書のタプルを返します。

   ---------- 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.22.5.14 XInclude サポート
...........................

This module provides limited support for XInclude directives(1), via the
*note xml.etree.ElementInclude: 12b. 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.22.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.22.5.16 リファレンス
......................

* Menu:

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


File: python.info,  Node: 関数<10>,  Next: Element オブジェクト,  Up: リファレンス<6>

5.22.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: 361. 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: 361. or an
     *note ElementTree: b4b. instance to find such element.  'loader' is
     an optional resource loader.  If omitted, it defaults to *note
     default_loader(): 3dbc.  If given, it should be a callable that
     implements the same interface as ‘default_loader()’.  '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.22.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():
          13f1. を参照してください。例えば ‘"".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: 361. でない場合、*note
          TypeError: 199. を送出します。

      -- メソッド: extend (subelements)

          Appends 'subelements' from an iterable of elements.  Raises
          *note TypeError: 199. if a subelement is not an ‘Element’.

          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: daa.  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:
          daa.  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: daa.  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: 361. でない場合、*note
          TypeError: 199. を送出します。

      -- メソッド: iter (tag=None)

          現在の要素を根とする木の *note イテレータ: 4c8. を作成します。
          イテレータは現在の要素とそれ以下のすべての要素を、文書内での出
          現順 (深さ優先順) でイテレートします。 'tag' が ‘None’ または
          ‘'*'’ でない場合、与えられたタグに等しいものについてのみイテレ
          ータから返されます。イテレート中に木構造が変更された場合の結果
          は未定義です。

          Added in version 3.2.

      -- メソッド: iterfind (match, namespaces=None)

          タグ名または *note パス: daa. にマッチするすべての子要素を検索
          します。マッチしたすべての要素を文書内での出現順で yield する
          イテレータを返します。'namespaces' はオプションで、名前空間接
          頭辞と完全名を対応付けるマップオブジェクトを指定します。

          Added in version 3.2.

      -- メソッド: itertext ()

          テキストのイテレータを作成します。イテレータは、この要素とすべ
          ての子要素を文書上の順序で巡回し、すべての内部のテキストを返し
          ます。

          Added in version 3.2.

      -- メソッド: makeelement (tag, attrib)

          現在の要素と同じ型の新しい要素オブジェクトを作成します。このメ
          ソッドは呼び出さずに、 *note SubElement(): 3da6. ファクトリ関
          数を使って下さい。

      -- メソッド: remove (subelement)

          要素から 'subelement' を削除します。find* メソッド群と異なり、
          このメソッドは要素をインスタンスの同一性で比較します。タグや内
          容では比較しません。

     *note Element: 361. オブジェクトは以下のシーケンス型のメソッドを、
     サブ要素を操作するためにサポートします: *note __delitem__(): 14e8,
     *note __getitem__(): 588, *note __setitem__(): 14e7, *note
     __len__(): 17ff.

     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: 1a4.

     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(): c4c. 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.22.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(): 18df. と同じで、木の根要素を起点とします
          。

      -- メソッド: findall (match, namespaces=None)

          *note Element.findall(): 18e0. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: findtext (match, default=None, namespaces=None)

          *note Element.findtext(): 17b8. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: getroot ()

          この木のルート要素を返します。

      -- メソッド: iter (tag=None)

          根要素に対する、木を巡回するイテレータを返します。イテレータは
          木のすべての要素に渡ってセクション順にループします。'tag' は探
          したいタグです (デフォルトではすべての要素を返します)。

      -- メソッド: iterfind (match, namespaces=None)

          *note Element.iterfind(): 13f0. と同じで、木の根要素を起点とし
          ます。

          Added in version 3.2.

      -- メソッド: parse (source, parser=None)

          外部の XML 断片をこの要素木に入れます。'source' にはファイル名
          か *note ファイルオブジェクト: 13df. を指定します。'parser' は
          オプションで、パーザインスタンスを指定します。パーザが指定され
          ない場合、標準の *note XMLParser: c4d. パーザが使用されます。
          断片の根要素を返します。

      -- メソッド: write (file, encoding='us-ascii',
               xml_declaration=None, default_namespace=None,
               method='xml', *, short_empty_elements=True)

          要素の木をファイルに XML として書き込みます。 'file' は、書き
          込み用に開かれたファイル名または *note ファイルオブジェクト:
          13df. です。 '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: 16a.) かバ
          イト列 (*note bytes: 193.) になります。'encoding' が
          ‘"unicode"’ の場合、出力は文字列になり、それ以外ではバイト列に
          なります。'file' が *note ファイルオブジェクト: 13df. の場合、
          型が衝突する場合があります。文字列をバイト列ファイルへ書き込ん
          だり、その逆を行わないよう注意してください。

          バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しまし
          た。

          バージョン 3.8 で変更: *note write(): c90. メソッドはユーザー
          が指定した属性の順序を保持するようになりました。

以下はこれから操作する 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.22.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: 3dd3. インスタンスは不透明です。


File: python.info,  Node: TreeBuilder オブジェクト,  Next: XMLParser オブジェクト,  Prev: QName オブジェクト,  Up: リファレンス<6>

5.22.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(): 3dae. and *note
     ProcessingInstruction(): 3db4. 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: 361. インスタンスになります。

      -- メソッド: 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: c4e. オブジェクトは以下のメソ
     ッドを提供できます:

      -- メソッド: doctype (name, pubid, system)

          doctype 宣言を処理します。 'name' は doctype 名です。 'pubid'
          は公式の識別子です。 'system' はシステム識別子です。このメソッ
          ドはデフォルトの *note TreeBuilder: c4e. クラスには存在しませ
          ん。

          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(): c4c. 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.22.5.22 XMLParser オブジェクト
................................

 -- クラス: xml.etree.ElementTree.XMLParser (*, target=None,
          encoding=None)

     このクラスは、このモジュールの構成要素のうち、低水準のものです。効
     率的でイベントベースのXMLパースのため、*note xml.parsers.expat:
     12d. を使用します。*note feed(): 3ddf. メソッドで XML データをイン
     クリメンタルに受け取り、'target' オブジェクトのコールバックを呼び出
     すことで、パースイベントをプッシュ API に変換します。'target' が省
     略された場合、標準の *note TreeBuilder: c4e. が使用されます。
     '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 ‘flush()’
          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 ‘flush()’ has been backported to some prior releases
          of CPython as a security fix.  Check for availability of
          ‘flush()’ using *note hasattr(): 6f9. if used in code running
          across a variety of Python versions.

          Added in version 3.13.

     *note XMLParser.feed(): 3ddf. は 'target' の ‘start(tag,
     attrs_dict)’ メソッドをそれぞれの開始タグに対して呼び、また
     ‘end(tag)’ メソッドを終了タグに対して呼び、そしてデータを
     ‘data(data)’ メソッドで処理します。サポートされているその他のコール
     バックメソッドについては、 *note TreeBuilder: c4e. クラスを参照して
     ください。*note XMLParser.close(): 3de0. は 'target' の ‘close()’ メ
     ソッドを呼びます。 *note XMLParser: c4d. は木構造を構築する以外にも
     使えます。以下の例では、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.22.5.23 XMLPullParser オブジェクト
....................................

 -- クラス: xml.etree.ElementTree.XMLPullParser (events=None)

     非ブロックアプリケーションに適したプルパーザです。入力側の API は
     *note XMLParser: c4d. のものと似ていますが、コールバックターゲット
     に呼び出しをプッシュするのではなく、 *note XMLPullParser: 11f9. は
     パースイベントの内部リストを収集し、ユーザーがそこから読み出すこと
     ができます。'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 ‘flush()’
          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 ‘flush()’ has been backported to some prior releases
          of CPython as a security fix.  Check for availability of
          ‘flush()’ using *note hasattr(): 6f9. if used in code running
          across a variety of Python versions.

          Added in version 3.13.

      -- メソッド: close ()

          パーザに、データストリームが終了したことを伝えます。*note
          XMLParser.close(): 3de0. とは異なり、このメソッドは常に *note
          None: 886. を返します。パーザがクローズした時にまだ帰って来て
          いないイベントは、まだ *note read_events(): 3d9e. で読むことが
          できます。

      -- メソッド: 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: 361. 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: 886. (this may change in a future
               version)

          *note read_events(): 3d9e. の前の呼び出しで提供されたイベント
          は、再度 yield されることはありません。イベントは、イテレータ
          から取得された場合にのみ内部キューから消費されるため、
          ‘read_events()’ から取得されたイテレータに対して複数の読み出し
          を並行して反復的に行うと、予期せぬ結果が引き起こされます。

          注釈: *note XMLPullParser: 11f9. は "start" イベントを発行した
          時に開始タグの文字 ">" が現れたことだけを保証します。そのため
          、属性は定義されますが、その時点ではテキストの内容も tail 属性
          も定義されていません。子要素にもそれが存在する、しないにかかわ
          らず同じ物が適用されます。

          全部揃った要素が必要ならば、"end" イベントを探してください。

     Added in version 3.4.

     バージョン 3.8 で変更: イベント ‘comment’, ‘pi’ が追加されました。


File: python.info,  Node: 例外<22>,  Prev: XMLPullParser オブジェクト,  Up: リファレンス<6>

5.22.5.24 例外
..............

 -- クラス: xml.etree.ElementTree.ParseError

     解析に失敗した時、このモジュールの様々なメソッドから送出される XML
     解析エラーです。この例外のインスタンスが表す文字列は、ユーザフレン
     ドリなメッセージを含んでいます。その他に、以下の属性も利用できます:

      -- の属性: code

          expat パーザからの数値エラーコードです。エラーコードの一覧とそ
          れらの意味については、*note xml.parsers.expat: 12d. のドキュメ
          ントを参照してください。

      -- の属性: position

          エラーが発生した場所を示す 'line' と 'column' 番号のタプルです
          。

脚注
....


File: python.info,  Node: xml dom --- ドキュメントオブジェクトモデル API,  Next: xml dom minidom --- 最小限の DOM の実装,  Prev: xml etree ElementTree --- ElementTree XML API,  Up: 構造化マークアップツール

5.22.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(): 3dea. が定義されているはずです。 DOM レベ
ル 3 ではロード(Load)/ストア(Store) 仕様が追加され、リーダのインターフェ
ースにを定義していますが、Python 標準ライブラリではまだ利用することがで
きません。

DOM 文書オブジェクトを生成したら、そのプロパティとメソッドを使って XML 文
書の一部にアクセスできます。これらのプロパティは DOM 仕様で定義されてい
ます; 本リファレンスマニュアルでは、Python において DOM 仕様がどのように
解釈されているかを記述しています。

W3C から提供されている仕様は、 DOM API を Java、ECMAScript、および OMG
IDL で定義しています。ここで定義されている Python での対応づけは、大部分
がこの仕様の IDL 版に基づいていますが、厳密な準拠は必要とされていません
(実装で IDL の厳密な対応付けをサポートするのは自由ですが)。API への対応
付けに関する詳細な議論は *note 適合性: 3deb. を参照してください。

参考
....

Document Object Model (DOM) Level 2 Specification(2)

     Python DOM API が準拠している W3C 勧告。

Document Object Model (DOM) Level 1 Specification(3)

     *note xml.dom.minidom: 129. でサポートされている W3C の DOM に関す
     る勧告。

Python Language Mapping Specification(4)

     このドキュメントでは OMG IDL から Python への対応付けを記述していま
     す。

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<2>.
* 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: モジュールコンテンツ<2>,  Next: DOM 内のオブジェクト,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.22.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: モジュールコンテンツ<2>,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.22.6.2 DOM 内のオブジェクト
.............................

DOM について最も明確に限定しているドキュメントは W3C による DOM 仕様です
。

DOM 属性は単純な文字列としてだけではなく、ノードとして操作されるかもしれ
ないので注意してください。とはいえ、そうしなければならない場合はかなり稀
なので、今のところ記述されていません。

インターフェース                     節                                      目的
                                                                             
-------------------------------------------------------------------------------------------------------------------
                                                                             
‘DOMImplementation’                  *note DOMImplementation オブジェクト: 3df4.根底にある実装へのインターフェース
                                                                             。
                                                                             
                                                                             
‘Node’                               *note Node オブジェクト: 3df5.          ドキュメント内の大部分のオブジェク
                                                                             トに対する基底インターフェース。
                                                                             
                                                                             
‘NodeList’                           *note NodeList オブジェクト: 240b.      ノード列に対するインターフェース。
                                                                             
                                                                             
‘DocumentType’                       *note DocumentType オブジェクト: 3df6.  ドキュメントの処理に必要な宣言につ
                                                                             いての情報。
                                                                             
                                                                             
‘Document’                           *note Document オブジェクト: 3df7.      ドキュメント全体を表現するオブジェ
                                                                             クト。
                                                                             
                                                                             
‘Element’                            *note Element オブジェクト: 3df8.       ドキュメント階層内の要素ノード。
                                                                             
                                                                             
‘Attr’                               *note Attr オブジェクト: 3df9.          要素ノード上の属性値ノード。
                                                                             
                                                                             
‘Comment’                            *note Comment オブジェクト: 3dfa.       ソースドキュメント内のコメント表現
                                                                             。
                                                                             
                                                                             
‘Text’                               *note Text オブジェクトおよび CDATASection オブジェクト: 3dfb.ドキュメント内のテキスト記述を含む
                                                                             ノード。
                                                                             
                                                                             
‘ProcessingInstruction’              *note ProcessingInstruction オブジェクト: 3dfc.処理命令 (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.22.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(): 3e00. によって生成された ‘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.22.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: 3e05. も参照してください。このノードが親ノー
     ドにおける末尾の子ノードである場合、属性値は ‘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: 3e0d. と似ています。こ
     の属性の値は文字列または ‘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: 2ee. が送出されます。 'newChild' が返されます。もし
     'refChild' が ‘None’ なら、 'newChild' を子ノードリストの最後に挿入
     します。

 -- メソッド: Node.removeChild (oldChild)

     子ノードを削除します。 'oldChild' はこのノードの子ノードでなければ
     なりません。そうでない場合、 *note ValueError: 2ee. が送出されます
     。成功した場合 'oldChild' が返されます。 'oldChild' をそれ以降使わ
     ない場合、 ‘unlink()’ メソッドを呼び出さなければなりません。

 -- メソッド: Node.replaceChild (newChild, oldChild)

     既存のノードと新たなノードを置き換えます。この操作は 'oldChild' が
     現在のノードの子ノードである場合に限られます; そうでない場合、
     *note ValueError: 2ee. が送出されます。

 -- メソッド: Node.normalize ()

     一続きのテキスト全体を一個の ‘Text’ インスタンスとして保存するため
     に隣接するテキストノードを結合します。これにより、多くのアプリケー
     ションで DOM ツリーからのテキスト処理が簡単になります。

 -- メソッド: Node.cloneNode (deep)

     このノードを複製 (clone) します。'deep' を設定すると、子ノードも同
     様に複製することを意味します。複製されたノードを返します。


File: python.info,  Node: NodeList オブジェクト,  Next: DocumentType オブジェクト,  Prev: Node オブジェクト,  Up: DOM 内のオブジェクト

5.22.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__(): 17ff. と *note
__getitem__(): 588. をサポートしなければなりません; このサポートにより、
*note for: 348. 文内で ‘NodeList’ にわたる繰り返しと、組み込み関数 *note
len(): 840. の適切なサポートができるようになります。

DOM 実装が文書の変更をサポートしている場合、 ‘NodeList’ の実装でも *note
__setitem__(): 14e7. および *note __delitem__(): 14e8. メソッドをサポー
トしなければなりません。


File: python.info,  Node: DocumentType オブジェクト,  Next: Document オブジェクト,  Prev: NodeList オブジェクト,  Up: DOM 内のオブジェクト

5.22.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.22.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.22.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: 3e37. が送出されます。

 -- メソッド: Element.removeAttributeNode (oldAttr)

     'oldAttr' が属性リストにある場合、削除して返します。 'oldAttr' が存
     在しない場合、 *note NotFoundErr: 3e37. が送出されます。

 -- メソッド: Element.removeAttributeNS (namespaceURI, localName)

     名前で指定された属性を削除します。このメソッドは 'qname' ではなく
     'localName' を使うので注意してください。該当する属性がなくても例外
     は送出されません。

 -- メソッド: Element.setAttribute (name, value)

     文字列を使って属性値を設定します。

 -- メソッド: Element.setAttributeNode (newAttr)

     新たな属性ノードを要素に追加します。 ‘name’ 属性が既存の属性に一致
     した場合、必要に応じて属性を置換します。置換が行われると古い属性ノ
     ードが返されます。 'newAttr' がすでに使われていれば、 *note
     InuseAttributeErr: 3e3c. が送出されます。

 -- メソッド: Element.setAttributeNodeNS (newAttr)

     新たな属性ノードを要素に追加します。 ‘namespaceURI’ および
     ‘localName’ 属性が既存の属性に一致した場合、必要に応じて属性を置き
     換えます。置換が生じると、古い属性ノードが返されます。 'newAttr' が
     すでに使われていれば、 *note InuseAttributeErr: 3e3c. が送出されま
     す。

 -- メソッド: Element.setAttributeNS (namespaceURI, qname, value)

     指定された 'namespaceURI' および 'qname' で与えられた属性の値を文字
     列で設定します。qname は属性の完全な名前であり、この点が上記のメソ
     ッドと違うので注意してください。


File: python.info,  Node: Attr オブジェクト,  Next: NamedNodeMap Objects,  Prev: Element オブジェクト<2>,  Up: DOM 内のオブジェクト

5.22.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.22.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.22.6.11 Comment オブジェクト
..............................

‘Comment’ は XML 文書中のコメントを表現します。 ‘Comment’ は ‘Node’ のサ
ブクラスですが、子ノードを持つことはありません。

 -- の属性: Comment.data

     文字列によるコメントの内容です。この属性には、コメントの先頭にある
     ‘<!-’ ‘-’ と末尾にある ‘-’ ‘->’ 間の全ての文字が入っていますが、
     ‘<!-’ ‘-’ と ‘-’ ‘->’ 自体は含みません。


File: python.info,  Node: Text オブジェクトおよび CDATASection オブジェクト,  Next: ProcessingInstruction オブジェクト,  Prev: Comment オブジェクト,  Up: DOM 内のオブジェクト

5.22.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.22.6.13 ProcessingInstruction オブジェクト
............................................

XML 文書内の処理命令を表現します; ‘Node’ インターフェースを継承していま
すが、子ノードを持つことはできません。

 -- の属性: ProcessingInstruction.target

     最初の空白文字までの処理命令の内容です。読み出し専用の属性です。

 -- の属性: ProcessingInstruction.data

     最初の空白文字以降の処理命令の内容です。


File: python.info,  Node: 例外<23>,  Prev: ProcessingInstruction オブジェクト,  Up: DOM 内のオブジェクト

5.22.6.14 例外
..............

DOM レベル 2 勧告では、単一の例外 *note DOMException: 3e51. と、どの種の
エラーが発生したかをアプリケーションが決定できるようにする多くの定数を定
義しています。 ‘DOMException’ インスタンスは、特定の例外に関する適切な値
を提供する *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: 3e52.
                                           
                                           
‘HIERARCHY_REQUEST_ERR’                    *note HierarchyRequestErr: 3e53.
                                           
                                           
‘INDEX_SIZE_ERR’                           *note IndexSizeErr: 3e54.
                                           
                                           
‘INUSE_ATTRIBUTE_ERR’                      *note InuseAttributeErr: 3e3c.
                                           
                                           
‘INVALID_ACCESS_ERR’                       *note InvalidAccessErr: 3e55.
                                           
                                           
‘INVALID_CHARACTER_ERR’                    *note InvalidCharacterErr: 3e56.
                                           
                                           
‘INVALID_MODIFICATION_ERR’                 *note InvalidModificationErr: 3e57.
                                           
                                           
‘INVALID_STATE_ERR’                        *note InvalidStateErr: 3e58.
                                           
                                           
‘NAMESPACE_ERR’                            *note NamespaceErr: 3e59.
                                           
                                           
‘NOT_FOUND_ERR’                            *note NotFoundErr: 3e37.
                                           
                                           
‘NOT_SUPPORTED_ERR’                        *note NotSupportedErr: 3e5a.
                                           
                                           
‘NO_DATA_ALLOWED_ERR’                      *note NoDataAllowedErr: 3e5b.
                                           
                                           
‘NO_MODIFICATION_ALLOWED_ERR’              *note NoModificationAllowedErr: 3e5c.
                                           
                                           
‘SYNTAX_ERR’                               *note SyntaxErr: 3e5d.
                                           
                                           
‘WRONG_DOCUMENT_ERR’                       *note WrongDocumentErr: 3e5e.
                                           

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/REC-xml-names/


File: python.info,  Node: 適合性,  Prev: DOM 内のオブジェクト,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.22.6.15 適合性
................

この節では適合性に関する要求と、Python DOM API、W3C DOM 勧告、および OMG
IDL の Python API への対応付けとの間の関係について述べます。

* Menu:

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


File: python.info,  Node: 型の対応付け,  Next: アクセサメソッド,  Up: 適合性

5.22.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.22.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.22.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: 12c. module for their XML processing
instead.

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3d91.

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(): 3e67. 関数はファイル名か、開かれたファイルオブジェクトを
引数にとることができます。

 -- の関数: xml.dom.minidom.parse (filename_or_file, parser=None,
          bufsize=None)

     与えられた入力から ‘Document’ を返します。 'filename_or_file' はフ
     ァイル名でもファイルオブジェクトでもかまいません。 'parser' を指定
     する場合、SAX2 パーザオブジェクトでなければなりません。この関数はパ
     ーザの文書ハンドラを変更し、名前空間サポートを有効にします; (エンテ
     ィティリゾルバ (entity resolver) のような) 他のパーザ設定は前もって
     おこなわなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 3e68. を代わり
に使うことができます:

 -- の関数: xml.dom.minidom.parseString (string, parser=None)

     'string' を表わす ‘Document’ を返します。このメソッドは、文字列に対
     する *note io.StringIO: 112e. オブジェクトを作成し、それを *note
     parse(): 3e67. に渡します。

これらの関数は両方とも、文書の内容を表現する ‘Document’ オブジェクトを返
します。

What the *note parse(): 3e67. and *note parseString(): 3e68. 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: 128. 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.22.7.1 DOM オブジェクト
.........................

The definition of the DOM API for Python is given as part of the *note
xml.dom: 128. module documentation.  This section lists the differences
between the API and ‘xml.dom.minidom’.

 -- メソッド: Node.unlink ()

     DOM との内部的な参照を破壊して、循環参照ガベージコレクションを持た
     ないバージョンの Python でもガベージコレクションされるようにします
     。循環参照ガベージコレクションが利用できる場合でも、このメソッドを
     使えば大量のメモリをすぐに使えるようにできるため、不要になったらす
     ぐに DOM オブジェクトに対してこのメソッドを呼ぶのが良い習慣です。こ
     のメソッドは ‘Document’ オブジェクトに対して呼び出すだけでよいので
     すが、あるノードの子ノードを破棄するために子ノードに対して呼び出し
     てもかまいません。

     *note with: 187. ステートメントを使用することで、このメソッドを明示
     的に呼ばないようにできます。 ‘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(): c8d. メソッドはユーザーが
     指定した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toxml (encoding=None, standalone=None)

     DOM ノードによって表わされる XML を含んだ文字列またはバイト文字列を
     返します。

     明示的に 'encoding' (1) 引数を渡すと、結果は指定されたエンコードの
     バイト文字列になります。'encoding' 引数なしだと、結果は unicode 文
     字列です。また、結果として生じる文字列の中の XML 宣言はエンコーディ
     ングを指定しません。XML のデフォルトエンコーディングは UTF-8 なので
     、この文字列を UTF-8 以外でエンコードすることはおそらく正しくありま
     せん。

     'standalone' 引数は *note writexml(): c8d. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toxml(): c8e. メソッドはユーザーが指定
     した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toprettyxml (indent='\t', newl='\n', encoding=None,
          standalone=None)

     文書の整形されたバージョンを返します。 'indent' はインデントを行う
     ための文字で、デフォルトはタブです; 'newl' には行末で出力される文字
     列を指定し、デフォルトは ‘\n’ です。

     'encoding' 引数は *note toxml(): c8e. の対応する引数と同様に振る舞
     います。

     'standalone' 引数は *note writexml(): c8d. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toprettyxml(): c8f. メソッドはユーザー
     が指定した属性の順序を保持するようになりました。

     バージョン 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.22.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.22.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: 349. パラメタの
     みを使うので、引数は通常の順番 (左から右へ) で渡されます。オプショ
     ン引数はありません。 ‘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: 199. 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.22.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: 3d91.

バージョン 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(): 3e73. メソッドを使用して DOM 関連の処理に切
り替える必要があります。

 -- クラス: xml.dom.pulldom.PullDOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 3e75. のサブクラスです。

 -- クラス: xml.dom.pulldom.SAX2DOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 3e75. のサブクラスです。

 -- の関数: xml.dom.pulldom.parse (stream_or_string, parser=None,
          bufsize=None)

     与えられた入力から *note DOMEventStream: 942. を返します。
     'stream_or_string' はファイル名かファイル様オブジェクトのいずれかで
     す。'parser' は、与えれた場合、 *note XMLReader: 3e78. オブジェクト
     でなければなりません。この関数はパーザの文書ハンドラを変えて名前空
     間のサポートを有効にします。パーザの他の設定 (例えばエンティティリ
     ゾルバ) は前もってしておかなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 3e79. を代わり
に使うことができます:

 -- の関数: xml.dom.pulldom.parseString (string, parser=None)

     (ユニコード) 'string' を表す *note DOMEventStream: 942. を返します
     。

 -- データ: xml.dom.pulldom.default_bufsize

     *note parse(): 3e77. の 'bufsize' パラメタのデフォルト値です。

     この変数の値は *note parse(): 3e77. を呼び出す前に変更することがで
     きます。その場合、その新しい値が有効になります。

* 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.22.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(): 3e73.
          が呼ばれない限り、現在のノードは子ノードの情報を持ちません。

      -- メソッド: 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.22.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: 3d91.

バージョン 3.7.1 で変更: SAXパーサーは、セキュリティーを向上させるために
、デフォルトで一般的な外部エンティティーを処理しなくなりました。以前は、
パーサーは、DTDおよびエンティティ用にファイルシステムからリモートファイ
ルまたはロードされたローカルファイルをフェッチするためのネットワーク接続
を作成していました。この機能は parser オブジェクトと(実) 引数 *note
feature_external_ges: 1838. の *note setFeature(): 3e82. メソッドで再度
有効にすることができます。

その関数群は以下の通りです:

 -- の関数: xml.sax.make_parser (parser_list=[])

     SAX *note XMLReader: 3e78. オブジェクトを生成し、返します。最初に見
     つかったパーサーが使用されます。'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: 3e75. のインスタントである必要があります。
     'error_handler' が与えられる場合は、 SAX *note ErrorHandler: 3e83.
     のインスタンスである必要があります。この引数を省略した場合、全ての
     例外に対して *note SAXParseException: 3e84. が発生します。 戻り値は
     ありません。すべての操作は渡される 'handler' によって行われなければ
     なりません。

 -- の関数: xml.sax.parseString (string, handler,
          error_handler=handler.ErrorHandler())

     *note parse(): 1e43. と同様ですが、こちらは引数で受け取ったバッファ
     'string' をパースします。 'string' は *note str: 16a. インスタンス
     か *note bytes-like object: 194. でなければなりません。

     バージョン 3.5 で変更: *note str: 16a. インスタンスがサポートされま
     した。

典型的な 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: 109f, *note Locator:
3e85, ‘Attributes’, ‘AttributesNS’, and *note XMLReader: 3e78.
interfaces are defined in the module *note xml.sax.xmlreader: 133.  The
handler interfaces are defined in *note xml.sax.handler: 131.  For
convenience, ‘InputSource’ (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: 3e83. で定義されているハンドラがこの
     例外のインスタンスを受け取ることに注意してください。実際に例外を発
     生させることは必須でなく、情報のコンテナとして利用されることもある
     からです。

     インスタンスを作成する際 'msg' はエラー内容を示す可読データにしてく
     ださい。オプションの 'exception' 引数は ‘None’ にするか、パース用コ
     ードで捕捉されて情報として渡される例外にしてください。

     このクラスはSAX 例外の基底クラスになります。

 -- 例外: xml.sax.SAXParseException (msg, exception, locator)

     パースエラー時に発生する *note SAXException: 3e86. のサブクラスです
     。パースエラーに関する情報として、このクラスのインスタンスが SAX
     *note ErrorHandler: 3e83. インターフェースのメソッドに渡されます。
     このクラスは *note SAXException: 3e86. 同様 SAX *note Locator:
     3e85. インターフェースもサポートしています。

 -- 例外: xml.sax.SAXNotRecognizedException (msg, exception=None)

     SAX *note XMLReader: 3e78. が認識できない機能やプロパティに遭遇した
     とき発生させる *note SAXException: 3e86. のサブクラスです。 SAX ア
     プリケーションや拡張モジュールにおいて同様の目的にこのクラスを利用
     することもできます。

 -- 例外: xml.sax.SAXNotSupportedException (msg, exception=None)

     SAX *note XMLReader: 3e78. が要求された機能をサポートしていないとき
     発生させる *note SAXException: 3e86. のサブクラスです。 SAX アプリ
     ケーションや拡張モジュールにおいて同様の目的にこのクラスを利用する
     こともできます。

参考
....

SAX: The Simple API for XML(2)

     SAX API 定義に関し中心となっているサイトです。Java による実装とオン
     ライン・ドキュメントが提供されています。実装と SAX API の歴史に関す
     る情報のリンクも掲載されています。

*note xml.sax.handler: 131. モジュール

     アプリケーションが提供するオブジェクトのインターフェース定義。

*note xml.sax.saxutils: 132. モジュール

     SAX アプリケーション向けの有用な関数群。

*note xml.sax.xmlreader: 133. モジュール

     パーサが提供するオブジェクトのインターフェース定義。

* 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.22.9.1 SAXException オブジェクト
..................................

*note SAXException: 3e86. 例外クラスは以下のメソッドをサポートしています
:

 -- メソッド: SAXException.getMessage ()

     エラー状態を示す可読メッセージを返します。

 -- メソッド: SAXException.getException ()

     カプセル化した例外オブジェクトまたは ‘None’ を返します。


File: python.info,  Node: xml sax handler --- SAX ハンドラーの基底クラス,  Next: xml sax saxutils --- SAX ユーティリティー,  Prev: xml sax --- SAX2 バーサーのサポート,  Up: 構造化マークアップツール

5.22.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.22.10.1 ContentHandler オブジェクト
.....................................

*note ContentHandler: 3e75. はアプリケーション側でサブクラス化して利用す
ることが前提になっています。パーサは入力ドキュメントのイベントにより、そ
れぞれに対応する以下のメソッドを呼び出します:

 -- メソッド: ContentHandler.setDocumentLocator (locator)

     アプリケーションにドキュメントイベントの発生位置を指すロケータを与
     えるためにパーサから呼び出されます。

     SAX パーサによるロケータの提供は強く推奨されています(必須ではありま
     せん)。もし提供する場合は、DocumentHandler インターフェースのどのメ
     ソッドよりも先にこのメソッドが呼び出されるようにしなければなりませ
     ん。

     パーサがエラーを報告しない場合でも、ロケータによってアプリケーショ
     ンは全てのドキュメント関連イベントの終了位置を知ることが出来ます。
     通常、アプリケーションは自身のエラー (例えば文字コンテンツがアプリ
     ケーションの規則に適合しない場合) を報告するためにこれを使用します
     。 ロケータが返す情報は検索エンジンでの利用にはおそらく不充分です。

     ロケータが正しい情報を返すのは、このインターフェースからイベントの
     呼出しが実行されている間だけです。それ以外のときは使用すべきであり
     ません。

 -- メソッド: ContentHandler.startDocument ()

     ドキュメントの開始通知を受け取ります。

     SAX パーサはこのインターフェースやDTDHandler のどのメソッド (*note
     setDocumentLocator(): 3e9f. を除く) よりも先にこのメソッドを一度だ
     け呼び出します。

 -- メソッド: ContentHandler.endDocument ()

     ドキュメントの終了通知を受け取ります。

     SAX パーサはこのメソッドを一度だけ呼び出します。パース中に呼び出す
     最後のメソッドです。パーサは (回復不能なエラーで) パース処理を中断
     するか、あるいは入力の最後に到達するまでこのメソッドを呼び出しませ
     ん。

 -- メソッド: ContentHandler.startPrefixMapping (prefix, uri)

     接頭辞と URI 名前空間の関連付けのスコープを開始します。

     このイベントからの情報は名前空間処理に必須ではありません。SAX XML リ
     ーダは ‘feature_namespaces’ 機能が有効な場合 (デフォルト)、要素と属
     性名の接頭辞を自動的に置換します。

     しかしながら、接頭辞の自動展開を安全に行えないために、アプリケーシ
     ョンが文字データや属性値の中で接頭辞を使わなければならない場合があ
     ります。 必要ならば *note startPrefixMapping(): 3ea2. や *note
     endPrefixMapping(): 3ea3. イベントはアプリケーションにコンテキスト
     自身の中で接頭辞を展開するための情報を提供します。

     *note startPrefixMapping(): 3ea2. と *note endPrefixMapping():
     3ea3. イベントは相互に正しい入れ子関係になることが保証されていない
     ので注意が必要です。すべての ‘startPrefixMapping()’ は対応する
     *note startElement(): 1761. の前に発生し、 ‘endPrefixMapping()’ イ
     ベントは対応する *note endElement(): 1762. の後で発生しますが、その
     順序は保証されていません。

 -- メソッド: ContentHandler.endPrefixMapping (prefix)

     接頭辞と URI の関連付けのスコープを終了します。

     詳しくは *note startPrefixMapping(): 3ea2. を参照してください。この
     イベントは常に対応する *note endElement(): 1762. の後で発生しますが
     、複数の *note endPrefixMapping(): 3ea3. イベントの順序は特に保証さ
     れません。

 -- メソッド: 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: 3ea4. 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(): 1761. イベントとまったく同じ要
     素型名を持ちます。

 -- メソッド: 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: 3ea6. 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(): 3ea5. イベントとまったく同じ
     要素型を持ちます。 '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.22.10.2 DTDHandler オブジェクト
.................................

*note DTDHandler: 3e90. インスタンスは以下のメソッドを提供します:

 -- メソッド: 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.22.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.22.10.4 ErrorHandler オブジェクト
...................................

Objects with this interface are used to receive error and warning
information from the *note XMLReader: 3e78.  If you create an object
that implements this interface, then register the object with your
‘XMLReader’, 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: 3e84. 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.22.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.22.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(): 3ec1. に似ていますが、 'data' は属性値の作成に使わ
     れます。戻り値はクォート済みの 'data' で、置換する文字の追加も可能
     です。 *note quoteattr(): 3ec3. はクォートすべき文字を '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: 3e75. インターフェースを実装しています。 つまり、
     *note XMLGenerator: 3ec4. をコンテントハンドラとして用いることで、
     パースしている元々の文書を複製することが出来ます。 '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: 3e78. とクライアント・アプリケーショ
     ンのイベント・ハンドラとの間に位置するものとして設計されています。
     デフォルトでは何もせず、ただリクエストをリーダに、イベントをハンド
     ラに、それぞれ加工せず渡すだけです。しかし、サブクラスでメソッドを
     オーバーライドすると、イベント・ストリームやリクエストを加工してか
     ら渡すように変更可能です。

 -- の関数: xml.sax.saxutils.prepare_input_source (source, base='')

     この関数は引数に入力ソース、オプションとして URL を取り、読み取り可
     能な解決済み *note InputSource: 109f. オブジェクトを返します。入力
     ソースは文字列、ファイル風オブジェクト、 ‘InputSource’ のいずれでも
     良く、この関数を使うことで、パーサは様々な 'source' 引数を *note
     parse(): 3ec7. メソッドに実装することが可能になります。

   ---------- 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.22.12 ‘xml.sax.xmlreader’ -- XML パーサーのインターフェース
-------------------------------------------------------------

'ソースコード:' Lib/xml/sax/xmlreader.py(1)

__________________________________________________________________

各 SAX パーサは Python モジュールとして *note XMLReader: 3e78. インター
フェースを実装しており、関数 ‘create_parser()’ を提供しています。この関
数は新たなパーサ・オブジェクトを生成する際、 *note
xml.sax.make_parser(): 1e78. から引数なしで呼び出されます。

 -- クラス: 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: 3e78. がエンティティを読み込むために必要な情報をカ
     プセル化します。

     このクラスには公開識別子、システム識別子、(場合によっては文字エンコ
     ーディング情報を含む) バイト・ストリーム、そしてエンティティの文字
     ストリームなどの情報が含まれます。

     アプリケーションは *note XMLReader.parse(): 3ec7. メソッドでの使用
     や EntityResolver.resolveEntity の戻り値としてこのオブジェトを作成
     します。

     *note InputSource: 109f. はアプリケーションに属します。 *note
     XMLReader: 3e78. はアプリケーションから渡された ‘InputSource’ オブ
     ジェクトの変更を許可されていませんが、コピーを作ってそれを変更する
     ことは可能です。

 -- クラス: xml.sax.xmlreader.AttributesImpl (attrs)

     ‘Attributes’ インターフェース (*note Attributes インターフェース:
     3ea4. 参照) の実装です。これは辞書風のオブジェクトで、
     ‘startElement()’ 内で要素の属性を表示します。最も有用な辞書操作に加
     え、インターフェースに記述されているメソッドを多数サポートしていま
     す。このクラスのオブジェクトはリーダによってインスタンス化されなけ
     ればなりません。'attrs' は属性名と属性値の対応付けを含む辞書風オブ
     ジェクトでなければなりません。

 -- クラス: xml.sax.xmlreader.AttributesNSImpl (attrs, qnames)

     *note AttributesImpl: 3ecc. を名前空間認識型に改良したクラスで、
     ‘startElementNS()’ に渡されます。 ‘AttributesImpl’ の派生クラスです
     が、 'namespaceURI' と 'localname' の2要素のタプルを解釈します。さ
     らに、元の文書に出てくる修飾名を返す多くのメソッドを提供します。こ
     のクラスは ‘AttributesNS’ インターフェース (*note AttributesNS
     インターフェース: 3ea6. 参照) の実装です。

* 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.22.12.1 XMLReader オブジェクト
................................

*note XMLReader: 3e78. は次のメソッドをサポートします:

 -- メソッド: XMLReader.parse (source)

     入力ソースを処理し、SAX イベントを作成します。 'source' オブジェク
     トはシステム識別子 (入力ソースを特定する文字列 - 一般にファイル名や
     URL)、 *note pathlib.Path: 268. オブジェクトか *note path-like:
     5a1. オブジェクトまたは *note InputSource: 109f. オブジェクトです。
     *note parse(): 3ec7. が return したとき、入力データの処理は完了し、
     パーサ・オブジェクトは破棄ないしリセットされます。

     バージョン 3.5 で変更: 文字ストリームがサポートされました。

     バージョン 3.8 で変更: path-like オブジェクトのサポートが追加されま
     した。

 -- メソッド: XMLReader.getContentHandler ()

     現在の *note ContentHandler: 3e75. を返します。

 -- メソッド: XMLReader.setContentHandler (handler)

     現在の *note ContentHandler: 3e75. を設定します。 ‘ContentHandler’
     が設定されていない場合、内容イベントは破棄されます。

 -- メソッド: XMLReader.getDTDHandler ()

     現在の *note DTDHandler: 3e90. を返します。

 -- メソッド: XMLReader.setDTDHandler (handler)

     現在の *note DTDHandler: 3e90. を返します。 ‘DTDHandler’ が設定され
     ていな場合、DTD イベントは破棄されます。

 -- メソッド: XMLReader.getEntityResolver ()

     現在の *note EntityResolver: 3e91. を返します。

 -- メソッド: XMLReader.setEntityResolver (handler)

     現在の *note EntityResolver: 3e91. を返します。 ‘EntityResolver’ が
     設定されていない場合、外部エンティティの解決を試行することでエンテ
     ィティのシステム識別子が開かれます。利用できない場合は失敗します。

 -- メソッド: XMLReader.getErrorHandler ()

     現在の *note ErrorHandler: 3e83. を返します。

 -- メソッド: XMLReader.setErrorHandler (handler)

     現在のエラーハンドラを設定します。*note ErrorHandler: 3e83. が設定
     されていない場合、エラーが例外として送出され、警告が表示されます。

 -- メソッド: XMLReader.setLocale (locale)

     アプリケーションにエラーや警告のロケール設定を許可します。

     SAX パーサにとって、エラーや警告の地域化は必須ではありません。しか
     し、パーサが要求されたロケールをサポートしていない場合、SAX 例外を
     送出しなければなりません。アプリケーションはパースの途中でロケール
     の変更を要求することができます。

 -- メソッド: XMLReader.getFeature (featurename)

     機能 'featurename' の現在の設定を返します。その機能が認識できないと
     きは、 ‘SAXNotRecognizedException’ を送出します。有名な機能名はモジ
     ュール *note xml.sax.handler: 131. に列挙されています。

 -- メソッド: XMLReader.setFeature (featurename, value)

     機能名 'featurename' に値 'value' を設定します。その機能が認識でき
     ないときは、 ‘SAXNotRecognizedException’ を送出します。また、パーサ
     が指定された機能や設定をサポートしていないときは、
     ‘SAXNotSupportedException’ を送出します。

 -- メソッド: XMLReader.getProperty (propertyname)

     属性名 'propertyname' の現在の値を返します。その属性が認識できない
     ときは、 ‘SAXNotRecognizedException’ を送出します。有名な属性名はモ
     ジュール *note xml.sax.handler: 131. に列挙されています。

 -- メソッド: XMLReader.setProperty (propertyname, value)

     属性名 'propertyname' に値 'value' を設定します。その機能が認識でき
     ないときは、 ‘SAXNotRecognizedException’ を送出します。また、パーサ
     が指定された機能や設定をサポートしていないときは、
     ‘SAXNotSupportedException’ を送出します。


File: python.info,  Node: IncrementalParser オブジェクト,  Next: Locator オブジェクト,  Prev: XMLReader オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.22.12.2 IncrementalParser オブジェクト
........................................

*note IncrementalParser: 3ecb. のインスタンスは次の追加メソッドを提供し
ます:

 -- メソッド: 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.22.12.3 Locator オブジェクト
..............................

*note Locator: 3e85. のインスタンスは次のメソッドを提供します:

 -- メソッド: Locator.getColumnNumber ()

     現在のイベントが開始する列番号を返します。

 -- メソッド: Locator.getLineNumber ()

     現在のイベントが開始する行番号を返します。

 -- メソッド: Locator.getPublicId ()

     現在の文書イベントの公開識別子を返します。

 -- メソッド: Locator.getSystemId ()

     現在のイベントのシステム識別子を返します。


File: python.info,  Node: InputSource オブジェクト,  Next: Attributes インターフェース,  Prev: Locator オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.22.12.4 InputSource オブジェクト
..................................

 -- メソッド: InputSource.setPublicId (id)

     この *note InputSource: 109f. の公開識別子を設定します。

 -- メソッド: InputSource.getPublicId ()

     この *note InputSource: 109f. の公開識別子を返します。

 -- メソッド: InputSource.setSystemId (id)

     この *note InputSource: 109f. のシステム識別子を設定します。

 -- メソッド: InputSource.getSystemId ()

     この *note InputSource: 109f. のシステム識別子を返します。

 -- メソッド: InputSource.setEncoding (encoding)

     この *note InputSource: 109f. の文字エンコーディングを設定します。

     エンコーディングは XML エンコーディング宣言として受け入れられる文字
     列でなければなりません (XML 勧告の 4.3.3 節を参照)。

     *note InputSource: 109f. も文字ストリームを含んでいた場合、
     ‘InputSource’ のエンコーディング属性は無視されます。

 -- メソッド: InputSource.getEncoding ()

     この InputSource の文字エンコーディングを取得します。

 -- メソッド: InputSource.setByteStream (bytefile)

     この入力ソースのバイトストリーム (*note binary file: 20ca.) を設定
     します。

     文字ストリームも指定されている場合、SAX パーサはこのバイトストリー
     ムを無視しますが、URI 接続自体を開くときには優先してバイトストリー
     ムを使います。

     アプリケーションがバイトストリームの文字エンコーディングを知ってい
     る場合は、setEncoding メソッドで設定する必要があります。

 -- メソッド: InputSource.getByteStream ()

     この入力ソースのバイトストリームを取得します。

     getEncoding メソッドは、このバイトストリームの文字エンコーディング
     を返します。不明なときは ‘None’ を返します。

 -- メソッド: InputSource.setCharacterStream (charfile)

     この入力ソースの文字ストリーム (*note text file: 20c9.) を設定しま
     す。

     文字ストリームが指定された場合、SAX パーサは全バイトストリームを無
     視し、システム識別子への URI 接続の開始を試みません。

 -- メソッド: InputSource.getCharacterStream ()

     この入力ソースの文字ストリームを取得します。


File: python.info,  Node: Attributes インターフェース,  Next: AttributesNS インターフェース,  Prev: InputSource オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.22.12.5 ‘Attributes’ インターフェース
.......................................

‘Attributes’ オブジェクトは ‘copy()’、‘get()’、*note __contains__():
15d7.、‘items()’、‘keys()’、‘values()’ を含む *note
マッピングプロトコル: 13d7. の一部を実装しています。以下のメソッドも提供
されています:

 -- メソッド: 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.22.12.6 ‘AttributesNS’ インターフェース
.........................................

このインターフェースは ‘Attributes’ インターフェース (*note Attributes
インターフェース: 3ea4. 参照) のサブタイプです。 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.22.13 ‘xml.parsers.expat’ -- Expat を使用した高速な XML 解析
--------------------------------------------------------------

__________________________________________________________________

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3d91.

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 例外: 3f00. を参照して
     ください。

 -- 例外: xml.parsers.expat.error

     *note ExpatError: 1494. の別名です。

 -- データ: xml.parsers.expat.XMLParserType

     *note ParserCreate(): 3f03. 関数から返された戻り値の型を示します。

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: 17d1.

     Expat はオプションで XML 名前空間の処理を行うことができます。これは
     引数 'namespace_separator' に値を指定することで有効になります。この
     値は、1文字の文字列でなければなりません; 文字列が誤った長さを持つ場
     合には *note ValueError: 2ee. が送出されます (‘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.22.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(): 3f0a. や *note
     NotationDeclHandler(): 3f0b, *note UnparsedEntityDeclHandler():
     3f0c. に引数 'base' としてそのまま渡されます。

 -- メソッド: xmlparser.GetBase ()

     以前の *note SetBase(): 3f09. によって設定された基底 URI を文字列の
     形で返します。 ‘SetBase()’ が呼ばれていないときには ‘None’ を返しま
     す。

 -- メソッド: xmlparser.GetInputContext ()

     現在のイベントを発生させた入力データを文字列として返します。データ
     はテキストの入っているエンティティが持っているエンコードになります
     。イベントハンドラがアクティブでないときに呼ばれると、戻り値は
     ‘None’ となります。

 -- メソッド: xmlparser.ExternalEntityParserCreate (context[, encoding])

     親となるパーザで解析された内容が参照している、外部で解析されるエン
     ティティを解析するために使える "子の" パーザを作成します。
     'context' パラメータは、以下に記すように *note
     ExternalEntityRefHandler(): 3f0a. ハンドラ関数に渡される文字列でな
     ければなりません。子のパーザは *note ordered_attributes: 3f0f,
     *note specified_attributes: 3f10. が現在のパーザの値に設定されて生
     成されます。

 -- メソッド: 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: 886. を設定して *note
     ExternalEntityRefHandler: 3f0a. を呼び出します。XML文書が文書型定義
     を持っていなければ、 ‘ExternalEntityRefHandler’ が呼び出しますが、
     *note StartDoctypeDeclHandler: 3f13. と *note
     EndDoctypeDeclHandler: 3f14. は呼び出されません。

     'flag' にfalseを与えると、メソッドが前回呼ばれた時のtrueの設定が解
     除されますが、他には何も起こりません。

     このメソッドは *note Parse(): 3f07. または *note ParseFile(): 3f08.
     メソッドが呼び出される前にだけ呼び出されます;これら2つのメソッドの
     どちらかが呼び出されたあとにメソッドが呼ばれると、 *note code: 1b.
     に定数
     ‘errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]’ が
     設定されて例外 *note ExpatError: 1494. が送出されます。

 -- メソッド: 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 ‘SetReparseDeferralEnabled()’ has been backported to some
     prior releases of CPython as a security fix.  Check for
     availability of ‘SetReparseDeferralEnabled()’ 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 tune protections
against some common XML vulnerabilities.

 -- メソッド:
          xmlparser.SetBillionLaughsAttackProtectionActivationThreshold
          (threshold, /)

     Sets the number of output bytes needed to activate protection
     against billion laughs(1) attacks.

     The number of output bytes includes amplification from entity
     expansion and reading DTD files.

     Parser objects usually have a protection activation threshold of 8
     MiB, but the actual default value depends on the underlying Expat
     library.

     An *note ExpatError: 1494. is raised if this method is called on a
     *note non-root: 3f05. parser.  The corresponding *note lineno:
     3f15. and *note offset: 3f16. should not be used as they may have
     no special meaning.

          注釈: Activation thresholds below 4 MiB are known to break
          support for DITA 1.3 payload and are hence not recommended.

     Added in version 3.14.6.

 -- メソッド:
          xmlparser.SetBillionLaughsAttackProtectionMaximumAmplification
          (max_factor, /)

     Sets the maximum tolerated amplification factor for protection
     against billion laughs(2) attacks.

     The amplification factor is calculated as ‘(direct + indirect) /
     direct’ while parsing, where ‘direct’ is the number of bytes read
     from the primary document in parsing and ‘indirect’ is the number
     of bytes added by expanding entities and reading of external DTD
     files.

     The 'max_factor' value must be a non-NaN *note float: 197. value
     greater than or equal to 1.0.  Peak amplifications of factor 15,000
     for the entire payload and of factor 30,000 in the middle of
     parsing have been observed with small benign files in practice.  In
     particular, the activation threshold should be carefully chosen to
     avoid false positives.

     Parser objects usually have a maximum amplification factor of 100,
     but the actual default value depends on the underlying Expat
     library.

     An *note ExpatError: 1494. is raised if this method is called on a
     *note non-root: 3f05. parser or if 'max_factor' is outside the
     valid range.  The corresponding *note lineno: 3f15. and *note
     offset: 3f16. 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
          SetBillionLaughsAttackProtectionActivationThreshold(): 1798.
          is exceeded.

     Added in version 3.14.6.

 -- メソッド: xmlparser.SetAllocTrackerActivationThreshold (threshold,
          /)

     Sets the number of allocated bytes of dynamic memory needed to
     activate protection against disproportionate use of RAM.

     Parser objects usually have an allocation activation threshold of
     64 MiB, but the actual default value depends on the underlying
     Expat library.

     An *note ExpatError: 1494. is raised if this method is called on a
     *note non-root: 3f05. parser.  The corresponding *note lineno:
     3f15. and *note offset: 3f16. 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: 197. 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.

     Parser objects usually have a maximum amplification factor of 100,
     but the actual default value depends on the underlying Expat
     library.

     An *note ExpatError: 1494. is raised if this method is called on a
     *note non-root: 3f05. parser or if 'max_factor' is outside the
     valid range.  The corresponding *note lineno: 3f15. and *note
     offset: 3f16. 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(): 1826. is exceeded.

     Added in version 3.14.1.

‘xmlparser’ オブジェクトは次のような属性を持ちます:

 -- の属性: xmlparser.buffer_size

     *note buffer_text: 16e0. が真の時に使われるバッファのサイズです。こ
     の属性に新しい整数値を代入することで違うバッファサイズにできます。
     サイズが変えられるときにバッファはフラッシュされます。

 -- の属性: 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(): 1796. 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: 16e0. が利用可能なとき、バッファに保持されたバイ
     ト数です。これらのバイトはUTF-8でエンコードされたテキストを表します
     。この属性は ‘buffer_text’ が偽の時には意味がありません。

 -- の属性: xmlparser.ordered_attributes

     この属性をゼロ以外の整数にすると、報告される(XMLノードの) 属性を辞
     書型ではなくリスト型にします。属性は文書のテキスト中の出現順で示さ
     れます。それぞれの属性は、2つのリストのエントリ: 属性名とその値、が
     与えられます。 (このモジュールの古いバージョンでも、同じフォーマッ
     トが使われています。) デフォルトでは、この属性はデフォルトでは偽と
     なりますが、いつでも変更可能です。

 -- の属性: xmlparser.specified_attributes

     ゼロ以外の整数にすると、パーザは文書のインスタンスで特定される属性
     だけを報告し、属性宣言から導出された属性は報告しないようになります
     。この属性が指定されたアプリケーションでは、XMLプロセッサの振る舞い
     に関する標準に従うために必要とされる (文書型) 宣言によって、どのよ
     うな付加情報が利用できるのかということについて特に注意を払わなけれ
     ばなりません。デフォルトで、この属性は偽となりますが、いつでも変更
     可能です。

以下の属性には、 ‘xmlparser’ オブジェクトで最も最近に起きたエラーに関す
る値が入っており、また ‘Parse()’ または ‘ParseFile()’ メソッドが *note
xml.parsers.expat.ExpatError: 1494. 例外を送出した際にのみ正しい値となり
ます。

 -- の属性: xmlparser.ErrorByteIndex

     エラーが発生したバイトのインデクスです。

 -- の属性: xmlparser.ErrorCode

     エラーを特定する数値によるコードです。この値は *note ErrorString():
     3f04. に渡したり、 ‘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: 3f0f. が
     真の場合これはリストです (詳細は ‘ordered_attributes’ を参照してく
     ださい)。 そうでなければ名前を値に対応させる辞書です。

 -- メソッド: 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: 3f24, *note EndCdataSectionHandler: 3f25,
     and *note ElementDeclHandler: 17c3. 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
     ‘CharacterDataHandler()’.  Set the *note buffer_text: 16e0.
     instance attribute to ‘True’ to avoid that.

 -- メソッド: xmlparser.UnparsedEntityDeclHandler (entityName, base,
          systemId, publicId, notationName)

     解析されていない (NDATA) エンティティ宣言を処理するために呼び出され
     ます。このハンドラは Expat ライブラリのバージョン1.2のためだけに存
     在します; より最近のバージョンでは、代わりに *note
     EntityDeclHandler: 3f26. を使用してください (根底にある 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: 3f21.
     が呼び出される前に処理されます。

 -- メソッド: xmlparser.EndNamespaceDeclHandler (prefix)

     名前空間宣言を含んでいたエレメントの終了タグに到達したときに呼び出
     されます。このハンドラは、要素に関する名前空間宣言ごとに、 *note
     StartNamespaceDeclHandler: 3f27. とは逆の順番で一度だけ呼び出され、
     各名前空間宣言のスコープが開始されたことを示します。このハンドラは
     、要素が終了する際、対応する *note EndElementHandler: 3f22. が呼ば
     れた後に呼び出されます。

 -- メソッド: xmlparser.CommentHandler (data)

     コメントで呼び出されます。 'data' はコメントのテキストで、先頭の
     '‘<!-’ ‘-’' と末尾の '‘-’ ‘->’' を除きます。

 -- メソッド: xmlparser.StartCdataSectionHandler ()

     CDATA セクションの開始時に呼び出されます。CDATA セクションの構文的
     な開始と終了位置を識別できるようにするには、このハンドラと *note
     EndCdataSectionHandler: 3f25. が必要です。

 -- メソッド: xmlparser.EndCdataSectionHandler ()

     CDATA セクションの終了時に呼び出されます。

 -- メソッド: xmlparser.DefaultHandler (data)

     XML 文書中で、適用可能なハンドラが指定されていない文字すべてに対し
     て呼び出されます。この文字とは、検出されたことが報告されるが、ハン
     ドラは指定されていないようなコンストラクト (construct) の一部である
     文字を意味します。

 -- メソッド: xmlparser.DefaultHandlerExpand (data)

     *note DefaultHandler(): 3f2a. と同じですが、内部エンティティの展開
     を禁止しません。エンティティ参照はデフォルトハンドラに渡されません
     。

 -- メソッド: 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(3) if ‘xmlparser’ is used with user-provided XML
          content.  Please reflect on your threat model(4) before
          implementing this handler.

     外部エンティティの参照時に呼び出されます。 'base' は現在の基底
     (base) で、以前の *note SetBase(): 3f09. で設定された値になっていま
     す。 public、および system の識別子である、 'systemId' と
     'publicId' が指定されている場合、値は文字列です; public 識別子が指
     定されていない場合、 'publicId' は ‘None’ になります。 'context' の
     値は不明瞭なものであり、以下に記述するようにしか使ってはなりません
     。

     外部エンティティが解析されるようにするには、このハンドラを実装しな
     ければなりません。このハンドラは、
     ‘ExternalEntityParserCreate(context)’ を使って適切なコールバックを
     指定し、子パーザを生成して、エンティティを解析する役割を担います。
     このハンドラは整数を返さなければなりません; ‘0’ を返した場合、パー
     ザは ‘XML_ERROR_EXTERNAL_ENTITY_HANDLING’ エラーを送出します。そう
     でない場合、解析を継続します。

     このハンドラが与えられておらず、 *note DefaultHandler: 3f2a. コール
     バックが指定されていれば、外部エンティティは ‘DefaultHandler’ で報
     告されます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Billion_laughs_attack

   (2) https://en.wikipedia.org/wiki/Billion_laughs_attack

   (3) https://en.wikipedia.org/wiki/XML_external_entity_attack

   (4) https://en.wikipedia.org/wiki/Threat_model


File: python.info,  Node: ExpatError 例外,  Next: 使用例<35>,  Prev: XMLParser オブジェクト<2>,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.22.13.2 ExpatError 例外
.........................

*note ExpatError: 1494. 例外はいくつかの興味深い属性を備えています:

 -- の属性: ExpatError.code

     特定のエラーに対する Expat の内部エラー番号です。 *note
     errors.messages: 3f2f. 辞書はこれらのエラー番号を 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: 12e. モジュールはエラーメッセージ定数と、それらのメッ
     セージをエラーコードに対応させる辞書 *note codes: 3f30. も提供して
     います。以下を参照してください。

 -- の属性: ExpatError.lineno

     エラーが検出された場所の行番号です。最初の行の番号は ‘1’ です。

 -- の属性: ExpatError.offset

     エラーが発生した場所の行内でのオフセットです。最初のカラムの番号は
     ‘0’ です。


File: python.info,  Node: 使用例<35>,  Next: 内容モデルの記述,  Prev: ExpatError 例外,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.22.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.22.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.22.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.23 インターネットプロトコルとサポート
=======================================

この章で記述されるモジュールは、インターネットプロトコルを実装し、関連技
術をサポートします。それらは全て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.23.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(): 17c5. 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: 218f.-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 ‘ctypes’ isn't available, calls to *note
open(): 17c5. 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.23.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: 2199.: 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 監査イベント: 1ccb. ‘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(): 3f6f. と同様に振る舞
     います。

     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(): 3f71. でそのブラウザのコントローラーを呼び出すことがで
     きます。 'instance' が指定されなかったり、 ‘None’ なら、インスタン
     スが必要な時には 'constructor' がパラメータなしに呼び出されて作られ
     ます。 'instance' が指定されたら、 'constructor' は呼び出されないの
     で、 ‘None’ でかまいません。

     'preferred' を ‘True’ に設定すると、 *note get(): 3f71. の引数無し
     の呼び出しの結果が優先的にこのブラウザになります。 そうでない場合は
     、この関数は、変数 ‘BROWSER’ を設定するか、 ‘get()’ を空文字列では
     ない、宣言したハンドラの名前と一致する引数とともに呼び出すときにだ
     け、役に立ちます。

     バージョン 3.7 で変更: 'preferred' キーワード専用引数が追加されまし
     た。

いくつかの種類のブラウザがあらかじめ定義されています。このモジュールで定
義されている、関数 *note get(): 3f71. に与えるブラウザの名前と、それぞれ
のコントローラークラスのインスタンスを以下の表に示します。

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.23.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(): 3f6f. の別名。

 -- メソッド: controller.open_new_tab (url)

     可能であれば、このコントローラーでハンドルされたブラウザの新しいペ
     ージ(「タブ」)で 'url' を開きますが、そうでない場合は *note
     open_new(): 3f6f. と同じです。

脚注
....


File: python.info,  Node: wsgiref --- WSGI ユーティリティとリファレンス実装,  Next: urllib --- URL を扱うモジュール群,  Prev: webbrowser --- 便利なウェブブラウザコントローラー,  Up: インターネットプロトコルとサポート

5.23.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.23.2.1 ‘wsgiref.util’ - WSGI environment utilities
....................................................

このモジュールは WSGI 環境で使う様々なユーティリティ関数を提供します。
WSGI 環境は PEP 3333(1) で記述されているような HTTP リクエスト変数を含む
辞書です。'environ' パラメータを取るすべての関数は WSGI 準拠の辞書を与え
られることを期待しています; 細かい仕様については PEP 3333(2) を、型アノ
テーションに使える型エイリアスについては *note WSGIEnvironment: 3f7c. を
参照してください。

 -- の関数: 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(): 3f7e. に似ています。結果はリクエストによって指定され
     たアプリケーションオブジェクトのベース 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(): 3f80. を呼んだ場合、これは "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(): 3f82. 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:
     3f83. protocol used to convert a file-like object to an *note
     iterator: 4c8.  The resulting objects are *note iterable: 12f5.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.23.2.2 ‘wsgiref.headers’ - WSGI response header tools
.......................................................

このモジュールは単一のクラス、 *note Headers: 109c. を提供し、WSGI レス
ポンスヘッダの操作をマップに似たインターフェースで便利にします。

 -- クラス: wsgiref.headers.Headers ([headers])

     'headers' をラップするマップ風オブジェクトを生成します。これは PEP
     3333(1) に定義されるようなヘッダの名前／値のタプルのリストです。
     'headers' のデフォルト値は空のリストです。

     ‘Headers’ objects support typical mapping operations including
     *note __getitem__(): 588, *note get(): 2090, *note __setitem__():
     14e7, *note setdefault(): 1289, *note __delitem__(): 14e8. and
     *note __contains__(): 15d7.  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: 109c. オブジェクトはラップされたヘ
     ッダリストに存在しないキーを取得または削除しようとした場合にもエラ
     ーを発生しません。単に、存在しないヘッダの取得は ‘None’ を返し、存
     在しないヘッダの削除は何もしません。

     *note Headers: 109c. オブジェクトは ‘keys()’ 、 ‘values()’ 、
     ‘items()’ メソッドもサポートします。複数の値を持つヘッダがある場合
     には、 ‘keys()’ と ‘items()’ で返されるリストは同じキーを一つ以上含
     むことがあります。 ‘Headers’ オブジェクトの ‘len()’ は、その
     ‘items()’ の長さと同じであり、ラップされたヘッダリストの長さと同じ
     です。実際、 ‘items()’ メソッドは単にラップされたヘッダリストのコピ
     ーを返しているだけです。

     *note Headers: 109c. オブジェクトに対して ‘bytes()’ を呼ぶと、HTTP
     レスポンスヘッダとして送信するのに適した形に整形されたバイト文字列
     を返します。それぞれのヘッダはコロンとスペースで区切られた値と共に
     一列に並んでいます。それぞれの行はキャリッジリターンとラインフィー
     ドで終了し、バイト文字列は空行で終了しています。

     これらのマッピングインターフェースと整形機能に加えて、 *note
     Headers: 109c. オブジェクトは複数の値を持つヘッダの取得と追加、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.23.2.3 ‘wsgiref.simple_server’ - a simple WSGI HTTP server
............................................................

このモジュールは WSGI アプリケーションを提供するシンプルな HTTP サーバで
す (*note http.server: 76. がベースです)。個々のサーバインスタンスは単一
の WSGI アプリケーションを、特定のホストとポート上で提供します。もし一つ
のホストとポート上で複数のアプリケーションを提供したいならば、
‘PATH_INFO’ をパースして個々のリクエストでどのアプリケーションを呼び出す
か選択するような WSGI アプリケーションを作る必要があります。（例えば、
*note wsgiref.util: 124. から ‘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: 3f89. protocol.

 -- クラス: wsgiref.simple_server.WSGIServer (server_address,
          RequestHandlerClass)

     *note WSGIServer: 3f8a. インスタンスを作成します。 'server_address'
     は ‘(host,port)’ のタプル、そして 'RequestHandlerClass' はリクエス
     トの処理に使われる *note http.server.BaseHTTPRequestHandler: 12e6.
     のサブクラスでなければいけません。

     *note make_server(): 3f88. が細かい調整をやってくれるので、通常はこ
     のコンストラクタを呼ぶ必要はありません。

     *note WSGIServer: 3f8a. は *note http.server.HTTPServer: 3f8b. のサ
     ブクラスなので、そのすべてのメソッド (‘serve_forever()’ や
     ‘handle_request()’ のような) が利用できます。 ‘WSGIServer’ も以下の
     ような WSGI 固有メソッドを提供します:

      -- メソッド: set_app (application)

          呼び出し可能 (callable) な 'application' をリクエストを受け取
          る WSGI アプリケーションとして設定します。

      -- メソッド: get_app ()

          Returns the currently set application callable.

     しかしながら、通常はこれらの追加されたメソッドを使う必要はありませ
     ん。 *note set_app(): 3f8c. は普通は *note make_server(): 3f88. に
     よって呼ばれ、 *note get_app(): 3f8d. は主にリクエストハンドライン
     スタンスの便宜上存在するからです。

 -- クラス: wsgiref.simple_server.WSGIRequestHandler (request,
          client_address, server)

     与えられた 'request' （すなわちソケット）の HTTP ハンドラ、
     'client_address' (‘(host,port)’ のタプル)、 'server' (*note
     WSGIServer: 3f8a. インスタンス) の HTTP ハンドラを作成します。

     このクラスのインスタンスを直接生成する必要はありません; これらは必
     要に応じて *note WSGIServer: 3f8a. オブジェクトによって自動的に生成
     されます。しかしながら、このクラスをサブクラス化し、 *note
     make_server(): 3f88. 関数に 'handler_class' として与えることは可能
     でしょう。サブクラスにおいてオーバーライドする意味のありそうなもの
     は:

      -- メソッド: get_environ ()

          リクエストに対する *note WSGIEnvironment: 3f7c. 辞書を返します
          。デフォルト実装では *note WSGIServer: 3f8a. オブジェクトの
          ‘base_environ’ 辞書属性のコンテンツをコピーし、それから HTTP リ
          クエスト由来の様々なヘッダを追加しています。このメソッド呼び出
          し毎に、 PEP 3333(2) に指定されている関連する CGI 環境変数をす
          べて含む新規の辞書を返さなければいけません。

      -- メソッド: get_stderr ()

          ‘wsgi.errors’ ストリームとして使われるオブジェクトを返します。
          デフォルト実装では単に ‘sys.stderr’ を返します。

      -- メソッド: handle ()

          HTTP リクエストを処理します。デフォルト実装では実際の WGI アプ
          リケーションインターフェースを実装するのに *note
          wsgiref.handlers: 120. クラスを使ってハンドラインスタンスを作
          成します。

   ---------- 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.23.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: 8b9. 例外が送
     出されます; しかし、このエラーがどう扱われるかはサーバ依存であるこ
     とに注意してください。例えば、 *note wsgiref.simple_server: 122. と
     その他 *note wsgiref.handlers: 120. ベースのサーバ（エラー処理メソ
     ッドが他のことをするようにオーバライドしていないもの）は単純にエラ
     ーが発生したというメッセージとトレースバックのダンプを ‘sys.stderr’
     やその他のエラーストリームに出力します。

     このラッパーは、疑わしいものの実際には PEP 3333(3) で禁止されていな
     いかもしれない挙動を指摘するために *note warnings: 119. モジュール
     を使って出力を生成します。これらは Python のコマンドラインオプショ
     ンや ‘warnings’ 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.23.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: 3f96. のサブクラスで、これは
     ‘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: 3f95. ク
     ラス以外の専用の選択肢です。

     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: 3f95, 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: 3f95. に似ていますが、 *note sys: df. と *note
     os: a5. モジュールを使う代わりに CGI 環境と I/O ストリームを明示的
     に指定します。 'multithread' と 'multiprocess' の値は、ハンドライン
     スタンスにより実行されるアプリケーションの ‘wsgi.multithread’ と
     ‘wsgi.multiprocess’ フラグの設定に使われます。

     このクラスは *note SimpleHandler: 3f98. のサブクラスで、HTTP の "本
     サーバ" でないソフトウェアと使うことを意図しています。もしあなたが
     ‘Status:’ ヘッダを HTTP ステータスを送信するのに使うようなゲートウ
     ェイプロトコルの実装（CGI、FastCGI、SCGIなど）を書いている場合、お
     そらく ‘SimpleHandler’ ではなくこのクラスをサブクラス化するとよいで
     しょう。

 -- クラス: wsgiref.handlers.SimpleHandler (stdin, stdout, stderr,
          environ, multithread=True, multiprocess=False)

     *note BaseCGIHandler: 3f96. と似ていますが、HTTP の本サーバと使うた
     めにデザインされています。もしあなたが HTTP サーバ実装を書いている
     場合、おそらく ‘BaseCGIHandler’ ではなくこのクラスをサブクラス化す
     るとよいでしょう。

     This class is a subclass of *note BaseHandler: 1e2f.  It overrides
     the ‘__init__()’, *note get_stdin(): 3f99, *note get_stderr():
     3f9a, *note add_cgi_vars(): 3f9b, *note _write(): 3f9c, and *note
     _flush(): 3f9d. 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(): edb. method of 'stdout' should write each chunk
     in full, like *note io.BufferedIOBase: 8a4.

 -- クラス: wsgiref.handlers.BaseHandler

     これは WSGI アプリケーションを実行するための抽象ベースクラスです。
     それぞれのインスタンスは一つの HTTP リクエストを処理します。しかし
     原理上は複数のリクエスト用に再利用可能なサブクラスを作成することが
     できます。

     *note BaseHandler: 1e2f. インスタンスは外部から利用されるたった一つ
     のメソッドを持ちます:

      -- メソッド: run (app)

          指定された WSGI アプリケーション、'app' を実行します。

     その他のすべての *note BaseHandler: 1e2f. のメソッドはアプリケーシ
     ョン実行プロセスでこのメソッドから呼ばれます。したがって、それらは
     主にそのプロセスのカスタマイズのために存在しています。

     以下のメソッドはサブクラスでオーバーライドされなければいけません:

      -- メソッド: _write (data)

          バイト列の 'data' をクライアントへの転送用にバッファします。こ
          のメソッドが実際にデータを転送しても OK です: 下部システムが実
          際にそのような区別をしている場合に効率をより良くするために、
          *note BaseHandler: 1e2f. は書き出しとフラッシュ操作を分けてい
          るからです。

      -- メソッド: _flush ()

          バッファされたデータをクライアントに強制的に転送します。このメ
          ソッドは何もしなくても OK です（すなわち、 *note _write():
          3f9c. が実際にデータを送る場合）。

      -- メソッド: get_stdin ()

          Return an object compatible with *note InputStream: 3f9f.
          suitable for use as the ‘wsgi.input’ of the request currently
          being processed.

      -- メソッド: get_stderr ()

          Return an object compatible with *note ErrorStream: 3fa0.
          suitable for use as the ‘wsgi.errors’ of the request currently
          being processed.

      -- メソッド: add_cgi_vars ()

          現在のリクエストの CGI 変数を ‘environ’ 属性に追加します。

     オーバーライドされることの多いメソッド及び属性を以下に挙げます。し
     かし、このリストは単にサマリであり、オーバーライド可能なすべてのメ
     ソッドは含んでいません。カスタマイズした *note BaseHandler: 1e2f. サ
     ブクラスを作成しようとする前に docstring やソースコードでさらなる情
     報を調べてください。

     WSGI 環境のカスタマイズのための属性とメソッド:

      -- の属性: wsgi_multithread

          ‘wsgi.multithread’ 環境変数で使われる値。 *note BaseHandler:
          1e2f. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_multiprocess

          ‘wsgi.multiprocess’ 環境変数で使われる値。 *note BaseHandler:
          1e2f. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_run_once

          ‘wsgi.run_once’ 環境変数で使われる値。 *note BaseHandler:
          1e2f. ではデフォルトが false ですが、 *note CGIHandler: 3f95.
          はデフォルトでこれを 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: 3fa6. 属性が設定されている場合、この属性
          の値がデフォルトの ‘SERVER_SOFTWARE’ WSGI 環境変数の設定や
          HTTP レスポンス中のデフォルトの ‘Server:’ ヘッダの設定に使われ
          ます。これは (*note BaseCGIHandler: 3f96. や *note CGIHandler:
          3f95. のような) HTTP オリジンサーバでないハンドラでは無視され
          ます。

          バージョン 3.3 で変更: "Python" という語は "CPython" や
          "Jython" などのような個別実装の語に置き換えられました。

      -- メソッド: get_scheme ()

          現在のリクエストで使われている URL スキームを返します。デフォ
          ルト実装は *note wsgiref.util: 124. の ‘guess_scheme()’ を使い
          、現在のリクエストの ‘environ’ 変数に基づいてスキームが"http"
          か "https" かを推測します。

      -- メソッド: setup_environ ()

          ‘environ’ 属性を、フル実装 (fully populated) の WSGI 環境に設
          定します。デフォルトの実装は、上記すべてのメソッドと属性、加え
          て *note get_stdin(): 3f99. 、 *note get_stderr(): 3f9a. 、
          *note add_cgi_vars(): 3f9b. メソッドと *note
          wsgi_file_wrapper: 3fa9. 属性を利用します。これは、キーが存在
          せず、 *note origin_server: 3fa6. 属性が true 値で *note
          server_software: 3fa5. 属性も設定されている場合に
          ‘SERVER_SOFTWARE’ を挿入します。

     例外処理のカスタマイズのためのメソッドと属性:

      -- メソッド: log_exception (exc_info)

          'exc_info' タプルをサーバログに記録します。'exc_info' は
          ‘(type, value, traceback)’ のタプルです。デフォルトの実装は単
          純にトレースバックをリクエストの ‘wsgi.errors’ ストリームに書
          き出してフラッシュします。サブクラスはこのメソッドをオーバーラ
          イドしてフォーマットを変更したり出力先の変更、トレースバックを
          管理者にメールしたりその他適切と思われるいかなるアクションも取
          ることができます。

      -- の属性: traceback_limit

          デフォルトの *note log_exception(): 3faa. メソッドで出力される
          トレースバック出力に含まれる最大のフレーム数です。 ‘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: 3f89. protocol.

          デフォルト実装は単に *note error_status: 3fad. 、 *note
          error_headers: 3fae. 、 *note error_body: 3faf. 属性を出力ペー
          ジの生成に使います。サブクラスではこれをオーバーライドしてもっ
          と動的なエラー出力をすることができます。

          しかし、セキュリティの観点からは診断をあらゆるユーザに吐き出す
          ことは推奨されないことに気をつけてください; 理想的には、診断的
          な出力を有効にするには何らかの特別なことをする必要があるように
          すべきで、これがデフォルト実装では何も含まれていない理由です。

      -- の属性: 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: 3f83, or ‘None’.  The default value
          of this attribute is the *note wsgiref.util.FileWrapper: 943.
          class.

      -- メソッド: sendfile ()

          オーバーライドしてプラットフォーム固有のファイル転送を実装しま
          す。このメソッドはアプリケーションの戻り値が *note
          wsgi_file_wrapper: 3fa9. 属性で指定されたクラスのインスタンス
          の場合にのみ呼ばれます。これはファイルの転送が成功できた場合に
          は true を返して、デフォルトの転送コードが実行されないようにす
          るべきです。このデフォルトの実装は単に false 値を返します。

     その他のメソッドと属性:

      -- の属性: origin_server

          この属性はハンドラの *note _write(): 3f9c. と *note _flush():
          3f9d. が、特別に ‘Status:’ ヘッダに HTTP ステータスを求めるよ
          うな CGI 風のゲートウェイプロトコル経由でなく、クライアントと
          直接通信をするような場合には true 値に設定されているべきです。

          この属性のデフォルト値は *note BaseHandler: 1e2f. では true で
          すが、 *note BaseCGIHandler: 3f96. と *note CGIHandler: 3f95.
          では false です。

      -- の属性: http_version

          *note origin_server: 3fa6. が 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: 3f95. and *note IISCGIHandler: 3f97. 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.23.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: 943. 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.23.2.7 使用例
...............

This is a working "Hello World" WSGI application, where the
'start_response' callable should follow the *note StartResponse: 3f89.
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.23.3 ‘urllib’ -- URL を扱うモジュール群
-----------------------------------------

'ソースコード:' Lib/urllib/(1)

__________________________________________________________________

‘urllib’ は URL を扱う幾つかのモジュールを集めたパッケージです:

   * *note urllib.request: 112. は URL を開いて読むためのモジュールです

   * *note urllib.error: 110. は *note urllib.request: 112. が発生させる
     例外を持っています

   * *note urllib.parse: 111. は URL をパースするためのモジュールです

   * *note urllib.robotparser: 114. は ‘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.23.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(): 3fbb.
     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: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

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: 11de. object.

     'data' はサーバーに送信する追加データを指定するオブジェクトであるか
     ‘None’ である必要があります。詳細は *note Request: 11de. を確認して
     ください。

     urllib.request モジュールは HTTP/1.1 を使用し、その HTTP リクエスト
     に ‘Connection:close’ ヘッダーを含みます。

     任意引数 'timeout' には接続開始などのブロックする操作におけるタイム
     アウト時間を秒数で指定します (指定されなかった場合、グローバルのデ
     フォルトタイムアウト時間が利用されます)。この引数は、 HTTP, HTTPS,
     FTP 接続でのみ有効です。

     'context' を指定する場合は、様々な SSL オプションを記述する *note
     ssl.SSLContext: 355. インスタンスでなければなりません。 詳細は
     *note HTTPSConnection: d3a. を参照してください。

     この関数は常にプロパティ 'url'、 'headers'、および 'status' を持ち
     、 *note コンテキストマネージャ: 1e3. として動作するオブジェクトを
     返します。これらのプロパティに関する詳細は *note
     urllib.response.addinfourl: 3fbc. を確認してください。

     HTTP および HTTPS URL の場合、この関数は、わずかに修正された *note
     http.client.HTTPResponse: 12e9. オブジェクトを返します。上記の3つの
     新しいメソッドに加えて、 msg 属性が ‘HTTPResponse’ のドキュメンテー
     ションで指定されているレスポンスヘッダーの代わりに *note reason:
     3fbd. 属性 -- サーバーから返された reason フレーズ -- と同じ情報を
     含んでいます。

     FTP 、ファイルおよびデータURLの場合、この関数は *note
     urllib.response.addinfourl: 3fbc. オブジェクトを返します。

     プロトコルエラー発生時は *note URLError: 2c0. を送出します。

     どのハンドラもリクエストを処理しなかった場合には ‘None’ を返すこと
     があるので注意してください (デフォルトでインストールされる グローバ
     ルハンドラの *note OpenerDirector: 3fbe. は、 *note UnknownHandler:
     3fbf. を使って上記の問題が起きないようにしています)。

     さらに、プロキシ設定が検出された場合(例えば ‘http_proxy’ のような
     ‘*_proxy’ 環境変数がセットされているなど)には *note ProxyHandler:
     1e11. がデフォルトでインストールされ、これがプロキシを通してリクエ
     ストを処理するようにしています。

     Python 2.6 以前のレガシーな ‘urllib.urlopen’ 関数は廃止されました。
     *note urllib.request.urlopen(): 309. が過去の ‘urllib2.urlopen’ に
     相当します。‘urllib.urlopen’ において辞書型オブジェクトで渡していた
     プロキシの扱いは、*note ProxyHandler: 1e11. オブジェクトを使用して
     取得できます。

     The default opener raises an *note auditing event: 1ccb.
     ‘urllib.Request’ with arguments ‘fullurl’, ‘data’, ‘headers’,
     ‘method’ taken from the request object.

     バージョン 3.2 で変更: 'cafile' および 'capath' が追加されました。

     HTTPS バーチャルホストがサポートされました (*note ssl.HAS_SNI:
     3a7f. が真の場合のみ)。

     '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(): 1068.

     バージョン 3.13 で変更: Remove 'cafile', 'capath' and 'cadefault'
     parameters: use the 'context' parameter instead.

 -- の関数: urllib.request.install_opener (opener)

     指定された *note OpenerDirector: 3fbe. のインスタンスを、デフォルト
     で利用されるグローバルの opener としてインストールします。 opener の
     インストールは、 urlopen にその opener を使って欲しいとき以外必要あ
     りません。普段は単に *note urlopen(): 309. の代わりに *note
     OpenerDirector.open(): 11e2. を利用してください。この関数は引数が本
     当に ‘OpenerDirector’ のインスタンスであるかどうかはチェックしませ
     ん。適切なインターフェースを持った任意のクラスを利用することができ
     ます。

 -- の関数: urllib.request.build_opener ([handler, ...])

     与えられた順番に URL ハンドラを連鎖させる *note OpenerDirector:
     3fbe. のインスタンスを返します。 'handler' は *note BaseHandler:
     3fc1. または ‘BaseHandler’ のサブクラスのインスタンスのどちらかです
     (どちらの場合も、コンストラクトは引数無しで呼び出せるようになってい
     なければなりません) 。クラス *note ProxyHandler: 1e11. (proxy 設定
     が検出された場合), *note UnknownHandler: 3fbf, *note HTTPHandler:
     efc, *note HTTPDefaultErrorHandler: 3fc2, *note
     HTTPRedirectHandler: 3fc3, *note FTPHandler: 3fc4, *note
     FileHandler: 3fc5, *note HTTPErrorProcessor: 3fc6. については、その
     クラスのインスタンスか、そのサブクラスのインスタンスが 'handler' に
     含まれていない限り、 'handler' よりも先に連鎖します。

     Python が SSL をサポートするように設定してインストールされている場
     合 (すなわち、 *note ssl: d5. モジュールを import できる場合) *note
     HTTPSHandler: 1440. も追加されます。

     *note BaseHandler: 3fc1. サブクラスでも ‘handler_order’ メンバー変
     数を変更して、ハンドラーリスト内での場所を変更できます。

 -- の関数: urllib.request.pathname2url (path, *, add_scheme=False)

     Convert the given local path to a ‘file:’ URL. This function uses
     *note quote(): da0. 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: 2c2. 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(): 1b59. 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: 2c0.
     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(): 3a3e. 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: 2c0. 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: 2c2. 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: 2c0. 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: efc. 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(): 1099. 関数は、マップ型ある
     いは 2 タプルのシーケンスを取り、この形式の ASCII 文字列を返します
     。これは 'data' パラメーターとして使用される前に bytes 型にエンコー
     ドされなければなりません。

     'headers' は辞書でなければなりません。この辞書は *note
     add_header(): 3fc7. を辞書のキーおよび値を引数として呼び出した時と
     同じように扱われます。この引数は、多くの場合ブラウザーが何であるか
     を特定する ‘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: 10f. はデフォルトで ‘"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: 11df. に格納され、 *note get_method(): 1385. で使用されます
     。デフォルトは 'data' が ‘None’ であれば ‘'GET'’ で、そうでなければ
     ‘'POST'’ です。サブクラスは ‘method’ 属性をクラス自身に設定して、異
     なるデフォルトメソッドを示すことができます。

          注釈: 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: 11df. が Request
     クラスに追加されました。

     バージョン 3.4 で変更: *note Request.method: 11df. のデフォルト値は
     クラスレベルで指定されることがあります。

     バージョン 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: 3fbe. クラスは、 *note BaseHandler: 3fc1. の
     連鎖的に呼び出して URL を開きます。このクラスはハンドラをどのように
     連鎖させるか、またどのようにエラーをリカバリするかを管理します。

 -- クラス: urllib.request.BaseHandler

     このクラスはハンドラ連鎖に登録される全てのハンドラがベースとしてい
     るクラスです - このクラスでは登録のための単純なメカニズムだけを扱い
     ます。

 -- クラス: urllib.request.HTTPDefaultErrorHandler

     HTTP エラーレスポンスのデフォルトハンドラーを定義するクラスです; す
     べてのレスポンスは *note HTTPError: 11e4. 例外に変換されます。

 -- クラス: 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(): 3fbb. のドキ
          ュメンテーションを参照してください。

 -- クラス: urllib.request.HTTPPasswordMgr

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。

 -- クラス: urllib.request.HTTPPasswordMgrWithDefaultRealm

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。レルム ‘None’ はその他諸々のレルムを表し、他のレルムが該当しな
     い場合に検索されます。

 -- クラス: urllib.request.HTTPPasswordMgrWithPriorAuth

     ‘uri -> is_authenticated’ マッピングのデータベースも持つ *note
     HTTPPasswordMgrWithDefaultRealm: 3fca. のバリエーションです。最初に
     ‘401’ レスポンスを待つのではなく直ちに認証情報を送るときの条件を判
     断するために、 BasicAuth ハンドラによって使われます。

     Added in version 3.5.

 -- クラス: urllib.request.AbstractBasicAuthHandler (password_mgr=None)

     これは、リモートホストとプロキシの両方に対して HTTP 認証を行うこと
     を助ける mixin クラスです。 'password_mgr' は、もし与えられたら
     *note HTTPPasswordMgr: 3fc9. と互換性のあるオブジェクトでなければな
     りません; サポートすべきインターフェースに関する情報は *note
     HTTPPasswordMgr オブジェクト: 3fcb. 節を参照してください。もし
     'passwd_mgr' が ‘is_authenticated’ と ‘update_authenticated’ メソッ
     ドも提供するなら (*note HTTPPasswordMgrWithPriorAuth オブジェクト:
     3fcc. を参照)、ハンドラは与えられた 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: 3fc9. と互換性がなければなりません; 互換性の
     ためにサポートしなければならないインターフェースについての情報はセ
     クション *note HTTPPasswordMgr オブジェクト: 3fcb. を参照してくださ
     い。HTTPBasicAuthHandler は、間違った認証スキーマが与えられると
     *note ValueError: 2ee. を送出します。

 -- クラス: urllib.request.ProxyBasicAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3fc9. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 3fcb. を参照してくだ
     さい。

 -- クラス: urllib.request.AbstractDigestAuthHandler (password_mgr=None)

     このクラスはHTTP 認証を補助するための混ぜ込みクラス (mixin class) で
     す。遠隔ホストとプロキシの両方に対応しています。 'password_mgr' を
     与える場合、 *note HTTPPasswordMgr: 3fc9. と互換性がなければなりま
     せん; 互換性のためにサポートしなければならないインターフェースにつ
     いての情報はセクション *note HTTPPasswordMgr オブジェクト: 3fcb. を
     参照してください。

     バージョン 3.14 で変更: Added support for HTTP digest
     authentication algorithm ‘SHA-256’.

 -- クラス: urllib.request.HTTPDigestAuthHandler (password_mgr=None)

     リモートホストとの認証を扱います。'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3fc9. と互換性のあるものでなければなりません
     。サポートしなければならないインターフェースについての情報は *note
     HTTPPasswordMgr オブジェクト: 3fcb. 節を参照してください。Digest 認
     証ハンドラーと Basic 認証ハンドラーの両方が追加された場合、常に
     Digest 認証を先に試みます。Digest 認証が 40x のレスポンスを再び返す
     と、Basic 認証ハンドラーに送信されます。このハンドラーメソッドは、
     Digest および Basic 以外の認証スキームが存在する場合は *note
     ValueError: 2ee. を送出します。

     バージョン 3.3 で変更: 未サポートの認証スキームでは *note
     ValueError: 2ee. を送出するようになりました。

 -- クラス: urllib.request.ProxyDigestAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3fc9. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 3fcb. を参照してくだ
     さい。

 -- クラス: urllib.request.HTTPHandler

     HTTP の URL を開きます。

 -- クラス: urllib.request.HTTPSHandler (debuglevel=0, context=None,
          check_hostname=None)

     HTTPS で URL を開きます。'context' および 'check_hostname' は *note
     http.client.HTTPSConnection: d3a. のものと同じ意味です。

     バージョン 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.23.4.1 Request オブジェクト
.............................

以下のメソッドは *note Request: 11de. の公開インターフェースについて説明
しています。これらはすべてサブクラスでオーバーライドできます。また、解析
したリクエストを調査するためにクライアントで使用するいくつかの属性も定義
します。

 -- の属性: Request.full_url

     コンストラクターに渡されたオリジナルの URL です。

     バージョン 3.4 で変更.

     Request.full_url は、 setter, getter, deleter を持つプロパティです
     。もし存在すれば、 *note full_url: 11e0. はオリジナルのリクエスト
     URL フラグメント付きで返します。

 -- の属性: Request.type

     URI スキームです。

 -- の属性: Request.host

     URI オーソリティです。通常はホスト名ですが、コロンで区切られたポー
     ト番号が付随することもあります。

 -- の属性: Request.origin_req_host

     リクエストしたオリジナルのホスト名です。ポート番号はつきません。

 -- の属性: Request.selector

     URI パスです。*note Request: 11de. がプロキシを使用する場合、セレク
     ターはプロキシに渡される完全な URL になります。

 -- の属性: Request.data

     リクエストのエンティティボディか、指定されない場合は ‘None’ になり
     ます。

     バージョン 3.4 で変更: *note Request.data: 11e1. の値が変更されると
     、もしそれ以前に "Content-Length" ヘッダーの値が設定または計算され
     ていたらヘッダーが削除されるようになりました。

 -- の属性: Request.unverifiable

     リクエストが RFC 2965(1) で定義された証明不能 (unverifiable) である
     かどうかを示す論理値です。

 -- の属性: Request.method

     HTTP リクエストで使うメソッドです。 デフォルト値は *note None: 886.
     で、このときは使うメソッドを *note get_method(): 1385. が通常の方法
     で決定するということになります。 この値を設定する (従って
     ‘get_method()’ のデフォルトの決定を上書きする) 方法は、 *note
     Request: 11de. サブクラスでのクラスレベルの設定処理でデフォルト値を
     提供するか、 ‘Request’ のコンストラクタの 'method' 引数へ値を渡すか
     です。

     Added in version 3.3.

     バージョン 3.4 で変更: サブクラスでデフォルト値が設定できるようにな
     りました; 以前はコンストラクタ引数からしか設定できませんでした。

 -- メソッド: Request.get_method ()

     HTTP リクエストメソッドを示す文字列を返します。*note
     Request.method: 11df. が ‘None’ でなければその値を返します。そうで
     ない場合、*note Request.data: 11e1. が ‘None’ なら ‘'GET'’ を、そう
     でなければ ‘'POST'’ を返します。これは HTTP リクエストに対してのみ
     意味を持ちます。

     バージョン 3.3 で変更: get_method は *note Request.method: 11df. の
     値を参照するようになりました。

 -- メソッド: 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: 11e0. を返します。

 -- メソッド: 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.23.4.2 OpenerDirector オブジェクト
....................................

*note OpenerDirector: 3fbe. インスタンスは以下のメソッドを持っています:

 -- メソッド: OpenerDirector.add_handler (handler)

     'handler' should be an instance of *note BaseHandler: 3fc1.  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(): 3fe1. を参照して
          ください。

        * ‘http_error_<type>()’ -- ハンドラーが HTTP エラーコード 'type'
          の処理方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.http_error_<nnn>(): 3fe2. を参照し
          てください。

        * ‘<protocol>_error()’ -- ハンドラーが (‘http’ でない)
          'protocol' のエラーを処理する方法を知っていることを示すシグナ
          ルです。

        * ‘<protocol>_request()’ -- ハンドラーが 'protocol' リクエストの
          プリプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_request(): 3fe3. を参照
          してください。

        * ‘<protocol>_response()’ -- ハンドラーが 'protocol' リクエスト
          のポストプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_response(): 3fe4. を参照
          してください。

 -- メソッド: OpenerDirector.open (url, data=None[, timeout])

     与えられた 'url' (リクエストオブジェクトでも文字列でもかまいません)
     を開きます。オプションとして 'data' を与えることができます。 引数、
     戻り値、および送出される例外は *note urlopen(): 309. と同じです
     (‘urlopen()’ の場合、標準でインストールされている グローバルな
     *note OpenerDirector: 3fbe. の *note open(): 318. メソッドを呼び出
     します) 。 オプションの 'timeout' 引数は、接続開始のようなブロック
     する処理におけるタイムアウト時間を 秒数で指定します。(指定しなかっ
     た場合は、グローバルのデフォルト設定が利用されます) タイムアウト機
     能は、 HTTP, HTTPS, FTP 接続でのみ有効です。

 -- メソッド: OpenerDirector.error (proto, *args)

     与えられたプロトコルにおけるエラーを処理します。このメソッドは与え
     られたプロトコルにおける登録済みのエラーハンドラを (プロトコル固有
     の) 引数で呼び出します。 HTTP プロトコルは特殊なケースで、特定のエ
     ラーハンドラを選び出すのに HTTP レスポンスコードを使います; ハンド
     ラクラスの ‘http_error_<type>()’ メソッドを参照してください。

     戻り値および送出される例外は *note urlopen(): 309. と同じものです。

OpenerDirector オブジェクトは、以下の 3 つのステージに分けて URL を開き
ます:

各ステージで OpenerDirector オブジェクトのメソッドがどのような順で呼び出
されるかは、ハンドラインスタンスの並び方で決まります。

  1. ‘<protocol>_request()’ 形式のメソッドを持つすべてのハンドラーに対し
     てそのメソッドを呼び出し、リクエストのプリプロセスを行います。

  2. ‘<protocol>_open()’ のようなメソッドでハンドラーが呼び出され、リク
     エストを処理します。このステージではハンドラーが非-*note None: 886.
     値 (例: レスポンス) か例外 (通常は *note URLError: 2c0.) を返した時
     点で終了します。例外は伝搬できます。

     実際には、上のアルゴリズムではまず *note default_open(): 3fe6. とい
     う名前のメソッドを呼び出します。このメソッドがすべて *note None:
     886. を返す場合、同じアルゴリズムを繰り返して、今度は
     ‘<protocol>_open()’ 形式のメソッドを試します。メソッドがすべて
     ‘None’ を返すと、さらに同じアルゴリズムを繰り返して *note
     unknown_open(): 3fe7. を呼び出します。

     これらのメソッドの実装には、親となる *note OpenerDirector: 3fbe. イ
     ンスタンスの ‘open()’ や ‘error()’ といったメソッド呼び出しが入る場
     合があるので注意してください。

  3. ‘<protocol>_response()’ 形式のメソッドを持つすべてのハンドラーに対
     してそのメソッドを呼び出し、リクエストのポストプロセスを行います。


File: python.info,  Node: BaseHandler オブジェクト,  Next: HTTPRedirectHandler オブジェクト,  Prev: OpenerDirector オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.3 BaseHandler オブジェクト
.................................

*note BaseHandler: 3fc1. オブジェクトは直接的に役に立つ 2 つのメソッドと
、その他として派生クラスで使われることを想定したメソッドを 提供します。
以下は直接的に使うためのメソッドです:

 -- メソッド: BaseHandler.add_parent (director)

     親オブジェクトとして、 ‘director’ を追加します。

 -- メソッド: BaseHandler.close ()

     全ての親オブジェクトを削除します。

以下の属性およびメソッドは *note BaseHandler: 3fc1. から派生したクラスで
のみ使われます。

     注釈: 慣習的に、 ‘<protocol>_request()’ や ‘<protocol>_response()’
     といったメソッドを定義している サブクラスは ‘*Processor`と名づけ、
     その他は :class:’!*Handler' と名づけることになっています

 -- の属性: BaseHandler.parent

     有効な *note OpenerDirector: 3fbe. です。この値は違うプロトコルを使
     って URL を開く場合やエラーを処理する際に使われます。

 -- メソッド: BaseHandler.default_open (req)

     このメソッドは *note BaseHandler: 3fc1. では定義されて 'いません' 。
     しかし、全ての URL をキャッチさせたいなら、サブクラスで定義する 必
     要があります。

     このメソッドが実装されていれば、*note OpenerDirector: 3fbe. の親ク
     ラスによって呼び出されます。これは ‘OpenerDirector’ の *note
     open(): 11e2. の戻り値で表されるファイルライクオブジェクトか、また
     は ‘None’ を返さなければならず、真に想定外の事態が発生した場合を除
     き、*note URLError: 2c0. を送出しなければなりません (例えば、*note
     MemoryError: 1772. は ‘URLError’ にマップしてはなりません)。

     このメソッドはプロトコル固有のオープンメソッドが呼び出される前に呼
     び出されます。

 -- メソッド: BaseHandler.<protocol>_open(req)

     このメソッドは *note BaseHandler: 3fc1. では定義されて 'いません' 。
     しかしプロトコルの URL をキャッチしたいなら、サブクラスで定義する必
     要があります。

     このメソッドが定義されていた場合、 *note OpenerDirector: 3fbe. から
     呼び出されます。戻り値は *note default_open(): 3fe6. と同じでなけれ
     ばなりません。

 -- メソッド: BaseHandler.unknown_open (req)

     このメソッドは *note BaseHandler: 3fc1. では定義されて 'いません' 。
     しかし URL を開くための特定のハンドラが登録されていないような URL を
     キャッチしたいなら、サブクラスで定義する必要があります。

     このメソッドが定義されていた場合、 *note parent: 3fec. *note
     OpenerDirector: 3fbe. から呼び出されます。戻り値は *note
     default_open(): 3fe6. と同じでなければなりません。

 -- メソッド: BaseHandler.http_error_default (req, fp, code, msg, hdrs)

     このメソッドは *note BaseHandler: 3fc1. では定義されて 'いません' 。
     しかしその他の処理されなかった HTTP エラーを処理する機能をもたせた
     いなら、サブクラスで定義する必要があります。このメソッドはエラーに
     遭遇した *note OpenerDirector: 3fbe. から自動的に呼び出されます。そ
     の他の状況では普通呼び出すべきではありません。

     *note OpenerDirector: 3fbe. will call this method with five
     positional arguments:

       1. *note Request: 11de. オブジェクト

       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(): 309. と同じもので
     なければなりません。

 -- メソッド: BaseHandler.http_error_<nnn>(req, fp, code, msg, hdrs)

     'nnn' は 3 桁の 10 進数からなる HTTP エラーコードでなくてはなりませ
     ん。このメソッドも *note BaseHandler: 3fc1. では定義されていません
     が、サブクラスのインスタンスで定義されていた場合、エラーコード
     'nnn' の HTTP エラーが発生した際に呼び出されます。

     特定の HTTP エラーに対する処理を行うためには、このメソッドをサブク
     ラスでオーバライドする必要があります。

     引数、返される値、および送出される例外は *note
     http_error_default(): 3fed. と同じものでなければなりません。

 -- メソッド: BaseHandler.<protocol>_request(req)

     このメソッドは *note BaseHandler: 3fc1. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのプリプロセスを行いたい
     場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     3fbe. から呼び出されます。その際、 'req' は *note Request: 11de. オ
     ブジェクトになります。戻り値は ‘Request’ オブジェクトでなければなり
     ません。

 -- メソッド: BaseHandler.<protocol>_response(req, response)

     このメソッドは *note BaseHandler: 3fc1. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのポストプロセスを行いた
     い場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     3fbe. から呼び出されます。その際、 'req' は *note Request: 11de. オ
     ブジェクトになります。 'response' は *note urlopen(): 309. の戻り値
     と同じインターフェースを 実装したオブジェクトになります。戻り値もま
     た、 ‘urlopen()’ の戻り値と同じインターフェースを実装したオブジェク
     トでなければなりません。


File: python.info,  Node: HTTPRedirectHandler オブジェクト,  Next: HTTPCookieProcessor オブジェクト,  Prev: BaseHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.4 HTTPRedirectHandler オブジェクト
.........................................

     注釈: 一部の HTTP リクエストはこのモジュールのクライアントモードか
     らの操作を要求します。その場合、*note HTTPError: 11e4. が送出されま
     す。さまざまなリダイレクションコードの正確な意味についての詳細は
     RFC 2616(1) を参照してください。

     セキュリティ上の配慮として、HTTPRedirectHandler に HTTP、HTTPS、あ
     るいは FTP の URL ではないリダイレクトされた URL が存在した場合、
     *note HTTPError: 11e4. 例外が送出されます。

 -- メソッド: HTTPRedirectHandler.redirect_request (req, fp, code, msg,
          hdrs, newurl)

     リダイレクトへのレスポンスの *note Request: 11de. または ‘None’ を
     返します。これはサーバーからリダイレクションを受信した時に
     ‘http_error_30*()’ メソッドのデフォルトの実装によって呼び出されます
     。リダイレクションを行わなければならない場合、'newurl' へのリダイレ
     クトを実行するための ‘http_error_30*()’ を許可する新しい ‘Request’
     を返します。その他の場合、この URL を扱うその他のハンドラーがない場
     合は *note HTTPError: 11e4. を、他のハンドラーでできそうな場合は
     ‘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: 3fbe. によって呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_302 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 3ff1. と同じですが、'found' レスポンスに対
     して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_303 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 3ff1. と同じですが、'see other' レスポンス
     に対して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_307 (req, fp, code, msg,
          hdrs)

     The same as *note http_error_301(): 3ff1, 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(): 3ff1, 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.23.4.5 HTTPCookieProcessor オブジェクト
.........................................

*note HTTPCookieProcessor: 3fc8. インスタンスは属性をひとつだけ持ちます:

 -- の属性: HTTPCookieProcessor.cookiejar

     Cookie の入っている *note http.cookiejar.CookieJar: 3ff9. オブジェ
     クトです。


File: python.info,  Node: ProxyHandler オブジェクト,  Next: HTTPPasswordMgr オブジェクト,  Prev: HTTPCookieProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.6 ProxyHandler オブジェクト
..................................

 -- メソッド: ProxyHandler.<protocol>_open(request)

     *note ProxyHandler: 1e11. は、コンストラクターで与えた辞書
     'proxies' にプロキシが設定されているような 'protocol' すべてについ
     て、メソッド ‘<protocol>_open()’ を持つことになります。このメソッド
     は ‘request.set_proxy()’ を呼び出して、リクエストがプロキシを通過で
     きるように修正します。その後連鎖するハンドラーの中から次のハンドラ
     ーを呼び出して実際にプロトコルを実行します。


File: python.info,  Node: HTTPPasswordMgr オブジェクト,  Next: HTTPPasswordMgrWithPriorAuth オブジェクト,  Prev: ProxyHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.7 HTTPPasswordMgr オブジェクト
.....................................

以下のメソッドは *note HTTPPasswordMgr: 3fc9. および *note
HTTPPasswordMgrWithDefaultRealm: 3fca. オブジェクトで利用できます。

 -- メソッド: 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: 3fca. オブジェクトでは、与え
     られた 'realm' に対して該当するユーザ名/パスワードが存在しない場合
     、レルム ‘None’ が検索されます。


File: python.info,  Node: HTTPPasswordMgrWithPriorAuth オブジェクト,  Next: AbstractBasicAuthHandler オブジェクト,  Prev: HTTPPasswordMgr オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.8 HTTPPasswordMgrWithPriorAuth オブジェクト
..................................................

このパスワードマネージャは *note HTTPPasswordMgrWithDefaultRealm: 3fca.
を継承して、認証の証明書を常に送らないといけない URI を追跡する機能をサ
ポートしています。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.add_password (realm, uri,
          user, passwd, is_authenticated=False)

     'realm', 'uri', 'user', 'passwd' は *note
     HTTPPasswordMgr.add_password(): 3ffd. のものと同じです。
     'is_authenticated' は、与えられた URI や URI のリストの
     ‘is_authenticated’ フラグの初期値に設定されます。
     'is_authenticated' に ‘True’ を指定した場合は、 'realm' は無視され
     ます。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.find_user_password (realm,
          authuri)

     *note HTTPPasswordMgrWithDefaultRealm: 3fca. オブジェクトに対する同
     名のメソッドと同じです。

 -- メソッド: 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.23.4.9 AbstractBasicAuthHandler オブジェクト
..............................................

 -- メソッド: AbstractBasicAuthHandler.http_error_auth_reqed (authreq,
          host, req, headers)

     ユーザ名／パスワードを取得し、再度サーバへのリクエストを試みること
     で、サーバからの認証リクエストを処理します。 'authreq' はリクエスト
     において レルムに関する情報が含まれているヘッダーの名前、 'host' は
     認証を行う対象の URL とパスを指定します、 'req' は (失敗した) *note
     Request: 11de. オブジェクト、そして 'headers' はエラーヘッダーでな
     くてはなりません。

     'host' is either an authority (e.g.  ‘"python.org"’) or a URL
     containing an authority component (e.g.  ‘"https://python.org/"’).
     In either case, the authority must not contain a userinfo component
     (so, ‘"python.org"’ and ‘"python.org:80"’ are fine,
     ‘"joe:password@python.org"’ is not).


File: python.info,  Node: HTTPBasicAuthHandler オブジェクト,  Next: ProxyBasicAuthHandler オブジェクト,  Prev: AbstractBasicAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.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.23.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.23.4.12 AbstractDigestAuthHandler オブジェクト
................................................

 -- メソッド: AbstractDigestAuthHandler.http_error_auth_reqed (authreq,
          host, req, headers)

     'authreq' はリクエストにおいてレルムに関する情報が含まれているヘッ
     ダーの名前、 'host' は認証を行う対象のホスト名、 'req' は (失敗した
     ) *note Request: 11de. オブジェクト、そして 'headers' はエラーヘッ
     ダーでなくてはなりません。


File: python.info,  Node: HTTPDigestAuthHandler オブジェクト,  Next: ProxyDigestAuthHandler オブジェクト,  Prev: AbstractDigestAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.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.23.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.23.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.23.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.23.4.17 FileHandler オブジェクト
..................................

 -- メソッド: FileHandler.file_open (req)

     ホスト名がない場合、またはホスト名が ‘'localhost'’ の場合にファイル
     をローカルでオープンします。

     バージョン 3.2 で変更: このメソッドはローカルのホスト名に対してのみ
     適用可能です。リモートホスト名が与えられた場合、*note URLError:
     2c0. が送出されます。


File: python.info,  Node: DataHandler オブジェクト,  Next: FTPHandler オブジェクト,  Prev: FileHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.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: 2ee. 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.23.4.19 FTPHandler オブジェクト
.................................

 -- メソッド: FTPHandler.ftp_open (req)

     'req' で表されるファイルを FTP 越しにオープンします。ログインは常に
     空のユーザネームおよびパスワードで行われます。


File: python.info,  Node: CacheFTPHandler オブジェクト,  Next: UnknownHandler オブジェクト,  Prev: FTPHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.20 CacheFTPHandler オブジェクト
......................................

*note CacheFTPHandler: 1afa. オブジェクトは *note FTPHandler: 3fc4. オブ
ジェクトに以下のメソッドを追加したものです:

 -- メソッド: CacheFTPHandler.setTimeout (t)

     接続のタイムアウトを 't' 秒に設定します。

 -- メソッド: CacheFTPHandler.setMaxConns (m)

     キャッシュ付き接続の最大接続数を 'm' に設定します。


File: python.info,  Node: UnknownHandler オブジェクト,  Next: HTTPErrorProcessor オブジェクト,  Prev: CacheFTPHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.21 UnknownHandler オブジェクト
.....................................

 -- メソッド: UnknownHandler.unknown_open ()

     *note URLError: 2c0. 例外を送出します。


File: python.info,  Node: HTTPErrorProcessor オブジェクト,  Next: 使用例<37>,  Prev: UnknownHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.22 HTTPErrorProcessor オブジェクト
.........................................

 -- メソッド: HTTPErrorProcessor.http_response (request, response)

     HTTP エラー応答の処理をします。

     エラーコード 200 の場合、レスポンスオブジェクトを即座に返します。

     200 以外のエラーコードの場合、これは単に ‘http_error_<type>()’ ハン
     ドラーメソッドに *note OpenerDirector.error(): 3fe5. 経由で処理を渡
     します。他にそのエラーを処理するハンドラーがない場合、*note
     HTTPDefaultErrorHandler: 3fc2. は最後に *note HTTPError: 11e4. を送
     出します。

 -- メソッド: HTTPErrorProcessor.https_response (request, response)

     HTTPS エラー応答の処理をします。

     振る舞いは *note http_response(): 402c. と同じです。


File: python.info,  Node: 使用例<37>,  Next: レガシーインターフェース<2>,  Prev: HTTPErrorProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.23 使用例
................

以下の例の他に *note urllib
パッケージを使ってインターネット上のリソースを取得するには: 4030. に多く
の例があります。

以下の例では、python.org のメインページを取得して、その最初の 300 バイト
分を表示します。

     >>> import urllib.request
     >>> with urllib.request.urlopen('https://www.python.org/') as f:
     ...     # The response may be compressed (for example, 'gzip').
     ...     print(f.headers.get('Content-Encoding'))
     ...     data = f.read()
     ...     if f.headers.get('Content-Encoding') == 'gzip':
     ...         import gzip
     ...         data = gzip.decompress(data)
     ...     print(data[:300].decode('utf-8', errors='replace'))

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('https://www.python.org/') as f:
     ...     # Check for compression and decode appropriately.
     ...     enc = f.headers.get('Content-Encoding')
     ...     data = f.read()
     ...     if enc == 'gzip':
     ...         import gzip
     ...         data = gzip.decompress(data)
     ...     print(data[:100].decode('utf-8', errors='replace'))
     ...

*note コンテキストマネージャー: 1e3. を使用しないアプローチでも同様の結
果を得ることができます。

     >>> import urllib.request
     >>> f = urllib.request.urlopen('https://www.python.org/')
     >>> try:
     ...     enc = f.headers.get('Content-Encoding')
     ...     data = f.read()
     ...     if enc == 'gzip':
     ...         import gzip
     ...         data = gzip.decompress(data)
     ...     print(data[:100].decode('utf-8', errors='replace'))
     ... finally:
     ...     f.close()

以下の例では、データストリームを 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: 11de. を使った ‘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(): 30b. はデフォルトで沢山のハンドラを提供しており、
その中に *note ProxyHandler: 1e11. があります。デフォルトでは、
‘ProxyHandler’ は ‘<scheme>_proxy’ という環境変数を使います。 ここで
‘<scheme>’ は URL スキームです。例えば、 HTTP プロキシの URL を得るには
、環境変数 ‘http_proxy’ を読み出します。

この例では、デフォルトの *note ProxyHandler: 1e11. を置き換えてプログラ
ム的に作成したプロキシ URL を使うようにし、 *note ProxyBasicAuthHandler:
3fce. でプロキシ認証サポートを追加します。

     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: 11de. コンストラクタを呼び出す方法
の他に、以下のようにできます:

     import urllib.request
     req = urllib.request.Request('http://www.example.com/')
     req.add_header('Referer', 'https://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: 3fbe. は全ての *note Request: 11de. に
‘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: 11de. が *note urlopen(): 309. (や *note
OpenerDirector.open(): 11e2.)に渡される際には、いくつかの標準ヘッダー
(‘Content-Length’, ‘Content-Type’ および ‘Host’) も追加されることを忘れ
ないでください。 以下は ‘GET’ メソッドを使ってパラメータを含む URL を取
得するセッションの例です:

     >>> import urllib.request
     >>> import urllib.parse
     >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
     >>> url = "https://www.python.org/?%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("https://httpbin.org/post", 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("https://www.python.org") as f:
     ...     f.read().decode('utf-8')
     ...

以下の例では、環境変数による設定内容に対して上書きする形で、まったくプロ
キシを使わないよう設定しています:

     >>> import urllib.request
     >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))
     >>> with opener.open("https://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.23.4.24 レガシーインターフェース
..................................

以下の関数およびクラスは、Python 2 のモジュール ‘urllib’ (‘urllib2’ では
ありません) から移植されたものです。これらは将来的に廃止されるかもしれま
せん。

 -- の関数: urllib.request.urlretrieve (url, filename=None,
          reporthook=None, data=None)

     URL で表されるネットワークオブジェクトをローカルファイルにコピーし
     ます。 URL がローカルファイルを示している場合は、ファイル名が与えら
     れない限りオブジェクトはコピーされません。戻り値はタプル
     ‘(filename, headers)’ になり、 'filename' はオブジェクトが保存され
     たローカルファイル名、 'headers' は (リモートオブジェクトに対しては
     ) *note urlopen(): 309. が返したオブジェクトの ‘info()’ メソッドが
     返すものすべてになります。例外は ‘urlopen()’ のものと同じになります
     。

     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('https://python.org/')
          >>> html = open(local_filename)
          >>> html.close()

     'url' が ‘http:’ スキーム識別子を使用していた場合、任意の引数
     'data' は ‘POST’ リクエストの指定に使用される場合があります (通常の
     リクエストタイプは ‘GET’ です)。引数 'data' は標準
     ‘application/x-www-form-urlencoded’ 形式のバイトオブジェクトでなけ
     ればなりません。 *note urllib.parse.urlencode(): 1099. 関数を参照し
     てください。

     *note urlretrieve(): 30a. は、予想 (これは 'Content-Length' ヘッダ
     ーにより通知されるサイズです) よりも取得できるデータ量が少ないこと
     を検知した場合、 *note ContentTooShortError: 4033. を発生します。こ
     れは、例えば、ダウンロードが中断された場合などに発生します。

     'Content-Length' はデータ量の下限です: 読み込むデータ量がこれを超え
     ている場合 urlretrieve はそれらも読み込みますが、利用できるデータが
     これを下回った場合、例外が送出されます。

     このような場合にもダウンロードされたデータを取得することは可能で、
     これは exception インスタンスの ‘content’ 属性に保存されています。

     'Content-Length' ヘッダーが与えられなれけば urlretrieve はダウンロ
     ードしたデータのサイズをチェックできません。この場合ダウンロードは
     正常に完了したとみなすしかありません。

 -- の関数: urllib.request.urlcleanup ()

     以前の *note urlretrieve(): 30a. 呼び出し後に残っているかもしれない
     一時ファイルをクリーンアップします。


File: python.info,  Node: urllib request Restrictions,  Prev: レガシーインターフェース<2>,  Up: urllib request --- URL を開くための大規模なライブラリ

5.23.4.25 ‘urllib.request’ Restrictions
.......................................

   * 現在、次のプロトコルのみサポートされています: HTTP (バージョン 0.9
     および 1.0)、FTP、ローカルファイル、およびデータ URL

     バージョン 3.4 で変更: データ URL サポートが追加されました。

   * *note urlretrieve(): 30a. のキャッシュ機能は、誰かが Expiration
     time ヘッダーの正しい処理をハックする時間を見つけるまで無効にされて
     います。

   * ある URL がキャッシュにあるかどうか調べるような関数があればと思って
     います。

   * 後方互換性のため、 URL がローカルシステム上のファイルを指しているよ
     うに見えるにも関わらずファイルを開くことができなければ、 URL は FTP
     プロトコルを使って再解釈されます。この機能は時として混乱を招くエラ
     ーメッセージを引き起こします。

   * 関数 *note urlopen(): 309. および *note urlretrieve(): 30a. は、ネ
     ットワーク接続が確立されるまでの間、一定でない長さの遅延を引き起こ
     すことがあります。このことは、これらの関数を使ってインタラクティブ
     な Web クライアントを構築するのはスレッドなしには難しいことを意味し
     ます。

   * *note urlopen(): 309. あるいは *note urlretrieve(): 30a. が返すデー
     タはサーバーから返された生データです。これは (画像のような) バイナ
     リ、プレーンテキスト、あるいは (例えば) 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.23.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: 3fbc. 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: 194a. を
          使用してください。

      -- メソッド: info ()

          バージョン 3.9 で非推奨: 非推奨となったので *note headers:
          4036. を使用してください。

      -- の属性: code

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          4037. を使用してください。

      -- メソッド: getcode ()

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          4037. を使用してください。


File: python.info,  Node: urllib parse --- URL を構成要素に解析する,  Next: urllib error --- urllib request によって送出される例外クラス,  Prev: urllib response --- Response classes used by urllib,  Up: インターネットプロトコルとサポート

5.23.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: 19f6. 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.23.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: 4040. or *note SplitResultBytes:
     4041.  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='')

     The 'scheme' argument gives the default addressing scheme, to be
     used only if the URL does not specify one.  It should be the same
     type (text or bytes) as 'urlstring', except that the default value
     ‘''’ is always allowed, and is automatically converted to ‘b''’ if
     appropriate.

     If the 'allow_fragments' argument is false, fragment identifiers
     are not recognized.  Instead, they are parsed as part of the path,
     parameters or query component, and ‘fragment’ is set to the empty
     string in the return value.

     戻り値は *note 名前付きタプル: 85e. です。これは、インデックス指定
     もしくは以下のような名前属性で要素にアクセスできることを意味します:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     ----------------------------------------------------------------------------------------------
                                                                      
     ‘scheme’               0           URL スキーム                  'scheme' parameter
                                                                      
                                                                      
     ‘netloc’               1           ネットワーク上の位置          空文字列
                                                                      
                                                                      
     ‘path’                 2           階層的パス                    空文字列
                                                                      
                                                                      
     ‘query’                3           クエリ要素                    空文字列
                                                                      
                                                                      
     ‘fragment’             4           フラグメント識別子            空文字列
                                                                      
                                                                      
     ‘username’                         ユーザ名                      *note None: 886.
                                                                      
                                                                      
     ‘password’                         パスワード                    *note None: 886.
                                                                      
                                                                      
     ‘hostname’                         ホスト名 (小文字)             *note None: 886.
                                                                      
                                                                      
     ‘port’                             ポート番号を表わす整数 (も    *note None: 886.
                                        しあれば)                     
                                        

     URL中で不正なポートが指定されている場合、 ‘port’ 属性を読みだすと、
     *note ValueError: 2ee. を送出します。結果オブジェクトのより詳しい情
     報は *note 構造化された解析結果: 4042. 節を参照してください。

     ‘netloc’ 属性にマッチしなかった角括弧があると *note ValueError:
     2ee. を送出します。

     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: 2ee.  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: 4040. 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='')

          警告: ‘urlsplit()’ does not perform validation.  See *note URL
          parsing security: 4043. 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 で変更: Out-of-range port numbers now raise *note
     ValueError: 2ee, instead of returning *note None: 886.

     バージョン 3.8 で変更: Characters that affect netloc parsing under
     NFKC normalization will now raise *note ValueError: 2ee.

     バージョン 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: 2ee. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): ad7. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 2ee. 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(): 1099. 関数を (‘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: 2ee. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): ad7. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 2ee. 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(): 1099. 関数を使用します。

     バージョン 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(): f3e, but additionally splits
     the 'path' component on 'path' and 'params'.  This function returns
     a 6-item *note named tuple: 85e. *note ParseResult: 4044. or *note
     ParseResultBytes: 4045.  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():
     f3e. should generally be used instead of ‘urlparse()’.  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():
     360. 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(): f3e.

          注釈: '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(): f3e. と *note urlunsplit(): 199e. で先に処理して、
          '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)

     If 'url' contains a fragment identifier, return a modified version
     of 'url' with no fragment identifier, and the fragment identifier
     as a separate string.  If there is no fragment identifier in 'url',
     return 'url' unmodified and an empty string.

     戻り値は *note 名前付きタプル: 85e. で、インデックスによってもしく
     は名前属性として要素にアクセスできます:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     --------------------------------------------------------------------------------------------
                                                                      
     ‘url’                  0           フラグメントのない URL        空文字列
                                                                      
                                                                      
     ‘fragment’             1           フラグメント識別子            空文字列
                                                                      

     結果オブジェクトのより詳しい情報は *note 構造化された解析結果:
     4042. 節を参照してください。

     バージョン 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.23.6.2 URL parsing security
.............................

The *note urlsplit(): f3e. and *note urlparse(): 360. 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.23.6.3 ASCII エンコードバイト列の解析
.......................................

URL を解析する関数は元々文字列のみ操作するよう設計されていました。実際の
ところ、それは URL が正しくクオートされエンコードされた ASCII バイト列を
操作できた方が有用でした。結果的にこのモジュールの URL 解析関数はすべて
*note bytes: 193. および *note bytearray: 342. オブジェクトに加えて
*note str: 16a. オブジェクトでも処理するようになりました。

*note str: 16a. データが渡された場合、戻り値は ‘str’ データのみを含んだ
ものになります。*note bytes: 193. あるいは *note bytearray: 342. が渡さ
れた場合、戻り値は ‘bytes’ データのみを含んだものになります。

単一の関数を呼び出す時に *note bytes: 193. または *note bytearray: 342.
が混在した *note str: 16a. を渡した場合、*note TypeError: 199. が、非
ASCII バイト値が渡された場合 *note UnicodeDecodeError: c0c. が送出されま
す。

*note str: 16a. と *note bytes: 193. 間で容易に変換を行えるよう、すべて
の URL 解析関数は ‘encode()’ メソッド (結果に ‘str’ データが含まれる時用
) か ‘decode()’ メソッド (結果に ‘bytes’ データが含まれる時用) のどちら
かを提供しています。これらメソッドの動作は対応する ‘str’ と ‘bytes’ メソ
ッドが持つものと同じです (ただしデフォルトのエンコーディングは ‘'utf-8'’
ではなく ‘'ascii'’ になります)。それぞれは ‘encode()’ メソッドを持つ
‘bytes’ データか ‘decode()’ メソッドを持つ ‘str’ データのどちらかに対応
した型を生成します。

非 ASCII データを含むなど、不適切にクオートされた URL を操作する可能性の
あるアプリケーションでは、URL 解析メソッドを呼び出す前に独自にバイト列か
ら文字列にデコードする必要があります。

この項で説明された挙動は URL 解析関数にのみ該当します。URL クオート関数
でバイトシーケンスを生成もしくは消化する際には、別にURL クオート関数の項
で詳説されている通りのルールに従います。

バージョン 3.2 で変更: URL 解析関数は ASCII エンコードバイトシーケンスも
受け付けるようになりました


File: python.info,  Node: 構造化された解析結果,  Next: URL のクオート,  Prev: ASCII エンコードバイト列の解析,  Up: urllib parse --- URL を構成要素に解析する

5.23.6.4 構造化された解析結果
.............................

The result objects from the *note urlsplit(): f3e, *note urlparse():
360. and *note urldefrag(): 1463. 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 ()

     Return the re-combined version of the original URL as a string.
     This may differ from the original URL in that the scheme may be
     normalized to lower case and empty components may be dropped.
     Specifically, empty parameters, queries, and fragment identifiers
     will be removed.

     *note urldefrag(): 1463. の戻り値では、空のフラグメント識別子のみ削
     除されます。*note urlsplit(): f3e. および *note urlparse(): 360. の
     戻り値では、このメソッドが返す 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: 16a. オブジェクトを操作した場合、構造化された
解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResult (url, fragment)

     *note urldefrag(): 1463. の具象クラスの結果には *note str: 16a. デ
     ータが含まれます。‘encode()’ メソッドは *note DefragResultBytes:
     404c. インスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResult (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 360. の具象クラスの結果には *note str: 16a. デー
     タが含まれます。‘encode()’ メソッドは *note ParseResultBytes: 4045.
     インスタンスを返します。

 -- クラス: urllib.parse.SplitResult (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): f3e. の具象クラスの結果には *note str: 16a. デー
     タが含まれます。‘encode()’ メソッドは *note SplitResultBytes: 4041.
     インスタンスを返します。

以下のクラスは *note bytes: 193. または *note bytearray: 342. オブジェク
トを操作した時に解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResultBytes (url, fragment)

     *note urldefrag(): 1463. の具象クラスの結果には *note bytes: 193. デ
     ータが含まれます。‘decode()’ メソッドは *note DefragResult: 404b. イ
     ンスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResultBytes (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 360. の具象クラスの結果には *note bytes: 193. が
     含まれます。‘decode()’ メソッドは *note ParseResult: 4044. インスタ
     ンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.SplitResultBytes (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): f3e. の具象クラスの結果には *note bytes: 193. デ
     ータが含まれます。‘decode()’ メソッドは *note SplitResult: 4040. イ
     ンスタンスを返します。

     Added in version 3.2.


File: python.info,  Node: URL のクオート,  Prev: 構造化された解析結果,  Up: urllib parse --- URL を構成要素に解析する

5.23.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: 16a. か *note bytes: 193. オブ
     ジェクトです。

     バージョン 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(): ad6.
     で受け付けられる非 ASCII 文字への対処法を指定します。'encoding' の
     デフォルトは ‘'utf-8'’、'errors' のデフォルトは ‘'strict'’ で、非サ
     ポート文字があると *note UnicodeEncodeError: 888. を送出します。
     'string' が *note bytes: 193. の場合 'encoding' と 'errors' を指定
     してはいけません。指定すると *note TypeError: 199. が送出されます。

     ‘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(): da0, 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(): da0. と似ていますが、*note str: 16a. ではなく *note
     bytes: 193. オブジェクトを取り、文字列からバイト列へのエンコードを
     行いません。

     例: ‘quote_from_bytes(b'a&\xef')’ は ‘'a%26%EF'’ を返します。

 -- の関数: urllib.parse.unquote (string, encoding='utf-8',
          errors='replace')

     エスケープされた ‘%XX’ をそれに対応した単一文字に置き換えます。オプ
     ション引数の 'encoding' と 'errors' は *note bytes.decode(): ad7. メ
     ソッドで受け付けられるパーセントエンコードされたシーケンスから
     Unicode 文字へのデコード法を指定します。

     'string' に使用できるのは *note str: 16a. か *note bytes: 193. オブ
     ジェクトです。

     '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(): 1b59. と似ていますが、HTML フォームの値のアンクオ
     ートのために「+」を空白に置き換えます。

     'string' は *note str: 16a. でなければなりません。

     例: ‘unquote_plus('/El+Ni%C3%B1o/')’ は ‘'/El Niño/'’ を返します。

 -- の関数: urllib.parse.unquote_to_bytes (string)

     スケープされた ‘%XX’ をそれに対応した 1 オクテットに置き換え、*note
     bytes: 193. オブジェクトを返します。

     'string' に使用できるのは *note str: 16a. か *note bytes: 193. オブ
     ジェクトです。

     *note str: 16a. だった場合、'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: 16a. か *note bytes: 193. オブジェクトが含まれているか
     もしれません) を、パーセントエンコードされた ASCII 文字列に変換しま
     す。戻り値の文字列が *note urlopen(): 309. 関数での POST 操作の
     'data' で使用される場合はバイト列にエンコードしなければなりません。
     そうでない場合は *note TypeError: 199. が送出されます。

     戻り値は ‘'&'’ 文字で区切られた ‘key=value’ のペアからなる一組の文
     字列になります。 'key' と 'value' は 'quote_via' を使用してクオート
     されます。デフォルトで、値をクォートするために *note quote_plus():
     1464. が使用されます。つまり、スペースは ‘'+'’ 文字に、 '/' 文字は
     ‘%2F’ にクォートされます。これは GET リクエストの標準に準拠します
     (‘application/x-www-form-urlencoded’)。 'quote_via' として渡すこと
     ができる別の関数は *note quote(): da0. です。それはスペースを ‘%20’
     にエンコードし、 '/' をエンコードしません。何がクォートされるかを最
     大限コントロールしたければ、 ‘quote’ を使って 'safe' に値を指定して
     ください。

     引数 'query' が 2 要素のタプルのシーケンスの場合、各タプルの第一要
     素はキーに、第二要素は値になります。 値となる要素はシーケンスを取る
     こともでき、この場合、オプションのパラメーター 'doseq' が ‘True’ と
     評価されるのであれば、キーに対し値シーケンスの各要素を個別に結び付
     けた ‘key=value’ のペアを、 ‘'&'’ 文字でつないだものを生成します。
     エンコードされた文字列内のパラメーターの順序はシーケンス内のパラメ
     ータータプルの順序と一致します。

     'safe', 'encoding', および 'errors' パラメータは 'quote_via' にその
     まま渡されます (クエリ要素が *note str: 16a. の場合は、 'encoding'
     と 'errors' パラメータだけが渡されます)。

     このエンコード処理の逆を行うには、このモジュールで提供されている
     *note parse_qs(): 321. と *note parse_qsl(): 320. を使用して、クエ
     リ文字列を Python データ構造に変換できます。

     POST リクエストのデータ、あるいは URL クエリ文字列を生成するために
     、 *note urllib.parse.urlencode(): 1099. メソッドをどのように使えば
     よいかを見るには、*note urllib の使用例: 4031. を参照してください。

     バージョン 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.23.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: 112.  The base exception class is *note
URLError: 2c0.

The following exceptions are raised by ‘urllib.error’ as appropriate:

 -- 例外: urllib.error.URLError

     ハンドラが何らかの問題に遭遇した場合、この例外 (またはこの例外から
     派生した例外)を送出します。この例外は *note OSError: 2c2. のサブク
     ラスです。

      -- の属性: reason

          このエラーの理由。メッセージ文字列あるいは他の例外インスタンス
          です。

     バージョン 3.3 で変更: *note URLError: 2c0. は以前は *note IOError:
     1262. のサブタイプでしたが、 *note OSError: 2c2. のエイリアスになり
     ました。

 -- 例外: urllib.error.HTTPError (url, code, msg, hdrs, fp)

     *note HTTPError: 11e4. は例外 (*note URLError: 2c0. のサブクラス) で
     すが、同時に例外ではない file-like な戻り値を返す関数でもあります
     (*note urlopen(): 309. の戻り値と同じです)。これは、例えばサーバか
     らの認証リクエストのように、変わった HTTP エラーを処理するのに役立
     ちます。

      -- の属性: url

          リクエスト URL を含みます。 'filename' 属性のエイリアスです。

      -- の属性: code

          RFC 2616(2) に定義されているHTTPステータスコード。 この数値型
          の値は、 *note http.server.BaseHTTPRequestHandler.responses:
          4055. の辞書に登録されているコードに対応します。

      -- の属性: reason

          これは通常、このエラーの原因を説明する文字列です。 'msg' 属性
          のエイリアスです。

      -- の属性: headers

          *note HTTPError: 11e4. の原因となった HTTP リクエストの HTTP レ
          スポンスヘッダ。 'hdrs' 属性のエイリアスです。

          Added in version 3.4.

      -- の属性: fp

          HTTP エラーの body を読み出し可能なファイルライクオブジェクト
          。

 -- 例外: urllib.error.ContentTooShortError (msg, content)

     この例外は *note urlretrieve(): 30a. 関数が、ダウンロードされたデー
     タの量が予期した量 ('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.23.8 ‘urllib.robotparser’ -- robots.txt 用のパーサー
------------------------------------------------------

'ソースコード:' Lib/urllib/robotparser.py(1)

__________________________________________________________________

This module provides a single class, *note RobotFileParser: efe, 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 RFC 9309(2).

 -- クラス: 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():
          24f. の形式で返します。そのようなパラメーターが存在しないか、
          ‘robots.txt’ のこのパラメーターのエントリの構文が無効な場合は
          、 ‘None’ を返します。

          Added in version 3.8.

以下に *note RobotFileParser: efe. クラスの利用例を示します。

     >>> 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

   (2) https://datatracker.ietf.org/doc/html/rfc9309.html


File: python.info,  Node: http --- HTTP モジュール群,  Next: http client --- HTTP プロトコルクライアント,  Prev: urllib robotparser --- robots txt 用のパーサー,  Up: インターネットプロトコルとサポート

5.23.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: 112. を使ってくだ
     さい

   * *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: edf. のサブクラスです。

     使い方:

          >>> 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.23.9.1 HTTP ステータスコード
..............................

*note http.HTTPStatus: b00. で利用可能な、サポートされている、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.23.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.23.9.3 HTTP メソッド
......................

*note http.HTTPMethod: 4068. で利用可能な、サポートされている、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.23.10 ‘http.client’ -- HTTP プロトコルクライアント
----------------------------------------------------

'ソースコード:' Lib/http/client.py(1)

__________________________________________________________________

このモジュールでは HTTP および HTTPS プロトコルのクライアントサイドを実
装しているクラスを定義しています。通常、このモジュールは直接使いません
-- *note urllib.request: 112. モジュールが HTTP や HTTPS を使った URL を
扱う上でこのモジュールを使います。

参考
....

より高水準の HTTP クライアントインターフェースとして Requests パッケージ
(2) が推奨されています。

     注釈: HTTPS のサポートは、Python が SSL サポート付きでコンパイルさ
     れている場合にのみ利用できます (*note ssl: d5. モジュールによって
     )。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

このモジュールでは以下のクラスを提供しています:

 -- クラス: http.client.HTTPConnection (host, port=None[, timeout],
          source_address=None, blocksize=8192)

     An ‘HTTPConnection’ instance represents one transaction with an
     HTTP server.  It should be instantiated by passing it a host and
     optional port number.  If no port number is passed, the port is
     extracted from the host string if it has the form ‘host:port’, else
     the default HTTP port (80) is used.  If the optional 'timeout'
     parameter is given, blocking operations (like connection attempts)
     will timeout after that many seconds (if it is not given, the
     global default timeout setting is used).  The optional
     'source_address' parameter may be a tuple of a (host, port) to use
     as the source address the HTTP connection is made from.  The
     optional 'blocksize' parameter sets the buffer size in bytes for
     sending a file-like message body.

     例えば、以下の呼び出しは全て同じサーバの同じポートに接続するインス
     タンスを生成します:

          >>> 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: d39. のサブクラスはセキュア・サーバとやりとり
     する為の SSL を使う場合に用います。デフォルトのポート番号は ‘443’ で
     す。'context' が指定されれば、それは様々な SSL オプションを記述する
     *note ssl.SSLContext: 355. インスタンスでなければなりません。

     ベストプラクティスに関するより良い情報が *note
     セキュリティで考慮すべき点: 3931. にありますのでお読みください。

     バージョン 3.2 で変更: 'source_address'、'context' そして
     'check_hostname' が追加されました。

     バージョン 3.2 で変更: このクラスは現在、可能であれば (つまり *note
     ssl.HAS_SNI: 3a7f. が真の場合) 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: c2a. 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(): 1068.

     バージョン 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: 8a4.
     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:
     406e. that holds the header fields, but no payload (the same as
     *note HTTPResponse.msg: 406f. and *note
     http.server.BaseHTTPRequestHandler.headers: 4070.).  After
     returning, the file pointer 'fp' is ready to read the HTTP body.

          注釈: ‘parse_headers()’ 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: bd1. のサブクラスです。

 -- 例外: http.client.NotConnected

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.InvalidURL

     *note HTTPException: 4071. のサブクラスです。ポート番号を指定したも
     のの、その値が数字でなかったり空のオブジェクトであった場合に送出さ
     れます。

 -- 例外: http.client.UnknownProtocol

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.UnknownTransferEncoding

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.UnimplementedFileMode

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.IncompleteRead

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.ImproperConnectionState

     *note HTTPException: 4071. サブクラスです。

 -- 例外: http.client.CannotSendRequest

     *note ImproperConnectionState: 4078. のサブクラスです。

 -- 例外: http.client.CannotSendHeader

     *note ImproperConnectionState: 4078. のサブクラスです。

 -- 例外: http.client.ResponseNotReady

     *note ImproperConnectionState: 4078. のサブクラスです。

 -- 例外: http.client.BadStatusLine

     *note HTTPException: 4071. のサブクラスです。サーバが理解できない
     HTTP 状態コードで応答した場合に送出されます。

 -- 例外: http.client.LineTooLong

     A subclass of *note HTTPException: 4071.  Raised if an excessively
     long line is received in the HTTP protocol from the server.

 -- 例外: http.client.RemoteDisconnected

     A subclass of *note ConnectionResetError: 126e. and *note
     BadStatusLine: 407c.  Raised by *note HTTPConnection.getresponse():
     100d. 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: 407c.‘('')’
     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 ステータスコード: 4065. 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.23.10.1 HTTPConnection オブジェクト
.....................................

*note HTTPConnection: d39. インスタンスには以下のメソッドがあります:

 -- メソッド: 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: 16a, a *note
     bytes-like object: 194, an open *note file object: 13df, or an
     iterable of *note bytes: 193.  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 file object, 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: 8a5, 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: 13df, 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: 16a. 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(): 4083. if *note getresponse(): 100d. raised an
          non-*note ConnectionError: 100f. 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: 12e9. インスタ
     ンスを返します。

     バージョン 3.5 で変更: If a *note ConnectionError: 100f. or
     subclass is raised, the *note HTTPConnection: d39. object will be
     ready to reconnect when a new request is sent.

     Note that this does not apply to *note OSError: 2c2.s raised by the
     underlying socket.  Instead the caller is responsible to call *note
     close(): 4083. 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: 12e9.
     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: d3a. constructor, and the address of the host that
     we eventually want to reach to the ‘set_tunnel()’ 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: 1ccb. ‘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(): eab. 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: 262. the encoding will result in a single chunk.  If
     'message_body' is a *note collections.abc.Iterable: 2707, each
     iteration of 'message_body' will result in a chunk.  If
     'message_body' is a *note file object: 13df, 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(): eac. が
     呼び出された直後で、かつ *note getresponse(): 100d. が呼び出される
     前に使わなければなりません。

     Raises an *note auditing event: 1ccb. ‘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.23.10.2 HTTPResponse オブジェクト
...................................

*note HTTPResponse: 12e9. インスタンスはサーバからのHTTPレスポンスをラッ
プします。これを使用してリクエストヘッダとエンティティボディへアクセスす
ることができます。レスポンスはイテレート可能なオブジェクトであり、また
with文と使うことも可能です。

バージョン 3.5 で変更: The *note io.BufferedIOBase: 8a4. 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: 406e. instance containing the
     response headers.  ‘http.client.HTTPMessage’ 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: 4093. 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: 4090. を使用
     してください。

 -- メソッド: HTTPResponse.info ()

     バージョン 3.9 で非推奨: 非推奨となったので *note headers: 4091. を
     使用してください。

 -- メソッド: HTTPResponse.getcode ()

     バージョン 3.9 で非推奨: 非推奨となったので *note status: 4092. を
     使用してください。


File: python.info,  Node: 使用例<38>,  Next: HTTPMessage オブジェクト,  Prev: HTTPResponse オブジェクト,  Up: http client --- HTTP プロトコルクライアント

5.23.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: 11de. 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.23.10.4 HTTPMessage オブジェクト
..................................

 -- クラス: http.client.HTTPMessage (email.message.Message)

*note http.client.HTTPMessage: 406e. のインスタンスは HTTP レスポンスヘ
ッダを格納します。 *note email.message.Message: 581. クラスを利用して実
装されています。


File: python.info,  Node: ftplib --- FTP プロトコルクライアント,  Next: poplib --- POP3 プロトコルクライアント,  Prev: http client --- HTTP プロトコルクライアント,  Up: インターネットプロトコルとサポート

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

'ソースコード:' Lib/ftplib.py(1)

__________________________________________________________________

このモジュールでは *note FTP: afa. クラスと、それに関連するいくつかの項
目を定義しています。 ‘FTP’ クラスは、FTPプロトコルのクライアント側の機能
を備えています。このクラスを使うとFTPのいろいろな機能の自動化、例えば他
のFTPサーバのミラーリングといったことを実行するPythonプログラムを書くこ
とができます。また、 *note urllib.request: 112. モジュールもFTPを使う
URLを操作するのにこのクラスを使っています。 FTP (File Transfer
Protocol)についての詳しい情報はinternet RFC 959(2) を参照して下さい。

The default encoding is UTF-8, following RFC 2640(3).

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

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.23.11.1 リファレンス
......................

* Menu:

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


File: python.info,  Node: FTP オブジェクト,  Next: FTP_TLS オブジェクト,  Up: リファレンス<7>

5.23.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: afa. class.


     パラメータ:

        * ‘host’ (*note str: 16a.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 16a.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 16a.) - 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: 16a.) - Account information to be used for
          the ‘ACCT’ FTP command.  Few systems implement this.  See
          RFC-959(1) for more details.

        * ‘timeout’ (*note float: 197.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 40a2.
          (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: 16a.) - The encoding for directories
          and filenames (default: ‘'utf-8'’).

     *note FTP: afa. クラスは *note with: 187. 文をサポートしています。
     例えば:

          >>> 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: 187. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' 引数が追加されました。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 2ee. 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: afa. インスタンスには以下のメソッドがあります:

      -- メソッド: set_debuglevel (level)

          Set the instance's debugging level as an *note int: 19c.  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: afa. instance
          was created.  All other ‘FTP’ methods can only be called after
          a connection has successfully been made.


          パラメータ:

             * ‘host’ (*note str: 16a.) - The host to connect to.

             * ‘port’ (*note int: 19c.) - 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: 197.‘ | ’‘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 監査イベント:
          1ccb. ‘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: afa. instance
          was created.  Most FTP commands are only allowed after the
          client has logged in.


          パラメータ:

             * ‘user’ (*note str: 16a.) - The username to log in with
               (default: ‘'anonymous'’).

             * ‘passwd’ (*note str: 16a.) - 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: 16a.) - 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 監査イベント: 1ccb.
          ‘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: 40a9. otherwise.

          引数 ‘self’, ‘cmd’ を指定して *note 監査イベント: 1ccb.
          ‘ftplib.sendcmd’ を送出します。

      -- メソッド: retrbinary (cmd, callback, blocksize=8192, rest=None)

          Retrieve a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 16a.) - An appropriate ‘RETR’ command:
               ‘"RETR FILENAME"’.

             * ‘callback’ (*note callable: 2df7.) - A single parameter
               callable that is called for each block of data received,
               with its single argument being the data as *note bytes:
               193.

             * ‘blocksize’ (*note int: 19c.) - The maximum chunk size to
               read on the low-level *note socket: fa5. 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: 19c.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 40ab. 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():
          40aa.) 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: cd1.

      -- メソッド: set_pasv (val)

          'val' が真の場合 "パッシブ" モードを有効化し、偽の場合は無効化
          します。 デフォルトではパッシブモードです。

      -- メソッド: storbinary (cmd, fp, blocksize=8192, callback=None,
               rest=None)

          Store a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 16a.) - An appropriate ‘STOR’ command:
               ‘"STOR FILENAME"’.

             * ‘fp’ (*note file object: 13df.) - A file object (opened
               in binary mode) which is read until EOF, using its *note
               read(): 1021. method in blocks of size 'blocksize' to
               provide the data to be stored.

             * ‘blocksize’ (*note int: 19c.) - The read block size.
               Defaults to ‘8192’.

             * ‘callback’ (*note callable: 2df7.) - A single parameter
               callable that is called for each block of data sent, with
               its single argument being the data as *note bytes: 193.

             * ‘rest’ (*note int: 19c.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 40ab. 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(): 1525.).  Lines are
          read until EOF from the *note file object: 13df. 'fp' (opened
          in binary mode) using its *note readline(): 1545. 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
          ‘transfercmd()’ 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: 40a9.
          exception will be raised.  If this happens, simply call
          ‘transfercmd()’ without a 'rest' argument.

      -- メソッド: ntransfercmd (cmd, rest=None)

          *note transfercmd(): 40ab. と同様ですが、データと予想されるサ
          イズとのタプルを返します。もしサイズが計算できないなら、サイズ
          の代わりに ‘None’ が返されます。 'cmd' と 'rest' は
          ‘transfercmd()’ のものと同じです。

      -- メソッド: 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():
               12dd. 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(): 40ac.;
          the default prints to *note sys.stdout: cd1.  This method
          returns ‘None’.

               注釈: If your server supports the command, *note mlsd():
               12dd. offers a better API.

      -- メソッド: rename (fromname, toname)

          サーバ上のファイルのファイル名 'fromname' を 'toname' へ変更し
          ます。

      -- メソッド: delete (filename)

          サーバからファイル 'filename' を削除します。成功したら応答のテ
          キストを返し、そうでないならパーミッションエラーでは *note
          error_perm: 40b2. を、他のエラーでは *note error_reply: 40a9.
          を返します。

      -- メソッド: cwd (pathname)

          サーバのカレントディレクトリを設定します。

      -- メソッド: mkd (pathname)

          サーバ上に新たにディレクトリを作ります。

      -- メソッド: pwd ()

          サーバ上のカレントディレクトリのパスを返します。

      -- メソッド: rmd (dirname)

          サーバ上のディレクトリ 'dirname' を削除します。

      -- メソッド: size (filename)

          サーバ上のファイル 'filename' のサイズを尋ねます。成功したらフ
          ァイルサイズが整数で返され、そうでないなら ‘None’ が返されます
          。 ‘SIZE’ コマンドは標準化されていませんが、多くの普通のサーバ
          で実装されていることに注意して下さい。

      -- メソッド: quit ()

          サーバに ‘QUIT’ コマンドを送信し、接続を閉じます。これは接続を
          閉じるのに"礼儀正しい"方法ですが、 ‘QUIT’ コマンドに反応してサ
          ーバの例外が発生するかもしれません。この例外は、 *note
          close(): 40b9. メソッドによって *note FTP: afa. インスタンスに
          対するその後のコマンド使用が不可になっていることを示しています
          （下記参照）。

      -- メソッド: close ()

          接続を一方的に閉じます。既に閉じた接続に対して実行すべきではあ
          りません（例えば *note quit(): 40b8. を呼び出して成功した後な
          ど）。この実行の後、 *note FTP: afa. インスタンスはもう使用す
          べきではありません（ *note close(): 40b9. あるいは ‘quit()’ を
          呼び出した後で、 *note login(): 40a5. メソッドをもう一度実行し
          て再び接続を開くことはできません）。

   ---------- 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.23.11.3 FTP_TLS オブジェクト
..............................

 -- クラス: ftplib.FTP_TLS (host='', user='', passwd='', acct='', *,
          context=None, timeout=None, source_address=None,
          encoding='utf-8')

     An *note FTP: afa. 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(): 40bb. method.


     パラメータ:

        * ‘host’ (*note str: 16a.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 16a.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 16a.) - 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: 16a.) - 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: 355.) - An SSL context object
          which allows bundling SSL configuration options, certificates
          and private keys into a single, potentially long-lived,
          structure.  Please read *note セキュリティで考慮すべき点:
          3931. for best practices.

        * ‘timeout’ (*note float: 197.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 40a2.
          (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: 16a.) - 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: 3a6d. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3a7f. を
     参照してください)。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 2ee. 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: afb. クラスを使ったサンプルセッションはこちらです:

          >>> 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: afa, defining these
     additional methods and attributes:

      -- の属性: ssl_version

          The SSL version to use (defaults to *note ssl.PROTOCOL_SSLv23:
          3a71.).

      -- メソッド: auth ()

          Set up a secure control connection by using TLS or SSL,
          depending on what is specified in the *note ssl_version: 40bc.
          attribute.

          バージョン 3.4 で変更: The method now supports hostname check
          with *note ssl.SSLContext.check_hostname: 3a6d. and 'Server
          Name Indication' (see *note ssl.HAS_SNI: 3a7f.).

      -- メソッド: 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 ()

          Set up secure data connection.

      -- メソッド: 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.23.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: afa. インスタンスのメソッド実行時、FTP接続で (プログラミ
     ングのエラーと考えられるメソッドの実行によって) 発生する全ての例外
     (タプル形式)。この例外には以上の４つのエラーはもちろん、 *note
     OSError: 2c2. と *note EOFError: 14f5. も含まれます。

参考
....

*note netrc: 9f. モジュール

     ‘.netrc’ ファイルフォーマットのパーザ。 ‘.netrc’ ファイルは、 FTPク
     ライアントがユーザにプロンプトを出す前に、ユーザ認証情報をロードす
     るのによく使われます。


File: python.info,  Node: poplib --- POP3 プロトコルクライアント,  Next: imaplib --- IMAP4 プロトコルクライアント,  Prev: ftplib --- FTP プロトコルクライアント,  Up: インターネットプロトコルとサポート

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

'ソースコード:' Lib/poplib.py(1)

__________________________________________________________________

このモジュールはクラス *note POP3: b21. を定義しています。 ‘POP3’ はPOP3
サーバへの接続をカプセル化し、 RFC 1939(2) で定義されているプロトコルを
実装しています。 ‘POP3’ クラスは RFC 1939(3) の最小限のコマンドセットと
オプションのコマンドセットをサポートしています。 既に確立されている接続
で暗号化された通信を行うために、 RFC 2595(4) で導入された ‘STLS’ コマン
ドもサポートされています。

加えて、このモジュールはクラス *note POP3_SSL: b22. を提供しています。
‘POP3_SSL’ は SSL を下層のプロトコルレイヤーとして使う POP3 サーバへの接
続をサポートしています。

POP3についての注意事項は、それが広くサポートされているにもかかわらず、既
に時代遅れだということです。幾つも実装されているPOP3サーバーの品質は、貧
弱なものが多数を占めています。もし、お使いのメールサーバーがIMAPをサポー
トしているなら、 *note imaplib.IMAP4: b03. クラスが使えます。 IMAPサーバ
ーは、より良く実装されている傾向があります。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

The ‘poplib’ module provides two classes:

 -- クラス: poplib.POP3 (host, port=POP3_PORT[, timeout])

     このクラスが、実際にPOP3プロトコルを実装します。インスタンスが初期
     化されるときに、コネクションが作成されます。 'port' が省略されると
     、POP3標準のポート(110)が使われます。オプションの 'timeout' 引数は
     、接続時のタイムアウト時間を秒数で指定します (指定されなかった場合
     は、グローバルのデフォルトタイムアウト設定が利用されます)。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1ccb.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1ccb. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ee. を
     送出します。

 -- クラス: poplib.POP3_SSL (host, port=POP3_SSL_PORT, *, timeout=None,
          context=None)

     *note POP3: b21. クラスのサブクラスで、SSL でカプセル化されたソケッ
     トによる POP サーバへの接続を提供します。 'port' が指定されていない
     場合、 POP3-over-SSL 標準の 995 番ポートが使われます。'timeout' に
     ついては ‘POP3’ クラスのコンストラクタの引数と同じです。 'context'
     は SSL の設定、証明書、秘密鍵を一つの (POP3_SSL オブジェクトよりも
     長く存在し続けうる) 構造にまとめた *note ssl.SSLContext: 355. オブ
     ジェクトで、省略可能です。ベストプラクティスについては *note
     セキュリティで考慮すべき点: 3931. を参照してください。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1ccb.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1ccb. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.2 で変更: 'context' 引数が追加されました。

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 3a6d. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3a7f. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ee. を
     送出します。

     バージョン 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.23.12.1 POP3 オブジェクト
...........................

POP3コマンドはすべて、それと同じ名前のメソッドとして小文字で表現されます
。そしてそのほとんどは、サーバからのレスポンスとなるテキストを返します。

*note POP3: b21. クラスのインスタンスは以下のメソッドを持ちます:

 -- メソッド: 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():
     13b7. が呼ばれるまでロックされます。

 -- メソッド: 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: 13b8. を送出します。 RFC
     6856(2) で規定されています。

     Added in version 3.5.

 -- メソッド: POP3.stls (context=None)

     アクティブな接続にて RFC 2595(3) で定められた方法で TLS セッション
     を開始します。TLS セッションはユーザ認証を行う前に開始する必要があ
     ります。

     'context' は SSL の設定、証明書、秘密鍵を一つの (POP3 オブジェクト
     よりも長く存在し続けうる) 構造にまとめた *note ssl.SSLContext: 355.
     オブジェクトです。ベストプラクティスについては *note
     セキュリティで考慮すべき点: 3931. を参照してください。

     このメソッドは *note ssl.SSLContext.check_hostname: 3a6d. と
     'Server Name Indication' でホスト名のチェックをサポートしました。
     (*note ssl.HAS_SNI: 3a7f. を参照してください)。

     Added in version 3.4.

*note POP3_SSL: b22. クラスのインスタンスは追加のメソッドを持ちません。
このサブクラスのインターフェイスは親クラスと同じです。

   ---------- 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.23.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.23.13 ‘imaplib’ -- IMAP4 プロトコルクライアント
-------------------------------------------------

'ソースコード:' Lib/imaplib.py(1)

__________________________________________________________________

このモジュールでは三つのクラス、 *note IMAP4: b03, *note IMAP4_SSL: b04.
と *note IMAP4_stream: b06. を定義します。これらのクラスは IMAP4 サーバ
への接続をカプセル化し、 RFC 2060(2) に定義されている IMAP4rev1 クライア
ントプロトコルの大規模なサブセットを実装しています。このクラスは IMAP4 (
RFC 1730(3)) 準拠のサーバと後方互換性がありますが、 ‘STATUS’ コマンドは
IMAP4 ではサポートされていないので注意してください。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

Three classes are provided by the ‘imaplib’ module, *note IMAP4: b03. 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 ‘IMAP4’ class supports the *note with: 187. 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: 187. 構文のサポートが追加されま
     した。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

例外は *note IMAP4: b03. クラスの属性として定義されています:

 -- 例外: IMAP4.error

     何らかのエラー発生の際に送出される例外です。例外の理由は文字列とし
     てコンストラクタに渡されます。

 -- 例外: IMAP4.abort

     IMAP4 サーバのエラーが生じると、この例外が送出されます。この例外は
     *note IMAP4.error: 185d. のサブクラスです。通常、インスタンスを閉じ
     、新たなインスタンスを再び生成することで、この例外から復旧できます
     。

 -- 例外: IMAP4.readonly

     この例外は書き込み可能なメールボックスの状態がサーバによって変更さ
     れた際に送出されます。この例外は *note IMAP4.error: 185d. のサブク
     ラスです。他の何らかのクライアントが現在書き込み権限を獲得しており
     、メールボックスを開きなおして書き込み権限を再獲得する必要がありま
     す。

このモジュールではもう一つ、安全 (secure) な接続を使ったサブクラスがあり
ます:

 -- クラス: imaplib.IMAP4_SSL (host='', port=IMAP4_SSL_PORT, *,
          ssl_context=None, timeout=None)

     This is a subclass derived from *note IMAP4: b03. 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: 355. object which allows bundling SSL
     configuration options, certificates and private keys into a single
     (potentially long-lived) structure.  Please read *note
     セキュリティで考慮すべき点: 3931. 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: 3a6d. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3a7f. を
     参照してください)。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

さらにもう一つのサブクラスは、子プロセスで確立した接続を使用する場合に使
用します:

 -- クラス: imaplib.IMAP4_stream (command)

     *note IMAP4: b03. から派生したサブクラスで、 'command' を
     ‘subprocess.Popen()’ に渡して作成される ‘stdin/stdout’ ディスクリプ
     タと接続します。

以下のユーティリティ関数が定義されています:

 -- の関数: imaplib.Internaldate2tuple (datestr)

     IMAP4 の ‘INTERNALDATE’ 文字列を解析してそれに相当するローカルタイ
     ムを返します。戻り値は *note time.struct_time: eea. のタプルか、文
     字列のフォーマットが不正な場合は ‘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: eea. (as returned by
     *note time.localtime(): 1717.), 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.23.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: b03. のインスタンスは以下のメソッドを持っています:

 -- メソッド: 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 ‘enable()’ 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: 187. 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: 187. context) can be
     retrieved in the usual way after ‘IDLE’ ends, using *note
     IMAP4.response(): 40f0.

     Responses are represented as ‘(type, [data, ...])’ tuples, as
     described in *note IMAP4 Objects: 40e2.

     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: 19c. or *note float: 197, 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: b06. 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: 19c. or *note float: 197.).

          This *note generator: 1270. 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: b06. 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
               ‘IMAP4.idle()’, 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 ‘IMAP4.idle()’ is usable only
          within a *note with: 187. statement.  Before or after that
          context, unsolicited responses are collected internally
          whenever a command finishes, and can be retrieved with *note
          IMAP4.response(): 40f0.

          注釈: 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: 185d. 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: 2ee. to reject
     creating a non-blocking socket.  This method is implicitly called
     by the *note IMAP4: b03. constructor.  The connection objects
     established by this method will be used in the *note IMAP4.read():
     40f7, *note IMAP4.readline(): 40f8, *note IMAP4.send(): 40f9, and
     *note IMAP4.shutdown(): 40fa. methods.  You may override this
     method.

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1ccb.
     ‘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(): 1012. 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 監査イベント: 1ccb.
     ‘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(): c88. は暗
     黙的にこのメソッドを呼び出します。このメソッドはオーバライドするこ
     とができます。

 -- メソッド: 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: 355. object.  This will
     enable encryption on the IMAP connection.  Please read *note
     セキュリティで考慮すべき点: 3931. for best practices.

     Added in version 3.2.

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 3a6d. and 'Server Name
     Indication' (see *note ssl.HAS_SNI: 3a7f.).

 -- メソッド: 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 ()

     ‘imaplib.IMAP4.unselect()’ 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(): b08, except that no messages are permanently
     removed from the currently selected mailbox.

     Added in version 3.9.

 -- メソッド: IMAP4.xatom (name[, ...])

     サーバから ‘CAPABILITY’ 応答で通知された単純な拡張命令を許容
     (allow) します。

以下の属性が *note IMAP4: b03. のインスタンス上で定義されています:

 -- の属性: 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(): 1012. 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.23.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.23.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: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

 -- クラス: smtplib.SMTP (host='', port=0, local_hostname=None[,
          timeout], source_address=None)

     An *note SMTP: b2b. instance encapsulates an SMTP connection.  It
     has methods that support a full repertoire of SMTP and ESMTP
     operations.  If the optional 'host' and 'port' parameters are
     given, the SMTP *note connect(): 17bb. method is called with those
     parameters during initialization.  If specified, 'local_hostname'
     is used as the FQDN of the local host in the HELO/EHLO command.
     Otherwise, the local hostname is found using *note
     socket.getfqdn(): 1b4c.  If the ‘connect()’ call returns anything
     other than a success code, an *note SMTPConnectError: 4114. is
     raised.  The optional 'timeout' parameter specifies a timeout in
     seconds for blocking operations like the connection attempt (if not
     specified, the global default timeout setting will be used).  If
     the timeout expires, *note TimeoutError: a3a. is raised.  The
     optional 'source_address' parameter allows binding to some specific
     source address in a machine with multiple network interfaces,
     and/or to some specific source TCP port.  It takes a 2-tuple
     ‘(host, port)’, for the socket to bind to as its source address
     before connecting.  If omitted (or if 'host' or 'port' are ‘''’
     and/or ‘0’ respectively) the OS default behavior will be used.

     普通に使う場合は、初期化と接続を行ってから、 *note sendmail():
     105d. と *note SMTP.quit(): 4115. メソッドを呼びます。使用例は先の
     方で記載しています。

     The *note SMTP: b2b. class supports the *note with: 187. 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: 1ccb. ‘smtplib.SMTP.send’ を送出します。ここで ‘data’ はリモ
     ートホストに送信されるバイト数です。

     バージョン 3.3 で変更: *note with: 187. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' argument was added.

     Added in version 3.5: SMTPUTF8 拡張 ( RFC 6531(4)) がサポートされま
     した。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ee. を
     送出します。

 -- クラス: smtplib.SMTP_SSL (host='', port=0, local_hostname=None, *[,
          timeout], context=None, source_address=None)

     An ‘SMTP_SSL’ instance behaves exactly the same as instances of
     *note SMTP: b2b.  ‘SMTP_SSL’ should be used for situations where
     SSL is required from the beginning of the connection and using
     *note starttls(): 1354. 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 ‘SMTP’ class.  'context', also optional,
     can contain a *note SSLContext: 355. and allows configuring various
     aspects of the secure connection.  Please read *note
     セキュリティで考慮すべき点: 3931. for best practices.

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.3 で変更: The 'source_address' argument was added.

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 3a6d. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 3a7f. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ee. を
     送出します。

     バージョン 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(): 17bb. 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: b2b. 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: 2c2. の派生クラスで、このモジュールが提供する他の全
     ての例外の基底クラスです。

     バージョン 3.4 で変更: SMTPException が *note OSError: 2c2. の派生
     クラスになりました。

 -- 例外: smtplib.SMTPServerDisconnected

     この例外はサーバが突然接続が切断されるか、*note SMTP: b2b. インスタ
     ンスを生成する前に接続しようとした場合に送出されます。

 -- 例外: 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: 4117. 例外に、 SMTPサーバが弾いた 'sender' ア
     ドレスの文字列がセットされます。

 -- 例外: smtplib.SMTPRecipientsRefused

     All recipient addresses refused.

      -- の属性: recipients

          A dictionary of exactly the same sort as returned by *note
          SMTP.sendmail(): 105d. 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.23.14.1 SMTP オブジェクト
...........................

*note SMTP: b2b. クラスインスタンスは次のメソッドを提供します:

 -- メソッド: SMTP.set_debuglevel (level)

     デバッグ出力レベルを設定します。'level' が 1 や ‘True’ の場合、接続
     ならびにサーバとの送受信のメッセージがデバッグメッセージとなります
     。'level' が 2 の場合、それらのメッセージにタイムスタンプが付きます
     。

     バージョン 3.5 で変更: デバッグレベル2が追加されました。

 -- メソッド: SMTP.docmd (cmd, args='')

     サーバへコマンド 'cmd' を送信します。オプション引数 'args' はスペー
     ス文字でコマンドに連結します。戻り値は、整数値のレスポンスコードと
     、サーバからの応答の値をタプルで返します (サーバからの応答が数行に
     渡る場合でも一つの大きな文字列で返します)。

     数値応答コードと実際の応答行 (複数の応答は 1 つの長い行に結合されま
     す) からなる 2 値タプルを返します。

     通常、このメソッドを明示的に使う必要はありません。他のメソッドを実
     装するのに使い、自分で拡張したものをテストするのに役立つかもしれま
     せん。

     応答待ちのときにサーバへの接続が切れると *note
     SMTPServerDisconnected: 4116. が送出されます。

 -- メソッド: SMTP.connect (host='localhost', port=0)

     ホスト名とポート番号をもとに接続します。デフォルトはlocalhostの標準
     的なSMTPポート(25番)に接続します。もしホスト名の末尾がコロン
     (‘':'’)で、後に番号がついている場合は、「ホスト名:ポート番号」とし
     て扱われます。このメソッドはコンストラクタにホスト名及びポート番号
     が指定されている場合、自動的に呼び出されます。戻り値は、この接続の
     応答内でサーバによって送信された応答コードとメッセージの2要素タプル
     です。

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1ccb.
     ‘smtplib.connect’ を送出します。

 -- メソッド: SMTP.helo (name='')

     SMTPサーバに ‘HELO’ コマンドで身元を示します。デフォルトでは
     hostname引数はローカルホストを指します。サーバーが返したメッセージ
     は、オブジェクトの *note helo_resp: 4124. 属性に格納されます。

     通常は *note sendmail(): 105d. が呼びだすため、これを明示的に呼び出
     す必要はありません。

 -- メソッド: SMTP.ehlo (name='')

     ‘EHLO’ を利用し、ESMTPサーバに身元を明かします。デフォルトでは
     hostname引数はローカルホストのFQDNです。また、ESMTPオプションのため
     に応答を調べたものは、 *note has_extn(): 4126. に備えて保存されます
     。また、幾つかの情報を属性に保存します: サーバーが返したメッセージ
     は *note ehlo_resp: 4127. 属性に、 *note does_esmtp: 4128. 属性はサ
     ーバーがESMTPをサポートしているかどうかによって ‘True’ か ‘False’ に
     、 *note esmtp_features: 4129. 属性は辞書で、サーバーが対応している
     SMTP サービス拡張の名前と、もしあればそのパラメータを格納します。

     メールを送信する前に *note has_extn(): 4126. を使おうとしない限り、
     このメソッドを明示的に呼ぶ必要はないはずです。必要な場合は *note
     sendmail(): 105d. に暗黙的に呼ばれます。

 -- メソッド: SMTP.ehlo_or_helo_if_needed ()

     このメソッドは、現在のセッションでまだ ‘EHLO’ か ‘HELO’ コマンドが
     実行されていない場合、 *note ehlo(): 4125. and/or *note helo():
     4123. メソッドを呼び出します。このメソッドは先に ESMTP ‘EHLO’ を試
     します。

     *note SMTPHeloError: 411e.

          サーバーが ‘HELO’ に正しく返答しませんでした。

 -- メソッド: SMTP.has_extn (name)

     'name' が拡張SMTPサービスセットに含まれている場合には *note True:
     e0b. を返し、そうでなければ *note False: d2f. を返します。大小文字
     は区別されません。

 -- メソッド: 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: 411e.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPAuthenticationError: 411f.

          サーバがユーザ名/パスワードでの認証に失敗しました。

     *note SMTPNotSupportedError: 1e0b.

          ‘AUTH’ コマンドはサーバにサポートされていません。

     *note SMTPException: 11a7.

          適当な認証方法が見付かりませんでした。

     Each of the authentication methods supported by ‘smtplib’ are tried
     in turn if they are advertised as supported by the server.  See
     *note auth(): 105b. for a list of supported authentication methods.
     'initial_response_ok' is passed through to ‘auth()’.

     オプションのキーワード引数 'initial_response_ok' は、それをサポート
     する認証方法に対して、チャレンジ/レスポンスを要求するのではなく、
     "AUTH"コマンドとともに RFC 4954(2) で指定された"初期応答"を送信でき
     るかどうかを指定します。

     バージョン 3.5 で変更: *note SMTPNotSupportedError: 1e0b. が送出さ
     れる場合があります。'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: 4129.

     '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(): 412c. 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(): 4125.
     を呼んでください。

     If 'keyfile' and 'certfile' are provided, they are used to create
     an *note ssl.SSLContext: 355.

     Optional 'context' parameter is an *note ssl.SSLContext: 355.
     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: 411e.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPNotSupportedError: 1e0b.

          サーバーが STARTTLS 拡張に対応していません。

     *note RuntimeError: 246.

          実行中の Python インタプリタで、SSL/TLS サポートが利用できませ
          ん。

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 3a6d. and 'Server Name
     Indicator' (see *note HAS_SNI: 3a7f.).

     バージョン 3.5 で変更: The error raised for lack of STARTTLS
     support is now the *note SMTPNotSupportedError: 1e0b. subclass
     instead of the base *note SMTPException: 11a7.

 -- メソッド: 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: 411b.

          All recipients were refused.  Nobody got the mail.

     *note SMTPHeloError: 411e.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPSenderRefused: 411a.

          サーバが 'from_addr' を受理しませんでした。

     *note SMTPDataError: 411d.

          サーバが予期しないエラーコードを返しました (受信拒否以外)。

     *note SMTPNotSupportedError: 1e0b.

          'mail_options' に ‘SMTPUTF8’ が与えられましたが、サーバがサポ
          ートしていません。

     また、この他の注意として、例外が上がった後もコネクションは開いたま
     まになっています。

     バージョン 3.2 で変更: 'msg' はバイト文字列でも構いません。

     バージョン 3.5 で変更: ‘SMTPUTF8’ のサポートが追加されました。
     ‘SMTPUTF8’ が与えられたが、サーバがサポートしていない場合は *note
     SMTPNotSupportedError: 1e0b. が送出されます。

 -- メソッド: SMTP.send_message (msg, from_addr=None, to_addrs=None,
          mail_options=(), rcpt_options=())

     This is a convenience method for calling *note sendmail(): 105d.
     with the message represented by an *note email.message.Message:
     581. object.  The arguments have the same meaning as for
     ‘sendmail()’, 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: 2ee. is
     raised, since there is no way to unambiguously detect the most
     recent set of ‘Resent-’ headers.

     ‘send_message’ serializes 'msg' using *note BytesGenerator: 13eb.
     with ‘\r\n’ as the 'linesep', and calls *note sendmail(): 105d. 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: 1e0b. is raised.  Otherwise the
     ‘Message’ is serialized with a clone of its *note policy: 53. with
     the *note utf8: ffd. 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(): 4123.

 -- の属性: SMTP.ehlo_resp

     The response to the ‘EHLO’ command, see *note ehlo(): 4125.

 -- の属性: SMTP.does_esmtp

     A boolean value indicating whether the server supports ESMTP, see
     *note ehlo(): 4125.

 -- の属性: SMTP.esmtp_features

     A dictionary of the names of SMTP service extensions supported by
     the server, see *note ehlo(): 4125.

   ---------- 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.23.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(): 105e. で送信する
     、という手順を用います。 *note email; 使用例: 1142. を参照してくだ
     さい。

   ---------- 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.23.15 ‘uuid’ --
-----------------

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

'ソースコード:' Lib/uuid.py(1)

__________________________________________________________________

This module provides immutable *note UUID: c5a. objects (the ‘UUID’
class) and *note functions: 4132. for generating UUIDs corresponding to
a specific UUID version as specified in RFC 9562(2) (which supersedes
RFC 4122(3)), for example, *note uuid1(): da5. for UUID version 1, *note
uuid3(): 2e7. 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(): da5. か
*note uuid4(): 2e9. を呼び出せば良いでしょう。 ‘uuid1()’ はコンピュータ
のネットワークアドレスを含む UUID を生成するためにプライバシーを侵害する
かもしれない点に注意してください。 ‘uuid4()’ はランダムな UUID を生成し
ます。

Depending on support from the underlying platform, *note uuid1(): da5.
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: c5a. have an *note
is_safe: da3. 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: 4137. 属性の比較によ
     って行われます。UUIDではないオブジェクトとの比較は、 *note
     TypeError: 199. を送出します。

     ‘str(uuid)’ は 32桁の16進でUUIDを表す
     ''12345678-1234-5678-1234-567812345678'' 形式の文字列を返します。

*note UUID: c5a. インスタンスは以下の読み出し専用属性を持ちます:

 -- の属性: 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: 4145, *note RFC_4122: 4146, *note RESERVED_MICROSOFT:
     4147, *note RESERVED_FUTURE: 4148. のいずれかです。

 -- の属性: UUID.version

     The UUID version number (1 through 8, meaningful only when the
     variant is *note RFC_4122: 4146.).

     バージョン 3.14 で変更: Added UUID versions 6, 7 and 8.

 -- の属性: UUID.is_safe

     *note SafeUUID: 4133. の列挙で、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(): da4. 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: 193. 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: 193. 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(): da5. to improve database
     locality.

     When 'node' is not specified, *note getnode(): da4. 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(): 2e9. 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(): 2e7. or *note uuid5(): 2e8.

 -- データ: 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: 4144. 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.23.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(): 2e9. 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(): 2e7.
     / *note uuid5(): 2e8. functions.

 -- Option: -N <name>
 -- Option: --name <name>

     The name used as part of generating the uuid.  Only required for
     *note uuid3(): 2e7. / *note uuid5(): 2e8. 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.23.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.23.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.23.16 ‘socketserver’ -- ネットワークサーバーのフレームワーク
--------------------------------------------------------------

'ソースコード:' Lib/socketserver.py(1)

__________________________________________________________________

The ‘socketserver’ module simplifies the task of writing network
servers.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

基本的な具象サーバクラスが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(): 415f. and *note server_activate():
     4160.  The other parameters are passed to the *note BaseServer:
     1359. 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: 153b.

 -- クラス: 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: 153b.

これらの 4 つのクラスは要求を '同期的に (synchronously)' 処理します; 各
要求は次の要求を開始する前に完結していなければなりません。同期的な処理は
、サーバで大量の計算を必要とする、あるいはクライアントが処理するには時間
がかかりすぎるような大量のデータを返す、といった理由によってリクエストに
長い時間がかかる状況には向いていません。こうした状況の解決方法は別のプロ
セスを生成するか、個々の要求を扱うスレッドを生成することです; *note
ForkingMixIn: d75. および *note ThreadingMixIn: d3e. 配合クラス (mix-in
classes) を使えば、非同期的な動作をサポートできます。

サーバの作成にはいくつかのステップが必要です。最初に、 *note
BaseRequestHandler: 4164. クラスをサブクラス化して要求処理クラス
(request hander class) を生成し、その *note handle(): 4165. メソッドをオ
ーバーライドしなければなりません; このメソッドは入力される要求を処理しま
す。次に、サーバクラスのうち一つを、サーバのアドレスと要求処理クラスを渡
してインスタンス化しなければなりません。サーバを *note with: 187. 文中で
使うことが推奨されます。そして、*note handle_request(): 153e. または
*note serve_forever(): 135b. メソッドを呼び出して、一つのまたは多数の要
求を処理します。最後に、(‘with’ 文を使っていなかったなら) *note
server_close(): d73. を呼び出してソケットを閉じます。

*note ThreadingMixIn: d3e. から継承してスレッドを利用した接続を行う場合
、突発的な通信切断時の処理を明示的に指定する必要があります。
‘ThreadingMixIn’ クラスには 'daemon_threads' 属性があり、サーバがスレッ
ドの終了を待ち合わせるかどうかを指定する事ができます。スレッドが独自の処
理を行う場合は、このフラグを明示的に指定します。デフォルトは *note
False: d2f. で、Pythonは ‘ThreadingMixIn’ クラスが起動した全てのスレッド
が終了するまで実行し続けます。

サーバクラス群は使用するネットワークプロトコルに関わらず、同じ外部メソッ
ドおよび属性を持ちます。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/socketserver.py


File: python.info,  Node: サーバ生成に関するノート,  Next: Serverオブジェクト,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.23.16.1 サーバ生成に関するノート
..................................

継承図にある五つのクラスのうち四つは四種類の同期サーバを表わしています:

     +------------+
     | BaseServer |
     +------------+
           |
           v
     +-----------+        +------------------+
     | TCPServer |------->| UnixStreamServer |
     +-----------+        +------------------+
           |
           v
     +-----------+        +--------------------+
     | UDPServer |------->| UnixDatagramServer |
     +-----------+        +--------------------+

*note UnixDatagramServer: 4163. は *note UDPServer: 4161. から派生してい
て、 *note UnixStreamServer: 4162. からではないことに注意してください --
IP と Unix サーバの唯一の違いはアドレスファミリーです。

 -- クラス: socketserver.ForkingMixIn
 -- クラス: socketserver.ThreadingMixIn

     それぞれのタイプのサーバのフォークしたりスレッド実行したりするバー
     ジョンはそれらのミクシン(mix-in)クラスを使って作ることができます。
     たとえば、*note ThreadingUDPServer: 4167. は以下のようにして作られ
     ます:

          class ThreadingUDPServer(ThreadingMixIn, UDPServer):
              pass

     ミクシンクラスは *note UDPServer: 4161. で定義されるメソッドをオー
     バライドするために、最初に来ます。様々な属性を設定することで元にな
     るサーバ機構の振る舞いを変えられます。

     ‘ForkingMixIn’ and the Forking classes mentioned below are only
     available on POSIX platforms that support *note fork(): 4b5.

      -- の属性: block_on_close

          *note ForkingMixIn.server_close: d73. waits until all child
          processes complete, except if *note block_on_close: d74.
          attribute is ‘False’.

          *note ThreadingMixIn.server_close: d73. waits until all
          non-daemon threads complete, except if *note block_on_close:
          d74. attribute is ‘False’.

      -- の属性: max_children

          Specify how many child processes will exist to handle requests
          at a time for ‘ForkingMixIn’.  If the limit is reached, new
          requests will wait until one child process has finished.

      -- の属性: daemon_threads

          For ‘ThreadingMixIn’ use daemonic threads by setting *note
          ThreadingMixIn.daemon_threads: 4169. to ‘True’ to not wait
          until threads complete.

     バージョン 3.7 で変更: *note ForkingMixIn.server_close: d73. and
     ‘ThreadingMixIn.server_close’ now waits until all child processes
     and non-daemonic threads complete.  Add a new *note
     ForkingMixIn.block_on_close: d74. 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: 4164. からクラスを派生さ
せてその *note handle(): 4165. メソッドを再定義しなければなりません。こ
のようにすれば、サーバクラスと要求処理クラスを結合して様々なバージョンの
サービスを実行することができます。要求処理クラスはデータグラムサービスか
ストリームサービスかで異なることでしょう。この違いは処理サブクラス *note
StreamRequestHandler: eda. または *note DatagramRequestHandler: 4171. を
使うという形で隠蔽できます。

もちろん、まだ頭を使わなければなりません!  たとえば、サービスがリクエス
トによっては書き換えられるようなメモリ上の状態を使うならば、フォークする
サーバを使うのは馬鹿げています。というのも子プロセスでの書き換えは親プロ
セスで保存されている初期状態にも親プロセスから分配される各子プロセスの状
態にも届かないからです。この場合、スレッド実行するサーバを使うことはでき
ますが、共有データの一貫性を保つためにロックを使わなければならなくなるで
しょう。

一方、全てのデータが外部に(たとえばファイルシステムに)保存される HTTP サ
ーバを作っているのだとすると、同期クラスではどうしても一つの要求が処理さ
れている間サービスが「耳の聞こえない」状態を呈することになります -- この
状態はもしクライアントが要求した全てのデータをゆっくり受け取るととても長
い時間続きかねません。こういう場合にはサーバをスレッド実行したりフォーク
することが適切です。

ある場合には、要求の一部を同期的に処理する一方で、要求データに依って子プ
ロセスをフォークして処理を終了させる、といった方法も適当かもしれません。
こうした処理方法は同期サーバを使って要求処理クラスの *note handle():
4165. メソッドの中で自分でフォークするようにして実装することができます。

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オブジェクト,  Next: Request Handler Objects,  Prev: サーバ生成に関するノート,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.23.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: 4173. and *note
     RequestHandlerClass: 4174. attributes.

      -- メソッド: fileno ()

          サーバが要求待ちを行っているソケットのファイル記述子を整数で返
          します。この関数は一般的に、同じプロセス中の複数のサーバを監視
          できるようにするために、 *note selectors: c7. に渡されます。

      -- メソッド: handle_request ()

          単一の要求を処理します。この関数は以下のメソッド: *note
          get_request(): 4176. 、 *note verify_request(): 4177. 、および
          *note process_request(): 4178. を順番に呼び出します。ハンドラ
          中でユーザによって提供された *note handle(): 4165. が例外を送
          出した場合、サーバの *note handle_error(): f41. メソッドが呼び
          出されます。 *note timeout: 153c. 秒以内にリクエストが来なかっ
          た場合、 *note handle_timeout(): 153d. が呼ばれて、 *note
          handle_request(): 153e. が終了します。

      -- メソッド: serve_forever (poll_interval=0.5)

          Handle requests until an explicit *note shutdown(): 1e72.
          request.  Poll for shutdown every 'poll_interval' seconds.
          Ignores the *note timeout: 153c. attribute.  It also calls
          *note service_actions(): 135a, which may be used by a subclass
          or mixin to provide actions specific to a given service.  For
          example, the *note ForkingMixIn: d75. class uses
          ‘service_actions()’ 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(): 135b. 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(): 135b. loop to stop and wait
          until it does.  ‘shutdown()’ must be called while
          ‘serve_forever()’ 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: 1c0a, *note
          socket.AF_INET6: 1c0b, and *note socket.AF_UNIX: 1c0d.
          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: d2f. で、サブクラスで再使用ポリシを変更する
          ために設定することができます。

      -- の属性: request_queue_size

          要求待ち行列 (queue) のサイズです。単一の要求を処理するのに長
          時間かかる場合には、サーバが処理中に届いた要求は最大 *note
          request_queue_size: 417c. 個まで待ち行列に置かれます。待ち行列
          が一杯になると、それ以降のクライアントからの要求は "接続拒否
          (Connection denied)" エラーになります。標準の値は通常 5 ですが
          、この値はサブクラスで上書きすることができます。

      -- の属性: socket_type

          サーバが使うソケットの型です; 一般的な2つの値は、 *note
          socket.SOCK_STREAM: 150f. と *note socket.SOCK_DGRAM: 150e. で
          す。

      -- の属性: timeout

          タイムアウト時間(秒)、もしくは、タイムアウトを望まない場合に
          *note None: 886. 。 *note handle_request(): 153e. がこの時間内
          にリクエストを受信しない場合、 *note handle_timeout(): 153d. メ
          ソッドが呼ばれます。

     *note TCPServer: 153b. のような基底クラスのサブクラスで上書きできる
     サーバメソッドは多数あります; これらのメソッドはサーバオブジェクト
     の外部のユーザにとっては役にたたないものです。

      -- メソッド: finish_request (request, client_address)

          *note RequestHandlerClass: 4174. をインスタンス化し、 *note
          handle(): 4165. メソッドを呼び出して、実際に要求を処理します。

      -- メソッド: get_request ()

          ソケットから要求を受理して、クライアントとの通信に使われる '新
          しい' ソケットオブジェクト、およびクライアントのアドレスからな
          る、2 要素のタプルを返します。

      -- メソッド: handle_error (request, client_address)

          この関数は *note RequestHandlerClass: 4174. インスタンスの
          *note handle(): 4165. メソッドが例外を送出した際に呼び出されま
          す。標準の動作では標準エラー出力へトレースバックを出力し、後続
          する要求を継続して処理します。

          バージョン 3.6 で変更: Now only called for exceptions derived
          from the *note Exception: bd1. class.

      -- メソッド: handle_timeout ()

          この関数は *note timeout: 153c. 属性が *note None: 886. 以外に
          設定されて、リクエストがないままタイムアウト秒数が過ぎたときに
          呼ばれます。 fork型サーバーでのデフォルトの動作は、終了した子
          プロセスの情報を集めるようになっています。スレッド型サーバーで
          はこのメソッドは何もしません。

      -- メソッド: process_request (request, client_address)

          *note finish_request(): 417e. を呼び出して、 *note
          RequestHandlerClass: 4174. のインスタンスを生成します。必要な
          ら、この関数から新たなプロセスかスレッドを生成して要求を処理す
          ることができます; その処理は *note ForkingMixIn: d75. または
          *note ThreadingMixIn: d3e. クラスが行います。

      -- メソッド: server_activate ()

          Called by the server's constructor to activate the server.
          The default behavior for a TCP server just invokes *note
          listen(): 1062. on the server's socket.  May be overridden.

      -- メソッド: server_bind ()

          サーバのコンストラクタによって呼び出され、適切なアドレスにソケ
          ットをバインドします。このメソッドは上書きできます。

      -- メソッド: verify_request (request, client_address)

          ブール値を返さなければなりません; 値が *note True: e0b. の場合
          には要求が処理され、 *note False: d2f. の場合には要求は拒否さ
          れます。サーバへのアクセス制御を実装するためにこの関数を上書き
          することができます。標準の実装では常に ‘True’ を返します。

     バージョン 3.6 で変更: *note context manager: 1e3. プロトコルのサポ
     ートが追加されました。コンテキストマネージャを終了することは、
     *note server_close(): d73. を呼ぶことと同一です。


File: python.info,  Node: Request Handler Objects,  Next: 使用例<40>,  Prev: Serverオブジェクト,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.23.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(): 4165. method, and can override
     any of the other methods.  A new instance of the subclass is
     created for each request.

      -- メソッド: setup ()

          *note handle(): 4165. メソッドより前に呼び出され、何らかの必要
          な初期化処理を行います。標準の実装では何も行いません。

      -- メソッド: 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: 4181.; the client address as *note
          client_address: 4182.; and the server instance as *note
          server: 4183, in case it needs access to per-server
          information.

          The type of *note request: 4181. is different for datagram or
          stream services.  For stream services, ‘request’ is a socket
          object; for datagram services, ‘request’ is a pair of string
          and socket.

      -- メソッド: finish ()

          *note handle(): 4165. メソッドより後に呼び出され、何らかの必要
          なクリーンアップ処理を行います。標準の実装では何も行いません。
          *note setup(): 4180. メソッドが例外を送出した場合、このメソッ
          ドは呼び出されません。

      -- の属性: request

          The 'new' *note socket.socket: fa5. object to be used to
          communicate with the client.

      -- の属性: client_address

          Client address returned by *note BaseServer.get_request():
          4176.

      -- の属性: server

          *note BaseServer: 1359. object used for handling the request.

 -- クラス: socketserver.StreamRequestHandler
 -- クラス: socketserver.DatagramRequestHandler

     These *note BaseRequestHandler: 4164. subclasses override the *note
     setup(): 4180. and *note finish(): 4184. methods, and provide *note
     rfile: 4185. and *note wfile: ed9. attributes.

      -- の属性: rfile

          A file object from which receives the request is read.
          Support the *note io.BufferedIOBase: 8a4. readable interface.

      -- の属性: wfile

          A file object to which the reply is written.  Support the
          *note io.BufferedIOBase: 8a4. writable interface

     バージョン 3.6 で変更: *note wfile: ed9. also supports the *note
     io.BufferedIOBase: 8a4. writable interface.


File: python.info,  Node: 使用例<40>,  Prev: Request Handler Objects,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.23.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.23.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.23.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.23.16.7 非同期処理の Mix-in
.............................

複数の接続を非同期に処理するハンドラを作るには、 *note ThreadingMixIn:
d3e. か *note ForkingMixIn: d75. クラスを利用します。

*note ThreadingMixIn: d3e. クラスの利用例:

     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: d75. クラスは同じように利用することができます。この
場合、サーバーはリクエスト毎に新しいプロセスを作成します。*note fork():
4b5. をサポートする POSIX プラットフォームでのみ利用可能です。


File: python.info,  Node: http server --- HTTP サーバー,  Next: http cookies --- HTTP の状態管理,  Prev: socketserver --- ネットワークサーバーのフレームワーク,  Up: インターネットプロトコルとサポート

5.23.17 ‘http.server’ -- HTTP サーバー
--------------------------------------

'ソースコード:' Lib/http/server.py(1)

__________________________________________________________________

このモジュールは HTTP サーバを実装するためのクラスを提供しています。

     警告: ‘http.server’ is not recommended for production.  It only
     implements *note basic security checks: 418d.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

クラス *note HTTPServer: 3f8b. は *note socketserver.TCPServer: 153b. の
サブクラスです。 ‘HTTPServer’ は 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: 153b. クラスの上に構築されており、サ
     ーバのアドレスをインスタンス変数 ‘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: d3e.  This is useful to
     handle web browsers pre-opening sockets, on which *note HTTPServer:
     3f8b. 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: 3f8b. with a wrapped socket using the
     *note ssl: d5. module.  If the ‘ssl’ module is not available,
     instantiating a ‘HTTPSServer’ object fails with a *note
     RuntimeError: 246.

     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: 22a. but uses threads
     to handle requests by inheriting from *note ThreadingMixIn: d3e.
     This is analogous to *note ThreadingHTTPServer: d3d. only using
     ‘HTTPSServer’.

     Added in version 3.14.

The *note HTTPServer: 3f8b, *note ThreadingHTTPServer: d3d, *note
HTTPSServer: 22a. and *note ThreadingHTTPSServer: 418e. must be given a
'RequestHandlerClass' on instantiation, of which this module provides
three different variants:

 -- クラス: http.server.BaseHTTPRequestHandler (request, client_address,
          server)

     This class is used to handle the HTTP requests that arrive at the
     server.  By itself, it cannot respond to any actual HTTP requests;
     it must be subclassed to handle each request method (for example,
     ‘'GET'’ or ‘'POST'’).  ‘BaseHTTPRequestHandler’ provides a number
     of class and instance variables, and methods for use by subclasses.

     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: 12e6. は以下のインスタンス変数を持っ
     ています:

      -- の属性: client_address

          HTTP クライアントのアドレスを参照している、‘(host, port)’ の形
          式をとるタプルが入っています。

      -- の属性: server

          server インスタンスが入っています。

      -- の属性: close_connection

          *note handle_one_request(): 4192. が返る前に設定すべき真偽値で
          、別のリクエストが期待されているかどうか、もしくはコネクション
          を切断すべきかどうかを指し示しています。

      -- の属性: requestline

          HTTP リクエスト行の文字列表現を保持しています。 末尾の CRLF は
          除去されています。 この属性は *note handle_one_request():
          4192. によって設定されるべきです。 妥当なリクエスト行が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: 4197. class variable.  This instance parses and
          manages the headers in the HTTP request.  The *note
          parse_headers(): 1e84. 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: 8a4. 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:
          8a4. stream.

     *note BaseHTTPRequestHandler: 12e6. は以下の属性を持っています:

      -- の属性: server_version

          サーバのソフトウェアバージョンを指定します。この値は上書きする
          必要が生じるかもしれません。書式は複数の文字列を空白で分割した
          もので、各文字列はソフトウェア名[/バージョン] の形式をとります
          。例えば、‘'BaseHTTP/0.2'’ です。

      -- の属性: sys_version

          Python 処理系のバージョンが, *note version_string: 419c. メソ
          ッドや *note server_version: 419a. クラス変数で利用可能な形式
          で入っています。例えば ‘'Python/1.4'’ です。

      -- の属性: error_message_format

          Specifies a format string that should be used by *note
          send_error(): 1155. method for building an error response to
          the client.  The string is filled by default with variables
          from *note responses: 4055. based on the status code that
          passed to ‘send_error()’.

      -- の属性: 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():
          419f.) 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: 406e. になってい
          ます。

      -- の属性: 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(): 41a0. and *note
          send_error(): 1155. methods.

     *note BaseHTTPRequestHandler: 12e6. インスタンスは以下のメソッドを
     持っています:

      -- メソッド: handle ()

          Calls *note handle_one_request(): 4192. 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 ()

          When an HTTP/1.1 conformant server receives an ‘Expect:
          100-continue’ request header it responds back with a ‘100
          Continue’ followed by ‘200 OK’ headers.  This method can be
          overridden to raise an error if the server does not want the
          client to continue.  For example, the server can choose to
          send ‘417 Expectation Failed’ as a response header and ‘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: 1156. attribute and
          emitted, after a complete set of headers, as the response
          body.  The *note responses: 4055. 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(): 419c. and *note date_time_string(): 41a4.
          methods, respectively.  If the server does not intend to send
          any other headers using the *note send_header(): 419f. method,
          then ‘send_response()’ should be followed by an *note
          end_headers(): 12e7. call.

          バージョン 3.3 で変更: Headers are stored to an internal
          buffer and *note end_headers(): 12e7. 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():
          12e7. or *note flush_headers(): 12e8. is invoked.  'keyword'
          should specify the header keyword, with 'value' specifying its
          value.  Note that, after the send_header calls are done,
          ‘end_headers()’ MUST BE called in order to complete the
          operation.

          This method does not reject input containing CRLF sequences.

          バージョン 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.

          This method does not reject 'message' containing CRLF
          sequences.

          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(): 12e8.

          バージョン 3.2 で変更: バッファされたヘッダは出力ストリームに
          書き出されます。

      -- メソッド: flush_headers ()

          最終的にヘッダを出力ストリームに送り、内部ヘッダバッファをフラ
          ッシュします。

          Added in version 3.3.

      -- メソッド: log_request (code='-', size='-')

          受理された (成功した) リクエストをログに記録します。'code' に
          はこの応答に関連付けられた HTTP コード番号を指定します。応答メ
          ッセージの大きさを知ることができる場合、'size' パラメタに渡す
          とよいでしょう。

      -- メソッド: log_error (...)

          リクエストを遂行できなかった際に、エラーをログに記録します。標
          準では、メッセージを *note log_message(): 41a7. に渡します。従
          って同じ引数 ('format' と追加の値) を取ります。

      -- メソッド: log_message (format, ...)

          任意のメッセージを ‘sys.stderr’ にログ記録します。このメソッド
          は通常、カスタムのエラーログ記録機構を作成するために上書きされ
          ます。 'format' 引数は標準の printf 形式の書式文字列で、 *note
          log_message(): 41a7. に渡された追加の引数は書式化の入力として
          適用されます。ログ記録される全てのメッセージには、クライアント
          の IP アドレスおよび現在の日付、時刻が先頭に付けられます。

      -- メソッド: version_string ()

          サーバーのソフトウェアのバージョンを示す文字列を返します。 そ
          の文字列は、*note server_version: 419a. と *note sys_version:
          419b. の属性が含まれます。

      -- メソッド: 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: 12e6. で行われます。このクラスは関数 *note
     do_GET(): 41aa. および *note do_HEAD(): 41ab. を実装しています。

     *note SimpleHTTPRequestHandler: d3c. では以下のメンバ変数を定義して
     います:

      -- の属性: 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: d3c. では以下のメソッドを定義してい
     ます:

      -- メソッド: do_HEAD ()

          このメソッドは ‘'HEAD'’ 型のリクエスト処理を実行します: すなわ
          ち、 ‘GET’ リクエストの時に送信されるものと同じヘッダを送信し
          ます。送信される可能性のあるヘッダについての完全な説明は *note
          do_GET(): 41aa. メソッドを参照してください。

      -- メソッド: do_GET ()

          リクエストを現在の作業ディレクトリからの相対的なパスとして解釈
          することで、リクエストをローカルシステム上のファイルと対応付け
          ます。

          リクエストがディレクトリに対応付けられた場合、 ‘index.html’ ま
          たは ‘index.htm’ を (この順序で) チェックします。もしファイル
          を発見できればその内容を、そうでなければディレクトリ一覧を
          ‘list_directory()’ メソッドで生成して、返します。このメソッド
          は *note os.listdir(): 1316. をディレクトリのスキャンに用いて
          おり、 ‘listdir()’ が失敗した場合には ‘404’ 応答が返されます。

          If the request was mapped to a file, it is opened.  Any *note
          OSError: 2c2. 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: d3c. 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: d3c. 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)

     This class is used to serve either files or output of CGI scripts
     from the current directory and below.  Note that mapping HTTP
     hierarchic structure to local directory structure is exactly as in
     *note SimpleHTTPRequestHandler: d3c.

          注釈: CGI scripts run by the ‘CGIHTTPRequestHandler’ class
          cannot execute redirects (HTTP code 302), because code 200
          (script output follows) is sent prior to execution of the CGI
          script.  This pre-empts the status code.

     The class will however, run the CGI script, instead of serving it
     as a file, if it guesses it to be a CGI script.  Only
     directory-based CGI are used -- the other common server
     configuration is to treat special extensions as denoting CGI
     scripts.

     The ‘do_GET()’ and ‘do_HEAD()’ functions are modified to run CGI
     scripts and serve the output, instead of serving files, if the
     request leads to somewhere below the ‘cgi_directories’ path.

     The ‘CGIHTTPRequestHandler’ defines the following data member:

      -- の属性: cgi_directories

          This defaults to ‘['/cgi-bin', '/htbin']’ and describes
          directories to treat as containing CGI scripts.

     The ‘CGIHTTPRequestHandler’ defines the following method:

      -- メソッド: do_POST ()

          This method serves the ‘'POST'’ request type, only allowed for
          CGI scripts.  Error 501, "Can only POST to CGI scripts", is
          output when trying to POST to a non-CGI url.

     Note that CGI scripts will be run with UID of user nobody, for
     security reasons.  Problems with the CGI script will be translated
     to error 403.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定:
     ‘CGIHTTPRequestHandler’ 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: 418d.

* 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.23.17.1 コマンドライン・インターフェース
..........................................

‘http.server’ can also be invoked directly using the *note -m: 23e.
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: 327. can be enabled in the command
     line by passing the ‘--cgi’ option:

          python -m http.server --cgi

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: ‘http.server’
     command line ‘--cgi’ support is being removed because *note
     CGIHTTPRequestHandler: 327. is being removed.

     警告: *note CGIHTTPRequestHandler: 327. 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.23.17.2 セキュリティで考慮すべき点
....................................

*note SimpleHTTPRequestHandler: d3c. will follow symbolic links when
handling requests, this makes it possible for files outside of the
specified directory to be served.

Methods *note BaseHTTPRequestHandler.send_header(): 419f. and *note
BaseHTTPRequestHandler.send_response_only(): 41a0. assume sanitized
input and do not perform input validation such as checking for the
presence of CRLF sequences.  Untrusted input may result in HTTP Header
injection attacks.

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: 12e6. ‘.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.23.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: 14df. 、 *note string.digits: 2797.
、 ‘!#$%&'*+-.^_`|~:’ を、このモジュールは cookie 名 (*note key: dff.) と
して有効と認めています。

バージョン 3.3 で変更: ':' が有効な cookie 名の文字として認められました
。

     注釈: 不正な cookie に遭遇した場合、 *note CookieError: 41bc. 例外
     を送出します。そのため、ブラウザから持ってきた cookie データをパー
     スするときには常に不正なデータに備え ‘CookieError’ 例外を捕捉してく
     ださい。

 -- 例外: http.cookies.CookieError

     属性や ‘Set-Cookie’ ヘッダが正しくないなど、 RFC 2109(4) に合致して
     いないときに発生する例外です。

 -- クラス: http.cookies.BaseCookie ([input])

     このクラスはキーが文字列、値が *note Morsel: e02. インスタンスで構
     成される辞書風オブジェクトです。値に対するキーを設定するときは、値
     がキーと値を含む ‘Morsel’ に変換されることに注意してください。

     'input' が与えられたときは、そのまま *note load(): 41be. メソッドへ
     渡されます。

 -- クラス: http.cookies.SimpleCookie ([input])

     このクラスは *note BaseCookie: 41bd. を継承し、 *note
     value_decode(): 41bf. と *note value_encode(): 41c0. をオーバーライ
     ドします。 ‘SimpleCookie’ は文字列と cookie 値をサポートします。値
     を設定するとき、 ‘SimpleCookie’ は組み込みの *note str(): 16a. を呼
     び出して値を文字列に変換します。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.23.18.1 Cookieオブジェクト
............................

 -- メソッド: BaseCookie.value_decode (val)

     文字列表現のタプル ‘(real_value, coded_value)’ を返します。
     ‘real_value’ の型はどのようなものでも許容されます。このメソッドは
     *note BaseCookie: 41bd. においてデコードを行わず、オーバーライドさ
     れるためにだけ存在します。

 -- メソッド: BaseCookie.value_encode (val)

     タプル ‘(real_value, coded_value)’ を返します。 'val' の型はどのよ
     うなものでも許容されますが、 ‘coded_value’ は常に文字列に変換されま
     す。このメソッドは *note BaseCookie: 41bd. においてエンコードを行わ
     ず、オーバーライドされるためにだけ存在します。

     通常 *note value_encode(): 41c0. と *note value_decode(): 41bf. は
     ともに '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: e02.'s *note
     output(): 41c4. 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(): 41c3. と同じです。

 -- メソッド: BaseCookie.load (rawdata)

     'rawdata' が文字列であれば、 ‘HTTP_COOKIE’ として処理し、その値を
     *note Morsel: e02. として追加します。辞書の場合は次と同様の処理をお
     こないます。

          for k, v in rawdata.items():
              cookie[k] = v


File: python.info,  Node: Morselオブジェクト,  Next: 使用例<41>,  Prev: Cookieオブジェクト,  Up: http cookies --- HTTP の状態管理

5.23.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: 15ee. 属性は、 cookie が HTTP リクエストでのみ送信
     されて、 JavaScript からのはアクセスできない事を示します。これはい
     くつかのクロスサイトスクリプティングの脅威を和らげることを意図して
     います。

     The attribute *note samesite: 41cd. 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: 41ce. 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: dff. 及び *note
     value: e00. を考慮するようになりました。

     バージョン 3.7 で変更: *note key: dff. と *note value: e00. 、
     *note coded_value: e01. 属性は読み出し専用です。設定には、 *note
     set(): e03. を使用してください。

     バージョン 3.8 で変更: *note samesite: 41cd. 属性がサポートされまし
     た。

     バージョン 3.14 で変更: Added support for the *note partitioned:
     41ce. 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: e02. のキーであるかどうかを判定します。

 -- メソッド: 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(): 41c4. と同じです。

 -- メソッド: Morsel.OutputString (attrs=None)

     Moselの文字列表現をHTTPやJavaScriptで囲まずに出力します。

     'attrs' の意味は *note output(): 41c4. と同じです。

 -- メソッド: 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(): 1289. と同じように振る舞います。

   ---------- 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.23.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.23.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: 41d9. インスタンスがファイルからク
     ッキーを読み込むのに失敗した場合に発生します。 *note LoadError:
     41d8. は *note OSError: 2c2. のサブクラスです。

     バージョン 3.3 で変更: *note LoadError: 41d8. は以前は *note
     IOError: 1262. のサブタイプでしたが、 *note OSError: 2c2. のエイリ
     アスになりました。

以下のクラスが提供されています:

 -- クラス: http.cookiejar.CookieJar (policy=None)

     'policy' は *note CookiePolicy: 41da. インターフェイスを実装するオ
     ブジェクトです。

     *note CookieJar: 3ff9. クラスには HTTP クッキーを保管します。これは
     HTTP リクエストに応じてクッキーを取り出し、それを HTTP レスポンスの
     中で返します。必要に応じて、 ‘CookieJar’ インスタンスは保管されてい
     るクッキーを自動的に破棄します。このサブクラスは、クッキーをファイ
     ルやデータベースに格納したり取り出したりする操作をおこなう役割を負
     っています。

 -- クラス: http.cookiejar.FileCookieJar (filename=None, delayload=None,
          policy=None)

     'policy' は *note CookiePolicy: 41da. インターフェイスを実装するオ
     ブジェクトです。これ以外の引数については、該当する属性の説明を参照
     してください。

     *note FileCookieJar: 41d9. はディスク上のファイルからのクッキーの読
     み込み、もしくは書き込みをサポートします。実際には、 *note load():
     41db. または *note revert(): 41dc. のどちらかのメソッドが呼ばれるま
     でクッキーは指定されたファイルからはロード 'されません' 。このクラ
     スのサブクラスは *note FileCookieJar のサブクラスと web
     ブラウザとの連携: 41dd. 節で説明します。

     これは直接初期化されるべきではありません。以下のサブクラスを代わり
     に使用してください。

     バージョン 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: 886. でない場合、クッキーを受けと
     り、返すのはこのシーケンスのドメインに限定されます。
     'secure_protocols' は、安全なクッキーを追加できるプロトコルのシーケ
     ンスです。デフォルトでは、 'https' と 'wss' (secure websocket) が安
     全なプロトコルとみなされます。これ以外の引数については *note
     CookiePolicy: 41da. および *note DefaultCookiePolicy: 1e51. オブジ
     ェクトの説明をごらんください。

     *note DefaultCookiePolicy: 1e51. は Netscape および RFC 2965(4) ク
     ッキーの標準的な許可 / 拒絶のルールを実装しています。デフォルトでは
     、 RFC 2109(5) のクッキー (‘Set-Cookie’ の version クッキー属性が 1
     で受けとられるもの) は RFC 2965 のルールで扱われます。しかし、RFC
     2965 処理が無効に設定されているか *note rfc2109_as_netscape: 41de.
     が ‘True’ の場合、RFC 2109 クッキーは *note CookieJar: 3ff9. インス
     タンスによって *note Cookie: 41df. のインスタンスの ‘version’ 属性
     を 0 に設定する事で Netscapeクッキーに「ダウングレード」されます。
     また ‘DefaultCookiePolicy’ にはいくつかの細かいポリシー設定をおこな
     うパラメータが用意されています。

 -- クラス: 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 ‘Cookie’ instances.  Instead, if necessary,
     call ‘make_cookies()’ on a *note CookieJar: 3ff9. instance.

参考
....

*note urllib.request: 112. モジュール

     クッキーの自動処理をおこない 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.23.19.1 CookieJar および FileCookieJar オブジェクト
.....................................................

*note CookieJar: 3ff9. オブジェクトは保管されている *note Cookie: 41df.
オブジェクトをひとつずつ取り出すための、 *note イテレータ: 4c8. プロトコ
ルをサポートしています。

*note CookieJar: 3ff9. は以下のようなメソッドを持っています:

 -- メソッド: CookieJar.add_cookie_header (request)

     'request' に正しい ‘Cookie’ ヘッダを追加します。

     ポリシーが許すようであれば (*note CookieJar: 3ff9. の *note
     CookiePolicy: 41da. インスタンスにある属性のうち、 ‘rfc2965’ および
     ‘hide_cookie2’ がそれぞれ真と偽であるような場合)、必要に応じて
     ‘Cookie2’ ヘッダも追加されます。

     'request' オブジェクト (通常は *note urllib.request.Request: 11de.
     インスタンス) は、 *note urllib.request: 112. のドキュメントに記さ
     れているように、メソッド ‘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: 3ff9. 内に保管します。

     *note CookieJar: 3ff9. は 'response' 引数の中から許可されている
     ‘Set-Cookie’ および ‘Set-Cookie2’ ヘッダを探しだし、適切に (*note
     CookiePolicy.set_ok(): 41e4. メソッドの承認におうじて) クッキーを保
     管します。

     'response' オブジェクト (通常は *note urllib.request.urlopen():
     309. あるいはそれに類似する呼び出しによって得られます) は ‘info()’
     メソッドをサポートしている必要があります。これは *note
     email.message.Message: 581. メソッドのあるオブジェクトを返すもので
     す。

     'request' オブジェクト (通常は *note urllib.request.Request: 11de.
     インスタンス) は *note urllib.request: 112. のドキュメントに記され
     ているように、メソッド ‘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: 41da. インスタンスを指定します。

 -- メソッド: CookieJar.make_cookies (response, request)

     'response' オブジェクトから得られた *note Cookie: 41df. オブジェク
     トからなるシーケンスを返します。

     'response' および 'request' 引数で要求されるインスタンスについては
     、 *note extract_cookies(): 41e3. の説明を参照してください。

 -- メソッド: CookieJar.set_cookie_if_ok (cookie, request)

     ポリシーが許すのであれば、与えられた *note Cookie: 41df. を設定しま
     す。

 -- メソッド: CookieJar.set_cookie (cookie)

     与えられた *note Cookie: 41df. を、それが設定されるべきかどうかのポ
     リシーのチェックを行わずに設定します。

 -- メソッド: 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: 41d9. は以下のようなメソッドを実装しています
:

 -- メソッド: FileCookieJar.save (filename=None, ignore_discard=False,
          ignore_expires=False)

     クッキーをファイルに保存します。

     この基底クラスは *note NotImplementedError: 369. を発生させます。サ
     ブクラスはこのメソッドを実装しないままにしておいてもかまいません。

     'filename' はクッキーを保存するファイルの名前です。 'filename' が指
     定されない場合、 ‘self.filename’ が使用されます (このデフォルト値は
     、それが存在する場合は、コンストラクタに渡されています)。
     ‘self.filename’ も *note None: 886. の場合は *note ValueError: 2ee.
     が発生します。

     'ignore_discard' : 破棄されるよう指示されていたクッキーでも保存しま
     す。'ignore_expires' : 期限の切れたクッキーでも保存します。

     ここで指定されたファイルがもしすでに存在する場合は上書きされるため
     、以前にあったクッキーはすべて消去されます。保存したクッキーはあと
     で *note load(): 41db. または *note revert(): 41dc. メソッドを使っ
     て復元することができます。

 -- メソッド: FileCookieJar.load (filename=None, ignore_discard=False,
          ignore_expires=False)

     ファイルからクッキーを読み込みます。

     それまでのクッキーは新しいものに上書きされない限り残ります。

     ここでの引数の値は *note save(): 41eb. と同じです。

     名前のついたファイルはこのクラスがわかるやり方で指定する必要があり
     ます。さもないと *note LoadError: 41d8. が発生します。さらに、例え
     ばファイルが存在しないような時に *note OSError: 2c2. が発生する場合
     があります。

     バージョン 3.3 で変更: 以前は *note IOError: 1262. が送出されました
     ; それは現在 *note OSError: 2c2. のエイリアスです。

 -- メソッド: FileCookieJar.revert (filename=None, ignore_discard=False,
          ignore_expires=False)

     すべてのクッキーを破棄し、保存されているファイルから読み込み直しま
     す。

     *note revert(): 41dc. は *note load(): 41db. と同じ例外を発生させる
     事ができます。失敗した場合、オブジェクトの状態は変更されません。

*note FileCookieJar: 41d9. インスタンスは以下のような公開の属性をもって
います:

 -- の属性: FileCookieJar.filename

     クッキーを保存するデフォルトのファイル名を指定します。この属性には
     代入することができます。

 -- の属性: FileCookieJar.delayload

     真であれば、クッキーを読み込むさいにディスクから遅延読み込みします
     。この属性には代入することができません。この情報は単なるヒントであ
     り、 (ディスク上のクッキーが変わらない限りは) インスタンスのふるま
     いには影響を与えず、パフォーマンスのみに影響します。 *note
     CookieJar: 3ff9. オブジェクトはこの値を無視することもあります。標準
     ライブラリに含まれている *note FileCookieJar: 41d9. クラスで遅延読
     み込みをおこなうものはありません。


File: python.info,  Node: FileCookieJar のサブクラスと web ブラウザとの連携,  Next: CookiePolicy オブジェクト,  Prev: CookieJar および FileCookieJar オブジェクト,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.23.19.2 FileCookieJar のサブクラスと web ブラウザとの連携
...........................................................

クッキーの読み書きのために、以下の *note CookieJar: 3ff9. サブクラスが提
供されています。

 -- クラス: http.cookiejar.MozillaCookieJar (filename=None,
          delayload=None, policy=None)

     Mozilla の ‘cookies.txt’ ファイル形式 (この形式はまた curl や Lynx
     と Netscape ブラウザによっても使われています) でディスクにクッキー
     を読み書きするための *note FileCookieJar: 41d9. です。

          注釈: このクラスは RFC 2965(1) クッキーに関する情報を失います
          。また、より新しいか、標準でない ‘port’ などのクッキー属性につ
          いての情報も失います。

          警告: もしクッキーの損失や欠損が望ましくない場合は、クッキーを
          保存する前にバックアップを取っておくようにしてください (ファイ
          ルへの読み込み / 保存をくり返すと微妙な変化が生じる場合があり
          ます)。

     また、Mozilla の起動中にクッキーを保存すると、Mozilla によって内容
     が破壊されてしまうことにも注意してください。

 -- クラス: http.cookiejar.LWPCookieJar (filename=None, delayload=None,
          policy=None)

     libwww-perl のライブラリである ‘Set-Cookie3’ ファイル形式でディスク
     にクッキーを読み書きするための *note FileCookieJar: 41d9. です。こ
     れはクッキーを人間に可読な形式で保存するのに向いています。

     バージョン 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.23.19.3 CookiePolicy オブジェクト
...................................

*note CookiePolicy: 41da. インターフェイスを実装するオブジェクトは以下の
ようなメソッドを持っています:

 -- メソッド: CookiePolicy.set_ok (cookie, request)

     クッキーがサーバから受け入れられるべきかどうかを表わす boolean 値を
     返します。

     'cookie' は *note Cookie: 41df. インスタンスです。 'request' は
     *note CookieJar.extract_cookies(): 41e3. の説明で定義されているイン
     ターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.return_ok (cookie, request)

     クッキーがサーバに返されるべきかどうかを表わす boolean 値を返します
     。

     'cookie' は *note Cookie: 41df. インスタンスです。 'request' は
     *note CookieJar.add_cookie_header(): 41e2. の説明で定義されているイ
     ンターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.domain_return_ok (domain, request)

     与えられたクッキーのドメインに対して、そこにクッキーを返すべきでな
     い場合には ‘False’ を返します。

     このメソッドは高速化のためのものです。これにより、すべてのクッキー
     をある特定のドメインに対してチェックする (これには多数のファイル読
     みこみを伴なう場合があります) 必要がなくなります。 *note
     domain_return_ok(): 41f4. および *note path_return_ok(): 41f5. の両
     方から true が返された場合、すべての決定は *note return_ok(): 41f3.
     に委ねられます。

     もし、このクッキードメインに対して *note domain_return_ok(): 41f4.
     が true を返すと、つぎにそのクッキーのパス名に対して *note
     path_return_ok(): 41f5. が呼ばれます。そうでない場合、そのクッキー
     ドメインに対する ‘path_return_ok()’ および *note return_ok(): 41f3.
     は決して呼ばれることはありません。 ‘path_return_ok()’ が true を返
     すと、 ‘return_ok()’ がその *note Cookie: 41df. オブジェクト自身の
     全チェックのために呼ばれます。そうでない場合、そのクッキーパス名に
     対する ‘return_ok()’ は決して呼ばれることはありません。

     注意: *note domain_return_ok(): 41f4. は 'request' ドメインだけでは
     なく、すべての 'cookie' ドメインに対して呼ばれます。たとえば
     request ドメインが ‘"www.example.com"’ だった場合、この関数は
     ‘".example.com"’ および ‘"www.example.com"’ の両方に対して呼ばれる
     ことがあります。同じことは *note path_return_ok(): 41f5. にもいえま
     す。

     'request' 引数は *note return_ok(): 41f3. で説明されているとおりで
     す。

 -- メソッド: CookiePolicy.path_return_ok (path, request)

     与えられたクッキーのパス名に対して、そこにクッキーを返すべきでない
     場合には ‘False’ を返します。

     *note domain_return_ok(): 41f4. の説明を参照してください。

上のメソッドの実装にくわえて、 *note CookiePolicy: 41da. インターフェイ
スの実装では以下の属性を設定する必要があります。これはどのプロトコルがど
のように使われるべきかを示すもので、これらの属性にはすべて代入することが
許されています。

 -- の属性: CookiePolicy.netscape

     Netscape プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.rfc2965

     RFC 2965(1) プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.hide_cookie2

     ‘Cookie2’ ヘッダをリクエストに含めないようにします (このヘッダが存
     在する場合、私たちは RFC 2965(2) クッキーを理解するということをサー
     バに示すことになります)。

もっとも有用な方法は、 *note DefaultCookiePolicy: 1e51. をサブクラス化し
た *note CookiePolicy: 41da. クラスを定義して、いくつか (あるいはすべて)
のメソッドをオーバーライドすることでしょう。 ‘CookiePolicy’ 自体はどのよ
うなクッキーも受け入れて設定を許可する「ポリシー無し」ポリシーとして使う
こともできます (これが役に立つことはあまりありませんが)。

   ---------- 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.23.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: 41da. インターフェイスを実装するのに必要な機能に加え
て、このクラスではクッキーを受けとったり設定したりするドメインを許可した
り拒絶したりできるようになっています。ほかにも、 Netscape プロトコルのか
なり緩い規則をややきつくするために、いくつかの厳密性のスイッチがついてい
ます (いくつかの良性クッキーをブロックする危険性もありますが)。

ドメインの拒否リストや許可リストも提供されています (デフォルトではどちら
もオフです)。拒否リストになく、(許可リストがアクティブなら) 許可リストに
あるドメインのみがクッキーを設定したり返したりできます。コンストラクタの
引数 'blocked_domains' 、および ‘blocked_domains()’ と
‘set_blocked_domains()’ メソッド ( そして 'allowed_domains' に対応する引
数とメソッド) を使ってください。許可リストを設定した場合は、それを *note
None: 886. にすることでオフに戻せます。

拒否あるいは許可リスト中にあるドメインのうち、ドット (.)  で始まっていな
いものは、正確にそれと一致するドメインのクッキーにしか適用されません。た
とえば拒否リスト中のエントリ ‘"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: 1e51. は以下のような追加メソッドを実装してい
ます:

 -- メソッド: DefaultCookiePolicy.blocked_domains ()

     ブロックしているドメインのシーケンスを (タプルとして) 返します。

 -- メソッド: DefaultCookiePolicy.set_blocked_domains (blocked_domains)

     ブロックするドメインを設定します。

 -- メソッド: DefaultCookiePolicy.is_blocked (domain)

     'domain' がクッキーを授受しない拒否リストに載っていれば ‘True’ を返
     します。

 -- メソッド: DefaultCookiePolicy.allowed_domains ()

     *note None: 886. あるいは明示的に許可されているドメインを (タプルと
     して) 返します。

 -- メソッド: DefaultCookiePolicy.set_allowed_domains (allowed_domains)

     許可するドメイン、あるいは *note None: 886. を設定します。

 -- メソッド: DefaultCookiePolicy.is_not_allowed (domain)

     'domain' がクッキーを授受する許可リストに載っていれば ‘True’ を返し
     ます。

*note DefaultCookiePolicy: 1e51. インスタンスは以下の属性をもっています
。これらはすべてコンストラクタから同じ名前の引数をつかって初期化すること
ができ、代入してもかまいません。

 -- の属性: DefaultCookiePolicy.rfc2109_as_netscape

     真の場合、 *note CookieJar: 3ff9. のインスタンスに RFC 2109(2) クッ
     キー (即ち ‘Set-Cookie’ ヘッダのクッキー属性 Version の値が 1 のク
     ッキー) を Netscapeクッキーへ、 *note Cookie: 41df. インスタンスの
     version 属性を 0 に設定する事でダウングレードするように要求します。
     デフォルトの値は *note None: 886. であり、この場合 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: 4204. 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.23.19.5 Cookieオブジェクト
............................

*note Cookie: 41df. 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: 41da. メソッド内でのごくわずかな例外を除けば、これら
の属性に代入する必要はないはずです。このクラスは内部の一貫性を保つように
はしていないため、代入するのは自分のやっていることを理解している場合のみ
にしてください。

 -- の属性: Cookie.version

     Integer or *note None: 886.  Netscape cookies have *note version:
     420d. 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
     ‘version’ is 0.

 -- の属性: Cookie.name

     クッキーの名前 (文字列)。

 -- の属性: Cookie.value

     クッキーの値 (文字列)、あるいは *note None: 886. 。

 -- の属性: Cookie.port

     ポートあるいはポートの集合をあらわす文字列 (例: '80' または
     '80,8080')、あるいは *note None: 886. 。

 -- の属性: Cookie.domain

     クッキーのドメイン (文字列) 。

 -- の属性: Cookie.path

     クッキーのパス名 (文字列、例: ‘'/acme/rocket_launchers'’)。

 -- の属性: Cookie.secure

     そのクッキーを返せるのがセキュアな接続のみならば ‘True’ を返します
     。

 -- の属性: Cookie.expires

     クッキーの期限が切れる日時をあわらす整数 (エポックから経過した秒数
     )、あるいは *note None: 886. 。 *note is_expired(): 4215. も参照し
     てください。

 -- の属性: Cookie.discard

     これがセッションクッキーであれば ‘True’ を返します。

 -- の属性: Cookie.comment

     このクッキーの働きを説明する、サーバからのコメント文字列、あるいは
     *note None: 886. 。

 -- の属性: Cookie.comment_url

     このクッキーの働きを説明する、サーバからのコメントのリンク URL、あ
     るいは *note None: 886. 。

 -- の属性: 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: 420d. 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: 41df. クラスは以下のメソッドも定義しています:

 -- メソッド: 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.23.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: 1e51. の使用例です。 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.23.20 ‘xmlrpc’ -- XMLRPC サーバーとクライアントモジュール群
-------------------------------------------------------------

XML-RPC は HTTP 経由の XML を使って遠隔手続き呼び出し (Remote Procedure
Call) を実現する方法です。XML-RPC を使うと、クライアントはリモートサーバ
ー (サーバーは URI で名前付けられます) 上のメソッドを引数付きで呼び出し
て、構造化されたデータを受け取る事ができます。

‘xmlrpc’ パッケージは XML-RPC のサーバーとクライアントを実装したモジュー
ルを持っています。モジュール一覧:

   * *note xmlrpc.client: 135.

   * *note xmlrpc.server: 136.


File: python.info,  Node: xmlrpc client --- XML-RPC クライアントアクセス,  Next: xmlrpc server --- 基本的な XML-RPC サーバー,  Prev: xmlrpc --- XMLRPC サーバーとクライアントモジュール群,  Up: インターネットプロトコルとサポート

5.23.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: 3d91.

バージョン 3.5 で変更: For HTTPS URIs, ‘xmlrpc.client’ now performs all
the necessary certificate and hostname checks by default.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

 -- クラス: 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: c50. は、リモートの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: 199.  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: 193.
     objects; this flag is false by default.  ‘datetime.datetime’,
     ‘bytes’ and *note bytearray: 342. 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: 355. 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: 3c1.
                                
                                
     ‘int’, ‘i1’, ‘i2’, ‘i4’,   *note int: 19c. in range from -2147483648 to 2147483647.
     ‘i8’ または ‘biginteger’   Values get the ‘<int>’ tag.
                                
                                
     ‘double’ または ‘float’    *note float: 197.  Values get the ‘<double>’ tag.
                                
                                
     ‘string’                   *note str: 16a.
                                
                                
     ‘array’                    適合する要素を持つ *note list: 24f. または
                                *note tuple: 614.。array は ‘list’ として返します。
                                
                                
     ‘struct’                   *note dict: 184. 。キーは文字列のみ。全ての値は変換可能で
                                なくてはならない。ユーザー定義型を渡すこともできます。
                                *note __dict__: 77d. の属性のみ転送されます。
                                
                                
     ‘dateTime.iso8601’         *note DateTime: 1601. または
                                *note datetime.datetime: 4e2.。返される型は
                                'use_builtin_types' および 'use_datetime' の値に依ります
                                。
                                
                                
     ‘base64’                   *note Binary: 4227.、 *note bytes: 193. または
                                *note bytearray: 342.。返される型は 'use_builtin_types' フ
                                ラグの値に依ります。
                                
                                
     ‘nil’                      ‘None’ 定数。 'allow_none' が真の場合にのみ渡すことが出来
                                ます。
                                
                                
     ‘bigdecimal’               *note decimal.Decimal: 200.  Returned type only.
                                

     上記のXML-RPCでサポートする全データ型を使用することができます。メソ
     ッド呼び出し時、XML- RPCサーバエラーが発生すると *note Fault: 4228.
     インスタンスを送出し、HTTP/HTTPSトランスポート層でエラーが発生した
     場合には *note ProtocolError: 4229. を送出します。 ‘Error’ をベース
     とする ‘Fault’ と ‘ProtocolError’ の両方が発生します。現在のところ
     xmlrpclibでは組み込み型のサブクラスのインスタンスをマーシャルするこ
     とはできません。

     文字列を渡す場合、 ‘<’, ‘>’, ‘&’ などのXMLで特殊な意味を持つ文字は
     自動的にエスケープされます。しかし、ASCII値0〜31の制御文字(もちろん
     、タブ'TAB',改行'LF',リターン'CR'は除く)などのXMLで使用することので
     きない文字を使用することはできず、使用するとそのXML-RPCリクエストは
     well-formedなXMLとはなりません。そのようなバイト列を渡す必要がある
     場合は、 *note bytes: 193, *note bytearray: 342. クラスまたは後述の
     *note Binary: 4227. ラッパークラスを使用してください。

     ‘Server’ は、後方互換性の為に *note ServerProxy: c50. の別名として
     残されています。新しいコードでは ‘ServerProxy’ を使用してください。

     バージョン 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.23.21.1 ServerProxy オブジェクト
..................................

A *note ServerProxy: c50. instance has a method corresponding to each
remote procedure call accepted by the XML-RPC server.  Calling the
method performs an RPC, dispatched by both name and argument signature
(e.g.  the same method name can be overloaded with multiple argument
signatures).  The RPC finishes by returning a value, which may be either
returned data in a conformant type or a *note Fault: 4228. or *note
ProtocolError: 4229. object indicating an error.

予約属性 ‘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: c50. support the
*note context manager: 1e3. 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.23.21.2 DateTime オブジェクト
...............................

 -- クラス: xmlrpc.client.DateTime

     このクラスは、エポックからの秒数、タプルで表現された時刻、ISO 8601形
     式の時間/日付文字列、 *note datetime.datetime: 4e2, のインスタンス
     のいずれかで初期化することができます。このクラスには以下のメソッド
     があり、主にコードをマーシャル/アンマーシャルするための内部処理を行
     います:

      -- メソッド: decode (string)

          文字列をインスタンスの新しい時間を示す値として指定します。

      -- メソッド: encode (out)

          出力ストリームオブジェクト 'out' に、XML-RPCエンコーディングの
          *note DateTime: 1601. 値を出力します。

     It also supports certain of Python's built-in operators through
     *note rich comparison: 14bc. and *note __repr__(): 82f. methods.

以下は、動作する例です。サーバ側のコード:

     import datetime as dt
     from xmlrpc.server import SimpleXMLRPCServer
     import xmlrpc.client

     def today():
         today = dt.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 as dt

     proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")

     today = proxy.today()
     # convert the ISO 8601 string to a datetime object
     converted = dt.datetime.strptime(today.value, "%Y%m%dT%H:%M:%S")
     print(f"Today: {converted.strftime('%d.%m.%Y, %H:%M')}")


File: python.info,  Node: Binary オブジェクト,  Next: Fault オブジェクト,  Prev: DateTime オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.23.21.3 Binary オブジェクト
.............................

 -- クラス: xmlrpc.client.Binary

     このクラスは、バイト列データ(NULを含む)で初期化することができます。
     *note Binary: 4227. の内容は、属性で参照します:

      -- の属性: data

          *note Binary: 4227. インスタンスがカプセル化しているバイナリデ
          ータ。このデータは *note bytes: 193. オブジェクトです。

     *note Binary: 4227. オブジェクトは以下のメソッドを持ち、主に内部的
     にマーシャル/アンマーシャル時に使用されます:

      -- メソッド: decode (bytes)

          指定されたbase64 *note bytes: 193. オブジェクトをデコードし、
          インスタンスのデータとします。

      -- メソッド: 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__(): cf6. and *note __ne__(): 1735. 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.23.21.4 Fault オブジェクト
............................

 -- クラス: xmlrpc.client.Fault

     *note Fault: 4228. オブジェクトは、XML-RPCのfaultタグの内容をカプセ
     ル化しており、以下の属性を持ちます:

      -- の属性: faultCode

          失敗のタイプを示す整数。

      -- の属性: faultString

          失敗の診断メッセージを含む文字列。

以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意に *note
Fault: 4228. を起こしています。

     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.23.21.5 ProtocolError オブジェクト
....................................

 -- クラス: xmlrpc.client.ProtocolError

     *note ProtocolError: 4229. オブジェクトはトランスポート層で発生した
     エラー(URI で指定したサーバが見つからなかった場合に発生する404 'not
     found'など)の内容を示し、以下の属性を持ちます:

      -- の属性: url

          エラーの原因となったURIまたはURL。

      -- の属性: errcode

          エラーコード。

      -- の属性: errmsg

          エラーメッセージまたは診断文字列。

      -- の属性: headers

          エラーの原因となったHTTP/HTTPSリクエストを含む辞書。

次の例では、不適切な URI を利用して、故意に *note ProtocolError: 4229. を
発生させています:

     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.23.21.6 MultiCall オブジェクト
................................

*note MultiCall: 4243. オブジェクトは遠隔のサーバに対する複数の呼び出し
をひとつのリクエストにカプセル化する方法を提供します (1)。

 -- クラス: xmlrpc.client.MultiCall (server)

     Create an object used to boxcar method calls.  'server' is the
     eventual target of the call.  Calls can be made to the result
     object, but they will immediately return ‘None’, and only store the
     call name and parameters in the ‘MultiCall’ object.  Calling the
     object itself causes all stored calls to be transmitted as a single
     ‘system.multicall’ request.  The result of this call is a *note
     generator: 1270.; iterating over this generator yields the
     individual results.

以下は、このクラスの使用例です。サーバ側のコード:

     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.23.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: 4228. 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: 886. 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: 4228. 例外を送出します。 'use_builtin_types' フラグは
     *note datetime.datetime: 4e2. のオブジェクトとして日付/時刻を、
     *note bytes: 193. のオブジェクトとしてバイナリデータを表現する時に
     使用し、デフォルトでは 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.23.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.23.21.9 クライアントとサーバーの利用例
........................................

*note SimpleXMLRPCServer example: 4248. を参照してください。

脚注
....


File: python.info,  Node: xmlrpc server --- 基本的な XML-RPC サーバー,  Next: ipaddress --- IPv4/IPv6 操作ライブラリ,  Prev: xmlrpc client --- XML-RPC クライアントアクセス,  Up: インターネットプロトコルとサポート

5.23.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: 424c, or embedded in a CGI environment, using
*note CGIXMLRPCRequestHandler: 424d.

     警告: The ‘xmlrpc.server’ module is not secure against maliciously
     constructed data.  If you need to parse untrusted or
     unauthenticated data, see *note XML security: 3d91.

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

 -- クラス: 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: 1543.
     です。 引数 'addr' と 'requestHandler' は *note
     socketserver.TCPServer: 153b. のコンストラクターに渡されます。
     'logRequests' が真の場合 (デフォルト)、 リクエストはログに記録され
     ます。 この引数を偽にするとはログは記録されません。 引数
     'allow_none' と 'encoding' は *note xmlrpc.client: 135. に渡され、
     サーバーが返す XML-RPC 応答を制御します。 'bind_and_activate' 引数
     はコンストラクタが直ちに ‘server_bind()’ と ‘server_activate()’ を
     呼ぶかどうかを制御します。デフォルトでは真です。 この引数に ‘False’
     を設定することで、アドレスを束縛する前に 'allow_reuse_address' クラ
     ス変数を操作することが出来ます。 'use_builtin_types' 引数は *note
     loads(): 1653. 関数に渡されます。 この引数は日付/時刻の値やバイナリ
     データを受け取ったときにどの型が処理されるかを制御します。デフォル
     トでは偽です。

     バージョン 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: 135. に渡され
     、サーバーが返す XML-RPC 応答を制御します。 'use_builtin_types' 引
     数は *note loads(): 1653. 関数に渡されます。 この引数は日付/時刻の
     値やバイナリデータを受け取ったときにどの型が処理されるかを制御しま
     す。デフォルトは偽です。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.SimpleXMLRPCRequestHandler

     リクエストハンドラーインスタンスを新たに作成します。このリクエスト
     ハンドラーは ‘POST’ リクエストをサポートし、 *note
     SimpleXMLRPCServer: 424c. コンストラクターの引数 'logRequests' に従
     ってログ出力を行います。

* Menu:

* SimpleXMLRPCServer objects::
* CGIXMLRPCRequestHandler::
* XMLRPC サーバの文書化::
* DocXMLRPCServer objects::
* DocCGIXMLRPCRequestHandler::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/xmlrpc/server.py


File: python.info,  Node: SimpleXMLRPCServer objects,  Next: CGIXMLRPCRequestHandler,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.1 SimpleXMLRPCServer objects
....................................

*note SimpleXMLRPCServer: 424c. クラスは *note socketserver.TCPServer:
153b. のサブクラスで、基本的なスタンドアロンの XML-RPC サーバーを作成す
る手段を提供します。

 -- メソッド: SimpleXMLRPCServer.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 14f0. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 14f0. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 4250. はデコレー
     ターとして使用できます。

 -- メソッド: SimpleXMLRPCServer.register_instance (instance,
          allow_dotted_names=False)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 4250. を使用して登録されていないメソッド名を公
     開するのに使われます。 '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 example::


File: python.info,  Node: SimpleXMLRPCServer example,  Up: SimpleXMLRPCServer objects

5.23.22.2 SimpleXMLRPCServer example
....................................

サーバーのコード:

     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 as dt

     class ExampleService:
         def getData(self):
             return '42'

         class currentTime:
             @staticmethod
             def getCurrentTime():
                 return dt.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 objects,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.3 CGIXMLRPCRequestHandler
.................................

*note CGIXMLRPCRequestHandler: 424d. クラスは、Python の CGI スクリプト
に送られた XML-RPC リクエストを処理するときに使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 14f0. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 14f0. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 4257. はデコレー
     ターとして使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_instance (instance)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 4257. を使用して登録されていないメソッド名を公
     開するのに使われます。 '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 objects,  Prev: CGIXMLRPCRequestHandler,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.4 XMLRPC サーバの文書化
...............................

これらのクラスは HTTP GET 要求への応答内で HTML 文書となるよう上記クラス
を拡張します。 サーバは独立していても CGI 環境に埋め込まれていてもかまい
ません。 前者では *note DocXMLRPCServer: 1e03. を、後者では *note
DocCGIXMLRPCRequestHandler: 425d. を使用します。

 -- クラス: xmlrpc.server.DocXMLRPCServer (addr,
          requestHandler=DocXMLRPCRequestHandler, logRequests=True,
          allow_none=False, encoding=None, bind_and_activate=True,
          use_builtin_types=True)

     サーバ・インスタンスを新たに生成します。全ての引数の意味は *note
     SimpleXMLRPCServer: 424c. のものと同じですが、 'requestHandler' の
     デフォルトは *note DocXMLRPCRequestHandler: 425e. になっています。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.DocCGIXMLRPCRequestHandler

     CGI環境で XMR-RPC リクエストを処理するインスタンスを新たに生成しま
     す。

 -- クラス: xmlrpc.server.DocXMLRPCRequestHandler

     リクエスト・ハンドラのインスタンスを新たに生成します。このリクエス
     ト・ハンドラは XML-RPC POST 要求とドキュメントの GET 要求をサポート
     し、 *note DocXMLRPCServer: 1e03. コンストラクタに与えられた引数
     'logRequests' を優先するためにロギングを変更します。


File: python.info,  Node: DocXMLRPCServer objects,  Next: DocCGIXMLRPCRequestHandler,  Prev: XMLRPC サーバの文書化,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.5 DocXMLRPCServer objects
.................................

*note DocXMLRPCServer: 1e03. は *note SimpleXMLRPCServer: 424c. の派生ク
ラスで、自己文書化するスタンドアローン 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 objects,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.23.22.6 DocCGIXMLRPCRequestHandler
....................................

*note DocCGIXMLRPCRequestHandler: 425d. は *note
CGIXMLRPCRequestHandler: 424d. の派生クラスで、自己文書化する 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.23.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モジュールの紹介: 426b. を参照してください。

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.23.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: 2ee. を発生させます。

          >>> 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' は ‘IPv4Network’ か ‘IPv6Network’
     のコンストラクタに渡されます。 'address' が正しい IPv4, IPv6 アドレ
     スを表現していない場合や、ネットワークの host bit がセットされてい
     た場合は *note ValueError: 2ee. を発生させます。

          >>> ipaddress.ip_network('192.168.0.0/28')
          IPv4Network('192.168.0.0/28')

 -- の関数: ipaddress.ip_interface (address)

     引数に渡された IP address に応じて、 *note IPv4Interface: 1bf6. か
     *note IPv6Interface: 1bf7. のオブジェクトを返します。 'address' は
     IP ネットワークを示す文字列あるいは整数です。 IPv4 か IPv6 のネット
     ワークを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4 ア
     ドレスだと判断されます。 'address' が正しい IPv4, IPv6 アドレスを表
     現していない場合は *note ValueError: 2ee. を発生させます。

これらの便利関数を利用するデメリットとして、IPv4 と IPv6 両方のフォーマ
ットを扱う必要性があるために、どちらを期待されていたのかを知ることができ
ず、エラーメッセージが最小限の情報しか提供できないことです。利用したいバ
ージョンの特定のコンストラクタを直接呼ぶことで、より詳細なエラーレポート
を得ることができます。


File: python.info,  Node: IP アドレス,  Next: IP ネットワーク定義,  Prev: 便利なファクトリ関数,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.23.23.2 IP アドレス
.....................

* Menu:

* Address オブジェクト::
* 文字列と整数への変換::
* 演算子: 演算子<2>.


File: python.info,  Node: Address オブジェクト,  Next: 文字列と整数への変換,  Up: IP アドレス

5.23.23.3 Address オブジェクト
..............................

*note IPv4Address: 50c. と *note IPv6Address: 50d. オブジェクトは多くの
共通した属性を持っています。両方の IP バージョンを扱うコードを書きやすく
するために、IPv6 アドレスでしか意味が無いいくつかの属性も ‘IPv4Address’
オブジェクトに実装されています。アドレスオブジェクトは *note hashable:
824. なので、辞書のキーとして利用できます。

 -- クラス: ipaddress.IPv4Address (address)

     IPv4 アドレスを構築する。 'address' が正しい IPv4 アドレスでない場
     合、 *note AddressValueError: 4272. を発生させます。

     以下のものが正しい 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: 193. オブジェクトに (最上位オクテットが
          最初になるように) パックされた整数。

          >>> 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(): b5f.

      -- の属性: 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:
          193. オブジェクト(最上位オクテットが先頭)。 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: 4279.):

                    address.is_private == address.ipv4_mapped.is_private

          ‘is_private’ has value opposite to *note is_global: 1165,
          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: 4279.):

               address.is_global == address.ipv4_mapped.is_global

          ‘is_global’ has value opposite to *note is_private: 1a20,
          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: 1a20. 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: 427c. & RFC 3879(11)).

      -- の属性: is_loopback

          ループバックアドレスである場合に ‘True’.  RFC 3330(12) (IPv4)
          か RFC 2373(13) (IPv6) を参照。

      -- の属性: is_link_local

          アドレスがリンクローカル用に予約されいている場合に ‘True’.
          RFC 3927(14) を参照。

      -- の属性: ipv6_mapped

          ‘IPv4Address’ 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(): 16a, ‘'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: 4272. を発生させます。

     以下のものが正しい 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: 193. オブ
          ジェクトにパックされた整数。

          >>> 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: 1a20. を利用してください。

      -- の属性: ipv4_mapped

          For addresses that appear to be IPv4 mapped addresses in the
          range ‘::FFFF:0:0/96’ as defined by RFC 4291(20), this
          property reports the embedded IPv4 address.  For any other
          address, this property will be ‘None’.

      -- の属性: scope_id

          For scoped addresses as defined by RFC 4007(21), 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(22) で定義された 6to4 (‘2002::/16’ で始まる)アドレス
          の場合、このプロパティは埋め込まれた IPv4 Address を返します。
          それ以外のアドレスに対しては、このプロパティは ‘None’ になりま
          す。

      -- の属性: teredo

          RFC 4380(23) で定義された 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/rfc4291.html

   (21) https://datatracker.ietf.org/doc/html/rfc4007.html

   (22) https://datatracker.ietf.org/doc/html/rfc3056.html

   (23) https://datatracker.ietf.org/doc/html/rfc4380.html


File: python.info,  Node: 文字列と整数への変換,  Next: 演算子<2>,  Prev: Address オブジェクト,  Up: IP アドレス

5.23.23.4 文字列と整数への変換
..............................

socket モジュールなどのネットワークインターフェースを利用するには、アド
レスを文字列や整数に変換しなければなりません。これには組み込みの *note
str(): 16a. と *note int(): 19c. 関数を利用します:

     >>> 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.23.23.5 演算子
................

Address オブジェクトはいくつかの演算子をサポートします。明記されない限り
、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) での
み利用できます。

* Menu:

* 比較演算子::
* 算術演算::


File: python.info,  Node: 比較演算子,  Next: 算術演算,  Up: 演算子<2>

5.23.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.23.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.23.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.23.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.23.23.10 Network オブジェクト
...............................

address オブジェクトで実装されていた属性は全て network オブジェクトにも
実装されています。 network はそれに追加で幾つかの属性を実装しています。
全ての追加属性は *note IPv4Network: 50e. と *note IPv6Network: 50f. で共
通なので、重複を避けるために ‘IPv4Network’ にだけドキュメントされていま
す。ネットワークオブジェクトは *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: 193. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の '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: 4272. 例外を発生させます。マスクが IPv4 アドレス
     に対して有効でない場合に *note NetmaskValueError: 4293. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 2ee. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     特に明記されない場合、他の network や address を受け取る network の
     メソッドは、引数の IP バージョンが ‘self’ と異なる場合に *note
     TypeError: 199. を発生させます。

     バージョン 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: 2ee. 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: 193. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の '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: 4272. 例外を発生させます。マスクが IPv6 アドレス
     に対して有効でない場合に *note NetmaskValueError: 4293. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 2ee. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     バージョン 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.23.23.11 演算子
.................

Network オブジェクトはいくつかの演算子をサポートします。明記されない限り
、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) での
み利用できます。

* Menu:

* 論理演算子::
* イテレーション::
* アドレスのコンテナとしてのネットワーク::


File: python.info,  Node: 論理演算子,  Next: イテレーション,  Up: 演算子<3>

5.23.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.23.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(): 181c. 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.23.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.23.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.

     ‘IPv4Interface’ 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: 1bf7. 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: 1bf6. の対応する属性のドキュメントを参照
          してください。

* Menu:

* 演算子: 演算子<4>.


File: python.info,  Node: 演算子<4>,  Up: インターフェイスオブジェクト

5.23.23.16 演算子
.................

Interface オブジェクトはいくつかの演算子をサポートします。明記されない限
り、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) で
のみ利用できます。

* Menu:

* 論理演算子: 論理演算子<2>.


File: python.info,  Node: 論理演算子<2>,  Up: 演算子<4>

5.23.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.23.23.18 その他のモジュールレベル関数
.......................................

このモジュールは以下のモジュールレベル関数も提供しています:

 -- の関数: ipaddress.v4_int_to_packed (address)

     アドレスをネットワークバイトオーダー(ビッグエンディアン)でパックさ
     れた4バイトで表現します。 'address' は IPv4 IPアドレスを整数で表し
     たものです。整数が負だったり IPv4 IPアドレスとして大きすぎる場合は
     *note ValueError: 2ee. 例外を発生させます。

          >>> 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: 2ee. 例外を発生させます。

 -- の関数: ipaddress.summarize_address_range (first, last)

     first と last で指定された IPアドレス帯に対するイテレーターを返しま
     す。 'first' はアドレス帯の中の最初の *note IPv4Address: 50c. か
     *note IPv6Address: 50d. で、 'last' はアドレス帯の中の最後の
     ‘IPv4Address’ か ‘IPv6Address’ です。 'first' か 'last' がIPアドレ
     スでない場合や、2つの型が揃っていない場合に、 *note TypeError: 199.
     を発生させます。 'last' が 'first' より大きくない場合や、 'first' ア
     ドレスのバージョンが 4 でも 6 でもない場合は *note ValueError: 2ee.
     を発生させます。

          >>> [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:
     12f5. of ‘IPv4Network’ or ‘IPv6Network’ objects.  A *note
     TypeError: 199. 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(): dcb.

     'obj' はネットワークオブジェクトかアドレスオブジェクトのどちらかで
     す。


File: python.info,  Node: Custom Exceptions,  Prev: その他のモジュールレベル関数,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.23.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.24 マルチメディアサービス
===========================

この章で記述されているモジュールは、主にマルチメディアアプリケーションに
役立つさまざまなアルゴリズムまたはインターフェイスを実装しています。これ
らのモジュールはインストール時の自由裁量に応じて利用できます:

* Menu:

* wave: wave --- WAV ファイルの読み書き. WAV ファイルの読み書き
* colorsys: colorsys --- 色体系間の変換. 色体系間の変換


File: python.info,  Node: wave --- WAV ファイルの読み書き,  Next: colorsys --- 色体系間の変換,  Up: マルチメディアサービス

5.24.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)

     If 'file' is a string, open the file by that name, otherwise treat
     it as a file-like object.  'mode' can be:

     ‘'rb'’

          読み出しのみのモード。

     ‘'wb'’

          書き込みのみのモード。

     WAVファイルに対して読み込み／書き込み両方のモードで開くことはできな
     いことに注意して下さい。

     'mode' が ‘'rb'’ の場合 *note Wave_read: 334. オブジェクトを返し、
     ‘'wb'’ の場合 *note Wave_write: 335. オブジェクトを返します。
     '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 ‘open()’ function may be used in a *note with: 187. statement.
     When the ‘with’ block completes, the *note Wave_read.close(): 42e3.
     or *note Wave_write.close(): 42e4. 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.24.1.1 Wave_read オブジェクト
...............................

 -- クラス: wave.Wave_read

     Read a WAV file.

     *note open(): b49. によって返される 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(): 42ec. を人に判読可能な形にしたものです。
          通常、 ‘'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:
          193. オブジェクトとして返します。

      -- メソッド: rewind ()

          ファイルのポインタをオーディオストリームの先頭に戻します。

     The following two methods are defined for compatibility with the
     old ‘aifc’ module, and don't do anything interesting.

      -- メソッド: getmarkers ()

          Returns ‘None’.

          バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: The
          method only existed for compatibility with the ‘aifc’ module
          which has been removed in Python 3.13.

      -- メソッド: getmark (id)

          Raise an error.

          バージョン 3.13 で非推奨、バージョン 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.24.1.2 Wave_write オブジェクト
................................

 -- クラス: wave.Wave_write

     Write a WAV file.

     Wave_write objects, as returned by *note open(): b49.

     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(): 42f3. or *note
     setparams(): 42f4. with the number of frames that will be written
     before *note close(): 42e4. is called and then using *note
     writeframesraw(): 11f2. to write the frame data, or by calling
     *note writeframes(): 11f3. with all of the frame data to be
     written.  In the latter case ‘writeframes()’ 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)

          チャンネル数を設定します。

      -- メソッド: getnchannels ()

          Return the number of channels.

      -- メソッド: setsampwidth (n)

          サンプルサイズを 'n' バイトに設定します。

      -- メソッド: getsampwidth ()

          Return the sample width in bytes.

      -- メソッド: setframerate (n)

          サンプリングレートを 'n' に設定します。

          バージョン 3.2 で変更: 整数ではない値がこのメソッドに入力され
          た場合は、直近の整数に丸められます。

      -- メソッド: getframerate ()

          Return the frame rate.

      -- メソッド: setnframes (n)

          フレーム数を 'n' に設定します。もし実際に書き込まれたフレーム
          の数と異なるなら、これは後で変更されます (出力ストリームがシー
          ク不能なら、更新しようとした時にエラーが起きます)。

      -- メソッド: getnframes ()

          Return the number of audio frames written so far.

      -- メソッド: setcomptype (type, name)

          圧縮形式とその記述を設定します。現在のところ、非圧縮を示す圧縮
          形式 ‘NONE’ だけがサポートされています。

      -- メソッド: getcomptype ()

          Return the compression type (‘'NONE'’).

      -- メソッド: getcompname ()

          Return the human-readable compression type name.

      -- メソッド: setparams (tuple)

          The 'tuple' should be ‘(nchannels, sampwidth, framerate,
          nframes, comptype, compname)’, with values valid for the
          ‘set*()’ methods.  Sets all parameters.

      -- メソッド: getparams ()

          Return a *note namedtuple(): 4e0. ‘(nchannels, sampwidth,
          framerate, nframes, comptype, compname)’ containing the
          current output parameters.

      -- メソッド: tell ()

          ファイルの中の現在位置を返します。 *note Wave_read.tell():
          42f1. と *note Wave_read.setpos(): 42f0. メソッドでお断りした
          ことがこのメソッドにも当てはまります。

      -- メソッド: writeframesraw (data)

          'nframes' の修正なしにオーディオフレームを書き込みます。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          194. も使用できるようになりました。

      -- メソッド: writeframes (data)

          出力ストリームが seek 不可能で、 'data' が書き込まれた後でそれ
          以前に 'nframes' に設定された値と書き込まれた全フレーム数が一
          致しなければ、エラーを送出します。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          194. も使用できるようになりました。

          *note writeframes(): 11f3. や *note writeframesraw(): 11f2. メ
          ソッドを呼び出したあとで、どんなパラメータを設定しようとしても
          不正となることに注意して下さい。そうすると *note wave.Error:
          42e5. を発生します。


File: python.info,  Node: colorsys --- 色体系間の変換,  Prev: wave --- WAV ファイルの読み書き,  Up: マルチメディアサービス

5.24.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.25 国際化
===========

この章で解説されるモジュールは、プログラムのメッセージで使用される言語を
選択したり、または出力を地域の習慣に従って変更するメカニズムを提供して、
言語やロケールに依存しないソフトの開発を手助けします。

この章で解説されるモジュールのリスト:

* Menu:

* gettext: gettext --- 多言語国際化サービス. 多言語国際化サービス
* locale: locale --- 国際化サービス. 国際化サービス


File: python.info,  Node: gettext --- 多言語国際化サービス,  Next: locale --- 国際化サービス,  Up: 国際化

5.25.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.25.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(): 1687. と同様ですが、指定された 'domain' からメッセ
     ージを探します。

 -- の関数: gettext.ngettext (singular, plural, n, /)

     *note gettext(): 1687. と同様ですが、複数形を考慮しています。 翻訳
     が見つかった場合、複数形の選択公式を 'n' に適用し、その結果得られた
     メッセージを返します (言語によっては二つ以上の複数形があります)。 翻
     訳が見つからなかった場合、 'n' が 1 なら 'singular' を返します; そ
     うでない場合 'plural' を返します。

     複数形の選択公式はカタログのヘッダから取得されます。 選択公式は自由
     変数 'n' を持つ C または Python の式です; その式の評価結果はカタロ
     グにある複数形のインデックスになります。 ‘.po’ ファイルで用いられる
     詳細な文法と、様々な言語における選択公式については GNU gettext ドキ
     ュメント(2) を参照してください。

 -- の関数: gettext.dngettext (domain, singular, plural, n, /)

     *note ngettext(): 4313. と同様ですが、指定された '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(): 4312, *note
     ngettext(): 4313, *note dngettext(): 4314.), 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: 3e4.).  For
this reason, it is always best to call *note bindtextdomain(): 4310.
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.25.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: 4319. 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(): 4311. と同じく、 'domain' を引数にとります。オ
     プションの 'localedir' は *note bindtextdomain(): 4310. と同じです
     。またオプションの 'languages' は文字列を列挙したリストで、各文字列
     は言語コードを表します。

     'localedir' が与えられていない場合、標準のシステムロケールディレク
     トリが使われます。 (1) 'languages' が与えられなかった場合、以下の環
     境変数: ‘LANGUAGE’ 、 ‘LC_ALL’ 、 ‘LC_MESSAGES’ 、および ‘LANG’ が
     検索されます。空でない値を返した最初の候補が 'languages' 変数として
     使われます。この環境変数は言語名をコロンで分かち書きしたリストを含
     んでいなければなりません。 *note find(): 431a. はこの文字列をコロン
     で分割し、言語コードの候補リストを生成します。

     *note find(): 431a. は次に言語コードを展開および正規化し、リストの
     各要素について、以下のパス構成:

     ‘`localedir'/`language'/LC_MESSAGES/`domain'.mo’

     からなる実在するファイルの探索を反復的に行います。 *note find():
     431a. は上記のような実在するファイルで最初に見つかったものを返しま
     す。該当するファイルが見つからなかった場合、 ‘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(): 431a. 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: 4319.  The class's constructor must take a single
     *note file object: 13df. argument.

     複数の ‘.mo’ ファイルがあった場合、後ろのファイルは前のファイルのフ
     ォールバックとして利用されます。 フォールバックの設定のために、
     *note copy.copy(): 757. を使いキャッシュから翻訳オブジェクトを複製
     します; こうすることで、実際のインスタンスデータはキャッシュのもの
     と共有されたままになります。

     ‘.mo’ ファイルが見つからなかった場合、 'fallback' が偽 (デフォルト
     値) ならこの関数は *note OSError: 2c2. を送出し、 'fallback' が真な
     ら *note NullTranslations: 431b. インスタンスが返されます。

     バージョン 3.3 で変更: 以前は *note IOError: 1262. が送出されました
     ; それは現在 *note OSError: 2c2. のエイリアスです。

     バージョン 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(): c71.

     'names' パラメータについては、翻訳オブジェクトの *note install():
     431c. メソッドの説明を参照ください。

     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(): 4310. に関する脚注を参照してください
。


File: python.info,  Node: NullTranslations クラス,  Next: GNUTranslations クラス,  Up: クラス形式の API

5.25.1.3 ‘NullTranslations’ クラス
..................................

翻訳クラスは、元のソースファイル中のメッセージ文字列から翻訳されたメッセ
ージ文字列への変換処理が実際に実装されているクラスです。 全ての翻訳クラ
スで基底クラスとして使われているクラスが *note NullTranslations: 431b. で
す; このクラスは、独自の翻訳クラスを実装するのに使える基本的なインターフ
ェースを提供しています。 以下に ‘NullTranslations’ のメソッドを示します:

 -- クラス: gettext.NullTranslations (fp=None)

     オプションの *note ファイルオブジェクト: 13df. 'fp' を取ります。こ
     の引数は基底クラスでは無視されます。このメソッドは "保護された
     (protected)" インスタンス変数 '_info' および '_charset' を初期化し
     ます。これらの変数の値は派生クラスで設定することができます。同様に
     '_fallback' も初期化しますが、この値は *note add_fallback(): 431e.
     で設定されます。その後、 '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(): bec.
          を代替オブジェクトに転送します。そうでない場合、翻訳されたメッ
          セージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n, /)

          代替オブジェクトが設定されている場合、 *note npgettext():
          4316. を代替オブジェクトに転送します。そうでない場合、翻訳され
          たメッセージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: info ()

          Return a dictionary containing the metadata found in the
          message catalog file.

      -- メソッド: charset ()

          メッセージカタログファイルのエンコーディングを返します。

      -- メソッド: install (names=None)

          このメソッドは *note gettext(): 4320. を組み込み名前空間にイン
          ストールし、変数 ‘_’ に束縛します。

          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.25.1.4 ‘GNUTranslations’ クラス
.................................

The ‘gettext’ module provides one additional class derived from *note
NullTranslations: 431b.: *note GNUTranslations: 4319.  This class
overrides ‘_parse()’ to enable reading GNU ‘gettext’ format ‘.mo’ files
in both big-endian and little-endian format.

*note GNUTranslations: 4319. 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: 4319. クラスのインスタンス化で *note
OSError: 2c2. が送出されることがあります。

 -- クラス: gettext.GNUTranslations

     以下のメソッドは基底クラスの実装からオーバライドされています:

      -- メソッド: gettext (message, /)

          カタログから 'message' id を検索して、対応するメッセージ文字列
          を Unicode でエンコードして返します。 'message' id に対応する
          エントリがカタログに存在せず、フォールバックが設定されている場
          合、検索処理をフォールバックの *note gettext(): 4320. メソッド
          に移譲します。 それ以外の場合は、 'message' id 自体が返されま
          す。

      -- メソッド: ngettext (singular, plural, n, /)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。返されるメッセージ文字列は
          Unicode 文字列です。

          メッセージ id がカタログ中に見つからず、フォールバックが指定さ
          れている場合は、メッセージ検索要求はフォールバックの *note
          ngettext(): 4321. メソッドに移譲されます。 それ以外の場合、
          '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(): bec. メソッドに転送されます。そう
          でない場合、 'message' id 自体が返されます。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n, /)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。

          'context' に対するメッセージ id がカタログ中に見つからず、フォ
          ールバックオブジェクトが指定されている場合、メッセージ検索要求
          はフォールバックオブジェクトの *note npgettext(): 4316. メソッ
          ドに転送されます。そうでない場合、 '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.25.1.5 Solaris メッセージカタログ機構のサポート
.................................................

Solaris オペレーティングシステムでは、独自の ‘.mo’ バイナリファイル形式
を定義していますが、この形式に関するドキュメントが手に入らないため、現時
点ではサポートされていません。


File: python.info,  Node: Catalog コンストラクタ,  Prev: Solaris メッセージカタログ機構のサポート,  Up: クラス形式の API

5.25.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(): c71. function described above.

このモジュールと Henstridge のバージョンとの間には一つ相違点があります:
彼のカタログオブジェクトはマップ型の API を介したアクセスがサポートされ
ていましたが、この API は使われていないらしく、現在はサポートされていま
せん。


File: python.info,  Node: プログラムやモジュールを国際化する,  Next: 謝辞<9>,  Prev: クラス形式の API,  Up: gettext --- 多言語国際化サービス

5.25.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.25.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.25.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(): c72. 関数に渡す
ことが出来ます:

     import gettext
     gettext.install('myapplication', '/usr/share/locale')


File: python.info,  Node: 動作中 on the fly に言語を切り替える,  Next: 翻訳処理の遅延解決,  Prev: アプリケーションを地域化する,  Up: プログラムやモジュールを国際化する

5.25.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.25.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:
1b7e. 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.25.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.25.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(): 930. に渡されたロケールが認識されない場合例外が
     送出されます。

 -- の関数: locale.setlocale (category, locale=None)

     If 'locale' is given and not ‘None’, *note setlocale(): 930.
     modifies the locale setting for the 'category'.  The available
     categories are listed in the data description below.  'locale' may
     be a *note string: 4337, 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: 4336.
     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: 4337, 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(): 930. 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: 27be.    ‘'decimal_point'’                         小数点を表す文字です。
                                                                          
                                                                          
                                ‘'grouping'’                              ‘'thousands_sep'’ が来るかもしれな
                                                                          い場所を相対的に表した数からなる配
                                                                          列です。配列が
                                                                          *note CHAR_MAX: 4338. で終端されて
                                                                          いる場合、それ以上の桁では桁数字の
                                                                          グループ化を行いません。配列が ‘0’
                                                                          で終端されている場合、最後に指定し
                                                                          たグループが反復的に使われます。
                                                                          
                                                                          
                                ‘'thousands_sep'’                         桁グループ間を区切るために使われる
                                                                          文字です。
                                                                          
                                                                          
     *note LC_MONETARY: 4339.   ‘'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: 4338. を設定すると、そのロケールでは
     値が指定されていないことを表します。

     ‘'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(): 452. は以下のキーのうち一つを受理します。
     ほとんどの記述は GNU C ライブラリ中の対応する説明から引用されていま
     す。

      -- データ: locale.CODESET

          選択されたロケールで用いられている文字エンコーディングの名前を
          文字列で取得します。

      -- データ: locale.D_T_FMT

          日付と時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.D_FMT

          日付をロケール特有の方法で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT

          時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT_AMPM

          時刻を午前／午後の書式で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: 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: 433f. を日曜日
               とする慣行に従っています。国際的な (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: 4367.
               and *note NOEXPR: 4368. 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(): 1406. 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(): 1406. の書式文字列として用いること
          のできる文字列を取得します。

      -- データ: locale.ERA_D_FMT

          日付をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.ERA_T_FMT

          時刻をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 1406. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: 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: 4337,
     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.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: 436f.  It defaults to
     *note LC_CTYPE: 4370.

     The language code has the same format as a *note locale name: 4337,
     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():
     930. を呼び出す必要があるため、この関数はスレッド安全ではありません
     。 ‘setlocale()’ を呼び出す必要がない、または呼び出したくない場合、
     'do_setlocale' を ‘False’ に設定する必要があります。

     On Android or if the *note Python UTF-8 Mode: 867. is enabled,
     always return ‘'utf-8'’, the *note locale encoding: 54a. and the
     'do_setlocale' argument are ignored.

     The *note Python preinitialization: 4371. configures the LC_CTYPE
     locale.  See also the *note filesystem encoding and error handler:
     75d.

     バージョン 3.7 で変更: この関数は、 Android 上あるいは *note Python
     UTF-8 モード: 867. が有効になっている場合、常に ‘"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:
          4370. 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: 4371. 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: 867.

     Added in version 3.11.

 -- の関数: locale.normalize (localename)

     与えたロケール名を規格化したロケールコードを返します。返されるロケ
     ールコードは *note setlocale(): 930. で使うために書式化されています
     。規格化が失敗した場合、もとの名前がそのまま返されます。

     与えたエンコードがシステムにとって未知の場合、標準の設定では、この
     関数は *note setlocale(): 930. と同様に、エンコーディングをロケール
     コードにおける標準のエンコーディングに設定します。

 -- の関数: locale.strcoll (string1, string2)

     現在の *note LC_COLLATE: 4374. 設定に従って二つの文字列を比較します
     。他の比較を行う関数と同じように、 '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:
     27be. 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: 4339. の設定にあわせてフォ
     ーマットします。

     'symbol' が真の場合は、返される文字列に通貨記号が含まれるようになり
     ます。これはデフォルトの設定です。'grouping' が ‘True’ の場合(これ
     はデフォルトではありません)は、値をグループ化します。
     'international' が ‘True’ の場合(これはデフォルトではありません)は
     、国際的な通貨記号を使用します。

          注釈: この関数は 'C' ロケールでは動作しないので、まず *note
          setlocale(): 930. でロケールを設定する必要があります。

 -- の関数: 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: 27be. で設定された慣行に従って正規化され
     た数値文字列に変換します。

     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: 27be. settings.

     Added in version 3.10.

 -- の関数: locale.atof (string, func=float)

     Converts a string to a number, following the *note LC_NUMERIC:
     27be. settings, by calling 'func' on the result of calling *note
     delocalize(): 102a. on 'string'.

 -- の関数: locale.atoi (string)

     文字列を *note LC_NUMERIC: 27be. で設定された慣行に従って整数に変換
     します。

 -- データ: 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:
     1574.

 -- データ: locale.LC_COLLATE

     Locale category for sorting strings.  The functions *note
     strcoll(): 4373. and *note strxfrm(): 1828. of the ‘locale’ module
     are affected.

 -- データ: locale.LC_TIME

     時刻を書式化するためのロケールカテゴリです。 *note time.strftime():
     1406. はこのカテゴリに設定されている慣行に従います。

 -- データ: locale.LC_MONETARY

     金額に関係する値を書式化するためのロケールカテゴリです。設定可能な
     オプションは関数 *note localeconv(): dfc. で得ることができます。

 -- データ: locale.LC_MESSAGES

     メッセージ表示のためのロケールカテゴリです。現在 Python はアプリケ
     ーション毎にロケールに対応したメッセージを出力する機能はサポートし
     ていません。 *note os.strerror(): 309f. が返すような、オペレーティ
     ングシステムによって表示されるメッセージはこのカテゴリによって影響
     を受けます。

     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(): 4379, *note atof(): 4378. and
     *note str(): 4376. 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(): dfc. の返す特別な値のためのシンボル定数です。

* 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.25.2.1 ロケールの背景、詳細、ヒント、助言および補足説明
.........................................................

C 標準では、ロケールはプログラム全体にわたる特性であり、その変更は高価な
処理であるとしています。加えて、頻繁にロケールを変更するようなひどい実装
はコアダンプを引き起こすこともあります。このことがロケールを正しく利用す
る上で苦痛となっています。

最初、プログラムが起動したときには、ユーザの希望するロケールにかかわらず
ロケールは ‘C’ です。例外が1つあります: *note LC_CTYPE: 4370. カテゴリは
、現在のロケールエンコーディングをユーザーの希望するロケールエンコーディ
ングに設定するために、スタートアップで変更されます。他のカテゴリについて
は、プログラムは ‘setlocale(LC_ALL, '')’ を呼び出して、明示的にユーザの
希望するロケール設定を行わなければなりません。

*note setlocale(): 930. をライブラリルーチン内で呼ぶことは、それがプログ
ラム全体に及ぼす副作用の面から、一般的によくない考えです。ロケールを保存
したり復帰したりするのもよくありません: 高価な処理であり、ロケールの設定
が復帰する以前に起動してしまった他のスレッドに悪影響を及ぼすからです。

もし、汎用を目的としたモジュールを作っていて、ロケールによって影響をうけ
るような操作 (例えば *note time.strftime(): 1406. の書式の一部) のロケー
ル独立のバージョンが必要ということになれば、標準ライブラリルーチンを使わ
ずに何とかしなければなりません。よりましな方法は、ロケール設定が正しく利
用できているか確かめることです。最後の手段は、あなたのモジュールが ‘C’ ロ
ケール以外の設定には互換性がないとドキュメントに書くことです。

The only way to perform numeric operations according to the locale is to
use the special functions defined by this module: *note atof(): 4378,
*note atoi(): 4379, *note format_string(): 742, *note str(): 4376.

ロケールに従ってケース変換や文字分類を行う方法はありません。 (ユニコード
) テキスト文字列については、これらは文字の値のみによって行われます。その
一方、バイト文字列はバイトの ASCII 値に従って変換と分類が行われます。そ
して、上位ビットが立っているバイト (すなわち、non-ASCII バイト) は、決し
て変換されず、英字や空白などの文字クラスの一部とみなされることもありませ
ん。


File: python.info,  Node: Locale names,  Next: Python 拡張の作者と、Python を埋め込むようなプログラムに関して,  Prev: ロケールの背景、詳細、ヒント、助言および補足説明,  Up: locale --- 国際化サービス

5.25.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.25.2.3 Python 拡張の作者と、Python を埋め込むようなプログラムに関して
.......................................................................

拡張モジュールは、現在のロケールを調べる以外は、決して *note
setlocale(): 930. を呼び出してはなりません。しかし、返される値もロケール
の復帰のために使えるだけなので、さほど便利とはいえません (例外はおそらく
ロケールが ‘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.25.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(): 4383. 、 *note
dcgettext(): 4384. 、 *note textdomain(): 4385. 、 *note
bindtextdomain(): 4386. 、および *note bind_textdomain_codeset(): 4387.
からなります。これらは *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.26 Graphical user interfaces with Tk
======================================

Tk/Tcl は長きにわたり Python の不可欠な一部でありつづけています。 Tk/Tcl
は頑健でプラットホームに依存しないウィンドウ構築ツールキットであり、
Python プログラマは *note tkinter: f6. パッケージやその拡張の *note
tkinter.ttk: 100. モジュールを使って利用できます。

*note tkinter: f6. パッケージはオブジェクトの薄い層で作ったTcl/Tkの最上
層です。‘tkinter’ を使うには、Tcl のコードを書く必要はありませんが、Tk の
ドキュメント、またはときどき、Tcl のドキュメントを調べる 必要が出て来ま
す。‘tkinter’ は Python クラスとして実装した Tk ウィジェットのラッパーの
集合です。

*note tkinter: f6. の一番素晴らしい点は、速く、そしてほとんどの Python に
付属していることです。標準ドキュメントが頼りないものだとしても、代わりと
なる、リファレンス、チュートリアル、書籍その他が入手可能です。‘tkinter’
は古臭いルックアンドフィールでも有名ですが、その点は 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 dialogs::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- Scrolled text widget. Scrolled text widget
* 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.26.1 ‘tkinter’ -- Tcl/Tk の Python インターフェース
-----------------------------------------------------

'ソースコード:' Lib/tkinter/__init__.py(1)

__________________________________________________________________

‘tkinter’ パッケージ ("Tk インターフェース") は、 Tcl/Tk GUI ツールキッ
トに対する標準の Python インターフェースです。 Tk と ‘tkinter’ は macOS
を含むほとんどの Unix プラットフォームの他、 Windows システム上でも利用
できます。

コマンドラインから ‘python -m tkinter’ を実行すると簡素な Tk インターフ
ェースを表示するウィンドウが開き、システムに ‘tkinter’ が正しくインスト
ールされたことが分かります。さらに、インストールされた Tcl/Tk のバージョ
ンが表示されているので、 Tcl/Tk のドキュメントを参照する時にはそのバージ
ョン情報が役立つでしょう。

Tkinter supports a range of Tcl/Tk versions, built either with or
without thread support.  Tcl/Tk 8.5.12 is the minimum supported version;
the official Python binary release bundles Tcl/Tk 8.6.  See the source
code for the *note _tkinter: 3. module for more information about
supported versions.

バージョン 3.11 で変更: Support for Tcl/Tk versions older than 8.5.12
was removed.

Tkinter は単なるラッパーではなく、Python らしい使用感を実現するための独
自の仕組みを備えています。本ドキュメントでは追加・変更された機能を中心に
解説し、変更のない部分については Tcl/Tk の公式ドキュメントを参照します。

     注釈: 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: 21b4.  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
オプションのモジュールの要件: 21b2.

参考
....

   * 
     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 modules::
* Tkinter life preserver::
* Threading model::
* Handy reference::
* リファレンス: リファレンス<8>.

   ---------- 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-lang.org/man/tcl9.0/TkCmd/index.html

   (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 modules,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.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:
     438f. 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: 1779. 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: 100.

Internally, Tk and Ttk use facilities of the underlying operating
system, that is, Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.

When your Python application uses a class in Tkinter, for example, 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 modules,  Next: Tkinter life preserver,  Prev: Architecture,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.2 Tkinter modules
........................

Support for Tkinter is spread across several modules.  Most applications
will need the main ‘tkinter’ module, as well as the *note tkinter.ttk:
100. module, which provides the modern themed widget set and API:

     from tkinter import *
     from tkinter import ttk

The modules that provide Tk support include:

‘tkinter’

     Main Tkinter module.

*note tkinter.colorchooser: f7.

     ユーザに色を選択させるためのダイアログです。

*note tkinter.commondialog: f8.

     このリストの他のモジュールが定義しているダイアログの基底クラスです
     。

*note tkinter.filedialog: fb.

     ユーザが開きたいファイルや保存したいファイルを指定できるようにする
     共通のダイアログです。

*note tkinter.font: fc.

     フォントの扱いを補助するためのユーティリティです。

*note tkinter.messagebox: fd.

     標準的な Tk のダイアログボックスにアクセスします。

*note tkinter.scrolledtext: fe.

     垂直スクロールバー付きのテキストウィジェットです。

*note tkinter.simpledialog: ff.

     基本的なダイアログと便宜関数 (convenience function) です。

*note tkinter.ttk: 100.

     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: fa.

     (experimental) Drag-and-drop support for ‘tkinter’.  This will
     become deprecated when it is replaced with the Tk DND.

*note turtle: 108.

     Tk ウィンドウ上でタートルグラフィックスを実現します。


File: python.info,  Node: Tkinter life preserver,  Next: Threading model,  Prev: Tkinter modules,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.3 Tkinter life preserver
...............................

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 life preserver

5.26.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 *note Tk:
1779. 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
*note grid(): 4393. 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 *note destroy(): 4394. method of the root
window.

Finally, the *note mainloop(): 4395. 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 life preserver

5.26.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 *note ttk.Frame: 4397, *note ttk.Label: 4398, and *note
     ttk.Button: 4399.

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 life preserver

5.26.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 *note Tk: 1779. 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 life preserver

5.26.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(): 117b, can help you
identify what you need.

To find out what configuration options are available on any widget, call
its *note configure(): 439c. method, which returns a dictionary
containing a variety of information about each object, including its
default and current values.  Use *note keys(): 439d. 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 life preserver

5.26.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, for example

     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 (for example, you'll find the *note invoke(): 439f. method on the
ttk::button(2) man page), while functions that take a widget as a
parameter often have their own man page (for example, 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, for
example, *note winfo_x(): 43a0, *note winfo_height(): 43a1, *note
winfo_viewable(): 43a2.  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 *note Widget: 43a3. class that
     all Tkinter widgets inherit from).

   ---------- Footnotes ----------

   (1) https://www.tcl-lang.org/man/tcl9.0/TkCmd/index.html

   (2) https://www.tcl-lang.org/man/tcl9.0/TkCmd/ttk_button.html

   (3) https://www.tcl-lang.org/man/tcl9.0/TkCmd/grid.html

   (4) https://www.tcl-lang.org/man/tcl9.0/TkCmd/options.html

   (5) https://www.tcl-lang.org/man/tcl9.0/TkCmd/ttk_widget.html

   (6) https://www.tcl-lang.org/man/tcl9.0/TkCmd/winfo.html


File: python.info,  Node: Threading model,  Next: Handy reference,  Prev: Tkinter life preserver,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.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 *note Tk: 1779. 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 (that is, *note
Tk.mainloop: 43a4.) 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 built without thread support are now rare: the
     bundled Tcl/Tk 8.6 is built with thread support, so this case only
     arises with some older non-threaded builds.  When the library is
     not thread-aware, ‘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
     *note Tk: 1779. 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: Handy reference,  Next: リファレンス<8>,  Prev: Threading model,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.10 Handy reference
.........................

* Menu:

* Setting options::
* The packer::
* Packer options::
* Coupling widget variables::
* The window manager::
* Tk option data types::
* Bindings and events::
* The index parameter::
* 画像::


File: python.info,  Node: Setting options,  Next: The packer,  Up: Handy reference

5.26.1.11 Setting options
.........................

オプションは、色やウィジェットの境界線幅などを制御します。オプションの設
定には三通りの方法があります:

オブジェクト生成時、キーワード引数を使用する

          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’ オプションがありますが、
ラベルにはありません。

The options supported by a given widget are listed in that widget's man
page, or can be queried at runtime by calling the *note config(): 43a8.
method without arguments, or by calling the *note keys(): 439d. method
on that widget.  The return value of these calls is a dictionary whose
key is the name of the option as a string (for example, ‘'relief'’) and
whose values are 5-tuples.

‘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: The packer,  Next: Packer options,  Prev: Setting options,  Up: Handy reference

5.26.1.12 The 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.

Note that widgets do not appear until they have had their geometry
specified with a geometry manager.  It's a common early mistake to leave
out the geometry specification, and then be surprised when the widget is
created but nothing appears.  A widget will appear only after it has
had, for example, the packer's *note pack(): 43ab. method applied to it.

pack() メソッドは、キーワード引数つきで呼び出せます。キーワード引数は、
ウィジェットをコンテナ内のどこに表示するか、メインのアプリケーションウィ
ンドウをリサイズしたときにウィジェットがどう振舞うかを制御します。以下に
例を示します:

     fred.pack()                     # defaults to side = "top"
     fred.pack(side="left")
     fred.pack(expand=1)


File: python.info,  Node: Packer options,  Next: Coupling widget variables,  Prev: The packer,  Up: Handy reference

5.26.1.13 Packer options
........................

packer と packer の取りえるオプションについての詳細は、man ページや John
Ousterhout の本の183ページを参照してください。

anchor

     Anchor type.  Denotes where the packer is to place each content in
     its parcel.

expand

     boolean, ‘0’ or ‘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: Coupling widget variables,  Next: The window manager,  Prev: Packer options,  Up: Handy reference

5.26.1.14 Coupling widget variables
...................................

ウィジェットによっては、(テキスト入力ウィジェットのように) 特殊なオプシ
ョンを使って、現在設定されている値をアプリケーション内の変数に直接関連付
けできます。このようなオプションには ‘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’.

There are many useful subclasses of Variable already defined: *note
StringVar: 43af, *note IntVar: 43b0, *note DoubleVar: 43b1, and *note
BooleanVar: 43b2.  To read the current value of such a variable, call
the *note get(): 43b3. method on it, and to change its value you call
the ‘set()’ method.  If you follow this protocol, the widget will always
track the value of the variable, with no further intervention on your
part.

例えば:

     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: The window manager,  Next: Tk option data types,  Prev: Coupling widget variables,  Up: Handy reference

5.26.1.15 The window manager
............................

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 *note Wm: 43b5. 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 *note master: 43b6.  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 *note winfo_toplevel(): 43b7. method.
There is also a ‘_root()’ method; it begins with an underscore to denote
the fact that this function is part of the implementation, and not an
interface to Tk functionality.  It returns the application's root window
rather than the nearest enclosing toplevel.

以下に典型的な使い方の例をいくつか挙げます:

     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 option data types,  Next: Bindings and events,  Prev: The window manager,  Up: Handy reference

5.26.1.16 Tk option data types
..............................

anchor

     指定できる値はコンパスの方位です: ‘"n"’ 、 ‘"ne"’ 、 ‘"e"’ 、
     ‘"se"’ 、 ‘"s"’ 、 ‘"sw"’ 、 ‘"w"’ 、 ‘"nw"’ 、および ‘"center"’ 。

bitmap

     There are ten built-in, named bitmaps: ‘'error'’, ‘'gray12'’,
     ‘'gray25'’, ‘'gray50'’, ‘'gray75'’, ‘'hourglass'’, ‘'info'’,
     ‘'questhead'’, ‘'question'’, ‘'warning'’.  To specify an X bitmap
     filename, give the full path to the file, preceded with an ‘@’, as
     in ‘"@/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

     The standard X cursor names from ‘cursorfont.h’ can be used,
     without the ‘XC_’ prefix.  For example to get a hand cursor
     (‘XC_hand2’), use the string ‘"hand2"’.  You can also specify a
     bitmap and mask file of your own.  On Windows a cursor file (‘.cur’
     or ‘.ani’) may be used directly, giving its path preceded with an
     ‘@’, as in ‘"@C:/cursors/bart.ani"’.  See page 179 of Ousterhout's
     book.

distance

     スクリーン上の距離をピクセルか絶対距離のどちらかで指定できます。ピ
     クセルは数値として与えられ、絶対距離は文字列として与えられます。絶
     対距離を表す文字列は、単位を表す終了文字 (センチメートルには ‘c’ 、
     インチには ‘i’ 、ミリメートルには ‘m’ 、プリンタのポイントには
     ‘p’)を伴います。例えば、3.5インチは ‘"3.5i"’ と表現します。

font

     Tk uses a font description such as ‘{courier 10 bold}’; in
     ‘tkinter’ this is most naturally passed as a tuple of ‘(family,
     size, *styles)’ (or as the equivalent string ‘"Courier 10 bold"’).
     Font sizes with positive numbers are measured in points; sizes with
     negative numbers are measured in pixels.

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

     Determines what the border style of a widget will be.  Legal values
     are: ‘"raised"’, ‘"sunken"’, ‘"flat"’, ‘"groove"’, ‘"ridge"’, and
     ‘"solid"’.

scrollcommand

     これはほとんどの場合スクロールバーウィジェットの ‘set()’ メソッドで
     すが、1 個の引数を取るあらゆるウィジェットにもなりえます。

wrap

     次の中の一つでなければなりません: ‘"none"’ 、 ‘"char"’ 、あるいは
     ‘"word"’ 。


File: python.info,  Node: Bindings and events,  Next: The index parameter,  Prev: Tk option data types,  Up: Handy reference

5.26.1.17 Bindings and events
.............................

ウィジェットコマンドからの bind メソッドによって、あるイベントを待つこと
と、そのイベント型が起きたときにコールバック関数を呼び出すことができるよ
うになります。 bind メソッドの形式は:

     def bind(self, sequence, func, add=''):

ここでは:

sequence

     is a string that denotes the target kind of event.  Physical events
     use the ‘<modifier-modifier-type-detail>’ form (for example
     ‘"<Enter>"’ or ‘"<Control-Button-1>"’); application-defined virtual
     events use double angle brackets, as in ‘"<<Paste>>"’.  (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
                                            
                                            
%#       serial                    %b       num
                                            
                                            
%d       detail                    %D       delta
                                            

The ‘add’ parameter above only affects the bindings you make yourself.
Every widget also inherits 'class bindings' that implement its standard
behavior - for example a *note Text: 1a58. widget binds ‘Control’-‘t’ to
transpose two characters.  These are described in the bindings section
of the widget's Tk man page (such as ‘text(3tk)(2)’ or ‘entry(3tk)(3)’).

Class bindings are processed separately from your own, so binding an
event yourself does not replace the default; both run.  To suppress an
unwanted default binding, bind the event on the widget and return the
string ‘"break"’ from your callback.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/bind(3tk)

   (2) https://manpages.debian.org/text(3tk)

   (3) https://manpages.debian.org/entry(3tk)


File: python.info,  Node: The index parameter,  Next: 画像,  Prev: Bindings and events,  Up: Handy reference

5.26.1.18 The index parameter
.............................

多くのウィジェットにはパラメータ "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: The index parameter,  Up: Handy reference

5.26.1.19 画像
..............

様々な形式の画像を、それに対応する *note tkinter.Image: 43bd. のサブクラ
スを使って作成できます:

   * XBM 形式の画像のための *note BitmapImage: 43be. 。

   * PGM, PPM, GIF, PNG 形式の画像のための *note PhotoImage: 1e42. 。 最
     後のは 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()’.

The image object can then be used wherever an ‘image’ option is
supported by some widget (for example, labels, buttons, menus).  In
these cases, Tk will not keep a reference to the image.  When the last
Python reference to the image object is deleted, the image data is
deleted as well, and Tk will display an empty box wherever the image was
used.

参考
....

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: リファレンス<8>,  Prev: Handy reference,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.26.1.20 リファレンス
......................

This section documents the classes, methods, functions and constants of
the ‘tkinter’ module.  Most of them wrap Tcl/Tk commands; consult the
official Tcl/Tk manual pages for the full list of widget options and
further details.

 -- 例外: tkinter.TclError

     The exception raised when a call into the Tcl interpreter fails,
     for example when a widget is given an unknown option or an invalid
     value.

* Menu:

* Base and mixin classes::
* Toplevel widgets::
* Widget classes::
* Variable classes::
* Image classes::
* Other classes::
* Module-level functions::
* File handlers::
* 定数: 定数<10>.


File: python.info,  Node: Base and mixin classes,  Next: Toplevel widgets,  Up: リファレンス<8>

5.26.1.21 Base and mixin classes
................................

 -- クラス: tkinter.Misc

     The ‘Misc’ class is a mix-in inherited by *note Tk: 1779. and,
     through *note BaseWidget: 43c3, by every widget.  It provides the
     large set of methods common to all Tk objects: querying window
     information, managing event bindings and the event loop,
     controlling the keyboard focus and pointer grabs, accessing the
     selection, clipboard and option database, and assorted utility and
     introspection services.  Because they are inherited, these methods
     are available on every widget and on the ‘Tk’ application object,
     and are documented here once rather than repeated for each widget.

      -- メソッド: cget (key)

          Return the current value of the configuration option named
          'key' for this widget, as a string.  The expression
          ‘widget[key]’ is equivalent and may be used instead.

      -- メソッド: configure (cnf=None, **kw)

          Query or modify the configuration options of the widget.  With
          no arguments, return a dictionary mapping every available
          option name to a tuple describing it (its name, X resource
          name, X resource class, default value and current value).  If
          a single option name is given as a string, return the tuple
          for just that option.  If one or more keyword arguments are
          given, or a dictionary is passed as 'cnf', set each named
          option to the corresponding value; the expression ‘widget[key]
          = value’ sets a single option in the same way.

          *note config(): 43a8. is an alias of ‘configure()’.

      -- メソッド: keys ()

          Return a list of the names of all configuration options of
          this widget.

      -- メソッド: getboolean (s)

          Interpret the string 's' as a Tcl boolean and return the
          corresponding *note bool: 3c1.  Tcl accepts values such as
          ‘'1'’, ‘'0'’, ‘'yes'’, ‘'no'’, ‘'true'’ and ‘'false'’.  Raise
          *note ValueError: 2ee. if 's' is not a valid boolean.

      -- メソッド: getdouble (s)

          Interpret the string 's' as a Tcl floating-point number and
          return it as a *note float: 197.  Raise *note ValueError: 2ee.
          if 's' is not a valid number.

          Added in version 3.5.

      -- メソッド: getint (s)

          Interpret the string 's' as a Tcl integer and return it as an
          *note int: 19c.  Raise *note ValueError: 2ee. if 's' is not a
          valid integer.

      -- メソッド: getvar (name='PY_VAR')

          Return the value of the Tcl global variable named 'name'.

      -- メソッド: setvar (name='PY_VAR', value='1')

          Set the Tcl global variable named 'name' to 'value'.

          The ‘getvar()’ and ‘setvar()’ methods give direct access to
          Tcl variables.  In most code you will instead use a *note
          Variable: 1d29. subclass such as *note StringVar: 43af. or
          *note IntVar: 43b0, which wraps a Tcl variable and converts
          its value to and from a Python type.

      -- メソッド: register (func, subst=None, needcleanup=1)

          Register the Python callable 'func' as a Tcl command and
          return the name of the new command as a string.  Whenever Tcl
          invokes that command, 'func' is called; if 'subst' is given,
          it is applied to the command's arguments first.  This is the
          mechanism used internally to turn Python callbacks into the
          command names passed to Tk options such as 'command'.  Unless
          'needcleanup' is false, the command is deleted automatically
          when the widget is destroyed.

          バージョン 3.13 で変更: The arguments passed to 'func' are no
          longer converted to strings.

      -- メソッド: deletecommand (name)

          Delete the Tcl command named 'name', such as one previously
          returned by *note register(): 43ca.

      -- メソッド: nametowidget (name)

          Return the widget instance corresponding to the Tk pathname
          'name'.

      -- メソッド: send (interp, cmd, *args)

          Send the Tcl command 'cmd', with the given 'args', to the Tcl
          interpreter registered under the name 'interp', and return its
          result.  This is not available on all platforms.

      -- メソッド: destroy ()

          Destroy this widget and all of its descendant widgets, and
          delete the Tcl commands associated with them.

      -- メソッド: tkraise (aboveThis=None)

          Raise this widget in the stacking order so that it is drawn on
          top of its siblings.  If 'aboveThis' is given, the widget is
          moved to be just above it in the stacking order instead.

          *note lift(): 43ce. is an alias of ‘tkraise()’.

      -- メソッド: lower (belowThis=None)

          Lower this widget in the stacking order so that it is drawn
          beneath its siblings.  If 'belowThis' is given, the widget is
          moved to be just below it in the stacking order instead.

          *note tkraise(): 43cf./*note lift(): 43ce. and ‘lower()’ are
          overridden by the *note Canvas: 1a59. widget, where they
          restack canvas items instead.

      -- メソッド: image_names ()

          Return the names of all images that currently exist in the Tcl
          interpreter.

          This is overridden by the *note Text: 1a58. widget, where
          ‘image_names()’ returns the names of its embedded images
          instead.

      -- メソッド: image_types ()

          Return the available image types, such as ‘'photo'’ and
          ‘'bitmap'’.

      -- メソッド: grid_anchor (anchor=None)

          Set the anchor that controls where the grid is placed inside
          this container when the container is larger than the grid and
          no row or column has a non-zero weight.  'anchor' is one of
          the usual anchor strings, such as ‘'nw'’ (the default) or
          ‘'center'’.  Called with no argument, this method has no
          effect.

          *note anchor(): 43d3. is an alias of ‘grid_anchor()’.

          Added in version 3.3.

      -- メソッド: grid_bbox (column=None, row=None, col2=None,
               row2=None)

          Return the bounding box, in pixels, of a region of the grid
          laid out in this container, as a 4-tuple ‘(xoffset, yoffset,
          width, height)’.  With no arguments the bounding box of the
          whole grid is returned.  If 'column' and 'row' are given, the
          box spans from the cell at row and column 0 to that cell; if
          'col2' and 'row2' are also given, it spans from the cell
          ('column', 'row') to the cell ('col2', 'row2').

          *note bbox(): 43d5. is an alias of ‘grid_bbox()’, except on
          *note Canvas: 1a59, *note Listbox: 43d7, *note Spinbox: 43d8,
          *note Text: 1a58, *note ttk.Entry: 43d9. and *note
          ttk.Treeview: c8b, which provide their own ‘bbox()’ method.

      -- メソッド: grid_columnconfigure (index, cnf={}, **kw)

          Query or set the properties of the column (or columns) 'index'
          of the grid managed by this container.  'index' may be a
          column number; when setting options it may also be a list of
          column numbers, the string ‘'all'’ to affect every column, or
          a child widget whose occupied columns are affected.  The
          supported options are:

          'minsize'

               The column's minimum size, in pixels.

          'weight'

               An integer setting how much of any extra space is
               apportioned to the column.  A weight of ‘0’ keeps the
               column at its requested size, and a column of weight two
               grows twice as fast as a column of weight one.

          'uniform'

               The name of a uniform group.  Columns sharing a non-empty
               group name are kept in sizes that are strictly
               proportional to their weights.

          'pad'

               Extra space, in pixels, added to the largest widget in
               the column when computing the column's size.

          With a single option name, return that option's value; with no
          options, return a dictionary of all of them.

          *note columnconfigure(): 43da. is an alias of
          ‘grid_columnconfigure()’.

      -- メソッド: grid_rowconfigure (index, cnf={}, **kw)

          Query or set the properties of the row (or rows) 'index' of
          the grid managed by this container.  'index' is interpreted as
          for *note grid_columnconfigure(): 43db, and the supported
          options ('minsize', 'weight', 'uniform' and 'pad') are the
          same, applied to a row instead of a column.

          *note rowconfigure(): 43dc. is an alias of
          ‘grid_rowconfigure()’.

      -- メソッド: grid_location (x, y)

          Return the ‘(column, row)’ of the grid cell that contains the
          pixel at position ('x', 'y'), given in pixels relative to this
          container.  For locations above or to the left of the grid,
          ‘-1’ is returned for the corresponding coordinate.

      -- メソッド: grid_propagate ()

      -- メソッド: grid_propagate (flag)

          Enable or disable geometry propagation for this container when
          it manages its children with the grid geometry manager.  When
          'flag' is true, the container resizes itself to fit the
          requested sizes of its children; when it is false, its size is
          left under your control.  Called with no argument, return the
          current setting as a boolean.

      -- メソッド: grid_size ()

          Return the size of the grid managed by this container as a
          ‘(columns, rows)’ tuple.

          *note size(): 43e0. is an alias of ‘grid_size()’, except on
          the *note Listbox: 43d7. widget, which provides its own
          ‘size()’ method.

      -- メソッド: grid_slaves (row=None, column=None)

          Return a list of the child widgets managed in this container's
          grid, most recently managed first.  If 'row' or 'column' is
          given, only the children in that row or column are returned.

      -- メソッド: pack_propagate ()

      -- メソッド: pack_propagate (flag)

          Enable or disable geometry propagation for this container when
          it manages its children with the pack geometry manager.  When
          'flag' is true, the container resizes itself to fit the
          requested sizes of its children; when it is false, its size is
          left under your control.  Called with no argument, return the
          current setting as a boolean.

          *note propagate(): 43e3. is an alias of ‘pack_propagate()’.

      -- メソッド: pack_slaves ()

          Return a list of the child widgets managed by this container
          with the pack geometry manager, in packing order.

          *note slaves(): 43e5. is an alias of ‘pack_slaves()’.

      -- メソッド: place_slaves ()

          Return a list of the child widgets managed by this container
          with the place geometry manager.

      -- メソッド: bind (sequence=None, func=None, add=None)

          Bind the event pattern 'sequence' on this widget to the
          callable 'func'.

          'sequence' is an event pattern, such as ‘'<Button-1>'’ (a
          mouse click) or ‘'<KeyPress-a>'’, optionally a concatenation
          of several such patterns that must occur shortly after one
          another.  When the event occurs, 'func' is called with an
          *note Event: 43e9. instance describing it as its only
          argument; if 'func' returns the string ‘'break'’, no further
          bindings for the event are invoked.

          If 'add' is true, 'func' is added to any functions already
          bound to 'sequence'; otherwise it replaces them.  The binding
          applies only to this widget.

          ‘bind()’ returns a string identifier (a 'funcid') that can
          later be passed to *note unbind(): 43ea. to remove the binding
          without leaking the associated Tcl command.

          If 'func' is omitted, return the binding currently associated
          with 'sequence'; if 'sequence' is also omitted, return a list
          of all the sequences for which bindings exist on this widget.

      -- メソッド: bind_class (className, sequence=None, func=None,
               add=None)

          Like *note bind(): 43e8, but bind 'func' to the binding tag
          'className' rather than to a single widget, so that the
          binding applies to every widget having that tag.  'className'
          is usually the name of a widget class, such as ‘'Button'’, in
          which case the binding affects all widgets of that class.  The
          set of binding tags for a widget can be inspected and changed
          with *note bindtags(): 43ec.

          The remaining arguments and the return value are as for *note
          bind(): 43e8.

      -- メソッド: bind_all (sequence=None, func=None, add=None)

          Like *note bind(): 43e8, but bind 'func' to the special
          binding tag ‘'all'’, so that the binding applies to every
          widget in the application.

          The remaining arguments and the return value are as for *note
          bind(): 43e8.

      -- メソッド: unbind (sequence, funcid=None)

          Remove bindings for the event pattern 'sequence' on this
          widget.

          If 'funcid' is given, only the function identified by it (a
          value returned from a previous call to *note bind(): 43e8.) is
          removed, and its associated Tcl command is deleted.  Otherwise
          all bindings for 'sequence' are destroyed, leaving it unbound.

          バージョン 3.13 で変更: If 'funcid' is given, only that
          callback is unbound; other callbacks bound to 'sequence' are
          kept.

      -- メソッド: unbind_class (className, sequence)

          Remove all bindings for the event pattern 'sequence' from the
          binding tag 'className'.  See *note bind_class(): 43eb.

      -- メソッド: unbind_all (sequence)

          Remove all bindings for the event pattern 'sequence' from the
          special binding tag ‘'all'’.  See *note bind_all(): 43ed.

      -- メソッド: bindtags (tagList=None)

          If 'tagList' is omitted, return a tuple of the binding tags
          associated with this widget.  When an event occurs in a
          widget, it is applied to each of the widget's binding tags in
          order, and for each tag the most specific matching binding is
          executed.  By default a widget has four binding tags: its own
          pathname, its widget class, the pathname of its nearest
          toplevel ancestor, and ‘'all'’, in that order.

          If 'tagList' is given, it must be a sequence of strings; the
          widget's binding tags are set to its elements, which
          determines the order in which bindings are evaluated.

     The methods with the ‘event_’ prefix define virtual events and
     generate events programmatically.

      -- メソッド: event_add (virtual, *sequences)

          Associate the virtual event 'virtual', whose name has the form
          ‘'<<Paste>>'’, with each of the physical event patterns given
          by 'sequences', so that the virtual event triggers whenever
          any of them occurs.  If 'virtual' is already defined, the new
          sequences are added to its existing ones.

      -- メソッド: event_delete (virtual, *sequences)

          Remove each of 'sequences' from those associated with the
          virtual event 'virtual'.  Sequences that are not currently
          associated with 'virtual' are ignored.  If no 'sequences' are
          given, all physical event sequences are removed, so that
          'virtual' no longer triggers.

      -- メソッド: event_generate (sequence, **kw)

          Generate the event 'sequence' on this widget and arrange for
          it to be processed just as if it had come from the window
          system.  'sequence' must be a single event pattern, such as
          ‘'<Button-1>'’ or ‘'<<Paste>>'’, not a concatenation of
          several.  Keyword arguments specify additional fields of the
          event, for example 'x' and 'y' for the pointer position, or
          'when' to control when the event is processed; refer to the Tk
          ‘event’ manual page for the full list.

      -- メソッド: event_info (virtual=None)

          If 'virtual' is omitted, return a tuple of all the virtual
          events that are currently defined.  If 'virtual' is given,
          return a tuple of the physical event sequences currently
          associated with it, or an empty tuple if it is not defined.

     The methods with the ‘after’ prefix schedule callbacks to run after
     a delay or when the application is idle.

      -- メソッド: after (ms, func=None, *args, **kw)

          Schedule the callable 'func' to be called after 'ms'
          milliseconds, with 'args' and 'kw' passed to it as positional
          and keyword arguments.  Return an identifier that can be
          passed to *note after_cancel(): 43f5. to cancel the call.

          If 'func' is omitted, sleep for 'ms' milliseconds instead,
          processing no events during that time, and return ‘None’.

          バージョン 3.10 で変更: 'func' can now be any callable object,
          not only a function.

          バージョン 3.14 で変更: Keyword arguments are now passed to
          'func'.

      -- メソッド: after_cancel (id)

          Cancel a callback previously scheduled with *note after():
          43f4. or *note after_idle(): 43f6.  'id' must be an identifier
          returned by one of those methods; passing a value that is not
          such an identifier raises *note ValueError: 2ee.  If the
          callback has already run or been cancelled, this has no
          effect.

          バージョン 3.7 で変更: Passing ‘None’ (or any false value) as
          'id' now raises *note ValueError: 2ee.

      -- メソッド: after_idle (func, *args, **kw)

          Schedule the callable 'func' to be called, with 'args' and
          'kw' passed to it, when the Tk main loop next becomes idle,
          that is, when it has no other events to process.  Return an
          identifier that can be passed to *note after_cancel(): 43f5.
          to cancel the call.

          バージョン 3.14 で変更: Keyword arguments are now passed to
          'func'.

      -- メソッド: after_info (id=None)

          If 'id' is omitted, return a tuple of the identifiers of all
          callbacks currently scheduled with *note after(): 43f4. and
          *note after_idle(): 43f6. for this interpreter.

          If 'id' is given, it must identify a callback that has not yet
          run or been cancelled, and the return value is a tuple
          ‘(script, type)’, where 'script' refers to the function to be
          called and 'type' is either ‘'idle'’ or ‘'timer'’.  A *note
          TclError: 43c0. is raised if 'id' does not exist.

          Added in version 3.13.

      -- メソッド: mainloop (n=0)

          Enter the Tk event loop, which processes events until all
          windows are destroyed.  This is normally called once, on the
          root window, to run the application.

      -- メソッド: quit ()

          Quit the Tcl interpreter, causing *note mainloop(): 4395. to
          return.

      -- メソッド: update ()

          Enter the event loop until all pending events, including idle
          callbacks, have been processed.  This brings the display up to
          date and handles any events that are already queued, then
          returns.

      -- メソッド: update_idletasks ()

          Enter the event loop until all pending idle callbacks have
          been called.  This updates the display of windows, for example
          after geometry changes, but does not process events caused by
          the user.

      -- メソッド: wait_variable (name='PY_VAR')

          Wait until the Tcl variable 'name' is modified, continuing to
          process events in the meantime so that the application stays
          responsive.  'name' is usually a *note Variable: 1d29.
          instance, such as an *note IntVar: 43b0. or *note StringVar:
          43af.

          *note waitvar(): 43fb. is an alias of ‘wait_variable()’.

      -- メソッド: wait_window (window=None)

          Wait until 'window' is destroyed, continuing to process events
          in the meantime.  If 'window' is omitted, this widget is used.
          This is typically used to wait for the user to finish
          interacting with a dialog box.

      -- メソッド: wait_visibility (window=None)

          Wait until the visibility state of 'window' changes, for
          example when it first appears on the screen, continuing to
          process events in the meantime.  If 'window' is omitted, this
          widget is used.  This is typically used to wait for a newly
          created window to become visible before acting on it.

     The methods with the ‘focus_’ prefix manage the keyboard focus.

      -- メソッド: focus ()

          Direct the keyboard input focus for this widget's display to
          this widget.  If the application does not currently have the
          input focus on this widget's display, the widget is remembered
          as the focus window for its top level, and the focus will be
          redirected to it the next time the window manager gives the
          focus to the top level.  ‘focus()’ is an alias of
          ‘focus_set()’, except on the *note Canvas: 1a59. and *note
          ttk.Treeview: c8b. widgets, which provide their own ‘focus()’
          method.

      -- メソッド: focus_force ()

          Direct the keyboard input focus to this widget even if the
          application does not currently have the input focus for the
          widget's display.  This method should be used sparingly, if at
          all; normally an application should wait for the window
          manager to give it the focus rather than claiming it.

      -- メソッド: focus_get ()

          Return the widget that currently has the keyboard focus in the
          application, or ‘None’ if no widget in the application has the
          focus.  Use *note focus_displayof(): 4403. to work correctly
          with several displays.

      -- メソッド: focus_displayof ()

          Return the widget that currently has the keyboard focus on the
          display where this widget is located, or ‘None’ if no widget
          in the application has the focus on that display.

      -- メソッド: focus_lastfor ()

          Return the most recent widget to have had the keyboard focus
          among all the widgets in the same top level as this widget;
          this is the widget that will receive the focus the next time
          the window manager gives the focus to the top level.  If no
          widget in that top level has ever had the focus, or if the
          most recent focus widget has been deleted, the top level
          itself is returned.

      -- メソッド: tk_focusFollowsMouse ()

          Reconfigure Tk to use an implicit focus model in which the
          focus is set to a widget whenever the mouse pointer enters it.
          This cannot easily be disabled once enabled.

      -- メソッド: tk_focusNext ()

          Return the next widget after this one in the keyboard
          traversal order, or ‘None’ if there is none.  The traversal
          order goes first to the next child, then recursively to the
          children of that child, and then to the next sibling higher in
          the stacking order.  A widget is skipped if its ‘takefocus’
          option is set to ‘0’.  This method is used in the default
          bindings for the ‘Tab’ key.

      -- メソッド: tk_focusPrev ()

          Return the previous widget before this one in the keyboard
          traversal order, or ‘None’ if there is none.  See *note
          tk_focusNext(): 4406. for how the order is defined.  This
          method is used in the default bindings for the ‘Shift’-‘Tab’
          key.

     The methods with the ‘grab_’ prefix set and query the input grab,
     which directs all input events to a single widget.

      -- メソッド: grab_set ()

          Set a local grab on this widget.  A grab confines pointer
          events to this widget and its descendants: while the pointer
          is outside the widget's subtree, button presses and releases
          and pointer motion are reported to the grab widget, and
          windows outside the subtree become insensitive until the grab
          is released.  A local grab affects only the grabbing
          application.  Any grab previously set by this application on
          the widget's display is automatically released.  Setting a
          grab is the usual way to make a dialog modal: while the grab
          is in effect the user cannot interact with the other windows
          of the application.

      -- メソッド: grab_set_global ()

          Set a global grab on this widget.  A global grab is like the
          local grab set by *note grab_set(): 4408, but it locks out all
          other applications on the screen, so that only this widget's
          subtree is sensitive to pointer events, and it also grabs the
          keyboard.  Use with caution: it is easy to render a display
          unusable with a global grab, since other applications stop
          receiving events until it is released.

      -- メソッド: grab_release ()

          Release the grab on this widget if there is one; otherwise do
          nothing.

      -- メソッド: grab_current ()

          Return the widget that currently holds the grab in this
          application for this widget's display, or ‘None’ if there is
          no such widget.

      -- メソッド: grab_status ()

          Return ‘None’ if no grab is currently set on this widget,
          ‘"local"’ if a local grab is set, or ‘"global"’ if a global
          grab is set.

     The methods with the ‘selection_’ prefix retrieve and manage the X
     selection.

      -- メソッド: selection_clear (**kw)

          Clear the X selection, so that no window owns it anymore.  The
          selection to clear is given by the keyword argument
          'selection', an atom name such as ‘'PRIMARY'’ or
          ‘'CLIPBOARD'’; it defaults to ‘PRIMARY’.  The 'displayof'
          keyword argument names a widget that determines the display on
          which to operate, and defaults to this widget.

          This is overridden by the *note Entry: 440e, *note Listbox:
          43d7. and *note Spinbox: 43d8. widgets, where
          ‘selection_clear()’ clears the widget's own selection instead.

      -- メソッド: selection_get (**kw)

          Return the contents of the current X selection.  The keyword
          argument 'selection' names the selection and defaults to
          ‘PRIMARY’.  The keyword argument 'type' specifies the form in
          which the data is to be returned (the desired conversion
          target), an atom name such as ‘'STRING'’ or ‘'FILE_NAME'’; it
          defaults to ‘STRING’, except on X11, where ‘UTF8_STRING’ is
          tried first and ‘STRING’ is used as a fallback.  The
          'displayof' keyword argument names a widget that determines
          the display from which to retrieve the selection, and defaults
          to this widget.

      -- メソッド: selection_handle (command, **kw)

          Register 'command' as a handler to supply the X selection
          owned by this widget when another application requests it.
          When the selection is retrieved, 'command' is called with two
          arguments, the starting character offset and the maximum
          number of characters to return, and must return at most that
          many characters of the selection starting at that offset; for
          very long selections it is called repeatedly with increasing
          offsets.  The keyword argument 'selection' names the selection
          (default ‘PRIMARY’) and the keyword argument 'type' gives the
          form of the selection that the handler supplies (such as
          ‘'STRING'’ or ‘'FILE_NAME'’, default ‘STRING’).

      -- メソッド: selection_own (**kw)

          Make this widget the owner of the X selection on its display.
          The previous owner, if any, is notified that it has lost the
          selection.  The keyword argument 'selection' names the
          selection and defaults to ‘PRIMARY’.

      -- メソッド: selection_own_get (**kw)

          Return the widget in this application that owns the X
          selection on the display containing this widget, or ‘None’ if
          no widget in this application owns the selection.  The keyword
          argument 'selection' names the selection and defaults to
          ‘PRIMARY’.  The 'displayof' keyword argument names a widget
          that determines the display to query, and defaults to this
          widget.

     The methods with the ‘clipboard_’ prefix manage the clipboard.

      -- メソッド: clipboard_append (string, **kw)

          Append 'string' to the Tk clipboard and claim ownership of the
          clipboard on this widget's display.  Before appending, the
          clipboard should be emptied with *note clipboard_clear():
          4414.; all appends should be completed before returning to the
          event loop so that the clipboard is updated atomically.  The
          keyword argument 'type' specifies the form of the data, an
          atom name such as ‘'STRING'’ or ‘'FILE_NAME'’ (default
          ‘STRING’), and the keyword argument 'format' specifies the
          representation used to transmit it (default ‘STRING’).  The
          'displayof' keyword argument names a widget that determines
          the target display, and defaults to this widget.  The contents
          can be retrieved with *note clipboard_get(): 4415. or *note
          selection_get(): 440f.

      -- メソッド: clipboard_clear (**kw)

          Claim ownership of the clipboard on this widget's display and
          remove any previous contents.  The 'displayof' keyword
          argument names a widget that determines the target display,
          and defaults to this widget.

      -- メソッド: clipboard_get (**kw)

          Retrieve data from the clipboard on this widget's display.
          The keyword argument 'type' specifies the form in which the
          data is to be returned, an atom name such as ‘'STRING'’ or
          ‘'FILE_NAME'’; it defaults to ‘STRING’, except on X11, where
          ‘UTF8_STRING’ is tried first and ‘STRING’ is used as a
          fallback.  The 'displayof' keyword argument names a widget
          that determines the display, and defaults to the root window
          of the application.  This is equivalent to
          ‘selection_get(selection='CLIPBOARD')’.

     The methods with the ‘option_’ prefix query and modify the Tk
     option database.

      -- メソッド: option_add (pattern, value, priority=None)

          Add an option to the Tk option database that associates
          'value' with 'pattern'.  'pattern' consists of names and/or
          classes separated by asterisks or dots, in the usual X format.
          'priority' is an integer between 0 and 100, or one of the
          symbolic names ‘'widgetDefault'’ (20), ‘'startupFile'’ (40),
          ‘'userDefault'’ (60), or ‘'interactive'’ (80); it defaults to
          ‘interactive’.

      -- メソッド: option_clear ()

          Clear the Tk option database.  Default options from the
          ‘RESOURCE_MANAGER’ property or the ‘.Xdefaults’ file are
          reloaded automatically the next time an option is added to or
          removed from the database.

      -- メソッド: option_get (name, className)

          Return the value of the option matching this widget under
          'name' and 'className' from the Tk option database, or an
          empty string if there is no matching entry.  When several
          entries match, the one with the highest priority is returned,
          and among entries of equal priority the most recently added
          one.

      -- メソッド: option_readfile (fileName, priority=None)

          Read the file named 'fileName', which should have the standard
          format for an X resource database such as ‘.Xdefaults’, and
          add all the options it specifies to the Tk option database.
          'priority' is interpreted as for *note option_add(): 4416. and
          defaults to ‘interactive’.

      -- メソッド: bell (displayof=0)

          Ring the bell on the display for this widget, using the
          display's current bell-related settings, and reset the screen
          saver for the screen.  If 'displayof' is given as a widget,
          the bell is rung on that widget's display instead.

      -- メソッド: tk_setPalette (background, /)

      -- メソッド: tk_setPalette (*args, **kw)

          Set a new color scheme for all Tk widget elements.  Existing
          widgets are updated and the option database is changed so that
          future widgets use the new colors.  A single color argument is
          taken as the normal background color, from which a complete
          palette is computed.  Alternatively, the arguments may be
          given as keyword 'name'/'value' pairs naming individual
          options in the option database.  The recognized option names
          are ‘activeBackground’, ‘activeForeground’, ‘background’,
          ‘disabledForeground’, ‘foreground’, ‘highlightBackground’,
          ‘highlightColor’, ‘insertBackground’, ‘selectColor’,
          ‘selectBackground’, ‘selectForeground’, and ‘troughColor’;
          reasonable defaults are computed for any that are not
          specified.

      -- メソッド: tk_bisque ()

          Restore the application's colors to the light brown (bisque)
          color scheme used in Tk 3.6 and earlier versions.  Provided
          for backward compatibility.

      -- メソッド: tk_strictMotif (boolean=None)

          Query or set whether Tk's look and feel should strictly adhere
          to Motif.  A true 'boolean' value enables strict Motif
          compliance (for example, no color change when the mouse passes
          over a slider).  Return the resulting setting.

     The methods with the ‘busy_’ prefix manage the busy state of a
     window, which shows a busy cursor and ignores user input.

      -- メソッド: tk_busy_hold (**kw)

          Make this widget appear busy.  A transparent window is placed
          in front of the widget, so that it and all of its descendants
          in the widget hierarchy are blocked from pointer events and
          display a busy cursor.  Normally *note update(): 43f9. should
          be called immediately afterwards to ensure that the hold
          operation is in effect before the application starts its
          processing.

          The only supported configuration option is 'cursor', the
          cursor to be displayed while the widget is busy; it may have
          any of the values accepted by ‘configure()’.

          *note busy_hold(): 441f, *note busy(): 441e. and *note
          tk_busy(): 4420. are aliases of ‘tk_busy_hold()’.

          Added in version 3.13.

      -- メソッド: tk_busy_configure (cnf=None, **kw)

          Query or modify the configuration options of the busy window.
          The widget must have been previously made busy by *note
          tk_busy_hold(): 4421.  With no arguments, return a dictionary
          describing all of the available options; if 'cnf' is the name
          of an option, return a tuple describing that one option.
          Otherwise set the given options to the given values.  Options
          may have any of the values accepted by ‘tk_busy_hold()’.

          The option database is referenced through the widget name or
          class.  For example, if a *note Frame: 4426. widget named
          ‘frame’ is to be made busy, the busy cursor can be specified
          for it by either of the calls:

               w.option_add('*frame.busyCursor', 'gumby')
               w.option_add('*Frame.BusyCursor', 'gumby')

          *note busy_configure(): 4422, *note busy_config(): 4423. and
          *note tk_busy_config(): 4424. are aliases of
          ‘tk_busy_configure()’.

          Added in version 3.13.

      -- メソッド: tk_busy_cget (option)

          Return the current value of the busy configuration 'option'.
          The widget must have been previously made busy by *note
          tk_busy_hold(): 4421, and 'option' may have any of the values
          accepted by that method.

          *note busy_cget(): 4427. is an alias of ‘tk_busy_cget()’.

          Added in version 3.13.

      -- メソッド: tk_busy_forget ()

          Make this widget no longer busy, releasing the resources
          (including the transparent window) allocated when it was made
          busy.  User events will again be received by the widget.
          These resources are also released when the widget is
          destroyed.

          *note busy_forget(): 4429. is an alias of ‘tk_busy_forget()’.

          Added in version 3.13.

      -- メソッド: tk_busy_status ()

          Return ‘True’ if the widget is currently busy, ‘False’
          otherwise.

          *note busy_status(): 442b. is an alias of ‘tk_busy_status()’.

          Added in version 3.13.

      -- メソッド: tk_busy_current (pattern=None)

          Return a list of widgets that are currently busy.  If
          'pattern' is given, only busy widgets whose path names match
          the pattern are returned.

          *note busy_current(): 442d. is an alias of
          ‘tk_busy_current()’.

          Added in version 3.13.

     The methods with the ‘winfo_’ prefix retrieve information about
     windows managed by Tk.

      -- メソッド: winfo_atom (name, displayof=0)

          Return the integer identifier for the atom whose name is
          'name', creating a new atom if none exists.  If 'displayof' is
          given, the atom is looked up on the display of that window;
          otherwise it is looked up on the display of the application's
          main window.

      -- メソッド: winfo_atomname (id, displayof=0)

          Return the textual name for the atom whose integer identifier
          is 'id'.  This is the inverse of *note winfo_atom(): 442f.  If
          'displayof' is given, the identifier is looked up on the
          display of that window; otherwise it is looked up on the
          display of the application's main window.

      -- メソッド: winfo_cells ()

          Return the number of cells in the colormap for the widget.

      -- メソッド: winfo_children ()

          Return a list containing the widgets that are children of the
          widget, in stacking order from lowest to highest.  Toplevel
          windows are returned as children of their logical parents.

      -- メソッド: winfo_class ()

          Return the class name of the widget.

      -- メソッド: winfo_colormapfull ()

          Return ‘True’ if the colormap for the widget is known to be
          full, ‘False’ otherwise.

      -- メソッド: winfo_containing (rootX, rootY, displayof=0)

          Return the widget containing the point given by 'rootX' and
          'rootY', or ‘None’ if no window in this application contains
          the point.  The coordinates are in screen units in the
          coordinate system of the root window.  If 'displayof' is
          given, the coordinates refer to the screen containing that
          window; otherwise they refer to the screen of the
          application's main window.

      -- メソッド: winfo_depth ()

          Return the depth of the widget, that is, the number of bits
          per pixel.

      -- メソッド: winfo_exists ()

          Return ‘1’ if the widget exists, ‘0’ otherwise.

      -- メソッド: winfo_fpixels (number)

          Return a floating-point value giving the number of pixels in
          the widget corresponding to the screen distance 'number' (for
          example, ‘"2.0c"’ or ‘"1i"’).  The result may be fractional;
          for a rounded integer value use *note winfo_pixels(): 4439.

      -- メソッド: winfo_geometry ()

          Return the geometry of the widget, in the form
          ‘widthxheight+x+y’.  All dimensions are in pixels.

      -- メソッド: winfo_height ()

          Return the height of the widget in pixels.  When a window is
          first created its height is 1 pixel; it is eventually changed
          by a geometry manager.  See also *note winfo_reqheight():
          443b.

      -- メソッド: winfo_id ()

          Return a low-level platform-specific identifier for the
          widget.  On Unix this is the X window identifier, and on
          Windows it is the window handle.

      -- メソッド: winfo_interps (displayof=0)

          Return a tuple of the names of all Tcl interpreters currently
          registered for a particular display.  If 'displayof' is given,
          the return value refers to the display of that window;
          otherwise it refers to the display of the application's main
          window.

      -- メソッド: winfo_ismapped ()

          Return ‘1’ if the widget is currently mapped, ‘0’ otherwise.

      -- メソッド: winfo_manager ()

          Return the name of the geometry manager currently responsible
          for the widget, or an empty string if it is not managed by any
          geometry manager.

      -- メソッド: winfo_name ()

          Return the widget's name within its parent, as opposed to its
          full path name.

      -- メソッド: winfo_parent ()

          Return the path name of the widget's parent, or an empty
          string if the widget is the main window of the application.

      -- メソッド: winfo_pathname (id, displayof=0)

          Return the path name of the window whose identifier is 'id'.
          If 'displayof' is given, the identifier is looked up on the
          display of that window; otherwise it is looked up on the
          display of the application's main window.

      -- メソッド: winfo_pixels (number)

          Return the number of pixels in the widget corresponding to the
          screen distance 'number' (for example, ‘"2.0c"’ or ‘"1i"’).
          The result is rounded to the nearest integer; for a fractional
          result use *note winfo_fpixels(): 4438.

      -- メソッド: winfo_pointerx ()

          Return the pointer's 'x' coordinate, in pixels, relative to
          the screen's root window (or virtual root, if one is in use).
          Return ‘-1’ if the pointer is not on the same screen as the
          widget.

      -- メソッド: winfo_pointerxy ()

          Return the pointer's coordinates as an ‘(x, y)’ tuple, in
          pixels, relative to the screen's root window (or virtual root,
          if one is in use).  Both coordinates are ‘-1’ if the pointer
          is not on the same screen as the widget.

      -- メソッド: winfo_pointery ()

          Return the pointer's 'y' coordinate, in pixels, relative to
          the screen's root window (or virtual root, if one is in use).
          Return ‘-1’ if the pointer is not on the same screen as the
          widget.

      -- メソッド: winfo_reqheight ()

          Return the widget's requested height in pixels.  This is the
          value used by the widget's geometry manager to compute its
          geometry.

      -- メソッド: winfo_reqwidth ()

          Return the widget's requested width in pixels.  This is the
          value used by the widget's geometry manager to compute its
          geometry.

      -- メソッド: winfo_rgb (color)

          Return an ‘(r, g, b)’ tuple of the red, green, and blue
          intensities, in the range 0 to 65535, that correspond to
          'color' in the widget.  'color' may be specified in any of the
          forms acceptable for a color option.

      -- メソッド: winfo_rootx ()

          Return the 'x' coordinate, in the root window of the screen,
          of the upper-left corner of the widget's border (or of the
          widget itself if it has no border).

      -- メソッド: winfo_rooty ()

          Return the 'y' coordinate, in the root window of the screen,
          of the upper-left corner of the widget's border (or of the
          widget itself if it has no border).

      -- メソッド: winfo_screen ()

          Return the name of the screen associated with the widget, in
          the form ‘displayName.screenIndex’.

      -- メソッド: winfo_screencells ()

          Return the number of cells in the default colormap for the
          widget's screen.

      -- メソッド: winfo_screendepth ()

          Return the depth of the root window of the widget's screen,
          that is, the number of bits per pixel.

      -- メソッド: winfo_screenheight ()

          Return the height of the widget's screen in pixels.

      -- メソッド: winfo_screenmmheight ()

          Return the height of the widget's screen in millimeters.

      -- メソッド: winfo_screenmmwidth ()

          Return the width of the widget's screen in millimeters.

      -- メソッド: winfo_screenvisual ()

          Return the default visual class for the widget's screen, one
          of ‘"directcolor"’, ‘"grayscale"’, ‘"pseudocolor"’,
          ‘"staticcolor"’, ‘"staticgray"’, or ‘"truecolor"’.

      -- メソッド: winfo_screenwidth ()

          Return the width of the widget's screen in pixels.

      -- メソッド: winfo_server ()

          Return a string containing information about the server for
          the widget's display.  The exact format of this string may
          vary from platform to platform.

      -- メソッド: winfo_toplevel ()

          Return the top-of-hierarchy window containing the widget.  In
          standard Tk this is always a *note Toplevel: 4453. widget.

      -- メソッド: winfo_viewable ()

          Return ‘1’ if the widget and all of its ancestors up through
          the nearest toplevel window are mapped, ‘0’ otherwise.

      -- メソッド: winfo_visual ()

          Return the visual class for the widget, one of
          ‘"directcolor"’, ‘"grayscale"’, ‘"pseudocolor"’,
          ‘"staticcolor"’, ‘"staticgray"’, or ‘"truecolor"’.

      -- メソッド: winfo_visualid ()

          Return the X identifier for the visual for the widget.

      -- メソッド: winfo_visualsavailable (includeids=False)

          Return a list describing the visuals available for the
          widget's screen.  Each item consists of a visual class (see
          *note winfo_visual(): 4454.) followed by an integer depth.  If
          'includeids' is true, the X identifier for the visual is also
          included.

      -- メソッド: winfo_vrootheight ()

          Return the height of the virtual root window associated with
          the widget if there is one; otherwise return the height of the
          widget's screen.

      -- メソッド: winfo_vrootwidth ()

          Return the width of the virtual root window associated with
          the widget if there is one; otherwise return the width of the
          widget's screen.

      -- メソッド: winfo_vrootx ()

          Return the 'x' offset of the virtual root window associated
          with the widget, relative to the root window of its screen.
          This is normally zero or negative, and is ‘0’ if there is no
          virtual root window.

      -- メソッド: winfo_vrooty ()

          Return the 'y' offset of the virtual root window associated
          with the widget, relative to the root window of its screen.
          This is normally zero or negative, and is ‘0’ if there is no
          virtual root window.

      -- メソッド: winfo_width ()

          Return the width of the widget in pixels.  When a window is
          first created its width is 1 pixel; it is eventually changed
          by a geometry manager.  See also *note winfo_reqwidth(): 4446.

      -- メソッド: winfo_x ()

          Return the 'x' coordinate, in the widget's parent, of the
          upper-left corner of the widget's border (or of the widget
          itself if it has no border).

      -- メソッド: winfo_y ()

          Return the 'y' coordinate, in the widget's parent, of the
          upper-left corner of the widget's border (or of the widget
          itself if it has no border).

      -- メソッド: info_patchlevel ()

          Return the Tcl/Tk patch level as a named tuple with the same
          five fields as *note sys.version_info: 8b0.: 'major', 'minor',
          'micro', 'releaselevel' and 'serial'.  'releaselevel' is
          ‘'alpha'’, ‘'beta'’ or ‘'final'’.  Converting it to a string
          gives the version in the usual Tcl/Tk notation, for example
          ‘'9.0.3'’ for a final release or ‘'9.1b2'’ for a pre-release.

          Added in version 3.11.

 -- クラス: tkinter.Wm

     The ‘Wm’ mixin provides access to the window manager, allowing an
     application to control such things as the title, geometry and icon
     of a top-level window, the way it is resized, and how it responds
     to window manager protocols.  It is mixed into *note Tk: 1779. and
     *note Toplevel: 4453, so its methods are available on every
     top-level window.  Each method has two equivalent spellings: a
     short name and a ‘wm_’-prefixed name (for example, *note title():
     445e. and *note wm_title(): 445f.).

      -- メソッド: aspect (minNumer=None, minDenom=None, maxNumer=None,
               maxDenom=None)

          Constrain the aspect ratio (the ratio of width to height) of
          the window.  If all four arguments are given, the window
          manager keeps the ratio between ‘minNumer/minDenom’ and
          ‘maxNumer/maxDenom’; passing empty strings removes any
          existing restriction.  With no arguments, return a tuple of
          the four current values, or an empty string if no aspect
          restriction is in effect.  *note wm_aspect(): 4460. is an
          alias of ‘aspect()’.

      -- メソッド: attributes (*args, return_python_dict=False,
               **kwargs)

          Query or set platform-specific attributes of the window.  With
          no arguments, return the platform-specific flags and their
          values; pass 'return_python_dict' as true to get them as a
          dictionary.  A single option name such as ‘'alpha'’ returns
          the value of that option, and options are set using keyword
          arguments (‘alpha=0.5’).

          The available attributes differ by platform.  All platforms
          support:

          'alpha'

               The window's opacity, from ‘0.0’ (fully transparent) to
               ‘1.0’ (opaque).  Where transparency is unsupported the
               value stays at ‘1.0’.

          'appearance'

               Whether the window is rendered in dark mode on Windows
               and macOS: ‘'auto'’, ‘'light'’ or ‘'dark'’ (this has no
               effect on X11).

          'fullscreen'

               Whether the window takes up the entire screen and has no
               borders.

          'topmost'

               Whether the window is displayed above all other windows.

          Windows additionally supports:

          'disabled'

               Whether the window is in a disabled state.

          'toolwindow'

               Whether the window uses the tool window style.

          'transparentcolor'

               The color that is made fully transparent, or an empty
               string for none.

          macOS additionally supports:

          'class'

               Whether the underlying Aqua window is an ‘nswindow’ or an
               ‘nspanel’; this can only be set before the window is
               created.

          'modified'

               The modification state shown by the window's close button
               and proxy icon.

          'notify'

               Whether the application's dock icon bounces to request
               attention.

          'stylemask'

               The style mask of the underlying Aqua window, given as a
               list of bit names such as ‘titled’ or ‘resizable’.

          'tabbingid'

               The identifier of the tab group that the window belongs
               to.

          'tabbingmode'

               Whether the window may be opened as a tab: ‘'auto'’,
               ‘'preferred'’ or ‘'disallowed'’.

          'titlepath'

               The path of the file represented by the window's proxy
               icon.

          'transparent'

               Whether the content area is transparent and the window
               shadow is turned off.

          X11 additionally supports:

          'type'

               The window type, or a list of types in order of
               preference, that the window manager should use to
               interpret the window, such as ‘'dialog'’ or ‘'splash'’.

          'zoomed'

               Whether the window is maximized.

               注釈: Tk 8.6 added the 'type' attribute, and Tk 9.0 added
               the 'appearance', 'class', 'stylemask', 'tabbingid' and
               'tabbingmode' attributes.

          On X11 changes are applied asynchronously, so a queried value
          may not yet reflect the most recent request.  *note
          wm_attributes(): 4462. is an alias of ‘attributes()’.

          バージョン 3.13 で変更: A single attribute may now be queried
          by name without the leading ‘-’, and attributes may be set
          using keyword arguments.  The 'return_python_dict' parameter
          was added.

          バージョン 3.13 で非推奨: Setting an attribute by passing the
          option name (with a leading ‘-’) and its value as two
          positional arguments, as in ‘w.attributes('-alpha', 0.5)’, is
          deprecated; use keyword arguments instead.

      -- メソッド: client (name=None)

          Store 'name', which should be the name of the host on which
          the application is running, in the window's
          ‘WM_CLIENT_MACHINE’ property for use by the window or session
          manager.  An empty string deletes the property.  With no
          argument, return the last name set, or an empty string.  *note
          wm_client(): 4464. is an alias of ‘client()’.

      -- メソッド: colormapwindows (*wlist)

          Manipulate the ‘WM_COLORMAP_WINDOWS’ property, which tells the
          window manager about windows that have private colormaps.  If
          'wlist' is given, overwrite the property with those windows
          (their order is a priority order for installing colormaps).
          With no arguments, return the list of windows currently named
          in the property.  *note wm_colormapwindows(): 4466. is an
          alias of ‘colormapwindows()’.

      -- メソッド: command (value=None)

          Store 'value' in the window's ‘WM_COMMAND’ property for use by
          the window or session manager; it should be a list giving the
          words of the command used to invoke the application.  An empty
          string deletes the property.  With no argument, return the
          last value set, or an empty string.  *note wm_command(): 4468.
          is an alias of ‘command()’.

      -- メソッド: deiconify ()

          Display the window in normal (non-iconified) form by mapping
          it.  If the window has never been mapped, this ensures it
          appears de-iconified when it is first mapped.  On Windows the
          window is also raised and given the focus.  *note
          wm_deiconify(): 446a. is an alias of ‘deiconify()’.

      -- メソッド: focusmodel (model=None)

          Set or query the focus model for the window.  'model' is
          either ‘'active'’ (the window claims the input focus for
          itself or its descendants, even when the focus is in another
          application) or ‘'passive'’ (the window relies on the window
          manager to give it the focus).  With no argument, return the
          current model.  The default is ‘'passive'’, which is what the
          ‘focus()’ command assumes.  *note wm_focusmodel(): 446c. is an
          alias of ‘focusmodel()’.

      -- メソッド: forget (window)

          Unmap 'window' from the screen so that it is no longer managed
          by the window manager.  A *note Toplevel: 4453. is then
          treated like a *note Frame: 4426, although its ‘-menu’
          configuration is remembered and the menu reappears if the
          widget is managed again.  *note wm_forget(): 446e. is an alias
          of ‘forget()’.

          Not to be confused with *note Pack.forget(): 4470.

          Added in version 3.3.

      -- メソッド: frame ()

          Return the platform-specific window identifier for the
          outermost decorative frame containing the window, if the
          window manager has reparented it into such a frame; otherwise
          return the identifier of the window itself.  *note wm_frame():
          4471. is an alias of ‘frame()’.

      -- メソッド: geometry (newGeometry=None)

          Set or query the geometry of the window.  'newGeometry' has
          the form ‘=widthxheight+x+y’, where any of ‘=’, ‘widthxheight’
          and the ‘+x+y’ position may be omitted.  'width' and 'height'
          are in pixels (or grid units for a gridded window); a position
          preceded by ‘+’ is measured from the left or top edge of the
          screen and one preceded by ‘-’ from the right or bottom edge.
          An empty string cancels any user-specified geometry, letting
          the window revert to its natural size.  With no argument,
          return the current geometry as a string of the form
          ‘'200x200+10+10'’.  *note wm_geometry(): 4473. is an alias of
          ‘geometry()’.

      -- メソッド: grid (baseWidth=None, baseHeight=None, widthInc=None,
               heightInc=None)

          Manage the window as a gridded window and define the
          relationship between grid units and pixels.  'baseWidth' and
          'baseHeight' are the numbers of grid units for the window's
          internally requested size, and 'widthInc' and 'heightInc' are
          the pixel sizes of a horizontal and vertical grid unit.  Empty
          strings turn off gridded management.  With no arguments,
          return a tuple of the four current values, or an empty string
          if the window is not gridded.  *note wm_grid(): 4475. is an
          alias of ‘grid()’.

          Not to be confused with the grid geometry manager *note
          Grid.grid(): 4393.

      -- メソッド: group (pathName=None)

          Set or query the leader of a group of related windows.
          'pathName' gives the path name of the group leader; the window
          manager may, for example, unmap all windows in the group when
          the leader is iconified.  An empty string removes the window
          from any group.  With no argument, return the path name of the
          current group leader, or an empty string.  *note wm_group():
          4477. is an alias of ‘group()’.

      -- メソッド: iconbitmap (bitmap=None, default=None)

          Set or query the bitmap used by the window manager for the
          window's icon.  'bitmap' names a bitmap in one of the standard
          forms accepted by Tk; an empty string cancels the current icon
          bitmap.  With no argument, return the name of the current icon
          bitmap, or an empty string.  On Windows the 'default' argument
          names an icon (for example an ‘.ico’ file) applied to all
          top-level windows that have no icon of their own.  *note
          wm_iconbitmap(): 4479. is an alias of ‘iconbitmap()’.

      -- メソッド: iconify ()

          Iconify the window.  If the window has not yet been mapped for
          the first time, arrange for it to appear in the iconified
          state when it is eventually mapped.  *note wm_iconify(): 447b.
          is an alias of ‘iconify()’.

      -- メソッド: iconmask (bitmap=None)

          Set or query the bitmap used as a mask for the icon (see *note
          iconbitmap(): 447a.).  Where the mask is zero no icon is
          displayed; where it is one, the corresponding bits of the icon
          bitmap are shown.  An empty string cancels the current mask.
          With no argument, return the name of the current icon mask, or
          an empty string.  *note wm_iconmask(): 447d. is an alias of
          ‘iconmask()’.

      -- メソッド: iconname (newName=None)

          Set or query the name displayed by the window manager inside
          the window's icon.  With no argument, return the current icon
          name, or an empty string if none has been set (in which case
          the window manager normally displays the window's title).
          *note wm_iconname(): 447f. is an alias of ‘iconname()’.

      -- メソッド: iconphoto (default=False, *images)

          Set the titlebar icon for the window from one or more *note
          PhotoImage: 1e42. objects given in 'images'.  Several images
          of different sizes (for example 16x16 and 32x32) may be
          supplied so that the window manager can choose an appropriate
          one.  The image data is taken as a snapshot at the time of the
          call; later changes to the images are not reflected.  If
          'default' is true, the icon is also applied to all top-level
          windows created in the future.  On macOS only the first image
          is used.  *note wm_iconphoto(): 4481. is an alias of
          ‘iconphoto()’.

          Added in version 3.3.

      -- メソッド: iconposition (x=None, y=None)

          Set or query a hint to the window manager about where the
          window's icon should be positioned.  Empty strings cancel an
          existing hint.  With no arguments, return a tuple of the two
          current values, or an empty string if no hint is in effect.
          *note wm_iconposition(): 4483. is an alias of
          ‘iconposition()’.

      -- メソッド: iconwindow (pathName=None)

          Set or query the window used as the icon for the window.  When
          the window is iconified, 'pathName' is mapped to serve as its
          icon and unmapped again when it is de-iconified.  An empty
          string cancels the association.  With no argument, return the
          path name of the current icon window, or an empty string.  Not
          all window managers support icon windows, and the concept is
          meaningless on non-X11 platforms.  *note wm_iconwindow():
          4485. is an alias of ‘iconwindow()’.

      -- メソッド: manage (widget)

          Make 'widget' a stand-alone top-level window, decorated by the
          window manager with a title bar and so on.  Only *note Frame:
          4426, *note LabelFrame: 4489. and *note Toplevel: 4453.
          widgets may be used; passing any other widget type raises an
          error.  *note wm_manage(): 4487. is an alias of ‘manage()’.

          Added in version 3.3.

      -- メソッド: maxsize (width=None, height=None)

          Set or query the maximum permissible dimensions of the window,
          in pixels (or grid units for a gridded window).  The window
          manager restricts the window to be no larger than 'width' and
          'height'.  With no arguments, return a tuple of the current
          maximum width and height.  The maximum size defaults to the
          size of the screen.  *note wm_maxsize(): 448a. is an alias of
          ‘maxsize()’.

      -- メソッド: minsize (width=None, height=None)

          Set or query the minimum permissible dimensions of the window,
          in pixels (or grid units for a gridded window).  The window
          manager restricts the window to be no smaller than 'width' and
          'height'.  With no arguments, return a tuple of the current
          minimum width and height.  The minimum size defaults to one
          pixel in each dimension.  *note wm_minsize(): 448c. is an
          alias of ‘minsize()’.

      -- メソッド: overrideredirect (boolean=None)

          Set or query the override-redirect flag for the window.  When
          this flag is set, the window is ignored by the window manager:
          it is not reparented into a decorative frame and the user
          cannot manipulate it through the usual window manager
          controls.  With no argument, return a boolean indicating
          whether the flag is set.  The flag is reliably honored only
          when the window is first mapped or remapped from the withdrawn
          state.  *note wm_overrideredirect(): 448e. is an alias of
          ‘overrideredirect()’.

      -- メソッド: positionfrom (who=None)

          Set or query the source of the window's current position.
          'who' is either ‘'program'’ or ‘'user'’ and indicates whether
          the position was requested by the program or by the user; an
          empty string cancels the current source.  With no argument,
          return the current source, or an empty string if none has been
          set.  Tk automatically sets the source to ‘'user'’ when *note
          geometry(): 4474. is called, unless it has been set explicitly
          to ‘'program'’.  *note wm_positionfrom(): 4490. is an alias of
          ‘positionfrom()’.

      -- メソッド: protocol (name=None, func=None)

          Register 'func' as the handler for the window manager protocol
          'name', an atom such as ‘'WM_DELETE_WINDOW'’,
          ‘'WM_SAVE_YOURSELF'’ or ‘'WM_TAKE_FOCUS'’; 'func' is then
          called whenever the window manager sends a message of that
          protocol.  Tk installs a default ‘WM_DELETE_WINDOW’ handler
          that destroys the window, which this method can replace.  If
          'func' is an empty string, the handler is removed.  With only
          'name', return the name of its registered handler command, or
          an empty string if none is set (the default ‘WM_DELETE_WINDOW’
          handler is not reported); with no arguments, return a tuple of
          the protocols that currently have handlers.  *note
          wm_protocol(): 4492. is an alias of ‘protocol()’.

      -- メソッド: resizable (width=None, height=None)

          Control whether the user may interactively resize the window.
          'width' and 'height' are boolean values that determine whether
          the window's width and height may be changed.  With no
          arguments, return a tuple of two ‘0’/‘1’ values indicating
          whether each dimension is currently resizable.  By default a
          window is resizable in both dimensions.  *note wm_resizable():
          4494. is an alias of ‘resizable()’.

      -- メソッド: sizefrom (who=None)

          Set or query the source of the window's current size.  'who'
          is either ‘'program'’ or ‘'user'’ and indicates whether the
          size was requested by the program or by the user; an empty
          string cancels the current source.  With no argument, return
          the current source, or an empty string if none has been set.
          *note wm_sizefrom(): 4496. is an alias of ‘sizefrom()’.

      -- メソッド: state (newstate=None)

          Set or query the state of the window.  With no argument,
          return the current state: one of ‘'normal'’, ‘'iconic'’,
          ‘'withdrawn'’, ‘'icon'’ or, on Windows and macOS only,
          ‘'zoomed'’.  ‘'iconic'’ refers to a window that has been
          iconified, while ‘'icon'’ refers to a window serving as the
          icon for another window (see *note iconwindow(): 4486.); the
          ‘'icon'’ state cannot be set.  *note wm_state(): 4498. is an
          alias of ‘state()’.

          Not to be confused with *note ttk.Widget.state: 449a.

      -- メソッド: title (string=None)

          Set or query the title for the window, which the window
          manager should display in the window's title bar.  With no
          argument, return the current title.  The title defaults to the
          window's name.  *note wm_title(): 445f. is an alias of
          ‘title()’.

      -- メソッド: transient (master=None)

          Mark the window as a transient window (such as a pull-down
          menu or dialog) working on behalf of 'master', the path name
          of another top-level window.  An empty string clears the
          transient status.  With no argument, return the path name of
          the current master, or an empty string.  A transient window
          mirrors state changes in its master and may be decorated
          differently by the window manager; it is an error to make a
          window a transient of itself.  *note wm_transient(): 449b. is
          an alias of ‘transient()’.

      -- メソッド: withdraw ()

          Withdraw the window from the screen, unmapping it and causing
          the window manager to forget about it.  If the window has
          never been mapped, it is instead mapped in the withdrawn
          state.  It is sometimes necessary to withdraw a window and
          then re-map it (for example with *note deiconify(): 446b.) to
          make some window managers notice changes to window attributes.
          *note wm_withdraw(): 449d. is an alias of ‘withdraw()’.

 -- クラス: tkinter.Pack

     Geometry manager that arranges widgets by packing them against the
     sides of their container.  The ‘Pack’ mix-in is inherited by all
     widgets (through *note Widget: 43a3.) and provides the methods for
     managing a widget with the 'pack' geometry manager.  See also *note
     The packer: 43a9.

          注釈: ‘Pack’, *note Place: 44a0. and *note Grid: 44a1. all
          define the short method names ‘forget()’, ‘info()’,
          ‘slaves()’, ‘content()’ and ‘propagate()’.  On a widget the
          bare names resolve to the 'pack' manager's versions, since
          ‘Pack’ and *note Misc: 43c2. precede ‘Place’ and ‘Grid’ in the
          method resolution order, whatever manager actually manages the
          widget; and ‘configure()’/‘config()’ configure the widget's
          options, not its geometry.  Use the explicit ‘pack_*’,
          ‘grid_*’ and ‘place_*’ methods (and ‘pack’, ‘grid’, ‘place’
          for geometry configuration) to act on a specific geometry
          manager.

      -- メソッド: pack_configure (cnf={}, **kw)
      -- メソッド: pack (cnf={}, **kw)

          Pack the widget inside its container, positioning it relative
          to the siblings already packed there.  The supported options
          are:

          'side'

               Which side of the container to pack the widget against:
               ‘'top'’ (the default), ‘'bottom'’, ‘'left'’ or ‘'right'’.

          'fill'

               Whether to stretch the widget to fill its parcel:
               ‘'none'’ (the default), ‘'x'’, ‘'y'’ or ‘'both'’.

          'expand'

               Whether the widget should expand to consume any extra
               space in its container (a boolean, default false).

          'anchor'

               Where to position the widget in its parcel when the
               parcel is larger than the widget: an anchor such as ‘'n'’
               or ‘'sw'’ (default ‘'center'’).

          'ipadx', 'ipady'

               Internal padding added on the left and right ('ipadx') or
               top and bottom ('ipady') of the widget, as a screen
               distance (default ‘0’).

          'padx', 'pady'

               External padding left on the left and right ('padx') or
               top and bottom ('pady') of the widget, as a screen
               distance or a pair of two distances for the two sides
               (default ‘0’).

          'after'

               Pack the widget after the given widget in the packing
               order, using the same container.

          'before'

               Pack the widget before the given widget in the packing
               order, using the same container.

          'in_'

               The container in which to pack the widget; it defaults to
               the parent widget.

          ‘pack()’, *note configure(): 44a2. and *note config(): 44a3.
          are aliases of ‘pack_configure()’.

      -- メソッド: pack_forget ()

          Unmap the widget and remove it from the packing order,
          forgetting its packing options.  It can be packed again later
          with *note pack_configure(): 44a4.  *note forget(): 4470. is
          an alias of ‘pack_forget()’, except on *note PanedWindow:
          44a6, *note ttk.Notebook: 44a7. and *note ttk.PanedWindow:
          44a8, which provide their own ‘forget()’ method.

          Not to be confused with *note Wm.forget(): 446f.

      -- メソッド: pack_info ()

          Return a dictionary of the widget's current packing options.
          *note info(): 44a9. is an alias of ‘pack_info()’.

      -- メソッド: pack_propagate ()

      -- メソッド: pack_propagate (flag)

          Same as *note Misc.pack_propagate(): 43e4, treating this
          widget as a container: enable or disable geometry propagation.
          *note propagate(): 44ab. is an alias of ‘pack_propagate()’.

      -- メソッド: pack_slaves ()

          Same as *note Misc.pack_slaves(): 43e6.: return the list of
          widgets packed in this widget.  *note slaves(): 44ad. is an
          alias of ‘pack_slaves()’.

 -- クラス: tkinter.Place

     Geometry manager that places widgets at explicit positions and
     sizes within their container.  The ‘Place’ mix-in is inherited by
     all widgets (through *note Widget: 43a3.).

      -- メソッド: place_configure (cnf={}, **kw)
      -- メソッド: place (cnf={}, **kw)

          Place the widget inside its container at an absolute or
          relative position.  The supported options are:

          'x', 'y'

               The absolute horizontal and vertical position of the
               widget's anchor point, as a screen distance (default
               ‘0’).

          'relx', 'rely'

               The horizontal and vertical position of the widget's
               anchor point as a fraction of the container's width and
               height, where ‘0.0’ is the left or top edge and ‘1.0’ is
               the right or bottom edge.  If both the absolute and the
               relative option are given, their values are summed.

          'anchor'

               Which point of the widget is placed at the given
               position: an anchor such as ‘'n'’ or ‘'se'’ (default
               ‘'nw'’).

          'width', 'height'

               The absolute width and height of the widget, as a screen
               distance.  By default the widget's requested size is
               used.

          'relwidth', 'relheight'

               The width and height of the widget as a fraction of the
               container's width and height.  If both the absolute and
               the relative option are given, their values are summed.

          'bordermode'

               How the container's border affects placement: ‘'inside'’
               (the default) measures the area inside the border,
               ‘'outside'’ measures the area including the border, and
               ‘'ignore'’ uses the official X area.

          'in_'

               The container relative to which the widget is placed; it
               must be the widget's parent or a descendant of the
               parent, and defaults to the parent.

          ‘place()’, *note configure(): 44af. and *note config(): 44b0.
          are aliases of ‘place_configure()’.

      -- メソッド: place_forget ()

          Unmap the widget and remove it from the placement, forgetting
          its place options.

      -- メソッド: place_info ()

          Return a dictionary of the widget's current place options.

      -- メソッド: place_slaves ()

          Same as *note Misc.place_slaves(): 43e7.: return the list of
          widgets placed in this widget.

 -- クラス: tkinter.Grid

     Geometry manager that arranges widgets in a two-dimensional grid of
     rows and columns within their container.  The ‘Grid’ mix-in is
     inherited by all widgets (through *note Widget: 43a3.).

      -- メソッド: grid_configure (cnf={}, **kw)
      -- メソッド: grid (cnf={}, **kw)

          Position the widget in a cell of its container's grid.

          Not to be confused with *note Wm.grid(): 4476.

          The supported options are:

          'row', 'column'

               The row and column of the cell to place the widget in,
               counting from ‘0’.  'column' defaults to the column after
               the previous widget placed in the same ‘grid_configure()’
               call (or ‘0’), and 'row' defaults to the next empty row.

          'rowspan', 'columnspan'

               The number of rows and columns the widget should span
               (default ‘1’).

          'sticky'

               How to position or stretch the widget when its cell is
               larger than the widget: a string containing zero or more
               of the characters ‘'n'’, ‘'s'’, ‘'e'’ and ‘'w'’, naming
               the cell sides the widget sticks to.  Specifying both
               ‘'n'’ and ‘'s'’ (or ‘'e'’ and ‘'w'’) stretches the widget
               to fill the height (or width) of the cell.  The default
               is ‘''’, which centers the widget at its requested size.

          'ipadx', 'ipady'

               Internal padding added on the left and right ('ipadx') or
               top and bottom ('ipady') of the widget, as a screen
               distance (default ‘0’).

          'padx', 'pady'

               External padding left on the left and right ('padx') or
               top and bottom ('pady') of the widget, as a screen
               distance or a pair of two distances for the two sides
               (default ‘0’).

          'in_'

               The container in whose grid to place the widget; it
               defaults to the parent widget.

          ‘grid()’, *note configure(): 44b9. and *note config(): 44ba.
          are aliases of ‘grid_configure()’.

      -- メソッド: grid_forget ()

          Unmap the widget and remove it from the grid, forgetting its
          grid options.

      -- メソッド: grid_remove ()

          Unmap the widget and remove it from the grid, but remember its
          grid options so that it is restored to the same cell if it is
          gridded again.

      -- メソッド: grid_info ()

          Return a dictionary of the widget's current grid options.

      -- メソッド: grid_bbox (column=None, row=None, col2=None,
               row2=None)

          Same as *note Misc.grid_bbox(): 43d6.  *note bbox(): 44c1. is
          an alias of ‘grid_bbox()’, except on *note Canvas: 1a59, *note
          Listbox: 43d7, *note Spinbox: 43d8, *note Text: 1a58, *note
          ttk.Entry: 43d9. and *note ttk.Treeview: c8b, which provide
          their own ‘bbox()’ method.

      -- メソッド: grid_columnconfigure (index, cnf={}, **kw)

          Same as *note Misc.grid_columnconfigure(): 43db.: query or set
          the options (such as 'weight', 'minsize', 'pad' and 'uniform')
          of a grid column.  *note columnconfigure(): 44c3. is an alias
          of ‘grid_columnconfigure()’.

      -- メソッド: grid_rowconfigure (index, cnf={}, **kw)

          Same as *note Misc.grid_rowconfigure(): 43dd.: query or set
          the options of a grid row.  *note rowconfigure(): 44c5. is an
          alias of ‘grid_rowconfigure()’.

      -- メソッド: grid_location (x, y)

          Same as *note Misc.grid_location(): 43de.: return the
          ‘(column, row)’ of the cell that covers the pixel at 'x', 'y'.
          *note location(): 44c7. is an alias of ‘grid_location()’.

      -- メソッド: grid_size ()

          Same as *note Misc.grid_size(): 43e1.: return a ‘(columns,
          rows)’ tuple giving the size of the grid.  *note size(): 44c9.
          is an alias of ‘grid_size()’, except on the *note Listbox:
          43d7. widget, which provides its own ‘size()’ method.

      -- メソッド: grid_propagate ()

      -- メソッド: grid_propagate (flag)

          Same as *note Misc.grid_propagate(): 43df.

      -- メソッド: grid_slaves (row=None, column=None)

          Same as *note Misc.grid_slaves(): 43e2.: return the widgets
          managed in the grid, optionally restricted to a 'row' and/or
          'column'.

 -- クラス: tkinter.XView

     Mix-in providing the horizontal-scrolling interface shared by
     widgets such as *note Entry: 440e, *note Canvas: 1a59, *note
     Listbox: 43d7, *note Text: 1a58. and *note Spinbox: 43d8.  A
     widget's *note xview(): 44d0. method is registered as the 'command'
     of a horizontal *note Scrollbar: 44d1.

      -- メソッド: xview (*args)

          Query or change the horizontal position of the view.  With no
          arguments, return a tuple ‘(first, last)’ of two fractions
          between 0 and 1 giving the portion of the document that is
          currently visible.  Otherwise the arguments are passed to the
          Tk ‘xview’ widget command and are usually generated by a
          scrollbar; *note xview_moveto(): 44d2. and *note
          xview_scroll(): 44d3. provide a more convenient interface.

      -- メソッド: xview_moveto (fraction)

          Adjust the view so that 'fraction' of the total width of the
          document is off-screen to the left.  'fraction' is a number
          between 0 and 1.

      -- メソッド: xview_scroll (number, what)

          Shift the view left or right by 'number' units.  'what' is
          either ‘'units'’ or ‘'pages'’; a negative 'number' scrolls
          left and a positive one scrolls right.

 -- クラス: tkinter.YView

     Mix-in providing the vertical-scrolling interface shared by widgets
     such as *note Canvas: 1a59, *note Listbox: 43d7. and *note Text:
     1a58.  A widget's *note yview(): 44d5. method is registered as the
     'command' of a vertical *note Scrollbar: 44d1.

      -- メソッド: yview (*args)

          Query or change the vertical position of the view.  With no
          arguments, return a tuple ‘(first, last)’ of two fractions
          between 0 and 1 giving the portion of the document that is
          currently visible.  Otherwise the arguments are passed to the
          Tk ‘yview’ widget command, usually generated by a scrollbar;
          *note yview_moveto(): 44d6. and *note yview_scroll(): 44d7.
          provide a more convenient interface.

      -- メソッド: yview_moveto (fraction)

          Adjust the view so that 'fraction' of the total height of the
          document is off-screen above the top.  'fraction' is a number
          between 0 and 1.

      -- メソッド: yview_scroll (number, what)

          Shift the view up or down by 'number' units.  'what' is either
          ‘'units'’ or ‘'pages'’; a negative 'number' scrolls up and a
          positive one scrolls down.

 -- クラス: tkinter.BaseWidget (master, widgetName, cnf={}, kw={},
          extra=())

     Internal base class for all widgets.  It inherits from *note Misc:
     43c2. and adds the machinery that creates the underlying Tk widget;
     application code normally uses *note Widget: 43a3. or a concrete
     widget class rather than instantiating ‘BaseWidget’ directly.

      -- メソッド: destroy ()

          Destroy this widget and all of its children, removing the
          corresponding Tk widgets and deleting the associated Tcl
          commands.

 -- クラス: tkinter.Widget (master, widgetName, cnf={}, kw={}, extra=())

     Internal base class for the standard widgets.  It combines *note
     BaseWidget: 43c3. with the geometry-manager mix-ins *note Pack:
     449f, *note Place: 44a0. and *note Grid: 44a1, so that every widget
     can be managed by any of the three geometry managers.  The concrete
     widget classes (*note Button: 44d9, *note Label: 44da, and so on)
     derive from ‘Widget’.


File: python.info,  Node: Toplevel widgets,  Next: Widget classes,  Prev: Base and mixin classes,  Up: リファレンス<8>

5.26.1.22 Toplevel widgets
..........................

 -- クラス: 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.  Inherits
     from *note Misc: 43c2. and *note Wm: 43b5.

     To create a Tcl interpreter without initializing the Tk subsystem,
     use the *note Tcl(): 44dc. factory function instead.

     The ‘Tk’ 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(): 44dc. 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 *note winfo_id(): 443c.).

          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.

     ‘Tk’ 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: 2cd3.

      -- の属性: tk

          The Tk application object created by instantiating ‘Tk’.  This
          provides access to the Tcl interpreter.  Each widget that is
          attached the same instance of ‘Tk’ has the same value for its
          *note tk: 44dd. attribute.

      -- の属性: master

          The widget object that contains this widget.  For ‘Tk’, the
          ‘master’ is *note None: 886. because it is the main window.
          The terms 'master' and 'parent' are similar and sometimes used
          interchangeably as argument names; however, calling *note
          winfo_parent(): 4441. 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: 184.
          with the child widget names as the keys and the child instance
          objects as the values.

      -- メソッド: destroy ()

          Destroy this and all descendant widgets and, for the main
          window, end the connection to the underlying Tcl interpreter.

      -- メソッド: loadtk ()

          Finish loading and initializing the Tk subsystem.  This is
          needed only when the interpreter was created without Tk (for
          example through *note Tcl(): 44dc.); it is called
          automatically when 'useTk' is true.

      -- メソッド: readprofile (baseName, className)

          Read and source the user's profile files ‘.`className'.tcl’
          and ‘.`baseName'.tcl’ into the Tcl interpreter, and execute
          the corresponding ‘.`className'.py’ and ‘.`baseName'.py’
          files.  This is called during initialization; see the
          description of the constructor above.

      -- メソッド: report_callback_exception (exc, val, tb)

          Report a callback exception.  This is called when an exception
          propagates out of a Tkinter callback; 'exc', 'val' and 'tb'
          are the exception type, value and traceback as returned by
          *note sys.exc_info(): 89b.  The default implementation prints
          a traceback to *note sys.stderr: b37.  It can be overridden to
          customize error handling, for example to display the traceback
          in a dialog.

 -- クラス: tkinter.Toplevel (master=None, cnf={}, **kw)

     A ‘Toplevel’ widget is a top-level window, similar to a *note
     Frame: 4426. except that its X parent is the root window of a
     screen rather than its logical parent.  Its primary purpose is to
     serve as a container for dialog boxes and other collections of
     widgets; its only visible features are its background and an
     optional 3-D border.  Notable options include 'menu', which
     installs a *note Menu: 44e3. as the window's menubar.  Inherits
     from *note BaseWidget: 43c3. and *note Wm: 43b5, so a toplevel is
     managed by the window manager.  Refer to the Tk ‘toplevel’ manual
     page for the full list of options.


File: python.info,  Node: Widget classes,  Next: Variable classes,  Prev: Toplevel widgets,  Up: リファレンス<8>

5.26.1.23 Widget classes
........................

 -- クラス: tkinter.Button (master=None, cnf={}, **kw)

     A ‘Button’ widget displays a textual string, bitmap or image and
     invokes a command when the user presses it (by clicking mouse
     button 1 over the button or, when the button has focus, by pressing
     the space key).  Inherits from *note Widget: 43a3.  In addition to
     the standard widget options, a button accepts the options
     documented in the Tk ‘button’ manual page, such as 'command' (the
     callback invoked when the button is pressed), 'textvariable',
     'state' and 'default'.

      -- メソッド: invoke ()

          Invoke the command associated with the button, if there is
          one, and return its result, or an empty string if no command
          is associated with the button.  This is ignored if the
          button's state is ‘disabled’.

      -- メソッド: flash ()

          Flash the button by redisplaying it several times, alternating
          between the active and normal colors.  At the end of the flash
          the button is left in the same normal or active state as when
          the method was called.  This is ignored if the button's state
          is ‘disabled’.

 -- クラス: tkinter.Canvas (master=None, cnf={}, **kw)

     A ‘Canvas’ widget implements structured graphics.  It displays any
     number of 'items', such as arcs, lines, ovals, polygons,
     rectangles, text, bitmaps, images and embedded windows, which may
     be drawn, moved, re-colored and bound to events.  Inherits from
     *note Widget: 43a3, *note XView: 44cf. and *note YView: 44d4, so
     the view can be scrolled horizontally and vertically with *note
     xview(): 44d0. and *note yview(): 44d5.  Refer to the Tk ‘canvas’
     manual page for the full list of widget and item options.

     Each item has a unique integer 'id', assigned when it is created,
     and zero or more string 'tags'.  A tag is an arbitrary string that
     does not have the form of an integer; the same tag may be shared by
     many items, which makes tags convenient for grouping items.  The
     special tag ‘'all'’ matches every item in the canvas, and
     ‘'current'’ matches the topmost item under the mouse pointer.  Most
     methods take a 'tagOrId' argument that may be an integer id naming
     a single item, or a tag naming zero or more items; as described in
     the Tk ‘canvas’ manual page, a tag may also be a logical expression
     of tags combined with the operators ‘&&’, ‘||’, ‘^’, ‘!’ and
     parentheses.  When a method that operates on a single item is given
     a 'tagOrId' matching several items, it normally uses the lowest
     matching item in the display list.

     The items are kept in a 'display list' that determines drawing
     order: items later in the list are drawn on top of earlier ones.  A
     newly created item is placed at the top of the list; the order can
     be changed with *note tag_raise(): 44e7. and *note tag_lower():
     44e8.

      -- メソッド: create_arc (*args, **kw)
      -- メソッド: create_bitmap (*args, **kw)
      -- メソッド: create_image (*args, **kw)
      -- メソッド: create_line (*args, **kw)
      -- メソッド: create_oval (*args, **kw)
      -- メソッド: create_polygon (*args, **kw)
      -- メソッド: create_rectangle (*args, **kw)
      -- メソッド: create_text (*args, **kw)
      -- メソッド: create_window (*args, **kw)

          Create a new item of the corresponding type and return its
          integer id.  Each method is called as ‘create_TYPE(coord...,
          **options)’: the leading positional arguments give the
          coordinates that define the item (as separate numbers, as a
          single sequence of numbers, or as coordinate pairs), and the
          keyword arguments set item-specific options.  Coordinates and
          screen distances may be given as numbers (interpreted as
          pixels) or as strings with a unit suffix (‘'m'’, ‘'c'’, ‘'i'’
          or ‘'p'’ for millimetres, centimetres, inches or printer's
          points), but are always stored and returned in pixels.

          The item types are: ‘arc’ (an arc-shaped region that is a
          section of an oval, defined by two diagonally opposite corners
          ‘x1, y1, x2, y2’ of the enclosing rectangle); ‘bitmap’ (a
          two-color bitmap positioned at a point ‘x, y’); ‘image’ (a Tk
          image positioned at a point ‘x, y’); ‘line’ (a line or curve
          through the points ‘x1, y1, ..., xn, yn’); ‘oval’ (a circle or
          ellipse inscribed in the rectangle ‘x1, y1, x2, y2’);
          ‘polygon’ (a closed polygon through the points ‘x1, y1, ...,
          xn, yn’); ‘rectangle’ (a rectangle with corners ‘x1, y1, x2,
          y2’); ‘text’ (a string of text positioned at a point ‘x, y’);
          and ‘window’ (a child widget embedded in the canvas at a point
          ‘x, y’, specified with the 'window' option).

          Most item types accept a common set of 'standard item
          options', plus a few options specific to each type.  Option
          names are passed as keyword arguments, without the leading
          hyphen.

          The standard item options are:

          'fill'

               The color used to fill the item's interior, or to draw a
               'line' item or the characters of a 'text' item.  An empty
               string (the default for all types except 'line' and
               'text') leaves the item unfilled.

          'outline'

               The color used to draw the item's outline.  An empty
               string draws no outline.

          'width'

               The width of the outline, defaulting to ‘1.0’.  Has no
               effect if 'outline' is empty.

          'dash'

               A dash pattern for the outline, given either as a
               sequence of segment lengths in pixels or as a string of
               the characters ‘'.'’, ‘','’, ‘'-'’, ‘'_'’ and space.  An
               empty pattern (the default) draws a solid outline.

          'dashoffset'

               The starting offset in pixels into the 'dash' pattern.
               Ignored if there is no 'dash' pattern.

          'stipple'

               A bitmap used as a stipple pattern when filling the item.
               Only well supported on X11.

          'outlinestipple'

               A bitmap used as a stipple pattern when drawing the
               outline.  Has no effect if 'outline' is empty.

          'offset', 'outlineoffset'

               The offset of the fill and outline stipple patterns,
               given as ‘'x,y'’ or as a side such as ‘'n'’, ‘'se'’ or
               ‘'center'’.  Stipple offsets are only supported on X11.

          'state'

               Overrides the canvas state for this item; one of
               ‘'normal'’, ‘'disabled'’ or ‘'hidden'’.

          'tags'

               A single tag or a sequence of tags to associate with the
               item, replacing any existing tags.

          Many of these options have 'active...'  and 'disabled...'
          variants (such as 'activefill', 'disabledfill', 'activewidth',
          'disableddash', 'activeoutline', 'disabledstipple') that
          override the base option when the item is the active item
          (under the mouse pointer) or is in the disabled state.

          The following item types support additional options.

          For ‘arc’ items:

          'start'

               The start of the arc's angular range, in degrees measured
               counter-clockwise from the 3-o'clock position.

          'extent'

               The size of the angular range, in degrees
               counter-clockwise from 'start'.

          'style'

               How the arc is drawn: ‘'pieslice'’ (the default),
               ‘'chord'’ or ‘'arc'’.

          For ‘line’ items:

          'arrow'

               Where to draw arrowheads: ‘'none'’ (the default),
               ‘'first'’, ‘'last'’ or ‘'both'’.

          'arrowshape'

               A sequence of three distances describing the shape of the
               arrowheads.

          'capstyle'

               How line ends are drawn: ‘'butt'’ (the default),
               ‘'projecting'’ or ‘'round'’.

          'joinstyle'

               How line vertices are drawn: ‘'round'’ (the default),
               ‘'bevel'’ or ‘'miter'’.

          'smooth'

               The smoothing method: a false value (the default) for no
               smoothing, or ‘'true'’/‘'bezier'’ or ‘'raw'’ to draw the
               line as a curve.

          'splinesteps'

               The number of line segments approximating each spline
               when 'smooth' is enabled.

          For ‘polygon’ items:

          'joinstyle', 'smooth', 'splinesteps'

               As for ‘line’ items, applied to the polygon's outline.

          For ‘text’ items:

          'text'

               The string to display; newline characters start new
               lines.

          'font'

               The font used for the text.

          'justify'

               How lines are justified: ‘'left'’ (the default),
               ‘'right'’ or ‘'center'’.

          'anchor'

               How the text is positioned relative to its point,
               defaulting to ‘'center'’.

          'width'

               The maximum line length; if non-zero, lines are wrapped
               at spaces.

          'angle'

               How many degrees to rotate the text counter-clockwise
               about its positioning point, from ‘0.0’ to ‘360.0’
               (default ‘0.0’).

          'underline'

               The index of a character to underline, or ‘-1’ for none.

          For ‘bitmap’ items:

          'bitmap'

               The bitmap to display.

          'anchor'

               How the bitmap is positioned relative to its point.

          'background', 'foreground'

               The colors used for the bitmap's ‘0’ and ‘1’ pixels; an
               empty 'background' makes the ‘0’ pixels transparent.
               Both have 'active...'  and 'disabled...'  variants, and
               'bitmap' has 'activebitmap' and 'disabledbitmap'
               variants.

          For ‘image’ items:

          'image'

               The Tk image to display, previously created with the
               image protocols.

          'anchor'

               How the image is positioned relative to its point.

          Both options have 'active...'  and 'disabled...'  variants
          ('activeimage', 'disabledimage') used in the active and
          disabled states.

          For ‘window’ items:

          'window'

               The widget to embed; it must be a child of the canvas or
               of one of its ancestors, and may not be a top-level
               window.

          'anchor'

               How the window is positioned relative to its point.

          'width', 'height'

               The size to assign to the window; if zero (the default),
               the window is given its requested size.

          ‘oval’ and ‘rectangle’ items have no type-specific options;
          they use only the standard item options.

               注釈: Tk 8.6 added the 'angle' option and Tk 9.0 added
               the 'underline' option for ‘text’ items.

      -- メソッド: coords (tagOrId)

      -- メソッド: coords (tagOrId, coordList, /)

      -- メソッド: coords (tagOrId, /, *coordList)

          Query or modify the coordinates of an item.  With only
          'tagOrId', return a list of the floating-point coordinates of
          the item given by 'tagOrId' (the first matching item if it
          matches several).  Given new coordinates, replace the
          coordinates of that item with them; like the ‘create_*’
          methods, the coordinates may be given as separate numbers, as
          a single sequence, or as coordinate pairs.  The returned
          coordinates are always in pixels, regardless of the units used
          to specify them; for rectangles, ovals and arcs they are
          ordered left, top, right, bottom.

          バージョン 3.12 で変更: The arguments are now flattened: the
          coordinates may be given as separate arguments, as a single
          sequence, or grouped in pairs, like the ‘create_*’ methods.

      -- メソッド: move (tagOrId, xAmount, yAmount, /)

          Move each of the items given by 'tagOrId' in the canvas
          coordinate space by adding 'xAmount' to every x-coordinate and
          'yAmount' to every y-coordinate of the item.

      -- メソッド: moveto (tagOrId, x='', y='')

          Move the items given by 'tagOrId' so that the first coordinate
          pair (the upper-left corner of the bounding box) of the lowest
          matching item is at position ('x', 'y').  'x' or 'y' may be an
          empty string, in which case the corresponding coordinate is
          unchanged.  All matching items keep their positions relative
          to each other.

          Added in version 3.8.

      -- メソッド: scale (tagOrId, xOrigin, yOrigin, xScale, yScale, /)

          Rescale the coordinates of all items given by 'tagOrId' in
          canvas coordinate space.  Each x-coordinate is adjusted so
          that its distance from 'xOrigin' changes by a factor of
          'xScale', and each y-coordinate so that its distance from
          'yOrigin' changes by a factor of 'yScale' (a factor of ‘1.0’
          leaves the coordinate unchanged).

      -- メソッド: delete (*tagOrIds)

          Delete each of the items given by the 'tagOrIds' arguments.

      -- メソッド: dchars (tagOrId, first, /)

      -- メソッド: dchars (tagOrId, first, last, /)

          Delete from each of the items given by 'tagOrId' the
          characters (for text items) or coordinates (for line and
          polygon items) in the range from 'first' to 'last' inclusive;
          'last' defaults to 'first'.  Items that do not support
          indexing ignore this operation.

      -- メソッド: insert (tagOrId, beforeThis, string, /)

          Insert 'string' into each of the items given by 'tagOrId' just
          before the character or coordinate whose index is
          'beforeThis'.  For line and polygon items 'string' must be a
          valid sequence of coordinates.

      -- メソッド: itemcget (tagOrId, option)

          Return the current value of the configuration option 'option'
          for the item given by 'tagOrId' (the lowest matching item if
          it matches several).  This is like *note cget(): 43c4. but
          applies to an individual item.

      -- メソッド: itemconfigure (tagOrId, cnf=None, **kw)

          Query or modify the configuration options of the items given
          by 'tagOrId'.  This mirrors *note configure(): 439c, except
          that it applies to individual items rather than to the canvas
          as a whole.  With no options, it returns a dictionary
          describing the current options of the first matching item;
          otherwise it sets the given options on every matching item.
          The legal options are those accepted by the corresponding
          ‘create_*’ method.  *note itemconfig(): 44f9. is an alias of
          ‘itemconfigure()’.

      -- メソッド: type (tagOrId)

          Return the type of the item given by 'tagOrId' (the first
          matching item if it matches several), such as ‘'rectangle'’ or
          ‘'text'’, or ‘None’ if 'tagOrId' does not match any item.

      -- メソッド: gettags (tagOrId, /)

          Return a tuple of the tags associated with the item given by
          'tagOrId' (the first matching item in display-list order if it
          matches several).  Return an empty tuple if no item matches or
          the item has no tags.

      -- メソッド: dtag (tagOrId, /)

      -- メソッド: dtag (tagOrId, tagToDelete, /)

          Remove the tag 'tagToDelete' (which defaults to 'tagOrId')
          from each of the items given by 'tagOrId'.  Items that do not
          have that tag are unaffected.

      -- メソッド: addtag (newtag, searchSpec, /, *args)

          Add the tag 'newtag' to each item selected by the search
          specification 'searchSpec' (and any further 'args').
          'searchSpec' is one of ‘'above'’, ‘'all'’, ‘'below'’,
          ‘'closest'’, ‘'enclosed'’, ‘'overlapping'’ or ‘'withtag'’; the
          ‘addtag_*’ methods below are convenient wrappers that supply
          each of these forms.

      -- メソッド: addtag_above (newtag, tagOrId)

          Add the tag 'newtag' to the item just above (after) 'tagOrId'
          in the display list.

      -- メソッド: addtag_all (newtag)

          Add the tag 'newtag' to all items in the canvas.

      -- メソッド: addtag_below (newtag, tagOrId)

          Add the tag 'newtag' to the item just below (before) 'tagOrId'
          in the display list.

      -- メソッド: addtag_closest (newtag, x, y, halo=None, start=None)

          Add the tag 'newtag' to the item closest to the point ('x',
          'y').  If 'halo' is given, any item within that distance of
          the point is treated as overlapping it.  If 'start' is given
          (a tag or id), select the topmost closest item that lies below
          'start' in the display list, which can be used to step through
          all the closest items.

      -- メソッド: addtag_enclosed (newtag, x1, y1, x2, y2)

          Add the tag 'newtag' to every item completely enclosed within
          the rectangle ('x1', 'y1', 'x2', 'y2'), where 'x1' <= 'x2' and
          'y1' <= 'y2'.

      -- メソッド: addtag_overlapping (newtag, x1, y1, x2, y2)

          Add the tag 'newtag' to every item that overlaps or is
          enclosed within the rectangle ('x1', 'y1', 'x2', 'y2'), where
          'x1' <= 'x2' and 'y1' <= 'y2'.

      -- メソッド: addtag_withtag (newtag, tagOrId)

          Add the tag 'newtag' to every item given by 'tagOrId'.

      -- メソッド: find (searchSpec, /, *args)

          Return a tuple of the ids of all items selected by the search
          specification 'searchSpec' (and any further 'args'), in
          stacking order with the lowest item first.  The search
          specification has any of the forms accepted by *note addtag():
          44fe.  The ‘find_*’ methods below are more convenient wrappers
          around it.

      -- メソッド: find_above (tagOrId)

          Return a tuple containing the id of the item just above
          'tagOrId' in the display list.

      -- メソッド: find_all ()

          Return a tuple of the ids of all items in the canvas, in
          stacking order.

      -- メソッド: find_below (tagOrId)

          Return a tuple containing the id of the item just below
          'tagOrId' in the display list.

      -- メソッド: find_closest (x, y, halo=None, start=None)

          Return a tuple containing the id of the item closest to the
          point ('x', 'y').  'halo' and 'start' are interpreted as for
          *note addtag_closest(): 4502.

      -- メソッド: find_enclosed (x1, y1, x2, y2)

          Return a tuple of the ids of all items completely enclosed
          within the rectangle ('x1', 'y1', 'x2', 'y2').

      -- メソッド: find_overlapping (x1, y1, x2, y2)

          Return a tuple of the ids of all items that overlap or are
          enclosed within the rectangle ('x1', 'y1', 'x2', 'y2').

      -- メソッド: find_withtag (tagOrId)

          Return a tuple of the ids of all items given by 'tagOrId'.

      -- メソッド: tag_raise (tagOrId, aboveThis=None, /)

          Move all items given by 'tagOrId' to a new position in the
          display list just above the item given by 'aboveThis', or to
          the top of the display list if 'aboveThis' is omitted.  When
          several items are moved their relative order is preserved.
          This has no effect on embedded window items, whose stacking
          order is controlled by *note Misc.tkraise(): 43cf. and *note
          Misc.lower(): 43d0. instead.  *note lift(): 450e. and *note
          tkraise(): 450f. are aliases of ‘tag_raise()’.

      -- メソッド: tag_lower (tagOrId, belowThis=None, /)

          Move all items given by 'tagOrId' to a new position in the
          display list just below the item given by 'belowThis', or to
          the bottom of the display list if 'belowThis' is omitted.
          When several items are moved their relative order is
          preserved.  This has no effect on embedded window items.
          *note lower(): 4510. is an alias of ‘tag_lower()’.

               注釈: On a ‘Canvas’, *note tkraise(): 450f./*note lift():
               450e. and *note lower(): 4510. restack canvas items,
               shadowing the inherited *note Misc.tkraise(): 43cf./*note
               Misc.lift(): 43ce. and *note Misc.lower(): 43d0. methods
               that restack the widget itself, which are therefore not
               available.

      -- メソッド: tag_bind (tagOrId, sequence=None, func=None,
               add=None)

          Bind the callback 'func' to the event 'sequence' for all items
          given by 'tagOrId', so that 'func' is invoked whenever that
          event occurs for one of the items.  This is like *note
          Widget.bind: 43e8. but operates on canvas items rather than on
          whole widgets; only mouse, keyboard and virtual events may be
          bound.  Mouse events are directed to the current item and
          keyboard events to the focus item (see *note focus(): 4512.).
          If 'add' is true the new binding is added to any existing
          bindings for the same sequence, rather than replacing them.
          Return the identifier of the bound function, which can be
          passed to *note tag_unbind(): 4513.

      -- メソッド: tag_unbind (tagOrId, sequence, funcid=None)

          Remove for all items given by 'tagOrId' the binding for the
          event 'sequence'.  If 'funcid' is given, only that callback
          (as returned by *note tag_bind(): 4511.) is unbound and
          deregistered.

          バージョン 3.13 で変更: If 'funcid' is given, only that
          callback is unbound.

      -- メソッド: bbox (tagOrId, /, *tagOrIds)

          Return a 4-tuple ‘(x1, y1, x2, y2)’ giving an approximate
          bounding box, in pixels, that encloses all the items given by
          'tagOrId' and any further 'tagOrIds'.  The result may
          overestimate the true bounding box by a few pixels.  Return
          ‘None’ if no item matches or the matching items have nothing
          to display.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: canvasx (screenx, gridspacing=None)

          Given a window x-coordinate 'screenx', return the canvas
          x-coordinate displayed at that location.  If 'gridspacing' is
          given, the result is rounded to the nearest multiple of
          'gridspacing' units.

      -- メソッド: canvasy (screeny, gridspacing=None)

          Given a window y-coordinate 'screeny', return the canvas
          y-coordinate displayed at that location.  If 'gridspacing' is
          given, the result is rounded to the nearest multiple of
          'gridspacing' units.

      -- メソッド: focus ()

      -- メソッド: focus (tagOrId, /)

          With 'tagOrId', set the keyboard focus for the canvas to the
          first item given by 'tagOrId' that supports the insertion
          cursor; the focus is left unchanged if no such item exists.
          If 'tagOrId' is an empty string, reset the focus so that no
          item has it.  With no argument, return the id of the item that
          currently has the focus, or an empty string if none does.  An
          item only displays the insertion cursor when both it is the
          focus item and its canvas has the input focus.

          This shadows the inherited ‘Misc.focus()’; use *note
          focus_set(): 43ff. to focus the widget itself.

      -- メソッド: icursor (tagOrId, index, /)

          Set the insertion cursor of the items given by 'tagOrId' to
          just before the character given by 'index'.  Items that do not
          support an insertion cursor are unaffected.  The cursor is
          only displayed when the item has the focus, but its position
          may be set at any time.

      -- メソッド: index (tagOrId, index, /)

          Return as an integer the numerical index within 'tagOrId'
          corresponding to 'index', which is a textual description of a
          position (for text items an index into the characters, for
          line and polygon items an index into the coordinates).  If
          'tagOrId' matches several items, the first one that supports
          indexing is used.

      -- メソッド: select_adjust (tagOrId, index)

          Adjust the end of the selection in 'tagOrId' nearest to
          'index' so that it is at 'index', and make the other end the
          anchor point for future *note select_to(): 451a. calls.  If
          the selection is not currently in 'tagOrId', this behaves like
          ‘select_to()’.

      -- メソッド: select_clear ()

          Clear the selection if it is in this canvas; otherwise do
          nothing.

      -- メソッド: select_from (tagOrId, index)

          Set the selection anchor point to just before the character
          given by 'index' in the item given by 'tagOrId'.  This does
          not change the selection itself; it sets the fixed end for
          future *note select_to(): 451a. calls.

      -- メソッド: select_item ()

          Return the id of the item that holds the selection, or ‘None’
          if the selection is not in this canvas.  Unlike *note find():
          4506. and the ‘find_*’ methods, this returns the id as a
          string rather than an integer.

      -- メソッド: select_to (tagOrId, index)

          Set the selection to the characters of 'tagOrId' between the
          selection anchor point and 'index', inclusive of 'index'.  The
          anchor point is the one set by the most recent *note
          select_adjust(): 4519. or *note select_from(): 451c. call.

      -- メソッド: scan_mark (x, y)

          Record 'x', 'y' and the current view, for use with later *note
          scan_dragto(): 451f. calls.  This is typically bound to a
          mouse button press in the widget.

      -- メソッド: scan_dragto (x, y, gain=10)

          Scroll the canvas by 'gain' times the difference between 'x',
          'y' and the coordinates passed to the last *note scan_mark():
          451e. call.  This is typically bound to mouse motion events in
          the widget, producing the effect of dragging the canvas at
          high speed through its window.

      -- メソッド: postscript (cnf={}, **kw)

          Generate a PostScript (Encapsulated PostScript, version 3.0)
          representation of part or all of the canvas.  If the 'file' or
          'channel' option is given, the PostScript is written there and
          an empty string is returned; otherwise it is returned as a
          string.  By default only the area currently visible in the
          window is generated, so it is usually necessary either to call
          *note update(): 43f9. first or to use the 'width' and 'height'
          options.  Supported options include 'colormap', 'colormode',
          'file', 'fontmap', 'height', 'pageanchor', 'pageheight',
          'pagewidth', 'pagex', 'pagey', 'rotate', 'width', 'x' and 'y'.

 -- クラス: tkinter.Checkbutton (master=None, cnf={}, **kw)

     A ‘Checkbutton’ widget displays a textual string, bitmap or image
     together with a square indicator, and toggles a boolean selection
     when pressed.  It has all the behavior of a simple button and, in
     addition, can be selected: when selected the indicator is drawn
     with a check mark and the associated variable is set to the
     ‘onvalue’, and when deselected the indicator is drawn empty and the
     variable is set to the ‘offvalue’.  Inherits from *note Widget:
     43a3.  In addition to the standard widget options, a checkbutton
     accepts the options documented in the Tk ‘checkbutton’ manual page,
     such as 'variable', 'onvalue', 'offvalue' and 'command'.

      -- メソッド: invoke ()

          Do just what would happen if the user pressed the checkbutton
          with the mouse: toggle the selection state of the button and
          invoke the associated command, if there is one.  Return the
          result of the command, or an empty string if no command is
          associated with the checkbutton.  This is ignored if the
          checkbutton's state is ‘disabled’.

      -- メソッド: select ()

          Select the checkbutton and set the associated variable to its
          ‘onvalue’.

      -- メソッド: deselect ()

          Deselect the checkbutton and set the associated variable to
          its ‘offvalue’.

      -- メソッド: toggle ()

          Toggle the selection state of the button, redisplaying it and
          modifying its associated variable to reflect the new state.

      -- メソッド: flash ()

          Flash the checkbutton by redisplaying it several times,
          alternating between the active and normal colors.  At the end
          of the flash the checkbutton is left in the same normal or
          active state as when the method was called.  This is ignored
          if the checkbutton's state is ‘disabled’.

 -- クラス: tkinter.Entry (master=None, cnf={}, **kw)

     An ‘Entry’ widget displays a single line of text and lets the user
     edit it.  Inherits from *note Widget: 43a3. and *note XView: 44cf.;
     since entries can hold strings too long to fit in the window, they
     support horizontal scrolling through *note xview(): 44d0.

     In addition to the standard widget options, an entry accepts the
     options documented in the Tk ‘entry’ manual page.  Notable ones are
     'textvariable' (the name of a variable kept in sync with the
     entry's contents), 'show' (if set, each character is displayed as
     the given character rather than its true value, useful for password
     entry), 'validate' and 'validatecommand' (which together let a
     callback accept or reject edits), and 'state' (one of ‘'normal'’,
     ‘'disabled'’ or ‘'readonly'’).

     Many of the methods below take an 'index' argument that selects a
     character in the entry's string.  As described in the Tk ‘entry’
     manual page, 'index' may be a number (counting from 0), ‘'insert'’
     (the character just after the insertion cursor), ‘'end'’ (just
     after the last character), ‘'anchor'’ (the selection anchor point),
     ‘'sel.first'’ and ‘'sel.last'’ (the ends of the selection), or ‘@x’
     (the character covering pixel x-coordinate 'x' in the window).
     Out-of-range indices are rounded to the nearest legal value.

      -- メソッド: delete (first, last=None)

          Delete the characters from index 'first' up to but not
          including index 'last'.  If 'last' is omitted, only the single
          character at 'first' is deleted.

      -- メソッド: get ()

          Return the entry's current string.

      -- メソッド: insert (index, string)

          Insert 'string' just before the character given by 'index'.

      -- メソッド: icursor (index)

          Arrange for the insertion cursor to be displayed just before
          the character given by 'index'.

      -- メソッド: index (index)

          Return the numerical index corresponding to 'index'.

      -- メソッド: selection_adjust (index)

          Locate the end of the selection nearest to the character given
          by 'index', and adjust that end to be at 'index' (including
          but not going beyond it); the other end becomes the anchor
          point for future *note selection_to(): 452d. calls.  If there
          is no selection in the entry, a new one is created between
          'index' and the most recent anchor point, inclusive.  *note
          select_adjust(): 452b. is an alias of ‘selection_adjust()’.

      -- メソッド: selection_clear ()

          Clear the selection if it is currently in this widget.  If the
          selection is not in this widget the method has no effect.
          *note select_clear(): 452e. is an alias of
          ‘selection_clear()’.

               注釈: This shadows the inherited *note
               Misc.selection_clear(): 440d, which clears the X
               selection; that method is not available on an ‘Entry’.

      -- メソッド: selection_from (index)

          Set the selection anchor point to just before the character
          given by 'index', without changing the selection.  *note
          select_from(): 4530. is an alias of ‘selection_from()’.

      -- メソッド: selection_present ()

          Return ‘True’ if there are characters selected in the entry,
          ‘False’ otherwise.  *note select_present(): 4532. is an alias
          of ‘selection_present()’.

      -- メソッド: selection_range (start, end)

          Set the selection to include the characters starting with the
          one indexed by 'start' and ending with the one just before
          'end'.  If 'end' refers to the same character as 'start' or an
          earlier one, the selection is cleared.  *note select_range():
          4534. is an alias of ‘selection_range()’.

      -- メソッド: selection_to (index)

          Set the selection between the anchor point and 'index': if
          'index' is before the anchor point, the selection runs from
          'index' up to but not including the anchor; if 'index' is
          after it, from the anchor up to but not including 'index'; if
          they coincide, nothing happens.  The anchor point is the one
          set by the most recent *note selection_from(): 4531. or *note
          selection_adjust(): 452c. call.  If there is no selection in
          the entry, a new one is created using the most recent anchor
          point.  *note select_to(): 4536. is an alias of
          ‘selection_to()’.

      -- メソッド: scan_mark (x)

          Record 'x' and the current view in the entry window, for use
          with later *note scan_dragto(): 4538. calls.  Typically
          associated with a mouse button press in the widget.

      -- メソッド: scan_dragto (x)

          Compute the difference between 'x' and the 'x' given to the
          last *note scan_mark(): 4537. call, and adjust the view left
          or right by 10 times that difference.  Typically associated
          with mouse motion events, to produce the effect of dragging
          the entry at high speed through the window.

 -- クラス: tkinter.Frame (master=None, cnf={}, **kw)

     A ‘Frame’ widget is a simple container.  Its primary purpose is to
     act as a spacer or container for complex window layouts; its only
     features are its background and an optional 3-D border to make the
     frame appear raised or sunken.  Inherits from *note Widget: 43a3.
     Refer to the Tk ‘frame’ manual page for the full list of options.

 -- クラス: tkinter.Label (master=None, cnf={}, **kw)

     A ‘Label’ widget displays a non-interactive textual string, bitmap
     or image.  The displayed text is set with the 'text' option or
     linked to a variable through 'textvariable', and an image can be
     shown using the 'image' option.  Text must all be in a single font
     but may occupy multiple lines, and one character may be underlined
     with the 'underline' option.  Inherits from *note Widget: 43a3.
     Refer to the Tk ‘label’ manual page for the full list of options.

 -- クラス: tkinter.LabelFrame (master=None, cnf={}, **kw)

     A ‘LabelFrame’ widget is a container that has the features of a
     *note Frame: 4426. plus the ability to display a label.  The label
     text is set with the 'text' option and positioned with
     'labelanchor', or an arbitrary widget may be used as the label by
     giving it as the 'labelwidget' option.  Inherits from *note Widget:
     43a3.  Refer to the Tk ‘labelframe’ manual page for the full list
     of options.

 -- クラス: tkinter.Listbox (master=None, cnf={}, **kw)

     A ‘Listbox’ widget displays a list of single-line text items, one
     per line, of which the user can select one or more.  The way the
     selection behaves is governed by the 'selectmode' option, which is
     one of ‘browse’ (the default; at most one item, which may be
     dragged with the mouse), ‘single’ (at most one item), ‘multiple’
     (any number of items, toggled individually), or ‘extended’ (any
     number of items, including discontiguous ranges, selected by
     clicking and dragging).  Inherits from *note Widget: 43a3, *note
     XView: 44cf. and *note YView: 44d4, so the view can be scrolled
     horizontally and vertically with *note xview(): 44d0. and *note
     yview(): 44d5.  Refer to the Tk ‘listbox’ manual page for the full
     list of options.

     Many of the methods take an 'index' argument identifying a
     particular item.  As described in the Tk ‘listbox’ manual page,
     'index' may be a numeric index (counting from 0 at the top),
     ‘'active'’ (the item with the location cursor, set with *note
     activate(): 4539.), ‘'anchor'’ (the selection anchor, set with
     *note selection_anchor(): 453a.), ‘'end'’ (the last item, or for
     *note index(): 453b. and *note insert(): 453c. the position just
     after it), or ‘@x,y’ (the item covering pixel coordinates 'x', 'y'
     in the listbox window).  Arguments named 'first' and 'last' are
     indices of the same forms.

      -- メソッド: insert (index, *elements)

          Insert the given 'elements' as new items just before the item
          given by 'index'.  If 'index' is ‘'end'’, the new items are
          appended to the end of the list.

      -- メソッド: delete (first, last=None)

          Delete the items in the range from 'first' to 'last'
          inclusive.  If 'last' is omitted, it defaults to 'first', so
          that a single item is deleted.

      -- メソッド: get (first, last=None)

          If 'last' is omitted, return the contents of the item given by
          'first', or an empty string if 'first' refers to a
          non-existent item.  If 'last' is given, return a tuple of all
          the items in the range from 'first' to 'last' inclusive.

      -- メソッド: size ()

          Return the total number of items in the listbox.

          This shadows the inherited ‘Misc.size()’; use *note
          grid_size(): 43e1. for the grid size.

      -- メソッド: index (index)

          Return the integer index value corresponding to 'index', or
          ‘None’ if 'index' is out of range.  If 'index' is ‘'end'’, the
          result is a count of the number of items in the listbox (not
          the index of the last item).

      -- メソッド: bbox (index)

          Return a tuple ‘(x, y, width, height)’ describing the bounding
          box, in pixels relative to the widget, of the text of the item
          given by 'index'.  Return ‘None’ if no part of that item is
          visible on the screen, or if 'index' refers to a non-existent
          item; if the item is only partly visible, the result still
          gives the full area of the item, including the parts that are
          not visible.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: nearest (y)

          Given a y-coordinate within the listbox window, return the
          index of the visible item nearest to that y-coordinate.

      -- メソッド: see (index)

          Adjust the view so that the item given by 'index' is visible.
          If the item is already visible the method has no effect; if it
          is near an edge of the window the listbox scrolls just enough
          to bring it into view at that edge, otherwise the listbox
          scrolls to center the item.

      -- メソッド: activate (index)

          Set the active item to the one given by 'index'.  If 'index'
          is outside the range of items, the closest item is activated
          instead.  The active item is drawn as specified by the
          'activestyle' option when the widget has the input focus, and
          its index may be retrieved with the ‘'active'’ index.

      -- メソッド: curselection ()

          Return a tuple containing the numerical indices of all of the
          items that are currently selected, or an empty tuple if no
          items are selected.

      -- メソッド: selection_anchor (index)

          Set the selection anchor to the item given by 'index'.  If
          'index' refers to a non-existent item, the closest item is
          used.  The selection anchor is the end of the selection that
          is fixed while dragging out a selection with the mouse, and
          may afterwards be referred to with the ‘'anchor'’ index.
          *note select_anchor(): 4544. is an alias of
          ‘selection_anchor()’.

      -- メソッド: selection_clear (first, last=None)

          Deselect any of the items in the range from 'first' to 'last'
          inclusive that are selected.  The selection state of items
          outside this range is not changed.  *note select_clear():
          4545. is an alias of ‘selection_clear()’.

               注釈: This shadows the inherited *note
               Misc.selection_clear(): 440d, which clears the X
               selection; that method is not available on a ‘Listbox’.

      -- メソッド: selection_includes (index)

          Return ‘True’ if the item given by 'index' is currently
          selected, ‘False’ otherwise.  *note select_includes(): 4547.
          is an alias of ‘selection_includes()’.

      -- メソッド: selection_set (first, last=None)

          Select all of the items in the range from 'first' to 'last'
          inclusive, without affecting the selection state of items
          outside that range.  *note select_set(): 4549. is an alias of
          ‘selection_set()’.

      -- メソッド: itemcget (index, option)

          Return the current value of the configuration option 'option'
          for the item given by 'index'.

      -- メソッド: itemconfigure (index, cnf=None, **kw)

          Query or modify the configuration options of the item given by
          'index'.  This mirrors *note configure(): 439c, except that it
          applies to an individual item rather than to the listbox as a
          whole.  With no options, it returns a dictionary describing
          the current options of the item; otherwise it sets the given
          options.  The supported item options are 'background',
          'foreground', 'selectbackground' and 'selectforeground'.
          *note itemconfig(): 454c. is an alias of ‘itemconfigure()’.

      -- メソッド: scan_mark (x, y)

          Record 'x', 'y' and the current view, for use with later *note
          scan_dragto(): 454f. calls.  This is typically bound to a
          mouse button press in the widget.

      -- メソッド: scan_dragto (x, y)

          Scroll the listbox by 10 times the difference between 'x', 'y'
          and the coordinates passed to the last *note scan_mark():
          454e. call.  This is typically bound to mouse motion events in
          the widget, producing the effect of dragging the list at high
          speed through the window.

 -- クラス: tkinter.Menu (master=None, cnf={}, **kw)

     A ‘Menu’ widget displays a column of entries, each of which may be
     a command, a checkbutton, a radiobutton, a cascade (which posts an
     associated submenu) or a separator.  Menus are used as the menubar
     of a toplevel window, as pulldown menus posted from a cascade entry
     or menubutton, and as popup menus.  Inherits from *note Widget:
     43a3.

     Many of the entry methods take an 'index' argument that selects
     which entry to operate on.  As described in the Tk ‘menu’ manual
     page, 'index' may be a numeric index (counting from 0 at the top),
     ‘'active'’ (the currently active entry), ‘'end'’ or ‘'last'’ (the
     bottommost entry), ‘'none'’ (no entry at all, written ‘{}’ in Tcl),
     ‘@y’ (the entry covering pixel y-coordinate 'y' in the menu
     window), or a pattern matched against the labels of the entries
     from the top down.

      -- メソッド: add (itemType, cnf={}, **kw)

          Add a new entry to the bottom of the menu.  'itemType' is one
          of ‘'command'’, ‘'cascade'’, ‘'checkbutton'’, ‘'radiobutton'’
          or ‘'separator'’ and determines the type of the new entry; the
          remaining options configure it.  The ‘add_command()’,
          ‘add_cascade()’, ‘add_checkbutton()’, ‘add_radiobutton()’ and
          ‘add_separator()’ convenience methods call this method with
          the corresponding 'itemType'.

          The entry is configured by the following options, although not
          every option applies to every entry type (a separator accepts
          none of them):

          'label'

               The text to display in the entry.

          'command'

               The function to call when the entry is invoked (command,
               checkbutton and radiobutton entries).

          'accelerator'

               A string displayed at the right of the entry to advertise
               an accelerator keystroke; it does not itself create the
               binding.

          'underline'

               The index of a character in the label to underline for
               keyboard traversal.

          'state'

               One of ‘'normal'’, ‘'active'’ or ‘'disabled'’.

          'image'

               An image to display instead of, or together with, the
               text label.

          'compound'

               Where to show the image relative to the text: ‘'none'’
               (the default), ‘'text'’, ‘'image'’, ‘'top'’, ‘'bottom'’,
               ‘'left'’ or ‘'right'’.

          'bitmap'

               A bitmap to display instead of the text label.

          'font'

               The font to use for the text.

          'background', 'foreground'

               The entry's background and foreground colors in its
               normal state (ignored on macOS).

          'activebackground', 'activeforeground'

               The background and foreground colors used when the entry
               is active (ignored on macOS).

          'columnbreak'

               If true, the entry starts a new column instead of being
               placed below the previous entry.

          'hidemargin'

               If true, the standard margin around the entry is omitted,
               which is useful when a menu is used as a palette.

          'menu'

               The submenu posted by a cascade entry; it must be a child
               of this menu.

          'variable'

               The variable associated with a checkbutton or radiobutton
               entry.

          'onvalue', 'offvalue'

               The values stored in 'variable' when a checkbutton entry
               is selected or cleared.

          'value'

               The value stored in 'variable' when a radiobutton entry
               is selected.

          'indicatoron'

               Whether to display the indicator of a checkbutton or
               radiobutton entry.

          'selectcolor'

               The color of the indicator of a checkbutton or
               radiobutton entry when it is selected.

          'selectimage'

               The image displayed when a checkbutton or radiobutton
               entry is selected and 'image' is also given.

      -- メソッド: add_cascade (cnf={}, **kw)

          Add a new cascade entry to the bottom of the menu.  A cascade
          entry has an associated submenu, given by its 'menu' option,
          which must be a child of this menu; posting the entry posts
          the submenu next to it.

      -- メソッド: add_checkbutton (cnf={}, **kw)

          Add a new checkbutton entry to the bottom of the menu.  When
          invoked, a checkbutton entry toggles between its 'onvalue' and
          'offvalue', storing the result in its associated 'variable',
          and displays an indicator showing whether it is selected.

      -- メソッド: add_command (cnf={}, **kw)

          Add a new command entry to the bottom of the menu.  A command
          entry behaves much like a button: when it is invoked, the
          callback given by its 'command' option is called.

      -- メソッド: add_radiobutton (cnf={}, **kw)

          Add a new radiobutton entry to the bottom of the menu.
          Radiobutton entries sharing the same 'variable' form a group
          of which only one may be selected at a time; selecting an
          entry stores its 'value' in the variable.

      -- メソッド: add_separator (cnf={}, **kw)

          Add a separator to the bottom of the menu.  A separator is
          displayed as a horizontal dividing line and cannot be
          activated or invoked.

      -- メソッド: insert (index, itemType, cnf={}, **kw)

          Same as *note add(): 4550, except that the new entry is
          inserted just before the entry given by 'index' instead of
          being appended to the end of the menu.  'itemType' is one of
          ‘'command'’, ‘'cascade'’, ‘'checkbutton'’, ‘'radiobutton'’ or
          ‘'separator'’.  The ‘insert_command()’, ‘insert_cascade()’,
          ‘insert_checkbutton()’, ‘insert_radiobutton()’ and
          ‘insert_separator()’ convenience methods call this method with
          the corresponding 'itemType'.

      -- メソッド: insert_cascade (index, cnf={}, **kw)

          Insert a new cascade entry before the entry given by 'index'
          (see *note add_cascade(): 4551.).

      -- メソッド: insert_checkbutton (index, cnf={}, **kw)

          Insert a new checkbutton entry before the entry given by
          'index' (see *note add_checkbutton(): 4552.).

      -- メソッド: insert_command (index, cnf={}, **kw)

          Insert a new command entry before the entry given by 'index'
          (see *note add_command(): 4553.).

      -- メソッド: insert_radiobutton (index, cnf={}, **kw)

          Insert a new radiobutton entry before the entry given by
          'index' (see *note add_radiobutton(): 4554.).

      -- メソッド: insert_separator (index, cnf={}, **kw)

          Insert a separator before the entry given by 'index' (see
          *note add_separator(): 4555.).

      -- メソッド: delete (index1, index2=None)

          Delete all of the menu entries between 'index1' and 'index2'
          inclusive.  If 'index2' is omitted, it defaults to 'index1',
          so that a single entry is deleted.  Attempts to delete a
          tear-off entry are ignored; remove it by changing the
          'tearoff' option instead.

      -- メソッド: entrycget (index, option)

          Return the current value of the configuration option 'option'
          for the entry given by 'index'.

      -- メソッド: entryconfigure (index, cnf=None, **kw)

          Query or modify the configuration options of the entry given
          by 'index'.  This mirrors *note configure(): 439c, except that
          it applies to an individual entry rather than to the menu as a
          whole.  With no options, it returns a dictionary describing
          the current options of the entry; otherwise it sets the given
          options.  The supported options are those accepted by *note
          add(): 4550. for the entry's type.  *note entryconfig(): 455e.
          is an alias of ‘entryconfigure()’.

      -- メソッド: index (index)

          Return the numerical index corresponding to 'index', or ‘None’
          if 'index' selects no entry.

      -- メソッド: type (index)

          Return the type of the entry given by 'index': one of
          ‘'command'’, ‘'cascade'’, ‘'checkbutton'’, ‘'radiobutton'’,
          ‘'separator'’ or ‘'tearoff'’ (for the tear-off entry).

      -- メソッド: activate (index)

          Make the entry given by 'index' the active entry, redisplaying
          it with its active colors, and deactivate any previously
          active entry.  If 'index' selects no entry, or the selected
          entry is disabled, the menu ends up with no active entry.

      -- メソッド: invoke (index)

          Invoke the action of the entry given by 'index', as if it had
          been clicked.  Nothing happens if the entry is disabled.  If
          the entry has a 'command' associated with it, the result of
          that command is returned; otherwise the result is an empty
          string.

      -- メソッド: post (x, y)

          Display the menu on the screen at the root-window coordinates
          'x' and 'y', adjusting them if necessary so that the whole
          menu is visible.  If the 'postcommand' option has been
          specified, it is evaluated before the menu is posted.

      -- メソッド: tk_popup (x, y, entry='')

          Post the menu as a popup at the root-window coordinates 'x'
          and 'y'.  If 'entry' is given, the menu is positioned so that
          this entry is displayed under the pointer.

      -- メソッド: unpost ()

          Unmap the menu so that it is no longer displayed, also
          unposting any posted lower-level cascaded submenu.  This has
          no effect on Windows and macOS, which manage the unposting of
          menus themselves.

      -- メソッド: xposition (index)

          Return the x-coordinate, within the menu window, of the
          leftmost pixel of the entry given by 'index'.

          Added in version 3.3.

      -- メソッド: yposition (index)

          Return the y-coordinate, within the menu window, of the
          topmost pixel of the entry given by 'index'.

 -- クラス: tkinter.Menubutton (master=None, cnf={}, **kw)

     A ‘Menubutton’ widget displays a textual string, bitmap or image
     and posts an associated *note Menu: 44e3, given by its 'menu'
     option, when the user presses it.  Like a *note Label: 44da. it can
     show 'text', a 'textvariable', or an 'image', and the 'direction'
     option controls where the menu appears relative to the button.
     Inherits from *note Widget: 43a3.  Refer to the Tk ‘menubutton’
     manual page for the full list of options.

 -- クラス: tkinter.Message (master=None, cnf={}, **kw)

     A ‘Message’ widget displays a non-interactive textual string, given
     by the 'text' option or linked to a variable through
     'textvariable'.  Unlike a *note Label: 44da, it breaks the string
     into multiple lines in order to produce a given aspect ratio,
     choosing line breaks at word boundaries, and it can justify the
     text left, centered or right.  Inherits from *note Widget: 43a3.
     Refer to the Tk ‘message’ manual page for the full list of options.

 -- クラス: tkinter.OptionMenu (master, variable, value, *values,
          **kwargs)

     A helper subclass of *note Menubutton: 4568. that displays a pop-up
     menu of mutually exclusive choices.  'variable' is a *note
     Variable: 1d29. kept in sync with the selection, 'value' is the
     initial choice, and 'values' are the remaining menu entries.  The
     keyword argument 'command' may be given a callback that is invoked
     with the selected value, and the keyword argument 'name' sets the
     Tk widget name.

      -- メソッド: destroy ()

          Destroy the widget, also cleaning up the associated pop-up
          menu.

     バージョン 3.14 で変更: Added support for the 'name' keyword
     argument.

 -- クラス: tkinter.PanedWindow (master=None, cnf={}, **kw)

     A ‘PanedWindow’ is a geometry-manager widget that arranges any
     number of child 'panes' in a row (when 'orient' is ‘'horizontal'’)
     or a column (when 'orient' is ‘'vertical'’).  Each pane holds one
     widget, and each pair of adjacent panes is separated by a movable
     'sash' that the user can drag with the mouse to resize the widgets
     on either side of it.  Inherits from *note Widget: 43a3.

     The 'orient' option selects the layout direction, 'sashwidth' sets
     the width of each sash and 'sashrelief' its relief.  When
     'showhandle' is true a small handle is drawn on each sash that the
     user can grab to drag it.  Refer to the Tk ‘panedwindow’ manual
     page for the full list of options.

      -- メソッド: add (child, **kw)

          Add 'child' to the panedwindow as a new pane, placed after any
          existing panes.  The keyword arguments specify per-pane
          management options for 'child'; they may be any of the options
          accepted by *note paneconfigure(): 456d.

      -- メソッド: remove (child)

          Remove the pane containing 'child' from the panedwindow.  All
          geometry management options for 'child' are forgotten.  *note
          forget(): 456e. is an alias of ‘remove()’.  This shadows the
          inherited geometry-manager ‘forget()’; use *note
          pack_forget(): 44a5, *note grid_forget(): 44bd. or *note
          place_forget(): 44b4. to remove the widget itself from its
          manager.

      -- メソッド: panes ()

          Return a tuple of the widgets managed by the panedwindow, one
          per pane, in order.

      -- メソッド: panecget (child, option)

          Return the current value of the management option 'option' for
          the pane containing 'child'.  'option' may be any value
          allowed by *note paneconfigure(): 456d.

      -- メソッド: paneconfigure (tagOrId, cnf=None, **kw)

          Query or modify the management options of the pane containing
          the widget 'tagOrId'.  With no options, it returns a
          dictionary describing all of the available options for the
          pane; given a single option name as a string, it returns a
          description of that one option; otherwise it sets the given
          options.  The supported options include 'after' and 'before'
          (insert the pane after or before another managed window),
          'height' and 'width' (the outer dimensions of the window,
          including any border), 'minsize' (the minimum size in the
          paned dimension), 'padx' and 'pady' (extra space to leave on
          each side of the window), 'sticky' (position or stretch the
          window within an oversized pane, using a string of the
          characters ‘n’, ‘s’, ‘e’ and ‘w’), 'hide' (hide the pane while
          keeping it in the list of panes) and 'stretch' (how extra
          space is allocated to the pane: one of ‘'always'’, ‘'first'’,
          ‘'last'’, ‘'middle'’ or ‘'never'’).  *note paneconfig(): 4572.
          is an alias of ‘paneconfigure()’.

      -- メソッド: identify (x, y)

          Identify the panedwindow component underneath the point given
          by 'x' and 'y', in window coordinates.  If the point is over a
          sash or a sash handle, the result is a two-element tuple
          containing the index of the sash or handle and a word
          indicating whether it is over a sash or a handle, such as ‘(0,
          'sash')’ or ‘(2, 'handle')’.  If the point is over any other
          part of the panedwindow, the result is an empty string.

      -- メソッド: sash (*args)

          Query or change the position of the sashes in the panedwindow.
          This is a thin wrapper around the Tk ‘sash’ subcommand; the
          convenience methods *note sash_coord(): 4575, *note
          sash_mark(): 4576. and *note sash_place(): 4577. should
          normally be used instead.

      -- メソッド: sash_coord (index)

          Return the current x and y coordinate pair for the sash given
          by 'index', which must be an integer between 0 and one less
          than the number of panes in the panedwindow.  The coordinates
          returned are those of the top left corner of the region
          containing the sash.

      -- メソッド: sash_mark (index)

          Record the current mouse position for the sash given by
          'index', for use together with later sash-drag operations to
          move the sash.

      -- メソッド: sash_place (index, x, y)

          Place the sash given by 'index' at the coordinates 'x' and
          'y'.

      -- メソッド: proxy (*args)

          Query or change the position of the sash proxy, the "ghost"
          sash shown while a sash is being dragged with non-opaque
          resizing.  This is a thin wrapper around the Tk ‘proxy’
          subcommand; the convenience methods *note proxy_coord(): 4579,
          *note proxy_forget(): 457a. and *note proxy_place(): 457b.
          should normally be used instead.

      -- メソッド: proxy_coord ()

          Return a tuple containing the x and y coordinates of the most
          recent proxy location.

      -- メソッド: proxy_forget ()

          Remove the proxy from the display.

      -- メソッド: proxy_place (x, y)

          Place the proxy at the coordinates 'x' and 'y'.

 -- クラス: tkinter.Radiobutton (master=None, cnf={}, **kw)

     A ‘Radiobutton’ widget displays a textual string, bitmap or image
     together with a diamond or circular indicator, and selects one
     choice out of several.  It has all the behavior of a simple button
     and, in addition, can be selected: typically several radiobuttons
     share a single 'variable', and selecting one sets that variable to
     the radiobutton's 'value'; each radiobutton also monitors the
     variable and automatically selects or deselects itself when the
     variable changes.  Inherits from *note Widget: 43a3.  In addition
     to the standard widget options, a radiobutton accepts the options
     documented in the Tk ‘radiobutton’ manual page, such as 'variable',
     'value' and 'command'.

      -- メソッド: invoke ()

          Do just what would happen if the user pressed the radiobutton
          with the mouse: select the button and invoke the associated
          command, if there is one.  Return the result of the command,
          or an empty string if no command is associated with the
          radiobutton.  This is ignored if the radiobutton's state is
          ‘disabled’.

      -- メソッド: select ()

          Select the radiobutton and set the associated variable to the
          value corresponding to this widget.

      -- メソッド: deselect ()

          Deselect the radiobutton and set the associated variable to an
          empty string.  If this radiobutton was not currently selected,
          this has no effect.

      -- メソッド: flash ()

          Flash the radiobutton by redisplaying it several times,
          alternating between the active and normal colors.  At the end
          of the flash the radiobutton is left in the same normal or
          active state as when the method was called.  This is ignored
          if the radiobutton's state is ‘disabled’.

 -- クラス: tkinter.Scale (master=None, cnf={}, **kw)

     A ‘Scale’ widget lets the user select a numerical value by moving a
     slider along a trough.  It can be oriented vertically or
     horizontally and can optionally display a label and the current
     value.  Inherits from *note Widget: 43a3.

     In addition to the standard widget options, a scale accepts the
     options documented in the Tk ‘scale’ manual page, such as 'from_',
     'to', 'resolution', 'orient', 'tickinterval', 'variable' and
     'command'.  As elsewhere in ‘tkinter’, the leading ‘-’ of the Tk
     option name is dropped; 'from' is spelled ‘from_’ because *note
     from: 14c7. is a Python keyword.

     With a non-integer 'resolution', see *note numeric values and the
     locale: 4582.

      -- メソッド: get ()

          Return the current value of the scale.  The result is an
          integer if the scale's 'resolution' yields whole numbers, and
          a float otherwise.

      -- メソッド: set (value)

          Set the scale to 'value', moving the slider accordingly.  This
          has no effect if the scale is disabled.

      -- メソッド: coords (value=None)

          Return a tuple ‘(x, y)’ giving the pixel coordinates, relative
          to the widget, of the point on the centerline of the trough
          that corresponds to 'value'.  If 'value' is omitted, the
          scale's current value is used.

      -- メソッド: identify (x, y)

          Return a string describing the part of the scale at the pixel
          coordinates 'x', 'y': ‘'slider'’, ‘'trough1'’ (the part of the
          trough above or to the left of the slider), ‘'trough2'’ (below
          or to the right of the slider), or an empty string if the
          point is not over any of these elements.

 -- クラス: tkinter.Scrollbar (master=None, cnf={}, **kw)

     A ‘Scrollbar’ widget displays a slider and two arrows that let the
     user scroll an associated widget, such as a *note Listbox: 43d7,
     *note Text: 1a58, *note Canvas: 1a59. or *note Entry: 440e.  It is
     connected to the scrolled widget by setting that widget's
     'xscrollcommand' or 'yscrollcommand' option to the scrollbar's
     *note set(): 185. method, and the scrollbar's 'command' option to
     the scrolled widget's *note xview(): 44d0. or *note yview(): 44d5.
     method.  Inherits from *note Widget: 43a3.

      -- メソッド: get ()

          Return the current scrollbar settings as a tuple ‘(first,
          last)’ of two fractions between 0 and 1, describing the
          portion of the document that is currently visible, as last
          passed to *note set(): 185.

      -- メソッド: set (first, last)

          Set the scrollbar.  'first' and 'last' are fractions between 0
          and 1 giving the positions of the start and end of the visible
          portion of the associated document.  This method is normally
          registered as the scrolled widget's 'xscrollcommand' or
          'yscrollcommand' and called by that widget.

      -- メソッド: activate (index=None)

          Mark the element 'index' (one of ‘'arrow1'’, ‘'slider'’ or
          ‘'arrow2'’) as active, displaying it according to the
          'activebackground' and 'activerelief' options.  If 'index' is
          omitted, return the name of the currently active element, or
          ‘None’ if no element is active.

          バージョン 3.5 で変更: The 'index' argument is now optional.

      -- メソッド: delta (deltax, deltay)

          Return a float indicating the fractional change in the
          scrollbar setting that corresponds to moving the slider by
          'deltax' pixels horizontally (for horizontal scrollbars) or
          'deltay' pixels vertically (for vertical scrollbars).

      -- メソッド: fraction (x, y)

          Return a float between 0 and 1 indicating where the point at
          pixel coordinates 'x', 'y' lies in the trough: 0 corresponds
          to the top or left of the trough and 1 to the bottom or right.

      -- メソッド: identify (x, y)

          Return the name of the element under the pixel coordinates
          'x', 'y' (such as ‘'arrow1'’), or an empty string if the point
          does not lie in any element of the scrollbar.

 -- クラス: tkinter.Spinbox (master=None, cnf={}, **kw)

     A ‘Spinbox’ widget is an *note Entry: 440e.-like widget with a pair
     of up/down arrow buttons that let the user step through a range of
     values in addition to editing the value directly.  The set of
     values may be a numeric range given by the 'from_', 'to' and
     'increment' options, or an explicit list of strings given by the
     'values' option (which takes precedence over the range).  Each time
     an arrow is invoked the 'command' callback, if any, is called; the
     'wrap' option controls whether stepping past either end of the
     range wraps around to the other end; the 'format' option specifies
     how numeric values are formatted; and the 'validate' option enables
     validation of the entered text.  Inherits from *note Widget: 43a3.
     and *note XView: 44cf.

     With a non-integer 'increment', see *note numeric values and the
     locale: 4582.

     Many of the methods take an 'index' argument identifying a
     character in the spinbox's string.  As described in the Tk
     ‘spinbox’ manual page, 'index' may be a numeric index (counting
     from 0), ‘'anchor'’ (the selection anchor point), ‘'end'’ (just
     after the last character), ‘'insert'’ (the character just after the
     insertion cursor), ‘'sel.first'’ or ‘'sel.last'’ (the ends of the
     selection), or ‘@x’ (the character covering pixel x-coordinate 'x'
     in the window).

      -- メソッド: get ()

          Return the spinbox's string.

      -- メソッド: insert (index, s)

          Insert the characters of the string 's' just before the
          character given by 'index'.

      -- メソッド: delete (first, last=None)

          Delete one or more characters of the spinbox.  'first' is the
          index of the first character to delete, and 'last' is the
          index of the character just after the last one to delete.  If
          'last' is omitted, a single character at 'first' is deleted.

      -- メソッド: icursor (index)

          Arrange for the insertion cursor to be displayed just before
          the character given by 'index'.

      -- メソッド: index (index)

          Return the numerical index corresponding to 'index', as a
          string.

      -- メソッド: bbox (index)

          Return a tuple of four integers ‘(x, y, width, height)’
          describing the bounding box of the character given by 'index'.
          'x' and 'y' are the pixel coordinates of the upper-left corner
          of the character relative to the widget, and 'width' and
          'height' are its size in pixels.  The bounding box may refer
          to a region outside the visible area of the window.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: identify (x, y)

          Return the name of the window element at the pixel coordinates
          'x', 'y': one of ‘'buttondown'’, ‘'buttonup'’, ‘'entry'’ or
          ‘'none'’.

      -- メソッド: invoke (element)

          Invoke the spin button given by 'element', either ‘'buttonup'’
          or ‘'buttondown'’, triggering the action associated with it.

      -- メソッド: scan (*args)

          A thin wrapper around the Tk ‘scan’ widget subcommand, used to
          implement fast dragging of the view: ‘scan('mark', x)’ records
          'x' and the current view, and ‘scan('dragto', x)’ adjusts the
          view relative to that mark.  The *note scan_mark(): 4596. and
          *note scan_dragto(): 4597. methods wrap the two forms.

      -- メソッド: scan_mark (x)

          Record 'x' and the current view in the spinbox window, for use
          with a later *note scan_dragto(): 4597. call.  This is
          typically associated with a mouse button press in the widget.

      -- メソッド: scan_dragto (x)

          Adjust the view by 10 times the difference between 'x' and the
          'x' passed to the last *note scan_mark(): 4596. call.  This is
          typically associated with mouse motion events, producing the
          effect of dragging the spinbox at high speed through the
          window.

      -- メソッド: selection (*args)

          A thin wrapper around the Tk ‘selection’ widget subcommand,
          used to adjust the selection within the spinbox.  It has
          several forms depending on the first argument, such as
          ‘selection('adjust', index)’, ‘selection('clear')’,
          ‘selection('element', ?elem?)’, ‘selection('from', index)’,
          ‘selection('present')’, ‘selection('range', start, end)’ and
          ‘selection('to', index)’.  The *note selection_adjust(): 4599,
          *note selection_clear(): 459a, *note selection_element():
          459b, *note selection_from(): 459c, *note selection_present():
          459d, *note selection_range(): 459e. and *note selection_to():
          459f. methods wrap these forms.

      -- メソッド: selection_adjust (index)

          Locate the end of the selection nearest to the character given
          by 'index' and adjust that end of the selection to be at
          'index' (including but not going beyond 'index').  The other
          end becomes the anchor point for future *note selection_to():
          459f. calls.  If the selection is not currently in the
          spinbox, a new selection is created to include the characters
          between 'index' and the most recent anchor point, inclusive.

      -- メソッド: selection_clear ()

          Clear the selection if it is currently in this widget.  If the
          selection is not in this widget, the method has no effect.

               注釈: This shadows the inherited *note
               Misc.selection_clear(): 440d, which clears the X
               selection; that method is not available on a ‘Spinbox’.

      -- メソッド: selection_element (element=None)

          Set or get the currently selected element.  If 'element' (one
          of ‘'buttonup'’, ‘'buttondown'’ or ‘'none'’) is given, that
          spin button is selected and displayed depressed; otherwise the
          name of the currently selected element is returned.

      -- メソッド: selection_from (index)

          Set the selection anchor point to just before the character
          given by 'index', without changing the selection itself.

          Added in version 3.8.

      -- メソッド: selection_present ()

          Return ‘True’ if there are characters selected in the spinbox,
          ‘False’ otherwise.

          Added in version 3.8.

      -- メソッド: selection_range (start, end)

          Set the selection to include the characters starting with the
          one indexed by 'start' and ending with the one just before
          'end'.  If 'end' refers to the same character as 'start' or an
          earlier one, the selection is cleared.

          Added in version 3.8.

      -- メソッド: selection_to (index)

          Set the selection between 'index' and the anchor point.  If
          'index' is before the anchor point, the selection runs from
          'index' up to but not including the anchor point; if it is
          after, the selection runs from the anchor point up to but not
          including 'index'; if it is the same, nothing happens.  The
          anchor point is the one set by the most recent *note
          selection_from(): 459c. or *note selection_adjust(): 4599.
          call.  If the selection is not in this widget, a new selection
          is created using the most recent anchor point.

          Added in version 3.8.

 -- クラス: tkinter.Text (master=None, cnf={}, **kw)

     A ‘Text’ widget displays and edits multi-line text.  Portions of
     the text may be styled with 'tags', particular positions may be
     annotated with floating 'marks', and arbitrary images and other
     widgets may be embedded in the text.  The widget also provides an
     unlimited undo/redo mechanism and supports peer widgets that share
     the same underlying data.  Inherits from *note Widget: 43a3, *note
     XView: 44cf. and *note YView: 44d4, so the view can be scrolled
     horizontally and vertically with *note xview(): 44d0. and *note
     yview(): 44d5.  Refer to the Tk ‘text’ manual page for the full
     list of options.

     Most of the methods take one or more 'index' arguments that
     identify a position within the text.  As described in the Tk ‘text’
     manual page, an index is a string consisting of a base, optionally
     followed by one or more modifiers.  The base may be ‘'line.char'’
     (line 'line', character 'char', where lines are counted from 1 and
     characters within a line from 0; ‘'line.end'’ refers to the newline
     ending the line), ‘'end'’ (the position just after the last
     newline), the name of a mark, ‘'tag.first'’ or ‘'tag.last'’ (the
     first character tagged with 'tag', or the position just after the
     last such character), the name of an embedded image or window, or
     ‘@x,y’ (the character covering pixel coordinates 'x', 'y' in the
     widget).  A modifier such as ‘'+5 chars'’, ‘'-3 lines'’,
     ‘'linestart'’, ‘'lineend'’, ‘'wordstart'’ or ‘'wordend'’ adjusts
     the index relative to its base; several modifiers may be combined
     and are applied from left to right, for example ‘'insert wordstart
     - 1 c'’.

      -- メソッド: insert (index, chars, *args)

          Insert the string 'chars' just before the character at 'index'
          (if 'index' is ‘'end'’, just before the final newline).  By
          default the new text inherits any tags present on both sides
          of the insertion point.  If 'args' is given, it consists of
          alternating 'tagList', 'chars' values: the preceding 'chars'
          receives exactly the tags listed (a tag list may be a single
          tag name or a sequence of names), overriding the surrounding
          tags.

      -- メソッド: delete (index1, index2=None)

          Delete the range of characters from 'index1' up to but not
          including 'index2'.  If 'index2' is omitted, the single
          character at 'index1' is deleted.  The widget always keeps a
          newline as its last character, so a deletion that would remove
          it is adjusted accordingly.

      -- メソッド: replace (index1, index2, chars, *args)

          Replace the range of characters from 'index1' up to but not
          including 'index2' with 'chars'.  This is equivalent to a
          *note delete(): 45a1. followed by an *note insert(): 45a0. at
          'index1'; 'args' is interpreted as for ‘insert()’.

          Added in version 3.3.

      -- メソッド: get (index1, index2=None)

          Return the text from 'index1' up to but not including 'index2'
          as a string.  If 'index2' is omitted, return the single
          character at 'index1'.  Embedded images and windows are
          omitted from the result.

      -- メソッド: index (index)

          Return the position corresponding to 'index' in the canonical
          ‘'line.char'’ form.

      -- メソッド: compare (index1, op, index2)

          Compare the positions of 'index1' and 'index2' using the
          relational operator 'op', which must be one of ‘'<'’, ‘'<='’,
          ‘'=='’, ‘'>='’, ‘'>'’ or ‘'!='’, and return the boolean
          result.

      -- メソッド: count (index1, index2, *options, return_ints=False)

          Count the number of items of the requested kinds between
          'index1' and 'index2'; the count is negative if 'index1' is
          after 'index2'.  Each of 'options' names a kind of item to
          count: ‘'chars'’, ‘'displaychars'’, ‘'displayindices'’,
          ‘'displaylines'’, ‘'indices'’, ‘'lines'’, ‘'xpixels'’ or
          ‘'ypixels'’ (the default, used when no option is given, is
          ‘'indices'’).  The pseudo-option ‘'update'’ forces any
          out-of-date layout information to be recalculated before the
          following options are evaluated.  When 'return_ints' is true
          and a single counting option is given, return a plain integer;
          otherwise return a tuple with one integer per counting option
          (or ‘None’ if the result is empty).

          Added in version 3.3.

          バージョン 3.13 で変更: Added the 'return_ints' parameter.

      -- メソッド: see (index)

          Adjust the view so that the character given by 'index' is
          visible.  If it is already visible the method has no effect;
          if it is a short distance out of view the widget scrolls just
          enough to bring it to the nearest edge, otherwise it scrolls
          to center 'index' in the window.

      -- メソッド: bbox (index)

          Return a tuple ‘(x, y, width, height)’ giving the bounding
          box, in pixels, of the visible part of the character at
          'index', or ‘None’ if that character is not visible on the
          screen.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: dlineinfo (index)

          Return a tuple ‘(x, y, width, height, baseline)’ describing
          the display line that contains 'index': the first four values
          give the bounding box of the line in pixels and 'baseline'
          gives the offset of the baseline measured down from the top of
          the area.  Return ‘None’ if that display line is not visible
          on the screen.

      -- メソッド: mark_set (markName, index)

          Set the mark named 'markName' to the position just before the
          character at 'index', creating the mark if it does not already
          exist.  A mark created this way has right gravity by default.

      -- メソッド: mark_unset (*markNames)

          Remove each of the marks named in 'markNames'.  The special
          ‘insert’ and ‘current’ marks may not be removed.

      -- メソッド: mark_names ()

          Return a tuple of the names of all marks currently set in the
          widget.

      -- メソッド: mark_gravity (markName, direction=None)

          If 'direction' is omitted, return the gravity of mark
          'markName', either ‘'left'’ or ‘'right'’.  Otherwise set its
          gravity to 'direction'.  The gravity determines on which side
          of the mark text inserted at the mark's position appears: a
          mark with right gravity (the default) stays to the right of
          such text.

      -- メソッド: mark_next (index)

          Return the name of the first mark at or after 'index', or
          ‘None’ if there is none.  When 'index' is the name of a mark,
          the search starts just after that mark.

      -- メソッド: mark_previous (index)

          Return the name of the last mark at or before 'index', or
          ‘None’ if there is none.  When 'index' is the name of a mark,
          the search starts just before that mark.

      -- メソッド: tag_add (tagName, index1, *args)

          Add the tag 'tagName' to the range of characters from 'index1'
          up to but not including the next index in 'args'.  Further
          pairs of indices may follow in 'args' to tag additional
          ranges; a trailing single index tags just the character at
          that index.

      -- メソッド: tag_remove (tagName, index1, index2=None)

          Remove the tag 'tagName' from the characters from 'index1' up
          to but not including 'index2' (or from the single character at
          'index1' if 'index2' is omitted).  The tag itself continues to
          exist even if no characters carry it.

      -- メソッド: tag_delete (*tagNames)

          Delete each of the tags named in 'tagNames', removing them
          from all characters and discarding their options and bindings.

      -- メソッド: tag_configure (tagName, cnf=None, **kw)

          Query or modify the configuration options of the tag
          'tagName'.  This mirrors *note configure(): 439c, except that
          it applies to a tag rather than to the widget as a whole: with
          no options it returns a dictionary describing the current
          options, otherwise it sets the given options.  Defining a tag
          this way also gives it a priority higher than any existing
          tag.

          The supported tag options, all controlling the appearance of
          the tagged text, are:

          'font'

               The font to use for the text.

          'foreground'

               The color to use for the text.

          'background'

               The color to use for the area behind the text.

          'fgstipple', 'bgstipple'

               Bitmaps used to stipple the foreground (text) and the
               background; only well supported on X11.

          'borderwidth'

               The width of the border drawn around the text according
               to 'relief' (default ‘0’).

          'relief'

               The 3-D appearance of the text's border: ‘'flat'’ (the
               default), ‘'raised'’, ‘'sunken'’, ‘'ridge'’, ‘'groove'’
               or ‘'solid'’.

          'offset'

               How far the text is raised above (or, if negative,
               lowered below) the baseline, for superscripts and
               subscripts.

          'underline'

               Whether to underline the text.

          'underlinefg'

               The color of the underline; it defaults to the text
               color.

          'overstrike'

               Whether to draw a line through the middle of the text.

          'overstrikefg'

               The color of the overstrike line; it defaults to the text
               color.

          'elide'

               Whether the text is elided (hidden).

          'justify'

               How to justify the first character of a display line:
               ‘'left'’ (the default), ‘'right'’ or ‘'center'’.

          'wrap'

               How to wrap lines that are too long: ‘'char'’, ‘'word'’
               or ‘'none'’.

          'lmargin1', 'lmargin2'

               The indentation, in pixels, of the first display line of
               a logical line and of the remaining display lines.

          'lmargincolor'

               The color of the left margin area.

          'rmargin'

               The right-hand margin, in pixels.

          'rmargincolor'

               The color of the right margin area.

          'spacing1', 'spacing2', 'spacing3'

               Extra space, in pixels, above the first display line of a
               logical line, between its display lines, and below its
               last display line.

          'tabs'

               The set of tab stops, in the same form as the widget's
               'tabs' option.

          'tabstyle'

               How tab stops are interpreted: ‘'tabular'’ or
               ‘'wordprocessor'’.

          'selectbackground', 'selectforeground'

               The background and foreground colors used for the text
               while it is selected.

               注釈: Tk 8.6 added the 'lmargincolor', 'overstrikefg',
               'rmargincolor', 'selectbackground', 'selectforeground'
               and 'underlinefg' options.

          *note tag_config(): 45b2. is an alias of ‘tag_configure()’.

      -- メソッド: tag_cget (tagName, option)

          Return the current value of the configuration option 'option'
          for the tag 'tagName'.

      -- メソッド: tag_names (index=None)

          If 'index' is omitted, return a tuple of the names of all tags
          defined in the widget; otherwise return only the names of the
          tags applied to the character at 'index'.  The names are
          ordered from lowest to highest priority.

      -- メソッド: tag_ranges (tagName)

          Return a tuple of indices describing all ranges of text tagged
          with 'tagName'.  The result alternates start and end indices,
          so that elements ‘2*i’ and ‘2*i+1’ bound the 'i'-th range.

      -- メソッド: tag_nextrange (tagName, index1, index2=None)

          Search forward from 'index1' (up to 'index2' if given) for the
          first range of characters tagged with 'tagName', and return a
          two-element tuple of its start and end indices, or an empty
          tuple if there is no such range.

      -- メソッド: tag_prevrange (tagName, index1, index2=None)

          Search backward from 'index1' (down to 'index2' if given) for
          the nearest preceding range of characters tagged with
          'tagName', and return a two-element tuple of its start and end
          indices, or an empty tuple if there is no such range.

      -- メソッド: tag_raise (tagName, aboveThis=None)

          Raise the priority of tag 'tagName' so that it is just above
          the priority of 'aboveThis', or to the highest priority of all
          tags if 'aboveThis' is omitted.  When the display options of
          overlapping tags conflict, the higher-priority tag wins.

      -- メソッド: tag_lower (tagName, belowThis=None)

          Lower the priority of tag 'tagName' so that it is just below
          the priority of 'belowThis', or to the lowest priority of all
          tags if 'belowThis' is omitted.

      -- メソッド: tag_bind (tagName, sequence, func, add=None)

          Bind the event 'sequence' on characters tagged with 'tagName'
          to the callback 'func', so that 'func' is invoked when that
          event occurs over such a character.  If 'add' is true the
          binding is added alongside any existing bindings for
          'sequence', otherwise it replaces them.  Works like *note
          bind(): 43e8. and returns the identifier of the new binding.

      -- メソッド: tag_unbind (tagName, sequence, funcid=None)

          Remove the bindings of the event 'sequence' on characters
          tagged with 'tagName'.  If 'funcid' is given, only that
          binding (as returned by *note tag_bind(): 45bb.) is removed
          and its callback is unregistered.

          バージョン 3.13 で変更: If 'funcid' is given, only that
          callback is unbound.

      -- メソッド: image_create (index, cnf={}, **kw)

          Embed an image at 'index' and return the name assigned to this
          image instance, which may then be used as an index or passed
          to the other ‘image_*’ methods.  The options, given in 'cnf'
          and 'kw', include 'image' (the Tk image to display), 'name' (a
          base name for the instance), 'align', 'padx' and 'pady'.

      -- メソッド: image_cget (index, option)

          Return the current value of the configuration option 'option'
          for the embedded image at 'index'.

      -- メソッド: image_configure (index, cnf=None, **kw)

          Query or modify the configuration options of the embedded
          image at 'index', like *note configure(): 439c. but applied to
          that image.

      -- メソッド: image_names ()

          Return a tuple of the names of all images embedded in the
          widget.

               注釈: This shadows the inherited *note
               Misc.image_names(): 43d1, which returns the names of all
               images in the Tcl interpreter; that method is not
               available on a ‘Text’.

      -- メソッド: window_create (index, cnf={}, **kw)

          Embed a window (any widget) at 'index'.  The options, given in
          'cnf' and 'kw', include 'window' (the widget to embed),
          'create' (a callback that creates the widget on demand),
          'align', 'stretch', 'padx' and 'pady'.  The embedded widget
          must be a descendant of the text widget's parent.

      -- メソッド: window_cget (index, option)

          Return the current value of the configuration option 'option'
          for the embedded window at 'index'.

      -- メソッド: window_configure (index, cnf=None, **kw)

          Query or modify the configuration options of the embedded
          window at 'index', like *note configure(): 439c. but applied
          to that window.

          *note window_config(): 45c3. is an alias of
          ‘window_configure()’.

      -- メソッド: window_names ()

          Return a tuple of the names of all windows embedded in the
          widget.

      -- メソッド: edit (*args)

          Low-level wrapper around the Tk ‘edit’ widget command that
          controls the undo/redo mechanism and the modified flag; 'args'
          is the ‘edit’ subcommand and its arguments.  The ‘edit_*()’
          methods below are thin wrappers around it and are usually more
          convenient.

      -- メソッド: edit_modified (arg=None)

          If 'arg' is omitted, return the current state of the modified
          flag as ‘0’ or ‘1’; the flag is set automatically whenever the
          text is inserted or deleted.  Otherwise set the flag to the
          boolean 'arg'.

      -- メソッド: edit_undo ()

          Undo the most recent edit action, that is, all the inserts and
          deletes recorded on the undo stack since the previous
          separator, and move it to the redo stack.  Raises *note
          TclError: 43c0. if the undo stack is empty.  Has no effect
          unless the 'undo' option is true.  Since Tk 9.0, returns a
          tuple of indices delimiting the ranges of text that were
          changed.

      -- メソッド: edit_redo ()

          Reapply the most recently undone edit action, provided no
          further edits have been made since, and move it back to the
          undo stack.  Raises *note TclError: 43c0. if the redo stack is
          empty.  Has no effect unless the 'undo' option is true.  Since
          Tk 9.0, returns a tuple of indices delimiting the ranges of
          text that were changed.

      -- メソッド: edit_reset ()

          Clear the undo and redo stacks.

      -- メソッド: edit_separator ()

          Push a separator onto the undo stack, marking a boundary
          between edit actions for undo and redo.  Has no effect unless
          the 'undo' option is true.  Separators are inserted
          automatically when the 'autoseparators' option is true.

      -- メソッド: search (pattern, index, stopindex=None,
               forwards=None, backwards=None, exact=None, regexp=None,
               nocase=None, count=None, elide=None)

          Search for 'pattern' starting at 'index' and return the index
          of the first character of the first match, or an empty string
          if there is no match.  Searching stops at 'stopindex' if
          given; otherwise it wraps around the ends of the text until
          the starting position is reached again.  The following boolean
          keyword flags control the search: 'forwards' or 'backwards'
          select the direction (forward is the default); 'exact' (the
          default) or 'regexp' select literal or regular-expression
          matching; 'nocase' makes the match case-insensitive; and
          'elide' causes hidden text to be searched as well.  If 'count'
          is a *note Variable: 1d29, the number of index positions in
          the match is stored in it.

      -- メソッド: scan_mark (x, y)

          Record 'x', 'y' and the current view, for use with later *note
          scan_dragto(): 45ce. calls.  This is typically bound to a
          mouse button press in the widget.

      -- メソッド: scan_dragto (x, y)

          Scroll the widget by 10 times the difference between 'x', 'y'
          and the coordinates passed to the last *note scan_mark():
          45cd. call.  This is typically bound to mouse motion events,
          producing the effect of dragging the text at high speed
          through the window.

      -- メソッド: debug (boolean=None)

          If 'boolean' is omitted, return whether internal consistency
          checks of the B-tree data structure are enabled.  Otherwise
          enable or disable them.  The setting is shared by all text
          widgets and may noticeably slow down widgets holding large
          amounts of text.

      -- メソッド: dump (index1, index2=None, command=None, **kw)

          Return the contents of the widget from 'index1' up to but not
          including 'index2' (or just the segment at 'index1' if
          'index2' is omitted), including text and information about
          marks, tags, images and windows.  The result is a list of
          ‘(key, value, index)’ triples, where 'key' is one of ‘'text'’,
          ‘'mark'’, ‘'tagon'’, ‘'tagoff'’, ‘'image'’ or ‘'window'’.  By
          default all kinds are reported; passing any of the keyword
          arguments 'all', 'text', 'mark', 'tag', 'image' or 'window' as
          true restricts the dump to the selected kinds.  If 'command'
          is given, it is called once per triple with the three values
          as arguments and nothing is returned.

      -- メソッド: peer_create (newPathName, cnf={}, **kw)

          Create a peer text widget with the path name 'newPathName'
          that shares this widget's underlying data (text, marks, tags,
          images and the undo stack).  Changes made through any peer are
          reflected in all of them.  By default the peer covers the same
          lines as this widget; standard text options, including
          'startline' and 'endline', may be given to override this.

          Added in version 3.3.

      -- メソッド: peer_names ()

          Return a tuple of the path names of this widget's peers, not
          including the widget itself.

          Added in version 3.3.

      -- メソッド: yview_pickplace (*what)

          Adjust the view so that the location given by 'what' is
          visible.  This is an obsolete equivalent of *note see(): 45a6,
          which should be used instead.


File: python.info,  Node: Variable classes,  Next: Image classes,  Prev: Widget classes,  Up: リファレンス<8>

5.26.1.24 Variable classes
..........................

 -- クラス: tkinter.Variable (master=None, value=None, name=None)

     The base class for the Tk variable wrappers.  A Tk variable is a
     value stored in the Tcl interpreter that can be linked to widgets
     through their 'variable' or 'textvariable' options (see *note
     Coupling widget variables: 43ad.), so that changes propagate both
     ways: updating the variable updates every widget bound to it, and a
     user editing such a widget updates the variable.

     'master' is the widget whose Tcl interpreter owns the variable; if
     omitted, the default root window is used.  'value' is the initial
     value; if omitted, a type-specific default is used.  'name' is the
     name of the variable in the Tcl interpreter; if omitted, a unique
     name of the form ‘'PY_VARnum'’ is generated.  If 'name' matches an
     existing variable and 'value' is omitted, the existing value is
     retained.

     In most cases you should use one of the typed subclasses below -
     *note StringVar: 43af, *note IntVar: 43b0, *note DoubleVar: 43b1.
     or *note BooleanVar: 43b2. - rather than ‘Variable’ directly.

     バージョン 3.10 で変更: Two variables now compare equal (‘==’) only
     when they have the same name, are of the same class, and belong to
     the same Tcl interpreter.

      -- メソッド: get ()

          Return the current value of the variable.  For the base class
          the value is returned as a string; the typed subclasses
          convert it to the appropriate Python type.

      -- メソッド: set (value)

          Set the variable to 'value'.  *note initialize(): 45d5. is an
          alias of ‘set()’.

          Added in version 3.3: The 'initialize' spelling.

      -- メソッド: trace_add (mode, callback)

          Register 'callback' to be called when the variable is accessed
          according to 'mode'.  'mode' is one of the strings ‘'array'’,
          ‘'read'’, ‘'write'’ or ‘'unset'’, or a list or tuple of such
          strings.

          When triggered, 'callback' is called with three arguments: the
          name of the Tcl variable, an index (or an empty string if the
          variable is not an element of an array), and the 'mode' that
          triggered the call.

          Return the internal name of the registered callback, which can
          be passed to *note trace_remove(): 45d8.

          Added in version 3.6.

      -- メソッド: trace_remove (mode, cbname)

          Remove a trace callback from the variable.  'mode' must match
          the 'mode' that was passed to *note trace_add(): 45d7, and
          'cbname' is the callback name returned by ‘trace_add()’.

          Added in version 3.6.

      -- メソッド: trace_info ()

          Return a list of ‘(modes, cbname)’ pairs describing all traces
          currently set on the variable, where 'modes' is a tuple of
          mode strings and 'cbname' is the internal callback name.

          Added in version 3.6.

      -- メソッド: trace_variable (mode, callback)

          Register 'callback' to be called when the variable is accessed
          according to 'mode'.  'mode' is one of the strings ‘'r'’,
          ‘'w'’ or ‘'u'’, for read, write or unset.  Return the internal
          name of the registered callback.  *note trace(): 104. is an
          alias of ‘trace_variable()’.

          バージョン 3.6 で非推奨: Use *note trace_add(): 45d7. instead.
          This method wraps a Tcl feature that was removed in Tcl 9.0.

      -- メソッド: trace_vdelete (mode, cbname)

          Remove the trace callback named 'cbname' registered for 'mode'
          with *note trace_variable(): 45db.

          バージョン 3.6 で非推奨: Use *note trace_remove(): 45d8.
          instead.  This method wraps a Tcl feature that was removed in
          Tcl 9.0.

      -- メソッド: trace_vinfo ()

          Return a list of ‘(mode, cbname)’ pairs for all traces set on
          the variable with *note trace_variable(): 45db.

          バージョン 3.6 で非推奨: Use *note trace_info(): 45d9.
          instead.  This method wraps a Tcl feature that was removed in
          Tcl 9.0.

 -- クラス: tkinter.StringVar (master=None, value=None, name=None)

     A *note Variable: 1d29. subclass that holds a string.  The default
     value is ‘''’.

      -- メソッド: get ()

          Return the value of the variable as a *note str: 16a.

 -- クラス: tkinter.IntVar (master=None, value=None, name=None)

     A *note Variable: 1d29. subclass that holds an integer.  The
     default value is ‘0’.

      -- メソッド: get ()

          Return the value of the variable as an *note int: 19c.

 -- クラス: tkinter.DoubleVar (master=None, value=None, name=None)

     A *note Variable: 1d29. subclass that holds a float.  The default
     value is ‘0.0’.

      -- メソッド: get ()

          Return the value of the variable as a *note float: 197.
          注釈: A floating-point value is always parsed with a period
          (‘.’) as the decimal separator, but *note Spinbox: 43d8, *note
          Scale: 4581. and *note ttk.Spinbox: d91. format it according
          to the ‘LC_NUMERIC’ locale.  Under a locale that uses a comma
          they produce a value that *note get(): 45e0. cannot read,
          raising *note TclError: 43c0.  Set ‘LC_NUMERIC’ to a locale
          that uses a period (such as ‘'C'’) to avoid this.

 -- クラス: tkinter.BooleanVar (master=None, value=None, name=None)

     A *note Variable: 1d29. subclass that holds a boolean.  The default
     value is ‘False’.

      -- メソッド: get ()

          Return the value of the variable as a *note bool: 3c1.  Raise
          a *note ValueError: 2ee. if the value cannot be interpreted as
          a boolean.

      -- メソッド: set (value)

          Set the variable to 'value', converting it to a boolean.
          *note initialize(): 45e2. is an alias of ‘set()’.

          Added in version 3.3: The 'initialize' spelling.


File: python.info,  Node: Image classes,  Next: Other classes,  Prev: Variable classes,  Up: リファレンス<8>

5.26.1.25 Image classes
.......................

 -- クラス: tkinter.Image (imgtype, name=None, cnf={}, master=None,
          **kw)

     Base class for Tk images.  'imgtype' is the Tk image type, one of
     ‘'photo'’ or ‘'bitmap'’.  An image is a named object that can be
     displayed by widgets through their 'image' option; deleting all
     references to the ‘Image’ object deletes the underlying Tk image.
     Usually you create a *note PhotoImage: 1e42. or *note BitmapImage:
     43be. rather than an ‘Image’ directly.

     The image's configuration options are given by 'cnf' and 'kw' and
     may be queried and changed later with the mapping protocol (using
     ‘image[key]’) or with the *note configure(): 45e5. method.

      -- メソッド: configure (**kw)

          Modify one or more configuration options of the image.  The
          valid options depend on the image type; see *note PhotoImage:
          1e42. and *note BitmapImage: 43be.  *note config(): 45e6. is
          an alias of ‘configure()’.

      -- メソッド: height ()

          Return the height of the image, in pixels.

      -- メソッド: width ()

          Return the width of the image, in pixels.

      -- メソッド: type ()

          Return the type of the image, that is the value of 'imgtype'
          with which it was created (for example ‘'photo'’ or
          ‘'bitmap'’).

 -- クラス: tkinter.PhotoImage (name=None, cnf={}, master=None, **kw)

     A full-color image (the Tk ‘photo’ image type), stored internally
     with a varying degree of transparency per pixel.  It can read and
     write GIF, PPM/PGM and (in Tk 8.6 and later) PNG files, read SVG
     files (in Tk 9.0 and later), and be drawn in widgets.  Inherits
     from *note Image: 43bd.

     The configuration options include 'data' (the image contents as a
     string), 'file' (the name of a file to read the contents from),
     'format' (the name of the file format handler), 'width' and
     'height' (the size of the image, used when building it up piece by
     piece), 'gamma' and 'palette'.

      -- メソッド: blank ()

          Blank the image; that is, set the entire image to have no
          data, so that it is displayed as transparent and the
          background of whatever window it is displayed in shows
          through.

      -- メソッド: cget (option)

          Return the current value of the configuration option 'option'.

      -- メソッド: copy (*, from_coords=None, zoom=None, subsample=None)

          Return a new ‘PhotoImage’ with a copy of this image.

          'from_coords' specifies a rectangular sub-region of the source
          image to be copied.  It must be a tuple or a list of 1 to 4
          integers ‘(x1, y1, x2, y2)’.  ‘(x1, y1)’ and ‘(x2, y2)’
          specify diagonally opposite corners of the rectangle.  If 'x2'
          and 'y2' are not specified, they default to the bottom-right
          corner of the source image.  The pixels copied include the
          left and top edges of the rectangle but not the bottom or
          right edges.  If 'from_coords' is not given, the whole source
          image is copied.

          If 'zoom' or 'subsample' are specified, the image is
          transformed as in the *note zoom(): 45ed. or *note
          subsample(): 45ee. methods.  The value must be a single
          integer or a pair of integers.

          バージョン 3.13 で変更: Added the 'from_coords', 'zoom' and
          'subsample' parameters.

      -- メソッド: copy_replace (sourceImage, *, from_coords=None,
               to=None, shrink=False, zoom=None, subsample=None,
               compositingrule=None)

          Copy a region from 'sourceImage' (which must be a
          ‘PhotoImage’) into this image, possibly with pixel zooming
          and/or subsampling.  If no options are specified, the whole of
          'sourceImage' is copied into this image, starting at
          coordinates ‘(0, 0)’.

          'from_coords' specifies a rectangular sub-region of the source
          image to be copied, as in the *note copy(): 29. method.

          'to' specifies a rectangular sub-region of the destination
          image to be affected.  It must be a tuple or a list of 1 to 4
          integers ‘(x1, y1, x2, y2)’.  If 'x2' and 'y2' are not
          specified, they default to ‘(x1, y1)’ plus the size of the
          source region (after subsampling and zooming, if specified).
          If 'x2' and 'y2' are specified, the source region is
          replicated if necessary to fill the destination region in a
          tiled fashion.

          If 'shrink' is true, the size of the destination image is
          reduced, if necessary, so that the region being copied into is
          at the bottom-right corner of the image.

          If 'zoom' or 'subsample' are specified, the image is
          transformed as in the *note zoom(): 45ed. or *note
          subsample(): 45ee. methods.  The value must be a single
          integer or a pair of integers.

          'compositingrule' specifies how transparent pixels in the
          source image are combined with the destination image.  With
          ‘'overlay'’ (the default), the old contents of the destination
          image remain visible, as if the source image were printed on a
          piece of transparent film and placed over the top of the
          destination.  With ‘'set'’, the old contents of the
          destination image are discarded and the source image is used
          as-is.

          Added in version 3.13.

      -- メソッド: data (format=None, *, from_coords=None,
               background=None, grayscale=False)

          Return the image data.

          'format' specifies the name of the image file format handler
          to use.  If it is not given, the data is returned as a tuple
          (one element per row) of strings containing space-separated
          (one element per pixel/column) colors in ‘#RRGGBB’ format.

          'from_coords' specifies a rectangular region of the image to
          be returned.  It must be a tuple or a list of 1 to 4 integers
          ‘(x1, y1, x2, y2)’.  If only 'x1' and 'y1' are specified, the
          region extends from ‘(x1, y1)’ to the bottom-right corner of
          the image.  If all four coordinates are given, they specify
          diagonally opposite corners of the region, including ‘(x1,
          y1)’ and excluding ‘(x2, y2)’.  If 'from_coords' is not given,
          the whole image is returned.

          If 'background' is specified, the data does not contain any
          transparency information; in all transparent pixels the color
          is replaced by the specified color.

          If 'grayscale' is true, the data does not contain color
          information; all pixel data is transformed into grayscale.

          Added in version 3.13.

      -- メソッド: get (x, y)

          Return the color of the pixel at coordinates ('x', 'y') as an
          ‘(r, g, b)’ tuple of three integers between 0 and 255,
          representing the red, green and blue components respectively.

      -- メソッド: put (data, to=None)

          Set pixels of the image to the colors given in 'data', which
          must be a string or a nested sequence of horizontal rows of
          pixel colors (for example ‘"{red green} {blue yellow}"’).

          'to' specifies the coordinates of the region of the image into
          which the data are copied.  It must be a tuple or a list of 2
          or 4 integers ‘(x1, y1)’ or ‘(x1, y1, x2, y2)’ giving the
          top-left corner, and optionally the bottom-right corner, of
          the region.  The default position is ‘(0, 0)’.

      -- メソッド: read (filename, format=None, *, from_coords=None,
               to=None, shrink=False)

          Read image data from the file named 'filename' into the image.

          'format' specifies the format of the image data in the file.

          'from_coords' specifies a rectangular sub-region of the image
          file data to be copied to the destination image.  It must be a
          tuple or a list of 1 to 4 integers ‘(x1, y1, x2, y2)’.  If
          only 'x1' and 'y1' are specified, the region extends from
          ‘(x1, y1)’ to the bottom-right corner of the image in the
          file.  If all four coordinates are given, they specify
          diagonally opposite corners of the region.  If 'from_coords'
          is not given, the whole of the image in the file is read.

          'to' specifies the coordinates of the top-left corner of the
          region of the image into which the data are read.  The default
          is ‘(0, 0)’.

          If 'shrink' is true, the size of the image is reduced, if
          necessary, so that the region into which the file data are
          read is at the bottom-right corner of the image.

          Added in version 3.13.

      -- メソッド: subsample (x, y='', *, from_coords=None)

          Return a new ‘PhotoImage’ based on this image but using only
          every 'x'-th pixel in the X direction and every 'y'-th pixel
          in the Y direction.  If 'y' is not given, it defaults to the
          same value as 'x'.

          'from_coords' specifies a rectangular sub-region of the source
          image to be copied, as in the *note copy(): 29. method.

          バージョン 3.13 で変更: Added the 'from_coords' parameter.

      -- メソッド: transparency_get (x, y)

          Return ‘True’ if the pixel at coordinates ('x', 'y') is fully
          transparent, ‘False’ otherwise.

          Added in version 3.8.

      -- メソッド: transparency_set (x, y, boolean)

          Make the pixel at coordinates ('x', 'y') fully transparent if
          'boolean' is true, fully opaque otherwise.

          Added in version 3.8.

      -- メソッド: write (filename, format=None, from_coords=None, *,
               background=None, grayscale=False)

          Write image data from the image to the file named 'filename'.

          'format' specifies the name of the image file format handler
          to use.  If it is not given, the format is guessed from the
          file extension.

          'from_coords' specifies a rectangular region of the image to
          be written.  It must be a tuple or a list of 1 to 4 integers
          ‘(x1, y1, x2, y2)’.  If only 'x1' and 'y1' are specified, the
          region extends from ‘(x1, y1)’ to the bottom-right corner of
          the image.  If all four coordinates are given, they specify
          diagonally opposite corners of the region.  If 'from_coords'
          is not given, the whole image is written.

          If 'background' is specified, the data does not contain any
          transparency information; in all transparent pixels the color
          is replaced by the specified color.

          If 'grayscale' is true, the data does not contain color
          information; all pixel data is transformed into grayscale.

          バージョン 3.13 で変更: Added the 'background' and 'grayscale'
          parameters.

      -- メソッド: zoom (x, y='', *, from_coords=None)

          Return a new ‘PhotoImage’ with this image magnified by a
          factor of 'x' in the X direction and 'y' in the Y direction.
          If 'y' is not given, it defaults to the same value as 'x'.

          'from_coords' specifies a rectangular sub-region of the source
          image to be copied, as in the *note copy(): 29. method.

          バージョン 3.13 で変更: Added the 'from_coords' parameter.

 -- クラス: tkinter.BitmapImage (name=None, cnf={}, master=None, **kw)

     A two-color image (the Tk ‘bitmap’ image type) created from an X11
     bitmap.  Each pixel displays a foreground color, a background
     color, or nothing (producing a transparent effect).  Inherits from
     *note Image: 43bd.

     The configuration options are 'data' or 'file' (the source bitmap,
     given as a string in X11 bitmap format or as the name of a file in
     that format), 'maskdata' or 'maskfile' (the mask bitmap, in the
     same forms), and 'foreground' and 'background' (the two colors).
     For pixels where the mask is zero the image displays nothing; for
     other pixels it displays the foreground color where the source is
     one and the background color where the source is zero.  If
     'background' is set to an empty string, the background pixels are
     transparent.

     ‘BitmapImage’ has no methods of its own beyond those inherited from
     *note Image: 43bd.


File: python.info,  Node: Other classes,  Next: Module-level functions,  Prev: Image classes,  Up: リファレンス<8>

5.26.1.26 Other classes
.......................

 -- クラス: tkinter.Event

     A container for the attributes of an event passed to a callback
     bound with *note Misc.bind(): 43e8.  An ‘Event’ instance has the
     following attributes, each corresponding to a field of the
     underlying Tk event; depending on the event type, some attributes
     may be set to the string ‘'??'’ to indicate that they are not
     meaningful.  See *note Bindings and events: 43b9.

      -- の属性: serial

          The serial number of the event.

      -- の属性: num

          The mouse button that was pressed or released (for button
          events).

      -- の属性: focus

          Whether the window has the focus (for ‘Enter’ and ‘Leave’
          events).

      -- の属性: height
      -- の属性: width

          The new height and width of the window (for ‘Configure’ and
          ‘Expose’ events).

      -- の属性: keycode

          The keycode of the key that was pressed or released.

      -- の属性: state

          The state of the event, as a number (for most events) or a
          string (for ‘Visibility’ events).

      -- の属性: time

          The timestamp of the event, in milliseconds.

      -- の属性: x
      -- の属性: y

          The pointer position relative to the widget, in pixels.

      -- の属性: x_root
      -- の属性: y_root

          The pointer position relative to the top-left corner of the
          screen, in pixels.

      -- の属性: char

          The character typed, as a string (for key events).

      -- の属性: send_event

          ‘True’ if the event was sent by another application.

      -- の属性: keysym

          The symbolic name of the key that was pressed or released.

      -- の属性: keysym_num

          The numeric value of *note keysym: 4606.

      -- の属性: type

          The *note EventType: 4609. of the event.

      -- の属性: widget

          The widget on which the event occurred.

      -- の属性: delta

          The amount the mouse wheel was rotated (for ‘MouseWheel’
          events).

 -- クラス: tkinter.EventType (*values)

     An *note enum.StrEnum: 82d. enumerating the Tk event types, used as
     the value of *note Event.type: 4608.  Its members include, among
     others, ‘KeyPress’, ‘KeyRelease’, ‘ButtonPress’, ‘ButtonRelease’,
     ‘Motion’, ‘Enter’, ‘Leave’, ‘FocusIn’, ‘FocusOut’, ‘Configure’,
     ‘Map’, ‘Unmap’, ‘Expose’, ‘Destroy’ and ‘MouseWheel’.

     Added in version 3.6.

 -- クラス: tkinter.CallWrapper (func, subst, widget)

     Internal helper that wraps a Python callback so that it can be
     invoked from Tcl.  'func' is the Python function, 'subst' is an
     optional function that pre-processes the Tcl arguments, and
     'widget' is the widget used for error reporting.  Instances are
     created automatically by *note Misc.register(): 43ca.; this class
     is not normally used directly.


File: python.info,  Node: Module-level functions,  Next: File handlers,  Prev: Other classes,  Up: リファレンス<8>

5.26.1.27 Module-level functions
................................

 -- の関数: tkinter.Tcl (screenName=None, baseName=None, className='Tk',
          useTk=False)

     The ‘Tcl()’ function is a factory function which creates an object
     much like that created by the *note Tk: 1779. class, except that it
     does not initialize the Tk subsystem.  This is most often useful
     when driving the Tcl interpreter in an environment where one
     doesn't want to create extraneous toplevel windows, or where one
     cannot (such as Unix/Linux systems without an X server).  An object
     created by the ‘Tcl()’ object can have a Toplevel window created
     (and the Tk subsystem initialized) by calling its *note loadtk():
     44e0. method.

 -- の関数: tkinter.NoDefaultRoot ()

     Inhibit the creation of an implicit default root window.
     Afterwards ‘tkinter’ no longer creates a shared default root
     automatically, and operations that rely on one -- such as
     constructing a widget without an explicit 'master' -- raise a *note
     RuntimeError: 246.  Call this early in larger applications to make
     the root window explicit.

 -- の関数: tkinter.mainloop (n=0)

     Run the Tk main event loop on the default root window until all
     windows are destroyed.  Equivalent to calling *note
     Misc.mainloop(): 43a4. on the default root.

 -- の関数: tkinter.getboolean (s)

     Convert the Tcl boolean string 's' (one of ‘'1'’, ‘'true'’,
     ‘'yes'’, ‘'on'’ and similar, or their false counterparts) to a
     Python *note bool: 3c1.  Raise *note TclError: 43c0. for an invalid
     value.

 -- の関数: tkinter.getdouble (s)

     Convert 's' to a floating-point number.  This is the built-in *note
     float: 197.

 -- の関数: tkinter.getint (s)

     Convert 's' to an integer.  This is the built-in *note int: 19c.

 -- の関数: tkinter.image_names ()

     Return the names of all existing images in the default root's
     interpreter.

 -- の関数: tkinter.image_types ()

     Return the available image types (such as ‘'photo'’ and ‘'bitmap'’)
     in the default root's interpreter.


File: python.info,  Node: File handlers,  Next: 定数<10>,  Prev: Module-level functions,  Up: リファレンス<8>

5.26.1.28 File handlers
.......................

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: 8a4. ク
ラスや *note TextIOBase: 8a5. クラスの *note read(): 1544. メソッドおよ
び *note readline(): 1545. メソッドを使おうとしないでください。これらは
読み込みの際に、あらかじめ決められたバイト数を要求するのです。ソケットに
は、 *note recv(): fa8. や *note recvfrom(): fa9. メソッドを使うといいで
す。その他のファイルには、 raw 読み込みか ‘os.read(file.fileno(),
maxbytecount)’ を使ってください。

 -- メソッド: Widget.tk.createfilehandler (file, mask, func)

     ファイルハンドラであるコールバック関数 'func' を登録します。 'file'
     引数は、 (ファイルやソケットオブジェクトのような) *note fileno():
     181b. メソッドを持つオブジェクトか、整数のファイルディスクリプタと
     なります。 'mask' 引数は、以下にある3つの定数の組み合わせの OR を取
     ったものです。コールバックは次のように呼ばれます:

          callback(file, mask)

 -- メソッド: Widget.tk.deletefilehandler (file)

     ファイルハンドラの登録を解除します。

 -- データ: tkinter.READABLE
 -- データ: tkinter.WRITABLE
 -- データ: tkinter.EXCEPTION

     'mask' 引数で使う定数です。


File: python.info,  Node: 定数<10>,  Prev: File handlers,  Up: リファレンス<8>

5.26.1.29 定数
..............

The following symbolic constants are available in both the ‘tkinter’ and
‘tkinter.constants’ namespaces.

 -- データ: tkinter.TRUE
 -- データ: tkinter.YES
 -- データ: tkinter.ON

     Truthy values, all equal to the integer ‘1’.

 -- データ: tkinter.FALSE
 -- データ: tkinter.NO
 -- データ: tkinter.OFF

     Falsy values, all equal to the integer ‘0’.

 -- データ: tkinter.N
 -- データ: tkinter.S
 -- データ: tkinter.E
 -- データ: tkinter.W
 -- データ: tkinter.NE
 -- データ: tkinter.NW
 -- データ: tkinter.SE
 -- データ: tkinter.SW
 -- データ: tkinter.NS
 -- データ: tkinter.EW
 -- データ: tkinter.NSEW
 -- データ: tkinter.CENTER

     Compass directions (‘'n'’, ‘'s'’, ‘'e'’, ‘'w'’ and the diagonals
     and edges) plus ‘CENTER’ (‘'center'’), used as values for the
     'anchor' and 'sticky' options and by methods such as *note
     Misc.grid_anchor(): 43d4.

 -- データ: tkinter.LEFT
 -- データ: tkinter.RIGHT
 -- データ: tkinter.TOP
 -- データ: tkinter.BOTTOM

     Sides for the 'side' option of the packer (see *note
     Pack.pack_configure(): 44a4.).

 -- データ: tkinter.X
 -- データ: tkinter.Y
 -- データ: tkinter.BOTH
 -- データ: tkinter.NONE

     Values for the 'fill' option of the packer: ‘'x'’, ‘'y'’, ‘'both'’
     or ‘'none'’.

 -- データ: tkinter.RAISED
 -- データ: tkinter.SUNKEN
 -- データ: tkinter.FLAT
 -- データ: tkinter.RIDGE
 -- データ: tkinter.GROOVE
 -- データ: tkinter.SOLID

     Values for the 'relief' option, which controls a widget's 3-D
     border.

 -- データ: tkinter.HORIZONTAL
 -- データ: tkinter.VERTICAL

     Values for the 'orient' option of widgets such as *note Scale:
     4581, *note Scrollbar: 44d1. and *note PanedWindow: 44a6.

 -- データ: tkinter.CHAR
 -- データ: tkinter.WORD

     Values for the 'wrap' option of the *note Text: 1a58. widget,
     selecting line wrapping on character or word boundaries.

 -- データ: tkinter.BASELINE

     The text-alignment value ‘'baseline'’.

 -- データ: tkinter.INSIDE
 -- データ: tkinter.OUTSIDE

     Values for the 'bordermode' option of the placer (see *note
     Place.place_configure(): 44b1.).

 -- データ: tkinter.INSERT
 -- データ: tkinter.CURRENT
 -- データ: tkinter.END
 -- データ: tkinter.ANCHOR
 -- データ: tkinter.SEL
 -- データ: tkinter.SEL_FIRST
 -- データ: tkinter.SEL_LAST

     Symbolic indices used by the *note Text: 1a58, *note Entry: 440e,
     *note Listbox: 43d7. and *note Canvas: 1a59. widgets, such as
     ‘'insert'’ (the insertion cursor), ‘'current'’, ‘'end'’, ‘'anchor'’
     and the bounds of the selection (‘'sel.first'’ and ‘'sel.last'’).

 -- データ: tkinter.ALL

     The special tag ‘'all'’, which matches every item of a *note
     Canvas: 1a59. or every character of a *note Text: 1a58. (for
     example ‘canvas.delete(ALL)’).

 -- データ: tkinter.NORMAL
 -- データ: tkinter.DISABLED
 -- データ: tkinter.ACTIVE
 -- データ: tkinter.HIDDEN

     Values for the 'state' option of various widgets and items.

 -- データ: tkinter.CASCADE
 -- データ: tkinter.CHECKBUTTON
 -- データ: tkinter.COMMAND
 -- データ: tkinter.RADIOBUTTON
 -- データ: tkinter.SEPARATOR

     Menu entry types, used as the 'itemType' argument of *note
     Menu.add(): 4550. and *note Menu.insert(): 4556.

 -- データ: tkinter.SINGLE
 -- データ: tkinter.BROWSE
 -- データ: tkinter.MULTIPLE
 -- データ: tkinter.EXTENDED

     Values for the 'selectmode' option of the *note Listbox: 43d7.
     widget.

 -- データ: tkinter.PIESLICE
 -- データ: tkinter.CHORD
 -- データ: tkinter.ARC

     Values for the 'style' option of *note Canvas: 1a59. arc items.

 -- データ: tkinter.BUTT
 -- データ: tkinter.PROJECTING
 -- データ: tkinter.ROUND
 -- データ: tkinter.BEVEL
 -- データ: tkinter.MITER

     Values for the 'capstyle' (‘'butt'’, ‘'projecting'’, ‘'round'’) and
     'joinstyle' (‘'round'’, ‘'bevel'’, ‘'miter'’) options of *note
     Canvas: 1a59. line items.

 -- データ: tkinter.FIRST
 -- データ: tkinter.LAST

     Values for the 'arrow' option of *note Canvas: 1a59. line items,
     indicating which ends have arrowheads.

 -- データ: tkinter.MOVETO
 -- データ: tkinter.SCROLL

     The first argument passed by a *note Scrollbar: 44d1. to the *note
     XView.xview(): 44d0. or *note YView.yview(): 44d5. method of the
     scrolled widget.

 -- データ: tkinter.UNITS
 -- データ: tkinter.PAGES

     Values for the 'what' argument of *note XView.xview_scroll(): 44d3.
     and *note YView.yview_scroll(): 44d7.

 -- データ: tkinter.UNDERLINE
 -- データ: tkinter.NUMERIC
 -- データ: tkinter.DOTBOX

     Other option values: ‘'underline'’, ‘'numeric'’ and ‘'dotbox'’.


File: python.info,  Node: tkinter colorchooser --- カラー選択ダイアログ,  Next: tkinter font --- Tkinter フォントラッパー,  Prev: tkinter --- Tcl/Tk の Python インターフェース,  Up: Graphical user interfaces with Tk

5.26.2 ‘tkinter.colorchooser’ -- カラー選択ダイアログ
-----------------------------------------------------

'ソースコード:' Lib/tkinter/colorchooser.py(1)

__________________________________________________________________

The ‘tkinter.colorchooser’ module provides the *note Chooser: 466b.
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: 466c. class.

 -- クラス: tkinter.colorchooser.Chooser (master=None, **options)

     The class implementing the modal color-choosing dialog.  Most
     applications use the *note askcolor(): 466d. convenience function
     rather than instantiating this class directly.

 -- の関数: tkinter.colorchooser.askcolor (color=None, **options)

     Show a modal color-choosing dialog and return the chosen color.
     'color' is the color selected when the dialog opens.  The return
     value is a tuple ‘((r, g, b), hexstr)’, where ‘r’, ‘g’ and ‘b’ are
     the red, green and blue components as integers in the range 0–255
     and 'hexstr' is the equivalent Tk color string, such as
     ‘'#ff8000'’.  If the user cancels the dialog, ‘(None, None)’ is
     returned.

     バージョン 3.10 で変更: The RGB values in the returned color are
     now integers in the range 0–255 instead of floats.

参考
....

モジュール *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 dialogs,  Prev: tkinter colorchooser --- カラー選択ダイアログ,  Up: Graphical user interfaces with Tk

5.26.3 ‘tkinter.font’ -- Tkinter フォントラッパー
-------------------------------------------------

'ソースコード:' Lib/tkinter/font.py(1)

__________________________________________________________________

The ‘tkinter.font’ module provides the *note Font: 1d2a. 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 ‘Font’ 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.

     バージョン 3.10 で変更: Two fonts now compare equal (‘==’) only
     when both are ‘Font’ instances with the same name belonging to the
     same Tcl interpreter.

     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, for example, 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 actual attributes of the font, which may differ
          from the requested ones because of platform limitations.  With
          no 'option', return a dictionary of all the attributes; if
          'option' is given, return the value of that single attribute.

      -- メソッド: cget (option)

          Retrieve an attribute of the font.

      -- メソッド: configure (**options)

          Modify one or more attributes of the font.  With no arguments,
          return a dictionary of the current attributes.

          *note config(): 4677. is an alias of ‘configure()’.

      -- メソッド: 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, as an integer
          number of pixels.  If no display is specified then the main
          application window is assumed.

      -- メソッド: metrics (*options, **kw)

          Return font-specific data.  With no options, return a
          dictionary mapping each metric name to its integer value; if
          one option name is given, return that metric's value as an
          integer.  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 a tuple of the names of the available font families.

 -- の関数: tkinter.font.names (root=None)

     Return a tuple of the names of all the defined fonts.

 -- の関数: tkinter.font.nametofont (name, root=None)

     Return a *note Font: 1d2a. representation of the existing named
     font 'name'.  'root' is the widget whose Tcl interpreter owns the
     font; if omitted, the default root window is used.

     バージョン 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 dialogs,  Next: tkinter messagebox --- Tkinter メッセージプロンプト,  Prev: tkinter font --- Tkinter フォントラッパー,  Up: Graphical user interfaces with Tk

5.26.4 Tkinter dialogs
----------------------

* 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
* tkinter.dialog: tkinter dialog --- Classic Tk dialog boxes. Classic Tk dialog boxes


File: python.info,  Node: tkinter simpledialog --- Standard Tkinter input dialogs,  Next: tkinter filedialog --- File selection dialogs,  Up: Tkinter dialogs

5.26.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, *,
          initialvalue=None, minvalue=None, maxvalue=None, parent=None)
 -- の関数: tkinter.simpledialog.askinteger (title, prompt, *,
          initialvalue=None, minvalue=None, maxvalue=None, parent=None)
 -- の関数: tkinter.simpledialog.askstring (title, prompt, *,
          initialvalue=None, show=None, parent=None)

     Prompt the user to enter a value of the desired type and return it,
     or ‘None’ if the dialog is cancelled.

     'title' is the dialog title and 'prompt' the message shown above
     the entry.  'initialvalue' is the value initially placed in the
     entry.  'parent' is the window over which the dialog is shown.
     ‘askinteger()’ and ‘askfloat()’ also accept 'minvalue' and
     'maxvalue', which bound the accepted value.  ‘askstring()’ also
     accepts 'show', a character used to mask the entered text, for
     example ‘'*'’ to hide a password.

 -- クラス: tkinter.simpledialog.Dialog (parent, title=None)

     The base class for custom dialogs.  Instantiating it shows the
     dialog modally and returns once the user closes it; the entered
     value is then available in the ‘result’ attribute.

      -- の属性: result

          The value produced by *note apply(): 4686, or ‘None’ if the
          dialog was cancelled.

      -- メソッド: body (master)

          ダイアログインターフェースの構築をオーバーライドし、初期フォー
          カスを持つべきウィジットを返します。

      -- メソッド: buttonbox ()

          デフォルト動作はOKとCancelボタンを追加します。カスタムのボタン
          レイアウトが必要であればオーバーライドします。

      -- メソッド: validate ()

          Validate the data entered by the user.  Return true if it is
          valid, in which case the dialog proceeds to *note apply():
          4686.; return false to keep the dialog open.  The default
          implementation always returns true; override it to check the
          input.

      -- メソッド: apply ()

          Process the data entered by the user, for example by storing
          it in the ‘result’ attribute.  Called after *note validate():
          4689. succeeds and just before the dialog is destroyed.  The
          default implementation does nothing; override it to act on or
          store the result.

      -- メソッド: destroy ()

          Destroy the dialog window, clearing the reference to the
          widget that had the initial focus.

 -- クラス: tkinter.simpledialog.SimpleDialog (master, text='',
          buttons=[], default=None, cancel=None, title=None,
          class_=None)

     A simple modal dialog that displays the message 'text' above a row
     of push buttons whose labels are given by 'buttons', and returns
     the index of the button the user presses.  'default' is the index
     of the button activated by the Return key, 'cancel' the index
     returned when the window is closed through the window manager,
     'title' the window title, and 'class_' the Tk class name of the
     window.

      -- メソッド: go ()

          Display the dialog, wait until the user presses a button or
          closes the window, and return the index of the chosen button.

   ---------- 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 dialogs

5.26.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:

* Native load/save dialogs::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/filedialog.py


File: python.info,  Node: Native load/save dialogs,  Up: tkinter filedialog --- File selection dialogs

5.26.4.3 Native load/save dialogs
.................................

下記のクラスは、振る舞いをカスタマイズできる設定オプション付きの、ネイテ
ィブルック＆フィールと統合したファイルダイアログを提供します。以下のキー
ワード引数は、下記で列挙するクラスや関数に適用できます。

          '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, and return it.  The exact return
value depends on the function (see below); when the dialog is cancelled
it is an empty string, an empty tuple, an empty list or ‘None’.

 -- の関数: tkinter.filedialog.askopenfile (mode='r', **options)
 -- の関数: tkinter.filedialog.askopenfiles (mode='r', **options)

     Create an *note Open: 4691. dialog.  ‘askopenfile()’ returns the
     opened file object, or ‘None’ if the dialog is cancelled.
     ‘askopenfiles()’ returns a list of the opened file objects, or an
     empty list if cancelled.  The files are opened in mode 'mode'
     (read-only ‘'r'’ by default).

 -- の関数: tkinter.filedialog.asksaveasfile (mode='w', **options)

     Create a *note SaveAs: 4693. dialog and return the opened file
     object, or ‘None’ if the dialog is cancelled.  The file is opened
     in mode 'mode' (‘'w'’ by default).

 -- の関数: tkinter.filedialog.askopenfilename (**options)
 -- の関数: tkinter.filedialog.askopenfilenames (**options)

     Create an *note Open: 4691. dialog.  ‘askopenfilename()’ returns
     the selected filename as a string, or an empty string if the dialog
     is cancelled.  ‘askopenfilenames()’ returns a tuple of the selected
     filenames, or an empty tuple if cancelled.

 -- の関数: tkinter.filedialog.asksaveasfilename (**options)

     Create a *note SaveAs: 4693. dialog and return the selected
     filename as a string, or an empty string if the dialog is
     cancelled.

 -- の関数: tkinter.filedialog.askdirectory (**options)

     Prompt the user to select a directory, and return its path as a
     string, or an empty string if the dialog is cancelled.  Additional
     keyword option: 'mustexist' - if true, the user may only select an
     existing directory (false by default).

 -- クラス: 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.

      -- メソッド: ok_command ()

          Called when the user confirms the current selection.  The base
          implementation accepts the selection and closes the dialog;
          *note LoadFileDialog: 46a5. and *note SaveFileDialog: 46a6.
          override it to check the selection first.

      -- メソッド: 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,  Next: tkinter dialog --- Classic Tk dialog boxes,  Prev: tkinter filedialog --- File selection dialogs,  Up: Tkinter dialogs

5.26.4.4 ‘tkinter.commondialog’ -- Dialog window templates
..........................................................

'Source code:' Lib/tkinter/commondialog.py(1)

__________________________________________________________________

The ‘tkinter.commondialog’ module provides the *note Dialog: 466c. 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.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/commondialog.py


File: python.info,  Node: tkinter dialog --- Classic Tk dialog boxes,  Prev: tkinter commondialog --- Dialog window templates,  Up: Tkinter dialogs

5.26.4.5 ‘tkinter.dialog’ -- Classic Tk dialog boxes
....................................................

'Source code:' Lib/tkinter/dialog.py(1)

__________________________________________________________________

The ‘tkinter.dialog’ module provides a simple modal dialog box built on
the classic (non-themed) Tk widgets.

 -- データ: tkinter.dialog.DIALOG_ICON

     The name of the default bitmap (‘'questhead'’) displayed by a *note
     Dialog: 46b0.

 -- クラス: tkinter.dialog.Dialog (master=None, cnf={}, **kw)

     Display a modal dialog box built from the classic (non-themed) Tk
     widgets and wait for the user to press one of its buttons.  The
     options, given through 'cnf' or as keyword arguments, include
     'title' (the window title), 'text' (the message), 'bitmap' (an
     icon, *note DIALOG_ICON: 46af. by default), 'default' (the index of
     the default button) and 'strings' (the sequence of button labels).
     After construction, the ‘num’ attribute holds the index of the
     button the user pressed.

      -- メソッド: destroy ()

          Destroy the dialog window.

参考
....

Modules *note tkinter.messagebox: fd, *note ファイルを読み書きする:
20c2.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tkinter/dialog.py


File: python.info,  Node: tkinter messagebox --- Tkinter メッセージプロンプト,  Next: tkinter scrolledtext --- Scrolled text widget,  Prev: Tkinter dialogs,  Up: Graphical user interfaces with Tk

5.26.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: each blocks until the user responds, then
returns a value that depends on the function.  The ‘show*’ functions and
*note Message.show(): 46b5. return the symbolic name of the button the
user pressed, as a string (such as *note OK: 46b6. or *note YES: 46b7.),
while the ‘ask*’ functions return a *note bool: 3c1. or ‘None’ (see each
function below).  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: 46b9. of the default
               button for this message window (*note OK: 46b6, *note
               CANCEL: 46ba, 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: 46bb. to display.  If this
               option is not specified, then the *note INFO: 46bc. 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: 46bd. to
               be displayed.

          注釈: Tk 8.6 added the 'command' option.

      -- メソッド: 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: 46b7. and
     *note NO: 46c2.  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: 46b6. and
     *note CANCEL: 46ba.  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:
     46c5. and *note CANCEL: 46ba.  Return ‘True’ if the answer is retry
     and ‘False’ otherwise.

 -- の関数: tkinter.messagebox.askyesno (title=None, message=None,
          **options)

     Ask a question.  Shows buttons *note YES: 46b7. and *note NO: 46c2.
     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: 46b7, *note NO: 46c2. and
     *note CANCEL: 46ba.  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: 46c8,
     *note RETRY: 46c5. and *note IGNORE: 46c9.

 -- データ: tkinter.messagebox.OK = 'ok'

     Displays one button whose symbolic name is *note OK: 46b6.

 -- データ: tkinter.messagebox.OKCANCEL = 'okcancel'

     Displays two buttons whose symbolic names are *note OK: 46b6. and
     *note CANCEL: 46ba.

 -- データ: tkinter.messagebox.RETRYCANCEL = 'retrycancel'

     Displays two buttons whose symbolic names are *note RETRY: 46c5.
     and *note CANCEL: 46ba.

 -- データ: tkinter.messagebox.YESNO = 'yesno'

     Displays two buttons whose symbolic names are *note YES: 46b7. and
     *note NO: 46c2.

 -- データ: tkinter.messagebox.YESNOCANCEL = 'yesnocancel'

     Displays three buttons whose symbolic names are *note YES: 46b7,
     *note NO: 46c2. and *note CANCEL: 46ba.
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 --- Scrolled text widget,  Next: tkinter dnd --- ドラッグアンドドロップのサポート,  Prev: tkinter messagebox --- Tkinter メッセージプロンプト,  Up: Graphical user interfaces with Tk

5.26.6 ‘tkinter.scrolledtext’ -- Scrolled text widget
-----------------------------------------------------

'ソースコード:' 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: 46d5.
class is a lot easier than setting up a text widget and scroll bar
directly.

The text widget and scrollbar are packed together in a *note Frame:
4426, and the methods of the *note Pack: 449f, *note Grid: 44a1. and
*note Place: 44a0. geometry managers are acquired from the ‘Frame’
object.  This allows the *note ScrolledText: 46d5. widget to be used
directly to achieve most normal geometry management behavior.

特定の制御が必要ならば、以下の属性が利用できます:

 -- クラス: 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 --- Scrolled text widget,  Up: Graphical user interfaces with Tk

5.26.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
Bindings and events: 43b9.).  The function should call *note
dnd_start(): 46db, 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 a 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 the drag-and-drop process.  Return the *note
     DndHandler: 46dc. instance managing the drag, or ‘None’ if a drag
     could not be started.

参考
....

*note Bindings and events: 43b9.

   ---------- 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.26.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.

Added in version 3.1.

参考
....

Tk Widget Styling Support(2)

     Tk のテーマサポートを紹介するドキュメント

* Menu:

* Ttk を使う::
* Ttk widgets::
* ウィジェット::
* コンボボックス::
* Spinbox::
* ノートブック::
* プログレスバー::
* セパレータ::
* サイズグリップ::
* ツリービュー::
* Ttk styling::
* Additional widgets::

   ---------- 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 widgets,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.1 Ttk を使う
...................

Ttk を使い始めるために、モジュールをインポートします:

     from tkinter import ttk

基本的な Tk ウィジェットを上書きするため、次のように Tk のインポートに続
けてインポートを行います:

     from tkinter import *
     from tkinter.ttk import *

That code causes several ‘tkinter.ttk’ widgets (*note Button: 4399,
*note Checkbutton: 1a25, *note Entry: 43d9, *note Frame: 4397, *note
Label: 4398, *note LabelFrame: 46e5, *note Menubutton: 46e6, *note
PanedWindow: 44a8, *note Radiobutton: 46e7, *note Scale: 46e8. and *note
Scrollbar: 46e9.) to automatically replace the Tk widgets.

This has the direct benefit of using the new widgets which gives a
better look and feel across platforms; however, the replacement widgets
are not completely compatible.  The main difference is that widget
options such as "fg", "bg" and others related to widget styling are no
longer present in Ttk widgets.  Instead, use the *note ttk.Style: 560.
class for improved styling effects.

参考
....

Converting existing applications to use Tile widgets(1)

     アプリケーションを移行して新しいウィジェットを使用する際に出くわす
     典型的な差異について (Tcl の用語を使って) 書かれている研究論文

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/doc/converting.txt


File: python.info,  Node: Ttk widgets,  Next: ウィジェット,  Prev: Ttk を使う,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.2 Ttk widgets
....................

Ttk には 18 のウィジェットがあり、そのうち 12 は Tkinter に既にあるもの
です: *note Button: 4399, *note Checkbutton: 1a25, *note Entry: 43d9,
*note Frame: 4397, *note Label: 4398, *note LabelFrame: 46e5, *note
Menubutton: 46e6, *note PanedWindow: 44a8, *note Radiobutton: 46e7,
*note Scale: 46e8, *note Scrollbar: 46e9, *note Spinbox: d91. 。新しい 6
つは次のものです: *note Combobox: 46eb, *note Notebook: 44a7, *note
Progressbar: 46ec, *note Separator: 46ed, *note Sizegrip: 46ee, *note
Treeview: c8b. 。そして、これらは全て *note Widget: 46ef. の子クラスです
。

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: 46f0. についての詳細は *note Style: 560. クラスの文書
を読んでください。


File: python.info,  Node: ウィジェット,  Next: コンボボックス,  Prev: Ttk widgets,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.3 ウィジェット
.....................

*note ttk.Widget: 46ef. defines standard options and methods supported
by Tk themed widgets and is not supposed to be directly instantiated.

* Menu:

* Standard options::
* Scrollable widget options::
* Label options::
* Compatibility options::
* Widget states::
* ttk.Widget: ttk Widget.


File: python.info,  Node: Standard options,  Next: Scrollable widget options,  Up: ウィジェット

5.26.8.4 Standard options
.........................

All the ‘ttk’ Widgets accept the following options:

オプション      説明
                
-----------------------------------------------------------------------------------
                
クラス          ウィンドウクラスを指定します。このクラスはオプションデータベース
                にウィンドウの他のオプションについて問い合わせを行うときに使われ
                、これによりウィンドウのデフォルトのバインドタグを決定したり、ウ
                ィジェットのデフォルトのレイアウトやスタイルを選択します。このオ
                プションは読み出し専用で、ウィンドウが作成されるときにのみ指定で
                きます。
                
                
cursor          Specifies the mouse cursor to be used for the widget.  If set to
                the empty string (the default), the cursor is inherited from the
                parent widget.
                
                
takefocus       キーボードによる移動のときにウィンドウがフォーカスを受け入れるか
                を決定します。0、1、空文字列のいずれかを返します。0 が返されると
                、キーボードによる移動でそのウィンドウは常にスキップされます。1
                なら、そのウィンドウが表示されているときに限り入力フォーカスを受
                け入れます。そして空文字列は、移動スクリプトによってウィンドウに
                フォーカスを当てるかどうかが決まることを意味します。
                
                
style           独自のウィジェットスタイルを指定するのに使われます。
                


File: python.info,  Node: Scrollable widget options,  Next: Label options,  Prev: Standard options,  Up: ウィジェット

5.26.8.5 Scrollable widget options
..................................

以下のオプションはスクロールバーで操作されるウィジェットが持っているオプ
ションです。

オプション           説明
                     
-----------------------------------------------------------------------------------
                     
xscrollcommand       水平方向のスクロールバーとのやり取りに使われます。
                     
                     When the view in the widget's window changes, the widget
                     calls the 'xscrollcommand' callback.
                     
                     Usually this option consists of the method
                     *note Scrollbar.set: 4588. of some scrollbar.  This will
                     cause the scrollbar to be updated whenever the view in the
                     window changes.
                     
                     
yscrollcommand       垂直方向のスクロールバーとのやり取りに使われます。詳しくは
                     、上記を参照してください。
                     


File: python.info,  Node: Label options,  Next: Compatibility options,  Prev: Scrollable widget options,  Up: ウィジェット

5.26.8.6 Label options
......................

以下のオプションはラベルやボタンやボタンに類似したウィジェットが持ってい
るオプションです。

オプション         説明
                   
-----------------------------------------------------------------------------------
                   
text               ウィジェットに表示される文字列を指定します。
                   
                   
textvariable       text オプションの代わりに使う値の変数名を指定します。
                   
                   
underline          このオプションを設定すると、文字列の中で下線を引く文字のイン
                   デックス (0 基点) を指定します。下線が引かれた文字はショート
                   カットとして使われます。
                   
                   
image              表示する画像を指定します。これは 1 つ以上の要素を持つリストで
                   す。先頭の要素はデフォルトの画像名です。残りの要素は
                   *note Style.map(): 1d44. で定義されているような状態名と値のペ
                   アの並びで、ウィジェットがある状態、もしくはある状態の組み合
                   わせにいるときに使用する別の画像を指定します。このリストにあ
                   る全ての画像は同じサイズでなればなりません。
                   
                   
compound           text オプションと image オプションが両方とも指定されていた場
                   合に、テキストに対して画像をどう配置するかを指定します。適当
                   な値は:
                   
                      * text: テキストのみ表示する
                   
                      * image: 画像のみ表示する
                   
                      * top, bottom, left, right: それぞれ画像をテキストの上、下
                        、左、右に配置する。
                   
                      * none: デフォルト。もしあれば画像を表示し、そうでなければ
                        テキストを表示する。
                   
                   
幅                 0 より大きい場合、テキストラベルを作成するのにどれくらいのス
                   ペースを使うかを文字の幅で指定します。0 より小さい場合、最小
                   の幅が指定されます。0 もしくは無指定の場合、テキストラベルに
                   対して自然な幅が使われます。
                   


File: python.info,  Node: Compatibility options,  Next: Widget states,  Prev: Label options,  Up: ウィジェット

5.26.8.7 Compatibility options
..............................

オプション   説明
             
----------------------------------------------------------------------------------
             
state        "normal" か "disabled" に設定され、 "disabled" 状態のビットをコン
             トロールします。これは書き込み専用のオプションです: これを設定する
             とウィジェットの状態を変更できますが、 *note Widget.state(): 449a.
             メソッドはこのオプションに影響を及ぼしません。
             


File: python.info,  Node: Widget states,  Next: ttk Widget,  Prev: Compatibility options,  Up: ウィジェット

5.26.8.8 Widget states
......................

ウィジェットの状態は独立した状態フラグのビットマップです。

Flag             説明
                 
-----------------------------------------------------------------------------------
                 
active           マウスカーソルがウィジェットの上にあり、マウスのボタンをクリッ
                 クすることで何らかの動作をさせられます
                 
                 
disabled         プログラムによってウィジェットは無効化されています
                 
                 
focus            ウィジェットにキーボードフォーカスがあります
                 
                 
pressed          ウィジェットは押されています
                 
                 
selected         チェックボタンやラジオボタンのようなウィジェットでの "オン" や
                 "チェック有" や "選択中" に当たります
                 
                 
background       Windows と Mac には "アクティブな" もしくは最前面のウィンドウと
                 いう概念があります。背面のウィンドウにあるウィジェットには
                 'background' 状態が設定され、最前面のウィンドウにあるウィジェッ
                 トでは解除されます
                 
                 
readonly         ウィジェットはユーザからの変更を受け付けません
                 
                 
alternate        ウィジェット特有の切り替え表示になっています
                 
                 
invalid          ウィジェットの値が不正です
                 

状態仕様は状態名の並びになっていて、状態名の先頭にはビットがオフになって
いることを示す感嘆符が付くことがあります。


File: python.info,  Node: ttk Widget,  Prev: Widget states,  Up: ウィジェット

5.26.8.9 ttk.Widget
...................

Besides the methods described below, the *note ttk.Widget: 46ef.
supports the methods *note tkinter.Widget.cget: 43c4. and *note
tkinter.Widget.configure: 439c.

 -- クラス: 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' が指定されていない場合、現在の状態フラグを返します
          。

          Not to be confused with *note Wm.state: 4499.

     通常 'statespec' はリストもしくはタプルです。


File: python.info,  Node: コンボボックス,  Next: Spinbox,  Prev: ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.10 コンボボックス
........................

The *note ttk.Combobox: 46eb. widget combines a text field with a
pop-down list of values.  This widget is a subclass of *note Entry:
43d9.

Besides the methods inherited from *note Widget: 46ef.: *note cget():
43c4, *note configure(): 439c, *note identify(): 46f8, *note instate():
46f9. and *note state(): 449a, and the following inherited from *note
Entry: 43d9.: *note bbox(): 46fb, *note delete(): 4526, *note icursor():
4529, *note index(): 452a, *note insert(): 4528, *note selection*: 452c,
*note xview*: 44d0, it has some other methods, described at *note
ttk.Combobox: 46eb.

* Menu:

* オプション::
* 仮想イベント::
* ttk.Combobox: ttk Combobox.


File: python.info,  Node: オプション,  Next: 仮想イベント,  Up: コンボボックス

5.26.8.11 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション            説明
                      
-----------------------------------------------------------------------------------
                      
exportselection       Boolean value.  If set, the widget selection is linked to
                      the X selection (which can be returned by invoking
                      Misc.selection_get, for example).
                      
                      
justify               ウィジェットの中でテキストをどう配置するかを指定します。
                      "left", "center", "right" のうちのどれか 1 つです。
                      
                      
高さ                  ポップダウンリストの高さを行数で指定します。
                      
                      
postcommand           コンボボックスの値を表示する直前に呼び出される、
                      (Misc.register などで登録した) スクリプトです。どの値を表
                      示するかについても指定できます。
                      
                      
state                 One of "normal", "readonly", or "disabled".  In the
                      "readonly" state, the value may not be edited directly,
                      and the user can only select one of the values from the
                      dropdown list.  In the "normal" state, the text field is
                      directly editable.  In the "disabled" state, no
                      interaction is possible.
                      
                      
textvariable          コンボボックスの値とリンクさせる変数名を指定します。その変
                      数の値が変更されたとき、ウィジェットの値は更新されます。ウ
                      ィジェットの値が更新されたときも同様です。
                      *note tkinter.StringVar: 43af. を参照してください。
                      
                      
‘values’              ドロップダウンリストに表示する値のリストを指定します。
                      
                      
幅                    入力ウィンドウに必要な幅をウィジェットのフォントの平均的な
                      サイズの文字で測った、文字数を指定します。
                      

     注釈: Tk 9.1 added the 'locale' option, which selects the locale
     used to determine word and character boundaries within the text
     (‘"C"’ by default).


File: python.info,  Node: 仮想イベント,  Next: ttk Combobox,  Prev: オプション,  Up: コンボボックス

5.26.8.12 仮想イベント
......................

コンボボックスウィジェットは、ユーザが値のリストから1つ選んだときに仮想
イベント '<<ComboboxSelected>>' を生成します。


File: python.info,  Node: ttk Combobox,  Prev: 仮想イベント,  Up: コンボボックス

5.26.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.26.8.14 Spinbox
.................

The *note ttk.Spinbox: d91. widget is a *note ttk.Entry: 43d9. enhanced
with increment and decrement arrows.  It can be used for numbers or
lists of string values.  This widget is a subclass of ‘Entry’.  Besides
the methods inherited from *note Widget: 46ef.: *note cget(): 43c4,
*note configure(): 439c, *note identify(): 46f8, *note instate(): 46f9.
and *note state(): 449a, and the following inherited from ‘Entry’: *note
bbox(): 46fb, *note delete(): 4526, *note icursor(): 4529, *note
index(): 452a, *note insert(): 4528, *note xview*: 44d0, it has some
other methods, described at ‘ttk.Spinbox’.

* Menu:

* オプション: オプション<2>.
* 仮想イベント: 仮想イベント<2>.
* ttk.Spinbox: ttk Spinbox.


File: python.info,  Node: オプション<2>,  Next: 仮想イベント<2>,  Up: Spinbox

5.26.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.26.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.26.8.17 ttk.Spinbox
.....................

 -- クラス: tkinter.ttk.Spinbox

     With a non-integer increment, see *note numeric values and the
     locale: 4582.

     Added in version 3.8.

      -- メソッド: 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.26.8.18 ノートブック
......................

ノートブックウィジェットは複数のウィンドウを管理し、同時に 1 つのウィン
ドウを表示します。それぞれの子ウィンドウはタブの関連付けられていて、ユー
ザはそれを選択して表示されているウィンドウを切り替えます。

* Menu:

* オプション: オプション<3>.
* Tab options::
* Tab identifiers::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.


File: python.info,  Node: オプション<3>,  Next: Tab options,  Up: ノートブック

5.26.8.19 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション    説明
              
-----------------------------------------------------------------------------------
              
高さ          0 より大きな値が設定されている場合、 (内部のパディングやタブを含ま
              ない) ペイン領域に必要な高さを指定します。設定されていない場合、全
              てのペインの高さの最大値が使われます。
              
              
padding       ノートブックの外周に付け足す追加の領域の量を指定します。パディング
              は最大 4 個の長さ指定のリストです: 左、上、右、下の順で指定します
              。4 個より少ない場合、デフォルトで下は上と、右は左と、上は左と同じ
              値が、それぞれ使われます。
              
              
幅            0 より大きな値が指定されている場合、(内部のパディングを含まない) ペ
              イン領域に必要な幅を指定します。設定されていない場合、全てのペイン
              の幅の最大値が使われます。
              


File: python.info,  Node: Tab options,  Next: Tab identifiers,  Prev: オプション<3>,  Up: ノートブック

5.26.8.20 Tab options
.....................

タブ用のオプションもあります:

オプション      説明
                
-----------------------------------------------------------------------------------
                
state           "normal", "disabled", "hidden" のうちどれか 1 つです。
                "disabled" の場合、タブは選択することができません。 "hidden" の
                場合、タブは表示されません。
                
                
sticky          Specifies how the child window is positioned within the pane
                area.  Value is a string containing zero or more of the
                characters "n", "s", "e" or "w".  Each letter refers to a side
                (north, south, east or west) that the child window will stick
                to, as per the *note grid: 4393. geometry manager.
                
                
padding         ノートブックとこのペインの間に付け足す追加の領域の量を指定します
                。文法はこのウィジェットの padding オプションと同じです。
                
                
text            タブに表示するテキストを指定します。
                
                
image           タブに表示する画像を指定します。 *note Widget: 46ef. のオプショ
                ン image の説明を参照してください。
                
                
compound        text オプションと image オプションが両方指定されているときにテキ
                ストに対して画像をどう表示するかを指定します。指定する値について
                は *note Label Options: 46f4. を参照してください。
                
                
underline       テキスト中の下線を引く文字のインデックス (0 基点) を指定します。
                *note Notebook.enable_traversal(): 470b. が呼ばれていた場合、下
                線が引かれた文字はショートカットとして使われます。
                


File: python.info,  Node: Tab identifiers,  Next: 仮想イベント<3>,  Prev: Tab options,  Up: ノートブック

5.26.8.21 Tab identifiers
.........................

The tab_id present in several methods of *note ttk.Notebook: 44a7. may
take any of the following forms:

   * 0 からタブの数の間の整数

   * 子ウィンドウの名前

   * タブを指し示す "@x,y" という形式の位置指定

   * 現在選択されているタブを指し示すリテラル文字列 "current"

   * タブ数を返すリテラル文字列 "end" (*note Notebook.index(): 470d. で
     のみ有効)


File: python.info,  Node: 仮想イベント<3>,  Next: ttk Notebook,  Prev: Tab identifiers,  Up: ノートブック

5.26.8.22 仮想イベント
......................

このウィジェットは新しいタブが選択された後に仮想イベント
'<<NotebookTabChanged>>' を生成します。


File: python.info,  Node: ttk Notebook,  Prev: 仮想イベント<3>,  Up: ノートブック

5.26.8.23 ttk.Notebook
......................

 -- クラス: tkinter.ttk.Notebook

      -- メソッド: add (child, **kw)

          ノートブックに新しいタブを追加します。

          ウィンドウが現在ノートブックによって管理されているが隠れている
          場合、以前の位置に復元します。

          利用可能なオプションのリストについては *note Tab Options:
          470a. を参照してください。

      -- メソッド: forget (tab_id)

          'tab_id' で指定されたタブを削除します。関連付けられていたウィ
          ンドウは切り離され、管理対象でなくなります。

          This shadows the inherited geometry-manager ‘forget()’; use
          *note pack_forget(): 44a5, *note grid_forget(): 44bd. or *note
          place_forget(): 44b4. to remove the widget itself from its
          manager.

      -- メソッド: hide (tab_id)

          'tab_id' で指定されたタブを隠します。

          タブは表示されませんが、関連付いているウィンドウはノートブック
          によって保持されていて、その設定も記憶されています。隠れたタブ
          は *note add(): 4710. コマンドで復元できます。

      -- メソッド: identify (x, y)

          'x' 'y' の位置にあるタブの名前を、そこにタブが無ければ空文字列
          を返します。

      -- メソッド: index (tab_id)

          'tab_id' で指定されたタブのインデックスを、 'tab_id' が文字列
          の "end" だった場合はタブの総数を返します。

      -- メソッド: insert (pos, child, **kw)

          指定された位置にペインを挿入します。

          'pos' は文字列の "end" か整数のインデックスか管理されている子
          ウィンドウの名前です。 'child' が既にノートブックの管理対象だ
          った場合、指定された場所に移動させます。

          利用可能なオプションのリストについては *note Tab Options:
          470a. を参照してください。

      -- メソッド: select (tab_id=None)

          指定された 'tab_id' を選択します。

          関連付いている子ウィンドウは表示され、直前に選択されていたウィ
          ンドウは (もし異なれば) 表示されなくなります。 'tab_id' が指定
          されていない場合は、現在選択されているペインのウィジェット名を
          返します。

      -- メソッド: tab (tab_id, option=None, **kw)

          指定された 'tab_id' のオプションを問い合わせたり、変更したりし
          ます。

          'kw' が与えられなかった場合、タブのオプション値の辞書を返しま
          す。 'option' が指定されていた場合、その 'option' の値を返しま
          す。それ以外の場合は、オプションに対応する値が設定されます。

      -- メソッド: tabs ()

          Returns a tuple of windows managed by the notebook.

      -- メソッド: enable_traversal ()

          このノートブックを含む最上位にあるウィンドウでのキーボード移動
          を可能にします。

          これによりノートブックを含んだ最上位にあるウィンドウに対し、以
          下のキーバインディングが追加されます:

             * ‘Control’-‘Tab’: 現在選択されているタブの 1 つ次のタブを
               選択します。

             * ‘Shift’-‘Control’-‘Tab’: 現在選択されているタブの 1 つ前
               のタブを選択します。

             * ‘Alt’-‘K’: 'K' があるタブの (下線が引かれた) ショートカッ
               トキーだとして、そのタブを選択します。

          Multiple notebooks in a single toplevel may be enabled for
          traversal, including nested notebooks.  However, notebook
          traversal only works properly if all panes are direct children
          of the notebook.


File: python.info,  Node: プログレスバー,  Next: セパレータ,  Prev: ノートブック,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.24 プログレスバー
........................

The *note ttk.Progressbar: 46ec. widget shows the status of a
long-running operation.  It can operate in two modes: 1) the determinate
mode which shows the amount completed relative to the total amount of
work to be done and 2) the indeterminate mode which provides an animated
display to let the user know that work is progressing.

* Menu:

* オプション: オプション<4>.
* ttk.Progressbar: ttk Progressbar.


File: python.info,  Node: オプション<4>,  Next: ttk Progressbar,  Up: プログレスバー

5.26.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.26.8.26 ttk.Progressbar
.........................

 -- クラス: tkinter.ttk.Progressbar

      -- メソッド: start (interval=None)

          自動増加モードを開始します: 'interval' ミリ秒ごとに *note
          Progressbar.step(): 471c. を繰り返し呼び出すタイマーイベントを
          設定します。引数で指定しない場合は、 'interval' はデフォルトで
          50 ミリ秒になります。

      -- メソッド: step (amount=None)

          プログレスバーの値を 'amount' だけ増加させます。

          引数で指定しない場合は、 'amount' はデフォルトで 1.0 になりま
          す。

      -- メソッド: stop ()

          自動増加モードを停止します: このプログレスバーの *note
          Progressbar.start(): 471b. で開始された繰り返しのタイマーイベ
          ントを全てキャンセルします。


File: python.info,  Node: セパレータ,  Next: サイズグリップ,  Prev: プログレスバー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.27 セパレータ
....................

The *note ttk.Separator: 46ed. widget displays a horizontal or vertical
separator bar.

It has no other methods besides the ones inherited from *note
ttk.Widget: 46ef.

* Menu:

* オプション: オプション<5>.


File: python.info,  Node: オプション<5>,  Up: セパレータ

5.26.8.28 オプション
....................

このウィジェットは次の特定のオプションを受け付けます。

オプション   説明
             
----------------------------------------------------------------------------------
             
orient       "horizontal" か "vertical" のいずれかです。セパレータの方向を指定
             します。
             


File: python.info,  Node: サイズグリップ,  Next: ツリービュー,  Prev: セパレータ,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.29 サイズグリップ
........................

The *note ttk.Sizegrip: 46ee. widget (also known as a grow box) allows
the user to resize the containing toplevel window by pressing and
dragging the grip.

This widget has neither specific options nor specific methods, besides
the ones inherited from *note ttk.Widget: 46ef.

* Menu:

* プラットフォーム固有のメモ::
* バグ::


File: python.info,  Node: プラットフォーム固有のメモ,  Next: バグ,  Up: サイズグリップ

5.26.8.30 プラットフォーム固有のメモ
....................................

   * macOS では、最上位のウィンドウにはデフォルトで組み込みのサイズグリ
     ップが含まれています。組み込みのグリップが *note Sizegrip: 46ee. を
     隠してしまうので、 ‘Sizegrip’ を追加しても問題ありません。


File: python.info,  Node: バグ,  Prev: プラットフォーム固有のメモ,  Up: サイズグリップ

5.26.8.31 バグ
..............

   * If the containing toplevel's position was specified relative to the
     right or bottom of the screen (for example, ....), the *note
     Sizegrip: 46ee. widget will not resize the window.

   * このウィジェットは "南東" 方向のサイズ変更しかサポートしていません
     。


File: python.info,  Node: ツリービュー,  Next: Ttk styling,  Prev: サイズグリップ,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.32 ツリービュー
......................

The *note ttk.Treeview: c8b. widget displays a hierarchical collection
of items.  Each item has a textual label, an optional image, and an
optional list of data values.  The data values are displayed in
successive columns after the tree label.

データが表示される順序はウィジェットの ‘displaycolumns’ オプションで制御
されます。ツリーウィジェットはカラムヘッダを表示することもできます。カラ
ムには数字もしくはウィジェットの columns オプションにある名前でアクセス
できます。 *note Column Identifiers: 4724. を参照してください。

それぞれの要素は一意な名前で識別されます。要素の作成時に識別子が与えられ
なかった場合、ウィジェットが要素の識別子を生成します。このウィジェットに
は ‘{}’ という名前の特別なルート要素があります。ルート要素自身は表示され
ません; その子要素たちが階層の最上位に現れます。

それぞれの要素はタグのリストも持っていて、イベントバインディングと個別の
要素を関連付け、要素の見た目を管理するのに使えます。

ツリービューウィジェットは水平方向と垂直方向のスクロールをサポートしてい
て、 *note Scrollable Widget Options: 46f3. に記述してあるオプションと
*note Treeview.xview(): 4725. メソッドおよび *note Treeview.yview():
4726. メソッドが使えます。

* Menu:

* オプション: オプション<6>.
* Item options::
* Tag options::
* Column identifiers::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.


File: python.info,  Node: オプション<6>,  Next: Item options,  Up: ツリービュー

5.26.8.33 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション           説明
                     
----------------------------------------------------------------------------------
                     
columns              カラム数とその名前を指定するカラム識別子のリストです。
                     
                     
displaycolumns       どのデータカラムをどの順序で表示するかを指定する、 (名前も
                     しくは整数のインデックスの) カラム識別子のリストか、文字列
                     "#all" です。
                     
                     
高さ                 表示する行数を指定します。メモ: 表示に必要な幅はカラム幅の
                     合計から決定されます。
                     
                     
padding              ウィジェットの内部のパディングのサイズを指定します。パディ
                     ングは最大 4 個の長さ指定のリストです。
                     
                     
selectmode           組み込みのクラスバインディングが選択状態をどう管理するかを
                     指定します。設定する値は "extended", "browse", "none" のど
                     れか 1 つです。 "extended" に設定した場合 (デフォルト)、複
                     数の要素が選択できます。 "browse" に設定した場合、同時に 1
                     つの要素しか選択できません。 "none" に設定した場合、選択を
                     変更することはできません。
                     
                     このオプションの値によらず、アプリケーションのコードと関連
                     付けられているタグからは好きなように選択状態を設定できます
                     。
                     
                     
show                 ツリーのどの要素を表示するかを指定する、以下にある値を 0 個
                     以上含むリストです。
                     
                        * tree: カラム #0 にツリーのラベルを表示します。
                     
                        * headings: ヘッダ行を表示します。
                     
                     The default is "tree headings", that is, show all
                     elements.
                     
                     'メモ': show="tree" が指定されていない場合でも、カラム #0
                     は常にツリーカラムを参照します。
                     

     注釈: Tk 9.0 added several *note Treeview: c8b. features.  The
     'selectmode' option gained the values ‘"single"’ and ‘"multiple"’;
     the new widget options 'selecttype' (‘"item"’ or ‘"cell"’
     selection), 'striped' (zebra-striped rows), and 'titlecolumns' /
     'titleitems' (columns or rows frozen against scrolling) were
     introduced; and items gained a 'hidden' option.  Tk 9.1 added the
     'rowheight' and 'headingheight' options.


File: python.info,  Node: Item options,  Next: Tag options,  Prev: オプション<6>,  Up: ツリービュー

5.26.8.34 Item options
......................

以下の要素オプションは、ウィジェットの insert コマンドと item コマンドで
要素に対して指定できます。

オプション   説明
             
---------------------------------------------------------------------------------
             
text         アイテムに表示するテキストラベルです。
             
             
image        ラベルの左に表示される Tk 画像です。
             
             
‘values’     要素に関連付けられている値のリストです。
             
             それぞれの要素はウィジェットの columns オプションと同じ数の値を持
             たなければいけません。 columns オプションより少ない場合、残りの値
             は空として扱われます。 columns オプションより多い場合、余計な値は
             無視されます。
             
             
open         要素の子供を表示するか隠すかを指示する ‘True’/‘False’ 値です。
             
             
tags         この要素に関連付いているタグのリストです。
             


File: python.info,  Node: Tag options,  Next: Column identifiers,  Prev: Item options,  Up: ツリービュー

5.26.8.35 Tag options
.....................

以下のオプションはタグに対して設定できます:

オプション       説明
                 
---------------------------------------------------------------------------------
                 
foreground       テキストの色を指定します。
                 
                 
background       セルや要素の背景色を指定します。
                 
                 
font             テキストを描画するときに使うフォントを指定します。
                 
                 
image            要素の image オプションが空だった場合に使用する画像を指定しま
                 す。
                 


File: python.info,  Node: Column identifiers,  Next: 仮想イベント<4>,  Prev: Tag options,  Up: ツリービュー

5.26.8.36 Column identifiers
............................

カラム識別子は以下のいずれかの形式を取ります:

   * 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: Column identifiers,  Up: ツリービュー

5.26.8.37 仮想イベント
......................

ツリービューは以下の仮想イベントを生成します。

Event                    説明
                         
--------------------------------------------------------------------------------
                         
<<TreeviewSelect>>       選択状態が変更されたときに生成されます。
                         
                         
<<TreeviewOpen>>         フォーカスが当たっている要素に open=True が設定され
                         る直前に生成されます。
                         
                         
<<TreeviewClose>>        フォーカスが当たっている要素に open=False が設定され
                         た直後に生成されます。
                         

*note Treeview.focus(): 472b. メソッドと *note Treeview.selection():
c8a. メソッドは変更を受けた要素を判別するのに使えます。


File: python.info,  Node: ttk Treeview,  Prev: 仮想イベント<4>,  Up: ツリービュー

5.26.8.38 ttk.Treeview
......................

 -- クラス: tkinter.ttk.Treeview

      -- メソッド: bbox (item, column=None)

          (ツリービューウィジェットのウィンドウを基準として) 指定された
          'item' のバウンディングボックス情報を (x 座標, y 座標, 幅, 高
          さ) の形式で返します。

          If 'column' is specified, returns the bounding box of that
          cell.  If the 'item' is not visible (that is, if it is a
          descendant of a closed item or is scrolled offscreen), returns
          an empty string.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: get_children (item=None)

          Returns a tuple of children belonging to 'item'.

          'item' が指定されていなかった場合は、ルート要素の子供が返され
          ます。

      -- メソッド: set_children (item, *newchildren)

          Replaces 'item"s children with '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)

          Returns ‘True’ if the specified 'item' is present in the tree,
          ‘False’ otherwise.

      -- メソッド: focus (item=None)

          'item' が指定されていた場合は、 'item' にフォーカスを当てます
          。そうでない場合は、現在フォーカスが当たっている要素が、どの要
          素にもフォーカスが当たっていない場合は '' が返されます。

          This shadows the inherited ‘Misc.focus()’; use *note
          focus_set(): 43ff. to focus the widget itself.

      -- メソッド: 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)

          Returns the display column identifier of the cell at position
          '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: 4728. 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' が切り離された状態の場
          合は、再度取り付けられます。

          *note reattach(): 473d. is an alias of ‘move()’.

      -- メソッド: next (item)

          'item' の 1 つ下の兄弟の識別子を、 'item' が親にとって一番下の
          子供だった場合 '' を返します。

      -- メソッド: parent (item)

          'item' の親の識別子を、 'item' が階層の最上位にいた場合 '' を
          返します。

      -- メソッド: prev (item)

          'item' の 1 つ上の兄弟の識別子を、 'item' が親にとって一番上の
          子供だった場合 '' を返します。

      -- メソッド: 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)

          If 'item' is specified, returns ‘True’ if the specified 'item'
          has the given 'tagname' and ‘False’ otherwise.  Otherwise,
          returns a tuple of all items that have the specified tag.

          使用可能バージョン: Tk 8.6

      -- メソッド: xview (*args)

          ツリービューの水平方向の位置を問い合わせたり、変更したりします
          。

      -- メソッド: yview (*args)

          ツリービューの垂直方向の位置を問い合わせたり、変更したりします
          。


File: python.info,  Node: Ttk styling,  Next: Additional widgets,  Prev: ツリービュー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.39 Ttk styling
.....................

Each widget in ‘ttk’ is assigned a style, which specifies the set of
elements making up the widget and how they are arranged, along with
dynamic and default settings for element options.  By default the style
name is the same as the widget's class name, but it may be overridden by
the widget's style option.  If you don't know the class name of a
widget, use the method *note Misc.winfo_class: 4433.
(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')]’ に変更した場合、ウィジェットがアクティブ
          もしくは押された状態のとき前面が青くなります。

          When called to query the map (without specifying values to
          set), it returns a dictionary mapping each option to its list
          of statespecs.

          バージョン 3.10 で変更: The value returned when querying the
          map was corrected.

      -- メソッド: 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: 474e. で説明されているフォーマットである必要がありま
          す。

          フォーマットを理解するために以下の例を見てください (何かを使い
          易くするための例ではありません):

               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', ‘element_create()’
          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 ()

          Returns a tuple of elements defined in the current theme.

      -- メソッド: element_options (elementname)

          Returns a tuple of 'elementname"s options.

      -- メソッド: theme_create (themename, parent=None, settings=None)

          新しいテーマを作成します。

          'themename' が既に存在していた場合はエラーになります。
          'parent' が指定されていた場合は、新しいテーマは親テーマからス
          タイルや要素やレイアウトを継承します。 'settings' が指定された
          場合は、 *note theme_settings(): 4752. で使われるのと同じ形式
          である必要があります。

      -- メソッド: theme_settings (themename, settings)

          一時的に現在のテーマを 'themename' に設定し、指定された
          'settings' を適用した後、元のテーマを復元します。

          'settings' のそれぞれのキーはスタイル名で値はさらに
          'configure', 'map', 'layout', 'element create' をキーとして持
          ち、その値はそれぞれ *note Style.configure(): 474b, *note
          Style.map(): 1d44, *note Style.layout(): 474d, *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 ()

          Returns a tuple of all known themes.

      -- メソッド: theme_use (themename=None)

          'themename' が与えられなかった場合は、現在使用中のテーマ名を返
          します。そうでない場合は、現在のテーマを 'themename' に設定し
          、全てのウィジェットを再描画し、 <<ThemeChanged>> イベントを発
          生させます。

* Menu:

* レイアウト::

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/tile-tcl2004.pdf


File: python.info,  Node: レイアウト,  Up: Ttk styling

5.26.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(): 46f8. などには要素とそ
     の子で単一の要素として扱われます。これは、グリップのついたスクロー
     ルバーサムのようなものに使われます。

'children': [sublayout... ]

     要素の内部に配置する要素のリストを指定します。リストのそれぞれの要
     素はタプル (もしくは他のシーケンス型) で、それの 1 番目の要素はレイ
     アウト名でそれ以降は *note Layout: 474e. です。


File: python.info,  Node: Additional widgets,  Prev: Ttk styling,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.26.8.41 Additional widgets
............................

The following themed widgets complete the ‘tkinter.ttk’ widget set.
Each is the themed counterpart of the like-named classic *note tkinter:
f6. widget and inherits the common methods of *note Widget: 46ef.

 -- クラス: tkinter.ttk.Button (master=None, **kw)

     Ttk ‘Button’ widget, displays a textual label and/or image, and
     evaluates a command when pressed.  It is the themed counterpart of
     *note tkinter.Button: 44d9. and inherits the common widget methods
     from *note Widget: 46ef.

      -- メソッド: invoke ()

          Invoke the command associated with the button and return its
          result.

 -- クラス: tkinter.ttk.Checkbutton (master=None, **kw)

     Ttk ‘Checkbutton’ widget, used to control a boolean variable that
     is toggled on and off.  It is the themed counterpart of *note
     tkinter.Checkbutton: 1a24. and inherits the common widget methods
     from *note Widget: 46ef.

      -- メソッド: invoke ()

          Toggle the button between its selected and deselected states,
          invoke the command associated with the button, and return its
          result.

 -- クラス: tkinter.ttk.Entry (master=None, widget=None, **kw)

     Ttk ‘Entry’ widget, displays a one-line text string and allows the
     user to edit it.  It is the themed counterpart of *note
     tkinter.Entry: 440e. and inherits the common widget methods from
     *note Widget: 46ef. as well as the editing methods from
     ‘tkinter.Entry’.

      -- メソッド: bbox (index)

          Return a tuple ‘(x, y, width, height)’ giving the bounding box
          of the character at the given 'index'.

          This shadows the inherited ‘Misc.bbox()’; use *note
          grid_bbox(): 43d6. for the grid bounding box.

      -- メソッド: identify (x, y)

          Return the name of the element under the point given by 'x'
          and 'y', or the empty string if no element is present at that
          location.

      -- メソッド: validate ()

          Force validation of the entry and return ‘True’ if validation
          succeeded, and ‘False’ otherwise.

 -- クラス: tkinter.ttk.Frame (master=None, **kw)

     Ttk ‘Frame’ widget, a container used to group and lay out other
     widgets.  It is the themed counterpart of *note tkinter.Frame:
     4426. and inherits the common widget methods from *note Widget:
     46ef.

 -- クラス: tkinter.ttk.Label (master=None, **kw)

     Ttk ‘Label’ widget, displays a textual label and/or image.  It is
     the themed counterpart of *note tkinter.Label: 44da. and inherits
     the common widget methods from *note Widget: 46ef.

 -- クラス: tkinter.ttk.Labelframe (master=None, **kw)

     Ttk ‘Labelframe’ widget, a container that draws a border and a
     title label around its contents.  It is the themed counterpart of
     *note tkinter.LabelFrame: 4489. and inherits the common widget
     methods from *note Widget: 46ef.

 -- クラス: tkinter.ttk.Menubutton (master=None, **kw)

     Ttk ‘Menubutton’ widget, displays a textual label and/or image, and
     pops up a menu when pressed.  It is the themed counterpart of *note
     tkinter.Menubutton: 4568. and inherits the common widget methods
     from *note Widget: 46ef.

 -- クラス: tkinter.ttk.OptionMenu (master, variable, default=None,
          *values, **kwargs)

     Ttk ‘OptionMenu’ widget, a *note Menubutton: 46e6. that pops up a
     menu of mutually exclusive choices.  'variable' is the variable
     that tracks the currently selected value, 'default' is the value to
     set initially, and 'values' are the entries to display in the menu.
     A 'command' keyword argument may be given to specify a callable
     that is invoked with the selected value whenever the selection
     changes; the 'style' keyword argument sets the style used by the
     underlying menubutton; and the 'name' keyword argument sets the Tk
     widget name.

      -- メソッド: set_menu (default=None, *values)

          Replace the entries of the menu with 'values'.  If 'default'
          is given, also set it as the current value of the 'variable'.

      -- メソッド: destroy ()

          Destroy this widget and its associated menu.

     バージョン 3.14 で変更: Added support for the 'name' keyword
     argument.

 -- クラス: tkinter.ttk.Panedwindow (master=None, **kw)

     Ttk ‘Panedwindow’ widget, displays a number of subwindows stacked
     either vertically or horizontally.  The user may adjust the
     relative sizes of the subwindows by dragging the sash between
     panes.  It is the themed counterpart of *note tkinter.PanedWindow:
     44a6. and inherits the common widget methods from *note Widget:
     46ef, as well as the ‘add()’ and ‘panes()’ methods from
     ‘tkinter.PanedWindow’.

      -- メソッド: insert (pos, child, **kw)

          Insert a pane containing 'child' at the position 'pos'.  'pos'
          is either the string ‘'end'’, an integer index, or the name of
          a managed subwindow.  If 'child' is already managed by the
          paned window, move it to the specified position.  Any keyword
          arguments set pane options.

      -- メソッド: forget (child)

          Remove 'child', which may be either an integer index or the
          name of a managed subwindow, from the panes.

          This shadows the inherited geometry-manager ‘forget()’; use
          *note pack_forget(): 44a5, *note grid_forget(): 44bd. or *note
          place_forget(): 44b4. to remove the widget itself from its
          manager.

      -- メソッド: pane (pane, option=None, **kw)

          Query or modify the options of the specified 'pane', where
          'pane' is either an integer index or the name of a managed
          subwindow.  If no arguments are given, return a dictionary of
          the pane option values.  If 'option' is specified, return the
          value of that option.  Otherwise, set the options given as
          keyword arguments to their corresponding values.

      -- メソッド: sashpos (index, newpos=None)

          If 'newpos' is specified, set the position of sash number
          'index' and return its new position.  This may adjust the
          positions of adjacent sashes to ensure that positions are
          monotonically increasing; positions are also constrained to be
          between 0 and the total size of the widget.  If 'newpos' is
          omitted, return the current position of the sash.

 -- クラス: tkinter.ttk.Radiobutton (master=None, **kw)

     Ttk ‘Radiobutton’ widget, used as part of a group to control a
     single shared variable by selecting one of several mutually
     exclusive values.  It is the themed counterpart of *note
     tkinter.Radiobutton: 457c. and inherits the common widget methods
     from *note Widget: 46ef.

      -- メソッド: invoke ()

          Set the option variable to the button's value, select the
          button, invoke the command associated with the button, and
          return its result.

 -- クラス: tkinter.ttk.Scale (master=None, **kw)

     Ttk ‘Scale’ widget, displays a slider that lets the user select a
     numeric value from a range by moving the slider along a trough.  It
     is the themed counterpart of *note tkinter.Scale: 4581. and
     inherits the common widget methods from *note Widget: 46ef.

      -- メソッド: configure (cnf=None, **kw)

          Modify or query the widget options, like *note
          Widget.configure: 439c.  In addition, this method clips the
          ‘from’ and ‘to’ values so that the current value stays within
          the range defined by them.

          バージョン 3.9 で変更: Now returns the configuration value,
          like *note Widget.configure: 439c.

      -- メソッド: get (x=None, y=None)

          Return the current value of the scale.  If 'x' and 'y' are
          given, return the value corresponding to the pixel coordinate
          'x', 'y' instead.

 -- クラス: tkinter.ttk.Scrollbar (master=None, **kw)

     Ttk ‘Scrollbar’ widget, controls the viewport of an associated
     scrollable widget such as a *note Treeview: c8b, *note Entry: 43d9.
     or *note tkinter.Text: 1a58.  It is the themed counterpart of *note
     tkinter.Scrollbar: 44d1. and inherits the common widget methods
     from *note Widget: 46ef, as well as the ‘set()’ and ‘get()’ methods
     from ‘tkinter.Scrollbar’.

 -- クラス: tkinter.ttk.Separator (master=None, **kw)

     Ttk ‘Separator’ widget, displays a horizontal or vertical separator
     line.  It has no direct counterpart in *note tkinter: f6. and
     inherits the common widget methods from *note Widget: 46ef.

 -- クラス: tkinter.ttk.Sizegrip (master=None, **kw)

     Ttk ‘Sizegrip’ widget, displays a grip that allows the user to
     resize the containing toplevel window by pressing and dragging the
     grip, typically placed in the bottom-right corner.  It has no
     direct counterpart in *note tkinter: f6. and inherits the common
     widget methods from *note Widget: 46ef.

 -- クラス: tkinter.ttk.LabeledScale (master=None, variable=None,
          from_=0, to=10, **kw)

     A *note Frame: 4397. containing a *note Scale: 46e8. and a *note
     Label: 4398. that shows the scale's current value.  'variable' is
     the *note IntVar: 43b0. tracked by the scale (one is created if it
     is not given), and 'from_' and 'to' define the range of the scale.

      -- メソッド: destroy ()

          Destroy this widget and remove the trace callback registered
          on the associated variable.

 -- クラス: tkinter.ttk.LabelFrame (master=None, **kw)

     Alias of *note Labelframe: 475a, kept for naming compatibility with
     *note tkinter.LabelFrame: 4489.

 -- クラス: tkinter.ttk.PanedWindow (master=None, **kw)

     Alias of *note Panedwindow: 475e, kept for naming compatibility
     with *note tkinter.PanedWindow: 44a6.


File: python.info,  Node: IDLE --- Python のエディタとシェル<2>,  Next: turtle --- Turtle graphics,  Prev: tkinter ttk --- Tk のテーマ付きウィジェット,  Up: Graphical user interfaces with Tk

5.26.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: 21b4.  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
オプションのモジュールの要件: 21b2.

* 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.26.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.26.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.26.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: 476d. 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: 476e. 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.26.9.4 Format メニュー (Shell ウィンドウ、Editor ウィンドウ)
..............................................................

Format Paragraph [パラグラフのフォーマット]

     Rewrap the text block containing the text insert cursor.  Avoid
     code lines.  See *note Format block: 4771. 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(): 16cf. 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.26.9.5 Run メニュー (Editor ウィンドウのみ)
.............................................

Run Module [モジュールの実行]

     *note Check Module: 4774. を実行します。エラーがなければ Shell の環
     境をクリーンにして再スタートした上で、モジュールを実行します。出力
     は Shell ウィンドウに表示されます。‘print’ や ‘write’ しない限り、
     この出力はされません。モジュール実行が完了すると Shell はフォーカス
     された状態のままで、プロンプトを表示します。これにより対話的に実行
     結果を調べることができます。この機能は、コマンドラインからファイル
     を ‘python -i file’ で実行することに相当します。

Run... Customized

     Same as *note Run Module: 4773, but run the module with customized
     settings.  'Command Line Arguments' extend *note sys.argv: 1480. 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.26.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.26.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.26.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: 477a. 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 コードコンテキスト: 477b. の項を参照してください。

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: 477a.).

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.26.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.26.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 ヘルプソース: 477e. の項を参照してください。


File: python.info,  Node: Context menus,  Prev: Help メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.26.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.26.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.26.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.26.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.26.9.15 自動的な字下げ
........................

ブロックの始まりの文の後、次の行は 4 つの空白 (Python Shell ウィンドウで
は、一つのタブ) で字下げされます。あるキーワード (break、return など) の
後では、次の行は字下げが解除 (dedent) されます。先頭の字下げでは、
‘Backspace’ は 4 つの空白があれば削除します。 ‘Tab’ はインデント幅に対応
する数の空白 (Python Shell ウィンドウでは一つのタブ) を挿入します。現在
、タブは Tcl/Tk の制約のため 4 つの空白に固定されています。

*note Format メニュー: 476f. の indent/dedent region コマンドも参照して
ください。


File: python.info,  Node: 検索と置換,  Next: 補完 Completions,  Prev: 自動的な字下げ,  Up: Editing and Navigation

5.26.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.26.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: 87b. or *note os.altsep: 87c. 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.26.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.26.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.26.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.26.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: 18f. 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.26.9.22 テキストの色
......................

IDLE の表示はデフォルトで白背景に黒字ですが、以下のような特別な意味を持
ったテキストには色が付きす。Shell では shell 出力、 shell エラー、ユーザ
エラー。Python コードでは Shell プロンプト内や Editor でのキーワード、組
み込みクラスや組み込み関数の名前、 ‘class’ や ‘def’ に続く名前、文字列、
そしてコメント。どんなテキストウィンドウでも、カーソル (あれば)、検索で
合致したテキスト (あれば)、そして選択されているテキストには色が付きます
。

IDLE also highlights the *note soft keywords: a11. *note match: a12,
‘case’, and *note _: a13. 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.26.9.23 Startup and Code Execution
....................................

‘-s’ オプションとともに起動すると、IDLE は環境変数 ‘IDLESTARTUP’ か
*note PYTHONSTARTUP: 1ba. で参照されているファイルを実行します。 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.26.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: 1ba.) 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.26.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.26.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(): 2668. 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.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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: 21b4.  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
オプションのモジュールの要件: 21b2.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Turtle_(robot)


File: python.info,  Node: Get started,  Next: チュートリアル<4>,  Prev: はじめに<12>,  Up: turtle --- Turtle graphics

5.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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.26.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: 47a8. 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(): 36ad.  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.26.10.11 Automatically begin and end filling
..............................................

Starting with Python 3.14, you can use the *note fill(): 2a5. *note
context manager: 1e3. instead of *note begin_fill(): 47b4. and *note
end_fill(): 47b5. 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.26.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.26.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.26.10.14 Use object-oriented turtle graphics
..............................................

参考
....

*note Explanation of the object-oriented interface: 47b9.

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:
47ba. 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.26.10.15 Turtle graphics reference
....................................

     注釈: 以下の文書では関数に対する引数リストが与えられています。メソ
     ッドでは、勿論、ここでは省略されている 'self' が第一引数になります
     。

* Menu:

* Turtle のメソッド::
* TurtleScreen/Screen のメソッド::


File: python.info,  Node: Turtle のメソッド,  Next: TurtleScreen/Screen のメソッド,  Up: Turtle graphics reference

5.26.10.16 Turtle のメソッド
............................

Turtle の動き

     移動および描画

               *note forward(): 36ad. | *note fd(): 47bd.
               *note backward(): 47be. | *note bk(): 47bf. | *note back(): 47c0.
               *note right(): 47c1. | *note rt(): 47c2.
               *note left(): 47c3. | *note lt(): 47c4.
               *note goto(): 47c5. | *note setpos(): 47c6. | *note setposition(): 47c7.
               *note teleport(): 1af8.
               *note setx(): 47c8.
               *note sety(): 47c9.
               *note setheading(): 47ca. | *note seth(): 47cb.
               *note home(): 47cc.
               *note circle(): 47cd.
               *note dot(): 47ce.
               *note stamp(): 47cf.
               *note clearstamp(): 47d0.
               *note clearstamps(): 47d1.
               *note undo(): 47d2.
               *note speed(): 47d3.

     Turtle の状態を知る

               *note position(): 47d4. | *note pos(): 47d5.
               *note towards(): 47d6.
               *note xcor(): 47d7.
               *note ycor(): 47d8.
               *note heading(): 47d9.
               *note distance(): 47da.

     設定と計測

               *note degrees(): 47db.
               *note radians(): 47dc.

Pen の制御

     描画状態

               *note pendown(): 47dd. | *note pd(): 47de. | *note down(): 47df.
               *note penup(): 47e0. | *note pu(): 47e1. | *note up(): 47e2.
               *note pensize(): 47e3. | *note width(): 47e4.
               *note pen(): 47e5.
               *note isdown(): 47e6.

     色の制御

               *note color(): 47e7.
               *note pencolor(): 47e8.
               *note fillcolor(): 47e9.

     塗りつぶし

               *note filling(): 47ea.
               *note fill(): 2a5.
               *note begin_fill(): 47b4.
               *note end_fill(): 47b5.

     さらなる描画の制御

               *note reset(): 47eb.
               *note clear(): 47ec.
               *note write(): 47ed.

タートルの状態

     可視性

               *note showturtle(): 47ee. | *note st(): 47ef.
               *note hideturtle(): 47f0. | *note ht(): 47f1.
               *note isvisible(): 47f2.

     見た目

               *note shape(): 47f3.
               *note resizemode(): 47f4.
               *note shapesize(): 47f5. | *note turtlesize(): 47f6.
               *note shearfactor(): 47f7.
               *note tiltangle(): 933.
               *note tilt(): 47f8.
               *note shapetransform(): 47f9.
               *note get_shapepoly(): 47fa.

イベントを利用する

          *note onclick(): 47fb.
          *note onrelease(): 47fc.
          *note ondrag(): 47fd.

特別な Turtle のメソッド

          *note poly(): 2a6.
          *note begin_poly(): 47fe.
          *note end_poly(): 47ff.
          *note get_poly(): 4800.
          *note clone(): 4801.
          *note getturtle(): 4802. | *note getpen(): 4803.
          *note getscreen(): 4804.
          *note setundobuffer(): 4805.
          *note undobufferentries(): 4806.


File: python.info,  Node: TurtleScreen/Screen のメソッド,  Prev: Turtle のメソッド,  Up: Turtle graphics reference

5.26.10.17 TurtleScreen/Screen のメソッド
.........................................

ウィンドウの制御

          *note bgcolor(): 4808.
          *note bgpic(): 4809.
          *note clearscreen(): 480a.
          *note resetscreen(): 480b.
          *note screensize(): 480c.
          *note setworldcoordinates(): 480d.

アニメーションの制御

          *note no_animation(): 2a7.
          *note delay(): 480e.
          *note tracer(): 480f.
          *note update(): 4810.

スクリーンイベントを利用する

          *note listen(): 4811.
          *note onkey(): 4812. | *note onkeyrelease(): 4813.
          *note onkeypress(): 4814.
          *note onclick(): 47fb. | *note onscreenclick(): 4815.
          *note ontimer(): 4816.
          *note mainloop(): 4817. | *note done(): 4818.

設定と特殊なメソッド

          *note mode(): 4819.
          *note colormode(): 481a.
          *note getcanvas(): 481b.
          *note getshapes(): 481c.
          *note register_shape(): 481d. | *note addshape(): 481e.
          *note turtles(): 481f.
          *note window_height(): 4820.
          *note window_width(): 4821.

入力メソッド

          *note textinput(): 1cd7.
          *note numinput(): 1cd8.

Screen 独自のメソッド

          *note bye(): 4822.
          *note exitonclick(): 4823.
          *note save(): 19d0.
          *note setup(): 4824.
          *note title(): 4825.


File: python.info,  Node: RawTurtle/Turtle のメソッドと対応する関数,  Next: TurtleScreen/Screen のメソッドと対応する関数,  Prev: Turtle graphics reference,  Up: turtle --- Turtle graphics

5.26.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.26.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(): 47db. と *note radians(): 47dc. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 4819. を参照してください。

          >>> turtle.heading()
          22.0
          >>> turtle.right(45)
          >>> turtle.heading()
          337.0

 -- の関数: turtle.left (angle)
 -- の関数: turtle.lt (angle)


     パラメータ: ‘angle’ - 数 (整数または浮動小数点数)

     タートルを 'angle' 単位だけ左に回します。 (単位のデフォルトは度です
     が、 *note degrees(): 47db. と *note radians(): 47dc. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 4819. を参照してください。

          >>> 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: 4828.
     (たとえば *note pos(): 47d5. で返されます) でなければなりません。

     タートルを指定された絶対位置に移動します。ペンが下りていれば線を引
     きます。タートルの向きは変わりません。

          >>> 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(): 4819. を参照して
     ください)。

          >>> 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(): 47cf. 呼出し
     で返された値でなければなりません

     '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.26.10.20 Turtle の状態を知る
..............................

 -- の関数: turtle.position ()
 -- の関数: turtle.pos ()

     タートルの現在位置を (*note Vec2D: 4828. のベクトルとして) 返します
     。

          >>> 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(): 4819. を参照してください)。

          >>> 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.26.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.26.10.22 Pen の制御
.....................

* Menu:

* 描画状態::
* 色の制御: 色の制御<2>.
* 塗りつぶし::
* さらなる描画の制御::


File: python.info,  Node: 描画状態,  Next: 色の制御<2>,  Up: Pen の制御<2>

5.26.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(): 47e5. 呼出しに渡して以前のペンの状態
     に復旧することができます。さらに一つ以上の属性をキーワード引数とし
     て渡すこともできます。一つの文で幾つものペンの属性を設定するのに使
     えます。

          >>> 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.26.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(): 481a. を参照)。

     ‘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(): 481a. を参照)。

     ‘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(): 47e8. およ
          び *note fillcolor(): 47e9. で返される色指定文字列またはタプル
          のペアで返します。

     ‘color(colorstring)’, ‘color((r,g,b))’, ‘color(r,g,b)’

          *note pencolor(): 47e8. の入力と同じですが、塗りつぶしの色とペ
          ンの色、両方を与えられた値に設定します。

     ‘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(): 481a. 。


File: python.info,  Node: 塗りつぶし,  Next: さらなる描画の制御,  Prev: 色の制御<2>,  Up: Pen の制御<2>

5.26.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():
     47b4. before the fill-block and *note end_fill(): 47b5. 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(): 47b4. の後に描かれた図形を塗
     りつぶします。

     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.26.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.26.10.27 タートルの状態
.........................

* Menu:

* 可視性::
* 見た目::


File: python.info,  Node: 可視性,  Next: 見た目,  Up: タートルの状態

5.26.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.26.10.29 見た目
.................

 -- の関数: turtle.shape (name=None)


     パラメータ: ‘name’ - 形の名前(shapename)として正しい文字列

     タートルの形を与えられた名前('name')の形に設定するか、もしくは名前
     が与えられなければ現在の形の名前を返します。 'name' という名前の形
     は TurtleScreen の形の辞書に載っていなければなりません。最初は次の
     多角形が載っています: "arrow", "turtle", "circle", "square",
     "triangle", "classic"。形についての扱いを学ぶには Screen のメソッド
     *note register_shape(): 481d. を参照して下さい。

          >>> 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(): 47f5. で設定します。

        - "noresize": タートルの見た目を調整しません。

     ‘resizemode("user")’ は *note shapesize(): 47f5. に引数を渡したとき
     に呼び出されます。

          >>> 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.26.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.26.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: 4835. オブジェクトを返します
     。 TurtleScreen のメソッドをそのオブジェクトに対して呼び出すことが
     できます。

          >>> ts = turtle.getscreen()
          >>> ts
          <turtle._Screen object at 0x...>
          >>> ts.bgcolor("pink")

 -- の関数: turtle.setundobuffer (size)


     パラメータ: ‘size’ - 整数または ‘None’

     アンドゥバッファを設定または無効化します。 'size' が整数ならばその
     サイズの空のアンドゥバッファを用意します。 'size' の値はタートルの
     アクションを何度 *note undo(): 47d2. メソッド/関数で取り消せるかの
     最大数を与えます。 'size' が ‘None’ ならば、アンドゥバッファは無効
     化されます。

          >>> turtle.setundobuffer(42)

 -- の関数: turtle.undobufferentries ()

     アンドゥバッファのエントリー数を返します。

          >>> while undobufferentries():
          ...     undo()


File: python.info,  Node: Compound shapes,  Prev: 特別な Turtle のメソッド,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.26.10.32 Compound shapes
..........................

合成されたタートルの形、つまり幾つかの色の違う多角形から成るような形を使
うには、以下のように補助クラス *note Shape: 4838. を直接使わなければなり
ません:

  1. タイプ "compound" の空の Shape オブジェクトを作ります。

  2. *note addcomponent(): 4839. メソッドを使って、好きなだけここにコン
     ポーネントを追加します。

     例えば:

          >>> 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: 4838. クラスは *note register_shape(): 481d. の
     内部では違った使われ方をします。アプリケーションを書く人が Shape ク
     ラスを扱わなければならないのは、上で示したように合成された形を使う
     とき 'だけ' です！


File: python.info,  Node: TurtleScreen/Screen のメソッドと対応する関数,  Next: Public classes,  Prev: RawTurtle/Turtle のメソッドと対応する関数,  Up: turtle --- Turtle graphics

5.26.10.33 TurtleScreen/Screen のメソッドと対応する関数
.......................................................

この節のほとんどの例では ‘screen’ という名前の TurtleScreen インスタンス
を使います。

* Menu:

* ウィンドウの制御::
* アニメーションの制御::
* スクリーンイベントを利用する::
* 入力メソッド::
* 設定と特殊なメソッド::
* Screen 独自のメソッド、TurtleScreen から継承したもの以外::


File: python.info,  Node: ウィンドウの制御,  Next: アニメーションの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.26.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(): 481a.).

     ‘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.26.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(): 480e. も参照)。

          >>> screen.tracer(8, 25)
          >>> dist = 2
          >>> for i in range(200):
          ...     fd(dist)
          ...     rt(90)
          ...     dist += 2

 -- の関数: turtle.update ()

     TurtleScreen の更新を実行します。トレーサーがオフの時に使われます。

RawTurtle/Turtle のメソッド *note speed(): 47d3. も参照して下さい。


File: python.info,  Node: スクリーンイベントを利用する,  Next: 入力メソッド,  Prev: アニメーションの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.26.10.36 スクリーンイベントを利用する
.......................................

 -- の関数: turtle.listen (xdummy=None, ydummy=None)

     TurtleScreen に(キー・イベントを収集するために)フォーカスします。ダ
     ミー引数は *note listen(): 4811. を onclick メソッドに渡せるように
     するためのものです。

 -- の関数: turtle.onkey (fun, key)
 -- の関数: turtle.onkeyrelease (fun, key)


     パラメータ:

        * ‘fun’ - 引数なしの関数または ‘None’

        * ‘key’ - 文字列: キー (例 "a") またはキー・シンボル (例
          "space")

     'fun' を指定されたキーのキーリリース(key-release)イベントに束縛しま
     す。 'fun' が ‘None’ ならばイベント束縛は除かれます。注意: キー・イ
     ベントを登録できるようにするためには TurtleScreen はフォーカスを持
     っていないとなりません(*note listen(): 4811. を参照)。

          >>> 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(): 4811.)

          >>> 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.26.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.26.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:
          4838. オブジェクト: 対応する合成形を取り込みます。

     タートルの形を 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.26.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.26.10.40 Public classes
.........................

 -- クラス: turtle.RawTurtle (canvas)
 -- クラス: turtle.RawPen (canvas)


     パラメータ: ‘canvas’ - a ‘tkinter.Canvas’, a *note ScrolledCanvas:
     4845. or a *note TurtleScreen: 4835.

     タートルを作ります。タートルには上の「Turtle/RawTurtle のメソッド」
     で説明した全てのメソッドがあります。

 -- クラス: turtle.Turtle

     RawTurtle のサブクラスで同じインターフェイスを持ちますが、最初に必
     要になったとき自動的に作られる *note Screen: 47ba. オブジェクトに描
     画します。

 -- クラス: turtle.TurtleScreen (cv)


     パラメータ: ‘cv’ - a ‘tkinter.Canvas’

     上で説明した *note bgcolor(): 4808. のようなスクリーン向けのメソッ
     ドを提供します。

 -- クラス: turtle.Screen

     TurtleScreen のサブクラスで *note 4つのメソッドが加わっています:
     4841. 。

 -- クラス: 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(): 4839. メソッドを使っ
                     て作らなければなりません)
                     

      -- メソッド: 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: 4837. を参照。

 -- クラス: 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.26.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: 4846. instance will automatically create a *note Screen:
47ba. instance if one is not already present.

‘Turtle’ is a subclass of *note RawTurtle: 4843, 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: 4845. or *note TurtleScreen: 4835.

*note TurtleScreen: 4835. is the basic drawing surface for a turtle.
*note Screen: 47ba. is a subclass of ‘TurtleScreen’, and includes *note
some additional methods: 4841. for managing its appearance (including
size and title) and behaviour.  ‘TurtleScreen’'s constructor needs a
‘tkinter.Canvas’ or a *note ScrolledCanvas: 4845. 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.26.10.42 ヘルプと設定
.......................

* Menu:

* ヘルプの使い方::
* ドキュメント文字列の翻訳::
* Screen および Turtle の設定方法::


File: python.info,  Node: ヘルプの使い方,  Next: ドキュメント文字列の翻訳,  Up: ヘルプと設定

5.26.10.43 ヘルプの使い方
.........................

Screen と Turtle クラスのパブリックメソッドはドキュメント文字列で網羅的
に文書化されていますので、Python のヘルプ機能を通じてオンラインヘルプと
して利用できます:

   - IDLE を使っているときは、打ち込んだ関数/メソッド呼び出しのシグニチ
     ャとドキュメント文字列の一行目がツールチップとして表示されます。

   - *note help(): ad8. をメソッドや関数に対して呼び出すとドキュメント文
     字列が表示されます:

          >>> 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.26.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.26.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: 4824. メソッドの引数に当たります。

   - 5行目6行目は *note Screen.screensize: 480c. メソッドの引数に当たり
     ます。

   - '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(): 4823. がメインループ(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.26.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(): 480f,
                             スパターン                         *note delay(): 480e,
                                                                *note update(): 4810.
                                                                
                                                                
‘chaos’                      verhust 力学系のグラフ化, コンピ   世界座標系
                             ュータの計算が常識的な予想に反す   
                             る場合があることを示します。
                             
                                                                
‘clock’                      コンピュータの時間を示すアナログ   turtles as clock's hands,
                             時計                               *note ontimer(): 4816.
                                                                
                                                                
‘colormixer’                 r, g, b の実験                     *note ondrag(): 47fd.
                                                                
                                                                
‘forest’                     3 breadth-first trees              randomization
                                                                
                                                                
‘fractalcurves’              Hilbert & Koch 曲線                再帰
                                                                
                                                                
‘lindenmayer’                民俗的数学 (インド kolams)         L-システム
                                                                
                                                                
‘minimal_hanoi’              ハノイの塔                         Rectangular Turtles as Hanoi discs
                                                                (*note shape(): 47f3,
                                                                *note shapesize(): 47f5.)
                                                                
                                                                
‘nim’                        play the classical nim game with   turtles as nimsticks, event driven
                             three heaps of sticks against      (mouse, keyboard)
                             the computer.                      
                             
                                                                
‘paint’                      超極小主義的描画プログラム         *note onclick(): 47fb.
                                                                
                                                                
‘peace’                      初歩的                             turtle: 見た目とアニメーション
                                                                
                                                                
‘penrose’                    凧と矢による非周期的タイリング     *note stamp(): 47cf.
                                                                
                                                                
‘planet_and_moon’            重力系のシミュレーション           合成形, *note Vec2D: 4828.
                                                                
                                                                
‘rosette’                    タートルグラフィックスについての   *note clone(): 4801, *note undo(): 47d2.
                             wikipedia の記事の例               
                             
                                                                
‘round_dance’                dancing turtles rotating           compound shapes, *note clone(): 4801.
                             pairwise in opposite direction     *note shapesize(): 47f5,
                                                                *note tilt(): 47f8,
                                                                *note get_shapepoly(): 47fa,
                                                                *note update(): 4810.
                                                                
                                                                
‘sorting_animate’            visual demonstration of            simple alignment, randomization
                             different sorting methods          
                             
                                                                
‘tree’                       (図形的) 幅優先木 (ジェネレータ    *note clone(): 4801.
                             を使って)                          
                             
                                                                
‘two_canvases’               simple design                      turtles on two canvases
                                                                
                                                                
‘yinyang’                    もう一つの初歩的な例               *note circle(): 47cd.
                                                                

楽しんでね!


File: python.info,  Node: python 2 6からの変更点,  Next: python 3 0からの変更点,  Prev: turtledemo --- Demo scripts,  Up: turtle --- Turtle graphics

5.26.10.47 python 2.6からの変更点
.................................

   - The methods *note Turtle.tracer: 480f, *note Turtle.window_width:
     4821. and *note Turtle.window_height: 4820. have been eliminated.
     Methods with these names and functionality are now available only
     as methods of *note Screen: 47ba.  The functions derived from these
     remain available.  (In fact already in Python 2.6 these methods
     were merely duplications of the corresponding *note TurtleScreen:
     4835./‘Screen’ methods.)

   - The method ‘Turtle.fill()’ has been eliminated.  The behaviour of
     *note begin_fill(): 47b4. and *note end_fill(): 47b5. have changed
     slightly: now every filling process must be completed with an
     ‘end_fill()’ call.

   - A method *note Turtle.filling: 47ea. 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.26.10.48 python 3.0からの変更点
.................................

   - The *note Turtle: 4846. methods *note shearfactor(): 47f7, *note
     shapetransform(): 47f9. and *note get_shapepoly(): 47fa. have been
     added.  Thus the full range of regular linear transforms is now
     available for transforming turtle shapes.  *note tiltangle(): 933.
     has been enhanced in functionality: it now can be used to get or
     set the tilt angle.

   - The *note Screen: 47ba. method *note onkeypress(): 4814. has been
     added as a complement to *note onkey(): 4812.  As the latter binds
     actions to the key release event, an alias: *note onkeyrelease():
     4813. was also added for it.

   - The method *note Screen.mainloop: 4817. has been added, so there is
     no longer a need to use the standalone ‘mainloop()’ function when
     working with *note Screen: 47ba. and *note Turtle: 4846. objects.

   - Two input methods have been added: *note Screen.textinput: 1cd7.
     and *note Screen.numinput: 1cd8.  These pop up input dialogs and
     return strings and numbers respectively.


File: python.info,  Node: 開発ツール,  Next: Debugging and Profiling,  Prev: Graphical user interfaces with Tk,  Up: Python 標準ライブラリ

5.27 開発ツール
===============

この章で紹介されるモジュールはソフトウェアを書くことを支援します。たとえ
ば、 *note pydoc: ba. モジュールはモジュールの内容からドキュメントを生成
します。 *note doctest: 3e. と *note unittest: 10d. モジュールでは、自動
的に実行して予想通りの出力が生成されるか確認するユニットテストを書くこと
ができます。

この章で解説されるモジュールのリスト:

* Menu:

* typing: typing --- 型ヒントのサポート. 型ヒントのサポート
* 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 --- 型ヒントのサポート,  Next: pydoc --- ドキュメント生成とオンラインヘルプシステム,  Up: 開発ツール

5.27.1 ‘typing’ -- 型ヒントのサポート
-------------------------------------

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: 242b. で示されているように、引数が *note float: 197. のインスタン
スであるという前提です。 そして、‘-> str’ というヒントにある通り、この関
数は *note str: 16a. のインスタンスを返すことになっています。

型ヒントは *note float: 197. や *note str: 16a. のような単純な型を指定す
ることもできますし、もっと複雑な型も指定できます。 *note typing: 10b. モ
ジュールには、より高度な型ヒントを表現するためのいろいろな型が含まれてい
ます。

‘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 構造的部分型::
* モジュールの内容: モジュールの内容<4>.
* メジャーな機能の非推奨時系列::

   ---------- 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 --- 型ヒントのサポート

5.27.1.1 Python 型システムの仕様
................................

最新の正式な Python 型システムの使用は 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 --- 型ヒントのサポート

5.27.1.2 型エイリアス
.....................

型エイリアスは *note type: 66d. 文を用いて定義され、これにより *note
TypeAliasType: 2b0. インスタンスが生成されます。 以下の例では、 ‘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: 9d0. でマークすることで、これが通常の変数代
入ではなく、型エイリアスであることを明示できます

     from typing import TypeAlias

     Vector: TypeAlias = list[float]


File: python.info,  Node: NewType,  Next: 呼び出し可能オブジェクトのアノテーション,  Prev: 型エイリアス,  Up: typing --- 型ヒントのサポート

5.27.1.3 NewType
................

異なる型を作るためには *note NewType: ef5. ヘルパークラスを使います:

     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: ef5. は
作ることが出来ます:

     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 --- 型ヒントのサポート

5.27.1.4 呼び出し可能オブジェクトのアノテーション
.................................................

関数、または他の *note callable: 2df7. なオブジェクトは、 *note
collections.abc.Callable: 9ef. または *note typing.Callable: 9cc. を使っ
てアノテーションすることができます。 ‘Callable[[int], str]’ は、 *note
int: 19c. 型のパラメータを1つ受け取り、 *note str: 16a. を返す関数を意味
します。

例えば:

     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

添字表記には必ず２つの値、すなわち引数のリストと返り値の型を指定する必要
があります。 引数のリストは型のリスト、*note ParamSpec: 487.、*note
Concatenate: 9cb.、ellipsis (‘...’) のいずれかでなければなりません。返り
値の型は単一の型でなければなりません。

もしellipsisリテラル ‘...’ が引数リストとして与えられた場合、それは任意
のパラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示しま
す。

     def concat(x: str, y: str) -> str:
         return x + y

     x: Callable[..., str]
     x = str     # OK
     x = concat  # これもOK

‘Callable’ は可変引数、*note オーバーロード関数: 485c.、キーワード専用引
数などを含む複雑な型シグネチャを表現することはできません。 しかし、*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)   # エラー! 第二実引数の名前と(引数としての)種類が
                              # 一致しません

callable が別の callable を引数に取る場合は、*note ParamSpec: 487. を使
えば両者のパラメータ引数の依存関係を表現することができます。 さらに、あ
る callable が別の callable から引数を追加したり削除したりする場合は、
*note Concatenate: 9cb. 演算子を使うことで表現できます。 その場合、
callable の型は ‘Callable[ParamSpecVariable, ReturnType]’ と
‘Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable],
ReturnType]’ という形になります。

バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 487. と *note
Concatenate: 9cb. をサポートしました。詳細は PEP 612(1) を参照してくださ
い。

参考
....

*note ParamSpec: 487. と *note Concatenate: 9cb. のドキュメントに、
‘Callable’ での使用例が記載されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0612/


File: python.info,  Node: ジェネリクス,  Next: タプルのアノテーション,  Prev: 呼び出し可能オブジェクトのアノテーション,  Up: typing --- 型ヒントのサポート

5.27.1.5 ジェネリクス
.....................

コンテナに含まれるオブジェクトに関する型情報は、一般的な方法で静的に推論
することができないため、標準ライブラリの多くのコンテナクラスは、要素に期
待する型を示す添字表記をサポートしています

     from collections.abc import Mapping, Sequence

     class Employee: ...

     # Sequence[Employee] はシーケンスの要素がすべて "Employee" の
     # インスタンスでなければならないということを表します。
     # Mapping[str, str] は mapping に含まれるキーとバリューが
     # すべて文字列である必要があることを表します。
     def notify_by_email(employees: Sequence[Employee],
                         overrides: Mapping[str, str]) -> None: ...

ジェネリック関数およびクラスは以下の通り、 *note 型引数構文: 5ad. を使う
ことでパラメータ化できます:

     from collections.abc import Sequence

     def first[T](l: Sequence[T]) -> T:  # この関数は型変数 "T" に関してジェネリックです
         return l[0]

もしくは、 *note TypeVar: 486. のコンストラクタを使うこともできます:

     from collections.abc import Sequence
     from typing import TypeVar

     U = TypeVar('U')                  # 型引数 "U" を宣言

     def second(l: Sequence[U]) -> U:  # 型引数 "U" に関してジェネリックな関数
         return l[1]

バージョン 3.12 で変更: ジェネリックが構文としてサポートされたのは
Python 3.12 が初めてです。


File: python.info,  Node: タプルのアノテーション,  Next: クラスオブジェクトの型,  Prev: ジェネリクス,  Up: typing --- 型ヒントのサポート

5.27.1.6 タプルのアノテーション
...............................

Python のコンテナのほとんどは、すべての要素が同じ型であると型システムが
想定するようになっています。例えば:

     from collections.abc import Mapping

     # ``x`` の要素がすべて int であると型チェッカーが推定する
     x: list[int] = []

     # 型チェッカーエラー： ``list`` は一つの引数しか受け付けない
     y: list[int, str] = [1, 'foo']

     # ``z`` のキーはすべて文字列であり、バリューは文字列か int のどちらか
     # であると型チェッカーが推定する
     z: Mapping[str, str | int] = {}

*note list: 24f. は引数に1つの型のみ受け入れるので、型チェッカーは上記の
‘y’ への代入でエラーを出力します。同様に、*note Mapping: acb. は引数に
2つの型のみ受け入れます。1つ目はキーの型を示し、2つ目は値の型を示します
。

しかし、他の多くのPythonのコンテナとは異なり、タプルがすべて同じ型ではな
い要素を持つことは、慣用的なPythonコードでは一般的です。このため、タプル
はPythonの型システムの中でも特殊です。*note tuple: 614. は任意の数の引数
を受け入れます

     # OK: ``x`` に代入されるのは長さ1のタプルで、要素は int
     x: tuple[int] = (5,)

     # OK: ``y`` に代入されるのは長さ2のタプルで、
     # 第１要素は int、第２要素は文字列
     y: tuple[int, str] = (5, "foo")

     # エラー: 型アノテーションでは長さ1のタプルとなっているが、
     # ``z`` には長さ3のタプルが代入されている
     z: tuple[int] = (1, 2, 3)

タプルの長さが可変で、すべての要素が同じ型 ‘T’ であるということを表すに
は、リテラルの ellipsis ‘...’ を使って ‘tuple[T, ...]’ と表現します。空
のタプルを表すには ‘tuple[()]’ を使います。型アノテーションとして
‘tuple’ だけを指定すると ‘tuple[Any, ...]’ と同じ意味になります:

     x: tuple[int, ...] = (1, 2)
     # 以下の再代入は OK: ``tuple[int, ...]`` は x の長さが任意であることを表す
     x = (1, 2, 3)
     x = ()
     # 以下の再代入はエラー: ``x`` のすべての要素が int である必要がある
     x = ("foo", "bar")

     # ``y`` に代入できるのは空のタプルのみ
     y: tuple[()] = ()

     z: tuple = ("foo", "bar")
     # 以下の再代入は OK: ``tuple`` は ``tuple[Any, ...]`` と等価
     z = (1, 2, 3)
     z = ()


File: python.info,  Node: クラスオブジェクトの型,  Next: Annotating generators and coroutines,  Prev: タプルのアノテーション,  Up: typing --- 型ヒントのサポート

5.27.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]: 4861.) 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: f48. are classes, *note Any:
8bc, *note type variables: 2429, 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: f48, which is the root of
Python's *note metaclass hierarchy: 241e.


File: python.info,  Node: Annotating generators and coroutines,  Next: ユーザー定義のジェネリック型,  Prev: クラスオブジェクトの型,  Up: typing --- 型ヒントのサポート

5.27.1.8 Annotating generators and coroutines
.............................................

A generator can be annotated using the generic type *note
Generator[YieldType, SendType, ReturnType]: fdf.  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: fdf. 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]: 2707. or *note
Iterator[YieldType]: 2708.:

     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]:
e8b.).  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]: fe3. and
*note AsyncIterator[YieldType]: fe2. 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]: fe1.  Generic arguments correspond to those of *note
Generator: fdf, 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 --- 型ヒントのサポート

5.27.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: 4864. ‘T’ .  This also makes ‘T’ valid as
a type within the class body.

Generic classes implicitly inherit from *note Generic: 1823.  For
compatibility with Python 3.11 and lower, it is also possible to inherit
explicitly from ‘Generic’ to indicate a generic class:

     from typing import TypeVar, Generic

     T = TypeVar('T')

     class LoggedVar(Generic[T]):
         ...

Generic classes have *note __class_getitem__(): 947. 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: 1823. の引数のそれぞれの型変数は別のものでなければなりま
せん。このため次のクラス定義は無効です:

     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: 8bc. 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: 1823. にあった独自のメタクラスは無
くなりました。

バージョン 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: 1823. 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: 1823.  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: 1823. 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 --- 型ヒントのサポート

5.27.1.10 ‘Any’ 型
..................

A special kind of type is *note Any: 8bc.  A static type checker will
treat every type as assignable to ‘Any’ and ‘Any’ as assignable to every
type.

これは、 *note Any: 8bc. 型の値では、任意の演算やメソッドの呼び出しが行
えることを意味します:

     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: 8bc. 型の値をより詳細な型に代入する時に型検査が行われないこと
に注意してください。例えば、静的型検査器は ‘a’ を ‘s’ に代入する時、‘s’
が *note str: 16a. 型として宣言されていて実行時に *note int: 19c. の値を
受け取るとしても、エラーを報告しません。

さらに、返り値や引数の型のないすべての関数は暗黙的に *note Any: 8bc. を
使用します。

     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: 8bc. を '非常口' として使用することができます。

*note Any: 8bc. の挙動と *note object: c82. の挙動を対比しましょう。
‘Any’ と同様に、すべての型は ‘object’ のサブタイプです。しかしながら、
‘Any’ と異なり、逆は成り立ちません: ‘object’ はすべての他の型のサブタイ
プでは 'ありません'。

これは、ある値の型が *note object: c82. のとき、型検査器はこれについての
ほとんどすべての操作を拒否し、これをより特殊化された変数に代入する (また
は返り値として利用する) ことは型エラーになることを意味します。例えば:

     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 assignable to all types
     hash_b(42)
     hash_b("foo")

*note object: c82. は、ある値が型安全な方法で任意の型として使えることを
示すために使用します。 *note Any: 8bc. はある値が動的に型付けられること
を示すために使用します。


File: python.info,  Node: 名前的部分型 vs 構造的部分型,  Next: モジュールの内容<4>,  Prev: Any 型,  Up: typing --- 型ヒントのサポート

5.27.1.11 名前的部分型 vs 構造的部分型
......................................

初めは PEP 484(1) は Python の静的型システムを '名前的部分型' を使って定
義していました。 名前的部分型とは、クラス ‘B’ が期待されているところにク
ラス ‘A’ が許容されるのは ‘A’ が ‘B’ のサブクラスの場合かつその場合に限
る、ということです。

前出の必要条件は、*note Iterable: 2707. などの抽象基底クラスにも当て嵌ま
ります。 この型付け手法の問題は、この手法をサポートするためにクラスに明
確な型付けを行う必要があることで、これは 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: モジュールの内容<4>,  Next: メジャーな機能の非推奨時系列,  Prev: 名前的部分型 vs 構造的部分型,  Up: typing --- 型ヒントのサポート

5.27.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::
* 定数: 定数<11>.
* 非推奨のエイリアス::


File: python.info,  Node: 特殊型付けプリミティブ,  Next: プロトコル<4>,  Up: モジュールの内容<4>

5.27.1.13 特殊型付けプリミティブ
................................

* Menu:

* 特殊型::
* 特殊形式::
* Building generic types and type aliases::
* Other special directives::


File: python.info,  Node: 特殊型,  Next: 特殊形式,  Up: 特殊型付けプリミティブ

5.27.1.14 特殊型
................

These can be used as types in annotations.  They do not support
subscription using ‘[]’.

 -- データ: typing.Any

     制約のない型であることを示す特別な型です。

        * Every type is assignable to ‘Any’.

        * ‘Any’ is assignable to every type.

     バージョン 3.11 で変更: ‘Any’ 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: 486a.

     Definition:

          AnyStr = TypeVar('AnyStr', str, bytes)

     ‘AnyStr’ is meant to be used for functions that may accept *note
     str: 16a. or *note bytes: 193. 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: 8bc. 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!"

     バージョン 3.13 で非推奨、バージョン 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(): 279.:

          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(): 8b7.:

          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 ‘NoReturn’.

     Added in version 3.11: Added ‘Never’.

 -- データ: 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 で非推奨: ‘TypeAlias’ is deprecated in favor of the
     *note type: 66d. statement, which creates instances of *note
     TypeAliasType: 2b0. and which natively supports forward references.
     Note that while ‘TypeAlias’ and ‘TypeAliasType’ serve similar
     purposes and have similar names, they are distinct and the latter
     is not the type of the former.  Removal of ‘TypeAlias’ is not
     currently planned, but users are encouraged to migrate to ‘type’
     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.27.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: 2b0.:

               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型の表現: 9c9. を参照ください。

     バージョン 3.14 で変更: *note types.UnionType: 2a9. is now an alias
     for ‘Union’, 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: 2728.
     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 valid when used in *note
     Callable: 2728. type hints and when instantiating user-defined
     generic classes with ‘ParamSpec’ parameters.  The last parameter to
     ‘Concatenate’ must be a ‘ParamSpec’ or ellipsis (‘...’).

     For example, to annotate a decorator ‘with_lock’ which provides a
     *note threading.Lock: 1a54. 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 呼び出し可能オブジェクトのアノテーション: 2728.

 -- データ: 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: 2b0.:

               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: 199. を送出するようになりました。

 -- データ: typing.ClassVar

     クラス変数であることを示す特別な型構築子です。

     PEP 526(3) で導入された通り、 ClassVar でラップされた変数アノテーシ
     ョンによって、ある属性はクラス変数として使うつもりであり、そのクラ
     スのインスタンスから設定すべきではないということを示せます。使い方
     は次のようになります:

          class Starship:
              stats: ClassVar[dict[str, int]] = {} # class variable
              damage: int = 10                     # instance variable

     *note ClassVar: 56d. は型のみを受け入れ、それ以外は受け付けられませ
     ん。

     ‘ClassVar’ is not a class itself, and cannot be used with *note
     isinstance(): 2af. or *note issubclass(): 9c8.  ‘ClassVar’ does not
     change Python runtime behavior, but it can be used by static type
     checkers.  For example, a type checker might flag the following
     code as an error:

          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 で変更: ‘ClassVar’ 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 で変更: ‘Final’ can now be nested in *note
     ClassVar: 56d. and vice versa.

 -- データ: typing.Required

     Special typing construct to mark a *note TypedDict: 330. key as
     required.

     This is mainly useful for ‘total=False’ TypedDicts.  See *note
     TypedDict: 330. and PEP 655(5) for more details.

     Added in version 3.11.

 -- データ: typing.NotRequired

     Special typing construct to mark a *note TypedDict: 330. key as
     potentially missing.

     より詳しくは、 *note TypedDict: 330. と PEP 655(6) を参照してくださ
     い。

     Added in version 3.11.

 -- データ: typing.ReadOnly

     A special typing construct to mark an item of a *note TypedDict:
     330. 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"  # type checker error

     There is no runtime checking for this property.

     See *note TypedDict: 330. 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: 8c4. 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(): 2af.).

      -- 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: 2b0.:

          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(): 8c1. 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(): 2ad. 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: 486d. 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: 330.
     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.27.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: 23d3.

     このクラスは次のように使用することが出来ます:

          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:
     23d3, 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: 1823. 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: 199.

      -- の属性: __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: 4875. corresponding to the *note
          __bound__: 4873. attribute.  When called directly, this method
          supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__bound__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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: 4875. corresponding to the *note
          __constraints__: 4877. attribute.  When called directly, this
          method supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__constraints__’ attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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: 4875. corresponding to the *note
          __default__: 4879. attribute.  When called directly, this
          method supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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__:
          4879. 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:
     4864. 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: 1a04. 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: 4875. corresponding to the *note
          __default__: 487d. attribute.  When called directly, this
          method supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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__: 487d. 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: 4864.

     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: 1823. 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: 8bc.

       2. *note cast(): 4880. 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: 9cd. and *note ParamSpecKwargs: 9ce.

      -- の属性: __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: 4875. corresponding to the *note
          __default__: 4884. attribute.  When called directly, this
          method supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__default__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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__: 4884. 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: 9cb.

        * *note 呼び出し可能オブジェクトのアノテーション: 2728.

 -- クラス: 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(): 2ad. 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: 4875. corresponding to the *note
          __value__: 488a. attribute.  When called directly, this method
          supports only the *note VALUE: 15f. format, which is
          equivalent to accessing the ‘__value__’ attribute directly,
          but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 4876. 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.27.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

     デフォルト値のあるフィールドはデフォルト値のないフィールドの後でな
     ければなりません。

     The types for each field name can be retrieved by calling *note
     annotationlib.get_annotations(): 457. on the resulting class.  (The
     field names are in the ‘_fields’ attribute and the default values
     are in the ‘_field_defaults’ attribute, both of which are part of
     the *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(): 1a7. (and the
     ‘__class__’ *note closure variable: 18f6.) in methods of
     ‘NamedTuple’ subclasses is unsupported and causes a *note
     TypeError: 199.

     バージョン 3.13 で非推奨、バージョン 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.

     バージョン 3.13 で非推奨、バージョン 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: 4859.

     A ‘NewType’ is considered a distinct type by a type checker.  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(): 2af. or *note issubclass(): 9c8.

     プロトコルクラスはジェネリックにもできます。例えば:

          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(): 2af. and *note
     issubclass(): 9c8.  This allows a simple-minded structural check,
     very similar to "one-trick ponies" in *note collections.abc: 1f.
     such as *note Iterable: 2707.  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: 199. 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: d7e. is a class,
          therefore it passes an *note issubclass(): 9c8. check against
          *note Callable: 2728.  However, the ‘ssl.SSLObject.__init__’
          method exists only to raise a *note TypeError: 199. with a
          more informative message, therefore making it impossible to
          call (instantiate) ‘ssl.SSLObject’.

          注釈: An *note isinstance(): 2af. 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(): 2af. 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(): 2af. 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: 184.

     ‘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: 184.:

          Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

     This functional syntax allows defining keys which are not valid
     *note identifiers: 22fc, for example because they are keywords or
     contain hyphens, or when key names must not be *note mangled: 20ff.
     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: 1823.  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: 1823. explicitly:

          T = TypeVar("T")

          class Group(TypedDict, Generic[T]):
              key: T
              group: list[T]

     A ‘TypedDict’ can be introspected via *note
     annotationlib.get_annotations(): 457. (see *note
     アノテーションのベストプラクティス: 9dd. for more information on
     annotations best practices) and the following attributes:

      -- の属性: __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__: 4891. and *note __optional_keys__:
          4892. 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.

     バージョン 3.13 で非推奨、バージョン 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: モジュールの内容<4>

5.27.1.18 プロトコル
....................

The following protocols are provided by the ‘typing’ module.  All are
decorated with *note @runtime_checkable: 675.

 -- クラス: typing.SupportsAbs

     A protocol with one abstract method ‘__abs__’ that is covariant in
     its return type.

 -- クラス: typing.SupportsBytes

     A protocol with one abstract method ‘__bytes__’.

 -- クラス: typing.SupportsComplex

     A protocol with one abstract method ‘__complex__’.

 -- クラス: typing.SupportsFloat

     A protocol with one abstract method ‘__float__’.

 -- クラス: typing.SupportsIndex

     A protocol with one abstract method ‘__index__’.

     Added in version 3.8.

 -- クラス: typing.SupportsInt

     A protocol with one abstract method ‘__int__’.

 -- クラス: typing.SupportsRound

     A protocol with one abstract method ‘__round__’ that is covariant
     in its return type.


File: python.info,  Node: ABCs and Protocols for working with I/O,  Next: Functions and decorators,  Prev: プロトコル<4>,  Up: モジュールの内容<4>

5.27.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(): 318.  Please note that these classes are
     not protocols, and their interface is fairly broad.

The protocols *note io.Reader: 238. and *note io.Writer: 239. 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: 2707. 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: モジュールの内容<4>

5.27.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: 19c.
     or a *note str: 16a, 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: 197.  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: 8b8, 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: b37. 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: 3c1.) - 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: 3c1.) - 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: 3c1.) - 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: 3c1.) - 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:
          9ef.‘[’‘...’‘, ’‘Any’‘]’‘, ’‘...’‘]’) - Specifies a static
          list of supported classes or functions that describe fields,
          similar to *note dataclasses.field(): 19ba.  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: 369.

     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(): 8be.

 -- の関数: typing.get_overloads (func)

     Return a sequence of *note @overload: 489b.-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: 489b,
     ‘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: 93e.  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

     Decorator to give another decorator the *note no_type_check(): 8c4.
     effect.

     This wraps the decorator with something that wraps the decorated
     function in *note no_type_check(): 8c4.

     バージョン 3.13 で非推奨、バージョン 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: 定数<11>,  Prev: Functions and decorators,  Up: モジュールの内容<4>

5.27.1.21 Introspection helpers
...............................

 -- の関数: typing.get_type_hints (obj, globalns=None, localns=None,
          include_extras=False, *, format=Format.VALUE)

     Return a dictionary containing type hints for a function, method,
     module, class object, or other callable object.

     This is often the same as *note annotationlib.get_annotations():
     457, but this function makes the following changes to the
     annotations dictionary:

        * Forward references encoded as string literals or *note
          ForwardRef: 1c37. 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: a56.

        * If *note @no_type_check: 8c4. 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__:
          23d4. and iteratively combining *note annotations: f55. of
          each base class.  Annotations on classes appearing earlier in
          the *note method resolution order: 263e. 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: b3b. for more information).

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 489e. for more information.

          注釈: If *note Format.VALUE: 15f. is used and any forward
          references in the annotations of 'obj' are not resolvable, a
          *note NameError: 450. exception is raised.  For example, this
          can happen with names imported under *note if TYPE_CHECKING:
          ef4.  More generally, any kind of exception can be raised if
          an annotation contains invalid Python code.

          注釈: Calling ‘get_type_hints()’ on an instance is not
          supported.  To retrieve annotations for an instance, call
          ‘get_type_hints()’ on the instance's class instead (for
          example, ‘get_type_hints(type(obj))’).

     バージョン 3.9 で変更: Added ‘include_extras’ parameter as part of
     PEP 593(1).  See the documentation on *note Annotated: b3b. 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.

     バージョン 3.14 で変更: Added the ‘format’ parameter.  See the
     documentation on *note annotationlib.get_annotations(): 457. for
     more information.

     バージョン 3.14 で変更: Calling ‘get_type_hints()’ on instances is
     no longer supported.  Some instances were accepted in earlier
     versions as an undocumented implementation detail.

 -- の関数: 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: 9cd. or *note ParamSpecKwargs:
     9ce, 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: a59. 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: 199. 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

          assert is_protocol(P)
          assert not is_protocol(int)

     This function only returns true for ‘Protocol’ classes, not for
     *note generic aliases: 8c2. of them:

          class GenericP[T](Protocol):
              def a(self) -> T: ...
              b: int

          assert not is_protocol(GenericP[int])

     Added in version 3.13.

 -- の関数: typing.is_typeddict (tp)

     Check if a type is a *note TypedDict: 330.

     例えば:

          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)

     This function only returns true for ‘TypedDict’ classes, not for
     *note generic aliases: 8c2. of them:

          class GenericFilm[T](TypedDict):
              title: str
              year: T

          assert not is_typeddict(GenericFilm[int])

     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: 17e8.  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: 17e8. as a *note type
     hint: 242b.

     This is similar to calling *note
     annotationlib.ForwardRef.evaluate(): 1820, 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(): 1820. 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: 489e. 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: 定数<11>,  Next: 非推奨のエイリアス,  Prev: Introspection helpers,  Up: モジュールの内容<4>

5.27.1.22 定数
..............

 -- データ: typing.TYPE_CHECKING

     A special constant that is assumed to be ‘True’ by 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(): 457. with a ‘format’ parameter of
     *note annotationlib.Format.STRING: 161. or *note
     annotationlib.Format.FORWARDREF: 160. to safely retrieve the
     annotations without raising *note NameError: 450.

     Added in version 3.5.2.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: 非推奨のエイリアス,  Prev: 定数<11>,  Up: モジュールの内容<4>

5.27.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.27.1.24 Aliases to built-in types
...................................

 -- クラス: typing.Dict (dict, MutableMapping[KT, VT])

     *note dict: 184. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Mapping: acb. rather than to use
     *note dict: 184. or ‘typing.Dict’.

     バージョン 3.9 で非推奨: *note builtins.dict: 184. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.List (list, MutableSequence[T])

     *note list: 24f. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Sequence: 13e0. or *note Iterable:
     2707. rather than to use *note list: 24f. or ‘typing.List’.

     バージョン 3.9 で非推奨: *note builtins.list: 24f. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Set (set, MutableSet[T])

     Deprecated alias to *note builtins.set: 185.

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note collections.abc.Set: 26ff. rather
     than to use *note set: 185. or *note typing.Set: 48a7.

     バージョン 3.9 で非推奨: *note builtins.set: 185. は添字表記 (‘[]’)
     をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.FrozenSet (frozenset, AbstractSet[T_co])

     Deprecated alias to *note builtins.frozenset: 7f2.

     バージョン 3.9 で非推奨: *note builtins.frozenset: 7f2. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- データ: typing.Tuple

     *note tuple: 614. の非推奨なエイリアス。

     *note tuple: 614. and ‘Tuple’ are special-cased in the type system;
     see *note タプルのアノテーション: 2674. for more details.

     バージョン 3.9 で非推奨: *note builtins.tuple: 614. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Type (Generic[CT_co])

     *note type: f48. の非推奨なエイリアス。

     See *note クラスオブジェクトの型: 4860. for details on using *note
     type: f48. or ‘typing.Type’ in type annotations.

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note builtins.type: f48. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

   ---------- 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.27.1.25 Aliases to types in ‘collections’
...........................................

 -- クラス: typing.DefaultDict (collections.defaultdict,
          MutableMapping[KT, VT])

     *note collections.defaultdict: 13d8. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.defaultdict: 13d8. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: 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
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.ChainMap (collections.ChainMap, MutableMapping[KT,
          VT])

     *note collections.ChainMap: e1a. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.ChainMap: e1a. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Counter (collections.Counter, Dict[T, int])

     *note collections.Counter: 12a7. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.Counter: 12a7. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: 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
     ジェネリックエイリアス型: 8c2. を参照してください。

   ---------- 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.27.1.26 Aliases to other concrete types
.........................................

 -- クラス: typing.Pattern
 -- クラス: typing.Match

     Deprecated aliases corresponding to the return types from *note
     re.compile(): dd2. and *note re.match(): 1449.

     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
     ジェネリックエイリアス型: 8c2.

 -- クラス: typing.Text

     Deprecated alias for *note str: 16a.

     ‘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: 16a. 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.27.1.27 Aliases to container ABCs in ‘collections.abc’
........................................................

 -- クラス: typing.AbstractSet (Collection[T_co])

     *note collections.abc.Set: 26ff. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Set: 26ff. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.ByteString (Sequence[int])

     Deprecated alias to *note collections.abc.ByteString: 340.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 262. at runtime.  For use in
     type annotations, either use *note Buffer: 341. 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: 193. and *note
     bytearray: 342.  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: 166. were also never
     understood as subtypes of ‘ByteString’ (either at runtime or by
     static type checkers).

     See PEP 688(2) for more details.

     バージョン 3.9 で非推奨、バージョン 3.17 で削除予定.

 -- クラス: typing.Collection (Sized, Iterable[T_co], Container[T_co])

     *note collections.abc.Collection: e88. の非推奨なエイリアス。

     Added in version 3.6.

     バージョン 3.9 で非推奨: *note collections.abc.Collection: e88. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Container (Generic[T_co])

     *note collections.abc.Container: 2709. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Container: 2709. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.ItemsView (MappingView, AbstractSet[tuple[KT_co,
          VT_co]])

     *note collections.abc.ItemsView: 270d. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ItemsView: 270d. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.KeysView (MappingView, AbstractSet[KT_co])

     *note collections.abc.KeysView: 270c. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.KeysView: 270c. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Mapping (Collection[KT], Generic[KT, VT_co])

     *note collections.abc.Mapping: acb. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Mapping: acb. は添字
     表記 (‘[]’) をサポートするようになりました。 PEP 585(7) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.MappingView (Sized)

     *note collections.abc.MappingView: 270b. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MappingView: 270b. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(8) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.MutableMapping (Mapping[KT, VT])

     *note collections.abc.MutableMapping: 12c4. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableMapping:
     12c4. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(9)
     と *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.MutableSequence (Sequence[T])

     *note collections.abc.MutableSequence: 4bf. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSequence:
     4bf. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(10)
     と *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.MutableSet (AbstractSet[T])

     *note collections.abc.MutableSet: 270a. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSet: 270a. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(11) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Sequence (Reversible[T_co], Collection[T_co])

     *note collections.abc.Sequence: 13e0. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Sequence: 13e0. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(12) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.ValuesView (MappingView, Collection[_VT_co])

     *note collections.abc.ValuesView: 270e. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ValuesView: 270e. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(13) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

   ---------- 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.27.1.28 Aliases to asynchronous ABCs in ‘collections.abc’
...........................................................

 -- クラス: typing.Coroutine (Awaitable[ReturnType], Generic[YieldType,
          SendType, ReturnType])

     *note collections.abc.Coroutine: fe1. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2a12. for details
     on using *note collections.abc.Coroutine: fe1. and
     ‘typing.Coroutine’ in type annotations.

     Added in version 3.5.3.

     バージョン 3.9 で非推奨: *note collections.abc.Coroutine: fe1. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.AsyncGenerator (AsyncIterator[YieldType],
          Generic[YieldType, SendType])

     *note collections.abc.AsyncGenerator: e8b. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2a12. for details
     on using *note collections.abc.AsyncGenerator: e8b. and
     ‘typing.AsyncGenerator’ in type annotations.

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncGenerator: e8b.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

     バージョン 3.13 で変更: The ‘SendType’ parameter now has a default.

 -- クラス: typing.AsyncIterable (Generic[T_co])

     *note collections.abc.AsyncIterable: fe3. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterable: fe3.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.AsyncIterator (AsyncIterable[T_co])

     *note collections.abc.AsyncIterator: fe2. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterator: fe2.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Awaitable (Generic[T_co])

     *note collections.abc.Awaitable: fe0. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.Awaitable: fe0. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

   ---------- 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.27.1.29 Aliases to other ABCs in ‘collections.abc’
....................................................

 -- クラス: typing.Iterable (Generic[T_co])

     *note collections.abc.Iterable: 2707. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterable: 2707. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: typing.Iterator (Iterable[T_co])

     *note collections.abc.Iterator: 2708. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterator: 2708. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

 -- データ: typing.Callable

     *note collections.abc.Callable: 9ef. の非推奨なエイリアス。

     See *note 呼び出し可能オブジェクトのアノテーション: 2728. for
     details on how to use *note collections.abc.Callable: 9ef. and
     ‘typing.Callable’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Callable: 9ef. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

     バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 487. と
     *note Concatenate: 9cb. をサポートしました。詳細は PEP 612(4) を参
     照してください。

 -- クラス: typing.Generator (Iterator[YieldType], Generic[YieldType,
          SendType, ReturnType])

     *note collections.abc.Generator: fdf. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 2a12. for details
     on using *note collections.abc.Generator: fdf. and
     ‘typing.Generator’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Generator: fdf. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

     バージョン 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: e89. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Reversible: e89. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と
     *note ジェネリックエイリアス型: 8c2. を参照してください。

 -- クラス: 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.27.1.30 Aliases to ‘contextlib’ ABCs
......................................

 -- クラス: typing.ContextManager (Generic[T_co, ExitT_co])

     *note contextlib.AbstractContextManager: e8e. の非推奨なエイリアス
     。

     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__(): 151c. method.

     Added in version 3.5.4.

     バージョン 3.9 で非推奨: *note contextlib.AbstractContextManager:
     e8e. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(1)
     と *note ジェネリックエイリアス型: 8c2. を参照してください。

     バージョン 3.13 で変更: Added the optional second type parameter,
     ‘ExitT_co’.

 -- クラス: typing.AsyncContextManager (Generic[T_co, AExitT_co])

     *note contextlib.AbstractAsyncContextManager: d24. の非推奨なエイリ
     アス。

     The first type parameter, ‘T_co’, represents the type returned by
     the *note __aenter__(): 247d. method.  The optional second type
     parameter, ‘AExitT_co’, which defaults to ‘bool | None’, represents
     the type returned by the *note __aexit__(): 1a00. method.

     Added in version 3.6.2.

     バージョン 3.9 で非推奨: *note
     contextlib.AbstractAsyncContextManager: d24. は添字表記 (‘[]’) をサ
     ポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c2. を参照してください。

     バージョン 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: モジュールの内容<4>,  Up: typing --- 型ヒントのサポート

5.27.1.31 メジャーな機能の非推奨時系列
......................................

‘typing’ の機能の中には非推奨のものがあり、Python の将来のバージョンで削
除される可能性があります。以下の表は主な非推奨機能をまとめたものです。こ
れは変更される可能性があり、すべての非推奨機能がリストされているわけでは
ありません。

機能                          非推奨となるバージョン        削除予定のバージョン          PEP/issue
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
標準コレクションのエイリア    3.9                           未定（                        PEP 585(1)
ス                                                          *note 非推奨のエイリアス: 48a1.
                                                            を参照）
                                                            
                                                                                          
*note typing.ByteString: 343. 3.9                           3.17                          gh-91896(2)
                                                                                          
                                                                                          
*note typing.Text: 35e.       3.11                          未定                          gh-92332(3)
                                                                                          
                                                                                          
*note typing.Hashable: 717.、 3.12                          未定                          gh-94309(4)
*note typing.Sized: 718.                                                                  

*note typing.TypeAlias: 9d0.  3.12                          未定                          PEP 695(5)
                                                                                          
                                                                                          
*note @typing.no_type_check_decorator: 331.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 --- 型ヒントのサポート,  Up: 開発ツール

5.27.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__: b25. 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(): 1998.).

The built-in function *note help(): ad8. 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’ を指定すると、任意の空きポートが
選択されます。

     警告: The ‘pydoc’ HTTP server is intended for local use during
     development and is not suitable for production use.

‘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(): 231.
rather than *note inspect.getfullargspec(): 945. 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.27.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: 170. command line option or by
setting the *note PYTHONDEVMODE: ceb. 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.27.3.1 Python 開発モードの影響
................................

Python 開発モードを有効化することは次のコマンドに似ていますが、以下で説
明される追加の影響があります:

     PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler

Python 開発モードの影響:

   * ‘default’ の *note 警告フィルタ: 2185. を追加します。次の警告が表示
     されます:

        * *note DeprecationWarning: 1a4.

        * *note ImportWarning: 71e.

        * *note PendingDeprecationWarning: ac9.

        * *note ResourceWarning: 54c.

     通常、上記の警告は デフォルトの *note 警告フィルタ: 2185. によりフ
     ィルタリングされます。

     It behaves as if the *note -W default: aca. command line option is
     used.

     Use the *note -W error: aca. command line option or set the *note
     PYTHONWARNINGS: da7. 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(): e68. C function.

     It behaves as if the *note PYTHONMALLOC: e62. environment variable
     is set to ‘debug’.

     To enable the Python Development Mode without installing debug
     hooks on memory allocators, set the *note PYTHONMALLOC: e62.
     environment variable to ‘default’.

   * Call *note faulthandler.enable(): 211. at Python startup to install
     handlers for the *note SIGSEGV: 1290, *note SIGFPE: 1291, *note
     SIGABRT: 1292, *note SIGBUS: 1293. and *note SIGILL: 1294. signals
     to dump the Python traceback on a crash.

     It behaves as if the *note -X faulthandler: 170. command line
     option is used or if the *note PYTHONFAULTHANDLER: 1295.
     environment variable is set to ‘1’.

   * Enable *note asyncio debug mode: 2195.  For example, *note asyncio:
     b. checks for coroutines that were not awaited and logs them.

     It behaves as if the *note PYTHONASYNCIODEBUG: 2194. environment
     variable is set to ‘1’.

   * Check the 'encoding' and 'errors' arguments for string encoding and
     decoding operations.  Examples: *note open(): 318, *note
     str.encode(): ad6. and *note bytes.decode(): ad7.

     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: 1ede. attribute of *note sys.flags: 89d. to
     ‘True’.

The Python Development Mode does not enable the *note tracemalloc: 106.
module by default, because the overhead cost (to performance and memory)
would be too large.  Enabling the ‘tracemalloc’ 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: 18d. command
line option from removing *note assert: b64. statements nor from setting
*note __debug__: 9de. 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: 89d.

バージョン 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.27.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: 106. 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.27.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.27.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: 1b9.

* 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.27.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(): 168b. に渡せば、詳細報告 (verbose) モ
ードを強制できます。また、 ‘verbose=False’ にすれば禁止できます。どちら
の場合にも、 ‘testmod()’ は *note sys.argv: 1480. 上のスイッチを調べませ
ん。(したがって、 ‘-v’ をつけても効果はありません)。

There is also a command line shortcut for running *note testmod(): 168b,
see section *note コマンドラインでの使用: 48dd.

*note testmod(): 168b. の詳しい情報は *note 基本 API: 48de. 節を参照して
ください。


File: python.info,  Node: 簡単な利用法 テキストファイル中の実行例をチェックする,  Next: コマンドラインでの使用<6>,  Prev: 簡単な利用法 docstring 中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.27.4.2 簡単な利用法: テキストファイル中の実行例をチェックする
...............................................................

doctest のもう一つの簡単な用途は、テキストファイル中にある対話実行例に対
するテストです。これには *note testfile(): 48e1. 関数を使います:

     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(): 168b. と同じく、 *note testfile(): 48e1. は実行例が失敗
しない限り何も表示しません。実行例が失敗すると、失敗した実行例とその原因
が (場合によっては複数) ‘testmod()’ と同じ書式で標準出力に書き出されます
。

デフォルトでは、 *note testfile(): 48e1. は自分自身を呼び出したモジュー
ルのあるディレクトリを探します。その他の場所にあるファイルを見に行くよう
に ‘testfile()’ に指示するためのオプション引数についての説明は *note 基本
API: 48de. 節を参照してください。

*note testmod(): 168b. と同様に *note testfile(): 48e1. の冗長性
(verbosity) はコマンドラインスイッチ ‘-v’ またはオプションのキーワード引
数 'verbose' によって指定できます。

There is also a command line shortcut for running *note testfile():
48e1, see section *note コマンドラインでの使用: 48dd.

*note testfile(): 48e1. の詳細は *note 基本 API: 48de. 節を参照してくだ
さい。


File: python.info,  Node: コマンドラインでの使用<6>,  Next: doctest のからくり,  Prev: 簡単な利用法 テキストファイル中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.27.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(): 168b. を実行します。このファイルがパッケ
     ージの一部で他のサブモジュールをそのパッケージからインポートしてい
     る場合はうまく動かないことに注意してください。

     If the file name does not end with ‘.py’, ‘doctest’ infers that it
     must be run with *note testfile(): 48e1. instead:

          python -m doctest -v example.txt

 -- Option: -o, --option <option>

     Option flags control various aspects of doctest's behavior, see
     section *note オプションフラグ: 1138.

     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.27.4.4 doctest のからくり
...........................

この節では、doctest のからくり: どの docstring を見に行くのか、どのよう
に対話実行例を見つけ出すのか、どんな実行コンテキストを使うのか、例外をど
う扱うか、上記の振る舞いを制御するためにどのようなオプションフラグを使う
か、について詳しく吟味します。こうした情報は、doctest に対応した実行例を
書くために必要な知識です; 書いた実行例に対して実際に doctest を実行する
上で必要な情報については後続の節を参照してください。

* Menu:

* どの docstring が検証されるのか?::
* docstring 内の実行例をどのように認識するのか?::
* 実行コンテキストとは何か?::
* 例外はどう扱えばよいか?::
* オプションフラグ::
* ディレクティブ (Directives): ディレクティブ Directives.
* 警告: 警告<2>.


File: python.info,  Node: どの docstring が検証されるのか?,  Next: docstring 内の実行例をどのように認識するのか?,  Up: doctest のからくり

5.27.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.27.4.6 docstring 内の実行例をどのように認識するのか?
......................................................

ほとんどの場合、対話コンソールセッション上でのコピー／ペーストはうまく動
作します。とはいえ、‘doctest’ は特定の 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: 48f0. オプ
     ションか *note directive: 48f1. を有効にするしかありません。そうす
     る代わりに、テストが出力を読み取りテストの一部として期待される値と
     正しく比較するように、テストを書き直すこともできます。このソース中
     のタブの扱いは試行錯誤の結果であり、タブの扱いの中で最も問題の起き
     にくいものだということが分かっています。タブの扱いについては、独自
     の *note DocTestParser: 48f2. クラスを実装して、別のアルゴリズムを
     使うこともできます。

   * 標準出力への出力は取り込まれますが、標準エラーは取り込まれません (例
     外発生時のトレースバックは別の方法で取り込まれます)。

   * 対話セッションにおいて、バックスラッシュを用いて次の行に続ける場合
     や、その他の理由でバックスラッシュを用いる場合、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.27.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(): 168b. や *note testfile(): 48e1. に ‘globs=your_dict’ を
渡し、自前の辞書を実行コンテキストとして使うこともできます。


File: python.info,  Node: 例外はどう扱えばよいか?,  Next: オプションフラグ,  Prev: 実行コンテキストとは何か?,  Up: doctest のからくり

5.27.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: 2ee. が送出され、その詳細情報が
‘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: 2ee. から始まる行) における例
外の型と詳細情報だけが比較され、それ以外の部分は無視されます。

例外を扱うコツは、実行例をドキュメントとして読む上で明らかに価値のある情
報でない限り、トレースバックスタックは省略する、ということです。したがっ
て、先ほどの例は以下のように書くべきでしょう:

     >>> raise ValueError('multi\n    line\ndetail')
     Traceback (most recent call last):
         ...
     ValueError: multi
         line
     detail

トレースバックの扱いは非常に特殊なので注意してください。特に、上の書き直
した実行例では、 ‘...’ の扱いは doctest の *note ELLIPSIS: 168c. オプシ
ョンとは独立しています。この例での省略記号は何かの省略を表しているかもし
れませんし、コンマや数字が 3 個 (または 300 個) かもしれませんし、 Monty
Python のスキットをインデントして書き写したものかもしれません。

以下の詳細はずっと覚えておく必要はないのですが、一度目を通しておいてくだ
さい:

   * doctest は期待する出力の出所が print 文なのか例外なのかを推測できま
     せん。したがって、例えば期待する出力が ‘ValueError: 42 is prime’ で
     あるような実行例は、 *note ValueError: 2ee. が実際に送出された場合
     と、万が一期待する出力と同じ文字列を print した場合の両方で成功して
     しまいます。現実的には、通常の出力がトレースバックヘッダから始まる
     ことはないので、実際に問題になることはないでしょう。

   * トレースバックスタック (がある場合) の各行は、実行例の最初の行より
     も深くインデントされているか、'または' 英数文字以外で始まっていなけ
     ればなりません。トレースバックヘッダ以後に現れる行のうち、インデン
     トが等しく英数文字で始まる最初の行は例外の詳細情報が書かれた行とみ
     なされるからです。もちろん、本物のトレースバックでは正しく動作しま
     す。

   * doctest のオプション *note IGNORE_EXCEPTION_DETAIL: 1524. を指定し
     た場合、最も左端のコロン以後の全ての内容と、例外名の中の全てのモジ
     ュール情報が無視されます。

   * 対話シェルでは、 *note SyntaxError: 18f. の場合にトレースバックヘッ
     ダが省略されることがあります。しかし 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.27.4.9 オプションフラグ
.........................

doctest の振る舞いは、数多くのオプションフラグによって様々な側面から制御
されています。フラグのシンボル名はモジュールの定数として提供され、 *note
ビット単位論理和: 252d. でつないで様々な関数に渡すことができます。シンボ
ル名は *note doctest directives: 48f1. でも使用でき、doctest コマンドラ
インインターフェースに ‘-o’ を通して与えることができます。

最初に説明するオプション群は、テストのセマンティクスを決めます。すなわち
、実際にテストを実行したときの出力と実行例中の期待する出力とが一致してい
るかどうかを doctest がどのように判断するかを制御します:

 -- データ: doctest.DONT_ACCEPT_TRUE_FOR_1

     デフォルトでは、期待する出力ブロックに単に ‘1’ だけが入っており、実
     際の出力ブロックに ‘1’ または ‘True’ だけが入っていた場合、これらの
     出力は一致しているとみなされます。 ‘0’ と ‘False’ の場合も同様です
     。 *note DONT_ACCEPT_TRUE_FOR_1: 48f9. を指定すると、こうした値の読
     み替えを行いません。デフォルトの挙動で読み替えを行うのは、最近の
     Python で多くの関数の戻り値型が整数型からブール型に変更されたことに
     対応するためです; 読み替えを行う場合、"通常の整数" の出力を期待する
     出力とするような doctest も動作します。このオプションはそのうちなく
     なるでしょうが、ここ数年はそのままでしょう。

 -- データ: doctest.DONT_ACCEPT_BLANKLINE

     デフォルトでは、期待する出力ブロックに ‘<BLANKLINE>’ だけの入った行
     がある場合、その行は実際の出力における空行に一致するようになります
     。完全な空行を入れてしまうと期待する出力がそこで終わっているとみな
     されてしまうため、期待する出力に空行を入れたい場合にはこの方法を使
     わなければなりません。 *note DONT_ACCEPT_BLANKLINE: 48fa. を指定す
     ると、 ‘<BLANKLINE>’ の読み替えを行わなくなります。

 -- データ: doctest.NORMALIZE_WHITESPACE

     このフラグを指定すると、連続する空白 (空白と改行文字) は互いに等価
     であるとみなします。期待する出力における任意の空白列は実際の出力に
     おける任意の空白と一致します。デフォルトでは、空白は厳密に一致しな
     ければなりません。 *note NORMALIZE_WHITESPACE: 48f0. は、期待する出
     力の内容が非常に長いために、ソースコード中でその内容を複数行に折り
     返して書きたい場合に特に便利です。

 -- データ: 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: 199. 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: 168c. 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 で変更: ‘doctest’ モジュールの *note
     IGNORE_EXCEPTION_DETAIL: 1524. フラグが、 テストされている例外を含
     むモジュールの名前を無視するようになりました。

 -- データ: 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: 48fd. を
     指定した場合、実行例がどこかで失敗しても、それ以後の実行例を続けて
     実行し、失敗したテストの総数を報告します; 出力が抑制されるだけです
     。

 -- データ: 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(): 48ff. は *note
     OutputChecker: 4900. や *note DocTestRunner: 4901. をサブクラス化し
     て、その中で新たに作成したオプションをサポートさせる際に使います。
     ‘register_optionflag()’ は以下のような定形文で呼び出さなければなり
     ません:

          MY_FLAG = register_optionflag('MY_FLAG')


File: python.info,  Node: ディレクティブ Directives,  Next: 警告<2>,  Prev: オプションフラグ,  Up: doctest のからくり

5.27.4.10 ディレクティブ (Directives)
.....................................

doctest ディレクティブは個々の実行例の *note オプションフラグ: 1138. を
操作するために使われます。 doctest ディレクティブは後のソースコード例に
あるような特殊な Python コメントです:

     directive:             "#" "doctest:" *note directive_options: 4904.
     directive_options:     *note directive_option: 4905. ("," *note directive_option: 4905.)*
     directive_option:      *note on_or_off: 4906. *note directive_option_name: 4907.
     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.27.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: 168c. ディレクティブを使うと、上のような例をうまく解決で
きます:

     >>> 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.27.4.12 基本 API
..................

数 *note testmod(): 168b. と *note testfile(): 48e1. は、ほとんどの基本
的な用途に十分な doctest インターフェースを提供しています。これら二つの
関数についてあまり形式的でない入門が読みたければ、 *note 簡単な利用法;
docstring 中の実行例をチェックする: 48db. 節や *note 簡単な利用法;
テキストファイル中の実行例をチェックする: 48df. 節を参照してください。

 -- の関数: 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(): 48e1. を呼び出しているモジ
          ュールからの相対パスになります; ただし、'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(): 1683. のように振舞います: 'globs' と 'extraglobs' と
     の間に同じキー値がある場合、両者を合わせた辞書中には 'extraglobs' の
     方の値が入ります。デフォルト、または ‘None’ であるとき、追加のグロ
     ーバル変数は使われません。この仕様は、パラメータ付きで doctest を実
     行するという、やや進んだ機能です。例えば、一般的な名前を使って基底
     クラス向けに doctest を書いておき、その後で辞書で一般的な名前からテ
     ストしたいサブクラスへの対応付けを行う辞書を 'extraglobs' に渡して
     、様々なサブクラスをテストできます。

     オプション引数 'verbose' が真の場合、様々な情報を出力します。偽の場
     合にはテストの失敗だけを報告します。デフォルトの場合や ‘None’ を指
     定した場合、*note sys.argv: 1480. に ‘'-v'’ を指定しない限りこの値
     は真になりません。

     オプション引数 'report' が真の場合、テストの最後にサマリを出力しま
     す。それ以外の場合には何も出力しません。verbose モードの場合、サマ
     リには詳細な情報を出力しますが、そうでない場合にはサマリはとても簡
     潔になります (実際には、すべてのテストが成功した場合には何も出力し
     ません)。

     オプション引数 'optionflags' (デフォルト値 ‘0’) は、各オプションフ
     ラグの *note ビット単位論理和: 252d. を取ります。 *note
     オプションフラグ: 1138. 節を参照してください。

     オプション引数 'raise_on_error' の値はデフォルトでは偽です。真にす
     ると、最初のテスト失敗や予期しない例外が起きたときに例外を送出しま
     す。このオプションを使うと、失敗の原因を検死デバッグ (post-mortem
     debug) できます。デフォルトの動作では、実行例の実行を継続します。

     オプション引数 'parser' には、 *note DocTestParser: 48f2. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘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: 490b. と *note testmod(): 168b. を
     合わせて利用しているようなコードでも、テスト実行例を持たないオブジ
     ェクトから出力を得るようにしています。新たに追加された *note
     DocTestFinder: 1a06. のコンストラクタの 'exclude_empty' はデフォル
     トで真になります。

     オプション引数 'extraglobs', 'verbose', 'report', 'optionflags',
     'raise_on_error', および 'globs' は上で説明した *note testfile():
     48e1. の引数と同じです。ただし、 '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(): 48e1.
     と同様の働きをします。


File: python.info,  Node: 単体テスト API,  Next: 拡張 API,  Prev: 基本 API,  Up: doctest --- 対話型の Python の例をテストする

5.27.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: 10d. test suites from modules
and text files containing doctests.  To integrate with ‘unittest’ test
discovery, include a *note load_tests: 490f. 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: ff9. インスタンスを生成するための主な関数は二つあり
ます:

 -- の関数: doctest.DocFileSuite (*paths, module_relative=True,
          package=None, setUp=None, tearDown=None, globs=None,
          optionflags=0, parser=DocTestParser(), encoding=None)

     単一または複数のテキストファイルに入っている doctest 形式のテストを
     、 *note unittest.TestSuite: ff9. インスタンスに変換します。

     The returned *note unittest.TestSuite: ff9. 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: 4911. 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(): 4910. には、キーワード引数でオプションを指定
     できます:

     オプション引数 '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: 1a8b. オブジェクトに引き渡され
     ます。 'setUp' は *note globs: 4912. 属性を介してテストのグローバル
     変数にアクセスできます。

     オプション引数 'tearDown' には、テストを解体 (tear-down) するための
     関数を指定します。この関数は、各ファイルのテストの実行を終了するた
     びに呼び出されます。 'tearDown' 関数は *note DocTest: 1a8b. オブジ
     ェクトに引き渡されます。 'tearDown' は *note globs: 4912. 属性を介
     してテストのグローバル変数にアクセスできます。

     オプション引数 'globs' は辞書で、テストのグローバル変数の初期値が入
     ります。この辞書は各テストごとに新たにコピーして使われます。デフォ
     ルトでは 'globs' は空の新たな辞書です。

     オプション引数 'optionflags' には、テストを実行する際にデフォルトで
     適用される doctest オプションを OR で結合して指定します。 *note
     オプションフラグ: 1138. 節を参照してください。結果レポートに関する
     オプションを指定するより適切な方法は下記の *note
     set_unittest_reportflags(): 4913. の説明を参照してください。

     オプション引数 'parser' には、 *note DocTestParser: 48f2. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘DocTestParser()’)
     です。

     オプション引数 'encoding' にはファイルをユニコードに変換する際に使
     われるエンコーディングを指定します。

     *note DocFileSuite(): 4910. を使用してテキストファイルからロードさ
     れた 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: ff9. に変換します。

     The returned *note unittest.TestSuite: ff9. 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: 4911. 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__: 23cb.

     オプション引数 'extraglobs' には追加のグローバル変数セットを指定し
     ます。この変数セットは 'globs' に統合されます。デフォルトでは、追加
     のグローバル変数はありません。

     オプション引数 'test_finder' は、モジュールから doctest を抽出する
     ための *note DocTestFinder: 1a06. オブジェクト (またはその代替とな
     るオブジェクト) です。

     Optional arguments 'setUp', 'tearDown', and 'optionflags' are the
     same as for function *note DocFileSuite(): 4910. above, but they
     are called for each docstring.

     この関数は *note testmod(): 168b. と同じ検索方法を使います。

     バージョン 3.5 で変更: 'module' がドキュメンテーション文字列を含ま
     ない場合には、 *note DocTestSuite(): ff8. は *note ValueError: 2ee.
     を送出するのではなく空の *note unittest.TestSuite: ff9. を返します
     。

Under the covers, *note DocTestSuite(): ff8. creates a *note
unittest.TestSuite: ff9. out of ‘doctest.DocTestCase’ instances, and
‘DocTestCase’ is a subclass of *note unittest.TestCase: 2b5.
‘DocTestCase’ isn't documented here (it's an internal detail), but
studying its code can answer questions about the exact details of *note
unittest: 10d. integration.

Similarly, *note DocFileSuite(): 4910. creates a *note
unittest.TestSuite: ff9. out of ‘doctest.DocFileCase’ instances, and
‘DocFileCase’ is a subclass of ‘DocTestCase’.

So both ways of creating a *note unittest.TestSuite: ff9. 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: 10d. 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: 10d. support, via this function:

 -- の関数: doctest.set_unittest_reportflags (flags)

     Set the ‘doctest’ reporting flags to use.

     引数 'flags' はオプションフラグの *note ビット単位論理和: 252d. を
     取ります。 *note オプションフラグ: 1138. 節を参照してください。「レ
     ポートフラグ」しか使えません。

     This is a module-global setting, and affects all future doctests
     run by module *note unittest: 10d.: 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:
     252d. into the option flags, and the option flags so augmented are
     passed to the *note DocTestRunner: 4901. 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: 10d.
     レポートフラグの値を返します。


File: python.info,  Node: 拡張 API,  Next: デバッグ,  Prev: 単体テスト API,  Up: doctest --- 対話型の Python の例をテストする

5.27.4.14 拡張 API
..................

基本 API は、doctest を使いやすくするための簡単なラッパであり、柔軟性が
あってほとんどのユーザの必要を満たしています; とはいえ、もっとテストをき
め細かに制御したい場合や、doctest の機能を拡張したい場合、拡張 API
(advanced API) を使わなければなりません。

拡張 API は、doctest ケースから抽出した対話モードでの実行例を記憶するた
めの二つのコンテナクラスを中心に構成されています:

   * *note Example: 4916.: 1つの Python *note 文: 2c78. と、その期待する
     出力をペアにしたもの。

   * *note DocTest: 1a8b.: *note Example: 4916. の集まり。通常一つの
     docstring やテキストファイルから抽出されます。

その他に、doctest の実行例を検索、構文解析、実行、チェックするための処理
クラスが以下のように定義されています:

   * *note DocTestFinder: 1a06.: 与えられたモジュールからすべての
     docstring を検索し、 *note DocTestParser: 48f2. を使って対話モード
     での実行例が入ったすべての docstring から *note DocTest: 1a8b. を生
     成します。

   * *note DocTestParser: 48f2.: (オブジェクトの docstring 等の) 文字列
     から *note DocTest: 1a8b. オブジェクトを生成します。

   * *note DocTestRunner: 4901.: *note DocTest: 1a8b. 内の実行例を実行し
     、 *note OutputChecker: 4900. を使って出力を検証します。

   * *note OutputChecker: 4900.: 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.27.4.15 DocTest オブジェクト
..............................

 -- クラス: doctest.DocTest (examples, globs, name, filename, lineno,
          docstring)

     単一の名前空間内で実行される doctest 実行例の集まりです。コンストラ
     クタの引数は *note DocTest: 1a8b. インスタンス中の同名の属性の初期
     化に使われます。

     *note DocTest: 1a8b. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: examples

          対話モードにおける実行例それぞれをエンコードしていて、テストで
          実行される、 *note Example: 4916. オブジェクトからなるリストで
          す。

      -- の属性: globs

          実行例を実行する名前空間 (いわゆるグローバル変数) です。このメ
          ンバは、名前から値への対応付けを行っている辞書です。実行例が名
          前空間に対して (新たな変数を束縛するなど) 何らかの変更を行った
          場合、 *note globs: 4912. への反映はテストの実行後に起こります
          。

      -- の属性: name

          *note DocTest: 1a8b. を識別する名前の文字列です。通常、この値
          はテストを取り出したオブジェクトかファイルの名前になります。

      -- の属性: filename

          The name of the file that this ‘DocTest’ was extracted from;
          or ‘None’ if the filename is unknown, or if the ‘DocTest’ was
          not extracted from a file.

      -- の属性: lineno

          *note filename: 491b. 中で *note DocTest: 1a8b. のテスト実行例
          が始まっている行の行番号で、行番号が利用できなければ ‘None’ で
          す。行番号は、ファイルの先頭を 0 として数えます。

      -- の属性: docstring

          テストを取り出した docstring 自体を現す文字列です。docstring 文
          字列を得られない場合や、文字列からテスト実行例を取り出したので
          ない場合には ‘None’ になります。


File: python.info,  Node: Example オブジェクト,  Next: DocTestFinder オブジェクト,  Prev: DocTest オブジェクト,  Up: 拡張 API

5.27.4.16 Example オブジェクト
..............................

 -- クラス: doctest.Example (source, want, exc_msg=None, lineno=0,
          indent=0, options=None)

     ひとつの Python 文と、それに対する期待する出力からなる、単一の対話
     的モードの実行例です。コンストラクタの引数は *note Example: 4916. イ
     ンスタンス中の同名の属性の初期化に使われます。

     *note Example: 4916. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: source

          実行例のソースコードが入った文字列です。ソースコードは単一の
          Python で、末尾は常に改行です。コンストラクタは必要に応じて改
          行を追加します。

      -- の属性: want

          実行例のソースコードを実行した際の期待する出力 (標準出力と、例
          外が生じた場合にはトレースバック) です。 *note want: 4920. の
          末尾は、期待する出力がまったくない場合を除いて常に改行になりま
          す。期待する出力がない場合には空文字列になります。コンストラク
          タは必要に応じて改行を追加します。

      -- の属性: exc_msg

          実行例が例外を生成すると期待される場合の例外メッセージです。例
          外を送出しない場合には ‘None’ です。この例外メッセージは、
          *note traceback.format_exception_only(): a52. の戻り値と比較さ
          れます。値が ‘None’ でない限り、 *note exc_msg: 4921. は改行で
          終わっていなければなりません; コンストラクタは必要に応じて改行
          を追加します。

      -- の属性: 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:
          4901.'s *note optionflags: 1138.).  By default, no options are
          set.


File: python.info,  Node: DocTestFinder オブジェクト,  Next: DocTestParser オブジェクト,  Prev: Example オブジェクト,  Up: 拡張 API

5.27.4.17 DocTestFinder オブジェクト
....................................

 -- クラス: doctest.DocTestFinder (verbose=False,
          parser=DocTestParser(), recurse=True, exclude_empty=True)

     与えられたオブジェクトについて、そのオブジェクト自身の docstring か
     、そのオブジェクトに含まれるオブジェクトの docstring から *note
     DocTest: 1a8b. を抽出する処理クラスです。モジュール、クラス、関数、
     メソッド、静的メソッド、クラスメソッド、プロパティから ‘DocTest’ を
     抽出できます。

     オプション引数 'verbose' を使うと、抽出処理の対象となるオブジェクト
     を表示できます。デフォルトは ‘False’ (出力を行わない) です。

     オプション引数 'parser' には、 docstring から *note DocTest: 1a8b.
     を抽出するのに使う *note DocTestParser: 48f2. オブジェクト (または
     その代替となるオブジェクト) を指定します。

     オプション引数 'recurse' が偽の場合、 *note DocTestFinder.find():
     1ad0. は与えられたオブジェクトだけを調べ、そのオブジェクトに含まれ
     る他のオブジェクトを調べません。

     オプション引数 'exclude_empty' が偽の場合、 *note
     DocTestFinder.find(): 1ad0. は空の docstring を持つオブジェクトもテ
     スト対象に含めます。

     *note DocTestFinder: 1a06. では以下のメソッドを定義しています:

      -- メソッド: find (obj[, name][, module][, globs][, extraglobs])

          'obj' または 'obj' 内に入っているオブジェクトの docstring 中で
          定義されている *note DocTest: 1a8b. のリストを返します。

          オプション引数 'name' には、オブジェクトの名前を指定します。こ
          の名前は、関数が返す *note DocTest: 1a8b. の名前になります。
          'name' を指定しない場合、 ‘obj.__name__’ を使います。

          オプションのパラメータ 'module' は、指定したオブジェクトを収め
          ているモジュールを指定します。 'module' を指定しないか、‘None’
          を指定した場合には、正しいモジュールを自動的に決定しようと試み
          ます。 オブジェクトのモジュールは以下のような役割を果たします:

             * 'globs' を指定していない場合、オブジェクトのモジュールは
               デフォルトの名前空間になります。

             * 他のモジュールから import されたオブジェクトに対して
               *note DocTestFinder: 1a06. が *note DocTest: 1a8b. を抽出
               するのを避けるために使います。 ('module' 由来でないオブジ
               ェクトを無視します。)

             * オブジェクトの入っているファイル名を調べるために使います
               。

             * オブジェクトがファイル内の何行目にあるかを調べる手助けに
               します。

          'module' が ‘False’ の場合には、モジュールの検索を試みません。
          これは正確さを欠くような使い方で、通常 doctest 自体のテストに
          しか使いません。'module' が ‘False’ の場合、または 'module' が
          ‘None’ で自動的に的確なモジュールを見つけ出せない場合には、す
          べてのオブジェクトは ‘(non-existent)’ モジュールに属するとみな
          され、そのオブジェクト内のすべてのオブジェクトに対して (再帰的
          に) doctest の検索を行います。

          The globals for each *note DocTest: 1a8b. 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__: 23cb, 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.27.4.18 DocTestParser オブジェクト
....................................

 -- クラス: doctest.DocTestParser

     対話モードの実行例を文字列から抽出し、それを使って *note DocTest:
     1a8b. オブジェクトを生成するために使われる処理クラスです。

     *note DocTestParser: 48f2. では以下のメソッドを定義しています:

      -- メソッド: get_doctest (string, globs, name, filename, lineno)

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          DocTest: 1a8b. オブジェクト内に集めます。

          'globs', 'name', 'filename', and 'lineno' are attributes for
          the new ‘DocTest’ object.  See the documentation for *note
          DocTest: 1a8b. for more information.

      -- メソッド: get_examples (string, name='<string>')

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          Example: 4916. オブジェクトからなるリストにして返します。各
          ‘Example’ の行番号は 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: 4916.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.27.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.27.4.20 DocTestRunner オブジェクト
....................................

 -- クラス: doctest.DocTestRunner (checker=None, verbose=None,
          optionflags=0)

     *note DocTest: 1a8b. 内の対話モード実行例を実行し、検証する際に用い
     られる処理クラスです。

     The comparison between expected outputs and actual outputs is done
     by an *note OutputChecker: 4900.  This comparison may be customized
     with a number of option flags; see section *note オプションフラグ:
     1138. 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(): 4932, *note report_success(): 4933, *note
     report_unexpected_exception(): 4934, and *note report_failure():
     4935.

     オプションのキーワード引数 'checker' には、 *note OutputChecker:
     4900. オブジェクト (またはその代替となるオブジェクト) を指定します
     。このオブジェクトは doctest 実行例の期待する出力と実際の出力との比
     較を行う際に使われます。

     オプションのキーワード引数 'verbose' は、 *note DocTestRunner:
     4901. の出すメッセージの冗長性を制御します。 'verbose' が ‘True’ の
     場合、各実行例を実行する都度、その実行例についての情報を出力します
     。 'verbose' が ‘False’ の場合、テストの失敗だけを出力します。
     'verbose' を指定しない場合や ‘None’ を指定した場合、コマンドライン
     スイッチ ‘-v’ を使った場合にのみ 'verbose' 出力を適用します。

     オプションのキーワード引数 'optionflags' を使うと、テストランナーが
     期待される出力と実際の出力を比較する方法や、テストの失敗を表示する
     方法を制御できます。詳しくは *note オプションフラグ: 1138. 節を参照
     してください。

     The test runner accumulates statistics.  The aggregated number of
     attempted, failed and skipped examples is also available via the
     *note tries: 4936, *note failures: 4937. and *note skips: 4ef.
     attributes.  The *note run(): 4ee. and *note summarize(): 490b.
     methods return a *note TestResults: 492d. instance.

     ‘DocTestRunner’ defines the following methods:

      -- メソッド: report_start (out, test, example)

          テストランナーが実行例を処理しようとしているときにレポートを出
          力します。 *note DocTestRunner: 4901. の出力をサブクラスでカス
          タマイズできるようにするためのメソッドです。直接呼び出してはな
          りません。

          '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: 4901. のサブクラスで出力をカスタマイズ
          できるようにするために提供されています; 直接呼び出してはなりま
          せん。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee. に渡
          されます。

      -- メソッド: report_failure (out, test, example, got)

          与えられた実行例が正しく動作しなかったことを報告します。このメ
          ソッドは *note DocTestRunner: 4901. のサブクラスで出力をカスタ
          マイズできるようにするために提供されています; 直接呼び出しては
          なりません。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee. に渡
          されます。

      -- メソッド: report_unexpected_exception (out, test, example,
               exc_info)

          与えられた実行例が期待とは違う例外を送出したことを報告します。
          このメソッドは *note DocTestRunner: 4901. のサブクラスで出力を
          カスタマイズできるようにするために提供されています; 直接呼び出
          してはなりません。

          'example' は処理する実行例です。 'exc_info' には予期せず送出さ
          れた例外の情報を入れたタプル (*note sys.exc_info(): 89b. の返
          す内容) になります。 'test' は 'example' の入っているテストで
          す。 'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee.
          に渡されます。

      -- メソッド: run (test, compileflags=None, out=None,
               clear_globs=True)

          Run the examples in 'test' (a *note DocTest: 1a8b. object),
          and display the results using the writer function 'out'.
          Return a *note TestResults: 492d. instance.

          実行例は名前空間 ‘test.globs’ の下で実行されます。
          'clear_globs' が真 (デフォルト) の場合、名前空間はテストの実行
          後に消去され、ガベージコレクションを促します。テストの実行完了
          後にその内容を調べたければ、'clear_globs=False' としてください
          。

          'compileflags' には、実行例を実行する際に Python コンパイラに
          適用するフラグセットを指定します。'compileflags' を指定しない
          場合、デフォルト値は 'globs' で適用されている future-import フ
          ラグセットになります。

          The output of each example is checked using the
          ‘DocTestRunner’'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: 492d.
          instance.

          オプションの 'verbose' 引数を使うと、どのくらいサマリを詳しく
          するかを制御できます。冗長度を指定しない場合、 *note
          DocTestRunner: 4901. 自体の冗長度を使います。

     *note DocTestParser: 48f2. 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.27.4.21 OutputChecker オブジェクト
....................................

 -- クラス: doctest.OutputChecker

     doctest 実行例を実際に実行したときの出力が期待する出力と一致するか
     どうかをチェックするために使われるクラスです。 *note OutputChecker:
     4900. では、与えられた二つの出力を比較して、一致する場合には ‘True’
     を返す *note check_output(): 493a. と、二つの出力間の違いを説明する
     文字列を返す *note output_difference(): 493b. の、二つのメソッドが
     あります。

     *note OutputChecker: 4900. では以下のメソッドを定義しています:

      -- メソッド: check_output (want, got, optionflags)

          実行例から実際に得られた出力 ('got') と、期待する出力 ('want')
          が一致する場合にのみ ‘True’ を返します。二つの文字列がまったく
          同一の場合には常に一致するとみなしますが、テストランナーの使っ
          ているオプションフラグにより、厳密には同じ内容になっていなくて
          も一致するとみなす場合もあります。オプションフラグについての詳
          しい情報は *note オプションフラグ: 1138. 節を参照してください
          。

      -- メソッド: output_difference (example, got, optionflags)

          与えられた実行例 ('example') の期待する出力と、実際に得られた
          出力 ('got') の間の差異を解説している文字列を返します。
          'optionflags' は 'want' と 'got' を比較する際に使われるオプシ
          ョンフラグのセットです。


File: python.info,  Node: デバッグ,  Next: アドバイス,  Prev: 拡張 API,  Up: doctest --- 対話型の Python の例をテストする

5.27.4.22 デバッグ
..................

‘doctest’ では、doctest 実行例をデバッグするメカニズムをいくつか提供して
います:

   * doctest を実行可能な Python プログラムに変換し、 Python デバッガ
     *note pdb: aa. で実行できるようにするための関数がいくつかあります。

   * *note DocTestRunner: 4901. のサブクラス *note DebugRunner: 493e. ク
     ラスがあります。このクラスは、最初に失敗した実行例に対して例外を送
     出します。例外には実行例に関する情報が入っています。この情報は実行
     例の検死デバッグに利用できます。

   * *note DocTestSuite(): ff8. の生成する *note unittest: 10d. テストケ
     ースは、 *note debug(): 493f. メソッドをサポートしています。
     ‘debug()’ は *note unittest.TestCase: 2b5. で定義されています。

   * *note pdb.set_trace(): 274. を 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(): 4940. 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(): 4941. と同じ
     です。指定したオブジェクトの docstring から合成された Python スクリ
     プトは一時ファイルに書き出され、その後 Python デバッガ *note pdb:
     aa. の制御下で実行されます。

     ローカルおよびグローバルの実行コンテキストには、‘module.__dict__’ の
     浅いコピーが使われます。

     オプション引数 'pm' は、検死デバッグを行うかどうかを指定します。
     'pm' が真の場合、スクリプトファイルは直接実行され、スクリプトが送出
     した例外が処理されないまま終了した場合にのみデバッガが立ち入ります
     。その場合、 *note pdb.post_mortem(): 15f8. によって検死デバッグを
     起動し、処理されなかった例外から得られたトレースバックオブジェクト
     を渡します。 'pm' を指定しないか値を偽にした場合、 *note pdb.run():
     4942. に適切な *note exec(): 4a2. 呼び出しを渡して、最初からデバッ
     ガの下でスクリプトを実行します。

 -- の関数: doctest.debug_src (src, pm=False, globs=None)

     文字列中の doctest をデバッグします。

     上の *note debug(): 493f. に似ていますが、doctest の入った文字列は
     'src' 引数で直接指定します。

     オプション引数 'pm' は上の *note debug(): 493f. と同じ意味です。

     オプション引数 'globs' には、ローカルおよびグローバルな実行コンテキ
     ストの両方に使われる辞書を指定します。'globs' を指定しない場合や
     ‘None’ にした場合、空の辞書を使います。辞書を指定した場合、実際の実
     行コンテキストには浅いコピーが使われます。

*note DebugRunner: 493e. クラス自体や ‘DebugRunner’ クラスが送出する特殊
な例外は、テストフレームワークの作者にとって非常に興味のあるところですが
、ここでは概要しか述べられません。詳しくはソースコード、とりわけ
‘DebugRunner’ の docstring (それ自体 doctest です!)  を参照してください:

 -- クラス: doctest.DebugRunner (checker=None, verbose=None,
          optionflags=0)

     テストの失敗に遭遇するとすぐに例外を送出するようになっている *note
     DocTestRunner: 4901. のサブクラスです。予期しない例外が生じると、
     *note UnexpectedException: 4944. 例外を送出します。この例外には、テ
     スト、実行例、もともと送出された例外が入っています。期待する出力と
     実際の出力が一致しないために失敗した場合には、 *note
     DocTestFailure: 4945. 例外を送出します。この例外には、テスト、実行
     例、実際の出力が入っています。

     コンストラクタのパラメータやメソッドについては、 *note 拡張 API:
     4915. 節の *note DocTestRunner: 4901. のドキュメントを参照してくだ
     さい。

*note DebugRunner: 493e. インスタンスの送出する例外には以下の二つがあり
ます:

 -- 例外: doctest.DocTestFailure (test, example, got)

     doctest 実行例の実際の出力が期待する出力と一致しなかったことを示す
     ために *note DocTestRunner: 4901. が送出する例外です。コンストラク
     タの引数は、インスタンスの同名の属性を初期化するために使われます。

*note DocTestFailure: 4945. では以下の属性を定義しています:

 -- の属性: DocTestFailure.test

     実行例が失敗した時に実行されていた *note DocTest: 1a8b. オブジェク
     トです。

 -- の属性: DocTestFailure.example

     失敗した *note Example: 4916. オブジェクトです。

 -- の属性: DocTestFailure.got

     実行例の実際の出力です。

 -- 例外: doctest.UnexpectedException (test, example, exc_info)

     doctest 実行例が予期しない例外を送出したことを示すために *note
     DocTestRunner: 4901. が送出する例外です。コンストラクタの引数は、イ
     ンスタンスの同名の属性を初期化するために使われます。

*note UnexpectedException: 4944. では以下の属性を定義しています:

 -- の属性: UnexpectedException.test

     実行例が失敗した時に実行されていた *note DocTest: 1a8b. オブジェク
     トです。

 -- の属性: UnexpectedException.example

     失敗した *note Example: 4916. オブジェクトです。

 -- の属性: UnexpectedException.exc_info

     予期しない例外についての情報の入ったタプルで、 *note
     sys.exc_info(): 89b. が返すのと同じものです。


File: python.info,  Node: アドバイス,  Prev: デバッグ,  Up: doctest --- 対話型の Python の例をテストする

5.27.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.

説明テキストの作成をけちらなければ、‘doctest’ は回帰テストの優れたツール
にもなり得ます。説明文と実行例を交互に記述していけば、実際に何をどうして
テストしているのかもっと簡単に把握できるようになるでしょう。もちろん、コ
ードベースのテストに詳しくコメントを入れるのも手ですが、そんなことをする
プログラマはほとんどいません。多くの人々が、‘doctest’ のアプローチをとっ
た方がきれいにテストを書けると気づいています。おそらく、これは単にコード
中にコメントを書くのが少し面倒だからという理由でしょう。私はもう少し穿っ
た見方もしています。doctest ベースのテストを書くときの自然な態度は、自分
のソフトウェアのよい点を説明しようとして、実行例を使って説明しようとする
ときの態度そのものだからだ、という理由です。それゆえに、テストファイルは
自然と単純な機能の解説から始め、論理的により複雑で境界条件的なケースに進
むような形になります。結果的に、一見ランダムに見えるような個別の機能をテ
ストしている個別の関数の集まりではなく、首尾一貫した説明ができるようにな
るのです。‘doctest’ によるテストの作成はまったく別の取り組み方であり、テ
ストと説明の区別をなくして、まったく違う結果を生み出すのです。

回帰テストは特定のオブジェクトやファイルにまとめておくのがよいでしょう。
回帰テストの組み方にはいくつか選択肢があります:

   * テストケースを対話モードの実行例にして入れたテキストファイルを書き
     、 *note testfile(): 48e1. や *note DocFileSuite(): 4910. を使って
     そのファイルをテストします。この方法をお勧めします。最初から
     doctest を使うようにしている新たなプロジェクトでは、この方法が一番
     簡単です。

   * ‘_regrtest_topic’ という名前の関数を定義します。この関数には、ある
     トピックに対応するテストケースの入った docstring が一つだけ入ってい
     ます。この関数はモジュールと同じファイルの中にも置けますし、別のテ
     ストファイルに分けてもかまいません。

   * Define a *note __test__: 48ed. 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.27.5 ‘unittest’ -- ユニットテストフレームワーク
-------------------------------------------------

'ソースコード:' Lib/unittest/__init__.py(1)

__________________________________________________________________

(すでにテストの基本概念について詳しいようでしたら、この部分をとばして
*note アサートメソッド一覧: 4951. に進むと良いでしょう。)

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: 2b5, 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.27.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: 2b5. のサブクラスとして作成し
ます。メソッド名が ‘test’ で始まる三つのメソッドがテストです。テストラン
ナーはこの命名規約によってテストを行うメソッドを検索します。

これらのテスト内では、予定の結果が得られていることを確かめるために *note
assertEqual(): 74c. を、条件のチェックに *note assertTrue(): 74a. や
*note assertFalse(): 74b. を、例外が発生する事を確認するために *note
assertRaises(): 750. をそれぞれ呼び出しています。 *note assert: b64. 文
の代わりにこれらのメソッドを使用すると、テストランナーでテスト結果を集計
してレポートを作成する事ができます。

*note setUp(): 1555. および *note tearDown(): 1556. メソッドによって各テ
ストメソッドの前後に実行する命令を実装することが出来ます。 詳細は *note
テストコードの構成: 4954. を参照してください。

最後のブロックは簡単なテストの実行方法を示しています。 *note
unittest.main(): 11e9. は、テストスクリプトのコマンドライン用インターフ
ェースを提供します。コマンドラインから起動された場合、上記のスクリプトは
以下のような結果を出力します:

     ...
     ----------------------------------------------------------------------
     Ran 3 tests in 0.000s

     OK

‘-v’ オプションをテストスクリプトに渡すことで *note unittest.main():
11e9. はより冗長になり、以下のような出力をします:

     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.27.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 テストディスカバリ: 4956. が開始されます:

     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: 1b9.

* Menu:

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


File: python.info,  Node: コマンドラインオプション<5>,  Up: コマンドラインインターフェイス<2>

5.27.5.3 コマンドラインオプション
.................................

‘unittest’ には以下のコマンドラインオプションがあります:

 -- Option: -b, --buffer

     標準出力と標準エラーのストリームをテストの実行中にバッファします。
     テストが成功している間は結果の出力は破棄されます。テストの失敗やエ
     ラーの場合、出力は通常通り表示され、エラーメッセージに追加されます
     。

 -- Option: -c, --catch

     ‘Control’-‘C’ を実行中のテストが終了するまで遅延させ、そこまでの結
     果を出力します。二回目の ‘Control’-‘C’ は、通常通り *note
     KeyboardInterrupt: bc9. の例外を発生させます。

     この機能の仕組みについては、*note シグナルハンドリング: 495a. を参
     照してください。

 -- Option: -f, --failfast

     初回のエラーもしくは失敗の時にテストを停止します。

 -- Option: -k

     パターンや部分文字列にマッチするテストメソッドとテストクラスのみ実
     行します。このオプションは複数回使うことができ、その場合はすべての
     パターンにマッチするテストケースが実行対象に含まれます。

     ワイルドカード(‘*’) を含むパターンは *note fnmatch.fnmatchcase():
     1cb2. を使用してテスト名と照合され、それ以外の場合は単純な大文字と
     小文字を区別した部分文字列マッチングが使用されます。

     パターンは、テストローダがインポートする時の完全修飾されたテストメ
     ソッド名と照合されます。

     たとえば、 ‘-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.27.5.4 テストディスカバリ
...........................

Added in version 3.2.

unittest はシンプルなテストディスカバリをサポートします。このテストディ
スカバリに対応するために、テストが定義された全ファイルは *note modules:
209a. もしくは *note packages: 20aa. としてプロジェクトの最上位のディス
カバリでインポート可能である必要があります (つまり、これらのファイルは
*note identifiers: 22fc. として有効である必要があるということです)。

テストディスカバリは *note TestLoader.discover(): 11eb. で実装されていま
すが、コマンドラインから使う事も出来ます。その基本的な使い方は:

     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: 4962. 、 *note -p: 4964. 、および *note -t: 4966. オプションは
、この順番であれば位置引数として渡す事ができます。以下の二つのコマンドは
等価です:

     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 プロトコル: 4968. によ
ってテストのロードとディスカバリをカスタマイズすることができます。

バージョン 3.4 で変更: ディスカバリが *note 名前空間パッケージ: 2b4. を
サポートしました。

バージョン 3.11 で変更: Test discovery dropped the *note namespace
packages: 2b4. 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:
2b4. 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.27.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: 2b5.
instances.  To make your own test cases you must write subclasses of
*note TestCase: 2b5. or use *note FunctionTestCase: 1ada.

*note TestCase: 2b5. インスタンスのテストコードは完全に独立していなけれ
ばなりません。 すなわち単独でか、他の様々なテストケースの任意の組み合わ
せのいずれかで実行可能でなければなりません。

最も単純な *note TestCase: 2b5. のサブクラスは、特定のテストコードを実行
するためのテストメソッド (すなわち名前が ‘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: 4951. provided by the *note TestCase: 2b5. 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(): 1555. メソッドを実装することで設定コードをくくり出すこ
とができます。 テストフレームワークは実行するテストごとに自動的に
‘setUp()’ を呼びます:

     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(): 1555. メソッドで例外が発生した場合、フレームワ
ークはそのテストに問題があるとみなし、そのテストメソッドは実行されません
。

同様に、テストメソッド実行後に片付けをする *note tearDown(): 1556. メソ
ッドを提供出来ます:

     import unittest

     class WidgetTestCase(unittest.TestCase):
         def setUp(self):
             self.widget = Widget('The widget')

         def tearDown(self):
             self.widget.dispose()

*note setUp(): 1555. が成功した場合、テストメソッドが成功したかどうかに
関わらず *note tearDown(): 1556. が実行されます。

そのようなテストコードのための作業環境は 'テストフィクスチャ (test
fixture)' と呼ばれます。 新しい TestCase インスタンスはある単一のテスト
フィクスチャとして作成され、個々のテストメソッドを実行するのに使われます
。 従って、 *note setUp(): 1555, *note tearDown(): 1556,
‘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: ff9. class.  In most cases, calling *note unittest.main():
11e9. 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.27.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: 2b5. subclass.

For this reason, ‘unittest’ provides a *note FunctionTestCase: 1ada.
class.  This subclass of *note TestCase: 2b5. 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: 1ada. 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: 2b5. subclasses will make future test
     refactorings infinitely easier.

既存のテストが *note doctest: 3e. を使って書かれている場合もあるでしょう
。その場合、 ‘doctest’ は *note DocTestSuite: ff8. クラスを提供します。
このクラスは、既存の ‘doctest’ベースのテストから、自動的に *note
unittest.TestSuite: ff9. のインスタンスを作成します。


File: python.info,  Node: テストのスキップと予期された失敗,  Next: サブテストを利用して繰り返しテストの区別を付ける,  Prev: 既存テストコードの再利用,  Up: unittest --- ユニットテストフレームワーク

5.27.5.7 テストのスキップと予期された失敗
.........................................

Added in version 3.1.

unittest は特定のテストメソッドやテストクラス全体をスキップする仕組みを
備えています。さらに、この機能はテスト結果を「予期された失敗 (expected
failure)」とすることができ、テストが失敗しても *note TestResult: 1383. の
失敗数にはカウントされなくなります。

テストをスキップするには、 *note skip(): 1e1a. *note デコレータ: 93e. か
その条件付きバージョンの一つを使うか、*note setUp(): 1555. やテストメソ
ッドの中で *note TestCase.skipTest(): 496e. を呼び出すか、あるいは直接
*note SkipTest: 11ea. を送出するだけです。

基本的なスキップは以下のようになります:

     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(): 1555. もスキップすることができます。この機能はセ
ットアップの対象のリソースが使用不可能な時に便利です。

予期された失敗の機能を使用するには *note expectedFailure(): 496f. デコレ
ータを使います。

     class ExpectedFailureTestCase(unittest.TestCase):
         @unittest.expectedFailure
         def test_fail(self):
             self.assertEqual(1, 0, "broken")

独自のスキップ用のデコレータの作成は簡単です。 そのためには、独自のデコ
レータのスキップしたい時点で *note skip(): 1e1a. を呼び出します。 以下の
デコレータはオブジェクトに指定した属性が無い場合にテストをスキップします
:

     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(): 496e.
     やスキッピングデコレータの一つを使用出来ます。

スキップしたテストの前後では、 *note setUp(): 1555. および *note
tearDown(): 1556. は実行されません。同様に、スキップしたクラスの前後では
、 *note setUpClass(): c47. および *note tearDownClass(): 1553. は実行さ
れません。スキップしたモジュールの前後では、 *note setUpModule(): c46. お
よび *note tearDownModule(): 1552. は実行されません。


File: python.info,  Node: サブテストを利用して繰り返しテストの区別を付ける,  Next: クラスと関数,  Prev: テストのスキップと予期された失敗,  Up: unittest --- ユニットテストフレームワーク

5.27.5.8 サブテストを利用して繰り返しテストの区別を付ける
.........................................................

Added in version 3.4.

テストの間にとても小さな差異がある場合（例えばいくつかのパラメータなど）
、unittestでは *note subTest(): 11e7. コンテキストマネージャを使用してテ
ストメソッドの内部でそれらを区別することができます。

例えば以下のテストは:

     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.27.5.9 クラスと関数
.....................

This section describes in depth the API of ‘unittest’.

* Menu:

* テストクラス::
* テストのグループ化::
* テストのロードと起動::


File: python.info,  Node: テストクラス,  Next: テストのグループ化,  Up: クラスと関数

5.27.5.10 テストクラス
......................

 -- クラス: unittest.TestCase (methodName='runTest')

     Instances of the ‘TestCase’ 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: 2b5. の各インスタンスは 'methodName' という名前の単
     一の基底メソッドを実行します。 ‘TestCase’ を使用する大半の場合
     'methodName' を変更したりデフォルトの ‘runTest()’ メソッドを再実装
     することはありません。

     バージョン 3.2 で変更: *note TestCase: 2b5. が 'methodName' を指定
     しなくてもインスタンス化できるようになりました。これにより対話的イ
     ンタプリタから ‘TestCase’ を簡単に試せるようになりました。

     *note TestCase: 2b5. のインスタンスのメソッドは3種類のグループを提
     供します。 1つ目のグループはテストの実行で使用されます。 2つ目のグ
     ループは条件のチェックおよび失敗のレポートを行うテストの実装で使用
     されます。 3つ目のグループである問い合わせ用のメソッドによってテス
     ト自身の情報が収集されます。

     はじめのグループ (テスト実行) に含まれるメソッドは以下の通りです:

      -- メソッド: setUp ()

          テストフィクスチャの準備のために呼び出されるメソッドです。テス
          トメソッドの直前に呼び出されます。このメソッドで *note
          AssertionError: 8b9. や *note SkipTest: 11ea. 以外の例外が発生
          した場合、テストの失敗ではなくエラーとされます。デフォルトの実
          装では何も行いません。

      -- メソッド: tearDown ()

          テストメソッドが実行され、結果が記録された直後に呼び出されるメ
          ソッドです。 このメソッドはテストメソッドで例外が投げられても
          呼び出されます。 そのため、サブクラスでこのメソッドを実装する
          場合は、内部状態を確認することが必要になるでしょう。 このメソ
          ッドで *note AssertionError: 8b9. や *note SkipTest: 11ea. 以
          外の例外が発生した場合、テストの失敗とは別のエラーとみなされま
          す (従って報告されるエラーの総数は増えます)。 このメソッドは、
          テストの結果に関わらず *note setUp(): 1555. が成功した場合にの
          み呼ばれます。 デフォルトの実装では何も行いません。

      -- メソッド: setUpClass ()

          個別のクラス内のテストが実行される前に呼び出されるクラスメソッ
          ドです。 ‘setUpClass’ はクラスを唯一の引数として取り、 *note
          classmethod(): 48e. でデコレートされていなければなりません:

               @classmethod
               def setUpClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 4977. を参照
          してください。

          Added in version 3.2.

      -- メソッド: tearDownClass ()

          個別のクラス内のテストが実行された後に呼び出されるクラスメソッ
          ドです。 ‘tearDownClass’ はクラスを唯一の引数として取り、
          *note classmethod(): 48e. でデコレートされていなければなりませ
          ん:

               @classmethod
               def tearDownClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 4977. を参照
          してください。

          Added in version 3.2.

      -- メソッド: run (result=None)

          テストを実行し、テスト結果を 'result' に指定された *note
          TestResult: 1383. オブジェクトにまとめます。 'result' が省略さ
          れるか ‘None’ が渡された場合、 (*note defaultTestResult():
          4978. メソッドを呼んで) 一時的な結果オブジェクトを生成し、使用
          します。 結果オブジェクトは *note run(): 1382. の呼び出し元に
          返されます。

          このメソッドは、単に *note TestCase: 2b5. インスタンスを呼び出
          した場合と同様に振る舞います。

          バージョン 3.3 で変更: 以前のバージョンの ‘run’ は結果オブジェ
          クトを返しませんでした。また *note TestCase: 2b5. インスタンス
          を呼び出した場合も同様でした。

      -- メソッド: skipTest (reason)

          テストメソッドや *note setUp(): 1555. が現在のテストをスキップ
          する間に呼ばれます。詳細については、 *note
          テストのスキップと予期された失敗: 496d. を参照してください。

          Added in version 3.1.

      -- メソッド: subTest (msg=None, **params)

          このメソッドを囲っているブロックをサブテストとして実行するコン
          テキストマネージャを返します。 'msg' と 'params' はサブテスト
          が失敗したときに表示されるオプションの任意の値で、どんな値が使
          われたかを明確にするものです。

          テストケースには subtest 宣言を幾らでも含めることができ、任意
          にネストすることができます。

          詳細は *note サブテストを利用して繰り返しテストの区別を付ける:
          11e8. を参照してください。

          Added in version 3.4.

      -- メソッド: debug ()

          テスト結果を収集せずにテストを実行します。例外が呼び出し元に通
          知されます。また、テストをデバッガで実行することができます。
     *note TestCase: 2b5. クラスは失敗の検査と報告を行う多くのメソッドを
     提供しています。 以下の表は最も一般的に使われるメソッドを列挙してい
     ます (より多くのアサートメソッドについては表の下を見てください):

     メソッド                                      確認事項                          初出
                                                                                     
     ----------------------------------------------------------------------------------------------------
                                                                                     
     *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): 1557.                   ‘a is b’                          3.1
                                                                                     
                                                                                     
     *note assertIsNot(a, b): 1558.                ‘a is not b’                      3.1
                                                                                     
                                                                                     
     *note assertIsNone(x): 14a6.                  ‘x is None’                       3.1
                                                                                     
                                                                                     
     *note assertIsNotNone(x): 14a7.               ‘x is not None’                   3.1
                                                                                     
                                                                                     
     *note assertIn(a, b): 1560.                   ‘a in b’                          3.1
                                                                                     
                                                                                     
     *note assertNotIn(a, b): 1561.                ‘a not in b’                      3.1
                                                                                     
                                                                                     
     *note assertIsInstance(a, b): 1559.           ‘isinstance(a, b)’                3.2
                                                                                     
                                                                                     
     *note assertNotIsInstance(a, b): 155a.        ‘not isinstance(a, b)’            3.2
                                                                                     
                                                                                     
     *note assertIsSubclass(a, b): 2b8.            ‘issubclass(a, b)’                3.14
                                                                                     
                                                                                     
     *note assertNotIsSubclass(a, b): 2b9.         ‘not issubclass(a, b)’            3.14
                                                                                     

     全てのアサートメソッドは 'msg' 引数を受け取り、指定された場合、失敗
     時のエラーメッセージとして使われます。 (*note longMessage: 1551. も
     参照してください)。 'msg' キーワード引数は *note assertRaises():
     750. 、 *note assertRaisesRegex(): 752. 、 *note assertWarns():
     1380. 、 *note assertWarnsRegex(): 1381. には、そのメソッドをコンテ
     キストマネージャとして使った場合にのみ使えます。

      -- メソッド: assertEqual (first, second, msg=None)

          'first' と 'second' が等しいことをテストします。両者が等しくな
          い場合、テストは失敗です。

          さらに、 'first' と 'second' が厳密に同じ型であり、list、
          tuple、dict、set、frozenset もしくは str のいずれか、またはサ
          ブクラスが *note addTypeEqualityFunc(): 1564. に登録されている
          任意の型の場合、より有用なデフォルトのエラーメッセージを生成す
          るために、その型特有の比較関数が呼ばれます（*note
          型固有のメソッドの一覧: 4979. も参照してください）。

          バージョン 3.1 で変更: 自動で型固有の比較関数が呼ばれるように
          なりました。

          バージョン 3.2 で変更: 文字列比較のデフォルトの比較関数として
          *note assertMultiLineEqual(): 155f. が追加されました。

      -- メソッド: 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(): 2af. が
          扱うことのできる、クラスもしくはクラスのタプルである必要があり
          ます)。正確な型をチェックするためには、 *note
          assertIs(type(obj), cls): 1557. を使用してください。

          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(): 9c8.).  To check for the exact type, use
          *note assertIs(cls, superclass): 1557.

          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): 1380.            ‘fun(*args, **kwds)’ が 'warn' を送出す    3.2
                                                                   る                                         
                                                                   
                                                                                                              
     *note assertWarnsRegex(warn, r, fun, *args, **kwds): 1381.    ‘fun(*args, **kwds)’ が 'warn' を送出し    3.2
                                                                   てメッセージが正規表現 'r' とマッチする    
                                                                   
                                                                                                              
     *note assertLogs(logger, level): a5d.                         ‘with’ ブロックが 最低 'level' で          3.4
                                                                   'logger' を使用する                        
                                                                   
                                                                                                              
     *note assertNoLogs(logger, level): a5c.                       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(): 1448. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               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(): 1380. で指定した位置パラメータとキーワー
          ドパラメータを該当メソッドに渡します。 'warning' が発生した場
          合にテストが成功し、そうでなければ失敗になります。例外が送出さ
          れた場合はエラーになります。複数の警告を捕捉する場合には、警告
          クラスのタプルを 'warnings' に指定してください。

          'warning' 引数のみ（またはそれに加えて 'msg' 引数）が渡された
          場合には、コンテキストマネージャが返されます。これにより関数名
          を渡す形式ではなく、インラインでテスト対象のコードを書くことが
          できます:

               with self.assertWarns(SomeWarning):
                   do_something()

          コンテキストマネージャとして使われたときは、 *note
          assertWarns(): 1380. は加えて '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(): 1380. と同等ですが、警告メッセージが
          'regex' にマッチすることもテストします。 'regex' は正規表現オ
          ブジェクトか、 *note re.search(): 1448. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               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: d4a.
          object or a *note str: 16a. 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:
          213c.) であるべきです。 デフォルトは *note logging.INFO: 213a.
          です。

          ‘with’ ブロック内で出たメッセージの少なくとも一つが 'logger' お
          よび 'level' 条件に合っている場合、このテストをパスします。そ
          れ以外の場合は失敗です。

          コンテキストマネージャから返されるオブジェクトは、条件に該当す
          るログメッセージを追跡し続ける記録のためのヘルパーです。 この
          オブジェクトには2つの属性があります:

           -- の属性: records

               該当するログメッセージを表す *note logging.LogRecord:
               11ec. オブジェクトのリスト。

           -- の属性: output

               該当するメッセージ出力をフォーマットした *note str: 16a.
               オブジェクトのリスト。

          以下はプログラム例です:

               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: d4a. オブジ
          ェクトもしくはロガーの名前である *note str: 16a. であるべきで
          す。 デフォルトはルートロガーで、これは全てのメッセージを掴ま
          えます。

          'level' が与えられた場合、ログレベルを表す数値もしくはそれに相
          当する文字列 (例えば ‘"ERROR"’ もしくは *note logging.ERROR:
          213c.) であるべきです。 デフォルトは *note logging.INFO: 213a.
          です。

          *note assertLogs(): a5d. と異なり、このコンテキストマネージャ
          は何も返しません。

          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): 155b.            ‘a > b’                              3.1
                                                                                      
                                                                                      
     *note assertGreaterEqual(a, b): 155c.       ‘a >= b’                             3.1
                                                                                      
                                                                                      
     *note assertLess(a, b): 155d.               ‘a < b’                              3.1
                                                                                      
                                                                                      
     *note assertLessEqual(a, b): 155e.          ‘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): 1446.         'a' contains the same elements as    3.2
                                                 'b', regardless of their order.      
                                                 
                                                                                      
     *note assertStartsWith(a, b): 2ba.          ‘a.startswith(b)’                    3.14
                                                                                      
                                                                                      
     *note assertNotStartsWith(a, b): 2bb.       ‘not a.startswith(b)’                3.14
                                                                                      
                                                                                      
     *note assertEndsWith(a, b): 2bc.            ‘a.endswith(b)’                      3.14
                                                                                      
                                                                                      
     *note assertNotEndsWith(a, b): 2bd.         ‘not a.endswith(b)’                  3.14
                                                                                      
                                                                                      
     *note assertHasAttr(a, b): 2b6.             ‘hasattr(a, b)’                      3.14
                                                                                      
                                                                                      
     *note assertNotHasAttr(a, b): 2b7.          ‘not hasattr(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(): 14f6. と同様に) '小数位' を指定するのであって
          、'有効桁数' を指定するのではないことに注意してください。

          'places' の代わりに 'delta' が渡された場合には、'first' と
          'second' の差分が 'delta' 以下 (以上) であることをテストします
          。

          'delta' と 'places' の両方が指定された場合は *note TypeError:
          199. が送出されます。

          バージョン 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(): 1448. が扱える正規表現が書
          かれた文字列である必要があります。

          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(): 1564. を使う事で新たなメソ
     ッドを登録することができます:

      -- メソッド: addTypeEqualityFunc (typeobj, function)

          *note assertEqual(): 74c. で呼び出される型特有のメソッドを登録
          します。登録するメソッドは、比較する2つのオブジェクトの型が厳
          密に 'typeobj' と同じ (サブクラスでもいけません) の場合に等価
          性を確認します。 'function' は ‘assertEqual()’ と同様に、2つの
          位置引数と、3番目に msg=None のキーワード引数を取れる必要があ
          ります。このメソッドは、始めの2つに指定したパラメータ間の差分
          を検出した時に *note self.failureException(msg): 4911. の例外
          を投げる必要があります。この例外を投げる際は、出来る限り、エラ
          ーの内容が分かる有用な情報と差分の詳細をエラーメッセージに含め
          てください。

          Added in version 3.1.

     *note assertEqual(): 74c. が自動的に呼び出す型特有のメソッドの概要
     を以下の表示に記載しています。これらのメソッドは通常は直接呼び出す
     必要がないことに注意が必要です。

     メソッド                                      比較の対象                        初出
                                                                                     
     ---------------------------------------------------------------------------------------------------
                                                                                     
     *note assertMultiLineEqual(a, b): 155f.       文字列                            3.1
                                                                                     
                                                                                     
     *note assertSequenceEqual(a, b): 14a5.        シーケンス                        3.1
                                                                                     
                                                                                     
     *note assertListEqual(a, b): 14a3.            リスト                            3.1
                                                                                     
                                                                                     
     *note assertTupleEqual(a, b): 14a4.           タプル                            3.1
                                                                                     
                                                                                     
     *note assertSetEqual(a, b): 14a1.             set または frozenset              3.1
                                                                                     
                                                                                     
     *note assertDictEqual(a, b): 14a2.            辞書                              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(): 14a3. と *note
          assertTupleEqual(): 14a4. の実装で使われています。

          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(): 26f1. が
          無い場合にはテストは失敗します。

          Added in version 3.1.

      -- メソッド: assertDictEqual (first, second, msg=None)

          2つの辞書が等しいかどうかをテストします。等しくない場合には、
          両者の差分を表示します。このメソッドは、デフォルトで、 *note
          assertEqual(): 74c. が dict を比較するときに自動的に使用します
          。

          Added in version 3.1.

     最後に、 *note TestCase: 2b5. の残りのメソッドと属性を紹介します:

      -- メソッド: fail (msg=None)

          無条件にテストを失敗させます。エラーメッセージの表示に、'msg'
          または ‘None’ が使われます。

      -- の属性: failureException

          *note test(): e8. メソッドが送出する例外を指定するクラス属性で
          す。例えばテストフレームワークで追加情報を付した特殊な例外が必
          要になる場合、この例外のサブクラスとして作成します。この属性の
          初期値は *note AssertionError: 8b9. です。

      -- の属性: longMessage

          このクラス属性は、失敗した assertXYY の呼び出しで独自の失敗時
          のメッセージが msg 引数として渡されていたときにどうするかを決
          定します。 ‘True’ がデフォルト値です。 この場合、標準の失敗時
          のメッセージの後に独自のメッセージが追記されます。 ‘False’ に
          設定したときは、標準のメッセージを独自のメッセージで置き換えま
          す。

          アサートメソッドを呼び出す前に、個別のテストメソッドの中でイン
          スタンス属性 self.longMessage を ‘True’ または ‘False’ に設定
          して、この設定を上書きできます。

          このクラスの設定はそれぞれのテストを呼び出す前にリセットされま
          す。

          Added in version 3.1.

      -- の属性: maxDiff

          この属性は、アサーションメソッドが失敗をレポートする時に表示す
          る差分の長さをコントロールします。デフォルトは 80*8 文字です。
          この属性が影響するメソッドは、 *note assertSequenceEqual():
          14a5. (およびこのメソッドに委譲するシーケンス比較メソッド)、
          *note assertDictEqual(): 14a2. と *note
          assertMultiLineEqual(): 155f. です。

          ‘maxDiff’ を ‘None’ に設定すると差分表示の上限がなくなります。

          Added in version 3.2.

     テストフレームワークは、テスト情報を収集するために以下のメソッドを
     使用します:

      -- メソッド: countTestCases ()

          テストオブジェクトに含まれるテストの数を返します。 *note
          TestCase: 2b5. インスタンスは常に ‘1’ を返します。

      -- メソッド: defaultTestResult ()

          このテストケースクラスで使われるテスト結果クラスのインスタンス
          を (もし *note run(): 1382. メソッドに他の結果インスタンスが提
          供されないならば) 返します。

          *note TestCase: 2b5. インスタンスに対しては、いつも *note
          TestResult: 1383. のインスタンスですので、 ‘TestCase’ のサブク
          ラスでは必要に応じてこのメソッドをオーバライドしてください。

      -- メソッド: id ()

          テストケースを特定する文字列を返します。通常、'id' はモジュー
          ル名・クラス名を含む、テストメソッドのフルネームを指定します。

      -- メソッド: shortDescription ()

          テストの説明を一行分、または説明がない場合には ‘None’ を返しま
          す。デフォルトでは、テストメソッドの docstring の先頭の一行、
          または ‘None’ を返します。

          バージョン 3.1 で変更: 3.1で docstring があったとしても、返さ
          れる短い説明文字列にテスト名が付けられるようになりました。 こ
          の変更によって unittest 拡張に互換性の問題が発生し、 Python
          3.2 でテスト名が追加される場所は *note TextTestResult: 754. へ
          移動しました。

      -- メソッド: addCleanup (function, /, *args, **kwargs)

          *note tearDown(): 1556. の後に呼び出される関数を追加します。こ
          の関数はリソースのクリーンアップのために使用します。追加された
          関数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
          addCleanup(): c78. に渡された引数とキーワード引数が追加された
          関数にも渡されます。

          *note setUp(): 1555. が失敗した場合、つまり *note tearDown():
          1556. が呼ばれなかった場合でも、追加されたクリーンアップ関数は
          呼び出されます。

          Added in version 3.1.

      -- メソッド: enterContext (cm)

          Enter the supplied *note context manager: 1e3.  If successful,
          also add its *note __exit__(): 151c. method as a cleanup
          function by *note addCleanup(): c78. and return the result of
          the *note __enter__(): 7e4. method.

          Added in version 3.11.

      -- メソッド: doCleanups ()

          このメソッドは、 *note tearDown(): 1556. の後、もしくは、
          *note setUp(): 1555. が例外を投げた場合は ‘setUp()’ の後に、無
          条件で呼ばれます。

          このメソッドは、 *note addCleanup(): c78. で追加された関数を呼
          び出す責務を担います。もし、クリーンアップ関数を *note
          tearDown(): 1556. より前に呼び出す必要がある場合には、 *note
          doCleanups(): 1554. を明示的に呼び出してください。

          *note doCleanups(): 1554. は、どこで呼び出されても、クリーンア
          ップ関数をスタックから削除して実行します。

          Added in version 3.1.

      -- メソッド: classmethod addClassCleanup (function, /, *args,
               **kwargs)

          *note tearDownClass(): 1553. の後に呼び出される関数を追加しま
          す。この関数はリソースのクリーンアップのために使用します。追加
          された関数は、追加された順と逆の順番で呼び出されます（LIFO）。
          *note addClassCleanup(): c45. に渡された引数とキーワード引数が
          追加された関数にも渡されます。

          *note setUpClass(): c47. が失敗した場合、つまり *note
          tearDownClass(): 1553. が呼ばれなかった場合でも、追加されたク
          リーンアップ関数は呼び出されます。

          Added in version 3.8.

      -- メソッド: classmethod enterClassContext (cm)

          Enter the supplied *note context manager: 1e3.  If successful,
          also add its *note __exit__(): 151c. method as a cleanup
          function by *note addClassCleanup(): c45. and return the
          result of the *note __enter__(): 7e4. method.

          Added in version 3.11.

      -- メソッド: classmethod doClassCleanups ()

          このメソッドは、 *note tearDownClass(): 1553. の後、もしくは、
          *note setUpClass(): c47. が例外を投げた場合は ‘setUpClass()’ の
          後に、無条件で呼ばれます。

          このメソッドは、 *note addClassCleanup(): c45. で追加された関
          数を呼び出す責務を担います。もし、クリーンアップ関数を *note
          tearDownClass(): 1553. より前に呼び出す必要がある場合には、
          *note doClassCleanups(): 4981. を明示的に呼び出してください。

          *note doClassCleanups(): 4981. は、どこで呼び出されても、クリ
          ーンアップ関数をスタックから削除して実行します。

          Added in version 3.8.

 -- クラス: unittest.IsolatedAsyncioTestCase (methodName='runTest')

     このクラスは *note TestCase: 2b5. と似たAPIを提供し、テスト関数とし
     てコルーチンも許容します。

     Added in version 3.8.

      -- の属性: loop_factory

          The 'loop_factory' passed to *note asyncio.Runner: 2f7.
          Override in subclasses with *note asyncio.EventLoop: 1ac8. to
          avoid using the asyncio policy system.

          Added in version 3.13.

      -- メソッド: async asyncSetUp ()

          テストフィクスチャを用意するために呼び出されるメソッドです。こ
          れは *note TestCase.setUp(): 1555. の後に呼び出されます。これ
          はテストメソッドを呼び出す直前に呼び出されます。*note
          AssertionError: 8b9. と *note SkipTest: 11ea. を除いて、このメ
          ソッドのによって送出されたあらゆる例外はテストの失敗ではなくエ
          ラーとみなされます。デフォルトの実装では何もしません。

      -- メソッド: async asyncTearDown ()

          テストメソッドが呼び出され、その結果が記録された直後に呼び出さ
          れるメソッドです。これは *note tearDown(): 1556. の前に呼び出
          されます。これはテストメソッドが例外を送出した場合でも呼び出さ
          れるので、サブクラスの実装では内部状態のチェックに特に気を付け
          る必要があります。このメソッドで送出された *note
          AssertionError: 8b9. と *note SkipTest: 11ea. 以外の例外は、テ
          ストの失敗ではなく追加のエラーとみなされます(そのため、報告さ
          れるエラーの総数が増えることになります)。このメソッドはテスト
          メソッドの結果に関係なく、*note asyncSetUp(): 4983. が成功した
          場合にのみ呼び出されます。デフォルトの実装では何もしません。

      -- メソッド: addAsyncCleanup (function, /, *args, **kwargs)

          このメソッドはクリーンアップ関数として使用できるコルーチンを受
          け入れます。

      -- メソッド: async enterAsyncContext (cm)

          Enter the supplied *note asynchronous context manager: 7f0.
          If successful, also add its *note __aexit__(): 1a00. method as
          a cleanup function by *note addAsyncCleanup(): 4985. and
          return the result of the *note __aenter__(): 247d. method.

          Added in version 3.11.

      -- メソッド: run (result=None)

          テストを実行するための新しいイベントループを作成し、 'result'
          として渡された *note TestResult: 1383. オブジェクトに結果を収
          集します。'result' が省略された場合や ‘None’ の場合は、一時的
          なresultオブジェクトが(*note defaultTestResult(): 4978. メソッ
          ドの呼び出しによって)作成され、使用されます。このresultオブジ
          ェクトは *note run(): 4986. の呼び出し元に返されます。テスト終
          了時には、イベントループ内のすべてのタスクがキャンセルされます
          。

     順番を示す例です:

          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: 2b5.
     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.27.5.11 テストのグループ化
............................

 -- クラス: unittest.TestSuite (tests=())

     このクラスは、個々のテストケースやテストスイートの集合を表現してい
     ます。 通常のテストケースと同じようにテストランナーで実行するための
     インターフェースを備えています。 *note TestSuite: ff9. インスタンス
     を実行することはスイートをイテレートして得られる個々のテストを実行
     することと同じです。

     引数 'tests' が指定された場合、それはテストケースに亘る繰り返し可能
     オブジェクトまたは内部でスイートを組み立てるための他のテストスイー
     トでなければなりません。後からテストケースやスイートをコレクション
     に付け加えるためのメソッドも提供されています。

     *note TestSuite: ff9. は *note TestCase: 2b5. オブジェクトのように
     振る舞います。違いは、スイートにはテストを実装しない点にあります。
     代わりに、テストをまとめてグループ化して、同時に実行します。
     ‘TestSuite’ のインスタンスにテスト追加するためのメソッドが用意され
     ています:

      -- メソッド: addTest (test)

          *note TestCase: 2b5. 又は *note TestSuite: ff9. のインスタンス
          をスイートに追加します。

      -- メソッド: addTests (tests)

          イテラブル 'tests' に含まれる全ての *note TestCase: 2b5. 又は
          *note TestSuite: ff9. のインスタンスをスイートに追加します。

          このメソッドは 'tests' 上のイテレーションをしながらそれぞれの
          要素に *note addTest(): 4989. を呼び出すのと等価です。

     *note TestSuite: ff9. クラスは *note TestCase: 2b5. と以下のメソッ
     ドを共有します:

      -- メソッド: run (result)

          スイート内のテストを実行し、結果を 'result' で指定した結果オブ
          ジェクトに収集します。 *note TestCase.run(): 1382. と異なり、
          *note TestSuite.run(): 498b. では必ず結果オブジェクトを指定す
          る必要があります。

      -- メソッド: debug ()

          このスイートに関連づけられたテストを結果を収集せずに実行します
          。これによりテストで送出された例外は呼び出し元に伝わるようにな
          り、デバッガの下でのテスト実行をサポートできるようになります。

      -- メソッド: countTestCases ()

          このテストオブジェクトによって表現されるテストの数を返します。
          これには個別のテストと下位のスイートも含まれます。

      -- メソッド: __iter__ ()

          *note TestSuite: ff9. でグループ化されたテストは反復アクセスで
          きます。 サブクラスは ‘__iter__()’ をオーバーライドすることで
          、遅延処理でテストを提供できます。 1つのスイート内でこのメソッ
          ドは何度も呼ばれる可能性があることに注意してください (例えば、
          テスト数のカウントや等価性の比較)。 そのため、 *note
          TestSuite.run(): 498b. を実行する前に反復アクセスを何度繰り返
          しても同じテスト群を返すようにしなければなりません。 呼び出し
          側が ‘TestSuite._removeTestAtIndex()’ をオーバーライドしたサブ
          クラスを使いテストへの参照を保存していない限り、
          ‘TestSuite.run()’ を実行した後はこのメソッドが返すテスト群を信
          頼すべきではありません。

          バージョン 3.2 で変更: 以前のバージョンでは *note TestSuite:
          ff9. はイテレータではなく、直接テストにアクセスしていました。
          そのため、 ‘__iter__()’ をオーバーラードしてもテストにアクセス
          できませんでした。

          バージョン 3.4 で変更: 以前のバージョンでは、 *note
          TestSuite.run(): 498b. の実行後は *note TestSuite: ff9. が各
          *note TestCase: 2b5. への参照を保持していました。 サブクラスで
          ‘TestSuite._removeTestAtIndex()’ をオーバーライドすることでこ
          の振る舞いを復元できます。

     通常、 *note TestSuite: ff9. の *note run(): 498b. メソッドは
     ‘TestRunner’ が起動するため、ユーザが直接実行する必要はありません。


File: python.info,  Node: テストのロードと起動,  Prev: テストのグループ化,  Up: クラスと関数

5.27.5.12 テストのロードと起動
..............................

 -- クラス: unittest.TestLoader

     The ‘TestLoader’ 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: 498f.  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: 2b5. の派生クラス ‘testCaseClass’ に含まれる全
          テストケースのスイートを返します。

          *note getTestCaseNames(): 596. で指定されたメソッドに対し、テ
          ストケースインスタンスが作成されます。 デフォルトでは ‘test’ で
          始まる名前のメソッド群です。 ‘getTestCaseNames()’ がメソッド名
          を返さなかったが、 ‘runTest()’ メソッドが実装されている場合は
          、そのメソッドに対するテストケースが代わりに作成されます。

      -- メソッド: loadTestsFromModule (module, *, pattern=None)

          指定したモジュールに含まれる全テストケースのスイートを返します
          。このメソッドは 'module' 内の *note TestCase: 2b5. 派生クラス
          を検索し、見つかったクラスのテストメソッドごとにクラスのインス
          タンスを作成します。

               注釈: *note TestCase: 2b5. クラスを基底クラスとしてクラス
               階層を構築するとテストフィクスチャや補助的な関数をうまく
               共用することができますが、基底クラスに直接インスタンス化
               できないテストメソッドがあると、この
               ‘loadTestsFromModule()’ を使うことができません。この場合
               でも、 fixture が全て別々で定義がサブクラスにある場合は使
               用することができます。

          モジュールが ‘load_tests’ 関数を用意している場合、この関数がテ
          ストの読み込みに使われます。 これによりテストの読み込み処理が
          カスタマイズできます。 これが *note load_tests プロトコル:
          4968. です。 '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: ff9. インス
          タンスまたは *note TestCase: 2b5. か ‘TestSuite’ のインスタン
          スを返す呼び出し可能オブジェクトを指定します。このチェックはこ
          こで挙げた順番に行なわれます。すなわち、候補テストケースクラス
          内のメソッドは「呼び出し可能オブジェクト」としてではなく「テス
          トケースクラス内のメソッド」として拾い出されます。

          例えば モジュールに *note TestCase: 2b5. から派生した クラスが
          あり、 ‘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(): 1562. と同じですが、名前を一つだけ
          指定するのではなく、複数の名前のシーケンスを指定する事ができま
          す。戻り値は 'names' 中の名前で指定されるテスト全てを含むテス
          トスイートです。

      -- メソッド: getTestCaseNames (testCaseClass)

          'testCaseClass' 中の全てのメソッド名を含むソート済みシーケンス
          を返します。 'testCaseClass' は *note TestCase: 2b5. のサブク
          ラスでなければなりません。

      -- メソッド: discover (start_dir, pattern='test*.py',
               top_level_dir=None)

          指定された開始ディレクトリからサブディレクトリに再帰することで
          すべてのテストモジュールを検索し、それらを含む TestSuite オブ
          ジェクトを返します。'pattern' にマッチしたテストファイルだけが
          ロードの対象になります。 (シェルスタイルのパターンマッチングが
          使われます)。その中で、インポート可能なもジュール (つまり
          Python の識別子として有効であるということです) がロードされま
          す。

          すべてのテストモジュールはプロジェクトのトップレベルからインポ
          ート可能である必要があります。開始ディレクトリがトップレベルデ
          ィレクトリでない場合は、'top_level_dir' を個別に指定しなければ
          なりません。

          シンタックスエラーなどでモジュールのインポートに失敗した場合、
          エラーが記録され、ディスカバリ自体は続けられます。 import の失
          敗が *note SkipTest: 11ea. 例外が発生したためだった場合は、そ
          のモジュールはエラーではなく 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: 11ea. を
          送出するモジュールはエラーではなくスキップとして記録されます。

          'start_dir' に *note 名前空間パッケージ: 2b4. を指定できます。

          ファイルシステムの順序がファイル名に従わないとしても実行順序が
          一定になるように、パスはインポートする前にソートされます。

          バージョン 3.5 で変更: パッケージ名がデフォルトのパターンに適
          合するのは不可能なので、パスが 'pattern' に適合するかどうかに
          関係無く、見付けたパッケージに ‘load_tests’ があるかをチェック
          するようになりました。

          バージョン 3.11 で変更: 'start_dir' can not be a *note
          namespace packages: 2b4.  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: 2b4.

     以下の属性は、サブクラス化またはインスタンスの属性値を変更して
     *note TestLoader: 593. をカスタマイズする場合に使用します:

      -- の属性: testMethodPrefix

          テストメソッドの名前と判断されるメソッド名の接頭語を示す文字列
          。デフォルト値は ‘'test'’ です。

          この値は *note getTestCaseNames(): 596. と全ての
          ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: sortTestMethodsUsing

          *note getTestCaseNames(): 596. および全ての ‘loadTestsFrom*’ メ
          ソッドでメソッド名をソートする際に使用する比較関数。

      -- の属性: suiteClass

          テストのリストからテストスイートを構築する呼び出し可能オブジェ
          クト。メソッドを持つ必要はありません。デフォルト値は *note
          TestSuite: ff9. です。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: testNamePatterns

          テストメソッドがテストスイートに含まれるためにマッチしなければ
          ならないUnixシェルスタイルのワイルドカードテスト名パターンのリ
          ストです(‘-k’ オプションを参照)。

          この属性が ‘None’ (デフォルト)でない場合、テストスイートに含ま
          れるすべてのテストメソッドはこのリストのパターンのいずれかにマ
          ッチしていなければなりません。マッチは常に *note
          fnmatch.fnmatchcase(): 1cb2. を使用して実行されるため、‘-k’ オ
          プションに渡されるパターンとは異なり、単純な部分文字列パターン
          は ‘*’ ワイルドカードを使用して変換する必要があることに注意し
          てください。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

          Added in version 3.7.

 -- クラス: unittest.TestResult

     このクラスはどのテストが成功しどのテストが失敗したかという情報を収
     集するのに使います。

     *note TestResult: 1383. は、複数のテスト結果を記録します。 *note
     TestCase: 2b5. クラスと *note TestSuite: ff9. クラスのテスト結果を
     正しく記録しますので、テスト開発者が独自にテスト結果を管理する処理
     を開発する必要はありません。

     Testing frameworks built on top of ‘unittest’ may want access to
     the ‘TestResult’ object generated by running a set of tests for
     reporting purposes; a ‘TestResult’ instance is returned by the
     ‘TestRunner.run()’ method for this purpose.

     *note TestResult: 1383. インスタンスの以下の属性は、テストの実行結
     果を検査する際に使用することができます:

      -- の属性: errors

          *note TestCase: 2b5. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは予
          想外の例外を送出したテストに対応します。

      -- の属性: failures

          *note TestCase: 2b5. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは
          ref:‘assert* メソッド <assert-methods>’ を使って見つけ出した失
          敗に対応します。

      -- の属性: skipped

          *note TestCase: 2b5. インスタンスとテストをスキップした理由を
          保持する文字列の2要素タプルからなるリストです。

          Added in version 3.1.

      -- の属性: expectedFailures

          *note TestCase: 2b5. と例外のトレースバック情報をフォーマット
          済の文字列の 2 要素タプルからなるリストです。それぞれのタプル
          は予期された失敗またはエラーに対応します。

      -- の属性: unexpectedSuccesses

          予期された失敗とされていながら成功してしまった *note TestCase:
          2b5. のインスタンスのリスト。

      -- の属性: 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(): 499a. によりテストの実行が
          停止します。

      -- の属性: testsRun

          これまでに実行したテストの総数です。

      -- の属性: buffer

          ‘True’ が設定されると、 ‘sys.stdout’ と ‘sys.stderr’ は、
          *note startTest(): 499d. から *note stopTest(): 499e. が呼ばれ
          るまでの間バッファリングされます。実際に、結果が ‘sys.stdout’
          と ‘sys.stderr’ に出力されるのは、テストが失敗するかエラーが発
          生した時になります。表示の際には、全ての失敗 / エラーメッセー
          ジが表示されます。

          Added in version 3.2.

      -- の属性: failfast

          真の場合 *note stop(): 499a. が始めの失敗もしくはエラーの時に
          呼び出され、テストの実行が終了します。

          Added in version 3.2.

      -- の属性: tb_locals

          真の場合、局所変数がトレースバックに表示されます。

          Added in version 3.5.

      -- メソッド: wasSuccessful ()

          これまでに実行したテストが全て成功していれば ‘True’ を、それ以
          外なら ‘False’ を返します。

          バージョン 3.4 で変更: *note expectedFailure(): 496f. デコレ－
          タでマークされたテストに *note unexpectedSuccesses: 4998. があ
          った場合 ‘False’ を返します。

      -- メソッド: stop ()

          このメソッドを呼び出して *note TestResult: 1383. の *note
          shouldStop: 4999. 属性に ‘True’ をセットすることで、実行中のテ
          ストは中断しなければならないというシグナルを送ることができます
          。 ‘TestRunner’ オブジェクトはこのフラグを順守してそれ以上のテ
          ストを実行することなく復帰しなければなりません。

          たとえばこの機能は、ユーザのキーボード割り込みを受け取って
          *note TextTestRunner: 1b18. クラスがテストフレームワークを停止
          させるのに使えます。 ‘TestRunner’ の実装を提供する対話的なツー
          ルでも同じように使用することができます。

     *note TestResult: 1383. クラスの以下のメソッドは内部データ管理用の
     メソッドですが、対話的にテスト結果をレポートするテストツールを開発
     する場合などにはサブクラスで拡張することができます。

      -- メソッド: 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(): 89b. が返すタプル
          ‘(type, value, traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note errors: 4994. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addFailure (test, err)

          テストケース 'test' が失敗した場合に呼び出されます。 'err' は
          *note sys.exc_info(): 89b. が返すタプル ‘(type, value,
          traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note failures: 4995. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addSuccess (test)

          テストケース 'test' が成功した場合に呼び出されます。

          デフォルトの実装では何もしません。

      -- メソッド: addSkip (test, reason)

          'test' がスキップされた時に呼び出されます。'reason' はスキップ
          の際に渡された理由の文字列です。

          デフォルトの実装では、 ‘(test, reason)’ のタプルをインスタンス
          の *note skipped: 4996. 属性に追加します。

      -- メソッド: addExpectedFailure (test, err)

          *note expectedFailure(): 496f. のデコレータでマークされた
          'test' が失敗またはエラーの時に呼び出されます。

          デフォルトの実装では ‘(test, formatted_err)’ のタプルをインス
          タンスの *note expectedFailures: 4997. に追加します。ここで
          'formatted_err' は 'err' から派生した整形されたトレースバック
          です。

      -- メソッド: addUnexpectedSuccess (test)

          *note expectedFailure(): 496f. のデコレータでマークされた
          'test' が成功した時に呼び出されます。

          デフォルトの実装ではテストをインスタンスの *note
          unexpectedSuccesses: 4998. 属性に追加します。

      -- メソッド: addSubTest (test, subtest, outcome)

          サブテストが終了すると呼ばれます。 'test' はテストメソッドに対
          応するテストケースです。 'subtest' はサブテストを記述するカス
          タムの *note TestCase: 2b5. インスタンスです。

          'outcome' が *note None: 886. の場合サブテストは成功です。 そ
          れ以外の場合は失敗で、*note sys.exc_info(): 89b. が返す形式
          ‘(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: 1383. used by the
     *note TextTestRunner: 1b18.  Subclasses should accept ‘**kwargs’ to
     ensure compatibility as the interface changes.

     Added in version 3.2.

     バージョン 3.12 で変更: 'durations' キーワード引数が追加されました
     。

 -- データ: unittest.defaultTestLoader

     *note TestLoader: 593. のインスタンスで、共用することが目的です。
     ‘TestLoader’ をカスタマイズする必要がなければ、新しい ‘TestLoader’
     オブジェクトを作らずにこのインスタンスを使用します。

 -- クラス: 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: b37. が出
     力ストリームとして使われます。 このクラスはいくつかの設定項目がある
     だけで、基本的に非常に単純です。 グラフィカルなテスト実行アプリケー
     ションでは、独自のテストランナーを実装してください。 テストランナー
     の実装は、 unittest に新しい機能が追加されランナーを構築するインタ
     ーフェースが変更されたときに備えて ‘**kwargs’ を受け取れるようにす
     るべきです。

     By default this runner shows *note DeprecationWarning: 1a4, *note
     PendingDeprecationWarning: ac9, *note ResourceWarning: 54c. and
     *note ImportWarning: 71e. even if they are *note ignored by
     default: 49a5.  This behavior can be overridden using Python's
     ‘-Wd’ or ‘-Wa’ options (see *note Warning control: 2184.) and
     leaving 'warnings' to ‘None’.

     バージョン 3.2 で変更: 'warnings' 引数が追加されました。

     バージョン 3.2 で変更: インポート時でなくインスタンス化時にデフォル
     トのストリームが *note sys.stderr: b37. に設定されます。

     バージョン 3.5 で変更: 'tb_locals' 引数が追加されました。

     バージョン 3.12 で変更: 'durations' 引数が追加されました。

      -- メソッド: _makeResult ()

          このメソッドは *note run(): 49a7. で使われる ‘TestResult’ のイ
          ンスタンスを返します。このメソッドは明示的に呼び出す必要はあり
          ませんが、サブクラスで ‘TestResult’ をカスタマイズすることがで
          きます。

          ‘_makeResult()’ は、 ‘TextTestRunner’ のコンストラクタで
          ‘resultclass’ 引数として渡されたクラスもしくはコーラブルオブジ
          ェクトをインスタンス化します。 ‘resultclass’ が指定されていな
          い場合には、デフォルトで *note TextTestResult: 754. が使用され
          ます。結果のクラスは以下の引数が渡されインスタンス化されます:

               stream, descriptions, verbosity

      -- メソッド: run (test)

          このメソッドは ‘TextTestRunner’ へのメインの公開インターフェー
          スです。 このメソッドは *note TestSuite: ff9. インスタンスある
          いは *note TestCase: 2b5. インスタンスを受け取ります。 *note
          _makeResult(): 49a6. が呼ばれて *note TestResult: 1383. が作成
          され、テストが実行され、結果が標準出力に表示されます。

 -- の関数: 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: 1480. が使われます。

     The 'testRunner' argument can either be a test runner class or an
     already created instance of it.  By default ‘main’ calls *note
     sys.exit(): 279. 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: 498f. です。

     ‘main’ は、 ‘exit=False’ を指定する事で対話的なインタプリタから使用
     することもできます。この引数を指定すると、 *note sys.exit(): 279. を
     呼ばずに、結果のみを出力します:

          >>> from unittest import main
          >>> main(module='test_module', exit=False)

     'failfast', 'catchbreak', 'buffer' は、*note
     コマンドラインオプション: 4957. にある同名のオプションと同じ効果の
     あるパラメータです。

     'warnings' 引数では、テストの実行中に使うべき *note 警告フィルタ:
     1b2. を指定します。 この引数が指定されない場合には、 ‘-W’ オプショ
     ンが ‘python’ に渡されていなければ ‘None’ のまま (*note 警告の制御:
     2184. を参照してください) で、そうでなければ ‘'default'’ が設定され
     ます。

     Calling ‘main’ returns an object with the ‘result’ attribute that
     contains the result of the tests run as a *note
     unittest.TestResult: 1383.

     バージョン 3.1 で変更: 'exit' パラメータが追加されました。

     バージョン 3.2 で変更: 'verbosity'、'failfast'、'catchbreak'、
     'buffer'、'warnings' 引数が追加されました。

     バージョン 3.4 で変更: 'defaultTest' 引数がテスト名のイテラブルも受
     け取るようになりました。

* Menu:

* load_tests プロトコル::


File: python.info,  Node: load_tests プロトコル,  Up: テストのロードと起動

5.27.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: ff9. を返すべきです。

'loader' はローディングを行う *note TestLoader: 593. のインスタンスです
。 'standard_tests' は、そのモジュールからデフォルトでロードされるテスト
です。これは、テストの標準セットのテストの追加や削除のみを行いたいテスト
モジュールに一般に使われます。第三引数は、パッケージをテストディスカバリ
の一部としてロードするときに使われます。

特定の *note TestCase: 2b5. クラスのセットからテストをロードする典型的な
‘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(): 11eb. の呼び出しでも
、パッケージを含むディレクトリで検索を始めた場合、そのパッケージの
‘__init__.py’ をチェックして ‘load_tests’ を探します。 その関数が存在し
ない場合、他のディレクトリであるかのようにパッケージの中を再帰的に検索し
ます。 その関数が存在した場合、パッケージのテストの検索をそちらに任せ、
‘load_tests’ が次の引数で呼び出されます:

     load_tests(loader, standard_tests, pattern)

これはパッケージ内のすべてのテストを表す *note TestSuite: ff9. を返すべ
きです。 (‘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.27.5.14 クラスとモジュールのフィクスチャ
..........................................

クラスレベルとモジュールレベルのフィクスチャが *note TestSuite: ff9. に
実装されました。 テストスイートが新しいクラスのテストを始める時、以前の
クラス (あれば)の *note tearDownClass(): 1553. を呼び出し、その後に新し
いクラスの *note setUpClass(): c47. を呼び出します。

同様に、今回のテストのモジュールが前回のテストとは異なる場合、以前のモジ
ュールの ‘tearDownModule’ を実行し、次に新しいモジュールの ‘setUpModule’
を実行します。

すべてのテストが実行された後、最後の ‘tearDownClass’ と ‘tearDownModule’
が実行されます。

なお、共有フィクスチャは、テストの並列化などの [潜在的な] 機能と同時には
うまくいかず、テストの分離を壊すので、気をつけて使うべきです。

unittest テストローダによるテスト作成のデフォルトの順序では、同じモジュ
ールやクラスからのテストはすべて同じグループにまとめられます。これにより
、‘setUpClass’ / ‘setUpModule’ (など) は、一つのクラスやモジュールにつき
一度だけ呼ばれます。この順序をバラバラにし、異なるモジュールやクラスのテ
ストが並ぶようにすると、共有フィクスチャ関数は、一度のテストで複数回呼ば
れるようにもなります。

共有フィクスチャは標準でない順序で実行されることを意図していません。 共
有フィクスチャをサポートしたくないフレームワークのために、
‘BaseTestSuite’ がまだ存在しています。

共有フィクスチャ関数のいずれかで例外が発生した場合、そのテストはエラーと
して報告されます。 そのとき、対応するテストインスタンスが無いので(*note
TestCase: 2b5. と同じインターフェースの) ‘_ErrorHolder’ オブジェクトが生
成され、エラーを表します。 標準 unittest テストランナーを使っている場合
はこの詳細は問題になりませんが、あなたがフレームワークの作者である場合は
注意してください。

* Menu:

* setUpClass と tearDownClass::
* setUpModule と tearDownModule::


File: python.info,  Node: setUpClass と tearDownClass,  Next: setUpModule と tearDownModule,  Up: クラスとモジュールのフィクスチャ

5.27.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: 2b5. の実装は空です
。

‘setUpClass’ の中で例外が送出されたら、クラス内のテストは実行されず、
‘tearDownClass’ も実行されません。スキップされたクラスは ‘setUpClass’ も
‘tearDownClass’ も実行されません。例外が *note SkipTest: 11ea. 例外であ
れば、そのクラスはエラーではなくスキップされたものとして報告されます。


File: python.info,  Node: setUpModule と tearDownModule,  Prev: setUpClass と tearDownClass,  Up: クラスとモジュールのフィクスチャ

5.27.5.16 setUpModule と tearDownModule
.......................................

これらは関数として実装されなければなりません:

     def setUpModule():
         createConnection()

     def tearDownModule():
         closeConnection()

‘setUpModule’ の中で例外が送出されたら、モジュール内のテストは実行されず
、 ‘tearDownModule’ も実行されません。例外が *note SkipTest: 11ea. 例外
であれば、そのモジュールはエラーではなくスキップされたものとして報告され
ます。

例外が発生した場合でも実行しなければならないクリーンアップコードを追加す
るには''addModuleCleanup''を使用します:

 -- の関数: unittest.addModuleCleanup (function, /, *args, **kwargs)

     *note tearDownModule(): 1552. の後に呼び出される関数を追加します。
     この関数はリソースのクリーンアップのために使用します。追加された関
     数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
     addModuleCleanup(): c44. に渡された引数とキーワード引数が追加された
     関数にも渡されます。

     *note setUpModule(): c46. が失敗した場合、つまり *note
     tearDownModule(): 1552. が呼ばれなかった場合でも、追加されたクリー
     ンアップ関数は呼び出されます。

     Added in version 3.8.

 -- の関数: unittest.enterModuleContext (cm)

     Enter the supplied *note context manager: 1e3.  If successful, also
     add its *note __exit__(): 151c. method as a cleanup function by
     *note addModuleCleanup(): c44. and return the result of the *note
     __enter__(): 7e4. method.

     Added in version 3.11.

 -- の関数: unittest.doModuleCleanups ()

     この関数は、 *note tearDownModule(): 1552. の後、もしくは、 *note
     setUpModule(): c46. が例外を投げた場合は ‘setUpModule()’ の後に、無
     条件で呼ばれます。

     このメソッドは、 *note addModuleCleanup(): c44. で追加された関数を
     呼び出す責務を担います。もし、クリーンアップ関数を *note
     tearDownModule(): 1552. より前に呼び出す必要がある場合には、 *note
     doModuleCleanups(): 1c30. を明示的に呼び出してください。

     *note doModuleCleanups(): 1c30. は、どこで呼び出されても、クリーン
     アップ関数をスタックから削除して実行します。

     Added in version 3.8.


File: python.info,  Node: シグナルハンドリング,  Prev: クラスとモジュールのフィクスチャ,  Up: unittest --- ユニットテストフレームワーク

5.27.5.17 シグナルハンドリング
..............................

Added in version 3.2.

unittest の *note -c/-catch: 154e. コマンドラインオプションや、 *note
unittest.main(): 11e9. の ‘catchbreak’ パラメタは、テスト実行中の
control-C の処理をよりフレンドリーにします。中断捕捉動作を有効である場合
、 control-C が押されると、現在実行されているテストまで完了され、そのテ
ストランが終わると今までの結果が報告されます。control-C がもう一度押され
ると、通常通り *note KeyboardInterrupt: bc9. が送出されます。

シグナルハンドラを処理する control-c は、独自の *note signal.SIGINT:
255. ハンドラをインストールするコードやテストの互換性を保とうとします。
‘unittest’ ハンドラが呼ばれ、それがインストールされた ‘signal.SIGINT’ ハ
ンドラで 'なければ' 、すなわちテスト中のシステムに置き換えられて移譲され
たなら、それはデフォルトのハンドラを呼び出します。インストールされたハン
ドラを置き換えて委譲するようなコードは、通常その動作を期待するからです。
‘unittest’ の control-c 処理を無効にしたいような個別のテストには、 *note
removeHandler(): 154f. デコレータが使えます。

フレームワークの作者がテストフレームワーク内で control-c 処理を有効にす
るための、いくつかのユーティリティ関数があります。

 -- の関数: unittest.installHandler ()

     control-c ハンドラをインストールします。(主にユーザが control-c を
     押したことにより) *note signal.SIGINT: 255. が受け取られると、登録
     した結果すべてに *note stop(): 499a. が呼び出されます。

 -- の関数: unittest.registerResult (result)

     control-c 処理のために *note TestResult: 1383. を登録します。結果を
     登録するとそれに対する弱参照が格納されるので、結果がガベージコレク
     トされるのを妨げません。

     control-c 処理が有効でなければ、 *note TestResult: 1383. オブジェク
     トの登録には副作用がありません。ですからテストフレームワークは、処
     理が有効か無効かにかかわらず、作成する全ての結果を無条件に登録でき
     ます。

 -- の関数: unittest.removeResult (result)

     登録された結果を削除します。一旦結果が削除されると、control-c が押
     された際にその結果オブジェクトに対して *note stop(): 499a. が呼び出
     されなくなります。

 -- の関数: 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.27.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: c43. 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(): 1096. デコレータを提供します。さらに、ユニークなオブジ
ェクトの作成には *note sentinel: d9d. が利用できます。 *note Mock: c43.
や *note MagicMock: 1093. 、 ‘patch()’ の利用例は *note quick guide:
49b0. を参照してください。

Mock は *note unittest: 10d. で利用するために設計されており、多くのモッ
クフレームワークで使われる '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.27.6.1 クイックガイド
.......................

*note Mock: c43. および *note MagicMock: 1093. オブジェクトはアクセスし
たすべての属性とメソッドを作成し、どのように使用されたかについての詳細な
情報を格納します。戻り値を指定したり利用できる属性を制限するために
‘Mock’ および ‘MagicMock’ を設定でき、どのよう使用されたかについてアサー
トできます:

     >>> 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: 49b1. によって、モック呼び出し時の例外発生などの副作
用を実行できます:

     >>> 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(): 1096. デコレータ / コンテキストマネージャーによってテスト
対象のモジュール内のクラスやオブジェクトを簡単にモックできます。指定した
オブジェクトはテスト中はモック (または別のオブジェクト) に置換され、テス
ト終了時に復元されます:

     >>> 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(): 1096. では探索される名前空間内のオブジェクトにパッチ
     をあてることが重要です。通常は単純ですが、詳しくは *note
     どこにパッチするか: 49b2. を参照してください。

*note patch(): 1096. デコレータと同様に 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(): 19c7. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> foo = {'key': 'value'}
     >>> original = foo.copy()
     >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):
     ...     assert foo == {'newkey': 'newvalue'}
     ...
     >>> assert foo == original

mock は Python の *note マジックメソッド: 49b3. のモックをサポートしてい
ます。 マジックメソッドのもっとも簡単な利用法は *note MagicMock: 1093. ク
ラスと使うことです。以下のように利用します:

     >>> mock = MagicMock()
     >>> mock.__str__.return_value = 'foobarbaz'
     >>> str(mock)
     'foobarbaz'
     >>> mock.__str__.assert_called_with()

mock によってマジックメソッドに関数 (あるいは他の Mock インスタンス) を
割り当てることができ、それらは適切に呼び出されます。 *note MagicMock:
1093. クラスは、すべてのマジックメソッドがあらかじめ作成されている点を除
けば *note Mock: c43. クラスと一緒です (まあ、とにかく便利ってこと)。

以下は通常の Mock クラスでマジックメソッドを利用する例です:

     >>> mock = Mock()
     >>> mock.__str__ = Mock(return_value='wheeeeee')
     >>> str(mock)
     'wheeeeee'

テスト内のモックオブジェクトが置換するオブジェクトと同じ API を持つこと
を保証するには、 *note auto-speccing: 49b4. を使うことができます。パッチ
をあてる 'autospec' 引数、または *note create_autospec(): 1994. 関数を通
じて 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(): 1994. はクラスにおいても利用でき、 ‘__init__’ メ
ソッドのシグニチャをコピーします。また、呼び出し可能オブジェクトについて
も ‘__call__’ メソッドのシグニチャをコピーします。


File: python.info,  Node: Mock クラス,  Next: patcher,  Prev: クイックガイド,  Up: unittest mock --- モックオブジェクトライブラリ

5.27.6.2 Mock クラス
....................

*note Mock: c43. は、コードにおけるスタブの使用やテストダブルを置き換え
るための柔軟なモックオブジェクトです。モックは呼び出し可能で、属性にアク
セスした場合それを新たなモックとして作成します (1)。同じ属性にアクセスし
た場合は常に同じモックを返します。 モックはどのように使われたかを記録す
るので、コードがモックに行うことについてアサートできます。

*note MagicMock: 1093. は *note Mock: c43. のサブクラスで、すべてのマジ
ックメソッドが事前に作成され、利用できます。また、呼び出し不可能なモック
を作成する場合には、呼び出し不能な変種の *note NonCallableMock: 49b6. や
*note NonCallableMagicMock: 49b7. があります。

*note patch(): 1096. デコレータによって特定のモジュール内のクラスを
*note Mock: c43. オブジェクトで一時的に置換することが簡単にできます。デ
フォルトでは ‘patch()’ は *note MagicMock: 1093. を作成します。
‘patch()’ に渡す 'new_callable' 引数によって、別の ‘Mock’ クラスを指定で
きます。

 -- クラス: unittest.mock.Mock (spec=None, side_effect=None,
          return_value=DEFAULT, wraps=None, name=None, spec_set=None,
          unsafe=False, **kwargs)

     新しい *note Mock: c43. オブジェクトを作成します。 ‘Mock’ はモック
     オブジェクトの挙動を指定するオプション引数をいくつか取ります:

        * 'spec': モックオブジェクトの仕様として働く文字列のリストもしく
          は存在するオブジェクト (クラスもしくはインスタンス) を指定しま
          す。オブジェクトを渡した場合には、 dir 関数によって文字列のリ
          ストが生成されます (サポートされない特殊属性や特殊メソッドは除
          く) 。このリストにない属性にアクセスした際には *note
          AttributeError: 5f0. が発生します。

          'spec' が (文字列のリストではなく) オブジェクトの場合、 *note
          __class__: 16cb. はスペックオブジェクトのクラスを返します。こ
          れによってモックが *note isinstance(): 2af. テストに通るように
          なります。

        * 'spec_set': より厳しい 'spec' です。こちらを利用した場合、
          'spec_set' に渡されたオブジェクトに存在しない属性に対し '設定'
          や取得をしようとした際に *note AttributeError: 5f0. が発生しま
          す。

        * 'side_effect': モックが呼び出された際に呼び出される関数を指定
          します。 *note side_effect: 49b1. 属性を参考にしてください。例
          外を発生させたり、動的に戻り値を変更する場合に便利です。関数に
          は、モックと同じ引数が渡され、 *note DEFAULT: 49b8. を返さない
          限りはこの関数の戻り値が使われます。

          一方で、 'side_effect' には、例外クラスやインスタンスを指定で
          きます。この場合は、モックが呼び出された際に指定された例外を発
          生します。

          もし、 'side_effect' にイテレート可能オブジェクトを指定した場
          合には、モックの呼び出しごとに順に値を返します。

          'side_effect' に ‘None’ を指定した場合には、設定がクリアされま
          す。

        * 'return_value': モックが呼び出された際に返す値です。デフォルト
          では (最初にアクセスされた際に生成される) 新しい Mock を返しま
          す。 *note return_value: 49b9. を参照してください。

        * '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():
     49ba. を参照してください。

      -- メソッド: 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)

          assert the mock has been called with the specified arguments.

          The assert passes if the mock has 'ever' been called, unlike
          *note assert_called_with(): 1e60. and *note
          assert_called_once_with(): 49bb. that only pass if the call is
          the most recent one, and in the case of
          ‘assert_called_once_with()’ 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)

          assert the mock has been called with the specified calls.  The
          *note mock_calls: 49bd. list is checked for the calls.

          'any_order' が false の場合、呼び出しは連続していなければなり
          ません。指定された呼び出しの前、あるいは呼び出しの後に余分な呼
          び出しがある場合があります。

          'any_order' が true の場合、呼び出しは任意の順番でも構いません
          が、それらがすべて *note mock_calls: 49bd. に現われなければな
          りません。

               >>> 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: 49b9.:

               >>> 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: 49b1.:

               >>> 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 ‘reset_mock()’ 'doesn't' clear the *note
          return_value: 49b9, *note side_effect: 49b1. 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: 49bf. や *note
          mock_calls: 49bd. 属性に記録されます。

      -- メソッド: 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(): 49ba. は、モック生成後のコンフィギュレ
          ーションを容易に行うために存在します。

      -- メソッド: __dir__ ()

          *note Mock: c43. オブジェクトは、有用な結果を得るために
          ‘dir(some_mock)’ の結果を制限します。 'spec' を設定したモック
          に対しては、許可された属性のみを含みます。

          このフィルタが何をしていて、どのように停止させるかは、 *note
          FILTER_DIR: 49c1. を参照してください。

      -- メソッド: _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: 49b9. は生成時にも設定可能です:

               >>> mock = Mock(return_value=3)
               >>> mock.return_value
               3
               >>> mock()
               3

      -- の属性: side_effect

          このモックが呼ばれた際に呼び出される関数、イテラブル、もしくは
          発生させる例外 (クラスまたはインスタンス) を設定できます。

          関数を渡した場合はモックと同じ引数で呼び出され、 *note
          DEFAULT: 49b8. を返さない限りはその関数の戻り値が返されます。
          関数が ‘DEFAULT’ を返した場合は ( *note return_value: 49b9. に
          よって) モックの通常の値を返します。

          iterable が渡された場合、その値はイテレータを取り出すために使
          用されます。イテレータは毎回の呼び出しにおいて値を yield しな
          ければなりません。この値は、送出される例外インスタンスか、呼び
          出しからモックに返される値のいずれかです (*note DEFAULT: 49b8.
          の処理は関数の場合と同一です)。

          以下はモックが (API による例外の扱いをテストするために) 例外を
          発生させる例です:

               >>> mock = Mock()
               >>> mock.side_effect = Exception('Boom!')
               >>> mock()
               Traceback (most recent call last):
                 ...
               Exception: Boom!

          *note side_effect: 49b1. を使用して連続的に値を返します:

               >>> 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: 49b1. は生成時にも設定可能です。呼び出し時
          の値に 1 を加えて返す例を以下に示します:

               >>> side_effect = lambda value: value + 1
               >>> mock = Mock(side_effect=side_effect)
               >>> mock(3)
               4
               >>> mock(-8)
               -7

          *note side_effect: 49b1. に ‘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: 1dc7. は、 *note call_args_list: 49c4. や
          *note method_calls: 49bf. 、 *note mock_calls: 49bd. と同様、
          *note call: 1e0f. オブジェクトです。これらはタプルとしてアンパ
          ックすることで個別に取り出すことができます。そして、より複雑な
          アサーションを行うことができます。 *note calls as tuples:
          49c5. を参照してください。

          バージョン 3.8 で変更: ‘args’ と ‘kwargs’ 属性が追加されました
          。

      -- の属性: call_args_list

          モックの呼び出しを順に記録したリストです (よって、このリストの
          長さはモックが呼び出された回数と等しくなります)。モックを作成
          してから一度も呼び出しを行なっていない場合は、空のリストが返さ
          れます。 *note call: 1e0f. オブジェクトは、 *note
          call_args_list: 49c4. の比較対象となる呼び出しのリストを作成す
          る際に便利です。

               >>> 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: 49c4. のメンバは *note call: 1e0f. オブ
          ジェクトです。タプルとしてアンパックすることで個別に取り出すこ
          とができます。 *note calls as tuples: 49c5. を参照してください
          。

      -- の属性: 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: 49bf. のメンバは *note call: 1e0f. オブジ
          ェクトです。タプルとしてアンパックすることで個別に取り出すこと
          ができます。 *note calls as tuples: 49c5. を参照してください。

      -- の属性: mock_calls

          *note mock_calls: 49bd. は、メソッド、特殊メソッド、 'そして'
          戻り値のモックまで、モックオブジェクトに対する 'すべての' 呼び
          出しを記録します。

               >>> 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: 49bd. のメンバは *note call: 1e0f. オブジェ
          クトです。タプルとしてアンパックすることで個別に取り出すことが
          できます。 *note calls as tuples: 49c5. を参照してください。

               注釈: The way *note mock_calls: 49bd. 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(): 2af. も通過することが
          できます:

               >>> mock = Mock(spec=3)
               >>> isinstance(mock, int)
               True

          ‘__class__’ は書き換え可能で、 *note isinstance(): 2af. を通る
          ために必ず 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: c43. です。コンストラクタのパラメー
     タは ‘Mock’ と同様ですが、 'return_value' や 'side_effect' は意味を
     持ちません。

‘spec’ か ‘spec_set’ にクラスかインスタンスを渡した mock は *note
isinstance(): 2af. テストをパスします:

     >>> mock = Mock(spec=SomeClass)
     >>> isinstance(mock, SomeClass)
     True
     >>> mock = Mock(spec_set=SomeClass())
     >>> isinstance(mock, SomeClass)
     True

*note Mock: c43. クラスは、 特殊メソッドをサポートしています。すべての詳
細は *note magic methods: 49b3. を参照してください。

モッククラスや *note patch(): 1096. デコレータは、任意のキーワード引数を
設定できます。 ‘patch()’ デコレータへのキーワード引数は、モックが作られ
る際のコンストラクタに渡されます。キーワード引数は、モックの属性を設定し
ます:

     >>> 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(): 1e60, *note
assert_called_once_with(): 49bb, *note assert_has_calls(): 1a84. and
*note assert_any_call(): 49bc. にも適用されます。 *note autospec を使う:
49b4. と、 モックオブジェクトのメソッド呼び出しにも適用されます。

バージョン 3.4 で変更: spec や autospec を用いて生成されたモックオブジェ
クトは、シグネチャを考慮するようになりました。

 -- クラス: unittest.mock.PropertyMock (*args, **kwargs)

     *note property: 4b3. もしくは:term:‘デスクリプタ <descriptor>’ とし
     て使われるためのモックです。 *note PropertyMock: 49c7. は、 *note
     __get__(): 1706. と *note __set__(): 2415. メソッドを提供し、戻り値
     を指定することができます。

     オブジェクトから *note PropertyMock: 49c7. のインスタンスを取得する
     ことは、引数を与えないモックの呼び出しに相当します。設定は、 設定す
     る値を伴った呼び出しになります。:

          >>> 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: 49c7. を直接モックに取り付ける方法は、モックの属性を
保存する方法によりうまく動作しません。代わりに、モック型に取り付けてくだ
さい:

     >>> 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: 49c7, 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: 1093.  The ‘AsyncMock’
     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 ‘AsyncMock’ object.

     Setting the 'spec' of a *note Mock: c43. or *note MagicMock: 1093.
     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: c43, *note MagicMock: 1093, or
     ‘AsyncMock’ to a class with asynchronous and synchronous functions
     will automatically detect the synchronous functions and set them as
     ‘MagicMock’ (if the parent mock is ‘AsyncMock’ or ‘MagicMock’) or
     ‘Mock’ (if the parent mock is ‘Mock’).  All asynchronous functions
     will be ‘AsyncMock’.

          >>> 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: 1dc6. 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: 1dc6.

               >>> 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(): efa.  Also sets *note
          await_count: 49d0. to 0, *note await_args: 49d1. to None, and
          clears the *note await_args_list: 1dc6.

      -- の属性: 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: 1dc7.

               >>> 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: 1093. for multithreading tests.  The
     ‘ThreadingMock’ 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: 49d2. attribute,
     which defaults to blocking (‘None’).

     You can configure the global default timeout by setting *note
     ThreadingMock.DEFAULT_TIMEOUT: 49d2.

      -- メソッド: 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: 8b9. 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: 8b9. 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
          ‘ThreadingMock’.

     Added in version 3.13.

* Menu:

* 呼び出し::
* 属性の削除::
* Mock の名前と name 属性::
* 属性として設定されるモック::

   ---------- Footnotes ----------

   (1) 例外は特殊メソッドと属性だけです (これらは2つのアンダースコアで開
始・終了します)。モックはこれらの代わりに *note AttributeError: 5f0. を
発生させます。これは、インタープリタが暗黙的にこれらのメソッドを要求する
ためであり、特殊メソッドを予測する際に '非常に' 混乱してしまいます。もし
特殊メソッドのサポートが必要な場合は、 *note magic methods: 49b3. を参照
してください。


File: python.info,  Node: 呼び出し,  Next: 属性の削除,  Up: Mock クラス

5.27.6.3 呼び出し
.................

モックオブジェクトは呼び出し可能です。呼び出しの戻り値は *note
return_value: 49b9. 属性に設定された値です。デフォルトでは新しいモックオ
ブジェクトを返します。この新しいモックは、属性に最初にアクセスした際に作
成されます (明示もしくはモックの呼び出しによって)。 そしてそれは保存され
、それ以降は同じものが返されます。

呼び出しはオブジェクトとして *note call_args: 1dc7. や *note
call_args_list: 49c4. に記録されます。

If *note side_effect: 49b1. 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: 49b1. を例外クラスかインスタンスにする方法が最もシンプルで
す:

     >>> 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: 49b1. 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: 49b9. from inside *note side_effect:
49b1, or return *note DEFAULT: 49b8.:

     >>> 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: 49b1, 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: 49b1. 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: df9. 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.27.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.27.6.5 Mock の名前と name 属性
................................

"name" は *note Mock: c43. コンストラクタの引数なので、モックオブジェク
トが "name" 属性を持つことを望む場合、単に生成時にそれを渡すことはできま
せん。2つの選択肢があります。1つのオプションは *note configure_mock():
49ba. を使用することです:

     >>> 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.27.6.6 属性として設定されるモック
...................................

属性 (もしくは戻り値) に他のモックを設定した場合、このモックは "子" にな
ります。この子に対する呼び出しは、親の *note method_calls: 49bf. や
*note mock_calls: 49bd. に記録されます。これは、子のモックを構成し、親に
そのモックを設定する際に有用です。また、親に対して設定したすべての子の呼
び出しを記録するため、それらの間の順番を確認する際にも有用です:

     >>> 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(): 1096. を用いて作成したモックには、自動的に名前が与えられ
ます。名前を持つモックを設定したい場合には、親に対して *note
attach_mock(): 19b5. メソッドを呼び出します:

     >>> 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.27.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.27.6.8 patch
..............

     注釈: 重要なのは正しい名前空間に対して patch することです。*note
     where to patch: 49dc. セクションを参照してください。

 -- の関数: unittest.mock.patch (target, new=DEFAULT, spec=None,
          create=False, spec_set=None, autospec=None, new_callable=None,
          **kwargs)

     *note patch(): 1096. は関数デコレータ、クラスデコレータ、コンテキス
     トマネージャーとして利用できます。関数や with 文の body では、
     'target' は 'new' オブジェクトにパッチされます。関数/with 文が終了
     すると、パッチは元に戻されます。

     If 'new' is omitted, then the target is replaced with an *note
     AsyncMock: c42. if the patched object is an async function or a
     *note MagicMock: 1093. otherwise.  If ‘patch()’ is used as a
     decorator and 'new' is omitted, the created mock is passed in as an
     extra argument to the decorated function.  If ‘patch()’ is used as
     a context manager the created mock is returned by the context
     manager.

     'target' は ‘'package.module.ClassName'’ の形式の文字列でなければな
     りません。 ‘target’ はインポートされ、指定されたオブジェクトが
     ‘new’ オブジェクトに置き換えられます。なので、 'target' は *note
     patch(): 1096. を呼び出した環境からインポート可能でなければなりませ
     ん。 target がインポートされるのは、デコレートした時ではなく、デコ
     レートされた関数が呼び出された時です。

     patch が *note MagicMock: 1093. を生成する場合、 'spec' と
     'spec_set' キーワード引数は ‘MagicMock’ に渡されます。

     加えて、 ‘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: c42. is used for async functions and *note
     MagicMock: 1093. for the rest.

     より強力な 'spec' の形は 'autospec' です。 ‘autospec=True’ を指定し
     た場合、 mock は置換対象となるオブジェクトから得られる spec で生成
     されます。 mock のすべての属性もまた置換対象となるオブジェクトの属
     性に応じた spec を持ちます。 mock されたメソッドや関数は引数をチェ
     ックし、間違ったシグネチャで呼び出された場合は *note TypeError:
     199. を発生させます。クラスを置き換える mock の場合、その戻り値 (つ
     まりインスタンス) はそのクラスと同じ spec を持ちます。 *note
     create_autospec(): 1994. 関数と *note autospec を使う: 49b4. を参照
     してください。

     置換対象ではなく任意のオブジェクトを spec として使うために、
     ‘autospec=True’ の代わりに、 ‘autospec=some_object’ と指定すること
     ができます。

     By default ‘patch()’ 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: 2b5. 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.  ‘patch()’ finds tests by looking for method names
     that start with ‘patch.TEST_PREFIX’.  By default this is ‘'test'’,
     which matches the way *note unittest: 10d. finds tests.  You can
     specify an alternative prefix by setting ‘patch.TEST_PREFIX’.

     patch は with 文を使ってコンテキストマネージャーとして使うこともで
     きます。その場合パッチは with 文のブロック内でのみ適用されます。
     "as" を使って、 "as" に続いて指定した変数にパッチされたオブジェクト
     が代入されます。これは *note patch(): 1096. が mock オブジェクトを
     生成するときに便利です。

     ‘patch()’ takes arbitrary keyword arguments.  These will be passed
     to *note AsyncMock: c42. if the patched object is asynchronous, to
     *note MagicMock: 1093. otherwise or to 'new_callable' if specified.

     異なるユースケースのために、 ‘patch.dict(...)’,
     ‘patch.multiple(...)’, ‘patch.object(...)’ が用意されています。

*note patch(): 1096. を関数デコレータとして利用し、 mock を生成してそれ
をデコレートされた関数に渡します:

     >>> @patch('__main__.SomeClass')
     ... def function(normal_argument, mock_class):
     ...     print(mock_class is SomeClass)
     ...
     >>> function(None)
     True

クラスをパッチするとそのクラスを *note MagicMock: 1093. の 'インスタンス
' に置き換えます。テスト中のコードからそのクラスがインスタンス化される場
合、 mock の *note return_value: 49b9. が利用されます。

クラスが複数回インスタンス化される場合、 *note side_effect: 49b1. を利用
して毎回新しい mock を返すようにできます。もしくは、 'return_value' に、
何でも好きなものを設定できます。

To configure return values on methods of 'instances' on the patched
class you must do this on the *note return_value: 49b9.  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(): 1096. が 'クラス' を置換
するとき、生成された 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: 1093. の代わりに別
のクラスをモックとして生成したい場合に便利です。例えば、 *note
NonCallableMock: 49b6. を利用したい場合:

     >>> 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: 112e. インス
タンスで置き換えることがあります:

     >>> 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(): 1096. に 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: 49b9. *note
side_effect: 49b1. などもセットアップできます。これらはキーワード引数の
シンタックスでは直接指定できませんが、それらをキーとする辞書を ‘**’ を使
って *note patch(): 1096. に渡すことができます:

     >>> 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(): 1096. 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(): 1096. now returns an *note
AsyncMock: c42. if the target is an async function.


File: python.info,  Node: patch object,  Next: patch dict,  Prev: patch,  Up: patcher

5.27.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(): 1967. はデコレータ、クラスデコレータ、コンテ
     キストマネージャーとして利用できます。引数の 'new', 'spec',
     'create', 'spec_set', 'autospec', 'new_callable' は *note patch():
     1096. と同じ意味を持ちます。 ‘patch()’ と同じく、 ‘patch.object()’
     も mock を生成するための任意のキーワード引数を受け取ります。

     クラスデコレータとして利用する場合、 *note patch.object(): 1967. は
     ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.object(): 1967. の呼び出しには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(): 1967. の引数は *note
patch(): 1096. の引数と同じ意味を持ちます。


File: python.info,  Node: patch dict,  Next: patch multiple,  Prev: patch object,  Up: patcher

5.27.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(): 19c7. はまた、任意のキーワード引数を受け取って
     辞書に設定します。

     バージョン 3.8 で変更: ‘patch.dict()’ now returns the patched
     dictionary when used as a context manager.

*note patch.dict(): 19c7. 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(): 19c7. 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:
49df.

*note patch.dict(): 19c7. を使うと、辞書にメンバーを追加するか、または単
にテストが辞書を変更して、その後テストが終了した時にその辞書が確実に復元
されるようにすることができます。

     >>> 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(): 19c7. を呼び出すときにキーワード引数を使って辞書に値
をセットすることができます。

     >>> mymodule = MagicMock()
     >>> mymodule.function.return_value = 'fish'
     >>> with patch.dict('sys.modules', mymodule=mymodule):
     ...     import mymodule
     ...     mymodule.function('some', 'args')
     ...
     'fish'

*note patch.dict(): 19c7. 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__(): 14e7, *note __delitem__(): 14e8. and either *note
__iter__(): 2105. or *note __contains__(): 15d7.

     >>> 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.27.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(): 49e1. に mock を生成させたい場合、キーワー
     ド引数の値に *note DEFAULT: 49b8. を指定します。この場合生成された
     モックはデコレート対象の関数にキーワード引数として渡され、コンテキ
     ストマネージャーとして ‘patch.multiple()’ が利用された場合は辞書と
     して返します。

     *note patch.multiple(): 49e1. はデコレータ、クラスデコレータ、コン
     テキストマネージャーとして使えます。引数の 'spec', 'spec_set',
     'create', 'autospec', 'new_callable' は *note patch(): 1096. の引数
     と同じ意味を持ちます。これらの引数は ‘patch.multiple()’ によって適
     用される 'すべての' パッチに対して適用されます。

     クラスデコレータとして利用する場合、 *note patch.multiple(): 49e1.
     は ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.multiple(): 49e1. に mock を生成させたい場合、キーワード引数
の値に *note DEFAULT: 49b8. を指定します。‘patch.multiple()’ をデコレー
タとして使った場合生成されたモックはデコレート対象の関数にキーワード引数
として渡されます。:

     >>> 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(): 49e1. は他の ‘patch’ デコレータとネストして利用
できますが、キーワード引数は *note patch(): 1096. によって作られる通常の
引数の '後ろ' で受け取る必要があります:

     >>> @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(): 49e1. がコンテキストマネージャーとして利用される
場合、コンテキストマネージャーが返す値は、名前がキーで値が生成された
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.27.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(): 1096, *note patch.object(): 1967. or
*note patch.dict(): 19c7. 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(): 1096. に 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: 2b5.:

     >>> 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(): c78. を使うと簡単にできます:

          >>> 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(): 49e4. を利用してすべての start されたパッチを
stop することもできます。

 -- の関数: patch.stopall ()

     すべての有効なパッチを stop します。 ‘start’ で開始したパッチしか
     stop しません。


File: python.info,  Node: ビルトインをパッチする,  Next: TEST_PREFIX,  Prev: patch のメソッド start と stop,  Up: patcher

5.27.6.13 ビルトインをパッチする
................................

モジュール内の任意のビルトインに対してパッチを当てることができます。以下
の例はビルトインの *note ord(): 2397. を修正します:

     >>> @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.27.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.27.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.27.6.16 どこにパッチするか
............................

*note patch(): 1096. は (一時的に) ある '名前' が参照しているオブジェク
トを別のものに変更することで適用されます。任意のオブジェクトには、それを
参照するたくさんの名前が存在しえます。なので、必ずテスト対象のシステムが
使っている名前に対して 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(): 1096.  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 ‘patch()’ 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.27.6.17 デスクリプタやプロキシオブジェクトにパッチする
........................................................

*note patch: 49db. と *note patch.object: 49dd. はどちらも デスクリプタ
(クラスメソッド、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.27.6.18 MagicMock と magic method のサポート
..............................................

* Menu:

* Magic Method をモックする::
* Magic Mock::


File: python.info,  Node: Magic Method をモックする,  Next: Magic Mock,  Up: MagicMock と magic method のサポート

5.27.6.19 Magic Method をモックする
...................................

*note Mock: c43. supports mocking the Python protocol methods, also
known as *note "magic methods": 49ec.  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: 187. 文の中でコンテキストマネージャーと
して使われるオブジェクトを 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: 49bf. に含まれませんが、
*note mock_calls: 49bd. には記録されます。

     注釈: 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__():
e50.

バージョン 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.27.6.20 Magic Mock
....................

‘MagicMock’ 系のクラスは2種類あります: *note MagicMock: 1093. と *note
NonCallableMagicMock: 49b7. です。

 -- クラス: unittest.mock.MagicMock (*args, **kw)

     ‘MagicMock’ is a subclass of *note Mock: c43. with default
     implementations of most of the *note magic methods: 49ec.  You can
     use ‘MagicMock’ without having to configure the magic methods
     yourself.

     コンストラクタの引数は *note Mock: c43. と同じ意味を持っています。

     'spec' か 'spec_set' 引数を利用した場合、 spec に存在する magic
     method 'のみ' が生成されます。

 -- クラス: unittest.mock.NonCallableMagicMock (*args, **kw)

     callable でないバージョンの *note MagicMock: 1093.

     コンストラクタの引数は *note MagicMock: 1093. と同じ意味を持ちます
     が、 'return_value' と 'side_effect' は callable でない mock では意
     味を持ちません。

*note MagicMock: 1093. が 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: 1a3.

   * ‘__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: 49b1. 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

The return value of ‘__iter__()’ can be any iterable object and isn't
required to be an iterator:

     >>> 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.27.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.27.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: d9d. はこの
ようなオブジェクトを生成し、同一性をテストするのに便利な方法を提供します
。

次の例では、 ‘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.27.6.23 DEFAULT
.................

 -- データ: unittest.mock.DEFAULT

     *note DEFAULT: 49b8. オブジェクトは事前に生成された sentinel (実際
     には ‘sentinel.DEFAULT’) オブジェクトです。 *note side_effect:
     49b1. 関数が、通常の戻り値を使うことを示すために使います。


File: python.info,  Node: call,  Next: create_autospec,  Prev: DEFAULT,  Up: ヘルパー

5.27.6.24 call
..............

 -- の関数: unittest.mock.call (*args, **kwargs)

     *note call(): 1e0f. は *note call_args: 1dc7, *note call_args_list:
     49c4, *note mock_calls: 49bd, *note method_calls: 49bf. と比較して
     より簡単に assert できるようにするためのヘルパーオブジェクトです。
     ‘call()’ は *note assert_has_calls(): 1a84. と組み合わせて使うこと
     もできます。

          >>> 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(): 49f2. はすべての途中の呼び出しと最終の呼び出しを含むリ
     ストを返します。

‘call_list’ は特に "chained call" に対して assert するのに便利です。
"chained call" は1行のコードにおける複数の呼び出しです。この結果は mock
の *note mock_calls: 49bd. に複数の call エントリとして格納されます。こ
の call のシーケンスを手動で構築するのは退屈な作業になります。

*note call_list(): 49f2. は同じ 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: 1dc7, *note Mock.call_args_list: 49c4, *note
Mock.mock_calls: 49bd. 属性の中の ‘call’ オブジェクトを解析して個々の引
数を解析することができます。

*note Mock.call_args: 1dc7. と *note Mock.call_args_list: 49c4. の中の
‘call’ オブジェクトは (位置引数, キーワード引数) のタプルで、 *note
Mock.mock_calls: 49bd. の中の ‘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.27.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(): 1994. は任意のキーワード引数を受け取り、生
     成する mock のコンストラクタに渡します。

*note create_autospec(): 1994. や、 *note patch(): 1096. の 'autospec' 引
数で autospec を使うサンプルは *note autospec を使う: 49b4. を参照してく
ださい。

バージョン 3.8 で変更: *note create_autospec(): 1994. now returns an
*note AsyncMock: c42. if the target is an async function.


File: python.info,  Node: ANY,  Next: FILTER_DIR,  Prev: create_autospec,  Up: ヘルパー

5.27.6.26 ANY
.............

 -- データ: unittest.mock.ANY

mock の呼び出しのうち '幾つか' の引数に対して assert したいけれども、そ
れ以外の引数は気にしない、あるいは *note call_args: 1dc7. から個別に取り
出してより高度な assert を行いたい場合があります。

特定の引数を無視するために、 'すべて' と等しくなるオブジェクトを使うこと
ができます。そうすると、 *note assert_called_with(): 1e60. と *note
assert_called_once_with(): 49bb. は、実際の引数が何であったかに関わらず
成功します。

     >>> mock = Mock(return_value=None)
     >>> mock('foo', bar=object())
     >>> mock.assert_called_once_with('foo', bar=ANY)

*note mock_calls: 49bd. などの call list との比較に *note ANY: 1e0d. を
使うこともできます:

     >>> m = MagicMock(return_value=None)
     >>> m(1)
     >>> m(1, 2)
     >>> m(object())
     >>> m.mock_calls == [call(1), call(1, 2), ANY]
     True

*note ANY: 1e0d. 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.27.6.27 FILTER_DIR
....................

 -- データ: unittest.mock.FILTER_DIR

*note FILTER_DIR: 49c1. は 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: c43. 自
身のプライベートな) 属性は、アンダースコアと2つのアンダースコアで prefix
された属性は ‘Mock’ に対して *note dir(): 844. した結果からフィルタリン
グされます。この動作が嫌な場合は、モジュールレベルの *note FILTER_DIR:
49c1. スイッチを設定することでフィルターを切ることができます。

     >>> 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: 49c1.


File: python.info,  Node: mock_open,  Next: autospec を使う,  Prev: FILTER_DIR,  Up: ヘルパー

5.27.6.28 mock_open
...................

 -- の関数: unittest.mock.mock_open (mock=None, read_data='')

     *note open(): 318. の利用を置き換えるための mock を作るヘルパー関数
     。 ‘open()’ を直接呼んだりコンテキストマネージャーとして利用する場
     合に使うことができます。

     'mock' 引数は構成する mock オブジェクトです。 ‘None’ (デフォルト) な
     ら、通常のファイルハンドルと同じ属性やメソッドにAPIが制限された
     *note MagicMock: 1093. が生成されます。

     'read_data' is a string for the *note read(): 1021, *note
     readline(): 1545, and *note readlines(): 2819. 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(): 1545. and *note
     readlines(): 2819. support.  The mock of *note read(): 1021.
     changed to consume 'read_data' rather than returning it on each
     call.

     バージョン 3.5 で変更: 'read_data' は 'mock' を呼び出す度に毎回リセ
     ットされるようになりました。

     バージョン 3.8 で変更: Added *note __iter__(): 2105. to
     implementation so that iteration (such as in for loops) correctly
     consumes 'read_data'.

*note open(): 318. をコンテキストマネージャーとして使う方法は、ファイル
が必ず適切に閉じられるようにする素晴らしい方法で、今では一般的になってい
ます:

     with open('/some/path', 'w') as f:
         f.write('something')

The issue is that even if you mock out the call to *note open(): 318. it
is the 'returned object' that is used as a context manager (and has
*note __enter__(): 7e4. and *note __exit__(): 151c. called).

コンテキストマネージャーを *note MagicMock: 1093. でモックするのは一般的
かつ面倒なので、ヘルパー関数を用意しています。:

     >>> 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.27.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: 199. if they are called incorrectly.

autospec の動作について説明する前に、それが必要となる背景から説明してい
きます。

*note Mock: c43. 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(): 1096. か *note
patch.object(): 1967. に ‘autospec=True’ を渡すか、 *note
create_autospec(): 1994. 関数を使って spec をもとに mock を作ることがで
きます。 ‘patch()’ の引数に ‘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(): 1096. 呼び出しに ‘autospec=True’ を
加えるだけで、ミススペルやAPI変更に伴うバグから守られます。

*note patch(): 1096. を経由する以外にも、 *note create_autospec(): 1994.
を使って '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__(): 8c0. 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__():
8c0.  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(): 1096. はこれをサポートしていて、 '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.27.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.27.6.31 Order of precedence of ‘side_effect’, ‘return_value’ and 'wraps'
..........................................................................

The order of their precedence is:

  1. *note side_effect: 49b1.

  2. *note return_value: 49b9.

  3. 'wraps'

If all three are set, mock will return the value from *note side_effect:
49b1, ignoring *note return_value: 49b9. 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: 49b1, if you
reassign its value back to ‘None’, the order of precedence will be
checked between *note return_value: 49b9. and the wrapped object,
ignoring ‘side_effect’.

     >>> order_mock.get_value.side_effect = None
     >>> order_mock.get_value()
     'second'

If the value being returned by *note side_effect: 49b1. is *note
DEFAULT: 49b8, 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: c43. wraps an object, the default value of *note
return_value: 49b9. will be *note DEFAULT: 49b8.

     >>> 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: 49b1. 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.27.7 ‘unittest.mock’ -- 入門
------------------------------

Added in version 3.3.

* Menu:

* Mock を使う::
* Patch decorators::
* Further examples::


File: python.info,  Node: Mock を使う,  Next: Patch decorators,  Up: unittest mock --- 入門

5.27.7.1 Mock を使う
....................

* Menu:

* Mock patching methods::
* Mock for method calls on an object::
* Mocking classes::
* モックに名前をつける::
* Tracking all calls::
* Setting return values and attributes::
* モックから例外を発生させる::
* side_effect の関数と iterable::
* 非同期イテレータをモックする::
* 非同期コンテキストマネージャをモックする::
* Creating a mock from an existing object::
* Using side_effect to return per file content::


File: python.info,  Node: Mock patching methods,  Next: Mock for method calls on an object,  Up: Mock を使う

5.27.7.2 Mock patching methods
..............................

一般的な *note Mock: c43. の使い方の中には次のものがあります:

   * メソッドにパッチを当てる

   * オブジェクトに対するメソッド呼び出しを記録する

システムの他の部分からメソッドが正しい引数で呼び出されたかどうかを確認す
るために、そのオブジェクトのメソッドを置き換えることができます:

     >>> real = SomeClass()
     >>> real.method = MagicMock(name='method')
     >>> real.method(3, 4, 5, key='value')
     <MagicMock name='method()' id='...'>

モック(上の例では ‘real.method’)が利用された場合、どう使われたかを
assert できるようにする属性やメソッドがモックにあります。

     注釈: この例のような場合、たいてい *note Mock: c43. と *note
     MagicMock: 1093. は互換です。 ‘MagicMock’ の方が強力なので、デフォ
     ルトではこちらを使うといいでしょう。

モックが呼び出されると、その *note called: 49c3. 属性が ‘True’ に設定さ
れます。そして *note assert_called_with(): 1e60. や *note
assert_called_once_with(): 49bb. メソッドを使ってそのメソッドが正しい引
数で呼び出されたかどうかをチェックできます。

次の例では ‘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: Mock for method calls on an object,  Next: Mocking classes,  Prev: Mock patching methods,  Up: Mock を使う

5.27.7.3 Mock for method calls on an object
...........................................

上の例ではオブジェクトのメソッドに対して直接パッチを当てて、それが正しく
呼び出されていたかどうかをテストしていました。もう一つのよくあるユースケ
ースが、モックをメソッド (またはテスト対象のシステムのどこか) に渡して、
それが正しく利用されたかどうかをチェックする方法です。

次の例で、‘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(): 1e60. が failure 例外を発生させます。


File: python.info,  Node: Mocking classes,  Next: モックに名前をつける,  Prev: Mock for method calls on an object,  Up: Mock を使う

5.27.7.4 Mocking classes
........................

他のよくあるユースケースが、テスト対象のコードによってインスタンス化され
ているクラスをモックに置き換えることです。クラスに patch すると、そのク
ラスがモックに置き換えられます。インスタンスは 'クラスを呼び出した時に'
作られます。なので、モックの戻り値を使うことで、「モックのインスタンス」
にアクセスできます。

次の例では、 ‘some_function’ という関数が ‘Foo’ をインスタンス化し、その
method を呼び出しています。 *note patch(): 1096. を呼び出すと ‘Foo’ クラ
スをモックに置き換えます。 ‘Foo’ のインスタンスはモックを呼び出して作ら
れるので、モックの *note return_value: 49b9. を変更することでカスタマイ
ズできます。:

     >>> 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: Tracking all calls,  Prev: Mocking classes,  Up: Mock を使う

5.27.7.5 モックに名前をつける
.............................

モックに名前をつけると便利なことがあります。その名前はモックを repr した
ときに表示されるので、モックがテスト失敗のメッセージ内に現れた時に便利で
す。また、モックの名前はそのモックの属性やメソッドにも伝播します:

     >>> mock = MagicMock(name='foo')
     >>> mock
     <MagicMock name='foo' id='...'>
     >>> mock.method
     <MagicMock name='foo.method' id='...'>


File: python.info,  Node: Tracking all calls,  Next: Setting return values and attributes,  Prev: モックに名前をつける,  Up: Mock を使う

5.27.7.6 Tracking all calls
...........................

メソッドの複数回の呼び出しをトラックしたいことがあります。 *note
mock_calls: 49bd. 属性は、そのモックの子属性やさらにその子孫に対する呼び
出しすべてを記録しています。

     >>> 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: 1e0f. オブジェクト
を利用できます:

     >>> 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: Setting return values and attributes,  Next: モックから例外を発生させる,  Prev: Tracking all calls,  Up: Mock を使う

5.27.7.7 Setting return values and attributes
.............................................

モックオブジェクトに戻り値を設定するのはとっても簡単です:

     >>> 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: 1e0f. を使って "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: Setting return values and attributes,  Up: Mock を使う

5.27.7.8 モックから例外を発生させる
...................................

*note side_effect: 49b1. という便利な属性があります。この属性に例外クラ
スやそのインスタンスを設定すると、モックが呼ばれた時にその例外を発生させ
ます。

     >>> 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.27.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.27.7.10 非同期イテレータをモックする
......................................

Python 3.8以降、‘AsyncMock’ と ‘MagicMock’ は ‘__aiter__’ を通じて *note
非同期イテレータ (Asynchronous Iterator): f7b. のモックをサポートしてい
ます。‘__aiter__’ の *note return_value: 49b9. 属性はイテレーションに使
用される戻り値を設定するために使用できます。

     >>> 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: Creating a mock from an existing object,  Prev: 非同期イテレータをモックする,  Up: Mock を使う

5.27.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: Creating a mock from an existing object,  Next: Using side_effect to return per file content,  Prev: 非同期コンテキストマネージャをモックする,  Up: Mock を使う

5.27.7.12 Creating a mock from an existing object
.................................................

mock を使いすぎることの問題の一つは、テストが実際のコードではなく mock の
実装をテストするようになってしまうことです。‘some_method’ というメソッド
を実装したクラスがあるとします。他のクラスをテストするときに、
‘some_method’ を提供する mock を使います。最初のクラスをリファクタリング
して ‘some_method’ がなくなった時、コードは壊れているのにテストは通る状
態になってしまいます

*note Mock: c43. は '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: 49b4. を使用します。

任意の属性の参照だけでなく代入も禁止するより強い定義を利用したい場合は、
'spec' の代わりに 'spec_set' を使います。


File: python.info,  Node: Using side_effect to return per file content,  Prev: Creating a mock from an existing object,  Up: Mock を使う

5.27.7.13 Using side_effect to return per file content
......................................................

*note mock_open(): 11ed. is used to patch *note open(): 318. method.
*note side_effect: 49b1. 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 decorators,  Next: Further examples,  Prev: Mock を使う,  Up: unittest mock --- 入門

5.27.7.14 Patch decorators
..........................

     注釈: *note patch(): 1096. では探索される名前空間内のオブジェクトに
     パッチをあてることが重要です。通常は単純ですが、クイックガイドには
     *note どこにパッチするか: 49b2. を読んでください。

テストの中でクラス属性やモジュール属性、例えば組み込み関数や、テスト対象
モジュールにあるインスタンス化されるクラスに対してパッチしたいことがあり
ます。モジュールやクラスは実際はグローバルなので、パッチするときは必ずテ
スト後にパッチを解除しないと、そのパッチが永続化されて他のテストに影響を
与え、解析しにくい問題になります。

mock はこのために3つの便利なデコレータを提供しています: *note patch():
1096, *note patch.object(): 1967, *note patch.dict(): 19c7. です。
‘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(): 1967. の代わりに *note patch(): 1096. を使用してください
:

     >>> 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(): 1096. を1引数で (または
*note patch.object(): 1967. を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(): 19c7. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> 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(): 1096. に 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: Further examples,  Prev: Patch decorators,  Up: unittest mock --- 入門

5.27.7.15 Further examples
..........................

より高度なシナリオを想定した例をあげていきます。

* Menu:

* chained call をモックする::
* 部分的なモック::
* Mocking a generator method::
* 同じパッチを全てのメソッドに適用する::
* Mocking unbound methods::
* モックで複数回の呼び出しをチェックする::
* ミュータブルな引数に対処する::
* Nesting patches::
* 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: Further examples

5.27.7.16 chained call をモックする
...................................

chained call を mock するのは、一度 *note return_value: 49b9. 属性を理解
してしまえば簡単です。mock が最初に呼ばれた時や、呼び出される前に
‘return_value’ を参照した場合、新しい *note Mock: c43. が生成されます。

つまり、戻り値のオブジェクトがどう利用されたかは、‘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(): 318. を ‘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(): 49ba. メソッドを使用して次のようにすることができます:

     >>> 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: 49bd. を使用すると、チェーンされた呼び出しを単一のアサ
ーションでチェックすることができます。チェーンされた呼び出しは、1行のコ
ードの中で行われる複数の呼び出しです。したがって、 ‘mock_calls’ には複数
のエントリーがあるでしょう。 *note call.call_list(): 49f2. を使用するこ
とで、この呼び出しのリストを作成することができます:

     >>> 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: Mocking a generator method,  Prev: chained call をモックする,  Up: Further examples

5.27.7.17 部分的なモック
........................

For some tests, you may want to mock out a call to *note
datetime.date.today(): 16e8. to return a known date, but don't want to
prevent the code under test from creating new date objects.
Unfortunately *note datetime.date: 1fc. is written in C, so you cannot
just monkey-patch out the static ‘datetime.date.today()’ 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: 1096. が使用されています。そして、モックの date クラス
の *note side_effect: 49b1. 属性は、本物の date を返すラムダ関数にセット
されます。モックの date クラスが呼ばれる時、 ‘side_effect’ によって本物
の date が構築されて返されます。:

     >>> import datetime as dt
     >>> with patch('mymodule.date') as mock_date:
     ...     mock_date.today.return_value = dt.date(2010, 10, 8)
     ...     mock_date.side_effect = lambda *args, **kw: dt.date(*args, **kw)
     ...
     ...     assert mymodule.date.today() == dt.date(2010, 10, 8)
     ...     assert mymodule.date(2009, 6, 8) == dt.date(2009, 6, 8)

グローバルに *note datetime.date: 1fc. にパッチするのではなく、それを使
用するモジュールの中の ‘date’ にパッチしていることに留意してください。
*note どこにパッチするか: 49b2. を参照してください。

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: Mocking a generator method,  Next: 同じパッチを全てのメソッドに適用する,  Prev: 部分的なモック,  Up: Further examples

5.27.7.18 Mocking a generator method
....................................

Pythonのジェネレータは、反復処理された時に一連の値を返す *note yield:
bc6. 文を使用した関数やメソッドです (1)。

ジェネレータメソッド/関数はジェネレータオブジェクトを返すために呼び出さ
れます。そしてこのジェネレータオブジェクトが反復処理されます。イテレーシ
ョンのためのプロトコルメソッドは *note __iter__(): 2105. なので、*note
MagicMock: 1093. を使ってこれをモックすることができます。

ここでは"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: 24f. の呼び出しの中での暗黙的な)イテレーションから返される
値を設定するには、‘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: Mocking unbound methods,  Prev: Mocking a generator method,  Up: Further examples

5.27.7.19 同じパッチを全てのメソッドに適用する
..............................................

複数のテストメソッドに複数のパッチを適用したい場合、当然のことながらすべ
てのメソッドにパッチデコレータを適用することになります。これは不要な繰り
返しのように感じられます。代わりに、(あらゆる形態の) *note patch():
1096. をクラスデコレータとして使用することができます。これはそのクラスの
すべてのテストメソッドにパッチを適用します。テストメソッドは名前が
‘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:
49e3.を使用する方法があります。これらを使うと、パッチを ‘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(): c78. を使
うと簡単にできます:

     >>> 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: Mocking unbound methods,  Next: モックで複数回の呼び出しをチェックする,  Prev: 同じパッチを全てのメソッドに適用する,  Up: Further examples

5.27.7.20 Mocking unbound methods
.................................

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(): 1096. 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: Mocking unbound methods,  Up: Further examples

5.27.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(): 49bb. method that also asserts that the *note
call_count: 17f3. 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: 49c4.:

     >>> 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: 1e0f. ヘルパーを使えば、これらの呼び出しについて簡単にアサー
トすることができます。予想される呼び出しのリストを作成し、それを
''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: Nesting patches,  Prev: モックで複数回の呼び出しをチェックする,  Up: Further examples

5.27.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: 49b1.
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(): d69. を使用して）引数をコピ
ーする、 *note Mock: c43. や *note MagicMock: 1093. のサブクラスを作成す
る方法があります。以下に実装例を示します。

     >>> 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: Nesting patches,  Next: MagicMock で辞書をモックする,  Prev: ミュータブルな引数に対処する,  Up: Further examples

5.27.7.23 Nesting patches
.........................

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: 49e3. 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: Nesting patches,  Up: Further examples

5.27.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: 1093, which will behave like a
dictionary, and using *note side_effect: 49b1. to delegate dictionary
access to a real underlying dictionary that is under our control.

When the *note __getitem__(): 588. and *note __setitem__(): 14e7.
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: 49c4. 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: Further examples

5.27.7.25 Mock のサブクラスと属性
.................................

There are various reasons why you might want to subclass *note Mock:
c43.  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: Further examples

5.27.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: 1791.
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(): 19c7. to 'temporarily' put a
mock in place in *note sys.modules: 1791.  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: 1791.

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: Further examples

5.27.7.27 Tracking order of calls and less verbose call assertions
..................................................................

The *note Mock: c43. class allows you to track the 'order' of method
calls on your mock objects through the *note method_calls: 49bf.
attribute.  This doesn't allow you to track the order of calls between
separate mock objects, however we can use *note mock_calls: 49bd. 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(): 19b5.
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(): 1a84. method.  This takes a list of calls
(constructed with the *note call: 1e0f. object).  If that sequence of
calls are in *note mock_calls: 49bd. 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: Further examples

5.27.7.28 More complex argument matching
........................................

Using the same basic concept as *note ANY: 1e0d. 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(): 1e60. 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: 8b9. 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: 8b9. 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.27.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.
‘test.support’ is used to enhance your tests while ‘test.regrtest’
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: 10d. 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: 10d. モジュール

     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.27.8.1 Writing Unit Tests for the ‘test’ package
..................................................

*note unittest: 10d. モジュールを使ってテストを書く場合、幾つかのガイド
ラインに従うことが推奨されます。 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: 10d. のコマンドラインインターフェースをサポ
ートしているスクリプトとして自分自身を起動したり、 ‘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: 2b5. 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 ‘unittest.TestCase’.

参考
....

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.27.8.2 コマンドラインインターフェースを利用してテストを実行する
.................................................................

The ‘test’ package can be run as a script to drive Python's regression
test suite, thanks to the *note -m: 23e. 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: 1b9.


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.27.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:
     10d. ベースのテストでは廃止予定で、 *note unittest.TestCase: 2b5. の
     assertXXX メソッドが推奨されます。

 -- 例外: test.support.ResourceDenied

     *note unittest.SkipTest: 11ea. のサブクラスです。 (ネットワーク接続
     のような) リソースが利用できないとき送出されます。 *note
     requires(): 4a24. 関数によって送出されます。

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(): fa7, *note
     recv(): fa8. and *note send(): fab. methods of *note socket.socket:
     fa5.

     デフォルト値は5秒です。

     *note INTERNET_TIMEOUT: 1dfa. も参照してください。

 -- データ: 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: 1dfa. should not
     mark a test as failed, but skip the test instead: see *note
     transient_internet(): 4a2d.

     デフォルト値は1分です。

     *note LOOPBACK_TIMEOUT: 1df9. も参照してください。

 -- データ: 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 ‘SHORT_TIMEOUT’ starts to fail randomly on slow
     buildbots, use *note LONG_TIMEOUT: 1dfb. 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: 1df9, *note INTERNET_TIMEOUT:
     1dfa. and *note SHORT_TIMEOUT: 1cc0.

 -- データ: 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: 189a. 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: 13e1. を設定し
     ます。

 -- データ: test.support.max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 4a37. を設定します。 *note MAX_Py_ssize_t: 4a35. が
     設定上限です。

 -- データ: test.support.real_max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 4a37. を設定します。 *note MAX_Py_ssize_t: 4a35. の
     設定上限はありません。

 -- データ: 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: 21fc. option.

     See also the *note HAVE_DOCSTRINGS: 4a3a. variable.

 -- データ: test.support.HAVE_DOCSTRINGS

     Set to ‘True’ if function docstrings are available.  See the *note
     python -OO: 18d. option, which strips docstrings of functions
     implemented in Python.

     See also the *note MISSING_C_DOCSTRINGS: 4a39. 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:
     4a3c.).  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: 8b9. 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(): 4a40. 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: 4a23. を送出
     します。その場合、 'msg' は ‘ResourceDenied’ の引数になります。
     ‘__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(): b48. 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: 4a36. and *note
     real_max_memuse: 4a38. 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():
     4a4b. 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: 112e. オブジェクトで一時的
     に置き換えるコンテキストマネージャです。

     出力ストリームの使用例:

          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: cd1. and then on
     *note sys.stderr: b37.  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__: 4a58.  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: 8b9. if the process exit code is not
     equal to 'exitcode'.

     If the process runs longer than 'timeout' seconds (*note
     SHORT_TIMEOUT: 1cc0. by default), kill the process and raise an
     *note AssertionError: 8b9.  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: 4a5b. 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(): 496f. の印をテストに付
     けるデコレータ。 このデコレータを使うときはいつも、関連する問題を指
     し示すコメントを付けておくべきです。

 -- の関数: 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: 165. 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: 13a. 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: 4a3a.

 -- の関数: @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(): 4a4a. 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: 10d. instance for
     the test.  'errtext' is the regular expression which should match
     the string representation of the raised *note SyntaxError: 18f.  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: 4a22.

 -- の関数: 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: 11ea. 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: 10d. ‘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: 11ea.
     if *note tracemalloc: 106. 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__: 272f. 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: 2c2.

     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(): 1789. 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(): 1831. is used to set *note
     resource.RLIMIT_CORE: 4a82.'s soft limit to 0 to prevent coredump
     file creation.

     On both platforms, the old value is restored by *note __exit__():
     151c.

 -- クラス: 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(): 4a84. 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.27.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: 1c0a, *note
     SOCK_STREAM: 150f.), 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(): 4a8c. 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 ‘bind_port()’ over
     ‘find_unused_port()’ 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: 1c0a. and
     ‘sock.type’ is *note SOCK_STREAM: 150f, 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: 11ea. if *note
     PermissionError: f42. 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: 4a23. 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.27.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: 3ee. is one way to get most of the
     testsuite to run in that situation.  *note PYTHONPATH: 1223. 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(): 4a92. 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.27.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: 8b9.

 -- メソッド: BytecodeTestCase.assertNotInBytecode (x, opname,
          argval=_UNSPECIFIED)

     Throws *note AssertionError: 8b9. 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.27.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:
     8b9. 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(): 36d4.  ‘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: 177. exception
     using *note threading.excepthook(): a4f.

     Attributes set when an exception is caught:

        * ‘exc_type’

        * ‘exc_value’

        * ‘exc_traceback’

        * ‘thread’

     See *note threading.excepthook(): a4f. 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.27.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(): e53. でエンコードできる 非 ASCII 文字。

 -- データ: test.support.os_helper.SAVEDCWD

     *note os.getcwd(): 196a. に設定されます。

 -- データ: test.support.os_helper.TESTFN

     テンポラリファイルの名前として安全に利用できる名前に設定されます。
     作成した一時ファイルは全て閉じ、unlink (削除) しなければなりません
     。

 -- データ: test.support.os_helper.TESTFN_NONASCII

     Set to a filename containing the *note FS_NONASCII: 4aa9.
     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__(): e50. 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(): 130f. 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(): 354. on 'path' or call *note
     os.lstat(): 6c8. and *note os.rmdir(): 130f. to remove a path and
     its contents.  As with *note rmdir(): 4ab9, 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(): 1311. on 'filename'.  As with *note
     rmdir(): 4ab9, 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.27.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: 11ea. 例外を発生させます。

     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: 293.

     Added in version 3.1.

 -- の関数: test.support.import_helper.modules_setup ()

     Return a copy of *note sys.modules: 1791.

 -- の関数: 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: 1a4. 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:
     3e2.

     This makes a copy of *note sys.path: 3e2, appends any directories
     given as positional arguments, then reverts ‘sys.path’ to the
     copied settings when the context ends.

     Note that 'all' *note sys.path: 3e2. 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.27.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: 2769. or a subclass.  Roughly equivalent to *note
     warnings.catch_warnings(): 17a. with *note
     warnings.simplefilter('ignore', category=category): 8d1.  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
     ‘ResourceWarning’ 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: 1af. is
     emitted only once, and that it will be converted to a *note
     SyntaxError: 18f. when turned into error.  'testcase' is the *note
     unittest: 10d. instance for the test.  'errtext' is the regular
     expression which should match the string representation of the
     emitted ‘SyntaxWarning’ and raised ‘SyntaxError’.  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(): 17a.
     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(): 8d1. 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: 119. 属性
     から、 *note catch_warnings(): 17a. から得られる警告のリストを取得
     することができます。便利さのために、レコーダーオブジェクトから直接
     、一番最近に発生した警告を表すオブジェクトの属性にアクセスできます
     (以下にある例を参照してください)。警告が1つも発生しなかった場合、そ
     れらの全ての属性は ‘None’ を返します。

     レコーダーオブジェクトの ‘reset()’ メソッドは警告リストをクリアしま
     す。

     コンテキストマネージャーは次のようにして使います:

          with check_warnings(("assertion is always true", SyntaxWarning),
                              ("", UserWarning)):
              exec('assert(False, "Hey!")')
              warnings.warn(UserWarning("Hide me!"))

     この場合、どちらの警告も発生しなかった場合や、それ以外の警告が発生
     した場合は、 *note check_warnings(): 4ace. はエラーを発生させます。

     警告が発生したかどうかだけでなく、もっと詳しいチェックが必要な場合
     は、次のようなコードになります:

          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(): 4ace. のドキュメントを参照してください。


File: python.info,  Node: Debugging and Profiling,  Next: ソフトウェア・パッケージと配布,  Prev: 開発ツール,  Up: Python 標準ライブラリ

5.28 Debugging and Profiling
============================

ここに含まれるライブラリは Python での開発を手助けするものです。デバッガ
を使うと、コードのステップ実行や、スタックフレームの解析、ブレークポイン
トの設定などができます。プロファイラはコードを実行して実行時間の詳細を提
供し、プログラムのボトルネックを特定できるようにします。

* Menu:

* 監査イベント表::
* bdb: bdb --- デバッガーフレームワーク. デバッガーフレームワーク
* faulthandler: faulthandler --- Python トレースバックをダンプする. Python トレースバックをダンプする
* pdb: pdb --- The Python Debugger. The Python Debugger
* The Python Profilers::
* timeit: timeit --- 小さなコードスニペットの実行時間計測. 小さなコードスニペットの実行時間計測
* trace: trace --- Python 文実行のトレースと追跡. Python 文実行のトレースと追跡
* tracemalloc: tracemalloc --- メモリ割り当ての追跡. メモリ割り当ての追跡


File: python.info,  Node: 監査イベント表,  Next: bdb --- デバッガーフレームワーク,  Up: Debugging and Profiling

5.28.1 監査イベント表
---------------------

この表は、 CPython ランタイムと標準ライブラリ全体で *note sys.audit():
197b. または *note PySys_Audit(): 613. の呼び出しによって送出されるすべ
てのイベントを含んでいます。これらの呼び出しは、 3.8 以降に追加されまし
た ( PEP 578(1) を参照) 。

これらのイベントの処理についての情報は *note sys.addaudithook(): 4ad5. と
*note PySys_AddAuditHook(): 4ad6. を参照してください。

この表は CPython ドキュメントから生成されており、他の実装により送出され
るイベントを表示していない可能性があります。実際に送出されるイベントは、
ランタイム固有のドキュメントを参照してください。

Audit event                        Arguments                                                   References
                                                                                               
-------------------------------------------------------------------------------------------------------------------
                                                                                               
_thread.start_new_thread           ‘function’, ‘args’, ‘kwargs’                                *note [1]: 4ad7.
                                                                                               
                                                                                               
array.__new__                      ‘typecode’, ‘initializer’                                   *note [1]: 4be.
                                                                                               
                                                                                               
builtins.breakpoint                ‘breakpointhook’                                            *note [1]: 273.
                                                                                               
                                                                                               
builtins.id                        ‘id’                                                        *note [1]: 1641.
                                                                                               
                                                                                               
builtins.input                     ‘prompt’                                                    *note [1]: 14f4.
                                                                                               
                                                                                               
builtins.input/result              ‘result’                                                    *note [1]: 14f4.
                                                                                               
                                                                                               
code.__new__                       ‘code’, ‘filename’, ‘name’, ‘argcount’,                     *note [1]: 32d.
                                   ‘posonlyargcount’, ‘kwonlyargcount’, ‘nlocals’,             
                                   ‘stacksize’, ‘flags’
                                   
                                                                                               
compile                            ‘source’, ‘filename’                                        *note [1]: 4b1.
                                                                                               
                                                                                               
cpython.PyConfig_Set               ‘name’, ‘value’                                             *note [1]: 37b.
                                                                                               
                                                                                               
cpython.PyInterpreterState_Clear                                                               *note [1]: 4ad8.
                                                                                               
                                                                                               
cpython.PyInterpreterState_New                                                                 *note [1]: 4ad9.
                                                                                               
                                                                                               
cpython._PySys_ClearAuditHooks                                                                 *note [1]: f15.
                                                                                               
                                                                                               
cpython.remote_debugger_script     ‘script_path’                                               *note [1]: 4ada.
                                                                                               
                                                                                               
cpython.run_command                ‘command’                                                   *note [1]: 1a9.
                                                                                               
                                                                                               
cpython.run_file                   ‘filename’                                                  *note [1]: 4adb.
                                                                                               
                                                                                               
cpython.run_interactivehook        ‘hook’                                                      *note [1]: 11ce.
                                                                                               
                                                                                               
cpython.run_module                 ‘module-name’                                               *note [1]: 23e.
                                                                                               
                                                                                               
cpython.run_startup                ‘filename’                                                  *note [1]: 1ba.
                                                                                               
                                                                                               
cpython.run_stdin                                                                              *note [1]: 4adc.*note [2]: 4add.*note [3]: 4ade.
                                                                                               
                                                                                               
ctypes.addressof                   ‘obj’                                                       *note [1]: 33d7.
                                                                                               
                                                                                               
ctypes.call_function               ‘func_pointer’, ‘arguments’                                 *note [1]: 33d1.
                                                                                               
                                                                                               
ctypes.cdata                       ‘address’                                                   *note [1]: 33e2.
                                                                                               
                                                                                               
ctypes.cdata/buffer                ‘pointer’, ‘size’, ‘offset’                                 *note [1]: 33e7.*note [2]: 33e8.
                                                                                               
                                                                                               
ctypes.create_string_buffer        ‘init’, ‘size’                                              *note [1]: 338b.
                                                                                               
                                                                                               
ctypes.create_unicode_buffer       ‘init’, ‘size’                                              *note [1]: 1e10.
                                                                                               
                                                                                               
ctypes.dlopen                      ‘name’                                                      *note [1]: 33ce.
                                                                                               
                                                                                               
ctypes.dlsym                       ‘library’, ‘name’                                           *note [1]: 33ce.
                                                                                               
                                                                                               
ctypes.dlsym/handle                ‘handle’, ‘name’                                            *note [1]: 33ce.
                                                                                               
                                                                                               
ctypes.get_errno                                                                               *note [1]: 177d.
                                                                                               
                                                                                               
ctypes.get_last_error                                                                          *note [1]: 33c8.
                                                                                               
                                                                                               
ctypes.memoryview_at               ‘address’, ‘size’, ‘readonly’                               *note [1]: 4adf.
                                                                                               
                                                                                               
ctypes.set_errno                   ‘errno’                                                     *note [1]: 33c7.
                                                                                               
                                                                                               
ctypes.set_exception               ‘code’                                                      *note [1]: 33d1.
                                                                                               
                                                                                               
ctypes.set_last_error              ‘error’                                                     *note [1]: 33c9.
                                                                                               
                                                                                               
ctypes.string_at                   ‘ptr’, ‘size’                                               *note [1]: 1ee.
                                                                                               
                                                                                               
ctypes.wstring_at                  ‘ptr’, ‘size’                                               *note [1]: 33e1.
                                                                                               
                                                                                               
ensurepip.bootstrap                ‘root’                                                      *note [1]: 4ae0.
                                                                                               
                                                                                               
exec                               ‘code_object’                                               *note [1]: 4a3.*note [2]: 4a2.
                                                                                               
                                                                                               
fcntl.fcntl                        ‘fd’, ‘cmd’, ‘arg’                                          *note [1]: 18b6.
                                                                                               
                                                                                               
fcntl.flock                        ‘fd’, ‘operation’                                           *note [1]: 4ae1.
                                                                                               
                                                                                               
fcntl.ioctl                        ‘fd’, ‘request’, ‘arg’                                      *note [1]: 1699.
                                                                                               
                                                                                               
fcntl.lockf                        ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’                       *note [1]: 160a.
                                                                                               
                                                                                               
ftplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: 40a2.
                                                                                               
                                                                                               
ftplib.sendcmd                     ‘self’, ‘cmd’                                               *note [1]: 40a7.*note [2]: 40a8.
                                                                                               
                                                                                               
function.__new__                   ‘code’                                                      *note [1]: a87.
                                                                                               
                                                                                               
gc.get_objects                     ‘generation’                                                *note [1]: a08.
                                                                                               
                                                                                               
gc.get_referents                   ‘objs’                                                      *note [1]: a0a.
                                                                                               
                                                                                               
gc.get_referrers                   ‘objs’                                                      *note [1]: a09.
                                                                                               
                                                                                               
glob.glob                          ‘pathname’, ‘recursive’                                     *note [1]: 5a0.*note [2]: a0c.
                                                                                               
                                                                                               
glob.glob/2                        ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’               *note [1]: 5a0.*note [2]: a0c.
                                                                                               
                                                                                               
http.client.connect                ‘self’, ‘host’, ‘port’                                      *note [1]: 4085.
                                                                                               
                                                                                               
http.client.send                   ‘self’, ‘data’                                              *note [1]: 4089.
                                                                                               
                                                                                               
imaplib.open                       ‘self’, ‘host’, ‘port’                                      *note [1]: b05.
                                                                                               
                                                                                               
imaplib.send                       ‘self’, ‘data’                                              *note [1]: 40f9.
                                                                                               
                                                                                               
import                             ‘module’, ‘filename’, ‘sys.path’, ‘sys.meta_path’,          *note [1]: 7f8.
                                   ‘sys.path_hooks’                                            
                                   
                                                                                               
marshal.dumps                      ‘value’, ‘version’                                          *note [1]: 2dbf.
                                                                                               
                                                                                               
marshal.load                                                                                   *note [1]: 1e53.
                                                                                               
                                                                                               
marshal.loads                      ‘bytes’                                                     *note [1]: 1e53.
                                                                                               
                                                                                               
mmap.__new__                       ‘fileno’, ‘length’, ‘access’, ‘offset’                      *note [1]: 519.
                                                                                               
                                                                                               
msvcrt.get_osfhandle               ‘fd’                                                        *note [1]: 4ae2.
                                                                                               
                                                                                               
msvcrt.locking                     ‘fd’, ‘mode’, ‘nbytes’                                      *note [1]: 4ae3.
                                                                                               
                                                                                               
msvcrt.open_osfhandle              ‘handle’, ‘flags’                                           *note [1]: 4ae4.
                                                                                               
                                                                                               
object.__delattr__                 ‘obj’, ‘name’                                               *note [1]: 23d9.
                                                                                               
                                                                                               
object.__getattr__                 ‘obj’, ‘name’                                               *note [1]: dcf.
                                                                                               
                                                                                               
object.__setattr__                 ‘obj’, ‘name’, ‘value’                                      *note [1]: 23d8.
                                                                                               
                                                                                               
open                               ‘path’, ‘mode’, ‘flags’                                     *note [1]: 318.*note [2]: 740.*note [3]: f96.
                                                                                               
                                                                                               
os.add_dll_directory               ‘path’                                                      *note [1]: be1.
                                                                                               
                                                                                               
os.chdir                           ‘path’                                                      *note [1]: 821.*note [2]: f8d.
                                                                                               
                                                                                               
os.chflags                         ‘path’, ‘flags’                                             *note [1]: 1309.*note [2]: 30fb.
                                                                                               
                                                                                               
os.chmod                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 529.*note [2]: 52a.*note [3]: 528.
                                                                                               
                                                                                               
os.chown                           ‘path’, ‘uid’, ‘gid’, ‘dir_fd’                              *note [1]: 130a.*note [2]: f8e.*note [3]: 30fc.
                                                                                               
                                                                                               
os.exec                            ‘path’, ‘args’, ‘env’                                       *note [1]: 314c.
                                                                                               
                                                                                               
os.fork                                                                                        *note [1]: 4b5.
                                                                                               
                                                                                               
os.forkpty                                                                                     *note [1]: 4b6.
                                                                                               
                                                                                               
os.fwalk                           ‘top’, ‘topdown’, ‘onerror’, ‘follow_symlinks’, ‘dir_fd’    *note [1]: d56.
                                                                                               
                                                                                               
os.getxattr                        ‘path’, ‘attribute’                                         *note [1]: 1320.
                                                                                               
                                                                                               
os.kill                            ‘pid’, ‘sig’                                                *note [1]: 1583.
                                                                                               
                                                                                               
os.killpg                          ‘pgid’, ‘sig’                                               *note [1]: 1e17.
                                                                                               
                                                                                               
os.link                            ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 130b.
                                                                                               
                                                                                               
os.listdir                         ‘path’                                                      *note [1]: 1316.
                                                                                               
                                                                                               
os.listdrives                                                                                  *note [1]: 6c5.
                                                                                               
                                                                                               
os.listmounts                      ‘volume’                                                    *note [1]: 6c7.
                                                                                               
                                                                                               
os.listvolumes                                                                                 *note [1]: 6c6.
                                                                                               
                                                                                               
os.listxattr                       ‘path’                                                      *note [1]: 1321.
                                                                                               
                                                                                               
os.lockf                           ‘fd’, ‘cmd’, ‘len’                                          *note [1]: 132f.
                                                                                               
                                                                                               
os.mkdir                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 52c.*note [2]: 52b.
                                                                                               
                                                                                               
os.posix_spawn                     ‘path’, ‘argv’, ‘env’                                       *note [1]: 52e.*note [2]: 17d5.
                                                                                               
                                                                                               
os.putenv                          ‘key’, ‘value’                                              *note [1]: 25d.
                                                                                               
                                                                                               
os.remove                          ‘path’, ‘dir_fd’                                            *note [1]: 130c.*note [2]: 3100.*note [3]: 1311.
                                                                                               
                                                                                               
os.removexattr                     ‘path’, ‘attribute’                                         *note [1]: 1322.
                                                                                               
                                                                                               
os.rename                          ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 130d.*note [2]: 3101.*note [3]: 130e.
                                                                                               
                                                                                               
os.rmdir                           ‘path’, ‘dir_fd’                                            *note [1]: 130f.
                                                                                               
                                                                                               
os.scandir                         ‘path’                                                      *note [1]: c58.
                                                                                               
                                                                                               
os.setxattr                        ‘path’, ‘attribute’, ‘value’, ‘flags’                       *note [1]: 1323.
                                                                                               
                                                                                               
os.spawn                           ‘mode’, ‘path’, ‘args’, ‘env’                               *note [1]: 31d.
                                                                                               
                                                                                               
os.startfile                       ‘path’, ‘operation’                                         *note [1]: 1cdf.
                                                                                               
                                                                                               
os.startfile/2                     ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’         *note [1]: 1cdf.
                                                                                               
                                                                                               
os.symlink                         ‘src’, ‘dst’, ‘dir_fd’                                      *note [1]: 1310.
                                                                                               
                                                                                               
os.system                          ‘command’                                                   *note [1]: 167b.
                                                                                               
                                                                                               
os.truncate                        ‘fd’, ‘length’                                              *note [1]: f93.*note [2]: 1040.
                                                                                               
                                                                                               
os.unsetenv                        ‘key’                                                       *note [1]: 25e.
                                                                                               
                                                                                               
os.utime                           ‘path’, ‘times’, ‘ns’, ‘dir_fd’                             *note [1]: 1312.
                                                                                               
                                                                                               
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]: 275.
                                                                                               
                                                                                               
pickle.find_class                  ‘module’, ‘name’                                            *note [1]: 2d95.
                                                                                               
                                                                                               
poplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: b21.*note [2]: b22.
                                                                                               
                                                                                               
poplib.putline                     ‘self’, ‘line’                                              *note [1]: b21.*note [2]: b22.
                                                                                               
                                                                                               
pty.spawn                          ‘argv’                                                      *note [1]: 1188.
                                                                                               
                                                                                               
resource.prlimit                   ‘pid’, ‘resource’, ‘limits’                                 *note [1]: 1190.
                                                                                               
                                                                                               
resource.setrlimit                 ‘resource’, ‘limits’                                        *note [1]: 1831.
                                                                                               
                                                                                               
setopencodehook                                                                                *note [1]: 1afb.
                                                                                               
                                                                                               
shutil.chown                       ‘path’, ‘user’, ‘group’                                     *note [1]: 548.
                                                                                               
                                                                                               
shutil.copyfile                    ‘src’, ‘dst’                                                *note [1]: c53.*note [2]: c54.*note [3]: c52.
                                                                                               
                                                                                               
shutil.copymode                    ‘src’, ‘dst’                                                *note [1]: c53.*note [2]: 1a86.
                                                                                               
                                                                                               
shutil.copystat                    ‘src’, ‘dst’                                                *note [1]: c54.*note [2]: 134a.
                                                                                               
                                                                                               
shutil.copytree                    ‘src’, ‘dst’                                                *note [1]: c22.
                                                                                               
                                                                                               
shutil.make_archive                ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’               *note [1]: 6da.
                                                                                               
                                                                                               
shutil.move                        ‘src’, ‘dst’                                                *note [1]: c55.
                                                                                               
                                                                                               
shutil.rmtree                      ‘path’, ‘dir_fd’                                            *note [1]: 354.
                                                                                               
                                                                                               
shutil.unpack_archive              ‘filename’, ‘extract_dir’, ‘format’                         *note [1]: 696.
                                                                                               
                                                                                               
signal.pthread_kill                ‘thread_id’, ‘signalnum’                                    *note [1]: 134d.
                                                                                               
                                                                                               
smtplib.connect                    ‘self’, ‘host’, ‘port’                                      *note [1]: 17bb.
                                                                                               
                                                                                               
smtplib.send                       ‘self’, ‘data’                                              *note [1]: b2b.
                                                                                               
                                                                                               
socket.__new__                     ‘self’, ‘family’, ‘type’, ‘protocol’                        *note [1]: fa5.
                                                                                               
                                                                                               
socket.bind                        ‘self’, ‘address’                                           *note [1]: 12db.
                                                                                               
                                                                                               
socket.connect                     ‘self’, ‘address’                                           *note [1]: fa7.*note [2]: 1758.
                                                                                               
                                                                                               
socket.getaddrinfo                 ‘host’, ‘port’, ‘family’, ‘type’, ‘protocol’                *note [1]: 17c7.
                                                                                               
                                                                                               
socket.gethostbyaddr               ‘ip_address’                                                *note [1]: 1ce0.
                                                                                               
                                                                                               
socket.gethostbyname               ‘hostname’                                                  *note [1]: 3a3e.*note [2]: 1ce1.
                                                                                               
                                                                                               
socket.gethostname                                                                             *note [1]: 30a6.
                                                                                               
                                                                                               
socket.getnameinfo                 ‘sockaddr’                                                  *note [1]: 1a9c.
                                                                                               
                                                                                               
socket.getservbyname               ‘servicename’, ‘protocolname’                               *note [1]: 3a40.
                                                                                               
                                                                                               
socket.getservbyport               ‘port’, ‘protocolname’                                      *note [1]: 3a41.
                                                                                               
                                                                                               
socket.sendmsg                     ‘self’, ‘address’                                           *note [1]: 6a1.
                                                                                               
                                                                                               
socket.sendto                      ‘self’, ‘address’                                           *note [1]: fad.
                                                                                               
                                                                                               
socket.sethostname                 ‘name’                                                      *note [1]: 1357.
                                                                                               
                                                                                               
sqlite3.connect                    ‘database’                                                  *note [1]: 5a6.
                                                                                               
                                                                                               
sqlite3.connect/handle             ‘connection_handle’                                         *note [1]: 5a6.
                                                                                               
                                                                                               
sqlite3.enable_load_extension      ‘connection’, ‘enabled’                                     *note [1]: a43.
                                                                                               
                                                                                               
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]: 1651.
                                                                                               
                                                                                               
sys._getframe                      ‘frame’                                                     *note [1]: 8f1.
                                                                                               
                                                                                               
sys._getframemodulename            ‘depth’                                                     *note [1]: 1b3e.
                                                                                               
                                                                                               
sys.addaudithook                                                                               *note [1]: 4ad6.*note [2]: 4ad5.
                                                                                               
                                                                                               
sys.excepthook                     ‘hook’, ‘type’, ‘value’, ‘traceback’                        *note [1]: a10.
                                                                                               
                                                                                               
sys.monitoring.register_callback   ‘func’                                                      *note [1]: 4ae5.
                                                                                               
                                                                                               
sys.remote_exec                    ‘pid’                                                       *note [1]: 4ae6.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_finalizer                                                               *note [1]: 19fc.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_firstiter                                                               *note [1]: 19fc.
                                                                                               
                                                                                               
sys.setprofile                                                                                 *note [1]: 171c.
                                                                                               
                                                                                               
sys.settrace                                                                                   *note [1]: 2e3.
                                                                                               
                                                                                               
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]: 4ae7.
                                                                                               
                                                                                               
syslog.syslog                      ‘priority’, ‘message’                                       *note [1]: 762.
                                                                                               
                                                                                               
tempfile.mkdtemp                   ‘fullpath’                                                  *note [1]: 1450.*note [2]: 52d.
                                                                                               
                                                                                               
tempfile.mkstemp                   ‘fullpath’                                                  *note [1]: 6ed.*note [2]: 2d45.*note [3]: 2d46.
                                                                                               
                                                                                               
time.sleep                         ‘secs’                                                      *note [1]: 4ae8.
                                                                                               
                                                                                               
urllib.Request                     ‘fullurl’, ‘data’, ‘headers’, ‘method’                      *note [1]: 309.
                                                                                               
                                                                                               
webbrowser.open                    ‘url’                                                       *note [1]: 17c5.
                                                                                               
                                                                                               
winreg.ConnectRegistry             ‘computer_name’, ‘key’                                      *note [1]: 4ae9.
                                                                                               
                                                                                               
winreg.CreateKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 4aea.*note [2]: 157e.
                                                                                               
                                                                                               
winreg.DeleteKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 4aeb.*note [2]: 157f.
                                                                                               
                                                                                               
winreg.DeleteValue                 ‘key’, ‘value’                                              *note [1]: 4aec.
                                                                                               
                                                                                               
winreg.DisableReflectionKey        ‘key’                                                       *note [1]: 1580.
                                                                                               
                                                                                               
winreg.EnableReflectionKey         ‘key’                                                       *note [1]: 1581.
                                                                                               
                                                                                               
winreg.EnumKey                     ‘key’, ‘index’                                              *note [1]: 4aed.
                                                                                               
                                                                                               
winreg.EnumValue                   ‘key’, ‘index’                                              *note [1]: 4aee.
                                                                                               
                                                                                               
winreg.ExpandEnvironmentStrings    ‘str’                                                       *note [1]: 1616.
                                                                                               
                                                                                               
winreg.LoadKey                     ‘key’, ‘sub_key’, ‘file_name’                               *note [1]: 4aef.
                                                                                               
                                                                                               
winreg.OpenKey                     ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 4af0.
                                                                                               
                                                                                               
winreg.OpenKey/result              ‘key’                                                       *note [1]: 4aea.*note [2]: 157e.*note [3]: 4af0.
                                                                                               
                                                                                               
winreg.PyHKEY.Detach               ‘key’                                                       *note [1]: 4af1.
                                                                                               
                                                                                               
winreg.QueryInfoKey                ‘key’                                                       *note [1]: 4af2.
                                                                                               
                                                                                               
winreg.QueryReflectionKey          ‘key’                                                       *note [1]: 1582.
                                                                                               
                                                                                               
winreg.QueryValue                  ‘key’, ‘sub_key’, ‘value_name’                              *note [1]: 4af3.*note [2]: 17f4.
                                                                                               
                                                                                               
winreg.SaveKey                     ‘key’, ‘file_name’                                          *note [1]: 4af4.
                                                                                               
                                                                                               
winreg.SetValue                    ‘key’, ‘sub_key’, ‘type’, ‘value’                           *note [1]: 4af5.*note [2]: 1b61.
                                                                                               

以下のイベントは内部で送出され、 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: Debugging and Profiling

5.28.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: 2d7. クラスが、デバッガーを終了させるために投げる例外。

The ‘bdb’ module also defines two classes:

 -- クラス: bdb.Breakpoint (self, file, line, temporary=False,
          cond=None, funcname=None)

     このクラスはテンポラリブレークポイント、無視するカウント、無効化と
     再有効化、条件付きブレークポイントを実装しています。

     ブレークポイントは *note bpbynumber: 4afa. という名前のリストで番号
     によりインデックスされ、 *note bplist: 4afb. により ‘(file, line)’
     の形でインデックスされます。 ‘bpbynumber’ は *note Breakpoint:
     4af9. クラスのインスタンスを指しています。一方 ‘bplist’ は、同じ行
     に複数のブレークポイントが設定される場合があるので、インスタンスの
     リストを指しています。

     ブレークポイントを作るとき、関連付けられる *note ファイル名: 4afc.
     は正規化されていなければなりません。*note funcname: 4afd. が定義さ
     れると、ブレークポイントの *note ヒット: 4afe. はその関数の最初の行
     が実行されたときにカウントされます。*note 条件付き: 4aff. ブレーク
     ポイントは毎回 ‘ヒット’ をカウントします。

     *note Breakpoint: 4af9. インスタンスは以下のメソッドを持ちます:

      -- メソッド: 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(): 4b03. の出力を表示する。

     *note Breakpoint: 4af9. インスタンスは以下の属性を持ちます:

      -- の属性: file

          File name of the ‘Breakpoint’.

      -- の属性: line

          Line number of the ‘Breakpoint’ within *note file: 4afc.

      -- の属性: temporary

          ‘True’ if a ‘Breakpoint’ at (file, line) is temporary.

      -- の属性: cond

          Condition for evaluating a ‘Breakpoint’ at (file, line).

      -- の属性: funcname

          Function name that defines whether a ‘Breakpoint’ is hit upon
          entering the function.

      -- の属性: enabled

          ‘True’ if ‘Breakpoint’ is enabled.

      -- の属性: bpbynumber

          Numeric index for a single instance of a ‘Breakpoint’.

      -- の属性: bplist

          Dictionary of ‘Breakpoint’ instances indexed by (*note file:
          4afc, *note line: 4b05.) tuples.

      -- の属性: ignore

          Number of times to ignore a ‘Breakpoint’.

      -- の属性: hits

          Count of the number of times a ‘Breakpoint’ has been hit.

 -- クラス: bdb.Bdb (skip=None, backend='settrace')

     *note Bdb: 2d7. クラスは一般的なPythonデバッガーの基本クラスとして
     振舞います。

     このクラスはトレース機能の詳細を扱います。ユーザーとのインタラクシ
     ョンは、派生クラスが実装するべきです。標準ライブラリのデバッガクラ
     ス (*note pdb.Pdb: 275.) がその利用例です。

     'skip' 引数は、もし与えられたならグロブ形式のモジュール名パターンの
     iterable でなければなりません。デバッガはこれらのパターンのどれかに
     マッチするモジュールで発生したフレームにステップインしなくなります
     。フレームが特定のモジュールで発生したかどうかは、フレームのグロー
     バル変数の ‘__name__’ によって決定されます。

     The 'backend' argument specifies the backend to use for ‘Bdb’.  It
     can be either ‘'settrace'’ or ‘'monitoring'’.  ‘'settrace'’ uses
     *note sys.settrace(): 2e3. 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: 2d7. のメソッドは、通常オーバーライドする必要はあ
     りません。

      -- メソッド: canonic (filename)

          Return canonical form of 'filename'.

          For real file names, the canonical form is an
          operating-system-dependent, *note case-normalized: 2cd2. *note
          absolute path: 1536.  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: 4b0d. attributes with values ready to start
          debugging.

      -- メソッド: trace_dispatch (frame, event, arg)

          この関数は、デバッグされているフレームのトレース関数としてイン
          ストールされます。戻り値は新しいトレース関数(殆どの場合はこの
          関数自身)です。

          デフォルトの実装は、実行しようとしている 'event' (文字列として
          渡されます) の種類に基づいてフレームのディスパッチ方法を決定し
          ます。'event' は次のうちのどれかです:

             * ‘"line"’: 新しい行を実行しようとしています。

             * ‘"call"’: 関数が呼び出されているか、別のコードブロックに
               入ります。

             * ‘"return"’: 関数か別のコードブロックからreturnしようとし
               ています。

             * ‘"exception"’: 例外が発生しました。

             * ‘"c_call"’: A C function is about to be called.

             * ‘"c_return"’: A C function has returned.

             * ‘"c_exception"’: A C function has raised an exception.

          For the Python events, specialized functions (see below) are
          called.  For the C events, no action is taken.

          'arg' 引数は以前のイベントに依存します。

          トレース関数についてのより詳しい情報は、 *note sys.settrace():
          2e3. のドキュメントを参照してください。コードとフレームオブジ
          ェクトについてのより詳しい情報は、 *note 標準型の階層: 238b. を
          参照してください。

      -- メソッド: dispatch_line (frame)

          If the debugger should stop on the current line, invoke the
          *note user_line(): 4b10. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 27a. exception if the
          *note quitting: 4b0d. flag is set (which can be set from
          ‘user_line()’).  Return a reference to the *note
          trace_dispatch(): 4b0e. 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(): 4b12. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 27a. exception if the
          *note quitting: 4b0d. flag is set (which can be set from
          ‘user_call()’).  Return a reference to the *note
          trace_dispatch(): 4b0e. 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(): 4b14. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 27a.
          exception if the *note quitting: 4b0d. flag is set (which can
          be set from ‘user_return()’).  Return a reference to the *note
          trace_dispatch(): 4b0e. method for further tracing in that
          scope.

      -- メソッド: dispatch_exception (frame, arg)

          If the debugger should stop at this exception, invokes the
          *note user_exception(): 4b16. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 27a.
          exception if the *note quitting: 4b0d. flag is set (which can
          be set from ‘user_exception()’).  Return a reference to the
          *note trace_dispatch(): 4b0e. 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(): 4b1a.

      -- メソッド: break_anywhere (frame)

          Return ‘True’ if any breakpoint exists for 'frame"s filename.

     継承クラスはデバッガー操作をするために以下のメソッド群をオーバーラ
     イドするべきです。

      -- メソッド: user_call (frame, argument_list)

          Called from *note dispatch_call(): 4b11. 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(): 4b18. か *note break_here(): 4b19. が
          ‘True’ を返したときに、 *note dispatch_line(): 4b0f. から呼び
          出されます。

      -- メソッド: user_return (frame, return_value)

          *note stop_here(): 4b18. が ‘True’ を返したときに、 *note
          dispatch_return(): 4b13. から呼び出されます。

      -- メソッド: user_exception (frame, exc_info)

          *note stop_here(): 4b18. が ‘True’ を返したときに、 *note
          dispatch_exception(): 4b15. から呼び出されます。

      -- メソッド: 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(): 4b22. 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: 27a. 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(): 4b09. メソッドで説明されてい
          るような、標準形である必要があります。

      -- メソッド: clear_break (filename, lineno)

          'filename' の 'lineno' 行にあるブレークポイントを削除します。
          もしブレークポイントが無かった場合、エラーメッセージを返します
          。

      -- メソッド: clear_bpbynumber (arg)

          *note Breakpoint.bpbynumber: 4afa. の中で 'arg' のインデックス
          を持つブレークポイントを削除します。 'arg' が数値でないか範囲
          外の場合、エラーメッセージを返します。

      -- メソッド: clear_all_file_breaks (filename)

          'filename' にあるすべてのブレークポイントを削除します。もしブ
          レークポイントが無かった場合、エラーメッセージを返します。

      -- メソッド: clear_all_breaks ()

          存在するすべてのブレークポイントを削除します。もしブレークポイ
          ントが無かった場合、エラーメッセージを返します。

      -- メソッド: get_bpbynumber (arg)

          与えられた数値によって指定されるブレークポイントを返します。
          'arg' が文字列なら数値に変換されます。 'arg' が非数値の文字列
          である場合、指定されたブレークポイントが存在しないか削除された
          場合、 *note ValueError: 2ee. が上げられます。

          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(): 4b2f. 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 文: 2c78. をデバ
     ッグするもので、クライアントから利用されます。

      -- メソッド: 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(): 4b32. と同じ意味です。

      -- メソッド: runctx (cmd, globals, locals)

          後方互換性のためのメソッドです。 *note run(): 4b32. を使ってく
          ださい。

      -- メソッド: runcall (func, /, *args, **kwds)

          1つの関数呼び出しをデバッグし、その結果を返します。

最後に、このモジュールは以下の関数を提供しています:

 -- の関数: bdb.checkfuncname (b, frame)

     Return ‘True’ if we should break here, depending on the way the
     *note Breakpoint: 4af9. 'b' was set.

     If it was set via line number, it checks if *note b.line: 4b05. is
     the same as the one in 'frame'.  If the breakpoint was set via
     *note function name: 4afd, 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: 4afb.
     for the (*note file: 4afc, *note line: 4b05.) (which must exist)
     that is *note enabled: 4b07, for which *note checkfuncname(): 4b35.
     is true, and that has neither a false *note condition: 4aff. nor
     positive *note ignore: 4b08. count.  The 'flag', meaning that a
     temporary breakpoint should be deleted, is ‘False’ only when the
     ‘cond’ cannot be evaluated (in which case, ‘ignore’ count is
     ignored).

     If no such entry exists, then ‘(None, None)’ is returned.

 -- の関数: bdb.set_trace ()

     *note Bdb: 2d7. クラスのインスタンスを使って、呼び出し元のフレーム
     からデバッグを開始します。

   ---------- 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: Debugging and Profiling

5.28.3 ‘faulthandler’ -- Python トレースバックをダンプする
----------------------------------------------------------

Added in version 3.3.

__________________________________________________________________

このモジュールは、例外発生時、タイムアウト時、ユーザシグナルの発生時など
のタイミングでpython tracebackを明示的にダンプするための関数を含んでいま
す。これらのシグナル、*note SIGSEGV: 1290.、*note SIGFPE: 1291.、*note
SIGABRT: 1292.、*note SIGBUS: 1293.、*note SIGILL: 1294. に対するフォー
ルトハンドラをインストールするには *note faulthandler.enable(): 211. を
実行してください。python起動時に有効にするには環境変数 *note
PYTHONFAULTHANDLER: 1295. を設定するか、コマンドライン引数に *note -X:
170. ‘faulthandler’ を指定してください。

Pythonのフォールトハンドラは、apportやWindowsのフォールトハンドラのよう
なシステムフォールトハンドラと互換性があります。このモジュールは
‘sigaltstack()’ 関数が使用可能であればシグナルハンドラ用に代替スタックを
利用します。これによってスタックオーバーフロー時にもトレースバックを出力
することができます。

フォールトハンドラは絶望的なケースで呼び出されます。そのためシグナルセー
フな関数しか使うことができません (例: ヒープメモリ上にメモリ確保はできま
せん)。この制限により、tracebackのダンプ機能は通常のPythonのtracebackと
比べてごく僅かなものです:

   * ASCIIのみサポートされます。エンコード時には ‘backslashreplace’ エラ
     ーハンドラを使用します。

   * すべての文字列は500文字以内に制限されています。

   * ファイル名、関数名、行数のみ表示します。(ソースコードの表示はありま
     せん)

   * It is limited to 100 frames and 100 threads.

   * 順番は保持されます: 最新の呼び出しが最初に表示されます。

デフォルトでは、Pythonのtracebackは *note sys.stderr: b37. に書き出され
ます。tracebackを見るには、対象アプリケーションはターミナル上で実行しな
ければなりません。 *note faulthandler.enable(): 211. に渡す引数によって
ログファイルを指定することができます。

モジュールはC言語で実装されているので、アプリのクラッシュ時でもPythonが
デッドロックした場合でもダンプができます。

The *note Python Development Mode: 508. calls *note
faulthandler.enable(): 211. at Python startup.

参考
....

*note pdb: aa. モジュール

     Interactive source code debugger for Python programs.

*note traceback: 105. モジュール

     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.28.3.1 tracebackのダンプ
..........................

 -- の関数: faulthandler.dump_traceback (file=sys.stderr,
          all_threads=True)

     Dump the tracebacks of all threads into 'file'.  If 'all_threads'
     is ‘False’, dump only the current thread.

     参考
     ....

     *note traceback.print_tb(): 1089, 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.28.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.28.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: 906.
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.28.3.4 フォールトハンドラの状態
.................................

 -- の関数: faulthandler.enable (file=sys.stderr, all_threads=True,
          c_stack=True)

     Enable the fault handler: install handlers for the *note SIGSEGV:
     1290, *note SIGFPE: 1291, *note SIGABRT: 1292, *note SIGBUS: 1293.
     and *note SIGILL: 1294. 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: 4b3d.

     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(): 210. 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: 165. 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(): 211. によってイン
     ストールされたシグナルハンドラをアンインストールします。

 -- の関数: faulthandler.is_enabled ()

     フォールトハンドラが有効かどうかチェックします。


File: python.info,  Node: タイムアウト後にtracebackをダンプする,  Next: ユーザシグナルに対してtracebackをダンプする,  Prev: フォールトハンドラの状態,  Up: faulthandler --- Python トレースバックをダンプする

5.28.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(): 4b41. is called: see *note issue
     with file descriptors: 4b3d.

     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(): 1004. の最新の呼び出しをキャンセルし
     ます。


File: python.info,  Node: ユーザシグナルに対してtracebackをダンプする,  Next: ファイル記述子の問題,  Prev: タイムアウト後にtracebackをダンプする,  Up: faulthandler --- Python トレースバックをダンプする

5.28.3.6 ユーザシグナルに対してtracebackをダンプする
....................................................

 -- の関数: faulthandler.register (signum, file=sys.stderr,
          all_threads=True, chain=False)

     Register a user signal: install a handler for the 'signum' signal
     to dump the traceback of all threads, or of the current thread if
     'all_threads' is ‘False’, into 'file'.  Call the previous handler
     if chain is ‘True’.

     The 'file' must be kept open until the signal is unregistered by
     *note unregister(): 4b43.: see *note issue with file descriptors:
     4b3d.

     Windowsでは利用不可です。

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

 -- の関数: faulthandler.unregister (signum)

     ユーザシグナルを登録解除します: *note register(): 1002. でインスト
     ールした 'signum' シグナルハンドラをアンインストールします。シグナ
     ルが登録された場合は ‘True’ を返し、そうでなければ ‘False’ を返しま
     す。

     Windowsでは利用不可です。


File: python.info,  Node: ファイル記述子の問題,  Next: 使用例<43>,  Prev: ユーザシグナルに対してtracebackをダンプする,  Up: faulthandler --- Python トレースバックをダンプする

5.28.3.7 ファイル記述子の問題
.............................

*note enable(): 211.、*note dump_traceback_later(): 1004. ならびに *note
register(): 1002. は引数 'file' に渡されたファイル記述子を保持します。フ
ァイルが閉じられファイル記述子が新しいファイルで再利用された場合や、
*note os.dup2(): d5e. の使用でファイル記述子が置き換えた場合、 traceback
の結果は別のファイルへ書き込まれます。ファイルが置き換えられた場合は、毎
回これらの関数を呼び出しなおしてください。


File: python.info,  Node: 使用例<43>,  Prev: ファイル記述子の問題,  Up: faulthandler --- Python トレースバックをダンプする

5.28.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: The Python Profilers,  Prev: faulthandler --- Python トレースバックをダンプする,  Up: Debugging and Profiling

5.28.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: 275. として定義され
ています。現在これについてのドキュメントはありませんが、ソースを読めば簡
単に理解できます。拡張インターフェースはモジュール *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: 105. モジュール

     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:
4b4a. command.

バージョン 3.7 で変更: The built-in *note breakpoint(): 273, 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.28.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: 4b4e.

     バージョン 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: 4b4a. とタイプできます。あるいは、文を *note step: 4b51.
     や *note next: 4b52. を使って一つづつ実行することができます (これら
     のコマンドはすべて下で説明します)。オプションの 'globals' と
     'locals' 引数はコードを実行する環境を指定します。デフォルトでは、モ
     ジュール *note __main__: 1. の辞書が使われます。(組み込み関数 *note
     exec(): 4a2. または *note eval(): 4a3. の説明を参照してください。)

 -- の関数: pdb.runeval (expression, globals=None, locals=None)

     デバッガーに制御された状態で (文字列またはコードオブジェクトとして
     与えられる) 'expression' を評価します。*note runeval(): 4b53. から
     復帰するとき、式の値を返します。その他の点では、この関数は *note
     run(): 4942. と同様です。

 -- の関数: pdb.runcall (function, *args, **kwds)

     'function' (関数またはメソッドオブジェクト、文字列ではありません) を
     与えられた引数とともに呼び出します。 *note runcall(): 4b54. から復
     帰するとき、関数呼び出しが返したものはなんでも返します。関数に入る
     とすぐにデバッガプロンプトが現れます。

 -- の関数: 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 で変更: ‘set_trace()’ 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(): 274.  This function should be
     used inside an async function with *note await: 18e.

          async def f():
              await pdb.set_trace_async()

     *note await: 18e. 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: cf0.  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: 2d7. for details.  The user can
     set the default backend to use if none is specified when
     instantiating *note Pdb: 275.  If no backend is specified, the
     default is ‘'settrace'’.

          注釈: *note breakpoint(): 273. and *note set_trace(): 274.
          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(): 274. は、 *note Pdb: 275. クラスをイン
スタンス化して同名のメソッドを実行することのエイリアス関数です。それ以上
の機能を利用したい場合は、インスタンス化を自分で行わなければなりません:

 -- クラス: pdb.Pdb (completekey='tab', stdin=None, stdout=None,
          skip=None, nosigint=False, readrc=True, mode=None,
          backend=None, colorize=False)

     *note Pdb: 275. はデバッガクラスです。

     'completekey', 'stdin', 'stdout' 引数は、基底にある *note cmd.Cmd:
     18b3. クラスに渡されます。そちらの解説を参照してください。

     'skip' 引数が指定された場合、 glob スタイルのモジュール名パターンの
     iterable (イテレート可能オブジェクト) でなければなりません。デバッ
     ガはこのパターンのどれかにマッチするモジュールに属するフレームには
     ステップインしません。 (2)

     デフォルトでは、Pdb は *note continue: 4b4a. コマンドが投入されると
     、(ユーザーがコンソールから ‘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(): 4b55.  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 監査イベント: 1ccb. ‘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():
     273. or *note pdb.set_trace(): 274. 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.28.4.2 Debugger commands
..........................

デバッガーに認識されるコマンドは以下に一覧されています。たいていのコマン
ドは以下のように 1、2 文字に省略できます。例えば ‘h(elp)’ は ‘h’ か
‘help’ がで help コマンドを呼び出すことを意味します (ただし ‘he’, ‘hel’,
‘H’, ‘Help’, ‘HELP’ は使用できません)。コマンドの引数はホワイトスペース
(スペースかタブ) で区切ってください。コマンド構文として任意の引数は大括
弧 (‘[]’) で括られています (実際に大括弧はタイプしないでください)。いく
つかから選択できる引数は縦線 (‘|’) で分割されて記述されています。

空行を入力すると入力された直前のコマンドを繰り返します。例外: 直前のコマ
ンドが *note list: 4b5b. コマンドならば、次の 11 行がリストされます。

デバッガが認識しないコマンドは Python 文とみなして、デバッグしているプロ
グラムのコンテキストおいて実行されます。先頭にに感嘆符 (‘!’) を付けるこ
とで Python 文であると明示することもできます。これはデバッグ中のプログラ
ムを調査する強力な方法です。変数を変更したり関数を呼び出したりすることも
可能です。このような文で例外が発生した場合には例外名が出力されますが、デ
バッガの状態は変化しません。

バージョン 3.13 で変更: Expressions/Statements whose prefix is a pdb
command are now correctly identified and executed.

デバッガーは *note エイリアス: 4b5c. をサポートしています。エイリアスは
デバッグ中のコンテキストに適用可能な一定レベルのパラメータを保持すること
ができます。

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: 4b4a. や *note next:
4b52. のようなデバッグを続行するコマンドが使用できるようになりました。以
前はこのようなコマンドは無視されていました。

バージョン 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: 3e2.  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: 4b61. と同じです。

 -- 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’ だけを続けます。つまり、コマンドを一つも指定しないようにしま
     す。

     With no 'bpnumber' argument, ‘commands’ refers to the last
     breakpoint set.

     ブレークポイントコマンドはプログラムを走らせ直すのに使えます。単に
     *note continue: 4b4a. コマンドや *note step: 4b51.、その他実行を再
     開するコマンドを使えば良いのです。

     Specifying any command resuming execution (currently *note
     continue: 4b4a, *note step: 4b51, *note next: 4b52, *note return:
     4b68, *note until: 4b69, *note jump: 4b6a, *note quit: 4b6b. 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: 4b52. と *note step: 4b51. の差は ‘step’ が呼び出
     された関数の内部で停止するのに対し、 ‘next’ は呼び出された関数を (ほ
     ぼ) 全速力で実行し、現在の関数内の次の行で停止するだけです。)

 -- Pdbcommand: unt(il) [lineno]

     引数なしだと、現在の行から 1 行先まで実行します。

     'lineno' を指定すると、番号が 'lineno' 以上である行に到達するまで実
     行します。どちらにしても現在のフレームが返ってきた時点で停止します
     。

     バージョン 3.2 で変更: 明示的に行数指定ができるようになりました。

 -- Pdbcommand: r(eturn)

     現在の関数が返るまで実行を継続します。

 -- Pdbcommand: c(ont(inue))

     ブレークポイントに出会うまで、実行を継続します。

 -- Pdbcommand: j(ump) lineno

     次に実行する行を指定します。最も底のフレーム中でのみ実行可能です。
     前に戻って実行したり、不要な部分をスキップして先の処理を実行する場
     合に使用します。

     ジャンプには制限があり、例えば *note for: 348. ループの中には飛び込
     めませんし、 *note finally: 1b1. 節の外にも飛ぶ事ができません。

 -- Pdbcommand: l(ist) [first[, last]]

     現在のファイルのソースコードを表示します。引数を指定しないと、現在
     の行の前後 11 行分を表示するか、直前の表示を続行します。引数に ‘.’
     を指定すると、現在の行の前後 11 行分を表示します。数値を 1 個指定す
     ると、その行番号の前後 11 行分を表示します。数値を 2 個指定すると、
     開始行と最終行として表示します; 2 個めの引数が 1 個め未満だった場合
     、1 個目を開始行、2 個めを開始行からの行数とみなします。

     現在のフレーム内の現在の行は ‘->’ で表示されます。例外をデバッグ中
     の場合、例外が発生または伝搬した行は、それが現在の行とは異なるとき
     ‘>>’ で表示されます。

     バージョン 3.2 で変更: ‘>>’ マーカーが追加されました。

 -- Pdbcommand: ll | longlist

     現在の関数またはフレームの全ソースコードを表示します。注目する行は
     *note list: 4b5b. と同じようにマーカーがつきます。

     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(): 117b. が実行され
          ます。

 -- Pdbcommand: pp expression

     *note p: 117c. コマンドに似ていますが、'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: 4b72. command.

     バージョン 3.13 で変更: *note interact: 4b72. directs its output to
     the debugger's output channel rather than *note sys.stderr: b37.

 -- 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: 1480.
     として使われます。ヒストリー、ブレークポイント、アクション、そして
     、デバッガーオプションは引き継がれます。 *note restart: 4b77. は
     *note run: 4b76. の別名です。

     バージョン 3.14 で変更: *note run: 4b76. and *note restart: 4b77.
     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: 4b6b.

     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(): 279. immediately, instead
     of raising *note bdb.BdbQuit: 27a. 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: The Python Profilers,  Next: timeit --- 小さなコードスニペットの実行時間計測,  Prev: pdb --- The Python Debugger,  Up: Debugging and Profiling

5.28.5 The Python Profilers
---------------------------

'Source code:' Lib/profile.py(1) and Lib/pstats.py(2)

__________________________________________________________________

* Menu:

* Introduction to the profilers::
* Instant User's Manual::
* profile and cProfile Module Reference::
* The Stats Class::
* What Is Deterministic Profiling?::
* 制限事項: 制限事項<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: Introduction to the profilers,  Next: Instant User's Manual,  Up: The Python Profilers

5.28.5.1 Introduction to the profilers
......................................

*note cProfile: 2b. and *note profile: b4. provide 'deterministic
profiling' of Python programs.  A 'profile' is a set of statistics that
describes how often and for how long various parts of the program
executed.  These statistics can be formatted into reports via the *note
pstats: b5. module.

The Python standard library provides two different implementations of
the same profiling interface:

  1. *note cProfile: 2b. is recommended for most users; it's a C
     extension with reasonable overhead that makes it suitable for
     profiling long-running programs.  Based on ‘lsprof’, contributed by
     Brett Rosen and Ted Czotter.

  2. *note profile: b4, a pure Python module whose interface is imitated
     by *note cProfile: 2b, but which adds significant overhead to
     profiled programs.  If you're trying to extend the profiler in some
     way, the task might be easier with this module.  Originally
     designed and written by Jim Roskind.

     注釈: The profiler modules are designed to provide an execution
     profile for a given program, not for benchmarking purposes (for
     that, there is *note timeit: f5. for reasonably accurate results).
     This particularly applies to benchmarking Python code against C
     code: the profilers introduce overhead for Python code, but not for
     C-level functions, and so the C code would seem faster than any
     Python one.


File: python.info,  Node: Instant User's Manual,  Next: profile and cProfile Module Reference,  Prev: Introduction to the profilers,  Up: The Python Profilers

5.28.5.2 Instant User's Manual
..............................

This section is provided for users that "don't want to read the manual."
It provides a very brief overview, and allows a user to rapidly perform
profiling on an existing application.

To profile a function that takes a single argument, you can do:

     import cProfile
     import re
     cProfile.run('re.compile("foo|bar")')

(Use *note profile: b4. instead of *note cProfile: 2b. if the latter is
not available on your system.)

The above action would run *note re.compile(): dd2. and print profile
results like the following:

           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

     for the number of calls.

tottime

     for the total time spent in the given function (and excluding time
     made in calls to sub-functions)

percall

     is the quotient of ‘tottime’ divided by ‘ncalls’

cumtime

     is the cumulative time spent in this and all subfunctions (from
     invocation till exit).  This figure is accurate 'even' for
     recursive functions.

percall

     is the quotient of ‘cumtime’ divided by primitive calls

filename:lineno(function)

     provides the respective data of each function

When there are two numbers in the first column (for example ‘3/1’), it
means that the function recursed.  The second value is the number of
primitive calls and the former is the total number of calls.  Note that
when the function does not recurse, these two values are the same, and
only the single figure is printed.

Instead of printing the output at the end of the profile run, you can
save the results to a file by specifying a filename to the ‘run()’
function:

     import cProfile
     import re
     cProfile.run('re.compile("foo|bar")', 'restats')

The *note pstats.Stats: 4b82. class reads profile results from a file
and formats them in various ways.  The files *note cProfile: 2b. and
*note profile: b4. can also be invoked as a script to profile another
script.  For example:

     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(): 4b86. sort values to sort
     the output by.  This only applies when *note -o: 4b84. 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.

The *note pstats: b5. module's *note Stats: 4b82. class has a variety of
methods for manipulating and printing the data saved into a profile
results file:

     import pstats
     from pstats import SortKey
     p = pstats.Stats('restats')
     p.strip_dirs().sort_stats(-1).print_stats()

The *note strip_dirs(): 4b88. method removed the extraneous path from
all the module names.  The *note sort_stats(): 4b86. method sorted all
the entries according to the standard module/line/name string that is
printed.  The *note print_stats(): 4b89. method printed out all the
statistics.  You might try the following sort calls:

     p.sort_stats(SortKey.NAME)
     p.print_stats()

The first call will actually sort the list by function name, and the
second call will print out the statistics.  The following are some
interesting calls to experiment with:

     p.sort_stats(SortKey.CUMULATIVE).print_stats(10)

This sorts the profile by cumulative time in a function, and then only
prints the ten most significant lines.  If you want to understand what
algorithms are taking time, the above line is what you would use.

If you were looking to see what functions were looping a lot, and taking
a lot of time, you would do:

     p.sort_stats(SortKey.TIME).print_stats(10)

to sort according to time spent within each function, and then print the
statistics for the top ten functions.

You might also try:

     p.sort_stats(SortKey.FILENAME).print_stats('__init__')

This will sort all the statistics by file name, and then print out
statistics for only the class init methods (since they are spelled with
‘__init__’ in them).  As one final example, you could try:

     p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')

This line sorts statistics with a primary key of time, and a secondary
key of cumulative time, and then prints out some of the statistics.  To
be specific, the list is first culled down to 50% (re: ‘.5’) of its
original size, then only lines containing ‘init’ are maintained, and
that sub-sub-list is printed.

If you wondered what functions called the above functions, you could now
(‘p’ is still sorted according to the last criteria) do:

     p.print_callers(.5, 'init')

and you would get a list of callers for each of the listed functions.

If you want more functionality, you're going to have to read the manual,
or guess what the following functions do:

     p.print_callees()
     p.add('restats')

Invoked as a script, the *note pstats: b5. module is a statistics
browser for reading and examining profile dumps.  It has a simple
line-oriented interface (implemented using *note cmd: 1a.) and
interactive help.


File: python.info,  Node: profile and cProfile Module Reference,  Next: The Stats Class,  Prev: Instant User's Manual,  Up: The Python Profilers

5.28.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: 4b82. のインスタンスが自動的に作ら
     れ、簡単なプロファイルレポートが表示されます。 'sort' が指定されて
     いる場合は、 ‘Stats’ インスタンスに渡され、結果をどのように並び替え
     るかを制御します。

 -- の関数: profile.runctx (command, globals, locals, filename=None,
          sort=-1)

     This function is similar to *note run(): 4b8b, with added arguments
     to supply the globals and locals mappings for the 'command' string.
     This routine executes:

          exec(command, globals, locals)

     そしてプロファイル統計情報を *note run(): 4b8b. 同様に収集します。

 -- クラス: profile.Profile (timer=None, timeunit=0.0, subcalls=True,
          builtins=True)

     This class is normally only used if more precise control over
     profiling is needed than what the ‘cProfile.run()’ function
     provides.

     'timer' 引数に、コードの実行時間を計測するためのカスタムな時刻取得
     用関数を渡せます。これは現在時刻を表す単一の数値を返す関数でなけれ
     ばなりません。もしこれが整数を返す関数ならば、 'timeunit' には単位
     時間当たりの実際の持続時間を指定します。たとえば関数が 1000 分の 1
     秒単位で計測した時間を返すとすると、 'timeunit' は ‘.001’ でしょう
     。

     *note Profile: bda. クラスを直接使うと、プロファイルデータをファイ
     ルに書き出すことなしに結果をフォーマット出来ます:

          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 ‘Profile’ class can also be used as a context manager
     (supported only in ‘cProfile’ module.  see *note
     コンテキストマネージャ型: 246c.):

          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: 4b82. オブジェクトを
          作成し、結果を標準出力に出力します。

          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: 4b86.

          Added in version 3.13: ‘print_stats()’ 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(): 279. call during the called command/function execution) no
profiling results will be printed.


File: python.info,  Node: The Stats Class,  Next: What Is Deterministic Profiling?,  Prev: profile and cProfile Module Reference,  Up: The Python Profilers

5.28.5.4 The ‘Stats’ Class
..........................

Analysis of the profiler data is done using the *note Stats: 4b82.
class.

 -- クラス: pstats.Stats (*filenames or profile, stream=sys.stdout)

     This class constructor creates an instance of a "statistics object"
     from a 'filename' (or list of filenames) or from a ‘Profile’
     instance.  Output will be printed to the stream specified by
     'stream'.

     The file selected by the above constructor must have been created
     by the corresponding version of *note profile: b4. or *note
     cProfile: 2b.  To be specific, there is 'no' file compatibility
     guaranteed with future versions of this profiler, and there is no
     compatibility with files produced by other profilers, or the same
     profiler run on a different operating system.  If several files are
     provided, all the statistics for identical functions will be
     coalesced, so that an overall view of several processes can be
     considered in a single report.  If additional files need to be
     combined with data in an existing *note Stats: 4b82. object, the
     *note add(): 4b96. method can be used.

     Instead of reading the profile data from a file, a
     ‘cProfile.Profile’ or *note profile.Profile: bda. object can be
     used as the profile data source.

     ‘Stats’ objects have the following methods:

      -- メソッド: strip_dirs ()

          This method for the ‘Stats’ class removes all leading path
          information from file names.  It is very useful in reducing
          the size of the printout to fit within (close to) 80 columns.
          This method modifies the object, and the stripped information
          is lost.  After performing a strip operation, the object is
          considered to have its entries in a "random" order, as it was
          just after object initialization and loading.  If *note
          strip_dirs(): 4b88. causes two function names to be
          indistinguishable (they are on the same line of the same
          filename, and have the same function name), then the
          statistics for these two entries are accumulated into a single
          entry.

      -- メソッド: add (*filenames)

          This method of the ‘Stats’ class accumulates additional
          profiling information into the current profiling object.  Its
          arguments should refer to filenames created by the
          corresponding version of *note profile.run(): 4b8b. or
          ‘cProfile.run()’.  Statistics for identically named (re: file,
          line, name) functions are automatically accumulated into
          single function statistics.

      -- メソッド: dump_stats (filename)

          Save the data loaded into the ‘Stats’ object to a file named
          'filename'.  The file is created if it does not exist, and is
          overwritten if it already exists.  This is equivalent to the
          method of the same name on the *note profile.Profile: bda. and
          ‘cProfile.Profile’ classes.

      -- メソッド: sort_stats (*keys)

          This method modifies the ‘Stats’ 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.

          When more than one key is provided, then additional keys are
          used as secondary criteria when there is equality in all keys
          selected before them.  For example, ‘sort_stats(SortKey.NAME,
          SortKey.FILE)’ will sort all the entries according to their
          function name, and resolve all ties (identical function names)
          by sorting by file name.

          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            Meaning
                                                           
          ----------------------------------------------------------------------------
                                                           
          ‘'calls'’              SortKey.CALLS             call count
                                                           
                                                           
          ‘'cumulative'’         SortKey.CUMULATIVE        cumulative time
                                                           
                                                           
          ‘'cumtime'’            N/A                       cumulative time
                                                           
                                                           
          ‘'file'’               N/A                       file name
                                                           
                                                           
          ‘'filename'’           SortKey.FILENAME          file name
                                                           
                                                           
          ‘'module'’             N/A                       file name
                                                           
                                                           
          ‘'ncalls'’             N/A                       call count
                                                           
                                                           
          ‘'pcalls'’             SortKey.PCALLS            primitive call count
                                                           
                                                           
          ‘'line'’               SortKey.LINE              line number
                                                           
                                                           
          ‘'name'’               SortKey.NAME              function name
                                                           
                                                           
          ‘'nfl'’                SortKey.NFL               name/file/line
                                                           
                                                           
          ‘'stdname'’            SortKey.STDNAME           standard name
                                                           
                                                           
          ‘'time'’               SortKey.TIME              internal time
                                                           
                                                           
          ‘'tottime'’            N/A                       internal time
                                                           

          Note that all sorts on statistics are in descending order
          (placing most time consuming items first), where as name,
          file, and line number searches are in ascending order
          (alphabetical).  The subtle distinction between ‘SortKey.NFL’
          and ‘SortKey.STDNAME’ is that the standard name is a sort of
          the name as printed, which means that the embedded line
          numbers get compared in an odd way.  For example, lines 3, 20,
          and 40 would (if the file names were the same) appear in the
          string order 20, 3 and 40.  In contrast, ‘SortKey.NFL’ does a
          numeric compare of the line numbers.  In fact,
          ‘sort_stats(SortKey.NFL)’ is the same as
          ‘sort_stats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE)’.

          For backward-compatibility reasons, the numeric arguments
          ‘-1’, ‘0’, ‘1’, and ‘2’ are permitted.  They are interpreted
          as ‘'stdname'’, ‘'calls'’, ‘'time'’, and ‘'cumulative'’
          respectively.  If this old style format (numeric) is used,
          only one sort key (the numeric key) will be used, and
          additional arguments will be silently ignored.

          Added in version 3.7: Added the SortKey enum.

      -- メソッド: reverse_order ()

          This method for the ‘Stats’ class reverses the ordering of the
          basic list within the object.  Note that by default ascending
          vs descending order is properly selected based on the sort key
          of choice.

      -- メソッド: print_stats (*restrictions)

          This method for the ‘Stats’ class prints out a report as
          described in the *note profile.run(): 4b8b. definition.

          The order of the printing is based on the last *note
          sort_stats(): 4b86. operation done on the object (subject to
          caveats in *note add(): 4b96. and *note strip_dirs(): 4b88.).

          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:')

          would first limit the printing to first 10% of list, and then
          only print functions that were part of filename ‘.*foo:’.  In
          contrast, the command:

               print_stats('foo:', .1)

          would limit the list to all functions having file names
          ‘.*foo:’, and then proceed to only print the first 10% of
          them.

      -- メソッド: print_callers (*restrictions)

          This method for the ‘Stats’ class prints a list of all
          functions that called each function in the profiled database.
          The ordering is identical to that provided by *note
          print_stats(): 4b89, and the definition of the restricting
          argument is also identical.  Each caller is reported on its
          own line.  The format differs slightly depending on the
          profiler that produced the stats:

             * With *note profile: b4, a number is shown in parentheses
               after each caller to show how many times this specific
               call was made.  For convenience, a second
               non-parenthesized number repeats the cumulative time
               spent in the function at the right.

             * With *note cProfile: 2b, each caller is preceded by three
               numbers: the number of times this specific call was made,
               and the total and cumulative times spent in the current
               function while it was invoked by this specific caller.

      -- メソッド: print_callees (*restrictions)

          This method for the ‘Stats’ class prints a list of all
          function that were called by the indicated function.  Aside
          from this reversal of direction of calls (re: called vs was
          called by), the arguments and ordering are identical to the
          *note print_callers(): 4b99. method.

      -- メソッド: 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: What Is Deterministic Profiling?,  Next: 制限事項<2>,  Prev: The Stats Class,  Up: The Python Profilers

5.28.5.5 What Is Deterministic Profiling?
.........................................

'Deterministic profiling' is meant to reflect the fact that all
'function call', 'function return', and 'exception' events are
monitored, and precise timings are made for the intervals between these
events (during which time the user's code is executing).  In contrast,
'statistical profiling' (which is not done by this module) randomly
samples the effective instruction pointer, and deduces where time is
being spent.  The latter technique traditionally involves less overhead
(as the code does not need to be instrumented), but provides only
relative indications of where time is being spent.

Python の場合、実行中は必ずインタプリタが動作しているため、決定論的プロ
ファイリングを行うために計測用のコードを追加する必要はありません。
Python は自動的に各イベントに 'フック' (オプションのコールバック) を提供
します。加えて Python のインタプリタという性質によって、実行時に大きなオ
ーバーヘッドを伴う傾向がありますが、それに比べると一般的なアプリケーショ
ンでは決定論的プロファイリングで追加される処理のオーバーヘッドは少ない傾
向にあります。結果的に、決定論的プロファイリングは少ないコストで Python
プログラムの実行時間に関する詳細な統計を得られる方法となっているのです。

呼び出し回数はコード中のバグ発見にも使用できます (とんでもない数の呼び出
しが行われている部分)。インライン拡張の対象とすべき部分を見つけるために
も使えます (呼び出し頻度の高い部分)。内部時間の統計は、注意深く最適化す
べき"ホットループ"の発見にも役立ちます。累積時間の統計は、アルゴリズム選
択に関連した高レベルのエラー検知に役立ちます。なお、このプロファイラは再
帰的なアルゴリズム実装の累計時間を計ることが可能で、通常のループを使った
実装と直接比較することもできるようになっています。


File: python.info,  Node: 制限事項<2>,  Next: キャリブレーション 補正,  Prev: What Is Deterministic Profiling?,  Up: The Python Profilers

5.28.5.6 制限事項
.................

一つの制限はタイミング情報の正確さに関するものです。決定論的プロファイラ
には正確さに関する根本的問題があります。最も明白な制限は、 (一般に) "ク
ロック"は .001 秒の精度しかないということです。これ以上の精度で計測する
ことはできません。仮に充分な精度が得られたとしても、"誤差"が計測の平均値
に影響を及ぼすことがあります。この最初の誤差を取り除いたとしても、それが
また別の誤差を引き起こす原因となります。

もう一つの問題として、イベントを検知してからプロファイラがその時刻を実際
に '取得' するまでに "いくらかの時間がかかる" ことです。同様に、イベント
ハンドラが終了する時にも、時刻を取得して (そしてその値を保存して) から、
ユーザコードが処理を再開するまでの間に遅延が発生します。結果的に多く呼び
出される関数または多数の関数から呼び出される関数の情報にはこの種の誤差が
蓄積する傾向にあります。このようにして蓄積される誤差は、典型的にはクロッ
クの精度を下回ります (1クロック以下) が、一方でこの時間が累計して非常に
大きな値になることも 'あり得ます' 。

The problem is more important with *note profile: b4. than with the
lower-overhead *note cProfile: 2b.  For this reason, ‘profile’ provides
a means of calibrating itself for a given platform so that this error
can be probabilistically (on the average) removed.  After the profiler
is calibrated, it will be more accurate (in a least square sense), but
it will sometimes produce negative numbers (when call counts are
exceptionally low, and the gods of probability work against you :-).  )
Do 'not' be alarmed by negative numbers in the profile.  They should
'only' appear if you have calibrated your profiler, and the results are
actually better than without calibration.


File: python.info,  Node: キャリブレーション 補正,  Next: カスタムな時刻取得用関数を使う,  Prev: 制限事項<2>,  Up: The Python Profilers

5.28.5.7 キャリブレーション (補正)
..................................

The profiler of the *note profile: b4. module subtracts a constant from
each event handling time to compensate for the overhead of calling the
time function, and socking away the results.  By default, the constant
is 0.  The following procedure can be used to obtain a better constant
for a given platform (see *note 制限事項: 4b9f.).

     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: The Python Profilers

5.28.5.8 カスタムな時刻取得用関数を使う
.......................................

プロファイラが時刻を取得する方法を変更したいなら (たとえば、実測時間やプ
ロセスの経過時間を使いたい場合)、時刻取得用の関数を ‘Profile’ クラスのコ
ンストラクタに指定することができます:

     pr = profile.Profile(your_time_func)

The resulting profiler will then call ‘your_time_func’.  Depending on
whether you are using *note profile.Profile: bda. or ‘cProfile.Profile’,
‘your_time_func’'s return value will be interpreted differently:

*note profile.Profile: bda.

     ‘your_time_func()’ は単一の数値、あるいは (*note os.times(): 1331.
     と同じように) その合計が累計時間を示すリストを返すようになっていな
     ければなりません。関数が1つの数値、あるいは長さ2の数値のリストを返
     すようになっていれば、ディスパッチルーチンには特別な高速化バージョ
     ンが使われます。

     Be warned that you should calibrate the profiler class for the
     timer function that you choose (see *note キャリブレーション
     (補正): 4ba1.).  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(): 1331. 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(): c7e.
を参照してください。


File: python.info,  Node: timeit --- 小さなコードスニペットの実行時間計測,  Next: trace --- Python 文実行のトレースと追跡,  Prev: The Python Profilers,  Up: Debugging and Profiling

5.28.6 ‘timeit’ -- 小さなコードスニペットの実行時間計測
-------------------------------------------------------

'ソースコード:' Lib/timeit.py(1)

__________________________________________________________________

このモジュールは小さい Python コードをの時間を計測するシンプルな手段を提
供しています。*note Command-Line Interface: 4ba7. の他 *note
呼び出しも可能: 4ba8. です。このモジュールは実行時間を計測するときに共通
するいくつかの罠を回避します。O'Reilly 出版の 'Python Cookbook' 第2版に
ある、Tim Peter による "Algorithms" 章も参照してください。

* Menu:

* Basic Examples::
* Python Interface::
* Command-Line Interface::
* 使用例: 使用例<44>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/timeit.py


File: python.info,  Node: Basic Examples,  Next: Python Interface,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.6.1 Basic Examples
.......................

次の例は *note Command-Line Interface: 4ba7. を使って 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 Interface: 4ba8. を使って実現することもできます:

     >>> 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 Interface: 4ba8. から渡すことも
できます:

     >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000)
     0.19665591977536678

ただし、*note timeit(): 1082. はコマンドラインインターフェイスを使った時
だけ繰り返し回数を自動で決定する事に注意してください。*note 使用例:
4baa. 節でより高度な例を説明しています。


File: python.info,  Node: Python Interface,  Next: Command-Line Interface,  Prev: Basic Examples,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.6.2 Python Interface
.........................

このモジュールは 3 つの有用な関数と 1 つの公開クラスを持っています:

 -- の関数: timeit.timeit (stmt='pass', setup='pass', timer=<default
          timer>, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     16e6. インスタンスを作成し、その *note timeit(): eed. メソッドを
     'number' 回実行します。 任意の 'globals' 引数はコードを実行する名前
     空間を指定します。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

 -- の関数: timeit.repeat (stmt='pass', setup='pass', timer=<default
          timer>, repeat=5, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     16e6. インスタンスを作成し、その *note repeat(): 4bad. メソッドを
     '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(): c7e. になりました。

 -- クラス: timeit.Timer (stmt='pass', setup='pass', timer=<timer
          function>, globals=None)

     小さなコード片の実行時間を計測するためのクラスです。

     コンストラクターは計測する文、セットアップのための追加の文、ならび
     にタイマー関数を取ります。 両文のデフォルトは ‘'pass'’ です。 タイ
     マー関数はプラットフォーム依存です (モジュールの doctring を参照)。
     'stmt' および 'setup' には、複数行の文字列リテラルを含まない限り、
     ‘;’ や改行で区切られた複数の文でも構いません。 デフォルトでは文は
     timeit の名前空間内で実行されます。 この挙動は名前空間を 'globals'
     に渡すことで制御出来ます。

     最初の命令文の実行時間を計測するには、*note timeit(): eed. メソッド
     を使用します。*note repeat(): 4bad. と *note autorange(): eec. メソ
     ッドは ‘timeit()’ を複数回呼び出したい時に使用します。

     'setup' の実行時間は全実行時間から除外されています。

     'stmt' および 'setup' パラメータは、引数なしの呼び出し可能オブジェ
     クトをとることもできます。呼び出し可能オブジェクトを指定すると、そ
     のオブジェクトの呼び出しがタイマー関数に埋め込まれ、その関数が
     *note timeit(): eed. メソッドによって実行されます。この場合、関数呼
     び出しが増えるためにタイミングのオーバーヘッドが少し増える点に注意
     してください。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

      -- メソッド: timeit (number=1000000)

          メイン文を 'number' 回実行した時間を計測します。このメソッドは
          セットアップ文を1回だけ実行し、メイン文を指定回数実行するのに
          かかった時間を返します。デフォルトのタイマーは秒数を浮動小数点
          数で返します。引数はループを何回実行するかの指定で、デフォルト
          値は 100万回です。メイン文、セットアップ文、タイマー関数はコン
          ストラクターで指定されたものを使用します。

               注釈: デフォルトでは、*note timeit(): eed. は計測中、一時
               的に *note ガベージコレクション: 1842. を停止します。 こ
               の手法の利点は個々の計測結果がより比較しやすくなることで
               す。 欠点は、ガベージコレクションが計測される関数の性能の
               重要な要素である場合があることです。 その場合、'setup' 文
               字列の最初の文でガベージコレクションを有効にできます。 以
               下に例を示します:

                    timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()

      -- メソッド: autorange (callback=None)

          *note timeit(): eed. を呼び出す回数を自動的に決定します。

          This is a convenience function that calls *note timeit(): eed.
          repeatedly so that the total time >= 0.2 second, returning the
          eventual (number of loops, time taken for that number of
          loops).  It calls ‘timeit()’ with increasing numbers from the
          sequence 1, 2, 5, 10, 20, 50, ...  until the time taken is at
          least 0.2 seconds.

          'callback' が与えられ、Noneでない場合は、 callback(number,
          time_taken) という2つの引数を指定して試行された後に呼び出され
          ます。

          Added in version 3.6.

      -- メソッド: repeat (repeat=5, number=1000000)

          *note timeit(): eed. を複数回繰り返します。

          これは *note timeit(): eed. を繰り返し呼び出したい時に有用で、
          結果をリストにして返します。最初の引数で何回 ‘timeit()’ を呼ぶ
          か指定します。第 2 引数で ‘timeit()’ の引数 'number' を指定し
          ます。

               注釈: 結果のベクトルから平均値や標準偏差を計算して出力さ
               せたいと思うかもしれませんが、それはあまり意味がありませ
               ん。多くの場合、最も低い値がそのマシンが与えられたコード
               断片を実行する場合の下限値です。結果のうち高めの値は、
               Python のスピードが一定しないために生じたものではなく、そ
               の他の計測精度に影響を及ぼすプロセスによるものです。した
               がって、結果のうち *note min(): 110f. だけが見るべき値と
               なるでしょう。この点を押さえた上で、統計的な分析よりも常
               識的な判断で結果を見るようにしてください。

          バージョン 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: b37. になります。


File: python.info,  Node: Command-Line Interface,  Next: 使用例<44>,  Prev: Python Interface,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.6.3 Command-Line Interface
...............................

コマンドラインからプログラムとして呼び出す場合は、次の書式を使います:

     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(): c7e. の代わり *note
     time.process_time(): c7f. を利用して、実時間ではなくプロセス時間を
     計測します

     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: 4bb5.
においても同じ形式で指定可能です。

If *note -n: 4bb1. is not given, a suitable number of loops is
calculated by trying increasing numbers from the sequence 1, 2, 5, 10,
20, 50, ...  until the total time is at least 0.2 seconds.

*note default_timer(): 4bae. の測定値は、同じマシン上で実行されている他
のプログラムの影響を受ける可能性があるため、正確な時間計測が必要な場合は
、計測を数回繰り返し、最適な時間を使用することをおすすめします。 *note
-r: 4bb3. オプションはこれに適しています。ほとんどの場合、デフォルトの
5回の繰り返しで十分でしょう。 *note time.process_time(): c7f. を使用すれ
ばCPU時間を測定できます。

     注釈: pass 文の実行には基本的なオーバーヘッドが存在します。ここにあ
     るコードはこの事実を隠そうとはしていませんが、注意する必要がありま
     す。基本的なオーバーヘッドは引数なしでプログラムを起動することによ
     り計測でき、それは Python のバージョンによって異なるでしょう。


File: python.info,  Node: 使用例<44>,  Prev: Command-Line Interface,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.28.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: 16e6. クラスとそのメソッドを使用して行うこともで
きます:

     >>> 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: 8f9./*note except: 1ac. を使用した場合のコ
ストを比較しています:

     $ 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(): 1c67. を '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: Debugging and Profiling

5.28.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.28.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.28.7.2 主要なオプション
.........................

At least one of the following options must be specified when invoking
‘trace’.  The *note -listfuncs: 4bc8. option is mutually exclusive with
the *note -trace: 4bc9. and *note -count: 4bca. options.  When
‘--listfuncs’ is provided, neither ‘--count’ nor ‘--trace’ are accepted,
and vice versa.

 -- Option: -c, --count

     プログラム完了時に、それぞれの文が何回実行されたかを示す注釈付きリ
     ストのファイルを生成します。下記の *note -coverdir: 4bcc, *note
     -file: 4bcd, *note -no-report: 4bce. も参照してください。

 -- Option: -t, --trace

     実行された通りに行を表示します。

 -- Option: -l, --listfuncs

     プログラム実行の際に実行された関数を表示します。

 -- Option: -r, --report

     *note -count: 4bca. と *note -file: 4bcd. 引数を使った過去のプログ
     ラム実行結果から、注釈付きリストのファイルを生成します。コードを実
     行するわけではありません。

 -- Option: -T, --trackcalls

     プログラム実行によって明らかになった呼び出しの関係を表示します。


File: python.info,  Node: 修飾的オプション,  Next: フィルターオプション,  Prev: 主要なオプション,  Up: コマンドラインからの使用<2>

5.28.7.3 修飾的オプション
.........................

 -- Option: -f, --file=<file>

     複数回にわたるトレース実行についてカウント (count) を累積するファイ
     ルに名前をつけます。 *note -count: 4bca. オプションと一緒に使って下
     さい。

 -- Option: -C, --coverdir=<dir>

     レポートファイルを保存するディレクトリを指定します。
     ‘package.module’ についてのカバレッジレポートは
     ‘`dir'/`package'/`module'.cover’ に書き込まれます。

 -- Option: -m, --missing

     注釈付きリストの生成時に、実行されなかった行に ‘>>>>>>’ の印を付け
     ます。

 -- Option: -s, --summary

     *note -count: 4bca. または *note -report: 4bd1. の利用時に、処理さ
     れたファイルそれぞれの簡潔な概要を標準出力 (stdout) に書き出します
     。

 -- Option: -R, --no-report

     注釈付きリストを生成しません。これは *note -count: 4bca. を何度か走
     らせてから最後に単一の注釈付きリストを生成するような場合に便利です
     。

 -- Option: -g, --timing

     各行の先頭にプログラム開始からの時間を付けます。トレース中にだけ使
     われます。


File: python.info,  Node: フィルターオプション,  Prev: 修飾的オプション,  Up: コマンドラインからの使用<2>

5.28.7.4 フィルターオプション
.............................

これらのオプションは複数回指定できます。

 -- Option: --ignore-module=<mod>

     指定されたモジュールと（パッケージだった場合は）そのサブモジュール
     を無視します。引数はカンマ区切りのモジュール名リストです。

 -- Option: --ignore-dir=<dir>

     指定されたディレクトリとサブディレクトリ中のモジュールとパッケージ
     を全て無視します。引数は *note os.pathsep: 218f. で区切られたディレ
     クトリのリストです。


File: python.info,  Node: プログラミングインターフェース,  Prev: コマンドラインからの使用<2>,  Up: trace --- Python 文実行のトレースと追跡

5.28.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: 4be4. オブジェクトの
          コントロール下で現在のトレースパラメタのもとに呼び出します。

      -- メソッド: results ()

          与えられた *note Trace: 4be4. インスタンスの ‘run’, ‘runctx’,
          ‘runfunc’ の以前の呼び出しについて集計した結果を納めた *note
          CoverageResults: 4be8. オブジェクトを返します。蓄積されたトレ
          ース結果はリセットしません。

 -- クラス: trace.CoverageResults

     カバレッジ結果のコンテナで、 *note Trace.results(): 4be7. で生成さ
     れるものです。ユーザーが直接生成するものではありません。

      -- メソッド: update (other)

          別の *note CoverageResults: 4be8. オブジェクトのデータを統合し
          ます。

      -- メソッド: write_results (show_missing=True, summary=False,
               coverdir=None, *, ignore_missing_files=False)

          カバレッジ結果を書き出します。ヒットしなかった行も出力するには
          'show_missing' を指定します。モジュールごとの概要を出力に含め
          るには 'summary' を指定します。'coverdir' に指定するのは結果フ
          ァイルを出力するディレクトリです。‘None’ の場合は各ソースファ
          イルごとの結果がそれぞれのディレクトリに置かれます。

          'ignore_missing_files' が ‘True’ の場合には、すでに存在しない
          ファイルのカバレッジカウントはサイレントに無視されます。そうで
          なければ、ファイルが見つからないと *note FileNotFoundError:
          266. が発生します。

          バージョン 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: Debugging and Profiling

5.28.8 ‘tracemalloc’ -- メモリ割り当ての追跡
--------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/tracemalloc.py(1)

__________________________________________________________________

tracemallocモジュールは、Python が割り当てたメモリブロックをトレースする
ためのデバッグツールです。このモジュールは以下の情報を提供します。

   * オブジェクトが割り当てられた場所のトレースバック

   * ファイル名ごと、及び行ごとに割り当てられたメモリブロックの以下の統
     計を取ります：総サイズ、ブロック数、割り当てられたブロックの平均サ
     イズ

   * メモリリークを検出するために2つのスナップショットの差を計算します。

Python が割り当てたメモリブロックの大半をトレースするには、 *note
PYTHONTRACEMALLOC: 2188. 環境変数を ‘1’ に設定して可能な限り早くモジュー
ルを開始させるか、*note -X: 170. ‘tracemalloc’ コマンドラインオプション
を使用してください。実行時に *note tracemalloc.start(): 2187. を呼んで
Python のメモリ割り当てのトレースを開始することが出来ます。

デフォルトでは、割り当てられたメモリブロック1つのトレースは最新1フレーム
を保存します。開始時に25フレームを保存するには、 *note
PYTHONTRACEMALLOC: 2188. 環境変数を ‘25’ に設定するか、*note -X: 170.
‘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.28.8.1 使用例
...............

* Menu:

* 上位10を表示する::
* 差を計算する::
* メモリブロックのトレースバックを取得する::
* top を整形化する::


File: python.info,  Node: 上位10を表示する,  Next: 差を計算する,  Up: 使用例<45>

5.28.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(): 4bf0. を参照して
ください。


File: python.info,  Node: 差を計算する,  Next: メモリブロックのトレースバックを取得する,  Prev: 上位10を表示する,  Up: 使用例<45>

5.28.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(): 4bf2. メソッドを使用して、スナップシ
ョットをディスクに書き込むことが出来ます。 そして *note Snapshot.load():
4bf3. メソッドを使用してスナップショットを再読み込みします。


File: python.info,  Node: メモリブロックのトレースバックを取得する,  Next: top を整形化する,  Prev: 差を計算する,  Up: 使用例<45>

5.28.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 ‘importlib’ 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.28.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(): 4bf0. を参照して
ください。

* 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.28.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():
4bf7. and *note reset_peak(): b39. 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(): b39. 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(): 2187. call.  Without the call to ‘reset_peak()’, ‘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: 24f, and writing ‘sum(range(...))’).


File: python.info,  Node: API,  Prev: 使用例<45>,  Up: tracemalloc --- メモリ割り当ての追跡

5.28.8.7 API
............

* Menu:

* 関数: 関数<11>.
* DomainFilter::
* Filter::
* Frame::
* Snapshot::
* Statistic::
* StatisticDiff::
* Trace::
* Traceback::


File: python.info,  Node: 関数<11>,  Next: DomainFilter,  Up: API

5.28.8.8 関数
.............

 -- の関数: tracemalloc.clear_traces ()

     Python が割り当てたメモリブロックのトレースを消去します。

     *note stop(): 190f. を参照してください。

 -- の関数: tracemalloc.get_object_traceback (obj)

     Get the traceback where the Python object 'obj' was allocated.
     Return a *note Traceback: d93. 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(): a09. や *note sys.getsizeof(): 1b3a. 関数
     も参照してください。

 -- の関数: tracemalloc.get_traceback_limit ()

     トレースのトレースバック内に格納されている最大フレーム数を取得しま
     す。

     The ‘tracemalloc’ module must be tracing memory allocations to get
     the limit, otherwise an exception is raised.

     *note start(): 2187. 関数で上限を設定します。

 -- の関数: 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(): 4bfa.
     Snapshots taken with *note take_snapshot(): 4bfc. before a call to
     ‘reset_peak()’ can be meaningfully compared to snapshots taken
     after the call.

     *note get_traced_memory(): 4bf7. も参照してください。

     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: 19c.

 -- の関数: tracemalloc.is_tracing ()

     ‘True’ if the ‘tracemalloc’ module is tracing Python memory
     allocations, ‘False’ otherwise.

     *note start(): 2187. ならびに *note stop(): 190f. 関数も参照してく
     ださい。

 -- の関数: 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: 4bff. attribute.

     ‘1’ より多くのフレームを保存するのは ‘'traceback'’ でグループ化され
     た統計や累積的な統計を計算する場合にのみ有用です。 *note
     Snapshot.compare_to(): 4c00. および *note Snapshot.statistics():
     4bf0. メソッドを参照してください。

     Storing more frames increases the memory and CPU overhead of the
     ‘tracemalloc’ module.  Use the *note get_tracemalloc_memory():
     4bfd. function to measure how much memory is used by the
     ‘tracemalloc’ module.

     *note PYTHONTRACEMALLOC: 2188. 環境変数
     (‘PYTHONTRACEMALLOC=NFRAME’) と *note -X: 170. ‘tracemalloc=NFRAME’
     コマンドラインオプションを使って実行開始時にトレースを始めることが
     出来ます。

     *note stop(): 190f.、*note is_tracing(): 4bfe.、*note
     get_traceback_limit(): 4bfb. 関数を参照してください。

 -- の関数: tracemalloc.stop ()

     Python のメモリ割り当てのトレースを停止します。つまり、Python のメ
     モリ割り当てへのフックをアンインストールします。 Python が割り当て
     たメモリブロックについてこれまで集めたトレースも全てクリアします。

     トレースが全部クリアされる前にスナップショットを取りたい場合は
     *note take_snapshot(): 4bfc. 関数を呼んでください。

     *note start(): 2187.、*note is_tracing(): 4bfe.、*note
     clear_traces(): 4bfa. 関数も参照してください。

 -- の関数: tracemalloc.take_snapshot ()

     Python が割り当てたメモリブロックのトレースのスナップショットを取り
     ます。新しい *note Snapshot: 4c01. インスタンスを返します。

     The snapshot does not include memory blocks allocated before the
     ‘tracemalloc’ module started to trace memory allocations.

     トレースのトレースバックは *note get_traceback_limit(): 4bfb. フレ
     ームに制限されています。より多くのフレームを保存するには *note
     start(): 2187. 関数の 'nframe' 引数を使用してください。

     The ‘tracemalloc’ module must be tracing memory allocations to take
     a snapshot, see the *note start(): 2187. function.

     *note get_object_traceback(): 1f95. 関数を参照してください。


File: python.info,  Node: DomainFilter,  Next: Filter,  Prev: 関数<11>,  Up: API

5.28.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: 4c04.

          If 'inclusive' is ‘False’ (exclude), match memory blocks not
          allocated in the address space *note domain: 4c04.

      -- の属性: domain

          Address space of a memory block (‘int’).  Read-only property.


File: python.info,  Node: Filter,  Next: Frame,  Prev: DomainFilter,  Up: API

5.28.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(): 1cb1. 関数を参照してください。‘'.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: 4c07. 属性が追加されました。

      -- の属性: 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: 4c09. at line number *note lineno: 4c0a.

          If 'inclusive' is ‘False’ (exclude), ignore memory blocks
          allocated in a file with a name matching *note
          filename_pattern: 4c09. at line number *note lineno: 4c0a.

      -- の属性: lineno

          フィルタの行番号です (‘int’)。'lineno' が ‘None’ の場合フィル
          タはあらゆる行番号にマッチします。

      -- の属性: filename_pattern

          フィルタのファイル名のパターンです (‘str’)。読み出し専用のプロ
          パティです。

      -- の属性: all_frames

          'all_frames' が ‘True’ の場合トレースバックの全てのフレームを
          チェックします。'all_frames' が ‘False’ の場合最新のフレームを
          チェックします。

          トレースバックの上限が ‘1’ の場合この属性の影響はありません。
          *note get_traceback_limit(): 4bfb. 関数と *note
          Snapshot.traceback_limit: 4c0c. 属性を参照してください。


File: python.info,  Node: Frame,  Next: Snapshot,  Prev: Filter,  Up: API

5.28.8.11 Frame
...............

 -- クラス: tracemalloc.Frame

     トレースバックのフレームです。

     *note Traceback: d93. クラスは *note Frame: 4c0e. インスタンスのシ
     ークエンスです。

      -- の属性: filename

          ファイル名 (‘str’)。

      -- の属性: lineno

          行番号 (‘int’)。


File: python.info,  Node: Snapshot,  Next: Statistic,  Prev: Frame,  Up: API

5.28.8.12 Snapshot
..................

 -- クラス: tracemalloc.Snapshot

     Python が割り当てたメモリブロックのトレースのスナップショットです。

     *note take_snapshot(): 4bfc. 関数はスナップショットのインスタンスを
     作ります。

      -- メソッド: compare_to (old_snapshot: Snapshot, key_type: str,
               cumulative: bool = False)

          古いスナップショットとの差を計算します。 'key_type' でグループ
          化された *note StatisticDiff: 4c12. インスタンスのソート済みリ
          ストとして統計を取得します。

          'key_type' および 'cumulative' 引数については *note
          Snapshot.statistics(): 4bf0. メソッドを参照してください。

          結果は降順でソートされます: キーは *note
          StatisticDiff.size_diff: 4c13. の絶対値、 *note
          StatisticDiff.size: 4c14.、 *note StatisticDiff.count_diff:
          4c15. の絶対置、 *note Statistic.count: 4c16.、そして *note
          StatisticDiff.traceback: 4c17. です。

      -- メソッド: dump (filename)

          スナップショットをファイルに書き込みます。

          スナップショットをリロードするには *note load(): 4bf3. を使用
          します。

      -- メソッド: filter_traces (filters)

          Create a new *note Snapshot: 4c01. instance with a filtered
          *note traces: 4c19. sequence, 'filters' is a list of *note
          DomainFilter: ef1. and *note Filter: 4c06. instances.  If
          'filters' is an empty list, return a new ‘Snapshot’ 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: ef1. instances are
          now also accepted in 'filters'.

      -- メソッド: classmethod load (filename)

          スナップショットをファイルからロードします。

          *note dump(): 4bf2. を参照してください。

      -- メソッド: statistics (key_type: str, cumulative: bool = False)

          'key_type' でグループ化された *note Statistic: 4c1a. インスタ
          ンスのソート済みリストとして統計を取得します:

          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: 4c1b,
          *note Statistic.count: 4c16, *note Statistic.traceback: 4c1c.
          です。

      -- の属性: traceback_limit

          *note traces: 4c19. のトレースバック内に保存されるフレーム数の
          最大値です。 スナップショットが取られたときの *note
          get_traceback_limit(): 4bfb. の結果です。

      -- の属性: traces

          Python が割り当てた全メモリブロックのトレースで、 *note Trace:
          4c1d. インスタンスのシークェンスです。

          シークェンスの順序は未定義です。統計のソート済みリストを取得す
          るには *note Snapshot.statistics(): 4bf0. を使用してください。


File: python.info,  Node: Statistic,  Next: StatisticDiff,  Prev: Snapshot,  Up: API

5.28.8.13 Statistic
...................

 -- クラス: tracemalloc.Statistic

     メモリ割り当ての統計です。

     *note Snapshot.statistics(): 4bf0. は *note Statistic: 4c1a. インス
     タンスの一覧を返します。

     *note StatisticDiff: 4c12. クラスも参照してください。

      -- の属性: count

          メモリブロック数 (‘int’)。

      -- の属性: size

          メモリブロックのバイト単位の総サイズ (‘int’)。

      -- の属性: traceback

          メモリブロックが割り当てられているトレースバック。*note
          Traceback: d93. インスタンス。


File: python.info,  Node: StatisticDiff,  Next: Trace,  Prev: Statistic,  Up: API

5.28.8.14 StatisticDiff
.......................

 -- クラス: tracemalloc.StatisticDiff

     新旧 *note Snapshot: 4c01. インスタンスのメモリ割り当ての統計差です
     。

     *note Snapshot.compare_to(): 4c00. は *note StatisticDiff: 4c12. イ
     ンスタンスのリストを返します。 *note Statistic: 4c1a. クラスも参照
     してください。

      -- の属性: count

          新しいスナップショット内のメモリブロックの数 (‘int’) です。新
          しいスナップショット内でメモリブロックが解放された場合は ‘0’ で
          す。

      -- の属性: count_diff

          新旧スナップショットのメモリブロック数の差 (‘int’) です。メモ
          リブロックが新しいスナップショット内で割り当てられた場合は ‘0’
          です。

      -- の属性: size

          新しいスナップショット内のメモリブロックのバイト単位での総サイ
          ズ (‘int’) です。新しいスナップショット内でメモリブロックが解
          放された場合は ‘0’ です。

      -- の属性: size_diff

          新旧スナップショットのバイト単位での総サイズの差 (‘int’) です
          。メモリブロックが新しいスナップショット内で割り当てられた場合
          は ‘0’ です。

      -- の属性: traceback

          メモリブロックが割り当てられたトレースバックで、 *note
          Traceback: d93. のインスタンスです。


File: python.info,  Node: Trace,  Next: Traceback,  Prev: StatisticDiff,  Up: API

5.28.8.15 Trace
...............

 -- クラス: tracemalloc.Trace

     メモリブロックをトレースします。

     *note Snapshot.traces: 4c19. 属性は *note Trace: 4c1d. インスタンス
     のシークエンスです。

     バージョン 3.6 で変更: *note domain: 4c22. 属性が追加されました。

      -- の属性: 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: d93. インスタンス。


File: python.info,  Node: Traceback,  Prev: Trace,  Up: API

5.28.8.16 Traceback
...................

 -- クラス: tracemalloc.Traceback

     Sequence of *note Frame: 4c0e. 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(): 4bfb. frames.  See the *note
     take_snapshot(): 4bfc. function.  The original number of frames of
     the traceback is stored in the *note Traceback.total_nframe: 4bff.
     attribute.  That allows one to know if a traceback has been
     truncated by the traceback limit.

     The *note Trace.traceback: 4c24. attribute is a ‘Traceback’
     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: 4bff. 属性が追
     加されました。

      -- メソッド: 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(): 4c26. function,
          except that ‘format()’ 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: Debugging and Profiling,  Up: Python 標準ライブラリ

5.29 ソフトウェア・パッケージと配布
===================================

以下のライブラリは 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.29.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: 21b4.  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
オプションのモジュールの要件: 21b2.

参考
....

*note Python モジュールのインストール: 10fc.

     エンドユーザーが Python パッケージをインストールする際のガイドです
     。

PEP 453(2): Python インストールの際の明示的なpipのブートストラッピング

     このモジュールのもともとの論拠と仕様。

*note Availability: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

* 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.29.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.29.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: 2ee. を起こします。

     'verbosity' でブートストラップ操作からの *note sys.stdout: cd1. へ
     の出力の冗長レベルをコントロールします。

     引数 ‘root’ 付きで *note 監査イベント: 1ccb. ‘ensurepip.bootstrap’
     を送出します。

          注釈: ブートストラップ処理は ‘sys.path’, ‘os.environ’ の両方に
          対して副作用を持ちます。代わりに、サブプロセスとしてコマンドラ
          インインターフェイスを使うことで、これら副作用を避けることが出
          来ます。

          注釈: ブートストラップ処理は ‘pip’ によって必要とされるモジュ
          ールを追加インストールするかもしれませんが、ほかのソフトウェア
          はそれら依存物がいつもデフォルトで存在していることを仮定すべき
          ではありません(将来のバージョンの ‘pip’ ではその依存はなくなる
          かもしれませんので)。


File: python.info,  Node: venv --- 仮想環境の作成,  Next: zipapp --- 実行可能な Python zip アーカイブを管理する,  Prev: ensurepip --- pip インストーラーのブートストラップ,  Up: ソフトウェア・パッケージと配布

5.29.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: 4c38. and ‘site’'s *note virtual environments
documentation: 4c39. 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: 2199.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 22b8. と *note
WebAssemblyプラットフォーム: 1bc9. をサポートしません。

* 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.29.2.1 仮想環境の作成
.......................

*note Virtual environments: 3e6. 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’ の使用が今は推奨され
ています。

バージョン 3.6 で非推奨、バージョン 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.29.2.2 仮想環境のしくみ
.........................

Python インタプリタが仮想環境で実行しているとき、*note sys.prefix: 3e5.
と *note sys.exec_prefix: 3e9. は仮想環境のディレクトリを指し示し、
*note sys.base_prefix: 3e4. と *note sys.base_exec_prefix: 3e8. は仮想環
境の作成に使われたベース 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.29.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(): 4c48.

     バージョン 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(): 4c4a, *note
          create_configuration(): 4c4b, *note setup_python(): 4c4c,
          *note setup_scripts(): 4c4d, *note post_setup(): 4c4e. はそれ
          ぞれオーバーライドできます。

      -- メソッド: ensure_directories (env_dir)

          仮想環境のディレクトリとすべての必要なサブディレクトリのうちま
          だ存在しないものを作成し、コンテキストオブジェクトを返します。
          このコンテキストオブジェクトは他のメソッドで使うために（パスな
          どの）属性を保持しているだけです。もし *note EnvBuilder: 571.
          が ‘clear=True’ の引数で作成された場合、仮想環境のディレクトリ
          の中身は消去され、すべての必要なサブディレクトリが再作成されま
          す。

          返されるコンテキストオブジェクトは以下の属性を持った *note
          types.SimpleNamespace: 4e5. です:

             * ‘env_dir’ - 仮想環境の場所。アクティベートスクリプトの中
               の ‘__VENV_DIR__’ で使われます（*note install_scripts():
               4c4f. を参照してください）。

             * ‘env_name’ - 仮想環境の名前。アクティベートスクリプトの中
               の ‘__VENV_NAME__’ で使われます（*note install_scripts():
               4c4f. を参照してください）。

             * ‘prompt’ - アクティベートスクリプトで使われるプロンプト。
               アクティベートスクリプトの中の ‘__VENV_PROMPT__’ で使われ
               ます（*note install_scripts(): 4c4f. を参照してください）
               。

             * ‘executable’ - 仮想環境の元になっている Python 実行可能フ
               ァイル。これは仮想環境が別の仮想環境から作られた場合も考
               慮に入れます。

             * ‘inc_path’ - 仮想環境の include パス。

             * ‘lib_path’ - 仮想環境の purelib パス。

             * ‘bin_path’ - 仮想環境のスクリプトのパス。

             * ‘bin_name’ - 仮想環境の場所に相対的な、スクリプトのパス。
               アクティベートスクリプトの中の ‘__VENV_BIN_NAME__’ で使わ
               れます（*note install_scripts(): 4c4f. を参照してください
               ）。

             * ‘env_exe’ - 仮想環境の中の Python インタプリタの名前。ア
               クティベートスクリプトの中の ‘__VENV_PYTHON__’ で使われま
               す（*note install_scripts(): 4c4f. を参照してください）。

             * ‘env_exec_cmd’ - ファイルシステムのリダイレクトを考慮に入
               れた、Python インタプリタの名前。これは仮想環境の中で
               Python を実行するのに使えます。

          バージョン 3.11 で変更: 'venv' *note
          システム構成インストールスキーム: 447. は作成されたディレクト
          リのパスを構築するために使われます。

          バージョン 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(): 4c4d. or
          *note post_setup(): 4c4e. in subclasses to assist in
          installing custom scripts into the virtual environment.

          'path' は ‘common’, ‘posix’, ‘nt’ ディレクトリを格納したディレ
          クトリへのパスです。各サブディレクトリには仮想環境の ‘bin’ デ
          ィレクトリにインストールするスクリプトを格納します。 ‘common’
          の中身と、 *note os.name: 307e. に一致するディレクトリの中身を
          、以下の置換処理を行いながらコピーします:

             * ‘__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(): 4c4c. だけは何もしません。

     バージョン 3.7.3 で変更: Windows では、 *note setup_scripts():
     4c4d. の代わりに *note setup_python(): 4c4c. の一部としてリダイレク
     トを行うスクリプトをコピーします。 これは 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(): 4c49. メソッドに '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.29.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.29.3 ‘zipapp’ -- 実行可能な Python zip アーカイブを管理する
-------------------------------------------------------------

Added in version 3.5.

'ソースコード:' Lib/zipapp.py(1)

__________________________________________________________________

このモジュールは Python コードを含む zip ファイルの作成を行うツールを提
供します。 zip ファイルは *note Python
インタープリタで直接実行することが出来ます: 2176.。 このモジュールは
*note コマンドラインインターフェイス: 4c55. と *note Python API: 4c56. の
両方を提供します。

* Menu:

* 基本的な例: 基本的な例<3>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<3>.
* 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: 基本的な例<3>,  Next: コマンドラインインターフェイス<3>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.29.3.1 基本的な例
...................

実行可能なアーカイブを Python コードを含むディレクトリから作成する為に
*note コマンドラインインターフェイス: 4c55. をどのように利用することがで
きるかを以下に例示します。アーカイブは実行時にアーカイブ内の ‘myapp’ モ
ジュールから ‘main’ 関数を実行します。

     $ python -m zipapp myapp -m "myapp:main"
     $ python myapp.pyz
     <output from myapp>


File: python.info,  Node: コマンドラインインターフェイス<3>,  Next: Python API,  Prev: 基本的な例<3>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.29.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: 4c5d. を指定することは出来ません
     。

 -- 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: 4c5f. に効果はありません。

     Added in version 3.7.

 -- Option: --info

     診断するために書庫に埋め込まれたインタープリタを表示します。 この場
     合、他の全てのオプションは無視され、SOURCE はディレクトリではなく書
     庫でなければなりません。

 -- Option: -h, --help

     簡単な使用法を表示して終了します。


File: python.info,  Node: Python API,  Next: 使用例<46>,  Prev: コマンドラインインターフェイス<3>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.29.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: 886. を返します。 'archive' 引数は、
     ファイル名またはバイトモードの読込みで開いた ファイルに準じるオブジ
     ェクトを指定することができ、アーカイブの起点で決定されます。


File: python.info,  Node: 使用例<46>,  Next: インタープリタの指定,  Prev: Python API,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.29.3.4 使用例
...............

ディレクトリを書庫に圧縮し、実行します。

     $ python -m zipapp myapp
     $ python myapp.pyz
     <output from myapp>

同じことを *note create_archive(): dad. 関数を使用して行うことができます
:

     >>> 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(): dad.
function: を使用して変更された書庫を作成します:

     >>> import zipapp
     >>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/python3')

アーカイブ内のファイルを更新するには *note BytesIO: 10a8. オブジェクトを
使用してメモリーへ格納し、 元のファイルを上書きして置換してください。 フ
ァイルを上書きする際にエラーが発生し、元のファイルが失われる危険性がある
ことに注意してください。 このコードは上記のようなエラーからファイルを保
護しませんが、プロダクションコードは保護するべきです。 この方法はアーカ
イブがメモリーに収まる場合にのみ動作します:

     >>> 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.29.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.29.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
インタープリタの指定: 4c69. 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.29.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.29.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: 3e2. 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(): e57. on POSIX.

  2. Standard zipfile data, as generated by the *note zipfile: 138.
     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.30 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.30.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: 2199.: Unix.

 -- の関数: sys.addaudithook (hook)

     呼び出し可能な 'hook' を現在の(サブ)インタープリタのアクティブな監
     査用フックのリストに加えます。

     When an auditing event is raised through the *note sys.audit():
     197b. 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(): 4ad6. 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(): 4ad6. before initialising the runtime,
     and any modules allowing arbitrary memory modification (such as
     *note ctypes: 2e.) should be completely removed or closely
     monitored.

     Calling ‘sys.addaudithook()’ will itself raise an auditing event
     named ‘sys.addaudithook’ with no arguments.  If any existing hooks
     raise an exception derived from *note RuntimeError: 246, 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: 1c70. 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: 246. ではない *note
     Exception: bd1. は抑制されなくなりました。

     'CPython 実装の詳細:' When tracing is enabled (see *note
     settrace(): 2e3.), 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: 1a9. を付けて Pythonを起動し
     た場合、 ‘argv[0]’ は文字列 ‘'-c'’ となります。スクリプト名なしで
     Pythonを起動した場合、 ‘argv[0]’ は空文字列になります。

     標準入力もしくはコマンドライン引数で指定されたファイルのリストに渡
     ってループするには、 *note fileinput: 5f. モジュールを参照してくだ
     さい。

     See also *note sys.orig_argv: a45.

          注釈: 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.

     ‘sys.audit()’ 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(): 4ad5. or *note
     PySys_AddAuditHook(): 4ad6. 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: 1c70. for all events raised by
     CPython.

     Added in version 3.8.

 -- データ: sys.base_exec_prefix

     Equivalent to *note exec_prefix: 3e9, but referring to the base
     Python installation.

     When running under *note Virtual Environments: 4c38, *note
     exec_prefix: 3e9. gets overwritten to the virtual environment
     prefix.  ‘base_exec_prefix’, conversely, does not change, and
     always points to the base Python installation.  Refer to *note
     Virtual Environments: 4c38. for more information.

     Added in version 3.3.

 -- データ: sys.base_prefix

     Equivalent to *note prefix: 3e5, but referring to the base Python
     installation.

     When running under *note virtual environment: 3e6, *note prefix:
     3e5. gets overwritten to the virtual environment prefix.
     ‘base_prefix’, conversely, does not change, and always points to
     the base Python installation.  Refer to *note Virtual Environments:
     4c38. 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: a46. 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(): 2e3. or *note setprofile(): 171c. 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(): 362. 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: 105. の関数を使えばそのように与えられたフレ
     ームのコールスタックを構築できます。

     この関数はデッドロックをデバッグするのに非常に有効です。デッドロッ
     ク状態のスレッドの協調動作を必要としませんし、そういったスレッドの
     コールスタックはデッドロックである限りフリーズしたままです。デッド
     ロックにないスレッドのフレームについては、そのフレームを調べるコー
     ドを呼んだ時にはそのスレッドの現在の実行状況とは関係ないところを指
     し示しているかもしれません。

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。

     引数無しで *note 監査イベント: 1ccb. ‘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 監査イベント: 1ccb. ‘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(): 273. から呼ばれます
     。 デフォルトでは、この関数は *note pdb: aa. デバッガに処理を移行さ
     せますが、他の関数を設定することもでき、使用するデバッガを選べます
     。

     この関数のシグネチャは何を呼び出すかに依存します。 例えば、
     (‘pdb.set_trace()’ などの) デフォルトの結び付けでは引数は求められま
     せんが、追加の引数 (位置引数およびキーワード引数) を求める関数に結
     び付けるかもしれません。 組み込みの ‘breakpoint()’ 関数は、自身の
     ‘*args’ と ‘**kws’ をそのまま渡します。 ‘breakpointhooks()’ の返り
     値が何であれ、そのまま ‘breakpoint()’ から返されます。

     デフォルトの実装では、最初に環境変数 *note PYTHONBREAKPOINT: cd6. を
     調べます。 それが ‘"0"’ に設定されていた場合は、この関数はすぐに終
     了します。つまり何もしません。 この環境変数が設定されていないか、空
     文字列に設定されていた場合は、 ‘pdb.set_trace()’ が呼ばれます。 そ
     れ以外の場合は、この変数は実行する関数の名前である必要があります。
     関数名の指定では、例えば ‘package.subpackage.module.function’ のよ
     うなドットでつながれた Python のインポートの命名体系を使ったを使い
     ます。 この場合では、 ‘package.subpackage.module’ がインポートされ
     、そのインポートされたモジュールには ‘function()’ という呼び出し可
     能オブジェクトがなくてはなりません。 この関数が渡された ‘*args’ と
     ‘**kws’ で実行され、 ‘function()’ の返り値が何であれ
     ‘sys.breakpointhook()’ は組み込みの *note breakpoint(): 273. 関数に
     その値をそのまま返します。

     *note PYTHONBREAKPOINT: cd6. で指名された呼び出し可能オブジェクトの
     インポートで何かしら問題が起きた場合、 *note RuntimeWarning: 4d7. が
     報告されブレークポイントは無視されることに注意してください。

     また、 ‘sys.breakpointhook()’ がプログラム上で上書きされていた場合
     は *note PYTHONBREAKPOINT: cd6. は '調べられない' ことにも注意して
     ください。

     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: 2199.: 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 式:
     242f. が評価されたときに呼び出されます。対話セッションの出力をカス
     タマイズする場合、 ‘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: 888. には
     ‘'backslashreplace'’ エラーハンドラを指定してください。

 -- データ: sys.dont_write_bytecode

     この値が真の時、Python はソースモジュールをインポートする時に
     ‘.pyc’ ファイルを生成しません。この値は *note -B: 15eb. コマンドラ
     インオプションと *note PYTHONDONTWRITEBYTECODE: 15ec. 環境変数の値
     によって、起動時に ‘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: 2199.: 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:
     170. ‘pycache_prefix=PATH’ command-line option or the *note
     PYTHONPYCACHEPREFIX: b9f. 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: f40. 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: 246. 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(): a4f. function
     handles exception raised by *note threading.Thread.run(): c35.

 -- データ: 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(): 89c. would return ‘e’), ‘exc_info()’ 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: cf0. 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 ‘exc_info()’.

 -- データ: 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: 3e6. is in effect, this
          ‘exec_prefix’ will point to the virtual environment.  The
          value for the Python installation will still be available, via
          *note base_exec_prefix: 3e8.  Refer to *note Virtual
          Environments: 4c38. for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3e6, *note prefix: 3e5. and ‘exec_prefix’ are now set
     to the virtual environment prefix by the *note path initialization:
     193e, instead of *note site: cc.  This means that ‘prefix’ and
     ‘exec_prefix’ always point to the virtual environment, even when
     ‘site’ is disabled (*note -S: 13c4.).

 -- データ: sys.executable

     Python インタプリタの実行ファイルの絶対パスを示す文字列です。このよ
     うな名前が意味を持つシステムで利用可能です。Python が自身の実行ファ
     イルの実際のパスを取得できない場合、*note sys.executable: 3eb. は空
     の文字列または ‘None’ になります。

 -- の関数: sys.exit ([arg])

     Raise a *note SystemExit: f40. 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:
     b37. 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(): 2646. 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: 8f9. statements are honored, and it
     is possible to intercept the exit attempt at an outer level.

     バージョン 3.6 で変更: Python インタープリタが (バッファされたデー
     タを標準ストリームに吐き出すときのエラーなどの) *note SystemExit:
     f40. を捕捉した後の後始末でエラーが起きた場合、終了ステータスは 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: 217e.
                                                            
                                                            
      -- の属性: flags.inspect                              *note -i: 16f9.
                                                            
                                                            
      -- の属性: flags.interactive                          *note -i: 16f9.
                                                            
                                                            
      -- の属性: flags.isolated                             *note -I: b5b.
                                                            
                                                            
      -- の属性: flags.optimize                             *note -O: 18d. または *note -OO: fb9.
                                                            
                                                            
      -- の属性: flags.dont_write_bytecode                  *note -B: 15eb.
                                                            
                                                            
      -- の属性: flags.no_user_site                         *note -s: 15aa.
                                                            
                                                            
      -- の属性: flags.no_site                              *note -S: 13c4.
                                                            
                                                            
      -- の属性: flags.ignore_environment                   *note -E: b5a.
                                                            
                                                            
      -- の属性: flags.verbose                              *note -v: 1643.
                                                            
                                                            
      -- の属性: flags.bytes_warning                        *note -b: 7f9.
                                                            
                                                            
      -- の属性: flags.quiet                                *note -q: 17ee.
                                                            
                                                            
      -- の属性: flags.hash_randomization                   *note -R: 1ed4.
                                                            
                                                            
      -- の属性: flags.dev_mode                             *note -X dev: 170.
                                                            (*note Python Development Mode: 508.)
                                                            
                                                            
      -- の属性: flags.utf8_mode                            *note -X utf8: 170.
                                                            
                                                            
      -- の属性: flags.safe_path                            *note -P: 7c1.
                                                            
                                                            
      -- の属性: flags.int_max_str_digits                   *note -X int_max_str_digits: 170.
                                                            (*note integer string conversion length limitation: 80b.)
                                                            
                                                            
      -- の属性: flags.warn_default_encoding                *note -X warn_default_encoding: 170.
                                                            
                                                            
      -- の属性: flags.gil                                  *note -X gil: 170. and *note PYTHON_GIL: 49a.
                                                            
                                                            
      -- の属性: flags.thread_inherit_context               *note -X thread_inherit_context: 170. and
                                                            *note PYTHON_THREAD_INHERIT_CONTEXT: 18cd.
                                                            
                                                            
      -- の属性: flags.context_aware_warnings               *note -X context_aware_warnings: 170. and
                                                            *note PYTHON_CONTEXT_AWARE_WARNINGS: 18c0.
                                                            

     バージョン 3.2 で変更: 新しい *note -q: 17ee. 向けに ‘quiet’ 属性が
     追加されました。

     Added in version 3.2.3: ‘hash_randomization’ 属性が追加されました。

     バージョン 3.3 で変更: 廃止済みの ‘division_warning’ 属性を削除しま
     した。

     バージョン 3.4 で変更: *note -I: b5b. ‘isolated’ フラグ向けに
     ‘isolated’ 属性が追加されました。

     バージョン 3.7 で変更: 新しい *note Python 開発モード: 508. 向けに
     ‘dev_mode’ 属性が、新しい *note -X: 170. ‘utf8’ フラグ向けに
     ‘utf8_mode’ 属性が追加されました。

     バージョン 3.10 で変更: Added ‘warn_default_encoding’ attribute for
     *note -X: 170. ‘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]: 4c8e. の 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(): b12. を参照してく
                                                                                 ださい。
                                                                                 
                                                                                 
      -- の属性: 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): b12. 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: 4c90. 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: 4c90. より大きい
     場合には、常に復元されるとは限りません:

          >>> s = '9876543211234567'    # 16 significant digits is too many!
          >>> format(float(s), '.16g')  # conversion changes value
          '9876543211234568'

 -- データ: sys.float_repr_style

     *note repr(): 1c3. 関数が浮動小数点数に対してどう振る舞うかを示す文
     字列です。この文字列が値 ‘'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(): 362. and
     *note gc.collect(): 1b5. to get more predictable results.

     If a Python build or implementation cannot reasonably compute this
     information, ‘getallocatedblocks()’ 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(): 1a23.

     *note Availability: 2199.: 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(): ad6.

 -- の関数: 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: 1334.).

     *note Availability: 2199.: Unix.

 -- の関数: sys.getfilesystemencoding ()

     Get the *note filesystem encoding: 75d.: the encoding used with the
     filesystem error handler to convert between Unicode filenames and
     bytes filenames.  The filesystem error handler is returned from
     *note getfilesystemencodeerrors(): ee6.

     最良の互換性のために、たとえファイル名の表現に bytes がサポートされ
     ていたとしても、全てのケースで str をファイル名に使うべきです。 フ
     ァイル名を受け取ったり返したりする関数は str と bytes をサポートし
     、すぐにシステムにとって好ましい表現に変換すべきです。

     *note os.fsencode(): e53. や *note os.fsdecode(): e52. を、正しいエ
     ンコーディングやエラーモードが使われていることを保証するために使う
     べきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     3f5. のメンバー *note filesystem_encoding: 419. と *note
     filesystem_errors: 41a. を参照してください。

     バージョン 3.2 で変更: *note getfilesystemencoding(): e57. の結果が
     ‘None’ になることはなくなりました。

     バージョン 3.6 で変更: Windows はもう ‘'mbcs'’ を返す保証は無くなり
     ました。 より詳しいことは PEP 529(3) および *note
     _enablelegacywindowsfsencoding(): 33c. を参照してください。

     バージョン 3.7 で変更: *note Python UTF-8 モード: 867. が有効なら
     ‘"utf-8"’ を返します。

 -- の関数: sys.getfilesystemencodeerrors ()

     Get the *note filesystem error handler: 75d.: the error handler
     used with the filesystem encoding to convert between Unicode
     filenames and bytes filenames.  The filesystem encoding is returned
     from *note getfilesystemencoding(): e57.

     *note os.fsencode(): e53. や *note os.fsdecode(): e52. を、正しいエ
     ンコーディングやエラーモードが使われていることを保証するために使う
     べきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     3f5. のメンバー *note filesystem_encoding: 419. と *note
     filesystem_errors: 41a. を参照してください。

     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():
     1789.

     Added in version 3.11.

 -- の関数: sys.getrefcount (object)

     'object' の参照数を返します。 'object' は (一時的に) *note
     getrefcount(): 2d0. からも参照されるため、参照数は予想される数より
     も 1 多くなります。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 292.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     'CPython 実装の詳細:' *note Immortal: 292. objects with a large
     reference count can be identified via *note _is_immortal(): 291.

     バージョン 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:
     199. が送出されます。

     *note getsizeof(): 1b3a. は 'object' の ‘__sizeof__’ メソッドを呼び
     出し、そのオブジェクトがガベージコレクタに管理されていた場合はガベ
     ージコレクタのオーバーヘッドを増やします。

     See recursive sizeof recipe(4) for an example of using
     ‘getsizeof()’ 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(): b48.

     Added in version 3.2.

 -- の関数: sys._getframe ([depth])

     コールスタックからフレームオブジェクトを返します。オプション引数
     'depth' を指定すると、スタックのトップから 'depth' だけ下のフレーム
     オブジェクトを取得します。 'depth' がコールスタックよりも深ければ、
     *note ValueError: 2ee. が発生します。 'depth' のデフォルト値は 0 で
     、この場合はコールスタックのトップのフレームを返します。

     引数 ‘frame’ で *note 監査イベント: 1ccb. ‘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: 1ccb. ‘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: 4c9c. set to 1 or using
     *note Py_NewInterpreter(): 1b90, and the *note main interpreter:
     164.).  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(): 171c. 関数で設定したプロファイラ関数を取得しま
     す。

 -- の関数: sys.gettrace ()

     *note settrace(): 2e3. 関数で設定したトレース関数を取得します。

     *note gettrace(): 15ff. 関数は、デバッガ、プロファイラ、カバレッジ
     ツールなどの実装に使うことのみを想定しています。この関数の振る舞い
     は言語定義ではなく実装プラットフォームの一部です。そのため、他の
     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: 2199.: 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: 39e0. を引数に取る関数と、イ
     ベントループが非同期ジェネレータの終了処理をスケジューリングするの
     に使う関数であることが求められます。

     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(): d89.

     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 数値型のハッシュ化:
     265d. を参照してください。

      -- の属性: 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(): 14eb. 関数を使って 16 進数に変換しなけ
     れば値の意味を持ちません。より読みやすいバージョン番号が必要な場合
     には *note named tuple: 85e. *note sys.version_info: 8b0. を使用し
     てください。

     ‘hexversion’ のより詳しい情報については *note API と ABI
     のバージョニング: 4ca6. を参照してください。

 -- データ: sys.implementation

     現在起動している Python インタプリタに関する情報が格納されたオブジ
     ェクトです。すべての Python 実装において、以下の属性が存在すること
     が要求されています。

     'name' は実装の識別子です (例: ‘'cpython'’)。実際の文字列は Python
     実装によって定義されますが、小文字であることが保証されています。

     'version' は *note sys.version_info: 8b0. と同じ形式の、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: 4ca5. と同形式の、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 実装固有の属性を追加する
     ことができます。それら非標準属性の名前はアンダースコアから始めなく
     てはならず、そしてここでは説明されません。その内容に関係なく、
     ‘sys.implementation’ はインタプリタ起動中や実装のバージョン間で変更
     することはありません (ただし 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():
          187e. 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(): 1789, *note
          PYTHONINTMAXSTRDIGITS: 1b99, or *note -X int_max_str_digits:
          170.

     Added in version 3.1.

     バージョン 3.11 で変更: Added *note default_max_str_digits: 2734.
     and *note str_digits_check_threshold: 4ca9.

 -- データ: sys.__interactivehook__

     この属性が存在する場合、インタープリタが *note 対話モード: 441. で
     起動したときに値は (引数なしで) 自動的に呼ばれます。これは *note
     PYTHONSTARTUP: 1ba. ファイルの読み込み後に行われるため、それにこの
     フックを設定することが出来ます。*note site: cc. モジュールで *note
     設定します: 11cf.。

     Raises an *note auditing event: 1ccb. ‘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: 292.; you must keep a
     reference to the return value of ‘intern()’ around to benefit from
     it.

 -- の関数: sys._is_gil_enabled ()

     Return *note True: e0b. if the *note GIL: 165. is enabled and *note
     False: d2f. 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: e0b. if the main Python interpreter is *note
     shutting down: 479.  Return *note False: d2f. 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: 44c. 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(): 44d.),
          and ‘False’ otherwise.  If JIT compilation is available, this
          can be controlled by setting the *note PYTHON_JIT: 44b.
          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():
          44e.), 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: e0b. if the given object is *note immortal: 292,
     *note False: d2f. 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: e0b. if the given string is "interned", *note
     False: d2f. 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(): 89b. above.

 -- データ: sys.maxsize

     *note Py_ssize_t: c59. 型の変数が取りうる最大値を示す整数です。通常
     、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: 1280. objects that have their
     *note find_spec(): a6c. 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
     ‘find_spec()’ 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__:
     20b0. attribute is passed in as a second argument.  The method
     returns a *note module spec: 23bf, or ‘None’ if the module cannot
     be found.

     参考
     ....

     *note importlib.abc.MetaPathFinder: a72.

          The abstract base class defining the interface of finder
          objects on ‘meta_path’.

     *note importlib.machinery.ModuleSpec: 22c8.

          The concrete class which *note find_spec(): a6c. should return
          instances of.

     バージョン 3.4 で変更: *note Module specs: 23bf. were introduced in
     Python 3.4, by PEP 451(13).

     バージョン 3.12 で変更: Removed the fallback that looked for a
     ‘find_module()’ method if a ‘meta_path’ entry didn't have a *note
     find_spec(): a6c. 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 ‘sys.orig_argv’ are the arguments to the Python
     interpreter, while the elements of *note sys.argv: 1480. are the
     arguments to the user's program.  Arguments consumed by the
     interpreter itself will be present in ‘sys.orig_argv’ and missing
     from ‘sys.argv’.

     Added in version 3.10.

 -- データ: sys.path

     モジュールを検索するパスを示す文字列のリスト。 *note PYTHONPATH:
     1223. 環境変数と、インストール時に指定したデフォルトパスで初期化さ
     れます。

     By default, as initialized upon program startup, a potentially
     unsafe path is prepended to *note sys.path: 3e2. ('before' the
     entries inserted as a result of *note PYTHONPATH: 1223.):

        * ‘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: 3e2. に追加でき、 ほかの全てのデータ型はイ
     ンポート中に無視されます。

     参考
     ....

        * *note site: cc. モジュールのドキュメントで、 .pth ファイルを使
          って *note sys.path: 3e2. を拡張する方法を解説しています。

 -- データ: sys.path_hooks

     path を引数にとって、その path に対する *note finder: 23c6. の作成
     を試みる呼び出し可能オブジェクトのリスト。 finder の作成に成功した
     ら、その呼出可能オブジェクトのは finder を返します。失敗した場合は
     、 *note ImportError: 65b. を発生させます。

     オリジナルの仕様は PEP 302(14) を参照してください。

 -- データ: sys.path_importer_cache

     *note finder: 23c6. オブジェクトのキャッシュ機能を果たす辞書です。
     キーは *note sys.path_hooks: 1229. に渡されているパスで、値は見つか
     った finder になります。パスが正常なファイルシステムパスであり、
     finder が ‘sys.path_hooks’ 上に見つからない場合は ‘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: 293. doesn't
     contain the major version anymore.  It is always ‘'linux'’, instead
     of ‘'linux2'’ or ‘'linux3'’.

     バージョン 3.8 で変更: On AIX, *note sys.platform: 293. doesn't
     contain the major version anymore.  It is always ‘'aix'’, instead
     of ‘'aix5'’ or ‘'aix7'’.

     バージョン 3.13 で変更: On Android, *note sys.platform: 293. now
     returns ‘'android'’ rather than ‘'linux'’.

     バージョン 3.14 で変更: On FreeBSD, *note sys.platform: 293.
     doesn't contain the major version anymore.  It is always
     ‘'freebsd'’, instead of ‘'freebsd13'’ or ‘'freebsd14'’.

     参考
     ....

     *note os.name: 307e. has a coarser granularity.  *note os.uname():
     1332. 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
          ‘sys.platlibdir’): 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: 21a9. argument to the ‘configure’ script.  See *note
     インストールパス: 447. for derived paths.

          注釈: If a *note virtual environment: 3e6. is in effect, this
          ‘prefix’ will point to the virtual environment.  The value for
          the Python installation will still be available, via *note
          base_prefix: 3e4.  Refer to *note Virtual Environments: 4c38.
          for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3e6, ‘prefix’ and *note exec_prefix: 3e9. are now set
     to the virtual environment prefix by the *note path initialization:
     193e, instead of *note site: cc.  This means that ‘prefix’ and
     ‘exec_prefix’ always point to the virtual environment, even when
     ‘site’ is disabled (*note -S: 13c4.).

 -- データ: sys.ps1
 -- データ: sys.ps2

     インタプリタの一次プロンプト、二次プロンプトを指定する文字列。対話
     モードで実行中のみ定義され、初期値は ‘'>>> '’ と ‘'... '’ です。文
     字列以外のオブジェクトを指定した場合、インタプリタが対話コマンドを
     読み込むごとにオブジェクトの *note str(): 16a. を評価します。この機
     能は、動的に変化するプロンプトを実装する場合に利用します。

 -- の関数: 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: 1334.).

     *note Availability: 2199.: 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():
     187e.

     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 The
     Python Profilers: 4b7b. for more information on the Python
     profiler.  The system's profile function is called similarly to the
     system's trace function (see *note settrace(): 2e3.), 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(): 2e3.  To trace calls with ‘setprofile()’
          inside a tracing function (e.g.  in a debugger breakpoint),
          see *note call_tracing(): 1c20.

     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 監査イベント: 1ccb. ‘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: f6c. exception is raised.

     バージョン 3.5.1 で変更: A *note RecursionError: f6c. 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 ‘settrace()’ for each thread
     being debugged or use *note threading.settrace(): a4c.

     Trace functions should have three arguments: 'frame', 'event', and
     'arg'.  'frame' is the *note current stack frame: 8f0.  '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(): 1c20.

     '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: dda.
          to *note False: d2f. on that *note frame: 8f0.

     ‘'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: ddb. to *note True: e0b. on the *note frame:
          8f0.

     例外が呼び出しチェインを辿って伝播していくことに注意してください。
     ‘'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
     ‘settrace()’ doesn't do.  Note that in order for this to work, a
     global tracing function must have been installed with ‘settrace()’
     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 標準型の階層: 238b. を
     参照してください。

     引数無しで *note 監査イベント: 1ccb. ‘sys.settrace’ を送出します。

     *note settrace(): 2e3. 関数は、デバッガ、プロファイラ、カバレッジツ
     ール等で使うためだけのものです。この関数の挙動は言語定義よりも実装
     プラットフォームの分野の問題で、全ての Python 実装で利用できるとは
     限りません。

     バージョン 3.7 で変更: ‘'opcode'’ event type added; *note
     f_trace_lines: dda. and *note f_trace_opcodes: ddb. 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: 39e0. 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 監査イベント: 1ccb.
     ‘sys.set_asyncgen_hooks_firstiter’ を送出します。

     引数無しで *note 監査イベント: 1ccb.
     ‘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: 2199.: 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: 2199.: Linux.

     Added in version 3.12.

 -- の関数: sys.is_stack_trampoline_active ()

     Return ‘True’ if a stack profiler trampoline is active.

     *note Availability: 2199.: 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: 4cab. for more
     information about the remote debugging mechanism.

     When the code is executed in the remote process, an *note auditing
     event: 1ccb. ‘sys.remote_exec’ is raised with the 'pid' and the
     path to the script file.  This event is raised in the process that
     called ‘sys.remote_exec()’.

     When the script is executed in the remote process, an *note
     auditing event: 1ccb. ‘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 ‘sys.remote_exec()’.

     *note Availability: 2199.: 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: 33d. environment variable before
     launching Python.

     See also *note sys.getfilesystemencoding(): e57. and *note
     sys.getfilesystemencodeerrors(): ee6.

     *note Availability: 2199.: 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: 33d. instead.

     Added in version 3.6: より詳しくは PEP 529(21) を参照してください。

     バージョン 3.13 で非推奨、バージョン 3.16 で削除予定: Use *note
     PYTHONLEGACYWINDOWSFSENCODING: 33d. instead.

 -- データ: sys.stdin
 -- データ: sys.stdout
 -- データ: sys.stderr

     インタプリタが使用する、それぞれ標準入力、標準出力、および標準エラ
     ー出力の *note ファイルオブジェクト: 13df. です:

        * ‘stdin’ は (*note input(): 14f4. の呼び出しも含む) すべての対
          話型入力に使われます。

        * ‘stdout’ は *note print(): 117b. および *note expression:
          242f. 文の出力と、*note input(): 14f4. のプロンプトに使用され
          ます。

        * インタプリタ自身のプロンプトおよびエラーメッセージは ‘stderr’
          に出力されます。

     これらのストリームは *note open(): 318. が返すような通常の *note
     テキストファイル: 20c9. です。引数は以下のように選択されます:

        * The encoding and error handling are is initialized from *note
          PyConfig.stdio_encoding: 644. and *note PyConfig.stdio_errors:
          4cac.

          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: 1210. environment
          variable before starting Python or by using the new *note -X:
          170. ‘utf8’ command line option and *note PYTHONUTF8: cd3.
          environment variable.  However, for the Windows console, this
          only applies when *note PYTHONLEGACYWINDOWSSTDIO: e59. 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: 1deb.
          command-line option or setting the *note PYTHONUNBUFFERED:
          1dec. environment variable.

     バージョン 3.9 で変更: Non-interactive ‘stderr’ is now
     line-buffered instead of fully buffered.

          注釈: 標準ストリームにバイナリーデータの読み書きを行うには下位
          のバイナリー *note buffer: 14bf. オブジェクトを使用してくださ
          い。例えば *note bytes: 193. を *note stdout: cd1. に書き出す
          場合は ‘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: 112e. 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: 20a3. 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(): 1b5.).

     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’.

     ‘sys.unraisablehook()’ can be overridden to control how unraisable
     exceptions are handled.

     参考
     ....

     *note excepthook(): a10. 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: 8b0. および *note platform: af. が提供する関数
     を使って下さい。

 -- データ: sys.api_version

     The C API version, equivalent to the C macro *note
     PYTHON_API_VERSION: 4cb2.  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: 119. を参照してください。

 -- データ: 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: 2199.: 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: 170. で渡された様々な実装固有の
     フラグの辞書です。オプション名にはその値が明示されていればそれが、
     それ以外の場合は *note True: e0b. がマップされます。例えば:

          $ ./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: 170. によって渡されたオプションにアクセスする方法は
     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.30.2 ‘sys.monitoring’ -- 実行イベントモニタリング
---------------------------------------------------

Added in version 3.12.

__________________________________________________________________

     注釈: ‘sys.monitoring’ is a namespace within the *note sys: df.
     module, not an independent module, and ‘import sys.monitoring’
     would fail with a *note ModuleNotFoundError: d41.  Instead, 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: 4cb7.

   * *note Events: 4cb8.

   * *note Callbacks: 4cb9.

* Menu:

* Tool identifiers::
* Events::
* Turning events on and off::
* Registering callback functions::


File: python.info,  Node: Tool identifiers,  Next: Events,  Up: sys monitoring --- 実行イベントモニタリング

5.30.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.30.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: 2ee. 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(): 198e. 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.30.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: 4cc9. event.

 -- monitoring-event: sys.monitoring.events.RERAISE

     An exception is re-raised, for example at the end of a *note
     finally: 1b1. block.

 -- monitoring-event: sys.monitoring.events.STOP_ITERATION

     An artificial *note StopIteration: df9. is raised; see *note the
     STOP_ITERATION event: 4ccb.

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: 4cc5. and *note PY_START:
4cc6. 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.30.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: 4cc6.

   * *note PY_RESUME: 4cc4.

   * *note PY_RETURN: 4cc5.

   * *note PY_YIELD: 4cc8.

   * *note CALL: 1a1a.

   * *note LINE: 4cc3.

   * *note INSTRUCTION: 4cc1.

   * *note JUMP: 4cc2.

   * *note BRANCH_LEFT: 297.

   * *note BRANCH_RIGHT: 298.

   * *note STOP_ITERATION: 4cc9.


File: python.info,  Node: Deprecated event,  Next: Ancillary events,  Prev: Local events,  Up: Events

5.30.2.5 Deprecated event
.........................

   * ‘BRANCH’

The ‘BRANCH’ event is deprecated in 3.14.  Using *note BRANCH_LEFT: 297.
and *note BRANCH_RIGHT: 298. 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.30.2.6 Ancillary events
.........................

Ancillary events can be monitored like other events, but are controlled
by another event:

   * *note C_RAISE: 4cbe.

   * *note C_RETURN: 4cbf.

The *note C_RETURN: 4cbf. and *note C_RAISE: 4cbe. events are controlled
by the *note CALL: 1a1a. event.  ‘C_RETURN’ and ‘C_RAISE’ events will
only be seen if the corresponding ‘CALL’ event is being monitored.


File: python.info,  Node: Other events,  Next: The STOP_ITERATION event,  Prev: Ancillary events,  Up: Events

5.30.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: 4cd3.

The other events that can be monitored are:

   * *note PY_THROW: 18ba.

   * *note PY_UNWIND: 4cc7.

   * *note RAISE: 19d4.

   * *note EXCEPTION_HANDLED: 4cc0.


File: python.info,  Node: The STOP_ITERATION event,  Prev: Other events,  Up: Events

5.30.2.8 The STOP_ITERATION event
.................................

PEP 380(1) specifies that a *note StopIteration: df9. 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: 4cc9. event is
provided.  ‘STOP_ITERATION’ can be locally disabled, unlike *note RAISE:
19d4.

Note that the *note STOP_ITERATION: 4cc9. event and the *note RAISE:
19d4. event for a *note StopIteration: df9. exception are equivalent,
and are treated as interchangeable when generating events.
Implementations will favor ‘STOP_ITERATION’ for performance reasons, but
may generate a ‘RAISE’ event with a ‘StopIteration’.

   ---------- 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.30.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.30.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: 2ee. 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.30.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: 32d. 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: 4cce. for 'code'

 -- の関数: sys.monitoring.set_local_events (tool_id: int, code:
          CodeType, event_set: int, /) -> None

     Activates all the *note local events: 4cce. for 'code' which are
     set in 'event_set'.  Raises a *note ValueError: 2ee. 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.30.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: 4cce. can be disabled for a specific code location
by returning *note sys.monitoring.DISABLE: 4cd3. 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: 4cd3. is returned by a callback for a *note global
event: 4cd1, *note ValueError: 2ee. 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: 4cd3. for all tools.


File: python.info,  Node: Registering callback functions,  Prev: Turning events on and off,  Up: sys monitoring --- 実行イベントモニタリング

5.30.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
     ‘register_callback()’ returns ‘None’.

     Raises an *note auditing event: 1ccb.
     ‘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.30.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: 4cd3.
will have no effect.  Different events will provide the callback
function with different arguments, as follows:

   * *note PY_START: 4cc6. and *note PY_RESUME: 4cc4.:

          func(code: CodeType, instruction_offset: int) -> object

   * *note PY_RETURN: 4cc5. and *note PY_YIELD: 4cc8.:

          func(code: CodeType, instruction_offset: int, retval: object) -> object

   * *note CALL: 1a1a, *note C_RAISE: 4cbe. and *note C_RETURN: 4cbf.
     ('arg0' can be *note MISSING: 4cdf. 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: 4cdf.

     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: 19d4, *note RERAISE: 4cca, *note EXCEPTION_HANDLED:
     4cc0, *note PY_UNWIND: 4cc7, *note PY_THROW: 18ba. and *note
     STOP_ITERATION: 4cc9.:

          func(code: CodeType, instruction_offset: int, exception: BaseException) -> object

   * *note LINE: 4cc3.:

          func(code: CodeType, line_number: int) -> object

   * *note BRANCH_LEFT: 297, *note BRANCH_RIGHT: 298. and *note JUMP:
     4cc2.:

          func(code: CodeType, instruction_offset: int, destination_offset: int) -> object

     Note that the 'destination_offset' is where the code will next
     execute.

   * *note INSTRUCTION: 4cc1.:

          func(code: CodeType, instruction_offset: int) -> object


File: python.info,  Node: sysconfig --- Python の構成情報へのアクセスを提供する,  Next: builtins --- 組み込みオブジェクト,  Prev: sys monitoring --- 実行イベントモニタリング,  Up: Python ランタイムサービス

5.30.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.30.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(): 29a. or *note
get_config_var(): 175.

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.30.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: 307e.  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: 1538.).

   - 'posix_venv': scheme for *note Python virtual environments: 118. 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: 118. 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.30.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:
1538. (written as ‘`userbase'’ hereafter).  This scheme installs pure
Python modules and extension modules in the same location (also known as
*note site.USER_SITE: 2181.).

* Menu:

* posix_user::
* nt_user::
* osx_framework_user::


File: python.info,  Node: posix_user,  Next: nt_user,  Up: User scheme

5.30.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.30.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.30.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.30.3.7 Home scheme
....................

"home スキーム" の背後にある考え方は、Python モジュールを個人用のモジュ
ール置き場でビルドし、維持するというものです。このスキームの名前は Unixの
「ホーム」ディレクトリの概念からとりました。というのも、 Unixのユーザに
とって、自分のホームディレクトリを ‘/usr/’ や ‘/usr/local/’ のようにレイ
アウトするのはよくあることだからです。とはいえ、このスキームはどのオペレ
ーティングシステムのユーザでも使えます。

* Menu:

* posix_home::


File: python.info,  Node: posix_home,  Up: Home scheme

5.30.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.30.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.30.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.30.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.30.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(): 4cf1.  It can be passed to ‘sysconfig’
     functions that take a 'scheme' argument, such as *note get_paths():
     33e.

     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(): 1c12. and *note get_preferred_scheme(): 8a0.
     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(): 4cf3. が返すリストに含まれる値で
     なければなりません。

     ‘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(): 1549. はパスを展開するのに *note
     get_config_vars(): 29a. が返す変数を利用します。すべての変数は各プ
     ラットフォームにおいてデフォルト値を持っていて、この関数を呼び出し
     たときにデフォルト値を取得する場合があります。

     'scheme' が指定された場合、*note get_scheme_names(): 4cf1. が返すリ
     ストに含まれる値でなければなりません。指定されなかった場合は、現在
     のプラットフォームでのデフォルトスキームが利用されます。

     If 'vars' is provided, it must be a dictionary of variables that
     will update the dictionary returned by *note get_config_vars():
     29a.

     'expand' が ‘False’ に設定された場合、パスは変数を使って展開されま
     せん。

     'name' が見つからない場合、*note KeyError: 5e7. を送出します。

 -- の関数: sysconfig.get_paths ([scheme[, vars[, expand]]])

     インストールスキームに基づいたすべてのインストールパスを格納した辞
     書を返します。詳しい情報は *note get_path(): 1549. を参照してくださ
     い。

     'scheme' が指定されない場合、現在のプラットフォームでのデフォルトス
     キーマが使用されます。

     'vars' を指定する場合、パスを展開するために使用される辞書を更新する
     値の辞書でなければなりません。

     'expand' に偽を指定すると、パスは展開されません。

     'scheme' が実在するスキームでなかった場合、*note get_paths(): 33e.
     は *note KeyError: 5e7. を発生させます。


File: python.info,  Node: その他の関数<3>,  Next: コマンドラインでの使用<7>,  Prev: Installation path functions,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.30.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(): 1332.), 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: 293. を返します。

 -- の関数: 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.30.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(): 145e.、*note get_python_version(): 145f.、
*note get_path(): 1549. および *note get_config_vars(): 29a. が返す情報
を標準出力に出力します。


File: python.info,  Node: builtins --- 組み込みオブジェクト,  Next: __main__ --- トップレベルのコード環境,  Prev: sysconfig --- Python の構成情報へのアクセスを提供する,  Up: Python ランタイムサービス

5.30.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(): 318.

通常このモジュールはほとんどのアプリケーションで明示的にアクセスされるこ
とはありませんが、組み込みの値と同じ名前のオブジェクトを提供するモジュー
ルが同時にその名前の組み込みオブジェクトも必要とするような場合には有用で
す。たとえば、組み込みの *note open(): 318. をラップした ‘open()’ という
関数を実装したいモジュールがあったとすると、このモジュールは次のように直
接的に使われます:

     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 組み込み定数: 24d7.

   * *note 組み込み例外: 1c84.

   * *note 組み込み関数: 1478.

   * *note 組み込み型: 2648.


File: python.info,  Node: __main__ --- トップレベルのコード環境,  Next: warnings --- 警告の制御,  Prev: builtins --- 組み込みオブジェクト,  Up: Python ランタイムサービス

5.30.5 ‘__main__’ -- トップレベルのコード環境
---------------------------------------------

__________________________________________________________________

Python では、 ‘__main__’ という特別な名前が次の二つの重要な用途で使われ
ます:

  1. プログラムのトップレベル環境の名前。 ‘__name__ == '__main__'’ とい
     う式でチェックすることができる。

  2. Python パッケージにおける ‘__main__.py’ ファイル。

どちらも Python のモジュールに関わる機能です。 １つ目はユーザーがどうモ
ジュールを使うか、２つ目はモジュールとモジュールがどうやりとりするかに関
係します。 詳細は以下で説明します。 Python モジュールがどういうものかに
ついては、 *note モジュール: 209a. を参照してください。

* 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.30.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.30.5.2 「トップレベルのスクリプト環境」とは
.............................................

‘__main__’ は、トップレベルのコードが実行される環境の名前です。 "トップ
レベルのコード" は、実行を開始する最初のユーザー指定の Python モジュール
です。これは、このモジュールがプログラムに必要なすべての他のモジュールを
インポートするために、 "トップレベル" なのです。時折、 "トップレベルのコ
ード" は、アプリケーションには 'エントリーポイント' と呼ばれます。

以下のものがトップレベルのスクリプト環境となります:

   * インタラクティブプロンプトのスコープ:

          >>> __name__
          '__main__'

   * Python インタープリタにファイル引数として渡される Python モジュール
     :

          $ python helloworld.py
          Hello, world!

   * Python インタープリタにPython *note -m: 23e. オプションとして渡され
     る 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: 1a9. オプションで渡される 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 モジュール: 209a. セクションを参照してください。


File: python.info,  Node: 通常の使われ方,  Next: パッケージングで考慮すべき点,  Prev: 「トップレベルのスクリプト環境」とは,  Up: __name__ == '__main__'

5.30.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.30.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(): 279.  For
example:

     sys.exit(main())

Since the call to ‘main’ is wrapped in *note sys.exit(): 279, the
expectation is that your function will return some value acceptable as
an input to ‘sys.exit()’; 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(): 279. 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:
b37.  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.30.5.5 ‘__main__.py’ in Python Packages
.........................................

If you are not familiar with Python packages, see section *note
パッケージ: 20aa. 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: 23e. 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 パッケージ内参照: 20ae.
in the *note モジュール: 209a. section of the tutorial.

* Menu:

* 通常の使われ方: 通常の使われ方<2>.


File: python.info,  Node: 通常の使われ方<2>,  Up: __main__ py in Python Packages

5.30.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: 118. 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: 23e. flag to the
interpreter executable.

See *note zipapp: 137. 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.30.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: 209b.) 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: 1791. 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 ‘sys.modules’, Python passes
that to ‘namely’.  See *note Special considerations for __main__: 24bf.
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.30.6 ‘warnings’ -- 警告の制御
-------------------------------

'ソースコード:' Lib/warnings.py(1)

__________________________________________________________________

警告メッセージは一般に、ユーザに警告しておいた方がよいような状況下にプロ
グラムが置かれているが、その状況は (通常は) 例外を送出したりそのプログラ
ムを終了させるほどの正当な理由がないといった状況で発されます。例えば、プ
ログラムが古いモジュールを使っている場合には警告を発したくなるかもしれま
せん。

Python プログラマは、このモジュールの *note warn(): 1737. 関数を使って警
告を発することができます。(C 言語のプログラマは *note PyErr_WarnEx():
166a. を使います; 詳細は *note 例外処理: 4d0c. を参照してください)。

警告メッセージは通常 *note sys.stderr: b37. に出力されますが、すべての警
告を無視したり、警告を例外にしたりと、その処理を柔軟に変更することができ
ます。 警告の処理は *note warning category: 2768. 、警告メッセージのテキ
スト、警告が発行されたソースの位置に基づいて変化します。 同じソースの位
置で特定の警告が繰り返された場合、通常は抑制されます。

警告制御には 2 つの段階 (stage) があります: 第一に、警告が発されるたびに
、メッセージを出力すべきかどうかの決定が行われます; 次に、メッセージを出
力するなら、メッセージはユーザによって設定が可能なフックを使って書式化さ
れ印字されます。

警告メッセージを出力するかどうかの決定は、 *note 警告フィルタ: 1b2. によ
って制御されます。警告フィルタは一致規則 (matching rule)と動作からなるシ
ーケンスです。 *note filterwarnings(): 16c7. を呼び出して一致規則をフィ
ルタに追加することができ、 *note resetwarnings(): 4d0d. を呼び出してフィ
ルタを標準設定の状態にリセットすることができます。

警告メッセージの印字は *note showwarning(): 4d0e. を呼び出して行うことが
でき、この関数は上書きすることができます; この関数の標準の実装では、
*note formatwarning(): 1e55. を呼び出して警告メッセージを書式化しますが
、この関数についても自作の実装を使うことができます。

参考
....

*note logging.captureWarnings(): 323e. を使うことで、標準ロギング基盤で
すべての警告を扱うことができます。

* 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.30.6.1 警告カテゴリ
.....................

警告カテゴリを表現する組み込み例外は数多くあります。このカテゴリ化は警告
をグループごとフィルタする上で便利です。

これらは厳密に言えば *note 組み込み例外: 2766. ですが、概念的には警告メ
カニズムに属しているのでここで記述されています。

標準の警告カテゴリをユーザの作成したコード上でサブクラス化することで、さ
らに別の警告カテゴリを定義することができます。警告カテゴリは常に *note
Warning: 2769. クラスのサブクラスでなければなりません。

現在以下の警告カテゴリクラスが定義されています:

クラス                                 説明
                                       
-------------------------------------------------------------------------------------------
                                       
*note Warning: 2769.                   すべての警告カテゴリクラスの基底クラスです。
                                       *note Exception: bd1. のサブクラスです。
                                       
                                       
*note UserWarning: 276a.               *note warn(): 1737. の標準のカテゴリです。
                                       
                                       
*note DeprecationWarning: 1a4.         他の Python 開発者へ向けて警告を発するときの、非
                                       推奨の機能についての警告の基底カテゴリです
                                       (‘__main__’ によって引き起こされない限り通常は無
                                       視されます)。
                                       
                                       
*note SyntaxWarning: 1af.              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: ac9.  将来その機能が非推奨になることを示す警告カテゴリ
                                       の基底クラスです(デフォルトでは無視されます)。
                                       
                                       
*note ImportWarning: 71e.              モジュールのインポート処理中に引き起こされる警告
                                       カテゴリの基底クラスです (デフォルトでは無視され
                                       ます)。
                                       
                                       
*note UnicodeWarning: 1642.            Unicode に関係した警告カテゴリの基底クラスです。
                                       
                                       
*note BytesWarning: e20.               *note bytes: 193. や *note bytearray: 342. に関連
                                       した警告カテゴリの基底クラスです。
                                       
                                       
*note ResourceWarning: 54c.            リソースの使用に関連した警告カテゴリの基底クラス
                                       です (デフォルトでは無視されます)。
                                       

バージョン 3.7 で変更: Previously *note DeprecationWarning: 1a4. 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.30.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: aca. and *note PYTHONWARNINGS: da7, '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: 2769. のサブクラス) です。警告
     クラスはこのクラスのサブクラスに一致しなければなりません。

   * 'module' is a string containing a regular expression that the start
     of the fully qualified module name must match, case-sensitively.
     In *note -W: aca. and *note PYTHONWARNINGS: da7, '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: 2769. クラスは組み込みの *note Exception: bd1. クラスから
派生しているので、警告をエラーに変換するには単に ‘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.30.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.30.6.4 Describing Warning Filters
...................................

The warnings filter is initialized by *note -W: aca. options passed to
the Python interpreter command line and the *note PYTHONWARNINGS: da7.
environment variable.  The interpreter saves the arguments for all
supplied entries without interpretation in *note sys.warnoptions: 3f3.;
the ‘warnings’ module parses these when it is first imported (invalid
options are ignored, after printing a message to *note sys.stderr:
b37.).

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
警告フィルタ: 1b2.  When listing multiple filters on a single line (as
for *note PYTHONWARNINGS: da7.), 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.30.6.5 デフォルトの警告フィルタ
.................................

デフォルトで、 Python はいくつかの警告フィルタをインストールします。これ
は *note -W: aca. コマンドラインオプション、 *note PYTHONWARNINGS: da7.
環境変数または *note filterwarnings(): 16c7. の呼び出しでオーバーライド
できます。

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: ac9. に加えて、
*note DeprecationWarning: 1a4. もデフォルトで無視されるようになりました
。

バージョン 3.7 で変更: *note DeprecationWarning: 1a4. is once again
shown by default when triggered directly by code in ‘__main__’.

バージョン 3.7 で変更: *note BytesWarning: e20. no longer appears in the
default filter list and is instead configured via *note sys.warnoptions:
3f3. when *note -b: 7f9. is specified twice.


File: python.info,  Node: Overriding the default filter,  Prev: デフォルトの警告フィルタ,  Up: 警告フィルタ

5.30.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: 3f3. 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: 1a4. 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.30.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: 17a.
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: 4d1a.
          for details on the concurrency-safety of the *note
          catch_warnings: 17a. 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.30.6.8 警告のテスト
.....................

コードが警告を発生させることをテストするには、 *note catch_warnings:
17a. コンテキストマネージャーを利用します。このクラスを使うと、一時的に
警告フィルタを操作してテストに利用できます。例えば、次のコードでは、発生
したすべての警告を取得してチェックしています:

     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: 4d1a.
          for details on the concurrency-safety of the *note
          catch_warnings: 17a. 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.30.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: 1a4. (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: 10d.
module does this).

In less ideal cases, applications can be checked for use of deprecated
interfaces by passing *note -Wd: aca. 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 ‘-W’
(e.g.  ‘-W error’).  See the ‘-W’ flag for more details on what is
possible.


File: python.info,  Node: 利用可能な関数,  Next: 利用可能なコンテキストマネージャー,  Prev: Updating Code For New Versions of Dependencies,  Up: warnings --- 警告の制御

5.30.6.10 利用可能な関数
........................

 -- の関数: warnings.warn (message, category=None, stacklevel=1,
          source=None, *, skip_file_prefixes=())

     警告を発するか、無視するか、あるいは例外を送出します。 'category' 引
     数が与えられた場合、 *note 警告カテゴリクラス: 2768. でなければなり
     ません; 標準の値は *note UserWarning: 276a. です。 'message' を
     *note Warning: 2769. インスタンスで代用することもできますが、この場
     合 'category' は無視され、 ‘message.__class__’ が使われ、メッセージ
     文は ‘str(message)’ になります。発された例外が前述した *note
     警告フィルタ: 1b2. によってエラーに変更された場合、この関数は例外を
     送出します。引数 '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():
     1737, 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: 2769. or
     'message' may be a ‘Warning’ 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: b37. です。この関数は ‘warnings.showwarning’ に任
     意の呼び出し可能オブジェクトを代入して置き換えることができます。
     'line' は警告メッセージに含めるソースコードの1行です。 'line' が与
     えられない場合、 *note showwarning(): 4d0e. は 'filename' と
     'lineno' から行を取得することを試みます。

 -- の関数: warnings.formatwarning (message, category, filename, lineno,
          line=None)

     警告を通常の方法で書式化します。返される文字列内には改行が埋め込ま
     れている可能性があり、かつ文字列は改行で終端されています。 'line' は
     警告メッセージに含まれるソースコードの1行です。 'line' が渡されない
     場合、 *note formatwarning(): 1e55. は 'filename' と 'lineno' から
     行の取得を試みます。

 -- の関数: warnings.filterwarnings (action, message='',
          category=Warning, module='', lineno=0, append=False)

     *note 警告フィルタ仕様: 1b2. のリストにエントリを一つ挿入します。標
     準ではエントリは先頭に挿入されます; 'append' が真ならば、末尾に挿入
     されます。この関数は引数の型をチェックし、 'message' および
     'module' の正規表現をコンパイルしてから、これらをタプルにして警告フ
     ィルタのリストに挿入します。二つのエントリが特定の警告に合致した場
     合、リストの先頭に近い方のエントリが後方にあるエントリに優先します
     。引数が省略されると、標準ではすべてにマッチする値に設定されます。

 -- の関数: warnings.simplefilter (action, category=Warning, lineno=0,
          append=False)

     単純なエントリを *note 警告フィルタ仕様: 1b2. のリストに挿入します
     。引数の意味は *note filterwarnings(): 16c7. と同じですが、この関数
     により挿入されるフィルタはカテゴリと行番号が一致していればすべての
     モジュールのすべてのメッセージに合致しますので、正規表現は必要あり
     ません。

 -- の関数: warnings.resetwarnings ()

     警告フィルタをリセットします。これにより、 *note -W: aca. コマンド
     ラインオプションによるもの *note simplefilter(): 8d1. 呼び出しによ
     るものを含め、 *note filterwarnings(): 16c7. の呼び出しによる影響は
     すべて無効化されます。

 -- の関数: @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: 489b. decorator for the attribute to exist on
     the overload as returned by *note typing.get_overloads(): 8be.

     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.30.6.11 利用可能なコンテキストマネージャー
............................................

 -- クラス: warnings.catch_warnings (*, record=False, module=None,
          action=None, category=Warning, lineno=0, append=False)

     A context manager that copies and, upon exit, restores the warnings
     filter and the *note showwarning(): 4d0e. function.  If the
     'record' argument is *note False: d2f. (the default) the context
     manager returns *note None: 886. on entry.  If 'record' is *note
     True: e0b, a list is returned that is progressively populated with
     objects as seen by a custom ‘showwarning()’ function (which also
     suppresses output to ‘sys.stderr’).  Each object in the list is
     guaranteed to have the following attributes:

             - ‘message’: the warning message (an instance of *note
               Warning: 2769.)

             - ‘category’: the warning category (a subclass of *note
               Warning: 2769.)

             - ‘filename’: the file name where the warning occurred
               (*note str: 16a.)

             - ‘lineno’: the line number in the file (*note int: 19c.)

             - ‘file’: the file object used for output (if any), or
               ‘None’

             - ‘line’: the line of source code (if available), or ‘None’

             - ‘source’: the original object that generated the warning
               (if available), or ‘None’

     バージョン 3.6 で変更: The ‘source’ attribute was added.

     The type of these objects is not specified and may change; only the
     presence of these attributes is guaranteed.

     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(): 8d1. as if it were called
     immediately on entering the context.

     See *note 警告フィルタ: 1b2. for the meaning of the 'category' and
     'lineno' parameters.

          注釈: See *note Concurrent safety of Context Managers: 4d1a.
          for details on the concurrency-safety of the ‘catch_warnings’
          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.30.6.12 Concurrent safety of Context Managers
...............................................

The behavior of *note catch_warnings: 17a. context manager depends on
the *note sys.flags.context_aware_warnings: 18b. 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: 3854. 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: 18b. flag is false, then *note
catch_warnings: 17a. 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 ‘catch_warnings’ class at the same time, the
behavior is undefined.

If the flag is true, *note catch_warnings: 17a. will not modify global
attributes and will instead use a *note ContextVar: 18da. to store the
newly established warning filtering state.  A context variable provides
thread-local storage and it makes the use of ‘catch_warnings’
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(): 4d0e. function.  That is not
concurrent-safe.

When 'record' is true and the flag is true, the *note showwarning():
4d0e. function is not replaced.  Instead, the recording status is
indicated by an internal property in the context variable.  In this
case, the ‘showwarning()’ function will not be restored when exiting the
context handler.

The *note context_aware_warnings: 18b. flag can be set the *note -X
context_aware_warnings: 170. command-line option or by the *note
PYTHON_CONTEXT_AWARE_WARNINGS: 18c0. 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: 176. flag to true.  That flag
          causes threads created by *note threading.Thread: 177. to
          start with a copy of the context variables from the thread
          starting it.  When true, the context established by *note
          catch_warnings: 17a. 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 ‘catch_warnings’ context manager
          will no longer be active.

バージョン 3.14 で変更: Added the *note
sys.flags.context_aware_warnings: 18b. flag and the use of a context
variable for *note catch_warnings: 17a. 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.30.7 ‘dataclasses’ -- データクラス
------------------------------------

'ソースコード:' Lib/dataclasses.py(1)

__________________________________________________________________

このモジュールは、*note __init__(): 8c0. や *note __repr__(): 82f. のよ
うな *note 特殊メソッド: 1cbd. を生成し、ユーザー定義のクラスに自動的に
追加するデコレーターや関数を提供します。このモジュールは元々、 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:

* モジュールの内容: モジュールの内容<5>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<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: モジュールの内容<5>,  Next: 初期化後の処理,  Up: dataclasses --- データクラス

5.30.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 特殊メソッド: 1cbd. を生成し、クラスに追
     加する *note decorator: 93e. です。

     ‘@dataclass’ デコレータは、‘field’ を探すためにクラスを検査します。
     ‘field’ は *note 型アノテーション: f55. を持つクラス変数として定義
     されます。後述する２つの例外を除き、 ‘@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__(): 8c0. 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__(): cf6. method
          will be generated.

          This method compares the class by comparing each field in
          order.  Both instances in the comparison must be of the
          identical type.

          If the class already defines ‘__eq__()’, this parameter is
          ignored.

          バージョン 3.13 で変更: The generated ‘__eq__’ method now
          compares each field individually (for example, ‘self.a ==
          other.a and self.b == other.b’), rather than comparing tuples
          of fields as in previous versions.

          This change makes the comparison faster but it may alter
          results in cases where attributes compare equal by identity
          but not by value (such as ‘float('nan')’).

          In Python 3.12 and earlier, the comparison was performed by
          creating tuples of the fields and comparing them (for example,
          ‘(self.a, self.b) == (other.a, other.b)’).

        - 'order': If true (the default is ‘False’), *note __lt__():
          14bc, *note __le__(): 1526, *note __gt__(): 1527, and *note
          __ge__(): 1528. 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: 2ee. is
          raised.

          If the class already defines any of ‘__lt__()’, ‘__le__()’,
          ‘__gt__()’, or ‘__ge__()’, then *note TypeError: 199. is
          raised.

        - 'unsafe_hash': If true, force ‘dataclasses’ to create a *note
          __hash__(): cf7. method, even though it may not be safe to do
          so.  Otherwise, generate a ‘__hash__()’ 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__(): cf7. 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:
          199.

          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: c82, 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: 4d26. below.

          If *note __setattr__(): 23d8. or *note __delattr__(): 23d9. is
          defined in the class and 'frozen' is true, then *note
          TypeError: 199. is raised.

        - 'match_args': If true (the default is ‘True’), the *note
          __match_args__: 1cd2. tuple will be created from the list of
          non keyword-only parameters to the generated *note __init__():
          8c0. 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__(): 8c0. parameter generated from a keyword-only field
          must be specified with a keyword when ‘__init__()’ is called.
          See the *note parameter: 23a7. glossary entry for details.
          Also see the *note KW_ONLY: 4d27. section.

          Keyword-only fields are not included in ‘__match_args__’.

          Added in version 3.10.

        - 'slots': If true (the default is ‘False’), *note __slots__:
          1709. 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: 199. is
          raised.

               警告: Passing parameters to a base class *note
               __init_subclass__(): 843. when using ‘slots=True’ will
               result in a *note TypeError: 199.  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:
          241a.  Therefore, do not use ‘__slots__’ to retrieve the field
          names of a dataclass.  Use *note fields(): 1995. 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: 11f6.  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__(): 8c0. method, which will be defined as:

          def __init__(self, a: int, b: int = 0):

     デフォルト値を指定しないフィールドを、デフォルト値を指定したフィー
     ルドの後ろに定義すると、 *note TypeError: 199. が送出されます。これ
     は、単一のクラスであっても、クラス継承の結果でも起きえます。

 -- の関数: 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: 4d28. 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 ‘MISSING’ 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__(): 8c0. 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__(): cf7. method.  If
          false, this field is excluded from the generated ‘__hash__()’.
          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__():
          cf6, *note __gt__(): 1527, 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: 19bb. 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__(): 8c0.
          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(): 1995.
     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(): 19ba.
          function.

     他の属性があることもありますが、それらはプライベートであり、調べた
     り、依存したりしてはなりません。

 -- クラス: dataclasses.InitVar

     ‘InitVar[T]’ type annotations describe variables that are *note
     init-only: 4d29.  Fields annotated with ‘InitVar’ are considered
     pseudo-fields, and thus are neither returned by the *note fields():
     1995. function nor used in any way except adding them as parameters
     to *note __init__(): 8c0. and an optional *note __post_init__():
     4d2a.

 -- の関数: dataclasses.fields (class_or_instance)

     このデータクラスのフィールドを定義する *note Field: 19bb. オブジェ
     クトをタプルで返します。 データクラスあるいはデータクラスのインスタ
     ンスを受け付けます。 データクラスやデータクラスのインスタンスが渡さ
     れなかった場合は、 *note TypeError: 199. を送出します。 ‘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(): d69.

     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: 199. 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(): d69.

     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: 199. 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: 8bc. 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 ‘@dataclass’ function is used.

     This function is not strictly required, because any Python
     mechanism for creating a new class with *note __annotations__: 456.
     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: 199.  If keys in 'changes' are not field names of
     the given dataclass, raises ‘TypeError’.

     The newly returned object is created by calling the *note
     __init__(): 8c0. method of the dataclass.  This ensures that *note
     __post_init__(): 4d2a, 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__(): 4d2a.

     It is an error for 'changes' to contain any fields that are defined
     as having ‘init=False’.  A *note ValueError: 2ee. 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__(): 4d2a, 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(): 1c2.

 -- の関数: dataclasses.is_dataclass (obj)

     Return ‘True’ if its parameter is a dataclass (including subclasses
     of a dataclass, but not including *note generic aliases: 8c2.) 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__(): 8c0. 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__(): 23d8. または *note __delattr__(): 23d9. が呼び
     出されたときに送出されます。これは *note AttributeError: 5f0. のサ
     ブクラスです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91126


File: python.info,  Node: 初期化後の処理,  Next: クラス変数,  Prev: モジュールの内容<5>,  Up: dataclasses --- データクラス

5.30.7.2 初期化後の処理
.......................

 -- の関数: dataclasses.__post_init__ ()

     When defined on the class, it will be called by the generated *note
     __init__(): 8c0, 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__(): 8c0. 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__(): 4d2a. 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(): 1acb. が ‘init=False’ であ
るフィールドをどう取り扱うかについての警告も参照してください。


File: python.info,  Node: クラス変数,  Next: 初期化限定変数,  Prev: 初期化後の処理,  Up: dataclasses --- データクラス

5.30.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(): 1995. function.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0526/


File: python.info,  Node: 初期化限定変数,  Next: 凍結されたインスタンス,  Prev: クラス変数,  Up: dataclasses --- データクラス

5.30.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: 1c11.  If a
field is an ‘InitVar’, 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(): 1995. function.  Init-only fields are added
as parameters to the generated *note __init__(): 8c0. method, and are
passed to the optional *note __post_init__(): 4d2a. 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(): 1995. will return *note Field: 19bb.
objects for ‘i’ and ‘j’, but not for ‘database’.


File: python.info,  Node: 凍結されたインスタンス,  Next: 継承<2>,  Prev: 初期化限定変数,  Up: dataclasses --- データクラス

5.30.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__(): 23d8. and *note __delattr__(): 23d9. methods to the
class.  These methods will raise a *note FrozenInstanceError: 17ba. when
invoked.

There is a tiny performance penalty when using ‘frozen=True’: *note
__init__(): 8c0. 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.30.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: c82.) 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: 19c, as specified in class ‘C’.

The generated *note __init__(): 8c0. 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.30.7.7 Re-ordering of keyword-only parameters in ‘__init__()’
...............................................................

*note __init__(): 8c0. で必要なパラメータが算出されると、キーワード専用
引数は他の一般的な（非キーワード専用）パラメータの後に移動します。これは
、すべてのキーワード専用引数は、非キーワード専用パラメータの末尾にこなけ
ればならないという、キーワード専用パラメータの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.30.7.8 デフォルトファクトリ関数
.................................

If a *note field(): 19ba. 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__(): 8c0. (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.30.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: 2ee. 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: 24f, *note dict: 184, or *note set: 185, 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.30.7.10 Descriptor-typed fields
.................................

Fields that are assigned *note descriptor objects: e4d. as their default
value have the following special behaviors:

   * The value for the field passed to the dataclass's *note __init__():
     8c0. method is passed to the descriptor's *note __set__(): 2415.
     method rather than overwriting the descriptor object.

   * Similarly, when getting or setting the field, the descriptor's
     *note __get__(): 1706. 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.30.8 ‘contextlib’ -- ‘with’ 文コンテキスト用ユーティリティ
------------------------------------------------------------

'ソースコード:' Lib/contextlib.py(1)

__________________________________________________________________

このモジュールは *note with: 187. 文に関わる一般的なタスクのためのユーテ
ィリティを提供します。詳しい情報は、 *note コンテキストマネージャ型:
246c. と *note with文とコンテキストマネージャ: 23de. を参照してください
。

* 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.30.8.1 ユーティリティ
.......................

以下の関数とクラスを提供しています:

 -- クラス: contextlib.AbstractContextManager

     An *note abstract base class: 13d2. for classes that implement
     *note __enter__(): 7e4. and *note __exit__(): 151c.  A default
     implementation for ‘__enter__()’ is provided which returns ‘self’
     while ‘__exit__()’ is an abstract method which by default returns
     ‘None’.  See also the definition of *note コンテキストマネージャ型:
     246c.

     Added in version 3.6.

 -- クラス: contextlib.AbstractAsyncContextManager

     An *note abstract base class: 13d2. for classes that implement
     *note __aenter__(): 247d. and *note __aexit__(): 1a00.  A default
     implementation for ‘__aenter__()’ is provided which returns ‘self’
     while ‘__aexit__()’ is an abstract method which by default returns
     ‘None’.  See also the definition of *note
     非同期コンテキストマネージャ (Asynchronous Context Manager): 812.

     Added in version 3.7.

 -- の関数: @contextlib.contextmanager

     この関数は *note with: 187. 文コンテキストマネージャのファクトリ関
     数を定義するために利用できる *note デコレータ: 93e. です。新しいク
     ラスや *note __enter__(): 7e4. と *note __exit__(): 151c. メソッド
     を別々に定義しなくても、ファクトリ関数を定義することができます。

     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 ジェネレータ:
     1270.-イテレータを返す必要があります。このイテレータは必ず値を1つ
     yield しなければなりません。 *note with: 187. 文の ‘as’ 節が存在す
     るなら、その値は as 節のターゲットへ束縛されることになります。

     ジェネレータが yield を実行した箇所で *note with: 187. 文のネストさ
     れたブロックが実行されます。ブロックから抜けた後でジェネレータは再
     開されます。ブロック内で処理されない例外が発生した場合は、ジェネレ
     ータ内部の yield を実行した箇所で例外が再送出されます。なので、(も
     しあれば) エラーを捕捉したり、クリーンアップ処理を確実に実行したり
     するために、*note try: 8f9...*note except: 1ac...*note finally:
     1b1. 構文を使用できます。例外を捕捉する目的が、(完全に例外を抑制し
     てしまうのではなく) 単に例外のログをとるため、もしくはあるアクショ
     ンを実行するためなら、ジェネレータはその例外を再送出しなければなり
     ません。例外を再送出しない場合、ジェネレータのコンテキストマネージ
     ャは ‘with’ 文に対して例外が処理されたことを示し、‘with’ 文の直後の
     文から実行を再開します。

     *note contextmanager(): 141f. は *note ContextDecorator: 141e. を使
     っているので、 ‘contextmanager()’ で作ったコンテキストマネージャは
     *note with: 187. 文だけでなくデコレータとしても利用できます。デコレ
     ーターとして利用された場合、新しい generator インスタンスが関数呼び
     出しのたびに暗黙に生成されます (このことによって、
     ‘contextmanager()’ によって作られたなにがしか「単発」コンテキストマ
     ネージャを、コンテキストマネージャがデコレータとして使われるために
     は多重に呼び出されることをサポートする必要がある、という要件に合致
     させることが出来ます。)

     バージョン 3.2 で変更: *note ContextDecorator: 141e. の使用。

 -- の関数: @contextlib.asynccontextmanager

     *note contextmanager(): 141f. と似ていますが、 *note
     非同期コンテキストマネージャ (asynchronous context manager): 812. を
     生成します。

     この関数は *note async with: 186. 文のための非同期コンテキストマネ
     ージャのファクトリ関数を定義するために利用できるデコレータ (*note
     decorator: 93e.) です。新しいクラスや *note __aenter__(): 247d. と
     *note __aexit__(): 1a00. メソッドを個別に定義する必要はありません。
     このデコレータは非同期ジェネレータ (*note asynchronous generator:
     24fb.) 関数に適用しなければなりません。

     簡単な例:

          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(): d23. とともに定義されたコンテキストマ
     ネージャは、デコレータとして使うことも *note async with: 186. 文と
     組み合わせて使うこともできます:

          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(): d23. で生成された単回使用のコンテキストマネ
     ージャが複数回呼び出し可能となり、コンテキストマネージャをデコレー
     タとして使うことができるための要件を満たすようにすることができます
     。

     バージョン 3.10 で変更: *note asynccontextmanager(): d23. により生
     成された非同期コンテキストマネージャをデコレータとして使うことがで
     きるようになりました。

 -- の関数: 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: 187. ブロックを出るときに ‘page.close()’ が呼ばれます。

          注釈: Most types managing resources support the *note context
          manager: 1e3. protocol, which closes 'thing' on leaving the
          *note with: 187. 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(): 309. 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: 180. や例外によっ
     て早期にブロックが終了した場合に、 ‘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)

     Return a context manager that returns 'enter_result' from *note
     __enter__(): 7e4, but otherwise does nothing.  It is intended to be
     used as a stand-in for an optional context manager, for example:

          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 再入可能(リエントラント): 4d3c.
     です。

     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(): 1a99. 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)

     Context manager for temporarily redirecting *note sys.stdout: cd1.
     to another file or file-like object.

     This tool adds flexibility to existing functions or classes whose
     output is hardwired to stdout.

     For example, the output of *note help(): ad8. normally is sent to
     'sys.stdout'.  You can capture that output in a string by
     redirecting the output to an *note io.StringIO: 112e. object.  The
     replacement stream is returned from the *note __enter__(): 7e4.
     method and so is available as the target of the *note with: 187.
     statement:

          with redirect_stdout(io.StringIO()) as f:
              help(pow)
          s = f.getvalue()

     *note help(): ad8. の出力をディスク上のファイルに送るためには、出力
     を通常のファイルにリダイレクトします:

          with open('help.txt', 'w') as f:
              with redirect_stdout(f):
                  help(pow)

     *note help(): ad8. の出力を標準エラー出力 ('sys.stderr') に送るには
     以下のようにします:

          with redirect_stdout(sys.stderr):
              help(pow)

     *note sys.stdout: cd1. のシステム全体にわたる副作用により、このコン
     テキストマネージャはライブラリコードやマルチスレッドアプリケーショ
     ンでの使用には適していません。また、サブプロセスの出力に対しても効
     果がありません。そのような制限はありますが、それでも多くのユーティ
     リティスクリプトに対して有用なアプローチです。

     このコンテキストマネージャは *note 再入可能(リエントラント): 4d3c.
     です。

     Added in version 3.4.

 -- の関数: contextlib.redirect_stderr (new_target)

     Similar to *note redirect_stdout(): feb. but redirecting *note
     sys.stderr: b37. to another file or file-like object.

     このコンテキストマネージャは *note 再入可能(リエントラント): 4d3c.
     です。

     Added in version 3.5.

 -- の関数: contextlib.chdir (path)

     現在の作業ディレクトリを変更するパラレル非安全なコンテキストマネー
     ジャです。グローバルな状態である作業ディレクトリを変更するため、ほ
     とんどのマルチスレッドまたは非同期のコンテキストに対する利用は適切
     ではありません。また、プログラムの実行権限を一時的に放棄するジェネ
     レータのような、直線的でないコードを実行する場合も適切ではありませ
     ん - 明確に必要でないかぎり、このコンテキストマネージャがアクティブ
     な状態で yield すべきではありません。

     これは *note chdir(): 821. の単純なラッパーで、コンテキストに入ると
     きに現在の作業ディレクトリを変更し、終了時に元の作業ディレクトリを
     復元します。

     このコンテキストマネージャは *note 再入可能(リエントラント): 4d3c.
     です。

     Added in version 3.11.

 -- クラス: contextlib.ContextDecorator

     コンテキストマネージャをデコレータとしても使用できるようにする基底
     クラスです。

     Context managers inheriting from ‘ContextDecorator’ have to
     implement *note __enter__(): 7e4. and *note __exit__(): 151c. as
     normal.  ‘__exit__’ retains its optional exception handling even
     when used as a decorator.

     *note contextmanager(): 141f. は ‘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: 187. 文に対応する必要
          があります。そうでないなら、明示的な ‘with’ 文を関数内で利用す
          るべきです。

     Added in version 3.2.

 -- クラス: contextlib.AsyncContextDecorator

     Similar to *note ContextDecorator: 141e. but only for asynchronous
     functions.

     ‘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 ‘ExitStack’
     instance, and performs no additional operations.

     各インスタンスは登録されたコールバックのスタックを管理し、インスタ
     ンスが (明示的に、あるいは *note with: 187. 文の終わりに暗黙的に)
     close されるときに逆順でそれを呼び出します。コンテキストスタックの
     インスタンスが暗黙的にガベージコレクトされたときには callback は呼
     び出され 'ません' 。

     このスタックモデルは、(file オブジェクトのように) ‘__init__’ メソッ
     ドでリソースを確保するコンテキストマネージャーを正しく扱うためのも
     のです。

     登録されたコールバックが登録の逆順で実行されるので、複数のネストさ
     れた *note with: 187. 文を利用するのと同じ振る舞いをします。これは
     例外処理にも適用されます。内側のコールバックが例外を抑制したり置き
     換えたりした場合、外側のコールバックには更新された状態に応じた引数
     が渡されます。

     これは正しく exit callback の stack を巻き戻すための、比較的低レベ
     ルな API です。アプリケーション独自のより高レベルなコンテキストマネ
     ージャーを作るための基板として使うのに適しています。

     Added in version 3.3.

      -- メソッド: enter_context (cm)

          Enters a new context manager and adds its *note __exit__():
          151c. method to the callback stack.  The return value is the
          result of the context manager's own *note __enter__(): 7e4.
          method.

          コンテキストマネージャーは、普段 *note with: 187. 文で利用され
          た時と同じように、例外を抑制することができます。

          バージョン 3.11 で変更: 'cm' がコンテキストマネージャでなかっ
          た場合、 *note AttributeError: 5f0. の代わりに *note
          TypeError: 199. 例外を送出します。

      -- メソッド: push (exit)

          Adds a context manager's *note __exit__(): 151c. 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__(): 151c. 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__(): 151c. 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__():
          151c. methods can.

          この関数はデコレータとしても使えるように、受け取ったオブジェク
          トをそのまま返します。

      -- メソッド: callback (callback, /, *args, **kwds)

          任意の関数と引数を受け取り、コールバックスタックに追加します。

          他のメソッドと異なり、このメソッドで追加されたコールバックは例
          外を抑制しません (例外の詳細も渡されません)。

          この関数はデコレータとしても使えるように、受け取った callback
          をそのまま返します。

      -- メソッド: pop_all ()

          コールバックスタックを新しい *note ExitStack: d22. インスタン
          スに移して、それを返します。このメソッドは callback を実行しま
          せん。代わりに、新しい stack が (明示的に、あるいは *note
          with: 187. 文の終わりに暗黙的に) 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: d22. に似た *note 非同期コンテキストマネージャ:
     812. です。スタック上で同期と非同期の両方のコンテキストマネージャの
     組み合わせをサポートします。また、後処理のためのコルーチンも持って
     います。

     The *note close(): 4d3f. method is not implemented; *note aclose():
     4d40. 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: 199. 例外を送出します。

      -- メソッド: push_async_exit (exit)

          Similar to *note ExitStack.push(): 4d3d. but expects either an
          asynchronous context manager or a coroutine function.

      -- メソッド: push_async_callback (callback, /, *args, **kwds)

          Similar to *note ExitStack.callback(): c7a. but expects a
          coroutine function.

      -- メソッド: async aclose ()

          Similar to *note ExitStack.close(): 4d3f. but properly handles
          awaitables.

     *note asynccontextmanager(): d23. の使用例の続きです:

          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.30.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.30.8.3 可変数個のコンテキストマネージャーをサポートする
.........................................................

*note ExitStack: d22. の第一のユースケースは、クラスのドキュメントにかか
れている通り、一つの *note with: 187. 文で可変数個のコンテキストマネージ
ャーや他のクリーンアップ関数をサポートすることです。ユーザーの入力 (指定
された複数個のファイルを開く場合など) に応じて複数個のコンテキストマネー
ジャーが必要となる場合や、いくつかのコンテキストマネージャーがオプション
となる場合に、可変数個のコンテキストマネージャーが必要になります:

     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: d22. はコンテキストマネージャープ
ロトコルをサポートしていないリソースの管理を *note with: 187. 文を使って
簡単に行えるようにします。


File: python.info,  Node: __enter__ メソッドからの例外をキャッチする,  Next: __enter__ 実装内のクリーンアップ,  Prev: 可変数個のコンテキストマネージャーをサポートする,  Up: 例とレシピ<3>

5.30.8.4 ‘__enter__’ メソッドからの例外をキャッチする
.....................................................

It is occasionally desirable to catch exceptions from an *note
__enter__(): 7e4. method implementation, 'without' inadvertently
catching exceptions from the *note with: 187. statement body or the
context manager's *note __exit__(): 151c. method.  By using *note
ExitStack: d22. the steps in the context management protocol can be
separated slightly in order to allow this:

     stack = ExitStack()
     try:
         x = stack.enter_context(cm)
     except Exception:
         # handle __enter__ exception
     else:
         with stack:
             # Handle normal case

実際のところ、このようなコードが必要になるのならば、利用している API 側
で *note try: 8f9./*note except: 1ac./*note finally: 1b1. 文を使った直接
的なリソース管理インターフェースを提供するべきです。しかし、すべての API
がそのようによく設計されているとは限りません。もしコンテキストマネージャ
ーが提供されている唯一のリソース管理APIであるなら、 *note ExitStack:
d22. を使って *note with: 187. 文を使って処理することができない様々なシ
チュエーションの処理をすることができます。


File: python.info,  Node: __enter__ 実装内のクリーンアップ,  Next: try-finally + flag 変数パターンを置き換える,  Prev: __enter__ メソッドからの例外をキャッチする,  Up: 例とレシピ<3>

5.30.8.5 ‘__enter__’ 実装内のクリーンアップ
...........................................

As noted in the documentation of *note ExitStack.push(): 4d3d, 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.30.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: d22. を使えば、代わりに ‘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(): c7a. のデコレーター形式を利用してリソース開放処理
を宣言することができます:

     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.30.8.7 コンテキストマネージャーを関数デコレーターとして使う
.............................................................

*note ContextDecorator: 141e. はコンテキストマネージャーを通常の ‘with’
文に加えて関数デコレーターとしても利用できるようにします。

例えば、関数やまとまった文を、そこに入った時と出た時の時間をトラックする
ロガーでラップしたい場合があります。そのために関数デコレーターとコンテキ
ストマネージャーを別々に書く代わりに、 *note ContextDecorator: 141e. を
継承すると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: 187. 文の仕様、背景、および例が記載されていま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ,  Prev: 例とレシピ<3>,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.30.8.8 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ
...........................................................................

ほとんどのコンテキストマネージャは、 *note with: 187. 文の中で一度だけ使
われるような場合に効果的になるように書かれています。これら単回使用のコン
テキストマネージャは毎回新規に生成されなければなりません - それらを再利
用しようとすると、例外を引き起こすか、正しく動作しません。

この共通の制限が意味することは、コンテキストマネージャは (上記すべての使
用例に示すとおり) 一般に *note with: 187. 文のヘッダ部分で直接生成するこ
とが推奨されるということです。

ファイルオブジェクトは単回使用のコンテキストマネージャ有効に利用した例で
す。最初の *note with: 187. 文によりファイルがクローズされ、それ以降その
ファイルオブジェクトに対するすべての IO 操作を防止します。

*note contextmanager(): 141f. により生成されたコンテキストマネージャも単
回使用のコンテキスト マネージャです。二回目に使おうとした場合、内部にあ
るジェネレータが値の生成に失敗したと訴えるでしょう:

     >>> 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.30.8.9 リエントラントなコンテキストマネージャ
...............................................

より洗練されたコンテキストマネージャには"リエントラント"なものがあります
。そのようなコンテキストマネージャは、複数の *note with: 187. 文で使える
だけでなく、同じコンテキストマネージャをすでに使っている ‘with’ 文の '内
部' でも使うことができます。

*note threading.RLock: 32c. はリエントラントなコンテキストマネージャの例
であり、また *note suppress(): 112d, *note redirect_stdout(): feb, そし
て *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(): feb. は、 *note
sys.stdout: cd1. を異なるストリームに束縛することによりシステムの状態に
対してグローバルな変更を行うことから、明らかにスレッドセーフではありませ
ん。


File: python.info,  Node: 再利用可能なコンテキストマネージャ,  Prev: リエントラントなコンテキストマネージャ,  Up: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ

5.30.8.10 再利用可能なコンテキストマネージャ
............................................

単回使用のコンテキストマネージャとリエントラントなコンテキストマネージャ
のいずれとも異なるタイプに "再利用可能" なコンテキストマネージャがありま
す (あるいは、より明確には、"再利用可能だがリエントラントでない" コンテ
キストマネージャです。リエントラントなコンテキストマネージャもまた再利用
可能だからです)。再利用可能なコンテキストマネージャは複数回利用をサポー
トしますが、同じコンテキストマネージャのインスタンスがすでに with 文で使
われている場合には失敗します (もしくは正しく動作しません)。

*note threading.Lock: 1a54. は再利用可能だがリエントラントでないコンテキ
ストマネージャの例です (リエントラントなロックのためには *note
threading.RLock: 32c. を代わりに使う必要があります)。

再利用可能だがリエントラントでないコンテキストマネージャのもうひとつの例
は *note ExitStack: d22. です。これは現在登録されている '全ての' コール
バック関数を、どこで登録されたかにかかわらず、呼び出します:

     >>> 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: d22. インスタンスを再利用する代わりに複数のイ
ンスタンスを使うことにより、この問題は回避することができます:

     >>> 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.30.9 ‘abc’ -- 抽象基底クラス
------------------------------

'ソースコード:' Lib/abc.py(1)

__________________________________________________________________

このモジュールは Python に PEP 3119(2) で概要が示された *note
抽象基底クラス: 13d2. (ABC) を定義する基盤を提供します。なぜこれが
Python に付け加えられたかについてはその PEP を参照してください。 (ABC に
基づいた数の型階層を扱った PEP 3141(3) と *note numbers: a2. モジュール
も参照してください。)

*note collections: 1e. モジュール には、抽象基底クラス から派生するいく
つかの具象クラスがある。もちろん、これらはさらに派生させることができる。
さらに、‘collections.抽象基底クラス’ サブモジュールには、クラスやインス
タンス が特定のインターフェース 、たとえば 、:term:>>'<<hashable'である
か、:term:>>'<<mapping'であるかをテストするために使用できる抽象基底クラ
ス があります。

このモジュールは、 抽象基底クラスを定義するためのメタクラス *note
ABCMeta: 1120. と、 継承を利用して抽象基底クラスを代替的に定義するヘルパ
ークラス *note ABC: 111f. を提供します。

 -- クラス: abc.ABC

     メタクラスとして *note ABCMeta: 1120. を持つヘルパークラスです。こ
     のクラスを使うことで、‘ABC’ を継承するだけで抽象基底クラスを作成で
     き、しばしば混乱しがちなメタクラスの使用を避けることができます。例
     えば:

          from abc import ABC

          class MyABC(ABC):
              pass

     Note that the type of ‘ABC’ is still *note ABCMeta: 1120, 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(): 9c8. によって登録した ABC のサブクラスと判
     定されますが、登録した ABC は MRO (Method Resolution Order, メソッ
     ド解決順)には現れませんし、この ABC のメソッド実装が(*note super():
     1a7. を通してだけでなく)呼び出し可能になるわけでもありません。 (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(): 111e. function.

     また、次のメソッドを抽象基底クラスの中でオーバーライドできます:

      -- メソッド: __subclasshook__ (subclass)

          (クラスメソッドとして定義しなければなりません。)

          Check whether 'subclass' is considered a subclass of this ABC.
          This means that you can customize the behavior of *note
          issubclass(): 9c8. further without the need to call *note
          register(): 129e. on every class you want to consider a
          subclass of the ABC. (This class method is called from the
          *note __subclasscheck__(): 2427. method of the ABC.)

          This method should return ‘True’, ‘False’ or *note
          NotImplemented: 1a3.  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__(): e6d, 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__(): 2a10. class method defined here says
     that any class that has an *note __iter__(): e6d. method in its
     *note __dict__: 77d. (or in that of one of its base classes,
     accessed via the *note __mro__: 23d4. 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__():
     e6d. method (it uses the old-style iterable protocol, defined in
     terms of *note __len__(): 17ff. 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: 1120. 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(): 4d4f. function.  The ‘abstractmethod()’
     only affects subclasses derived using regular inheritance; "virtual
     subclasses" registered with the ABC's *note register(): 129e.
     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(): 1a7. メカニズムを通して
          それをオーバーライドしたクラスから呼び出すことができます。これ
          は協調的多重継承を使ったフレームワークにおいて super 呼び出し
          の終点として有効です。

The ‘abc’ module also supports the following legacy decorators:

 -- の関数: @abc.abstractclassmethod

     Added in version 3.2.

     バージョン 3.3 で非推奨: *note classmethod: 48e. を *note
     abstractmethod(): 129b. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note classmethod(): 48e. のサブクラスで、抽象クラスメソ
     ッドであることを示します。それ以外は *note abstractmethod(): 129b.
     と同じです。

     この特殊ケースは *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: 451. を *note
     abstractmethod(): 129b. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note staticmethod(): 451. のサブクラスで、抽象静的メソ
     ッドであることを示します。それ以外は *note abstractmethod(): 129b.
     と同じです。

     この特殊ケースは *note staticmethod(): 451. デコレータが抽象メソッ
     ドに適用された場合に抽象的だと正しく認識されるようになったため撤廃
     されます:

          class C(ABC):
              @staticmethod
              @abstractmethod
              def my_abstract_staticmethod(arg):
                  ...

 -- の関数: @abc.abstractproperty

     バージョン 3.3 で非推奨: *note property: 4b3. 、 *note
     property.getter(): 1a38. 、 *note property.setter(): 1a39. および
     *note property.deleter(): 1a3a. を *note abstractmethod(): 129b. と
     一緒に使えるようになったため、このデコレータは冗長になりました。

     組み込みの *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(): 129e. の呼び出しごと
     に、トークンは変更されます。

     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: 1120, 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.30.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(): 2750. が呼び出された場合は実
行されません。

'注意:' クリーンアップ関数内からの関数の登録・登録解除効果は定義されてい
ません。

バージョン 3.7 で変更: C-API のサブインタープリタで使われているとき、登
録された関数は登録先のインタープリタのローカルな関数になります。

 -- の関数: atexit.register (func, *args, **kwargs)

     'func' を終了時に実行する関数として登録します。'func' に渡す引数は
     *note register(): a82. の引数として指定しなければなりません。同じ関
     数を同じ引数で複数回登録できます。

     通常のプログラムの終了時、例えば *note sys.exit(): 279. が呼び出さ
     れるとき、あるいは、メインモジュールの実行が完了したときに、登録さ
     れた全ての関数を、最後に登録されたものから順に呼び出します。通常、
     より低レベルのモジュールはより高レベルのモジュールより前に import さ
     れるので、後で後始末が行われるという仮定に基づいています。

     終了ハンドラの実行中に例外が発生すると、(*note SystemExit: f40. 以
     外の場合は)トレースバックを表示して、例外の情報を保存します。全ての
     終了ハンドラに動作するチャンスを与えた後に、最後に送出された例外を
     再送出します。

     この関数は 'func' を返し、これをデコレータとして利用できます。

          警告: 登録された関数から新しいスレッドを開始したり、 *note
          os.fork(): 4b5. を呼び出したりすると、メインの Python ランタイ
          ムスレッドがスレッド状態を開放する一方で、内部の *note
          threading: f3. ルーチンや新しいプロセスがそのスレッド状態を使
          用しようと試みる競合が発生します。これはクリーンなシャットダウ
          ンではなく、クラッシュにつながる恐れがあります。

     バージョン 3.12 で変更: 登録された関数から新しいスレッドの開始また
     は新しいプロセスの *note os.fork(): 4b5. が試みられた場合は、 *note
     RuntimeError: 246. が発生するようになりました。

 -- の関数: atexit.unregister (func)

     Remove 'func' from the list of functions to be run at interpreter
     shutdown.  ‘unregister()’ 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.30.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(): a82. に指定した位置引数とキーワード引数は登録した関数
を呼び出す際に渡されます:

     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 デコレータ: 93e. として利用する例:

     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.30.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: cf0. -- these are objects of
type *note types.TracebackType: cee, which are assigned to the *note
__traceback__: 14e2. 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: 1087. and *note FrameSummary: 1088.  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: 1b9.

* 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.30.11.1 モジュールレベルの関数
................................

 -- の関数: traceback.print_tb (tb, limit=None, file=None)

     Print up to 'limit' stack trace entries from *note traceback
     object: cf0. '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: b37.;
     otherwise it should be an open *note file: 13df. or *note file-like
     object: 181a. to receive the output.

          注釈: The meaning of the 'limit' parameter is different than
          the meaning of *note sys.tracebacklimit: 19a4.  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 トレースバックオブジェクト: cf0. 'tb' から例外の情報とスタッ
     クトレースの項目を 'file' に出力します。 この関数は以下の点で *note
     print_tb(): 1089. と異なります:

        * 'tb' が ‘None’ でない場合ヘッダ ‘Traceback (most recent call
          last):’ を出力します

        * スタックトレースの後に例外タイプと 'value' を出力します

        * 'type(value)' が *note SyntaxError: 18f. であり、 '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(): 1089. のものと同
     じです。 'chain' が真の場合 (デフォルト)、連鎖した例外 (例外の
     *note __cause__: 14e4. か *note __context__: 14e3. 属性) も出力され
     ます。 これはインタープリタ自身が処理されていない例外を出力するとき
     と同じです。

     バージョン 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
     スタックフレーム: 8f0. を指定するために用いることができます。オプシ
     ョンの 'file' 引数は *note print_tb(): 1089. の 'file' 引数と同様の
     意味を持っています。

     バージョン 3.5 で変更: 負の 'limit' がサポートされました。

 -- の関数: traceback.extract_tb (tb, limit=None)

     Return a *note StackSummary: 1087. object representing a list of
     "pre-processed" stack trace entries extracted from the *note
     traceback object: cf0. 'tb'.  It is useful for alternate formatting
     of stack traces.  The optional 'limit' argument has the same
     meaning as for *note print_tb(): 1089.  A "pre-processed" stack
     trace entry is a *note FrameSummary: 1088. object with attributes
     representing the information that is usually printed for a stack
     trace.

 -- の関数: traceback.extract_stack (f=None, limit=None)

     現在の *note スタックフレーム: 8f0. から生のトレースバックを取り出
     します。戻り値は *note extract_tb(): 4d5a. と同じ形式です。オプショ
     ンの 'f' と 'limit' 引数は *note print_stack(): 108a. と同じ意味を
     持ちます。

 -- の関数: traceback.print_list (extracted_list, file=None)

     Print the list of tuples as returned by *note extract_tb(): 4d5a.
     or *note extract_stack(): 4d5b. as a formatted stack trace to the
     given file.  If 'file' is ‘None’, the output is written to *note
     sys.stderr: b37.

 -- の関数: traceback.format_list (extracted_list)

     *note extract_tb(): 4d5a. または *note extract_stack(): 4d5b. が返
     すタプルのリストまたは *note FrameSummary: 1088. オブジェクトが与え
     られると、出力の準備を整えた文字列のリストを返します。結果として生
     じるリストの中の各文字列は、引数リストの中の同じインデックスの要素
     に対応します。各文字列は末尾に改行が付いています。さらに、ソーステ
     キスト行が ‘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_exc: 6e5.  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: 18f. 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: 273c.

     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: 273c. attached to the exception.

     バージョン 3.13 で変更: 'show_group' 引数が追加されました。

 -- の関数: traceback.format_exception (exc, /[, value, tb], limit=None,
          chain=True)

     スタックトレースと例外情報を書式化します。引数は *note
     print_exception(): a53. の対応する引数と同じ意味を持ちます。戻り値
     は文字列のリストで、それぞれの文字列は改行で終わり、そのいくつかは
     内部に改行を含みます。これらの行が連結されて出力される場合は、厳密
     に ‘print_exception()’ と同じテキストが出力されます。

     バージョン 3.5 で変更: 引数 'etype' は無視され、 'value' の型から推
     論されます。

     バージョン 3.10 で変更: This function's behavior and signature were
     modified to match *note print_exception(): a53.

 -- の関数: 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: cf0. 'tb' by calling the *note clear(): 585. method of
     each *note frame object: 8f0.

     Added in version 3.4.

 -- の関数: traceback.walk_stack (f)

     Walk a stack following *note f.f_back: 993. 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(): 4d5f.

     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: cef. yielding the frame
     and line number for each frame.  This helper is used with *note
     StackSummary.extract(): 4d5f.

     Added in version 3.5.


File: python.info,  Node: TracebackException オブジェクト,  Next: StackSummary オブジェクト,  Prev: モジュールレベルの関数<2>,  Up: traceback --- スタックトレースの表示または取得

5.30.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: cf0. and *note frame: 8f0. 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: 1087. class.

     If 'compact' is true, only data that is required by
     ‘TracebackException’'s *note format(): 19a. method is saved in the
     class attributes.  In particular, the *note __context__: 4d61.
     field is calculated only if *note __cause__: 4d62. is ‘None’ and
     *note __suppress_context__: 4d63. 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__: 14e4. の ‘TracebackException’。

      -- の属性: __context__

          元々の *note __context__: 14e3. の ‘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__: 2574.。

      -- の属性: __notes__

          The *note __notes__: 273c. 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: 1087.。

      -- の属性: exc_type

          The class of the original exception.

          バージョン 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, compact=False,
               max_group_width=15, max_group_depth=10)

          後のレンダリングのために例外をキャプチャします。 'limit'、
          'lookup_lines'、'capture_locals' は *note StackSummary: 1087.
          class のものです。

          局所変数がキャプチャされたとき、それらはトレースバックに表示さ
          れることに注意してください。

      -- メソッド: print (*, file=None, chain=True)

          Print to 'file' (default ‘sys.stderr’) the exception
          information returned by *note format(): 19a.

          Added in version 3.11.

      -- メソッド: format (*, chain=True)

          例外を書式化します。

          'chain' が ‘True’ でない場合 *note __cause__: 4d62. と *note
          __context__: 4d61. は書式化されません。

          返り値は文字列のジェネレータで、それぞれ改行で終わりますが、内
          部に改行を持つものもあります。 *note print_exception(): a53. は
          このメソッドのラッパで、単にファイルに出力します。

      -- メソッド: 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: 18f. 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: 273c. are
          now included in the output.

          バージョン 3.13 で変更: 'show_group' パラメータが追加されまし
          た。


File: python.info,  Node: StackSummary オブジェクト,  Next: FrameSummary オブジェクト,  Prev: TracebackException オブジェクト,  Up: traceback --- スタックトレースの表示または取得

5.30.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(): 1085. や *note
          walk_tb(): 1086. が返すもの) から ‘StackSummary’ を構築します
          。

          If 'limit' is supplied, only this many frames are taken from
          'frame_gen'.  If 'lookup_lines' is ‘False’, the returned *note
          FrameSummary: 1088. 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():
          1c3. 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: 1088. 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: 8f0.
          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: 8f0.
          involved in the stack.  This method is called for each *note
          FrameSummary: 1088. object to be printed by *note
          StackSummary.format(): 4d72.  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.30.11.4 ‘FrameSummary’ オブジェクト
.....................................

Added in version 3.5.

A ‘FrameSummary’ object represents a single *note frame: 8f0. in a *note
traceback: cf0.

 -- クラス: 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: 8f0. in the *note traceback: cf0.
     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: 4d74. attribute accessed
     (which also happens when casting it to a *note tuple: 614.).
     ‘line’ 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: 1589. on a *note frame
          object: 8f0. 'f'.

      -- の属性: lineno

          The line number of the source code for this frame.

      -- の属性: name

          Equivalent to accessing *note f.f_code.co_name: 23e5. on a
          *note frame object: 8f0. '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.30.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.30.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.30.12 ‘__future__’ -- future 文の定義
---------------------------------------

'ソースコード:' Lib/__future__.py(1)

__________________________________________________________________

‘from __future__ import feature’ の形式でのインポートは *note future 文:
45b. の定義と呼ばれています。これらは特殊なケースで、 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: 45b. 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:

* モジュールコンテンツ: モジュールコンテンツ<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/__future__.py


File: python.info,  Node: モジュールコンテンツ<3>,  Up: __future__ --- future 文の定義

5.30.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: 8b0. と同じフォーマットの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: 2627. インスタ
     ンスの *note _Feature.compiler_flag: 23f3. 属性に保存されています。

参考
....

*note future 文 (future statement): 45b.

     コンパイラがどのように 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.30.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)

     With no arguments, run a full collection.  The optional argument
     'generation' may be an integer specifying which generation to
     collect (from 0 to 2).  A *note ValueError: 2ee. is raised if the
     generation number is invalid.  The sum of collected objects and
     uncollectable objects is returned.

     ビルトイン型が持っている free list は、フルGCか最高世代(2)のGCの時
     にクリアされます。 *note float: 197. など、実装によって幾つかの
     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.

     バージョン 3.14.5 で変更: ‘generation=1’ performs collection of the
     middle generation.

 -- の関数: 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 tracked by the collector that are in that generation.

     バージョン 3.8 で変更: 新しい 'generation' パラメータ。

     バージョン 3.14 で変更: Generation 1 is removed

     バージョン 3.14.5 で変更: Generation 1 is reintroduced to maintain
     GC behavior from 3.13.

     引数 ‘generation’ で *note 監査イベント: 1ccb. ‘gc.get_objects’ を
     送出します。

 -- の関数: gc.get_stats ()

     インタプリタが開始してからの、世代ごと回収統計を持つ辞書の、3 世代
     ぶんのリストを返します。キーの数は将来変わるかもしれませんが、現在
     のところそれぞれの辞書には以下の項目が含まれています:

        * ‘collections’ は、この世代が検出を行った回数です;

        * ‘collected’ は、この世代内で回収されたオブジェクトの総数です;

        * ‘uncollectable’ is the total number of objects which were
          found to be uncollectable (and were therefore moved to the
          *note garbage: 13dd. list) inside this generation.

     Added in version 3.4.

 -- の関数: gc.set_threshold (threshold0[, threshold1[, threshold2]])

     ガベージコレクションの閾値（検出頻度）を指定します。 'threshold0' を
     0 にすると、検出は行われません。

     The GC classifies objects into three generations depending on how
     many collection sweeps they have survived.  New objects are placed
     in the youngest generation (generation ‘0’).  If an object survives
     a collection it is moved into the next older generation.  Since
     generation ‘2’ is the oldest generation, objects in that generation
     remain there after a collection.  In order to decide when to run,
     the collector keeps track of the number object allocations and
     deallocations since the last collection.  When the number of
     allocations minus the number of deallocations exceeds 'threshold0',
     collection starts.  Initially only generation ‘0’ is examined.  If
     generation ‘0’ has been examined more than 'threshold1' times since
     generation ‘1’ has been examined, then generation ‘1’ is examined
     as well.  With the third generation, things are a bit more
     complicated, see Collecting the oldest generation(1) for more
     information.

     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.

     See Garbage collector design(2) for more information.

     バージョン 3.14 で変更: 'threshold2' is ignored

     バージョン 3.14.5 で変更: 'threshold2' is restored to match Python
     3.13 behavior.

 -- の関数: gc.get_count ()

     現在の検出数を、 ‘(count0, count1, count2)’ のタプルで返します。

 -- の関数: gc.get_threshold ()

     現在の検出閾値を、 ‘(threshold0, threshold1, threshold2)’ のタプル
     で返します。

 -- の関数: gc.get_referrers (*objs)

     objsで指定したオブジェクトのいずれかを参照しているオブジェクトのリ
     ストを返します。この関数では、ガベージコレクションをサポートしてい
     るコンテナのみを返します。他のオブジェクトを参照していても、ガベー
     ジコレクションをサポートしていない拡張型は含まれません。

     尚、戻り値のリストには、すでに参照されなくなっているが、循環参照の
     一部でまだガベージコレクションで回収されていないオブジェクトも含ま
     れるので注意が必要です。有効なオブジェクトのみを取得する場合、
     *note get_referrers(): a09. の前に *note collect(): 1b5. を呼び出し
     てください。

          警告: *note get_referrers(): a09. から返されるオブジェクトは作
          りかけや利用できない状態である場合があるので、利用する際には注
          意が必要です。 ‘get_referrers()’ をデバッグ以外の目的で利用す
          るのは避けてください。

     引数 ‘objs’ を指定して *note 監査イベント: 1ccb. ‘gc.get_referrers’
     を送出します。

 -- の関数: gc.get_referents (*objs)

     引数で指定したオブジェクトのいずれかから参照されている、全てのオブ
     ジェクトのリストを返します。参照先のオブジェクトは、引数で指定した
     オブジェクトの Cレベルメソッド *note tp_traverse: 986. で取得し、全
     てのオブジェクトが直接到達可能な全てのオブジェクトを返すわけではあ
     りません。 ‘tp_traverse’ はガベージコレクションをサポートするオブジ
     ェクトのみが実装しており、ここで取得できるオブジェクトは循環参照の
     一部となる可能性のあるオブジェクトのみです。従って、例えば整数オブ
     ジェクトが直接到達可能であっても、このオブジェクトは戻り値には含ま
     れません。

     引数 ‘objs’ を指定して *note 監査イベント: 1ccb. ‘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: 4d96. が設定されている場合、全ての到達不能オブ
     ジェクトは解放されずにこのリストに格納されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 479. 時に
     このリストが空でない場合、(デフォルトでは黙りますが) *note
     ResourceWarning: 54c. が発行されます。 *note DEBUG_UNCOLLECTABLE:
     13de. がセットされていると、加えて回収不能オブジェクトを出力します
     。

     バージョン 3.4 で変更: Following PEP 442(3), objects with a *note
     __del__(): 1203. method don't end up in ‘gc.garbage’ anymore.

 -- データ: gc.callbacks

     ガベージコレクタの起動前と終了後に呼び出されるコールバック関数のリ
     スト。コールバックは 'phase' と 'info' の2つの引数で呼び出されます
     。

     'phase' は以下 2 つのいずれかです:

          "start": ガベージコレクションを始めます。

          "stop": ガベージコレクションが終了しました。

     'info' はコールバックに付加情報を提供する辞書です。現在のところ以下
     のキーが定義されています:

          "generation": 回収される最も古い世代。

          "collected": 'phase' が "stop" のとき、正常に回収されたオブジ
          ェクトの数。

          "uncollectable": 'phase' が "stop" のとき、回収出来ずに *note
          garbage: 13dd. リストに入れられたオブジェクトの数。

     アプリケーションは自身のコールバックをこのリストに追加出来ます。基
     本的なユースケースは以下のようなものでしょう:

          世代が回収される頻度やガベージコレクションにかかった時間の長さ
          といった、ガベージコレクションの統計情報を集めます。

          *note garbage: 13dd. に回収できない独自の型のオブジェクトが現
          れたとき、アプリケーションがそれらを特定し消去できるようにする
          。

     Added in version 3.3.

以下は *note set_debug(): 4d94. に指定することのできる定数です:

 -- データ: gc.DEBUG_STATS

     検出中に統計情報を出力します。この情報は、検出頻度を最適化する際に
     有益です。

 -- データ: gc.DEBUG_COLLECTABLE

     見つかった回収可能オブジェクトの情報を出力します。

 -- データ: gc.DEBUG_UNCOLLECTABLE

     見つかった回収不能オブジェクト（到達不能だが、ガベージコレクション
     で解放する事ができないオブジェクト）の情報を出力します。回収不能オ
     ブジェクトは、 ‘garbage’ リストに追加されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 479. 時に
     *note garbage: 13dd. リストが空でない場合に、その中身の出力も行いま
     す。

 -- データ: gc.DEBUG_SAVEALL

     設定されている場合、全ての到達不能オブジェクトは解放されずに
     'garbage' に追加されます。これはプログラムのメモリリークをデバッグ
     するときに便利です。

 -- データ: gc.DEBUG_LEAK

     プログラムのメモリリークをデバッグするときに指定します（
     ‘DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL’ と同じ）
     。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation

   (2) 
https://github.com/python/cpython/blob/3.14/InternalDocs/garbage_collector.md

   (3) https://peps.python.org/pep-0442/


File: python.info,  Node: inspect --- 活動中のオブジェクトを調査する,  Next: annotationlib --- Functionality for introspecting annotations,  Prev: gc --- ガベージコレクターインターフェース,  Up: Python ランタイムサービス

5.30.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.30.14.1 型とメンバー
......................

*note getmembers(): 1c4e. は、クラスやモジュールなどのオブジェクトからメ
ンバーを取得します。名前が "is" で始まる関数は、主に ‘getmembers()’ の第
2引数として利用するために提供されています。以下のような特殊属性を参照で
きるかどうか調べる時にも使えるでしょう (モジュール属性については *note
Import-related attributes on module objects: 23bd. を参照してください):

型                    属性                    説明
                                              
------------------------------------------------------------------------------
                                              
クラス                __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 こちら: 23f2. を
                                              参照。
                                              
                                              
                      co_lnotab               encoded mapping of line
                                              numbers to bytecode indices
                                              
                                              
                      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(): d89.
                                              を参照。
                                              
                                              
組み込み              __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__(): 17d8. に列挙されている場合、*note
          getmembers(): 1c4e. はメタクラスで定義されたクラス属性のみを返
          します。

 -- の関数: 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(): 4d9e. の全てのエントリに対して
     一致するかどうかをチェックされます。拡張子が一致した場合、最後のパ
     ス成分から拡張子を除いたものを返します。それ以外の場合は ‘None’ を
     返します。

     この関数は、実際の Python モジュールとして意味のある名前 'だけ' を
     返します。すなわち、 Python パッケージを指している可能性のあるパス
     に対しては、依然として ‘None’ を返します。

     バージョン 3.3 で変更: この関数は直接 *note importlib: 7b. に依存す
     るようになりました。

 -- の関数: inspect.ismodule (object)

     オブジェクトがモジュールの場合 ‘True’ を返します。

 -- の関数: inspect.isclass (object)

     オブジェクトが組み込みか Python が生成したクラスの場合に ‘True’ を
     返します。

     This function returns ‘False’ for *note generic aliases: 8c2. of
     classes, such as ‘list[int]’.

 -- の関数: inspect.ismethod (object)

     オブジェクトがメソッドの場合 ‘True’ を返します。

          注釈: For example, given this class:

               >>> class Greeter:
               ...     def say_hello(self):
               ...         print('hello!')

          A bound method (also known as an 'instance method') is created
          when accessing ‘say_hello’ (a *note function: 2517. defined in
          the ‘Greeter’ namespace) through an instance of the ‘Greeter’
          class:

               >>> instance = Greeter()

               >>> instance.say_hello
               <bound method Greeter.say_hello of <__main__.Greeter object ...>>
               >>> ismethod(instance.say_hello)
               True
               >>> isfunction(instance.say_hello)
               False

          Accessing ‘say_hello’ through the ‘Greeter’ class will return
          the function itself.  For this function, ‘ismethod()’ will
          return ‘False’, but *note isfunction(): 4da2. will return
          ‘True’:

               >>> Greeter.say_hello
               <function Greeter.say_hello at 0x7f7503854a90>
               >>> ismethod(Greeter.say_hello)
               False
               >>> isfunction(Greeter.say_hello)
               True

          See *note メソッド: 2721. for details.

 -- の関数: inspect.isfunction (object)

     オブジェクトが、 *note lambda: 2c2f. 式で生成されたものを含む
     Python 関数の場合に ‘True’ を返します。

     See the note for *note ismethod(): 4da1. for an example.

 -- の関数: inspect.ispackage (object)

     Return ‘True’ if the object is a *note package: 235.

     Added in version 3.14.

 -- の関数: inspect.isgeneratorfunction (object)

     オブジェクトが Python のジェネレータ関数の場合 ‘True’ を返します。

     It also returns ‘True’ for bound methods created from Python
     generator functions (see *note メソッド: 2721. for more
     information).

     バージョン 3.8 で変更: *note functools.partial(): 219. でラップした
     関数に対して、ラップされた関数が Python のジェネレータ関数である場
     合は ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 21a. でラ
     ップした関数に対して、ラップされた関数が Python のジェネレータ関数
     である場合は ‘True’ を返すようになりました。

 -- の関数: inspect.isgenerator (object)

     オブジェクトがジェネレータの場合 ‘True’ を返します。

 -- の関数: inspect.iscoroutinefunction (object)

     オブジェクトがコルーチン関数 *note coroutine function: f77. (*note
     async def: 7ed. 構文で定義された関数)、コルーチン関数 coroutine
     function をラップしている *note functools.partial(): 219. もしくは
     *note markcoroutinefunction(): 6b8. とマークされた同期関数のいずれ
     かの場合に ‘True’ を返します

     Added in version 3.5.

     バージョン 3.8 で変更: *note functools.partial(): 219. でラップした
     関数に対して、ラップされた関数が コルーチン関数 *note coroutine
     function: f77. である場合は ‘True’ を返すようになりました。

     バージョン 3.12 で変更: *note markcoroutinefunction(): 6b8. とマー
     クされた同期関数に対して ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 21a. でラ
     ップした関数に対して、ラップされた関数がコルーチン関数 *note
     coroutine function: f77. である場合は ‘True’ を返すようになりました
     。

 -- の関数: inspect.markcoroutinefunction (func)

     そのままであれば *note iscoroutinefunction(): 30f. がコルーチン関数
     と判定しないような呼び出し可能オブジェクトを、コルーチン関数 *note
     coroutine function: f77. とマークするためのデコレータです。

     これは、コルーチン *note coroutine: 6b9. を返す同期関数が、 *note
     iscoroutinefunction(): 30f. が真であることを要求するAPIに渡される場
     合に役に立つかもしれません。

     可能なら、 *note async def: 7ed. を使った関数定義が好ましいです。ま
     た、関数を呼び出した上でその戻り値を *note iscoroutine(): 101b. で
     テストする方法も容認できます。

     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: 18e. 式内で使用できる場合 ‘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:
     24fb. 関数である場合に ‘True’ を返します。使用例:

          >>> async def agen():
          ...     yield 1
          ...
          >>> inspect.isasyncgenfunction(agen)
          True

     Added in version 3.6.

     バージョン 3.8 で変更: *note functools.partial(): 219. でラップされ
     た関数でも、元の関数が非同期ジェネレータ *note asynchronous
     generator: 24fb. 関数であれば ‘True’ を返すようになりました。

     バージョン 3.13 で変更: Functions wrapped in *note
     functools.partialmethod(): 21a. now return ‘True’ if the wrapped
     function is a *note asynchronous generator: 24fb. function.

 -- の関数: inspect.isasyncgen (object)

     オブジェクトが *note asynchronous generator: 24fb. 関数によって生成
     された *note asynchronous generator iterator: 39e0. である場合に
     ‘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__(): cf6, *note __repr__(): 82f. などで
     す。

     Added in version 3.11.

 -- の関数: inspect.isroutine (object)

     オブジェクトがユーザ定義か組み込みの関数またはメソッドの場合は
     ‘True’ を返します。

 -- の関数: inspect.isabstract (object)

     オブジェクトが抽象基底クラスであるときに ‘True’ を返します。

 -- の関数: inspect.ismethoddescriptor (object)

     オブジェクトがメソッドデスクリプタであり、 *note ismethod(): 4da1,
     *note isclass(): 4da0, *note isfunction(): 4da2, *note isbuiltin():
     4da8. でない場合に ‘True’ を返します。

     これはたとえば、 ‘int.__add__’ で真を返します。この関数によるテスト
     をパスする（真を返す）オブジェクトは *note __get__(): 1706. メソッ
     ドを持ちますが、 *note __set__(): 2415. メソッドや *note
     __delete__(): 19af. メソッドは持ちません。それ以外の属性の有無はさ
     まざまです。 *note __name__: 1276. 属性は普通は存在しますし、 *note
     __doc__: b25. 属性もしばしば見られます。

     デスクリプタによって実装されたメソッドがこのメソッド以外のテストを
     パスする場合、 *note ismethoddescriptor(): 19ae. によるテストでは
     ‘False’ を返します。これは単純に、他のテストはより多くを約束するか
     らです - たとえば、あるオブジェクトが *note ismethod(): 4da1. のテ
     ストをパスするとき、そのオブジェクトが *note __func__: 1518. 属性
     (など) を持っていることを期待することができます。

     バージョン 3.13 で変更: この関数は、 *note __get__(): 1706. 属性と
     *note __delete__(): 19af. 属性を持ち、 *note __set__(): 2415. 属性
     を持たないオブジェクトをメソッドデスクリプタであると不正に報告する
     ことはなくなりました (そのようなオブジェクトはデータデスクリプタで
     あって、メソッドデスクリプタではありません)。

 -- の関数: inspect.isdatadescriptor (object)

     オブジェクトがデータデスクリプタの場合に ‘True’ を返します。

     データデスクリプタは *note __set__: 2415. メソッドか *note
     __delete__: 19af. メソッドのいずれかを持ちます。例としては、
     (Python で定義された) プロパティ、 getset デスクリプタ、メンバーデ
     スクリプタがあります。後者2つは C で定義されており、それぞれの型に
     対して特別なテストが存在します。それらのテストは、全ての Python 実
     装に対して堅牢です。概して、データデスクリプタは *note __name__:
     1276. 属性や ‘__doc__’ 属性も持ちますが、このことは保証されてはいま
     せん (一方でプロパティ、 getset デスクリプタ、メンバーデスクリプタ
     はこれら2つの属性を両方持っています)。

 -- の関数: inspect.isgetsetdescriptor (object)

     オブジェクトが getset デスクリプタの場合に ‘True’ を返します。

     getset とは、拡張モジュールで *note PyGetSetDef: db6. 構造体を用い
     て定義された属性のことです。そのような型を持たない Python 実装の場
     合は、このメソッドは常に ‘False’ を返します。

 -- の関数: inspect.ismemberdescriptor (object)

     オブジェクトがメンバーデスクリプタの場合に ‘True’ を返します。

     メンバーデスクリプタとは、拡張モジュールで *note PyMemberDef: 771.
     構造体を用いて定義された属性のことです。そのような型を持たない
     Python 実装の場合は、このメソッドは常に ‘False’ を返します。


File: python.info,  Node: ソースコードの情報取得,  Next: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Prev: 型とメンバー,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.2 ソースコードの情報取得
................................

 -- の関数: inspect.getdoc (object)

     Get the documentation string for an object, cleaned up with *note
     cleandoc(): 1a8e.  If the documentation string for an object is not
     provided and the object is a class, a method, a property or a
     descriptor, retrieve the documentation string from the inheritance
     hierarchy.  Return ‘None’ if the documentation string is invalid or
     missing.

     バージョン 3.5 で変更: ドキュメンテーション文字列がオーバーライドさ
     れていない場合は継承されるようになりました。

 -- の関数: inspect.getcomments (object)

     オブジェクトのソースコード直前 (クラス、関数、メソッドの場合) また
     は Python ソースファイルの先頭 (モジュールの場合) の任意の行数にわ
     たるコメントを、ひとつの文字列として返します。オブジェクトのソース
     コードが存在しない場合は ‘None’ を返します。オブジェクトが C で定義
     されている場合や、対話型シェルで定義したオブジェクトの場合にこのよ
     うなことが起こり得ます。

 -- の関数: inspect.getfile (object)

     オブジェクトを定義している (テキストまたはバイナリの) ファイルの名
     前を返します。オブジェクトが組み込みモジュール、クラス、関数の場合
     は *note TypeError: 199. 例外が発生します。

 -- の関数: inspect.getmodule (object)

     オブジェクトが定義されているモジュールの推定を試みます。モジュール
     が決められない場合は ‘None’ を返します。

 -- の関数: inspect.getsourcefile (object)

     オブジェクトが定義されている Python ソースファイルの名前を返します
     。ソースを取得する方法がない場合は ‘None’ を返します。組み込みのモ
     ジュール、クラス、関数に対しては *note TypeError: 199. で失敗します
     。

 -- の関数: inspect.getsourcelines (object)

     オブジェクトを定義しているソースコードの行のリストと、定義の開始行
     番号を返します。引数にはモジュール、クラス、メソッド、関数、トレー
     スバック、またはコードオブジェクトを渡すことができます。オブジェク
     トに対応するソースコードが行のリストとして返されます。また行番号は
     、元のソースファイル中でコードが見つかった最初の行を示します。ソー
     スコードを探し出すことができなかった場合、 *note OSError: 2c2. 例外
     が送出されます。オブジェクトが組み込みのモジュール、クラス、または
     関数である場合は *note TypeError: 199. 例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 1262. の代わりに *note
     OSError: 2c2. を送出します。前者は後者のエイリアスです。

 -- の関数: inspect.getsource (object)

     オブジェクトを定義しているソースコードのテキストを返します。引数に
     はモジュール、クラス、メソッド、関数、トレースバック、フレーム、ま
     たはコードオブジェクトを渡すことができます。ソースコードはひとつの
     文字列として返されます。ソースコードを探し出すことができなかった場
     合、 *note OSError: 2c2. 例外が送出されます。オブジェクトが組み込み
     のモジュール、クラス、または関数である場合は *note TypeError: 199.
     例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 1262. の代わりに *note
     OSError: 2c2. を送出します。前者は後者のエイリアスです。

 -- の関数: inspect.cleandoc (doc)

     コードブロックと位置を合わせるためのインデントを docstring から削除
     します。

     先頭行の行頭の空白文字は全て削除されます。 2行目以降では全行で同じ
     数の行頭の空白文字が、削除できるだけ削除されます。 その後、先頭と末
     尾の空白行が削除され、全てのタブが空白に展開されます。


File: python.info,  Node: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Next: クラスと関数<2>,  Prev: ソースコードの情報取得,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.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(): 219. オブジェク
     トまで、幅広い Python の呼び出し可能なオブジェクトを受け付けます。

     アノテーションのいくつかが (たとえば ‘from __future__ import
     annotations’ が使われていることを理由に) 文字列である場合、 *note
     signature(): 231. は *note annotationlib.get_annotations(): 457. を
     使って「非文字列化」すなわち文字列アノテーションを解決して本来のア
     ノテーションに戻すことを試みます。アノテーションの解決を行う際には
     'globals', 'locals', および 'eval_str' パラメータが
     ‘annotationlib.get_annotations()’ に渡されます; これらのパラメータ
     を使う方法についての説明は ‘annotationlib.get_annotations()’ のドキ
     ュメンテーションを参照してください。返されるアノテーションの形式を
     制御するため、 'annotation_format' パラメータには *note
     annotationlib.Format: 232. 列挙型のメンバーを渡すことができます。た
     とえばアノテーションを文字列形式で返すためには
     ‘annotation_format=annotationlib.Format.STRING’ を使ってください。

     シグネチャを提供できない場合は *note ValueError: 2ee. 例外を送出し
     ます。またオブジェクトの型がサポートされていない場合は *note
     TypeError: 199. 例外を送出します。さらに、アノテーションが文字列化
     されており、 'eval_str' が偽でない場合、アノテーションを「非文字列
     化」するために *note annotationlib.get_annotations(): 457. 内部で呼
     ばれる ‘eval()’ により、いかなる種類の例外も送出される可能性があり
     ます。

     関数シグネチャにおけるスラッシュ (/) は、それより前のパラメータが位
     置専用引数であることを示します。より詳しい情報は、 *note
     位置専用引数に関する FAQ エントリ: 2635. を参照してください。

     バージョン 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: 4db1.
     集合として、関数が受け取るパラメータそれぞれについての *note
     Parameter: 4e4. オブジェクトを保存します。

     オプション引数 'parameters' は *note Parameter: 4e4. オブジェクトの
     シーケンスで、重複した名前のパラメータはないか、パラメータの並び順
     は正しいか、すなわち位置専用引数からはじまり次に位置引数としてもキ
     ーワード引数としても指定可能なパラメータが続くかどうか、またデフォ
     ルト値のあるパラメータがデフォルト値のないパラメータの後にあるかど
     うか、といった項目をチェックするための検証が行われます。

     オプション引数 'return_annotation' は任意の Python オブジェクトをと
     ることができます。この引数は、呼び出し可能オブジェクトの "戻り値" に
     対するアノテーションを表します。

     ‘Signature’ オブジェクトは 'immutable' すなわち変更不可能です。変更
     されたコピーを生成するためには、 *note Signature.replace(): 4db2. ま
     たは *note copy.replace(): 1c2. を使ってください。

     バージョン 3.5 で変更: ‘Signature’ オブジェクトは pickle 可能かつ ハ
     ッシュ可能 になりました。

      -- の属性: empty

          return アノテーションがないことを指すクラスレベルの特殊マーカ
          です。

      -- の属性: parameters

          パラメータの名前と対応する *note Parameter: 4e4. オブジェクト
          の、順序ありマッピングです。パラメータは、キーワード専用パラメ
          ータも含めて、厳密な定義順に現れます。

          バージョン 3.7 で変更: バージョン 3.7 までは、Python はキーワ
          ード専用パラメータだけしか順序を保つことを明確に保証していませ
          んでした。とはいえ Python 3 では事実上パラメータの順序は維持さ
          れていました。

      -- の属性: return_annotation

          呼び出し可能オブジェクトの "return" アノテーションです。呼び出
          し可能オブジェクトに "return" アノテーションがない場合、この属
          性は *note Signature.empty: 4db3. に設定されます。

      -- メソッド: bind (*args, **kwargs)

          位置引数およびキーワード引数からパラメータへのマッピングを生成
          します。 ‘*args’ と ‘**kwargs’ がシグネチャに一致した場合
          *note BoundArguments: 1279. を返します。引数がシグネチャと一致
          しない場合は *note TypeError: 199. 例外を送出します。

      -- メソッド: bind_partial (*args, **kwargs)

          *note Signature.bind(): 18f5. と同様に動作しますが、いくつかの
          必要な引数を省略することができます (*note functools.partial():
          219. の振る舞いによく似たものです) 。 *note BoundArguments:
          1279. を返します。引数がシグネチャと一致しない場合は *note
          TypeError: 199. 例外を送出します。

      -- メソッド: replace (*[, parameters][, return_annotation])

          *note replace(): 4db2. メソッドが呼び出されたインスタンスから
          、新しい *note Signature: 4e3. インスタンスを生成します。元に
          なるシグネチャのプロパティをオーバーライドするために異なる
          'parameters' や 'return_annotation' を渡すことが可能です。
          ‘return_annotation’ をコピーされた ‘Signature’ インスタンスか
          ら削除したい場合、 *note Signature.empty: 4db3. を渡してくださ
          い。

               >>> 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(): 1c2. でもサポートされています。

      -- メソッド: format (*, max_width=None,
               quote_annotation_strings=True)

          *note Signature: 4e3. オブジェクトの文字列表現を生成します。

          'max_width' が指定されると、メソッドはシグネチャをそれぞれの行
          が最大 'max_width' 文字になるようにフォーマットを試みます。シ
          グネチャが 'max_width' よりも長くなってしまう場合は、全てのパ
          ラメータごとに改行されます。

          'quote_annotation_strings' が偽の場合、文字列で表されたシグネ
          チャの中の *note アノテーション: 15d. は、最初と最後のクォート
          記号無しで表示されます。この挙動は、シグネチャが *note STRING:
          161. フォーマットで作られた場合や ‘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(): 231.
          と同じです。

          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(): 4db6. や *note copy.replace(): 1c2. を使ってオ
     ブジェクトの内容を変更したコピーを作成することができます。

     バージョン 3.5 で変更: Parameter オブジェクトはピックル化可能
     (picklable) かつ ハッシュ化可能 (*note hashable: 824.) になりました
     。

      -- の属性: empty

          デフォルト値とアノテーションがないことを指すクラスレベルの特殊
          マーカです。

      -- の属性: name

          仮引数名 (文字列) です。名前は有効な Python 識別子でなければな
          りません。

          CPython は内包表記やジェネレータ式を実装するためのコードオブジ
          ェクトにおいて、 ‘.0’ という形式で暗黙のパラメータ名を生成しま
          す。

          バージョン 3.6 で変更: このモジュールにより、これら暗黙のパラ
          メータ名は ‘implicit0’ のような名前で公開されるようになりまし
          た。

      -- の属性: default

          引数のデフォルト値です。引数にデフォルト値がない場合、この属性
          は *note Parameter.empty: 4db7. に設定されます。

      -- の属性: annotation

          引数のアノテーションです。引数にアノテーションがない場合、この
          属性は *note Parameter.empty: 4db7. に設定されます。

      -- の属性: 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: 4dbb. 列挙型の各定数を説明します。

          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: 4db7. を渡してくださ
          い。

               >>> 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(): 1c2. でもサポートされています。

     バージョン 3.4 で変更: Python 3.3 では、‘kind’ が ‘POSITIONAL_ONLY’
     の場合に限り、 ‘name’ が ‘None’ であるような *note Parameter: 4e4.
     オブジェクトが許されていました。ですが、そのようなオブジェクトはも
     はや許可されていません。

 -- クラス: inspect.BoundArguments

     *note Signature.bind(): 18f5. または *note
     Signature.bind_partial(): 4db5. を呼び出して得られる結果です。引数
     と関数のパラメータとの間のマッピング情報を保持します。

      -- の属性: arguments

          パラメータの名前と引数の値との間のミュータブルなマッピングです
          。明示的に紐付けされた引数だけを含みます。 *note arguments:
          b0c. に対する変更は *note args: 4dbd. と *note kwargs: 4dbe. に
          反映されます。

          いかなる引数処理の目的でも、 *note Signature.parameters: 4db1.
          とあわせて使うようにしてください。

               注釈: *note Signature.bind(): 18f5. または *note
               Signature.bind_partial(): 4db5. でデフォルト値をあてにす
               るとされた引数は、スキップされます。それらをマッピングに
               加えたい場合は、必要に応じて *note
               BoundArguments.apply_defaults(): 101a. を使ってください。

          バージョン 3.9 で変更: *note arguments: b0c. の型が *note
          dict: 184. になりました。以前は *note collections.OrderedDict:
          7f3. 型でした。

      -- の属性: args

          位置引数の値のタプルです。*note arguments: b0c. 属性から動的に
          計算されます。

      -- の属性: kwargs

          キーワード引数の値の辞書です。 *note arguments: b0c. 属性から
          動的に計算されます。位置引数として渡すことができる引数は、
          *note args: 4dbd. に含まれることに注意してください。

      -- の属性: 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: 4dbd. と *note kwargs: 4dbe. の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.30.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(): 231. と *note Signature オブジェクト: 4daf. が呼
     び出し可能オブジェクトのイントロスペクション (実行時オブジェクト調
     査) のための推奨される API を提供しており、かつ拡張モジュール API で
     ときどき遭遇する追加の振る舞い (位置専用引数など) もサポートしてい
     ることに注意してください。この関数は、主に Python 2 の ‘inspect’ モ
     ジュール API との互換性を維持することが必要なコードで利用されるため
     に残されています。

     バージョン 3.4 で変更: この関数は *note signature(): 231. をもとに
     実装されています。ただし、 ‘__wrapped__’ 属性を無視します。また、束
     縛されたメソッドに対するシグネチャの出力において、すでに束縛された
     最初のパラメータを含みます。

     バージョン 3.6 で変更: This method was previously documented as
     deprecated in favour of *note signature(): 231. 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(): 10c3. で取得した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(): 18f5. や
     *note Signature.bind_partial(): 4db5. を使ってください。

 -- の関数: inspect.getclosurevars (func)

     Python 関数またはメソッド 'func' の外部の名前参照と、それらの現在の
     値のマッピングを取得します。 *note named tuple: 85e.
     ‘ClosureVars(nonlocals, globals, builtins, unbound)’ を返します。参
     照名を、 'nonlocals' はレキシカルクロージャ変数、すなわち外側のスコ
     ープで定義された変数の値にマップし、 'globals' は関数が属するモジュ
     ールのグローバル変数にマップし、 'builtins' は関数本体から見える組
     み込み変数にマップします。 'unbound' は、現在のモジュールにおけるグ
     ローバル変数や組み込み変数において解決できないにもかかわらず、関数
     内で参照されている名前の集合です。

     'func' が Python の関数やメソッドでない場合 *note TypeError: 199. が
     送出されます。

     Added in version 3.3.

 -- の関数: inspect.unwrap (func, *, stop=None)

     'func' によりラップされたオブジェクトを取得します。 ‘__wrapped__’ 属
     性の連鎖をたどり、ラップの連鎖の最後にあるオブジェクトを返します。

     'stop' はオプションで指定可能なコールバック関数で、ラッパーの連鎖に
     おけるオブジェクトをただひとつの引数として取ります。このコールバッ
     ク関数が真値を返した段階で、オブジェクトのアンラップを早期に終了さ
     せることができます。コールバック関数が真値を返さない場合は、通常通
     りラッパーの連鎖における最後のオブジェクトを返します。例えば、
     *note signature(): 231. は、オブジェクトに ‘__signature__’ 属性が定
     義されていたらオブジェクトのアンラップを停止するために、このオプシ
     ョンを使っています。

     循環を検知した場合は *note ValueError: 2ee. を送出します。

     Added in version 3.4.

 -- の関数: inspect.get_annotations (obj, *, globals=None, locals=None,
          eval_str=False, format=annotationlib.Format.VALUE)

     オブジェクトに対するアノテーション辞書を計算します。

     これは *note annotationlib.get_annotations(): 457. のエイリアスです
     ; 詳細はその関数のドキュメントを参照してください。

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 489e. for more information.

     Added in version 3.10.

     バージョン 3.14 で変更: この関数は *note
     annotationlib.get_annotations(): 457. のエイリアスになりました。
     ‘inspect.get_annotations’ として呼び出しても、引き続き正しく動作し
     ます。


File: python.info,  Node: インタープリタスタック,  Next: 属性の静的なフェッチ,  Prev: クラスと関数<2>,  Up: inspect --- 活動中のオブジェクトを調査する

5.30.14.5 インタープリタスタック
................................

以下の関数のうちいくつかは *note FrameInfo: 85c. オブジェクトを返します
。これらのオブジェクトは、後方互換性のために ‘positions’ を除く全ての属
性に対して、タプル的な演算を許可します。この振る舞いは非推奨と考えられて
おり、将来削除されるかもしれません。

 -- クラス: inspect.FrameInfo

      -- の属性: frame

          そのレコードに相当する *note フレームオブジェクト: 8f0. です。

      -- の属性: filename

          このレコードに相当するフレームによって実行されるコードのファイ
          ル名です。

      -- の属性: lineno

          このレコードに相当するフレームによって実行されるコードの、現在
          の行の行番号です。

      -- の属性: function

          このレコードに相当するフレームによって実行される関数名です。

      -- の属性: code_context

          このレコードに相当するフレームによって実行される、ソースコード
          から生成されたコンテキストの行のリストです。

      -- の属性: index

          *note code_context: 4dca. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このレコードに相当するフレームによって実行される命令に結びつい
          た *note dis.Positions: 19a0. オブジェクトで、開始行番号、終了
          行番号、開始カラムオフセット、終了カラムオフセットを含んでいま
          す。

     バージョン 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: 4dd0. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このトレースバックに対応するフレームによって実行される命令の開
          始行番号、終了行番号、開始カラムオフセット、終了カラムオフセッ
          トを含む *note dis.Positions: 19a0. オブジェクトです。

     バージョン 3.11 で変更: ‘Traceback’ はクラスインスタンスになりまし
     た (ただしそれ以前の *note named tuple: 85e. とは後方互換です) 。

     注釈: フレームレコードの最初の要素などのフレームオブジェクトへの参
     照を保存すると、循環参照になってしまう場合があります。循環参照がで
     きると、Python の循環参照検出機能を有効にしていたとしても関連するオ
     ブジェクトが参照しているすべてのオブジェクトが解放されにくくなり、
     明示的に参照を削除しないとメモリ消費量が増大する恐れがあります。

     参照の削除を Python の循環参照検出機能にまかせることもできますが、
     *note finally: 1b1. 節で循環参照を解除すれば確実にフレーム (とその
     ローカル変数) は削除されます。また、循環参照検出機能は Python のコ
     ンパイルオプションや *note gc.disable(): 4d92. で無効とされている場
     合がありますので注意が必要です。例:

          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.30.14.6 属性の静的なフェッチ
..............................

*note getattr(): dce. や *note hasattr(): 6f9. は属性の存在確認や属性値
の取得に際してコードの実行を伴うことがあります。プロパティなどのデスクリ
プタが呼び出され、また *note __getattr__(): 6fa. や *note
__getattribute__(): dcf. が呼び出されたりするかもしれません。

For cases where you want passive introspection, like documentation
tools, this can be inconvenient.  *note getattr_static(): 6bc. has a
similar signature as *note getattr(): dce. but avoids executing code
when it fetches attributes.

 -- の関数: inspect.getattr_static (obj, attr)

 -- の関数: inspect.getattr_static (obj, attr, default)

     Retrieve attributes without triggering dynamic lookup via the
     descriptor protocol, *note __getattr__(): 6fa. or *note
     __getattribute__(): dcf.

     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.30.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(): 1452. 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: bc6. 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: 1270. with no currently
     associated frame, then an empty dictionary is returned.  *note
     TypeError: 199. 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(): 12f1, 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(): 12f1, but
     works for asynchronous generator objects created by *note async
     def: 7ed. functions which use the *note yield: bc6. 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.30.14.8 Code Objects Bit Flags
................................

Python code objects have a *note co_flags: 193d. 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: 18fe.

     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.30.14.9 Buffer flags
......................

 -- クラス: inspect.BufferFlags

     This is an *note enum.IntFlag: e9e. that represents the flags that
     can be passed to the *note __buffer__(): 68c. method of objects
     implementing the *note buffer protocol: 262.

     The meaning of the flags is explained at *note
     バッファリクエストのタイプ: 124d.

      -- の属性: 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.30.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.30.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: 15d. 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: 232.), each of which works best for different use cases:

   * *note VALUE: 15f. 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: 160. returns *note ForwardRef: 17e8. 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: 161. 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(): 457. 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: 15e. that is used to evaluate annotations, such as *note
get_annotate_from_class_namespace(): 459. and *note
call_annotate_function(): 1829, as well as the *note
call_evaluate_function(): 4876. function for working with *note evaluate
functions: 4875.

     注意: Most functionality in this module can execute arbitrary code;
     see *note the security section: 489e. 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 アノテーションのベストプラクティス: 9dd. provides best practices
for working with annotations.

typing-extensions(5) provides a backport of *note get_annotations():
457. 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.30.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: 45b.  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: 450. 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.30.15.2 クラス
................

 -- クラス: annotationlib.Format

     An *note IntEnum: edf. 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(): 457. and other
     functions in this module, as well as to *note __annotate__: 19e3.
     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: 15f.
          format, or raise *note NotImplementedError: 369. 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:
          15f. format) for defined values, and *note ForwardRef: 17e8.
          proxies for undefined values.  Real objects may contain
          references to ‘ForwardRef’ 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:
     160. 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
          ‘ForwardRef’.  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: 15f. (the default),
          this method may throw an exception, such as *note NameError:
          450, 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: 160, the method will
          never throw an exception, but may return a ‘ForwardRef’
          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 ‘FORWARDREF’
          format will return ‘list[ForwardRef('undefined')]’.  If the
          'format' argument is *note STRING: 161, the method will return
          *note __forward_arg__: 4dfa.

          The 'owner' parameter provides the preferred mechanism for
          passing scope information to this method.  The owner of a
          ‘ForwardRef’ is the object that contains the annotation from
          which the ‘ForwardRef’ 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 ‘ForwardRef’ 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: 23d3. 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 ‘ForwardRef’
          retrieved from an annotation found in the class namespace of a
          generic class ‘C’, 'type_params' should be set to
          ‘C.__type_params__’.

          ‘ForwardRef’ instances returned by *note get_annotations():
          457. 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.
          ‘ForwardRef’ 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 ‘ForwardRef’ 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.30.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(): 18bb.  This is meant as
     a helper for user-provided annotate functions that support the
     *note STRING: 161. format but do not have access to the code
     creating the annotations.

     For example, this is used to implement the *note STRING: 161. for
     *note typing.TypedDict: 330. 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: 15e. 'annotate' with the given
     'format', a member of the *note Format: 232. 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: 15f. 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: 160. format to produce a *note ForwardRef: 17e8. 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: 4875. 'evaluate' with the given
     'format', a member of the *note Format: 232. enum, and return the
     value produced by the function.  This is similar to *note
     call_annotate_function(): 1829, 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(): 488b, the value
          of type aliases

        * *note typing.TypeVar.evaluate_bound(): 4874, the bound of type
          variables

        * *note typing.TypeVar.evaluate_constraints(): 4878, the
          constraints of type variables

        * *note typing.TypeVar.evaluate_default(): 487a, the default
          value of type variables

        * *note typing.ParamSpec.evaluate_default(): 4885, the default
          value of parameter specifications

        * *note typing.TypeVarTuple.evaluate_default(): 487e, 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: 15e. 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: 4dfd. 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__: 19e3. or *note __annotations__: 456. attributes.
     Passing any other object raises *note TypeError: 199.

     The 'format' parameter controls the format in which annotations are
     returned, and must be a member of the *note Format: 232. 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: 160.  If this is not implemented,
               it will then check if *note VALUE_WITH_FAKE_GLOBALS:
               4df9. 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: 15f.  If ‘VALUE’
               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(): 4dfc.

             * When calling ‘object.__annotate__’ it is first called
               with *note STRING: 161.  If this is not implemented, it
               will then check if *note VALUE_WITH_FAKE_GLOBALS: 4df9.
               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: 15f. with the
               result converted using *note annotations_to_string():
               4dfc.  If ‘VALUE’ 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: 15f.

        * 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 ‘eval()’ 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 ‘eval()’ 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__: 14ef, although if 'obj' is a wrapped function
          (using *note functools.update_wrapper(): 1227.) or a *note
          functools.partial: 219. 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
     アノテーションのベストプラクティス: 9dd. 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: 161. format.  This calls *note repr(): 1c3. 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: 161. 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.30.15.4 レシピ
................

* Menu:

* Using annotations in a metaclass::
* Creating a custom callable annotate function::


File: python.info,  Node: Using annotations in a metaclass,  Next: Creating a custom callable annotate function,  Up: レシピ<3>

5.30.15.5 Using annotations in a metaclass
..........................................

A *note metaclass: 241e. 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(): 459. can be
used to get the annotate function, and *note call_annotate_function():
1829. can be used to call it and retrieve the annotations.  Using the
*note FORWARDREF: 160. 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: Creating a custom callable annotate function,  Prev: Using annotations in a metaclass,  Up: レシピ<3>

5.30.15.6 Creating a custom callable annotate function
......................................................

Custom *note annotate functions: 15e. may be literal functions like
those automatically generated for functions, classes, and modules.  Or,
they may wish to utilise the encapsulation provided by classes, in which
case any *note callable: 2df7. can be used as an annotate function.

To provide the *note VALUE: 15f, *note STRING: 161, or *note FORWARDREF:
160. formats directly, an *note annotate function: 15e. must provide the
following attribute:

   * A callable ‘__call__’ with signature ‘__call__(format, /) -> dict’,
     that does not raise a *note NotImplementedError: 369. when called
     with a supported format.

To provide the *note VALUE_WITH_FAKE_GLOBALS: 4df9. format, which is
used to automatically generate *note STRING: 161. or *note FORWARDREF:
160. if they are not supported directly, *note annotate functions: 15e.
must provide the following attributes:

   * A callable ‘__call__’ with signature ‘__call__(format, /) -> dict’,
     that does not raise a *note NotImplementedError: 369. when called
     with *note VALUE_WITH_FAKE_GLOBALS: 4df9.

   * A *note code object: 4e6. ‘__code__’ containing the compiled code
     for the annotate function.

   * Optional: A tuple of the function's positional defaults
     ‘__kwdefaults__’, if the function represented by ‘__code__’ uses
     any positional defaults.

   * Optional: A dict of the function's keyword defaults ‘__defaults__’,
     if the function represented by ‘__code__’ uses any keyword
     defaults.

   * Optional: All other *note function attributes: 1def.

     class Annotate:
         called_formats = []

         def __call__(self, format=None, /, *, _self=None):
             # When called with fake globals, `_self` will be the
             # actual self value, and `self` will be the format.
             if _self is not None:
                 self, format = _self, self

             self.called_formats.append(format)
             if format <= 2:  # VALUE or VALUE_WITH_FAKE_GLOBALS
                 return {"x": MyType}
             raise NotImplementedError

         __code__ = __call__.__code__
         __defaults__ = (None,)
         __kwdefaults__ = property(lambda self: dict(_self=self))

         __globals__ = {}
         __builtins__ = {}
         __closure__ = None

This can then be called with:

     >>> from annotationlib import call_annotate_function, Format
     >>> call_annotate_function(Annotate(), format=Format.STRING)
     {'x': 'MyType'}

Or used as the annotate function for an object:

     >>> from annotationlib import get_annotations, Format
     >>> class C:
     ...   pass
     >>> C.__annotate__ = Annotate()
     >>> get_annotations(Annotate(), format=Format.STRING)
     {'x': 'MyType'}


File: python.info,  Node: Limitations of the STRING format,  Next: Limitations of the FORWARDREF format,  Prev: レシピ<3>,  Up: annotationlib --- Functionality for introspecting annotations

5.30.15.7 Limitations of the ‘STRING’ format
............................................

The *note STRING: 161. 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: 1e0e.

   * *note ast.UnaryOp: 4e02.

        * *note ast.Invert: 4e03. (‘~’), *note ast.UAdd: 4e04. (‘+’),
          and *note ast.USub: 4e05. (‘-’) are supported

        * *note ast.Not: 4e06. (‘not’) is not supported

   * *note ast.Dict: 1da7. (except when using ‘**’ unpacking)

   * *note ast.Set: 4e07.

   * *note ast.Compare: 4e08.

        * *note ast.Eq: 4e09. and *note ast.NotEq: 4e0a. are supported

        * *note ast.Lt: 4e0b, *note ast.LtE: 4e0c, *note ast.Gt: 4e0d,
          and *note ast.GtE: 4e0e. are supported, but the operand may be
          flipped

        * *note ast.Is: 4e0f, *note ast.IsNot: 4e10, *note ast.In: 4e11,
          and *note ast.NotIn: 4e12. are not supported

   * *note ast.Call: 4e13. (except when using ‘**’ unpacking)

   * *note ast.Constant: 2f1. (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: 4e14. (assuming the value is not a constant)

   * *note ast.Subscript: 4e15. (assuming the value is not a constant)

   * *note ast.Starred: 4e16. (‘*’ unpacking)

   * *note ast.Name: 1d80.

   * *note ast.List: 4e17.

   * *note ast.Tuple: 4e18.

   * *note ast.Slice: 4e19.

The following are unsupported, but throw an informative error when
encountered by the stringifier:

   * *note ast.FormattedValue: 4e1a. (f-strings; error is not detected
     if conversion specifiers like ‘!r’ are used)

   * *note ast.JoinedStr: 1abd. (f-strings)

The following are unsupported and result in incorrect output:

   * *note ast.BoolOp: 4e1b. (‘and’ and ‘or’)

   * *note ast.IfExp: 4e1c.

   * *note ast.Lambda: 4e1d.

   * *note ast.ListComp: 4e1e.

   * *note ast.SetComp: 4e1f.

   * *note ast.DictComp: 4e20.

   * *note ast.GeneratorExp: 4e21.

The following are disallowed in annotation scopes and therefore not
relevant:

   * *note ast.NamedExpr: 4e22. (‘:=’)

   * *note ast.Await: 4e23.

   * *note ast.Yield: 4e24.

   * *note ast.YieldFrom: 4e25.


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.30.15.8 Limitations of the ‘FORWARDREF’ format
................................................

The *note FORWARDREF: 160. format aims to produce real values as much as
possible, with anything that cannot be resolved replaced with *note
ForwardRef: 17e8. objects.  It is affected by broadly the same
Limitations as the *note STRING: 161. format: annotations that perform
operations on literals or that use unsupported expression types may
raise exceptions when evaluated using the ‘FORWARDREF’ 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.30.15.9 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(): 457. may call an arbitrary *note annotate function:
15e, and *note ForwardRef.evaluate(): 1820. 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__: 456. attribute, and for various functions in the *note
typing: 10b. module that work with annotations, such as *note
typing.get_type_hints(): 8c1.

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: 17e8. object.


File: python.info,  Node: site --- サイト固有の設定フック,  Prev: annotationlib --- Functionality for introspecting annotations,  Up: Python ランタイムサービス

5.30.16 ‘site’ -- サイト固有の設定フック
----------------------------------------

'ソースコード:' Lib/site.py(1)

__________________________________________________________________

'このモジュールは初期化中に自動的にインポートされます。' 自動インポート
はインタプリタの *note -S: 13c4. オプションで禁止できます。

Importing this module normally appends site-specific paths to the module
search path and adds *note callables: 2644, including *note help(): ad8.
to the built-in namespace.  However, Python startup option *note -S:
13c4. 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(): 2182. function.

バージョン 3.3 で変更: 以前は *note -S: 13c4. を使っているときでも、モジ
ュールをインポートするとパス変更が起動されていました。

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: 17b0, and is
appended if ‘"t"’ is present in the *note sys.abiflags: c5d. 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: 1f6. 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: 3e5. and *note sys.exec_prefix: 3e9. on *note Virtual
Environments: 4c38.  This is now done during the *note path
initialization: 193e.  As a result, under *note Virtual Environments:
4c38, ‘sys.prefix’ and ‘sys.exec_prefix’ no longer depend on the ‘site’
initialization, and are therefore unaffected by *note -S: 13c4.

When running under a *note virtual environment: 4c38, the ‘pyvenv.cfg’
file in *note sys.prefix: 3e5. 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.

A path configuration file is a file whose name has the form ‘`name'.pth’
and exists in one of the four directories mentioned above; its contents
are additional items (one per line) to be added to ‘sys.path’.
Non-existing items are never added to ‘sys.path’, and no check is made
that the item refers to a directory rather than a file.  No item is
added to ‘sys.path’ more than once.  Blank lines and lines beginning
with ‘#’ are skipped.  Lines starting with ‘import’ (followed by space
or tab) are executed.

     注釈: An executable line in a ‘.pth’ file is run at every Python
     startup, regardless of whether a particular module is actually
     going to be used.  Its impact should thus be kept to a minimum.
     The primary intended purpose of executable lines is to make the
     corresponding module(s) importable (load 3rd-party import hooks,
     adjust ‘PATH’ etc).  Any other initialization is supposed to be
     done upon a module's actual import, if and when it happens.
     Limiting a code chunk to a single line is a deliberate measure to
     discourage putting anything more complex here.

バージョン 3.13 で変更: ‘.pth’ ファイルは、最初に UTF-8 で、失敗した場合
は *note locale encoding: 54a. でデコードされるようになります。

For example, suppose ‘sys.prefix’ and ‘sys.exec_prefix’ are set to
‘/usr/local’.  The Python X.Y library is then installed in
‘/usr/local/lib/python`X.Y'’.  Suppose this has a subdirectory
‘/usr/local/lib/python`X.Y'/site-packages’ with three subsubdirectories,
‘foo’, ‘bar’ and ‘spam’, and two path configuration files, ‘foo.pth’ and
‘bar.pth’.  Assume ‘foo.pth’ contains the following:

     # 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 の設定::
* モジュールの内容: モジュールの内容<6>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<11>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/site.py


File: python.info,  Node: sitecustomize,  Next: usercustomize,  Up: site --- サイト固有の設定フック

5.30.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: 17b4. 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.30.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: 4e2d. 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: 15aa.  If this import fails with
an *note ImportError: 65b. or its subclass exception, and the
exception's *note name: 17b4. 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: モジュールの内容<6>,  Prev: usercustomize,  Up: site --- サイト固有の設定フック

5.30.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: 441. and without the *note -S: 13c4. 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__: 11ce. attribute in your
*note sitecustomize: cd. or *note usercustomize: 115. module or your
*note PYTHONSTARTUP: 1ba. file.

バージョン 3.4 で変更: rlcompleter とhistory のアクティベーションが自動
で行われるようになりました。


File: python.info,  Node: モジュールの内容<6>,  Next: コマンドライン・インターフェース<11>,  Prev: readline の設定,  Up: site --- サイト固有の設定フック

5.30.16.4 モジュールの内容
..........................

 -- データ: site.PREFIXES

     siteパッケージディレクトリのprefixのリスト。

 -- データ: site.ENABLE_USER_SITE

     ユーザサイトディレクトリのステータスを示すフラグ。 ‘True’ の場合、
     ユーザサイトディレクトリが有効で ‘sys.path’ に追加されていることを
     意味しています。 ‘False’ の場合、ユーザによるリクエスト(オプション
     *note -s: 15aa. か *note PYTHONNOUSERSITE: 15ab.)によって、 ‘None’
     の場合セキュリティ上の理由(ユーザまたはグループIDと実効IDの間のミス
     マッチ)あるいは管理者によって、ユーザサイトディレクトリが無効になっ
     ていることを示しています。

 -- データ: site.USER_SITE

     Path to the user site-packages for the running Python.  Can be
     ‘None’ if *note getusersitepackages(): 145c. 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(): 145b. がまだ呼び出されていなければ ‘None’ かも
     しれません。デフォルト値は UNIX と frameworkなしの macOS ビルドでは
     ‘~/.local’ 、macOS framework ビルドでは ‘~/Library/Python/`X.Y'’ 、
     Windows では ‘`%APPDATA%'\Python’ です。この値は、スクリプト、デー
     タファイル、Python モジュールなどのインストール先のディレクトリを
     *note ユーザーインストールスキーム: 2192. で計算するのに使われます
     。 *note PYTHONUSERBASE: 15a9. も参照してください。

 -- の関数: site.main ()

     モジュール検索パスに標準のサイト固有ディレクトリを追加します。この
     関数は、Python インタプリタが *note -S: 13c4. で開始されていない限
     り、このモジュールインポート時に自動的に呼び出されます。

     バージョン 3.3 で変更: この関数は以前は無条件に呼び出されていました
     。

 -- の関数: site.addsitedir (sitedir, known_paths=None)

     Add a directory to sys.path and process its ‘.pth’ files.
     Typically used in *note sitecustomize: cd. or *note usercustomize:
     115. (see above).

 -- の関数: site.getsitepackages ()

     全てのグローバルな site-packages ディレクトリのリストを返します。

     Added in version 3.2.

 -- の関数: site.getuserbase ()

     ユーザのベースディレクトリへのパス *note USER_BASE: 1538. を返しま
     す。未初期化であればこの関数は *note PYTHONUSERBASE: 15a9. を参考に
     して、設定もします。

     Added in version 3.2.

 -- の関数: site.getusersitepackages ()

     ユーザ固有の site パッケージのディレクトリへのパス *note USER_SITE:
     2181. を返します。未初期化であればこの関数は *note USER_BASE: 1538.
     を参考にして、設定もします。 ユーザ固有の site パッケージが
     ‘sys.path’ に追加されたかどうかを確認するには *note
     ENABLE_USER_SITE: 4e2d. を使ってください。

     Added in version 3.2.


File: python.info,  Node: コマンドライン・インターフェース<11>,  Prev: モジュールの内容<6>,  Up: site --- サイト固有の設定フック

5.30.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: 3e2. の中身を表示し、続けて
*note USER_BASE: 1538. とそのディレクトリが存在するかどうか、 *note
USER_SITE: 2181. とそのディレクトリが存在するかどうか、最後に *note
ENABLE_USER_SITE: 4e2d. の値を、標準出力に出力します。

 -- Option: --user-base

     ユーザのベースディレクトリを表示します。

 -- Option: --user-site

     ユーザの site-packages ディレクトリを表示します。

両方のオプションが指定された場合、ユーザのベースとユーザの site が(常に
この順序で) *note os.pathsep: 218f. 区切りで表示されます。

いずれかのオプションが与えられた場合に、このスクリプトは次のいずれかの終
了コードで終了します: ユーザの site-packages が有効ならば ‘0’ 、ユーザに
より無効にされていれば ‘1’ 、セキュリティ的な理由あるいは管理者によって
無効にされている場合 ‘2’ 、そして何かエラーがあった場合は 2 より大きな値
。

参考
....

   * PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

   * *note sys.path モジュール検索パスの初期化: 193e. - *note sys.path:
     3e2.  の初期化。

参考
....

   * 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.31 カスタム 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.31.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: 19a3. を継承しており、
     よく知られた ‘sys.ps1’ と ‘sys.ps2’ を使用してプロンプトと入力バッ
     ファリングを追加します。 'local_exit' が真の場合、コンソールでの
     ‘exit()’ と ‘quit()’ は *note SystemExit: f40. を送出せず、代わりに
     呼び出し元のコードに戻ります。

     バージョン 3.13 で変更: 'local_exit' 引数が追加されました。

 -- の関数: code.interact (banner=None, readfunc=None, local=None,
          exitmsg=None, local_exit=False)

     read-eval-print ループを実行するための便利な関数。これは *note
     InteractiveConsole: 287e. の新しいインスタンスを作り、 'readfunc' が
     与えられた場合は *note InteractiveConsole.raw_input(): 4e3b. メソッ
     ドとして使われるように設定します。 'local' が与えられた場合は、イン
     タープリターループのデフォルト名前空間として使うために
     ‘InteractiveConsole’ コンストラクタへ渡されます。 'local_exit' が与
     えられた場合は、 ‘InteractiveConsole’ コンストラクタへ渡されます。
     そして、インスタンスの *note interact(): 4e3c. メソッドは、もし提供
     されていれば、見出しと終了メッセージして使うために '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: 18f. を発生させます。または、コマンドが無効な
     リテラルを含む場合は、 *note OverflowError: a85. もしくは *note
     ValueError: 2ee. を発生させます。

* Menu:

* 対話的なインタプリタオブジェクト::
* 対話的なコンソールオブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/code.py


File: python.info,  Node: 対話的なインタプリタオブジェクト,  Next: 対話的なコンソールオブジェクト,  Up: code --- インタープリター基底クラス

5.31.1.1 対話的なインタプリタオブジェクト
.........................................

 -- メソッド: InteractiveInterpreter.runsource (source,
          filename='<input>', symbol='single')

     インタプリタ内のあるソースをコンパイルし実行します。引数は *note
     compile_command(): 4e3d. のものと同じです。 'filename' のデフォルト
     は ‘'<input>'’ で、 'symbol' は ‘'single'’ です。あるいくつかのこと
     が起きる可能性があります:

        * 入力が不正。 *note compile_command(): 4e3d. が例外(*note
          SyntaxError: 18f. か *note OverflowError: a85.)を起こした場合
          。 *note showsyntaxerror(): 4e41. メソッドの呼び出によって、構
          文トレースバックが表示されるでしょう。 *note runsource():
          4e40. は ‘False’ を返します。

        * 入力が完全でなく、さらに入力が必要。 *note compile_command():
          4e3d. が ‘None’ を返した場合。 *note runsource(): 4e40. は
          ‘True’ を返します。

        * 入力が完全。 *note compile_command(): 4e3d. がコードオブジェク
          トを返した場合。 (*note SystemExit: f40. を除く実行時例外も処
          理する) *note runcode(): 4e42. を呼び出すことによって、コード
          は実行されます。 *note runsource(): 4e40. は ‘False’ を返しま
          す。

     戻り値は、次の行のプロンプトに ‘sys.ps1’ か ‘sys.ps2’ のどちらを使
     うのか判断するために使えます。

 -- メソッド: InteractiveInterpreter.runcode (code)

     コードオブジェクトを実行します。例外が生じたときは、トレースバック
     を表示するために *note showtraceback(): fd2. が呼び出されます。伝搬
     することが許されている *note SystemExit: f40. を除くすべての例外が
     捉えられます。

     *note KeyboardInterrupt: bc9. についての注意。このコードの他の場所
     でこの例外が生じる可能性がありますし、常に捕らえることができるとは
     限りません。呼び出し側はそれを処理するために準備しておくべきです。

 -- メソッド: InteractiveInterpreter.showsyntaxerror (filename=None)

     起きたばかりの構文エラーを表示します。複数の構文エラーに対して一つ
     あるのではないため、これはスタックトレースを表示しません。
     'filename' が与えられた場合は、Pythonのパーサが与えるデフォルトのフ
     ァイル名の代わりに例外の中へ入れられます。なぜなら、文字列から読み
     込んでいるときはパーサは常に ‘'<string>'’ を使うからです。出力は
     *note write(): 4e43. メソッドによって書き込まれます。

 -- メソッド: InteractiveInterpreter.showtraceback ()

     起きたばかりの例外を表示します。スタックの最初の項目を取り除きます
     。なぜなら、それはインタプリタオブジェクトの実装の内部にあるからで
     す。出力は *note write(): 4e43. メソッドによって書き込まれます。

     バージョン 3.5 で変更: 最初のトレースバックではなく、完全なトレース
     バックの連鎖が表示されます。

 -- メソッド: InteractiveInterpreter.write (data)

     文字列を標準エラーストリーム(‘sys.stderr’)へ書き込みます。必要に応
     じて適切な出力処理を提供するために、派生クラスはこれをオーバーライ
     ドすべきです。


File: python.info,  Node: 対話的なコンソールオブジェクト,  Prev: 対話的なインタプリタオブジェクト,  Up: code --- インタープリター基底クラス

5.31.1.2 対話的なコンソールオブジェクト
.......................................

*note InteractiveConsole: 287e. クラスは *note InteractiveInterpreter:
19a3. のサブクラスです。以下の追加メソッドだけでなく、インタプリタオブジ
ェクトのすべてのメソッドも提供します。

 -- メソッド: InteractiveConsole.interact (banner=None, exitmsg=None)

     対話的な Python コンソールをそっくりにエミュレートします。オプショ
     ンの 'banner' 引数は最初のやりとりの前に表示するバナーを指定します
     。デフォルトでは、標準 Python インタプリタが表示するものと同じよう
     なバナーを表示します。それに続けて、実際のインタプリタと混乱しない
     ように (とても似ているから!)  括弧の中にコンソールオブジェクトのク
     ラス名を表示します。

     オプション引数の 'exitmsg' は、終了時に出力される終了メッセージを指
     定します。空文字列を渡すと、出力メッセージを抑止します。もし、
     'exitmsg' が与えられないか、‘None’ の場合は、デフォルトのメッセージ
     が出力されます。

     バージョン 3.4 で変更: バナーの表示を抑制するには、空の文字列を渡し
     てください。

     バージョン 3.6 で変更: 終了時に、終了メッセージを表示します。

 -- メソッド: InteractiveConsole.push (line)

     ソーステキストの一行をインタープリターへ送ります。その行の末尾に改
     行がついていてはいけません。内部に改行を持っているかもしれません。
     その行はバッファへ追加され、ソースとして連結されたバッファの内容が
     渡されインタープリターの *note runsource(): 4e40. メソッドが呼び出
     されます。コマンドが実行されたか、有効であることをこれが示している
     場合は、バッファはリセットされます。そうでなければ、コマンドが不完
     全で、その行が付加された後のままバッファは残されます。さらに入力が
     必要ならば、戻り値は ‘True’ です。その行がある方法で処理されたなら
     ば、 ‘False’ です(これは ‘runsource()’ と同じです)。

 -- メソッド: InteractiveConsole.resetbuffer ()

     入力バッファから処理されていないソーステキストを取り除きます。

 -- メソッド: InteractiveConsole.raw_input (prompt='')

     プロンプトを書き込み、一行を読み込みます。返る行は末尾に改行を含み
     ません。ユーザがEOFキーシーケンスを入力したときは、 *note EOFError:
     14f5. を発生させます。基本実装では、 ‘sys.stdin’ から読み込みます。
     サブクラスはこれを異なる実装と置き換えるかもしれません。


File: python.info,  Node: codeop --- Python コードをコンパイルする,  Prev: code --- インタープリター基底クラス,  Up: カスタム Python インタプリタ

5.31.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 ‘code’ 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: 18f. を発生させます。また、無効なリ
     テラルがある場合は、 *note OverflowError: a85. または *note
     ValueError: 2ee. を発生させます。

     'symbol' 引数は 'source' が文としてコンパイルされるか(‘'single'’ 、
     デフォルト) 、*note 文: 2c78. のシーケンスとしてか (‘'exec'’) 、ま
     たは *note 式: 242f. としてコンパイルされるかを決定します
     (‘'eval'’)。他のどんな値も *note ValueError: 2ee. を送出させます。

          注釈: ソースの終わりに達する前に、成功した結果をもってパーサは
          構文解析を止めることがあります。このような場合、後ろに続く記号
          はエラーとならずに無視されます。例えば、バックスラッシュの後ろ
          に改行が2つあって、その後ろにゴミがあるかもしれません。パーサ
          のAPIがより良くなればすぐに、この挙動は修正されるでしょう。

 -- クラス: codeop.Compile

     このクラスのインスタンスは組み込み関数 *note compile(): 4b1. とシグ
     ネチャが一致する *note __call__(): 77a. メソッドを持っていますが、
     インスタンスが *note __future__: 0. 文を含むプログラムテキストをコ
     ンパイルする場合は、インスタンスは有効なその文とともに続くすべての
     プログラムテキストを'覚えていて'コンパイルするという違いがあります
     。

 -- クラス: codeop.CommandCompiler

     このクラスのインスタンスは *note compile_command(): 1bb2. とシグネ
     チャが一致する *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.32 モジュールのインポート
===========================

この章で解説されるモジュールは他の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.32.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: 3e2. items
that are paths to ZIP archives.

普通、 *note sys.path: 3e2. はディレクトリ名の文字列からなるリストです。
このモジュールを使うと、 ‘sys.path’ の要素に 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. のサブクラスなので、 ‘ImportError’ としても捕捉できます。

* 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.32.1.1 zipimporter オブジェクト
.................................

*note zipimporter: 4e56. は ZIP ファイルを import するためのクラスです。

 -- クラス: zipimport.zipimporter (archivepath)

     新たな zipimporter インスタンスを生成します。 'archivepath' は ZIP
     ファイルへのパスまたは ZIP ファイル中の特定のパスへのパスでなければ
     なりません。たとえば、 ‘foo/bar.zip/lib’ という 'archivepath' の場
     合、 ‘foo/bar.zip’ という ZIP ファイルの中の ‘lib’ ディレクトリにあ
     るモジュールを (存在するものとして) 検索します。

     'archivepath' が有効な ZIP アーカイブを指していない場合、 *note
     ZipImportError: 4e53. を送出します。

     バージョン 3.12 で変更: Methods ‘find_loader()’ and
     ‘find_module()’, deprecated in 3.10 are now removed.  Use *note
     find_spec(): a62. instead.

      -- メソッド: create_module (spec)

          Implementation of *note importlib.abc.Loader.create_module():
          eb0. that returns *note None: 886. to explicitly request the
          default semantics.

          Added in version 3.10.

      -- メソッド: exec_module (module)

          *note importlib.abc.Loader.exec_module(): a6e. の実装です。

          Added in version 3.10.

      -- メソッド: find_spec (fullname, target=None)

          *note importlib.abc.PathEntryFinder.find_spec(): a70. の実装で
          す。

          Added in version 3.10.

      -- メソッド: get_code (fullname)

          'fullname' に指定したモジュールのコードオブジェクトを返します
          。モジュールがインポートできなかった場合には *note
          ZipImportError: 4e53. を送出します。

      -- メソッド: get_data (pathname)

          'pathname' に関連付けられたデータを返します。該当するファイル
          が見つからなかった場合には *note OSError: 2c2. を送出します。

          バージョン 3.3 で変更: 以前は *note IOError: 1262. が送出され
          ました; それは現在 *note OSError: 2c2. のエイリアスです。

      -- メソッド: get_filename (fullname)

          指定されたモジュールが import された場合、そのモジュールに設定
          した ‘__file__’ の値を返します。モジュールがインポートできなか
          った場合、 *note ZipImportError: 4e53. を送出します。

          Added in version 3.1.

      -- メソッド: get_source (fullname)

          'fullname' で指定されたモジュールのソースコードを返します。モ
          ジュールが見つからない場合、*note ZipImportError: 4e53. を送出
          します。アーカイブにはモジュールがあるもののソースコードがない
          場合、 *note None: 886. を返します。

      -- メソッド: is_package (fullname)

          'fullname' で指定されたモジュールがパッケージの場合 ‘True’ を
          返します。モジュールを見つけられない場合 *note ZipImportError:
          4e53. を送出します。

      -- メソッド: 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: 4e53.
          on failure.

          バージョン 3.10 で非推奨、バージョン 3.15 で削除予定: Use
          *note exec_module(): 337. instead.

      -- メソッド: 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: 4e5c. と *note prefix: 4e5d.
     属性は *note zipimporter: 4e56. コンストラクタに渡された元々の
     'archivepath' 引数と等しくなります。


File: python.info,  Node: 使用例<47>,  Prev: zipimporter オブジェクト,  Up: zipimport --- Zip アーカイブからモジュールをインポートする

5.32.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.32.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: 3e2. that has a subdirectory
     that matches the package name, add the subdirectory to the
     package's *note __path__: 20b0.  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: 3e2. はシーケンスであることが前提になっています。
     ‘sys.path’ の要素の内、実在するディレクトリを指す文字列となっていな
     いものは無視されます。ファイル名として使ったときにエラーが発生する
     ‘sys.path’ の Unicode要素がある場合、この関数(*note
     os.path.isdir(): c09. を実行している行) で例外が発生する可能性があ
     ります。

 -- の関数: pkgutil.get_importer (path_item)

     指定された 'path_item' に対する *note finder: 23c6. を取得します。

     path hook により新しい finder が作成された場合は、それは *note
     sys.path_importer_cache: 7fa. にキャッシュされます。

     キャッシュ (やその一部) は、 *note sys.path_hooks: 1229. のリスキャ
     ンが必要になった場合は手動でクリアすることができます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(2) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.iter_importers (fullname='')

     Yield *note finder: 23c6. 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: f2b. and
     *note sys.path_hooks: 1229.).

     その名前のついたモジュールがパッケージ内に含まれている場合、この関
     数を実行した副作用としてそのパッケージが import されます。

     モジュール名が指定されない場合は全てのトップレベルの finder が生成
     されます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(3) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.iter_modules (path=None, prefix='')

     'path' を指定すればそのすべてのサブモジュールに対して、 'path' が
     ‘None’ なら *note sys.path: 3e2. のすべてのトップレベルモジュールに
     対して、*note ModuleInfo: f4c. を yield します。

     'path' は ‘None’ か、モジュールを検索する path のリストのどちらかで
     なければなりません。

     'prefix' は出力の全てのモジュール名の頭に出力する文字列です。

          注釈: これは ‘iter_modules()’ メソッドを定義している *note
          finder: 23c6. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          1282. と *note zipimport.zipimporter: 4e56. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(4) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.walk_packages (path=None, prefix='', onerror=None)

     'path' を指定すれば再帰的にその中のモジュールすべてに対して、
     'path' が ‘None’ ならばアクセスできるすべてのモジュールに対して、
     *note ModuleInfo: f4c. を 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: 23c6. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          1282. と *note zipimport.zipimporter: 4e56. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(5) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.get_data (package, resource)

     パッケージからリソースを取得します。

     This is a wrapper for the *note loader: 1a8a. *note get_data: 4e65.
     API. The 'package' argument should be the name of a package, in
     standard module format (‘foo.bar’).  The 'resource' argument should
     be in the form of a relative filename, using ‘/’ as the path
     separator.

     この関数が返すのは指定されたリソースの内容であるバイナリ文字列です
     。

     This function uses the *note loader: 1a8a. method *note get_data():
     4e66. to support modules installed in the filesystem, but also in
     zip files, databases, or elsewhere.

     ファイルシステム中に位置するパッケージで既にインポートされているも
     のに対しては、次と大体同じです:

          d = os.path.dirname(sys.modules[package].__file__)
          data = open(os.path.join(d, resource), 'rb').read()

     Like the *note open(): 318. function, ‘get_data()’ can follow
     parent directories (‘../’) and absolute paths (starting with ‘/’ or
     ‘C:/’, for example).  It can open compilation/installation
     artifacts like ‘.py’ and ‘.pyc’ files or files with *note reserved
     filenames: 329.  To be compatible with non-filesystem loaders,
     avoid using these features.

          警告: This function is intended for trusted input.  It does
          not verify that 'resource' "belongs" to 'package'.

     If you use a user-provided 'resource' path, consider verifying it.
     For example, require an alphanumeric filename with a known
     extension, or install and check a list of known resources.

     If the package cannot be located or loaded, or it uses a *note
     loader: 1a8a. which does not support *note get_data: 4e65, then
     ‘None’ is returned.  In particular, the loader for *note namespace
     packages: 2b4. does not support ‘get_data’.

     参考
     ....

     The *note importlib.resources: 7f. module provides structured
     access to module resources.

 -- の関数: 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: 2ee. - 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.32.3 ‘modulefinder’ -- スクリプト中で使用されているモジュールの検索
---------------------------------------------------------------------

'ソースコード:' Lib/modulefinder.py(1)

__________________________________________________________________

このモジュールでは、スクリプト中で import されているモジュールセットを調
べるために使える *note ModuleFinder: 1e41. クラスを提供しています。
‘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(): 4e6d. および *note report():
     4e6e. メソッドを提供しています。これらのメソッドは何らかのスクリプ
     ト中で import されているモジュールの集合を調べます。 'path' はモジ
     ュールを検索する先のディレクトリ名からなるリストです。 'path' を指
     定しない場合、 ‘sys.path’ を使います。 'debug' にはデバッグレベルを
     設定します; 値を大きくすると、実行している内容を表すデバッグメッセ
     ージを出力します。 'excludes' は検索から除外するモジュール名です。
     'replace_paths' には、モジュールパス内で置き換えられるパスをタプル
     ‘(oldpath, newpath)’ からなるリストで指定します。

      -- メソッド: report ()

          スクリプトで import しているモジュールと、そのパスからなるリス
          トを列挙したレポートを標準出力に出力します。モジュールを見つけ
          られなかったり、モジュールがないように見える場合にも報告します
          。

      -- メソッド: run_script (pathname)

          'pathname' に指定したファイルの内容を解析します。ファイルには
          Python コードが入っていなければなりません。

      -- の属性: modules

          モジュール名をモジュールに結びつける辞書。 *note ModuleFinder
          の使用例: 4e70. を参照して下さい。

* Menu:

* ModuleFinder の使用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/modulefinder.py


File: python.info,  Node: ModuleFinder の使用例,  Up: modulefinder --- スクリプト中で使用されているモジュールの検索

5.32.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.32.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: 23e.
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 ‘run_module()’.

     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' が:const:‘None’ でない場合は 'run_name'
     に設定されます。 'run_name' が *note None: 886. である場合、
     'mod_name' がパッケージであれば''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: 23bd. based on the module spec.

     引数 'alter_sys' が与えられて *note True: e0b. に評価されるならば、
     ‘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: 23e. オプションを与えることで同じ機
     能を実現出来ます。

     バージョン 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: 22c8. 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: 3e2. 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: 3e2. 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 ‘run_path()’.

     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: 886. でない
     場合は 'run_name' に設定されます。 'run_name' が ‘None’ の場合は
     ‘'<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: 886.

     If 'file_path' is a reference to a valid *note sys.path: 3e2.
     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: 23bd. based on the
     module spec.

     A number of alterations are also made to the *note sys: df. module.
     Firstly, *note sys.path: 3e2. 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 ‘sys’
     are reverted before the function returns.

     Note that, unlike *note run_module(): 17b3, 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: 3e2. 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 インターフェイスオプション: 2176. で同じ機
     能を使えます (‘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: 3e2. 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 コマンドラインと環境: 1e04. - 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.32.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.32.5.1 はじめに
.................

The purpose of the ‘importlib’ package is three-fold.

1つ目は Python ソースコード中にある *note import: 7f8. 文の(そして、拡張
として、 *note __import__(): ad5. 関数の)実装を提供することです。このパ
ッケージは ‘import’ 文の、どの Python インタープリターでも動作する実装を
提供します。また、 Python 以外の言語で実装されたどの実装よりも把握しやす
い実装を提供します。

2つ目の目的は、このパッケージが公開している *note import: 7f8. を実装す
るための要素を利用して、(*note インポーター: 24a8. として知られる) イン
ポートプロセスで動作するカスタムのオブジェクトを実装しやすくすることです
。

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: 1791. で ‘None’ に基づくリダイレ
     クト)。

*note __import__(): 127d. 関数

     *note import: 7f8. 文はこの関数のシンタックスシュガーです。

*note sys.path モジュール検索パスの初期化: 193e.

     The initialization of *note sys.path: 3e2.

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.32.5.2 関数
.............

 -- の関数: importlib.__import__ (name, globals=None, locals=None,
          fromlist=(), level=0)

     組み込みの *note __import__(): ad5. 関数の実装です。

          注釈: プログラムからモジュールをインポートする場合はこの関数の
          代わりに *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__():
     127d. を単純化するラッパーとして働きます。つまり、この関数のすべて
     の意味は ‘importlib.__import__()’ から受け継いでいます。これらの2つ
     の関数の最も重要な違いは、 ‘import_module()’ が指定されたパッケージ
     やモジュール (例えば ‘pkg.mod’) を返すのに対し、 *note
     __import__(): ad5. はトップレベルのパッケージやモジュール (例えば
     ‘pkg’) を返すことです。

     もしモジュールを動的にインポートしていて、インタープリタの実行開始
     後にモジュールが作成された (例えば、 Python ソースファイルを作成し
     た) 場合、インポートシステムが新しいモジュールを見つけられるように
     、 *note invalidate_caches(): e0e. を呼ぶ必要があるでしょう。

     バージョン 3.3 で変更: 親パッケージは自動的にインポートされます。

 -- の関数: importlib.invalidate_caches ()

     *note sys.meta_path: f2b. に保存されたファインダーの内部キャッシュ
     を無効にします。ファインダーが ‘invalidate_caches()’ を実装していれ
     ば、無効化を行うためにそれが呼び出されます。すべてのファインダーが
     新しいモジュールの存在に気づくことを保証しているプログラムの実行中
     に、モジュールが作成またはインストールされたなら、この関数が呼び出
     されるべきです。

     Added in version 3.3.

     バージョン 3.10 で変更: Namespace packages created/installed in a
     different *note sys.path: 3e2. location after the same namespace
     was already imported are noticed.

 -- の関数: importlib.reload (module)

     以前にインポートされた 'module' をリロードします。引数はモジュール
     オブジェクトでなければならず、したがってそれ以前に必ずインポートに
     成功していなければなりません。この関数は、モジュールのソースファイ
     ルを外部エディタで編集していて Python インタープリタから離れること
     なく新しいバージョンを試したい際に便利です。戻り値はモジュールオブ
     ジェクトです。 (もし再インポートが異なるオブジェクトを *note
     sys.modules: 1791. に配置したら、元の 'module' とは異なるかもしれま
     せん。)

     *note reload(): 73d. が実行された場合:

        * Python モジュールのコードは再コンパイルされ、モジュールレベル
          のコードが再度実行されます。モジュールの辞書中にある何らかの名
          前に結び付けられたオブジェクトは、そのモジュールを最初にロード
          したときの *note ローダー: 1a8a. を再利用して新たに定義されま
          す。拡張モジュールの ‘init’ 関数が二度呼び出されることはありま
          せん。

        * Python における他のオブジェクトと同様、以前のオブジェクトのメ
          モリ領域は、参照カウントがゼロにならないかぎり再利用されません
          。

        * モジュール名前空間内の名前は新しいオブジェクト (または更新され
          たオブジェクト) を指すよう更新されます。

        * 以前のオブジェクトが (外部の他のモジュールなどからの) 参照を受
          けている場合、それらを新たなオブジェクトに再束縛し直すことはな
          いので、必要なら自分で名前空間を更新しなければなりません。

     いくつか補足説明があります:

     モジュールが再ロードされた際、その辞書 (モジュールのグローバル変数
     を含みます) はそのまま残ります。名前の再定義を行うと、以前の定義を
     上書きするので、一般的には問題はありません。新たなバージョンのモジ
     ュールが古いバージョンで定義された名前を定義していない場合、古い定
     義がそのまま残ります。辞書がグローバルテーブルやオブジェクトのキャ
     ッシュを維持していれば、この機能をモジュールを有効性を引き出すため
     に使うことができます -- つまり、 *note try: 8f9. 文を使えば、必要に
     応じてテーブルがあるかどうかをテストし、その初期化を飛ばすことがで
     きます:

          try:
              cache
          except NameError:
              cache = {}

     組み込みモジュールや動的にロードされるモジュールを再ロードすること
     は、一般的にそれほど便利ではありません。 *note sys: df, *note
     __main__: 1, *note builtins: 13. やその他重要なモジュールの再ロード
     はお勧め出来ません。多くの場合、拡張モジュールは 1 度以上初期化され
     るようには設計されておらず、再ロードされた場合には何らかの理由で失
     敗するかもしれません。

     一方のモジュールが *note from: 14c7. ...  *note import: 7f8. ...  を
     使って、オブジェクトを他方のモジュールからインポートしているなら、
     他方のモジュールを *note reload(): 73d. で呼び出しても、そのモジュ
     ールからインポートされたオブジェクトを再定義することはできません --
     この問題を回避する一つの方法は、 ‘from’ 文を再度実行することで、も
     う一つの方法は ‘from’ 文の代わりに ‘import’ と限定的な名前
     ('module.name') を使うことです。

     あるモジュールがクラスのインスタンスを生成している場合、そのクラス
     を定義しているモジュールの再ロードはそれらインスタンスのメソッド定
     義に影響しません -- それらは古いクラス定義を使い続けます。これは派
     生クラスの場合でも同じです。

     Added in version 3.4.

     バージョン 3.7 で変更: リロードされたモジュールの *note ModuleSpec:
     22c8. が欠けていたときは *note ModuleNotFoundError: d41. が送出され
     ます。

          警告: 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: 1a54. 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.32.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: 1280. を表す抽象基底クラスです。

     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: 23bf. 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__: 20b0.
          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(): a71.
          may be useful for implementing concrete ‘MetaPathFinders’.

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。 *note sys.meta_path: f2b. 上のすべ
          てのファインダーのキャッシュを無効化する際、 *note
          importlib.invalidate_caches(): e0e. によって使われます。

          バージョン 3.4 で変更: Returns ‘None’ when called instead of
          *note NotImplemented: 1a3.

 -- クラス: importlib.abc.PathEntryFinder

     *note path entry finder: 1281. を表す抽象基底クラスです。 *note
     MetaPathFinder: a72. と似ているところがありますが、
     ‘PathEntryFinder’ は *note importlib.machinery.PathFinder: 1228. が
     提供するパスに基づく import サブシステムの中でのみ使うことが意図さ
     れています。

     Added in version 3.3.

     バージョン 3.10 で変更: No longer a subclass of ‘Finder’.

      -- メソッド: find_spec (fullname, target=None)

          指定されたモジュールに対応する *note スペック: 23bf. を検索す
          る抽象メソッド。ファインダーは、割り当てられている *note
          パス・エントリー: 24b8. 内のモジュールだけを検索します。スペッ
          クが見つからなければ ‘None’ が返されます。 ‘target’ は、渡され
          てきたならモジュールオブジェクトです。これはファインダーがどの
          ようなスペックを返せばよいか推測するために使用します。具体的な
          ‘PathEntryFinders’ を実装するためには *note
          importlib.util.spec_from_loader(): a71. が便利かもしれません。

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。キャッシュされたすべてのファインダー
          の無効化する際、 *note
          importlib.machinery.PathFinder.invalidate_caches(): e0d. によ
          って使われます。

 -- クラス: importlib.abc.Loader

     *note loader: 1a8a. の抽象基底クラスです。ローダーの厳密な定義は
     PEP 302(2) を参照してください。

     リソースの読み出しをサポートさせたいローダーには、 *note
     importlib.resources.abc.ResourceReader: 4e7d. で指定されている
     ‘get_resource_reader()’ メソッドを実装してください。

     バージョン 3.7 で変更: オプションの ‘get_resource_reader()’ メソッ
     ドが導入されました。

      -- メソッド: create_module (spec)

          モジュールをインポートする際に使用されるモジュールオブジェクト
          を返すメソッド。このメソッドは ‘None’ を戻すことができ、その場
          合はデフォルトのモジュール作成のセマンティクスが適用されること
          を示します。

          Added in version 3.4.

          バージョン 3.6 で変更: *note exec_module(): a6e. が定義されて
          いる場合は、このメソッドはオプションではなくなりました。

      -- メソッド: exec_module (module)

          モジュールがインポートまたはリロードされる際に、そのモジュール
          をモジュール自身の名前空間の中で実行する抽象的なメソッド。
          *note exec_module(): a6e. が呼ばれる時点で、モジュールはすでに
          初期設定されている必要があります。 このメソッドが存在するとき
          は、 *note create_module(): eb0. の定義が必須です。

          Added in version 3.4.

          バージョン 3.6 で変更: *note create_module(): eb0. の定義が必
          須となりました。

      -- メソッド: load_module (fullname)

          A legacy method for loading a module.  If the module cannot be
          loaded, *note ImportError: 65b. is raised, otherwise the
          loaded module is returned.

          If the requested module already exists in *note sys.modules:
          1791, that module should be used and reloaded.  Otherwise the
          loader should create a new module and insert it into
          ‘sys.modules’ 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 ‘sys.modules’;
          modules already in ‘sys.modules’ before the loader began
          execution should be left alone.

          The loader should set several attributes on the module (note
          that some of these attributes can change when a module is
          reloaded):

             - *note module.__name__: 15a7.

             - *note module.__file__: 23c5.

             - *note module.__cached__: 323. '(deprecated)'

             - *note module.__path__: 20b0.

             - *note module.__package__: 325. '(deprecated)'

             - *note module.__loader__: 339. '(deprecated)'

          When *note exec_module(): a6e. is available then
          backwards-compatible functionality is provided.

          バージョン 3.4 で変更: Raise *note ImportError: 65b. when
          called instead of *note NotImplementedError: 369.
          Functionality provided when *note exec_module(): a6e. is
          available.

          バージョン 3.4 で非推奨、バージョン 3.15 で削除予定: The
          recommended API for loading a module is *note exec_module():
          a6e. (and *note create_module(): eb0.).  Loaders should
          implement it instead of ‘load_module()’.  The import machinery
          takes care of all the other responsibilities of
          ‘load_module()’ when ‘exec_module()’ is implemented.

 -- クラス: importlib.abc.ResourceLoader

     'TraversableResources に取って代わられました'

          *note loader: 1a8a. の抽象基底クラスで、ストレージバックエンド
          から任意のリソースをロードするオプションの PEP 302(3) プロトコ
          ルを実装します。

          バージョン 3.7 で非推奨: This ABC is deprecated in favour of
          supporting resource loading through *note
          importlib.resources.abc.TraversableResources: 2fb.  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: 2c2. is
                    to be raised if the 'path' cannot be found.  The
                    'path' is expected to be constructed using a
                    module's *note __file__: 23c5. attribute or an item
                    from a package's *note __path__: 20b0.

                    バージョン 3.4 で変更: *note NotImplementedError:
                    369. の代わりに *note OSError: 2c2. を送出します。

 -- クラス: importlib.abc.InspectLoader

     *note loader: 1a8a. の抽象基底クラスで、ローダーがモジュールを検査
     するためのオプションの PEP 302(4) プロトコルを実装します。

      -- メソッド: get_code (fullname)

          モジュールの *note code: 1b. オブジェクトを返すか、 (例えば組
          み込みモジュールの場合に) モジュールがコードオブジェクトを持た
          なければ ‘None’ を返します。要求されたモジュールをローダーが見
          つけられなかった場合は *note ImportError: 65b. を送出します。

               注釈: このメソッドにはデフォルト実装がありますが、とはい
               えパフォーマンスのために、可能ならばオーバライドしたほう
               が良いです。

          バージョン 3.4 で変更: このメソッドはもはや抽象メソッドではな
          く、具象実装が提供されます。

      -- メソッド: abstractmethod get_source (fullname)

               モジュールのソースを返す抽象メソッドです。これは認識され
               たすべての行セパレータを ‘'\n'’ 文字に変換し、 *note
               universal newlines: f39. を使ったテキスト文字列として返さ
               れます。利用できるソースがなければ (例えば組み込みモジュ
               ール)、 ‘None’ を返します。指定されたモジュールが見つから
               なければ、 *note ImportError: 65b. を送出します。

               バージョン 3.4 で変更: *note NotImplementedError: 369. の
               代わりに *note ImportError: 65b. を送出します。

      -- メソッド: is_package (fullname)

          モジュールがパッケージであれば True を返し、そうでなければ
          False を返すオプションのメソッドです。 *note ローダー: 1a8a. が
          モジュールを見つけられなかったなら *note ImportError: 65b. が
          送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 369. の代わ
          りに *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(): a6e. の実装です。

          Added in version 3.4.

      -- メソッド: load_module (fullname)

          Implementation of *note Loader.load_module(): a6d.

          バージョン 3.4 で非推奨、バージョン 3.15 で削除予定: use *note
          exec_module(): 1218. instead.

 -- クラス: importlib.abc.ExecutionLoader

     *note InspectLoader: 115a. から継承された抽象基底クラスで、実装され
     ていれば、モジュールをスクリプトとして実行する助けになります。この
     抽象基底クラスはオプションの PEP 302(5) プロトコルを表します。

      -- メソッド: abstractmethod get_filename (fullname)

               An abstract method that is to return the value of *note
               __file__: 23c5. for the specified module.  If no path is
               available, *note ImportError: 65b. is raised.

               ソースコードが利用できるなら、そのモジュールのロードにバ
               イトコードが使われたかにかかわらず、このメソッドはそのソ
               ースファイルへのパスを返す必要があります。

               バージョン 3.4 で変更: *note NotImplementedError: 369. の
               代わりに *note ImportError: 65b. を送出します。

 -- クラス: importlib.abc.FileLoader (fullname, path)

     *note ResourceLoader: de6. と *note ExecutionLoader: 4e80. から継承
     された抽象基底クラスで、 *note ResourceLoader.get_data(): 4e65. お
     よび *note ExecutionLoader.get_filename(): 4e81. の具象実装を提供し
     ます。

     'fullname' 引数は、ローダーが解決しようとするモジュールの、完全に解
     決された名前です。'path' 引数は、モジュールのファイルへのパスです。

     Added in version 3.3.

      -- の属性: name

          ローダーが扱えるモジュールの名前です。

      -- の属性: path

          モジュールのファイルへのパスです。

      -- メソッド: load_module (fullname)

          Calls super's ‘load_module()’.

          バージョン 3.4 で非推奨、バージョン 3.15 で削除予定: Use *note
          Loader.exec_module(): a6e. instead.

      -- メソッド: abstractmethod get_filename (fullname)

          *note path: 4e83. を返します。

      -- メソッド: abstractmethod get_data (path)

          'path' をバイナリファイルとして読み込み、そのバイト列を返しま
          す。

 -- クラス: importlib.abc.SourceLoader

     ソース (オプションでバイトコード) ファイルのロードを実装する抽象基
     底クラスです。このクラスは、 *note ResourceLoader: de6. と *note
     ExecutionLoader: 4e80. の両方を継承し、以下の実装が必要です:

        * *note ResourceLoader.get_data(): 4e65.

        * 
          *note ExecutionLoader.get_filename(): 4e81.

               ソースファイルへのパスのみを返す必要があります。ソースな
               しのロードはサポートされていません。

     このクラスでこれらの抽象メソッドを定義することで、バイトコードファ
     イルを追加でサポートします。これらのメソッドを定義しなければ (また
     はそのモジュールが *note NotImplementedError: 369. を送出すれば)、
     このローダーはソースコードに対してのみ働きます。これらのメソッドを
     実装することで、ローダーはソースとバイトコードファイル 'の組み合わ
     せ' に対して働きます。バイトコードのみを与えた 'ソースのない' ロー
     ドは認められません。バイトコードファイルは、 Python コンパイラによ
     る解析の工程をなくして速度を上げる最適化です。ですから、バイトコー
     ド特有の API は公開されていません。

      -- メソッド: path_stats (path)

          指定されたパスについてのメタデータを含む *note dict: 184. を返
          す、オプションの抽象メソッドです。サポートされる辞書のキーは:

             - ‘'mtime'’ (必須): ソースコードの更新時刻を表す整数または
               浮動小数点数です。

             - ‘'size'’ (任意): バイト数で表したソースコードのサイズです
               。

          未来の拡張のため、辞書内の他のキーは無視されます。パスが扱えな
          ければ、 *note OSError: 2c2. が送出されます。

          Added in version 3.3.

          バージョン 3.4 で変更: *note NotImplementedError: 369. の代わ
          りに *note OSError: 2c2. を送出します。

      -- メソッド: path_mtime (path)

          指定されたパスの更新時刻を返す、オプションの抽象メソッドです。

          バージョン 3.3 で非推奨: このメソッドは廃止され、 *note
          path_stats(): 13a5. が推奨されます。このモジュールを実装する必
          要はありませんが、互換性のため現在も利用できます。パスが扱えな
          ければ、 *note OSError: 2c2. が送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 369. の代わ
          りに *note OSError: 2c2. を送出します。

      -- メソッド: set_data (path, data)

          ファイルパスに指定されたバイト列を書き込むオプションの抽象メソ
          ッドです。存在しない中間ディレクトリがあれば、自動で作成されま
          す。

          When writing to the path fails because the path is read-only
          (*note errno.EACCES: 2763./*note PermissionError: f42.), do
          not propagate the exception.

          バージョン 3.4 で変更: 呼ばれたときに *note
          NotImplementedError: 369. を送出することは最早ありません。

      -- メソッド: get_code (fullname)

          *note InspectLoader.get_code(): 115b. の具象実装です。

      -- メソッド: exec_module (module)

          *note Loader.exec_module(): a6e. の具象実装です。

          Added in version 3.4.

      -- メソッド: load_module (fullname)

          Concrete implementation of *note Loader.load_module(): a6d.

          バージョン 3.4 で非推奨、バージョン 3.15 で削除予定: Use *note
          exec_module(): 1219. instead.

      -- メソッド: get_source (fullname)

          *note InspectLoader.get_source(): 115e. の具象実装です。

      -- メソッド: is_package (fullname)

          *note InspectLoader.is_package(): 4e7e. の具象実装です。モジュ
          ールは、次の '両方' を満たすならパッケージであると決定されます
          。モジュールの (*note ExecutionLoader.get_filename(): 4e81. で
          与えられる) ファイルパスが、ファイル拡張子を除くと ‘__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.32.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(): f38.) です。

     Added in version 3.3.

 -- クラス: importlib.machinery.BuiltinImporter

     組み込みモジュールの *note importer: 24a8. です。すべての既知のモジ
     ュールは *note sys.builtin_module_names: 20a3. に列挙されています。
     このクラスは *note importlib.abc.MetaPathFinder: a72. および *note
     importlib.abc.InspectLoader: 115a. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.5 で変更: PEP 489(2) の一環として、ビルトインインポー
     ターは ‘Loader.create_module()’ と ‘Loader.exec_module()’ を実装し
     ています。

 -- クラス: importlib.machinery.FrozenImporter

     フリーズされたモジュールの *note インポーター: 24a8. です。このクラ
     スは *note importlib.abc.MetaPathFinder: a72. および *note
     importlib.abc.InspectLoader: 115a. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.4 で変更: Gained ‘create_module()’ and ‘exec_module()’
     methods.

 -- クラス: importlib.machinery.WindowsRegistryFinder

     Windows レジストリで宣言されたモジュールの *note finder: 23c6. です
     。このクラスは *note importlib.abc.MetaPathFinder: a72. 抽象基底ク
     ラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     Added in version 3.3.

     バージョン 3.6 で非推奨: 代わりに *note site: cc. の設定を使ってく
     ださい。 Python の将来のバージョンでは、デフォルトでこのファインダ
     ーが使えなくなるかもしれません。

 -- クラス: importlib.machinery.PathFinder

     *note sys.path: 3e2. およびパッケージの ‘__path__’ 属性の *note
     Finder: 23c6. です。このクラスは *note
     importlib.abc.MetaPathFinder: a72. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

      -- メソッド: classmethod find_spec (fullname, path=None,
               target=None)

          *note sys.path: 3e2. または定義されていれば 'path' から、
          'fullname' で指定されたモジュールの *note スペック: 23bf. の検
          索を試みるクラスメソッドです。検索されるそれぞれのパスエントリ
          に対して *note sys.path_importer_cache: 7fa. が検査されます。
          偽でないオブジェクトが見つかれば、それが目的のモジュールを検索
          するための *note パスエントリ・ファインダー: 1281. として使わ
          れます。 ‘sys.path_importer_cache’ に目的のエントリが見つから
          なければ、パスエントリに対するファインダーが *note
          sys.path_hooks: 1229. から検索され、見つかれば、それが
          ‘sys.path_importer_cache’ に保管されるとともに、モジュールにつ
          いて問い合わせられます。それでもファインダーが見つからなければ
          ‘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():
          4e7c. on all finders stored in *note sys.path_importer_cache:
          7fa. that define the method.  Otherwise entries in
          ‘sys.path_importer_cache’ 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: 1229. のオブジ
     ェクトを呼び出します。

 -- クラス: importlib.machinery.FileFinder (path, *loader_details)

     ファイルシステムからの結果をキャッシュする *note
     importlib.abc.PathEntryFinder: a73. の具象実装です。

     'path' 引数は検索を担当するファインダーのディレクトリです。

     'loader_details' 引数は、可変個の 2 要素タプルで、それぞれがローダ
     ーとローダーが認識するファイル接尾辞のシーケンスとを含みます。ロー
     ダーは、呼び出し可能でモジュール名と見つかったファイルのパスとの 2
     引数を受け付けることを期待されます。

     ファインダーはモジュール検索のたびに stat を呼び出し、必要に応じて
     ディレクトリの内容をキャッシュすることで、コードキャッシュが古くな
     っていないことを確かめます。キャッシュの古さはオペレーティングシス
     テムのファイルシステムのステート情報の粒度に依存しますから、モジュ
     ールを検索し、新しいファイルを作成し、その後に新しいファイルが表す
     モジュールを検索する、という競合状態の可能性があります。この操作が
     stat の呼び出しの粒度に収まるほど速く起こると、モジュールの検索が失
     敗します。これを防ぐためには、モジュールを動的に作成する際に、必ず
     *note importlib.invalidate_caches(): e0e. を呼び出してください。

     Added in version 3.3.

      -- の属性: path

          ファインダーが検索されるパスです。

      -- メソッド: find_spec (fullname, target=None)

          *note path: 4e8c. 内で '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: 1229.  An instance of *note FileFinder: 1282.
          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: 1283. を継承し、その他いくつかのメ
     ソッドの具象実装を提供する、 *note importlib.abc.SourceLoader:
     4e86. の具象実装です。

     Added in version 3.3.

      -- の属性: name

          このローダーが扱うモジュールの名前です。

      -- の属性: path

          ソースファイルへのパスです。

      -- メソッド: is_package (fullname)

          *note path: 4e90. がパッケージを表すとき ‘True’ を返します。

      -- メソッド: path_stats (path)

          *note importlib.abc.SourceLoader.path_stats(): 13a5. の具象実
          装です。

      -- メソッド: set_data (path, data)

          *note importlib.abc.SourceLoader.set_data(): 4e87. の具象実装
          です。

      -- メソッド: load_module (name=None)

          Concrete implementation of *note
          importlib.abc.Loader.load_module(): a6d. where specifying the
          name of the module to load is optional.

          バージョン 3.6 で非推奨、バージョン 3.15 で削除予定: Use *note
          importlib.abc.Loader.exec_module(): a6e. instead.

 -- クラス: importlib.machinery.SourcelessFileLoader (fullname, path)

     バイトコードファイル (すなわちソースコードファイルが存在しない) を
     インポートできる *note importlib.abc.FileLoader: 1283. の具象実装で
     す。

     注意として、バイトコードを直接使う (つまりソースコードファイルがな
     い) と、そのモジュールはすべての Python 実装では使用できないし、新
     しいバージョンの Python ではバイトコードフォーマットが変更されてい
     たら使用できません。

     Added in version 3.3.

      -- の属性: name

          ローダーが扱うモジュールの名前です。

      -- の属性: path

          バイトコードファイルへのパスです。

      -- メソッド: is_package (fullname)

          そのモジュールがパッケージであるかを *note path: 4e95. に基づ
          いて決定します。

      -- メソッド: get_code (fullname)

          *note path: 4e95. から作成された *note name: 4e94. のコードオ
          ブジェクトを返します。

      -- メソッド: get_source (fullname)

          このローダーが使われたとき、バイトコードファイルのソースがなけ
          れば ‘None’ を返します。

      -- メソッド: load_module (name=None)

     Concrete implementation of *note
     importlib.abc.Loader.load_module(): a6d. where specifying the name
     of the module to load is optional.

     バージョン 3.6 で非推奨、バージョン 3.15 で削除予定: Use *note
     importlib.abc.Loader.exec_module(): a6e. instead.

 -- クラス: importlib.machinery.ExtensionFileLoader (fullname, path)

     拡張モジュールのための *note importlib.abc.ExecutionLoader: 4e80. の
     具象実装です。

     '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: 4e9a. を返します。

          Added in version 3.4.

 -- クラス: importlib.machinery.NamespaceLoader (name, path,
          path_finder)

     A concrete implementation of *note importlib.abc.InspectLoader:
     115a. 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__: 23c0.
     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__: 23c5. at runtime and this will not be automatically
     reflected in the module's *note __spec__.origin: 4ea0, and vice
     versa.

     Added in version 3.4.

      -- の属性: name

          The module's fully qualified name (see *note module.__name__:
          15a7.).  The *note finder: 23c6. should always set this
          attribute to a non-empty string.

      -- の属性: loader

          The *note loader: 1a8a. used to load the module (see *note
          module.__loader__: 339.).  The *note finder: 23c6. should
          always set this attribute.

      -- の属性: origin

          The location the *note loader: 1a8a. should use to load the
          module (see *note module.__file__: 23c5.).  For example, for
          modules loaded from a ‘.py’ file this is the filename.  The
          *note finder: 23c6. should always set this attribute to a
          meaningful value for the loader 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__: 20b0.).  Most of the time there
          will only be a single directory in this list.

          The *note finder: 23c6. 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: 23c6. 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__: 323.).  The *note finder: 23c6.
          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__: 325.  If the module is a package then this
          is the same as *note name: 23c1.

      -- の属性: has_location

          ‘True’ if the spec's *note origin: 4ea0. refers to a loadable
          location, ‘False’ otherwise.  This value impacts how ‘origin’
          is interpreted and how the module's *note __file__: 23c5. is
          populated.

 -- クラス: importlib.machinery.AppleFrameworkLoader (name, path)

     フレームワーク形式の拡張モジュールを読み込み事ができる、特殊な
     *note importlib.machinery.ExtensionFileLoader: eb2. です。

     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: 2199.: 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.32.5.5 ‘importlib.util’ - Utility code for importers
......................................................

'ソースコード:' Lib/importlib/util.py(1)

__________________________________________________________________

このモジュールには、 *note インポーター: 24a8. の構築を助ける様々なオブ
ジェクトがあります。

 -- データ: importlib.util.MAGIC_NUMBER

     バイトコードバージョン番号を表しているバイト列。バイトコードのロー
     ド／書き込みについてヘルプが必要なら *note
     importlib.abc.SourceLoader: 4e86. を参照してください。

     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: 369. が送出されます。)

     '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: 2ee. が上げられます。

     The 'debug_override' parameter is deprecated and can be used to
     override the system's value for ‘__debug__’.  A ‘True’ value is the
     equivalent of setting 'optimization' to the empty string.  A
     ‘False’ value is the same as setting 'optimization' to ‘1’.  If
     both 'debug_override' an 'optimization' are not ‘None’ then *note
     TypeError: 199. is raised.

     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: 2ee. が送出されます。
     ‘sys.implementation.cache_tag’ が定義されていない場合、 *note
     NotImplementedError: 369. が送出されます。

     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(): 115e. で要求されるように
     )。

     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’ を要求する) 場合にも
     ‘ImportError’ が送出されます。

     Added in version 3.3.

     バージョン 3.9 で変更: To improve consistency with import
     statements, raise *note ImportError: 65b. instead of *note
     ValueError: 2ee. for invalid relative import attempts.

 -- の関数: importlib.util.find_spec (name, package=None)

     Find the *note spec: 23bf. for a module, optionally relative to the
     specified 'package' name.  If the module is in *note sys.modules:
     1791, then ‘sys.modules[name].__spec__’ is returned (unless the
     spec would be ‘None’ or is not set, in which case *note ValueError:
     2ee. is raised).  Otherwise a search using *note sys.meta_path:
     f2b. 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: d41.
     instead of *note AttributeError: 5f0. if 'package' is in fact not a
     package (i.e.  lacks a *note __path__: 20b0. attribute).

 -- の関数: importlib.util.module_from_spec (spec)

     'spec' と *note spec.loader.create_module: eb0. に基づいて新しいモ
     ジュールを作ります。

     *note spec.loader.create_module: eb0. が ‘None’ を返さない場合は、
     既に存在するどの属性もリセットされません。また、 'spec' にアクセス
     したり属性をモジュールに設定したりする際に *note AttributeError:
     5f0. 例外が起きても例外は送出されません。

     この関数は、新しいモジュールを作る方法として *note
     types.ModuleType: 1018. よりも推奨されます。なぜなら、できるだけ多
     くのインポートコントロールされた属性をモジュールに設定するために
     'spec' が使用されるからです。

     Added in version 3.5.

 -- の関数: importlib.util.spec_from_loader (name, loader, *,
          origin=None, is_package=None)

     この関数は、スペックに不足している情報を埋めるために *note
     ModuleSpec: 22c8. のような利用可能な *note loader: 1a8a. API を使い
     ます。

     Added in version 3.4.

 -- の関数: importlib.util.spec_from_file_location (name, location, *,
          loader=None, submodule_search_locations=None)

     ファイルへのパスにもとづいて *note ModuleSpec: 22c8. インスタンスを
     生成するためのファクトリー関数。不足している情報は、ローダー 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 ‘source_hash()’ 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(): a6e. as control over what module type is used for
     the module is required.  For those same reasons, the loader's *note
     create_module(): eb0. 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: 1791. will not work as there is no way to
     properly replace the module references throughout the interpreter
     safely; *note ValueError: 2ee. is raised if such a substitution is
     detected.

          注釈: 起動時間が重要なプロジェクトでは、もし決して使われないモ
          ジュールがあれば、このクラスを使ってモジュールをロードするコス
          トを最小化できるかもしれません。スタートアップ時間が重要でない
          プロジェクトでは、遅延されたロードの際に発生して文脈の外で起こ
          るエラーメッセージのため、このクラスの使用は '著しく' 推奨され
          ません。

     Added in version 3.5.

     バージョン 3.6 で変更: Began calling *note create_module(): eb0,
     removing the compatibility warning for *note
     importlib.machinery.BuiltinImporter: eb1. and *note
     importlib.machinery.ExtensionFileLoader: eb2.

      -- メソッド: 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.32.5.6 使用例
...............

* Menu:

* プログラムからのインポート::
* モジュールがインポートできるか確認する::
* ソースファイルから直接インポートする::
* Implementing lazy imports::
* インポーターのセットアップ::
* Approximating importlib.import_module(): Approximating importlib import_module.


File: python.info,  Node: プログラムからのインポート,  Next: モジュールがインポートできるか確認する,  Up: 使用例<48>

5.32.5.7 プログラムからのインポート
...................................

プログラムからモジュールをインポートするには、 *note
importlib.import_module(): 73c. を使ってください。

     import importlib

     itertools = importlib.import_module('itertools')


File: python.info,  Node: モジュールがインポートできるか確認する,  Next: ソースファイルから直接インポートする,  Prev: プログラムからのインポート,  Up: 使用例<48>

5.32.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.32.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: 3e2. being searched.  Alternatives should first be
considered first, such as modifying ‘sys.path’ 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.32.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.32.5.11 インポーターのセットアップ
....................................

For deep customizations of import, you typically want to implement an
*note importer: 24a8.  This means managing both the *note finder: 23c6.
and *note loader: 1a8a. side of things.  For finders there are two
flavours to choose from depending on your needs: a *note meta path
finder: 1280. or a *note path entry finder: 1281.  The former is what
you would put on *note sys.meta_path: f2b. while the latter is what you
create using a *note path entry hook: 24ba. on *note sys.path_hooks:
1229. which works with *note sys.path: 3e2. 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.32.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.32.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: 329. 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: 139. を使って zip ファイルからインポートすること
ができます。

     警告: ‘importlib.resources’ follows the same security model as the
     built-in *note open(): 318. function.  Passing untrusted inputs to
     the functions in this module is unsafe.

     注釈: このモジュールのスタンドアローンバックポートでは、
     importlib.resources の使用(2) と pkg_resources から
     importlib.resources への移行(3) についての詳細情報を提供しています
     。

*note Loaders: 10cb. でリソースの読み込みをサポートしたい場合は、 *note
importlib.resources.abc.ResourceReader: 4e7d. で指定された
‘get_resource_reader(fullname)’ メソッドを実装しなければいけません。

 -- クラス: importlib.resources.Anchor

     Represents an anchor for resources, either a *note module object:
     1018. or a module name as a string.  Defined as ‘Union[str,
     ModuleType]’.

 -- の関数: importlib.resources.files (anchor: Anchor | None = None)

     Returns a *note Traversable: 2fc. 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: 4eb3.  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: 1a4.
     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: 2fc. object representing a file or
     directory, typically from *note importlib.resources.files(): 6b6,
     return a context manager for use in a *note with: 187. statement.
     The context manager provides a *note pathlib.Path: 268. 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://importlib-resources.readthedocs.io/en/latest/using.html

   (3) 
https://importlib-resources.readthedocs.io/en/latest/migration.html


File: python.info,  Node: 関数 API,  Up: importlib resources -- パッケージリソースの読み取り、オープン、アクセス

5.32.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: 4eb3, 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: 2fc, 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: 4eb5. for details on 'anchor' and
     'path_names'.

     This function returns a *note BinaryIO: 23c. 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: 4eb5. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 318.

     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: 23b. 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:
     193.

     See *note the introduction: 4eb5. 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:
     16a.  By default, the contents are read as strict UTF-8.

     See *note the introduction: 4eb5. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 318.

     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:
     187. statement.  The context manager provides a *note pathlib.Path:
     268. 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(): a28. 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: 4eb5. 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.

 -- の関数: 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: 4eb5. 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: 16a.  The iterable
     does not recurse into subdirectories.

     See *note the introduction: 4eb5. 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.32.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): 13d2. です。

     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: 886.  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: 2fb. instead.

      -- メソッド: abstractmethod open_resource (resource)

          Returns an opened, *note file-like object: 181a. for binary
          reading of the 'resource'.

          リソースが見付からない場合は、 *note FileNotFoundError: 266. が
          送出されます。

      -- メソッド: abstractmethod resource_path (resource)

          'resource' へのファイルシステムパスを返します。

          リソースの実体がファイルシステムに存在しない場合、 *note
          FileNotFoundError: 266. が送出されます。

      -- メソッド: abstractmethod is_resource (path)

          Returns ‘True’ if the named 'path' is considered a resource.
          *note FileNotFoundError: 266. is raised if 'path' does not
          exist.

          バージョン 3.10 で変更: The argument 'name' was renamed to
          'path'.

      -- メソッド: abstractmethod contents ()

          Returns an *note iterable: 12f5. 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():
          4ebb. 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: 268. 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:
          2cb6.).

          When opening as text, accepts encoding parameters such as
          those accepted by *note io.TextIOWrapper: 9c2.

      -- メソッド: 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: 4e7d. 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: 2fc.
          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.32.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 provides the entry point and
metadata APIs that were previously exposed by the now-removed
‘pkg_resources’ package.  Along with *note importlib.resources: 7f, it
supersedes ‘pkg_resources’.

‘importlib.metadata’ は、Pythonの ‘site-packages’ ディレクトリに pip(4)
などのツールでインストールしたサードパーティの '配布パッケージ' に対して
動作します。具体的には、 ‘dist-info’ や ‘egg-info’ ディレクトリを持つ配
布物や、 コアとなるメタデータの仕様(5) で定義されたメタデータを検出でき
るようにします。

     重要: これらはPythonコード内でインポートできるトップレベルの 'パッ
     ケージ' 名と '必ずしも' 同等であったり、1:1 で対応するものではあり
     ません。1つの '配布パッケージ' は複数の 'パッケージ' (および単一の
     モジュール) を含むことができ、1つのトップレベルの 'パッケージ' は、
     それが名前空間パッケージであれば複数の '配布パッケージ' にマップす
     ることができます。これらのマッピングを得るには *note
     packages_distributions(): a15. を使用します。

By default, distribution metadata can live on the file system or in zip
archives on *note sys.path: 3e2.  Through an extension mechanism, the
metadata can live almost anywhere.

参考
....

‘https://importlib-metadata.readthedocs.io/’

     ‘importlib_metadata’ のドキュメントは ‘importlib.metadata’ のバック
     ポートです。これには、このモジュールのクラスと関数の APIリファレン
     ス(6) と、 ‘pkg_resources’ の既存のユーザーのための 移行ガイド(7) が
     あります。

* 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://pypi.org/project/pip/

   (5) 
https://packaging.python.org/ja/latest/specifications/core-metadata/#core-metadata

   (6) https://importlib-metadata.readthedocs.io/en/latest/api.html

   (7) 
https://importlib-metadata.readthedocs.io/en/latest/migration.html


File: python.info,  Node: 概要<3>,  Next: 機能 API,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.32.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 ディストリビューションのメタデータ: 4ecc. を取得することができます
。:

     >>> 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 配布物のバージョン番号: 4ecd. を取得し、 *note
構成ファイル: 4ece. をリストアップし、配布物の *note 配布物の要件: 4ecf.
のリストを取得することができます。

 -- 例外: importlib.metadata.PackageNotFoundError

     Subclass of *note ModuleNotFoundError: d41. 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.32.8.2 機能 API
.................

本パッケージは、公開APIを通じて以下の機能を提供します。

* Menu:

* エントリポイント::
* 配布物メタデータ::
* 配布物バージョン::
* 配布物ファイル::
* 配布物の要件::
* Mapping import to distribution packages::


File: python.info,  Node: エントリポイント,  Next: 配布物メタデータ,  Up: 機能 API

5.32.8.3 エントリポイント
.........................

 -- の関数: importlib.metadata.entry_points (**select_params)

     Returns a *note EntryPoints: 4ed4. 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.32.8.4 配布物メタデータ
.........................

 -- の関数: importlib.metadata.metadata (distribution_name)

     Return the distribution metadata corresponding to the named
     distribution package as a *note PackageMetadata: 4ed8. instance.

     Raises *note PackageNotFoundError: 4ed0. 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: 4ed8. 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.32.8.5 配布物バージョン
.........................

 -- の関数: importlib.metadata.version (distribution_name)

     Return the installed distribution package version(1) for the named
     distribution package.

     Raises *note PackageNotFoundError: 4ed0. 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.32.8.6 配布物ファイル
.......................

 -- の関数: importlib.metadata.files (distribution_name)

     Return the full set of files contained within the named
     distribution package.

     Raises *note PackageNotFoundError: 4ed0. if the named distribution
     package is not installed in the current Python environment.

     Returns *note None: 886. 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: 4edc. 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: 886.  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.32.8.7 配布物の要件
.....................

 -- の関数: importlib.metadata.requires (distribution_name)

     Return the declared dependency specifiers for the named
     distribution package.

     Raises *note PackageNotFoundError: 4ed0. 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.32.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: f2b. 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.32.8.9 Distributions
......................

 -- の関数: importlib.metadata.distribution (distribution_name)

     Return a *note Distribution: 4ee4. instance describing the named
     distribution package.

     Raises *note PackageNotFoundError: 4ed0. 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(): 4ee3.
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.32.8.10 Distribution Discovery
................................

デフォルトでは、このパッケージは組み込みで、ファイルシステムおよび zip フ
ァイル 配布パッケージ(1) のメタデータを発見するためのサポートを提供しま
す。このメタデータ検索のデフォルトは ‘sys.path’ ですが、その値をどのよう
に解釈するかは、他のインポート機構が行う方法とは若干異なります。具体的に
は:

   - ‘importlib.metadata’ は ‘sys.path’ の *note bytes: 193. オブジェク
     トを受け入れません。

   - ‘importlib.metadata’ は、インポート時には無視されますが、
     ‘sys.path’ 上の *note pathlib.Path: 268. オブジェクトを優先的に使用
     します。

   ---------- 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.32.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: 3e2. searches, or package loaders directly, the metadata for a
distribution is found through import system *note finders: 24a6.  To
find a distribution package's metadata, ‘importlib.metadata’ queries the
list of *note meta path finders: 1280. on *note sys.meta_path: f2b.

The implementation has hooks integrated into the ‘PathFinder’, serving
metadata for distribution packages found on the file system.

The abstract class *note importlib.abc.MetaPathFinder: a72. defines the
interface expected of finders by Python's import system.
‘importlib.metadata’ extends this protocol by looking for an optional
‘find_distributions’ callable on the finders from *note sys.meta_path:
f2b. and presents this extended interface as the ‘DistributionFinder’
abstract base class, which defines this abstract method:

     @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.32.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.32.9 ‘sys.path’ モジュール検索パスの初期化
--------------------------------------------

モジュール検索パスは Python の開始時に初期化されます。このモジュール検索
パスは、 *note sys.path: 3e2. でアクセス可能です。

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: 1a9. command, or *note -m: 23e. module.

The *note PYTHONPATH: 1223. 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: 1223. 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: 22ad.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: 3ee. 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: b36. and *note PYTHONPLATLIBDIR: 1d81.

Once found, ‘prefix’ and ‘exec_prefix’ are available at *note
sys.base_prefix: 3e4. and *note sys.base_exec_prefix: 3e8. respectively.

If *note PYTHONHOME: 3ee. is not set, and a ‘pyvenv.cfg’ file is found
alongside the main executable, or in its parent directory, *note
sys.prefix: 3e5. and *note sys.exec_prefix: 3e9. get set to the
directory containing ‘pyvenv.cfg’, otherwise they are set to the same
value as *note sys.base_prefix: 3e4. and *note sys.base_exec_prefix:
3e8, respectively.  This is used by *note Virtual Environments: 4c38.

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: 115. modules as described in the ‘site’ module
documentation.

     注釈: Certain command line options may further affect path
     calculations.  See *note -E: b5a, *note -I: b5b, *note -s: 15aa.
     and *note -S: 13c4. for further details.

バージョン 3.14 で変更: *note sys.prefix: 3e5. and *note
sys.exec_prefix: 3e9. 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: 13c4.

* Menu:

* Virtual Environments::
* _pth files::
* 埋め込みの Python::


File: python.info,  Node: Virtual Environments,  Next: _pth files,  Up: sys path モジュール検索パスの初期化

5.32.9.1 Virtual Environments
.............................

Virtual environments place a ‘pyvenv.cfg’ file in their prefix, which
causes *note sys.prefix: 3e5. and *note sys.exec_prefix: 3e9. 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: 3e4. and *note sys.base_exec_prefix:
3e8.

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 ‘site’'s *note virtual environments
documentation: 4c39.

     注釈: *note PYTHONHOME: 3ee. 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: 118.  Most virtual
     environment implementations follow the model set by ‘venv’, 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.32.9.2 _pth files
...................

To completely override *note sys.path: 3e2. 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 ‘sys.path’.  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.32.9.3 埋め込みの Python
..........................

Python が他のアプリケーションに埋め込まれている場合は、 *note
Py_InitializeFromConfig(): 3f4. と *note PyConfig: 3f5. 構造体が Python
の初期化に使用可能です。パス固有の詳細は、 *note Python Path
Configuration: aae. で説明されています。

参考
....

   * Windows の詳細についてのメモは、 *note モジュールの検索: e1e. を参
     照。

   * Unix の詳細は、 *note Unix プラットフォームで Python を使う: 219e.
     を参照。


File: python.info,  Node: Python言語サービス,  Next: MS Windows 固有のサービス,  Prev: モジュールのインポート,  Up: Python 標準ライブラリ

5.33 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.33.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: 4ef4. を組み込み関数
*note compile(): 4b1. のフラグとして渡すか、あるいはこのモジュールで提供
されているヘルパー関数 *note parse(): 1c4. を使います。その結果は、
*note ast.AST: 4c3. を継承したクラスのオブジェクトのツリーとなります。抽
象構文木は組み込み関数 ‘compile()’ を使って 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.33.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.33.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: 4ef5.  They are defined in the ‘_ast’ C module and
     re-exported in ‘ast’.

     抽象文法の左辺のシンボル一つずつにそれぞれ一つのクラスがあります (た
     とえば ‘ast.stmt’ や ‘ast.expr’)。それに加えて、右辺のコンストラク
     タ一つずつにそれぞれ一つのクラスがあり、これらのクラスは左辺のツリ
     ーのクラスを継承しています。たとえば、 *note ast.BinOp: 1e0e. は
     ‘ast.expr’ から継承しています。代替を伴った生成規則 (production
     rules with alternatives) (別名 "sums") の場合、左辺は抽象クラスとな
     り、特定のコンストラクタ・ノードのインスタンスのみが作成されます。

      -- の属性: _fields

          各具象クラスは属性 ‘_fields’ を持っており、すべての子ノードの
          名前をそこに保持しています。

          具象クラスのインスタンスは、各子ノードに対してそれぞれひとつの
          属性を持っています。この属性は、文法で定義された型となります。
          たとえば *note ast.BinOp: 1e0e. のインスタンスは ‘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: 1841.) 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: 4ef8, *note col_offset: 4ef9, *note end_lineno: 4efa,
          および *note end_col_offset: 4efb. 属性を持ちます。 ‘lineno’ と
          ‘end_lineno’ はソーステキストの範囲を最初と最後の行番号で表し
          (1 から数え始めるので、最初の行の行番号は 1 となります)、
          ‘col_offset’ と ‘end_col_offset’ はノードが生成した最初と最後
          のトークンの UTF-8 バイトオフセットです。 UTF-8 オフセットはパ
          ーサが内部で使用するので記録されます。

          コンパイラは終了位置を必要としないことに注意してください。この
          ため終了位置は省略可能です。終了位置を示すオフセットは最後のシ
          ンボルの '後の位置' になります。例えば一行で書かれた式のソース
          コードのセグメントは ‘source_line[node.col_offset :
          node.end_col_offset]’ により取得できます。

     クラス ‘ast.T’ のコンストラクタは引数を次のように解析します:

        * 位置引数があるとすれば、 ‘T._fields’ にあるのと同じだけの個数
          が無ければなりません。これらの引数はそこにある名前を持った属性
          として割り当てられます。

        * キーワード引数があるとすれば、それらはその名前の属性にその値を
          割り当てられます。

     たとえば、 *note ast.UnaryOp: 4e02. ノードを生成して属性を埋めるに
     は、次のようにすることができます

          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: 1a4. 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: 2f1. が全ての定数に使われるよ
うになりました。

バージョン 3.9 で変更: 単純なインデックスはその値で表現され、幅を持つス
ライスはタプルで表現されます。

バージョン 3.13 で変更: AST node constructors were changed to provide
sensible defaults for omitted fields: optional fields now default to
‘None’, list fields default to an empty list, and fields of type
‘ast.expr_context’ default to *note Load(): 4c2.  Previously, omitted
attributes would not exist on constructed nodes (accessing them raised
*note AttributeError: 5f0.).

バージョン 3.14 で変更: The *note __repr__(): 82f. output of *note AST:
4c3. nodes includes the values of the node fields.

バージョン 3.8 で非推奨、バージョン 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: 2f1.

バージョン 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.

バージョン 3.13 で非推奨、バージョン 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.33.1.3 Root nodes
...................

 -- クラス: ast.Module (body, type_ignores)

     A Python module, as with *note file input: 25fd.  Node type
     generated by *note ast.parse(): 1c4. in the default ‘"exec"’
     'mode'.

     ‘body’ is a *note list: 24f. of the module's *note 文 (Statements):
     4eff.

     ‘type_ignores’ is a *note list: 24f. of the module's type ignore
     comments; see *note ast.parse(): 1c4. 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: 2603.  Node type generated
     by *note ast.parse(): 1c4. when 'mode' is ‘"eval"’.

     ‘body’ is a single node, one of the *note expression types: 4f01.

          >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))
          Expression(
              body=Constant(value=123))

 -- クラス: ast.Interactive (body)

     A single *note interactive input: 2600, like in *note 対話モード:
     494.  Node type generated by *note ast.parse(): 1c4. when 'mode' is
     ‘"single"’.

     ‘body’ is a *note list: 24f. of *note statement nodes: 4eff.

          >>> 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(): 1c4. 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: 24f. of *note expression nodes: 4f01.

     ‘returns’ is a single *note expression node: 4f01.

          >>> 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.33.1.4 リテラル
.................

 -- クラス: ast.Constant (value, kind)

     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: 16a, *note bytes: 193, *note int:
     19c, *note float: 197, *note complex: 198, and *note bool: 3c1, and
     the constants *note None: 886. and *note Ellipsis: 2384.

     The ‘kind’ attribute is an optional string.  For string literals
     with a ‘u’ prefix, ‘kind’ is set to ‘'u'’.  For all other
     constants, ‘kind’ is ‘None’.

          >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))
          Expression(
              body=Constant(value=123))
          >>> print(ast.dump(ast.parse("u'hello'", mode='eval'), indent=4))
          Expression(
              body=Constant(value='hello', kind='u'))

 -- クラス: ast.FormattedValue (value, conversion, format_spec)

     このノードは f-string における単一の書式指定置換フィールドを表現し
     ます。文字列が単一の置換フィールドしか持たず、他に何も含まない場合
     は、ノードは単独で存在できます。そうでない場合は *note JoinedStr:
     1abd. の一部としてあらわれます。

        * ‘value’ は式ツリーのノードのいずれか (リテラル、変数、関数呼び
          出しなど) です。

        * ‘conversion’ は整数です:

             * -1: 書式指定なし

             * 97 (‘ord('a')’): ‘!a’ *note ASCII: 1604. formatting

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 1c3. formatting

             * 115 (‘ord('s')’): ‘!s’ *note string: 16a. formatting

        * ‘format_spec’ は値の書式指定を表現する *note JoinedStr: 1abd.
          ノード、もしくは書式指定がない場合は ‘None’ です。
          ‘conversion’ と ‘format_spec’ を同時に設定することができます。

 -- クラス: ast.JoinedStr (values)

     *note FormattedValue: 4e1a. ノードと *note Constant: 2f1. ノードの
     集まりからなる 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: 1822. and *note Constant: 2f1. 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(): ae6.  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: 1604. conversion

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 1c3. conversion

             * 115 (‘ord('s')’): ‘!s’ *note string: 16a. conversion

          This has the same meaning as ‘FormattedValue.conversion’.

        * ‘format_spec’ is a *note JoinedStr: 1abd. 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:
     4f05. であり、そうでない場合は *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.33.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: 1d80. ノード、を保持します。この型は ‘*args’ を伴う関数
     呼び出しノード *note Call: 4e13. を構築する際に使用します。

          >>> 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.33.1.6 式 (expression)
........................

 -- クラス: ast.Expr (value)

     関数呼び出しのような式がそれ自身で文となり、戻り値が使われないかま
     たは保存されないとき、その式はこのコンテナでラップされます。
     ‘value’ はこの節で説明する他のノード、 *note Constant: 2f1. ノード
     、 *note Name: 1d80. ノード、 *note Lambda: 4e1d. ノード *note
     Yield: 4e24. ノードまたは *note YieldFrom: 4e25. ノードのいずれかを
     保持します。

          >>> 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: 4e06. は論理否定キーワ
     ード ‘not’ であり、 *note Invert: 4e03. はビット反転演算子 ‘~’ です
     。

          >>> 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:
     4f17. または *note And: 4f18. です。 ‘values’ は必要な値のリストで
     す。 ‘a or b or c’ のように同じ演算子を使う連続した演算は、複数の値
     を持った単一のノードとして表現されます。

     ‘not’ は単項演算 *note UnaryOp: 4e02. のため、ここには含まれません
     。

          >>> 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: 1d80. または *note Attribute: 4e14. のオブジェクトです。 関数
     呼び出しの引数:

        * ‘args’ は位置引数のリストを保持します。

        * ‘keywords’ holds a list of *note keyword: 4f19. 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:
     1d80. ノードです。

          >>> 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: 1d80. です。 ‘attr’ は属性名を与える生の文
     字列で、 ‘ctx’ はその属性がどのように振る舞うかに応じて *note Load:
     4c2.、 *note Store: 4f05. または *note Del: 4f07. のいずれかです。

          >>> 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: 4f1a. ノードと異な
     り、このノードの場合は ‘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.33.1.7 配列要素の参照 (Subscripting)
......................................

 -- クラス: ast.Subscript (value, slice, ctx)

     ‘l[1]’ のような配列要素の参照をあらわします。 ‘value’ は参照元のオ
     ブジェクトです (通常シーケンス型またはマッピング型)。 ‘slice’ はイ
     ンデックス、スライス、またはキーです。 *note Slice: 4e19. を含む
     *note Tuple: 4e18. でもかまいません。 ‘ctx’ は要素の参照により実行
     されるアクションに応じて *note Load: 4c2.、 *note Store: 4f05. また
     は *note Del: 4f07. のいずれかです。

          >>> 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: 4e15. の 'slice' フィールドでの直接
     指定か、または *note Tuple: 4e18. の要素として指定する場合のみ利用
     可能です。

          >>> 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.33.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: 4f1d. ノードのリストです。

          >>> 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: 1d80. または *note Tuple:
     4e18. ノードです。 ‘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.33.1.9 文 (Statements)
........................

 -- クラス: ast.Assign (targets, value, type_comment)

     代入です。 ‘targets’ はノードのリスト、 ‘value’ は単一のノードです
     。

     ‘targets’ の複数のノードは、それぞれに対して同じ値を代入することを
     あらわします。分割代入は ‘targets’ 内に *note Tuple: 4e18. または
     *note List: 4e17. を置くことで表現されます。

      -- の属性: 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: 1d80, an *note Attribute: 4e14. or a *note
     Subscript: 4e15.  ‘annotation’ is the annotation, such as a *note
     Constant: 2f1. or ‘Name’ 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: 1d80. node that does not appear between
     parentheses; all other targets are considered complex.  Only simple
     targets appear in the *note __annotations__: 456. 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: 4f05. コンテキストを伴う) ‘x’ のための *note Name:
     1d80. ノード、 ‘op’ は *note Add: 4f0a. 演算子、そして ‘value’ は定
     数1をあらわす *note Constant: 2f1. ノードです。

     *note Assign: 4f1a. と異なり、 ‘target’ 属性は class *note Tuple:
     4e18. や *note List: 4e17. であってはいけません。

          >>> 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: 4e13. または *note Name: 1d80.、 もしくは単独の
     ‘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: 4e08. ノードなどのよう
     な条件を保持します。 ‘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: 1d80, *note
     Attribute: 4e14, *note Subscript: 4e15. などのノードのリストです。

          >>> 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: 4f26, 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.33.1.10 インポート
....................

 -- クラス: ast.Import (names)

     インポート文です。 ‘names’ は *note alias: 1cd1. ノードのリストです
     。

          >>> 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.33.1.11 制御フロー
....................

     注釈: ‘else’ 節のようなオプションの節が存在しない場合は、空のリスト
     として保存されます。

 -- クラス: ast.If (test, body, orelse)

     ‘if’ 文です。 ‘test’ は *note Compare: 4e08. ノードなどの単一のノー
     ドを保持します。 ‘body’ と ‘orelse’ はそれぞれノードのリストを保持
     します。

     ‘elif’ 節は AST において固有の表現を持たず、先行する節をあらわすノ
     ードの ‘orelse’ セクションに追加の *note If: 4f2b. ノードとして現れ
     ます。

          >>> 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: 1d80, *note Tuple: 4e18, *note List: 4e17,
     *note Attribute: 4e14. or *note Subscript: 4e15. 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: 4e08. のような条件を
     あらわすノードを保持します。

          >>> 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: 4f32. ノードのリストであ
     る ‘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: 4f31. but the *note
     ExceptHandler: 4f32. 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: 1d80. ノードです (‘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: 4f35. ノードのリス
     トで、コンテキストマネージャのリストをあらわします。また ‘body’ は
     コンテキスト内にインデントされたブロックです。

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

 -- クラス: ast.withitem (context_expr, optional_vars)

     ‘with’ ブロックにおける単一のコンテキストマネージャをあらわします。
     ‘context_expr’ はコンテキストマネージャで、しばしば *note Call:
     4e13. ノードが設定されます。 ‘optional_vars’ は ‘as foo’ に相当する
     *note Name: 1d80, *note Tuple: 4e18. または *note List: 4e17. のい
     ずれかのノードか、または、この部分が不要な場合は ‘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.33.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: 4f39. 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.33.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(): 1c4. for more details.

     Added in version 3.8.


File: python.info,  Node: Type parameters,  Next: 関数およびクラス定義,  Prev: Type annotations,  Up: Node クラス

5.33.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: 4e18, 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.33.1.15 関数およびクラス定義
..............................

 -- クラス: ast.FunctionDef (name, args, body, decorator_list, returns,
          type_comment, type_params)

     関数定義です。

        * ‘name’ は関数名をあらわす生の文字列です。

        * ‘args’ は引数をあらわす *note arguments: 4f48. ノードです。

        * ‘body’ は関数の本体をあらわすノードのリストです。

        * ‘decorator_list’ は関数に適用されるデコレータのリストで、外側
          のデコレータがリストの先頭に保存されます (すなわち、リストの先
          頭にあるデコレータが最後に適用されます)。

        * ‘returns’ は戻り値に対する注釈です。

        * ‘type_params’ is a list of *note type parameters: 4f26.

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Lambda (args, body)

     ‘lambda’ は式の中で使うことができる最小限の関数定義です。 *note
     FunctionDef: 1ad9. ノードと異なり、 ‘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: 4f4a. ノードのリストです。

        * ‘vararg’ と ‘kwarg’ はそれぞれ単一の *note arg: 4f4a. ノードで
          、 ‘*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: 1d80.
     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: 4f09. 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: 4f19. nodes,
          principally for 'metaclass'.  Other keywords will be passed to
          the metaclass, as per PEP 3115(1).

        * ‘body’ はクラス定義に含まれるコードをあらわすノードのリストで
          す。

        * ‘decorator_list’ はノードのリストで、関数定義 *note
          FunctionDef: 1ad9. の場合と同様に解釈されます。

        * ‘type_params’ is a list of *note type parameters: 4f26.

          >>> 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.33.1.16 async と await
........................

 -- クラス: ast.AsyncFunctionDef (name, args, body, decorator_list,
          returns, type_comment, type_params)

     ‘async def’ 形式の関数定義です。通常の関数定義 *note FunctionDef:
     1ad9. と同じフィールドを持ちます。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Await (value)

     ‘await’ 式をあらわします。 ‘value’ は待ち受ける値です。 *note
     AsyncFunctionDef: 1ad8. の本体 (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: 4f2c. および *note With: 4f34. と同じフィールドを持
     ちます。 *note AsyncFunctionDef: 1ad8. の本体 (body) の中でのみ有効
     です。

     注釈: When a string is parsed by *note ast.parse(): 1c4, 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: 4f0a.).


File: python.info,  Node: ast helpers,  Next: Compiler flags<2>,  Prev: Node クラス,  Up: ast --- Abstract syntax trees

5.33.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: 4f53. 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: 4efe. (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: a12. 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: 2ee.
     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: 18f. 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, ‘ast.parse()’ 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(): 1c4. が元の ‘ast.AST’ と等価なオブジェクトを生成できる
     ような文字列を生成します。

          警告: 生成されたコード文字列は、生成元のコードである *note
          ast.AST: 4c3. オブジェクトと必ずしも等価であるとは限りません
          (定数タプルや frozenset などに対するコンパイラ最適化なしのコー
          ドです)。

          警告: 非常に複雑な式を逆構文解析すると *note RecursionError:
          f6c. となることがあります。

     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: 2ee, *note TypeError: 199,
          *note SyntaxError: 18f, *note MemoryError: 1772. and *note
          RecursionError: f6c. 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: 1ad9, *note
     AsyncFunctionDef: 1ad8, *note ClassDef: 1ad7, *note Module: 4efe. の
     いずれかのノードでなければなりません) のドキュメント文字列を返しま
     す。もしドキュメント文字列が無ければ ‘None’ を返します。 'clean' が
     真ならば、ドキュメント文字列のインデントを *note
     inspect.cleandoc(): 1a8e. を用いて一掃します。

     バージョン 3.5 で変更: *note AsyncFunctionDef: 1ad8. がサポートされ
     ました。

 -- の関数: ast.get_source_segment (source, node, *, padded=False)

     Get source code segment of the 'source' that generated 'node'.  If
     some location information (*note lineno: 4ef8, *note end_lineno:
     4efa, *note col_offset: 4ef9, or *note end_col_offset: 4efb.) 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: 4ef8. and *note col_offset: 4ef9.
     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: 4ef8, *note col_offset: 4ef9,
     *note end_lineno: 4efa, and *note end_col_offset: 4efb.) 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(): 4f59. メ
     ソッドに送られる値を返してもかまいません。

     このクラスはビジター・メソッドを付け加えたサブクラスを派生させるこ
     とを意図しています。

      -- メソッド: visit (node)

          ノードを訪れます。デフォルトの実装では ‘self.visit_CLASSNAME’
          というメソッド (ここで 'classname' はノードのクラス名です) を
          呼び出すか、そのメソッドがなければ *note generic_visit():
          4f5a. を呼び出します。

      -- メソッド: generic_visit (node)

          このビジターはノードの全ての子について *note visit(): 4f59. を
          呼び出します。

          注意して欲しいのは、専用のビジター・メソッドを具えたノードの子
          ノードは、このビジターが *note generic_visit(): 4f5a. を呼び出
          すかそれ自身で子ノードを訪れない限り訪れられないということです
          。

      -- メソッド: visit_Constant (node)

          Handles all constant nodes.

     トラバースの途中でノードを変化させたいならば *note NodeVisitor:
     2f2. を使ってはいけません。そうした目的のために変更を許す特別なビジ
     ター (*note NodeTransformer: 4f5b.) があります。

     バージョン 3.8 で非推奨、バージョン 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(): c67. method instead
     to handle all constant nodes.

 -- クラス: ast.NodeTransformer

     *note NodeVisitor: 2f2. のサブクラスで抽象構文木を渡り歩きながらノ
     ードを変更することを許すものです。

     *note NodeTransformer: 4f5b. は抽象構文木(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(): 4f5a. method for the node first.

     文のコレクションであるようなノード (全ての文のノードが当てはまりま
     す) に対して、このビジターは単独のノードではなくノードのリストを返
     すかもしれません。

     If ‘NodeTransformer’ introduces new nodes (that weren't part of
     original tree) without giving them location information (such as
     *note lineno: 4ef8.), *note fix_missing_locations(): 4f54. 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=[])

 -- の関数: 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/

   (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.33.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(): 1c4.

     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.

   ---------- 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.33.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(): 1c4. 関数の '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.33.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.33.2.1 記号表の生成
.....................

 -- の関数: symtable.symtable (code, filename, compile_type)

     Return the toplevel *note SymbolTable: 4f6f. for the Python source
     'code'.  'filename' is the name of the file containing the code.
     'compile_type' is like the 'mode' argument to *note compile(): 4b1.


File: python.info,  Node: 記号表の検査,  Next: コマンドラインからの使用<3>,  Prev: 記号表の生成,  Up: symtable --- コンパイラーの記号表へのアクセス

5.33.2.2 記号表の検査
.....................

 -- クラス: symtable.SymbolTableType

     An enumeration indicating the type of a *note SymbolTable: 4f6f.
     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: 23d3.

      -- の属性: 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: 19b2. 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: 19b2. enumeration.

          The exact values of the returned string may change in the
          future, and thus, it is recommended to use *note
          SymbolTableType: 19b2. 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(): 19b3. 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(): 4f7e. で得られます
          。

      -- メソッド: get_identifiers ()

          Return a view object containing the names of symbols in the
          table.  See the *note documentation of view objects: 26fc.

      -- メソッド: lookup (name)

          記号表から名前 'name' を見つけ出して *note Symbol: 28b. インス
          タンスとして返します。

      -- メソッド: get_symbols ()

          記号表中の名前を表す *note Symbol: 28b. インスタンスのリストを
          返します。

      -- メソッド: get_children ()

          入れ子になった記号表のリストを返します。

 -- クラス: symtable.Function

     A namespace for a function or method.  This class inherits from
     *note SymbolTable: 4f6f.

      -- メソッド: 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: 18f6. in this function.

 -- クラス: symtable.Class

     A namespace of a class.  This class inherits from *note
     SymbolTable: 4f6f.

      -- メソッド: 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: 1678. or *note async def: 7ed.

          Functions defined in a deeper scope (e.g., in an inner class)
          are not picked up by ‘get_methods()’.

          例えば:

               >>> 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: 199. at runtime,
          ‘A.f’ is still considered as a method-like function.

          バージョン 3.14 で非推奨、バージョン 3.16 で削除予定.

 -- クラス: symtable.Symbol

     *note SymbolTable: 4f6f. のエントリーでソースの識別子に対応するもの
     です。コンストラクタはパブリックではありません。

      -- メソッド: 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: 2ee. が送出
          されます。


File: python.info,  Node: コマンドラインからの使用<3>,  Prev: 記号表の検査,  Up: symtable --- コンパイラーの記号表へのアクセス

5.33.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.33.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: 4f9a. or *note OP:
22e6, or a ‘"match"’ token may be either *note NAME: 2315. or *note
SOFT_KEYWORD: 4f9b.

 -- データ: 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: 22fc.

 -- データ: token.NUMBER

     Token value that indicates a *note numeric literal: 22fd.

 -- データ: token.STRING

     Token value that indicates a *note string or byte literal: 22fb,
     excluding *note formatted string literals: 19b.  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: 22e8. or
     *note delimiter: 22e7.

     'CPython 実装の詳細:' This value is only reported by the *note
     tokenize: 102. module.  Internally, the tokenizer uses *note exact
     token types: 237a. 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: 2301.

 -- データ: 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: 2301. to
     indicate the start of an *note indented block: 22f8.

 -- データ: token.DEDENT

     Token value used at the beginning of a *note logical line: 2301. to
     indicate the end of an *note indented block: 22f8.

 -- データ: token.FSTRING_START

     Token value used to indicate the beginning of an *note f-string
     literal: 19b.

     '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:
     19b, 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: 4fa2, *note RBRACE: 4fa3, *note
     EXCLAMATION: 4fa4. and *note COLON: 4fa5. tokens.

 -- データ: token.FSTRING_END

     Token value used to indicate the end of a *note f-string: 19b.

     '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: 4fa2, *note RBRACE: 4fa3, *note
     EXCLAMATION: 4fa4. and *note COLON: 4fa5. 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: 25f9.

 -- データ: 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: 102. module.

The following token types are not produced by the *note tokenize: 102.
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: 4fa0. tokens only with the *note PyCF_TYPE_COMMENTS: 4f53.
     flag.

 -- データ: token.TYPE_COMMENT

     Token value indicating that a type comment was recognized.  Such
     tokens are produced instead of regular *note COMMENT: 4fa0. tokens
     only with the *note PyCF_TYPE_COMMENTS: 4f53. flag.

 -- データ: token.SOFT_KEYWORD

     Token value indicating a *note soft keyword: a11.

     The tokenizer never produces this value.  To check for a soft
     keyword, pass a *note NAME: 2315. token's string to *note
     keyword.issoftkeyword(): 4fac.

 -- データ: token.ERRORTOKEN

     Token value used to indicate wrong input.

     The *note tokenize: 102. module generally indicates errors by
     raising exceptions instead of emitting this token.  It can also
     emit tokens such as *note OP: 22e6. or *note NAME: 2315. with
     strings that are later rejected by the parser.
The remaining tokens represent specific *note operators: 22e8. and *note
delimiters: 22e7.  (The *note tokenize: 102. module reports these as
*note OP: 22e6.; see ‘exact_type’ in the ‘tokenize’ 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: 4fa0. 、*note NL: 4fa1.、*note
ENCODING: 4fa9. トークンが追加されました。

バージョン 3.7 で変更: Removed ‘AWAIT’ and ‘ASYNC’ tokens.  "async" and
"await" are now tokenized as *note NAME: 2315. tokens.

バージョン 3.8 で変更: Added *note TYPE_COMMENT: 4fab, *note
TYPE_IGNORE: 4faa, *note COLONEQUAL: 4fd8.  Added ‘AWAIT’ and ‘ASYNC’
tokens back (they're needed to support parsing older Python versions for
*note ast.parse(): 1c4. with ‘feature_version’ set to 6 or lower).

バージョン 3.12 で変更: Added *note EXCLAMATION: 4fa4.

バージョン 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.33.4 ‘keyword’ -- Python キーワードのテスト
---------------------------------------------

'ソースコード:' Lib/keyword.py(1)

__________________________________________________________________

このモジュールでは、Python プログラムで文字列が *note キーワード: 22e5.
や *note ソフトキーワード: a11. か否かをチェックする機能を提供します。

 -- の関数: keyword.iskeyword (s)

     's' が Python の *note キーワード: 22e5. であれば ‘True’ を返します
     。

 -- データ: keyword.kwlist

     インタープリタで定義している全ての *note キーワード: 22e5. のシーケ
     ンス。特定の *note __future__: 0. 宣言がなければ有効ではないキーワ
     ードでもこのリストには含まれます。

 -- の関数: keyword.issoftkeyword (s)

     's' が Python の *note ソフトキーワード: a11. であれば ‘True’ を返
     します。

     Added in version 3.9.

 -- データ: keyword.softkwlist

     インタープリタで定義している全ての *note ソフトキーワード: a11. の
     シーケンス。特定の *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.33.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:
22e8. と *note delimiter: 22e7. トークンおよび *note Ellipsis: 2384. は
ジェネリックな *note OP: 22e6. トークンタイプとして返されます。正確な型
は *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(): 1c4.).  The behavior of the
     functions in this module is 'undefined' when providing invalid
     Python code and it can change at any point.

* Menu:

* Tokenizing Input::
* Command-Line Usage::
* 使用例: 使用例<50>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tokenize.py


File: python.info,  Node: Tokenizing Input,  Next: Command-Line Usage,  Up: tokenize --- Python ソース用のトークナイザー

5.33.5.1 Tokenizing Input
.........................

第一のエントリポイントは *note ジェネレータ: 1270. です:

 -- の関数: tokenize.tokenize (readline)

     *note tokenize(): 700. ジェネレータは一つの引数 'readline' を必要と
     します。この引数は呼び出し可能オブジェクトで、ファイルオブジェクト
     の *note io.IOBase.readline(): 1545. メソッドと同じインタフェースを
     提供している必要があります。この関数は呼び出しのたびに入力の一行を
     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: 22e6. トークンに対して正確な演
     算子のタイプを持ちます。それ以外のトークンタイプについては、
     ‘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, ‘generate_tokens()’
     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: 4fa9. token.

All constants from the *note token: 101. 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: 4fa9. 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(): 1825. 関数は Python のソースファイルをデコ
     ードするのに使うエンコーディングを検出するために使われます。 *note
     tokenize(): 700. ジェネレータと同じ readline を引数として取ります。

     readline を最大2回呼び出し、利用するエンコーディング (文字列として)
     と、読み込んだ行を (bytes からデコードされないままの状態で) 返しま
     す。

     UTF-8 BOM か PEP 263(2) で定義されている encoding cookie からエンコ
     ーディングを検出します。BOMと cookie の両方が存在し、一致していない
     場合、*note SyntaxError: 18f. が送出されます。 BOM が見つかった場合
     はエンコーディングとして ‘'utf-8-sig'’ が返されます。

     エンコーディングが指定されていない場合、デフォルトの ‘'utf-8'’ が返
     されます。

     Python のソースファイルを開くには *note open(): 2d5b. を使ってくだ
     さい。これは *note detect_encoding(): 1825. を利用してファイルエン
     コーディングを検出します。

 -- の関数: tokenize.open (filename)

     *note detect_encoding(): 1825. を使って検出したエンコーディングを利
     用して、ファイルを読み出し専用モードで開きます。

     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: Command-Line Usage,  Next: 使用例<50>,  Prev: Tokenizing Input,  Up: tokenize --- Python ソース用のトークナイザー

5.33.5.2 Command-Line Usage
...........................

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: Command-Line Usage,  Up: tokenize --- Python ソース用のトークナイザー

5.33.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()

will be tokenized to the following output where the first column is the
range of the line/column coordinates where the token is found, the
second column is the name of the token, and the final column is the
value of the token (if any)

     $ 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: 4fe7. オプションで表示できます:

     $ 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.33.6 ‘tabnanny’ -- あいまいなインデントの検出
-----------------------------------------------

'ソースコード:' Lib/tabnanny.py(1)

__________________________________________________________________

差し当たり、このモジュールはスクリプトとして呼び出すことを意図しています
。しかし、IDE 上にインポートして下で説明する関数 *note check(): 4fed. を
使うことができます。

     注釈: このモジュールが提供する API を将来のリリースで変更する確率が
     高いです。このような変更は後方互換性がないかもしれません。

 -- の関数: tabnanny.check (file_or_dir)

     'file_or_dir' がディレクトリであってシンボリックリンクでないときに
     、 'file_or_dir' という名前のディレクトリツリーを再帰的に下って行き
     、この通り道に沿ってすべての ‘.py’ ファイルをチェックします。
     'file_or_dir' が通常の Python ソースファイルの場合には、問題のある
     空白をチェックします。診断メッセージは *note print(): 117b. 関数を
     使って標準出力に書き込まれます。

 -- データ: tabnanny.verbose

     冗長なメッセージをプリントするかどうかを示すフラグ。スクリプトとし
     て呼び出された場合は、‘-v’ オプションによって増加します。

 -- データ: tabnanny.filename_only

     問題のある空白を含むファイルのファイル名のみをプリントするかどうか
     を示すフラグ。スクリプトとして呼び出された場合は、‘-q’ オプションに
     よって真に設定されます。

 -- 例外: tabnanny.NannyNag

     あいまいなインデントを検出した場合に *note process_tokens(): 4ff1.
     が送出します。 この例外は *note check(): 4fed. で捕捉され処理されま
     す。

 -- の関数: tabnanny.process_tokens (tokens)

     この関数は、 *note tokenize: 102. モジュールによって生成されたトー
     クンを *note check(): 4fed. が処理するために使われます。

参考
....

*note tokenize: 102. モジュール

     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.33.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.33.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: 184. 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.33.7.2 クラスオブジェクト
...........................

 -- クラス: pyclbr.Class

     Class ‘Class’ instances describe classes defined by class
     statements.  They have the same attributes as *note Functions:
     4ff7. 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(): a31. are listed as a string with the class
          name instead of as ‘Class’ objects.

      -- の属性: methods

          A *note dictionary: 184. mapping method names to line numbers.
          This can be derived from the newer *note children: 5007.
          dictionary, but remains for back-compatibility.


File: python.info,  Node: py_compile --- Python ソースファイルをコンパイルする,  Next: compileall --- Python ライブラリをバイトコンパイルする,  Prev: pyclbr --- Python モジュールブラウザーサポート,  Up: Python言語サービス

5.33.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: 500d. 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: 500d. is
     raised instead.  However if 'quiet' is 2, no message is written,
     and 'doraise' has no effect.

     (明示的に指定されたか計算された結果の) 'cfile' のパスがシンボリック
     リンクだったり通常のファイルでなかったりした場合は、 *note
     FileExistsError: 1225. が送出されます。この動作は、それらのパスにバ
     イトコンパイルされたファイルを書き込む権限がある場合、インポートの
     ときにそのパスを通常のファイルに変えてしまうことを警告するためのも
     のです。これはリネームを使ってバイトコンパイルされたファイルを配置
     するインポートで、同時にファイル書き込みをしてしまう問題を避けるた
     めの副作用です。

     'optimize' は最適化レベルを制御するもので、組み込みの *note
     compile(): 4b1. 関数に渡されます。デフォルトは現在のインタープリタ
     の最適化レベルを選ぶ ‘-1’ です。

     'invalidation_mode' should be a member of the *note
     PycInvalidationMode: 500e. enum and controls how the generated
     bytecode cache is invalidated at runtime.  The default is *note
     PycInvalidationMode.CHECKED_HASH: 500f. if the ‘SOURCE_DATE_EPOCH’
     environment variable is set, otherwise the default is *note
     PycInvalidationMode.TIMESTAMP: 5010.

     バージョン 3.2 で変更: PEP 3147(4) に準拠し 'cfile' のデフォルト値
     を変更しました。以前のデフォルトは 'file' + ‘'c'’ (最適化が有効な場
     合は ‘'o'’) でした。同時に 'optimize' パラメータも追加されました。

     バージョン 3.4 で変更: バイトコードをキャッシュするファイルへの書き
     込みに *note importlib: 7b. を使うようにコードを変更しました。これ
     により、例えば権限や write-and-move セマンティクスなどの、ファイル
     の作成や書き込みの動作が ‘importlib’ と一致するようになりました。
     'cfile' がシンボリックリンクであるか通常のファイルでない場合、
     *note FileExistsError: 1225. を送出するという注意書きも追加されまし
     た。

     バージョン 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: 500f.

     バージョン 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: 500f, 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:

* コマンドラインインターフェイス: コマンドラインインターフェイス<4>.

   ---------- 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: コマンドラインインターフェイス<4>,  Up: py_compile --- Python ソースファイルをコンパイルする

5.33.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: 5016. のサポートが追加されました。

参考
....

*note compileall: 21. モジュール

     ディレクトリツリー内の Python ソースファイルを全てコンパイルするラ
     イブラリ。


File: python.info,  Node: compileall --- Python ライブラリをバイトコンパイルする,  Next: dis --- Python バイトコードの逆アセンブラー,  Prev: py_compile --- Python ソースファイルをコンパイルする,  Up: Python言語サービス

5.33.9 ‘compileall’ -- Python ライブラリをバイトコンパイルする
--------------------------------------------------------------

'ソースコード:' Lib/compileall.py(1)

__________________________________________________________________

このモジュールは、Python ライブラリのインストールを助けるユーティリティ
関数群を提供します。この関数群は、ディレクトリツリー内の Python ソースフ
ァイルをコンパイルします。このモジュールを使って、キャッシュされたバイト
コードファイルをライブラリのインストール時に生成することで、ライブラリデ
ィレクトリに書き込み権限をもたないユーザでも、これらを利用できるようにな
ります。

*note Availability: 2199.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1bc9. を見てください。

* 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.33.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: ba0. setting.  The generated bytecode cache will
only be useful if ‘compile()’ is run with the same ‘sys.pycache_prefix’
(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.33.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: 118d.
     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: 2ee.
     will be raised.

     'invalidation_mode' は、*note py_compile.PycInvalidationMode: 500e.
     のメンバーでなければならず、生成された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: e4f.

     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: 118d. 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: 500e.
     のメンバーでなければならず、生成された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: e4f.

     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(): d1f.
     関数に渡されます。 その他の 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.33.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: 909.
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: 909. entries.

As a consequence, the presence of the *note CACHE: 909. 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: 20a. command-line option and the
‘show_positions’ argument were added.

The *note -S: 20b. 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.33.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.33.10.2 バイトコード解析
..........................

Added in version 3.4.

バイトコード解析の API を使うと、 Python のコード片を *note Bytecode:
206. オブジェクトでラップでき、コンパイルされたコードの細かいところに簡
単にアクセスできます。

 -- クラス: 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: 206. インスタンスに対し反復処理をしながら、バイトコード命
     令を *note Instruction: 205. インスタンスとして返します。

     'first_line' が ‘None’ でない場合は、それを逆アセンブルしたコードの
     ソースの最初の行に表示する行番号とします。 そうでない場合は、ソース
     の行の情報 (もしあれば) を逆アセンブルされたコードオブジェクトから
     直接取得します。

     'current_offset' が ‘None’ でない場合は、逆アセンブルされたコードで
     のあるインストラクションのオフセット位置を示します。 これを設定する
     と、 *note dis(): 1134. の出力において、指定された命令コード
     (opcode) に "現在の命令 (instruction)" を表す印が表示されます。

     If 'show_caches' is ‘True’, *note dis(): 1134. will display inline
     cache entries used by the interpreter to specialize the bytecode.

     If 'adaptive' is ‘True’, *note dis(): 1134. will display
     specialized bytecode that may be different from the original
     bytecode.

     If 'show_offsets' is ‘True’, *note dis(): 1134. will include
     instruction offsets in the output.

     If 'show_positions' is ‘True’, *note dis(): 1134. will include
     instruction source code positions in the output.

      -- メソッド: classmethod from_traceback (tb, *, show_caches=False)

          与えられたトレースバックから *note Bytecode: 206. インスタンス
          を構築し、 'current_offset' がその例外の原因となった命令となる
          よう設定します。

      -- データ: codeobj

          コンパイルされたコードオブジェクト。

      -- データ: first_line

          コードオブジェクトのソースの最初の行 (利用可能であれば)

      -- メソッド: dis ()

          バイトコード命令の整形された表示を返します (*note dis.dis():
          207. と同じ出力になりますが、複数行文字列として返されます)。

      -- メソッド: info ()

          *note code_info(): 1455. のようなコードオブジェクトの詳細を含
          んだ整形された複数行文字列を返します。

     バージョン 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.33.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: 205. からなる列を生成します。

     '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:
     205. 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(): 34e. 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(): 34e.
     method is used instead of the *note co_firstlineno: 23f0. and *note
     co_lnotab: 32e. 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’,
     ‘stack_effect()’ 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.33.10.4 Python バイトコード命令
.................................

*note get_instructions(): 4ec. 関数と *note Bytecode: 206. クラスはバイ
トコード命令の詳細を *note Instruction: 205. インスタンスの形で提供しま
す:

 -- クラス: dis.Instruction

     バイトコード命令の詳細

      -- データ: opcode

          以下の命令コードの値と *note 命令コードコレクション: 5045. の
          バイトコードの値に対応する、命令の数値コードです。

      -- データ: opname

          人間が読むための命令名

      -- データ: baseopcode

          numeric code for the base operation if operation is
          specialized; otherwise equal to *note opcode: 5044.

      -- データ: baseopname

          human readable name for the base operation if operation is
          specialized; otherwise equal to *note opname: 5049.

      -- データ: arg

          (ある場合は) 命令の数値引数、無ければ ‘None’

      -- データ: oparg

          alias for *note arg: 504a.

      -- データ: 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: 504e.

      -- データ: 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: 19a0. 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: 297. and *note BRANCH_RIGHT: 298. 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: 3c1. 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: ddd. 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: 4ddd. 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: ca5. 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:
     1e6c, 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(): 1802. call through the current frame.  If ‘STACK[-1]’ is
     an instance of *note StopIteration: df9, 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: 5067, *note LIST_APPEND: 5068, *note MAP_ADD: ca6. は、追
加した値または 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: 1270.

     バージョン 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: f55.
     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: a8c. 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: 187. 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: b64. statement to load *note AssertionError:
     8b9.

     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: a12.
     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:
     acb. (or, more technically: if it has the *note Py_TPFLAGS_MAPPING:
     1cb5. flag set in its *note tp_flags: 1cce.), 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:
     13e0. and is 'not' an instance of *note str: 16a./*note bytes:
     193./*note bytearray: 342. (or, more technically: if it has the
     *note Py_TPFLAGS_SEQUENCE: 1cb6. flag set in its *note tp_flags:
     1cce.), 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: 23ef. of the *note code object: 4e6.
     The compiler tries to use *note STORE_FAST: 1ac4. or *note
     STORE_GLOBAL: 5071. if possible.

 -- Opcode: DELETE_NAME (namei)

     Implements ‘del name’, where 'namei' is the index into *note
     co_names: 23ef. 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: 23ef. 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: 23ef. of
     the *note code object: 4e6.

 -- Opcode: STORE_GLOBAL (namei)

     *note STORE_NAME: 5070. と同じように動作しますが、 name をグローバ
     ルとして保存します。

 -- Opcode: DELETE_GLOBAL (namei)

     *note DELETE_NAME: 5072. と同じように動作しますが、グローバルの
     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:
     1abb.  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: 16b. 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: 16c. 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: 5078. と同じように動作しますが、この命令はリスト
     を作り出します。

 -- Opcode: BUILD_SET (count)

     *note BUILD_TUPLE: 5078. と同じように動作しますが、この命令は 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: 507d. 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: 916. or *note CALL_KW:
     370. 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(): 1a7, 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(): 1a7. (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: 3c1.

 -- 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__(): ad5.  The module object is pushed onto the
     stack.  The current namespace is not affected: for a proper import
     statement, a subsequent *note STORE_FAST: 1ac4. 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: 1ac4. 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: 3c1. 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: 3c1. 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__():
     14e9. 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: 1754.

 -- 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: 1754. 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: 23eb.

 -- 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: 5086.  This is used for loading *note
     closure variables: 18f6. 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: 23eb.

 -- Opcode: DELETE_DEREF (i)

     Empties the cell contained in slot ‘i’ of the "fast locals"
     storage.  Used by the *note del: 1b7e. statement.

     Added in version 3.2.

     バージョン 3.11 で変更: ‘i’ is no longer offset by the length of
     *note co_varnames: 23eb.

 -- Opcode: COPY_FREE_VARS (n)

     Copies the ‘n’ *note free (closure) variables: 18f6. 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: 370.

 -- 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: 508a.

 -- 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: 15e. 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(): 16a. on 'value'

        * ‘oparg == 2’: call *note repr(): 1c3. on 'value'

        * ‘oparg == 3’: call *note ascii(): 1604. 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: df9, 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: 1823.
                                             subscripted with the argument
                                             
                                             
     ‘INTRINSIC_TYPEALIAS’                   Creates a
                                             *note typing.TypeAliasType: 2b0.;
                                             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: 187. and *note async with: 186.
     constructs, which push the return value of the context manager's
     *note __enter__(): 7e4. or *note __aenter__(): 247d. 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: 5076, 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.33.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:
     18f6.  '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: 509a.

 -- データ: 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.33.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 ‘pickle’; ordinary users of the ‘pickle’ 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.33.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.33.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.33.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.34 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.34.1 ‘msvcrt’ -- MS VC++ ランタイムの有用なルーチン群
-------------------------------------------------------

__________________________________________________________________

このモジュールの関数は、 Windows プラットフォームの便利な機能のいくつか
に対するアクセス機構を提供しています。高レベルモジュールのいくつかは、提
供するサービスを Windows で実装するために、これらの関数を使っています。
例えば、 *note getpass: 66. モジュールは関数 *note getpass(): 66. を実装
するためにこのモジュールの関数を使います。

ここに挙げた関数の詳細なドキュメントについては、プラットフォーム API ド
キュメントで見つけることができます。

このモジュールは、通常版とワイド文字列版の両方のコンソールI/O APIを実装
しています。通常版の API は ASCII 文字列のためのもので、国際化アプリケー
ションでは利用が制限されます。可能な限りワイド文字列版APIを利用するべき
です。

*note Availability: 2199.: Windows.

バージョン 3.3 で変更: このモジュールの操作で以前は *note IOError: 1262.
が送出されていたところで *note OSError: 2c2. が送出されるようになりまし
た。

* Menu:

* ファイル操作関連::
* コンソール I/O 関連::
* その多の関数::


File: python.info,  Node: ファイル操作関連,  Next: コンソール I/O 関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.34.1.1 ファイル操作関連
.........................

 -- の関数: msvcrt.locking (fd, mode, nbytes)

     Lock part of a file based on file descriptor 'fd' from the C
     runtime.  Raises *note OSError: 2c2. 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 監査イベント: 1ccb.
     ‘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: 2c2. is
     raised.

 -- データ: msvcrt.LK_NBLCK
 -- データ: msvcrt.LK_NBRLCK

     指定されたバイト列にロックをかけます。指定領域がロックできなかった
     場合、 *note OSError: 2c2. が送出されます。

 -- データ: msvcrt.LK_UNLCK

     指定されたバイト列のロックを解除します。指定領域はあらかじめロック
     されていなければなりません。

 -- の関数: msvcrt.setmode (fd, flags)

     ファイル記述子 'fd' に対して、行末文字の変換モードを設定します。テ
     キストモードに設定するには、 'flags' を *note os.O_TEXT: 30d5. にし
     ます; バイナリモードにするには *note os.O_BINARY: 30c6. にします。

 -- の関数: 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:
     30c8, *note os.O_RDONLY: 30c4, *note os.O_TEXT: 30d5. and *note
     os.O_NOINHERIT: 30d0.  The returned file descriptor may be used as
     a parameter to *note os.fdopen(): 23dd. to create a file object.

     The file descriptor is inheritable by default.  Pass *note
     os.O_NOINHERIT: 30d0. flag to make it non inheritable.

     引数 ‘handle’, ‘flags’ を指定して *note 監査イベント: 1ccb.
     ‘msvcrt.open_osfhandle’ を送出します。

 -- の関数: msvcrt.get_osfhandle (fd)

     Return the file handle for the file descriptor 'fd'.  Raises *note
     OSError: 2c2. if 'fd' is not recognized.

     引数 ‘fd’ を指定して *note 監査イベント: 1ccb.
     ‘msvcrt.get_osfhandle’ を送出します。


File: python.info,  Node: コンソール I/O 関連,  Next: その多の関数,  Prev: ファイル操作関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.34.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(): 50c1. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.getche ()

     Similar to *note getch(): 50c1, but the keypress will be echoed if
     it represents a printable character.

 -- の関数: msvcrt.getwche ()

     *note getche(): 50c2. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.putch (char)

     バイト文字列 'char' をバッファリングを行わないでコンソールに出力し
     ます。

 -- の関数: msvcrt.putwch (unicode_char)

     *note putch(): 50c3. のワイド文字列版。Unicode の値を引数に取ります
     。

 -- の関数: msvcrt.ungetch (char)

     バイト文字列 'char' をコンソールバッファに "押し戻し (push back)" ま
     す; これにより、押し戻された文字は *note getch(): 50c1. や *note
     getche(): 50c2. で次に読み出される文字になります。

 -- の関数: msvcrt.ungetwch (unicode_char)

     *note ungetch(): 50c4. のワイド文字列版。Unicode の値を引数に取りま
     す。


File: python.info,  Node: その多の関数,  Prev: コンソール I/O 関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.34.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: 2c2.

 -- の関数: 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: 50ca.
     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(): 50ce. to specify *note
     CRTDBG_MODE_FILE: 50d0, 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(): 50cf. 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.34.2 ‘winreg’ -- Windows レジストリへのアクセス
-------------------------------------------------

__________________________________________________________________

これらの関数は Windows レジストリ API を Python から使えるようにします。
プログラマがレジストリハンドルを明示的にクローズするのを忘れた場合でも、
確実にハンドルがクローズされるようにするために、レジストリハンドルとして
整数値ではなく *note ハンドルオブジェクト: 50da. が使われます。

*note Availability: 2199.: Windows.

バージョン 3.3 で変更: このモジュールのいくつかの関数は以前は *note
WindowsError: 1264. を送出していました。それは今では *note OSError: 2c2.
の別名です。

* Menu:

* 関数: 関数<14>.
* 定数: 定数<12>.
* レジストリハンドルオブジェクト::


File: python.info,  Node: 関数<14>,  Next: 定数<12>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.1 関数
.............

このモジュールでは以下の関数を提供します:

 -- の関数: winreg.CloseKey (hkey)

     以前開かれたレジストリキーを閉じます。'hkey' 引数は以前開かれたレジ
     ストリキーを指定します。

          注釈: このメソッドを使って (または *note hkey.Close(): 50df. に
          よって) 'hkey' が閉じられなかった場合、Python が 'hkey' オブジ
          ェクトを破壊する際に閉じられます。

 -- の関数: winreg.ConnectRegistry (computer_name, key)

     他のコンピュータ上にある事前に定義されたレジストリハンドルとの接続
     を確立し、 *note ハンドルオブジェクト: 50da. を返します。

     'computer_name' はリモートコンピュータの名前で、‘r"\\computername"’
     の形式をとります。‘None’ の場合、ローカルのコンピュータが使われます
     。

     'key' は、事前に定義された接続先のハンドルです。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c2. 例外が送出されます。

     引数 ‘computer_name’, ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.ConnectRegistry’ を送出します。

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.CreateKey (key, sub_key)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 50da.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c2. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1ccb. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.CreateKeyEx (key, sub_key, reserved=0,
          access=KEY_WRITE)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 50da.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WRITE: 50e1. で
     す。その他の利用可能な値については *note アクセス権: 50e2. を参照し
     てください。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c2. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1ccb. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.OpenKey/result’ を送出します。

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.DeleteKey (key, sub_key)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' は文字列で、'key' 引数によって指定されたキーのサブキーで
     なければなりません。この値は ‘None’ であってはならず、キーはサブキ
     ーを持っていなくてもかまいません。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 2c2. 例外が
     送出されます。

     Raises an *note auditing event: 1ccb. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.DeleteKeyEx (key, sub_key, access=KEY_WOW64_64KEY,
          reserved=0)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' は 'key' 引数によって指定された key の subkey でなければ
     なりません。この値は ‘None’ であってはなりません。また、key は
     subkey を持たないかもしれません。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WOW64_64KEY:
     50e3. です。32 bit Windows では、WOW64 定数は無視されます。その他の
     利用可能な値については *note アクセス権: 50e2. を参照してください。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 2c2. 例外が
     送出されます。

     サポートされていない Windows バージョンでは、 *note
     NotImplementedError: 369. 例外を発生させます。

     Raises an *note auditing event: 1ccb. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.DeleteValue (key, value)

     レジストリキーから指定された名前つきの値を削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'value' は削除したい値を指定するための文字列です。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.DeleteValue’ を送出します。

 -- の関数: winreg.EnumKey (key, index)

     開かれているレジストリキーのサブキーを列挙し、文字列で返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'index' は整数値で、取得するキーのインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 2c2. 例外が
     送出されるまで繰り返し呼び出されます。

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.EnumKey’ を送出します。

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.EnumValue (key, index)

     開かれているレジストリキーの値を列挙し、タプルで返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'index' は整数値で、取得する値のインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 2c2. 例外が
     送出されるまで繰り返し呼び出されます。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     -------------------------------------------------------------
                 
     ‘0’         値の名前を指定する文字列
                 
                 
     ‘1’         値のデータを保持するためのオブジェクトで、その
                 型は背後のレジストリ型に依存します
                 
                 
     ‘2’         値のデータ型を指定する整数です
                 (*note SetValueEx(): 1b61. のドキュメント内の
                 テーブルを参照してください)
                 

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.EnumValue’ を送出します。

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.ExpandEnvironmentStrings (str)

     *note REG_EXPAND_SZ: 50e4. のように、環境変数プレースホルダ
     ‘%NAME%’ を文字列で展開します:

          >>> ExpandEnvironmentStrings('%windir%')
          'C:\\Windows'

     引数 ‘str’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.ExpandEnvironmentStrings’ を送出します。

 -- の関数: winreg.FlushKey (key)

     キーのすべての属性をレジストリに書き込みます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     キーを変更するために *note FlushKey(): 50e5. を呼ぶ必要はありません
     。レジストリの変更は怠惰なフラッシュ機構 (lazy flusher) を使ってフ
     ラッシュされます。また、システムの遮断時にもディスクにフラッシュさ
     れます。 *note CloseKey(): 50de. と違って、 ‘FlushKey()’ メソッドは
     レジストリに全てのデータを書き終えたときにのみ返ります。アプリケー
     ションは、レジストリへの変更を絶対に確実にディスク上に反映させる必
     要がある場合にのみ、 ‘FlushKey()’ を呼ぶべきです。

          注釈: *note FlushKey(): 50e5. を呼び出す必要があるかどうか分か
          らない場合、おそらくその必要はありません。

 -- の関数: winreg.LoadKey (key, sub_key, file_name)

     指定されたキーの下にサブキーを生成し、サブキーに指定されたファイル
     のレジストリ情報を記録します。

     'key' は *note ConnectRegistry(): 4ae9. が返したハンドルか、定数
     *note HKEY_USERS: 50e6. と *note HKEY_LOCAL_MACHINE: 50e7. のどちら
     かです。

     'sub_key' は記録先のサブキーを指定する文字列です。

     'file_name' はレジストリデータを読み出すためのファイル名です。この
     ファイルは *note SaveKey(): 4af4. 関数で生成されたファイルでなくて
     はなりません。ファイル割り当てテーブル (FAT) ファイルシステム下では
     、ファイル名は拡張子を持っていてはなりません。

     A call to *note LoadKey(): 4aef. 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(): 4ae9. によって返されたハンドルの
     場合、 'file_name' に指定されたパスはリモートコンピュータに対する相
     対パス名になります。

     引数 ‘key’, ‘sub_key’, ‘file_name’ を指定して *note 監査イベント:
     1ccb. ‘winreg.LoadKey’ を送出します。

 -- の関数: winreg.OpenKey (key, sub_key, reserved=0, access=KEY_READ)
 -- の関数: winreg.OpenKeyEx (key, sub_key, reserved=0, access=KEY_READ)

     指定されたキーを開き、 *note ハンドルオブジェクト: 50da. を返します
     。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' は開くサブキーを指定する文字列です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_READ: 50e9. で
     す。その他の利用可能な値については *note アクセス権: 50e2. を参照し
     てください。

     指定されたキーへの新しいハンドルが返されます。

     この関数が失敗すると、 *note OSError: 2c2. が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1ccb. ‘winreg.OpenKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.2 で変更: 名前付き引数が使用できるようになりました。

     バージョン 3.3 で変更: *note 上記: 50db. を参照。

 -- の関数: winreg.QueryInfoKey (key)

     キーに関する情報をタプルとして返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     --------------------------------------------------------------
                 
     ‘0’         このキーが持つサブキーの数を表す整数。
                 
                 
     ‘1’         このキーが持つ値の数を表す整数。
                 
                 
     ‘2’         最後のキーの変更が (あれば) いつだったかを表す
                 整数で、1601 年 1 月 1 日からの 100 ナノ秒単位
                 で数えたもの。
                 

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.QueryInfoKey’ を送出します。

 -- の関数: winreg.QueryValue (key, sub_key)

     キーに対する、名前付けられていない値を文字列で取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を保持する文字列で
     す。この引数が ‘None’ または空文字列の場合、この関数は 'key' で指定
     されたキーに対して *note SetValue(): 4af5. メソッドで設定された値を
     取得します。

     レジストリ中の値は名前、型、およびデータから構成されています。この
     メソッドはあるキーのデータ中で、名前 ‘NULL’ をもつ最初の値を取得し
     ます。しかし背後のAPI 呼び出しは型情報を返しません。なので、可能な
     らいつでも *note QueryValueEx(): 17f4. を使うべきです。

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1ccb. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.QueryValueEx (key, value_name)

     開かれたレジストリキーに関連付けられている、指定した名前の値に対し
     て、型およびデータを取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'value_name' は要求する値を指定する文字列です。

     結果は 2 つの要素からなるタプルです:

     インデッ    意味
     クス        

     ----------------------------------------------------------
                 
     ‘0’         レジストリ要素の値。
                 
                 
     ‘1’         この値のレジストリ型を表す整数。
                 (*note SetValueEx(): 1b61. のドキュメント内
                 のテーブルを参照してください。)
                 

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1ccb. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.SaveKey (key, file_name)

     指定されたキーと、そのサブキー全てを指定したファイルに保存します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'file_name' はレジストリデータを保存するファイルの名前です、このフ
     ァイルはすでに存在していてはいけません。このファイル名が拡張子を含
     んでいる場合、 *note LoadKey(): 4aef. メソッドは、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 監査イベント: 1ccb.
     ‘winreg.SaveKey’ を送出します。

 -- の関数: winreg.SetValue (key, sub_key, type, value)

     値を指定したキーに関連付けます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を表す文字列です。

     'type' はデータの型を指定する整数です。現状では、この値は *note
     REG_SZ: 50ea. でなければならず、これは文字列だけがサポートされてい
     ることを示します。他のデータ型をサポートするには *note
     SetValueEx(): 1b61. を使ってください。

     'value' は新たな値を指定する文字列です。

     'sub_key' 引数で指定されたキーが存在しなければ、SetValue 関数で生成
     されます。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     'key' 引数に指定されたキーは *note KEY_SET_VALUE: 50eb. アクセスで
     開かれていなければなりません。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1ccb. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.SetValueEx (key, value_name, reserved, type, value)

     開かれたレジストリキーの値フィールドにデータを記録します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     'value_name' は値が関連付けられているサブキーの名前を表す文字列です
     。

     'reserved' は何もしません - API には常にゼロが渡されます。

     'type' はデータの型を指定する整数です。利用できる型については *note
     値の型: 50ec. を参照してください。

     'value' は新たな値を指定する文字列です。

     このメソッドではまた、指定されたキーに対して、さらに別の値や型情報
     を設定することができます。 'key' 引数で指定されたキーは *note
     KEY_SET_VALUE: 50eb. アクセスで開かれていなければなりません。

     キーを開くには、 *note CreateKey(): 4aea. または *note OpenKey():
     4af0. メソッドを使ってください。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1ccb. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.DisableReflectionKey (key)

     64ビット OS上で動作している 32bit プロセスに対するレジストリリフレ
     クションを無効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 369. 例外を発生さ
     せます。

     key がリフレクションリストに無い場合は、この関数は成功しますが効果
     はありません。あるキーのリフレクションを無効にしても、そのキーのサ
     ブキーのリフレクションには全く影響しません。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.DisableReflectionKey’ を送出します。

 -- の関数: winreg.EnableReflectionKey (key)

     指定された、リフレクションが無効にされたキーのリフレクションを再び
     有効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 369. 例外を発生さ
     せます。

     あるキーのリフレクションを再開しても、その全てのサブキーには影響し
     ません。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘winreg.EnableReflectionKey’ を送出します。

 -- の関数: winreg.QueryReflectionKey (key)

     指定されたキーのリフレクション状態を確認します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 50e0. のう
     ちの一つです。

     リフレクションが無効になっている場合、‘True’ を返します。

     32bit OS上では一般的に *note NotImplementedError: 369. 例外を発生さ
     せます。

     引数 ‘key’ を指定して *note 監査イベント: 1ccb.
     ‘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: 定数<12>,  Next: レジストリハンドルオブジェクト,  Prev: 関数<14>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.2 定数
.............

The following constants are defined for use in many ‘winreg’ functions.

* Menu:

* HKEY_* 定数::
* アクセス権限::
* 値の型::


File: python.info,  Node: HKEY_* 定数,  Next: アクセス権限,  Up: 定数<12>

5.34.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: 定数<12>

5.34.2.4 アクセス権限
.....................

より詳しい情報については、 Registry Key Security and Access(1) を参照し
てください。

 -- データ: winreg.KEY_ALL_ACCESS

     STANDARD_RIGHTS_REQUIRED (*note KEY_QUERY_VALUE: 50f7, *note
     KEY_SET_VALUE: 50eb, *note KEY_CREATE_SUB_KEY: 50f8, *note
     KEY_ENUMERATE_SUB_KEYS: 50f9, *note KEY_NOTIFY: 50fa, *note
     KEY_CREATE_LINK: 50fb.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_WRITE

     STANDARD_RIGHTS_WRITE (*note KEY_SET_VALUE: 50eb, *note
     KEY_CREATE_SUB_KEY: 50f8.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_READ

     STANDARD_RIGHTS_READ (*note KEY_QUERY_VALUE: 50f7, *note
     KEY_ENUMERATE_SUB_KEYS: 50f9, *note KEY_NOTIFY: 50fa.) アクセス権限
     の組み合わせ。

 -- データ: winreg.KEY_EXECUTE

     *note KEY_READ: 50e9. と同じ。

 -- データ: 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.34.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: 定数<12>

5.34.2.6 値の型
...............

より詳しい情報については、 Registry Value Types(1) を参照してください。

 -- データ: winreg.REG_BINARY

     何らかの形式のバイナリデータ。

 -- データ: winreg.REG_DWORD

     32 ビットの数。

 -- データ: winreg.REG_DWORD_LITTLE_ENDIAN

     32 ビットのリトルエンディアン形式の数。*note REG_DWORD: 5102. と等
     価。

 -- データ: 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: f03. と等価
     。

     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: 定数<12>,  Up: winreg --- Windows レジストリへのアクセス

5.34.2.7 レジストリハンドルオブジェクト
.......................................

このオブジェクトは Windows の HKEY オブジェクトをラップし、オブジェクト
が破壊されたときに自動的にハンドルを閉じます。オブジェクトの *note
Close(): 50df. メソッドと *note CloseKey(): 50de. 関数のどちらも、後始末
がきちんと行われることを保証するために呼び出すことができます。

このモジュールのレジストリ関数は全て、これらのハンドルオブジェクトの一つ
を返します。

このモジュールのレジストリ関数でハンドルオブジェクトを受理するものは全て
整数も受理しますが、ハンドルオブジェクトを利用することを推奨します。

Handle objects provide semantics for *note __bool__(): 14f1. - thus

     if handle:
         print("Yes")

は、ハンドルが現在有効な (閉じられたり切り離されたりしていない) 場合には
‘Yes’ となります。

ハンドルオブジェクトは (例えば組み込みの *note int(): 19c. 関数を使って)
整数に変換することができます。この場合、背後の Windows ハンドル値が返さ
れます、また、 *note Detach(): 4af1. メソッドを使って整数のハンドル値を
返させると同時に、ハンドルオブジェクトから Windows ハンドルを切り離すこ
ともできます。

 -- メソッド: PyHKEY.Close ()

     背後の Windows ハンドルを閉じます。

     ハンドルがすでに閉じられていてもエラーは送出されません。

 -- メソッド: PyHKEY.Detach ()

     ハンドルオブジェクトから Windows ハンドルを切り離します。

     切り離される以前にそのハンドルを保持していた整数オブジェクトが返さ
     れます。ハンドルがすでに切り離されていたり閉じられていたりした場合
     、ゼロが返されます。

     この関数を呼び出した後、ハンドルは確実に無効化されますが、閉じられ
     るわけではありません。背後の Win32 ハンドルがハンドルオブジェクトよ
     りも長く維持される必要がある場合にはこの関数を呼び出すとよいでしょ
     う。

     Raises an *note auditing event: 1ccb. ‘winreg.PyHKEY.Detach’ with
     argument ‘key’.

 -- メソッド: PyHKEY.__enter__ ()
 -- メソッド: PyHKEY.__exit__ (*exc_info)

     HKEY オブジェクトは *note __enter__(): 7e4, *note __exit__(): 151c.
     メソッドを実装していて、 *note with: 187. 文のためのコンテキストプ
     ロトコルをサポートしています:

          with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key:
              ...  # work with key

     このコードは、 *note with: 187. ブロックから抜けるときに自動的に
     'key' を閉じます。


File: python.info,  Node: winsound --- Windows 用の音声再生インターフェース,  Prev: winreg --- Windows レジストリへのアクセス,  Up: MS Windows 固有のサービス

5.34.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: 2199.: Windows.

 -- の関数: winsound.Beep (frequency, duration)

     PC のスピーカを鳴らします。引数 'frequency' は鳴らす音の周波数の指
     定で、単位は Hz です。値は 37 から 32,767 でなくてはなりません。引
     数 'duration' は音を何ミリ秒鳴らすかの指定です。システムがスピーカ
     を鳴らすことができない場合、例外 *note RuntimeError: 246. が送出さ
     れます。

 -- の関数: winsound.PlaySound (sound, flags)

     プラットフォームの API から関数 ‘PlaySound()’ を呼び出します。引数
     'sound' はファイル名、システム音エイリアス、音声データの *note
     bytes-like オブジェクト: 194.、または ‘None’ をとり得ます。 'sound'
     の解釈は 'flags' の値に依存します。この値は以下に述べる定数をビット
     単位OR して組み合わせたものになります。 'sound' 引数が ‘None’ だっ
     た場合、現在再生中のWave形式サウンドの再生を停止します。システムの
     エラーが発生した場合、例外 *note RuntimeError: 246. が送出されます
     。

 -- の関数: winsound.MessageBeep (type=MB_OK)

     根底にある ‘MessageBeep()’ 関数をプラットフォームの API から呼び出
     します。この関数は音声をレジストリの指定に従って再生します。 'type'
     引数はどの音声を再生するかを指定します; とり得る値は ‘-1’,
     ‘MB_ICONASTERISK’, ‘MB_ICONEXCLAMATION’, ‘MB_ICONHAND’,
     ‘MB_ICONQUESTION’,および ‘MB_OK’ で、全て以下に記述されています。値
     ‘-1’ は "単純なビープ音" を再生します; この値は他の場合で音声を再生
     することができなかった際の最終的な代替音です。システムがエラーを示
     したら、*note RuntimeError: 246. が送出されます。

 -- データ: winsound.SND_FILENAME

     'sound' パラメタが WAV ファイル名であることを示します。 *note
     SND_ALIAS: 5112. と同時に使ってはいけません。

 -- データ: winsound.SND_ALIAS

     引数 'sound' はレジストリにある音声データに関連付けられた名前である
     ことを示します。指定した名前がレジストリ上にない場合、定数 *note
     SND_NODEFAULT: 5113. が同時に指定されていない限り、システム標準の音
     声データが再生されます。標準の音声データが登録されていない場合、例
     外 *note RuntimeError: 246. が送出されます。 *note SND_FILENAME:
     5111. と同時に使ってはいけません。

     全ての Win32 システムは少なくとも以下の名前をサポートします; ほとん
     どのシステムでは他に多数あります:

     *note PlaySound(): f07.        対応するコントロールパネルでの音声名
     '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: 5115. フラグを同時に使わなくてはなりません
     。 *note SND_MEMORY: 5116. と同時に使うことはできません。

 -- データ: winsound.SND_MEMORY

     *note PlaySound(): f07. の引数 'sound' が *note bytes-like
     オブジェクト: 194. の形式をとった WAV ファイルのメモリ上のイメージ
     であることを示します。

          注釈: このモジュールはメモリ上のイメージを非同期に再生する機能
          をサポートしていません。従って、このフラグと *note SND_ASYNC:
          5115. を組み合わせると例外 *note RuntimeError: 246. が送出され
          ます。

 -- データ: 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:
     5112. 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.35 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.35.1 ‘shlex’ -- 単純な字句解析
--------------------------------

'ソースコード:' Lib/shlex.py(1)

__________________________________________________________________

*note shlex: ecc. クラスは Unix シェルに似た、単純な構文に対する字句解析
器を簡単に書けるようにします。このクラスはしばしば、 Python アプリケーシ
ョンのための実行制御ファイルのような小規模言語を書く上で便利です。

The ‘shlex’ module defines the following functions:

 -- の関数: shlex.split (s, comments=False, posix=True)

     シェルに似た文法を使って、文字列 's' を分割します。 'comments' が
     *note False: d2f. (デフォルト値) の場合、受理した文字列内のコメント
     を解析しません (*note shlex: ecc. インスタンスの *note commenters:
     512d. メンバの値を空文字列にします)。この関数はデフォルトでは 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 ‘quote()’ 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(): d83. 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 ‘shlex’ 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(): 20c8. and *note readline(): 177c. 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: 512e. 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
     ‘shlex’ instance will operate in compatibility mode.  When
     operating in POSIX mode, ‘shlex’ 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:
     512f. attribute that appear in 'punctuation_chars' will be removed
     from ‘wordchars’.  See *note Improved Compatibility with Shells:
     ecd. for more information.  'punctuation_chars' can be set only
     upon ‘shlex’ 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.35.1.1 shlex オブジェクト
...........................

*note shlex: ecc. インスタンスは以下のメソッドを持っています:

 -- メソッド: shlex.get_token ()

     トークンを一つ返します。トークンが *note push_token(): 5133. で使っ
     てスタックに積まれていた場合、トークンをスタックからポップします。
     そうでない場合、トークンを一つ入力ストリームから読み出します。読み
     出し即時にファイル終了子に遭遇した場合、 *note eof: 5134. (非 POSIX
     モードでは空文字列 (‘''’)、POSIX モードでは ‘None’) が返されます。

 -- メソッド: shlex.push_token (str)

     トークンスタックに引数文字列をスタックします。

 -- メソッド: shlex.read_token ()

     生 (raw) のトークンを読み出します。プッシュバックスタックを無視し、
     かつソースリクエストを解釈しません (通常これは便利なエントリポイン
     トではありません。完全性のためにここで記述されています)。

 -- メソッド: shlex.sourcehook (filename)

     *note shlex: ecc. がソースリクエスト (下の *note source: 5137. を参
     照してください) を検出した際、このメソッドはその後に続くトークンを
     引数として渡され、ファイル名と開かれたファイル類似オブジェクトから
     なるタプルを返すとされています。

     通常、このメソッドはまず引数から何らかのクオートを取り除きます。処
     理後の引数が絶対パス名であった場合か、以前に有効になったソースリク
     エストが存在しない場合か、以前のソースが (‘sys.stdin’ のような) ス
     トリームであった場合、この結果はそのままにされます。そうでない場合
     で、処理後の引数が相対パス名の場合、ソースインクルードスタックにあ
     る直前のファイル名からディレクトリ部分が取り出され、相対パスの前の
     部分に追加されます (この動作は C 言語プリプロセッサにおける
     ‘#include "file.h"’ の扱いと同様です)。

     これらの操作の結果はファイル名として扱われ、タプルの最初の要素とし
     て返されます。同時にこのファイル名で *note open(): 318. を呼び出し
     た結果が二つ目の要素になります (注意: インスタンス初期化のときとは
     引数の並びが逆になっています！)

     このフックはディレクトリサーチパスや、ファイル拡張子の追加、その他
     の名前空間に関するハックを実装できるようにするために公開されていま
     す。 'close' フックに対応するものはありませんが、shlex インスタンス
     はソースリクエストされている入力ストリームが EOF を返した時には
     *note close(): 506. を呼び出します。

     ソーススタックをより明示的に操作するには、 *note push_source():
     5138. および *note pop_source(): 5139. メソッドを使ってください。

 -- メソッド: shlex.push_source (newstream, newfile=None)

     入力ソースストリームを入力スタックにプッシュします。ファイル名引数
     が指定された場合、以後のエラーメッセージ中で利用することができます
     。 *note sourcehook(): 5136. メソッドが内部で使用しているのと同じメ
     ソッドです。

 -- メソッド: 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: ecc. サブクラスのインスタンスは、字句解析を制御したり、デバ
ッグに使えるような 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: 1e12. 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: 513b. is set to ‘True’,
     this will have no effect.

 -- の属性: shlex.whitespace

     空白と見なされ、読み飛ばされる文字群です。空白はトークンの境界を作
     ります。標準では、スペース、タブ、改行 (linefeed) および復帰
     (carriage-return) が入っています。

 -- の属性: shlex.escape

     エスケープ文字と見なされる文字群です。これは POSIX モードでのみ使わ
     れ、デフォルトでは ‘'\'’ だけが入っています。

 -- の属性: shlex.quotes

     文字列引用符と見なされる文字群です。トークンを構成する際、同じクオ
     ートが再び出現するまで文字をバッファに蓄積します (すなわち、異なる
     クオート形式はシェル中で互いに保護し合う関係にあります)。標準では、
     ASCII 単引用符および二重引用符が入っています。

 -- の属性: shlex.escapedquotes

     *note quotes: 513e. のうち、 *note escape: 513d. で定義されたエスケ
     ープ文字を解釈する文字群です。これは 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:
     ecc, getting tokens in a similar way to shell arguments.  When used
     in combination with *note punctuation_chars: 1e12, tokens will be
     split on whitespace in addition to those characters.

     バージョン 3.8 で変更: The *note punctuation_chars: 1e12. attribute
     was made compatible with the *note whitespace_split: 513b.
     attribute.

 -- の属性: shlex.infile

     現在の入力ファイル名です。クラスのインスタンス化時に初期設定される
     か、その後のソースリクエストでスタックされます。エラーメッセージを
     構成する際にこの値を調べると便利なことがあります。

 -- の属性: shlex.instream

     *note shlex: ecc. インスタンスが文字を読み出している入力ストリーム
     です。

 -- の属性: shlex.source

     このメンバ変数は標準で *note None: 886. を取ります。この値に文字列
     を代入すると、その文字列は多くのシェルにおける ‘source’ キーワード
     に似た、字句解析レベルでのインクルード要求として認識されます。すな
     わち、その直後に現れるトークンをファイル名として新たなストリームを
     開き、そのストリームを入力として、EOF に到達するまで読み込まれます
     。新たなストリームの EOF に到達した時点で *note close(): 506. が呼
     び出され、入力は元の入力ストリームに戻されます。ソースリクエストは
     任意のレベルの深さまでスタックしてかまいません。

 -- の属性: shlex.debug

     このメンバ変数が数値で、かつ ‘1’ またはそれ以上の値の場合、 *note
     shlex: ecc. インスタンスは動作に関する冗長な進捗報告を出力します。
     この出力を使いたいなら、モジュールのソースコードを読めば詳細を学ぶ
     ことができます。

 -- の属性: 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.35.1.2 解析規則
.................

When operating in non-POSIX mode, *note shlex: ecc. will try to obey the
following rules.

   * ワード内の引用符を認識しない (‘Do"Not"Separate’ は単一ワード
     ‘Do"Not"Separate’ として解析されます)

   * エスケープ文字を認識しない

   * 引用符で囲まれた文字列は、引用符内の全ての文字リテラルを保持する

   * 閉じ引用符でワードを区切る (‘"Do"Separate’ は、 ‘"Do"’ と
     ‘Separate’ であると解析されます)

   * *note whitespace_split: 513b. が ‘False’ の場合、wordchar、
     whitespace または quote として宣言されていない全ての文字を、単一の
     文字トークンとして返す。 ‘True’ の場合、 *note shlex: ecc. は空白文
     字でのみ単語を区切る。

   * 空文字列 (‘''’) で EOF を送出する

   * 引用符に囲んであっても、空文字列を解析しない

When operating in POSIX mode, *note shlex: ecc. will try to obey the
following parsing rules.

   * 引用符を取り除き、引用符で単語を分解しない (‘"Do"Not"Separate"’ は
     単一ワード ‘DoNotSeparate’ として解析されます)

   * 引用符で囲まれないエスケープ文字群 (‘'\'’ など) は直後に続く文字の
     リテラル値を保持する

   * *note escapedquotes: 513f. でない引用符文字 (‘"'"’ など) で囲まれて
     いる全ての文字のリテラル値を保持する

   * Enclosing characters in quotes which are part of *note
     escapedquotes: 513f. (e.g.  ‘'"'’)  preserves the literal value of
     all characters within the quotes, with the exception of the
     characters mentioned in *note escape: 513d.  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: 886. で EOF を送出する

   * 引用符に囲まれた空文字列 (‘''’) を許す。


File: python.info,  Node: Improved Compatibility with Shells,  Prev: 解析規則,  Up: shlex --- 単純な字句解析

5.35.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:
     512f. 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: 513b.
     when using *note punctuation_chars: 1e12, which will negate *note
     wordchars: 512f. entirely.

For best effect, ‘punctuation_chars’ should be set in conjunction with
‘posix=True’.  (Note that ‘posix=False’ is the default for *note shlex:
ecc.)


File: python.info,  Node: posix --- 最も一般的な POSIX システムコール群,  Next: pwd --- パスワードデータベース,  Prev: shlex --- 単純な字句解析,  Up: Unix-specific services

5.35.2 ‘posix’ -- 最も一般的な POSIX システムコール群
-----------------------------------------------------

__________________________________________________________________

このモジュールはオペレーティングシステムの機能のうち、C 言語標準および
(Unix インターフェースをほんの少し隠蔽した) POSIX 標準で標準化されている
機能に対するアクセス機構を提供します。

*note Availability: 2199.: 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 ‘os’ 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 ‘os’ interface.  Once ‘os’ is
imported, there is 'no' performance penalty in using it instead of
‘posix’.  In addition, ‘os’ provides some additional functionality, such
as automatically calling *note putenv(): 25d. when an entry in
‘os.environ’ is changed.

エラーは例外として報告されます; よくある例外は型エラーです。一方、システ
ムコールから報告されたエラーは以下に述べるように *note OSError: 2c2. を
送出します。

* Menu:

* ラージファイルのサポート::
* 注目すべきモジュールの内容::


File: python.info,  Node: ラージファイルのサポート,  Next: 注目すべきモジュールの内容,  Up: posix --- 最も一般的な POSIX システムコール群

5.35.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.35.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(): 3094. 、 *note popen(): 31c.
     、 *note system(): 167b. で渡された環境変数文字列には影響は与えませ
     ん; 環境変数を変更したい場合は、 ‘environ’ を *note execve(): 1315.
     に渡すか、変数への代入文と export 文を ‘system()’ や ‘popen()’ に渡
     すコマンド文字列に追加してください。

     バージョン 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: 25b.
          will render this dictionary obsolete.  Use of the ‘os’ 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.35.3 ‘pwd’ -- パスワードデータベース
--------------------------------------

__________________________________________________________________

このモジュールは Unix のユーザアカウントとパスワードのデータベースへのア
クセスを提供します。全ての Unix 系 OS で利用できます。

*note Availability: 2199.: 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.35.4 ‘grp’ -- グループデータベース
------------------------------------

__________________________________________________________________

このモジュールでは Unix グループ (group) データベースへのアクセス機構を
提供します。全ての Unix バージョンで利用可能です。

*note Availability: 2199.: 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(): 37e2. や *note getgrgid():
f26. でアクセスできないかもしれないことにも注意してください。)

このモジュールでは以下の内容を定義しています:

 -- の関数: grp.getgrgid (id)

     与えられたグループ ID に対するグループデータベースエントリを返しま
     す。要求したエントリが見つからなかった場合、 *note KeyError: 5e7. が
     送出されます。

     バージョン 3.10 で変更: 浮動小数点数や文字列のような、整数でない引
     数には *note TypeError: 199. が送出されます。

 -- の関数: 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.35.5 ‘termios’ -- POSIX スタイルの端末制御
--------------------------------------------

__________________________________________________________________

このモジュールでは端末 I/O 制御のための POSIX 準拠の関数呼び出しインター
フェースを提供します。これら呼び出しのための完全な記述については、 Unix
マニュアルページの ‘termios(3)(1)’ を参照してください。これは POSIX
'termios' 形式の端末制御をサポートしていてインストール時に有効にした
Unix のバージョンでのみ利用可能です。

*note Availability: 2199.: Unix.

このモジュールの関数は全て、ファイル記述子 'fd' を最初の引数としてとりま
す。この値は、 ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも
、 ‘sys.stdin’ 自体のような *note file object: 13df. でもかまいません。

このモジュールではまた、モジュールで提供されている関数を使う上で必要とな
る全ての定数を定義しています; これらの定数は 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(): 1a53.  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(): 5160.  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: 107. モジュール

     一般的な端末制御操作のための便利な関数。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/termios(3)


File: python.info,  Node: 使用例<51>,  Up: termios --- POSIX スタイルの端末制御

5.35.5.1 使用例
...............

以下はエコーバックを切った状態でパスワード入力を促す関数です。ユーザの入
力に関わらず以前の端末属性を正確に回復するために、二つの *note
tcgetattr(): 1a53. と *note try: 8f9. ...  *note finally: 1b1. 文による
テクニックが使われています:

     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.35.6 ‘tty’ -- 端末制御用の関数群
----------------------------------

'ソースコード:' Lib/tty.py(1)

__________________________________________________________________

The ‘tty’ module defines functions for putting the tty into cbreak and
raw modes.

*note Availability: 2199.: 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(): 1a53, 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(): 1a53, 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(): 1a55. 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: 515b, and is
     passed to *note termios.tcsetattr(): 1aca.  The return value of
     *note termios.tcgetattr(): 1a53. 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: 515b, and is
     passed to *note termios.tcsetattr(): 1aca.  The return value of
     *note termios.tcgetattr(): 1a53. 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.35.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: 2199.: 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: 112.

 -- の関数: pty.openpty ()

     新しい擬似端末のペアを開きます。利用できるなら *note os.openpty():
     30db. を使い、利用できなければ一般的な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(): f9e. on the
     child process.

     *note os.waitstatus_to_exitcode(): b1b. can be used to convert the
     exit status into an exit code.

     引数 ‘argv’ を指定して *note 監査イベント: 1ccb. ‘pty.spawn’ を送出
     します。

     バージョン 3.4 で変更: *note spawn(): 1188. が *note os.waitpid():
     f9e. が返す子プロセスのステータス値を返すようになりました。

* Menu:

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

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pty.py


File: python.info,  Node: 使用例<52>,  Up: pty --- 擬似端末ユーティリティ

5.35.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.35.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: 2199.: Unix, not WASI.

このモジュール内の全ての関数はファイル記述子 'fd' を最初の引数に取ります
。 この値は ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも、
‘sys.stdin’ 自体のような、純粋にファイル記述子だけを返す *note fileno():
181b. メソッドを提供している *note io.IOBase: 505. オブジェクトでもかま
いません。

バージョン 3.3 で変更: 以前は *note IOError: 1262. を送出していたこのモ
ジュールの操作が、 *note OSError: 2c2. を送出するようになりました。

バージョン 3.8 で変更: The ‘fcntl’ module now contains ‘F_ADD_SEALS’,
‘F_GET_SEALS’, and ‘F_SEAL_*’ constants for sealing of *note
os.memfd_create(): c02. 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(): 181b. 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: 194, 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(): 1492.  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: 193. 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: 2c2. 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 監査イベント: 1ccb.
     ‘fcntl.fcntl’ を送出します。

     バージョン 3.14 で変更: Add support of arbitrary *note bytes-like
     objects: 194, not only *note bytes: 193.

 -- の関数: fcntl.ioctl (fd, request, arg=0, mutate_flag=True, /)

     この関数は *note fcntl(): 18b6. 関数と同じですが、引数の扱いがより
     複雑であるところが異なります。

     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:
     194, 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(): 18b6.
     function.

     If 'arg' supports the read-write buffer interface (like *note
     bytearray: 342.) 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
     ‘ioctl()’ and copied back into the supplied buffer.

     If the ‘ioctl()’ call fails, an *note OSError: 2c2. 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 監査イベント: 1ccb.
     ‘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(): 181b. メソッドを提供しているフ
     ァイルオブジェクトも含む) に対してロック操作 'operation' を実行しま
     す。 詳細は Unix マニュアルの ‘flock(2)(3)’ を参照してください (シ
     ステムによっては、この関数は ‘fcntl()’ を使ってエミュレーションされ
     ています)。

     If the ‘flock()’ call fails, an *note OSError: 2c2. exception is
     raised.

     引数 ‘fd’, ‘operation’ を指定して *note 監査イベント: 1ccb.
     ‘fcntl.flock’ を送出します。

 -- の関数: fcntl.lockf (fd, cmd, len=0, start=0, whence=0, /)

     本質的に *note fcntl(): 18b6. によるロッキングの呼び出しをラップし
     たものです。 'fd' はロックまたはアンロックするファイルのファイル記
     述子 (*note fileno(): 181b. メソッドを提供するファイルオブジェクト
     も受け付けられます) で、 '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: 2c2. will be raised and the exception will have an 'errno'
     attribute set to *note EACCES: 2763. or *note EAGAIN: 2754.
     (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(): 14a8. と同じで、具体的には:

        * ‘0’ - relative to the start of the file (*note os.SEEK_SET:
          14a9.)

        * ‘1’ - relative to the current buffer position (*note
          os.SEEK_CUR: 14aa.)

        * ‘2’ - relative to the end of the file (*note os.SEEK_END:
          14ab.)

     'start' の標準の値は 0 で、ファイルの先頭から開始することを意味しま
     す。'len' の標準の値は 0 で、ファイルの終了までロックすることを表し
     ます。'whence' の標準の値も 0 です。

     引数 ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’ を指定して *note
     監査イベント: 1ccb. ‘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: 193. オブジェクトを保持しています。 'lockdata' 変数の構造体レイア
ウトはシステム依存です -- 従って *note flock(): 4ae1. を呼ぶ方が良いでし
ょう。

参考
....

*note os: a5. モジュール

     If the locking flags *note O_SHLOCK: 164d. and *note O_EXLOCK:
     164e. are present in the *note os: a5. module (on BSD only), the
     *note os.open(): f96. function provides an alternative to the *note
     lockf(): 160a. and *note flock(): 4ae1. 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.35.9 ‘resource’ -- リソース使用情報
-------------------------------------

__________________________________________________________________

このモジュールでは、プログラムによって使用されているシステムリソースを計
測したり制御するための基本的なメカニズムを提供します。

*note Availability: 2199.: Unix, not WASI.

特定のシステムリソースを指定したり、現在のプロセスやその子プロセスのリソ
ース使用情報を要求するためにシンボル定数が使われます。

システムコールが失敗した場合 *note OSError: 2c2. を送出します。

 -- 例外: resource.error

     *note OSError: 2c2. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c2. のエイリアスになりました。

* Menu:

* リソースの制限::
* リソースの使用状態::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: リソースの制限,  Next: リソースの使用状態,  Up: resource --- リソース使用情報

5.35.9.1 リソースの制限
.......................

リソースの使用は下に述べる *note setrlimit(): 1831. 関数を使って制限する
ことができます。各リソースは二つ組の制限値: ソフトリミット (soft limit)
、およびハードリミット (hard limit) 、で制御されます。ソフトリミットは現
在の制限値で、時間とともにプロセスによって下げたり上げたりできます。ソフ
トリミットはハードリミットを超えることはできません。ハードリミットはソフ
トリミットよりも高い任意の値まで下げることができますが、上げることはでき
ません。 (スーパユーザの有効な UID を持つプロセスのみがハードリミットを
上げることができます。)

制限をかけるべく指定できるリソースはシステムに依存します。指定できるリソ
ースは ‘getrlimit(2)(1)’ マニュアルページで解説されています。以下に列挙
するリソースは背後のオペレーティングシステムがサポートする場合にサポート
されています; オペレーティングシステム側で値を調べたり制御したりできない
リソースは、そのプラットフォーム向けのこのモジュール内では定義されていま
せん。

 -- データ: resource.RLIM_INFINITY

     無制限のリソースの上限を示すための定数です。

 -- の関数: resource.getrlimit (resource)

     'resource' の現在のソフトおよびハードリミットを表すタプル ‘(soft,
     hard)’ を返します。無効なリソースが指定された場合には *note
     ValueError: 2ee. が、背後のシステムコールが予期せず失敗した場合には
     *note error: 5175. が送出されます。

 -- の関数: 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: 1830. can be used
     to request a limit that is unlimited.

     Raises *note ValueError: 2ee. 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: 1830. when the hard or system limit for that
     resource is not unlimited will result in a ‘ValueError’.  A process
     with the effective UID of super-user can request any valid limit
     value, including unlimited, but ‘ValueError’ will still be raised
     if the requested limit exceeds the system imposed limit.

     ‘setrlimit’ は背後のシステムコールが予期せず失敗した場合に、 *note
     error: 5175. を送出する場合があります。

     VxWorks only supports setting *note RLIMIT_NOFILE: 5177.

     引数 ‘src’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1ccb.
     ‘resource.setrlimit’ を送出します。

 -- の関数: resource.prlimit (pid, resource[, limits])

     1つの関数の中で *note setrlimit(): 1831. と *note getrlimit():
     182f. を組み合わせ、任意のプロセスのリソースの制限値を取得したり設
     定したりします。 'pid' が 0 の場合は、現在のプロセスに適用されます
     。 'resource' および 'limits' は、 'limits' がオプションであること
     を除けば、 ‘setrlimit()’ と同じ意味です。

     'limits' が与えられないときは、関数はプロセス 'pid' の 'resource' の
     制限値を返します。 'limits' が与えられたときは、プロセスの
     'resource' の制限値が設定され、設定が変更される前のリソースの制限値
     が返されます。

     'pid' が見付からないときは *note ProcessLookupError: 126a. を、ユー
     ザがプロセスの ‘CAP_SYS_RESOURCE’ を持ってないときは *note
     PermissionError: f42. を送出します。

     引数 ‘pid’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1ccb.
     ‘resource.prlimit’ を送出します。

     *note Availability: 2199.: Linux >= 2.6.36 with glibc >= 2.13.

     Added in version 3.4.

以下のシンボルは、後に述べる関数 *note setrlimit(): 1831. および *note
getrlimit(): 182f. を使って消費量を制御することができるリソースを定義し
ています。これらのシンボルの値は、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: 3b19. 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: 5177. の 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: 5181.

     *note Availability: 2199.: Solaris, FreeBSD, NetBSD.

 -- データ: resource.RLIMIT_AS

     アドレス空間でプロセスが占有できる最大領域 (バイト単位) です。

 -- データ: resource.RLIMIT_MSGQUEUE

     POSIX メッセージキューに割り当てることの出来るバイト数です。

     *note Availability: 2199.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NICE

     プロセスの nice の上限です (20 - rlim_cur)。

     *note Availability: 2199.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTPRIO

     リアルタイム優先順位の上限です。

     *note Availability: 2199.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTTIME

     リアルタイムスケジューリングにおいて、プロセスがブロッキングシステ
     ムコールを行わずに使用できるCPU時間の制限値（マイクロ秒単位）。

     *note Availability: 2199.: Linux >= 2.6.25.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SIGPENDING

     プロセスがキュー出来るシグナルの数です。

     *note Availability: 2199.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SBSIZE

     このユーザが使用するソケットバッファの最大サイズ(バイト単位)。これ
     は、このユーザが常に保持できるネットワークメモリの量、つまり mbuf の
     量を制限します。

     *note Availability: 2199.: FreeBSD, NetBSD.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SWAP

     このユーザ ID のすべてのプロセスで予約または使用できるスワップスペ
     ースの最大サイズ (バイト単位)。この制限は vm.overcommit sysctl のビ
     ット 1 が設定されている場合のみ適用されます。この sysctl の完全な説
     明については tuning(7)(3) を参照してください。

     *note Availability: 2199.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NPTS

     このユーザ ID が作成する擬似端末の数の上限です。

     *note Availability: 2199.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_KQUEUES

     The maximum number of kqueues this user id is allowed to create.

     *note Availability: 2199.: 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.35.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:
     2ee. を送出します。また、異常が発生した場合には *note error: 5175.
     例外が送出される可能性があります。

 -- の関数: resource.getpagesize ()

     システムページ内のバイト数を返します。(ハードウェアページサイズと同
     じとは限りません。)

The following ‘RUSAGE_*’ symbols are passed to the *note getrusage():
164f. function to specify which processes information should be provided
for.

 -- データ: resource.RUSAGE_SELF

     *note getrusage(): 164f. に渡すと呼び出し中のプロセスが消費している
     リソースを要求します。そのプロセスの全スレッドが使用するリソースの
     合計です。

 -- データ: resource.RUSAGE_CHILDREN

     呼び出し元のプロセスの子プロセスが消費するリソースを要求するために
     、 *note getrusage(): 164f. に渡して終了させ、待機させることができ
     ます。

 -- データ: resource.RUSAGE_BOTH

     *note getrusage(): 164f. に渡すと現在のプロセスおよび子プロセスの両
     方が消費しているリソースを要求します。全てのシステムで利用可能なわ
     けではありません。

 -- データ: resource.RUSAGE_THREAD

     *note getrusage(): 164f. に渡すと現在のスレッドが消費しているリソー
     スを要求します。全てのシステムで利用可能なわけではありません。

     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.35.10 ‘syslog’ -- Unix syslog ライブラリルーチン群
----------------------------------------------------

__________________________________________________________________

このモジュールでは Unix ‘syslog’ ライブラリルーチン群へのインターフェー
スを提供します。‘syslog’ の便宜レベルに関する詳細な記述は Unix マニュア
ルページを参照してください。

*note Availability: 2199.: Unix, not WASI, not iOS.

このモジュールはシステムの ‘syslog’ ファミリのルーチンをラップしています
。 syslog サーバーと通信できる pure Python のライブラリが、 *note
logging.handlers: 8d. モジュールの *note SysLogHandler: 86d. にあります
。

このモジュールには、以下の関数が定義されています:

 -- の関数: syslog.syslog (message)

 -- の関数: syslog.syslog (priority, message)

     文字列 'message' をシステムログ機構に送信します。末尾の改行文字は必
     要に応じて追加されます。各メッセージは 'facility' および 'level' か
     らなる優先度でタグ付けされます。オプションの 'priority' 引数はメッ
     セージの優先度を定義します。標準の値は *note LOG_INFO: 518b. です。
     'priority' 中に、便宜レベルが (‘LOG_INFO | LOG_USER’ のように) 論理
     和を使ってコード化されていない場合、 *note openlog(): 760. を呼び出
     した際の値が使われます。

     *note syslog(): e2. が呼び出される前に *note openlog(): 760. が呼び
     出されなかった場合、 ‘openlog()’ が引数なしで呼び出されます。

     引数 ‘priority’, ‘message’ を指定して *note 監査イベント: 1ccb.
     ‘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 ‘syslog()’, 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
     ‘syslog()’ may be used in a subinterpreter.  Otherwise it will
     raise *note RuntimeError: 246.

 -- の関数: syslog.openlog ([ident[, logoption[, facility]]])

     *note openlog(): 760. 関数を呼び出すことで以降の *note syslog():
     e2. の呼び出しに対するログオプションを設定することができます。ログ
     がまだ開かれていない状態で ‘syslog()’ を呼び出すと ‘openlog()’ が引
     数なしで呼び出されます。

     オプションの 'ident' キーワード引数は全てのメッセージの先頭に付く文
     字列で、デフォルトでは ‘sys.argv[0]’ から前方のパス部分を取り除いた
     ものです。オプションの 'logoption' キーワード引数 (デフォルトは 0)
     はビットフィールドです。組み合わせられる値については下記を参照して
     ください。オプションの 'facility' キーワード引数 (デフォルトは
     *note LOG_USER: 518c.) は明示的に facility が encode されていないメ
     ッセージに設定される facility です。

     引数 ‘ident’, ‘logoptiona'’, ‘facility’ を指定して *note
     監査イベント: 1ccb. ‘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: 246. if called in a subinterpreter.

 -- の関数: syslog.closelog ()

     syslog モジュールの値をリセットし、システムライブラリの
     ‘closelog()’ を呼び出します。

     この関数を呼ぶと、モジュールが最初に import されたときと同じように
     ふるまいます。例えば、(*note openlog(): 760. を呼び出さないで)
     *note syslog(): e2. を最初に呼び出したときに、 ‘openlog()’ が呼び出
     され、 'ident' やその他の ‘openlog()’ の引数はデフォルト値にリセッ
     トされます。

     引数無しで *note 監査イベント: 1ccb. ‘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: 246. if called in a subinterpreter.

 -- の関数: syslog.setlogmask (maskpri)

     優先度マスクを 'maskpri' に設定し、以前のマスク値を返します。
     'maskpri' に設定されていない優先度レベルを持った *note syslog():
     e2. の呼び出しは無視されます。標準では全ての優先度をログ出力します
     。関数 ‘LOG_MASK(pri)’ は個々の優先度 'pri' に対する優先度マスクを
     計算します。関数 ‘LOG_UPTO(pri)’ は優先度 'pri' までの全ての優先度
     を含むようなマスクを計算します。

     引数 ‘maskpri’ を指定して *note 監査イベント: 1ccb.
     ‘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: 5195, *note LOG_FTP: 5198, *note LOG_NETINFO: 519e,
     *note LOG_REMOTEAUTH: 51a1, *note LOG_INSTALL: 5199. and *note
     LOG_RAS: 51a0.

     バージョン 3.13 で変更: Added *note LOG_FTP: 5198, *note
     LOG_NETINFO: 519e, *note LOG_REMOTEAUTH: 51a1, *note LOG_INSTALL:
     5199, *note LOG_RAS: 51a0, and *note LOG_LAUNCHD: 519b.

 -- データ: 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: 51af, *note LOG_NOWAIT: 51b0. and *note LOG_PERROR:
     51b1.

* Menu:

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


File: python.info,  Node: 使用例<53>,  Up: syslog --- Unix syslog ライブラリルーチン群

5.35.10.1 使用例
................

* Menu:

* シンプルな例::


File: python.info,  Node: シンプルな例,  Up: 使用例<53>

5.35.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: Superseded Modules,  Prev: Unix-specific services,  Up: Python 標準ライブラリ

5.36 モジュールのコマンドラインインターフェース (CLI)
=====================================================

以下のモジュールにはコマンドラインインターフェースがあります。

   * *note ast: 4f5f.

   * *note asyncio: 385e.

   * *note base64: f.

   * *note calendar: 1d2.

   * *note code: 1b.

   * *note compileall: 501c.

   * *note cProfile: 2b.: see *note profile: 4b83.

   * *note dis: 5033.

   * *note doctest: 48dd.

   * ‘encodings.rot_13’

   * *note ensurepip: 4c2d.

   * *note filecmp: 5e.

   * *note fileinput: 5f.

   * *note ftplib: 62.

   * *note gzip: 2ed5.

   * *note http.server: 1157.

   * *note idlelib: 478e.

   * *note inspect: 1161.

   * *note json: 240.

   * *note mimetypes: 249.

   * *note pdb: 2e4.

   * *note pickle: 2daa.

   * *note pickletools: 2dab.

   * *note platform: 32de.

   * *note poplib: b1.

   * *note profile: 4b83.

   * *note pstats: b5.

   * *note py_compile: 5013.

   * *note pyclbr: b9.

   * *note pydoc: ba.

   * *note quopri: bc.

   * *note random: 47f.

   * *note runpy: c3.

   * *note site: 4e32.

   * *note sqlite3: 674.

   * *note symtable: 4f96.

   * *note sysconfig: 4cf8.

   * *note tabnanny: e3.

   * *note tarfile: 11d1.

   * ‘this’

   * *note timeit: 4ba7.

   * *note tokenize: 4fe4.

   * *note trace: 4bc4.

   * *note turtledemo: 109.

   * *note unittest: 113a.

   * *note uuid: 676.

   * *note venv: 4c3b.

   * *note webbrowser: 3f69.

   * *note zipapp: 4c55.

   * *note zipfile: 2f44.

*note Python コマンドラインインターフェース: 1e04. も参照してください。


File: python.info,  Node: Superseded Modules,  Next: 削除されたモジュール,  Prev: モジュールのコマンドラインインターフェース CLI,  Up: Python 標準ライブラリ

5.37 Superseded Modules
=======================

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: 23f. 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: Superseded Modules

5.37.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: 340d. 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: 194c. 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. と同じように動作します。つまり、オプションとオ
     プションでない引数とを混在させることができます。‘getopt()’ 関数はオ
     プションでない引数を見つけると解析を停止します。

     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: 194c. へのエイリアスです。後方互換性のために残さ
     れています。

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: 340d. 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: Superseded Modules,  Up: Python 標準ライブラリ

5.38 削除されたモジュール
=========================

この章で説明されているモジュールは 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.38.1 ‘aifc’ -- Read and write AIFF and AIFC files
---------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.2 ‘asynchat’ -- Asynchronous socket command/response handler
-----------------------------------------------------------------

バージョン 3.6 で非推奨、バージョン 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.38.3 ‘asyncore’ -- Asynchronous socket handler
------------------------------------------------

バージョン 3.6 で非推奨、バージョン 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.38.4 ‘audioop’ -- Manipulate raw audio data
---------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.5 ‘cgi’ -- Common Gateway Interface のサポート
---------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.6 ‘cgitb’ -- Traceback manager for CGI scripts
---------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.7 ‘chunk’ -- Read IFF chunked data
---------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.8 ‘crypt’ -- Function to check Unix passwords
--------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.9 ‘distutils’ -- Building and installing Python modules
------------------------------------------------------------

バージョン 3.10 で非推奨、バージョン 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.38.10 ‘imghdr’ -- Determine the type of an image
--------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.11 ‘imp’ -- Access the import internals
--------------------------------------------

バージョン 3.4 で非推奨、バージョン 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.38.12 ‘mailcap’ -- Mailcap file handling
------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.13 ‘msilib’ -- Read and write Microsoft Installer files
------------------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.14 ‘nis’ -- Interface to Sun’s NIS (Yellow Pages)
------------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.15 ‘nntplib’ -- NNTP protocol client
-----------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.16 ‘ossaudiodev’ -- Access to OSS-compatible audio devices
---------------------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.17 ‘pipes’ -- Interface to shell pipelines
-----------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.18 ‘smtpd’ -- SMTP Server
------------------------------

バージョン 3.6 で非推奨、バージョン 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.38.19 ‘sndhdr’ -- Determine type of sound file
------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.20 ‘spwd’ -- The shadow password database
----------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.21 ‘sunau’ -- Read and write Sun AU files
----------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.22 ‘telnetlib’ -- Telnet client
------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.23 ‘uu’ -- Encode and decode uuencode files
------------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.38.24 ‘xdrlib’ -- Encode and decode XDR data
----------------------------------------------

バージョン 3.11 で非推奨、バージョン 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.39 セキュリティで考慮すべき点
===============================

The following modules have specific security considerations:

   * *note base64: f.: *note base64 security considerations: 3d5e. in
     RFC 4648(1)

   * *note hashlib: 6c.: *note all constructors take a "usedforsecurity"
     keyword-only argument disabling known insecure and blocked
     algorithms: 3043.

   * *note http.server: 76. is not suitable for production use, only
     implementing basic security checks.  See the *note security
     considerations: 418d.

   * *note logging: 8b.: *note Logging configuration uses eval(): 3246.

   * *note multiprocessing: 98.: *note Connection.recv() uses pickle:
     3724.

   * *note pickle: ab.: *note Restricting globals in pickle: 2d96.

   * *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: 2db8.

   * *note ssl: d5.: *note SSL/TLS security considerations: 3931.

   * *note subprocess: dc.: *note Subprocess security considerations:
     37f2.

   * *note tempfile: e6.: *note mktemp is deprecated due to
     vulnerability to race conditions: 2d50.

   * *note xml: 127.: *note XML security: 3d91.

   * *note zipfile: 138.: *note maliciously prepared .zip files can
     cause disk volume exhaustion: 2f53.

The *note -I: b5b. 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: 3e2. 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 reference manual,  Prev: Python 標準ライブラリ,  Up: Top

6 Python インタプリタの拡張と埋め込み
*************************************

This document describes how to write modules in C or C++ to extend the
Python interpreter with new modules.  Those modules can not only define
new functions but also new object types and their methods.  The document
also describes how to embed the Python interpreter in another
application, for use as an extension language.  Finally, it shows how to
compile and link extension modules so that they can be loaded
dynamically (at run time) into the interpreter, if the underlying
operating system supports this feature.

This document assumes basic knowledge about Python.  For an informal
introduction to the language, see *note Python チュートリアル: 2018.
*note Python 言語リファレンス: 14b. gives a more formal definition of
the language.  *note Python 標準ライブラリ: 14a. documents the existing
object types, functions and modules (both built-in and written in
Python) that give the language its wide application range.

Python/C API 全体の詳しい説明は、別のドキュメントである、 *note Python/C
API reference manual: 201a. を参照してください。

* Menu:

* おすすめのサードパーティツール::
* Creating extensions without third party tools::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::


File: python.info,  Node: おすすめのサードパーティツール,  Next: Creating extensions without third party tools,  Up: Python インタプリタの拡張と埋め込み

6.1 おすすめのサードパーティツール
==================================

This guide only covers the basic tools for creating extensions provided
as part of this version of CPython.  Some *note third party tools: 5212.
offer both simpler and more sophisticated approaches to creating C and
C++ extensions for Python.


File: python.info,  Node: Creating extensions without third party tools,  Next: 大規模なアプリケーションへの Python ランタイムの埋め込み,  Prev: おすすめのサードパーティツール,  Up: Python インタプリタの拡張と埋め込み

6.2 Creating extensions without third party tools
=================================================

ガイドのこの節ではサードパーティツールの補助無しに C および C++ 拡張を作
成する方法を説明します。 これは自分自身の C 拡張を作成するおすすめの方法
というよりも、主にそれらのツールを作成する人向けのものです。

参考
....

PEP 489(1) - Multi-phase extension module initialization

* Menu:

* Extending Python with C or C++::
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: Extending Python with C or C++,  Next: 拡張の型の定義 チュートリアル,  Up: Creating extensions without third party tools

6.2.1 Extending Python with C or C++
------------------------------------

It is quite easy to add new built-in modules to Python, if you know how
to program in C. Such 'extension modules' can do two things that can't
be done directly in Python: they can implement new built-in object
types, and they can call C library functions and system calls.

To support extensions, the Python API (Application Programmers
Interface) defines a set of functions, macros and variables that provide
access to most aspects of the Python run-time system.  The Python API is
incorporated in a C source file by including the header ‘"Python.h"’.

The compilation of an extension module depends on its intended use as
well as on your system setup; details are given in later chapters.

     注釈: The C extension interface is specific to CPython, and
     extension modules do not work on other Python implementations.  In
     many cases, it is possible to avoid writing C extensions and
     preserve portability to other implementations.  For example, if
     your use case is calling C library functions or system calls, you
     should consider using the *note ctypes: 2e. module or the cffi(1)
     library rather than writing custom C code.  These modules let you
     write Python code to interface with C code and are more portable
     between implementations of Python than writing and compiling a C
     extension module.

* Menu:

* A Simple Example::
* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions.
* Back to the Example::
* The Module's Method Table and Initialization Function::
* Compilation and Linkage::
* C から Python 関数を呼び出す::
* 拡張モジュール関数でのパラメタ展開::
* 拡張モジュール関数のキーワードパラメタ::
* 任意の値を構築する::
* 参照カウント法::
* C++での拡張モジュール作成::
* 拡張モジュールに C API を提供する::

   ---------- Footnotes ----------

   (1) https://cffi.readthedocs.io/


File: python.info,  Node: A Simple Example,  Next: Intermezzo Errors and Exceptions,  Up: Extending Python with C or C++

6.2.1.1 A Simple Example
........................

Let's create an extension module called ‘spam’ (the favorite food of
Monty Python fans...)  and let's say we want to create a Python
interface to the C library function ‘system()’ (1).  This function takes
a null-terminated character string as argument and returns an integer.
We want this function to be callable from Python as follows:

     >>> import spam
     >>> status = spam.system("ls -l")

Begin by creating a file ‘spammodule.c’.  (Historically, if a module is
called ‘spam’, the C file containing its implementation is called
‘spammodule.c’; if the module name is very long, like ‘spammify’, the
module name can be just ‘spammify.c’.)

The first two lines of our file can be:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

which pulls in the Python API (you can add a comment describing the
purpose of the module and a copyright notice if you like).

     注釈: Since Python may define some pre-processor definitions which
     affect the standard headers on some systems, you 'must' include
     ‘Python.h’ before any standard headers are included.

     ‘#define PY_SSIZE_T_CLEAN’ was used to indicate that ‘Py_ssize_t’
     should be used in some APIs instead of ‘int’.  It is not necessary
     since Python 3.13, but we keep it here for backward compatibility.
     See *note 文字列とバッファ: 62c. for a description of this macro.

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>’

The next thing we add to our module file is the C function that will be
called when the Python expression ‘spam.system(string)’ is evaluated
(we'll see shortly how it ends up being called):

     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);
     }

There is a straightforward translation from the argument list in Python
(for example, the single expression ‘"ls -l"’) to the arguments passed
to the C function.  The C function always has two arguments,
conventionally named 'self' and 'args'.

The 'self' argument points to the module object for module-level
functions; for a method it would point to the object instance.

The 'args' argument will be a pointer to a Python tuple object
containing the arguments.  Each item of the tuple corresponds to an
argument in the call's argument list.  The arguments are Python objects
-- in order to do anything with them in our C function we have to
convert them to C values.  The function *note PyArg_ParseTuple(): 3bf.
in the Python API checks the argument types and converts them to C
values.  It uses a template string to determine the required types of
the arguments as well as the types of the C variables into which to
store the converted values.  More about this later.

*note PyArg_ParseTuple(): 3bf. returns true (nonzero) if all arguments
have the right type and its components have been stored in the variables
whose addresses are passed.  It returns false (zero) if an invalid
argument list was passed.  In the latter case it also raises an
appropriate exception so the calling function can return ‘NULL’
immediately (as we saw in the example).

   ---------- Footnotes ----------

   (1) An interface for this function already exists in the standard
module *note os: a5. -- it was chosen as a simple and straightforward
example.


File: python.info,  Node: Intermezzo Errors and Exceptions,  Next: Back to the Example,  Prev: A Simple Example,  Up: Extending Python with C or C++

6.2.1.2 Intermezzo: Errors and Exceptions
.........................................

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(): 89b.  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: 521b. のような定義済みのオブジェクトです。 C 文
字列はエラーの原因を示し、Python 文字列オブジェクトに変換されて例外の "付
属値" に保存されます。

もう一つ有用な関数として *note PyErr_SetFromErrno(): 521c. があります。
この関数は引数に例外だけをとり、付属値はグローバル変数 ‘errno’ から構築
します。もっとも汎用的な関数は *note PyErr_SetObject(): 79b. で、二つの
オブジェクト、例外と付属値を引数にとります。これら関数に渡すオブジェクト
には *note Py_INCREF(): 78f. を使う必要はありません。

例外がセットされているかどうかは、 *note PyErr_Occurred(): 1d0a. を使っ
て非破壊的に調べられます。この関数は現在の例外オブジェクトを返します。例
外が発生していない場合には ‘NULL’ を返します。通常は、関数の戻り値からエ
ラーが発生したかを判別できるはずなので、 ‘PyErr_Occurred()’ を呼び出す必
要はありません。

関数 'g' を呼び出す 'f' が、前者の関数の呼び出しに失敗したことを検出する
と、 'f' 自体はエラー値 (大抵は ‘NULL’ や ‘-1’) を返さねばなりません。し
かし、 ‘PyErr_*’ 関数群のいずれかを呼び出す必要は 'ありません' -- なぜな
ら、 'g' がすでに呼び出しているからです。次いで 'f' を呼び出したコードも
エラーを示す値を '自らを呼び出したコード' に返すことになりますが、同様に
‘PyErr_*’ は '呼び出しません' 。以下同様に続きます -- エラーの最も詳しい
原因は、最初にエラーを検出した関数がすでに報告しているからです。エラーが
Python インタプリタのメインループに到達すると、現在実行中の Python コー
ドは一時停止し、 Python プログラマが指定した例外ハンドラを探し出そうとし
ます。

(モジュールが ‘PyErr_*’ 関数をもう一度呼び出して、より詳細なエラーメッセ
ージを提供するような状況があります。このような状況ではそうすべきです。と
はいえ、一般的な規則としては、この関数を何度も呼び出す必要はなく、ともす
ればエラーの原因に関する情報を失う結果になりがちです: これにより、ほとん
どの操作が様々な理由から失敗するかもしれません)

ある関数呼び出しでの処理の失敗によってセットされた例外を無視するには、
*note PyErr_Clear(): 1236. を呼び出して例外状態を明示的に消去しなくては
なりません。エラーをインタプリタには渡したくなく、自前で (何か他の作業を
行ったり、何も起こらなかったかのように見せかけるような) エラー処理を完全
に行う場合にのみ、 ‘PyErr_Clear()’ を呼び出すようにすべきです。

‘malloc()’ の呼び出し失敗は、常に例外にしなくてはなりません --
‘malloc()’ (または ‘realloc()’) を直接呼び出しているコードは、 *note
PyErr_NoMemory(): 521d. を呼び出して、失敗を示す値を返さねばなりません。
オブジェクトを生成する全ての関数 (例えば *note PyLong_FromLong(): 1c2d.)
は ‘PyErr_NoMemory()’ の呼び出しを済ませてしまうので、この規則が関係する
のは直接 ‘malloc()’ を呼び出すコードだけです。

また、 *note PyArg_ParseTuple(): 3bf. という重要な例外を除いて、整数の状
態コードを返す関数はたいてい、Unix のシステムコールと同じく、処理が成功
した際にはゼロまたは正の値を返し、失敗した場合には ‘-1’ を返します。

最後に、エラー標示値を返す際に、(エラーが発生するまでに既に生成してしま
ったオブジェクトに対して *note Py_XDECREF(): 996. や *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: 521b, which you can use directly.
Of course, you should choose exceptions wisely -- don't use *note
PyExc_TypeError: 521e. to mean that a file couldn't be opened (that
should probably be *note PyExc_OSError: 521f.).  If something's wrong
with the argument list, the *note PyArg_ParseTuple(): 3bf. function
usually raises ‘PyExc_TypeError’.  If you have an argument whose value
must be in a particular range or must satisfy other conditions, *note
PyExc_ValueError: 5220. 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(): 1485. in the
module's *note Py_mod_exec: b79. 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: b79.
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(): 1485. function may create a class with the
base class being *note Exception: bd1. (unless another class is passed
in instead of ‘NULL’), described in *note 組み込み例外: 1c84.

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: 16f1. 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: Back to the Example,  Next: The Module's Method Table and Initialization Function,  Prev: Intermezzo Errors and Exceptions,  Up: Extending Python with C or C++

6.2.1.3 Back to the Example
...........................

Going back to our example function, you should now be able to understand
this statement:

     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(): 3bf.  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’).

The next statement is a call to the Unix function ‘system()’, passing it
the string we just got from *note PyArg_ParseTuple(): 3bf.:

     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(): 1c2d.

     return PyLong_FromLong(sts);

In this case, it will return an integer object.  (Yes, even integers are
objects on the heap in Python!)

If you have a C function that returns no useful argument (a function
returning void), the corresponding Python function must return ‘None’.
You need this idiom to do so (which is implemented by the *note
Py_RETURN_NONE: 1691. macro):

     Py_INCREF(Py_None);
     return Py_None;

*note Py_None: 5223. is the C name for the special Python object ‘None’.
It is a genuine Python object rather than a ‘NULL’ pointer, which means
"error" in most contexts, as we have seen.


File: python.info,  Node: The Module's Method Table and Initialization Function,  Next: Compilation and Linkage,  Prev: Back to the Example,  Up: Extending Python with C or C++

6.2.1.4 The Module's Method Table and Initialization Function
.............................................................

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 */
     };

Note the third entry (‘METH_VARARGS’).  This is a flag telling the
interpreter the calling convention to be used for the C function.  It
should normally always be ‘METH_VARARGS’ or ‘METH_VARARGS |
METH_KEYWORDS’; a value of ‘0’ means that an obsolete variant of *note
PyArg_ParseTuple(): 3bf. is used.

When using only ‘METH_VARARGS’, the function should expect the
Python-level parameters to be passed in as a tuple acceptable for
parsing via *note PyArg_ParseTuple(): 3bf.; more information on this
function is provided below.

The *note METH_KEYWORDS: 5226. 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.

The method table must be referenced in the module definition structure:

     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: 16f1. 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(): 5227, 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:
1b7a. table.  To add the module to the initialization table, use *note
PyImport_AppendInittab(): 1b7b, 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: 167, authors should consider
     marking the module as having no support for subinterpreters (via
     *note Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED: 5228.).

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: Compilation and Linkage,  Next: C から Python 関数を呼び出す,  Prev: The Module's Method Table and Initialization Function,  Up: Extending Python with C or C++

6.2.1.5 Compilation and Linkage
...............................

There are two more things to do before you can use your new extension:
compiling and linking it with the Python system.  If you use dynamic
loading, the details may depend on the style of dynamic loading your
system uses; see the chapters about building extension modules (chapter
*note C および C++ 拡張のビルド: 522b.) and additional information that
pertains only to building on Windows (chapter *note Windows 上での C
および C++ 拡張モジュールのビルド: 2280.) for more information about
this.

If you can't use dynamic loading, or if you want to make your module a
permanent part of the Python interpreter, you will have to change the
configuration setup and rebuild the interpreter.  Luckily, this is very
simple on Unix: just place your file (‘spammodule.c’ for example) in the
‘Modules/’ directory of an unpacked source distribution, add a line to
the file ‘Modules/Setup.local’ describing your file:

     spam spammodule.o

を追加して、トップレベルのディレクトリで ‘make’ を実行して、インタプリタ
を再ビルドするだけです。 ‘Modules/’ サブディレクトリでも ‘make’ を実行で
きますが、前もって '‘make’ Makefile' を実行して ‘Makefile’ を再ビルドし
ておかなければならりません。(この作業は ‘Setup’ ファイルを変更するたびに
必要です。)

モジュールが別のライブラリとリンクされている必要がある場合、ライブラリも
設定ファイルに列挙できます。例えば以下のようにします。

     spam spammodule.o -lX11


File: python.info,  Node: C から Python 関数を呼び出す,  Next: 拡張モジュール関数でのパラメタ展開,  Prev: Compilation and Linkage,  Up: Extending Python with C or C++

6.2.1.6 C から Python 関数を呼び出す
....................................

So far we have concentrated on making C functions callable from Python.
The reverse is also useful: calling Python functions from C. This is
especially the case for libraries that support so-called "callback"
functions.  If a C interface makes use of callbacks, the equivalent
Python often needs to provide a callback mechanism to the Python
programmer; the implementation will require calling the Python callback
functions from a C callback.  Other uses are also imaginable.

Fortunately, the Python interpreter is easily called recursively, and
there is a standard interface to call a Python function.  (If you're
interested in how to call the Python parser with a particular string as
input, see *note 超高水準レイヤ: 522e.)

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: 1726. flag; this is described in section *note The
Module's Method Table and Initialization Function: 5224.  The *note
PyArg_ParseTuple(): 3bf. function and its arguments are documented in
section *note 拡張モジュール関数でのパラメタ展開: 522f.

*note Py_XINCREF(): c5e. および *note Py_XDECREF(): 996. は、オブジェク
トに対する参照カウントをインクリメント/デクリメントするためのマクロで、
‘NULL’ ポインタが渡されても安全に操作できる形式です (とはいえ、上の流れ
では 'temp' が ‘NULL’ になることはありません)。これらのマクロと参照カウ
ントについては、 *note 参照カウント法: 5230. で説明しています。

その後、コールバック関数を呼び出す時が来たら、C 関数 *note
PyObject_CallObject(): 5231. を呼び出します。この関数には二つの引数:
Python 関数と Python 関数の引数リストがあり、いずれも任意の Python オブ
ジェクトを表すポインタ型です。引数リストは常にタプルオブジェクトでなけれ
ばならず、その長さは引数の数になります。Python 関数を引数なしで呼び出す
のなら、 ‘NULL’ か空のタプルを渡します; 単一の引数で関数を呼び出すのなら
、単要素 (singleton) のタプルを渡します。 *note Py_BuildValue(): 3c0. の
書式文字列中に、ゼロ個または一個以上の書式化コードが入った丸括弧がある場
合、この関数はタプルを返します。以下に例を示します:

     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(): 5231. は Python オブジェクトへのポインタを
返します: これは Python 関数からの戻り値になります。
‘PyObject_CallObject()’ は、引数に対して "参照カウント中立
(reference-count- neutral)" です。上の例ではタプルを生成して引数リストと
して提供しており、このタプルは ‘PyObject_CallObject()’ の呼び出し直後に
*note Py_DECREF(): 790. されています。

*note PyObject_CallObject(): 5231. は戻り値として "新しい" オブジェクト:
新規に作成されたオブジェクトか、既存のオブジェクトの参照カウントをインク
リメントしたものを返します。従って、このオブジェクトをグローバル変数に保
存したいのでないかぎり、たとえこの戻り値に興味がなくても (むしろ、そうで
あればなおさら!)  何がしかの方法で戻り値オブジェクトを *note
Py_DECREF(): 790. しなければなりません。

とはいえ、戻り値を *note Py_DECREF(): 790. する前には、値が ‘NULL’ でな
いかチェックしておくことが重要です。もし ‘NULL’ なら、呼び出した Python
関数は例外を送出して終了させられています。 *note PyObject_CallObject():
5231. を呼び出しているコード自体もまた Python から呼び出されているのであ
れば、今度は C コードが自分を呼び出している Python コードにエラー標示値
を返さねばなりません。それにより、インタプリタはスタックトレースを出力し
たり、例外を処理するための Python コードを呼び出したりできます。例外の送
出が不可能だったり、したくないのなら、 *note PyErr_Clear(): 1236. を呼ん
で例外を消去しておかねばなりません。例えば以下のようにします:

     if (result == NULL)
         return NULL; /* Pass error back */
     ...use result...
     Py_DECREF(result);

Python コールバック関数をどんなインターフェースにしたいかによっては、引
数リストを *note PyObject_CallObject(): 5231. に与えなければならない場合
もあります。あるケースでは、コールバック関数を指定したのと同じインターフ
ェースを介して、引数リストも渡されているかもしれません。また別のケースで
は、新しいタプルを構築して引数リストを渡さねばならないかもしれません。こ
の場合最も簡単なのは *note Py_BuildValue(): 3c0. を呼ぶやり方です。例え
ば、整数のイベントコードを渡したければ、以下のようなコードを使うことにな
るでしょう:

     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(): 3c0. はメモリ不足におちいるかもしれず、
チェックしておくべきです。

通常の引数とキーワード引数をサポートする *note PyObject_Call(): 63d. を
使って、キーワード引数を伴う関数呼び出しをすることができます。上の例と同
じように、 *note Py_BuildValue(): 3c0. を作って辞書を作ります。

     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: Extending Python with C or C++

6.2.1.7 拡張モジュール関数でのパラメタ展開
..........................................

The *note PyArg_ParseTuple(): 3bf. function is declared as follows:

     int PyArg_ParseTuple(PyObject *arg, const char *format, ...);

引数 'arg' は C 関数から Python に渡される引数リストが入ったタプルオブジ
ェクトでなければなりません。 'format' 引数は書式文字列で、 Python/C API
リファレンスマニュアルの *note 引数の解釈と値の構築: 3d3. で解説されてい
る書法に従わねばなりません。残りの引数は、それぞれの変数のアドレスで、書
式化文字列から決まる型になっていなければなりません。

*note PyArg_ParseTuple(): 3bf. は Python 側から与えられた引数が必要な型
になっているか調べるのに対し、 ‘PyArg_ParseTuple()’ は呼び出しの際に渡さ
れた 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: Extending Python with C or C++

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(): 3bf. のものと同じ
です。 'kwdict' パラメタはキーワード引数の入った辞書で、 Python ランタイ
ムシステムから第三パラメタとして受け取ります。 'kwlist' パラメタは各パラ
メタを識別するための文字列からなる、 ‘NULL’ 終端されたリストです; 各パラ
メタ名は 'format' 中の型情報に対して左から右の順に照合されます。成功する
と *note PyArg_ParseTupleAndKeywords(): 624. は真を返し、それ以外の場合
には適切な例外を送出して偽を返します。

     注釈: キーワード引数を使っている場合、タプルは入れ子にして使えませ
     ん!  'kwlist' 内に存在しないキーワードパラメタが渡された場合、
     *note TypeError: 199. の送出を引き起こします。

以下にキーワードを使ったモジュール例を示します。これは 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: Extending Python with C or C++

6.2.1.9 任意の値を構築する
..........................

*note Py_BuildValue(): 3c0. は *note PyArg_ParseTuple(): 3bf. の対極に位
置するものです。この関数は以下のように定義されています:

     PyObject *Py_BuildValue(const char *format, ...);

*note Py_BuildValue(): 3c0. は、 *note PyArg_ParseTuple(): 3bf. の認識す
る一連の書式単位に似た書式単位を認識します。ただし (関数への出力ではなく
、入力に使われる) 引数はポインタではなく、ただの値でなければなりません。
Python から呼び出された C 関数が返す値として適切な、新たな Python オブジ
ェクトを返します。

*note PyArg_ParseTuple(): 3bf. とは一つ違う点があります:
‘PyArg_ParseTuple()’ は第一引数をタプルにする必要があります (Python の引
数リストは内部的には常にタプルとして表現されるからです) が、 *note
Py_BuildValue(): 3c0. はタプルを生成するとは限りません。
‘Py_BuildValue()’ は書式文字列中に書式単位が二つかそれ以上入っている場合
にのみタプルを構築します。書式文字列が空なら、 ‘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: Extending Python with C or C++

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') と呼ばれる手法です。参
照カウント法の原理は簡単です: 全てのオブジェクトにはカウンタがあり、オブ
ジェクトに対する参照がどこかに保存されたらカウンタをインクリメントし、オ
ブジェクトに対する参照が削除されたらデクリメントします。カウンタがゼロに
なったら、オブジェクトへの最後の参照が削除されたことになり、オブジェクト
は解放されます。

An alternative strategy is called 'automatic garbage collection'.
(Sometimes, reference counting is also referred to as a garbage
collection strategy, hence the use of "automatic" to distinguish the
two.)  The big advantage of automatic garbage collection is that the
user doesn't need to call ‘free()’ explicitly.  (Another claimed
advantage is an improvement in speed or memory usage -- this is no hard
fact however.)  The disadvantage is that for C, there is no truly
portable automatic garbage collector, while reference counting can be
implemented portably (as long as the functions ‘malloc()’ and ‘free()’
are available -- which the C Standard guarantees).  Maybe some day a
sufficiently portable automatic garbage collector will be available for
C. Until then, we'll have to live with reference counts.

Python では、伝統的な参照カウント法の実装を行っている一方で、参照の循環
を検出するために働く循環参照検出機構 (cycle detector) も提供しています。
循環参照検出機構のおかげで、直接、間接にかかわらず循環参照の生成を気にせ
ずにアプリケーションを構築できます; というのも、参照カウント法だけを使っ
たガベージコレクション実装にとって循環参照は弱点だからです。循環参照は、
(間接参照の場合も含めて) 相互への参照が入ったオブジェクトから形成される
ため、循環内のオブジェクトは各々非ゼロの参照カウントを持ちます。典型的な
参照カウント法の実装では、たとえ循環参照を形成するオブジェクトに対して他
に全く参照がないとしても、循環参照内のどのオブジェクトに属するメモリも再
利用できません。

循環参照検出機構はそのようなガベージサイクル (前述したような循環参照オブ
ジェクト) を検出して回収することができます。 *note gc: 64. モジュールそ
のような検出機構の実行 (*note collect(): 1b5. 関数) を提供するとともに、
設定のためのインタフェースおよび検出機構を実行時に無効にする方法も提供し
ています。

* 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) の放棄には、渡す、保存す
る、 ‘Py_DECREF()’ を呼び出す、という三つの方法があります。所有参照を処
理し忘れると、メモリリークを引き起こします。

It is also possible to 'borrow' (1) a reference to an object.  The
borrower of a reference should not call *note Py_DECREF(): 790.  The
borrower must not hold on to the object longer than the owner from which
it was borrowed.  Using a borrowed reference after the owner has
disposed of it risks using freed memory and should be avoided completely
(2).

参照の借用が参照の所有よりも優れている点は、コードがとりうるあらゆる処理
経路で参照を廃棄しておくよう注意しなくて済むことです -- 別の言い方をすれ
ば、借用参照の場合には、処理の途中で関数を終了してもメモリリークの危険を
冒すことがない、ということです。逆に、所有よりも不利な点は、ごくまともに
見えるコードが、実際には参照の借用元で放棄されてしまった後にその参照を使
うかもしれないような微妙な状況があるということです。

*note Py_INCREF(): 78f. を呼び出すと、借用参照を所有参照に変更できます。
この操作は参照の借用元の状態には影響しません -- ‘Py_INCREF()’ は新たな所
有参照を生成し、参照の所有者が担うべき全ての責任を課します (つまり、新た
な参照の所有者は、以前の所有者と同様、参照の放棄を適切に行わねばなりませ
ん)。

   ---------- Footnotes ----------

   (1) 参照を "借用する" というメタファは厳密には正しくありません: なぜ
なら、参照の所有者は依然として参照のコピーを持っているからです。

   (2) 参照カウントが 1 以上かどうか調べる方法は 'うまくいきません' -- 参
照カウント自体も解放されたメモリ上にあるため、その領域が他のオブジェクト
に使われている可能性があります!


File: python.info,  Node: 所有権にまつわる規則,  Next: 薄氷,  Prev: Python における参照カウント法,  Up: 参照カウント法

6.2.1.12 所有権にまつわる規則
.............................

オブジェクトへの参照を関数の内外に渡す場合には、オブジェクトの所有権が参
照と共に渡されるか否かが常に関数インターフェース仕様の一部となります。

オブジェクトへの参照を返すほとんどの関数は、参照とともに所有権も渡します
。特に、 *note PyLong_FromLong(): 1c2d. や *note Py_BuildValue(): 3c0. の
ように、新しいオブジェクトを生成する関数は全て所有権を相手に渡します。オ
ブジェクトが実際には新たなオブジェクトでなくても、そのオブジェクトに対す
る新たな参照の所有権を得ます。例えば、 ‘PyLong_FromLong()’ はよく使う値
をキャッシュしており、キャッシュされた値への参照を返すことがあります。

*note PyObject_GetAttrString(): 5ef. のように、あるオブジェクトから別の
オブジェクトを抽出するような関数もまた、参照とともに所有権を委譲します。
こちらの方はやや理解しにくいかもしれません。というのはよく使われるルーチ
ンのいくつかが例外となっているからです: *note PyTuple_GetItem(): 523c. 、
*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(): 523d. と *note
PyList_SetItem(): 191c. があります。これらの関数は、渡された引数要素に対
して所有権を乗っ取り (take over) ます -- たとえ失敗してもです!  (*note
PyDict_SetItem(): 523e. とその仲間は所有権を乗っ取りません -- これらはい
わば "普通の" 関数です。)

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(): 191c.  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, ‘PyList_SetItem()’ calls *note
Py_DECREF(): 790. on the replaced item, which invokes replaced item's
corresponding *note tp_dealloc: 5241. function.  During deallocation,
‘tp_dealloc’ calls *note tp_finalize: ca1, which is mapped to the
‘__del__()’ method for class instances (see PEP 442(1)).  This entire
sequence happens synchronously within the ‘PyList_SetItem()’ 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: 5242, and to re-acquire it using *note
Py_END_ALLOW_THREADS: c83.  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(): c5e. および *note Py_XDECREF(): 996. はチェックを行
います。

特定のオブジェクト型について調べるマクロ (‘Pytype_Check()’) は 'NULL' ポ
インタのチェックを行いません -- 繰り返しますが、様々な異なる型を想定して
オブジェクトの型を調べる際には、こうしたマクロを続けて呼び出す必要がある
ので、個別に ‘NULL’ ポインタのチェックをすると冗長なテストになってしまう
のです。型を調べるマクロには、 ‘NULL’ チェックを行う変化形はありません。

The C function calling mechanism guarantees that the argument list
passed to C functions (‘args’ in the examples) is never ‘NULL’ -- in
fact it guarantees that it is always a tuple (1).

‘NULL’ ポインタを Python ユーザレベルに "逃がし" てしまうと、深刻なエラ
ーを引き起こします。

   ---------- Footnotes ----------

   (1) "旧式の" 呼び出し規約を使っている場合には、この保証は適用されませ
ん -- 既存のコードにはいまだに旧式の呼び出し規約が多々あります。


File: python.info,  Node: C++での拡張モジュール作成,  Next: 拡張モジュールに C API を提供する,  Prev: 参照カウント法,  Up: Extending Python with C or C++

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: Extending Python with C or C++

6.2.1.16 拡張モジュールに C API を提供する
..........................................

多くの拡張モジュールは単に Python から使える新たな関数や型を提供するだけ
ですが、時に拡張モジュール内のコードが他の拡張モジュールでも便利なことが
あります。例えば、あるモジュールでは順序概念のないリストのように動作する
"コレクション (collection)" クラスを実装しているかもしれません。ちょうど
リストを生成したり操作したりできる C API を備えた標準の Python リスト型
のように、この新たなコレクション型も他の拡張モジュールから直接操作できる
ようにするには一連の C 関数を持っていなければなりません。

一見するとこれは簡単なこと: 単に関数を (もちろん ‘static’ などとは宣言せ
ずに) 書いて、適切なヘッダファイルを提供し、C API を書けばよいだけ、に思
えます。そして実際のところ、全ての拡張モジュールが Python インタプリタに
常に静的にリンクされている場合にはうまく動作します。ところがモジュールが
共有ライブラリの場合には、一つのモジュールで定義されているシンボルが他の
モジュールから不可視なことがあります。可視性の詳細はオペレーティングシス
テムによります; あるシステムは Python インタプリタと全ての拡張モジュール
用に単一のグローバルな名前空間を用意しています (例えば Windows)。別のシ
ステムはモジュールのリンク時に取り込まれるシンボルを明示的に指定する必要
があります (AIX がその一例です)、また別のシステム (ほとんどの Unix) では
、違った戦略を選択肢として提供しています。そして、たとえシンボルがグロー
バル変数として可視であっても、呼び出したい関数の入ったモジュールがまだロ
ードされていないことだってあります!

Portability therefore requires not to make any assumptions about symbol
visibility.  This means that all symbols in extension modules should be
declared ‘static’, except for the module's initialization function, in
order to avoid name clashes with other extension modules (as discussed
in section *note The Module's Method Table and Initialization Function:
5224.).  And it means that symbols that 'should' be accessible from
other extension modules must be exported in a different way.

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(): 5248. は name 引数 (const char*) を取ります。
‘NULL’ を name に渡すことも許可されていますが、 name を設定することを強
く推奨します。正しく名前を付けられた Capsule はある程度の実行時型安全性
を持ちます。名前を付けられていない Capsule を他の Capsule と区別する現実
的な方法はありません。

特に、 C API を公開するための Capsule には次のルールに従った名前を付ける
べきです:

     modulename.attributename

*note PyCapsule_Import(): 1c6d. という便利関数は、 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 A Simple Example: 5218.  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: b79. 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: b79. 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
カプセル: 2a69, および Capsule の実装部分 (Python ソースコード配布物中の
ファイル ‘Include/pycapsule.h’ および ‘Objects/pycapsule.c’ に述べられて
います。

脚注
....


File: python.info,  Node: 拡張の型の定義 チュートリアル,  Next: 拡張の型の定義 雑多なトピック,  Prev: Extending Python with C or C++,  Up: Creating extensions without third party tools

6.2.2 拡張の型の定義: チュートリアル
------------------------------------

Python では、組み込みの *note str: 16a. 型や *note list: 24f. 型のような
Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できま
す。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に
理解しておくべき細かいことがあります。 このドキュメントはその話題につい
てのやさしい入門です。

* Menu:

* 基本的なこと::
* 基本のサンプルにデータとメソッドを追加する::
* データ属性をこまかく制御する::
* 循環ガベージコレクションをサポートする::
* 他の型のサブクラスを作る::


File: python.info,  Node: 基本的なこと,  Next: 基本のサンプルにデータとメソッドを追加する,  Up: 拡張の型の定義 チュートリアル

6.2.2.1 基本的なこと
....................

*note CPython: 906. ランタイムは Python の全てのオブジェクトを、 Python
の全てのオブジェクトの "基底型 (base type)" である *note PyObject: 5df.*
型の変数と見なします。 *note PyObject: 5df. 構造体自身は *note
参照カウント: 524e. と、オブジェクトの "型オブジェクト" へのポインタのみ
を持ちます。ここには動作が定義されています; 型オブジェクトは、例えば、あ
る属性があるオブジェクトから検索されたり、メソッドが呼ばれたり、他のオブ
ジェクトによって操作されたりしたときに、どの (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’
という名前のフィールドを定義します。 ‘PyObject’ 型には (それぞれ *note
Py_TYPE: 3c7. マクロおよび *note Py_REFCNT: 2d1. マクロからアクセスでき
る) 型オブジェクトへのポインタと参照カウントが格納されています。このマク
ロが用意されている理由は、構造体のレイアウトを抽象化し、デバッグビルドで
フィールドを追加できるようにするためです。

     注釈: 上の例では *note PyObject_HEAD: 14f9. マクロの後にセミコロン
     はありません。 うっかりセミコロンを追加しないように気を付けてくださ
     い: これを警告するコンパイラもあります。

もちろん、一般的にはオブジェクトは標準的な ‘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: ca0. の特に関心の無いフィールドまで全て並べたり、フィ
     ールドを宣言する順序に気を使ったりせずに済ませるのをお薦めします。

‘object.h’ にある実際の *note PyTypeObject: ca0. の定義には上の定義にあ
るよりももっと多くの *note フィールド: b88. があります。 ここに出てきて
いないフィールドは 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: 241b.
は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でないオブジ
ェクトでは 0 にすべきです。

     注釈: If you want your type to be subclassable from Python, and
     your type has the same *note tp_basicsize: b82. 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__: 16ca, 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 ‘tp_basicsize’ than its base type does.  Most of the time, this
     will be true anyway, because either your base type will be *note
     object: c82, or else you will be adding data members to your base
     type, and therefore increasing its size.

*note Py_TPFLAGS_DEFAULT: 524f. にクラスフラグを設定します。

     .tp_flags = Py_TPFLAGS_DEFAULT,

すべての型はフラグにこの定数を含めておく必要があります。これは最低でも
Python 3.3 までに定義されているすべてのメンバを許可します。それ以上のメ
ンバが必要なら、対応するフラグの OR をとる必要があります。

この型の docstring は *note tp_doc: 5250. に入れます。

     .tp_doc = PyDoc_STR("Custom objects"),

オブジェクトが生成できるように、 *note tp_new: 79f. ハンドラを提供する必
要があります。これは Python のメソッド *note __new__(): 7a0. と同等のも
のですが、明示的に与える必要があります。今の場合では、 API 関数の *note
PyType_GenericNew(): 5251. として提供されるデフォルトの実装をそのまま使
えます。

     .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: 5252. も含めて、いくつかの
メンバーを適切なデフォルト値で埋めて、 ‘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: 5241. メンバに代入されます。

     .tp_dealloc = Custom_dealloc,

このメソッドは、まず二つのPython 属性の参照カウントをクリアします。
*note Py_XDECREF(): 996. は引数が ‘NULL’ のケースを正しく扱えます (これ
は、‘tp_new’ が途中で失敗した場合に起こりえます) 。このメソッドは、つぎ
にオブジェクトの型 (‘Py_TYPE(self)’ で算出します) のメンバ *note
tp_free: 5254. を呼び出し、オブジェクトのメモリを開放します。オブジェク
トの型が ‘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(): 5251. 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: 5255. スロットを呼び出してメモリ
を割り当てます:

     self = (CustomObject *) type->tp_alloc(type, 0);

メモリ割り当ては失敗するかもしれないので、先に進む前に *note tp_alloc:
5255. の結果が ‘NULL’ でないかチェックしなければなりません。

     注釈: We didn't fill the *note tp_alloc: 5255. slot ourselves.
     Rather *note PyType_Ready(): 984. fills it for us by inheriting it
     from our base class, which is *note object: c82. by default.  Most
     types use the default allocation strategy.

     注釈: もし協力的な *note tp_new: 79f. (基底タイプの ‘tp_new’ または
     *note __new__(): 7a0. を呼んでいるもの) を作りたいのならば、実行時
     のメソッド解決順序をつかってどのメソッドを呼びだすかを決定しようと
     しては 'いけません' 。常に呼び出す型を静的に決めておき、直接その
     ‘tp_new’ を呼び出すか、あるいは ‘type->tp_base->tp_new’ を経由して
     ください。こうしないと、あなたが作成したタイプの Python サブクラス
     が他の Python で定義されたクラスも継承している場合にうまく動かない
     場合があります。 (とりわけ、そのようなサブクラスのインスタンスを
     *note TypeError: 199. を出さずに作ることが不可能になります。)

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__(): 8c0. 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__(): 8c0. 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:
5256. 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: 5256. nor cause any calls back into
     our type's code;

   * when decrementing a reference count in a *note tp_dealloc: 5241.
     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: 5257. スロットに入れましょう:

     .tp_members = Custom_members,

Each member definition has a member name, type, offset, access flags and
documentation string.  See the *note 総称的な属性を管理する: 5258.
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: 16f2. flag to indicate that
the method is expecting no arguments other than 'self')

and assign it to the *note tp_methods: 5259. 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: 525a. 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: b78. struct, and update the full class
name in the *note PyTypeObject: ca0. 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: 5241. 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: db6. 構造体の配列をつくります:

     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: 525c. スロットに登録します:

     .tp_getset = Custom_getsetters,

The last item in a *note PyGetSetDef: db6. 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(): 996. 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) 機能: 1842. をもっており、これ
は不要なオブジェクトを、たとえ参照カウントがゼロでなくても発見することが
できます。そのような状況はオブジェクトの参照が循環しているときに起こりえ
ます。たとえば以下の例を考えてください:

     >>> 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(): 525e. macro that automates calling
visit functions.  With ‘Py_VISIT()’, 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: 986. implementation must name its
     arguments exactly 'visit' and 'arg' in order to use *note
     Py_VISIT(): 525e.

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(): 996. 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():
1723. before clearing members.  Here is our reimplemented deallocator
using ‘PyObject_GC_UnTrack()’ 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: 985. flag to the class
flags:

     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,

これで完了です。 *note tp_alloc: 5255. スロットまたは *note tp_free:
5254. ハンドラが書かれていれば、それらを循環ガベージコレクションに使える
よう修正すればよいのです。ほとんどの拡張機能は自動的に提供されるバージョ
ンを使うでしょう。

   ---------- Footnotes ----------

   (1) Also, even with our attributes restricted to strings instances,
the user could pass arbitrary *note str: 16a. subclasses and therefore
still create reference cycles.


File: python.info,  Node: 他の型のサブクラスを作る,  Prev: 循環ガベージコレクションをサポートする,  Up: 拡張の型の定義 チュートリアル

6.2.2.5 他の型のサブクラスを作る
................................

既存の型を継承した新しい拡張型を作成することができます。組み込み型から継
承するのは特に簡単です。必要な *note PyTypeObject: ca0. を簡単に利用でき
るからです。それに比べて、 ‘PyTypeObject’ 構造体を拡張モジュール間で共有
するのは難しいです。

In this example we will create a ‘SubList’ type that inherits from the
built-in *note list: 24f. 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(): 14f9. 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__(): 8c0. method of
the base type.

This pattern is important when writing a type with custom *note tp_new:
79f. and *note tp_dealloc: 5241. members.  The ‘tp_new’ handler should
not actually create the memory for the object with its *note tp_alloc:
5255, but let the base class handle it by calling its own ‘tp_new’.

The *note PyTypeObject: ca0. struct supports a *note tp_base: 23d1.
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: 5260.; it should be done in the *note Py_mod_exec:
b79. 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: 23d1. スロットは
埋められていなければなりません。既存の型を継承する際には、 *note
tp_alloc: 5255. スロットを *note PyType_GenericNew(): 5251. で埋める必要
はありません。 - 基底型のアロケーション関数が継承されます。

After that, calling *note PyType_Ready(): 984. 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: Creating extensions without third party tools

6.2.3 拡張の型の定義: 雑多なトピック
------------------------------------

この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであ
るかについて、ざっと説明します。

以下は *note PyTypeObject: ca0. の定義です。 *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: 241b. メンバが使われます
。これらについてはあとでふれます。

     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(): 1723. 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(): 426. および *note PyErr_Restore(): 429. 関数を使うことに
よって可能になります:

     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: 986. および *note
     tp_clear: 5267. を使って) ガベージコレクションをサポートしている場
     合、 *note tp_dealloc: 5241. が呼び出されるまでに、消去されファイナ
     ライズされてしまうオブジェクトのメンバーが有り得ることです。 2つ目
     は、 ‘tp_dealloc’ の中ではオブジェクトは不安定な状態にあることです:
     つまり参照カウントが0であるということです。 (上の例にあるような) 複
     雑なオブジェクトや API の呼び出しでは、 ‘tp_dealloc’ を再度呼び出し
     、二重解放からクラッシュすることになるかもしれません。

     Python 3.4 からは、複雑なファイナライズのコードは *note tp_dealloc:
     5241. に置かず、代わりに新しく導入された *note tp_finalize: ca1. と
     いう型メソッドを使うことが推奨されています。

     参考
     ....

     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(): 1c3. 関数を使う方法と、 *note str(): 16a. 関数を使う方
法です。 (*note print(): 117b. 関数は単に ‘str()’ を呼び出します。) これ
らのハンドラはどちらも省略できます。

     reprfunc tp_repr;
     reprfunc tp_str;

*note tp_repr: 5269. ハンドラは呼び出されたインスタンスの文字列表現を格
納した文字列オブジェクトを返す必要があります。簡単な例は以下のようなもの
です:

     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: 5269. handler is specified, the interpreter will
supply a representation that uses the type's *note tp_name: 1d0b. and a
uniquely identifying value for the object.

*note tp_str: 526a. ハンドラと *note str(): 16a. の関係は、上の *note
tp_repr: 5269. ハンドラと *note repr(): 1c3. の関係に相当します。つまり
、これは Python のコードがオブジェクトのインスタンスに対して ‘str()’ を
呼び出したときに呼ばれます。この関数の実装は ‘tp_repr’ ハンドラのそれと
非常に似ていますが、得られる文字列表現は人間が読むことを意図されています
。 ‘tp_str’ が指定されていない場合、かわりに ‘tp_repr’ ハンドラが使われ
ます。

以下は簡単な例です:

     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(): 984. が呼ばれたとき、すでに属性の名前がわかっ
     ていること。

  2. 属性を参照したり設定したりするときに、特別な記録のための処理が必要
     でなく、また参照したり設定した値に対してどんな操作も実行する必要が
     ないこと。

これらの条件は、属性の値や、値が計算されるタイミング、または格納されたデ
ータがどの程度妥当なものであるかといったことになんら制約を課すものではな
いことに注意してください。

When *note PyType_Ready(): 984. is called, it uses three tables
referenced by the type object to create *note descriptor: 18e5.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: 1ac5. and *note tp_setattro: 526d. 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: 5259. is not ‘NULL’, it must refer to an array of
*note PyMethodDef: 16f5. 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: 526e. 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: 18e5. will be
constructed and added to the type which will be able to extract a value
from the instance structure.  The *note type: 526f. 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: 5270. 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: 5257. 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__: 20f1. attribute.

As with the *note tp_methods: 5259. table, a sentinel entry with a *note
ml_name: 526e. 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: 5272. 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: 5273. handler is called when the *note
__setattr__(): 23d8. or *note __delattr__(): 23d9. 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 ‘tp_setattr’
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: 5275. handler is called when comparisons are
needed.  It is analogous to the *note rich comparison methods: 240e,
like ‘__lt__()’, and also called by *note PyObject_RichCompare(): 5276.
and *note PyObject_RichCompareBool(): 1dea.

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): 5278. で解説されています。

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: 163c. 構造体、
*note PySequenceMethods: 5279. 構造体、または *note PyMappingMethods:
527a. 構造体のアドレスを入れます。これらに適切な値を入れても入れなくても
かまいません。これらを使った例は 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: 147f. is a signed integer type with a platform-varying
width.  Returning ‘-1’ from *note tp_hash: 527b. 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(): 3bf. を使います。

  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: 199. 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: 170d.
corresponds to the Python *note __iter__(): e6d. method, while *note
tp_iternext: 170e. corresponds to the Python *note __next__(): 14e9.
method.

Any *note iterable: 12f5. object must implement the *note tp_iter: 170d.
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: 170d.

   * Objects which can only be iterated over once (usually due to side
     effects of iteration, such as file objects) can implement *note
     tp_iter: 170d. by returning a new reference to themselves - and
     should also therefore implement the *note tp_iternext: 170e.
     handler.

Any *note iterator: 4c8. object should implement both *note tp_iter:
170d. and *note tp_iternext: 170e.  An iterator's ‘tp_iter’ handler
should return a new reference to the iterator.  Its ‘tp_iternext’
handler should return a new reference to the next object in the
iteration, if there is one.  If the iteration has reached the end,
‘tp_iternext’ may return ‘NULL’ without setting an exception, or it may
set *note StopIteration: df9. 'in addition' to returning ‘NULL’;
avoiding the exception can yield slightly better performance.  If an
actual error occurs, ‘tp_iternext’ 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: 11b. module.

For an object to be weakly referenceable, the extension type must set
the ‘Py_TPFLAGS_MANAGED_WEAKREF’ bit of the *note tp_flags: 1cce. field.
The legacy *note tp_weaklistoffset: b83. 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: 906. 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(): 1d10.
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: Creating extensions without third party tools

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 拡張モジュールの定義: 5281. 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: Creating extensions without third party tools

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++ 拡張のビルド: 10fe.  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:
     528c. 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(): 3bf.), 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: 442. 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():
     3bf. のような) 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: Creating extensions without third party tools,  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(): 45e. を呼び出さねばなりません。オプションとして、Python
側にコマンドライン引数を渡すために関数呼び出しを行います。その後、アプリ
ケーションのどこでもインタプリタを呼び出せるようになります。

インタプリタを呼び出すには、異なるいくつかの方法があります: Python 文が
入った文字列を *note PyRun_SimpleString(): 5290. に渡す、 stdio ファイル
ポインタとファイル名 (これはエラーメッセージ内でコードを識別するためだけ
のものです) を *note PyRun_SimpleFile(): 5291. に渡す、といった具合です
。これまでの各章で説明した低水準の操作を呼び出して、Python オブジェクト
を構築したり使用したりもできます。

参考
....

*note Python/C API reference manual: 201a.

     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: 3f0. should be called before *note
Py_InitializeFromConfig(): 3f4. to inform the interpreter about paths to
Python run-time libraries.  Next, the Python interpreter is initialized
with *note Py_Initialize(): 45e, followed by the execution of a
hard-coded Python script that prints the date and time.  Afterwards, the
*note Py_FinalizeEx(): f15. 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(): 5291. 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 コンパイルしてリンク: 5298. し
(できた実行可能形式を ‘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(): 161a.  This routine needs a Python string as its
argument, which is constructed using the *note
PyUnicode_DecodeFSDefault(): 1ae9. 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(): 45e. の呼び出しの前に挿入します:

     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:
529e. は歓迎です)、あなたのシステムのダイナミックリンクについてのドキュ
メントを読み、Python の ‘Makefile’ のコンパイルオプションを調べる必要が
あるでしょう(Makefile の場所を調べるには *note
sysconfig.get_makefile_filename(): 4cf7. を使ってください)。この場合、
*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 reference manual,  Next: Python モジュールのインストール,  Prev: Python インタプリタの拡張と埋め込み,  Up: Top

7 Python/C API reference manual
*******************************

このマニュアルでは、拡張モジュールを書いたり Python インタプリタをアプリ
ケーションに埋め込んだりしたい C/C++ プログラマが利用できる API について
述べています。 *note Python インタプリタの拡張と埋め込み: 2019. は拡張モ
ジュールを書く際の一般的な決まりごとについて記述していますが、 API の詳
細までは記述していないので、このドキュメントが手引きになります。

* Menu:

* はじめに: はじめに<14>.
* C API Stability::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* ユーティリティ: ユーティリティ<2>.
* 抽象オブジェクトレイヤ (Abstract Objects Layer): 抽象オブジェクトレイヤ Abstract Objects Layer.
* 具象オブジェクト (concrete object) レイヤ: 具象オブジェクト concrete object レイヤ.
* インタープリタの初期化と終了処理::
* Thread states and the global interpreter lock::
* Asynchronous notifications::
* Operating system thread APIs::
* 同期プリミティブ: 同期プリミティブ<3>.
* Thread-local storage support::
* Multiple interpreters in a Python process::
* Profiling and tracing::
* Reference tracing::
* Python 初期化設定::
* メモリ管理::
* オブジェクト実装サポート (object implementation support): オブジェクト実装サポート object implementation support.
* API と ABI のバージョニング::
* Monitoring C API::
* Generating Execution Events::


File: python.info,  Node: はじめに<14>,  Next: C API Stability,  Up: Python/C API reference manual

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
     引数の解釈と値の構築: 3d3. を参照してください。

Python.h で定義されている、ユーザから見える名前全て (Python.h がインクル
ードしている標準ヘッダの名前は除きます) には、接頭文字列 ‘Py’ または
‘_Py’ が付きます。‘_Py’ で始まる名前は Python 実装で内部使用するための名
前で、拡張モジュールの作者は使ってはなりません。構造体のメンバには予約済
みの接頭文字列はありません。

     注釈: API のユーザは、‘Py’ や ‘_Py’ で始まる名前を定義するコードを
     絶対に書いてはなりません。 後からコードを読む人を混乱させたり、将来
     の Python のバージョンで同じ名前が定義されて、ユーザの書いたコード
     の可搬性を危うくする可能性があります。

ヘッダファイル群は通常 Python と共にインストールされます。 Unixでは
‘`prefix'/include/pythonversion/’ および
‘`exec_prefix'/include/pythonversion/’ に置かれます。 *note prefix:
21a9. と *note exec_prefix: 21aa. は Python をビルドする際の ‘configure’
スクリプトに与えたパラメタに対応し、 'version' は ‘'%d.%d' %
sys.version_info[:2]’ に対応します。 Windows では、ヘッダは
‘`prefix'/include’ に置かれます。 ‘prefix’ はインストーラに指定したイン
ストールディレクトリです。

ヘッダをインクルードするには、各ヘッダの入ったディレクトリ (別々のディレ
クトリの場合は両方) を、コンパイラがインクルードファイルを検索するための
パスに入れます。親ディレクトリをサーチパスに入れて、 ‘#include
<pythonX.Y/Python.h>’ のようにしては 'なりません' ; *note prefix: 21a9.
内のプラットフォームに依存しないヘッダは、 *note exec_prefix: 21aa. から
プラットフォーム依存のヘッダをインクルードしているので、このような操作を
行うと複数のプラットフォームでのビルドができなくなります。

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: 1691, *note PyMODINIT_FUNC: 16f1.).  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: b5a. was passed
     on the command line (see *note PyConfig.use_environment: 409.).

* 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:
     21fc.), 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: 21fc.).

     以下はプログラム例です:

          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(): b7e.

     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(): b7e. 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: 189a. 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: 189a. macro is defined), the *note Py_ALWAYS_INLINE:
     1cc8. 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: 1668. 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: 23f. alias to ‘memcpy()’.  Use
     ‘memcpy()’ directly instead.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23f.

 -- C のマクロ: Py_VA_COPY

     This is a *note soft deprecated: 23f. 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) としても宣言できません。 PyObject*
型のポインタ変数のみ宣言できます。唯一の例外は、型オブジェクトです; 型オ
ブジェクトはメモリ解放 (deallocate) してはならないので、通常は静的記憶の
*note PyTypeObject: ca0. オブジェクトにします。

全ての Python オブジェクトには (Python 整数型ですら) 型 ('type') と参照
カウント ('reference count') があります。あるオブジェクトの型は、そのオ
ブジェクトがどの種類のオブジェクトか (例えば整数、リスト、ユーザ定義関数
、など; その他多数については *note 標準型の階層: 238b. で説明しています)
を決定します。よく知られている型については、各々マクロが存在して、あるオ
ブジェクトがその型かどうか調べられます; 例えば、 ‘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 strong
reference 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 ‘Py_DECREF()’ 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 strong
reference (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(): 996. 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: 3d5.

逆に、ある関数呼び出しで、あるオブジェクトへの参照を呼び出される関数に渡
す際には、二つの可能性: 関数がオブジェクトへの参照を '盗み取る' (steal)
場合と、そうでない場合があります。'参照を盗む' とは、関数に参照を渡した
ときに、参照の所有者がその関数になったと仮定し、関数の呼び出し元には所有
権がなくなるということです。

参照を盗み取る関数はほとんどありません; 例外としてよく知られているのは、
*note PyList_SetItem(): 191c. と *note PyTuple_SetItem(): 523d. で、これ
らはシーケンスに入れる要素に対する参照を盗み取ります (しかし、要素の入る
先のタプルやリストの参照は盗み取りません!)。これらの関数は、リストやタプ
ルの中に新たに作成されたオブジェクトを入れていく際の常套的な書き方をしや
すくするために、参照を盗み取るように設計されています; 例えば、 ‘(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(): 1c2d. は新しい参照を返し、すぐに *note
PyTuple_SetItem(): 523d. に盗まれます。参照が盗まれた後もそのオブジェク
トを利用したい場合は、参照盗む関数を呼び出す前に、 *note Py_INCREF():
78f. を利用してもう一つの参照を取得してください。

ちなみに、 *note PyTuple_SetItem(): 523d. はタプルに値をセットするための
'唯一の' 方法です; タプルは変更不能なデータ型なので、 *note
PySequence_SetItem(): 1e91. や *note PyObject_SetItem(): 52cd. を使うと
上の操作は拒否されてしまいます。自分でタプルの値を入れていくつもりなら、
‘PyTuple_SetItem()’ だけしか使えません。

同じく、リストに値を入れていくコードは *note PyList_New(): 52ce. と
*note PyList_SetItem(): 191c. で書けます。

しかし実際には、タプルやリストを生成して値を入れる際には、上記のような方
法はほとんど使いません。より汎用性のある関数、 *note Py_BuildValue():
3c0. があり、ほとんどの主要なオブジェクトをフォーマット文字列 '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(): 52cd. 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(): 1e90. のように、オブジェクトに対する
参照を返す汎用の関数は、常に新たな参照を返します (呼び出し側が参照の所有
者になります)。

重要なのは、関数が返す参照の所有権を持てるかどうかは、どの関数を呼び出す
かだけによる、と理解することです -- 関数呼び出し時の 'お飾り' (関数に引
数として渡したオブジェクトの型) は 'この問題には関係ありません!'  従って
、 *note PyList_GetItem(): 5ff. を使ってリスト内の要素を得た場合には、参
照の所有者にはなりません -- が、同じ要素を同じリストから *note
PySequence_GetItem(): 1e90. (図らずもこの関数は全く同じ引数をとります) を
使って取り出すと、返されたオブジェクトに対する参照を得ます。

以下は、整数からなるリストに対して各要素の合計を計算する関数をどのように
して書けるかを示した例です; 一つは *note PyList_GetItem(): 5ff. を使って
いて、もう一つは *note PySequence_GetItem(): 1e90. を使っています。

     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: c59.

   ---------- 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(): 1d0a. で明示的に
エラーテストを行う必要があります。これらの例外は常に明示的にドキュメント
化されます。

例外時の状態情報 (exception state)は、スレッド単位に用意された記憶領域
(per-thread storage) 内で管理されます (この記憶領域は、スレッドを使わな
いアプリケーションではグローバルな記憶領域と同じです)。一つのスレッドは
二つの状態のどちらか: 例外が発生したか、まだ発生していないか、をとります
。関数 *note PyErr_Occurred(): 1d0a. を使うと、この状態を調べられます: こ
の関数は例外が発生した際にはその例外型オブジェクトに対する借用参照
(borrowed reference) を返し、そうでないときには ‘NULL’ を返します。例外
状態を設定する関数は数多くあります: *note PyErr_SetString(): 79c. はもっ
ともよく知られている (が、もっとも汎用性のない) 例外を設定するための関数
で、 *note PyErr_Clear(): 1236. は例外状態情報を消し去る関数です。

完全な例外状態情報は、3 つのオブジェクト: 例外の型、例外の値、そしてトレ
ースバック、からなります (どのオブジェクトも ‘NULL’ を取り得ます)。これ
らの情報は、 Python の ‘sys.exc_info()’ の結果と同じ意味を持ちます; とは
いえ、 C と Python の例外状態情報は全く同じではありません: Python におけ
る例外オブジェクトは、Python の *note try: 8f9. ...  *note except: 1ac.
文で最近処理したオブジェクトを表す一方、 C レベルの例外状態情報が存続す
るのは、渡された例外情報を ‘sys.exc_info()’ その他に転送するよう取り計ら
う Python のバイトコードインタプリタのメインループに到達するまで、例外が
関数の間で受け渡しされている間だけです。

Python 1.5 からは、Python で書かれたコードから例外状態情報にアクセスする
方法として、推奨されていてスレッドセーフな方法は *note sys.exc_info():
89b. になっているので注意してください。この関数は 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(): 52d3.
および *note PyErr_Clear(): 1236. をどう使うかを示しています。また、所有
権を持っている参照で、値が ‘NULL’ になるかもしれないものを捨てるために
*note Py_XDECREF(): 996. をどう使うかも示しています (関数名に ‘'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(): 45e. です。この関
数はロード済みのモジュールからなるテーブルを作成し、土台となるモジュール
*note builtins: 13, *note __main__: 1, および *note sys: df. を作成しま
す。また、モジュール検索パス (‘sys.path’) の初期化も行います。

*note Py_Initialize(): 45e. 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: 3ef. and *note
PyConfig.parse_argv: 1d4f. must be set: see *note Python Initialization
Configuration: 646.

ほとんどのシステムでは (特に Unix と Windows は、詳細がわずかに異なりは
しますが)、 *note Py_Initialize(): 45e. は標準の 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: 3ee. を設定することでこの動作をオーバーライドしたり、 *note
PYTHONPATH: 1223. を設定して追加のディレクトリを標準モジュール検索パスの
前に挿入したりできます。

The embedding application can steer the search by setting *note
PyConfig.program_name: 3f0. 'before' calling *note
Py_InitializeFromConfig(): 3f4.  Note that *note PYTHONHOME: 3ee. still
overrides this and *note PYTHONPATH: 1223. 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(): 3e1, *note
Py_GetPrefix(): 3e3, *note Py_GetExecPrefix(): 3e7, and *note
Py_GetProgramFullPath(): 3ea. (all defined in ‘Modules/getpath.c’).

たまに、 Python を初期化前の状態にもどしたいことがあります。例えば、ある
アプリケーションでは実行を最初からやりなおし (start over) させる (*note
Py_Initialize(): 45e. をもう一度呼び出させる) ようにしたいかもしれません
。あるいは、アプリケーションが Python を一旦使い終えて、Python が確保し
たメモリを解放させたいかもしれません。 *note Py_FinalizeEx(): f15. を使
うとこうした処理を実現できます。また、関数 *note Py_IsInitialized():
52d6. は、Python が現在初期化済みの状態にある場合に真を返します。これら
の関数についてのさらなる情報は、後の章で説明します。 ‘Py_FinalizeEx()’ が
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 Stability,  Next: 超高水準レイヤ,  Prev: はじめに<14>,  Up: Python/C API reference manual

7.2 C API Stability
===================

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 プラットフォームで考慮すべき点: 52dd. 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::
* Stable Application 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: Stable Application Binary Interface,  Up: C API Stability

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: Stable Application Binary Interface,  Next: プラットフォームで考慮すべき点,  Prev: Unstable C API,  Up: C API Stability

7.2.2 Stable Application 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::
* Limited API Scope and Performance::
* Limited API Caveats::


File: python.info,  Node: Limited C API,  Next: Stable ABI,  Up: Stable Application 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: 9a1.

 -- C のマクロ: Py_LIMITED_API

     Define this macro before including ‘Python.h’ to opt in to only use
     the Limited API, and to select the Limited API version.

     Define ‘Py_LIMITED_API’ to the value of *note PY_VERSION_HEX: 380.
     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.

     Rather than using the ‘PY_VERSION_HEX’ macro directly, hardcode a
     minimum minor version (e.g.  ‘0x030A0000’ for Python 3.10) for
     stability when compiling with future Python versions.

     You can also define ‘Py_LIMITED_API’ to ‘3’.  This works the same
     as ‘0x03020000’ (Python 3.2, the version that introduced Limited
     API).


File: python.info,  Node: Stable ABI,  Next: Limited API Scope and Performance,  Prev: Limited C API,  Up: Stable Application 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.

On Windows, extensions that use the Stable ABI should be linked against
‘python3.dll’ rather than a version-specific library such as
‘python39.dll’.

On some platforms, Python will look for and load shared library files
named with the ‘abi3’ tag (e.g.  ‘mymodule.abi3.so’).  It does not check
if such extensions conform to a Stable ABI. The user (or their packaging
tools) need to ensure that, for example, extensions built with the 3.10+
Limited API are not installed for lower versions of Python.

All functions in the Stable ABI are present as functions in Python's
shared library, not solely as macros.  This makes them usable from
languages that don't use the C preprocessor.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0387/


File: python.info,  Node: Limited API Scope and Performance,  Next: Limited API Caveats,  Prev: Stable ABI,  Up: Stable Application Binary Interface

7.2.2.3 Limited API Scope and Performance
.........................................

The goal for the Limited API is to allow everything that is possible
with the full C API, but possibly with a performance penalty.

For example, while *note PyList_GetItem(): 5ff. is available, its
“unsafe” macro variant *note PyList_GET_ITEM(): 52e4. is not.  The macro
can be faster because it can rely on version-specific implementation
details of the list object.

Without ‘Py_LIMITED_API’ defined, some C API functions are inlined or
replaced by macros.  Defining ‘Py_LIMITED_API’ disables this inlining,
allowing stability as Python's data structures are improved, but
possibly reducing performance.

By leaving out the ‘Py_LIMITED_API’ definition, it is possible to
compile a Limited API extension with a version-specific ABI. This can
improve performance for that Python version, but will limit
compatibility.  Compiling with ‘Py_LIMITED_API’ will then yield an
extension that can be distributed where a version-specific one is not
available – for example, for prereleases of an upcoming Python version.


File: python.info,  Node: Limited API Caveats,  Prev: Limited API Scope and Performance,  Up: Stable Application Binary Interface

7.2.2.4 Limited API Caveats
...........................

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: 52e2.  ‘Py_LIMITED_API’ only covers definitions, but an API also
includes other issues, such as expected semantics.

One issue that ‘Py_LIMITED_API’ does not guard against is calling a
function with arguments that are invalid in a lower Python version.  For
example, consider a function that starts accepting ‘NULL’ for an
argument.  In Python 3.9, ‘NULL’ now selects a default behavior, but in
Python 3.8, the argument will be used directly, causing a ‘NULL’
dereference and crash.  A similar argument works for fields of structs.

Another issue is that some struct fields are currently not hidden when
‘Py_LIMITED_API’ is defined, even though they're part of the Limited
API.

For these reasons, we recommend testing an extension with 'all' minor
Python versions it supports, and preferably to build with the 'lowest'
such version.

また、使用するすべての API のドキュメントを確認し、それが明示的に
Limited API の一部であるかどうかをチェックすることをお勧めします。
‘Py_LIMITED_API’ が定義されていても、技術的な理由で(あるいはバグとして意
図せず)いくつかのプライベート宣言が公開されることがあります。

Also note that the Limited API is not necessarily stable: compiling with
‘Py_LIMITED_API’ with Python 3.8 means that the extension will run with
Python 3.12, but it will not necessarily 'compile' with Python 3.12.  In
particular, parts of the Limited API may be deprecated and removed,
provided that the Stable ABI stays stable.


File: python.info,  Node: プラットフォームで考慮すべき点,  Next: 限定版APIの内容,  Prev: Stable Application Binary Interface,  Up: C API Stability

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: 52e2, these details define a “platform”.  They usually
depend on the OS type and processor architecture

It is the responsibility of each particular distributor of Python to
ensure that all Python versions on a particular platform are built in a
way that does not break the Stable ABI. This is the case with Windows
and macOS releases from ‘python.org’ and many third-party distributors.


File: python.info,  Node: 限定版APIの内容,  Prev: プラットフォームで考慮すべき点,  Up: C API Stability

7.2.4 限定版APIの内容
---------------------

Currently, the *note Limited API: 637. includes the following items:

   * *note METH_CLASS: 16f3.

   * *note METH_COEXIST: 1695.

   * *note METH_FASTCALL: 19fd.

   * *note METH_METHOD: b6c.

   * *note METH_NOARGS: 16f2.

   * *note METH_O: 1725.

   * *note METH_STATIC: 16f4.

   * *note METH_VARARGS: 1726.

   * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 780.

   * *note PyAIter_Check(): 52e8.

   * *note PyArg_Parse(): 1874.

   * *note PyArg_ParseTuple(): 3bf.

   * *note PyArg_ParseTupleAndKeywords(): 624.

   * *note PyArg_UnpackTuple(): 1724.

   * *note PyArg_VaParse(): 52e9.

   * *note PyArg_VaParseTupleAndKeywords(): 625.

   * *note PyArg_ValidateKeywordArguments(): 52ea.

   * *note PyBUF_ANY_CONTIGUOUS: 52eb.

   * *note PyBUF_CONTIG: 52ec.

   * *note PyBUF_CONTIG_RO: 52ed.

   * *note PyBUF_C_CONTIGUOUS: 15d4.

   * *note PyBUF_FORMAT: 52ee.

   * *note PyBUF_FULL: 52ef.

   * *note PyBUF_FULL_RO: 52f0.

   * *note PyBUF_F_CONTIGUOUS: 15d5.

   * *note PyBUF_INDIRECT: 52f1.

   * *note PyBUF_MAX_NDIM: 52f2.

   * *note PyBUF_ND: 52f3.

   * *note PyBUF_READ: 1a6d.

   * *note PyBUF_RECORDS: 52f4.

   * *note PyBUF_RECORDS_RO: 52f5.

   * *note PyBUF_SIMPLE: 52f6.

   * *note PyBUF_STRIDED: 52f7.

   * *note PyBUF_STRIDED_RO: 52f8.

   * *note PyBUF_STRIDES: 52f9.

   * *note PyBUF_WRITABLE: 15d3.

   * *note PyBUF_WRITE: 1a6e.

   * *note PyBaseObject_Type: 52fa.

   * *note PyBool_FromLong(): 52fb.

   * *note PyBool_Type: 52fc.

   * *note PyBuffer_FillContiguousStrides(): 967.

   * *note PyBuffer_FillInfo(): 968.

   * *note PyBuffer_FromContiguous(): 964.

   * *note PyBuffer_GetPointer(): 961.

   * *note PyBuffer_IsContiguous(): 966.

   * *note PyBuffer_Release(): 63b.

   * *note PyBuffer_SizeFromFormat(): 962.

   * *note PyBuffer_ToContiguous(): 963.

   * *note PyByteArrayIter_Type: 52fd.

   * *note PyByteArray_AsString(): 52fe.

   * *note PyByteArray_Concat(): 52ff.

   * *note PyByteArray_FromObject(): 15c6.

   * *note PyByteArray_FromStringAndSize(): 15c7.

   * *note PyByteArray_Resize(): 5300.

   * *note PyByteArray_Size(): 5301.

   * *note PyByteArray_Type: 5302.

   * *note PyBytesIter_Type: 5303.

   * *note PyBytes_AsString(): a8b.

   * *note PyBytes_AsStringAndSize(): 5304.

   * *note PyBytes_Concat(): 5305.

   * *note PyBytes_ConcatAndDel(): 5306.

   * *note PyBytes_DecodeEscape(): 5307.

   * *note PyBytes_FromFormat(): 1e68.

   * *note PyBytes_FromFormatV(): 5308.

   * *note PyBytes_FromObject(): 5309.

   * *note PyBytes_FromString(): 530a.

   * *note PyBytes_FromStringAndSize(): 15bc.

   * *note PyBytes_Repr(): 530b.

   * *note PyBytes_Size(): 530c.

   * *note PyBytes_Type: 530d.

   * *note PyCFunction: 1696.

   * *note PyCFunctionFast: 530e.

   * *note PyCFunctionFastWithKeywords: 530f.

   * *note PyCFunctionWithKeywords: 5310.

   * *note PyCFunction_GetFlags(): 5311.

   * *note PyCFunction_GetFunction(): 5312.

   * *note PyCFunction_GetSelf(): 5313.

   * *note PyCFunction_New(): 1d0c.

   * *note PyCFunction_NewEx(): 1dd4.

   * *note PyCFunction_Type: 5314.

   * *note PyCMethod_New(): 1d06.

   * *note PyCallIter_New(): 5315.

   * *note PyCallIter_Type: 5316.

   * *note PyCallable_Check(): 5317.

   * *note PyCapsule_Destructor: 5318.

   * *note PyCapsule_GetContext(): 5319.

   * *note PyCapsule_GetDestructor(): 531a.

   * *note PyCapsule_GetName(): 531b.

   * *note PyCapsule_GetPointer(): 531c.

   * *note PyCapsule_Import(): 1c6d.

   * *note PyCapsule_IsValid(): 1578.

   * *note PyCapsule_New(): 5248.

   * *note PyCapsule_SetContext(): 531d.

   * *note PyCapsule_SetDestructor(): 531e.

   * *note PyCapsule_SetName(): 531f.

   * *note PyCapsule_SetPointer(): 5320.

   * *note PyCapsule_Type: 5321.

   * *note PyClassMethodDescr_Type: 5322.

   * *note PyCodec_BackslashReplaceErrors(): 5323.

   * *note PyCodec_Decode(): 3df.

   * *note PyCodec_Decoder(): 5324.

   * *note PyCodec_Encode(): 3e0.

   * *note PyCodec_Encoder(): 5325.

   * *note PyCodec_IgnoreErrors(): 5326.

   * *note PyCodec_IncrementalDecoder(): 5327.

   * *note PyCodec_IncrementalEncoder(): 5328.

   * *note PyCodec_KnownEncoding(): 5329.

   * *note PyCodec_LookupError(): 532a.

   * *note PyCodec_NameReplaceErrors(): 10b3.

   * *note PyCodec_Register(): 532b.

   * *note PyCodec_RegisterError(): 532c.

   * *note PyCodec_ReplaceErrors(): 532d.

   * *note PyCodec_StreamReader(): 532e.

   * *note PyCodec_StreamWriter(): 532f.

   * *note PyCodec_StrictErrors(): 5330.

   * *note PyCodec_Unregister(): a9b.

   * *note PyCodec_XMLCharRefReplaceErrors(): 5331.

   * *note PyComplex_FromDoubles(): 5332.

   * *note PyComplex_ImagAsDouble(): 1a75.

   * *note PyComplex_RealAsDouble(): 1a74.

   * *note PyComplex_Type: 5333.

   * *note PyDescr_NewClassMethod(): 5334.

   * *note PyDescr_NewGetSet(): 5335.

   * *note PyDescr_NewMember(): 5336.

   * *note PyDescr_NewMethod(): 1dd3.

   * *note PyDictItems_Type: 5337.

   * *note PyDictIterItem_Type: 5338.

   * *note PyDictIterKey_Type: 5339.

   * *note PyDictIterValue_Type: 533a.

   * *note PyDictKeys_Type: 533b.

   * *note PyDictProxy_New(): 533c.

   * *note PyDictProxy_Type: 533d.

   * *note PyDictRevIterItem_Type: 533e.

   * *note PyDictRevIterKey_Type: 533f.

   * *note PyDictRevIterValue_Type: 5340.

   * *note PyDictValues_Type: 5341.

   * *note PyDict_Clear(): 5342.

   * *note PyDict_Contains(): 5de.

   * *note PyDict_Copy(): 662.

   * *note PyDict_DelItem(): 5343.

   * *note PyDict_DelItemString(): 5344.

   * *note PyDict_GetItem(): 628.

   * *note PyDict_GetItemRef(): 5e0.

   * *note PyDict_GetItemString(): 629.

   * *note PyDict_GetItemStringRef(): 41f.

   * *note PyDict_GetItemWithError(): 5e1.

   * *note PyDict_Items(): 5345.

   * *note PyDict_Keys(): 5346.

   * *note PyDict_Merge(): 5347.

   * *note PyDict_MergeFromSeq2(): 5348.

   * *note PyDict_New(): 5349.

   * *note PyDict_Next(): 19ee.

   * *note PyDict_SetItem(): 523e.

   * *note PyDict_SetItemString(): 19ec.

   * *note PyDict_Size(): 534a.

   * *note PyDict_Type: 534b.

   * *note PyDict_Update(): 534c.

   * *note PyDict_Values(): 534d.

   * *note PyEllipsis_Type: 534e.

   * *note PyEnum_Type: 534f.

   * *note PyErr_BadArgument(): 5350.

   * *note PyErr_BadInternalCall(): 5351.

   * *note PyErr_CheckSignals(): 693.

   * *note PyErr_Clear(): 1236.

   * ‘PyErr_Display()’

   * *note PyErr_DisplayException(): 433.

   * *note PyErr_ExceptionMatches(): 52d3.

   * *note PyErr_Fetch(): 426.

   * *note PyErr_Format(): 10b5.

   * *note PyErr_FormatV(): 10b4.

   * *note PyErr_GetExcInfo(): 97a.

   * *note PyErr_GetHandledException(): 977.

   * *note PyErr_GetRaisedException(): 427.

   * *note PyErr_GivenExceptionMatches(): 5352.

   * *note PyErr_NewException(): 1485.

   * *note PyErr_NewExceptionWithDoc(): 1484.

   * *note PyErr_NoMemory(): 521d.

   * *note PyErr_NormalizeException(): 428.

   * *note PyErr_Occurred(): 1d0a.

   * *note PyErr_Print(): 1d8a.

   * *note PyErr_PrintEx(): 5353.

   * *note PyErr_ProgramText(): 5354.

   * *note PyErr_ResourceWarning(): f17.

   * *note PyErr_Restore(): 429.

   * *note PyErr_SetExcFromWindowsErr(): 5355.

   * *note PyErr_SetExcFromWindowsErrWithFilename(): 1ae7.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObject(): 5356.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObjects(): 5357.

   * *note PyErr_SetExcInfo(): 979.

   * *note PyErr_SetFromErrno(): 521c.

   * *note PyErr_SetFromErrnoWithFilename(): 1ae6.

   * *note PyErr_SetFromErrnoWithFilenameObject(): 5358.

   * *note PyErr_SetFromErrnoWithFilenameObjects(): 5359.

   * *note PyErr_SetFromWindowsErr(): 535a.

   * *note PyErr_SetFromWindowsErrWithFilename(): 1ae8.

   * *note PyErr_SetHandledException(): 978.

   * *note PyErr_SetImportError(): f3d.

   * *note PyErr_SetImportErrorSubclass(): f16.

   * *note PyErr_SetInterrupt(): 535b.

   * *note PyErr_SetInterruptEx(): aa2.

   * *note PyErr_SetNone(): 535c.

   * *note PyErr_SetObject(): 79b.

   * *note PyErr_SetRaisedException(): 42a.

   * *note PyErr_SetString(): 79c.

   * *note PyErr_SyntaxLocation(): 535d.

   * *note PyErr_SyntaxLocationEx(): 535e.

   * *note PyErr_WarnEx(): 166a.

   * *note PyErr_WarnExplicit(): 1aee.

   * *note PyErr_WarnFormat(): 535f.

   * *note PyErr_WriteUnraisable(): 5f2.

   * *note PyEval_AcquireThread(): 649.

   * *note PyEval_EvalCode(): a8a.

   * *note PyEval_EvalCodeEx(): 1b39.

   * *note PyEval_EvalFrame(): 5360.

   * *note PyEval_EvalFrameEx(): 1233.

   * *note PyEval_GetBuiltins(): 5f4.

   * *note PyEval_GetFrame(): 1b98.

   * *note PyEval_GetFrameBuiltins(): 5f3.

   * *note PyEval_GetFrameGlobals(): 5f5.

   * *note PyEval_GetFrameLocals(): 5f7.

   * *note PyEval_GetFuncDesc(): 5361.

   * *note PyEval_GetFuncName(): 5362.

   * *note PyEval_GetGlobals(): 5f6.

   * *note PyEval_GetLocals(): 5f8.

   * *note PyEval_InitThreads(): 1a16.

   * *note PyEval_ReleaseThread(): 5363.

   * *note PyEval_RestoreThread(): 648.

   * *note PyEval_SaveThread(): 647.

   * *note PyExc_ArithmeticError: 5364.

   * *note PyExc_AssertionError: 5365.

   * *note PyExc_AttributeError: 5366.

   * *note PyExc_BaseException: 5367.

   * *note PyExc_BaseExceptionGroup: 5368.

   * *note PyExc_BlockingIOError: 5369.

   * *note PyExc_BrokenPipeError: 536a.

   * *note PyExc_BufferError: 536b.

   * *note PyExc_BytesWarning: 536c.

   * *note PyExc_ChildProcessError: 536d.

   * *note PyExc_ConnectionAbortedError: 536e.

   * *note PyExc_ConnectionError: 536f.

   * *note PyExc_ConnectionRefusedError: 5370.

   * *note PyExc_ConnectionResetError: 5371.

   * *note PyExc_DeprecationWarning: 5372.

   * *note PyExc_EOFError: 5373.

   * *note PyExc_EncodingWarning: 5374.

   * *note PyExc_EnvironmentError: 5375.

   * *note PyExc_Exception: 5376.

   * *note PyExc_FileExistsError: 5377.

   * *note PyExc_FileNotFoundError: 5378.

   * *note PyExc_FloatingPointError: 5379.

   * *note PyExc_FutureWarning: 537a.

   * *note PyExc_GeneratorExit: 537b.

   * *note PyExc_IOError: 537c.

   * *note PyExc_ImportError: 537d.

   * *note PyExc_ImportWarning: 537e.

   * *note PyExc_IndentationError: 537f.

   * *note PyExc_IndexError: 5380.

   * *note PyExc_InterruptedError: 5381.

   * *note PyExc_IsADirectoryError: 5382.

   * *note PyExc_KeyError: 5383.

   * *note PyExc_KeyboardInterrupt: 5384.

   * *note PyExc_LookupError: 5385.

   * *note PyExc_MemoryError: 5386.

   * *note PyExc_ModuleNotFoundError: 5387.

   * *note PyExc_NameError: 5388.

   * *note PyExc_NotADirectoryError: 5389.

   * *note PyExc_NotImplementedError: 538a.

   * *note PyExc_OSError: 521f.

   * *note PyExc_OverflowError: 538b.

   * *note PyExc_PendingDeprecationWarning: 538c.

   * *note PyExc_PermissionError: 538d.

   * *note PyExc_ProcessLookupError: 538e.

   * *note PyExc_RecursionError: 10b6.

   * *note PyExc_ReferenceError: 538f.

   * *note PyExc_ResourceWarning: 5390.

   * *note PyExc_RuntimeError: 5391.

   * *note PyExc_RuntimeWarning: 5392.

   * *note PyExc_StopAsyncIteration: 5393.

   * *note PyExc_StopIteration: 5394.

   * *note PyExc_SyntaxError: 5395.

   * *note PyExc_SyntaxWarning: 5396.

   * *note PyExc_SystemError: 5397.

   * *note PyExc_SystemExit: 5398.

   * *note PyExc_TabError: 5399.

   * *note PyExc_TimeoutError: 539a.

   * *note PyExc_TypeError: 521e.

   * *note PyExc_UnboundLocalError: 539b.

   * *note PyExc_UnicodeDecodeError: 539c.

   * *note PyExc_UnicodeEncodeError: 539d.

   * *note PyExc_UnicodeError: 539e.

   * *note PyExc_UnicodeTranslateError: 539f.

   * *note PyExc_UnicodeWarning: 53a0.

   * *note PyExc_UserWarning: 53a1.

   * *note PyExc_ValueError: 5220.

   * *note PyExc_Warning: 53a2.

   * *note PyExc_WindowsError: 53a3.

   * *note PyExc_ZeroDivisionError: 521b.

   * *note PyExceptionClass_Name(): c5f.

   * *note PyException_GetArgs(): 78b.

   * *note PyException_GetCause(): 53a4.

   * *note PyException_GetContext(): 53a5.

   * *note PyException_GetTraceback(): 53a6.

   * *note PyException_SetArgs(): 78c.

   * *note PyException_SetCause(): 53a7.

   * *note PyException_SetContext(): 53a8.

   * *note PyException_SetTraceback(): 1e2a.

   * *note PyFile_FromFd(): 53a9.

   * *note PyFile_GetLine(): 53aa.

   * *note PyFile_WriteObject(): 53ab.

   * *note PyFile_WriteString(): 53ac.

   * *note PyFilter_Type: 53ad.

   * *note PyFloat_AsDouble(): c63.

   * *note PyFloat_FromDouble(): 53ae.

   * *note PyFloat_FromString(): 53af.

   * *note PyFloat_GetInfo(): 160e.

   * *note PyFloat_GetMax(): 160c.

   * *note PyFloat_GetMin(): 160d.

   * *note PyFloat_Type: 53b0.

   * *note PyFrameObject: 990.

   * *note PyFrame_GetCode(): 991.

   * *note PyFrame_GetLineNumber(): 992.

   * *note PyFrozenSet_New(): 1663.

   * *note PyFrozenSet_Type: 53b1.

   * *note PyGC_Collect(): b89.

   * *note PyGC_Disable(): aa9.

   * *note PyGC_Enable(): aa8.

   * *note PyGC_IsEnabled(): aaa.

   * *note PyGILState_Ensure(): 64a.

   * *note PyGILState_GetThisThreadState(): 53b2.

   * *note PyGILState_Release(): 64b.

   * *note PyGILState_STATE: 53b3.

   * *note PyGetSetDef: db6.

   * *note PyGetSetDescr_Type: 53b4.

   * *note PyImport_AddModule(): 5fc.

   * *note PyImport_AddModuleObject(): 53b5.

   * *note PyImport_AddModuleRef(): 5fb.

   * *note PyImport_AppendInittab(): 1b7b.

   * *note PyImport_ExecCodeModule(): 53b6.

   * *note PyImport_ExecCodeModuleEx(): 53b7.

   * *note PyImport_ExecCodeModuleObject(): 53b8.

   * *note PyImport_ExecCodeModuleWithPathnames(): 53b9.

   * *note PyImport_GetImporter(): 1ae5.

   * *note PyImport_GetMagicNumber(): 13bf.

   * *note PyImport_GetMagicTag(): 53ba.

   * *note PyImport_GetModule(): db0.

   * *note PyImport_GetModuleDict(): 53bb.

   * *note PyImport_Import(): 161a.

   * *note PyImport_ImportFrozenModule(): 53bc.

   * *note PyImport_ImportFrozenModuleObject(): 53bd.

   * *note PyImport_ImportModule(): 3da.

   * *note PyImport_ImportModuleLevel(): 13c0.

   * *note PyImport_ImportModuleLevelObject(): 53be.

   * *note PyImport_ImportModuleNoBlock(): 3d9.

   * *note PyImport_ReloadModule(): 53bf.

   * *note PyIndex_Check(): b85.

   * *note PyInterpreterState: abe.

   * *note PyInterpreterState_Clear(): 4ad8.

   * *note PyInterpreterState_Delete(): 53c0.

   * *note PyInterpreterState_Get(): 64c.

   * *note PyInterpreterState_GetDict(): 53c1.

   * *note PyInterpreterState_GetID(): dc3.

   * *note PyInterpreterState_New(): 4ad9.

   * *note PyIter_Check(): 1d0d.

   * *note PyIter_Next(): 397.

   * *note PyIter_NextItem(): 396.

   * *note PyIter_Send(): a9c.

   * *note PyListIter_Type: 53c2.

   * *note PyListRevIter_Type: 53c3.

   * *note PyList_Append(): 53c4.

   * *note PyList_AsTuple(): 53c5.

   * *note PyList_GetItem(): 5ff.

   * *note PyList_GetItemRef(): 5fe.

   * *note PyList_GetSlice(): 53c6.

   * *note PyList_Insert(): 191b.

   * *note PyList_New(): 52ce.

   * *note PyList_Reverse(): 53c7.

   * *note PyList_SetItem(): 191c.

   * *note PyList_SetSlice(): 53c8.

   * *note PyList_Size(): 1638.

   * *note PyList_Sort(): 53c9.

   * *note PyList_Type: 5260.

   * *note PyLongObject: 39c.

   * *note PyLongRangeIter_Type: 53ca.

   * *note PyLong_AsDouble(): 19d5.

   * *note PyLong_AsInt(): 604.

   * *note PyLong_AsInt32(): 39d.

   * *note PyLong_AsInt64(): 39e.

   * *note PyLong_AsLong(): 605.

   * *note PyLong_AsLongAndOverflow(): 1481.

   * *note PyLong_AsLongLong(): 53cb.

   * *note PyLong_AsLongLongAndOverflow(): 1482.

   * *note PyLong_AsNativeBytes(): 606.

   * *note PyLong_AsSize_t(): 53cc.

   * *note PyLong_AsSsize_t(): 53cd.

   * *note PyLong_AsUInt32(): 39f.

   * *note PyLong_AsUInt64(): 3a0.

   * *note PyLong_AsUnsignedLong(): 53ce.

   * *note PyLong_AsUnsignedLongLong(): 14b0.

   * *note PyLong_AsUnsignedLongLongMask(): 1e26.

   * *note PyLong_AsUnsignedLongMask(): 53cf.

   * *note PyLong_AsVoidPtr(): 53d0.

   * *note PyLong_FromDouble(): b40.

   * *note PyLong_FromInt32(): 3a1.

   * *note PyLong_FromInt64(): 3a2.

   * *note PyLong_FromLong(): 1c2d.

   * *note PyLong_FromLongLong(): 1c2e.

   * *note PyLong_FromNativeBytes(): 607.

   * *note PyLong_FromSize_t(): 1921.

   * *note PyLong_FromSsize_t(): 1901.

   * *note PyLong_FromString(): 53d1.

   * *note PyLong_FromUInt32(): 3a3.

   * *note PyLong_FromUInt64(): 3a4.

   * *note PyLong_FromUnsignedLong(): 191f.

   * *note PyLong_FromUnsignedLongLong(): 1920.

   * *note PyLong_FromUnsignedNativeBytes(): 608.

   * *note PyLong_FromVoidPtr(): 53d2.

   * *note PyLong_GetInfo(): 53d3.

   * *note PyLong_Type: 53d4.

   * *note PyMap_Type: 53d5.

   * *note PyMapping_Check(): 53d6.

   * *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(): dbb.

   * *note PyMapping_Keys(): db9.

   * *note PyMapping_Length(): 53d7.

   * *note PyMapping_SetItemString(): 53d8.

   * *note PyMapping_Size(): 1e93.

   * *note PyMapping_Values(): dba.

   * *note PyMem_Calloc(): 10b1.

   * *note PyMem_Free(): 1660.

   * *note PyMem_Malloc(): e63.

   * *note PyMem_RawCalloc(): 632.

   * *note PyMem_RawFree(): 634.

   * *note PyMem_RawMalloc(): 631.

   * *note PyMem_RawRealloc(): 633.

   * *note PyMem_Realloc(): 1237.

   * *note PyMemberDef: 771.

   * *note PyMemberDescr_Type: 53d9.

   * *note PyMember_GetOne(): 7aa.

   * *note PyMember_SetOne(): 7ab.

   * *note PyMemoryView_FromBuffer(): 969.

   * *note PyMemoryView_FromMemory(): 138c.

   * *note PyMemoryView_FromObject(): 53da.

   * *note PyMemoryView_GetContiguous(): 53db.

   * *note PyMemoryView_Type: 53dc.

   * *note PyMethodDef: 16f5.

   * *note PyMethodDescr_Type: 53dd.

   * *note PyModuleDef: b78.

   * ‘PyModuleDef_Base’

   * *note PyModuleDef_Init(): 5227.

   * *note PyModuleDef_Slot: 53de.

   * *note PyModuleDef_Type: 53df.

   * *note PyModule_Add(): 609.

   * *note PyModule_AddFunctions(): 53e0.

   * *note PyModule_AddIntConstant(): 175a.

   * *note PyModule_AddObject(): 60b.

   * *note PyModule_AddObjectRef(): 60a.

   * *note PyModule_AddStringConstant(): 175b.

   * *note PyModule_AddType(): b70.

   * *note PyModule_Create2(): 53e1.

   * *note PyModule_ExecDef(): 10b9.

   * *note PyModule_FromDefAndSpec2(): 10b8.

   * *note PyModule_GetDef(): 53e2.

   * *note PyModule_GetDict(): 53e3.

   * *note PyModule_GetFilename(): 42b.

   * *note PyModule_GetFilenameObject(): 42c.

   * *note PyModule_GetName(): 53e4.

   * *note PyModule_GetNameObject(): 53e5.

   * *note PyModule_GetState(): b7b.

   * *note PyModule_New(): 53e6.

   * *note PyModule_NewObject(): 53e7.

   * *note PyModule_SetDocString(): 53e8.

   * *note PyModule_Type: 53e9.

   * *note PyNumber_Absolute(): 53ea.

   * *note PyNumber_Add(): 53eb.

   * *note PyNumber_And(): 53ec.

   * *note PyNumber_AsSsize_t(): 53ed.

   * *note PyNumber_Check(): c60.

   * *note PyNumber_Divmod(): 53ee.

   * *note PyNumber_Float(): c62.

   * *note PyNumber_FloorDivide(): 53ef.

   * *note PyNumber_InPlaceAdd(): 53f0.

   * *note PyNumber_InPlaceAnd(): 53f1.

   * *note PyNumber_InPlaceFloorDivide(): 53f2.

   * *note PyNumber_InPlaceLshift(): 53f3.

   * *note PyNumber_InPlaceMatrixMultiply(): 10bb.

   * *note PyNumber_InPlaceMultiply(): 53f4.

   * *note PyNumber_InPlaceOr(): 53f5.

   * *note PyNumber_InPlacePower(): 53f6.

   * *note PyNumber_InPlaceRemainder(): 53f7.

   * *note PyNumber_InPlaceRshift(): 53f8.

   * *note PyNumber_InPlaceSubtract(): 53f9.

   * *note PyNumber_InPlaceTrueDivide(): 53fa.

   * *note PyNumber_InPlaceXor(): 53fb.

   * *note PyNumber_Index(): a97.

   * *note PyNumber_Invert(): 53fc.

   * *note PyNumber_Long(): c61.

   * *note PyNumber_Lshift(): 53fd.

   * *note PyNumber_MatrixMultiply(): 10ba.

   * *note PyNumber_Multiply(): 53fe.

   * *note PyNumber_Negative(): 53ff.

   * *note PyNumber_Or(): 5400.

   * *note PyNumber_Positive(): 5401.

   * *note PyNumber_Power(): 5402.

   * *note PyNumber_Remainder(): 5403.

   * *note PyNumber_Rshift(): 5404.

   * *note PyNumber_Subtract(): 5405.

   * *note PyNumber_ToBase(): 1bd2.

   * *note PyNumber_TrueDivide(): 5406.

   * *note PyNumber_Xor(): 5407.

   * *note PyOS_AfterFork(): 42d.

   * *note PyOS_AfterFork_Child(): 42e.

   * *note PyOS_AfterFork_Parent(): dbd.

   * *note PyOS_BeforeFork(): dbc.

   * *note PyOS_CheckStack(): 1bfe.

   * *note PyOS_FSPath(): f18.

   * *note PyOS_InputHook: 7a4.

   * *note PyOS_InterruptOccurred(): 1da0.

   * *note PyOS_double_to_string(): 5408.

   * *note PyOS_getsig(): 175c.

   * *note PyOS_mystricmp(): 1d99.

   * *note PyOS_mystrnicmp(): 1d98.

   * *note PyOS_setsig(): 175d.

   * *note PyOS_sighandler_t: 5409.

   * *note PyOS_snprintf(): 1727.

   * *note PyOS_string_to_double(): 14b1.

   * *note PyOS_strtol(): 540a.

   * *note PyOS_strtoul(): 540b.

   * *note PyOS_vsnprintf(): 1728.

   * *note PyObject: 5df.

   * *note PyObject.ob_refcnt: aa3.

   * *note PyObject.ob_type: 5252.

   * *note PyObject_ASCII(): 540c.

   * *note PyObject_AsFileDescriptor(): 540d.

   * *note PyObject_Bytes(): 540e.

   * *note PyObject_Call(): 63d.

   * *note PyObject_CallFunction(): 63f.

   * *note PyObject_CallFunctionObjArgs(): 540f.

   * *note PyObject_CallMethod(): 640.

   * *note PyObject_CallMethodObjArgs(): 1e3b.

   * *note PyObject_CallNoArgs(): 63c.

   * *note PyObject_CallObject(): 5231.

   * *note PyObject_Calloc(): 10b2.

   * *note PyObject_CheckBuffer(): 639.

   * *note PyObject_ClearWeakRefs(): 796.

   * *note PyObject_CopyData(): 965.

   * *note PyObject_DelAttr(): 1897.

   * *note PyObject_DelAttrString(): 1898.

   * *note PyObject_DelItem(): 5410.

   * *note PyObject_DelItemString(): 5411.

   * *note PyObject_Dir(): 5412.

   * *note PyObject_Format(): 5413.

   * *note PyObject_Free(): e64.

   * *note PyObject_GC_Del(): 1721.

   * *note PyObject_GC_IsFinalized(): b72.

   * *note PyObject_GC_IsTracked(): b71.

   * *note PyObject_GC_Track(): 1722.

   * *note PyObject_GC_UnTrack(): 1723.

   * *note PyObject_GenericGetAttr(): 5414.

   * *note PyObject_GenericGetDict(): 1d63.

   * *note PyObject_GenericSetAttr(): 5415.

   * *note PyObject_GenericSetDict(): 5416.

   * *note PyObject_GetAIter(): 5417.

   * *note PyObject_GetAttr(): 5ee.

   * *note PyObject_GetAttrString(): 5ef.

   * *note PyObject_GetBuffer(): 63a.

   * *note PyObject_GetItem(): 5ea.

   * *note PyObject_GetIter(): 5418.

   * *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(): 434.

   * *note PyObject_HashNotImplemented(): 15e4.

   * *note PyObject_Init(): c64.

   * *note PyObject_InitVar(): 1d9e.

   * *note PyObject_IsInstance(): 10aa.

   * *note PyObject_IsSubclass(): 10ab.

   * *note PyObject_IsTrue(): 5419.

   * *note PyObject_Length(): 541a.

   * *note PyObject_Malloc(): e66.

   * *note PyObject_Not(): 541b.

   * *note PyObject_Realloc(): 1661.

   * *note PyObject_Repr(): 1234.

   * *note PyObject_RichCompare(): 5276.

   * *note PyObject_RichCompareBool(): 1dea.

   * *note PyObject_SelfIter(): 541c.

   * *note PyObject_SetAttr(): 17c8.

   * *note PyObject_SetAttrString(): 19ed.

   * *note PyObject_SetItem(): 52cd.

   * *note PyObject_Size(): 541d.

   * *note PyObject_Str(): 1235.

   * *note PyObject_Type(): 541e.

   * *note PyObject_Vectorcall(): 77e.

   * *note PyObject_VectorcallMethod(): 77f.

   * *note PyProperty_Type: 541f.

   * *note PyRangeIter_Type: 5420.

   * *note PyRange_Type: 5421.

   * *note PyReversed_Type: 5422.

   * *note PySeqIter_New(): 5423.

   * *note PySeqIter_Type: 5424.

   * *note PySequence_Check(): 5425.

   * *note PySequence_Concat(): 5426.

   * *note PySequence_Contains(): 3d7.

   * *note PySequence_Count(): 5427.

   * *note PySequence_DelItem(): 1e92.

   * *note PySequence_DelSlice(): 5428.

   * *note PySequence_Fast(): 1905.

   * *note PySequence_GetItem(): 1e90.

   * *note PySequence_GetSlice(): 5429.

   * *note PySequence_In(): 3d6.

   * *note PySequence_InPlaceConcat(): 542a.

   * *note PySequence_InPlaceRepeat(): 542b.

   * *note PySequence_Index(): 542c.

   * *note PySequence_Length(): 542d.

   * *note PySequence_List(): 542e.

   * *note PySequence_Repeat(): 542f.

   * *note PySequence_SetItem(): 1e91.

   * *note PySequence_SetSlice(): 5430.

   * *note PySequence_Size(): 1e8f.

   * *note PySequence_Tuple(): 5431.

   * *note PySetIter_Type: 5432.

   * *note PySet_Add(): 1664.

   * *note PySet_Clear(): 5433.

   * *note PySet_Contains(): 1666.

   * *note PySet_Discard(): 1665.

   * *note PySet_New(): 1662.

   * *note PySet_Pop(): 5434.

   * *note PySet_Size(): 1667.

   * *note PySet_Type: 5435.

   * *note PySlice_AdjustIndices(): 431.

   * *note PySlice_GetIndices(): 5436.

   * *note PySlice_GetIndicesEx(): 42f.

   * *note PySlice_New(): 5437.

   * *note PySlice_Type: 5438.

   * *note PySlice_Unpack(): 430.

   * *note PyState_AddModule(): 5439.

   * *note PyState_FindModule(): 543a.

   * *note PyState_RemoveModule(): 543b.

   * *note PyStructSequence_Desc: db8.

   * *note PyStructSequence_Field: db7.

   * *note PyStructSequence_GetItem(): 543c.

   * *note PyStructSequence_New(): 543d.

   * *note PyStructSequence_NewType(): 543e.

   * *note PyStructSequence_SetItem(): 543f.

   * *note PyStructSequence_UnnamedField: b7d.

   * *note PySuper_Type: 5440.

   * *note PySys_Audit(): 613.

   * *note PySys_AuditTuple(): 612.

   * *note PySys_FormatStderr(): 5441.

   * *note PySys_FormatStdout(): 5442.

   * *note PySys_GetObject(): 62a.

   * *note PySys_GetXOptions(): 5443.

   * *note PySys_ResetWarnOptions(): 3f2.

   * *note PySys_SetArgv(): 1a15.

   * *note PySys_SetArgvEx(): 1a14.

   * *note PySys_SetObject(): 5444.

   * *note PySys_WriteStderr(): 5445.

   * *note PySys_WriteStdout(): 5446.

   * *note PyThreadState: 994.

   * *note PyThreadState_Clear(): 19f0.

   * *note PyThreadState_Delete(): 1de7.

   * *note PyThreadState_Get(): 615.

   * *note PyThreadState_GetDict(): 5447.

   * *note PyThreadState_GetFrame(): 995.

   * *note PyThreadState_GetID(): b6e.

   * *note PyThreadState_GetInterpreter(): b6d.

   * *note PyThreadState_New(): 5448.

   * *note PyThreadState_SetAsyncExc(): dc1.

   * *note PyThreadState_Swap(): 5449.

   * *note PyThread_GetInfo(): 544a.

   * *note PyThread_ReInitTLS(): 43f.

   * *note PyThread_acquire_lock(): 544b.

   * *note PyThread_acquire_lock_timed(): 544c.

   * *note PyThread_allocate_lock(): 544d.

   * *note PyThread_create_key(): 435.

   * *note PyThread_delete_key(): 437.

   * *note PyThread_delete_key_value(): 43d.

   * *note PyThread_exit_thread(): 544e.

   * *note PyThread_free_lock(): 544f.

   * *note PyThread_get_key_value(): 43b.

   * *note PyThread_get_stacksize(): 5450.

   * *note PyThread_get_thread_ident(): 5451.

   * *note PyThread_get_thread_native_id(): 1bff.

   * *note PyThread_init_thread(): 5452.

   * *note PyThread_release_lock(): 5453.

   * *note PyThread_set_key_value(): 439.

   * *note PyThread_set_stacksize(): 5454.

   * *note PyThread_start_new_thread(): 1e87.

   * *note PyThread_tss_alloc(): 436.

   * *note PyThread_tss_create(): 5455.

   * *note PyThread_tss_delete(): 43e.

   * *note PyThread_tss_free(): 438.

   * *note PyThread_tss_get(): 43c.

   * *note PyThread_tss_is_created(): 5456.

   * *note PyThread_tss_set(): 43a.

   * *note PyTraceBack_Here(): 5457.

   * *note PyTraceBack_Print(): 5458.

   * *note PyTraceBack_Type: 5459.

   * *note PyTupleIter_Type: 545a.

   * *note PyTuple_GetItem(): 523c.

   * *note PyTuple_GetSlice(): 545b.

   * *note PyTuple_New(): 63e.

   * *note PyTuple_Pack(): 545c.

   * *note PyTuple_SetItem(): 523d.

   * *note PyTuple_Size(): 545d.

   * *note PyTuple_Type: 545e.

   * *note PyTypeObject: ca0.

   * *note PyType_ClearCache(): 545f.

   * *note PyType_Freeze(): 3ad.

   * *note PyType_FromMetaclass(): 772.

   * *note PyType_FromModuleAndSpec(): 773.

   * *note PyType_FromSpec(): 79d.

   * *note PyType_FromSpecWithBases(): 79e.

   * *note PyType_GenericAlloc(): c65.

   * *note PyType_GenericNew(): 5251.

   * *note PyType_GetBaseByToken(): 3ae.

   * *note PyType_GetFlags(): 1d9b.

   * *note PyType_GetFullyQualifiedName(): 616.

   * *note PyType_GetModule(): b6a.

   * *note PyType_GetModuleByDef(): 635.

   * *note PyType_GetModuleName(): 618.

   * *note PyType_GetModuleState(): b6b.

   * *note PyType_GetName(): 95c.

   * *note PyType_GetQualName(): 95d.

   * *note PyType_GetSlot(): aa0.

   * *note PyType_GetTypeDataSize(): 76c.

   * *note PyType_IsSubtype(): 5460.

   * *note PyType_Modified(): 1bda.

   * *note PyType_Ready(): 984.

   * *note PyType_Slot: 5461.

   * *note PyType_Spec: 1aea.

   * *note PyType_Type: 76f.

   * *note PyUnicodeDecodeError_Create(): 5462.

   * *note PyUnicodeDecodeError_GetEncoding(): 5463.

   * *note PyUnicodeDecodeError_GetEnd(): 5464.

   * *note PyUnicodeDecodeError_GetObject(): 5465.

   * *note PyUnicodeDecodeError_GetReason(): 5466.

   * *note PyUnicodeDecodeError_GetStart(): 5467.

   * *note PyUnicodeDecodeError_SetEnd(): 5468.

   * *note PyUnicodeDecodeError_SetReason(): 5469.

   * *note PyUnicodeDecodeError_SetStart(): 546a.

   * *note PyUnicodeEncodeError_GetEncoding(): 546b.

   * *note PyUnicodeEncodeError_GetEnd(): 195c.

   * *note PyUnicodeEncodeError_GetObject(): 546c.

   * *note PyUnicodeEncodeError_GetReason(): 546d.

   * *note PyUnicodeEncodeError_GetStart(): 195f.

   * *note PyUnicodeEncodeError_SetEnd(): 546e.

   * *note PyUnicodeEncodeError_SetReason(): 546f.

   * *note PyUnicodeEncodeError_SetStart(): 5470.

   * *note PyUnicodeIter_Type: 5471.

   * *note PyUnicodeTranslateError_GetEnd(): 5472.

   * *note PyUnicodeTranslateError_GetObject(): 5473.

   * *note PyUnicodeTranslateError_GetReason(): 5474.

   * *note PyUnicodeTranslateError_GetStart(): 5475.

   * *note PyUnicodeTranslateError_SetEnd(): 5476.

   * *note PyUnicodeTranslateError_SetReason(): 5477.

   * *note PyUnicodeTranslateError_SetStart(): 5478.

   * *note PyUnicode_Append(): 5479.

   * *note PyUnicode_AppendAndDel(): 547a.

   * *note PyUnicode_AsASCIIString(): 13ae.

   * *note PyUnicode_AsCharmapString(): 547b.

   * ‘PyUnicode_AsDecodedObject()’

   * ‘PyUnicode_AsDecodedUnicode()’

   * ‘PyUnicode_AsEncodedObject()’

   * *note PyUnicode_AsEncodedString(): 547c.

   * ‘PyUnicode_AsEncodedUnicode()’

   * *note PyUnicode_AsLatin1String(): 13ad.

   * *note PyUnicode_AsMBCSString(): 13af.

   * *note PyUnicode_AsRawUnicodeEscapeString(): 13ac.

   * *note PyUnicode_AsUCS4(): 1394.

   * *note PyUnicode_AsUCS4Copy(): abc.

   * *note PyUnicode_AsUTF16String(): 547d.

   * *note PyUnicode_AsUTF32String(): 547e.

   * *note PyUnicode_AsUTF8AndSize(): a9d.

   * *note PyUnicode_AsUTF8String(): 13aa.

   * *note PyUnicode_AsUnicodeEscapeString(): 13ab.

   * *note PyUnicode_AsWideChar(): 1e94.

   * *note PyUnicode_AsWideCharString(): abd.

   * *note PyUnicode_BuildEncodingMap(): 1ac3.

   * *note PyUnicode_Compare(): ab8.

   * *note PyUnicode_CompareWithASCIIString(): 1483.

   * *note PyUnicode_Concat(): 13bd.

   * *note PyUnicode_Contains(): 547f.

   * *note PyUnicode_Count(): 5480.

   * *note PyUnicode_Decode(): 1e23.

   * *note PyUnicode_DecodeASCII(): 5481.

   * *note PyUnicode_DecodeCharmap(): 5482.

   * *note PyUnicode_DecodeCodePageStateful(): 5483.

   * *note PyUnicode_DecodeFSDefault(): 1ae9.

   * *note PyUnicode_DecodeFSDefaultAndSize(): 5484.

   * *note PyUnicode_DecodeLatin1(): 5485.

   * *note PyUnicode_DecodeLocale(): 5486.

   * *note PyUnicode_DecodeLocaleAndSize(): dc6.

   * *note PyUnicode_DecodeMBCS(): 5487.

   * *note PyUnicode_DecodeMBCSStateful(): 5488.

   * *note PyUnicode_DecodeRawUnicodeEscape(): 5489.

   * *note PyUnicode_DecodeUTF16(): 548a.

   * *note PyUnicode_DecodeUTF16Stateful(): 548b.

   * *note PyUnicode_DecodeUTF32(): 548c.

   * *note PyUnicode_DecodeUTF32Stateful(): 548d.

   * *note PyUnicode_DecodeUTF7(): 548e.

   * *note PyUnicode_DecodeUTF7Stateful(): 548f.

   * *note PyUnicode_DecodeUTF8(): 5490.

   * *note PyUnicode_DecodeUTF8Stateful(): 1b76.

   * *note PyUnicode_DecodeUnicodeEscape(): 5491.

   * *note PyUnicode_EncodeCodePage(): 13b0.

   * *note PyUnicode_EncodeFSDefault(): 1e8d.

   * *note PyUnicode_EncodeLocale(): dc7.

   * *note PyUnicode_Equal(): 3b0.

   * *note PyUnicode_EqualToUTF8(): 61a.

   * *note PyUnicode_EqualToUTF8AndSize(): 619.

   * *note PyUnicode_FSConverter(): f19.

   * *note PyUnicode_FSDecoder(): 797.

   * *note PyUnicode_Find(): 5492.

   * *note PyUnicode_FindChar(): aba.

   * *note PyUnicode_Format(): 5493.

   * *note PyUnicode_FromEncodedObject(): 5494.

   * *note PyUnicode_FromFormat(): 62b.

   * *note PyUnicode_FromFormatV(): 794.

   * *note PyUnicode_FromObject(): 5495.

   * *note PyUnicode_FromOrdinal(): 5496.

   * *note PyUnicode_FromString(): 5497.

   * *note PyUnicode_FromStringAndSize(): 5498.

   * *note PyUnicode_FromWideChar(): 13a8.

   * *note PyUnicode_GetDefaultEncoding(): 5499.

   * *note PyUnicode_GetLength(): ab4.

   * *note PyUnicode_InternFromString(): 19eb.

   * *note PyUnicode_InternInPlace(): ab2.

   * *note PyUnicode_IsIdentifier(): 1de4.

   * *note PyUnicode_Join(): 13be.

   * *note PyUnicode_Partition(): 18fb.

   * *note PyUnicode_RPartition(): 18fc.

   * *note PyUnicode_RSplit(): 18fa.

   * *note PyUnicode_ReadChar(): 138d.

   * *note PyUnicode_Replace(): 549a.

   * *note PyUnicode_Resize(): 549b.

   * *note PyUnicode_RichCompare(): 549c.

   * *note PyUnicode_Split(): 549d.

   * *note PyUnicode_Splitlines(): 549e.

   * *note PyUnicode_Substring(): ab7.

   * *note PyUnicode_Tailmatch(): ab9.

   * *note PyUnicode_Translate(): 549f.

   * *note PyUnicode_Type: 54a0.

   * *note PyUnicode_WriteChar(): 138e.

   * *note PyVarObject: 4a5b.

   * ‘PyVarObject.ob_base’

   * *note PyVarObject.ob_size: 54a1.

   * *note PyVectorcall_Call(): 778.

   * *note PyVectorcall_NARGS(): 777.

   * ‘PyWeakReference’

   * *note PyWeakref_GetObject(): 3db.

   * *note PyWeakref_GetRef(): 3dd.

   * *note PyWeakref_NewProxy(): 54a2.

   * *note PyWeakref_NewRef(): 1c43.

   * *note PyWrapperDescr_Type: 54a3.

   * *note PyWrapper_New(): 54a4.

   * *note PyZip_Type: 54a5.

   * *note Py_ASNATIVEBYTES_ALLOW_INDEX: 54a6.

   * *note Py_ASNATIVEBYTES_BIG_ENDIAN: 54a7.

   * *note Py_ASNATIVEBYTES_DEFAULTS: 54a8.

   * *note Py_ASNATIVEBYTES_LITTLE_ENDIAN: 54a9.

   * *note Py_ASNATIVEBYTES_NATIVE_ENDIAN: 54aa.

   * *note Py_ASNATIVEBYTES_REJECT_NEGATIVE: 54ab.

   * *note Py_ASNATIVEBYTES_UNSIGNED_BUFFER: 54ac.

   * *note Py_AUDIT_READ: 7af.

   * *note Py_AddPendingCall(): b7c.

   * *note Py_AtExit(): 54ad.

   * *note Py_BEGIN_ALLOW_THREADS: 5242.

   * *note Py_BLOCK_THREADS: 54ae.

   * *note Py_BuildValue(): 3c0.

   * *note Py_BytesMain(): bbc.

   * *note Py_CompileString(): a89.

   * *note Py_DecRef(): 54af.

   * *note Py_DecodeLocale(): dc4.

   * *note Py_END_ALLOW_THREADS: c83.

   * *note Py_EncodeLocale(): dc5.

   * *note Py_EndInterpreter(): 18aa.

   * *note Py_EnterRecursiveCall(): 3d0.

   * *note Py_Exit(): f4f.

   * *note Py_FatalError(): b7e.

   * ‘Py_FileSystemDefaultEncodeErrors’

   * ‘Py_FileSystemDefaultEncoding’

   * *note Py_Finalize(): 45d.

   * *note Py_FinalizeEx(): f15.

   * *note Py_GenericAlias(): 54b0.

   * *note Py_GenericAliasType: 54b1.

   * *note Py_GetBuildInfo(): 1650.

   * *note Py_GetCompiler(): 54b2.

   * *note Py_GetConstant(): 5f9.

   * *note Py_GetConstantBorrowed(): 5fa.

   * *note Py_GetCopyright(): 54b3.

   * *note Py_GetExecPrefix(): 3e7.

   * *note Py_GetPath(): 3e1.

   * *note Py_GetPlatform(): 54b4.

   * *note Py_GetPrefix(): 3e3.

   * *note Py_GetProgramFullPath(): 3ea.

   * *note Py_GetProgramName(): 3ec.

   * *note Py_GetPythonHome(): 3ed.

   * *note Py_GetRecursionLimit(): 54b5.

   * *note Py_GetVersion(): 54b6.

   * ‘Py_HasFileSystemDefaultEncoding’

   * *note Py_IncRef(): 54b7.

   * *note Py_Initialize(): 45e.

   * *note Py_InitializeEx(): 54b8.

   * *note Py_Is(): aa4.

   * *note Py_IsFalse(): aa7.

   * *note Py_IsFinalizing(): 5fd.

   * *note Py_IsInitialized(): 52d6.

   * *note Py_IsNone(): aa5.

   * *note Py_IsTrue(): aa6.

   * *note Py_LeaveRecursiveCall(): b6f.

   * *note Py_Main(): e22.

   * *note Py_MakePendingCalls(): 54b9.

   * *note Py_NewInterpreter(): 1b90.

   * *note Py_NewRef(): a9e.

   * *note Py_PACK_FULL_VERSION(): 37e.

   * *note Py_PACK_VERSION(): 37d.

   * *note Py_READONLY: 7ae.

   * *note Py_REFCNT(): 2d1.

   * *note Py_RELATIVE_OFFSET: 770.

   * *note Py_ReprEnter(): 54ba.

   * *note Py_ReprLeave(): 54bb.

   * *note Py_SetProgramName(): 1a13.

   * *note Py_SetPythonHome(): 1a12.

   * *note Py_SetRecursionLimit(): 54bc.

   * *note Py_TPFLAGS_BASETYPE: 525a.

   * *note Py_TPFLAGS_DEFAULT: 524f.

   * *note Py_TPFLAGS_HAVE_GC: 985.

   * *note Py_TPFLAGS_HAVE_VECTORCALL: 776.

   * *note Py_TPFLAGS_ITEMS_AT_END: 76d.

   * *note Py_TPFLAGS_METHOD_DESCRIPTOR: 54bd.

   * *note Py_TP_USE_SPEC: 54be.

   * *note Py_TYPE(): 3c7.

   * *note Py_T_BOOL: 54bf.

   * *note Py_T_BYTE: 54c0.

   * *note Py_T_CHAR: 54c1.

   * *note Py_T_DOUBLE: 7ad.

   * *note Py_T_FLOAT: 54c2.

   * *note Py_T_INT: 7ac.

   * *note Py_T_LONG: 54c3.

   * *note Py_T_LONGLONG: 54c4.

   * *note Py_T_OBJECT_EX: 7b1.

   * *note Py_T_PYSSIZET: 54c5.

   * *note Py_T_SHORT: 54c6.

   * *note Py_T_STRING: 54c7.

   * *note Py_T_STRING_INPLACE: 54c8.

   * *note Py_T_UBYTE: 54c9.

   * *note Py_T_UINT: 54ca.

   * *note Py_T_ULONG: 54cb.

   * *note Py_T_ULONGLONG: 54cc.

   * *note Py_T_USHORT: 54cd.

   * *note Py_UCS4: 33b.

   * *note Py_UNBLOCK_THREADS: 54ce.

   * ‘Py_UTF8Mode’

   * *note Py_VaBuildValue(): 54cf.

   * *note Py_Version: 37f.

   * *note Py_XNewRef(): a9f.

   * *note Py_am_aiter: 54d0.

   * *note Py_am_anext: 54d1.

   * *note Py_am_await: 54d2.

   * *note Py_am_send: 54d3.

   * *note Py_bf_getbuffer: 54d4.

   * *note Py_bf_releasebuffer: 54d5.

   * *note Py_buffer: 960.

   * ‘Py_intptr_t’

   * *note Py_mod_create: 54d6.

   * *note Py_mod_exec: b79.

   * *note Py_mod_gil: 482.

   * *note Py_mod_multiple_interpreters: 54d7.

   * *note Py_mp_ass_subscript: 54d8.

   * *note Py_mp_length: 54d9.

   * *note Py_mp_subscript: 54da.

   * *note Py_nb_absolute: 54db.

   * *note Py_nb_add: 54dc.

   * *note Py_nb_and: 54dd.

   * *note Py_nb_bool: 54de.

   * *note Py_nb_divmod: 54df.

   * *note Py_nb_float: 54e0.

   * *note Py_nb_floor_divide: 54e1.

   * *note Py_nb_index: 54e2.

   * *note Py_nb_inplace_add: 54e3.

   * *note Py_nb_inplace_and: 54e4.

   * *note Py_nb_inplace_floor_divide: 54e5.

   * *note Py_nb_inplace_lshift: 54e6.

   * *note Py_nb_inplace_matrix_multiply: 54e7.

   * *note Py_nb_inplace_multiply: 54e8.

   * *note Py_nb_inplace_or: 54e9.

   * *note Py_nb_inplace_power: 54ea.

   * *note Py_nb_inplace_remainder: 54eb.

   * *note Py_nb_inplace_rshift: 54ec.

   * *note Py_nb_inplace_subtract: 54ed.

   * *note Py_nb_inplace_true_divide: 54ee.

   * *note Py_nb_inplace_xor: 54ef.

   * *note Py_nb_int: 54f0.

   * *note Py_nb_invert: 54f1.

   * *note Py_nb_lshift: 54f2.

   * *note Py_nb_matrix_multiply: 54f3.

   * *note Py_nb_multiply: 54f4.

   * *note Py_nb_negative: 54f5.

   * *note Py_nb_or: 54f6.

   * *note Py_nb_positive: 54f7.

   * *note Py_nb_power: 54f8.

   * *note Py_nb_remainder: 54f9.

   * *note Py_nb_rshift: 54fa.

   * *note Py_nb_subtract: 54fb.

   * *note Py_nb_true_divide: 54fc.

   * *note Py_nb_xor: 54fd.

   * *note Py_sq_ass_item: 54fe.

   * *note Py_sq_concat: 54ff.

   * *note Py_sq_contains: 5500.

   * *note Py_sq_inplace_concat: 5501.

   * *note Py_sq_inplace_repeat: 5502.

   * *note Py_sq_item: 5503.

   * *note Py_sq_length: 5504.

   * *note Py_sq_repeat: 5505.

   * *note Py_ssize_t: c59.

   * *note Py_tp_alloc: 5506.

   * *note Py_tp_base: 5507.

   * *note Py_tp_bases: 5508.

   * *note Py_tp_call: 5509.

   * *note Py_tp_clear: 550a.

   * *note Py_tp_dealloc: 550b.

   * *note Py_tp_del: 550c.

   * *note Py_tp_descr_get: 550d.

   * *note Py_tp_descr_set: 550e.

   * *note Py_tp_doc: 550f.

   * *note Py_tp_finalize: 5510.

   * *note Py_tp_free: 5511.

   * *note Py_tp_getattr: 5512.

   * *note Py_tp_getattro: 5513.

   * *note Py_tp_getset: 5514.

   * *note Py_tp_hash: 5515.

   * *note Py_tp_init: 5516.

   * *note Py_tp_is_gc: 5517.

   * *note Py_tp_iter: 5518.

   * *note Py_tp_iternext: 5519.

   * *note Py_tp_members: 551a.

   * *note Py_tp_methods: 551b.

   * *note Py_tp_new: 551c.

   * *note Py_tp_repr: 551d.

   * *note Py_tp_richcompare: 551e.

   * *note Py_tp_setattr: 551f.

   * *note Py_tp_setattro: 5520.

   * *note Py_tp_str: 5521.

   * *note Py_tp_token: 3af.

   * *note Py_tp_traverse: 5522.

   * *note Py_tp_vectorcall: 5523.

   * ‘Py_uintptr_t’

   * *note allocfunc: 5524.

   * *note binaryfunc: 5525.

   * *note descrgetfunc: 5526.

   * *note descrsetfunc: 5527.

   * *note destructor: 5528.

   * *note getattrfunc: 5529.

   * *note getattrofunc: 552a.

   * *note getbufferproc: 552b.

   * *note getiterfunc: 552c.

   * *note getter: 552d.

   * *note hashfunc: 552e.

   * *note initproc: 552f.

   * *note inquiry: 5530.

   * *note iternextfunc: 5531.

   * *note lenfunc: 5532.

   * *note newfunc: 5533.

   * *note objobjargproc: 5534.

   * *note objobjproc: 5535.

   * *note releasebufferproc: 5536.

   * *note reprfunc: 5537.

   * *note richcmpfunc: 5538.

   * *note setattrfunc: 5539.

   * *note setattrofunc: 553a.

   * *note setter: 553b.

   * *note ssizeargfunc: 553c.

   * *note ssizeobjargproc: 553d.

   * ‘ssizessizeargfunc’

   * ‘ssizessizeobjargproc’

   * ‘symtable’

   * *note ternaryfunc: 553e.

   * *note traverseproc: 553f.

   * *note unaryfunc: 5540.

   * *note vectorcallfunc: 779.

   * *note visitproc: 5541.


File: python.info,  Node: 超高水準レイヤ,  Next: 参照カウント,  Prev: C API Stability,  Up: Python/C API reference manual

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: 5545,
*note Py_file_input: 5546, *note Py_single_input: 5547, and *note
Py_func_type_input: 5548.  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(): 554a. の 'closeit' を ‘0’ に、
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileFlags (FILE *fp, const char *filename,
          PyCompilerFlags *flags)

     下記の *note PyRun_AnyFileExFlags(): 554a. の 'closeit' を ‘0’ にし
     て単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileEx (FILE *fp, const char *filename, int
          closeit)

     下記の *note PyRun_AnyFileExFlags(): 554a. の 'flags' を ‘NULL’ に
     して単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileExFlags (FILE *fp, const char *filename,
          int closeit, PyCompilerFlags *flags)

     'fp' が対話的デバイス (コンソールや端末入力あるいは Unix 仮想端末)
     と関連づけられたファイルを参照している場合は、 *note
     PyRun_InteractiveLoop(): 554d. の値を返します。それ以外の場合は、
     *note PyRun_SimpleFile(): 5291. の結果を返します。 'filename' はフ
     ァイルシステムのエンコーディング (*note
     sys.getfilesystemencoding(): e57.) でデコードされます。 'filename'
     が ‘NULL’ ならば、この関数はファイル名として ‘"???"’ を使います。
     'closeit' が真なら、ファイルは ‘PyRun_SimpleFileExFlags()’ が処理を
     戻す前に閉じられます。

 -- C の関数: int PyRun_SimpleString (const char *command)

     下記の *note PyRun_SimpleStringFlags(): 554e. の *note
     PyCompilerFlags: c9c.* を ‘NULL’ にして単純化したインタフェースです
     。

 -- C の関数: int PyRun_SimpleStringFlags (const char *command,
          PyCompilerFlags *flags)

     *note __main__: 1. モジュールの中で 'flags' に従って 'command' に含
     まれる Python ソースコードを実行します。 ‘__main__’ がまだ存在しな
     い場合は作成されます。正常終了の場合は ‘0’ を返し、また例外が発生し
     た場合は ‘-1’ を返します。エラーがあっても、例外情報を得る方法はあ
     りません。 'flags' の意味については、後述します。

     Note that if an otherwise unhandled *note SystemExit: f40. is
     raised, this function will not return ‘-1’, but exit the process,
     as long as *note PyConfig.inspect: 3ff. is zero.

 -- C の関数: int PyRun_SimpleFile (FILE *fp, const char *filename)

     下記の *note PyRun_SimpleFileExFlags(): 1d25. の 'closeit' を ‘0’ に
     、 'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileEx (FILE *fp, const char *filename,
          int closeit)

     下記の *note PyRun_SimpleFileExFlags(): 1d25. の 'flags' を ‘NULL’
     にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileExFlags (FILE *fp, const char
          *filename, int closeit, PyCompilerFlags *flags)

     *note PyRun_SimpleStringFlags(): 554e. と似ていますが、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: 16a. object.

     入力が正常に実行されたときは ‘0’ を返します。例外が発生した場合は
     ‘-1’ を返します。パースエラーの場合はPythonの一部として配布されてい
     る ‘errcode.h’ インクルードファイルにあるエラーコードを返します。
     (‘Python.h’ は ‘errcode.h’ をインクルードしません。従って、 必要な
     場合はその都度インクルードしなければならないことに注意してください
     。)

 -- C の関数: int PyRun_InteractiveOne (FILE *fp, const char *filename)

     下記の *note PyRun_InteractiveOneFlags(): 5552. の 'flags' を
     ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_InteractiveOneFlags (FILE *fp, const char
          *filename, PyCompilerFlags *flags)

     Similar to *note PyRun_InteractiveOneObject(): 5550, 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(): 5553. の '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: 164.

 -- 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(): e63. や
     *note PyMem_Realloc(): 1237. ではなく、 *note PyMem_RawMalloc():
     631. または *note PyMem_RawRealloc(): 633. でメモリ確保したものでな
     ければなりません。

     バージョン 3.12 で変更: This function is only called from the *note
     main interpreter: 164.

 -- C の関数: *note PyObject: 5df. *PyRun_String (const char *str, int
          start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_StringFlags(): 5554. の
     '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: 5555.

     コードを実行した結果をPythonオブジェクトとして返します。または、例
     外が発生したならば ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyRun_File (FILE *fp, const char
          *filename, int start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 5557. の
     '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(): 5557. の
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *PyRun_FileFlags (FILE *fp, const
          char *filename, int start, PyObject *globals, PyObject
          *locals, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 5557. の
     '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(): 5554. と似ていま
     すが、Pythonソースコードをメモリ内の文字列ではなく 'fp' から読み込
     みます。 'filename' はそのファイルの名前でなければならず、 *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。 'closeit' に真を指定した場合は、*note
     PyRun_FileExFlags(): 5557. が処理を戻す前にファイルを閉じます。

 -- C の関数: *note PyObject: 5df. *Py_CompileString (const char *str,
          const char *filename, int start)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  下記
     の *note Py_CompileStringFlags(): 555a. の 'flags' を ‘NULL’ にして
     単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *Py_CompileStringFlags (const char
          *str, const char *filename, int start, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note Py_CompileStringExFlags():
     555b. の '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: 5555.  The
     filename specified by 'filename' is used to construct the code
     object and may appear in tracebacks or *note SyntaxError: 18f.
     exception messages.  This returns ‘NULL’ if the code cannot be
     parsed or compiled.

     整数 'optimize' は、コンパイラの最適化レベルを指定します; ‘-1’ は、
     インタプリタの *note -O: 18d. オプションで与えられるのと同じ最適化
     レベルを選びます。明示的なレベルは、 ‘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(): 555c. と似て
     いますが、 '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(): 1b39. のシンプルなインターフェースで、コ
     ードオブジェクトと、グローバル変数とローカル変数だけを受け取ります
     。 他の引数には ‘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(): 1233. に対
     するシンプルなインターフェースで、後方互換性のためのものです。

 -- 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: 555e.
     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: 555e.

     バージョン 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: 2626. 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: 5564. to enable features
     normally selectable using *note future statements: 45b.  See *note
     Code Object Flags: 5565. 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():
     a89. と一緒に使います。

 -- C 変数: int Py_file_input

     ファイルあるいは他のソースから読み込まれた文の並びに対するPython文
     法の開始記号で、 *note Py_CompileString(): a89. と一緒に使います。
     これは任意の長さのPythonソースコードをコンパイルするときに使う記号
     です。

 -- C 変数: int Py_single_input

     単一の文に対するPython文法の開始記号で、 *note Py_CompileString():
     a89. と一緒に使います。これは対話式のインタプリタループのための記号
     です。

 -- C 変数: int Py_func_type_input

     The start symbol from the Python grammar for a function type; for
     use with *note Py_CompileString(): a89.  This is used to parse
     "signature type comments" from PEP 484(1).

     This requires the *note PyCF_ONLY_AST: 5561. flag to be set.

     参考
     ....

        * *note ast.FunctionType: 4f02.

        * 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(): 1136.

 -- 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: 5568.

     Added in version 3.4.

 -- C の関数: int PyCompile_OpcodeStackEffectWithJump (int opcode, int
          oparg, int jump)

     Similar to *note PyCompile_OpcodeStackEffect(): 5569, 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: 5568.

     Added in version 3.8.


File: python.info,  Node: 参照カウント,  Next: 例外処理,  Prev: 超高水準レイヤ,  Up: Python/C API reference manual

7.4 参照カウント
================

このセクションにある関数とマクロは、 Python オブジェクトの参照カウントの
管理に使用されます。

 -- C の関数: *note Py_ssize_t: c59. Py_REFCNT (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Python オブジェクト 'o' の参照カウントを取得します。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 292.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     オブジェクトの参照カウントを設定するためには、 *note
     Py_SET_REFCNT(): aac. 関数を使用してください。

          注釈: On *note free-threaded builds: 17b0. 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(): 3c4. for that
          instead.

          See also the function *note
          PyUnstable_Object_IsUniqueReferencedTemporary(): 3c5.

     バージョン 3.10 で変更: *note Py_REFCNT(): 2d1. は static なインラ
     イン関数に変更されました。

     バージョン 3.11 で変更: 引数の型は const *note PyObject: 5df.* では
     なくなりました。

 -- C の関数: void Py_SET_REFCNT (PyObject *o, Py_ssize_t refcnt)

     オブジェクト 'o' の参照カウントを 'refcnt' に設定します。

     *note フリースレッドな Python ビルド: 21c8. では、 'refcnt' が
     ‘UINT32_MAX’ より大きい場合、オブジェクトは永続 (*note immortal:
     292.) となります。

     この関数は永続 (*note immortal: 292.) オブジェクトには何もしません
     。

     Added in version 3.9.

     バージョン 3.12 で変更: 永続オブジェクトは変更されません。

 -- C の関数: void Py_INCREF (PyObject *o)

     オブジェクト 'o' への新しい *note 強参照: 5e2. を取得し、それが使用
     中で破棄されてはならないことを示します。

     この関数は永続 (*note immortal: 292.) オブジェクトには何もしません
     。

     This function is usually used to convert a *note borrowed
     reference: 3d5. to a *note strong reference: 5e2. in-place.  The
     *note Py_NewRef(): a9e. function can be used to create a new strong
     reference.

     When done using the object, release is by calling *note
     Py_DECREF(): 790.

     オブジェクトが ‘NULL’ であってはいけません。それが ‘NULL’ ではない
     と確信が持てないならば、 *note Py_XINCREF(): c5e. を使ってください
     。

     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(): a9f.

 -- 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(): a9f. 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(): a9e, 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: 292.) オブジェクトには何もしません
     。

     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(): 996. を使ってください
     。

     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__(): 1203. 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 ‘Py_DECREF()’
          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
     ‘Py_DECREF()’ 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 ‘Py_DECREF()’ 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(): c5e.  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(): 996.  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(): 996. 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 reference manual

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(): 89b.  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__(): 1203. 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: 5391.  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(): 10b5. と同じですが、可変
     長引数の代わりに ‘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(): 521c, 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: 2c2. 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():
     5358. に似てますが、ファイル名を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(): 5358. に似ていますが
     、ファイル名は 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: 2c2.  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 ‘OSError’ object with the *note winerror: 2746.
     attribute set to the error code, the *note strerror: 2747.
     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: 2199.: Windows.

 -- C の関数: *note PyObject: 5df. *PyErr_SetExcFromWindowsErr (PyObject
          *type, int ierr)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  *note PyErr_SetFromWindowsErr():
     535a. に似ていますが、送出する例外の型を指定する引数が追加されてい
     ます。

     *note Availability: 2199.: 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(): 535a, with the additional behavior that
     if 'filename' is not ‘NULL’, it is decoded from the filesystem
     encoding (*note os.fsdecode(): e52.) and passed to the constructor
     of *note OSError: 2c2. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 2199.: 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(): 5355, with the additional behavior
     that if 'filename' is not ‘NULL’, it is passed to the constructor
     of *note OSError: 2c2. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 2199.: 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(): 5356. に似てますが
     、2つ目のファイル名オブジェクトを受け取ります。

     *note Availability: 2199.: 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(): 1ae8. に似ていますが、送出す
     る例外の型を指定する引数が追加されています。

     *note Availability: 2199.: 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’ にしてよく、それぞれ
     ‘ImportError’ の ‘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(): f3d. とよく似てい
     ますが、この関数は送出する例外として、 *note ImportError: 65b. のサ
     ブクラスを指定できます。

     Added in version 3.6.

 -- C の関数: void PyErr_SyntaxLocationObject (PyObject *filename, int
          lineno, int col_offset)

     現在の例外のファイル、行、オフセットの情報をセットします。 現在の例
     外が *note SyntaxError: 18f. でない場合は、例外を表示するサブシステ
     ムが、例外が ‘SyntaxError’ であると思えるように属性を追加します。

     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(): 5573, 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(): 5573. と似ていますが、
     'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されたバイト文字列です。

     Added in version 3.2.

 -- C の関数: void PyErr_SyntaxLocation (const char *filename, int
          lineno)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyErr_SyntaxLocationEx(): 535e. と似ていますが、 '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: 16a. 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(): 5575, 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: 119. モジュールで公開されている同様の関数とよく似てます。 これ
らの関数は通常警告メッセージを '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(): 166a. を呼び出している関数が、2 だとその上の関数が
     Warning の発行元になります。

     警告カテゴリは *note PyExc_Warning: 53a2. のサブクラスでなければな
     りません。 ‘PyExc_Warning’ は *note PyExc_Exception: 5376. のサブク
     ラスです。 デフォルトの警告カテゴリは *note PyExc_RuntimeWarning:
     5392. です。 標準の Python 警告カテゴリは、 *note Warning types:
     5577. で名前が列挙されているグローバル変数として利用可能です。

     警告をコントロールするための情報については、 *note warnings: 119. モ
     ジュールのドキュメンテーションとコマンドライン・ドキュメンテーショ
     ンの *note -W: aca. オプションを参照してください。警告コントロール
     のためのC APIはありません。

 -- C の関数: int PyErr_WarnExplicitObject (PyObject *category, PyObject
          *message, PyObject *filename, int lineno, PyObject *module,
          PyObject *registry)

     すべての警告の属性を明示的に制御した警告メッセージを出します。これ
     は Python 関数 *note warnings.warn_explicit(): f01. の直接的なラッ
     パーで、さらに情報を得るにはそちらを参照してください。そこに説明さ
     れているデフォルトの効果を得るために、 '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(): 5578. に似ていますが、 '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.'  Function similar to *note
     PyErr_WarnEx(): 166a, 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_WarnExplicitFormat (PyObject *category, const
          char *filename, int lineno, const char *module, PyObject
          *registry, const char *format, ...)

     Similar to *note PyErr_WarnExplicit(): 1aee, 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(): 535f, 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():
     429. への最も新しい呼び出しに対する第一引数)を返します。設定されて
     いない場合は ‘NULL’ を返します。あなたは戻り値への参照を持っていま
     せんので、それに *note Py_DECREF(): 790. する必要はありません。

     The caller must have an *note attached thread state: 5256.

          注釈: 戻り値を特定の例外と比較しないでください。その代わりに、
          下に示す *note PyErr_ExceptionMatches(): 52d3. を使ってくださ
          い。(比較は簡単に失敗するでしょう。なぜなら、例外はクラスでは
          なくインスタンスかもしれないし、あるいは、クラス例外の場合は期
          待される例外のサブクラスかもしれないからです。)

 -- 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(): 977, 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():
     427. 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():
     42a. 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(): 426. 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():
     427. instead, to avoid any possible de-normalization.

     ある状況では、以下の *note PyErr_Fetch(): 426. が返す値は "正規化さ
     れていない" 可能性があります。つまり、 ‘*exc’ はクラスオブジェクト
     だが ‘*val’ は同じクラスのインスタンスではないという意味です。この
     関数はそのような場合にそのクラスをインスタンス化するために使われま
     す。その値がすでに正規化されている場合は何も起きません。遅延正規化
     はパフォーマンスを改善するために実装されています。

          注釈: This function 'does not' implicitly set the *note
          __traceback__: 14e2. 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(): 89c.  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(): 978. を使
          ってください。

     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(): 977. を使ってください。

     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(): 89b.  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(): 977.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を元に戻す、もしく
          はクリアするには *note PyErr_SetExcInfo(): 979. を使ってくださ
          い。

     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(): 978.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を取得するには
          *note PyErr_GetExcInfo(): 97a. を使ってください。

     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.'

     Handle external interruptions, such as signals or activating a
     debugger, whose processing has been delayed until it is safe to run
     Python code and/or raise exceptions.

     For example, pressing ‘Ctrl’-‘C’ causes a terminal to send the
     *note signal.SIGINT: 255. signal.  This function executes the
     corresponding Python signal handler, which, by default, raises the
     *note KeyboardInterrupt: bc9. exception.

     ‘PyErr_CheckSignals()’ should be called by long-running C code
     frequently enough so that the response appears immediate to humans.

     Handlers invoked by this function currently include:

        - Signal handlers, including Python functions registered using
          the *note signal: cb. module.

          Signal handlers are only run in the main thread of the main
          interpreter.

          (This is where the function got the name: originally, signals
          were the only way to interrupt the interpreter.)

        - Running the garbage collector, if necessary.

        - Executing a pending *note remote debugger: 4cab. script.

     If any handler raises an exception, immediately return ‘-1’ with
     that exception set.  Any remaining interruptions are left to be
     processed on the next *note PyErr_CheckSignals(): 693. invocation,
     if appropriate.

     If all handlers finish successfully, or there are no handlers to
     run, return ‘0’.

     バージョン 3.12 で変更: This function may now invoke the garbage
     collector.

     バージョン 3.14 で変更: This function may now execute a remote
     debugger script, if remote debugging is enabled.

 -- 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: 5256. 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: 1c0f. or *note signal.SIG_IGN: 1c0e.), 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: 5256. 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(): d6b. と同等ですが、
     どんなエラーチェックも行いません。 '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: bd1. (Cでは *note
     PyExc_Exception: 5376. としてアクセス可能)をルートとして派生したク
     ラスオブジェクトを作成します。

     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(): 1485. とほぼ同じですが、新しい例外クラ
     スに簡単に 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: 1d0b. 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): 3c7.

 -- C の関数: *note PyObject: 5df. *PyException_GetTraceback (PyObject
          *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python で *note __traceback__: 14e2. 属性からアクセスできるものと同
     じ、例外に関する 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__:
     14e3. 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__:
     14e4. 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__: 2574. 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: c0c. オブジェクトを作成します。
     '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: 195d. is an empty sequence, the
     resulting 'start' is ‘0’.  Otherwise, it is clipped to ‘[0,
     len(object) - 1]’.

     参考
     ....

     *note UnicodeError.start: 1922.

 -- 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: 195d. 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: 1923.

 -- 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: f6c. is set and a nonzero value
     is returned.  Otherwise, zero is returned.

     'where' は ‘" in instance check"’ のような UTF-8 エンコードされた文
     字列にして、再帰の深さの限界に達したことで送出される *note
     RecursionError: f6c. のメッセージに連結できるようにすべきです。

     参考
     ....

     The *note PyUnstable_ThreadState_SetStackProtection(): 464.
     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(): 3d0. を終了させます。
     ‘Py_EnterRecursiveCall()’ の '成功した' 呼び出しに対し 1 回呼ばなけ
     ればなりません。

     バージョン 3.9 で変更: This function is now also available in the
     *note limited API: 637.

コンテナ型に対し *note tp_repr: 5269. を適切に実装するには、特殊な再帰の
処理が求められます。スタックの防護に加え、 ‘tp_repr’ は循環処理を避ける
ためにオブジェクトを辿っていく必要があります。次の 2 つの関数はその機能
を容易にします。実質的には、これらは *note reprlib.recursive_repr():
1410. と同等な C の実装です。

 -- C の関数: int Py_ReprEnter (PyObject *object)
     ' 次に属します: *note Stable ABI: 775.'  循環処理を検知するために、
     *note tp_repr: 5269. の実装の先頭で呼び出します。

     そのオブジェクトが既に処理されたものだった場合、この関数は正の整数
     を返します。その場合、 *note tp_repr: 5269. の実装は、循環を示す文
     字列オブジェクトを返すべきです。例えば、 *note dict: 184. オブジェ
     クトは ‘{...}’ を返しますし、 *note list: 24f. オブジェクトは
     ‘[...]’ を返します。

     再帰回数の上限に達した場合は、この関数は負の整数を返します。この場
     合、 *note tp_repr: 5269. の実装は一般的には ‘NULL’ を返すべきです
     。

     それ以外の場合は、関数はゼロを返し、 *note tp_repr: 5269. の実装は
     通常どおり処理を続けてかまいません。

 -- C の関数: void Py_ReprLeave (PyObject *object)
     ' 次に属します: *note Stable ABI: 775.'  *note Py_ReprEnter():
     54ba. を終了させます。 0 を返した ‘Py_ReprEnter()’ の呼び出しに対し
     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(): 54bc.  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: 5256.

     参考
     ....

     *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: 5256.

     参考
     ....

     *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: bd1.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ArithmeticError: 273d.
          *PyExc_ArithmeticError                       
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note AssertionError: 8b9.
          *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: 237.
          *PyExc_BlockingIOError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note BrokenPipeError: 126b.
          *PyExc_BrokenPipeError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_BufferError    *note BufferError: 1806.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ChildProcessError: 1267.
          *PyExc_ChildProcessError                     
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionAbortedError: 126c.
          *PyExc_ConnectionAbortedError                
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionError: 100f.
          *PyExc_ConnectionError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionRefusedError: 126d.
          *PyExc_ConnectionRefusedError                
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionResetError: 126e.
          *PyExc_ConnectionResetError                  
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_EOFError       *note EOFError: 14f5.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note FileExistsError: 1225.
          *PyExc_FileExistsError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note FileNotFoundError: 266.
          *PyExc_FileNotFoundError                     
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note FloatingPointError: 273e.
          *PyExc_FloatingPointError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note GeneratorExit: 15e5.
          *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: 1755.
          *PyExc_IndentationError                      
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_IndexError     *note IndexError: 1753.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note InterruptedError: f8c.
          *PyExc_InterruptedError                      
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note IsADirectoryError: 1268.
          *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: bc9.
          *PyExc_KeyboardInterrupt                     
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_LookupError    *note LookupError: 2445.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_MemoryError    *note MemoryError: 1772.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ModuleNotFoundError: d41.
          *PyExc_ModuleNotFoundError                   
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.6 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_NameError      *note NameError: 450.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note NotADirectoryError: 1269.
          *PyExc_NotADirectoryError                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note NotImplementedError: 369.
          *PyExc_NotImplementedError                   
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_OSError        *note OSError: 2c2.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note OverflowError: a85.
          *PyExc_OverflowError                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note PermissionError: f42.
          *PyExc_PermissionError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ProcessLookupError: 126a.
          *PyExc_ProcessLookupError                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note PythonFinalizationError: 47a.
          *PyExc_PythonFinalizationError               

 -- C 変数: *note PyObject: 5df.                       *note RecursionError: f6c.
          *PyExc_RecursionError                        
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ReferenceError: 172b.
          *PyExc_ReferenceError                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_RuntimeError   *note RuntimeError: 246.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note StopAsyncIteration: 1e6c.
          *PyExc_StopAsyncIteration                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note StopIteration: df9.
          *PyExc_StopIteration                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_SyntaxError    *note SyntaxError: 18f.
     ' 次に属します: *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: f40.
     ' 次に属します: *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: a3a.
     ' 次に属します: *note Stable ABI: 775. (バージ    
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_TypeError      *note TypeError: 199.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note UnboundLocalError: 1754.
          *PyExc_UnboundLocalError                     
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeDecodeError: c0c.
          *PyExc_UnicodeDecodeError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeEncodeError: 888.
          *PyExc_UnicodeEncodeError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_UnicodeError   *note UnicodeError: 460.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note UnicodeTranslateError: 195e.
          *PyExc_UnicodeTranslateError                 
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_ValueError     *note ValueError: 2ee.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ZeroDivisionError: b43.
          *PyExc_ZeroDivisionError                     
     ' 次に属します: *note Stable ABI: 775.'

Added in version 3.3: *note PyExc_BlockingIOError: 5369. 、 *note
PyExc_BrokenPipeError: 536a. 、 *note PyExc_ChildProcessError: 536d. 、
*note PyExc_ConnectionError: 536f. 、 *note
PyExc_ConnectionAbortedError: 536e. 、 *note
PyExc_ConnectionRefusedError: 5370. 、 *note PyExc_ConnectionResetError:
5371. 、 *note PyExc_FileExistsError: 5377. 、 *note
PyExc_FileNotFoundError: 5378. 、 *note PyExc_InterruptedError: 5381. 、
*note PyExc_IsADirectoryError: 5382. 、 *note PyExc_NotADirectoryError:
5389. 、 *note PyExc_PermissionError: 538d. 、 *note
PyExc_ProcessLookupError: 538e. 、 *note PyExc_TimeoutError: 539a. は
PEP 3151(1) により導入されました。

Added in version 3.5: *note PyExc_StopAsyncIteration: 5393. および *note
PyExc_RecursionError: 10b6. 。

Added in version 3.6: *note PyExc_ModuleNotFoundError: 5387.

Added in version 3.11: *note PyExc_BaseExceptionGroup: 5368.

   ---------- 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: 521f.

バージョン 3.3 で変更: これらのエイリアスは例外の種類を分けるために使わ
れます。

C name                                Python name                           注釈
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
 -- C 変数: *note PyObject: 5df.      *note OSError: 2c2.
          *PyExc_EnvironmentError     
     ' 次に属します:
     *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.      *note OSError: 2c2.
          *PyExc_IOError              
     ' 次に属します:
     *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.      *note OSError: 2c2.                   *note [win]: 558a.
          *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: 2769.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_BytesWarning   *note BytesWarning: e20.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note DeprecationWarning: 1a4.
          *PyExc_DeprecationWarning                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note EncodingWarning: 2189.
          *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: ac9.
          *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: 1af.
          *PyExc_SyntaxWarning                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeWarning: 1642.
          *PyExc_UnicodeWarning                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_UserWarning    *note UserWarning: 276a.
     ' 次に属します: *note Stable ABI: 775.'           

Added in version 3.2: *note PyExc_ResourceWarning: 5390.

Added in version 3.10: *note PyExc_EncodingWarning: 5374.


File: python.info,  Node: Tracebacks,  Prev: Exception and warning types,  Up: 例外処理

7.5.11 Tracebacks
-----------------

 -- C 変数: *note PyTypeObject: ca0. PyTraceBack_Type
     ' 次に属します: *note Stable ABI: 775.'  Type object for traceback
     objects.  This is available as *note types.TracebackType: cee. 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__: 14e2. 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 reference manual

7.6 拡張モジュールの定義
========================

A C extension for CPython is a shared library (for example, a ‘.so’ file
on Linux, ‘.pyd’ DLL on Windows), which is loadable into the Python
process (for example, it is compiled with compatible compiler settings),
and which exports an *note initialization function: 5591.

デフォルトで (つまり、 *note importlib.machinery.ExtensionFileLoader:
eb2. によって) インポート可能であるためには、共有ライブラリは *note
sys.path: 3e2. 上で利用可能である必要があり、モジュール名と *note
importlib.machinery.EXTENSION_SUFFIXES: 739.  に含まれる拡張子で命名する
必要があります。

     注釈: 拡張モジュールのビルド、パッケージ化および配布には、サードパ
     ーティのツールが最適であり、このドキュメントの範囲外です。適切なツ
     ールの一つは Setuptools であり、ドキュメントは
     ‘https://setuptools.pypa.io/en/latest/setuptools.html’ にあります。

Normally, the initialization function returns a module definition
initialized using *note PyModuleDef_Init(): 5227.  This allows splitting
the creation process into several phases:

   - 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__: 325. and
     *note __loader__: 339.

   - Afterwards, the module object is initialized using
     extension-specific code - the equivalent of *note __init__(): 8c0.
     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: 5592. for details.

バージョン 3.5 で変更: 多段階初期化 ( PEP 489(1)) のサポートを追加しまし
た。

* Menu:

* 複数のモジュールインスタンス::
* Initialization function::
* 多段階初期化::
* 従来の一段階初期化::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: 複数のモジュールインスタンス,  Next: Initialization function,  Up: 拡張モジュールの定義

7.6.1 複数のモジュールインスタンス
----------------------------------

By default, extension modules are not singletons.  For example, if the
*note sys.modules: 1791. 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:
164. or after Python runtime reinitialization (*note Py_Finalize(): 45d.
and *note Py_Initialize(): 45e.).  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 拡張モジュールを分離する: 167. for more details and a practical
guide.

A simpler way to avoid these issues is *note raising an error on
repeated initialization: 5594.

All modules are expected to support *note sub-interpreters: 164, 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: 54d7. slot.


File: python.info,  Node: Initialization function,  Next: 多段階初期化,  Prev: 複数のモジュールインスタンス,  Up: 拡張モジュールの定義

7.6.2 Initialization function
-----------------------------

The initialization function defined by an extension module has the
following signature:

 -- C の関数: *note PyObject: 5df. *PyInit_modulename (void)

Its name should be ‘PyInit_<NAME>’, with ‘<name>’ replaced by the name
of the module.

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 多段階初期化: 5597, 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

It is recommended to define the initialization function using a helper
macro:

 -- 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: Initialization function,  Up: 拡張モジュールの定義

7.6.3 多段階初期化
------------------

Normally, the *note initialization function: 5591. (‘PyInit_modulename’)
returns a *note PyModuleDef: b78. instance with non-‘NULL’ *note
m_slots: 5599.  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 多段階初期化: 5597.  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: 5591.
(‘PyInit_modulename’) should create, populate and return a module
object.  This is typically done using *note PyModule_Create(): 559b. and
functions like *note PyModule_AddObjectRef(): 60a.

Single-phase initialization differs from the *note default: 5597. 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(): 543a.

   ---------- 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 reference manual

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: 16a. or *note bytes: 193.
     object, then a new *note strong reference: 5e2. is returned.  If
     the object implements the *note os.PathLike: e4f. interface, then
     *note __fspath__(): e50. is returned as long as it is a ‘str’ or
     ‘bytes’ object.  Otherwise *note TypeError: 199. 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: 3fd. 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: 55a4. (of the *note "main" interpreter: 164.).
          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: 55a4. (of the *note "main" interpreter: 164.).
          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: 55a4. (of the *note "main" interpreter: 164.).
          The same is true for ‘PyOS_AfterFork_Child()’.

     Added in version 3.7.

     参考
     ....

     *note os.register_at_fork(): 353. を利用すると *note
     PyOS_BeforeFork(): dbc.、*note PyOS_AfterFork_Parent(): dbd. *note
     PyOS_AfterFork_Child(): 42e. によって呼び出されるカスタムのPython関
     数を登録できます。

 -- C の関数: void PyOS_AfterFork ()
     ' 次に属します: *note Stable ABI: 775. on platforms with fork().'  プ
     ロセスが fork した後の内部状態を更新するための関数です; fork 後
     Python インタプリタを使い続ける場合、新たなプロセス内でこの関数を呼
     び出さねばなりません。新たなプロセスに新たな実行可能物をロードする
     場合、この関数を呼び出す必要はありません。

     バージョン 3.7 で非推奨: この関数は *note PyOS_AfterFork_Child():
     42e. によって置き換えられました。

 -- 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: 5409. 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: 5409. 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: 5256.

 -- 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: 3f5. API with the *note
          PyConfig_SetBytesString(): baf. function which ensures that
          *note Python is preinitialized: 4371.

          This function must not be called before *note Python is
          preinitialized: 4371. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 41c.
          function.

     *note ファイルシステムのエンコーディングとエラーハンドラ: 75d. から
     バイト文字列をデコードします。エラーハンドラが *note
     surrogateescape エラーハンドラ: 28cb. なら、 デコードできないバイト
     は 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(): 997.: see *note filesystem_encoding: 419.
     and *note filesystem_errors: 41a. members of *note PyConfig: 3f5.

     C ライブラリーにバグがない限り、デコードでのエラーは起こりえません
     。

     キャラクター文字列をバイト文字列に戻すには *note Py_EncodeLocale():
     dc5. 関数を使ってください。

     参考
     ....

     *note PyUnicode_DecodeFSDefaultAndSize(): 5484. および *note
     PyUnicode_DecodeLocaleAndSize(): dc6. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: 867. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 416. is
     zero;

 -- C の関数: char *Py_EncodeLocale (const wchar_t *text, size_t
          *error_pos)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  ワ
     イドキャラクター文字列を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. にエンコー
     ドします。エラーハンドラが *note surrogateescape エラーハンドラ:
     28cb. なら、 U+DC80 から U+DCFF までの範囲のサロゲート文字は 0x80 か
     ら 0xFF までのバイトに変換されます。

     新しくメモリ確保されたバイト文字列へのポインタを返します。 このメモ
     リを解放するのには *note PyMem_Free(): 1660. を使ってください。 エ
     ンコードエラーかメモリ確保エラーのときは ‘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(): 997.: see *note filesystem_encoding: 419.
     and *note filesystem_errors: 41a. members of *note PyConfig: 3f5.

     バイト文字列をワイドキャラクター文字列に戻すには *note
     Py_DecodeLocale(): dc4. 関数を使ってください。

          警告: This function must not be called before *note Python is
          preinitialized: 4371. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 41c.
          function.

     参考
     ....

     *note PyUnicode_EncodeFSDefault(): 1e8d. および *note
     PyUnicode_EncodeLocale(): dc7. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: 867. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 416. 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: 16a. object, a *note bytes: 193.
     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(): 392. rather than
     calling directly ‘fclose()’.

     The file descriptor is created non-inheritable ( PEP 446(1)).

     The caller must have an *note attached thread state: 5256.

     Added in version 3.14.

 -- C の関数: int Py_fclose (FILE *file)

     Close a file that was opened by *note Py_fopen(): 391.

     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(): 392.) 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のコードからアクセスする関
数です。すべての関数は現在のインタプリタスレッドの ‘sys’ モジュールの辞
書に対して動作します。この辞書は内部のスレッド状態構造体に格納されていま
す。

 -- C の関数: *note PyObject: 5df. *PySys_GetObject (const char *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     the object 'name' from the *note sys: df. module or ‘NULL’ if it
     does not exist, without setting an exception.

 -- 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: 3f3. to an empty list.  This function may be
     called prior to *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Clear *note
     sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

 -- C の関数: void PySys_WriteStdout (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  'format' で指定された出力
     文字列を *note sys.stdout: cd1. に出力します。切り詰めが起こった場
     合を含め、例外は一切発生しません (後述)。

     'format' は、フォーマット後の出力文字列のトータルの大きさを1000バイ
     ト以下に抑えるべきです。- 1000 バイト以降の出力文字列は切り詰められ
     ます。特に、制限のない "%s" フォーマットを使うべきではありません。
     "%.<N>s" のようにして N に10進数の値を指定し、<N> + その他のフォー
     マット後の最大サイズが1000を超えないように設定するべきです。同じよ
     うに "%f" にも気を付ける必要があります。非常に大きい数値に対して、
     数百の数字を出力する可能性があります。

     問題が発生したり、 *note sys.stdout: cd1. が設定されていなかった場
     合、フォーマット後のメッセージは本物の(Cレベルの) 'stdout' に出力さ
     れます。

 -- C の関数: void PySys_WriteStderr (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  *note PySys_WriteStdout():
     5446. と同じですが、 *note sys.stderr: b37. もしくは '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(): 5442. と同じですが、 *note sys.stderr: b37. も
     しくは 'stderr' に出力します。

     Added in version 3.2.

 -- C の関数: *note PyObject: 5df. *PySys_GetXOptions ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'  *note sys._xoptions: 218c. と同様、 *note -X:
     170. オプションの現在の辞書を返します。エラーが起きると、 ‘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(): 3c0. 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: c59, regardless of whether ‘PY_SSIZE_T_CLEAN’ was
     defined.

     *note sys.audit(): 197b. 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: c59. 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(): 45e.
     When called after runtime initialization, existing audit hooks are
     notified and may silently abort the operation by raising an error
     subclassed from *note Exception: bd1. (other errors will not be
     silenced).

     The hook function is always called with an *note attached thread
     state: 5256. 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: 1c70.  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: bd1, 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: 55a8.  '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(): f15. を呼び出し
     た後、標準Cライブラリ関数の ‘exit(status)’ を呼び出します。
     ‘Py_FinalizeEx()’ がエラーになった場合、終了ステータスは 120に設定
     されます。

     バージョン 3.6 で変更: 終了処理のエラーは無視されなくなりました。

 -- C の関数: int Py_AtExit (void (*func)())
     ' 次に属します: *note Stable ABI: 775.'

     *note Py_FinalizeEx(): f15. から呼び出される後始末処理を行う関数
     (cleanup function) を登録します。後始末関数は引数無しで呼び出され、
     値を返しません。最大で 32 の後始末処理関数を登録できます。登録に成
     功すると、 *note Py_AtExit(): 54ad. は ‘0’ を返します; 失敗すると
     ‘-1’ を返します。最後に登録した後始末処理関数から先に呼び出されます
     。各関数は高々一度しか呼び出されません。 Python の内部的な終了処理
     は後始末処理関数より以前に完了しているので、 'func' からはいかなる
     Python API も呼び出してはなりません。

     参考
     ....

     *note PyUnstable_AtExit(): 195b. 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(): 161a. 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.'  This
     function is a deprecated alias of *note PyImport_ImportModule():
     3da.

     バージョン 3.3 で変更: This function used to fail immediately when
     the import lock was held by another thread.  In Python 3.3 though,
     the locking scheme switched to per-module locks for most purposes,
     so this function's special behaviour isn't needed anymore.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyImport_ImportModule(): 3da. instead.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleEx (const char
          *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist)
     '戻り値: 新しい参照。'

     モジュールをインポートします。モジュールのインポートについては組み
     込みの Python 関数 *note __import__(): ad5. を読むとよくわかります
     。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): ad5. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない 'fromlist' を渡された時以外は、トップレベルの
     パッケージを返します。

     インポートが失敗した場合は、*note PyImport_ImportModule(): 3da. と
     同様に不完全なモジュールのオブジェクトを削除します。

 -- 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__(): ad5. を
     読むとよく分かります。というのも、標準の ‘__import__()’ はこの関数
     を直接呼び出しているからです。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): ad5. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない '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(): 53be. と似ていますが、
     name が Unicode オブジェクトではなく UTF-8 でエンコードされた文字列
     である点で異なります。

     バージョン 3.3 で変更: 'level' にはもはや負の値は使用できません。

 -- C の関数: *note PyObject: 5df. *PyImport_Import (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  現在
     の "インポートフック関数" を呼び出すための高水準のインターフェース
     です ('level' に 0 を明示すると、絶対インポートを意味します)。 この
     関数は現在のグローバル変数辞書内の ‘__builtins__’ から *note
     __import__(): ad5. 関数を呼び出します。すなわち、現在の環境にインス
     トールされているインポートフック使ってインポートを行います。

     この関数は常に絶対インポートを使用します。

 -- 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(): 3da. 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: 3d5. and 'name' is a Python
     *note str: 16a. 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: 3d5.

 -- 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:
     1791. in error cases, even if 'name' was already in ‘sys.modules’
     on entry to *note PyImport_ExecCodeModule(): 53b6.  Leaving
     incompletely initialized modules in ‘sys.modules’ 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__: 23c0. and *note __loader__: 339. 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: 1284. otherwise.

     The module's *note __file__: 23c5. attribute will be set to the
     code object's *note co_filename: 1589.  If applicable, *note
     __cached__: 323. will also be set.

     この関数は、すでにインポートされているモジュールの場合には再ロード
     を行います。意図的にモジュールの再ロードを行う方法は *note
     PyImport_ReloadModule(): 53bf. を参照してください。

     'name' が ‘package.module’ 形式のドット名表記であった場合、まだ作成
     されていないパッケージ構造はその作成されないままになります。

     *note PyImport_ExecCodeModuleEx(): 53b7. と *note
     PyImport_ExecCodeModuleWithPathnames(): 53b9. も参照してください。

     バージョン 3.12 で変更: The setting of *note __cached__: 323. and
     *note __loader__: 339. is deprecated.  See *note ModuleSpec: 22c8.
     for alternatives.

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModuleEx (const
          char *name, PyObject *co, const char *pathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  Like
     *note PyImport_ExecCodeModule(): 53b6, but the *note __file__:
     23c5. attribute of the module object is set to 'pathname' if it is
     non-‘NULL’.

     *note PyImport_ExecCodeModuleWithPathnames(): 53b9. も参照してくだ
     さい。

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModuleObject
          (PyObject *name, PyObject *co, PyObject *pathname, PyObject
          *cpathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Like *note PyImport_ExecCodeModuleEx(): 53b7,
     but the *note __cached__: 323. 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__: 323. is
     deprecated.  See *note ModuleSpec: 22c8. 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(): 53b8. と似ていますが、
     '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: 3e2./‘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: 1229. 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: 24ad. could not find a
     finder for this path item.  Cache the result in
     ‘sys.path_importer_cache’.  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():
     3da. を使ってください。 (Note この関数はいささか誤解を招く名前です
     -- この関数はモジュールがすでにインポートされていたらリロードしてし
     まいます。)

     Added in version 3.3.

     バージョン 3.4 で変更: ‘__file__’ 属性はもうモジュールにセットされ
     ません。

 -- C の関数: int PyImport_ImportFrozenModule (const char *name)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyImport_ImportFrozenModuleObject(): 53bd. と似ていますが、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: 97d. *PyImport_FrozenModules

     このポインタは *note _frozen: 97d. のレコードからなり、終端の要素の
     メンバが ‘NULL’ かゼロになっているような配列を指すよう初期化されま
     す。 フリーズされたモジュールをインポートするとき、このテーブルを検
     索します。 サードパーティ製のコードからこのポインタに仕掛けを講じて
     、動的に生成されたフリーズ化モジュールの集合を提供するようにできま
     す。

 -- C の関数: int PyImport_AppendInittab (const char *name, PyObject
          *(*initfunc)(void))
     ' 次に属します: *note Stable ABI: 775.'  既存の組み込みモジュールテ
     ーブルに単一のモジュールを追加します。この関数は利便性を目的とした
     *note PyImport_ExtendInittab(): 1b7c. のラッパー関数で、テーブルが
     拡張できないときには ‘-1’ を返します。新たなモジュールは 'name' で
     インポートでき、最初にインポートを試みた際に呼び出される関数として
     'initfunc' を使います。 *note Py_Initialize(): 45e. よりも前に呼び
     出さなければなりません。

 -- 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():
     1b7c. 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: 55b0. 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():
     45e.

     Python が複数回初期化される場合、*note PyImport_AppendInittab():
     1b7b. または *note PyImport_ExtendInittab(): 1b7c. は、それぞれの初
     期化の前に呼び出される必要があります。

 -- C 変数: struct *note _inittab: 55af. *PyImport_Inittab

     The table of built-in modules used by Python initialization.  Do
     not use this directly; use *note PyImport_AppendInittab(): 1b7b.
     and *note PyImport_ExtendInittab(): 1b7c. 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: 16a. objects.

     Helper function combining *note PyImport_Import(): 161a. 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(): 394, but names are UTF-8 encoded
     strings instead of Python *note str: 16a. 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: 2dbe.

 -- C の関数: void PyMarshal_WriteLongToFile (long value, FILE *file,
          int version)

     long 型の整数値 'value' を 'file' へ整列化します。この関数は
     'value' の下桁 32 ビットを書き込むだけです; ネイティブの long 型サ
     イズには関知しません。 'version' はファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1d0a. を使います。

 -- C の関数: void PyMarshal_WriteObjectToFile (PyObject *value, FILE
          *file, int version)

     Python オブジェクト 'value' を 'file' へ整列化します。'version' は
     ファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1d0a. を使います。

 -- 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: 14f5.) を設定し ‘-1’ を返
     します。

 -- C の関数: int PyMarshal_ReadShortFromFile (FILE *file)

     読み出し用に開かれた FILE* 内のデータストリームから、 C の short 型
     データを読み出して返します。この関数は、ネイティブの short のサイズ
     に関係なく、 16 ビットの値だけを読み出せます。

     エラーの場合、適切な例外 (*note EOFError: 14f5.) を設定し ‘-1’ を返
     します。

 -- C の関数: *note PyObject: 5df. *PyMarshal_ReadObjectFromFile (FILE
          *file)
     '戻り値: 新しい参照。' 読み出し用に開かれた FILE* 内のデータストリ
     ームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 14f5, *note ValueError:
     2ee, *note TypeError: 199.) を設定し ‘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(): 55b9, 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: 14f5, *note ValueError:
     2ee, *note TypeError: 199.) を設定し ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyMarshal_ReadObjectFromString
          (const char *data, Py_ssize_t len)
     '戻り値: 新しい参照。' 'data' が指す 'len' バイトのバイト列バッファ
     内のデータストリームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 14f5, *note ValueError:
     2ee, *note TypeError: 199.) を設定し ‘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 インタプリタの拡張と埋め込み: 2019.

最初に説明する 3 つの関数、 *note PyArg_ParseTuple(): 3bf, *note
PyArg_ParseTupleAndKeywords(): 624,および *note PyArg_Parse(): 1874. は
いずれも '書式文字列 (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: 960. 構造体。
     これはロックします 根底 バッファ これにより、呼び出し元はその後、バ
     ッファを内部でも使用できるようになります
     :c:type:‘Py_BEGIN_ALLOW_THREADS’ ブロック リスクなしに 可変 データ
     が再サイズ化または破壊される。その結果、'電話をかけなければならない
     ' *note PyBuffer_Release(): 63b. データ処理が完了した後（または早期
     終了の場合）。

   * その ‘es’, ‘es#’, ‘et’ そして ‘et#’ フォーマットは結果を割り当てま
     す バッファ.  '必ず電話をかけてください' *note PyMem_Free(): 1660.
     データ処理が完了した後（または早期終了の場合）。

   * 他の形式では *note str: 16a. または 読み出し専用 bytes-like オブジ
     ェクト、例えば *note bytes: 193, および提供する ‘const char *’ ポイ
     ンタ その バッファ.  この場合 バッファ「借用」されています：これは
     対応するPythonオブジェクトによって管理され、このオブジェクトのライ
     フサイクルを共有します。メモリを自分で解放する必要はありません。

     以下のことを確実にするため 根底 バッファ 安全に借りることができます
     , 対象の *note PyBufferProcs.bf_releasebuffer: 96b. フィールドは必
     須です。 ‘NULL’.  これは一般的な 可変 次のようなオブジェクト *note
     bytearray: 342, また、いくつかの 読み出し専用 次のようなオブジェク
     ト *note memoryview: 166. の *note bytes: 193.

     これに加えて ‘bf_releasebuffer’ 要件として、入力が有効かどうかを確
     認するチェックはありません 対象は 不変 （例：請求に応じるかどうか 書
     き込み可能 バッファ, または、別のスレッドがデータを変更できるかどう
     か)。

‘s’ (*note str: 16a.) [const char *]

     Unicode オブジェクトを、キャラクタ文字列を指す C のポインタに変換し
     ます。キャラクタ型ポインタ変数のアドレスを渡すと、すでに存在してい
     る文字列へのポインタをその変数に記録します。C 文字列は NUL で終端さ
     れています。Python の文字列型は、 null コードポイントが途中に埋め込
     まれていてはなりません; もし埋め込まれていれば *note ValueError:
     2ee. 例外を送出します。Unicode オブジェクトは ‘'utf-8'’ を使って C
     文字列に変換されます。変換に失敗すると *note UnicodeError: 460. を
     送出します。

          注釈: このフォーマットは *note bytes-like objects: 194. をサポ
          ートしません。 ファイルシステムパスを受け取って C 言語の文字列
          に変換したい場合は、 ‘O&’ フォーマットを、 'converter' に
          *note PyUnicode_FSConverter(): f19. を指定して利用すると良いで
          す。

     バージョン 3.5 で変更: 以前は Python 文字列に null コードポイントが
     埋め込まれていたときに *note TypeError: 199. を送出していました。

‘s*’ (*note str: 16a. または *note bytes-like object: 194.) [Py_buffer]

     このフォーマットは Unicode オブジェクトと bytes-like object を受け
     付けて、呼び出し元から渡された *note Py_buffer: 960. 構造体に値を格
     納します。 結果の C 文字列は NUL バイトを含むかもしれません。
     Unicode オブジェクトは ‘'utf-8'’ エンコーディングで C 文字列に変換
     されます。

‘s#’ (*note str: 16a, 読み取り専用の *note bytes-like object: 194.) [const char *, *note Py_ssize_t: c59.]

     のように ‘s*’, ただし、それは *note 借用された バッファ: 3d4.  結果
     は2つのC変数に格納されます。最初の変数はC文字列へのポインター、2つ
     目の変数はその長さです。文字列には埋め込まれたヌルバイトが含まれる
     可能性があります。Unicodeオブジェクトは、C文字列に変換されます
     ‘'utf-8'’ エンコード。

‘z’ (*note str: 16a. または ‘None’) [const char *]

     ‘s’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場合
     には C のポインタは ‘NULL’ にセットされます。

‘z*’ (*note str: 16a, *note bytes-like object: 194. または ‘None’) [Py_buffer]

     ‘s*’ と同じですが、 Python の ‘None’ オブジェクトを受け取ることがで
     きます。その場合、 *note Py_buffer: 960. 構造体の ‘buf’ メンバーは
     ‘NULL’ になります。

‘z#’ (*note str: 16a, 読み出し専用の *note bytes-like object: 194. または ‘None’) [const char *, *note Py_ssize_t: c59.]

     ‘s#’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場
     合には C のポインタは ‘NULL’ にセットされます。

‘y’ (読み出し専用の *note bytes-like object: 194.) [const char *]

     この形式は bytes-like Cポインタへのオブジェクトへの参照を拒否する
     *note borrowed: 3d4. 文字列; Unicode オブジェクトは受け付けません。
     バイトバッファには埋め込みのヌルバイトを含んではいけません。もし含
     まれている場合 *note ValueError: 2ee. 例外が発生します。

     バージョン 3.5 で変更: 以前は bytes バッファにヌルバイトが埋め込ま
     れていたときに *note TypeError: 199. を送出していました。

‘y*’ (*note bytes-like object: 194.) [Py_buffer]

     ‘s*’ の変形で、 Unicode オブジェクトを受け付けず、 bytes-like
     object のみを受け付けます。 'バイナリデータを受け付ける目的には、こ
     のフォーマットを使うことを推奨します。'

‘y#’ (読み出し専用の *note bytes-like object: 194.) [const char *, *note Py_ssize_t: c59.]

     ‘s#’ の変形で、 Unicode オブジェクトを受け付けず、bytes-like object
     だけを受け付けます。

‘S’ (*note bytes: 193.) [PyBytesObject *]

     Pythonオブジェクトとして、 *note bytes: 193. オブジェクトを要求し、
     いかなる変換も行いません。オブジェクトが bytes オブジェクトでなけれ
     ば、 *note TypeError: 199. を送出します。C 変数は *note PyObject:
     5df.* と宣言しても構いません。

‘Y’ (*note bytearray: 342.) [PyByteArrayObject *]

     Python オブジェクトとして *note bytearray: 342. オブジェクトを要求
     し、いかなる変換もおこないません。 もしオブジェクトが ‘bytearray’ で
     なければ、 *note TypeError: 199. を送出します。C 変数は *note
     PyObject: 5df.* として宣言しても構いません。

‘U’ (*note str: 16a.) [PyObject *]

     Python オブジェクトとして Unicode オブジェクトを要求し、いかなる変
     換も行いません。オブジェクトが Unicode オブジェクトではない場合、
     *note TypeError: 199. が送出されます。C変数は *note PyObject: 5df.*
     として宣言しても構いません。

‘w*’ (読み書き可能な *note bytes-like object: 194.) [Py_buffer]

     This format accepts any object which implements the read-write
     buffer interface.  It fills a *note Py_buffer: 960. 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: 16a.) [const char *encoding, char **buffer]

     これは ‘s’ の変化形で、Unicodeをキャラクタ型バッファにエンコードす
     るために用いられます。NULバイトが埋め込まれていないデータでのみ動作
     します。

     この書式には二つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型または、
     ‘'utf-8'’ が使われることを表す ‘NULL’ でなければなりません。指定し
     たエンコード名を Python が理解できない場合には例外を送出します。第
     二の引数は char** でなければなりません; この引数が参照しているポイ
     ンタの値は、引数に指定したテキストの内容が入ったバッファへのポイン
     タになります。テキストは最初の引数に指定したエンコード方式でエンコ
     ードされます。

     *note PyArg_ParseTuple(): 3bf. を使うと、必要なサイズのバッファを確
     保し、そのバッファにエンコード後のデータをコピーして、 '*buffer' が
     この新たに確保された記憶領域を指すように変更します。呼び出し側には
     、確保されたバッファを使い終わった後に *note PyMem_Free(): 1660. で
     解放する責任があります。

‘et’ (*note str: 16a, *note bytes: 193. または *note bytearray: 342.) [const char *encoding, char **buffer]

     ‘es’ と同じです。ただし、バイト文字列オブジェクトをエンコードし直さ
     ずに渡します。その代わり、実装ではバイト文字列オブジェクトがパラメ
     タに渡したエンコードを使っているものと仮定します。

‘es#’ (*note str: 16a.) [const char *encoding, char **buffer, *note Py_ssize_t: c59. *buffer_length]

     ‘s#’ の変化形で、Unicode をキャラクタ型バッファにエンコードするため
     に用いられます。‘es’ 書式違って、この変化形はバイトが埋め込まれてい
     てもかまいません。

     この書式には三つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型か ‘NULL’ でなけ
     ればなりません。 ‘NULL’ の場合には ‘'utf-8'’ を使います。指定したエ
     ンコード名を Python が理解できない場合には例外を送出します。第二の
     引数は char** でなければなりません; この引数が参照しているポインタ
     の値は、引数に指定したテキストの内容が入ったバッファへのポインタに
     なります。テキストは最初の引数に指定したエンコード方式でエンコード
     されます。第三の引数は整数へのポインタでなければなりません; ポイン
     タが参照している整数の値は出力バッファ内のバイト数にセットされます
     。

     この書式の処理には二つのモードがあります:

     '*buffer' が ‘NULL’ ポインタを指している場合、関数は必要なサイズの
     バッファを確保し、そのバッファにエンコード後のデータをコピーして、
     '*buffer' がこの新たに確保された記憶領域を指すように変更します。呼
     び出し側には、確保されたバッファを使い終わった後に *note
     PyMem_Free(): 1660. で解放する責任があります。

     '*buffer' が非 ‘NULL’ のポインタ (すでにメモリ確保済みのバッファ) を
     指している場合、 *note PyArg_ParseTuple(): 3bf. はこのメモリ位置を
     バッファとして用い、 '*buffer_length' の初期値をバッファサイズとし
     て用います。 PyArg_ParseTuple は次にエンコード済みのデータをバッフ
     ァにコピーして、NUL で終端します。バッファの大きさが足りなければ
     *note ValueError: 2ee. がセットされます。

     どちらの場合も、 '*buffer_length' は終端の NUL バイトを含まないエン
     コード済みデータの長さにセットされます。

‘et#’ (*note str: 16a, *note bytes: 193. または *note bytearray: 342.) [const char *encoding, char **buffer, *note Py_ssize_t: c59. *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: 19c, *note float: 197. or
*note complex: 198. can also use the corresponding special methods *note
__index__(): 19f, *note __float__(): bc5. or *note __complex__(): 7fd.
to convert the Python object to the required type.

For signed integer formats, *note OverflowError: a85. 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: 19c.) [unsigned char]

     Convert a nonnegative Python integer to an unsigned tiny integer,
     stored in a C unsigned char.

‘B’ (*note int: 19c.) [unsigned char]

     Convert a Python integer to a tiny integer without overflow
     checking, stored in a C unsigned char.

‘h’ (*note int: 19c.) [short int]

     Python の整数を、 C の short int 型に変換します。

‘H’ (*note int: 19c.) [unsigned short int]

     Convert a Python integer to a C unsigned short int, without
     overflow checking.

‘i’ (*note int: 19c.) [int]

     Python の整数を、 C の int 型に変換します。

‘I’ (*note int: 19c.) [unsigned int]

     Convert a Python integer to a C unsigned int, without overflow
     checking.

‘l’ (*note int: 19c.) [long int]

     Python の整数を、 C の long int 型に変換します。

‘k’ (*note int: 19c.) [unsigned long]

     Convert a Python integer to a C unsigned long without overflow
     checking.

     バージョン 3.14 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

‘L’ (*note int: 19c.) [long long]

     Python の整数を、 C の long long 型に変換します。

‘K’ (*note int: 19c.) [unsigned long long]

     Convert a Python integer to a C unsigned long long without overflow
     checking.

     バージョン 3.14 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

‘n’ (*note int: 19c.) [*note Py_ssize_t: c59.]

     Python の整数をCの *note Py_ssize_t: c59. 型に変換します。

‘c’ (長さ 1 の、 *note bytes: 193. または *note bytearray: 342.) [char]

     長さ 1 の *note bytes: 193. または *note bytearray: 342. オブジェク
     トとして表現されている Python バイトを C の char 型に変換します。

     バージョン 3.3 で変更: *note bytearray: 342. を受け付けるようになり
     ました。

‘C’ (長さ 1 の *note str: 16a.) [int]

     長さ 1 の *note str: 16a. オブジェクトとして表現されている Python キ
     ャラクタを C の int 型に変換します。

‘f’ (*note float: 197.) [float]

     Convert a Python floating-point number to a C float.

‘d’ (*note float: 197.) [double]

     Convert a Python floating-point number to a C double.

‘D’ (*note complex: 198.) [Py_complex]

     Python の複素数型を、 C の *note Py_complex: 55c1. 構造体に変換しま
     す。


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: 199. を送出します。

‘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(): f19. and
     *note PyUnicode_FSDecoder(): 797.

     バージョン 3.1 で変更: ‘Py_CLEANUP_SUPPORTED’ was added.

‘p’ (*note bool: 3c1.) [int]

     真偽値が求められる箇所 (a boolean 'p'redicate) に渡された値を判定し
     、その結果を等価な C の true/false 整数値に変換します。 もし式が真
     なら int には ‘1’ が、偽なら ‘0’ が設定されます。この関数は任意の有
     効なPython値を受け付けます。 Pythonが値の真偽をどのように判定するか
     を知りたければ、 *note 真理値判定: 18bd. を参照してください。

     Added in version 3.3.

‘(items)’ (sequence) ['matching-items']

     The object must be a Python sequence (except *note str: 16a, *note
     bytes: 193. or *note bytearray: 342.) 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: 3d4. (‘s’, ‘s#’, ‘z’, ‘z#’, ‘y’, or ‘y#’) or a *note
     borrowed reference: 3d5. (‘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: 16a. and *note bytearray: 342.
     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(): 3bf. は対応する C 変数の内容に手を加えま
     せん。

‘$’

     *note PyArg_ParseTupleAndKeywords(): 624. でのみ使用可能: 後続の
     Python引数がキーワード専用であることを示します。 現在、すべてのキー
     ワード専用引数は任意の引数でなければならず、そのため フォーマット文
     字列中の ‘|’ は常に ‘$’ より前に指定されなければなりません。

     Added in version 3.3.

‘:’

     この文字があると、書式単位の記述はそこで終わります; コロン以降の文
     字列は、エラーメッセージにおける関数名 (*note PyArg_ParseTuple():
     3bf. が送出する例外の "付属値 (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():
     3bf. と同じですが、可変長の引数ではなく '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: c7c.  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 位置専用引数: c7c. を追加した。

     バージョン 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: 1726. に 関数 にメソッド テーブ
     ル。実際のパラメーターを含むタプルは '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(): 1724. 呼び出しは、 *note
     PyArg_ParseTuple(): 3bf. を使った以下の呼び出しと全く等価です:

          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(): 3c0. は常にタプルを生成するとは限りません。
     この関数がタプルを生成するのは、書式文字列に二つ以上の書式単位が入
     っているときだけです。書式文字列が空の場合 ‘None’ を返します; 書式
     単位が厳密に一つだけ入っている場合、書式単位で指定されている何らか
     のオブジェクト単体を返します。サイズがゼロや 1 のタプルを返すように
     強制するには、丸括弧で囲われた書式文字列を使います。

     書式単位 ‘s’ や ‘s#’ の場合のように、オブジェクトを構築する際にデー
     タを供給するためにメモリバッファをパラメタとして渡す場合には、指定
     したデータはコピーされます。 *note Py_BuildValue(): 3c0. が生成した
     オブジェクトは、呼び出し側が提供したバッファを決して参照しません。
     別の言い方をすれば、 ‘malloc()’ を呼び出してメモリを確保し、それを
     ‘Py_BuildValue()’ に渡した場合、コード内で ‘Py_BuildValue()’ が返っ
     た後で ‘free()’ を呼び出す責任があるということです。

     以下の説明では、引用符のついた形式は書式単位です; (丸)括弧で囲った
     部分は書式単位が返す Python のオブジェクト型です; [角] 括弧は関数に
     渡す値の C 変数型です。

     書式文字列内では、(‘s#’ のような書式単位を除いて) スペース、タブ、
     コロンおよびコンマは無視されます。これらの文字を使うと、長い書式文
     字列をちょっとだけ読みやすくできます。

     ‘s’ (*note str: 16a. または ‘None’) [const char *]

          null終端された C 文字列を、 ‘'utf-8'’ エンコーディングを用いて
          、 Python *note str: 16a. オブジェクトに変換します。もし C 文
          字列ポインタが ‘NULL’ の場合、 ‘None’ になります。

     ‘s#’ (*note str: 16a. or ‘None’) [const char *, *note Py_ssize_t: c59.]

          C 文字列とその長さを ‘'utf-8'’ エンコーディングを使って Python
          *note str: 16a. オブジェクトに変換します。C 文字列ポインタが
          ‘NULL’ の場合、長さは無視され、 ‘None’ になります。

     ‘y’ (*note bytes: 193.) [const char *]

          C 文字列をPython *note bytes: 193. オブジェクトに変換します。
          もしC 文字列ポインタが ‘NULL’ だった場合、‘None’ を返します。

     ‘y#’ (*note bytes: 193.) [const char *, *note Py_ssize_t: c59.]

          これは C 文字列とその長さから Python オブジェクトに変換します
          。C 文字列ポインタが ‘NULL’ の場合、長さは無視され ‘None’ にな
          ります。

     ‘z’ (*note str: 16a. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘z#’ (*note str: 16a. または ‘None’) [const char *, *note Py_ssize_t: c59.]

          ‘s#’ と同じです。

     ‘u’ (*note str: 16a.) [const wchar_t *]

          null 終端された Unicode (UTF-16 または UCS-4) データの
          ‘wchar_t’ バッファから Python Unicode オブジェクトに変換します
          。 Unicode バッファポインタが ‘NULL’ の場合、 ‘None’ になりま
          す。

     ‘u#’ (*note str: 16a.) [const wchar_t *, *note Py_ssize_t: c59.]

          Unicode (UTF-16 または UCS-4) データのバッファとその長さから
          Python Unicode オブジェクトに変換します。 Unicode バッファポイ
          ンタが ‘NULL’ の場合、長さは無視され ‘None’ になります。

     ‘U’ (*note str: 16a. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘U#’ (*note str: 16a. または ‘None’) [const char *, *note Py_ssize_t: c59.]

          ‘s#’ と同じです。

     ‘i’ (*note int: 19c.) [int]

          通常の C の int を Python の整数オブジェクトに変換します。

     ‘b’ (*note int: 19c.) [char]

          通常のC の char を Python の整数オブジェクトに変換します。

     ‘h’ (*note int: 19c.) [short int]

          通常のC の short int を Python の整数オブジェクトに変換します
          。

     ‘l’ (*note int: 19c.) [long int]

          C の long int を Python の整数オブジェクトに変換します。

     ‘B’ (*note int: 19c.) [unsigned char]

          C の unsigned char を Python の整数オブジェクトに変換します。

     ‘H’ (*note int: 19c.) [unsigned short int]

          C の unsigned short int を Python の整数オブジェクトに変換しま
          す。

     ‘I’ (*note int: 19c.) [unsigned int]

          C の unsigned int を Python の整数オブジェクトに変換します。

     ‘k’ (*note int: 19c.) [unsigned long]

          C の unsigned long を Python の整数オブジェクトに変換します。

     ‘L’ (*note int: 19c.) [long long]

          C の long long を Python の整数オブジェクトに変換します。

     ‘K’ (*note int: 19c.) [unsigned long long]

          C unsigned long long をPythonのintオブジェクトへ変換する。

     ‘n’ (*note int: 19c.) [*note Py_ssize_t: c59.]

          C の *note Py_ssize_t: c59. を Python の整数オブジェクトに変換
          します。

     ‘p’ (*note bool: 3c1.) [int]

          Convert a C int to a Python *note bool: 3c1. 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: 193.) [char]

          バイトを表す通常の C の int を、長さ 1 の Python の *note
          bytes: 193. オブジェクトに変換します。

     ‘C’ (長さ 1 の *note str: 16a.) [int]

          文字を表す通常の C の int を、長さ 1 の Python の *note str:
          16a. オブジェクトに変換します。

     ‘d’ (*note float: 197.) [double]

          Convert a C double to a Python floating-point number.

     ‘f’ (*note float: 197.) [float]

          Convert a C float to a Python floating-point number.

     ‘D’ (*note complex: 198.) [Py_complex *]

          C の *note Py_complex: 55c1. 構造体を Python の複素数型に変換
          します。

     ‘O’ (object) [PyObject *]

          Python オブジェクトをそのまま渡すものの、それに対する新しい 強
          参照 を作成する（つまり、その参照カウントが1増加します）。渡さ
          れたオブジェクトが ‘NULL’ ポインタ, この問題は、引数を生成する
          呼び出しがエラーを検出し、例外を設定したため発生したものと推測
          されます。したがって、*note Py_BuildValue(): 3c0. 戻ってきます
          ‘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: 24f.) ['matching-items']

          C の値からなる配列を、同じ要素数を持つ Python のリストに変換し
          ます。

     ‘{items}’ (*note dict: 184.) ['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(): 3c0. と同じですが、可変長引数の代わりに
     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(): 1727. と *note PyOS_vsnprintf(): 1728. は標準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(): 540b, 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(): 197. コンストラクタが受け付け
     る文字列に準拠しますが、 ‘s’ の先頭と末尾に空白文字があってはならな
     いという部分が異なります。この変換は現在のロケールに依存しません。

     ‘endptr’ が ‘NULL’ の場合、変換は文字列全体に対して行われます。文字
     列が正しい浮動小数点数の表現になっていない場合は ‘-1.0’ を返して
     *note ValueError: 2ee. を発生させます。

     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(): 1c3. フォーマットを指定しています。

     '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(): 1727. ‘'#'’ 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(): 1660. を使って解放する責任があります。

     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():
     1d99. and *note PyOS_mystrnicmp(): 1d98, 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: 527b. メンバや *note 数値型のハッシュ化:
265d. も参照してください。

 -- 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: 16a. 、 *note bytes: 193. や *note memoryview: 166. のハ
     ッシュ用アルゴリズムを示す数値型。

     アルゴリズム名は *note sys.hash_info.algorithm: 4ca1. により公開さ
     れます。

     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: 55d9. to
     determine which algorithm is used for hashing.  The hash algorithm
     can be configured via the configure *note -with-hash-algorithm:
     2210. 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: 55d9.

        - 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: 4ca4. 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: 265e.
     constant.

     Added in version 3.13.

 -- C のマクロ: PyHASH_BITS

     The exponent ‘n’ of ‘P’ in *note PyHASH_MODULUS: 1a47.

     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: 4c9e. 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: 4ca0. constant.

     Added in version 3.13.

 -- C のデータ型: type PyHash_FuncDef

     Hash function definition used by *note PyHash_GetFuncDef(): 55df.

      -- C のメンバ変数: *note Py_hash_t: 147f. (*const hash)(const
               void*, *note Py_ssize_t: c59.)

          Hash function.

      -- C のメンバ変数: const char *name

          Hash function name (UTF-8 encoded string).

          This corresponds to the *note sys.hash_info.algorithm: 4ca1.
          constant.

      -- C のメンバ変数: const int hash_bits

          Internal size of the hash value in bits.

          This corresponds to the *note sys.hash_info.hash_bits: 4ca2.
          constant.

      -- C のメンバ変数: const int seed_bits

          Size of seed input in bits.

          This corresponds to the *note sys.hash_info.seed_bits: 4ca3.
          constant.

     Added in version 3.4.

 -- C の関数: *note PyHash_FuncDef: 55de. *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: 147f. 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: 147f. 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: 193, *note memoryview: 166, and other built-in objects
     that implement the *note buffer protocol: 262.

     Use this function to implement hashing for immutable objects whose
     *note tp_richcompare: 5275. 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: 147f. 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(): 423.

     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(): 1b98. 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: 3d5, 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: 990. *PyEval_GetFrame (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     the *note attached thread state: 5256.'s frame, which is ‘NULL’ if
     no frame is currently executing.

     See also *note PyThreadState_GetFrame(): 995.

 -- 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():
     1b98.

     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(): 1c67. 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(): 5362. と連結された結果、 '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: 2445. を発生させます。

 -- 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: 2445. 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: 28ae. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_IncrementalDecoder (const
          char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note IncrementalDecoder: 28af. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_StreamReader (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note StreamReader: 28b3. ファクトリ関数を返し
     ます。

 -- C の関数: *note PyObject: 5df. *PyCodec_StreamWriter (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note StreamWriter: 28b2. ファクトリ関数を返し
     ます。


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: 888,
     *note UnicodeDecodeError: c0c, *note UnicodeTranslateError: 195e. の
     どれかのインスタンスを受け取ります。このインスタンスは問題のある文
     字列やバイト列に関する情報と、その元の文字列中のオフセットを持って
     います。(その情報を取得するための関数については *note Unicode
     例外オブジェクト: 45f. を参照してください。) コールバックは渡された
     例外を発生させるか、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 オブジェクト: 55f1. を参照してください。

* 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: 538b.
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: 5256.

 -- 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(): c7e.
     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: 5256.

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: 5256. a
*note thread state: 18ab, 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: 5256.

 -- 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: 5256.

 -- 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: 5256.


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: 5256. 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():
     1b0b.).  Normally, there's no need to call this explicitly; just
     use ‘PyUnstable_WritePerfMapEntry()’ 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(): 1b0c. before
     writing the entry, if the perf map file is not already opened.
     Returns ‘0’ on success, or the same error codes as
     ‘PyUnstable_PerfMapState_Init()’ 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(): 1b0c.  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 reference manual

7.8 抽象オブジェクトレイヤ (Abstract Objects Layer)
===================================================

この章で説明する関数は、オブジェクトの型に依存しないような Python オブジ
ェクトの操作や、(数値型全て、シーケンス型全てといった) 大まかな型のオブ
ジェクトに対する操作を行ないます。関数を適用対象でないオブジェクトに対し
て使った場合、Python の例外が送出されることになります。

これらの関数は、 *note PyList_New(): 52ce. で作成された後に ‘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: 886.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_FALSE            ‘1’       *note False: d2f.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_TRUE             ‘2’       *note True: e0b.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_ELLIPSIS         ‘3’       *note Ellipsis: 2384.
                                                            
                                                            
      -- C のマクロ:                              ‘4’       *note NotImplemented: 1a3.
               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: 292.

 -- 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: 3d5.

     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: 560a. from
     within a C function (that is, create a new *note strong reference:
     5e2. to *note NotImplemented: 1a3. and return it).

 -- C のマクロ: Py_PRINT_RAW

     Flag to be used with multiple functions that print the object (like
     *note PyObject_Print(): 17b1. and *note PyFile_WriteObject():
     53ab.).  If passed, these functions use the *note str(): 16a. of
     the object instead of the *note repr(): 1c3.

 -- 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: 560b.; if
     given, the *note str(): 16a. of the object is written instead of
     the *note repr(): 1c3.

 -- 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__(): dcf. 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__(): dcf. methods
          or while creating the temporary *note str: 16a. 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
     ‘AttributeError’ 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) の実装:
     e4d. で概要が述べられている通り、データのデスクリプタはインスタンス
     の属性より優先され、非データデスクリプタは後回しにされます。見付か
     らなかった場合は *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(): 1897. のため、非推奨となっていますが、削
     除される予定はありません。

 -- C の関数: int PyObject_SetAttrString (PyObject *o, const char
          *attr_name, PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyObject_SetAttr(): 17c8, 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(): 1898. を使うのが望ましいです。

     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(): 5497.
     and *note PyObject_SetAttr(): 17c8. directly.  For more details,
     see *note PyUnicode_InternFromString(): 19eb, 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: 526d. スロットに置
     かれます。 オブジェクトの 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(): 1897, 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(): 5497.
     and *note PyObject_DelAttr(): 1897. directly.  For more details,
     see *note PyUnicode_InternFromString(): 19eb, 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: 560d, *note Py_LE:
     560e, *note Py_EQ: 560f, *note Py_NE: 5610, *note Py_GT: 5611, or
     *note Py_GE: 5612, 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(): 5276, but returns ‘-1’ on error, ‘0’ if the
     result is false, ‘1’ otherwise.

     注釈: If 'o1' and 'o2' are the same object, *note
     PyObject_RichCompareBool(): 1dea. will always return ‘1’ for *note
     Py_EQ: 560f. and ‘0’ for *note Py_NE: 5610.

 -- 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(): 1c3. の処理で呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: *note PyObject: 5df. *PyObject_ASCII (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     *note PyObject_Repr(): 1234. と同様、オブジェクト 'o' の文字列表現
     を計算しますが、 ‘PyObject_Repr()’ によって返された文字列に含まれる
     非 ASCII 文字を、エスケープ文字 ‘\x’ 、 ‘\u’ 、 ‘\U’ でエスケープし
     ます。この関数は Pythoh 2 の ‘PyObject_Repr()’ が返す文字列と同じ文
     字列を生成します。 *note ascii(): 1604. によって呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

 -- C の関数: *note PyObject: 5df. *PyObject_Str (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  オブ
     ジェクト 'o' の文字列表現を計算します。成功すると文字列表現を返し、
     失敗すると ‘NULL’ を返します。 Python 式 ‘str(o)’ と同じです。この
     関数は組み込み関数 *note str(): 16a. や、 *note print(): 117b. 関数
     の処理で呼び出されます。

     If argument is ‘NULL’, return the string ‘'<NULL>'’.

     バージョン 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 が送出されます。

     If argument is ‘NULL’, return the *note bytes: 193. object
     ‘b'<NULL>'’.

 -- 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__(): 2427. 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__:
     23d4.

     Normally only class objects, i.e.  instances of *note type: f48. or
     a derived class, are considered classes.  However, objects can
     override this by having a *note __bases__: 16ca. 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__(): 2426. 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__: 16cb. attribute.

     An object 'cls' can override if it is considered a class, and what
     its base classes are, by having a *note __bases__: 16ca. attribute
     (which must be a tuple of base classes).

 -- C の関数: *note Py_hash_t: 147f. PyObject_Hash (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     オブジェクト 'o' のハッシュ値を計算して返します。失敗すると ‘-1’ を
     返します。 Python の式 ‘hash(o)’ と同じです。

     バージョン 3.2 で変更: 返り値の型が Py_hash_t になりました。この型
     は、 *note Py_ssize_t: c59. と同じサイズをもつ符号付き整数です。

 -- C の関数: *note Py_hash_t: 147f. PyObject_HashNotImplemented
          (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Set a *note TypeError:
     199. 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(): 3c7. function,
     which returns a pointer of type *note PyTypeObject: ca0.*, except
     when a new strong reference 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: c59. PyObject_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c59. PyObject_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     'o' の長さを返します。ただしオブジェクト 'o' がシーケンス型プロトコ
     ルとマップ型プロトコルの両方を提供している場合、シーケンスとしての
     長さを返します。エラーが生じると ‘-1’ を返します。 Python の式
     ‘len(o)’ と同じです。

 -- C の関数: *note Py_ssize_t: c59. PyObject_LengthHint (PyObject *o,
          Py_ssize_t defaultvalue)

     オブジェクト 'o' の概算の長さを返します。 最初に実際の長さを、次に
     *note __length_hint__(): 1113. を使って概算の長さを、そして最後にデ
     フォルトの値を返そうとします。 この関数は 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(): 5410, 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(): 1d0a. は偽を返します。

 -- C の関数: *note PyObject: 5df. *PyObject_GetIter (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python の式 ‘iter(o)’ と同じです。引数にとったオブジェクトに対する
     新たなイテレータか、オブジェクトがすでにイテレータの場合にはオブジ
     ェクト自身を返します。オブジェクトが反復処理不可能であった場合には
     *note TypeError: 199. を送出して ‘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: 170d. 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: 199. 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: c59. 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:
     199. 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: 1f6. 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: 165.
     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(): 1529. and *note
     PyObject_GC_IsTracked(): b71.).

     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: 3d5. 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(): 2d1.

     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: 292, 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(): 192c. must have been called
     earlier on 'obj' or this function may spuriously return ‘0’ in the
     *note free-threaded build: 17b0.

     This function is logically equivalent to the following C code,
     except that it behaves atomically in the *note free-threaded build:
     17b0.:

          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: 5613.

     Typically, correct use of this function requires support from
     'obj"s deallocator (*note tp_dealloc: 5241.).  For example, the
     following sketch could be adapted to implement a "weakmap" that
     works like a *note WeakValueDictionary: 198a. 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(): 192b. 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: 2d1.(*note op: 3c4.) == 1.

     On a *note free-threaded build: 17b0, this checks if 'op"s *note
     reference count: 524e. is equal to one and additionally checks if
     'op' is only used by this thread.  *note Py_REFCNT: 2d1.(*note op:
     3c4.) == 1 is 'not' thread-safe on free-threaded builds; prefer
     this function.

     The caller must hold an *note attached thread state: 5256, 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: 5618.


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 ‘tp_call’ 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: 3cd. 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: 561a. 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:
5618. 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: 5583.: CPython uses *note Py_EnterRecursiveCall(): 3d0. and
*note Py_LeaveRecursiveCall(): b6f. 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: c59. 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(): b73.              ‘PyObject *’           1 object                 --
                                                                                               
                                                                                               
*note PyObject_CallObject(): 5231.             ‘PyObject *’           tuple/‘NULL’             --
                                                                                               
                                                                                               
*note PyObject_CallFunction(): 63f.            ‘PyObject *’           format                   --
                                                                                               
                                                                                               
*note PyObject_CallMethod(): 640.              obj + ‘char*’          format                   --
                                                                                               
                                                                                               
*note PyObject_CallFunctionObjArgs(): 540f.    ‘PyObject *’           variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodObjArgs(): 1e3b.      obj + name             variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodNoArgs(): 561f.       obj + name             --                       --
                                                                                               
                                                                                               
*note PyObject_CallMethodOneArg(): 5620.       obj + name             1 object                 --
                                                                                               
                                                                                               
*note PyObject_Vectorcall(): 77e.              ‘PyObject *’           vectorcall               vectorcall
                                                                                               
                                                                                               
*note PyObject_VectorcallDict(): 5621.         ‘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(): 3c0. 形式のフォー
     マット文字列を使って記述します。 'format' は 'NULL' かもしれず、与
     える引数がないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args)’ 。

     *note PyObject: 5df.* args だけを引数に渡す場合は、 *note
     PyObject_CallFunctionObjArgs(): 540f. がより速い方法であることを覚
     えておいてください。

     バージョン 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(): 3c0. 形式のフォーマット文字列で記述されています。

     'format' は 'NULL' でもよく、引数が与えられないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘obj.name(arg1, arg2, ...)’ 。

     *note PyObject: 5df.* args だけを引数に渡す場合は、 *note
     PyObject_CallMethodObjArgs(): 1e3b. がより速い方法であることを覚え
     ておいてください。

     バージョン 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: 23f.

 -- 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: 54bd.
     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(): b9d. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘divmod(o1, o2)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Power (PyObject *o1,
          PyObject *o2, PyObject *o3)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     組み込み関数 *note pow(): 1a5. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘pow(o1, o2, o3)’ と同じです。 'o3'
     はオプションです。 'o3' を無視させたいなら、 *note Py_None: 5223. を
     入れてください ('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(): 1a5. を参照してください。失敗すると
     ‘NULL’ を返します。 'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。この関数は 'o3' が *note Py_None: 5223. の
     場合は Python 文 ‘o1 **= o2’ と同じで、それ以外の場合は ‘pow(o1,
     o2, o3)’ の in-place 版です。 'o3' を無視させたいなら、 ‘Py_None’ を
     入れてください ('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: 199. 例外が送出されます。

     バージョン 3.10 で変更: 結果は常に厳密な *note int: 19c. 型です。 以
     前は、結果は ‘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(): a97. で変換されます。

 -- C の関数: *note Py_ssize_t: c59. PyNumber_AsSsize_t (PyObject *o,
          PyObject *exc)
     ' 次に属します: *note Stable ABI: 775.'  'o' を整数として解釈可能だ
     った場合、*note Py_ssize_t: c59. 型の値に変換して返します。呼び出し
     が失敗したら、例外が送出され、 ‘-1’ が返されます。

     もし 'o' がPythonのintに変換できたのに、*note Py_ssize_t: c59. への
     変換が *note OverflowError: a85. になる場合は、 'exc' 引数で渡され
     た型 (普通は *note IndexError: 1753. か ‘OverflowError’) の例外を送
     出します。もし、 '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: 184. 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: c59. PySequence_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c59. 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(): 1897. を使うのが望ましいです。

 -- 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: c59. 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(): 3d7.

     *note Soft deprecated: 23f. since version 3.14: The function should
     no longer be used to write new code.

 -- C の関数: *note Py_ssize_t: c59. 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:
     199. を送出します。失敗したら ‘NULL’ を返します。

     ‘PySequence_Fast*’ ファミリの関数は、'o' が *note PyTupleObject:
     55a8. または *note PyListObject: 2784. と仮定し、'o' のデータフィー
     ルドに直接アクセスするため、そのように名付けられています。

     CPythonの実装では、もし 'o' が 既にシーケンスかタプルであれば、'o'
     そのものを返します。

 -- C の関数: *note Py_ssize_t: c59. PySequence_Fast_GET_SIZE (PyObject
          *o)

     'o' が ‘NULL’ でなく、 *note PySequence_Fast(): 1905. が返したオブ
     ジェクトであると仮定して、 'o' の長さを返します。 'o' のサイズは
     *note PySequence_Size(): 1e8f. を呼び出しても得られますが、 *note
     PySequence_Fast_GET_SIZE(): 3c8. の方が 'o' をリストかタプルである
     と仮定して処理するため、より高速です。

 -- C の関数: *note PyObject: 5df. *PySequence_Fast_GET_ITEM (PyObject
          *o, Py_ssize_t i)
     '戻り値: 借用参照。' 'o' が ‘NULL’ でなく、 *note
     PySequence_Fast(): 1905. が返したオブジェクトであり、かつ 'i' がイ
     ンデクスの範囲内にあると仮定して、 'o' の 'i' 番目の要素を返します
     。

 -- C の関数: *note PyObject: 5df. **PySequence_Fast_ITEMS (PyObject *o)

     PyObject ポインタの背後にあるアレイを返します。この関数では、 'o' は
     *note PySequence_Fast(): 1905. の返したオブジェクトであり、 ‘NULL’
     でないものと仮定しています。

     リストのサイズが変更されるとき、メモリ再確保が要素の配列を再配置す
     るかもしれないことに注意してください。そのため、シーケンスの変更が
     発生しないコンテキストでのみ背後にあるポインタを使ってください。

 -- C の関数: *note PyObject: 5df. *PySequence_ITEM (PyObject *o,
          Py_ssize_t i)
     '戻り値: 新しい参照。' 'o' の 'i' 番目の要素を返し、失敗すると
     ‘NULL’ を返します。 *note PySequence_GetItem(): 1e90. の高速版であ
     り、*note PySequence_Check(): 5425. で '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(): 52cd, *note
PyObject_DelItem(): 5410. も参照してください。

 -- 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: c59. PyMapping_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c59. 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 ‘KeyError’ 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(): 52cd, 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(): 5410.

 -- C の関数: int PyMapping_DelItemString (PyObject *o, const char *key)

     This is the same as *note PyObject_DelItem(): 5410, 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: 16a. 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(): 396. 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(): 396.

     Return the next value from the iterator 'o'.  The object must be an
     iterator according to *note PyIter_Check(): 1d0d. (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(): a9c.

     Added in version 3.10.

 -- C の関数: *note PySendResult: 5637. 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: 193. や *note bytearray: 342. 、 *note array.array:
4be. のようないくつかの拡張型が挙げられます。サードバーティのライブラリ
は画像処理や数値解析のような特別な目的のために、それら自身の型を定義する
ことができます。

それぞれの型はそれ自身のセマンティクスを持ちますが、おそらく大きなメモリ
バッファからなるという共通の特徴を共有します。いくつかの状況では仲介する
コピーを行うことなく直接バッファにアクセスすることが望まれます。

Python provides such a facility at the C and Python level in the form of
the *note buffer protocol: 262.  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): 124c.;
     for Python see *note Emulating buffer types: 2470.

   - 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: 166.

*note bytes: 193. や *note bytearray: 342. などのシンプルなオブジェクト
は、内部のバッファーをバイト列の形式で公開します。 バイト列以外の形式も
利用可能です。例えば、 *note array.array: 4be. が公開する要素はマルチバ
イト値になることがあります。

bufferインターフェースの利用者の一例は、ファイルオブジェクトの *note
write(): edb. メソッドです: bufferインターフェースを通して一連のバイト列
を提供できるどんなオブジェクトでもファイルに書き込むことができます。
‘write()’ は、その引数として渡されたオブジェクトの内部要素に対する読み出
し専用アクセスのみを必要としますが、 *note readinto(): 18f8. のような他
のメソッドでは、その引数の内容に対する書き込みアクセスが必要です。
bufferインターフェースにより、オブジェクトは読み書き両方、読み出し専用バ
ッファへのアクセスを許可するかそれとも拒否するか選択することができます。

bufferインターフェースの利用者には、対象となるオブジェクトのバッファを得
る二つの方法があります:

   * 正しい引数で *note PyObject_GetBuffer(): 63a. を呼び出す;

   * *note PyArg_ParseTuple(): 3bf. (またはその同族のひとつ) を ‘y*’ 、
     ‘w*’ または ‘s*’ *note format codes: 3d3. のいずれかとともに呼び出
     す。

どちらのケースでも、bufferが必要なくなった時に *note PyBuffer_Release():
63b. を呼び出さなければなりません。これを怠ると、リソースリークのような
様々な問題につながる恐れがあります。

Added in version 3.12: The buffer protocol is now accessible in Python,
see *note Emulating buffer types: 2470. and *note memoryview: 166.

* 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: 563d. オブジェクトが作成されます。

エクスポートされるオブジェクトを書く方法の短い説明には、 *note Buffer
Object Structures: 124c. を参照してください。バッファを取得するには、
*note PyObject_GetBuffer(): 63a. を参照してください。

 -- C のデータ型: type Py_buffer
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む) (バ
     ージョン 3.11 より).'
      -- C のメンバ変数: void *buf

          バッファフィールドが表している論理構造の先頭を指すポインタ。 バ
          ッファを提供するオブジェクトの下層物理メモリブロック中のどの位
          置にもなりえます。 例えば *note strides: 563f. が負だと、この
          値はメモリブロックの末尾かもしれません。

          *note 連続: 1252. 配列の場合この値はメモリブロックの先頭を指し
          ます。

      -- C のメンバ変数: *note PyObject: 5df. *obj

          エクスポート対象オブジェクトへの新しい参照。この参照は消費者に
          よって所有され、自動的に解放されます（つまり、参照カウントが減
          少します）し、設定されます ‘NULL’ by *note PyBuffer_Release():
          63b.  このフィールドは、標準のC-API関数の戻り値に相当します。

          *note PyMemoryView_FromBuffer(): 969. または *note
          PyBuffer_FillInfo(): 968. によってラップされた '一時的な' バッ
          ファである特別なケースでは、このフィールドは ‘NULL’ です。一般
          的に、エクスポートオブジェクトはこの方式を使用してはなりません
          。

      -- C のメンバ変数: *note Py_ssize_t: c59. len

          ‘product(shape) * itemsize’。contiguous配列では、下層のメモリ
          ブロックの長さになります。非contiguous 配列では、contiguous表
          現にコピーされた場合に論理構造がもつ長さです。

          ‘((char *)buf)[0]’ から ‘((char *)buf)[len-1]’ の範囲へのアク
          セスは、連続性 (contiguity) を保証するリクエストによって取得さ
          れたバッファに対してのみ許されます。 多くの場合に、そのような
          リクエストは *note PyBUF_SIMPLE: 52f6. または *note
          PyBUF_WRITABLE: 15d3. です。

      -- C のメンバ変数: int readonly

          バッファが読み出し専用であるか示します。このフィールドは *note
          PyBUF_WRITABLE: 15d3. フラグで制御できます。

      -- C のメンバ変数: *note Py_ssize_t: c59. itemsize

          要素一つ分のbyte単位のサイズ。 *note struct.calcsize(): 1e06.
          を非 ‘NULL’ の *note format: 5644. 値に対して呼び出した結果と
          同じです。

          重要な例外: 消費者が *note PyBUF_FORMAT: 52ee. フラグを設定す
          ることなくバッファを要求した場合、 ‘format’ は ‘NULL’ に設定さ
          れます。 しかし *note itemsize: 5643. は元のフォーマットに従っ
          た値を保持します。

          *note shape: 5645. が存在する場合、 ‘product(shape) * itemsize
          == len’ の等式が守られ、利用者は *note itemsize: 5643. を
          buffer を読むために利用できます。

          *note PyBUF_SIMPLE: 52f6. または *note PyBUF_WRITABLE: 15d3. で
          要求した結果、 *note shape: 5645. が ‘NULL’ であれば、消費者は
          *note itemsize: 5643. を無視して ‘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: 52ee. フラグによって制御
          されます。

      -- C のメンバ変数: int ndim

          The number of dimensions the memory represents as an
          n-dimensional array.  If it is ‘0’, *note buf: 563e. points to
          a single item representing a scalar.  In this case, *note
          shape: 5645, *note strides: 563f. and *note suboffsets: 5647.
          MUST be ‘NULL’.  The maximum number of dimensions is given by
          *note PyBUF_MAX_NDIM: 52f2.

      -- C のメンバ変数: *note Py_ssize_t: c59. *shape

          メモリ上のN次元配列の形を示す、長さが *note ndim: 5646. である
          *note Py_ssize_t: c59. の配列です。 ‘shape[0] * ... *
          shape[ndim-1] * itemsize’ は *note len: 5641. と等しくなければ
          なりません。

          shape の値は ‘shape[n] >= 0’ に制限されます。 ‘shape[n] == 0’
          の場合に特に注意が必要です。 詳細は *note complex arrays:
          5648. を参照してください。

          shepe (形状) 配列は利用者からは読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: c59. *strides

          各次元において新しい値を得るためにスキップするバイト数を示す、
          長さ *note ndim: 5646. の *note Py_ssize_t: c59. の配列。

          ストライド値は、任意の整数を指定できます。規定の配列では、スト
          ライドは通常でいけば有効です。しかし利用者は、‘strides[n] <=
          0’ のケースを処理することができる必要があります。詳細について
          は *note complex arrays: 5648. を参照してください。

          消費者にとって、この strides 配列は読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: c59. *suboffsets

          *note Py_ssize_t: c59. 型の要素を持つ長さ *note ndim: 5646. の
          配列。 ‘suboffsets[n] >= 0’ の場合は、 n 番目の次元に沿って保
          存されている値はポインタで、 suboffset 値は各ポインタの参照を
          解決した後に何バイト加えればいいかを示しています。 suboffset の
          値が負の数の場合は、ポインタの参照解決は不要 (連続したメモリブ
          ロック内に直接配置されいる) ということになります。

          全ての suboffset が負数の場合 (つまり参照解決が不要) な場合、
          このフィールドは ‘NULL’ (デフォルト値) でなければなりません。

          この種の配列表現は Python Imaging Library (PIL) で使われていま
          す。 このような配列で要素にアクセスする方法についてさらに詳し
          ことは *note complex arrays: 5648. を参照してください。

          消費者にとって、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: 960. の全フィールドは、リクエストの種類によって曖昧さを
残さずに定義されます。

* 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: 5640, *note buf: 563e, *note len: 5641, *note itemsize:
5643, *note ndim: 5646.


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: 5642. 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: 52f6. | *note PyBUF_WRITABLE: 15d3. can be used
          to request a simple writable buffer.

      -- C のマクロ: PyBUF_WRITEABLE

          This is a *note soft deprecated: 23f. alias to *note
          PyBUF_WRITABLE: 15d3.

      -- C のマクロ: PyBUF_FORMAT
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より
          ).'  *note format: 5644. フィールドを制御します。もしフラグが
          設定されていれば、このフィールドを正しく埋めなければなりません
          。フラグが設定されていなければ、このフィールドを ‘NULL’ に設定
          しなければなりません。

*note PyBUF_WRITABLE: 15d3. は、次の節に出てくるどのフラグとも | を取っ
てかまいません。 *note PyBUF_SIMPLE: 52f6. は 0 と定義されているので、
‘PyBUF_WRITABLE’ は単純な書き込み可能なバッファを要求する単独のフラグと
して使えます。

*note PyBUF_FORMAT: 52ee. must be |'d to any of the flags except *note
PyBUF_SIMPLE: 52f6, 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 連続性:
1252. が明確に要求される可能性があります。 ストライド情報なしに、バッフ
ァーは 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: 52f3.                   yes         NULL          NULL             C
                                                                                   


File: python.info,  Node: 複合リクエスト,  Prev: 隣接性のリクエスト,  Up: バッファリクエストのタイプ

7.8.7.7 複合リクエスト
......................

有り得る全てのリクエストの値は、前の節でのフラグの組み合わせで網羅的に定
義されています。 便利なように、バッファープロトコルでは頻繁に使用される
組み合わせを単一のフラグとして提供してます。

次のテーブルの 'U' は連続性が未定義であることを表します。 利用者は *note
PyBuffer_IsContiguous(): 966. を呼び出して連続性を判定する必要があるでし
ょう。

リクエスト                          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: 5643, *note ndim:
5646, *note shape: 5645, *note strides: 563f. で定義されます。

‘ndim == 0’ の場合は、 *note buf: 563e. が指すメモリの場所は、サイズが
*note itemsize: 5643. のスカラ値として解釈されます。 この場合、 *note
shape: 5645. と *note strides: 563f. の両方とも ‘NULL’ です。

*note strides: 563f. が ‘NULL’ の場合は、配列は標準の n 次元 C 配列とし
て解釈されます。 そうでない場合は、利用者は次のように n 次元配列にアクセ
スしなければなりません:

     ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];
     item = *((typeof(item) *)ptr);

上記のように、 *note buf: 563e. はメモリブロック内のどの場所でも指すこと
が可能です。エクスポーターはこの関数を使用することによってバッファの妥当
性を確認出来ます。

     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: 563e. の先頭に埋め込め、メモリのどこにでも配置で
きる 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: 1806. を送出し、 ‘view->obj’ を ‘NULL’ に設
     定した上で、 ‘-1’ を返さなければなりません。

     成功したときは、 'view' を埋め、 ‘view->obj’ に 'exporter' への新し
     い参照を設定し、0を返します。チェイン状のバッファプロバイダがリクエ
     ストを単一のオブジェクトにリダイレクトするケースでは、 ‘view->obj’
     は 'exporter' の代わりにこのオブジェクトを参照します (*note
     バッファオブジェクト構造体: 124c. を参照してください)。

     ‘malloc()’ と ‘free()’ のように、呼び出しに成功した *note
     PyObject_GetBuffer(): 63a. と対になる *note PyBuffer_Release():
     63b. の呼び出しがなけれなればなりません。 従って、バッファの利用が
     済んだら ‘PyBuffer_Release()’ が厳密に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: c59. PyBuffer_SizeFromFormat (const char
          *format)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Return the implied *note itemsize: 5643. from *note format: 5644.
     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 連続: 1252. のと
     きか、そのいずれか ('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 より).'
     Copy contiguous 'len' bytes from 'buf' to 'view'.  'fort' can be
     ‘'C'’ or ‘'F'’ (for C-style or Fortran-style ordering).  ‘0’ is
     returned on success, ‘-1’ on error.

 -- 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 連続な: 1252. ('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:
     15d3. が設定されていない限り、常にフラグに指定された通りに 'view' を
     埋めます。

     On success, set ‘view->obj’ to a new reference to 'exporter' and
     return 0.  Otherwise, raise *note BufferError: 1806, set
     ‘view->obj’ to ‘NULL’ and return ‘-1’;

     この関数を *note getbufferproc: 124c. の一部として使う場合には、
     'exporter' はエクスポートするオブジェクトに設定しなければならず、さ
     らに 'flags' は変更せずに渡さなければなりません。 そうでない場合は
     、 'exporter' は ‘NULL’ でなければなりません。


File: python.info,  Node: 具象オブジェクト concrete object レイヤ,  Next: インタープリタの初期化と終了処理,  Prev: 抽象オブジェクトレイヤ Abstract Objects Layer,  Up: Python/C API reference manual

7.9 具象オブジェクト (concrete object) レイヤ
=============================================

この章では、特定の Python オブジェクト型固有の関数について述べています。
これらの関数に間違った型のオブジェクトを渡すのは良い考えではありません;
Python プログラムから何らかのオブジェクトを受け取ったとき、そのオブジェ
クトが正しい型になっているか確信をもてないのなら、まず型チェックを行わな
ければなりません; 例えば、あるオブジェクトが辞書型か調べるには、 *note
PyDict_Check(): 5658. を使います。この章は 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: ca0. PyType_Type
     ' 次に属します: *note Stable ABI: 775.'  型オブジェクト自身の型オブ
     ジェクトです。Python レイヤにおける *note type: f48. と同じオブジェ
     クトです。

 -- 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:
     1cce. 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 ‘tp_flags’ 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__: e5b.).
     This is a replacement for accessing *note tp_dict: 1aed. 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(): 1bda. 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(): 1bda. 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:
     5662.  This function is used by many ‘_Check’ functions for common
     types.

     参考
     ....

     *note PyObject_TypeCheck(): 1d10, 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: 985.

 -- 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__(): 2427. is not called on 'b'.  Call *note
     PyObject_IsSubclass(): 10ab. to do the same check that *note
     issubclass(): 9c8. 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: 5255. 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(): c64.
     or *note PyObject_InitVar(): 1d9e.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 5255. slot instead.

     For types that support garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 985. flag is set), this function behaves like
     *note PyObject_GC_New: c9d. or *note PyObject_GC_NewVar: c9e.
     (except the memory is guaranteed to be zeroed before
     initialization), and should be paired with *note PyObject_GC_Del():
     1721. in *note tp_free: 5254.  Otherwise, it behaves like *note
     PyObject_New: b80. or *note PyObject_NewVar: b81. (except the
     memory is guaranteed to be zeroed before initialization) and should
     be paired with *note PyObject_Free(): e64. in ‘tp_free’.

 -- 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: 5255. 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: 985. in its flags, then the GC protocol
          will be automatically implemented from its parents.  On the
          contrary, if the type being created does include
          ‘Py_TPFLAGS_HAVE_GC’ in its flags then it 'must' implement the
          GC protocol itself by at least implementing the *note
          tp_traverse: 986. 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__: 16c9. 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__: 23cf. 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__: 23cf. 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: 5664. for possible values of the 'slot'
     argument.

     Added in version 3.4.

     バージョン 3.10 で変更: *note PyType_GetSlot(): aa0. can now accept
     all types.  Previously, it was limited to *note heap types: b62.

 -- 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.

     The returned reference is *note borrowed: 3d5. 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.

     If no module is associated with the given type, sets *note
     TypeError: 199. 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: 96c. 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():
     b7b. on the result of *note PyType_GetModule(): b6a.

     If no module is associated with the given type, sets *note
     TypeError: 199. 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: b78. 'def', and return
     that module.

     If no module is found, raises a *note TypeError: 199. and returns
     ‘NULL’.

     This function is intended to be used together with *note
     PyModule_GetState(): b7b. to get module state from slot methods
     (such as *note tp_init: 7a1. or *note nb_add: 5665.) and other
     places where a method's defining class cannot be passed using the
     *note PyCMethod: 96c. calling convention.

     The returned reference is *note borrowed: 3d5. 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:
     263e. whose *note Py_tp_token: 3af. 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 弱参照オブジェクト: 5613.

        * *note weakref: 11b.

* 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:
b62.

 -- 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: b62. from the 'spec' (see
     *note Py_TPFLAGS_HEAPTYPE: ab0.).

     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: 5508. slot is used instead.  If that
     also is ‘NULL’, the *note Py_tp_base: 5507. slot is used instead.
     If that also is ‘NULL’, the new type derives from *note object:
     c82.

     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(): b6a.  The
     associated module is not inherited by subclasses; it must be
     specified for each class individually.

     This function calls *note PyType_Ready(): 984. on the new type.

     Note that this function does 'not' fully match the behavior of
     calling *note type(): f48. or using the *note class: 14f3.
     statement.  With user-provided base types or metaclasses, prefer
     *note calling: 5618. ‘type’ (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__(): 8c0. is not called on the new class.

        * *note __init_subclass__(): 843. is not called on any bases.

        * *note __set_name__(): e4c. 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: f48. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides ‘tp_new’ 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: f48. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides ‘tp_new’ 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: f48. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides ‘tp_new’ 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: 3cd.
     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:
          1d0b.

      -- C のメンバ変数: int basicsize

          If positive, specifies the size of the instance in bytes.  It
          is used to set *note PyTypeObject.tp_basicsize: b82.

          If zero, specifies that *note tp_basicsize: b82. 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: b82.'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: 241b.  See
          ‘tp_itemsize’ documentation for caveats.

          If zero, *note tp_itemsize: 241b. 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:
               241b.).

             - 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: 1cce.

          If the ‘Py_TPFLAGS_HEAPTYPE’ flag is not set, *note
          PyType_FromSpecWithBases(): 79e. sets it automatically.

      -- C のメンバ変数: *note PyType_Slot: 5461. *slots

          Array of *note PyType_Slot: 5461. 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: ca0, *note PyNumberMethods: 163c, *note
          PySequenceMethods: 5279, *note PyMappingMethods: 527a. and
          *note PyAsyncMethods: 566d. with an added ‘Py_’ prefix.  For
          example, use:

             * *note Py_tp_dealloc: 550b. to set *note
               PyTypeObject.tp_dealloc: 5241.

             * *note Py_nb_add: 54dc. to set *note
               PyNumberMethods.nb_add: 5665.

             * *note Py_sq_length: 5504. to set *note
               PySequenceMethods.sq_length: 566e.

          An additional slot is supported that does not correspond to a
          ‘PyTypeObject’ struct field:

             * *note Py_tp_token: 3af.

          The following “offset” fields cannot be set using *note
          PyType_Slot: 5461.:

             * *note tp_weaklistoffset: b83. (use *note
               Py_TPFLAGS_MANAGED_WEAKREF: 77c. instead if possible)

             * *note tp_dictoffset: 566f. (use *note
               Py_TPFLAGS_MANAGED_DICT: 60f. instead if possible)

             * *note tp_vectorcall_offset: 561a. (use
               ‘"__vectorcalloffset__"’ in *note PyMemberDef: 5670.)

          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: 551a.  See *note
          PyMemberDef documentation: 5670. for details.

          The following internal fields cannot be set at all when
          creating a heap type:

             * *note tp_dict: 1aed, *note tp_mro: 5671, *note tp_cache:
               5672, *note tp_subclasses: 792, and *note tp_weaklist:
               5673.

          Setting *note Py_tp_bases: 5508. or *note Py_tp_base: 5507.
          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: 5674. may
          be set in the unlimited API.

          バージョン 3.11 で変更: *note bf_getbuffer: 96a. and *note
          bf_releasebuffer: 96b. are now available under the *note
          limited API: 637.

          バージョン 3.14 で変更: The field *note tp_vectorcall: 19ea.
          can now be set using *note Py_tp_vectorcall: 5523.  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: 550f.

             * *note Py_tp_token: 3af. (for clarity, prefer *note
               Py_TP_USE_SPEC: 54be. rather than ‘NULL’)

 -- C のマクロ: Py_tp_token
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'  A
     *note slot: 5664. that records a static memory layout ID for a
     class.

     If the *note PyType_Spec: 1aea. of the class is statically
     allocated, the token can be set to the spec using the special value
     *note Py_TP_USE_SPEC: 54be.:

          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(): 3ae. 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(): aa0. 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: 3af. to set the
          token to the class's *note PyType_Spec: 1aea.  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: ca0. は、 Python/C API では直接公開
されていないので注意してください。 ‘None’ は単量子 (singleton) なので、
オブジェクトの同一性テスト (C では ‘==’) を使うだけで十分だからです。同
じ理由から、 ‘PyNone_Check()’ 関数はありません。

 -- C 変数: *note PyObject: 5df. *Py_None

     値の欠如を示す、 Python の ‘None’ オブジェクト。このオブジェクトは
     メソッドを持たず、 *note immortal: 292. です。

     バージョン 3.12 で変更: *note Py_None: 5223. は *note immortal:
     292. です。

 -- C のマクロ: Py_RETURN_NONE

     関数から *note Py_None: 5223. を返します。


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(): 1d0a. を使ってください。

 -- C のデータ型: type PyLongObject
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  こ
     の *note PyObject: 5df. のサブタイプは整数型を表現します。

 -- C 変数: *note PyTypeObject: ca0. PyLong_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは Python 整数型を表現します。これは Python レイ
     ヤにおける *note int: 19c. と同じオブジェクトです。

 -- C の関数: int PyLong_Check (PyObject *p)

     引数が *note PyLongObject: 39c. か ‘PyLongObject’ のサブタイプであ
     るときに真を返します。この関数は常に成功します。

 -- C の関数: int PyLong_CheckExact (PyObject *p)

     引数が *note PyLongObject: 39c. であるが ‘PyLongObject’ のサブタイ
     プでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     から新たな *note PyLongObject: 39c. オブジェクトを生成して返します
     。失敗のときには ‘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: 39c. オブジェクトを生
     成して返します。失敗した際には ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromSsize_t (Py_ssize_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     *note Py_ssize_t: c59. 型から新たな *note PyLongObject: 39c. オブジ
     ェクトを生成して返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromSize_t (size_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     ‘size_t’ 型から新たな *note PyLongObject: 39c. オブジェクトを生成し
     て返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromLongLong (long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     long long 型から新たな *note PyLongObject: 39c. オブジェクトを生成
     して返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromUnsignedLongLong
          (unsigned long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     unsigned long long 型から新たな *note PyLongObject: 39c. オブジェク
     トを生成して返します。失敗のときには ‘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: 39c. 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_FromUInt32 (uint32_t value)
 -- C の関数: *note PyObject: 5df. *PyLong_FromUInt64 (uint64_t value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Return a new *note PyLongObject: 39c. 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: 39c. オブジェクトを生成して
     返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromString (const char *str,
          char **pend, int base)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new *note PyLongObject: 39c. 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 整数リテラル: 2367. definition; in this case,
     leading zeros in a non-zero decimal number raises a *note
     ValueError: 2ee.  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, ‘ValueError’ will be raised.

     参考
     ....

     *note PyLong_AsNativeBytes(): 606. and *note
     PyLong_FromNativeBytes(): 607. functions can be used to convert a
     *note PyLongObject: 39c. 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(): 53d0. を適用した結果から取得されます。

 -- 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(): 1c2d.
     or *note PyLong_FromLongLong(): 1c2e, 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: 39c, first call its *note
     __index__(): 19f. method (if present) to convert it to a
     ‘PyLongObject’.

     もし 'obj' の値が long の範囲外であれば、 *note OverflowError: a85.
     を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1d0a. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

      -- C の関数: long PyLong_AS_LONG (PyObject *obj)

          Exactly equivalent to the preferred ‘PyLong_AsLong’.  In
          particular, it can fail with *note OverflowError: a85. or
          another exception.

          *note Soft deprecated: 23f. since version 3.14.

 -- 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: 39c, first call its *note __index__(): 19f. method
     (if present) to convert it to a ‘PyLongObject’.

     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(): 1d0a. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

 -- 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: 39c, first call its *note
     __index__(): 19f. method (if present) to convert it to a
     ‘PyLongObject’.

     もし 'obj' の値が long long の範囲外であれば、 *note OverflowError:
     a85. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1d0a. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

 -- 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: 39c, first call its *note __index__(): 19f. method
     (if present) to convert it to a ‘PyLongObject’.

     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(): 1d0a. を使ってください。

     Added in version 3.2.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

 -- C の関数: *note Py_ssize_t: c59. PyLong_AsSsize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の *note Py_ssize_t: c59. を返します。 'pylong' は
     *note PyLongObject: 39c. のインスタンスでなければなりません。

     もし 'pylong' の値が *note Py_ssize_t: c59. の範囲外であれば、
     *note OverflowError: a85. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1d0a. を使ってください。

 -- C の関数: unsigned long PyLong_AsUnsignedLong (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の unsigned long を返します。 'pylong' は *note
     PyLongObject: 39c. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long の範囲外であれば、 *note
     OverflowError: a85. を送出します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1d0a. を使ってください。

 -- C の関数: size_t PyLong_AsSize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の ‘size_t’ を返します。 'pylong' は *note
     PyLongObject: 39c. のインスタンスでなければなりません。

     もし 'pylong' の値が ‘size_t’ の範囲外であれば、 *note
     OverflowError: a85. を送出します。

     エラーが起きたときに ‘(size_t)-1’ を返します。 見分けを付けるために
     は *note PyErr_Occurred(): 1d0a. を使ってください。

 -- C の関数: unsigned long long PyLong_AsUnsignedLongLong (PyObject
          *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の unsigned long long を返します。 'pylong' は
     *note PyLongObject: 39c. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long long の範囲外であれば、 *note
     OverflowError: a85. を送出します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1d0a. を使ってください。

     バージョン 3.1 で変更: 負 'pylong' を指定した際に *note TypeError:
     199. ではなく、 *note OverflowError: a85. を送出するようになりまし
     た。

 -- 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: 39c, first call its *note __index__(): 19f. method
     (if present) to convert it to a ‘PyLongObject’.

     'obj' の値が unsigned long の範囲から外れていた場合は、 ‘ULONG_MAX
     + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1d0a. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

 -- 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: 39c, first call its *note __index__(): 19f. method
     (if present) to convert it to a ‘PyLongObject’.

     'obj' の値が unsigned long long の範囲から外れていた場合は、
     ‘ULLONG_MAX + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1d0a. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19e.

 -- 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: 39c, first call
     its *note __index__(): 19f. method (if present) to convert it to a
     ‘PyLongObject’.

     If the 'obj' value is out of range, raise an *note OverflowError:
     a85.

     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: 39c, first call
     its *note __index__(): 19f. method (if present) to convert it to a
     ‘PyLongObject’.

        * If 'obj' is negative, raise a *note ValueError: 2ee.

        * If the 'obj' value is out of range, raise an *note
          OverflowError: a85.

     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: 39c. のインスタ
     ンスでなければなりません。

     もし 'pylong' の値が double の範囲外であれば、 *note OverflowError:
     a85. を送出します。

     エラーが起きたときに ‘-1.0’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1d0a. を使ってください。

 -- C の関数: void *PyLong_AsVoidPtr (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'  Python の整数型を指す
     'pylong' を、 C の void ポインタに変換します。 'pylong' を変換でき
     なければ、 *note OverflowError: a85. を送出します。この関数は *note
     PyLong_FromVoidPtr(): 53d2. で値を生成するときに使うような void ポ
     インタ型を生成できるだけです。

     エラーが起きたときに ‘NULL’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1d0a. を使ってください。

 -- C の関数: *note Py_ssize_t: c59. 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__(): 19f. 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: 199.

          注釈: 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(): 1c2e, 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: 39c. 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: 39c. 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: 39c. 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: 39c. 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: 14af.
     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*: 53cc. 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: c59. 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(): 3a5. to get the native layout
     of Python *note int: 19c. objects, used internally for integers
     with "big enough" absolute value.

     See also *note sys.int_info: 14af. 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: 5684. *PyLong_GetNativeLayout
          (void)

     Get the native layout of Python *note int: 19c. objects.

     See the *note PyLongLayout: 5684. 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: 19c. object.

     There are two cases:

        * If *note digits: 568a. is ‘NULL’, only use the *note value:
          568b. member.

        * If *note digits: 568a. is not ‘NULL’, use *note negative:
          568c, *note ndigits: 568d. and ‘digits’ members.

      -- C のメンバ変数: int64_t value

          The native integer value of the exported *note int: 19c.
          object.  Only valid if *note digits: 568a. is ‘NULL’.

      -- C のメンバ変数: uint8_t negative

          ‘1’ if the number is negative, ‘0’ otherwise.  Only valid if
          *note digits: 568a. is not ‘NULL’.

      -- C のメンバ変数: *note Py_ssize_t: c59. ndigits

          Number of digits in *note digits: 568a. array.  Only valid if
          ‘digits’ 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: 19c. object.

     'export_long' must point to a *note PyLongExport: 5689. 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(): 3a7. must be called when the export is
     no longer needed.

          'CPython 実装の詳細:' This function always succeeds if 'obj'
          is a Python *note int: 19c. object or a subclass.

 -- C の関数: void PyLong_FreeExport (PyLongExport *export_long)

     Release the export 'export_long' created by *note PyLong_Export():
     3a6.

     'CPython 実装の詳細:' Calling *note PyLong_FreeExport(): 3a7. 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: 568f. API can be used to import an integer.

Added in version 3.14.

 -- C Struct: struct PyLongWriter

     A Python *note int: 19c. writer instance.

     The instance must be destroyed by *note PyLongWriter_Finish(): 3a9.
     or *note PyLongWriter_Discard(): 3aa.

 -- C の関数: *note PyLongWriter: 568f. *PyLongWriter_Create (int
          negative, Py_ssize_t ndigits, void **digits)

     Create a *note PyLongWriter: 568f.

     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(): 3a9. to get a Python *note int: 19c.  The
     layout of 'digits' is described by *note PyLong_GetNativeLayout():
     3a5.

     Digits must be in the range [‘0’; ‘(1 << bits_per_digit) - 1’]
     (where the *note bits_per_digit: 5685. is the number of bits per
     digit).  Any unused most significant digits must be set to ‘0’.

     Alternately, call *note PyLongWriter_Discard(): 3aa. to destroy the
     writer instance without creating an *note int: 19c. object.

 -- C の関数: *note PyObject: 5df. *PyLongWriter_Finish (PyLongWriter
          *writer)
     '戻り値: 新しい参照。' Finish a *note PyLongWriter: 568f. created
     by *note PyLongWriter_Create(): 3a8.

     On success, return a Python *note int: 19c. 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: 568f. created by *note
     PyLongWriter_Create(): 3a8.

     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: 23f.  They describe parameters
of the internal representation of *note PyLongObject: 39c. instances.

Use *note PyLong_GetNativeLayout(): 3a5. instead, along with *note
PyLong_Export(): 3a6. to read integer data or *note PyLongWriter: 568f.
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: 5685. in the output of
     *note PyLong_GetNativeLayout(): 3a5.

 -- C のマクロ: PyLong_BASE

     This is currently equivalent to 1 << *note PyLong_SHIFT: 5691.

 -- C のマクロ: PyLong_MASK

     This is currently equivalent to (1 << *note PyLong_SHIFT: 5691.) -
     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: 5697. と *note Py_True: 5698. の 2 つしかありません
。従って、通常の生成／削除関数はブール型にはあてはまりません。とはいえ、
以下のマクロが利用できます。

 -- C 変数: *note PyTypeObject: ca0. PyBool_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは Python の boolean 型を表現します; Python レイ
     ヤにおける *note bool: 3c1. と同じオブジェクトです。

 -- C の関数: int PyBool_Check (PyObject *o)

     'o' が *note PyBool_Type: 52fc. 型の場合に真を返します。この関数は
     常に成功します。

 -- C 変数: *note PyObject: 5df. *Py_False

     Python の ‘False’ オブジェクト。このオブジェクトはメソッドを持たず
     、 *note immortal: 292. です。

     バージョン 3.12 で変更: *note Py_False: 5697. は *note immortal:
     292. です。

 -- C 変数: *note PyObject: 5df. *Py_True

     Python の ‘True’ オブジェクト。このオブジェクトはメソッドを持たず、
     *note immortal: 292. です。

     バージョン 3.12 で変更: *note Py_True: 5698. は *note immortal:
     292. です。

 -- C のマクロ: Py_RETURN_FALSE

     関数から *note Py_False: 5697. を返します。

 -- C のマクロ: Py_RETURN_TRUE

     関数から *note Py_True: 5698. を返します。

 -- C の関数: *note PyObject: 5df. *PyBool_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     の真理値に応じて *note Py_True: 5698. または *note Py_False: 5697.
     を返します。


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: ca0. PyFloat_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: ca0. represents the Python floating-point type.  This
     is the same object as *note float: 197. in the Python layer.

 -- C の関数: int PyFloat_Check (PyObject *p)

     引数が *note PyFloatObject: 569e. か ‘PyFloatObject’ のサブタイプで
     あるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyFloat_CheckExact (PyObject *p)

     引数が *note PyFloatObject: 569e. であるが ‘PyFloatObject’ のサブタ
     イプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyFloat_FromString (PyObject *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'str' の文字列値をもとに *note PyFloatObject: 569e. オブジェクトを
     生成します。失敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyFloat_FromDouble (double v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     から *note PyFloatObject: 569e. オブジェクトを生成して返します。 失
     敗すると ‘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__(): bc5.
     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__(): 19f.  This method returns ‘-1.0’ upon failure,
     so one should call *note PyErr_Occurred(): 1d0a. to check for
     errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。

 -- 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: 23f.

 -- C のマクロ: Py_MATH_E

     The definition (accurate for a double type) of the *note math.e:
     2aff. constant.

 -- C のマクロ: Py_MATH_El

     High precision (long double) definition of *note e: 2aff. constant.

 -- C のマクロ: Py_MATH_PI

     The definition (accurate for a double type) of the *note math.pi:
     2afe. constant.

 -- C のマクロ: Py_MATH_PIl

     High precision (long double) definition of *note pi: 2afe.
     constant.

 -- C のマクロ: Py_MATH_TAU

     The definition (accurate for a double type) of the *note math.tau:
     2b00. constant.

     Added in version 3.6.

 -- C のマクロ: Py_RETURN_NAN

     Return *note math.nan: 874. from a function.

     On most platforms, this is equivalent to ‘return
     PyFloat_FromDouble(NAN)’.

 -- C のマクロ: Py_RETURN_INF (sign)

     Return *note math.inf: e82. or ‘-math.inf’ 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: 23f.
     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: 23f.
     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: 23f.
     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 NaN type may not be preserved on IEEE platforms (signaling
NaNs become quiet NaNs), 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’ and ‘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: a85.).

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(): 1d0a. is true (and an exception is set, most likely
*note OverflowError: a85.).

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's complex number objects are implemented as two distinct types
when viewed from the C API: one is the Python object exposed to Python
programs, and the other is a C structure which represents the actual
complex number value.  The API provides functions for working with both.

* Menu:

* C 構造体としての複素数::
* Complex Numbers as Python Objects::


File: python.info,  Node: C 構造体としての複素数,  Next: Complex Numbers as Python Objects,  Up: 複素数オブジェクト

7.9.2.11 C 構造体としての複素数
...............................

Note that the functions which accept these structures as parameters and
return them as results do so 'by value' rather than dereferencing them
through pointers.  This is consistent throughout the 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: 55c1. _Py_c_sum (Py_complex left,
          Py_complex right)

     二つの複素数の和を C の *note Py_complex: 55c1. 型で返します。

 -- C の関数: *note Py_complex: 55c1. _Py_c_diff (Py_complex left,
          Py_complex right)

     二つの複素数の差を C の *note Py_complex: 55c1. 型で返します。

 -- C の関数: *note Py_complex: 55c1. _Py_c_neg (Py_complex num)

     複素数 'num' の符号反転 C の *note Py_complex: 55c1. 型で返します。

 -- C の関数: *note Py_complex: 55c1. _Py_c_prod (Py_complex left,
          Py_complex right)

     二つの複素数の積を C の *note Py_complex: 55c1. 型で返します。

 -- C の関数: *note Py_complex: 55c1. _Py_c_quot (Py_complex dividend,
          Py_complex divisor)

     二つの複素数の商を C の *note Py_complex: 55c1. 型で返します。

     'divisor' が null の場合は、このメソッドはゼロを返し、 ‘errno’ に
     ‘EDOM’ をセットします。

 -- C の関数: *note Py_complex: 55c1. _Py_c_pow (Py_complex num,
          Py_complex exp)

     指数 'exp' の 'num' 乗を C の *note Py_complex: 55c1. 型で返します
     。

     'num' が null で 'exp' が正の実数でない場合は、このメソッドはゼロを
     返し、 ‘errno’ に ‘EDOM’ をセットします。

     Set ‘errno’ to ‘ERANGE’ on overflows.


File: python.info,  Node: Complex Numbers as Python Objects,  Prev: C 構造体としての複素数,  Up: 複素数オブジェクト

7.9.2.12 Complex Numbers as Python Objects
..........................................

 -- C のデータ型: type PyComplexObject

     この *note PyObject: 5df. のサブタイプは Python の複素数型を表現し
     ます。

 -- C 変数: *note PyTypeObject: ca0. PyComplex_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは Python の複素数型を表現します。 Pythonレイヤ
     の *note complex: 198. と同じオブジェクトです。

 -- C の関数: int PyComplex_Check (PyObject *p)

     引数が *note PyComplexObject: 56be. か ‘PyComplexObject’ のサブタイ
     プであるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyComplex_CheckExact (PyObject *p)

     引数が *note PyComplexObject: 56be. であるが ‘PyComplexObject’ のサ
     ブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyComplex_FromCComplex (Py_complex
          v)
     '戻り値: 新しい参照。' Create a new Python complex number object
     from a C *note Py_complex: 55c1. 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: 56be. 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():
     c63. and returns its result.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1d0a. 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():
     c63. and returns ‘0.0’ on success.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1d0a. to check for errors.

     バージョン 3.13 で変更: Use *note __complex__(): 7fd. if available.

 -- C の関数: *note Py_complex: 55c1. PyComplex_AsCComplex (PyObject
          *op)

     複素数値 'op' から *note Py_complex: 55c1. 型を生成します。

     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__(): bc5.  If
     ‘__float__()’ is not defined then it falls back to *note
     __index__(): 19f.

     Upon failure, this method returns *note Py_complex: 55c1. with
     *note real: 56b6. set to ‘-1.0’ and with an exception set, so one
     should call *note PyErr_Occurred(): 1d0a. to check for errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19f. を使う
     ようになりました。


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: 199. を送出しま
す。

 -- C のデータ型: type PyBytesObject

     この *note PyObject: 5df. のサブタイプは、Python バイトオブジェクト
     を表します。

 -- C 変数: *note PyTypeObject: ca0. PyBytes_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは、Python バイト型を表します; Pythonレイヤの
     *note bytes: 193. と同じオブジェクトです。

 -- 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.''
     Thread safety: *note Atomic: 2786.'  成功時に、文字列 'v' のコピー
     を値とする新しいバイトオブジェクトを返し、失敗時に ‘NULL’ を返しま
     す。 引数 'v' は ‘NULL’ であってはなりません; そのチェックは行われ
     ません。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromStringAndSize (const
          char *v, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  成功時に、文字列 'v' のコピー
     を値とする長さ 'len' の新しいバイトオブジェクトを返し、失敗時に
     ‘NULL’ を返します。 引数 'v' が ‘NULL’ の場合、バイトオブジェクトの
     中身は初期化されていません。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromFormat (const char
          *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  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: c59.‘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.''
     Thread safety: *note Atomic: 2786.'  ちょうど２つの引数を取ることを
     除いて、 *note PyBytes_FromFormat(): 1e68. と同じです。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromObject (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  バッファプロトコルを実装するオブジェクト 'o' のバイト表現を
     返します。

          注釈: If the object implements the buffer protocol, then the
          buffer must not be mutated while the bytes object is being
          created.

 -- C の関数: *note Py_ssize_t: c59. PyBytes_Size (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  バイトオブジェクト 'o' のバイト単位の長さを返します
     。

 -- C の関数: *note Py_ssize_t: c59. PyBytes_GET_SIZE (PyObject *o)
     ' Thread safety: *note Atomic: 2786.'  *note PyBytes_Size(): 530c.
     に似ていますが、エラーチェックを行いません。

 -- C の関数: char *PyBytes_AsString (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     277a.'  'o' の中身へのポインタを返します。 ポインタは、 ‘len(o) +
     1’ バイトからなる 'o' の内部バッファを参照します。 他に null のバイ
     トがあるかどうかにかかわらず、バッファの最後のバイトは必ず null に
     なります。 ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合
     を除いて、データを修正してはなりません。 またポインタを解放（
     deallocated）してはなりません。 もし、 'o' が bytes オブジェクトで
     なければ、 *note PyBytes_AsString(): a8b. は ‘NULL’ を返し *note
     TypeError: 199. を送出します。

 -- C の関数: char *PyBytes_AS_STRING (PyObject *string)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  *note PyBytes_AsString():
     a8b. に似ていますが、エラーチェックを行いません。

 -- C の関数: int PyBytes_AsStringAndSize (PyObject *obj, char **buffer,
          Py_ssize_t *length)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     277a.'  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: 2ee. を送出します。

     buffer は 'obj' の内部バッファを参照していて、これには末尾の null バ
     イトも含んでいます (これは 'length' には数えられません)。 オブジェ
     クトが ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合を除
     いて、何があってもデータを改変してはいけません。 オブジェクトを解放
     (deallocate) してもいけません。 'obj' が bytes オブジェクトでなかっ
     た場合は、 *note PyBytes_AsStringAndSize(): 5304. は ‘-1’ を返し
     *note TypeError: 199. を送出します。

     バージョン 3.5 で変更: 以前は bytes オブジェクトにヌルバイトが埋め
     込まれていたときに *note TypeError: 199. を送出していました。

 -- C の関数: void PyBytes_Concat (PyObject **bytes, PyObject *newpart)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  'newpart' の内容を
     'bytes' の後ろに連結した新しいバイトオブジェクトを '*bytes' に生成
     します。呼び出し側は新しい参照を所有します。 'bytes' の古い値の参照
     は盗まれます。 もし新しいオブジェクトが生成できない場合、古い
     'bytes' の参照は放棄され、 '*bytes' の値は ‘NULL’ に設定されます; 適
     切な例外が設定されます。

          注釈: If 'newpart' implements the buffer protocol, then the
          buffer must not be mutated while the new bytes object is being
          created.

 -- C の関数: void PyBytes_ConcatAndDel (PyObject **bytes, PyObject
          *newpart)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  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).

          注釈: If 'newpart' implements the buffer protocol, then the
          buffer must not be mutated while the new bytes object is being
          created.

 -- C の関数: *note PyObject: 5df. *PyBytes_Join (PyObject *sep,
          PyObject *iterable)
     ' Thread safety: *note Safe for concurrent use on the same object:
     2781.'  Similar to ‘sep.join(iterable)’ in Python.

     'sep' must be Python *note bytes: 193. object.  (Note that *note
     PyUnicode_Join(): 13be. accepts ‘NULL’ separator and treats it as a
     space, whereas *note PyBytes_Join(): 381. doesn't accept ‘NULL’
     separator.)

     'iterable' must be an iterable object yielding objects that
     implement the *note buffer protocol: 262.

     On success, return a new *note bytes: 193. object.  On error, set
     an exception and return ‘NULL’.

     Added in version 3.14.

          注釈: If 'iterable' objects implement the buffer protocol,
          then the buffers must not be mutated while the new bytes
          object is being created.

 -- C の関数: int _PyBytes_Resize (PyObject **bytes, Py_ssize_t newsize)
     ' Thread safety: *note Safe to call without external
     synchronization on distinct objects: 277f.'  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: 1772. is set, and ‘-1’ is returned.

 -- C の関数: *note PyObject: 5df. *PyBytes_Repr (PyObject *bytes, int
          smartquotes)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  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: 16a. 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.''  Thread safety: *note
     Atomic: 2786.'  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: 193. 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: ca0. PyByteArray_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは、 Python bytearray 型を示します。 Python レイ
     ヤでの *note bytearray: 342. と同じオブジェクトです。

* 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.''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  *note buffer protocol: 262. を実装した任意のオブジェクト
     'o' から、新しいbytearrayオブジェクトを作成し、返します。

     On failure, return ‘NULL’ with an exception set.

          注釈: If the object implements the buffer protocol, then the
          buffer must not be mutated while the bytearray object is being
          created.

 -- C の関数: *note PyObject: 5df. *PyByteArray_FromStringAndSize (const
          char *string, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  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.''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  bytearray 'a' と 'b' を連結した結果を新しい bytearray とし
     て返します。

     On failure, return ‘NULL’ with an exception set.

          注釈: If the object implements the buffer protocol, then the
          buffer must not be mutated while the bytearray object is being
          created.

 -- C の関数: *note Py_ssize_t: c59. PyByteArray_Size (PyObject
          *bytearray)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  ‘NULL’ ポインタチェックの後に 'bytearray' のサイズ
     を返します。

 -- C の関数: char *PyByteArray_AsString (PyObject *bytearray)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     277a.'  ‘NULL’ ポインタチェックの後に 'bytearray' の内容を char 配
     列として返します。 返される配列には、常に余分な null バイトが追加さ
     れます。

          注釈: It is not thread-safe to mutate the bytearray object
          while using the returned char array.

 -- 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)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  *note
     PyByteArray_AsString(): 52fe. に似ていますが、エラーチェックを行い
     ません。

          注釈: It is not thread-safe to mutate the bytearray object
          while using the returned char array.

 -- C の関数: *note Py_ssize_t: c59. PyByteArray_GET_SIZE (PyObject
          *bytearray)
     ' Thread safety: *note Atomic: 2786.'  *note PyByteArray_Size():
     5301. に似ていますが、エラーチェックを行いません。


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: 3de. 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: ca0. PyUnicode_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: ca0. represents the Python Unicode type.  It is
     exposed to Python code as *note str: 16a.

 -- C 変数: *note PyTypeObject: ca0. PyUnicodeIter_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: ca0. 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: 33b. を用いてください。

     Added in version 3.3.

 -- C のデータ型: type PyASCIIObject
 -- C のデータ型: type PyCompactUnicodeObject
 -- C のデータ型: type PyUnicodeObject

     これらの *note PyObject: 5df. のサブタイプは Python Unicode オブジ
     ェクトを表現します。 Unicode オブジェクトを扱う全ての API 関数は
     ‘PyObject’ へのポインタを受け取って 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: 1392.
          structure.

          Added in version 3.3.

      -- C のマクロ: PyUnicode_IS_COMPACT_ASCII (o)

          True if 'o' uses the *note PyASCIIObject: 1391. 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: c59. PyUnicode_GET_LENGTH (PyObject
          *unicode)

     Unicode 文字列のコードポイントでの長さを返します。 'unicode' は "正
     統な" 表現形式の Unicode オブジェクトでなければなりません (ただしチ
     ェックはしません)。

     Added in version 3.3.

 -- C の関数: *note Py_UCS1: 138f. *PyUnicode_1BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS2: 1390. *PyUnicode_2BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS4: 33b. *PyUnicode_4BYTE_DATA (PyObject
          *unicode)

     文字に直接アクセスするために、 UCS1, UCS2, UCS4 のいずれかの整数型
     にキャストされた正統な表現形式へのポインタを返します。 正統な表現が
     適正な文字サイズになっているかどうかのチェックはしません; *note
     PyUnicode_KIND(): 1399. を使って正しい関数を選んでください。

     Added in version 3.3.

 -- C のマクロ: PyUnicode_1BYTE_KIND
 -- C のマクロ: PyUnicode_2BYTE_KIND
 -- C のマクロ: PyUnicode_4BYTE_KIND

     *note PyUnicode_KIND(): 1399. マクロの返り値です。

     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(): 1399. and *note
     PyUnicode_DATA(): 1395. respectively.  You must hold a reference to
     that string while calling ‘PyUnicode_WRITE()’.  All requirements of
     *note PyUnicode_WriteChar(): 138e. 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: 33b. PyUnicode_READ (int kind, void *data,
          Py_ssize_t index)

     正統な表現形式となっている (*note PyUnicode_DATA(): 1395. で取得し
     た) 'data' からコードポイントを読み取ります。 チェックや事前確認の
     マクロ呼び出しは一切行われません。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33b. PyUnicode_READ_CHAR (PyObject
          *unicode, Py_ssize_t index)

     Unicode オブジェクト 'unicode' から文字を読み取ります。 この
     Unicode オブジェクトは "正統な" 表現形式でなければなりません。 何度
     も連続して読み取る場合には、このマクロは *note PyUnicode_READ():
     139d. よりも非効率的です。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33b. 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): 22fc. 節の言語定義における有効な識別子
     であれば ‘1’ を返します。それ以外の場合は ‘0’ を返します。

     バージョン 3.9 で変更: The function does not call *note
     Py_FatalError(): b7e. 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(): ced.

     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(): fdc.

以下の API は、高速に直接文字変換を行うために使われます:

 -- C の関数: *note Py_UCS4: 33b. Py_UNICODE_TOLOWER (Py_UCS4 ch)

     'ch' を小文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 33b. Py_UNICODE_TOUPPER (Py_UCS4 ch)

     'ch' を大文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 33b. 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: 33b. 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: 33b. 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: 33b. Py_UNICODE_JOIN_SURROGATES (Py_UCS4
          high, Py_UCS4 low)

     Join two surrogate code points and return a single *note Py_UCS4:
     33b. 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(): 138e, *note PyUnicode_CopyCharacters(): ab6,
     *note PyUnicode_Fill(): 13a9, *note PyUnicode_WRITE(): 139f. 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: a9d, 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: 3b1. 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: 139a. などの *note PyUnicode_KIND(): 1399. が
     返す値です) の 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: 139c.) and it consists only of
     codepoints in the UCS1 range, it will be transformed into UCS1
     (*note PyUnicode_1BYTE_KIND: 139a.).

     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(): 1604. の戻り値。
                                                                                 
                                                                                 
     ‘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(): 1235. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘R’                                   *note PyObject: 5df.*                 *note PyObject_Repr(): 1234. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘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: ca0.*             Get the fully qualified name of a
                                                                                 type; call
                                                                                 *note PyType_GetFullyQualifiedName(): 616.
                                                                                 
                                                                                 
     ‘#N’                                  *note PyTypeObject: ca0.*             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:
     199. が引き起こされます。

 -- 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: 2ee.
     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: 193. や *note bytearray: 342. や他の *note bytes-like
     objects: 194. は、与えられた 'encoding' に従ってデコードされ、
     'errors' で定義されたエラーハンドリングが使われます。 これらの引数
     は両方とも ‘NULL’ にでき、その場合この API はデフォルト値を使います
     (詳しことは *note 組み込み codec (built-in codec): 56f8. を参照して
     ください)。

     その他のUnicodeオブジェクトを含むオブジェクトは *note TypeError:
     199. 例外を引き起こします。

     この 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(): 5479, 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: 199. 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(): 4c9b.

     The returned string does not need to be freed, and is valid until
     interpreter shutdown.

 -- C の関数: *note Py_ssize_t: c59. 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: c59. 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(): aad. 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: c59. 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(): aad. for details.

     Return the number of written characters, or return ‘-1’ and raise
     an exception on error.

     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(): 139f. for a version that
     skips these checks, making them your responsibility.

     The string must not have been “used” yet.  See *note
     PyUnicode_New(): aad. for details.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33b. PyUnicode_ReadChar (PyObject *unicode,
          Py_ssize_t index)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  文
     字列から文字を読み取ります。 エラーチェックを行わない *note
     PyUnicode_READ_CHAR(): 139e. とは対照的に、この関数は '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: 33b. *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: 33b. *PyUnicode_AsUCS4Copy (PyObject
          *unicode)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  文
     字列 'unicode' を *note PyMem_Malloc(): e63. でメモリ確保された新し
     い UCS4 型のバッファにコピーします。 これが失敗した場合は、 ‘NULL’
     を返し *note MemoryError: 1772. をセットします。 返されたバッファは
     必ず 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(): 5484. to decode a
     string from the *note filesystem encoding and error handler: 75d.

     This function ignores the *note Python UTF-8 Mode: 867.

     参考
     ....

     *note Py_DecodeLocale(): dc4. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_DecodeLocale(): dc4. が
     ‘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(): dc6, 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: 193. object.  'unicode' cannot
     contain embedded null characters.

     Use *note PyUnicode_EncodeFSDefault(): 1e8d. to encode a string to
     the *note filesystem encoding and error handler: 75d.

     This function ignores the *note Python UTF-8 Mode: 867.

     参考
     ....

     *note Py_EncodeLocale(): dc5. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_EncodeLocale(): dc5. が
     ‘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: 193. 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: 3d3.: encode *note str: 16a. objects - obtained directly
     or through the *note os.PathLike: e4f. interface - to *note bytes:
     193. using *note PyUnicode_EncodeFSDefault(): 1e8d.; ‘bytes’
     objects are output as-is.  'result' must be an address of a C
     variable of type *note PyObject: 5df.* (or *note PyBytesObject:
     999.*).  On success, set the variable to a new *note strong
     reference: 5e2. to a *note bytes object: 56c6. which must be
     released when it is no longer used and return a non-zero value
     (*note Py_CLEANUP_SUPPORTED: 55c4.).  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: 16a. 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: 3d3.: decode *note bytes: 193. objects - obtained either
     directly or indirectly through the *note os.PathLike: e4f.
     interface - to *note str: 16a. using *note
     PyUnicode_DecodeFSDefaultAndSize(): 5484.; ‘str’ objects are output
     as-is.  'result' must be an address of a C variable of type *note
     PyObject: 5df.* (or *note PyUnicodeObject: 99b.*).  On success, set
     the variable to a new *note strong reference: 5e2. to a *note
     Unicode object: 56d8. which must be released when it is no longer
     used and return a non-zero value (*note Py_CLEANUP_SUPPORTED:
     55c4.).  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(): dc6.

     参考
     ....

     *note Py_DecodeLocale(): dc4. 関数。

     バージョン 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(): 5484.

     バージョン 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: 193.  Note that the resulting
     ‘bytes’ object can contain null bytes.

     If you need to encode a string to the current locale encoding, use
     *note PyUnicode_EncodeLocale(): dc7.

     参考
     ....

     *note Py_EncodeLocale(): dc5. 関数。

     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: c59. 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: 2ee. is raised.

     Returns a buffer allocated by *note PyMem_New: 1742. (use *note
     PyMem_Free(): 1660. to free it) on success.  On error, returns
     ‘NULL’ and '*size' is undefined.  Raises a *note MemoryError: 1772.
     if memory allocation is failed.

     Added in version 3.2.

     バージョン 3.7 で変更: Raises a *note ValueError: 2ee. 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(): 16a. における同名のパラメータと同じ意味を持ちます。

Setting encoding to ‘NULL’ causes the default encoding to be used which
is UTF-8.  The file system calls should use *note
PyUnicode_FSConverter(): f19. for encoding file names.  This uses the
*note filesystem encoding and error handler: 75d. internally.

'errors' で指定するエラー処理もまた、 ‘NULL’ を指定できます。 ‘NULL’ を
指定すると、codec で定義されているデフォルト処理の使用を意味します。全て
の組み込み codec で、デフォルトのエラー処理は "strict" (*note
ValueError: 2ee. を送出する) になっています。

個々の 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(): 16a. 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(): ad6. メソッドに与える同名のパラメータと同じ意味を持
     ちます。 使用する 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(): 5490. と
     同じように動作します。 '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 で変更: The return type is now ‘const char *’ rather
     than ‘char *’.

     バージョン 3.10 で変更: This function is a part of the *note
     limited API: 637.

 -- C の関数: const char *PyUnicode_AsUTF8 (PyObject *unicode)

     *note PyUnicode_AsUTF8AndSize(): a9d. とほぼ同じですが、サイズを格
     納しません。

          警告: 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(): a9d.
          instead.

     Added in version 3.3.

     バージョン 3.7 で変更: The return type is now ‘const char *’ rather
     than ‘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(): 548c.
     と同じように振る舞います。 'consumed' が ‘NULL’ でないとき、 *note
     PyUnicode_DecodeUTF32Stateful(): 548d. は末尾の不完全な (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(): 548a.
     と同じように動作します。 'consumed' が ‘NULL’ でない場合、 *note
     PyUnicode_DecodeUTF16Stateful(): 548b. は末尾の不完全な 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(): 548e. と
     同じように動作します。 '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: 2445, 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: 2445.) 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: 2445.)
     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(): 5487. と同じ動作をします。 'consumed'
     が ‘NULL’ でないとき、 *note PyUnicode_DecodeMBCSStateful(): 5488.
     は文字列の最後にあるマルチバイト文字の前半バイトをデコードせず、
     '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(): 5488, 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(): 10ae.

 -- C の関数: *note PyObject: 5df. *PyUnicode_RSplit (PyObject *unicode,
          PyObject *sep, Py_ssize_t maxsplit)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyUnicode_Split(): 549d, 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(): 1471.

 -- 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(): 10af.

 -- C の関数: *note PyObject: 5df. *PyUnicode_RPartition (PyObject
          *unicode, PyObject *sep)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyUnicode_Partition(): 18fb, 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(): 1474.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Join (PyObject *separator,
          PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  指定
     した 'separator' で文字列からなるシーケンスを連結 (join) し、連結結
     果を Unicode 文字列で返します。

 -- C の関数: *note Py_ssize_t: c59. 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: c59. 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: c59. 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: c59. 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(): 1d0a. を呼び出して、エラーをチェックすべきです。

     参考
     ....

     The *note PyUnicode_Equal(): 3b0. 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: 199. exception and return ‘-1’ if 'a'
          or 'b' is not a *note str: 16a. object.

     The function always succeeds if 'a' and 'b' are *note str: 16a.
     objects.

     The function works for *note str: 16a. subclasses, but does not
     honor custom ‘__eq__()’ method.

     参考
     ....

     The *note PyUnicode_Compare(): ab8. 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: 5698. もしくは *note Py_False: 5697. を、正しく
          比較できた時に返します。

        * *note Py_NotImplemented: 560a. in case the type combination is
          unknown

     Possible values for 'op' are *note Py_GT: 5611, *note Py_GE: 5612,
     *note Py_EQ: 560f, *note Py_NE: 5610, *note Py_LT: 560d, and *note
     Py_LE: 560e.

 -- 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: ab2. 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
     *p_unicode, it sets *p_unicode 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 *p_unicode
     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: 16a. may not be interned,
     that is, *note PyUnicode_CheckExact: 56de.(**note p_unicode: ab2.)
     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(): 5497. and *note
     PyUnicode_InternInPlace(): ab2, 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: 292, 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(): 5497. and *note PyUnicode_InternInPlace():
     ab2. 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: 3b1. API can be used to create a Python *note
str: 16a. object.

Added in version 3.14.

 -- C のデータ型: type PyUnicodeWriter

     A Unicode writer instance.

     The instance must be destroyed by *note PyUnicodeWriter_Finish():
     3b5. on success, or *note PyUnicodeWriter_Discard(): 3b4. on error.

 -- C の関数: *note PyUnicodeWriter: 3b1. *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: 16a. 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(): 3b3.

 -- 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’.

 -- 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(): 1235. on 'obj' and write the output into
     'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

     To write a *note str: 16a. subclass which overrides the *note
     __str__(): 830. method, *note PyUnicode_FromObject(): 5495. can be
     used to get the original string.

 -- C の関数: int PyUnicodeWriter_WriteRepr (PyUnicodeWriter *writer,
          PyObject *obj)

     Call *note PyObject_Repr(): 1234. on 'obj' and write the output
     into 'writer'.

     If 'obj' is ‘NULL’, write the string ‘"<NULL>"’ into 'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

     バージョン 3.14.4 で変更: Added support for ‘NULL’.

 -- 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: 16a. 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: 1bce. 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(): 3bd.


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ビットのどちらかの型になっていました。

     バージョン 3.13 で非推奨、バージョン 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(): 432. 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: ca0. PyTuple_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは 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: c59. 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: c59. PyTuple_GET_SIZE (PyObject *p)

     Like *note PyTuple_Size(): 545d, 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: 1753. 例外をセットします。

     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(...)): a9e. or *note
     PySequence_GetItem(): 1e90.

 -- C の関数: *note PyObject: 5df. *PyTuple_GET_ITEM (PyObject *p,
          Py_ssize_t pos)
     '戻り値: 借用参照。' *note PyTuple_GetItem(): 523c. に似ていますが
     、引数に対するエラーチェックを行いません。

 -- 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.'  Insert a reference to
     object 'o' at position 'pos' of the tuple pointed to by 'p'.
     Return ‘0’ on success.  If 'pos' is out of bounds, return ‘-1’ and
     set an *note IndexError: 1753. exception.

          注釈: この関数は 'o' への参照を "盗み取り" ます。また、変更先
          のインデクスにすでに別の要素が入っている場合、その要素に対する
          参照を放棄します。

 -- C の関数: void PyTuple_SET_ITEM (PyObject *p, Py_ssize_t pos,
          PyObject *o)

     Like *note PyTuple_SetItem(): 523d, but does no error checking, and
     should 'only' be used to fill in brand new tuples.

     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(): 523d. と違って、要素の置き換えが生じても置
          き換えられるオブジェクトへの参照を放棄 'しません' ; その結果、
          タプル中の位置 '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: 1772. または *note SystemError: 795. を送出します。


File: python.info,  Node: Struct Sequence オブジェクト,  Next: リストオブジェクト,  Prev: タプルオブジェクト tuple object,  Up: シーケンスオブジェクト sequence object

7.9.3.30 Struct Sequence オブジェクト
.....................................

Struct sequence objects are the C equivalent of *note namedtuple(): 4e0.
objects, i.e.  a sequence whose items can also be accessed through
attributes.  To create a struct sequence, you first have to create a
specific struct sequence type.

 -- C の関数: *note PyTypeObject: ca0. *PyStructSequence_NewType
          (PyStructSequence_Desc *desc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  後述
     の 'desc' 中のデータから新しい struct sequence 型を生成します。返さ
     れる型のインスタンスは *note PyStructSequence_New(): 543d. で生成で
     きます。

     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(): 1208, 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: db7. *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: 571a. array of the *note
     PyStructSequence_Desc: db8. 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: b7d. 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(): 543e. によって事前に生成していなければ
     なりません。

     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():
     543c.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_GetItem(): 543c.

 -- 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(): 543f.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_SetItem(): 543f.


File: python.info,  Node: リストオブジェクト,  Prev: Struct Sequence オブジェクト,  Up: シーケンスオブジェクト sequence object

7.9.3.31 リストオブジェクト
...........................

 -- C のデータ型: type PyListObject

     この *note PyObject: 5df. のサブタイプは Python のリストオブジェク
     トを表現します。

 -- C 変数: *note PyTypeObject: ca0. PyList_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは Python のリスト型を表現します。これは Python
     レイヤにおける *note list: 24f. と同じオブジェクトです。

 -- C の関数: int PyList_Check (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  'p' がリストオブジェクトかリ
     スト型のサブタイプのインスタンスである場合に真を返します。この関数
     は常に成功します。

 -- C の関数: int PyList_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  'p' がリストオブジェクトだが
     リスト型のサブタイプのインスタンスでない場合に真を返します。この関
     数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyList_New (Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  サイズが '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():
          1e91. or expose the object to Python code before setting all
          items to a real object with *note PyList_SetItem(): 191c. or
          *note PyList_SET_ITEM(): 62f.  The following APIs are safe
          APIs before the list is fully initialized: ‘PyList_SetItem()’
          and ‘PyList_SET_ITEM()’.

 -- C の関数: *note Py_ssize_t: c59. PyList_Size (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'

     リストオブジェクト 'list' の長さを返します; リストオブジェクトにお
     ける ‘len(list)’ と同じです。

 -- C の関数: *note Py_ssize_t: c59. PyList_GET_SIZE (PyObject *list)
     ' Thread safety: *note Atomic: 2786.'  *note PyList_Size(): 1638. に
     似ていますが、エラーチェックを行いません。

 -- C の関数: *note PyObject: 5df. *PyList_GetItemRef (PyObject *list,
          Py_ssize_t index)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).''  Thread safety: *note Atomic: 2786.'  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: 1753.
     exception.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyList_GetItem (PyObject *list,
          Py_ssize_t index)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  Like *note
     PyList_GetItemRef(): 5fe, but returns a *note borrowed reference:
     3d5. instead of a *note strong reference: 5e2.

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the list concurrently.  Prefer *note
          PyList_GetItemRef(): 5fe, which returns a *note strong
          reference: 5e2.

 -- C の関数: *note PyObject: 5df. *PyList_GET_ITEM (PyObject *list,
          Py_ssize_t i)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 277a.'  *note
     PyList_GetItem(): 5ff. に似ていますが、エラーチェックを行いません。

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the list concurrently.  Prefer *note
          PyList_GetItemRef(): 5fe, which returns a *note strong
          reference: 5e2.

 -- C の関数: int PyList_SetItem (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  リストオブジェクト内の位置 'index' に、オブジェクト
     'item' を挿入します。 成功した場合には ‘0’ を返します。 'index' が
     範囲を越えている場合、 ‘-1’ を返して *note IndexError: 1753. をセッ
     トします。

          注釈: この関数は 'item' への参照を "盗み取り" ます。また、変更
          先のインデクスにすでに別の要素が入っている場合、その要素に対す
          る参照を放棄します。

 -- C の関数: void PyList_SET_ITEM (PyObject *list, Py_ssize_t i,
          PyObject *o)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  *note PyList_SetItem():
     191c. をマクロによる実装で、エラーチェックを行いません。このマクロ
     は、新たなリストのまだ要素を入れたことのない位置に要素を入れるとき
     にのみ使います。

     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(): 191c. と違って、要素の置き換えが生じて
          も置き換えられるオブジェクトへの参照を放棄 'しません' ; その結
          果、 'list' 中の位置 'i' で参照されていたオブジェクトがメモリ
          リークを引き起こします。

          注釈: In the *note free-threaded build: 17b0, this macro has
          no internal synchronization.  It is normally only used to fill
          in new lists where no other thread has a reference to the
          list.  If the list may be shared, use *note PyList_SetItem():
          191c. instead, which uses a *note per-object lock: 2782.

 -- C の関数: int PyList_Insert (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  要素 'item' をリスト
     'list' のインデックス 'index' の前に挿入します。成功すると ‘0’ を返
     します。失敗すると ‘-1’ を返し、例外をセットします。
     ‘list.insert(index, item)’ に類似した機能です。

 -- C の関数: int PyList_Append (PyObject *list, PyObject *item)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  オブジェクト '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.''
     Thread safety: *note Atomic: 2786.'  '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.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  'low' から 'high' ま
     での 'list' のスライスを、 'itemlist' の内容にします。
     ‘list[low:high] = itemlist’ と類似の機能です。 'itemlist' は ‘NULL’
     でもよく、空リストの代入 (指定スライスの削除) になります。 成功した
     場合には ‘0’ を、失敗した場合には ‘-1’ を返します。 ただし、リスト
     の末尾からのインデックスはサポートされていません。

          注釈: In the *note free-threaded build: 17b0, when 'itemlist'
          is a *note list: 24f, both 'list' and 'itemlist' are locked
          for the duration of the operation.  For other iterables (or
          ‘NULL’), only 'list' is locked.

 -- C の関数: int PyList_Extend (PyObject *list, PyObject *iterable)
     ' Thread safety: *note Safe for concurrent use on the same object:
     2781.'  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:
     24f. object.  Return 0 on success.

     Added in version 3.13.

          注釈: In the *note free-threaded build: 17b0, when 'iterable'
          is a *note list: 24f, *note set: 185, *note dict: 184, or dict
          view, both 'list' and 'iterable' (or its underlying dict) are
          locked for the duration of the operation.  For other
          iterables, only 'list' is locked; 'iterable' may be
          concurrently modified by another thread.

 -- C の関数: int PyList_Clear (PyObject *list)
     ' Thread safety: *note Atomic: 2786.'  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:
     24f. object.  Return 0 on success.

     Added in version 3.13.

 -- C の関数: int PyList_Sort (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  'list' の内容をイン
     プレースでソートします。成功した場合には ‘0’ を、失敗した場合には
     ‘-1’ を返します。‘list.sort()’ と同じです。

          注釈: In the *note free-threaded build: 17b0, element
          comparison via *note __lt__(): 14bc. can execute arbitrary
          Python code, during which the *note per-object lock: 2782. may
          be temporarily released.  For built-in types (*note str: 16a,
          *note int: 19c, *note float: 197.), the lock is not released
          during comparison.

 -- C の関数: int PyList_Reverse (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  'list' の要素をイン
     プレースで反転します。成功した場合には ‘0’ を、失敗した場合には
     ‘-1’ を返します。‘list.reverse()’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyList_AsTuple (PyObject *list)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'

     'list' の内容が入った新たなタプルオブジェクトを返します;
     ‘tuple(list)’ と同じです。


File: python.info,  Node: Container オブジェクト,  Next: Function オブジェクト<2>,  Prev: シーケンスオブジェクト sequence object,  Up: 具象オブジェクト concrete object レイヤ

7.9.4 Container オブジェクト
----------------------------

* Menu:

* Dictionary Objects::
* Set オブジェクト::


File: python.info,  Node: Dictionary Objects,  Next: Set オブジェクト,  Up: Container オブジェクト

7.9.4.1 Dictionary Objects
..........................

 -- C のデータ型: type PyDictObject

     この *note PyObject: 5df. のサブタイプは Python の辞書オブジェクト
     を表現します。

 -- C 変数: *note PyTypeObject: ca0. PyDict_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは Python の辞書を表現します。このオブジェクトは
     、Python レイヤにおける *note dict: 184. と同じオブジェクトです。

 -- C の関数: int PyDict_Check (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  'p' が辞書オブジェクトか辞書
     型のサブタイプのインスタンスである場合に真を返します。この関数は常
     に成功します。

 -- C の関数: int PyDict_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  'p' が辞書オブジェクトだが辞
     書型のサブタイプのインスタンスでない場合に真を返します。この関数は
     常に成功します。

 -- C の関数: *note PyObject: 5df. *PyDict_New ()
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  空の新たな辞書を返します。 失
     敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyDictProxy_New (PyObject *mapping)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ある
     マップ型オブジェクトに対して、読み出し専用に制限された *note
     types.MappingProxyType: 698. オブジェクトを返します。通常、この関数
     は動的でないクラス型 (non-dynamic class type) のクラス辞書が変更さ
     れないようにビューを作成するために使われます。

 -- C 変数: *note PyTypeObject: ca0. PyDictProxy_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     mapping proxy objects created by *note PyDictProxy_New(): 533c. and
     for the read-only ‘__dict__’ attribute of many built-in types.  A
     *note PyDictProxy_Type: 533d. 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.''  Thread safety: *note
     Atomic: 2786.'  現在辞書に入っている全てのキーと値のペアを除去して
     空にします。

 -- C の関数: int PyDict_Contains (PyObject *p, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  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’.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

 -- C の関数: int PyDict_ContainsString (PyObject *p, const char *key)
     ' Thread safety: *note Atomic: 2786.'  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.''
     Thread safety: *note Atomic: 2786.'  'p' と同じキーと値のペアが入っ
     た新たな辞書を返します。

 -- C の関数: int PyDict_SetItem (PyObject *p, PyObject *key, PyObject
          *val)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  辞書 'p' に、 'key'
     をキーとして値 'val' を挿入します。 'key' はハッシュ可能(*note
     hashable: 824.)でなければなりません。ハッシュ可能でない場合、 *note
     TypeError: 199. を送出します。 成功した場合には ‘0’ を、失敗した場
     合には ‘-1’ を返します。 この関数は 'val' への参照を盗み取り 'ませ
     ん'。

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

 -- C の関数: int PyDict_SetItemString (PyObject *p, const char *key,
          PyObject *val)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  This is the same as *note PyDict_SetItem(): 523e,
     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.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  辞書 'p' から 'key'
     をキーとするエントリを除去します。 'key' は *note ハッシュ可能:
     824. でなければなりません; ハッシュ可能でない場合、 *note
     TypeError: 199. を送出します。'key' が辞書になければ、*note
     KeyError: 5e7. を送出します。成功した場合には ‘0’ を、失敗した場合
     には ‘-1’ を返します。

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

 -- C の関数: int PyDict_DelItemString (PyObject *p, const char *key)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  This is the same as *note PyDict_DelItem(): 5343,
     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 より).''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  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’.

        * On error, raise an exception, set '*result' to ‘NULL’ and
          return ‘-1’.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

     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.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  Return a *note borrowed
     reference: 3d5. 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__():
          cf7. and *note __eq__(): cf6. methods are silently ignored.
          Prefer the *note PyDict_GetItemWithError(): 5e1. function
          instead.

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemRef(): 5e0, which returns a *note strong
          reference: 5e2.

     バージョン 3.10 で変更: Calling this API without an *note attached
     thread state: 5256. 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.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  *note PyDict_GetItem(): 628.
     の変種で例外を隠しません。 例外が発生した場合は、例外をセット 'した
     上で' ‘NULL’ を返します。 キーが存在しなかった場合は、例外をセット
     'せずに' ‘NULL’ を返します。

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemRef(): 5e0, which returns a *note strong
          reference: 5e2.

 -- C の関数: *note PyObject: 5df. *PyDict_GetItemString (PyObject *p,
          const char *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  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__():
          cf7. and *note __eq__(): cf6. methods or while creating the
          temporary *note str: 16a. object are silently ignored.  Prefer
          using the *note PyDict_GetItemWithError(): 5e1. function with
          your own *note PyUnicode_FromString(): 5497. 'key' instead.

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_GetItemStringRef(): 41f, which returns a *note strong
          reference: 5e2.

 -- C の関数: int PyDict_GetItemStringRef (PyObject *p, const char *key,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).''
     Thread safety: *note Atomic: 2786.'  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)
     '戻り値: 借用参照。'' Thread safety: *note Safe to call from
     multiple threads with external synchronization only: 277a.'  これは
     Python レベルの *note dict.setdefault(): 1289. と同じです。 もしあ
     れば、辞書 'p' から 'key' に対応する値を返します。 キーが辞書になけ
     れば、値 'defaultobj' を挿入し 'defaultobj' を返します。 この関数は
     、 'key' のハッシュ値を検索と挿入ごとに別々に評価するのではなく、一
     度だけしか評価しません。

     Added in version 3.4.

          注釈: In the *note free-threaded build: 17b0, the returned
          *note borrowed reference: 3d5. may become invalid if another
          thread modifies the dictionary concurrently.  Prefer *note
          PyDict_SetDefaultRef(): 5e3, which returns a *note strong
          reference: 5e2.

 -- C の関数: int PyDict_SetDefaultRef (PyObject *p, PyObject *key,
          PyObject *default_value, PyObject **result)
     ' Thread safety: *note Safe for concurrent use on the same object:
     2781.'  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.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

     Added in version 3.13.

 -- C の関数: int PyDict_Pop (PyObject *p, PyObject *key, PyObject
          **result)
     ' Thread safety: *note Safe for concurrent use on the same object:
     2781.'  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.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

     Added in version 3.13.

 -- C の関数: int PyDict_PopString (PyObject *p, const char *key,
          PyObject **result)
     ' Thread safety: *note Atomic: 2786.'  Similar to *note
     PyDict_Pop(): 420, 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.''
     Thread safety: *note Atomic: 2786.'  辞書内の全ての要素対が入った
     *note PyListObject: 2784. を返します。

 -- C の関数: *note PyObject: 5df. *PyDict_Keys (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  辞書内の全てのキーが入った
     *note PyListObject: 2784. を返します。

 -- C の関数: *note PyObject: 5df. *PyDict_Values (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  辞書 'p' 内の全ての値が入った
     *note PyListObject: 2784. を返します。

 -- C の関数: *note Py_ssize_t: c59. PyDict_Size (PyObject *p)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'

     辞書内の要素の数を返します。辞書に対して ‘len(p)’ を実行するのと同
     じです。

 -- C の関数: *note Py_ssize_t: c59. PyDict_GET_SIZE (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  Similar to *note
     PyDict_Size(): 534a, but without error checking.

 -- C の関数: int PyDict_Next (PyObject *p, Py_ssize_t *ppos, PyObject
          **pkey, PyObject **pvalue)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     277a.'  辞書 'p' 内の全てのキー/値のペアにわたる反復処理を行います
     。 'ppos' が参照している *note Py_ssize_t: c59. 型は、この関数で反
     復処理を開始する際に、最初に関数を呼び出すよりも前に ‘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: 1f6.
     build without external synchronization.  You can use *note
     Py_BEGIN_CRITICAL_SECTION: 572e. 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: 3d5. 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(): a9e.).

 -- C の関数: int PyDict_Merge (PyObject *a, PyObject *b, int override)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  マップ型オブジェクト
     'b' の全ての要素にわたって、反復的にキー/値のペアを辞書 'a' に追加
     します。 'b' は辞書か、 *note PyMapping_Keys(): db9. または *note
     PyObject_GetItem(): 5ea. をサポートする何らかのオブジェクトにできま
     す。 'override' が真ならば、 'a' のキーと一致するキーが 'b' にある
     際に、既存のペアを置き換えます。それ以外の場合は、 'b' のキーに一致
     するキーが 'a' にないときのみ追加を行います。成功した場合には ‘0’ を
     返し、例外が送出された場合には ‘-1’ を返します。

          注釈: In the *note free-threaded build: 17b0, when 'b' is a
          *note dict: 184. (with the standard iterator), both 'a' and
          'b' are locked for the duration of the operation.  When 'b' is
          a non-dict mapping, only 'a' is locked; 'b' may be
          concurrently modified by another thread.

 -- C の関数: int PyDict_Update (PyObject *a, PyObject *b)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  C で表せば
     ‘PyDict_Merge(a, b, 1)’ と同じで、また Python の ‘a.update(b)’ と似
     ていますが、 *note PyDict_Update(): 534c. は第二引数が "keys" 属性
     を持たない場合にキー/値ペアのシーケンスを反復することはありません。
     成功した場合には ‘0’ を返し、例外が送出された場合には ‘-1’ を返しま
     す。

          注釈: In the *note free-threaded build: 17b0, when 'b' is a
          *note dict: 184. (with the standard iterator), both 'a' and
          'b' are locked for the duration of the operation.  When 'b' is
          a non-dict mapping, only 'a' is locked; 'b' may be
          concurrently modified by another thread.

 -- C の関数: int PyDict_MergeFromSeq2 (PyObject *a, PyObject *seq2, int
          override)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  '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

          注釈: In the *note free-threaded: 1f6. build, only 'a' is
          locked.  The iteration over 'seq2' is not synchronized; 'seq2'
          may be concurrently modified by another thread.

 -- C の関数: int PyDict_AddWatcher (PyDict_WatchCallback callback)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  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.

          注釈: This function is not internally synchronized.  In the
          *note free-threaded: 1f6. build, callers should ensure no
          concurrent calls to *note PyDict_AddWatcher(): 3ce. or *note
          PyDict_ClearWatcher(): 17a3. are in progress.

     Added in version 3.12.

 -- C の関数: int PyDict_ClearWatcher (int watcher_id)
     ' Thread safety: *note Safe to call from multiple threads with
     external synchronization only: 277a.'  Clear watcher identified by
     'watcher_id' previously returned from *note PyDict_AddWatcher():
     3ce.  Return ‘0’ on success, ‘-1’ on error (e.g.  if the given
     'watcher_id' was never registered.)

          注釈: This function is not internally synchronized.  In the
          *note free-threaded: 1f6. build, callers should ensure no
          concurrent calls to *note PyDict_AddWatcher(): 3ce. or *note
          PyDict_ClearWatcher(): 17a3. are in progress.

     Added in version 3.12.

 -- C の関数: int PyDict_Watch (int watcher_id, PyObject *dict)
     ' Thread safety: *note Safe to call without external
     synchronization on distinct objects: 277f.'  Mark dictionary 'dict'
     as watched.  The callback granted 'watcher_id' by *note
     PyDict_AddWatcher(): 3ce. 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)
     ' Thread safety: *note Safe to call without external
     synchronization on distinct objects: 277f.'  Mark dictionary 'dict'
     as no longer watched.  The callback granted 'watcher_id' by *note
     PyDict_AddWatcher(): 3ce. 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: 572f. 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 Objects

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: 5733.(*note op:
     5732.) || *note PyDictItems_Check: 5734.(op).  This function always
     succeeds.

 -- C 変数: *note PyTypeObject: ca0. 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(): 9d4.

 -- 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: ca0. 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(): 9d5.

 -- 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: ca0. 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(): 9d6.

 -- 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 Objects

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: ca0. 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: ca0. PyODictKeys_Type

     Analogous to *note PyDictKeys_Type: 533b. for ordered dictionaries.

 -- C 変数: *note PyTypeObject: ca0. PyODictValues_Type

     Analogous to *note PyDictValues_Type: 5341. for ordered
     dictionaries.

 -- C 変数: *note PyTypeObject: ca0. PyODictItems_Type

     Analogous to *note PyDictItems_Type: 5337. 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(): 5349.

 -- 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(): 523e.

 -- 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(): 5343.

These are *note soft deprecated: 23f. 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(): 534a.
                                                       
                                                       
 -- C のマクロ: PyODict_SIZE (od)                      *note PyDict_GET_SIZE(): 572d.
                                                       


File: python.info,  Node: Set オブジェクト,  Prev: Dictionary Objects,  Up: Container オブジェクト

7.9.4.4 Set オブジェクト
........................

このセクションでは *note set: 185. と *note frozenset: 7f2. の公開 API に
ついて詳しく述べます。以降で説明していない機能は、抽象オブジェクトプロト
コル (*note PyObject_CallMethod(): 640, *note
PyObject_RichCompareBool(): 1dea, *note PyObject_Hash(): 434, *note
PyObject_Repr(): 1234, *note PyObject_IsTrue(): 5419, *note
PyObject_Print(): 17b1, *note PyObject_GetIter(): 5418. を含む) か抽象数
値プロトコル (*note PyNumber_And(): 53ec, *note PyNumber_Subtract():
5405, *note PyNumber_Or(): 5400, *note PyNumber_Xor(): 5407, *note
PyNumber_InPlaceAnd(): 53f1, *note PyNumber_InPlaceSubtract(): 53f9,
*note PyNumber_InPlaceOr(): 53f5, *note PyNumber_InPlaceXor(): 53fb. を
含む) を使って利用できます。

 -- C のデータ型: type PySetObject

     この *note PyObject: 5df. を継承した型は、 *note set: 185. と *note
     frozenset: 7f2. 両方の内部データを保存するのに用いられます。 *note
     PyDictObject: 64f. と同じように、小さい集合(set)に対しては(タプルの
     ように)固定サイズであり、そうでない集合に対しては(リストと同じよう
     に)可変長のメモリブロックを用います。この構造体のどのフィールドも、
     公開されていると考えるべきではなく、変更される可能性があります。す
     べてのアクセスは、構造体の中の値を直接操作するのではなく、ドキュメ
     ントされた API を用いて行うべきです。

 -- C 変数: *note PyTypeObject: ca0. PySet_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは、Python の *note set: 185. 型を表します。

 -- C 変数: *note PyTypeObject: ca0. PyFrozenSet_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     ca0. のインスタンスは、Python の *note frozenset: 7f2. 型を表します
     。

以降の型チェックマクロはすべての Python オブジェクトに対するポインタに対
して動作します。同様に、コンストラクタはすべてのイテレート可能な Python
オブジェクトに対して動作します。

 -- C の関数: int PySet_Check (PyObject *p)

     'p' が *note set: 185. かそのサブタイプのオブジェクトであるときに
     true を返します。この関数は常に成功します。

 -- C の関数: int PyFrozenSet_Check (PyObject *p)

     'p' が *note frozenset: 7f2. かそのサブタイプのオブジェクトであると
     きに true を返します。この関数は常に成功します。

 -- C の関数: int PyAnySet_Check (PyObject *p)

     'p' が *note set: 185. か *note frozenset: 7f2. 、あるいはそのサブ
     タイプのオブジェクトであれば、true を返します。この関数は常に成功し
     ます。

 -- C の関数: int PySet_CheckExact (PyObject *p)

     'p' が *note set: 185. オブジェクトだがサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

     Added in version 3.10.

 -- C の関数: int PyAnySet_CheckExact (PyObject *p)

     'p' が *note set: 185. か *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.''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  'iterable' が返すオブジェクトを含む新しい *note set: 185. を
     返します。 'iterable' が ‘NULL’ のときは、空の set を返します。 成
     功したら新しい set を、失敗したら ‘NULL’ を返します。 'iterable' が
     イテレート可能でない場合は、 *note TypeError: 199. を送出します。 こ
     のコンストラクタは set をコピーするときにも使えます (‘c=set(s)’)。

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'iterable' is a *note set: 185, *note frozenset: 7f2. or
          *note dict: 184.

 -- C の関数: *note PyObject: 5df. *PyFrozenSet_New (PyObject *iterable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Safe for concurrent use on the same object:
     2781.'  'iterable' が返すオブジェクトを含む新しい *note frozenset:
     7f2. を返します。 'iterable' が ‘NULL’ のときは、空の frozenset を
     返します。 成功時には新しい set を、失敗時には ‘NULL’ を返します。
     'iterable' がイテレート可能でない場合は、 *note TypeError: 199. を
     送出します。

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'iterable' is a *note set: 185, *note frozenset: 7f2. or
          *note dict: 184.

以降の関数やマクロは、 *note set: 185. と *note frozenset: 7f2. とそのサ
ブタイプのインスタンスに対して利用できます。

 -- C の関数: *note Py_ssize_t: c59. PySet_Size (PyObject *anyset)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'

     Return the length of a *note set: 185. or *note frozenset: 7f2.
     object.  Equivalent to ‘len(anyset)’.  Raises a *note SystemError:
     795. if 'anyset' is not a ‘set’, ‘frozenset’, or an instance of a
     subtype.

 -- C の関数: *note Py_ssize_t: c59. PySet_GET_SIZE (PyObject *anyset)
     ' Thread safety: *note Atomic: 2786.'  エラーチェックを行わない、
     *note PySet_Size(): 1667. のマクロ形式。

 -- C の関数: int PySet_Contains (PyObject *anyset, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  Return ‘1’ if found,
     ‘0’ if not found, and ‘-1’ if an error is encountered.  Unlike the
     Python *note __contains__(): 15d7. method, this function does not
     automatically convert unhashable sets into temporary frozensets.
     Raise a *note TypeError: 199. if the 'key' is unhashable.  Raise
     *note SystemError: 795. if 'anyset' is not a *note set: 185, *note
     frozenset: 7f2, or an instance of a subtype.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

 -- C の関数: int PySet_Add (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  *note set: 185. のイ
     ンスタンスに 'key' を追加します。 *note frozenset: 7f2. に対しても
     動作します (*note PyTuple_SetItem(): 523d. のように、他のコードに見
     える前の新しい frozenset の値を埋めるために使用できます)。 成功した
     ら ‘0’ を、失敗したら ‘-1’ を返します。 'key' がハッシュ可能でない
     場合は、 *note TypeError: 199. を送出します。 'set' を大きくする余
     裕がない場合は、 *note MemoryError: 1772. を送出します。 'set' が
     ‘set’ かそのサブタイプのインスタンスでない場合は、 *note
     SystemError: 795. を送出します。

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

以降の関数は、 *note set: 185. とそのサブタイプに対して利用可能です。
*note frozenset: 7f2. とそのサブタイプには利用できません。

 -- C の関数: int PySet_Discard (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     for concurrent use on the same object: 2781.'  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: 199. if the 'key' is
     unhashable.  Unlike the Python *note discard(): 26f7. 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: 185. or its subtype.

          注釈: The operation is atomic on *note free threading: 17b0.
          when 'key' is *note str: 16a, *note int: 19c, *note float:
          197, *note bool: 3c1. or *note bytes: 193.

 -- C の関数: *note PyObject: 5df. *PySet_Pop (PyObject *set)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  'set' の中の要素のどれかに対す
     る新しい参照を返し、そのオブジェクトを 'set' から削除します。 失敗
     したら ‘NULL’ を返します。 set が空の場合には *note KeyError: 5e7.
     を送出します。 'set' が *note set: 185. とそのサブタイプのインスタ
     ンスでない場合は、 *note SystemError: 795. を送出します。

 -- C の関数: int PySet_Clear (PyObject *set)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note
     Atomic: 2786.'  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: 185. or its subtype.

          注釈: In the *note free-threaded build: 17b0, the set is
          emptied before its entries are cleared, so other threads will
          observe an empty set rather than intermediate states.

* 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: 23f. constant representing the size of an
     internal preallocated table inside *note PySetObject: 574a.
     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(): 1667.
     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: ca0. PyFunction_Type

     *note PyTypeObject: ca0. 型のインスタンスで、 Python の関数型を表し
     ます。これは Python プログラムに ‘types.FunctionType’ として公開さ
     れています。

 -- C の関数: int PyFunction_Check (PyObject *o)

     'o' が関数オブジェクト (*note PyFunction_Type: 5758. 型である) 場合
     に真を返します。パラメータは ‘NULL’ にできません。この関数は常に成
     功します。

 -- C の関数: *note PyObject: 5df. *PyFunction_New (PyObject *code,
          PyObject *globals)
     '戻り値: 新しい参照。' コードオブジェクト 'code' に関連付けられた新
     しい関数オブジェクトを返します。'globals' はこの関数からアクセスで
     きるグローバル変数の辞書でなければなりません。

     関数のドキュメント文字列と名前はコードオブジェクトから取得されます
     。 *note __module__: 23a6. は 'globals' から取得されます。 引数のデ
     フォルト値やアノテーション、クロージャは ‘NULL’ に設定されます。
     *note __qualname__: 23a5. はコードオブジェクトの *note co_qualname:
     23e6. フィールドと同じ値に設定されます。

 -- C の関数: *note PyObject: 5df. *PyFunction_NewWithQualName (PyObject
          *code, PyObject *globals, PyObject *qualname)
     '戻り値: 新しい参照。' *note PyFunction_New(): 575a. に似ていますが
     、関数オブジェクトの *note __qualname__: 23a5. 属性に値をセットでき
     ます。 'qualname' はユニコードオブジェクトか ‘NULL’ でなくてはなり
     ません。‘NULL’ だった場合、 ‘__qualname__’ 属性にはコードオブジェク
     トの *note co_qualname: 23e6. フィールドと同じ値がセットされます。

     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: 3d5. to the
     *note __module__: 23a6. attribute of the *note function object:
     59c. 'op'.  It can be 'NULL'.

     This is normally a *note string: 16a. 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:
     5758. 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(): 576e.  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(): 576d. 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: 576f. 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: 3d5.
     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: 1696. and the
new way to bind a ‘PyCFunction’ to a class object.  It replaces the
former call ‘PyMethod_New(func, NULL, class)’.

 -- C 変数: *note PyTypeObject: ca0. PyInstanceMethod_Type

     *note PyTypeObject: ca0. のインスタンスは Python のインスタンスメソ
     ッドの型を表現します。これは Python のプログラムには公開されません
     。

 -- C の関数: int PyInstanceMethod_Check (PyObject *o)

     'o' がインスタンスメソッドオブジェクト (*note
     PyInstanceMethod_Type: 5775. 型である) 場合に真を返します。パラメー
     タは ‘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(): 5778. のマ
     クロ版で、エラーチェックを行いません。


File: python.info,  Node: メソッドオブジェクト<2>,  Next: セルオブジェクト cell object,  Prev: インスタンスメソッドオブジェクト Instance Method Objects,  Up: Function オブジェクト<2>

7.9.5.3 メソッドオブジェクト
............................

メソッドは関数オブジェクトに束縛されています。メソッドは常にあるユーザー
定義のクラスに束縛されているのです。束縛されていないメソッド(クラスオブ
ジェクトに束縛されたメソッド)は利用することができません。

 -- C 変数: *note PyTypeObject: ca0. PyMethod_Type

     この *note PyTypeObject: ca0. のインスタンスは Python のメソッド型
     を表現します。このオブジェクトは、 ‘types.MethodType’ として Python
     プログラムに公開されています。

 -- C の関数: int PyMethod_Check (PyObject *o)

     'o' がメソッドオブジェクト (*note PyMethod_Type: 577c. 型である) 場
     合に真を返します。パラメータは ‘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(): 577f. のマクロ版で
     、エラーチェックを行いません。

 -- C の関数: *note PyObject: 5df. *PyMethod_Self (PyObject *meth)
     '戻り値: 借用参照。' メソッド 'meth' に関連付けられたインスタンスを
     返します。

 -- C の関数: *note PyObject: 5df. *PyMethod_GET_SELF (PyObject *meth)
     '戻り値: 借用参照。' *note PyMethod_Self(): 5781. のマクロ版で、エ
     ラーチェックを行いません。


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: ca0. 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: ca0. PyCode_Type

     This is an instance of *note PyTypeObject: ca0. 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: c59. PyCode_GetNumFree (PyCodeObject
          *co)

     Return the number of *note free (closure) variables: 18f6. 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:
     18f6. 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: 97f. *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(): 156c. instead.

     Since the definition of the bytecode changes often, calling *note
     PyUnstable_Code_New(): 5793. 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: 97f.
          *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(): 5793, 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: 97f. *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(): 992. 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: 999. 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: 55a8. 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: 55a8. 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: 55a8. containing
     the names of the *note free (closure) variables: 18f6.  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:
          5796. event, *note PyCodeObject: 97f. *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: 23f. 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: 193d. Python attribute (for example using *note
PyObject_GetAttrString(): 5ef.), and set using a 'flags' argument to
*note PyUnstable_Code_New(): 5793. and similar functions.

Flags whose names start with ‘CO_FUTURE_’ correspond to features
normally selectable by *note future statements: 45b.  These flags can be
used in *note PyCompilerFlags.cf_flags: 555e.  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: 4dd6.
                                                       
                                                       
 -- C のマクロ: CO_NEWLOCALS                           *note inspect.CO_NEWLOCALS: 4dd7.
                                                       
                                                       
 -- C のマクロ: CO_VARARGS                             *note inspect.CO_VARARGS: 4dd8.
                                                       
                                                       
 -- C のマクロ: CO_VARKEYWORDS                         *note inspect.CO_VARKEYWORDS: 4dd9.
                                                       
                                                       
 -- C のマクロ: CO_NESTED                              *note inspect.CO_NESTED: 4dda.
                                                       
                                                       
 -- C のマクロ: CO_GENERATOR                           *note inspect.CO_GENERATOR: 4ddb.
                                                       
                                                       
 -- C のマクロ: CO_COROUTINE                           *note inspect.CO_COROUTINE: 4ddc.
                                                       
                                                       
 -- C のマクロ: CO_ITERABLE_COROUTINE                  *note inspect.CO_ITERABLE_COROUTINE: 4ddd.
                                                       
                                                       
 -- C のマクロ: CO_ASYNC_GENERATOR                     *note inspect.CO_ASYNC_GENERATOR: 4dde.
                                                       
                                                       
 -- C のマクロ: CO_HAS_DOCSTRING                       *note inspect.CO_HAS_DOCSTRING: 23f4.
                                                       
                                                       
 -- C のマクロ: CO_METHOD                              *note inspect.CO_METHOD: 4ddf.
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_DIVISION                     no effect (*note __future__.division: 4d84.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ABSOLUTE_IMPORT              no effect (*note __future__.absolute_import: 4d85.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_WITH_STATEMENT               no effect (*note __future__.with_statement: 4d86.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_PRINT_FUNCTION               no effect (*note __future__.print_function: 4d87.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_UNICODE_LITERALS             no effect (*note __future__.unicode_literals: 4d88.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_GENERATOR_STOP               no effect (*note __future__.generator_stop: 4d89.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ANNOTATIONS                  *note __future__.annotations: 4d8a.
                                                       


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: c59.
          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(): 54af. 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:

* File objects::
* モジュールオブジェクト (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: File objects,  Next: モジュールオブジェクト module object,  Up: その他のオブジェクト<2>

7.9.6.1 File objects
....................

これらの API は、 Python 2 の組み込みのファイルオブジェクトの C API を最
低限エミュレートするためのものです。それらは、標準 C ライブラリでサポー
トされているバッファ付き I/O (FILE*) に頼るために使われます。 Python 3 で
は、ファイルとストリームは新しい *note io: 83. モジュールを使用され、そ
こに OS の低レベルなバッファ付き I/O の上にいくつかの層が定義されていま
す。下で解説されている関数は、それらの新しい API の便利な C ラッパーであ
り、インタプリタでの内部的なエラー通知に向いています; サードパーティーの
コードは代わりに ‘io’ の 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():
     181b. メソッドがあれば呼び出します; このメソッドの返り値は、ファイ
     ル記述子の値として返される整数でなければなりません。失敗すると例外
     を設定して ‘-1’ を返します。

 -- C の関数: *note PyObject: 5df. *PyFile_GetLine (PyObject *p, int n)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     ‘p.readline([n])’ と同じで、この関数はオブジェクト 'p' の各行を読み
     出します。 'p' はファイルオブジェクトか、 *note readline(): 1545. メ
     ソッドを持つ何らかのオブジェクトでかまいません。 'n' が ‘0’ の場合
     、行の長さに関係なく正確に 1 行だけ読み出します。 'n' が ‘0’ より大
     きければ、 'n' バイト以上のデータは読み出しません; 従って、行の一部
     だけが返される場合があります。 どちらの場合でも、読み出し後すぐにフ
     ァイルの終端に到達した場合には空文字列を 返します。 'n' が ‘0’ より
     小さければ、長さに関わらず 1 行だけを 読み出しますが、すぐにファイ
     ルの終端に到達した場合には *note EOFError: 14f5. を送出します。

 -- C の関数: int PyFile_SetOpenCodeHook (Py_OpenCodeHookFunction
          handler)

     *note io.open_code(): 17c4. の通常の振る舞いを上書きして、そのパラ
     メーターを提供されたハンドラで渡します。

     ハンドラーは次の型の関数です。

      -- C のデータ型: typedef *note PyObject: 5df.
               *(*Py_OpenCodeHookFunction)(*note PyObject: 5df.*, void*)

          *note PyObject: 5df. *(*)(PyObject *path, void *userData) と等
          価で、 'path' は *note PyUnicodeObject: 99b. であることが保証
          されています。

     'userData' ポインタはフック関数に渡されます。 フック関数は別なラン
     タイムから呼び出されるかもしれないので、このポインタは直接 Python の
     状態を参照すべきではありません。

     このフック関数はインポート中に使われることを意図しているため、モジ
     ュールが frozen なモジュールであるか ‘sys.modules’ にある利用可能な
     モジュールであることが分かっている場合を除いては、フック関数の実行
     中に新しいモジュールをインポートするのは避けてください。

     いったんフック関数が設定されたら、削除や置き換えもできず、後からの
     *note PyFile_SetOpenCodeHook(): 1afb. の呼び出しは失敗します。 この
     関数が失敗したときは、インタープリタが初期化されていた場合、 -1 を
     返して例外をセットします。

     この関数は *note Py_Initialize(): 45e. より前に呼び出しても安全です
     。

     引数無しで *note 監査イベント: 1ccb. ‘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: 16a. object.  The behavior of this function may be overridden
     by *note PyFile_SetOpenCodeHook(): 1afb. to allow for some
     preprocessing of the text.

     This is analogous to *note io.open_code(): 17c4. 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(): 57b4, 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.'

     Write object 'obj' to file object 'p'.  The only supported flag for
     'flags' is *note Py_PRINT_RAW: 560b.; if given, the *note str():
     16a. of the object is written instead of the *note repr(): 1c3.

     If 'obj' is ‘NULL’, write the string ‘"<NULL>"’.

     Return ‘0’ on success or ‘-1’ on failure; the appropriate exception
     will be set.

 -- C の関数: int PyFile_WriteString (const char *s, PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'  文字列 's' をファイルオブ
     ジェクト 'p' に書き出します。成功した場合には ‘0’ を返し、失敗する
     と ‘-1’ を返して適切な例外をセットします。

* Menu:

* Soft-deprecated API::


File: python.info,  Node: Soft-deprecated API,  Up: File objects

7.9.6.2 Soft-deprecated API
...........................

*note Soft deprecated: 23f. since version 3.15.

These are 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(): 53a9. with defaults (‘fd, NULL, "w", -1,
     NULL, NULL, NULL, 0’) instead.

 -- C 変数: *note PyTypeObject: ca0. PyStdPrinter_Type

     Type of file-like objects used internally at Python startup when
     *note io: 83. is not yet available.  Use Python *note open(): 318.
     or *note PyFile_FromFd(): 53a9. to create file objects instead.


File: python.info,  Node: モジュールオブジェクト module object,  Next: Module definitions,  Prev: File objects,  Up: その他のオブジェクト<2>

7.9.6.3 モジュールオブジェクト (module object)
..............................................

 -- C 変数: *note PyTypeObject: ca0. PyModule_Type
     ' 次に属します: *note Stable ABI: 775.'

     This instance of *note PyTypeObject: ca0. represents the Python
     module type.  This is exposed to Python programs as *note
     types.ModuleType: 1018.

 -- C の関数: int PyModule_Check (PyObject *p)

     'p' がモジュールオブジェクトかモジュールオブジェクトのサブタイプで
     あるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyModule_CheckExact (PyObject *p)

     'p' がモジュールオブジェクトで、かつ *note PyModule_Type: 53e9. の
     サブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyModule_NewObject (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'

     Return a new module object with *note module.__name__: 15a7. set to
     'name'.  The module's ‘__name__’, *note __doc__: 1c4c, *note
     __package__: 325. and *note __loader__: 339. attributes are filled
     in (all but ‘__name__’ are set to ‘None’).  The caller is
     responsible for setting a *note __file__: 23c5. attribute.

     Return ‘NULL’ with an exception set on error.

     Added in version 3.3.

     バージョン 3.4 で変更: *note __package__: 325. and *note
     __loader__: 339. are now set to ‘None’.

 -- C の関数: *note PyObject: 5df. *PyModule_New (const char *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyModule_NewObject(): 53e7. に似ていますが、 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__: 15a7. 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(): 53e5. に似ていますが、 ‘'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__: 15a7. attribute.

 -- C の関数: void *PyModule_GetState (PyObject *module)
     ' 次に属します: *note Stable ABI: 775.'  Return the "state" of the
     module, that is, a pointer to the block of memory allocated at
     module creation time, or ‘NULL’.  See *note PyModuleDef.m_size:
     b7a.

 -- C の関数: *note PyModuleDef: b78. *PyModule_GetDef (PyObject
          *module)
     ' 次に属します: *note Stable ABI: 775.'  モジュールが作られる元とな
     った *note PyModuleDef: b78. 構造体へのポインタを返します。 モジュ
     ールが定義によって作られていなかった場合は ‘NULL’ を返します。

     On error, return ‘NULL’ with an exception set.  Use *note
     PyErr_Occurred(): 1d0a. 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__: 23c5. 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(): 42c. と似ていますが、 'utf-8' でエン
     コードされたファイル名を返します。

     The returned buffer is only valid until the module's *note
     __file__: 23c5. attribute is reassigned or the module is destroyed.

     バージョン 3.2 で非推奨: *note PyModule_GetFilename(): 42b. はエン
     コードできないファイル名に対しては *note UnicodeEncodeError: 888. を
     送出します。これの代わりに *note PyModule_GetFilenameObject(): 42c.
     を使用してください。


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: b78. - 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 拡張モジュールの定義: 5281. for details).  It is also
used to *note create extension modules dynamically: 57c1.

Unlike *note PyModule_New(): 53e6, 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

          Always initialize this member to ‘PyModuleDef_HEAD_INIT’.

      -- C のメンバ変数: const char *m_name

          Name for the new module.

      -- C のメンバ変数: const char *m_doc

          Docstring for the module; usually a docstring variable created
          with *note PyDoc_STRVAR: 1db9. is used.

      -- C のメンバ変数: *note Py_ssize_t: c59. m_size

          Module state may be kept in a per-module memory area that can
          be retrieved with *note PyModule_GetState(): b7b, rather than
          in static globals.  This makes modules safe for use in
          multiple sub-interpreters.

          This memory area is allocated based on 'm_size' on module
          creation, and freed when the module object is deallocated,
          after the *note m_free: b77. function has been called, if
          present.

          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: 5592. or when *note creating
          modules dynamically: 57c1.

          詳細は PEP 3121(1) を参照。

      -- C のメンバ変数: *note PyMethodDef: 16f5. *m_methods

          A pointer to a table of module-level functions, described by
          *note PyMethodDef: 16f5. values.  Can be ‘NULL’ if no
          functions are present.

      -- C のメンバ変数: *note PyModuleDef_Slot: 53de. *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: 5530. m_reload

      -- C のメンバ変数: *note traverseproc: 553f. m_traverse

          A traversal function to call during GC traversal of the module
          object, or ‘NULL’ if not needed.

          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: b79. function).  More precisely, this function is
          not called if *note m_size: b7a. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b7b.)
          is ‘NULL’.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

      -- C のメンバ変数: *note inquiry: 5530. m_clear

          A clear function to call during GC clearing of the module
          object, or ‘NULL’ if not needed.

          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: b79. function).  More precisely, this function is
          not called if *note m_size: b7a. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b7b.)
          is ‘NULL’.

          Like *note PyTypeObject.tp_clear: 5267, 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: b77. is called directly.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

      -- C のメンバ変数: *note freefunc: 57c7. m_free

          A function to call during deallocation of the module object,
          or ‘NULL’ if not needed.

          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: b79. function).  More precisely, this function is
          not called if *note m_size: b7a. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b7b.)
          is ‘NULL’.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

 -- C 変数: *note PyTypeObject: ca0. PyModuleDef_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'  The
     type of ‘PyModuleDef’ objects.

* 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

          A slot ID, chosen from the available values explained below.

      -- C のメンバ変数: void *value

          Value of the slot, whose meaning depends on the slot ID.

     Added in version 3.5.

The available slot types are:

 -- C のマクロ: Py_mod_create
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'
     Specifies a function that is called to create the module object
     itself.  The 'value' pointer of this slot must point to a function
     of the signature:

      -- C の関数: *note PyObject: 5df. *create_module (PyObject *spec,
               PyModuleDef *def)

     The function receives a *note ModuleSpec: 22c8. instance, as
     defined in PEP 451(1), and the module definition.  It should return
     a new module object, or set an error and return ‘NULL’.

     この関数は最小限に留めておくべきです。 特に任意のPythonコードを呼び
     出すべきではなく、同じモジュールをインポートしようとすると無限ルー
     プに陥るでしょう。

     Multiple ‘Py_mod_create’ slots may not be specified in one module
     definition.

     ‘Py_mod_create’ が設定されていない場合は、インポート機構は *note
     PyModule_New(): 53e6. を使って通常のモジュールオブジェクトを生成し
     ます。 モジュールの名前は定義ではなく 'spec' から取得され、これによ
     って拡張モジュールが動的にモジュール階層における位置を調整できたり
     、シンボリックリンクを通して同一のモジュール定義を共有しつつ別の名
     前でインポートできたりします。

     There is no requirement for the returned object to be an instance
     of *note PyModule_Type: 53e9.  Any type can be used, as long as it
     supports setting and getting import-related attributes.  However,
     only ‘PyModule_Type’ instances may be returned if the ‘PyModuleDef’
     has non-‘NULL’ ‘m_traverse’, ‘m_clear’, ‘m_free’; non-zero
     ‘m_size’; or slots other than ‘Py_mod_create’.

     Added in version 3.5.

 -- C のマクロ: Py_mod_exec
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'
     Specifies a function that is called to 'execute' the module.  This
     is equivalent to executing the code of a Python module: typically,
     this function adds classes and constants to the module.  The
     signature of the function is:

      -- C の関数: int exec_module (PyObject *module)

     If multiple ‘Py_mod_exec’ slots are specified, they are processed
     in the order they appear in the 'm_slots' array.

     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
          拡張モジュールを分離する: 167.)

      -- C のマクロ: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED

          The module supports being imported in subinterpreters, even
          when they have their own GIL. (See *note
          拡張モジュールを分離する: 167.)

     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: 5591.  They are also used in
*note single-phase initialization: 5592.

 -- 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(): 53e1. with 'module_api_version' set to *note
     PYTHON_API_VERSION: 4cb2, or to *note PYTHON_ABI_VERSION: 57d2. 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: 5599.
     member of 'def' must be ‘NULL’.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_Create(): 559b. を利用するべきです。この関数は、この
          関数の必要性を理解しているときにだけ利用してください。

 -- C の関数: *note PyObject: 5df. *PyModule_FromDefAndSpec (PyModuleDef
          *def, PyObject *spec)
     '戻り値: 新しい参照。' This macro calls *note
     PyModule_FromDefAndSpec2(): 10b8. with 'module_api_version' set to
     *note PYTHON_API_VERSION: 4cb2, or to *note PYTHON_ABI_VERSION:
     57d2. 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:
     b79.).  Both ‘PyModule_FromDefAndSpec’ and ‘PyModule_ExecDef’ must
     be called to fully initialize a module.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_FromDefAndSpec(): 10b7. を利用するべきです。 この関数
          は、この関数の必要性を理解しているときにだけ利用してください。

     Added in version 3.5.

 -- C の関数: int PyModule_ExecDef (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     'def' で与えられた任意の実行スロット (*note Py_mod_exec: b79.) を実
     行します。

     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:
b79.), the initialization function for legacy *note single-phase
initialization: 5592, 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(): 5497. and *note
     PyObject_SetAttr(): 17c8. directly.  For more details, see *note
     PyUnicode_InternFromString(): 19eb, 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(): 996. '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.

     *note Soft deprecated: 23f. since version 3.13.

 -- 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():
     1c2d. 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(): 19eb. 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(): 984.  The name of the type
     object is taken from the last component of *note tp_name: 1d0b.
     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: 16f5. 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 多段階初期化: 5597,
     ‘PyModule_Create’, or ‘PyModule_FromDefAndSpec’).  Some module
     authors may prefer defining functions in multiple *note
     PyMethodDef: 16f5. 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 多段階初期化: 5597, ‘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 従来の一段階初期化: 5592.  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: 5592. 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():
     5439. でインタプリタの state にモジュールオブジェクトを連結しておく
     ことを要求します。対応するモジュールオブジェクトが見付からない、も
     しくは事前にインタプリタの state に連結されていない場合は、 ‘NULL’
     を返します。

 -- C の関数: int PyState_AddModule (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.3 より).'  関
     数に渡されたモジュールオブジェクトを、インタプリタの state に連結し
     ます。この関数を使うことで *note PyState_FindModule(): 543a. からモ
     ジュールオブジェクトにアクセスできるようになります。

     一段階初期化を使って作成されたモジュールにのみ有効です。

     Python calls ‘PyState_AddModule’ automatically after importing a
     module that uses *note single-phase initialization: 5592, 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: 5256.

     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: 5256.

     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: ca0. PySeqIter_Type
     ' 次に属します: *note Stable ABI: 775.'  *note PySeqIter_New():
     5423. や、組み込みシーケンス型に対して 1 引数形式の組み込み関数
     *note iter(): 9db. を呼び出したときに返される、イテレータオブジェク
     トの型オブジェクトです。

 -- C の関数: int PySeqIter_Check (PyObject *op)

     'op' の型が ‘PySeqlter_Type’ 型の場合に真を返します。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 5df. *PySeqIter_New (PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  一般
     的なシーケンスオブジェクト 'seq' を扱うイテレータを返します。反復処
     理は、シーケンスが添字指定操作の際に *note IndexError: 1753. を返し
     たときに終了します。

 -- C 変数: *note PyTypeObject: ca0. PyCallIter_Type
     ' 次に属します: *note Stable ABI: 775.'  *note PyCallIter_New():
     5315. や、組み込み関数 *note iter(): 9db. の 2 引数形式が返すイテレ
     ータオブジェクトの型オブジェクトです。

 -- C の関数: int PyCallIter_Check (PyObject *op)

     'op' の型が *note PyCallIter_Type: 5316. 型の場合に真を返します。こ
     の関数は常に成功します。

 -- 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: ca0. PyRange_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for *note
     range: b41. objects.

 -- C の関数: int PyRange_Check (PyObject *o)

     Return true if the object 'o' is an instance of a *note range: b41.
     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: ca0. PyEnum_Type       *note enumerate: 169f.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: ca0. PyFilter_Type     *note filter: a68.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: ca0. PyMap_Type        *note map: 1a0.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: ca0. PyReversed_Type   *note reversed: a69.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: ca0. PyZip_Type        *note zip: 1a1.
     ' 次に属します: *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: ca0. PyByteArrayIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyBytesIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyListIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyListRevIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PySetIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyTupleIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyRangeIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyLongRangeIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyDictIterKey_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyDictRevIterKey_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: ca0. PyDictIterValue_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyDictRevIterValue_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: ca0. PyDictIterItem_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: ca0. PyDictRevIterItem_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: ca0. PyODictIter_Type

     Type objects for iterators of various built-in objects.

     Do not create instances of these directly; prefer calling *note
     PyObject_GetIter(): 5418. instead.

     Note that there is no guarantee that a given built-in type uses a
     given iterator type.  For example, iterating over *note range: b41.
     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: ca0. PyProperty_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for the
     built-in descriptor types.

 -- 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: ca0. 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: 2a62.
     objects in Python.

 -- C 変数: *note PyTypeObject: ca0. PyGetSetDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     get/set descriptor objects created from *note PyGetSetDef: db6.
     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: ca0. PyMethodDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for method
     descriptor objects created from *note PyMethodDef: 16f5.
     structures.  These descriptors expose C functions as methods on a
     type, and correspond to *note types.MemberDescriptorType: 2a62.
     objects in Python.

 -- C の関数: *note PyObject: 5df. *PyDescr_NewWrapper (PyTypeObject
          *type, struct wrapperbase *wrapper, void *wrapped)
     '戻り値: 新しい参照。'

 -- C 変数: *note PyTypeObject: ca0. PyWrapperDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     wrapper descriptor objects created by *note PyDescr_NewWrapper():
     57e4. and *note PyWrapper_New(): 54a4.  Wrapper descriptors are
     used internally to expose special methods implemented via wrapper
     structures, and appear in Python as *note
     types.WrapperDescriptorType: d96. 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: ca0. PySuper_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for super
     objects.  This is the same object as *note super: 1a7. in the
     Python layer.

 -- C 変数: *note PyTypeObject: ca0. PyClassMethod_Type

     The type of class method objects.  This is the same object as *note
     classmethod: 48e. in the Python layer.

 -- C 変数: *note PyTypeObject: ca0. 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: ca0. PyStaticMethod_Type

     The type of static method objects.  This is the same object as
     *note staticmethod: 451. in the Python layer.

 -- C の関数: *note PyObject: 5df. *PyStaticMethod_New (PyObject
          *callable)

     Create a new *note staticmethod: 451. 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: ca0. 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(): 5436. の便利な代替です。 '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(): 430. and *note
          PySlice_AdjustIndices(): 431. 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: c59. 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: ca0. PyEllipsis_Type
     ' 次に属します: *note Stable ABI: 775.'  The type of Python *note
     Ellipsis: 2384. object.  Same as *note types.EllipsisType: a55. in
     the Python layer.

 -- C 変数: *note PyObject: 5df. *Py_Ellipsis

     Python の ‘Ellipsis’ オブジェクト。このオブジェクトにはメソッドがあ
     りません。 *note Py_None: 5223. と同様、これは *note immortal: 292.
     でシングルトンなオブジェクトです。

     バージョン 3.12 で変更: *note Py_Ellipsis: 57f0. は immortal です。


File: python.info,  Node: memoryview オブジェクト,  Next: Pickle buffer objects,  Prev: スライスオブジェクト slice object,  Up: その他のオブジェクト<2>

7.9.6.17 memoryview オブジェクト
................................

*note memoryview: 166. オブジェクトは、他のオブジェクトと同じように扱え
る Python オブジェクトの形をした C 言語レベルの *note
バッファのインターフェース: 262. です。

 -- C 変数: *note PyTypeObject: ca0. PyMemoryView_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: ca0. represents the Python memoryview type.  This is
     the same object as *note memoryview: 166. 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: 1a6d. か *note
     PyBUF_WRITE: 1a6e. のどちらかになります。

     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(): 138c. のほうが望ましいです。

 -- C の関数: *note PyObject: 5df. *PyMemoryView_GetContiguous (PyObject
          *obj, int buffertype, char order)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     buffer インターフェースを定義しているオブジェクトから ('C' か
     'F'ortran の 'order' で) *note 連続した: 1252. メモリチャンクへの
     memoryview オブジェクトを作ります。メモリが連続している場合、
     memoryview オブジェクトは元のメモリを参照します。それ以外の場合、メ
     モリはコピーされて、 memoryview オブジェクトは新しい bytes オブジェ
     クトを参照します。

     'buffertype' can be one of *note PyBUF_READ: 1a6d. or *note
     PyBUF_WRITE: 1a6e.

 -- C の関数: int PyMemoryView_Check (PyObject *obj)

     'obj' が memoryview オブジェクトの場合に真を返します。現在のところ
     、 *note memoryview: 166. のサブクラスの作成は許可されていません。
     この関数は常に成功します。

 -- C の関数: *note Py_buffer: 960. *PyMemoryView_GET_BUFFER (PyObject
          *mview)

     書きだされたバッファーの memoryview のプライベート コピーに、ポイン
     ターを返します。 'mview' は memoryview インスタンスでなければなりま
     せん; このマクロは型をチェックしないので自前で型チェックしなければ
     ならず、それを怠るとクラッシュする恐れがあります。

 -- C の関数: *note PyObject: 5df. *PyMemoryView_GET_BASE (PyObject
          *mview)

     memoryview をエクスポートしているオブジェクトへのポインタを返します
     。 memoryview が *note PyMemoryView_FromMemory(): 138c. か *note
     PyMemoryView_FromBuffer(): 969. のどちらかで作成されていた場合、
     ‘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: 17b6. object wraps a *note buffer-providing
object: 262. for out-of-band data transfer with the *note pickle: ab.
module.

 -- C 変数: *note PyTypeObject: ca0. PyPickleBuffer_Type

     This instance of *note PyTypeObject: ca0. represents the Python
     pickle buffer type.  This is the same object as *note
     pickle.PickleBuffer: 17b6. 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: 262.

     On success, return a new pickle buffer instance.  On failure, set
     an exception and return ‘NULL’.

     Analogous to calling *note pickle.PickleBuffer: 17b6. with 'obj' in
     Python.

 -- C の関数: const *note Py_buffer: 960. *PyPickleBuffer_GetBuffer
          (PyObject *picklebuf)

     Get a pointer to the underlying *note Py_buffer: 960. 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: 960.  If the pickle buffer has been
     released, raise *note ValueError: 2ee.

     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(): 2d98. 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, this will raise *note TypeError: 199.
     and return ‘NULL’.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 5667. 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' weakly
     referenceable object, this will raise *note TypeError: 199. and
     return ‘NULL’.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 5667. 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: 3d5. 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: 3d5.
          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.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyWeakref_GetRef(): 3dd. instead.

 -- C の関数: *note PyObject: 5df. *PyWeakref_GET_OBJECT (PyObject *ref)
     '戻り値: 借用参照。' Similar to *note PyWeakref_GetObject(): 3db,
     but does no error checking.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyWeakref_GetRef(): 3dd. 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: 5241. 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: 5241. handler for
     types with finalizers (i.e., *note __del__(): 1203.).  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 を提供する: 1579. を参照してください。

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: ca0. PyCapsule_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object
     corresponding to capsule objects.  This is the same object as *note
     types.CapsuleType: 2a68. in the Python layer.

 -- C のデータ型: type PyCapsule_Destructor
     ' 次に属します: *note Stable ABI: 775.'  カプセルに対するデストラク
     タコールバック型.  次のように定義されます:

          typedef void (*PyCapsule_Destructor)(PyObject *);

     PyCapsule_Destructor コールバックの動作については *note
     PyCapsule_New(): 5248. を参照してください。

 -- C の関数: int PyCapsule_CheckExact (PyObject *p)
     ' Thread safety: *note Atomic: 2786.'  引数が *note PyCapsule:
     148e. の場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyCapsule_New (void *pointer, const
          char *name, PyCapsule_Destructor destructor)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.''
     Thread safety: *note Atomic: 2786.'  'pointer' を格納する *note
     PyCapsule: 148e. を作成します。 'pointer' 引数は ‘NULL’ であっては
     なりません。

     失敗した場合、例外を設定して ‘NULL’ を返します。

     'name' 文字列は ‘NULL’ か、有効なC文字列へのポインタです。‘NULL’ で
     無い場合、この文字列は少なくともカプセルより長く生存する必要があり
     ます。('destructor' の中で解放することは許可されています)

     'destructor' が ‘NULL’ で無い場合、カプセルが削除されるときにそのカ
     プセルを引数として呼び出されます。

     このカプセルがモジュールの属性として保存される場合、 'name' は
     ‘modulename.attributename’ と指定されるべきです。こうすると、他のモ
     ジュールがそのカプセルを *note PyCapsule_Import(): 1c6d. でインポー
     トすることができます。

 -- C の関数: void *PyCapsule_GetPointer (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  カプセルに保存されている '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: 5318. PyCapsule_GetDestructor
          (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  カプセルに保存されている現在のデストラクタを返します。失敗
     した場合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ をデストラクタとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1578. か *note PyErr_Occurred(): 1d0a. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_GetContext (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  カプセルに保存されている現在のコンテキスト(context)を返しま
     す。失敗した場合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ をコンテキストとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1578. か *note PyErr_Occurred(): 1d0a. を利用
     して確認してください。

 -- C の関数: const char *PyCapsule_GetName (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  カプセルに保存されている現在の name を返します。失敗した場
     合、例外を設定して ‘NULL’ を返します。

     カプセルは ‘NULL’ を name として持つことができます。従って、戻り値
     の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1578. か *note PyErr_Occurred(): 1d0a. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_Import (const char *name, int no_block)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call from multiple threads with external synchronization only:
     277a.'  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(): 3da.) 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.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  'capsule' が有効なカプセルであるかどうかをチェックします。
     有効な 'capsule' は、非 ‘NULL’ で、 *note PyCapsule_CheckExact():
     580a. をパスし、非 ‘NULL’ なポインタを格納していて、内部の name が
     引数 'name' とマッチします。 (name の比較方法については *note
     PyCapsule_GetPointer(): 531c. を参照)

     In other words, if *note PyCapsule_IsValid(): 1578. 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.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  'capsule' 内部のコンテキストポインタを 'context' に設定しま
     す。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetDestructor (PyObject *capsule,
          PyCapsule_Destructor destructor)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  'capsule' 内部のデストラクタを 'destructor' に設定します。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetName (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  'capsule' 内部の name を 'name' に設定します。'name' が非
     ‘NULL’ のとき、それは 'capsule' よりも長い寿命を持つ必要があります
     。もしすでに 'capsule' に非 ‘NULL’ の 'name' が保存されていた場合、
     それに対する解放は行われません。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetPointer (PyObject *capsule, void
          *pointer)
     ' 次に属します: *note Stable ABI: 775.''  Thread safety: *note Safe
     to call without external synchronization on distinct objects:
     277f.'  '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: 98f.
     for details.

The *note PyEval_GetFrame(): 1b98. and *note PyThreadState_GetFrame():
995. functions can be used to get a frame object.

See also *note Reflection: 55e6.

 -- C 変数: *note PyTypeObject: ca0. PyFrame_Type

     The type of frame objects.  It is the same object as *note
     types.FrameType: 1c4b. in the Python layer.

     バージョン 3.11 で変更: Previously, this type was only available
     after including ‘<frameobject.h>’.

 -- C の関数: *note PyFrameObject: 990. *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: 990. *PyFrame_GetBack (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame' next outer frame.

     Return a *note strong reference: 5e2, or ‘NULL’ if 'frame' has no
     outer frame.  This raises no exceptions.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetBuiltins (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_builtins: 23fb.
     attribute.

     Return a *note strong reference: 5e2.  The result cannot be ‘NULL’.

     Added in version 3.11.

 -- C の関数: *note PyCodeObject: 97f. *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: 23fa.
     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: a8c. 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: 450. and return ‘NULL’ if the variable
          does not exist.

        * Raise an exception and return ‘NULL’ on error.

     'name' type must be a *note str: 16a.

     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: 580e.

 -- 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: 8f0. 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: ca0. 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: 23f.  As of Python 3.13, they do
nothing.  They exist solely for backwards compatibility.

 -- C の関数: void PyFrame_LocalsToFast (PyFrameObject *f, int clear)

     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.

     *note Soft deprecated: 23f. since version 3.13: This function now
     does nothing.

 -- C の関数: void PyFrame_FastToLocals (PyFrameObject *f)

     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.

     *note Soft deprecated: 23f. since version 3.13: This function now
     does nothing.

 -- C の関数: int PyFrame_FastToLocalsWithError (PyFrameObject *f)

     Prior to Python 3.13, this function was similar to *note
     PyFrame_FastToLocals(): 5813, but would return ‘0’ on success, and
     ‘-1’ with an exception set on failure.

     *note Soft deprecated: 23f. since version 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(): 581d. や *note PyGen_NewWithQualName(): 581e. の明示的な呼
び出しではなく、値を yield する関数のイテレーションにより生成されます。

 -- C のデータ型: type PyGenObject

     ジェネレータオブジェクトに使われている C 構造体です。

 -- C 変数: *note PyTypeObject: ca0. PyGen_Type

     ジェネレータオブジェクトに対応する型オブジェクトです。

 -- C の関数: int PyGen_Check (PyObject *ob)

     'ob' がジェネレータオブジェクトの場合に真を返ます、 'ob' は ‘NULL’
     であってはなりません。この関数は常に成功します。

 -- C の関数: int PyGen_CheckExact (PyObject *ob)

     'ob' が *note PyGen_Type: 5820. の場合に真を返します。 '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: 97f. *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<4>.


File: python.info,  Node: Asynchronous Generator Objects,  Next: Deprecated API<4>,  Up: ジェネレータオブジェクト

7.9.6.26 Asynchronous Generator Objects
.......................................

参考
....

PEP 525(1)

 -- C 変数: *note PyTypeObject: ca0. PyAsyncGen_Type

     The type object corresponding to asynchronous generator objects.
     This is available as *note types.AsyncGeneratorType: 2a5d. 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<4>,  Prev: Asynchronous Generator Objects,  Up: ジェネレータオブジェクト

7.9.6.27 Deprecated API
.......................

 -- C のマクロ: PyAsyncGenASend_CheckExact (op)

     This is a *note soft deprecated: 23f. 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: ca0. PyCoro_Type

     コルーチンオブジェクトに対応する型オブジェクト。

 -- C の関数: int PyCoro_CheckExact (PyObject *ob)

     'ob' が *note PyCoro_Type: 582e. の場合に真を返します。 '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: 5834, *note PyContextVar: 5835, *note
     PyContextToken: 5836. の代わりに *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: 178. オブジェクトを表現するための C 構造
     体。

 -- C のデータ型: type PyContextVar

     *note contextvars.ContextVar: 18da. オブジェクトを表現するための C
     構造体。

 -- C のデータ型: type PyContextToken

     *note contextvars.Token: 1e4. オブジェクトを表現するための C 構造体
     。

 -- C 変数: *note PyTypeObject: ca0. PyContext_Type

     'コンテキスト' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: ca0. PyContextVar_Type

     'コンテキスト変数' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: ca0. PyContextToken_Type

     'コンテキスト変数トークン' 型を表現する型オブジェクト。

型チェックマクロ:

 -- C の関数: int PyContext_CheckExact (PyObject *o)

     'o' が *note PyContext_Type: 5837. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextVar_CheckExact (PyObject *o)

     'o' が *note PyContextVar_Type: 5838. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextToken_CheckExact (PyObject *o)

     'o' が *note PyContextToken_Type: 5839. の場合に真を返します。 '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(): 19f2.  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(): 19f1. 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: 19c4. has
          switched to a different context.  The object passed to the
          watch callback is the now-current *note contextvars.Context:
          178. object, or None if no context is current.

     Added in version 3.14.

 -- C のデータ型: typedef int (*PyContext_WatchCallback)(*note
          PyContextEvent: 5842. event, *note PyObject: 5df. *obj)

     Context object watcher callback function.  The object passed to the
     callback is event-specific; see *note PyContextEvent: 5842. 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(): 5846. が呼ばれる前の状態に戻します。 この関数は
     成功したら ‘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: 8c2. and *note Union: 9c9.  Only
‘GenericAlias’ is exposed to C.

 -- C の関数: *note PyObject: 5df. *Py_GenericAlias (PyObject *origin,
          PyObject *args)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     *note GenericAlias: 8c2. オブジェクトを生成します。Pythonクラス
     *note types.GenericAlias: 9f0. を呼び出すことと同等です。引数
     'origin' と 'args' は ‘GenericAlias’ の ‘__origin__’ および
     ‘__args__’ 属性をそれぞれ設定します。 'origin' は *note
     PyTypeObject: ca0.* でなければならず、 'args' は *note
     PyTupleObject: 55a8.* または任意の ‘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, "my_obj is generic over its contained type"}
              ...
          }

     参考
     ....

     The data model method *note __class_getitem__(): 947.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: ca0. Py_GenericAliasType
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     *note Py_GenericAlias(): 54b0. により返されるCの型オブジェクトです
     。Pythonの *note types.GenericAlias: 9f0. と同等です。

     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(): 584f. must
be invoked, usually as part of the module initialisation function, to
populate *note PyCurses_API: 5850.

     警告: 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: 5850. pointer.

     On failure, set *note PyCurses_API: 5850. to NULL and set an
     exception.  The caller must check if an error occurred via *note
     PyErr_Occurred(): 1d0a.:

          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: 584f.
     succeeds.

     ‘PyCurses_API[0]’ corresponds to *note PyCursesWindow_Type: 5851.

     ‘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(): 3543, *note curses.initscr(): 196f, and *note
     curses.start_color(): 3548. have been called respectively.

     See also the convenience macros *note PyCursesSetupTermCalled:
     5852, *note PyCursesInitialised: 5853, and *note
     PyCursesInitialisedColor: 5854.

          注釈: The number of entries in this structure is subject to
          changes.  Consider using *note PyCurses_API_pointers: 5855. to
          check if new fields are available or not.

 -- C のマクロ: PyCurses_API_pointers

     The number of accessible fields (‘4’) in *note PyCurses_API: 5850.
     This number is incremented whenever new fields are added.

 -- C 変数: *note PyTypeObject: ca0. PyCursesWindow_Type

     The *note heap type: b62. corresponding to *note curses.window:
     12ab.

 -- C の関数: int PyCursesWindow_Check (PyObject *op)

     Return true if 'op' is a *note curses.window: 12ab. 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(): 3543. 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(): 196f. 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(): 3548. 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():
     1c6d.

     Internal usage only.  Use *note import_curses: 584f. 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: 585c. マクロを、通常はモジ
ュール初期化関数から、起動しておく必要があります。このマクロは以下のマク
ロで使われる静的変数 *note PyDateTimeAPI: 585d. に C 構造体へのポインタ
を入れます。

 -- C のマクロ: PyDateTime_IMPORT ()

     Import the datetime C API.

     On success, populate the *note PyDateTimeAPI: 585d. pointer.  On
     failure, set ‘PyDateTimeAPI’ to ‘NULL’ and set an exception.  The
     caller must check if an error occurred via *note PyErr_Occurred():
     1d0a.:

          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: 585e. *PyDateTimeAPI

     Dynamically allocated object containing the datetime C API.

     This variable is only available once *note PyDateTime_IMPORT: 585c.
     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: ca0. PyDateTime_DateType

     この *note PyTypeObject: ca0. のインスタンスは Python の date 型を
     表します; Python レイヤにおける *note datetime.date: 1fc. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: ca0. PyDateTime_DateTimeType

     この *note PyTypeObject: ca0. のインスタンスは Python の datetime 型
     を表現します; Python レイヤにおける *note datetime.datetime: 4e2. と
     同じオブジェクトです。

 -- C 変数: *note PyTypeObject: ca0. PyDateTime_TimeType

     この *note PyTypeObject: ca0. のインスタンスは Python の time 型を
     表します; Python レイヤにおける *note datetime.time: 1fd. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: ca0. PyDateTime_DeltaType

     This instance of *note PyTypeObject: ca0. represents the Python
     type for the difference between two datetime values; it is the same
     object as *note datetime.timedelta: bc7. in the Python layer.

 -- C 変数: *note PyTypeObject: ca0. PyDateTime_TZInfoType

     この *note PyTypeObject: ca0. のインスタンスは 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: 5863. 型か ‘PyDateTime_DateType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyDate_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateType: 5863. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDateTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 5864. 型か
     ‘PyDateTime_DateTimeType’ 型のサブタイプのオブジェクトの場合に真を
     返します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功し
     ます。

 -- C の関数: int PyDateTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 5864. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 5865. 型か ‘PyDateTime_TimeType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 5865. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDelta_Check (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 5866. 型か
     ‘PyDateTime_DeltaType’ 型のサブタイプのオブジェクトの場合に真を返し
     ます; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功します
     。

 -- C の関数: int PyDelta_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 5866. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTZInfo_Check (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 5867. 型か
     ‘PyDateTime_TZInfoType’ 型のサブタイプのオブジェクトの場合に真を返
     します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功しま
     す。

 -- C の関数: int PyTZInfo_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 5867. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

以下はオブジェクトを作成するためのマクロです:

 -- C の関数: *note PyObject: 5df. *PyDate_FromDate (int year, int
          month, int day)
     '戻り値: 新しい参照。' 指定した年、月、日の *note datetime.date:
     1fc. オブジェクトを返します。

 -- 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: 1fd. オブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyTime_FromTimeAndFold (int hour,
          int minute, int second, int usecond, int fold)
     '戻り値: 新しい参照。' 指定された時、分、秒、マイクロ秒、fold の
     *note datetime.time: 1fd. オブジェクトを返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyDelta_FromDSU (int days, int
          seconds, int useconds)
     '戻り値: 新しい参照。' 指定された日、秒、マイクロ秒の *note
     datetime.timedelta: bc7. オブジェクトを返します。マイクロ秒と秒が
     ‘datetime.timedelta’ オブジェクトで定義されている範囲に入るように正
     規化を行います。

 -- C の関数: *note PyObject: 5df. *PyTimeZone_FromOffset (PyObject
          *offset)
     '戻り値: 新しい参照。' 'offset' 引数で指定した固定オフセットを持つ
     、名前のない *note datetime.timezone: 12d9. オブジェクトを返します
     。

     Added in version 3.7.

 -- C の関数: *note PyObject: 5df. *PyTimeZone_FromOffsetAndName
          (PyObject *offset, PyObject *name)
     '戻り値: 新しい参照。' 'offset*引数で指定した固定のオフセットと、
     *name' のタイムゾーン名を持つ *note datetime.timezone: 12d9. オブジ
     ェクトを返します。

     Added in version 3.7.

以下のマクロは date オブジェクトからフィールド値を取り出すためのものです
。引数は *note PyDateTime_Date: 585f. またはそのサブクラス (例えば *note
PyDateTime_DateTime: 5860.)の インスタンスでなければなりません。引数を
‘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: 5860. またはそのサブクラスのイン
スタンスでなければなりません。引数を ‘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: 5861. またはそのサブクラスのインスタンス
でなければなりません。引数を ‘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: 5862. かそのサブクラスのインスタ
ンスでなければなりません。引数を ‘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:
     1fc. object given an argument tuple suitable for passing to *note
     datetime.date.fromtimestamp(): dd1.


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():
     1c6d.

     Internal usage only.  Use *note PyDateTime_IMPORT: 585c. instead.


File: python.info,  Node: インタープリタの初期化と終了処理,  Next: Thread states and the global interpreter lock,  Prev: 具象オブジェクト concrete object レイヤ,  Up: Python/C API reference manual

7.10 インタープリタの初期化と終了処理
=====================================

See *note Python Initialization Configuration: 646. for details on how
to configure the interpreter prior to initialization.

* Menu:

* Before Python initialization::
* グローバルな設定変数::
* インタープリタの初期化と終了処理: インタープリタの初期化と終了処理<2>.
* Cautions regarding runtime finalization::
* プロセスワイドのパラメータ::


File: python.info,  Node: Before Python initialization,  Next: グローバルな設定変数,  Up: インタープリタの初期化と終了処理

7.10.1 Before Python initialization
-----------------------------------

In an application embedding Python, the *note Py_Initialize(): 45e.
function must be called before using any other Python/C API functions;
with the exception of a few functions and the *note global configuration
variables: 5890.

次の関数は Python の初期化の前でも安全に呼び出せます:

   * Functions that initialize the interpreter:

        * *note Py_Initialize(): 45e.

        * *note Py_InitializeEx(): 54b8.

        * *note Py_InitializeFromConfig(): 3f4.

        * *note Py_BytesMain(): bbc.

        * *note Py_Main(): e22.

        * the runtime pre-initialization functions covered in *note
          Python 初期化設定: 646.

   * 設定関数:

        * *note PyImport_AppendInittab(): 1b7b.

        * *note PyImport_ExtendInittab(): 1b7c.

        * ‘PyInitFrozenExtensions()’

        * *note PyMem_SetAllocator(): 7a8.

        * *note PyMem_SetupDebugHooks(): e68.

        * *note PyObject_SetArenaAllocator(): 5891.

        * *note Py_SetProgramName(): 1a13.

        * *note Py_SetPythonHome(): 1a12.

        * the configuration functions covered in *note Python
          初期化設定: 646.

   * 情報取得の関数:

        * *note Py_IsInitialized(): 52d6.

        * *note PyMem_GetAllocator(): 5892.

        * *note PyObject_GetArenaAllocator(): 5893.

        * *note Py_GetBuildInfo(): 1650.

        * *note Py_GetCompiler(): 54b2.

        * *note Py_GetCopyright(): 54b3.

        * *note Py_GetPlatform(): 54b4.

        * *note Py_GetVersion(): 54b6.

        * *note Py_IsInitialized(): 52d6.

   * ユーティリティ:

        * *note Py_DecodeLocale(): dc4.

        * 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(): dc5,
     *note PyEval_InitThreads(): 1a16, and *note Py_RunMain(): bc0.


File: python.info,  Node: グローバルな設定変数,  Next: インタープリタの初期化と終了処理<2>,  Prev: Before Python initialization,  Up: インタープリタの初期化と終了処理

7.10.2 グローバルな設定変数
---------------------------

Python には、様々な機能やオプションを制御するグローバルな設定のための変
数があります。 デフォルトでは、これらのフラグは *note
コマンドラインオプション: 2176. で制御されます。

オプションでフラグがセットされると、フラグの値はそのオプションがセットさ
れた回数になります。 例えば、 ‘-b’ では *note Py_BytesWarningFlag: 404.
が 1 に設定され、 ‘-bb’ では ‘Py_BytesWarningFlag’ が 2 に設定されます。

 -- C 変数: int Py_BytesWarningFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.bytes_warning: 405. should be used instead, see *note
     Python Initialization Configuration: 646.

     *note bytes: 193. または *note bytearray: 342. を *note str: 16a. と
     比較した場合、または、 ‘bytes’ を *note int: 19c. と比較した場合に
     警告を発生させます。 ‘2’ 以上の値を設定している場合は、エラーを発生
     させます。

     *note -b: 7f9. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_DebugFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.parser_debug: 3f7. should be used instead, see *note
     Python Initialization Configuration: 646.

     パーサーのデバッグ出力を有効にします。(専門家専用です。コンパイルオ
     プションに依存します)。

     *note -d: 217e. オプションと *note PYTHONDEBUG: 217f. 環境変数で設
     定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_DontWriteBytecodeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.write_bytecode: 40b. should be used instead, see *note
     Python Initialization Configuration: 646.

     非ゼロに設定した場合、Python はソースモジュールのインポート時に
     ‘.pyc’ ファイルの作成を試みません。

     *note -B: 15eb. オプションと *note PYTHONDONTWRITEBYTECODE: 15ec. 環
     境変数で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_FrozenFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.pathconfig_warnings: 407. should be used instead, see
     *note Python Initialization Configuration: 646.

     ‘_freeze_module’ プログラムと ‘frozenmain’ プログラムが使用する非公
     開フラグです。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_HashRandomizationFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.hash_seed: 412. and *note PyConfig.use_hash_seed: 411.
     should be used instead, see *note Python Initialization
     Configuration: 646.

     *note PYTHONHASHSEED: 128d. 環境変数が空でない文字列に設定された場
     合に、 ‘1’ が設定されます。

     フラグがゼロでない場合、 *note PYTHONHASHSEED: 128d. 環境変数を読み
     シークレットハッシュシードを初期化します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_IgnoreEnvironmentFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.use_environment: 409. should be used instead, see *note
     Python Initialization Configuration: 646.

     Ignore all ‘PYTHON*’ environment variables, e.g.  *note PYTHONPATH:
     1223. and *note PYTHONHOME: 3ee, that might be set.

     *note -E: b5a. オプションと *note -I: b5b. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_InspectFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.inspect: 3ff. should be used instead, see *note Python
     Initialization Configuration: 646.

     最初の引数にスクリプトが指定されたときや *note -c: 1a9. オプション
     が利用された際に、 *note sys.stdin: 75f. がターミナルに出力されない
     ときであっても、スクリプトかコマンドを実行した後にインタラクティブ
     モードに入ります。

     *note -i: 16f9. オプションと *note PYTHONINSPECT: 16f8. 環境変数で
     設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_InteractiveFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.interactive: 3fd. should be used instead, see *note Python
     Initialization Configuration: 646.

     *note -i: 16f9. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_IsolatedFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.isolated: 414. should be used instead, see *note Python
     Initialization Configuration: 646.

     Python を隔離モードで実行します。 隔離モードでは *note sys.path:
     3e2. はスクリプトのディレクトリやユーザのサイトパッケージのディレク
     トリを含みません。

     *note -I: b5b. オプションで設定します。

     Added in version 3.4.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_LegacyWindowsFSEncodingFlag

     This API is kept for backward compatibility: setting *note
     PyPreConfig.legacy_windows_fs_encoding: 416. 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: 33d. 環境変数が空でない文字列
     に設定された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 529(1) を参照してください。

     *note Availability: 2199.: Windows.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_LegacyWindowsStdioFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.legacy_windows_stdio: 418. should be used instead, see
     *note Python Initialization Configuration: 646.

     If the flag is non-zero, use *note io.FileIO: 152b. instead of
     ‘io._WindowsConsoleIO’ for *note sys: df. standard streams.

     *note PYTHONLEGACYWINDOWSSTDIO: e59. 環境変数が空でない文字列に設定
     された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 528(2) を参照してください。

     *note Availability: 2199.: Windows.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_NoSiteFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.site_import: 403. should be used instead, see *note Python
     Initialization Configuration: 646.

     *note site: cc. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 3e2. への操作を無効にします。後で
     ‘site’ を明示的に import しても、これらの操作は実行されません (実行
     したい場合は、 *note site.main(): 2182. を呼び出してください)。

     *note -S: 13c4. オプションで設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_NoUserSiteDirectory

     This API is kept for backward compatibility: setting *note
     PyConfig.user_site_directory: 40d. should be used instead, see
     *note Python Initialization Configuration: 646.

     *note ユーザのサイトパッケージのディレクトリ: 2181. を *note
     sys.path: 3e2. に追加しません。

     *note -s: 15aa. オプション、 *note -I: b5b. 、 *note
     PYTHONNOUSERSITE: 15ab. 環境変数で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_OptimizeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.optimization_level: 401. should be used instead, see *note
     Python Initialization Configuration: 646.

     *note -O: 18d. オプションと *note PYTHONOPTIMIZE: 2180. 環境変数で
     設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_QuietFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.quiet: 3fb. should be used instead, see *note Python
     Initialization Configuration: 646.

     インタラクティブモードでも copyright とバージョンのメッセージを表示
     しません。

     *note -q: 17ee. オプションで設定します。

     Added in version 3.2.

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_UnbufferedStdioFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.buffered_stdio: 40f. should be used instead, see *note
     Python Initialization Configuration: 646.

     標準出力と標準エラーをバッファリングしないように強制します。

     *note -u: 1deb. オプションと *note PYTHONUNBUFFERED: 1dec. 環境変数
     で設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

 -- C 変数: int Py_VerboseFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.verbose: 3f9. should be used instead, see *note Python
     Initialization Configuration: 646.

     モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファ
     イル名やビルトインモジュール) からロードされたのかを表示します。 値
     が 2 以上の場合は、モジュールを検索するときにチェックしたファイルご
     とにメッセージを出力します。また、終了時のモジュールクリーンアップ
     に関する情報も提供します。

     *note -v: 1643. オプションと *note PYTHONVERBOSE: 2183. 環境変数で
     設定します。

     バージョン 3.12 で非推奨、バージョン 3.15 で削除予定.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0529/

   (2) https://peps.python.org/pep-0528/


File: python.info,  Node: インタープリタの初期化と終了処理<2>,  Next: Cautions regarding runtime finalization,  Prev: グローバルな設定変数,  Up: インタープリタの初期化と終了処理

7.10.3 インタープリタの初期化と終了処理
---------------------------------------

 -- C の関数: void Py_Initialize ()
     ' 次に属します: *note Stable ABI: 775.'

     Initialize the Python interpreter.  In an application embedding
     Python, this should be called before using any other Python/C API
     functions; see *note Before Python Initialization: dc2. for the few
     exceptions.

     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(): f15. first).  There is no return value; it is a
     fatal error if the initialization fails.

     Use *note Py_InitializeFromConfig(): 3f4. 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(): 45e. 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(): 3f4. to customize the *note
     Python Initialization Configuration: 646.

 -- C の関数: *note PyStatus: ba8. Py_InitializeFromConfig (const
          PyConfig *config)

     Initialize Python from 'config' configuration, as described in
     *note Initialization with PyConfig: 5896.

     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(): f15. を呼び出した後は、*note Py_Initialize(): 45e.
     を再び呼び出すまで、この関数は偽を返します。

 -- 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(): 45e. and
     subsequent use of Python/C API functions, and destroy all
     sub-interpreters (see *note Py_NewInterpreter(): 1b90. below) that
     were created and not yet destroyed since the last call to
     ‘Py_Initialize()’.  This is a no-op when called for a second time
     (without calling ‘Py_Initialize()’ again first).

     Since this is the reverse of *note Py_Initialize(): 45e, 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(): bc0. 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(): 45e.  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__(): 1203. 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(): 45e. and *note Py_FinalizeEx(): f15. more than
     once.  ‘Py_FinalizeEx()’ 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 監査イベント: 1ccb.
     ‘cpython._PySys_ClearAuditHooks’ を送出します。

     Added in version 3.6.

 -- C の関数: void Py_Finalize ()
     ' 次に属します: *note Stable ABI: 775.'  この関数は *note
     Py_FinalizeEx(): f15. の後方互換性バージョンで、戻り値がありません
     。

 -- C の関数: int Py_BytesMain (int argc, char **argv)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'
     Similar to *note Py_Main(): e22. 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 コマンドライン: 120d.

     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(): dc4.  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(): bc0.

     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(): 45e, *note
     Py_InitializeEx(): 54b8. or *note Py_InitializeFromConfig(): 3f4.
     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: 5897.), the
     script (*note PyConfig.run_filename: 5898.) or the module (*note
     PyConfig.run_module: 5899.) 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: 3ff. 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: f40, or ‘1’ for any other unhandled exception.

     If *note PyConfig.inspect: 3ff. is set (such as when the *note -i:
     16f9. 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: f40, as specified above.

     This function always finalizes the Python interpreter before it
     returns.

     See *note Python Configuration: 589a. for an example of a
     customized Python that always runs in isolated mode using *note
     Py_RunMain(): bc0.

 -- 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(): 54ad, but takes an
     explicit interpreter and data pointer for the callback.

     There must be an *note attached thread state: 5256. for 'interp'.

     Added in version 3.13.


File: python.info,  Node: Cautions regarding runtime finalization,  Next: プロセスワイドのパラメータ,  Prev: インタープリタの初期化と終了処理<2>,  Up: インタープリタの初期化と終了処理

7.10.4 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: bc9.) and running the *note atexit: d.
functions, the runtime is marked as 'finalizing': *note
Py_IsFinalizing(): 5fd. and *note sys.is_finalizing(): c84. return true.
At this point, only the 'finalization thread' that initiated
finalization (typically the main thread) is allowed to acquire the *note
GIL: 165.

If any thread, other than the finalization thread, attempts to attach a
*note thread state: 18ab. 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: 18ab. C APIs have never had any error reporting or
handling expectations at thread state 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: プロセスワイドのパラメータ,  Prev: Cautions regarding runtime finalization,  Up: インタープリタの初期化と終了処理

7.10.5 プロセスワイドのパラメータ
---------------------------------

 -- C の関数: void Py_SetProgramName (const wchar_t *name)
     ' 次に属します: *note Stable ABI: 775.'

     This API is kept for backward compatibility: setting *note
     PyConfig.program_name: 3f0. should be used instead, see *note
     Python Initialization Configuration: 646.

     This function should be called before *note Py_Initialize(): 45e.
     is called for the first time, if it is called at all.  It tells the
     interpreter the value of the ‘argv[0]’ argument to the ‘main()’
     function of the program (converted to wide characters).  This is
     used by *note Py_GetPath(): 3e1. and some other functions below to
     find the Python run-time libraries relative to the interpreter
     executable.  The default value is ‘'python'’.  The argument should
     point to a zero-terminated wide character string in static storage
     whose contents will not change for the duration of the program's
     execution.  No code in the Python interpreter will change the
     contents of this storage.

     Use *note Py_DecodeLocale(): dc4. to decode a bytes string to get a
     wchar_t* string.

     バージョン 3.11 で非推奨、バージョン 3.15 で削除予定.

 -- C の関数: wchar_t *Py_GetProgramName ()
     ' 次に属します: *note Stable ABI: 775.'  Return the program name
     set with *note PyConfig.program_name: 3f0, 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():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
     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: 3f0. 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: 21a9. 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():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("base_prefix"): 37a. (*note sys.base_prefix: 3e4.)
     instead.  Use ‘PyConfig_Get("prefix")’ (*note sys.prefix: 3e5.) if
     *note virtual environments: 3e6. 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: 3f0. 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.

     Background: The exec-prefix differs from the prefix when platform
     dependent files (such as executables and shared libraries) are
     installed in a different directory tree.  In a typical
     installation, platform dependent files may be installed in the
     ‘/usr/local/plat’ subtree while platform independent may be
     installed in ‘/usr/local’.

     Generally speaking, a platform is a combination of hardware and
     software families, e.g.  Sparc machines running the Solaris 2.x
     operating system are considered the same platform, but Intel
     machines running Solaris 2.x are another platform, and Intel
     machines running Linux are yet another platform.  Different major
     revisions of the same operating system generally also form
     different platforms.  Non-Unix operating systems are a different
     story; the installation strategies on those systems are so
     different that the prefix and exec-prefix are meaningless, and set
     to the empty string.  Note that compiled Python bytecode files are
     platform independent (but not independent from the Python version
     by which they were compiled!).

     System administrators will know how to configure the ‘mount’ or
     ‘automount’ programs to share ‘/usr/local’ between platforms while
     having ‘/usr/local/plat’ be a different filesystem for each
     platform.

     This function should not be called before *note Py_Initialize():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("base_exec_prefix"): 37a. (*note sys.base_exec_prefix:
     3e8.) instead.  Use ‘PyConfig_Get("exec_prefix")’ (*note
     sys.exec_prefix: 3e9.) if *note virtual environments: 3e6. 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:
     3f0.).  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():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
     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: 3f0.) 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:
     3e2. 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():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("module_search_paths"): 37a. (*note sys.path: 3e2.)
     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: 37f. 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.'  Return information about
     the sequence number and build date and time of the current Python
     interpreter instance, for example

          "#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: 3ef, *note PyConfig.parse_argv: 1d4f. and *note
     PyConfig.safe_path: 97b. should be used instead, see *note Python
     Initialization Configuration: 646.

     'argc' および 'argv' に基づいて *note sys.argv: 1480. を設定します
     。これらの引数はプログラムの ‘main()’ に渡した引数に似ていますが、
     最初の要素が Python インタプリタの宿主となっている実行形式の名前で
     はなく、実行されるスクリプト名を参照しなければならない点が違います
     。実行するスクリプトがない場合、 'argv' の最初の要素は空文字列にし
     てもかまいません。この関数が ‘sys.argv’ の初期化に失敗した場合、致
     命的エラーを *note Py_FatalError(): b7e. で知らせます。

     'updatepath' が 0 の場合、ここまでの動作がこの関数がすることの全て
     です。 'updatepath' が 0 でない場合、この関数は *note sys.path:
     3e2. を以下のアルゴリズムに基づいて修正します:

        - 存在するスクリプトの名前が ‘argv[0]’ に渡された場合、そのスク
          リプトがある場所の絶対パスを *note sys.path: 3e2. の先頭に追加
          します。

        - それ以外の場合 ('argc' が ‘0’ だったり、 ‘argv[0]’ が存在する
          ファイル名を指していない場合)、 *note sys.path: 3e2. の先頭に
          空の文字列を追加します。 これは現在の作業ディレクトリ (‘"."’)
          を先頭に追加するのと同じです。

     Use *note Py_DecodeLocale(): dc4. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: a98. and *note PyConfig.argv:
     3ef. 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: 3e2.
          themselves if desired.  See CVE 2008-5983(1).

          3.1.3 より前のバージョンでは、 *note PySys_SetArgv(): 1a15. の
          呼び出しが完了した後に *note sys.path: 3e2. の先頭の要素を取り
          出すことで、同じ効果が得られます。例えばこのように使います:

               PyRun_SimpleString("import sys; sys.path.pop(0)\n");

     Added in version 3.1.3.

     バージョン 3.11 で非推奨、バージョン 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: 3ef. and *note
     PyConfig.parse_argv: 1d4f. should be used instead, see *note Python
     Initialization Configuration: 646.

     この関数は、 ‘python’ インタプリタが *note -I: b5b. オプション付き
     で実行されている場合を除き *note PySys_SetArgvEx(): 1a14. の
     'updatepath' に ‘1’ を設定したのと同じように動作します。

     Use *note Py_DecodeLocale(): dc4. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: a98. and *note PyConfig.argv:
     3ef. members of the *note Python Initialization Configuration: 646.

     バージョン 3.4 で変更: 'updatepath' の値は *note -I: b5b. オプショ
     ンに依存します。

     バージョン 3.11 で非推奨、バージョン 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: 3f1. should be
     used instead, see *note Python Initialization Configuration: 646.

     Python の標準ライブラリがある、デフォルトの "home" ディレクトリを設
     定します。引数の文字列の意味については *note PYTHONHOME: 3ee. を参
     照してください。

     引数は静的なストレージに置かれてプログラム実行中に書き換えられない
     ようなゼロ終端の文字列であるべきです。Python インタプリタはこのスト
     レージの内容を変更しません。

     Use *note Py_DecodeLocale(): dc4. to decode a bytes string to get a
     wchar_t* string.

     バージョン 3.11 で非推奨、バージョン 3.15 で削除予定.

 -- C の関数: wchar_t *Py_GetPythonHome ()
     ' 次に属します: *note Stable ABI: 775.'  Return the default "home",
     that is, the value set by *note PyConfig.home: 3f1, or the value of
     the *note PYTHONHOME: 3ee. environment variable if it is set.

     This function should not be called before *note Py_Initialize():
     45e, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 45e.

     バージョン 3.13 で非推奨、バージョン 3.15 で削除予定: Use *note
     PyConfig_Get("home"): 37a. or the *note PYTHONHOME: 3ee.
     environment variable instead.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2008-5983


File: python.info,  Node: Thread states and the global interpreter lock,  Next: Asynchronous notifications,  Prev: インタープリタの初期化と終了処理,  Up: Python/C API reference manual

7.11 Thread states and the global interpreter lock
==================================================

Unless on a *note free-threaded build: 17b0. of *note CPython: 906, the
Python interpreter is generally not 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: 165, that must be held by a
thread before accessing 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.

As such, only a thread that holds the GIL may operate on Python objects
or invoke Python's C API.

In order to emulate concurrency, the interpreter regularly tries to
switch threads between bytecode instructions (see *note
sys.setswitchinterval(): b48.).  This is why locks are also necessary
for thread-safety in pure-Python code.

Additionally, the global interpreter lock is released around blocking
I/O operations, such as reading or writing to a file.  From the C API,
this is done by *note detaching the thread state: 58a2.

The Python interpreter keeps some thread-local information inside a data
structure called *note PyThreadState: 994, known as a *note thread
state: 18ab.  Each thread has a thread-local pointer to a
‘PyThreadState’; a thread state referenced by this pointer is considered
to be *note attached: 5256.

A thread can only have one *note attached thread state: 5256. at a time.
An attached thread state is typically analogous with holding the GIL,
except on free-threaded builds.  On builds with the GIL enabled,
attaching a thread state will block until the GIL can be acquired.
However, even on builds with the GIL disabled, it is still required to
have an attached thread state, as the interpreter needs to keep track of
which threads may access Python objects.

     注釈: Even on the free-threaded build, attaching a thread state may
     block, as the GIL can be re-enabled or threads might be temporarily
     suspended (such as during a garbage collection).

Generally, there will always be an attached thread state when using
Python's C API, including during embedding and when implementing
methods, so it's uncommon to need to set up a thread state on your own.
Only in some specific cases, such as in a *note Py_BEGIN_ALLOW_THREADS:
5242. block or in a fresh thread, will the thread not have an attached
thread state.  If uncertain, check if *note
PyThreadState_GetUnchecked(): 421. returns ‘NULL’.

If it turns out that you do need to create a thread state, call *note
PyThreadState_New(): 5448. followed by *note PyThreadState_Swap(): 5449,
or use the dangerous *note PyGILState_Ensure(): 64a. function.

* Menu:

* Detaching the thread state from extension code::
* Non-Python created threads::
* Legacy API::
* Cautions about fork(): Cautions about fork.
* 高水準 API::
* GIL-state APIs::
* 低水準 API::


File: python.info,  Node: Detaching the thread state from extension code,  Next: Non-Python created threads,  Up: Thread states and the global interpreter lock

7.11.1 Detaching the thread state from extension code
-----------------------------------------------------

Most extension code manipulating the *note thread state: 18ab. 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: 5242. マクロは新たなブロックを開始し、隠し
ローカル変数を宣言します; *note Py_END_ALLOW_THREADS: c83. はブロックを
閉じます。

上のブロックは次のコードに展開されます:

     PyThreadState *_save;

     _save = PyEval_SaveThread();
     ... Do some blocking I/O operation ...
     PyEval_RestoreThread(_save);

Here is how these functions work:

The attached thread state implies that the GIL is held for the
interpreter.  To detach it, *note PyEval_SaveThread(): 647. is called
and the result is stored in a local variable.

By detaching the thread state, the GIL is released, which allows other
threads to attach to the interpreter and execute while the current
thread performs blocking I/O. When the I/O operation is complete, the
old thread state is reattached by calling *note PyEval_RestoreThread():
648, which will wait until the GIL can be acquired.

     注釈: Performing blocking I/O is the most common use case for
     detaching the thread state, but it is also useful to call it over
     long-running native code that doesn't need access to Python objects
     or Python's C API. For example, the standard *note zlib: 13a. and
     *note hashlib: 6c. modules detach the *note thread state: 5256.
     when compressing or hashing data.

On a *note free-threaded build: 17b0, the *note GIL: 165. is usually out
of the question, but 'detaching the thread state is still required',
because the interpreter periodically needs to block all threads to get a
consistent view of Python objects without the risk of race conditions.
For example, CPython currently suspends all threads for a short period
of time while running the garbage collector.

     警告: Detaching the thread state can lead to unexpected behavior
     during interpreter finalization.  See *note Cautions regarding
     runtime finalization: 589b. for more details.

* Menu:

* APIs::


File: python.info,  Node: APIs,  Up: Detaching the thread state from extension code

7.11.1.1 APIs
.............

以下のマクロは、通常末尾にセミコロンを付けずに使います; Python ソース配
布物内の使用例を見てください。

     注釈: These macros are still necessary on the *note free-threaded
     build: 17b0. to prevent deadlocks.

 -- C のマクロ: Py_BEGIN_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると ‘{
     PyThreadState *_save; _save = PyEval_SaveThread();’ になります。マ
     クロに開き波括弧が入っていることに注意してください; この波括弧は後
     で *note Py_END_ALLOW_THREADS: c83. マクロと対応させなければなりま
     せん。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_END_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save); }’ になります。マクロに開き波括弧が入
     っていることに注意してください; この波括弧は事前の *note
     Py_BEGIN_ALLOW_THREADS: 5242. マクロと対応していなければなりません
     。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_BLOCK_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save);’ になります: 閉じ波括弧のない *note
     Py_END_ALLOW_THREADS: c83. と同じです。

 -- C のマクロ: Py_UNBLOCK_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘_save = PyEval_SaveThread();’ になります: 開き波括弧のない *note
     Py_BEGIN_ALLOW_THREADS: 5242. と同じです。


File: python.info,  Node: Non-Python created threads,  Next: Legacy API,  Prev: Detaching the thread state from extension code,  Up: Thread states and the global interpreter lock

7.11.2 Non-Python created threads
---------------------------------

When threads are created using the dedicated Python APIs (such as the
*note threading: f3. module), a thread state is automatically associated
with them, However, when a thread is created from native code (for
example, by a third-party library with its own thread management), it
doesn't hold an attached thread state.

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 a new thread state and attaching it.

The most robust way to do this is through *note PyThreadState_New():
5448. followed by *note PyThreadState_Swap(): 5449.

     注釈: ‘PyThreadState_New’ requires an argument pointing to the
     desired interpreter; such a pointer can be acquired via a call to
     *note PyInterpreterState_Get(): 64c. from the code where the thread
     was created.

例えば:

     /* The return value of PyInterpreterState_Get() from the
        function that created this thread. */
     PyInterpreterState *interp = thread_data->interp;

     /* Create a new thread state for the interpreter. It does not start out
        attached. */
     PyThreadState *tstate = PyThreadState_New(interp);

     /* Attach the thread state, which will acquire the GIL. */
     PyThreadState_Swap(tstate);

     /* 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();

     警告: If the interpreter finalized before ‘PyThreadState_Swap’ was
     called, then ‘interp’ will be a dangling pointer!


File: python.info,  Node: Legacy API,  Next: Cautions about fork,  Prev: Non-Python created threads,  Up: Thread states and the global interpreter lock

7.11.3 Legacy API
-----------------

Another common pattern to call Python code from a non-Python thread is
to use *note PyGILState_Ensure(): 64a. followed by a call to *note
PyGILState_Release(): 64b.

These functions do not work well when multiple interpreters exist in the
Python process.  If no Python interpreter has ever been used in the
current thread (which is common for threads created outside Python),
‘PyGILState_Ensure’ will create and attach a thread state for the "main"
interpreter (the first interpreter in the Python process).

Additionally, these functions have thread-safety issues during
interpreter finalization.  Using ‘PyGILState_Ensure’ during finalization
will likely crash the process.

Usage of these functions look like such:

     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);


File: python.info,  Node: Cautions about fork,  Next: 高水準 API,  Prev: Legacy API,  Up: Thread states and the global interpreter lock

7.11.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: 36c1. 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 ‘os.fork()’ (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(): 42e. 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: 994.
objects belonging to the current interpreter and all other *note
PyInterpreterState: abe. objects.  Due to this and the special nature of
the *note "main" interpreter: 164, ‘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: 高水準 API,  Next: GIL-state APIs,  Prev: Cautions about fork,  Up: Thread states and the global interpreter lock

7.11.5 高水準 API
-----------------

These are the most commonly used types and functions when writing
multi-threaded C extensions.

 -- 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: abe. *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(): 45e. から
     呼び出されるようになり、わざわざ呼び出す必要はもう無くなりました。

     バージョン 3.2 で変更: この関数は *note Py_Initialize(): 45e. より
     前に呼び出すことができなくなりました。

     バージョン 3.9 で非推奨.

 -- C の関数: *note PyThreadState: 994. *PyEval_SaveThread ()
     ' 次に属します: *note Stable ABI: 775.'  Detach the *note attached
     thread state: 5256. and return it.  The thread will have no *note
     thread state: 18ab. upon returning.

 -- C の関数: void PyEval_RestoreThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Set the *note attached
     thread state: 5256. to 'tstate'.  The passed *note thread state:
     18ab. 'should not' be attached, 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: 589b. for more
          details.

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

 -- C の関数: *note PyThreadState: 994. *PyThreadState_Get ()
     ' 次に属します: *note Stable ABI: 775.'  Return the *note attached
     thread state: 5256.  If the thread has no attached thread state,
     (such as when inside of *note Py_BEGIN_ALLOW_THREADS: 5242. block),
     then this issues a fatal error (so that the caller needn't check
     for ‘NULL’).

     See also *note PyThreadState_GetUnchecked(): 421.

 -- C の関数: *note PyThreadState: 994. *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: 994. *PyThreadState_Swap
          (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Set the *note attached
     thread state: 5256. to 'tstate', and return the *note thread state:
     18ab. that was attached prior to calling.

     This function is safe to call without an *note attached thread
     state: 5256.; it will simply return ‘NULL’ indicating that there
     was no prior thread state.

     参考
     ....

     *note PyEval_ReleaseThread(): 5363.

          注釈: Similar to *note PyGILState_Ensure(): 64a, this function
          will hang the thread if the runtime is finalizing.


File: python.info,  Node: GIL-state APIs,  Next: 低水準 API,  Prev: 高水準 API,  Up: Thread states and the global interpreter lock

7.11.6 GIL-state APIs
---------------------

The following functions use thread-local storage, and are not compatible
with sub-interpreters:

 -- 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: 53b3. 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: 5256.  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 ‘PyGILState_Release()’ 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: 5242. and *note Py_END_ALLOW_THREADS: c83.
     macros is acceptable.

     The return value is an opaque "handle" to the *note attached thread
     state: 5256. 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
     ‘PyGILState_Ensure()’ must save the handle for its call to
     ‘PyGILState_Release()’.

     When the function returns, there will be an *note attached thread
     state: 5256. 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: 589b.
          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.'  Release any resources
     previously acquired.  After this call, Python's state will be the
     same as it was prior to the corresponding *note
     PyGILState_Ensure(): 64a. call (but generally this state will be
     unknown to the caller, hence the use of the GILState API).

     *note PyGILState_Ensure(): 64a. を呼び出す場合は、必ず同一スレッド
     内で対応する *note PyGILState_Release(): 64b. を呼び出してください
     。

 -- C の関数: *note PyThreadState: 994. *PyGILState_GetThisThreadState
          ()
     ' 次に属します: *note Stable ABI: 775.'  Get the *note attached
     thread state: 5256. 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: 18ab. is detached.  Prefer *note
          PyThreadState_Get(): 615. or *note
          PyThreadState_GetUnchecked(): 421. for most cases.

     参考
     ....

     *note PyThreadState_Get(): 615.

 -- C の関数: int PyGILState_Check ()

     Return ‘1’ if the current thread is holding the *note GIL: 165. and
     ‘0’ otherwise.  This function can be called from any thread at any
     time.  Only if it has had its *note thread state: 5256. 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 GIL 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(): 421. for most
          cases.

     Added in version 3.4.


File: python.info,  Node: 低水準 API,  Prev: GIL-state APIs,  Up: Thread states and the global interpreter lock

7.11.7 低水準 API
-----------------

 -- C の関数: *note PyThreadState: 994. *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: 5256. is not needed.

 -- C の関数: void PyThreadState_Clear (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Reset all information in a
     *note thread state: 18ab. object.  'tstate' must be *note attached:
     5256.

     バージョン 3.9 で変更: This function now calls the
     ‘PyThreadState.on_delete’ callback.  Previously, that happened in
     *note PyThreadState_Delete(): 1de7.

     バージョン 3.13 で変更: The ‘PyThreadState.on_delete’ callback was
     removed.

 -- C の関数: void PyThreadState_Delete (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Destroy a *note thread
     state: 18ab. object.  'tstate' should not be *note attached: 5256.
     to any thread.  'tstate' must have been reset with a previous call
     to *note PyThreadState_Clear(): 19f0.

 -- C の関数: void PyThreadState_DeleteCurrent (void)

     Detach the *note attached thread state: 5256. (which must have been
     reset with a previous call to *note PyThreadState_Clear(): 19f0.)
     and then destroy it.

     No *note thread state: 18ab. will be *note attached: 5256. upon
     returning.

 -- C の関数: *note PyFrameObject: 990. *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(): 1b98.

     'tstate' must not be ‘NULL’, and must be *note attached: 5256.

     Added in version 3.9.

 -- C の関数: uint64_t PyThreadState_GetID (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Get the unique *note thread state: 18ab. identifier of the Python
     thread state 'tstate'.

     'tstate' must not be ‘NULL’, and must be *note attached: 5256.

     Added in version 3.9.

 -- C の関数: *note PyInterpreterState: abe.
          *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: 5256.

     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(): 95f.
     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(): 95e. function.

     See also *note PyEval_SetTrace(): 663. and *note
     PyEval_SetProfile(): 171b. 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: 5583. for C code by
     raising *note RecursionError: f6c. when it notices that the machine
     execution stack is close to overflow.  See for example the *note
     Py_EnterRecursiveCall(): 3d0. 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(): 464. to inform CPython
     of the change.

     Call *note PyUnstable_ThreadState_SetStackProtection(): 464. 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(): 465. for
     undoing this operation.

     Added in version 3.15.

 -- 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(): 464. for an
     explanation.

     Added in version 3.15.

 -- 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: 18ab. is *note attached: 5256.  If this
     function returns ‘NULL’, no exception has been raised and the
     caller should assume no thread state is attached.

 -- C の関数: void PyEval_AcquireThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  *note Attach: 5256.
     'tstate' to the current thread, which must not be ‘NULL’ or already
     attached.

     The calling thread must not already have an *note attached thread
     state: 5256.

          注釈: 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: 589b. for more
          details.

     バージョン 3.8 で変更: Updated to be consistent with *note
     PyEval_RestoreThread(): 648, *note Py_END_ALLOW_THREADS(): c83, 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: 5256.  The 'tstate' argument, which must not be
     ‘NULL’, is only used to check that it represents the attached
     thread state -- if it isn't, a fatal error is reported.

     *note PyEval_SaveThread(): 647. はより高レベルな関数で常に (スレッ
     ドが初期化されていないときでも) 利用できます。


File: python.info,  Node: Asynchronous notifications,  Next: Operating system thread APIs,  Prev: Thread states and the global interpreter lock,  Up: Python/C API reference manual

7.12 Asynchronous notifications
===============================

インタプリタのメインスレッドに非同期な通知を行うために提供されている仕組
みです。これらの通知は関数ポインタと 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:
          5256. ('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: 5256. is
     detached.

     This function doesn't need an *note attached thread state: 5256.
     However, to call this function in a subinterpreter, the caller must
     have an attached thread state.  Otherwise, the function 'func' can
     be scheduled to be called from the wrong interpreter.

          警告: This is a low-level function, only useful for very
          special cases.  There is no guarantee that 'func' will be
          called as quick as possible.  If the main thread is busy
          executing a system call, 'func' won't be called before the
          system call returns.  This function is generally 'not'
          suitable for calling Python code from arbitrary C threads.
          Instead, use the *note PyGILState API: 58a6.

     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: 5256.

     Added in version 3.1.

     バージョン 3.12 で変更: This function only runs pending calls in
     the main interpreter.

 -- 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: 5256.  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 へ変
     更されました。


File: python.info,  Node: Operating system thread APIs,  Next: 同期プリミティブ<3>,  Prev: Asynchronous notifications,  Up: Python/C API reference manual

7.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: 58b2.

     The caller does not need to hold an *note attached thread state:
     5256.

 -- 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: 5256.

     参考
     ....

     *note threading.get_ident(): 1376.

 -- 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: 13db. object.  This information is accessible as
     *note sys.thread_info: 136c. 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: 5256.

 -- 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: 58b3. is defined.

     This function cannot fail, and the caller does not need to hold an
     *note attached thread state: 5256.

     参考
     ....

     *note threading.get_native_id(): c36.

 -- 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:
     5256.

 -- 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:
     5256.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/pthread_exit(3)


File: python.info,  Node: 同期プリミティブ<3>,  Next: Thread-local storage support,  Prev: Operating system thread APIs,  Up: Python/C API reference manual

7.14 同期プリミティブ
=====================

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)
     ' Thread safety: *note Atomic: 2786.'  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: 5256. if one exists.

     Added in version 3.13.

 -- C の関数: void PyMutex_Unlock (PyMutex *m)
     ' Thread safety: *note Atomic: 2786.'  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)
     ' Thread safety: *note Atomic: 2786.'  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.14.1 Python critical section API
----------------------------------

The critical section API provides a deadlock avoidance layer on top of
per-object locks for *note free-threaded: 1f6. 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: 24f. and *note dict: 184. because their public
C-APIs already use critical sections internally, with the notable
exception of *note PyDict_Next(): 19ee, 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
‘PyObject’ 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: 58b9.  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: 572e, 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-object 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: 58b9, 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.14.2 Legacy locking APIs
--------------------------

These APIs are obsolete since Python 3.13 with the introduction of *note
PyMutex: 484.

 -- 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: 58bf. 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:
     5256.

 -- 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:
     5256.

 -- C の関数: *note PyLockStatus: 58c0. 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: 58c1.  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:
     58c3.  Upon interruption, it's generally expected that the caller
     makes a call to *note Py_MakePendingCalls(): 54b9. to propagate an
     exception to Python code.

     If the lock is successfully acquired, this function returns *note
     PY_LOCK_ACQUIRED: 58c2.

     The caller does not need to hold an *note attached thread state:
     5256.

 -- 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(): 544c, acquiring the
     lock cannot be interrupted by a signal.

     The caller does not need to hold an *note attached thread state:
     5256.

 -- 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:
     5256.


File: python.info,  Node: Thread-local storage support,  Next: Multiple interpreters in a Python process,  Prev: 同期プリミティブ<3>,  Up: Python/C API reference manual

7.15 Thread-local storage support
=================================

The Python interpreter provides low-level support for thread-local
storage (TLS) which wraps the underlying native TLS implementation to
support the Python-level thread-local storage API (*note
threading.local: 18c4.).  The CPython C level APIs are similar to those
offered by pthreads and Windows: use a thread key and functions to
associate a void* value per thread.

A *note thread state: 18ab. does 'not' need to be *note attached: 5256.
when calling these functions; they supply their own locking.

‘Python.h’ は TLS API の宣言を include せず、スレッドローカルストレージ
を使うには ‘pythread.h’ を include する必要があることに注意してください
。

     注釈: この API 関数はどれも void* 値の代わりにメモリ管理を行うこと
     はしません。 メモリの確保と解放は自前で行う必要があります。 void* 値
     がたまたま *note PyObject: 5df.* だった場合は、 API 関数はそれぞれ
     の値の参照カウントの操作は行いません。

* Menu:

* Thread-specific storage API::
* Dynamic allocation::
* メソッド: メソッド<2>.
* Legacy APIs::


File: python.info,  Node: Thread-specific storage API,  Next: Dynamic allocation,  Up: Thread-local storage support

7.15.1 Thread-specific storage API
----------------------------------

The thread-specific storage (TSS) API was introduced to supersede the
use of the existing TLS API within the CPython interpreter.  This API
uses a new type *note Py_tss_t: cda. instead of int to represent thread
keys.

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: 58c9. による静的メモリ確保ができます。

 -- C のマクロ: Py_tss_NEEDS_INIT

     このマクロは *note Py_tss_t: cda. 変数の初期化子に展開されます。 こ
     のマクロは *note Py_LIMITED_API: 775. があるときは定義されません。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0539/


File: python.info,  Node: Dynamic allocation,  Next: メソッド<2>,  Prev: Thread-specific storage API,  Up: Thread-local storage support

7.15.2 Dynamic allocation
-------------------------

動的な *note Py_tss_t: cda. のメモリ確保は *note Py_LIMITED_API: 775. で
ビルドされた拡張モジュールで必要になりますが、その実装がビルド時に不透明
なために、この型の静的なメモリ確保は不可能です。

 -- C の関数: *note Py_tss_t: cda. *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: 58c9, 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(): 436,
     after first calling *note PyThread_tss_delete(): 43e. 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>,  Next: Legacy APIs,  Prev: Dynamic allocation,  Up: Thread-local storage support

7.15.3 メソッド
---------------

The parameter 'key' of these functions must not be ‘NULL’.  Moreover,
the behaviors of *note PyThread_tss_set(): 43a. and *note
PyThread_tss_get(): 43c. are undefined if the given *note Py_tss_t: cda.
has not been initialized by *note PyThread_tss_create(): 5455.

 -- 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: cda. has been
     initialized by *note PyThread_tss_create(): 5455.

 -- 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: 58c9.  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(): 5455.  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: Legacy APIs,  Prev: メソッド<2>,  Up: Thread-local storage support

7.15.4 Legacy APIs
------------------

バージョン 3.7 で非推奨: This API is superseded by the *note
thread-specific storage (TSS) API: cd9.

     注釈: 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(): 435. 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: Multiple interpreters in a Python process,  Next: Profiling and tracing,  Prev: Thread-local storage support,  Up: Python/C API reference manual

7.16 Multiple interpreters in a Python process
==============================================

ほとんどの場合は埋め込む Python インタプリタは1つだけですが、いくつかの
場合に同一プロセス内、あるいは同一スレッド内で、複数の独立したインタプリ
タを作成する必要があります。 これを可能にするのがサブインタプリタです。

"メイン" インタプリタとは、ランタイムが初期化を行ったときに最初に作成さ
れたインタプリタのことです。 サブインタプリタと違い、メインインタプリタ
にはシグナルハンドリングのような、プロセス全域で唯一な責務があります。 メ
インインタプリタにはランタイムの初期化中の処理実行という責務もあり、通常
はランタイムの終了処理中に動いているランタイムでもあります。 *note
PyInterpreterState_Main(): 58d0. 関数は、メインインタプリタの状態へのポ
インタを返します。

サブインタプリタを切り替えが *note PyThreadState_Swap(): 5449. 関数でで
きます。 次の関数を使ってサブインタプリタの作成と削除が行えます:

 -- 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: 58d1.
          must be ‘1’ (non-zero).  If this is ‘1’ then *note gil: 58d2.
          must not be *note PyInterpreterConfig_OWN_GIL: 58d3.

      -- 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(): 3094.) 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: 58d6. 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:
          54d7.)

          This must be ‘1’ (non-zero) if *note use_main_obmalloc: 4c9c.
          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: 58d9.).

           -- 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: 58d3. then *note
          PyInterpreterConfig.use_main_obmalloc: 4c9c. must be ‘0’.

 -- C の関数: *note PyStatus: ba8. 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: 18ab. created in the new sub-interpreter.  This thread state
     is *note attached: 5256.  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
     attached thread state, which might not exist.

     Like all other Python/C API functions, an *note attached thread
     state: 5256. must be present before calling this function, but it
     might be detached upon returning.  On success, the returned thread
     state will be attached.  If the sub-interpreter is created with its
     own *note GIL: 165. then the attached thread state of the calling
     interpreter will be detached.  When the function returns, the new
     interpreter's *note thread state: 18ab. will be attached to the
     current thread and the previous interpreter's attached thread state
     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: abe. values.  A read-only
     copy of the config may be stored internally on the
     ‘PyInterpreterState’.

     Extension modules are shared between (sub-)interpreters as follows:

        * For modules using multi-phase initialization, e.g.  *note
          PyModule_FromDefAndSpec(): 10b7, 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 legacy *note single-phase initialization:
          5592, e.g.  *note PyModule_Create(): 559b, 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: 58da. 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():
          f15. and *note Py_Initialize(): 45e.; 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: 994. *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: 18ab.  The given thread state must be *note attached: 5256.
     When the call returns, there will be no attached thread state.  All
     thread states associated with this interpreter are destroyed.

     *note Py_FinalizeEx(): f15. will destroy all sub-interpreters that
     haven't been explicitly destroyed at that point.

* Menu:

* A per-interpreter GIL::
* バグと注意事項::
* 高水準 API: 高水準 API<2>.
* 低水準 API: 低水準 API<2>.
* Advanced debugger support::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: A per-interpreter GIL,  Next: バグと注意事項,  Up: Multiple interpreters in a Python process

7.16.1 A per-interpreter GIL
----------------------------

Added in version 3.12.

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: 292.  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.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0554/

   (2) https://peps.python.org/pep-0684/


File: python.info,  Node: バグと注意事項,  Next: 高水準 API<2>,  Prev: A per-interpreter GIL,  Up: Multiple interpreters in a Python process

7.16.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(): d6f. 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: 高水準 API<2>,  Next: 低水準 API<2>,  Prev: バグと注意事項,  Up: Multiple interpreters in a Python process

7.16.3 高水準 API
-----------------

 -- C のデータ型: type PyInterpreterState
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  こ
     のデータ構造体は、協調動作する多数のスレッド間で共有されている状態
     を表現します。同じインタプリタに属するスレッドはモジュール管理情報
     やその他いくつかの内部的な情報を共有しています。この構造体には公開
     (public) のメンバはありません。

     異なるインタプリタに属するスレッド間では、利用可能なメモリ、開かれ
     ているファイルデスクリプタなどといったプロセス状態を除いて、初期状
     態では何も共有されていません。GILもまた、スレッドがどのインタプリタ
     に属しているかに関わらずすべてのスレッドで共有されています。

     バージョン 3.12 で変更: PEP 684(1) introduced the possibility of a
     *note per-interpreter GIL: 58dc.  See *note
     Py_NewInterpreterFromConfig(): 689.

 -- C の関数: *note PyInterpreterState: abe. *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:
     5256.  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: 5256.

     Added in version 3.7.

 -- C の関数: *note PyObject: 5df. *PyInterpreterState_GetDict
          (PyInterpreterState *interp)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.8 より).'  インタプリタ固有のデータを保持している辞書を返し
     ます。 この関数が ‘NULL’ を返した場合は、ここまでで例外は送出されて
     おらず、呼び出し側はインタプリタ固有の辞書は利用できないと考えなけ
     ればなりません。

     この関数は *note PyModule_GetState(): b7b. を置き換えるものではなく
     、拡張モジュールがインタプリタ固有の状態情報を格納するのに使うべき
     ものです。

     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: 994. *tstate,
          *note _PyInterpreterFrame: 19ce. *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: 97e.
          _PyInterpreterState_GetEvalFrameFunc (PyInterpreterState
          *interp)

     Get the frame evaluation function.

     See the PEP 523(2) "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(3) "Adding a frame evaluation API to CPython".

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0684/

   (2) https://peps.python.org/pep-0523/

   (3) https://peps.python.org/pep-0523/


File: python.info,  Node: 低水準 API<2>,  Next: Advanced debugger support,  Prev: 高水準 API<2>,  Up: Multiple interpreters in a Python process

7.16.4 低水準 API
-----------------

次の全ての関数は *note Py_Initialize(): 45e. の後に呼び出さなければなり
ません。

バージョン 3.7 で変更: *note Py_Initialize(): 45e. now initializes the
*note GIL: 165. and sets an *note attached thread state: 5256.

 -- C の関数: *note PyInterpreterState: abe. *PyInterpreterState_New ()
     ' 次に属します: *note Stable ABI: 775.'  Create a new interpreter
     state object.  An *note attached thread state: 5256. is not needed,
     but may optionally exist if it is necessary to serialize calls to
     this function.

     引数無しで *note 監査イベント: 1ccb.
     ‘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: 5256. for the interpreter.

     引数無しで *note 監査イベント: 1ccb.
     ‘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: 5256. for the target interpreter.  The interpreter state
     must have been reset with a previous call to *note
     PyInterpreterState_Clear(): 4ad8.


File: python.info,  Node: Advanced debugger support,  Prev: 低水準 API<2>,  Up: Multiple interpreters in a Python process

7.16.5 Advanced debugger support
--------------------------------

以下の関数は高度なデバッグツールでの使用のためだけのものです。

 -- C の関数: *note PyInterpreterState: abe. *PyInterpreterState_Head ()

     インタプリタ状態オブジェクトからなるリストのうち、先頭にあるものを
     返します。

 -- C の関数: *note PyInterpreterState: abe. *PyInterpreterState_Main ()

     メインインタプリタの状態オブジェクトを返します。

 -- C の関数: *note PyInterpreterState: abe. *PyInterpreterState_Next
          (PyInterpreterState *interp)

     インタプリタ状態オブジェクトからなるリストのうち、'interp' の次にあ
     るものを返します。

 -- C の関数: *note PyThreadState: 994. *PyInterpreterState_ThreadHead
          (PyInterpreterState *interp)

     インタプリタ 'interp' に関連付けられているスレッドからなるリストの
     うち、先頭にある *note PyThreadState: 994. オブジェクトを返します。

 -- C の関数: *note PyThreadState: 994. *PyThreadState_Next
          (PyThreadState *tstate)

     'tstate' と同じ *note PyInterpreterState: abe. オブジェクトに属して
     いるスレッド状態オブジェクトのうち、 'tstate' の次にあるものを返し
     ます。


File: python.info,  Node: Profiling and tracing,  Next: Reference tracing,  Prev: Multiple interpreters in a Python process,  Up: Python/C API reference manual

7.17 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: 990. *frame, int what, *note PyObject:
          5df. *arg)

     The type of the trace function registered using *note
     PyEval_SetProfile(): 171b. 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: 58e6, *note
     PyTrace_EXCEPTION: 58e7, *note PyTrace_LINE: 58e8, *note
     PyTrace_RETURN: 58e9, *note PyTrace_C_CALL: 58ea, *note
     PyTrace_C_EXCEPTION: 58eb, *note PyTrace_C_RETURN: 58ec, or *note
     PyTrace_OPCODE: 58ed, and 'arg' depends on the value of 'what':

     'what' の値                         'arg' の意味
                                         
     ---------------------------------------------------------------------------------
                                         
     *note PyTrace_CALL: 58e6.           常に *note Py_None: 5223. 。
                                         
                                         
     *note PyTrace_EXCEPTION: 58e7.      *note sys.exc_info(): 89b. の返す例外情報
                                         です。
                                         
                                         
     *note PyTrace_LINE: 58e8.           常に *note Py_None: 5223. 。
                                         
                                         
     *note PyTrace_RETURN: 58e9.         呼び出し側に返される予定の値か、例外によっ
                                         て関数を抜ける場合は ‘NULL’ です。
                                         
                                         
     *note PyTrace_C_CALL: 58ea.         呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_EXCEPTION: 58eb.    呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_RETURN: 58ec.       呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_OPCODE: 58ed.         常に *note Py_None: 5223. 。
                                         

 -- C 変数: int PyTrace_CALL

     関数やメソッドが新たに呼び出されたり、ジェネレータが新たなエントリ
     の処理に入ったことを報告する際の、 *note Py_tracefunc: 58e5. の
     'what' の値です。イテレータやジェネレータ関数の生成は、対応するフレ
     ーム内の Python バイトコードに制御の委譲 (control transfer) が起こ
     らないため報告されないので注意してください。

 -- C 変数: int PyTrace_EXCEPTION

     The value of the 'what' parameter to a *note Py_tracefunc: 58e5.
     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:
     58e5. 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: dda. to '0' on that frame.

 -- C 変数: int PyTrace_RETURN

     呼び出しが返るときに *note Py_tracefunc: 58e5. 関数に 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_C_CALL

     C関数を呼び出す直前に *note Py_tracefunc: 58e5. 関数の 'what' 引数
     として渡す値です。

 -- C 変数: int PyTrace_C_EXCEPTION

     C関数が例外を送出したときに *note Py_tracefunc: 58e5. 関数の 'what'
     引数として渡す値です。

 -- C 変数: int PyTrace_C_RETURN

     C関数から戻るときに *note Py_tracefunc: 58e5. 関数の 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_OPCODE

     The value for the 'what' parameter to *note Py_tracefunc: 58e5.
     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: ddb. 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: 58e8.
     *note PyTrace_OPCODE: 58ed. and *note PyTrace_EXCEPTION: 58e7.

     *note sys.setprofile(): 171c. 関数も参照してください。

     The caller must have an *note attached thread state: 5256.

 -- C の関数: void PyEval_SetProfileAllThreads (Py_tracefunc func,
          PyObject *obj)

     Like *note PyEval_SetProfile(): 171b. 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: 5256.

     As *note PyEval_SetProfile(): 171b, 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(): 171b, 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: 58ea, *note PyTrace_C_EXCEPTION:
     58eb. or *note PyTrace_C_RETURN: 58ec. as a value for the 'what'
     parameter.

     *note sys.settrace(): 2e3. 関数も参照してください。

     The caller must have an *note attached thread state: 5256.

 -- 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: 5256.

     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: Python 初期化設定,  Prev: Profiling and tracing,  Up: Python/C API reference manual

7.18 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: 58f0.) or about to be destroyed (when 'event'
     is set to *note PyRefTracer_DESTROY: 58f1.).  The 'data' argument
     is the opaque pointer that was provided when
     ‘PyRefTracer_SetTracer()’ was called.

     If a new tracing function is registered replacing the current one,
     a call to the trace function will be made with the object set to
     'NULL' and 'event' set to *note PyRefTracer_TRACKER_REMOVED: 58f2.
     This will happen just before the new function is registered.

Added in version 3.13.

 -- C 変数: int PyRefTracer_CREATE

     The value for the 'event' parameter to *note PyRefTracer: 58ef.
     functions when a Python object has been created.

 -- C 変数: int PyRefTracer_DESTROY

     The value for the 'event' parameter to *note PyRefTracer: 58ef.
     functions when a Python object has been destroyed.

 -- C 変数: int PyRefTracer_TRACKER_REMOVED

     The value for the 'event' parameter to *note PyRefTracer: 58ef.
     functions when the current tracer is about to be replaced by a new
     one.

     Added in version 3.14.

 -- C の関数: int PyRefTracer_SetTracer (PyRefTracer tracer, void *data)

     Register a reference tracer function.  The function will be called
     when a new Python object 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: 18ab. will be active every time the tracer function
     is called.

     There must be an *note attached thread state: 5256. when calling
     this function.

     If another tracer function was already registered, the old function
     will be called with 'event' set to *note
     PyRefTracer_TRACKER_REMOVED: 58f2. just before the new function is
     registered.

Added in version 3.13.

 -- C の関数: *note PyRefTracer: 58ef. 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: 5256. when calling
     this function.

Added in version 3.13.


File: python.info,  Node: Python 初期化設定,  Next: メモリ管理,  Prev: Reference tracing,  Up: Python/C API reference manual

7.19 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.19.1 PyInitConfig C API
-------------------------

Added in version 3.14.

Python は *note Py_InitializeFromInitConfig(): 384. で初期化できます。

*note Py_RunMain(): bc0. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 588c. も参照してくださ
い。

参考
....

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.19.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.19.1.2 設定の作成
...................

 -- C Struct: struct PyInitConfig

     Python の初期化を構成するための不透明な構造体です。

 -- C の関数: *note PyInitConfig: 58f9. *PyInitConfig_Create (void)

     Create a new initialization configuration using *note Isolated
     Configuration: 58fa. default values.

     It must be freed by *note PyInitConfig_Free(): 386.

     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.19.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.19.1.4 Get Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
58fd.

 -- 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.19.1.5 Set Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
58fd.

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.19.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(): 1b7b. function.


File: python.info,  Node: Initialize Python,  Prev: Module,  Up: PyInitConfig C API

7.19.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.19.2 Configuration Options
----------------------------

オプション                    PyConfig/PyPreConfig member   型                            可視性
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
‘"allocator"’                 *note allocator: 5902.        ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"argv"’                      *note argv: 3ef.              ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"base_exec_prefix"’          *note base_exec_prefix: 5903. ‘str’                         Public
                                                                                          
                                                                                          
‘"base_executable"’           *note base_executable: 5904.  ‘str’                         Public
                                                                                          
                                                                                          
‘"base_prefix"’               *note base_prefix: 5905.      ‘str’                         Public
                                                                                          
                                                                                          
‘"buffered_stdio"’            *note buffered_stdio: 40f.    ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"bytes_warning"’             *note bytes_warning: 405.     ‘int’                         Public
                                                                                          
                                                                                          
‘"check_hash_pycs_mode"’      *note check_hash_pycs_mode: 5906.‘str’                      読み出し専用
                                                                                          
                                                                                          
‘"code_debug_ranges"’         *note code_debug_ranges: 5907.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale"’           *note coerce_c_locale: 5908.  ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale_warn"’      *note coerce_c_locale_warn: 5909.‘bool’                     読み出し専用
                                                                                          
                                                                                          
‘"configure_c_stdio"’         *note configure_c_stdio: 590a.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"configure_locale"’          *note configure_locale: 590b. ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"cpu_count"’                 *note cpu_count: 590c.        ‘int’                         Public
                                                                                          
                                                                                          
‘"dev_mode"’                  *note dev_mode: 590d.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs"’                 *note dump_refs: 590e.        ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs_file"’            *note dump_refs_file: 590f.   ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"exec_prefix"’               *note exec_prefix: 5910.      ‘str’                         Public
                                                                                          
                                                                                          
‘"executable"’                *note executable: 645.        ‘str’                         Public
                                                                                          
                                                                                          
‘"faulthandler"’              *note faulthandler: 5911.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_encoding"’       *note filesystem_encoding: 419.‘str’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_errors"’         *note filesystem_errors: 41a. ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"hash_seed"’                 *note hash_seed: 412.         ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"home"’                      *note home: 3f1.              ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"import_time"’               *note import_time: 5912.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"inspect"’                   *note inspect: 3ff.           ‘bool’                        Public
                                                                                          
                                                                                          
‘"install_signal_handlers"’   *note install_signal_handlers: abf.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"int_max_str_digits"’        *note int_max_str_digits: 5913.‘int’                        Public
                                                                                          
                                                                                          
‘"interactive"’               *note interactive: 3fd.       ‘bool’                        Public
                                                                                          
                                                                                          
‘"isolated"’                  *note isolated: 414.          ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_fs_encoding"’*note legacy_windows_fs_encoding: 416.‘bool’                読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_stdio"’      *note legacy_windows_stdio: 418.‘bool’                      読み出し専用
                                                                                          
                                                                                          
‘"malloc_stats"’              *note malloc_stats: 5914.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"module_search_paths"’       *note module_search_paths: 643.‘list[str]’                  Public
                                                                                          
                                                                                          
‘"optimization_level"’        *note optimization_level: 401.‘int’                         Public
                                                                                          
                                                                                          
‘"orig_argv"’                 *note orig_argv: a98.         ‘list[str]’                   読み出し専用
                                                                                          
                                                                                          
‘"parse_argv"’                *note parse_argv: 1d4f.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"parser_debug"’              *note parser_debug: 3f7.      ‘bool’                        Public
                                                                                          
                                                                                          
‘"pathconfig_warnings"’       *note pathconfig_warnings: 407.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"perf_profiling"’            *note perf_profiling: 5915.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"platlibdir"’                *note platlibdir: 1d7f.       ‘str’                         Public
                                                                                          
                                                                                          
‘"prefix"’                    *note prefix: 5916.           ‘str’                         Public
                                                                                          
                                                                                          
‘"program_name"’              *note program_name: 3f0.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"pycache_prefix"’            *note pycache_prefix: 5917.   ‘str’                         Public
                                                                                          
                                                                                          
‘"quiet"’                     *note quiet: 3fb.             ‘bool’                        Public
                                                                                          
                                                                                          
‘"run_command"’               *note run_command: 5897.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_filename"’              *note run_filename: 5898.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_module"’                *note run_module: 5899.       ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_presite"’               *note run_presite: 5918.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"safe_path"’                 *note safe_path: 97b.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"show_ref_count"’            *note show_ref_count: 5919.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"site_import"’               *note site_import: 403.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"skip_source_first_line"’    *note skip_source_first_line: 591a.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"stdio_encoding"’            *note stdio_encoding: 644.    ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdio_errors"’              *note stdio_errors: 4cac.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdlib_dir"’                *note stdlib_dir: 591b.       ‘str’                         Public
                                                                                          
                                                                                          
‘"tracemalloc"’               *note tracemalloc: 591c.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"use_environment"’           *note use_environment: 409.   ‘bool’                        Public
                                                                                          
                                                                                          
‘"use_frozen_modules"’        *note use_frozen_modules: 591d.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"use_hash_seed"’             *note use_hash_seed: 411.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"use_system_logger"’         *note use_system_logger: 22cd.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"user_site_directory"’       *note user_site_directory: 40d.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"utf8_mode"’                 *note utf8_mode: 41b.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"verbose"’                   *note verbose: 3f9.           ‘int’                         Public
                                                                                          
                                                                                          
‘"warn_default_encoding"’     *note warn_default_encoding: 591e.‘bool’                    読み出し専用
                                                                                          
                                                                                          
‘"warnoptions"’               *note warnoptions: 641.       ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"write_bytecode"’            *note write_bytecode: 40b.    ‘bool’                        Public
                                                                                          
                                                                                          
‘"xoptions"’                  *note xoptions: 642.          ‘dict[str, str]’              Public
                                                                                          
                                                                                          
‘"_pystats"’                  *note _pystats: 591f.         ‘bool’                        読み出し専用
                                                                                          

Visibility:

   * Public: Can be retrieved by *note PyConfig_Get(): 37a. and set by
     *note PyConfig_Set(): 37b.

   * Read-only: Can be retrieved by *note PyConfig_Get(): 37a, but
     cannot be set by *note PyConfig_Set(): 37b.


File: python.info,  Node: Runtime Python configuration API,  Next: PyConfig C API,  Prev: Configuration Options,  Up: Python 初期化設定

7.19.3 Runtime Python configuration API
---------------------------------------

At runtime, it's possible to get and set configuration options using
*note PyConfig_Get(): 37a. and *note PyConfig_Set(): 37b. functions.

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
58fd.

Some options are read from the *note sys: df. attributes.  For example,
the option ‘"argv"’ is read from *note sys.argv: 1480.

 -- 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: 5256.  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(): 37a, 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: 5256.  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: 2ee. if there is no option 'name'.

        * Raise a *note ValueError: 2ee. if 'value' is an invalid value.

        * Raise a *note ValueError: 2ee. if the option is read-only
          (cannot be set).

        * Raise a *note TypeError: 199. if 'value' has not the proper
          type.

     The caller must have an *note attached thread state: 5256.  The
     function cannot be called before Python initialization nor after
     Python finalization.

     Raises an *note auditing event: 1ccb. ‘cpython.PyConfig_Set’ with
     arguments ‘name’, ‘value’.

     Added in version 3.14.

     バージョン 3.14.6 (unreleased) で変更: The function now replaces
     *note sys.flags: 89d. (create a new object), instead of modifying
     ‘sys.flags’ in-place.


File: python.info,  Node: PyConfig C API,  Next: Py_GetArgcArgv,  Prev: Runtime Python configuration API,  Up: Python 初期化設定

7.19.4 PyConfig C API
---------------------

Added in version 3.8.

Pythonは *note Py_InitializeFromConfig(): 3f4. と *note PyConfig: 3f5. 構
造体を使って初期化できます。*note Py_PreInitialize(): 41c. と *note
PyPreConfig: ba7. 構造体によって事前に初期化できます。

設定には二つの種類があります:

   * *note Python Configuration: 589a. は、通常の Python と同じ振る舞い
     をするカスタマイズされた Python を構築するために使用されます。例え
     ば、環境変数やコマンドライン引数がPythonを設定するために使用されま
     す。

   * The *note Isolated Configuration: 58fa. 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(): bc0. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 588c. も参照してくださ
い。

参考
....

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.19.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.19.4.2 PyWideStringList
.........................

 -- C のデータ型: type PyWideStringList

     ‘wchar_t*’ 文字列のリスト。

     'length' が非ゼロの場合は、'items' は非 ‘NULL’ かつすべての文字列は
     非 ‘NULL’ でなければなりません。

     メソッド:

      -- C の関数: *note PyStatus: ba8. PyWideStringList_Append
               (PyWideStringList *list, const wchar_t *item)

          'item' を 'list' に追加します。

          Python must be preinitialized to call this function.

      -- C の関数: *note PyStatus: ba8. 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: c59. length

          リストの長さ。

      -- C のメンバ変数: wchar_t **items

          リストの要素。


File: python.info,  Node: PyStatus,  Next: PyPreConfig,  Prev: PyWideStringList,  Up: PyConfig C API

7.19.4.3 PyStatus
.................

 -- C のデータ型: type PyStatus

     初期化関数のステータス(成功、エラー、終了)を格納する構造体です。

     エラー時には、エラーを生成したC関数の名前を格納できます。

     構造体フィールド:

      -- C のメンバ変数: int exitcode

          終了コード。‘exit()’ の引数として渡されます。

      -- C のメンバ変数: const char *err_msg

          エラーメッセージ。

      -- C のメンバ変数: const char *func

          エラーを生成した関数の名前で、‘NULL’ になりえます。

     ステータスを生成する関数:

      -- C の関数: *note PyStatus: ba8. PyStatus_Ok (void)

          成功。

      -- C の関数: *note PyStatus: ba8. PyStatus_Error (const char
               *err_msg)

          メッセージとともにエラーを初期化します。

          'err_msg' must not be ‘NULL’.

      -- C の関数: *note PyStatus: ba8. PyStatus_NoMemory (void)

          メモリ割り当ての失敗(メモリ不足)。

      -- C の関数: *note PyStatus: ba8. 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():
          bbd. 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.19.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: 589a.

      -- C の関数: void PyPreConfig_InitIsolatedConfig (PyPreConfig
               *preconfig)

          Initialize the preconfiguration with *note Isolated
          Configuration: 58fa.

     構造体フィールド:

      -- 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: 2196.

             * ‘PYMEM_ALLOCATOR_DEBUG’ (‘2’): *note default memory
               allocators: 2196. with *note debug hooks: 2198.

             * ‘PYMEM_ALLOCATOR_MALLOC’ (‘3’): use ‘malloc()’ of the C
               library.

             * ‘PYMEM_ALLOCATOR_MALLOC_DEBUG’ (‘4’): force usage of
               ‘malloc()’ with *note debug hooks: 2198.

             * ‘PYMEM_ALLOCATOR_PYMALLOC’ (‘5’): *note Python pymalloc
               memory allocator: f0f.

             * ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ (‘6’): *note Python
               pymalloc memory allocator: f0f. with *note debug hooks:
               2198.

             * ‘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: 2198.

          ‘PYMEM_ALLOCATOR_PYMALLOC’ and
          ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-pymalloc: 21fb.

          ‘PYMEM_ALLOCATOR_MIMALLOC’ and
          ‘PYMEM_ALLOCATOR_MIMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-mimalloc: 21fa. or if the
          underlying atomic support isn't available.

          See *note Memory Management: 592b.

          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: 5908. and *note
          coerce_c_locale_warn: 5909. 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: 590d.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int isolated

          Isolated mode: see *note PyConfig.isolated: 414.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

      -- C のメンバ変数: int legacy_windows_fs_encoding

          If non-zero:

             * Set *note PyPreConfig.utf8_mode: 41b. to ‘0’,

             * Set *note PyConfig.filesystem_encoding: 419. to ‘"mbcs"’,

             * Set *note PyConfig.filesystem_errors: 41a. to
               ‘"replace"’.

          Initialized from the *note PYTHONLEGACYWINDOWSFSENCODING: 33d.
          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(): bbe. and *note
          Py_PreInitializeFromBytesArgs(): bbf. parse their ‘argv’
          argument the same way the regular Python parses command line
          arguments: see *note Command Line Arguments: 120d.

          Default: ‘1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int use_environment

          Use *note environment variables: 807.?  See *note
          PyConfig.use_environment: 409.

          Default: ‘1’ in Python config and ‘0’ in isolated config.

      -- C のメンバ変数: int utf8_mode

          If non-zero, enable the *note Python UTF-8 Mode: 867.

          Set to ‘0’ or ‘1’ by the *note -X utf8: 170. command line
          option and the *note PYTHONUTF8: cd3. 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.19.4.5 Preinitialize Python with PyPreConfig
..............................................

The preinitialization of Python:

   * Set the Python memory allocators (*note PyPreConfig.allocator:
     5902.)

   * Configure the LC_CTYPE locale (*note locale encoding: 54a.)

   * Set the *note Python UTF-8 Mode: 867. (*note PyPreConfig.utf8_mode:
     41b.)

The current preconfiguration (‘PyPreConfig’ type) is stored in
‘_PyRuntime.preconfig’.

Functions to preinitialize Python:

 -- C の関数: *note PyStatus: ba8. Py_PreInitialize (const PyPreConfig
          *preconfig)

     Preinitialize Python from 'preconfig' preconfiguration.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: ba8. 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: 592e. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: ba8. 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: 592e. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): bb4. and *note Py_ExitStatusException():
bbd.

For *note Python Configuration: 589a. (*note
PyPreConfig_InitPythonConfig(): bb2.), 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: 170.
command line option enables the *note Python UTF-8 Mode: 867.

‘PyMem_SetAllocator()’ can be called after *note Py_PreInitialize():
41c. and before *note Py_InitializeFromConfig(): 3f4. to install a
custom memory allocator.  It can be called before ‘Py_PreInitialize()’
if *note PyPreConfig.allocator: 5902. 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(): dc4. must not be called before the Python
preinitialization.

Example using the preinitialization to enable the *note Python UTF-8
Mode: 867.:

     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.19.4.6 PyConfig
.................

 -- C のデータ型: type PyConfig

     Structure containing most parameters to configure Python.

     When done, the *note PyConfig_Clear(): baa. function must be used
     to release the configuration memory.

     Structure methods:

      -- C の関数: void PyConfig_InitPythonConfig (PyConfig *config)

          Initialize configuration with the *note Python Configuration:
          589a.

      -- C の関数: void PyConfig_InitIsolatedConfig (PyConfig *config)

          Initialize configuration with the *note Isolated
          Configuration: 58fa.

      -- C の関数: *note PyStatus: ba8. 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: 4371. if needed.

      -- C の関数: *note PyStatus: ba8. PyConfig_SetBytesString
               (PyConfig *config, wchar_t *const *config_str, const char
               *str)

          Decode 'str' using *note Py_DecodeLocale(): dc4. and set the
          result into ‘*config_str’.

          *note Preinitialize Python: 4371. if needed.

      -- C の関数: *note PyStatus: ba8. PyConfig_SetArgv (PyConfig
               *config, int argc, wchar_t *const *argv)

          Set command line arguments (*note argv: 3ef. member of
          'config') from the 'argv' list of wide character strings.

          *note Preinitialize Python: 4371. if needed.

      -- C の関数: *note PyStatus: ba8. PyConfig_SetBytesArgv (PyConfig
               *config, int argc, char *const *argv)

          Set command line arguments (*note argv: 3ef. member of
          'config') from the 'argv' list of bytes strings.  Decode bytes
          using *note Py_DecodeLocale(): dc4.

          *note Preinitialize Python: 4371. if needed.

      -- C の関数: *note PyStatus: ba8. 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: 4371. if needed.

      -- C の関数: *note PyStatus: ba8. PyConfig_Read (PyConfig *config)

          Read all Python configuration.

          Fields which are already initialized are left unchanged.

          Fields for *note path configuration: aae. are no longer
          calculated or modified when calling this function, as of
          Python 3.11.

          The *note PyConfig_Read(): 997. function only parses *note
          PyConfig.argv: 3ef. arguments once: *note PyConfig.parse_argv:
          1d4f. is set to ‘2’ after arguments are parsed.  Since Python
          arguments are stripped from ‘PyConfig.argv’, parsing arguments
          twice would parse the application options as Python options.

          *note Preinitialize Python: 4371. if needed.

          バージョン 3.10 で変更: The *note PyConfig.argv: 3ef.
          arguments are now only parsed once, *note PyConfig.parse_argv:
          1d4f. is set to ‘2’ after arguments are parsed, and arguments
          are only parsed if ‘PyConfig.parse_argv’ equals ‘1’.

          バージョン 3.11 で変更: *note PyConfig_Read(): 997. no longer
          calculates all paths, and so fields listed under *note Python
          Path Configuration: aae. may no longer be updated until *note
          Py_InitializeFromConfig(): 3f4. is called.

      -- C の関数: void PyConfig_Clear (PyConfig *config)

          Release configuration memory.

     Most ‘PyConfig’ methods *note preinitialize Python: 4371. if
     needed.  In that case, the Python preinitialization configuration
     (*note PyPreConfig: ba7.) is based on the *note PyConfig: 3f5.  If
     configuration fields which are in common with ‘PyPreConfig’ are
     tuned, they must be set before calling a ‘PyConfig’ method:

        * *note PyConfig.dev_mode: 590d.

        * *note PyConfig.isolated: 414.

        * *note PyConfig.parse_argv: 1d4f.

        * *note PyConfig.use_environment: 409.

     Moreover, if *note PyConfig_SetArgv(): bad. or *note
     PyConfig_SetBytesArgv(): bae. is used, this method must be called
     before other methods, since the preinitialization configuration
     depends on command line arguments (if *note parse_argv: 1d4f. 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: ba9. argv

          Set *note sys.argv: 1480. command line arguments based on
          *note argv: 3ef.  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
          ‘argv’ can be an empty string.

          Set *note parse_argv: 1d4f. to ‘1’ to parse *note argv: 3ef.
          the same way the regular Python parses Python command line
          arguments and then to strip Python arguments from ‘argv’.

          If *note argv: 3ef. is empty, an empty string is added to
          ensure that *note sys.argv: 1480. always exists and is never
          empty.

          Default: ‘NULL’.

          See also the *note orig_argv: a98. member.

      -- C のメンバ変数: int safe_path

          If equals to zero, ‘Py_RunMain()’ prepends a potentially
          unsafe path to *note sys.path: 3e2. at startup:

             * If *note argv[0]: 3ef. 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: 3e8.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. output.

          See also *note PyConfig.exec_prefix: 5910.

      -- 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: aae. output.

          See also *note PyConfig.executable: 645.

      -- C のメンバ変数: wchar_t *base_prefix

          *note sys.base_prefix: 3e4.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. output.

          See also *note PyConfig.prefix: 5916.

      -- C のメンバ変数: int buffered_stdio

          If equals to ‘0’ and *note configure_c_stdio: 590a. is
          non-zero, disable buffering on the C streams stdout and
          stderr.

          Set to ‘0’ by the *note -u: 1deb. command line option and the
          *note PYTHONUNBUFFERED: 1dec. 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:
          193. or *note bytearray: 342. with *note str: 16a, or
          comparing ‘bytes’ with *note int: 19c.

          If equal or greater to ‘2’, raise a *note BytesWarning: e20.
          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: 2189. warning when
          *note io.TextIOWrapper: 9c2. uses its default encoding.  See
          *note Opt-in EncodingWarning: 219a. 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: 170. 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: 217d. 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: 40f. equals zero, disable
               buffering of stdin, stdout and stderr streams.

             * If *note interactive: 3fd. 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: 170. option and the *note
          PYTHONDEVMODE: ceb. 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: ba2. 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: 1c9c. 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: 3e9.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. output.

          See also *note PyConfig.base_exec_prefix: 5903.

      -- C のメンバ変数: wchar_t *executable

          The absolute path of the executable binary for the Python
          interpreter: *note sys.executable: 3eb.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. output.

          See also *note PyConfig.base_executable: 5904.

      -- C のメンバ変数: int faulthandler

          Enable faulthandler?

          If non-zero, call *note faulthandler.enable(): 211. at
          startup.

          Set to ‘1’ by *note -X faulthandler: 170. and the *note
          PYTHONFAULTHANDLER: 1295. environment variable.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: wchar_t *filesystem_encoding

          *note Filesystem encoding: 75d.: *note
          sys.getfilesystemencoding(): e57.

          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: 416. of *note PyPreConfig: ba7. is
          non-zero.

          Default encoding on other platforms:

             * ‘"utf-8"’ if *note PyPreConfig.utf8_mode: 41b. 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: 41a. member.

      -- C のメンバ変数: wchar_t *filesystem_errors

          *note Filesystem error handler: 75d.: *note
          sys.getfilesystemencodeerrors(): ee6.

          On Windows: use ‘"surrogatepass"’ by default, or ‘"replace"’
          if *note legacy_windows_fs_encoding: 416. of *note
          PyPreConfig: ba7. 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: 419. 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: 411. is zero, a seed is chosen
          randomly at Python startup, and *note hash_seed: 412. is
          ignored.

          Set by the *note PYTHONHASHSEED: 128d. 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: 3ee.).

          Set by the *note PYTHONHOME: 3ee. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. 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: 170. option and the *note
               PYTHONPROFILEIMPORTTIME: cf1. 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: 16f9. command line option.  Set
          to ‘1’ if the *note PYTHONINSPECT: 16f8. 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: 16f9. 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: 2734.).  A value of ‘0’
          disables the limitation.  Values greater than zero but less
          than 640 (*note sys.int_info.str_digits_check_threshold:
          4ca9.) are unsupported and will produce an error.

          Configured by the *note -X int_max_str_digits: 170. command
          line flag or the *note PYTHONINTMAXSTRDIGITS: 1b99.
          environment variable.

          Default: ‘-1’ in Python mode.  4300 (*note
          sys.int_info.default_max_str_digits: 2734.) in isolated mode.

          Added in version 3.12.

      -- C のメンバ変数: int cpu_count

          If the value of *note cpu_count: 590c. 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(): 1175.

          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: 97b. to ‘1’: don't prepend a
               potentially unsafe path to *note sys.path: 3e2. at Python
               startup, such as the current directory, the script's
               directory or an empty string.

             * Set *note use_environment: 409. to ‘0’: ignore ‘PYTHON’
               environment variables.

             * Set *note user_site_directory: 40d. to ‘0’: don't add the
               user site directory to *note sys.path: 3e2.

             * Python REPL doesn't import *note readline: bf. nor enable
               default readline configuration on interactive prompts.

          Set to ‘1’ by the *note -I: b5b. command line option.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

          See also the *note Isolated Configuration: 58fa. and *note
          PyPreConfig.isolated: 592d.

      -- C のメンバ変数: int legacy_windows_stdio

          If non-zero, use *note io.FileIO: 152b. instead of
          ‘io._WindowsConsoleIO’ for *note sys.stdin: 75f, *note
          sys.stdout: cd1. and *note sys.stderr: b37.

          *note PYTHONLEGACYWINDOWSSTDIO: e59. 環境変数が空でない文字列
          に設定された場合に、 ‘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: f0f. at exit.

          Set to ‘1’ by the *note PYTHONMALLOCSTATS: 1f93. environment
          variable.

          The option is ignored if Python is *note configured using the
          -without-pymalloc option: 21fb.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *platlibdir

          Platform library directory name: *note sys.platlibdir: b36.

          Set by the *note PYTHONPLATLIBDIR: 1d81. environment variable.

          Default: value of the ‘PLATLIBDIR’ macro which is set by the
          *note configure -with-platlibdir option: 21c6. (default:
          ‘"lib"’, or ‘"DLLs"’ on Windows).

          Part of the *note Python Path Configuration: aae. 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: 3e2.) as a string
          separated by ‘DELIM’ (*note os.pathsep: 218f.).

          Set by the *note PYTHONPATH: 1223. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. input.

      -- C のメンバ変数: *note PyWideStringList: ba9.
               module_search_paths

      -- C のメンバ変数: int module_search_paths_set

          Module search paths: *note sys.path: 3e2.

          If *note module_search_paths_set: 805. is equal to ‘0’, *note
          Py_InitializeFromConfig(): 3f4. will replace *note
          module_search_paths: 643. and sets ‘module_search_paths_set’
          to ‘1’.

          Default: empty list (‘module_search_paths’) and ‘0’
          (‘module_search_paths_set’).

          Part of the *note Python Path Configuration: aae. 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: 18d. command line option.  Set to
          the *note PYTHONOPTIMIZE: 2180. environment variable value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: ba9. orig_argv

          The list of the original command line arguments passed to the
          Python executable: *note sys.orig_argv: a45.

          If *note orig_argv: a98. list is empty and *note argv: 3ef. is
          not a list only containing an empty string, *note
          PyConfig_Read(): 997. copies ‘argv’ into ‘orig_argv’ before
          modifying ‘argv’ (if *note parse_argv: 1d4f. is non-zero).

          See also the *note argv: 3ef. member and the *note
          Py_GetArgcArgv(): 1d9f. function.

          Default: empty list.

          Added in version 3.10.

      -- C のメンバ変数: int parse_argv

          Parse command line arguments?

          If equals to ‘1’, parse *note argv: 3ef. the same way the
          regular Python parses *note command line arguments: 120d, and
          strip Python arguments from ‘argv’.

          The *note PyConfig_Read(): 997. function only parses *note
          PyConfig.argv: 3ef. arguments once: *note PyConfig.parse_argv:
          1d4f. is set to ‘2’ after arguments are parsed.  Since Python
          arguments are stripped from ‘PyConfig.argv’, 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: 3ef.
          arguments are now only parsed if *note PyConfig.parse_argv:
          1d4f. 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: 217e. command line option.  Set
          to the *note PYTHONDEBUG: 217f. 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: aae. 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: 3e5.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aae. output.

          See also *note PyConfig.base_prefix: 5905.

      -- 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: 2193. 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: 3ef. 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: aae. input.

      -- C のメンバ変数: wchar_t *pycache_prefix

          Directory where cached ‘.pyc’ files are written: *note
          sys.pycache_prefix: ba0.

          Set by the *note -X pycache_prefix=PATH: 170. command line
          option and the *note PYTHONPYCACHEPREFIX: b9f. environment
          variable.  The command-line option takes precedence.

          If ‘NULL’, *note sys.pycache_prefix: ba0. 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: 17ee. command line option.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *run_command

          Value of the *note -c: 1a9. command line option.

          Used by *note Py_RunMain(): bc0.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_filename

          Filename passed on the command line: trailing command line
          argument without *note -c: 1a9. or *note -m: 23e.  It is used
          by the *note Py_RunMain(): bc0. 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: 591a.
          option.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_module

          Value of the *note -m: 23e. command line option.

          Used by *note Py_RunMain(): bc0.

          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: 170. command-line
          option and the *note PYTHON_PRESITE: 218a. 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:
          292. objects)?

          Set to ‘1’ by *note -X showrefcount: 170. 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: 3e2. that
          it entails.

          Also disable these manipulations if the *note site: cc. module
          is explicitly imported later (call *note site.main(): 2182. if
          you want them to be triggered).

          Set to ‘0’ by the *note -S: 13c4. command line option.

          *note sys.flags.no_site: 89d. is set to the inverted value of
          *note site_import: 403.

          Default: ‘1’.

      -- C のメンバ変数: int skip_source_first_line

          If non-zero, skip the first line of the *note
          PyConfig.run_filename: 5898. 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: 2186. 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: cd1. and *note sys.stderr: b37. (but ‘sys.stderr’
          always uses ‘"backslashreplace"’ error handler).

          Use the *note PYTHONIOENCODING: 1210. environment variable if
          it is non-empty.

          Default encoding:

             * ‘"UTF-8"’ if *note PyPreConfig.utf8_mode: 41b. is
               non-zero.

             * Otherwise, use the *note locale encoding: 54a.

          Default error handler:

             * On Windows: use ‘"surrogateescape"’.

             * ‘"surrogateescape"’ if *note PyPreConfig.utf8_mode: 41b.
               is non-zero, or if the LC_CTYPE locale is "C" or "POSIX".

             * ‘"strict"’ otherwise.

          See also *note PyConfig.legacy_windows_stdio: 418.

      -- C のメンバ変数: int tracemalloc

          Enable tracemalloc?

          If non-zero, call *note tracemalloc.start(): 2187. at startup.

          Set by *note -X tracemalloc=N: 170. command line option and by
          the *note PYTHONTRACEMALLOC: 2188. 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: 170. command-line option and the
          *note PYTHONPERFSUPPORT: 699. environment variable.

          Set to ‘2’ by the *note -X perf_jit: 170. 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: b5a. 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:
          3e2.

          Set to ‘0’ by the *note -s: 15aa. and *note -I: b5b. command
          line options.

          Set to ‘0’ by the *note PYTHONNOUSERSITE: 15ab. 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: 1643. command line option.

          Set by the *note PYTHONVERBOSE: 2183. environment variable
          value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: ba9. warnoptions

          Options of the *note warnings: 119. module to build warnings
          filters, lowest to highest priority: *note sys.warnoptions:
          3f3.

          The *note warnings: 119. module adds *note sys.warnoptions:
          3f3. 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: aca. command line options adds its value to
          *note warnoptions: 641, it can be used multiple times.

          The *note PYTHONWARNINGS: da7. 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: 15eb. command line option and the
          *note PYTHONDONTWRITEBYTECODE: 15ec. environment variable.

          *note sys.dont_write_bytecode: 4c76. is initialized to the
          inverted value of *note write_bytecode: 40b.

          Default: ‘1’.

      -- C のメンバ変数: *note PyWideStringList: ba9. xoptions

          Values of the *note -X: 170. command line options: *note
          sys._xoptions: 218c.

          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: 1b97.

          Default: ‘0’.

If *note parse_argv: 1d4f. is non-zero, *note argv: 3ef. arguments are
parsed the same way the regular Python parses *note command line
arguments: 120d, and Python arguments are stripped from ‘argv’.

The *note xoptions: 642. options are parsed to set other options: see
the *note -X: 170. 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.19.4.7 Initialization with PyConfig
.....................................

Initializing the interpreter from a populated configuration struct is
handled by calling *note Py_InitializeFromConfig(): 3f4.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): bb4. and *note Py_ExitStatusException():
bbd.

If *note PyImport_FrozenModules(): 33b6, *note PyImport_AppendInittab():
1b7b. or *note PyImport_ExtendInittab(): 1b7c. are used, they must be
set or called after Python preinitialization and before the Python
initialization.  If Python is initialized multiple times,
‘PyImport_AppendInittab()’ or ‘PyImport_ExtendInittab()’ 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.19.4.8 Isolated Configuration
...............................

*note PyPreConfig_InitIsolatedConfig(): bb1. and *note
PyConfig_InitIsolatedConfig(): bab. 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: 3ef. 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: 3f1. 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.19.4.9 Python Configuration
.............................

*note PyPreConfig_InitPythonConfig(): bb2. and *note
PyConfig_InitPythonConfig(): bac. 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: 867. ( PEP 540(2)) depending on the LC_CTYPE locale, *note
PYTHONUTF8: cd3. and *note PYTHONCOERCECLOCALE: cd0. 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.19.4.10 Python Path Configuration
...................................

*note PyConfig: 3f5. contains multiple fields for the path
configuration:

   * Path configuration inputs:

        * *note PyConfig.home: 3f1.

        * *note PyConfig.platlibdir: 1d7f.

        * *note PyConfig.pathconfig_warnings: 407.

        * *note PyConfig.program_name: 3f0.

        * *note PyConfig.pythonpath_env: 5932.

        * current working directory: to get absolute paths

        * ‘PATH’ environment variable to get the program full path (from
          *note PyConfig.program_name: 3f0.)

        * ‘__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: 5903.

        * *note PyConfig.base_executable: 5904.

        * *note PyConfig.base_prefix: 5905.

        * *note PyConfig.exec_prefix: 5910.

        * *note PyConfig.executable: 645.

        * *note PyConfig.module_search_paths_set: 805, *note
          PyConfig.module_search_paths: 643.

        * *note PyConfig.prefix: 5916.

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
‘module_search_paths_set’ 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: 407. to ‘0’ to suppress warnings when
calculating the path configuration (Unix only, Windows does not log any
warning).

If *note base_prefix: 5905. or *note base_exec_prefix: 5903. fields are
not set, they inherit their value from *note prefix: 5916. and *note
exec_prefix: 5910. respectively.

*note Py_RunMain(): bc0. and *note Py_Main(): e22. modify *note
sys.path: 3e2.:

   * If *note run_filename: 5898. is set and is a directory which
     contains a ‘__main__.py’ script, prepend ‘run_filename’ to *note
     sys.path: 3e2.

   * If *note isolated: 414. is zero:

        * If *note run_module: 5899. is set, prepend the current
          directory to *note sys.path: 3e2.  Do nothing if the current
          directory cannot be read.

        * If *note run_filename: 5898. is set, prepend the directory of
          the filename to *note sys.path: 3e2.

        * Otherwise, prepend an empty string to *note sys.path: 3e2.

If *note site_import: 403. is non-zero, *note sys.path: 3e2. can be
modified by the *note site: cc. module.  If *note user_site_directory:
40d. is non-zero and the user's site-package directory exists, the
‘site’ module appends the user's site-package directory to ‘sys.path’.

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: 414. to ‘1’.

   * Set *note use_environment: 409. to ‘0’.

   * Set *note site_import: 403. to ‘0’.

   * Set *note safe_path: 97b. to ‘1’.

If *note home: 3f1. is not set and a ‘pyvenv.cfg’ file is present in the
same directory as *note executable: 645, or its parent, *note prefix:
5916. and *note exec_prefix: 5910. are set that location.  When this
happens, *note base_prefix: 5905. and *note base_exec_prefix: 5903.
still keep their value, pointing to the base installation.  See *note
Virtual Environments: 4c38. for more information.

The ‘__PYVENV_LAUNCHER__’ environment variable is used to set *note
PyConfig.base_executable: 5904.

バージョン 3.14 で変更: *note prefix: 5916, and *note exec_prefix: 5910,
are now set to the ‘pyvenv.cfg’ directory.  This was previously done by
*note site: cc, therefore affected by *note -S: 13c4.


File: python.info,  Node: Py_GetArgcArgv,  Next: Delaying main module execution,  Prev: PyConfig C API,  Up: Python 初期化設定

7.19.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: a98. member.


File: python.info,  Node: Delaying main module execution,  Prev: Py_GetArgcArgv,  Up: Python 初期化設定

7.19.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 reference manual

7.20 メモリ管理
===============

* 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.20.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
オブジェクトを確保する時にだけ必要です。

In most situations, however, it is recommended to allocate memory from
the Python heap specifically because the latter is under control of the
Python memory manager.  For example, this is required when the
interpreter is extended with new object types written in C. Another
reason for using the Python heap is the desire to 'inform' the Python
memory manager about the memory needs of the extension module.  Even
when the requested memory is used exclusively for internal, highly
specific purposes, delegating all memory requests to the Python memory
manager causes the interpreter to have a more accurate image of its
memory footprint as a whole.  Consequently, under certain circumstances,
the Python memory manager may or may not trigger appropriate actions,
like garbage collection, memory compaction or other preventive
procedures.  Note that by using the C library allocator as shown in the
previous example, the allocated memory for the I/O buffer completely
escapes the Python memory manager.

参考
....

環境変数 *note PYTHONMALLOC: e62. を使用して Python が利用するメモリアロ
ケータを制御することができます。

環境変数 *note PYTHONMALLOCSTATS: 1f93. を使用して、新たなオブジェクトア
リーナが生成される時と、シャットダウン時に *note pymalloc
メモリアロケータ: f0f. の統計情報を表示できます。


File: python.info,  Node: Allocator Domains,  Next: 生メモリインターフェース,  Prev: 概要<4>,  Up: メモリ管理

7.20.2 Allocator Domains
------------------------

All allocating functions belong to one of three different "domains" (see
also *note PyMemAllocatorDomain: 5940.).  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: 2196.  The APIs used to
allocate and free a block of memory must be from the same domain.  For
example, *note PyMem_Free(): 1660. must be used to free memory allocated
using *note PyMem_Malloc(): e63.

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: 5256.  The memory is requested directly from
     the system.  See *note Raw Memory Interface: 5941.

   * "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: 5256.  The memory is
     taken from the Python private heap.  See *note Memory Interface:
     5942.

   * Object domain: intended for allocating memory for Python objects.
     The memory is taken from the Python private heap.  See *note Object
     allocators: 5943.

     注釈: The *note free-threaded: 1f6. 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(): e63, *note PyMem_RawMalloc(): 631, or
     ‘malloc()’, but not *note PyObject_Malloc(): e66.

     See *note Memory Allocation APIs: 5944.


File: python.info,  Node: 生メモリインターフェース,  Next: メモリインターフェース,  Prev: Allocator Domains,  Up: メモリ管理

7.20.3 生メモリインターフェース
-------------------------------

The following function sets are wrappers to the system allocator.  These
functions are thread-safe, so a *note thread state: 18ab. does not need
to be *note attached: 5256.

The *note default raw memory allocator: 2196. 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 より).'
     Allocates 'nelem' elements each of size 'elsize' bytes and returns
     a pointer of type void* to the allocated memory, or ‘NULL’ if the
     request fails.  The memory is initialized to zeros.

     要素数か要素のサイズが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.20.4 メモリインターフェース
-----------------------------

以下の関数群が利用して Python ヒープに対してメモリを確保したり解放したり
出来ます。これらの関数は ANSI C 標準に従ってモデル化されていますが、0 バ
イトを要求した際の動作についても定義しています:

In the GIL-enabled build (default build) the *note default memory
allocator: 2196. uses the *note pymalloc memory allocator: f0f, whereas
in the *note free-threaded build: 17b0, the default is the *note
mimalloc memory allocator: 178a. instead.

     警告: There must be an *note attached thread state: 5256. when
     using these functions.

バージョン 3.6 で変更: デフォルトのアロケータがシステムの ‘malloc()’ か
ら pymalloc になりました。

バージョン 3.13 で変更: In the *note free-threaded: 1f6. build, the
default allocator is now *note mimalloc: 178a.

 -- 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 より).'
     Allocates 'nelem' elements each of size 'elsize' bytes and returns
     a pointer of type void* to the allocated memory, or ‘NULL’ if the
     request fails.  The memory is initialized to zeros.

     要素数か要素のサイズが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():
     e63, *note PyMem_Realloc(): 1237. または *note PyMem_Calloc():
     10b1. の呼び出しにより返されなければなりません。

     要求が失敗した場合 *note PyMem_Realloc(): 1237. は ‘NULL’ を返し、
     'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyMem_Free (void *p)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyMem_Malloc(): e63.、
     *note PyMem_Realloc(): 1237.、または *note PyMem_Calloc(): 10b1. の
     返した値でなければなりません。それ以外の場合や ‘PyMem_Free(p)’ を呼
     び出した後だった場合、未定義の動作になります。

     'p' が ‘NULL’ の場合何もしません。

以下に挙げる型対象のマクロは利便性のために提供されているものです。'TYPE'
は任意の C の型を表します。

 -- C のマクロ: PyMem_New (TYPE, n)

     Same as *note PyMem_Malloc(): e63, 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(): 1237, 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(): 1660. と同じです。

* Menu:

* 非推奨のエイリアス: 非推奨のエイリアス<2>.


File: python.info,  Node: 非推奨のエイリアス<2>,  Up: メモリインターフェース

7.20.4.1 非推奨のエイリアス
...........................

These are *note soft deprecated: 23f. aliases to existing functions and
macros.  They exist solely for backwards compatibility.

非推奨のエイリアス                                     Corresponding function or macro
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyMem_MALLOC (size)                    *note PyMem_Malloc(): e63.
                                                       
                                                       
 -- C のマクロ: PyMem_NEW (type, size)                 *note PyMem_New: 1742.
                                                       
                                                       
 -- C のマクロ: PyMem_REALLOC (ptr, size)              *note PyMem_Realloc(): 1237.
                                                       
                                                       
 -- C のマクロ: PyMem_RESIZE (ptr, type, size)         *note PyMem_Resize: 5947.
                                                       
                                                       
 -- C のマクロ: PyMem_FREE (ptr)                       *note PyMem_Free(): 1660.
                                                       
                                                       
 -- C のマクロ: PyMem_DEL (ptr)                        *note PyMem_Free(): 1660.
                                                       

バージョン 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.20.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: 5950. section.

The *note default object allocator: 2196. uses the *note pymalloc memory
allocator: f0f.  In the *note free-threaded: 1f6. build, the default is
the *note mimalloc memory allocator: 178a. instead.

     警告: There must be an *note attached thread state: 5256. 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 より).'
     Allocates 'nelem' elements each of size 'elsize' bytes and returns
     a pointer of type void* to the allocated memory, or ‘NULL’ if the
     request fails.  The memory is initialized to zeros.

     要素数か要素のサイズが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(): e66, *note PyObject_Realloc(): 1661. または
     *note PyObject_Calloc(): 10b2. の呼び出しにより返されなければなりま
     せん。

     要求が失敗した場合 *note PyObject_Realloc(): 1661. は ‘NULL’ を返し
     、 'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyObject_Free (void *p)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyObject_Malloc(): e66.、
     *note PyObject_Realloc(): 1661.、または *note PyObject_Calloc():
     10b2. の返した値でなければなりません。それ以外の場合や
     ‘PyObject_Free(p)’ を呼び出した後だった場合、未定義の動作になります
     。

     'p' が ‘NULL’ の場合何もしません。

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 5254. slot instead.

     Do not use this for memory allocated by *note PyObject_GC_New: c9d.
     or *note PyObject_GC_NewVar: c9e.; use *note PyObject_GC_Del():
     1721. instead.

     参考
     ....

        * *note PyObject_GC_Del(): 1721. is the equivalent of this
          function for memory allocated by types that support garbage
          collection.

        * *note PyObject_Malloc(): e66.

        * *note PyObject_Realloc(): 1661.

        * *note PyObject_Calloc(): 10b2.

        * *note PyObject_New: b80.

        * *note PyObject_NewVar: b81.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_free: 5254.


File: python.info,  Node: Default Memory Allocators,  Next: メモリアロケータをカスタマイズする,  Prev: オブジェクトアロケータ,  Up: メモリ管理

7.20.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
                                                                                                                        
                                                                                                                        
Free-threaded build                     ‘"mimalloc"’                ‘mimalloc’               ‘mimalloc’                 ‘mimalloc’
                                                                                                                        
                                                                                                                        
Free-threaded debug build               ‘"mimalloc_debug"’          ‘mimalloc’ + debug       ‘mimalloc’ + debug         ‘mimalloc’ + debug
                                                                                                                        

説明:

   * Name: value for *note PYTHONMALLOC: e62. environment variable.

   * ‘malloc’: system allocators from the standard C library, C
     functions: ‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’.

   * ‘pymalloc’: *note pymalloc memory allocator: f0f.

   * ‘mimalloc’: *note mimalloc memory allocator: 178a.

   * "+ debug": with *note debug hooks on the Python memory allocators:
     2198.

   * "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.20.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: 10d2. 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(): e63,

             * *note PyMem_Realloc(): 1237.

             * *note PyMem_Calloc(): 10b1.

             * *note PyMem_Free(): 1660.

      -- C のマクロ: PYMEM_DOMAIN_OBJ

          関数:

             * *note PyObject_Malloc(): e66.

             * *note PyObject_Realloc(): 1661.

             * *note PyObject_Calloc(): 10b2.

             * *note PyObject_Free(): e64.

 -- C の関数: void PyMem_GetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを取得します。

 -- C の関数: void PyMem_SetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを設定します。

     新しいアロケータは、0バイトを要求されたときユニークな ‘NULL’ でない
     ポインタを返さなければなりません。

     For the *note PYMEM_DOMAIN_RAW: 2197. domain, the allocator must be
     thread-safe: a *note thread state: 18ab. is not *note attached:
     5256. 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: 165.

     新しいアロケータがフックでない (1つ前のアロケータを呼び出さない) 場
     合、 *note PyMem_SetupDebugHooks(): e68. 関数を呼び出して、新しいア
     ロケータの上にデバッグフックを再度設置しなければなりません。

     See also *note PyPreConfig.allocator: 5902. and *note Preinitialize
     Python with PyPreConfig: 4371.

          警告: *note PyMem_SetAllocator(): 7a8. does have the following
          contract:

             * It can be called after *note Py_PreInitialize(): 41c. and
               before *note Py_InitializeFromConfig(): 3f4. 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: 5256.).  See *note the section on allocator
               domains: 593f. for more information.

             * If called after Python has finish initializing (after
               *note Py_InitializeFromConfig(): 3f4. 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: 2198. to
     detect memory errors.


File: python.info,  Node: Debug hooks on the Python memory allocators,  Next: pymalloc アロケータ,  Prev: メモリアロケータをカスタマイズする,  Up: メモリ管理

7.20.8 Debug hooks on the Python memory allocators
--------------------------------------------------

When *note Python is built in debug mode: 509, the *note
PyMem_SetupDebugHooks(): e68. function is called at the *note Python
preinitialization: 4371. to setup debug hooks on Python memory
allocators to detect memory errors.

The *note PYTHONMALLOC: e62. environment variable can be used to install
debug hooks on a Python compiled in release mode (ex:
‘PYTHONMALLOC=debug’).

The *note PyMem_SetupDebugHooks(): e68. 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(): e64. is called on a memory block allocated by
     *note PyMem_Malloc(): e63.

   - 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: 5256. when
     allocator functions of *note PYMEM_DOMAIN_OBJ: e65. (ex: *note
     PyObject_Malloc(): e66.) and *note PYMEM_DOMAIN_MEM: e67. (ex:
     *note PyMem_Malloc(): e63.) domains are called.

On error, the debug hooks use the *note tracemalloc: 106. module to get
the traceback where a memory block was allocated.  The traceback is only
displayed if ‘tracemalloc’ 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: 2197.

        * ‘'m'’ for *note PYMEM_DOMAIN_MEM: e67.

        * ‘'o'’ for *note PYMEM_DOMAIN_OBJ: e65.

‘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(): e68. function
now also works on Python compiled in release mode.  On error, the debug
hooks now use *note tracemalloc: 106. to get the traceback where a
memory block was allocated.  The debug hooks now also check if there is
an *note attached thread state: 5256. when functions of *note
PYMEM_DOMAIN_OBJ: e65. and *note PYMEM_DOMAIN_MEM: e67. 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.20.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: 2196. of the *note
PYMEM_DOMAIN_MEM: e67. (ex: *note PyMem_Malloc(): e63.) and *note
PYMEM_DOMAIN_OBJ: e65. (ex: *note PyObject_Malloc(): e66.) 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: 21fb. option.  It can also be disabled at runtime
using the *note PYTHONMALLOC: e62. environment variable (ex:
‘PYTHONMALLOC=malloc’).

Typically, it makes sense to disable the pymalloc allocator when
building Python with AddressSanitizer (*note -with-address-sanitizer:
2204.) which helps uncover low level bugs within the C code.

* Menu:

* pymalloc アリーナアロケータのカスタマイズ::


File: python.info,  Node: pymalloc アリーナアロケータのカスタマイズ,  Up: pymalloc アロケータ

7.20.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.20.10 The mimalloc allocator
------------------------------

Added in version 3.13.

Python supports the mimalloc(1) 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.

Unlike *note pymalloc: f0f, which is optimized for small objects (512
bytes or fewer), mimalloc handles allocations of any size.

In the *note free-threaded: 1f6. build, mimalloc is the default and
'required' allocator for the *note PYMEM_DOMAIN_MEM: e67. and *note
PYMEM_DOMAIN_OBJ: e65. domains.  It cannot be disabled in free-threaded
builds.  The free-threaded build uses per-thread mimalloc heaps, which
allows allocation and deallocation to proceed without locking in most
cases.

In the default (non-free-threaded) build, mimalloc is available but not
the default allocator.  It can be selected at runtime using *note
PYTHONMALLOC: e62.‘=mimalloc’ (or ‘mimalloc_debug’ to include *note
debug hooks: 2198.).  It can be disabled at build time using the *note
-without-mimalloc: 21fa. configure option, but this option cannot be
combined with *note -disable-gil: 499.

   ---------- Footnotes ----------

   (1) https://github.com/microsoft/mimalloc/


File: python.info,  Node: tracemalloc C API,  Next: 使用例<56>,  Prev: The mimalloc allocator,  Up: メモリ管理

7.20.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: 106.
     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: 106.
     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.20.12 使用例
--------------

最初に述べた関数セットを使って、 *note 概要: 593c. 節の例を 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: b80, *note PyObject_NewVar: b81. and *note
PyObject_Free(): e64.

これらの関数については、次章の C による新しいオブジェクト型の定義や実装
に関する記述の中で説明します。


File: python.info,  Node: オブジェクト実装サポート object implementation support,  Next: API と ABI のバージョニング,  Prev: メモリ管理,  Up: Python/C API reference manual

7.21 オブジェクト実装サポート (object implementation support)
=============================================================

この章では、新しいオブジェクトの型を定義する際に使われる関数、型、および
マクロについて説明します。

* Menu:

* Allocating objects on the heap::
* Object Life Cycle::
* 共通のオブジェクト構造体 (common object structure): 共通のオブジェクト構造体 common object structure.
* Type Object Structures::
* 循環参照ガベージコレクションをサポートする::


File: python.info,  Node: Allocating objects on the heap,  Next: Object Life Cycle,  Up: オブジェクト実装サポート object implementation support

7.21.1 Allocating objects on the heap
-------------------------------------

 -- C の関数: *note PyObject: 5df. *_PyObject_New (PyTypeObject *type)
     '戻り値: 新しい参照。'

 -- C の関数: *note PyVarObject: 4a5b. *_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__(): 8c0. 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: 5255. where possible.  For implementing ‘tp_alloc’
     for your type, prefer *note PyType_GenericAlloc(): c65. or *note
     PyObject_New(): b80.

          注釈: 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: 4a5b. *PyObject_InitVar (PyVarObject
          *op, PyTypeObject *type, Py_ssize_t size)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  *note
     PyObject_Init(): c64. の全ての処理を行い、可変サイズオブジェクトの
     場合には長さ情報も初期化します。

          注釈: 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(): e66. to allocate memory and initializing it like
     *note PyObject_Init(): c64.  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: 5255. slot instead.

     When populating a type's *note tp_alloc: 5255. slot, *note
     PyType_GenericAlloc(): c65. is preferred over a custom function
     that simply calls this macro.

     This macro does not call *note tp_alloc: 5255, *note tp_new: 79f.
     (*note __new__(): 7a0.), or *note tp_init: 7a1. (*note __init__():
     8c0.).

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 985.
     set in *note tp_flags: 1cce.; use *note PyObject_GC_New: c9d.
     instead.

     Memory allocated by this macro must be freed with *note
     PyObject_Free(): e64. (usually called via the object's *note
     tp_free: 5254. 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(): e64.

        * *note PyObject_GC_New: c9d.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_alloc: 5255.

 -- C のマクロ: PyObject_NewVar (TYPE, typeobj, size)

     Like *note PyObject_New: b80. except:

        * It allocates enough memory for the 'TYPE' structure plus
          'size' (‘Py_ssize_t’) fields of the size given by the *note
          tp_itemsize: 241b. field of 'typeobj'.

        * The memory is initialized like *note PyObject_InitVar(): 1d9e.

     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: 5255. slot instead.

     When populating a type's *note tp_alloc: 5255. slot, *note
     PyType_GenericAlloc(): c65. is preferred over a custom function
     that simply calls this macro.

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 985.
     set in *note tp_flags: 1cce.; use *note PyObject_GC_NewVar: c9e.
     instead.

     Memory allocated by this function must be freed with *note
     PyObject_Free(): e64. (usually called via the object's *note
     tp_free: 5254. 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(): e64.

        * *note PyObject_GC_NewVar: c9e.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_alloc: 5255.

 -- C 変数: *note PyObject: 5df. _Py_NoneStruct

     Python からは ‘None’ に見えるオブジェクトです。この値へのアクセスは
     、このオブジェクトへのポインタを評価する *note Py_None: 5223. マク
     ロを使わなければなりません。

参考
....

*note モジュールオブジェクト (module object): 57bb.

     拡張モジュールのアロケートと生成。

* Menu:

* Soft-deprecated aliases::


File: python.info,  Node: Soft-deprecated aliases,  Up: Allocating objects on the heap

7.21.1.1 Soft-deprecated aliases
................................

*note Soft deprecated: 23f. since version 3.10.

These are aliases to existing functions and macros.  They exist solely
for backwards compatibility.

Soft-deprecated alias                                  関数
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyObject_NEW (type, typeobj)           *note PyObject_New: b80.
                                                       
                                                       
 -- C のマクロ: PyObject_NEW_VAR (type, typeobj, n)    *note PyObject_NewVar: b81.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT (op, typeobj)            *note PyObject_Init(): c64.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT_VAR (op, typeobj, n)     *note PyObject_InitVar(): 1d9e.
                                                       
                                                       
 -- C のマクロ: PyObject_MALLOC (n)                    *note PyObject_Malloc(): e66.
                                                       
                                                       
 -- C のマクロ: PyObject_REALLOC (p, n)                *note PyObject_Realloc(): 1661.
                                                       
                                                       
 -- C のマクロ: PyObject_FREE (p)                      *note PyObject_Free(): e64.
                                                       
                                                       
 -- C のマクロ: PyObject_DEL (p)                       *note PyObject_Free(): e64.
                                                       
                                                       
 -- C のマクロ: PyObject_Del (p)                       *note PyObject_Free(): e64.
                                                       


File: python.info,  Node: Object Life Cycle,  Next: 共通のオブジェクト構造体 common object structure,  Prev: Allocating objects on the heap,  Up: オブジェクト実装サポート object implementation support

7.21.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: b88. 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.21.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: 5255. 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: ca1. function.  Python does 'not' finalize an
          object when the last reference to it is deleted; use *note
          PyObject_CallFinalizerFromDealloc(): 5971. to ensure that
          ‘tp_finalize’ is always called.

       2. If the object is marked as finalized, *note tp_clear: 5267.
          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: 5241. is called to destroy the object.  To
          avoid code duplication, ‘tp_dealloc’ typically calls into
          *note tp_clear: 5267. to free up the object's references.

       4. When *note tp_dealloc: 5241. finishes object destruction, it
          directly calls *note tp_free: 5254. (usually set to *note
          PyObject_Free(): e64. or *note PyObject_GC_Del(): 1721.
          automatically as appropriate for the type) to deallocate the
          memory.

   * The *note tp_finalize: ca1. 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:
     5267. and *note tp_dealloc: 5241. 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:
     985. 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: 5241. can optionally call *note tp_finalize: ca1.
     via *note PyObject_CallFinalizerFromDealloc(): 5971. 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 ‘tp_dealloc’ documentation for
     example code.

   * If the object is a member of a *note cyclic isolate: 5972. and
     either *note tp_clear: 5267. fails to break the reference cycle or
     the cyclic isolate is not detected (perhaps *note gc.disable():
     4d92. was called, or the *note Py_TPFLAGS_HAVE_GC: 985. flag was
     erroneously omitted in one of the involved types), the objects
     remain indefinitely uncollectable (they "leak").  See *note
     gc.garbage: 13dd.

If the object is marked as supporting garbage collection (the *note
Py_TPFLAGS_HAVE_GC: 985. flag is set in *note tp_flags: 1cce.), the
following events are also possible:

   * The garbage collector occasionally calls *note tp_traverse: 986. to
     identify *note cyclic isolates: 5972.

   * When the garbage collector discovers a *note cyclic isolate: 5972,
     it finalizes one of the objects in the group by marking it as
     'finalized' and calling its *note tp_finalize: ca1. 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: ca1. is permitted to resurrect the object by
     adding a reference from outside the *note cyclic isolate: 5972.
     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: 5972.
     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: 5267. 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.21.2.2 Cyclic Isolate Destruction
...................................

Listed below are the stages of life of a hypothetical *note cyclic
isolate: 5972. 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:
ca1.).

  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: 165. 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: 13dd.).  It is a
     bug if a cyclic isolate reaches this stage--it means the *note
     tp_clear: 5267. methods of the participating objects have failed to
     break the reference cycle as required.

If *note tp_clear: 5267. 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 ‘tp_clear’ is called to partially destroy the objects
enough to detangle them from each other, then *note tp_dealloc: 5241. 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: 5267. (if called) and concludes with *note tp_dealloc:
5241.

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: ca1. and *note tp_clear: 5267.
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 ‘tp_finalize’ and ‘tp_clear’ 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.21.2.3 関数
.............

To allocate and free memory, see *note Allocating objects on the heap:
5960.

 -- C の関数: void PyObject_CallFinalizer (PyObject *op)

     Finalizes the object as described in *note tp_finalize: ca1.  Call
     this function (or *note PyObject_CallFinalizerFromDealloc(): 5971.)
     instead of calling ‘tp_finalize’ 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: 985. 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(): 5975. but meant to be
     called at the beginning of the object's destructor (*note
     tp_dealloc: 5241.).  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: 5241. for example code.


File: python.info,  Node: 共通のオブジェクト構造体 common object structure,  Next: Type Object Structures,  Prev: Object Life Cycle,  Up: オブジェクト実装サポート object implementation support

7.21.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.21.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: 4a5b.
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: 556b.

 -- 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: 2d1. and *note Py_TYPE: 3c7.

      -- C のメンバ変数: *note Py_ssize_t: c59. ob_refcnt
          ' 次に属します: *note Stable ABI: 775.'  The object's
          reference count, as returned by *note Py_REFCNT: 2d1.  Do not
          use this field directly; instead use functions and macros such
          as ‘Py_REFCNT’, *note Py_INCREF(): 78f. and *note Py_DecRef():
          54af.

          The field type may be different from ‘Py_ssize_t’, depending
          on build configuration and platform.

      -- C のメンバ変数: *note PyTypeObject: ca0. *ob_type
          ' 次に属します: *note Stable ABI: 775.'  The object's type.
          Do not use this field directly; use *note Py_TYPE: 3c7. and
          *note Py_SET_TYPE(): 988. instead.

 -- C のデータ型: type PyVarObject
     ' 次に属します: *note Limited API: 775.  (いくつかのメンバーのみが
     安定 ABI です。)' An extension of *note PyObject: 5df. that adds
     the *note ob_size: 54a1. 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: 989, *note Py_REFCNT:
     2d1. and *note Py_TYPE: 3c7.

      -- C のメンバ変数: *note Py_ssize_t: c59. 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: 989.
          instead.

          Object creation functions such as *note PyObject_NewVar():
          b81. 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: 98a.

          To get an object's publicly exposed length, as returned by the
          Python function *note len(): 840, use *note PyObject_Length():
          541a. instead.

 -- C のマクロ: PyObject_HEAD

     可変な長さを持たないオブジェクトを表現する新しい型を宣言するときに
     使うマクロです。 PyObject_HEAD マクロは次のように展開されます:

          PyObject ob_base;

     上にある *note PyObject: 5df. のドキュメントを参照してください。

 -- C のマクロ: PyObject_VAR_HEAD

     インスタンスごとに異なる長さを持つオブジェクトを表現する新しい型を
     宣言するときに使うマクロです。 PyObject_VAR_HEAD マクロは次のように
     展開されます:

          PyVarObject ob_base;

     上にある *note PyVarObject: 4a5b. のドキュメントを参照してください
     。

 -- C 変数: *note PyTypeObject: ca0. PyBaseObject_Type
     ' 次に属します: *note Stable ABI: 775.'  The base class of all
     other objects, the same as *note object: c82. 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: ca0. *Py_TYPE (PyObject *o)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.14 より).'  Get the type of the Python object 'o'.

     The returned reference is *note borrowed: 3d5. from 'o'.  Do not
     release it with *note Py_DECREF(): 790. or similar.

     バージョン 3.11 で変更: *note Py_TYPE(): 3c7. 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__: 16cb. using *note
     PyObject_SetAttrString(): 19ed. or similar.

     Note that assigning an incompatible type can lead to undefined
     behavior.

     If 'type' is a *note heap type: b62, 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: c59. Py_SIZE (PyVarObject *o)

     Get the *note ob_size: 54a1. field of 'o'.

     バージョン 3.11 で変更: *note Py_SIZE(): 989. is changed to an
     inline static function.  The parameter type is no longer const
     *note PyVarObject: 4a5b.*.

 -- C の関数: void Py_SET_SIZE (PyVarObject *o, Py_ssize_t size)

     Set the *note ob_size: 54a1. 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: 4a5b. type, including the *note ob_size: 54a1.
     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.21.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: 597f.  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: 19fd.  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: 5980.  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: 1a6b.
     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: 1696. 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: 5981. 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: 1696, the compiler will
require a cast in the method table.  Even though ‘PyCFunction’ defines
the first parameter as PyObject*, it is common that the method
implementation uses the specific C type of the 'self' object.

The *note ml_flags: 5982. 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: 1696. 型
     のメソッドで典型的に使われる呼び出し規約です。関数は *note
     PyObject: 5df.* 型の引数値を二つ要求します。最初の引数はメソッドの
     'self' オブジェクトです; モジュール関数の場合、これはモジュールオブ
     ジェクトです。第二のパラメタ (よく 'args' と呼ばれます) は、全ての
     引数を表現するタプルオブジェクトです。パラメタは通常、 *note
     PyArg_ParseTuple(): 3bf. や *note PyArg_UnpackTuple(): 1724. で処理
     されます。

 -- C のマクロ: METH_KEYWORDS

     Can only be used in certain combinations with other flags: *note
     METH_VARARGS | METH_KEYWORDS: 597f, *note METH_FASTCALL |
     METH_KEYWORDS: 5980. and *note METH_METHOD | METH_FASTCALL |
     METH_KEYWORDS: 1a6b.

*note METH_VARARGS: 1726. | *note METH_KEYWORDS: 5226.

     Methods with these flags must be of type *note
     PyCFunctionWithKeywords: 5310.  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.10 より).'
     Fast calling convention supporting only positional arguments.  The
     methods have the type *note PyCFunctionFast: 530e.  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: 52e2.

*note METH_FASTCALL: 19fd. | *note METH_KEYWORDS: 5226.

     Extension of *note METH_FASTCALL: 19fd. supporting also keyword
     arguments, with methods of type *note PyCFunctionFastWithKeywords:
     530f.  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: 1a6b.

*note METH_METHOD: b6c. | *note METH_FASTCALL: 19fd. | *note METH_KEYWORDS: 5226.

     Extension of *note METH_FASTCALL | METH_KEYWORDS: 5980. 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: 96c, 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: 16f2. flag.  They need to be of type
     *note PyCFunction: 1696.  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: 1aeb. 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: 1725. flag,
     instead of invoking *note PyArg_ParseTuple(): 3bf. with a ‘"O"’
     argument.  They have the type *note PyCFunction: 1696, 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(): 451. を使って生成するの
     と同じ '静的メソッド (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__(): 15d7. 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: ca0. PyCMethod_Type

     The type object corresponding to Python C method objects.  This is
     available as *note types.BuiltinMethodType: 2a60. in the Python
     layer.

 -- C の関数: int PyCMethod_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCMethod_Type:
     5984. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCMethod_CheckExact (PyObject *op)

     This is the same as *note PyCMethod_Check(): 5985, 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: 2df7.
     object.  The caller must ensure that 'ml' outlives the callable.
     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: 2df7. 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: 886. or
     ‘NULL’.

     参考
     ....

     *note function.__module__: 23a6.

     The 'cls' parameter will be passed as the 'defining_class' argument
     to the C function.  Must be set if *note METH_METHOD: b6c. is set
     on ‘ml->ml_flags’.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: ca0. PyCFunction_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object
     corresponding to Python C function objects.  This is available as
     *note types.BuiltinFunctionType: 2a5f. in the Python layer.

 -- C の関数: int PyCFunction_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCFunction_Type:
     5314. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCFunction_CheckExact (PyObject *op)

     This is the same as *note PyCFunction_Check(): 5987, 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: 5982.

     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(): 5311, but without
     error or type checking.

 -- C の関数: *note PyCFunction: 1696. PyCFunction_GetFunction (PyObject
          *func)
     ' 次に属します: *note Stable ABI: 775.'  Get the function pointer
     on 'func' as it was passed to *note ml_meth: 5981.

     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(): 5312, 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: 1696.  For C function objects
     created through a *note PyMethodDef: 16f5. on a *note PyModuleDef:
     b78, 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: 3d5. 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(): 5313, 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.21.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: 5257. 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: 1a4f. for the possible values.

      -- C のメンバ変数: *note Py_ssize_t: c59. 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: 598f, 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: 1bf4.

     By default (when *note flags: 5270. 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: 54c7,
     imply ‘Py_READONLY’.  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: 561a. 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: 566f. and *note
     tp_weaklistoffset: b83. 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.21.3.4 Member flags
.....................

The following flags can be used with *note PyMemberDef.flags: 5270.:

 -- 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: 1c70. before
     reading.

 -- C のマクロ: Py_RELATIVE_OFFSET
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Indicates that the *note offset: 598e. 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: 551a. *note
     slot: 5461. when creating a class using negative *note basicsize:
     76a.  It is mandatory in that case.  When setting *note tp_members:
     5257. from the slot during class creation, Python clears the flag
     and sets *note PyMemberDef.offset: 598e. 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.21.3.5 Member types
.....................

*note PyMemberDef.type: 526f. 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: 199. or *note
ValueError: 2ee. is raised.

Unless marked (D), attributes defined this way cannot be deleted using
e.g.  *note del: 1b7e. or *note delattr(): 2616.

マクロ名                             C の型                            Python の型
                                                                       
--------------------------------------------------------------------------------------------------
                                                                       
 -- C のマクロ: Py_T_BYTE            char                              *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_SHORT           short                             *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_INT             int                               *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONG            long                              *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONGLONG        long long                         *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UBYTE           unsigned char                     *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UINT            unsigned int                      *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_USHORT          unsigned short                    *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONG           unsigned long                     *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONGLONG       unsigned long long                *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_PYSSIZET        *note Py_ssize_t: c59.            *note int: 19c.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_FLOAT           float                             *note float: 197.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_DOUBLE          double                            *note float: 197.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_BOOL            char (written as 0 or 1)          *note bool: 3c1.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_STRING          const char* (*)                   *note str: 16a. (RO)
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ:                      const char[] (*)                  *note str: 16a. (RO)
          Py_T_STRING_INPLACE                                          
     ' 次に属します:
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_CHAR            char (0-127)                      *note str: 16a. (**)
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_OBJECT_EX       *note PyObject: 5df.*             *note object: c82. (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.21.3.6 Defining Getters and Setters
.....................................

 -- C のデータ型: type PyGetSetDef
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'  型
     のプロパティのようなアクセスを定義するための構造体です。 *note
     PyTypeObject.tp_getset: 525c. スロットの説明も参照してください。

      -- C のメンバ変数: const char *name

          属性名

      -- C のメンバ変数: *note getter: 552d. get

          C function to get the attribute.

      -- C のメンバ変数: *note setter: 553b. 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.21.4 Type Object Structures
-----------------------------

新スタイルの型を定義する構造体: *note PyTypeObject: ca0. 構造体は、おそ
らく Python オブジェクトシステムの中で最も重要な構造体の1つでしょう。型
オブジェクトは ‘PyObject_*’ 系や ‘PyType_*’ 系の関数で扱えますが、ほとん
どの Python アプリケーションにとって、さして面白みのある機能を提供しませ
ん。型オブジェクトはオブジェクトがどのように振舞うかを決める基盤ですから
、インタプリタ自体や新たな型を定義する拡張モジュールでは非常に重要な存在
です。

型オブジェクトは標準の型 (standard type) に比べるとかなり大きな構造体で
す。各型オブジェクトは多くの値を保持しており、そのほとんどは C 関数への
ポインタで、それぞれの関数はその型の機能の小さい部分を実装しています。こ
の節では、型オブジェクトの各フィールドについて詳細を説明します。各フィー
ルドは、構造体内で出現する順番に説明されています。

以下のクイックリファレンスに加えて、 *note 使用例: 599c. 節では *note
PyTypeObject: ca0. の意味と使い方を一目で理解できる例を載せています。

* 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.21.4.1 クイックリファレンス
.............................

* Menu:

* tp スロット::
* sub-slots::
* スロットの定義型 (typedef): スロットの定義型 typedef.


File: python.info,  Node: tp スロット,  Next: sub-slots,  Up: クイックリファレンス

7.21.4.2 tp スロット
....................

PyTypeObject スロッ    *note 型: 59a0.        特殊メソッド/特殊属    Info
ト (1)                                        性                     (2)
                                                                     
---------------------------------------------------------------------------------------------
                                                                     
O                      T                      D                      I
                                                                     
                                                                                       
<R>                    const char *           __name__               X     X
*note tp_name: 1d0b.                                                       

*note tp_basicsize: b82.*note Py_ssize_t: c59.                       X     X           X
                                                                                       
                                                                                       
*note tp_itemsize: 241b.*note Py_ssize_t: c59.                             X           X
                                                                                       
                                                                                       
*note tp_dealloc: 5241.*note destructor: 5528.                       X     X           X
                                                                                       
                                                                                       
*note tp_vectorcall_offset: 561a.*note Py_ssize_t: c59.                    X           X
                                                                                       
                                                                                       
(*note tp_getattr: 5272.)*note getattrfunc: 5529.__getattribute__,                     G
                                              __getattr__                              
                                              
                                                                                       
(*note tp_setattr: 5273.)*note setattrfunc: 5539.__setattr__,                          G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_async: 10d3.*note PyAsyncMethods: 566d.*note sub-slots: 59a1.              %
                       *                                                               
                       
                                                                                       
*note tp_repr: 5269.   *note reprfunc: 5537.  __repr__               X     X           X
                                                                                       
                                                                                       
*note tp_as_number: b86.*note PyNumberMethods: 163c.*note sub-slots: 59a1.             %
                       *                                                               
                       
                                                                                       
*note tp_as_sequence: 59a2.*note PySequenceMethods: 5279.*note sub-slots: 59a1.        %
                       *                                                               
                       
                                                                                       
*note tp_as_mapping: 59a3.*note PyMappingMethods: 527a.*note sub-slots: 59a1.          %
                       *                                                               
                       
                                                                                       
*note tp_hash: 527b.   *note hashfunc: 552e.  __hash__               X                 G
                                                                                       
                                                                                       
*note tp_call: 77b.    *note ternaryfunc: 553e.__call__                    X           X
                                                                                       
                                                                                       
*note tp_str: 526a.    *note reprfunc: 5537.  __str__                X                 X
                                                                                       
                                                                                       
*note tp_getattro: 1ac5.*note getattrofunc: 552a.__getattribute__,   X     X           G
                                              __getattr__                              
                                              
                                                                                       
*note tp_setattro: 526d.*note setattrofunc: 553a.__setattr__,        X     X           G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_buffer: b84.*note PyBufferProcs: 5674.*note sub-slots: 59a1.               %
                       *                                                               
                       
                                                                                       
*note tp_flags: 1cce.  unsigned long                                 X     X           ?
                                                                                       
                                                                                       
*note tp_doc: 5250.    const char *           __doc__                X     X
                                                                           
                                                                                       
*note tp_traverse: 986.*note traverseproc: 553f.                           X           G
                                                                                       
                                                                                       
*note tp_clear: 5267.  *note inquiry: 5530.                                X           G
                                                                                       
                                                                                       
*note tp_richcompare: 5275.*note richcmpfunc: 5538.__lt__, __le__,   X                 G
                                              __eq__, __ne__,                          
                                              __gt__, __ge__
                                              
                                                                                       
(*note tp_weaklistoffset: b83.)*note Py_ssize_t: c59.                      X           ?
                                                                                       
                                                                                       
*note tp_iter: 170d.   *note getiterfunc: 552c.__iter__                                X
                                                                                       
                                                                                       
*note tp_iternext: 170e.*note iternextfunc: 5531.__next__                              X
                                                                                       
                                                                                       
*note tp_methods: 5259.*note PyMethodDef: 16f5.                      X     X
                       []                                                  
                       
                                                                                       
*note tp_members: 5257.*note PyMemberDef: 771.                             X
                       []                                                  
                       
                                                                                       
*note tp_getset: 525c. *note PyGetSetDef: db6.                       X     X
                       []                                                  
                       
                                                                                       
*note tp_base: 23d1.   *note PyTypeObject: ca0.__base__                          X
                       *                                                         
                       
                                                                                       
*note tp_dict: 1aed.   *note PyObject: 5df.   __dict__                           ?
                       *                                                         
                       
                                                                                       
*note tp_descr_get: 59a4.*note descrgetfunc: 5526.__get__                              X
                                                                                       
                                                                                       
*note tp_descr_set: 1d0f.*note descrsetfunc: 5527.__set__, __delete__                  X
                                                                                       
                                                                                       
(*note tp_dictoffset: 566f.)*note Py_ssize_t: c59.                         X           ?
                                                                                       
                                                                                       
*note tp_init: 7a1.    *note initproc: 552f.  __init__               X     X           X
                                                                                       
                                                                                       
*note tp_alloc: 5255.  *note allocfunc: 5524.                        X           ?     ?
                                                                                       
                                                                                       
*note tp_new: 79f.     *note newfunc: 5533.   __new__                X     X     ?     ?
                                                                                       
                                                                                       
*note tp_free: 5254.   *note freefunc: 57c7.                         X     X     ?     ?
                                                                                       
                                                                                       
*note tp_is_gc: 59a5.  *note inquiry: 5530.                                X           X
                                                                                       
                                                                                       
<*note tp_bases: 59a6.>*note PyObject: 5df.   __bases__                          ~
                       *                                                         
                       
                                                                                       
<*note tp_mro: 5671.>  *note PyObject: 5df.   __mro__                            ~
                       *                                                         
                       
                                                                                       
[*note tp_cache: 5672.]*note PyObject: 5df.
                       *
                       
                                                                                       
[*note tp_subclasses: 792.]void *             __subclasses__
                                              
                                                                                       
[*note tp_weaklist: 5673.]*note PyObject: 5df.
                       *
                       
                                                                                       
(*note tp_del: 59a7.)  *note destructor: 5528.
                       
                                                                                       
[*note tp_version_tag: 59a8.]unsigned int
                       
                                                                                       
*note tp_finalize: ca1.*note destructor: 5528.__del__                                  X
                                                                                       
                                                                                       
*note tp_vectorcall: 19ea.*note vectorcallfunc: 779.
                       
                                                                                       
[*note tp_watched: 59a9.]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: 52fa.

'"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.21.4.3 sub-slots
..................

Slot                           *note 型: 59a0.       特殊メソッド
                                                     
----------------------------------------------------------------------
                                                     
*note am_await: 59ab.          *note unaryfunc: 5540.__await__
                                                     
                                                     
*note am_aiter: 59ac.          *note unaryfunc: 5540.__aiter__
                                                     
                                                     
*note am_anext: 59ad.          *note unaryfunc: 5540.__anext__
                                                     
                                                     
*note am_send: 59ae.           *note sendfunc: 59af.
                               
                                                     
                                                     
*note nb_add: 5665.            *note binaryfunc: 5525.__add__
                                                     __radd__
                                                     
                                                     
*note nb_inplace_add: 59b0.    *note binaryfunc: 5525.__iadd__
                                                     
                                                     
*note nb_subtract: 59b1.       *note binaryfunc: 5525.__sub__
                                                     __rsub__
                                                     
                                                     
*note nb_inplace_subtract: 59b2.*note binaryfunc: 5525.__isub__
                                                     
                                                     
*note nb_multiply: 59b3.       *note binaryfunc: 5525.__mul__
                                                     __rmul__
                                                     
                                                     
*note nb_inplace_multiply: 59b4.*note binaryfunc: 5525.__imul__
                                                     
                                                     
*note nb_remainder: 59b5.      *note binaryfunc: 5525.__mod__
                                                     __rmod__
                                                     
                                                     
*note nb_inplace_remainder: 59b6.*note binaryfunc: 5525.__imod__
                                                     
                                                     
*note nb_divmod: 59b7.         *note binaryfunc: 5525.__divmod__
                                                     __rdivmod__
                                                     
                                                     
*note nb_power: 59b8.          *note ternaryfunc: 553e.__pow__
                                                     __rpow__
                                                     
                                                     
*note nb_inplace_power: 59b9.  *note ternaryfunc: 553e.__ipow__
                                                     
                                                     
*note nb_negative: 59ba.       *note unaryfunc: 5540.__neg__
                                                     
                                                     
*note nb_positive: 59bb.       *note unaryfunc: 5540.__pos__
                                                     
                                                     
*note nb_absolute: 59bc.       *note unaryfunc: 5540.__abs__
                                                     
                                                     
*note nb_bool: 59bd.           *note inquiry: 5530.  __bool__
                                                     
                                                     
*note nb_invert: 59be.         *note unaryfunc: 5540.__invert__
                                                     
                                                     
*note nb_lshift: 59bf.         *note binaryfunc: 5525.__lshift__
                                                     __rlshift__
                                                     
                                                     
*note nb_inplace_lshift: 59c0. *note binaryfunc: 5525.__ilshift__
                                                     
                                                     
*note nb_rshift: 59c1.         *note binaryfunc: 5525.__rshift__
                                                     __rrshift__
                                                     
                                                     
*note nb_inplace_rshift: 59c2. *note binaryfunc: 5525.__irshift__
                                                     
                                                     
*note nb_and: 59c3.            *note binaryfunc: 5525.__and__
                                                     __rand__
                                                     
                                                     
*note nb_inplace_and: 59c4.    *note binaryfunc: 5525.__iand__
                                                     
                                                     
*note nb_xor: 59c5.            *note binaryfunc: 5525.__xor__
                                                     __rxor__
                                                     
                                                     
*note nb_inplace_xor: 59c6.    *note binaryfunc: 5525.__ixor__
                                                     
                                                     
*note nb_or: 59c7.             *note binaryfunc: 5525.__or__ __ror__
                                                     
                                                     
*note nb_inplace_or: 59c8.     *note binaryfunc: 5525.__ior__
                                                     
                                                     
*note nb_int: 59c9.            *note unaryfunc: 5540.__int__
                                                     
                                                     
*note nb_reserved: 59ca.       void *
                               
                                                     
*note nb_float: 59cb.          *note unaryfunc: 5540.__float__
                                                     
                                                     
*note nb_floor_divide: 59cc.   *note binaryfunc: 5525.__floordiv__
                                                     
                                                     
*note nb_inplace_floor_divide: 59cd.*note binaryfunc: 5525.__ifloordiv__
                                                     
                                                     
*note nb_true_divide: 59ce.    *note binaryfunc: 5525.__truediv__
                                                     
                                                     
*note nb_inplace_true_divide: 59cf.*note binaryfunc: 5525.__itruediv__
                                                     
                                                     
*note nb_index: 163b.          *note unaryfunc: 5540.__index__
                                                     
                                                     
*note nb_matrix_multiply: 59d0.*note binaryfunc: 5525.__matmul__
                                                     __rmatmul__
                                                     
                                                     
*note nb_inplace_matrix_multiply: 59d1.*note binaryfunc: 5525.__imatmul__
                                                     
                                                     
                                                     
*note mp_length: 59d2.         *note lenfunc: 5532.  __len__
                                                     
                                                     
*note mp_subscript: 1d54.      *note binaryfunc: 5525.__getitem__
                                                     
                                                     
*note mp_ass_subscript: 59d3.  *note objobjargproc: 5534.__setitem__,
                                                     __delitem__
                                                     
                                                     
                                                     
*note sq_length: 566e.         *note lenfunc: 5532.  __len__
                                                     
                                                     
*note sq_concat: 59d4.         *note binaryfunc: 5525.__add__
                                                     
                                                     
*note sq_repeat: 59d5.         *note ssizeargfunc: 553c.__mul__
                                                     
                                                     
*note sq_item: 1d53.           *note ssizeargfunc: 553c.__getitem__
                                                     
                                                     
*note sq_ass_item: 59d6.       *note ssizeobjargproc: 553d.__setitem__
                                                     __delitem__
                                                     
                                                     
*note sq_contains: 59d7.       *note objobjproc: 5535.__contains__
                                                     
                                                     
*note sq_inplace_concat: 59d8. *note binaryfunc: 5525.__iadd__
                                                     
                                                     
*note sq_inplace_repeat: 59d9. *note ssizeargfunc: 553c.__imul__
                                                     
                                                     
                                                     
*note bf_getbuffer: 96a.       *note getbufferproc(): 552b.__buffer__
                                                     
                                                     
*note bf_releasebuffer: 96b.   *note releasebufferproc(): 5536.__release_buffer__
                                                     


File: python.info,  Node: スロットの定義型 typedef,  Prev: sub-slots,  Up: クイックリファレンス

7.21.4.4 スロットの定義型 (typedef)
...................................

定義型 (typedef)                  引数型                            返り値型
                                                                    
-----------------------------------------------------------------------------------------------
                                                                    
*note allocfunc: 5524.                 *note PyTypeObject: ca0. *   *note PyObject: 5df. *
                                       *note Py_ssize_t: c59.       
                                  
                                                                    
*note destructor: 5528.           *note PyObject: 5df. *            void
                                                                    
                                                                    
*note freefunc: 57c7.             void *                            void
                                                                    
                                                                    
*note traverseproc: 553f.              *note PyObject: 5df. *       int
                                       *note visitproc: 5541.       
                                       void *
                                  
                                                                    
*note newfunc: 5533.                   *note PyTypeObject: ca0. *   *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note initproc: 552f.                  *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note reprfunc: 5537.             *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note getattrfunc: 5529.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       const char *                 
                                  
                                                                    
*note setattrfunc: 5539.               *note PyObject: 5df. *       int
                                       const char *                 
                                       *note PyObject: 5df. *
                                  
                                                                    
*note getattrofunc: 552a.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note setattrofunc: 553a.              *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note descrgetfunc: 5526.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note descrsetfunc: 5527.              *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note hashfunc: 552e.             *note PyObject: 5df. *            Py_hash_t
                                                                    
                                                                    
*note richcmpfunc: 5538.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       int
                                  
                                                                    
*note getiterfunc: 552c.          *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note iternextfunc: 5531.         *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note lenfunc: 5532.              *note PyObject: 5df. *            *note Py_ssize_t: c59.
                                                                    
                                                                    
*note getbufferproc: 552b.             *note PyObject: 5df. *       int
                                       *note Py_buffer: 960. *      
                                       int
                                  
                                                                    
*note releasebufferproc: 5536.         *note PyObject: 5df. *       void
                                       *note Py_buffer: 960. *      
                                  
                                                                    
*note inquiry: 5530.              *note PyObject: 5df. *            int
                                                                    
                                                                    
*note unaryfunc: 5540.                 *note PyObject: 5df. *       *note PyObject: 5df. *
                                                                    
                                                                    
*note binaryfunc: 5525.                *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note ternaryfunc: 553e.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note ssizeargfunc: 553c.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note Py_ssize_t: c59.       
                                  
                                                                    
*note ssizeobjargproc: 553d.           *note PyObject: 5df. *       int
                                       *note Py_ssize_t: c59.       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note objobjproc: 5535.                *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note objobjargproc: 5534.             *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  

See *note Slot Type typedefs: 59db. below for more detail.


File: python.info,  Node: PyTypeObject 定義,  Next: PyObject スロット,  Prev: クイックリファレンス,  Up: Type Object Structures

7.21.4.5 PyTypeObject 定義
..........................

The structure definition for *note PyTypeObject: ca0. 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.21.4.6 PyObject スロット
..........................

The type object structure extends the *note PyVarObject: 4a5b.
structure.  The *note ob_size: 54a1. 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: 241b, which means that its instances (i.e.  type objects)
'must' have the ‘ob_size’ field.

*note PyObject.ob_refcnt: aa3.

     The type object's reference count is initialized to ‘1’ by the
     ‘PyObject_HEAD_INIT’ macro.  Note that for *note statically
     allocated type objects: 987, the type's instances (objects whose
     *note ob_type: 5252. points back to the type) do 'not' count as
     references.  But for *note dynamically allocated type objects: b62,
     the instances 'do' count as references.

     '継承:'

     サブタイプはこのフィールドを継承しません。

*note PyObject.ob_type: 5252.

     型自体の型、別の言い方をするとメタタイプです。 ‘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(): 984. checks if *note ob_type: 5252. is
     ‘NULL’, and if so, initializes it to the ‘ob_type’ field of the
     base class.  ‘PyType_Ready()’ will not change this field if it is
     non-zero.

     '継承:'

     サブタイプはこのフィールドを継承します。


File: python.info,  Node: PyVarObject スロット,  Next: PyTypeObject スロット,  Prev: PyObject スロット,  Up: Type Object Structures

7.21.4.7 PyVarObject スロット
.............................

*note PyVarObject.ob_size: 54a1.

     *note 静的にメモリ確保されている型オブジェクト: 987. の場合、このフ
     ィールドはゼロに初期化されます。*note
     動的にメモリ確保されている型オブジェクト: b62. の場合、このフィール
     ドは内部使用される特殊な意味を持ちます。

     This field should be accessed using the *note Py_SIZE(): 989.
     macro.

     '継承:'

     サブタイプはこのフィールドを継承しません。


File: python.info,  Node: PyTypeObject スロット,  Next: Static Types,  Prev: PyVarObject スロット,  Up: Type Object Structures

7.21.4.8 PyTypeObject スロット
..............................

Each slot has a section describing inheritance.  If *note
PyType_Ready(): 984. 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: 52fa. and *note PyType_Type: 76f.
effectively act as defaults.)

 -- C のメンバ変数: const char **note PyTypeObject: ca0.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: 1d0b. initializer ‘"P.Q.M.T"’.

     *note 動的にメモリ確保される型オブジェクト: b62. の場合、このフィー
     ルドは単に型の名前になり、モジュール名は型の辞書内でキー
     ‘'__module__'’ に対する値として明示的に保存されます。

     For *note statically allocated type objects: 987, 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__: 16c9.
     attribute.

     If no dot is present, the entire *note tp_name: 1d0b. field is made
     accessible as the *note __name__: 16c9. 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(): ca0. (other than potentially *note
     tp_itemsize: 241b.).

     '継承:'

     サブタイプはこのフィールドを継承しません。

 -- C のメンバ変数: *note Py_ssize_t: c59. *note PyTypeObject:
          ca0.tp_basicsize
 -- C のメンバ変数: *note Py_ssize_t: c59. *note PyTypeObject:
          ca0.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(): 1b0a.)

     For a type with variable-length instances, the instances must have
     an *note ob_size: 54a1. 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(): b81. will take the value of
     N as an argument, and store in the instance's *note ob_size: 54a1.
     field.  Note that the ‘ob_size’ field may later be used for other
     purposes.  For example, *note int: 19c. instances use the bits of
     ‘ob_size’ in an implementation-defined way; the underlying storage
     and its size should be accessed using *note PyLong_Export(): 3a6.

          注釈: The *note ob_size: 54a1. field should be accessed using
          the *note Py_SIZE(): 989. and *note Py_SET_SIZE(): 98a.
          macros.

     Also, the presence of an *note ob_size: 54a1. field in the instance
     layout doesn't mean that the instance structure is variable-length.
     For example, the *note list: 24f. type has fixed-length instances,
     yet those instances have a ‘ob_size’ field.  (As with *note int:
     19c, avoid reading lists' ‘ob_size’ directly.  Call *note
     PyList_Size(): 1638. instead.)

     The ‘tp_basicsize’ includes size needed for data of the type's
     *note tp_base: 23d1, 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: c82, this struct
     must include *note PyObject: 5df. or *note PyVarObject: 4a5b.
     (depending on whether *note ob_size: 54a1. should be included).
     These are usually defined by the macro *note PyObject_HEAD: 14f9.
     or *note PyObject_VAR_HEAD: 597b, respectively.

     The basic size does not include the GC header size, as that header
     is not part of *note PyObject_HEAD: 14f9.

     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: 14f9, 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(): 984. 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: 241b, it is
     generally not safe to set ‘tp_itemsize’ to a different non-zero
     value in a subtype (though this depends on the implementation of
     the base type).

 -- C のメンバ変数: *note destructor: 5528. *note PyTypeObject:
          ca0.tp_dealloc

     ' The corresponding *note slot ID: 5461. ‘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:
     5254. function to free the object itself.

     If you may call functions that may set the error indicator, you
     must use *note PyErr_GetRaisedException(): 427. and *note
     PyErr_SetRaisedException(): 42a. 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: ca1.) subsequently resurrects
          the object.

        * An object will not be destroyed while it is being
          automatically finalized (*note tp_finalize: ca1.) or
          automatically cleared (*note tp_clear: 5267.).

     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(): 5971. 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: 985. flag is set), the destructor should call
     *note PyObject_GC_UnTrack(): 1723. before clearing any member
     fields.

     It is permissible to call *note tp_clear: 5267. 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: ab0.),
     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: 5256.  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: 596d. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note Py_ssize_t: c59. *note PyTypeObject:
          ca0.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: b62. 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: 5529. *note PyTypeObject:
          ca0.tp_getattr

     ' The corresponding *note slot ID: 5461. ‘Py_tp_getattr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、get-attribute-string を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_getattro: 1ac5. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_getattr: 5272, *note tp_getattro: 1ac5.

     このフィールドは *note tp_getattro: 1ac5. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_getattr: 5272. および
     ‘tp_getattro’ が共に ‘NULL’ の場合、サブタイプは基底タイプから
     ‘tp_getattr’ と ‘tp_getattro’ を両方とも継承します。

 -- C のメンバ変数: *note setattrfunc: 5539. *note PyTypeObject:
          ca0.tp_setattr

     ' The corresponding *note slot ID: 5461. ‘Py_tp_setattr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_setattro: 526d. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_setattr: 5273, *note tp_setattro: 526d.

     このフィールドは *note tp_setattro: 526d. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_setattr: 5273. および
     ‘tp_setattro’ が共に ‘NULL’ の場合、サブタイプは基底タイプから
     ‘tp_setattr’ と ‘tp_setattro’ を両方とも継承します。

 -- C のメンバ変数: *note PyAsyncMethods: 566d. **note PyTypeObject:
          ca0.tp_as_async

     追加の構造体を指すポインタです。 この構造体は、 C レベルで *note
     awaitable: 4c9. プロトコルと *note asynchronous iterator: 4c7. プロ
     トコルを実装するオブジェクトだけに関係するフィールドを持ちます。 詳
     しいことは *note async オブジェクト構造体: 59e0. を参照してください
     。

     Added in version 3.5: 以前は ‘tp_compare’ や ‘tp_reserved’ として知
     られていました。

     '継承:'

     *note tp_as_async: 10d3. フィールドは継承されませんが、これに含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note reprfunc: 5537. *note PyTypeObject:
          ca0.tp_repr

     ' The corresponding *note slot ID: 5461. ‘Py_tp_repr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、組み込み関数 *note repr(): 1c3. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Repr(): 1234.:

          PyObject *tp_repr(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。理想的には、この関数が返す文字列は、適切な環境で *note
     eval(): 4a3. に渡した場合、同じ値を持つオブジェクトになるような文字
     列でなければなりません。不可能な場合には、オブジェクトの型と値から
     導出した内容の入った ‘'<'’ から始まって ‘'>'’ で終わる文字列を返さ
     なければなりません。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、 ‘<%s object at %p>’ の形式を
     とる文字列が返されます。 ‘%s’ は型の名前に、 ‘%p’ はオブジェクトの
     メモリアドレスに置き換えられます。

 -- C のメンバ変数: *note PyNumberMethods: 163c. **note PyTypeObject:
          ca0.tp_as_number

     数値プロトコルを実装した追加の構造体を指すポインタです。これらのフ
     ィールドについては *note 数値オブジェクト構造体: 59e1. で説明されて
     います。

     '継承:'

     *note tp_as_number: b86. フィールドは継承されませんが、そこの含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note PySequenceMethods: 5279. **note PyTypeObject:
          ca0.tp_as_sequence

     シーケンスプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note シーケンスオブジェクト構造体: 59e2.
     で説明されています。

     '継承:'

     *note tp_as_sequence: 59a2. フィールドは継承されませんが、これに含
     まれるフィールドが個別に継承されます。

 -- C のメンバ変数: *note PyMappingMethods: 527a. **note PyTypeObject:
          ca0.tp_as_mapping

     マッピングプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note マップオブジェクト構造体: 59e3. で説
     明されています。

     '継承:'

     *note tp_as_mapping: 59a3. フィールドは継承されませんが、これに含ま
     れるフィールドが個別に継承されます。

 -- C のメンバ変数: *note hashfunc: 552e. *note PyTypeObject:
          ca0.tp_hash

     ' The corresponding *note slot ID: 5461. ‘Py_tp_hash’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、組み込み関数 *note hash(): 801. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Hash(): 434.:

          Py_hash_t tp_hash(PyObject *);

     通常時には ‘-1’ を戻り値にしてはなりません; ハッシュ値の計算中にエ
     ラーが生じた場合、関数は例外をセットして ‘-1’ を返さねばなりません
     。

     When this field is not set ('and' *note tp_richcompare: 5275. is
     not set), an attempt to take the hash of the object raises *note
     TypeError: 199.  This is the same as setting it to *note
     PyObject_HashNotImplemented(): 15e4.

     このフィールドは明示的に *note PyObject_HashNotImplemented(): 15e4.
     に設定することで、親 type からのハッシュメソッドの継承をブロックす
     ることができます。これは Python レベルでの ‘__hash__ = None’ と同等
     に解釈され、 ‘isinstance(o, collections.Hashable)’ が正しく ‘False’
     を返すようになります。逆もまた可能であることに注意してください -
     Python レベルで ‘__hash__ = None’ を設定することで ‘tp_hash’ スロッ
     トは ‘PyObject_HashNotImplemented()’ に設定されます。

     '継承:'

     Group: *note tp_hash: 527b, *note tp_richcompare: 5275.

     このフィールドは *note tp_richcompare: 5275. と共にサブタイプに継承
     されます: すなわち、サブタイプの ‘tp_richcompare’ および *note
     tp_hash: 527b. が両方とも ‘NULL’ のとき、サブタイプは基底タイプから
     ‘tp_richcompare’ と ‘tp_hash’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52fa. uses *note PyObject_GenericHash():
     60c.

 -- C のメンバ変数: *note ternaryfunc: 553e. *note PyTypeObject:
          ca0.tp_call

     ' The corresponding *note slot ID: 5461. ‘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: 5537. *note PyTypeObject: ca0.tp_str

     ' The corresponding *note slot ID: 5461. ‘Py_tp_str’ is part of the
     *note Stable ABI: 775.'

     オプションのポインタで、組み込みの演算 *note str(): 16a. を実装して
     いる関数を指します。(*note str: 16a. が型の一つになったため、
     ‘str()’ は ‘str’ のコンストラクタを呼び出すことに注意してください。
     このコンストラクタは実際の処理を行う上で *note PyObject_Str():
     1235. を呼び出し、さらに ‘PyObject_Str()’ がこのハンドラを呼び出す
     ことになります。)

     The signature is the same as for *note PyObject_Str(): 1235.:

          PyObject *tp_str(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。それはオブジェクトを "分かりやすく (friendly)" 表現した文
     字列でなければなりません。というのは、この文字列はとりわけ *note
     print(): 117b. 関数で使われることになる表記だからです。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、文字列表現を返すためには
     *note PyObject_Repr(): 1234. が呼び出されます。

 -- C のメンバ変数: *note getattrofunc: 552a. *note PyTypeObject:
          ca0.tp_getattro

     ' The corresponding *note slot ID: 5461. ‘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(): 5414.
     をこのフィールドに設定しておくとたいていの場合は便利です。

     '継承:'

     Group: *note tp_getattr: 5272, *note tp_getattro: 1ac5.

     このフィールドは *note tp_getattr: 5272. と共にサブタイプに継承され
     ます: すなわち、サブタイプの ‘tp_getattr’ および *note tp_getattro:
     1ac5. が共に ‘NULL’ の場合、サブタイプは基底タイプから ‘tp_getattr’
     と ‘tp_getattro’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52fa. uses *note
     PyObject_GenericGetAttr(): 5414.

 -- C のメンバ変数: *note setattrofunc: 553a. *note PyTypeObject:
          ca0.tp_setattro

     ' The corresponding *note slot ID: 5461. ‘Py_tp_setattro’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     The signature is the same as for *note PyObject_SetAttr(): 17c8.:

          int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);

     さらに、'value' に ‘NULL’ を指定して属性を削除できるようにしなけれ
     ばなりません。 通常のオブジェクト属性設定を実装している *note
     PyObject_GenericSetAttr(): 5415. をこのフィールドに設定しておくとた
     いていの場合は便利です。

     '継承:'

     Group: *note tp_setattr: 5273, *note tp_setattro: 526d.

     このフィールドは *note tp_setattr: 5273. と共にサブタイプに継承され
     ます: すなわち、サブタイプの ‘tp_setattr’ および *note tp_setattro:
     526d. が共に ‘NULL’ の場合、サブタイプは基底タイプから ‘tp_setattr’
     と ‘tp_setattro’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52fa. uses *note
     PyObject_GenericSetAttr(): 5415.

 -- C のメンバ変数: *note PyBufferProcs: 5674. **note PyTypeObject:
          ca0.tp_as_buffer

     バッファインターフェースを実装しているオブジェクトにのみ関連する、
     一連のフィールド群が入った別の構造体を指すポインタです。構造体内の
     各フィールドは *note バッファオブジェクト構造体 (buffer object
     structure): 124c. で説明します。

     '継承:'

     *note tp_as_buffer: b84. フィールド自体は継承されませんが、これに含
     まれるフィールドは個別に継承されます。

 -- C のメンバ変数: unsigned long *note PyTypeObject: ca0.tp_flags

     このフィールドは様々なフラグからなるビットマスクです。いくつかのフ
     ラグは、特定の状況において変則的なセマンティクスが適用されることを
     示します; その他のフラグは、型オブジェクト (あるいは *note
     tp_as_number: b86. 、 *note tp_as_sequence: 59a2. 、 *note
     tp_as_mapping: 59a3. 、 および *note tp_as_buffer: b84. が参照して
     いる拡張機能構造体) の特定のフィールドのうち、過去から現在までずっ
     と存在していたわけではないものが有効になっていることを示すために使
     われます; フラグビットがクリアされていれば、フラグが保護しているフ
     ィールドにはアクセスしない代わりに、その値はゼロか ‘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: 985. flag bit is
     inherited together with the *note tp_traverse: 986. and *note
     tp_clear: 5267. fields, i.e.  if the ‘Py_TPFLAGS_HAVE_GC’ flag bit
     is clear in the subtype and the ‘tp_traverse’ and ‘tp_clear’ fields
     in the subtype exist and have ‘NULL’ values.

     'デフォルト'

     *note PyBaseObject_Type: 52fa. uses ‘Py_TPFLAGS_DEFAULT |
     Py_TPFLAGS_BASETYPE’.

     'Bit Masks:'

     以下に挙げるビットマスクは現在定義されているものです; フラグは ‘|’
     演算子で論理和を取って *note tp_flags: 1cce. フィールドの値を作成で
     きます。 *note PyType_HasFeature(): 1d9a. マクロは型とフラグ値、
     '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:
          5252. 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: 59e4. 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(): 984. で完全に初期化され
          るとセットされるビットです。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_READYING

          *note PyType_Ready(): 984. による型オブジェクトの初期化処理中
          にセットされるビットです。

          '継承:'

          ???

      -- 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: 5255.) must be
          allocated using *note PyObject_GC_New: c9d. or *note
          PyType_GenericAlloc(): c65. and deallocated (see *note
          tp_free: 5254.) using *note PyObject_GC_Del(): 1721.  More
          information in section *note
          循環参照ガベージコレクションをサポートする: 59e4.

          '継承:'

          Group: *note Py_TPFLAGS_HAVE_GC: 985, *note tp_traverse: 986,
          *note tp_clear: 5267.

          The *note Py_TPFLAGS_HAVE_GC: 985. flag bit is inherited
          together with the *note tp_traverse: 986. and *note tp_clear:
          5267. fields, i.e.  if the ‘Py_TPFLAGS_HAVE_GC’ flag bit is
          clear in the subtype and the ‘tp_traverse’ and ‘tp_clear’
          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: *note
          Py_TPFLAGS_HAVE_STACKLESS_EXTENSION: 59e7.

          '継承:'

          ???

      -- 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: 3cd. flag set.  For extension types,
          it is inherited whenever *note tp_descr_get: 59a4. 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: 985. 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: 566f.
          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:
          b83. 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: 241b.

          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(): 567f. will call *note
          PyType_FastSubclass(): 5661. 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(): 10aa.  Custom types that inherit
          from built-ins should have their *note tp_flags: 1cce. 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: ca1. スロットが存在しているとき
          にセットされるビットです。

          Added in version 3.4.

          バージョン 3.8 で非推奨: This flag isn't necessary anymore, as
          the interpreter assumes the *note tp_finalize: ca1. 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:
          561a. 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: 23f.

          バージョン 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(): 984. automatically applies this flag to
          *note static types: 987.

          '継承:'

          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(): 984. is
          called on the type.

          The flag is set automatically on *note static types: 987. if
          *note tp_base: 23d1. 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: 13d2.), 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:
          a12. block.  It is automatically set when registering or
          subclassing *note collections.abc.Mapping: acb, and unset when
          registering *note collections.abc.Sequence: 13e0.

               注釈: *note Py_TPFLAGS_MAPPING: 1cb5. and *note
               Py_TPFLAGS_SEQUENCE: 1cb6. 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: 1cb6.

          参考
          ....

          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:
          a12. block.  It is automatically set when registering or
          subclassing *note collections.abc.Sequence: 13e0, and unset
          when registering *note collections.abc.Mapping: acb.

               注釈: *note Py_TPFLAGS_MAPPING: 1cb5. and *note
               Py_TPFLAGS_SEQUENCE: 1cb6. 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: 1cb5.

          参考
          ....

          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(): 1bda.

               警告: This flag is present in header files, but is not be
               used.  It will be removed in a future version of CPython

      -- C のマクロ: Py_TPFLAGS_HAVE_VERSION_TAG

          This is a *note soft deprecated: 23f. macro that does nothing.
          Historically, this would indicate that the *note
          tp_version_tag: 59a8. field was available and initialized.

      -- C のマクロ: Py_TPFLAGS_INLINE_VALUES

          This bit indicates that instances of this type will have an
          "inline values" array (containing the object's attributes)
          placed directly after the end of the object.

          This requires that *note Py_TPFLAGS_HAVE_GC: 985. is set.

          '継承:'

          This flag is not inherited.

          Added in version 3.13.

      -- C のマクロ: Py_TPFLAGS_IS_ABSTRACT

          This bit indicates that this is an abstract type and therefore
          cannot be instantiated.

          '継承:'

          This flag is not inherited.

          参考
          ....

          *note abc: 4.

      -- C のマクロ: Py_TPFLAGS_HAVE_STACKLESS_EXTENSION

          Internal.  Do not set or unset this flag.  Historically, this
          was a reserved flag for use in Stackless Python.

               警告: This flag is present in header files, but is not be
               used.  This may be removed in a future version of
               CPython.

 -- C のメンバ変数: const char **note PyTypeObject: ca0.tp_doc

     ' The corresponding *note slot ID: 5461. ‘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__: 20f1. attribute on the type and instances of the type.

     '継承:'

     サブタイプはこのフィールドを継承 'しません' 。

 -- C のメンバ変数: *note traverseproc: 553f. *note PyTypeObject:
          ca0.tp_traverse

     ' The corresponding *note slot ID: 5461. ‘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: 985.
     flag bit is set.  The signature is:

          int tp_traverse(PyObject *self, visitproc visit, void *arg);

     Pythonのガベージコレクションの仕組みについての詳細は、 *note
     循環参照ガベージコレクションをサポートする: 59e4. にあります。

     The *note tp_traverse: 986. pointer is used by the garbage
     collector to detect reference cycles.  A typical implementation of
     a ‘tp_traverse’ function simply calls *note Py_VISIT(): 525e. 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 that *note Py_VISIT(): 525e. is called only on those members
     that can participate in reference cycles.  Although there is also a
     ‘self->key’ member, it can only be ‘NULL’ or a Python string and
     therefore cannot be part of a reference cycle.

     On the other hand, even if you know a member can never be part of a
     cycle, as a debugging aid you may want to visit it anyway just so
     the *note gc: 64. module's *note get_referents(): a0a. function
     will include it.

     Heap types (*note Py_TPFLAGS_HEAPTYPE: ab0.) 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: 1cce. field, the traverse function must call *note
     PyObject_VisitManagedDict(): 60d. like this:

          PyObject_VisitManagedDict((PyObject*)self, visit, arg);

          警告: When implementing *note tp_traverse: 986, 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:
          5673. 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(): 525e. 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: b62. hold a reference to
     their type.  Their traversal function must therefore either visit
     *note Py_TYPE(self): 3c7, 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: 986. 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: 985, *note tp_traverse: 986, *note
     tp_clear: 5267.

     This field is inherited by subtypes together with *note tp_clear:
     5267. and the *note Py_TPFLAGS_HAVE_GC: 985. flag bit: the flag
     bit, *note tp_traverse: 986, and ‘tp_clear’ are all inherited from
     the base type if they are all zero in the subtype.

 -- C のメンバ変数: *note inquiry: 5530. *note PyTypeObject:
          ca0.tp_clear

     ' The corresponding *note slot ID: 5461. ‘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: 5972. 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: 5241. 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:
     ca1. instead of ‘tp_clear’.

          注釈: If ‘tp_clear’ fails to break a reference cycle then the
          objects in the *note cyclic isolate: 5972. may remain
          indefinitely uncollectable ("leak").  See *note gc.garbage:
          13dd.

          注釈: Referents (direct and indirect) might have already been
          cleared; they are not guaranteed to be in a consistent state.

          注釈: The *note tp_clear: 5267. function can be called from
          any thread.

          注釈: An object is not guaranteed to be automatically cleared
          before its destructor (*note tp_dealloc: 5241.) is called.

     This function differs from the destructor (*note tp_dealloc: 5241.)
     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: 5254.).

        * 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: 5254.).  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: 5972.).

     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: 5972.

        * Python will not automatically clear an object if it has not
          been automatically finalized (see *note tp_finalize: ca1.).
          (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: 5972,
          Python will not automatically clear it if any member of the
          cyclic isolate has not yet been automatically finalized (*note
          tp_finalize: ca1.).

        * 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: 5972, but future
     versions might clear objects regularly before their destruction.

     Taken together, all *note tp_clear: 5267. functions in the system
     must combine to break all reference cycles.  This is subtle, and if
     in any doubt supply a ‘tp_clear’ function.  For example, the tuple
     type does not implement a ‘tp_clear’ function, because it's
     possible to prove that no reference cycle can be composed entirely
     of tuples.  Therefore the ‘tp_clear’ 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 ‘tp_clear’.

     次の例にあるように、 *note tp_clear: 5267. の実装は、インスタンスか
     ら 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
     ‘Py_CLEAR()’ macro performs the operations in a safe order.

     If the *note Py_TPFLAGS_MANAGED_DICT: 60f. bit is set in the *note
     tp_flags: 1cce. field, the clear function must call *note
     PyObject_ClearManagedDict(): 60e. like this:

          PyObject_ClearManagedDict((PyObject*)self);

     Pythonのガベージコレクションの仕組みについての詳細は、 *note
     循環参照ガベージコレクションをサポートする: 59e4. にあります。

     '継承:'

     Group: *note Py_TPFLAGS_HAVE_GC: 985, *note tp_traverse: 986, *note
     tp_clear: 5267.

     This field is inherited by subtypes together with *note
     tp_traverse: 986. and the *note Py_TPFLAGS_HAVE_GC: 985. flag bit:
     the flag bit, ‘tp_traverse’, and *note tp_clear: 5267. are all
     inherited from the base type if they are all zero in the subtype.

     参考
     ....

     *note Object Life Cycle: 596d. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note richcmpfunc: 5538. *note PyTypeObject:
          ca0.tp_richcompare

     ' The corresponding *note slot ID: 5461. ‘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: ca0.

     この関数は、比較結果を返すべきです。(普通は ‘Py_True’ か ‘Py_False’
     です。) 比較が未定義の場合は、‘Py_NotImplemented’ を、それ以外のエ
     ラーが発生した場合には例外状態をセットして ‘NULL’ を返さなければな
     りません。

     *note tp_richcompare: 5275. および *note PyObject_RichCompare():
     5276. 関数の第三引数に使うための定数としては以下が定義されています:

     定数                     比較
                              
     ------------------------------------------
                              
      -- 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(): 5276. と
          同様に要求された演算を指定します。

          The returned value is a new *note strong reference: 5e2.

          エラー時には例外を設定して、関数から ‘NULL’ でリターンします。

          Added in version 3.7.

     '継承:'

     Group: *note tp_hash: 527b, *note tp_richcompare: 5275.

     このフィールドは *note tp_hash: 527b. と共にサブタイプに継承されま
     す: すなわち、サブタイプの *note tp_richcompare: 5275. および
     ‘tp_hash’ が両方とも ‘NULL’ のとき、サブタイプは基底タイプから
     ‘tp_richcompare’ と ‘tp_hash’ を両方とも継承します。

     'デフォルト'

     *note PyBaseObject_Type: 52fa. provides a *note tp_richcompare:
     5275. implementation, which may be inherited.  However, if only
     *note tp_hash: 527b. 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: c59. *note PyTypeObject:
          ca0.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: 5673. と混同しないようにしてく
     ださい; これは型オブジェクト自身への弱参照からなるリストの先頭です
     。

     It is an error to set both the *note Py_TPFLAGS_MANAGED_WEAKREF:
     77c. bit and *note tp_weaklistoffset: b83.

     '継承:'

     このフィールドはサブタイプに継承されますが、以下の規則を読んでくだ
     さい。サブタイプはこのオフセット値をオーバライドすることがあります;
     従って、サブタイプでは弱参照リストの先頭が基底タイプとは異なる場合
     があります。リストの先頭は常に *note tp_weaklistoffset: b83. で分か
     るはずなので、このことは問題にはならないはずです。

     'デフォルト'

     If the *note Py_TPFLAGS_MANAGED_WEAKREF: 77c. bit is set in the
     *note tp_flags: 1cce. field, then *note tp_weaklistoffset: b83.
     will be set to a negative value, to indicate that it is unsafe to
     use this field.

 -- C のメンバ変数: *note getiterfunc: 552c. *note PyTypeObject:
          ca0.tp_iter

     ' The corresponding *note slot ID: 5461. ‘Py_tp_iter’ is part of
     the *note Stable ABI: 775.'

     オプションの変数で、そのオブジェクトの *note イテレータ: 4c8. を返
     す関数へのポインタです。この値が存在することは、通常この型のインス
     タンスが *note イテレート可能: 12f5. であることを示しています (しか
     し、シーケンスはこの関数がなくてもイテレート可能です)。

     この関数は *note PyObject_GetIter(): 5418. と同じシグネチャを持って
     います:

          PyObject *tp_iter(PyObject *self);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note iternextfunc: 5531. *note PyTypeObject:
          ca0.tp_iternext

     ' The corresponding *note slot ID: 5461. ‘Py_tp_iternext’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、*note イテレーター: 4c8. の次の要素を返す関
     数を指します。シグネチャは次の通りです:

          PyObject *tp_iternext(PyObject *self);

     イテレータの要素がなくなると、この関数は ‘NULL’ を返さなければなり
     ません。 *note StopIteration: df9. 例外は設定してもしなくても良いで
     す。その他のエラーが発生したときも、 ‘NULL’ を返さなければなりませ
     ん。このフィールドがあると、この型のインスタンスがイテレータである
     ことを示します。

     イテレータ型では、 *note tp_iter: 170d. 関数も定義されていなければ
     ならず、その関数は (新たなイテレータインスタンスではなく) イテレー
     タインスタンス自体を返さねばなりません。

     この関数のシグネチャは *note PyIter_Next(): 397. と同じです。

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: struct *note PyMethodDef: 16f5. **note PyTypeObject:
          ca0.tp_methods

     ' The corresponding *note slot ID: 5461. ‘Py_tp_methods’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、この型の正規 (regular) のメソッドを宣言して
     いる *note PyMethodDef: 16f5. 構造体からなる、 ‘NULL’ で終端された
     静的な配列を指します。

     配列の各要素ごとに、メソッドデスクリプタの入った、要素が型の辞書 (下
     記の *note tp_dict: 1aed. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メソッドは別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: struct *note PyMemberDef: 771. **note PyTypeObject:
          ca0.tp_members

     ' The corresponding *note slot ID: 5461. ‘Py_tp_members’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、型の正規 (regular) のデータメンバ (フィール
     ドおよびスロット) を宣言している *note PyMemberDef: 771. 構造体から
     なる、 ‘NULL’ で終端された静的な配列を指します。

     配列の各要素ごとに、メンバデスクリプタの入った要素が型の辞書 (下記
     の *note tp_dict: 1aed. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メンバは別個のメカニズム
     で継承されています)。

 -- C のメンバ変数: struct *note PyGetSetDef: db6. **note PyTypeObject:
          ca0.tp_getset

     ' The corresponding *note slot ID: 5461. ‘Py_tp_getset’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンスの算出属性 (computed attribute)
     を宣言している *note PyGetSetDef: db6. 構造体からなる、 ‘NULL’ で終
     端された静的な配列を指します。

     配列の各要素ごとに、 getter/setter デスクリプタの入った、要素が型の
     辞書 (下記の *note tp_dict: 1aed. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (算出属性は別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: *note PyTypeObject: ca0. **note PyTypeObject:
          ca0.tp_base

     ' The corresponding *note slot ID: 5461. ‘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(): 5251, 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: 52fa. 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: 23d1. should be set in the
          extension module's init function.

     '継承:'

     (当たり前ですが) サブタイプはこのフィールドを継承しません。

     'デフォルト'

     このフィールドのデフォルト値は (Python プログラマは *note object:
     c82. 型として知っている) ‘&PyBaseObject_Type’ になります。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          ca0.tp_dict

     型の辞書は *note PyType_Ready(): 984. によってこのフィールドに収め
     られます。

     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(): 984. 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__(): 243d.).
     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(): 1aec. 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(): 1aec. to get
     the dict for an arbitrary type.

     '継承:'

     サブタイプはこのフィールドを継承しません (が、この辞書内で定義され
     ている属性は異なるメカニズムで継承されます)。

     'デフォルト'

     If this field is ‘NULL’, *note PyType_Ready(): 984. will assign a
     new dictionary to it.

          警告: *note tp_dict: 1aed. に *note PyDict_SetItem(): 523e. を
          使ったり、辞書 C-API で編集するのは安全ではありません。

 -- C のメンバ変数: *note descrgetfunc: 5526. *note PyTypeObject:
          ca0.tp_descr_get

     ' The corresponding *note slot ID: 5461. ‘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: 5527. *note PyTypeObject:
          ca0.tp_descr_set

     ' The corresponding *note slot ID: 5461. ‘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: c59. *note PyTypeObject:
          ca0.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(): 5414. が使います。

     このフィールドを *note tp_dict: 1aed. と混同しないようにしてくださ
     い; これは型オブジェクト自身の属性の辞書です。

     The value specifies the offset of the dictionary from the start of
     the instance structure.

     The *note tp_dictoffset: 566f. should be regarded as write-only.
     To get the pointer to the dictionary call *note
     PyObject_GenericGetDict(): 1d63.  Calling
     ‘PyObject_GenericGetDict()’ 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: 566f.

     '継承:'

     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: 987, 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: 1cce. field, then *note tp_dictoffset: 566f. will be set
     to ‘-1’, to indicate that it is unsafe to use this field.

 -- C のメンバ変数: *note initproc: 552f. *note PyTypeObject:
          ca0.tp_init

     ' The corresponding *note slot ID: 5461. ‘Py_tp_init’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンス初期化関数を指します。

     This function corresponds to the *note __init__(): 8c0. 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__(): 8c0.

     *note tp_init: 7a1. 関数のフィールドが ‘NULL’ でない場合、通常の型
     を呼び出す方法のインスタンス生成において、型の *note tp_new: 79f. 関
     数がインスタンスを返した後に呼び出されます。 ‘tp_new’ が元の型のサ
     ブタイプでない別の型を返す場合、 ‘tp_init’ は全く呼び出されません;
     ‘tp_new’ が元の型のサブタイプのインスタンスを返す場合、サブタイプの
     ‘tp_init’ が呼び出されます。

     成功のときには ‘0’ を、エラー時には例外をセットして ‘-1’ を返します
     。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     For *note static types: 987. this field does not have a default.

 -- C のメンバ変数: *note allocfunc: 5524. *note PyTypeObject:
          ca0.tp_alloc

     ' The corresponding *note slot ID: 5461. ‘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(): c65. if inherited from *note object: c82.

     *note Heap subtypes: b62. do not inherit this slot.

     'デフォルト'

     For heap subtypes, this field is always set to *note
     PyType_GenericAlloc(): c65.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note newfunc: 5533. *note PyTypeObject: ca0.tp_new

     ' The corresponding *note slot ID: 5461. ‘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. ハンドラ内に配置しなければなりません。だ
     いたいの目安としては、変更不能な型では初期化は全て ‘tp_new’ で行い
     、一方、変更可能な型ではほとんどの初期化を ‘tp_init’ に回すべきです
     。

     Set the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. flag to
     disallow creating instances of the type in Python.

     '継承:'

     サブタイプはこのフィールドを継承します。例外として、 *note tp_base:
     23d1. が ‘NULL’ か ‘&PyBaseObject_Type’ になっている *note
     静的な型: 987. では継承しません。

     'デフォルト'

     For *note static types: 987. 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: 57c7. *note PyTypeObject:
          ca0.tp_free

     ' The corresponding *note slot ID: 5461. ‘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:
     5255.

     '継承:'

     Static subtypes inherit this slot, which will be *note
     PyObject_Free(): e64. if inherited from *note object: c82.
     Exception: If the type supports garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 985. flag is set in *note tp_flags: 1cce.) and
     it would inherit ‘PyObject_Free()’, then this slot is not inherited
     but instead defaults to *note PyObject_GC_Del(): 1721.

     *note Heap subtypes: b62. do not inherit this slot.

     'デフォルト'

     For *note heap subtypes: b62, this slot defaults to a deallocator
     suitable to match *note PyType_GenericAlloc(): c65. and the value
     of the *note Py_TPFLAGS_HAVE_GC: 985. flag.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note inquiry: 5530. *note PyTypeObject:
          ca0.tp_is_gc

     ' The corresponding *note slot ID: 5461. ‘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: 1cce. field, and check the *note
     Py_TPFLAGS_HAVE_GC: 985. 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 動的: b62. かを
     区別するためにこの関数を定義しています。)

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     This slot has no default.  If this field is ‘NULL’, *note
     Py_TPFLAGS_HAVE_GC: 985. is used as the functional equivalent.

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          ca0.tp_bases

     ' The corresponding *note slot ID: 5461. ‘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: 984.

     For dynamically created classes, the *note Py_tp_bases: 5508. *note
     slot: 5461. 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: ca0.tp_mro

     基底タイプ群を展開した集合が入っているタプルです。集合は該当する型
     自体からはじまり、 *note object: c82. で終わります。メソッド解決順
     序 (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: 984.

     '継承:'

     このフィールドは継承されません; フィールドの値は *note
     PyType_Ready(): 984. で毎回計算されます。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          ca0.tp_cache

     未使用のフィールドです。内部でのみ利用されます。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: void **note PyTypeObject: ca0.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:
          ca0.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: 5528. *note PyTypeObject:
          ca0.tp_del

     ' The corresponding *note slot ID: 5461. ‘Py_tp_del’ is part of the
     *note Stable ABI: 775.'

     このフィールドは廃止されました。*note tp_finalize: ca1. を代わりに
     利用してください。

 -- C のメンバ変数: unsigned int *note PyTypeObject: ca0.tp_version_tag

     メソッドキャッシュへのインデックスとして使われます。内部使用だけの
     ための関数です。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note destructor: 5528. *note PyTypeObject:
          ca0.tp_finalize

     ' The corresponding *note slot ID: 5461. ‘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__(): 1203. 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: 5267.) 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: 5267.) 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: 5241.) is
          called.  It is recommended to call *note
          PyObject_CallFinalizerFromDealloc(): 5971. at the beginning of
          ‘tp_dealloc’ to guarantee that the object is always finalized
          before destruction.

          注釈: The *note tp_finalize: ca1. function can be called from
          any thread, although the *note GIL: 165. 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__(): 1203. 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: 985. flag is
          set in *note tp_flags: 1cce.) 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: 5972.), 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(): 5975. or
     *note PyObject_CallFinalizerFromDealloc(): 5971.  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: 5972.

        * 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: 985. flag is
          not set.  Such objects can still be manually finalized by
          calling *note PyObject_CallFinalizer(): 5975. or *note
          PyObject_CallFinalizerFromDealloc(): 5971.

        * Python will not automatically finalize any two members of a
          *note cyclic isolate: 5972. concurrently.

        * Python will not automatically finalize an object after it has
          automatically cleared (*note tp_clear: 5267.) the object.

        * If an object is a member of a *note cyclic isolate: 5972,
          Python will not automatically finalize it after automatically
          clearing (see *note tp_clear: 5267.) any other member.

        * Python will automatically finalize every member of a *note
          cyclic isolate: 5972. before it automatically clears (see
          *note tp_clear: 5267.) any of them.

        * If Python is going to automatically clear an object (*note
          tp_clear: 5267.), it will automatically finalize the object
          first.

     Python currently only automatically finalizes objects that are
     members of a *note cyclic isolate: 5972, 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(): 5975. or *note
     PyObject_CallFinalizerFromDealloc(): 5971. instead.

     *note tp_finalize: ca1. 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(): 427. and restore the exception at the
     end by calling *note PyErr_SetRaisedException(): 42a.  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: 425. 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: 596d. for details about how this slot
          relates to other slots.

        * *note PyObject_CallFinalizer(): 5975.

        * *note PyObject_CallFinalizerFromDealloc(): 5971.

 -- C のメンバ変数: *note vectorcallfunc: 779. *note PyTypeObject:
          ca0.tp_vectorcall

     ' The corresponding *note slot ID: 5461. ‘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__(): 8c0, respectively).

     '継承:'

     このフィールドは決して継承されません。

     Added in version 3.9: （このフィールドは3.8から存在していますが、
     3.9以降でしか利用できません）

 -- C のメンバ変数: unsigned char *note PyTypeObject: ca0.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.21.4.9 Static Types
.....................

Traditionally, types defined in C code are 'static', that is, a static
*note PyTypeObject: ca0. structure is defined directly in code and
initialized using *note PyType_Ready(): 984.

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: 164,
     so they should not include any subinterpreter-specific state.

Also, since *note PyTypeObject: ca0. 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.21.4.10 Heap Types
....................

An alternative to *note static types: 987. 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: ab0. flag set.

This is done by filling a *note PyType_Spec: 1aea. 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.21.4.11 数値オブジェクト構造体
................................

 -- C のデータ型: type PyNumberMethods

     この構造体は数値型プロトコルを実装するために使われる関数群へのポイ
     ンタを保持しています。 以下のそれぞれの関数は *note 数値型プロトコル
     (number protocol): 5625. で解説されている似た名前の関数から利用され
     ます。

     以下は構造体の定義です:

          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: 59ca. field should always be
          ‘NULL’.  It was previously called ‘nb_long’, and was renamed
          in Python 3.0.1.

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_add

     ' The corresponding *note slot ID: 5461. ‘Py_nb_add’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_subtract

     ' The corresponding *note slot ID: 5461. ‘Py_nb_subtract’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_multiply

     ' The corresponding *note slot ID: 5461. ‘Py_nb_multiply’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_remainder

     ' The corresponding *note slot ID: 5461. ‘Py_nb_remainder’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_divmod

     ' The corresponding *note slot ID: 5461. ‘Py_nb_divmod’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note ternaryfunc: 553e. *note PyNumberMethods:
          163c.nb_power

     ' The corresponding *note slot ID: 5461. ‘Py_nb_power’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_negative

     ' The corresponding *note slot ID: 5461. ‘Py_nb_negative’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_positive

     ' The corresponding *note slot ID: 5461. ‘Py_nb_positive’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_absolute

     ' The corresponding *note slot ID: 5461. ‘Py_nb_absolute’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note inquiry: 5530. *note PyNumberMethods:
          163c.nb_bool

     ' The corresponding *note slot ID: 5461. ‘Py_nb_bool’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_invert

     ' The corresponding *note slot ID: 5461. ‘Py_nb_invert’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_lshift

     ' The corresponding *note slot ID: 5461. ‘Py_nb_lshift’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_rshift

     ' The corresponding *note slot ID: 5461. ‘Py_nb_rshift’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_and

     ' The corresponding *note slot ID: 5461. ‘Py_nb_and’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_xor

     ' The corresponding *note slot ID: 5461. ‘Py_nb_xor’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_or

     ' The corresponding *note slot ID: 5461. ‘Py_nb_or’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_int

     ' The corresponding *note slot ID: 5461. ‘Py_nb_int’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: void **note PyNumberMethods: 163c.nb_reserved

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_float

     ' The corresponding *note slot ID: 5461. ‘Py_nb_float’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_add

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_add’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_subtract

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_subtract’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_multiply

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_multiply’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_remainder

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_remainder’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note ternaryfunc: 553e. *note PyNumberMethods:
          163c.nb_inplace_power

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_power’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_lshift

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_lshift’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_rshift

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_rshift’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_and

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_and’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_xor

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_xor’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_or

     ' The corresponding *note slot ID: 5461. ‘Py_nb_inplace_or’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_floor_divide

     ' The corresponding *note slot ID: 5461. ‘Py_nb_floor_divide’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_true_divide

     ' The corresponding *note slot ID: 5461. ‘Py_nb_true_divide’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_floor_divide

     ' The corresponding *note slot ID: 5461.
     ‘Py_nb_inplace_floor_divide’ is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_true_divide

     ' The corresponding *note slot ID: 5461.
     ‘Py_nb_inplace_true_divide’ is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyNumberMethods:
          163c.nb_index

     ' The corresponding *note slot ID: 5461. ‘Py_nb_index’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_matrix_multiply

     ' The corresponding *note slot ID: 5461. ‘Py_nb_matrix_multiply’ is
     part of the *note Stable ABI: 775. (バージョン 3.5 より).'

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyNumberMethods:
          163c.nb_inplace_matrix_multiply

     ' The corresponding *note slot ID: 5461.
     ‘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.21.4.12 マップオブジェクト構造体
..................................

 -- C のデータ型: type PyMappingMethods

     この構造体はマップ型プロトコルを実装するために使われる関数群へのポ
     インタを保持しています。 以下の3つのメンバを持っています:

 -- C のメンバ変数: *note lenfunc: 5532. *note PyMappingMethods:
          527a.mp_length

     ' The corresponding *note slot ID: 5461. ‘Py_mp_length’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PyMapping_Size(): 1e93. や *note PyObject_Size():
     541d. から利用され、それらと同じシグネチャを持っています。オブジェ
     クトが定義された長さを持たない場合は、このスロットは ‘NULL’ に設定
     されることがあります。

 -- C のメンバ変数: *note binaryfunc: 5525. *note PyMappingMethods:
          527a.mp_subscript

     ' The corresponding *note slot ID: 5461. ‘Py_mp_subscript’ is part
     of the *note Stable ABI: 775.'

     この関数は *note PyObject_GetItem(): 5ea. および *note
     PySequence_GetSlice(): 5429. から利用され、‘PyObject_GetItem()’ と
     同じシグネチャを持っています。このスロットは *note
     PyMapping_Check(): 53d6. が ‘1’ を返すためには必要で、そうでなけれ
     ば ‘NULL’ の場合があります。

 -- C のメンバ変数: *note objobjargproc: 5534. *note PyMappingMethods:
          527a.mp_ass_subscript

     ' The corresponding *note slot ID: 5461. ‘Py_mp_ass_subscript’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PyObject_SetItem(): 52cd, *note
     PyObject_DelItem(): 5410, *note PySequence_SetSlice(): 5430. and
     *note PySequence_DelSlice(): 5428.  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.21.4.13 シーケンスオブジェクト構造体
......................................

 -- C のデータ型: type PySequenceMethods

     この構造体はシーケンス型プロトコルを実装するために使われる関数群へ
     のポインタを保持しています。

 -- C のメンバ変数: *note lenfunc: 5532. *note PySequenceMethods:
          5279.sq_length

     ' The corresponding *note slot ID: 5461. ‘Py_sq_length’ is part of
     the *note Stable ABI: 775.'

     This function is used by *note PySequence_Size(): 1e8f. and *note
     PyObject_Size(): 541d, and has the same signature.  It is also used
     for handling negative indices via the *note sq_item: 1d53. and the
     *note sq_ass_item: 59d6. slots.

 -- C のメンバ変数: *note binaryfunc: 5525. *note PySequenceMethods:
          5279.sq_concat

     ' The corresponding *note slot ID: 5461. ‘Py_sq_concat’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PySequence_Concat(): 5426. で利用され、同じシグネ
     チャを持っています。また、 ‘+’ 演算子でも、 *note nb_add: 5665. ス
     ロットによる数値加算を試した後に利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 553c. *note PySequenceMethods:
          5279.sq_repeat

     ' The corresponding *note slot ID: 5461. ‘Py_sq_repeat’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PySequence_Repeat(): 542f. で利用され、同じシグネ
     チャを持っています。また、 ‘*’ 演算でも、 *note nb_multiply: 59b3.
     スロットによる数値乗算を試したあとに利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 553c. *note PySequenceMethods:
          5279.sq_item

     ' The corresponding *note slot ID: 5461. ‘Py_sq_item’ is part of
     the *note Stable ABI: 775.'

     This function is used by *note PySequence_GetItem(): 1e90. and has
     the same signature.  It is also used by *note PyObject_GetItem():
     5ea, after trying the subscription via the *note mp_subscript:
     1d54. slot.  This slot must be filled for the *note
     PySequence_Check(): 5425. function to return ‘1’, it can be ‘NULL’
     otherwise.

     Negative indexes are handled as follows: if the *note sq_length:
     566e. slot is filled, it is called and the sequence length is used
     to compute a positive index which is passed to *note sq_item: 1d53.
     If ‘sq_length’ is ‘NULL’, the index is passed as is to the
     function.

 -- C のメンバ変数: *note ssizeobjargproc: 553d. *note
          PySequenceMethods: 5279.sq_ass_item

     ' The corresponding *note slot ID: 5461. ‘Py_sq_ass_item’ is part
     of the *note Stable ABI: 775.'

     This function is used by *note PySequence_SetItem(): 1e91. and has
     the same signature.  It is also used by *note PyObject_SetItem():
     52cd. and *note PyObject_DelItem(): 5410, after trying the item
     assignment and deletion via the *note mp_ass_subscript: 59d3. slot.
     This slot may be left to ‘NULL’ if the object does not support item
     assignment and deletion.

 -- C のメンバ変数: *note objobjproc: 5535. *note PySequenceMethods:
          5279.sq_contains

     ' The corresponding *note slot ID: 5461. ‘Py_sq_contains’ is part
     of the *note Stable ABI: 775.'

     この関数は *note PySequence_Contains(): 3d7. から利用され、同じシグ
     ネチャを持っています。このスロットは ‘NULL’ の場合があり、その時
     ‘PySequence_Contains()’ はシンプルにマッチするオブジェクトを見つけ
     るまでシーケンスを巡回します。

 -- C のメンバ変数: *note binaryfunc: 5525. *note PySequenceMethods:
          5279.sq_inplace_concat

     ' The corresponding *note slot ID: 5461. ‘Py_sq_inplace_concat’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PySequence_InPlaceConcat(): 542a.
     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(): 5426.  It is also used by the augmented
     assignment ‘+=’, after trying numeric in-place addition via the
     *note nb_inplace_add: 59b0. slot.

 -- C のメンバ変数: *note ssizeargfunc: 553c. *note PySequenceMethods:
          5279.sq_inplace_repeat

     ' The corresponding *note slot ID: 5461. ‘Py_sq_inplace_repeat’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PySequence_InPlaceRepeat(): 542b.
     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(): 542f.  It is also used by the augmented
     assignment ‘*=’, after trying numeric in-place multiplication via
     the *note nb_inplace_multiply: 59b4. slot.


File: python.info,  Node: バッファオブジェクト構造体 buffer object structure,  Next: async オブジェクト構造体,  Prev: シーケンスオブジェクト構造体,  Up: Type Object Structures

7.21.4.14 バッファオブジェクト構造体 (buffer object structure)
..............................................................

 -- C のデータ型: type PyBufferProcs

     この構造体は *note buffer プロトコル: 262. が要求する関数群へのポイ
     ンタを保持しています。 そのプロトコルは、エクスポーターオブジェクト
     が如何にして、その内部データをコンシューマオブジェクトに渡すかを定
     義します。

 -- C のメンバ変数: *note getbufferproc: 552b. *note PyBufferProcs:
          5674.bf_getbuffer

     ' The corresponding *note slot ID: 5461. ‘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: 1806, set ‘view->obj’ to ‘NULL’ and return ‘-1’.

       2. 要求されたフィールドを埋めます。

       3. エクスポートした回数を保持する内部カウンタをインクリメントしま
          す。

       4. Set ‘view->obj’ to 'exporter' and increment ‘view->obj’.

       5. ‘0’ を返します。

     'Thread safety:'

     In the *note free-threaded build: 17b0, implementations must
     ensure:

        * The export counter increment in step (3) is atomic.

        * The underlying buffer data remains valid and at a stable
          memory location for the lifetime of all exports.

        * For objects that support resizing or reallocation (such as
          *note bytearray: 342.), the export counter is checked
          atomically before such operations, and *note BufferError:
          1806. is raised if exports exist.

        * The function is safe to call concurrently from multiple
          threads.

     See also *note Thread safety for memoryview objects: 2471. for the
     Python-level thread safety guarantees of *note memoryview: 166.
     objects.

     'exporter' がバッファプロバイダのチェインかツリーの一部であれば、２
     つの主要な方式が使用できます:

        * Re-export: Each member of the tree acts as the exporting
          object and sets ‘view->obj’ to a new reference to itself.

        * Redirect: The buffer request is redirected to the root object
          of the tree.  Here, ‘view->obj’ will be a new reference to the
          root object.

     'view' の個別のフィールドは *note バッファ構造体: 563b. の節で説明
     されており、エクスポートが特定の要求に対しどう対応しなければならな
     いかの規則は、 *note バッファ要求のタイプ: 124d. の節にあります。

     *note Py_buffer: 960. 構造体の中から参照している全てのメモリはエク
     スポータに属し、コンシューマがいなくなるまで有効でなくてはなりませ
     ん。 *note format: 5644. 、 *note shape: 5645. 、 *note strides:
     563f. 、 *note suboffsets: 5647. 、 *note internal: 5649. はコンシ
     ューマからは読み出し専用です。

     *note PyBuffer_FillInfo(): 968. は、全てのリクエストタイプを正しく
     扱う際に、単純なバイトバッファを公開する簡単な方法を提供します。

     *note PyObject_GetBuffer(): 63a. は、この関数をラップするコンシュー
     マ向けのインターフェースです。

 -- C のメンバ変数: *note releasebufferproc: 5536. *note PyBufferProcs:
          5674.bf_releasebuffer

     ' The corresponding *note slot ID: 5461. ‘Py_bf_releasebuffer’ is
     part of the *note Stable ABI: 775. (バージョン 3.11 より).'

     この関数のシグネチャは以下の通りです:

          void (PyObject *exporter, Py_buffer *view);

     バッファのリソースを開放する要求を処理します。もし開放する必要のあ
     るリソースがない場合、 *note PyBufferProcs.bf_releasebuffer: 96b. は
     ‘NULL’ にしても構いません。そうでない場合は、この関数の標準的な実装
     は、以下の任意の処理手順 (optional step) を行います:

       1. エクスポートした回数を保持する内部カウンタをデクリメントします
          。

       2. カウンタが ‘0’ の場合は、'view' に関連付けられた全てのメモリを
          解放します。

     'Thread safety:'

     In the *note free-threaded build: 17b0.:

        * The export counter decrement in step (1) must be atomic.

        * Resource cleanup when the counter reaches zero must be done
          atomically, as the final release may race with concurrent
          releases from other threads and dellocation must only happen
          once.

     エクスポータは、バッファ固有のリソースを監視し続けるために *note
     internal: 5649. フィールドを使わなければなりません。このフィールド
     は、コンシューマが 'view' 引数としてオリジナルのバッファのコピーを
     渡しているであろう間、変わらないことが保証されています。

     This function MUST NOT decrement ‘view->obj’, since that is done
     automatically in *note PyBuffer_Release(): 63b. (this scheme is
     useful for breaking reference cycles).

     *note PyBuffer_Release(): 63b. は、この関数をラップするコンシューマ
     向けのインターフェースです。


File: python.info,  Node: async オブジェクト構造体,  Next: Slot Type typedefs,  Prev: バッファオブジェクト構造体 buffer object structure,  Up: Type Object Structures

7.21.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: 5540. *note PyAsyncMethods:
          566d.am_await

     ' The corresponding *note slot ID: 5461. ‘Py_am_await’ is part of
     the *note Stable ABI: 775. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_await(PyObject *self);

     返されるオブジェクトは *note イテレータ: 4c8. でなければなりません
     。 つまりこのオブジェクトに対して *note PyIter_Check(): 1d0d. が
     ‘1’ を返さなければなりません。

     オブジェクトが *note awaitable: 4c9. でない場合、このスロットを
     ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyAsyncMethods:
          566d.am_aiter

     ' The corresponding *note slot ID: 5461. ‘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__(): 18e6. for details.

     オブジェクトが非同期反復処理のプロトコルを実装していない場合、この
     スロットを ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 5540. *note PyAsyncMethods:
          566d.am_anext

     ' The corresponding *note slot ID: 5461. ‘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__(): 18e6. for details.  This slot may be set to ‘NULL’.

 -- C のメンバ変数: *note sendfunc: 59af. *note PyAsyncMethods:
          566d.am_send

     ' The corresponding *note slot ID: 5461. ‘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(): a9c. 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.21.4.16 Slot Type typedefs
............................

 -- C のデータ型: typedef *note PyObject: 5df. *(*allocfunc)(*note
          PyTypeObject: ca0. *cls, *note Py_ssize_t: c59. 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: aa3. set to ‘1’ and *note
     ob_type: 5252. set to the type argument.  If the type's *note
     tp_itemsize: 241b. is non-zero, the object's *note ob_size: 54a1.
     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: b82.

     この関数では他のいかなるインスタンス初期化も行ってはなりません。追
     加のメモリ割り当てすらも行ってはなりません。そのような処理は *note
     tp_new: 79f. で行われるべきです。

 -- C のデータ型: typedef void (*destructor)(*note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef void (*freefunc)(void*)

     *note tp_free: 5254. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*newfunc)(*note
          PyTypeObject: ca0.*, *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: 5269. を参
     照してください。

 -- 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: 1ac5. を参照してください。

 -- 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: 526d. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*descrgetfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_descr_get: 59a4.
     を参照してください。

 -- C のデータ型: typedef int (*descrsetfunc)(*note PyObject: 5df.*,
          *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_descr_set: 1d0f.
     を参照してください。

 -- C のデータ型: typedef *note Py_hash_t: 147f. (*hashfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_hash: 527b. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*richcmpfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, int)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_richcompare:
     5275. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*getiterfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_iter: 170d. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*iternextfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_iternext: 170e. を
     参照してください。

 -- C のデータ型: typedef *note Py_ssize_t: c59. (*lenfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*getbufferproc)(*note PyObject: 5df.*,
          *note Py_buffer: 960.*, int)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'

 -- C のデータ型: typedef void (*releasebufferproc)(*note PyObject:
          5df.*, *note Py_buffer: 960.*)
     ' 次に属します: *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: 5637. (*sendfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, *note PyObject:
          5df.**)

     *note am_send: 59ae. を参照してください。

 -- 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: c59.)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*ssizeobjargproc)(*note PyObject: 5df.*,
          *note Py_ssize_t: c59, *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.21.4.17 使用例
................

ここでは Python の型定義の簡単な例をいくつか挙げます。これらの例にはあな
たが遭遇する共通的な利用例を含んでいます。いくつかの例ではトリッキーなコ
ーナーケースを実演しています。より多くの例や実践的な情報、チュートリアル
が必要なら、*note 拡張の型の定義; チュートリアル: 524a. や *note
拡張の型の定義; 雑多なトピック: 5263. を参照してください。

A basic *note static type: 987.:

     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: 987. 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: 987. 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.21.5 循環参照ガベージコレクションをサポートする
-------------------------------------------------

Python が循環参照を含むガベージの検出とコレクションをサポートするには、
他のオブジェクトに対する "コンテナ" (他のオブジェクトには他のコンテナも
含みます) となるオブジェクト型によるサポートが必要です。他のオブジェクト
に対する参照を記憶しないオブジェクトや、(数値や文字列のような) アトム型
(atomic type) への参照だけを記憶するような型では、ガベージコレクションに
際して特別これといったサポートを提供する必要はありません。

To create a container type, the *note tp_flags: 1cce. field of the type
object must include the *note Py_TPFLAGS_HAVE_GC: 985. and provide an
implementation of the *note tp_traverse: 986. handler.  If instances of
the type are mutable, a *note tp_clear: 5267. implementation must also
be provided.

*note Py_TPFLAGS_HAVE_GC: 985.

     このフラグをセットした型のオブジェクトは、この節に述べた規則に適合
     しなければなりません。簡単のため、このフラグをセットした型のオブジ
     ェクトをコンテナオブジェクトと呼びます。

コンテナ型のコンストラクタは以下の二つの規則に適合しなければなりません:

  1. The memory for the object must be allocated using *note
     PyObject_GC_New: c9d. or *note PyObject_GC_NewVar: c9e.

  2. 他のコンテナへの参照が入るかもしれないフィールドが全て初期化された
     ら、すぐに *note PyObject_GC_Track(): 1722. を呼び出さなければなり
     ません。

同様に、オブジェクトのメモリ解放関数も以下の二つの規則に適合しなければな
りません:

  1. 他のコンテナを参照しているフィールドを無効化する前に、 *note
     PyObject_GC_UnTrack(): 1723. を呼び出さなければなりません。

  2. オブジェクトのメモリは *note PyObject_GC_Del(): 1721. で解放しなけ
     ればなりません。

          警告: If a type adds the Py_TPFLAGS_HAVE_GC, then it 'must'
          implement at least a *note tp_traverse: 986. handler or
          explicitly use one from its subclass or subclasses.

          When calling *note PyType_Ready(): 984. 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: 1cce, *note
          tp_traverse: 986. and *note tp_clear: 5267. 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: 985. flag.

 -- C のマクロ: PyObject_GC_New (TYPE, typeobj)

     Analogous to *note PyObject_New: b80. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 985. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 5255. slot instead.

     When populating a type's *note tp_alloc: 5255. slot, *note
     PyType_GenericAlloc(): c65. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 1721. (usually called via the object's *note
     tp_free: 5254. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 1721.

        * *note PyObject_New: b80.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_alloc: 5255.

 -- C のマクロ: PyObject_GC_NewVar (TYPE, typeobj, size)

     Analogous to *note PyObject_NewVar: b81. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 985. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 5255. slot instead.

     When populating a type's *note tp_alloc: 5255. slot, *note
     PyType_GenericAlloc(): c65. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 1721. (usually called via the object's *note
     tp_free: 5254. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 1721.

        * *note PyObject_NewVar: b81.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_alloc: 5255.

 -- 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: c9d. but allocates 'extra_size'
     bytes at the end of the object (at offset *note tp_basicsize:
     b82.).  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(): 1721. (usually called via the object's *note
     tp_free: 5254. 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: 4a5b. and *note tp_itemsize:
          241b. instead.

     Added in version 3.12.

 -- C のマクロ: PyObject_GC_Resize (TYPE, op, newsize)

     Resize an object allocated by *note PyObject_NewVar: b81.  Returns
     the resized object of type ‘TYPE*’ (refers to any C type) or ‘NULL’
     on failure.

     'op' must be of type *note PyVarObject: 4a5b.* and must not be
     tracked by the collector yet.  'newsize' must be of type *note
     Py_ssize_t: c59.

 -- C の関数: void PyObject_GC_Track (PyObject *op)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合に追加します。コレクタは何
     回動くのかは予想できないので、追跡されている間はオブジェクトは正し
     い状態でいなければなりません。 *note tp_traverse: 986. の対象となる
     全てのフィールドが正しい状態になってすぐに、たいていはコンストラク
     タの末尾付近で、呼び出すべきです。

 -- 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():
     1529.

     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():
     afd.

     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: c9d. or *note
     PyObject_GC_NewVar: c9e.

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 5254. slot instead.

     Do not use this for memory allocated by *note PyObject_New: b80,
     *note PyObject_NewVar: b81, or related allocation functions; use
     *note PyObject_Free(): e64. instead.

     参考
     ....

        * *note PyObject_Free(): e64. is the non-GC equivalent of this
          function.

        * *note PyObject_GC_New: c9d.

        * *note PyObject_GC_NewVar: c9e.

        * *note PyType_GenericAlloc(): c65.

        * *note tp_free: 5254.

 -- C の関数: void PyObject_GC_UnTrack (void *op)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合から除去します。このオブジ
     ェクトに対して *note PyObject_GC_Track(): 1722. を再度呼び出して、
     追跡されるオブジェクトの集合に戻すことも可能です。 *note
     tp_traverse: 986. ハンドラの対象となるフィールドが正しくない状態に
     なる前に、デアロケータ (*note tp_dealloc: 5241. ハンドラ) はオブジ
     ェクトに対して、この関数を呼び出すべきです。

バージョン 3.8 で変更: The ‘_PyObject_GC_TRACK()’ and
‘_PyObject_GC_UNTRACK()’ macros have been removed from the public C API.

*note tp_traverse: 986. ハンドラはこの型の関数パラメータを受け取ります:

 -- C のデータ型: typedef int (*visitproc)(*note PyObject: 5df. *object,
          void *arg)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_traverse: 986. ハ
     ンドラに渡されるビジター関数 (visitor function) の型です。この関数
     は、探索するオブジェクトを 'object' として、 ‘tp_traverse’ ハンドラ
     の第 3 引数を 'arg' として呼び出します。 Python のコアはいくつかの
     ビジター関数を使って、ゴミとなった循環参照を検出する仕組みを実装し
     ます; ユーザが自身のためにビジター関数を書く必要が出てくることはな
     いでしょう。

*note tp_traverse: 986. ハンドラは次の型を持っていなければなりません:

 -- C のデータ型: typedef int (*traverseproc)(*note PyObject: 5df.
          *self, *note visitproc: 5541. visit, void *arg)
     ' 次に属します: *note Stable ABI: 775.'  Traversal function for a
     container object.  Implementations must call the 'visit' function
     for each object directly contained by 'self', with the parameters
     to 'visit' being the contained object and the 'arg' value passed to
     the handler.  The 'visit' function must not be called with a ‘NULL’
     object argument.  If 'visit' returns a non-zero value that value
     should be returned immediately.

     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.

To simplify writing *note tp_traverse: 986. handlers, a *note
Py_VISIT(): 525e. macro is provided.  In order to use this macro, the
‘tp_traverse’ implementation must name its arguments exactly 'visit' and
'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: 986. 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: 5267. ハンドラは *note inquiry: 5530. 型であるか、オブジ
ェクトが不変 (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.21.5.1 Controlling the Garbage Collector State
................................................

The C-API provides the following functions for controlling garbage
collection runs.

 -- C の関数: *note Py_ssize_t: c59. PyGC_Collect (void)
     ' 次に属します: *note Stable ABI: 775.'  Perform a full garbage
     collection, if the garbage collector is enabled.  (Note that *note
     gc.collect(): 1b5. 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(): 4d91.
     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(): 4d92.
     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(): 4d93.  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.21.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(): 5a01.  '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 reference manual

7.22 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.22.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: 37f. for the version used at 'run time'.

バージョン間の API と ABI の安定性については *note C API Stability: 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(): 37e. 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.22.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(): 37e. 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.22.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 reference manual

7.23 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 reference manual

7.24 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: 32d. 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(): 427.).

 -- 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(): 427.).

 -- 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(): 427.).

 -- 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(): 427.).

 -- 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(): 427.).

 -- 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(): 427.).

 -- 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: df9, it is used.  Otherwise, a new ‘StopIteration’
     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.24.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: 297.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_BRANCH_RIGHT       *note BRANCH_RIGHT: 298.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_CALL               *note CALL: 1a1a.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RAISE            *note C_RAISE: 4cbe.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RETURN           *note C_RETURN: 4cbf.
                                                            
                                                            
      -- C のマクロ:                                        *note EXCEPTION_HANDLED: 4cc0.
               PY_MONITORING_EVENT_EXCEPTION_HANDLED        

      -- C のマクロ: PY_MONITORING_EVENT_INSTRUCTION        *note INSTRUCTION: 4cc1.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_JUMP               *note JUMP: 4cc2.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_LINE               *note LINE: 4cc3.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RESUME          *note PY_RESUME: 4cc4.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RETURN          *note PY_RETURN: 4cc5.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_START           *note PY_START: 4cc6.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_THROW           *note PY_THROW: 18ba.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_UNWIND          *note PY_UNWIND: 4cc7.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_YIELD           *note PY_YIELD: 4cc8.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RAISE              *note RAISE: 19d4.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RERAISE            *note RERAISE: 4cca.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_STOP_ITERATION     *note STOP_ITERATION: 4cc9.
                                                            

 -- 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: 4cce.

     Added in version 3.13.

     *note Soft deprecated: 23f. since version 3.14.


File: python.info,  Node: Python モジュールのインストール,  Next: Python HOWTO,  Prev: Python/C API reference manual,  Up: Top

8 Python モジュールのインストール
*********************************

As a popular open source development project, Python has an active
supporting community of contributors and users that also make their
software available for other Python developers to use under open-source
license terms.

これはほかの人が既に挙げた共通の(あるいは時折極めて稀有な!)問題や、彼ら
自身の解法による潜在的な貢献が共通の場所に蓄えられることによる恩恵によっ
て、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’ is the preferred installer program.  It is included by
     default with the Python binary installers.

   * '仮想環境' は、システム全体にインストールするのではなく、特定のアプ
     リケーションで使用するためにパッケージをインストールできるようにす
     る半独立型のPython環境です。

   * ‘venv’ is the standard tool for creating virtual environments.  It
     defaults to installing ‘pip’ into all created virtual environments.

   * ‘virtualenv’ is a third-party alternative (and predecessor) to
     ‘venv’.

   * The Python Package Index (PyPI)(1) is a public repository of open
     source licensed packages made available for use by other Python
     users.

   * The Python Packaging Authority(2) is the group of developers and
     documentation authors responsible for the maintenance and evolution
     of the standard packaging tools and the associated metadata and
     file format standards.  They maintain a variety of tools,
     documentation, and issue trackers on GitHub(3).

バージョン 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 基本的な使い方
==================

パッケージングのための標準ツールはすべてコマンドラインから使われることを
想定しています。

The following command will install the latest version of a module and
its dependencies from PyPI:

     python -m pip install SomePackage

     注釈: POSIX ユーザ(macOS と Linux ユーザを含みます)向けには、このガ
     イド内の例は、 *note virtual environment: 2149. の利用を前提にして
     います。

     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

More information and resources regarding ‘pip’ and its capabilities can
be found in the Python Packaging User Guide(1).

仮想環境の作成は *note venv: 118. モジュールを通して行われます。 有効な
仮想環境にインストールするには 上記のコマンドを使います。

参考
....

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:

* ... パッケージを現在のユーザ用のみにインストールするには？: パッケージを現在のユーザ用のみにインストールするには？.
* ... 科学技術計算用の Python パッケージをインストールするには？: 科学技術計算用の Python パッケージをインストールするには？.
* ... インストールされた複数のバージョンの Python を並行して使うには？: インストールされた複数のバージョンの Python を並行して使うには？.


File: python.info,  Node: パッケージを現在のユーザ用のみにインストールするには？,  Next: 科学技術計算用の Python パッケージをインストールするには？,  Up: どうすればいいの ？

8.3.1 ... パッケージを現在のユーザ用のみにインストールするには？
----------------------------------------------------------------

‘python -m pip install’ に ‘--user’ オプションを付けてください。パッケー
ジはシステムのすべてのユーザ用にではなく、現在のユーザ用のみにインストー
ルされます。


File: python.info,  Node: 科学技術計算用の Python パッケージをインストールするには？,  Next: インストールされた複数のバージョンの Python を並行して使うには？,  Prev: パッケージを現在のユーザ用のみにインストールするには？,  Up: どうすればいいの ？

8.3.2 ... 科学技術計算用の Python パッケージをインストールするには？
--------------------------------------------------------------------

A number of scientific Python packages have complex binary dependencies,
and aren't currently easy to install using ‘pip’ directly.  It will
often be easier for users to install these packages by other means(1)
rather than attempting to install them with ‘pip’.

参考
....

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.3 ... インストールされた複数のバージョンの Python を並行して使うには？
--------------------------------------------------------------------------

On Linux, macOS, and other POSIX systems, use the versioned Python
commands in combination with the ‘-m’ switch to run the appropriate copy
of ‘pip’:

     python3    -m pip install SomePackage  # default Python 3
     python3.14 -m pip install SomePackage  # specifically Python 3.14

Appropriately versioned ‘pip’ commands may also be available.

On Windows, use the ‘py’ Python launcher in combination with the ‘-m’
switch:

     py -3    -m pip install SomePackage  # default Python 3
     py -3.14 -m pip install SomePackage  # specifically Python 3.14


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 内にインストールする
------------------------------------------------------

On Linux systems, a Python installation will typically be included as
part of the distribution.  Installing into this Python installation
requires root access to the system, and may interfere with the operation
of the system package manager and other components of the system if a
component is unexpectedly upgraded using ‘pip’.

On such systems, it is often better to use a virtual environment or a
per-user installation when installing packages with ‘pip’.


File: python.info,  Node: pip がインストールされていない,  Next: バイナリの拡張のインストール,  Prev: Linux で、システムの Python 内にインストールする,  Up: よくあるインストールに関する問題

8.4.2 pip がインストールされていない
------------------------------------

It is possible that ‘pip’ does not get installed by default.  One
potential fix is:

     python -m ensurepip --default-pip

There are also additional resources for installing 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 once relied heavily on source-based distribution, with end users
being expected to compile extension modules from source as part of the
installation process.

With the introduction of the binary wheel format, and the ability to
publish wheels through PyPI, this problem is diminishing, as users are
more regularly able to install pre-built extensions rather than needing
to build them themselves.

Some of the solutions for installing scientific software(1) that are not
yet available as pre-built wheel files may also help with obtaining
other binary extensions without needing to build them locally.

参考
....

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 クックブック::
* Regular expression HOWTO::
* ソケットプログラミング HOWTO::
* ソートのテクニック::
* Unicode HOWTO::
* urllib パッケージを使ってインターネット上のリソースを取得するには::
* ipaddressモジュールの紹介::
* DTrace と SystemTap で CPython を測定する::
* Python support for the Linux perf profiler::
* アノテーションのベストプラクティス::
* 拡張モジュールを分離する::
* 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::
* Security and threat model::


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: 5a34. 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:

* Event Loop::
* Asynchronous functions and coroutines::
* Task: Task<2>.
* await::


File: python.info,  Node: Event Loop,  Next: Asynchronous functions and coroutines,  Up: A conceptual overview part 1 the high-level

9.1.1.1 Event Loop
..................

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: Event Loop,  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: 3854. 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: 108d. (native coroutine).
Note that coroutines can also exist as instances of *note
collections.abc.Coroutine: fe1. - 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: ddd. and *note generator functions:
1270.  Recall, a generator function is a function that *note yield:
bc6.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(): 9dc.  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: 3886. 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: 18e.  The recommended way to create tasks is via
*note asyncio.create_task(): 1cb.

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(): 2f5, 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: 18e. 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(): 2f5. can help you detect such
occurrences via the ‘debug=True’ flag, which enables *note debug mode:
2195.  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): 1271. 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: 24f8, 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__(): f79. 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: df9. exception with the
return value attached in the *note value: 2477. 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:
     24fc, a different beast entirely.

     2.  What about a *note yield from: 24f8. 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: 3961. 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: 1c9. subclasses *note asyncio.Future: dca. 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(): c68.

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(): 3889. (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: 5212. 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 プログラミング
===================================


Author: A.M. Kuchling, Eric S. Raymond


Release: 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.  The third-party windows-curses(2) package provides the same
interface on Windows.

* Menu:

* Python の curses module::

   ---------- Footnotes ----------

   (1) https://pypi.org/project/Urwid/

   (2) https://pypi.org/project/windows-curses/


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(): 3516. 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(): 196f. 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(): 353f.
function.

     curses.noecho()

通常アプリケーションはまた、Enter キーを押すことなく、キーに対してすぐに
反応する必要があります; これは cbreak モードと呼ばれ、通常の入力がバッフ
ァされるモードと逆に動作します。

     curses.cbreak()

端末は通常、カーソルキーや Page Up や Home といった操作キーなどの特別な
キーをマルチバイトエスケープシーケンスとして返します。それらのシーケンス
を想定して対応する処理を行うアプリケーションを書けるように、 curses はそ
れを *note curses.KEY_LEFT: 35b2. のような特別な値を返して行ってくれます
。 curses にその仕事をさせるには、キーパッドモードを有効にする必要があり
ます。

     stdscr.keypad(True)

curses アプリケーションを終了させるのは起動よりも簡単です。 以下を呼び出
す必要があります:

     curses.nocbreak()
     stdscr.keypad(False)
     curses.echo()

cursesに親和性の高い設定をもとに戻します。そして、*note endwin(): 3519.
関数を呼び出し、端末を通常の操作モードに復旧します。

     curses.endwin()

curses アプリケーションをデバッグするときの一般的な問題は、アプリケーシ
ョンが端末を以前の状態に復旧することなく異常終了したときに端末がめちゃめ
ちゃになることです。Python ではこの問題はコードにバグがあって、捕捉でき
ない例外が発生したときによく起きます。タイプしたキーはもはやエコーされま
せん、例えば、シェルを使うのが難しくなります。

Pythonでは、これらの複雑さを避けデバッグをより容易にするために、 *note
curses.wrapper(): c77. 関数をインポートして、このように使います:

     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(): c77. 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: 8f9...*note
except: 1ac. 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(): 196f. 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(): 353c. 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: ff0. and *note curses.COLS: ff1. 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(): 353b. 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(): 3517. メソッドを呼び出
     して、配下にある、スクリーンの望ましい状態を表すデータ構造を更新し
     ます。

  2. *note doupdate(): 3515. 関数を呼び出して、データ構造に記録された望
     ましい状態に合致するように、物理スクリーンを更新します。

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(): 3516. のようなメソッドは複数の引数形式を許容してくれます。通常
それらは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(): 3516. 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: 12ac. attribute; this defaults to the default
system encoding as returned by *note locale.getencoding(): 866.

The *note addch(): 1774. 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: 361f. is a
+/- symbol, and *note ACS_ULCORNER: 355e. 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(): 350f.  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: 35a0.       テキストを点滅
                           
                           
*note A_BOLD: 35a1.        高輝度またはボールドテキスト
                           
                           
*note A_DIM: 35a2.         低輝度テキスト
                           
                           
*note A_REVERSE: 350d.     反転テキスト
                           
                           
*note A_STANDOUT: 350c.    利用できる最良のハイライトモード
                           
                           
*note A_UNDERLINE: 35a6.   下線付きテキスト
                           

つまり、反転するステータスラインを画面の最上部に表示するには、コードをこ
うします:

     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(): 3548. function soon
after calling *note initscr(): 196f, to initialize the default color set
(the *note curses.wrapper(): c77. function does this automatically).
Once that's done, the *note has_colors(): 352b. 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(): 350b. function; this can be bitwise-OR'ed with other
attributes such as *note A_REVERSE: 350d, 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(): 3548. 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: 3631, *note curses.COLOR_RED: 3636, 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(): 3508, 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(): 188b. refreshes the screen and then waits for the
     user to hit a key, displaying the key if *note echo(): 3518. has
     been called earlier.  You can optionally specify a coordinate to
     which the cursor should be moved before pausing.

   * *note getkey(): 3573. 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(): 3588.
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(): 352f. 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:
35c3, *note curses.KEY_HOME: 35b4, or *note curses.KEY_LEFT: 35b2.  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(): 3678. returns the control character
corresponding to its argument.

There's also a method to retrieve an entire string, *note getstr():
18a3.  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:
1773. 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_*: 360b. 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 デスクリプタ ガイド
=======================


Author: Raymond Hettinger


Contact: <python at rcn dot com>

*note デスクリプタ: 18e5. を使うと、オブジェクトの属性検索、保存、削除を
カスタマイズできます。

本ガイドは4つの大項目から構成されています。

  1. 最初の「入門」では基本の紹介をして、シンプルな例から少しずつ概念を
     説明していきます。もしデスクリプタに触れるのが初めての場合はここか
     ら学んでいきましょう。

  2. 2つ目のセクションでは完全で実践的なデスクリプタのサンプルを紹介しま
     す。もしデスクリプタの基本を理解しているのであれば、ここから読み始
     めても良いでしょう。

  3. 3番目のセクションはより技巧的なチュートリアルを通じて、デスクリプタ
     がどのようなメカニズムで動作しているのかを紹介します。多くの人はこ
     のレベルの理解は不要でしょう。

  4. 最後のセクションは、Cで書かれた組み込みのデスクリプタをピュア
     Pythonで実現する方法を紹介します。このセクションがどのように関数が
     束縛メソッドになるのか、 *note classmethod(): 48e. や *note
     staticmethod(): 451, *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__(): 1706. 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__(): 1706.  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 ‘__get__()’ 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__(): 1706. and *note
__set__(): 2415. 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__(): e4c. 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__(): e4c. so that the field names would be recorded.  Here we
call *note vars(): 1e7f. 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: 18e5. is what we call any object that defines *note
__get__(): 1706, *note __set__(): 2415, or *note __delete__(): 19af.

Optionally, descriptors can have a *note __set_name__(): e4c. 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(): 451, *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: 13d2. 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: 19c. or
     *note float: 197.  Optionally, it verifies that a value is between
     a given minimum or maximum.

  3. ‘String’ verifies that a value is a *note str: 16a.  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__():
1706, *note __set__(): 2415, and *note __delete__(): 19af.  If any of
those methods are defined for an attribute, it is said to be a *note
descriptor: 18e5.

属性アクセスのデフォルトの振る舞いは、オブジェクトの辞書の属性の取得、設
定、削除です。例えば ‘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(): 1a7.  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__(): 2415. or *note __delete__(): 19af,
it is considered a data descriptor.  Descriptors that only define *note
__get__(): 1706. 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__(): 1706.
and *note __set__(): 2415. with the ‘__set__()’ raising an *note
AttributeError: 5f0. when called.  Defining the ‘__set__()’ 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__(): 1706. 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__():
dcf. の中で行われます。ピュア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__(): dcf. code.  That is why calling ‘__getattribute__()’
directly or with ‘super().__getattribute__’ will bypass ‘__getattr__()’
entirely.

Instead, it is the dot operator and the *note getattr(): dce. function
that are responsible for invoking *note __getattr__(): 6fa. whenever
*note __getattribute__(): dcf. 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:
263e.

‘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__():
dcf. method for object returned by *note super(): 1a7.

‘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__(): dcf. methods for *note object: c82, *note type: f48,
and *note super(): 1a7.

憶えておくべき重要な点は:

   * Descriptors are invoked by the *note __getattribute__(): dcf.
     method.

   * クラスはこの機構を *note object: c82. 、 *note type: f48. 、 *note
     super(): 1a7. から継承する

   * Overriding *note __getattribute__(): dcf. prevents automatic
     descriptor calls because all the descriptor logic is in that
     method.

   * ‘object.__getattribute__()’ and ‘type.__getattribute__()’ make
     different calls to *note __get__(): 1706.  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:
f48. metaclass scans the dictionary of the new class.  If any of the
entries are descriptors and if they define *note __set_name__(): e4c,
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__(): e4c. 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: 1be2. を使え
ば手動で作れます。

     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__(): 1706. 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:
1d82. も持っています。

     >>> D.f.__qualname__
     'D.f'

Accessing the function through the class dictionary does not invoke
*note __get__(): 1706.  Instead, it just returns the underlying function
object:

     >>> D.__dict__['f']
     <function D.f at 0x00C45070>

Dotted access from a class calls *note __get__(): 1706. 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__(): 1706. 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__(): 1706. 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(): 451. は以下のようになります:

     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(): 1227. 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__: 14f0, *note __qualname__:
23a5, and *note __doc__: 13f5.


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(): 250. は新しい辞書をキーのリストから生成します。等価な
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(): 1227. の呼び出しは
、根底にある関数を参照する ‘__wrapped__’ 属性を追加します。また、ラッパ
ーがそのラップされた関数のように見えるよう、必要な属性を追加します:
*note __name__: 14f0. 、 *note __qualname__: 23a5. 、 *note __doc__:
13f5. 、 *note __annotations__: 13f4. 。


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/descrobject.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: 2430. 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: 39c.*) 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: 39c.*:

     (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: 99b.*:

     (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(): 1c3. がより便利だったり、グルー
ピングの機能、型安全などいくつかの機能があります。

これらは、限られた選択肢の値の一つを取る変数がある場合に便利です。例えば
、曜日情報があります:

     >>> 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. の作成は ‘Enum’ 自体を継承するクラスを作成
するのと同じくらい簡単です。

     注釈: 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: 1fc. has two methods for returning the weekday: *note
weekday(): 2937. and *note isoweekday(): 2938.  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 ‘date’ 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())

さて、これで今日が何曜日か調べることができます！ 見てみましょう:

     >>> import datetime as dt
     >>> Weekday.from_date(dt.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: 24f. - 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(): e9f. を使用すること
で手間を省くことができます:

     >>> 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(): 2aa3. デコレータを使用で
きます:

     >>> 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: e9f. が使えます:

     >>> 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_(): 2ab7, 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_(): 2ab7. 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: 5a89. を参照してください):

     >>> 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

Comparisons against non-enumeration values will always compare not equal
(again, *note IntEnum: edf. was explicitly designed to behave
differently, see below):

     >>> Color.BLUE == 2
     False

     警告: モジュールは再読み込みすることが可能です。再読み込みされたモ
     ジュールに列挙型が含まれている場合、それらは再作成され、新しいメン
     バーは元のメンバーと同一でない/等しくない可能性があります。


File: python.info,  Node: 列挙型で許されるメンバーと属性,  Next: Enumのサブクラス化の制限,  Prev: 比較<3>,  Up: 列挙型 HOWTO

9.6.7 列挙型で許されるメンバーと属性
------------------------------------

これまでのほとんどの例では、列挙型の値に整数を使用しています。 整数を使
うのは短くて便利（そして、 *note 関数 API: 5a8b. ではデフォルトで設定さ
れる）ですが、これは強制されているわけではありません。大半の使用例では、
列挙値の実際の値が何であるかは意識しません。しかし、値が重要な場合、列挙
型は任意の値を持つことができます。

列挙型は 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__(): 243d, etc.), descriptors (methods are
also descriptors), and variable names listed in *note _ignore_: 2ab5.

Note: if your enumeration defines *note __new__(): 7a0. and/or *note
__init__(): 8c0, any value(s) given to the enum member will be passed
into those methods.  See *note Planet: 5a8c. 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
     ‘__new__()’ which is used after class creation for lookup of
     existing members.  See *note When to use __new__() vs.  __init__():
     5a8d. for more details.


File: python.info,  Node: Enumのサブクラス化の制限,  Next: データクラスのサポート,  Prev: 列挙型で許されるメンバーと属性,  Up: 列挙型 HOWTO

9.6.8 Enumのサブクラス化の制限
------------------------------

新しい *note Enum: 842. クラスは、ベースの enum クラスを1つ、具象データ
型を1つ、複数の *note object: c82. ベースのミックスインクラスが許容され
ます。これらのベースクラスの順序は次の通りです:

     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: 5a8f. の例を参照してください。)


File: python.info,  Node: データクラスのサポート,  Next: Pickle 化,  Prev: Enumのサブクラス化の制限,  Up: 列挙型 HOWTO

9.6.9 データクラスのサポート
----------------------------

*note dataclass: 4e1. を継承する場合、 *note __repr__(): 1b58. は継承す
るクラス名を省略します。 例えば:

     >>> 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(): 1c3. を使うには、*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__(): 19cb. 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__: 23cf. 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:
19c. のサブクラスでもあります。 *note IntEnum: edf. のメンバーは整数と比
較できます; さらに言うと、異なる整数列挙型どうしでも比較できます:

     >>> 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: edf. の値は他の用途では整数のように振る舞います:

     >>> 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: 16a.
のサブクラスでもあります。*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: e9e. も、*note int: 19c. を
基底クラスとしています。 違いは、 ‘IntFlag’ のメンバーをビット演算子
(&amp;, |, ^, ~) を使って組み合わせられ、その結果も ‘IntFlag’ メンバーに
なることです。 *note IntEnum: edf. と同様、‘IntFlag’ のメンバーも整数で
あり、‘int’ が使用されるところであればどこでも使えます。

     注釈: *note IntFlag: e9e. メンバーに対してビット演算以外のどんな演
     算をしても、その結果は ‘IntFlag’ メンバーではなくなります。

     ビット単位演算の結果が *note IntFlag: e9e. として不正な値な値の場合
     、値は ‘IntFlag’ メンバーではなくなります。 詳しくは *note
     FlagBoundary: 836. を参照してください。

Added in version 3.6.

バージョン 3.11 で変更.

*note IntFlag: e9e. クラスの例:

     >>> 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: e9e. と *note Enum: 842. のもう 1 つの重要な違いは、フラ
グが設定されていない (値が0である) 場合、その真偽値としての評価は *note
False: d2f. になることです:

     >>> Perm.R & Perm.X
     <Perm: 0>
     >>> bool(Perm.R & Perm.X)
     False

*note IntFlag: e9e. メンバーも *note int: 19c. のサブクラスであるため、
それらと組み合わせることができます（ただし、 ‘IntFlag’ 型ではなくなる可
能性があります）:

     >>> Perm.X | 4
     <Perm.R|X: 5>

     >>> Perm.X + 8
     9

     注釈: 否定の演算子 ‘~’ は、常に正の値を持つ *note IntFlag: e9e. メ
     ンバー を返す:

          >>> (~Perm.X).value == (Perm.R|Perm.W).value == 6
          True

*note IntFlag: e9e. メンバーは反復処理することもできます:

     >>> 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: e9e. と同様に、
‘Flag’ メンバーもビット演算子 (&, |, ^, ~) を使って組み合わせられます。
しかし ‘IntFlag’ とは違い、他のどの ‘Flag’ 列挙型とも *note int: 19c. と
も組み合わせたり、比較したりできません。 値を直接指定することも可能です
が、値として *note auto: e9f. を使い、 ‘Flag’ に適切な値を選ばせることが
推奨されています。

Added in version 3.6.

*note IntFlag: e9e. と同様に、 *note Flag: 835. メンバーの組み合わせがど
のフラグも設定されていない状態になった場合、その真偽値としての評価は
*note False: d2f. となります:

     >>> 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: edf. と *note
     IntFlag: e9e. は (整数と比較でき、従って推移的に他の無関係な列挙型
     と比較できてしまうことにより) 列挙型の意味論的な約束に反するからで
     す。 ‘IntEnum’ と ‘IntFlag’ は、 ‘Enum’ や ‘Flag’ では上手くいかな
     い場合のみに使うべきです; 例えば、整数定数を列挙型で置き換えるとき
     や、他のシステムとの相互運用性を持たせたいときです。


File: python.info,  Node: その他<6>,  Prev: Flag,  Up: 派生列挙型

9.6.12.5 その他
...............

*note IntEnum: edf. は *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: 197. instead of *note
int: 19c.

いくつかのルール:

  1. *note Enum: 842. のサブクラスを作成するとき、複合させるデータ型は、
     基底クラスの並びで ‘Enum’ クラス自身より先に記述しなければなりませ
     ん (上記 *note IntEnum: edf. の例を参照)。

  2. 複合させる型はサブクラス化可能でなければいけません。例えば、 *note
     bool: 3c1. と *note range: b41. はサブクラス化できないため、複合さ
     せるとEnum作成時にエラーが発生します。

  3. *note Enum: 842. のメンバーはどんなデータ型でも構いませんが、追加の
     データ型 (例えば、上の例の *note int: 19c.) と複合させてしまうと、
     すべてのメンバーの値はそのデータ型でなければならなくなります。この
     制限は、メソッドの追加するだけの、他のデータ型を指定しない複合には
     適用されません。

  4. When another data type is mixed in, the *note value: 2ab0.
     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: 19b, *note str.format(): 833, and
     *note format(): 19a. will use the enum's *note __str__(): 830.
     method.

     注釈: Because *note IntEnum: edf, *note IntFlag: e9e, 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' ‘__str__()’ method.


File: python.info,  Node: When to use __new__ vs __init__,  Next: 細かい点,  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 ‘__new__()’ or *note __init__(): 8c0, with ‘__init__()’
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.


File: python.info,  Node: 細かい点,  Next: EnumとFlagはどう違うのか？,  Prev: When to use __new__ vs __init__,  Up: 列挙型 HOWTO

9.6.14 細かい点
---------------

* Menu:

* Supported __dunder__ and _sunder_ names::
* _Private__names::
* Enum メンバー型::
* Creating members that are mixed with other data types::
* Enum クラスとメンバーの真偽値::
* メソッド付きの Enum クラス::
* Flag のメンバーの組み合わせ::
* Flag and IntFlag minutia::


File: python.info,  Node: Supported __dunder__ and _sunder_ names,  Next: _Private__names,  Up: 細かい点

9.6.14.1 Supported ‘__dunder__’ and ‘_sunder_’ names
....................................................

The supported ‘__dunder__’ and ‘_sunder_’ names can be found in the
*note Enum API documentation: 2acf.


File: python.info,  Node: _Private__names,  Next: Enum メンバー型,  Prev: Supported __dunder__ and _sunder_ names,  Up: 細かい点

9.6.14.2 _Private__names
........................

*note Private names: 20ff. は列挙型メンバーには変換されず、通常の属性と
なります。

バージョン 3.11 で変更.


File: python.info,  Node: Enum メンバー型,  Next: Creating members that are mixed with other data types,  Prev: _Private__names,  Up: 細かい点

9.6.14.3 ‘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.14.4 Creating members that are mixed with other data types
..............................................................

When subclassing other data types, such as *note int: 19c. or *note str:
16a, 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.14.5 ‘Enum’ クラスとメンバーの真偽値
........................................

(*note int: 19c, *note str: 16a. などのような) 非 *note Enum: 842. 型と
複合させた enum クラスは、その複合された型の規則に従って評価されます; そ
うでない場合は、全てのメンバーは *note True: e0b. と評価されます。 メン
バーの値に依存する独自の enum の真偽値評価を行うには、クラスに次のコード
を追加してください:

     def __bool__(self):
         return bool(self.value)

プレーンな *note Enum: 842. クラスは *note True: e0b. として評価されます
。


File: python.info,  Node: メソッド付きの Enum クラス,  Next: Flag のメンバーの組み合わせ,  Prev: Enum クラスとメンバーの真偽値,  Up: 細かい点

9.6.14.6 メソッド付きの ‘Enum’ クラス
.....................................

enum サブクラスに追加のメソッドを与えた場合、後述の *note Planet: 5a8c.
クラスのように、そのメソッドはメンバーの *note dir(): 844. に表示されま
すが、クラスの ‘dir()’ には表示されません:

     >>> 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.14.7 ‘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.14.8 ‘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: 細かい点,  Up: 列挙型 HOWTO

9.6.15 EnumとFlagはどう違うのか？
---------------------------------

Enum は *note Enum: 842. 派生クラスやそれらのインスタンス (メンバー) 双
方の多くの側面に影響を及ぼすカスタムメタクラスを持っています。

* Menu:

* Enum クラス::
* Flag クラス::
* Enum メンバー (インスタンス): Enum メンバー インスタンス.
* Flag メンバー::


File: python.info,  Node: Enum クラス,  Next: Flag クラス,  Up: EnumとFlagはどう違うのか？

9.6.15.1 Enum クラス
....................

The *note EnumType: 4f7. metaclass is responsible for providing the
*note __contains__(): 15d7, *note __dir__(): 17d8, *note __iter__():
e6d. 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’.  ‘EnumType’ is responsible for ensuring that
various other methods on the final ‘Enum’ class are correct (such as
*note __new__(): 7a0, *note __getnewargs__(): fd8, *note __str__(): 830.
and *note __repr__(): 82f.).


File: python.info,  Node: Flag クラス,  Next: Enum メンバー インスタンス,  Prev: Enum クラス,  Up: EnumとFlagはどう違うのか？

9.6.15.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.15.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.15.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.16 Enum クックブック
------------------------

*note Enum: 842, *note IntEnum: edf, *note StrEnum: 82d, *note Flag:
835, *note IntFlag: e9e. は用途の大部分をカバーすると予想されますが、そ
のすべてをカバーできているわけではありません。ここでは、そのまま、あるい
は独自の列挙型を作る例として使える、様々なタイプの列挙型を紹介します。

* Menu:

* 値の省略::
* OrderedEnum::
* DuplicateFreeEnum::
* MultiValueEnum::
* Planet::
* TimePeriod::


File: python.info,  Node: 値の省略,  Next: OrderedEnum,  Up: Enum クックブック

9.6.16.1 値の省略
.................

多くの用途では、列挙型の実際の値が何かは気にされません。 このタイプの単
純な列挙型を定義する方法はいくつかあります:

   - 値に *note auto: e9f. インスタンスを使用する

   - 値として *note object: c82. インスタンスを使用する

   - 値として解説文字列を使用する

   - use a tuple as the value and a custom *note __new__(): 7a0. to
     replace the tuple with an *note int: 19c. value

これらのどの方法を使ってもユーザーに対して、値は重要ではなく、他のメンバ
ーの番号の振り直しをする必要無しに、メンバーの追加、削除、並べ替えが行え
るということを示せます。

* Menu:

* auto を使う::
* object を使う::
* 解説文字列を使う::
* Using a custom __new__(): Using a custom __new__.


File: python.info,  Node: auto を使う,  Next: object を使う,  Up: 値の省略

9.6.16.2 ‘auto’ を使う
......................

*note auto: e9f. を使うと次のようになります:

     >>> 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.16.3 ‘object’ を使う
........................

*note object: c82. を使うと次のようになります:

     >>> 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.16.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.16.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
     ‘__new__()’ 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.16.6 OrderedEnum
....................

*note IntEnum: edf. をベースとしないため、通常の *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.16.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(): 2aa3. デコレーターを使用して行えます。


File: python.info,  Node: MultiValueEnum,  Next: Planet,  Prev: DuplicateFreeEnum,  Up: Enum クックブック

9.6.16.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.16.9 Planet
...............

If *note __new__(): 7a0. or *note __init__(): 8c0. 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.16.10 TimePeriod
....................

An example to show the *note _ignore_: 2ab5. attribute in use:

     >>> import datetime as dt
     >>> class Period(dt.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.17 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
==============================


Author: A. M. Kuchling


Release: 0.32

この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python
の機能を見てまわることにしましょう。まず関数型プログラミングという概念を
紹介したあと、 *note iterator: 4c8. や *note generator: 1270. のような言
語機能、および *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): 5ab5. まで
飛ばしてください。

プログラミング言語とは問題を分解するものですが、各言語がサポートする分解
方法にはいくつかの種類があります:

   * ほとんどのプログラミング言語は '手続き型' です: プログラムは、入力
     に対して行うべきことをコンピュータに教える指示リストとなります。 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(): 117b.
や *note time.sleep(): 8ad. 関数の呼び出しもありますが、どちらも有用な値
を返しません。画面にテキストを送ったり、実行を 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__(): 14e9. という、引数を取らず次の要素を返すメソッドを必ずサポー
トしています。データストリームに要素が残っていない場合、 ‘__next__()’ は
必ず *note StopIteration: df9. 例外を出します。ただし、イテレータの長さ
は有限である必要はありません; 無限のストリームを生成するイテレータを書く
というのもまったく理に適ったことです。

ビルトインの *note iter(): 9db. 関数は任意のオブジェクトを受けて、 その
中身や要素を返すイテレータを返そうとします。引数のオブジェクトが イテレ
ータを作れないときは *note TypeError: 199. を投げます。Python の ビルト
インなデータ型にもいくつかイテレータ化のできるものがあり、 中でもよく使
われるのはリストと辞書です。イテレータを作れる オブジェクトは *note
iterable: 12f5. オブジェクトと呼ばれます。

手を動かしてイテレータ化の実験をしてみましょう:

     >>> 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: 348. 文です。 ‘for X in Y’ という文の Y は、 イテレータ
か、あるいは *note iter(): 9db. でイテレータを作れるオブジェクトである必
要があります。次の二つは同じ意味になります:

     for i in iter(obj):
         print(i)

     for i in obj:
         print(i)

イテレータは *note list(): 24f. や *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(): 1110. や *note min(): 110f. なども、イテレ
ータ一つだけを引数に取って最大・最小の要素を返すことができます。 ‘"in"’
や ‘"not in"’ 演算子もイテレータに対応しています: ‘X in iterator’ は、そ
のイテレータから返るストリームに X があれば真です。ですからイテレータが
無限長だと、当然ながら問題に直面します; ‘max()’, ‘min()’ はいつまでも戻
って来ませんし、 要素 X がストリームに出てこなければ ‘"in"’, ‘"not in"’
オペレータも戻りません。

イテレータは次に進むことしかできませんのでご注意ください; 前の要素を手に
入れたり、イテレータをリセットしたり、コピーを作ったりする方法はありませ
ん。イテレータがオブジェクトとしてそうした追加機能を 持つことはできます
が、プロトコルでは *note __next__(): 14e9. メソッドのことしか指定されて
いません。ですから関数はイテレータの出力を使い尽くして しまうかもしれま
せんし、同じストリームに何か別のことをする 必要があるなら新しいイテレー
タを作らなくてはいけません。

* Menu:

* イテレータ対応のデータ型::


File: python.info,  Node: イテレータ対応のデータ型,  Up: イテレータ iterator<2>

9.7.2.1 イテレータ対応のデータ型
................................

リストやタプルがイテレータに対応している方法については既に見ましたが、実
のところ Python のシーケンス型はどれでも、たとえば文字列なども、自動でイ
テレータ生成に対応しています。

辞書に対して *note iter(): 9db. すると、辞書のキーでループを回すイテレー
タが返されます:

     >>> 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(): 9db. を適用するとキーでループを回しますが、辞書には
他のイテレータを返すメソッドもあります。明示的に値、あるいはキーと値のペ
アでイテレートしたければ、*note values(): 9d5, *note items(): 9d6. とい
うメソッドでイテレータを作ることができます。

逆に *note dict(): 184. コンストラクタは、有限な ‘(key, value)’ タプルの
ストリームを返すイテレータを受け入れることができます:

     >>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')]
     >>> dict(iter(L))
     {'Italy': 'Rome', 'France': 'Paris', 'US': 'Washington DC'}

ファイルも、最後の行まで *note readline(): 177c. メソッドを呼んでいくこ
とでイテレータ化に対応しています。つまりこうやってファイルの各行を読んで
いくことができるわけです:

     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: bc6. キーワードを含む関数はすべてジェネレータ関数です;
Python の *note bytecode: 4aa. コンパイラがこれを検出して、特別な方法で
コンパイルしてくれるのです。

ジェネレータ関数は、呼ばれたときに一回だけ値を返すのではなく、イテレータ
プロトコルに対応したオブジェクトを返します。上の例で ‘yield’ を実行した
とき、 ジェネレータは ‘return’ 文のようにして ‘i’ の値を出力します。
‘yield’ と ‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレ
ータの実行状態が一時停止になって、ローカル変数が保存される点です。 次回
そのジェネレータの *note __next__(): 2109. を呼ぶと、そこから関数が実行
を再開します。

上記 ‘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__(): 2109. メソ
ッドから送出された ‘StopIteration(value)’ を引き起こします。これが発生し
た場合や、関数の終わりに到達した場合は、値の生成が終了してジェネレーター
がそれ以上の値を返さない。

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note __next__():
14e9. メソッドが ‘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: bc6. が、変数に代入したり演算したりできる値を返す式になったのです
:

     val = (yield i)

上のように、返り値で何かをするときは ‘yield’ 式の前後に '必ず' 括弧を付
けるようお勧めします。括弧は常に必要なわけではありませんが、どんなとき付
けなくて良いのかを覚えておくより、いつも付けておくほうが楽ですから。

( PEP 342(1) がその規則を正確に説明していますが、それによると ‘yield’-式
は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を付ける必要があ
ります。つまり ‘val = yield i’ とは書けますが、 ‘val = (yield i) + 12’ の
ように演算子があるときは括弧を使わなくてはいけません。)

ジェネレータに値を送るには *note send(value): 1271. メソッドを呼びます。
するとジェネレータのコードが実行を再開し、 ‘yield’ 式がその値を返すので
す。ふつうの *note __next__(): 2109. メソッドを呼ぶと、 ‘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(): 1271. しかないのだと確定してるのでない限り、式の値
をそのまま使ってはいけません。

ジェネレータには、 *note send(): 1271. のほかにもメソッドが二つあります:

   * *note throw(value): 71c. はジェネレータ内で例外を投げるために使いま
     す; その例外はジェネレータの実行が停止したところの ‘yield’ 式によっ
     て投げられます。

   * *note close(): 1802. sends a *note GeneratorExit: 15e5. exception
     to the generator to terminate the iteration.  On receiving this
     exception, the generator's code must either raise ‘GeneratorExit’
     or *note StopIteration: df9.; catching the exception and doing
     anything else is illegal and will trigger a *note RuntimeError:
     246.  ‘close()’ will also be called by Python's garbage collector
     when the generator is garbage-collected.

     *note GeneratorExit: 15e5. が起こったときにクリーンアップ作業をする
     必要があるなら、 ‘GeneratorExit’ を捕捉するのではなく ‘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(): 1a0. と *note filter(): a68. は、機
能がジェネレータ式と重複しています:

*note map(f, iterA, iterB, ...): 1a0. は以下のシーケンスのイテレータを返します

     ‘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): a68. はある条件を満たす要素に渡るイテレー
タを返すので、同様にリスト内包表記で再現できます。 'predicate' は、ある
条件に対する真偽値を返す関数です; ‘filter()’ で使うには、その関数の引数
は一つでなければなりません。

     >>> 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): 169f. はイテラブルの要素に順番に番号を振
っていき、('start' から数え始めたときの) 番号とそれぞれの要素を含む 2 タ
プルを返します。

     >>> for item in enumerate(['subject', 'verb', 'object']):
     ...     print(item)
     (0, 'subject')
     (1, 'verb')
     (2, 'object')

*note enumerate(): 169f. はよく、リストに対してループさせて、条件に合う
所に印を付けていくときに使われます:

     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): dcb. はイテラブルの要素
をすべて集めたリストを作り、ソートして返します。 引数 'key' および
'reverse' は、リストの *note sort(): dcc. メソッドにそのまま渡されます。

     >>> 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 ソートのテクニック: 13f7. を参照)

組み込みの *note any(iter): 163f. および *note all(iter): 1640. は
iterable の値の真偽を調べます。 ‘any()’ は要素のどれかが真値なら ‘True’
を返し、 ‘all()’ は要素が全て真値なら ‘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, ...): 1a1. はそれぞれの iterable から1つの要素を
取り、それらをタプルに入れて返します:

     zip(['a', 'b', 'c'], (1, 2, 3)) =>
       ('a', 1), ('b', 2), ('c', 3)

*note zip(): 1a1. は結果を返す前に入力のイテレーターを全て消費してメモリ
上に 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): 149f. は値の間隔が一定の無限ストリー
ムを返します。 オプションで開始する数 (デフォルトは 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): 2c20. は与えられたイテラブルの内容をコピー
して、 その要素を最初から最後まで無限に繰り返していくイテレータを返しま
す。

     itertools.cycle([1, 2, 3, 4, 5]) =>
       1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ...

*note itertools.repeat(elem, [n]): 18be. は、与えられた要素を '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, ...): 263d. は任意の数のイテラブルを
受け取って、最初のイテレータから要素をすべて返し、次に二番目から 要素を
すべて返し、ということを要素がなくなるまで続けます。

     itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>
       a, b, c, 1, 2, 3

*note itertools.islice(iter, [start], stop, [step]): d47. は、イテレータ
の スライスをストリームで返します。 '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]): 2c23. はイテレータを複製します; 元のイテ
レータの内容を同じように返す、独立した '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):
2c4a. (二つの値を加算)、 *note operator.ne(a, b): 2c3a. (‘a != b’ と同じ
)、 *note operator.attrgetter('id'): 1037. (‘.id’ 属性を取得するコーラブ
ルを返す) といった関数です。

*note itertools.starmap(func, iter): 12fe. は、イテラブルがタプルのスト
リームを返すとみなして、 そのタプルを引数に使って '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): 262d. は *note filter():
a68. とは反対に、 述語が偽を返す要素をすべて返します:

     itertools.filterfalse(is_even, itertools.count()) =>
       1, 3, 5, 7, 9, 11, 13, 15, ...

*note itertools.takewhile(predicate, iter): 2c22. は述語が真を返している
間だけ要素を返します。一度でも述語が偽を返すと、イテレータは出力終了の合
図をします。

     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): 2c21. は、述語が真を返してい
るうちは要素を無視し、偽になってから残りの出力をすべて返します。

     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): 149e. は 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): 152d. は、 '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): 1d3b. が
あり、こちらはこの順序についての制約がなく、 '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): 149d. 関数は
別の制約を取り払います: 一回の選択で同じ要素を繰り返し選んでも良い。概念
的には、それぞれのタプルの最初のものとして一つ要素が選ばれ、続いて 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):
17cc. は、 これまでで最も複雑です。 ‘key_func(elem)’ は、イテラブルから
返ってきた要素それぞれのキー値を計算する関数です。この関数が指定されてい
なければ、 キーは単に各要素そのものになります。

*note groupby(): 17cc. は、元になるイテラブルから同じキー値を持つ連続す
る要素を集めて、キー値とそのキーに対応する要素のイテレータの 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(): 17cc. は、元になるイテラブルの内容がキー値でソートされ
た状態で与えられることを想定しています。ここで、返されるイテレータ自体も
元のイテラブルを使うということに注意してください。そのため、 iterator-1
の結果を読み終わるまでは iterator-2 とそれに対応するキー値を要求すること
はできません。


File: python.info,  Node: functools モジュール,  Next: 小さな関数とラムダ式,  Prev: itertools モジュール,  Up: 関数型プログラミング HOWTO

9.7.7 functools モジュール
--------------------------

*note functools: 63. モジュールには、高階関数がいくつか入っています。 '高
階関数' とは、入力として関数を受け取って新たな関数を返す関数です。このモ
ジュールで一番便利なツールは *note functools.partial(): 219. 関数です。

関数型スタイルのプログラムでは時折、既存の関数から一部のパラメータを埋め
た変種を作りたくなることがあります。Python の関数 ‘f(a, b, c)’ というも
のがあるとしてください; ‘f(1, b, c)’ と同じ意味の ‘g(b, c)’ という関数を
作りたくなることがあります; つまり ‘f()’ のパラメータを一つ埋めるわけで
す。これは「関数の部分適用」と呼ばれています。

*note partial(): 219. のコンストラクタは ‘(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]): 21c. はイテラブルの
要素に対して次々に演算を実行していった最終結果を出すもので、それゆえ無限
長イテラブルには適用できません。 'func' には、要素を二つ取って値を一つ返
す関数が入ります。 ‘functools.reduce()’ はイテレータが返す最初の二要素 A
と B を取って ‘func(A, B)’ を計算します。それから三番目の要素 C を要求し
て ‘func(func(A, B), C)’ を計算すると、その結果をさらに四番目の要素と組
み合わせて……ということをイテラブルが尽きるまで続けるのです。 もしイテラ
ブルが一つも値を返さなければ *note TypeError: 199. が発生します。 初期値
‘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 iterable with no initial value
     >>> functools.reduce(operator.mul, [1, 2, 3], 1)
     6
     >>> functools.reduce(operator.mul, [], 1)
     1

*note operator.add(): 2c4a. を *note functools.reduce(): 21c. で使うと、
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(): 21c. を使うよりは、単に
*note for: 348. ループを書いたほうがわかりやすくなります:

     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):
bf4. です。この関数は同じ計算をしますが、最終結果を返すのではなく、
‘accumulate()’ はそれぞれの中間結果を生成するイテレータが返り値となりま
す。

     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: 14b9. 式です。 ‘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(): 21c. を使っているところは ‘for’ ル
ープに 書き直したほうが見やすいです。

Fredrik Lundh は以前 ‘lambda’ 利用のリファクタリングに関して以下の指針を
提案したことがあります:

  1. ラムダ関数を書く。

  2. そのラムダが一体ぜんたい何をしているのかコメントで説明する。

  3. そのコメントをしばらく研究して、本質をとらえた名前を考える。

  4. ラムダをその名前で def 文に書き換える。

  5. コメントを消す。

著者はこの指針を本当に気に入っていますが、こうしたラムダなしスタイルが他
より優れているかどうかについて、異論は認めます。


File: python.info,  Node: 更新履歴と謝辞,  Next: 参考資料<2>,  Prev: 小さな関数とラムダ式,  Up: 関数型プログラミング HOWTO

9.7.9 更新履歴と謝辞
--------------------

The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
article: 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 also wrote a 3-part series of articles on functional programming
for IBM's DeveloperWorks site; see part 1(1), part 2(2), and 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
=================


Author: Vinay Sajip <vinay_sajip at red-dove dot com>

このページはチュートリアルです。レファレンスやロギングクックブックは、
*note その他のリソース: 5ad2. を参照してください。

* Menu:

* 基本 logging チュートリアル::
* 上級ロギングチュートリアル::
* ロギングレベル: ロギングレベル<2>.
* 便利なハンドラ::
* ログ記録中に発生する例外::
* 任意のオブジェクトをメッセージに使用する::
* 最適化: 最適化<19>.
* その他のリソース::


File: python.info,  Node: 基本 logging チュートリアル,  Next: 上級ロギングチュートリアル,  Up: Logging HOWTO

9.8.1 基本 logging チュートリアル
---------------------------------

logging は、あるソフトウェアが実行されているときに起こったイベントを追跡
するための手段です。ソフトウェアの開発者は、特定のイベントが発生したこと
を示す logging の呼び出しをコードに加えます。イベントは、メッセージで記
述され、これに変数データ (すなわち、イベントが起こる度に異なるかもしれな
いデータ) を加えることもできます。イベントには、開発者がそのイベントに定
めた重要性も含まれます。重要性は、'レベル (level)' や '重大度
(severity)' とも呼ばれます。

* Menu:

* logging を使うとき::
* 簡単な例::
* ファイルへの logging::
* 変数データのロギング::
* 表示されるメッセージのフォーマットの変更::
* メッセージ内での日付と時刻の表示::
* 次のステップ::


File: python.info,  Node: logging を使うとき,  Next: 簡単な例,  Up: 基本 logging チュートリアル

9.8.1.1 logging を使うとき
..........................

You can access logging functionality by creating a logger via ‘logger =
logging.getLogger(__name__)’, and then calling the logger's *note
debug(): 102f, *note info(): 2138, *note warning(): 1ad5, *note error():
31f8. and *note critical(): 102e. 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(): 117b.
普通に使う、コンソール出力の表示          

プログラムの通常の操作中に発生したイベ    A logger's *note info(): 2138. (or
ントの報告 (例えば、状態の監視や障害の    *note debug(): 102f. method for very
分析)                                     detailed output for diagnostic purposes)
                                          
                                          
特定のランタイムイベントに関わる警告の    その発行が避けられるもので、クライアント
発行                                      アプリケーションを修正してその警告を排除
                                          するべきなら
                                          *note warnings.warn(): 1737.
                                          
                                          A logger's *note warning(): 1ad5. 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(): 31f8,
、長期のサーバプロセス中のエラーハンド    *note exception(): 102d. or
ラ)                                       *note critical(): 102e. 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: 簡単な例,  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(): bf7. 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: 簡単な例,  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(): 318. が使うデフォルト値が使われます。上の例に出てきていませんが
、同じく渡せるようになった 'errors' 引数は、エンコーディングエラーの扱い
を決定します。利用可能な値およびデフォルト値については、 ‘open()’ のドキ
ュメントを参照してください。

そして、ファイルの中身を確認すると、ログメッセージが確認できます:

     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(): bf7. の '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(): bf7. should come 'before' any calls to
a logger's methods such as *note debug(): 102f, *note info(): 2138, 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: 898. のような新しいフォーマットオプションよりも先に生ま
れました。新しいフォーマットオプションはサポートされて 'います' が、その
探求はこのチュートリアルでは対象としません。詳細は *note
固有の書式化スタイルをアプリケーション全体で使う: 3215. を参照してくださ
い。


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 属性: 31f6. のドキュメ
ントから参照できますが、単純な用途では、必要なものは '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(): 1406. でサポート
されているものと同じです。

   ---------- 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 クックブック:
1414. もご覧ください。

   ---------- 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: 11ec. インスタンスの形で、 logger,
handler, filter, formatter の間でやりとりされます。

ロギングは、 *note Logger: d4a. クラスのインスタンス (以下 'ロガー') に
メソッドを呼び出すことで実行されます。各インスタンスには名前があり、名前
空間階層構造に、ドット (ピリオド) をセパレータとして、概念的に並べられて
います。例えば、 'scan' という名前のロガーは、ロガー 'scan.text',
'scan.html' および 'scan.pdf'の親です。ロガー名は、何でも望むものにでき
、ロギングされたメッセージが発生した場所を指し示します。

ロガーに名前をつけるときの良い習慣は、ロギングを使う各モジュールに、以下
のように名付けられた、モジュールレベルロガーを使うことです:

     logger = logging.getLogger(__name__)

これにより、ロガー名はパッケージ/モジュール階層をなぞり、ロガー名だけで
、どこでイベントのログが取られたか、直感的に明らかになります。

ロガーの階層構造の根源は、ルートロガーと呼ばれます。それが、関数 *note
debug(): 31f7, *note info(): 3220, *note warning(): 352, *note error():
3234. および *note critical(): 3235. によって使われるロガーとなります。
これらの関数は単に、ルートロガーの同名のメソッドを呼び出します。これらの
関数とメソッドは、同じ署名をもっています。ルートロガーの名前は、ログ出力
では 'root' と表示されます。

もちろん、メッセージを異なる送信先に記録することも出来ます。このパッケー
ジでは、ファイルへ、 HTTP GET/POST 先へ、 SMTP 経由で電子メールへ、汎用
のソケットへ、キューへ、または Windows NT イベントログのような OS 毎のロ
グ記録機構への、ログメッセージの書きこみがサポートされています。送信先は
、 'handler' クラスによって取り扱われます。組み込みのハンドラクラスでは
満たせないような、特殊な要件があるなら、独自のログ送信先を生成できます。

デフォルトでは、どのロギングメッセージに対しても、送信先は設定されていま
せん。チュートリアルの例のように、 *note basicConfig(): bf7. を使って、
送信先 (コンソールやファイルなど) を指定できます。関数 *note debug():
31f7, *note info(): 3220, *note warning(): 352, *note error(): 3234. お
よび *note critical(): 3235. を呼び出すと、それらは送信先が設定されてい
ないかを調べます。そして設定されていなければ、ルートロガーに委譲して実際
にメッセージを出力する前に、コンソール (‘sys.stderr’) を送信先に、デフォ
ルトのフォーマットを表示されるメッセージに設定します。

*note basicConfig(): bf7. が設定するデフォルトのメッセージのフォーマット
は次のようになります:

     severity:logger name:message

*note basicConfig(): bf7. の 'format' キーワード引数にフォーマット文字列
を渡すことで、これを変更できます。フォーマット文字列を構成するためのすべ
てのオプションは、 *note フォーマッタオブジェクト: 3212. を参照してくだ
さい。

* 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: d4a. オブジェクトの仕事は大きく三つに分かれます。一つ目は
、アプリケーションが実行中にメッセージを記録できるように、いくつかのメソ
ッドをアプリケーションから呼べるようにしています。二つ目に、ロガーオブジ
ェクトはどのメッセージに対して作用するかを、深刻度 (デフォルトのフィルタ
機構) またはフィルタオブジェクトに基づいて決定します。三つ目に、ロガーオ
ブジェクトは関心を持っているすべてのログハンドラに関連するログメッセージ
を回送します。

とりわけ広く使われるロガーオブジェクトのメソッドは、二つのカテゴリーに分
類できます: 設定とメッセージ送信です。

これらが設定メソッドの中でよく使われます:

   * *note Logger.setLevel(): 16b1. はロガーが扱うログメッセージの最も低
     い深刻度を指定します。組み込みの深刻度の中では DEBUG が一番低く、
     CRITICAL が一番高くなります。たとえば、深刻度が INFO と設定されたロ
     ガーは INFO, WARNING, ERROR, CRITICAL のメッセージしか扱わず、
     DEBUG メッセージは無視します。

   * *note Logger.addHandler(): 31f1. と *note Logger.removeHandler():
     31f2. は、ハンドラオブジェクトをロガーオブジェクトから追加または削
     除します。ハンドラについては、 *note ハンドラ: 5adf. で詳しく述べま
     す。

   * *note Logger.addFilter(): 31f9. と *note Logger.removeFilter():
     31fa. はロガーオブジェクトにフィルタオブジェクトを追加または削除し
     ます。フィルタについては、 *note フィルタオブジェクト: 321d. で詳し
     く述べます。

これらのメソッドを、生成したすべてのロガーに毎回呼び出さなければならない
わけではありません。この節の最後の 2 段落を参照してください。

ロガーオブジェクトが設定されれば、以下のメソッドがログメッセージを生成し
ます:

   * *note Logger.debug(): 102f, *note Logger.info(): 2138, *note
     Logger.warning(): 1ad5, *note Logger.error(): 31f8, *note
     Logger.critical(): 102e. はすべて、メッセージとメソッド名に対応した
     レベルでログ記録を作り出します。メッセージは実際にはフォーマット文
     字列であり、通常の文字列代入に使う ‘%s’, ‘%d’, ‘%f’ などを含むこと
     ができます。残りの引数はメッセージの代入される位置に対応するオブジ
     ェクトのリストです。 ‘**kwargs’ については、ログ記録メソッドが気に
     するキーワードは ‘exc_info’ だけで、例外の情報をログに記録するかを
     決定するのに使います。

   * *note Logger.exception(): 102d. は *note Logger.error(): 31f8. と似
     たログメッセージを作成します。違いは ‘Logger.exception()’ がスタッ
     クトレースを一緒にダンプすることです。このメソッドは例外ハンドラか
     らだけ呼び出すようにしてください。

   * *note Logger.log(): 102c. はログレベルを明示的な引数として受け取り
     ます。これは上に挙げた便宜的なログレベル毎のメソッドを使うより少し
     コード量が多くなりますが、独自のログレベルを使うことができます。

*note getLogger(): b5d. は、指定されればその特定の名前の、そうでなければ
‘root’ のロガーインスタンスへの参照を返します。ロガーの名前はピリオド区
切りの階層構造を表します。同じ名前で ‘getLogger()’ を複数回呼び出した場
合、同一のロガーオブジェクトへの参照が返されます。階層リストを下ったロガ
ーはリスト上位のロガーの子です。たとえば、名前が ‘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: 16b4. オブジェクトは適切なログメッセージを (ログメッセー
ジの深刻度に基づいて) ハンドラの指定された出力先に振り分けることに責任を
持ちます。 *note Logger: d4a. オブジェクトには *note addHandler(): 31f1.
メソッドで 0 個以上のハンドラを追加することができます。例として、あるア
プリケーションがすべてのログメッセージをログファイルに、 error 以上のす
べてのログメッセージを標準出力に、 critical のメッセージはすべてメールア
ドレスに、それぞれ送りたいとします。この場合、 3 つの個別のハンドラがそ
れぞれの深刻度と宛先に応じて必要になります。

このライブラリには多くのハンドラが用意されています (*note
便利なハンドラ: 5ae1. を参照してください) が、このチュートリアルでは
*note StreamHandler: 1415. と *note FileHandler: 1cb0. だけを例に取り上
げます。

アプリケーション開発者にとってハンドラを扱う上で気にするべきメソッドは極
々限られています。組み込みのハンドラオブジェクトを使う (つまり自作ハンド
ラを作らない) 開発者に関係あるハンドラのメソッドは、次の設定用のメソッド
だけでしょう:

   * *note setLevel(): 3207. メソッドは、ロガーオブジェクトの場合と同様
     に、適切な出力先に振り分けられるべき最も低い深刻度を指定します。な
     ぜ 2 つも ‘setLevel()’ メソッドがあるのでしょうか?  ロガーで設定さ
     れるレベルは、付随するハンドラにどんな深刻度のメッセージを渡すか決
     めます。それぞれのハンドラで設定されるレベルは、そのハンドラがどの
     メッセージを転送するべきか決めます。

   * *note setFormatter(): 3208. でこのハンドラが使用する Formatter オブ
     ジェクトを選択します。

   * *note addFilter(): 3209. および *note removeFilter(): 320a. はそれ
     ぞれハンドラへのフィルタオブジェクトの設定と解除を行います。

アプリケーションのコード中では *note Handler: 16b4. のインスタンスを直接
インスタンス化して使ってはなりません。代わりに、 ‘Handler’ クラスはすべ
てのハンドラが持つべきインターフェイスを定義する基底クラスであり、子クラ
スが使える (もしくはオーバライドできる) いくつかのデフォルトの振る舞いを
規定します。


File: python.info,  Node: フォーマッタ,  Next: ロギングの環境設定,  Prev: ハンドラ,  Up: 上級ロギングチュートリアル

9.8.2.4 フォーマッタ
....................

フォーマッタオブジェクトは最終的なログメッセージの順序、構造および内容を
設定します。基底クラスである *note logging.Handler: 16b4. とは違って、ア
プリケーションのコードはフォーマッタクラスをインスタンス化しても構いませ
ん。特別な振る舞いをさせたいアプリケーションではフォーマッタのサブクラス
を使う可能性もあります。コンストラクタは三つのオプション引数を取ります -
メッセージのフォーマット文字列、日付のフォーマット文字列、スタイル標識で
す。

 -- メソッド: 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 属性: 31f6. に文書化されています。 style が ‘'{'’ の場合、メッ
セージフォーマット文字列は (キーワード引数を使う) *note str.format():
833. と互換となります。 style が ‘'$'’ の場合、メッセージフォーマット文
字列は *note string.Template.substitute(): 2130. で期待されているものと
一致します。

バージョン 3.2 で変更: ‘style’ パラメータが追加されました。

次のメッセージフォーマット文字列は、人が読みやすい形式の時刻、メッセージ
の深刻度、およびメッセージの内容を、順番に出力します:

     '%(asctime)s - %(levelname)s - %(message)s'

フォーマッタは、ユーザが設定できる関数を使って、生成時刻をタプルに記録し
ます。デフォルトでは、 *note time.localtime(): 1717. が使われます。特定
のフォーマッタインスタンスに対してこれを変更するには、インスタンスの
‘converter’ 属性を ‘time.localtime()’ や *note time.gmtime(): 13dc. と同
じ署名をもつ関数に設定してください。すべてのフォーマッタインスタンスに対
してこれを変更するには、例えば全てのロギング時刻を GMT で表示するには、
フォーマッタクラスの ‘converter’ 属性を (GMT 表示の ‘time.gmtime’ に) 設
定してください。


File: python.info,  Node: ロギングの環境設定,  Next: 環境設定が与えられないとどうなるか,  Prev: フォーマッタ,  Up: 上級ロギングチュートリアル

9.8.2.5 ロギングの環境設定
..........................

プログラマは、ロギングを 3 種類の方法で設定できます:

  1. 上述の設定メソッドを呼び出す Python コードを明示的に使って、ロガー
     、ハンドラ、そしてフォーマッタを生成する。

  2. ロギング設定ファイルを作り、それを *note fileConfig(): d4c. 関数を
     使って読み込む。

  3. 設定情報の辞書を作り、それを *note dictConfig(): 13cc. 関数に渡す。

最後の2つの選択肢については、 *note 環境設定のための関数: 150d. で解説し
ています。以下の例では、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(): d4c. 関数はデフォルト引数
     ‘disable_existing_loggers’ を取り、後方互換性のためにデフォルト値は
     ‘True’ になっています。 これはあなたの望むものかもしれませんし、そ
     うでないかもしれません。というのは、設定で明示的に指定したクラス (も
     しくはその親クラス) を除いて、 ‘fileConfig()’ が呼び出される前に存
     在した非ルートロガーを無効化してしまうからです。 より詳細なことはリ
     ファレンスを参照し、望むならこの引数に ‘False’ を指定してください。

     *note dictConfig(): 13cc. に渡される辞書でも、キー
     ‘disable_existing_loggers’ で真偽値を指定することができ、辞書の中で
     明示的に指定しなかった場合はデフォルトで ‘True’ と解釈されます。こ
     れは上で説明したロガー無効化につながりますが、それを望まないことも
     あるでしょう - その場合は、明示的にキーを与えて値を ‘False’ にして
     ください。

なお、設定ファイルで参照されるクラス名は、logging モジュールに対して相対
であるか、通常のインポート機構を使って解決される絶対である値でなければな
りません。従って、(logging モジュールに相対な) *note WatchedFileHandler:
3274. または (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 環境設定のための関数: 150d. を
参照してください。


File: python.info,  Node: 環境設定が与えられないとどうなるか,  Next: ライブラリのためのロギングの設定,  Prev: ロギングの環境設定,  Up: 上級ロギングチュートリアル

9.8.2.6 環境設定が与えられないとどうなるか
..........................................

ロギング環境設定を与えられないと、ロギングイベントを出力しなければならな
いのに、イベントを出力するハンドラが見つからないことがあります。

イベントは、 *note lastResort: 1417. に格納された「最終手段ハンドラ」を
使用して出力されます。この内部的なハンドラはどんなロガーにも関係しておら
ず、イベント記述メッセージを現在の ‘sys.stderr’ に書く *note
StreamHandler: 1415. のように動作します (したがって、あらゆるリダイレク
トの効果が反映されます)。メッセージに対してフォーマットは行われません。
イベント記述メッセージだけがそのまま表示されます。ハンドラのレベルは
‘WARNING’ にセットされ、重大度がこれ以上のすべてのイベントが出力されます
。

バージョン 3.2 で変更: Python 3.2 より前のバージョンでは、振る舞いは以下
の通りです:

   * *note raiseExceptions: 1416. が ‘False’ (製品モード) なら、イベント
     は黙って捨てられます。

   * *note raiseExceptions: 1416. が ‘True’ (開発モード) なら、メッセー
     ジ 'No handlers could be found for logger X.Y.Z' が一度表示されます
     。

3.2 より前の動作にするために、*note lastResort: 1417. を ‘None’ に設定す
ることもできます。


File: python.info,  Node: ライブラリのためのロギングの設定,  Prev: 環境設定が与えられないとどうなるか,  Up: 上級ロギングチュートリアル

9.8.2.7 ライブラリのためのロギングの設定
........................................

ロギングを使うライブラリを開発するときは、ライブラリがどのようにロギング
を使うのか、例えば使われているロガーの名前などを、ドキュメントにしておく
べきです。ロギングの設定については、いくつか考えておくべきこともあります
。使っているアプリケーションがロギングを使っていなくて、ライブラリコード
がロギングを呼び出すと、(前の節で解説したように) 重大度 ‘WARNING’ 以上の
イベントが、‘sys.stderr’ に表示されます。これが最高のデフォルトの振る舞
いと見なされます。

何らかの理由でロギング設定がなされていないときにメッセージを表示 'させた
くない' のであれば、ライブラリのトップレベルのロガーに何もしないハンドラ
を取り付けられます。ライブラリの全てのイベントに対してそのハンドラが見つ
かるので、メッセージが表示されなくなります。ライブラリのユーザーがアプリ
ケーションのためにロギングを設定する場合、おそらくハンドラが追加され、そ
してレベルが適切に設定された場合に、ライブラリコード内でのロギングの呼び
出しは通常通りそのハンドラに出力を送るようになります。

何もしないハンドラ *note NullHandler: 14a0. (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: 14a0. '以外のハ
     ンドラを追加しない' ことを強く推奨します。これは、ハンドラの設定が
     、あなたのライブラリを使うアプリケーション開発者にも伝播するからで
     す。アプリケーション開発者は、対象となる聴衆と、そのアプリケーショ
     ンにどのハンドラが最も適しているかを知っています。ハンドラを 'ボン
     ネットの中で' 加えてしまうと、ユニットテストをして必要に応じたログ
     を送達する能力に干渉しかねません。


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: 11ec. クラスのインスタンスと
してエンコードされます。ロガーがあるイベントを実際にログ出力すると決定し
た場合、ログメッセージから ‘LogRecord’ インスタンスが生成されます。

ログ記録されるメッセージは、ハンドラ ('handlers') を通してディスパッチ機
構にかけられます。ハンドラは *note Handler: 16b4. クラスのサブクラスのイ
ンスタンスで、ログ記録された (*note LogRecord: 11ec. 形式の) メッセージ
が、そのメッセージの伝達対象となる相手 (エンドユーザ、サポートデスクのス
タッフ、システム管理者、開発者) に行き着くようにする役割を持ちます。ハン
ドラには特定の出力先を意図された ‘LogRecord’ インスタンスが渡されます。
各ロガーは 0 個以上のハンドラを (*note Logger: d4a. の *note
addHandler(): 31f1. メソッド) で関連付けることができます。ロガーに直接関
連付けられたハンドラに加えて、'ロガーの上位にあるロガーすべてに関連付け
られたハンドラ' がメッセージを処理する際に呼び出されます (ただしロガーの
'propagate' フラグが false 値にセットされている場合を除きます。その場合
は、祖先ハンドラへの伝搬はそこで止まります)。

ロガーと同様に、ハンドラは関連付けられたレベルを持つことができます。ハン
ドラのレベルはロガーのレベルと同じ方法で、フィルタとして働きます。ハンド
ラがあるイベントを実際に処理すると決定した場合、 *note emit(): 3210. メ
ソッドが使われ、メッセージを出力先に送信します。ほとんどのユーザ定義の
*note Handler: 16b4. のサブクラスで、この ‘emit()’ をオーバライドする必
要があるでしょう。

* 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: 16b4. クラスに加え、多くの便利なサブクラスが提供さ
れています:

  1. *note StreamHandler: 1415. インスタンスは、メッセージをストリーム
     (ファイル風オブジェクト) に送ります。

  2. *note FileHandler: 1cb0. インスタンスは、メッセージをディスクファイ
     ルに送ります。

  3. *note BaseRotatingHandler: 3278. は、ある地点でログファイルを循環さ
     せるハンドラの基底クラスです。これを直接インスタンス化することは意
     図されていません。代わりに、 *note RotatingFileHandler: 19a1. や
     *note TimedRotatingFileHandler: 1167. を使用してください。

  4. *note RotatingFileHandler: 19a1. インスタンスは、メッセージをディス
     クファイルに送り、最大ログファイル数とログファイル循環をサポートし
     ます。

  5. *note TimedRotatingFileHandler: 1167. インスタンスは、メッセージを
     ディスクファイルに送り、ログファイルを特定時間のインターバルで循環
     します。

  6. *note SocketHandler: 1168. インスタンスは、 TCP/IP ソケットにメッセ
     ージを送ります。バージョン3.4　から、 Unixドメインソケットもサポー
     トされます。

  7. *note DatagramHandler: 1169. インスタンスは UDP ソケットにメッセー
     ジを送ります。バージョン 3.4 から、Unix ドメインソケットもサポート
     されます。

  8. *note SMTPHandler: 1914. インスタンスは、メッセージを指示された
     email アドレスに送ります。

  9. *note SysLogHandler: 86d. インスタンスは、メッセージを、必要ならば
     リモートマシンの、Unix syslog daemon に送ります。

  10. *note NTEventLogHandler: 329e. インスタンスは、メッセージを
     Windows NT/2000/XP イベントログに送ります。

  11. *note MemoryHandler: 3257. インスタンスは、メッセージを、特定の基
     準が満たされる度に流される、メモリ中のバッファに送ります。

  12. *note HTTPHandler: 1030. インスタンスは、メッセージを、 ‘GET’ また
     は ‘POST’ セマンティクスを使って、HTTP サーバに送ります。

  13. *note WatchedFileHandler: 3274. インスタンスは、ロギングする先のフ
     ァイルを監視します。ファイルが変更されると、そのファイルは閉じられ
     、ファイル名を使って再び開かれます。このハンドラは Unix 系のシステ
     ムにのみ便利です。Windows は、使われている基の機構をサポートしてい
     ません。

  14. *note QueueHandler: 1bc0. インスタンスは、 *note queue: bb. モジュ
     ールや *note multiprocessing: 98. モジュールなどで実装されているキ
     ューにメッセージを送ります。

  15. *note NullHandler: 14a0. インスタンスは、エラーメッセージについて
     何もしません。このクラスはライブラリ開発者が、 logging は使いたいが
     、ライブラリのユーザーが logging の設定をしなかったときに表示されう
     る 'No handlers could be found for logger 'XXX" のようなメッセージ
     を回避したいときに使います。詳しくは、 *note
     ライブラリのためのロギングの設定: 3271. を参照してください。

Added in version 3.1: *note NullHandler: 14a0. クラス。

Added in version 3.2: *note QueueHandler: 1bc0. クラス。

コア logging パッケージで、 *note NullHandler: 14a0, *note
StreamHandler: 1415. および *note FileHandler: 1cb0. クラスが定義されて
います。その他のハンドラは、サブモジュールの *note logging.handlers: 8d.
で定義されています。(環境設定機能のためのサブモジュール、 *note
logging.config: 8c. もあります。)

ログメッセージは、 *note Formatter: 16b5. クラスのインスタンスを通してフ
ォーマット化してから表示されます。このインスタンスは、 % 演算子と辞書で
使うのに適切なフォーマット文字列で初期化されます。

複数のメッセージを一括してフォーマット化するには、 *note
BufferingFormatter: 3219. が使えます。(一連の文字列のそれぞれに適用され
る) フォーマット文字列に加え、ヘッダとトレーラフォーマット文字列も提供さ
れています。

ロガーレベルおよび/またはハンドラレベルに基づくフィルタリングで十分でな
ければ、 *note Filter: 1418. のインスタンスを *note Logger: d4a. と
*note Handler: 16b4. インスタンスの両方に (*note addFilter(): 3209. を通
して) 加えることができます。メッセージの処理を続ける前に、ロガーもハンド
ラも、全てのフィルタに許可を求めます。フィルタのいずれかが偽値を返したら
、メッセージの処理は続けられません。

基本の *note Filter: 1418. 機能では、特定のロガー名でのフィルタリングを
できます。この機能が使われると、指名されたロガーに送られたメッセージとそ
の子だけがフィルタを通り、その他は落とされます。


File: python.info,  Node: ログ記録中に発生する例外,  Next: 任意のオブジェクトをメッセージに使用する,  Prev: 便利なハンドラ,  Up: Logging HOWTO

9.8.5 ログ記録中に発生する例外
------------------------------

logging パッケージは、ログを生成している間に起こる例外を飲み込むように設
計されています。これは、ログ記録イベントを扱っている間に発生するエラー
(ログ記録の設定ミス、ネットワークまたは他の同様のエラー) によってログ記
録を使用するアプリケーションが早期に終了しないようにするためです。

*note SystemExit: f40. と *note KeyboardInterrupt: bc9. 例外は決して飲み
込まれません。 *note Handler: 16b4. サブクラスの *note emit(): 3210. メ
ソッドの間に起こる他の例外は、 *note handleError(): 320f. メソッドに渡さ
れます。

*note Handler: 16b4. の *note handleError(): 320f. のデフォルト実装は、
モジュールレベル変数 *note raiseExceptions: 1416. が設定されているかどう
かチェックします。設定されているなら、トレースバックが *note sys.stderr:
b37. に出力されます。設定されていないなら、例外は飲み込まれます。

     注釈: *note raiseExceptions: 1416. のデフォルト値は ‘True’ です。こ
     れは、開発の間に起こるどんな例外についても通常は通知してほしいから
     です。実運用環境では ‘raiseExceptions’ を ‘False’ に設定することを
     お勧めします。


File: python.info,  Node: 任意のオブジェクトをメッセージに使用する,  Next: 最適化<19>,  Prev: ログ記録中に発生する例外,  Up: Logging HOWTO

9.8.6 任意のオブジェクトをメッセージに使用する
----------------------------------------------

前の節とそこで挙げた例では、イベントを記録するときに渡されたメッセージが
文字列であると仮定していました。しかし、これは唯一の可能性ではありません
。メッセージとして任意のオブジェクトを渡すことができます。そして、ロギン
グシステムがそのオブジェクトを文字列表現に変換する必要があるとき、オブジ
ェクトの *note __str__(): 830. メソッドが呼び出されます。実際、そうした
ければ、文字列表現を計算することを完全に避けることができます - 例えば、
*note SocketHandler: 1168. は、イベントを pickle してネットワーク上で送
信することでログ出力します。


File: python.info,  Node: 最適化<19>,  Next: その他のリソース,  Prev: 任意のオブジェクトをメッセージに使用する,  Up: Logging HOWTO

9.8.7 最適化
------------

message 引数の整形は、必要になるまで延期されます。しかしながら、ログ記録
メソッドに渡す引数を計算するだけでもコストがかかる場合があります。ロガー
が単にイベントを捨てるなら、その計算を避けたいと考えるかもしれません。ど
うするかを決定するために *note isEnabledFor(): 1512. メソッドを呼ぶこと
ができます。このメソッドは引数にレベルを取って、そのレベルの呼び出しに対
して Logger がイベントを生成するなら true を返します。このようにコードを
書くことができます:

     if logger.isEnabledFor(logging.DEBUG):
         logger.debug('Message with %s, %s', expensive_func1(),
                                             expensive_func2())

このようにすると、ロガーの閾値が ‘DEBUG’ より上に設定されている場合、
‘expensive_func1’ と ‘expensive_func2’ の呼び出しは行われません。

     注釈: ある種のケースでは、 *note isEnabledFor(): 1512. それ自身があ
     なたが期待するよりも高価になる場合があります(たとえば明示的なレベル
     指定がロガー階層の上位のみに設定されていて、ロガーが深くネストされ
     ているような場合です)。そのようなケース(あるいはタイトなループ内で
     メソッド呼び出しを避けたい場合)は、 ‘isEnabledFor()’ 結果をローカル
     にもしくはインスタンス変数としてキャッシュし、メソッドを毎回呼び出
     すかわりに使えば良いです。そのようなキャッシュ値は、(まったく一般的
     ではありませんが)ロギング設定がアプリケーション実行中に動的に変更さ
     れた場合にのみ再計算が必要でしょう。

これ以外にも、どんなログ情報が集められるかについてより正確なコントロール
を必要とする、特定のアプリケーションでできる最適化があります。これは、ロ
グ記録の間の不要な処理を避けるためにできることのリストです:

不要な情報                                                それを避ける方法
                                                          
------------------------------------------------------------------------------------------------------------------
                                                          
呼び出しがどこから行われたかに関する情報。                ‘logging._srcfile’ を ‘None’ にする。このことにより
                                                          *note sys._getframe(): 8f1. 呼び出しを避けることが出
                                                          来、PyPy のような環境(‘sys._getframe()’ の高速化が出
                                                          来ない)において高速化の役に立ちます。
                                                          
                                                          
スレッド情報。                                            ‘logging.logThreads’ を ‘False’ にする。
                                                          
                                                          
現在のプロセスID(*note os.getpid(): 307c.)                ‘logging.logProcesses’ を ‘False’ にする。
                                                          
                                                          
マルチプロセスの制御に ‘multiprocessing’ を使っていると   ‘logging.logMultiprocessing’ を ‘False’ にする。
きの、現在のプロセス名                                    

‘asyncio’ を使っているときの、現在の                      ‘logging.logAsyncioTasks’ を ‘False’ に設定する。
*note asyncio.Task: 1c9. の名前。                         

また、コア 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 ロギングクックブック: 1414.


File: python.info,  Node: Logging クックブック,  Next: Regular expression HOWTO,  Prev: Logging HOWTO,  Up: Python HOWTO

9.9 Logging クックブック
========================


Author: Vinay Sajip <vinay_sajip at red-dove dot com>

このページは、過去に有用であるとされていた、logging に関連するいくつもの
レシピを含んでいます。チュートリアルやリファレンス情報へのリンクについて
は *note その他のリソース: 5af2. を参照してください。

* 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(): 31f1. メソ
ッドは追加されるハンドラの個数について最小値も最大値も定めていません。時
にアプリケーションがすべての深刻度のすべてのメッセージをテキストファイル
に記録しつつ、同時にエラーやそれ以上のものをコンソールに出力することが役
に立ちます。これを実現する方法は、単に適切なハンドラを設定するだけです。
アプリケーションコードの中のログ記録の呼び出しは変更されずに残ります。少
し前に取り上げた単純なモジュール式の例を少し変えるとこうなります:

     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: 1914.: が電子メールを送るのに時間がかかることです
。しかし、ほとんどのネットワークをまたぐ handler はブロックする可能性が
あります: *note SocketHandler: 1168. による処理でさえ、裏で DNS への問い
合わせというとても遅い処理を行うことがあります (そしてこの問い合わせ処理
は、 Python の層より下のあなたの手の届かない、ソケットライブラリの深いと
ころにある可能性もあります)。

解決策の1つは、2パートに分離したアプローチを用いることです。最初のパート
は、パフォーマンスが重要なスレッドからアクセスされる、 *note
QueueHandler: 1bc0. だけをアタッチした logger です。この logger は単に、
十分大きい、あるいは無制限の容量を持ったキューに書き込むだけです。キュー
への書き込みは通常すぐに完了しますが、念の為に *note queue.Full: 370b. 例
外をキャッチする必要があるかもしれません。もしパフォーマンスクリティカル
なスレッドを持つライブラリの開発者であるなら、このことを (‘QueueHandler’
だけをアタッチした logger についての言及を添えて) ドキュメントに書いてお
きましょう。

2つ目のパートは *note QueueHandler: 1bc0. の対向として作られた *note
QueueListener: 244. です。 ‘QueueListener’ はとてもシンプルで、キューと
handler を渡され、内部で ‘QueueHandler’ (もしくは他の ‘LogRecord’ の出力
元) から送られた LogRecord をキューから受け取るスレッドを起動します。
‘LogRecord’ をキューから取り出して、 handler に渡して処理させます。

分離した *note QueueListener: 244. クラスを持つメリットは、複数の
‘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: 244. ク
ラスは常にキューから受け取ったメッセージを、初期化元となっているそれぞれ
のハンドラーに受け渡していました。 ( というのも、レベルフィルターリング
は別サイド、つまり、キューが満たされている場所で処理されるということが想
定されているからです) Python 3.5以降では、キーワードとなる引数
‘respect_handler_level=True’ をリスナーのコントラクターに受け渡すことで
、この挙動を変更することができるようになっています。これが行われると、各
メッセージのレベルをハンドラーのレベルと比較して、そうすることが適切な場
合のみ、メッセージをハンドラーに渡します。

バージョン 3.14 で変更: The *note QueueListener: 244. can be started
(and stopped) via the *note with: 187. 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: 1168. インスタンスを送信端の 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(): 328f. メソッドをオーバーライ
ドし代替シリアライズ手法を実装して、それを使うように上記のスクリプトを修
正することもできます。

* 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: d4a. インスタン
スを生成する誘惑に駆られるかもしれませんが、生成した ‘Logger’ インスタン
スはガーベジコレクションで回収されないので、これは良いアイデアとは言えま
せん。この例は現実的な問題ではないかもしれませんが、 ‘Logger’ インスタン
スの個数がアプリケーションの中でログ記録が行われるレベルの粒度に依存する
場合、 ‘Logger’ インスタンスの個数が事実上無制限にならないと、管理が難し
くなります。

* Menu:

* LoggerAdapter を使ったコンテキスト情報の伝達::
* Filter を使ったコンテキスト情報の伝達::


File: python.info,  Node: LoggerAdapter を使ったコンテキスト情報の伝達,  Next: Filter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.1 LoggerAdapter を使ったコンテキスト情報の伝達
....................................................

logging イベントの情報と一緒に出力されるコンテキスト情報を渡す簡単な方法
は、 *note LoggerAdapter: 1511. を使うことです。このクラスは *note
Logger: d4a. のように見えるように設計されていて、 *note debug(): 31f7,
*note info(): 3220, *note warning(): 352, *note error(): 3234, *note
exception(): 16b2, *note critical(): 3235, *note log(): 3236. の各メソッ
ドを呼び出せるようになっています。これらのメソッドは対応する ‘Logger’ の
メソッドと同じ引数を取るので、二つの型を取り替えて使うことができます。

*note LoggerAdapter: 1511. のインスタンスを生成する際には、 *note
Logger: d4a. インスタンスとコンテキスト情報を収めた辞書風 (dict-like) の
オブジェクトを渡します。 ‘LoggerAdapter’ のログ記録メソッドを呼び出すと
、呼び出しをコンストラクタに渡された配下の ‘Logger’ インスタンスに委譲し
、その際コンテキスト情報をその委譲された呼び出しに埋め込みます。
‘LoggerAdapter’ のコードから少し抜き出してみます:

     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: 1511. の *note process(): 322d. メソッドがコンテキ
スト情報をログ出力に加える場所です。そこではログ記録呼び出しのメッセージ
とキーワード引数が渡され、加工された (可能性のある) それらの情報を配下の
ロガーへの呼び出しに渡し直します。このメソッドのデフォルト実装ではメッセ
ージは元のままですが、キーワード引数にはコンストラクタに渡された辞書風オ
ブジェクトを値として "extra" キーが挿入されます。もちろん、呼び出し時に
"extra" キーワードを使った場合には何事もなかったかのように上書きされます
。

"extra" を用いる利点は辞書風オブジェクトの中の値が *note LogRecord:
11ec. インスタンスの __dict__ にマージされることで、辞書風オブジェクトの
キーを知っている *note Formatter: 16b5. を用意して文字列をカスタマイズす
るようにできることです。それ以外のメソッドが必要なとき、たとえばコンテキ
スト情報をメッセージの前や後ろにつなげたい場合には、 *note
LoggerAdapter: 1511. から *note process(): 322d. を望むようにオーバライ
ドしたサブクラスを作ることが必要なだけです。次に挙げるのはこのクラスを使
った例で、コンストラクタで使われる「辞書風」オブジェクトにどの振る舞いが
必要なのかも示しています:

     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: 1511. に渡すのは本物の dict でなくても構いません。
‘__getitem__’ と ‘__iter__’ を実装していて logging が辞書のように扱える
クラスのインスタンスを利用することができます。これは (dict の値が固定さ
れるのに対して) 値を動的に生成できるので便利です。


File: python.info,  Node: Filter を使ったコンテキスト情報の伝達,  Prev: LoggerAdapter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.3 Filter を使ったコンテキスト情報の伝達
.............................................

ユーザ定義の *note Filter: 1418. を使ってログ出力にコンテキスト情報を加
えることもできます。 ‘Filter’ インスタンスは、渡された ‘LogRecords’ を修
正することができます。これにより、適切なフォーマット文字列や必要なら
*note Formatter: 16b5. を使って、出力となる属性を新しく追加することも出
来ます。

例えば、web アプリケーションで、処理されるリクエスト (または、少なくとも
その重要な部分) は、スレッドローカル (*note threading.local: 18c4.) な変
数に保存して、 ‘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: 16b4. はそれぞれ一連のフィルタを独自に持っています。コン
テキスト情報を、他のハンドラに漏らすことなく *note LogRecord: 11ec. に付
加したい場合、以下に示すスクリプトのように、直接レコードを編集する代わり
に新しい ‘LogRecord’ を返すフィルタを使うことができます:

     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:
1168. に対してログ記録を行い、独立したプロセスとしてソケットサーバを動か
すことです。ソケットサーバはソケットから読み取ってファイルにログを書き出
します。 (この機能を実行するために、既存のプロセスの 1 つのスレッドを割
り当てることもできます) *note この節: 5afc. では、このアプローチをさらに
詳細に文書化しています。動作するソケット受信プログラムが含まれているので
、アプリケーションに組み込むための出発点として使用できるでしょう。

You could also write your own handler which uses the *note Lock: 18b8.
class from the *note multiprocessing: 98. module to serialize access to
the file from your processes.  The stdlib *note FileHandler: 1cb0. and
subclasses do not make use of ‘multiprocessing’.

別の方法として、 ‘Queue’ と *note QueueHandler: 1bc0. を使って、マルチプ
ロセスアプリケーションの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の利用.
* Deploying web applications using Gunicorn and uWSGI::


File: python.info,  Node: concurrent futures ProcessPoolExecutorの利用,  Next: Deploying web applications using Gunicorn and uWSGI,  Up: 複数のプロセスからの単一ファイルへのログ記録

9.9.12.1 concurrent.futures.ProcessPoolExecutorの利用
.....................................................

もし、ワーカープロセスを起動するために *note
concurrent.futures.ProcessPoolExecutor: 1d8. を使いたいのであれば、少し
違う方法でキューを作る必要があります。次のような方法の代わりに

     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: Deploying web applications using Gunicorn and uWSGI,  Prev: concurrent futures ProcessPoolExecutorの利用,  Up: 複数のプロセスからの単一ファイルへのログ記録

9.9.12.2 Deploying web applications using Gunicorn and uWSGI
............................................................

When deploying web applications using Gunicorn(1) or uWSGI(2) (or
similar), multiple worker processes are created to handle client
requests.  In such environments, avoid creating file-based handlers
directly in your web application.  Instead, use a *note SocketHandler:
1168. to log from the web application to a listener in a separate
process.  This can be set up using a process management tool such as
Supervisor - see *note Running a logging socket listener in production:
5afe. for more details.

   ---------- 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: 19a1. を提供しています:

     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:
898. (Python 2.4 で追加) と *note str.format(): 833. (Python 2.6 で追加)
が加わりました。

logging は (3.2 から) この2つの追加されたフォーマット方法をサポートして
います。 *note Formatter: 16b5. クラスが ‘style’ という名前のオプション
のキーワード引数を受け取ります。このデフォルト値は ‘'%'’ ですが、他に
‘'{'’ と ‘'$'’ が指定可能で、それぞれのフォーマット方法に対応しています
。後方互換性はデフォルト値によって維持されていますが、明示的に style 引
数を指定することで、 *note str.format(): 833. か *note string.Template:
898. を使った 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: 898. を使っ
て 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(): 1687. やその仲間によくエイリアスとして使われるアンダ
ースコア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: 1511. を利用して上と似たような効果
を実現する方法もあります:

     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: 11ec. のインスタンスとして表
現されます。イベントのログが取られて logger のレベルでフィルタされなかっ
た場合、イベントの情報を含む ‘LogRecord’ が生成され、その logger (と、
propagate が無効になるまでの上位 logger) の handler に渡されます。
Python 3.2 までは、この生成が行われているのは2箇所だけでした:

   * *note Logger.makeRecord(): 31fe.: 通常のイベント logging プロセスで
     呼ばれます。これは *note LogRecord: 11ec. を直接読んでインスタンス
     を生成します。

   * *note makeLogRecord(): 3224.: LogRecord に追加される属性を含む辞書
     を渡して呼び出されます。これはネットワーク越しに (pickle 形式で
     *note SocketHandler: 1168. 経由で、あるいは JSON 形式で *note
     HTTPHandler: 1030. 経由で) 辞書を受け取った場合などに利用されます。

そのために *note LogRecord: 11ec. で何か特別なことをしたい場合は、次のど
ちらかをしなければなりません。

   * *note Logger.makeRecord(): 31fe. をオーバーライドした独自の *note
     Logger: d4a. のサブクラスを作り、利用したい logger のどれかがインス
     タンス化される前に、それを *note setLoggerClass(): 3233. を使って登
     録する。

   * *note filter(): 321f. メソッドで必要な特殊な処理を行う *note
     Filter: 1418. を logger か handler に追加する。

最初の方法は、複数の異なるライブラリが別々のことをしようとした場合にうま
く行きません。各ライブラリが独自の *note Logger: d4a. のサブクラスを登録
しようとして、最後に登録されたライブラリが生き残ります。

2つ目の方法はほとんどのケースでうまくいきますが、たとえば *note
LogRecord: 11ec. を特殊化したサブクラスを使うことなどはできません。ライ
ブラリの開発者は利用している logger に適切な filter を設定できますが、新
しい logger を作るたびに忘れずに設定しないといけなくなります。 (新しいパ
ッケージやモジュールを追加し、モジュールレベルで次の式を実行することで、
新しい logger が作られます)

     logger = logging.getLogger(__name__)

これでは考えることが余計に1つ増えてしまうでしょう。開発者は、最も高いレ
ベルのロガーに取り付けられた *note NullHandler: 14a0. に、フィルタを追加
することもできますが、アプリケーション開発者が、より低いレベルに対するラ
イブラリのロガーにハンドラを取り付けた場合、フィルタは呼び出されません
-- 従って、そのハンドラからの出力はライブラリ開発者の意図を反映したもの
にはなりません。

Python 3.2 以降では、 *note LogRecord: 11ec. の生成は、指定できるファク
トリ経由になります。ファクトリは callable で、 *note
setLogRecordFactory(): 3228. で登録でき、 *note getLogRecordFactory():
3227. で現在のファクトリを取得できます。ファクトリは ‘LogRecord’ コンス
トラクタと同じシグネチャで呼び出され、 *note LogRecord: 11ec. がデフォル
トのファクトリとして設定されています。

このアプローチはカスタムのファクトリが 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: 1418. を利用するだけでは望む結果が得られな
い場合にのみ使うべきです。


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: 1bc0. のサブクラスを作ってメッセージを他のキュー、例
えば 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: 244. のサブクラスを作って、メッセージを他のキュー、
例えば 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(): 13cc.
に渡して設定を有効にします:

     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: 86d. に、 message に BOM を挿入するコ
ードが追加されました。しかし、そのときの実装が悪くて、 message の先頭に
BOM をつけてしまうのでピュアASCII 部分をその前に書くことができませんでし
た。

この動作は壊れているので、Python 3.2.4 以降では BOM を挿入するコードが、
削除されました。書き直されるのではなく削除されたので、 RFC 5424(3) 準拠
の、BOM と、オプションのピュア ASCII部分をBOMの前に、任意の Unicode を
BOM の後ろに持つ UTF-8 でエンコードされた message を生成したい場合、次の
手順に従う必要があります:

  1. *note SysLogHandler: 86d. のインスタンスに、次のような format 文字
     列を持った *note Formatter: 16b5. インスタンスをアタッチする:

          '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(): 13cc. を使っているなら、サブクラスを作らなくてもカスタマイ
ズが可能です。例えば、ログファイルの 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(): 13cc. に渡される構成設定の中で、この関数を
使って 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():
13cc. をサポートした全ての Python バージョン - Python 2.7, 3.2 以降 - で
利用できます。 3.3 以前のバージョンでは、オーナーを変更するのに *note
os.chown(): 130a. を利用する必要があるでしょう。

実際には、handler を生成する関数はプロジェクト内のどこかにあるユーティリ
ティモジュールに置くことになるでしょう。設定の中で直接関数を参照する代わ
りに:

     '()': owned_file_handler,

次のように書くこともできます:

     '()': 'ext://project.util.owned_file_handler',

‘project.util’ は関数がある実際の場所に置き換えてください。上のスクリプ
トでは ‘'ext://__main__.owned_file_handler'’ で動くはずです。 *note
dictConfig(): 13cc. は ‘ext://’ から実際の callable を見つけます。

この例は他のファイルに対する変更を実装する例にもなっています。例えば
*note os.chmod(): 529. を使って、同じ方法で POSIX パーミッションを設定で
きるでしょう。

もちろん、このアプローチは *note FileHandler: 1cb0. 以外の handler 、ロ
ーテートする file handler のいずれかやその他の handler にも適用できます
。


File: python.info,  Node: 固有の書式化スタイルをアプリケーション全体で使う,  Next: filter を dictConfig を使ってカスタマイズする,  Prev: handler を dictConfig を使ってカスタマイズする,  Up: Logging クックブック

9.9.24 固有の書式化スタイルをアプリケーション全体で使う
-------------------------------------------------------

Python 3.2 では、*note Formatter: 16b5. クラスが ‘style’ という名前のオ
プションのキーワード引数を受け取ります。このデフォルト値は後方互換性を維
持するために ‘%’ となっていますが、 ‘{’ か ‘$’ を指定することで、*note
str.format(): 833. か *note string.Template: 898. でサポートされているの
と同じ書式化のアプローチを採れます。これは最終的に出力されるログメッセー
ジの書式化に影響を与えますが、個々のログメッセージが構築される方法とは完
全に直交していることに注意してください。

ロギングの呼び出し (*note debug(): 102f, *note info(): 2138. など) はロ
グメッセージのためには位置引数しか取らず、ロギングの呼び出しを処理する方
法を決定するためだけにキーワード引数を指定できます (たとえば ‘exc_info’
キーワード引数はトレースバックの情報をログに含めるかどうかを指定し、
‘extra’ キーワード引数はログに付加する追加のコンテキスト情報を指定します
)。ロギングパッケージは内部で %-format を使って書式文字列に可変長引数を
埋め込んでいるため、 *note str.format(): 833. や *note string.Template:
898. の構文を使って直接ロギングの呼び出しを行うことはできません。既存の
コードにおける全てのロギングの呼び出しは %-format 文字列を使っているため
、後方互換性を維持する限りこの部分が変更されることはないでしょう。

特定のロガーに関連付ける書式スタイルへの提案がなされてきましたが、そのア
プローチは同時に後方互換性の問題にぶち当たります。あらゆる既存のコードは
ロガーの名前を使っているでしょうし、 % 形式書式化を使っているでしょう。

あらゆるサードパーティのライブラリ、あらゆるあなたのコードの間で相互運用
可能なようにロギングを行うには、書式化についての決定は、個々のログ呼び出
しのレベルで行う必要があります。これは受け容れ可能な代替書式化スタイルに
様々な手段の可能性を広げます。

* Menu:

* LogRecord ファクトリを使う::
* カスタムなメッセージオブジェクトを使う::


File: python.info,  Node: LogRecord ファクトリを使う,  Next: カスタムなメッセージオブジェクトを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.1 LogRecord ファクトリを使う
...................................

Python 3.2 において、上述した *note Formatter: 16b5. の変更とともに、
*note setLogRecordFactory(): 3228. 関数を使って *note LogRecord: 11ec. の
サブクラスをユーザに指定することを可能にするロギングパッケージの機能拡張
がありました。これにより、 *note getMessage(): 3226. をオーバライドして
た　だ　し　い　ことをする、あなた自身の手による ‘LogRecord’ のサブクラ
スをセットすることが出来ます。このメソッドの実装は基底クラスでは ‘msg %
args’ 書式化をし、あなたの代替の書式化の置換が出来る場所ですが、他のコー
ドとの相互運用性を保障するために、全ての書式化スタイルをサポートするよう
注意深く行うべきであり、また、%-書式化をデフォルトで認めるべきです。基底
クラスの実装がそうしているように、 ‘str(self.msg)’ 呼び出しもしてくださ
い。

さらに詳しい情報は、リファレンスの *note setLogRecordFactory(): 3228,
*note LogRecord: 11ec. を参照してください。


File: python.info,  Node: カスタムなメッセージオブジェクトを使う,  Prev: LogRecord ファクトリを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.2 カスタムなメッセージオブジェクトを使う
...............................................

あなた独自のログメッセージを構築するのに {}- および $- 書式化を使えるよ
うにするための、もうひとつの、おそらくもっと簡単な方法があります。ロギン
グの際には、あなたはメッセージ書式文字列として、任意のオブジェクトを使え
ることを(*note 任意のオブジェクトをメッセージに使用する: 3225. より)思い
出してみましょう、そしてロギングパッケージはそのオブジェクトに対して実際
の書式文字列を得るために *note str(): 16a. を呼び出すことも。以下 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: 898. でフォーマットする例です:

     >>> __ = 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(): 13cc. によってフィルタを設定 '出来ます' が、どうやっ
てそれを行うのかが初見では明快とは言えないでしょう(そのためのこのレシピ
です)。 *note Filter: 1418. のみが唯一標準ライブラリに含まれているだけで
すし、それは何の要求にも応えてはくれません(ただの基底クラスですから)ので
、典型的には *note filter(): 321f. メソッドをオーバライドした ‘Filter’ の
サブクラスをあなた自身で定義する必要があります。これをするには、設定辞書
内のフィルタ指定部分に、 ‘()’ キーでそのフィルタを作るのに使われる
callable を指定してください(クラスを指定するのが最もわかりやすいですが、
‘Filter’ インスタンスを返却する 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 外部オブジェクトへのアクセス: 3254. に記述され
     ている ‘ext://...’ 形式を使えます。例えば、上記例のように
     ‘MyFilter’ と指定する代わりに、 ‘'ext://__main__.MyFilter'’ と記述
     することが出来ます。

   * フィルタについてとともに、このテクニックは、カスタムハンドラ、カス
     タムフォーマッタに対しても同様に使えます。ロギングが設定において、
     どのようにユーザ定義のオブジェクトをサポートするのかについてのさら
     なる詳細については、 *note ユーザ定義オブジェクト: 3248. と、本クッ
     クブックの上の方のレシピ *note handler を dictConfig()
     を使ってカスタマイズする: 5b1b. を参照してください。


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: 105. モジュールが有用です。


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: 3257. を使います。これにより何か条件を満
たすまでロギングイベントを溜め込むことが出来、条件を満たせば溜め込まれた
イベントが ‘flushed’ として他のハンドラ (‘target’ のハンドラ)に渡されま
す。デフォルトでは、 ‘MemoryHandler’ はそのバッファが一杯になるか、指定
された閾値のレベル以上のイベントが起こるとフラッシュされます。何か特別な
フラッシュの振る舞いをしたければ、このレシピはさらに特殊化した
‘MemoryHandler’ とともに利用出来ます。

スクリプト例では、 ‘foo’ という、単に全てのログレベルについて、
‘sys.stderr’ にもどのレベルを出力したのかについて書き出しながら実際のロ
グ出力も行う、という単純な関数を使っています。 ‘foo’ に真を与えると
ERROR と CRITICAL の出力をし、そうでなければ DEBUG, INFO, WARNING だけを
出力します。

スクリプトが行うことは単に、 ‘foo’ を必要とされている特定の条件でのロギ
ングを行うようにするデコレータで修飾することだけです。このデコレータはパ
ラメータとしてロガーを取り、修飾された関数が呼ばれている間だけメモリハン
ドラをアタッチします。追加のパラメータとして、ターゲットのハンドラ、フラ
ッシュが発生すべきレベル、バッファの容量(バッファされたレコード数)も受け
取れます。これらのデフォルトは順に ‘sys.stderr’ へ書き出す *note
StreamHandler: 1415, ‘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: 32aa. を継承します
。以下の例は、必要に応じて改変することもできますが、 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: 16b5. の代わりに使え
ます。これを設定を通して行いたい場合、 *note dictConfig(): 13cc. 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 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 へのロギング
-------------------------------------------------

Although RFC 5424(1) dates from 2009, most syslog servers are configured
by default to use the older RFC 3164(2), which hails from 2001.  When
‘logging’ was added to Python in 2003, it supported the earlier (and
only existing) protocol at the time.  Since RFC 5424 came out, as there
has not been widespread deployment of it in syslog servers, the *note
SysLogHandler: 86d. functionality has not been updated.

RFC 5424 は構造化データのサポートなど、いくつかの有用な機能を持っていま
す。その機能をサポートする syslog サーバーへのロギングを可能にする必要が
ある場合、以下のような派生ハンドラクラスを使うことで実現することができま
す:

     import datetime as dt
     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 = dt.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(): bf7. の呼び出しが (‘LoggerWriter’ インスタ
ンスで上書きされる '前の' ‘sys.stderr’ を使って) 設定を行います。そして
、以下のような結果を得るでしょう:

     >>> print('Foo')
     INFO:demo:Foo
     >>> print('Bar', file=sys.stderr)
     WARNING:demo:Bar
     >>>

言うまでもなく上記の例は *note basicConfig(): bf7. で使われている書式に
もとづく出力を示していますが、ロギングの設定で異なるフォーマッタを使うこ
とができます。

上記の例では、バッファリングや奪取した書き込み呼び出しのシーケンスの扱い
についてはなすがままになっています。たとえば、上記の ‘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
複数のプロセスからの単一ファイルへのログ記録: 5b06. で紹介したテクニック
を使用してください。


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:
14a0. インスタンス以外のロガーを追加してはいけない、ということを意味しま
す。


File: python.info,  Node: 大量のロガーを作成する,  Prev: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する,  Up: 避けるべきパターン

9.9.37.4 大量のロガーを作成する
...............................

ロガーはシングルトンであり、スクリプトの実行中に解放されることがないため
、大量のロガーを作成すると、メモリが解放されることなく消費されます。ファ
イルの処理単位やネットワーク接続単位でロガーを作るのではなく、 *note
既存のメカニズム: 322c. を使ってコンテキスト依存の情報をログに渡し、ロガ
ーはアプリケーション内の説明の単位（通常はモジュールだが、場合によっては
それよりも小さい可能性もある）で作るように制限してください。


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 基本チュートリアル: 1412.

*note 上級チュートリアル: 1413.


File: python.info,  Node: Regular expression HOWTO,  Next: ソケットプログラミング HOWTO,  Prev: Logging クックブック,  Up: Python HOWTO

9.10 Regular expression HOWTO
=============================


Author: A.M. Kuchling <<amk@amk.ca>>

概要
....

このドキュメントは *note re: be. モジュールを使って Python で正規表現を
扱うための導入のチュートリアルです。ライブラリレファレンスの正規表現の節
よりもやさしい入門ドキュメントを用意しています。

* Menu:

* はじめに: はじめに<16>.
* Simple patterns::
* Using regular expressions::
* More pattern power::
* Modifying strings::
* Common problems::
* フィードバック::


File: python.info,  Node: はじめに<16>,  Next: Simple patterns,  Up: Regular expression HOWTO

9.10.1 はじめに
---------------

正規表現 regular expressions (REs や regexes または regex patterns と呼
ばれます) は本質的に小さく、Python 内部に埋め込まれた高度に特化したプロ
グラミング言語で *note re: be. モジュールから利用可能です。この小さな言
語を利用することで、マッチさせたい文字列に適合するような文字列の集合を指
定することができます; この集合は英文や e-mail アドレスや TeX コマンドな
ど、どんなものでも構いません。「この文字列は指定したパターンにマッチしま
すか?」「このパターンはこの文字列のどの部分にマッチするのですか?」といっ
たことを問い合わせることができます。正規表現を使って文字列を変更したりい
ろいろな方法で別々の部分に分割したりすることもできます。

正規表現パターンは一連のバイトコードとしてコンパイルされ、C で書かれたマ
ッチングエンジンによって実行されます。より進んだ利用法では、エンジンがど
う与えられた正規表現を実行するかに注意することが必要になり、高速に実行で
きるバイトコードを生成するように正規表現を書くことになります。このドキュ
メントでは最適化までは扱いません、それにはマッチングエンジンの内部に対す
る十分な理解が必要だからです。

正規表現言語は相対的に小さく、制限されています、そのため正規表現を使って
あらゆる文字列処理作業を行なえるわけではありません。正規表現を使って行う
ことのできる作業もあります、ただ表現はとても複雑なものになります。それら
の場合では、Python コードを書いた方がいいでしょう; Python コードは念入り
に作られた正規表現より遅くなりますが、おそらくより読み易いでしょう。


File: python.info,  Node: Simple patterns,  Next: Using regular expressions,  Prev: はじめに<16>,  Up: Regular expression HOWTO

9.10.2 Simple patterns
----------------------

まずはできるだけ簡単な正規表現を学ぶことから始めてみましょう。正規表現は
文字列の操作に使われるので、ますは最も一般的な作業である文字のマッチング
をしてみます。

正規表現の基礎を成す計算機科学 (決定、非決定有限オートマトン) の詳細な説
明については, コンパイラ作成に関するテキストブックをどれでもいいので参照
して下さい。

* Menu:

* Matching characters::
* Repeating things::


File: python.info,  Node: Matching characters,  Next: Repeating things,  Up: Simple patterns

9.10.2.1 Matching characters
............................

多くの活字や文字は単純にそれ自身とマッチします。例えば、 ‘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: 10c. モジュールで提
供されている Unicode データベースで letters としてマークされている全ての
文字とマッチします。正規表現のコンパイル時に *note re.ASCII: 83e. フラグ
を与えることにより、 ‘\w’ を、より制限された定義で使うことが出来ます。

以下に続く特別な文字列のリストは完全ではありません。特殊シーケンスと拡張
クラスについてのユニコードパターンの定義についての完全なリストは、標準ラ
イブラリリファレンスの *note 正規表現の構文: 932. の最後のパートを参照し
てください。一般的にユニコードバージョンは、ユニコードデータベース内で相
応しいカテゴリに属すればマッチします。

‘\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:
27db.) があります。 ‘.’ は「任意の文字」にマッチさせたい場合に利用されま
す。


File: python.info,  Node: Repeating things,  Prev: Matching characters,  Up: Simple patterns

9.10.2.2 Repeating things
.........................

さまざまな文字集合をマッチさせることは正規表現で最初にできるようになるこ
とで、これは文字列に対するメソッドですぐにできることではありません。しか
し、正規表現がより力を発揮する場面がこれだけだとすると、正規表現はあまり
先進的とはいえません。正規表現の力をもう一つの能力は、正規表現の一部が何
度も繰り返されるようものを指定できることです。

最初にとりあげる繰り返しのための最初の特殊文字は ‘*’ です。 ‘*’ は文字リ
テラル ‘'*'’ とはマッチしません; その代わりに、前の文字がぴったり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’ のみにマッチするよ
                           うに再び戻る。
                           
                           
7          ‘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: Using regular expressions,  Next: More pattern power,  Prev: Simple patterns,  Up: Regular expression HOWTO

9.10.3 Using regular expressions
--------------------------------

これまででいくつかの単純な正規表現に触れてきました、実際に Python ではこ
れらをどう使えばいいのでしょう?  *note re: be. モジュールは正規表現エン
ジンに対するインターフェースを提供していて、それらを使うことで正規表現を
オブジェクトにコンパイルし、マッチを実行することができます。

* Menu:

* Compiling regular expressions::
* The backslash plague::
* Performing matches::
* Module-level functions: Module-level functions<2>.
* Compilation flags::


File: python.info,  Node: Compiling regular expressions,  Next: The backslash plague,  Up: Using regular expressions

9.10.3.1 Compiling regular expressions
......................................

正規表現はパターンオブジェクトにコンパイルされます、パターンオブジェクト
は多くの操作、パターンマッチの検索や文字列の置換の実行などのメソッドを持
っています。

     >>> import re
     >>> p = re.compile('ab*')
     >>> p
     re.compile('ab*')

*note re.compile(): dd2. はいくつかの 'flags' 引数を受け付けることができ
ます、この引数はさまざまな特別な機能を有効にしたり、構文を変化させたりし
ます。利用できる設定に何があるかは後に飛ばすことにして、簡単な例をやるこ
とにしましょう:

     >>> p = re.compile('ab*', re.IGNORECASE)

正規表現は文字列として *note re.compile(): dd2. に渡されます。正規表現は
文字列として扱われますが、それは正規表現が Python 言語のコアシステムに含
まれないためです、そのため正規表現を表わす特殊な構文はありません。 (正規
表現を全く必要としないアプリケーションも存在します、そのためそれらを含め
て言語仕様を無駄に大きくする必要はありません) その代わり、 *note re: be.
モジュールは *note socket: d1. や *note zlib: 13a. モジュールのような通
常の C 拡張モジュールとして Python に含まれています。

正規表現を文字列としておくことで Python 言語はより簡素に保たれていますが
、そのため1つの欠点があります、これについては次の節で話題とします。


File: python.info,  Node: The backslash plague,  Next: Performing matches,  Prev: Compiling regular expressions,  Up: Using regular expressions

9.10.3.2 The backslash plague
.............................

先に述べたように、正規表現は特別な形式や特殊な文字の特別な意味を意味を除
くことを示すためにバックスラッシュ文字 (‘'\'’) を利用します。これは
Python が文字列リテラルに対して、同じ文字を同じ目的で使うことと衝突しま
す。

‘\section’ という文字列 (これは LaTeX ファイルでみかけます) にマッチする
正規表現を書きたいとします。どんなプログラムを書くか考え、マッチして欲し
い文字列をはじめに考えます。次に、バックスラッシュや他の特殊文字をバック
スラッシュに続けて書くことでエスケープしなければいけません、その結果
‘\\section’ のような文字列となります。こうしてできた *note re.compile():
dd2. に渡す文字列は ‘\\section’ でなければいけません。しかし、これを
Python の文字列リテラルとして扱うにはこの二つのバックスラッシュを '再び'
エスケープする必要があります。

文字                    段階
                        
-----------------------------------------------------------------------
                        
‘\section’              マッチさせるテキスト
                        
                        
‘\\section’             *note re.compile(): dd2. のためのバックスラ
                        ッシュエスケープ
                        
                        
‘"\\\\section"’         文字列リテラルのためのバックスラッシュエスケ
                        ープ
                        

要点だけをいえば、リテラルとしてのバックスラッシュにマッチさせるために、
正規表現文字列として ‘'\\\\'’ と書かなければいけません、なぜなら正規表現
は ‘\\’ であり、通常の Python の文字列リテラルとしてはそれぞれのバックス
ラッシュは ‘\\’ で表現しなければいけないからです。正規表現に関してこのバ
ックスラッシュの繰り返しの機能は、たくさんのバックスラッシュの繰り返しを
生むことになり、その結果として作られる文字列は理解することが難しくなりま
す。

この問題の解決策としては正規表現に対しては Python の raw string 記法を使
うことです; ‘'r'’ を文字列リテラルの先頭に書くことでバックスラッシュは特
別扱いされなくなります、つまり ‘"\n"’ は改行を含む1つの文字からなる文字
列であるのに対して、 ‘r"\n"’ は2つの文字 ‘'\'’ と ‘'n'’ を含む文字列とな
ります。多くの場合 Python コードの中の正規表現はこの raw string 記法を使
って書かれます。

In addition, special escape sequences that are valid in regular
expressions, but not valid as Python string literals, now result in a
*note SyntaxWarning: 1af. and will eventually become a *note
SyntaxError: 18f, which means the sequences will be invalid if raw
string notation or escaping the backslashes isn't used.

通常の文字列            Raw string
                        
-----------------------------------------------
                        
‘"ab*"’                 ‘r"ab*"’
                        
                        
‘"\\\\section"’         ‘r"\\section"’
                        
                        
‘"\\w+\\s+\\1"’         ‘r"\w+\s+\1"’
                        


File: python.info,  Node: Performing matches,  Next: Module-level functions<2>,  Prev: The backslash plague,  Up: Using regular expressions

9.10.3.3 Performing matches
...........................

一旦コンパイルした正規表現を表現するオブジェクトを作成したら、次に何をし
ますか?  パターンオブジェクトはいくつかのメソッドや属性を持っています。
ここでは、その中でも最も重要なものについて扱います; 完全なリストは *note
re: be. ドキュメントを参照して下さい。

メソッド/属性          目的
                       
---------------------------------------------------------------------------
                       
‘match()’              Determine if the RE matches at the beginning of
                       the string.
                       
                       
‘search()’             文字列を先頭から走査して、正規表現がどこにマッチ
                       するか調べます。
                       
                       
‘findall()’            Find all substrings where the RE matches, and
                       return them as a list.
                       
                       
‘finditer()’           Find all substrings where the RE matches, and
                       return them as an *note iterator: 4c8.
                       

*note match(): 27ec. and *note search(): 27ed. return ‘None’ if no match
can be found.  If they're successful, a *note match object: 118e.
instance is returned, containing information about the match: where it
starts and ends, the substring it matched, and more.

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]+')

Now, you can try matching various strings against the RE ‘[a-z]+’.  An
empty string shouldn't match at all, since ‘+’ means 'one or more
repetitions'.  *note match(): 27ec. should return ‘None’ in this case,
which will cause the interpreter to print no output.  You can explicitly
print the result of ‘match()’ to make this clear.

     >>> p.match("")
     >>> print(p.match(""))
     None

Now, let's try it on a string that it should match, such as ‘tempo’.  In
this case, *note match(): 27ec. will return a *note match object: 118e,
so you should store the result in a variable for later use.

     >>> m = p.match('tempo')
     >>> m
     <re.Match object; span=(0, 5), match='tempo'>

これでマッチした文字列についての情報を *note Match オブジェクト: 118e. に
問い合わせることが出来ます。 Match オブジェクトインスタンスはいくつかの
メソッドと属性も持っていて、最も重要なのは次のものです:

メソッド/属性          目的
                       
------------------------------------------------------------------------
                       
‘group()’              正規表現にマッチした文字列を返す
                       
                       
‘start()’              マッチの開始位置を返す
                       
                       
‘end()’                マッチの終了位置を返す
                       
                       
‘span()’               マッチの位置 (start, end) を含むタプルを返す
                       

これらのメソッドを試せば、その意味はすぐに理解できます:

     >>> m.group()
     'tempo'
     >>> m.start(), m.end()
     (0, 5)
     >>> m.span()
     (0, 5)

*note group(): 1230. returns the substring that was matched by the RE.
*note start(): 27ff. and *note end(): 2800. return the starting and
ending index of the match.  *note span(): 2801. returns both start and
end indexes in a single tuple.  Since the *note match(): 27ec. method
only checks if the RE matches at the start of a string, ‘start()’ will
always be zero.  However, the *note search(): 27ed. method of patterns
scans through the string, so the match may not start at zero in that
case.

     >>> 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 オブジェクト: 118e. を変数に記憶してお
き, その次に ‘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(): 27f3. はマッチした文字列のリストを返しま
す:

     >>> p = re.compile(r'\d+')
     >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')
     ['12', '11', '10']

The ‘r’ prefix, making the literal a raw string literal, is needed in
this example because escape sequences in a normal "cooked" string
literal that are not recognized by Python, as opposed to regular
expressions, now result in a *note SyntaxWarning: 1af. and will
eventually become a *note SyntaxError: 18f.  See *note The backslash
plague: 5b45.

*note findall(): 27f3. は結果を返す前に完全なリストを必ず生成してしまい
ます。いっぽう *note finditer(): 27f4. メソッドは *note
マッチオブジェクト: 118e. インスタンスのシーケンスを *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: Module-level functions<2>,  Next: Compilation flags,  Prev: Performing matches,  Up: Using regular expressions

9.10.3.4 Module-level functions
...............................

You don't have to create a pattern object and call its methods; the
*note re: be. module also provides top-level functions called *note
match(): 1449, *note search(): 1448, *note findall(): 122f, *note sub():
5a3, and so forth.  These functions take the same arguments as the
corresponding pattern method with the RE string added as the first
argument, and still return either ‘None’ or a *note match object: 118e.
instance.

     >>> 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: Compilation flags,  Prev: Module-level functions<2>,  Up: Using regular expressions

9.10.3.5 Compilation flags
..........................

コンパイルフラグは正規表現の動作をいくつかの側面から変更します。フラグは
*note re: be. モジュール下で二つの名前で利用することができます、例えば長
い名前は *note IGNORECASE: 1af7. で短い名前は1文字で *note I: 27de. のよ
うになっています。 (1文字形式は Perl のパターン修飾子と同じ形式を使いま
す; 例えば *note re.VERBOSE: 27ea. の短かい形式は *note re.X: 27e3. です
。) 複数のフラグが OR ビット演算で指定することができます; 例えば ‘re.I |
re.M’ は ‘I’ と *note M: 27e0. フラグの両方を設定します。

ここに利用可能なフラグの表があります、それぞれについてのより詳細な説明が
後に続きます。

Flag                                  意味
                                      
---------------------------------------------------------------------------------------
                                      
*note ASCII: 83e, *note A: 27dd.      ‘\w’, ‘\b’, ‘\s’, そして ‘\d’ などをそれぞれの
                                      プロパティをもつ ASCII 文字だけにマッチさせま
                                      す。
                                      
                                      
*note DOTALL: 27db, *note S: 27e1.    ‘.’ を改行を含む任意の文字にマッチするようにし
                                      ます。
                                      
                                      
*note IGNORECASE: 1af7,               大文字小文字を区別しないマッチを行います。
*note I: 27de.                        

*note LOCALE: d67, *note L: 27df.     ロケールに対応したマッチを行います。
                                      
                                      
*note MULTILINE: 27dc,                ‘^’ や ‘$’ の意味を変更し、複数行文字列に対す
*note M: 27e0.                        るマッチングを行います。
                                      
                                      
*note VERBOSE: 27ea, *note X: 27e3.   冗長な正規表現を利用できるようにして、よりきれ
('X' は 'extended' の 'X')            いで理解しやすくまとめることができます。
                                      

 -- データ: re.I

 -- データ: re.IGNORECASE

     大文字と小文字を区別しないマッチングを実行します; 文字クラスと文字
     列リテラルは大文字か小文字かに関係なくパターンにマッチします。例え
     ば、 ‘[A-Z]’ は小文字のアルファベットにもマッチします。 *note
     ASCII: 83e. フラグによって非 ASCII 文字のマッチングが無効化されてい
     なければ、完全なユニコードのマッチングも可能です。ユニコードで
     ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1af7. フラグとともに使
     われると、 52個の ASCII 文字に加えて 次の4つの 非 ASCII 文字にマッ
     チします: 'İ' (U+0130, ラテン語の大文字 I で、上部に点がついたもの
     ), 'ı' (U+0131, ラテン語の小文字 i で上部に点がない), 'ſ' (U+017F,
     ラテン語の小文字 s), 'K' (U+212A, ケルビン記号)。 ‘Spam’ は
     ‘'Spam'’, ‘'spam'’, ‘'spAM'’, そして ‘'ſpam'’ にマッチします (ただ
     し最後の文字列はユニコードモードの場合のみマッチします)。この「小文
     字化」は現在のロケールを考慮しません; ただし *note LOCALE: d67. フ
     ラグをセットした場合はロケールを考慮します。

 -- データ: re.L

 -- データ: re.LOCALE

     ‘\w’, ‘\W’, ‘\b’, ‘\B’ と小文字大文字の区別を無視したマッチングを、
     Unicode データベースではなく現在のロケールに従って行います。

     ロケールは言語の違いを考慮したプログラムを書くことを手助けすること
     を目的とした C ライブラリの機能です。例えば、エンコードされたフラン
     ス語のテキストを処理していて、‘\w+’ を使って単語のマッチを行いたい
     とします。ですがこの場合、 ‘\w’ はバイトパターンにおいて文字クラス
     ‘[A-Za-z]’ だけにマッチします; すなわち ‘é’ や ‘ç’ に対応するバイト
     列にはマッチしません。もしシステムが適切に設定されていて、ロケール
     がフランス語に設定されていれば、ある C 関数はプログラムに ‘é’ に対
     応するバイト列も文字として考慮するべきであると伝えます。正規表現を
     コンパイルするときに *note LOCALE: d67. フラグを設定すると、コンパ
     イルされたオブジェクトが ‘\w’ に対してロケールを考慮する C 関数を使
     うようになります; これにより処理は遅くなりますが、 ‘\w+’ を期待通り
     フランス語の単語にマッチさせることが可能になります。このフラグを
     Python 3 で利用することは推奨されません。なぜならロケールの仕組みは
     非常に信頼性が低く、同時にひとつの "文化" しか扱うことができず、ま
     た8ビットのロケールでしか正しく動作しないからです。Python 3 ではユ
     ニコード (文字列の) パターンに対してユニコードのマッチングがデフォ
     ルトで有効化されており、これにより異なるロケールまたは言語を同時に
     扱うことができます。

 -- データ: re.M

 -- データ: re.MULTILINE

     (‘^’ と ‘$’ についてはまだ説明していません; これらは *note More
     metacharacters: 5b49. の節で説明します。)

     通常 ‘^’ は文字列の先頭にマッチし、 ‘$’ は文字列の末尾と文字列の末
     尾に改行(があれば)その直前にマッチします。このフラグが指定されると
     、 ‘^’ は文字列の先頭と文字列の中の改行に続く各行の先頭にマッチしま
     す。同様に ‘$’ 特殊文字は文字列の末尾と各行の末尾(各改行の直前)のど
     ちらにもマッチします。

 -- データ: re.S

 -- データ: re.DOTALL

     特別な文字 ‘'.'’ を改行を含む全ての任意の文字とマッチするようにしま
     す; このフラグが無しでは、 ‘'.'’ は改行 '以外' の全てにマッチします
     。

 -- データ: re.A

 -- データ: re.ASCII

     ‘\w’, ‘\W’, ‘\b’, ‘\B’, ‘\s’, ‘\S’ が、完全な Unicode マッチングで
     はなく、ASCII のみのマッチングをするようにします。これは Unicode パ
     ターンにのみ意味があり、byte パターンには無視されます。

 -- データ: re.X

 -- データ: re.VERBOSE

     This flag allows you to write regular expressions that are more
     readable by granting you more flexibility in how you can format
     them.  When this flag has been specified, whitespace within the RE
     string is ignored, except when the whitespace is in a character
     class or preceded by an unescaped backslash; this lets you organize
     and indent the RE more clearly.  This flag also lets you put
     comments within a RE that will be ignored by the engine; comments
     are marked by a ‘'#'’ that's neither in a character class nor
     preceded by an unescaped backslash.

     例えば、ここに *note re.VERBOSE: 27ea. を利用した正規表現があります
     ; 読み易いと思いませんか?

          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: 27ea. を使った場
     合に比べるとまだ難しくなっています。


File: python.info,  Node: More pattern power,  Next: Modifying strings,  Prev: Using regular expressions,  Up: Regular expression HOWTO

9.10.4 More pattern power
-------------------------

ここまでで、正規表現の機能のほんの一部を扱ってきました。この節では、新た
にいくつかの特殊文字とグループを使ってマッチしたテキストの一部をどう取得
するかについて扱います。

* Menu:

* More metacharacters::
* グルーピング::
* Non-capturing and named groups::
* Lookahead assertions::


File: python.info,  Node: More metacharacters,  Next: グルーピング,  Up: More pattern power

9.10.4.1 More metacharacters
............................

これまでで、まだ扱っていない特殊文字がいくつかありました。そのほとんどを
この節で扱っていきます。

残りの特殊文字の内いくつかは 'ゼロ幅アサーション zero-width-assertions'
に関するものです。これらは文字列に対してエンジンを進めません; 文字列を全
く利用しない代わりに、単純に成功か失敗かを利用します。例えば、 ‘\b’ は現
在位置が単語の境界であることを示します; ‘\b’ によってエンジンの読んでい
る位置は全く変化しません。つまり、これはゼロ幅アサーションは繰り返し使う
ことがありません、一度ある位置でマッチしたら、明らかに無限回マッチできま
す。

‘|’

     代替 (alternation) または "or" 演算子です。 'A' と 'B' が正規表現の
     場合、 ‘A|B’ は 'A' と 'B' のどちらかにマッチするような文字列にマッ
     チします。複数の文字からなる文字列による代替処理が適切に動作するた
     めに、 ‘|’ の優先度は非常に低く設定されています。 ‘Crow|Servo’ は
     ‘'Crow'’ か ‘'Servo'’ のどちらかにマッチするパターンであり、 「
     ‘'Cro'’ に続いて ‘'w'’ または ‘'S'’ があり、さらに ‘'ervo'’ が続く
     」という意味ではありません。

     リテラル ‘'|'’ にマッチするには、 ‘\|’ を利用するか、 ‘[|]’ のよう
     に文字クラス内に収めて下さい。

‘^’

     行の先頭にマッチします。 *note MULTILINE: 27dc. フラグが設定されな
     い場合には、文字列の先頭にのみマッチします。 ‘MULTILINE’ モードでは
     文字列内の各改行の直後にマッチします。

     例えば、行の先頭の ‘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: 27dc. モードでな
     い場合には ‘\A’ と ‘^’ は実質的に同じです。 ‘MULTILINE’ モードでの
     これらの違いは: ‘\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: Non-capturing and named groups,  Prev: More metacharacters,  Up: More pattern power

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(): 1230, *note start(): 27ff, *note end():
2800, *note span(): 2801. に引数を与えて取り出せます。グループはゼロ始ま
りの数値です。グループ 0 は常に使えます; それは RE でマッチした全体で、
*note Match オブジェクト: 118e. メソッドの全てはグループ 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(): 1230. には一回に複数の引数を渡してもかまいません、その場
合にはそれらのグループに対応する値を含むタプルを返します。

     >>> m.group(2,1,2)
     ('b', 'abc', 'b')

*note groups(): 1231. メソッドは 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: Non-capturing and named groups,  Next: Lookahead assertions,  Prev: グルーピング,  Up: More pattern power

9.10.4.3 Non-capturing and named groups
.......................................

念入りに作られた正規表現は多くのグループを利用します、その利用法には対象
となる部分文字列を取り出す、正規表現自身をグループ化したり構造化する、と
いう二つの方法があります。複雑な正規表現では、グループ番号を追っていくこ
とは困難になっていきます。この問題の解決を助ける二つの機能があります。そ
の両方が正規表現を拡張するための一般的な構文を利用します、まずはそれらを
みてみましょう。

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 オブジェクト: 118e. の取りこむグループを扱うメソッドは全て、
番号によるグループ参照のための整数、名前によるグループ参照のための文字列
、ともに許容しています。名前つきグループにも番号が振られますので、グルー
プについての情報を、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(): 27fe. を使って辞書として
取り出すこともできます:

     >>> 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: Non-capturing and named groups,  Up: More pattern power

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: Modifying strings,  Next: Common problems,  Prev: More pattern power,  Up: Regular expression HOWTO

9.10.5 Modifying strings
------------------------

ここまででは単純に静的な文字列に対する検索を実行してきました。正規表現は
文字列を様々な方法で変更するのにもよく使われます。変更には以下のパターン
メソッドが利用されます:

メソッド/属性          目的
                       
---------------------------------------------------------------------------
                       
‘split()’              文字列をリストに分割する、正規表現がマッチした全
                       ての場所で分割を行う
                       
                       
‘sub()’                正規表現にマッチした全ての文字列を発見し、別の文
                       字列に置き換えます
                       
                       
‘subn()’               ‘sub()’ と同じことをしますが、新しい文字列と置き
                       換えの回数を返します
                       

* Menu:

* Splitting strings::
* Search and replace::


File: python.info,  Node: Splitting strings,  Next: Search and replace,  Up: Modifying strings

9.10.5.1 Splitting strings
..........................

‘split()’ メソッドは文字列を正規表現にマッチした場所で分割し、リストで返
却します。文字列の *note split(): 10ae. メソッドに似てはいますが、もっと
ずっと一般化したデリミタで分割出来ます; 文字列の ‘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: Search and replace,  Prev: Splitting strings,  Up: Modifying strings

9.10.5.2 Search and replace
...........................

もう一つのよくある作業は、パターンにマッチする全ての文字列を探し、異なる
文字列に置換します。 *note sub(): 27f5. メソッドは置換する値をとります、
文字列と関数の両方をとることができ、文字列を処理します。

 -- メソッド: .sub (replacement, string[, count=0])

     'string' 内で最も長く、他の部分と重複するところがない正規表現を
     'replacement' に置換した文字列を返します。パターンが見つからなかっ
     た場合 'string' は変更されずに返されます。

     オプション引数 'count' はパターンの出現の最大置換回数です; 'count'
     は非負の整数でなければいけません。デフォルト値 0 は全ての出現で置換
     することを意味します。

ここに *note sub(): 27f5. メソッドを使った単純な例があります。これは色の
名前を ‘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(): 27f6. メソッドも同じ働きをしますが、新しい文字列と置換の実
行回数を含む 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 オブジェクト: 118e. が引数として渡されるので、望みの置換と返
却のためにこの情報を利用出来ます。

続く例では、置換関数は十進数文字列を十六進数文字列に変換しています:

     >>> 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: Common problems,  Next: フィードバック,  Prev: Modifying strings,  Up: Regular expression HOWTO

9.10.6 Common problems
----------------------

正規表現はいくつかの応用に対して強力なツールですが、いくつかの部分でそれ
らの振る舞いは直感的ではなく、期待通りに振る舞わないことがあります。この
節では最もよくある落とし穴を指摘します。

* Menu:

* Use string methods::
* match() versus search(): match versus search.
* Greedy versus non-greedy::
* re.VERBOSE の利用: re VERBOSE の利用.


File: python.info,  Node: Use string methods,  Next: match versus search,  Up: Common problems

9.10.6.1 Use string methods
...........................

いくつかの場合 *note re: be. モジュールを利用することは間違いである場合
があります。固定文字列や単一の文字クラスにマッチさせる場合や、 *note
IGNORECASE: 1af7. フラグのような ‘re’ の機能を利用しない場合、正規表現の
全ての能力は必要とされていなでしょう。文字列は固定文字列に対する操作を実
行するメソッドを持っていて、大きな汎用化された正規表現エンジンではなく、
目的のために最適化された単一の小さな 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(): 26a6. は削除と置換の両方の作業をこ
なし、正規表現操作よりも高速に行うことができます。

要は、 *note re: be. モジュールに向う前に問題が高速で単純な文字列メソッ
ドで解決できるか考えましょうということです。


File: python.info,  Node: match versus search,  Next: Greedy versus non-greedy,  Prev: Use string methods,  Up: Common problems

9.10.6.2 match() versus search()
................................

The *note match(): 1449. function only checks if the RE matches at the
beginning of the string while *note search(): 1448. will scan forward
through the string for a match.  It's important to keep this distinction
in mind.  Remember, ‘match()’ will only report a successful match which
will start at 0; if the match wouldn't start at zero, ‘match()’ will
'not' report it.

     >>> print(re.match('super', 'superstition').span())
     (0, 5)
     >>> print(re.match('super', 'insuperable'))
     None

On the other hand, *note search(): 1448. will scan forward through the
string, reporting the first match it finds.

     >>> print(re.search('super', 'superstition').span())
     (0, 5)
     >>> print(re.search('super', 'insuperable').span())
     (2, 7)

Sometimes you'll be tempted to keep using *note re.match(): 1449, and
just add ‘.*’ to the front of your RE. Resist this temptation and use
*note re.search(): 1448. instead.  The regular expression compiler does
some analysis of REs in order to speed up the process of looking for a
match.  One such analysis figures out what the first character of a
match must be; for example, a pattern starting with ‘Crow’ must match
starting with a ‘'C'’.  The analysis lets the engine quickly scan
through the string looking for the starting character, only trying the
full match if a ‘'C'’ is found.

Adding ‘.*’ defeats this optimization, requiring scanning to the end of
the string and then backtracking to find a match for the rest of the RE.
Use *note re.search(): 1448. instead.


File: python.info,  Node: Greedy versus non-greedy,  Next: re VERBOSE の利用,  Prev: match versus search,  Up: Common problems

9.10.6.3 Greedy versus 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 versus non-greedy,  Up: Common problems

9.10.6.4 re.VERBOSE の利用
..........................

ここまでで、正規表現がとても簡潔な表記であることに気づいたでしょう、また
、正規表現は読みやすいものでもないということにも気づいたことでしょう。そ
こそこに入り組んだ正規表現ははバックスラッシュ、括弧、特殊文字が長く続い
て、読みにくく、理解しづらいものになります。

そのような正規表現に対しては、正規表現をコンパイルする時に *note
re.VERBOSE: 27ea. フラグを指定することが助けになります。なぜなら、より明
確な書式で正規表現を書けるからです。

‘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: Common problems,  Up: Regular expression HOWTO

9.10.7 フィードバック
---------------------

Regular expressions are a complicated topic.  Did this document help you
understand them?  Were there parts that were unclear, or problems you
encountered that weren't covered here?  If so, please send suggestions
for improvements to the *note issue tracker: 557.

O'Reilly から出版されている Jeffrey Friedl の Mastering Regular
Expressions は正規表現に関するほぼ完璧な書籍です (訳注　日本語訳「詳説　
正規表現」が出版されています) 。不幸なことに、この本は Perl と Java の正
規表現を集中して扱っていて、 Python の正規表現については全く扱っていませ
ん、そのため Python プログラミングのためのレファレンスとして使うことはで
きません。 (第一版はいまや削除された Python の ‘regex’ モジュールについ
て扱っていましたが、これはあまり役に立たないでしょう。) 図書館で調べるの
を検討してみましょう。


File: python.info,  Node: ソケットプログラミング HOWTO,  Next: ソートのテクニック,  Prev: Regular expression HOWTO,  Up: Python HOWTO

9.11 ソケットプログラミング HOWTO
=================================


Author: 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 ソートのテクニック
=======================


Author: Andrew Dalke and Raymond Hettinger

Python のリストにはリストをインプレースに変更する、組み込みメソッド
*note list.sort(): dcc. があります。他にもイテラブルからソートしたリスト
を作成する組み込み関数 *note sorted(): dcb. があります。

このドキュメントでは 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(): dcb. 関数を呼ぶだけ
です。そうすれば、新たにソートされたリストが返されます:

     >>> sorted([5, 2, 3, 1, 4])
     [1, 2, 3, 4, 5]

*note list.sort(): dcc. メソッドを呼びだしても同じことができます。この方
法はリストをインプレースに変更します (そして sorted との混乱を避けるため
‘None’ を返します)。多くの場合、こちらの方法は *note sorted(): dcb. と比
べると不便です - ただし、元々のリストが不要な場合には、わずかですがより
効率的です。

     >>> a = [5, 2, 3, 1, 4]
     >>> a.sort()
     >>> a
     [1, 2, 3, 4, 5]

違いは他にもあります、 *note list.sort(): dcc. メソッドはリストにのみ定
義されています。一方 *note sorted(): dcb. 関数は任意のイテラブルを受け付
けます。

     >>> 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(): dcc. method and the functions *note sorted():
dcb, *note min(): 110f, *note max(): 1110, *note heapq.nsmallest():
2a1c, and *note heapq.nlargest(): 2a1b. 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(): fda.:

     >>> 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: 100a. パターンは非常に一般的なので、
Python はアクセサ関数を簡単に速く作れる便利な関数を提供しています。*note
operator: a3. モジュールに *note itemgetter(): c5b.、*note attrgetter():
1037.、および *note methodcaller(): 1038. 関数があります。

これらの関数を利用すると、上の例はもっと簡単で高速になります:

     >>> 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(): 219. 関数は複数引数の関数の アリティ(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(): dcc. と *note sorted(): dcb. の両方とも '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():
4373. は比較関数です。

このような場合に対処するため、Python は比較関数をラップしてキー関数とし
て使えるようにする関数 *note functools.cmp_to_key: 13f6. を提供していま
す。

     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: 199.

   * 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:
199.

   * 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(): 1828. を使うか、比較関数に *note
     locale.strcoll(): 4373. を使ってください。これが必要なのは、同じア
     ルファベットを使っていたとしても、文化が違えば "アルファベット順" の
     意味するものが変わることがあるからです。

   * 'reverse' パラメータはソートの安定性を保ちます (ですから、レコード
     のキーが等しい場合元々の順序が維持されます)。面白いことにこの影響は
     パラメータ無しで *note reversed(): a69. 関数を二回使うことで模倣す
     ることができます:

          >>> 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__():
     14bc. メソッドを定義することで達成できます。

          >>> Student.__lt__ = lambda self, other: self.age < other.age
          >>> sorted(student_objects)
          [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

     ただし、‘<’ は *note __lt__(): 14bc. が実装されていなければ *note
     __gt__(): 1527. を使って代替することに注意してください (この技法に
     ついて詳しくは *note object.__lt__(): 14bc. を参照してください)。驚
     きを防ぐため、 PEP 8(1) は6つの比較メソッドを全て実装することを推奨
     しています。この作業を簡単にするため、*note total_ordering(): 1148.
     デコレータが提供されています。

   * 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(): 110f. と *note max(): 1110. はそれぞれ最小値と最大値を
     返します。これらの関数は入力データを一度だけ通過し、補助的なメモリ
     をほとんど要求しません。

   * *note heapq.nsmallest(): 2a1c. と *note heapq.nlargest(): 2a1b. は
     それぞれ最小と最大の値 'n' 個を返します。これらの関数はデータを一度
     だけ通過し、一度に 'n' 要素だけを記憶します。入力の数に対して小さい
     'n' の値では、これらの関数は完全なソートより比較の回数がはるかに少
     なくなります。

   * *note heapq.heappush(): 16da. と *note heapq.heappop(): 16db. は最
     小の要素がつねに位置 ‘0’ になる、部分的にソートされたデータの配列を
     作り維持します。これらの関数はタスクスケジューリングに一般的に使わ
     れる優先度キューを実装するのに適しています。


File: python.info,  Node: Unicode HOWTO,  Next: urllib パッケージを使ってインターネット上のリソースを取得するには,  Prev: ソートのテクニック,  Up: Python HOWTO

9.13 Unicode HOWTO
==================


Release: 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: 16a. 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: 193. クラスの *note decode(): ad7. メソッドを使っ
て文字列を作ることもできます。このメソッドは ‘UTF-8’ のような値を
'encoding' 引数に取り、オプションで 'errors' 引数を取ります。

'errors' 引数は、入力文字列に対しエンコーディングルールに従った変換がで
きなかったときの対応方法を指定します。この引数に使える値は ‘'strict'’
(*note UnicodeDecodeError: c0c. を送出する)、 ‘'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 標準エンコーディング: fbc. を参照
してください。いくつかのエンコーディングは複数の名前を持っています; 例え
ば、 ‘'latin-1'’ と ‘'iso_8859_1'’ と ‘'8859'’ は全て同じエンコーディン
グの別名です。

Unicode 文字列の一つの文字は *note chr(): 1a4e. 組み込み関数で作成するこ
とができます、この関数は整数を引数にとり、対応するコードポイントを含む長
さ1の Unicode 文字列を返します。逆の操作は *note ord(): 2397. 組み込み関
数です、この関数は一文字の 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(): ad7. とは処理が逆向きのメソッドが *note
str.encode(): ad6. です。このメソッドは、 Unicode 文字列を指定された
'encoding' でエンコードして、 *note bytes: 193. による表現で返します。

'errors' 引数は *note decode(): ad7. メソッドのパラメータと同じものです
が、サポートされているハンドラの数がもう少し多いです。 ‘'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. モジュールにあります。新しいエンコーディングを
実装するには、 ‘codecs’ モジュールを理解していることも必要になります。し
かし、このモジュールのエンコードやデコードの関数は、使い勝手が良いという
より低レベルな関数で、新しいエンコーディングを書くのは特殊な作業なので、
この 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(): 1a4e. 組み込み関数を使って組み上げることも
できますが、それはさらに長くなってしまうでしょう。

理想的にはあなたの言語の自然なエンコーディングでリテラルを書くことでしょ
う。そうなれば、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(): fda.
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: 10c. module's *note normalize():
8e5. function that converts strings to one of several normal forms,
where letters followed by a combining character are replaced with single
characters.  ‘normalize()’ 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(): 8e5. 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(): fda. 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(): dd2. に渡した場合、 ‘\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: 16a. 型については Python ライブラリリファレンスの *note
テキストシーケンス型 -- str: 203c. で解説されています。

*note unicodedata: 10c. モジュールについてのドキュメント。

*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(): 318. 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(): 20c8. and *note write(): 20b7.  This works through
‘open()’'s 'encoding' and 'errors' parameters which are interpreted just
like those in *note str.encode(): ad6. and *note bytes.decode(): ad7.

そのためファイルから 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(): e57. 関数は現在のシステムで利用するエ
ンコーディングを返し、エンコーディングを手動で設定したい場合利用します、
ただしわざわざそうする積極的な理由はありません。読み書きのためにファイル
を開く時には、ファイル名を Unicode 文字列として渡すだけで正しいエンコー
ディングに自動的に変更されます:

     filename = 'filename\u4500abc'
     with open(filename, 'w') as f:
         f.write('blah\n')

*note os.stat(): 26f. のような *note os: a5. モジュールの関数も Unicode
のファイル名を受け付けます。

The *note os.listdir(): 1316. function returns filenames, which raises
an issue: should it return the Unicode version of filenames, or should
it return bytes containing the encoded versions?  ‘os.listdir()’ 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:
199. will be raised.

web ブラウザから来るデータやその他の信頼できないところからのデータを利用
する場合、それらの文字列から生成したコマンド行の実行や、それらの文字列を
データベースに蓄える前に文字列の中に不正な文字が含まれていないか確認する
のが一般的です。もしそういう状況になった場合には、エンコードされたバイト
データではなく、デコードされた文字列のチェックを入念に行なって下さい; い
くつかのエンコーディングは問題となる性質を持っています、例えば全単射でな
かったり、完全に ASCII 互換でないなど。入力データがエンコーディングを指
定している場合でもそうして下さい、なぜなら攻撃者は巧みに悪意あるテキスト
をエンコードした文字列の中に隠すことができるからです。

* Menu:

* ファイルエンコーディングの変換::
* 不明なエンコーディングのファイル::


File: python.info,  Node: ファイルエンコーディングの変換,  Next: 不明なエンコーディングのファイル,  Up: Unicode 対応のプログラムを書くための Tips

9.13.3.3 ファイルエンコーディングの変換
.......................................

The *note StreamRecoder: 1e30. 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: 1e30. 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 パッケージを使ってインターネット上のリソースを取得するには
======================================================================


Author: 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: 112. のドキュメントの代わりに
はなりませんが、補完する役割を持っています。

   ---------- 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(): c56. と *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: 111. ライブラリの関数を使っ
て行います。

     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:
5b8e. の節を見て下さい、この節は後で問題が起きた場合に見ておくべき内容で
す。

   ---------- 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: 2c0. when it cannot handle a response
(though as usual with Python APIs, built-in exceptions such as *note
ValueError: 2ee, *note TypeError: 199. etc.  may also be raised).

*note HTTPError: 11e4. is the subclass of *note URLError: 2c0. raised in
the specific case of HTTP URLs.

例外クラスは *note urllib.error: 110. モジュールから提供されています。

* 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: 11e4.  Typical errors include '404' (page not found), '403'
(request forbidden), and '401' (authentication required).

HTTP のエラーコード全てについては RFC 2616(1) の10節を参照して下さい。

The *note HTTPError: 11e4. 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: 4055. 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: 11e4. インスタンスはエラーページのレ
スポンスとして扱えます。これは 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: 11e4. 'or' *note
URLError: 2c0. 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: 11e4.


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: 11e4.
instance) has two useful methods ‘info()’ and ‘geturl()’ and is defined
in the module *note urllib.response: 113.

   * 'geturl' - これは取得したページの実際の URL を返します。 ‘urlopen’
     (または利用される opener オブジェクト) はリダイレクトに追従するため
     、有用です。取得したページの URL は要求した URL と同じとは限りませ
     ん。

   * 'info' - これは取得したページ (特にサーバからヘッダ)を表す辞書風オ
     ブジェクトを返します。これは現在では *note http.client.HTTPMessage:
     406e. インスタンスです。

典型的なヘッダは '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: 3fbe. のインスタンス) を利用します。標準
的にはデフォルトの 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: 5b97. 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(): 3fbb. のドキュメンテーションを参
     照してください。

   ---------- 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ネットワーキングの用語に詳しくないユー
ザーを対象としていますが、‘ipaddress’ がどのようにIPネットワークアドレス
処理の概念を表現しているかをざっと見るのにも役立つかもしれません。

* Menu:

* アドレス/ネットワーク/インターフェースオブジェクトの作成::
* アドレス/ネットワーク/インターフェースオブジェクト::
* アドレスのリストとしてのネットワーク::
* 比較: 比較<4>.
* 他のモジュールでIPアドレスを使用する::
* インスタンスの生成に失敗した場合にさらに詳細を取得する::


File: python.info,  Node: アドレス/ネットワーク/インターフェースオブジェクトの作成,  Next: アドレス/ネットワーク/インターフェースオブジェクト,  Up: ipaddressモジュールの紹介

9.15.1 アドレス/ネットワーク/インターフェースオブジェクトの作成
---------------------------------------------------------------

*note ipaddress: 84. はIPアドレスを検査したり操作したりするためのモジュ
ールであるため、まずはオブジェクトを作成したほうが良いでしょう。文字列お
よび整数を使用して ‘ipaddress’ を使用してオブジェクトを作成できます。

* 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(): 426d. ファクトリー関数を使用することで、この方法
では渡された値をもとに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: 2ee. が発生する結果となります。
‘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: 199. 例外が発生します。


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: 2ee. として報告されます。特定
のエラーが提供されないのは、拒否された理由をより詳細に提供するために、値
がIPv4またはIPv6である 'はず' かどうかを知る必要があるためです。

追加の詳細を得ると役立つ場合のユースケースに対応するため、個別のクラスの
コンストラクタは実際に *note ValueError: 2ee. のサブクラスである *note
ipaddress.AddressValueError: 4272. と *note ipaddress.NetmaskValueError:
4293. を発生させて具体的に定義のどの部分のパースに失敗したのかを示します
。

クラスコンストラクタを直接使用する場合にはこれらのエラーメッセージはさら
に非常に詳細になっています。例えば:

     >>> 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:
2ee. を親クラスとして持ち、エラーの特定のタイプに興味がない場合でも、以
下のようにコードを記述できます:

     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:
2203.:

     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: a67. 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: a67. 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():
     1b5.

 -- 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(): 197b. 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.

* Menu:

* C Entry Points::
* C Probing Checks::


File: python.info,  Node: C Entry Points,  Next: C Probing Checks,  Up: 利用可能な静的マーカー

9.16.4.1 C Entry Points
.......................

To simplify triggering of DTrace markers, Python's C API comes with a
number of helper functions that mirror each static marker.  On builds of
Python without DTrace enabled, these do nothing.

In general, it is not necessary to call these yourself, as Python will
do it for you.

C API Function                                         Static Marker                 注釈
                                                                                     
-------------------------------------------------------------------------------------------------------------------
                                                                                     
 -- C の関数: void PyDTrace_LINE (const char *arg0,    ‘line()’
          const char *arg1, int arg2)                  

 -- C の関数: void PyDTrace_FUNCTION_ENTRY (const      ‘function__entry()’
          char *arg0, const char *arg1, int arg2)      

 -- C の関数: void PyDTrace_FUNCTION_RETURN (const     ‘function__return()’
          char *arg0, const char *arg1, int arg2)      

 -- C の関数: void PyDTrace_GC_START (int arg0)        ‘gc__start()’
                                                       
                                                                                     
 -- C の関数: void PyDTrace_GC_DONE (Py_ssize_t        ‘gc__done()’
          arg0)                                        

 -- C の関数: void PyDTrace_INSTANCE_NEW_START (int    ‘instance__new__start()’      Not used by Python
          arg0)                                                                      

 -- C の関数: void PyDTrace_INSTANCE_NEW_DONE (int     ‘instance__new__done()’       Not used by Python
          arg0)                                                                      

 -- C の関数: void PyDTrace_INSTANCE_DELETE_START      ‘instance__delete__start()’   Not used by Python
          (int arg0)                                                                 

 -- C の関数: void PyDTrace_INSTANCE_DELETE_DONE       ‘instance__delete__done()’    Not used by Python
          (int arg0)                                                                 

 -- C の関数: void PyDTrace_IMPORT_FIND_LOAD_START     ‘import__find__load__start()’
          (const char *arg0)                           

 -- C の関数: void PyDTrace_IMPORT_FIND_LOAD_DONE      ‘import__find__load__done()’
          (const char *arg0, int arg1)                 

 -- C の関数: void PyDTrace_AUDIT (const char *arg0,   ‘audit()’
          void *arg1)                                  


File: python.info,  Node: C Probing Checks,  Prev: C Entry Points,  Up: 利用可能な静的マーカー

9.16.4.2 C Probing Checks
.........................

 -- C の関数: int PyDTrace_LINE_ENABLED (void)

 -- C の関数: int PyDTrace_FUNCTION_ENTRY_ENABLED (void)

 -- C の関数: int PyDTrace_FUNCTION_RETURN_ENABLED (void)

 -- C の関数: int PyDTrace_GC_START_ENABLED (void)

 -- C の関数: int PyDTrace_GC_DONE_ENABLED (void)

 -- C の関数: int PyDTrace_INSTANCE_NEW_START_ENABLED (void)

 -- C の関数: int PyDTrace_INSTANCE_NEW_DONE_ENABLED (void)

 -- C の関数: int PyDTrace_INSTANCE_DELETE_START_ENABLED (void)

 -- C の関数: int PyDTrace_INSTANCE_DELETE_DONE_ENABLED (void)

 -- C の関数: int PyDTrace_IMPORT_FIND_LOAD_START_ENABLED (void)

 -- C の関数: int PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED (void)

 -- C の関数: int PyDTrace_AUDIT_ENABLED (void)

     All calls to ‘PyDTrace’ functions must be guarded by a call to one
     of these functions.  This allows Python to minimize performance
     impact when probing is disabled.

     On builds without DTrace enabled, these functions do nothing and
     return ‘0’.


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: アノテーションのベストプラクティス,  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: 55f6.

     注釈: 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:
170. 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: 170. 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: アノテーションのベストプラクティス,  Next: 拡張モジュールを分離する,  Prev: Python support for the Linux perf profiler,  Up: Python HOWTO

9.18 アノテーションのベストプラクティス
=======================================


author: Larry Hastings

概要
....

このドキュメントは、アノテーションの辞書を扱う上でのベストプラクティスを
まとめるものです。Python オブジェクトに付与された ‘__annotations__’ を
Python コードからアクセスする際には、以下のガイドラインに従うことを推奨
します。

本ドキュメントは次の４セクションで構成されています。Python 3.10 以降でオ
ブジェクトのアノテーションにアクセスするときのベストプラクティス、Python
3.9 以下でオブジェクトのアノテーションにアクセスするときのベストプラクテ
ィス、Python バージョンに関わらない ‘__annotations__’ に関するベストプラ
クティス、 ‘__annotations__’ の注意点、です。

注意：本ドキュメントは、アノテーションの使い方ではなく、
‘__annotations__’ の使い方を扱っています。型ヒントをコードの中でどうやっ
て使うかについては、 *note typing: 10b. モジュールを参照してください。

* Menu:

* オブジェクトのアノテーション辞書へのアクセス (Python 3.10 以降): オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降.
* オブジェクトのアノテーション辞書へのアクセス (Python 3.9 以前): オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前.
* 文字列指定のアノテーションを手動で解決する方法::
* __annotations__ のベストプラクティス (全 Python バージョン共通): __annotations__ のベストプラクティス 全 Python バージョン共通.
* __annotations__ の注意点::


File: python.info,  Node: オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降,  Next: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前,  Up: アノテーションのベストプラクティス

9.18.1 オブジェクトのアノテーション辞書へのアクセス (Python 3.10 以降)
----------------------------------------------------------------------

Python 3.10 で標準ライブラリに *note inspect.get_annotations(): a18. 関
数が新たに追加されました。Python 3.10 から 3.13 までは、アノテーションに
対応しているオブジェクトのアノテーション辞書にアクセスするには、この関数
を使うのが一番良いです。文字列で指定されたアノテーションも自動的に文字列
でない値に解決してくれます。

Python 3.14 では、アノテーションを扱うためのモジュール *note
annotationlib: 6. が追加されました。このモジュールに *note
annotationlib.get_annotations(): 457. があり、 *note
inspect.get_annotations(): a18. を置き換えるものです。

もし何らかの理由で自分の用途に *note inspect.get_annotations(): a18. が
合わないという場合は、手動で ‘__annotations__’ にアクセスすることもでき
ます。これについても、推奨のアクセス方法が Python 3.10 で変わりました。
3.10 で、 ‘o.__annotations__’ は関数、クラス、モジュールに対しては必ず使
えることが保証されるようになりました。オブジェクトが確実にこの３つのいず
れかである場合は、単に ‘o.__annotations__’ を使えばアノテーション辞書を
取得できます。

しかし、それ以外の callable (例えば、 *note functools.partial(): 219. で
作られたもの) は ‘__annotations__’ 属性が定義されていない可能性がありま
す。この属性があるかどうか不明なオブジェクトの場合は、Python 3.10 以降で
は、 *note getattr(): dce. に３つの引数を渡して呼び出す (例えば
‘getattr(o, '__annotations__', None)’ ) のを推奨します。

Python 3.10 より前のバージョンでは、親クラスにアノテーションがあるが自身
はアノテーションを定義していないようなクラスの場合、 ‘__annotations__’ を
取得すると親クラスの ‘__annotations__’ が返されます。3.10 以降では、代わ
りに空の辞書が返されます。


File: python.info,  Node: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前,  Next: 文字列指定のアノテーションを手動で解決する方法,  Prev: オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降,  Up: アノテーションのベストプラクティス

9.18.2 オブジェクトのアノテーション辞書へのアクセス (Python 3.9 以前)
---------------------------------------------------------------------

Python 3.9 以前では、オブジェクトのアノテーション辞書を取得するのはより
複雑です。原因は、3.9 以前のバージョンの設計上の欠陥 (具体的にはクラスの
アノテーション) です。

クラス以外のオブジェクト (関数や他の callable、モジュール) のアノテーシ
ョンを取得する推奨の方法は、3.10と同じです。 *note
inspect.get_annotations(): a18. ではなく、 *note getattr(): dce. に３つ
の引数を渡すことで ‘__annotations__’ 属性を取得するのがいいです。

ただし、クラスについては推奨方法が異なります。なぜなら、クラスには
‘__annotations__’ は必須ではなく、属性はベースクラスから継承されるので、
‘__annotations__’ 属性にアクセスするとベースクラスのアノテーション辞書を
取得してしまうという問題があるからです。例えば:

     class Base:
         a: int = 3
         b: str = 'abc'

     class Derived(Base):
         pass

     print(Derived.__annotations__)

このコードでは ‘Derived’ ではなく ‘Base’ のアノテーションが表示されます
。

クラス (‘isinstance(o, type)’) のアノテーションを取得するためには、新た
に分岐を追加する必要があります。推奨する方法では、 Python 3.9 以前の実装
に依存した方法をとります。クラスにアノテーションがあれば、 *note
__dict__: e5b. の辞書に格納されるという実装になっています。クラスにはア
ノテーションがない場合もあるため、この辞書の *note get(): 2090. メソッド
を使ってアノテーションを取得する、というのが推奨の方法です。

以上を踏まえると、Python 3.9 以前では、以下のサンプルコードで任意のオブ
ジェクトの ‘__annotations__’ 属性を安全に取得することができます:

     if isinstance(o, type):
         ann = o.__dict__.get('__annotations__', None)
     else:
         ann = getattr(o, '__annotations__', None)

このコードを実行すると、 ‘ann’ の値は辞書か ‘None’ となります。さらに
‘ann’ の値を調べるには、 *note isinstance(): 2af. で型を再度確認すること
を推奨します。

ただし、一部の特殊な型オブジェクトや不正な形式の型オブジェクトは *note
__dict__: e5b. 属性がないこともあるため、さらに安全をとるには *note
getattr(): dce. を使って ‘__dict__’ を取得したほうがいいです。


File: python.info,  Node: 文字列指定のアノテーションを手動で解決する方法,  Next: __annotations__ のベストプラクティス 全 Python バージョン共通,  Prev: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前,  Up: アノテーションのベストプラクティス

9.18.3 文字列指定のアノテーションを手動で解決する方法
-----------------------------------------------------

アノテーションは文字列として指定されている場合があり、それを評価して
Python の値に変換するには、 *note inspect.get_annotations(): a18. を使う
のが一番です。

Python 3.9 以前を使っているか、もしくは何らかの理由で *note
inspect.get_annotations(): a18. を使えない場合は、自分で実装する必要があ
ります。現状の Python バージョンの ‘inspect.get_annotations()’ の実装を
確認して、同様の処理を実装することを推奨します。

すなわち、任意のオブジェクト ‘o’ の文字列アノテーションを評価するには:

   * ‘o’ がモジュールならば、 ‘o.__dict__’ を ‘globals’ として *note
     eval(): 4a3. を呼ぶ。

   * ‘o’ がクラスならば、 ‘sys.modules[o.__module__].__dict__’ を
     ‘globals’ とし、 ‘dict(vars(o))’ を ‘locals’ として *note eval():
     4a3. を呼ぶ。

   * ‘o’ が *note functools.update_wrapper(): 1227. か *note
     functools.wraps(): 1163. か *note functools.partial(): 219. でラッ
     プされた callable ならば、一番内部の関数に到達するまで、
     ‘o.__wrapped__’ か ‘o.func’ のどちらかを繰り返し取得する。

   * ‘o’ がクラス以外の callable であれば、 *note o.__globals__: 14ef. を
     globals として *note eval(): 4a3. を呼ぶ。

しかし、必ずしもアノテーションの文字列が *note eval(): 4a3. で Python の
値に変換できるとは限りません。理論上どんな文字列も指定可能であり、変換で
きない文字列を型ヒントとして指定する必要がある場合が実際にあります。例え
ば:

   * ‘|’ を使った PEP 604(1) のユニオン型 (これが追加された Python 3.10
     より前のバージョン)

   * *note typing.TYPE_CHECKING: ef4. が True の時だけインポートされ、実
     行時には必要ない型定義。

*note eval(): 4a3. で上記のような値を評価しようとすると、失敗し例外が発
生します。そのため、アノテーションを扱うライブラリ API を作る際は、呼び
出し側が明示的に要求したときのみ、文字列を評価することが推奨されます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0604/


File: python.info,  Node: __annotations__ のベストプラクティス 全 Python バージョン共通,  Next: __annotations__ の注意点,  Prev: 文字列指定のアノテーションを手動で解決する方法,  Up: アノテーションのベストプラクティス

9.18.4 ‘__annotations__’ のベストプラクティス (全 Python バージョン共通)
------------------------------------------------------------------------

   * オブジェクトの ‘__annotations__’ 属性に直接代入することは避けるべき
     です。Python に任せましょう。

   * 直接 ‘__annotations__’ 属性に代入するなら、必ず ‘dict’ オブジェクト
     を代入するべきです。

   * どういうオブジェクトかに関わらず、直接 ‘__annotations__’ にアクセス
     するのは避けるべきです。Python 3.14 以降は *note
     annotationlib.get_annotations(): 457. 、 Python 3.10 以降は *note
     inspect.get_annotations(): a18. を使いましょう。

   * 直接 ‘__annotations__’ メンバーにアクセスするなら、まず値が辞書であ
     ることをチェックしてから中身を調べるべきです。

   * ‘__annotations__’ 辞書を書き換えるのは避けるべきです。

   * ‘__annotations__’ 属性を削除するのは避けるべきです。


File: python.info,  Node: __annotations__ の注意点,  Prev: __annotations__ のベストプラクティス 全 Python バージョン共通,  Up: アノテーションのベストプラクティス

9.18.5 ‘__annotations__’ の注意点
---------------------------------

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(): 457. on Python 3.14+ or *note
inspect.get_annotations(): a18. on Python 3.10+.  On earlier versions of
Python, you can avoid these bugs by accessing the annotations from the
class's *note __dict__: e5b. (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(): f48. 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: アノテーションのベストプラクティス,  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: 201a. 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(): 54b8./*note
     Py_FinalizeEx(): f15. cycles, and

   - in parallel, managing "sub-interpreters" using *note
     Py_NewInterpreter(): 1b90./*note Py_EndInterpreter(): 18aa.

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::
* 分離されたモジュールオブジェクト::
* Surprising Edge Cases::


File: python.info,  Node: Enter Per-Module State,  Next: 分離されたモジュールオブジェクト,  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: 分離されたモジュールオブジェクト,  Next: Surprising Edge Cases,  Prev: Enter Per-Module State,  Up: 背景<2>

9.19.2.2 分離されたモジュールオブジェクト
.........................................

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  # 新しいモジュールオブジェクトを作成
     >>> 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:
5bdf.), 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: 分離されたモジュールオブジェクト,  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: 5bde, 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: 5594.


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: 5597.  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: 1bef.) 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: b76. 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(): f15.) and
re-initialization (*note Py_Initialize(): 45e.).


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: 3cd. 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: 1aea.
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: 985. flag.

   - Define a traverse function using *note Py_tp_traverse: 5522, which
     visits the type (e.g.  using ‘Py_VISIT(Py_TYPE(self))’).

Please refer to the documentation of *note Py_TPFLAGS_HAVE_GC: 985. and
*note tp_traverse: 986. 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: 37f. was only added in Python 3.11.  As
a replacement, use:

   * *note PY_VERSION_HEX: 380, if not using the stable ABI, or

   * *note sys.version_info: 8b0. (via *note PySys_GetObject(): 62a. and
     *note PyArg_ParseTuple(): 3bf.).


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: 986. 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: 5267.


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: 5241. function, it needs to:

   - call *note PyObject_GC_UnTrack(): 1723. 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: 5254. slot of a heap type must be set to *note
PyObject_GC_Del(): 1721.  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(): b80. or *note PyObject_NewVar(): b81.:

   - Get and call type's *note tp_alloc: 5255. 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(): c9d. or *note PyObject_GC_NewVar():
     c9e.:

          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(): b6a. to get the associated
module, and then *note PyModule_GetState(): b7b. 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(): b6b, 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: 1a6b. *note calling
convention: 16f5. and the corresponding *note PyCMethod: 96c. 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():
b6b. 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: 5665. for *note __add__: 243d. 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: 96c.  The same goes for
getters and setters defined with *note PyGetSetDef: db6.

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():
b7b. 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: 263e. (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: 197. 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(): 119a. 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(): fa4. 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(): 23d6. 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: 1f6. 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: 22ad, may not be ready for use in a free-threaded build, and
will re-enable the *note GIL: 165.

This document describes the implications of free threading for Python
code.  See *note C API Extension Support for Free Threading: 5c06. 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(): 4caa. 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: 170.

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: 184, *note list: 24f, and *note set: 185. 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: 1a54. 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: 292.
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(): 14f7.


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:
8f0. 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::
* Increased memory usage::


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: 176.
is set to true by default which causes threads created with *note
threading.Thread: 177. to start with a copy of the *note Context(): 178.
of the caller of *note start(): 179.  In the default GIL-enabled build,
the flag defaults to false so threads start with an empty ‘Context()’.


File: python.info,  Node: Warning filters,  Next: Increased memory usage,  Prev: Context variables,  Up: Behavioral changes

9.22.6.2 Warning filters
........................

In the free-threaded build, the flag *note context_aware_warnings: 18b.
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: 17a. context manager uses a context variable
for warning filters.  If the flag is false then ‘catch_warnings’
modifies the global filters list, which is not thread-safe.  See the
*note warnings: 119. module for more details.


File: python.info,  Node: Increased memory usage,  Prev: Warning filters,  Up: Behavioral changes

9.22.6.3 Increased memory usage
...............................

The free-threaded build will typically use more memory compared to the
default build.  There are multiple reasons for this, mostly due to
design decisions.

* Menu:

* All interned strings are immortal::
* Non-GC objects have a larger object header::
* QSBR can delay freeing of memory::
* mimalloc allocator vs pymalloc::
* Free-threaded reference counting can cause objects to live longer::
* Per-thread reference counting can delay freeing objects::


File: python.info,  Node: All interned strings are immortal,  Next: Non-GC objects have a larger object header,  Up: Increased memory usage

9.22.6.4 All interned strings are immortal
..........................................

For modern Python versions (since version 2.3), interning a string (e.g.
with *note sys.intern(): 14f7.) does not cause it to become immortal.
Instead, if the last reference to that string disappears, it will be
removed from the interned string table.  This is not the case for the
free-threaded build and any interned string will become immortal,
surviving until interpreter shutdown.


File: python.info,  Node: Non-GC objects have a larger object header,  Next: QSBR can delay freeing of memory,  Prev: All interned strings are immortal,  Up: Increased memory usage

9.22.6.5 Non-GC objects have a larger object header
...................................................

The free-threaded build uses a different *note PyObject: 5df. structure.
Instead of having the GC related information allocated before the
‘PyObject’ structure, like in the default build, the GC related info is
part of the normal object header.  For example, on the AMD64 platform,
‘None’ uses 32 bytes on the free-threaded build vs 16 bytes for the
default build.  GC objects (such as dicts and lists) are the same size
for both builds since the free-threaded build does not use additional
space for the GC info.


File: python.info,  Node: QSBR can delay freeing of memory,  Next: mimalloc allocator vs pymalloc,  Prev: Non-GC objects have a larger object header,  Up: Increased memory usage

9.22.6.6 QSBR can delay freeing of memory
.........................................

In order to safely implement lock-free data structures, a safe memory
reclamation (SMR) scheme is used, known as quiescent state-based
reclamation (QSBR). This means that the memory backing data structures
allowing lock-free access will use QSBR, which defers the free
operation, rather than immediately freeing the memory.  Two examples of
these data structures are the list object and the dictionary keys
object.  See ‘InternalDocs/qsbr.md’ in the CPython source tree for more
details on how QSBR is implemented.  Running *note gc.collect(): 1b5.
should cause all memory being held by QSBR to be actually freed.  Note
that even when QSBR frees the memory, the underlying memory allocator
may not immediately return that memory to the OS and so the resident set
size (RSS) of the process might not decrease.


File: python.info,  Node: mimalloc allocator vs pymalloc,  Next: Free-threaded reference counting can cause objects to live longer,  Prev: QSBR can delay freeing of memory,  Up: Increased memory usage

9.22.6.7 mimalloc allocator vs pymalloc
.......................................

The default build will normally use the "pymalloc" memory allocator for
small allocations (512 bytes or smaller).  The free-threaded build does
not use pymalloc and allocates all Python objects using the "mimalloc"
allocator.  The pymalloc allocator has the following properties that
help keep memory usage low: small per-allocated-block overhead,
effective memory fragmentation prevention, and quick return of free
memory to the operating system.  The mimalloc allocator does quite well
in these respects as well but can have some more overhead.

In the free-threaded build, mimalloc manages memory in a number of
separate heaps (currently four).  For example, all GC supporting objects
are allocated from their own heap.  Using separate heaps means that free
memory in one heap cannot be used for an allocation that uses another
heap.  Also, some heaps are configured to use QSBR (quiescent-state
based reclamation) when freeing the memory that backs up the heap (known
as "pages" in mimalloc terminology).  The use of QSBR creates a delay
between all memory blocks for a page being freed and the memory page
being released, either for new allocations or back to the OS.

The mimalloc allocator also defers returning freed memory back to the
OS.  You can reduce that delay by setting the environment variable
‘MIMALLOC_PURGE_DELAY’ to ‘0’.  Note that this will likely reduce the
performance of the allocator.


File: python.info,  Node: Free-threaded reference counting can cause objects to live longer,  Next: Per-thread reference counting can delay freeing objects,  Prev: mimalloc allocator vs pymalloc,  Up: Increased memory usage

9.22.6.8 Free-threaded reference counting can cause objects to live longer
..........................................................................

In the default build, when an object's reference count reaches zero, it
is normally deallocated.  The free-threaded build uses "biased reference
counting", with a fast-path for objects "owned" by the current thread
and a slow path for other objects.  See PEP 703(1) for additional
details.  Any time an object's reference count ends up in a "queued"
state, deallocation can be deferred.  The queued state is cleared from
the "eval breaker" section of the bytecode evaluator.

The free-threaded build also allows a different mode of reference
counting, known as "deferred reference counting".  This mode is enabled
by setting a flag on a per-object basis.  Deferred reference counting is
enabled for the following types:

   * module objects

   * module top-level functions

   * class methods defined in the class scope

   * descriptor objects

   * thread-local objects, created by *note threading.local: 18c4.

When deferred reference counting is enabled, references from Python
function stacks are not added to the reference count.  This scheme
reduces the overhead of reference counting, especially for objects used
from multiple threads.  Because the stack references are not counted,
objects with deferred reference counting are not immediately freed when
their internal reference count goes to zero.  Instead, they are examined
by the next GC run and, if no stack references to them are found, they
are freed.  This means these objects are freed by the GC and not when
their reference count goes to zero, as is typical.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/


File: python.info,  Node: Per-thread reference counting can delay freeing objects,  Prev: Free-threaded reference counting can cause objects to live longer,  Up: Increased memory usage

9.22.6.9 Per-thread reference counting can delay freeing objects
................................................................

To avoid contention on the reference count fields of frequently shared
objects, the free-threaded build also uses "per-thread reference
counting" for a few selected object types.  Rather than updating a
single shared reference count, each thread maintains its own local
reference count array, indexed by a unique id assigned to the object.
The true reference count is only computed by summing the per-thread
counts when the object's local count drops to zero.  Per-thread
reference counting is currently used for:

   * heap type objects (classes created in Python)

   * code objects

   * the ‘__dict__’ of module objects

Because the per-thread counts must be merged back to the object before
it can be deallocated, objects using per-thread reference counting are
typically freed later than they would be in the default build.  In
particular, such an object is usually not freed until the thread that
referenced it reaches a safe point (for example, in the "eval breaker"
section of the bytecode evaluator) or exits.  Running *note
gc.collect(): 1b5. will merge the per-thread counts and allow these
objects to be freed.


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: 1f6.  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(): 175. 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(): 5227.) 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: 380.
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(): 559b.) 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: 52e4, *note
     PyList_SET_ITEM: 62f, and macros like *note
     PySequence_Fast_GET_SIZE: 3c8. that use the object returned by
     *note PySequence_Fast(): 1905. 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: 3d5. may not be thread-safe if the containing object is
     modified concurrently.  See the section on *note borrowed
     references: 5c22. 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: 2784, *note PyDictObject: 64f, and
*note PySetObject: 574a. perform internal locking in the free-threaded
build.  For example, the *note PyList_Append(): 53c4. 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(): 19ee, which does not lock
the dictionary.  You should use *note Py_BEGIN_CRITICAL_SECTION: 572e.
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: 3d5.  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(): 52e4.          *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(): 41f.
                                        
                                        
*note PyDict_SetDefault(): 5e4.         *note PyDict_SetDefaultRef(): 5e3.
                                        
                                        
*note PyDict_Next(): 19ee.              none (see *note PyDict_Next: 5c25.)
                                        
                                        
*note PyWeakref_GetObject(): 3db.       *note PyWeakref_GetRef(): 3dd.
                                        
                                        
*note PyWeakref_GET_OBJECT(): 3dc.      *note PyWeakref_GetRef(): 3dd.
                                        
                                        
*note PyImport_AddModule(): 5fc.        *note PyImport_AddModuleRef(): 5fb.
                                        
                                        
*note PyCell_GET(): 578b.               *note PyCell_Get(): 578a.
                                        

Not all APIs that return borrowed references are problematic.  For
example, *note PyTuple_GetItem(): 523c. 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: 593f.: "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(): e66. in your
     extension and check that the allocated memory is used for Python
     objects.  Use *note PyMem_Malloc(): e63. to allocate buffers
     instead of ‘PyObject_Malloc()’.


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: 5242. and *note Py_END_ALLOW_THREADS:
     c83.

These functions should still be used in the free-threaded build to
manage thread state even when the *note GIL: 165. 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: 5242. around blocking operations, such as I/O or
lock acquisitions, to allow other threads to run the *note cyclic
garbage collector: 1842.


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(): 523e, 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: 572e. and *note
     Py_END_CRITICAL_SECTION: 58bb. - For locking a single object

   * *note Py_BEGIN_CRITICAL_SECTION2: 58b9. and *note
     Py_END_CRITICAL_SECTION2: 58bd. - 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: 58b9. 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 ‘PyMutex’ causes the
critical sections to be suspended, only the mutexes that are part of the
critical sections are released.  If ‘PyMutex’ 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: 58b9, 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.14t’.

   * pypa/cibuildwheel(2) supports building wheels for the free-threaded
     build of Python 3.14 and newer.

* Menu:

* Limited C API and Stable ABI::
* Windows: Windows<87>.

   ---------- Footnotes ----------

   (1) https://github.com/pypa/manylinux

   (2) https://github.com/pypa/cibuildwheel


File: python.info,  Node: Limited C API and Stable ABI,  Next: Windows<87>,  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<87>,  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: 16f. environment
     variable to ‘1’ before starting the interpreter.

   * Use the *note -X disable_remote_debug: 170. command-line option.

   * Compile Python with the *note -without-remote-debug: 171. 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:
     5c39. 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(): 16e.
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,  Next: Security and threat model,  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.


File: python.info,  Node: Security and threat model,  Prev: Summary,  Up: Python HOWTO

9.31 Security and threat model
==============================

The remote debugging protocol relies on the same operating system
primitives used by native debuggers such as GDB and LLDB. Attaching to a
process requires the 'same privileges' that those debuggers require, for
example ‘ptrace’ / Yama LSM on Linux, ‘task_for_pid’ on macOS, and
‘SeDebugPrivilege’ on Windows.  Python does not introduce any new
privilege escalation path; if an attacker already possesses the
permissions needed to attach to a process, they could equally use GDB to
read memory or inject code.

The following principles define what is, and is not, considered a
security vulnerability in this feature:

Attaching requires OS-level privileges

     On every supported platform the operating system gates
     cross-process memory access behind privilege checks
     (‘CAP_SYS_PTRACE’, root, or administrator rights).  A report that
     demonstrates an issue only after these privileges have already been
     obtained is 'not' a vulnerability in CPython, since the OS security
     boundary was already crossed.

Crashes or memory errors when reading a compromised process are not vulnerabilities

     A tool that reads internal interpreter state from a target process
     must trust that memory to be well-formed.  If the target process
     has been corrupted or is controlled by an attacker, the debugger or
     profiler may crash, produce garbage output, or behave
     unpredictably.  This is the same risk accepted by every
     ‘ptrace’-based debugger.  Bugs in this category (buffer overflows,
     segmentation faults, or undefined behaviour triggered by reading
     corrupted state) are 'not' treated as security issues, though fixes
     that improve robustness are welcome.

Vulnerabilities in the target process are not in scope

     If the Python process being debugged has already been compromised,
     the attacker already controls execution in that process.
     Demonstrating further impact from that starting point does not
     constitute a vulnerability in the remote debugging protocol.

* Menu:

* When to use PYTHON_DISABLE_REMOTE_DEBUG::


File: python.info,  Node: When to use PYTHON_DISABLE_REMOTE_DEBUG,  Up: Security and threat model

9.31.1 When to use ‘PYTHON_DISABLE_REMOTE_DEBUG’
------------------------------------------------

The environment variable *note PYTHON_DISABLE_REMOTE_DEBUG: 16f. (and
the equivalent *note -X disable_remote_debug: 170. flag) allows
operators to disable the in-process side of the protocol as a
'defence-in-depth' measure.  This may be useful in hardened or sandboxed
deployment environments where no debugging or profiling of the process
is expected and reducing attack surface is a priority, even though the
OS-level privilege checks already prevent unprivileged access.

Setting this variable does 'not' affect other OS-level debugging
interfaces (‘ptrace’, ‘/proc’, ‘task_for_pid’, etc.), which remain
available according to their own permission models.

General:

   * *note A Conceptual Overview of asyncio: 3853.

   * *note アノテーションのベストプラクティス: 9dd.

   * *note Argparse チュートリアル: 340e.

   * *note デスクリプタ ガイド: 170b.

   * *note 列挙型 HOWTO: 5a80.

   * *note 関数型プログラミング HOWTO: 5ab1.

   * *note ipaddressモジュールの紹介: 426b.

   * *note Logging HOWTO: 5ad0.

   * *note Logging クックブック: 1414.

   * *note Regular expression HOWTO: 27da.

   * *note ソートのテクニック: 13f7.

   * *note Unicode HOWTO: 14c0.

   * *note urllib
     パッケージを使ってインターネット上のリソースを取得するには: 4030.

Advanced development:

   * *note Python で Curses プログラミング: 3501.

   * *note Python support for free threading: 2774.

   * *note C API Extension Support for Free Threading: 5c06.

   * *note 拡張モジュールを分離する: 167.

   * *note The Python 2.3 Method Resolution Order: 16c8.

   * *note ソケットプログラミング HOWTO: 3a49.

   * *note timer file descriptor HOWTO: 5bf7.

   * *note Python 3 への拡張モジュール移植: 14fc.

Debugging and profiling:

   * *note Debugging C API extensions and CPython Internals with GDB:
     5a71.

   * *note DTrace と SystemTap で CPython を測定する: e6a.

   * *note Python support for the Linux perf profiler: 4ae.

   * *note Remote debugging attachment protocol: 4cab.


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 チュートリアル: 2018. から始めましょう
。他にも、 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
標準ライブラリ: 14a. の一覧を参照してください。また、様々なサードパーテ
ィの拡張も使えます。 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: 4ca5. 、 *note
sys.version_info: 8b0. も参照してください。

   ---------- 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 チュートリアル: 2018. などがあります。

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>.
* Sequences (tuples/lists): Sequences tuples/lists.
* オブジェクト::
* モジュール: モジュール<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(): 273. 関数でそれらのデバッガに処理を移せます。

pdb モジュールは簡素にして十分な Python のコンソールモードデバッガです。
これは Python の標準ライブラリに含まれているもので、 *note
ライブラリリファレンスマニュアルにドキュメントがあります: aa. 。 pdb の
コードを手本にして自分用のデバッガを書くこともできます。

IDLE 対話型開発環境は、標準 Python ディストリビューションの一部 (普通は
*note idlelib: 77. として利用可能) であり、グラフィカルなデバッガを含ん
でいます。

PythonWin は、pdb をベースとした GUI デバッガを含む Python IDE です。
Pythonwin デバッガは、ブレークポイントの色付けや非 PythonWin プログラム
のデバッグなどの素敵な機能をたくさん持っています。PythonWin は
pywin32(1) プロジェクトの一部、あるいは ActivePython(2) ディストリビュー
ションの一部として利用可能です。

Eric(3) は PyQt や Scintilla editing component をもとにした IDE です。

trepan3k(4) は gdbライクなデバッガです。

Visual Studio Code(5) はバージョン管理ソフトと一緒になったデバッグツール
を備えた IDE です

商業のグラフィカルデバッガ付き Python IDE もあります。例えば:

   * Wing IDE(6)

   * PyCharm(7)

   ---------- Footnotes ----------

   (1) https://github.com/mhammond/pywin32

   (2) https://www.activestate.com/products/python/

   (3) https://eric-ide.python-projects.org/

   (4) https://github.com/rocky/python3-trepan/

   (5) https://code.visualstudio.com/

   (6) https://wingware.com/

   (7) https://www.jetbrains.com/pycharm/


File: python.info,  Node: バグの発見や静的解析に役立つツールはありますか？,  Next: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？,  Prev: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？,  Up: 一般的な質問

10.2.1.2 バグの発見や静的解析に役立つツールはありますか？
.........................................................

はい。

Ruff(1), Pylint(2) と Pyflakes(3) は、基本的なチェックを行いバグの早期発
見を助けます。

mypy(4), ty(5), Pyrefly(6), そして pytype(7) などの静的型チェッカーは、
Python ソースコードにある型ヒントをチェックできます。

   ---------- Footnotes ----------

   (1) https://docs.astral.sh/ruff/

   (2) https://pylint.readthedocs.io/

   (3) https://github.com/PyCQA/pyflakes

   (4) https://mypy-lang.org/

   (5) https://docs.astral.sh/ty/

   (6) https://pyrefly.org/

   (7) 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/3.14/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: 1754. を出すのには驚くかもしれません。

このコード:

     >>> x = 10
     >>> def bar():
     ...     print(x)
     ...
     >>> bar()
     10

は動きますが、このコード:

     >>> x = 10
     >>> def foo():
     ...     print(x)
     ...     x += 1

は ‘UnboundLocalError’ になります:

     >>> foo()
     Traceback (most recent call last):
       ...
     UnboundLocalError: cannot access local variable 'x' where it is not associated with a value

これは、あるスコープの中で変数に代入を行うとき、その変数はそのスコープに
対してローカルになり、外のスコープにある同じ名前の変数を隠すからです。
foo の最後の文が ‘x’ に新しい値を代入しているので、コンパイラはこれをロ
ーカル変数であると認識します。その結果、先の ‘print(x)’ が初期化されてい
ないローカル変数を表示しようとして結果はエラーとなります。

上の例では、グローバルであると宣言することで外のスコープにアクセスできま
す:

     >>> x = 10
     >>> def foobar():
     ...     global x
     ...     print(x)
     ...     x += 1
     ...
     >>> foobar()
     10

この明示的な宣言は (表面的には似ているクラスとインスタンス変数の例とは違
って) あなたは実際は他のスコープの変数の値を変えようとしているのだ、とい
うことを知らせるのに必要です:

     >>> print(x)
     11

同様のことを、ネストされたスコープで *note nonlocal: 14c3. 予約語を使う
ことでもできます:

     >>> 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   # 'x' 設定のデフォルト値

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(1),
     requests(2), tzdata(3)

  3. 自前で開発したモジュール

循環参照の問題を避けるために、インポートを関数やクラスに移すことが必要な
ときもあります。Gordon McMillan によれば:

     循環参照は両方のモジュールが "import <module>" 形式のインポートを使
     っていれば大丈夫です。二つ目のモジュールが最初のモジュールから名前
     を確保しようとして ("from module import name")、そのインポートがト
     ップレベルにあると駄目です。最初のモジュールが二つ目のモジュールを
     インポートするのに忙しくて、最初のモジュールの名前が利用可能になっ
     ていないからです。

この状況では、二つ目のモジュールが一つの関数の中でのみ使われているならば
、そのインポートは簡単に関数の中に移せます。インポートが呼ばれたとき、最
初のモジュールは初期化を完了していて、二つ目のモジュールは自分のインポー
トをできます。

プラットフォーム依存のモジュールがあるときには、インポートをトップレベル
の外に動かすことも必要です。この場合、ファイルの先頭ではすべてのモジュー
ルをインポートすることさえできないかもしれません。この場合は、対応するプ
ラットフォームに合わせたコードで正しいモジュールをインポートすることを選
ぶと良いです。

循環参照の問題を避けたりモジュールの初期化にかかる時間を減らしたりしたい
なら、単にインポートを関数定義の中などのローカルなスコープに移してくださ
い。この手法は多くのインポートがプログラムがどのように実行されるかに依存
しなくてよいときに特に有効です。ある関数の中でのみモジュールが使われるの
なら、インポートをその関数の中に移すことを考えてもいいでしょう。なお、モ
ジュールを読み込む最初の回はモジュールの初期化の時間のために高価になりえ
ますが、複数回目にモジュールを読み込むのは事実上無料、辞書探索の数回のコ
ストだけで済みます。モジュール名がスコープから外れてさえ、そのモジュール
はおそらく *note sys.modules: 1791. から利用できるでしょう。

   ---------- Footnotes ----------

   (1) https://pypi.org/project/dateutil/

   (2) https://pypi.org/project/requests/

   (3) https://pypi.org/project/tzdata/


File: python.info,  Node: なぜオブジェクト間でデフォルト値が共有されるのですか？,  Next: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？,  Prev: モジュールで import を使う際の「ベストプラクティス」は何ですか？,  Up: コア言語

10.2.2.6 なぜオブジェクト間でデフォルト値が共有されるのですか？
...............................................................

この種のバグがよく初心者プログラマに噛み付きます。この関数を考えてみてく
ださい:

     def foo(mydict={}):  # 危険：すべての呼び出しで単一辞書への参照が共有される
         ... 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 = {}  # ローカル名前空間での新辞書作成

この性質が便利なこともあります。時間のかかる計算を行う関数があるときに使
われる一般的な技法は、関数が呼び出されるごとにパラメータと結果の値をキャ
ッシュし、再び同じ値が要求されたらキャッシュされた値を返すというものです
。これはメモ化（ "memoizing" ）と呼ばれ、このように実装されます:

     # 呼び出し元は２つのパラメータを指定でき、キーワードにより _cache をオプションとして渡せる
     def expensive(arg1, arg2, *, _cache={}):
         if (arg1, arg2) in _cache:
             return _cache[(arg1, arg2)]

         # 値の算出
         result = ... 高コストな計算 ...
         _cache[(arg1, arg2)] = result           # 結果をキャッシュに保持
         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): 23a7. は関数定義に表れる名前で定義されるのに対
し、 *note 実引数 (argument): 67b. は関数を呼び出すときに実際に渡す値の
ことです。仮引数は関数が受け取ることの出来る 実引数の型 を定義します。例
えば、以下のような関数定義があったとして:

     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: 15be. です。内容を変更出来る、ということで
     す。

*note append(): 2436. 呼び出しの後、ミュータブルオブジェクトの内容が
‘[]’ から ‘[10]’ に変わります。 変数が同じオブジェクトを参照しているので
、どちらの名前であっても変更された値 ‘[10]’ にアクセスします。

代わりに ‘x’ にイミュータブルを代入すると:

     >>> x = 5  # int はイミュータブル（不変）
     >>> y = x
     >>> x = x + 1  # 5 は変更不可。 ここでは新しいオブジェクトを作っている
     >>> x
     6
     >>> y
     5

この場合ご覧の通り ‘x’ と ‘y’ はまったく同じではありませんね。これは整数
が *note immutable: 15bd. だからで、 ‘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):
dcb.) は新しいオブジェクトを作ります。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’ は新しいオブジェクトを作ります)。

言い換えると:

   * mutable オブジェクト (*note list: 24f, *note dict: 184, *note set:
     185. のような) の場合は、特定の操作を用いてそれを変えることができ、
     それを参照する どの変数にも その変更が反映されます。

   * immutable オブジェクト (*note str: 16a, *note int: 19c, *note
     tuple: 614. のような) の場合は、それを参照する どの変数も同じ値を参
     照しますが、その値を新しい値に変換する操作では 常に新しいオブジェク
     トを返します。

2つの変数が同じオブジェクトを参照しているかどうかが知りたければ、 *note
is: 34a. 演算子や組み込み関数 *note id(): 1641. が使えます。


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 と b はローカル名で
          ...     b = b + 1              # 新しいオブジェクトが代入され
          ...     return a, b            # 新しい値一式を返す
          ...
          >>> x, y = 'old-value', 99
          >>> func1(x, y)
          ('new-value', 100)

     これはたいてい一番明確な方法です。

  2. グローバル変数を使って。これはスレッドセーフでないので、推奨されま
     せん。

  3. ミュータブルな (インプレースに変更可能な) オブジェクトを渡すことに
     よって:

          >>> def func2(a):
          ...     a[0] = 'new-value'     # 'a' は mutable list への参照
          ...     a[1] = a[1] + 1        # 共有されたオブジェクトを変える
          ...
          >>> args = ['old-value', 99]
          >>> func2(args)
          >>> args
          ['new-value', 100]

  4. 変更を受ける辞書を渡すことによって:

          >>> def func3(args):
          ...     args['a'] = 'new-value'     # args は mutable dictionary
          ...     args['b'] = args['b'] + 1   # インプレースで変更
          ...
          >>> 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 は mutable Namespace
          ...     args.b = args.b + 1         # オブジェクトをインプレースで変更
          ...
          >>> 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__ 継承
         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(): d69.
を試してください。何でもコピーできるとは限りませんが、たいていはできます
。

もっと簡単にコピーできるオブジェクトもあります。辞書には *note copy():
dcd. メソッドがあります:

     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’ か決めることはできないのです。

概して、コードにとってある値の「名前を知っている」事は重要ではありません
。あなたがあえて introspective （訳注：実行時のオブジェクト情報を調査す
るような）プログラムを書いているのでない限り、方針を変えた方がいいかもし
れないということになるでしょう。

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: 14b9. がネ
ストされています。Ulf Bartelt によるものを少しアレンジした下の３つの例を
見てください:

     from functools import reduce

     # 素数 < 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)))))

     # 先頭 10 フィボナッチ数列
     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))))

     # マンデルブロ集合
     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))
     #    \___ ___/  \___ ___/  |   |   |__ 画面行数
     #        V          V      |   |______ 画面列数
     #        |          |      |__________ 最大 "iterations"
     #        |          |_________________ y 軸範囲
     #        |____________________________ x 軸範囲

よい子はまねしないでね！


File: python.info,  Node: 関数の仮引数リストにあるスラッシュ / は何を意味しますか？,  Prev: Python で解し難いワンライナーを書くことはできますか？,  Up: コア言語

10.2.2.18 関数の仮引数リストにあるスラッシュ (/) は何を意味しますか？
.....................................................................

関数の仮引数にあるスラッシュは、それより前にある仮引数は位置専用引数であ
ることを示します。 位置専用引数は、外から使える名前を持たない仮引数です
。 位置専用引数を受け付ける関数の呼び出しにおいて、実引数はその位置だけ
に基づいて仮引数に対応付けられます。 例えば、 *note divmod(): b9d. は位
置専用引数を受け付けます。 そのドキュメントは次のようになります:

     >>> 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(): b9d. をキーワード
引数を使って呼び出すとエラーになります:

     >>> 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 を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* 文字列から後端の改行を取り除く Perl の chomp() に相当するものはありますか？: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？.
* 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: 18f. となります:

     >>> 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 文字列を数に変換するにはどうしたらいいですか？
.......................................................

整数に変換するには、組み込みの *note int(): 19c. 型コンストラクタを使っ
てください。例えば、 ‘int('144') == 144’ です。同様に、 *note float():
197. は浮動小数点に変換します。例えば、 ‘float('144') == 144.0’ です。

デフォルトでは、これらは数を十進数として解釈するので、 ‘int('0144') ==
144’ は成立しますが ‘int('0x144')’ は *note ValueError: 2ee. を送出しま
す。 ‘int(string, base)’ はオプションの第二引数をとって変換元の基数にし
ます。つまり ‘int( '0x144', 16) == 324’ です。基数が 0 と指定された場合
、その数は Python の基準によって解釈されます。先頭が '0o' なら八進数で、
'0x' なら十六進数を表します。

文字列を数に変換するだけのために *note eval(): 4a3. を使わないでください
。 ‘eval()’ は特に遅いですし、セキュリティ上のリスクもあります。求められ
ない副作用を持つような 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(): 16a. を使ってください。 十六進数や八進数
にしたければ、組み込み関数の *note hex(): 14eb. や *note oct(): 14ea. を
使ってください。 手の込んだフォーマット形式を使うなら、 *note f-strings:
19b. と *note Format string syntax: 15b7. の節を参照してください。 例え
ば、 ‘"{: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
io.StringIO: 112e. オブジェクトや *note array: 8. モジュールを試してくだ
さい:

     >>> 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: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？,  Prev: 文字列をインプレースに変更するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.7 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？
.......................................................................

様々なテクニックがあります。

   * 一番いいのは、文字列を関数に対応させる辞書を使うことです。このテク
     ニックの一番の利点は、文字列が関数の名前と同じ必要がないことです。
     この方法は case 構造をエミュレートするための一番のテクニックでもあ
     ります:

          def a():
              pass

          def b():
              pass

          dispatch = {'go': a, 'stop': b}  # 注意：関数にはカッコなし

          dispatch[get_input()]()  # 注意：関数を呼び出すには末尾カッコ

   * 組み込み関数の *note getattr(): dce. を使う方法:

          import foo
          getattr(foo, 'bar')()

     なお、 *note getattr(): dce. はクラス、クラスインスタンス、モジュー
     ルなど、どんなオブジェクトにも使えます。

     これは標準ライブラリでも何箇所か使われています。このように:

          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: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？,  Next: Is there a scanf or sscanf equivalent?,  Prev: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.8 文字列から後端の改行を取り除く Perl の ‘chomp()’ に相当するものはありますか？
......................................................................................

‘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: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？,  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(): 10ae.
method of string objects and then convert decimal strings to numeric
values using *note int(): 19c. or *note float(): 197.  ‘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: 14c0. を参照して下さい。


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(): 1a07. を使ってバックスラッシュを追加
することもできます:

     >>> os.path.join(r'C:\this\will\work', '')
     'C:\\this\\will\\work\\'

注意点として、バックスラッシュは raw string 終端のクォートを「エスケープ
」しますが、 raw string の値を解釈する際にはエスケープが生じません。つま
り、バックスラッシュは raw string 値の中に残ったままになります:

     >>> r'backslash\'preserved'
     "backslash\\'preserved"

*note 言語リファレンス: 22fb. の仕様も参照してください。


File: python.info,  Node: 性能<4>,  Next: Sequences tuples/lists,  Prev: 数と文字列,  Up: プログラミング FAQ

10.2.4 性能
-----------

* Menu:

* プログラムが遅すぎます。どうしたら速くなりますか？::
* 多くの文字列を結合するのに最も効率的な方法は何ですか？::


File: python.info,  Node: プログラムが遅すぎます。どうしたら速くなりますか？,  Next: 多くの文字列を結合するのに最も効率的な方法は何ですか？,  Up: 性能<4>

10.2.4.1 プログラムが遅すぎます。どうしたら速くなりますか？
...........................................................

That's a tough one, in general.  First, here is a list of things to
remember before diving further:

   * 性能の傾向は Python 実装によって変わります。この FAQ では *note
     CPython: 906. に焦点を当てます。

   * 振る舞いはオペレーティングシステムによって変わりえます。特に、I/O や
     マルチスレッドに関しては顕著です。

   * 常に、コードの最適化を始める '前に' プログラムのホットスポットを見
     つけるべきです (*note profile: b4. モジュールを参照してください)。

   * ベンチマークスクリプトを書くことで、改善箇所の捜索を素早く繰り返せ
     ます (*note timeit: f5. モジュールを参照してください)。

   * 洗練された最適化に隠れたリグレッションの可能性を生む前に、(ユニット
     テストやその他の技法で) コードカバレッジを上げることを強く推奨しま
     す。

とは言っても、Python コードを高速化する技法はたくさんあります。ここでは
、満足な性能のレベルにたどり着くまでの長い道のりを進む、一般的な方針を示
します:

   * コード中に細かい最適化の技法をばらまこうとするよりも、アルゴリズム
     を高速化 (または高速なアルゴリズムに変更) するほうが、大きな利益を
     生むことがあります。

   * 適切なデータ構造を使ってください。*note 組み込み型: 2648. や *note
     collections: 1e. を調べてください。

   * 何かをするための基本要素が標準ライブラリにあるなら、自分で発明した
     代用品よりもそちらのほうが、(絶対にとは言えませんが) おそらく速いで
     す。 それが組み込み型やある種の拡張型のように C で書かれたものなら
     なおさらです。 たとえば、ソートするには、必ず *note list.sort():
     dcc. 組み込みメソッドか *note sorted(): dcb. 関数を使ってください
     (また、中程度に高度な例は、 *note ソートのテクニック: 13f7. を参照
     してください)。

   * 抽象化は、遠回りにしがちで、インタプリタの作業を増やすことになりま
     す。この遠回りさが、なされる作業の量より重大になると、プログラムが
     遅くなってしまいます。過度な抽象化、特に細かい関数やメソッドの形で
     現れるもの (これは読みにくさも落とします) は防ぐべきです。

pure Python にできる限界に達したなら、更に進むためのツールがあります。例
えば、Cython(1) は、Python コードのわずかに変形した版を C 拡張にコンパイ
ルし、多種のプラットフォームで使えます。Cython は、コンパイル (と任意の
型アノテーション) を利用し、コードの解釈を大幅に速くします。C プログラミ
ングに自信があるなら、自分で *note write a C extension module: 2019. こ
ともできます。

参考
....

パフォーマンス 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: 16a. および *note bytes: 193. オブジェクトはイミュータブルな
ので、多くの文字列の結合は結合ごとに新しいオブジェクトを作成し、効率が悪
いです。 一般的に、全体の実行時間のコストは文字列の長さの二乗に比例しま
す。

多くの *note str: 16a. オブジェクトを累積するのにおすすめのイディオムは
、すべてをリストに配置してから最後に *note str.join(): 2668. を呼び出す
ことです:

     chunks = []
     for s in my_strings:
         chunks.append(s)
     result = ''.join(chunks)

(Another reasonably efficient idiom is to use *note io.StringIO: 112e.)

多くの *note bytes: 193. オブジェクトを累積するのにおすすめのイディオム
は、 *note bytearray: 342. オブジェクトをインプレース結合 (‘+=’ 演算子)
で拡張することです:

     result = bytearray()
     for b in my_bytes_objects:
         result += b


File: python.info,  Node: Sequences tuples/lists,  Next: オブジェクト,  Prev: 性能<4>,  Up: プログラミング FAQ

10.2.5 Sequences (tuples/lists)
-------------------------------

* Menu:

* タプル、リスト間の変更はどのようにするのですか？::
* 負の添え字は何ですか？::
* シーケンスを逆順にイテレートするにはどうしたらいいですか？::
* リストから重複を取り除くにはどうしますか？::
* How do you remove multiple items from a list?::
* Python で配列を作るにはどうしますか？::
* 多次元のリストを作るにはどうしますか？::
* オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？::
* なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?::
* 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？::
* リストを別のリストの値によってソートするにはどうしますか？::


File: python.info,  Node: タプル、リスト間の変更はどのようにするのですか？,  Next: 負の添え字は何ですか？,  Up: Sequences tuples/lists

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: Sequences tuples/lists

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: Sequences tuples/lists

10.2.5.3 シーケンスを逆順にイテレートするにはどうしたらいいですか？
...................................................................

組み込み関数 *note reversed(): a69. を使ってください。

     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: Sequences tuples/lists

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]

If all elements of the list may be used as set keys (that is, they are
all *note hashable: 824.) this is often faster:

     mylist = list(set(mylist))

リストを集合に変換するときに重複は取り除かれるので、それをリストに戻せば
いいのです。


File: python.info,  Node: How do you remove multiple items from a list?,  Next: Python で配列を作るにはどうしますか？,  Prev: リストから重複を取り除くにはどうしますか？,  Up: Sequences tuples/lists

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: Sequences tuples/lists

10.2.5.6 Python で配列を作るにはどうしますか？
..............................................

リストを使ってください:

     ["this", 1, "is", "an", "array"]

リストの時間計算量は C や Pascal の配列と同じです。大きな違いは、Python
のリストは多くの異なる型のオブジェクトを含めることです。

The ‘array’ module also provides methods for creating arrays of fixed
types with compact representations, but they are slower to index than
lists.  Also note that NumPy(1) and other third-party packages define
array-like structures with various characteristics as well.

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: Sequences tuples/lists

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: Sequences tuples/lists

10.2.5.8 オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？
.............................................................................

To call a method or function and accumulate the return values in a list,
a *note list comprehension: 8de. is an elegant solution:

     result = [obj.method() for obj in mylist]

     result = [function(obj) for obj in mylist]

戻り値を保存せずにメソッドや関数を実行するだけなら、ただの *note for:
348. ループで十分です:

     for obj in mylist:
         obj.method()

     for obj in mylist:
         function(obj)


File: python.info,  Node: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?,  Next: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？,  Prev: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？,  Up: Sequences tuples/lists

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__(): 243f. 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(): 2439. 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: Sequences tuples/lists

10.2.5.10 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？
.............................................................................

Perl コミュニティの Randal Schwartz の作とされるこのテクニックは、リスト
の要素を、それぞれの要素をその「ソート値」に対応付けるメトリックによって
ソートします。Python では、 *note list.sort(): dcc. メソッドに ‘key’ 引
数を使ってください:

     Isorted = L[:]
     Isorted.sort(key=lambda s: int(s[10:15]))


File: python.info,  Node: リストを別のリストの値によってソートするにはどうしますか？,  Prev: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？,  Up: Sequences tuples/lists

10.2.5.11 リストを別のリストの値によってソートするにはどうしますか？
....................................................................

Merge them into an iterator of tuples, sort the resulting list, and then
pick out the element you want.

     >>> 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: Sequences tuples/lists,  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'
を明示しなければならないのですか？: 5c9d. も参照してください。


File: python.info,  Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？,  Next: 委譲とは何ですか？,  Prev: self とは何ですか？,  Up: オブジェクト

10.2.6.4 あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？
.............................................................................................................

Use the built-in function *note isinstance(obj, cls): 2af.  You can
check if an object is an instance of any of a number of classes by
providing a tuple instead of a single class, for example,
‘isinstance(obj, (class1, class2, ...))’, and can also check whether an
object is one of Python's built-in types, for example, ‘isinstance(obj,
str)’ or ‘isinstance(obj, (int, float, complex))’.

Note that *note isinstance(): 2af. also checks for virtual inheritance
from an *note abstract base class: 13d2.  So, the test will return
‘True’ for a registered class even if hasn't directly or indirectly
inherited from it.  To test for "true inheritance", scan the *note
method resolution order: 263e. (MRO) of the class:

     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(): 2af. をユーザー定義の
クラスに何度も使うべきではありません。クラスを自分で開発するときに、適切
なオブジェクト指向スタイルは、特定の振る舞いをカプセル化するクラスのメソ
ッドを定義するものであって、オブジェクトのクラスを調べてそのクラスに応じ
て違うことをするものではありません。例えば、何かをする関数があったとして
:

     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 is an object-oriented technique (also called a design
pattern).  Let's say you have an object ‘x’ and want to change the
behaviour of just one of its methods.  You can create a new class that
provides a new implementation of the method you're interested in
changing and delegates all other methods to the corresponding method of
‘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 言語リファレンス: 240f. を
参照してください。

なお、一般的に委譲はトリッキーになりがちです。属性が設定される時には読み
出される時と同様に、そのクラスに *note __setattr__(): 23d8. メソッドを定
義する必要があり、それには細心の注意が必要です。 ‘__setattr__()’ の基本
的な実装はおおよそ以下のようになります:

     class X:
         ...
         def __setattr__(self, name, value):
             self.__dict__[name] = value
         ...

Many *note __setattr__(): 23d8. 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(): 1a7. 関数を使ってください:

     class Derived(Base):
         def meth(self):
             super().meth()  # calls Base.meth

この例では、 *note super(): 1a7. は呼ばれたインスタンス (‘self’ の値) を
自動判断し、 ‘type(self).__mro__’ で *note method resolution order:
263e. (MRO メソッド解決順) を検索し、そしてMRO内で ‘Derived’ の次行を返
します: ‘Base’ 。


File: python.info,  Node: 基底クラスの名前を変えやすいコードを書くにはどうしますか？,  Next: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？,  Prev: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？,  Up: オブジェクト

10.2.6.7 基底クラスの名前を変えやすいコードを書くにはどうしますか？
...................................................................

You could assign the base class to an alias and derive from the alias.
Then all you have to change is the value assigned to the alias.
Incidentally, this trick is also handy if you want to decide dynamically
(such as depending on availability of resources) which base class to
use.  Example:

     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 でコンストラクタ(やメソッド)をオーバーロードするにはどうしたらいいですか？
..........................................................................................

この質問の答えはすべてのメソッドについて言えることですが、この質問はだい
たい以下の構造の文脈から出てきます。

In C++ you'd write:

     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)

これで完全に等価とは言えませんが、実用上は十分に近いです。

You could also try a variable-length argument list, for example:

     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: 20ff. 。


File: python.info,  Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。,  Next: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？,  Prev: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。,  Up: オブジェクト

10.2.6.11 クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。
.....................................................................................................

いくつかの可能性があります。

*note del: 1b7e. 文は必ずしも *note __del__(): 1203. を呼び出すとは限り
ません - これは単純にオブジェクトの参照カウントを減らすもので、カウント
がゼロになったときに ‘__del__()’ が呼び出されます。

If your data structures contain circular links (for example, a tree
where each child has a parent reference and each parent has a list of
children) the reference counts will never go back to zero.  Once in a
while Python runs an algorithm to detect such cycles, but the garbage
collector might run some time after the last reference to your data
structure vanishes, so your ‘__del__()’ method may be called at an
inconvenient and random time.  This is inconvenient if you're trying to
reproduce a problem.  Worse, the order in which object's ‘__del__()’
methods are executed is arbitrary.  You can run *note gc.collect(): 1b5.
to force a collection, but there 'are' pathological cases where objects
will never be collected.

循環参照コレクタがあるとはいえ、オブジェクトに ‘close()’ メソッドを明示
的に定義し、使い終わったらいつでも呼び出せるようにするのはいいことです。
‘close()’ メソッドを使うと、サブオブジェクトを参照している属性を取り除け
ます。 ‘__del__()’ を直接呼び出さないでください - ‘__del__()’ は
‘close()’ を呼び出すでしょうし、 ‘close()’ なら同じオブジェクトに対して
複数回呼ばれてもいいことが保証されているでしょう。

循環参照を避ける他の方法は、 *note weakref: 11b. モジュールを使って、参
照カウントを増やすことなくオブジェクトを示すことです。例えばツリー構造は
、親と (必要なら！) 兄弟に弱参照を使うべきです。

最後に、 ‘__del__()’ メソッドが例外を発生させた場合、警告のメッセージが
*note sys.stderr: b37. に書きこまれます。


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(): 1641. は、オブジェクトが生存している間は一意なこ
とが保証されている整数値を返します。 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: 19c. や
*note str: 16a. などの定数をチェックするために同一性テストを使わないでく
ださい。

     >>> a = 10_000_000
     >>> b = 5_000_000
     >>> c = b + 5_000_000
     >>> 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__(): 8c0. ではなく
*note __new__(): 7a0. メソッドを継承します。 前者はインスタンスが生成さ
れた '後' に動くため、イミュータブルなインスタンスのデータを変えるには遅
すぎます。

これらのイミュータブルクラスはすべて、親クラスと異なるシグネチャを持ちま
す:

     import datetime as dt

     class FirstOfMonthDate(dt.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(): be6. で
す。前者はインスタンスレベル、後者はクラスレベルで結果を保存します。

The ‘cached_property’ approach only works with methods that do not take
any arguments.  It does not create a reference to the instance.  The
cached method result will be kept only as long as the instance is alive.

利点は、インスタンスが使われなくなった場合、キャッシュされたメソッドの結
果がすぐに解放されることです。欠点は、インスタンスが溜まると、溜められた
メソッドの結果も増えてしまうことです。それらは際限なく増える恐れがありま
す。

The ‘lru_cache’ approach works with methods that have *note hashable:
824. arguments.  It creates a reference to the instance unless special
efforts are made to pass in 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.

The above example assumes that the 'station_id' never changes.  If the
relevant instance attributes are mutable, the ‘cached_property’ approach
can't be made to work because it cannot detect changes to the
attributes.

To make the ‘lru_cache’ approach work when the 'station_id' is mutable,
the class needs to define the *note __eq__(): cf6. and *note __hash__():
cf7. methods so that the cache can detect relevant attribute updates:

     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__’ サブディレクトリが作れない問題です。これは
、例えば、ウェブサーバーでテストを行っているときのような、開発者のユーザ
と実行者のユーザが別な場合に、起こり得ます。

Unless the *note PYTHONDONTWRITEBYTECODE: 15ec. environment variable is
set, creation of a .pyc file is automatic if you're importing a module
and Python has the ability (permissions, free space, and so on) to
create a ‘__pycache__’ subdirectory and write the compiled module to
that subdirectory.

Running Python on a top-level script is not considered an import and no
‘.pyc’ will be created.  For example, if you have a top-level module
‘foo.py’ that imports another module ‘xyz.py’, when you run ‘foo’ (by
typing ‘python foo.py’ as a shell command), a ‘.pyc’ will be created for
‘xyz’ because ‘xyz’ is imported, but no ‘.pyc’ file will be created for
‘foo’ since ‘foo.py’ isn't being imported.

‘foo’ の ‘.pyc’ ファイルを作成する - つまり、インポートされていないモジ
ュールの ‘.pyc’ ファイルを作成する - 必要がある場合、 *note py_compile:
b8. モジュールと *note compileall: 21. モジュールを使えば可能です。

*note py_compile: b8. モジュールは手動で任意のモジュールをコンパイルでき
ます。やり方の一つは、このモジュールの ‘compile()’ 関数をインタラクティ
ブに実行することです:

     >>> import py_compile
     >>> py_compile.compile('foo.py')

This will write the ‘.pyc’ to a ‘__pycache__’ subdirectory in the same
location as ‘foo.py’ (or you can override that with the optional
parameter '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)

Warning: this technique is not 100% fool-proof.  In particular, modules
containing statements like:

     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: 197. 型は C 言語の ‘double’ 型をデータ格納
先に使います。 ‘float’ オブジェクトの値は固定精度 (典型的には 53 bit) の
2 進浮動小数点数で格納されます。 そして Python は浮動小数点演算を行うた
めに C の演算を使いますが、これはプロセッサのハードウェア実装に依存しま
す。つまり、浮動小数点数に関して Python は C 言語や Java を含む多くの一
般的な言語と同じように振る舞います。

10 進数表記 (decimal) で簡単に表せる数値でも、その多くは 2 進浮動小数点
数 (binary) で正確に表現できません。 たとえば次では

     >>> x = 1.2

‘x’ に保存された値は 10 進数の ‘1.2’ の (とても高い精度の) 近似値であっ
て、厳密な ‘1.2’ ではありません。一般的なコンピューターでは、実際に格納
される値は:

     1.0011001100110011001100110011001100110011001100110011 (binary)

で、正確には次の値です:

     1.1999999999999999555910790149937383830547332763671875 (decimal)

典型的な 53bit 精度は、Python の float に 10 進数での 15〜16 桁の正確さ
を与えます。

詳しくは、Python チュートリアルの *note floating-point arithmetic: 215c.
の章を参照してください。


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__(): 8c0. メソッドに便利ですし、派生クラスの
メソッドが、基底クラスにある同じ名前のメソッドを拡張するために、基底クラ
スのメソッドをどうにかして呼び出したい時にも便利です。

最後に、インスタンス変数に対する、代入の構文の問題を解決できます。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） 幾つかの演算では、接頭辞は接尾辞よりも単純に読みやすいからで
     す。接頭辞（そして接中辞！）による演算は数学において長い歴史があり
     、そこでは課題に対する数学者の思考を視覚的に助けるような記法が好ま
     れます。x*(a+b)をx*a + x*bに書き換える容易さと、それと同じことを純
     粋なオブジェクト指向の記法で行う煩わしさを比較してみてください。

     （b） len(x) というコードを読んだ時、私はそれが何かの長さを問うてい
     るのだなと知ることができます。これは私に2つの事を知らせています。一
     つは結果が整数であること、そして引数は何らかのコンテナであることで
     す。対して、 x.len() を目にした場合、私はその時点でxが何らかのコン
     テナであり、それが標準のlen()を持っているクラスを継承しているか、イ
     ンターフェースを実装していることを知っている必要があります。
     mapping を実装していないクラスが get() や keys() メソッドを持ってい
     たり、 file でない何かが write() メソッドを持っているような混乱は時
     折見かけます。

-- ‘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(): 10ae. を文字列のメソッド
としておいた方がはるかに簡単です。これを見ると分かりやすいでしょう

     "1, 2, 4, 8, 16".split(", ")

これは文字列リテラルに対する、与えられたセパレータ (または、デフォルトで
は任意の空白文字の連続) で区切られた部分文字列を返せという指示です。

*note join(): 2668. は、セパレータ文字列に、文字列のシーケンスをイテレー
トして隣り合う要素の間に自身を挿入するように指示しているので、文字列のメ
ソッドです。このメソッドは、独自に定義された新しいクラスを含め、シーケン
スの規則を満たすいかなる引数にも使えます。バイト列やバイト配列にも同様の
メソッドがあります。


File: python.info,  Node: 例外はどれくらい速いのですか？,  Next: Python に switch や case 文がないのはなぜですか？,  Prev: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.9 例外はどれくらい速いのですか？
-------------------------------------

*note try: 8f9./*note except: 1ac. ブロックは例外が送出されなければ極端
に効率的です。実際に例外を捕捉するのは高価です。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(): dce.
組み込み関数で特定の名前のメソッドを検索できます:

     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) は、 オプションアノテーションを付けた 修正バージョンの Python
から C 拡張 にコンパイルします。 Nuitka(2) は Python から C++ コードへの
有望なコンパイラで、 フルセットの Python 言語サポートを目指しています。

   ---------- 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 の標準実装である
*note CPython: 906. は、参照カウントを使ってアクセスできない（訳注：参照
されえない）オブジェクトを検出し、そして別の仕組みで参照サイクル（循環参
照）を集めます。サイクル検出アルゴリズムを定期的に実行し、アクセスできな
いサイクルを見つけて一連のオブジェクトを削除します。 *note gc: 64. モジ
ュールは、ガベージコレクションの実行、デバッグ統計の取得、コレクタのパラ
メータ調整を行う関数を提供します。

ただし、他の実装（ Jython(1) や PyPy(2) など）では、本格的なガベージコレ
クタのような別の仕組みを用いているかもしれません。 この違いは微妙な移植
の問題を起こす可能性があります。もし あなたの Python コードが参照カウン
ト実装の振る舞いに依存している場合には。

Python の実装によっては、以下の (CPython では通る) コードはおそらく、フ
ァイルディスクリプタを使い果たすでしょう:

     for file in very_long_list_of_files:
         f = open(file)
         c = f.read(1)

実際、CPython の参照カウントとデストラクタのスキームを使えば ‘f’ への新
しい代入ごとにファイルは閉じられます。しかし、伝統的な GC を使うと、これ
らのファイルオブジェクトが回収され (て閉じられる) までに不定な、場合によ
っては長い、間隔が空くことがあります。

Python の実装に依らずに動くコードを書くには、ファイルを明示的に閉じるか
、 *note with: 187. 文を使ってください。これでメモリ管理のスキームに関係
なく動きます:

     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('.'): 1316. はカレントディレクトリ内にあるファイルの文
字列表現のリストを返します。この出力を演算する関数は一般に、ディレクトリ
に一つや二つの別のファイルを加えても壊れません。

Tuples are immutable, meaning that once a tuple has been created, you
can't replace any of its elements with a new value.  Lists are mutable,
meaning that you can always change a list's elements.  Only immutable
elements can be used as dictionary keys, and hence only tuples and not
lists can be used as keys.


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: 34a. ではないというこ
     とです。

   - リストをキーとして使うときにコピーを作る。リストはミュータブルなの
     で、自分自身への参照を含むことができ、コードをコピーするときに無限
     ループにハマる可能性があるので、これは駄目です。

   - リストをキーとして使うことを認めるが、ユーザにそれを変更させないよ
     うに伝える。もしユーザが忘れたり、偶然にリストが変更されてしまった
     りしたら、追跡困難なバグの可能性を生じてしまいます。またこれは、
     ‘d.keys()’ のすべての値は辞書のキーとして使えるという、辞書の重要な
     不変性も潰してしまいます。

   - リストが一旦辞書のキーとして使われたら、読み出し専用のマークを付け
     る。問題は、値を変えられるのはトップレベルオブジェクトだけではない
     ことです。リストを含むタプルもキーとして使えます。全てを辞書のキー
     として導入すると、そこから到達可能な全てのオブジェクトに読み出し専
     用のマークを付ける必要があります - そして再び、自己参照オブジェクト
     が無限ループを引き起こします。

必要ならばこれを回避する方法がありますが、自己責任のもとで行ってください
。ミュータブルな構造を、 *note __eq__(): cf6. と *note __hash__(): cf7.
メソッドの両方を持つクラスインスタンスに含めることができます。その時、辞
書 (またはハッシュに基づく別の構造体) に属するような全てのラッパーオブジ
ェクトのハッシュ値が、そのオブジェクトが辞書 (その他の構造体) 中にある間
固定され続けることを確実にしてください。

     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(): dcc. はインプレース
にリストをソートします。このことを忘れないため、この関数はソートされたリ
ストを返しません。こうすることで、ソートされたコピーが必要で、ソートされ
ていないものも残しておきたいときに、うっかり上書きしてしまうようなことが
なくなります。

新しいリストを返したいなら、代わりに組み込みの *note sorted(): dcb. 関数
を使ってください。この関数は、与えられたイテレート可能オブジェクトから新
しいリストを生成し、ソートして返します。例えば、辞書のキーをソートされた
順序でイテレートする方法は:

     for key in sorted(mydict):
         ...  # 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(): 2af. と *note issubclass(): 9c8. を使って、インスタンスや
クラスが、ある ABC を実装しているかどうかチェックできます。*note
collections.abc: 1f. モジュールでは、 *note Iterable: 2707. 、 *note
Container: 2709. 、 *note MutableMapping: 12c4. などの便利な ABC が定義
されています。

Pythonでは、インターフェース仕様の多くの利点は、コンポーネントへの適切な
テスト規律により得られます。

モジュールのための適切なテストスイートは、回帰テストを提供し、モジュール
のインターフェース仕様や用例集としても役立ちます。多くの Python モジュー
ルは、簡単な「自己テスト」を提供するスクリプトとして実行できます。複雑な
外部インターフェースを使うモジュールさえ、外部インターフェースの細かい「
スタブ」エミュレーションで単独にテストできることが多いです。 *note
doctest: 3e. や *note unittest: 10d. モジュール、あるいはサードパーティ
のテストフレームワークで、モジュールのコードの全ての行に及ぶ徹底的なテス
トスイートを構成できます。

Python で大きくて複雑なアプリケーションを構築するとき、インターフェース
仕様と同様に、適切なテスト規律も役立ちます。 実際には、インターフェース
仕様ではテストできないプログラムの属性もあるので、それ以上にもなりえます
。 例えば、 *note list.append(): 8dd. メソッドは新しい要素をある内部リス
トの終わりに加えます。インターフェース仕様ではこの ‘list.append()’ の実
装が実際にこれを行うかをテストできませんが、テストスイートならこの機能を
簡単に確かめられます。

テストスイートを書くことはとても有用ですし、簡単にテストできるコード設計
を心がけると良いでしょう。人気を博している開発手法の一つ、テスト駆動開発
は、実際のコードを記述するよりも先に、まずテストスイートの部分を記述する
よう求めています。ご心配なく、Python は、あなたがいい加減でもテストケー
スを全く書かなくても構いません。


File: python.info,  Node: なぜ goto が無いのですか？,  Next: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？,  Prev: Python ではどのようにインターフェース仕様を特定し適用するのですか？,  Up: デザインと歴史 FAQ

10.3.23 なぜ goto が無いのですか？
----------------------------------

1970年代、人々は気付きました。秩序なき goto は、理解するのも手直しするの
も困難という厄介な"スパゲッティ"コードに陥りがちであると。 高水準言語で
は、分岐とループの手段があれば goto は不要です。 (Pythonだと、分岐には
*note if: 182. 文及び *note or: 34b. ・ *note and: 347. ・ ‘if’/*note
else: 17d. 式を使います。ループには *note while: 19d3. 文と *note for:
348. 文を使い、 ループ内に *note continue: 181. ・ *note break: 180. を
含むことがあります)

関数の呼び出しをまたいでも動作する "構造化された goto" をまかなうものと
して例外を使えます。C、Fortran、その他の言語での ‘go’ あるいは ‘goto’ 構
造の適切な用途は全て、例外で同じようなことをすれば便利であると、広く感じ
られています。例えば:

     class label(Exception): pass  # declare a label

     try:
         ...
         if condition: raise label()  # goto label
         ...
     except label:  # 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")  # 正常に動く！

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: 187. 文があり、ブロックに
入るときとブロックから出るときに、コードを呼び出します。以下のような構造
を持つ言語があります:

     with obj:
         a = 1               # これに相当： 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: 187. ブロッ
クの中で使われるのでしょうか。この通り、Python の動的な特質から、このよ
うな選択はとても難しい物になっています。

しかし、*note with: 187. やそれに類する言語の機能の一番の利点 (コード量
の削減) は、 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: 187. 文で *note contextlib.closing(generator): 15a5. のようにラッ
プします。


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],  # 最後のカンマはオプションだが良いスタイル
     }

これを許すのには、いくつかの理由があります。

リストやタプルや辞書のリテラルが複数行に渡っているときに、前の行にカンマ
を追加するのを覚えておく必要が無いため、要素を追加するのが楽になります。
また、文法エラーを起こすこと無く、行の並べ替えを行うことができます。

間違えてカンマを落としてしまうと、診断しづらいエラーにつながります。例え
ば:

     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 ライブラリリファンレス: 14a. から関係がありそうな標準ライブラリモ
ジュールがあるかどうか調べてください。 (標準ライブラリに何があるかが分か
るようになると、この段階をスキップすることができます。)

サードパーティのパッケージについては、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: 10d. モジュールは、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. モジュー
ルを使ってください。 ‘threading’ モジュールは、 ‘_thread’ モジュールで提
供される低レベルな基本要素の、便利な抽象化を構成します。


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(): 8ad. の良い遅延時間を推測しようとするよりも、セマフ
ォのような仕組みを使う方が良いでしょう。 1 つのアイディアは *note queue:
bb. モジュールを使って、キューオブジェクトを作り、各スレッドが完了したと
きにキューにトークンを追加し、メインスレッドにスレッドと同じ数のトークン
をキューから読み出させることです。


File: python.info,  Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Next: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Prev: スレッドが一つも実行されていないようです。なぜですか？,  Up: スレッド

10.4.3.3 たくさんのワーカースレッドに作業を割り振るにはどうしますか？
.....................................................................

最も簡単な方法は、新しい *note concurrent.futures: 24. モジュール、特に
*note ThreadPoolExecutor: 94d. クラスを使うことです。

もしくは、実行アルゴリズムを上手にコントロールしたい場合は、自身の手でロ
ジックを書くこともできます。 *note queue: bb. モジュールを使って、ジョブ
のリストを含むキューを作ってください。 *note Queue: 15b0. クラスはオブジ
ェクトのリストを保持し、キューに要素を追加する ‘.put(obj)’ メソッド、そ
れら要素を返す ‘.get()’ メソッドを持っています。このクラスは、それぞれの
ジョブがきっちり 1 回だけ取り出されることを保証するのに必要なロック処理
にも配慮します。

ここにちょっとした例があります:

     import threading, queue, time

     # ワーカースレッドはキューからジョブを取り出す。キューが空になれば、
     # それ以上の作業はないとして終了 (exit) する。
     # （現実的には ワーカーは終了する (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)

     # キュー作成
     q = queue.Queue()

     # ５つのワーカープールをスタート
     for i in range(5):
         t = threading.Thread(target=worker, name='worker %i' % (i+1))
         t.start()

     # キューへの作業追加を開始
     for i in range(50):
         q.put(i)

     # スレッドの作業時間を確保
     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:
15b0. クラスは多機能なインターフェースを提供しています。


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(): b48. で設定できます。したがって
、それぞれのバイトコード命令、そしてそれぞれの命令が届く全ての 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__(): 1203. メソッドを呼び出すことがあり
、これが影響を及ぼすかもしれません。これは特に、辞書やリストの大規模な更
新に当てはまります。疑わしければ、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 がこの作業を含む最初のリリースになる可能性がありますが、こ
のリリースで完全に機能するとは限りません。

GIL 削除に向けた現在の取り組みは fork of Python 3.9 with the GIL
removed(2) by Sam Gross をベースとしています。それ以前 Python 1.5 の時代
には、 Greg Stein が実際に、 GIL を取り除き よりきめ細かいロッキングに置
き換える包括的なパッチセット ("free threading" パッチ) を実装しました。
Adam Olsen は python-safethread(3) プロジェクトで同様の実験を行いました
。 残念ながら、これら初期の実験はどちらも シングルスレッドのパフォーマン
スの極端な低下 (少なくとも 30% の遅れ) を示しましたが、それは GIL の削除
を補うために必要なきめ細かいロッキングの量のためでした。 Python 3.9 fork
は、許容可能なパフォーマンス影響にて GIL を取り除こうとする最初の試みで
す。

現行の Python リリースに GIL が搭載されていることは、マルチ CPU マシン上
で Python を使いこなせないことを意味しません！ 作業を複数の 'スレッド' で
はなく複数の 'プロセス' に分けることを考えればいいのです。 その簡単な方
法は新しい *note concurrent.futures: 24. モジュールの *note
ProcessPoolExecutor: 1d8. クラスが提供しますが、タスクのディスパッチをよ
り深く制御したい場合には *note multiprocessing: 98. モジュールがより低水
準な API を提供しています。

C 拡張をうまく使うことも役立ちます。C 拡張を時間のかかるタスクの実行に使
えば、その拡張は実行が C コードで行われている間 GIL を解放でき、その間に
他のスレッドで作業が進められます。 *note zlib: 13a. や *note hashlib:
6c. など、すでにこれを行なっている標準ライブラリモジュールもあります。

GIL の影響を減らす別のアプローチとして、 GIL を真にグローバルなロックで
はなく、インタープリタごとのロックにするというものがあります。これは
*note Python 3.12 で初めて実装され: 670. C API で利用できます。 Python の
インターフェースは Python 3.13 で利用可能となる予定です。現時点での主な
制約はサードパーティー製の拡張モジュールで、使えるようにするには複数のイ
ンタープリタを想定して書く必要があるため、多くの古い拡張モジュールは使え
なくなります。

   ---------- 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(): 1311. は単に、この関数の Unix システ
ムコールの名称です。

ディレクトリを削除するには、*note os.rmdir(): 130f. を使ってください。作
成には *note os.mkdir(): 52b. を使ってください。‘os.makedirs(path)’ は
‘path’ の中間のディレクトリの、存在しないものを作成します。
‘os.removedirs(path)’ は中間のディレクトリが空である限り、それらを削除し
ます。ディレクトリツリー全体とその中身全てを削除したいなら、*note
shutil.rmtree(): 354. を使ってください。

ファイルの名前を変更するには、‘os.rename(old_path, new_path)’ を使ってく
ださい。

ファイルを切り詰めるには、 ‘f = open(filename, "rb+")’ を使ってファイル
を開き、 ‘f.truncate(offset)’ を使ってください; offset はデフォルトでは
現在のシーク位置です。 *note os.open(): f96. で開かれたファイル用の
‘os.ftruncate(fd, offset)’ もあります。 'fd' はファイルディスクリプタ (小
さい整数値) です。

*note shutil: ca. モジュールにも、*note copyfile(): c52.、 *note
copytree(): c22.、*note rmtree(): 354. 等、ファイルに作用する関数がいく
つか含まれます。


File: python.info,  Node: ファイルをコピーするにはどうしますか？,  Next: バイナリデータを読み書きするにはどうしますか？,  Prev: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問,  Up: 入力と出力<2>

10.4.4.2 ファイルをコピーするにはどうしますか？
...............................................

*note shutil: ca. モジュールに *note copyfile(): c52. 関数があります。注
意点として、これは Windows NTFS ボリューム上の alternate data streams(1)
も macOS HFS+ 上の resource forks(2) もコピーしません。ただし現在ではど
ちらも使われることは ほとんどありません。またファイルのパーミッションや
メタデータもコピーされませんが、この代わりに *note shutil.copy2(): c54.
を使うとそのほとんど (すべてではありませんが) が保持されます。

   ---------- 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(): 318. に渡して) ファイルをバイナリモードで開く義務があ
     ります。代わりに (デフォルトの) ‘"r"’ を使った場合は、ファイルはテ
     キストモードで開かれ、 ‘f.read()’ は *note bytes: 193. オブジェクト
     ではなく *note str: 16a. オブジェクトを返します。


File: python.info,  Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？,  Next: シリアル RS232 ポートにアクセスするにはどうしますか？,  Prev: バイナリデータを読み書きするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.4 os.popen() によって作られたパイプで os.read() が使われていないようです。なぜですか？
.............................................................................................

*note os.read(): f99. は、開かれたファイルを表す小さな整数、ファイルディ
スクリプタを引数に取る、低レベルの関数です。 *note os.popen(): 31c. は、
組み込みの *note open(): 318. 関数の返り値と同じ型の、高レベルなファイル
オブジェクトを作成します。従って、 ‘os.popen()’ によって作成されたパイプ
'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: 13df. は、低水準の C ファイルディスクリプタ
上の、抽象の高水準レイヤです。

組み込みの *note open(): 318. 関数によって生成されたほとんどのファイルオ
ブジェクトでは、 ‘f.close()’ は Python ファイルオブジェクトが Python の
視点からは閉じられているものとする印をつけ、その下にある C ファイルディ
スクリプタを閉じるように手配します。これは、 ‘f’ がガベージとなったとき
にも、 ‘f’ のデストラクタで自動的に起こります。

しかし、stdin、stdout、stderr は C で特別な立場が与えられていることから
、Python でも同様に特別に扱われます。‘sys.stdout.close()’ を実行すると、
Python レベルのファイルオブジェクトには閉じられているものとする印がつけ
られますが、C ファイルディスクリプタは '閉じられません'。

下にある C ファイルディスクリプタのうち、この三つのどれかを閉じるには、
まず本当に閉じる必要があることを確かめるべきです (例えば、拡張モジュール
の I/O を混乱させてしまうかもしれません)。本当に必要ならば、 *note
os.close(): d6f. を使ってください:

     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
インターネットプロトコルとサポート: 3f63. と *note
インターネット上のデータの操作: 3b5a. という章を参照してください。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 の場所
     p = os.popen("%s -t -i" % SENDMAIL, "w")
     p.write("To: receiver@example.com\n")
     p.write("Subject: test\n")
     p.write("\n")  # headers - 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(): fa7. したとき
に、即座に接続できるか、エラー番号を ‘.errno’ として含む例外を受け取るか
のどちらかになります。‘errno.EINPROGRESS’ は、接続が進行中であるが、まだ
完了していないということを示します。異なる OS では異なる値が返されるので
、あなたのシステムで何が返されるかを確かめておく必要があります。

*note connect_ex(): 1758. メソッドを使えば例外を生成しなくて済みます。こ
れは単に errno の値を返すでしょう。ポーリングのためには、後でまた
‘connect_ex()’ を呼び出すことができます - ‘0’ または ‘errno.EISCONN’ は
接続されたことを表します - または、このソケットを *note select.select():
fa4. に渡して書き込み可能か調べることができます。

     注釈: *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
インタプリタの拡張と埋め込み: 2019. で説明されています。

ほとんどの中級から上級の 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: 5212. 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(): 5290. で、一つの
文字列引数を取り、モジュール ‘__main__’ のコンテキストでそれを実行し、成
功なら ‘0’、例外 (*note SyntaxError: 18f. を含む) が発生したら ‘-1’ を返
します。更に制御したければ、 *note PyRun_String(): 1e1c. を使ってくださ
い。ソースは ‘Python/pythonrun.c’ の '‘PyRun_SimpleString()’ を参照して
ください。


File: python.info,  Node: C から任意の Python 式を評価するにはどうしますか？,  Next: Python オブジェクトから C の値を取り出すにはどうしますか？,  Prev: C から任意の Python 文を実行するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.5 C から任意の Python 式を評価するにはどうしますか？
---------------------------------------------------------

先の質問の *note PyRun_String(): 1e1c. を、スタートシンボル *note
Py_eval_input: 5545. を渡して呼び出してください。これは式を解析し、評価
してその値を返します。


File: python.info,  Node: Python オブジェクトから C の値を取り出すにはどうしますか？,  Next: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Prev: C から任意の Python 式を評価するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.6 Python オブジェクトから C の値を取り出すにはどうしますか？
-----------------------------------------------------------------

オブジェクトの型に依ります。タプルなら、 *note PyTuple_Size(): 545d. が
長さを返し、 *note PyTuple_GetItem(): 523c. が指定されたインデックスの要
素を返します。リストにも同様の関数 *note PyList_Size(): 1638. と *note
PyList_GetItem(): 5ff. があります。

bytes では、 *note PyBytes_Size(): 530c. がその長さを返し、 *note
PyBytes_AsStringAndSize(): 5304. がその値へのポインタと長さを提供します
。 Python の bytes オブジェクトは null を含むこともできるので、 C の
‘strlen()’ を使うべきではないことに注意してください。

オブジェクトの型を検査するには、まず最初にそれが ‘NULL’ でないことを確か
めた上で、 *note PyBytes_Check(): 15bb. 、 *note PyTuple_Check(): 5713.
、 *note PyList_Check(): 5724. などを使います。

いわゆる 'abstract' インターフェースから提供される、 Python オブジェクト
に対する高レベル API もあります - より詳しいことは ‘Include/abstract.h’
を読んでください。これを使うと、数値型プロトコル (*note
PyNumber_Index(): a97. など) や PyMapping API のマップ型プロトコルなどの
役に立つプロトコルに加え、 *note PySequence_Length(): 542d. や *note
PySequence_GetItem(): 1e90. などの任意の種類の Python シーケンスへのイン
ターフェースにアクセスできます。


File: python.info,  Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Next: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Prev: Python オブジェクトから C の値を取り出すにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.7 Py_BuildValue() で任意長のタプルを作るにはどうしますか？
---------------------------------------------------------------

できません。代わりに *note PyTuple_Pack(): 545c. を使ってください。


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(): 3c0. で使われるようなフォーマット文字列、そして引数です
:

     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(): 5231. の引数リストには '常に' タプル
が必要です。関数を引数なしで呼び出すには、フォーマットに "()" を渡し、関
数を一つの引数で呼び出すには、関数を括弧でくくって例えば "(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: cd1. と *note
sys.stderr: b37. に代入してください。print_error を呼び出すか、単に標準
のトレースバック機構を作動させてください。そうすれば、出力は ‘write()’ が
送る任意の所に行きます。

最も簡単な方法は、 *note io.StringIO: 112e. クラスを使うことです:

     >>> 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: 1791. に現れていない) なら、これはモジュールを初期化します
。そうでなければ、単純に ‘sys.modules["<modulename>"]’ の値を返します。
なお、これはモジュールをいかなる名前空間にも代入しません。これはモジュー
ルが初期化されて '‘sys.modules’ に保管されていることを保証するだけです。

これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以
下のようにアクセスできるようになります:

     attr = PyObject_GetAttrString(module, "<attrname>");

*note PyObject_SetAttrString(): 19ed. を呼んでモジュールの変数に代入する
こともできます。


File: python.info,  Node: Python から C++ へインターフェースするにはどうしますか？,  Next: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？,  Prev: C から Python で書かれたモジュールにアクセスするにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.11 Python から C++ へインターフェースするにはどうしますか？
----------------------------------------------------------------

やりたいことに応じて、いろいろな方法があります。手動でやるなら、 *note
"拡張と埋め込み" ドキュメント: 2019. を読むことから始めてください。なお
、Python ランタイムシステムにとっては、 C と C++ はあまり変わりません。
だから、C 構造体 (ポインタ)型に基づいて新しい Python の型を構築する方針
は C++ オブジェクトに対しても有効です。

C++ ライブラリに関しては、 *note C
を書くのは大変です。他の方法はありませんか？: 5cfa. を参照してください。


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(): 554d. を
(おそらく別のスレッドで) 呼び出し、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: 19c. 、 *note list: 24f. 、 *note dict: 184. などのビ
ルトインクラスから継承できます。

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(): 2646. 関数
を呼び出すか、 ‘Ctrl’ キーを押しながら ‘Z’ を入力し "‘Enter’" キーを押し
て、 Windows コマンドプロンプトに戻ってください。

スタート ‣ すべてのプログラム ‣ Python 3.x ‣ Python (command line) のよ
うな項目がスタートメニューに見付かるかもしれません。 これを起動すると、
新しいウィンドウに ‘>>>’ というプロンプトが見られるでしょう。その場合、
*note exit(): 2646. 関数を呼び出すか ‘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
スクリプトからスタンドアロンバイナリを作れますか？: 5c66. を参照してくだ
さい。


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: 1755. または *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: 438a. という 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’ でランタイムに指定することです。

py2exe や cx_Freeze など いくつかのサードパーティ製凍結ライブラリは、
Tkinter アプリケーション組み込みの機能を持ちます。


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 File handlers: 4614. を参照してください。


File: python.info,  Node: Tkinter で働くキーバインディングが得られません。なぜですか？,  Prev: I/O を待つ間に扱われる Tk イベントを作れますか？,  Up: Tkinter の質問

10.7.3.3 Tkinter で働くキーバインディングが得られません。なぜですか？
.....................................................................

‘bind()’ メソッドでイベントに *note 結び付けられた: 43b9. イベントハンド
ラが、適切なキーが押されたときにさえハンドルされないという苦情がよく聞か
れます。

最も一般的な原因は、バインディングが適用されるウィジェットが "キーボード
フォーカス" を持たないことです。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__: 323. on a module while failing to
          set *note __spec__.cached: 324. 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__: 325. on a module while failing to
          set *note __spec__.parent: 326. 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: 327.
          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 pathlib: a8.:

        * *note PurePath.is_reserved(): 328. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 329. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32a. 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(): 32b. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32c. 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: 10a.:

        * *note types.CodeType: 32d.: Accessing *note co_lnotab: 32e.
          was deprecated in PEP 626(3) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a4. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(4).)

   * *note typing: 10b.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 32f. 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: 330.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(): 331. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10b. module, it has yet to be
          supported by any major type checker.

   * *note wave: 11a.:

        * The *note getmark(): 332, ‘setmark()’, and *note getmarkers():
          333. methods of the *note Wave_read: 334. and *note
          Wave_write: 335. classes have been deprecated since Python
          3.13.

   * *note zipimport: 139.:

        * *note load_module(): 336. has been deprecated since Python
          3.10.  Use *note exec_module(): 337. instead.  (Contributed by
          Jiahao Li in gh-125746(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://peps.python.org/pep-0626/

   (4) https://github.com/python/cpython/issues/101866

   (5) 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__: 339. on a module while failing to
          set *note __spec__.loader: 33a. 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: 33b.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30f. 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: 310.

             * *note asyncio.DefaultEventLoopPolicy: 311.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 312.

             * *note asyncio.WindowsProactorEventLoopPolicy: 313.

             * *note asyncio.get_event_loop_policy(): 314.

             * *note asyncio.set_event_loop_policy(): 315.

          Users should use *note asyncio.run(): 2f5. or *note
          asyncio.Runner: 2f7. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 316. 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():
          21c. 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(): 31b.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ee. 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: 246.

   * *note symtable: de.:

        * The *note Class.get_methods: 31f. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33c. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33d. 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(): 33e. 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: 340. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 10b.:

        - 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(): 2ad. and *note
          typing.get_args(): 2ae. instead of relying on private
          implementation details.

        - *note typing.ByteString: 343, 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: 262. at runtime.  For
          use in type annotations, either use *note Buffer: 341. 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: 193. and
          *note bytearray: 342.  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:
          166. 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: 200. 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_: 319. but not *note _layout_: 1e9. 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(): 2ed. is now deprecated.

        * The *note argparse.FileType: 30e. 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:
          347, *note else: 17d, *note for: 348, *note if: 182, *note in:
          349, *note is: 34a. and *note or: 34b.  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: 19c.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 197.: these methods will be required to return
          an instance of ‘float’.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 198.: these methods will be required to
          return an instance of ‘complex’.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 198. 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:
     34c. and *note calendar.FEBRUARY: 34d.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 318. instead of *note
     codecs.open(): 317.  (gh-133038(4))

   * *note codeobject.co_lnotab: 32e.: use the *note
     codeobject.co_lines(): 34e. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 34f.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 350.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 351. '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(): 352. 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(): 353. 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(): 354.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 355. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 355.: *note set_npn_protocols(): 356.
          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():
          357.

        * ‘threading.Event.isSet()’: use *note is_set(): 358.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 359.: use *note
          threading.Thread.daemon: 35a. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35b.: use *note
          threading.Thread.name: 2a2. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35c.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35d.

   * *note typing.Text: 35e. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2aa.  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: 35f.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 111. deprecated functions: *note urlparse():
     360. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11f.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12c.: Testing the truth value of an
     *note Element: 361. 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(): 294. is deprecated: use *note
     sys._clear_internal_caches(): 362. 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(): 3d9.: Use *note
     PyImport_ImportModule(): 3da. instead.

   * *note PyWeakref_GetObject(): 3db. and *note PyWeakref_GET_OBJECT():
     3dc.: Use *note PyWeakref_GetRef(): 3dd. instead.  The
     pythoncapi-compat project(1) can be used to get
     ‘PyWeakref_GetRef()’ on Python 3.12 and older.

   * *note Py_UNICODE: 3de. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3df.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3df.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 16a, such as *note bytes: 193.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e0.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e0.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 193, such as *note str: 16a.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e1.: Use *note
          PyConfig_Get("module_search_paths"): 37a. (*note sys.path:
          3e2.) instead.

        * *note Py_GetPrefix(): 3e3.: Use *note
          PyConfig_Get("base_prefix"): 37a. (*note sys.base_prefix:
          3e4.) instead.  Use ‘PyConfig_Get("prefix")’ (*note
          sys.prefix: 3e5.) if *note virtual environments: 3e6. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e7.: Use *note
          PyConfig_Get("base_exec_prefix"): 37a. (*note
          sys.base_exec_prefix: 3e8.) instead.  Use
          ‘PyConfig_Get("exec_prefix")’ (*note sys.exec_prefix: 3e9.) if
          *note virtual environments: 3e6. need to be handled.

        * *note Py_GetProgramFullPath(): 3ea.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetProgramName(): 3ec.: Use *note
          PyConfig_Get("executable"): 37a. (*note sys.executable: 3eb.)
          instead.

        * *note Py_GetPythonHome(): 3ed.: Use *note
          PyConfig_Get("home"): 37a. or the *note PYTHONHOME: 3ee.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37a. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3ef. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f0.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f1. instead.

        * *note PySys_ResetWarnOptions(): 3f2.: Clear *note
          sys.warnoptions: 3f3. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f6.: Use *note PyConfig.parser_debug:
          3f7. or *note PyConfig_Get("parser_debug"): 37a. instead.

        * *note Py_VerboseFlag: 3f8.: Use *note PyConfig.verbose: 3f9.
          or *note PyConfig_Get("verbose"): 37a. instead.

        * *note Py_QuietFlag: 3fa.: Use *note PyConfig.quiet: 3fb. or
          *note PyConfig_Get("quiet"): 37a. instead.

        * *note Py_InteractiveFlag: 3fc.: Use *note
          PyConfig.interactive: 3fd. or *note
          PyConfig_Get("interactive"): 37a. instead.

        * *note Py_InspectFlag: 3fe.: Use *note PyConfig.inspect: 3ff.
          or *note PyConfig_Get("inspect"): 37a. instead.

        * *note Py_OptimizeFlag: 400.: Use *note
          PyConfig.optimization_level: 401. or *note
          PyConfig_Get("optimization_level"): 37a. instead.

        * *note Py_NoSiteFlag: 402.: Use *note PyConfig.site_import:
          403. or *note PyConfig_Get("site_import"): 37a. instead.

        * *note Py_BytesWarningFlag: 404.: Use *note
          PyConfig.bytes_warning: 405. or *note
          PyConfig_Get("bytes_warning"): 37a. instead.

        * *note Py_FrozenFlag: 406.: Use *note
          PyConfig.pathconfig_warnings: 407. or *note
          PyConfig_Get("pathconfig_warnings"): 37a. instead.

        * *note Py_IgnoreEnvironmentFlag: 408.: Use *note
          PyConfig.use_environment: 409. or *note
          PyConfig_Get("use_environment"): 37a. instead.

        * *note Py_DontWriteBytecodeFlag: 40a.: Use *note
          PyConfig.write_bytecode: 40b. or *note
          PyConfig_Get("write_bytecode"): 37a. instead.

        * *note Py_NoUserSiteDirectory: 40c.: Use *note
          PyConfig.user_site_directory: 40d. or *note
          PyConfig_Get("user_site_directory"): 37a. instead.

        * *note Py_UnbufferedStdioFlag: 40e.: Use *note
          PyConfig.buffered_stdio: 40f. or *note
          PyConfig_Get("buffered_stdio"): 37a. instead.

        * *note Py_HashRandomizationFlag: 410.: Use *note
          PyConfig.use_hash_seed: 411. and *note PyConfig.hash_seed:
          412. or *note PyConfig_Get("hash_seed"): 37a. instead.

        * *note Py_IsolatedFlag: 413.: Use *note PyConfig.isolated: 414.
          or *note PyConfig_Get("isolated"): 37a. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 415.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 416. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37a. instead.

        * *note Py_LegacyWindowsStdioFlag: 417.: Use *note
          PyConfig.legacy_windows_stdio: 418. or *note
          PyConfig_Get("legacy_windows_stdio"): 37a. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 419. or *note
          PyConfig_Get("filesystem_encoding"): 37a. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41a. or *note
          PyConfig_Get("filesystem_errors"): 37a. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41b. or *note
          PyConfig_Get("utf8_mode"): 37a. instead.  (see *note
          Py_PreInitialize(): 41c.)

     The *note Py_InitializeFromConfig(): 3f4. API should be used with
     *note PyConfig: 3f5. to set these options.  Or *note
     PyConfig_Get(): 37a. 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(): 381.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 41f.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 420.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 398.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3a8.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 421.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 422.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b2.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b5.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b4.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3b8.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3ba.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bb.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b7.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bd.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 423.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 391.

     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: 425.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 426.: Use *note PyErr_GetRaisedException():
     427. instead.

   * *note PyErr_NormalizeException(): 428.: Use *note
     PyErr_GetRaisedException(): 427. instead.

   * *note PyErr_Restore(): 429.: Use *note PyErr_SetRaisedException():
     42a. instead.

   * *note PyModule_GetFilename(): 42b.: Use *note
     PyModule_GetFilenameObject(): 42c. instead.

   * *note PyOS_AfterFork(): 42d.: Use *note PyOS_AfterFork_Child():
     42e. instead.

   * *note PySlice_GetIndicesEx(): 42f.: Use *note PySlice_Unpack():
     430. and *note PySlice_AdjustIndices(): 431. instead.

   * *note PyUnicode_READY(): 432.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 433.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 434.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 435.: Use *note
          PyThread_tss_alloc(): 436. instead.

        * *note PyThread_delete_key(): 437.: Use *note
          PyThread_tss_free(): 438. instead.

        * *note PyThread_set_key_value(): 439.: Use *note
          PyThread_tss_set(): 43a. instead.

        * *note PyThread_get_key_value(): 43b.: Use *note
          PyThread_tss_get(): 43c. instead.

        * *note PyThread_delete_key_value(): 43d.: Use *note
          PyThread_tss_delete(): 43e. instead.

        * *note PyThread_ReInitTLS(): 43f.: Unneeded since Python 3.7.


File: python.info,  Node: 用語集<2>,  Next: このドキュメントについて,  Prev: 非推奨<14>,  Up: Top

12 用語集
*********

‘>>>’

     *note 対話型: 1b7. シェルにおけるデフォルトの Python プロンプトです
     。インタープリターで対話的に実行されるコード例でよく見られます。

‘...’

     次のものが考えられます:

        * 対話型 (*note interactive: 1b7.) シェルにおいて、インデントさ
          れたコードブロック、対応する左右の区切り文字の組 (丸括弧、角括
          弧、波括弧、三重引用符) の内側、デコレーターの後に、コードを入
          力する際に表示されるデフォルトの Python プロンプトです。

        * The three dots form of the *note Ellipsis: 2058. object.

abstract base class

     (抽象基底クラス) 抽象基底クラスは *note duck-typing: 5d37. を補完す
     るもので、 *note hasattr(): 6f9. などの別のテクニックでは不恰好であ
     ったり微妙に誤る (例えば *note magic methods: 2411. の場合) 場合に
     インターフェースを定義する方法を提供します。ABC は仮想 (virtual) サ
     ブクラスを導入します。これは親クラスから継承しませんが、それでも
     *note isinstance(): 2af. や *note issubclass(): 9c8. に認識されます
     ; *note abc: 4. モジュールのドキュメントを参照してください。Python
     には、多くの組み込み ABC が同梱されています。その対象は、(*note
     collections.abc: 1f. モジュールで) データ構造、(*note numbers: a2.
     モジュールで) 数、(*note io: 83. モジュールで) ストリーム、(*note
     importlib.abc: 7c. モジュールで) インポートファインダ及びローダーで
     す。 ‘abc’ モジュールを利用して独自の ABC を作成できます。

annotate function

     A callable that can be called to retrieve the *note annotations:
     15d. of an object.  Annotate functions are usually *note functions:
     2517, automatically generated as the *note __annotate__: 19e3.
     attribute of functions, classes, and modules.  Annotate functions
     are a subset of *note evaluate functions: 4875.

annotation

     (アノテーション) 変数、クラス属性、関数のパラメータや返り値に関係す
     るラベルです。 慣例により *note type hint: 242b. として使われていま
     す。

     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():
     457. on modules, classes, and functions, respectively.

     機能の説明がある *note variable annotation: f55, *note function
     annotation: 2075, PEP 484(1), PEP 526(2), PEP 649(3) を参照してくだ
     さい。また、アノテーションを利用するベストプラクティスとして *note
     アノテーションのベストプラクティス: 9dd. も参照してください。

引数 (argument)

     (実引数) 関数を呼び出す際に、 *note 関数: 2517. (または *note
     メソッド: 18c9.) に渡す値です。実引数には２種類あります:

        * 'キーワード引数': 関数呼び出しの際に引数の前に識別子がついたも
          の (例: ‘name=’) や、 ‘**’ に続けた辞書の中の値として渡された
          引数。例えば、次の *note complex(): 198. の呼び出しでは、 ‘3’
          と ‘5’ がキーワード引数です:

               complex(real=3, imag=5)
               complex(**{'real': 3, 'imag': 5})

        * '位置引数': キーワード引数以外の引数。位置引数は引数リストの先
          頭に書くことができ、また ‘*’ に続けた *note iterable: 12f5. の
          要素として渡すことができます。例えば、次の例では ‘3’ と ‘5’ は
          両方共位置引数です:

               complex(3, 5)
               complex(*(3, 5))

     実引数は関数の実体において名前付きのローカル変数に割り当てられます
     。割り当てを行う規則については *note 呼び出し (call): f81. を参照し
     てください。シンタックスにおいて実引数を表すためにあらゆる式を使う
     ことが出来ます。評価された値はローカル変数に割り当てられます。

     *note 仮引数: 23a7. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     5c71. 、 PEP 362(4) を参照してください。

asynchronous context manager

     (非同期コンテキストマネージャ) *note __aenter__(): 247d. と *note
     __aexit__(): 1a00. メソッドを定義することで *note async with: 186.
     文内の環境を管理するオブジェクトです。 PEP 492(5) で導入されました
     。

asynchronous generator

     Informally used to mean either an *note asynchronous generator
     function: 5d38. or an *note asynchronous generator iterator: 39e0,
     depending on context.  The formal terms asynchronous generator
     function and asynchronous generator iterator are uncommon in
     practice; "asynchronous generator" alone is almost always
     sufficient.

asynchronous generator function

     A function which returns an *note asynchronous generator iterator:
     39e0.  It looks like a coroutine function defined with *note async
     def: 7ed. except that it contains *note yield: bc6. expressions for
     producing a series of values usable in an *note async for: ca5.
     loop.  See PEP 525(6).

     非同期ジェネレータ関数には、 *note async for: ca5. 文や *note async
     with: 186. 文だけでなく *note await: 18e. 式もあることがあります。

asynchronous generator iterator

     An object created by an *note asynchronous generator function:
     5d38.

     これは *note asynchronous iterator: 4c7. で、 *note __anext__():
     18e6. メソッドを使って呼ばれると awaitable オブジェクトを返します。
     この awaitable オブジェクトは、次の *note yield: bc6. 式まで非同期
     ジェネレータ関数の本体を実行します。

     各 *note yield: bc6. では一時的に処理を中断し、その実行状態 (ローカ
     ル変数や保留中の try 文を含む) を記憶します。 '非同期ジェネレータイ
     テレータ' が *note __anext__(): 18e6. で返された他の awaitable で実
     際に再開する時には、その中断箇所が選ばれます。 PEP 492(7) および
     PEP 525(8) を参照してください。

asynchronous iterable

     (非同期イテラブル) *note async for: ca5. 文の中で使用できるオブジェ
     クトです。 自身の *note __aiter__(): dfa. メソッドから *note
     asynchronous iterator: 4c7. を返さなければなりません。 PEP 492(9) で
     導入されました。

asynchronous iterator

     (非同期イテレータ) *note __aiter__(): dfa. と *note __anext__():
     18e6. メソッドを実装したオブジェクトです。 ‘__anext__()’ は *note
     awaitable: 4c9. オブジェクトを返さなければなりません。 *note async
     for: ca5. は *note StopAsyncIteration: 1e6c. 例外を送出するまで、非
     同期イテレータの ‘__anext__()’ メソッドが返す awaitable を解決しま
     す。 PEP 492(10) で導入されました。

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: 277c. and *note data race: 277d.

attached thread state

     A *note thread state: 18ab. that is active for the current OS
     thread.

     When a *note thread state: 18ab. 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: 165. for the current
     interpreter, so only one OS thread can have an attached thread
     state at a given moment.  In *note free-threaded builds: 17b0. 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): 22fc. で
     定義される識別子ではない名前の属性を与えることができます。たとえば
     *note setattr(): 261d. を使い、オブジェクトがそれを許可している場合
     に行えます。このような属性はドット表記式ではアクセスできず、代わり
     に *note getattr(): dce. を使って取る必要があります。

awaitable

     (待機可能) *note await: 18e. 式で使用することが出来るオブジェクトで
     す。 *note coroutine: 6b9. か、 *note __await__(): f79. メソッドが
     あるオブジェクトです。 PEP 492(11) を参照してください。

BDFL

     慈悲深き終身独裁者 (Benevolent Dictator For Life) の略です。Python
     の作者、Guido van Rossum(12) のことです。

binary file

     (バイナリファイル) *note bytes-like オブジェクト: 194. の読み込みお
     よび書き込みができる *note ファイルオブジェクト: 13df. です。 バイ
     ナリファイルの例は、バイナリモード (‘'rb'’, ‘'wb'’ or ‘'rb+'’) で開
     かれたファイル、*note sys.stdin.buffer: 75f.、*note
     sys.stdout.buffer: cd1.、 *note io.BytesIO: 10a8. や *note
     gzip.GzipFile: 65c.  のインスタンスです。

     *note str: 16a. オブジェクトの読み書きができるファイルオブジェクト
     については、 *note text file: 20c9. も参照してください。

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:
     3d5. 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(): a9e.
     function can be used to create a new strong reference.

bytes-like object

     *note バッファプロトコル (buffer Protocol): 262. をサポートしていて
     、 C 言語の意味で *note 連続した: 1252. バッファーを提供可能なオブ
     ジェクト。 *note bytes: 193, *note bytearray: 342, *note
     array.array: 4be. や、多くの一般的な *note memoryview: 166. オブジ
     ェクトがこれに当たります。 bytes-like オブジェクトは、データ圧縮、
     バイナリファイルへの保存、ソケットを経由した送信など、バイナリデー
     タを要求するいろいろな操作に利用することができます。

     幾つかの操作ではバイナリデータを変更する必要があります。 その操作の
     ドキュメントではよく "読み書き可能な bytes-like オブジェクト" に言
     及しています。 変更可能なバッファーオブジェクトには、 *note
     bytearray: 342. と ‘bytearray’ の *note memoryview: 166. などが含ま
     れます。 また、他の幾つかの操作では不変なオブジェクト内のバイナリデ
     ータ ("読み出し専用の bytes-like オブジェクト") を必要します。それ
     には *note bytes: 193. と ‘bytes’ の ‘memoryview’ オブジェクトが含
     まれます。

bytecode

     (バイトコード) Python のソースコードは、 Python プログラムの
     CPython インタプリタの内部表現であるバイトコードへとコンパイルされ
     ます。 バイトコードは ‘.pyc’ ファイルにキャッシュされ、同じファイル
     が二度目に実行されるときはより高速になります (ソースコードからバイ
     トコードへの再度のコンパイルは回避されます)。 この "中間言語
     (intermediate language)" は、各々のバイトコードに対応する機械語を実
     行する *note 仮想マシン: 3b04. で動作するといえます。 重要な注意と
     して、バイトコードは異なる 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: 2517, and by extension a *note method: 18c9, 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: 2488. referenced from a *note nested scope:
     23ed. 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: 14c3. 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: 2488, 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: 23a3. 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: 2488. 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:
     5d3d.).

concurrent modification

     When multiple threads modify shared data at the same time.
     Concurrent modification without proper synchronization can cause
     *note race conditions: 277c, and might also trigger a *note data
     race: 277d, 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: 1e3. via a *note with: 187. statement.

        * The collection of key­value bindings associated with a
          particular *note contextvars.Context: 178. object and accessed
          via *note ContextVar: 18da. objects.  Also see *note context
          variable: 5d3f.

        * A *note contextvars.Context: 178. object.  Also see *note
          current context: 19c4.

コンテキスト管理プロトコル

     The *note __enter__(): 7e4. and *note __exit__(): 151c. methods
     called by the *note with: 187. statement.  See PEP 343(13).

context manager

     An object which implements the *note context management protocol:
     19c5. and controls the environment seen in a *note with: 187.
     statement.  See PEP 343(14).

context variable

     A variable whose value depends on which context is the *note
     current context: 19c4.  Values are accessed via *note
     contextvars.ContextVar: 18da. 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(15) を参照してください。

coroutine function

     (コルーチン関数) *note coroutine: 6b9. オブジェクトを返す関数です。
     コルーチン関数は *note async def: 7ed. 文で実装され、*note await:
     18e.、*note async for: ca5.、 および *note async with: 186. キーワ
     ードを持つことが出来ます。 これらは PEP 492(16) で導入されました。

CPython

     python.org(17) で配布されている、Python プログラミング言語の標準的
     な実装です。"CPython" という単語は、この実装を Jython や IronPython
     といった他の実装と区別する必要が有る場合に利用されます。

current context

     The *note context: 19c3. (*note contextvars.Context: 178. object)
     that is currently used by *note ContextVar: 18da. objects to access
     (get or set) the values of *note context variables: 5d3f.  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: 1842. 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: 5d40. behavior and can
     cause data corruption.  Proper use of *note locks: 277b. and other
     *note synchronization primitives: 5d41. prevents data races.  Note
     that data races can only happen in native code, but that *note
     native code: 5d42. might be exposed in a Python API. See also *note
     race condition: 277c. and *note thread-safe: 5d43.

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: 277b. in a consistent order.  See also lock
     and *note reentrant: 5d45.

decorator

     (デコレータ) 別の関数を返す関数で、通常、 ‘@wrapper’ 構文で関数変換
     として適用されます。デコレータの一般的な利用例は、 *note
     classmethod(): 48e. と *note staticmethod(): 451. です。

     デコレータの文法はシンタックスシュガーです。次の2つの関数定義は意味
     的に同じものです:

          def f(arg):
              ...
          f = staticmethod(f)

          @staticmethod
          def f(arg):
              ...

     同じ概念がクラスにも存在しますが、あまり使われません。デコレータに
     ついて詳しくは、 *note 関数定義: 2074. および *note クラス定義:
     14f3. のドキュメントを参照してください。

descriptor

     Any object which defines the methods *note __get__(): 1706, *note
     __set__(): 2415, or *note __delete__(): 19af.  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) の実装: e4d. や *note Descriptor How To Guide: 170b. を
     参照してください。

dictionary

     An associative array, where arbitrary keys are mapped to values.
     The keys can be any object with *note __hash__(): cf7. and *note
     __eq__(): cf6. methods.  Called a hash in Perl.

dictionary comprehension

     (辞書内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる辞書を返すコンパクトな書き方です。 ‘results = {n: n **
     2 for n in range(10)}’ とすると、キー ‘n’ を値 ‘n ** 2’ に対応付け
     る辞書を生成します。 *note Displays for lists, sets and
     dictionaries: 7ec. を参照してください。

dictionary view

     (辞書ビュー) *note dict.keys(): 9d4.、*note dict.values(): 9d5.、
     *note dict.items(): 9d6. が返すオブジェクトです。 辞書の項目の動的
     なビューを提供します。 すなわち、辞書が変更されるとビューはそれを反
     映します。 辞書ビューを強制的に完全なリストにするには
     ‘list(dictview)’ を使用してください。 *note 辞書ビューオブジェクト:
     26fc. を参照してください。

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__: b25.
     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(): f48. や *note isinstance(): 2af. による判
     定を避けます。 (ただし、ダックタイピングを *note 抽象基底クラス:
     13d2. で補完することもできます。) その代わり、典型的に *note
     hasattr(): 6f9. 判定や *note EAFP: 30fa. プログラミングを利用します
     。

dunder

     An informal short-hand for "double underscore", used when talking
     about a *note special method: 1cbd.  For example, ‘__init__’ is
     often pronounced "dunder init".

EAFP

     「認可をとるより許しを請う方が容易 (easier to ask for forgiveness
     than permission、マーフィーの法則)」の略です。この Python で広く使
     われているコーディングスタイルでは、通常は有効なキーや属性が存在す
     るものと仮定し、その仮定が誤っていた場合に例外を捕捉します。この簡
     潔で手早く書けるコーディングスタイルには、 *note try: 8f9. 文および
     *note except: 1ac. 文がたくさんあるのが特徴です。このテクニックは、
     C のような言語でよく使われている *note LBYL: 5d48. スタイルと対照的
     なものです。

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: 19d3. のように、式としては使えない *note 文: 2c78. も
     あります。代入も式ではなく文です。

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:
     19b.  See also PEP 498(18).

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
     バイナリーファイル: 20ca.、バッファされた バイナリーファイル、そし
     て *note テキストファイル: 20c9. です。インターフェイスは *note io:
     83. モジュールで定義されています。ファイルオブジェクトを作る標準的
     な方法は *note open(): 318. 関数を使うことです。

file-like object

     *note file object: 13df. と同義です。

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: 460. を送出することがあります。

     The *note sys.getfilesystemencoding(): e57. and *note
     sys.getfilesystemencodeerrors(): ee6. 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:
     3f5. のメンバー *note filesystem_encoding: 419. と *note
     filesystem_errors: 41a. を参照してください。

     See also the *note locale encoding: 54a.

finder

     (ファインダ) インポートされているモジュールの *note loader: 1a8a. の
     発見を試行するオブジェクトです。

     There are two types of finder: *note meta path finders: 1280. for
     use with *note sys.meta_path: f2b, and *note path entry finders:
     1281. for use with *note sys.path_hooks: 1229.

     See *note ファインダーとローダー: 24a6. and *note importlib: 7b.
     for much more detail.

floor division

     (切り捨て除算) 一番近い整数に切り捨てる数学的除算。 切り捨て除算演
     算子は ‘//’ です。 例えば、 ‘11 // 4’ は ‘2’ になり、それとは対称に
     浮動小数点数の真の除算では ‘2.75’ が 返ってきます。 ‘(-11) // 4’ は
     ‘-2.75’ を '小さい方に' 丸める (訳注: 負の無限大への丸めを行う) の
     で ‘-3’ になることに注意してください。 PEP 238(19) を参照してくださ
     い。

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(20).

free-threaded build

     A build of *note CPython: 906. that supports *note free threading:
     1f6, configured using the *note -disable-gil: 499. option before
     compilation.

     See *note Python support for free threading: 2774.

free variable

     Formally, as defined in the *note language execution model: 2485, a
     free variable is any variable used in a namespace which is not a
     local variable in that namespace.  See *note closure variable:
     18f6. for an example.  Pragmatically, due to the name of the *note
     codeobject.co_freevars: 23a3. attribute, the term is also sometimes
     used as a synonym for closure variable.

関数

     (関数) 呼び出し側に値を返す一連の文のことです。関数には0以上の
     *note 実引数: 67b. を渡すことが出来ます。実体の実行時に引数を使用す
     ることが出来ます。 *note 仮引数: 23a7.、*note メソッド: 18c9.、
     *note 関数定義: 2074. を参照してください。

function annotation

     (関数アノテーション) 関数のパラメータや返り値の *note annotation:
     15d. です。

     関数アノテーションは、通常は *note 型ヒント: 242b. のために使われま
     す: 例えば、この関数は 2 つの *note int: 19c. 型の引数を取ると期待
     され、また ‘int’ 型の返り値を持つと期待されています。

          def sum_two_numbers(a: int, b: int) -> int:
             return a + b

     関数アノテーションの文法は *note 関数定義: 2074. の節で解説されてい
     ます。

     機能の説明がある *note variable annotation: f55, PEP 484(21),を参照
     してください。また、アノテーションを利用するベストプラクティスとし
     て *note アノテーションのベストプラクティス: 9dd. も参照してくださ
     い。

__future__

     ‘from __future__ import <feature>’ という *note future 文: 45b. は
     、コンパイラーに将来の 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. モジュールを使って操作できます。

ジェネレータ

     Informally used to mean either a *note generator function: 5d4a. or
     a *note generator iterator: ddd, depending on context.  The formal
     terms generator function and generator iterator are uncommon in
     practice; "generator" alone is almost always sufficient.

generator function

     A function which returns a *note generator: 1270. object.  It looks
     like a normal function except that it contains *note yield: bc6.
     expressions for producing a series of values usable in a *note for:
     348.-loop or that can be retrieved one at a time with the *note
     next(): 9dc. function.  See *note Yield 式: 24f8.

generator iterator

     An object created by a *note generator function: 5d4a. or a *note
     generator expression: 5d4b.

     Each *note yield: bc6. 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 iterators also implement the *note send(): 1271. method
     to send a value into the suspended generator, and the *note
     throw(): 71c. method to raise an exception at the point where the
     generator was paused.  See *note ジェネレータ-イテレータメソッド:
     2478.

generator expression

     (ジェネレータ式) iterator を返す *note 式: 242f. です。 普通の式に
     、ループ変数を定義する ‘for’ 節、範囲、そして省略可能な ‘if’ 節がつ
     づいているように見えます。 こうして構成された式は、外側の関数に向け
     て値を生成します:

          >>> sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81
          285

generic function

     (ジェネリック関数) 異なる型に対し同じ操作をする関数群から構成される
     関数です。呼び出し時にどの実装を用いるかはディスパッチアルゴリズム
     により決定されます。

     *note single dispatch: be7.、*note functools.singledispatch(): 84b.
     デコレータ、 PEP 443(22) を参照してください。

generic type

     A *note type: 1d5c. that can be parameterized; typically a *note
     container class: 2434. such as *note list: 24f. or *note dict: 184.
     Used for *note type hints: 242b. and *note annotations: 15d.

     For more details, see *note generic alias types: 8c2, PEP 483(23),
     PEP 484(24), PEP 585(25), and the *note typing: 10b. module.

GIL

     *note global interpreter lock: 474. を参照してください。

global interpreter lock

     (グローバルインタプリタロック) *note CPython: 906. インタプリタが利
     用している、一度に Python の *note バイトコード: 4aa. を実行するス
     レッドは一つだけであることを保証する仕組みです。これにより (*note
     dict: 184. などの重要な組み込み型を含む) オブジェクトモデルが同時ア
     クセスに対して暗黙的に安全になるので、 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: 170. 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(26).

     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: 5256.

global state

     Data that is accessible throughout a program, such as module-level
     variables, class variables, or C static variables in *note
     extension modules: 22ad.  In multi-threaded programs, global state
     shared between threads typically requires synchronization to avoid
     *note race conditions: 277c. and *note data races: 277d.

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__(): cf7. method), and
     can be compared to other objects (it needs an *note __eq__(): cf6.
     method).  Hashable objects which compare equal must have the same
     hash value.

     ハッシュ可能なオブジェクトは辞書のキーや集合のメンバーとして使えま
     す。辞書や集合のデータ構造は内部でハッシュ値を使っているからです。

     Python のイミュータブルな組み込みオブジェクトは、ほとんどがハッシュ
     可能です。(リストや辞書のような) ミュータブルなコンテナはハッシュ不
     可能です。(タプルや frozenset のような) イミュータブルなコンテナは
     、要素がハッシュ可能であるときのみハッシュ可能です。 ユーザー定義の
     クラスのインスタンスであるようなオブジェクトはデフォルトでハッシュ
     可能です。 それらは全て (自身を除いて) 比較結果は非等価であり、ハッ
     シュ値は *note id(): 1641. より得られます。

IDLE

     Python の統合開発環境 (Integrated DeveLopment Environment)及び学習
     環境 (Learning Environment) です。*note IDLE -- Python
     のエディタとシェル: 121b. は Python の標準的な配布に同梱されている
     基本的な機能のエディタとインタプリタ環境です。

永続オブジェクト (immortal)

     'Immortal objects' are a CPython implementation detail introduced
     in PEP 683(27).

     If an object is immortal, its *note reference count: 524e. is never
     modified, and therefore it is never deallocated while the
     interpreter is running.  For example, *note True: e0b. and *note
     None: 886. are immortal in CPython.

     Immortal objects can be identified via *note sys._is_immortal():
     291, or via *note PyUnstable_IsImmortal(): 3c2. 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: 5d43. because their state cannot
     be modified after creation, eliminating concerns about improperly
     synchronized *note concurrent modification: 5d3e.

import path

     *note path based finder: 24ad. が import するモジュールを検索する場
     所 (または *note path entry: 24b8.) のリスト。 import 中、このリス
     トは通常 *note sys.path: 3e2. から来ますが、サブパッケージの場合は
     親パッケージの ‘__path__’ 属性からも来ます。

importing

     あるモジュールの Python コードが別のモジュールの Python コードで使
     えるようにする処理です。

importer

     モジュールを探してロードするオブジェクト。 *note finder: 23c6. と
     *note loader: 1a8a. のどちらでもあるオブジェクト。

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: 250e.

     See also *note subscript: 5d4f.

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 対話的: 1b7. も参照してください。

interpreter shutdown

     Python インタープリターはシャットダウンを要請された時に、モジュール
     やすべてのクリティカルな内部構造をなどの、すべての確保したリソース
     を段階的に開放する、特別なフェーズに入ります。 このフェーズは *note
     ガベージコレクタ: 1842. を複数回呼び出します。 これによりユーザー定
     義のデストラクターや 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: 24f,
     *note str: 16a, and *note tuple: 614.) and some non-sequence types
     like *note dict: 184, *note file objects: 13df, and objects of any
     classes you define with an *note __iter__(): e6d. method or with a
     *note __getitem__(): 588. method that implements *note sequence:
     716. semantics.

     反復可能オブジェクトは *note for: 348. ループ内やその他多くのシーケ
     ンス (訳注: ここでのシーケンスとは、シーケンス型ではなくただの列と
     いう意味)が必要となる状況 (*note zip(): 1a1, *note map(): 1a0, ...)
     で利用できます。 反復可能オブジェクトを組み込み関数 *note iter():
     9db. の引数として渡すと、 オブジェクトに対するイテレータを返します
     。 このイテレータは一連の値を引き渡す際に便利です。 通常は反復可能
     オブジェクトを使う際には、 ‘iter()’ を呼んだりイテレータオブジェク
     トを自分で操作する必要はありません。 ‘for’ 文ではこの操作を自動的に
     行い、一時的な無名の変数を作成してループを回している間イテレータを
     保持します。 *note イテレータ: 4c8. 、 *note シーケンス: 716. 、
     *note ジェネレータ: 1270. も参照してください。

iterator

     データの流れを表現するオブジェクトです。イテレータの *note
     __next__(): 14e9. メソッドを繰り返し呼び出す (または組み込み関数
     *note next(): 9dc. に渡す) と、流れの中の要素を一つずつ返します。デ
     ータがなくなると、代わりに *note StopIteration: df9. 例外を送出しま
     す。その時点で、イテレータオブジェクトは尽きており、それ以降は
     ‘__next__()’ を何度呼んでも ‘StopIteration’ を送出します。イテレー
     タは、そのイテレータオブジェクト自体を返す *note __iter__(): 2108.
     メソッドを実装しなければならないので、イテレータは他の iterable を
     受理するほとんどの場所で利用できます。はっきりとした例外は複数の反
     復を行うようなコードです。 (*note list: 24f. のような) コンテナオブ
     ジェクトは、自身を *note iter(): 9db. 関数にオブジェクトに渡したり
     *note for: 348. ループ内で使うたびに、新たな未使用のイテレータを生
     成します。これをイテレータで行おうとすると、前回のイテレーションで
     使用済みの同じイテレータオブジェクトを単純に返すため、空のコンテナ
     のようになってしまいます。

     詳細な情報は *note イテレータ型: 2636. にあります。

     'CPython 実装の詳細:' CPython does not consistently apply the
     requirement that an iterator define *note __iter__(): 2108.  And
     also please note that *note free-threaded: 1f6. CPython does not
     guarantee *note thread-safe: 5d43. behavior of iterator operations.

キー

     A value that identifies an entry in a *note mapping: 13d7.  See
     also *note subscript: 5d4f.

key function

     (キー関数) キー関数、あるいは照合関数とは、ソートや順序比較のための
     値を返す呼び出し可能オブジェクト(callable)です。例えば、 *note
     locale.strxfrm(): 1828. をキー関数に使えば、ロケール依存のソートの
     慣習にのっとったソートキーを返します。

     Python の多くのツールはキー関数を受け取り要素の並び順やグループ化を
     管理します。 *note min(): 110f, *note max(): 1110, *note sorted():
     dcb, *note list.sort(): dcc, *note heapq.merge(): 1009, *note
     heapq.nsmallest(): 2a1c, *note heapq.nlargest(): 2a1b, *note
     itertools.groupby(): 17cc. 等があります。

     There are several ways to create a key function.  For example.  the
     *note str.casefold(): fda. method can serve as a key function for
     case insensitive sorts.  Alternatively, a key function can be built
     from a *note lambda: 14b9. expression such as ‘lambda r: (r[0],
     r[2])’.  Also, *note operator.attrgetter(): 1037, *note
     operator.itemgetter(): c5b, and *note operator.methodcaller():
     1038. are three key function constructors.  See the *note Sorting
     HOW TO: 13f7. for examples of how to create and use key functions.

keyword argument

     *note 実引数: 67b. を参照してください。

lambda

     (ラムダ) 無名のインライン関数で、関数が呼び出されたときに評価される
     1 つの *note 式: 242f. を含みます。ラムダ関数を作る構文は ‘lambda
     [parameters]: expression’ です。

LBYL

     「ころばぬ先の杖 (look before you leap)」 の略です。このコーディン
     グスタイルでは、呼び出しや検索を行う前に、明示的に前提条件
     (pre-condition) 判定を行います。 *note EAFP: 30fa. アプローチと対照
     的で、 *note if: 182. 文がたくさん使われるのが特徴的です。

     In a multi-threaded environment, the LBYL approach can risk
     introducing a *note race condition: 277c. 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: 277b. or by using the *note EAFP: 30fa.
     approach.  See also *note thread-safe: 5d43.

lexical analyzer

     Formal name for the 'tokenizer'; see *note token: 22e4.

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: 182. 節はオプションです。 ‘if’ 節がない場
     合、 ‘range(256)’ の全ての要素が処理されます。

lock

     A *note synchronization primitive: 5d41. 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: 1a54. (a basic lock) and *note RLock: 32c. (a *note
     reentrant: 5d45. lock).  Locks are used to prevent *note race
     conditions: 277c. and ensure *note thread-safe: 5d43. access to
     shared data.  Alternative design patterns to locks exist such as
     queues, producer/consumer patterns, and thread-local state.  See
     also *note deadlock: 5d44, and reentrant.

lock-free

     An operation that does not acquire any *note lock: 277b. 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: 1f6. Python, built-in types like *note dict: 184.
     and *note list: 24f. 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: 2782.

loader

     An object that loads a module.  It must define the ‘exec_module()’
     and ‘create_module()’ methods to implement the *note Loader: 10cb.
     interface.  A loader is typically returned by a *note finder: 23c6.
     See also:

        * *note ファインダーとローダー: 24a6.

        * *note importlib.abc.Loader: 10cb.

        * PEP 302(28)

ロケールエンコーディング

     On Unix, it is the encoding of the LC_CTYPE locale.  It can be set
     with *note locale.setlocale(locale.LC_CTYPE, new_locale): 930.

     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(): 866. can be used to get the locale
     encoding.

     See also the *note filesystem encoding and error handler: 75d.

magic method

     *note special method: 1cbd. のくだけた同義語です。

mapping

     (マッピング) 任意のキー探索をサポートしていて、 *note
     collections.abc.Mapping: acb. か *note
     collections.abc.MutableMapping: 12c4. の *note 抽象基底クラス: a7c.
     で指定されたメソッドを実装しているコンテナオブジェクトです。例えば
     、 *note dict: 184, *note collections.defaultdict: 13d8, *note
     collections.OrderedDict: 7f3, *note collections.Counter: 12a7. など
     です。

meta path finder

     *note sys.meta_path: f2b. を検索して得られた *note finder: 23c6.
     meta path finder は *note path entry finder: 1281. と関係はあります
     が、別物です。

     meta path finder が実装するメソッドについては *note
     importlib.abc.MetaPathFinder: a72. を参照してください。

metaclass

     (メタクラス) クラスのクラスです。クラス定義は、クラス名、クラスの辞
     書と、基底クラスのリストを作ります。メタクラスは、それら 3 つを引数
     として受け取り、クラスを作る責任を負います。ほとんどのオブジェクト
     指向言語は(訳注:メタクラスの)デフォルトの実装を提供しています。
     Python が特別なのはカスタムのメタクラスを作成できる点です。ほとんど
     のユーザーに取って、メタクラスは全く必要のないものです。しかし、一
     部の場面では、メタクラスは強力でエレガントな方法を提供します。たと
     えば属性アクセスのログを取ったり、スレッドセーフ性を追加したり、オ
     ブジェクトの生成を追跡したり、シングルトンを実装するなど、多くの場
     面で利用されます。

     詳細は *note メタクラス: 241e. を参照してください。

メソッド

     (メソッド) クラス本体の中で定義された関数。そのクラスのインスタンス
     の属性として呼び出された場合、メソッドはインスタンスオブジェクトを
     第一 *note 引数: 67b. として受け取ります (この第一引数は通常 ‘self’
     と呼ばれます)。 *note 関数: 2517. と *note ネストされたスコープ:
     23ed. も参照してください。

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: 16c8. for details of the algorithm used by
     the Python interpreter since the 2.3 release.

module

     (モジュール) Python コードの組織単位としてはたらくオブジェクトです
     。モジュールは任意の Python オブジェクトを含む名前空間を持ちます。
     モジュールは *note importing: 249c. の処理によって Python に読み込
     まれます。

     *note パッケージ: 235. を参照してください。

module spec

     モジュールをロードするのに使われるインポート関連の情報を含む名前空
     間です。 *note importlib.machinery.ModuleSpec: 22c8. のインスタンス
     です。

     See also *note Module specs: 23c2.

MRO

     *note method resolution order: 263e. を参照してください。

mutable

     An *note object: 5d52. 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: 277c.  See also
     *note immutable: 15bd, *note thread-safe: 5d43, and *note
     concurrent modification: 5d3e.

named tuple

     "名前付きタプル" という用語は、タプルを継承していて、インデックスが
     付く要素に対し属性を使ってのアクセスもできる任意の型やクラスに応用
     されています。 その型やクラスは他の機能も持っていることもあります。

     *note time.localtime(): 1717. や *note os.stat(): 26f. の返り値を含
     むいくつかの組み込み型は名前付きタプルです。 他の例は *note
     sys.float_info: 1e2b. です:

          >>> 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: 32f, 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: 318. と *note os.open(): f96. は
     名前空間で区別されています。また、どのモジュールが関数を実装してい
     るか明示することによって名前空間は可読性と保守性を支援します。例え
     ば、*note random.seed(): 148f. や *note itertools.islice(): d47. と
     書くと、それぞれモジュール *note random: bd. や *note itertools:
     85. で実装されていることが明らかです。

namespace package

     A *note package: 235. which serves only as a container for
     subpackages.  Namespace packages may have no physical
     representation, and specifically are not like a *note regular
     package: 24a0. 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: 24a0.

     For more information, see PEP 420(29) and *note 名前空間パッケージ:
     24a1.

     *note module: 1a3d. を参照してください。

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:
     22ad. that can be called from Python.  See also extension module.

nested scope

     (ネストされたスコープ) 外側で定義されている変数を参照する機能です。
     例えば、ある関数が別の関数の中で定義されている場合、内側の関数は外
     側の関数中の変数を参照できます。ネストされたスコープはデフォルトで
     は変数の参照だけができ、変数の代入はできないので注意してください。
     ローカル変数は、最も内側のスコープで変数を読み書きします。同様に、
     グローバル変数を使うとグローバル名前空間の値を読み書きします。
     *note nonlocal: 14c3. で外側の変数に書き込めます。

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__: 1709,
     descriptors, properties, *note __getattribute__(): dcf, 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: 277c. where the relative timing or interleaving of
     threads affects the result.  Proper synchronization using *note
     locks: 277b. and other *note synchronization primitives: 5d41.
     helps ensure deterministic behavior.

object

     (オブジェクト) 状態 (属性や値) と定義された振る舞い (メソッド) をも
     つ全てのデータ。もしくは、全ての *note 新スタイルクラス: 2d86. の究
     極の基底クラスのこと。

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: 22ad. that is part of the *note standard
     library: 5d53, but may be absent in some builds of *note CPython:
     906, usually due to missing third-party libraries or because the
     module is not available for a given platform.

     See *note オプションのモジュールの要件: 21b2. for a list of
     optional modules that require third-party libraries.

package

     (パッケージ) サブモジュールや再帰的にサブパッケージを含むことの出来
     る *note module: 1a3d. のことです。専門的には、パッケージは
     ‘__path__’ 属性を持つ Python オブジェクトです。

     *note regular package: 24a0. と *note namespace package: 2b4. を参
     照してください。

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: 1f6. Python, multiple
     Python threads can run Python code simultaneously on different
     cores.

parameter

     (仮引数) 名前付の実体で *note 関数: 2517. (や *note メソッド: 18c9.
     ) の定義において関数が受ける *note 実引数: 67b. を指定します。仮引
     数には5種類あります:

        * '位置またはキーワード': *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 仮引数: 23a7. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     5c71. 、*note inspect.Parameter: 4e4. クラス、 *note 関数定義:
     2074. セクション、 PEP 362(30) を参照してください。

per-object lock

     A *note lock: 277b. associated with an individual object instance
     rather than a global lock shared across all objects.  In *note
     free-threaded: 1f6. Python, built-in types like *note dict: 184.
     and *note list: 24f. 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: 2789. operations.

path entry

     *note path based finder: 24ad. が import するモジュールを探す *note
     import path: 24aa. 上の1つの場所です。

path entry finder

     *note sys.path_hooks: 1229. にある callable (つまり *note path
     entry hook: 24ba.) が返した *note finder: 23c6. です。与えられた
     *note path entry: 24b8. にあるモジュールを見つける方法を知っていま
     す。

     パスエントリーファインダが実装するメソッドについては *note
     importlib.abc.PathEntryFinder: a73. を参照してください。

path entry hook

     A callable on the *note sys.path_hooks: 1229. list which returns a
     *note path entry finder: 1281. if it knows how to find modules on a
     specific *note path entry: 24b8.

path based finder

     デフォルトの *note meta path finder: 1280. の1つは、モジュールの
     *note import path: 24aa. を検索します。

path-like object

     (path-like オブジェクト) ファイルシステムパスを表します。 path-like
     オブジェクトは、パスを表す *note str: 16a. オブジェクトや *note
     bytes: 193. オブジェクト、または *note os.PathLike: e4f. プロトコル
     を実装したオブジェクトのどれかです。 ‘os.PathLike’ プロトコルをサポ
     ートしているオブジェクトは *note os.fspath(): e51. を呼び出すことで
     ‘str’ または ‘bytes’ のファイルシステムパスに変換できます。 *note
     os.fsdecode(): e52. と *note os.fsencode(): e53. はそれぞれ ‘str’ あ
     るいは ‘bytes’ になるのを保証するのに使えます。 PEP 519(31) で導入
     されました。

PEP

     Python Enhancement Proposal。PEP は、Python コミュニティに対して情
     報を提供する、あるいは Python の新機能やその過程や環境について記述
     する設計文書です。 PEP は、機能についての簡潔な技術的仕様と提案する
     機能の論拠 (理論) を伝えるべきです。

     PEP は、新機能の提案にかかる、コミュニティによる問題提起の集積と
     Python になされる設計決断の文書化のための最上位の機構となることを意
     図しています。PEP の著者にはコミュニティ内の合意形成を行うこと、反
     対意見を文書化することの責務があります。

     PEP 1(32) を参照してください。

portion

     PEP 420(33) で定義されている、namespace package に属する、複数のフ
     ァイルが (zipファイルに格納されている場合もある) 1つのディレクトリ
     に格納されたもの。

位置引数 (positional argument)

     *note 実引数: 67b. を参照してください。

provisional API

     (暫定 API) 標準ライブラリの後方互換性保証から計画的に除外されたもの
     です。そのようなインターフェースへの大きな変更は、暫定であるとされ
     ている間は期待されていませんが、コア開発者によって必要とみなされれ
     ば、後方非互換な変更 (インターフェースの削除まで含まれる) が行われ
     えます。このような変更はむやみに行われるものではありません - これは
     API を組み込む前には見落とされていた重大な欠陥が露呈したときにのみ
     行われます。

     暫定 API についても、後方互換性のない変更は「最終手段」とみなされて
     います。問題点が判明した場合でも後方互換な解決策を探すべきです。

     このプロセスにより、標準ライブラリは問題となるデザインエラーに長い
     間閉じ込められることなく、時代を超えて進化を続けられます。詳細は
     PEP 411(34) を参照してください。

provisional package

     *note provisional API: 3cf. を参照してください。

Python 3000

     Python 3.x リリースラインのニックネームです。(Python 3 が遠い将来の
     話だった頃に作られた言葉です。) "Py3k" と略されることもあります。

Pythonic

     他の言語で一般的な考え方で書かれたコードではなく、Python の特に一般
     的なイディオムに従った考え方やコード片。例えば、Python の一般的なイ
     ディオムでは *note for: 348. 文を使ってイテラブルのすべての要素に渡
     ってループします。他の多くの言語にはこの仕組みはないので、Python に
     慣れていない人は代わりに数値のカウンターを使うかもしれません:

          for i in range(len(food)):
              print(food[i])

     これに対し、きれいな Pythonic な方法は:

          for piece in food:
              print(piece)

qualified name

     (修飾名) モジュールのグローバルスコープから、そのモジュールで定義さ
     れたクラス、関数、メソッドへの、 "パス" を表すドット名表記です。
     PEP 3155(35) で定義されています。トップレベルの関数やクラスでは、修
     飾名はオブジェクトの名前と同じです:

          >>> 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:
     5d40. behavior and bugs that are difficult to reproduce.  A *note
     data race: 277d. is a specific type of race condition involving
     unsynchronized access to shared memory.  The *note LBYL: 5d48.
     coding style is particularly susceptible to race conditions in
     multi-threaded code.  Using *note locks: 277b. and other *note
     synchronization primitives: 5d41. helps prevent race conditions.

reference count

     (参照カウント) あるオブジェクトに対する参照の数。参照カウントが0に
     なったとき、そのオブジェクトは破棄されます。 *note 永続: 292. であ
     り、参照カウントが決して変更されないために割り当てが解除されないオ
     ブジェクトもあります。参照カウントは通常は Python のコード上には現
     れませんが、 *note CPython: 906. 実装の重要な要素です。プログラマー
     は、 任意のオブジェクトの参照カウントを知るために *note
     sys.getrefcount(): 2d0. 関数を呼び出すことが出来ます。

     In *note CPython: 906, 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: 235.。

     *note namespace package: 2b4. を参照してください。

reentrant

     A property of a function or *note lock: 277b. that allows it to be
     called or acquired multiple times by the same thread without
     causing errors or a *note deadlock: 5d44.

     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:
     5d40. if they're called reentrantly in a multithreaded program.

     For locks, Python's *note threading.RLock: 32c. (reentrant lock) is
     reentrant, meaning a thread that already holds the lock can acquire
     it again without blocking.  In contrast, *note threading.Lock:
     1a54. is not reentrant - attempting to acquire it twice from the
     same thread will cause a deadlock.

     See also *note lock: 277b. and *note deadlock: 5d44.

REPL

     "read–eval–print loop" の頭字語で、 *note 対話型: 1b7. インタープリ
     ターシェルの別名。

__slots__

     クラス内での宣言で、インスタンス属性の領域をあらかじめ定義しておき
     、インスタンス辞書を排除することで、メモリを節約します。これはよく
     使われるテクニックですが、正しく扱うには少しトリッキーなので、稀な
     ケース、例えばメモリが死活問題となるアプリケーションでインスタンス
     が大量に存在する、といったときを除き、使わないのがベストです。

sequence

     An *note iterable: 12f5. which supports efficient element access
     using integer indices via the *note __getitem__(): 588. special
     method and defines a *note __len__(): 17ff. method that returns the
     length of the sequence.  Some built-in sequence types are *note
     list: 24f, *note str: 16a, *note tuple: 614, and *note bytes: 193.
     Note that *note dict: 184. also supports ‘__getitem__()’ 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: 13e0. abstract base class
     defines a much richer interface that goes beyond just *note
     __getitem__(): 588. and *note __len__(): 17ff, adding *note
     count(): 2438, *note index(): 19d9, *note __contains__(): 15d7, and
     *note __reversed__(): e8a.  Types that implement this expanded
     interface can be registered explicitly using *note register():
     129e.  For more documentation on sequence methods generally, see
     *note Common Sequence Operations: 2666.

set comprehension

     (集合内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる集合を返すコンパクトな書き方です。 ‘results = {c for c
     in 'abracadabra' if c not in 'abc'}’ とすると、‘{'r', 'd'}’ という
     文字列の辞書を生成します。 *note Displays for lists, sets and
     dictionaries: 7ec. を参照してください。

single dispatch

     *note generic function: be8. の一種で実装は一つの引数の型により選択
     されます。

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: 250d. form of *note subscript notation: 242e, 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(36).

special method

     (特殊メソッド) ある型に特定の操作、例えば加算をするために Python か
     ら暗黙に呼び出されるメソッド。この種類のメソッドは、メソッド名の最
     初と最後にアンダースコア 2 つがついています。特殊メソッドについては
     *note 特殊メソッド名: e6c. で解説されています。

standard library

     The collection of *note packages: 235, *note modules: 1a3d. and
     *note extension modules: 22ad. 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
     標準ライブラリ: 14a.

     See also *note sys.stdlib_module_names: a46. for a list of all
     possible standard library module names.

statement

     (文) 文はスイート (コードの"ブロック") に不可欠な要素です。文は
     *note 式: 242f. かキーワードから構成されるもののどちらかです。後者
     には *note if: 182.、*note while: 19d3.、*note for: 348. があります
     。

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:
     242b. and the *note typing: 10b. module.

stdlib

     An abbreviation of *note standard library: 5d53.

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(): a9e. 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: 3d5.

添字

     The expression in square brackets of a *note subscription
     expression: 242e, for example, the ‘3’ in ‘items[3]’.  Usually used
     to select an element of a container.  Also called a *note key:
     2444. when subscripting a *note mapping: 13d7, or an *note index:
     2443. 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: 5d43.
     access to shared resources.  Python's *note threading: f3. module
     provides several synchronization primitives including *note Lock:
     1a54, *note RLock: 32c, *note Semaphore: 1372, *note Condition:
     1371, *note Event: 1374, and *note Barrier: 1400.  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: 277c. and coordinate
     thread execution.  See also *note lock: 277b.

t-string

t-strings

     String literals prefixed with ‘t’ or ‘T’ are commonly called
     "t-strings" which is short for *note template string literals:
     1860.

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:
     fbc, which are collectively referred to as "text encodings".

text file

     (テキストファイル) *note str: 16a. オブジェクトを読み書きできる
     *note file object: 13df. です。 しばしば、テキストファイルは実際に
     バイト指向のデータストリームにアクセスし、 *note
     テキストエンコーディング: 263a. を自動的に行います。 テキストファイ
     ルの例は、 *note sys.stdin: 75f, *note sys.stdout: cd1, *note
     io.StringIO: 112e. インスタンスなどをテキストモード (‘'r'’ or
     ‘'w'’) で開いたファイルです。

     *note bytes-like オブジェクト: 194. を読み書きできるファイルオブジ
     ェクトについては、 *note バイナリファイル: 20ca. も参照してください
     。

thread state

     The information used by the *note CPython: 906. 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: 5256. at once.

     An *note attached thread state: 5256. 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: 5256.
     in that thread at any given moment.

     See *note Thread State and the Global Interpreter Lock: 58a0. 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: 5d41. like *note locks: 277b. to
     protect shared mutable state, or is designed to avoid shared
     mutable state entirely.  In the *note free-threaded: 1f6. build,
     built-in types like *note dict: 184, *note list: 24f, and *note
     set: 185. 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: 277c. and
     *note data races: 277d. when used in multi-threaded programs.

トークン

     A small unit of source code, generated by the *note lexical
     analyzer: 22f1. (also called the 'tokenizer').  Names, numbers,
     strings, operators, newlines and similar are represented by tokens.

     The *note tokenize: 102. module exposes Python's lexical analyzer.
     The *note token: 101. 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__: 16cb. attribute or can be retrieved with
     ‘type(obj)’.

type alias

     (型エイリアス) 型の別名で、型を識別子に代入して作成します。

     型エイリアスは *note 型ヒント: 242b. を単純化するのに有用です。例え
     ば:

          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: 10b. と PEP 484(37) を参照してくださ
     い。

type hint

     (型ヒント) 変数、クラス属性、関数のパラメータや返り値の期待される型
     を指定する *note annotation: 15d. です。

     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(): 8c1. で取得できます。

     機能の説明がある *note typing: 10b. と PEP 484(38) を参照してくださ
     い。

universal newlines

     テキストストリームの解釈法の一つで、以下のすべてを行末と認識します:
     Unix の行末規定 ‘'\n'’、Windows の規定 ‘'\r\n'’、古い Macintosh の
     規定 ‘'\r'’。利用法について詳しくは、 PEP 278(39) と PEP 3116(40) 、
     さらに *note bytes.splitlines(): 2682. も参照してください。

variable annotation

     (変数アノテーション) 変数あるいはクラス属性の *note annotation:
     15d. 。

     変数あるいはクラス属性に注釈を付けたときは、代入部分は任意です:

          class C:
              field: 'annotation'

     変数アノテーションは通常は *note 型ヒント: 242b. のために使われます
     : 例えば、この変数は *note int: 19c. の値を取ることを期待されていま
     す:

          count: int = 0

     変数アノテーションの構文については *note 注釈付き代入文 (annotated
     assignment statements): 256b. 節で解説しています。

     機能の説明がある *note function annotation: 2075, PEP 484(41) , PEP
     526(42) を参照してください。また、アノテーションを利用するベストプ
     ラクティスとして *note アノテーションのベストプラクティス: 9dd. も
     参照してください。

virtual environment

     (仮想環境) 協調的に切り離された実行環境です。これにより Python ユー
     ザとアプリケーションは同じシステム上で動いている他の Python アプリ
     ケーションの挙動に干渉することなく Python パッケージのインストール
     と更新を行うことができます。

     *note venv: 118. を参照してください。

virtual machine

     (仮想マシン) 完全にソフトウェアにより定義されたコンピュータ。
     Python の仮想マシンは、バイトコードコンパイラが出力した *note
     バイトコード: 4aa. を実行します。

walrus operator

     A light-hearted way to refer to the *note assignment expression:
     253d. 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-0525/

   (7) https://peps.python.org/pep-0492/

   (8) https://peps.python.org/pep-0525/

   (9) https://peps.python.org/pep-0492/

   (10) https://peps.python.org/pep-0492/

   (11) https://peps.python.org/pep-0492/

   (12) https://gvanrossum.github.io/

   (13) https://peps.python.org/pep-0343/

   (14) https://peps.python.org/pep-0343/

   (15) https://peps.python.org/pep-0492/

   (16) https://peps.python.org/pep-0492/

   (17) https://www.python.org

   (18) https://peps.python.org/pep-0498/

   (19) https://peps.python.org/pep-0238/

   (20) https://peps.python.org/pep-0703/

   (21) https://peps.python.org/pep-0484/

   (22) https://peps.python.org/pep-0443/

   (23) https://peps.python.org/pep-0483/

   (24) https://peps.python.org/pep-0484/

   (25) https://peps.python.org/pep-0585/

   (26) https://peps.python.org/pep-0703/

   (27) https://peps.python.org/pep-0683/

   (28) https://peps.python.org/pep-0302/

   (29) https://peps.python.org/pep-0420/

   (30) https://peps.python.org/pep-0362/

   (31) https://peps.python.org/pep-0519/

   (32) https://peps.python.org/pep-0001/

   (33) https://peps.python.org/pep-0420/

   (34) https://peps.python.org/pep-0411/

   (35) https://peps.python.org/pep-3155/

   (36) https://peps.python.org/pep-0387/#soft-deprecation

   (37) https://peps.python.org/pep-0484/

   (38) https://peps.python.org/pep-0484/

   (39) https://peps.python.org/pep-0278/

   (40) https://peps.python.org/pep-3116/

   (41) https://peps.python.org/pep-0484/

   (42) 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 バグへの対処: 529e. ページをご覧下さい。 新しいボランティアはい
つでも歓迎です!  （訳注: 日本語訳の問題については、 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ドキュメントへの貢献者
=================================

Many people have contributed to the Python language, the Python standard
library, and the Python documentation.  See Misc/ACKS(1) in the Python
source distribution for a partial list of contributors.

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: 5d64.

* 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 ドキュメントへの貢献に興味がある個人へ向けた包括的なガイド。

Documentation Translations(7)

     A list of GitHub pages for documentation translation and their
     primary contacts.

   ---------- 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 歴史とライセンス: 5d6b.
を参照してください。


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: 5d71.

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: 5d72. 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: 104. 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: 135. 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: 12d. 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: 13a. 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: 106.
で使用しているハッシュテーブルの実装は、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.dialog: f9. A simple dialog box built on the classic Tk widgets.
* tkinter.dnd: fa. Tkinter drag-and-drop interface
* tkinter.filedialog: fb. Dialog classes for file selection
* tkinter.font: fc. Tkinter font-wrapping class
* tkinter.messagebox: fd. Various types of alert dialogs
* tkinter.scrolledtext: fe. Text widget with a vertical scroll bar.
* tkinter.simpledialog: ff. Simple dialog windows
* tkinter.ttk: 100. Tk themed widget set
* token: 101. Constants representing terminal nodes of the parse
                        tree.
* tokenize: 102. Lexical scanner for Python source code.
* tomllib: 103. Parse TOML files.
* trace: 104. Trace or track Python statement execution.
* traceback: 105. Print or retrieve a stack traceback.
* tracemalloc: 106. Trace memory allocations.
* tty: 107. Utility functions that perform common terminal control
                        operations.
* turtle: 108. An educational framework for simple graphics
                        applications
* turtledemo: 109. A viewer for example turtle scripts
* types: 10a. Names for built-in types.
* typing: 10b. Support for type hints (see :pep:'484').
* unicodedata: 10c. Access the Unicode Database.
* unittest: 10d. Unit testing framework for Python.
* unittest.mock: 10e. Mock object library.
* urllib: 10f.
* urllib.error: 110. Exception classes raised by urllib.request.
* urllib.parse: 111. Parse URLs into or assemble them from components.
* urllib.request: 112. Extensible library for opening URLs.
* urllib.response: 113. Response classes used by urllib.
* urllib.robotparser: 114. Load a robots.txt file and answer questions about
                        fetchability of other URLs.
* usercustomize: 115.
* uu: 116. Removed in 3.13.
* uuid: 117. UUID objects (universally unique identifiers)
                        according to RFC 9562
* venv: 118. Creation of virtual environments.
* warnings: 119. Issue warning messages and control their disposition.
* wave: 11a. Provide an interface to the WAV sound format.
* weakref: 11b. Support for weak references and weak dictionaries.
* webbrowser: 11c. Easy-to-use controller for web browsers.
* winreg: 11d. Routines and objects for manipulating the Windows
                        registry.
* winsound: 11e. Access to the sound-playing machinery for Windows.
* wsgiref: 11f. WSGI Utilities and Reference Implementation.
* wsgiref.handlers: 120. WSGI server/gateway base classes.
* wsgiref.headers: 121. WSGI response header tools.
* wsgiref.simple_server: 122. A simple WSGI HTTP server.
* wsgiref.types: 123. WSGI types for static type checking
* wsgiref.util: 124. WSGI environment utilities.
* wsgiref.validate: 125. WSGI conformance checker.
* xdrlib: 126. Removed in 3.13.
* xml: 127. Package containing XML processing modules
* xml.dom: 128. Document Object Model API for Python.
* xml.dom.minidom: 129. Minimal Document Object Model (DOM) implementation.
* xml.dom.pulldom: 12a. Support for building partial DOM trees from SAX
                        events.
* xml.etree.ElementInclude: 12b.
* xml.etree.ElementTree: 12c. Implementation of the ElementTree API.
* xml.parsers.expat: 12d. An interface to the Expat non-validating XML parser.
* xml.parsers.expat.errors: 12e.
* xml.parsers.expat.model: 12f.
* xml.sax: 130. Package containing SAX2 base classes and convenience
                        functions.
* xml.sax.handler: 131. Base classes for SAX event handlers.
* xml.sax.saxutils: 132. Convenience functions and classes for use with SAX.
* xml.sax.xmlreader: 133. Interface which SAX-compliant XML parsers must
                        implement.
* xmlrpc: 134. Server and client modules implementing XML-RPC.
* xmlrpc.client: 135. XML-RPC client access.
* xmlrpc.server: 136. Basic XML-RPC server implementations.
* zipapp: 137. Manage executable Python zip archives
* zipfile: 138. Read and write ZIP-format archive files.
* zipimport: 139. Support for importing Python modules from ZIP
                        archives.
* zlib: 13a. Low-level interface to compression and decompression
                        routines compatible with gzip.
* zoneinfo: 13b. 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)
* _ (下線);文字列のフォーマットで:       Format specification mini-language.
                                                             (line  130)
* __, identifiers:                       ソフトキーワード.   (line   24)
* __abs__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  113)
* __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   87)
* __all__ (package variable):            モジュールのインポート<2>.
                                                             (line    8)
* __all__ (オプションの module 属性):    import 文.          (line   87)
* __and__() (enum.Flag のメソッド):      データ型<2>.        (line  542)
* __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__() (enum.Flag のメソッド):     データ型<2>.        (line  522)
* __bool__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line  315)
* __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  385)
* __call__() (enum.EnumType のメソッド): データ型<2>.        (line   20)
* __call__() (object のメソッド):        呼び出し可能オブジェクトをエミュレートする.
                                                             (line    6)
* __call__() (operator モジュール):      operator --- 関数形式の標準演算子.
                                                             (line  228)
* __call__() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  288)
* __call__() (オブジェクトメソッド):     呼び出し call.      (line  152)
* __callback__ (weakref.ref の属性):     weakref --- Weak references.
                                                             (line  122)
* __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  193)
* __ceil__() (object のメソッド):        数値型をエミュレートする.
                                                             (line  143)
* __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  551)
* __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  121)
* __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  300)
* __contains__() (enum.EnumType のメソッド): データ型<2>.    (line   64)
* __contains__() (enum.Flag のメソッド): データ型<2>.        (line  479)
* __contains__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  199)
* __contains__() (object のメソッド):    コンテナをエミュレートする.
                                                             (line  170)
* __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   85)
* __covariant__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  159)
* __debug__:                             assert 文.          (line   22)
* __debug__ (組み込み変数):              組み込み定数.       (line   69)
* __deepcopy__() (コピープロトコル):     copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   85)
* __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   67)
* __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  335)
* __delitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   76)
* __delitem__() (mailbox.MH のメソッド): MH オブジェクト.    (line   81)
* __delitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  129)
* __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  199)
* __dir__() (enum.EnumType のメソッド):  データ型<2>.        (line   77)
* __dir__() (module のメソッド):         モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __dir__() (object のメソッド):         属性値アクセスをカスタマイズする.
                                                             (line   77)
* __dir__() (unittest.mock.Mock のメソッド): Mock クラス.    (line  294)
* __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  154)
* __eq__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  162)
* __eq__() (memoryview のメソッド):      メモリビュー.       (line  120)
* __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  121)
* __floor__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  184)
* __floor__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  143)
* __floordiv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   11)
* __floordiv__() (operator モジュール):  operator --- 関数形式の標準演算子.
                                                             (line   98)
* __format__:                            組み込み関数.       (line  776)
* __format__() (datetime.date のメソッド): date objects.     (line  333)
* __format__() (datetime.datetime のメソッド): datetime objects.
                                                             (line  762)
* __format__() (datetime.time のメソッド): time objects.     (line  240)
* __format__() (enum.Enum のメソッド):   データ型<2>.        (line  357)
* __format__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  208)
* __format__() (ipaddress.IPv4Address のメソッド): Address オブジェクト.
                                                             (line  196)
* __format__() (ipaddress.IPv6Address のメソッド): Address オブジェクト.
                                                             (line  327)
* __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  698)
* __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   32)
* __getitem__() (email.headerregistry.HeaderRegistry のメソッド): email headerregistry Custom Header Objects.
                                                             (line  380)
* __getitem__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  189)
* __getitem__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  310)
* __getitem__() (enum.EnumType のメソッド): データ型<2>.     (line   85)
* __getitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  146)
* __getitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line   71)
* __getitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  204)
* __getitem__() (re.Match のメソッド):   Match Objects.      (line   91)
* __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  234)
* __iadd__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __iadd__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   34)
* __iand__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __iand__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   39)
* __iconcat__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   44)
* __ifloordiv__() (object のメソッド):   数値型をエミュレートする.
                                                             (line   82)
* __ifloordiv__() (operator モジュール): インプレース in-place 演算子.
                                                             (line   50)
* __ilshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   82)
* __ilshift__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   55)
* __imatmul__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   82)
* __imatmul__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   70)
* __imod__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __imod__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   60)
* __import__() (importlib モジュール):   関数<13>.           (line    6)
* __imul__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __imul__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   65)
* __index__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  129)
* __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  263)
* __init__() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   14)
* __init__() (logging.logging.Formatter のメソッド): フォーマッタ.
                                                             (line   14)
* __init__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line   35)
* __init_subclass__() (enum.Enum のメソッド): データ型<2>.   (line  275)
* __init_subclass__() (object のクラスメソッド): クラス生成をカスタマイズする.
                                                             (line   13)
* __instancecheck__() (type のメソッド): インスタンスのカスタマイズとサブクラスチェック.
                                                             (line   14)
* __int__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  121)
* __interactivehook__ (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1200)
* __inv__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  111)
* __invert__() (enum.Flag のメソッド):   データ型<2>.        (line  560)
* __invert__() (object のメソッド):      数値型をエミュレートする.
                                                             (line  113)
* __invert__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  111)
* __ior__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   82)
* __ior__() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   77)
* __ipow__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __ipow__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   82)
* __irshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   82)
* __irshift__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   87)
* __isub__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __isub__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   92)
* __iter__() (container のメソッド):     イテレータ型.       (line   14)
* __iter__() (enum.EnumType のメソッド): データ型<2>.        (line   93)
* __iter__() (enum.Flag のメソッド):     データ型<2>.        (line  500)
* __iter__() (iterator のメソッド):      イテレータ型.       (line   29)
* __iter__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  115)
* __iter__() (object のメソッド):        コンテナをエミュレートする.
                                                             (line  144)
* __iter__() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   59)
* __itruediv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   82)
* __itruediv__() (operator モジュール):  インプレース in-place 演算子.
                                                             (line   97)
* __ixor__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   82)
* __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  296)
* __len__() (enum.EnumType のメソッド):  データ型<2>.        (line  100)
* __len__() (enum.Flag のメソッド):      データ型<2>.        (line  511)
* __len__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  204)
* __len__() (object のメソッド):         コンテナをエミュレートする.
                                                             (line   44)
* __len__() (マップオブジェクトのメソッド): 基本的なカスタマイズ.
                                                             (line  317)
* __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__():                         Mapping Types --- dict.
                                                             (line  114)
* __missing__() (collections.defaultdict のメソッド): defaultdict オブジェクト.
                                                             (line   30)
* __missing__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  138)
* __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 1672)
* __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  159)
* __ne__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  167)
* __ne__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __ne__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __ne__() (インスタンスメソッド):       比較<2>.            (line   49)
* __neg__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  113)
* __neg__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  140)
* __new__() (enum.Enum のメソッド):      データ型<2>.        (line  305)
* __new__() (object のメソッド):         基本的なカスタマイズ.
                                                             (line    6)
* __new__() (string.templatelib.Interpolation のメソッド): 型.
                                                             (line  282)
* __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  535)
* __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  113)
* __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  182)
* __PYVENV_LAUNCHER__ <1>:               PyConfig.           (line  724)
* __qualname__ (definition の属性):      特殊属性.           (line   15)
* __qualname__ (function の属性):        Special writable attributes.
                                                             (line   20)
* __qualname__ (type の属性):            Special attributes. (line   14)
* __radd__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rand__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rdivmod__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   41)
* __readonly_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  451)
* __reduce__() (object のメソッド):      クラスインスタンスの pickle 化.
                                                             (line  124)
* __reduce_ex__() (object のメソッド):   クラスインスタンスの pickle 化.
                                                             (line  183)
* __release_buffer__() (object のメソッド): Emulating buffer types.
                                                             (line   32)
* __replace__() (replace protocol):      copy --- 浅いコピーおよび深いコピー操作.
                                                             (line  103)
* __repr__() (enum.Enum のメソッド):     データ型<2>.        (line  322)
* __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  152)
* __rfloordiv__() (object のメソッド):   数値型をエミュレートする.
                                                             (line   41)
* __rlshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   41)
* __rmatmul__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   41)
* __rmod__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rmul__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __ror__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   41)
* __round__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  198)
* __round__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  143)
* __rpow__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rrshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   41)
* __rshift__() (object のメソッド):      数値型をエミュレートする.
                                                             (line   11)
* __rshift__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  160)
* __rsub__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __rtruediv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   41)
* __rxor__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   41)
* __self__ (method の属性):              インスタンスメソッド.
                                                             (line   11)
* __self__ (メソッド属性):               インスタンスメソッド.
                                                             (line    9)
* __set__() (object のメソッド):         デスクリプタ descriptor の実装.
                                                             (line   33)
* __set_name__() (object のメソッド):    クラス生成をカスタマイズする.
                                                             (line   47)
* __setattr__() (object のメソッド):     属性値アクセスをカスタマイズする.
                                                             (line   53)
* __setitem__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  204)
* __setitem__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  321)
* __setitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   90)
* __setitem__() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  191)
* __setitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  119)
* __setitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  213)
* __setstate__() (copy プロトコル):      状態を持つオブジェクトの扱い.
                                                             (line    6)
* __setstate__() (object のメソッド):    クラスインスタンスの pickle 化.
                                                             (line   86)
* __slots__:                             用語集<2>.          (line 1579)
* __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 2020)
* __stdin__ (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 2020)
* __stdout__ (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 2020)
* __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  149)
* __str__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  151)
* __str__() (email.headerregistry.Address のメソッド): email headerregistry Custom Header Objects.
                                                             (line  441)
* __str__() (email.headerregistry.Group のメソッド): email headerregistry Custom Header Objects.
                                                             (line  476)
* __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  340)
* __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  143)
* __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  551)
* __xor__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __xor__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  176)
* _, identifiers:                        ソフトキーワード.   (line   25)
* _add_alias_() (enum.Enum のメソッド):  データ型<2>.        (line  379)
* _add_value_alias_() (enum.Enum のメソッド): データ型<2>.   (line  392)
* _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 1927)
* _enter_task() (asyncio モジュール):    Task lifetime support.
                                                             (line   22)
* _exit() (os モジュール):               プロセス管理.       (line  124)
* _Feature (__future__ のクラス):        モジュールコンテンツ<3>.
                                                             (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  221)
* _get_child_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  303)
* _get_preferred_schemes() (sysconfig モジュール): Installation path functions.
                                                             (line   41)
* _getframe() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  899)
* _getframemodulename() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  913)
* _getvalue() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line  135)
* _handle (ctypes.CDLL の属性):          共有ライブラリをロードする.
                                                             (line  122)
* _ignore_ (enum.Enum の属性):           データ型<2>.        (line  188)
* _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 1229)
* _is_immortal() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1317)
* _is_interned() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1333)
* _jit (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1248)
* _jit.is_active() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1276)
* _jit.is_available() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1259)
* _jit.is_enabled() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line 1267)
* _layout_ (ctypes.Structure の属性):    構造化データ型.     (line  136)
* _leave_task() (asyncio モジュール):    Task lifetime support.
                                                             (line   30)
* _length_ (ctypes.Array の属性):        配列とポインタ.     (line   20)
* _log (logging.LoggerAdapter の属性):   LoggerAdapter オブジェクト.
                                                             (line   35)
* _make() (collections.somenamedtuple のクラスメソッド): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  100)
* _makeResult() (unittest.TextTestRunner のメソッド): テストのロードと起動.
                                                             (line  483)
* _missing_() (enum.Enum のメソッド):    データ型<2>.        (line  280)
* _name (ctypes.CDLL の属性):            共有ライブラリをロードする.
                                                             (line  126)
* _name_ (enum.Enum の属性):             データ型<2>.        (line  152)
* _numeric_repr_() (enum.Flag のメソッド): データ型<2>.      (line  571)
* _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   41)
* _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):                Allocating objects on the heap.
                                                             (line  142)
* _Py_TPFLAGS_HAVE_VECTORCALL (C macro): PyTypeObject スロット.
                                                             (line  843)
* _PyBytes_Resize (C function):          バイトオブジェクト<2>.
                                                             (line  215)
* _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<2>.      (line   59)
* _PyInterpreterFrame (C struct):        Internal frames.    (line    8)
* _PyInterpreterState_GetEvalFrameFunc (C function): 高水準 API<2>.
                                                             (line   73)
* _PyInterpreterState_SetEvalFrameFunc (C function): 高水準 API<2>.
                                                             (line   83)
* _PyObject_GetDictPtr (C function):     オブジェクトプロトコル object protocol.
                                                             (line  283)
* _PyObject_New (C function):            Allocating objects on the heap.
                                                             (line    6)
* _PyObject_NewVar (C function):         Allocating objects on the heap.
                                                             (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   56)
* _type_ (ctypes._SimpleCData の属性):   基本データ型<2>.    (line   32)
* _type_ (ctypes.Array の属性):          配列とポインタ.     (line   26)
* _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 2201)
* - (負符号);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:     Regular Expression Syntax.
                                                             (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)
* - (負符号);文字列のフォーマットで:     Format specification mini-language.
                                                             (line   76)
* -=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ->;関数のアノテーション:               関数のアノテーション.
                                                             (line    6)
* ->;関数のアノテーション <1>:           関数定義.           (line  106)
* , (comma):                             Parenthesized forms.
                                                             (line   20)
* , (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)
* , (カンマ);文字列のフォーマットで:     Format specification mini-language.
                                                             (line  130)
* ; (semicolon):                         複合文 compound statement.
                                                             (line   17)
* ; (semicolon) <1>:                     雑多なシステム情報. (line  134)
* ; (コロン);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  978)
* ; (コロン);in SQL statements:          Cursor オブジェクト.
                                                             (line   24)
* ; (コロン);lambda expression:          ラムダ lambda.      (line    6)
* ; (コロン);path separator (POSIX):     雑多なシステム情報. (line  134)
* ; (コロン);スライス:                   Subscriptions and slicings.
                                                             (line   70)
* ; (コロン);文字列のフォーマットで:     Format string syntax.
                                                             (line   13)
* ; (コロン);関数のアノテーション:       関数のアノテーション.
                                                             (line    6)
* ; (コロン);関数のアノテーション <1>:   関数定義.           (line  106)
* ;= (colon equals):                     ブール演算 boolean operation.
                                                             (line   34)
* ! (exclamation mark);in formatted string literal: 文字列メソッド<2>.
                                                             (line  978)
* ! (pdb command):                       Debugger commands.  (line  406)
* ! (エクスクラメーション);curses モジュール内: curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  229)
* ! (エクスクラメーション);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)
* ! (エクスクラメーション);文字列のフォーマットで: Format string syntax.
                                                             (line   13)
* ! f-string:                            文字列メソッド<2>.  (line  978)
* ! formatted string literal:            文字列メソッド<2>.  (line  978)
* ! 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: Regular Expression Syntax.
                                                             (line   77)
* ? (クエスチョンマーク);in SQL statements: Cursor オブジェクト.
                                                             (line   24)
* ? (クエスチョンマーク);in struct format strings: 書式指定文字.
                                                             (line  103)
* ? (クエスチョンマーク);in struct format strings <1>: 書式指定文字.
                                                             (line  200)
* ? (クエスチョンマーク);replacement character: エラーハンドラ.
                                                             (line   14)
* ??;in regular expressions:             Regular Expression Syntax.
                                                             (line   82)
* ?+;in regular expressions:             Regular Expression Syntax.
                                                             (line   92)
* . (ドット);attribute reference:        属性参照.           (line    6)
* . (ドット);glob 形式のワイルドカード:  glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* . (ドット);in numeric literal:         整数リテラル.       (line   65)
* . (ドット);in pathnames:               雑多なシステム情報. (line   99)
* . (ドット);in pathnames <1>:           雑多なシステム情報. (line  129)
* . (ドット);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   30)
* . (ドット);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   23)
* . (ドット);in regular expressions:     Regular Expression Syntax.
                                                             (line   42)
* . (ドット);文字列のフォーマットで:     Format string syntax.
                                                             (line   13)
* ..;in pathnames:                       雑多なシステム情報. (line  105)
* ...:                                   用語集<2>.          (line    9)
* ...;ellipsisリテラル:                  ループの else 節.   (line   55)
* ...;ellipsisリテラル <1>:              Ellipsis.           (line    6)
* ...;ellipsisリテラル <2>:              組み込み定数.       (line   61)
* ...;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 1597)
* ...;placeholder:                       textwrap --- テキストの折り返しと詰め込み.
                                                             (line  272)
* ...;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:            Regular Expression Syntax.
                                                             (line  276)
* (?;in regular expressions:             Regular Expression Syntax.
                                                             (line  238)
* (?!;in regular expressions:            Regular Expression Syntax.
                                                             (line  393)
* (?(;in regular expressions:            Regular Expression Syntax.
                                                             (line  436)
* (?#;in regular expressions:            Regular Expression Syntax.
                                                             (line  382)
* (?<!;in regular expressions:           Regular Expression Syntax.
                                                             (line  427)
* (?<=;in regular expressions:           Regular Expression Syntax.
                                                             (line  400)
* (?=;in regular expressions:            Regular Expression Syntax.
                                                             (line  386)
* (?P<;in regular expressions:           Regular Expression Syntax.
                                                             (line  338)
* (?P=;in regular expressions:           Regular Expression Syntax.
                                                             (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:    Regular Expression Syntax.
                                                             (line  230)
* () (丸括弧);tuple display:             Parenthesized forms.
                                                             (line    6)
* [] (角カッコ);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* [] (角カッコ);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* [] (角カッコ);in assignment target list: 代入文 assignment statement.
                                                             (line   34)
* [] (角カッコ);in regular expressions:  Regular Expression Syntax.
                                                             (line  166)
* [] (角カッコ);list expression:         リスト表示.         (line    6)
* [] (角カッコ);文字列のフォーマットで:  Format string syntax.
                                                             (line   13)
* [] (角カッコ);添字表記:                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  978)
* {} (波括弧);in regular expressions:    Regular Expression Syntax.
                                                             (line  111)
* {} (波括弧);set expression:            集合表示.           (line    6)
* {} (波括弧);文字列のフォーマットで:    Format string syntax.
                                                             (line   13)
* @ (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   83)
* * (アスタリスク);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: Regular Expression Syntax.
                                                             (line   65)
* * (アスタリスク);関数呼び出しの中の:   任意引数リスト.     (line    6)
* * (アスタリスク);関数呼び出しの中の <1>: 呼び出し call.    (line   69)
* *?;in regular expressions:             Regular Expression Syntax.
                                                             (line   82)
* **;function definition:                関数定義.           (line   91)
* **;glob 形式のワイルドカード:          glob --- Unix 形式のパス名のパターン展開.
                                                             (line   52)
* **;in dictionary displays:             辞書表示.           (line   23)
* **;関数呼び出しの中の:                 引数リストのアンパック.
                                                             (line   18)
* **;関数呼び出しの中の <1>:             呼び出し call.      (line   96)
* **=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* *+;in regular expressions:             Regular Expression Syntax.
                                                             (line   92)
* *=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* / (スラッシュ);function definition:    関数定義.           (line   91)
* / (スラッシュ);in pathnames:           雑多なシステム情報. (line  111)
* / (スラッシュ);in pathnames <1>:       雑多なシステム情報. (line  121)
* //=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* /=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* \ (backslash);in pathnames (Windows):  雑多なシステム情報. (line  111)
* \ (backslash);in regular expressions:  Regular Expression Syntax.
                                                             (line  151)
* \ (backslash);in regular expressions <1>: Regular Expression Syntax.
                                                             (line  185)
* \ (backslash);in regular expressions <2>: Regular Expression Syntax.
                                                             (line  454)
* \ (backslash);エスケープシーケンス:    Formal grammar.     (line   28)
* \ (backslash);エスケープシーケンス <1>: エラーハンドラ.    (line   14)
* \\;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \\;エスケープシーケンス:               Formal grammar.     (line   28)
* \A;in regular expressions:             Regular Expression Syntax.
                                                             (line  466)
* \a;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \a;エスケープシーケンス:               Formal grammar.     (line   28)
* \b;in regular expressions:             Regular Expression Syntax.
                                                             (line  470)
* \B;in regular expressions:             Regular Expression Syntax.
                                                             (line  487)
* \b;in regular expressions <1>:         Regular Expression Syntax.
                                                             (line  585)
* \b;エスケープシーケンス:               Formal grammar.     (line   28)
* \d;in regular expressions:             Regular Expression Syntax.
                                                             (line  499)
* \D;in regular expressions:             Regular Expression Syntax.
                                                             (line  513)
* \f;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \f;エスケープシーケンス:               Formal grammar.     (line   28)
* \g;in regular expressions:             関数<2>.            (line  209)
* \n;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \N;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \n;エスケープシーケンス:               Formal grammar.     (line   28)
* \N;エスケープシーケンス:               Formal grammar.     (line   28)
* \N;エスケープシーケンス <1>:           エラーハンドラ.     (line   52)
* \r;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \r;エスケープシーケンス:               Formal grammar.     (line   28)
* \s;in regular expressions:             Regular Expression Syntax.
                                                             (line  520)
* \S;in regular expressions:             Regular Expression Syntax.
                                                             (line  537)
* \t;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \t;エスケープシーケンス:               Formal grammar.     (line   28)
* \u;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \U;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \u;エスケープシーケンス:               Formal grammar.     (line   28)
* \U;エスケープシーケンス:               Formal grammar.     (line   27)
* \u;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \U;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \v;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \v;エスケープシーケンス:               Formal grammar.     (line   28)
* \w;in regular expressions:             Regular Expression Syntax.
                                                             (line  545)
* \W;in regular expressions:             Regular Expression Syntax.
                                                             (line  563)
* \x;in regular expressions:             Regular Expression Syntax.
                                                             (line  585)
* \x;エスケープシーケンス:               Formal grammar.     (line   28)
* \x;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \z;in regular expressions:             Regular Expression Syntax.
                                                             (line  575)
* \Z;in regular expressions:             Regular Expression Syntax.
                                                             (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   55)
* # (hash);文字列のフォーマットで:       Format specification mini-language.
                                                             (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  229)
* ^ (キャレット);in regular expressions: Regular Expression Syntax.
                                                             (line   49)
* ^ (キャレット);in regular expressions <1>: Regular Expression Syntax.
                                                             (line  195)
* ^ (キャレット);marker:                 例外はどう扱えばよいか?.
                                                             (line   92)
* ^ (キャレット);marker <1>:             モジュールレベルの関数<2>.
                                                             (line   36)
* ^ (キャレット);文字列のフォーマットで: Format specification mini-language.
                                                             (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: Regular Expression Syntax.
                                                             (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)
* + (プラス記号);文字列のフォーマットで: Format specification mini-language.
                                                             (line   76)
* +?;in regular expressions:             Regular Expression Syntax.
                                                             (line   82)
* ++;in regular expressions:             Regular Expression Syntax.
                                                             (line   92)
* +=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* < (小さい);in struct format strings:   バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* < (小さい);文字列のフォーマットで:     Format specification mini-language.
                                                             (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  977)
* = (等号);function definition:          関数定義.           (line   67)
* = (等号);in struct format strings:     バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* = (等号);文字列のフォーマットで:       Format specification mini-language.
                                                             (line   46)
* = (等号);関数呼び出しの中の:           Formal subscription grammar.
                                                             (line   15)
* > (大きい);in struct format strings:   バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* > (大きい);文字列のフォーマットで:     Format specification mini-language.
                                                             (line   46)
* >>=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* >>>:                                   用語集<2>.          (line    6)
* >>>;interpreter prompt:                docstring 内の実行例をどのように認識するのか?.
                                                             (line   26)
* >>>;interpreter prompt <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1597)
* | (縦棒);in regular expressions:       Regular Expression Syntax.
                                                             (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:     Regular Expression Syntax.
                                                             (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  146)
* a2b_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   72)
* a2b_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   25)
* a85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   66)
* a85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   37)
* 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  152)
* abort_clients() (asyncio.Server のメソッド): Server objects.
                                                             (line   56)
* abort() (asyncio.Barrier のメソッド):  Barrier.            (line   87)
* 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  167)
* ABOVE_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   68)
* above() (curses.panel.Panel のメソッド): Panel objects.    (line   13)
* abs() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  264)
* abs() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line   83)
* absolute_import (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (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 のクラス):  Event loop implementations.
                                                             (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   69)
* 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  648)
* aclosing() (contextlib モジュール):    ユーティリティ.     (line  189)
* acos() (cmath モジュール):             三角関数<2>.        (line    6)
* acos() (math モジュール):              三角関数.           (line    6)
* acosh() (cmath モジュール):            双曲線関数<2>.      (line    6)
* acosh() (math モジュール):             双曲線関数.         (line    9)
* acquire() (_thread.LockType のメソッド): _thread --- 低水準なスレッド API.
                                                             (line  141)
* acquire() (asyncio.Condition のメソッド): Condition.       (line   46)
* acquire() (asyncio.Lock のメソッド):   Lock.               (line   36)
* acquire() (asyncio.Semaphore のメソッド): Semaphore.       (line   43)
* acquire() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   27)
* acquire() (multiprocessing.Lock のメソッド): 同期プリミティブ.
                                                             (line   86)
* acquire() (multiprocessing.RLock のメソッド): 同期プリミティブ.
                                                             (line  145)
* acquire() (threading.Condition のメソッド): Condition objects.
                                                             (line   84)
* acquire() (threading.Lock のメソッド): Lock objects.       (line   44)
* acquire() (threading.RLock のメソッド): RLock objects.     (line   45)
* acquire() (threading.Semaphore のメソッド): Semaphore objects.
                                                             (line   34)
* 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 1855)
* activate() (tkinter.Listbox のメソッド): Widget classes.   (line  961)
* activate() (tkinter.Menu のメソッド):  Widget classes.     (line 1273)
* activate() (tkinter.Scrollbar のメソッド): Widget classes. (line 1592)
* ACTIVE (tkinter モジュール):           定数<10>.           (line  106)
* active_children() (multiprocessing モジュール): その他<5>. (line    6)
* active_count() (threading モジュール): リファレンス<2>.    (line    8)
* actual() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   51)
* Add (ast のクラス):                    式 expression<2>.   (line   55)
* add_alias() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  198)
* 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_cascade() (tkinter.Menu のメソッド): Widget classes.   (line 1169)
* add_cgi_vars() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  135)
* add_charset() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  168)
* add_checkbutton() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1176)
* add_codec() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  207)
* add_command() (tkinter.Menu のメソッド): Widget classes.   (line 1183)
* add_cookie_header() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   12)
* add_dll_directory() (os モジュール):   プロセス管理.       (line   24)
* add_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   84)
* add_done_callback() (asyncio.Task のメソッド): Task object.
                                                             (line  105)
* 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  369)
* 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_radiobutton() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1189)
* 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_separator() (tkinter.Menu のメソッド): Widget classes. (line 1196)
* 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  268)
* 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 のメソッド):       The Stats Class.    (line   49)
* add() (set のメソッド):                set（集合）型 --- set frozenset.
                                                             (line  197)
* add() (tarfile.TarFile のメソッド):    TarFile オブジェクト.
                                                             (line  276)
* add() (tkinter.Menu のメソッド):       Widget classes.     (line 1057)
* add() (tkinter.PanedWindow のメソッド): Widget classes.    (line 1374)
* add() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line    8)
* addAsyncCleanup() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  946)
* addaudithook() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line   25)
* addch() (curses.window のメソッド):    Window objects.     (line   11)
* addClassCleanup() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  869)
* addCleanup() (unittest.TestCase のメソッド): テストクラス. (line  830)
* addcomponent() (turtle.Shape のメソッド): Public classes.  (line   67)
* addDuration() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  428)
* addError() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  359)
* addExpectedFailure() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  395)
* addFailure() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  370)
* 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 objects.     (line   24)
* AddPackagePath() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   16)
* addr_spec (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  435)
* Address (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  398)
* address (email.headerregistry.SingleAddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  218)
* 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オブジェクト.
                                                             (line   65)
* address_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  385)
* addresses (email.headerregistry.AddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  193)
* addresses (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  471)
* AddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  178)
* addressof() (ctypes モジュール):       ユーティリティー関数.
                                                             (line    6)
* AddressValueError:                     Custom Exceptions.  (line    9)
* addshape() (turtle モジュール):        設定と特殊なメソッド.
                                                             (line   70)
* addsitedir() (site モジュール):        モジュールの内容<6>.
                                                             (line   52)
* addSkip() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  387)
* addstr() (curses.window のメソッド):   Window objects.     (line   31)
* addSubTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  413)
* addSuccess() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  381)
* addtag_above() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  432)
* addtag_all() (tkinter.Canvas のメソッド): Widget classes.  (line  437)
* addtag_below() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  441)
* addtag_closest() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  446)
* addtag_enclosed() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  455)
* addtag_overlapping() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  461)
* addtag_withtag() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  467)
* addtag() (tkinter.Canvas のメソッド):  Widget classes.     (line  423)
* addTest() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   25)
* addTests() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   30)
* addTypeEqualityFunc() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  653)
* addUnexpectedSuccess() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  405)
* adjust_int_max_str_digits() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  777)
* adjusted() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  112)
* 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)
* after_cancel() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  422)
* after_idle() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  434)
* after_info() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  445)
* after() (tkinter.Misc のメソッド):     Base and mixin classes.
                                                             (line  406)
* alarm() (signal モジュール):           モジュールの内容<3>.
                                                             (line  296)
* 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 1071)
* algorithms_available (hashlib モジュール): 属性.           (line   18)
* algorithms_guaranteed (hashlib モジュール): 属性.          (line    8)
* alias (ast のクラス):                  インポート.         (line   39)
* alias (pdb command):                   Debugger commands.  (line  378)
* alignment() (ctypes モジュール):       ユーティリティー関数.
                                                             (line   14)
* alive (weakref.finalize の属性):       weakref --- Weak references.
                                                             (line  305)
* ALL (tkinter モジュール):              定数<10>.           (line  100)
* ALL_COMPLETED (asyncio モジュール):    Waiting primitives. (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   77)
* allocfunc (C type):                    Slot Type typedefs. (line    6)
* ALLOW_MISSING (os.path モジュール):    os path --- 一般的なパス名操作.
                                                             (line  447)
* allow_reuse_address (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   93)
* allowed_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   64)
* ALT_DIGITS (locale モジュール):        locale --- 国際化サービス.
                                                             (line  335)
* alt() (curses.ascii モジュール):       curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  221)
* altsep (os モジュール):                雑多なシステム情報. (line  121)
* 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   45)
* anchor (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line   65)
* ANCHOR (tkinter モジュール):           定数<10>.           (line   87)
* anchor() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line  145)
* 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__ モジュール):   モジュールコンテンツ<3>.
                                                             (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 2158)
* apilevel (sqlite3 モジュール):         モジュール定数.     (line   64)
* apop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   40)
* append_history_file() (readline モジュール): 履歴ファイル. (line   27)
* append() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  132)
* append() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   37)
* append() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line   92)
* 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   41)
* 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)
* apply() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   61)
* APRIL (calendar モジュール):           calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* ARC (tkinter モジュール):              定数<10>.           (line  130)
* 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  266)
* args (subprocess.CompletedProcess の属性): Using the subprocess Module.
                                                             (line  104)
* args (subprocess.Popen の属性):        Popen オブジェクト. (line  110)
* 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  224)
* argv (in module sys) <1>:              PyConfig.           (line  126)
* argv (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line   69)
* ArithmeticError:                       基底クラス.         (line   68)
* array (array のクラス):                array --- 効率的な数値配列.
                                                             (line   97)
* Array (ctypes のクラス):               配列とポインタ.     (line    6)
* ARRAY() (ctypes モジュール):           配列とポインタ.     (line   33)
* 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 モジュール):   Waiting primitives. (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   73)
* as_integer_ratio():                    fractions --- 有理数.
                                                             (line   15)
* as_integer_ratio() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  119)
* as_integer_ratio() (float のメソッド): 浮動小数点数に対する追加のメソッド.
                                                             (line   23)
* as_integer_ratio() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  121)
* 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  132)
* 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   41)
* 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  212)
* asctime() (time モジュール):           関数<5>.            (line    6)
* asdict() (dataclasses モジュール):     モジュールの内容<5>.
                                                             (line  355)
* 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   21)
* askdirectory() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   60)
* 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  124)
* askopenfile() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   31)
* askopenfilename() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   46)
* askopenfilenames() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   46)
* askopenfiles() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   31)
* askquestion() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  118)
* askretrycancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  131)
* asksaveasfile() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   40)
* asksaveasfilename() (tkinter.filedialog モジュール): Native load/save dialogs.
                                                             (line   54)
* askstring() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askyesno() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  138)
* askyesnocancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  144)
* aspect() (tkinter.Wm のメソッド):      Base and mixin classes.
                                                             (line 1196)
* Assert (ast のクラス):                 文 Statements.      (line  126)
* assert_any_await() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  831)
* assert_any_call() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  148)
* assert_awaited_once_with() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  814)
* assert_awaited_once() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  781)
* assert_awaited_with() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  797)
* assert_awaited() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  761)
* assert_called_once_with() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  133)
* assert_called_once() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  105)
* assert_called_with() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  123)
* assert_called() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line   94)
* assert_has_awaits() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  848)
* assert_has_calls() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  163)
* assert_never() (typing モジュール):    Functions and decorators.
                                                             (line   43)
* assert_not_awaited() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  875)
* assert_not_called() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  186)
* 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  547)
* assertCountEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  603)
* assertDictEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  741)
* assertEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  628)
* assertEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  183)
* assertFalse() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  206)
* assertGreater() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  571)
* assertGreaterEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  571)
* assertHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  638)
* assertIn() (unittest.TestCase のメソッド): テストクラス.   (line  235)
* 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  219)
* assertIsInstance() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  243)
* assertIsNone() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  227)
* assertIsNot() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  219)
* assertIsNotNone() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  227)
* assertIsSubclass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  254)
* assertLess() (unittest.TestCase のメソッド): テストクラス. (line  571)
* assertLessEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  571)
* assertListEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  718)
* assertLogs() (unittest.TestCase のメソッド): テストクラス. (line  430)
* assertMultiLineEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  694)
* assertNoLogs() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  474)
* assertNotAlmostEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  547)
* assertNotEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  630)
* assertNotEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  201)
* assertNotHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  640)
* assertNotIn() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  235)
* assertNotInBytecode() (test.support.bytecode_helper.BytecodeTestCase のメソッド): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   28)
* assertNotIsInstance() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  243)
* assertNotIsSubclass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  254)
* assertNotRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  585)
* assertNotStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  620)
* assertRaises() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  295)
* assertRaisesRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  337)
* assertRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  585)
* assertSequenceEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  704)
* assertSetEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  729)
* assertStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  618)
* assertTrue() (unittest.TestCase のメソッド): テストクラス. (line  206)
* assertTupleEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  718)
* assertWarns() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  364)
* assertWarnsRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  406)
* 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 モジュール):    モジュールの内容<5>.
                                                             (line  387)
* async for;in comprehensions:           Displays for lists sets and dictionaries.
                                                             (line   14)
* AsyncContextDecorator (contextlib のクラス): ユーティリティ.
                                                             (line  467)
* AsyncContextManager (typing のクラス): Aliases to contextlib ABCs.
                                                             (line   25)
* asynccontextmanager() (contextlib モジュール): ユーティリティ.
                                                             (line   93)
* AsyncExitStack (contextlib のクラス):  ユーティリティ.     (line  619)
* 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   88)
* asynchronous generator:                用語集<2>.          (line   95)
* asynchronous generator function:       用語集<2>.          (line  104)
* asynchronous generator iterator:       用語集<2>.          (line  115)
* asynchronous generator;asynchronous iterator: 非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous generator;関数:           非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous iterable:                 用語集<2>.          (line  131)
* asynchronous iterator:                 用語集<2>.          (line  138)
* 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  690)
* AsyncResult (multiprocessing.pool のクラス): プロセスプール.
                                                             (line  200)
* asyncSetUp() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  924)
* asyncTearDown() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  933)
* 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  310)
* athrow() (agen のメソッド):            非同期ジェネレータイテレータメソッド.
                                                             (line   42)
* atof() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  507)
* atoi() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  513)
* atom:                                  アトム、原子的要素 atom.
                                                             (line    6)
* atomic operation:                      用語集<2>.          (line  147)
* attach_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  255)
* attach() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  168)
* attached thread state:                 用語集<2>.          (line  157)
* attempted (doctest.TestResults の属性): TestResults objects.
                                                             (line   12)
* AttlistDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  351)
* 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)
* attributes() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1208)
* AttributesImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   67)
* AttributesNSImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   77)
* attroff() (curses.window のメソッド):  Window objects.     (line   53)
* attron() (curses.window のメソッド):   Window objects.     (line   58)
* attrset() (curses.window のメソッド):  Window objects.     (line   63)
* audit() (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line   89)
* auditing:                              sys --- システム固有のパラメーターと関数.
                                                             (line   91)
* AugAssign (ast のクラス):              文 Statements.      (line   94)
* augmented;代入:                        累算代入文 augmented assignment statement.
                                                             (line    6)
* AUGUST (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* auth() (ftplib.FTP_TLS のメソッド):    FTP_TLS オブジェクト.
                                                             (line   89)
* auth() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line  135)
* authenticate() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   36)
* AuthenticationError:                   Process クラスと例外.
                                                             (line  291)
* authenticators() (netrc.netrc のメソッド): netrc オブジェクト.
                                                             (line    8)
* authkey (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  175)
* auto (enum のクラス):                  Utilities and decorators.
                                                             (line    6)
* autocommit (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  745)
* autorange() (timeit.Timer のメソッド): Python Interface.   (line   87)
* available_timezones() (zoneinfo モジュール): 関数<3>.      (line    6)
* avoids_symlink_attacks (shutil.rmtree の属性): ディレクトリとファイルの操作.
                                                             (line  344)
* Await (ast のクラス):                  async と await.     (line   14)
* await_args (unittest.mock.AsyncMock の属性): Mock クラス.  (line  904)
* await_args_list (unittest.mock.AsyncMock の属性): Mock クラス.
                                                             (line  922)
* await_count (unittest.mock.AsyncMock の属性): Mock クラス. (line  888)
* await;in comprehensions:               Displays for lists sets and dictionaries.
                                                             (line   44)
* awaitable:                             用語集<2>.          (line  192)
* 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  128)
* b16encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  123)
* b2a_base64() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line   63)
* b2a_hex() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  117)
* b2a_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   79)
* b2a_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   32)
* b32decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   81)
* b32encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   76)
* b32hexdecode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  111)
* b32hexencode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  104)
* b64decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   25)
* b64encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   10)
* b85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  103)
* b85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   89)
* 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  182)
* 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)
* BASELINE (tkinter モジュール):         定数<10>.           (line   77)
* 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オブジェクト. (line    6)
* BaseTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line    6)
* BaseWidget (tkinter のクラス):         Base and mixin classes.
                                                             (line 2002)
* basicConfig() (logging モジュール):    モジュールレベルの関数.
                                                             (line  194)
* BasicContext (decimal モジュール):     Context オブジェクト.
                                                             (line   71)
* BasicInterpolation (configparser のクラス): 値の補間.      (line   10)
* batched() (itertools モジュール):      Itertool関数.       (line   71)
* baudrate() (curses モジュール):        関数<6>.            (line   35)
* bbox() (tkinter.Canvas のメソッド):    Widget classes.     (line  567)
* bbox() (tkinter.Grid のメソッド):      Base and mixin classes.
                                                             (line 1896)
* bbox() (tkinter.Listbox のメソッド):   Widget classes.     (line  935)
* bbox() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  158)
* bbox() (tkinter.Spinbox のメソッド):   Widget classes.     (line 1674)
* bbox() (tkinter.Text のメソッド):      Widget classes.     (line 1900)
* bbox() (tkinter.ttk.Entry のメソッド): Additional widgets. (line   43)
* 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  125)
* BdbQuit:                               bdb --- デバッガーフレームワーク.
                                                             (line   15)
* BDFL:                                  用語集<2>.          (line  198)
* beep() (curses モジュール):            関数<6>.            (line   43)
* 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)
* bell() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  756)
* BELOW_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   75)
* below() (curses.panel.Panel のメソッド): Panel objects.    (line   17)
* betavariate() (random モジュール):     実数分布.           (line   29)
* BEVEL (tkinter モジュール):            定数<10>.           (line  136)
* 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 モジュール):               Utilities and decorators.
                                                             (line  109)
* Binary (xmlrpc.client のクラス):       Binary オブジェクト.
                                                             (line    6)
* binary file:                           用語集<2>.          (line  203)
* 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):                        Bindings and events.
                                                             (line    6)
* bind_all() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line  319)
* bind_class() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  305)
* 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   88)
* bind() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  280)
* bindtags() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line  352)
* 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)
* BitmapImage (tkinter のクラス):        Image classes.      (line  266)
* BitOr (ast のクラス):                  式 expression<2>.   (line   55)
* bits_per_digit (sys.int_info の属性):  sys --- システム固有のパラメーターと関数.
                                                             (line 1174)
* BitXor (ast のクラス):                 式 expression<2>.   (line   55)
* bk() (turtle モジュール):              Turtle の動き.      (line   24)
* bkgd() (curses.window のメソッド):     Window objects.     (line   68)
* bkgdset() (curses.window のメソッド):  Window objects.     (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)
* blank() (tkinter.PhotoImage のメソッド): Image classes.    (line   55)
* BLKTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  346)
* Blob (sqlite3 のクラス):               Blob オブジェクト.  (line    6)
* blobopen() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   35)
* block_on_close (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   44)
* 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  163)
* BNF:                                   本マニュアルにおける表記法.
                                                             (line    6)
* BNF <1>:                               式 expression.      (line    6)
* body_encode() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  139)
* body_encoding (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   67)
* body_line_iterator() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   14)
* body() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   43)
* BOLD (tkinter.font モジュール):        tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* BOM (codecs モジュール):               codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_BE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_LE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF16 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF16_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF16_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF32 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF32_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF32_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* BOM_UTF8 (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line  277)
* bool (組み込みクラス):                 組み込み関数.       (line  133)
* BOOLEAN_STATES (configparser.ConfigParser の属性): パーサーの振る舞いをカスタマイズする.
                                                             (line  235)
* Boolean;''values'':                    ブーリアン型 - bool.
                                                             (line    9)
* Boolean;type:                          組み込み関数.       (line  144)
* Boolean;操作:                          真理値判定.         (line    6)
* Boolean;操作 <1>:                      ブール演算 --- and or not.
                                                             (line    6)
* Boolean;演算:                          ブール演算 boolean operation.
                                                             (line    6)
* BooleanOptionalAction (argparse のクラス): Action クラス.  (line   64)
* BooleanVar (tkinter のクラス):         Variable classes.   (line  140)
* BoolOp (ast のクラス):                 式 expression<2>.   (line   71)
* bootstrap() (ensurepip モジュール):    モジュール API.     (line   13)
* border() (curses.window のメソッド):   Window objects.     (line   88)
* borrowed reference:                    用語集<2>.          (line  215)
* BOTH (tkinter モジュール):             定数<10>.           (line   47)
* BOTTOM (tkinter モジュール):           定数<10>.           (line   39)
* bottom_panel() (curses.panel モジュール): 関数<7>.         (line    8)
* bottom() (curses.panel.Panel のメソッド): Panel objects.   (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   71)
* BoundedSemaphore() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  170)
* bounds() (compression.zstd.CompressionParameter のメソッド): Advanced parameter control.
                                                             (line   28)
* bounds() (compression.zstd.DecompressionParameter のメソッド): Advanced parameter control.
                                                             (line  278)
* box() (curses.window のメソッド):      Window objects.     (line  127)
* bpbynumber (bdb.Breakpoint の属性):    bdb --- デバッガーフレームワーク.
                                                             (line  108)
* bpformat() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   57)
* bplist (bdb.Breakpoint の属性):        bdb --- デバッガーフレームワーク.
                                                             (line  112)
* 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  285)
* break_here() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  276)
* break_long_words (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  246)
* break_on_hyphens (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  254)
* 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  103)
* broken (threading.Barrier の属性):     Barrier objects.    (line  100)
* BrokenBarrierError:                    Barrier objects.    (line  104)
* BrokenBarrierError <1>:                Barrier.            (line  107)
* BrokenExecutor:                        例外クラス.         (line   18)
* BrokenInterpreterPool:                 例外クラス.         (line   41)
* BrokenPipeError:                       OS 例外.            (line   38)
* BrokenProcessPool:                     例外クラス.         (line   49)
* BrokenThreadPool:                      例外クラス.         (line   33)
* BROWSE (tkinter モジュール):           定数<10>.           (line  122)
* BROWSER:                               webbrowser.         (line    6)
* BROWSER <1>:                           webbrowser.         (line   10)
* BROWSER <2>:                           ライブラリ<28>.     (line  420)
* BROWSER <3>:                           ライブラリ<28>.     (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  318)
* btopt (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  320)
* 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  322)
* btultra2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  324)
* 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  289)
* 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  189)
* buffer size, I/O:                      組み込み関数.       (line 1461)
* buffer_info() (array.array のメソッド): array --- 効率的な数値配列.
                                                             (line  137)
* buffer_size (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  232)
* buffer_text (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  238)
* buffer_updated() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   34)
* buffer_used (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  249)
* BufferedIOBase (io のクラス):          I/O 基底クラス.     (line  241)
* BufferedProtocol (asyncio のクラス):   基底プロトコル.     (line   16)
* BufferedRandom (io のクラス):          バッファ付きストリーム.
                                                             (line  138)
* BufferedReader (io のクラス):          バッファ付きストリーム.
                                                             (line   57)
* BufferedRWPair (io のクラス):          バッファ付きストリーム.
                                                             (line  153)
* 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  283)
* 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 2169)
* 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  108)
* built-in function; breakpoint():       組み込み関数.       (line  146)
* built-in function; callable():         組み込み関数.       (line  225)
* built-in function; chr():              組み込み関数.       (line  238)
* built-in function; classmethod():      組み込み関数.       (line  247)
* built-in function; compile():          組み込み関数.       (line  287)
* built-in function; delattr():          組み込み関数.       (line  438)
* built-in function; dir():              組み込み関数.       (line  461)
* built-in function; divmod():           組み込み関数.       (line  520)
* built-in function; enumerate():        組み込み関数.       (line  531)
* built-in function; eval():             組み込み関数.       (line  554)
* built-in function; exec():             組み込み関数.       (line  627)
* built-in function; filter():           組み込み関数.       (line  694)
* built-in function; format():           組み込み関数.       (line  776)
* built-in function; getattr():          組み込み関数.       (line  809)
* built-in function; globals():          組み込み関数.       (line  828)
* built-in function; hasattr():          組み込み関数.       (line  834)
* built-in function; hash():             組み込み関数.       (line  841)
* built-in function; help():             組み込み関数.       (line  852)
* built-in function; hex():              組み込み関数.       (line  876)
* built-in function; id():               組み込み関数.       (line  906)
* built-in function; input():            組み込み関数.       (line  918)
* built-in function; isinstance():       組み込み関数.       (line 1016)
* built-in function; issubclass():       組み込み関数.       (line 1033)
* built-in function; iter():             組み込み関数.       (line 1046)
* built-in function; len():              組み込み関数.       (line 1076)
* built-in function; locals():           組み込み関数.       (line 1092)
* built-in function; map():              組み込み関数.       (line 1140)
* built-in function; max():              組み込み関数.       (line 1154)
* built-in function; min():              組み込み関数.       (line 1189)
* built-in function; multiprocessing.Manager(): マネージャー.
                                                             (line   12)
* built-in function; next():             組み込み関数.       (line 1219)
* built-in function; oct():              組み込み関数.       (line 1239)
* built-in function; open():             組み込み関数.       (line 1264)
* built-in function; ord():              組み込み関数.       (line 1508)
* built-in function; pow():              組み込み関数.       (line 1520)
* built-in function; print():            組み込み関数.       (line 1562)
* built-in function; property.deleter(): 組み込み関数.       (line 1638)
* built-in function; property.getter():  組み込み関数.       (line 1634)
* built-in function; property.setter():  組み込み関数.       (line 1636)
* built-in function; repr():             組み込み関数.       (line 1687)
* built-in function; reversed():         組み込み関数.       (line 1709)
* built-in function; round():            組み込み関数.       (line 1717)
* built-in function; setattr():          組み込み関数.       (line 1752)
* built-in function; sorted():           組み込み関数.       (line 1801)
* built-in function; staticmethod():     組み込み関数.       (line 1836)
* built-in function; sum():              組み込み関数.       (line 1895)
* built-in function; vars():             組み込み関数.       (line 2050)
* built-in function; zip():              組み込み関数.       (line 2073)
* 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_cget() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  840)
* busy_config() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  816)
* busy_configure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  816)
* busy_current() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  872)
* busy_forget() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  851)
* busy_hold() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  797)
* busy_retry() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  217)
* busy_status() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  863)
* busy() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  797)
* BUTT (tkinter モジュール):             定数<10>.           (line  136)
* Button (tkinter のクラス):             Widget classes.     (line    6)
* Button (tkinter.ttk のクラス):         Additional widgets. (line   10)
* 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   48)
* 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  248)
* 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   86)
* bytes (組み込みクラス):                バイトオブジェクト. (line   11)
* bytes_le (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   91)
* bytes_warning (sys.flags の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line  555)
* bytes-like object:                     用語集<2>.          (line  229)
* 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   28)
* 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  157)
* 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  257)
* c_byte (ctypes のクラス):              基本データ型<2>.    (line   69)
* c_char (ctypes のクラス):              基本データ型<2>.    (line   75)
* c_char_p (ctypes のクラス):            基本データ型<2>.    (line   81)
* C_CONTIGUOUS (inspect.BufferFlags の属性): Buffer flags.   (line   25)
* c_contiguous (memoryview の属性):      メモリビュー.       (line  506)
* c_double (ctypes のクラス):            基本データ型<2>.    (line   88)
* c_double_complex (ctypes のクラス):    基本データ型<2>.    (line  105)
* c_float (ctypes のクラス):             基本データ型<2>.    (line  100)
* c_float_complex (ctypes のクラス):     基本データ型<2>.    (line  112)
* c_int (ctypes のクラス):               基本データ型<2>.    (line  126)
* c_int16 (ctypes のクラス):             基本データ型<2>.    (line  138)
* c_int32 (ctypes のクラス):             基本データ型<2>.    (line  143)
* c_int64 (ctypes のクラス):             基本データ型<2>.    (line  148)
* c_int8 (ctypes のクラス):              基本データ型<2>.    (line  133)
* c_long (ctypes のクラス):              基本データ型<2>.    (line  153)
* c_longdouble (ctypes のクラス):        基本データ型<2>.    (line   93)
* c_longdouble_complex (ctypes のクラス): 基本データ型<2>.   (line  119)
* c_longlong (ctypes のクラス):          基本データ型<2>.    (line  158)
* C_RAISE (monitoring event):            Events.             (line   25)
* C_RETURN (monitoring event):           Events.             (line   30)
* c_short (ctypes のクラス):             基本データ型<2>.    (line  165)
* c_size_t (ctypes のクラス):            基本データ型<2>.    (line  170)
* c_ssize_t (ctypes のクラス):           基本データ型<2>.    (line  175)
* c_time_t (ctypes のクラス):            基本データ型<2>.    (line  183)
* c_ubyte (ctypes のクラス):             基本データ型<2>.    (line  190)
* c_uint (ctypes のクラス):              基本データ型<2>.    (line  196)
* c_uint16 (ctypes のクラス):            基本データ型<2>.    (line  208)
* c_uint32 (ctypes のクラス):            基本データ型<2>.    (line  213)
* c_uint64 (ctypes のクラス):            基本データ型<2>.    (line  218)
* c_uint8 (ctypes のクラス):             基本データ型<2>.    (line  203)
* c_ulong (ctypes のクラス):             基本データ型<2>.    (line  223)
* c_ulonglong (ctypes のクラス):         基本データ型<2>.    (line  228)
* c_ushort (ctypes のクラス):            基本データ型<2>.    (line  235)
* c_void_p (ctypes のクラス):            基本データ型<2>.    (line  240)
* c_wchar (ctypes のクラス):             基本データ型<2>.    (line  245)
* c_wchar_p (ctypes のクラス):           基本データ型<2>.    (line  251)
* C-contiguous:                          shape strides suboffsets.
                                                             (line   34)
* C-contiguous <1>:                      用語集<2>.          (line  385)
* 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  203)
* cache_from_source() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   21)
* cache_info() (functools.lru_cache のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  198)
* 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  427)
* call_args_list (unittest.mock.Mock の属性): Mock クラス.   (line  472)
* call_at() (asyncio.loop のメソッド):   遅延コールバックのスケジューリング.
                                                             (line   43)
* call_count (unittest.mock.Mock の属性): Mock クラス.       (line  324)
* call_evaluate_function() (annotationlib モジュール): 関数<12>.
                                                             (line   55)
* call_exception_handler() (asyncio.loop のメソッド): Error handling API.
                                                             (line   45)
* CALL_FUNCTION_EX (opcode):             Python バイトコード命令.
                                                             (line 1128)
* call_in_thread() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   52)
* 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   47)
* call() (operator モジュール):          operator --- 関数形式の標準演算子.
                                                             (line  228)
* call() (subprocess モジュール):        古い高水準 API.     (line   11)
* call() (unittest.mock モジュール):     call.               (line    6)
* callable:                              用語集<2>.          (line  262)
* Callable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   18)
* Callable (typing モジュール):          Aliases to other ABCs in collections abc.
                                                             (line   22)
* CallableProxyType (weakref のクラス):  weakref --- Weak references.
                                                             (line  333)
* callback:                              用語集<2>.          (line  273)
* callback (optparse.Option の属性):     オプション属性.     (line   67)
* callback_args (optparse.Option の属性): オプション属性.    (line   74)
* callback_kwargs (optparse.Option の属性): オプション属性.  (line   74)
* callback() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  582)
* callbacks (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line  272)
* called (unittest.mock.Mock の属性):    Mock クラス.        (line  313)
* CalledProcessError:                    Using the subprocess Module.
                                                             (line  205)
* calloc (C function):                   概要<4>.            (line   33)
* CallWrapper (tkinter のクラス):        Other classes.      (line   98)
* CAN (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   96)
* CAN_BCM (socket モジュール):           定数<8>.            (line  153)
* can_change_color() (curses モジュール): 関数<6>.           (line   47)
* can_fetch() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   32)
* 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  160)
* cancel_command() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line   89)
* cancel_dump_traceback_later() (faulthandler モジュール): タイムアウト後にtracebackをダンプする.
                                                             (line   29)
* cancel_join_thread() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  199)
* cancel() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line  119)
* cancel() (asyncio.Handle のメソッド):  Callback handles.   (line   18)
* cancel() (asyncio.Task のメソッド):    Task object.        (line  204)
* 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   48)
* cancelled() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   73)
* cancelled() (asyncio.Handle のメソッド): Callback handles. (line   23)
* cancelled() (asyncio.Task のメソッド): Task object.        (line  268)
* cancelled() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   23)
* CancelledError:                        例外クラス.         (line    6)
* CancelledError <1>:                    例外<16>.           (line   18)
* cancelling() (asyncio.Task のメソッド): Task object.       (line  326)
* CannotSendHeader:                      http client --- HTTP プロトコルクライアント.
                                                             (line  174)
* CannotSendRequest:                     http client --- HTTP プロトコルクライアント.
                                                             (line  170)
* canonic() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  157)
* canonical() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  272)
* canonical() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  137)
* canonicalize() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line    6)
* Canvas (tkinter のクラス):             Widget classes.     (line   32)
* canvasx() (tkinter.Canvas のメソッド): Widget classes.     (line  579)
* canvasy() (tkinter.Canvas のメソッド): Widget classes.     (line  586)
* 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  300)
* 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)
* CASCADE (tkinter モジュール):          定数<10>.           (line  113)
* case block:                            論駁不可能なケースブロック.
                                                             (line    6)
* casefold() (str のメソッド):           文字列メソッド<2>.  (line   30)
* cast() (ctypes モジュール):            ユーティリティー関数.
                                                             (line   51)
* cast() (memoryview のメソッド):        メモリビュー.       (line  285)
* 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   52)
* 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)
* cdll (ctypes モジュール):              共有ライブラリをロードする.
                                                             (line  204)
* ceil() (math モジュール):              数値型 int float complex.
                                                             (line  115)
* ceil() (math モジュール) <1>:          Floating point arithmetic.
                                                             (line    6)
* CellType (types モジュール):           標準的なインタプリタ型.
                                                             (line   69)
* CENTER (tkinter モジュール):           定数<10>.           (line   21)
* center() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  291)
* center() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  291)
* center() (str のメソッド):             文字列メソッド<2>.  (line   51)
* CERT_NONE (ssl モジュール):            定数<9>.            (line   11)
* CERT_OPTIONAL (ssl モジュール):        定数<9>.            (line   25)
* CERT_REQUIRED (ssl モジュール):        定数<9>.            (line   41)
* cert_store_stats() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line   89)
* cert_time_to_seconds() (ssl モジュール): 証明書の取り扱い. (line    6)
* CertificateError:                      例外<19>.           (line   92)
* certificates:                          SSL contexts.       (line  758)
* 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   58)
* cget() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line   18)
* cget() (tkinter.PhotoImage のメソッド): Image classes.     (line   62)
* cgi_directories (http.server.CGIHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  516)
* CGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   11)
* CGIHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line  491)
* CGIXMLRPCRequestHandler (xmlrpc.server のクラス): xmlrpc server --- 基本的な XML-RPC サーバー.
                                                             (line   49)
* chain_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   72)
* 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 (tkinter モジュール):             定数<10>.           (line   71)
* char (tkinter.Event の属性):           Other classes.      (line   59)
* CHAR_MAX (locale モジュール):          locale --- 国際化サービス.
                                                             (line  576)
* CharacterDataHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  380)
* 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   22)
* charset() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   73)
* chdir() (contextlib モジュール):       ユーティリティ.     (line  369)
* 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 contexts.      (line  490)
* 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 のメソッド): Custom string formatting.
                                                             (line   92)
* check_warnings() (test.support.warnings_helper モジュール): test support warnings_helper --- Utilities for warnings tests.
                                                             (line   47)
* check() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line   57)
* check() (tabnanny モジュール):         tabnanny --- あいまいなインデントの検出.
                                                             (line   17)
* Checkbutton (tkinter のクラス):        Widget classes.     (line  687)
* CHECKBUTTON (tkinter モジュール):      定数<10>.           (line  113)
* Checkbutton (tkinter.ttk のクラス):    Additional widgets. (line   22)
* checkcache() (linecache モジュール):   linecache --- テキストラインへのランダムアクセス.
                                                             (line   49)
* CHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  110)
* checkfuncname() (bdb モジュール):      bdb --- デバッガーフレームワーク.
                                                             (line  501)
* checksizeof() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  472)
* checksum_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  204)
* chflags() (os モジュール):             ファイルとディレクトリ.
                                                             (line  139)
* chgat() (curses.window のメソッド):    Window objects.     (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 の属性):          Toplevel widgets.   (line   83)
* 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)
* CHORD (tkinter モジュール):            定数<10>.           (line  130)
* chown() (os モジュール):               ファイルとディレクトリ.
                                                             (line  252)
* chown() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  424)
* chroot() (os モジュール):              ファイルとディレクトリ.
                                                             (line  281)
* CHRTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  342)
* cipher() (ssl.SSLSocket のメソッド):   SSL sockets.        (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  284)
* ClassDef (ast のクラス):               関数およびクラス定義.
                                                             (line  168)
* ClassMethodDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  115)
* ClassVar (typing モジュール):          特殊形式.           (line  201)
* clause:                                複合文 compound statement.
                                                             (line   17)
* CLD_CONTINUED (os モジュール):         プロセス管理.       (line 1048)
* CLD_DUMPED (os モジュール):            プロセス管理.       (line 1048)
* CLD_EXITED (os モジュール):            プロセス管理.       (line 1048)
* CLD_KILLED (os モジュール):            プロセス管理.       (line 1048)
* CLD_STOPPED (os モジュール):           プロセス管理.       (line 1048)
* CLD_TRAPPED (os モジュール):           プロセス管理.       (line 1048)
* 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  394)
* clear_all_file_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  389)
* clear_bpbynumber() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  383)
* clear_break() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  377)
* 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  185)
* clear_frames() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  173)
* clear_history() (readline モジュール): 履歴リスト.         (line    8)
* clear_memo() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  236)
* 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  189)
* clear() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  237)
* clear() (asyncio.Event のメソッド):    Event.              (line   59)
* clear() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   45)
* clear() (curses.window のメソッド):    Window objects.     (line  149)
* clear() (dict のメソッド):             Mapping Types --- dict.
                                                             (line  161)
* 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  215)
* 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 objects.     (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  118)
* client_address (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   46)
* Client() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   34)
* client() (tkinter.Wm のメソッド):      Base and mixin classes.
                                                             (line 1330)
* clipboard_append() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  684)
* clipboard_clear() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  700)
* clipboard_get() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  707)
* 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  135)
* clock_seq_hi_variant (uuid.UUID の属性): uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  116)
* clock_seq_low (uuid.UUID の属性):      uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  120)
* 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  672)
* CLONE_FS (os モジュール):              プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWCGROUP (os モジュール):       プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWIPC (os モジュール):          プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWNET (os モジュール):          プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWNS (os モジュール):           プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWPID (os モジュール):          プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWTIME (os モジュール):         プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWUSER (os モジュール):         プロセスのパラメーター.
                                                             (line  672)
* CLONE_NEWUTS (os モジュール):          プロセスのパラメーター.
                                                             (line  672)
* CLONE_SIGHAND (os モジュール):         プロセスのパラメーター.
                                                             (line  672)
* CLONE_SYSVSEM (os モジュール):         プロセスのパラメーター.
                                                             (line  672)
* CLONE_THREAD (os モジュール):          プロセスのパラメーター.
                                                             (line  672)
* CLONE_VM (os モジュール):              プロセスのパラメーター.
                                                             (line  672)
* clone() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line  111)
* clone() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  205)
* 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):                  Multiple interpreters in a Python process.
                                                             (line  195)
* close_clients() (asyncio.Server のメソッド): Server objects.
                                                             (line   44)
* close_connection (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  127)
* close() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line    6)
* close() (asyncio.loop のメソッド):     ループの開始と停止. (line   47)
* close() (asyncio.Runner のメソッド):   Runner context manager.
                                                             (line   57)
* close() (asyncio.Server のメソッド):   Server objects.     (line   32)
* close() (asyncio.StreamWriter のメソッド): StreamWriter.   (line   41)
* close() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   59)
* close() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   30)
* close() (contextlib.ExitStack のメソッド): ユーティリティ. (line  612)
* close() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   51)
* 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   65)
* close() (file のメソッド):             I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line   31)
* 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  159)
* 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  183)
* 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  248)
* close() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  175)
* close() (multiprocessing.shared_memory.SharedMemory のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   92)
* close() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  229)
* close() (os モジュール):               ファイル記述子の操作.
                                                             (line   22)
* close() (os.scandir のメソッド):       ファイルとディレクトリ.
                                                             (line  894)
* close() (select.devpoll のメソッド):   /dev/poll polling objects.
                                                             (line   12)
* close() (select.epoll のメソッド):     Edge and level trigger polling epoll objects.
                                                             (line   71)
* close() (select.kqueue のメソッド):    Kqueue objects.     (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   99)
* close() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   38)
* close() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   90)
* close() (sqlite3.Cursor のメソッド):   Cursor オブジェクト.
                                                             (line  157)
* close() (tarfile.TarFile のメソッド):  TarFile オブジェクト.
                                                             (line  328)
* 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   40)
* close() (xml.sax.xmlreader.IncrementalParser のメソッド): IncrementalParser オブジェクト.
                                                             (line   13)
* close() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  114)
* 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  190)
* closed (select.devpoll の属性):        /dev/poll polling objects.
                                                             (line   18)
* closed (select.epoll の属性):          Edge and level trigger polling epoll objects.
                                                             (line   75)
* closed (select.kqueue の属性):         Kqueue objects.     (line   10)
* CloseKey() (winreg モジュール):        関数<14>.           (line    8)
* closelog() (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   78)
* closerange() (os モジュール):          ファイル記述子の操作.
                                                             (line   33)
* closing() (contextlib モジュール):     ユーティリティ.     (line  154)
* closure variable:                      用語集<2>.          (line  289)
* clrtobot() (curses.window のメソッド): Window objects.     (line  159)
* clrtoeol() (curses.window のメソッド): Window objects.     (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  139)
* cmp_op (dis モジュール):               命令コードコレクション.
                                                             (line   22)
* cmp_to_key() (functools モジュール):   functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  119)
* 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 (code object attribute):     コードオブジェクト. (line   16)
* co_lnotab (codeobject の属性):         Special read-only attributes<2>.
                                                             (line   73)
* 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  396)
* 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   67)
* 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  273)
* 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   86)
* 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   62)
* COLOR_CYAN (curses モジュール):        定数<6>.            (line  645)
* COLOR_GREEN (curses モジュール):       定数<6>.            (line  648)
* COLOR_MAGENTA (curses モジュール):     定数<6>.            (line  651)
* color_pair() (curses モジュール):      関数<6>.            (line   71)
* 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)
* colormapwindows() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1339)
* colormode() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   33)
* COLORS (curses モジュール):            定数<6>.            (line   34)
* COLS (curses モジュール):              定数<6>.            (line   44)
* column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   38)
* columnconfigure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1905)
* columnconfigure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  174)
* columnize() (cmd.Cmd のメソッド):      Cmdオブジェクト.    (line   86)
* COLUMNS:                               関数<6>.            (line  635)
* COLUMNS <1>:                           関数<6>.            (line  636)
* 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  140)
* COMMAND (tkinter モジュール):          定数<10>.           (line  113)
* command() (tkinter.Wm のメソッド):     Base and mixin classes.
                                                             (line 1349)
* 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  439)
* 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  261)
* Common Vulnerabilities and Exposures; CVE 2012-0876: セキュリティ<54>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <1>: セキュリティ<57>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <2>: セキュリティ<63>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2013-0340: セキュリティ<34>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2013-1753: ライブラリ<211>.
                                                             (line  193)
* Common Vulnerabilities and Exposures; CVE 2014-0224: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   30)
* Common Vulnerabilities and Exposures; CVE 2014-4616: ライブラリ<211>.
                                                             (line 1122)
* Common Vulnerabilities and Exposures; CVE 2015-1283: セキュリティ<60>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2015-1283 <1>: セキュリティ<65>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2016-0718: セキュリティ<54>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <1>: セキュリティ<54>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <2>: セキュリティ<54>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <3>: セキュリティ<57>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <4>: セキュリティ<57>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <5>: セキュリティ<58>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <6>: セキュリティ<63>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <7>: セキュリティ<63>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <8>: セキュリティ<63>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-0772: セキュリティ<60>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-0772 <1>: セキュリティ<65>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-1000110: ライブラリ<190>.
                                                             (line   82)
* Common Vulnerabilities and Exposures; CVE 2016-1000110 <1>: ライブラリ<197>.
                                                             (line  267)
* Common Vulnerabilities and Exposures; CVE 2016-2183: ライブラリ<189>.
                                                             (line  178)
* Common Vulnerabilities and Exposures; CVE 2016-2183 <1>: ライブラリ<197>.
                                                             (line  205)
* Common Vulnerabilities and Exposures; CVE 2016-3189: Windows<33>.
                                                             (line   25)
* Common Vulnerabilities and Exposures; CVE 2016-4472: セキュリティ<54>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <1>: セキュリティ<58>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <2>: セキュリティ<63>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-5300: セキュリティ<54>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <1>: セキュリティ<57>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <2>: セキュリティ<63>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-9063: セキュリティ<54>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <1>: セキュリティ<57>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <2>: セキュリティ<63>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2017-1000158: セキュリティ<62>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2017-9233: セキュリティ<54>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <1>: セキュリティ<57>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <2>: セキュリティ<63>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1060: セキュリティ<51>.
                                                             (line   48)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <1>: セキュリティ<52>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <2>: セキュリティ<55>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1061: セキュリティ<51>.
                                                             (line   49)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <1>: セキュリティ<52>.
                                                             (line   16)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <2>: セキュリティ<55>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2018-14647: セキュリティ<51>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2018-25032: Windows<33>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2018-8970: セキュリティ<51>.
                                                             (line   38)
* Common Vulnerabilities and Exposures; CVE 2018-8970 <1>: セキュリティ<52>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-12900: Windows<33>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2019-15903: セキュリティ<47>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2019-18348: セキュリティ<44>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2019-20907: ライブラリ<154>.
                                                             (line  186)
* Common Vulnerabilities and Exposures; CVE 2019-5010: セキュリティ<51>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-9740: セキュリティ<49>.
                                                             (line    9)
* Common Vulnerabilities and Exposures; CVE 2019-9948: セキュリティ<48>.
                                                             (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: セキュリティ<41>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2020-15801: セキュリティ<41>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2020-8492: セキュリティ<43>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2021-3426: セキュリティ<36>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-26488: Windows<33>.
                                                             (line   28)
* Common Vulnerabilities and Exposures; CVE 2022-37434: Windows<30>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-42919: セキュリティ<32>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2022-4303: セキュリティ<28>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2022-4303 <1>: セキュリティ<28>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2023-0286: セキュリティ<28>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-24329: セキュリティ<27>.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2023-27043: email<2>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2023-27043 <1>: ライブラリ<66>.
                                                             (line  429)
* Common Vulnerabilities and Exposures; CVE 2023-40217: セキュリティ<26>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-52425: xml. (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <1>: セキュリティ<23>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <2>: ドキュメント<20>.
                                                             (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>: セキュリティ<13>.
                                                             (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>: セキュリティ<21>.
                                                             (line   54)
* Common Vulnerabilities and Exposures; CVE 2025-4138: tarfile.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2025-4138 <1>: セキュリティ<13>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2025-4330: tarfile.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2025-4330 <1>: セキュリティ.
                                                             (line   17)
* Common Vulnerabilities and Exposures; CVE 2025-4330 <2>: セキュリティ<13>.
                                                             (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>: セキュリティ<13>.
                                                             (line   16)
* Common Vulnerabilities and Exposures; CVE 2026-2297: セキュリティ<5>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2026-3219: ライブラリ<4>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2026-3644: セキュリティ<5>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2026-4224: セキュリティ<5>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2026-45186: セキュリティ<2>.
                                                             (line   20)
* Common Weakness Enumeration; CWE 257:  レシピとベストプラクティス.
                                                             (line   16)
* Common Weakness Enumeration; CWE 295:  ssl<3>.             (line   21)
* Common Weakness Enumeration; CWE 295 <1>: ライブラリ<91>.  (line  515)
* 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  280)
* compare_signal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  154)
* compare_to() (tracemalloc.Snapshot のメソッド): Snapshot.  (line   13)
* compare_total_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  288)
* compare_total_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  183)
* compare_total() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  284)
* compare_total() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  161)
* compare() (ast モジュール):            ast helpers.        (line  321)
* compare() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  276)
* compare() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  143)
* compare() (difflib.Differ のメソッド): Differ objects.     (line   36)
* compare() (tkinter.Text のメソッド):   Widget classes.     (line 1866)
* COMPARISON_FLAGS (doctest モジュール): オプションフラグ.   (line  100)
* Compat32 (email.policy のクラス):      email policy Policy Objects.
                                                             (line  560)
* compat32 (email.policy モジュール):    email policy Policy Objects.
                                                             (line  614)
* 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 の属性): モジュールコンテンツ<3>.
                                                             (line   90)
* complete_statement() (sqlite3 モジュール): モジュール関数. (line  103)
* complete() (rlcompleter.Completer のメソッド): rlcompleter --- GNU readline の補完機能.
                                                             (line   43)
* completedefault() (cmd.Cmd のメソッド): Cmdオブジェクト.   (line   80)
* CompletedProcess (subprocess のクラス): Using the subprocess Module.
                                                             (line  100)
* Completer (rlcompleter のクラス):      rlcompleter --- GNU readline の補完機能.
                                                             (line   39)
* Complex (numbers のクラス):            数値塔.             (line    6)
* complex (組み込みクラス):              組み込み関数.       (line  362)
* complex number:                        用語集<2>.          (line  317)
* 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  196)
* 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 sockets.     (line  247)
* CompressionError:                      tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  260)
* CompressionParameter (compression.zstd のクラス): Advanced parameter control.
                                                             (line    6)
* compressobj() (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line   82)
* COMSPEC:                               プロセス管理.       (line  779)
* COMSPEC <1>:                           Popen コンストラクター.
                                                             (line  111)
* concat() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  184)
* Concatenate (typing モジュール):       特殊形式.           (line   82)
* concurrency:                           用語集<2>.          (line  327)
* concurrent modification:               用語集<2>.          (line  339)
* cond (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   95)
* 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   62)
* config() (tkinter.Grid のメソッド):    Base and mixin classes.
                                                             (line 1829)
* config() (tkinter.Image のメソッド):   Image classes.      (line   20)
* config() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line   24)
* config() (tkinter.Pack のメソッド):    Base and mixin classes.
                                                             (line 1660)
* config() (tkinter.Place のメソッド):   Base and mixin classes.
                                                             (line 1755)
* ConfigParser (configparser のクラス):  ConfigParser オブジェクト.
                                                             (line    6)
* configuration information:             sysconfig --- Python の構成情報へのアクセスを提供する.
                                                             (line   10)
* configure_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  261)
* configure() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   62)
* configure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1829)
* configure() (tkinter.Image のメソッド): Image classes.     (line   20)
* configure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line   24)
* configure() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1660)
* configure() (tkinter.Place のメソッド): Base and mixin classes.
                                                             (line 1755)
* configure() (tkinter.ttk.Scale のメソッド): Additional widgets.
                                                             (line  181)
* configure() (tkinter.ttk.Style のメソッド): Ttk styling.   (line   25)
* CONFORM (enum.FlagBoundary の属性):    データ型<2>.        (line  732)
* confstr_names (os モジュール):         雑多なシステム情報. (line   26)
* confstr() (os モジュール):             雑多なシステム情報. (line    6)
* conjugate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  195)
* conjugate() (numbers.Complex のメソッド): 数値塔.          (line   23)
* conjugate() (複素数のメソッド):        数値型 int float complex.
                                                             (line  103)
* connect_accepted_socket() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line  149)
* connect_ex() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  146)
* 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  150)
* connect() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   79)
* connect() (smtplib.SMTP のメソッド):   SMTP オブジェクト.  (line   34)
* connect() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  120)
* 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  280)
* content_manager (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  416)
* content_size_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  178)
* content_type (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  267)
* ContentDispositionHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  275)
* ContentHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   18)
* ContentManager (email.contentmanager のクラス): email contentmanager Managing MIME Content.
                                                             (line   12)
* contents (ctypes._Pointer の属性):     配列とポインタ.     (line   60)
* contents() (importlib.resources モジュール): 関数 API.     (line  149)
* 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  285)
* ContentTypeHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  262)
* context:                               用語集<2>.          (line  346)
* Context (contextvars のクラス):        マニュアルでのコンテキスト管理.
                                                             (line   20)
* Context (decimal のクラス):            Context オブジェクト.
                                                             (line  118)
* context (ssl.SSLSocket の属性):        SSL sockets.        (line  338)
* context manager:                       with文とコンテキストマネージャ.
                                                             (line   13)
* context manager <1>:                   コンテキストマネージャ型.
                                                             (line    6)
* context manager <2>:                   用語集<2>.          (line  367)
* context variable:                      用語集<2>.          (line  373)
* context_aware_warnings (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  588)
* context_diff() (difflib モジュール):   difflib --- 差分の計算の補助.
                                                             (line  150)
* ContextDecorator (contextlib のクラス): ユーティリティ.    (line  388)
* ContextManager (typing のクラス):      Aliases to contextlib ABCs.
                                                             (line    6)
* contextmanager() (contextlib モジュール): ユーティリティ.  (line   30)
* 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  381)
* contiguous (memoryview の属性):        メモリビュー.       (line  520)
* Continue (ast のクラス):               制御フロー.         (line   99)
* CONTINUE (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  128)
* continue (pdb command):                Debugger commands.  (line  231)
* CONTINUOUS (enum.EnumCheck の属性):    データ型<2>.        (line  671)
* control() (select.kqueue のメソッド):  Kqueue objects.     (line   22)
* controlnames (curses.ascii モジュール): curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  239)
* CONTTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  358)
* conversion (string.templatelib.Interpolation の属性): 型.  (line  242)
* convert_arg_line_to_args() (argparse.ArgumentParser のメソッド): ファイル解析のカスタマイズ.
                                                             (line    6)
* convert_field() (string.Formatter のメソッド): Custom string formatting.
                                                             (line  108)
* 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)
* coords() (tkinter.Canvas のメソッド):  Widget classes.     (line  315)
* coords() (tkinter.Scale のメソッド):   Widget classes.     (line 1551)
* COPY (opcode):                         Python バイトコード命令.
                                                             (line  172)
* Copy [コピー]:                         Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* copy_abs() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  292)
* copy_abs() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  200)
* copy_context() (contextvars モジュール): マニュアルでのコンテキスト管理.
                                                             (line    6)
* copy_decimal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  199)
* 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  296)
* copy_negate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  205)
* copy_replace() (tkinter.PhotoImage のメソッド): Image classes.
                                                             (line   88)
* copy_sign() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  300)
* copy_sign() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  210)
* copy;プロトコル:                       クラスインスタンスの pickle 化.
                                                             (line  110)
* copy() (collections.deque のメソッド): deque オブジェクト. (line   49)
* copy() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  103)
* copy() (copy モジュール):              copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   19)
* copy() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  195)
* copy() (dict のメソッド):              Mapping Types --- dict.
                                                             (line  165)
* copy() (frozenset のメソッド):         set（集合）型 --- set frozenset.
                                                             (line  127)
* 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  127)
* copy() (shutil モジュール):            ディレクトリとファイルの操作.
                                                             (line  136)
* copy() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   69)
* copy() (tkinter.PhotoImage のメソッド): Image classes.     (line   66)
* copy() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  262)
* copy() (zlib.Compress のメソッド):     zlib --- gzip 互換の圧縮.
                                                             (line  223)
* copy() (zlib.Decompress のメソッド):   zlib --- gzip 互換の圧縮.
                                                             (line  287)
* 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  196)
* 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  399)
* 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  165)
* count() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line   36)
* count() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line   36)
* count() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   55)
* count() (itertools モジュール):        Itertool関数.       (line  223)
* count() (memoryview のメソッド):       メモリビュー.       (line  384)
* count() (multiprocessing.shared_memory.ShareableList のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  331)
* count() (sequence のメソッド):         共通のシーケンス演算.
                                                             (line  167)
* count() (str のメソッド):              文字列メソッド<2>.  (line   65)
* count() (tkinter.Text のメソッド):     Widget classes.     (line 1873)
* Counter (collections のクラス):        Counter オブジェクト.
                                                             (line   23)
* Counter (typing のクラス):             Aliases to types in collections.
                                                             (line   39)
* countOf() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  195)
* countTestCases() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  798)
* 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: Instant User's Manual.
                                                             (line   99)
* cProfile コマンドラインオプション; -o: Instant User's Manual.
                                                             (line   89)
* cProfile コマンドラインオプション; -s: Instant User's Manual.
                                                             (line   93)
* CPU 時間:                              関数<5>.            (line  247)
* CPU 時間 <1>:                          関数<5>.            (line  612)
* cpu_count() (multiprocessing モジュール): その他<5>.       (line   14)
* cpu_count() (os モジュール):           雑多なシステム情報. (line   34)
* CPython:                               用語集<2>.          (line  406)
* 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   49)
* CRC:                                   zlib --- gzip 互換の圧縮.
                                                             (line  122)
* CRC (zipfile.ZipInfo の属性):          ZipInfo objects.    (line  151)
* crc_hqx() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line   94)
* crc32() (binascii モジュール):         binascii --- バイナリ と ASCII 間の変換.
                                                             (line  101)
* crc32() (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  120)
* create_aggregate() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  163)
* create_arc() (tkinter.Canvas のメソッド): Widget classes.  (line   63)
* create_archive() (zipapp モジュール):  Python API.         (line    8)
* create_autospec() (unittest.mock モジュール): create_autospec.
                                                             (line    6)
* create_bitmap() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line   63)
* 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   30)
* create_datagram_endpoint() (asyncio.loop のメソッド): ネットワーク接続の確立.
                                                             (line  158)
* create_decimal_from_float() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  228)
* create_decimal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  203)
* 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 のメソッド): Creating futures and tasks.
                                                             (line    6)
* create_git_ignore_file() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  206)
* create_image() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line   63)
* create_line() (tkinter.Canvas のメソッド): Widget classes. (line   63)
* 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_oval() (tkinter.Canvas のメソッド): Widget classes. (line   63)
* create_polygon() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line   63)
* create_queue() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   30)
* create_rectangle() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line   63)
* create_server() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line    6)
* create_server() (socket モジュール):   ソケットの作成.     (line   60)
* create_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   85)
* 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 モジュール):    Creating tasks.     (line   10)
* create_task() (asyncio.loop のメソッド): Creating futures and tasks.
                                                             (line   18)
* create_task() (asyncio.TaskGroup のメソッド): Task groups. (line   17)
* create_text() (tkinter.Canvas のメソッド): Widget classes. (line   63)
* 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_window() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line   63)
* 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 のメソッド): File handlers.
                                                             (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  285)
* cssclass_month_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  278)
* cssclass_noday (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  264)
* cssclass_year (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  292)
* cssclass_year_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  299)
* cssclasses (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  251)
* cssclasses_weekday_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  271)
* csv:                                   csv --- CSV ファイルの読み書き.
                                                             (line    8)
* cte (email.headerregistry.ContentTransferEncodingHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  289)
* cte_type (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  158)
* ctermid() (os モジュール):             プロセスのパラメーター.
                                                             (line    9)
* ctime() (datetime.date のメソッド):    date objects.       (line  310)
* ctime() (datetime.datetime のメソッド): datetime objects.  (line  737)
* ctime() (time モジュール):             関数<5>.            (line   93)
* CTRL_BREAK_EVENT (signal モジュール):  モジュールの内容<3>.
                                                             (line  229)
* CTRL_C_EVENT (signal モジュール):      モジュールの内容<3>.
                                                             (line  220)
* ctrl() (curses.ascii モジュール):      curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  216)
* curdir (os モジュール):                雑多なシステム情報. (line   99)
* currency() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  472)
* CURRENT (tkinter モジュール):          定数<10>.           (line   87)
* current context:                       用語集<2>.          (line  412)
* 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  303)
* CurrentColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  307)
* currentframe() (inspect モジュール):   インタープリタスタック.
                                                             (line  155)
* CurrentLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  311)
* curs_set() (curses モジュール):        関数<6>.            (line   79)
* curselection() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  969)
* Cursor (sqlite3 のクラス):             Cursor オブジェクト.
                                                             (line   20)
* cursor() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   27)
* cursyncup() (curses.window のメソッド): Window objects.    (line  168)
* Cut [切り取り]:                        Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* cutoff (sys.hash_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 1084)
* cwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  334)
* cwd() (pathlib.Path のクラスメソッド): パスの展開と解決.   (line   30)
* cycle() (itertools モジュール):        Itertool関数.       (line  245)
* CycleError:                            例外<4>.            (line    8)
* cyclic isolate:                        用語集<2>.          (line  422)
* 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  241)
* daemon_threads (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   60)
* dangling;else:                         複合文 compound statement.
                                                             (line   52)
* data (collections.UserDict の属性):    UserDict オブジェクト.
                                                             (line   26)
* data (collections.UserList の属性):    UserList オブジェクト.
                                                             (line   27)
* data (collections.UserString の属性):  UserString オブジェクト.
                                                             (line   22)
* data (plistlib.UID の属性):            plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  146)
* data (select.kevent の属性):           Kevent objects.     (line  176)
* 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  430)
* data_filter() (tarfile モジュール):    Default named filters.
                                                             (line   36)
* data_open() (urllib.request.DataHandler のメソッド): DataHandler オブジェクト.
                                                             (line    6)
* data_received() (asyncio.Protocol のメソッド): ストリーミングプロトコル.
                                                             (line   13)
* data() (tkinter.PhotoImage のメソッド): Image classes.     (line  130)
* data() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   32)
* DatabaseError:                         例外<7>.            (line   42)
* dataclass_transform() (typing モジュール): Functions and decorators.
                                                             (line  113)
* dataclass() (dataclasses モジュール):  モジュールの内容<5>.
                                                             (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  372)
* date() (datetime.datetime のメソッド): datetime objects.   (line  445)
* DateHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  136)
* datetime (datetime のクラス):          datetime objects.   (line   17)
* datetime (email.headerregistry.DateHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  145)
* DateTime (xmlrpc.client のクラス):     DateTime オブジェクト.
                                                             (line    6)
* Day (calendar のクラス):               calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  452)
* day (datetime.date の属性):            date objects.       (line  154)
* day (datetime.datetime の属性):        datetime objects.   (line  317)
* 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  430)
* day_name (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  421)
* daylight (time モジュール):            Timezone Constants. (line   13)
* days (datetime.timedelta の属性):      timedelta objects.  (line  112)
* 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)
* dchars() (tkinter.Canvas のメソッド):  Widget classes.     (line  366)
* deactivate_stack_trampoline() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1873)
* deadlock:                              用語集<2>.          (line  442)
* deallocation, object:                  ファイナライズとメモリ解放.
                                                             (line    6)
* debug (imaplib.IMAP4 の属性):          IMAP4 オブジェクト. (line  489)
* DEBUG (logging モジュール):            ロギングレベル.     (line   24)
* debug (pdb command):                   Debugger commands.  (line  448)
* DEBUG (re モジュール):                 フラグ.             (line   31)
* debug (shlex.shlex の属性):            shlex オブジェクト. (line  161)
* debug (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  525)
* 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  314)
* DEBUG_LEAK (gc モジュール):            gc --- ガベージコレクターインターフェース.
                                                             (line  334)
* DEBUG_SAVEALL (gc モジュール):         gc --- ガベージコレクターインターフェース.
                                                             (line  328)
* debug_src() (doctest モジュール):      デバッグ.           (line  143)
* DEBUG_STATS (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  309)
* DEBUG_UNCOLLECTABLE (gc モジュール):   gc --- ガベージコレクターインターフェース.
                                                             (line  318)
* debug() (doctest モジュール):          デバッグ.           (line  122)
* debug() (logging モジュール):          モジュールレベルの関数.
                                                             (line   44)
* debug() (logging.Logger のメソッド):   ロガーオブジェクト. (line  182)
* debug() (tkinter.Text のメソッド):     Widget classes.     (line 2295)
* debug() (unittest.TestCase のメソッド): テストクラス.      (line  122)
* debug() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   48)
* debugger:                              リファレンス<2>.    (line  129)
* debugger <1>:                          Debug メニュー Shell ウィンドウのみ.
                                                             (line   15)
* debugger <2>:                          sys --- システム固有のパラメーターと関数.
                                                             (line  961)
* debugger <3>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1713)
* debugger;設定;ファイル:                Debugger commands.  (line   60)
* debuglevel (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   70)
* DebugRunner (doctest のクラス):        デバッグ.           (line  162)
* DECEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* Decimal (decimal のクラス):            Decimal オブジェクト.
                                                             (line    6)
* decimal() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   51)
* DecimalException (decimal のクラス):   シグナル.           (line   29)
* decode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   78)
* decode_header() (email.header モジュール): email header 国際化されたヘッダー.
                                                             (line  175)
* 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  228)
* 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  182)
* decompress() (gzip モジュール):        gzip --- gzip ファイルのサポート.
                                                             (line  223)
* 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  258)
* decompressobj() (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  179)
* decorator:                             用語集<2>.          (line  455)
* 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  313)
* DEF_MEM_LEVEL (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line  309)
* def_prog_mode() (curses モジュール):   関数<6>.            (line   88)
* def_shell_mode() (curses モジュール):  関数<6>.            (line   95)
* default (email.policy モジュール):     email policy Policy Objects.
                                                             (line  501)
* 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 のメソッド): Error handling API.
                                                             (line   34)
* default_factory (collections.defaultdict の属性): defaultdict オブジェクト.
                                                             (line   57)
* DEFAULT_FORMAT (tarfile モジュール):   tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  390)
* DEFAULT_IGNORES (filecmp モジュール):  dircmp クラス.      (line  112)
* default_loader() (xml.etree.ElementInclude モジュール): 関数<10>.
                                                             (line    6)
* default_max_str_digits (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1183)
* DEFAULT_MODE (ctypes モジュール):      共有ライブラリをロードする.
                                                             (line  176)
* default_open() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   30)
* DEFAULT_PROTOCOL (pickle モジュール):  モジュールインターフェース.
                                                             (line   21)
* DEFAULT_TIMEOUT (unittest.mock.ThreadingMock の属性): Mock クラス.
                                                             (line  986)
* default_timer() (timeit モジュール):   Python Interface.   (line   31)
* default;parameter;value:               関数定義.           (line   67)
* default() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line   74)
* 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  454)
* DefaultHandlerExpand() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  461)
* defaults() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  108)
* DefaultSelector (selectors のクラス):  クラス<4>.          (line  164)
* defaultTestLoader (unittest モジュール): テストのロードと起動.
                                                             (line  448)
* defaultTestResult() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  803)
* 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  732)
* DEFLATED (zlib モジュール):            zlib --- gzip 互換の圧縮.
                                                             (line  300)
* defpath (os モジュール):               雑多なシステム情報. (line  141)
* DefragResult (urllib.parse のクラス):  構造化された解析結果.
                                                             (line   40)
* DefragResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   65)
* degrees() (math モジュール):           角度変換.           (line    6)
* degrees() (turtle モジュール):         設定と計測.         (line    6)
* deiconify() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1358)
* 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  548)
* delay_output() (curses モジュール):    関数<6>.            (line  103)
* delay() (turtle モジュール):           アニメーションの制御.
                                                             (line   19)
* delayload (http.cookiejar.FileCookieJar の属性): CookieJar および FileCookieJar オブジェクト.
                                                             (line  166)
* delch() (curses.window のメソッド):    Window objects.     (line  173)
* dele() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   67)
* Delete (ast のクラス):                 文 Statements.      (line  138)
* 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.Canvas のメソッド):  Widget classes.     (line  362)
* delete() (tkinter.Entry のメソッド):   Widget classes.     (line  757)
* delete() (tkinter.Listbox のメソッド): Widget classes.     (line  908)
* delete() (tkinter.Menu のメソッド):    Widget classes.     (line 1238)
* delete() (tkinter.Spinbox のメソッド): Widget classes.     (line 1657)
* delete() (tkinter.Text のメソッド):    Widget classes.     (line 1837)
* delete() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   77)
* deleteacl() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   80)
* deletecommand() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line   92)
* deletefilehandler() (tkinter.Widget.tk のメソッド): File handlers.
                                                             (line   38)
* DeleteKey() (winreg モジュール):       関数<14>.           (line  101)
* DeleteKeyEx() (winreg モジュール):     関数<14>.           (line  123)
* deleteln() (curses.window のメソッド): Window objects.     (line  179)
* 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   18)
* delitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  199)
* deliver_challenge() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   15)
* delocalize() (locale モジュール):      locale --- 国際化サービス.
                                                             (line  493)
* delta (tkinter.Event の属性):          Other classes.      (line   83)
* delta() (tkinter.Scrollbar のメソッド): Widget classes.    (line 1602)
* demo_app() (wsgiref.simple_server モジュール): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   36)
* denominator (fractions.Fraction の属性): fractions --- 有理数.
                                                             (line  116)
* 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   55)
* DER_cert_to_PEM_cert() (ssl モジュール): 証明書の取り扱い. (line   53)
* derive() (BaseExceptionGroup のメソッド): 例外グループ.    (line   77)
* derwin() (curses.window のメソッド):   Window objects.     (line  184)
* descrgetfunc (C type):                 Slot Type typedefs. (line   75)
* description (inspect.Parameter.kind の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  303)
* description (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  196)
* descriptor:                            用語集<2>.          (line  476)
* descrsetfunc (C type):                 Slot Type typedefs. (line   80)
* deselect() (tkinter.Checkbutton のメソッド): Widget classes.
                                                             (line  714)
* deselect() (tkinter.Radiobutton のメソッド): Widget classes.
                                                             (line 1509)
* deserialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  712)
* dest (optparse.Option の属性):         オプション属性.     (line   35)
* destroy() (tkinter.BaseWidget のメソッド): Base and mixin classes.
                                                             (line 2010)
* destroy() (tkinter.dialog.Dialog のメソッド): tkinter dialog --- Classic Tk dialog boxes.
                                                             (line   29)
* destroy() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line  108)
* destroy() (tkinter.OptionMenu のメソッド): Widget classes. (line 1351)
* destroy() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   69)
* destroy() (tkinter.Tk のメソッド):     Toplevel widgets.   (line   89)
* destroy() (tkinter.ttk.LabeledScale のメソッド): Additional widgets.
                                                             (line  228)
* destroy() (tkinter.ttk.OptionMenu のメソッド): Additional widgets.
                                                             (line  107)
* destructor (C type):                   Slot Type typedefs. (line   25)
* detach() (io.BufferedIOBase のメソッド): I/O 基底クラス.   (line  275)
* detach() (io.TextIOBase のメソッド):   テキスト I/O<2>.    (line   37)
* detach() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  161)
* detach() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   83)
* detach() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  294)
* 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 モジュール): Tokenizing Input. (line   75)
* deterministic profiling:               Introduction to the profilers.
                                                             (line    6)
* dev_mode (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  564)
* device_encoding() (os モジュール):     ファイル記述子の操作.
                                                             (line   81)
* devmajor (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line  143)
* devminor (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line  147)
* devnull (os モジュール):               雑多なシステム情報. (line  156)
* 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  310)
* dgettext() (gettext モジュール):       GNU gettext API.    (line   40)
* dgettext() (locale モジュール):        メッセージカタログへのアクセス.
                                                             (line    8)
* Dialect (csv のクラス):                モジュールコンテンツ.
                                                             (line  207)
* dialect (csv.csvreader の属性):        reader オブジェクト.
                                                             (line   20)
* dialect (csv.csvwriter の属性):        writer オブジェクト.
                                                             (line   33)
* Dialog (tkinter.commondialog のクラス): tkinter commondialog --- Dialog window templates.
                                                             (line   13)
* Dialog (tkinter.dialog のクラス):      tkinter dialog --- Classic Tk dialog boxes.
                                                             (line   18)
* Dialog (tkinter.simpledialog のクラス): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   32)
* DIALOG_ICON (tkinter.dialog モジュール): tkinter dialog --- Classic Tk dialog boxes.
                                                             (line   13)
* Dict (ast のクラス):                   リテラル<3>.        (line  174)
* Dict (typing のクラス):                Aliases to built-in types.
                                                             (line    6)
* dict (組み込みクラス):                 Mapping Types --- dict.
                                                             (line   19)
* 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  214)
* 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  493)
* dictionary comprehension:              用語集<2>.          (line  499)
* dictionary view:                       用語集<2>.          (line  507)
* dictionary_id (compression.zstd.FrameInfo の属性): その他<3>.
                                                             (line   20)
* dictionary;内包表記:                   辞書表示.           (line    6)
* dictionary;表示:                       辞書表示.           (line    6)
* DictReader (csv のクラス):             モジュールコンテンツ.
                                                             (line  113)
* DictWriter (csv のクラス):             モジュールコンテンツ.
                                                             (line  166)
* 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  184)
* difference() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line  111)
* difference() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line  111)
* dig (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  644)
* 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 のクラス): Native load/save dialogs.
                                                             (line   78)
* DirEntry (os のクラス):                ファイルとディレクトリ.
                                                             (line  932)
* dirname() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  111)
* dirs_double_event() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line   93)
* dirs_select_event() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line   97)
* 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  431)
* 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   81)
* disabled (logging.Logger の属性):      ロガーオブジェクト. (line   96)
* DISABLED (tkinter モジュール):         定数<10>.           (line  106)
* DisableReflectionKey() (winreg モジュール): 関数<14>.      (line  476)
* 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  206)
* disco() (dis モジュール):              解析関数.           (line  102)
* discover() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  113)
* disk_usage() (shutil モジュール):      ディレクトリとファイルの操作.
                                                             (line  405)
* dispatch_call() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  233)
* dispatch_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  253)
* dispatch_line() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  223)
* dispatch_return() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  243)
* dispatch_table (pickle.Pickler の属性): モジュールインターフェース.
                                                             (line  186)
* DISPLAY:                               Toplevel widgets.   (line   22)
* display (pdb command):                 Debugger commands.  (line  295)
* display_name (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  421)
* display_name (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  465)
* 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  308)
* divide() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  304)
* division:                              二項算術演算 binary arithmetic operation.
                                                             (line   37)
* division (__future__ モジュール):      モジュールコンテンツ<3>.
                                                             (line   22)
* DivisionByZero (decimal のクラス):     シグナル.           (line   34)
* divmod() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  312)
* DLE (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   72)
* dlineinfo() (tkinter.Text のメソッド): Widget classes.     (line 1910)
* DllCanUnloadNow() (ctypes モジュール): ユーティリティー関数.
                                                             (line  113)
* DllGetClassObject() (ctypes モジュール): ユーティリティー関数.
                                                             (line  121)
* dllhandle (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  285)
* dllist() (ctypes.util モジュール):     ユーティリティー関数.
                                                             (line  153)
* dnd_start() (tkinter.dnd モジュール):  tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   65)
* DndHandler (tkinter.dnd のクラス):     tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   43)
* dngettext() (gettext モジュール):      GNU gettext API.    (line   59)
* dnpgettext() (gettext モジュール):     GNU gettext API.    (line   70)
* do_clear() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  316)
* do_command() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   34)
* do_GET() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  437)
* do_handshake() (ssl.SSLSocket のメソッド): SSL sockets.    (line  127)
* do_HEAD() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  430)
* do_help() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line   47)
* do_POST() (http.server.CGIHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  523)
* doc (json.JSONDecodeError の属性):     例外<20>.           (line   14)
* doc (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   74)
* doc_header (cmd.Cmd の属性):           Cmdオブジェクト.    (line  152)
* DocCGIXMLRPCRequestHandler (xmlrpc.server のクラス): XMLRPC サーバの文書化.
                                                             (line   22)
* DocFileSuite() (doctest モジュール):   単体テスト API.     (line   25)
* doClassCleanups() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  893)
* doCleanups() (unittest.TestCase のメソッド): テストクラス. (line  853)
* docmd() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line   17)
* docstring:                             クラス定義.         (line    6)
* docstring <1>:                         用語集<2>.          (line  516)
* 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  180)
* 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  431)
* 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   65)
* done() (asyncio.Task のメソッド):      Task object.        (line   70)
* done() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   32)
* done() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  139)
* 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  540)
* 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)
* DOTBOX (tkinter モジュール):           定数<10>.           (line  165)
* doublequote (csv.Dialect の属性):      Dialect クラスと書式化パラメータ.
                                                             (line   23)
* DOUBLESLASH (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  323)
* DOUBLESLASHEQUAL (token モジュール):   token --- Python 解析木で使われる定数.
                                                             (line  326)
* DOUBLESTAR (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  287)
* DOUBLESTAREQUAL (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line  320)
* DoubleVar (tkinter のクラス):          Variable classes.   (line  124)
* doupdate() (curses モジュール):        関数<6>.            (line  107)
* 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   65)
* dtag() (tkinter.Canvas のメソッド):    Widget classes.     (line  415)
* DTDHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   24)
* duck-typing:                           用語集<2>.          (line  525)
* dump_c_stack() (faulthandler モジュール): Dumping the C stack.
                                                             (line    8)
* dump_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  103)
* dump_stats() (pstats.Stats のメソッド): The Stats Class.   (line   59)
* 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() (tkinter.Text のメソッド):      Widget classes.     (line 2303)
* dump() (tracemalloc.Snapshot のメソッド): Snapshot.        (line   29)
* dump() (xml.etree.ElementTree モジュール): 関数<9>.        (line   85)
* dumps() (json モジュール):             基本的な使い方<4>.  (line   91)
* 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  539)
* dup() (os モジュール):                 ファイル記述子の操作.
                                                             (line   93)
* dup() (socket.socket のメソッド):      socket オブジェクト.
                                                             (line  169)
* dup2() (os モジュール):                ファイル記述子の操作.
                                                             (line  106)
* DuplicateOptionError:                  例外<9>.            (line   24)
* DuplicateSectionError:                 例外<9>.            (line   14)
* dwFlags (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   20)
* DynamicClassAttribute() (types モジュール): 追加のユーティリティクラスと関数.
                                                             (line   54)
* e (cmath モジュール):                  定数<3>.            (line   10)
* e (math モジュール):                   定数<2>.            (line   10)
* E (tkinter モジュール):                定数<10>.           (line   21)
* 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  545)
* 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  124)
* echochar() (curses.window のメソッド): Window objects.     (line  193)
* 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_modified() (tkinter.Text のメソッド): Widget classes. (line 2227)
* edit_redo() (tkinter.Text のメソッド): Widget classes.     (line 2244)
* edit_reset() (tkinter.Text のメソッド): Widget classes.    (line 2253)
* edit_separator() (tkinter.Text のメソッド): Widget classes.
                                                             (line 2257)
* edit_undo() (tkinter.Text のメソッド): Widget classes.     (line 2234)
* edit() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   22)
* edit() (tkinter.Text のメソッド):      Widget classes.     (line 2219)
* 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 2078)
* EFD_NONBLOCK (os モジュール):          ファイルとディレクトリ.
                                                             (line 2087)
* EFD_SEMAPHORE (os モジュール):         ファイルとディレクトリ.
                                                             (line 2096)
* effective() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  512)
* 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  746)
* 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 styling.
                                                             (line  140)
* element_names() (tkinter.ttk.Style のメソッド): Ttk styling.
                                                             (line  259)
* element_options() (tkinter.ttk.Style のメソッド): Ttk styling.
                                                             (line  263)
* ElementDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  346)
* elements() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   68)
* 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   61)
* 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  357)
* 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   79)
* empty (inspect.Parameter の属性):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  226)
* empty (inspect.Signature の属性):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  111)
* EMPTY_NAMESPACE (xml.dom モジュール):  モジュールコンテンツ<2>.
                                                             (line   34)
* empty() (asyncio.Queue のメソッド):    Queue.              (line   26)
* empty() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  118)
* empty() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  239)
* empty() (queue.Queue のメソッド):      キューオブジェクト. (line   15)
* empty() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line   15)
* empty() (sched.scheduler のメソッド):  スケジューラオブジェクト.
                                                             (line   46)
* emptyline() (cmd.Cmd のメソッド):      Cmdオブジェクト.    (line   68)
* 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  131)
* enable_traversal() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   79)
* ENABLE_USER_SITE (site モジュール):    モジュールの内容<6>.
                                                             (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   77)
* EnableControlFlowGuard:                ビルド<46>.         (line   47)
* enabled (bdb.Breakpoint の属性):       bdb --- デバッガーフレームワーク.
                                                             (line  104)
* EnableReflectionKey() (winreg モジュール): 関数<14>.       (line  494)
* ENAMETOOLONG (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  181)
* ENAVAIL (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  551)
* enclose() (curses.window のメソッド):  Window objects.     (line  198)
* encode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   78)
* 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  120)
* encode() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  224)
* encode() (quopri モジュール):          quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   30)
* encode() (str のメソッド):             文字列メソッド<2>.  (line   86)
* encode() (xmlrpc.client.Binary のメソッド): Binary オブジェクト.
                                                             (line   24)
* encode() (xmlrpc.client.DateTime のメソッド): DateTime オブジェクト.
                                                             (line   18)
* encodebytes() (base64 モジュール):     レガシーインターフェース.
                                                             (line   31)
* EncodedFile() (codecs モジュール):     codecs --- codec レジストリと基底クラス.
                                                             (line  216)
* encodePriority() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line  100)
* encodestring() (quopri モジュール):    quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   47)
* encoding (curses.window の属性):       Window objects.     (line  208)
* encoding (io.TextIOBase の属性):       テキスト I/O<2>.    (line   15)
* ENCODING (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  324)
* ENCODING (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  153)
* encoding (UnicodeError の属性):        具象例外.           (line  433)
* 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 (tkinter モジュール):              定数<10>.           (line   87)
* end (UnicodeError の属性):             具象例外.           (line  454)
* 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  328)
* end_lineno (ast.AST の属性):           Node クラス.        (line   49)
* end_lineno (SyntaxError の属性):       具象例外.           (line  329)
* 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  334)
* end_offset (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  112)
* end_poly() (turtle モジュール):        特別な Turtle のメソッド.
                                                             (line   23)
* END_SEND (opcode):                     Python バイトコード命令.
                                                             (line  165)
* end() (re.Match のメソッド):           Match Objects.      (line  146)
* 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  450)
* EndDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  341)
* 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  372)
* endElementNS() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  114)
* endheaders() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  190)
* ENDMARKER (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  148)
* EndNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  430)
* endpos (re.Match の属性):              Match Objects.      (line  183)
* endPrefixMapping() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   68)
* endswith() (bytearray のメソッド):     bytes と bytearray の操作.
                                                             (line  122)
* endswith() (bytes のメソッド):         bytes と bytearray の操作.
                                                             (line  122)
* endswith() (str のメソッド):           文字列メソッド<2>.  (line  117)
* endwin() (curses モジュール):          関数<6>.            (line  129)
* 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  100)
* 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  629)
* enter_context() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  547)
* enter() (sched.scheduler のメソッド):  スケジューラオブジェクト.
                                                             (line   29)
* enterabs() (sched.scheduler のメソッド): スケジューラオブジェクト.
                                                             (line    8)
* enterAsyncContext() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  951)
* enterClassContext() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  884)
* enterContext() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  844)
* enterModuleContext() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   36)
* entities (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   38)
* EntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  401)
* entitydefs (html.entities モジュール): html entities --- HTML 一般実体の定義.
                                                             (line   24)
* EntityResolver (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   31)
* Entry (tkinter のクラス):              Widget classes.     (line  732)
* Entry (tkinter.ttk のクラス):          Additional widgets. (line   35)
* entry_points() (importlib.metadata モジュール): エントリポイント.
                                                             (line    6)
* entrycget() (tkinter.Menu のメソッド): Widget classes.     (line 1246)
* entryconfig() (tkinter.Menu のメソッド): Widget classes.   (line 1251)
* entryconfigure() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1251)
* 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  650)
* EnumDict (enum のクラス):              データ型<2>.        (line  777)
* 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  491)
* 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  206)
* eof (lzma.LZMADecompressor の属性):    メモリ上での圧縮と展開<2>.
                                                             (line  154)
* eof (shlex.shlex の属性):              shlex オブジェクト. (line  177)
* eof (ssl.MemoryBIO の属性):            Memory BIO support. (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 (組み込み例外):               File objects.       (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  723)
* EPIPE (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  162)
* epoll() (select モジュール):           select --- I/O 完了の待機.
                                                             (line   56)
* 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  636)
* 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 objects.     (line  218)
* erasechar() (curses モジュール):       関数<6>.            (line  133)
* 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   19)
* 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   66)
* 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  498)
* 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>:                             モジュールコンテンツ.
                                                             (line  356)
* 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   51)
* 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  197)
* error_body (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  261)
* error_content_type (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  204)
* 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  196)
* 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  279)
* errorcode (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line   13)
* ErrorCode (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  283)
* ErrorColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  289)
* ErrorHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   37)
* errorlevel (tarfile.TarFile の属性):   TarFile オブジェクト.
                                                             (line  228)
* ErrorLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  293)
* errors (io.TextIOBase の属性):         テキスト I/O<2>.    (line   20)
* errors (unittest.TestLoader の属性):   テストのロードと起動.
                                                             (line   17)
* errors (unittest.TestResult の属性):   テストのロードと起動.
                                                             (line  242)
* 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  117)
* escape() (html モジュール):            html --- HyperText Markup Language のサポート.
                                                             (line   12)
* escape() (re モジュール):              関数<2>.            (line  251)
* escape() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   14)
* escapechar (csv.Dialect の属性):       Dialect クラスと書式化パラメータ.
                                                             (line   35)
* 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  247)
* ETOOMANYREFS (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  500)
* Etop() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  253)
* 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  556)
* 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  203)
* 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 (tkinter のクラス):              Other classes.      (line    6)
* event_add() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  369)
* event_delete() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  377)
* event_generate() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  385)
* event_info() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  396)
* EVENT_READ (selectors モジュール):     クラス<4>.          (line   23)
* EVENT_WRITE (selectors モジュール):    クラス<4>.          (line   26)
* Event() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  186)
* eventfd_read() (os モジュール):        ファイルとディレクトリ.
                                                             (line 2058)
* eventfd_write() (os モジュール):       ファイルとディレクトリ.
                                                             (line 2068)
* eventfd() (os モジュール):             ファイルとディレクトリ.
                                                             (line 2005)
* EventLoop (asyncio のクラス):          Event loop implementations.
                                                             (line   42)
* events (selectors.SelectorKey の属性): クラス<4>.          (line   44)
* events (widgets):                      Bindings and events.
                                                             (line    6)
* EventType (tkinter のクラス):          Other classes.      (line   88)
* EW (tkinter モジュール):               定数<10>.           (line   21)
* 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  193)
* example (doctest.UnexpectedException の属性): デバッグ.    (line  214)
* examples (doctest.DocTest の属性):     DocTest オブジェクト.
                                                             (line   16)
* exc_info (doctest.UnexpectedException の属性): デバッグ.   (line  218)
* 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 のクラス):                  モジュールコンテンツ.
                                                             (line  226)
* excel_tab (csv のクラス):              モジュールコンテンツ.
                                                             (line  232)
* ExceptHandler (ast のクラス):          制御フロー.         (line  201)
* excepthook() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  385)
* excepthook() (threading モジュール):   リファレンス<2>.    (line   24)
* Exception:                             基底クラス.         (line   63)
* EXCEPTION (tkinter モジュール):        File handlers.      (line   42)
* EXCEPTION_HANDLED (monitoring event):  Events.             (line   35)
* exception() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  134)
* exception() (asyncio.Task のメソッド): Task object.        (line   91)
* 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   40)
* exceptions (pdb command):              Debugger commands.  (line  458)
* 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  261)
* 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  401)
* 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  458)
* exec() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   42)
* execl() (os モジュール):               プロセス管理.       (line   53)
* execle() (os モジュール):              プロセス管理.       (line   53)
* execlp() (os モジュール):              プロセス管理.       (line   53)
* execlpe() (os モジュール):             プロセス管理.       (line   53)
* executable (in module sys):            プロセスワイドのパラメータ.
                                                             (line  121)
* executable (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  481)
* 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  274)
* 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   44)
* exists() (pathlib.types.PathInfo のメソッド): プロトコル.  (line   16)
* exists() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   93)
* exists() (zipfile.Path のメソッド):    Path objects.       (line   74)
* exit (C function):                     プロセス制御.       (line   23)
* exit (組み込み変数):                   site モジュールで追加される定数.
                                                             (line   11)
* exit() (_thread モジュール):           _thread --- 低水準なスレッド API.
                                                             (line   72)
* exit() (argparse.ArgumentParser のメソッド): 終了メソッド. (line    6)
* exit() (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line  488)
* exitcode (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  160)
* exitonclick() (turtle モジュール):     Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   10)
* ExitStack (contextlib のクラス):       ユーティリティ.     (line  508)
* exp() (cmath モジュール):              指数関数と対数関数. (line    6)
* exp() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  316)
* exp() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  223)
* 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 のメソッド):        Match Objects.      (line   25)
* 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  137)
* 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  262)
* 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  562)
* Expression (ast のクラス):             Root nodes.         (line   26)
* expression (string.templatelib.Interpolation の属性): 型.  (line  224)
* 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  169)
* extend() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   61)
* extend() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   92)
* extend() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   89)
* EXTENDED (tkinter モジュール):         定数<10>.           (line  122)
* EXTENDED_ARG (opcode):                 Python バイトコード命令.
                                                             (line 1206)
* ExtendedContext (decimal モジュール):  Context オブジェクト.
                                                             (line   82)
* ExtendedInterpolation (configparser のクラス): 値の補間.   (line   39)
* extendleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   66)
* extension module:                      用語集<2>.          (line  571)
* 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  417)
* 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  476)
* extra (zipfile.ZipInfo の属性):        ZipInfo objects.    (line  109)
* extract_cookies() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   32)
* extract_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line   91)
* 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  195)
* extractall() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  141)
* extractall() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  223)
* ExtractError:                          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  270)
* extractfile() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  212)
* extraction_filter (tarfile.TarFile の属性): TarFile オブジェクト.
                                                             (line  248)
* extsep (os モジュール):                雑多なシステム情報. (line  129)
* f_back (frame の属性):                 Special read-only attributes<3>.
                                                             (line    6)
* f_back (フレーム属性):                 フレーム frame オブジェクト.
                                                             (line   10)
* f_bavail (os.statvfs_result の属性):   ファイルとディレクトリ.
                                                             (line 1448)
* f_bfree (os.statvfs_result の属性):    ファイルとディレクトリ.
                                                             (line 1444)
* f_blocks (os.statvfs_result の属性):   ファイルとディレクトリ.
                                                             (line 1439)
* f_bsize (os.statvfs_result の属性):    ファイルとディレクトリ.
                                                             (line 1431)
* 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  513)
* f_favail (os.statvfs_result の属性):   ファイルとディレクトリ.
                                                             (line 1460)
* f_ffree (os.statvfs_result の属性):    ファイルとディレクトリ.
                                                             (line 1456)
* f_files (os.statvfs_result の属性):    ファイルとディレクトリ.
                                                             (line 1452)
* f_flag (os.statvfs_result の属性):     ファイルとディレクトリ.
                                                             (line 1464)
* f_frsize (os.statvfs_result の属性):   ファイルとディレクトリ.
                                                             (line 1435)
* f_fsid (os.statvfs_result の属性):     ファイルとディレクトリ.
                                                             (line 1479)
* 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  278)
* f_namemax (os.statvfs_result の属性):  ファイルとディレクトリ.
                                                             (line 1473)
* F_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* F_TEST (os モジュール):                ファイル記述子の操作.
                                                             (line  278)
* F_TLOCK (os モジュール):               ファイル記述子の操作.
                                                             (line  278)
* 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  278)
* f-string:                              出力を見やすくフォーマットする.
                                                             (line   91)
* f-string <1>:                          Raw string literals.
                                                             (line   25)
* f-string <2>:                          用語集<2>.          (line  576)
* f-strings:                             文字列メソッド<2>.  (line  978)
* f-strings <1>:                         用語集<2>.          (line  579)
* 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   23)
* factory() (importlib.util.LazyLoader のクラスメソッド): importlib util -- Utility code for importers.
                                                             (line  226)
* FAIL_FAST (doctest モジュール):        オプションフラグ.   (line  138)
* fail() (unittest.TestCase のメソッド): テストクラス.       (line  752)
* failed (doctest.TestResults の属性):   TestResults objects.
                                                             (line    8)
* failfast (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  300)
* failureException (unittest.TestCase の属性): テストクラス. (line  757)
* failures (doctest.DocTestRunner の属性): DocTestRunner オブジェクト.
                                                             (line  141)
* failures (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  248)
* 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 (tkinter モジュール):            定数<10>.           (line   15)
* False (組み込みオブジェクト):          真理値判定.         (line   17)
* False (組み込み変数):                  組み込み定数.       (line    8)
* families() (tkinter.font モジュール):  tkinter font --- Tkinter フォントラッパー.
                                                             (line  102)
* family (socket.socket の属性):         socket オブジェクト.
                                                             (line  698)
* fast (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  308)
* fast (pickle.Pickler の属性):          モジュールインターフェース.
                                                             (line  225)
* 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  482)
* feed_eof() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   16)
* feed() (email.parser.BytesFeedParser のメソッド): FeedParser API.
                                                             (line   56)
* 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   71)
* 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 objects.     (line   90)
* Field (dataclasses のクラス):          モジュールの内容<5>.
                                                             (line  319)
* field_size_limit() (csv モジュール):   モジュールコンテンツ.
                                                             (line  104)
* field() (dataclasses モジュール):      モジュールの内容<5>.
                                                             (line  219)
* fieldnames (csv.DictReader の属性):    reader オブジェクト.
                                                             (line   31)
* fields (uuid.UUID の属性):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   96)
* fields() (dataclasses モジュール):     モジュールの内容<5>.
                                                             (line  347)
* 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  584)
* file object;io module:                 概要<2>.            (line    6)
* file object;open() built-in function:  組み込み関数.       (line 1264)
* 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  600)
* fileConfig() (logging.config モジュール): 環境設定のための関数.
                                                             (line   60)
* FileCookieJar (http.cookiejar のクラス): http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   57)
* FileDialog (tkinter.filedialog のクラス): Native load/save dialogs.
                                                             (line   85)
* 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  293)
* 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  311)
* 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   85)
* 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 polling objects.
                                                             (line   24)
* fileno() (select.epoll のメソッド):    Edge and level trigger polling epoll objects.
                                                             (line   79)
* fileno() (select.kqueue のメソッド):   Kqueue objects.     (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  180)
* fileno() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   15)
* FileNotFoundError:                     OS 例外.            (line   68)
* fileobj (selectors.SelectorKey の属性): クラス<4>.         (line   36)
* files_double_event() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  101)
* files_select_event() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  105)
* files() (importlib.metadata モジュール): 配布物ファイル.   (line    6)
* files() (importlib.resources モジュール): importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line   51)
* files() (importlib.resources.abc.TraversableResources のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  172)
* filesystem encoding and error handler: 用語集<2>.          (line  604)
* 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  290)
* 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 objects.     (line   15)
* Filter (tracemalloc のクラス):         Filter.             (line    6)
* filter_command() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  109)
* FILTER_DIR (unittest.mock モジュール): FILTER_DIR.         (line    6)
* filter_traces() (tracemalloc.Snapshot のメソッド): Snapshot.
                                                             (line   36)
* filter() (curses モジュール):          関数<6>.            (line  140)
* 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  261)
* finalize_dict() (compression.zstd モジュール): Zstandard dictionaries.
                                                             (line   28)
* finalizer:                             基本的なカスタマイズ.
                                                             (line   53)
* find_above() (tkinter.Canvas のメソッド): Widget classes.  (line  480)
* find_all() (tkinter.Canvas のメソッド): Widget classes.    (line  485)
* find_below() (tkinter.Canvas のメソッド): Widget classes.  (line  490)
* find_class() (pickle プロトコル):      グローバル変数を制限する.
                                                             (line    6)
* find_class() (pickle.Unpickler のメソッド): モジュールインターフェース.
                                                             (line  310)
* find_closest() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  495)
* find_enclosed() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  501)
* find_library() (ctypes.util モジュール): ユーティリティー関数.
                                                             (line  129)
* find_longest_match() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line   65)
* find_msvcrt() (ctypes.util モジュール): ユーティリティー関数.
                                                             (line  141)
* find_overlapping() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  506)
* 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_withtag() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  511)
* 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  196)
* find() (str のメソッド):               文字列メソッド<2>.  (line  161)
* find() (tkinter.Canvas のメソッド):    Widget classes.     (line  471)
* find() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   96)
* find() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   20)
* findall() (re モジュール):             関数<2>.            (line  128)
* findall() (re.Pattern のメソッド):     Regular Expression Objects.
                                                             (line   85)
* findall() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  105)
* findall() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   25)
* findCaller() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  340)
* finder:                                ファインダーとローダー.
                                                             (line    6)
* finder <1>:                            用語集<2>.          (line  626)
* finder;find_spec:                      メタパス.           (line    6)
* findfile() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  296)
* finditer() (re モジュール):            関数<2>.            (line  154)
* finditer() (re.Pattern のメソッド):    Regular Expression Objects.
                                                             (line   91)
* findlabels() (dis モジュール):         解析関数.           (line  186)
* findlinestarts() (dis モジュール):     解析関数.           (line  169)
* findtext() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  114)
* findtext() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   30)
* finish_request() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line  125)
* finish() (socketserver.BaseRequestHandler のメソッド): Request Handler Objects.
                                                             (line   34)
* finish() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   52)
* FIRST (tkinter モジュール):            定数<10>.           (line  146)
* FIRST_COMPLETED (asyncio モジュール):  Waiting primitives. (line   35)
* FIRST_COMPLETED (concurrent.futures モジュール): モジュール関数<2>.
                                                             (line   29)
* FIRST_EXCEPTION (asyncio モジュール):  Waiting primitives. (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  353)
* fix_missing_locations() (ast モジュール): ast helpers.     (line  146)
* fix_sentence_endings (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  223)
* Flag (enum のクラス):                  データ型<2>.        (line  472)
* flag_bits (zipfile.ZipInfo の属性):    ZipInfo objects.    (line  131)
* FlagBoundary (enum のクラス):          データ型<2>.        (line  709)
* flags (decimal.Context の属性):        Context オブジェクト.
                                                             (line  136)
* flags (re.Pattern の属性):             Regular Expression Objects.
                                                             (line  107)
* flags (select.kevent の属性):          Kevent objects.     (line   52)
* flags (sys モジュール):                sys --- システム固有のパラメーターと関数.
                                                             (line  519)
* flash() (curses モジュール):           関数<6>.            (line  151)
* flash() (tkinter.Button のメソッド):   Widget classes.     (line   24)
* flash() (tkinter.Checkbutton のメソッド): Widget classes.  (line  724)
* flash() (tkinter.Radiobutton のメソッド): Widget classes.  (line 1515)
* FLAT (tkinter モジュール):             定数<10>.           (line   55)
* flatten() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line   79)
* flatten() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  172)
* float (組み込みクラス):                組み込み関数.       (line  711)
* float_info (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  623)
* float_repr_style (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  730)
* floating-point literal:                数値リテラル.       (line    6)
* FloatingPointError:                    具象例外.           (line   39)
* FloatOperation (decimal のクラス):     シグナル.           (line  107)
* flock() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  169)
* floor division:                        用語集<2>.          (line  638)
* 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  135)
* FLUSH_FRAME (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  142)
* flush_headers() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  337)
* 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  206)
* 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  278)
* flushinp() (curses モジュール):        関数<6>.            (line  157)
* FlushKey() (winreg モジュール):        関数<14>.           (line  237)
* fma() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  320)
* fma() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  275)
* 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.Event の属性):          Other classes.      (line   24)
* focus_displayof() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  538)
* focus_force() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  523)
* focus_get() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  531)
* focus_lastfor() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  544)
* focus_set() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  511)
* focus() (tkinter.Canvas のメソッド):   Widget classes.     (line  593)
* focus() (tkinter.Misc のメソッド):     Base and mixin classes.
                                                             (line  511)
* focus() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line   98)
* focusmodel() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1366)
* fold (datetime.datetime の属性):       datetime objects.   (line  342)
* fold (datetime.time の属性):           time objects.       (line   71)
* fold_binary() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  604)
* fold_binary() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  484)
* fold_binary() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  348)
* fold() (email.headerregistry.BaseHeader のメソッド): email headerregistry Custom Header Objects.
                                                             (line   72)
* fold() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  596)
* fold() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  464)
* fold() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  333)
* Font (tkinter.font のクラス):          tkinter font --- Tkinter フォントラッパー.
                                                             (line   20)
* For (ast のクラス):                    制御フロー.         (line   44)
* FOR_ITER (opcode):                     Python バイトコード命令.
                                                             (line  923)
* for;in comprehensions:                 Displays for lists sets and dictionaries.
                                                             (line   14)
* forget() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   11)
* forget() (tkinter.Grid のメソッド):    Base and mixin classes.
                                                             (line 1881)
* forget() (tkinter.Pack のメソッド):    Base and mixin classes.
                                                             (line 1719)
* forget() (tkinter.PanedWindow のメソッド): Widget classes. (line 1381)
* forget() (tkinter.Place のメソッド):   Base and mixin classes.
                                                             (line 1809)
* forget() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   18)
* forget() (tkinter.ttk.Panedwindow のメソッド): Additional widgets.
                                                             (line  132)
* forget() (tkinter.Wm のメソッド):      Base and mixin classes.
                                                             (line 1377)
* fork() (os モジュール):                プロセス管理.       (line  255)
* fork() (pty モジュール):               pty --- 擬似端末ユーティリティ.
                                                             (line   22)
* ForkingMixIn (socketserver のクラス):  サーバ生成に関するノート.
                                                             (line   26)
* ForkingTCPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUDPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUnixDatagramServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ForkingUnixStreamServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* forkpty() (os モジュール):             プロセス管理.       (line  299)
* Format (annotationlib のクラス):       クラス<5>.          (line    6)
* FORMAT (inspect.BufferFlags の属性):   Buffer flags.       (line   19)
* format (memoryview の属性):            メモリビュー.       (line  453)
* 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  160)
* format_exception_only() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  115)
* format_exception_only() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  152)
* format_exception() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  145)
* format_field() (string.Formatter のメソッド): Custom string formatting.
                                                             (line  102)
* format_frame_summary() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   54)
* format_help() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   30)
* format_list() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line  105)
* format_map() (str のメソッド):         文字列メソッド<2>.  (line  216)
* FORMAT_SIMPLE (opcode):                Python バイトコード命令.
                                                             (line 1232)
* format_spec (string.templatelib.Interpolation の属性): 型. (line  260)
* format_stack_entry() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  461)
* format_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  169)
* format_string() (locale モジュール):   locale --- 国際化サービス.
                                                             (line  455)
* format_tb() (traceback モジュール):    モジュールレベルの関数<2>.
                                                             (line  165)
* 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  182)
* format() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   17)
* format() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   39)
* format() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  141)
* 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  169)
* 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  242)
* formatmonthname() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  186)
* formatStack() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line  120)
* formatted string literal:              出力を見やすくフォーマットする.
                                                             (line   91)
* formatted string literal <1>:          Raw string literals.
                                                             (line   25)
* formatted string literals:             文字列メソッド<2>.  (line  978)
* FormattedValue (ast のクラス):         リテラル<3>.        (line   25)
* Formatter (logging のクラス):          フォーマッタオブジェクト.
                                                             (line    6)
* Formatter (string のクラス):           Custom string formatting.
                                                             (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  385)
* forward() (turtle モジュール):         Turtle の動き.      (line    6)
* ForwardRef (annotationlib のクラス):   クラス<5>.          (line   49)
* FORWARDREF (annotationlib.Format の属性): クラス<5>.       (line   30)
* ForwardRef (typing のクラス):          Introspection helpers.
                                                             (line  182)
* fp (urllib.error.HTTPError の属性):    urllib error --- urllib request によって送出される例外クラス.
                                                             (line   61)
* fpathconf() (os モジュール):           ファイル記述子の操作.
                                                             (line  159)
* Fraction (fractions のクラス):         fractions --- 有理数.
                                                             (line   15)
* fraction() (tkinter.Scrollbar のメソッド): Widget classes. (line 1609)
* frame (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   13)
* Frame (tkinter のクラス):              Widget classes.     (line  848)
* frame (tkinter.scrolledtext.ScrolledText の属性): tkinter scrolledtext --- Scrolled text widget.
                                                             (line   26)
* Frame (tkinter.ttk のクラス):          Additional widgets. (line   62)
* Frame (tracemalloc のクラス):          Frame.              (line    6)
* frame() (tkinter.Wm のメソッド):       Base and mixin classes.
                                                             (line 1390)
* 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  647)
* free variable:                         用語集<2>.          (line  662)
* free_tool_id() (sys.monitoring モジュール): Registering and using tools.
                                                             (line   18)
* free-threaded build:                   用語集<2>.          (line  654)
* 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  219)
* frexp() (math モジュール):             Floating point manipulation functions.
                                                             (line   12)
* FRIDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  439)
* 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  146)
* 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  233)
* from_float() (fractions.Fraction のクラスメソッド): fractions --- 有理数.
                                                             (line  135)
* 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  260)
* from_number() (float のクラスメソッド): 浮動小数点数に対する追加のメソッド.
                                                             (line    9)
* from_number() (fractions.Fraction のクラスメソッド): fractions --- 有理数.
                                                             (line  155)
* 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   53)
* from;yield from expression:            Yield 式.           (line   62)
* frombuf() (tarfile.TarInfo のクラスメソッド): TarInfo オブジェクト.
                                                             (line   37)
* frombytes() (array.array のメソッド):  array --- 効率的な数値配列.
                                                             (line  178)
* fromfd() (select.epoll のメソッド):    Edge and level trigger polling epoll objects.
                                                             (line   83)
* fromfd() (select.kqueue のメソッド):   Kqueue objects.     (line   18)
* fromfd() (socket モジュール):          ソケットの作成.     (line  105)
* fromfile() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  188)
* 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  247)
* fromisoformat() (datetime.date のクラスメソッド): date objects.
                                                             (line   62)
* fromisoformat() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  200)
* fromisoformat() (datetime.time のクラスメソッド): time objects.
                                                             (line  106)
* fromkeys() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  119)
* fromkeys() (dict のクラスメソッド):    Mapping Types --- dict.
                                                             (line  169)
* fromlist() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  196)
* fromordinal() (datetime.date のクラスメソッド): date objects.
                                                             (line   53)
* fromordinal() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  175)
* fromshare() (socket モジュール):       ソケットの作成.     (line  122)
* 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  202)
* 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:                   モジュールの内容<5>.
                                                             (line  532)
* 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  179)
* fstatvfs() (os モジュール):            ファイル記述子の操作.
                                                             (line  191)
* fstring:                               出力を見やすくフォーマットする.
                                                             (line   91)
* fstring <1>:                           Raw string literals.
                                                             (line   25)
* fstring <2>:                           文字列メソッド<2>.  (line  978)
* 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  200)
* 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  212)
* Full:                                  queue --- 同期キュークラス.
                                                             (line   85)
* 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  127)
* full() (queue.Queue のメソッド):       キューオブジェクト. (line   22)
* fullmatch() (re モジュール):           関数<2>.            (line   66)
* fullmatch() (re.Pattern のメソッド):   Regular Expression Objects.
                                                             (line   63)
* fully_trusted_filter() (tarfile モジュール): Default named filters.
                                                             (line    9)
* func (functools.partial の属性):       partial オブジェクト.
                                                             (line   10)
* funcname (bdb.Breakpoint の属性):      bdb --- デバッガーフレームワーク.
                                                             (line   99)
* 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  678)
* FunctionDef (ast のクラス):            関数およびクラス定義.
                                                             (line    6)
* FunctionTestCase (unittest のクラス):  テストクラス.       (line 1011)
* 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 1901)
* gaierror:                              例外<18>.           (line   26)
* gamma() (math モジュール):             特殊関数.           (line   27)
* gammavariate() (random モジュール):    実数分布.           (line   43)
* garbage (gc モジュール):               gc --- ガベージコレクターインターフェース.
                                                             (line  253)
* garbage collection:                    オブジェクト、値、および型.
                                                             (line   35)
* garbage collection <1>:                用語集<2>.          (line  713)
* gather() (asyncio モジュール):         Running tasks concurrently.
                                                             (line    6)
* gather() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line  116)
* gauss() (random モジュール):           実数分布.           (line   56)
* gc_collect() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  382)
* gcd() (math モジュール):               Number-theoretic functions.
                                                             (line   30)
* gcvisitobjects_t (C type):             Querying Garbage Collector State.
                                                             (line   26)
* ge() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* generate_tokens() (tokenize モジュール): Tokenizing Input. (line   36)
* Generator (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   56)
* Generator (email.generator のクラス):  email generator Generating MIME documents.
                                                             (line  137)
* Generator (typing のクラス):           Aliases to other ABCs in collections abc.
                                                             (line   38)
* generator expression:                  用語集<2>.          (line  753)
* generator expression <1>:              用語集<2>.          (line  753)
* generator function:                    用語集<2>.          (line  728)
* generator function <1>:                用語集<2>.          (line  728)
* generator iterator:                    用語集<2>.          (line  734)
* generator_stop (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (line   43)
* GeneratorExit:                         具象例外.           (line   43)
* GeneratorExp (ast のクラス):           内包表記 Comprehension.
                                                             (line    6)
* generators (__future__ モジュール):    モジュールコンテンツ<3>.
                                                             (line   18)
* GeneratorType (types モジュール):      標準的なインタプリタ型.
                                                             (line   36)
* Generic (typing のクラス):             Building generic types and type aliases.
                                                             (line   15)
* generic function:                      用語集<2>.          (line  762)
* generic type:                          用語集<2>.          (line  770)
* 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)
* geometry() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1398)
* GET_AITER (opcode):                    Python バイトコード命令.
                                                             (line  330)
* get_all_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  423)
* 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  363)
* 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   69)
* get_args() (typing モジュール):        Introspection helpers.
                                                             (line   97)
* get_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1021)
* 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  225)
* get_body_encoding() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line   97)
* 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  586)
* get_bpbynumber() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  399)
* get_break() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  408)
* get_breaks() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  413)
* 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 contexts.  (line  179)
* get_cache_token() (abc モジュール):    abc --- 抽象基底クラス.
                                                             (line  324)
* get_channel_binding() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  258)
* get_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  266)
* get_charsets() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  433)
* get_charsets() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  621)
* get_children() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  120)
* get_children() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line   22)
* get_ciphers() (ssl.SSLContext のメソッド): SSL contexts.   (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  208)
* get_code() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  397)
* 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  609)
* 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  634)
* 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  434)
* 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  440)
* 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  416)
* 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 のメソッド): Callback handles.
                                                             (line   11)
* get_context() (asyncio.Task のメソッド): Task object.      (line  175)
* get_context() (multiprocessing モジュール): その他<5>.     (line   86)
* get_coro() (asyncio.Task のメソッド):  Task object.        (line  161)
* get_coroutine_origin_tracking_depth() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1035)
* get_count() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  130)
* 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  324)
* get_data() (importlib.abc.ResourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  188)
* 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   60)
* get_default_backend() (pdb モジュール): コマンドライン・インターフェース<8>.
                                                             (line  169)
* 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  446)
* get_default_verify_paths() (ssl モジュール): 証明書の取り扱い.
                                                             (line   63)
* get_default() (argparse.ArgumentParser のメソッド): パーサーのデフォルト値.
                                                             (line   34)
* get_dialect() (csv モジュール):        モジュールコンテンツ.
                                                             (line   94)
* 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  185)
* get_escdelay() (curses モジュール):    関数<6>.            (line  474)
* get_event_loop_policy() (asyncio モジュール): ポリシーの取得と設定.
                                                             (line    9)
* get_event_loop() (asyncio モジュール): Event loop.         (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 のメソッド): Error handling API.
                                                             (line   27)
* get_exec_path() (os モジュール):       プロセスのパラメーター.
                                                             (line  189)
* get_extra_info() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   21)
* get_extra_info() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   66)
* get_field() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   56)
* get_file_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  418)
* 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  577)
* get_filename() (importlib.abc.ExecutionLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  280)
* get_filename() (importlib.abc.FileLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  320)
* 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 のメソッド): Native load/save dialogs.
                                                             (line  113)
* 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  244)
* 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 objects.
                                                             (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   82)
* 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  190)
* get_instructions() (dis モジュール):   解析関数.           (line  142)
* get_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  837)
* 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  193)
* 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  147)
* get_loop() (asyncio.Runner のメソッド): Runner context manager.
                                                             (line   65)
* get_loop() (asyncio.Server のメソッド): Server objects.    (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 objects.
                                                             (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 object.        (line  182)
* get_name() (symtable.Symbol のメソッド): 記号表の検査.     (line  199)
* get_name() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   74)
* get_namespace() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  310)
* get_namespaces() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  306)
* get_native_id() (_thread モジュール):  _thread --- 低水準なスレッド API.
                                                             (line   90)
* 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  167)
* 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   64)
* get_opcodes() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line  124)
* get_option_group() (optparse.OptionParser のメソッド): オプションをグループ化する.
                                                             (line  102)
* get_option() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   38)
* get_origin() (typing モジュール):      Introspection helpers.
                                                             (line   74)
* get_original_bases() (types モジュール): 動的な型生成.     (line   65)
* 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  114)
* 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  481)
* get_parameters() (symtable.Function のメソッド): 記号表の検査.
                                                             (line  129)
* get_params() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  460)
* 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  181)
* 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  115)
* get_protocol() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   89)
* get_proxy_response_headers() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  141)
* get_python_version() (sysconfig モジュール): その他の関数<3>.
                                                             (line    6)
* get_ready() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  153)
* get_referents() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  160)
* get_referrers() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  139)
* get_request() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (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 モジュール): Event loop.       (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 のメソッド): Native load/save dialogs.
                                                             (line  117)
* 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  222)
* get_source() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  414)
* 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 object.        (line  125)
* get_stack() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  452)
* get_start_method() (multiprocessing モジュール): その他<5>.
                                                             (line  101)
* get_starttag_text() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   33)
* get_stats_profile() (pstats.Stats のメソッド): The Stats Class.
                                                             (line  224)
* get_stats() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line   80)
* 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  489)
* get_task_factory() (asyncio.loop のメソッド): Creating futures and tasks.
                                                             (line   83)
* get_terminal_size() (os モジュール):   ターミナルのサイズの問い合わせ.
                                                             (line    8)
* get_terminal_size() (shutil モジュール): 出力ターミナルのサイズの取得.
                                                             (line    6)
* get_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  134)
* 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  205)
* get_unverified_chain() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  223)
* get_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   22)
* get_value() (multiprocessing.Semaphore のメソッド): 同期プリミティブ.
                                                             (line  212)
* get_value() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   67)
* get_verified_chain() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  214)
* get_version() (optparse.OptionParser のメソッド): バージョン番号の出力.
                                                             (line   33)
* get_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   64)
* get_wch() (curses.window のメソッド):  Window objects.     (line  240)
* 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   33)
* get() (dict のメソッド):               Mapping Types --- dict.
                                                             (line  181)
* get() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  246)
* get() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  355)
* get() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line  146)
* get() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  205)
* get() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  153)
* get() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  247)
* get() (queue.Queue のメソッド):        キューオブジェクト. (line   46)
* get() (queue.SimpleQueue のメソッド):  SimpleQueue オブジェクト.
                                                             (line   41)
* get() (tkinter.BooleanVar のメソッド): Variable classes.   (line  145)
* get() (tkinter.DoubleVar のメソッド):  Variable classes.   (line  129)
* get() (tkinter.Entry のメソッド):      Widget classes.     (line  763)
* get() (tkinter.IntVar のメソッド):     Variable classes.   (line  120)
* get() (tkinter.Listbox のメソッド):    Widget classes.     (line  914)
* get() (tkinter.PhotoImage のメソッド): Image classes.      (line  158)
* get() (tkinter.Scale のメソッド):      Widget classes.     (line 1540)
* get() (tkinter.Scrollbar のメソッド):  Widget classes.     (line 1577)
* get() (tkinter.Spinbox のメソッド):    Widget classes.     (line 1648)
* get() (tkinter.StringVar のメソッド):  Variable classes.   (line  111)
* get() (tkinter.Text のメソッド):       Widget classes.     (line 1854)
* get() (tkinter.ttk.Combobox のメソッド): ttk Combobox.     (line   15)
* get() (tkinter.ttk.Scale のメソッド):  Additional widgets. (line  191)
* get() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line   13)
* get() (tkinter.Variable のメソッド):   Variable classes.   (line   31)
* get() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  266)
* 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  741)
* getandroidapilevel() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  761)
* 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 objects.     (line  222)
* getbkgd() (curses.window のメソッド):  Window objects.     (line  226)
* getblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  228)
* getboolean() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  251)
* getboolean() (tkinter モジュール):     Module-level functions.
                                                             (line   34)
* getboolean() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line   43)
* 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 objects.     (line  232)
* 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)
* getcompname() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   84)
* getcomptype() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   36)
* getcomptype() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   80)
* 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  118)
* getdefaultencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  772)
* getdefaultlocale() (locale モジュール): locale --- 国際化サービス.
                                                             (line  350)
* getdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  371)
* getdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  777)
* getdoc() (inspect モジュール):         ソースコードの情報取得.
                                                             (line    6)
* getDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<2>.
                                                             (line   17)
* getdouble() (tkinter モジュール):      Module-level functions.
                                                             (line   41)
* getdouble() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line   50)
* getDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   31)
* getEffectiveLevel() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  148)
* getegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  198)
* 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  110)
* getencoding() (locale モジュール):     locale --- 国際化サービス.
                                                             (line  409)
* getEncoding() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   32)
* getEntityResolver() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   40)
* getenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  158)
* getenvb() (os モジュール):             プロセスのパラメーター.
                                                             (line  173)
* getErrorHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   50)
* geteuid() (os モジュール):             プロセスのパラメーター.
                                                             (line  205)
* 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   68)
* getfile() (inspect モジュール):        ソースコードの情報取得.
                                                             (line   27)
* getFilesToDelete() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  111)
* getfilesystemencodeerrors() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  818)
* getfilesystemencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  786)
* 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)
* getframerate() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   61)
* 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  211)
* getgrall() (grp モジュール):           grp --- グループデータベース.
                                                             (line   60)
* getgrgid() (grp モジュール):           grp --- グループデータベース.
                                                             (line   45)
* getgrnam() (grp モジュール):           grp --- グループデータベース.
                                                             (line   54)
* getgrouplist() (os モジュール):        プロセスのパラメーター.
                                                             (line  220)
* getgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  231)
* 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  134)
* getincrementalencoder() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  126)
* getinfo() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  120)
* getinnerframes() (inspect モジュール): インタープリタスタック.
                                                             (line  140)
* GetInputContext() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   36)
* getint() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  237)
* getint() (tkinter モジュール):         Module-level functions.
                                                             (line   46)
* getint() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line   58)
* getitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  204)
* getiterfunc (C type):                  Slot Type typedefs. (line   95)
* getitimer() (signal モジュール):       モジュールの内容<3>.
                                                             (line  462)
* getkey() (curses.window のメソッド):   Window objects.     (line  248)
* GetLastError() (ctypes モジュール):    ユーティリティー関数.
                                                             (line  177)
* 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  373)
* getLogger() (logging モジュール):      モジュールレベルの関数.
                                                             (line    8)
* getLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line   21)
* getlogin() (os モジュール):            プロセスのパラメーター.
                                                             (line  253)
* getLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line   32)
* getMandatoryRelease() (__future__._Feature のメソッド): モジュールコンテンツ<3>.
                                                             (line   77)
* getmark() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   72)
* getmarkers() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   64)
* getmaxyx() (curses.window のメソッド): Window objects.     (line  255)
* getmember() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  106)
* getmembers_static() (inspect モジュール): 型とメンバー.    (line  371)
* getmembers() (inspect モジュール):     型とメンバー.       (line  358)
* 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  389)
* getmouse() (curses モジュール):        関数<6>.            (line  163)
* getmro() (inspect モジュール):         クラスと関数<2>.    (line   79)
* getmtime() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  189)
* getName() (threading.Thread のメソッド): Thread objects.   (line  198)
* 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)
* getnchannels() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   42)
* getnframes() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   32)
* getnframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   71)
* getnode() (uuid モジュール):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  173)
* getobjects() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  929)
* 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 のメソッド): モジュールコンテンツ<3>.
                                                             (line   72)
* getouterframes() (inspect モジュール): インタープリタスタック.
                                                             (line  125)
* getoutput() (subprocess モジュール):   レガシーなシェル呼び出し関数.
                                                             (line   45)
* getpagesize() (resource モジュール):   リソースの使用状態. (line  102)
* getparams() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   46)
* getparams() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   94)
* getparyx() (curses.window のメソッド): Window objects.     (line  259)
* getpass() (getpass モジュール):        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   17)
* GetPassWarning:                        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   49)
* getpeercert() (ssl.SSLSocket のメソッド): SSL sockets.     (line  149)
* getpeername() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  198)
* getpen() (turtle モジュール):          特別な Turtle のメソッド.
                                                             (line   51)
* getpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  263)
* getpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  270)
* getpid() (os モジュール):              プロセスのパラメーター.
                                                             (line  276)
* getpos() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   29)
* getppid() (os モジュール):             プロセスのパラメーター.
                                                             (line  283)
* getpreferredencoding() (locale モジュール): locale --- 国際化サービス.
                                                             (line  385)
* getpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  294)
* getprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  954)
* getprofile() (threading モジュール):   リファレンス<2>.    (line  149)
* getProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   81)
* 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  142)
* getrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  863)
* getrefcount() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line  845)
* GetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  109)
* getresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  341)
* getresponse() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line   81)
* getresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  332)
* getrlimit() (resource モジュール):     リソースの制限.     (line   26)
* getroot() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   35)
* getrusage() (resource モジュール):     リソースの使用状態. (line    8)
* getsampwidth() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   24)
* getsampwidth() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   50)
* 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 モジュール):       モジュールの内容<3>.
                                                             (line  311)
* getsitepackages() (site モジュール):   モジュールの内容<6>.
                                                             (line   58)
* getsize() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  210)
* getsizeof() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  871)
* getsockname() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  206)
* getsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  213)
* 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 objects.     (line  264)
* getSubject() (logging.handlers.SMTPHandler のメソッド): SMTPHandler.
                                                             (line   37)
* getswitchinterval() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  892)
* getSystemId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   18)
* getSystemId() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   20)
* getsyx() (curses モジュール):          関数<6>.            (line  182)
* gettags() (tkinter.Canvas のメソッド): Widget classes.     (line  408)
* gettarinfo() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  307)
* 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  107)
* 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  237)
* gettrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  959)
* gettrace() (threading モジュール):     リファレンス<2>.    (line  127)
* getturtle() (turtle モジュール):       特別な Turtle のメソッド.
                                                             (line   51)
* getType() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   19)
* getuid() (os モジュール):              プロセスのパラメーター.
                                                             (line  350)
* getunicodeinternedsize() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  755)
* 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 モジュール):       モジュールの内容<6>.
                                                             (line   64)
* getusersitepackages() (site モジュール): モジュールの内容<6>.
                                                             (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)
* getvar() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line   64)
* getwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   21)
* getwche() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   30)
* getweakrefcount() (weakref モジュール): weakref --- Weak references.
                                                             (line  152)
* getweakrefs() (weakref モジュール):    weakref --- Weak references.
                                                             (line  156)
* getwelcome() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  121)
* getwelcome() (poplib.POP3 のメソッド): POP3 オブジェクト.  (line   19)
* getwin() (curses モジュール):          関数<6>.            (line  188)
* getwindowsversion() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  968)
* getwriter() (codecs モジュール):       codecs --- codec レジストリと基底クラス.
                                                             (line  150)
* getxattr() (os モジュール):            Linux 拡張属性.     (line   10)
* getyx() (curses.window のメソッド):    Window objects.     (line  279)
* gid (tarfile.TarInfo の属性):          TarInfo オブジェクト.
                                                             (line  115)
* GIL:                                   用語集<2>.          (line  779)
* gil (sys.flags の属性):                sys --- システム固有のパラメーターと関数.
                                                             (line  581)
* glob() (glob モジュール):              glob --- Unix 形式のパス名のパターン展開.
                                                             (line   29)
* glob() (pathlib.Path のメソッド):      ディレクトリを読む. (line   30)
* Global (ast のクラス):                 関数およびクラス定義.
                                                             (line  144)
* global interpreter lock:               Thread states and the global interpreter lock.
                                                             (line    6)
* global interpreter lock <1>:           用語集<2>.          (line  783)
* global state:                          用語集<2>.          (line  810)
* global_enum() (enum モジュール):       Utilities and decorators.
                                                             (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 のメソッド): Native load/save dialogs.
                                                             (line  121)
* go() (tkinter.simpledialog.SimpleDialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   86)
* got (doctest.DocTestFailure の属性):   デバッグ.           (line  197)
* goto() (turtle モジュール):            Turtle の動き.      (line   74)
* grab_current() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  610)
* grab_release() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  605)
* grab_set_global() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  595)
* grab_set() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line  581)
* grab_status() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  616)
* grantpt() (os モジュール):             ファイル記述子の操作.
                                                             (line  245)
* GREATER (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  245)
* GREATEREQUAL (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  272)
* greedy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  312)
* Grid (tkinter のクラス):               Base and mixin classes.
                                                             (line 1823)
* grid_anchor() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  145)
* grid_bbox() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1896)
* grid_bbox() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  158)
* grid_columnconfigure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1905)
* grid_columnconfigure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  174)
* grid_configure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1829)
* grid_forget() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1881)
* grid_info() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1892)
* grid_location() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1918)
* grid_location() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  222)
* grid_propagate() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1931)
* grid_propagate() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  229)
* grid_remove() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1886)
* grid_rowconfigure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1912)
* grid_rowconfigure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  211)
* grid_size() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1924)
* grid_size() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  240)
* grid_slaves() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1937)
* grid_slaves() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  249)
* grid() (tkinter.Grid のメソッド):      Base and mixin classes.
                                                             (line 1829)
* grid() (tkinter.Wm のメソッド):        Base and mixin classes.
                                                             (line 1412)
* GRND_NONBLOCK (os モジュール):         乱数<2>.            (line   77)
* GRND_RANDOM (os モジュール):           乱数<2>.            (line   90)
* GROOVE (tkinter モジュール):           定数<10>.           (line   55)
* Group (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  451)
* group() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line   23)
* group() (re.Match のメソッド):         Match Objects.      (line   38)
* group() (tkinter.Wm のメソッド):       Base and mixin classes.
                                                             (line 1428)
* groupby() (itertools モジュール):      Itertool関数.       (line  304)
* groupdict() (re.Match のメソッド):     Match Objects.      (line  136)
* groupindex (re.Pattern の属性):        Regular Expression Objects.
                                                             (line  118)
* groups (email.headerregistry.AddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  186)
* groups (re.Pattern の属性):            Regular Expression Objects.
                                                             (line  114)
* groups() (re.Match のメソッド):        Match Objects.      (line  114)
* 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  229)
* Handle (asyncio のクラス):             Callback handles.   (line    6)
* handle_charref() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   91)
* handle_comment() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  100)
* handle_data() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   79)
* handle_decl() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  113)
* handle_defect() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  232)
* handle_endtag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   64)
* handle_entityref() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   84)
* handle_error() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line  136)
* handle_expect_100() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  253)
* handle_one_request() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  247)
* handle_pi() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  121)
* handle_request() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   21)
* handle_request() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   49)
* handle_startendtag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   71)
* handle_starttag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   45)
* handle_timeout() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line  146)
* handle() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  240)
* handle() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   85)
* handle() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   73)
* 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 のクラス):            モジュールの内容<3>.
                                                             (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  196)
* 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   98)
* HAS_ECDH (ssl モジュール):             定数<9>.            (line  400)
* has_extended_color_support() (curses モジュール): 関数<6>. (line  201)
* has_extn() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line   82)
* has_header() (csv.Sniffer のメソッド): モジュールコンテンツ.
                                                             (line  261)
* has_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   96)
* has_ic() (curses モジュール):          関数<6>.            (line  212)
* has_il() (curses モジュール):          関数<6>.            (line  218)
* has_ipv6 (socket モジュール):          定数<8>.            (line  302)
* has_key() (curses モジュール):         関数<6>.            (line  224)
* 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 1076)
* hash_info (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1045)
* hash_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   63)
* hash_randomization (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  561)
* hash-based pyc:                        用語集<2>.          (line  818)
* hash.block_size (hashlib モジュール):  Hash Objects.       (line   13)
* hash.digest_size (hashlib モジュール): Hash Objects.       (line    9)
* hashable:                              辞書表示.           (line   37)
* hashable <1>:                          用語集<2>.          (line  825)
* 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   57)
* header_encode_lines() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  128)
* header_encode() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  121)
* header_encoding (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   58)
* header_factory (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  405)
* header_fetch_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  590)
* header_fetch_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  455)
* header_fetch_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  316)
* header_items() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  127)
* header_max_count() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  432)
* header_max_count() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  257)
* header_offset (zipfile.ZipInfo の属性): ZipInfo objects.   (line  147)
* header_source_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  578)
* header_source_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  438)
* header_source_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  278)
* header_store_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  586)
* header_store_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  446)
* header_store_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  300)
* 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  294)
* headers (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   57)
* headers (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  157)
* 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  107)
* 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)
* height (tkinter.Event の属性):         Other classes.      (line   29)
* height() (tkinter.Image のメソッド):   Image classes.      (line   27)
* 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  139)
* hex() (bytearray のメソッド):          bytearray オブジェクト.
                                                             (line   58)
* hex() (bytes のメソッド):              バイトオブジェクト. (line   83)
* hex() (float のメソッド):              浮動小数点数に対する追加のメソッド.
                                                             (line   44)
* hex() (memoryview のメソッド):         メモリビュー.       (line  196)
* 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  117)
* hexversion (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1094)
* HIDDEN (tkinter モジュール):           定数<10>.           (line  106)
* hidden() (curses.panel.Panel のメソッド): Panel objects.   (line   25)
* hide_cookie2 (http.cookiejar.CookiePolicy の属性): CookiePolicy オブジェクト.
                                                             (line   78)
* hide() (curses.panel.Panel のメソッド): Panel objects.     (line   30)
* hide() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   28)
* 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  121)
* 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 objects.     (line  284)
* 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<50>.        (line   15)
* HOME <3>:                              Windows<50>.        (line   18)
* HOME <4>:                              os path --- 一般的なパス名操作.
                                                             (line  149)
* HOME <5>:                              os path --- 一般的なパス名操作.
                                                             (line  167)
* HOME <6>:                              Toplevel widgets.   (line   61)
* 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  193)
* hook_encoded() (fileinput モジュール): fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  213)
* hooks;import:                          インポートフック.   (line    6)
* hooks;meta:                            インポートフック.   (line    6)
* hooks;パス:                            インポートフック.   (line    6)
* HORIZONTAL (tkinter モジュール):       定数<10>.           (line   65)
* 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 contexts.
                                                             (line  610)
* hosts (netrc.netrc の属性):            netrc オブジェクト. (line   25)
* hosts() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  136)
* hosts() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  333)
* hour (datetime.datetime の属性):       datetime objects.   (line  321)
* hour (datetime.time の属性):           time objects.       (line   50)
* HRESULT (ctypes のクラス):             基本データ型<2>.    (line  263)
* 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  522)
* 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   66)
* http_open() (urllib.request.HTTPHandler のメソッド): HTTPHandler オブジェクト.
                                                             (line    6)
* HTTP_PORT (http.client モジュール):    http client --- HTTP プロトコルクライアント.
                                                             (line  205)
* 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  135)
* 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  209)
* 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 1461)
* I/O control;buffering <1>:             socket オブジェクト.
                                                             (line  278)
* iadd() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   34)
* iand() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   39)
* iconbitmap() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1438)
* iconcat() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   44)
* iconify() (tkinter.Wm のメソッド):     Base and mixin classes.
                                                             (line 1449)
* iconmask() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1456)
* iconname() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1466)
* iconphoto() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1474)
* iconposition() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1489)
* iconwindow() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1498)
* icursor() (tkinter.Canvas のメソッド): Widget classes.     (line  609)
* icursor() (tkinter.Entry のメソッド):  Widget classes.     (line  771)
* icursor() (tkinter.Spinbox のメソッド): Widget classes.    (line 1664)
* id (concurrent.interpreters.Interpreter の属性): Interpreter objects.
                                                             (line   13)
* id (concurrent.interpreters.Queue の属性): Communicating Between Interpreters.
                                                             (line   16)
* id (ssl.SSLSession の属性):            SSL セッション.     (line   12)
* id() (unittest.TestCase のメソッド):   テストクラス.       (line  813)
* idcok() (curses.window のメソッド):    Window objects.     (line  293)
* ident (select.kevent の属性):          Kevent objects.     (line    8)
* ident (threading.Thread の属性):       Thread objects.     (line  206)
* identchars (cmd.Cmd の属性):           Cmdオブジェクト.    (line  131)
* identify_column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  153)
* identify_element() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  182)
* identify_region() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  160)
* identify_row() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  149)
* identify() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1422)
* identify() (tkinter.Scale のメソッド): Widget classes.     (line 1558)
* identify() (tkinter.Scrollbar のメソッド): Widget classes. (line 1615)
* identify() (tkinter.Spinbox のメソッド): Widget classes.   (line 1686)
* identify() (tkinter.ttk.Entry のメソッド): Additional widgets.
                                                             (line   51)
* identify() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   36)
* identify() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  139)
* identify() (tkinter.ttk.Widget のメソッド): ttk Widget.    (line   12)
* IDLE:                                  IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* IDLE <1>:                              用語集<2>.          (line  844)
* 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<38>.           (line  176)
* IDLESTARTUP <1>:                       IDLE<42>.           (line    9)
* IDLESTARTUP <2>:                       IDLE<48>.           (line    9)
* IDLESTARTUP <3>:                       Startup and Code Execution.
                                                             (line    6)
* IDLESTARTUP <4>:                       コマンドラインでの使用<5>.
                                                             (line   41)
* idlok() (curses.window のメソッド):    Window objects.     (line  300)
* 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:                  Displays for lists sets and dictionaries.
                                                             (line   14)
* IfExp (ast のクラス):                  式 expression<2>.   (line  159)
* ifloordiv() (operator モジュール):     インプレース in-place 演算子.
                                                             (line   50)
* iglob() (glob モジュール):             glob --- Unix 形式のパス名のパターン展開.
                                                             (line   87)
* ignorableWhitespace() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  142)
* ignore (bdb.Breakpoint の属性):        bdb --- デバッガーフレームワーク.
                                                             (line  117)
* ignore (pdb command):                  Debugger commands.  (line  152)
* IGNORE (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  156)
* ignore_environment (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  549)
* 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  510)
* IllegalWeekdayError:                   calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  524)
* ilshift() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   55)
* imag (numbers.Complex の属性):         数値塔.             (line   19)
* imag (sys.hash_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line 1067)
* Image (tkinter のクラス):              Image classes.      (line    6)
* image_cget() (tkinter.Text のメソッド): Widget classes.    (line 2171)
* image_configure() (tkinter.Text のメソッド): Widget classes.
                                                             (line 2176)
* image_create() (tkinter.Text のメソッド): Widget classes.  (line 2163)
* image_names() (tkinter モジュール):    Module-level functions.
                                                             (line   50)
* image_names() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  131)
* image_names() (tkinter.Text のメソッド): Widget classes.   (line 2182)
* image_types() (tkinter モジュール):    Module-level functions.
                                                             (line   55)
* image_types() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  140)
* 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 objects.     (line  305)
* immutable:                             用語集<2>.          (line  864)
* immutable;object:                      リテラル<2>.        (line   31)
* immutable;object <1>:                  辞書表示.           (line   37)
* 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 1116)
* Import (ast のクラス):                 インポート.         (line    6)
* import hooks:                          インポートフック.   (line    6)
* import machinery:                      インポートシステム. (line    6)
* import path:                           用語集<2>.          (line  875)
* 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  887)
* ImportError:                           具象例外.           (line   51)
* ImportFrom (ast のクラス):             インポート.         (line   20)
* importing:                             用語集<2>.          (line  882)
* ImportWarning:                         警告.               (line   59)
* ImproperConnectionState:               http client --- HTTP プロトコルクライアント.
                                                             (line  166)
* 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 objects.     (line  313)
* 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  162)
* 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   88)
* IncrementalEncoder (codecs のクラス):  IncrementalEncoder オブジェクト.
                                                             (line   11)
* incrementalencoder (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   88)
* 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  348)
* index:                                 用語集<2>.          (line  892)
* index (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   36)
* index (inspect.Traceback の属性):      インタープリタスタック.
                                                             (line   76)
* index() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  210)
* index() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  156)
* index() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  156)
* index() (collections.abc.ByteString のメソッド): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   84)
* index() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   72)
* index() (memoryview のメソッド):       メモリビュー.       (line  390)
* index() (multiprocessing.shared_memory.ShareableList のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  335)
* index() (operator モジュール):         operator --- 関数形式の標準演算子.
                                                             (line  103)
* index() (sequence のメソッド):         共通のシーケンス演算.
                                                             (line  171)
* index() (str のメソッド):              文字列メソッド<2>.  (line  231)
* index() (tkinter.Canvas のメソッド):   Widget classes.     (line  617)
* index() (tkinter.Entry のメソッド):    Widget classes.     (line  776)
* index() (tkinter.Listbox のメソッド):  Widget classes.     (line  928)
* index() (tkinter.Menu のメソッド):     Widget classes.     (line 1262)
* index() (tkinter.Spinbox のメソッド):  Widget classes.     (line 1669)
* index() (tkinter.Text のメソッド):     Widget classes.     (line 1861)
* index() (tkinter.ttk.Notebook のメソッド): ttk Notebook.   (line   41)
* index() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  188)
* 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 1059)
* infile (shlex.shlex の属性):           shlex オブジェクト. (line  139)
* Infinity:                              組み込み関数.       (line  715)
* infj (cmath モジュール):               定数<3>.            (line   26)
* INFO (logging モジュール):             ロギングレベル.     (line   29)
* info (pathlib.Path の属性):            ファイルの種類とステータスを問い合わせる.
                                                             (line  173)
* INFO (tkinter.messagebox モジュール):  tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  199)
* info_patchlevel() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1174)
* 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() (tkinter.Grid のメソッド):      Base and mixin classes.
                                                             (line 1892)
* info() (tkinter.Pack のメソッド):      Base and mixin classes.
                                                             (line 1730)
* info() (tkinter.Place のメソッド):     Base and mixin classes.
                                                             (line 1814)
* info() (urllib.response.addinfourl のメソッド): urllib response --- Response classes used by urllib.
                                                             (line   35)
* infolist() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  127)
* inheritance:                           クラス定義.         (line    6)
* ini ファイル:                          configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* init_color() (curses モジュール):      関数<6>.            (line  237)
* init_pair() (curses モジュール):       関数<6>.            (line  247)
* init() (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   96)
* inited (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  135)
* initgroups() (os モジュール):          プロセスのパラメーター.
                                                             (line  359)
* initial_indent (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  211)
* initialize() (tkinter.BooleanVar のメソッド): Variable classes.
                                                             (line  151)
* initialize() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   37)
* initproc (C type):                     Slot Type typedefs. (line   38)
* initscr() (curses モジュール):         関数<6>.            (line  261)
* InitVar (dataclasses のクラス):        モジュールの内容<5>.
                                                             (line  338)
* inode() (os.DirEntry のメソッド):      ファイルとディレクトリ.
                                                             (line  986)
* input_charset (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   51)
* input_codec (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   82)
* 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  272)
* insch() (curses.window のメソッド):    Window objects.     (line  321)
* insdelln() (curses.window のメソッド): Window objects.     (line  331)
* INSERT (tkinter モジュール):           定数<10>.           (line   87)
* insert_cascade() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1213)
* insert_checkbutton() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1218)
* insert_command() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1223)
* insert_radiobutton() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1228)
* insert_separator() (tkinter.Menu のメソッド): Widget classes.
                                                             (line 1233)
* insert_text() (readline モジュール):   行バッファ.         (line   13)
* insert() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  221)
* insert() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   80)
* insert() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   98)
* insert() (tkinter.Canvas のメソッド):  Widget classes.     (line  376)
* insert() (tkinter.Entry のメソッド):   Widget classes.     (line  767)
* insert() (tkinter.Listbox のメソッド): Widget classes.     (line  902)
* insert() (tkinter.Menu のメソッド):    Widget classes.     (line 1202)
* insert() (tkinter.Spinbox のメソッド): Widget classes.     (line 1652)
* insert() (tkinter.Text のメソッド):    Widget classes.     (line 1826)
* insert() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   46)
* insert() (tkinter.ttk.Panedwindow のメソッド): Additional widgets.
                                                             (line  124)
* insert() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line  192)
* insert() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  125)
* insertBefore() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  120)
* insertln() (curses.window のメソッド): Window objects.     (line  339)
* INSIDE (tkinter モジュール):           定数<10>.           (line   81)
* insnstr() (curses.window のメソッド):  Window objects.     (line  344)
* insort_left() (bisect モジュール):     bisect --- 配列二分法アルゴリズム.
                                                             (line   69)
* insort_right() (bisect モジュール):    bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* insort() (bisect モジュール):          bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* inspect (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  528)
* inspect コマンドラインオプション; -details: コマンドライン・インターフェース<10>.
                                                             (line   13)
* InspectLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  203)
* insstr() (curses.window のメソッド):   Window objects.     (line  354)
* 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  152)
* instate() (tkinter.ttk.Widget のメソッド): ttk Widget.     (line   19)
* instr() (curses.window のメソッド):    Window objects.     (line  363)
* 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  143)
* int (組み込みクラス):                  組み込み関数.       (line  941)
* int_info (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1169)
* int_max_str_digits (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  574)
* 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  405)
* interact (pdb command):                Debugger commands.  (line  357)
* interact() (code モジュール):          code --- インタープリター基底クラス.
                                                             (line   42)
* interact() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   10)
* interactive:                           用語集<2>.          (line  905)
* Interactive (ast のクラス):            Root nodes.         (line   37)
* interactive (sys.flags の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line  531)
* InteractiveConsole (code のクラス):    code --- インタープリター基底クラス.
                                                             (line   30)
* InteractiveInterpreter (code のクラス): code --- インタープリター基底クラス.
                                                             (line   15)
* InterfaceError:                        例外<7>.            (line   36)
* intern() (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1214)
* 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   91)
* interpolated string literal <1>:       Raw string literals.
                                                             (line   25)
* interpolated string literal <2>:       文字列メソッド<2>.  (line  978)
* Interpolation (ast のクラス):          リテラル<3>.        (line   99)
* 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  915)
* Interpreter (concurrent.interpreters のクラス): Interpreter objects.
                                                             (line    6)
* interpreter lock:                      Thread states and the global interpreter lock.
                                                             (line    6)
* interpreter prompts:                   sys --- システム固有のパラメーターと関数.
                                                             (line 1597)
* interpreter shutdown:                  用語集<2>.          (line  925)
* 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   50)
* interrupt() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  204)
* interrupt() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  347)
* InterruptedError:                      OS 例外.            (line   73)
* intersection_update() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  177)
* intersection() (frozenset のメソッド): set（集合）型 --- set frozenset.
                                                             (line  104)
* intersection() (set のメソッド):       set（集合）型 --- set frozenset.
                                                             (line  104)
* IntFlag (enum のクラス):               データ型<2>.        (line  586)
* intrflush() (curses モジュール):       関数<6>.            (line  269)
* intro (cmd.Cmd の属性):                Cmdオブジェクト.    (line  146)
* IntVar (tkinter のクラス):             Variable classes.   (line  115)
* 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  144)
* InvalidWriteError:                     例外<9>.            (line   83)
* Invert (ast のクラス):                 式 expression<2>.   (line   28)
* invert() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  111)
* invoke() (tkinter.Button のメソッド):  Widget classes.     (line   17)
* invoke() (tkinter.Checkbutton のメソッド): Widget classes. (line  700)
* invoke() (tkinter.Menu のメソッド):    Widget classes.     (line 1280)
* invoke() (tkinter.Radiobutton のメソッド): Widget classes. (line 1495)
* invoke() (tkinter.Spinbox のメソッド): Widget classes.     (line 1692)
* invoke() (tkinter.ttk.Button のメソッド): Additional widgets.
                                                             (line   17)
* invoke() (tkinter.ttk.Checkbutton のメソッド): Additional widgets.
                                                             (line   29)
* invoke() (tkinter.ttk.Radiobutton のメソッド): Additional widgets.
                                                             (line  168)
* 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  245)
* IOError:                               具象例外.           (line  493)
* 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   36)
* 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  232)
* is_android (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line   40)
* is_annotated() (symtable.Symbol のメソッド): 記号表の検査. (line  238)
* 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  269)
* 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  140)
* is_blocked() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   59)
* is_canonical() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  324)
* is_canonical() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  283)
* is_char_device() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  147)
* 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  281)
* is_comp_iter() (symtable.Symbol のメソッド): 記号表の検査. (line  274)
* is_dataclass() (dataclasses モジュール): モジュールの内容<5>.
                                                             (line  488)
* is_declared_global() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  229)
* is_dir() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  106)
* is_dir() (os.DirEntry のメソッド):     ファイルとディレクトリ.
                                                             (line  997)
* is_dir() (pathlib.Path のメソッド):    ファイルの種類とステータスを問い合わせる.
                                                             (line   80)
* 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  133)
* is_file() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  110)
* is_file() (os.DirEntry のメソッド):    ファイルとディレクトリ.
                                                             (line 1028)
* is_file() (pathlib.Path のメソッド):   ファイルの種類とステータスを問い合わせる.
                                                             (line   67)
* is_file() (pathlib.types.PathInfo のメソッド): プロトコル. (line   36)
* is_file() (zipfile.Path のメソッド):   Path objects.       (line   61)
* is_finalized() (gc モジュール):        gc --- ガベージコレクターインターフェース.
                                                             (line  199)
* is_finalizing() (sys モジュール):      sys --- システム固有のパラメーターと関数.
                                                             (line 1239)
* is_finite() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  329)
* is_finite() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  290)
* is_free_class() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  249)
* is_free() (symtable.Symbol のメソッド): 記号表の検査.      (line  244)
* is_global (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  136)
* is_global (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  279)
* is_global() (symtable.Symbol のメソッド): 記号表の検査.    (line  221)
* is_hop_by_hop() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line  112)
* is_imported() (symtable.Symbol のメソッド): 記号表の検査.  (line  207)
* is_infinite() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  334)
* is_infinite() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  295)
* is_integer() (float のメソッド):       浮動小数点数に対する追加のメソッド.
                                                             (line   30)
* is_integer() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  129)
* is_integer() (int のメソッド):         整数型における追加のメソッド.
                                                             (line  156)
* is_junction() (os.DirEntry のメソッド): ファイルとディレクトリ.
                                                             (line 1064)
* is_junction() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  102)
* 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 objects.
                                                             (line  377)
* 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  234)
* 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  110)
* 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  288)
* is_nan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  339)
* is_nan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  300)
* is_nested() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   95)
* is_none() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   69)
* is_nonlocal() (symtable.Symbol のメソッド): 記号表の検査.  (line  225)
* is_normal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  344)
* is_normal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  305)
* 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  234)
* is_package() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  418)
* 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  211)
* 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  130)
* is_python_build() (sysconfig モジュール): その他の関数<3>. (line   46)
* is_qnan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  349)
* is_qnan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  311)
* is_reading() (asyncio.ReadTransport のメソッド): 読み出し専用のトランスポート.
                                                             (line    6)
* is_referenced() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  203)
* 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  135)
* 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   25)
* is_safe (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  164)
* is_serving() (asyncio.Server のメソッド): Server objects.  (line  118)
* is_set() (asyncio.Event のメソッド):   Event.              (line   66)
* is_set() (threading.Event のメソッド): Event objects.      (line   25)
* is_signed() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  354)
* is_signed() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  316)
* is_site_local (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  291)
* is_site_local (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  359)
* is_skipped_module() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  267)
* is_snan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  359)
* is_snan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  322)
* is_socket() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  126)
* is_stack_trampoline_active() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1883)
* is_subnormal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  364)
* is_subnormal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  327)
* is_symlink() (os.DirEntry のメソッド): ファイルとディレクトリ.
                                                             (line 1044)
* is_symlink() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line   94)
* 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  275)
* is_tracing() (tracemalloc モジュール): 関数<11>.           (line   60)
* is_tracked() (gc モジュール):          gc --- ガベージコレクターインターフェース.
                                                             (line  175)
* is_type_parameter() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  215)
* is_typeddict() (typing モジュール):    Introspection helpers.
                                                             (line  154)
* 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 objects.
                                                             (line  384)
* is_zero() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  369)
* is_zero() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  332)
* is_zipfile() (zipfile モジュール):     zipfile --- ZIP アーカイブの処理.
                                                             (line   95)
* isabs() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  218)
* isabstract() (inspect モジュール):     型とメンバー.       (line  616)
* 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  247)
* isalpha() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  524)
* isalpha() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  524)
* isalpha() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  138)
* isalpha() (str のメソッド):            文字列メソッド<2>.  (line  264)
* isascii() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  540)
* isascii() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  540)
* isascii() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  143)
* isascii() (str のメソッド):            文字列メソッド<2>.  (line  284)
* isasyncgen() (inspect モジュール):     型とメンバー.       (line  575)
* isasyncgenfunction() (inspect モジュール): 型とメンバー.   (line  554)
* isatty() (io.IOBase のメソッド):       I/O 基底クラス.     (line   72)
* isatty() (os モジュール):              ファイル記述子の操作.
                                                             (line  257)
* isawaitable() (inspect モジュール):    型とメンバー.       (line  533)
* isblank() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  147)
* isblk() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  211)
* isbuiltin() (inspect モジュール):      型とメンバー.       (line  595)
* ischr() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  207)
* isclass() (inspect モジュール):        型とメンバー.       (line  409)
* isclose() (cmath モジュール):          類別関数.           (line   23)
* isclose() (math モジュール):           Floating point manipulation functions.
                                                             (line   25)
* iscntrl() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  151)
* iscode() (inspect モジュール):         型とメンバー.       (line  591)
* iscoroutine() (asyncio モジュール):    イントロスペクション.
                                                             (line   26)
* iscoroutine() (inspect モジュール):    型とメンバー.       (line  526)
* iscoroutinefunction() (inspect モジュール): 型とメンバー.  (line  488)
* isctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  192)
* isDaemon() (threading.Thread のメソッド): Thread objects.  (line  254)
* isdatadescriptor() (inspect モジュール): 型とメンバー.     (line  646)
* isdecimal() (str のメソッド):          文字列メソッド<2>.  (line  297)
* 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  313)
* isdir() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  245)
* isdir() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  195)
* isdisjoint() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line   66)
* isdisjoint() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line   66)
* 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  280)
* 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  587)
* isfunction() (inspect モジュール):     型とメンバー.       (line  455)
* isfuture() (asyncio モジュール):       Future の関数.      (line    6)
* isgenerator() (inspect モジュール):    型とメンバー.       (line  484)
* isgeneratorfunction() (inspect モジュール): 型とメンバー.  (line  468)
* isgetsetdescriptor() (inspect モジュール): 型とメンバー.   (line  660)
* isgraph() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  161)
* isidentifier() (str のメソッド):       文字列メソッド<2>.  (line  336)
* 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  357)
* 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  354)
* ismemberdescriptor() (inspect モジュール): 型とメンバー.   (line  668)
* ismeta() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  198)
* ismethod() (inspect モジュール):       型とメンバー.       (line  417)
* ismethoddescriptor() (inspect モジュール): 型とメンバー.   (line  620)
* ismethodwrapper() (inspect モジュール): 型とメンバー.      (line  600)
* ismodule() (inspect モジュール):       型とメンバー.       (line  405)
* 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  360)
* 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  534)
* IsolatedAsyncioTestCase (unittest のクラス): テストクラス. (line  909)
* isolation_level (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  791)
* isoweekday() (datetime.date のメソッド): date objects.     (line  265)
* isoweekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  648)
* ispackage() (inspect モジュール):      型とメンバー.       (line  462)
* isprint() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  169)
* isprintable() (str のメソッド):        文字列メソッド<2>.  (line  381)
* ispunct() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  173)
* isqrt() (math モジュール):             Number-theoretic functions.
                                                             (line   43)
* isreadable() (pprint モジュール):      関数<4>.            (line   82)
* isreadable() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   65)
* isrecursive() (pprint モジュール):     関数<4>.            (line   91)
* 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  611)
* 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  178)
* isspace() (str のメソッド):            文字列メソッド<2>.  (line  407)
* isstdin() (fileinput モジュール):      fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  113)
* issubset() (frozenset のメソッド):     set（集合）型 --- set frozenset.
                                                             (line   73)
* issubset() (set のメソッド):           set（集合）型 --- set frozenset.
                                                             (line   73)
* issuperset() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line   85)
* issuperset() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line   85)
* 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  430)
* istraceback() (inspect モジュール):    型とメンバー.       (line  583)
* 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  183)
* isupper() (str のメソッド):            文字列メソッド<2>.  (line  448)
* isvisible() (turtle モジュール):       可視性.             (line   22)
* isxdigit() (curses.ascii モジュール):  curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  187)
* ITALIC (tkinter.font モジュール):      tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* item() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  208)
* item() (xml.dom.NamedNodeMap のメソッド): NamedNodeMap Objects.
                                                             (line   12)
* item() (xml.dom.NodeList のメソッド):  NodeList オブジェクト.
                                                             (line   16)
* itemcget() (tkinter.Canvas のメソッド): Widget classes.    (line  383)
* itemcget() (tkinter.Listbox のメソッド): Widget classes.   (line 1009)
* itemconfig() (tkinter.Canvas のメソッド): Widget classes.  (line  390)
* itemconfig() (tkinter.Listbox のメソッド): Widget classes. (line 1014)
* itemconfigure() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  390)
* itemconfigure() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line 1014)
* itemgetter() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  277)
* items() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  262)
* items() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  142)
* items() (dict のメソッド):             Mapping Types --- dict.
                                                             (line  188)
* items() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  241)
* items() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  350)
* items() (mailbox.Mailbox のメソッド):  Mailbox オブジェクト.
                                                             (line  140)
* items() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  274)
* items() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   67)
* itemsize (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  128)
* itemsize (memoryview の属性):          メモリビュー.       (line  467)
* 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  131)
* iter() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   39)
* iterable:                              用語集<2>.          (line  939)
* Iterable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   26)
* Iterable (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line    6)
* iterable;unpacking:                    式のリスト.         (line   17)
* iterator:                              用語集<2>.          (line  961)
* Iterator (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   43)
* Iterator (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line   14)
* iterdecode() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  249)
* 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  236)
* iterencode() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  231)
* iterfind() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  142)
* 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  151)
* itervalues() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  115)
* iterweekdays() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   59)
* ITIMER_PROF (signal モジュール):       モジュールの内容<3>.
                                                             (line  253)
* ITIMER_REAL (signal モジュール):       モジュールの内容<3>.
                                                             (line  243)
* ITIMER_VIRTUAL (signal モジュール):    モジュールの内容<3>.
                                                             (line  248)
* ItimerError:                           モジュールの内容<3>.
                                                             (line  284)
* 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  482)
* java_ver() (platform モジュール):      Java platform.      (line    6)
* Java;言語:                             numbers Real float 実数.
                                                             (line    6)
* job_size (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  232)
* join_thread() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  187)
* 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  280)
* 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  463)
* join() (threading.Thread のメソッド):  Thread objects.     (line  150)
* JoinableQueue (multiprocessing のクラス): パイプ Pipe とキュー Queue.
                                                             (line  255)
* JoinedStr (ast のクラス):              リテラル<3>.        (line   49)
* 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  482)
* JUMP (monitoring event):               Events.             (line   43)
* JUMP (opcode):                         Python バイトコード命令.
                                                             (line 1488)
* jump (pdb command):                    Debugger commands.  (line  235)
* 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  482)
* kbhit() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line    6)
* kde_random() (statistics モジュール):  関数の詳細.         (line  179)
* kde() (statistics モジュール):         関数の詳細.         (line  131)
* KEEP (enum.FlagBoundary の属性):       データ型<2>.        (line  760)
* kevent() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  112)
* key (http.cookies.Morsel の属性):      Morselオブジェクト. (line   71)
* key (zoneinfo.ZoneInfo の属性):        ZoneInfo クラス.    (line   78)
* key function:                          用語集<2>.          (line  991)
* 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   51)
* KeyboardInterrupt (組み込み例外) <2>:  シグナルハンドリング<2>.
                                                             (line   61)
* keycode (tkinter.Event の属性):        Other classes.      (line   35)
* KeyError:                              具象例外.           (line   85)
* keylog_filename (ssl.SSLContext の属性): SSL contexts.     (line  525)
* keyname() (curses モジュール):         関数<6>.            (line  285)
* keypad() (curses.window のメソッド):   Window objects.     (line  390)
* keyrefs() (weakref.WeakKeyDictionary のメソッド): weakref --- Weak references.
                                                             (line  204)
* keys() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  133)
* keys() (dict のメソッド):              Mapping Types --- dict.
                                                             (line  193)
* keys() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  232)
* keys() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  341)
* keys() (mailbox.Mailbox のメソッド):   Mailbox オブジェクト.
                                                             (line  110)
* keys() (sqlite3.Row のメソッド):       Row オブジェクト.   (line   20)
* keys() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line   38)
* keys() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  279)
* keys() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   72)
* KeysView (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* KeysView (typing のクラス):            Aliases to container ABCs in collections abc.
                                                             (line   64)
* keysym (tkinter.Event の属性):         Other classes.      (line   67)
* keysym_num (tkinter.Event の属性):     Other classes.      (line   71)
* keyword (ast のクラス):                式 expression<2>.   (line  153)
* keyword argument:                      用語集<2>.          (line 1014)
* 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  109)
* kill() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line  108)
* kill() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   35)
* kill() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  241)
* kill() (os モジュール):                プロセス管理.       (line  323)
* kill() (subprocess.Popen のメソッド):  Popen オブジェクト. (line  101)
* killchar() (curses モジュール):        関数<6>.            (line  297)
* killpg() (os モジュール):              プロセス管理.       (line  345)
* kind (inspect.Parameter の属性):       Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  254)
* knownfiles (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  140)
* kqueue() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  101)
* KqueueSelector (selectors のクラス):   クラス<4>.          (line  198)
* KW_ONLY (dataclasses モジュール):      モジュールの内容<5>.
                                                             (line  506)
* 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)
* Label (tkinter のクラス):              Widget classes.     (line  856)
* Label (tkinter.ttk のクラス):          Additional widgets. (line   69)
* LabeledScale (tkinter.ttk のクラス):   Additional widgets. (line  220)
* LabelFrame (tkinter のクラス):         Widget classes.     (line  866)
* Labelframe (tkinter.ttk のクラス):     Additional widgets. (line   75)
* LabelFrame (tkinter.ttk のクラス):     Additional widgets. (line  233)
* lambda:                                用語集<2>.          (line 1017)
* 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 (tkinter モジュール):             定数<10>.           (line  146)
* last_accepted (multiprocessing.connection.Listener の属性): リスナーとクライアント.
                                                             (line  104)
* last_exc (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1304)
* last_mode (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  148)
* last_traceback (sys モジュール):       トレースバック traceback オブジェクト.
                                                             (line    6)
* last_traceback (sys モジュール) <1>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1343)
* last_type (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1343)
* last_value (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1343)
* lastChild (xml.dom.Node の属性):       Node オブジェクト.  (line   58)
* lastcmd (cmd.Cmd の属性):              Cmdオブジェクト.    (line  135)
* lastgroup (re.Match の属性):           Match Objects.      (line  197)
* lastindex (re.Match の属性):           Match Objects.      (line  189)
* lastResort (logging モジュール):       モジュールレベル属性.
                                                             (line    6)
* lastrowid (sqlite3.Cursor の属性):     Cursor オブジェクト.
                                                             (line  205)
* layout() (tkinter.ttk.Style のメソッド): Ttk styling.      (line  104)
* lazy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  314)
* lazy2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  316)
* 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 1023)
* LC_ALL:                                GNU gettext API.    (line   20)
* LC_ALL <1>:                            クラス形式の API.   (line   25)
* LC_ALL (locale モジュール):            locale --- 国際化サービス.
                                                             (line  567)
* LC_COLLATE (locale モジュール):        locale --- 国際化サービス.
                                                             (line  532)
* LC_CTYPE (locale モジュール):          locale --- 国際化サービス.
                                                             (line  518)
* LC_MESSAGES:                           GNU gettext API.    (line   20)
* LC_MESSAGES <1>:                       クラス形式の API.   (line   25)
* LC_MESSAGES (locale モジュール):       locale --- 国際化サービス.
                                                             (line  548)
* LC_MONETARY (locale モジュール):       locale --- 国際化サービス.
                                                             (line  543)
* LC_NUMERIC (locale モジュール):        locale --- 国際化サービス.
                                                             (line  559)
* LC_TIME (locale モジュール):           locale --- 国際化サービス.
                                                             (line  538)
* lchflags() (os モジュール):            ファイルとディレクトリ.
                                                             (line  315)
* lchmod() (os モジュール):              ファイルとディレクトリ.
                                                             (line  329)
* lchmod() (pathlib.Path のメソッド):    パーミッションと所有者.
                                                             (line   60)
* lchown() (os モジュール):              ファイルとディレクトリ.
                                                             (line  351)
* lcm() (math モジュール):               Number-theoretic functions.
                                                             (line   56)
* 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  161)
* ldm_hash_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  146)
* ldm_hash_rate_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  169)
* ldm_min_match (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  154)
* le() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* leapdays() (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  362)
* leaveok() (curses.window のメソッド):  Window objects.     (line  397)
* left (filecmp.dircmp の属性):          dircmp クラス.      (line   44)
* LEFT (tkinter モジュール):             定数<10>.           (line   39)
* 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 1038)
* 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   33)
* 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  186)
* license (組み込み変数):                site モジュールで追加される定数.
                                                             (line   32)
* LifoQueue (asyncio のクラス):          LIFO キュー.        (line    6)
* LifoQueue (queue のクラス):            queue --- 同期キュークラス.
                                                             (line   39)
* lift() (tkinter.Canvas のメソッド):    Widget classes.     (line  515)
* lift() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  113)
* light-weight processes:                _thread --- 低水準なスレッド API.
                                                             (line    6)
* limit_denominator() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  164)
* 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 1461)
* 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  315)
* lineno (tomllib.TOMLDecodeError の属性): tomllib --- TOML ファイルの解析.
                                                             (line   82)
* 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  144)
* LINES <1>:                             関数<6>.            (line  634)
* LINES <2>:                             関数<6>.            (line  636)
* LINES (curses モジュール):             定数<6>.            (line   51)
* lines (os.terminal_size の属性):       ターミナルのサイズの問い合わせ.
                                                             (line   33)
* linesep (email.policy.Policy の属性):  email policy Policy Objects.
                                                             (line  151)
* linesep (os モジュール):               雑多なシステム情報. (line  147)
* lineterminator (csv.Dialect の属性):   Dialect クラスと書式化パラメータ.
                                                             (line   55)
* LineTooLong:                           http client --- HTTP プロトコルクライアント.
                                                             (line  187)
* 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 1042)
* List (ast のクラス):                   リテラル<3>.        (line  136)
* list (pdb command):                    Debugger commands.  (line  244)
* List (typing のクラス):                Aliases to built-in types.
                                                             (line   18)
* list (組み込みクラス):                 リスト型 list<2>.   (line   10)
* list comprehension:                    用語集<2>.          (line 1048)
* list_all() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line    8)
* LIST_APPEND (opcode):                  Python バイトコード命令.
                                                             (line  380)
* list_dialects() (csv モジュール):      モジュールコンテンツ.
                                                             (line  100)
* 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)
* Listbox (tkinter のクラス):            Widget classes.     (line  876)
* ListComp (ast のクラス):               内包表記 Comprehension.
                                                             (line    6)
* listdir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  389)
* listdrives() (os モジュール):          ファイルとディレクトリ.
                                                             (line  425)
* listen() (logging.config モジュール):  環境設定のための関数.
                                                             (line  115)
* listen() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  263)
* listen() (turtle モジュール):          スクリーンイベントを利用する.
                                                             (line    6)
* listener (logging.handlers.QueueHandler の属性): QueueHandler.
                                                             (line   95)
* Listener (multiprocessing.connection のクラス): リスナーとクライアント.
                                                             (line   50)
* listMethods() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   17)
* 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  478)
* 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  259)
* LMTP (smtplib のクラス):               smtplib --- SMTP プロトコルクライアント.
                                                             (line  106)
* ln() (decimal.Context のメソッド):     Context オブジェクト.
                                                             (line  374)
* ln() (decimal.Decimal のメソッド):     Decimal オブジェクト.
                                                             (line  337)
* 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 contexts.
                                                             (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 contexts.
                                                             (line  130)
* LOAD_DEREF (opcode):                   Python バイトコード命令.
                                                             (line 1017)
* load_dh_params() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  350)
* 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  313)
* load_module() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  267)
* 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  407)
* 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 contexts.
                                                             (line  149)
* load() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  132)
* load() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   39)
* load() (json モジュール):              基本的な使い方<4>.  (line  106)
* load() (marshal モジュール):           marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   92)
* load() (pickle モジュール):            モジュールインターフェース.
                                                             (line   62)
* load() (pickle.Unpickler のメソッド):  モジュールインターフェース.
                                                             (line  288)
* load() (plistlib モジュール):          plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   46)
* load() (tomllib モジュール):           tomllib --- TOML ファイルの解析.
                                                             (line   37)
* load() (tracemalloc.Snapshot のクラスメソッド): Snapshot.  (line   51)
* loader:                                ファインダーとローダー.
                                                             (line    6)
* loader <1>:                            用語集<2>.          (line 1084)
* 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 のクラス): Native load/save dialogs.
                                                             (line  149)
* LoadKey() (winreg モジュール):         関数<14>.           (line  255)
* LoadLibrary() (ctypes.LibraryLoader のメソッド): 共有ライブラリをロードする.
                                                             (line  197)
* loads() (json モジュール):             基本的な使い方<4>.  (line  189)
* loads() (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  130)
* loads() (pickle モジュール):           モジュールインターフェース.
                                                             (line   80)
* loads() (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   81)
* loads() (tomllib モジュール):          tomllib --- TOML ファイルの解析.
                                                             (line   54)
* loads() (xmlrpc.client モジュール):    補助関数.           (line   19)
* loadTestsFromModule() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   40)
* loadTestsFromName() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   70)
* loadTestsFromNames() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  100)
* loadTestsFromTestCase() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   29)
* loadtk() (tkinter.Tk のメソッド):      Toplevel widgets.   (line   94)
* 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  328)
* LocaleTextCalendar (calendar のクラス): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  322)
* localize() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  500)
* 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)
* location() (tkinter.Grid のメソッド):  Base and mixin classes.
                                                             (line 1918)
* Locator (xml.sax.xmlreader のクラス):  xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   42)
* lock:                                  用語集<2>.          (line 1057)
* Lock (asyncio のクラス):               Lock.               (line    6)
* Lock (multiprocessing のクラス):       同期プリミティブ.   (line   65)
* lock (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2077)
* Lock (threading のクラス):             Lock objects.       (line   33)
* 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 1072)
* lock, interpreter:                     Thread states and the 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.LockType のメソッド): _thread --- 低水準なスレッド API.
                                                             (line  177)
* locked() (asyncio.Condition のメソッド): Condition.        (line   63)
* locked() (asyncio.Lock のメソッド):    Lock.               (line   60)
* locked() (asyncio.Semaphore のメソッド): Semaphore.        (line   52)
* 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   95)
* locked() (threading.Lock のメソッド):  Lock objects.       (line   91)
* locked() (threading.RLock のメソッド): RLock objects.      (line  111)
* lockf() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  183)
* lockf() (os モジュール):               ファイル記述子の操作.
                                                             (line  263)
* locking() (msvcrt モジュール):         ファイル操作関連.   (line    6)
* LockType (_thread のクラス):           _thread --- 低水準なスレッド API.
                                                             (line  135)
* LOG_ALERT (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_AUTH (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_AUTHPRIV (syslog モジュール):      syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_CONS (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_CRIT (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_CRON (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_DAEMON (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* log_date_time_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  381)
* LOG_DEBUG (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_EMERG (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_ERR (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* log_error() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  351)
* log_exception() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  209)
* LOG_FTP (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_INFO (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_INSTALL (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_KERN (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LAUNCHD (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL0 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL1 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL2 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL3 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL4 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL5 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL6 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LOCAL7 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_LPR (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_MAIL (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* log_message() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  357)
* LOG_NDELAY (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_NETINFO (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_NEWS (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_NOTICE (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* LOG_NOWAIT (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_ODELAY (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_PERROR (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_PID (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  158)
* LOG_RAS (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_REMOTEAUTH (syslog モジュール):    syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* log_request() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  344)
* LOG_SYSLOG (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* log_to_stderr() (multiprocessing モジュール): ログ記録<2>. (line   24)
* LOG_USER (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_UUCP (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  123)
* LOG_WARNING (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  112)
* 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  378)
* log10() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  342)
* 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  382)
* logb() (decimal.Decimal のメソッド):   Decimal オブジェクト.
                                                             (line  347)
* Logger (logging のクラス):             ロガーオブジェクト. (line   23)
* LoggerAdapter (logging のクラス):      LoggerAdapter オブジェクト.
                                                             (line   10)
* logical_and() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  386)
* logical_and() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  355)
* logical_invert() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  390)
* logical_invert() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  361)
* logical_or() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  394)
* logical_or() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  366)
* logical_xor() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  398)
* logical_xor() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  372)
* login_cram_md5() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  219)
* login_tty() (os モジュール):           ファイル記述子の操作.
                                                             (line  289)
* login() (ftplib.FTP のメソッド):       FTP オブジェクト.   (line  127)
* login() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  214)
* login() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line   98)
* LOGNAME:                               プロセスのパラメーター.
                                                             (line  257)
* 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  164)
* LONG_TIMEOUT (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  110)
* longMessage (unittest.TestCase の属性): テストクラス.      (line  764)
* longname() (curses モジュール):        関数<6>.            (line  304)
* lookup_error() (codecs モジュール):    エラーハンドラ.     (line  125)
* lookup() (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line   56)
* lookup() (symtable.SymbolTable のメソッド): 記号表の検査.  (line  110)
* lookup() (tkinter.ttk.Style のメソッド): Ttk styling.      (line   89)
* lookup() (unicodedata モジュール):     unicodedata --- Unicode データベース.
                                                             (line   22)
* LookupError:                           基底クラス.         (line   79)
* loop control;target:                   break 文.           (line   12)
* loop_factory (unittest.IsolatedAsyncioTestCase の属性): テストクラス.
                                                             (line  916)
* 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  495)
* lower() (tkinter.Canvas のメソッド):   Widget classes.     (line  526)
* lower() (tkinter.Misc のメソッド):     Base and mixin classes.
                                                             (line  121)
* LPAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  203)
* lpAttributeList (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   60)
* lru_cache() (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  143)
* lseek() (os モジュール):               ファイル記述子の操作.
                                                             (line  300)
* 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   38)
* lstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  315)
* lstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  315)
* lstrip() (str のメソッド):             文字列メソッド<2>.  (line  506)
* 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 (os.uname_result の属性):      プロセスのパラメーター.
                                                             (line  625)
* 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  226)
* magic method:                          用語集<2>.          (line 1112)
* MAGIC_NUMBER (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   13)
* magic;メソッド:                        用語集<2>.          (line 1116)
* 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  224)
* main() <2>:                            PyConfig.           (line  126)
* main() (site モジュール):              モジュールの内容<6>.
                                                             (line   43)
* main() (unittest モジュール):          テストのロードと起動.
                                                             (line  506)
* mainloop() (tkinter モジュール):       Module-level functions.
                                                             (line   28)
* mainloop() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line  459)
* mainloop() (turtle モジュール):        スクリーンイベントを利用する.
                                                             (line  105)
* maintype (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  271)
* major (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  242)
* major() (os モジュール):               ファイルとディレクトリ.
                                                             (line  641)
* 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 モジュール): モジュールの内容<5>.
                                                             (line  407)
* make_file() (difflib.HtmlDiff のメソッド): difflib --- 差分の計算の補助.
                                                             (line  109)
* MAKE_FUNCTION (opcode):                Python バイトコード命令.
                                                             (line 1149)
* make_header() (email.header モジュール): email header 国際化されたヘッダー.
                                                             (line  212)
* 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  651)
* makedirs() (os モジュール):            ファイルとディレクトリ.
                                                             (line  557)
* makeelement() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  159)
* makefile() (socket のメソッド):        I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* makefile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  275)
* 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  527)
* MalformedHeaderDefect:                 email errors Exception and Defect classes.
                                                             (line  108)
* malloc (C function):                   概要<4>.            (line   33)
* manage() (tkinter.Wm のメソッド):      Base and mixin classes.
                                                             (line 1509)
* manager (logging.LoggerAdapter の属性): LoggerAdapter オブジェクト.
                                                             (line   30)
* mangle_from_ (email.policy.Compat32 の属性): email policy Policy Objects.
                                                             (line  571)
* 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  649)
* 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  372)
* 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 styling.        (line   49)
* mapLogRecord() (logging.handlers.HTTPHandler のメソッド): HTTPHandler.
                                                             (line   26)
* mapping:                               用語集<2>.          (line 1116)
* 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  482)
* mark_gravity() (tkinter.Text のメソッド): Widget classes.  (line 1935)
* mark_names() (tkinter.Text のメソッド): Widget classes.    (line 1930)
* mark_next() (tkinter.Text のメソッド): Widget classes.     (line 1944)
* mark_previous() (tkinter.Text のメソッド): Widget classes. (line 1950)
* mark_set() (tkinter.Text のメソッド):  Widget classes.     (line 1919)
* mark_unset() (tkinter.Text のメソッド): Widget classes.    (line 1925)
* markcoroutinefunction() (inspect モジュール): 型とメンバー.
                                                             (line  510)
* master (tkinter.Tk の属性):            Toplevel widgets.   (line   72)
* Match (ast のクラス):                  Pattern matching.   (line    6)
* Match (re のクラス):                   Match Objects.      (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   47)
* match() (re.Pattern のメソッド):       Regular Expression Objects.
                                                             (line   44)
* 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  296)
* max (datetime.time の属性):            time objects.       (line   37)
* max (datetime.timedelta の属性):       timedelta objects.  (line   95)
* max (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  654)
* MAX (uuid モジュール):                 uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  318)
* max_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  663)
* max_children (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   54)
* 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  658)
* 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  264)
* max_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  406)
* max_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  385)
* 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  304)
* max() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  402)
* max() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  378)
* maxarray (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxdeque (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxdict (reprlib.Repr の属性):         Reprオブジェクト.   (line   21)
* maxDiff (unittest.TestCase の属性):    テストクラス.       (line  782)
* maxfrozenset (reprlib.Repr の属性):    Reprオブジェクト.   (line   21)
* MAXIMUM_SUPPORTED (ssl.TLSVersion の属性): 定数<9>.        (line  572)
* maximum_version (ssl.SSLContext の属性): SSL contexts.     (line  536)
* maxlen (collections.deque の属性):     deque オブジェクト. (line  123)
* 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 1351)
* maxsize() (tkinter.Wm のメソッド):     Base and mixin classes.
                                                             (line 1519)
* maxstring (reprlib.Repr の属性):       Reprオブジェクト.   (line   38)
* maxtuple (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxunicode (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1357)
* MAXYEAR (datetime モジュール):         定数.               (line   13)
* MAY (calendar モジュール):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* 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   73)
* 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  792)
* member() (enum モジュール):            Utilities and decorators.
                                                             (line   81)
* MemberDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  210)
* memfd_create() (os モジュール):        ファイルとディレクトリ.
                                                             (line 1961)
* memmove() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  203)
* MemoryBIO (ssl のクラス):              Memory BIO support. (line  132)
* MemoryError:                           具象例外.           (line  106)
* MemoryHandler (logging.handlers のクラス): MemoryHandler.  (line   42)
* memoryview (組み込みクラス):           メモリビュー.       (line   10)
* memoryview_at() (ctypes モジュール):   ユーティリティー関数.
                                                             (line  298)
* memset() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  209)
* Menu (tkinter のクラス):               Widget classes.     (line 1039)
* Menubutton (tkinter のクラス):         Widget classes.     (line 1320)
* Menubutton (tkinter.ttk のクラス):     Additional widgets. (line   82)
* merge() (heapq モジュール):            heapq --- ヒープキューアルゴリズム.
                                                             (line  140)
* message (BaseExceptionGroup の属性):   例外グループ.       (line   36)
* Message (email.message のクラス):      email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   49)
* Message (mailbox のクラス):            Message オブジェクト.
                                                             (line    6)
* Message (tkinter のクラス):            Widget classes.     (line 1330)
* Message (tkinter.messagebox のクラス): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   24)
* 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  220)
* 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 1126)
* meta_path (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1366)
* meta() (curses モジュール):            関数<6>.            (line  311)
* metaclass:                             メタクラス.         (line    6)
* metaclass <1>:                         用語集<2>.          (line 1135)
* 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  193)
* METH_COEXIST (C macro):                Implementing functions and methods.
                                                             (line  211)
* METH_FASTCALL (C macro):               Implementing functions and methods.
                                                             (line  123)
* METH_KEYWORDS (C macro):               Implementing functions and methods.
                                                             (line  107)
* METH_METHOD (C macro):                 Implementing functions and methods.
                                                             (line  150)
* METH_NOARGS (C macro):                 Implementing functions and methods.
                                                             (line  168)
* METH_O (C macro):                      Implementing functions and methods.
                                                             (line  180)
* METH_STATIC (C macro):                 Implementing functions and methods.
                                                             (line  201)
* METH_VARARGS (C macro):                Implementing functions and methods.
                                                             (line   97)
* method (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   53)
* method resolution order:               用語集<2>.          (line 1158)
* method_calls (unittest.mock.Mock の属性): Mock クラス.     (line  496)
* methodcaller() (operator モジュール):  operator --- 関数形式の標準演算子.
                                                             (line  328)
* MethodDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  108)
* methodHelp() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   39)
* methods (pyclbr.Class の属性):         クラスオブジェクト<2>.
                                                             (line   50)
* methodSignature() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   22)
* 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   80)
* MFD_ALLOW_SEALING (os モジュール):     ファイルとディレクトリ.
                                                             (line 1979)
* MFD_CLOEXEC (os モジュール):           ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_16GB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_16MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_1GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_1MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_256MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_2GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_2MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_32MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_512KB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_512MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_64KB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_8MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_MASK (os モジュール):         ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGE_SHIFT (os モジュール):        ファイルとディレクトリ.
                                                             (line 1979)
* MFD_HUGETLB (os モジュール):           ファイルとディレクトリ.
                                                             (line 1979)
* MH (mailbox のクラス):                 MH オブジェクト.    (line    6)
* MHMessage (mailbox のクラス):          MHMessage オブジェクト.
                                                             (line    6)
* microsecond (datetime.datetime の属性): datetime objects.  (line  333)
* microsecond (datetime.time の属性):    time objects.       (line   62)
* microseconds (datetime.timedelta の属性): timedelta objects.
                                                             (line  131)
* 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  230)
* min (datetime.date の属性):            date objects.       (line  130)
* min (datetime.datetime の属性):        datetime objects.   (line  291)
* min (datetime.time の属性):            time objects.       (line   33)
* min (datetime.timedelta の属性):       timedelta objects.  (line   90)
* min (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  668)
* min_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  681)
* MIN_EMIN (decimal モジュール):         定数<4>.            (line   19)
* MIN_ETINY (decimal モジュール):        定数<4>.            (line   22)
* min_exp (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  676)
* min_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  414)
* min_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  397)
* min_match (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   92)
* min() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  410)
* min() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  390)
* MINEQUAL (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  293)
* MINIMUM_SUPPORTED (ssl.TLSVersion の属性): 定数<9>.        (line  570)
* minimum_version (ssl.SSLContext の属性): SSL contexts.     (line  554)
* minor (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  246)
* minor() (os モジュール):               ファイルとディレクトリ.
                                                             (line  646)
* minsize() (tkinter.Wm のメソッド):     Base and mixin classes.
                                                             (line 1529)
* MINUS (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  227)
* minus() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  418)
* minute (datetime.datetime の属性):     datetime objects.   (line  325)
* minute (datetime.time の属性):         time objects.       (line   54)
* MINYEAR (datetime モジュール):         定数.               (line    8)
* mirrored() (unicodedata モジュール):   unicodedata --- Unicode データベース.
                                                             (line  114)
* Misc (tkinter のクラス):               Base and mixin classes.
                                                             (line    6)
* misc_header (cmd.Cmd の属性):          Cmdオブジェクト.    (line  157)
* MisplacedEnvelopeHeaderDefect:         email errors Exception and Defect classes.
                                                             (line   96)
* MISSING (contextvars.Token の属性):    コンテキスト変数.   (line  134)
* MISSING (dataclasses モジュール):      モジュールの内容<5>.
                                                             (line  501)
* 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)
* MITER (tkinter モジュール):            定数<10>.           (line  136)
* 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  247)
* mock_calls (unittest.mock.Mock の属性): Mock クラス.       (line  513)
* mock_open() (unittest.mock モジュール): mock_open.         (line    6)
* Mod (ast のクラス):                    式 expression<2>.   (line   55)
* mod() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  123)
* mode (bz2.BZ2File の属性):             ファイルの圧縮/解凍.
                                                             (line  127)
* mode (compression.zstd.ZstdFile の属性): 圧縮ファイルへの読み書き.
                                                             (line  106)
* mode (gzip.GzipFile の属性):           gzip --- gzip ファイルのサポート.
                                                             (line  148)
* mode (io.FileIO の属性):               生ファイルI/O.      (line   63)
* mode (lzma.LZMAFile の属性):           圧縮ファイルへの読み書き<2>.
                                                             (line   97)
* 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   44)
* modify() (select.devpoll のメソッド):  /dev/poll polling objects.
                                                             (line   49)
* modify() (select.epoll のメソッド):    Edge and level trigger polling epoll objects.
                                                             (line   91)
* modify() (select.poll のメソッド):     Polling objects.    (line   59)
* modify() (selectors.BaseSelector のメソッド): クラス<4>.   (line   97)
* module:                                用語集<2>.          (line 1165)
* 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 1174)
* 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 modules.    (line   57)
* 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:                        The Stats Class.    (line    9)
* 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.dialog:                tkinter dialog --- Classic Tk dialog boxes.
                                                             (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 --- Scrolled text widget.
                                                             (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 --- 型ヒントのサポート.
                                                             (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   51)
* 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>:                   インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* module;__main__ <7>:                   Multiple interpreters in a Python process.
                                                             (line  109)
* module;__main__ <8>:                   Multiple interpreters in a Python process.
                                                             (line  196)
* module;_locale:                        locale --- 国際化サービス.
                                                             (line   16)
* module;_thread:                        高水準 API.         (line   36)
* 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 2172)
* module;builtins <3>:                   Python の埋め込み<2>.
                                                             (line   11)
* module;builtins <4>:                   インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* module;builtins <5>:                   Multiple interpreters in a Python process.
                                                             (line  109)
* module;builtins <6>:                   Multiple interpreters in a Python process.
                                                             (line  196)
* 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   80)
* module;pickle <1>:                     copyreg --- pickle サポート関数を登録する.
                                                             (line    8)
* module;pickle <2>:                     shelve --- Python オブジェクトの永続化.
                                                             (line    8)
* module;pickle <3>:                     marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   15)
* module;pty:                            ファイル記述子の操作.
                                                             (line  478)
* 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  194)
* module;signal <1>:                     シグナルハンドリング<2>.
                                                             (line    7)
* module;signal <2>:                     シグナルハンドリング<2>.
                                                             (line   51)
* module;signal <3>:                     シグナルハンドリング<2>.
                                                             (line   61)
* module;socket:                         インターネットプロトコルとサポート.
                                                             (line    6)
* module;stat:                           ファイルとディレクトリ.
                                                             (line 1139)
* module;struct:                         socket オブジェクト.
                                                             (line  646)
* module;sys:                            標準モジュール.     (line    6)
* module;sys <1>:                        except 節.          (line   57)
* module;sys <2>:                        完全な Python プログラム.
                                                             (line    6)
* module;sys <3>:                        組み込み関数.       (line 1461)
* module;sys <4>:                        Python の埋め込み<2>.
                                                             (line   11)
* module;sys <5>:                        インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* module;sys <6>:                        Multiple interpreters in a Python process.
                                                             (line  109)
* module;sys <7>:                        Multiple interpreters in a Python process.
                                                             (line  196)
* module;types:                          型オブジェクト.     (line    6)
* module;urllib.request:                 http client --- HTTP プロトコルクライアント.
                                                             (line    8)
* module;検索;パス:                      モジュール検索パス. (line    6)
* module;検索;パス <1>:                  linecache --- テキストラインへのランダムアクセス.
                                                             (line   29)
* module;検索;パス <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1426)
* module;検索;パス <3>:                  site --- サイト固有の設定フック.
                                                             (line   13)
* module;検索;パス <4>:                  Python の埋め込み<2>.
                                                             (line   11)
* module;検索;パス <5>:                  インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* module;検索;パス <6>:                  プロセスワイドのパラメータ.
                                                             (line  141)
* 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>:           インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* modules (modulefinder.ModuleFinder の属性): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   51)
* modules (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 1399)
* 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 1055)
* 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  439)
* monotonic_ns() (time モジュール):      関数<5>.            (line  207)
* monotonic() (time モジュール):         関数<5>.            (line  175)
* Month (calendar のクラス):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  500)
* month (calendar.IllegalMonthError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  520)
* month (datetime.date の属性):          date objects.       (line  150)
* month (datetime.datetime の属性):      datetime objects.   (line  313)
* month_abbr (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  471)
* month_name (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  460)
* 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  379)
* Morsel (http.cookies のクラス):        Morselオブジェクト. (line    6)
* most_common() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   78)
* mouseinterval() (curses モジュール):   関数<6>.            (line  316)
* mousemask() (curses モジュール):       関数<6>.            (line  324)
* move_into() (pathlib.Path のメソッド): Copying moving and deleting.
                                                             (line  100)
* move_to_end() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   76)
* move() (curses.panel.Panel のメソッド): Panel objects.     (line   35)
* move() (curses.window のメソッド):     Window objects.     (line  406)
* move() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  239)
* move() (pathlib.Path のメソッド):      Copying moving and deleting.
                                                             (line   83)
* move() (shutil モジュール):            ディレクトリとファイルの操作.
                                                             (line  353)
* move() (tkinter.Canvas のメソッド):    Widget classes.     (line  336)
* move() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  218)
* MOVETO (tkinter モジュール):           定数<10>.           (line  152)
* moveto() (tkinter.Canvas のメソッド):  Widget classes.     (line  342)
* MozillaCookieJar (http.cookiejar のクラス): FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line    9)
* MRO:                                   用語集<2>.          (line 1182)
* 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   70)
* msg (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  119)
* mtime (gzip.GzipFile の属性):          gzip --- gzip ファイルのサポート.
                                                             (line  155)
* mtime (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line   70)
* mtime() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   38)
* 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)
* MULTIPLE (tkinter モジュール):         定数<10>.           (line  122)
* multiply() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  422)
* mutable:                               用語集<2>.          (line 1186)
* 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 objects.     (line  410)
* mvwin() (curses.window のメソッド):    Window objects.     (line  416)
* myrights() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  243)
* N (tkinter モジュール):                定数<10>.           (line   21)
* N_TOKENS (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  349)
* n_waiting (asyncio.Barrier の属性):    Barrier.            (line   98)
* 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  133)
* name (codecs.CodecInfo の属性):        codecs --- codec レジストリと基底クラス.
                                                             (line   74)
* name (compression.zstd.ZstdFile の属性): 圧縮ファイルへの読み書き.
                                                             (line  110)
* name (contextvars.ContextVar の属性):  コンテキスト変数.   (line   27)
* 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  163)
* 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  305)
* 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   67)
* name (logging.Logger の属性):          ロガーオブジェクト. (line   25)
* name (lzma.LZMAFile の属性):           圧縮ファイルへの読み書き<2>.
                                                             (line  103)
* 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  961)
* name (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line  122)
* name (pyclbr.Class の属性):            クラスオブジェクト<2>.
                                                             (line   20)
* name (pyclbr.Function の属性):         Function オブジェクト.
                                                             (line   19)
* name (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2064)
* name (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   62)
* name (tempfile.TemporaryDirectory の属性): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  194)
* name (threading.Thread の属性):        Thread objects.     (line  181)
* 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   53)
* 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 1195)
* NAMED_FLAGS (enum.EnumCheck の属性):   データ型<2>.        (line  686)
* 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  133)
* nameprep() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   47)
* 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  106)
* namespace:                             名前づけと束縛 naming and binding.
                                                             (line    6)
* namespace <1>:                         用語集<2>.          (line 1221)
* Namespace (argparse のクラス):         Namespace オブジェクト.
                                                             (line    6)
* Namespace (multiprocessing.managers のクラス): マネージャー.
                                                             (line  257)
* namespace package:                     用語集<2>.          (line 1234)
* NAMESPACE_DNS (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  270)
* NAMESPACE_OID (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  279)
* NAMESPACE_URL (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  275)
* NAMESPACE_X500 (uuid モジュール):      uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  283)
* 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  110)
* nametowidget() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line   97)
* NaN:                                   組み込み関数.       (line  715)
* nan (cmath モジュール):                定数<3>.            (line   33)
* nan (math モジュール):                 定数<2>.            (line   31)
* nan (sys.hash_info の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line 1063)
* nanj (cmath モジュール):               定数<3>.            (line   40)
* NannyNag:                              tabnanny --- あいまいなインデントの検出.
                                                             (line   37)
* napms() (curses モジュール):           関数<6>.            (line  333)
* nargs (optparse.Option の属性):        オプション属性.     (line   50)
* native code:                           用語集<2>.          (line 1250)
* native_id (threading.Thread の属性):   Thread objects.     (line  214)
* nb_workers (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  222)
* nbytes (memoryview の属性):            メモリビュー.       (line  413)
* ncurses_version (curses モジュール):   定数<6>.            (line   22)
* ND (inspect.BufferFlags の属性):       Buffer flags.       (line   21)
* ndiff() (difflib モジュール):          difflib --- 差分の計算の補助.
                                                             (line  227)
* ndim (memoryview の属性):              メモリビュー.       (line  480)
* NE (tkinter モジュール):               定数<10>.           (line   21)
* ne() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* nearest() (tkinter.Listbox のメソッド): Widget classes.    (line  948)
* needs_input (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   85)
* needs_input (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  216)
* needs_input (lzma.LZMADecompressor の属性): メモリ上での圧縮と展開<2>.
                                                             (line  164)
* neg() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  140)
* nested scope:                          用語集<2>.          (line 1258)
* nested_scopes (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (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   70)
* 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 モジュール): Event loop.         (line   70)
* new_event_loop() (asyncio.AbstractEventLoopPolicy のメソッド): ポリシーオブジェクト.
                                                             (line   27)
* new_panel() (curses.panel モジュール): 関数<7>.            (line   12)
* new-style class:                       用語集<2>.          (line 1268)
* 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  337)
* NewType (typing のクラス):             Other special directives.
                                                             (line  108)
* newwin() (curses モジュール):          関数<6>.            (line  356)
* next (pdb command):                    Debugger commands.  (line  210)
* next_minus() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  426)
* next_minus() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  402)
* next_plus() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  430)
* next_plus() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  408)
* next_toward() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  434)
* next_toward() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  414)
* next() (tarfile.TarFile のメソッド):   TarFile オブジェクト.
                                                             (line  135)
* next() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  230)
* 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  354)
* NIL (uuid モジュール):                 uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  311)
* NL (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   54)
* NL (token モジュール):                 token --- Python 解析木で使われる定数.
                                                             (line   76)
* nl_langinfo() (locale モジュール):     locale --- 国際化サービス.
                                                             (line  176)
* nl() (curses モジュール):              関数<6>.            (line  366)
* nlargest() (heapq モジュール):         heapq --- ヒープキューアルゴリズム.
                                                             (line  166)
* nlst() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  298)
* NO (tkinter モジュール):               定数<10>.           (line   15)
* NO (tkinter.messagebox モジュール):    tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  164)
* 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  546)
* 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  543)
* NoBoundaryInMultipartDefect:           email errors Exception and Defect classes.
                                                             (line   75)
* nocbreak() (curses モジュール):        関数<6>.            (line  375)
* NoDataAllowedErr:                      例外<23>.           (line   79)
* node (uuid.UUID の属性):               uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  124)
* node() (platform モジュール):          Cross platform.     (line   42)
* NoDefault (typing モジュール):         Introspection helpers.
                                                             (line  226)
* NoDefaultRoot() (tkinter モジュール):  Module-level functions.
                                                             (line   19)
* nodelay() (curses.window のメソッド):  Window objects.     (line  424)
* nodename (os.uname_result の属性):     プロセスのパラメーター.
                                                             (line  610)
* 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  380)
* NOEXPR (locale モジュール):            locale --- 国際化サービス.
                                                             (line  284)
* NOFLAG (re モジュール):                フラグ.             (line   91)
* NoModificationAllowedErr:              例外<23>.           (line   84)
* non-deterministic:                     用語集<2>.          (line 1276)
* NonCallableMagicMock (unittest.mock のクラス): Magic Mock. (line   21)
* NonCallableMock (unittest.mock のクラス): Mock クラス.     (line  571)
* NONE (tkinter モジュール):             定数<10>.           (line   47)
* None (組み込みオブジェクト):           真理値判定.         (line   17)
* None (組み込み変数):                   組み込み定数.       (line   18)
* NoneType (types のクラス):             標準的なインタプリタ型.
                                                             (line   18)
* nonl() (curses モジュール):            関数<6>.            (line  384)
* Nonlocal (ast のクラス):               関数およびクラス定義.
                                                             (line  144)
* nonmember() (enum モジュール):         Utilities and decorators.
                                                             (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  393)
* noraw() (curses モジュール):           関数<6>.            (line  401)
* NoReturn (typing モジュール):          特殊型.             (line   99)
* NORMAL (tkinter モジュール):           定数<10>.           (line  106)
* 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  438)
* normalize() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  420)
* normalize() (locale モジュール):       locale --- 国際化サービス.
                                                             (line  431)
* 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  416)
* notations (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   46)
* NotConnected:                          http client --- HTTP プロトコルクライアント.
                                                             (line  140)
* 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  177)
* notify() (asyncio.Condition のメソッド): Condition.        (line   53)
* notify() (threading.Condition のメソッド): Condition objects.
                                                             (line  158)
* notimeout() (curses.window のメソッド): Window objects.    (line  429)
* 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  467)
* NotSupportedErr:                       例外<23>.           (line   74)
* NotSupportedError:                     例外<7>.            (line   82)
* noutrefresh() (curses.window のメソッド): Window objects.  (line  437)
* NOVEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* 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)
* NS (tkinter モジュール):               定数<10>.           (line   21)
* NSEW (tkinter モジュール):             定数<10>.           (line   21)
* NSIG (signal モジュール):              モジュールの内容<3>.
                                                             (line  238)
* 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  222)
* NullHandler (logging のクラス):        NullHandler.        (line   12)
* NullTranslations (gettext のクラス):   NullTranslations クラス.
                                                             (line   12)
* num (tkinter.Event の属性):            Other classes.      (line   19)
* num_addresses (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  128)
* num_addresses (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  329)
* num_tickets (ssl.SSLContext の属性):   SSL contexts.       (line  561)
* number:                                数値リテラル.       (line    6)
* Number (numbers のクラス):             numbers --- 数の抽象基底クラス.
                                                             (line   15)
* NUMBER (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   46)
* number_class() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  442)
* number_class() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  443)
* numerator (fractions.Fraction の属性): fractions --- 有理数.
                                                             (line  112)
* numerator (numbers.Rational の属性):   数値塔.             (line   51)
* NUMERIC (tkinter モジュール):          定数<10>.           (line  165)
* numeric() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   71)
* numinput() (turtle モジュール):        入力メソッド.       (line   22)
* NW (tkinter モジュール):               定数<10>.           (line   21)
* O_APPEND (os モジュール):              ファイル記述子の操作.
                                                             (line  416)
* O_ASYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  459)
* O_BINARY (os モジュール):              ファイル記述子の操作.
                                                             (line  439)
* O_CLOEXEC (os モジュール):             ファイル記述子の操作.
                                                             (line  426)
* O_CREAT (os モジュール):               ファイル記述子の操作.
                                                             (line  416)
* O_DIRECT (os モジュール):              ファイル記述子の操作.
                                                             (line  459)
* O_DIRECTORY (os モジュール):           ファイル記述子の操作.
                                                             (line  459)
* O_DSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  426)
* O_EVTONLY (os モジュール):             ファイル記述子の操作.
                                                             (line  449)
* O_EXCL (os モジュール):                ファイル記述子の操作.
                                                             (line  416)
* O_EXLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  459)
* O_FSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  449)
* O_NDELAY (os モジュール):              ファイル記述子の操作.
                                                             (line  426)
* O_NOATIME (os モジュール):             ファイル記述子の操作.
                                                             (line  459)
* O_NOCTTY (os モジュール):              ファイル記述子の操作.
                                                             (line  426)
* O_NOFOLLOW (os モジュール):            ファイル記述子の操作.
                                                             (line  459)
* O_NOFOLLOW_ANY (os モジュール):        ファイル記述子の操作.
                                                             (line  449)
* O_NOINHERIT (os モジュール):           ファイル記述子の操作.
                                                             (line  439)
* O_NONBLOCK (os モジュール):            ファイル記述子の操作.
                                                             (line  426)
* O_PATH (os モジュール):                ファイル記述子の操作.
                                                             (line  459)
* O_RANDOM (os モジュール):              ファイル記述子の操作.
                                                             (line  439)
* O_RDONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  416)
* O_RDWR (os モジュール):                ファイル記述子の操作.
                                                             (line  416)
* O_RSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  426)
* O_SEQUENTIAL (os モジュール):          ファイル記述子の操作.
                                                             (line  439)
* O_SHLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  459)
* O_SHORT_LIVED (os モジュール):         ファイル記述子の操作.
                                                             (line  439)
* O_SYMLINK (os モジュール):             ファイル記述子の操作.
                                                             (line  449)
* O_SYNC (os モジュール):                ファイル記述子の操作.
                                                             (line  426)
* O_TEMPORARY (os モジュール):           ファイル記述子の操作.
                                                             (line  439)
* O_TEXT (os モジュール):                ファイル記述子の操作.
                                                             (line  439)
* O_TMPFILE (os モジュール):             ファイル記述子の操作.
                                                             (line  459)
* O_TRUNC (os モジュール):               ファイル記述子の操作.
                                                             (line  416)
* O_WRONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  416)
* obj (AttributeError の属性):           具象例外.           (line   25)
* obj (memoryview の属性):               メモリビュー.       (line  402)
* object:                                オブジェクト、値、および型.
                                                             (line    6)
* object <1>:                            用語集<2>.          (line 1286)
* object (UnicodeError の属性):          具象例外.           (line  441)
* object (組み込みクラス):               組み込み関数.       (line 1228)
* 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  236)
* object;dictionary <3>:                 辞書表示.           (line    6)
* object;dictionary <4>:                 Subscriptions and slicings.
                                                             (line    6)
* object;dictionary <5>:                 代入文 assignment statement.
                                                             (line  117)
* object;dictionary <6>:                 Mapping Types --- dict.
                                                             (line    6)
* object;dictionary <7>:                 Dictionary Objects. (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  146)
* 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>:                    Mapping Types --- 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   96)
* 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  117)
* 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 2012)
* object;type <1>:                       オブジェクト、型および参照カウント.
                                                             (line    6)
* object;type <2>:                       型オブジェクト<2>.  (line    6)
* object;Union:                          Union 型.           (line    6)
* object;クラス:                         カスタムクラス型.   (line   19)
* object;クラス <1>:                     呼び出し call.      (line  142)
* object;クラス <2>:                     クラス定義.         (line    6)
* object;クラスインスタンス:             カスタムクラス型.   (line   19)
* object;クラスインスタンス <1>:         クラスインスタンス class instance.
                                                             (line    6)
* object;クラスインスタンス <2>:         呼び出し call.      (line  146)
* 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>:                   File objects.       (line    6)
* object;フレーム:                       フレーム frame オブジェクト.
                                                             (line    6)
* object;メソッド:                       インスタンスオブジェクト.
                                                             (line   25)
* object;メソッド <1>:                   インスタンスメソッド.
                                                             (line    6)
* object;メソッド <2>:                   組み込みメソッド built-in method.
                                                             (line    6)
* object;メソッド <3>:                   呼び出し call.      (line  137)
* object;メソッド <4>:                   メソッド.           (line    6)
* object;メソッド <5>:                   メソッドオブジェクト<2>.
                                                             (line    6)
* object;ユーザ定義メソッド:             インスタンスメソッド.
                                                             (line    6)
* object;ユーザ定義関数:                 ユーザ定義関数 user-defined function.
                                                             (line    6)
* object;ユーザ定義関数 <1>:             呼び出し call.      (line  127)
* 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  137)
* object;組み込み関数:                   組み込み関数 built-in function.
                                                             (line    6)
* object;組み込み関数 <1>:               呼び出し call.      (line  137)
* object;複素数:                         numbers Complex complex.
                                                             (line    6)
* object;関数:                           ユーザ定義関数 user-defined function.
                                                             (line    6)
* object;関数 <1>:                       組み込み関数 built-in function.
                                                             (line    6)
* object;関数 <2>:                       呼び出し call.      (line  127)
* object;関数 <3>:                       呼び出し call.      (line  137)
* 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  482)
* OFF (tkinter モジュール):              定数<10>.           (line   15)
* offset (ctypes.CField の属性):         構造化データ型.     (line  259)
* offset (SyntaxError の属性):           具象例外.           (line  320)
* 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  158)
* ok_command() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  130)
* ok_command() (tkinter.filedialog.LoadFileDialog のメソッド): Native load/save dialogs.
                                                             (line  154)
* ok_command() (tkinter.filedialog.SaveFileDialog のメソッド): Native load/save dialogs.
                                                             (line  164)
* ok_event() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  126)
* OKCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  176)
* old_value (contextvars.Token の属性):  コンテキスト変数.   (line  127)
* OleDLL (ctypes のクラス):              共有ライブラリをロードする.
                                                             (line  130)
* oledll (ctypes モジュール):            共有ライブラリをロードする.
                                                             (line  214)
* ON (tkinter モジュール):               定数<10>.           (line    9)
* on_motion() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   56)
* on_release() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   61)
* onclick() (turtle モジュール):         スクリーンイベントを利用する.
                                                             (line   56)
* ondrag() (turtle モジュール):          イベントを利用する. (line   56)
* onecmd() (cmd.Cmd のメソッド):         Cmdオブジェクト.    (line   57)
* 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 のクラス):    Native load/save dialogs.
                                                             (line   67)
* 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  184)
* 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  372)
* 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 モジュール):          Tokenizing Input.   (line   97)
* 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  137)
* OpenerDirector (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  320)
* OpenKey() (winreg モジュール):         関数<14>.           (line  283)
* OpenKeyEx() (winreg モジュール):       関数<14>.           (line  283)
* openlog() (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   51)
* openpty() (os モジュール):             ファイル記述子の操作.
                                                             (line  476)
* 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   62)
* 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   62)
* 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  537)
* optimize() (pickletools モジュール):   Programmatic interface.
                                                             (line   30)
* optimized scope:                       用語集<2>.          (line 1292)
* OPTIMIZED_BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   29)
* Option (optparse のクラス):            オプション属性.     (line    6)
* option_add() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  722)
* option_clear() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  732)
* option_get() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  739)
* option_readfile() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  748)
* Optional (typing モジュール):          特殊形式.           (line   60)
* optional module:                       用語集<2>.          (line 1303)
* OptionConflictError:                   例外<12>.           (line   11)
* OptionError:                           例外<12>.           (line    6)
* OptionGroup (optparse のクラス):       オプションをグループ化する.
                                                             (line   12)
* OptionMenu (tkinter のクラス):         Widget classes.     (line 1340)
* OptionMenu (tkinter.ttk のクラス):     Additional widgets. (line   89)
* OptionParser (optparse のクラス):      parserを作る.       (line    9)
* options (doctest.Example の属性):      Example オブジェクト.
                                                             (line   49)
* Options (ssl のクラス):                定数<9>.            (line  341)
* options (ssl.SSLContext の属性):       SSL contexts.       (line  569)
* 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  255)
* OrderedDict (collections のクラス):    OrderedDict オブジェクト.
                                                             (line   59)
* OrderedDict (typing のクラス):         Aliases to types in collections.
                                                             (line   17)
* orig_argv (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1411)
* 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  459)
* output_charset (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   74)
* output_codec (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   88)
* 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)
* OUTSIDE (tkinter モジュール):          定数<10>.           (line   81)
* OutsideDestinationError:               tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  294)
* Overflow (decimal のクラス):           シグナル.           (line   69)
* OverflowError:                         具象例外.           (line  208)
* OverflowError (組み込み例外):          整数型オブジェクト integer object.
                                                             (line  164)
* OverflowError (組み込み例外) <1>:      整数型オブジェクト integer object.
                                                             (line  220)
* OverflowError (組み込み例外) <2>:      整数型オブジェクト integer object.
                                                             (line  263)
* OverflowError (組み込み例外) <3>:      整数型オブジェクト integer object.
                                                             (line  275)
* OverflowError (組み込み例外) <4>:      整数型オブジェクト integer object.
                                                             (line  287)
* OverflowError (組み込み例外) <5>:      整数型オブジェクト integer object.
                                                             (line  300)
* overlap_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  241)
* overlap() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  102)
* overlaps() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  155)
* overlaps() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  342)
* overlay() (curses.window のメソッド):  Window objects.     (line  451)
* overload() (typing モジュール):        Functions and decorators.
                                                             (line  246)
* override() (typing モジュール):        Functions and decorators.
                                                             (line  370)
* overrideredirect() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1539)
* overwrite() (curses.window のメソッド): Window objects.    (line  463)
* owner() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line    6)
* p (pdb command):                       Debugger commands.  (line  271)
* P_ALL (os モジュール):                 プロセス管理.       (line  961)
* P_DETACH (os モジュール):              プロセス管理.       (line  696)
* P_NOWAIT (os モジュール):              プロセス管理.       (line  676)
* P_NOWAITO (os モジュール):             プロセス管理.       (line  676)
* P_OVERLAY (os モジュール):             プロセス管理.       (line  696)
* P_PGID (os モジュール):                プロセス管理.       (line  961)
* P_PID (os モジュール):                 プロセス管理.       (line  961)
* P_PIDFD (os モジュール):               プロセス管理.       (line  961)
* P_WAIT (os モジュール):                プロセス管理.       (line  686)
* Pack (tkinter のクラス):               Base and mixin classes.
                                                             (line 1640)
* pack_configure() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1660)
* pack_forget() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1719)
* pack_info() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1730)
* pack_into() (struct モジュール):       関数と例外.         (line   19)
* pack_into() (struct.Struct のメソッド): クラス<3>.         (line   30)
* pack_propagate() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  255)
* pack_propagate() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1735)
* pack_slaves() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  268)
* pack_slaves() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1743)
* pack() (mailbox.MH のメソッド):        MH オブジェクト.    (line   69)
* pack() (struct モジュール):            関数と例外.         (line   13)
* pack() (struct.Struct のメソッド):     クラス<3>.          (line   24)
* pack() (tkinter.Pack のメソッド):      Base and mixin classes.
                                                             (line 1660)
* package:                               パッケージ<2>.      (line    6)
* package <1>:                           site --- サイト固有の設定フック.
                                                             (line   77)
* package <2>:                           用語集<2>.          (line 1313)
* 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):                     The packer.         (line    6)
* PAGER:                                 pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* PAGES (tkinter モジュール):            定数<10>.           (line  159)
* pair_content() (curses モジュール):    関数<6>.            (line  406)
* pair_number() (curses モジュール):     関数<6>.            (line  412)
* pairwise() (itertools モジュール):     Itertool関数.       (line  411)
* pane() (tkinter.ttk.Panedwindow のメソッド): Additional widgets.
                                                             (line  142)
* panecget() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1396)
* paneconfig() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1402)
* paneconfigure() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1402)
* PanedWindow (tkinter のクラス):        Widget classes.     (line 1359)
* Panedwindow (tkinter.ttk のクラス):    Additional widgets. (line  114)
* PanedWindow (tkinter.ttk のクラス):    Additional widgets. (line  238)
* panes() (tkinter.PanedWindow のメソッド): Widget classes.  (line 1391)
* parallelism:                           用語集<2>.          (line 1322)
* parameter:                             用語集<2>.          (line 1333)
* 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  250)
* parameters (inspect.Signature の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  116)
* params (email.headerregistry.ParameterizedMIMEHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  258)
* 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  105)
* 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  235)
* 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  160)
* parse_qsl() (urllib.parse モジュール): URL の解析.         (line  210)
* parse() (ast モジュール):              ast helpers.        (line    9)
* parse() (doctest.DocTestParser のメソッド): DocTestParser オブジェクト.
                                                             (line   29)
* parse() (email.parser.BytesParser のメソッド): Parser API. (line   34)
* parse() (email.parser.Parser のメソッド): Parser API.      (line   86)
* parse() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   39)
* parse() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   28)
* 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   48)
* ParseResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   73)
* 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  329)
* partial() (imaplib.IMAP4 のメソッド):  IMAP4 オブジェクト. (line  275)
* partialmethod (functools のクラス):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  399)
* parties (asyncio.Barrier の属性):      Barrier.            (line   94)
* parties (threading.Barrier の属性):    Barrier objects.    (line   92)
* partition() (bytearray のメソッド):    bytes と bytearray の操作.
                                                             (line  188)
* partition() (bytes のメソッド):        bytes と bytearray の操作.
                                                             (line  188)
* partition() (str のメソッド):          文字列メソッド<2>.  (line  545)
* partitioned (http.cookies.Morsel の属性): Morselオブジェクト.
                                                             (line   13)
* parts (pathlib.PurePath の属性):       個別の構成要素へのアクセス.
                                                             (line    9)
* Pass (ast のクラス):                   文 Statements.      (line  152)
* 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<12>.          (line   14)
* PATH <5>:                              Windows<31>.        (line   55)
* PATH <6>:                              Windows<35>.        (line   14)
* PATH <7>:                              セキュリティ<49>.   (line   16)
* PATH <8>:                              セキュリティ<49>.   (line   20)
* PATH <9>:                              モジュール検索パス. (line   15)
* 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  132)
* 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  109)
* 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  455)
* PATH <40>:                             ディレクトリとファイルの操作.
                                                             (line  460)
* PATH <41>:                             プロセス管理.       (line   45)
* PATH <42>:                             プロセス管理.       (line   87)
* PATH <43>:                             プロセス管理.       (line   90)
* PATH <44>:                             プロセス管理.       (line   93)
* PATH <45>:                             プロセス管理.       (line  544)
* PATH <46>:                             プロセス管理.       (line  632)
* PATH <47>:                             プロセス管理.       (line  634)
* PATH <48>:                             プロセス管理.       (line  636)
* PATH <49>:                             雑多なシステム情報. (line  136)
* 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   69)
* 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  145)
* path (ImportError の属性):             具象例外.           (line   64)
* path (importlib.abc.FileLoader の属性): importlib abc -- Abstract base classes related to import.
                                                             (line  309)
* 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  971)
* Path (pathlib のクラス):               具象パス.           (line   10)
* path (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1424)
* path (sys モジュール) <1>:             Python の埋め込み<2>.
                                                             (line   11)
* path (sys モジュール) <2>:             インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* path (sys モジュール) <3>:             プロセスワイドのパラメータ.
                                                             (line  141)
* Path (zipfile のクラス):               Path objects.       (line    6)
* path based finder:                     パスベース・ファインダー.
                                                             (line    6)
* path based finder <1>:                 用語集<2>.          (line 1410)
* Path browser:                          File メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   23)
* path entry:                            用語集<2>.          (line 1389)
* path entry finder:                     用語集<2>.          (line 1394)
* path entry hook:                       用語集<2>.          (line 1404)
* path hooks:                            インポートフック.   (line    6)
* path_hook() (importlib.machinery.FileFinder のクラスメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  191)
* path_hooks (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1457)
* path_importer_cache (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1466)
* path_mtime() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  372)
* path_return_ok() (http.cookiejar.CookiePolicy のメソッド): CookiePolicy オブジェクト.
                                                             (line   58)
* path_stats() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  353)
* path_stats() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  221)
* path-like object:                      用語集<2>.          (line 1415)
* 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  678)
* pathconf() (os モジュール):            ファイルとディレクトリ.
                                                             (line  656)
* PathEntryFinder (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line   58)
* PATHEXT:                               その他の改善<2>.    (line   30)
* PATHEXT <1>:                           ライブラリ<139>.    (line  138)
* PATHEXT <2>:                           Installing without UI.
                                                             (line   78)
* PATHEXT <3>:                           Installing without UI.
                                                             (line   83)
* PATHEXT <4>:                           ディレクトリとファイルの操作.
                                                             (line  470)
* 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  134)
* Pattern (re のクラス):                 Regular Expression Objects.
                                                             (line    6)
* pattern (re.Pattern の属性):           Regular Expression Objects.
                                                             (line  124)
* 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 モジュール):           モジュールの内容<3>.
                                                             (line  338)
* PAX_FORMAT (tarfile モジュール):       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  386)
* pax_headers (tarfile.TarFile の属性):  TarFile オブジェクト.
                                                             (line  333)
* 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  179)
* 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  136)
* peek() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   77)
* peek() (lzma.LZMAFile のメソッド):     圧縮ファイルへの読み書き<2>.
                                                             (line   85)
* peek() (weakref.finalize のメソッド):  weakref --- Weak references.
                                                             (line  300)
* peer_create() (tkinter.Text のメソッド): Widget classes.   (line 2317)
* peer_names() (tkinter.Text のメソッド): Widget classes.    (line 2328)
* PEM_cert_to_DER_cert() (ssl モジュール): 証明書の取り扱い. (line   58)
* pen() (turtle モジュール):             描画状態.           (line   32)
* pencolor() (turtle モジュール):        色の制御<2>.        (line    6)
* pending (ssl.MemoryBIO の属性):        Memory BIO support. (line  137)
* pending() (ssl.SSLSocket のメソッド):  SSL sockets.        (line  333)
* PendingDeprecationWarning:             警告.               (line   28)
* pendown() (turtle モジュール):         描画状態.           (line    6)
* pensize() (turtle モジュール):         描画状態.           (line   18)
* penup() (turtle モジュール):           描画状態.           (line   12)
* PEP:                                   用語集<2>.          (line 1427)
* per-object lock:                       用語集<2>.          (line 1378)
* 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   66)
* 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  295)
* 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   73)
* 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)
* PhotoImage (tkinter のクラス):         Image classes.      (line   41)
* 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  326)
* 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  151)
* PIDFD_NONBLOCK (os モジュール):        プロセス管理.       (line  374)
* pidfd_open() (os モジュール):          プロセス管理.       (line  361)
* pidfd_send_signal() (signal モジュール): モジュールの内容<3>.
                                                             (line  356)
* PIESLICE (tkinter モジュール):         定数<10>.           (line  130)
* PIP_USER:                              Windows<52>.        (line  102)
* PIPE (subprocess モジュール):          Using the subprocess Module.
                                                             (line  150)
* PIPE_BUF (select モジュール):          select --- I/O 完了の待機.
                                                             (line  169)
* 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   79)
* pipe() (os モジュール):                ファイル記述子の操作.
                                                             (line  487)
* pipe2() (os モジュール):               ファイル記述子の操作.
                                                             (line  497)
* Place (tkinter のクラス):              Base and mixin classes.
                                                             (line 1749)
* place_configure() (tkinter.Place のメソッド): Base and mixin classes.
                                                             (line 1755)
* place_forget() (tkinter.Place のメソッド): Base and mixin classes.
                                                             (line 1809)
* place_info() (tkinter.Place のメソッド): Base and mixin classes.
                                                             (line 1814)
* place_slaves() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  275)
* place_slaves() (tkinter.Place のメソッド): Base and mixin classes.
                                                             (line 1818)
* place() (tkinter.Place のメソッド):    Base and mixin classes.
                                                             (line 1755)
* Placeholder (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  321)
* placeholder (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  272)
* platform (in module sys):              プロセスワイドのパラメータ.
                                                             (line  179)
* platform (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1476)
* platform コマンドラインオプション; -nonaliased: コマンドラインでの使用<3>.
                                                             (line   19)
* platform コマンドラインオプション; -terse: コマンドラインでの使用<3>.
                                                             (line   13)
* platform() (platform モジュール):      Cross platform.     (line   47)
* platlibdir (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1548)
* PlaySound() (winsound モジュール):     winsound --- Windows 用の音声再生インターフェース.
                                                             (line   22)
* plist;ファイル:                        plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line    8)
* plock() (os モジュール):               プロセス管理.       (line  386)
* PLUS (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  224)
* plus() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  446)
* PLUSEQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  290)
* pm() (pdb モジュール):                 コマンドライン・インターフェース<8>.
                                                             (line  150)
* POINTER() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  216)
* pointer() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  229)
* 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   92)
* poll() (select.devpoll のメソッド):    /dev/poll polling objects.
                                                             (line   65)
* poll() (select.epoll のメソッド):      Edge and level trigger polling epoll objects.
                                                             (line  102)
* poll() (select.poll のメソッド):       Polling objects.    (line   76)
* 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  592)
* 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  227)
* pop() (collections.deque のメソッド):  deque オブジェクト. (line   89)
* pop() (dict のメソッド):               Mapping Types --- dict.
                                                             (line  198)
* pop() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line  212)
* pop() (sequence のメソッド):           ミュータブルなシーケンス型.
                                                             (line  103)
* pop() (set のメソッド):                set（集合）型 --- set frozenset.
                                                             (line  210)
* 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  394)
* popen() (os モジュール) <2>:           select --- I/O 完了の待機.
                                                             (line  149)
* popitem() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   70)
* popitem() (dict のメソッド):           Mapping Types --- dict.
                                                             (line  207)
* popitem() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  220)
* popleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   95)
* port (http.cookiejar.Cookie の属性):   Cookieオブジェクト<2>.
                                                             (line   35)
* port_specified (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   81)
* portion:                               用語集<2>.          (line 1441)
* pos (json.JSONDecodeError の属性):     例外<20>.           (line   18)
* pos (re.Match の属性):                 Match Objects.      (line  177)
* pos (re.PatternError の属性):          例外<3>.            (line   23)
* pos (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   78)
* pos() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  150)
* pos() (turtle モジュール):             Turtle の状態を知る.
                                                             (line    6)
* position (xml.etree.ElementTree.ParseError の属性): 例外<22>.
                                                             (line   18)
* position() (turtle モジュール):        Turtle の状態を知る.
                                                             (line    6)
* positionfrom() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1551)
* 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  531)
* POSIX_FADV_NOREUSE (os モジュール):    ファイル記述子の操作.
                                                             (line  531)
* POSIX_FADV_NORMAL (os モジュール):     ファイル記述子の操作.
                                                             (line  531)
* POSIX_FADV_RANDOM (os モジュール):     ファイル記述子の操作.
                                                             (line  531)
* POSIX_FADV_SEQUENTIAL (os モジュール): ファイル記述子の操作.
                                                             (line  531)
* POSIX_FADV_WILLNEED (os モジュール):   ファイル記述子の操作.
                                                             (line  531)
* posix_fadvise() (os モジュール):       ファイル記述子の操作.
                                                             (line  517)
* posix_fallocate() (os モジュール):     ファイル記述子の操作.
                                                             (line  508)
* posix_openpt() (os モジュール):        ファイル記述子の操作.
                                                             (line  557)
* POSIX_SPAWN_CLOSE (os モジュール):     プロセス管理.       (line  463)
* POSIX_SPAWN_CLOSEFROM (os モジュール): プロセス管理.       (line  475)
* POSIX_SPAWN_DUP2 (os モジュール):      プロセス管理.       (line  469)
* POSIX_SPAWN_OPEN (os モジュール):      プロセス管理.       (line  457)
* posix_spawn() (os モジュール):         プロセス管理.       (line  433)
* posix_spawnp() (os モジュール):        プロセス管理.       (line  536)
* POSIX;I/O control:                     termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* PosixPath (pathlib のクラス):          具象パス.           (line   21)
* post_handshake_auth (ssl.SSLContext の属性): SSL contexts. (line  586)
* post_mortem() (pdb モジュール):        コマンドライン・インターフェース<8>.
                                                             (line  140)
* post_setup() (venv.EnvBuilder のメソッド): API<2>.         (line  170)
* post() (tkinter.Menu のメソッド):      Widget classes.     (line 1288)
* postcmd() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line  102)
* postloop() (cmd.Cmd のメソッド):       Cmdオブジェクト.    (line  118)
* postscript() (tkinter.Canvas のメソッド): Widget classes.  (line  674)
* 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  452)
* pp (pdb command):                      Debugger commands.  (line  280)
* pp() (pprint モジュール):              関数<4>.            (line    6)
* pprint() (pprint モジュール):          関数<4>.            (line   65)
* pprint() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   56)
* prcal() (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  400)
* pread() (os モジュール):               ファイル記述子の操作.
                                                             (line  545)
* preadv() (os モジュール):              ファイル記述子の操作.
                                                             (line  575)
* preamble (email.message.EmailMessage の属性): email message Representing an email message.
                                                             (line  681)
* preamble (email.message.Message の属性): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  698)
* prec (decimal.Context の属性):         Context オブジェクト.
                                                             (line  126)
* precmd() (cmd.Cmd のメソッド):         Cmdオブジェクト.    (line   92)
* prefix (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line 1573)
* prefix (xml.dom.Attr の属性):          Attr オブジェクト.  (line   18)
* prefix (xml.dom.Node の属性):          Node オブジェクト.  (line   68)
* prefix (zipimport.zipimporter の属性): zipimporter オブジェクト.
                                                             (line  101)
* PREFIXES (site モジュール):            モジュールの内容<6>.
                                                             (line    6)
* prefixlen (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  132)
* prefixlen (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  331)
* preloop() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line  112)
* 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   34)
* prepare() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line   97)
* prepare() (logging.handlers.QueueHandler のメソッド): QueueHandler.
                                                             (line   53)
* prepare() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   64)
* PrepareProtocol (sqlite3 のクラス):    PrepareProtocol オブジェクト.
                                                             (line    6)
* PrettyPrinter (pprint のクラス):       PrettyPrinter オブジェクト.
                                                             (line    6)
* prev() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  240)
* previousSibling (xml.dom.Node の属性): Node オブジェクト.  (line   32)
* print_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   17)
* print_callees() (pstats.Stats のメソッド): The Stats Class.
                                                             (line  216)
* print_callers() (pstats.Stats のメソッド): The Stats Class.
                                                             (line  195)
* print_exc() (timeit.Timer のメソッド): Python Interface.   (line  126)
* print_exc() (traceback モジュール):    モジュールレベルの関数<2>.
                                                             (line   57)
* print_exception() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line   24)
* print_function (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (line   35)
* print_help() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   16)
* print_last() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   62)
* print_list() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   98)
* print_stack() (asyncio.Task のメソッド): Task object.      (line  146)
* print_stack() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line   68)
* print_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   90)
* print_stats() (pstats.Stats のメソッド): The Stats Class.  (line  164)
* 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  134)
* print() (組み込み関数);__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* printable (string モジュール):         文字列定数.         (line   40)
* printdir() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  244)
* printf 形式の書式化:                   printf 形式の文字列書式化.
                                                             (line    6)
* printf 形式の書式化 <1>:               printf 形式での bytes の書式化.
                                                             (line    6)
* PRIO_DARWIN_BG (os モジュール):        プロセスのパラメーター.
                                                             (line  320)
* PRIO_DARWIN_NONUI (os モジュール):     プロセスのパラメーター.
                                                             (line  320)
* PRIO_DARWIN_PROCESS (os モジュール):   プロセスのパラメーター.
                                                             (line  320)
* PRIO_DARWIN_THREAD (os モジュール):    プロセスのパラメーター.
                                                             (line  320)
* PRIO_PGRP (os モジュール):             プロセスのパラメーター.
                                                             (line  309)
* PRIO_PROCESS (os モジュール):          プロセスのパラメーター.
                                                             (line  309)
* PRIO_USER (os モジュール):             プロセスのパラメーター.
                                                             (line  309)
* PriorityQueue (asyncio のクラス):      優先度付きのキュー. (line    6)
* PriorityQueue (queue のクラス):        queue --- 同期キュークラス.
                                                             (line   46)
* prlimit() (resource モジュール):       リソースの制限.     (line   57)
* prmonth() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  390)
* prmonth() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  195)
* ProactorEventLoop (asyncio のクラス):  Event loop implementations.
                                                             (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オブジェクト.
                                                             (line  154)
* process_time_ns() (time モジュール):   関数<5>.            (line  257)
* process_time() (time モジュール):      関数<5>.            (line  245)
* process_tokens() (tabnanny モジュール): tabnanny --- あいまいなインデントの検出.
                                                             (line   43)
* process;id:                            プロセスのパラメーター.
                                                             (line  278)
* process;kill:                          プロセス管理.       (line  325)
* process;kill <1>:                      プロセス管理.       (line  347)
* process;グループ:                      プロセスのパラメーター.
                                                             (line  213)
* process;グループ <1>:                  プロセスのパラメーター.
                                                             (line  272)
* process;シグナル:                      プロセス管理.       (line  325)
* process;シグナル <1>:                  プロセス管理.       (line  347)
* process;スケジューリング優先度:        プロセスのパラメーター.
                                                             (line  296)
* process;スケジューリング優先度 <1>:    プロセスのパラメーター.
                                                             (line  485)
* process;親の ID:                       プロセスのパラメーター.
                                                             (line  285)
* process() (logging.LoggerAdapter のメソッド): LoggerAdapter オブジェクト.
                                                             (line   21)
* ProcessError:                          Process クラスと例外.
                                                             (line  279)
* 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  376)
* ProcessLookupError:                    OS 例外.            (line  106)
* processor() (platform モジュール):     Cross platform.     (line   68)
* ProcessPoolExecutor (concurrent.futures のクラス): ProcessPoolExecutor.
                                                             (line   26)
* 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  956)
* profile function <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1626)
* PROFILE_TASK:                          ビルド<26>.         (line   13)
* PROFILE_TASK <1>:                      パフォーマンスに関するオプション.
                                                             (line   12)
* profiler:                              sys --- システム固有のパラメーターと関数.
                                                             (line  956)
* profiler <1>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1626)
* profiling, deterministic:              Introduction to the profilers.
                                                             (line    6)
* ProgrammingError:                      例外<7>.            (line   75)
* Progressbar (tkinter.ttk のクラス):    ttk Progressbar.    (line    6)
* PROJECTING (tkinter モジュール):       定数<10>.           (line  136)
* prompt (cmd.Cmd の属性):               Cmdオブジェクト.    (line  127)
* prompts, interpreter:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1597)
* propagate (logging.Logger の属性):     ロガーオブジェクト. (line   50)
* propagate() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1931)
* propagate() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  255)
* propagate() (tkinter.Pack のメソッド): Base and mixin classes.
                                                             (line 1735)
* property (組み込みクラス):             組み込み関数.       (line 1587)
* 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 モジュール):          Utilities and decorators.
                                                             (line   41)
* PropertyMock (unittest.mock のクラス): Mock クラス.        (line  638)
* prot_c() (ftplib.FTP_TLS のメソッド):  FTP_TLS オブジェクト.
                                                             (line  111)
* prot_p() (ftplib.FTP_TLS のメソッド):  FTP_TLS オブジェクト.
                                                             (line  107)
* proto (socket.socket の属性):          socket オブジェクト.
                                                             (line  706)
* Protocol (asyncio のクラス):           基底プロトコル.     (line   11)
* protocol (ssl.SSLContext の属性):      SSL contexts.       (line  605)
* 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  209)
* PROTOCOL_VERSION (imaplib.IMAP4 の属性): IMAP4 オブジェクト.
                                                             (line  484)
* protocol() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1563)
* ProtocolError (xmlrpc.client のクラス): ProtocolError オブジェクト.
                                                             (line    6)
* provisional API:                       用語集<2>.          (line 1451)
* provisional package:                   用語集<2>.          (line 1468)
* proxy_coord() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1468)
* proxy_forget() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1473)
* proxy_place() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1477)
* proxy() (tkinter.PanedWindow のメソッド): Widget classes.  (line 1459)
* proxy() (weakref モジュール):          weakref --- Weak references.
                                                             (line  131)
* 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  329)
* ProxyTypes (weakref モジュール):       weakref --- Weak references.
                                                             (line  337)
* pryear() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  209)
* ps1 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1594)
* ps2 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1594)
* pstdev() (statistics モジュール):      関数の詳細.         (line  362)
* pthread_getcpuclockid() (time モジュール): 関数<5>.        (line   21)
* pthread_kill() (signal モジュール):    モジュールの内容<3>.
                                                             (line  371)
* pthread_sigmask() (signal モジュール): モジュールの内容<3>.
                                                             (line  401)
* pthreads:                              _thread --- 低水準なスレッド API.
                                                             (line   15)
* pthreads (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  352)
* ptsname() (os モジュール):             ファイル記述子の操作.
                                                             (line  634)
* 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  283)
* Purpose.CLIENT_AUTH (ssl モジュール):  定数<9>.            (line  547)
* Purpose.SERVER_AUTH (ssl モジュール):  定数<9>.            (line  538)
* push_async_callback() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  643)
* push_async_exit() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  638)
* 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  561)
* put_nowait() (asyncio.Queue のメソッド): Queue.            (line   72)
* put_nowait() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  149)
* 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  133)
* put() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  251)
* put() (queue.Queue のメソッド):        キューオブジェクト. (line   29)
* put() (queue.SimpleQueue のメソッド):  SimpleQueue オブジェクト.
                                                             (line   21)
* put() (tkinter.PhotoImage のメソッド): Image classes.      (line  164)
* putch() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line   34)
* putenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  369)
* putheader() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  183)
* putp() (curses モジュール):            関数<6>.            (line  417)
* putrequest() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  173)
* putwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   39)
* putwin() (curses.window のメソッド):   Window objects.     (line  475)
* pvariance() (statistics モジュール):   関数の詳細.         (line  370)
* pwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  342)
* pwrite() (os モジュール):              ファイル記述子の操作.
                                                             (line  648)
* pwritev() (os モジュール):             ファイル記述子の操作.
                                                             (line  659)
* Py_ABS (C macro):                      Numeric utilities.  (line    6)
* Py_AddPendingCall (C function):        Asynchronous notifications.
                                                             (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  538)
* Py_ASNATIVEBYTES_BIG_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  516)
* Py_ASNATIVEBYTES_DEFAULTS (C macro):   整数型オブジェクト integer object.
                                                             (line  512)
* Py_ASNATIVEBYTES_LITTLE_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  520)
* Py_ASNATIVEBYTES_NATIVE_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  524)
* Py_ASNATIVEBYTES_REJECT_NEGATIVE (C macro): 整数型オブジェクト integer object.
                                                             (line  533)
* Py_ASNATIVEBYTES_UNSIGNED_BUFFER (C macro): 整数型オブジェクト integer object.
                                                             (line  528)
* 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>:  APIs.               (line   12)
* 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   91)
* Py_BLOCK_THREADS (C macro):            APIs.               (line   26)
* 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):             インタープリタの初期化と終了処理<2>.
                                                             (line  126)
* Py_BytesWarningFlag (C var):           グローバルな設定変数.
                                                             (line   14)
* 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   29)
* 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   43)
* 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>:    APIs.               (line   19)
* 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):        Multiple interpreters in a Python process.
                                                             (line  205)
* Py_EnterRecursiveCall (C function):    再帰の管理.         (line   13)
* Py_EQ (C macro):                       PyTypeObject スロット.
                                                             (line 1314)
* 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  224)
* 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):              インタープリタの初期化と終了処理<2>.
                                                             (line  121)
* Py_FinalizeEx (C function):            プロセス制御.       (line   23)
* Py_FinalizeEx (C function) <1>:        プロセス制御.       (line   33)
* Py_FinalizeEx (C function) <2>:        インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* Py_FinalizeEx (C function) <3>:        インタープリタの初期化と終了処理<2>.
                                                             (line   64)
* Py_FinalizeEx (C function) <4>:        Multiple interpreters in a Python process.
                                                             (line  168)
* Py_FinalizeEx (C function) <5>:        Multiple interpreters in a Python process.
                                                             (line  206)
* Py_fopen (C function):                 オペレーティングシステム関連のユーティリティ.
                                                             (line  229)
* Py_FORCE_EXPANSION (C macro):          Macro definition utilities.
                                                             (line    6)
* Py_FrozenFlag (C var):                 グローバルな設定変数.
                                                             (line   57)
* 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 1323)
* 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  211)
* Py_GetCompiler (C function):           プロセスワイドのパラメータ.
                                                             (line  200)
* Py_GetConstant (C function):           オブジェクトプロトコル object protocol.
                                                             (line    6)
* Py_GetConstantBorrowed (C function):   オブジェクトプロトコル object protocol.
                                                             (line   57)
* Py_GetCopyright (C function):          プロセスワイドのパラメータ.
                                                             (line  190)
* 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  140)
* Py_GetPath():                          プロセスワイドのパラメータ.
                                                             (line    7)
* Py_GetPlatform (C function):           プロセスワイドのパラメータ.
                                                             (line  178)
* Py_GetPrefix (C function):             Python の埋め込み<2>.
                                                             (line   39)
* Py_GetPrefix (C function) <1>:         プロセスワイドのパラメータ.
                                                             (line   46)
* Py_GetProgramFullPath (C function):    Python の埋め込み<2>.
                                                             (line   39)
* Py_GetProgramFullPath (C function) <1>: プロセスワイドのパラメータ.
                                                             (line  120)
* Py_GetProgramName (C function):        プロセスワイドのパラメータ.
                                                             (line   30)
* Py_GetPythonHome (C function):         プロセスワイドのパラメータ.
                                                             (line  312)
* Py_GetRecursionLimit (C function):     再帰の管理.         (line   71)
* Py_GetVersion (C function):            プロセスワイドのパラメータ.
                                                             (line  164)
* Py_GT (C macro):                       PyTypeObject スロット.
                                                             (line 1320)
* 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   68)
* 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   83)
* Py_IgnoreEnvironmentFlag (C var):      グローバルな設定変数.
                                                             (line   83)
* 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   67)
* Py_Initialize (C function):            Python の埋め込み<2>.
                                                             (line   11)
* Py_Initialize (C function) <1>:        インタープリタの初期化と終了処理<2>.
                                                             (line    6)
* Py_Initialize (C function) <2>:        Multiple interpreters in a Python process.
                                                             (line  168)
* Py_Initialize():                       プロセスワイドのパラメータ.
                                                             (line    7)
* Py_InitializeEx (C function):          インタープリタの初期化と終了処理<2>.
                                                             (line   30)
* Py_InitializeFromConfig (C function):  インタープリタの初期化と終了処理<2>.
                                                             (line   40)
* Py_InitializeFromInitConfig (C function): Initialize Python.
                                                             (line    6)
* Py_InspectFlag (C var):                グローバルな設定変数.
                                                             (line   96)
* Py_InteractiveFlag (C var):            グローバルな設定変数.
                                                             (line  112)
* 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  131)
* Py_IS_INFINITY (C macro):              Floating-Point Objects.
                                                             (line  140)
* Py_IS_NAN (C macro):                   Floating-Point Objects.
                                                             (line  148)
* 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):          インタープリタの初期化と終了処理<2>.
                                                             (line   57)
* Py_IsInitialized (C function):         Python の埋め込み<2>.
                                                             (line   48)
* Py_IsInitialized (C function) <1>:     インタープリタの初期化と終了処理<2>.
                                                             (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  122)
* 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 1311)
* Py_LeaveRecursiveCall (C function):    再帰の管理.         (line   34)
* Py_LegacyWindowsFSEncodingFlag (C var): グローバルな設定変数.
                                                             (line  138)
* Py_LegacyWindowsStdioFlag (C var):     グローバルな設定変数.
                                                             (line  158)
* 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   21)
* PY_LOCK_FAILURE (C enumerator):        Legacy locking APIs.
                                                             (line   17)
* PY_LOCK_INTR (C enumerator):           Legacy locking APIs.
                                                             (line   25)
* Py_LT (C macro):                       PyTypeObject スロット.
                                                             (line 1308)
* Py_Main (C function):                  インタープリタの初期化と終了処理<2>.
                                                             (line  134)
* PY_MAJOR_VERSION (C macro):            Build-time version constants.
                                                             (line   13)
* Py_MakePendingCalls (C function):      Asynchronous notifications.
                                                             (line   56)
* Py_MARSHAL_VERSION (C macro):          データ整列化 data marshalling のサポート.
                                                             (line   16)
* Py_MATH_E (C macro):                   Floating-Point Objects.
                                                             (line   89)
* Py_MATH_El (C macro):                  Floating-Point Objects.
                                                             (line   94)
* Py_MATH_PI (C macro):                  Floating-Point Objects.
                                                             (line   98)
* Py_MATH_PIl (C macro):                 Floating-Point Objects.
                                                             (line  103)
* Py_MATH_TAU (C macro):                 Floating-Point Objects.
                                                             (line  108)
* 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   21)
* Py_mod_exec (C macro):                 Module slots.       (line   57)
* Py_mod_gil (C macro):                  Module slots.       (line  102)
* Py_MOD_GIL_NOT_USED (C macro):         Module slots.       (line  112)
* Py_MOD_GIL_USED (C macro):             Module slots.       (line  106)
* Py_mod_multiple_interpreters (C macro): Module slots.      (line   71)
* Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED (C macro): Module slots.
                                                             (line   75)
* Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (C macro): Module slots.
                                                             (line   79)
* Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (C macro): Module slots.
                                                             (line   85)
* 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   75)
* 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 1317)
* Py_NewInterpreter (C function):        Multiple interpreters in a Python process.
                                                             (line  195)
* Py_NewInterpreterFromConfig (C function): Multiple interpreters in a Python process.
                                                             (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  176)
* Py_NotImplemented (C var):             オブジェクトプロトコル object protocol.
                                                             (line   71)
* Py_NoUserSiteDirectory (C var):        グローバルな設定変数.
                                                             (line  191)
* py_object (ctypes のクラス):           基本データ型<2>.    (line  270)
* Py_OpenCodeHookFunction (C type):      File objects.       (line   62)
* Py_OptimizeFlag (C var):               グローバルな設定変数.
                                                             (line  205)
* 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のマクロ):              File objects.       (line  116)
* Py_QuietFlag (C var):                  グローバルな設定変数.
                                                             (line  216)
* 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  159)
* 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  122)
* Py_RETURN_NAN (C macro):               Floating-Point Objects.
                                                             (line  115)
* Py_RETURN_NONE (C macro):              None オブジェクト.  (line   19)
* Py_RETURN_NOTIMPLEMENTED (C macro):    オブジェクトプロトコル object protocol.
                                                             (line   76)
* Py_RETURN_RICHCOMPARE (C macro):       PyTypeObject スロット.
                                                             (line 1329)
* Py_RETURN_TRUE (C macro):              Boolean オブジェクト.
                                                             (line   41)
* Py_RunMain (C function):               インタープリタの初期化と終了処理<2>.
                                                             (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  294)
* 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  263)
* 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 1692)
* Py_tp_base (C macro):                  PyTypeObject スロット.
                                                             (line 1501)
* Py_tp_bases (C macro):                 PyTypeObject スロット.
                                                             (line 1826)
* Py_tp_call (C macro):                  PyTypeObject スロット.
                                                             (line  495)
* Py_tp_clear (C macro):                 PyTypeObject スロット.
                                                             (line 1128)
* Py_tp_dealloc (C macro):               PyTypeObject スロット.
                                                             (line  138)
* Py_tp_del (C macro):                   PyTypeObject スロット.
                                                             (line 1904)
* Py_tp_descr_get (C macro):             PyTypeObject スロット.
                                                             (line 1574)
* Py_tp_descr_set (C macro):             PyTypeObject スロット.
                                                             (line 1590)
* Py_tp_doc (C macro):                   PyTypeObject スロット.
                                                             (line 1010)
* Py_tp_finalize (C macro):              PyTypeObject スロット.
                                                             (line 1922)
* Py_tp_free (C macro):                  PyTypeObject スロット.
                                                             (line 1759)
* Py_tp_getattr (C macro):               PyTypeObject スロット.
                                                             (line  324)
* Py_tp_getattro (C macro):              PyTypeObject スロット.
                                                             (line  542)
* Py_tp_getset (C macro):                PyTypeObject スロット.
                                                             (line 1483)
* Py_tp_hash (C macro):                  PyTypeObject スロット.
                                                             (line  451)
* Py_tp_init (C macro):                  PyTypeObject スロット.
                                                             (line 1653)
* Py_tp_is_gc (C macro):                 PyTypeObject スロット.
                                                             (line 1792)
* Py_tp_iter (C macro):                  PyTypeObject スロット.
                                                             (line 1400)
* Py_tp_iternext (C macro):              PyTypeObject スロット.
                                                             (line 1420)
* Py_tp_members (C macro):               PyTypeObject スロット.
                                                             (line 1465)
* Py_tp_methods (C macro):               PyTypeObject スロット.
                                                             (line 1447)
* Py_tp_new (C macro):                   PyTypeObject スロット.
                                                             (line 1717)
* Py_tp_repr (C macro):                  PyTypeObject スロット.
                                                             (line  385)
* Py_tp_richcompare (C macro):           PyTypeObject スロット.
                                                             (line 1286)
* Py_tp_setattr (C macro):               PyTypeObject スロット.
                                                             (line  346)
* Py_tp_setattro (C macro):              PyTypeObject スロット.
                                                             (line  572)
* Py_tp_str (C macro):                   PyTypeObject スロット.
                                                             (line  511)
* Py_tp_token (C macro):                 Creating Heap-Allocated Types.
                                                             (line  277)
* Py_tp_traverse (C macro):              PyTypeObject スロット.
                                                             (line 1024)
* Py_TP_USE_SPEC (C macro):              Creating Heap-Allocated Types.
                                                             (line  307)
* Py_tp_vectorcall (C macro):            PyTypeObject スロット.
                                                             (line 2092)
* Py_TPFLAGS_BASE_EXC_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  819)
* Py_TPFLAGS_BASETYPE (C macro):         PyTypeObject スロット.
                                                             (line  670)
* Py_TPFLAGS_BYTES_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  813)
* Py_TPFLAGS_DEFAULT (C macro):          PyTypeObject スロット.
                                                             (line  719)
* Py_TPFLAGS_DICT_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  817)
* Py_TPFLAGS_DISALLOW_INSTANTIATION (C macro): PyTypeObject スロット.
                                                             (line  880)
* Py_TPFLAGS_HAVE_FINALIZE (C macro):    PyTypeObject スロット.
                                                             (line  832)
* Py_TPFLAGS_HAVE_GC (C macro):          PyTypeObject スロット.
                                                             (line  698)
* Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (C macro): PyTypeObject スロット.
                                                             (line  998)
* Py_TPFLAGS_HAVE_VECTORCALL (C macro):  PyTypeObject スロット.
                                                             (line  843)
* Py_TPFLAGS_HAVE_VERSION_TAG (C macro): PyTypeObject スロット.
                                                             (line  964)
* Py_TPFLAGS_HEAPTYPE (C macro):         PyTypeObject スロット.
                                                             (line  652)
* Py_TPFLAGS_IMMUTABLETYPE (C macro):    PyTypeObject スロット.
                                                             (line  866)
* Py_TPFLAGS_INLINE_VALUES (C macro):    PyTypeObject スロット.
                                                             (line  970)
* Py_TPFLAGS_IS_ABSTRACT (C macro):      PyTypeObject スロット.
                                                             (line  984)
* Py_TPFLAGS_ITEMS_AT_END (C macro):     PyTypeObject スロット.
                                                             (line  787)
* Py_TPFLAGS_LIST_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  809)
* Py_TPFLAGS_LONG_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  807)
* Py_TPFLAGS_MANAGED_DICT (C macro):     PyTypeObject スロット.
                                                             (line  755)
* Py_TPFLAGS_MANAGED_WEAKREF (C macro):  PyTypeObject スロット.
                                                             (line  775)
* Py_TPFLAGS_MAPPING (C macro):          PyTypeObject スロット.
                                                             (line  908)
* Py_TPFLAGS_METHOD_DESCRIPTOR (C macro): PyTypeObject スロット.
                                                             (line  730)
* Py_TPFLAGS_READY (C macro):            PyTypeObject スロット.
                                                             (line  680)
* Py_TPFLAGS_READYING (C macro):         PyTypeObject スロット.
                                                             (line  689)
* Py_TPFLAGS_SEQUENCE (C macro):         PyTypeObject スロット.
                                                             (line  932)
* Py_TPFLAGS_TUPLE_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  811)
* Py_TPFLAGS_TYPE_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  821)
* Py_TPFLAGS_UNICODE_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  815)
* Py_TPFLAGS_VALID_VERSION_TAG (C macro): PyTypeObject スロット.
                                                             (line  956)
* 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 API.
                                                             (line   28)
* Py_tss_t (C type):                     Thread-specific storage API.
                                                             (line   18)
* 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):          APIs.               (line   31)
* Py_UnbufferedStdioFlag (C var):        グローバルな設定変数.
                                                             (line  231)
* 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  217)
* PY_VECTORCALL_ARGUMENTS_OFFSET (C macro): The Vectorcall Protocol.
                                                             (line   69)
* Py_VerboseFlag (C var):                グローバルな設定変数.
                                                             (line  244)
* 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  254)
* 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<4>.  (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   87)
* PyByteArray_AS_STRING (C function):    マクロ.             (line    9)
* PyByteArray_AsString (C function):     ダイレクト API 関数.
                                                             (line   45)
* PyByteArray_Check (C function):        型チェックマクロ.   (line    6)
* PyByteArray_CheckExact (C function):   型チェックマクロ.   (line   12)
* PyByteArray_Concat (C function):       ダイレクト API 関数.
                                                             (line   26)
* PyByteArray_FromObject (C function):   ダイレクト API 関数.
                                                             (line    6)
* PyByteArray_FromStringAndSize (C function): ダイレクト API 関数.
                                                             (line   18)
* PyByteArray_GET_SIZE (C function):     マクロ.             (line   18)
* PyByteArray_Resize (C function):       ダイレクト API 関数.
                                                             (line   55)
* PyByteArray_Size (C function):         ダイレクト API 関数.
                                                             (line   39)
* 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  140)
* PyBytes_AsString (C function):         バイトオブジェクト<2>.
                                                             (line  128)
* PyBytes_AsStringAndSize (C function):  バイトオブジェクト<2>.
                                                             (line  145)
* PyBytes_Check (C function):            バイトオブジェクト<2>.
                                                             (line   20)
* PyBytes_CheckExact (C function):       バイトオブジェクト<2>.
                                                             (line   25)
* PyBytes_Concat (C function):           バイトオブジェクト<2>.
                                                             (line  168)
* PyBytes_ConcatAndDel (C function):     バイトオブジェクト<2>.
                                                             (line  181)
* PyBytes_DecodeEscape (C function):     バイトオブジェクト<2>.
                                                             (line  248)
* PyBytes_FromFormat (C function):       バイトオブジェクト<2>.
                                                             (line   45)
* PyBytes_FromFormatV (C function):      バイトオブジェクト<2>.
                                                             (line  103)
* PyBytes_FromObject (C function):       バイトオブジェクト<2>.
                                                             (line  109)
* PyBytes_FromString (C function):       バイトオブジェクト<2>.
                                                             (line   30)
* PyBytes_FromStringAndSize (C function): バイトオブジェクト<2>.
                                                             (line   37)
* PyBytes_GET_SIZE (C function):         バイトオブジェクト<2>.
                                                             (line  124)
* PyBytes_Join (C function):             バイトオブジェクト<2>.
                                                             (line  193)
* PyBytes_Repr (C function):             バイトオブジェクト<2>.
                                                             (line  228)
* PyBytes_Size (C function):             バイトオブジェクト<2>.
                                                             (line  119)
* 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   83)
* PyCapsule_GetDestructor (C function):  カプセル<2>.        (line   71)
* PyCapsule_GetName (C function):        カプセル<2>.        (line   94)
* PyCapsule_GetPointer (C function):     カプセル<2>.        (line   59)
* PyCapsule_Import (C function):         カプセル<2>.        (line  105)
* PyCapsule_IsValid (C function):        カプセル<2>.        (line  128)
* PyCapsule_New (C function):            カプセル<2>.        (line   38)
* PyCapsule_SetContext (C function):     カプセル<2>.        (line  145)
* PyCapsule_SetDestructor (C function):  カプセル<2>.        (line  154)
* PyCapsule_SetName (C function):        カプセル<2>.        (line  162)
* PyCapsule_SetPointer (C function):     カプセル<2>.        (line  173)
* 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  271)
* PyCFunction_CheckExact (C function):   Implementing functions and methods.
                                                             (line  276)
* PyCFunction_GET_FLAGS (C function):    Implementing functions and methods.
                                                             (line  302)
* PyCFunction_GET_FUNCTION (C function): Implementing functions and methods.
                                                             (line  318)
* PyCFunction_GET_SELF (C function):     Implementing functions and methods.
                                                             (line  337)
* PyCFunction_GetFlags (C function):     Implementing functions and methods.
                                                             (line  292)
* PyCFunction_GetFunction (C function):  Implementing functions and methods.
                                                             (line  307)
* PyCFunction_GetSelf (C function):      Implementing functions and methods.
                                                             (line  323)
* PyCFunction_New (C function):          Implementing functions and methods.
                                                             (line  286)
* PyCFunction_NewEx (C function):        Implementing functions and methods.
                                                             (line  281)
* PyCFunction_Type (C var):              Implementing functions and methods.
                                                             (line  266)
* 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  229)
* PyCMethod_CheckExact (C function):     Implementing functions and methods.
                                                             (line  234)
* PyCMethod_New (C function):            Implementing functions and methods.
                                                             (line  239)
* PyCMethod_Type (C var):                Implementing functions and methods.
                                                             (line  223)
* 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):     Complex Numbers as Python Objects.
                                                             (line   68)
* PyComplex_Check (C function):          Complex Numbers as Python Objects.
                                                             (line   16)
* PyComplex_CheckExact (C function):     Complex Numbers as Python Objects.
                                                             (line   21)
* PyComplex_FromCComplex (C function):   Complex Numbers as Python Objects.
                                                             (line   26)
* PyComplex_FromDoubles (C function):    Complex Numbers as Python Objects.
                                                             (line   32)
* PyComplex_ImagAsDouble (C function):   Complex Numbers as Python Objects.
                                                             (line   53)
* PyComplex_RealAsDouble (C function):   Complex Numbers as Python Objects.
                                                             (line   38)
* PyComplex_Type (C var):                Complex Numbers as Python Objects.
                                                             (line   11)
* PyComplexObject (C type):              Complex Numbers as Python Objects.
                                                             (line    6)
* PyConfig (C type):                     PyConfig.           (line    6)
* PyConfig_Clear (C function):           PyConfig.           (line   94)
* 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 1014)
* PyConfig.argv (C member):              PyConfig.           (line  124)
* PyConfig.base_exec_prefix (C member):  PyConfig.           (line  168)
* PyConfig.base_executable (C member):   PyConfig.           (line  178)
* PyConfig.base_prefix (C member):       PyConfig.           (line  192)
* PyConfig.buffered_stdio (C member):    PyConfig.           (line  202)
* PyConfig.bytes_warning (C member):     PyConfig.           (line  215)
* PyConfig.check_hash_pycs_mode (C member): PyConfig.        (line  252)
* PyConfig.code_debug_ranges (C member): PyConfig.           (line  238)
* PyConfig.configure_c_stdio (C member): PyConfig.           (line  272)
* PyConfig.cpu_count (C member):         PyConfig.           (line  509)
* PyConfig.dev_mode (C member):          PyConfig.           (line  287)
* PyConfig.dump_refs (C member):         PyConfig.           (line  296)
* PyConfig.dump_refs_file (C member):    PyConfig.           (line  310)
* PyConfig.exec_prefix (C member):       PyConfig.           (line  321)
* PyConfig.executable (C member):        PyConfig.           (line  333)
* PyConfig.faulthandler (C member):      PyConfig.           (line  344)
* PyConfig.filesystem_encoding (C member): PyConfig.         (line  356)
* PyConfig.filesystem_errors (C member): PyConfig.           (line  389)
* PyConfig.hash_seed (C member):         PyConfig.           (line  421)
* PyConfig.home (C member):              PyConfig.           (line  436)
* PyConfig.import_time (C member):       PyConfig.           (line  447)
* PyConfig.inspect (C member):           PyConfig.           (line  460)
* PyConfig.install_signal_handlers (C member): PyConfig.     (line  475)
* PyConfig.int_max_str_digits (C member): PyConfig.          (line  489)
* PyConfig.interactive (C member):       PyConfig.           (line  481)
* PyConfig.isolated (C member):          PyConfig.           (line  523)
* PyConfig.legacy_windows_stdio (C member): PyConfig.        (line  548)
* PyConfig.malloc_stats (C member):      PyConfig.           (line  565)
* PyConfig.module_search_paths (C member): PyConfig.         (line  609)
* PyConfig.module_search_paths_set (C member): PyConfig.     (line  612)
* PyConfig.optimization_level (C member): PyConfig.          (line  626)
* PyConfig.orig_argv (C member):         PyConfig.           (line  642)
* PyConfig.parse_argv (C member):        PyConfig.           (line  659)
* PyConfig.parser_debug (C member):      PyConfig.           (line  679)
* PyConfig.pathconfig_warnings (C member): PyConfig.         (line  693)
* PyConfig.perf_profiling (C member):    PyConfig.           (line  886)
* PyConfig.platlibdir (C member):        PyConfig.           (line  578)
* PyConfig.prefix (C member):            PyConfig.           (line  705)
* PyConfig.program_name (C member):      PyConfig.           (line  716)
* PyConfig.pycache_prefix (C member):    PyConfig.           (line  737)
* PyConfig.pythonpath_env (C member):    PyConfig.           (line  598)
* PyConfig.quiet (C member):             PyConfig.           (line  750)
* PyConfig.run_command (C member):       PyConfig.           (line  759)
* PyConfig.run_filename (C member):      PyConfig.           (line  767)
* PyConfig.run_module (C member):        PyConfig.           (line  781)
* PyConfig.run_presite (C member):       PyConfig.           (line  789)
* PyConfig.safe_path (C member):         PyConfig.           (line  146)
* PyConfig.show_ref_count (C member):    PyConfig.           (line  803)
* PyConfig.site_import (C member):       PyConfig.           (line  815)
* PyConfig.skip_source_first_line (C member): PyConfig.      (line  834)
* PyConfig.stdio_encoding (C member):    PyConfig.           (line  846)
* PyConfig.stdio_errors (C member):      PyConfig.           (line  848)
* PyConfig.stdlib_dir (C member):        PyConfig.           (line  913)
* PyConfig.tracemalloc (C member):       PyConfig.           (line  875)
* PyConfig.use_environment (C member):   PyConfig.           (line  921)
* PyConfig.use_frozen_modules (C member): PyConfig.          (line  411)
* PyConfig.use_hash_seed (C member):     PyConfig.           (line  423)
* PyConfig.use_system_logger (C member): PyConfig.           (line  932)
* PyConfig.user_site_directory (C member): PyConfig.         (line  944)
* PyConfig.verbose (C member):           PyConfig.           (line  957)
* PyConfig.warn_default_encoding (C member): PyConfig.       (line  228)
* PyConfig.warnoptions (C member):       PyConfig.           (line  974)
* PyConfig.write_bytecode (C member):    PyConfig.           (line  994)
* PyConfig.xoptions (C member):          PyConfig.           (line 1007)
* 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 Objects. (line  428)
* PyDict_Check (C function):             Dictionary Objects. (line   16)
* PyDict_CheckExact (C function):        Dictionary Objects. (line   21)
* PyDict_Clear (C function):             Dictionary Objects. (line   48)
* PyDict_ClearWatcher (C function):      Dictionary Objects. (line  443)
* PyDict_Contains (C function):          Dictionary Objects. (line   53)
* PyDict_ContainsString (C function):    Dictionary Objects. (line   64)
* PyDict_Copy (C function):              Dictionary Objects. (line   71)
* PyDict_DelItem (C function):           Dictionary Objects. (line   97)
* PyDict_DelItemString (C function):     Dictionary Objects. (line  110)
* PyDict_GET_SIZE (C function):          Dictionary Objects. (line  304)
* PyDict_GetItem (C function):           Dictionary Objects. (line  139)
* PyDict_GetItemRef (C function):        Dictionary Objects. (line  116)
* PyDict_GetItemString (C function):     Dictionary Objects. (line  178)
* PyDict_GetItemStringRef (C function):  Dictionary Objects. (line  198)
* PyDict_GetItemWithError (C function):  Dictionary Objects. (line  163)
* PyDict_Items (C function):             Dictionary Objects. (line  282)
* PyDict_Keys (C function):              Dictionary Objects. (line  287)
* PyDict_Merge (C function):             Dictionary Objects. (line  375)
* PyDict_MergeFromSeq2 (C function):     Dictionary Objects. (line  407)
* PyDict_New (C function):               Dictionary Objects. (line   26)
* PyDict_Next (C function):              Dictionary Objects. (line  308)
* PyDict_Pop (C function):               Dictionary Objects. (line  250)
* PyDict_PopString (C function):         Dictionary Objects. (line  274)
* PyDict_SetDefault (C function):        Dictionary Objects. (line  207)
* PyDict_SetDefaultRef (C function):     Dictionary Objects. (line  225)
* PyDict_SetItem (C function):           Dictionary Objects. (line   76)
* PyDict_SetItemString (C function):     Dictionary Objects. (line   90)
* PyDict_Size (C function):              Dictionary Objects. (line  297)
* PyDict_Type (C var):                   Dictionary Objects. (line   11)
* PyDict_Unwatch (C function):           Dictionary Objects. (line  466)
* PyDict_Update (C function):            Dictionary Objects. (line  392)
* PyDict_Values (C function):            Dictionary Objects. (line  292)
* PyDict_Watch (C function):             Dictionary Objects. (line  457)
* PyDict_WatchCallback (C type):         Dictionary Objects. (line  485)
* PyDict_WatchEvent (C type):            Dictionary Objects. (line  476)
* 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 Objects. (line    6)
* PyDictProxy_New (C function):          Dictionary Objects. (line   31)
* PyDictProxy_Type (C var):              Dictionary Objects. (line   38)
* 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  155)
* pydll (ctypes モジュール):             共有ライブラリをロードする.
                                                             (line  220)
* PyDoc_STR (C macro):                   Docstring macros.   (line   24)
* PyDoc_STRVAR (C macro):                Docstring macros.   (line    6)
* PyDoc_VAR (C macro):                   Docstring macros.   (line   37)
* PyDTrace_AUDIT (C function):           C Entry Points.     (line   50)
* PyDTrace_AUDIT_ENABLED (C function):   C Probing Checks.   (line   28)
* PyDTrace_FUNCTION_ENTRY (C function):  C Entry Points.     (line   20)
* PyDTrace_FUNCTION_ENTRY_ENABLED (C function): C Probing Checks.
                                                             (line    8)
* PyDTrace_FUNCTION_RETURN (C function): C Entry Points.     (line   23)
* PyDTrace_FUNCTION_RETURN_ENABLED (C function): C Probing Checks.
                                                             (line   10)
* PyDTrace_GC_DONE (C function):         C Entry Points.     (line   29)
* PyDTrace_GC_DONE_ENABLED (C function): C Probing Checks.   (line   14)
* PyDTrace_GC_START (C function):        C Entry Points.     (line   26)
* PyDTrace_GC_START_ENABLED (C function): C Probing Checks.  (line   12)
* PyDTrace_IMPORT_FIND_LOAD_DONE (C function): C Entry Points.
                                                             (line   47)
* PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED (C function): C Probing Checks.
                                                             (line   26)
* PyDTrace_IMPORT_FIND_LOAD_START (C function): C Entry Points.
                                                             (line   44)
* PyDTrace_IMPORT_FIND_LOAD_START_ENABLED (C function): C Probing Checks.
                                                             (line   24)
* PyDTrace_INSTANCE_DELETE_DONE (C function): C Entry Points.
                                                             (line   41)
* PyDTrace_INSTANCE_DELETE_DONE_ENABLED (C function): C Probing Checks.
                                                             (line   22)
* PyDTrace_INSTANCE_DELETE_START (C function): C Entry Points.
                                                             (line   38)
* PyDTrace_INSTANCE_DELETE_START_ENABLED (C function): C Probing Checks.
                                                             (line   20)
* PyDTrace_INSTANCE_NEW_DONE (C function): C Entry Points.   (line   35)
* PyDTrace_INSTANCE_NEW_DONE_ENABLED (C function): C Probing Checks.
                                                             (line   18)
* PyDTrace_INSTANCE_NEW_START (C function): C Entry Points.  (line   32)
* PyDTrace_INSTANCE_NEW_START_ENABLED (C function): C Probing Checks.
                                                             (line   16)
* PyDTrace_LINE (C function):            C Entry Points.     (line   17)
* PyDTrace_LINE_ENABLED (C function):    C Probing Checks.   (line    6)
* 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  224)
* 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  241)
* PyErr_ProgramTextObject (C function):  例外の送出.         (line  231)
* PyErr_RangedSyntaxLocationObject (C function): 例外の送出. (line  198)
* PyErr_ResourceWarning (C function):    警告<3>.            (line   79)
* 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  179)
* PyErr_SetInterrupt (C function):       シグナルハンドリング<2>.
                                                             (line   50)
* PyErr_SetInterruptEx (C function):     シグナルハンドリング<2>.
                                                             (line   60)
* 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  218)
* PyErr_SyntaxLocationEx (C function):   例外の送出.         (line  208)
* PyErr_SyntaxLocationObject (C function): 例外の送出.       (line  189)
* PyErr_WarnEx (C function):             警告<3>.            (line   17)
* PyErr_WarnExplicit (C function):       警告<3>.            (line   50)
* PyErr_WarnExplicitFormat (C function): 警告<3>.            (line   69)
* PyErr_WarnExplicitObject (C function): 警告<3>.            (line   38)
* PyErr_WarnFormat (C function):         警告<3>.            (line   60)
* PyErr_WriteUnraisable (C function):    出力とクリア.       (line   35)
* PyEval_AcquireThread (C function):     低水準 API.         (line  142)
* PyEval_AcquireThread():                高水準 API.         (line   19)
* 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   18)
* PyEval_InitThreads():                  インタープリタの初期化と終了処理<2>.
                                                             (line    7)
* PyEval_MergeCompilerFlags (C function): 超高水準レイヤ.    (line  300)
* PyEval_ReleaseThread (C function):     低水準 API.         (line  167)
* PyEval_ReleaseThread():                高水準 API.         (line   19)
* PyEval_RestoreThread (C function):     Detaching the thread state from extension code.
                                                             (line   32)
* PyEval_RestoreThread (C function) <1>: 高水準 API.         (line   41)
* PyEval_RestoreThread():                高水準 API.         (line   19)
* PyEval_SaveThread (C function):        Detaching the thread state from extension code.
                                                             (line   32)
* PyEval_SaveThread (C function) <1>:    高水準 API.         (line   36)
* PyEval_SaveThread():                   高水準 API.         (line   19)
* 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):            File objects.       (line   15)
* PyFile_GetLine (C function):           File objects.       (line   41)
* PyFile_NewStdPrinter (C function):     Soft-deprecated API.
                                                             (line   12)
* PyFile_OpenCode (C function):          File objects.       (line  107)
* PyFile_OpenCodeObject (C function):    File objects.       (line   91)
* PyFile_SetOpenCodeHook (C function):   File objects.       (line   54)
* PyFile_WriteObject (C function):       File objects.       (line  114)
* PyFile_WriteString (C function):       File objects.       (line  127)
* PyFilter_Type (C var):                 Builtin Iterator Types.
                                                             (line   16)
* PyFloat_AS_DOUBLE (C function):        Floating-Point Objects.
                                                             (line   49)
* PyFloat_AsDouble (C function):         Floating-Point Objects.
                                                             (line   36)
* 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   31)
* PyFloat_FromString (C function):       Floating-Point Objects.
                                                             (line   26)
* PyFloat_GetInfo (C function):          Floating-Point Objects.
                                                             (line   54)
* PyFloat_GetMax (C function):           Floating-Point Objects.
                                                             (line   59)
* PyFloat_GetMin (C function):           Floating-Point Objects.
                                                             (line   63)
* 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   20)
* PyFrame_FastToLocalsWithError (C function): Legacy local variable APIs.
                                                             (line   30)
* 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   89)
* 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):         GIL-state APIs.     (line   88)
* PyGILState_Ensure (C function):        GIL-state APIs.     (line   24)
* PyGILState_GetThisThreadState (C function): GIL-state APIs.
                                                             (line   69)
* PyGILState_Release (C function):       GIL-state APIs.     (line   58)
* PyGILState_STATE (C type):             GIL-state APIs.     (line    9)
* PyGILState_STATE.PyGILState_LOCKED (C enumerator): GIL-state APIs.
                                                             (line   14)
* PyGILState_STATE.PyGILState_UNLOCKED (C enumerator): GIL-state APIs.
                                                             (line   19)
* 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):        Initialization function.
                                                             (line    9)
* 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):          Multiple interpreters in a Python process.
                                                             (line   21)
* PyInterpreterConfig_DEFAULT_GIL (C macro): Multiple interpreters in a Python process.
                                                             (line   90)
* PyInterpreterConfig_OWN_GIL (C macro): Multiple interpreters in a Python process.
                                                             (line   99)
* PyInterpreterConfig_SHARED_GIL (C macro): Multiple interpreters in a Python process.
                                                             (line   95)
* PyInterpreterConfig.allow_daemon_threads (C member): Multiple interpreters in a Python process.
                                                             (line   66)
* PyInterpreterConfig.allow_exec (C member): Multiple interpreters in a Python process.
                                                             (line   51)
* PyInterpreterConfig.allow_fork (C member): Multiple interpreters in a Python process.
                                                             (line   42)
* PyInterpreterConfig.allow_threads (C member): Multiple interpreters in a Python process.
                                                             (line   61)
* PyInterpreterConfig.check_multi_interp_extensions (C member): Multiple interpreters in a Python process.
                                                             (line   73)
* PyInterpreterConfig.gil (C member):    Multiple interpreters in a Python process.
                                                             (line   85)
* PyInterpreterConfig.use_main_obmalloc (C member): Multiple interpreters in a Python process.
                                                             (line   32)
* PyInterpreterState (C type):           高水準 API<2>.      (line    6)
* PyInterpreterState_Clear (C function): 低水準 API<2>.      (line   21)
* PyInterpreterState_Delete (C function): 低水準 API<2>.     (line   29)
* PyInterpreterState_Get (C function):   高水準 API<2>.      (line   22)
* PyInterpreterState_GetDict (C function): 高水準 API<2>.    (line   42)
* PyInterpreterState_GetID (C function): 高水準 API<2>.      (line   32)
* PyInterpreterState_Head (C function):  Advanced debugger support.
                                                             (line    8)
* PyInterpreterState_Main (C function):  Advanced debugger support.
                                                             (line   13)
* PyInterpreterState_New (C function):   低水準 API<2>.      (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<19>.        (line   24)
* PYLAUNCHER_ALLOW_INSTALL <1>:          Windows<33>.        (line   15)
* PyList_Append (C function):            リストオブジェクト. (line  132)
* PyList_AsTuple (C function):           リストオブジェクト. (line  210)
* PyList_Check (C function):             リストオブジェクト. (line   16)
* PyList_CheckExact (C function):        リストオブジェクト. (line   21)
* PyList_Clear (C function):             リストオブジェクト. (line  180)
* PyList_Extend (C function):            リストオブジェクト. (line  161)
* PyList_GET_ITEM (C function):          リストオブジェクト. (line   77)
* PyList_GET_SIZE (C function):          リストオブジェクト. (line   47)
* PyList_GetItem (C function):           参照カウントの詳細. (line  115)
* PyList_GetItem (C function) <1>:       リストオブジェクト. (line   63)
* PyList_GetItemRef (C function):        リストオブジェクト. (line   51)
* PyList_GetSlice (C function):          リストオブジェクト. (line  138)
* PyList_Insert (C function):            リストオブジェクト. (line  124)
* PyList_New (C function):               リストオブジェクト. (line   26)
* PyList_Reverse (C function):           リストオブジェクト. (line  204)
* PyList_SET_ITEM (C function):          リストオブジェクト. (line  101)
* PyList_SetItem (C function):           参照カウントの詳細. (line   26)
* PyList_SetItem (C function) <1>:       リストオブジェクト. (line   89)
* PyList_SetSlice (C function):          リストオブジェクト. (line  146)
* PyList_Size (C function):              リストオブジェクト. (line   40)
* PyList_Sort (C function):              リストオブジェクト. (line  191)
* 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   13)
* PyLong_AS_LONG (C function):           整数型オブジェクト integer object.
                                                             (line  183)
* PyLong_AsDouble (C function):          整数型オブジェクト integer object.
                                                             (line  394)
* PyLong_AsInt (C function):             整数型オブジェクト integer object.
                                                             (line  191)
* PyLong_AsInt32 (C function):           整数型オブジェクト integer object.
                                                             (line  352)
* PyLong_AsInt64 (C function):           整数型オブジェクト integer object.
                                                             (line  352)
* PyLong_AsLong (C function):            整数型オブジェクト integer object.
                                                             (line  163)
* PyLong_AsLongAndOverflow (C function): 整数型オブジェクト integer object.
                                                             (line  198)
* PyLong_AsLongLong (C function):        整数型オブジェクト integer object.
                                                             (line  219)
* PyLong_AsLongLongAndOverflow (C function): 整数型オブジェクト integer object.
                                                             (line  239)
* PyLong_AsNativeBytes (C function):     整数型オブジェクト integer object.
                                                             (line  415)
* PyLong_AsPid (C macro):                整数型オブジェクト integer object.
                                                             (line  577)
* PyLong_AsSize_t (C function):          整数型オブジェクト integer object.
                                                             (line  286)
* PyLong_AsSsize_t (C function):         整数型オブジェクト integer object.
                                                             (line  262)
* PyLong_AsUInt32 (C function):          整数型オブジェクト integer object.
                                                             (line  372)
* PyLong_AsUInt64 (C function):          整数型オブジェクト integer object.
                                                             (line  372)
* PyLong_AsUnsignedLong (C function):    整数型オブジェクト integer object.
                                                             (line  274)
* PyLong_AsUnsignedLongLong (C function): 整数型オブジェクト integer object.
                                                             (line  298)
* PyLong_AsUnsignedLongLongMask (C function): 整数型オブジェクト integer object.
                                                             (line  333)
* PyLong_AsUnsignedLongMask (C function): 整数型オブジェクト integer object.
                                                             (line  315)
* PyLong_AsVoidPtr (C function):         整数型オブジェクト integer object.
                                                             (line  405)
* 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   68)
* PyLong_FromInt64 (C function):         整数型オブジェクト integer object.
                                                             (line   68)
* PyLong_FromLong (C function):          整数型オブジェクト integer object.
                                                             (line   31)
* PyLong_FromLongLong (C function):      整数型オブジェクト integer object.
                                                             (line   57)
* PyLong_FromNativeBytes (C function):   整数型オブジェクト integer object.
                                                             (line  124)
* PyLong_FromPid (C macro):              整数型オブジェクト integer object.
                                                             (line  153)
* 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  112)
* PyLong_FromUnsignedLong (C function):  整数型オブジェクト integer object.
                                                             (line   41)
* PyLong_FromUnsignedLongLong (C function): 整数型オブジェクト integer object.
                                                             (line   62)
* PyLong_FromUnsignedNativeBytes (C function): 整数型オブジェクト integer object.
                                                             (line  140)
* PyLong_FromVoidPtr (C function):       整数型オブジェクト integer object.
                                                             (line  119)
* PyLong_GetInfo (C function):           整数型オブジェクト integer object.
                                                             (line  629)
* PyLong_GetNativeLayout (C function):   Export API.         (line   46)
* PyLong_GetSign (C function):           整数型オブジェクト integer object.
                                                             (line  587)
* PyLong_IsNegative (C function):        整数型オブジェクト integer object.
                                                             (line  609)
* PyLong_IsPositive (C function):        整数型オブジェクト integer object.
                                                             (line  599)
* PyLong_IsZero (C function):            整数型オブジェクト integer object.
                                                             (line  619)
* 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   33)
* PyMem_Del (C function):                メモリインターフェース.
                                                             (line   89)
* 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   61)
* PyMem_FREE (C macro):                  非推奨のエイリアス<2>.
                                                             (line   25)
* PyMem_GetAllocator (C function):       メモリアロケータをカスタマイズする.
                                                             (line   78)
* PyMem_Malloc (C function):             メモリインターフェース.
                                                             (line   24)
* PyMem_MALLOC (C macro):                非推奨のエイリアス<2>.
                                                             (line   13)
* PyMem_New (C macro):                   メモリインターフェース.
                                                             (line   73)
* PyMem_NEW (C macro):                   非推奨のエイリアス<2>.
                                                             (line   16)
* PyMem_RawCalloc (C function):          生メモリインターフェース.
                                                             (line   25)
* PyMem_RawFree (C function):            生メモリインターフェース.
                                                             (line   53)
* PyMem_RawMalloc (C function):          生メモリインターフェース.
                                                             (line   16)
* PyMem_RawRealloc (C function):         生メモリインターフェース.
                                                             (line   37)
* PyMem_Realloc (C function):            メモリインターフェース.
                                                             (line   45)
* PyMem_REALLOC (C macro):               非推奨のエイリアス<2>.
                                                             (line   19)
* PyMem_Resize (C macro):                メモリインターフェース.
                                                             (line   79)
* 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):              Initialization function.
                                                             (line   31)
* PyModule_Add (C function):             サポート関数.       (line   63)
* PyModule_AddFunctions (C function):    サポート関数.       (line  158)
* PyModule_AddIntConstant (C function):  サポート関数.       (line  112)
* PyModule_AddIntMacro (C macro):        サポート関数.       (line  135)
* PyModule_AddObject (C function):       サポート関数.       (line   79)
* PyModule_AddObjectRef (C function):    サポート関数.       (line   11)
* PyModule_AddStringConstant (C function): サポート関数.     (line  123)
* PyModule_AddStringMacro (C macro):     サポート関数.       (line  143)
* PyModule_AddType (C function):         サポート関数.       (line  147)
* 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  180)
* 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   13)
* PyModuleDef_Type (C var):              Module definitions. (line  138)
* 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   38)
* 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   34)
* PyModuleDef.m_size (C member):         Module definitions. (line   43)
* 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   39)
* PyMutex_Lock (C function):             同期プリミティブ<3>.
                                                             (line   25)
* PyMutex_Unlock (C function):           同期プリミティブ<3>.
                                                             (line   33)
* 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  339)
* PyObject_AsFileDescriptor (C function): File objects.      (line   33)
* PyObject_Bytes (C function):           オブジェクトプロトコル object protocol.
                                                             (line  363)
* 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   63)
* PyObject_CallObject (C function) <1>:  Object Calling API. (line   94)
* PyObject_Calloc (C function):          オブジェクトアロケータ.
                                                             (line   31)
* PyObject_CallOneArg (C function):      Object Calling API. (line   84)
* PyObject_CheckBuffer (C function):     バッファ関連の関数. (line    6)
* PyObject_ClearManagedDict (C function): オブジェクトプロトコル object protocol.
                                                             (line  589)
* PyObject_ClearWeakRefs (C function):   弱参照オブジェクト<2>.
                                                             (line  113)
* PyObject_CopyData (C function):        バッファ関連の関数. (line   83)
* PyObject_DEL (C macro):                Soft-deprecated aliases.
                                                             (line   36)
* PyObject_Del (C macro):                Soft-deprecated aliases.
                                                             (line   39)
* PyObject_DelAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  238)
* PyObject_DelAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  244)
* PyObject_DelItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  494)
* PyObject_DelItemString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  499)
* PyObject_Dir (C function):             オブジェクトプロトコル object protocol.
                                                             (line  504)
* PyObject_Format (C function):          オブジェクトプロトコル object protocol.
                                                             (line  316)
* PyObject_Free (C function):            オブジェクトアロケータ.
                                                             (line   60)
* PyObject_FREE (C macro):               Soft-deprecated aliases.
                                                             (line   33)
* 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  526)
* 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  481)
* PyObject_GetItemData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  568)
* PyObject_GetIter (C function):         オブジェクトプロトコル object protocol.
                                                             (line  513)
* PyObject_GetOptionalAttr (C function): オブジェクトプロトコル object protocol.
                                                             (line  163)
* PyObject_GetOptionalAttrString (C function): オブジェクトプロトコル object protocol.
                                                             (line  178)
* PyObject_GetTypeData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  537)
* 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  418)
* PyObject_HashNotImplemented (C function): オブジェクトプロトコル object protocol.
                                                             (line  427)
* 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):            Allocating objects on the heap.
                                                             (line   13)
* PyObject_INIT (C macro):               Soft-deprecated aliases.
                                                             (line   21)
* PyObject_INIT_VAR (C macro):           Soft-deprecated aliases.
                                                             (line   24)
* PyObject_InitVar (C function):         Allocating objects on the heap.
                                                             (line   32)
* PyObject_IS_GC (C function):           循環参照ガベージコレクションをサポートする.
                                                             (line  153)
* PyObject_IsInstance (C function):      オブジェクトプロトコル object protocol.
                                                             (line  396)
* PyObject_IsSubclass (C function):      オブジェクトプロトコル object protocol.
                                                             (line  375)
* PyObject_IsTrue (C function):          オブジェクトプロトコル object protocol.
                                                             (line  435)
* PyObject_Length (C function):          オブジェクトプロトコル object protocol.
                                                             (line  462)
* PyObject_LengthHint (C function):      オブジェクトプロトコル object protocol.
                                                             (line  471)
* PyObject_Malloc (C function):          オブジェクトアロケータ.
                                                             (line   22)
* PyObject_MALLOC (C macro):             Soft-deprecated aliases.
                                                             (line   27)
* PyObject_New (C macro):                Allocating objects on the heap.
                                                             (line   41)
* PyObject_NEW (C macro):                Soft-deprecated aliases.
                                                             (line   15)
* PyObject_NEW_VAR (C macro):            Soft-deprecated aliases.
                                                             (line   18)
* PyObject_NewVar (C macro):             Allocating objects on the heap.
                                                             (line   90)
* PyObject_Not (C function):             オブジェクトプロトコル object protocol.
                                                             (line  440)
* PyObject_Print (C function):           オブジェクトプロトコル object protocol.
                                                             (line   89)
* PyObject_Realloc (C function):         オブジェクトアロケータ.
                                                             (line   43)
* PyObject_REALLOC (C macro):            Soft-deprecated aliases.
                                                             (line   30)
* 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  520)
* 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  487)
* PyObject_Size (C function):            オブジェクトプロトコル object protocol.
                                                             (line  462)
* PyObject_Str (C function):             オブジェクトプロトコル object protocol.
                                                             (line  350)
* PyObject_Type (C function):            オブジェクトプロトコル object protocol.
                                                             (line  445)
* PyObject_TypeCheck (C function):       オブジェクトプロトコル object protocol.
                                                             (line  457)
* 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  579)
* 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   26)
* PyRefTracer_DESTROY (C var):           Reference tracing.  (line   31)
* PyRefTracer_GetTracer (C function):    Reference tracing.  (line   68)
* PyRefTracer_SetTracer (C function):    Reference tracing.  (line   44)
* PyRefTracer_TRACKER_REMOVED (C var):   Reference tracing.  (line   36)
* 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  132)
* PySet_Check (C function):              Set オブジェクト.   (line   42)
* PySet_CheckExact (C function):         Set オブジェクト.   (line   58)
* PySet_Clear (C function):              Set オブジェクト.   (line  174)
* PySet_Contains (C function):           Set オブジェクト.   (line  118)
* PySet_Discard (C function):            Set オブジェクト.   (line  151)
* PySet_GET_SIZE (C function):           Set オブジェクト.   (line  114)
* PySet_MINSIZE (C macro):               Deprecated API<3>.  (line    6)
* PySet_New (C function):                Set オブジェクト.   (line   76)
* PySet_Pop (C function):                Set オブジェクト.   (line  166)
* PySet_Size (C function):               Set オブジェクト.   (line  105)
* 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   86)
* 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):             Soft-deprecated API.
                                                             (line   17)
* 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  273)
* PySys_SetArgvEx (C function):          プロセスワイドのパラメータ.
                                                             (line  222)
* PySys_SetObject (C function):          システム関数.       (line   16)
* PySys_WriteStderr (C function):        システム関数.       (line   47)
* PySys_WriteStdout (C function):        システム関数.       (line   30)
* Python 3000:                           用語集<2>.          (line 1472)
* Python Editor:                         IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 0007#documentation-strings: ドキュメント<32>.
                                                             (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 1441)
* 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>: ビルド<36>.     (line   56)
* Python Enhancement Proposals; PEP 11 <12>: ビルド<36>.     (line  107)
* Python Enhancement Proposals; PEP 11 <13>: ビルド<74>.     (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  346)
* 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>: モジュールコンテンツ<3>.
                                                             (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   82)
* Python Enhancement Proposals; PEP 236 <4>: モジュールコンテンツ<3>.
                                                             (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  182)
* 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>: モジュールコンテンツ<3>.
                                                             (line   22)
* Python Enhancement Proposals; PEP 238 <5>: 用語集<2>.      (line  646)
* 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: ドキュメント<31>.   (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>: ライブラリ<81>. (line  123)
* Python Enhancement Proposals; PEP 249 <4>: ライブラリ<96>. (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>: モジュールコンテンツ<3>.
                                                             (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   98)
* Python Enhancement Proposals; PEP 263 <1>: PEP 263 ソースコードのエンコーディング.
                                                             (line   29)
* Python Enhancement Proposals; PEP 263 <2>: Core and Builtins<106>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 263 <3>: はじめに<13>.   (line   53)
* Python Enhancement Proposals; PEP 263 <4>: Tokenizing Input.
                                                             (line   33)
* Python Enhancement Proposals; PEP 263 <5>: Tokenizing Input.
                                                             (line   85)
* 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 1850)
* Python Enhancement Proposals; PEP 279: PEP 279 enumerate.  (line   28)
* Python Enhancement Proposals; PEP 282: PEP 282 ロギングパッケージ.
                                                             (line  102)
* Python Enhancement Proposals; PEP 282 <1>: PEP 282 ロギングパッケージ.
                                                             (line  108)
* Python Enhancement Proposals; PEP 282 <2>: アーカイブ化操作.
                                                             (line   48)
* 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  279)
* 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 2179)
* Python Enhancement Proposals; PEP 302 <12>: linecache --- テキストラインへのランダムアクセス.
                                                             (line   34)
* Python Enhancement Proposals; PEP 302 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1464)
* Python Enhancement Proposals; PEP 302 <14>: sys --- システム固有のパラメーターと関数.
                                                             (line 1474)
* 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  179)
* Python Enhancement Proposals; PEP 302 <24>: importlib abc -- Abstract base classes related to import.
                                                             (line  206)
* Python Enhancement Proposals; PEP 302 <25>: importlib abc -- Abstract base classes related to import.
                                                             (line  278)
* Python Enhancement Proposals; PEP 302 <26>: 用語集<2>.     (line 1097)
* 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>: Custom string formatting.
                                                             (line    8)
* Python Enhancement Proposals; PEP 3101 <5>: Custom string formatting.
                                                             (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>: モジュールコンテンツ<3>.
                                                             (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   93)
* 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>: モジュールコンテンツ<3>.
                                                             (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   72)
* Python Enhancement Proposals; PEP 3116 <2>: 用語集<2>.     (line 1850)
* 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>: ライブラリ<177>.
                                                             (line   99)
* Python Enhancement Proposals; PEP 3118 <7>: ライブラリ<182>.
                                                             (line   61)
* Python Enhancement Proposals; PEP 3118 <8>: ライブラリ<211>.
                                                             (line  958)
* Python Enhancement Proposals; PEP 3118 <9>: メモリビュー.  (line  122)
* 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   69)
* Python Enhancement Proposals; PEP 3119 <3>: abc --- 抽象基底クラス.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3119 <4>: オブジェクトプロトコル object protocol.
                                                             (line  386)
* Python Enhancement Proposals; PEP 3119 <5>: オブジェクトプロトコル object protocol.
                                                             (line  407)
* Python Enhancement Proposals; PEP 3120: Unicode 対 8 ビット、ではなく、テキスト対データに.
                                                             (line  110)
* 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>: ライブラリ<151>.
                                                             (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  112)
* Python Enhancement Proposals; PEP 3131 <1>: ライブラリ<166>.
                                                             (line  599)
* 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>: ライブラリ<96>.
                                                             (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  106)
* 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<205>.
                                                             (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>: ライブラリ<166>.
                                                             (line 1279)
* 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 1498)
* 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 2196)
* Python Enhancement Proposals; PEP 328 <8>: モジュールコンテンツ<3>.
                                                             (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>: モジュールコンテンツ<3>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 343 <7>: 用語集<2>.      (line  367)
* Python Enhancement Proposals; PEP 343 <8>: 用語集<2>.      (line  373)
* 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   64)
* Python Enhancement Proposals; PEP 353: Porting to Python 3 10<2>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 353 <1>: PEP 353 添え字型に ssize_t を使う.
                                                             (line   52)
* Python Enhancement Proposals; PEP 353 <2>: PEP 353 添え字型に ssize_t を使う.
                                                             (line   58)
* Python Enhancement Proposals; PEP 353 <3>: ビルドならびに C API の変更<10>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 353 <4>: C API<48>.      (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   88)
* Python Enhancement Proposals; PEP 362 <3>: 用語集<2>.      (line 1378)
* 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>: ライブラリ<91>. (line  603)
* Python Enhancement Proposals; PEP 370 <2>: その他のオプション.
                                                             (line  165)
* Python Enhancement Proposals; PEP 370 <3>: 環境変数.       (line  202)
* Python Enhancement Proposals; PEP 370 <4>: 環境変数.       (line  214)
* Python Enhancement Proposals; PEP 370 <5>: コマンドライン・インターフェース<11>.
                                                             (line   37)
* Python Enhancement Proposals; PEP 371: PEP 371 multiprocessing パッケージ.
                                                             (line  145)
* 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>: Format specification mini-language.
                                                             (line  151)
* 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: ドキュメント<32>.   (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<42>.      (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 Stability.
                                                             (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   99)
* 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<40>.     (line  142)
* Python Enhancement Proposals; PEP 393 <12>: エンコーディングと Unicode.
                                                             (line    7)
* Python Enhancement Proposals; PEP 393 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1362)
* 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 1033)
* Python Enhancement Proposals; PEP 411 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1043)
* Python Enhancement Proposals; PEP 411 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1833)
* Python Enhancement Proposals; PEP 411 <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 1853)
* Python Enhancement Proposals; PEP 411 <4>: 用語集<2>.      (line 1467)
* 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<190>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 420 <4>: Core and Builtins<195>.
                                                             (line  114)
* Python Enhancement Proposals; PEP 420 <5>: インポートシステム.
                                                             (line   43)
* Python Enhancement Proposals; PEP 420 <6>: 通常のパッケージ.
                                                             (line   35)
* Python Enhancement Proposals; PEP 420 <7>: 名前空間パッケージ.
                                                             (line   33)
* Python Enhancement Proposals; PEP 420 <8>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <9>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <10>: 参考資料.      (line   11)
* Python Enhancement Proposals; PEP 420 <11>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <12>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <13>: はじめに<13>.  (line   69)
* Python Enhancement Proposals; PEP 420 <14>: 用語集<2>.     (line 1247)
* Python Enhancement Proposals; PEP 420 <15>: 用語集<2>.     (line 1445)
* Python Enhancement Proposals; PEP 421: SimpleNamespace.    (line   16)
* Python Enhancement Proposals; PEP 421 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1159)
* Python Enhancement Proposals; PEP 421 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1167)
* 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<173>.
                                                             (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<55>.      (line   55)
* Python Enhancement Proposals; PEP 442 <6>: gc --- ガベージコレクターインターフェース.
                                                             (line  269)
* Python Enhancement Proposals; PEP 442 <7>: 薄氷.           (line   37)
* Python Enhancement Proposals; PEP 442 <8>: ファイナライズとメモリ解放.
                                                             (line   92)
* Python Enhancement Proposals; PEP 442 <9>: Cyclic Isolate Destruction.
                                                             (line   42)
* Python Enhancement Proposals; PEP 442 <10>: PyTypeObject スロット.
                                                             (line 2079)
* 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  770)
* 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<61>.
                                                             (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>: ドキュメント<79>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 448 <3>: ドキュメント<83>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <4>: Core and Builtins<198>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 448 <5>: Core and Builtins<201>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <6>: 辞書表示.       (line   28)
* Python Enhancement Proposals; PEP 448 <7>: 呼び出し call.  (line  117)
* 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>: ライブラリ<91>. (line  456)
* Python Enhancement Proposals; PEP 451 <6>: Core and Builtins<190>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 451 <7>: 参考資料.       (line   27)
* Python Enhancement Proposals; PEP 451 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1393)
* 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>: ライブラリ<184>.
                                                             (line   87)
* Python Enhancement Proposals; PEP 468 <2>: OrderedDict オブジェクト.
                                                             (line  107)
* 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>: ライブラリ<210>.
                                                             (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>: ライブラリ<175>.
                                                             (line  228)
* Python Enhancement Proposals; PEP 475 <4>: ライブラリ<208>.
                                                             (line  143)
* Python Enhancement Proposals; PEP 475 <5>: 組み込み関数.   (line 1493)
* Python Enhancement Proposals; PEP 475 <6>: OS 例外.        (line   81)
* Python Enhancement Proposals; PEP 475 <7>: ファイル記述子の操作.
                                                             (line  405)
* Python Enhancement Proposals; PEP 475 <8>: ファイル記述子の操作.
                                                             (line  744)
* Python Enhancement Proposals; PEP 475 <9>: ファイル記述子の操作.
                                                             (line  980)
* Python Enhancement Proposals; PEP 475 <10>: プロセス管理.  (line  933)
* Python Enhancement Proposals; PEP 475 <11>: I/O 基底クラス.
                                                             (line  191)
* Python Enhancement Proposals; PEP 475 <12>: I/O 基底クラス.
                                                             (line  297)
* Python Enhancement Proposals; PEP 475 <13>: I/O 基底クラス.
                                                             (line  315)
* Python Enhancement Proposals; PEP 475 <14>: 関数<5>.       (line  310)
* Python Enhancement Proposals; PEP 475 <15>: socket オブジェクト.
                                                             (line   85)
* Python Enhancement Proposals; PEP 475 <16>: socket オブジェクト.
                                                             (line  142)
* Python Enhancement Proposals; PEP 475 <17>: socket オブジェクト.
                                                             (line  311)
* Python Enhancement Proposals; PEP 475 <18>: socket オブジェクト.
                                                             (line  327)
* Python Enhancement Proposals; PEP 475 <19>: socket オブジェクト.
                                                             (line  406)
* Python Enhancement Proposals; PEP 475 <20>: socket オブジェクト.
                                                             (line  483)
* Python Enhancement Proposals; PEP 475 <21>: socket オブジェクト.
                                                             (line  503)
* Python Enhancement Proposals; PEP 475 <22>: socket オブジェクト.
                                                             (line  523)
* Python Enhancement Proposals; PEP 475 <23>: socket オブジェクト.
                                                             (line  569)
* Python Enhancement Proposals; PEP 475 <24>: select --- I/O 完了の待機.
                                                             (line  166)
* Python Enhancement Proposals; PEP 475 <25>: /dev/poll polling objects.
                                                             (line   83)
* Python Enhancement Proposals; PEP 475 <26>: Edge and level trigger polling epoll objects.
                                                             (line  109)
* Python Enhancement Proposals; PEP 475 <27>: Polling objects.
                                                             (line   94)
* Python Enhancement Proposals; PEP 475 <28>: Kqueue objects.
                                                             (line   37)
* Python Enhancement Proposals; PEP 475 <29>: クラス<4>.     (line  138)
* Python Enhancement Proposals; PEP 475 <30>: モジュールの内容<3>.
                                                             (line  615)
* Python Enhancement Proposals; PEP 475 <31>: モジュールの内容<3>.
                                                             (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>: ライブラリ<166>.
                                                             (line 1267)
* Python Enhancement Proposals; PEP 479 <4>: ライブラリ<170>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 479 <5>: Core and Builtins<169>.
                                                             (line   34)
* Python Enhancement Proposals; PEP 479 <6>: ライブラリ<178>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 479 <7>: ライブラリ<191>.
                                                             (line   80)
* Python Enhancement Proposals; PEP 479 <8>: ライブラリ<197>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 479 <9>: 具象例外.       (line  286)
* Python Enhancement Proposals; PEP 479 <10>: 具象例外.      (line  289)
* Python Enhancement Proposals; PEP 479 <11>: モジュールコンテンツ<3>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 483: PEP 484 - 型ヒント. (line   43)
* Python Enhancement Proposals; PEP 483 <1>: 用語集<2>.      (line  778)
* 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   57)
* Python Enhancement Proposals; PEP 484 <31>: 用語集<2>.     (line  695)
* Python Enhancement Proposals; PEP 484 <32>: 用語集<2>.     (line  778)
* Python Enhancement Proposals; PEP 484 <33>: 用語集<2>.     (line 1828)
* Python Enhancement Proposals; PEP 484 <34>: 用語集<2>.     (line 1843)
* Python Enhancement Proposals; PEP 484 <35>: 用語集<2>.     (line 1872)
* 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>: ライブラリ<206>.
                                                             (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<84>.    (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>: ドキュメント<69>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 487 <5>: ドキュメント<76>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 487 <6>: Core and Builtins<187>.
                                                             (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   83)
* Python Enhancement Proposals; PEP 488 <3>: Core and Builtins<205>.
                                                             (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>: ライブラリ<50>. (line   83)
* Python Enhancement Proposals; PEP 489 <4>: C API<18>.      (line   23)
* Python Enhancement Proposals; PEP 489 <5>: ライブラリ<59>. (line  254)
* Python Enhancement Proposals; PEP 489 <6>: ライブラリ<75>. (line   24)
* Python Enhancement Proposals; PEP 489 <7>: ライブラリ<130>.
                                                             (line   64)
* Python Enhancement Proposals; PEP 489 <8>: ライブラリ<130>.
                                                             (line   79)
* Python Enhancement Proposals; PEP 489 <9>: ライブラリ<132>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <10>: ライブラリ<133>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 489 <11>: ライブラリ<133>.
                                                             (line  177)
* Python Enhancement Proposals; PEP 489 <12>: ライブラリ<134>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <13>: ライブラリ<137>.
                                                             (line  103)
* Python Enhancement Proposals; PEP 489 <14>: C API<46>.     (line   11)
* Python Enhancement Proposals; PEP 489 <15>: C API<46>.     (line   14)
* Python Enhancement Proposals; PEP 489 <16>: C API<46>.     (line   17)
* Python Enhancement Proposals; PEP 489 <17>: C API<46>.     (line   20)
* Python Enhancement Proposals; PEP 489 <18>: C API<46>.     (line   23)
* Python Enhancement Proposals; PEP 489 <19>: C API<46>.     (line   26)
* Python Enhancement Proposals; PEP 489 <20>: C API<46>.     (line   29)
* Python Enhancement Proposals; PEP 489 <21>: C API<46>.     (line   38)
* Python Enhancement Proposals; PEP 489 <22>: C API<46>.     (line   41)
* Python Enhancement Proposals; PEP 489 <23>: C API<46>.     (line   44)
* Python Enhancement Proposals; PEP 489 <24>: C API<46>.     (line   47)
* Python Enhancement Proposals; PEP 489 <25>: ライブラリ<139>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 489 <26>: ライブラリ<140>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <27>: ライブラリ<141>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <28>: ライブラリ<141>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <29>: ライブラリ<141>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <30>: ライブラリ<141>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 489 <31>: ライブラリ<142>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <32>: ライブラリ<142>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <33>: ライブラリ<142>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <34>: ライブラリ<144>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <35>: ライブラリ<146>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <36>: ライブラリ<147>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <37>: ライブラリ<154>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <38>: ライブラリ<154>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 489 <39>: ライブラリ<154>.
                                                             (line  423)
* Python Enhancement Proposals; PEP 489 <40>: Core and Builtins<152>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <41>: Core and Builtins<152>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 489 <42>: Core and Builtins<152>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 489 <43>: Core and Builtins<153>.
                                                             (line   46)
* Python Enhancement Proposals; PEP 489 <44>: Core and Builtins<153>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 489 <45>: Core and Builtins<153>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 489 <46>: Core and Builtins<153>.
                                                             (line   71)
* Python Enhancement Proposals; PEP 489 <47>: Core and Builtins<153>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <48>: Core and Builtins<154>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 489 <49>: Core and Builtins<154>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 489 <50>: Core and Builtins<154>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 489 <51>: Core and Builtins<154>.
                                                             (line   54)
* Python Enhancement Proposals; PEP 489 <52>: Core and Builtins<154>.
                                                             (line  109)
* Python Enhancement Proposals; PEP 489 <53>: Core and Builtins<154>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 489 <54>: Core and Builtins<155>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 489 <55>: Core and Builtins<155>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 489 <56>: Core and Builtins<155>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 489 <57>: Core and Builtins<155>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 489 <58>: Core and Builtins<155>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 489 <59>: Core and Builtins<156>.
                                                             (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>: Creating extensions without third party tools.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <67>: 拡張モジュールの定義.
                                                             (line   44)
* Python Enhancement Proposals; PEP 489 <68>: Initialization function.
                                                             (line   60)
* Python Enhancement Proposals; PEP 489 <69>: Multiple interpreters in a Python process.
                                                             (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<172>.
                                                             (line   98)
* Python Enhancement Proposals; PEP 492 <7>: ライブラリ<192>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 492 <8>: ライブラリ<198>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 492 <9>: Core and Builtins<202>.
                                                             (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   94)
* Python Enhancement Proposals; PEP 492 <17>: 用語集<2>.     (line  130)
* Python Enhancement Proposals; PEP 492 <18>: 用語集<2>.     (line  137)
* Python Enhancement Proposals; PEP 492 <19>: 用語集<2>.     (line  147)
* Python Enhancement Proposals; PEP 492 <20>: 用語集<2>.     (line  198)
* Python Enhancement Proposals; PEP 492 <21>: 用語集<2>.     (line  398)
* Python Enhancement Proposals; PEP 492 <22>: 用語集<2>.     (line  406)
* 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>: ライブラリ<190>.
                                                             (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<190>.
                                                             (line  283)
* Python Enhancement Proposals; PEP 498 <3>: f-strings.      (line  150)
* Python Enhancement Proposals; PEP 498 <4>: 用語集<2>.      (line  584)
* 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>: ライブラリ<193>.
                                                             (line   60)
* Python Enhancement Proposals; PEP 506 <2>: secrets --- 機密を扱うために安全な乱数を生成する.
                                                             (line   23)
* Python Enhancement Proposals; PEP 509: C API<18>.          (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<33>.    (line   13)
* Python Enhancement Proposals; PEP 514 <2>: Windows<76>.    (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<186>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 515 <4>: Core and Builtins<186>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 515 <5>: Format specification mini-language.
                                                             (line  154)
* Python Enhancement Proposals; PEP 515 <6>: fractions --- 有理数.
                                                             (line   93)
* Python Enhancement Proposals; PEP 519: PEP 519 ファイルシステムパスプロトコルの追加.
                                                             (line   62)
* Python Enhancement Proposals; PEP 519 <1>: ライブラリ<190>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 519 <2>: Core and Builtins<189>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 519 <3>: ライブラリ<192>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 519 <4>: ライブラリ<192>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 519 <5>: ライブラリ<192>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 519 <6>: C API<76>.      (line    6)
* Python Enhancement Proposals; PEP 519 <7>: 用語集<2>.      (line 1426)
* 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<64>.
                                                             (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<186>.
                                                             (line   83)
* Python Enhancement Proposals; PEP 523 <9>: Internal frames.
                                                             (line    6)
* Python Enhancement Proposals; PEP 523 <10>: 高水準 API<2>. (line   79)
* Python Enhancement Proposals; PEP 523 <11>: 高水準 API<2>. (line   88)
* 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>: ライブラリ<189>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 524 <4>: ライブラリ<189>.
                                                             (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<186>.
                                                             (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 1030)
* Python Enhancement Proposals; PEP 525 <5>: sys --- システム固有のパラメーターと関数.
                                                             (line 1828)
* 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  112)
* Python Enhancement Proposals; PEP 525 <9>: 用語集<2>.      (line  130)
* 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<186>.
                                                             (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   57)
* Python Enhancement Proposals; PEP 526 <17>: 用語集<2>.     (line 1872)
* 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  170)
* Python Enhancement Proposals; PEP 528 <3>: PyConfig.       (line  562)
* 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>: ドキュメント<32>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 529 <3>: ライブラリ<161>.
                                                             (line  619)
* Python Enhancement Proposals; PEP 529 <4>: Windows<71>.    (line   14)
* Python Enhancement Proposals; PEP 529 <5>: 環境変数.       (line  359)
* 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  812)
* Python Enhancement Proposals; PEP 529 <9>: sys --- システム固有のパラメーターと関数.
                                                             (line 1947)
* Python Enhancement Proposals; PEP 529 <10>: ファイルシステムエンコーディング.
                                                             (line    7)
* Python Enhancement Proposals; PEP 529 <11>: グローバルな設定変数.
                                                             (line  152)
* 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<186>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 530 <3>: Displays for lists sets and dictionaries.
                                                             (line   55)
* 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>: ドキュメント<59>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 538 <5>: ドキュメント<60>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 538 <6>: Core and Builtins<173>.
                                                             (line  134)
* Python Enhancement Proposals; PEP 538 <7>: 環境変数.       (line  428)
* Python Enhancement Proposals; PEP 538 <8>: 一般的なオプション.
                                                             (line   89)
* Python Enhancement Proposals; PEP 538 <9>: locale --- 国際化サービス.
                                                             (line  522)
* 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<65>.      (line   13)
* Python Enhancement Proposals; PEP 539 <3>: Thread-specific storage API.
                                                             (line   16)
* 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<170>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 540 <3>: Python UTF-8 Mode.
                                                             (line    6)
* Python Enhancement Proposals; PEP 540 <4>: locale --- 国際化サービス.
                                                             (line  522)
* 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>: ライブラリ<166>.
                                                             (line  794)
* Python Enhancement Proposals; PEP 552 <4>: Core and Builtins<170>.
                                                             (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  270)
* Python Enhancement Proposals; PEP 553: PEP 553 組み込みの breakpoint.
                                                             (line   20)
* Python Enhancement Proposals; PEP 553 <1>: Core and Builtins<172>.
                                                             (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   15)
* 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   19)
* Python Enhancement Proposals; PEP 560 <1>: types<5>.       (line   12)
* Python Enhancement Proposals; PEP 560 <2>: Core and Builtins<170>.
                                                             (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   69)
* Python Enhancement Proposals; PEP 560 <7>: 動的な型生成.   (line  107)
* Python Enhancement Proposals; PEP 562: PEP 562 モジュール属性へのアクセスのカスタマイズ.
                                                             (line   16)
* Python Enhancement Proposals; PEP 562 <1>: ライブラリ<173>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 562 <2>: Core and Builtins<170>.
                                                             (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>: ライブラリ<123>.
                                                             (line  300)
* Python Enhancement Proposals; PEP 563 <4>: Core and Builtins<136>.
                                                             (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>: モジュールコンテンツ<3>.
                                                             (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>: ライブラリ<175>.
                                                             (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>: ドキュメント<59>.
                                                             (line   86)
* Python Enhancement Proposals; PEP 567 <3>: ドキュメント<61>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 567 <4>: Core and Builtins<169>.
                                                             (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  110)
* 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<160>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 570 <3>: 関数定義.       (line  104)
* Python Enhancement Proposals; PEP 572: その他の言語変更<2>.
                                                             (line   30)
* 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<71>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 572 <4>: ドキュメント<50>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 572 <5>: Core and Builtins<158>.
                                                             (line  184)
* Python Enhancement Proposals; PEP 572 <6>: Core and Builtins<163>.
                                                             (line   92)
* Python Enhancement Proposals; PEP 572 <7>: 辞書表示.       (line   45)
* 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<152>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 573 <3>: C API<49>.      (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>: ライブラリ<156>.
                                                             (line  193)
* Python Enhancement Proposals; PEP 584 <3>: ライブラリ<156>.
                                                             (line  196)
* Python Enhancement Proposals; PEP 584 <4>: ライブラリ<156>.
                                                             (line  210)
* Python Enhancement Proposals; PEP 584 <5>: ライブラリ<157>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 584 <6>: ライブラリ<157>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 584 <7>: ライブラリ<157>.
                                                             (line  120)
* Python Enhancement Proposals; PEP 584 <8>: ライブラリ<157>.
                                                             (line  142)
* Python Enhancement Proposals; PEP 584 <9>: ChainMap オブジェクト.
                                                             (line   88)
* Python Enhancement Proposals; PEP 584 <10>: defaultdict オブジェクト.
                                                             (line   63)
* Python Enhancement Proposals; PEP 584 <11>: OrderedDict オブジェクト.
                                                             (line  111)
* Python Enhancement Proposals; PEP 584 <12>: weakref --- Weak references.
                                                             (line  194)
* Python Enhancement Proposals; PEP 584 <13>: weakref --- Weak references.
                                                             (line  213)
* Python Enhancement Proposals; PEP 584 <14>: 標準的なインタプリタ型.
                                                             (line  239)
* 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>: ライブラリ<78>. (line  158)
* Python Enhancement Proposals; PEP 585 <3>: ライブラリ<109>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 585 <4>: ドキュメント<38>.
                                                             (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  191)
* 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  779)
* 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  103)
* 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<14>.      (line   31)
* Python Enhancement Proposals; PEP 587 <9>: C API<40>.      (line  124)
* Python Enhancement Proposals; PEP 587 <10>: Core and Builtins<158>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 587 <11>: C API<56>.     (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  134)
* 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<54>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 590 <7>: ライブラリ<68>. (line 1078)
* Python Enhancement Proposals; PEP 590 <8>: C API<25>.      (line  146)
* Python Enhancement Proposals; PEP 590 <9>: Core and Builtins<76>.
                                                             (line  112)
* Python Enhancement Proposals; PEP 590 <10>: ライブラリ<96>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 590 <11>: Core and Builtins<98>.
                                                             (line   57)
* Python Enhancement Proposals; PEP 590 <12>: Core and Builtins<107>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 590 <13>: Core and Builtins<116>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 590 <14>: Core and Builtins<122>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 590 <15>: Core and Builtins<122>.
                                                             (line   59)
* Python Enhancement Proposals; PEP 590 <16>: Core and Builtins<137>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 590 <17>: Core and Builtins<137>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 590 <18>: Core and Builtins<153>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 590 <19>: Core and Builtins<153>.
                                                             (line   91)
* Python Enhancement Proposals; PEP 590 <20>: Core and Builtins<154>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 590 <21>: Core and Builtins<154>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 590 <22>: Core and Builtins<154>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 590 <23>: C API<56>.     (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>: ライブラリ<158>.
                                                             (line   91)
* Python Enhancement Proposals; PEP 593 <3>: 特殊形式.       (line  440)
* Python Enhancement Proposals; PEP 593 <4>: Introspection helpers.
                                                             (line   58)
* 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>: ライブラリ<68>. (line  844)
* Python Enhancement Proposals; PEP 594 <8>: ライブラリ<68>. (line  847)
* Python Enhancement Proposals; PEP 594 <9>: ライブラリ<68>. (line  850)
* Python Enhancement Proposals; PEP 594 <10>: ライブラリ<68>.
                                                             (line  858)
* Python Enhancement Proposals; PEP 594 <11>: ライブラリ<68>.
                                                             (line  862)
* Python Enhancement Proposals; PEP 594 <12>: ライブラリ<68>.
                                                             (line  868)
* Python Enhancement Proposals; PEP 594 <13>: ライブラリ<68>.
                                                             (line  871)
* Python Enhancement Proposals; PEP 594 <14>: ライブラリ<68>.
                                                             (line  886)
* Python Enhancement Proposals; PEP 594 <15>: ライブラリ<68>.
                                                             (line  889)
* Python Enhancement Proposals; PEP 594 <16>: ライブラリ<68>.
                                                             (line  896)
* Python Enhancement Proposals; PEP 594 <17>: ライブラリ<68>.
                                                             (line  899)
* Python Enhancement Proposals; PEP 594 <18>: ライブラリ<68>.
                                                             (line  902)
* Python Enhancement Proposals; PEP 594 <19>: ライブラリ<68>.
                                                             (line  905)
* Python Enhancement Proposals; PEP 594 <20>: ライブラリ<68>.
                                                             (line  908)
* Python Enhancement Proposals; PEP 594 <21>: ライブラリ<68>.
                                                             (line  963)
* Python Enhancement Proposals; PEP 594 <22>: ライブラリ<68>.
                                                             (line  966)
* Python Enhancement Proposals; PEP 594 <23>: ライブラリ<68>.
                                                             (line  969)
* Python Enhancement Proposals; PEP 594 <24>: ライブラリ<68>.
                                                             (line  972)
* Python Enhancement Proposals; PEP 594 <25>: ライブラリ<81>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 594 <26>: ライブラリ<91>.
                                                             (line  681)
* Python Enhancement Proposals; PEP 594 <27>: ライブラリ<93>.
                                                             (line   94)
* Python Enhancement Proposals; PEP 594 <28>: ライブラリ<96>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 594 <29>: ライブラリ<96>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 594 <30>: テスト<33>.    (line   25)
* Python Enhancement Proposals; PEP 594 <31>: Superseded Modules.
                                                             (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>: ライブラリ<125>.
                                                             (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>: ライブラリ<133>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 604 <3>: ドキュメント<47>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 604 <4>: Union 型.       (line  105)
* Python Enhancement Proposals; PEP 604 <5>: 文字列指定のアノテーションを手動で解決する方法.
                                                             (line   37)
* 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>: ライブラリ<120>.
                                                             (line  691)
* Python Enhancement Proposals; PEP 612 <3>: ライブラリ<123>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 612 <4>: ライブラリ<132>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 612 <5>: ライブラリ<133>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 612 <6>: ライブラリ<133>.
                                                             (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>: ライブラリ<139>.
                                                             (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<154>.
                                                             (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>: ライブラリ<155>.
                                                             (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<153>.
                                                             (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>: ライブラリ<120>.
                                                             (line  178)
* Python Enhancement Proposals; PEP 617 <7>: ライブラリ<156>.
                                                             (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<148>.
                                                             (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<33>.      (line   21)
* Python Enhancement Proposals; PEP 623 <5>: Core and Builtins<123>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623 <6>: ドキュメント<42>.
                                                             (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<40>.      (line  142)
* Python Enhancement Proposals; PEP 624#alternative-apis: 削除<5>.
                                                             (line   97)
* Python Enhancement Proposals; PEP 626: Pending removal in Python 3 15.
                                                             (line   68)
* Python Enhancement Proposals; PEP 626 <1>: Pending removal in Python 3 15<3>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 626 <2>: 非推奨<2>.      (line  226)
* Python Enhancement Proposals; PEP 626 <3>: Pending removal in Python 3 15<5>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 626 <4>: 概要 -- リリースハイライト<5>.
                                                             (line   22)
* Python Enhancement Proposals; PEP 626 <5>: Core and Builtins<84>.
                                                             (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   68)
* Python Enhancement Proposals; PEP 628: cmath.              (line    7)
* Python Enhancement Proposals; PEP 628 <1>: math<8>.        (line    7)
* Python Enhancement Proposals; PEP 628 <2>: ライブラリ<190>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 630: C API<18>.          (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>: ライブラリ<81>. (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<88>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 634 <3>: Core and Builtins<119>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 634 <4>: Core and Builtins<124>.
                                                             (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  928)
* Python Enhancement Proposals; PEP 634 <9>: PyTypeObject スロット.
                                                             (line  952)
* 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<61>.
                                                             (line  167)
* Python Enhancement Proposals; PEP 644 <6>: ライブラリ<91>. (line  524)
* Python Enhancement Proposals; PEP 644 <7>: ビルド<47>.     (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>: ライブラリ<9>.  (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>: ライブラリ<123>.
                                                             (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   42)
* 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>: ライブラリ<50>. (line  790)
* Python Enhancement Proposals; PEP 649 <7>: Core and Builtins<51>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 649 <8>: Core and Builtins<51>.
                                                             (line  115)
* Python Enhancement Proposals; PEP 649 <9>: Core and Builtins<51>.
                                                             (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>: 定数<11>.      (line   15)
* Python Enhancement Proposals; PEP 649 <16>: モジュールコンテンツ<3>.
                                                             (line  129)
* Python Enhancement Proposals; PEP 649 <17>: モジュールコンテンツ<3>.
                                                             (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   57)
* 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<41>.      (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<81>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 654 <4>: Core and Builtins<104>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 654 <5>: Core and Builtins<107>.
                                                             (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>: ライブラリ<93>. (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>: ライブラリ<93>. (line  223)
* Python Enhancement Proposals; PEP 657 <3>: Core and Builtins<115>.
                                                             (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 1134)
* 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   42)
* 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<65>.
                                                             (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>: ライブラリ<100>.
                                                             (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>: ライブラリ<96>. (line   59)
* Python Enhancement Proposals; PEP 675 <2>: 特殊型.         (line   95)
* Python Enhancement Proposals; PEP 676: ドキュメント<33>.   (line    8)
* Python Enhancement Proposals; PEP 678: その他の言語変更<2>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 678 <1>: PEP 678 ノートによって例外を充実させる.
                                                             (line   11)
* Python Enhancement Proposals; PEP 678 <2>: Core and Builtins<65>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 678 <3>: Core and Builtins<67>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 678 <4>: Core and Builtins<88>.
                                                             (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>: ライブラリ<96>. (line  205)
* Python Enhancement Proposals; PEP 681: PEP 681 Data class transforms.
                                                             (line   30)
* Python Enhancement Proposals; PEP 681 <1>: ライブラリ<93>. (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>: Format specification mini-language.
                                                             (line   96)
* Python Enhancement Proposals; PEP 683: 新しい機能<5>.      (line  147)
* Python Enhancement Proposals; PEP 683 <1>: Core and Builtins<64>.
                                                             (line   70)
* Python Enhancement Proposals; PEP 683 <2>: 参照カウント.   (line  136)
* Python Enhancement Proposals; PEP 683 <3>: 用語集<2>.      (line  856)
* Python Enhancement Proposals; PEP 684: PEP 734 複数インタープリタ機能が標準ライブラリに追加.
                                                             (line   31)
* 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 1152)
* Python Enhancement Proposals; PEP 684 <5>: A per-interpreter GIL.
                                                             (line   16)
* Python Enhancement Proposals; PEP 684 <6>: 高水準 API<2>.  (line   18)
* Python Enhancement Proposals; PEP 686: Python UTF-8 Mode.  (line   70)
* Python Enhancement Proposals; PEP 686 <1>: Text Encoding.  (line   32)
* Python Enhancement Proposals; PEP 687: ライブラリ<64>.     (line  137)
* Python Enhancement Proposals; PEP 687 <1>: Core and Builtins<63>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 687 <2>: ライブラリ<71>. (line  293)
* Python Enhancement Proposals; PEP 687 <3>: ライブラリ<71>. (line  300)
* Python Enhancement Proposals; PEP 687 <4>: ライブラリ<71>. (line  333)
* Python Enhancement Proposals; PEP 687 <5>: ライブラリ<71>. (line  336)
* Python Enhancement Proposals; PEP 687 <6>: ライブラリ<71>. (line  346)
* Python Enhancement Proposals; PEP 687 <7>: ライブラリ<71>. (line  403)
* Python Enhancement Proposals; PEP 687 <8>: ライブラリ<73>. (line    6)
* Python Enhancement Proposals; PEP 687 <9>: ライブラリ<74>. (line  111)
* Python Enhancement Proposals; PEP 687 <10>: ライブラリ<74>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 688: PEP 688 バッファプロトコルを Python で利用可能にする.
                                                             (line    6)
* Python Enhancement Proposals; PEP 688 <1>: Core and Builtins<65>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 688 <2>: Emulating buffer types.
                                                             (line   52)
* 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<28>.          (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>: ライブラリ<71>. (line  120)
* Python Enhancement Proposals; PEP 692 <3>: ドキュメント<24>.
                                                             (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>: ライブラリ<50>. (line  813)
* Python Enhancement Proposals; PEP 695 <4>: ライブラリ<59>. (line  123)
* Python Enhancement Proposals; PEP 695 <5>: ライブラリ<68>. (line   95)
* Python Enhancement Proposals; PEP 695 <6>: ライブラリ<68>. (line  660)
* Python Enhancement Proposals; PEP 695 <7>: ライブラリ<68>. (line  855)
* Python Enhancement Proposals; PEP 695 <8>: ライブラリ<68>. (line  948)
* Python Enhancement Proposals; PEP 695 <9>: Core and Builtins<64>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 695 <10>: Core and Builtins<64>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 695 <11>: ライブラリ<71>.
                                                             (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   59)
* 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<54>.
                                                             (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<26>.      (line   38)
* Python Enhancement Proposals; PEP 698: PEP 698 Override Decorator for Static Typing.
                                                             (line   30)
* Python Enhancement Proposals; PEP 698 <1>: ライブラリ<74>. (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<18>.      (line   15)
* Python Enhancement Proposals; PEP 699 <4>: ビルド<31>.     (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   75)
* Python Enhancement Proposals; PEP 701 <5>: Python API の変更<3>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 701 <6>: Python API の変更<3>.
                                                             (line   99)
* 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>: ライブラリ<66>. (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<17>.      (line   21)
* Python Enhancement Proposals; PEP 703 <6>: Core and Builtins<51>.
                                                             (line  169)
* Python Enhancement Proposals; PEP 703 <7>: Core and Builtins<57>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 703 <8>: C API<24>.      (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>: Free-threaded reference counting can cause objects to live longer.
                                                             (line    9)
* Python Enhancement Proposals; PEP 703 <14>: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？.
                                                             (line   12)
* Python Enhancement Proposals; PEP 703 <15>: 用語集<2>.     (line  654)
* Python Enhancement Proposals; PEP 703 <16>: 用語集<2>.     (line  806)
* Python Enhancement Proposals; PEP 705: 概要 -- リリースハイライト<2>.
                                                             (line  123)
* Python Enhancement Proposals; PEP 705 <1>: typing<2>.      (line    6)
* Python Enhancement Proposals; PEP 705 <2>: ライブラリ<64>. (line   17)
* Python Enhancement Proposals; PEP 705 <3>: 特殊形式.       (line  295)
* Python Enhancement Proposals; PEP 706: その他の言語変更<2>.
                                                             (line   77)
* 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<65>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 709 <5>: 組み込み関数.   (line 1132)
* 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 複数インタープリタ機能が標準ライブラリに追加.
                                                             (line    3)
* Python Enhancement Proposals; PEP 734 <2>: PEP 734 複数インタープリタ機能が標準ライブラリに追加.
                                                             (line   91)
* Python Enhancement Proposals; PEP 734 <3>: ライブラリ<23>. (line   44)
* Python Enhancement Proposals; PEP 734 <4>: ライブラリ<46>. (line  348)
* Python Enhancement Proposals; PEP 734 <5>: ライブラリ<59>. (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 1152)
* Python Enhancement Proposals; PEP 737: Changed C APIs.     (line   44)
* Python Enhancement Proposals; PEP 737 <1>: C API<20>.      (line    6)
* Python Enhancement Proposals; PEP 737 <2>: C API<20>.      (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>: ライブラリ<59>. (line   54)
* Python Enhancement Proposals; PEP 739: build-details json. (line   19)
* Python Enhancement Proposals; PEP 739 <1>: ビルド<10>.     (line   21)
* Python Enhancement Proposals; PEP 739 <2>: ビルド<11>.     (line    7)
* Python Enhancement Proposals; PEP 739 <3>: Core and Builtins<31>.
                                                             (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<14>.      (line   27)
* Python Enhancement Proposals; PEP 741 <3>: C API<18>.      (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>: ライブラリ<59>. (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>: ライブラリ<50>. (line  527)
* Python Enhancement Proposals; PEP 749 <6>: ライブラリ<50>. (line  790)
* 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>: モジュールコンテンツ<3>.
                                                             (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__ の注意点.
                                                             (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   71)
* Python Enhancement Proposals; PEP 750 <3>: Core and Builtins<18>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 750 <4>: ライブラリ<27>. (line  140)
* Python Enhancement Proposals; PEP 750 <5>: Core and Builtins<27>.
                                                             (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<14>.      (line   76)
* Python Enhancement Proposals; PEP 757 <2>: C API<16>.      (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>: ライブラリ<29>. (line    6)
* Python Enhancement Proposals; PEP 758 <3>: Core and Builtins<29>.
                                                             (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<12>.
                                                             (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 安全な外部デバッガインターフェース.
                                                             (line    3)
* Python Enhancement Proposals; PEP 768 <2>: PEP 768 安全な外部デバッガインターフェース.
                                                             (line   52)
* Python Enhancement Proposals; PEP 768 <3>: Core and Builtins<23>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 768 <4>: Core and Builtins<27>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 768 <5>: Core and Builtins<29>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 768 <6>: その他のオプション.
                                                             (line  383)
* Python Enhancement Proposals; PEP 768 <7>: その他のオプション.
                                                             (line  390)
* Python Enhancement Proposals; PEP 768 <8>: 環境変数.       (line  500)
* Python Enhancement Proposals; PEP 768 <9>: パフォーマンスに関するオプション.
                                                             (line  152)
* Python Enhancement Proposals; PEP 768 <10>: パフォーマンスに関するオプション.
                                                             (line  155)
* Python Enhancement Proposals; PEP 768 <11>: sys --- システム固有のパラメーターと関数.
                                                             (line 1925)
* 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>: ライブラリ<175>.  (line  124)
* Python Enhancement Proposals; PEP 8 <2>: IDLE<64>.         (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 1825)
* 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>:                 ライブラリ<50>.     (line   52)
* PYTHON_BASIC_REPL <3>:                 ライブラリ<50>.     (line   55)
* PYTHON_BASIC_REPL <4>:                 Core and Builtins<51>.
                                                             (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:         ライブラリ<28>.     (line  369)
* PYTHON_CONTEXT_AWARE_WARNINGS <1>:     その他のオプション. (line  434)
* PYTHON_CONTEXT_AWARE_WARNINGS <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  588)
* PYTHON_CONTEXT_AWARE_WARNINGS <3>:     Concurrent safety of Context Managers.
                                                             (line   41)
* PYTHON_CPU_COUNT:                      os<2>.              (line   11)
* PYTHON_CPU_COUNT <1>:                  その他のオプション. (line  398)
* 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  517)
* PYTHON_DISABLE_REMOTE_DEBUG:           PEP 768 安全な外部デバッガインターフェース.
                                                             (line   39)
* PYTHON_DISABLE_REMOTE_DEBUG <1>:       その他のオプション. (line  389)
* PYTHON_DISABLE_REMOTE_DEBUG <2>:       Disabling remote debugging.
                                                             (line    8)
* PYTHON_DISABLE_REMOTE_DEBUG <3>:       When to use PYTHON_DISABLE_REMOTE_DEBUG.
                                                             (line    6)
* PYTHON_DOM:                            モジュールコンテンツ<2>.
                                                             (line   22)
* PYTHON_FROZEN_MODULES:                 その他の言語変更.   (line   46)
* PYTHON_FROZEN_MODULES <1>:             Core and Builtins<62>.
                                                             (line  105)
* PYTHON_FROZEN_MODULES <2>:             その他のオプション. (line  357)
* PYTHON_FROZEN_MODULES <3>:             PyConfig.           (line  415)
* PYTHON_GIL:                            フリースレッドの CPython.
                                                             (line   23)
* PYTHON_GIL <1>:                        フリースレッドの CPython.
                                                             (line   37)
* PYTHON_GIL <2>:                        Core and Builtins<47>.
                                                             (line   50)
* PYTHON_GIL <3>:                        その他のオプション. (line  416)
* PYTHON_GIL <4>:                        sys --- システム固有のパラメーターと関数.
                                                             (line  581)
* PYTHON_GIL <5>:                        The global interpreter lock in free-threaded Python.
                                                             (line    7)
* PYTHON_GIL <6>:                        用語集<2>.          (line  803)
* PYTHON_HISTORY:                        その他の言語変更.   (line   57)
* PYTHON_HISTORY <1>:                    ライブラリ<66>.     (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 1272)
* PYTHON_MANAGER_AUTOMATIC_INSTALL:      Installing runtimes.
                                                             (line   47)
* PYTHON_MANAGER_DEFAULT:                基本的な使い方.     (line   46)
* PYTHON_MANAGER_DEFAULT <1>:            Troubleshooting.    (line   76)
* PYTHON_PERF_JIT_SUPPORT:               その他の言語変更.   (line   52)
* PYTHON_PERF_JIT_SUPPORT <1>:           その他のオプション. (line  376)
* PYTHON_PERF_JIT_SUPPORT <2>:           PyConfig.           (line  900)
* PYTHON_PERF_JIT_SUPPORT <3>:           How to work without frame pointers.
                                                             (line   14)
* PYTHON_PRESITE:                        その他のオプション. (line  410)
* PYTHON_PRESITE <1>:                    PyConfig.           (line  795)
* PYTHON_PRESITE=package.module:         Core and Builtins<62>.
                                                             (line  154)
* python_revision() (platform モジュール): Cross platform.   (line   96)
* PYTHON_THREAD_INHERIT_CONTEXT:         Core and Builtins<28>.
                                                             (line  134)
* PYTHON_THREAD_INHERIT_CONTEXT <1>:     その他のオプション. (line  426)
* PYTHON_THREAD_INHERIT_CONTEXT <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  584)
* PYTHON_TLBC:                           その他のオプション. (line  442)
* python_version_tuple() (platform モジュール): Cross platform.
                                                             (line  109)
* python_version() (platform モジュール): Cross platform.    (line  101)
* python-m-py_compile コマンドラインオプション; -: コマンドラインインターフェイス<4>.
                                                             (line   13)
* python-m-py_compile コマンドラインオプション; -q: コマンドラインインターフェイス<4>.
                                                             (line   19)
* python-m-py_compile コマンドラインオプション; -quiet: コマンドラインインターフェイス<4>.
                                                             (line   19)
* python-m-py_compile コマンドラインオプション; <file>: コマンドラインインターフェイス<4>.
                                                             (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)
* pythonapi (ctypes モジュール):         共有ライブラリをロードする.
                                                             (line  227)
* PYTHONASYNCIODEBUG:                    デバッグモードの有効化.
                                                             (line   10)
* PYTHONASYNCIODEBUG <1>:                デバッグモード.     (line   11)
* PYTHONASYNCIODEBUG <2>:                Python 開発モードの影響.
                                                             (line   65)
* PYTHONBREAKPOINT:                      PEP 553 組み込みの breakpoint.
                                                             (line   13)
* PYTHONBREAKPOINT <1>:                  組み込み関数.       (line  159)
* 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>:                      ライブラリ<157>.    (line  144)
* PYTHONCASEOK <3>:                      組み込み関数.       (line 2236)
* PYTHONCOERCECLOCALE:                   PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* PYTHONCOERCECLOCALE <1>:               一般的なオプション. (line   89)
* PYTHONCOERCECLOCALE <2>:               Python UTF-8 Mode.  (line   56)
* PYTHONCOERCECLOCALE <3>:               Python Configuration.
                                                             (line   15)
* PYTHONDEBUG:                           その他のオプション. (line   38)
* PYTHONDEBUG <1>:                       Python デバッグビルド.
                                                             (line   20)
* PYTHONDEBUG <2>:                       グローバルな設定変数.
                                                             (line   38)
* PYTHONDEBUG <3>:                       PyConfig.           (line  686)
* PYTHONDEVMODE:                         Python Development Mode -X dev.
                                                             (line    6)
* PYTHONDEVMODE <1>:                     その他のオプション. (line  316)
* PYTHONDEVMODE <2>:                     Python 開発モード.  (line   14)
* PYTHONDEVMODE <3>:                     PyConfig.           (line  291)
* PYTHONDONTWRITEBYTECODE:               インタプリタの変更<2>.
                                                             (line   15)
* PYTHONDONTWRITEBYTECODE <1>:           新しいモジュールと改良されたモジュール<2>.
                                                             (line  636)
* PYTHONDONTWRITEBYTECODE <2>:           その他のオプション. (line   19)
* PYTHONDONTWRITEBYTECODE <3>:           sys --- システム固有のパラメーターと関数.
                                                             (line  332)
* PYTHONDONTWRITEBYTECODE <4>:           グローバルな設定変数.
                                                             (line   52)
* PYTHONDONTWRITEBYTECODE <5>:           PyConfig.           (line  999)
* PYTHONDONTWRITEBYTECODE <6>:           pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* PYTHONDUMPREFS:                        デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* PYTHONDUMPREFS <1>:                    ビルド<63>.         (line   54)
* PYTHONDUMPREFS <2>:                    Debug options.      (line   22)
* PYTHONDUMPREFS <3>:                    Debug options.      (line   24)
* PYTHONDUMPREFS <4>:                    PyConfig.           (line  302)
* PYTHONDUMPREFSFILE:                    Core and Builtins<113>.
                                                             (line   16)
* PYTHONDUMPREFSFILE <1>:                PyConfig.           (line  314)
* PYTHONEXECUTABLE:                      PyConfig.           (line  721)
* PYTHONFAULTHANDLER:                    faulthandler<5>.    (line   12)
* PYTHONFAULTHANDLER <1>:                その他のオプション. (line  268)
* PYTHONFAULTHANDLER <2>:                Python 開発モードの影響.
                                                             (line   59)
* PYTHONFAULTHANDLER <3>:                faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* PYTHONFAULTHANDLER <4>:                PyConfig.           (line  351)
* PythonFinalizationError:               具象例外.           (line  217)
* PYTHONHASHSEED:                        組み込みの関数と型. (line   18)
* PYTHONHASHSEED <1>:                    Python コードの移植.
                                                             (line    7)
* PYTHONHASHSEED <2>:                    Core and Builtins<170>.
                                                             (line   30)
* PYTHONHASHSEED <3>:                    その他のオプション. (line  131)
* PYTHONHASHSEED <4>:                    その他のオプション. (line  148)
* PYTHONHASHSEED <5>:                    環境変数.           (line  156)
* PYTHONHASHSEED <6>:                    基本的なカスタマイズ.
                                                             (line  310)
* PYTHONHASHSEED <7>:                    グローバルな設定変数.
                                                             (line   75)
* PYTHONHASHSEED <8>:                    グローバルな設定変数.
                                                             (line   78)
* PYTHONHASHSEED <9>:                    PyConfig.           (line  431)
* 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   90)
* PYTHONHOME <20>:                       プロセスワイドのパラメータ.
                                                             (line  300)
* PYTHONHOME <21>:                       プロセスワイドのパラメータ.
                                                             (line  315)
* PYTHONHOME <22>:                       プロセスワイドのパラメータ.
                                                             (line  324)
* PYTHONHOME <23>:                       PyConfig.           (line  439)
* PYTHONHOME <24>:                       PyConfig.           (line  441)
* PYTHONHOME <25>:                       Pending removal in Python 3 15<8>.
                                                             (line   58)
* Pythonic:                              用語集<2>.          (line 1477)
* PYTHONINSPECT:                         その他の変更と修正<2>.
                                                             (line   13)
* PYTHONINSPECT <1>:                     Core and Builtins<6>.
                                                             (line   57)
* PYTHONINSPECT <2>:                     その他のオプション. (line   69)
* PYTHONINSPECT <3>:                     グローバルな設定変数.
                                                             (line  107)
* PYTHONINSPECT <4>:                     PyConfig.           (line  470)
* PYTHONINTMAXSTRDIGITS:                 Core and Builtins<79>.
                                                             (line   74)
* PYTHONINTMAXSTRDIGITS <1>:             その他のオプション. (line  290)
* PYTHONINTMAXSTRDIGITS <2>:             上限値を設定する.   (line    9)
* PYTHONINTMAXSTRDIGITS <3>:             上限値を設定する.   (line   16)
* PYTHONINTMAXSTRDIGITS <4>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1191)
* PYTHONINTMAXSTRDIGITS <5>:             PyConfig.           (line  501)
* PYTHONIOENCODING:                      その他の改善<2>.    (line   75)
* PYTHONIOENCODING <1>:                  インタプリタの変更<2>.
                                                             (line   22)
* PYTHONIOENCODING <2>:                  環境変数.           (line  411)
* PYTHONIOENCODING <3>:                  Python UTF-8 Mode.  (line   28)
* PYTHONIOENCODING <4>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1992)
* PYTHONIOENCODING <5>:                  PyConfig.           (line  854)
* 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<21>.        (line   37)
* PYTHONLEGACYWINDOWSFSENCODING <6>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1933)
* PYTHONLEGACYWINDOWSFSENCODING <7>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1944)
* PYTHONLEGACYWINDOWSFSENCODING <8>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1949)
* PYTHONLEGACYWINDOWSFSENCODING <9>:     グローバルな設定変数.
                                                             (line  149)
* 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 1996)
* PYTHONLEGACYWINDOWSSTDIO <3>:          グローバルな設定変数.
                                                             (line  167)
* PYTHONLEGACYWINDOWSSTDIO <4>:          PyConfig.           (line  554)
* PYTHONMALLOC:                          PYTHONMALLOC 環境変数.
                                                             (line    6)
* PYTHONMALLOC <1>:                      C API の変更<13>.   (line    9)
* PYTHONMALLOC <2>:                      Core and Builtins<190>.
                                                             (line   90)
* PYTHONMALLOC <3>:                      環境変数.           (line  338)
* PYTHONMALLOC <4>:                      パフォーマンスに関するオプション.
                                                             (line  122)
* PYTHONMALLOC <5>:                      パフォーマンスに関するオプション.
                                                             (line  129)
* PYTHONMALLOC <6>:                      Python 開発モードの影響.
                                                             (line   46)
* PYTHONMALLOC <7>:                      Python 開発モードの影響.
                                                             (line   50)
* PYTHONMALLOC <8>:                      概要<4>.            (line   76)
* PYTHONMALLOC <9>:                      Default Memory Allocators.
                                                             (line   32)
* PYTHONMALLOC <10>:                     Debug hooks on the Python memory allocators.
                                                             (line   11)
* PYTHONMALLOC <11>:                     pymalloc アロケータ.
                                                             (line   27)
* PYTHONMALLOC <12>:                     The mimalloc allocator.
                                                             (line   24)
* PYTHONMALLOCSTATS:                     Core and Builtins<190>.
                                                             (line   96)
* PYTHONMALLOCSTATS <1>:                 PyConfig.           (line  570)
* PYTHONMALLOCSTATS <2>:                 概要<4>.            (line   79)
* PYTHONNODEBUGRANGES:                   PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* PYTHONNODEBUGRANGES <1>:               その他のオプション. (line  345)
* PYTHONNODEBUGRANGES <2>:               Methods on code objects.
                                                             (line   40)
* PYTHONNODEBUGRANGES <3>:               PyConfig.           (line  244)
* PYTHONNOUSERSITE:                      PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* PYTHONNOUSERSITE <1>:                  その他のオプション. (line  160)
* PYTHONNOUSERSITE <2>:                  モジュールの内容<6>.
                                                             (line   15)
* PYTHONNOUSERSITE <3>:                  グローバルな設定変数.
                                                             (line  200)
* PYTHONNOUSERSITE <4>:                  PyConfig.           (line  952)
* PYTHONOPTIMIZE:                        その他のオプション. (line   89)
* PYTHONOPTIMIZE <1>:                    グローバルな設定変数.
                                                             (line  211)
* PYTHONOPTIMIZE <2>:                    PyConfig.           (line  638)
* PYTHONPATH:                            'python' コマンドの挙動の変更<2>.
                                                             (line    7)
* PYTHONPATH <1>:                        'python' コマンドの挙動の変更<2>.
                                                             (line    9)
* PYTHONPATH <2>:                        モジュール検索パス. (line   15)
* 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 1426)
* PYTHONPATH <19>:                       sys --- システム固有のパラメーターと関数.
                                                             (line 1432)
* 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   89)
* PYTHONPATH <25>:                       PyConfig.           (line  603)
* PYTHONPERFSUPPORT:                     その他の言語変更<2>.
                                                             (line   84)
* PYTHONPERFSUPPORT <1>:                 その他のオプション. (line  365)
* PYTHONPERFSUPPORT <2>:                 PyConfig.           (line  896)
* PYTHONPERFSUPPORT <3>:                 How to enable perf profiling support.
                                                             (line    7)
* PYTHONPLATLIBDIR:                      Core and Builtins<149>.
                                                             (line   47)
* PYTHONPLATLIBDIR <1>:                  sys path モジュール検索パスの初期化.
                                                             (line   51)
* PYTHONPLATLIBDIR <2>:                  PyConfig.           (line  582)
* PYTHONPROFILEIMPORTTIME:               その他の言語変更<7>.
                                                             (line   47)
* PYTHONPROFILEIMPORTTIME <1>:           Core and Builtins<172>.
                                                             (line   66)
* PYTHONPROFILEIMPORTTIME <2>:           その他のオプション. (line  306)
* PYTHONPROFILEIMPORTTIME <3>:           PyConfig.           (line  453)
* PYTHONPYCACHEPREFIX:                   コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* PYTHONPYCACHEPREFIX <1>:               Core and Builtins<163>.
                                                             (line  402)
* PYTHONPYCACHEPREFIX <2>:               その他のオプション. (line  329)
* PYTHONPYCACHEPREFIX <3>:               sys --- システム固有のパラメーターと関数.
                                                             (line  379)
* PYTHONPYCACHEPREFIX <4>:               PyConfig.           (line  743)
* PYTHONREGRTEST_UNICODE_GUARD:          テスト<32>.         (line   13)
* PYTHONSAFEPATH:                        概要 -- リリースハイライト<4>.
                                                             (line   27)
* PYTHONSAFEPATH <1>:                    その他の言語変更<3>.
                                                             (line   37)
* PYTHONSAFEPATH <2>:                    セキュリティ<33>.   (line    6)
* PYTHONSAFEPATH <3>:                    その他のオプション. (line  117)
* PYTHONSAFEPATH <4>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1444)
* PYTHONSAFEPATH <5>:                    セキュリティで考慮すべき点<6>.
                                                             (line   47)
* PYTHONSAFEPATH <6>:                    PyConfig.           (line  161)
* PYTHONSTARTUP:                         Default interactive shell.
                                                             (line   15)
* PYTHONSTARTUP <1>:                     sys<12>.            (line   16)
* PYTHONSTARTUP <2>:                     sys<12>.            (line   21)
* PYTHONSTARTUP <3>:                     ライブラリ<4>.      (line  102)
* PYTHONSTARTUP <4>:                     ライブラリ<6>.      (line  144)
* PYTHONSTARTUP <5>:                     Core and Builtins<15>.
                                                             (line   41)
* PYTHONSTARTUP <6>:                     IDLE<38>.           (line  176)
* PYTHONSTARTUP <7>:                     IDLE<42>.           (line    9)
* PYTHONSTARTUP <8>:                     IDLE<48>.           (line    9)
* PYTHONSTARTUP <9>:                     対話モード用の起動時実行ファイル.
                                                             (line    7)
* PYTHONSTARTUP <10>:                    その他のオプション. (line   65)
* 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 1203)
* PYTHONSTARTUP <17>:                    readline の設定.    (line   12)
* PYTHONTRACEMALLOC:                     その他のオプション. (line  285)
* PYTHONTRACEMALLOC <1>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* PYTHONTRACEMALLOC <2>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* PYTHONTRACEMALLOC <3>:                 関数<11>.           (line   90)
* PYTHONTRACEMALLOC <4>:                 PyConfig.           (line  882)
* PYTHONTZPATH:                          例外と警告.         (line   14)
* PYTHONUNBUFFERED:                      Core and Builtins<156>.
                                                             (line  107)
* PYTHONUNBUFFERED <1>:                  その他のオプション. (line  179)
* PYTHONUNBUFFERED <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 2003)
* PYTHONUNBUFFERED <3>:                  グローバルな設定変数.
                                                             (line  239)
* PYTHONUNBUFFERED <4>:                  PyConfig.           (line  208)
* PYTHONUOPS:                            Core and Builtins<63>.
                                                             (line   27)
* PYTHONUOPS <1>:                        Core and Builtins<63>.
                                                             (line  179)
* PYTHONUOPS <2>:                        Core and Builtins<63>.
                                                             (line  258)
* PYTHONUOPS <3>:                        Core and Builtins<63>.
                                                             (line  317)
* PYTHONUOPS <4>:                        Core and Builtins<63>.
                                                             (line  381)
* PYTHONUSERBASE:                        PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* PYTHONUSERBASE <1>:                    モジュールの内容<6>.
                                                             (line   41)
* PYTHONUSERBASE <2>:                    モジュールの内容<6>.
                                                             (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  323)
* PYTHONUTF8 <2>:                        環境変数.           (line  421)
* PYTHONUTF8 <3>:                        UTF-8 モード.       (line   18)
* PYTHONUTF8 <4>:                        Python UTF-8 Mode.  (line   51)
* PYTHONUTF8 <5>:                        Python UTF-8 Mode.  (line   53)
* PYTHONUTF8 <6>:                        sys --- システム固有のパラメーターと関数.
                                                             (line 1994)
* PYTHONUTF8 <7>:                        PyPreConfig.        (line  152)
* PYTHONUTF8 <8>:                        Python Configuration.
                                                             (line   14)
* PYTHONVERBOSE:                         その他のオプション. (line  195)
* PYTHONVERBOSE <1>:                     グローバルな設定変数.
                                                             (line  256)
* PYTHONVERBOSE <2>:                     PyConfig.           (line  969)
* PYTHONWARNDEFAULTENCODING:             Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* PYTHONWARNDEFAULTENCODING <1>:         ライブラリ<125>.    (line   45)
* PYTHONWARNDEFAULTENCODING <2>:         その他のオプション. (line  335)
* PYTHONWARNDEFAULTENCODING <3>:         Opt-in EncodingWarning.
                                                             (line    9)
* PYTHONWARNINGS:                        warnings<3>.        (line   21)
* PYTHONWARNINGS <1>:                    その他の言語変更<12>.
                                                             (line  157)
* PYTHONWARNINGS <2>:                    Deprecation Warnings の扱いの変更.
                                                             (line   23)
* PYTHONWARNINGS <3>:                    インタプリタの変更. (line    6)
* PYTHONWARNINGS <4>:                    ドキュメント<31>.   (line   67)
* PYTHONWARNINGS <5>:                    その他のオプション. (line  249)
* 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  988)
* PyThread_acquire_lock (C function):    Legacy locking APIs.
                                                             (line   69)
* PyThread_acquire_lock_timed (C function): Legacy locking APIs.
                                                             (line   46)
* PyThread_allocate_lock (C function):   Legacy locking APIs.
                                                             (line   29)
* PyThread_create_key (C function):      Legacy APIs.        (line   18)
* PyThread_delete_key (C function):      Legacy APIs.        (line   21)
* PyThread_delete_key_value (C function): Legacy APIs.       (line   30)
* PyThread_exit_thread (C function):     Operating system thread APIs.
                                                             (line   71)
* PyThread_free_lock (C function):       Legacy locking APIs.
                                                             (line   39)
* PyThread_get_key_value (C function):   Legacy APIs.        (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):       Legacy APIs.        (line   33)
* PyThread_release_lock (C function):    Legacy locking APIs.
                                                             (line   88)
* PyThread_set_key_value (C function):   Legacy APIs.        (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):       Dynamic allocation. (line   10)
* PyThread_tss_create (C function):      メソッド<2>.        (line   16)
* PyThread_tss_delete (C function):      メソッド<2>.        (line   24)
* PyThread_tss_free (C function):        Dynamic allocation. (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    9)
* PyThreadState (C type):                Thread states and the global interpreter lock.
                                                             (line   28)
* PyThreadState (C type) <1>:            高水準 API.         (line    9)
* PyThreadState_Clear (C function):      低水準 API.         (line   12)
* PyThreadState_Delete (C function):     低水準 API.         (line   24)
* PyThreadState_DeleteCurrent (C function): 低水準 API.      (line   30)
* PyThreadState_EnterTracing (C function): 低水準 API.       (line   71)
* PyThreadState_Get (C function):        高水準 API.         (line   56)
* PyThreadState_GetDict (C function):    低水準 API.         (line  133)
* PyThreadState_GetFrame (C function):   低水準 API.         (line   39)
* PyThreadState_GetID (C function):      低水準 API.         (line   53)
* PyThreadState_GetInterpreter (C function): 低水準 API.     (line   62)
* PyThreadState_GetUnchecked (C function): 高水準 API.       (line   65)
* PyThreadState_LeaveTracing (C function): 低水準 API.       (line   80)
* PyThreadState_New (C function):        低水準 API.         (line    6)
* PyThreadState_Next (C function):       Advanced debugger support.
                                                             (line   29)
* PyThreadState_SetAsyncExc (C function): Asynchronous notifications.
                                                             (line   72)
* PyThreadState_Swap (C function):       高水準 API.         (line   74)
* PyThreadState.interp (C member):       高水準 API.         (line   14)
* 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  319)
* 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  297)
* PyType_GetModuleName (C function):     型オブジェクト<2>.  (line  235)
* PyType_GetModuleState (C function):    型オブジェクト<2>.  (line  283)
* 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  550)
* 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  351)
* 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 1688)
* PyTypeObject.tp_as_async (C member):   PyTypeObject スロット.
                                                             (line  364)
* PyTypeObject.tp_as_buffer (C member):  PyTypeObject スロット.
                                                             (line  599)
* PyTypeObject.tp_as_mapping (C member): PyTypeObject スロット.
                                                             (line  435)
* PyTypeObject.tp_as_number (C member):  PyTypeObject スロット.
                                                             (line  411)
* PyTypeObject.tp_as_sequence (C member): PyTypeObject スロット.
                                                             (line  423)
* PyTypeObject.tp_base (C member):       PyTypeObject スロット.
                                                             (line 1497)
* PyTypeObject.tp_bases (C member):      PyTypeObject スロット.
                                                             (line 1822)
* PyTypeObject.tp_basicsize (C member):  PyTypeObject スロット.
                                                             (line   48)
* PyTypeObject.tp_cache (C member):      PyTypeObject スロット.
                                                             (line 1860)
* PyTypeObject.tp_call (C member):       PyTypeObject スロット.
                                                             (line  491)
* PyTypeObject.tp_clear (C member):      PyTypeObject スロット.
                                                             (line 1124)
* PyTypeObject.tp_dealloc (C member):    PyTypeObject スロット.
                                                             (line  134)
* PyTypeObject.tp_del (C member):        PyTypeObject スロット.
                                                             (line 1900)
* PyTypeObject.tp_descr_get (C member):  PyTypeObject スロット.
                                                             (line 1570)
* PyTypeObject.tp_descr_set (C member):  PyTypeObject スロット.
                                                             (line 1586)
* PyTypeObject.tp_dict (C member):       PyTypeObject スロット.
                                                             (line 1533)
* PyTypeObject.tp_dictoffset (C member): PyTypeObject スロット.
                                                             (line 1605)
* PyTypeObject.tp_doc (C member):        PyTypeObject スロット.
                                                             (line 1007)
* PyTypeObject.tp_finalize (C member):   PyTypeObject スロット.
                                                             (line 1918)
* PyTypeObject.tp_flags (C member):      PyTypeObject スロット.
                                                             (line  612)
* PyTypeObject.tp_free (C member):       PyTypeObject スロット.
                                                             (line 1755)
* PyTypeObject.tp_getattr (C member):    PyTypeObject スロット.
                                                             (line  320)
* PyTypeObject.tp_getattro (C member):   PyTypeObject スロット.
                                                             (line  538)
* PyTypeObject.tp_getset (C member):     PyTypeObject スロット.
                                                             (line 1479)
* PyTypeObject.tp_hash (C member):       PyTypeObject スロット.
                                                             (line  447)
* PyTypeObject.tp_init (C member):       PyTypeObject スロット.
                                                             (line 1649)
* PyTypeObject.tp_is_gc (C member):      PyTypeObject スロット.
                                                             (line 1788)
* PyTypeObject.tp_itemsize (C member):   PyTypeObject スロット.
                                                             (line   48)
* PyTypeObject.tp_iter (C member):       PyTypeObject スロット.
                                                             (line 1396)
* PyTypeObject.tp_iternext (C member):   PyTypeObject スロット.
                                                             (line 1416)
* PyTypeObject.tp_members (C member):    PyTypeObject スロット.
                                                             (line 1461)
* PyTypeObject.tp_methods (C member):    PyTypeObject スロット.
                                                             (line 1443)
* PyTypeObject.tp_mro (C member):        PyTypeObject スロット.
                                                             (line 1846)
* PyTypeObject.tp_name (C member):       PyTypeObject スロット.
                                                             (line   12)
* PyTypeObject.tp_new (C member):        PyTypeObject スロット.
                                                             (line 1714)
* PyTypeObject.tp_repr (C member):       PyTypeObject スロット.
                                                             (line  381)
* PyTypeObject.tp_richcompare (C member): PyTypeObject スロット.
                                                             (line 1282)
* PyTypeObject.tp_setattr (C member):    PyTypeObject スロット.
                                                             (line  342)
* PyTypeObject.tp_setattro (C member):   PyTypeObject スロット.
                                                             (line  568)
* PyTypeObject.tp_str (C member):        PyTypeObject スロット.
                                                             (line  508)
* PyTypeObject.tp_subclasses (C member): PyTypeObject スロット.
                                                             (line 1869)
* PyTypeObject.tp_traverse (C member):   PyTypeObject スロット.
                                                             (line 1020)
* PyTypeObject.tp_vectorcall (C member): PyTypeObject スロット.
                                                             (line 2088)
* PyTypeObject.tp_vectorcall_offset (C member): PyTypeObject スロット.
                                                             (line  280)
* PyTypeObject.tp_version_tag (C member): PyTypeObject スロット.
                                                             (line 1909)
* PyTypeObject.tp_watched (C member):    PyTypeObject スロット.
                                                             (line 2131)
* PyTypeObject.tp_weaklist (C member):   PyTypeObject スロット.
                                                             (line 1885)
* PyTypeObject.tp_weaklistoffset (C member): PyTypeObject スロット.
                                                             (line 1360)
* PyTZInfo_Check (C function):           DateTime オブジェクト<2>.
                                                             (line  150)
* PyTZInfo_CheckExact (C function):      DateTime オブジェクト<2>.
                                                             (line  157)
* PyUnicode_1BYTE_DATA (C function):     Unicode 型.         (line   79)
* PyUnicode_1BYTE_KIND (C macro):        Unicode 型.         (line   93)
* PyUnicode_2BYTE_DATA (C function):     Unicode 型.         (line   79)
* PyUnicode_2BYTE_KIND (C macro):        Unicode 型.         (line   93)
* PyUnicode_4BYTE_DATA (C function):     Unicode 型.         (line   79)
* PyUnicode_4BYTE_KIND (C macro):        Unicode 型.         (line   93)
* 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   60)
* PyUnicode_CHECK_INTERNED (C function): メソッドおよびスロット関数 slot function.
                                                             (line  278)
* PyUnicode_CheckExact (C function):     Unicode 型.         (line   65)
* 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  112)
* 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   78)
* PyUnicode_DecodeFSDefaultAndSize (C function): ファイルシステムエンコーディング.
                                                             (line   61)
* 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   90)
* 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   70)
* 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  174)
* PyUnicode_IS_COMPACT (C macro):        Unicode 型.         (line   44)
* PyUnicode_IS_COMPACT_ASCII (C macro):  Unicode 型.         (line   51)
* PyUnicode_IS_READY (C function):       Deprecated API<2>.  (line   31)
* PyUnicode_IsIdentifier (C function):   Unicode 型.         (line  166)
* PyUnicode_Join (C function):           メソッドおよびスロット関数 slot function.
                                                             (line   78)
* PyUnicode_KIND (C function):           Unicode 型.         (line  103)
* PyUnicode_MAX_CHAR_VALUE (C function): Unicode 型.         (line  156)
* PyUnicode_New (C function):            Unicode 文字列の生成とアクセス.
                                                             (line    9)
* PyUnicode_Partition (C function):      メソッドおよびスロット関数 slot function.
                                                             (line   49)
* PyUnicode_READ (C function):           Unicode 型.         (line  137)
* PyUnicode_READ_CHAR (C function):      Unicode 型.         (line  146)
* 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  120)
* 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  153)
* PyUnicodeWriter_Discard (C function):  PyUnicodeWriter.    (line   40)
* PyUnicodeWriter_Finish (C function):   PyUnicodeWriter.    (line   30)
* PyUnicodeWriter_Format (C function):   PyUnicodeWriter.    (line  144)
* PyUnicodeWriter_WriteASCII (C function): PyUnicodeWriter.  (line   71)
* PyUnicodeWriter_WriteChar (C function): PyUnicodeWriter.   (line   49)
* PyUnicodeWriter_WriteRepr (C function): PyUnicodeWriter.   (line  119)
* PyUnicodeWriter_WriteStr (C function): PyUnicodeWriter.    (line  106)
* PyUnicodeWriter_WriteSubstring (C function): PyUnicodeWriter.
                                                             (line  132)
* PyUnicodeWriter_WriteUCS4 (C function): PyUnicodeWriter.   (line   96)
* PyUnicodeWriter_WriteUTF8 (C function): PyUnicodeWriter.   (line   57)
* PyUnicodeWriter_WriteWideChar (C function): PyUnicodeWriter.
                                                             (line   85)
* PyUnstable:                            Unstable C API.     (line    6)
* PyUnstable_AtExit (C function):        インタープリタの初期化と終了処理<2>.
                                                             (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  744)
* 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  660)
* PyUnstable_Long_CompactValue (C function): 整数型オブジェクト integer object.
                                                             (line  657)
* PyUnstable_Long_IsCompact (C function): 整数型オブジェクト integer object.
                                                             (line  639)
* PyUnstable_Module_SetGIL (C function): サポート関数.       (line  192)
* PyUnstable_Object_ClearWeakRefsNoCallbacks (C function): 弱参照オブジェクト<2>.
                                                             (line  121)
* PyUnstable_Object_EnableDeferredRefcount (C function): オブジェクトプロトコル object protocol.
                                                             (line  598)
* PyUnstable_Object_GC_NewWithExtraData (C function): 循環参照ガベージコレクションをサポートする.
                                                             (line  110)
* PyUnstable_Object_IsUniquelyReferenced (C function): オブジェクトプロトコル object protocol.
                                                             (line  753)
* PyUnstable_Object_IsUniqueReferencedTemporary (C function): オブジェクトプロトコル object protocol.
                                                             (line  627)
* 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  121)
* PyUnstable_ThreadState_SetStackProtection (C function): 低水準 API.
                                                             (line   90)
* PyUnstable_TryIncRef (C function):     オブジェクトプロトコル object protocol.
                                                             (line  671)
* PyUnstable_Type_AssignVersionTag (C function): 型オブジェクト<2>.
                                                             (line  341)
* 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   98)
* PyWeakref_GetObject (C function):      弱参照オブジェクト<2>.
                                                             (line   83)
* PyWeakref_GetRef (C function):         弱参照オブジェクト<2>.
                                                             (line   69)
* PyWeakref_IsDead (C function):         弱参照オブジェクト<2>.
                                                             (line  105)
* PyWeakref_NewProxy (C function):       弱参照オブジェクト<2>.
                                                             (line   50)
* 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  426)
* QName (xml.etree.ElementTree のクラス): QName オブジェクト.
                                                             (line    6)
* qsize() (asyncio.Queue のメソッド):    Queue.              (line   79)
* qsize() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  109)
* qsize() (queue.Queue のメソッド):      キューオブジェクト. (line    9)
* qsize() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line    9)
* qualified name:                        用語集<2>.          (line 1494)
* quantiles() (statistics モジュール):   関数の詳細.         (line  483)
* quantiles() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  109)
* quantize() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  489)
* quantize() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  469)
* QueryInfoKey() (winreg モジュール):    関数<14>.           (line  316)
* QueryReflectionKey() (winreg モジュール): 関数<14>.        (line  511)
* QueryValue() (winreg モジュール):      関数<14>.           (line  344)
* QueryValueEx() (winreg モジュール):    関数<14>.           (line  364)
* QUESTION (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  201)
* Queue (asyncio のクラス):              Queue.              (line    6)
* Queue (concurrent.interpreters のクラス): Communicating Between Interpreters.
                                                             (line    6)
* Queue (multiprocessing のクラス):      パイプ Pipe とキュー Queue.
                                                             (line   91)
* Queue (queue のクラス):                queue --- 同期キュークラス.
                                                             (line   32)
* queue (sched.scheduler の属性):        スケジューラオブジェクト.
                                                             (line   76)
* 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   24)
* QueueShutDown:                         例外<15>.           (line   16)
* quick_ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line  202)
* quiet (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  558)
* quit (pdb command):                    Debugger commands.  (line  434)
* 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 のメソッド): Native load/save dialogs.
                                                             (line  137)
* quit() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  465)
* quitting (bdb.Bdb attribute):          bdb --- デバッガーフレームワーク.
                                                             (line  361)
* QUOTE_ALL (csv モジュール):            モジュールコンテンツ.
                                                             (line  291)
* quote_from_bytes() (urllib.parse モジュール): URL のクオート.
                                                             (line   52)
* QUOTE_MINIMAL (csv モジュール):        モジュールコンテンツ.
                                                             (line  296)
* QUOTE_NONE (csv モジュール):           モジュールコンテンツ.
                                                             (line  316)
* QUOTE_NONNUMERIC (csv モジュール):     モジュールコンテンツ.
                                                             (line  302)
* QUOTE_NOTNULL (csv モジュール):        モジュールコンテンツ.
                                                             (line  329)
* quote_plus() (urllib.parse モジュール): URL のクオート.    (line   40)
* QUOTE_STRINGS (csv モジュール):        モジュールコンテンツ.
                                                             (line  341)
* 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   64)
* quoted-printable;encoding:             quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line    8)
* quotes (shlex.shlex の属性):           shlex オブジェクト. (line  114)
* quoting (csv.Dialect の属性):          Dialect クラスと書式化パラメータ.
                                                             (line   75)
* 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 1521)
* radians() (math モジュール):           角度変換.           (line   10)
* radians() (turtle モジュール):         設定と計測.         (line   28)
* Radiobutton (tkinter のクラス):        Widget classes.     (line 1481)
* RADIOBUTTON (tkinter モジュール):      定数<10>.           (line  113)
* Radiobutton (tkinter.ttk のクラス):    Additional widgets. (line  160)
* radix (sys.float_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line  685)
* radix() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  493)
* radix() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  494)
* RADIXCHAR (locale モジュール):         locale --- 国際化サービス.
                                                             (line  270)
* Raise (ast のクラス):                  文 Statements.      (line  112)
* RAISE (monitoring event):              Events.             (line   82)
* raise_on_defect (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  179)
* raise_signal() (signal モジュール):    モジュールの内容<3>.
                                                             (line  350)
* RAISE_VARARGS (opcode):                Python バイトコード命令.
                                                             (line 1063)
* RAISED (tkinter モジュール):           定数<10>.           (line   55)
* 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 objects.
                                                             (line  178)
* Rational (numbers のクラス):           数値塔.             (line   41)
* raw (io.BufferedIOBase の属性):        I/O 基底クラス.     (line  268)
* 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  432)
* raw() (pickle.PickleBuffer のメソッド): モジュールインターフェース.
                                                             (line  344)
* 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 の属性):                  Match Objects.      (line  202)
* READ (inspect.BufferFlags の属性):     Buffer flags.       (line   49)
* read_binary() (importlib.resources モジュール): 関数 API.  (line   75)
* read_byte() (mmap.mmap のメソッド):    mmap --- メモリマップファイルのサポート.
                                                             (line  256)
* 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   48)
* 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() (file のメソッド):              I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line   22)
* read() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   14)
* read() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  285)
* read() (io.BufferedIOBase のメソッド): I/O 基底クラス.     (line  288)
* 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  245)
* read() (os モジュール):                ファイル記述子の操作.
                                                             (line  726)
* read() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   46)
* read() (ssl.MemoryBIO のメソッド):     Memory BIO support. (line  145)
* read() (ssl.SSLSocket のメソッド):     SSL sockets.        (line   77)
* read() (tkinter.PhotoImage のメソッド): Image classes.     (line  176)
* read() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   24)
* read() (zipfile.ZipFile のメソッド):   ZipFile objects.    (line  253)
* read1() (bz2.BZ2File のメソッド):      ファイルの圧縮/解凍.
                                                             (line  109)
* read1() (io.BufferedIOBase のメソッド): I/O 基底クラス.    (line  312)
* read1() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   89)
* read1() (io.BytesIO のメソッド):       バッファ付きストリーム.
                                                             (line   43)
* READABLE (tkinter モジュール):         File handlers.      (line   42)
* readable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   91)
* readable() (io.IOBase のメソッド):     I/O 基底クラス.     (line   77)
* readall() (io.RawIOBase のメソッド):   I/O 基底クラス.     (line  202)
* readbuffer_encode() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  263)
* Reader (io のクラス):                  Static Typing.      (line   10)
* reader() (csv モジュール):             モジュールコンテンツ.
                                                             (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  119)
* readinto() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   18)
* readinto() (io.BufferedIOBase のメソッド): I/O 基底クラス. (line  324)
* readinto() (io.RawIOBase のメソッド):  I/O 基底クラス.     (line  212)
* readinto() (os モジュール):            ファイル記述子の操作.
                                                             (line  746)
* readinto1() (io.BufferedIOBase のメソッド): I/O 基底クラス.
                                                             (line  338)
* 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  261)
* readlines() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   70)
* readlines() (io.IOBase のメソッド):    I/O 基底クラス.     (line   91)
* readlink() (os モジュール):            ファイルとディレクトリ.
                                                             (line  687)
* 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  449)
* ReadOnly (typing モジュール):          特殊形式.           (line  278)
* readprofile() (tkinter.Tk のメソッド): Toplevel widgets.   (line  101)
* ReadTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line   20)
* readuntil() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   56)
* readv() (os モジュール):               ファイル記述子の操作.
                                                             (line  911)
* 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 objects.
                                                             (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  437)
* 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  218)
* 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  454)
* 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  459)
* recv() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   24)
* recv() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line  299)
* recvfrom_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  448)
* recvfrom() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  314)
* recvmsg_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  409)
* recvmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  334)
* redirect_request() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   15)
* redirect_stderr() (contextlib モジュール): ユーティリティ. (line  359)
* redirect_stdout() (contextlib モジュール): ユーティリティ. (line  316)
* redisplay() (readline モジュール):     行バッファ.         (line   19)
* redrawln() (curses.window のメソッド): Window objects.     (line  481)
* redrawwin() (curses.window のメソッド): Window objects.    (line  487)
* reduce() (functools モジュール):       functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  443)
* reducer_override() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  209)
* reentrant:                             用語集<2>.          (line 1554)
* 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 1532)
* ReferenceError:                        具象例外.           (line  249)
* ReferenceType (weakref のクラス):      weakref --- Weak references.
                                                             (line  325)
* refold_source (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  385)
* refresh() (curses.window のメソッド):  Window objects.     (line  492)
* 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   99)
* register_at_fork() (os モジュール):    プロセス管理.       (line  556)
* register_callback() (sys.monitoring モジュール): Registering callback functions.
                                                             (line    6)
* register_converter() (sqlite3 モジュール): モジュール関数. (line  146)
* register_defect() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  243)
* register_dialect() (csv モジュール):   モジュールコンテンツ.
                                                             (line   80)
* register_error() (codecs モジュール):  エラーハンドラ.     (line   98)
* register_function() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line    9)
* register_function() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer objects.
                                                             (line   10)
* register_instance() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   26)
* register_instance() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer objects.
                                                             (line   27)
* register_introspection_functions() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   39)
* register_introspection_functions() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer objects.
                                                             (line   52)
* register_multicall_functions() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   45)
* register_multicall_functions() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer objects.
                                                             (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  176)
* 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  161)
* register() (faulthandler モジュール):  ユーザシグナルに対してtracebackをダンプする.
                                                             (line    6)
* register() (functools.singledispatch のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  493)
* register() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   95)
* register() (select.devpoll のメソッド): /dev/poll polling objects.
                                                             (line   30)
* register() (select.epoll のメソッド):  Edge and level trigger polling epoll objects.
                                                             (line   87)
* register() (select.poll のメソッド):   Polling objects.    (line   15)
* register() (selectors.BaseSelector のメソッド): クラス<4>. (line   67)
* register() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line   78)
* register() (webbrowser モジュール):    コマンドライン・インターフェース<6>.
                                                             (line   75)
* registerDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<2>.
                                                             (line    8)
* registerResult() (unittest モジュール): シグナルハンドリング.
                                                             (line   33)
* REGTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  329)
* regular package:                       用語集<2>.          (line 1547)
* relative_to() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  317)
* relative;import:                       import 文.          (line  104)
* relative;URL:                          urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* release (os.uname_result の属性):      プロセスのパラメーター.
                                                             (line  617)
* release() (_thread.LockType のメソッド): _thread --- 低水準なスレッド API.
                                                             (line  171)
* release() (asyncio.Condition のメソッド): Condition.       (line   79)
* release() (asyncio.Lock のメソッド):   Lock.               (line   50)
* release() (asyncio.Semaphore のメソッド): Semaphore.       (line   56)
* release() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   32)
* release() (memoryview のメソッド):     メモリビュー.       (line  250)
* release() (multiprocessing.Lock のメソッド): 同期プリミティブ.
                                                             (line  110)
* release() (multiprocessing.RLock のメソッド): 同期プリミティブ.
                                                             (line  175)
* release() (pickle.PickleBuffer のメソッド): モジュールインターフェース.
                                                             (line  352)
* release() (platform モジュール):       Cross platform.     (line  117)
* release() (threading.Condition のメソッド): Condition objects.
                                                             (line   90)
* release() (threading.Lock のメソッド): Lock objects.       (line   76)
* release() (threading.RLock のメソッド): RLock objects.     (line   95)
* release() (threading.Semaphore のメソッド): Semaphore objects.
                                                             (line   61)
* 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  503)
* remainder_near() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  500)
* remainder() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  497)
* remainder() (math モジュール):         Floating point arithmetic.
                                                             (line   64)
* remote_exec() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line 1891)
* RemoteDisconnected:                    http client --- HTTP プロトコルクライアント.
                                                             (line  192)
* remove_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  112)
* remove_done_callback() (asyncio.Task のメソッド): Task object.
                                                             (line  115)
* 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  233)
* remove() (collections.deque のメソッド): deque オブジェクト.
                                                             (line  101)
* remove() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   76)
* remove() (mailbox.MH のメソッド):      MH オブジェクト.    (line   81)
* remove() (os モジュール):              ファイルとディレクトリ.
                                                             (line  724)
* remove() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line  108)
* remove() (set のメソッド):             set（集合）型 --- set frozenset.
                                                             (line  201)
* remove() (tkinter.PanedWindow のメソッド): Widget classes. (line 1381)
* remove() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  165)
* 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  748)
* 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  563)
* removeResult() (unittest モジュール):  シグナルハンドリング.
                                                             (line   44)
* removesuffix() (bytearray のメソッド): bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (bytes のメソッド):     bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (str のメソッド):       文字列メソッド<2>.  (line  578)
* removexattr() (os モジュール):         Linux 拡張属性.     (line   42)
* rename() (ftplib.FTP のメソッド):      FTP オブジェクト.   (line  322)
* rename() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  300)
* rename() (os モジュール):              ファイルとディレクトリ.
                                                             (line  766)
* rename() (pathlib.Path のメソッド):    Copying moving and deleting.
                                                             (line   41)
* renames() (os モジュール):             ファイルとディレクトリ.
                                                             (line  803)
* 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 Interface.   (line   18)
* repeat() (timeit.Timer のメソッド):    Python Interface.   (line  104)
* REPL:                                  用語集<2>.          (line 1574)
* 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  409)
* 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 objects.  (line   39)
* replace() (dataclasses モジュール):    モジュールの内容<5>.
                                                             (line  457)
* 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  820)
* replace() (pathlib.Path のメソッド):   Copying moving and deleting.
                                                             (line   69)
* replace() (str のメソッド):            文字列メソッド<2>.  (line  593)
* replace() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  167)
* replace() (tkinter.Text のメソッド):   Widget classes.     (line 1845)
* replaceChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  135)
* ReplacePackage() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   21)
* report_callback_exception() (tkinter.Tk のメソッド): Toplevel widgets.
                                                             (line  109)
* 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  634)
* 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オブジェクト.
                                                             (line   99)
* request_rate() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   59)
* request_uri() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   26)
* request_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  152)
* request() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line    8)
* RequestHandlerClass (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   74)
* requestline (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  133)
* 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  305)
* RESERVED_MICROSOFT (uuid モジュール):  uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  301)
* RESERVED_NCS (uuid モジュール):        uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  291)
* reset_mock() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  882)
* reset_mock() (unittest.mock.Mock のメソッド): Mock クラス. (line  201)
* reset_peak() (tracemalloc モジュール): 関数<11>.           (line   37)
* reset_prog_mode() (curses モジュール): 関数<6>.            (line  439)
* reset_shell_mode() (curses モジュール): 関数<6>.           (line  444)
* reset_tzpath() (zoneinfo モジュール):  関数<3>.            (line   27)
* reset() (asyncio.Barrier のメソッド):  Barrier.            (line   78)
* reset() (bdb.Bdb のメソッド):          bdb --- デバッガーフレームワーク.
                                                             (line  181)
* 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   86)
* 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  449)
* resetwarnings() (warnings モジュール): 利用可能な関数.     (line  130)
* resizable() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1578)
* resize_term() (curses モジュール):     関数<6>.            (line  454)
* resize() (bytearray のメソッド):       bytearray オブジェクト.
                                                             (line   75)
* resize() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  237)
* resize() (curses.window のメソッド):   Window objects.     (line  511)
* resize() (mmap.mmap のメソッド):       mmap --- メモリマップファイルのサポート.
                                                             (line  267)
* resizemode() (turtle モジュール):      見た目.             (line   24)
* resizeterm() (curses モジュール):      関数<6>.            (line  463)
* resolution (datetime.date の属性):     date objects.       (line  138)
* resolution (datetime.datetime の属性): datetime objects.   (line  301)
* resolution (datetime.time の属性):     time objects.       (line   42)
* resolution (datetime.timedelta の属性): timedelta objects. (line  101)
* resolve_bases() (types モジュール):    動的な型生成.       (line   52)
* resolve_name() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   83)
* resolve_name() (pkgutil モジュール):   pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  194)
* 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  174)
* ResourceReader (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   12)
* ResourceWarning:                       警告.               (line   84)
* response() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  305)
* ResponseNotReady:                      http client --- HTTP プロトコルクライアント.
                                                             (line  178)
* responses (http.client モジュール):    http client --- HTTP プロトコルクライアント.
                                                             (line  213)
* responses (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  227)
* restart (pdb command):                 Debugger commands.  (line  421)
* restart_events() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  439)
* 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 (tkinter.simpledialog.Dialog の属性): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   38)
* result() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line   35)
* result() (asyncio.Task のメソッド):    Task object.        (line   77)
* 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  154)
* RETRYCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  181)
* Return (ast のクラス):                 関数およびクラス定義.
                                                             (line  113)
* return (pdb command):                  Debugger commands.  (line  227)
* 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  336)
* 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  158)
* retval (pdb command):                  Debugger commands.  (line  454)
* reveal_type() (typing モジュール):     Functions and decorators.
                                                             (line   81)
* reverse_order() (pstats.Stats のメソッド): The Stats Class.
                                                             (line  157)
* reverse_pointer (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   78)
* reverse_pointer (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  269)
* reverse() (array.array のメソッド):    array --- 効率的な数値配列.
                                                             (line  243)
* reverse() (collections.deque のメソッド): deque オブジェクト.
                                                             (line  106)
* 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  295)
* 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   88)
* 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  272)
* 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  272)
* 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 1924:                         Base85 エンコーディング.
                                                             (line   14)
* RFC; RFC 1939:                         poplib --- POP3 プロトコルクライアント.
                                                             (line   11)
* RFC; RFC 1939 <1>:                     poplib --- POP3 プロトコルクライアント.
                                                             (line   12)
* RFC; RFC 2033:                         新しいモジュールと改良されたモジュール<2>.
                                                             (line  581)
* 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  317)
* RFC; RFC 2045 <3>:                     email message Representing an email message.
                                                             (line  321)
* RFC; RFC 2045 <4>:                     email headerregistry Custom Header Objects.
                                                             (line  235)
* RFC; RFC 2045 <5>:                     email headerregistry Custom Header Objects.
                                                             (line  292)
* RFC; RFC 2045 <6>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  422)
* RFC; RFC 2045 <7>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  426)
* RFC; RFC 2045 <8>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  431)
* RFC; RFC 2045 <9>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  527)
* RFC; RFC 2045 <10>:                    email header 国際化されたヘッダー.
                                                             (line   28)
* RFC; RFC 2045 <11>:                    base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   25)
* RFC; RFC 2045 <12>:                    base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   26)
* 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>:                     ライブラリ<2>.      (line  116)
* RFC; RFC 2047 <3>:                     ライブラリ<5>.      (line  155)
* RFC; RFC 2047 <4>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   15)
* RFC; RFC 2047 <5>:                     email policy Policy Objects.
                                                             (line  361)
* RFC; RFC 2047 <6>:                     email policy Policy Objects.
                                                             (line  367)
* RFC; RFC 2047 <7>:                     email headerregistry Custom Header Objects.
                                                             (line   78)
* RFC; RFC 2047 <8>:                     email headerregistry Custom Header Objects.
                                                             (line  123)
* RFC; RFC 2047 <9>:                     email headerregistry Custom Header Objects.
                                                             (line  127)
* RFC; RFC 2047 <10>:                    email header 国際化されたヘッダー.
                                                             (line   29)
* RFC; RFC 2047 <11>:                    email header 国際化されたヘッダー.
                                                             (line   51)
* RFC; RFC 2047 <12>:                    email header 国際化されたヘッダー.
                                                             (line  111)
* RFC; RFC 2047 <13>:                    email header 国際化されたヘッダー.
                                                             (line  135)
* RFC; RFC 2047 <14>:                    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>:                     ライブラリ<33>.     (line    6)
* RFC; RFC 2104 <3>:                     hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   10)
* RFC; RFC 2109:                         Python API の変更<10>.
                                                             (line   76)
* 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   64)
* 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  141)
* 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  639)
* RFC; RFC 2231:                         ライブラリ<23>.     (line   68)
* RFC; RFC 2231 <1>:                     ライブラリ<59>.     (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  386)
* RFC; RFC 2231 <7>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  389)
* RFC; RFC 2231 <8>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  493)
* RFC; RFC 2231 <9>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  501)
* RFC; RFC 2231 <10>:                    email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  536)
* 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>:                     テスト<49>.         (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  274)
* 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   84)
* RFC; RFC 2822 <9>:                     email header 国際化されたヘッダー.
                                                             (line  111)
* RFC; RFC 2822 <10>:                    email header 国際化されたヘッダー.
                                                             (line  129)
* 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  155)
* 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  143)
* RFC; RFC 2965 <7>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  146)
* RFC; RFC 2965 <8>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  153)
* RFC; RFC 2965 <9>:                     FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line   16)
* RFC; RFC 2965 <10>:                    CookiePolicy オブジェクト.
                                                             (line   76)
* RFC; RFC 2965 <11>:                    CookiePolicy オブジェクト.
                                                             (line   81)
* 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  315)
* RFC; RFC 3164:                         RFC5424 をサポートする syslog へのロギング.
                                                             (line    7)
* RFC; RFC 3171:                         Address オブジェクト.
                                                             (line   95)
* RFC; RFC 3207:                         新しいモジュールと改良されたモジュール<2>.
                                                             (line  586)
* RFC; RFC 3229:                         HTTP ステータスコード.
                                                             (line   52)
* RFC; RFC 3280:                         SSL sockets.        (line  159)
* RFC; RFC 3330:                         Address オブジェクト.
                                                             (line  181)
* RFC; RFC 3339:                         メッセージ内での日付と時刻の表示.
                                                             (line   17)
* RFC; RFC 3362:                         mimetypes.          (line   41)
* RFC; RFC 3454:                         セキュリティ<31>.   (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   54)
* RFC; RFC 3490 <3>:                     encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   59)
* RFC; RFC 3490 Section 3.1:             encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   27)
* RFC; RFC 3491:                         セキュリティ<31>.   (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:                         ライブラリ<166>.    (line  350)
* 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:             ライブラリ<50>.     (line  339)
* 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>:                     ライブラリ<46>.     (line  197)
* RFC; RFC 3986 <8>:                     urllib parse --- URL を構成要素に解析する.
                                                             (line   35)
* RFC; RFC 3986 <9>:                     URL の解析.         (line  118)
* RFC; RFC 3986 <10>:                    URL の解析.         (line  144)
* RFC; RFC 3986 <11>:                    URL の解析.         (line  275)
* 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  149)
* RFC; RFC 4007:                         Address オブジェクト.
                                                             (line  237)
* RFC; RFC 4007 <1>:                     Address オブジェクト.
                                                             (line  308)
* RFC; RFC 4047:                         mimetypes.          (line   49)
* RFC; RFC 4086:                         TLS 1 3.            (line   45)
* RFC; RFC 4122:                         新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  413)
* RFC; RFC 4122 <1>:                     新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  419)
* RFC; RFC 4122 <2>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   14)
* RFC; RFC 4122 <3>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  178)
* RFC; RFC 4122 <4>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  297)
* RFC; RFC 4122 <5>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  298)
* RFC; RFC 4180:                         csv --- CSV ファイルの読み書き.
                                                             (line   12)
* RFC; RFC 4193:                         Address オブジェクト.
                                                             (line  295)
* RFC; RFC 4217:                         FTP_TLS オブジェクト.
                                                             (line   11)
* RFC; RFC 4291:                         ライブラリ<68>.     (line 1074)
* RFC; RFC 4291 <1>:                     ライブラリ<120>.    (line  653)
* RFC; RFC 4291 <2>:                     Address オブジェクト.
                                                             (line  192)
* RFC; RFC 4291 <3>:                     Address オブジェクト.
                                                             (line  231)
* RFC; RFC 4291 <4>:                     Address オブジェクト.
                                                             (line  302)
* RFC; RFC 4337:                         mimetypes.          (line   60)
* RFC; RFC 4366:                         ssl<13>.            (line   26)
* RFC; RFC 4380:                         Address オブジェクト.
                                                             (line  322)
* RFC; RFC 4627:                         json --- JSON エンコーダーとデコーダー.
                                                             (line   10)
* RFC; RFC 4627 <1>:                     トップレベルの非オブジェクト、非配列の値の扱い.
                                                             (line    6)
* RFC; RFC 4648:                         ライブラリ<5>.      (line  113)
* RFC; RFC 4648 <1>:                     ドキュメント<39>.   (line   32)
* RFC; RFC 4648 <2>:                     base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   12)
* RFC; RFC 4648 <3>:                     base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   19)
* RFC; RFC 4648 <4>:                     RFC 4648 エンコーディング.
                                                             (line    6)
* RFC; RFC 4648 <5>:                     RFC 4648 エンコーディング.
                                                             (line   91)
* RFC; RFC 4648 <6>:                     セキュリティで考慮すべき点<4>.
                                                             (line    6)
* RFC; RFC 4648 <7>:                     セキュリティで考慮すべき点<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   98)
* 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  447)
* RFC; RFC 5322:                         Batteries included. (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  192)
* RFC; RFC 5322 <11>:                    email policy Policy Objects.
                                                             (line  147)
* RFC; RFC 5322 <12>:                    email policy Policy Objects.
                                                             (line  340)
* RFC; RFC 5322 <13>:                    email policy Policy Objects.
                                                             (line  361)
* RFC; RFC 5322 <14>:                    email policy Policy Objects.
                                                             (line  367)
* RFC; RFC 5322 <15>:                    email policy Policy Objects.
                                                             (line  379)
* RFC; RFC 5322 <16>:                    email policy Policy Objects.
                                                             (line  412)
* 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  117)
* RFC; RFC 5322 <20>:                    email headerregistry Custom Header Objects.
                                                             (line  122)
* RFC; RFC 5322 <21>:                    email headerregistry Custom Header Objects.
                                                             (line  124)
* RFC; RFC 5322 <22>:                    email headerregistry Custom Header Objects.
                                                             (line  138)
* RFC; RFC 5322 <23>:                    email headerregistry Custom Header Objects.
                                                             (line  157)
* RFC; RFC 5322 <24>:                    email headerregistry Custom Header Objects.
                                                             (line  411)
* RFC; RFC 5322 <25>:                    email headerregistry Custom Header Objects.
                                                             (line  444)
* RFC; RFC 5322 <26>:                    email headerregistry Custom Header Objects.
                                                             (line  478)
* 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  164)
* RFC; RFC 5322 Section 2.2:             ライブラリ<32>.     (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:                         セキュリティ<31>.   (line   20)
* RFC; RFC 5895:                         encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   12)
* RFC; RFC 5929:                         SSL sockets.        (line  265)
* RFC; RFC 6066:                         定数<9>.            (line  410)
* RFC; RFC 6066 <1>:                     SSL contexts.       (line  287)
* 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  383)
* 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  381)
* 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  198)
* RFC; RFC 7301:                         Application-Layer Protocol Negotiation Support.
                                                             (line   10)
* RFC; RFC 7301 <1>:                     定数<9>.            (line  386)
* RFC; RFC 7301 <2>:                     SSL contexts.       (line  257)
* RFC; RFC 7525:                         TLS 1 3.            (line   65)
* RFC; RFC 7538:                         ライブラリ<110>.    (line  171)
* RFC; RFC 7616:                         urllib.             (line    8)
* RFC; RFC 7616 <1>:                     ライブラリ<42>.     (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  185)
* 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:                          ライブラリ<44>.     (line  212)
* RFC; RFC 9110:                         ライブラリ<44>.     (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:                         ライブラリ<91>.     (line   75)
* RFC; RFC 9309:                         ライブラリ<3>.      (line   11)
* RFC; RFC 9309 <1>:                     urllib robotparser --- robots txt 用のパーサー.
                                                             (line   13)
* RFC; RFC 9512:                         mimetypes.          (line   68)
* RFC; RFC 9512 <1>:                     ライブラリ<28>.     (line  274)
* RFC; RFC 9559:                         mimetypes.          (line   27)
* RFC; RFC 9559 <1>:                     ライブラリ<46>.     (line  105)
* RFC; RFC 9562:                         uuid.               (line    8)
* RFC; RFC 9562 <1>:                     uuid.               (line   12)
* RFC; RFC 9562 <2>:                     ライブラリ<34>.     (line  256)
* RFC; RFC 9562 <3>:                     ライブラリ<34>.     (line  259)
* RFC; RFC 9562 <4>:                     ライブラリ<37>.     (line  174)
* RFC; RFC 9562 <5>:                     ライブラリ<46>.     (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   74)
* RFC; RFC 9562 <9>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  149)
* RFC; RFC 9562 <10>:                    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  299)
* RFC; RFC 9562 <11>:                    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  328)
* RFC; RFC 9562 Section 5.1:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  193)
* RFC; RFC 9562 Section 5.10:            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  321)
* RFC; RFC 9562 Section 5.3:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  207)
* RFC; RFC 9562 Section 5.4:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  213)
* RFC; RFC 9562 Section 5.5:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  219)
* RFC; RFC 9562 Section 5.6:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  225)
* RFC; RFC 9562 Section 5.7:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  242)
* RFC; RFC 9562 Section 5.8:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  252)
* RFC; RFC 9562 Section 5.9:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  314)
* RFC; RFC 9562 Section 6.10-3:          ライブラリ<23>.     (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   74)
* rfile (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  166)
* 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  286)
* rfind() (str のメソッド):              文字列メソッド<2>.  (line  608)
* 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   86)
* richcmpfunc (C type):                  Slot Type typedefs. (line   90)
* RIDGE (tkinter モジュール):            定数<10>.           (line   55)
* right (filecmp.dircmp の属性):         dircmp クラス.      (line   48)
* RIGHT (tkinter モジュール):            定数<10>.           (line   39)
* 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  622)
* rjust() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  345)
* rjust() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  345)
* rjust() (str のメソッド):              文字列メソッド<2>.  (line  638)
* RLIM_INFINITY (resource モジュール):   リソースの制限.     (line   22)
* RLIMIT_AS (resource モジュール):       リソースの制限.     (line  150)
* RLIMIT_CORE (resource モジュール):     リソースの制限.     (line   93)
* RLIMIT_CPU (resource モジュール):      リソースの制限.     (line  100)
* RLIMIT_DATA (resource モジュール):     リソースの制限.     (line  112)
* RLIMIT_FSIZE (resource モジュール):    リソースの制限.     (line  108)
* RLIMIT_KQUEUES (resource モジュール):  リソースの制限.     (line  224)
* RLIMIT_MEMLOCK (resource モジュール):  リソースの制限.     (line  139)
* RLIMIT_MSGQUEUE (resource モジュール): リソースの制限.     (line  154)
* RLIMIT_NICE (resource モジュール):     リソースの制限.     (line  162)
* RLIMIT_NOFILE (resource モジュール):   リソースの制限.     (line  131)
* RLIMIT_NPROC (resource モジュール):    リソースの制限.     (line  127)
* RLIMIT_NPTS (resource モジュール):     リソースの制限.     (line  216)
* RLIMIT_OFILE (resource モジュール):    リソースの制限.     (line  135)
* RLIMIT_RSS (resource モジュール):      リソースの制限.     (line  122)
* RLIMIT_RTPRIO (resource モジュール):   リソースの制限.     (line  170)
* RLIMIT_RTTIME (resource モジュール):   リソースの制限.     (line  178)
* RLIMIT_SBSIZE (resource モジュール):   リソースの制限.     (line  195)
* RLIMIT_SIGPENDING (resource モジュール): リソースの制限.   (line  187)
* RLIMIT_STACK (resource モジュール):    リソースの制限.     (line  116)
* RLIMIT_SWAP (resource モジュール):     リソースの制限.     (line  205)
* RLIMIT_VMEM (resource モジュール):     リソースの制限.     (line  143)
* 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  841)
* 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   15)
* 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  112)
* rotate() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  509)
* rotate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  517)
* 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 (tkinter モジュール):            定数<10>.           (line  136)
* 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  689)
* Row (sqlite3 のクラス):                Row オブジェクト.   (line    6)
* row_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  811)
* row_factory (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  229)
* rowconfigure() (tkinter.Grid のメソッド): Base and mixin classes.
                                                             (line 1912)
* rowconfigure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  211)
* 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  655)
* rpc_paths (xmlrpc.server.SimpleXMLRPCRequestHandler の属性): SimpleXMLRPCServer objects.
                                                             (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  673)
* RSQB (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  212)
* rstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  368)
* rstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  368)
* rstrip() (str のメソッド):             文字列メソッド<2>.  (line  682)
* rt() (turtle モジュール):              Turtle の動き.      (line   40)
* RTLD_DEEPBIND (os モジュール):         雑多なシステム情報. (line  162)
* RTLD_GLOBAL (ctypes モジュール):       共有ライブラリをロードする.
                                                             (line  166)
* RTLD_GLOBAL (os モジュール):           雑多なシステム情報. (line  162)
* RTLD_LAZY (os モジュール):             雑多なシステム情報. (line  162)
* RTLD_LOCAL (ctypes モジュール):        共有ライブラリをロードする.
                                                             (line  171)
* RTLD_LOCAL (os モジュール):            雑多なシステム情報. (line  162)
* RTLD_NODELETE (os モジュール):         雑多なシステム情報. (line  162)
* RTLD_NOLOAD (os モジュール):           雑多なシステム情報. (line  162)
* RTLD_NOW (os モジュール):              雑多なシステム情報. (line  162)
* ruler (cmd.Cmd の属性):                Cmdオブジェクト.    (line  169)
* run (pdb command):                     Debugger commands.  (line  421)
* 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 モジュール): Scheduling from other threads.
                                                             (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  479)
* 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  241)
* run() (profile モジュール):            profile and cProfile Module Reference.
                                                             (line    9)
* run() (profile.Profile のメソッド):    profile and cProfile Module Reference.
                                                             (line  107)
* run() (sched.scheduler のメソッド):    スケジューラオブジェクト.
                                                             (line   50)
* run() (subprocess モジュール):         Using the subprocess Module.
                                                             (line   10)
* run() (threading.Thread のメソッド):   Thread objects.     (line  127)
* run() (trace.Trace のメソッド):        プログラミングインターフェース.
                                                             (line   21)
* run() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  960)
* run() (unittest.TestCase のメソッド):  テストクラス.       (line   83)
* run() (unittest.TestSuite のメソッド): テストのグループ化. (line   41)
* run() (unittest.TextTestRunner のメソッド): テストのロードと起動.
                                                             (line  498)
* run() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line   99)
* runcall() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  495)
* runcall() (pdb モジュール):            コマンドライン・インターフェース<8>.
                                                             (line  103)
* runcall() (pdb.Pdb のメソッド):        コマンドライン・インターフェース<8>.
                                                             (line  241)
* runcall() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  116)
* runcode() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   33)
* runctx() (bdb.Bdb のメソッド):         bdb --- デバッガーフレームワーク.
                                                             (line  490)
* runctx() (profile モジュール):         profile and cProfile Module Reference.
                                                             (line   23)
* runctx() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  111)
* runctx() (trace.Trace のメソッド):     プログラミングインターフェース.
                                                             (line   27)
* runeval() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  485)
* runeval() (pdb モジュール):            コマンドライン・インターフェース<8>.
                                                             (line   96)
* runeval() (pdb.Pdb のメソッド):        コマンドライン・インターフェース<8>.
                                                             (line  241)
* 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  712)
* RWF_DSYNC (os モジュール):             ファイル記述子の操作.
                                                             (line  692)
* RWF_HIPRI (os モジュール):             ファイル記述子の操作.
                                                             (line  621)
* RWF_NOWAIT (os モジュール):            ファイル記述子の操作.
                                                             (line  607)
* RWF_SYNC (os モジュール):              ファイル記述子の操作.
                                                             (line  702)
* S (re モジュール):                     フラグ.             (line  103)
* S (tkinter モジュール):                定数<10>.           (line   21)
* 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   36)
* safe_path (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  571)
* safe_substitute() (string.Template のメソッド): Template strings $-strings.
                                                             (line   60)
* saferepr() (pprint モジュール):        関数<4>.            (line   98)
* SafeUUID (uuid のクラス):              uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   32)
* same_files (filecmp.dircmp の属性):    dircmp クラス.      (line   88)
* same_quantum() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  513)
* same_quantum() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  527)
* samefile() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  467)
* samefile() (pathlib.Path のメソッド):  ファイルの種類とステータスを問い合わせる.
                                                             (line  154)
* 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   65)
* samples() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   58)
* sash_coord() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1440)
* sash_mark() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1448)
* sash_place() (tkinter.PanedWindow のメソッド): Widget classes.
                                                             (line 1454)
* sash() (tkinter.PanedWindow のメソッド): Widget classes.   (line 1432)
* sashpos() (tkinter.ttk.Panedwindow のメソッド): Additional widgets.
                                                             (line  151)
* SATURDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  439)
* 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 のクラス):  Native load/save dialogs.
                                                             (line   67)
* SAVEDCWD (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   14)
* SaveFileDialog (tkinter.filedialog のクラス): Native load/save dialogs.
                                                             (line  159)
* SaveKey() (winreg モジュール):         関数<14>.           (line  392)
* SaveSignals (test.support のクラス):   test support --- Utilities for the Python test suite.
                                                             (line  804)
* savetty() (curses モジュール):         関数<6>.            (line  469)
* 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)
* Scale (tkinter のクラス):              Widget classes.     (line 1523)
* Scale (tkinter.ttk のクラス):          Additional widgets. (line  174)
* scale() (tkinter.Canvas のメソッド):   Widget classes.     (line  353)
* scaleb() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  517)
* scaleb() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  537)
* scan_dragto() (tkinter.Canvas のメソッド): Widget classes. (line  666)
* scan_dragto() (tkinter.Entry のメソッド): Widget classes.  (line  840)
* scan_dragto() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line 1031)
* scan_dragto() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1711)
* scan_dragto() (tkinter.Text のメソッド): Widget classes.   (line 2287)
* scan_mark() (tkinter.Canvas のメソッド): Widget classes.   (line  660)
* scan_mark() (tkinter.Entry のメソッド): Widget classes.    (line  834)
* scan_mark() (tkinter.Listbox のメソッド): Widget classes.  (line 1025)
* scan_mark() (tkinter.Spinbox のメソッド): Widget classes.  (line 1705)
* scan_mark() (tkinter.Text のメソッド): Widget classes.     (line 2281)
* scan() (tkinter.Spinbox のメソッド):   Widget classes.     (line 1697)
* scandir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  859)
* 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  306)
* Screen (turtle のクラス):              Public classes.     (line   30)
* screensize() (turtle モジュール):      ウィンドウの制御.   (line   88)
* script_from_examples() (doctest モジュール): デバッグ.     (line   72)
* SCROLL (tkinter モジュール):           定数<10>.           (line  152)
* scroll() (curses.window のメソッド):   Window objects.     (line  517)
* Scrollbar (tkinter のクラス):          Widget classes.     (line 1566)
* Scrollbar (tkinter.ttk のクラス):      Additional widgets. (line  197)
* ScrolledCanvas (turtle のクラス):      Public classes.     (line   35)
* ScrolledText (tkinter.scrolledtext のクラス): tkinter scrolledtext --- Scrolled text widget.
                                                             (line   24)
* scrollok() (curses.window のメソッド): Window objects.     (line  524)
* scrypt() (hashlib モジュール):         鍵導出.             (line   49)
* SE (tkinter モジュール):               定数<10>.           (line   21)
* seal() (unittest.mock モジュール):     Sealing mocks.      (line    6)
* search_function() (encodings モジュール): encodings --- Encodings package.
                                                             (line   23)
* search_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   83)
* search() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  311)
* search() (re モジュール):              関数<2>.            (line   35)
* search() (re.Pattern のメソッド):      Regular Expression Objects.
                                                             (line   18)
* search() (tkinter.Text のメソッド):    Widget classes.     (line 2264)
* second (datetime.datetime の属性):     datetime objects.   (line  329)
* second (datetime.time の属性):         time objects.       (line   58)
* seconds (datetime.timedelta の属性):   timedelta objects.  (line  116)
* 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 contexts.      (line  622)
* see() (tkinter.Listbox のメソッド):    Widget classes.     (line  953)
* see() (tkinter.Text のメソッド):       Widget classes.     (line 1892)
* see() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  245)
* seed_bits (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1080)
* seed() (random モジュール):            保守 bookkeeping 関数.
                                                             (line    6)
* seed() (random.Random のメソッド):     他の生成器.         (line   19)
* SEEK_CUR (os モジュール):              ファイル記述子の操作.
                                                             (line  323)
* SEEK_DATA (os モジュール):             ファイル記述子の操作.
                                                             (line  347)
* SEEK_END (os モジュール):              ファイル記述子の操作.
                                                             (line  323)
* SEEK_HOLE (os モジュール):             ファイル記述子の操作.
                                                             (line  347)
* SEEK_SET (os モジュール):              ファイル記述子の操作.
                                                             (line  323)
* 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  296)
* seek() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   66)
* seekable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   97)
* seekable() (io.IOBase のメソッド):     I/O 基底クラス.     (line  128)
* seekable() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  307)
* SEL (tkinter モジュール):              定数<10>.           (line   87)
* SEL_FIRST (tkinter モジュール):        定数<10>.           (line   87)
* SEL_LAST (tkinter モジュール):         定数<10>.           (line   87)
* select_adjust() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  626)
* select_adjust() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  780)
* select_anchor() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  975)
* select_clear() (tkinter.Canvas のメソッド): Widget classes.
                                                             (line  634)
* select_clear() (tkinter.Entry のメソッド): Widget classes. (line  790)
* select_clear() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  985)
* select_from() (tkinter.Canvas のメソッド): Widget classes. (line  639)
* select_from() (tkinter.Entry のメソッド): Widget classes.  (line  801)
* select_includes() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  996)
* select_item() (tkinter.Canvas のメソッド): Widget classes. (line  646)
* select_present() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  807)
* select_range() (tkinter.Entry のメソッド): Widget classes. (line  813)
* select_set() (tkinter.Listbox のメソッド): Widget classes. (line 1002)
* select_to() (tkinter.Canvas のメソッド): Widget classes.   (line  653)
* select_to() (tkinter.Entry のメソッド): Widget classes.    (line  821)
* select() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  328)
* select() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  120)
* select() (selectors.BaseSelector のメソッド): クラス<4>.   (line  112)
* select() (tkinter.Checkbutton のメソッド): Widget classes. (line  709)
* select() (tkinter.Radiobutton のメソッド): Widget classes. (line 1504)
* select() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   57)
* selected_alpn_protocol() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  272)
* selected_npn_protocol() (ssl.SSLSocket のメソッド): SSL sockets.
                                                             (line  282)
* selection_add() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  268)
* selection_adjust() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  780)
* selection_adjust() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1733)
* selection_anchor() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  975)
* selection_clear() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  790)
* selection_clear() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  985)
* selection_clear() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  625)
* selection_clear() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1743)
* selection_element() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1752)
* selection_from() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  801)
* selection_from() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1759)
* selection_get() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  638)
* selection_handle() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  651)
* selection_includes() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line  996)
* selection_own_get() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  672)
* selection_own() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  665)
* selection_present() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  807)
* selection_present() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1766)
* selection_range() (tkinter.Entry のメソッド): Widget classes.
                                                             (line  813)
* selection_range() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1773)
* selection_remove() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  275)
* selection_set() (tkinter.Listbox のメソッド): Widget classes.
                                                             (line 1002)
* selection_set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  261)
* selection_to() (tkinter.Entry のメソッド): Widget classes. (line  821)
* selection_to() (tkinter.Spinbox のメソッド): Widget classes.
                                                             (line 1782)
* selection_toggle() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  282)
* selection() (tkinter.Spinbox のメソッド): Widget classes.  (line 1719)
* selection() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  253)
* selector (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   34)
* SelectorEventLoop (asyncio のクラス):  Event loop implementations.
                                                             (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   19)
* 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_event (tkinter.Event の属性):     Other classes.      (line   63)
* 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  315)
* 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   84)
* send() (coroutine のメソッド):         コルーチンオブジェクト.
                                                             (line   25)
* send() (generator のメソッド):         ジェネレータ-イテレータメソッド.
                                                             (line   27)
* send() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  217)
* 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  469)
* send() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  102)
* sendall() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  486)
* sendcmd() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line  156)
* sendfile() (asyncio.loop のメソッド):  ファイルの転送.     (line    6)
* sendfile() (os モジュール):            ファイル記述子の操作.
                                                             (line  773)
* sendfile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  583)
* 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  572)
* sendmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  526)
* sendto() (asyncio.DatagramTransport のメソッド): データグラムトランスポート.
                                                             (line    6)
* sendto() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  506)
* sentinel (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  188)
* sentinel (unittest.mock モジュール):   sentinel.           (line    6)
* sep (os モジュール):                   雑多なシステム情報. (line  111)
* SEPARATOR (tkinter モジュール):        定数<10>.           (line  113)
* Separator (tkinter.ttk のクラス):      Additional widgets. (line  206)
* SEPTEMBER (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  482)
* sequence:                              用語集<2>.          (line 1587)
* 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 objects.
                                                             (line    9)
* serial (tkinter.Event の属性):         Other classes.      (line   15)
* serialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  691)
* serve_forever() (asyncio.Server のメソッド): Server objects.
                                                             (line   92)
* serve_forever() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   32)
* Server (asyncio のクラス):             Server objects.     (line   12)
* server (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  123)
* server (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   51)
* server_activate() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line  162)
* server_address (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   79)
* server_bind() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line  168)
* server_close() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   61)
* server_hostname (ssl.SSLSocket の属性): SSL sockets.       (line  351)
* server_side (ssl.SSLSocket の属性):    SSL sockets.        (line  344)
* server_software (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  177)
* server_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  183)
* server_version (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  412)
* ServerProxy (xmlrpc.client のクラス):  xmlrpc client --- XML-RPC クライアントアクセス.
                                                             (line   29)
* service_actions() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   45)
* session (ssl.SSLSocket の属性):        SSL sockets.        (line  363)
* session_reused (ssl.SSLSocket の属性): SSL sockets.        (line  373)
* session_stats() (ssl.SSLContext のメソッド): SSL contexts. (line  478)
* Set (ast のクラス):                    リテラル<3>.        (line  161)
* 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 1608)
* 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 contexts.
                                                             (line  253)
* set_app() (wsgiref.simple_server.WSGIServer のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   64)
* set_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1810)
* 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  834)
* set_boundary() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  412)
* set_boundary() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  594)
* set_break() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  369)
* set_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  237)
* set_children() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line   29)
* set_ciphers() (ssl.SSLContext のメソッド): SSL contexts.   (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  353)
* 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 1835)
* set_data() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  384)
* 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   54)
* 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  155)
* 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  453)
* set_default_verify_paths() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  231)
* set_defaults() (argparse.ArgumentParser のメソッド): パーサーのデフォルト値.
                                                             (line    6)
* set_defaults() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   27)
* set_ecdh_curve() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  364)
* set_errno() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  244)
* set_error_mode() (msvcrt モジュール):  その多の関数.       (line   12)
* set_escdelay() (curses モジュール):    関数<6>.            (line  480)
* set_event_loop_policy() (asyncio モジュール): ポリシーの取得と設定.
                                                             (line   16)
* set_event_loop() (asyncio モジュール): Event loop.         (line   66)
* set_event_loop() (asyncio.AbstractEventLoopPolicy のメソッド): ポリシーオブジェクト.
                                                             (line   23)
* set_events() (sys.monitoring モジュール): Setting events globally.
                                                             (line   13)
* set_exception_handler() (asyncio.loop のメソッド): Error handling API.
                                                             (line    8)
* set_exception() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   58)
* set_exception() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  119)
* set_executable() (multiprocessing モジュール): その他<5>.  (line  118)
* set_filter() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  141)
* 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  600)
* set_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1616)
* set_labels() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   50)
* set_last_error() (ctypes モジュール):  ユーティリティー関数.
                                                             (line  252)
* 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_menu() (tkinter.ttk.OptionMenu のメソッド): Additional widgets.
                                                             (line  102)
* set_name() (asyncio.Task のメソッド):  Task object.        (line  192)
* set_next() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  330)
* set_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  109)
* set_npn_protocols() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  267)
* 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  521)
* set_pasv() (ftplib.FTP のメソッド):    FTP オブジェクト.   (line  212)
* set_payload() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  226)
* set_pledged_input_size() (compression.zstd.ZstdCompressor のメソッド): メモリ上での圧縮と展開.
                                                             (line  105)
* 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 contexts.
                                                             (line  657)
* set_psk_server_callback() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  709)
* set_quit() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  359)
* set_result() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   51)
* set_result() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  107)
* set_return() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  335)
* set_running_or_notify_cancel() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   86)
* set_selection() (tkinter.filedialog.FileDialog のメソッド): Native load/save dialogs.
                                                             (line  145)
* set_seq1() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line   55)
* set_seq2() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (line   60)
* set_seqs() (difflib.SequenceMatcher のメソッド): SequenceMatcher objects.
                                                             (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 objects.
                                                             (line   22)
* set_server_name() (xmlrpc.server.DocCGIXMLRPCRequestHandler のメソッド): DocCGIXMLRPCRequestHandler.
                                                             (line   18)
* set_server_name() (xmlrpc.server.DocXMLRPCServer のメソッド): DocXMLRPCServer objects.
                                                             (line   17)
* set_server_title() (xmlrpc.server.DocCGIXMLRPCRequestHandler のメソッド): DocCGIXMLRPCRequestHandler.
                                                             (line   13)
* set_server_title() (xmlrpc.server.DocXMLRPCServer のメソッド): DocXMLRPCServer objects.
                                                             (line   12)
* set_servername_callback() (ssl.SSLContext のメソッド): SSL contexts.
                                                             (line  335)
* set_start_method() (multiprocessing モジュール): その他<5>.
                                                             (line  151)
* set_startup_hook() (readline モジュール): 開始フック.      (line    6)
* set_step() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  326)
* set_subdir() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   62)
* set_tabsize() (curses モジュール):     関数<6>.            (line  495)
* set_task_factory() (asyncio.loop のメソッド): Creating futures and tasks.
                                                             (line   61)
* set_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line   96)
* set_trace_async() (pdb モジュール):    コマンドライン・インターフェース<8>.
                                                             (line  126)
* set_trace_callback() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  406)
* set_trace() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  528)
* set_trace() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  344)
* set_trace() (pdb モジュール):          コマンドライン・インターフェース<8>.
                                                             (line  110)
* set_trace() (pdb.Pdb のメソッド):      コマンドライン・インターフェース<8>.
                                                             (line  241)
* set_tunnel() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  105)
* set_type() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  558)
* 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  339)
* SET_UPDATE (opcode):                   Python バイトコード命令.
                                                             (line  745)
* set_url() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   20)
* set_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line    8)
* set_userptr() (curses.panel.Panel のメソッド): Panel objects.
                                                             (line   43)
* set_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   69)
* set_wakeup_fd() (signal モジュール):   モジュールの内容<3>.
                                                             (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   48)
* 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.BooleanVar のメソッド): Variable classes.   (line  151)
* set() (tkinter.Scale のメソッド):      Widget classes.     (line 1546)
* set() (tkinter.Scrollbar のメソッド):  Widget classes.     (line 1584)
* set() (tkinter.ttk.Combobox のメソッド): ttk Combobox.     (line   19)
* set() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line   17)
* set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  289)
* set() (tkinter.Variable のメソッド):   Variable classes.   (line   37)
* set() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   77)
* setacl() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  343)
* SetAllocTrackerActivationThreshold() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  180)
* SetAllocTrackerMaximumAmplification() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  197)
* 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)
* SetBillionLaughsAttackProtectionActivationThreshold() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  119)
* SetBillionLaughsAttackProtectionMaximumAmplification() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  143)
* setblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  607)
* 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   75)
* 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  254)
* setdefault() (dict のメソッド):        Mapping Types --- dict.
                                                             (line  228)
* setdefault() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  116)
* setdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  378)
* setdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1603)
* setDocumentLocator() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   10)
* setDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   35)
* setegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  395)
* setEncoding() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   22)
* setEntityResolver() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   44)
* setErrorHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   54)
* seteuid() (os モジュール):             プロセスのパラメーター.
                                                             (line  401)
* setFeature() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   74)
* setfirstweekday() (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  342)
* setfirstweekday() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   52)
* setFormatter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   50)
* setframerate() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   54)
* setgid() (os モジュール):              プロセスのパラメーター.
                                                             (line  407)
* setgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  413)
* 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 モジュール):       モジュールの内容<3>.
                                                             (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   59)
* setLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line  311)
* setlogmask() (syslog モジュール):      syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   98)
* setLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line  323)
* setMaxConns() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line   13)
* setmode() (msvcrt モジュール):         ファイル操作関連.   (line   38)
* setName() (threading.Thread のメソッド): Thread objects.   (line  198)
* setnchannels() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   38)
* setnframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   65)
* setns() (os モジュール):               プロセスのパラメーター.
                                                             (line  428)
* setoutputsize() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  170)
* SetParamEntityParsing() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   53)
* setparams() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   88)
* setpassword() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  248)
* setpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  475)
* setpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  467)
* setpos() (turtle モジュール):          Turtle の動き.      (line   74)
* setpos() (wave.Wave_read のメソッド):  Wave_read オブジェクト.
                                                             (line   83)
* setposition() (turtle モジュール):     Turtle の動き.      (line   74)
* setpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  483)
* setprofile_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  139)
* setprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 1624)
* setprofile() (threading モジュール):   リファレンス<2>.    (line  133)
* setProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   87)
* setPublicId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line    6)
* setquota() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  353)
* setraw() (tty モジュール):             tty --- 端末制御用の関数群.
                                                             (line   43)
* setrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1681)
* setregid() (os モジュール):            プロセスのパラメーター.
                                                             (line  500)
* SetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   80)
* setresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  506)
* setresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  516)
* setreuid() (os モジュール):            プロセスのパラメーター.
                                                             (line  526)
* setrlimit() (resource モジュール):     リソースの制限.     (line   33)
* setsampwidth() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   46)
* setscrreg() (curses.window のメソッド): Window objects.    (line  533)
* setsid() (os モジュール):              プロセスのパラメーター.
                                                             (line  539)
* setsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  642)
* 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 states and the global interpreter lock.
                                                             (line   19)
* setswitchinterval() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1699)
* 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  503)
* setTarget() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   70)
* setter (C type):                       Defining Getters and Setters.
                                                             (line   42)
* settimeout() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  625)
* setTimeout() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line    9)
* settrace_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  117)
* settrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1711)
* 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   32)
* setUpClass() (unittest.TestCase のメソッド): テストクラス. (line   52)
* setUpModule() (unittest モジュール):   setUpModule と tearDownModule.
                                                             (line    6)
* setupterm() (curses モジュール):       関数<6>.            (line  508)
* SetValue() (winreg モジュール):        関数<14>.           (line  416)
* SetValueEx() (winreg モジュール):      関数<14>.           (line  445)
* setvar() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line   68)
* 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  813)
* SF_NOCACHE (os モジュール):            ファイル記述子の操作.
                                                             (line  824)
* SF_NODISKIO (os モジュール):           ファイル記述子の操作.
                                                             (line  813)
* 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  813)
* 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  484)
* Shape (turtle のクラス):               Public classes.     (line   44)
* shape() (turtle モジュール):           見た目.             (line    6)
* shapesize() (turtle モジュール):       見た目.             (line   50)
* shapetransform() (turtle モジュール):  見た目.             (line  135)
* share() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line  675)
* 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 sockets.  (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 モジュール):         Shielding from cancellation.
                                                             (line    6)
* shift_path_info() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   39)
* shift() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  521)
* shift() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  543)
* 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  818)
* 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  280)
* show_code() (dis モジュール):          解析関数.           (line   25)
* show_flag_values() (enum モジュール):  Utilities and decorators.
                                                             (line  103)
* show() (curses.panel.Panel のメソッド): Panel objects.     (line   49)
* show() (tkinter.commondialog.Dialog のメソッド): tkinter commondialog --- Dialog window templates.
                                                             (line   15)
* show() (tkinter.messagebox.Message のメソッド): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   87)
* showerror() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  110)
* showinfo() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   96)
* showsyntaxerror() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   44)
* showtraceback() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   53)
* showturtle() (turtle モジュール):      可視性.             (line   15)
* showwarning() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  104)
* showwarning() (warnings モジュール):   利用可能な関数.     (line   89)
* shuffle() (random モジュール):         シーケンス用の関数. (line   50)
* SHUT_RD (socket モジュール):           定数<8>.            (line  476)
* SHUT_RDWR (socket モジュール):         定数<8>.            (line  476)
* SHUT_WR (socket モジュール):           定数<8>.            (line  476)
* ShutDown:                              queue --- 同期キュークラス.
                                                             (line   91)
* 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  666)
* shutdown() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (line   54)
* SI (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   69)
* side_effect (unittest.mock.Mock の属性): Mock クラス.      (line  362)
* SIG_BLOCK (signal モジュール):         モジュールの内容<3>.
                                                             (line  261)
* SIG_DFL (signal モジュール):           モジュールの内容<3>.
                                                             (line   46)
* SIG_IGN (signal モジュール):           モジュールの内容<3>.
                                                             (line   53)
* SIG_SETMASK (signal モジュール):       モジュールの内容<3>.
                                                             (line  275)
* SIG_UNBLOCK (signal モジュール):       モジュールの内容<3>.
                                                             (line  268)
* SIGABRT (signal モジュール):           モジュールの内容<3>.
                                                             (line   58)
* SIGALRM (signal モジュール):           モジュールの内容<3>.
                                                             (line   62)
* SIGBREAK (signal モジュール):          モジュールの内容<3>.
                                                             (line   68)
* SIGBUS (signal モジュール):            モジュールの内容<3>.
                                                             (line   74)
* SIGCHLD (signal モジュール):           モジュールの内容<3>.
                                                             (line   80)
* SIGCLD (signal モジュール):            モジュールの内容<3>.
                                                             (line   86)
* SIGCONT (signal モジュール):           モジュールの内容<3>.
                                                             (line   92)
* SIGFPE (signal モジュール):            モジュールの内容<3>.
                                                             (line   98)
* SIGHUP (signal モジュール):            モジュールの内容<3>.
                                                             (line  108)
* SIGILL (signal モジュール):            モジュールの内容<3>.
                                                             (line  115)
* SIGINT (C macro):                      シグナルハンドリング<2>.
                                                             (line    7)
* SIGINT (C macro) <1>:                  シグナルハンドリング<2>.
                                                             (line   51)
* SIGINT (signal モジュール):            モジュールの内容<3>.
                                                             (line  119)
* siginterrupt() (signal モジュール):    モジュールの内容<3>.
                                                             (line  514)
* SIGKILL (signal モジュール):           モジュールの内容<3>.
                                                             (line  125)
* Sigmasks (signal のクラス):            モジュールの内容<3>.
                                                             (line   31)
* signal() (signal モジュール):          モジュールの内容<3>.
                                                             (line  529)
* Signals (signal のクラス):             モジュールの内容<3>.
                                                             (line   17)
* Signature (inspect のクラス):          Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   85)
* signature (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  387)
* signature() (inspect モジュール):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   12)
* sigpending() (signal モジュール):      モジュールの内容<3>.
                                                             (line  557)
* SIGPIPE (signal モジュール):           モジュールの内容<3>.
                                                             (line  133)
* SIGPROF (signal モジュール):           モジュールの内容<3>.
                                                             (line  141)
* SIGQUIT (signal モジュール):           モジュールの内容<3>.
                                                             (line  147)
* SIGSEGV (signal モジュール):           モジュールの内容<3>.
                                                             (line  153)
* SIGSTKFLT (signal モジュール):         モジュールの内容<3>.
                                                             (line  163)
* SIGSTOP (signal モジュール):           モジュールの内容<3>.
                                                             (line  157)
* SIGTERM (signal モジュール):           モジュールの内容<3>.
                                                             (line  175)
* sigtimedwait() (signal モジュール):    モジュールの内容<3>.
                                                             (line  617)
* SIGUSR1 (signal モジュール):           モジュールの内容<3>.
                                                             (line  179)
* SIGUSR2 (signal モジュール):           モジュールの内容<3>.
                                                             (line  185)
* SIGVTALRM (signal モジュール):         モジュールの内容<3>.
                                                             (line  191)
* sigwait() (signal モジュール):         モジュールの内容<3>.
                                                             (line  572)
* sigwaitinfo() (signal モジュール):     モジュールの内容<3>.
                                                             (line  588)
* SIGWINCH (signal モジュール):          モジュールの内容<3>.
                                                             (line  197)
* SIGXCPU (signal モジュール):           モジュールの内容<3>.
                                                             (line  203)
* 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   47)
* SimpleDialog (tkinter.simpledialog のクラス): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   74)
* simplefilter() (warnings モジュール):  利用可能な関数.     (line  121)
* SimpleHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   70)
* SimpleHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line  393)
* SimpleNamespace (types のクラス):      追加のユーティリティクラスと関数.
                                                             (line    6)
* SimpleQueue (multiprocessing のクラス): パイプ Pipe とキュー Queue.
                                                             (line  221)
* 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 (tkinter モジュール):           定数<10>.           (line  122)
* single dispatch:                       用語集<2>.          (line 1616)
* SingleAddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  214)
* singledispatch() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  476)
* singledispatchmethod (functools のクラス): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  647)
* 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   70)
* site-packages;ディレクトリ:            site --- サイト固有の設定フック.
                                                             (line   24)
* sitecustomize:                         カスタマイズ用モジュール.
                                                             (line    6)
* sitecustomize <1>:                     カスタマイズ用モジュール.
                                                             (line   20)
* sixtofour (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  313)
* 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  287)
* size() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  350)
* size() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  314)
* size() (tkinter.Grid のメソッド):      Base and mixin classes.
                                                             (line 1924)
* size() (tkinter.Listbox のメソッド):   Widget classes.     (line  921)
* size() (tkinter.Misc のメソッド):      Base and mixin classes.
                                                             (line  240)
* Sized (collections.abc のクラス):      コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   14)
* Sized (typing のクラス):               Aliases to other ABCs in collections abc.
                                                             (line   69)
* sizefrom() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1588)
* Sizegrip (tkinter.ttk のクラス):       Additional widgets. (line  212)
* sizeof_digit (sys.int_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line 1179)
* sizeof() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  263)
* 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   82)
* skipped (doctest.TestResults の属性):  TestResults objects.
                                                             (line   16)
* skipped (unittest.TestResult の属性):  テストのロードと起動.
                                                             (line  255)
* skippedEntity() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  168)
* skips (doctest.DocTestRunner の属性):  DocTestRunner オブジェクト.
                                                             (line  145)
* SkipTest:                              テストのスキップと予期された失敗.
                                                             (line  106)
* skipTest() (unittest.TestCase のメソッド): テストクラス.   (line   99)
* skipUnless() (unittest モジュール):    テストのスキップと予期された失敗.
                                                             (line   95)
* SLASH (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  233)
* SLASHEQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  299)
* slaves() (tkinter.Grid のメソッド):    Base and mixin classes.
                                                             (line 1937)
* slaves() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line  268)
* slaves() (tkinter.Pack のメソッド):    Base and mixin classes.
                                                             (line 1743)
* slaves() (tkinter.Place のメソッド):   Base and mixin classes.
                                                             (line 1818)
* 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 1621)
* Slice (ast のクラス):                  配列要素の参照 Subscripting.
                                                             (line   28)
* slice (組み込みクラス):                組み込み関数.       (line 1773)
* 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  507)
* 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  513)
* 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 contexts.       (line  283)
* sniff() (csv.Sniffer のメソッド):      モジュールコンテンツ.
                                                             (line  254)
* Sniffer (csv のクラス):                モジュールコンテンツ.
                                                             (line  247)
* 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 のクラス):              socket オブジェクト.
                                                             (line    6)
* socket (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line   87)
* socket_type (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (line  108)
* socket() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  364)
* socket() (in module socket):           select --- I/O 完了の待機.
                                                             (line  149)
* SocketHandler (logging.handlers のクラス): SocketHandler.  (line   10)
* socketpair() (socket モジュール):      ソケットの作成.     (line   12)
* sockets (asyncio.Server の属性):       Server objects.     (line  130)
* SocketType (socket のクラス):          socket オブジェクト.
                                                             (line  710)
* soft deprecated:                       用語集<2>.          (line 1628)
* 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)
* SOLID (tkinter モジュール):            定数<10>.           (line   55)
* SOMAXCONN (socket モジュール):         定数<8>.            (line   55)
* sort_stats() (pstats.Stats のメソッド): The Stats Class.   (line   67)
* sort() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  368)
* sort() (list のメソッド):              リスト型 list<2>.   (line   39)
* sortdict() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  292)
* sortTestMethodsUsing (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  193)
* source (doctest.Example の属性):       Example オブジェクト.
                                                             (line   16)
* source (pdb command):                  Debugger commands.  (line  289)
* 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>:                 ライブラリ<166>.    (line  451)
* SOURCE_DATE_EPOCH <3>:                 ビルド<71>.         (line   15)
* SOURCE_DATE_EPOCH <4>:                 ZipFile objects.    (line  346)
* SOURCE_DATE_EPOCH <5>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   66)
* SOURCE_DATE_EPOCH <6>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* SOURCE_DATE_EPOCH <7>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   87)
* SOURCE_DATE_EPOCH <8>:                 コマンドラインでの使用<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  244)
* 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  329)
* SP (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  120)
* span() (re.Match のメソッド):          Match Objects.      (line  171)
* 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  592)
* spawnle() (os モジュール):             プロセス管理.       (line  592)
* spawnlp() (os モジュール):             プロセス管理.       (line  592)
* spawnlpe() (os モジュール):            プロセス管理.       (line  592)
* spawnv() (os モジュール):              プロセス管理.       (line  592)
* spawnve() (os モジュール):             プロセス管理.       (line  592)
* spawnvp() (os モジュール):             プロセス管理.       (line  592)
* spawnvpe() (os モジュール):            プロセス管理.       (line  592)
* 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 1639)
* SpecialFileError:                      ディレクトリとファイルの操作.
                                                             (line   60)
* SpecialFileError <1>:                  tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  299)
* specified_attributes (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  264)
* speed() (turtle モジュール):           Turtle の動き.      (line  332)
* Spinbox (tkinter のクラス):            Widget classes.     (line 1621)
* Spinbox (tkinter.ttk のクラス):        ttk Spinbox.        (line    6)
* SPLICE_F_MORE (os モジュール):         ファイル記述子の操作.
                                                             (line  905)
* SPLICE_F_MOVE (os モジュール):         ファイル記述子の操作.
                                                             (line  905)
* SPLICE_F_NONBLOCK (os モジュール):     ファイル記述子の操作.
                                                             (line  905)
* splice() (os モジュール):              ファイル記述子の操作.
                                                             (line  854)
* split() (BaseExceptionGroup のメソッド): 例外グループ.     (line   71)
* split() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  398)
* split() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  398)
* split() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  502)
* split() (re モジュール):               関数<2>.            (line   78)
* split() (re.Pattern のメソッド):       Regular Expression Objects.
                                                             (line   80)
* split() (shlex モジュール):            shlex --- 単純な字句解析.
                                                             (line   16)
* split() (str のメソッド):              文字列メソッド<2>.  (line  706)
* 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  761)
* SplitResult (urllib.parse のクラス):   構造化された解析結果.
                                                             (line   55)
* SplitResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   82)
* 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  525)
* sqrt() (decimal.Decimal のメソッド):   Decimal オブジェクト.
                                                             (line  553)
* 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 contexts.       (line   13)
* SSLEOFError:                           例外<19>.           (line   69)
* SSLError:                              例外<19>.           (line    6)
* SSLErrorNumber (ssl のクラス):         定数<9>.            (line  556)
* SSLKEYLOGFILE:                         コンテキストの作成. (line   34)
* SSLKEYLOGFILE <1>:                     コンテキストの作成. (line   83)
* SSLObject (ssl のクラス):              Memory BIO support. (line   30)
* sslobject_class (ssl.SSLContext の属性): SSL contexts.     (line  470)
* SSLSession (ssl のクラス):             SSL セッション.     (line    8)
* SSLSocket (ssl のクラス):              SSL sockets.        (line    6)
* sslsocket_class (ssl.SSLContext の属性): SSL contexts.     (line  444)
* SSLSyscallError:                       例外<19>.           (line   61)
* SSLv3 (ssl.TLSVersion の属性):         定数<9>.            (line  578)
* SSLWantReadError:                      例外<19>.           (line   43)
* SSLWantWriteError:                     例外<19>.           (line   52)
* SSLZeroReturnError:                    例外<19>.           (line   34)
* ST_APPEND (os モジュール):             ファイルとディレクトリ.
                                                             (line 1539)
* st_atime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1216)
* ST_ATIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  168)
* st_atime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1233)
* st_birthtime (os.stat_result の属性):  ファイルとディレクトリ.
                                                             (line 1257)
* st_birthtime_ns (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1265)
* st_blksize (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1302)
* st_blocks (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1296)
* st_creator (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1338)
* st_ctime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1224)
* ST_CTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  176)
* st_ctime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1245)
* st_dev (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1191)
* ST_DEV (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  147)
* st_file_attributes (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1348)
* st_flags (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1312)
* st_fstype (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1327)
* st_gen (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1320)
* st_gid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1203)
* ST_GID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  159)
* ST_IMMUTABLE (os モジュール):          ファイルとディレクトリ.
                                                             (line 1547)
* st_ino (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1182)
* ST_INO (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  143)
* ST_MANDLOCK (os モジュール):           ファイルとディレクトリ.
                                                             (line 1523)
* st_mode (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1177)
* ST_MODE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  139)
* st_mtime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1220)
* ST_MTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  172)
* st_mtime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1239)
* st_nlink (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1195)
* ST_NLINK (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  151)
* ST_NOATIME (os モジュール):            ファイルとディレクトリ.
                                                             (line 1555)
* ST_NODEV (os モジュール):              ファイルとディレクトリ.
                                                             (line 1499)
* ST_NODIRATIME (os モジュール):         ファイルとディレクトリ.
                                                             (line 1563)
* ST_NOEXEC (os モジュール):             ファイルとディレクトリ.
                                                             (line 1507)
* ST_NOSUID (os モジュール):             ファイルとディレクトリ.
                                                             (line 1493)
* st_rdev (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1308)
* ST_RDONLY (os モジュール):             ファイルとディレクトリ.
                                                             (line 1487)
* ST_RELATIME (os モジュール):           ファイルとディレクトリ.
                                                             (line 1571)
* st_reparse_tag (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1358)
* st_rsize (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1334)
* st_size (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1207)
* ST_SIZE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  163)
* ST_SYNCHRONOUS (os モジュール):        ファイルとディレクトリ.
                                                             (line 1515)
* st_type (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1342)
* st_uid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1199)
* ST_UID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  155)
* ST_WRITE (os モジュール):              ファイルとディレクトリ.
                                                             (line 1531)
* 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  105)
* stack_size() (threading モジュール):   リファレンス<2>.    (line  156)
* stack() (inspect モジュール):          インタープリタスタック.
                                                             (line  164)
* StackSummary (traceback のクラス):     StackSummary オブジェクト.
                                                             (line   11)
* stamp() (turtle モジュール):           Turtle の動き.      (line  276)
* standard library:                      用語集<2>.          (line 1646)
* standard_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   56)
* standard_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   50)
* standard;output:                       式文 expression statement.
                                                             (line   16)
* standend() (curses.window のメソッド): Window objects.     (line  538)
* standout() (curses.window のメソッド): Window objects.     (line  543)
* 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 1787)
* start (UnicodeError の属性):           具象例外.           (line  446)
* start (スライスオブジェクトの属性):    シーケンス型 sequence.
                                                             (line   18)
* start (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   10)
* start_color() (curses モジュール):     関数<6>.            (line  519)
* start_new_thread() (_thread モジュール): _thread --- 低水準なスレッド API.
                                                             (line   27)
* start_ns() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   74)
* start_server() (asyncio モジュール):   ストリーム.         (line   76)
* start_serving() (asyncio.Server のメソッド): Server objects.
                                                             (line   75)
* start_threads() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   22)
* start_tls() (asyncio.loop のメソッド): TLS upgrade.        (line    6)
* start_tls() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   86)
* start_trace() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  167)
* start_unix_server() (asyncio モジュール): ストリーム.      (line  145)
* start() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   81)
* start() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   60)
* start() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line   91)
* start() (re.Match のメソッド):         Match Objects.      (line  146)
* start() (threading.Thread のメソッド): Thread objects.     (line  109)
* 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  444)
* StartDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  330)
* 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  365)
* 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  708)
* StartNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  424)
* 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  832)
* startTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  339)
* startTestRun() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  347)
* starttls() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  386)
* starttls() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line  179)
* STARTUPINFO (subprocess のクラス):     Windows Popen ヘルパー.
                                                             (line    9)
* stat_result (os のクラス):             ファイルとディレクトリ.
                                                             (line 1169)
* stat() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1112)
* stat() (os.DirEntry のメソッド):       ファイルとディレクトリ.
                                                             (line 1075)
* stat() (pathlib.Path のメソッド):      ファイルの種類とステータスを問い合わせる.
                                                             (line   19)
* stat() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   50)
* state (tkinter.Event の属性):          Other classes.      (line   39)
* state() (tkinter.ttk.Widget のメソッド): ttk Widget.       (line   27)
* state() (tkinter.Wm のメソッド):       Base and mixin classes.
                                                             (line 1597)
* statement:                             用語集<2>.          (line 1658)
* 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>:                     Mapping Types --- 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 2172)
* statement;import <3>:                  site --- サイト固有の設定フック.
                                                             (line   55)
* 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 1665)
* static_order() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  165)
* Statistic (tracemalloc のクラス):      Statistic.          (line    6)
* StatisticDiff (tracemalloc のクラス):  StatisticDiff.      (line    6)
* statistics() (tracemalloc.Snapshot のメソッド): Snapshot.  (line   57)
* StatisticsError:                       例外<5>.            (line    8)
* Stats (pstats のクラス):               The Stats Class.    (line    9)
* 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_result (os のクラス):          ファイルとディレクトリ.
                                                             (line 1426)
* 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  136)
* stderr (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  192)
* stderr (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stderr (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 1952)
* stderr (sys モジュール) <2>:           Multiple interpreters in a Python process.
                                                             (line  109)
* stderr (sys モジュール) <3>:           Multiple interpreters in a Python process.
                                                             (line  196)
* stdev (statistics.NormalDist の属性):  NormalDist オブジェクト.
                                                             (line   35)
* stdev() (statistics モジュール):       関数の詳細.         (line  422)
* stdin (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  118)
* stdin (subprocess.Popen の属性):       Popen オブジェクト. (line  117)
* stdin (sys モジュール):                I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdin (sys モジュール) <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1952)
* stdin (sys モジュール) <2>:            Multiple interpreters in a Python process.
                                                             (line  109)
* stdin (sys モジュール) <3>:            Multiple interpreters in a Python process.
                                                             (line  196)
* stdio:                                 I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdlib:                                用語集<2>.          (line 1671)
* stdlib_module_names (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 2040)
* 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  126)
* stdout (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  188)
* stdout (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdout (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 1952)
* stdout (sys モジュール) <2>:           Multiple interpreters in a Python process.
                                                             (line  109)
* stdout (sys モジュール) <3>:           Multiple interpreters in a Python process.
                                                             (line  196)
* stem (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line  167)
* step (pdb command):                    Debugger commands.  (line  205)
* step (range の属性):                   range.              (line   64)
* step (slice の属性):                   組み込み関数.       (line 1787)
* 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 1787)
* stop (スライスオブジェクトの属性):     シーケンス型 sequence.
                                                             (line   18)
* stop (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   10)
* stop_here() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  271)
* STOP_ITERATION (monitoring event):     Events.             (line   92)
* stop_trace() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  174)
* stop() (asyncio.loop のメソッド):      ループの開始と停止. (line   35)
* stop() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   91)
* stop() (tkinter.ttk.Progressbar のメソッド): ttk Progressbar.
                                                             (line   22)
* stop() (tracemalloc モジュール):       関数<11>.           (line   98)
* stop() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  322)
* StopAsyncIteration:                    具象例外.           (line  293)
* StopIteration:                         具象例外.           (line  261)
* stopListening() (logging.config モジュール): 環境設定のための関数.
                                                             (line  168)
* stopTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  343)
* stopTestRun() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  353)
* 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  118)
* str_digits_check_threshold (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1188)
* str() (locale モジュール):             locale --- 国際化サービス.
                                                             (line  487)
* Strategy (compression.zstd のクラス):  Advanced parameter control.
                                                             (line  295)
* strategy (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  120)
* strcoll() (locale モジュール):         locale --- 国際化サービス.
                                                             (line  441)
* 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   97)
* 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   97)
* StrEnum (enum のクラス):               データ型<2>.        (line  435)
* strerror (C function):                 例外の送出.         (line   58)
* strerror (OSError の属性):             具象例外.           (line  183)
* strerror() (os モジュール):            プロセスのパラメーター.
                                                             (line  552)
* strftime() (datetime.date のメソッド): date objects.       (line  326)
* strftime() (datetime.datetime のメソッド): datetime objects.
                                                             (line  756)
* strftime() (datetime.time のメソッド): time objects.       (line  234)
* strftime() (time モジュール):          関数<5>.            (line  318)
* strict (csv.Dialect の属性):           Dialect クラスと書式化パラメータ.
                                                             (line   89)
* strict (email.policy モジュール):      email policy Policy Objects.
                                                             (line  528)
* STRICT (enum.FlagBoundary の属性):     データ型<2>.        (line  714)
* 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  492)
* STRING (annotationlib.Format の属性):  クラス<5>.          (line   37)
* string (re.Match の属性):              Match Objects.      (line  208)
* STRING (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   50)
* string_at() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  268)
* string;__format__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  149)
* string;__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* string;format() (組み込み関数):        組み込み関数.       (line  776)
* string;formatted literal:              出力を見やすくフォーマットする.
                                                             (line   91)
* string;formatted literal <1>:          Raw string literals.
                                                             (line   25)
* string;formatted literal <2>:          文字列メソッド<2>.  (line  978)
* string;formatting, printf:             printf 形式の文字列書式化.
                                                             (line    6)
* string;immutable sequences:            変更不能なシーケンス immutable sequence.
                                                             (line   14)
* string;interpolated literal:           出力を見やすくフォーマットする.
                                                             (line   91)
* string;interpolated literal <1>:       Raw string literals.
                                                             (line   25)
* string;interpolated literal <2>:       文字列メソッド<2>.  (line  978)
* string;interpolation, printf:          printf 形式の文字列書式化.
                                                             (line    6)
* string;object representation:          ファイナライズとメモリ解放.
                                                             (line   94)
* string;PyObject_Str (C 関数):          オブジェクトプロトコル object protocol.
                                                             (line  350)
* string;str (組み込みクラス):           テキストシーケンス型 --- str.
                                                             (line   44)
* string;str() (built-in function):      組み込み関数.       (line 1880)
* string;テキストシーケンス型:           range.              (line  118)
* string;メソッド:                       テキストシーケンス型 --- str.
                                                             (line   90)
* 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)
* StringVar (tkinter のクラス):          Variable classes.   (line  106)
* strip_dirs() (pstats.Stats のメソッド): The Stats Class.   (line   34)
* strip() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  442)
* strip() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  442)
* strip() (str のメソッド):              文字列メソッド<2>.  (line  850)
* stripspaces (curses.textpad.Textbox の属性): Textbox オブジェクト.
                                                             (line  122)
* strong reference:                      用語集<2>.          (line 1675)
* strptime() (datetime.date のクラスメソッド): date objects. (line   97)
* strptime() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  257)
* strptime() (datetime.time のクラスメソッド): time objects. (line  146)
* strptime() (time モジュール):          関数<5>.            (line  475)
* strsignal() (signal モジュール):       モジュールの内容<3>.
                                                             (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  448)
* STX (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   24)
* Style (tkinter.ttk のクラス):          Ttk styling.        (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  168)
* sub() (re.Pattern のメソッド):         Regular Expression Objects.
                                                             (line   97)
* subdirs (filecmp.dircmp の属性):       dircmp クラス.      (line  102)
* SubElement() (xml.etree.ElementTree モジュール): 関数<9>.  (line  205)
* subgroup() (BaseExceptionGroup のメソッド): 例外グループ.  (line   45)
* 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  242)
* subn() (re.Pattern のメソッド):        Regular Expression Objects.
                                                             (line  102)
* 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  501)
* subpad() (curses.window のメソッド):   Window objects.     (line  547)
* subprocess_exec() (asyncio.loop のメソッド): Running subprocesses.
                                                             (line   16)
* subprocess_shell() (asyncio.loop のメソッド): Running subprocesses.
                                                             (line  117)
* SubprocessError:                       Using the subprocess Module.
                                                             (line  161)
* SubprocessProtocol (asyncio のクラス): 基底プロトコル.     (line   25)
* SubprocessTransport (asyncio のクラス): トランスポートのクラス階層構造.
                                                             (line   52)
* subsample() (tkinter.PhotoImage のメソッド): Image classes.
                                                             (line  202)
* 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  107)
* subtract() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   88)
* subtract() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  529)
* subtype (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  273)
* subwin() (curses.window のメソッド):   Window objects.     (line  557)
* 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  198)
* 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  439)
* SUNKEN (tkinter モジュール):           定数<10>.           (line   55)
* super (pyclbr.Class の属性):           クラスオブジェクト<2>.
                                                             (line   42)
* super (組み込みクラス):                組み込み関数.       (line 1918)
* 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 1579)
* supports_effective_ids (os モジュール): ファイルとディレクトリ.
                                                             (line 1604)
* supports_fd (os モジュール):           ファイルとディレクトリ.
                                                             (line 1623)
* supports_follow_symlinks (os モジュール): ファイルとディレクトリ.
                                                             (line 1642)
* supports_unicode_filenames (os.path モジュール): os path --- 一般的なパス名操作.
                                                             (line  605)
* SupportsAbs (typing のクラス):         プロトコル<4>.      (line    9)
* SupportsBytes (typing のクラス):       プロトコル<4>.      (line   14)
* SupportsComplex (typing のクラス):     プロトコル<4>.      (line   18)
* SupportsFloat (typing のクラス):       プロトコル<4>.      (line   22)
* SupportsIndex (typing のクラス):       プロトコル<4>.      (line   26)
* SupportsInt (typing のクラス):         プロトコル<4>.      (line   32)
* SupportsRound (typing のクラス):       プロトコル<4>.      (line   36)
* suppress() (contextlib モジュール):    ユーティリティ.     (line  270)
* 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 (tkinter モジュール):               定数<10>.           (line   21)
* 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  882)
* Symbol (symtable のクラス):            記号表の検査.       (line  194)
* SymbolTable (symtable のクラス):       記号表の検査.       (line   49)
* SymbolTableType (symtable のクラス):   記号表の検査.       (line    6)
* symlink_to() (pathlib.Path のメソッド): ファイルとディレクトリの作成.
                                                             (line   44)
* symlink() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1665)
* symmetric_difference_update() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  190)
* symmetric_difference() (frozenset のメソッド): set（集合）型 --- set frozenset.
                                                             (line  119)
* symmetric_difference() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  119)
* 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 1715)
* sync() (shelve.Shelf のメソッド):      shelve --- Python オブジェクトの永続化.
                                                             (line   68)
* syncdown() (curses.window のメソッド): Window objects.     (line  568)
* synchronization primitive:             用語集<2>.          (line 1698)
* synchronized() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   96)
* SyncManager (multiprocessing.managers のクラス): マネージャー.
                                                             (line  153)
* syncok() (curses.window のメソッド):   Window objects.     (line  575)
* syncup() (curses.window のメソッド):   Window objects.     (line  580)
* SyntaxErr:                             例外<23>.           (line   89)
* SyntaxError:                           具象例外.           (line  301)
* SyntaxWarning:                         警告.               (line   42)
* sys_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  190)
* 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   83)
* sysconf() (os モジュール):             雑多なシステム情報. (line   73)
* syslog() (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   21)
* SysLogHandler (logging.handlers のクラス): SysLogHandler.  (line   10)
* sysname (os.uname_result の属性):      プロセスのパラメーター.
                                                             (line  606)
* 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  763)
* system() (platform モジュール):        Cross platform.     (line  122)
* SystemError:                           具象例外.           (line  358)
* SystemError (組み込み例外):            モジュールオブジェクト module object.
                                                             (line   64)
* SystemError (組み込み例外) <1>:        モジュールオブジェクト module object.
                                                             (line   99)
* SystemExit:                            具象例外.           (line  375)
* 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 1711)
* t-strings:                             用語集<2>.          (line 1714)
* TAB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   45)
* tab() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line   66)
* TabError:                              具象例外.           (line  353)
* tabs() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   75)
* tabsize (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  178)
* tag (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   16)
* tag_add() (tkinter.Text のメソッド):   Widget classes.     (line 1956)
* tag_bind() (tkinter.Canvas のメソッド): Widget classes.    (line  542)
* tag_bind() (tkinter.Text のメソッド):  Widget classes.     (line 2144)
* tag_bind() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  297)
* tag_cget() (tkinter.Text のメソッド):  Widget classes.     (line 2099)
* tag_config() (tkinter.Text のメソッド): Widget classes.    (line 1976)
* tag_configure() (tkinter.Text のメソッド): Widget classes. (line 1976)
* tag_configure() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  303)
* tag_delete() (tkinter.Text のメソッド): Widget classes.    (line 1971)
* tag_has() (tkinter.ttk.Treeview のメソッド): ttk Treeview. (line  313)
* tag_lower() (tkinter.Canvas のメソッド): Widget classes.   (line  526)
* tag_lower() (tkinter.Text のメソッド): Widget classes.     (line 2138)
* tag_names() (tkinter.Text のメソッド): Widget classes.     (line 2104)
* tag_nextrange() (tkinter.Text のメソッド): Widget classes. (line 2117)
* tag_prevrange() (tkinter.Text のメソッド): Widget classes. (line 2124)
* tag_raise() (tkinter.Canvas のメソッド): Widget classes.   (line  515)
* tag_raise() (tkinter.Text のメソッド): Widget classes.     (line 2131)
* tag_ranges() (tkinter.Text のメソッド): Widget classes.    (line 2111)
* tag_remove() (tkinter.Text のメソッド): Widget classes.    (line 1964)
* tag_unbind() (tkinter.Canvas のメソッド): Widget classes.  (line  557)
* tag_unbind() (tkinter.Text のメソッド): Widget classes.    (line 2153)
* 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  104)
* 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 object.        (line    6)
* task_done() (asyncio.Queue のメソッド): Queue.             (line  117)
* task_done() (multiprocessing.JoinableQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  264)
* 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  307)
* 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  929)
* tcgetwinsize() (termios モジュール):   termios --- POSIX スタイルの端末制御.
                                                             (line   83)
* Tcl() (tkinter モジュール):            Module-level functions.
                                                             (line    6)
* TclError:                              リファレンス<8>.    (line   11)
* 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  936)
* tcsetwinsize() (termios モジュール):   termios --- POSIX スタイルの端末制御.
                                                             (line   91)
* tearDown() (unittest.TestCase のメソッド): テストクラス.   (line   40)
* tearDownClass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line   67)
* 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  319)
* tell() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   61)
* tell() (wave.Wave_read のメソッド):    Wave_read オブジェクト.
                                                             (line   87)
* tell() (wave.Wave_write のメソッド):   Wave_write オブジェクト.
                                                             (line  100)
* 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   73)
* temporary (bdb.Breakpoint の属性):     bdb --- デバッガーフレームワーク.
                                                             (line   91)
* TemporaryDirectory (tempfile のクラス): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  184)
* TemporaryFile() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line   27)
* teredo (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  320)
* TERM:                                  関数<6>.            (line  511)
* TERM <1>:                              関数<6>.            (line  540)
* termattrs() (curses モジュール):       関数<6>.            (line  532)
* terminal_size (os のクラス):           ターミナルのサイズの問い合わせ.
                                                             (line   24)
* terminate_workers() (concurrent.futures.ProcessPoolExecutor のメソッド): ProcessPoolExecutor.
                                                             (line   96)
* terminate() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line   98)
* terminate() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   49)
* terminate() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  182)
* terminate() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  224)
* terminate() (subprocess.Popen のメソッド): Popen オブジェクト.
                                                             (line   95)
* terminator (logging.StreamHandler の属性): StreamHandler.  (line   48)
* termname() (curses モジュール):        関数<6>.            (line  538)
* ternaryfunc (C type):                  Slot Type typedefs. (line  131)
* test (doctest.DocTestFailure の属性):  デバッグ.           (line  188)
* test (doctest.UnexpectedException の属性): デバッグ.       (line  209)
* 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  185)
* testmod() (doctest モジュール):        基本 API.           (line   94)
* testNamePatterns (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  206)
* TestResult (unittest のクラス):        テストのロードと起動.
                                                             (line  224)
* TestResults (doctest のクラス):        TestResults objects.
                                                             (line    6)
* testsource() (doctest モジュール):     デバッグ.           (line  104)
* testsRun (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  285)
* TestSuite (unittest のクラス):         テストのグループ化. (line    6)
* testzip() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  271)
* text (ctypes.COMError の属性):         例外<10>.           (line   19)
* text (SyntaxError の属性):             具象例外.           (line  325)
* Text (tkinter のクラス):               Widget classes.     (line 1796)
* 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 1719)
* text file:                             用語集<2>.          (line 1732)
* text mode:                             組み込み関数.       (line 1461)
* text_encoding() (io モジュール):       高水準のモジュールインターフェイス.
                                                             (line   38)
* text_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  826)
* 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  436)
* TextTestRunner (unittest のクラス):    テストのロードと起動.
                                                             (line  454)
* TextWrapper (textwrap のクラス):       textwrap --- テキストの折り返しと詰め込み.
                                                             (line  145)
* TFD_CLOEXEC (os モジュール):           Timer File Descriptors.
                                                             (line  202)
* TFD_NONBLOCK (os モジュール):          Timer File Descriptors.
                                                             (line  191)
* TFD_TIMER_ABSTIME (os モジュール):     Timer File Descriptors.
                                                             (line  212)
* TFD_TIMER_CANCEL_ON_SET (os モジュール): Timer File Descriptors.
                                                             (line  223)
* theme_create() (tkinter.ttk.Style のメソッド): Ttk styling.
                                                             (line  267)
* theme_names() (tkinter.ttk.Style のメソッド): Ttk styling. (line  315)
* theme_settings() (tkinter.ttk.Style のメソッド): Ttk styling.
                                                             (line  277)
* theme_use() (tkinter.ttk.Style のメソッド): Ttk styling.   (line  319)
* THOUSEP (locale モジュール):           locale --- 国際化サービス.
                                                             (line  274)
* Thread (threading のクラス):           Thread objects.     (line   59)
* thread state:                          用語集<2>.          (line 1746)
* thread_info (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2059)
* thread_inherit_context (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  584)
* 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 1769)
* 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  942)
* ThreadingTCPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ThreadingUDPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ThreadingUnixDatagramServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ThreadingUnixStreamServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   72)
* ThreadPool (multiprocessing.pool のクラス): The multiprocessing dummy module.
                                                             (line   14)
* ThreadPoolExecutor (concurrent.futures のクラス): ThreadPoolExecutor.
                                                             (line   41)
* threads;POSIX:                         _thread --- 低水準なスレッド API.
                                                             (line   15)
* threadsafety (sqlite3 モジュール):     モジュール定数.     (line   88)
* throw() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   35)
* throw() (generator のメソッド):        ジェネレータ-イテレータメソッド.
                                                             (line   37)
* THURSDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  439)
* ticket_lifetime_hint (ssl.SSLSession の属性): SSL セッション.
                                                             (line   18)
* tigetflag() (curses モジュール):       関数<6>.            (line  543)
* tigetnum() (curses モジュール):        関数<6>.            (line  552)
* tigetstr() (curses モジュール):        関数<6>.            (line  561)
* 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 (tkinter.Event の属性):           Other classes.      (line   44)
* time (uuid.UUID の属性):               uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  128)
* time_hi_version (uuid.UUID の属性):    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  112)
* time_low (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  104)
* time_mid (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  108)
* 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:   Command-Line Interface.
                                                             (line   43)
* timeit コマンドラインオプション; -help: Command-Line Interface.
                                                             (line   43)
* timeit コマンドラインオプション; -n:   Command-Line Interface.
                                                             (line   12)
* timeit コマンドラインオプション; -number: Command-Line Interface.
                                                             (line   12)
* timeit コマンドラインオプション; -p:   Command-Line Interface.
                                                             (line   24)
* timeit コマンドラインオプション; -process: Command-Line Interface.
                                                             (line   24)
* timeit コマンドラインオプション; -r:   Command-Line Interface.
                                                             (line   16)
* timeit コマンドラインオプション; -repeat: Command-Line Interface.
                                                             (line   16)
* timeit コマンドラインオプション; -s:   Command-Line Interface.
                                                             (line   20)
* timeit コマンドラインオプション; -setup: Command-Line Interface.
                                                             (line   20)
* timeit コマンドラインオプション; -u:   Command-Line Interface.
                                                             (line   32)
* timeit コマンドラインオプション; -unit: Command-Line Interface.
                                                             (line   32)
* timeit コマンドラインオプション; -v:   Command-Line Interface.
                                                             (line   39)
* timeit コマンドラインオプション; -verbose: Command-Line Interface.
                                                             (line   39)
* timeit() (timeit モジュール):          Python Interface.   (line    8)
* timeit() (timeit.Timer のメソッド):    Python Interface.   (line   68)
* timeout:                               例外<18>.           (line   39)
* Timeout (asyncio のクラス):            タイムアウト.       (line   50)
* timeout (socketserver.BaseServer の属性): Serverオブジェクト.
                                                             (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  127)
* TIMEOUT_MAX (threading モジュール):    リファレンス<2>.    (line  180)
* timeout() (asyncio モジュール):        タイムアウト.       (line    6)
* timeout() (curses.window のメソッド):  Window objects.     (line  585)
* TimeoutError:                          OS 例外.            (line  111)
* TimeoutError <1>:                      Process クラスと例外.
                                                             (line  295)
* 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 Interface.   (line   40)
* timerfd_create() (os モジュール):      Timer File Descriptors.
                                                             (line   11)
* timerfd_gettime_ns() (os モジュール):  Timer File Descriptors.
                                                             (line  182)
* timerfd_gettime() (os モジュール):     Timer File Descriptors.
                                                             (line  162)
* timerfd_settime_ns() (os モジュール):  Timer File Descriptors.
                                                             (line  151)
* timerfd_settime() (os モジュール):     Timer File Descriptors.
                                                             (line   83)
* TimerHandle (asyncio のクラス):        Callback handles.   (line   29)
* times() (os モジュール):               プロセス管理.       (line  799)
* 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  898)
* title() (tkinter.Wm のメソッド):       Base and mixin classes.
                                                             (line 1610)
* title() (turtle モジュール):           Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   68)
* Tk:                                    Graphical user interfaces with Tk.
                                                             (line    6)
* Tk (tkinter のクラス):                 Toplevel widgets.   (line    6)
* tk (tkinter.Tk の属性):                Toplevel widgets.   (line   65)
* Tk オプションデータ型:                 Tk option data types.
                                                             (line    6)
* tk_bisque() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  781)
* tk_busy_cget() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  840)
* tk_busy_config() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  816)
* tk_busy_configure() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  816)
* tk_busy_current() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  872)
* tk_busy_forget() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  851)
* tk_busy_hold() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  797)
* tk_busy_status() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  863)
* tk_busy() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line  797)
* tk_focusFollowsMouse() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  554)
* tk_focusNext() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  560)
* tk_focusPrev() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  570)
* tk_popup() (tkinter.Menu のメソッド):  Widget classes.     (line 1295)
* tk_setPalette() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  763)
* tk_strictMotif() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  787)
* Tkinter:                               Graphical user interfaces with Tk.
                                                             (line    6)
* tkraise() (tkinter.Canvas のメソッド): Widget classes.     (line  515)
* tkraise() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line  113)
* 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:                                ライブラリ<27>.     (line   79)
* TMPDIR <1>:                            テスト<31>.         (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  533)
* to_eng_string() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  557)
* to_integral_exact() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  541)
* to_integral_exact() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  574)
* to_integral_value() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  583)
* to_integral() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  568)
* to_sci_string() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  545)
* to_thread() (asyncio モジュール):      Running in threads. (line    6)
* ToASCII() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   52)
* tobuf() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line   50)
* tobytes() (array.array のメソッド):    array --- 効率的な数値配列.
                                                             (line  247)
* tobytes() (memoryview のメソッド):     メモリビュー.       (line  170)
* today() (datetime.date のクラスメソッド): date objects.    (line   28)
* today() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   47)
* tofile() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  256)
* toggle() (tkinter.Checkbutton のメソッド): Widget classes. (line  719)
* tok_name (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line   23)
* Token (contextvars のクラス):          コンテキスト変数.   (line  104)
* token (shlex.shlex の属性):            shlex オブジェクト. (line  172)
* token_bytes() (secrets モジュール):    トークンの生成.     (line   10)
* token_hex() (secrets モジュール):      トークンの生成.     (line   20)
* token_urlsafe() (secrets モジュール):  トークンの生成.     (line   31)
* TokenError:                            Tokenizing Input.   (line  104)
* tokenize コマンドラインオプション; -e: Command-Line Usage. (line   19)
* tokenize コマンドラインオプション; -exact: Command-Line Usage.
                                                             (line   19)
* tokenize コマンドラインオプション; -h: Command-Line Usage. (line   15)
* tokenize コマンドラインオプション; -help: Command-Line Usage.
                                                             (line   15)
* tokenize() (tokenize モジュール):      Tokenizing Input.   (line    8)
* tolist() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  261)
* tolist() (memoryview のメソッド):      メモリビュー.       (line  214)
* TOMLDecodeError:                       tomllib --- TOML ファイルの解析.
                                                             (line   66)
* toordinal() (datetime.date のメソッド): date objects.      (line  253)
* toordinal() (datetime.datetime のメソッド): datetime objects.
                                                             (line  601)
* TOP (tkinter モジュール):              定数<10>.           (line   39)
* top_panel() (curses.panel モジュール): 関数<7>.            (line   20)
* top() (curses.panel.Panel のメソッド): Panel objects.      (line   54)
* top() (poplib.POP3 のメソッド):        POP3 オブジェクト.  (line   87)
* Toplevel (tkinter のクラス):           Toplevel widgets.   (line  119)
* TopologicalSorter (graphlib のクラス): graphlib --- グラフ構造を操作する機能.
                                                             (line   10)
* toprettyxml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   71)
* toreadonly() (memoryview のメソッド):  メモリビュー.       (line  231)
* tostring() (xml.etree.ElementTree モジュール): 関数<9>.    (line  217)
* tostringlist() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  239)
* total_changes (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  840)
* total_nframe (tracemalloc.Traceback の属性): Traceback.    (line   28)
* total_ordering() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  272)
* total_seconds() (datetime.timedelta のメソッド): timedelta objects.
                                                             (line  248)
* total() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  106)
* touch() (pathlib.Path のメソッド):     ファイルとディレクトリの作成.
                                                             (line    6)
* touchline() (curses.window のメソッド): Window objects.    (line  594)
* touchwin() (curses.window のメソッド): Window objects.     (line  600)
* tounicode() (array.array のメソッド):  array --- 効率的な数値配列.
                                                             (line  265)
* ToUnicode() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   57)
* towards() (turtle モジュール):         Turtle の状態を知る.
                                                             (line   15)
* toxml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   52)
* tparm() (curses モジュール):           関数<6>.            (line  571)
* 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  961)
* trace function <3>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1713)
* 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_add() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   44)
* trace_dispatch() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  187)
* trace_info() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   69)
* trace_remove() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   61)
* trace_variable() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   77)
* trace_vdelete() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   88)
* trace_vinfo() (tkinter.Variable のメソッド): Variable classes.
                                                             (line   97)
* trace() (inspect モジュール):          インタープリタスタック.
                                                             (line  177)
* trace() (tkinter.Variable のメソッド): Variable classes.   (line   77)
* 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 2095)
* 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)
* transient() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1618)
* translate() (bytearray のメソッド):    bytes と bytearray の操作.
                                                             (line  265)
* translate() (bytes のメソッド):        bytes と bytearray の操作.
                                                             (line  265)
* translate() (fnmatch モジュール):      fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   92)
* translate() (glob モジュール):         glob --- Unix 形式のパス名のパターン展開.
                                                             (line  127)
* translate() (str のメソッド):          文字列メソッド<2>.  (line  932)
* translation() (gettext モジュール):    クラス形式の API.   (line   42)
* transparency_get() (tkinter.PhotoImage のメソッド): Image classes.
                                                             (line  214)
* transparency_set() (tkinter.PhotoImage のメソッド): Image classes.
                                                             (line  221)
* 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 1792)
* True:                                  numbers Integral 整数.
                                                             (line   24)
* true:                                  真理値判定.         (line    9)
* True <1>:                              真理値判定.         (line   25)
* True <2>:                              ブーリアン型 - bool.
                                                             (line    9)
* TRUE (tkinter モジュール):             定数<10>.           (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 1723)
* 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  943)
* TUESDAY (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  439)
* Tuple (ast のクラス):                  リテラル<3>.        (line  136)
* 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 1801)
* type (ctypes.CField の属性):           構造化データ型.     (line  255)
* type (optparse.Option の属性):         オプション属性.     (line   27)
* type (socket.socket の属性):           socket オブジェクト.
                                                             (line  702)
* type (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   87)
* type (tkinter.Event の属性):           Other classes.      (line   75)
* Type (typing のクラス):                Aliases to built-in types.
                                                             (line   61)
* type (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   21)
* type (組み込みクラス):                 組み込み関数.       (line 2008)
* type alias:                            用語集<2>.          (line 1808)
* type hint:                             用語集<2>.          (line 1829)
* 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 モジュール):     定数<11>.           (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)
* type() (tkinter.Canvas のメソッド):    Widget classes.     (line  402)
* type() (tkinter.Image のメソッド):     Image classes.      (line   35)
* type() (tkinter.Menu のメソッド):      Widget classes.     (line 1267)
* typeahead() (curses モジュール):       関数<6>.            (line  582)
* TypeAlias (ast のクラス):              文 Statements.      (line  161)
* TypeAlias (typing モジュール):         特殊型.             (line  198)
* TypeAliasType (typing のクラス):       Building generic types and type aliases.
                                                             (line  552)
* typecode (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  124)
* typecodes (array モジュール):          array --- 効率的な数値配列.
                                                             (line   91)
* TYPED_ACTIONS (optparse.Option の属性): 新しいアクションの追加.
                                                             (line   39)
* typed_subpart_iterator() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   26)
* TypedDict (typing のクラス):           Other special directives.
                                                             (line  243)
* TypeError:                             具象例外.           (line  401)
* 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  337)
* 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  127)
* 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 objects.     (line  180)
* 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  275)
* ulp() (math モジュール):               Floating point manipulation functions.
                                                             (line  107)
* umask() (os モジュール):               プロセスのパラメーター.
                                                             (line  565)
* unalias (pdb command):                 Debugger commands.  (line  402)
* uname (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line  123)
* uname_result (os のクラス):            プロセスのパラメーター.
                                                             (line  595)
* 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)
* unbind_all() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  347)
* unbind_class() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  342)
* unbind() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line  328)
* unbinding;name:                        del 文<2>.          (line   15)
* UnboundLocalError:                     名前解決.           (line   17)
* UnboundLocalError <1>:                 具象例外.           (line  418)
* unbuffered I/O:                        組み込み関数.       (line 1461)
* UNC パス;os.makedirs():                ファイルとディレクトリ.
                                                             (line  559)
* uncancel() (asyncio.Task のメソッド):  Task object.        (line  277)
* UNCHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  116)
* unconsumed_tail (zlib.Decompress の属性): zlib --- gzip 互換の圧縮.
                                                             (line  241)
* unctrl() (curses モジュール):          関数<6>.            (line  594)
* unctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  229)
* Underflow (decimal のクラス):          シグナル.           (line   98)
* UNDERLINE (tkinter モジュール):        定数<10>.           (line  165)
* undisplay (pdb command):               Debugger commands.  (line  349)
* undo() (turtle モジュール):            Turtle の動き.      (line  321)
* undobufferentries() (turtle モジュール): 特別な Turtle のメソッド.
                                                             (line   86)
* undoc_header (cmd.Cmd の属性):         Cmdオブジェクト.    (line  163)
* unescape() (html モジュール):          html --- HyperText Markup Language のサポート.
                                                             (line   24)
* unescape() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   27)
* UnexpectedException:                   デバッグ.           (line  201)
* unexpectedSuccesses (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  268)
* unfreeze() (gc モジュール):            gc --- ガベージコレクターインターフェース.
                                                             (line  237)
* unget_wch() (curses モジュール):       関数<6>.            (line  616)
* ungetch() (curses モジュール):         関数<6>.            (line  601)
* ungetch() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   44)
* ungetmouse() (curses モジュール):      関数<6>.            (line  626)
* ungetwch() (msvcrt モジュール):        コンソール I/O 関連.
                                                             (line   50)
* unhexlify() (binascii モジュール):     binascii --- バイナリ と ASCII 間の変換.
                                                             (line  146)
* 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__ モジュール): モジュールコンテンツ<3>.
                                                             (line   39)
* UnicodeDecodeError:                    具象例外.           (line  467)
* UnicodeEncodeError:                    具象例外.           (line  462)
* UnicodeError:                          具象例外.           (line  424)
* UnicodeTranslateError:                 具象例外.           (line  472)
* 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  158)
* Union (ctypes のクラス):               構造化データ型.     (line    6)
* Union (typing のクラス):               特殊形式.           (line    9)
* union;type:                            Union 型.           (line    6)
* union() (frozenset のメソッド):        set（集合）型 --- set frozenset.
                                                             (line   97)
* union() (set のメソッド):              set（集合）型 --- set frozenset.
                                                             (line   97)
* UnionType (types のクラス):            標準的なインタプリタ型.
                                                             (line  179)
* UNIQUE (enum.EnumCheck の属性):        データ型<2>.        (line  656)
* unique() (enum モジュール):            Utilities and decorators.
                                                             (line   55)
* UNITS (tkinter モジュール):            定数<10>.           (line  159)
* 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 1844)
* universal newlines;bytearray.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  642)
* universal newlines;bytes.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  642)
* universal newlines;csv.reader 関数:    モジュールコンテンツ.
                                                             (line    8)
* universal newlines;importlib.abc.InspectLoader.get_source メソッド: importlib abc -- Abstract base classes related to import.
                                                             (line  219)
* 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 1401)
* universal newlines;str.splitlines メソッド: 文字列メソッド<2>.
                                                             (line  761)
* universal newlines;subprocess モジュール: よく使われる引数.
                                                             (line   32)
* universal newlines;What's new:         PEP 3116 新しい I/O ライブラリ.
                                                             (line   45)
* universal newlines;What's new <1>:     新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  134)
* 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 のクラス):           モジュールコンテンツ.
                                                             (line  238)
* 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   45)
* unknown_decl() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  133)
* unknown_open() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   56)
* unknown_open() (urllib.request.UnknownHandler のメソッド): UnknownHandler オブジェクト.
                                                             (line    6)
* UnknownHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  492)
* UnknownProtocol:                       http client --- HTTP プロトコルクライアント.
                                                             (line  150)
* UnknownTransferEncoding:               http client --- HTTP プロトコルクライアント.
                                                             (line  154)
* unlink() (multiprocessing.shared_memory.SharedMemory のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  102)
* unlink() (os モジュール):              ファイルとディレクトリ.
                                                             (line 1742)
* 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  951)
* UNNAMED_SECTION (configparser モジュール): ConfigParser オブジェクト.
                                                             (line  333)
* UnnamedSectionDisabledError:           例外<9>.            (line   76)
* Unpack (typing モジュール):            特殊形式.           (line  593)
* unpack_archive() (shutil モジュール):  アーカイブ化操作.   (line  133)
* 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   69)
* unparse() (ast モジュール):            ast helpers.        (line   68)
* unparsedEntityDecl() (xml.sax.handler.DTDHandler のメソッド): DTDHandler オブジェクト.
                                                             (line   12)
* UnparsedEntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  392)
* Unpickler (pickle のクラス):           モジュールインターフェース.
                                                             (line  245)
* UnpicklingError:                       モジュールインターフェース.
                                                             (line  111)
* unpost() (tkinter.Menu のメソッド):    Widget classes.     (line 1301)
* 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 2102)
* unregister_archive_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  128)
* unregister_dialect() (csv モジュール): モジュールコンテンツ.
                                                             (line   89)
* unregister_unpack_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  200)
* unregister() (atexit モジュール):      atexit --- 終了ハンドラー.
                                                             (line   56)
* unregister() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  172)
* unregister() (faulthandler モジュール): ユーザシグナルに対してtracebackをダンプする.
                                                             (line   23)
* unregister() (select.devpoll のメソッド): /dev/poll polling objects.
                                                             (line   55)
* unregister() (select.epoll のメソッド): Edge and level trigger polling epoll objects.
                                                             (line   95)
* unregister() (select.poll のメソッド): Polling objects.    (line   66)
* unregister() (selectors.BaseSelector のメソッド): クラス<4>.
                                                             (line   82)
* unsafe (uuid.SafeUUID の属性):         uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   40)
* 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  629)
* unshare() (os モジュール):             プロセスのパラメーター.
                                                             (line  648)
* UnstructuredHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  115)
* unsubscribe() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  463)
* UnsupportedOperation:                  例外<6>.            (line    6)
* UnsupportedOperation <1>:              高水準のモジュールインターフェイス.
                                                             (line   72)
* until (pdb command):                   Debugger commands.  (line  217)
* untokenize() (tokenize モジュール):    Tokenizing Input.   (line   54)
* untouchwin() (curses.window のメソッド): Window objects.   (line  605)
* unused_data (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   78)
* unused_data (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  210)
* 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 sockets.        (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_idletasks() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  477)
* update_lines_cols() (curses モジュール): 関数<6>.          (line  609)
* update_panels() (curses.panel モジュール): 関数<7>.        (line   24)
* update_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   77)
* update_wrapper() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  697)
* update() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  124)
* update() (dict のメソッド):            Mapping Types --- dict.
                                                             (line  234)
* 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  171)
* update() (tkinter.Misc のメソッド):    Base and mixin classes.
                                                             (line  470)
* 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  951)
* 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  262)
* urlretrieve() (urllib.request モジュール): レガシーインターフェース<2>.
                                                             (line   10)
* urlsafe_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   69)
* urlsafe_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   62)
* urlsplit() (urllib.parse モジュール):  URL の解析.         (line    9)
* urlunparse() (urllib.parse モジュール): URL の解析.        (line  279)
* urlunsplit() (urllib.parse モジュール): URL の解析.        (line  254)
* urn (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  147)
* US (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  117)
* use_default_colors() (curses モジュール): 関数<6>.         (line  641)
* use_env() (curses モジュール):         関数<6>.            (line  631)
* use_rawinput (cmd.Cmd の属性):         Cmdオブジェクト.    (line  175)
* 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 モジュール):           モジュールの内容<6>.
                                                             (line   32)
* user_call() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  292)
* user_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  311)
* user_line() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  300)
* user_return() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  306)
* USER_SITE (site モジュール):           モジュールの内容<6>.
                                                             (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  258)
* USERNAME <2>:                          getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* username (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  427)
* USERPROFILE:                           os path<5>.         (line   14)
* USERPROFILE <1>:                       Python API の変更<6>.
                                                             (line  117)
* USERPROFILE <2>:                       Windows<50>.        (line   15)
* USERPROFILE <3>:                       os path --- 一般的なパス名操作.
                                                             (line  155)
* userptr() (curses.panel.Panel のメソッド): Panel objects.  (line   58)
* 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   37)
* utctimetuple() (datetime.datetime のメソッド): datetime objects.
                                                             (line  579)
* utf8 (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  377)
* utf8_enabled (imaplib.IMAP4 の属性):   IMAP4 オブジェクト. (line  494)
* utf8_mode (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  568)
* utf8() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line  106)
* utime() (os モジュール):               ファイルとディレクトリ.
                                                             (line 1756)
* UUID (uuid のクラス):                  uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   50)
* 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  190)
* uuid3() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  203)
* uuid4() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  210)
* uuid5() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  215)
* uuid6() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  222)
* uuid7() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  240)
* uuid8() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  250)
* v4_int_to_packed() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line    8)
* v6_int_to_packed() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   20)
* valid_signals() (signal モジュール):   モジュールの内容<3>.
                                                             (line  330)
* validate() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   53)
* validate() (tkinter.ttk.Entry のメソッド): Additional widgets.
                                                             (line   57)
* 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  217)
* 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  477)
* valuerefs() (weakref.WeakValueDictionary のメソッド): weakref --- Weak references.
                                                             (line  220)
* Values (optparse のクラス):            オプションの定義.   (line   87)
* values (string.templatelib.Template の属性): 型.           (line   90)
* values() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  137)
* values() (dict のメソッド):            Mapping Types --- 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  346)
* values() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  127)
* values() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  283)
* ValuesView (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* ValuesView (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line  120)
* var (contextvars.Token の属性):        コンテキスト変数.   (line  122)
* Variable (tkinter のクラス):           Variable classes.   (line    6)
* variable annotation:                   用語集<2>.          (line 1851)
* variance (statistics.NormalDist の属性): NormalDist オブジェクト.
                                                             (line   40)
* variance() (statistics モジュール):    関数の詳細.         (line  430)
* variant (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  151)
* vbar (tkinter.scrolledtext.ScrolledText の属性): tkinter scrolledtext --- Scrolled text widget.
                                                             (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  552)
* 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 sockets.
                                                             (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 contexts.       (line  629)
* verify_generated_headers (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  202)
* verify_message (ssl.SSLCertVerificationError の属性): 例外<19>.
                                                             (line   88)
* verify_mode (ssl.SSLContext の属性):   SSL contexts.       (line  644)
* verify_request() (socketserver.BaseServer のメソッド): Serverオブジェクト.
                                                             (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 モジュール):            Utilities and decorators.
                                                             (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  238)
* 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  170)
* version (in module sys) <1>:           プロセスワイドのパラメータ.
                                                             (line  207)
* version (in module sys) <2>:           プロセスワイドのパラメータ.
                                                             (line  218)
* 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 (os.uname_result の属性):      プロセスのパラメーター.
                                                             (line  621)
* version (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 2150)
* version (sys.thread_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 2088)
* version (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  157)
* version_info (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 2166)
* version_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  366)
* version() (ensurepip モジュール):      モジュール API.     (line    8)
* version() (importlib.metadata モジュール): 配布物バージョン.
                                                             (line    6)
* version() (platform モジュール):       Cross platform.     (line  137)
* version() (ssl.SSLSocket のメソッド):  SSL sockets.        (line  323)
* VERTICAL (tkinter モジュール):         定数<10>.           (line   65)
* vformat() (string.Formatter のメソッド): Custom string formatting.
                                                             (line   26)
* virtual environment:                   用語集<2>.          (line 1875)
* virtual machine:                       用語集<2>.          (line 1884)
* visit_Constant() (ast.NodeVisitor のメソッド): ast helpers.
                                                             (line  211)
* visit() (ast.NodeVisitor のメソッド):  ast helpers.        (line  194)
* visitproc (C type):                    循環参照ガベージコレクションをサポートする.
                                                             (line  223)
* vline() (curses.window のメソッド):    Window objects.     (line  610)
* 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 (tkinter モジュール):                定数<10>.           (line   21)
* W_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* wait_closed() (asyncio.Server のメソッド): Server objects. (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  133)
* 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  972)
* wait_until_called() (unittest.mock.ThreadingMock のメソッド): Mock クラス.
                                                             (line  957)
* wait_variable() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  484)
* wait_visibility() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  501)
* wait_window() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  494)
* wait() (asyncio モジュール):           Waiting primitives. (line    6)
* wait() (asyncio.Barrier のメソッド):   Barrier.            (line   52)
* 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  827)
* wait() (subprocess.Popen のメソッド):  Popen オブジェクト. (line   14)
* wait() (threading.Barrier のメソッド): Barrier objects.    (line   42)
* wait() (threading.Condition のメソッド): Condition objects.
                                                             (line  102)
* wait() (threading.Event のメソッド):   Event objects.      (line   45)
* wait3() (os モジュール):               プロセス管理.       (line  935)
* wait4() (os モジュール):               プロセス管理.       (line  948)
* waitid() (os モジュール):              プロセス管理.       (line  851)
* waitpid() (os モジュール):             プロセス管理.       (line  890)
* waitstatus_to_exitcode() (os モジュール): プロセス管理.    (line 1064)
* waitvar() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line  484)
* walk_packages() (pkgutil モジュール):  pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  107)
* walk_stack() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line  181)
* walk_tb() (traceback モジュール):      モジュールレベルの関数<2>.
                                                             (line  195)
* 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  643)
* walk() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1800)
* walk() (pathlib.Path のメソッド):      ディレクトリを読む. (line  117)
* walrus operator:                       ブール演算 boolean operation.
                                                             (line   34)
* walrus operator <1>:                   用語集<2>.          (line 1890)
* want (doctest.Example の属性):         Example オブジェクト.
                                                             (line   22)
* warn_default_encoding (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  578)
* 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  203)
* 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  111)
* warnoptions (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2179)
* wasSuccessful() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  313)
* WatchedFileHandler (logging.handlers のクラス): WatchedFileHandler.
                                                             (line   25)
* Wave_read (wave のクラス):             Wave_read オブジェクト.
                                                             (line    6)
* Wave_write (wave のクラス):            Wave_write オブジェクト.
                                                             (line    6)
* WCONTINUED (os モジュール):            プロセス管理.       (line  987)
* WCOREDUMP() (os モジュール):           プロセス管理.       (line 1105)
* WeakKeyDictionary (weakref のクラス):  weakref --- Weak references.
                                                             (line  161)
* WeakMethod (weakref のクラス):         weakref --- Weak references.
                                                             (line  229)
* WeakSet (weakref のクラス):            weakref --- Weak references.
                                                             (line  224)
* WeakValueDictionary (weakref のクラス): weakref --- Weak references.
                                                             (line  208)
* 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  439)
* weekday (calendar.IllegalWeekdayError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  529)
* weekday() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  369)
* weekday() (datetime.date のメソッド):  date objects.       (line  259)
* weekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  642)
* weekheader() (calendar モジュール):    calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  374)
* weibullvariate() (random モジュール):  実数分布.           (line   96)
* WEXITED (os モジュール):               プロセス管理.       (line  996)
* WEXITSTATUS() (os モジュール):         プロセス管理.       (line 1152)
* wfile (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  171)
* wfile (socketserver.DatagramRequestHandler の属性): Request Handler Objects.
                                                             (line   67)
* whatis (pdb command):                  Debugger commands.  (line  285)
* when() (asyncio.Timeout のメソッド):   タイムアウト.       (line   67)
* when() (asyncio.TimerHandle のメソッド): Callback handles. (line   36)
* whence (concurrent.interpreters.Interpreter の属性): Interpreter objects.
                                                             (line   19)
* where (pdb command):                   Debugger commands.  (line   82)
* which() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  445)
* 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 のクラス):             Base and mixin classes.
                                                             (line 2016)
* widget (tkinter.Event の属性):         Other classes.      (line   79)
* Widget (tkinter.ttk のクラス):         ttk Widget.         (line   10)
* width (sys.hash_info の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line 1051)
* width (textwrap.TextWrapper の属性):   textwrap --- テキストの折り返しと詰め込み.
                                                             (line  165)
* width (tkinter.Event の属性):          Other classes.      (line   29)
* width() (tkinter.Image のメソッド):    Image classes.      (line   31)
* width() (turtle モジュール):           描画状態.           (line   18)
* WIFCONTINUED() (os モジュール):        プロセス管理.       (line 1115)
* WIFEXITED() (os モジュール):           プロセス管理.       (line 1144)
* WIFSIGNALED() (os モジュール):         プロセス管理.       (line 1137)
* WIFSTOPPED() (os モジュール):          プロセス管理.       (line 1125)
* 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  146)
* windll (ctypes モジュール):            共有ライブラリをロードする.
                                                             (line  208)
* window (curses のクラス):              Window objects.     (line    6)
* window manager (widgets):              The window manager. (line    6)
* window_cget() (tkinter.Text のメソッド): Widget classes.   (line 2200)
* window_config() (tkinter.Text のメソッド): Widget classes. (line 2205)
* window_configure() (tkinter.Text のメソッド): Widget classes.
                                                             (line 2205)
* window_create() (tkinter.Text のメソッド): Widget classes. (line 2192)
* 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  286)
* window_names() (tkinter.Text のメソッド): Widget classes.  (line 2214)
* window_width() (turtle モジュール):    設定と特殊なメソッド.
                                                             (line  121)
* window() (curses.panel.Panel のメソッド): Panel objects.   (line   62)
* Windows:                               完全な Python プログラム.
                                                             (line   24)
* Windows ini ファイル:                  configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* WindowsError:                          具象例外.           (line  495)
* 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  277)
* winfo_atom() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  886)
* winfo_atomname() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  894)
* winfo_cells() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  902)
* winfo_children() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  906)
* winfo_class() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  912)
* winfo_colormapfull() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  916)
* winfo_containing() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  921)
* winfo_depth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  931)
* winfo_exists() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  936)
* winfo_fpixels() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  940)
* winfo_geometry() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  947)
* winfo_height() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  952)
* winfo_id() (tkinter.Misc のメソッド):  Base and mixin classes.
                                                             (line  959)
* winfo_interps() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  965)
* winfo_ismapped() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  973)
* winfo_manager() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  977)
* winfo_name() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  983)
* winfo_parent() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  988)
* winfo_pathname() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line  993)
* winfo_pixels() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1000)
* winfo_pointerx() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1007)
* winfo_pointerxy() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1014)
* winfo_pointery() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1021)
* winfo_reqheight() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1028)
* winfo_reqwidth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1034)
* winfo_rgb() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1040)
* winfo_rootx() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1047)
* winfo_rooty() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1053)
* winfo_screen() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1059)
* winfo_screencells() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1064)
* winfo_screendepth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1069)
* winfo_screenheight() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1074)
* winfo_screenmmheight() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1078)
* winfo_screenmmwidth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1082)
* winfo_screenvisual() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1086)
* winfo_screenwidth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1092)
* winfo_server() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1096)
* winfo_toplevel() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1102)
* winfo_viewable() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1107)
* winfo_visual() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1112)
* winfo_visualid() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1118)
* winfo_visualsavailable() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1122)
* winfo_vrootheight() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1130)
* winfo_vrootwidth() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1136)
* winfo_vrootx() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1142)
* winfo_vrooty() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1149)
* winfo_width() (tkinter.Misc のメソッド): Base and mixin classes.
                                                             (line 1156)
* winfo_x() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line 1162)
* winfo_y() (tkinter.Misc のメソッド):   Base and mixin classes.
                                                             (line 1168)
* WINFUNCTYPE() (ctypes モジュール):     関数プロトタイプ.   (line   23)
* WinSock:                               select --- I/O 完了の待機.
                                                             (line  157)
* winver (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line 2184)
* 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  360)
* 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  419)
* with_statement (__future__ モジュール): モジュールコンテンツ<3>.
                                                             (line   31)
* with_stem() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  376)
* with_suffix() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  399)
* with_traceback() (BaseException のメソッド): 基底クラス.   (line   23)
* withdraw() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1630)
* withitem (ast のクラス):               制御フロー.         (line  242)
* Wm (tkinter のクラス):                 Base and mixin classes.
                                                             (line 1185)
* wm_aspect() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1196)
* wm_attributes() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1208)
* wm_client() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1330)
* wm_colormapwindows() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1339)
* wm_command() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1349)
* wm_deiconify() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1358)
* wm_focusmodel() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1366)
* wm_forget() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1377)
* wm_frame() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1390)
* wm_geometry() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1398)
* wm_grid() (tkinter.Wm のメソッド):     Base and mixin classes.
                                                             (line 1412)
* wm_group() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1428)
* wm_iconbitmap() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1438)
* wm_iconify() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1449)
* wm_iconmask() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1456)
* wm_iconname() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1466)
* wm_iconphoto() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1474)
* wm_iconposition() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1489)
* wm_iconwindow() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1498)
* wm_manage() (tkinter.Wm のメソッド):   Base and mixin classes.
                                                             (line 1509)
* wm_maxsize() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1519)
* wm_minsize() (tkinter.Wm のメソッド):  Base and mixin classes.
                                                             (line 1529)
* wm_overrideredirect() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1539)
* wm_positionfrom() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1551)
* wm_protocol() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1563)
* wm_resizable() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1578)
* wm_sizefrom() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1588)
* wm_state() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1597)
* wm_title() (tkinter.Wm のメソッド):    Base and mixin classes.
                                                             (line 1610)
* wm_transient() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1618)
* wm_withdraw() (tkinter.Wm のメソッド): Base and mixin classes.
                                                             (line 1630)
* WNOHANG (os モジュール):               プロセス管理.       (line 1030)
* WNOWAIT (os モジュール):               プロセス管理.       (line 1038)
* WORD (tkinter モジュール):             定数<10>.           (line   71)
* 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 contexts.      (line  453)
* wrap_future() (asyncio モジュール):    Future の関数.      (line   54)
* wrap_socket() (ssl.SSLContext のメソッド): SSL contexts.   (line  388)
* wrap() (textwrap モジュール):          textwrap --- テキストの折り返しと詰め込み.
                                                             (line   16)
* wrap() (textwrap.TextWrapper のメソッド): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  282)
* wrapper() (curses モジュール):         関数<6>.            (line  645)
* WrapperDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line   87)
* wraps() (functools モジュール):        functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  743)
* WRITABLE (inspect.BufferFlags の属性): Buffer flags.       (line   17)
* WRITABLE (tkinter モジュール):         File handlers.      (line   42)
* writable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line  103)
* writable() (io.IOBase のメソッド):     I/O 基底クラス.     (line  152)
* WRITE (inspect.BufferFlags の属性):    Buffer flags.       (line   51)
* write_byte() (mmap.mmap のメソッド):   mmap --- メモリマップファイルのサポート.
                                                             (line  339)
* 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 のメソッド): Memory BIO support.
                                                             (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  210)
* write() (file のメソッド):             I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line   27)
* write() (io.BufferedIOBase のメソッド): I/O 基底クラス.    (line  351)
* write() (io.BufferedWriter のメソッド): バッファ付きストリーム.
                                                             (line  130)
* write() (io.RawIOBase のメソッド):     I/O 基底クラス.     (line  222)
* write() (io.TextIOBase のメソッド):    テキスト I/O<2>.    (line   91)
* write() (io.Writer のメソッド):        Static Typing.      (line   40)
* write() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  323)
* write() (os モジュール):               ファイル記述子の操作.
                                                             (line  963)
* write() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   55)
* write() (ssl.MemoryBIO のメソッド):    Memory BIO support. (line  150)
* write() (ssl.SSLSocket のメソッド):    SSL sockets.        (line   97)
* write() (tkinter.PhotoImage のメソッド): Image classes.    (line  228)
* write() (turtle モジュール):           さらなる描画の制御. (line   29)
* write() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   60)
* write() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  281)
* writeframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  113)
* writeframesraw() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line  106)
* 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 モジュール):             モジュールコンテンツ.
                                                             (line   45)
* writerow() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   16)
* writerows() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   25)
* writestr() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  317)
* WriteTransport (asyncio のクラス):     トランスポートのクラス階層構造.
                                                             (line   11)
* writev() (os モジュール):              ファイル記述子の操作.
                                                             (line  982)
* 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 1008)
* WSTOPSIG() (os モジュール):            プロセス管理.       (line 1161)
* wstring_at() (ctypes モジュール):      ユーティリティー関数.
                                                             (line  289)
* WTERMSIG() (os モジュール):            プロセス管理.       (line 1170)
* WUNTRACED (os モジュール):             プロセス管理.       (line 1019)
* 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 (tkinter モジュール):                定数<10>.           (line   47)
* x (tkinter.Event の属性):              Other classes.      (line   48)
* X_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* x_root (tkinter.Event の属性):         Other classes.      (line   53)
* X509 certificate:                      SSL contexts.       (line  757)
* 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 モジュール):  モジュールコンテンツ<2>.
                                                             (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 モジュール):    モジュールコンテンツ<2>.
                                                             (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  321)
* 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 モジュール):  モジュールコンテンツ<2>.
                                                             (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)
* xposition() (tkinter.Menu のメソッド): Widget classes.     (line 1308)
* XView (tkinter のクラス):              Base and mixin classes.
                                                             (line 1943)
* xview_moveto() (tkinter.XView のメソッド): Base and mixin classes.
                                                             (line 1961)
* xview_scroll() (tkinter.XView のメソッド): Base and mixin classes.
                                                             (line 1967)
* xview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  321)
* xview() (tkinter.XView のメソッド):    Base and mixin classes.
                                                             (line 1951)
* Y (tkinter モジュール):                定数<10>.           (line   47)
* y (tkinter.Event の属性):              Other classes.      (line   48)
* y_root (tkinter.Event の属性):         Other classes.      (line   53)
* ycor() (turtle モジュール):            Turtle の状態を知る.
                                                             (line   44)
* year (datetime.date の属性):           date objects.       (line  145)
* year (datetime.datetime の属性):       datetime objects.   (line  308)
* yeardatescalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  123)
* yeardays2calendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  130)
* yeardayscalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  137)
* YES (tkinter モジュール):              定数<10>.           (line    9)
* YES (tkinter.messagebox モジュール):   tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  162)
* YESEXPR (locale モジュール):           locale --- 国際化サービス.
                                                             (line  279)
* YESNO (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  186)
* YESNOCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  191)
* 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   80)
* YieldFrom (ast のクラス):              関数およびクラス定義.
                                                             (line  123)
* yiq_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   32)
* yposition() (tkinter.Menu のメソッド): Widget classes.     (line 1315)
* YView (tkinter のクラス):              Base and mixin classes.
                                                             (line 1973)
* yview_moveto() (tkinter.YView のメソッド): Base and mixin classes.
                                                             (line 1990)
* yview_pickplace() (tkinter.Text のメソッド): Widget classes.
                                                             (line 2335)
* yview_scroll() (tkinter.YView のメソッド): Base and mixin classes.
                                                             (line 1996)
* yview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  326)
* yview() (tkinter.YView のメソッド):    Base and mixin classes.
                                                             (line 1980)
* Z_BEST_COMPRESSION (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  327)
* Z_BEST_SPEED (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  323)
* Z_BLOCK (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  393)
* Z_DEFAULT_COMPRESSION (zlib モジュール): zlib --- gzip 互換の圧縮.
                                                             (line  331)
* Z_DEFAULT_STRATEGY (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  336)
* Z_FILTERED (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  340)
* Z_FINISH (zlib モジュール):            zlib --- gzip 互換の圧縮.
                                                             (line  388)
* Z_FIXED (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  358)
* Z_FULL_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  383)
* Z_HUFFMAN_ONLY (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  344)
* Z_NO_COMPRESSION (zlib モジュール):    zlib --- gzip 互換の圧縮.
                                                             (line  317)
* Z_NO_FLUSH (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  368)
* Z_PARTIAL_FLUSH (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  374)
* Z_RLE (zlib モジュール):               zlib --- gzip 互換の圧縮.
                                                             (line  348)
* Z_SYNC_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  378)
* Z_TREES (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  402)
* z;文字列のフォーマットで:              Format specification mini-language.
                                                             (line   92)
* z85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  121)
* z85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line  110)
* Zen of Python:                         用語集<2>.          (line 1896)
* ZeroDivisionError:                     具象例外.           (line  483)
* zfill() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  753)
* zfill() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  753)
* zfill() (str のメソッド):              文字列メソッド<2>.  (line  962)
* 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:   コマンドラインインターフェイス<3>.
                                                             (line   46)
* zipapp コマンドラインオプション; -compress: コマンドラインインターフェイス<3>.
                                                             (line   46)
* zipapp コマンドラインオプション; -h:   コマンドラインインターフェイス<3>.
                                                             (line   62)
* zipapp コマンドラインオプション; -help: コマンドラインインターフェイス<3>.
                                                             (line   62)
* zipapp コマンドラインオプション; -info: コマンドラインインターフェイス<3>.
                                                             (line   56)
* zipapp コマンドラインオプション; -m:   コマンドラインインターフェイス<3>.
                                                             (line   35)
* zipapp コマンドラインオプション; -main: コマンドラインインターフェイス<3>.
                                                             (line   35)
* zipapp コマンドラインオプション; -o:   コマンドラインインターフェイス<3>.
                                                             (line   17)
* zipapp コマンドラインオプション; -output: コマンドラインインターフェイス<3>.
                                                             (line   17)
* zipapp コマンドラインオプション; -p:   コマンドラインインターフェイス<3>.
                                                             (line   29)
* zipapp コマンドラインオプション; -python: コマンドラインインターフェイス<3>.
                                                             (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  421)
* ZLIB_VERSION (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  414)
* ZLIBNG_VERSION (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  428)
* ZoneInfo (zoneinfo のクラス):          ZoneInfo クラス.    (line    6)
* ZoneInfoNotFoundError:                 例外と警告.         (line    6)
* zoom() (tkinter.PhotoImage のメソッド): Image classes.     (line  255)
* zscore() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  120)
* zstd_version_info (compression.zstd モジュール): その他<3>.
                                                             (line   32)
* ZstdCompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line   50)
* ZstdDecompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line  156)
* 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 forms.
                                                             (line   20)
* キー:                                  辞書表示.           (line    6)
* キー <1>:                              用語集<2>.          (line  987)
* キーワード:                            キーワード 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  154)
* キーワード;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  278)
* クラス;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  146)
* クラスインスタンス;属性:               クラスインスタンス class instance.
                                                             (line    6)
* クラスインスタンス;属性;代入:          クラスインスタンス class instance.
                                                             (line   21)
* クラスオブジェクト;call:               カスタムクラス型.   (line   19)
* クラスオブジェクト;call <1>:           カスタムクラス型.   (line   31)
* クラスオブジェクト;call <2>:           呼び出し call.      (line  142)
* グラフィカルユーザインターフェース:    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  141)
* コマンドラインオプション; -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  174)
* コマンドラインオプション; -V:          一般オプション.     (line   33)
* コマンドラインオプション; -v:          その他のオプション. (line  184)
* コマンドラインオプション; -version:    一般オプション.     (line   33)
* コマンドラインオプション; -W:          その他のオプション. (line  197)
* コマンドラインオプション; -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  145)
* コマンドラインオプション; -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  131)
* コマンドラインオプション; -without-mimalloc: パフォーマンスに関するオプション.
                                                             (line  114)
* コマンドラインオプション; -without-pymalloc: パフォーマンスに関するオプション.
                                                             (line  124)
* コマンドラインオプション; -without-readline: Libraries options.
                                                             (line   51)
* コマンドラインオプション; -without-remote-debug: パフォーマンスに関するオプション.
                                                             (line  150)
* コマンドラインオプション; -without-static-libpython: リンカのオプション<2>.
                                                             (line   11)
* コマンドラインオプション; -x:          その他のオプション. (line  258)
* コマンドラインオプション; -X:          その他のオプション. (line  263)
* コマンドラインオプション; 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  391)
* コルーチン;関数:                       コルーチン関数 coroutine function.
                                                             (line    6)
* コンテキスト管理プロトコル:            コンテキストマネージャ型.
                                                             (line    6)
* コンテキスト管理プロトコル <1>:        用語集<2>.          (line  363)
* コンテナ:                              オブジェクト、値、および型.
                                                             (line   65)
* コンテナ <1>:                          カスタムクラス型.   (line   19)
* コンテナ;での反復:                     イテレータ型.       (line    6)
* サブクラス化;変更不能な型:             基本的なカスタマイズ.
                                                             (line    8)
* ジェネレータ:                          用語集<2>.          (line  721)
* ジェネレータ <1>:                      用語集<2>.          (line  721)
* ジェネレータ;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 1802)
* ディレクトリ;トラバース <1>:           ファイルとディレクトリ.
                                                             (line 1904)
* ディレクトリ;作成:                     ファイルとディレクトリ.
                                                             (line  559)
* ディレクトリ;削除:                     ディレクトリとファイルの操作.
                                                             (line  283)
* ディレクトリ;削除 <1>:                 ファイルとディレクトリ.
                                                             (line  750)
* ディレクトリ;変更:                     ファイルとディレクトリ.
                                                             (line  120)
* ディレクトリ;走査:                     ファイルとディレクトリ.
                                                             (line 1802)
* ディレクトリ;走査 <1>:                 ファイルとディレクトリ.
                                                             (line 1904)
* デストラクタ:                          基本的なカスタマイズ.
                                                             (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 1782)
* ドキュメント文字列:                    Special read-only attributes<2>.
                                                             (line  104)
* バイト:                                変更不能なシーケンス immutable sequence.
                                                             (line   45)
* バイト列リテラル:                      リテラル.           (line   15)
* バイナリモード:                        組み込み関数.       (line 1461)
* パス;操作:                             pathlib --- オブジェクト指向のファイルシステムパス.
                                                             (line   10)
* パス;操作 <1>:                         os path --- 一般的なパス名操作.
                                                             (line    9)
* パス;設定;ファイル:                    site --- サイト固有の設定フック.
                                                             (line   77)
* パック;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 1292)
* ファイル;コピー:                       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 1150)
* メソッド;call:                         呼び出し call.      (line  137)
* モジュロ:                              二項算術演算 binary arithmetic operation.
                                                             (line   50)
* ユーザー;id:                           プロセスのパラメーター.
                                                             (line  352)
* ユーザー;ID、設定:                     プロセスのパラメーター.
                                                             (line  548)
* ユーザー;実効 ID:                      プロセスのパラメーター.
                                                             (line  207)
* ユーザ定義の;メソッド:                 インスタンスメソッド.
                                                             (line    6)
* ユーザ定義の;関数:                     ユーザ定義関数 user-defined function.
                                                             (line    6)
* ユーザ定義の;関数;call:                呼び出し call.      (line  127)
* リテラル:                              リテラル.           (line    6)
* リテラル <1>:                          リテラル<2>.        (line    6)
* ロケールエンコーディング:              用語集<2>.          (line 1098)
* 三項;operator:                         条件式 Conditional Expressions.
                                                             (line    6)
* 丸括弧形式:                            Parenthesized forms.
                                                             (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 1447)
* 例外:                                  例外<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)
* 内包表記:                              Displays for lists sets and dictionaries.
                                                             (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  180)
* 属性;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   59)
* 引数 (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  851)
* 永続化:                                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 1690)
* 添字;代入:                             ミュータブルなシーケンス型.
                                                             (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:                  Mapping Types --- dict.
                                                             (line    6)
* 演算;list;type:                        ミュータブルなシーケンス型.
                                                             (line   16)
* 演算;mapping;types:                    Mapping Types --- dict.
                                                             (line    6)
* 演算;sequence;types:                   共通のシーケンス演算.
                                                             (line   18)
* 演算;sequence;types <1>:               ミュータブルなシーケンス型.
                                                             (line   16)
* 演算;数値;types:                       数値型 int float complex.
                                                             (line  103)
* 演算;整数;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 1643)
* 特殊;属性:                             標準型の階層.       (line   12)
* 環境:                                  名前解決.           (line   12)
* 環境;仮想:                             venv --- 仮想環境の作成.
                                                             (line   10)
* 環境変数; __PYVENV_LAUNCHER__:         PyConfig.           (line  182)
* 環境変数; __PYVENV_LAUNCHER__ <1>:     PyConfig.           (line  724)
* 環境変数; 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>:                 ライブラリ<28>.     (line  420)
* 環境変数; BROWSER <3>:                 ライブラリ<28>.     (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   87)
* 環境変数; 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_CEVAL:                Compiler flags.     (line   81)
* 環境変数; 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   93)
* 環境変数; COLUMNS:                     関数<6>.            (line  635)
* 環境変数; COLUMNS <1>:                 関数<6>.            (line  636)
* 環境変数; COMPILEALL_OPTS:             Compiler flags.     (line   41)
* 環境変数; COMSPEC:                     プロセス管理.       (line  779)
* 環境変数; 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:                     Toplevel widgets.   (line   22)
* 環境変数; EnableControlFlowGuard:      ビルド<46>.         (line   47)
* 環境変数; EXTRA_CFLAGS:                Compiler flags.     (line   48)
* 環境変数; HOME:                        os path<5>.         (line   15)
* 環境変数; HOME <1>:                    Python API の変更<6>.
                                                             (line  118)
* 環境変数; HOME <2>:                    Windows<50>.        (line   15)
* 環境変数; HOME <3>:                    Windows<50>.        (line   18)
* 環境変数; HOME <4>:                    os path --- 一般的なパス名操作.
                                                             (line  149)
* 環境変数; HOME <5>:                    os path --- 一般的なパス名操作.
                                                             (line  167)
* 環境変数; HOME <6>:                    Toplevel widgets.   (line   61)
* 環境変数; HOMEDRIVE:                   os path --- 一般的なパス名操作.
                                                             (line  156)
* 環境変数; HOMEPATH:                    os path --- 一般的なパス名操作.
                                                             (line  156)
* 環境変数; IDLESTARTUP:                 IDLE<38>.           (line  176)
* 環境変数; IDLESTARTUP <1>:             IDLE<42>.           (line    9)
* 環境変数; IDLESTARTUP <2>:             IDLE<48>.           (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  144)
* 環境変数; LINES <1>:                   関数<6>.            (line  634)
* 環境変数; LINES <2>:                   関数<6>.            (line  636)
* 環境変数; LINKCC:                      Linker flags.       (line    6)
* 環境変数; LOGNAME:                     プロセスのパラメーター.
                                                             (line  257)
* 環境変数; 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<12>.          (line   14)
* 環境変数; PATH <5>:                    Windows<31>.        (line   55)
* 環境変数; PATH <6>:                    Windows<35>.        (line   14)
* 環境変数; PATH <7>:                    セキュリティ<49>.   (line   16)
* 環境変数; PATH <8>:                    セキュリティ<49>.   (line   20)
* 環境変数; PATH <9>:                    モジュール検索パス. (line   15)
* 環境変数; 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  132)
* 環境変数; 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  109)
* 環境変数; 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  455)
* 環境変数; PATH <40>:                   ディレクトリとファイルの操作.
                                                             (line  460)
* 環境変数; PATH <41>:                   プロセス管理.       (line   45)
* 環境変数; PATH <42>:                   プロセス管理.       (line   87)
* 環境変数; PATH <43>:                   プロセス管理.       (line   90)
* 環境変数; PATH <44>:                   プロセス管理.       (line   93)
* 環境変数; PATH <45>:                   プロセス管理.       (line  544)
* 環境変数; PATH <46>:                   プロセス管理.       (line  632)
* 環境変数; PATH <47>:                   プロセス管理.       (line  634)
* 環境変数; PATH <48>:                   プロセス管理.       (line  636)
* 環境変数; PATH <49>:                   雑多なシステム情報. (line  136)
* 環境変数; 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   69)
* 環境変数; 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>:                 ライブラリ<139>.    (line  138)
* 環境変数; PATHEXT <2>:                 Installing without UI.
                                                             (line   78)
* 環境変数; PATHEXT <3>:                 Installing without UI.
                                                             (line   83)
* 環境変数; PATHEXT <4>:                 ディレクトリとファイルの操作.
                                                             (line  470)
* 環境変数; PIP_USER:                    Windows<52>.        (line  102)
* 環境変数; PROFILE_TASK:                ビルド<26>.         (line   13)
* 環境変数; PROFILE_TASK <1>:            パフォーマンスに関するオプション.
                                                             (line   12)
* 環境変数; PROFILE_TASK <2>:            パフォーマンスに関するオプション.
                                                             (line   35)
* 環境変数; PURIFY:                      Compiler flags.     (line  136)
* 環境変数; PY_BUILTIN_MODULE_CFLAGS:    Compiler flags.     (line  127)
* 環境変数; PY_CFLAGS:                   Compiler flags.     (line  100)
* 環境変数; PY_CFLAGS_NODIST:            Compiler flags.     (line  105)
* 環境変数; PY_CORE_CFLAGS:              Compiler flags.     (line  121)
* 環境変数; 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  112)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL:    Windows<19>.        (line   24)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL <1>: Windows<33>.       (line   15)
* 環境変数; PYTHON_BASIC_REPL:           Default interactive shell.
                                                             (line    7)
* 環境変数; PYTHON_BASIC_REPL <1>:       改善された対話的インタープリタ.
                                                             (line   28)
* 環境変数; PYTHON_BASIC_REPL <2>:       ライブラリ<50>.     (line   52)
* 環境変数; PYTHON_BASIC_REPL <3>:       ライブラリ<50>.     (line   55)
* 環境変数; PYTHON_BASIC_REPL <4>:       Core and Builtins<51>.
                                                             (line   13)
* 環境変数; PYTHON_BASIC_REPL <5>:       対話モード<2>.      (line   21)
* 環境変数; PYTHON_BASIC_REPL <6>:       環境変数.           (line  542)
* 環境変数; 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  534)
* 環境変数; PYTHON_COLORS <5>:           color.              (line   24)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS: ライブラリ<28>.   (line  369)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <1>: その他のオプション.
                                                             (line  434)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <2>: 環境変数.     (line  582)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  588)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <4>: Concurrent safety of Context Managers.
                                                             (line   41)
* 環境変数; PYTHON_CPU_COUNT:            os<2>.              (line   11)
* 環境変数; PYTHON_CPU_COUNT <1>:        その他のオプション. (line  398)
* 環境変数; PYTHON_CPU_COUNT <2>:        環境変数.           (line  510)
* 環境変数; 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  517)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG: PEP 768 安全な外部デバッガインターフェース.
                                                             (line   39)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <1>: その他のオプション.
                                                             (line  389)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <2>: 環境変数.       (line  497)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <3>: Disabling remote debugging.
                                                             (line    8)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <4>: When to use PYTHON_DISABLE_REMOTE_DEBUG.
                                                             (line    6)
* 環境変数; PYTHON_DOM:                  モジュールコンテンツ<2>.
                                                             (line   22)
* 環境変数; PYTHON_FROZEN_MODULES:       その他の言語変更.   (line   46)
* 環境変数; PYTHON_FROZEN_MODULES <1>:   Core and Builtins<62>.
                                                             (line  105)
* 環境変数; PYTHON_FROZEN_MODULES <2>:   その他のオプション. (line  357)
* 環境変数; PYTHON_FROZEN_MODULES <3>:   環境変数.           (line  520)
* 環境変数; PYTHON_FROZEN_MODULES <4>:   PyConfig.           (line  415)
* 環境変数; PYTHON_GIL:                  フリースレッドの CPython.
                                                             (line   23)
* 環境変数; PYTHON_GIL <1>:              フリースレッドの CPython.
                                                             (line   37)
* 環境変数; PYTHON_GIL <2>:              Core and Builtins<47>.
                                                             (line   50)
* 環境変数; PYTHON_GIL <3>:              その他のオプション. (line  416)
* 環境変数; PYTHON_GIL <4>:              環境変数.           (line  559)
* 環境変数; PYTHON_GIL <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line  581)
* 環境変数; PYTHON_GIL <6>:              The global interpreter lock in free-threaded Python.
                                                             (line    7)
* 環境変数; PYTHON_GIL <7>:              用語集<2>.          (line  803)
* 環境変数; PYTHON_HISTORY:              その他の言語変更.   (line   57)
* 環境変数; PYTHON_HISTORY <1>:          ライブラリ<66>.     (line  544)
* 環境変数; PYTHON_HISTORY <2>:          環境変数.           (line  551)
* 環境変数; PYTHON_JIT:                  Binary releases for the experimental just-in-time compiler.
                                                             (line    8)
* 環境変数; PYTHON_JIT <1>:              環境変数.           (line  592)
* 環境変数; PYTHON_JIT <2>:              一般的なオプション. (line  242)
* 環境変数; PYTHON_JIT <3>:              一般的なオプション. (line  245)
* 環境変数; PYTHON_JIT <4>:              一般的なオプション. (line  250)
* 環境変数; PYTHON_JIT <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line 1272)
* 環境変数; PYTHON_MANAGER_AUTOMATIC_INSTALL: Installing runtimes.
                                                             (line   47)
* 環境変数; 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  376)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <2>: 環境変数.           (line  484)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <3>: PyConfig.           (line  900)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <4>: How to work without frame pointers.
                                                             (line   14)
* 環境変数; PYTHON_PRESITE:              その他のオプション. (line  410)
* 環境変数; PYTHON_PRESITE <1>:          デバッグモード変数. (line   25)
* 環境変数; PYTHON_PRESITE <2>:          PyConfig.           (line  795)
* 環境変数; PYTHON_PRESITE=package.module: Core and Builtins<62>.
                                                             (line  154)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT: Core and Builtins<28>.
                                                             (line  134)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <1>: その他のオプション.
                                                             (line  426)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <2>: 環境変数.     (line  571)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  584)
* 環境変数; PYTHON_TLBC:                 その他のオプション. (line  442)
* 環境変数; PYTHON_TLBC <1>:             環境変数.           (line  600)
* 環境変数; PYTHONASYNCIODEBUG:          環境変数.           (line  280)
* 環境変数; 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  159)
* 環境変数; 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>:            ライブラリ<157>.    (line  144)
* 環境変数; PYTHONCASEOK <3>:            環境変数.           (line  130)
* 環境変数; PYTHONCASEOK <4>:            組み込み関数.       (line 2236)
* 環境変数; PYTHONCOERCECLOCALE:         PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* 環境変数; PYTHONCOERCECLOCALE <1>:     環境変数.           (line  374)
* 環境変数; PYTHONCOERCECLOCALE <2>:     一般的なオプション. (line   89)
* 環境変数; PYTHONCOERCECLOCALE <3>:     Python UTF-8 Mode.  (line   56)
* 環境変数; PYTHONCOERCECLOCALE <4>:     Python Configuration.
                                                             (line   15)
* 環境変数; PYTHONDEBUG:                 その他のオプション. (line   38)
* 環境変数; PYTHONDEBUG <1>:             環境変数.           (line   93)
* 環境変数; PYTHONDEBUG <2>:             Python デバッグビルド.
                                                             (line   20)
* 環境変数; PYTHONDEBUG <3>:             グローバルな設定変数.
                                                             (line   38)
* 環境変数; PYTHONDEBUG <4>:             PyConfig.           (line  686)
* 環境変数; PYTHONDEVMODE:               Python Development Mode -X dev.
                                                             (line    6)
* 環境変数; PYTHONDEVMODE <1>:           その他のオプション. (line  316)
* 環境変数; PYTHONDEVMODE <2>:           環境変数.           (line  431)
* 環境変数; PYTHONDEVMODE <3>:           Python 開発モード.  (line   14)
* 環境変数; PYTHONDEVMODE <4>:           PyConfig.           (line  291)
* 環境変数; PYTHONDONTWRITEBYTECODE:     インタプリタの変更<2>.
                                                             (line   15)
* 環境変数; PYTHONDONTWRITEBYTECODE <1>: 新しいモジュールと改良されたモジュール<2>.
                                                             (line  636)
* 環境変数; PYTHONDONTWRITEBYTECODE <2>: その他のオプション. (line   19)
* 環境変数; PYTHONDONTWRITEBYTECODE <3>: 環境変数.           (line  136)
* 環境変数; PYTHONDONTWRITEBYTECODE <4>: sys --- システム固有のパラメーターと関数.
                                                             (line  332)
* 環境変数; PYTHONDONTWRITEBYTECODE <5>: グローバルな設定変数.
                                                             (line   52)
* 環境変数; PYTHONDONTWRITEBYTECODE <6>: PyConfig.           (line  999)
* 環境変数; PYTHONDONTWRITEBYTECODE <7>: pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* 環境変数; PYTHONDUMPREFS:              デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* 環境変数; PYTHONDUMPREFS <1>:          ビルド<63>.         (line   54)
* 環境変数; PYTHONDUMPREFS <2>:          デバッグモード変数. (line    6)
* 環境変数; PYTHONDUMPREFS <3>:          Debug options.      (line   22)
* 環境変数; PYTHONDUMPREFS <4>:          Debug options.      (line   24)
* 環境変数; PYTHONDUMPREFS <5>:          PyConfig.           (line  302)
* 環境変数; PYTHONDUMPREFSFILE:          Core and Builtins<113>.
                                                             (line   16)
* 環境変数; PYTHONDUMPREFSFILE <1>:      デバッグモード変数. (line   14)
* 環境変数; PYTHONDUMPREFSFILE <2>:      PyConfig.           (line  314)
* 環境変数; PYTHONEXECUTABLE:            環境変数.           (line  216)
* 環境変数; PYTHONEXECUTABLE <1>:        PyConfig.           (line  721)
* 環境変数; PYTHONFAULTHANDLER:          faulthandler<5>.    (line   12)
* 環境変数; PYTHONFAULTHANDLER <1>:      その他のオプション. (line  268)
* 環境変数; PYTHONFAULTHANDLER <2>:      環境変数.           (line  244)
* 環境変数; PYTHONFAULTHANDLER <3>:      Python 開発モードの影響.
                                                             (line   59)
* 環境変数; PYTHONFAULTHANDLER <4>:      faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* 環境変数; PYTHONFAULTHANDLER <5>:      PyConfig.           (line  351)
* 環境変数; PYTHONHASHSEED:              組み込みの関数と型. (line   18)
* 環境変数; PYTHONHASHSEED <1>:          Python コードの移植.
                                                             (line    7)
* 環境変数; PYTHONHASHSEED <2>:          Core and Builtins<170>.
                                                             (line   30)
* 環境変数; PYTHONHASHSEED <3>:          その他のオプション. (line  131)
* 環境変数; PYTHONHASHSEED <4>:          その他のオプション. (line  148)
* 環境変数; PYTHONHASHSEED <5>:          環境変数.           (line  151)
* 環境変数; PYTHONHASHSEED <6>:          環境変数.           (line  156)
* 環境変数; PYTHONHASHSEED <7>:          基本的なカスタマイズ.
                                                             (line  310)
* 環境変数; PYTHONHASHSEED <8>:          グローバルな設定変数.
                                                             (line   75)
* 環境変数; PYTHONHASHSEED <9>:          グローバルな設定変数.
                                                             (line   78)
* 環境変数; PYTHONHASHSEED <10>:         PyConfig.           (line  431)
* 環境変数; 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   90)
* 環境変数; PYTHONHOME <21>:             プロセスワイドのパラメータ.
                                                             (line  300)
* 環境変数; PYTHONHOME <22>:             プロセスワイドのパラメータ.
                                                             (line  315)
* 環境変数; PYTHONHOME <23>:             プロセスワイドのパラメータ.
                                                             (line  324)
* 環境変数; PYTHONHOME <24>:             PyConfig.           (line  439)
* 環境変数; PYTHONHOME <25>:             PyConfig.           (line  441)
* 環境変数; PYTHONHOME <26>:             Pending removal in Python 3 15<8>.
                                                             (line   58)
* 環境変数; PYTHONINSPECT:               その他の変更と修正<2>.
                                                             (line   13)
* 環境変数; PYTHONINSPECT <1>:           Core and Builtins<6>.
                                                             (line   57)
* 環境変数; PYTHONINSPECT <2>:           その他のオプション. (line   69)
* 環境変数; PYTHONINSPECT <3>:           環境変数.           (line  102)
* 環境変数; PYTHONINSPECT <4>:           グローバルな設定変数.
                                                             (line  107)
* 環境変数; PYTHONINSPECT <5>:           PyConfig.           (line  470)
* 環境変数; PYTHONINTMAXSTRDIGITS:       Core and Builtins<79>.
                                                             (line   74)
* 環境変数; PYTHONINTMAXSTRDIGITS <1>:   その他のオプション. (line  290)
* 環境変数; PYTHONINTMAXSTRDIGITS <2>:   環境変数.           (line  168)
* 環境変数; PYTHONINTMAXSTRDIGITS <3>:   上限値を設定する.   (line    9)
* 環境変数; PYTHONINTMAXSTRDIGITS <4>:   上限値を設定する.   (line   16)
* 環境変数; PYTHONINTMAXSTRDIGITS <5>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1191)
* 環境変数; PYTHONINTMAXSTRDIGITS <6>:   PyConfig.           (line  501)
* 環境変数; PYTHONIOENCODING:            その他の改善<2>.    (line   75)
* 環境変数; PYTHONIOENCODING <1>:        インタプリタの変更<2>.
                                                             (line   22)
* 環境変数; PYTHONIOENCODING <2>:        環境変数.           (line  176)
* 環境変数; PYTHONIOENCODING <3>:        環境変数.           (line  411)
* 環境変数; PYTHONIOENCODING <4>:        Python UTF-8 Mode.  (line   28)
* 環境変数; PYTHONIOENCODING <5>:        sys --- システム固有のパラメーターと関数.
                                                             (line 1992)
* 環境変数; PYTHONIOENCODING <6>:        PyConfig.           (line  854)
* 環境変数; 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<21>.  (line   37)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <6>: 環境変数.     (line  347)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <7>: sys --- システム固有のパラメーターと関数.
                                                             (line 1933)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1944)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <9>: sys --- システム固有のパラメーターと関数.
                                                             (line 1949)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <10>: グローバルな設定変数.
                                                             (line  149)
* 環境変数; 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  361)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 1996)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <4>: グローバルな設定変数.
                                                             (line  167)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <5>: PyConfig.          (line  554)
* 環境変数; PYTHONMALLOC:                PYTHONMALLOC 環境変数.
                                                             (line    6)
* 環境変数; PYTHONMALLOC <1>:            C API の変更<13>.   (line    9)
* 環境変数; PYTHONMALLOC <2>:            Core and Builtins<190>.
                                                             (line   90)
* 環境変数; PYTHONMALLOC <3>:            環境変数.           (line  287)
* 環境変数; PYTHONMALLOC <4>:            環境変数.           (line  338)
* 環境変数; PYTHONMALLOC <5>:            パフォーマンスに関するオプション.
                                                             (line  122)
* 環境変数; PYTHONMALLOC <6>:            パフォーマンスに関するオプション.
                                                             (line  129)
* 環境変数; PYTHONMALLOC <7>:            Python 開発モードの影響.
                                                             (line   46)
* 環境変数; PYTHONMALLOC <8>:            Python 開発モードの影響.
                                                             (line   50)
* 環境変数; PYTHONMALLOC <9>:            概要<4>.            (line   76)
* 環境変数; PYTHONMALLOC <10>:           Default Memory Allocators.
                                                             (line   32)
* 環境変数; PYTHONMALLOC <11>:           Debug hooks on the Python memory allocators.
                                                             (line   11)
* 環境変数; PYTHONMALLOC <12>:           pymalloc アロケータ.
                                                             (line   27)
* 環境変数; PYTHONMALLOC <13>:           The mimalloc allocator.
                                                             (line   24)
* 環境変数; PYTHONMALLOCSTATS:           Core and Builtins<190>.
                                                             (line   96)
* 環境変数; PYTHONMALLOCSTATS <1>:       環境変数.           (line  331)
* 環境変数; PYTHONMALLOCSTATS <2>:       PyConfig.           (line  570)
* 環境変数; PYTHONMALLOCSTATS <3>:       概要<4>.            (line   79)
* 環境変数; PYTHONNODEBUGRANGES:         PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* 環境変数; PYTHONNODEBUGRANGES <1>:     その他のオプション. (line  345)
* 環境変数; PYTHONNODEBUGRANGES <2>:     環境変数.           (line  461)
* 環境変数; PYTHONNODEBUGRANGES <3>:     Methods on code objects.
                                                             (line   40)
* 環境変数; PYTHONNODEBUGRANGES <4>:     PyConfig.           (line  244)
* 環境変数; PYTHONNOUSERSITE:            PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* 環境変数; PYTHONNOUSERSITE <1>:        その他のオプション. (line  160)
* 環境変数; PYTHONNOUSERSITE <2>:        環境変数.           (line  194)
* 環境変数; PYTHONNOUSERSITE <3>:        モジュールの内容<6>.
                                                             (line   15)
* 環境変数; PYTHONNOUSERSITE <4>:        グローバルな設定変数.
                                                             (line  200)
* 環境変数; PYTHONNOUSERSITE <5>:        PyConfig.           (line  952)
* 環境変数; PYTHONOPTIMIZE:              その他のオプション. (line   89)
* 環境変数; PYTHONOPTIMIZE <1>:          環境変数.           (line   74)
* 環境変数; PYTHONOPTIMIZE <2>:          グローバルな設定変数.
                                                             (line  211)
* 環境変数; PYTHONOPTIMIZE <3>:          PyConfig.           (line  638)
* 環境変数; PYTHONPATH:                  'python' コマンドの挙動の変更<2>.
                                                             (line    7)
* 環境変数; PYTHONPATH <1>:              'python' コマンドの挙動の変更<2>.
                                                             (line    9)
* 環境変数; PYTHONPATH <2>:              モジュール検索パス. (line   15)
* 環境変数; 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 1426)
* 環境変数; PYTHONPATH <19>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1432)
* 環境変数; 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   89)
* 環境変数; PYTHONPATH <25>:             PyConfig.           (line  603)
* 環境変数; PYTHONPERFSUPPORT:           その他の言語変更<2>.
                                                             (line   84)
* 環境変数; PYTHONPERFSUPPORT <1>:       その他のオプション. (line  365)
* 環境変数; PYTHONPERFSUPPORT <2>:       環境変数.           (line  472)
* 環境変数; PYTHONPERFSUPPORT <3>:       PyConfig.           (line  896)
* 環境変数; PYTHONPERFSUPPORT <4>:       How to enable perf profiling support.
                                                             (line    7)
* 環境変数; PYTHONPLATLIBDIR:            Core and Builtins<149>.
                                                             (line   47)
* 環境変数; PYTHONPLATLIBDIR <1>:        環境変数.           (line   54)
* 環境変数; PYTHONPLATLIBDIR <2>:        sys path モジュール検索パスの初期化.
                                                             (line   51)
* 環境変数; PYTHONPLATLIBDIR <3>:        PyConfig.           (line  582)
* 環境変数; PYTHONPROFILEIMPORTTIME:     その他の言語変更<7>.
                                                             (line   47)
* 環境変数; PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<172>.
                                                             (line   66)
* 環境変数; PYTHONPROFILEIMPORTTIME <2>: その他のオプション. (line  306)
* 環境変数; PYTHONPROFILEIMPORTTIME <3>: 環境変数.           (line  268)
* 環境変数; PYTHONPROFILEIMPORTTIME <4>: PyConfig.           (line  453)
* 環境変数; PYTHONPYCACHEPREFIX:         コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* 環境変数; PYTHONPYCACHEPREFIX <1>:     Core and Builtins<163>.
                                                             (line  402)
* 環境変数; PYTHONPYCACHEPREFIX <2>:     その他のオプション. (line  329)
* 環境変数; PYTHONPYCACHEPREFIX <3>:     環境変数.           (line  142)
* 環境変数; PYTHONPYCACHEPREFIX <4>:     sys --- システム固有のパラメーターと関数.
                                                             (line  379)
* 環境変数; PYTHONPYCACHEPREFIX <5>:     PyConfig.           (line  743)
* 環境変数; PYTHONREGRTEST_UNICODE_GUARD: テスト<32>.        (line   13)
* 環境変数; PYTHONSAFEPATH:              概要 -- リリースハイライト<4>.
                                                             (line   27)
* 環境変数; PYTHONSAFEPATH <1>:          その他の言語変更<3>.
                                                             (line   37)
* 環境変数; PYTHONSAFEPATH <2>:          セキュリティ<33>.   (line    6)
* 環境変数; PYTHONSAFEPATH <3>:          その他のオプション. (line  117)
* 環境変数; PYTHONSAFEPATH <4>:          環境変数.           (line   46)
* 環境変数; PYTHONSAFEPATH <5>:          sys --- システム固有のパラメーターと関数.
                                                             (line 1444)
* 環境変数; PYTHONSAFEPATH <6>:          セキュリティで考慮すべき点<6>.
                                                             (line   47)
* 環境変数; PYTHONSAFEPATH <7>:          PyConfig.           (line  161)
* 環境変数; PYTHONSTARTUP:               Default interactive shell.
                                                             (line   15)
* 環境変数; PYTHONSTARTUP <1>:           sys<12>.            (line   16)
* 環境変数; PYTHONSTARTUP <2>:           sys<12>.            (line   21)
* 環境変数; PYTHONSTARTUP <3>:           ライブラリ<4>.      (line  102)
* 環境変数; PYTHONSTARTUP <4>:           ライブラリ<6>.      (line  144)
* 環境変数; PYTHONSTARTUP <5>:           Core and Builtins<15>.
                                                             (line   41)
* 環境変数; PYTHONSTARTUP <6>:           IDLE<38>.           (line  176)
* 環境変数; PYTHONSTARTUP <7>:           IDLE<42>.           (line    9)
* 環境変数; PYTHONSTARTUP <8>:           IDLE<48>.           (line    9)
* 環境変数; PYTHONSTARTUP <9>:           対話モード用の起動時実行ファイル.
                                                             (line    7)
* 環境変数; PYTHONSTARTUP <10>:          その他のオプション. (line   65)
* 環境変数; PYTHONSTARTUP <11>:          環境変数.           (line   61)
* 環境変数; PYTHONSTARTUP <12>:          環境変数.           (line  116)
* 環境変数; PYTHONSTARTUP <13>:          使用例<2>.          (line   10)
* 環境変数; PYTHONSTARTUP <14>:          asyncio --- 非同期 I/O.
                                                             (line   88)
* 環境変数; PYTHONSTARTUP <15>:          Startup and Code Execution.
                                                             (line    6)
* 環境変数; PYTHONSTARTUP <16>:          コマンドラインでの使用<5>.
                                                             (line   42)
* 環境変数; PYTHONSTARTUP <17>:          sys --- システム固有のパラメーターと関数.
                                                             (line 1203)
* 環境変数; PYTHONSTARTUP <18>:          readline の設定.    (line   12)
* 環境変数; PYTHONTRACEMALLOC:           その他のオプション. (line  285)
* 環境変数; PYTHONTRACEMALLOC <1>:       環境変数.           (line  255)
* 環境変数; PYTHONTRACEMALLOC <2>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* 環境変数; PYTHONTRACEMALLOC <3>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* 環境変数; PYTHONTRACEMALLOC <4>:       関数<11>.           (line   90)
* 環境変数; PYTHONTRACEMALLOC <5>:       PyConfig.           (line  882)
* 環境変数; PYTHONTZPATH:                Environment configuration.
                                                             (line   11)
* 環境変数; PYTHONTZPATH <1>:            例外と警告.         (line   14)
* 環境変数; PYTHONUNBUFFERED:            Core and Builtins<156>.
                                                             (line  107)
* 環境変数; PYTHONUNBUFFERED <1>:        その他のオプション. (line  179)
* 環境変数; PYTHONUNBUFFERED <2>:        環境変数.           (line  119)
* 環境変数; PYTHONUNBUFFERED <3>:        sys --- システム固有のパラメーターと関数.
                                                             (line 2003)
* 環境変数; PYTHONUNBUFFERED <4>:        グローバルな設定変数.
                                                             (line  239)
* 環境変数; PYTHONUNBUFFERED <5>:        PyConfig.           (line  208)
* 環境変数; PYTHONUOPS:                  Core and Builtins<63>.
                                                             (line   27)
* 環境変数; PYTHONUOPS <1>:              Core and Builtins<63>.
                                                             (line  179)
* 環境変数; PYTHONUOPS <2>:              Core and Builtins<63>.
                                                             (line  258)
* 環境変数; PYTHONUOPS <3>:              Core and Builtins<63>.
                                                             (line  317)
* 環境変数; PYTHONUOPS <4>:              Core and Builtins<63>.
                                                             (line  381)
* 環境変数; PYTHONUSERBASE:              PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* 環境変数; PYTHONUSERBASE <1>:          環境変数.           (line  204)
* 環境変数; PYTHONUSERBASE <2>:          モジュールの内容<6>.
                                                             (line   41)
* 環境変数; PYTHONUSERBASE <3>:          モジュールの内容<6>.
                                                             (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  323)
* 環境変数; PYTHONUTF8 <2>:              環境変数.           (line  421)
* 環境変数; PYTHONUTF8 <3>:              環境変数.           (line  440)
* 環境変数; PYTHONUTF8 <4>:              UTF-8 モード.       (line   18)
* 環境変数; PYTHONUTF8 <5>:              Python UTF-8 Mode.  (line   51)
* 環境変数; PYTHONUTF8 <6>:              Python UTF-8 Mode.  (line   53)
* 環境変数; PYTHONUTF8 <7>:              sys --- システム固有のパラメーターと関数.
                                                             (line 1994)
* 環境変数; PYTHONUTF8 <8>:              PyPreConfig.        (line  152)
* 環境変数; PYTHONUTF8 <9>:              Python Configuration.
                                                             (line   14)
* 環境変数; PYTHONVERBOSE:               その他のオプション. (line  195)
* 環境変数; PYTHONVERBOSE <1>:           環境変数.           (line  124)
* 環境変数; PYTHONVERBOSE <2>:           グローバルな設定変数.
                                                             (line  256)
* 環境変数; PYTHONVERBOSE <3>:           PyConfig.           (line  969)
* 環境変数; PYTHONWARNDEFAULTENCODING:   Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* 環境変数; PYTHONWARNDEFAULTENCODING <1>: ライブラリ<125>.  (line   45)
* 環境変数; PYTHONWARNDEFAULTENCODING <2>: その他のオプション.
                                                             (line  335)
* 環境変数; PYTHONWARNDEFAULTENCODING <3>: 環境変数.         (line  451)
* 環境変数; PYTHONWARNDEFAULTENCODING <4>: Opt-in EncodingWarning.
                                                             (line    9)
* 環境変数; PYTHONWARNINGS:              warnings<3>.        (line   21)
* 環境変数; PYTHONWARNINGS <1>:          その他の言語変更<12>.
                                                             (line  157)
* 環境変数; PYTHONWARNINGS <2>:          Deprecation Warnings の扱いの変更.
                                                             (line   23)
* 環境変数; PYTHONWARNINGS <3>:          インタプリタの変更. (line    6)
* 環境変数; PYTHONWARNINGS <4>:          ドキュメント<31>.   (line   67)
* 環境変数; PYTHONWARNINGS <5>:          その他のオプション. (line  249)
* 環境変数; PYTHONWARNINGS <6>:          環境変数.           (line  222)
* 環境変数; 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  988)
* 環境変数; SOURCE_DATE_EPOCH:           zipfile.            (line   11)
* 環境変数; SOURCE_DATE_EPOCH <1>:       py_compile<3>.      (line    7)
* 環境変数; SOURCE_DATE_EPOCH <2>:       ライブラリ<166>.    (line  451)
* 環境変数; SOURCE_DATE_EPOCH <3>:       ビルド<71>.         (line   15)
* 環境変数; SOURCE_DATE_EPOCH <4>:       ZipFile objects.    (line  346)
* 環境変数; SOURCE_DATE_EPOCH <5>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   66)
* 環境変数; SOURCE_DATE_EPOCH <6>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* 環境変数; SOURCE_DATE_EPOCH <7>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   87)
* 環境変数; SOURCE_DATE_EPOCH <8>:       コマンドラインでの使用<9>.
                                                             (line   94)
* 環境変数; SSLKEYLOGFILE:               コンテキストの作成. (line   34)
* 環境変数; SSLKEYLOGFILE <1>:           コンテキストの作成. (line   83)
* 環境変数; TEMP:                        tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  327)
* 環境変数; TERM:                        関数<6>.            (line  511)
* 環境変数; TERM <1>:                    関数<6>.            (line  540)
* 環境変数; TMP:                         tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  329)
* 環境変数; TMPDIR:                      ライブラリ<27>.     (line   79)
* 環境変数; TMPDIR <1>:                  テスト<31>.         (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  258)
* 環境変数; USERNAME <2>:                getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* 環境変数; USERPROFILE:                 os path<5>.         (line   14)
* 環境変数; USERPROFILE <1>:             Python API の変更<6>.
                                                             (line  117)
* 環境変数; USERPROFILE <2>:             Windows<50>.        (line   15)
* 環境変数; USERPROFILE <3>:             os path --- 一般的なパス名操作.
                                                             (line  155)
* 環境変数;削除:                         プロセスのパラメーター.
                                                             (line  631)
* 環境変数;設定:                         プロセスのパラメーター.
                                                             (line  371)
* 監査イベント:                          Debugging and Profiling.
                                                             (line   11)
* 直列化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 真理値;value:                          真理値判定.         (line    6)
* 空の;list:                             リスト表示.         (line    6)
* 空の;tuple:                            変更不能なシーケンス immutable sequence.
                                                             (line   35)
* 空の;tuple <1>:                        Parenthesized forms.
                                                             (line   16)
* 空白:                                  インデント.         (line    6)
* 空白;in printf-style formatting:       printf 形式の文字列書式化.
                                                             (line   68)
* 空白;in printf-style formatting <1>:   printf 形式での bytes の書式化.
                                                             (line   61)
* 空白;文字列のフォーマットで:           Format specification mini-language.
                                                             (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  137)
* 組み込み関数;__import__:               モジュールのインポート<2>.
                                                             (line   30)
* 組み込み関数;abs:                      数値型をエミュレートする.
                                                             (line  118)
* 組み込み関数;abs <1>:                  数値型プロトコル number protocol.
                                                             (line   92)
* 組み込み関数;ascii:                    オブジェクトプロトコル object protocol.
                                                             (line  340)
* 組み込み関数;bytes:                    基本的なカスタマイズ.
                                                             (line  144)
* 組み込み関数;bytes <1>:                オブジェクトプロトコル object protocol.
                                                             (line  364)
* 組み込み関数;call:                     呼び出し call.      (line  137)
* 組み込み関数;chr:                      変更不能なシーケンス immutable sequence.
                                                             (line   16)
* 組み込み関数;divmod:                   数値型をエミュレートする.
                                                             (line   26)
* 組み込み関数;divmod <1>:               数値型をエミュレートする.
                                                             (line   56)
* 組み込み関数;divmod <2>:               数値型プロトコル number protocol.
                                                             (line   66)
* 組み込み関数;eval:                     global 文.          (line   23)
* 組み込み関数;eval <1>:                 式入力.             (line    6)
* 組み込み関数;eval <2>:                 コードオブジェクト<2>.
                                                             (line   17)
* 組み込み関数;eval <3>:                 関数<4>.            (line   84)
* 組み込み関数;eval <4>:                 PrettyPrinter オブジェクト.
                                                             (line   67)
* 組み込み関数;exec:                     global 文.          (line   23)
* 組み込み関数;exec <1>:                 組み込み関数.       (line  627)
* 組み込み関数;exec <2>:                 コードオブジェクト<2>.
                                                             (line   17)
* 組み込み関数;hash:                     基本的なカスタマイズ.
                                                             (line  236)
* 組み込み関数;hash <1>:                 イミュータブルなシーケンス型.
                                                             (line    6)
* 組み込み関数;hash <2>:                 オブジェクトプロトコル object protocol.
                                                             (line  419)
* 組み込み関数;hash <3>:                 PyTypeObject スロット.
                                                             (line  453)
* 組み込み関数;help:                     Operating system interface.
                                                             (line   20)
* 組み込み関数;id:                       オブジェクト、値、および型.
                                                             (line   10)
* 組み込み関数;int:                      数値型をエミュレートする.
                                                             (line  125)
* 組み込み関数;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>:                  Mapping Types --- dict.
                                                             (line    6)
* 組み込み関数;len <6>:                  オブジェクトプロトコル object protocol.
                                                             (line  464)
* 組み込み関数;len <7>:                  シーケンス型プロトコル sequence protocol.
                                                             (line   16)
* 組み込み関数;len <8>:                  マップ型プロトコル mapping protocol.
                                                             (line   19)
* 組み込み関数;len <9>:                  リストオブジェクト. (line   42)
* 組み込み関数;len <10>:                 Dictionary Objects. (line  299)
* 組み込み関数;len <11>:                 Set オブジェクト.   (line  107)
* 組み込み関数;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   56)
* 組み込み関数;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   93)
* 組み込み関数;repr <2>:                 オブジェクトプロトコル object protocol.
                                                             (line  327)
* 組み込み関数;repr <3>:                 PyTypeObject スロット.
                                                             (line  387)
* 組み込み関数;round:                    数値型をエミュレートする.
                                                             (line  148)
* 組み込み関数;slice:                    スライス slice オブジェクト.
                                                             (line    6)
* 組み込み関数;slice <1>:                Python バイトコード命令.
                                                             (line 1190)
* 組み込み関数;tuple:                    シーケンス型プロトコル sequence protocol.
                                                             (line  120)
* 組み込み関数;tuple <1>:                リストオブジェクト. (line  212)
* 組み込み関数;type:                     オブジェクト、値、および型.
                                                             (line   10)
* 組み込み関数;type <1>:                 メタクラス.         (line    6)
* 組み込み関数;type <2>:                 型オブジェクト.     (line    6)
* 組み込み関数;type <3>:                 オブジェクトプロトコル object protocol.
                                                             (line  446)
* 組み込み関数;クラスメソッド:           Implementing functions and methods.
                                                             (line  194)
* 組み込み関数;コンパイル:               global 文.          (line   23)
* 組み込み関数;コンパイル <1>:           コードオブジェクト<2>.
                                                             (line    6)
* 組み込み関数;コンパイル <2>:           標準的なインタプリタ型.
                                                             (line   57)
* 組み込み関数;コンパイル <3>:           モジュールのインポート<2>.
                                                             (line  129)
* 組み込み関数;浮動小数点数:             数値型をエミュレートする.
                                                             (line  125)
* 組み込み関数;浮動小数点数 <1>:         数値型 int float complex.
                                                             (line   27)
* 組み込み関数;浮動小数点数 <2>:         数値型プロトコル number protocol.
                                                             (line  245)
* 組み込み関数;複素数:                   数値型をエミュレートする.
                                                             (line  125)
* 組み込み関数;複素数 <1>:               数値型 int float complex.
                                                             (line   27)
* 組み込み関数;静的メソッド:             Implementing functions and methods.
                                                             (line  202)
* 結合;演算:                             共通のシーケンス演算.
                                                             (line   18)
* 繰り返し;演算:                         共通のシーケンス演算.
                                                             (line   18)
* 自由;variable:                         名前の束縛.         (line   46)
* 虚数リテラル:                          数値リテラル.       (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  671)
* 関数;annotations:                      関数のアノテーション.
                                                             (line    6)
* 関数;annotations <1>:                  関数定義.           (line  106)
* 関数;call:                             呼び出し可能型 callable type.
                                                             (line    6)
* 関数;call <1>:                         呼び出し call.      (line  127)
* 関数;call <2>:                         呼び出し call.      (line  137)
* 関数;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: 13c547
Node: What's New in Python312458
Ref: whatsnew/index doc312567
Ref: 13d312567
Ref: whatsnew/index python-documentation-contents312567
Ref: 13e312567
Ref: whatsnew/index what-s-new-in-python312567
Ref: 13f312567
Ref: whatsnew/index whatsnew-index312567
Ref: 140312567
Node: What's new in Python 3 14314159
Ref: whatsnew/3 14 doc314275
Ref: 141314275
Ref: whatsnew/3 14 what-s-new-in-python-3-14314275
Ref: 142314275
Ref: What's new in Python 3 14-Footnote-1315186
Node: 概要 -- リリースハイライト315228
Ref: whatsnew/3 14 summary-release-highlights315351
Ref: 144315351
Ref: 概要 -- リリースハイライト-Footnote-1319019
Ref: 概要 -- リリースハイライト-Footnote-2319061
Ref: 概要 -- リリースハイライト-Footnote-3319103
Ref: 概要 -- リリースハイライト-Footnote-4319145
Ref: 概要 -- リリースハイライト-Footnote-5319187
Ref: 概要 -- リリースハイライト-Footnote-6319229
Ref: 概要 -- リリースハイライト-Footnote-7319271
Ref: 概要 -- リリースハイライト-Footnote-8319313
Ref: 概要 -- リリースハイライト-Footnote-9319355
Ref: 概要 -- リリースハイライト-Footnote-10319397
Ref: 概要 -- リリースハイライト-Footnote-11319440
Ref: 概要 -- リリースハイライト-Footnote-12319490
Ref: 概要 -- リリースハイライト-Footnote-13319533
Node: 新しい機能319576
Ref: whatsnew/3 14 new-features319730
Ref: 15b319730
Node: PEP 649 と PEP 749 アノテーションの遅延評価320570
Ref: whatsnew/3 14 pep-649-pep-749-deferred-evaluation-of-annotations320761
Ref: 15c320761
Ref: whatsnew/3 14 whatsnew314-deferred-annotations320761
Ref: 146320761
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-1323300
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-2323342
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-3323398
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-4323440
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-5323482
Node: PEP 734 複数インタープリタ機能が標準ライブラリに追加323524
Ref: whatsnew/3 14 pep-734-multiple-interpreters-in-the-standard-library323771
Ref: 163323771
Ref: whatsnew/3 14 whatsnew314-multiple-interpreters323771
Ref: 147323771
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-1329291
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-2329333
Ref: PEP 734 複数インタープリタ機能が標準ライブラリに追加-Footnote-3329389
Node: PEP 750 テンプレート文字列リテラル329431
Ref: whatsnew/3 14 pep-750-template-string-literals329681
Ref: 169329681
Ref: whatsnew/3 14 whatsnew314-template-string-literals329681
Ref: 145329681
Ref: PEP 750 テンプレート文字列リテラル-Footnote-1333083
Ref: PEP 750 テンプレート文字列リテラル-Footnote-2333139
Node: PEP 768 安全な外部デバッガインターフェース333181
Ref: whatsnew/3 14 pep-768-safe-external-debugger-interface333387
Ref: 16d333387
Ref: whatsnew/3 14 whatsnew314-remote-debugging333387
Ref: 14f333387
Ref: PEP 768 安全な外部デバッガインターフェース-Footnote-1335922
Ref: PEP 768 安全な外部デバッガインターフェース-Footnote-2335978
Node: 新しいインタープリタ336020
Ref: whatsnew/3 14 a-new-type-of-interpreter336210
Ref: 172336210
Ref: whatsnew/3 14 whatsnew314-tail-call-interpreter336210
Ref: 150336210
Ref: 新しいインタープリタ-Footnote-1338146
Ref: 新しいインタープリタ-Footnote-2338194
Node: Free-threaded mode improvements338250
Ref: whatsnew/3 14 free-threaded-mode-improvements338414
Ref: 174338414
Ref: whatsnew/3 14 whatsnew314-free-threaded-cpython338414
Ref: 151338414
Ref: Free-threaded mode improvements-Footnote-1340738
Ref: Free-threaded mode improvements-Footnote-2340780
Node: エラーメッセージの改善340822
Ref: whatsnew/3 14 improved-error-messages341005
Ref: 17b341005
Ref: whatsnew/3 14 whatsnew314-improved-error-messages341005
Ref: 152341005
Ref: エラーメッセージの改善-Footnote-1345604
Ref: エラーメッセージの改善-Footnote-2345660
Ref: エラーメッセージの改善-Footnote-3345716
Ref: エラーメッセージの改善-Footnote-4345772
Ref: エラーメッセージの改善-Footnote-5345827
Ref: エラーメッセージの改善-Footnote-6345883
Ref: エラーメッセージの改善-Footnote-7345939
Ref: エラーメッセージの改善-Footnote-8345995
Ref: エラーメッセージの改善-Footnote-9346051
Ref: エラーメッセージの改善-Footnote-10346107
Node: PEP 784 Zstandard support in the standard library346164
Ref: whatsnew/3 14 pep-784-zstandard-support-in-the-standard-library346350
Ref: 188346350
Ref: whatsnew/3 14 whatsnew314-zstandard346350
Ref: 149346350
Ref: PEP 784 Zstandard support in the standard library-Footnote-1347991
Ref: PEP 784 Zstandard support in the standard library-Footnote-2348032
Ref: PEP 784 Zstandard support in the standard library-Footnote-3348088
Node: Asyncio introspection capabilities348130
Ref: whatsnew/3 14 asyncio-introspection-capabilities348315
Ref: 189348315
Ref: whatsnew/3 14 whatsnew314-asyncio-introspection348315
Ref: 148348315
Ref: Asyncio introspection capabilities-Footnote-1353950
Node: Concurrent safe warnings control354005
Ref: whatsnew/3 14 concurrent-safe-warnings-control354132
Ref: 18a354132
Ref: whatsnew/3 14 whatsnew314-concurrent-warnings-control354132
Ref: 154354132
Ref: Concurrent safe warnings control-Footnote-1354808
Node: Other language changes354864
Ref: whatsnew/3 14 other-language-changes355005
Ref: 18c355005
Ref: Other language changes-Footnote-1356493
Ref: Other language changes-Footnote-2356549
Ref: Other language changes-Footnote-3356604
Ref: Other language changes-Footnote-4356660
Ref: Other language changes-Footnote-5356716
Node: Built-ins356772
Ref: whatsnew/3 14 built-ins356879
Ref: 190356879
Ref: Built-ins-Footnote-1359057
Ref: Built-ins-Footnote-2359113
Ref: Built-ins-Footnote-3359168
Ref: Built-ins-Footnote-4359223
Ref: Built-ins-Footnote-5359279
Ref: Built-ins-Footnote-6359335
Ref: Built-ins-Footnote-7359391
Ref: Built-ins-Footnote-8359447
Ref: Built-ins-Footnote-9359503
Node: コマンドラインと環境359559
Ref: whatsnew/3 14 command-line-and-environment359736
Ref: 1a8359736
Ref: コマンドラインと環境-Footnote-1360645
Ref: コマンドラインと環境-Footnote-2360701
Ref: コマンドラインと環境-Footnote-3360757
Ref: コマンドラインと環境-Footnote-4360789
Node: PEP 758 Allow except and except* expressions without brackets360845
Ref: whatsnew/3 14 pep-758-allow-except-and-except-expressions-without-brackets361051
Ref: 1ab361051
Ref: whatsnew/3 14 whatsnew314-bracketless-except361051
Ref: 14d361051
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-1361649
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-2361691
Node: PEP 765 Control flow in finally blocks361747
Ref: whatsnew/3 14 pep-765-control-flow-in-finally-blocks361941
Ref: 1ae361941
Ref: whatsnew/3 14 whatsnew314-finally-syntaxwarning361941
Ref: 14e361941
Ref: whatsnew/3 14 incremental-garbage-collection363095
Ref: 1b3363095
Ref: PEP 765 Control flow in finally blocks-Footnote-1363133
Ref: PEP 765 Control flow in finally blocks-Footnote-2363175
Node: Garbage collection363231
Ref: whatsnew/3 14 garbage-collection363389
Ref: 1b4363389
Ref: whatsnew/3 14 whatsnew314-incremental-gc363389
Ref: 153363389
Ref: Garbage collection-Footnote-1364582
Ref: Garbage collection-Footnote-2364638
Node: Default interactive shell364694
Ref: whatsnew/3 14 default-interactive-shell364805
Ref: 1b6364805
Ref: whatsnew/3 14 whatsnew314-pyrepl-highlighting364874
Ref: 155364874
Ref: Default interactive shell-Footnote-1366143
Ref: Default interactive shell-Footnote-2366199
Node: 新しいモジュール366254
Ref: whatsnew/3 14 new-modules366396
Ref: 1bb366396
Ref: 新しいモジュール-Footnote-1367578
Ref: 新しいモジュール-Footnote-2367634
Ref: 新しいモジュール-Footnote-3367690
Ref: 新しいモジュール-Footnote-4367746
Node: Improved modules367802
Ref: whatsnew/3 14 improved-modules367931
Ref: 1bc367931
Node: argparse368804
Ref: whatsnew/3 14 argparse368877
Ref: 1bd368877
Ref: argparse-Footnote-1369750
Ref: argparse-Footnote-2369805
Ref: argparse-Footnote-3369861
Node: ast369917
Ref: whatsnew/3 14 ast370006
Ref: 1c0370006
Ref: ast-Footnote-1370970
Ref: ast-Footnote-2371025
Ref: ast-Footnote-3371081
Ref: ast-Footnote-4371137
Ref: ast-Footnote-5371193
Ref: ast-Footnote-6371249
Node: asyncio371305
Ref: whatsnew/3 14 asyncio371394
Ref: 1c8371394
Ref: asyncio-Footnote-1372525
Ref: asyncio-Footnote-2372581
Node: calendar372636
Ref: whatsnew/3 14 calendar372740
Ref: 1d0372740
Ref: whatsnew/3 14 whatsnew314-color-calendar372775
Ref: 1d1372775
Ref: calendar-Footnote-1373058
Node: concurrent futures373114
Ref: whatsnew/3 14 concurrent-futures373223
Ref: 1d3373223
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-interp-pool373278
Ref: 168373278
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-start-method373701
Ref: 1d5373701
Ref: concurrent futures-Footnote-1375169
Ref: concurrent futures-Footnote-2375225
Ref: concurrent futures-Footnote-3375280
Ref: concurrent futures-Footnote-4375336
Node: configparser375391
Ref: whatsnew/3 14 configparser375503
Ref: 1df375503
Ref: configparser-Footnote-1375898
Node: contextvars375954
Ref: whatsnew/3 14 contextvars376054
Ref: 1e2376054
Ref: contextvars-Footnote-1376272
Node: ctypes376328
Ref: whatsnew/3 14 ctypes376422
Ref: 1e5376422
Ref: ctypes-Footnote-1378900
Ref: ctypes-Footnote-2378955
Ref: ctypes-Footnote-3379010
Ref: ctypes-Footnote-4379066
Ref: ctypes-Footnote-5379122
Ref: ctypes-Footnote-6379178
Ref: ctypes-Footnote-7379234
Ref: ctypes-Footnote-8379289
Ref: ctypes-Footnote-9379345
Ref: ctypes-Footnote-10379401
Ref: ctypes-Footnote-11379458
Node: curses379515
Ref: whatsnew/3 14 curses379606
Ref: 1f7379606
Ref: curses-Footnote-1379908
Node: datetime379964
Ref: whatsnew/3 14 datetime380056
Ref: 1fa380056
Ref: datetime-Footnote-1380305
Node: decimal380360
Ref: whatsnew/3 14 decimal380453
Ref: 1fe380453
Ref: decimal-Footnote-1380883
Ref: decimal-Footnote-2380939
Node: difflib380994
Ref: whatsnew/3 14 difflib381082
Ref: 202381082
Ref: difflib-Footnote-1381325
Node: dis381381
Ref: whatsnew/3 14 dis381467
Ref: 204381467
Ref: dis-Footnote-1382191
Ref: dis-Footnote-2382247
Node: errno382303
Ref: whatsnew/3 14 errno382394
Ref: 20c382394
Ref: errno-Footnote-1382568
Node: faulthandler382624
Ref: whatsnew/3 14 faulthandler382719
Ref: 20e382719
Ref: faulthandler-Footnote-1383065
Node: fnmatch383121
Ref: whatsnew/3 14 fnmatch383220
Ref: 212383220
Ref: fnmatch-Footnote-1383435
Node: fractions383490
Ref: whatsnew/3 14 fractions383586
Ref: 214383586
Ref: fractions-Footnote-1384001
Ref: fractions-Footnote-2384056
Node: functools384112
Ref: whatsnew/3 14 functools384207
Ref: 217384207
Ref: functools-Footnote-1384737
Ref: functools-Footnote-2384793
Node: getopt384849
Ref: whatsnew/3 14 getopt384942
Ref: 21d384942
Ref: getopt-Footnote-1385271
Ref: getopt-Footnote-2385327
Node: getpass385383
Ref: whatsnew/3 14 getpass385475
Ref: 21e385475
Ref: getpass-Footnote-1385846
Node: graphlib385901
Ref: whatsnew/3 14 graphlib385992
Ref: 220385992
Ref: graphlib-Footnote-1386238
Node: heapq386294
Ref: whatsnew/3 14 heapq386382
Ref: 222386382
Node: hmac386723
Ref: whatsnew/3 14 hmac386807
Ref: 228386807
Ref: hmac-Footnote-1387159
Ref: hmac-Footnote-2387218
Ref: hmac-Footnote-3387266
Node: http387321
Ref: whatsnew/3 14 http387407
Ref: 229387407
Ref: http-Footnote-1388268
Ref: http-Footnote-2388324
Node: imaplib388379
Ref: whatsnew/3 14 imaplib388468
Ref: 22e388468
Ref: imaplib-Footnote-1388689
Ref: imaplib-Footnote-2388748
Node: inspect388803
Ref: whatsnew/3 14 inspect388890
Ref: 230388890
Ref: inspect-Footnote-1389568
Ref: inspect-Footnote-2389624
Ref: inspect-Footnote-3389680
Node: io389736
Ref: whatsnew/3 14 io389820
Ref: 236389820
Ref: io-Footnote-1390360
Ref: io-Footnote-2390416
Node: json390472
Ref: whatsnew/3 14 json390558
Ref: 23d390558
Ref: json-Footnote-1391344
Ref: json-Footnote-2391400
Ref: json-Footnote-3391456
Node: linecache391512
Ref: whatsnew/3 14 linecache391612
Ref: 241391612
Ref: linecache-Footnote-1391813
Node: logging handlers391869
Ref: whatsnew/3 14 logging-handlers391969
Ref: 243391969
Ref: logging handlers-Footnote-1392388
Ref: logging handlers-Footnote-2392444
Node: math392500
Ref: whatsnew/3 14 math392600
Ref: 247392600
Ref: math-Footnote-1392819
Node: mimetypes392875
Ref: whatsnew/3 14 mimetypes392974
Ref: 248392974
Ref: mimetypes-Footnote-1396261
Ref: mimetypes-Footnote-2396316
Ref: mimetypes-Footnote-3396375
Ref: mimetypes-Footnote-4396434
Ref: mimetypes-Footnote-5396493
Ref: mimetypes-Footnote-6396552
Ref: mimetypes-Footnote-7396611
Ref: mimetypes-Footnote-8396670
Ref: mimetypes-Footnote-9396729
Ref: mimetypes-Footnote-10396788
Ref: mimetypes-Footnote-11396848
Ref: mimetypes-Footnote-12396908
Ref: mimetypes-Footnote-13396968
Ref: mimetypes-Footnote-14397028
Ref: mimetypes-Footnote-15397088
Ref: mimetypes-Footnote-16397148
Ref: mimetypes-Footnote-17397236
Ref: mimetypes-Footnote-18397336
Ref: mimetypes-Footnote-19397391
Ref: mimetypes-Footnote-20397447
Ref: mimetypes-Footnote-21397504
Ref: mimetypes-Footnote-22397560
Ref: mimetypes-Footnote-23397616
Node: multiprocessing397673
Ref: whatsnew/3 14 multiprocessing397776
Ref: 24a397776
Ref: whatsnew/3 14 whatsnew314-multiprocessing-start-method397827
Ref: 24b397827
Ref: multiprocessing-Footnote-1399945
Ref: multiprocessing-Footnote-2400000
Ref: multiprocessing-Footnote-3400055
Ref: multiprocessing-Footnote-4400111
Ref: multiprocessing-Footnote-5400167
Node: operator400223
Ref: whatsnew/3 14 operator400319
Ref: 256400319
Ref: operator-Footnote-1400715
Node: os400771
Ref: whatsnew/3 14 os400859
Ref: 259400859
Ref: os-Footnote-1401568
Ref: os-Footnote-2401624
Ref: os-Footnote-3401680
Node: os path401736
Ref: whatsnew/3 14 os-path401823
Ref: 263401823
Ref: os path-Footnote-1402214
Node: pathlib402269
Ref: whatsnew/3 14 pathlib402357
Ref: 267402357
Ref: pathlib-Footnote-1403345
Ref: pathlib-Footnote-2403400
Node: pdb403456
Ref: whatsnew/3 14 pdb403543
Ref: 271403543
Ref: pdb-Footnote-1406695
Ref: pdb-Footnote-2406751
Ref: pdb-Footnote-3406807
Ref: pdb-Footnote-4406863
Ref: pdb-Footnote-5406919
Ref: pdb-Footnote-6406975
Ref: pdb-Footnote-7407031
Ref: pdb-Footnote-8407087
Ref: pdb-Footnote-9407143
Ref: pdb-Footnote-10407199
Node: pickle407256
Ref: whatsnew/3 14 pickle407360
Ref: 27c407360
Ref: pickle-Footnote-1407731
Node: プラットフォーム407787
Ref: whatsnew/3 14 platform407893
Ref: 27e407893
Ref: プラットフォーム-Footnote-1408163
Node: pydoc408219
Ref: whatsnew/3 14 pydoc408321
Ref: 280408321
Ref: pydoc-Footnote-1408570
Node: re408626
Ref: whatsnew/3 14 re408710
Ref: 281408710
Ref: re-Footnote-1409251
Ref: re-Footnote-2409307
Node: socket409363
Ref: whatsnew/3 14 socket409445
Ref: 282409445
Ref: socket-Footnote-1410682
Ref: socket-Footnote-2410738
Ref: socket-Footnote-3410794
Ref: socket-Footnote-4410849
Ref: socket-Footnote-5410905
Ref: socket-Footnote-6410960
Ref: socket-Footnote-7411016
Ref: socket-Footnote-8411072
Node: ssl411128
Ref: whatsnew/3 14 ssl411214
Ref: 287411214
Ref: ssl-Footnote-1411484
Node: struct411540
Ref: whatsnew/3 14 struct411628
Ref: 289411628
Ref: struct-Footnote-1411919
Node: symtable411975
Ref: whatsnew/3 14 symtable412063
Ref: 28a412063
Ref: symtable-Footnote-1412362
Node: sys412418
Ref: whatsnew/3 14 sys412514
Ref: 28f412514
Ref: sys-Footnote-1413809
Ref: sys-Footnote-2413865
Ref: sys-Footnote-3413921
Ref: sys-Footnote-4413977
Ref: sys-Footnote-5414033
Node: sys monitoring414089
Ref: whatsnew/3 14 sys-monitoring414186
Ref: 296414186
Ref: sys monitoring-Footnote-1414471
Node: sysconfig414527
Ref: whatsnew/3 14 sysconfig414628
Ref: 299414628
Ref: sysconfig-Footnote-1414827
Node: tarfile414883
Ref: whatsnew/3 14 tarfile414979
Ref: 29b414979
Ref: tarfile-Footnote-1416081
Ref: tarfile-Footnote-2416137
Ref: tarfile-Footnote-3416192
Ref: tarfile-Footnote-4416248
Ref: tarfile-Footnote-5416304
Ref: tarfile-Footnote-6416359
Ref: tarfile-Footnote-7416415
Ref: tarfile-Footnote-8416471
Node: threading416526
Ref: whatsnew/3 14 threading416620
Ref: 2a1416620
Ref: threading-Footnote-1416876
Node: tkinter416931
Ref: whatsnew/3 14 tkinter417024
Ref: 2a3417024
Ref: tkinter-Footnote-1417416
Ref: tkinter-Footnote-2417472
Node: turtle417528
Ref: whatsnew/3 14 turtle417617
Ref: 2a4417617
Ref: turtle-Footnote-1417892
Node: types417948
Ref: whatsnew/3 14 types418036
Ref: 2a8418036
Ref: types-Footnote-1418283
Node: typing418339
Ref: whatsnew/3 14 typing418432
Ref: 2ac418432
Ref: whatsnew/3 14 whatsnew314-typing-union418465
Ref: 2ab418465
Ref: typing-Footnote-1421517
Ref: typing-Footnote-2421559
Node: unicodedata421615
Ref: whatsnew/3 14 unicodedata421711
Ref: 2b1421711
Node: unittest421817
Ref: whatsnew/3 14 unittest421913
Ref: 2b2421913
Ref: whatsnew/3 14 whatsnew314-color-unittest421950
Ref: 2b3421950
Ref: unittest-Footnote-1423116
Ref: unittest-Footnote-2423172
Ref: unittest-Footnote-3423227
Node: urllib423282
Ref: whatsnew/3 14 urllib423371
Ref: 2be423371
Ref: urllib-Footnote-1424837
Ref: urllib-Footnote-2424896
Ref: urllib-Footnote-3424952
Node: uuid425008
Ref: whatsnew/3 14 uuid425099
Ref: 2c3425099
Ref: uuid-Footnote-1425740
Ref: uuid-Footnote-2425799
Ref: uuid-Footnote-3425854
Ref: uuid-Footnote-4425913
Ref: uuid-Footnote-5425969
Node: webbrowser426025
Ref: whatsnew/3 14 webbrowser426117
Ref: 2ca426117
Node: zipfile426469
Ref: whatsnew/3 14 zipfile426548
Ref: 2cb426548
Ref: zipfile-Footnote-1427042
Ref: zipfile-Footnote-2427098
Node: 最適化427153
Ref: whatsnew/3 14 optimizations427264
Ref: 2cf427264
Ref: 最適化-Footnote-1428516
Node: asyncio<2>428572
Ref: whatsnew/3 14 id2428643
Ref: 2d3428643
Ref: asyncio<2>-Footnote-1429399
Ref: asyncio<2>-Footnote-2429455
Node: base64429511
Ref: whatsnew/3 14 base64429594
Ref: 2d4429594
Ref: base64-Footnote-1429817
Node: bdb429873
Ref: whatsnew/3 14 bdb429956
Ref: 2d6429956
Ref: bdb-Footnote-1430265
Node: difflib<2>430321
Ref: whatsnew/3 14 id3430400
Ref: 2d8430400
Ref: difflib<2>-Footnote-1430611
Node: gc430667
Ref: whatsnew/3 14 gc430748
Ref: 2da430748
Ref: gc-Footnote-1432726
Ref: gc-Footnote-2432782
Node: io<2>432838
Ref: whatsnew/3 14 id4432919
Ref: 2df432919
Ref: io<2>-Footnote-1433215
Ref: io<2>-Footnote-2433271
Node: pathlib<2>433326
Ref: whatsnew/3 14 id5433411
Ref: 2e0433411
Ref: pathlib<2>-Footnote-1433664
Node: pdb<2>433720
Ref: whatsnew/3 14 id6433808
Ref: 2e2433808
Ref: pdb<2>-Footnote-1434319
Node: textwrap434375
Ref: whatsnew/3 14 textwrap434460
Ref: 2e5434460
Node: uuid<2>434761
Ref: whatsnew/3 14 id7434844
Ref: 2e6434844
Ref: uuid<2>-Footnote-1435264
Ref: uuid<2>-Footnote-2435320
Node: zlib435376
Ref: whatsnew/3 14 zlib435442
Ref: 2ea435442
Ref: zlib-Footnote-1436093
Ref: zlib-Footnote-2436136
Node: 削除436191
Ref: whatsnew/3 14 removed436295
Ref: 2eb436295
Node: argparse<2>436525
Ref: whatsnew/3 14 id8436594
Ref: 2ec436594
Ref: argparse<2>-Footnote-1437388
Ref: argparse<2>-Footnote-2437444
Node: ast<2>437500
Ref: whatsnew/3 14 id9437588
Ref: 2f0437588
Ref: ast<2>-Footnote-1438667
Ref: ast<2>-Footnote-2438723
Node: asyncio<3>438779
Ref: whatsnew/3 14 id10438861
Ref: 2f3438861
Ref: asyncio<3>-Footnote-1441666
Ref: asyncio<3>-Footnote-2441722
Node: email441778
Ref: whatsnew/3 14 email441867
Ref: 2f8441867
Ref: email-Footnote-1442128
Node: importlib abc442184
Ref: whatsnew/3 14 importlib-abc442272
Ref: 2fa442272
Ref: importlib abc-Footnote-1442700
Node: itertools442755
Ref: whatsnew/3 14 itertools442848
Ref: 2fd442848
Ref: itertools-Footnote-1443161
Node: pathlib<3>443217
Ref: whatsnew/3 14 id11443304
Ref: 2fe443304
Ref: pathlib<3>-Footnote-1443828
Ref: pathlib<3>-Footnote-2443883
Node: pkgutil443938
Ref: whatsnew/3 14 pkgutil444019
Ref: 301444019
Ref: pkgutil-Footnote-1444265
Node: pty444320
Ref: whatsnew/3 14 pty444398
Ref: 302444398
Ref: pty-Footnote-1444676
Node: sqlite3444732
Ref: whatsnew/3 14 sqlite3444812
Ref: 304444812
Ref: sqlite3-Footnote-1445400
Ref: sqlite3-Footnote-2445456
Ref: sqlite3-Footnote-3445512
Node: urllib<2>445568
Ref: whatsnew/3 14 id12445636
Ref: 308445636
Ref: urllib<2>-Footnote-1446348
Ref: urllib<2>-Footnote-2446404
Node: 非推奨446459
Ref: whatsnew/3 14 deprecated446589
Ref: 30c446589
Node: New deprecations447019
Ref: whatsnew/3 14 new-deprecations447120
Ref: 30d447120
Ref: New deprecations-Footnote-1453206
Ref: New deprecations-Footnote-2453262
Ref: New deprecations-Footnote-3453318
Ref: New deprecations-Footnote-4453373
Ref: New deprecations-Footnote-5453429
Ref: New deprecations-Footnote-6453485
Ref: New deprecations-Footnote-7453541
Ref: New deprecations-Footnote-8453597
Ref: New deprecations-Footnote-9453653
Ref: New deprecations-Footnote-10453709
Ref: New deprecations-Footnote-11453766
Ref: New deprecations-Footnote-12453822
Ref: New deprecations-Footnote-13453879
Ref: New deprecations-Footnote-14453936
Ref: New deprecations-Footnote-15453993
Ref: New deprecations-Footnote-16454036
Ref: New deprecations-Footnote-17454093
Ref: New deprecations-Footnote-18454150
Ref: New deprecations-Footnote-19454207
Ref: New deprecations-Footnote-20454264
Node: Pending removal in Python 3 15454321
Ref: whatsnew/3 14 pending-removal-in-python-3-15454461
Ref: 322454461
Ref: Pending removal in Python 3 15-Footnote-1458597
Ref: Pending removal in Python 3 15-Footnote-2458652
Ref: Pending removal in Python 3 15-Footnote-3458707
Ref: Pending removal in Python 3 15-Footnote-4458749
Ref: Pending removal in Python 3 15-Footnote-5458805
Node: Pending removal in Python 3 16458861
Ref: whatsnew/3 14 pending-removal-in-python-3-16459015
Ref: 338459015
Ref: Pending removal in Python 3 16-Footnote-1463256
Ref: Pending removal in Python 3 16-Footnote-2463312
Ref: Pending removal in Python 3 16-Footnote-3463368
Ref: Pending removal in Python 3 16-Footnote-4463424
Node: Pending removal in Python 3 17463479
Ref: whatsnew/3 14 pending-removal-in-python-3-17463633
Ref: 33f463633
Ref: Pending removal in Python 3 17-Footnote-1466567
Ref: Pending removal in Python 3 17-Footnote-2466625
Ref: Pending removal in Python 3 17-Footnote-3466680
Ref: Pending removal in Python 3 17-Footnote-4466738
Node: Pending removal in Python 3 18466793
Ref: whatsnew/3 14 pending-removal-in-python-3-18466947
Ref: 344466947
Ref: Pending removal in Python 3 18-Footnote-1467373
Node: Pending removal in Python 3 19467428
Ref: whatsnew/3 14 pending-removal-in-python-3-19467586
Ref: 345467586
Node: Pending removal in future versions467864
Ref: whatsnew/3 14 pending-removal-in-future-versions467983
Ref: 346467983
Ref: Pending removal in future versions-Footnote-1475170
Ref: Pending removal in future versions-Footnote-2475225
Ref: Pending removal in future versions-Footnote-3475281
Ref: Pending removal in future versions-Footnote-4475337
Ref: Pending removal in future versions-Footnote-5475393
Ref: Pending removal in future versions-Footnote-6475448
Ref: Pending removal in future versions-Footnote-7475503
Node: CPython バイトコードの変更475559
Ref: whatsnew/3 14 cpython-bytecode-changes475696
Ref: 363475696
Ref: CPython バイトコードの変更-Footnote-1477608
Ref: CPython バイトコードの変更-Footnote-2477664
Ref: CPython バイトコードの変更-Footnote-3477720
Ref: CPython バイトコードの変更-Footnote-4477776
Ref: CPython バイトコードの変更-Footnote-5477832
Ref: CPython バイトコードの変更-Footnote-6477888
Ref: CPython バイトコードの変更-Footnote-7477944
Node: Pseudo-instructions478000
Ref: whatsnew/3 14 pseudo-instructions478091
Ref: 36f478091
Ref: Pseudo-instructions-Footnote-1479730
Ref: Pseudo-instructions-Footnote-2479786
Ref: Pseudo-instructions-Footnote-3479842
Ref: Pseudo-instructions-Footnote-4479898
Ref: Pseudo-instructions-Footnote-5479954
Ref: Pseudo-instructions-Footnote-6480010
Ref: Pseudo-instructions-Footnote-7480066
Node: C API changes480122
Ref: whatsnew/3 14 c-api-changes480263
Ref: 375480263
Node: Python configuration C API480444
Ref: whatsnew/3 14 python-configuration-c-api480554
Ref: 376480554
Ref: whatsnew/3 14 whatsnew314-capi-config480554
Ref: 156480554
Ref: Python configuration C API-Footnote-1481879
Ref: Python configuration C API-Footnote-2481921
Ref: Python configuration C API-Footnote-3481963
Ref: Python configuration C API-Footnote-4482019
Ref: Python configuration C API-Footnote-5482061
Node: New features in the C API482103
Ref: whatsnew/3 14 new-features-in-the-c-api482243
Ref: 37c482243
Ref: New features in the C API-Footnote-1489394
Ref: New features in the C API-Footnote-2489450
Ref: New features in the C API-Footnote-3489506
Ref: New features in the C API-Footnote-4489562
Ref: New features in the C API-Footnote-5489618
Ref: New features in the C API-Footnote-6489674
Ref: New features in the C API-Footnote-7489730
Ref: New features in the C API-Footnote-8489786
Ref: New features in the C API-Footnote-9489842
Ref: New features in the C API-Footnote-10489898
Ref: New features in the C API-Footnote-11489955
Ref: New features in the C API-Footnote-12490012
Ref: New features in the C API-Footnote-13490055
Ref: New features in the C API-Footnote-14490112
Ref: New features in the C API-Footnote-15490169
Ref: New features in the C API-Footnote-16490226
Ref: New features in the C API-Footnote-17490283
Ref: New features in the C API-Footnote-18490340
Ref: New features in the C API-Footnote-19490397
Ref: New features in the C API-Footnote-20490454
Ref: New features in the C API-Footnote-21490511
Ref: New features in the C API-Footnote-22490577
Ref: New features in the C API-Footnote-23490634
Ref: New features in the C API-Footnote-24490677
Ref: New features in the C API-Footnote-25490734
Node: Limited C API changes490791
Ref: whatsnew/3 14 limited-c-api-changes490919
Ref: 3c6490919
Ref: Limited C API changes-Footnote-1491565
Ref: Limited C API changes-Footnote-2491621
Ref: Limited C API changes-Footnote-3491677
Node: Removed C APIs491732
Ref: whatsnew/3 14 removed-c-apis491852
Ref: 3cb491852
Ref: whatsnew/3 14 whatsnew314-c-api-removed491852
Ref: 3cc491852
Ref: Removed C APIs-Footnote-1492881
Ref: Removed C APIs-Footnote-2492937
Ref: Removed C APIs-Footnote-3492993
Ref: Removed C APIs-Footnote-4493035
Ref: Removed C APIs-Footnote-5493091
Ref: Removed C APIs-Footnote-6493147
Node: Deprecated C APIs493203
Ref: whatsnew/3 14 deprecated-c-apis493293
Ref: 3d1493293
Ref: whatsnew/3 14 whatsnew314-c-api-deprecated493293
Ref: 3d2493293
Ref: Deprecated C APIs-Footnote-1494917
Ref: Deprecated C APIs-Footnote-2494973
Ref: Deprecated C APIs-Footnote-3495029
Ref: Deprecated C APIs-Footnote-4495084
Node: Pending removal in Python 3 15<2>495140
Ref: whatsnew/3 14 id13495269
Ref: 3d8495269
Ref: Pending removal in Python 3 15<2>-Footnote-1501900
Ref: Pending removal in Python 3 15<2>-Footnote-2501953
Node: Pending removal in Python 3 16<2>502006
Ref: whatsnew/3 14 id14502177
Ref: 41d502177
Node: Pending removal in Python 3 18<2>502300
Ref: whatsnew/3 14 id15502475
Ref: 41e502475
Ref: Pending removal in Python 3 18<2>-Footnote-1505150
Ref: Pending removal in Python 3 18<2>-Footnote-2505203
Node: Pending removal in future versions<2>505259
Ref: whatsnew/3 14 id16505392
Ref: 424505392
Node: Build changes507231
Ref: whatsnew/3 14 build-changes507359
Ref: 440507359
Ref: whatsnew/3 14 whatsnew314-build-changes507359
Ref: 157507359
Ref: Build changes-Footnote-1509883
Ref: Build changes-Footnote-2509925
Ref: Build changes-Footnote-3509974
Ref: Build changes-Footnote-4510055
Ref: Build changes-Footnote-5510111
Ref: Build changes-Footnote-6510167
Ref: Build changes-Footnote-7510223
Ref: Build changes-Footnote-8510273
Ref: Build changes-Footnote-9510329
Ref: Build changes-Footnote-10510371
Ref: Build changes-Footnote-11510428
Ref: Build changes-Footnote-12510485
Ref: Build changes-Footnote-13510542
Ref: Build changes-Footnote-14510598
Ref: Build changes-Footnote-15510655
Node: build-details json510712
Ref: whatsnew/3 14 build-details-json510822
Ref: 445510822
Ref: whatsnew/3 14 whatsnew314-build-details510822
Ref: 446510822
Ref: build-details json-Footnote-1511571
Node: Discontinuation of PGP signatures511613
Ref: whatsnew/3 14 discontinuation-of-pgp-signatures511776
Ref: 448511776
Ref: whatsnew/3 14 whatsnew314-no-more-pgp511776
Ref: 159511776
Ref: Discontinuation of PGP signatures-Footnote-1512212
Ref: Discontinuation of PGP signatures-Footnote-2512272
Ref: Discontinuation of PGP signatures-Footnote-3512306
Node: Free-threaded Python is officially supported512348
Ref: whatsnew/3 14 free-threaded-python-is-officially-supported512551
Ref: 449512551
Ref: whatsnew/3 14 whatsnew314-free-threaded-now-supported512551
Ref: 158512551
Ref: Free-threaded Python is officially supported-Footnote-1513651
Ref: Free-threaded Python is officially supported-Footnote-2513694
Ref: Free-threaded Python is officially supported-Footnote-3513737
Ref: Free-threaded Python is officially supported-Footnote-4513779
Node: Binary releases for the experimental just-in-time compiler513826
Ref: whatsnew/3 14 binary-releases-for-the-experimental-just-in-time-compiler513987
Ref: 44a513987
Ref: whatsnew/3 14 whatsnew314-jit-compiler513987
Ref: 15a513987
Ref: Binary releases for the experimental just-in-time compiler-Footnote-1515525
Node: Porting to Python 3 14515567
Ref: whatsnew/3 14 porting-to-python-3-14515707
Ref: 14c515707
Node: Python API の変更516063
Ref: whatsnew/3 14 changes-in-the-python-api516193
Ref: 44f516193
Ref: Python API の変更-Footnote-1518587
Ref: Python API の変更-Footnote-2518643
Ref: Python API の変更-Footnote-3518698
Node: Changes in annotations PEP 649 and PEP 749518754
Ref: whatsnew/3 14 changes-in-annotations-pep-649-and-pep-749518908
Ref: 453518908
Ref: whatsnew/3 14 whatsnew314-porting-annotations518908
Ref: 162518908
Node: Implications for annotated code519473
Ref: whatsnew/3 14 implications-for-annotated-code519635
Ref: 454519635
Node: Implications for readers of __annotations__520426
Ref: whatsnew/3 14 implications-for-readers-of-annotations520612
Ref: 455520612
Ref: Implications for readers of __annotations__-Footnote-1521433
Node: Related changes521485
Ref: whatsnew/3 14 related-changes521674
Ref: 458521674
Node: from __future__ import annotations522718
Ref: whatsnew/3 14 from-future-import-annotations522855
Ref: 45a522855
Ref: from __future__ import annotations-Footnote-1523524
Node: C API の変更523566
Ref: whatsnew/3 14 changes-in-the-c-api523691
Ref: 45c523691
Ref: whatsnew/3 14 whatsnew314-refcount524622
Ref: 2d2524622
Ref: C API の変更-Footnote-1526818
Ref: C API の変更-Footnote-2526874
Ref: C API の変更-Footnote-3526930
Node: Notable changes in 3 14 1526983
Ref: whatsnew/3 14 notable-changes-in-3-14-1527135
Ref: 462527135
Ref: whatsnew/3 14 pythoncapi-compat-project527135
Ref: 463527135
Ref: Notable changes in 3 14 1-Footnote-1527539
Node: Notable changes in 3 14 5527595
Ref: whatsnew/3 14 notable-changes-in-3-14-5527716
Ref: 466527716
Node: gc<2>527806
Ref: whatsnew/3 14 id19527873
Ref: 467527873
Ref: gc<2>-Footnote-1528236
Node: What's New In Python 3 13528292
Ref: whatsnew/3 13 doc528442
Ref: 468528442
Ref: whatsnew/3 13 translation-repo528442
Ref: 469528442
Ref: whatsnew/3 13 what-s-new-in-python-3-13528442
Ref: 46a528442
Ref: What's New In Python 3 13-Footnote-1529352
Node: 概要 -- リリースハイライト<2>529394
Ref: whatsnew/3 13 summary-release-highlights529523
Ref: 46b529523
Ref: 概要 -- リリースハイライト<2>-Footnote-1538754
Ref: 概要 -- リリースハイライト<2>-Footnote-2538796
Ref: 概要 -- リリースハイライト<2>-Footnote-3538838
Ref: 概要 -- リリースハイライト<2>-Footnote-4538880
Ref: 概要 -- リリースハイライト<2>-Footnote-5538922
Ref: 概要 -- リリースハイライト<2>-Footnote-6538964
Ref: 概要 -- リリースハイライト<2>-Footnote-7539006
Ref: 概要 -- リリースハイライト<2>-Footnote-8539036
Ref: 概要 -- リリースハイライト<2>-Footnote-9539076
Ref: 概要 -- リリースハイライト<2>-Footnote-10539118
Ref: 概要 -- リリースハイライト<2>-Footnote-11539161
Ref: 概要 -- リリースハイライト<2>-Footnote-12539204
Ref: 概要 -- リリースハイライト<2>-Footnote-13539247
Ref: 概要 -- リリースハイライト<2>-Footnote-14539290
Ref: 概要 -- リリースハイライト<2>-Footnote-15539333
Ref: 概要 -- リリースハイライト<2>-Footnote-16539383
Ref: 概要 -- リリースハイライト<2>-Footnote-17539426
Ref: 概要 -- リリースハイライト<2>-Footnote-18539476
Ref: 概要 -- リリースハイライト<2>-Footnote-19539526
Node: 新しい機能<2>539569
Ref: whatsnew/3 13 new-features539731
Ref: 48f539731
Node: 改善された対話的インタープリタ540157
Ref: whatsnew/3 13 a-better-interactive-interpreter540302
Ref: 490540302
Ref: whatsnew/3 13 whatsnew313-better-interactive-interpreter540302
Ref: 46c540302
Ref: 改善された対話的インタープリタ-Footnote-1542217
Ref: 改善された対話的インタープリタ-Footnote-2542243
Node: エラーメッセージの改善<2>542299
Ref: whatsnew/3 13 improved-error-messages542485
Ref: 495542485
Ref: whatsnew/3 13 whatsnew313-improved-error-messages542485
Ref: 473542485
Ref: エラーメッセージの改善<2>-Footnote-1545392
Ref: エラーメッセージの改善<2>-Footnote-2545422
Ref: エラーメッセージの改善<2>-Footnote-3545455
Ref: エラーメッセージの改善<2>-Footnote-4545511
Ref: エラーメッセージの改善<2>-Footnote-5545566
Node: フリースレッドの CPython545622
Ref: whatsnew/3 13 free-threaded-cpython545808
Ref: 496545808
Ref: whatsnew/3 13 whatsnew313-free-threaded-cpython545808
Ref: 46d545808
Ref: フリースレッドの CPython-Footnote-1549969
Ref: フリースレッドの CPython-Footnote-2550011
Node: 実験的な Just-in-time JIT コンパイラ550064
Ref: whatsnew/3 13 an-experimental-just-in-time-jit-compiler550251
Ref: 49e550251
Ref: whatsnew/3 13 whatsnew313-jit-compiler550251
Ref: 46e550251
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-1552989
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-2553061
Node: Defined mutation semantics for locals553103
Ref: whatsnew/3 13 defined-mutation-semantics-for-locals553286
Ref: 4a0553286
Ref: whatsnew/3 13 whatsnew313-locals-semantics553286
Ref: 470553286
Ref: Defined mutation semantics for locals-Footnote-1555897
Ref: Defined mutation semantics for locals-Footnote-2555939
Ref: Defined mutation semantics for locals-Footnote-3555981
Node: Support for mobile platforms556036
Ref: whatsnew/3 13 support-for-mobile-platforms556165
Ref: 4a8556165
Ref: whatsnew/3 13 whatsnew313-platform-support556165
Ref: 48d556165
Ref: Support for mobile platforms-Footnote-1557206
Ref: Support for mobile platforms-Footnote-2557248
Ref: Support for mobile platforms-Footnote-3557290
Ref: Support for mobile platforms-Footnote-4557346
Ref: Support for mobile platforms-Footnote-5557388
Ref: Support for mobile platforms-Footnote-6557430
Ref: Support for mobile platforms-Footnote-7557486
Ref: Support for mobile platforms-Footnote-8557528
Node: その他の言語変更557570
Ref: whatsnew/3 13 other-language-changes557716
Ref: 4a9557716
Ref: その他の言語変更-Footnote-1562537
Ref: その他の言語変更-Footnote-2562592
Ref: その他の言語変更-Footnote-3562648
Ref: その他の言語変更-Footnote-4562704
Ref: その他の言語変更-Footnote-5562760
Ref: その他の言語変更-Footnote-6562816
Ref: その他の言語変更-Footnote-7562872
Ref: その他の言語変更-Footnote-8562921
Ref: その他の言語変更-Footnote-9562977
Ref: その他の言語変更-Footnote-10563032
Ref: その他の言語変更-Footnote-11563089
Ref: その他の言語変更-Footnote-12563146
Ref: その他の言語変更-Footnote-13563203
Ref: その他の言語変更-Footnote-14563260
Ref: その他の言語変更-Footnote-15563317
Ref: その他の言語変更-Footnote-16563374
Ref: その他の言語変更-Footnote-17563431
Ref: その他の言語変更-Footnote-18563487
Node: 新たなモジュール563544
Ref: whatsnew/3 13 new-modules563702
Ref: 4b9563702
Ref: 新たなモジュール-Footnote-1563944
Node: 改良されたモジュール564000
Ref: whatsnew/3 13 improved-modules564146
Ref: 4ba564146
Node: argparse<3>565095
Ref: whatsnew/3 13 argparse565188
Ref: 4bb565188
Ref: argparse<3>-Footnote-1565511
Node: 配列565566
Ref: whatsnew/3 13 array565674
Ref: 4bd565674
Ref: 配列-Footnote-1566110
Ref: 配列-Footnote-2566165
Node: ast<3>566221
Ref: whatsnew/3 13 ast566328
Ref: 4c1566328
Ref: ast<3>-Footnote-1567888
Ref: ast<3>-Footnote-2567944
Ref: ast<3>-Footnote-3568000
Ref: ast<3>-Footnote-4568056
Node: asyncio<4>568112
Ref: whatsnew/3 13 asyncio568222
Ref: 4c5568222
Ref: asyncio<4>-Footnote-1571982
Ref: asyncio<4>-Footnote-2572037
Ref: asyncio<4>-Footnote-3572093
Ref: asyncio<4>-Footnote-4572149
Ref: asyncio<4>-Footnote-5572205
Ref: asyncio<4>-Footnote-6572261
Ref: asyncio<4>-Footnote-7572316
Ref: asyncio<4>-Footnote-8572372
Ref: asyncio<4>-Footnote-9572428
Node: base64<2>572484
Ref: whatsnew/3 13 base64572598
Ref: 4d8572598
Ref: base64<2>-Footnote-1572893
Ref: base64<2>-Footnote-2572933
Node: compileall572988
Ref: whatsnew/3 13 compileall573113
Ref: 4d9573113
Ref: compileall-Footnote-1573405
Node: concurrent futures<2>573461
Ref: whatsnew/3 13 concurrent-futures573592
Ref: 4dc573592
Ref: concurrent futures<2>-Footnote-1573900
Node: configparser<2>573956
Ref: whatsnew/3 13 configparser574081
Ref: 4dd574081
Ref: configparser<2>-Footnote-1574411
Node: copy574466
Ref: whatsnew/3 13 copy574579
Ref: 4df574579
Ref: copy-Footnote-1575490
Node: ctypes<2>575546
Ref: whatsnew/3 13 ctypes575647
Ref: 4e7575647
Ref: ctypes<2>-Footnote-1576580
Ref: ctypes<2>-Footnote-2576636
Node: dbm576692
Ref: whatsnew/3 13 dbm576795
Ref: 4e9576795
Ref: dbm-Footnote-1577249
Ref: dbm-Footnote-2577305
Node: dis<2>577361
Ref: whatsnew/3 13 dis577462
Ref: 4ea577462
Ref: dis<2>-Footnote-1578210
Ref: dis<2>-Footnote-2578266
Node: doctest578322
Ref: whatsnew/3 13 doctest578428
Ref: 4ed578428
Ref: whatsnew/3 13 whatsnew313-doctest578428
Ref: 475578428
Ref: doctest-Footnote-1579071
Ref: doctest-Footnote-2579101
Ref: doctest-Footnote-3579134
Ref: doctest-Footnote-4579190
Node: email<2>579246
Ref: whatsnew/3 13 email579350
Ref: 4f1579350
Ref: email<2>-Footnote-1580482
Ref: email<2>-Footnote-2580538
Ref: email<2>-Footnote-3580594
Node: enum580650
Ref: whatsnew/3 13 enum580759
Ref: 4f5580759
Node: fractions<2>580892
Ref: whatsnew/3 13 fractions580997
Ref: 4f8580997
Ref: fractions<2>-Footnote-1581315
Node: glob581371
Ref: whatsnew/3 13 glob581481
Ref: 4fa581481
Ref: glob-Footnote-1581730
Node: importlib581785
Ref: whatsnew/3 13 importlib581888
Ref: 4fc581888
Ref: importlib-Footnote-1582789
Ref: importlib-Footnote-2582845
Node: io<3>582901
Ref: whatsnew/3 13 io583009
Ref: 504583009
Ref: io<3>-Footnote-1583435
Node: ipaddress583490
Ref: whatsnew/3 13 ipaddress583601
Ref: 50a583601
Ref: ipaddress-Footnote-1584060
Ref: ipaddress-Footnote-2584116
Node: itertools<2>584172
Ref: whatsnew/3 13 itertools584285
Ref: 510584285
Ref: itertools<2>-Footnote-1584585
Node: marshal584641
Ref: whatsnew/3 13 marshal584752
Ref: 512584752
Ref: marshal-Footnote-1585087
Node: math<2>585143
Ref: whatsnew/3 13 math585254
Ref: 513585254
Ref: math<2>-Footnote-1585745
Node: mimetypes<2>585800
Ref: whatsnew/3 13 mimetypes585908
Ref: 515585908
Ref: mimetypes<2>-Footnote-1586225
Node: mmap586280
Ref: whatsnew/3 13 mmap586399
Ref: 518586399
Ref: mmap-Footnote-1587212
Ref: mmap-Footnote-2587268
Ref: mmap-Footnote-3587324
Node: multiprocessing<2>587379
Ref: whatsnew/3 13 multiprocessing587491
Ref: 51c587491
Ref: multiprocessing<2>-Footnote-1587795
Node: os<2>587851
Ref: whatsnew/3 13 os587969
Ref: 51d587969
Ref: os<2>-Footnote-1590435
Ref: os<2>-Footnote-2590491
Ref: os<2>-Footnote-3590547
Ref: os<2>-Footnote-4590601
Ref: os<2>-Footnote-5590657
Ref: os<2>-Footnote-6590712
Ref: os<2>-Footnote-7590768
Ref: os<2>-Footnote-8590823
Ref: os<2>-Footnote-9590879
Ref: os<2>-Footnote-10590935
Node: os path<2>590992
Ref: whatsnew/3 13 os-path591102
Ref: 530591102
Ref: os path<2>-Footnote-1591725
Ref: os path<2>-Footnote-2591780
Ref: os path<2>-Footnote-3591835
Node: pathlib<4>591890
Ref: whatsnew/3 13 pathlib592001
Ref: 532592001
Ref: pathlib<4>-Footnote-1593515
Ref: pathlib<4>-Footnote-2593570
Ref: pathlib<4>-Footnote-3593626
Ref: pathlib<4>-Footnote-4593681
Ref: pathlib<4>-Footnote-5593736
Ref: pathlib<4>-Footnote-6593791
Ref: pathlib<4>-Footnote-7593847
Node: pdb<3>593903
Ref: whatsnew/3 13 pdb594009
Ref: 53d594009
Ref: pdb<3>-Footnote-1595144
Ref: pdb<3>-Footnote-2595200
Ref: pdb<3>-Footnote-3595256
Ref: pdb<3>-Footnote-4595312
Ref: pdb<3>-Footnote-5595368
Node: queue595424
Ref: whatsnew/3 13 queue595526
Ref: 541595526
Ref: queue-Footnote-1595761
Node: random595817
Ref: whatsnew/3 13 random595918
Ref: 544595918
Ref: random-Footnote-1596092
Node: re<2>596148
Ref: whatsnew/3 13 re596250
Ref: 545596250
Node: shutil596409
Ref: whatsnew/3 13 shutil596509
Ref: 547596509
Ref: shutil-Footnote-1596737
Node: site596792
Ref: whatsnew/3 13 site596897
Ref: 549596897
Ref: site-Footnote-1597148
Node: sqlite3<2>597204
Ref: whatsnew/3 13 sqlite3597309
Ref: 54b597309
Ref: sqlite3<2>-Footnote-1597750
Ref: sqlite3<2>-Footnote-2597806
Node: ssl<2>597861
Ref: whatsnew/3 13 ssl597972
Ref: 550597972
Ref: ssl<2>-Footnote-1598663
Ref: ssl<2>-Footnote-2598722
Node: statistics598778
Ref: whatsnew/3 13 statistics598889
Ref: 552598889
Ref: statistics-Footnote-1599398
Ref: statistics-Footnote-2599454
Node: subprocess599510
Ref: whatsnew/3 13 subprocess599621
Ref: 555599621
Ref: whatsnew/3 13 whatsnew313-subprocess599621
Ref: 556599621
Ref: subprocess-Footnote-1600561
Node: sys<2>600617
Ref: whatsnew/3 13 sys600726
Ref: 558600726
Ref: sys<2>-Footnote-1601015
Node: tempfile601070
Ref: whatsnew/3 13 tempfile601173
Ref: 55a601173
Ref: tempfile-Footnote-1601518
Ref: tempfile-Footnote-2601573
Node: time601629
Ref: whatsnew/3 13 time601736
Ref: 55b601736
Ref: time-Footnote-1602384
Ref: time-Footnote-2602439
Node: tkinter<2>602494
Ref: whatsnew/3 13 tkinter602602
Ref: 55e602602
Ref: tkinter<2>-Footnote-1604866
Ref: tkinter<2>-Footnote-2604921
Ref: tkinter<2>-Footnote-3604976
Ref: tkinter<2>-Footnote-4605031
Ref: tkinter<2>-Footnote-5605086
Ref: tkinter<2>-Footnote-6605141
Ref: tkinter<2>-Footnote-7605196
Ref: tkinter<2>-Footnote-8605252
Ref: tkinter<2>-Footnote-9605308
Node: traceback605364
Ref: whatsnew/3 13 traceback605476
Ref: 561605476
Ref: traceback-Footnote-1606206
Ref: traceback-Footnote-2606262
Node: types<2>606318
Ref: whatsnew/3 13 types606429
Ref: 567606429
Ref: types<2>-Footnote-1606754
Node: typing<2>606810
Ref: whatsnew/3 13 typing606926
Ref: 568606926
Ref: typing<2>-Footnote-1607912
Ref: typing<2>-Footnote-2607954
Ref: typing<2>-Footnote-3607996
Ref: typing<2>-Footnote-4608052
Ref: typing<2>-Footnote-5608108
Ref: typing<2>-Footnote-6608164
Node: unicodedata<2>608219
Ref: whatsnew/3 13 unicodedata608331
Ref: 56f608331
Ref: unicodedata<2>-Footnote-1608519
Ref: unicodedata<2>-Footnote-2608575
Node: venv608631
Ref: whatsnew/3 13 venv608742
Ref: 570608742
Ref: venv-Footnote-1609234
Node: warnings609290
Ref: whatsnew/3 13 warnings609390
Ref: 573609390
Ref: warnings-Footnote-1609854
Ref: warnings-Footnote-2609896
Node: xml609952
Ref: whatsnew/3 13 xml610057
Ref: 575610057
Ref: xml-Footnote-1610823
Ref: xml-Footnote-2610879
Ref: xml-Footnote-3610935
Node: zipimport610990
Ref: whatsnew/3 13 zipimport611078
Ref: 57b611078
Ref: zipimport-Footnote-1611282
Ref: zipimport-Footnote-2611344
Node: 最適化<2>611399
Ref: whatsnew/3 13 optimizations611545
Ref: 57c611545
Ref: 最適化<2>-Footnote-1612741
Ref: 最適化<2>-Footnote-2612797
Ref: 最適化<2>-Footnote-3612853
Node: Removed Modules And APIs612909
Ref: whatsnew/3 13 removed-modules-and-apis613041
Ref: 57e613041
Node: PEP 594 Remove "dead batteries" from the standard library613548
Ref: whatsnew/3 13 pep-594-remove-dead-batteries-from-the-standard-library613679
Ref: 57f613679
Ref: whatsnew/3 13 whatsnew313-pep594613679
Ref: 471613679
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-1618937
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-2618979
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-3619027
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-4619073
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-5619122
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-6619166
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-7619210
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-8619257
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-9619306
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-10619347
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-11619394
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-12619441
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-13619484
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-14619532
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-15619582
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-16619646
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-17619690
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-18619735
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-19619783
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-20619834
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-21619886
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-22619928
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-23619980
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-24620022
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-25620072
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-26620116
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-27620161
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-28620209
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-29620260
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-30620306
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-31620356
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-32620402
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-33620446
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-34620500
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-35620547
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-36620598
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-37620655
Node: 2to3620712
Ref: whatsnew/3 13 to3620860
Ref: 583620860
Ref: 2to3-Footnote-1621087
Node: builtins621143
Ref: whatsnew/3 13 builtins621249
Ref: 584621249
Ref: builtins-Footnote-1621986
Ref: builtins-Footnote-2622041
Ref: builtins-Footnote-3622096
Node: configparser<3>622151
Ref: whatsnew/3 13 id3622271
Ref: 586622271
Ref: configparser<3>-Footnote-1622555
Node: importlib metadata622611
Ref: whatsnew/3 13 importlib-metadata622729
Ref: 587622729
Ref: importlib metadata-Footnote-1622986
Node: locale623042
Ref: whatsnew/3 13 locale623151
Ref: 58a623151
Ref: locale-Footnote-1623414
Node: opcode623470
Ref: whatsnew/3 13 opcode623569
Ref: 58b623569
Ref: opcode-Footnote-1624194
Ref: opcode-Footnote-2624250
Node: optparse624306
Ref: whatsnew/3 13 optparse624409
Ref: 58c624409
Ref: optparse-Footnote-1625197
Node: pathlib<5>625253
Ref: whatsnew/3 13 id4625355
Ref: 58d625355
Ref: pathlib<5>-Footnote-1625633
Node: re<3>625688
Ref: whatsnew/3 13 id5625793
Ref: 58e625793
Ref: re<3>-Footnote-1626059
Node: tkinter tix626115
Ref: whatsnew/3 13 tkinter-tix626219
Ref: 58f626219
Ref: tkinter tix-Footnote-1626494
Node: turtle<2>626549
Ref: whatsnew/3 13 turtle626657
Ref: 590626657
Ref: turtle<2>-Footnote-1626935
Node: typing<3>626991
Ref: whatsnew/3 13 id6627099
Ref: 591627099
Ref: typing<3>-Footnote-1627585
Ref: typing<3>-Footnote-2627640
Node: unittest<2>627696
Ref: whatsnew/3 13 unittest627804
Ref: 592627804
Ref: unittest<2>-Footnote-1628506
Ref: unittest<2>-Footnote-2628562
Node: urllib<3>628618
Ref: whatsnew/3 13 urllib628730
Ref: 597628730
Ref: urllib<3>-Footnote-1629335
Node: webbrowser<2>629391
Ref: whatsnew/3 13 webbrowser629483
Ref: 599629483
Ref: webbrowser<2>-Footnote-1629974
Ref: webbrowser<2>-Footnote-2630030
Node: New Deprecations630086
Ref: whatsnew/3 13 new-deprecations630230
Ref: 59b630230
Ref: New Deprecations-Footnote-1638826
Ref: New Deprecations-Footnote-2638881
Ref: New Deprecations-Footnote-3638936
Ref: New Deprecations-Footnote-4638992
Ref: New Deprecations-Footnote-5639048
Ref: New Deprecations-Footnote-6639103
Ref: New Deprecations-Footnote-7639159
Ref: New Deprecations-Footnote-8639214
Ref: New Deprecations-Footnote-9639270
Ref: New Deprecations-Footnote-10639326
Ref: New Deprecations-Footnote-11639383
Ref: New Deprecations-Footnote-12639439
Ref: New Deprecations-Footnote-13639495
Ref: New Deprecations-Footnote-14639551
Ref: New Deprecations-Footnote-15639608
Ref: New Deprecations-Footnote-16639664
Ref: New Deprecations-Footnote-17639721
Ref: New Deprecations-Footnote-18639778
Ref: New Deprecations-Footnote-19639835
Ref: New Deprecations-Footnote-20639891
Ref: New Deprecations-Footnote-21639948
Ref: New Deprecations-Footnote-22640005
Ref: New Deprecations-Footnote-23640062
Ref: New Deprecations-Footnote-24640119
Ref: New Deprecations-Footnote-25640176
Ref: New Deprecations-Footnote-26640233
Ref: New Deprecations-Footnote-27640290
Node: Pending removal in Python 3 14640347
Ref: whatsnew/3 13 pending-removal-in-python-3-14640472
Ref: 5ae640472
Ref: Pending removal in Python 3 14-Footnote-1644690
Ref: Pending removal in Python 3 14-Footnote-2644745
Ref: Pending removal in Python 3 14-Footnote-3644800
Ref: Pending removal in Python 3 14-Footnote-4644855
Ref: Pending removal in Python 3 14-Footnote-5644910
Ref: Pending removal in Python 3 14-Footnote-6644966
Ref: Pending removal in Python 3 14-Footnote-7645021
Ref: Pending removal in Python 3 14-Footnote-8645076
Ref: Pending removal in Python 3 14-Footnote-9645132
Ref: Pending removal in Python 3 14-Footnote-10645187
Ref: Pending removal in Python 3 14-Footnote-11645243
Node: Pending removal in Python 3 15<3>645299
Ref: whatsnew/3 13 pending-removal-in-python-3-15645466
Ref: 5b3645466
Ref: Pending removal in Python 3 15<3>-Footnote-1649602
Ref: Pending removal in Python 3 15<3>-Footnote-2649657
Ref: Pending removal in Python 3 15<3>-Footnote-3649712
Ref: Pending removal in Python 3 15<3>-Footnote-4649754
Ref: Pending removal in Python 3 15<3>-Footnote-5649810
Node: Pending removal in Python 3 16<3>649866
Ref: whatsnew/3 13 pending-removal-in-python-3-16650036
Ref: 5b4650036
Ref: Pending removal in Python 3 16<3>-Footnote-1654277
Ref: Pending removal in Python 3 16<3>-Footnote-2654333
Ref: Pending removal in Python 3 16<3>-Footnote-3654389
Ref: Pending removal in Python 3 16<3>-Footnote-4654445
Node: Pending removal in Python 3 17<2>654500
Ref: whatsnew/3 13 pending-removal-in-python-3-17654670
Ref: 5b5654670
Ref: Pending removal in Python 3 17<2>-Footnote-1657604
Ref: Pending removal in Python 3 17<2>-Footnote-2657662
Ref: Pending removal in Python 3 17<2>-Footnote-3657717
Ref: Pending removal in Python 3 17<2>-Footnote-4657775
Node: Pending removal in Python 3 18<3>657830
Ref: whatsnew/3 13 pending-removal-in-python-3-18658000
Ref: 5b6658000
Ref: Pending removal in Python 3 18<3>-Footnote-1658426
Node: Pending removal in Python 3 19<2>658481
Ref: whatsnew/3 13 pending-removal-in-python-3-19658655
Ref: 5b7658655
Node: Pending removal in future versions<3>658933
Ref: whatsnew/3 13 pending-removal-in-future-versions659065
Ref: 5b8659065
Ref: Pending removal in future versions<3>-Footnote-1666252
Ref: Pending removal in future versions<3>-Footnote-2666307
Ref: Pending removal in future versions<3>-Footnote-3666363
Ref: Pending removal in future versions<3>-Footnote-4666419
Ref: Pending removal in future versions<3>-Footnote-5666475
Ref: Pending removal in future versions<3>-Footnote-6666530
Ref: Pending removal in future versions<3>-Footnote-7666585
Node: CPython Bytecode Changes666641
Ref: whatsnew/3 13 cpython-bytecode-changes666779
Ref: 5b9666779
Ref: CPython Bytecode Changes-Footnote-1667220
Node: C API の変更<2>667276
Ref: whatsnew/3 13 c-api-changes667411
Ref: 5bc667411
Node: 新しい機能<3>667629
Ref: whatsnew/3 13 id7667725
Ref: 5bd667725
Ref: 新しい機能<3>-Footnote-1678641
Ref: 新しい機能<3>-Footnote-2678683
Ref: 新しい機能<3>-Footnote-3678739
Ref: 新しい機能<3>-Footnote-4678795
Ref: 新しい機能<3>-Footnote-5678851
Ref: 新しい機能<3>-Footnote-6678907
Ref: 新しい機能<3>-Footnote-7678963
Ref: 新しい機能<3>-Footnote-8679019
Ref: 新しい機能<3>-Footnote-9679075
Ref: 新しい機能<3>-Footnote-10679131
Ref: 新しい機能<3>-Footnote-11679188
Ref: 新しい機能<3>-Footnote-12679245
Ref: 新しい機能<3>-Footnote-13679301
Ref: 新しい機能<3>-Footnote-14679358
Ref: 新しい機能<3>-Footnote-15679415
Ref: 新しい機能<3>-Footnote-16679472
Ref: 新しい機能<3>-Footnote-17679529
Ref: 新しい機能<3>-Footnote-18679586
Ref: 新しい機能<3>-Footnote-19679643
Ref: 新しい機能<3>-Footnote-20679700
Ref: 新しい機能<3>-Footnote-21679756
Ref: 新しい機能<3>-Footnote-22679813
Ref: 新しい機能<3>-Footnote-23679870
Ref: 新しい機能<3>-Footnote-24679924
Ref: 新しい機能<3>-Footnote-25679981
Ref: 新しい機能<3>-Footnote-26680037
Ref: 新しい機能<3>-Footnote-27680093
Ref: 新しい機能<3>-Footnote-28680150
Ref: 新しい機能<3>-Footnote-29680207
Ref: 新しい機能<3>-Footnote-30680264
Ref: 新しい機能<3>-Footnote-31680321
Ref: 新しい機能<3>-Footnote-32680378
Node: Changed C APIs680435
Ref: whatsnew/3 13 changed-c-apis680561
Ref: 623680561
Ref: Changed C APIs-Footnote-1683156
Ref: Changed C APIs-Footnote-2683211
Ref: Changed C APIs-Footnote-3683267
Ref: Changed C APIs-Footnote-4683323
Ref: Changed C APIs-Footnote-5683379
Ref: Changed C APIs-Footnote-6683421
Ref: Changed C APIs-Footnote-7683477
Ref: Changed C APIs-Footnote-8683533
Node: Limited C API Changes683589
Ref: whatsnew/3 13 limited-c-api-changes683714
Ref: 630683714
Ref: Limited C API Changes-Footnote-1684417
Ref: Limited C API Changes-Footnote-2684472
Ref: Limited C API Changes-Footnote-3684528
Node: Removed C APIs<2>684584
Ref: whatsnew/3 13 removed-c-apis684715
Ref: 638684715
Ref: Removed C APIs<2>-Footnote-1691041
Ref: Removed C APIs<2>-Footnote-2691097
Ref: Removed C APIs<2>-Footnote-3691152
Ref: Removed C APIs<2>-Footnote-4691208
Ref: Removed C APIs<2>-Footnote-5691250
Ref: Removed C APIs<2>-Footnote-6691306
Ref: Removed C APIs<2>-Footnote-7691362
Ref: Removed C APIs<2>-Footnote-8691418
Ref: Removed C APIs<2>-Footnote-9691471
Ref: Removed C APIs<2>-Footnote-10691527
Ref: Removed C APIs<2>-Footnote-11691570
Ref: Removed C APIs<2>-Footnote-12691627
Ref: Removed C APIs<2>-Footnote-13691684
Ref: Removed C APIs<2>-Footnote-14691741
Node: Deprecated C APIs<2>691798
Ref: whatsnew/3 13 deprecated-c-apis691899
Ref: 64d691899
Ref: Deprecated C APIs<2>-Footnote-1694649
Ref: Deprecated C APIs<2>-Footnote-2694705
Ref: Deprecated C APIs<2>-Footnote-3694747
Ref: Deprecated C APIs<2>-Footnote-4694803
Ref: Deprecated C APIs<2>-Footnote-5694858
Ref: Deprecated C APIs<2>-Footnote-6694914
Ref: Deprecated C APIs<2>-Footnote-7694967
Node: Pending removal in Python 3 14<2>695023
Ref: whatsnew/3 13 id8695155
Ref: 64e695155
Ref: Pending removal in Python 3 14<2>-Footnote-1695475
Ref: Pending removal in Python 3 14<2>-Footnote-2695517
Ref: Pending removal in Python 3 14<2>-Footnote-3695573
Node: Pending removal in Python 3 15<4>695628
Ref: whatsnew/3 13 id9695802
Ref: 650695802
Ref: Pending removal in Python 3 15<4>-Footnote-1702433
Ref: Pending removal in Python 3 15<4>-Footnote-2702486
Node: Pending removal in Python 3 16<4>702539
Ref: whatsnew/3 13 id10702713
Ref: 651702713
Node: Pending removal in Python 3 18<4>702836
Ref: whatsnew/3 13 id11703014
Ref: 652703014
Ref: Pending removal in Python 3 18<4>-Footnote-1705689
Ref: Pending removal in Python 3 18<4>-Footnote-2705742
Node: Pending removal in future versions<4>705798
Ref: whatsnew/3 13 id12705934
Ref: 653705934
Node: Build Changes707775
Ref: whatsnew/3 13 build-changes707908
Ref: 654707908
Ref: whatsnew/3 13 pythoncapi-compat-project707908
Ref: 655707908
Ref: Build Changes-Footnote-1710486
Ref: Build Changes-Footnote-2710528
Ref: Build Changes-Footnote-3710584
Ref: Build Changes-Footnote-4710626
Ref: Build Changes-Footnote-5710682
Ref: Build Changes-Footnote-6710724
Ref: Build Changes-Footnote-7710780
Ref: Build Changes-Footnote-8710822
Ref: Build Changes-Footnote-9710878
Ref: Build Changes-Footnote-10710933
Ref: Build Changes-Footnote-11710990
Ref: Build Changes-Footnote-12711047
Ref: Build Changes-Footnote-13711095
Ref: Build Changes-Footnote-14711152
Ref: Build Changes-Footnote-15711209
Ref: Build Changes-Footnote-16711266
Node: Porting to Python 3 13711322
Ref: whatsnew/3 13 porting-to-python-3-13711460
Ref: 472711460
Node: Python API の変更<2>711767
Ref: whatsnew/3 13 changes-in-the-python-api711876
Ref: 658711876
Ref: whatsnew/3 13 pep667-porting-notes-py711934
Ref: 4a6711934
Ref: Python API の変更<2>-Footnote-1715469
Ref: Python API の変更<2>-Footnote-2715511
Ref: Python API の変更<2>-Footnote-3715553
Ref: Python API の変更<2>-Footnote-4715595
Ref: Python API の変更<2>-Footnote-5715637
Ref: Python API の変更<2>-Footnote-6715693
Ref: Python API の変更<2>-Footnote-7715749
Ref: Python API の変更<2>-Footnote-8715804
Node: C API の変更<3>715860
Ref: whatsnew/3 13 changes-in-the-c-api715969
Ref: 65f715969
Ref: whatsnew/3 13 pep667-porting-notes-c718611
Ref: 4a7718611
Ref: C API の変更<3>-Footnote-1722365
Ref: C API の変更<3>-Footnote-2722421
Ref: C API の変更<3>-Footnote-3722477
Ref: C API の変更<3>-Footnote-4722533
Ref: C API の変更<3>-Footnote-5722588
Ref: C API の変更<3>-Footnote-6722644
Node: Regression Test Changes722697
Ref: whatsnew/3 13 regression-test-changes722813
Ref: 665722813
Ref: Regression Test Changes-Footnote-1723254
Node: What's New In Python 3 12723310
Ref: whatsnew/3 12 doc723460
Ref: 667723460
Ref: whatsnew/3 12 translation-repo723460
Ref: 668723460
Ref: whatsnew/3 12 what-s-new-in-python-3-12723460
Ref: 669723460
Ref: What's New In Python 3 12-Footnote-1724546
Node: 概要 -- リリースハイライト<3>724588
Ref: whatsnew/3 12 summary-release-highlights724717
Ref: 66a724717
Ref: 概要 -- リリースハイライト<3>-Footnote-1730275
Ref: 概要 -- リリースハイライト<3>-Footnote-2730323
Ref: 概要 -- リリースハイライト<3>-Footnote-3730365
Ref: 概要 -- リリースハイライト<3>-Footnote-4730407
Ref: 概要 -- リリースハイライト<3>-Footnote-5730466
Ref: 概要 -- リリースハイライト<3>-Footnote-6730545
Node: 新しい機能<4>730600
Ref: whatsnew/3 12 new-features730780
Ref: 680730780
Node: PEP 695 型パラメータの構文731499
Ref: whatsnew/3 12 pep-695-type-parameter-syntax731640
Ref: 681731640
Ref: whatsnew/3 12 whatsnew312-pep695731640
Ref: 66c731640
Ref: PEP 695 型パラメータの構文-Footnote-1734822
Ref: PEP 695 型パラメータの構文-Footnote-2734864
Ref: PEP 695 型パラメータの構文-Footnote-3734906
Ref: PEP 695 型パラメータの構文-Footnote-4734948
Node: PEP 701 f-strings の構文的な形式化735004
Ref: whatsnew/3 12 pep-701-syntactic-formalization-of-f-strings735196
Ref: 686735196
Ref: whatsnew/3 12 whatsnew312-pep701735196
Ref: 66f735196
Ref: PEP 701 f-strings の構文的な形式化-Footnote-1740459
Ref: PEP 701 f-strings の構文的な形式化-Footnote-2740501
Ref: PEP 701 f-strings の構文的な形式化-Footnote-3740543
Ref: PEP 701 f-strings の構文的な形式化-Footnote-4740585
Node: PEP 684 インタープリタごとの GIL740641
Ref: whatsnew/3 12 pep-684-a-per-interpreter-gil740844
Ref: 688740844
Ref: whatsnew/3 12 whatsnew312-pep684740844
Ref: 670740844
Ref: PEP 684 インタープリタごとの GIL-Footnote-1742136
Ref: PEP 684 インタープリタごとの GIL-Footnote-2742178
Ref: PEP 684 インタープリタごとの GIL-Footnote-3742220
Node: PEP 669 CPython の低影響モニタリング742276
Ref: whatsnew/3 12 pep-669-low-impact-monitoring-for-cpython742507
Ref: 68a742507
Ref: whatsnew/3 12 whatsnew312-pep669742507
Ref: 671742507
Ref: PEP 669 CPython の低影響モニタリング-Footnote-1743249
Ref: PEP 669 CPython の低影響モニタリング-Footnote-2743291
Node: PEP 688 バッファプロトコルを Python で利用可能にする743347
Ref: whatsnew/3 12 pep-688-making-the-buffer-protocol-accessible-in-python743577
Ref: 68b743577
Ref: whatsnew/3 12 whatsnew312-pep688743577
Ref: 673743577
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-1744357
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-2744399
Node: PEP 709 内包表記のインライン化744455
Ref: whatsnew/3 12 pep-709-comprehension-inlining744675
Ref: 68e744675
Ref: whatsnew/3 12 whatsnew312-pep709744675
Ref: 679744675
Ref: PEP 709 内包表記のインライン化-Footnote-1746468
Ref: PEP 709 内包表記のインライン化-Footnote-2746510
Node: エラーメッセージの改善<3>746552
Ref: whatsnew/3 12 improved-error-messages746693
Ref: 672746693
Ref: エラーメッセージの改善<3>-Footnote-1749053
Ref: エラーメッセージの改善<3>-Footnote-2749108
Ref: エラーメッセージの改善<3>-Footnote-3749163
Ref: エラーメッセージの改善<3>-Footnote-4749218
Node: 型ヒントに関連する新しい機能749273
Ref: whatsnew/3 12 new-features-related-to-type-hints749440
Ref: 68f749440
Ref: 型ヒントに関連する新しい機能-Footnote-1749879
Node: PEP 692 Using TypedDict for more precise **kwargs typing749921
Ref: whatsnew/3 12 pep-692-using-typeddict-for-more-precise-kwargs-typing750109
Ref: 690750109
Ref: whatsnew/3 12 whatsnew312-pep692750109
Ref: 67a750109
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-1750831
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-2750873
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-3750915
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-4750957
Node: PEP 698 Override Decorator for Static Typing751013
Ref: whatsnew/3 12 pep-698-override-decorator-for-static-typing751201
Ref: 691751201
Ref: whatsnew/3 12 whatsnew312-pep698751201
Ref: 67c751201
Ref: PEP 698 Override Decorator for Static Typing-Footnote-1752205
Ref: PEP 698 Override Decorator for Static Typing-Footnote-2752247
Node: その他の言語変更<2>752303
Ref: whatsnew/3 12 other-language-changes752479
Ref: 692752479
Ref: その他の言語変更<2>-Footnote-1757140
Ref: その他の言語変更<2>-Footnote-2757195
Ref: その他の言語変更<2>-Footnote-3757250
Ref: その他の言語変更<2>-Footnote-4757305
Ref: その他の言語変更<2>-Footnote-5757347
Ref: その他の言語変更<2>-Footnote-6757403
Ref: その他の言語変更<2>-Footnote-7757445
Ref: その他の言語変更<2>-Footnote-8757500
Ref: その他の言語変更<2>-Footnote-9757556
Ref: その他の言語変更<2>-Footnote-10757611
Ref: その他の言語変更<2>-Footnote-11757667
Ref: その他の言語変更<2>-Footnote-12757723
Ref: その他の言語変更<2>-Footnote-13757780
Ref: その他の言語変更<2>-Footnote-14757837
Ref: その他の言語変更<2>-Footnote-15757893
Ref: その他の言語変更<2>-Footnote-16757936
Ref: その他の言語変更<2>-Footnote-17757992
Node: 新たなモジュール<2>758048
Ref: whatsnew/3 12 new-modules758215
Ref: 69d758215
Node: 改良されたモジュール<2>758282
Ref: whatsnew/3 12 improved-modules758434
Ref: 69e758434
Node: array759169
Ref: whatsnew/3 12 array759263
Ref: 69f759263
Ref: array-Footnote-1759491
Node: asyncio<5>759546
Ref: whatsnew/3 12 asyncio759660
Ref: 6a0759660
Ref: asyncio<5>-Footnote-1761623
Ref: asyncio<5>-Footnote-2761678
Ref: asyncio<5>-Footnote-3761734
Ref: asyncio<5>-Footnote-4761790
Ref: asyncio<5>-Footnote-5761846
Ref: asyncio<5>-Footnote-6761901
Ref: asyncio<5>-Footnote-7761956
Ref: asyncio<5>-Footnote-8762011
Ref: asyncio<5>-Footnote-9762067
Ref: asyncio<5>-Footnote-10762123
Node: calendar<2>762179
Ref: whatsnew/3 12 calendar762291
Ref: 6a8762291
Ref: calendar<2>-Footnote-1762543
Node: csv762599
Ref: whatsnew/3 12 csv762707
Ref: 6ab762707
Node: dis<3>762941
Ref: whatsnew/3 12 dis763050
Ref: 6b0763050
Ref: dis<3>-Footnote-1763660
Ref: dis<3>-Footnote-2763715
Node: fractions<3>763770
Ref: whatsnew/3 12 fractions763895
Ref: 6b3763895
Ref: fractions<3>-Footnote-1764117
Node: importlib resources764173
Ref: whatsnew/3 12 importlib-resources764302
Ref: 6b4764302
Ref: importlib resources-Footnote-1764674
Ref: importlib resources-Footnote-2764729
Node: inspect<2>764785
Ref: whatsnew/3 12 inspect764914
Ref: 6b7764914
Ref: inspect<2>-Footnote-1765684
Ref: inspect<2>-Footnote-2765739
Ref: inspect<2>-Footnote-3765794
Node: itertools<3>765850
Ref: whatsnew/3 12 itertools765967
Ref: 6bd765967
Ref: itertools<3>-Footnote-1766232
Node: math<3>766287
Ref: whatsnew/3 12 math766399
Ref: 6be766399
Ref: math<3>-Footnote-1766817
Ref: math<3>-Footnote-2766873
Node: os<3>766928
Ref: whatsnew/3 12 os767038
Ref: 6c1767038
Ref: os<3>-Footnote-1768383
Ref: os<3>-Footnote-2768438
Ref: os<3>-Footnote-3768493
Ref: os<3>-Footnote-4768549
Node: os path<3>768604
Ref: whatsnew/3 12 os-path768717
Ref: 6c9768717
Ref: os path<3>-Footnote-1769082
Ref: os path<3>-Footnote-2769137
Node: pathlib<6>769193
Ref: whatsnew/3 12 pathlib769328
Ref: 6cc769328
Ref: pathlib<6>-Footnote-1770623
Ref: pathlib<6>-Footnote-2770678
Ref: pathlib<6>-Footnote-3770733
Node: プラットフォーム<2>770788
Ref: whatsnew/3 12 platform770919
Ref: 6d4770919
Ref: プラットフォーム<2>-Footnote-1771288
Node: pdb<4>771343
Ref: whatsnew/3 12 pdb771473
Ref: 6d5771473
Ref: pdb<4>-Footnote-1771746
Node: random<2>771802
Ref: whatsnew/3 12 random771914
Ref: 6d6771914
Ref: random<2>-Footnote-1772219
Ref: random<2>-Footnote-2772274
Node: shutil<2>772330
Ref: whatsnew/3 12 shutil772446
Ref: 6d9772446
Ref: shutil<2>-Footnote-1773876
Ref: shutil<2>-Footnote-2773931
Ref: shutil<2>-Footnote-3773987
Ref: shutil<2>-Footnote-4774043
Ref: shutil<2>-Footnote-5774099
Node: sqlite3<3>774155
Ref: whatsnew/3 12 sqlite3774275
Ref: 6dc774275
Ref: sqlite3<3>-Footnote-1775222
Ref: sqlite3<3>-Footnote-2775277
Ref: sqlite3<3>-Footnote-3775319
Ref: sqlite3<3>-Footnote-4775374
Ref: sqlite3<3>-Footnote-5775430
Node: statistics<2>775486
Ref: whatsnew/3 12 statistics775603
Ref: 6e2775603
Ref: statistics<2>-Footnote-1775883
Node: sys<3>775938
Ref: whatsnew/3 12 sys776056
Ref: 6e4776056
Ref: sys<3>-Footnote-1777606
Ref: sys<3>-Footnote-2777662
Ref: sys<3>-Footnote-3777717
Ref: sys<3>-Footnote-4777773
Node: tempfile<2>777829
Ref: whatsnew/3 12 tempfile777946
Ref: 6ec777946
Ref: tempfile<2>-Footnote-1778338
Node: threading<2>778393
Ref: whatsnew/3 12 threading778514
Ref: 6ee778514
Ref: threading<2>-Footnote-1778863
Node: tkinter<3>778918
Ref: whatsnew/3 12 tkinter779036
Ref: 6f1779036
Ref: tkinter<3>-Footnote-1779532
Node: tokenize779587
Ref: whatsnew/3 12 tokenize779701
Ref: 6f2779701
Ref: tokenize-Footnote-1780056
Ref: tokenize-Footnote-2780098
Node: types<3>780154
Ref: whatsnew/3 12 types780267
Ref: 6f4780267
Ref: types<3>-Footnote-1780579
Node: typing<4>780635
Ref: whatsnew/3 12 typing780754
Ref: 6f7780754
Ref: whatsnew/3 12 whatsnew-typing-py312780754
Ref: 6f8780754
Ref: typing<4>-Footnote-1783325
Ref: typing<4>-Footnote-2783381
Ref: typing<4>-Footnote-3783436
Ref: typing<4>-Footnote-4783492
Ref: typing<4>-Footnote-5783548
Node: unicodedata<3>783603
Ref: whatsnew/3 12 unicodedata783725
Ref: 6fc783725
Ref: unicodedata<3>-Footnote-1783923
Node: unittest<3>783978
Ref: whatsnew/3 12 unittest784098
Ref: 6fd784098
Ref: unittest<3>-Footnote-1784882
Node: uuid<3>784937
Ref: whatsnew/3 12 uuid785034
Ref: 6fe785034
Ref: uuid<3>-Footnote-1785197
Node: 最適化<3>785252
Ref: whatsnew/3 12 optimizations785415
Ref: 6ff785415
Ref: 最適化<3>-Footnote-1786856
Ref: 最適化<3>-Footnote-2786898
Ref: 最適化<3>-Footnote-3786953
Ref: 最適化<3>-Footnote-4787008
Ref: 最適化<3>-Footnote-5787064
Ref: 最適化<3>-Footnote-6787119
Ref: 最適化<3>-Footnote-7787175
Ref: 最適化<3>-Footnote-8787217
Ref: 最適化<3>-Footnote-9787273
Node: CPython バイトコードの変更<2>787329
Ref: whatsnew/3 12 cpython-bytecode-changes787474
Ref: 703787474
Ref: CPython バイトコードの変更<2>-Footnote-1789505
Ref: CPython バイトコードの変更<2>-Footnote-2789560
Ref: CPython バイトコードの変更<2>-Footnote-3789616
Ref: CPython バイトコードの変更<2>-Footnote-4789671
Ref: CPython バイトコードの変更<2>-Footnote-5789726
Ref: CPython バイトコードの変更<2>-Footnote-6789781
Ref: CPython バイトコードの変更<2>-Footnote-7789837
Ref: CPython バイトコードの変更<2>-Footnote-8789892
Ref: CPython バイトコードの変更<2>-Footnote-9789948
Ref: CPython バイトコードの変更<2>-Footnote-10789990
Ref: CPython バイトコードの変更<2>-Footnote-11790047
Ref: CPython バイトコードの変更<2>-Footnote-12790103
Ref: CPython バイトコードの変更<2>-Footnote-13790146
Ref: CPython バイトコードの変更<2>-Footnote-14790203
Ref: CPython バイトコードの変更<2>-Footnote-15790260
Node: Demos and Tools790317
Ref: whatsnew/3 12 demos-and-tools790462
Ref: 70f790462
Ref: Demos and Tools-Footnote-1790915
Ref: Demos and Tools-Footnote-2790963
Ref: Demos and Tools-Footnote-3791018
Ref: Demos and Tools-Footnote-4791066
Node: 非推奨<2>791121
Ref: whatsnew/3 12 deprecated791237
Ref: 710791237
Ref: 非推奨<2>-Footnote-1802386
Ref: 非推奨<2>-Footnote-2802441
Ref: 非推奨<2>-Footnote-3802496
Ref: 非推奨<2>-Footnote-4802551
Ref: 非推奨<2>-Footnote-5802606
Ref: 非推奨<2>-Footnote-6802662
Ref: 非推奨<2>-Footnote-7802718
Ref: 非推奨<2>-Footnote-8802776
Ref: 非推奨<2>-Footnote-9802831
Ref: 非推奨<2>-Footnote-10802887
Ref: 非推奨<2>-Footnote-11802943
Ref: 非推奨<2>-Footnote-12802999
Ref: 非推奨<2>-Footnote-13803056
Ref: 非推奨<2>-Footnote-14803112
Ref: 非推奨<2>-Footnote-15803168
Ref: 非推奨<2>-Footnote-16803224
Ref: 非推奨<2>-Footnote-17803280
Ref: 非推奨<2>-Footnote-18803383
Ref: 非推奨<2>-Footnote-19803440
Ref: 非推奨<2>-Footnote-20803496
Ref: 非推奨<2>-Footnote-21803553
Ref: 非推奨<2>-Footnote-22803610
Ref: 非推奨<2>-Footnote-23803666
Ref: 非推奨<2>-Footnote-24803722
Ref: 非推奨<2>-Footnote-25803778
Ref: 非推奨<2>-Footnote-26803834
Ref: 非推奨<2>-Footnote-27803890
Ref: 非推奨<2>-Footnote-28803946
Ref: 非推奨<2>-Footnote-29804003
Ref: 非推奨<2>-Footnote-30804046
Node: Pending removal in Python 3 13804103
Ref: whatsnew/3 12 pending-removal-in-python-3-13804224
Ref: 71f804224
Ref: Pending removal in Python 3 13-Footnote-1805317
Ref: Pending removal in Python 3 13-Footnote-2805359
Ref: Pending removal in Python 3 13-Footnote-3805414
Ref: Pending removal in Python 3 13-Footnote-4805469
Ref: Pending removal in Python 3 13-Footnote-5805524
Ref: Pending removal in Python 3 13-Footnote-6805579
Ref: Pending removal in Python 3 13-Footnote-7805634
Ref: Pending removal in Python 3 13-Footnote-8805689
Ref: Pending removal in Python 3 13-Footnote-9805744
Ref: Pending removal in Python 3 13-Footnote-10805799
Ref: Pending removal in Python 3 13-Footnote-11805855
Node: Pending removal in Python 3 14<3>805911
Ref: whatsnew/3 12 pending-removal-in-python-3-14806074
Ref: 720806074
Ref: Pending removal in Python 3 14<3>-Footnote-1810294
Ref: Pending removal in Python 3 14<3>-Footnote-2810349
Ref: Pending removal in Python 3 14<3>-Footnote-3810404
Ref: Pending removal in Python 3 14<3>-Footnote-4810459
Ref: Pending removal in Python 3 14<3>-Footnote-5810514
Ref: Pending removal in Python 3 14<3>-Footnote-6810570
Ref: Pending removal in Python 3 14<3>-Footnote-7810625
Ref: Pending removal in Python 3 14<3>-Footnote-8810680
Ref: Pending removal in Python 3 14<3>-Footnote-9810736
Ref: Pending removal in Python 3 14<3>-Footnote-10810791
Ref: Pending removal in Python 3 14<3>-Footnote-11810847
Node: Pending removal in Python 3 15<5>810903
Ref: whatsnew/3 12 pending-removal-in-python-3-15811069
Ref: 721811069
Ref: Pending removal in Python 3 15<5>-Footnote-1815207
Ref: Pending removal in Python 3 15<5>-Footnote-2815262
Ref: Pending removal in Python 3 15<5>-Footnote-3815317
Ref: Pending removal in Python 3 15<5>-Footnote-4815359
Ref: Pending removal in Python 3 15<5>-Footnote-5815415
Node: Pending removal in Python 3 16<5>815471
Ref: whatsnew/3 12 pending-removal-in-python-3-16815637
Ref: 722815637
Ref: Pending removal in Python 3 16<5>-Footnote-1819880
Ref: Pending removal in Python 3 16<5>-Footnote-2819936
Ref: Pending removal in Python 3 16<5>-Footnote-3819992
Ref: Pending removal in Python 3 16<5>-Footnote-4820048
Node: Pending removal in Python 3 17<3>820103
Ref: whatsnew/3 12 pending-removal-in-python-3-17820273
Ref: 723820273
Ref: Pending removal in Python 3 17<3>-Footnote-1823209
Ref: Pending removal in Python 3 17<3>-Footnote-2823267
Ref: Pending removal in Python 3 17<3>-Footnote-3823322
Ref: Pending removal in Python 3 17<3>-Footnote-4823380
Node: Pending removal in future versions<5>823435
Ref: whatsnew/3 12 pending-removal-in-future-versions823563
Ref: 724823563
Ref: Pending removal in future versions<5>-Footnote-1830752
Ref: Pending removal in future versions<5>-Footnote-2830807
Ref: Pending removal in future versions<5>-Footnote-3830863
Ref: Pending removal in future versions<5>-Footnote-4830919
Ref: Pending removal in future versions<5>-Footnote-5830975
Ref: Pending removal in future versions<5>-Footnote-6831030
Ref: Pending removal in future versions<5>-Footnote-7831085
Node: 削除<2>831141
Ref: whatsnew/3 12 removed831266
Ref: 725831266
Ref: whatsnew/3 12 whatsnew312-removed831266
Ref: 726831266
Node: asynchat and asyncore831699
Ref: whatsnew/3 12 asynchat-and-asyncore831790
Ref: 727831790
Ref: asynchat and asyncore-Footnote-1832106
Ref: asynchat and asyncore-Footnote-2832148
Node: configparser<4>832203
Ref: whatsnew/3 12 configparser832312
Ref: 728832312
Ref: configparser<4>-Footnote-1832969
Node: distutils833024
Ref: whatsnew/3 12 distutils833121
Ref: 72b833121
Ref: whatsnew/3 12 whatsnew312-removed-distutils833121
Ref: 72c833121
Ref: distutils-Footnote-1833550
Ref: distutils-Footnote-2833592
Node: ensurepip833647
Ref: whatsnew/3 12 ensurepip833736
Ref: 72d833736
Ref: ensurepip-Footnote-1834757
Node: enum<2>834812
Ref: whatsnew/3 12 enum834898
Ref: 72e834898
Ref: enum<2>-Footnote-1835132
Node: ftplib835187
Ref: whatsnew/3 12 ftplib835268
Ref: 72f835268
Ref: ftplib-Footnote-1835509
Node: gzip835564
Ref: whatsnew/3 12 gzip835645
Ref: 730835645
Ref: gzip-Footnote-1836041
Node: hashlib836096
Ref: whatsnew/3 12 hashlib836183
Ref: 732836183
Ref: hashlib-Footnote-1836602
Ref: hashlib-Footnote-2836644
Node: importlib<2>836699
Ref: whatsnew/3 12 importlib836785
Ref: 734836785
Ref: importlib<2>-Footnote-1837675
Ref: importlib<2>-Footnote-2837730
Ref: importlib<2>-Footnote-3837785
Ref: importlib<2>-Footnote-4837840
Ref: importlib<2>-Footnote-5837895
Node: imp837950
Ref: whatsnew/3 12 imp838034
Ref: 735838034
Ref: whatsnew/3 12 whatsnew312-removed-imp838034
Ref: 736838034
Ref: imp-Footnote-1842181
Node: io<4>842236
Ref: whatsnew/3 12 io842317
Ref: 73f842317
Ref: io<4>-Footnote-1842730
Node: locale<2>842785
Ref: whatsnew/3 12 locale842868
Ref: 741842868
Ref: locale<2>-Footnote-1843136
Node: smtpd843191
Ref: whatsnew/3 12 smtpd843279
Ref: 743843279
Ref: smtpd-Footnote-1843633
Ref: smtpd-Footnote-2843675
Ref: smtpd-Footnote-3843718
Node: sqlite3<4>843773
Ref: whatsnew/3 12 id2843858
Ref: 744843858
Ref: sqlite3<4>-Footnote-1844592
Node: ssl<3>844647
Ref: whatsnew/3 12 ssl844738
Ref: 745844738
Ref: ssl<3>-Footnote-1845795
Ref: ssl<3>-Footnote-2845850
Ref: ssl<3>-Footnote-3845905
Ref: ssl<3>-Footnote-4845961
Node: unittest<4>846016
Ref: whatsnew/3 12 id3846110
Ref: 749846110
Ref: whatsnew/3 12 unittest-testcase-removed-aliases846212
Ref: 67f846212
Ref: unittest<4>-Footnote-1850989
Node: webbrowser<3>851044
Ref: whatsnew/3 12 webbrowser851153
Ref: 755851153
Ref: webbrowser<3>-Footnote-1851460
Node: xml etree ElementTree851516
Ref: whatsnew/3 12 xml-etree-elementtree851626
Ref: 756851626
Ref: xml etree ElementTree-Footnote-1852089
Node: zipimport<2>852144
Ref: whatsnew/3 12 zipimport852250
Ref: 758852250
Ref: zipimport<2>-Footnote-1852585
Ref: zipimport<2>-Footnote-2852627
Node: その他852682
Ref: whatsnew/3 12 others852758
Ref: 759852758
Ref: その他-Footnote-1853764
Ref: その他-Footnote-2853818
Ref: その他-Footnote-3853873
Ref: その他-Footnote-4853928
Ref: その他-Footnote-5853983
Node: Python 3 12 への移植854038
Ref: whatsnew/3 12 porting-to-python-3-12854167
Ref: 75a854167
Ref: whatsnew/3 12 whatsnew312-porting-to-python312854167
Ref: 6f3854167
Node: Python API の変更<3>854435
Ref: whatsnew/3 12 changes-in-the-python-api854519
Ref: 75b854519
Ref: Python API の変更<3>-Footnote-1860792
Ref: Python API の変更<3>-Footnote-2860847
Ref: Python API の変更<3>-Footnote-3860902
Ref: Python API の変更<3>-Footnote-4860945
Ref: Python API の変更<3>-Footnote-5861000
Ref: Python API の変更<3>-Footnote-6861055
Ref: Python API の変更<3>-Footnote-7861110
Ref: Python API の変更<3>-Footnote-8861166
Ref: Python API の変更<3>-Footnote-9861208
Ref: Python API の変更<3>-Footnote-10861250
Ref: Python API の変更<3>-Footnote-11861293
Node: Build Changes<2>861350
Ref: whatsnew/3 12 build-changes861488
Ref: 766861488
Ref: Build Changes<2>-Footnote-1863172
Ref: Build Changes<2>-Footnote-2863227
Ref: Build Changes<2>-Footnote-3863282
Ref: Build Changes<2>-Footnote-4863337
Ref: Build Changes<2>-Footnote-5863392
Ref: Build Changes<2>-Footnote-6863447
Node: C API の変更<4>863502
Ref: whatsnew/3 12 c-api-changes863607
Ref: 767863607
Node: 新しい機能<5>863805
Ref: whatsnew/3 12 id4863914
Ref: 768863914
Ref: whatsnew/3 12 whatsnew312-pep697863960
Ref: 677863960
Ref: whatsnew/3 12 whatsnew312-pep683870102
Ref: 678870102
Ref: 新しい機能<5>-Footnote-1871843
Ref: 新しい機能<5>-Footnote-2871885
Ref: 新しい機能<5>-Footnote-3871927
Ref: 新しい機能<5>-Footnote-4871983
Ref: 新しい機能<5>-Footnote-5872025
Ref: 新しい機能<5>-Footnote-6872081
Ref: 新しい機能<5>-Footnote-7872136
Ref: 新しい機能<5>-Footnote-8872191
Ref: 新しい機能<5>-Footnote-9872246
Ref: 新しい機能<5>-Footnote-10872301
Ref: 新しい機能<5>-Footnote-11872357
Ref: 新しい機能<5>-Footnote-12872413
Ref: 新しい機能<5>-Footnote-13872469
Ref: 新しい機能<5>-Footnote-14872525
Ref: 新しい機能<5>-Footnote-15872581
Ref: 新しい機能<5>-Footnote-16872638
Ref: 新しい機能<5>-Footnote-17872695
Ref: 新しい機能<5>-Footnote-18872752
Ref: 新しい機能<5>-Footnote-19872809
Ref: 新しい機能<5>-Footnote-20872852
Ref: 新しい機能<5>-Footnote-21872908
Ref: 新しい機能<5>-Footnote-22872951
Ref: 新しい機能<5>-Footnote-23873008
Node: Python 3 12 への移植<2>873065
Ref: whatsnew/3 12 id5873195
Ref: 791873195
Ref: Python 3 12 への移植<2>-Footnote-1880638
Ref: Python 3 12 への移植<2>-Footnote-2880693
Ref: Python 3 12 への移植<2>-Footnote-3880748
Ref: Python 3 12 への移植<2>-Footnote-4880803
Ref: Python 3 12 への移植<2>-Footnote-5880858
Ref: Python 3 12 への移植<2>-Footnote-6880913
Ref: Python 3 12 への移植<2>-Footnote-7880968
Ref: Python 3 12 への移植<2>-Footnote-8881024
Node: 非推奨<3>881080
Ref: whatsnew/3 12 id6881201
Ref: 7a9881201
Ref: 非推奨<3>-Footnote-1886604
Ref: 非推奨<3>-Footnote-2886646
Ref: 非推奨<3>-Footnote-3886702
Ref: 非推奨<3>-Footnote-4886757
Ref: 非推奨<3>-Footnote-5886812
Ref: 非推奨<3>-Footnote-6886867
Ref: 非推奨<3>-Footnote-7886923
Ref: 非推奨<3>-Footnote-8886979
Node: Pending removal in Python 3 14<4>887035
Ref: whatsnew/3 12 id7887159
Ref: 7b3887159
Ref: Pending removal in Python 3 14<4>-Footnote-1887479
Ref: Pending removal in Python 3 14<4>-Footnote-2887521
Ref: Pending removal in Python 3 14<4>-Footnote-3887577
Node: Pending removal in Python 3 15<6>887632
Ref: whatsnew/3 12 id8887798
Ref: 7b4887798
Ref: Pending removal in Python 3 15<6>-Footnote-1894429
Ref: Pending removal in Python 3 15<6>-Footnote-2894482
Node: Pending removal in Python 3 16<6>894535
Ref: whatsnew/3 12 id9894705
Ref: 7b5894705
Node: Pending removal in future versions<6>894828
Ref: whatsnew/3 12 id10894956
Ref: 7b6894956
Node: 削除<3>896795
Ref: whatsnew/3 12 id11896880
Ref: 7b7896880
Ref: 削除<3>-Footnote-1897731
Ref: 削除<3>-Footnote-2897786
Ref: 削除<3>-Footnote-3897828
Node: What's New In Python 3 11897883
Ref: whatsnew/3 11 doc898033
Ref: 7b8898033
Ref: whatsnew/3 11 translation-repo898033
Ref: 7b9898033
Ref: whatsnew/3 11 what-s-new-in-python-3-11898033
Ref: 7ba898033
Node: 概要 -- リリースハイライト<4>899335
Ref: whatsnew/3 11 summary-release-highlights899464
Ref: 7bb899464
Ref: whatsnew/3 11 whatsnew311-summary899464
Ref: 7bc899464
Ref: 概要 -- リリースハイライト<4>-Footnote-1901260
Ref: 概要 -- リリースハイライト<4>-Footnote-2901302
Ref: 概要 -- リリースハイライト<4>-Footnote-3901327
Ref: 概要 -- リリースハイライト<4>-Footnote-4901369
Ref: 概要 -- リリースハイライト<4>-Footnote-5901411
Node: 新しい機能<6>901453
Ref: whatsnew/3 11 new-features901636
Ref: 7cc901636
Ref: whatsnew/3 11 whatsnew311-features901636
Ref: 7cd901636
Node: PEP 657 トレースバックのエラー位置の詳細化902089
Ref: whatsnew/3 11 pep-657-fine-grained-error-locations-in-tracebacks902249
Ref: 7ce902249
Ref: whatsnew/3 11 whatsnew311-pep657902249
Ref: 7c0902249
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-1905348
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-2905390
Node: PEP 654 例外グループと except*905455
Ref: whatsnew/3 11 pep-654-exception-groups-and-except905677
Ref: 7d4905677
Ref: whatsnew/3 11 whatsnew311-pep654905677
Ref: 7be905677
Ref: PEP 654 例外グループと except*-Footnote-1906525
Ref: PEP 654 例外グループと except*-Footnote-2906567
Ref: PEP 654 例外グループと except*-Footnote-3906609
Node: PEP 678 ノートによって例外を充実させる906674
Ref: whatsnew/3 11 pep-678-exceptions-can-be-enriched-with-notes906876
Ref: 7d5906876
Ref: whatsnew/3 11 whatsnew311-pep678906876
Ref: 7bf906876
Ref: PEP 678 ノートによって例外を充実させる-Footnote-1907526
Ref: PEP 678 ノートによって例外を充実させる-Footnote-2907568
Node: Windows py exe ランチャーの改善907633
Ref: whatsnew/3 11 whatsnew311-windows-launcher907789
Ref: 7d8907789
Ref: whatsnew/3 11 windows-py-exe-launcher-improvements907789
Ref: 7d9907789
Ref: whatsnew/3 11 new-feat-related-type-hints-311909224
Ref: 7db909224
Ref: Windows py exe ランチャーの改善-Footnote-1909262
Ref: Windows py exe ランチャーの改善-Footnote-2909304
Node: 型ヒントに関連する新しい機能<2>909335
Ref: whatsnew/3 11 new-features-related-to-type-hints909505
Ref: 7dc909505
Ref: whatsnew/3 11 whatsnew311-typing-features909505
Ref: 7dd909505
Ref: 型ヒントに関連する新しい機能<2>-Footnote-1910161
Node: PEP 646 Variadic generics910203
Ref: whatsnew/3 11 pep-646-variadic-generics910389
Ref: 7de910389
Ref: whatsnew/3 11 whatsnew311-pep646910389
Ref: 7c4910389
Ref: PEP 646 Variadic generics-Footnote-1911389
Ref: PEP 646 Variadic generics-Footnote-2911431
Ref: PEP 646 Variadic generics-Footnote-3911473
Ref: PEP 646 Variadic generics-Footnote-4911515
Node: PEP 655 Marking individual TypedDict items as required or not-required911580
Ref: whatsnew/3 11 pep-655-marking-individual-typeddict-items-as-required-or-not-required911791
Ref: 7df911791
Ref: whatsnew/3 11 whatsnew311-pep655911791
Ref: 7c5911791
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-1913039
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-2913081
Node: PEP 673 Self 型913146
Ref: whatsnew/3 11 pep-673-self-type913369
Ref: 7e2913369
Ref: whatsnew/3 11 whatsnew311-pep673913369
Ref: 7c6913369
Ref: PEP 673 Self 型-Footnote-1914438
Ref: PEP 673 Self 型-Footnote-2914519
Ref: PEP 673 Self 型-Footnote-3914561
Node: PEP 675 Arbitrary literal string type914626
Ref: whatsnew/3 11 pep-675-arbitrary-literal-string-type914808
Ref: 7e5914808
Ref: whatsnew/3 11 whatsnew311-pep675914808
Ref: 7c7914808
Ref: PEP 675 Arbitrary literal string type-Footnote-1916230
Ref: PEP 675 Arbitrary literal string type-Footnote-2916272
Node: PEP 681 Data class transforms916337
Ref: whatsnew/3 11 pep-681-data-class-transforms916532
Ref: 7e7916532
Ref: whatsnew/3 11 whatsnew311-pep681916532
Ref: 7c8916532
Ref: PEP 681 Data class transforms-Footnote-1917587
Ref: PEP 681 Data class transforms-Footnote-2917629
Node: PEP 563 may not be the future917684
Ref: whatsnew/3 11 pep-563-may-not-be-the-future917833
Ref: 7e8917833
Ref: whatsnew/3 11 whatsnew311-pep563-deferred917833
Ref: 7e9917833
Ref: PEP 563 may not be the future-Footnote-1918228
Ref: PEP 563 may not be the future-Footnote-2918270
Node: その他の言語変更<3>918381
Ref: whatsnew/3 11 other-language-changes918572
Ref: 7ea918572
Ref: whatsnew/3 11 whatsnew311-other-lang-changes918572
Ref: 7eb918572
Ref: whatsnew/3 11 whatsnew311-pythonsafepath920371
Ref: 7c3920371
Ref: その他の言語変更<3>-Footnote-1921717
Ref: その他の言語変更<3>-Footnote-2921782
Ref: その他の言語変更<3>-Footnote-3921847
Ref: その他の言語変更<3>-Footnote-4921912
Ref: その他の言語変更<3>-Footnote-5921977
Ref: その他の言語変更<3>-Footnote-6922032
Ref: その他の言語変更<3>-Footnote-7922097
Ref: その他の言語変更<3>-Footnote-8922152
Ref: その他の言語変更<3>-Footnote-9922194
Ref: その他の言語変更<3>-Footnote-10922249
Node: その他の CPython の実装の変更922305
Ref: whatsnew/3 11 other-cpython-implementation-changes922478
Ref: 7fb922478
Ref: whatsnew/3 11 whatsnew311-other-implementation-changes922478
Ref: 7fc922478
Ref: その他の CPython の実装の変更-Footnote-1925726
Ref: その他の CPython の実装の変更-Footnote-2925791
Ref: その他の CPython の実装の変更-Footnote-3925833
Ref: その他の CPython の実装の変更-Footnote-4925898
Ref: その他の CPython の実装の変更-Footnote-5925963
Ref: その他の CPython の実装の変更-Footnote-6926028
Ref: その他の CPython の実装の変更-Footnote-7926093
Ref: その他の CPython の実装の変更-Footnote-8926158
Node: 新たなモジュール<3>926214
Ref: whatsnew/3 11 new-modules926393
Ref: 80c926393
Ref: whatsnew/3 11 whatsnew311-new-modules926393
Ref: 80d926393
Ref: 新たなモジュール<3>-Footnote-1926760
Ref: 新たなモジュール<3>-Footnote-2926785
Ref: 新たなモジュール<3>-Footnote-3926827
Ref: 新たなモジュール<3>-Footnote-4926892
Ref: 新たなモジュール<3>-Footnote-5926934
Node: 改良されたモジュール<3>926999
Ref: whatsnew/3 11 improved-modules927151
Ref: 80e927151
Ref: whatsnew/3 11 whatsnew311-improved-modules927151
Ref: 80f927151
Node: asyncio<6>927981
Ref: whatsnew/3 11 asyncio928080
Ref: 810928080
Ref: whatsnew/3 11 whatsnew311-asyncio928080
Ref: 811928080
Ref: asyncio<6>-Footnote-1929998
Ref: asyncio<6>-Footnote-2930053
Ref: asyncio<6>-Footnote-3930108
Ref: asyncio<6>-Footnote-4930163
Ref: asyncio<6>-Footnote-5930218
Ref: asyncio<6>-Footnote-6930283
Node: contextlib930348
Ref: whatsnew/3 11 contextlib930474
Ref: 81e930474
Ref: whatsnew/3 11 whatsnew311-contextlib930474
Ref: 81f930474
Ref: contextlib-Footnote-1930789
Node: データクラス930854
Ref: whatsnew/3 11 dataclasses930981
Ref: 822930981
Ref: whatsnew/3 11 whatsnew311-dataclasses930981
Ref: 823930981
Ref: データクラス-Footnote-1931331
Node: datetime<2>931396
Ref: whatsnew/3 11 datetime931520
Ref: 825931520
Ref: whatsnew/3 11 whatsnew311-datetime931520
Ref: 826931520
Ref: datetime<2>-Footnote-1932059
Ref: datetime<2>-Footnote-2932114
Node: enum<3>932169
Ref: whatsnew/3 11 enum932280
Ref: 82b932280
Ref: whatsnew/3 11 whatsnew311-enum932280
Ref: 82c932280
Node: fcntl934924
Ref: whatsnew/3 11 fcntl935036
Ref: 845935036
Ref: whatsnew/3 11 whatsnew311-fcntl935036
Ref: 846935036
Node: fractions<4>935271
Ref: whatsnew/3 11 fractions935388
Ref: 847935388
Ref: whatsnew/3 11 whatsnew311-fractions935388
Ref: 848935388
Ref: fractions<4>-Footnote-1935806
Ref: fractions<4>-Footnote-2935848
Ref: fractions<4>-Footnote-3935913
Node: functools<2>935978
Ref: whatsnew/3 11 functools936097
Ref: 849936097
Ref: whatsnew/3 11 whatsnew311-functools936097
Ref: 84a936097
Ref: functools<2>-Footnote-1937169
Node: gzip<2>937234
Ref: whatsnew/3 11 gzip937351
Ref: 84c937351
Ref: whatsnew/3 11 whatsnew311-gzip937351
Ref: 84d937351
Ref: gzip<2>-Footnote-1938048
Node: hashlib<2>938104
Ref: whatsnew/3 11 hashlib938226
Ref: 850938226
Ref: whatsnew/3 11 whatsnew311-hashlib938226
Ref: 851938226
Ref: hashlib<2>-Footnote-1939047
Ref: hashlib<2>-Footnote-2939079
Ref: hashlib<2>-Footnote-3939144
Ref: hashlib<2>-Footnote-4939209
Node: IDLE と idelelib939264
Ref: whatsnew/3 11 idle-and-idlelib939389
Ref: 855939389
Ref: whatsnew/3 11 whatsnew311-idle939389
Ref: 856939389
Ref: IDLE と idelelib-Footnote-1939724
Ref: IDLE と idelelib-Footnote-2939789
Node: inspect<3>939844
Ref: whatsnew/3 11 inspect939968
Ref: 857939968
Ref: whatsnew/3 11 whatsnew311-inspect939968
Ref: 858939968
Ref: inspect<3>-Footnote-1941055
Ref: inspect<3>-Footnote-2941120
Ref: inspect<3>-Footnote-3941185
Ref: inspect<3>-Footnote-4941227
Node: locale<3>941282
Ref: whatsnew/3 11 locale941396
Ref: 864941396
Ref: whatsnew/3 11 whatsnew311-locale941396
Ref: 865941396
Node: logging941623
Ref: whatsnew/3 11 logging941734
Ref: 868941734
Ref: whatsnew/3 11 whatsnew311-logging941734
Ref: 869941734
Ref: logging-Footnote-1942400
Ref: logging-Footnote-2942455
Node: math<4>942510
Ref: whatsnew/3 11 math942623
Ref: 86f942623
Ref: whatsnew/3 11 whatsnew311-math942623
Ref: 870942623
Ref: math<4>-Footnote-1943396
Ref: math<4>-Footnote-2943461
Ref: math<4>-Footnote-3943526
Ref: math<4>-Footnote-4943591
Node: operator<2>943656
Ref: whatsnew/3 11 operator943767
Ref: 875943767
Ref: whatsnew/3 11 whatsnew311-operator943767
Ref: 876943767
Ref: operator<2>-Footnote-1944029
Node: os<4>944094
Ref: whatsnew/3 11 os944208
Ref: 877944208
Ref: whatsnew/3 11 whatsnew311-os944208
Ref: 878944208
Ref: os<4>-Footnote-1944457
Node: pathlib<7>944522
Ref: whatsnew/3 11 pathlib944630
Ref: 879944630
Ref: whatsnew/3 11 whatsnew311-pathlib944630
Ref: 87a944630
Ref: pathlib<7>-Footnote-1944951
Ref: pathlib<7>-Footnote-2945016
Node: re<4>945081
Ref: whatsnew/3 11 re945193
Ref: 87d945193
Ref: whatsnew/3 11 whatsnew311-re945193
Ref: 87e945193
Ref: re<4>-Footnote-1945495
Node: shutil<3>945561
Ref: whatsnew/3 11 shutil945672
Ref: 87f945672
Ref: whatsnew/3 11 whatsnew311-shutil945672
Ref: 880945672
Ref: shutil<3>-Footnote-1945866
Node: socket<2>945931
Ref: whatsnew/3 11 socket946047
Ref: 881946047
Ref: whatsnew/3 11 whatsnew311-socket946047
Ref: 882946047
Ref: socket<2>-Footnote-1946460
Ref: socket<2>-Footnote-2946525
Node: sqlite3<5>946590
Ref: whatsnew/3 11 sqlite3946703
Ref: 884946703
Ref: whatsnew/3 11 whatsnew311-sqlite3946703
Ref: 885946703
Ref: sqlite3<5>-Footnote-1949047
Ref: sqlite3<5>-Footnote-2949112
Ref: sqlite3<5>-Footnote-3949177
Ref: sqlite3<5>-Footnote-4949242
Ref: sqlite3<5>-Footnote-5949307
Ref: sqlite3<5>-Footnote-6949372
Ref: sqlite3<5>-Footnote-7949437
Ref: sqlite3<5>-Footnote-8949502
Ref: sqlite3<5>-Footnote-9949567
Ref: sqlite3<5>-Footnote-10949632
Ref: sqlite3<5>-Footnote-11949698
Node: string949764
Ref: whatsnew/3 11 string949874
Ref: 894949874
Ref: whatsnew/3 11 whatsnew311-string949874
Ref: 895949874
Ref: string-Footnote-1950199
Node: sys<4>950254
Ref: whatsnew/3 11 sys950366
Ref: 899950366
Ref: whatsnew/3 11 whatsnew311-sys950366
Ref: 89a950366
Ref: sys<4>-Footnote-1951059
Ref: sys<4>-Footnote-2951124
Ref: sys<4>-Footnote-3951189
Node: sysconfig<2>951244
Ref: whatsnew/3 11 sysconfig951361
Ref: 89e951361
Ref: whatsnew/3 11 whatsnew311-sysconfig951361
Ref: 89f951361
Ref: sysconfig<2>-Footnote-1952174
Node: tempfile<3>952239
Ref: whatsnew/3 11 tempfile952362
Ref: 8a1952362
Ref: whatsnew/3 11 whatsnew311-tempfile952362
Ref: 8a2952362
Ref: tempfile<3>-Footnote-1952771
Node: threading<3>952826
Ref: whatsnew/3 11 threading952944
Ref: 8a6952944
Ref: whatsnew/3 11 whatsnew311-threading952944
Ref: 8a7952944
Ref: threading<3>-Footnote-1953449
Node: time<2>953514
Ref: whatsnew/3 11 time953631
Ref: 8ab953631
Ref: whatsnew/3 11 whatsnew311-time953631
Ref: 8ac953631
Ref: time<2>-Footnote-1954432
Ref: time<2>-Footnote-2954497
Ref: time<2>-Footnote-3954594
Ref: time<2>-Footnote-4954659
Node: tkinter<4>954724
Ref: whatsnew/3 11 tkinter954841
Ref: 8ae954841
Ref: whatsnew/3 11 whatsnew311-tkinter954841
Ref: 8af954841
Ref: tkinter<4>-Footnote-1955124
Node: traceback<2>955179
Ref: whatsnew/3 11 traceback955298
Ref: 8b1955298
Ref: whatsnew/3 11 whatsnew311-traceback955298
Ref: 8b2955298
Ref: traceback<2>-Footnote-1955790
Ref: traceback<2>-Footnote-2955855
Node: typing<5>955920
Ref: whatsnew/3 11 typing956043
Ref: 8b5956043
Ref: whatsnew/3 11 whatsnew311-typing956043
Ref: 8b6956043
Ref: typing<5>-Footnote-1959337
Ref: typing<5>-Footnote-2959392
Ref: typing<5>-Footnote-3959447
Ref: typing<5>-Footnote-4959502
Ref: typing<5>-Footnote-5959557
Ref: typing<5>-Footnote-6959622
Ref: typing<5>-Footnote-7959677
Ref: typing<5>-Footnote-8959732
Ref: typing<5>-Footnote-9959787
Ref: typing<5>-Footnote-10959842
Ref: typing<5>-Footnote-11959898
Ref: typing<5>-Footnote-12959954
Ref: typing<5>-Footnote-13960010
Ref: typing<5>-Footnote-14960066
Ref: typing<5>-Footnote-15960122
Node: unicodedata<4>960178
Ref: whatsnew/3 11 unicodedata960300
Ref: 8c5960300
Ref: whatsnew/3 11 whatsnew311-unicodedata960300
Ref: 8c6960300
Ref: unicodedata<4>-Footnote-1960499
Node: unittest<5>960564
Ref: whatsnew/3 11 unittest960684
Ref: 8c7960684
Ref: whatsnew/3 11 whatsnew311-unittest960684
Ref: 8c8960684
Ref: unittest<5>-Footnote-1961086
Node: venv<2>961151
Ref: whatsnew/3 11 venv961268
Ref: 8cd961268
Ref: whatsnew/3 11 whatsnew311-venv961268
Ref: 8ce961268
Ref: venv<2>-Footnote-1961891
Node: warnings<2>961956
Ref: whatsnew/3 11 warnings962072
Ref: 8cf962072
Ref: whatsnew/3 11 whatsnew311-warnings962072
Ref: 8d0962072
Ref: warnings<2>-Footnote-1962403
Node: zipfile<2>962468
Ref: whatsnew/3 11 whatsnew311-zipfile962568
Ref: 8d2962568
Ref: whatsnew/3 11 zipfile962568
Ref: 8d3962568
Ref: zipfile<2>-Footnote-1963157
Ref: zipfile<2>-Footnote-2963222
Ref: zipfile<2>-Footnote-3963277
Node: 最適化<4>963332
Ref: whatsnew/3 11 optimizations963471
Ref: 8da963471
Ref: whatsnew/3 11 whatsnew311-optimizations963471
Ref: 8db963471
Ref: 最適化<4>-Footnote-1965870
Ref: 最適化<4>-Footnote-2965935
Ref: 最適化<4>-Footnote-3965990
Ref: 最適化<4>-Footnote-4966045
Ref: 最適化<4>-Footnote-5966100
Ref: 最適化<4>-Footnote-6966165
Ref: 最適化<4>-Footnote-7966220
Ref: 最適化<4>-Footnote-8966285
Ref: 最適化<4>-Footnote-9966340
Node: Faster CPython966405
Ref: whatsnew/3 11 faster-cpython966549
Ref: 8e6966549
Ref: whatsnew/3 11 whatsnew311-faster-cpython966549
Ref: 7bd966549
Ref: Faster CPython-Footnote-1967130
Ref: Faster CPython-Footnote-2967196
Node: Faster Startup967244
Ref: whatsnew/3 11 faster-startup967332
Ref: 8e9967332
Ref: whatsnew/3 11 whatsnew311-faster-startup967332
Ref: 8e7967332
Node: Frozen imports / Static code objects967430
Ref: whatsnew/3 11 frozen-imports-static-code-objects967517
Ref: 8ea967517
Ref: whatsnew/3 11 whatsnew311-faster-imports967517
Ref: 8eb967517
Node: Faster Runtime968362
Ref: whatsnew/3 11 faster-runtime968463
Ref: 8ed968463
Ref: whatsnew/3 11 whatsnew311-faster-runtime968463
Ref: 8e8968463
Node: Cheaper lazy Python frames968702
Ref: whatsnew/3 11 cheaper-lazy-python-frames968817
Ref: 8ee968817
Ref: whatsnew/3 11 whatsnew311-lazy-python-frames968817
Ref: 8ef968817
Ref: whatsnew/3 11 inline-calls969760
Ref: 8f3969760
Ref: Cheaper lazy Python frames-Footnote-1969798
Node: Inlined Python function calls969863
Ref: whatsnew/3 11 inlined-python-function-calls970028
Ref: 8f4970028
Ref: whatsnew/3 11 whatsnew311-inline-calls970028
Ref: 8f5970028
Ref: Inlined Python function calls-Footnote-1970976
Node: PEP 659 Specializing Adaptive Interpreter971041
Ref: whatsnew/3 11 pep-659-specializing-adaptive-interpreter971171
Ref: 8f6971171
Ref: whatsnew/3 11 whatsnew311-pep659971171
Ref: 49f971171
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-1978579
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-2978621
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-3978663
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-4978788
Node: Misc979013
Ref: whatsnew/3 11 misc979103
Ref: 8f7979103
Ref: whatsnew/3 11 whatsnew311-faster-cpython-misc979103
Ref: 8f8979103
Ref: Misc-Footnote-1980110
Ref: Misc-Footnote-2980175
Ref: Misc-Footnote-3980240
Ref: Misc-Footnote-4980305
Ref: Misc-Footnote-5980370
Ref: Misc-Footnote-6980441
Node: FAQ980496
Ref: whatsnew/3 11 faq980577
Ref: 8fa980577
Ref: whatsnew/3 11 whatsnew311-faster-cpython-faq980577
Ref: 8fb980577
Node: How should I write my code to utilize these speedups?980868
Ref: whatsnew/3 11 faster-cpython-faq-my-code981004
Ref: 8fc981004
Ref: whatsnew/3 11 how-should-i-write-my-code-to-utilize-these-speedups981004
Ref: 8fd981004
Node: Will CPython 3 11 use more memory?981297
Ref: whatsnew/3 11 faster-cpython-faq-memory981486
Ref: 8fe981486
Ref: whatsnew/3 11 will-cpython-3-11-use-more-memory981486
Ref: 8ff981486
Node: I don't see any speedups in my workload Why?981747
Ref: whatsnew/3 11 faster-cpython-ymmv981907
Ref: 900981907
Ref: whatsnew/3 11 i-don-t-see-any-speedups-in-my-workload-why981907
Ref: 901981907
Node: Is there a JIT compiler?982491
Ref: whatsnew/3 11 faster-cpython-jit982608
Ref: 902982608
Ref: whatsnew/3 11 is-there-a-jit-compiler982608
Ref: 903982608
Node: About982726
Ref: whatsnew/3 11 about982794
Ref: 904982794
Ref: whatsnew/3 11 whatsnew311-faster-cpython-about982794
Ref: 905982794
Node: CPython バイトコードの変更<3>983103
Ref: whatsnew/3 11 cpython-bytecode-changes983247
Ref: 907983247
Ref: whatsnew/3 11 whatsnew311-bytecode-changes983247
Ref: 908983247
Node: New opcodes983807
Ref: whatsnew/3 11 new-opcodes983918
Ref: 90a983918
Ref: whatsnew/3 11 whatsnew311-added-opcodes983918
Ref: 90b983918
Ref: New opcodes-Footnote-1984731
Node: Replaced opcodes984773
Ref: whatsnew/3 11 replaced-opcodes984916
Ref: 914984916
Ref: whatsnew/3 11 whatsnew311-replaced-opcodes984916
Ref: 915984916
Ref: whatsnew/3 11 whatsnew311-changed-opcodes987634
Ref: 91c987634
Ref: whatsnew/3 11 whatsnew311-removed-opcodes987634
Ref: 91d987634
Ref: Replaced opcodes-Footnote-1987670
Node: Changed/removed opcodes987888
Ref: whatsnew/3 11 changed-removed-opcodes988011
Ref: 91e988011
Ref: whatsnew/3 11 whatsnew311-changed-removed-opcodes988011
Ref: 91f988011
Ref: whatsnew/3 11 whatsnew311-deprecated988599
Ref: 922988599
Ref: Changed/removed opcodes-Footnote-1988636
Node: 非推奨<4>988691
Ref: whatsnew/3 11 deprecated988851
Ref: 923988851
Ref: whatsnew/3 11 whatsnew311-python-api-deprecated988851
Ref: 924988851
Ref: whatsnew/3 11 whatsnew311-deprecated-language989008
Ref: 926989008
Node: Language/Builtins989082
Ref: whatsnew/3 11 language-builtins989172
Ref: 927989172
Ref: whatsnew/3 11 whatsnew311-deprecated-builtins989172
Ref: 928989172
Ref: Language/Builtins-Footnote-1990389
Ref: Language/Builtins-Footnote-2990454
Ref: Language/Builtins-Footnote-3990509
Ref: Language/Builtins-Footnote-4990564
Node: モジュール990629
Ref: whatsnew/3 11 modules990744
Ref: 929990744
Ref: whatsnew/3 11 whatsnew311-deprecated-modules990744
Ref: 92a990744
Ref: whatsnew/3 11 whatsnew311-pep594990790
Ref: 7c9990790
Ref: モジュール-Footnote-1993000
Ref: モジュール-Footnote-2993042
Ref: モジュール-Footnote-3993107
Ref: モジュール-Footnote-4993162
Ref: モジュール-Footnote-5993227
Ref: モジュール-Footnote-6993269
Ref: モジュール-Footnote-7993334
Node: Standard Library993399
Ref: whatsnew/3 11 standard-library993488
Ref: 92b993488
Ref: whatsnew/3 11 whatsnew311-deprecated-stdlib993488
Ref: 92c993488
Ref: whatsnew/3 11 whatsnew311-pending-removal998345
Ref: 934998345
Ref: Standard Library-Footnote-1998382
Ref: Standard Library-Footnote-2998447
Ref: Standard Library-Footnote-3998512
Ref: Standard Library-Footnote-4998567
Ref: Standard Library-Footnote-5998622
Ref: Standard Library-Footnote-6998677
Ref: Standard Library-Footnote-7998732
Ref: Standard Library-Footnote-8998797
Ref: Standard Library-Footnote-9998852
Ref: Standard Library-Footnote-10998907
Ref: Standard Library-Footnote-11998973
Ref: Standard Library-Footnote-12999038
Node: Pending Removal in Python 3 12999094
Ref: whatsnew/3 11 pending-removal-in-python-3-12999225
Ref: 935999225
Ref: whatsnew/3 11 whatsnew311-python-api-pending-removal999225
Ref: 936999225
Ref: whatsnew/3 11 whatsnew311-removed1004977
Ref: 93a1004977
Node: 削除<4>1004977
Ref: whatsnew/3 11 removed1005118
Ref: 93b1005118
Ref: whatsnew/3 11 whatsnew311-python-api-removed1005118
Ref: 93c1005118
Ref: whatsnew/3 11 whatsnew311-porting1009772
Ref: 9481009772
Ref: 削除<4>-Footnote-11009809
Ref: 削除<4>-Footnote-21009874
Ref: 削除<4>-Footnote-31009939
Ref: 削除<4>-Footnote-41010004
Ref: 削除<4>-Footnote-51010069
Ref: 削除<4>-Footnote-61010134
Ref: 削除<4>-Footnote-71010199
Ref: 削除<4>-Footnote-81010264
Ref: 削除<4>-Footnote-91010329
Ref: 削除<4>-Footnote-101010394
Ref: 削除<4>-Footnote-111010460
Ref: 削除<4>-Footnote-121010526
Ref: 削除<4>-Footnote-131010592
Ref: 削除<4>-Footnote-141010658
Ref: 削除<4>-Footnote-151010700
Node: Porting to Python 3 111010754
Ref: whatsnew/3 11 porting-to-python-3-111010881
Ref: 9491010881
Ref: whatsnew/3 11 whatsnew311-python-api-porting1010881
Ref: 94a1010881
Ref: Porting to Python 3 11-Footnote-11013922
Ref: Porting to Python 3 11-Footnote-21013987
Ref: Porting to Python 3 11-Footnote-31014042
Ref: Porting to Python 3 11-Footnote-41014107
Ref: Porting to Python 3 11-Footnote-51014172
Ref: Porting to Python 3 11-Footnote-61014237
Ref: Porting to Python 3 11-Footnote-71014302
Ref: Porting to Python 3 11-Footnote-81014367
Node: Build Changes<3>1014432
Ref: whatsnew/3 11 build-changes1014568
Ref: 9541014568
Ref: whatsnew/3 11 whatsnew311-build-changes1014568
Ref: 9551014568
Ref: Build Changes<3>-Footnote-11018796
Ref: Build Changes<3>-Footnote-21018838
Ref: Build Changes<3>-Footnote-31018887
Ref: Build Changes<3>-Footnote-41018920
Ref: Build Changes<3>-Footnote-51018952
Ref: Build Changes<3>-Footnote-61018978
Ref: Build Changes<3>-Footnote-71019007
Ref: Build Changes<3>-Footnote-81019062
Ref: Build Changes<3>-Footnote-91019117
Ref: Build Changes<3>-Footnote-101019172
Ref: Build Changes<3>-Footnote-111019216
Ref: Build Changes<3>-Footnote-121019300
Ref: Build Changes<3>-Footnote-131019366
Ref: Build Changes<3>-Footnote-141019432
Ref: Build Changes<3>-Footnote-151019498
Ref: Build Changes<3>-Footnote-161019546
Ref: Build Changes<3>-Footnote-171019612
Ref: Build Changes<3>-Footnote-181019678
Ref: Build Changes<3>-Footnote-191019706
Ref: Build Changes<3>-Footnote-201019772
Ref: Build Changes<3>-Footnote-211019835
Ref: Build Changes<3>-Footnote-221019863
Ref: Build Changes<3>-Footnote-231019929
Ref: Build Changes<3>-Footnote-241019995
Ref: Build Changes<3>-Footnote-251020061
Ref: Build Changes<3>-Footnote-261020127
Ref: Build Changes<3>-Footnote-271020177
Ref: Build Changes<3>-Footnote-281020243
Ref: Build Changes<3>-Footnote-291020309
Ref: Build Changes<3>-Footnote-301020375
Ref: Build Changes<3>-Footnote-311020441
Ref: Build Changes<3>-Footnote-321020507
Ref: Build Changes<3>-Footnote-331020573
Node: C API の変更<5>1020639
Ref: whatsnew/3 11 c-api-changes1020790
Ref: 9581020790
Ref: whatsnew/3 11 whatsnew311-c-api1020790
Ref: 9591020790
Node: 新しい機能<7>1021053
Ref: whatsnew/3 11 id51021160
Ref: 95a1021160
Ref: whatsnew/3 11 whatsnew311-c-api-new-features1021160
Ref: 95b1021160
Ref: 新しい機能<7>-Footnote-11024011
Ref: 新しい機能<7>-Footnote-21024076
Ref: 新しい機能<7>-Footnote-31024141
Ref: 新しい機能<7>-Footnote-41024206
Ref: 新しい機能<7>-Footnote-51024271
Ref: 新しい機能<7>-Footnote-61024336
Ref: 新しい機能<7>-Footnote-71024401
Ref: 新しい機能<7>-Footnote-81024466
Ref: 新しい機能<7>-Footnote-91024531
Node: Porting to Python 3 11<2>1024586
Ref: whatsnew/3 11 id61024714
Ref: 97c1024714
Ref: whatsnew/3 11 whatsnew311-c-api-porting1024714
Ref: 94b1024714
Ref: whatsnew/3 11 whatsnew311-pep6701024779
Ref: 7cb1024779
Ref: whatsnew/3 11 pyframeobject-3-11-hiding1032194
Ref: 98f1032194
Ref: Porting to Python 3 11<2>-Footnote-11038151
Ref: Porting to Python 3 11<2>-Footnote-21038214
Ref: Porting to Python 3 11<2>-Footnote-31038256
Ref: Porting to Python 3 11<2>-Footnote-41038311
Ref: Porting to Python 3 11<2>-Footnote-51038376
Ref: Porting to Python 3 11<2>-Footnote-61038441
Ref: Porting to Python 3 11<2>-Footnote-71038506
Ref: Porting to Python 3 11<2>-Footnote-81038548
Ref: Porting to Python 3 11<2>-Footnote-91038613
Ref: Porting to Python 3 11<2>-Footnote-101038668
Ref: Porting to Python 3 11<2>-Footnote-111038724
Ref: Porting to Python 3 11<2>-Footnote-121038790
Ref: Porting to Python 3 11<2>-Footnote-131038833
Ref: Porting to Python 3 11<2>-Footnote-141038899
Ref: Porting to Python 3 11<2>-Footnote-151038965
Ref: Porting to Python 3 11<2>-Footnote-161039031
Ref: Porting to Python 3 11<2>-Footnote-171039097
Ref: Porting to Python 3 11<2>-Footnote-181039163
Ref: Porting to Python 3 11<2>-Footnote-191039229
Ref: Porting to Python 3 11<2>-Footnote-201039285
Ref: Porting to Python 3 11<2>-Footnote-211039338
Ref: Porting to Python 3 11<2>-Footnote-221039404
Ref: Porting to Python 3 11<2>-Footnote-231039470
Ref: Porting to Python 3 11<2>-Footnote-241039523
Node: 非推奨<5>1039556
Ref: whatsnew/3 11 id71039699
Ref: 9981039699
Ref: whatsnew/3 11 whatsnew311-c-api-deprecated1039699
Ref: 9251039699
Ref: 非推奨<5>-Footnote-11040663
Ref: 非推奨<5>-Footnote-21040705
Ref: 非推奨<5>-Footnote-31040760
Node: Pending Removal in Python 3 12<2>1040825
Ref: whatsnew/3 11 id81040952
Ref: 99a1040952
Ref: whatsnew/3 11 whatsnew311-c-api-pending-removal1040952
Ref: 9371040952
Node: 削除<5>1041702
Ref: whatsnew/3 11 id91041808
Ref: 99c1041808
Ref: whatsnew/3 11 whatsnew311-c-api-removed1041808
Ref: 93d1041808
Ref: whatsnew/3 11 whatsnew311-pep6241044064
Ref: 7ca1044064
Ref: 削除<5>-Footnote-11045024
Ref: 削除<5>-Footnote-21045089
Ref: 削除<5>-Footnote-31045154
Ref: 削除<5>-Footnote-41045219
Ref: 削除<5>-Footnote-51045284
Ref: 削除<5>-Footnote-61045349
Ref: 削除<5>-Footnote-71045414
Ref: 削除<5>-Footnote-81045479
Ref: 削除<5>-Footnote-91045544
Ref: 削除<5>-Footnote-101045609
Ref: 削除<5>-Footnote-111045652
Ref: 削除<5>-Footnote-121045712
Node: Python 3 11 4での重要な変更点1045778
Ref: whatsnew/3 11 notable-changes-in-3-11-41045950
Ref: 9a21045950
Node: tarfile<2>1046066
Ref: whatsnew/3 11 tarfile1046150
Ref: 9a31046150
Ref: tarfile<2>-Footnote-11046754
Node: Python 3 11 5での重要な変更点1046796
Ref: whatsnew/3 11 notable-changes-in-3-11-51046941
Ref: 9a41046941
Node: OpenSSL1047046
Ref: whatsnew/3 11 openssl1047127
Ref: 9a51047127
Node: What's New In Python 3 101047246
Ref: whatsnew/3 10 doc1047395
Ref: 9a61047395
Ref: whatsnew/3 10 translation-repo1047395
Ref: 9a71047395
Ref: whatsnew/3 10 what-s-new-in-python-3-101047395
Ref: 9a81047395
Node: 概要 -- リリースハイライト<5>1048612
Ref: whatsnew/3 10 summary-release-highlights1048741
Ref: 9a91048741
Ref: 概要 -- リリースハイライト<5>-Footnote-11050011
Ref: 概要 -- リリースハイライト<5>-Footnote-21050053
Ref: 概要 -- リリースハイライト<5>-Footnote-31050095
Ref: 概要 -- リリースハイライト<5>-Footnote-41050137
Ref: 概要 -- リリースハイライト<5>-Footnote-51050202
Ref: 概要 -- リリースハイライト<5>-Footnote-61050244
Ref: 概要 -- リリースハイライト<5>-Footnote-71050286
Ref: 概要 -- リリースハイライト<5>-Footnote-81050328
Ref: 概要 -- リリースハイライト<5>-Footnote-91050370
Ref: 概要 -- リリースハイライト<5>-Footnote-101050412
Ref: 概要 -- リリースハイライト<5>-Footnote-111050455
Ref: 概要 -- リリースハイライト<5>-Footnote-121050498
Ref: 概要 -- リリースハイライト<5>-Footnote-131050541
Ref: 概要 -- リリースハイライト<5>-Footnote-141050584
Ref: 概要 -- リリースハイライト<5>-Footnote-151050627
Node: 新しい機能<8>1050670
Ref: whatsnew/3 10 new-features1050853
Ref: 9aa1050853
Node: カッコ内のコンテキストマネージャー1051336
Ref: whatsnew/3 10 parenthesized-context-managers1051487
Ref: 9ab1051487
Ref: whatsnew/3 10 whatsnew310-pep5631051487
Ref: 9ac1051487
Ref: カッコ内のコンテキストマネージャー-Footnote-11052901
Ref: カッコ内のコンテキストマネージャー-Footnote-21052943
Ref: カッコ内のコンテキストマネージャー-Footnote-31053008
Node: エラーメッセージの改善<4>1053073
Ref: whatsnew/3 10 better-error-messages1053310
Ref: 9ad1053310
Node: SyntaxErrors1053468
Ref: whatsnew/3 10 syntaxerrors1053579
Ref: 9ae1053579
Ref: SyntaxErrors-Footnote-11059590
Ref: SyntaxErrors-Footnote-21059655
Ref: SyntaxErrors-Footnote-31059720
Ref: SyntaxErrors-Footnote-41059785
Ref: SyntaxErrors-Footnote-51059850
Ref: SyntaxErrors-Footnote-61059915
Ref: SyntaxErrors-Footnote-71059980
Ref: SyntaxErrors-Footnote-81060045
Ref: SyntaxErrors-Footnote-91060110
Ref: SyntaxErrors-Footnote-101060175
Ref: SyntaxErrors-Footnote-111060241
Node: IndentationErrors1060307
Ref: whatsnew/3 10 indentationerrors1060442
Ref: 9af1060442
Node: AttributeErrors1060912
Ref: whatsnew/3 10 attributeerrors1061045
Ref: 9b01061045
Ref: AttributeErrors-Footnote-11061795
Node: NameErrors1061860
Ref: whatsnew/3 10 nameerrors1061967
Ref: 9b11061967
Ref: NameErrors-Footnote-11062777
Node: PEP 626 デバッグおよびその他のツール用の正確な行番号。1062842
Ref: whatsnew/3 10 pep-626-precise-line-numbers-for-debugging-and-other-tools1063066
Ref: 9b21063066
Node: PEP 634 構造的パターンマッチ1063776
Ref: whatsnew/3 10 pep-634-structural-pattern-matching1064017
Ref: 9b41064017
Node: 構文と演算1064886
Ref: whatsnew/3 10 syntax-and-operations1065012
Ref: 9b51065012
Node: 宣言的なアプローチ1066234
Ref: whatsnew/3 10 declarative-approach1066415
Ref: 9b61066415
Node: 単純パターン リテラルとのマッチ1067908
Ref: whatsnew/3 10 simple-pattern-match-to-a-literal1068128
Ref: 9b71068128
Node: ワイルドカードがないときの振る舞い1069780
Ref: whatsnew/3 10 behavior-without-the-wildcard1069914
Ref: 9b81069914
Node: リテラルと変数を組み合わせたパターン1070680
Ref: whatsnew/3 10 patterns-with-a-literal-and-variable1070897
Ref: 9b91070897
Node: パターンとクラス1072108
Ref: whatsnew/3 10 patterns-and-classes1072306
Ref: 9ba1072306
Node: 位置パラメータを用いたパターン1073365
Ref: whatsnew/3 10 patterns-with-positional-parameters1073471
Ref: 9bb1073471
Node: ネストしたパターン1074100
Ref: whatsnew/3 10 nested-patterns1074289
Ref: 9bc1074289
Node: 複雑なパターンとワイルドカード1075071
Ref: whatsnew/3 10 complex-patterns-and-the-wildcard1075245
Ref: 9bd1075245
Node: ガード1075978
Ref: whatsnew/3 10 guard1076152
Ref: 9be1076152
Node: その他の主要な機能1076696
Ref: whatsnew/3 10 other-key-features1076816
Ref: 9bf1076816
Ref: その他の主要な機能-Footnote-11079733
Ref: その他の主要な機能-Footnote-21079775
Ref: その他の主要な機能-Footnote-31079817
Node: Optional EncodingWarning and encoding="locale" option1079859
Ref: whatsnew/3 10 optional-encodingwarning-and-encoding-locale-option1080014
Ref: 9c01080014
Ref: whatsnew/3 10 whatsnew310-pep5971080014
Ref: 9c11080014
Node: 型ヒントに関連する新しい機能<3>1080914
Ref: whatsnew/3 10 new-feat-related-type-hints1081084
Ref: 9c51081084
Ref: whatsnew/3 10 new-features-related-to-type-hints1081084
Ref: 9c61081084
Ref: 型ヒントに関連する新しい機能<3>-Footnote-11081587
Node: PEP 604 New Type Union Operator1081629
Ref: whatsnew/3 10 pep-604-new-type-union-operator1081792
Ref: 9c71081792
Ref: PEP 604 New Type Union Operator-Footnote-11082861
Ref: PEP 604 New Type Union Operator-Footnote-21082903
Ref: PEP 604 New Type Union Operator-Footnote-31082968
Node: PEP 612 Parameter Specification Variables1083033
Ref: whatsnew/3 10 pep-612-parameter-specification-variables1083222
Ref: 9ca1083222
Ref: PEP 612 Parameter Specification Variables-Footnote-11084503
Ref: PEP 612 Parameter Specification Variables-Footnote-21084545
Ref: PEP 612 Parameter Specification Variables-Footnote-31084587
Ref: PEP 612 Parameter Specification Variables-Footnote-41084652
Node: PEP 613 TypeAlias1084717
Ref: whatsnew/3 10 pep-613-typealias1084907
Ref: 9cf1084907
Ref: PEP 613 TypeAlias-Footnote-11085760
Ref: PEP 613 TypeAlias-Footnote-21085802
Ref: PEP 613 TypeAlias-Footnote-31085844
Node: PEP 647 User-Defined Type Guards1085909
Ref: whatsnew/3 10 pep-647-user-defined-type-guards1086049
Ref: 9d11086049
Ref: PEP 647 User-Defined Type Guards-Footnote-11086529
Ref: PEP 647 User-Defined Type Guards-Footnote-21086571
Node: その他の言語変更<4>1086636
Ref: whatsnew/3 10 other-language-changes1086815
Ref: 9d21086815
Ref: その他の言語変更<4>-Footnote-11091517
Ref: その他の言語変更<4>-Footnote-21091582
Ref: その他の言語変更<4>-Footnote-31091647
Ref: その他の言語変更<4>-Footnote-41091689
Ref: その他の言語変更<4>-Footnote-51091754
Ref: その他の言語変更<4>-Footnote-61091819
Ref: その他の言語変更<4>-Footnote-71091884
Ref: その他の言語変更<4>-Footnote-81091949
Ref: その他の言語変更<4>-Footnote-91092014
Ref: その他の言語変更<4>-Footnote-101092056
Ref: その他の言語変更<4>-Footnote-111092122
Ref: その他の言語変更<4>-Footnote-121092188
Ref: その他の言語変更<4>-Footnote-131092254
Ref: その他の言語変更<4>-Footnote-141092320
Ref: その他の言語変更<4>-Footnote-151092386
Ref: その他の言語変更<4>-Footnote-161092452
Node: 新たなモジュール<4>1092518
Ref: whatsnew/3 10 new-modules1092685
Ref: 9df1092685
Node: 改良されたモジュール<4>1092752
Ref: whatsnew/3 10 improved-modules1092904
Ref: 9e01092904
Node: asyncio<7>1094154
Ref: whatsnew/3 10 asyncio1094254
Ref: 9e11094254
Ref: asyncio<7>-Footnote-11094432
Node: argparse<4>1094497
Ref: whatsnew/3 10 argparse1094614
Ref: 9e31094614
Ref: argparse<4>-Footnote-11094896
Node: array<2>1094960
Ref: whatsnew/3 10 array1095090
Ref: 9e41095090
Ref: array<2>-Footnote-11095332
Node: asynchat asyncore smtpd1095397
Ref: whatsnew/3 10 asynchat-asyncore-smtpd1095525
Ref: 9e61095525
Node: base64<3>1095785
Ref: whatsnew/3 10 base641095911
Ref: 9e71095911
Node: bdb<2>1096078
Ref: whatsnew/3 10 bdb1096187
Ref: 9ea1096187
Ref: bdb<2>-Footnote-11096356
Node: bisect1096421
Ref: whatsnew/3 10 bisect1096527
Ref: 9eb1096527
Ref: bisect-Footnote-11096744
Node: codecs1096808
Ref: whatsnew/3 10 codecs1096923
Ref: 9ec1096923
Ref: codecs-Footnote-11097120
Node: collections abc1097185
Ref: whatsnew/3 10 collections-abc1097307
Ref: 9ee1097307
Ref: collections abc-Footnote-11098204
Node: contextlib<2>1098269
Ref: whatsnew/3 10 contextlib1098394
Ref: 9f11098394
Ref: contextlib<2>-Footnote-11098916
Ref: contextlib<2>-Footnote-21098981
Node: curses<2>1099046
Ref: whatsnew/3 10 curses1099177
Ref: 9f51099177
Ref: curses<2>-Footnote-11099874
Ref: curses<2>-Footnote-21099939
Node: データクラス<2>1100004
Ref: whatsnew/3 10 dataclasses1100134
Ref: 9fb1100134
Node: __slots__1100233
Ref: whatsnew/3 10 slots1100328
Ref: 9fc1100328
Ref: __slots__-Footnote-11100530
Node: Keyword-only fields1100595
Ref: whatsnew/3 10 keyword-only-fields1100690
Ref: 9fd1100690
Ref: Keyword-only fields-Footnote-11102163
Node: distutils<2>1102228
Ref: whatsnew/3 10 distutils1102359
Ref: 9fe1102359
Ref: whatsnew/3 10 distutils-deprecated1102359
Ref: 9381102359
Ref: distutils<2>-Footnote-11103267
Ref: distutils<2>-Footnote-21103309
Node: doctest<2>1103374
Ref: whatsnew/3 10 doctest1103508
Ref: 9ff1103508
Ref: doctest<2>-Footnote-11103712
Node: エンコーディング1103777
Ref: whatsnew/3 10 encodings1103906
Ref: a001103906
Ref: エンコーディング-Footnote-11104124
Node: enum<4>1104189
Ref: whatsnew/3 10 enum1104317
Ref: a021104317
Ref: enum<4>-Footnote-11104790
Ref: enum<4>-Footnote-21104855
Node: fileinput1104920
Ref: whatsnew/3 10 fileinput1105039
Ref: a031105039
Ref: fileinput-Footnote-11105470
Ref: fileinput-Footnote-21105535
Node: faulthandler<2>1105599
Ref: whatsnew/3 10 faulthandler1105716
Ref: a061105716
Ref: faulthandler<2>-Footnote-11105958
Node: gc<3>1106023
Ref: whatsnew/3 10 gc1106138
Ref: a071106138
Ref: gc<3>-Footnote-11106363
Node: glob<2>1106428
Ref: whatsnew/3 10 glob1106538
Ref: a0b1106538
Ref: glob<2>-Footnote-11106802
Node: hashlib<3>1106867
Ref: whatsnew/3 10 hashlib1106979
Ref: a0d1106979
Ref: hashlib<3>-Footnote-11107522
Ref: hashlib<3>-Footnote-21107564
Ref: hashlib<3>-Footnote-31107629
Ref: hashlib<3>-Footnote-41107694
Node: hmac<2>1107759
Ref: whatsnew/3 10 hmac1107884
Ref: a0e1107884
Ref: hmac<2>-Footnote-11108068
Node: IDLE と idelelib<2>1108133
Ref: whatsnew/3 10 idle-and-idlelib1108269
Ref: a0f1108269
Ref: IDLE と idelelib<2>-Footnote-11110336
Ref: IDLE と idelelib<2>-Footnote-21110401
Ref: IDLE と idelelib<2>-Footnote-31110466
Ref: IDLE と idelelib<2>-Footnote-41110531
Ref: IDLE と idelelib<2>-Footnote-51110596
Ref: IDLE と idelelib<2>-Footnote-61110661
Ref: IDLE と idelelib<2>-Footnote-71110726
Ref: IDLE と idelelib<2>-Footnote-81110791
Node: importlib metadata<2>1110846
Ref: whatsnew/3 10 importlib-metadata1110985
Ref: a141110985
Ref: importlib metadata<2>-Footnote-11111579
Node: inspect<4>1111652
Ref: whatsnew/3 10 inspect1111783
Ref: a171111783
Ref: inspect<4>-Footnote-11112980
Ref: inspect<4>-Footnote-21113045
Node: itertools<4>1113110
Ref: whatsnew/3 10 itertools1113232
Ref: a191113232
Ref: itertools<4>-Footnote-11113398
Node: linecache<2>1113463
Ref: whatsnew/3 10 linecache1113580
Ref: a1b1113580
Ref: linecache<2>-Footnote-11113788
Node: os<5>1113853
Ref: whatsnew/3 10 os1113968
Ref: a1c1113968
Ref: os<5>-Footnote-11114707
Ref: os<5>-Footnote-21114772
Ref: os<5>-Footnote-31114837
Ref: os<5>-Footnote-41114902
Node: os path<4>1114967
Ref: whatsnew/3 10 os-path1115080
Ref: a231115080
Ref: os path<4>-Footnote-11115389
Node: pathlib<8>1115454
Ref: whatsnew/3 10 pathlib1115589
Ref: a241115589
Ref: pathlib<8>-Footnote-11116298
Ref: pathlib<8>-Footnote-21116363
Ref: pathlib<8>-Footnote-31116428
Ref: pathlib<8>-Footnote-41116493
Node: プラットフォーム<3>1116558
Ref: whatsnew/3 10 platform1116689
Ref: a2a1116689
Ref: プラットフォーム<3>-Footnote-11116982
Ref: プラットフォーム<3>-Footnote-21117055
Node: pprint1117120
Ref: whatsnew/3 10 pprint1117251
Ref: a2c1117251
Ref: pprint-Footnote-11117585
Ref: pprint-Footnote-21117650
Node: py_compile1117715
Ref: whatsnew/3 10 py-compile1117825
Ref: a2e1117825
Ref: py_compile-Footnote-11118033
Node: pyclbr1118098
Ref: whatsnew/3 10 pyclbr1118208
Ref: a2f1118208
Ref: pyclbr-Footnote-11118552
Node: shelve1118617
Ref: whatsnew/3 10 shelve1118730
Ref: a321118730
Ref: shelve-Footnote-11119003
Node: statistics<3>1119068
Ref: whatsnew/3 10 statistics1119182
Ref: a341119182
Ref: statistics<3>-Footnote-11119435
Node: site<2>1119500
Ref: whatsnew/3 10 site1119617
Ref: a371119617
Ref: site<2>-Footnote-11119815
Node: socket<3>1119880
Ref: whatsnew/3 10 socket1119990
Ref: a381119990
Ref: socket<3>-Footnote-11120436
Ref: socket<3>-Footnote-21120501
Ref: socket<3>-Footnote-31120566
Node: ssl<4>1120631
Ref: whatsnew/3 10 ssl1120744
Ref: a3b1120744
Ref: ssl<4>-Footnote-11122583
Ref: ssl<4>-Footnote-21122625
Ref: ssl<4>-Footnote-31122690
Ref: ssl<4>-Footnote-41122755
Ref: ssl<4>-Footnote-51122820
Ref: ssl<4>-Footnote-61122885
Ref: ssl<4>-Footnote-71122950
Ref: ssl<4>-Footnote-81123015
Ref: ssl<4>-Footnote-91123080
Ref: ssl<4>-Footnote-101123145
Ref: ssl<4>-Footnote-111123211
Ref: ssl<4>-Footnote-121123277
Ref: ssl<4>-Footnote-131123343
Ref: ssl<4>-Footnote-141123409
Ref: ssl<4>-Footnote-151123475
Node: sqlite3<6>1123541
Ref: whatsnew/3 10 sqlite31123651
Ref: a421123651
Ref: sqlite3<6>-Footnote-11123887
Node: sys<5>1123952
Ref: whatsnew/3 10 sys1124063
Ref: a441124063
Ref: sys<5>-Footnote-11124448
Ref: sys<5>-Footnote-21124513
Node: _thread1124578
Ref: whatsnew/3 10 thread1124691
Ref: a471124691
Ref: _thread-Footnote-11124947
Node: threading<4>1125012
Ref: whatsnew/3 10 threading1125131
Ref: a491125131
Ref: threading<4>-Footnote-11125673
Ref: threading<4>-Footnote-21125738
Node: traceback<3>1125803
Ref: whatsnew/3 10 traceback1125923
Ref: a501125923
Ref: traceback<3>-Footnote-11126251
Node: types<4>1126316
Ref: whatsnew/3 10 types1126433
Ref: a541126433
Ref: types<4>-Footnote-11126742
Node: typing<6>1126807
Ref: whatsnew/3 10 typing1126923
Ref: a581126923
Ref: typing<6>-Footnote-11129156
Ref: typing<6>-Footnote-21129198
Ref: typing<6>-Footnote-31129263
Ref: typing<6>-Footnote-41129328
Ref: typing<6>-Footnote-51129393
Node: unittest<6>1129458
Ref: whatsnew/3 10 unittest1129578
Ref: a5b1129578
Ref: unittest<6>-Footnote-11129794
Node: urllib parse1129859
Ref: whatsnew/3 10 urllib-parse1129976
Ref: a5e1129976
Ref: urllib parse-Footnote-11131125
Ref: urllib parse-Footnote-21131190
Ref: urllib parse-Footnote-31131249
Node: xml<2>1131304
Ref: whatsnew/3 10 xml1131422
Ref: a5f1131422
Ref: xml<2>-Footnote-11131638
Node: zipimport<3>1131703
Ref: whatsnew/3 10 zipimport1131800
Ref: a611131800
Ref: zipimport<3>-Footnote-11132180
Ref: zipimport<3>-Footnote-21132222
Ref: zipimport<3>-Footnote-31132287
Node: 最適化<5>1132352
Ref: whatsnew/3 10 optimizations1132489
Ref: a651132489
Ref: 最適化<5>-Footnote-11135958
Ref: 最適化<5>-Footnote-21136023
Ref: 最適化<5>-Footnote-31136088
Ref: 最適化<5>-Footnote-41136153
Ref: 最適化<5>-Footnote-51136218
Ref: 最適化<5>-Footnote-61136283
Ref: 最適化<5>-Footnote-71136404
Ref: 最適化<5>-Footnote-81136469
Ref: 最適化<5>-Footnote-91136534
Ref: 最適化<5>-Footnote-101136599
Ref: 最適化<5>-Footnote-111136665
Ref: 最適化<5>-Footnote-121136731
Ref: 最適化<5>-Footnote-131136774
Ref: 最適化<5>-Footnote-141136840
Ref: 最適化<5>-Footnote-151136906
Ref: 最適化<5>-Footnote-161136972
Ref: 最適化<5>-Footnote-171137038
Ref: 最適化<5>-Footnote-181137104
Node: 非推奨<6>1137170
Ref: whatsnew/3 10 deprecated1137283
Ref: a6b1137283
Ref: whatsnew/3 10 whatsnew310-deprecated1137283
Ref: a401137283
Ref: 非推奨<6>-Footnote-11146705
Ref: 非推奨<6>-Footnote-21146770
Ref: 非推奨<6>-Footnote-31146835
Ref: 非推奨<6>-Footnote-41146900
Ref: 非推奨<6>-Footnote-51146965
Ref: 非推奨<6>-Footnote-61147030
Ref: 非推奨<6>-Footnote-71147095
Ref: 非推奨<6>-Footnote-81147160
Ref: 非推奨<6>-Footnote-91147225
Ref: 非推奨<6>-Footnote-101147290
Ref: 非推奨<6>-Footnote-111147356
Ref: 非推奨<6>-Footnote-121147422
Ref: 非推奨<6>-Footnote-131147488
Ref: 非推奨<6>-Footnote-141147554
Ref: 非推奨<6>-Footnote-151147613
Ref: 非推奨<6>-Footnote-161147679
Ref: 非推奨<6>-Footnote-171147735
Ref: 非推奨<6>-Footnote-181147801
Ref: 非推奨<6>-Footnote-191147867
Ref: 非推奨<6>-Footnote-201147933
Node: 削除<6>1147999
Ref: whatsnew/3 10 removed1148122
Ref: a791148122
Ref: whatsnew/3 10 whatsnew310-removed1148122
Ref: a7a1148122
Ref: 削除<6>-Footnote-11151353
Ref: 削除<6>-Footnote-21151418
Ref: 削除<6>-Footnote-31151483
Ref: 削除<6>-Footnote-41151548
Ref: 削除<6>-Footnote-51151613
Ref: 削除<6>-Footnote-61151678
Ref: 削除<6>-Footnote-71151743
Node: Porting to Python 3 101151808
Ref: whatsnew/3 10 porting-to-python-3-101151957
Ref: a7f1151957
Node: Changes in the Python syntax1152297
Ref: whatsnew/3 10 changes-in-the-python-syntax1152416
Ref: a801152416
Ref: Changes in the Python syntax-Footnote-11153011
Node: Python API の変更<4>1153076
Ref: whatsnew/3 10 changes-in-the-python-api1153222
Ref: a811153222
Ref: whatsnew/3 10 changes-python-api1153222
Ref: a7e1153222
Ref: Python API の変更<4>-Footnote-11156126
Ref: Python API の変更<4>-Footnote-21156191
Ref: Python API の変更<4>-Footnote-31156256
Ref: Python API の変更<4>-Footnote-41156321
Ref: Python API の変更<4>-Footnote-51156386
Ref: Python API の変更<4>-Footnote-61156451
Node: C API の変更<6>1156516
Ref: whatsnew/3 10 changes-in-the-c-api1156625
Ref: a881156625
Node: CPython バイトコードの変更<4>1159084
Ref: whatsnew/3 10 cpython-bytecode-changes1159240
Ref: a8e1159240
Ref: CPython バイトコードの変更<4>-Footnote-11159550
Node: Build Changes<4>1159615
Ref: whatsnew/3 10 build-changes1159767
Ref: a8f1159767
Ref: Build Changes<4>-Footnote-11162227
Ref: Build Changes<4>-Footnote-21162269
Ref: Build Changes<4>-Footnote-31162334
Ref: Build Changes<4>-Footnote-41162399
Ref: Build Changes<4>-Footnote-51162464
Ref: Build Changes<4>-Footnote-61162529
Ref: Build Changes<4>-Footnote-71162594
Ref: Build Changes<4>-Footnote-81162659
Ref: Build Changes<4>-Footnote-91162724
Ref: Build Changes<4>-Footnote-101162789
Ref: Build Changes<4>-Footnote-111162855
Node: C API の変更<7>1162921
Ref: whatsnew/3 10 c-api-changes1163069
Ref: a941163069
Node: PEP 652 Maintaining the Stable ABI1163338
Ref: whatsnew/3 10 pep-652-maintaining-the-stable-abi1163454
Ref: a951163454
Ref: PEP 652 Maintaining the Stable ABI-Footnote-11163887
Ref: PEP 652 Maintaining the Stable ABI-Footnote-21163929
Node: 新しい機能<9>1163994
Ref: whatsnew/3 10 id11164144
Ref: a961164144
Ref: 新しい機能<9>-Footnote-11168770
Ref: 新しい機能<9>-Footnote-21168835
Ref: 新しい機能<9>-Footnote-31168900
Ref: 新しい機能<9>-Footnote-41168965
Ref: 新しい機能<9>-Footnote-51169030
Ref: 新しい機能<9>-Footnote-61169095
Ref: 新しい機能<9>-Footnote-71169160
Ref: 新しい機能<9>-Footnote-81169227
Ref: 新しい機能<9>-Footnote-91169292
Ref: 新しい機能<9>-Footnote-101169357
Ref: 新しい機能<9>-Footnote-111169423
Ref: 新しい機能<9>-Footnote-121169489
Ref: 新しい機能<9>-Footnote-131169555
Ref: 新しい機能<9>-Footnote-141169621
Ref: 新しい機能<9>-Footnote-151169687
Ref: 新しい機能<9>-Footnote-161169753
Ref: 新しい機能<9>-Footnote-171169819
Ref: 新しい機能<9>-Footnote-181169885
Node: Porting to Python 3 10<2>1169951
Ref: whatsnew/3 10 id21170079
Ref: aab1170079
Ref: Porting to Python 3 10<2>-Footnote-11173751
Ref: Porting to Python 3 10<2>-Footnote-21173793
Ref: Porting to Python 3 10<2>-Footnote-31173858
Ref: Porting to Python 3 10<2>-Footnote-41173923
Ref: Porting to Python 3 10<2>-Footnote-51173988
Ref: Porting to Python 3 10<2>-Footnote-61174053
Ref: Porting to Python 3 10<2>-Footnote-71174118
Ref: Porting to Python 3 10<2>-Footnote-81174183
Ref: Porting to Python 3 10<2>-Footnote-91174248
Ref: Porting to Python 3 10<2>-Footnote-101174313
Ref: Porting to Python 3 10<2>-Footnote-111174379
Node: 非推奨<7>1174445
Ref: whatsnew/3 10 id31174564
Ref: ab11174564
Ref: 非推奨<7>-Footnote-11174858
Node: 削除<7>1174923
Ref: whatsnew/3 10 id41175008
Ref: ab31175008
Ref: 削除<7>-Footnote-11180008
Ref: 削除<7>-Footnote-21180073
Ref: 削除<7>-Footnote-31180115
Ref: 削除<7>-Footnote-41180180
Ref: 削除<7>-Footnote-51180245
Ref: 削除<7>-Footnote-61180310
Ref: 削除<7>-Footnote-71180375
Ref: 削除<7>-Footnote-81180440
Ref: 削除<7>-Footnote-91180505
Ref: 削除<7>-Footnote-101180547
Ref: 削除<7>-Footnote-111180613
Ref: 削除<7>-Footnote-121180679
Ref: 削除<7>-Footnote-131180745
Ref: 削除<7>-Footnote-141180811
Ref: 削除<7>-Footnote-151180877
Ref: 削除<7>-Footnote-161180943
Node: Notable security feature in 3 10 71181009
Ref: whatsnew/3 10 notable-security-feature-in-3-10-71181175
Ref: ac01181175
Ref: Notable security feature in 3 10 7-Footnote-11181905
Node: Notable security feature in 3 10 81181961
Ref: whatsnew/3 10 notable-security-feature-in-3-10-81182135
Ref: ac11182135
Ref: Notable security feature in 3 10 8-Footnote-11182557
Node: Notable changes in 3 10 121182612
Ref: whatsnew/3 10 notable-changes-in-3-10-121182743
Ref: ac21182743
Node: tarfile<3>1182845
Ref: whatsnew/3 10 tarfile1182918
Ref: ac31182918
Ref: tarfile<3>-Footnote-11183522
Node: What's New In Python 3 91183564
Ref: whatsnew/3 9 doc1183712
Ref: ac41183712
Ref: whatsnew/3 9 translation-repo1183712
Ref: ac51183712
Ref: whatsnew/3 9 what-s-new-in-python-3-91183712
Ref: ac61183712
Ref: What's New In Python 3 9-Footnote-11185194
Node: 概要 -- リリースハイライト<6>1185236
Ref: whatsnew/3 9 summary-release-highlights1185426
Ref: ac71185426
Ref: 概要 -- リリースハイライト<6>-Footnote-11187789
Ref: 概要 -- リリースハイライト<6>-Footnote-21187831
Ref: 概要 -- リリースハイライト<6>-Footnote-31187873
Ref: 概要 -- リリースハイライト<6>-Footnote-41187915
Ref: 概要 -- リリースハイライト<6>-Footnote-51187957
Ref: 概要 -- リリースハイライト<6>-Footnote-61187999
Ref: 概要 -- リリースハイライト<6>-Footnote-71188041
Ref: 概要 -- リリースハイライト<6>-Footnote-81188083
Ref: 概要 -- リリースハイライト<6>-Footnote-91188125
Ref: 概要 -- リリースハイライト<6>-Footnote-101188167
Node: コード中の非推奨警告 DeprecationWarning をチェックして下さい1188210
Ref: whatsnew/3 9 you-should-check-for-deprecationwarning-in-your-code1188428
Ref: ac81188428
Node: 新しい機能<10>1190570
Ref: whatsnew/3 9 new-features1190775
Ref: acd1190775
Node: 辞書のマージと更新演算子1191129
Ref: whatsnew/3 9 dictionary-merge-update-operators1191290
Ref: ace1191290
Ref: 辞書のマージと更新演算子-Footnote-11192106
Ref: 辞書のマージと更新演算子-Footnote-21192148
Node: prefixとsuffixを削除する新しい文字列メソッド1192213
Ref: whatsnew/3 9 new-string-methods-to-remove-prefixes-and-suffixes1192465
Ref: acf1192465
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-11193015
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-21193057
Node: 標準コレクション型の型ヒントにおける総称型 generics の使用1193122
Ref: whatsnew/3 9 type-hinting-generics-in-standard-collections1193359
Ref: ad21193359
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-11194227
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-21194269
Node: 新しいパーサー1194334
Ref: whatsnew/3 9 new-parser1194502
Ref: ad31194502
Ref: 新しいパーサー-Footnote-11195573
Ref: 新しいパーサー-Footnote-21195621
Ref: 新しいパーサー-Footnote-31195686
Ref: 新しいパーサー-Footnote-41195728
Node: その他の言語変更<5>1195793
Ref: whatsnew/3 9 other-language-changes1195945
Ref: ad41195945
Ref: その他の言語変更<5>-Footnote-11199043
Ref: その他の言語変更<5>-Footnote-21199108
Ref: その他の言語変更<5>-Footnote-31199173
Ref: その他の言語変更<5>-Footnote-41199238
Ref: その他の言語変更<5>-Footnote-51199303
Ref: その他の言語変更<5>-Footnote-61199345
Ref: その他の言語変更<5>-Footnote-71199410
Ref: その他の言語変更<5>-Footnote-81199475
Ref: その他の言語変更<5>-Footnote-91199540
Ref: その他の言語変更<5>-Footnote-101199605
Ref: その他の言語変更<5>-Footnote-111199671
Node: 新たなモジュール<5>1199737
Ref: whatsnew/3 9 new-modules1199903
Ref: ade1199903
Node: zoneinfo1200006
Ref: whatsnew/3 9 zoneinfo1200098
Ref: adf1200098
Ref: zoneinfo-Footnote-11201318
Ref: zoneinfo-Footnote-21201359
Node: graphlib<2>1201401
Ref: whatsnew/3 9 graphlib1201493
Ref: ae11201493
Ref: graphlib<2>-Footnote-11201817
Node: 改良されたモジュール<5>1201882
Ref: whatsnew/3 9 improved-modules1202033
Ref: ae31202033
Node: ast<4>1202896
Ref: whatsnew/3 9 ast1202991
Ref: ae41202991
Ref: ast<4>-Footnote-11203653
Ref: ast<4>-Footnote-21203718
Ref: ast<4>-Footnote-31203783
Node: asyncio<8>1203848
Ref: whatsnew/3 9 asyncio1203965
Ref: ae71203965
Ref: asyncio<8>-Footnote-11205726
Ref: asyncio<8>-Footnote-21205791
Ref: asyncio<8>-Footnote-31205856
Ref: asyncio<8>-Footnote-41205921
Ref: asyncio<8>-Footnote-51205986
Ref: asyncio<8>-Footnote-61206051
Node: compileall<2>1206116
Ref: whatsnew/3 9 compileall1206248
Ref: aec1206248
Ref: compileall<2>-Footnote-11206828
Ref: compileall<2>-Footnote-21206893
Node: concurrent futures<3>1206958
Ref: whatsnew/3 9 concurrent-futures1207089
Ref: aed1207089
Ref: concurrent futures<3>-Footnote-11207968
Ref: concurrent futures<3>-Footnote-21208033
Ref: concurrent futures<3>-Footnote-31208098
Node: curses<3>1208163
Ref: whatsnew/3 9 curses1208292
Ref: aef1208292
Ref: curses<3>-Footnote-11208606
Node: datetime<3>1208671
Ref: whatsnew/3 9 datetime1208791
Ref: af41208791
Ref: datetime<3>-Footnote-11209109
Node: distutils<3>1209174
Ref: whatsnew/3 9 distutils1209293
Ref: af71209293
Ref: distutils<3>-Footnote-11209544
Node: fcntl<2>1209609
Ref: whatsnew/3 9 fcntl1209726
Ref: af81209726
Ref: fcntl<2>-Footnote-11209933
Node: ftplib<2>1209998
Ref: whatsnew/3 9 ftplib1210108
Ref: af91210108
Ref: ftplib<2>-Footnote-11210398
Node: gc<4>1210463
Ref: whatsnew/3 9 gc1210575
Ref: afc1210575
Ref: gc<4>-Footnote-11211113
Ref: gc<4>-Footnote-21211178
Node: hashlib<4>1211243
Ref: whatsnew/3 9 hashlib1211353
Ref: afe1211353
Ref: hashlib<4>-Footnote-11211862
Ref: hashlib<4>-Footnote-21211927
Node: http<2>1211992
Ref: whatsnew/3 9 http1212117
Ref: aff1212117
Ref: http<2>-Footnote-11212389
Ref: http<2>-Footnote-21212454
Node: IDLE と idelelib<3>1212519
Ref: whatsnew/3 9 idle-and-idlelib1212644
Ref: b011212644
Ref: IDLE と idelelib<3>-Footnote-11213853
Ref: IDLE と idelelib<3>-Footnote-21213917
Ref: IDLE と idelelib<3>-Footnote-31213982
Ref: IDLE と idelelib<3>-Footnote-41214047
Ref: IDLE と idelelib<3>-Footnote-51214112
Ref: IDLE と idelelib<3>-Footnote-61214177
Ref: IDLE と idelelib<3>-Footnote-71214242
Node: imaplib<2>1214307
Ref: whatsnew/3 9 imaplib1214437
Ref: b021214437
Ref: imaplib<2>-Footnote-11215258
Ref: imaplib<2>-Footnote-21215323
Node: importlib<3>1215388
Ref: whatsnew/3 9 importlib1215508
Ref: b091215508
Ref: importlib<3>-Footnote-11216300
Ref: importlib<3>-Footnote-21216365
Ref: importlib<3>-Footnote-31216430
Node: inspect<5>1216495
Ref: whatsnew/3 9 inspect1216617
Ref: b0b1216617
Ref: inspect<5>-Footnote-11216863
Ref: inspect<5>-Footnote-21216928
Node: ipaddress<2>1216993
Ref: whatsnew/3 9 ipaddress1217110
Ref: b0d1217110
Ref: ipaddress<2>-Footnote-11217675
Ref: ipaddress<2>-Footnote-21217740
Node: math<5>1217805
Ref: whatsnew/3 9 math1217930
Ref: b0f1217930
Ref: math<5>-Footnote-11218646
Ref: math<5>-Footnote-21218711
Ref: math<5>-Footnote-31218776
Ref: math<5>-Footnote-41218841
Ref: math<5>-Footnote-51218906
Node: multiprocessing<3>1218971
Ref: whatsnew/3 9 multiprocessing1219091
Ref: b131219091
Ref: multiprocessing<3>-Footnote-11219347
Node: nntplib1219412
Ref: whatsnew/3 9 nntplib1219530
Ref: b161219530
Ref: nntplib-Footnote-11219814
Node: os<6>1219879
Ref: whatsnew/3 9 os1219989
Ref: b171219989
Ref: os<6>-Footnote-11220802
Ref: os<6>-Footnote-21220867
Ref: os<6>-Footnote-31220932
Ref: os<6>-Footnote-41220997
Ref: os<6>-Footnote-51221062
Ref: os<6>-Footnote-61221127
Node: pathlib<9>1221192
Ref: whatsnew/3 9 pathlib1221301
Ref: b1c1221301
Ref: pathlib<9>-Footnote-11221515
Node: pdb<5>1221580
Ref: whatsnew/3 9 pdb1221690
Ref: b1f1221690
Ref: pdb<5>-Footnote-11221878
Node: poplib1221943
Ref: whatsnew/3 9 poplib1222052
Ref: b201222052
Ref: poplib-Footnote-11222346
Node: pprint<2>1222411
Ref: whatsnew/3 9 pprint1222522
Ref: b231222522
Ref: pprint<2>-Footnote-11222718
Node: pydoc<2>1222783
Ref: whatsnew/3 9 pydoc1222897
Ref: b241222897
Ref: pydoc<2>-Footnote-11223164
Node: random<3>1223229
Ref: whatsnew/3 9 random1223340
Ref: b261223340
Ref: random<3>-Footnote-11223541
Node: signal1223606
Ref: whatsnew/3 9 signal1223716
Ref: b281223716
Ref: signal-Footnote-11223946
Node: smtplib1224011
Ref: whatsnew/3 9 smtplib1224121
Ref: b2a1224121
Ref: smtplib-Footnote-11224533
Ref: smtplib-Footnote-21224598
Node: socket<4>1224663
Ref: whatsnew/3 9 socket1224774
Ref: b2e1224774
Ref: socket<4>-Footnote-11225360
Ref: socket<4>-Footnote-21225425
Ref: socket<4>-Footnote-31225490
Node: time<3>1225555
Ref: whatsnew/3 9 time1225665
Ref: b331225665
Ref: time<3>-Footnote-11225995
Node: sys<6>1226060
Ref: whatsnew/3 9 sys1226172
Ref: b351226172
Ref: sys<6>-Footnote-11226837
Ref: sys<6>-Footnote-21226904
Node: tracemalloc1226969
Ref: whatsnew/3 9 tracemalloc1227083
Ref: b381227083
Ref: tracemalloc-Footnote-11227367
Node: typing<7>1227432
Ref: whatsnew/3 9 typing1227554
Ref: b3a1227554
Ref: typing<7>-Footnote-11227910
Node: unicodedata<5>1227952
Ref: whatsnew/3 9 unicodedata1228070
Ref: b3c1228070
Ref: unicodedata<5>-Footnote-11228248
Node: venv<3>1228313
Ref: whatsnew/3 9 venv1228428
Ref: b3d1228428
Ref: venv<3>-Footnote-11228890
Node: xml<3>1228955
Ref: whatsnew/3 9 xml1229047
Ref: b3e1229047
Ref: xml<3>-Footnote-11229405
Node: 最適化<6>1229470
Ref: whatsnew/3 9 optimizations1229606
Ref: b3f1229606
Ref: 最適化<6>-Footnote-11235356
Ref: 最適化<6>-Footnote-21235421
Ref: 最適化<6>-Footnote-31235486
Ref: 最適化<6>-Footnote-41235551
Ref: 最適化<6>-Footnote-51235616
Ref: 最適化<6>-Footnote-61235658
Ref: 最適化<6>-Footnote-71235723
Ref: 最適化<6>-Footnote-81235787
Ref: 最適化<6>-Footnote-91235852
Ref: 最適化<6>-Footnote-101235917
Ref: 最適化<6>-Footnote-111235983
Ref: 最適化<6>-Footnote-121236112
Node: 非推奨<8>1236161
Ref: whatsnew/3 9 deprecated1236273
Ref: b441236273
Ref: 非推奨<8>-Footnote-11241370
Ref: 非推奨<8>-Footnote-21241435
Ref: 非推奨<8>-Footnote-31241500
Ref: 非推奨<8>-Footnote-41241565
Ref: 非推奨<8>-Footnote-51241630
Ref: 非推奨<8>-Footnote-61241695
Ref: 非推奨<8>-Footnote-71241760
Ref: 非推奨<8>-Footnote-81241825
Ref: 非推奨<8>-Footnote-91241890
Ref: 非推奨<8>-Footnote-101241955
Ref: 非推奨<8>-Footnote-111242021
Ref: 非推奨<8>-Footnote-121242087
Ref: 非推奨<8>-Footnote-131242153
Ref: 非推奨<8>-Footnote-141242219
Ref: 非推奨<8>-Footnote-151242285
Ref: 非推奨<8>-Footnote-161242328
Ref: 非推奨<8>-Footnote-171242368
Ref: 非推奨<8>-Footnote-181242407
Ref: 非推奨<8>-Footnote-191242473
Node: 削除<8>1242539
Ref: whatsnew/3 9 removed1242661
Ref: b461242661
Ref: whatsnew/3 9 removed-in-python-391242661
Ref: acc1242661
Ref: 削除<8>-Footnote-11248801
Ref: 削除<8>-Footnote-21248866
Ref: 削除<8>-Footnote-31248931
Ref: 削除<8>-Footnote-41248996
Ref: 削除<8>-Footnote-51249061
Ref: 削除<8>-Footnote-61249126
Ref: 削除<8>-Footnote-71249191
Ref: 削除<8>-Footnote-81249256
Ref: 削除<8>-Footnote-91249321
Ref: 削除<8>-Footnote-101249386
Ref: 削除<8>-Footnote-111249452
Ref: 削除<8>-Footnote-121249495
Ref: 削除<8>-Footnote-131249561
Ref: 削除<8>-Footnote-141249627
Ref: 削除<8>-Footnote-151249693
Ref: 削除<8>-Footnote-161249759
Ref: 削除<8>-Footnote-171249825
Ref: 削除<8>-Footnote-181249891
Ref: 削除<8>-Footnote-191249957
Ref: 削除<8>-Footnote-201250023
Ref: 削除<8>-Footnote-211250089
Ref: 削除<8>-Footnote-221250155
Node: Python 3 9への移植1250221
Ref: whatsnew/3 9 porting-to-python-3-91250347
Ref: b551250347
Node: Python API の変更<5>1250729
Ref: whatsnew/3 9 changes-in-the-python-api1250838
Ref: b561250838
Ref: Python API の変更<5>-Footnote-11255007
Ref: Python API の変更<5>-Footnote-21255072
Ref: Python API の変更<5>-Footnote-31255137
Ref: Python API の変更<5>-Footnote-41255202
Ref: Python API の変更<5>-Footnote-51255261
Ref: Python API の変更<5>-Footnote-61255326
Ref: Python API の変更<5>-Footnote-71255391
Ref: Python API の変更<5>-Footnote-81255456
Ref: Python API の変更<5>-Footnote-91255521
Ref: Python API の変更<5>-Footnote-101255586
Ref: Python API の変更<5>-Footnote-111255652
Node: C API の変更<8>1255718
Ref: whatsnew/3 9 changes-in-the-c-api1255874
Ref: b611255874
Ref: C API の変更<8>-Footnote-11257988
Ref: C API の変更<8>-Footnote-21258053
Ref: C API の変更<8>-Footnote-31258118
Node: CPython バイトコードの変更<5>1258183
Ref: whatsnew/3 9 cpython-bytecode-changes1258307
Ref: b631258307
Ref: CPython バイトコードの変更<5>-Footnote-11259112
Ref: CPython バイトコードの変更<5>-Footnote-21259177
Node: Build Changes<5>1259242
Ref: whatsnew/3 9 build-changes1259377
Ref: b661259377
Ref: Build Changes<5>-Footnote-11261785
Ref: Build Changes<5>-Footnote-21261852
Ref: Build Changes<5>-Footnote-31261917
Ref: Build Changes<5>-Footnote-41261982
Ref: Build Changes<5>-Footnote-51262047
Ref: Build Changes<5>-Footnote-61262112
Ref: Build Changes<5>-Footnote-71262177
Ref: Build Changes<5>-Footnote-81262242
Node: C API の変更<9>1262307
Ref: whatsnew/3 9 c-api-changes1262457
Ref: b681262457
Node: 新しい機能<11>1262625
Ref: whatsnew/3 9 id11262733
Ref: b691262733
Ref: 新しい機能<11>-Footnote-11265751
Ref: 新しい機能<11>-Footnote-21265793
Ref: 新しい機能<11>-Footnote-31265858
Ref: 新しい機能<11>-Footnote-41265923
Ref: 新しい機能<11>-Footnote-51265988
Ref: 新しい機能<11>-Footnote-61266053
Ref: 新しい機能<11>-Footnote-71266118
Ref: 新しい機能<11>-Footnote-81266183
Ref: 新しい機能<11>-Footnote-91266248
Ref: 新しい機能<11>-Footnote-101266313
Ref: 新しい機能<11>-Footnote-111266379
Ref: 新しい機能<11>-Footnote-121266445
Node: Python 3 9への移植<2>1266511
Ref: whatsnew/3 9 id21266637
Ref: b741266637
Ref: Python 3 9への移植<2>-Footnote-11270458
Ref: Python 3 9への移植<2>-Footnote-21270500
Ref: Python 3 9への移植<2>-Footnote-31270565
Ref: Python 3 9への移植<2>-Footnote-41270630
Ref: Python 3 9への移植<2>-Footnote-51270694
Ref: Python 3 9への移植<2>-Footnote-61270759
Ref: Python 3 9への移植<2>-Footnote-71270824
Ref: Python 3 9への移植<2>-Footnote-81270866
Ref: Python 3 9への移植<2>-Footnote-91270931
Ref: Python 3 9への移植<2>-Footnote-101270996
Ref: Python 3 9への移植<2>-Footnote-111271062
Node: 削除<9>1271128
Ref: whatsnew/3 9 id31271226
Ref: b871271226
Ref: 削除<9>-Footnote-11275163
Ref: 削除<9>-Footnote-21275228
Ref: 削除<9>-Footnote-31275293
Ref: 削除<9>-Footnote-41275358
Ref: 削除<9>-Footnote-51275423
Ref: 削除<9>-Footnote-61275488
Ref: 削除<9>-Footnote-71275553
Ref: 削除<9>-Footnote-81275618
Ref: 削除<9>-Footnote-91275683
Ref: 削除<9>-Footnote-101275748
Ref: 削除<9>-Footnote-111275814
Ref: 削除<9>-Footnote-121275857
Ref: 削除<9>-Footnote-131275923
Node: Python 3 9 1 での重要な変更点1275989
Ref: whatsnew/3 9 notable-changes-in-python-3-9-11276160
Ref: b8a1276160
Node: typing<8>1276408
Ref: whatsnew/3 9 id41276563
Ref: b8b1276563
Ref: typing<8>-Footnote-11277760
Ref: typing<8>-Footnote-21277802
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート1277867
Ref: whatsnew/3 9 macos-11-0-big-sur-and-apple-silicon-mac-support1278022
Ref: b8c1278022
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート-Footnote-11278848
Node: Python 3 9 2 での重要な変更点1278913
Ref: whatsnew/3 9 notable-changes-in-python-3-9-21279103
Ref: b8d1279103
Node: collections abc<2>1279268
Ref: whatsnew/3 9 collections-abc1279384
Ref: b8e1279384
Ref: collections abc<2>-Footnote-11280345
Node: urllib parse<2>1280410
Ref: whatsnew/3 9 urllib-parse1280526
Ref: b8f1280526
Ref: urllib parse<2>-Footnote-11281210
Node: Python 3 9 3 での重要な変更点1281275
Ref: whatsnew/3 9 notable-changes-in-python-3-9-31281464
Ref: b901281464
Ref: Python 3 9 3 での重要な変更点-Footnote-11281939
Node: Python 3 9 5での重要な変更点1281994
Ref: whatsnew/3 9 notable-changes-in-python-3-9-51282180
Ref: b911282180
Node: urllib parse<3>1282304
Ref: whatsnew/3 9 id51282392
Ref: b921282392
Ref: urllib parse<3>-Footnote-11282921
Ref: urllib parse<3>-Footnote-21282980
Node: Notable security feature in 3 9 141283035
Ref: whatsnew/3 9 notable-security-feature-in-3-9-141283209
Ref: b931283209
Ref: Notable security feature in 3 9 14-Footnote-11283939
Node: Notable changes in 3 9 171283995
Ref: whatsnew/3 9 notable-changes-in-3-9-171284124
Ref: b941284124
Node: tarfile<4>1284224
Ref: whatsnew/3 9 tarfile1284296
Ref: b951284296
Ref: tarfile<4>-Footnote-11284900
Node: What's New In Python 3 81284942
Ref: whatsnew/3 8 doc1285089
Ref: b961285089
Ref: whatsnew/3 8 translation-repo1285089
Ref: b971285089
Ref: whatsnew/3 8 what-s-new-in-python-3-81285089
Ref: b981285089
Node: 概要 -- リリースハイライト<7>1286546
Ref: whatsnew/3 8 summary-release-highlights1286675
Ref: b991286675
Node: 新しい機能<12>1286751
Ref: whatsnew/3 8 new-features1286916
Ref: b9a1286916
Node: 代入式1287618
Ref: whatsnew/3 8 assignment-expressions1287710
Ref: b9b1287710
Ref: 代入式-Footnote-11289430
Ref: 代入式-Footnote-21289527
Ref: 代入式-Footnote-31289569
Node: 位置専用引数1289634
Ref: whatsnew/3 8 positional-only-parameters1289849
Ref: b9c1289849
Ref: 位置専用引数-Footnote-11292776
Ref: 位置専用引数-Footnote-21292838
Ref: 位置専用引数-Footnote-31292880
Node: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム1292945
Ref: whatsnew/3 8 parallel-filesystem-cache-for-compiled-bytecode-files1293212
Ref: b9e1293212
Ref: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム-Footnote-11294144
Node: デバッグビルドとリリースビルドのABI 共通化1294209
Ref: whatsnew/3 8 debug-build-uses-the-same-abi-as-release-build1294515
Ref: ba11294515
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-11297531
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-21297596
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-31297661
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-41297726
Node: f-string での = を用いたオブジェクトの表現1297791
Ref: whatsnew/3 8 bpo-36817-whatsnew1298030
Ref: ba31298030
Ref: whatsnew/3 8 f-strings-support-for-self-documenting-expressions-and-debugging1298030
Ref: ba41298030
Ref: f-string での = を用いたオブジェクトの表現-Footnote-11299243
Node: PEP 578 Pythonランタイムの監査フック1299308
Ref: whatsnew/3 8 pep-578-python-runtime-audit-hooks1299516
Ref: ba51299516
Ref: PEP 578 Pythonランタイムの監査フック-Footnote-11300169
Node: PEP 587 Python 初期化設定1300211
Ref: whatsnew/3 8 pep-587-python-initialization-configuration1300416
Ref: ba61300416
Ref: PEP 587 Python 初期化設定-Footnote-11302405
Ref: PEP 587 Python 初期化設定-Footnote-21302447
Ref: PEP 587 Python 初期化設定-Footnote-31302489
Node: PEP 590 Vectorcall a fast calling protocol for CPython1302554
Ref: whatsnew/3 8 pep-590-vectorcall-a-fast-calling-protocol-for-cpython1302791
Ref: bc11302791
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-11303438
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-21303480
Node: Pickle プロトコルバージョン 5 による帯域外データバッファ1303545
Ref: whatsnew/3 8 pickle-protocol-5-with-out-of-band-data-buffers1303743
Ref: bc21303743
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-11304599
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-21304641
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-31304683
Node: その他の言語変更<6>1304748
Ref: whatsnew/3 8 other-language-changes1304900
Ref: bc31304900
Ref: その他の言語変更<6>-Footnote-11313031
Ref: その他の言語変更<6>-Footnote-21313096
Ref: その他の言語変更<6>-Footnote-31313161
Ref: その他の言語変更<6>-Footnote-41313226
Ref: その他の言語変更<6>-Footnote-51313291
Ref: その他の言語変更<6>-Footnote-61313356
Ref: その他の言語変更<6>-Footnote-71313421
Ref: その他の言語変更<6>-Footnote-81313486
Ref: その他の言語変更<6>-Footnote-91313551
Ref: その他の言語変更<6>-Footnote-101313616
Ref: その他の言語変更<6>-Footnote-111313682
Ref: その他の言語変更<6>-Footnote-121313750
Ref: その他の言語変更<6>-Footnote-131313816
Ref: その他の言語変更<6>-Footnote-141313886
Ref: その他の言語変更<6>-Footnote-151313946
Ref: その他の言語変更<6>-Footnote-161314012
Ref: その他の言語変更<6>-Footnote-171314078
Node: 新たなモジュール<6>1314144
Ref: whatsnew/3 8 new-modules1314310
Ref: bcc1314310
Ref: 新たなモジュール<6>-Footnote-11315516
Node: 改良されたモジュール<6>1315581
Ref: whatsnew/3 8 improved-modules1315732
Ref: bcd1315732
Node: ast<5>1316778
Ref: whatsnew/3 8 ast1316873
Ref: bce1316873
Ref: ast<5>-Footnote-11318105
Ref: ast<5>-Footnote-21318170
Ref: ast<5>-Footnote-31318212
Ref: ast<5>-Footnote-41318254
Ref: ast<5>-Footnote-51318296
Node: asyncio<9>1318361
Ref: whatsnew/3 8 asyncio1318476
Ref: bd01318476
Ref: asyncio<9>-Footnote-11322130
Ref: asyncio<9>-Footnote-21322195
Ref: asyncio<9>-Footnote-31322260
Ref: asyncio<9>-Footnote-41322325
Ref: asyncio<9>-Footnote-51322390
Ref: asyncio<9>-Footnote-61322455
Ref: asyncio<9>-Footnote-71322520
Ref: asyncio<9>-Footnote-81322585
Ref: asyncio<9>-Footnote-91322650
Ref: asyncio<9>-Footnote-101322703
Node: builtins<2>1322769
Ref: whatsnew/3 8 builtins1322889
Ref: bd61322889
Ref: builtins<2>-Footnote-11323477
Node: collections1323542
Ref: whatsnew/3 8 collections1323660
Ref: bd71323660
Ref: collections-Footnote-11324252
Node: cProfile1324317
Ref: whatsnew/3 8 cprofile1324430
Ref: bd91324430
Ref: cProfile-Footnote-11324870
Node: csv<2>1324935
Ref: whatsnew/3 8 csv1325046
Ref: csv<2>-Footnote-11325447
Node: curses<4>1325512
Ref: whatsnew/3 8 curses1325624
Ref: bdd1325624
Ref: curses<4>-Footnote-11325887
Node: ctypes<3>1325952
Ref: whatsnew/3 8 ctypes1326069
Ref: bdf1326069
Ref: ctypes<3>-Footnote-11326716
Node: datetime<4>1326781
Ref: whatsnew/3 8 datetime1326901
Ref: be21326901
Ref: datetime<4>-Footnote-11327334
Node: functools<3>1327399
Ref: whatsnew/3 8 functools1327515
Ref: be51327515
Ref: functools<3>-Footnote-11329204
Ref: functools<3>-Footnote-21329269
Ref: functools<3>-Footnote-31329334
Node: gc<5>1329399
Ref: whatsnew/3 8 gc1329511
Ref: bea1329511
Ref: gc<5>-Footnote-11329797
Node: gettext1329862
Ref: whatsnew/3 8 gettext1329969
Ref: beb1329969
Ref: gettext-Footnote-11330211
Node: gzip<3>1330275
Ref: whatsnew/3 8 gzip1330397
Ref: bed1330397
Ref: gzip<3>-Footnote-11330928
Ref: gzip<3>-Footnote-21330993
Node: IDLE と idelelib<4>1331057
Ref: whatsnew/3 8 idle-and-idlelib1331182
Ref: bef1331182
Ref: IDLE と idelelib<4>-Footnote-11333182
Ref: IDLE と idelelib<4>-Footnote-21333249
Ref: IDLE と idelelib<4>-Footnote-31333313
Ref: IDLE と idelelib<4>-Footnote-41333378
Ref: IDLE と idelelib<4>-Footnote-51333443
Ref: IDLE と idelelib<4>-Footnote-61333508
Ref: IDLE と idelelib<4>-Footnote-71333572
Ref: IDLE と idelelib<4>-Footnote-81333637
Node: inspect<6>1333702
Ref: whatsnew/3 8 inspect1333825
Ref: bf01333825
Ref: inspect<6>-Footnote-11334666
Node: io<5>1334731
Ref: whatsnew/3 8 io1334846
Ref: bf21334846
Ref: io<5>-Footnote-11335194
Node: itertools<5>1335259
Ref: whatsnew/3 8 itertools1335373
Ref: bf31335373
Ref: itertools<5>-Footnote-11335778
Node: json tool1335843
Ref: whatsnew/3 8 json-tool1335962
Ref: bf51335962
Ref: json tool-Footnote-11336214
Node: logging<2>1336279
Ref: whatsnew/3 8 logging1336393
Ref: bf61336393
Ref: logging<2>-Footnote-11337108
Node: math<6>1337173
Ref: whatsnew/3 8 math1337285
Ref: bf81337285
Ref: math<6>-Footnote-11339226
Ref: math<6>-Footnote-21339291
Ref: math<6>-Footnote-31339356
Ref: math<6>-Footnote-41339421
Ref: math<6>-Footnote-51339486
Ref: math<6>-Footnote-61339551
Ref: math<6>-Footnote-71339616
Ref: math<6>-Footnote-81339681
Node: mmap<2>1339746
Ref: whatsnew/3 8 mmap1339866
Ref: bfe1339866
Ref: mmap<2>-Footnote-11340096
Node: multiprocessing<4>1340161
Ref: whatsnew/3 8 multiprocessing1340279
Ref: c001340279
Ref: multiprocessing<4>-Footnote-11340583
Ref: multiprocessing<4>-Footnote-21340648
Node: os<7>1340713
Ref: whatsnew/3 8 os1340834
Ref: c011340834
Ref: os<7>-Footnote-11342345
Ref: os<7>-Footnote-21342410
Ref: os<7>-Footnote-31342475
Node: os path<5>1342540
Ref: whatsnew/3 8 os-path1342654
Ref: c061342654
Ref: os path<5>-Footnote-11343677
Ref: os path<5>-Footnote-21343742
Ref: os path<5>-Footnote-31343807
Node: pathlib<10>1343872
Ref: whatsnew/3 8 pathlib1343990
Ref: c0e1343990
Ref: pathlib<10>-Footnote-11344899
Ref: pathlib<10>-Footnote-21344964
Node: pickle<2>1345029
Ref: whatsnew/3 8 pickle1345145
Ref: c161345145
Ref: pickle<2>-Footnote-11345483
Node: plistlib1345548
Ref: whatsnew/3 8 plistlib1345662
Ref: c191345662
Ref: plistlib-Footnote-11345900
Node: pprint<3>1345965
Ref: whatsnew/3 8 pprint1346083
Ref: c1b1346083
Ref: pprint<3>-Footnote-11347148
Node: py_compile<2>1347213
Ref: whatsnew/3 8 py-compile1347328
Ref: c1d1347328
Ref: py_compile<2>-Footnote-11347517
Node: shlex1347582
Ref: whatsnew/3 8 shlex1347697
Ref: c1f1347697
Ref: shlex-Footnote-11347901
Node: shutil<4>1347966
Ref: whatsnew/3 8 shutil1348077
Ref: c211348077
Ref: shutil<4>-Footnote-11348730
Ref: shutil<4>-Footnote-21348795
Ref: shutil<4>-Footnote-31348860
Node: socket<5>1348925
Ref: whatsnew/3 8 socket1349037
Ref: c231349037
Ref: socket<5>-Footnote-11349612
Ref: socket<5>-Footnote-21349677
Node: ssl<5>1349742
Ref: whatsnew/3 8 ssl1349858
Ref: c291349858
Ref: ssl<5>-Footnote-11350120
Node: statistics<4>1350185
Ref: whatsnew/3 8 statistics1350298
Ref: c2c1350298
Ref: statistics<4>-Footnote-11352027
Ref: statistics<4>-Footnote-21352092
Ref: statistics<4>-Footnote-31352157
Ref: statistics<4>-Footnote-41352222
Ref: statistics<4>-Footnote-51352287
Node: sys<7>1352352
Ref: whatsnew/3 8 sys1352469
Ref: c321352469
Ref: sys<7>-Footnote-11352908
Node: tarfile<5>1352973
Ref: whatsnew/3 8 tarfile1353089
Ref: c331353089
Ref: tarfile<5>-Footnote-11353507
Node: threading<5>1353572
Ref: whatsnew/3 8 threading1353693
Ref: c341353693
Ref: threading<5>-Footnote-11354418
Ref: threading<5>-Footnote-21354485
Node: tokenize<2>1354550
Ref: whatsnew/3 8 tokenize1354671
Ref: c381354671
Ref: tokenize<2>-Footnote-11354997
Node: tkinter<5>1355062
Ref: whatsnew/3 8 tkinter1355178
Ref: c391355178
Ref: tkinter<5>-Footnote-11355721
Ref: tkinter<5>-Footnote-21355786
Ref: tkinter<5>-Footnote-31355851
Node: time<4>1355916
Ref: whatsnew/3 8 time1356030
Ref: c3a1356030
Ref: time<4>-Footnote-11356209
Node: typing<9>1356274
Ref: whatsnew/3 8 typing1356392
Ref: c3c1356392
Ref: typing<9>-Footnote-11357858
Ref: typing<9>-Footnote-21357900
Ref: typing<9>-Footnote-31357942
Ref: typing<9>-Footnote-41357984
Node: unicodedata<6>1358026
Ref: whatsnew/3 8 unicodedata1358148
Ref: c3f1358148
Ref: unicodedata<6>-Footnote-11358577
Ref: unicodedata<6>-Footnote-21358639
Ref: unicodedata<6>-Footnote-31358704
Node: unittest<7>1358769
Ref: whatsnew/3 8 unittest1358889
Ref: c411358889
Ref: unittest<7>-Footnote-11360211
Ref: unittest<7>-Footnote-21360276
Ref: unittest<7>-Footnote-31360341
Ref: unittest<7>-Footnote-41360406
Node: venv<4>1360471
Ref: whatsnew/3 8 venv1360584
Ref: c481360584
Ref: venv<4>-Footnote-11360836
Node: weakref1360901
Ref: whatsnew/3 8 weakref1361009
Ref: c491361009
Ref: weakref-Footnote-11361302
Node: xml<4>1361367
Ref: whatsnew/3 8 xml1361474
Ref: c4b1361474
Ref: xml<4>-Footnote-11362630
Ref: xml<4>-Footnote-21362695
Ref: xml<4>-Footnote-31362760
Ref: xml<4>-Footnote-41362825
Ref: xml<4>-Footnote-51362890
Node: xmlrpc1362955
Ref: whatsnew/3 8 xmlrpc1363046
Ref: c4f1363046
Ref: xmlrpc-Footnote-11363438
Node: 最適化<7>1363503
Ref: whatsnew/3 8 optimizations1363664
Ref: c511363664
Ref: 最適化<7>-Footnote-11368006
Ref: 最適化<7>-Footnote-21368071
Ref: 最適化<7>-Footnote-31368136
Ref: 最適化<7>-Footnote-41368201
Ref: 最適化<7>-Footnote-51368266
Ref: 最適化<7>-Footnote-61368331
Ref: 最適化<7>-Footnote-71368396
Ref: 最適化<7>-Footnote-81368461
Ref: 最適化<7>-Footnote-91368526
Ref: 最適化<7>-Footnote-101368591
Ref: 最適化<7>-Footnote-111368657
Ref: 最適化<7>-Footnote-121368723
Ref: 最適化<7>-Footnote-131368789
Node: ビルドならびに C API の変更1368855
Ref: whatsnew/3 8 build-and-c-api-changes1368995
Ref: c5c1368995
Ref: ビルドならびに C API の変更-Footnote-11374588
Ref: ビルドならびに C API の変更-Footnote-21374653
Ref: ビルドならびに C API の変更-Footnote-31374718
Ref: ビルドならびに C API の変更-Footnote-41374783
Ref: ビルドならびに C API の変更-Footnote-51374848
Ref: ビルドならびに C API の変更-Footnote-61374913
Ref: ビルドならびに C API の変更-Footnote-71374978
Ref: ビルドならびに C API の変更-Footnote-81375043
Ref: ビルドならびに C API の変更-Footnote-91375108
Ref: ビルドならびに C API の変更-Footnote-101375173
Ref: ビルドならびに C API の変更-Footnote-111375239
Ref: ビルドならびに C API の変更-Footnote-121375305
Node: 非推奨<9>1375371
Ref: whatsnew/3 8 deprecated1375521
Ref: c661375521
Ref: 非推奨<9>-Footnote-11381378
Ref: 非推奨<9>-Footnote-21381443
Ref: 非推奨<9>-Footnote-31381508
Ref: 非推奨<9>-Footnote-41381573
Ref: 非推奨<9>-Footnote-51381637
Ref: 非推奨<9>-Footnote-61381702
Ref: 非推奨<9>-Footnote-71381767
Ref: 非推奨<9>-Footnote-81381832
Ref: 非推奨<9>-Footnote-91381897
Ref: 非推奨<9>-Footnote-101381962
Ref: 非推奨<9>-Footnote-111382028
Ref: 非推奨<9>-Footnote-121382094
Ref: 非推奨<9>-Footnote-131382160
Node: API と機能の削除1382226
Ref: whatsnew/3 8 api-and-feature-removals1382362
Ref: c7d1382362
Ref: API と機能の削除-Footnote-11385170
Ref: API と機能の削除-Footnote-21385225
Ref: API と機能の削除-Footnote-31385290
Ref: API と機能の削除-Footnote-41385355
Ref: API と機能の削除-Footnote-51385420
Ref: API と機能の削除-Footnote-61385485
Ref: API と機能の削除-Footnote-71385550
Ref: API と機能の削除-Footnote-81385615
Ref: API と機能の削除-Footnote-91385680
Ref: API と機能の削除-Footnote-101385745
Ref: API と機能の削除-Footnote-111385811
Node: Python 3 8 への移植1385877
Ref: whatsnew/3 8 porting-to-python-3-81386037
Ref: c801386037
Node: Python の挙動の変更1386491
Ref: whatsnew/3 8 changes-in-python-behavior1386608
Ref: c811386608
Ref: Python の挙動の変更-Footnote-11388965
Ref: Python の挙動の変更-Footnote-21389030
Ref: Python の挙動の変更-Footnote-31389095
Ref: Python の挙動の変更-Footnote-41389160
Ref: Python の挙動の変更-Footnote-51389225
Ref: Python の挙動の変更-Footnote-61389290
Node: Python API の変更<6>1389355
Ref: whatsnew/3 8 changes-in-the-python-api1389500
Ref: c851389500
Ref: whatsnew/3 8 bpo-36085-whatsnew1396516
Ref: c991396516
Ref: Python API の変更<6>-Footnote-11398164
Ref: Python API の変更<6>-Footnote-21398206
Ref: Python API の変更<6>-Footnote-31398271
Ref: Python API の変更<6>-Footnote-41398336
Ref: Python API の変更<6>-Footnote-51398401
Ref: Python API の変更<6>-Footnote-61398466
Ref: Python API の変更<6>-Footnote-71398531
Ref: Python API の変更<6>-Footnote-81398596
Ref: Python API の変更<6>-Footnote-91398661
Ref: Python API の変更<6>-Footnote-101398726
Ref: Python API の変更<6>-Footnote-111398792
Ref: Python API の変更<6>-Footnote-121398858
Ref: Python API の変更<6>-Footnote-131398924
Ref: Python API の変更<6>-Footnote-141398990
Ref: Python API の変更<6>-Footnote-151399056
Ref: Python API の変更<6>-Footnote-161399122
Ref: Python API の変更<6>-Footnote-171399188
Ref: Python API の変更<6>-Footnote-181399253
Ref: Python API の変更<6>-Footnote-191399319
Ref: Python API の変更<6>-Footnote-201399385
Ref: Python API の変更<6>-Footnote-211399451
Ref: Python API の変更<6>-Footnote-221399517
Ref: Python API の変更<6>-Footnote-231399583
Ref: Python API の変更<6>-Footnote-241399649
Ref: Python API の変更<6>-Footnote-251399715
Ref: Python API の変更<6>-Footnote-261399781
Ref: Python API の変更<6>-Footnote-271399847
Node: C API の変更<10>1399890
Ref: whatsnew/3 8 changes-in-the-c-api1400048
Ref: c9b1400048
Ref: C API の変更<10>-Footnote-11405844
Ref: C API の変更<10>-Footnote-21405909
Ref: C API の変更<10>-Footnote-31405974
Ref: C API の変更<10>-Footnote-41406039
Ref: C API の変更<10>-Footnote-51406104
Ref: C API の変更<10>-Footnote-61406169
Ref: C API の変更<10>-Footnote-71406234
Ref: C API の変更<10>-Footnote-81406299
Node: CPython バイトコードの変更<6>1406364
Ref: whatsnew/3 8 cpython-bytecode-changes1406517
Ref: ca31406517
Ref: CPython バイトコードの変更<6>-Footnote-11407855
Ref: CPython バイトコードの変更<6>-Footnote-21407920
Ref: CPython バイトコードの変更<6>-Footnote-31407985
Ref: CPython バイトコードの変更<6>-Footnote-41408027
Node: Demos and Tools<2>1408092
Ref: whatsnew/3 8 demos-and-tools1408217
Ref: ca71408217
Ref: Demos and Tools<2>-Footnote-11411512
Ref: Demos and Tools<2>-Footnote-21411577
Ref: Demos and Tools<2>-Footnote-31411705
Node: Python3 8 1 での重要な変更点1411753
Ref: whatsnew/3 8 notable-changes-in-python-3-8-11411927
Ref: ca81411927
Ref: Python3 8 1 での重要な変更点-Footnote-11412490
Node: Python3 8 2 での重要な変更点1412555
Ref: whatsnew/3 8 notable-changes-in-python-3-8-21412737
Ref: ca91412737
Ref: Python3 8 2 での重要な変更点-Footnote-11413061
Node: Notable changes in Python 3 8 31413116
Ref: whatsnew/3 8 notable-changes-in-python-3-8-31413298
Ref: caa1413298
Ref: Notable changes in Python 3 8 3-Footnote-11413685
Node: Python3 8 8 での重要な変更点1413740
Ref: whatsnew/3 8 notable-changes-in-python-3-8-81413917
Ref: cab1413917
Ref: Python3 8 8 での重要な変更点-Footnote-11414637
Node: Notable changes in Python 3 8 91414702
Ref: whatsnew/3 8 notable-changes-in-python-3-8-91414880
Ref: cac1414880
Ref: Notable changes in Python 3 8 9-Footnote-11415351
Node: Notable changes in Python 3 8 101415406
Ref: whatsnew/3 8 notable-changes-in-python-3-8-101415583
Ref: cad1415583
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>1415811
Ref: whatsnew/3 8 macos-11-0-big-sur-and-apple-silicon-mac-support1415946
Ref: cae1415946
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>-Footnote-11416936
Node: Notable changes in Python 3 8 10<2>1416991
Ref: whatsnew/3 8 id11417169
Ref: caf1417169
Node: urllib parse<4>1417293
Ref: whatsnew/3 8 urllib-parse1417380
Ref: cb01417380
Ref: urllib parse<4>-Footnote-11417910
Ref: urllib parse<4>-Footnote-21417969
Node: Notable changes in Python 3 8 121418034
Ref: whatsnew/3 8 notable-changes-in-python-3-8-121418214
Ref: cb11418214
Node: Python API の変更<7>1418354
Ref: whatsnew/3 8 id21418446
Ref: cb21418446
Ref: Python API の変更<7>-Footnote-11419044
Node: Notable security feature in 3 8 141419109
Ref: whatsnew/3 8 notable-security-feature-in-3-8-141419279
Ref: cb31419279
Ref: Notable security feature in 3 8 14-Footnote-11420009
Node: Notable changes in 3 8 171420065
Ref: whatsnew/3 8 notable-changes-in-3-8-171420194
Ref: cb41420194
Node: tarfile<6>1420294
Ref: whatsnew/3 8 id31420366
Ref: cb51420366
Ref: tarfile<6>-Footnote-11420970
Node: What's New In Python 3 71421012
Ref: whatsnew/3 7 doc1421159
Ref: cb61421159
Ref: whatsnew/3 7 translation-repo1421159
Ref: cb71421159
Ref: whatsnew/3 7 what-s-new-in-python-3-71421159
Ref: cb81421159
Node: 概要 -- リリースハイライト<8>1422825
Ref: whatsnew/3 7 summary-release-highlights1422954
Ref: cb91422954
Ref: 概要 -- リリースハイライト<8>-Footnote-11425572
Ref: 概要 -- リリースハイライト<8>-Footnote-21425652
Ref: 概要 -- リリースハイライト<8>-Footnote-31425688
Ref: 概要 -- リリースハイライト<8>-Footnote-41425724
Node: 新しい機能<13>1425760
Ref: whatsnew/3 7 new-features1425925
Ref: ccd1425925
Node: PEP 563 アノテーションの遅延評価1427281
Ref: whatsnew/3 7 pep-563-postponed-evaluation-of-annotations1427437
Ref: cce1427437
Ref: whatsnew/3 7 whatsnew37-pep5631427437
Ref: cba1427437
Ref: PEP 563 アノテーションの遅延評価-Footnote-11429680
Ref: PEP 563 アノテーションの遅延評価-Footnote-21429722
Ref: PEP 563 アノテーションの遅延評価-Footnote-31429764
Node: PEP 538 レガシーな C ロケールの抑圧1429806
Ref: whatsnew/3 7 pep-538-legacy-c-locale-coercion1430007
Ref: ccf1430007
Ref: whatsnew/3 7 whatsnew37-pep5381430007
Ref: cc41430007
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-11433171
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-21433213
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-31433255
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-41433297
Node: PEP 540 強制 UTF-8 実行モード1433339
Ref: whatsnew/3 7 pep-540-forced-utf-8-runtime-mode1433530
Ref: cd21433530
Ref: whatsnew/3 7 whatsnew37-pep5401433530
Ref: cc51433530
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-11435100
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-21435142
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-31435184
Node: PEP 553 組み込みの breakpoint1435226
Ref: whatsnew/3 7 pep-553-built-in-breakpoint1435444
Ref: cd41435444
Ref: whatsnew/3 7 whatsnew37-pep5531435444
Ref: cbe1435444
Ref: PEP 553 組み込みの breakpoint-Footnote-11436342
Node: PEP 539 スレッドローカルストレージのための新しい C API1436384
Ref: whatsnew/3 7 pep-539-new-c-api-for-thread-local-storage1436634
Ref: cd71436634
Ref: whatsnew/3 7 whatsnew37-pep5391436634
Ref: cc91436634
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-11438163
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-21438205
Node: PEP 562 モジュール属性へのアクセスのカスタマイズ1438247
Ref: whatsnew/3 7 pep-562-customization-of-access-to-module-attributes1438528
Ref: cdb1438528
Ref: whatsnew/3 7 whatsnew37-pep5621438528
Ref: cbf1438528
Ref: PEP 562 モジュール属性へのアクセスのカスタマイズ-Footnote-11439151
Node: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数1439193
Ref: whatsnew/3 7 pep-564-new-time-functions-with-nanosecond-resolution1439443
Ref: cde1439443
Ref: whatsnew/3 7 whatsnew37-pep5641439443
Ref: cc31439443
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-11440548
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-21440590
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-31440667
Node: PEP 565 Show DeprecationWarning in __main__1440709
Ref: whatsnew/3 7 pep-565-show-deprecationwarning-in-main1440990
Ref: ce51440990
Ref: whatsnew/3 7 whatsnew37-pep5651440990
Ref: cc81440990
Ref: PEP 565 Show DeprecationWarning in __main__-Footnote-11442914
Node: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート1442956
Ref: whatsnew/3 7 pep-560-core-support-for-typing-module-and-generic-types1443200
Ref: ce61443200
Ref: whatsnew/3 7 whatsnew37-pep5601443200
Ref: cc01443200
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-11444244
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-21444286
Node: PEP 552 Hash-based pyc Files1444328
Ref: whatsnew/3 7 pep-552-hash-based-pyc-files1444570
Ref: ce81444570
Ref: whatsnew/3 7 whatsnew37-pep5521444570
Ref: cc61444570
Ref: PEP 552 Hash-based pyc Files-Footnote-11446256
Ref: PEP 552 Hash-based pyc Files-Footnote-21446297
Ref: PEP 552 Hash-based pyc Files-Footnote-31446339
Node: PEP 545 Python Documentation Translations1446381
Ref: whatsnew/3 7 pep-545-python-documentation-translations1446554
Ref: ce91446554
Ref: whatsnew/3 7 whatsnew37-pep5451446554
Ref: cca1446554
Ref: PEP 545 Python Documentation Translations-Footnote-11447141
Ref: PEP 545 Python Documentation Translations-Footnote-21447183
Node: Python Development Mode -X dev1447225
Ref: whatsnew/3 7 python-development-mode-x-dev1447361
Ref: cea1447361
Ref: whatsnew/3 7 whatsnew37-devmode1447361
Ref: cc71447361
Node: その他の言語変更<7>1447815
Ref: whatsnew/3 7 other-language-changes1447967
Ref: cec1447967
Ref: その他の言語変更<7>-Footnote-11450355
Ref: その他の言語変更<7>-Footnote-21450420
Ref: その他の言語変更<7>-Footnote-31450485
Ref: その他の言語変更<7>-Footnote-41450550
Ref: その他の言語変更<7>-Footnote-51450615
Ref: その他の言語変更<7>-Footnote-61450680
Ref: その他の言語変更<7>-Footnote-71450745
Ref: その他の言語変更<7>-Footnote-81450810
Ref: その他の言語変更<7>-Footnote-91450875
Ref: その他の言語変更<7>-Footnote-101450940
Node: 新たなモジュール<7>1451006
Ref: whatsnew/3 7 new-modules1451172
Ref: cf21451172
Node: contextvars<2>1451360
Ref: whatsnew/3 7 contextvars1451468
Ref: cf31451468
Ref: whatsnew/3 7 whatsnew37-pep5671451468
Ref: cbb1451468
Ref: contextvars<2>-Footnote-11452196
Node: データクラス<3>1452238
Ref: whatsnew/3 7 dataclasses1452377
Ref: cf51452377
Ref: whatsnew/3 7 whatsnew37-pep5571452377
Ref: cbc1452377
Ref: データクラス<3>-Footnote-11453173
Node: importlib resources<2>1453215
Ref: whatsnew/3 7 importlib-resources1453331
Ref: cf81453331
Ref: whatsnew/3 7 whatsnew37-importlib-resources1453331
Ref: cbd1453331
Ref: importlib resources<2>-Footnote-11454063
Ref: importlib resources<2>-Footnote-21454128
Node: 改良されたモジュール<7>1454190
Ref: whatsnew/3 7 improved-modules1454348
Ref: cf91454348
Node: argparse<5>1455826
Ref: whatsnew/3 7 argparse1455927
Ref: cfa1455927
Ref: argparse<5>-Footnote-11456161
Node: asyncio<10>1456226
Ref: whatsnew/3 7 asyncio1456344
Ref: cfc1456344
Ref: whatsnew/3 7 whatsnew37-asyncio1456344
Ref: cc21456344
Ref: asyncio<10>-Footnote-11462629
Ref: asyncio<10>-Footnote-21462694
Ref: asyncio<10>-Footnote-31462736
Ref: asyncio<10>-Footnote-41462801
Ref: asyncio<10>-Footnote-51462866
Ref: asyncio<10>-Footnote-61462931
Ref: asyncio<10>-Footnote-71462996
Ref: asyncio<10>-Footnote-81463061
Ref: asyncio<10>-Footnote-91463126
Ref: asyncio<10>-Footnote-101463191
Ref: asyncio<10>-Footnote-111463257
Ref: asyncio<10>-Footnote-121463323
Ref: asyncio<10>-Footnote-131463389
Ref: asyncio<10>-Footnote-141463455
Ref: asyncio<10>-Footnote-151463521
Ref: asyncio<10>-Footnote-161463587
Ref: asyncio<10>-Footnote-171463653
Ref: asyncio<10>-Footnote-181463719
Ref: asyncio<10>-Footnote-191463785
Ref: asyncio<10>-Footnote-201463851
Ref: asyncio<10>-Footnote-211463917
Ref: asyncio<10>-Footnote-221463983
Ref: asyncio<10>-Footnote-231464049
Ref: asyncio<10>-Footnote-241464115
Node: binascii1464181
Ref: whatsnew/3 7 binascii1464299
Ref: d191464299
Ref: binascii-Footnote-11464576
Node: calendar<3>1464641
Ref: whatsnew/3 7 calendar1464762
Ref: d1b1464762
Ref: calendar<3>-Footnote-11465059
Node: collections<2>1465124
Ref: whatsnew/3 7 collections1465250
Ref: d1d1465250
Ref: collections<2>-Footnote-11465482
Node: compileall<3>1465547
Ref: whatsnew/3 7 compileall1465683
Ref: d1e1465683
Ref: compileall<3>-Footnote-11466080
Node: concurrent futures<4>1466145
Ref: whatsnew/3 7 concurrent-futures1466280
Ref: d201466280
Ref: concurrent futures<4>-Footnote-11466808
Ref: concurrent futures<4>-Footnote-21466873
Node: contextlib<3>1466938
Ref: whatsnew/3 7 contextlib1467071
Ref: d211467071
Ref: contextlib<3>-Footnote-11467601
Ref: contextlib<3>-Footnote-21467666
Ref: contextlib<3>-Footnote-31467731
Ref: contextlib<3>-Footnote-41467796
Node: cProfile<2>1467861
Ref: whatsnew/3 7 cprofile1467978
Ref: d261467978
Ref: cProfile<2>-Footnote-11468204
Node: crypt1468269
Ref: whatsnew/3 7 crypt1468384
Ref: d271468384
Ref: crypt-Footnote-11468705
Ref: crypt-Footnote-21468770
Node: datetime<5>1468835
Ref: whatsnew/3 7 datetime1468945
Ref: d281468945
Ref: datetime<5>-Footnote-11469356
Ref: datetime<5>-Footnote-21469421
Node: dbm<2>1469485
Ref: whatsnew/3 7 dbm1469600
Ref: d2a1469600
Node: decimal<2>1469745
Ref: whatsnew/3 7 decimal1469855
Ref: d2b1469855
Ref: decimal<2>-Footnote-11470076
Node: dis<4>1470141
Ref: whatsnew/3 7 dis1470257
Ref: d2c1470257
Ref: dis<4>-Footnote-11470660
Node: distutils<4>1470725
Ref: whatsnew/3 7 distutils1470838
Ref: d2d1470838
Ref: distutils<4>-Footnote-11471086
Node: enum<5>1471151
Ref: whatsnew/3 7 enum1471270
Ref: d2e1471270
Ref: enum<5>-Footnote-11471944
Ref: enum<5>-Footnote-21472009
Node: functools<4>1472074
Ref: whatsnew/3 7 functools1472186
Ref: d301472186
Ref: functools<4>-Footnote-11472415
Node: gc<6>1472480
Ref: whatsnew/3 7 gc1472592
Ref: d311472592
Ref: gc<6>-Footnote-11473131
Node: hmac<3>1473196
Ref: whatsnew/3 7 hmac1473307
Ref: d351473307
Ref: hmac<3>-Footnote-11473570
Node: http client1473635
Ref: whatsnew/3 7 http-client1473752
Ref: d381473752
Ref: http client-Footnote-11474009
Node: http server1474074
Ref: whatsnew/3 7 http-server1474200
Ref: d3b1474200
Ref: http server-Footnote-11475083
Ref: http server-Footnote-21475148
Ref: http server-Footnote-31475213
Node: idlelib と IDLE1475278
Ref: whatsnew/3 7 idlelib-and-idle1475405
Ref: d3f1475405
Ref: idlelib と IDLE-Footnote-11478456
Ref: idlelib と IDLE-Footnote-21478521
Ref: idlelib と IDLE-Footnote-31478588
Ref: idlelib と IDLE-Footnote-41478653
Ref: idlelib と IDLE-Footnote-51478718
Ref: idlelib と IDLE-Footnote-61478783
Ref: idlelib と IDLE-Footnote-71478848
Ref: idlelib と IDLE-Footnote-81478913
Ref: idlelib と IDLE-Footnote-91478978
Ref: idlelib と IDLE-Footnote-101479043
Ref: idlelib と IDLE-Footnote-111479111
Ref: idlelib と IDLE-Footnote-121479176
Ref: idlelib と IDLE-Footnote-131479242
Node: importlib<4>1479308
Ref: whatsnew/3 7 importlib1479429
Ref: d401479429
Ref: importlib<4>-Footnote-11480316
Ref: importlib<4>-Footnote-21480381
Ref: importlib<4>-Footnote-31480446
Node: io<6>1480511
Ref: whatsnew/3 7 io1480628
Ref: d431480628
Ref: io<6>-Footnote-11480893
Ref: io<6>-Footnote-21480958
Node: ipaddress<3>1481023
Ref: whatsnew/3 7 ipaddress1481140
Ref: d451481140
Ref: ipaddress<3>-Footnote-11481460
Node: itertools<6>1481525
Ref: whatsnew/3 7 itertools1481646
Ref: d461481646
Ref: itertools<6>-Footnote-11481883
Node: locale<4>1481948
Ref: whatsnew/3 7 locale1482067
Ref: d481482067
Ref: locale<4>-Footnote-11482481
Node: logging<3>1482546
Ref: whatsnew/3 7 logging1482660
Ref: d491482660
Ref: logging<3>-Footnote-11483222
Ref: logging<3>-Footnote-21483287
Ref: logging<3>-Footnote-31483352
Node: math<7>1483417
Ref: whatsnew/3 7 math1483534
Ref: d4d1483534
Ref: math<7>-Footnote-11483759
Node: mimetypes<3>1483824
Ref: whatsnew/3 7 mimetypes1483937
Ref: d4f1483937
Ref: mimetypes<3>-Footnote-11484152
Node: msilib1484217
Ref: whatsnew/3 7 msilib1484341
Ref: d501484341
Ref: msilib-Footnote-11484536
Node: multiprocessing<5>1484601
Ref: whatsnew/3 7 multiprocessing1484718
Ref: d511484718
Ref: multiprocessing<5>-Footnote-11485371
Ref: multiprocessing<5>-Footnote-21485436
Ref: multiprocessing<5>-Footnote-31485501
Node: os<8>1485566
Ref: whatsnew/3 7 os1485688
Ref: d551485688
Ref: os<8>-Footnote-11486986
Ref: os<8>-Footnote-21487051
Ref: os<8>-Footnote-31487116
Ref: os<8>-Footnote-41487181
Ref: os<8>-Footnote-51487246
Ref: os<8>-Footnote-61487311
Ref: os<8>-Footnote-71487376
Node: pathlib<11>1487441
Ref: whatsnew/3 7 pathlib1487551
Ref: d601487551
Ref: pathlib<11>-Footnote-11487811
Node: pdb<6>1487876
Ref: whatsnew/3 7 pdb1487994
Ref: d611487994
Ref: pdb<6>-Footnote-11488404
Ref: pdb<6>-Footnote-21488469
Node: py_compile<3>1488534
Ref: whatsnew/3 7 py-compile1488649
Ref: d621488649
Ref: py_compile<3>-Footnote-11489099
Ref: py_compile<3>-Footnote-21489140
Node: pydoc<3>1489205
Ref: whatsnew/3 7 pydoc1489322
Ref: d631489322
Ref: pydoc<3>-Footnote-11489546
Node: queue<2>1489611
Ref: whatsnew/3 7 queue1489720
Ref: d641489720
Ref: queue<2>-Footnote-11489903
Node: re<5>1489968
Ref: whatsnew/3 7 re1490078
Ref: d661490078
Ref: re<5>-Footnote-11491160
Ref: re<5>-Footnote-21491225
Ref: re<5>-Footnote-31491290
Ref: re<5>-Footnote-41491355
Ref: re<5>-Footnote-51491420
Node: signal<2>1491485
Ref: whatsnew/3 7 signal1491596
Ref: d6a1491596
Ref: signal<2>-Footnote-11491915
Node: socket<6>1491980
Ref: whatsnew/3 7 socket1492098
Ref: d6c1492098
Ref: socket<6>-Footnote-11493204
Ref: socket<6>-Footnote-21493269
Ref: socket<6>-Footnote-31493334
Ref: socket<6>-Footnote-41493399
Ref: socket<6>-Footnote-51493464
Ref: socket<6>-Footnote-61493529
Node: socketserver1493594
Ref: whatsnew/3 7 socketserver1493713
Ref: d721493713
Node: sqlite3<7>1494197
Ref: whatsnew/3 7 sqlite31494313
Ref: d761494313
Ref: sqlite3<7>-Footnote-11494755
Ref: sqlite3<7>-Footnote-21494820
Node: ssl<6>1494885
Ref: whatsnew/3 7 ssl1494998
Ref: d781494998
Ref: ssl<6>-Footnote-11498293
Ref: ssl<6>-Footnote-21498358
Ref: ssl<6>-Footnote-31498423
Ref: ssl<6>-Footnote-41498488
Ref: ssl<6>-Footnote-51498553
Ref: ssl<6>-Footnote-61498618
Ref: ssl<6>-Footnote-71498683
Ref: ssl<6>-Footnote-81498748
Ref: ssl<6>-Footnote-91498813
Ref: ssl<6>-Footnote-101498878
Ref: ssl<6>-Footnote-111498944
Ref: ssl<6>-Footnote-121499010
Ref: ssl<6>-Footnote-131499076
Ref: ssl<6>-Footnote-141499142
Node: string<2>1499198
Ref: whatsnew/3 7 string1499314
Ref: d811499314
Ref: string<2>-Footnote-11499591
Node: subprocess<2>1499658
Ref: whatsnew/3 7 subprocess1499774
Ref: d821499774
Ref: subprocess<2>-Footnote-11501094
Ref: subprocess<2>-Footnote-21501159
Ref: subprocess<2>-Footnote-31501224
Ref: subprocess<2>-Footnote-41501289
Node: sys<8>1501354
Ref: whatsnew/3 7 sys1501468
Ref: d861501468
Ref: sys<8>-Footnote-11502208
Ref: sys<8>-Footnote-21502273
Ref: sys<8>-Footnote-31502338
Node: time<5>1502403
Ref: whatsnew/3 7 time1502514
Ref: d8a1502514
Ref: time<5>-Footnote-11503723
Ref: time<5>-Footnote-21503765
Node: tkinter<6>1503830
Ref: whatsnew/3 7 tkinter1503949
Ref: d901503949
Ref: tkinter<6>-Footnote-11504130
Node: tracemalloc<2>1504195
Ref: whatsnew/3 7 tracemalloc1504315
Ref: d921504315
Ref: tracemalloc<2>-Footnote-11504781
Node: types<5>1504846
Ref: whatsnew/3 7 types1504970
Ref: d951504970
Ref: types<5>-Footnote-11505485
Ref: types<5>-Footnote-21505550
Ref: types<5>-Footnote-31505615
Ref: types<5>-Footnote-41505657
Node: unicodedata<7>1505722
Ref: whatsnew/3 7 unicodedata1505843
Ref: d9a1505843
Ref: unicodedata<7>-Footnote-11506046
Node: unittest<8>1506102
Ref: whatsnew/3 7 unittest1506228
Ref: d9b1506228
Ref: unittest<8>-Footnote-11506633
Node: unittest mock1506698
Ref: whatsnew/3 7 unittest-mock1506825
Ref: d9c1506825
Ref: unittest mock-Footnote-11507343
Ref: unittest mock-Footnote-21507408
Node: urllib parse<5>1507473
Ref: whatsnew/3 7 urllib-parse1507591
Ref: d9f1507591
Ref: urllib parse<5>-Footnote-11507904
Ref: urllib parse<5>-Footnote-21507963
Ref: urllib parse<5>-Footnote-31508022
Node: uu1508087
Ref: whatsnew/3 7 uu1508199
Ref: da11508199
Ref: uu-Footnote-11508463
Node: uuid<4>1508528
Ref: whatsnew/3 7 uuid1508636
Ref: da21508636
Ref: uuid<4>-Footnote-11509276
Ref: uuid<4>-Footnote-21509341
Node: warnings<3>1509406
Ref: whatsnew/3 7 warnings1509518
Ref: da61509518
Ref: warnings<3>-Footnote-11510943
Ref: warnings<3>-Footnote-21511008
Ref: warnings<3>-Footnote-31511073
Ref: warnings<3>-Footnote-41511138
Node: xml<5>1511203
Ref: whatsnew/3 7 xml1511317
Ref: da81511317
Ref: xml<5>-Footnote-11511601
Node: xml etree1511656
Ref: whatsnew/3 7 xml-etree1511772
Ref: da91511772
Ref: xml etree-Footnote-11512113
Node: xmlrpc server1512178
Ref: whatsnew/3 7 xmlrpc-server1512294
Ref: dab1512294
Ref: xmlrpc server-Footnote-11512505
Node: zipapp1512569
Ref: whatsnew/3 7 zipapp1512686
Ref: dac1512686
Ref: zipapp-Footnote-11513210
Ref: zipapp-Footnote-21513275
Node: zipfile<3>1513340
Ref: whatsnew/3 7 zipfile1513435
Ref: dae1513435
Ref: zipfile<3>-Footnote-11513800
Ref: zipfile<3>-Footnote-21513865
Node: C API の変更<11>1513930
Ref: whatsnew/3 7 c-api-changes1514077
Ref: daf1514077
Ref: C API の変更<11>-Footnote-11518608
Ref: C API の変更<11>-Footnote-21518673
Ref: C API の変更<11>-Footnote-31518738
Ref: C API の変更<11>-Footnote-41518803
Ref: C API の変更<11>-Footnote-51518868
Ref: C API の変更<11>-Footnote-61518933
Ref: C API の変更<11>-Footnote-71518998
Ref: C API の変更<11>-Footnote-81519063
Ref: C API の変更<11>-Footnote-91519128
Ref: C API の変更<11>-Footnote-101519193
Ref: C API の変更<11>-Footnote-111519259
Ref: C API の変更<11>-Footnote-121519325
Ref: C API の変更<11>-Footnote-131519391
Ref: C API の変更<11>-Footnote-141519457
Ref: C API の変更<11>-Footnote-151519523
Ref: C API の変更<11>-Footnote-161519588
Ref: C API の変更<11>-Footnote-171519654
Ref: C API の変更<11>-Footnote-181519720
Ref: C API の変更<11>-Footnote-191519786
Ref: C API の変更<11>-Footnote-201519852
Node: Build Changes<6>1519918
Ref: whatsnew/3 7 build-changes1520044
Ref: dc81520044
Ref: Build Changes<6>-Footnote-11521177
Ref: Build Changes<6>-Footnote-21521242
Ref: Build Changes<6>-Footnote-31521307
Node: 最適化<8>1521372
Ref: whatsnew/3 7 optimizations1521521
Ref: dc91521521
Ref: whatsnew/3 7 whatsnew37-perf1521521
Ref: ccb1521521
Ref: whatsnew/3 7 whatsnew37-asyncio-perf1522204
Ref: cfd1522204
Ref: 最適化<8>-Footnote-11526780
Ref: 最適化<8>-Footnote-21526845
Ref: 最適化<8>-Footnote-31526910
Ref: 最適化<8>-Footnote-41526975
Ref: 最適化<8>-Footnote-51527040
Ref: 最適化<8>-Footnote-61527105
Ref: 最適化<8>-Footnote-71527170
Ref: 最適化<8>-Footnote-81527235
Ref: 最適化<8>-Footnote-91527300
Ref: 最適化<8>-Footnote-101527365
Ref: 最適化<8>-Footnote-111527431
Ref: 最適化<8>-Footnote-121527497
Ref: 最適化<8>-Footnote-131527563
Ref: 最適化<8>-Footnote-141527629
Ref: 最適化<8>-Footnote-151527695
Ref: 最適化<8>-Footnote-161527761
Ref: 最適化<8>-Footnote-171527827
Ref: 最適化<8>-Footnote-181527893
Ref: 最適化<8>-Footnote-191527959
Ref: 最適化<8>-Footnote-201528025
Ref: 最適化<8>-Footnote-211528091
Ref: 最適化<8>-Footnote-221528157
Ref: 最適化<8>-Footnote-231528223
Ref: 最適化<8>-Footnote-241528289
Ref: 最適化<8>-Footnote-251528355
Ref: 最適化<8>-Footnote-261528421
Ref: 最適化<8>-Footnote-271528487
Ref: 最適化<8>-Footnote-281528553
Ref: 最適化<8>-Footnote-291528619
Ref: 最適化<8>-Footnote-301528685
Node: その他の CPython の実装の変更<2>1528751
Ref: whatsnew/3 7 other-cpython-implementation-changes1528913
Ref: dd91528913
Ref: その他の CPython の実装の変更<2>-Footnote-11530314
Ref: その他の CPython の実装の変更<2>-Footnote-21530379
Ref: その他の CPython の実装の変更<2>-Footnote-31530444
Ref: その他の CPython の実装の変更<2>-Footnote-41530509
Ref: その他の CPython の実装の変更<2>-Footnote-51530574
Node: 非推奨の Python の挙動1530639
Ref: whatsnew/3 7 deprecated-python-behavior1530848
Ref: ddc1530848
Ref: 非推奨の Python の挙動-Footnote-11531954
Ref: 非推奨の Python の挙動-Footnote-21532019
Node: 非推奨の Python モジュール、関数、メソッド1532084
Ref: whatsnew/3 7 deprecated-python-modules-functions-and-methods1532293
Ref: dde1532293
Node: aifc1532697
Ref: whatsnew/3 7 aifc1532817
Ref: ddf1532817
Ref: aifc-Footnote-11533037
Node: asyncio<11>1533102
Ref: whatsnew/3 7 id21533245
Ref: de01533245
Ref: whatsnew/3 7 whatsnew37-asyncio-deprecated1533245
Ref: d181533245
Ref: asyncio<11>-Footnote-11533770
Ref: asyncio<11>-Footnote-21533835
Node: collections<3>1533900
Ref: whatsnew/3 7 id31534045
Ref: de11534045
Ref: collections<3>-Footnote-11534424
Node: dbm<3>1534489
Ref: whatsnew/3 7 id41534630
Ref: de21534630
Ref: dbm<3>-Footnote-11535031
Node: enum<6>1535096
Ref: whatsnew/3 7 id51535233
Ref: de31535233
Ref: enum<6>-Footnote-11535689
Node: gettext<2>1535754
Ref: whatsnew/3 7 gettext1535897
Ref: de41535897
Ref: gettext<2>-Footnote-11536142
Node: importlib<5>1536207
Ref: whatsnew/3 7 id61536352
Ref: de51536352
Ref: importlib<5>-Footnote-11536862
Node: locale<5>1536927
Ref: whatsnew/3 7 id71537069
Ref: de71537069
Ref: locale<5>-Footnote-11537272
Node: macpath1537337
Ref: whatsnew/3 7 macpath1537479
Ref: de81537479
Ref: macpath-Footnote-11537669
Node: threading<6>1537733
Ref: whatsnew/3 7 threading1537875
Ref: de91537875
Ref: threading<6>-Footnote-11538173
Node: socket<7>1538238
Ref: whatsnew/3 7 id81538379
Ref: dea1538379
Ref: socket<7>-Footnote-11538724
Node: ssl<7>1538789
Ref: whatsnew/3 7 id91538923
Ref: deb1538923
Ref: ssl<7>-Footnote-11539135
Node: sunau1539200
Ref: whatsnew/3 7 sunau1539331
Ref: dec1539331
Ref: sunau-Footnote-11539557
Node: sys<9>1539622
Ref: whatsnew/3 7 id101539751
Ref: ded1539751
Ref: sys<9>-Footnote-11540068
Node: wave1540133
Ref: whatsnew/3 7 wave1540248
Ref: dee1540248
Ref: wave-Footnote-11540476
Node: C API の非推奨の関数ならびに型1540541
Ref: whatsnew/3 7 deprecated-functions-and-types-of-the-c-api1540778
Ref: def1540778
Ref: C API の非推奨の関数ならびに型-Footnote-11541422
Ref: C API の非推奨の関数ならびに型-Footnote-21541487
Node: サポート対象プラットフォームからの除外1541552
Ref: whatsnew/3 7 id111541755
Ref: df01541755
Ref: whatsnew/3 7 platform-support-removals1541755
Ref: d7b1541755
Ref: サポート対象プラットフォームからの除外-Footnote-11543243
Ref: サポート対象プラットフォームからの除外-Footnote-21543310
Node: API と機能の削除<2>1543390
Ref: whatsnew/3 7 api-and-feature-removals1543566
Ref: df11543566
Ref: API と機能の削除<2>-Footnote-11546463
Ref: API と機能の削除<2>-Footnote-21546528
Ref: API と機能の削除<2>-Footnote-31546593
Node: Module Removals1546658
Ref: whatsnew/3 7 module-removals1546797
Ref: df51546797
Ref: Module Removals-Footnote-11547132
Node: Windows-only Changes1547197
Ref: whatsnew/3 7 windows-only-changes1547334
Ref: df61547334
Ref: Windows-only Changes-Footnote-11548211
Ref: Windows-only Changes-Footnote-21548276
Node: Python 3 7 への移植1548341
Ref: whatsnew/3 7 porting-to-python-3-71548500
Ref: df71548500
Ref: whatsnew/3 7 porting-to-python-371548500
Ref: ccc1548500
Node: Python の挙動の変更<2>1549080
Ref: whatsnew/3 7 changes-in-python-behavior1549200
Ref: df81549200
Ref: Python の挙動の変更<2>-Footnote-11551077
Ref: Python の挙動の変更<2>-Footnote-21551142
Ref: Python の挙動の変更<2>-Footnote-31551184
Ref: Python の挙動の変更<2>-Footnote-41551249
Ref: Python の挙動の変更<2>-Footnote-51551314
Ref: Python の挙動の変更<2>-Footnote-61551379
Node: Python API の変更<8>1551444
Ref: whatsnew/3 7 changes-in-the-python-api1551592
Ref: dfb1551592
Ref: Python API の変更<8>-Footnote-11561116
Ref: Python API の変更<8>-Footnote-21561181
Ref: Python API の変更<8>-Footnote-31561246
Ref: Python API の変更<8>-Footnote-41561311
Ref: Python API の変更<8>-Footnote-51561376
Ref: Python API の変更<8>-Footnote-61561441
Ref: Python API の変更<8>-Footnote-71561506
Ref: Python API の変更<8>-Footnote-81561571
Ref: Python API の変更<8>-Footnote-91561636
Ref: Python API の変更<8>-Footnote-101561701
Ref: Python API の変更<8>-Footnote-111561767
Ref: Python API の変更<8>-Footnote-121561833
Ref: Python API の変更<8>-Footnote-131561899
Ref: Python API の変更<8>-Footnote-141561965
Ref: Python API の変更<8>-Footnote-151562008
Ref: Python API の変更<8>-Footnote-161562074
Ref: Python API の変更<8>-Footnote-171562140
Ref: Python API の変更<8>-Footnote-181562206
Ref: Python API の変更<8>-Footnote-191562272
Ref: Python API の変更<8>-Footnote-201562338
Ref: Python API の変更<8>-Footnote-211562404
Ref: Python API の変更<8>-Footnote-221562470
Ref: Python API の変更<8>-Footnote-231562536
Ref: Python API の変更<8>-Footnote-241562602
Ref: Python API の変更<8>-Footnote-251562668
Ref: Python API の変更<8>-Footnote-261562734
Ref: Python API の変更<8>-Footnote-271562800
Ref: Python API の変更<8>-Footnote-281562866
Ref: Python API の変更<8>-Footnote-291562932
Ref: Python API の変更<8>-Footnote-301562998
Node: C API の変更<12>1563064
Ref: whatsnew/3 7 changes-in-the-c-api1563222
Ref: e1b1563222
Ref: C API の変更<12>-Footnote-11563845
Node: CPython バイトコードの変更<7>1563910
Ref: whatsnew/3 7 cpython-bytecode-changes1564068
Ref: e1c1564068
Ref: CPython バイトコードの変更<7>-Footnote-11564421
Ref: CPython バイトコードの変更<7>-Footnote-21564486
Node: Windows-only Changes<2>1564551
Ref: whatsnew/3 7 id121564732
Ref: e1d1564732
Ref: Windows-only Changes<2>-Footnote-11565062
Node: その他の CPython の実装の変更<3>1565127
Ref: whatsnew/3 7 id131565261
Ref: e1f1565261
Ref: その他の CPython の実装の変更<3>-Footnote-11567581
Ref: その他の CPython の実装の変更<3>-Footnote-21567623
Ref: その他の CPython の実装の変更<3>-Footnote-31567688
Node: Python 3 7 1 での重要な変更点1567753
Ref: whatsnew/3 7 notable-changes-in-python-3-7-11567929
Ref: e211567929
Ref: Python 3 7 1 での重要な変更点-Footnote-11568866
Ref: Python 3 7 1 での重要な変更点-Footnote-21568931
Ref: Python 3 7 1 での重要な変更点-Footnote-31568996
Node: Python 3 7 2 での重要な変更点1569061
Ref: whatsnew/3 7 notable-changes-in-python-3-7-21569251
Ref: e241569251
Node: Python 3 7 6 での重要な変更点1569750
Ref: whatsnew/3 7 notable-changes-in-python-3-7-61569941
Ref: e251569941
Ref: Python 3 7 6 での重要な変更点-Footnote-11570506
Node: Python 3 7 10 での重要な変更点1570571
Ref: whatsnew/3 7 notable-changes-in-python-3-7-101570757
Ref: e261570757
Ref: Python 3 7 10 での重要な変更点-Footnote-11571481
Node: Notable changes in Python 3 7 111571546
Ref: whatsnew/3 7 notable-changes-in-python-3-7-111571729
Ref: e271571729
Ref: Notable changes in Python 3 7 11-Footnote-11572646
Ref: Notable changes in Python 3 7 11-Footnote-21572701
Node: Notable security feature in 3 7 141572756
Ref: whatsnew/3 7 notable-security-feature-in-3-7-141572892
Ref: e281572892
Ref: Notable security feature in 3 7 14-Footnote-11573622
Node: What's New In Python 3 61573678
Ref: whatsnew/3 6 doc1573825
Ref: e291573825
Ref: whatsnew/3 6 translation-repo1573825
Ref: e2a1573825
Ref: whatsnew/3 6 what-s-new-in-python-3-61573825
Ref: e2b1573825
Ref: What's New In Python 3 6-Footnote-11575276
Ref: What's New In Python 3 6-Footnote-21575336
Node: 概要 -- リリースハイライト<9>1575378
Ref: whatsnew/3 6 summary-release-highlights1575507
Ref: e2c1575507
Ref: 概要 -- リリースハイライト<9>-Footnote-11580345
Ref: 概要 -- リリースハイライト<9>-Footnote-21580425
Ref: 概要 -- リリースハイライト<9>-Footnote-31580515
Node: 新しい機能<14>1580557
Ref: whatsnew/3 6 new-features1580722
Ref: e401580722
Ref: whatsnew/3 6 pypy-dict-implementation1580722
Ref: e411580722
Node: PEP 498 フォーマット済み文字列リテラル1582393
Ref: whatsnew/3 6 pep-498-formatted-string-literals1582555
Ref: e421582555
Ref: whatsnew/3 6 whatsnew36-pep4981582555
Ref: e2d1582555
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-11583675
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-21583717
Node: PEP 526 変数アノテーションの文法1583759
Ref: whatsnew/3 6 pep-526-syntax-for-variable-annotations1583983
Ref: e431583983
Ref: whatsnew/3 6 whatsnew36-pep5261583983
Ref: e2f1583983
Ref: PEP 526 変数アノテーションの文法-Footnote-11585377
Ref: PEP 526 変数アノテーションの文法-Footnote-21585419
Ref: PEP 526 変数アノテーションの文法-Footnote-31585461
Ref: PEP 526 変数アノテーションの文法-Footnote-41585496
Node: PEP 515 数値リテラル内のアンダースコア1585537
Ref: whatsnew/3 6 pep-515-underscores-in-numeric-literals1585743
Ref: e441585743
Ref: whatsnew/3 6 whatsnew36-pep5151585743
Ref: e2e1585743
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-11586927
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-21586969
Node: PEP 525 非同期ジェネレータ1587011
Ref: whatsnew/3 6 pep-525-asynchronous-generators1587202
Ref: e451587202
Ref: whatsnew/3 6 whatsnew36-pep5251587202
Ref: e301587202
Ref: PEP 525 非同期ジェネレータ-Footnote-11588122
Ref: PEP 525 非同期ジェネレータ-Footnote-21588164
Node: PEP 530 非同期内包表記1588206
Ref: whatsnew/3 6 pep-530-asynchronous-comprehensions1588391
Ref: e461588391
Ref: whatsnew/3 6 whatsnew36-pep5301588391
Ref: e311588391
Ref: PEP 530 非同期内包表記-Footnote-11588968
Ref: PEP 530 非同期内包表記-Footnote-21589010
Node: PEP 487 Simpler customization of class creation1589052
Ref: whatsnew/3 6 pep-487-simpler-customization-of-class-creation1589243
Ref: e471589243
Ref: whatsnew/3 6 whatsnew36-pep4871589243
Ref: e341589243
Ref: PEP 487 Simpler customization of class creation-Footnote-11590324
Node: PEP 487 記述子プロトコルの改善1590366
Ref: whatsnew/3 6 pep-487-descriptor-protocol-enhancements1590590
Ref: e4a1590590
Ref: whatsnew/3 6 whatsnew36-pep487-descriptors1590590
Ref: e4b1590590
Ref: PEP 487 記述子プロトコルの改善-Footnote-11591810
Ref: PEP 487 記述子プロトコルの改善-Footnote-21591852
Node: PEP 519 ファイルシステムパスプロトコルの追加1591894
Ref: whatsnew/3 6 pep-519-adding-a-file-system-path-protocol1592109
Ref: e4e1592109
Ref: whatsnew/3 6 whatsnew36-pep5191592109
Ref: e391592109
Ref: PEP 519 ファイルシステムパスプロトコルの追加-Footnote-11594933
Node: PEP 495 地域時間の曖昧さ回避1594975
Ref: whatsnew/3 6 pep-495-local-time-disambiguation1595235
Ref: e541595235
Ref: whatsnew/3 6 whatsnew36-pep4951595235
Ref: e3a1595235
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-11596753
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-21596795
Node: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更1596837
Ref: whatsnew/3 6 pep-529-change-windows-filesystem-encoding-to-utf-81597112
Ref: e561597112
Ref: whatsnew/3 6 whatsnew36-pep5291597112
Ref: e3e1597112
Ref: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更-Footnote-11598191
Node: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更1598233
Ref: whatsnew/3 6 pep-528-change-windows-console-encoding-to-utf-81598520
Ref: e581598520
Ref: whatsnew/3 6 whatsnew36-pep5281598520
Ref: e3d1598520
Ref: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更-Footnote-11599284
Node: PEP 520 クラス属性の定義の順番を保持1599326
Ref: whatsnew/3 6 pep-520-preserving-class-attribute-definition-order1599574
Ref: e5a1599574
Ref: whatsnew/3 6 whatsnew36-pep5201599574
Ref: e351599574
Ref: PEP 520 クラス属性の定義の順番を保持-Footnote-11600187
Node: PEP 468 キーワード引数の順番の保持1600229
Ref: whatsnew/3 6 pep-468-preserving-keyword-argument-order1600421
Ref: e5d1600421
Ref: whatsnew/3 6 whatsnew36-pep4681600421
Ref: e361600421
Ref: PEP 468 キーワード引数の順番の保持-Footnote-11600833
Node: 新たな dict 実装1600875
Ref: whatsnew/3 6 new-dict-implementation1601068
Ref: e5e1601068
Ref: whatsnew/3 6 whatsnew36-compactdict1601068
Ref: e331601068
Ref: 新たな dict 実装-Footnote-11602033
Ref: 新たな dict 実装-Footnote-21602113
Ref: 新たな dict 実装-Footnote-31602203
Ref: 新たな dict 実装-Footnote-41602268
Node: PEP 523 CPython にフレーム評価 API を追加1602348
Ref: whatsnew/3 6 pep-523-adding-a-frame-evaluation-api-to-cpython1602519
Ref: e5f1602519
Ref: whatsnew/3 6 whatsnew36-pep5231602519
Ref: e601602519
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-11603676
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-21603718
Node: PYTHONMALLOC 環境変数1603760
Ref: whatsnew/3 6 pythonmalloc-environment-variable1603946
Ref: e611603946
Ref: whatsnew/3 6 whatsnew36-pythonmalloc1603946
Ref: e381603946
Ref: PYTHONMALLOC 環境変数-Footnote-11607348
Ref: PYTHONMALLOC 環境変数-Footnote-21607413
Node: DTrace and SystemTap probing support1607478
Ref: whatsnew/3 6 dtrace-and-systemtap-probing-support1607604
Ref: e691607604
Ref: whatsnew/3 6 whatsnew36-tracing1607604
Ref: e371607604
Ref: DTrace and SystemTap probing support-Footnote-11608516
Node: その他の言語変更<8>1608581
Ref: whatsnew/3 6 other-language-changes1608733
Ref: e6b1608733
Ref: その他の言語変更<8>-Footnote-11610127
Ref: その他の言語変更<8>-Footnote-21610192
Ref: その他の言語変更<8>-Footnote-31610257
Ref: その他の言語変更<8>-Footnote-41610322
Node: 新たなモジュール<8>1610387
Ref: whatsnew/3 6 new-modules1610553
Ref: e6f1610553
Node: secrets1610630
Ref: whatsnew/3 6 secrets1610701
Ref: e701610701
Ref: whatsnew/3 6 whatsnew36-pep5061610701
Ref: e321610701
Ref: secrets-Footnote-11611373
Node: 改良されたモジュール<8>1611415
Ref: whatsnew/3 6 improved-modules1611566
Ref: e711611566
Node: array<3>1613127
Ref: whatsnew/3 6 array1613220
Ref: e721613220
Ref: array<3>-Footnote-11613513
Node: ast<6>1613578
Ref: whatsnew/3 6 ast1613691
Ref: e731613691
Ref: ast<6>-Footnote-11613940
Node: asyncio<12>1614005
Ref: whatsnew/3 6 asyncio1614121
Ref: e741614121
Ref: asyncio<12>-Footnote-11617585
Ref: asyncio<12>-Footnote-21617650
Ref: asyncio<12>-Footnote-31617695
Ref: asyncio<12>-Footnote-41617760
Ref: asyncio<12>-Footnote-51617825
Ref: asyncio<12>-Footnote-61617890
Ref: asyncio<12>-Footnote-71617955
Ref: asyncio<12>-Footnote-81618020
Ref: asyncio<12>-Footnote-91618085
Ref: asyncio<12>-Footnote-101618150
Ref: asyncio<12>-Footnote-111618216
Ref: asyncio<12>-Footnote-121618282
Node: binascii<2>1618348
Ref: whatsnew/3 6 binascii1618463
Ref: e7e1618463
Ref: binascii<2>-Footnote-11618748
Node: cmath1618813
Ref: whatsnew/3 6 cmath1618931
Ref: e801618931
Ref: cmath-Footnote-11619445
Ref: cmath-Footnote-21619510
Ref: cmath-Footnote-31619552
Node: collections<4>1619617
Ref: whatsnew/3 6 collections1619745
Ref: e871619745
Ref: collections<4>-Footnote-11620851
Ref: collections<4>-Footnote-21620916
Ref: collections<4>-Footnote-31620981
Ref: collections<4>-Footnote-41621046
Ref: collections<4>-Footnote-51621111
Ref: collections<4>-Footnote-61621176
Node: concurrent futures<5>1621241
Ref: whatsnew/3 6 concurrent-futures1621377
Ref: e8c1621377
Ref: concurrent futures<5>-Footnote-11621708
Node: contextlib<4>1621773
Ref: whatsnew/3 6 contextlib1621906
Ref: e8d1621906
Ref: contextlib<4>-Footnote-11622402
Node: datetime<6>1622467
Ref: whatsnew/3 6 datetime1622589
Ref: e901622589
Ref: datetime<6>-Footnote-11623611
Ref: datetime<6>-Footnote-21623676
Ref: datetime<6>-Footnote-31623741
Ref: datetime<6>-Footnote-41623806
Node: decimal<3>1623871
Ref: whatsnew/3 6 decimal1623992
Ref: e951623992
Ref: decimal<3>-Footnote-11624405
Node: distutils<5>1624470
Ref: whatsnew/3 6 distutils1624588
Ref: e971624588
Ref: distutils<5>-Footnote-11624962
Node: email<3>1625027
Ref: whatsnew/3 6 email1625162
Ref: e981625162
Ref: email<3>-Footnote-11626078
Ref: email<3>-Footnote-21626143
Ref: email<3>-Footnote-31626208
Node: エンコーディング<2>1626273
Ref: whatsnew/3 6 encodings1626403
Ref: e9c1626403
Ref: エンコーディング<2>-Footnote-11626720
Node: enum<7>1626785
Ref: whatsnew/3 6 enum1626922
Ref: e9d1626922
Ref: enum<7>-Footnote-11627679
Node: faulthandler<3>1627744
Ref: whatsnew/3 6 faulthandler1627866
Ref: ea01627866
Ref: faulthandler<3>-Footnote-11628129
Node: fileinput<2>1628194
Ref: whatsnew/3 6 fileinput1628319
Ref: ea11628319
Ref: fileinput<2>-Footnote-11628507
Node: hashlib<5>1628572
Ref: whatsnew/3 6 hashlib1628696
Ref: ea31628696
Ref: hashlib<5>-Footnote-11629745
Ref: hashlib<5>-Footnote-21629810
Ref: hashlib<5>-Footnote-31629875
Ref: hashlib<5>-Footnote-41629940
Node: http client<2>1630005
Ref: whatsnew/3 6 http-client1630136
Ref: eaa1630136
Ref: http client<2>-Footnote-11630396
Node: idlelib と IDLE<2>1630461
Ref: whatsnew/3 6 idlelib-and-idle1630594
Ref: ead1630594
Ref: idlelib と IDLE<2>-Footnote-11634076
Ref: idlelib と IDLE<2>-Footnote-21634141
Ref: idlelib と IDLE<2>-Footnote-31634206
Ref: idlelib と IDLE<2>-Footnote-41634273
Ref: idlelib と IDLE<2>-Footnote-51634338
Ref: idlelib と IDLE<2>-Footnote-61634403
Ref: idlelib と IDLE<2>-Footnote-71634468
Ref: idlelib と IDLE<2>-Footnote-81634533
Ref: idlelib と IDLE<2>-Footnote-91634598
Ref: idlelib と IDLE<2>-Footnote-101634663
Ref: idlelib と IDLE<2>-Footnote-111634729
Node: importlib<6>1634797
Ref: whatsnew/3 6 importlib1634926
Ref: eae1634926
Ref: importlib<6>-Footnote-11635746
Node: inspect<7>1635811
Ref: whatsnew/3 6 inspect1635928
Ref: eb41635928
Ref: inspect<7>-Footnote-11636703
Ref: inspect<7>-Footnote-21636768
Node: json<2>1636833
Ref: whatsnew/3 6 json1636948
Ref: eb51636948
Ref: json<2>-Footnote-11637271
Node: logging<4>1637336
Ref: whatsnew/3 6 logging1637448
Ref: eb71637448
Ref: logging<4>-Footnote-11637778
Node: math<8>1637843
Ref: whatsnew/3 6 math1637966
Ref: eb91637966
Ref: math<8>-Footnote-11638198
Ref: math<8>-Footnote-21638263
Node: multiprocessing<6>1638305
Ref: whatsnew/3 6 multiprocessing1638423
Ref: eba1638423
Ref: multiprocessing<6>-Footnote-11638652
Node: os<9>1638716
Ref: whatsnew/3 6 os1638838
Ref: ebb1638838
Ref: os<9>-Footnote-11639832
Ref: os<9>-Footnote-21639897
Ref: os<9>-Footnote-31639939
Node: pathlib<12>1639981
Ref: whatsnew/3 6 pathlib1640091
Ref: ebe1640091
Ref: pathlib<12>-Footnote-11640368
Node: pdb<7>1640433
Ref: whatsnew/3 6 pdb1640547
Ref: ebf1640547
Node: pickle<3>1640785
Ref: whatsnew/3 6 pickle1640899
Ref: ec01640899
Ref: pickle<3>-Footnote-11641216
Node: pickletools1641281
Ref: whatsnew/3 6 pickletools1641397
Ref: ec11641397
Ref: pickletools-Footnote-11641625
Node: pydoc<4>1641690
Ref: whatsnew/3 6 pydoc1641806
Ref: ec31641806
Ref: pydoc<4>-Footnote-11642200
Ref: pydoc<4>-Footnote-21642264
Node: random<4>1642329
Ref: whatsnew/3 6 random1642439
Ref: ec41642439
Ref: random<4>-Footnote-11642694
Node: re<6>1642759
Ref: whatsnew/3 6 re1642869
Ref: ec61642869
Ref: re<6>-Footnote-11643580
Ref: re<6>-Footnote-21643646
Ref: re<6>-Footnote-31643711
Node: readline1643776
Ref: whatsnew/3 6 readline1643888
Ref: ec81643888
Ref: readline-Footnote-11644119
Node: rlcompleter1644184
Ref: whatsnew/3 6 rlcompleter1644299
Ref: eca1644299
Ref: rlcompleter-Footnote-11644603
Ref: rlcompleter-Footnote-21644668
Node: shlex<2>1644733
Ref: whatsnew/3 6 shlex1644847
Ref: ecb1644847
Ref: shlex<2>-Footnote-11645137
Node: site<3>1645204
Ref: whatsnew/3 6 site1645317
Ref: ece1645317
Ref: site<3>-Footnote-11645581
Node: sqlite3<8>1645646
Ref: whatsnew/3 6 sqlite31645760
Ref: ecf1645760
Ref: sqlite3<8>-Footnote-11645976
Node: socket<8>1646041
Ref: whatsnew/3 6 socket1646163
Ref: ed11646163
Ref: socket<8>-Footnote-11647120
Ref: socket<8>-Footnote-21647185
Ref: socket<8>-Footnote-31647250
Ref: socket<8>-Footnote-41647315
Ref: socket<8>-Footnote-51647380
Node: socketserver<2>1647445
Ref: whatsnew/3 6 socketserver1647563
Ref: ed81647563
Ref: socketserver<2>-Footnote-11648198
Ref: socketserver<2>-Footnote-21648263
Node: ssl<8>1648328
Ref: whatsnew/3 6 ssl1648450
Ref: edc1648450
Ref: ssl<8>-Footnote-11649877
Ref: ssl<8>-Footnote-21649942
Ref: ssl<8>-Footnote-31650007
Ref: ssl<8>-Footnote-41650072
Ref: ssl<8>-Footnote-51650137
Ref: ssl<8>-Footnote-61650202
Ref: ssl<8>-Footnote-71650267
Ref: ssl<8>-Footnote-81650332
Node: statistics<5>1650387
Ref: whatsnew/3 6 statistics1650503
Ref: ee01650503
Ref: statistics<5>-Footnote-11650691
Node: struct<2>1650756
Ref: whatsnew/3 6 struct1650879
Ref: ee21650879
Ref: struct<2>-Footnote-11651110
Node: subprocess<3>1651175
Ref: whatsnew/3 6 subprocess1651292
Ref: ee31651292
Ref: subprocess<3>-Footnote-11651985
Ref: subprocess<3>-Footnote-21652050
Node: sys<10>1652114
Ref: whatsnew/3 6 sys1652231
Ref: ee51652231
Ref: sys<10>-Footnote-11652832
Ref: sys<10>-Footnote-21652897
Node: telnetlib1652962
Ref: whatsnew/3 6 telnetlib1653073
Ref: ee81653073
Ref: telnetlib-Footnote-11653248
Node: time<6>1653313
Ref: whatsnew/3 6 time1653423
Ref: ee91653423
Node: timeit1653562
Ref: whatsnew/3 6 timeit1653673
Ref: eeb1653673
Ref: timeit-Footnote-11654130
Ref: timeit-Footnote-21654194
Node: tkinter<7>1654259
Ref: whatsnew/3 6 tkinter1654375
Ref: eee1654375
Ref: tkinter<7>-Footnote-11654819
Node: traceback<4>1654884
Ref: whatsnew/3 6 traceback1655008
Ref: eef1655008
Ref: whatsnew/3 6 whatsnew36-traceback1655008
Ref: e6e1655008
Ref: traceback<4>-Footnote-11655641
Node: tracemalloc<3>1655706
Ref: whatsnew/3 6 tracemalloc1655830
Ref: ef01655830
Ref: tracemalloc<3>-Footnote-11656191
Node: typing<10>1656256
Ref: whatsnew/3 6 typing1656382
Ref: ef21656382
Ref: whatsnew/3 6 whatsnew36-typing1656382
Ref: e3b1656382
Ref: typing<10>-Footnote-11658034
Ref: typing<10>-Footnote-21658084
Ref: typing<10>-Footnote-31658149
Ref: typing<10>-Footnote-41658214
Ref: typing<10>-Footnote-51658256
Ref: typing<10>-Footnote-61658306
Ref: typing<10>-Footnote-71658358
Node: unicodedata<8>1658410
Ref: whatsnew/3 6 unicodedata1658538
Ref: ef61658538
Ref: unicodedata<8>-Footnote-11658726
Node: unittest mock<2>1658777
Ref: whatsnew/3 6 unittest-mock1658909
Ref: ef71658909
Ref: unittest mock<2>-Footnote-11659456
Ref: unittest mock<2>-Footnote-21659521
Node: urllib request1659586
Ref: whatsnew/3 6 urllib-request1659722
Ref: efb1659722
Ref: urllib request-Footnote-11660094
Node: urllib robotparser1660159
Ref: whatsnew/3 6 urllib-robotparser1660286
Ref: efd1660286
Ref: urllib robotparser-Footnote-11660531
Node: venv<5>1660596
Ref: whatsnew/3 6 venv1660720
Ref: eff1660720
Ref: venv<5>-Footnote-11661046
Node: warnings<4>1661111
Ref: whatsnew/3 6 warnings1661223
Ref: f001661223
Ref: warnings<4>-Footnote-11662496
Ref: warnings<4>-Footnote-21662561
Node: winreg1662626
Ref: whatsnew/3 6 winreg1662739
Ref: f021662739
Ref: winreg-Footnote-11662912
Node: winsound1662977
Ref: whatsnew/3 6 winsound1663092
Ref: f041663092
Ref: winsound-Footnote-11663291
Node: xmlrpc client1663356
Ref: whatsnew/3 6 xmlrpc-client1663475
Ref: f081663475
Ref: xmlrpc client-Footnote-11663768
Node: zipfile<4>1663833
Ref: whatsnew/3 6 zipfile1663951
Ref: f091663951
Ref: zipfile<4>-Footnote-11664479
Ref: zipfile<4>-Footnote-21664544
Node: zlib<2>1664609
Ref: whatsnew/3 6 zlib1664705
Ref: f0c1664705
Ref: zlib<2>-Footnote-11664961
Ref: zlib<2>-Footnote-21665026
Node: 最適化<9>1665091
Ref: whatsnew/3 6 optimizations1665255
Ref: f0e1665255
Ref: 最適化<9>-Footnote-11669109
Ref: 最適化<9>-Footnote-21669174
Ref: 最適化<9>-Footnote-31669239
Ref: 最適化<9>-Footnote-41669304
Ref: 最適化<9>-Footnote-51669369
Ref: 最適化<9>-Footnote-61669434
Ref: 最適化<9>-Footnote-71669499
Ref: 最適化<9>-Footnote-81669564
Ref: 最適化<9>-Footnote-91669629
Ref: 最適化<9>-Footnote-101669694
Ref: 最適化<9>-Footnote-111669760
Ref: 最適化<9>-Footnote-121669826
Ref: 最適化<9>-Footnote-131669892
Ref: 最適化<9>-Footnote-141669958
Ref: 最適化<9>-Footnote-151670024
Ref: 最適化<9>-Footnote-161670090
Ref: 最適化<9>-Footnote-171670156
Ref: 最適化<9>-Footnote-181670222
Ref: 最適化<9>-Footnote-191670288
Ref: 最適化<9>-Footnote-201670354
Ref: 最適化<9>-Footnote-211670420
Node: ビルドならびに C API の変更<2>1670486
Ref: whatsnew/3 6 build-and-c-api-changes1670635
Ref: f141670635
Ref: ビルドならびに C API の変更<2>-Footnote-11673106
Ref: ビルドならびに C API の変更<2>-Footnote-21673148
Ref: ビルドならびに C API の変更<2>-Footnote-31673213
Ref: ビルドならびに C API の変更<2>-Footnote-41673278
Ref: ビルドならびに C API の変更<2>-Footnote-51673343
Ref: ビルドならびに C API の変更<2>-Footnote-61673407
Ref: ビルドならびに C API の変更<2>-Footnote-71673472
Ref: ビルドならびに C API の変更<2>-Footnote-81673537
Ref: ビルドならびに C API の変更<2>-Footnote-91673602
Ref: ビルドならびに C API の変更<2>-Footnote-101673667
Node: その他の改善1673733
Ref: whatsnew/3 6 other-improvements1673883
Ref: f1a1673883
Node: 非推奨<10>1674259
Ref: whatsnew/3 6 deprecated1674379
Ref: f1c1674379
Node: 新たなキーワード1674755
Ref: whatsnew/3 6 new-keywords1674864
Ref: f1d1674864
Ref: 新たなキーワード-Footnote-11675364
Node: 非推奨の Python 挙動1675406
Ref: whatsnew/3 6 deprecated-python-behavior1675586
Ref: f1e1675586
Ref: 非推奨の Python 挙動-Footnote-11676797
Ref: 非推奨の Python 挙動-Footnote-21676862
Ref: 非推奨の Python 挙動-Footnote-31676927
Node: 非推奨の Python モジュール、関数、メソッド<2>1676992
Ref: whatsnew/3 6 deprecated-python-modules-functions-and-methods1677154
Ref: f201677154
Node: asynchat1677469
Ref: whatsnew/3 6 asynchat1677593
Ref: f211677593
Ref: asynchat-Footnote-11677777
Node: asyncore1677842
Ref: whatsnew/3 6 asyncore1677981
Ref: f221677981
Ref: asyncore-Footnote-11678165
Node: dbm<4>1678230
Ref: whatsnew/3 6 dbm1678373
Ref: f231678373
Ref: dbm<4>-Footnote-11678733
Node: distutils<6>1678798
Ref: whatsnew/3 6 id21678936
Ref: f241678936
Ref: distutils<6>-Footnote-11679266
Node: grp1679331
Ref: whatsnew/3 6 grp1679475
Ref: f251679475
Ref: grp-Footnote-11679681
Node: importlib<7>1679746
Ref: whatsnew/3 6 id31679884
Ref: f271679884
Node: os<10>1680538
Ref: whatsnew/3 6 id41680678
Ref: f2c1680678
Ref: os<10>-Footnote-11680972
Ref: os<10>-Footnote-21681037
Node: re<7>1681102
Ref: whatsnew/3 6 id51681236
Ref: f2d1681236
Ref: re<7>-Footnote-11681562
Node: ssl<9>1681627
Ref: whatsnew/3 6 id61681765
Ref: f2e1681765
Ref: ssl<9>-Footnote-11682623
Ref: ssl<9>-Footnote-21682688
Ref: ssl<9>-Footnote-31682753
Node: tkinter<8>1682818
Ref: whatsnew/3 6 id71682958
Ref: f2f1682958
Node: venv<6>1683112
Ref: whatsnew/3 6 id81683237
Ref: f301683237
Ref: whatsnew/3 6 whatsnew36-venv1683237
Ref: f311683237
Ref: venv<6>-Footnote-11683588
Node: xml<6>1683653
Ref: whatsnew/3 6 xml1683834
Ref: f321683834
Ref: xml<6>-Footnote-11684138
Node: C API の非推奨の関数ならびに型<2>1684193
Ref: whatsnew/3 6 deprecated-functions-and-types-of-the-c-api1684348
Ref: f331684348
Node: 非推奨のビルドオプション1684683
Ref: whatsnew/3 6 deprecated-build-options1684823
Ref: f351684823
Node: 削除<10>1685276
Ref: whatsnew/3 6 removed1685401
Ref: f361685401
Node: API と機能の削除<3>1685491
Ref: whatsnew/3 6 api-and-feature-removals1685563
Ref: f371685563
Ref: API と機能の削除<3>-Footnote-11687655
Ref: API と機能の削除<3>-Footnote-21687720
Node: Python 3 6 への移植1687798
Ref: whatsnew/3 6 porting-to-python-3-61687941
Ref: f3a1687941
Node: 'python' コマンドの挙動の変更1688370
Ref: whatsnew/3 6 changes-in-python-command-behavior1688501
Ref: f3b1688501
Ref: 'python' コマンドの挙動の変更-Footnote-11688973
Node: Python API の変更<9>1689038
Ref: whatsnew/3 6 changes-in-the-python-api1689197
Ref: f3c1689197
Ref: Python API の変更<9>-Footnote-11699341
Ref: Python API の変更<9>-Footnote-21699405
Ref: Python API の変更<9>-Footnote-31699447
Ref: Python API の変更<9>-Footnote-41699512
Ref: Python API の変更<9>-Footnote-51699577
Ref: Python API の変更<9>-Footnote-61699642
Ref: Python API の変更<9>-Footnote-71699707
Ref: Python API の変更<9>-Footnote-81699772
Ref: Python API の変更<9>-Footnote-91699837
Ref: Python API の変更<9>-Footnote-101699902
Ref: Python API の変更<9>-Footnote-111699968
Ref: Python API の変更<9>-Footnote-121700011
Ref: Python API の変更<9>-Footnote-131700077
Ref: Python API の変更<9>-Footnote-141700143
Ref: Python API の変更<9>-Footnote-151700209
Ref: Python API の変更<9>-Footnote-161700275
Ref: Python API の変更<9>-Footnote-171700340
Ref: Python API の変更<9>-Footnote-181700406
Ref: Python API の変更<9>-Footnote-191700472
Ref: Python API の変更<9>-Footnote-201700538
Node: C API の変更<13>1700604
Ref: whatsnew/3 6 changes-in-the-c-api1700762
Ref: f4e1700762
Ref: C API の変更<13>-Footnote-11701397
Ref: C API の変更<13>-Footnote-21701462
Node: CPython バイトコードの変更<8>1701526
Ref: whatsnew/3 6 cpython-bytecode-changes1701652
Ref: f501701652
Ref: CPython バイトコードの変更<8>-Footnote-11703285
Ref: CPython バイトコードの変更<8>-Footnote-21703350
Ref: CPython バイトコードの変更<8>-Footnote-31703415
Ref: CPython バイトコードの変更<8>-Footnote-41703480
Ref: CPython バイトコードの変更<8>-Footnote-51703545
Ref: CPython バイトコードの変更<8>-Footnote-61703610
Ref: CPython バイトコードの変更<8>-Footnote-71703675
Ref: CPython バイトコードの変更<8>-Footnote-81703740
Ref: CPython バイトコードの変更<8>-Footnote-91703805
Node: Notable changes in Python 3 6 21703870
Ref: whatsnew/3 6 notable-changes-in-python-3-6-21704034
Ref: f561704034
Node: New make regen-all build target1704198
Ref: whatsnew/3 6 new-make-regen-all-build-target1704340
Ref: f571704340
Ref: New make regen-all build target-Footnote-11705129
Ref: New make regen-all build target-Footnote-21705197
Node: Removal of make touch build target1705262
Ref: whatsnew/3 6 removal-of-make-touch-build-target1705404
Ref: f581705404
Ref: Removal of make touch build target-Footnote-11705841
Node: Notable changes in Python 3 6 41705906
Ref: whatsnew/3 6 notable-changes-in-python-3-6-41706078
Ref: f591706078
Ref: Notable changes in Python 3 6 4-Footnote-11706451
Ref: Notable changes in Python 3 6 4-Footnote-21706516
Node: Notable changes in Python 3 6 51706581
Ref: whatsnew/3 6 notable-changes-in-python-3-6-51706753
Ref: f5a1706753
Ref: Notable changes in Python 3 6 5-Footnote-11707056
Node: Notable changes in Python 3 6 71707121
Ref: whatsnew/3 6 notable-changes-in-python-3-6-71707294
Ref: f5b1707294
Ref: Notable changes in Python 3 6 7-Footnote-11707803
Ref: Notable changes in Python 3 6 7-Footnote-21707858
Node: Notable changes in Python 3 6 101707923
Ref: whatsnew/3 6 notable-changes-in-python-3-6-101708097
Ref: f5c1708097
Ref: Notable changes in Python 3 6 10-Footnote-11708660
Node: Notable changes in Python 3 6 131708725
Ref: whatsnew/3 6 notable-changes-in-python-3-6-131708900
Ref: f5d1708900
Ref: Notable changes in Python 3 6 13-Footnote-11709620
Node: Notable changes in Python 3 6 141709685
Ref: whatsnew/3 6 notable-changes-in-python-3-6-141709819
Ref: f5e1709819
Ref: Notable changes in Python 3 6 14-Footnote-11710736
Ref: Notable changes in Python 3 6 14-Footnote-21710791
Node: What's New In Python 3 51710846
Ref: whatsnew/3 5 doc1710993
Ref: f5f1710993
Ref: whatsnew/3 5 translation-repo1710993
Ref: f601710993
Ref: whatsnew/3 5 what-s-new-in-python-3-51710993
Ref: f611710993
Ref: What's New In Python 3 5-Footnote-11712062
Ref: What's New In Python 3 5-Footnote-21712122
Node: 概要 -- リリースハイライト<10>1712164
Ref: whatsnew/3 5 summary-release-highlights1712294
Ref: f621712294
Ref: 概要 -- リリースハイライト<10>-Footnote-11716948
Ref: 概要 -- リリースハイライト<10>-Footnote-21717012
Ref: 概要 -- リリースハイライト<10>-Footnote-31717077
Ref: 概要 -- リリースハイライト<10>-Footnote-41717142
Ref: 概要 -- リリースハイライト<10>-Footnote-51717207
Ref: 概要 -- リリースハイライト<10>-Footnote-61717272
Ref: 概要 -- リリースハイライト<10>-Footnote-71717337
Node: 新しい機能<15>1717402
Ref: whatsnew/3 5 new-features1717568
Ref: f751717568
Node: PEP 492 - コルーチン、 async と await 構文1718760
Ref: whatsnew/3 5 pep-492-coroutines-with-async-and-await-syntax1718925
Ref: f761718925
Ref: whatsnew/3 5 whatsnew-pep-4921718925
Ref: f631718925
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-11722332
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-21722374
Node: PEP 465 - 行列の乗算専用の中置演算子1722416
Ref: whatsnew/3 5 pep-465-a-dedicated-infix-operator-for-matrix-multiplication1722645
Ref: f7c1722645
Ref: whatsnew/3 5 whatsnew-pep-4651722645
Ref: f641722645
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-11724111
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-21724153
Node: PEP 448 - 追加可能なアンパックへの一般化1724195
Ref: whatsnew/3 5 pep-448-additional-unpacking-generalizations1724448
Ref: f801724448
Ref: whatsnew/3 5 whatsnew-pep-4481724448
Ref: f651724448
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-11725642
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-21725684
Node: PEP 461 - bytes および bytearray のパーセント書式化サポート1725726
Ref: whatsnew/3 5 pep-461-percent-formatting-support-for-bytes-and-bytearray1725952
Ref: f841725952
Ref: whatsnew/3 5 whatsnew-pep-4611725952
Ref: f681725952
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-11727688
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-21727730
Node: PEP 484 - 型ヒント1727772
Ref: whatsnew/3 5 pep-484-type-hints1728028
Ref: f861728028
Ref: whatsnew/3 5 whatsnew-pep-4841728028
Ref: f661728028
Ref: PEP 484 - 型ヒント-Footnote-11729787
Ref: PEP 484 - 型ヒント-Footnote-21729829
Ref: PEP 484 - 型ヒント-Footnote-31729871
Ref: PEP 484 - 型ヒント-Footnote-41729901
Ref: PEP 484 - 型ヒント-Footnote-51729943
Node: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ1729985
Ref: whatsnew/3 5 pep-471-os-scandir-function-a-better-and-faster-directory-iterator1730228
Ref: f871730228
Ref: whatsnew/3 5 whatsnew-pep-4711730228
Ref: f711730228
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-11731772
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-21731814
Node: PEP 475 EINTR で失敗したシステムコールの再試行1731856
Ref: whatsnew/3 5 pep-475-retry-system-calls-failing-with-eintr1732142
Ref: f891732142
Ref: whatsnew/3 5 whatsnew-pep-4751732142
Ref: f8a1732142
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-11735625
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-21735667
Node: PEP 479 ジェネレータ内の StopIteration の処理の変更1735709
Ref: whatsnew/3 5 pep-479-change-stopiteration-handling-inside-generators1735963
Ref: fb01735963
Ref: whatsnew/3 5 whatsnew-pep-4791735963
Ref: f1f1735963
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-11738257
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-21738299
Node: PEP 485 近似的に等しいことを調べる関数1738341
Ref: whatsnew/3 5 pep-485-a-function-for-testing-approximate-equality1738593
Ref: fb21738593
Ref: whatsnew/3 5 whatsnew-pep-4851738593
Ref: fb31738593
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-11739779
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-21739821
Node: PEP 486 Python ランチャーが仮想環境を認識する1739863
Ref: whatsnew/3 5 pep-486-make-the-python-launcher-aware-of-virtual-environments1740083
Ref: fb61740083
Ref: whatsnew/3 5 whatsnew-pep-4861740083
Ref: fb71740083
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-11740732
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-21740774
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-31740816
Node: PEP 488 PYO ファイルの廃止1740858
Ref: whatsnew/3 5 pep-488-elimination-of-pyo-files1741075
Ref: fb81741075
Ref: whatsnew/3 5 whatsnew-pep-4881741075
Ref: f6d1741075
Ref: PEP 488 PYO ファイルの廃止-Footnote-11742207
Ref: PEP 488 PYO ファイルの廃止-Footnote-21742249
Node: PEP 489 拡張モジュールの多段階初期化1742291
Ref: whatsnew/3 5 pep-489-multi-phase-extension-module-initialization1742439
Ref: fba1742439
Ref: whatsnew/3 5 whatsnew-pep-4891742439
Ref: f6e1742439
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-11743328
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-21743370
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-31743412
Node: その他の言語変更<9>1743454
Ref: whatsnew/3 5 other-language-changes1743606
Ref: fbb1743606
Ref: その他の言語変更<9>-Footnote-11744864
Ref: その他の言語変更<9>-Footnote-21744929
Ref: その他の言語変更<9>-Footnote-31744994
Ref: その他の言語変更<9>-Footnote-41745059
Ref: その他の言語変更<9>-Footnote-51745124
Ref: その他の言語変更<9>-Footnote-61745189
Ref: その他の言語変更<9>-Footnote-71745254
Node: 新たなモジュール<9>1745319
Ref: whatsnew/3 5 new-modules1745485
Ref: fbd1745485
Node: typing<11>1745595
Ref: whatsnew/3 5 typing1745687
Ref: fbe1745687
Node: zipapp<2>1745900
Ref: whatsnew/3 5 whatsnew-zipapp1745992
Ref: f671745992
Ref: whatsnew/3 5 zipapp1745992
Ref: fbf1745992
Ref: zipapp<2>-Footnote-11746924
Ref: zipapp<2>-Footnote-21746966
Ref: zipapp<2>-Footnote-31747033
Ref: zipapp<2>-Footnote-41747098
Node: 改良されたモジュール<9>1747140
Ref: whatsnew/3 5 improved-modules1747324
Ref: fc01747324
Node: argparse<6>1749073
Ref: whatsnew/3 5 argparse1749174
Ref: fc11749174
Ref: argparse<6>-Footnote-11749552
Node: asyncio<13>1749617
Ref: whatsnew/3 5 asyncio1749730
Ref: fc41749730
Ref: asyncio<13>-Footnote-11753580
Ref: asyncio<13>-Footnote-21753645
Ref: asyncio<13>-Footnote-31753710
Node: bz21753755
Ref: whatsnew/3 5 bz21753860
Ref: fcd1753860
Ref: bz2-Footnote-11754180
Node: cgi1754245
Ref: whatsnew/3 5 cgi1754347
Ref: fcf1754347
Ref: cgi-Footnote-11754544
Node: cmath<2>1754609
Ref: whatsnew/3 5 cmath1754717
Ref: fd01754717
Ref: cmath<2>-Footnote-11754964
Node: コード1755029
Ref: whatsnew/3 5 code1755148
Ref: fd11755148
Ref: コード-Footnote-11755466
Node: collections<5>1755531
Ref: whatsnew/3 5 collections1755660
Ref: fd31755660
Ref: whatsnew/3 5 whatsnew-ordereddict1755703
Ref: f6f1755703
Ref: collections<5>-Footnote-11757109
Ref: collections<5>-Footnote-21757174
Ref: collections<5>-Footnote-31757239
Ref: collections<5>-Footnote-41757304
Ref: collections<5>-Footnote-51757369
Node: collections abc<3>1757434
Ref: whatsnew/3 5 collections-abc1757567
Ref: fde1757567
Ref: collections abc<3>-Footnote-11758297
Ref: collections abc<3>-Footnote-21758362
Ref: collections abc<3>-Footnote-31758427
Ref: collections abc<3>-Footnote-41758492
Node: compileall<4>1758540
Ref: whatsnew/3 5 compileall1758680
Ref: fe41758680
Ref: compileall<4>-Footnote-11759557
Ref: compileall<4>-Footnote-21759622
Ref: compileall<4>-Footnote-31759687
Node: concurrent futures<6>1759752
Ref: whatsnew/3 5 concurrent-futures1759889
Ref: fe71759889
Ref: concurrent futures<6>-Footnote-11760391
Ref: concurrent futures<6>-Footnote-21760456
Node: configparser<5>1760521
Ref: whatsnew/3 5 configparser1760658
Ref: fe81760658
Ref: configparser<5>-Footnote-11761637
Node: contextlib<5>1761702
Ref: whatsnew/3 5 contextlib1761824
Ref: fe91761824
Ref: contextlib<5>-Footnote-11762513
Node: csv<3>1762578
Ref: whatsnew/3 5 csv1762694
Ref: fec1762694
Ref: csv<3>-Footnote-11762941
Node: curses<5>1763006
Ref: whatsnew/3 5 curses1763115
Ref: fee1763115
Ref: curses<5>-Footnote-11763405
Node: dbm<5>1763469
Ref: whatsnew/3 5 dbm1763582
Ref: ff21763582
Ref: dbm<5>-Footnote-11763787
Node: difflib<3>1763852
Ref: whatsnew/3 5 difflib1763968
Ref: ff31763968
Ref: difflib<3>-Footnote-11764506
Ref: difflib<3>-Footnote-21764570
Node: distutils<7>1764635
Ref: whatsnew/3 5 distutils1764755
Ref: ff61764755
Ref: distutils<7>-Footnote-11765208
Ref: distutils<7>-Footnote-21765272
Node: doctest<3>1765337
Ref: whatsnew/3 5 doctest1765455
Ref: ff71765455
Ref: doctest<3>-Footnote-11765833
Node: email<4>1765898
Ref: whatsnew/3 5 email1766011
Ref: ffa1766011
Ref: email<4>-Footnote-11767124
Ref: email<4>-Footnote-21767189
Ref: email<4>-Footnote-31767254
Ref: email<4>-Footnote-41767313
Ref: email<4>-Footnote-51767372
Ref: email<4>-Footnote-61767437
Node: enum<8>1767502
Ref: whatsnew/3 5 enum1767620
Ref: 10001767620
Ref: enum<8>-Footnote-11768058
Node: faulthandler<4>1768123
Ref: whatsnew/3 5 faulthandler1768245
Ref: 10011768245
Ref: faulthandler<4>-Footnote-11768607
Node: functools<5>1768672
Ref: whatsnew/3 5 functools1768794
Ref: 10051768794
Ref: whatsnew/3 5 whatsnew-lrucache1768835
Ref: f721768835
Ref: functools<5>-Footnote-11769085
Node: glob<3>1769150
Ref: whatsnew/3 5 glob1769264
Ref: 10061769264
Ref: glob<3>-Footnote-11769556
Node: gzip<4>1769621
Ref: whatsnew/3 5 gzip1769731
Ref: 10071769731
Ref: gzip<4>-Footnote-11769990
Node: heapq<2>1770055
Ref: whatsnew/3 5 heapq1770165
Ref: 10081770165
Ref: heapq<2>-Footnote-11770809
Node: http<3>1770874
Ref: whatsnew/3 5 http1770991
Ref: 100b1770991
Ref: http<3>-Footnote-11771276
Node: http client<3>1771341
Ref: whatsnew/3 5 http-client1771469
Ref: 100c1771469
Ref: http client<3>-Footnote-11772218
Node: idlelib と IDLE<3>1772282
Ref: whatsnew/3 5 idlelib-and-idle1772413
Ref: 10101772413
Node: imaplib<3>1772945
Ref: whatsnew/3 5 imaplib1773068
Ref: 10111773068
Ref: imaplib<3>-Footnote-11774006
Ref: imaplib<3>-Footnote-21774070
Ref: imaplib<3>-Footnote-31774129
Ref: imaplib<3>-Footnote-41774188
Ref: imaplib<3>-Footnote-51774247
Ref: imaplib<3>-Footnote-61774312
Node: imghdr1774377
Ref: whatsnew/3 5 imghdr1774493
Ref: 10141774493
Ref: imghdr-Footnote-11774783
Ref: imghdr-Footnote-21774815
Ref: imghdr-Footnote-31774880
Ref: imghdr-Footnote-41774923
Node: importlib<8>1774988
Ref: whatsnew/3 5 importlib1775104
Ref: 10151775104
Ref: importlib<8>-Footnote-11775945
Ref: importlib<8>-Footnote-21776010
Ref: importlib<8>-Footnote-31776075
Node: inspect<8>1776140
Ref: whatsnew/3 5 inspect1776255
Ref: 10191776255
Ref: inspect<8>-Footnote-11777819
Ref: inspect<8>-Footnote-21777884
Ref: inspect<8>-Footnote-31777949
Ref: inspect<8>-Footnote-41778014
Ref: inspect<8>-Footnote-51778079
Ref: inspect<8>-Footnote-61778144
Ref: inspect<8>-Footnote-71778209
Ref: inspect<8>-Footnote-81778274
Node: io<7>1778339
Ref: whatsnew/3 5 io1778454
Ref: 101f1778454
Ref: io<7>-Footnote-11778755
Node: ipaddress<4>1778820
Ref: whatsnew/3 5 ipaddress1778932
Ref: 10231778932
Ref: ipaddress<4>-Footnote-11779969
Ref: ipaddress<4>-Footnote-21780034
Node: json<3>1780099
Ref: whatsnew/3 5 json1780218
Ref: 10251780218
Ref: json<3>-Footnote-11780721
Ref: json<3>-Footnote-21780786
Node: linecache<3>1780851
Ref: whatsnew/3 5 linecache1780967
Ref: 10271780967
Ref: linecache<3>-Footnote-11781380
Node: locale<6>1781445
Ref: whatsnew/3 5 locale1781564
Ref: 10291781564
Ref: locale<6>-Footnote-11782132
Node: logging<5>1782197
Ref: whatsnew/3 5 logging1782308
Ref: 102b1782308
Ref: logging<5>-Footnote-11783285
Ref: logging<5>-Footnote-21783350
Node: lzma1783415
Ref: whatsnew/3 5 lzma1783524
Ref: 10311783524
Ref: lzma-Footnote-11783789
Node: math<9>1783854
Ref: whatsnew/3 5 math1783971
Ref: 10331783971
Ref: math<9>-Footnote-11784546
Ref: math<9>-Footnote-21784611
Ref: math<9>-Footnote-31784676
Node: multiprocessing<7>1784741
Ref: whatsnew/3 5 multiprocessing1784865
Ref: 10341784865
Ref: multiprocessing<7>-Footnote-11785187
Node: operator<3>1785252
Ref: whatsnew/3 5 operator1785375
Ref: 10361785375
Ref: operator<3>-Footnote-11785809
Ref: operator<3>-Footnote-21785874
Node: os<11>1785939
Ref: whatsnew/3 5 os1786055
Ref: 103b1786055
Ref: os<11>-Footnote-11788106
Ref: os<11>-Footnote-21788171
Ref: os<11>-Footnote-31788236
Ref: os<11>-Footnote-41788301
Ref: os<11>-Footnote-51788366
Ref: os<11>-Footnote-61788431
Node: pathlib<13>1788496
Ref: whatsnew/3 5 pathlib1788610
Ref: 10431788610
Ref: pathlib<13>-Footnote-11790090
Ref: pathlib<13>-Footnote-21790155
Ref: pathlib<13>-Footnote-31790220
Ref: pathlib<13>-Footnote-41790285
Ref: pathlib<13>-Footnote-51790350
Node: pickle<4>1790415
Ref: whatsnew/3 5 pickle1790532
Ref: 104b1790532
Ref: pickle<4>-Footnote-11790850
Node: poplib<2>1790915
Ref: whatsnew/3 5 poplib1791026
Ref: 104c1791026
Ref: poplib<2>-Footnote-11791271
Ref: poplib<2>-Footnote-21791330
Node: re<8>1791395
Ref: whatsnew/3 5 re1791508
Ref: 104e1791508
Ref: re<8>-Footnote-11792751
Ref: re<8>-Footnote-21792815
Ref: re<8>-Footnote-31792880
Ref: re<8>-Footnote-41792947
Node: readline<2>1793012
Ref: whatsnew/3 5 readline1793125
Ref: 10541793125
Ref: readline<2>-Footnote-11793391
Node: selectors1793456
Ref: whatsnew/3 5 selectors1793573
Ref: 10561793573
Ref: selectors-Footnote-11793795
Node: shutil<5>1793860
Ref: whatsnew/3 5 shutil1793975
Ref: 10571793975
Ref: shutil<5>-Footnote-11794456
Ref: shutil<5>-Footnote-21794521
Node: signal<3>1794585
Ref: whatsnew/3 5 signal1794699
Ref: 10581794699
Ref: signal<3>-Footnote-11795209
Ref: signal<3>-Footnote-21795274
Node: smtpd<2>1795339
Ref: whatsnew/3 5 smtpd1795454
Ref: 10591795454
Ref: smtpd<2>-Footnote-11797092
Ref: smtpd<2>-Footnote-21797157
Ref: smtpd<2>-Footnote-31797216
Ref: smtpd<2>-Footnote-41797281
Ref: smtpd<2>-Footnote-51797340
Ref: smtpd<2>-Footnote-61797405
Node: smtplib<2>1797470
Ref: whatsnew/3 5 smtplib1797582
Ref: 105a1797582
Ref: smtplib<2>-Footnote-11798209
Ref: smtplib<2>-Footnote-21798274
Ref: smtplib<2>-Footnote-31798339
Ref: smtplib<2>-Footnote-41798398
Node: sndhdr1798463
Ref: whatsnew/3 5 sndhdr1798576
Ref: 105f1798576
Ref: sndhdr-Footnote-11798781
Node: socket<9>1798846
Ref: whatsnew/3 5 socket1798956
Ref: 10601798956
Ref: socket<9>-Footnote-11799930
Ref: socket<9>-Footnote-21799995
Ref: socket<9>-Footnote-31800060
Ref: socket<9>-Footnote-41800125
Node: ssl<10>1800190
Ref: whatsnew/3 5 ssl1800304
Ref: 10641800304
Node: メモリ BIO サポート1800448
Ref: whatsnew/3 5 memory-bio-support1800573
Ref: 10651800573
Ref: whatsnew/3 5 whatsnew-sslmemorybio1800573
Ref: f701800573
Ref: メモリ BIO サポート-Footnote-11801462
Node: Application-Layer Protocol Negotiation Support1801527
Ref: whatsnew/3 5 application-layer-protocol-negotiation-support1801679
Ref: 10671801679
Ref: Application-Layer Protocol Negotiation Support-Footnote-11802389
Ref: Application-Layer Protocol Negotiation Support-Footnote-21802454
Node: その他の変更1802513
Ref: whatsnew/3 5 other-changes1802630
Ref: 106b1802630
Ref: その他の変更-Footnote-11804228
Ref: その他の変更-Footnote-21804293
Ref: その他の変更-Footnote-31804358
Ref: その他の変更-Footnote-41804423
Ref: その他の変更-Footnote-51804482
Ref: その他の変更-Footnote-61804547
Ref: その他の変更-Footnote-71804612
Ref: その他の変更-Footnote-81804677
Node: sqlite3<9>1804742
Ref: whatsnew/3 5 sqlite31804860
Ref: 10741804860
Ref: sqlite3<9>-Footnote-11805192
Ref: sqlite3<9>-Footnote-21805257
Node: subprocess<4>1805322
Ref: whatsnew/3 5 subprocess1805440
Ref: 10761805440
Ref: whatsnew/3 5 whatsnew-subprocess1805440
Ref: f731805440
Ref: subprocess<4>-Footnote-11806537
Node: sys<11>1806602
Ref: whatsnew/3 5 sys1806722
Ref: 10781806722
Ref: sys<11>-Footnote-11807374
Ref: sys<11>-Footnote-21807439
Node: sysconfig<3>1807504
Ref: whatsnew/3 5 sysconfig1807621
Ref: 10791807621
Ref: sysconfig<3>-Footnote-11807856
Node: tarfile<7>1807921
Ref: whatsnew/3 5 tarfile1808043
Ref: 107a1808043
Ref: tarfile<7>-Footnote-11808980
Ref: tarfile<7>-Footnote-21809045
Ref: tarfile<7>-Footnote-31809110
Node: threading<7>1809175
Ref: whatsnew/3 5 threading1809292
Ref: 107e1809292
Ref: threading<7>-Footnote-11809586
Node: time<7>1809651
Ref: whatsnew/3 5 time1809767
Ref: 10801809767
Ref: time<7>-Footnote-11809966
Node: timeit<2>1810031
Ref: whatsnew/3 5 timeit1810145
Ref: 10811810145
Ref: timeit<2>-Footnote-11810695
Ref: timeit<2>-Footnote-21810760
Node: tkinter<9>1810824
Ref: whatsnew/3 5 tkinter1810943
Ref: 10831810943
Ref: tkinter<9>-Footnote-11811277
Node: traceback<5>1811342
Ref: whatsnew/3 5 traceback1811460
Ref: 10841811460
Ref: whatsnew/3 5 whatsnew-traceback1811460
Ref: f741811460
Ref: traceback<5>-Footnote-11812060
Ref: traceback<5>-Footnote-21812125
Ref: traceback<5>-Footnote-31812190
Node: types<6>1812255
Ref: whatsnew/3 5 types1812377
Ref: 108b1812377
Ref: types<6>-Footnote-11812924
Ref: types<6>-Footnote-21812989
Node: unicodedata<9>1813054
Ref: whatsnew/3 5 unicodedata1813175
Ref: 108e1813175
Ref: unicodedata<9>-Footnote-11813329
Node: unittest<9>1813380
Ref: whatsnew/3 5 unittest1813509
Ref: 108f1813509
Ref: unittest<9>-Footnote-11814306
Ref: unittest<9>-Footnote-21814371
Ref: unittest<9>-Footnote-31814436
Node: unittest mock<3>1814501
Ref: whatsnew/3 5 unittest-mock1814625
Ref: 10911814625
Ref: unittest mock<3>-Footnote-11815583
Ref: unittest mock<3>-Footnote-21815648
Ref: unittest mock<3>-Footnote-31815713
Ref: unittest mock<3>-Footnote-41815778
Ref: unittest mock<3>-Footnote-51815843
Ref: unittest mock<3>-Footnote-61815908
Node: urllib<4>1815973
Ref: whatsnew/3 5 urllib1816093
Ref: 10971816093
Ref: urllib<4>-Footnote-11817258
Ref: urllib<4>-Footnote-21817323
Ref: urllib<4>-Footnote-31817387
Ref: urllib<4>-Footnote-41817452
Ref: urllib<4>-Footnote-51817517
Ref: urllib<4>-Footnote-61817576
Ref: urllib<4>-Footnote-71817635
Ref: urllib<4>-Footnote-81817694
Node: wsgiref1817759
Ref: whatsnew/3 5 wsgiref1817872
Ref: 109b1817872
Ref: wsgiref-Footnote-11818113
Node: xmlrpc<2>1818177
Ref: whatsnew/3 5 xmlrpc1818288
Ref: 109d1818288
Ref: xmlrpc<2>-Footnote-11818761
Ref: xmlrpc<2>-Footnote-21818826
Node: xml sax1818891
Ref: whatsnew/3 5 xml-sax1819005
Ref: 109e1819005
Ref: xml sax-Footnote-11819416
Ref: xml sax-Footnote-21819480
Node: zipfile<5>1819545
Ref: whatsnew/3 5 zipfile1819641
Ref: 10a11819641
Ref: zipfile<5>-Footnote-11820015
Ref: zipfile<5>-Footnote-21820080
Node: その他のモジュールレベルの変更1820145
Ref: whatsnew/3 5 other-module-level-changes1820315
Ref: 10a21820315
Ref: その他のモジュールレベルの変更-Footnote-11820667
Node: 最適化<10>1820732
Ref: whatsnew/3 5 optimizations1820909
Ref: 10a31820909
Ref: 最適化<10>-Footnote-11824143
Ref: 最適化<10>-Footnote-21824208
Ref: 最適化<10>-Footnote-31824273
Ref: 最適化<10>-Footnote-41824338
Ref: 最適化<10>-Footnote-51824403
Ref: 最適化<10>-Footnote-61824468
Ref: 最適化<10>-Footnote-71824533
Ref: 最適化<10>-Footnote-81824598
Ref: 最適化<10>-Footnote-91824663
Ref: 最適化<10>-Footnote-101824728
Ref: 最適化<10>-Footnote-111824794
Ref: 最適化<10>-Footnote-121824860
Ref: 最適化<10>-Footnote-131824926
Ref: 最適化<10>-Footnote-141824992
Ref: 最適化<10>-Footnote-151825058
Ref: 最適化<10>-Footnote-161825124
Ref: 最適化<10>-Footnote-171825190
Ref: 最適化<10>-Footnote-181825256
Ref: 最適化<10>-Footnote-191825322
Ref: 最適化<10>-Footnote-201825388
Node: ビルドならびに C API の変更<3>1825454
Ref: whatsnew/3 5 build-and-c-api-changes1825599
Ref: 10b01825599
Ref: ビルドならびに C API の変更<3>-Footnote-11830068
Ref: ビルドならびに C API の変更<3>-Footnote-21830133
Ref: ビルドならびに C API の変更<3>-Footnote-31830198
Ref: ビルドならびに C API の変更<3>-Footnote-41830263
Ref: ビルドならびに C API の変更<3>-Footnote-51830328
Ref: ビルドならびに C API の変更<3>-Footnote-61830393
Ref: ビルドならびに C API の変更<3>-Footnote-71830435
Ref: ビルドならびに C API の変更<3>-Footnote-81830500
Ref: ビルドならびに C API の変更<3>-Footnote-91830565
Ref: ビルドならびに C API の変更<3>-Footnote-101830607
Node: 非推奨<11>1830713
Ref: whatsnew/3 5 deprecated1830855
Ref: 10bc1830855
Node: 新たなキーワード<2>1831213
Ref: whatsnew/3 5 new-keywords1831331
Ref: 10bd1831331
Ref: 新たなキーワード<2>-Footnote-11831703
Node: 非推奨の Python の挙動<2>1831745
Ref: whatsnew/3 5 deprecated-python-behavior1831932
Ref: 10be1831932
Node: サポートされないオペレーティングシステム1832408
Ref: whatsnew/3 5 unsupported-operating-systems1832630
Ref: 10bf1832630
Ref: サポートされないオペレーティングシステム-Footnote-11832982
Node: 非推奨の Python モジュール、関数、メソッド<3>1833024
Ref: whatsnew/3 5 deprecated-python-modules-functions-and-methods1833205
Ref: 10c01833205
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-11836458
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-21836523
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-31836587
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-41836652
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-51836717
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-61836782
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-71836847
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-81836912
Node: 削除<11>1836977
Ref: whatsnew/3 5 removed1837102
Ref: 10c51837102
Node: API と機能の削除<4>1837194
Ref: whatsnew/3 5 api-and-feature-removals1837266
Ref: 10c61837266
Ref: API と機能の削除<4>-Footnote-11838279
Ref: API と機能の削除<4>-Footnote-21838343
Node: Python 3 5 への移植1838408
Ref: whatsnew/3 5 porting-to-python-3-51838551
Ref: 10c71838551
Node: Python の挙動の変更<3>1838919
Ref: whatsnew/3 5 changes-in-python-behavior1839040
Ref: 10c81839040
Node: Python API の変更<10>1839816
Ref: whatsnew/3 5 changes-in-the-python-api1839965
Ref: 10c91839965
Ref: Python API の変更<10>-Footnote-11849116
Ref: Python API の変更<10>-Footnote-21849158
Ref: Python API の変更<10>-Footnote-31849223
Ref: Python API の変更<10>-Footnote-41849288
Ref: Python API の変更<10>-Footnote-51849353
Ref: Python API の変更<10>-Footnote-61849418
Ref: Python API の変更<10>-Footnote-71849483
Ref: Python API の変更<10>-Footnote-81849548
Ref: Python API の変更<10>-Footnote-91849601
Ref: Python API の変更<10>-Footnote-101849666
Ref: Python API の変更<10>-Footnote-111849732
Ref: Python API の変更<10>-Footnote-121849798
Ref: Python API の変更<10>-Footnote-131849864
Ref: Python API の変更<10>-Footnote-141849924
Ref: Python API の変更<10>-Footnote-151849989
Ref: Python API の変更<10>-Footnote-161850032
Ref: Python API の変更<10>-Footnote-171850092
Ref: Python API の変更<10>-Footnote-181850158
Ref: Python API の変更<10>-Footnote-191850224
Ref: Python API の変更<10>-Footnote-201850290
Node: C API の変更<14>1850355
Ref: whatsnew/3 5 changes-in-the-c-api1850467
Ref: 10d11850467
Ref: C API の変更<14>-Footnote-11851773
Ref: C API の変更<14>-Footnote-21851838
Ref: C API の変更<14>-Footnote-31851903
Node: Notable changes in Python 3 5 41851945
Ref: whatsnew/3 5 notable-changes-in-python-3-5-41852069
Ref: 10d51852069
Node: New make regen-all build target<2>1852308
Ref: whatsnew/3 5 new-make-regen-all-build-target1852456
Ref: 10d61852456
Ref: New make regen-all build target<2>-Footnote-11853247
Ref: New make regen-all build target<2>-Footnote-21853315
Node: Removal of make touch build target<2>1853380
Ref: whatsnew/3 5 removal-of-make-touch-build-target1853528
Ref: 10d71853528
Ref: Removal of make touch build target<2>-Footnote-11853967
Node: What's New In Python 3 41854032
Ref: whatsnew/3 4 doc1854179
Ref: 10d81854179
Ref: whatsnew/3 4 translation-repo1854179
Ref: 10d91854179
Ref: whatsnew/3 4 what-s-new-in-python-3-41854179
Ref: 10da1854179
Ref: What's New In Python 3 4-Footnote-11855049
Ref: What's New In Python 3 4-Footnote-21855108
Node: 概要 -- リリースハイライト<11>1855150
Ref: whatsnew/3 4 summary-release-highlights1855280
Ref: 10db1855280
Ref: 概要 -- リリースハイライト<11>-Footnote-11860734
Ref: 概要 -- リリースハイライト<11>-Footnote-21860776
Ref: 概要 -- リリースハイライト<11>-Footnote-31860818
Ref: 概要 -- リリースハイライト<11>-Footnote-41860883
Ref: 概要 -- リリースハイライト<11>-Footnote-51860925
Ref: 概要 -- リリースハイライト<11>-Footnote-61860990
Ref: 概要 -- リリースハイライト<11>-Footnote-71861032
Ref: 概要 -- リリースハイライト<11>-Footnote-81861074
Ref: 概要 -- リリースハイライト<11>-Footnote-91861116
Ref: 概要 -- リリースハイライト<11>-Footnote-101861158
Ref: 概要 -- リリースハイライト<11>-Footnote-111861201
Ref: 概要 -- リリースハイライト<11>-Footnote-121861244
Ref: 概要 -- リリースハイライト<11>-Footnote-131861287
Ref: 概要 -- リリースハイライト<11>-Footnote-141861330
Ref: 概要 -- リリースハイライト<11>-Footnote-151861373
Ref: 概要 -- リリースハイライト<11>-Footnote-161861438
Ref: 概要 -- リリースハイライト<11>-Footnote-171861504
Ref: 概要 -- リリースハイライト<11>-Footnote-181861547
Ref: 概要 -- リリースハイライト<11>-Footnote-191861590
Ref: 概要 -- リリースハイライト<11>-Footnote-201861656
Ref: 概要 -- リリースハイライト<11>-Footnote-211861702
Ref: 概要 -- リリースハイライト<11>-Footnote-221861745
Ref: 概要 -- リリースハイライト<11>-Footnote-231861788
Ref: 概要 -- リリースハイライト<11>-Footnote-241861854
Ref: 概要 -- リリースハイライト<11>-Footnote-251861897
Node: 新しい機能<16>1861940
Ref: whatsnew/3 4 new-features1862107
Ref: 10f61862107
Node: PEP 453 Python インストール時の PIP の明示的なブートストラッピング1862696
Ref: whatsnew/3 4 pep-453-explicit-bootstrapping-of-pip-in-python-installations1862915
Ref: 10f71862915
Ref: whatsnew/3 4 whatsnew-pep-4531862915
Ref: 10dc1862915
Node: デフォルトでの pip のブートストラッピング1863199
Ref: whatsnew/3 4 bootstrapping-pip-by-default1863420
Ref: 10f81863420
Ref: デフォルトでの pip のブートストラッピング-Footnote-11867264
Ref: デフォルトでの pip のブートストラッピング-Footnote-21867306
Node: ドキュメントの変更1867393
Ref: whatsnew/3 4 documentation-changes1867614
Ref: 10fb1867614
Ref: ドキュメントの変更-Footnote-11868768
Ref: ドキュメントの変更-Footnote-21868805
Node: PEP 446 新規作成されたファイル記述子は継承不可1868847
Ref: whatsnew/3 4 pep-446-newly-created-file-descriptors-are-non-inheritable1869096
Ref: 10ff1869096
Ref: whatsnew/3 4 whatsnew-pep-4461869096
Ref: 10dd1869096
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-11870334
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-21870376
Node: Codec 処理の改良1870418
Ref: whatsnew/3 4 codec-handling-improvements1870640
Ref: 10df1870640
Ref: whatsnew/3 4 improvements-to-codec-handling1870640
Ref: 11071870640
Ref: Codec 処理の改良-Footnote-11875921
Ref: Codec 処理の改良-Footnote-21875999
Ref: Codec 処理の改良-Footnote-31876063
Ref: Codec 処理の改良-Footnote-41876128
Ref: Codec 処理の改良-Footnote-51876193
Node: PEP 451 インポートシステムのための ModuleSpec 型1876258
Ref: whatsnew/3 4 pep-451-a-modulespec-type-for-the-import-system1876443
Ref: 110c1876443
Ref: whatsnew/3 4 whatsnew-pep-4511876443
Ref: 10e01876443
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-11877656
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-21877698
Node: その他の言語変更<10>1877778
Ref: whatsnew/3 4 other-language-changes1877933
Ref: 110e1877933
Ref: その他の言語変更<10>-Footnote-11881295
Ref: その他の言語変更<10>-Footnote-21881360
Ref: その他の言語変更<10>-Footnote-31881425
Ref: その他の言語変更<10>-Footnote-41881490
Ref: その他の言語変更<10>-Footnote-51881557
Ref: その他の言語変更<10>-Footnote-61881622
Ref: その他の言語変更<10>-Footnote-71881687
Ref: その他の言語変更<10>-Footnote-81881752
Ref: その他の言語変更<10>-Footnote-91881817
Ref: その他の言語変更<10>-Footnote-101881882
Ref: その他の言語変更<10>-Footnote-111881948
Ref: その他の言語変更<10>-Footnote-121882014
Ref: その他の言語変更<10>-Footnote-131882057
Node: 新たなモジュール<10>1882123
Ref: whatsnew/3 4 new-modules1882283
Ref: 11141882283
Node: asyncio<14>1882529
Ref: whatsnew/3 4 asyncio1882626
Ref: 11151882626
Ref: whatsnew/3 4 whatsnew-asyncio1882626
Ref: 10e21882626
Ref: asyncio<14>-Footnote-11883535
Ref: asyncio<14>-Footnote-21883577
Ref: asyncio<14>-Footnote-31883619
Node: ensurepip<2>1883661
Ref: whatsnew/3 4 ensurepip1883774
Ref: 11161883774
Ref: whatsnew/3 4 whatsnew-ensurepip1883774
Ref: 10e31883774
Ref: ensurepip<2>-Footnote-11885545
Node: enum<9>1885587
Ref: whatsnew/3 4 enum1885700
Ref: 11171885700
Ref: whatsnew/3 4 whatsnew-enum1885700
Ref: 10e41885700
Ref: enum<9>-Footnote-11886378
Ref: enum<9>-Footnote-21886420
Node: pathlib<14>1886462
Ref: whatsnew/3 4 pathlib1886575
Ref: 11181886575
Ref: whatsnew/3 4 whatsnew-pathlib1886575
Ref: 10e51886575
Ref: pathlib<14>-Footnote-11887380
Node: selectors<2>1887422
Ref: whatsnew/3 4 selectors1887541
Ref: 11191887541
Ref: whatsnew/3 4 whatsnew-selectors1887541
Ref: 10e61887541
Ref: selectors<2>-Footnote-11887869
Node: statistics<6>1887911
Ref: whatsnew/3 4 statistics1888033
Ref: 111a1888033
Ref: whatsnew/3 4 whatsnew-statistics1888033
Ref: 10e71888033
Ref: statistics<6>-Footnote-11888545
Ref: statistics<6>-Footnote-21888587
Node: tracemalloc<4>1888629
Ref: whatsnew/3 4 tracemalloc1888730
Ref: 111b1888730
Ref: whatsnew/3 4 whatsnew-tracemalloc1888730
Ref: 10e81888730
Ref: tracemalloc<4>-Footnote-11889612
Ref: tracemalloc<4>-Footnote-21889654
Node: 改良されたモジュール<10>1889696
Ref: whatsnew/3 4 improved-modules1889863
Ref: 111c1889863
Node: abc1891251
Ref: whatsnew/3 4 abc1891341
Ref: 111d1891341
Ref: abc-Footnote-11892053
Ref: abc-Footnote-21892118
Node: aifc<2>1892183
Ref: whatsnew/3 4 aifc1892293
Ref: 11211892293
Ref: aifc<2>-Footnote-11892903
Ref: aifc<2>-Footnote-21892968
Ref: aifc<2>-Footnote-31893033
Node: argparse<7>1893097
Ref: whatsnew/3 4 argparse1893211
Ref: 11221893211
Ref: argparse<7>-Footnote-11893512
Node: audioop1893577
Ref: whatsnew/3 4 audioop1893693
Ref: 11231893693
Ref: audioop-Footnote-11894217
Ref: audioop-Footnote-21894282
Ref: audioop-Footnote-31894347
Node: base64<4>1894412
Ref: whatsnew/3 4 base641894531
Ref: 11241894531
Ref: base64<4>-Footnote-11895524
Ref: base64<4>-Footnote-21895589
Node: collections<6>1895654
Ref: whatsnew/3 4 collections1895774
Ref: 11291895774
Ref: collections<6>-Footnote-11896221
Node: colorsys1896286
Ref: whatsnew/3 4 colorsys1896410
Ref: 112b1896410
Ref: colorsys-Footnote-11896784
Ref: colorsys-Footnote-21896855
Node: contextlib<6>1896920
Ref: whatsnew/3 4 contextlib1897036
Ref: 112c1897036
Ref: contextlib<6>-Footnote-11898698
Ref: contextlib<6>-Footnote-21898763
Ref: contextlib<6>-Footnote-31898828
Node: dbm<6>1898893
Ref: whatsnew/3 4 dbm1899007
Ref: 11301899007
Ref: dbm<6>-Footnote-11899421
Node: dis<5>1899486
Ref: whatsnew/3 4 dis1899597
Ref: 11321899597
Ref: dis<5>-Footnote-11902850
Ref: dis<5>-Footnote-21902915
Ref: dis<5>-Footnote-31902980
Ref: dis<5>-Footnote-41903045
Node: doctest<4>1903125
Ref: whatsnew/3 4 doctest1903238
Ref: 11371903238
Ref: doctest<4>-Footnote-11904267
Ref: doctest<4>-Footnote-21904332
Ref: doctest<4>-Footnote-31904397
Node: email<5>1904461
Ref: whatsnew/3 4 email1904575
Ref: 113b1904575
Ref: whatsnew/3 4 whatsnew-email-contentmanager1906045
Ref: 10ec1906045
Ref: email<5>-Footnote-11907230
Ref: email<5>-Footnote-21907295
Ref: email<5>-Footnote-31907360
Ref: email<5>-Footnote-41907425
Node: filecmp1907490
Ref: whatsnew/3 4 filecmp1907606
Ref: 11431907606
Ref: filecmp-Footnote-11908390
Ref: filecmp-Footnote-21908455
Node: functools<6>1908520
Ref: whatsnew/3 4 functools1908633
Ref: 11471908633
Ref: whatsnew/3 4 whatsnew-singledispatch1909189
Ref: 10e91909189
Ref: functools<6>-Footnote-11910731
Ref: functools<6>-Footnote-21910795
Ref: functools<6>-Footnote-31910837
Ref: functools<6>-Footnote-41910902
Node: gc<7>1910967
Ref: whatsnew/3 4 gc1911080
Ref: 11491911080
Ref: gc<7>-Footnote-11911371
Node: glob<4>1911436
Ref: whatsnew/3 4 glob1911547
Ref: 114a1911547
Ref: glob<4>-Footnote-11911890
Node: hashlib<6>1911954
Ref: whatsnew/3 4 hashlib1912067
Ref: 114c1912067
Ref: hashlib<6>-Footnote-11912904
Ref: hashlib<6>-Footnote-21912949
Ref: hashlib<6>-Footnote-31913014
Node: hmac<4>1913079
Ref: whatsnew/3 4 hmac1913189
Ref: 114e1913189
Ref: hmac<4>-Footnote-11914445
Ref: hmac<4>-Footnote-21914510
Ref: hmac<4>-Footnote-31914575
Ref: hmac<4>-Footnote-41914617
Node: html1914682
Ref: whatsnew/3 4 html1914789
Ref: 11531914789
Ref: html-Footnote-11915674
Ref: html-Footnote-21915738
Ref: html-Footnote-31915803
Node: http<4>1915868
Ref: whatsnew/3 4 http1915987
Ref: 11541915987
Ref: http<4>-Footnote-11917166
Ref: http<4>-Footnote-21917231
Node: idlelib と IDLE<4>1917296
Ref: whatsnew/3 4 idlelib-and-idle1917423
Ref: 11581917423
Node: importlib<9>1917955
Ref: whatsnew/3 4 importlib1918085
Ref: 11591918085
Ref: importlib<9>-Footnote-11920484
Ref: importlib<9>-Footnote-21920549
Ref: importlib<9>-Footnote-31920614
Ref: importlib<9>-Footnote-41920679
Ref: importlib<9>-Footnote-51920744
Ref: importlib<9>-Footnote-61920809
Ref: importlib<9>-Footnote-71920874
Ref: importlib<9>-Footnote-81920916
Node: inspect<9>1920981
Ref: whatsnew/3 4 inspect1921104
Ref: 11601921104
Ref: inspect<9>-Footnote-11923526
Ref: inspect<9>-Footnote-21923591
Ref: inspect<9>-Footnote-31923656
Ref: inspect<9>-Footnote-41923721
Ref: inspect<9>-Footnote-51923786
Ref: inspect<9>-Footnote-61923851
Ref: inspect<9>-Footnote-71923916
Node: ipaddress<5>1923994
Ref: whatsnew/3 4 ipaddress1924115
Ref: 11641924115
Ref: ipaddress<5>-Footnote-11924893
Node: logging<6>1924958
Ref: whatsnew/3 4 logging1925079
Ref: 11661925079
Ref: logging<6>-Footnote-11926418
Ref: logging<6>-Footnote-21926482
Ref: logging<6>-Footnote-31926537
Ref: logging<6>-Footnote-41926602
Node: marshal<2>1926667
Ref: whatsnew/3 4 marshal1926783
Ref: 116c1926783
Ref: whatsnew/3 4 whatsnew-marshal-31926783
Ref: 10e11926783
Ref: marshal<2>-Footnote-11927649
Ref: marshal<2>-Footnote-21927714
Node: mmap<3>1927779
Ref: whatsnew/3 4 mmap1927903
Ref: 116d1927903
Ref: mmap<3>-Footnote-11928076
Node: multiprocessing<8>1928140
Ref: whatsnew/3 4 multiprocessing1928265
Ref: 116e1928265
Ref: whatsnew/3 4 whatsnew-multiprocessing-no-fork1928318
Ref: 10eb1928318
Ref: multiprocessing<8>-Footnote-11930694
Ref: multiprocessing<8>-Footnote-21930758
Ref: multiprocessing<8>-Footnote-31930823
Ref: multiprocessing<8>-Footnote-41930887
Node: operator<4>1930952
Ref: whatsnew/3 4 operator1931076
Ref: 11721931076
Ref: operator<4>-Footnote-11931687
Ref: operator<4>-Footnote-21931729
Ref: operator<4>-Footnote-31931794
Node: os<12>1931859
Ref: whatsnew/3 4 os1931971
Ref: 11741931971
Ref: os<12>-Footnote-11933671
Ref: os<12>-Footnote-21933736
Ref: os<12>-Footnote-31933801
Ref: os<12>-Footnote-41933865
Node: pdb<8>1933930
Ref: whatsnew/3 4 pdb1934040
Ref: 117a1934040
Ref: pdb<8>-Footnote-11935358
Ref: pdb<8>-Footnote-21935423
Node: pickle<5>1935488
Ref: whatsnew/3 4 pickle1935603
Ref: 117d1935603
Ref: whatsnew/3 4 whatsnew-protocol-41935603
Ref: 10ea1935603
Ref: pickle<5>-Footnote-11936199
Node: plistlib<2>1936241
Ref: whatsnew/3 4 plistlib1936359
Ref: 117e1936359
Ref: plistlib<2>-Footnote-11936896
Node: poplib<3>1936961
Ref: whatsnew/3 4 poplib1937079
Ref: 11811937079
Ref: poplib<3>-Footnote-11937535
Node: pprint<4>1937599
Ref: whatsnew/3 4 pprint1937712
Ref: 11841937712
Ref: pprint<4>-Footnote-11938449
Ref: pprint<4>-Footnote-21938514
Node: pty<2>1938579
Ref: whatsnew/3 4 pty1938691
Ref: 11871938691
Node: pydoc<5>1938923
Ref: whatsnew/3 4 pydoc1939031
Ref: 11891939031
Ref: pydoc<5>-Footnote-11940300
Ref: pydoc<5>-Footnote-21940365
Node: re<9>1940430
Ref: whatsnew/3 4 re1940540
Ref: 118a1940540
Ref: re<9>-Footnote-11941358
Ref: re<9>-Footnote-21941423
Ref: re<9>-Footnote-31941488
Node: resource1941553
Ref: whatsnew/3 4 resource1941661
Ref: 118f1941661
Ref: resource-Footnote-11942565
Ref: resource-Footnote-21942630
Ref: resource-Footnote-31942695
Node: select1942760
Ref: whatsnew/3 4 select1942872
Ref: 11991942872
Ref: select-Footnote-11943483
Ref: select-Footnote-21943548
Node: shelve<2>1943613
Ref: whatsnew/3 4 shelve1943726
Ref: 11a01943726
Ref: shelve<2>-Footnote-11944064
Node: shutil<6>1944129
Ref: whatsnew/3 4 shutil1944244
Ref: 11a21944244
Ref: shutil<6>-Footnote-11944733
Node: smtpd<3>1944800
Ref: whatsnew/3 4 smtpd1944916
Ref: 11a51944916
Ref: smtpd<3>-Footnote-11945276
Node: smtplib<3>1945341
Ref: whatsnew/3 4 smtplib1945458
Ref: 11a61945458
Ref: smtplib<3>-Footnote-11945944
Node: socket<10>1946008
Ref: whatsnew/3 4 socket1946128
Ref: 11a81946128
Ref: socket<10>-Footnote-11947066
Ref: socket<10>-Footnote-21947131
Node: sqlite3<10>1947195
Ref: whatsnew/3 4 sqlite31947312
Ref: 11ac1947312
Ref: sqlite3<10>-Footnote-11947714
Ref: sqlite3<10>-Footnote-21947754
Node: ssl<11>1947819
Ref: whatsnew/3 4 ssl1947930
Ref: 11ad1947930
Ref: whatsnew/3 4 whatsnew-tls-11-121947959
Ref: 10ee1947959
Ref: whatsnew/3 4 whatsnew34-sslcontext1948289
Ref: 10f11948289
Ref: whatsnew/3 4 whatsnew34-win-cert-store1951543
Ref: 10ef1951543
Ref: whatsnew/3 4 whatsnew34-sni1951897
Ref: 10f01951897
Ref: ssl<11>-Footnote-11952392
Ref: ssl<11>-Footnote-21952457
Ref: ssl<11>-Footnote-31952522
Ref: ssl<11>-Footnote-41952587
Ref: ssl<11>-Footnote-51952652
Ref: ssl<11>-Footnote-61952717
Ref: ssl<11>-Footnote-71952781
Ref: ssl<11>-Footnote-81952846
Ref: ssl<11>-Footnote-91952911
Ref: ssl<11>-Footnote-101952975
Node: stat1953041
Ref: whatsnew/3 4 stat1953150
Ref: 11bf1953150
Ref: stat-Footnote-11953625
Ref: stat-Footnote-21953690
Node: struct<3>1953755
Ref: whatsnew/3 4 struct1953870
Ref: 11c41953870
Ref: struct<3>-Footnote-11954305
Node: subprocess<5>1954370
Ref: whatsnew/3 4 subprocess1954489
Ref: 11c71954489
Ref: subprocess<5>-Footnote-11955049
Ref: subprocess<5>-Footnote-21955114
Node: sunau<2>1955179
Ref: whatsnew/3 4 sunau1955296
Ref: 11cb1955296
Ref: sunau<2>-Footnote-11956080
Ref: sunau<2>-Footnote-21956145
Ref: sunau<2>-Footnote-31956210
Ref: sunau<2>-Footnote-41956275
Node: sys<12>1956339
Ref: whatsnew/3 4 sys1956453
Ref: 11cc1956453
Ref: sys<12>-Footnote-11958086
Ref: sys<12>-Footnote-21958151
Node: tarfile<8>1958215
Ref: whatsnew/3 4 tarfile1958332
Ref: 11d01958332
Ref: tarfile<8>-Footnote-11958753
Node: textwrap<2>1958818
Ref: whatsnew/3 4 textwrap1958940
Ref: 11d21958940
Ref: textwrap<2>-Footnote-11959818
Ref: textwrap<2>-Footnote-21959883
Node: threading<8>1959948
Ref: whatsnew/3 4 threading1960072
Ref: 11d71960072
Ref: threading<8>-Footnote-11960470
Node: traceback<6>1960535
Ref: whatsnew/3 4 traceback1960656
Ref: 11d91960656
Ref: traceback<6>-Footnote-11961047
Node: types<7>1961114
Ref: whatsnew/3 4 types1961232
Ref: 11db1961232
Ref: types<7>-Footnote-11961743
Node: urllib<5>1961808
Ref: whatsnew/3 4 urllib1961926
Ref: 11dc1961926
Ref: urllib<5>-Footnote-11963663
Ref: urllib<5>-Footnote-21963728
Ref: urllib<5>-Footnote-31963793
Ref: urllib<5>-Footnote-41963858
Ref: urllib<5>-Footnote-51963923
Ref: urllib<5>-Footnote-61963988
Node: unittest<10>1964053
Ref: whatsnew/3 4 unittest1964170
Ref: 11e61964170
Ref: unittest<10>-Footnote-11968195
Ref: unittest<10>-Footnote-21968260
Ref: unittest<10>-Footnote-31968325
Ref: unittest<10>-Footnote-41968390
Ref: unittest<10>-Footnote-51968455
Ref: unittest<10>-Footnote-61968520
Ref: unittest<10>-Footnote-71968585
Ref: unittest<10>-Footnote-81968650
Ref: unittest<10>-Footnote-91968715
Node: venv<7>1968780
Ref: whatsnew/3 4 venv1968895
Ref: 11ee1968895
Ref: venv<7>-Footnote-11969562
Ref: venv<7>-Footnote-21969627
Ref: venv<7>-Footnote-31969692
Node: wave<2>1969734
Ref: whatsnew/3 4 wave1969847
Ref: 11ef1969847
Ref: wave<2>-Footnote-11970639
Ref: wave<2>-Footnote-21970704
Ref: wave<2>-Footnote-31970769
Ref: wave<2>-Footnote-41970833
Node: weakref<2>1970897
Ref: whatsnew/3 4 weakref1971015
Ref: 11f41971015
Ref: weakref<2>-Footnote-11971798
Ref: weakref<2>-Footnote-21971863
Ref: weakref<2>-Footnote-31971928
Node: xml etree<2>1971993
Ref: whatsnew/3 4 xml-etree1972114
Ref: 11f81972114
Ref: xml etree<2>-Footnote-11973016
Ref: xml etree<2>-Footnote-21973081
Node: zipfile<6>1973146
Ref: whatsnew/3 4 zipfile1973248
Ref: 11fd1973248
Ref: zipfile<6>-Footnote-11973923
Ref: zipfile<6>-Footnote-21973988
Node: CPython の実装の変更1974053
Ref: whatsnew/3 4 cpython-implementation-changes1974205
Ref: 12001974205
Node: PEP 445 CPython のメモリアロケータのカスタマイズ1974877
Ref: whatsnew/3 4 pep-445-customization-of-cpython-memory-allocators1975084
Ref: 12011975084
Ref: whatsnew/3 4 whatsnew-pep-4451975084
Ref: 10f41975084
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-11975595
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-21975637
Node: PEP 442 オブジェクトの安全なファイナライゼーション1975679
Ref: whatsnew/3 4 pep-442-safe-object-finalization1975963
Ref: 12021975963
Ref: whatsnew/3 4 whatsnew-pep-4421975963
Ref: 10f31975963
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-11977184
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-21977226
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-31977291
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-41977357
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-51977413
Node: PEP 456 安全で取り換え可能なハッシュアルゴリズム1977455
Ref: whatsnew/3 4 pep-456-secure-and-interchangeable-hash-algorithm1977698
Ref: 12041977698
Ref: whatsnew/3 4 whatsnew-pep-4561977698
Ref: 10ed1977698
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-11978945
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-21978987
Node: PEP 436 Argument Clinic1979052
Ref: whatsnew/3 4 pep-436-argument-clinic1979270
Ref: 12061979270
Ref: whatsnew/3 4 whatsnew-pep-4361979270
Ref: 10f51979270
Ref: PEP 436 Argument Clinic-Footnote-11980796
Ref: PEP 436 Argument Clinic-Footnote-21980838
Node: その他のビルド並びに C API の変更1980880
Ref: whatsnew/3 4 other-build-and-c-api-changes1981051
Ref: 12071981051
Ref: その他のビルド並びに C API の変更-Footnote-11983615
Ref: その他のビルド並びに C API の変更-Footnote-21983680
Ref: その他のビルド並びに C API の変更-Footnote-31983722
Ref: その他のビルド並びに C API の変更-Footnote-41983787
Ref: その他のビルド並びに C API の変更-Footnote-51983854
Ref: その他のビルド並びに C API の変更-Footnote-61983918
Ref: その他のビルド並びに C API の変更-Footnote-71983983
Ref: その他のビルド並びに C API の変更-Footnote-81984056
Ref: その他のビルド並びに C API の変更-Footnote-91984120
Ref: その他のビルド並びに C API の変更-Footnote-101984185
Node: その他の改善<2>1984251
Ref: whatsnew/3 4 other-improvements1984417
Ref: 120b1984417
Ref: whatsnew/3 4 other-improvements-3-41984417
Ref: 120c1984417
Ref: whatsnew/3 4 whatsnew-isolated-mode1984468
Ref: 10de1984468
Ref: その他の改善<2>-Footnote-11989453
Ref: その他の改善<2>-Footnote-21989518
Ref: その他の改善<2>-Footnote-31989582
Ref: その他の改善<2>-Footnote-41989647
Ref: その他の改善<2>-Footnote-51989712
Ref: その他の改善<2>-Footnote-61989777
Ref: その他の改善<2>-Footnote-71989842
Ref: その他の改善<2>-Footnote-81989937
Ref: その他の改善<2>-Footnote-91989988
Ref: その他の改善<2>-Footnote-101990053
Ref: その他の改善<2>-Footnote-111990119
Ref: その他の改善<2>-Footnote-121990173
Ref: その他の改善<2>-Footnote-131990239
Ref: その他の改善<2>-Footnote-141990305
Ref: その他の改善<2>-Footnote-151990348
Ref: その他の改善<2>-Footnote-161990414
Ref: その他の改善<2>-Footnote-171990480
Ref: その他の改善<2>-Footnote-181990546
Ref: その他の改善<2>-Footnote-191990612
Ref: その他の改善<2>-Footnote-201990655
Ref: その他の改善<2>-Footnote-211990721
Ref: その他の改善<2>-Footnote-221990787
Ref: その他の改善<2>-Footnote-231990853
Node: 大幅な最適化1990919
Ref: whatsnew/3 4 significant-optimizations1991030
Ref: 12111991030
Ref: 大幅な最適化-Footnote-11994497
Ref: 大幅な最適化-Footnote-21994562
Ref: 大幅な最適化-Footnote-31994627
Ref: 大幅な最適化-Footnote-41994692
Ref: 大幅な最適化-Footnote-51994757
Ref: 大幅な最適化-Footnote-61994822
Ref: 大幅な最適化-Footnote-71994887
Ref: 大幅な最適化-Footnote-81994951
Ref: 大幅な最適化-Footnote-91995016
Ref: 大幅な最適化-Footnote-101995081
Ref: 大幅な最適化-Footnote-111995147
Ref: 大幅な最適化-Footnote-121995213
Ref: 大幅な最適化-Footnote-131995279
Node: 非推奨<12>1995345
Ref: whatsnew/3 4 deprecated1995473
Ref: 12151995473
Ref: whatsnew/3 4 deprecated-3-41995473
Ref: 110d1995473
Node: Python API の非推奨項目1996011
Ref: whatsnew/3 4 deprecations-in-the-python-api1996117
Ref: 12161996117
Node: 非推奨の機能2000377
Ref: whatsnew/3 4 deprecated-features2000483
Ref: 121a2000483
Ref: 非推奨の機能-Footnote-12001050
Ref: 非推奨の機能-Footnote-22001115
Node: 削除<12>2001180
Ref: whatsnew/3 4 removed2001305
Ref: 121c2001305
Node: サポートされなくなったオペレーティングシステム2001492
Ref: whatsnew/3 4 operating-systems-no-longer-supported2001642
Ref: 121d2001642
Ref: サポートされなくなったオペレーティングシステム-Footnote-12002105
Ref: サポートされなくなったオペレーティングシステム-Footnote-22002170
Ref: サポートされなくなったオペレーティングシステム-Footnote-32002225
Ref: サポートされなくなったオペレーティングシステム-Footnote-42002290
Node: API と機能の削除<5>2002355
Ref: whatsnew/3 4 api-and-feature-removals2002532
Ref: 121e2002532
Ref: API と機能の削除<5>-Footnote-12006439
Ref: API と機能の削除<5>-Footnote-22006475
Ref: API と機能の削除<5>-Footnote-32006533
Ref: API と機能の削除<5>-Footnote-42006584
Ref: API と機能の削除<5>-Footnote-52006649
Ref: API と機能の削除<5>-Footnote-62006714
Ref: API と機能の削除<5>-Footnote-72006779
Ref: API と機能の削除<5>-Footnote-82006844
Ref: API と機能の削除<5>-Footnote-92006908
Node: コードの整理2006973
Ref: whatsnew/3 4 code-cleanups2007072
Ref: 12202007072
Ref: コードの整理-Footnote-12007888
Node: Python 3 4 への移植2007953
Ref: whatsnew/3 4 porting-to-python-3-42008080
Ref: 12212008080
Node: 'python' コマンドの挙動の変更<2>2008474
Ref: whatsnew/3 4 changes-in-python-command-behavior2008609
Ref: 12222008609
Ref: 'python' コマンドの挙動の変更<2>-Footnote-12010046
Node: Python API の変更<11>2010111
Ref: whatsnew/3 4 changes-in-the-python-api2010274
Ref: 11122010274
Ref: Python API の変更<11>-Footnote-12027870
Ref: Python API の変更<11>-Footnote-22027935
Ref: Python API の変更<11>-Footnote-32028000
Ref: Python API の変更<11>-Footnote-42028065
Ref: Python API の変更<11>-Footnote-52028120
Ref: Python API の変更<11>-Footnote-62028185
Ref: Python API の変更<11>-Footnote-72028250
Ref: Python API の変更<11>-Footnote-82028315
Ref: Python API の変更<11>-Footnote-92028380
Ref: Python API の変更<11>-Footnote-102028445
Ref: Python API の変更<11>-Footnote-112028510
Ref: Python API の変更<11>-Footnote-122028576
Ref: Python API の変更<11>-Footnote-132028642
Ref: Python API の変更<11>-Footnote-142028708
Ref: Python API の変更<11>-Footnote-152028774
Ref: Python API の変更<11>-Footnote-162028840
Ref: Python API の変更<11>-Footnote-172028906
Ref: Python API の変更<11>-Footnote-182028972
Ref: Python API の変更<11>-Footnote-192029038
Ref: Python API の変更<11>-Footnote-202029104
Ref: Python API の変更<11>-Footnote-212029170
Ref: Python API の変更<11>-Footnote-222029236
Ref: Python API の変更<11>-Footnote-232029302
Ref: Python API の変更<11>-Footnote-242029368
Ref: Python API の変更<11>-Footnote-252029434
Ref: Python API の変更<11>-Footnote-262029499
Node: C API の変更<15>2029565
Ref: whatsnew/3 4 changes-in-the-c-api2029677
Ref: 12322029677
Ref: C API の変更<15>-Footnote-12031827
Ref: C API の変更<15>-Footnote-22031892
Node: 3 4 3 の変更2031957
Ref: whatsnew/3 4 changed-in-3-4-32032065
Ref: 12382032065
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化2032328
Ref: whatsnew/3 4 pep-4762032481
Ref: 12392032481
Ref: whatsnew/3 4 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2032481
Ref: 123a2032481
Node: What's New In Python 3 32033699
Ref: whatsnew/3 3 doc2033846
Ref: 123b2033846
Ref: whatsnew/3 3 translation-repo2033846
Ref: 123c2033846
Ref: whatsnew/3 3 what-s-new-in-python-3-32033846
Ref: 123d2033846
Ref: What's New In Python 3 3-Footnote-12036061
Ref: What's New In Python 3 3-Footnote-22036120
Node: 概要 -- リリースハイライト<12>2036162
Ref: whatsnew/3 3 summary-release-highlights2036293
Ref: 123e2036293
Node: PEP 405 仮想環境2037879
Ref: whatsnew/3 3 pep-4052038066
Ref: 12402038066
Ref: whatsnew/3 3 pep-405-virtual-environments2038066
Ref: 12482038066
Ref: PEP 405 仮想環境-Footnote-12039270
Node: PEP 420 暗黙的な名前空間パッケージ2039312
Ref: whatsnew/3 3 pep-420-implicit-namespace-packages2039554
Ref: 12492039554
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-12040138
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-22040180
Node: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント2040222
Ref: whatsnew/3 3 pep-3118-new-memoryview-implementation-and-buffer-protocol-documentation2040479
Ref: 124a2040479
Ref: whatsnew/3 3 pep-3118-update2040479
Ref: 124b2040479
Ref: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント-Footnote-12042112
Node: フィーチャー2042154
Ref: whatsnew/3 3 features2042327
Ref: 124e2042327
Ref: フィーチャー-Footnote-12043487
Node: API の変更2043552
Ref: whatsnew/3 3 api-changes2043725
Ref: 12532043725
Ref: API の変更-Footnote-12045165
Ref: API の変更-Footnote-22045230
Node: PEP 393 文字列の柔軟な表現2045272
Ref: whatsnew/3 3 pep-3932045521
Ref: 12432045521
Ref: whatsnew/3 3 pep-393-flexible-string-representation2045521
Ref: 125a2045521
Ref: PEP 393 文字列の柔軟な表現-Footnote-12046973
Node: 機能性2047015
Ref: whatsnew/3 3 functionality2047141
Ref: 125b2047141
Ref: 機能性-Footnote-12049038
Ref: 機能性-Footnote-22049080
Node: 性能およびリソース使用量2049145
Ref: whatsnew/3 3 performance-and-resource-usage2049271
Ref: 125d2049271
Ref: 性能およびリソース使用量-Footnote-12051064
Node: PEP 397 Windows の Python ランチャ2051106
Ref: whatsnew/3 3 pep-3972051308
Ref: 125e2051308
Ref: whatsnew/3 3 pep-397-python-launcher-for-windows2051308
Ref: 125f2051308
Ref: PEP 397 Windows の Python ランチャ-Footnote-12053356
Ref: PEP 397 Windows の Python ランチャ-Footnote-22053420
Node: PEP 3151 OS および IO 例外階層の手直し2053462
Ref: whatsnew/3 3 pep-31512053679
Ref: 12412053679
Ref: whatsnew/3 3 pep-3151-reworking-the-os-and-io-exception-hierarchy2053679
Ref: 12612053679
Ref: PEP 3151 OS および IO 例外階層の手直し-Footnote-12056344
Node: PEP 380 サブジェネレータへの委譲構文2056386
Ref: whatsnew/3 3 pep-3802056605
Ref: 123f2056605
Ref: whatsnew/3 3 pep-380-syntax-for-delegating-to-a-subgenerator2056605
Ref: 126f2056605
Ref: PEP 380 サブジェネレータへの委譲構文-Footnote-12059530
Node: PEP 409 例外コンテキストの抑制2059572
Ref: whatsnew/3 3 pep-409-suppressing-exception-context2059789
Ref: 12722059789
Ref: PEP 409 例外コンテキストの抑制-Footnote-12062116
Node: PEP 414 明示的なユニコードリテラル2062158
Ref: whatsnew/3 3 pep-414-explicit-unicode-literals2062364
Ref: 12732062364
Ref: PEP 414 明示的なユニコードリテラル-Footnote-12063251
Node: PEP 3155 クラスと関数の正規名2063293
Ref: whatsnew/3 3 pep-3155-qualified-name-for-classes-and-functions2063484
Ref: 12742063484
Ref: PEP 3155 クラスと関数の正規名-Footnote-12065112
Node: PEP 412 キー共有辞書2065154
Ref: whatsnew/3 3 pep-4122065345
Ref: 12442065345
Ref: whatsnew/3 3 pep-412-key-sharing-dictionary2065345
Ref: 12772065345
Ref: PEP 412 キー共有辞書-Footnote-12065890
Node: PEP 362 関数シグニチャオブジェクト2065932
Ref: whatsnew/3 3 pep-362-function-signature-object2066120
Ref: 12782066120
Ref: PEP 362 関数シグニチャオブジェクト-Footnote-12067345
Node: PEP 421 sys implementation の追加2067387
Ref: whatsnew/3 3 pep-421-adding-sys-implementation2067602
Ref: 127a2067602
Ref: PEP 421 sys implementation の追加-Footnote-12069155
Node: SimpleNamespace2069197
Ref: whatsnew/3 3 simplenamespace2069285
Ref: 127b2069285
Ref: SimpleNamespace-Footnote-12070034
Node: インポート実装としての importlib の使用2070076
Ref: whatsnew/3 3 importlib2070272
Ref: 12422070272
Ref: whatsnew/3 3 using-importlib-as-the-implementation-of-import2070272
Ref: 127c2070272
Ref: インポート実装としての importlib の使用-Footnote-12071865
Ref: インポート実装としての importlib の使用-Footnote-22071929
Ref: インポート実装としての importlib の使用-Footnote-32071994
Ref: インポート実装としての importlib の使用-Footnote-42072059
Ref: インポート実装としての importlib の使用-Footnote-52072124
Node: 新たな API2072166
Ref: whatsnew/3 3 new-apis2072299
Ref: 127f2072299
Node: 目に見える変化2074543
Ref: whatsnew/3 3 visible-changes2074676
Ref: 12862074676
Ref: 目に見える変化-Footnote-12077287
Ref: 目に見える変化-Footnote-22077329
Node: その他の言語変更<11>2077371
Ref: whatsnew/3 3 other-language-changes2077567
Ref: 12872077567
Ref: その他の言語変更<11>-Footnote-12080074
Ref: その他の言語変更<11>-Footnote-22080139
Ref: その他の言語変更<11>-Footnote-32080204
Ref: その他の言語変更<11>-Footnote-42080269
Ref: その他の言語変更<11>-Footnote-52080334
Ref: その他の言語変更<11>-Footnote-62080399
Ref: その他の言語変更<11>-Footnote-72080464
Ref: その他の言語変更<11>-Footnote-82080529
Node: 細粒度のインポートロック2080594
Ref: whatsnew/3 3 a-finer-grained-import-lock2080764
Ref: 128a2080764
Ref: 細粒度のインポートロック-Footnote-12081647
Node: 組み込みの関数と型2081711
Ref: whatsnew/3 3 builtin-functions-and-types2081881
Ref: 128b2081881
Ref: 組み込みの関数と型-Footnote-12083457
Node: 新たなモジュール<11>2083521
Ref: whatsnew/3 3 new-modules2083689
Ref: 128e2083689
Node: faulthandler<5>2083835
Ref: whatsnew/3 3 faulthandler2083936
Ref: 128f2083936
Node: ipaddress<6>2084917
Ref: whatsnew/3 3 ipaddress2085034
Ref: 12962085034
Ref: ipaddress<6>-Footnote-12085490
Node: lzma<2>2085532
Ref: whatsnew/3 3 lzma2085625
Ref: 12972085625
Ref: lzma<2>-Footnote-12085939
Node: 改良されたモジュール<11>2086003
Ref: whatsnew/3 3 improved-modules2086157
Ref: 12982086157
Node: abc<2>2087513
Ref: whatsnew/3 3 abc2087607
Ref: 12992087607
Ref: abc<2>-Footnote-12088841
Ref: abc<2>-Footnote-22088906
Node: array<4>2088971
Ref: whatsnew/3 3 array2089083
Ref: 129f2089083
Ref: array<4>-Footnote-12089317
Node: base64<5>2089384
Ref: whatsnew/3 3 base642089501
Ref: 12a02089501
Ref: base64<5>-Footnote-12089909
Node: binascii<3>2089974
Ref: whatsnew/3 3 binascii2090089
Ref: 12a12090089
Ref: binascii<3>-Footnote-12090398
Node: bz2<2>2090463
Ref: whatsnew/3 3 bz22090578
Ref: 12a22090578
Ref: bz2<2>-Footnote-12091755
Ref: bz2<2>-Footnote-22091819
Node: codecs<2>2091883
Ref: whatsnew/3 3 codecs2092001
Ref: 12a52092001
Ref: codecs<2>-Footnote-12093802
Ref: codecs<2>-Footnote-22093867
Ref: codecs<2>-Footnote-32093932
Node: collections<7>2093997
Ref: whatsnew/3 3 collections2094122
Ref: 12a62094122
Ref: collections<7>-Footnote-12095071
Ref: collections<7>-Footnote-22095136
Ref: collections<7>-Footnote-32095201
Ref: collections<7>-Footnote-42095266
Node: contextlib<7>2095331
Ref: whatsnew/3 3 contextlib2095455
Ref: 12a82095455
Ref: contextlib<7>-Footnote-12096275
Node: crypt<2>2096340
Ref: whatsnew/3 3 crypt2096459
Ref: 12a92096459
Ref: crypt<2>-Footnote-12096663
Node: curses<6>2096728
Ref: whatsnew/3 3 curses2096845
Ref: 12aa2096845
Ref: curses<6>-Footnote-12098309
Ref: curses<6>-Footnote-22098374
Ref: curses<6>-Footnote-32098438
Node: datetime<7>2098503
Ref: whatsnew/3 3 datetime2098622
Ref: 12af2098622
Ref: datetime<7>-Footnote-12099577
Node: decimal<4>2099642
Ref: whatsnew/3 3 decimal2099760
Ref: 12b12099760
Ref: whatsnew/3 3 new-decimal2099760
Ref: 12452099760
Ref: decimal<4>-Footnote-12101513
Node: フィーチャー<2>2101577
Ref: whatsnew/3 3 id12101670
Ref: 12b22101670
Node: API の変更<2>2102190
Ref: whatsnew/3 3 id22102283
Ref: 12b72102283
Node: email<6>2105707
Ref: whatsnew/3 3 email2105823
Ref: 12c92105823
Ref: whatsnew/3 3 new-email2105823
Ref: 12462105823
Node: ポリシーフレームワーク2105990
Ref: whatsnew/3 3 policy-framework2106127
Ref: 12ca2106127
Node: 新規ヘッダ API を伴った暫定ポリシー2109990
Ref: whatsnew/3 3 provisional-policy-with-new-header-api2110160
Ref: 12ce2110160
Node: その他のAPIの変更2115741
Ref: whatsnew/3 3 other-api-changes2115869
Ref: 12d42115869
Node: ftplib<3>2117048
Ref: whatsnew/3 3 ftplib2117166
Ref: 12da2117166
Ref: ftplib<3>-Footnote-12118348
Ref: ftplib<3>-Footnote-22118412
Ref: ftplib<3>-Footnote-32118477
Node: functools<7>2118542
Ref: whatsnew/3 3 functools2118657
Ref: 12e02118657
Ref: functools<7>-Footnote-12119101
Node: gc<8>2119166
Ref: whatsnew/3 3 gc2119279
Ref: 12e12119279
Node: hmac<5>2119497
Ref: whatsnew/3 3 hmac2119605
Ref: 12e32119605
Ref: hmac<5>-Footnote-12119934
Ref: hmac<5>-Footnote-22119992
Node: http<5>2120057
Ref: whatsnew/3 3 http2120167
Ref: 12e52120167
Ref: http<5>-Footnote-12121056
Ref: http<5>-Footnote-22121120
Ref: http<5>-Footnote-32121185
Node: html<2>2121250
Ref: whatsnew/3 3 html2121363
Ref: 12ec2121363
Ref: html<2>-Footnote-12122375
Ref: html<2>-Footnote-22122440
Ref: html<2>-Footnote-32122505
Ref: html<2>-Footnote-42122570
Ref: html<2>-Footnote-52122635
Ref: html<2>-Footnote-62122700
Ref: html<2>-Footnote-72122767
Ref: html<2>-Footnote-82122833
Ref: html<2>-Footnote-92122898
Ref: html<2>-Footnote-102122963
Ref: html<2>-Footnote-112123031
Ref: html<2>-Footnote-122123098
Ref: html<2>-Footnote-132123164
Ref: html<2>-Footnote-142123230
Ref: html<2>-Footnote-152123295
Ref: html<2>-Footnote-162123361
Node: imaplib<4>2123427
Ref: whatsnew/3 3 imaplib2123544
Ref: 12ee2123544
Ref: imaplib<4>-Footnote-12123859
Node: inspect<10>2123923
Ref: whatsnew/3 3 inspect2124038
Ref: 12ef2124038
Ref: inspect<10>-Footnote-12125046
Ref: inspect<10>-Footnote-22125111
Node: io<8>2125176
Ref: whatsnew/3 3 io2125293
Ref: 12f22125293
Ref: io<8>-Footnote-12125978
Node: itertools<7>2126043
Ref: whatsnew/3 3 itertools2126159
Ref: 12f32126159
Node: logging<7>2126359
Ref: whatsnew/3 3 logging2126478
Ref: 12f42126478
Node: math<10>2127007
Ref: whatsnew/3 3 math2127121
Ref: 12f62127121
Ref: math<10>-Footnote-12127385
Node: mmap<4>2127450
Ref: whatsnew/3 3 mmap2127572
Ref: 12f82127572
Ref: mmap<4>-Footnote-12127983
Node: multiprocessing<9>2128048
Ref: whatsnew/3 3 multiprocessing2128172
Ref: 12fa2128172
Ref: multiprocessing<9>-Footnote-12129606
Ref: multiprocessing<9>-Footnote-22129671
Ref: multiprocessing<9>-Footnote-32129735
Ref: multiprocessing<9>-Footnote-42129799
Node: nntplib<2>2129864
Ref: whatsnew/3 3 nntplib2129987
Ref: 13032129987
Ref: nntplib<2>-Footnote-12130547
Node: os<13>2130611
Ref: whatsnew/3 3 os2130722
Ref: 13042130722
Ref: os<13>-Footnote-12139902
Ref: os<13>-Footnote-22139967
Ref: os<13>-Footnote-32140031
Ref: os<13>-Footnote-42140096
Ref: os<13>-Footnote-52140161
Ref: os<13>-Footnote-62140226
Ref: os<13>-Footnote-72140290
Ref: os<13>-Footnote-82140355
Ref: os<13>-Footnote-92140420
Ref: os<13>-Footnote-102140485
Ref: os<13>-Footnote-112140550
Node: pdb<9>2140616
Ref: whatsnew/3 3 pdb2140726
Ref: 133c2140726
Ref: pdb<9>-Footnote-12141068
Node: pickle<6>2141133
Ref: whatsnew/3 3 pickle2141245
Ref: 133d2141245
Ref: pickle<6>-Footnote-12141564
Node: pydoc<6>2141629
Ref: whatsnew/3 3 pydoc2141741
Ref: 133f2141741
Node: re<10>2141940
Ref: whatsnew/3 3 re2142048
Ref: 13402142048
Ref: re<10>-Footnote-12142272
Node: sched2142336
Ref: whatsnew/3 3 sched2142445
Ref: 13412142445
Ref: sched-Footnote-12144223
Ref: sched-Footnote-22144288
Ref: sched-Footnote-32144352
Ref: sched-Footnote-42144417
Ref: sched-Footnote-52144482
Node: select<2>2144547
Ref: whatsnew/3 3 select2144658
Ref: 13462144658
Ref: select<2>-Footnote-12145034
Node: shlex<3>2145098
Ref: whatsnew/3 3 shlex2145213
Ref: 13472145213
Node: shutil<7>2145520
Ref: whatsnew/3 3 shutil2145635
Ref: 13482145635
Ref: shutil<7>-Footnote-12148210
Ref: shutil<7>-Footnote-22148275
Ref: shutil<7>-Footnote-32148340
Ref: shutil<7>-Footnote-42148405
Ref: shutil<7>-Footnote-52148470
Ref: shutil<7>-Footnote-62148535
Ref: shutil<7>-Footnote-72148600
Ref: shutil<7>-Footnote-82148664
Node: signal<4>2148728
Ref: whatsnew/3 3 signal2148843
Ref: 134b2148843
Ref: signal<4>-Footnote-12150340
Node: smtpd<4>2150404
Ref: whatsnew/3 3 smtpd2150520
Ref: 13522150520
Ref: smtpd<4>-Footnote-12151003
Ref: smtpd<4>-Footnote-22151062
Ref: smtpd<4>-Footnote-32151121
Node: smtplib<4>2151185
Ref: whatsnew/3 3 smtplib2151302
Ref: 13532151302
Ref: smtplib<4>-Footnote-12152274
Ref: smtplib<4>-Footnote-22152339
Ref: smtplib<4>-Footnote-32152404
Node: socket<11>2152468
Ref: whatsnew/3 3 socket2152592
Ref: 13552152592
Ref: socket<11>-Footnote-12153964
Ref: socket<11>-Footnote-22154028
Ref: socket<11>-Footnote-32154093
Ref: socket<11>-Footnote-42154182
Ref: socket<11>-Footnote-52154247
Node: socketserver<3>2154312
Ref: whatsnew/3 3 socketserver2154437
Ref: 13582154437
Ref: socketserver<3>-Footnote-12154920
Node: sqlite3<11>2154985
Ref: whatsnew/3 3 sqlite32155107
Ref: 135c2155107
Ref: sqlite3<11>-Footnote-12155457
Node: ssl<12>2155522
Ref: whatsnew/3 3 ssl2155636
Ref: 135d2155636
Ref: ssl<12>-Footnote-12158317
Ref: ssl<12>-Footnote-22158382
Ref: ssl<12>-Footnote-32158447
Ref: ssl<12>-Footnote-42158512
Ref: ssl<12>-Footnote-52158577
Ref: ssl<12>-Footnote-62158642
Ref: ssl<12>-Footnote-72158701
Ref: ssl<12>-Footnote-82158766
Ref: ssl<12>-Footnote-92158831
Ref: ssl<12>-Footnote-102158896
Ref: ssl<12>-Footnote-112158962
Ref: ssl<12>-Footnote-122159028
Node: stat<2>2159094
Ref: whatsnew/3 3 stat2159206
Ref: 13662159206
Ref: stat<2>-Footnote-12159563
Node: struct<4>2159628
Ref: whatsnew/3 3 struct2159746
Ref: 13682159746
Ref: struct<4>-Footnote-12159995
Node: subprocess<6>2160059
Ref: whatsnew/3 3 subprocess2160177
Ref: 13692160177
Ref: subprocess<6>-Footnote-12160595
Ref: subprocess<6>-Footnote-22160659
Node: sys<13>2160723
Ref: whatsnew/3 3 sys2160842
Ref: 136b2160842
Ref: sys<13>-Footnote-12161123
Node: tarfile<9>2161188
Ref: whatsnew/3 3 tarfile2161305
Ref: 136d2161305
Ref: tarfile<9>-Footnote-12161578
Node: tempfile<4>2161642
Ref: whatsnew/3 3 tempfile2161763
Ref: 136e2161763
Ref: tempfile<4>-Footnote-12161990
Node: textwrap<3>2162054
Ref: whatsnew/3 3 textwrap2162177
Ref: 136f2162177
Ref: textwrap<3>-Footnote-12162488
Node: threading<9>2162553
Ref: whatsnew/3 3 threading2162672
Ref: 13702162672
Ref: threading<9>-Footnote-12163888
Ref: threading<9>-Footnote-22163953
Node: time<8>2164017
Ref: whatsnew/3 3 time2164133
Ref: 13772164133
Ref: time<8>-Footnote-12165318
Ref: time<8>-Footnote-22165360
Node: types<8>2165425
Ref: whatsnew/3 3 types2165541
Ref: 137c2165541
Ref: types<8>-Footnote-12165931
Ref: types<8>-Footnote-22165996
Ref: types<8>-Footnote-32166038
Node: unittest<11>2166103
Ref: whatsnew/3 3 unittest2166221
Ref: 137f2166221
Ref: unittest<11>-Footnote-12166759
Node: urllib<6>2166824
Ref: whatsnew/3 3 urllib2166947
Ref: 13842166947
Ref: urllib<6>-Footnote-12167389
Node: webbrowser<4>2167456
Ref: whatsnew/3 3 webbrowser2167591
Ref: 13862167591
Ref: webbrowser<4>-Footnote-12168186
Ref: webbrowser<4>-Footnote-22168251
Node: xml etree ElementTree<2>2168316
Ref: whatsnew/3 3 xml-etree-elementtree2168449
Ref: 13872168449
Node: zlib<3>2168968
Ref: whatsnew/3 3 zlib2169079
Ref: 13882169079
Ref: zlib<3>-Footnote-12169555
Ref: zlib<3>-Footnote-22169620
Node: 最適化<11>2169685
Ref: whatsnew/3 3 optimizations2169851
Ref: 138b2169851
Ref: 最適化<11>-Footnote-12170781
Ref: 最適化<11>-Footnote-22170823
Ref: 最適化<11>-Footnote-32170888
Ref: 最適化<11>-Footnote-42170953
Node: ビルドならびに C API の変更<4>2171018
Ref: whatsnew/3 3 build-and-c-api-changes2171163
Ref: 12582171163
Ref: ビルドならびに C API の変更<4>-Footnote-12173147
Ref: ビルドならびに C API の変更<4>-Footnote-22173189
Ref: ビルドならびに C API の変更<4>-Footnote-32173231
Node: 非推奨<13>2173296
Ref: whatsnew/3 3 deprecated2173451
Ref: 13a12173451
Node: サポートされないオペレーティングシステム<2>2173889
Ref: whatsnew/3 3 unsupported-operating-systems2174073
Ref: 13a22174073
Node: 非推奨の Python モジュール、関数、メソッド<4>2174562
Ref: whatsnew/3 3 deprecated-python-modules-functions-and-methods2174800
Ref: 13a32174800
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-12177662
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-22177726
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-32177768
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-42177833
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-52177898
Node: C API の非推奨の関数ならびに型<3>2177963
Ref: whatsnew/3 3 deprecated-functions-and-types-of-the-c-api2178159
Ref: 13a72178159
Ref: C API の非推奨の関数ならびに型<3>-Footnote-12181210
Node: 非推奨の機能<2>2181252
Ref: whatsnew/3 3 deprecated-features2181377
Ref: 13b12181377
Node: Python 3 3 への移植2181626
Ref: whatsnew/3 3 porting-to-python-3-32181732
Ref: 13b22181732
Node: Python コードの移植2182078
Ref: whatsnew/3 3 porting-python-code2182192
Ref: 127e2182192
Ref: whatsnew/3 3 portingpythoncode2182192
Ref: 13b32182192
Ref: Python コードの移植-Footnote-12191269
Ref: Python コードの移植-Footnote-22191334
Ref: Python コードの移植-Footnote-32191399
Ref: Python コードの移植-Footnote-42191464
Ref: Python コードの移植-Footnote-52191506
Ref: Python コードの移植-Footnote-62191548
Ref: Python コードの移植-Footnote-72191612
Ref: Python コードの移植-Footnote-82191679
Ref: Python コードの移植-Footnote-92191744
Ref: Python コードの移植-Footnote-102191808
Node: C コードの移植2191874
Ref: whatsnew/3 3 porting-c-code2192017
Ref: 12592192017
Ref: C コードの移植-Footnote-12193803
Node: C 拡張のビルド2193845
Ref: whatsnew/3 3 building-c-extensions2194005
Ref: 13c22194005
Ref: C 拡張のビルド-Footnote-12194704
Node: コマンドラインスイッチの変更2194769
Ref: whatsnew/3 3 command-line-switch-changes2194900
Ref: 13c32194900
Ref: コマンドラインスイッチの変更-Footnote-12195649
Ref: コマンドラインスイッチの変更-Footnote-22195714
Node: What's New In Python 3 22195779
Ref: whatsnew/3 2 doc2195926
Ref: 13c52195926
Ref: whatsnew/3 2 translation-repo2195926
Ref: 13c62195926
Ref: whatsnew/3 2 what-s-new-in-python-3-22195926
Ref: 13c72195926
Ref: What's New In Python 3 2-Footnote-12197531
Ref: What's New In Python 3 2-Footnote-22197630
Node: PEP 384 安定 ABI の定義2197672
Ref: whatsnew/3 2 pep-384-defining-a-stable-abi2197829
Ref: 13c82197829
Ref: PEP 384 安定 ABI の定義-Footnote-12199248
Node: PEP 389 argparse コマンドライン解析モジュール2199290
Ref: whatsnew/3 2 pep-389-argparse-command-line-parsing-module2199499
Ref: 13c92199499
Ref: PEP 389 argparse コマンドライン解析モジュール-Footnote-12204148
Node: PEP 391 logging の辞書ベースの設定2204190
Ref: whatsnew/3 2 pep-391-dictionary-based-configuration-for-logging2204414
Ref: 13cb2204414
Ref: PEP 391 logging の辞書ベースの設定-Footnote-12206798
Node: PEP 3148 concurrent futures モジュール2206840
Ref: whatsnew/3 2 pep-3148-the-concurrent-futures-module2207054
Ref: 13cd2207054
Ref: PEP 3148 concurrent futures モジュール-Footnote-12210739
Node: PEP 3147 PYC リポジトリーディレクトリ2210781
Ref: whatsnew/3 2 pep-3147-pyc-repository-directories2211020
Ref: 13d12211020
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-12214707
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-22214778
Node: PEP 3149 ABI バージョンでタグ付けされた so ファイル2214820
Ref: whatsnew/3 2 pep-3149-abi-version-tagged-so-files2215067
Ref: 13d32215067
Ref: PEP 3149 ABI バージョンでタグ付けされた so ファイル-Footnote-12216719
Node: PEP 3333 Python Web Server Gateway Interface v1 0 12216761
Ref: whatsnew/3 2 pep-3333-python-web-server-gateway-interface-v1-0-12216987
Ref: 13d42216987
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-12220106
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-22220165
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-32220224
Node: その他の言語変更<12>2220266
Ref: whatsnew/3 2 other-language-changes2220511
Ref: 13d62220511
Ref: その他の言語変更<12>-Footnote-12230895
Ref: その他の言語変更<12>-Footnote-22230959
Ref: その他の言語変更<12>-Footnote-32231023
Ref: その他の言語変更<12>-Footnote-42231090
Ref: その他の言語変更<12>-Footnote-52231154
Ref: その他の言語変更<12>-Footnote-62231218
Ref: その他の言語変更<12>-Footnote-72231282
Ref: その他の言語変更<12>-Footnote-82231346
Ref: その他の言語変更<12>-Footnote-92231410
Ref: その他の言語変更<12>-Footnote-102231474
Ref: その他の言語変更<12>-Footnote-112231540
Ref: その他の言語変更<12>-Footnote-122231607
Ref: その他の言語変更<12>-Footnote-132231672
Ref: その他の言語変更<12>-Footnote-142231737
Ref: その他の言語変更<12>-Footnote-152231803
Ref: その他の言語変更<12>-Footnote-162231869
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール2231934
Ref: whatsnew/3 2 new-improved-and-deprecated-modules2232158
Ref: 13e32232158
Node: email<7>2234508
Ref: whatsnew/3 2 email2234660
Ref: 13e42234660
Ref: email<7>-Footnote-12237224
Ref: email<7>-Footnote-22237283
Ref: email<7>-Footnote-32237347
Node: elementtree2237412
Ref: whatsnew/3 2 elementtree2237585
Ref: 13ec2237585
Ref: elementtree-Footnote-12239215
Ref: elementtree-Footnote-22239315
Node: functools<8>2239379
Ref: whatsnew/3 2 functools2239556
Ref: 13f32239556
Ref: functools<8>-Footnote-12243456
Ref: functools<8>-Footnote-22243539
Ref: functools<8>-Footnote-32243618
Ref: functools<8>-Footnote-42243683
Ref: functools<8>-Footnote-52243748
Ref: functools<8>-Footnote-62243812
Ref: functools<8>-Footnote-72243876
Node: itertools<8>2243940
Ref: whatsnew/3 2 itertools2244120
Ref: 13f82244120
Ref: itertools<8>-Footnote-12244895
Ref: itertools<8>-Footnote-22244937
Node: collections<8>2244967
Ref: whatsnew/3 2 collections2245148
Ref: 13fa2245148
Ref: collections<8>-Footnote-12247789
Ref: collections<8>-Footnote-22247849
Node: threading<10>2247925
Ref: whatsnew/3 2 threading2248111
Ref: 13ff2248111
Ref: threading<10>-Footnote-12251522
Ref: threading<10>-Footnote-22251583
Ref: threading<10>-Footnote-32251682
Ref: threading<10>-Footnote-42251754
Node: datetime と time2251818
Ref: whatsnew/3 2 datetime-and-time2251998
Ref: 14032251998
Ref: datetime と time-Footnote-12255047
Ref: datetime と time-Footnote-22255114
Ref: datetime と time-Footnote-32255178
Ref: datetime と time-Footnote-42255242
Ref: datetime と time-Footnote-52255306
Ref: datetime と time-Footnote-62255373
Ref: datetime と time-Footnote-72255437
Node: math<11>2255502
Ref: whatsnew/3 2 math2255675
Ref: 14072255675
Ref: math<11>-Footnote-12257631
Ref: math<11>-Footnote-22257707
Node: abc<3>2257792
Ref: whatsnew/3 2 abc2257953
Ref: 140c2257953
Ref: abc<3>-Footnote-12258636
Node: io<9>2258700
Ref: whatsnew/3 2 io2258860
Ref: 140d2258860
Ref: io<9>-Footnote-12260120
Node: reprlib2260184
Ref: whatsnew/3 2 reprlib2260348
Ref: 140f2260348
Ref: reprlib-Footnote-12261328
Ref: reprlib-Footnote-22261392
Node: logging<8>2261456
Ref: whatsnew/3 2 logging2261621
Ref: 14112261621
Node: csv<4>2263745
Ref: whatsnew/3 2 csv2263916
Ref: 14192263916
Ref: csv<4>-Footnote-12264891
Ref: csv<4>-Footnote-22264955
Node: contextlib<8>2265022
Ref: whatsnew/3 2 contextlib2265204
Ref: 141d2265204
Ref: contextlib<8>-Footnote-12268109
Node: decimal と fractions2268173
Ref: whatsnew/3 2 decimal-and-fractions2268352
Ref: 14202268352
Ref: decimal と fractions-Footnote-12270935
Ref: decimal と fractions-Footnote-22270999
Ref: decimal と fractions-Footnote-32271063
Ref: decimal と fractions-Footnote-42271127
Ref: decimal と fractions-Footnote-52271191
Ref: decimal と fractions-Footnote-62271255
Node: ftp2271319
Ref: whatsnew/3 2 ftp2271490
Ref: 14242271490
Ref: ftp-Footnote-12273195
Ref: ftp-Footnote-22273259
Ref: ftp-Footnote-32273323
Ref: ftp-Footnote-42273387
Node: popen2273451
Ref: whatsnew/3 2 popen2273610
Ref: 14252273610
Ref: popen-Footnote-12273937
Ref: popen-Footnote-22274001
Node: select<3>2274066
Ref: whatsnew/3 2 select2274238
Ref: 14262274238
Ref: select<3>-Footnote-12274672
Node: gzip と zipfile2274736
Ref: whatsnew/3 2 gzip-and-zipfile2274914
Ref: 14282274914
Ref: gzip と zipfile-Footnote-12276655
Ref: gzip と zipfile-Footnote-22276719
Ref: gzip と zipfile-Footnote-32276783
Ref: gzip と zipfile-Footnote-42276850
Ref: gzip と zipfile-Footnote-52276914
Ref: gzip と zipfile-Footnote-62276978
Node: tarfile<10>2277042
Ref: whatsnew/3 2 tarfile2277221
Ref: 142c2277221
Ref: tarfile<10>-Footnote-12279066
Node: hashlib<7>2279130
Ref: whatsnew/3 2 hashlib2279299
Ref: 142f2279299
Ref: hashlib<7>-Footnote-12280138
Node: ast<7>2280202
Ref: whatsnew/3 2 ast2280366
Ref: 14302280366
Node: os<14>2281503
Ref: whatsnew/3 2 os2281666
Ref: 14312281666
Node: shutil<8>2282583
Ref: whatsnew/3 2 shutil2282751
Ref: 14342282751
Node: sqlite3<12>2285523
Ref: whatsnew/3 2 sqlite32285692
Ref: 14362285692
Ref: sqlite3<12>-Footnote-12286457
Node: html<3>2286521
Ref: whatsnew/3 2 html2286691
Ref: 14372286691
Node: socket<12>2287064
Ref: whatsnew/3 2 socket2287230
Ref: 14382287230
Ref: socket<12>-Footnote-12288438
Ref: socket<12>-Footnote-22288502
Ref: socket<12>-Footnote-32288566
Node: ssl<13>2288627
Ref: whatsnew/3 2 ssl2288790
Ref: 143a2288790
Ref: ssl<13>-Footnote-12291261
Ref: ssl<13>-Footnote-22291320
Ref: ssl<13>-Footnote-32291392
Ref: ssl<13>-Footnote-42291451
Ref: ssl<13>-Footnote-52291515
Ref: ssl<13>-Footnote-62291579
Ref: ssl<13>-Footnote-72291643
Ref: ssl<13>-Footnote-82291707
Ref: ssl<13>-Footnote-92291771
Ref: ssl<13>-Footnote-102291835
Node: nntp2291900
Ref: whatsnew/3 2 nntp2292065
Ref: 143e2292065
Ref: nntp-Footnote-12292620
Ref: nntp-Footnote-22292684
Node: certificates2292748
Ref: whatsnew/3 2 certificates2292916
Ref: 143f2292916
Ref: certificates-Footnote-12293591
Node: imaplib<5>2293655
Ref: whatsnew/3 2 imaplib2293833
Ref: 14412293833
Ref: imaplib<5>-Footnote-12294123
Node: http client<4>2294187
Ref: whatsnew/3 2 http-client2294365
Ref: 14432294365
Ref: http client<4>-Footnote-12296374
Node: unittest<12>2296439
Ref: whatsnew/3 2 unittest2296616
Ref: 14452296616
Ref: unittest<12>-Footnote-12301688
Ref: unittest<12>-Footnote-22301753
Ref: unittest<12>-Footnote-32301817
Node: random<5>2301881
Ref: whatsnew/3 2 random2302053
Ref: 144a2302053
Ref: random<5>-Footnote-12302780
Node: poplib<4>2302844
Ref: whatsnew/3 2 poplib2303015
Ref: 144d2303015
Ref: poplib<4>-Footnote-12303492
Node: asyncore<2>2303556
Ref: whatsnew/3 2 asyncore2303729
Ref: 144e2303729
Ref: asyncore<2>-Footnote-12304184
Node: tempfile<5>2304248
Ref: whatsnew/3 2 tempfile2304423
Ref: 144f2304423
Ref: tempfile<5>-Footnote-12304889
Node: inspect<11>2304953
Ref: whatsnew/3 2 inspect2305125
Ref: 14512305125
Ref: inspect<11>-Footnote-12307004
Node: pydoc<7>2307069
Ref: whatsnew/3 2 pydoc2307236
Ref: 14532307236
Ref: pydoc<7>-Footnote-12307555
Node: dis<6>2307619
Ref: whatsnew/3 2 dis2307781
Ref: 14542307781
Ref: dis<6>-Footnote-12310156
Node: dbm<7>2310220
Ref: whatsnew/3 2 dbm2310383
Ref: 14562310383
Ref: dbm<7>-Footnote-12310572
Node: ctypes<4>2310636
Ref: whatsnew/3 2 ctypes2310800
Ref: 14572310800
Node: site<4>2310951
Ref: whatsnew/3 2 site2311121
Ref: 14592311121
Ref: site<4>-Footnote-12312528
Node: sysconfig<4>2312592
Ref: whatsnew/3 2 sysconfig2312760
Ref: 145d2312760
Node: pdb<10>2315219
Ref: whatsnew/3 2 pdb2315395
Ref: 14602315395
Node: configparser<6>2316562
Ref: whatsnew/3 2 configparser2316741
Ref: 14612316741
Node: urllib parse<6>2319917
Ref: whatsnew/3 2 urllib-parse2320096
Ref: 14622320096
Ref: urllib parse<6>-Footnote-12322384
Ref: urllib parse<6>-Footnote-22322443
Ref: urllib parse<6>-Footnote-32322486
Ref: urllib parse<6>-Footnote-42322550
Ref: urllib parse<6>-Footnote-52322614
Node: mailbox2322678
Ref: whatsnew/3 2 mailbox2322852
Ref: 14662322852
Ref: mailbox-Footnote-12324887
Node: turtledemo2324951
Ref: whatsnew/3 2 turtledemo2325101
Ref: 146d2325101
Ref: turtledemo-Footnote-12325538
Node: マルチスレッディング2325603
Ref: whatsnew/3 2 multi-threading2325812
Ref: 146e2325812
Ref: マルチスレッディング-Footnote-12327658
Ref: マルチスレッディング-Footnote-22327737
Ref: マルチスレッディング-Footnote-32327801
Ref: マルチスレッディング-Footnote-42327867
Node: 最適化<12>2327931
Ref: whatsnew/3 2 optimizations2328073
Ref: 14702328073
Ref: 最適化<12>-Footnote-12331595
Ref: 最適化<12>-Footnote-22331659
Ref: 最適化<12>-Footnote-32331723
Ref: 最適化<12>-Footnote-42331787
Ref: 最適化<12>-Footnote-52331833
Ref: 最適化<12>-Footnote-62331897
Ref: 最適化<12>-Footnote-72331961
Ref: 最適化<12>-Footnote-82332026
Ref: 最適化<12>-Footnote-92332090
Ref: 最適化<12>-Footnote-102332154
Ref: 最適化<12>-Footnote-112332219
Ref: 最適化<12>-Footnote-122332284
Ref: 最適化<12>-Footnote-132332349
Ref: 最適化<12>-Footnote-142332417
Ref: 最適化<12>-Footnote-152332482
Ref: 最適化<12>-Footnote-162332548
Node: Unicode 文字列型2332613
Ref: whatsnew/3 2 unicode2332731
Ref: 14752332731
Ref: Unicode 文字列型-Footnote-12333305
Ref: Unicode 文字列型-Footnote-22333356
Ref: Unicode 文字列型-Footnote-32333400
Node: Codecs2333472
Ref: whatsnew/3 2 codecs2333595
Ref: 14762333595
Ref: Codecs-Footnote-12334872
Node: ドキュメント2334939
Ref: whatsnew/3 2 documentation2335046
Ref: 14772335046
Ref: ドキュメント-Footnote-12337178
Ref: ドキュメント-Footnote-22337228
Ref: ドキュメント-Footnote-32337297
Ref: ドキュメント-Footnote-42337373
Ref: ドキュメント-Footnote-52337437
Node: IDLE2337501
Ref: whatsnew/3 2 idle2337626
Ref: 147b2337626
Ref: IDLE-Footnote-12338116
Ref: IDLE-Footnote-22338180
Node: コードリポジトリ2338244
Ref: whatsnew/3 2 code-repository2338391
Ref: 147c2338391
Ref: コードリポジトリ-Footnote-12339096
Ref: コードリポジトリ-Footnote-22339135
Ref: コードリポジトリ-Footnote-32339177
Ref: コードリポジトリ-Footnote-42339231
Node: ビルドならびに C API の変更<5>2339275
Ref: whatsnew/3 2 build-and-c-api-changes2339441
Ref: 147d2339441
Ref: ビルドならびに C API の変更<5>-Footnote-12344284
Ref: ビルドならびに C API の変更<5>-Footnote-22344349
Ref: ビルドならびに C API の変更<5>-Footnote-32344413
Ref: ビルドならびに C API の変更<5>-Footnote-42344477
Ref: ビルドならびに C API の変更<5>-Footnote-52344541
Ref: ビルドならびに C API の変更<5>-Footnote-62344605
Ref: ビルドならびに C API の変更<5>-Footnote-72344669
Ref: ビルドならびに C API の変更<5>-Footnote-82344733
Ref: ビルドならびに C API の変更<5>-Footnote-92344797
Ref: ビルドならびに C API の変更<5>-Footnote-102344861
Ref: ビルドならびに C API の変更<5>-Footnote-112344926
Ref: ビルドならびに C API の変更<5>-Footnote-122344991
Ref: ビルドならびに C API の変更<5>-Footnote-132345056
Ref: ビルドならびに C API の変更<5>-Footnote-142345121
Ref: ビルドならびに C API の変更<5>-Footnote-152345204
Node: Python 3 2 への移植2345305
Ref: whatsnew/3 2 porting-to-python-3-22345438
Ref: 14862345438
Ref: Python 3 2 への移植-Footnote-12353686
Ref: Python 3 2 への移植-Footnote-22353750
Ref: Python 3 2 への移植-Footnote-32353814
Ref: Python 3 2 への移植-Footnote-42353859
Ref: Python 3 2 への移植-Footnote-52353924
Ref: Python 3 2 への移植-Footnote-62353989
Ref: Python 3 2 への移植-Footnote-72354054
Node: What's New In Python 3 12354118
Ref: whatsnew/3 1 doc2354265
Ref: 14962354265
Ref: whatsnew/3 1 translation-repo2354265
Ref: 14972354265
Ref: whatsnew/3 1 what-s-new-in-python-3-12354265
Ref: 14982354265
Node: PEP 372 順序付き辞書2355061
Ref: whatsnew/3 1 pep-372-ordered-dictionaries2355205
Ref: 14992355205
Ref: PEP 372 順序付き辞書-Footnote-12358060
Ref: PEP 372 順序付き辞書-Footnote-22358088
Node: PEP 378 1000区切りのための書式指定子2358130
Ref: whatsnew/3 1 pep-378-format-specifier-for-thousands-separator2358311
Ref: 149a2358311
Ref: PEP 378 1000区切りのための書式指定子-Footnote-12359780
Node: その他の言語変更<13>2359822
Ref: whatsnew/3 1 other-language-changes2360067
Ref: 149b2360067
Ref: その他の言語変更<13>-Footnote-12365178
Ref: その他の言語変更<13>-Footnote-22365245
Ref: その他の言語変更<13>-Footnote-32365309
Ref: その他の言語変更<13>-Footnote-42365373
Ref: その他の言語変更<13>-Footnote-52365437
Ref: その他の言語変更<13>-Footnote-62365482
Ref: その他の言語変更<13>-Footnote-72365546
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>2365610
Ref: whatsnew/3 1 new-improved-and-deprecated-modules2365820
Ref: 149c2365820
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-12376137
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-22376204
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-32376268
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-42376310
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-52376374
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-62376438
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-72376502
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-82376544
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-92376608
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-102376672
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-112376737
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-122376802
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-132376867
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-142376932
Node: 最適化<13>2376997
Ref: whatsnew/3 1 optimizations2377186
Ref: 14ac2377186
Ref: 最適化<13>-Footnote-12379357
Ref: 最適化<13>-Footnote-22379399
Ref: 最適化<13>-Footnote-32379463
Ref: 最適化<13>-Footnote-42379527
Ref: 最適化<13>-Footnote-52379591
Ref: 最適化<13>-Footnote-62379617
Ref: 最適化<13>-Footnote-72379681
Node: IDLE<2>2379745
Ref: whatsnew/3 1 idle2379884
Ref: 14ad2379884
Ref: IDLE<2>-Footnote-12380168
Node: ビルドならびに C API の変更<6>2380232
Ref: whatsnew/3 1 build-and-c-api-changes2380381
Ref: 14ae2380381
Ref: ビルドならびに C API の変更<6>-Footnote-12383140
Ref: ビルドならびに C API の変更<6>-Footnote-22383204
Ref: ビルドならびに C API の変更<6>-Footnote-32383268
Ref: ビルドならびに C API の変更<6>-Footnote-42383332
Ref: ビルドならびに C API の変更<6>-Footnote-52383396
Node: Python 3 1 への移植2383460
Ref: whatsnew/3 1 porting-to-python-3-12383593
Ref: 14b22383593
Node: What's New In Python 3 02384892
Ref: whatsnew/3 0 doc2385039
Ref: 14b32385039
Ref: whatsnew/3 0 translation-repo2385039
Ref: 14b42385039
Ref: whatsnew/3 0 what-s-new-in-python-3-02385039
Ref: 14b52385039
Node: よくある悩みの種2387185
Ref: whatsnew/3 0 common-stumbling-blocks2387303
Ref: 14b62387303
Node: print関数2387663
Ref: whatsnew/3 0 print-is-a-function2387795
Ref: 14b72387795
Ref: print関数-Footnote-12389615
Node: リストからビューおよびイテレータへ2389657
Ref: whatsnew/3 0 views-and-iterators-instead-of-lists2389810
Ref: 14b82389810
Node: 順序比較2392116
Ref: whatsnew/3 0 ordering-comparisons2392264
Ref: 14bb2392264
Node: 整数2393904
Ref: whatsnew/3 0 integers2394069
Ref: 14bd2394069
Ref: 整数-Footnote-12395388
Ref: 整数-Footnote-22395430
Node: Unicode 対 8 ビット、ではなく、テキスト対データに2395472
Ref: whatsnew/3 0 text-vs-data-instead-of-unicode-vs-8-bit2395616
Ref: 14be2395616
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-12404537
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-22404579
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-32404621
Node: 構文の変更の概要2404663
Ref: whatsnew/3 0 overview-of-syntax-changes2404825
Ref: 14c12404825
Node: 新たな構文2405082
Ref: whatsnew/3 0 new-syntax2405188
Ref: 14c22405188
Ref: 新たな構文-Footnote-12408818
Ref: 新たな構文-Footnote-22408860
Ref: 新たな構文-Footnote-32408902
Ref: 新たな構文-Footnote-42408944
Ref: 新たな構文-Footnote-52408986
Node: 変更された構文2409028
Ref: whatsnew/3 0 changed-syntax2409164
Ref: 14c52409164
Ref: 変更された構文-Footnote-12411171
Ref: 変更された構文-Footnote-22411213
Ref: 変更された構文-Footnote-32411255
Ref: 変更された構文-Footnote-42411297
Node: 削除された操作2411339
Ref: whatsnew/3 0 removed-syntax2411451
Ref: 14c62411451
Ref: 削除された操作-Footnote-12413170
Ref: 削除された操作-Footnote-22413212
Node: Python 2 6 で既にあった変更2413254
Ref: whatsnew/3 0 changes-already-present-in-python-2-62413416
Ref: 14c82413416
Node: ライブラリの変更2418287
Ref: whatsnew/3 0 library-changes2418476
Ref: 14db2418476
Ref: ライブラリの変更-Footnote-12425109
Ref: ライブラリの変更-Footnote-22425151
Ref: ライブラリの変更-Footnote-32425193
Ref: ライブラリの変更-Footnote-42425235
Ref: ライブラリの変更-Footnote-52425277
Ref: ライブラリの変更-Footnote-62425319
Node: PEP 3101 文字列整形の新たなアプローチ2425361
Ref: whatsnew/3 0 pep-3101-a-new-approach-to-string-formatting2425539
Ref: 14e02425539
Ref: PEP 3101 文字列整形の新たなアプローチ-Footnote-12426111
Node: 例外に関する変更2426153
Ref: whatsnew/3 0 changes-to-exceptions2426328
Ref: 14e12426328
Ref: 例外に関する変更-Footnote-12430151
Ref: 例外に関する変更-Footnote-22430193
Ref: 例外に関する変更-Footnote-32430235
Ref: 例外に関する変更-Footnote-42430277
Ref: 例外に関する変更-Footnote-52430319
Node: その他の変更<2>2430361
Ref: whatsnew/3 0 miscellaneous-other-changes2430525
Ref: 14e52430525
Node: 演算子と特殊メソッド2430634
Ref: whatsnew/3 0 operators-and-special-methods2430743
Ref: 14e62430743
Ref: 演算子と特殊メソッド-Footnote-12432518
Node: 組み込み2432560
Ref: whatsnew/3 0 builtins2432669
Ref: 14f22432669
Ref: 組み込み-Footnote-12435478
Ref: 組み込み-Footnote-22435520
Ref: 組み込み-Footnote-32435562
Node: ビルドならびに C API の変更<7>2435622
Ref: whatsnew/3 0 build-and-c-api-changes2435768
Ref: 14f82435768
Ref: ビルドならびに C API の変更<7>-Footnote-12436946
Ref: ビルドならびに C API の変更<7>-Footnote-22436988
Ref: ビルドならびに C API の変更<7>-Footnote-32437030
Node: 性能2437072
Ref: whatsnew/3 0 performance2437220
Ref: 14fa2437220
Node: Python 3 0 への移植2437656
Ref: whatsnew/3 0 porting-to-python-3-02437755
Ref: 14fb2437755
Node: What's New in Python 2 72440433
Ref: whatsnew/2 7 doc2440580
Ref: 14fd2440580
Ref: whatsnew/2 7 translation-repo2440580
Ref: 14fe2440580
Ref: whatsnew/2 7 what-s-new-in-python-2-72440580
Ref: 14ff2440580
Node: Python 2 x の今後2443488
Ref: whatsnew/2 7 the-future-for-python-2-x2443617
Ref: 15002443617
Ref: whatsnew/2 7 whatsnew27-python312443617
Ref: 15012443617
Ref: Python 2 x の今後-Footnote-12447893
Ref: Python 2 x の今後-Footnote-22447935
Node: Deprecation Warnings の扱いの変更2447972
Ref: whatsnew/2 7 changes-to-the-handling-of-deprecation-warnings2448130
Ref: 15032448130
Ref: Deprecation Warnings の扱いの変更-Footnote-12449932
Node: Python 3 1 の機能2449996
Ref: whatsnew/2 7 python-3-1-features2450184
Ref: 15042450184
Node: PEP 372 collections に順序付き辞書を追加2452498
Ref: whatsnew/2 7 pep-03722452698
Ref: 15052452698
Ref: whatsnew/2 7 pep-372-adding-an-ordered-dictionary-to-collections2452698
Ref: 15082452698
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-12456519
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-22456547
Node: PEP 378 1000区切りのための書式指定子<2>2456589
Ref: whatsnew/2 7 pep-03782456841
Ref: 15062456841
Ref: whatsnew/2 7 pep-378-format-specifier-for-thousands-separator2456841
Ref: 150a2456841
Ref: PEP 378 1000区切りのための書式指定子<2>-Footnote-12458561
Node: PEP 389 コマンドライン解析のための argparse モジュール2458603
Ref: whatsnew/2 7 pep-389-the-argparse-module-for-parsing-command-lines2458851
Ref: 150b2458851
Ref: PEP 389 コマンドライン解析のための argparse モジュール-Footnote-12463232
Node: PEP 391 logging の辞書ベースの設定<2>2463274
Ref: whatsnew/2 7 pep-391-dictionary-based-configuration-for-logging2463491
Ref: 150c2463491
Ref: PEP 391 logging の辞書ベースの設定<2>-Footnote-12467682
Node: PEP 3106 辞書 View2467724
Ref: whatsnew/2 7 pep-3106-dictionary-views2467907
Ref: 15132467907
Ref: PEP 3106 辞書 View-Footnote-12470159
Ref: PEP 3106 辞書 View-Footnote-22470201
Node: PEP 3137 memoryview オブジェクト2470265
Ref: whatsnew/2 7 pep-3137-the-memoryview-object2470430
Ref: 15142470430
Ref: PEP 3137 memoryview オブジェクト-Footnote-12472244
Ref: PEP 3137 memoryview オブジェクト-Footnote-22472286
Node: その他の言語変更<14>2472350
Ref: whatsnew/2 7 other-language-changes2472552
Ref: 15152472552
Ref: その他の言語変更<14>-Footnote-12483872
Ref: その他の言語変更<14>-Footnote-22483936
Ref: その他の言語変更<14>-Footnote-32484000
Ref: その他の言語変更<14>-Footnote-42484064
Ref: その他の言語変更<14>-Footnote-52484128
Ref: その他の言語変更<14>-Footnote-62484192
Ref: その他の言語変更<14>-Footnote-72484256
Ref: その他の言語変更<14>-Footnote-82484320
Ref: その他の言語変更<14>-Footnote-92484384
Ref: その他の言語変更<14>-Footnote-102484448
Ref: その他の言語変更<14>-Footnote-112484513
Ref: その他の言語変更<14>-Footnote-122484578
Ref: その他の言語変更<14>-Footnote-132484643
Ref: その他の言語変更<14>-Footnote-142484708
Ref: その他の言語変更<14>-Footnote-152484776
Ref: その他の言語変更<14>-Footnote-162484841
Ref: その他の言語変更<14>-Footnote-172484906
Ref: その他の言語変更<14>-Footnote-182484971
Ref: その他の言語変更<14>-Footnote-192485039
Ref: その他の言語変更<14>-Footnote-202485104
Ref: その他の言語変更<14>-Footnote-212485169
Ref: その他の言語変更<14>-Footnote-222485234
Ref: その他の言語変更<14>-Footnote-232485299
Ref: その他の言語変更<14>-Footnote-242485364
Node: インタプリタの変更2485429
Ref: whatsnew/2 7 interpreter-changes2485543
Ref: 15192485543
Ref: whatsnew/2 7 new-27-interpreter2485543
Ref: 151a2485543
Ref: インタプリタの変更-Footnote-12486250
Node: 最適化<14>2486314
Ref: whatsnew/2 7 optimizations2486428
Ref: 151b2486428
Ref: 最適化<14>-Footnote-12491772
Ref: 最適化<14>-Footnote-22491836
Ref: 最適化<14>-Footnote-32491900
Ref: 最適化<14>-Footnote-42491964
Ref: 最適化<14>-Footnote-52492028
Ref: 最適化<14>-Footnote-62492092
Ref: 最適化<14>-Footnote-72492159
Ref: 最適化<14>-Footnote-82492223
Ref: 最適化<14>-Footnote-92492287
Ref: 最適化<14>-Footnote-102492351
Ref: 最適化<14>-Footnote-112492416
Ref: 最適化<14>-Footnote-122492481
Ref: 最適化<14>-Footnote-132492546
Node: 新しいモジュールと改良されたモジュール2492611
Ref: whatsnew/2 7 new-and-improved-modules2492815
Ref: 151d2492815
Ref: 新しいモジュールと改良されたモジュール-Footnote-12533253
Ref: 新しいモジュールと改良されたモジュール-Footnote-22533317
Ref: 新しいモジュールと改良されたモジュール-Footnote-32533381
Ref: 新しいモジュールと改良されたモジュール-Footnote-42533434
Ref: 新しいモジュールと改良されたモジュール-Footnote-52533498
Ref: 新しいモジュールと改良されたモジュール-Footnote-62533562
Ref: 新しいモジュールと改良されたモジュール-Footnote-72533629
Ref: 新しいモジュールと改良されたモジュール-Footnote-82533693
Ref: 新しいモジュールと改良されたモジュール-Footnote-92533757
Ref: 新しいモジュールと改良されたモジュール-Footnote-102533821
Ref: 新しいモジュールと改良されたモジュール-Footnote-112533886
Ref: 新しいモジュールと改良されたモジュール-Footnote-122533951
Ref: 新しいモジュールと改良されたモジュール-Footnote-132534016
Ref: 新しいモジュールと改良されたモジュール-Footnote-142534056
Ref: 新しいモジュールと改良されたモジュール-Footnote-152534121
Ref: 新しいモジュールと改良されたモジュール-Footnote-162534186
Ref: 新しいモジュールと改良されたモジュール-Footnote-172534251
Ref: 新しいモジュールと改良されたモジュール-Footnote-182534316
Ref: 新しいモジュールと改良されたモジュール-Footnote-192534381
Ref: 新しいモジュールと改良されたモジュール-Footnote-202534446
Ref: 新しいモジュールと改良されたモジュール-Footnote-212534511
Ref: 新しいモジュールと改良されたモジュール-Footnote-222534576
Ref: 新しいモジュールと改良されたモジュール-Footnote-232534641
Ref: 新しいモジュールと改良されたモジュール-Footnote-242534706
Ref: 新しいモジュールと改良されたモジュール-Footnote-252534771
Ref: 新しいモジュールと改良されたモジュール-Footnote-262534836
Ref: 新しいモジュールと改良されたモジュール-Footnote-272534904
Ref: 新しいモジュールと改良されたモジュール-Footnote-282534969
Ref: 新しいモジュールと改良されたモジュール-Footnote-292535034
Ref: 新しいモジュールと改良されたモジュール-Footnote-302535099
Ref: 新しいモジュールと改良されたモジュール-Footnote-312535164
Ref: 新しいモジュールと改良されたモジュール-Footnote-322535229
Ref: 新しいモジュールと改良されたモジュール-Footnote-332535294
Ref: 新しいモジュールと改良されたモジュール-Footnote-342535359
Ref: 新しいモジュールと改良されたモジュール-Footnote-352535424
Ref: 新しいモジュールと改良されたモジュール-Footnote-362535489
Ref: 新しいモジュールと改良されたモジュール-Footnote-372535554
Ref: 新しいモジュールと改良されたモジュール-Footnote-382535619
Ref: 新しいモジュールと改良されたモジュール-Footnote-392535684
Ref: 新しいモジュールと改良されたモジュール-Footnote-402535749
Ref: 新しいモジュールと改良されたモジュール-Footnote-412535814
Ref: 新しいモジュールと改良されたモジュール-Footnote-422535879
Ref: 新しいモジュールと改良されたモジュール-Footnote-432535944
Ref: 新しいモジュールと改良されたモジュール-Footnote-442536009
Ref: 新しいモジュールと改良されたモジュール-Footnote-452536074
Ref: 新しいモジュールと改良されたモジュール-Footnote-462536139
Ref: 新しいモジュールと改良されたモジュール-Footnote-472536204
Ref: 新しいモジュールと改良されたモジュール-Footnote-482536269
Ref: 新しいモジュールと改良されたモジュール-Footnote-492536337
Ref: 新しいモジュールと改良されたモジュール-Footnote-502536402
Ref: 新しいモジュールと改良されたモジュール-Footnote-512536467
Ref: 新しいモジュールと改良されたモジュール-Footnote-522536532
Ref: 新しいモジュールと改良されたモジュール-Footnote-532536597
Ref: 新しいモジュールと改良されたモジュール-Footnote-542536662
Ref: 新しいモジュールと改良されたモジュール-Footnote-552536727
Ref: 新しいモジュールと改良されたモジュール-Footnote-562536792
Ref: 新しいモジュールと改良されたモジュール-Footnote-572536857
Ref: 新しいモジュールと改良されたモジュール-Footnote-582536922
Ref: 新しいモジュールと改良されたモジュール-Footnote-592536987
Ref: 新しいモジュールと改良されたモジュール-Footnote-602537052
Ref: 新しいモジュールと改良されたモジュール-Footnote-612537117
Ref: 新しいモジュールと改良されたモジュール-Footnote-622537182
Ref: 新しいモジュールと改良されたモジュール-Footnote-632537247
Ref: 新しいモジュールと改良されたモジュール-Footnote-642537312
Ref: 新しいモジュールと改良されたモジュール-Footnote-652537377
Ref: 新しいモジュールと改良されたモジュール-Footnote-662537442
Ref: 新しいモジュールと改良されたモジュール-Footnote-672537507
Ref: 新しいモジュールと改良されたモジュール-Footnote-682537572
Ref: 新しいモジュールと改良されたモジュール-Footnote-692537637
Ref: 新しいモジュールと改良されたモジュール-Footnote-702537683
Ref: 新しいモジュールと改良されたモジュール-Footnote-712537748
Ref: 新しいモジュールと改良されたモジュール-Footnote-722537813
Ref: 新しいモジュールと改良されたモジュール-Footnote-732537867
Ref: 新しいモジュールと改良されたモジュール-Footnote-742537932
Ref: 新しいモジュールと改良されたモジュール-Footnote-752537997
Ref: 新しいモジュールと改良されたモジュール-Footnote-762538062
Ref: 新しいモジュールと改良されたモジュール-Footnote-772538127
Ref: 新しいモジュールと改良されたモジュール-Footnote-782538192
Ref: 新しいモジュールと改良されたモジュール-Footnote-792538260
Ref: 新しいモジュールと改良されたモジュール-Footnote-802538325
Ref: 新しいモジュールと改良されたモジュール-Footnote-812538390
Ref: 新しいモジュールと改良されたモジュール-Footnote-822538455
Ref: 新しいモジュールと改良されたモジュール-Footnote-832538520
Ref: 新しいモジュールと改良されたモジュール-Footnote-842538585
Ref: 新しいモジュールと改良されたモジュール-Footnote-852538650
Ref: 新しいモジュールと改良されたモジュール-Footnote-862538718
Ref: 新しいモジュールと改良されたモジュール-Footnote-872538786
Ref: 新しいモジュールと改良されたモジュール-Footnote-882538851
Ref: 新しいモジュールと改良されたモジュール-Footnote-892538911
Ref: 新しいモジュールと改良されたモジュール-Footnote-902538971
Ref: 新しいモジュールと改良されたモジュール-Footnote-912539036
Ref: 新しいモジュールと改良されたモジュール-Footnote-922539101
Ref: 新しいモジュールと改良されたモジュール-Footnote-932539166
Ref: 新しいモジュールと改良されたモジュール-Footnote-942539231
Ref: 新しいモジュールと改良されたモジュール-Footnote-952539296
Ref: 新しいモジュールと改良されたモジュール-Footnote-962539361
Ref: 新しいモジュールと改良されたモジュール-Footnote-972539426
Node: 新しいモジュール importlib2539491
Ref: whatsnew/2 7 importlib-section2539662
Ref: 15072539662
Ref: whatsnew/2 7 new-module-importlib2539662
Ref: 15472539662
Node: 新しいモジュール sysconfig2541375
Ref: whatsnew/2 7 new-module-sysconfig2541598
Ref: 15482541598
Node: ttk Tk のテーマ付きウィジェット2543300
Ref: whatsnew/2 7 ttk-themed-widgets-for-tk2543528
Ref: 154a2543528
Ref: ttk Tk のテーマ付きウィジェット-Footnote-12544775
Ref: ttk Tk のテーマ付きウィジェット-Footnote-22544839
Node: 更新されたモジュール unittest2544903
Ref: whatsnew/2 7 unittest-section2545143
Ref: 154b2545143
Ref: whatsnew/2 7 updated-module-unittest2545143
Ref: 154c2545143
Ref: 更新されたモジュール unittest-Footnote-12555812
Ref: 更新されたモジュール unittest-Footnote-22555856
Ref: 更新されたモジュール unittest-Footnote-32555883
Ref: 更新されたモジュール unittest-Footnote-42555920
Ref: 更新されたモジュール unittest-Footnote-52555984
Ref: 更新されたモジュール unittest-Footnote-62556048
Ref: 更新されたモジュール unittest-Footnote-72556115
Ref: 更新されたモジュール unittest-Footnote-82556179
Ref: 更新されたモジュール unittest-Footnote-92556243
Ref: 更新されたモジュール unittest-Footnote-102556307
Ref: 更新されたモジュール unittest-Footnote-112556372
Ref: 更新されたモジュール unittest-Footnote-122556437
Ref: 更新されたモジュール unittest-Footnote-132556502
Ref: 更新されたモジュール unittest-Footnote-142556567
Ref: 更新されたモジュール unittest-Footnote-152556632
Node: 更新されたモジュール ElementTree 1 32556697
Ref: whatsnew/2 7 elementtree-section2556885
Ref: 15672556885
Ref: whatsnew/2 7 updated-module-elementtree-1-32556885
Ref: 15682556885
Ref: 更新されたモジュール ElementTree 1 3-Footnote-12561167
Node: ビルドならびに C API の変更<8>2561231
Ref: whatsnew/2 7 build-and-c-api-changes2561434
Ref: 156b2561434
Ref: ビルドならびに C API の変更<8>-Footnote-12571025
Ref: ビルドならびに C API の変更<8>-Footnote-22571138
Ref: ビルドならびに C API の変更<8>-Footnote-32571202
Ref: ビルドならびに C API の変更<8>-Footnote-42571266
Ref: ビルドならびに C API の変更<8>-Footnote-52571330
Ref: ビルドならびに C API の変更<8>-Footnote-62571394
Ref: ビルドならびに C API の変更<8>-Footnote-72571458
Ref: ビルドならびに C API の変更<8>-Footnote-82571522
Ref: ビルドならびに C API の変更<8>-Footnote-92571577
Ref: ビルドならびに C API の変更<8>-Footnote-102571641
Ref: ビルドならびに C API の変更<8>-Footnote-112571706
Ref: ビルドならびに C API の変更<8>-Footnote-122571771
Ref: ビルドならびに C API の変更<8>-Footnote-132571836
Ref: ビルドならびに C API の変更<8>-Footnote-142571904
Ref: ビルドならびに C API の変更<8>-Footnote-152571972
Ref: ビルドならびに C API の変更<8>-Footnote-162572037
Ref: ビルドならびに C API の変更<8>-Footnote-172572102
Ref: ビルドならびに C API の変更<8>-Footnote-182572167
Ref: ビルドならびに C API の変更<8>-Footnote-192572232
Ref: ビルドならびに C API の変更<8>-Footnote-202572297
Ref: ビルドならびに C API の変更<8>-Footnote-212572365
Ref: ビルドならびに C API の変更<8>-Footnote-222572430
Node: カプセル2572495
Ref: whatsnew/2 7 capsules2572625
Ref: 15762572625
Ref: whatsnew/2 7 whatsnew27-capsules2572625
Ref: 15772572625
Ref: カプセル-Footnote-12574881
Node: ポート特有の変更 Windows2574945
Ref: whatsnew/2 7 port-specific-changes-windows2575117
Ref: 157a2575117
Ref: ポート特有の変更 Windows-Footnote-12576947
Ref: ポート特有の変更 Windows-Footnote-22577011
Ref: ポート特有の変更 Windows-Footnote-32577075
Ref: ポート特有の変更 Windows-Footnote-42577139
Ref: ポート特有の変更 Windows-Footnote-52577206
Ref: ポート特有の変更 Windows-Footnote-62577270
Node: ポート特有の変更 Mac OS X2577334
Ref: whatsnew/2 7 port-specific-changes-mac-os-x2577526
Ref: 15862577526
Ref: ポート特有の変更 Mac OS X-Footnote-12578588
Ref: ポート特有の変更 Mac OS X-Footnote-22578652
Node: ポート特有の変更 FreeBSD2578717
Ref: whatsnew/2 7 port-specific-changes-freebsd2578868
Ref: 15872578868
Ref: ポート特有の変更 FreeBSD-Footnote-12579269
Node: その他の変更と修正2579333
Ref: whatsnew/2 7 other-changes-and-fixes2579502
Ref: 15882579502
Ref: その他の変更と修正-Footnote-12582157
Ref: その他の変更と修正-Footnote-22582221
Ref: その他の変更と修正-Footnote-32582288
Ref: その他の変更と修正-Footnote-42582352
Ref: その他の変更と修正-Footnote-52582416
Node: Python 2 7 への移植2582480
Ref: whatsnew/2 7 porting-to-python-2-72582677
Ref: 158a2582677
Ref: Python 2 7 への移植-Footnote-12588745
Ref: Python 2 7 への移植-Footnote-22588809
Ref: Python 2 7 への移植-Footnote-32588873
Ref: Python 2 7 への移植-Footnote-42588937
Ref: Python 2 7 への移植-Footnote-52589001
Ref: Python 2 7 への移植-Footnote-62589065
Ref: Python 2 7 への移植-Footnote-72589129
Ref: Python 2 7 への移植-Footnote-82589193
Ref: Python 2 7 への移植-Footnote-92589257
Ref: Python 2 7 への移植-Footnote-102589321
Ref: Python 2 7 への移植-Footnote-112589386
Ref: Python 2 7 への移植-Footnote-122589451
Ref: Python 2 7 への移植-Footnote-132589516
Ref: Python 2 7 への移植-Footnote-142589576
Node: Python 2 7 メンテナンスリリースで追加された新機能2589641
Ref: whatsnew/2 7 new-features-added-to-python-2-7-maintenance-releases2589817
Ref: 158b2589817
Ref: whatsnew/2 7 py27-maintenance-enhancements2589817
Ref: 15022589817
Node: デバッグモード用の2つの新しい環境変数2591665
Ref: whatsnew/2 7 two-new-environment-variables-for-debug-mode2591919
Ref: 158c2591919
Ref: デバッグモード用の2つの新しい環境変数-Footnote-12592604
Ref: デバッグモード用の2つの新しい環境変数-Footnote-22592669
Node: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い2592734
Ref: whatsnew/2 7 pep-434-idle-enhancement-exception-for-all-branches2593070
Ref: 158d2593070
Ref: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い-Footnote-12593765
Node: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張2593807
Ref: whatsnew/2 7 pep-466-network-security-enhancements-for-python-2-72594150
Ref: 158e2594150
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-12596984
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-22597026
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-32597068
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-42597133
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-52597198
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-62597240
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-72597305
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-82597370
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-92597425
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-102597467
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-112597533
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-122597599
Node: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート2597665
Ref: whatsnew/2 7 pep-477-backport-ensurepip-pep-453-to-python-2-72598027
Ref: 15912598027
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-12598682
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-22598724
Node: デフォルトでの pip のブートストラッピング<2>2598766
Ref: whatsnew/2 7 bootstrapping-pip-by-default2598966
Ref: 15922598966
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-12601045
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-22601087
Node: ドキュメントの変更<2>2601177
Ref: whatsnew/2 7 documentation-changes2601377
Ref: 15932601377
Ref: ドキュメントの変更<2>-Footnote-12602533
Ref: ドキュメントの変更<2>-Footnote-22602570
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>2602612
Ref: whatsnew/2 7 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2602958
Ref: 15942602958
Ref: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>-Footnote-12604110
Node: PEP 493 HTTPS verification migration tools for Python 2 72604152
Ref: whatsnew/2 7 pep-493-https-verification-migration-tools-for-python-2-72604470
Ref: 15952604470
Ref: PEP 493 HTTPS verification migration tools for Python 2 7-Footnote-12605628
Node: New make regen-all build target<3>2605670
Ref: whatsnew/2 7 new-make-regen-all-build-target2605921
Ref: 15962605921
Ref: New make regen-all build target<3>-Footnote-12606713
Ref: New make regen-all build target<3>-Footnote-22606781
Node: Removal of make touch build target<3>2606846
Ref: whatsnew/2 7 removal-of-make-touch-build-target2607031
Ref: 15972607031
Ref: Removal of make touch build target<3>-Footnote-12607473
Node: 謝辞2607538
Ref: whatsnew/2 7 acknowledgements2607682
Ref: 15982607682
Ref: whatsnew/2 7 acks272607682
Ref: 15992607682
Node: What's New in Python 2 62607974
Ref: whatsnew/2 6 doc2608121
Ref: 159a2608121
Ref: whatsnew/2 6 translation-repo2608121
Ref: 159b2608121
Ref: whatsnew/2 6 what-s-new-in-python-2-62608121
Ref: 159c2608121
Ref: whatsnew/2 6 whats-new-in-2-62608121
Ref: 14c92608121
Ref: What's New in Python 2 6-Footnote-12611648
Node: Python 3 02611690
Ref: whatsnew/2 6 python-3-02611806
Ref: 159d2611806
Ref: Python 3 0-Footnote-12614177
Ref: Python 3 0-Footnote-22614219
Node: 開発プロセスに関する変更2614261
Ref: whatsnew/2 6 changes-to-the-development-process2614422
Ref: 159e2614422
Node: 新しい課題トラッカー Roundup2615116
Ref: whatsnew/2 6 new-issue-tracker-roundup2615333
Ref: 159f2615333
Ref: 新しい課題トラッカー Roundup-Footnote-12617767
Ref: 新しい課題トラッカー Roundup-Footnote-22617816
Ref: 新しい課題トラッカー Roundup-Footnote-32617847
Ref: 新しい課題トラッカー Roundup-Footnote-42617887
Ref: 新しい課題トラッカー Roundup-Footnote-52617922
Node: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText2617960
Ref: whatsnew/2 6 new-documentation-format-restructuredtext-using-sphinx2618177
Ref: 15a02618177
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-12621348
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-22621407
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-32621456
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-42621492
Node: PEP 343 "with" ステートメント2621532
Ref: whatsnew/2 6 pep-03432621754
Ref: 14ca2621754
Ref: whatsnew/2 6 pep-343-the-with-statement2621754
Ref: 15a12621754
Node: コンテキストマネージャを書く2625480
Ref: whatsnew/2 6 new-26-context-managers2625630
Ref: 14cb2625630
Ref: whatsnew/2 6 writing-context-managers2625630
Ref: 15a32625630
Node: contextlib モジュール2630861
Ref: whatsnew/2 6 new-module-contextlib2631011
Ref: 14cc2631011
Ref: whatsnew/2 6 the-contextlib-module2631011
Ref: 15a42631011
Ref: contextlib モジュール-Footnote-12633876
Node: PEP 366 メインモジュールからの明示的相対インポート2633918
Ref: whatsnew/2 6 pep-03662634163
Ref: 14cd2634163
Ref: whatsnew/2 6 pep-366-explicit-relative-imports-from-a-main-module2634163
Ref: 15a62634163
Node: PEP 370 ユーザごとの site-packages ディレクトリ2635012
Ref: whatsnew/2 6 pep-03702635260
Ref: 14ce2635260
Ref: whatsnew/2 6 pep-370-per-user-site-packages-directory2635260
Ref: 15a82635260
Ref: PEP 370 ユーザごとの site-packages ディレクトリ-Footnote-12636906
Node: PEP 371 multiprocessing パッケージ2636948
Ref: whatsnew/2 6 pep-03712637179
Ref: 14cf2637179
Ref: whatsnew/2 6 pep-371-the-multiprocessing-package2637179
Ref: 15ac2637179
Ref: PEP 371 multiprocessing パッケージ-Footnote-12642625
Node: PEP 3101 進化版文字列フォーマッティング2642667
Ref: whatsnew/2 6 pep-31012642872
Ref: 14d02642872
Ref: whatsnew/2 6 pep-3101-advanced-string-formatting2642872
Ref: 15b62642872
Ref: PEP 3101 進化版文字列フォーマッティング-Footnote-12648975
Node: PEP 3105 print を関数にする2649017
Ref: whatsnew/2 6 pep-31052649213
Ref: 14d12649213
Ref: whatsnew/2 6 pep-3105-print-as-a-function2649213
Ref: 15b82649213
Ref: PEP 3105 print を関数にする-Footnote-12650497
Node: PEP 3110 例外処理の変更2650539
Ref: whatsnew/2 6 pep-31102650711
Ref: 14d22650711
Ref: whatsnew/2 6 pep-3110-exception-handling-changes2650711
Ref: 15b92650711
Ref: PEP 3110 例外処理の変更-Footnote-12652564
Node: PEP 3112 バイトリテラル2652606
Ref: whatsnew/2 6 pep-31122652783
Ref: 14d32652783
Ref: whatsnew/2 6 pep-3112-byte-literals2652783
Ref: 15ba2652783
Ref: PEP 3112 バイトリテラル-Footnote-12656357
Node: PEP 3116 新しい I/O ライブラリ2656399
Ref: whatsnew/2 6 pep-31162656591
Ref: 14d42656591
Ref: whatsnew/2 6 pep-3116-new-i-o-library2656591
Ref: 15c82656591
Ref: PEP 3116 新しい I/O ライブラリ-Footnote-12660664
Node: PEP 3118 改訂版バッファプロトコル2660706
Ref: whatsnew/2 6 pep-31182660898
Ref: 14d52660898
Ref: whatsnew/2 6 pep-3118-revised-buffer-protocol2660898
Ref: 15d22660898
Ref: PEP 3118 改訂版バッファプロトコル-Footnote-12663449
Node: PEP 3119 抽象基底クラス2663491
Ref: whatsnew/2 6 pep-31192663696
Ref: 14d62663696
Ref: whatsnew/2 6 pep-3119-abstract-base-classes2663696
Ref: 15d62663696
Ref: PEP 3119 抽象基底クラス-Footnote-12669521
Node: PEP 3127 整数リテラルのサポートと文法2669563
Ref: whatsnew/2 6 pep-31272669756
Ref: 14d72669756
Ref: whatsnew/2 6 pep-3127-integer-literal-support-and-syntax2669756
Ref: 15d82669756
Ref: PEP 3127 整数リテラルのサポートと文法-Footnote-12671360
Node: PEP 3129 クラスデコレータ2671402
Ref: whatsnew/2 6 pep-31292671592
Ref: 14d82671592
Ref: whatsnew/2 6 pep-3129-class-decorators2671592
Ref: 15d92671592
Ref: PEP 3129 クラスデコレータ-Footnote-12672066
Node: PEP 3141 数値の型階層2672108
Ref: whatsnew/2 6 pep-31412672275
Ref: 14d92672275
Ref: whatsnew/2 6 pep-3141-a-type-hierarchy-for-numbers2672275
Ref: 15da2672275
Ref: PEP 3141 数値の型階層-Footnote-12674813
Ref: PEP 3141 数値の型階層-Footnote-22674855
Ref: PEP 3141 数値の型階層-Footnote-32674953
Node: fractions モジュール2675059
Ref: whatsnew/2 6 the-fractions-module2675148
Ref: 15de2675148
Node: その他の言語変更<15>2676895
Ref: whatsnew/2 6 other-language-changes2677089
Ref: 15df2677089
Ref: その他の言語変更<15>-Footnote-12687309
Ref: その他の言語変更<15>-Footnote-22687376
Ref: その他の言語変更<15>-Footnote-32687440
Ref: その他の言語変更<15>-Footnote-42687507
Ref: その他の言語変更<15>-Footnote-52687571
Ref: その他の言語変更<15>-Footnote-62687635
Ref: その他の言語変更<15>-Footnote-72687699
Ref: その他の言語変更<15>-Footnote-82687763
Ref: その他の言語変更<15>-Footnote-92687827
Ref: その他の言語変更<15>-Footnote-102687891
Ref: その他の言語変更<15>-Footnote-112687956
Ref: その他の言語変更<15>-Footnote-122688021
Ref: その他の言語変更<15>-Footnote-132688089
Ref: その他の言語変更<15>-Footnote-142688157
Ref: その他の言語変更<15>-Footnote-152688225
Ref: その他の言語変更<15>-Footnote-162688293
Node: 最適化<15>2688361
Ref: whatsnew/2 6 optimizations2688478
Ref: 15e72688478
Ref: 最適化<15>-Footnote-12692328
Ref: 最適化<15>-Footnote-22692395
Ref: 最適化<15>-Footnote-32692462
Ref: 最適化<15>-Footnote-42692526
Node: インタプリタの変更<2>2692590
Ref: whatsnew/2 6 interpreter-changes2692707
Ref: 15e92692707
Ref: whatsnew/2 6 new-26-interpreter2692707
Ref: 15ea2692707
Node: 新しいモジュールと改良されたモジュール<2>2694529
Ref: whatsnew/2 6 new-and-improved-modules2694714
Ref: 15ed2694714
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-12748333
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-22748400
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-32748453
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-42748517
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-52748583
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-62748647
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-72748714
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-82748778
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-92748832
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-102748899
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-112748967
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-122749035
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-132749100
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-142749165
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-152749232
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-162749297
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-172749365
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-182749430
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-192749498
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-202749566
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-212749634
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-222749701
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-232749769
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-242749837
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-252749902
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-262749967
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-272750035
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-282750103
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-292750170
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-302750235
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-312750300
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-322750365
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-332750430
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-342750495
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-352750560
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-362750625
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-372750685
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-382750752
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-392750812
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-402750879
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-412750944
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-422751011
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-432751079
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-442751144
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-452751209
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-462751274
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-472751342
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-482751407
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-492751472
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-502751540
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-512751605
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-522751673
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-532751738
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-542751806
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-552751871
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-562751939
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-572752004
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-582752072
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-592752140
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-602752205
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-612752270
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-622752337
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-632752405
Node: ast モジュール2752473
Ref: whatsnew/2 6 the-ast-module2752624
Ref: 16022752624
Node: The future_builtins module2755610
Ref: whatsnew/2 6 the-future-builtins-module2755826
Ref: 16032755826
Node: json モジュール JavaScript オブジェクト記法2757114
Ref: whatsnew/2 6 the-json-module-javascript-object-notation2757369
Ref: 16052757369
Node: plistlib モジュール プロパティリストパーサ2758678
Ref: whatsnew/2 6 the-plistlib-module-a-property-list-parser2758923
Ref: 16062758923
Node: ctypes の強化2760439
Ref: whatsnew/2 6 ctypes-enhancements2760653
Ref: 16072760653
Ref: ctypes の強化-Footnote-12762851
Ref: ctypes の強化-Footnote-22762918
Node: SSL サポートの改善2762982
Ref: whatsnew/2 6 improved-ssl-support2763129
Ref: 16082763129
Ref: SSL サポートの改善-Footnote-12764471
Node: 非推奨と削除2764504
Ref: whatsnew/2 6 deprecations-and-removals2764701
Ref: 16092764701
Ref: 非推奨と削除-Footnote-12766696
Node: ビルドならびに C API の変更<9>2766738
Ref: whatsnew/2 6 build-and-c-api-changes2766898
Ref: 160b2766898
Ref: ビルドならびに C API の変更<9>-Footnote-12775408
Ref: ビルドならびに C API の変更<9>-Footnote-22775463
Ref: ビルドならびに C API の変更<9>-Footnote-32775518
Ref: ビルドならびに C API の変更<9>-Footnote-42775582
Ref: ビルドならびに C API の変更<9>-Footnote-52775649
Ref: ビルドならびに C API の変更<9>-Footnote-62775713
Ref: ビルドならびに C API の変更<9>-Footnote-72775777
Node: ポート特有の変更 Windows<2>2775844
Ref: whatsnew/2 6 port-specific-changes-windows2776001
Ref: 16122776001
Ref: ポート特有の変更 Windows<2>-Footnote-12778622
Ref: ポート特有の変更 Windows<2>-Footnote-22778688
Ref: ポート特有の変更 Windows<2>-Footnote-32778755
Node: ポート特有の変更 Mac OS X<2>2778819
Ref: whatsnew/2 6 port-specific-changes-mac-os-x2779014
Ref: 16172779014
Ref: ポート特有の変更 Mac OS X<2>-Footnote-12780332
Node: ポート特有の変更 IRIX2780399
Ref: whatsnew/2 6 port-specific-changes-irix2780550
Ref: 16182780550
Node: Python 2 6 への移植2781067
Ref: whatsnew/2 6 porting-to-python-2-62781218
Ref: 16192781218
Ref: Python 2 6 への移植-Footnote-12785983
Ref: Python 2 6 への移植-Footnote-22786050
Ref: Python 2 6 への移植-Footnote-32786117
Node: 謝辞<2>2786184
Ref: whatsnew/2 6 acknowledgements2786286
Ref: 161b2786286
Ref: whatsnew/2 6 acks2786286
Ref: 161c2786286
Node: What's New in Python 2 52786596
Ref: whatsnew/2 5 doc2786743
Ref: 161d2786743
Ref: whatsnew/2 5 translation-repo2786743
Ref: 161e2786743
Ref: whatsnew/2 5 what-s-new-in-python-2-52786743
Ref: 161f2786743
Ref: What's New in Python 2 5-Footnote-12791245
Node: PEP 308 条件式 Conditional Expressions2791287
Ref: whatsnew/2 5 pep-3082791427
Ref: 16202791427
Ref: whatsnew/2 5 pep-308-conditional-expressions2791427
Ref: 16252791427
Ref: PEP 308 条件式 Conditional Expressions-Footnote-12795482
Ref: PEP 308 条件式 Conditional Expressions-Footnote-22795524
Node: PEP 309 関数の部分適用2795566
Ref: whatsnew/2 5 pep-3092795765
Ref: 16262795765
Ref: whatsnew/2 5 pep-309-partial-function-application2795765
Ref: 16272795765
Ref: PEP 309 関数の部分適用-Footnote-12799701
Node: PEP 314 Metadata for Python Software Packages v1 12799743
Ref: whatsnew/2 5 pep-3142799954
Ref: 16282799954
Ref: whatsnew/2 5 pep-314-metadata-for-python-software-packages-v1-12799954
Ref: 16292799954
Ref: PEP 314 Metadata for Python Software Packages v1 1-Footnote-12802219
Node: PEP 328 絶対インポート、相対インポート2802261
Ref: whatsnew/2 5 pep-3282802507
Ref: 16232802507
Ref: whatsnew/2 5 pep-328-absolute-and-relative-imports2802507
Ref: 162a2802507
Ref: PEP 328 絶対インポート、相対インポート-Footnote-12807808
Ref: PEP 328 絶対インポート、相対インポート-Footnote-22807850
Node: PEP 338 - モジュールをスクリプトとして実行する2807892
Ref: whatsnew/2 5 pep-3382808127
Ref: 162b2808127
Ref: whatsnew/2 5 pep-338-executing-modules-as-scripts2808127
Ref: 162c2808127
Ref: PEP 338 - モジュールをスクリプトとして実行する-Footnote-12809318
Node: PEP 341 try/except/finally の一体化2809360
Ref: whatsnew/2 5 pep-3412809580
Ref: 16242809580
Ref: whatsnew/2 5 pep-341-unified-try-except-finally2809580
Ref: 162d2809580
Ref: PEP 341 try/except/finally の一体化-Footnote-12811718
Node: PEP 342 ジェネレータの新機能2811760
Ref: whatsnew/2 5 pep-3422811955
Ref: 16222811955
Ref: whatsnew/2 5 pep-342-new-generator-features2811955
Ref: 162e2811955
Ref: PEP 342 ジェネレータの新機能-Footnote-12819529
Ref: PEP 342 ジェネレータの新機能-Footnote-22819571
Ref: PEP 342 ジェネレータの新機能-Footnote-32819613
Ref: PEP 342 ジェネレータの新機能-Footnote-42819655
Ref: PEP 342 ジェネレータの新機能-Footnote-52819697
Node: PEP 343 "with" ステートメント<2>2819739
Ref: whatsnew/2 5 pep-3432819939
Ref: 16212819939
Ref: whatsnew/2 5 pep-343-the-with-statement2819939
Ref: 162f2819939
Node: コンテキストマネージャを書く<2>2823528
Ref: whatsnew/2 5 new-25-context-managers2823687
Ref: 16302823687
Ref: whatsnew/2 5 writing-context-managers2823687
Ref: 16312823687
Node: contextlib モジュール<2>2829203
Ref: whatsnew/2 5 contextlibmod2829362
Ref: 16322829362
Ref: whatsnew/2 5 the-contextlib-module2829362
Ref: 16332829362
Ref: contextlib モジュール<2>-Footnote-12832288
Node: PEP 352 例外の新スタイルクラス化2832330
Ref: whatsnew/2 5 pep-3522832533
Ref: 16342832533
Ref: whatsnew/2 5 pep-352-exceptions-as-new-style-classes2832533
Ref: 16352832533
Ref: PEP 352 例外の新スタイルクラス化-Footnote-12836365
Node: PEP 353 添え字型に ssize_t を使う2836407
Ref: whatsnew/2 5 pep-3532836603
Ref: 16362836603
Ref: whatsnew/2 5 pep-353-using-ssize-t-as-the-index-type2836603
Ref: 16372836603
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-12840091
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-22840133
Node: PEP 357 '__index__' メソッド2840175
Ref: whatsnew/2 5 pep-3572840355
Ref: 16392840355
Ref: whatsnew/2 5 pep-357-the-index-method2840355
Ref: 163a2840355
Ref: PEP 357 '__index__' メソッド-Footnote-12842387
Node: その他の言語変更<16>2842429
Ref: whatsnew/2 5 other-lang2842658
Ref: 163d2842658
Ref: whatsnew/2 5 other-language-changes2842658
Ref: 163e2842658
Ref: その他の言語変更<16>-Footnote-12851953
Node: 対話的なインタプリタの変更2851995
Ref: whatsnew/2 5 interactive2852121
Ref: 16442852121
Ref: whatsnew/2 5 interactive-interpreter-changes2852121
Ref: 16452852121
Node: 最適化<16>2853194
Ref: whatsnew/2 5 optimizations2853320
Ref: 16472853320
Ref: whatsnew/2 5 opts2853320
Ref: 16482853320
Node: 新たなモジュール、改良されたモジュール、削除されたモジュール2857657
Ref: whatsnew/2 5 modules2857895
Ref: 16492857895
Ref: whatsnew/2 5 new-improved-and-removed-modules2857895
Ref: 164a2857895
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-12887603
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-22887645
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-32887704
Node: ctypes パッケージ2887763
Ref: whatsnew/2 5 module-ctypes2887948
Ref: 16542887948
Ref: whatsnew/2 5 the-ctypes-package2887948
Ref: 16552887948
Node: ElementTree パッケージ2891585
Ref: whatsnew/2 5 module-etree2891802
Ref: 16562891802
Ref: whatsnew/2 5 the-elementtree-package2891802
Ref: 16572891802
Node: hashlib パッケージ2897839
Ref: whatsnew/2 5 module-hashlib2898057
Ref: 16582898057
Ref: whatsnew/2 5 the-hashlib-package2898057
Ref: 16592898057
Node: sqlite3 パッケージ2899789
Ref: whatsnew/2 5 module-sqlite2900003
Ref: 165a2900003
Ref: whatsnew/2 5 the-sqlite3-package2900003
Ref: 165b2900003
Ref: sqlite3 パッケージ-Footnote-12905071
Ref: sqlite3 パッケージ-Footnote-22905113
Node: wsgiref パッケージ2905155
Ref: whatsnew/2 5 module-wsgiref2905337
Ref: 165c2905337
Ref: whatsnew/2 5 the-wsgiref-package2905337
Ref: 165d2905337
Ref: wsgiref パッケージ-Footnote-12906471
Ref: wsgiref パッケージ-Footnote-22906513
Node: ビルドならびに C API の変更<10>2906555
Ref: whatsnew/2 5 build-and-c-api-changes2906788
Ref: 165e2906788
Ref: whatsnew/2 5 build-api2906788
Ref: 165f2906788
Ref: ビルドならびに C API の変更<10>-Footnote-12914094
Ref: ビルドならびに C API の変更<10>-Footnote-22914136
Ref: ビルドならびに C API の変更<10>-Footnote-32914178
Node: ポート特有の変更2914220
Ref: whatsnew/2 5 port-specific-changes2914322
Ref: 166b2914322
Ref: whatsnew/2 5 ports2914322
Ref: 166c2914322
Ref: ポート特有の変更-Footnote-12915093
Node: Python 2 5 への移植2915157
Ref: whatsnew/2 5 porting2915309
Ref: 166d2915309
Ref: whatsnew/2 5 porting-to-python-2-52915309
Ref: 166e2915309
Ref: Python 2 5 への移植-Footnote-12918595
Node: 謝辞<3>2918637
Ref: whatsnew/2 5 acknowledgements2918739
Ref: 166f2918739
Node: What's New in Python 2 42919211
Ref: whatsnew/2 4 doc2919358
Ref: 16702919358
Ref: whatsnew/2 4 translation-repo2919358
Ref: 16712919358
Ref: whatsnew/2 4 what-s-new-in-python-2-42919358
Ref: 16722919358
Node: PEP 218 ビルトインの集合オブジェクト2922044
Ref: whatsnew/2 4 pep-218-built-in-set-objects2922214
Ref: 16732922214
Ref: PEP 218 ビルトインの集合オブジェクト-Footnote-12924856
Node: PEP 237 長整数と整数を一体化していく2924898
Ref: whatsnew/2 4 pep-237-unifying-long-integers-and-integers2925106
Ref: 16742925106
Ref: PEP 237 長整数と整数を一体化していく-Footnote-12926399
Node: PEP 289 ジェネレータ式2926441
Ref: whatsnew/2 4 pep-289-generator-expressions2926657
Ref: 16752926657
Ref: PEP 289 ジェネレータ式-Footnote-12929398
Node: PEP 292 より単純な文字列置換 string substitution2929440
Ref: whatsnew/2 4 pep-292-simpler-string-substitutions2929662
Ref: 16762929662
Ref: PEP 292 より単純な文字列置換 string substitution-Footnote-12932005
Node: PEP 318 関数とメソッドのためのデコレータ2932047
Ref: whatsnew/2 4 pep-318-decorators-for-functions-and-methods2932278
Ref: 16772932278
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-12937980
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-22938022
Node: PEP 322 逆順のイテレーション2938064
Ref: whatsnew/2 4 pep-322-reverse-iteration2938281
Ref: 16792938281
Ref: PEP 322 逆順のイテレーション-Footnote-12939432
Node: PEP 324 新しい subprocess モジュール2939474
Ref: whatsnew/2 4 pep-324-new-subprocess-module2939663
Ref: 167a2939663
Ref: PEP 324 新しい subprocess モジュール-Footnote-12944106
Node: PEP 327 Decimal データ型2944148
Ref: whatsnew/2 4 pep-327-decimal-data-type2944340
Ref: 167c2944340
Node: なぜ Decimal が必要なのか?2944914
Ref: whatsnew/2 4 why-is-decimal-needed2945033
Ref: 167d2945033
Node: Decimal 型2947903
Ref: whatsnew/2 4 the-decimal-type2948042
Ref: 167e2948042
Node: Context 型2951543
Ref: whatsnew/2 4 the-context-type2951639
Ref: 167f2951639
Ref: Context 型-Footnote-12954885
Ref: Context 型-Footnote-22954927
Node: PEP 328 マルチラインインポート2955010
Ref: whatsnew/2 4 pep-328-multi-line-imports2955211
Ref: 16802955211
Ref: PEP 328 マルチラインインポート-Footnote-12957026
Node: PEP 331 Locale に依存しない Float/String 変換2957068
Ref: whatsnew/2 4 pep-331-locale-independent-float-string-conversions2957269
Ref: 16812957269
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-12959187
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-22959277
Node: その他の言語変更<17>2959319
Ref: whatsnew/2 4 other-language-changes2959569
Ref: 16822959569
Ref: その他の言語変更<17>-Footnote-12967675
Ref: その他の言語変更<17>-Footnote-22967717
Ref: その他の言語変更<17>-Footnote-32967759
Ref: その他の言語変更<17>-Footnote-42967801
Ref: その他の言語変更<17>-Footnote-52967843
Ref: その他の言語変更<17>-Footnote-62967885
Node: 最適化<17>2967927
Ref: whatsnew/2 4 optimizations2968005
Ref: 16842968005
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>2970741
Ref: whatsnew/2 4 new-improved-and-deprecated-modules2970979
Ref: 16852970979
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>-Footnote-12991679
Node: cookielib2991738
Ref: whatsnew/2 4 cookielib2991893
Ref: 16892991893
Node: doctest<5>2992981
Ref: whatsnew/2 4 doctest2993136
Ref: 168a2993136
Node: ビルドならびに C API の変更<11>2996276
Ref: whatsnew/2 4 build-and-c-api-changes2996509
Ref: 16902996509
Node: ポート特有の変更<2>2999252
Ref: whatsnew/2 4 port-specific-changes2999357
Ref: 16972999357
Node: Python 2 4 への移植2999533
Ref: whatsnew/2 4 porting-to-python-2-42999685
Ref: 16982999685
Node: 謝辞<4>3002097
Ref: whatsnew/2 4 acknowledgements3002199
Ref: 169a3002199
Ref: whatsnew/2 4 acks3002199
Ref: 169b3002199
Node: What's New in Python 2 33002500
Ref: whatsnew/2 3 doc3002647
Ref: 169c3002647
Ref: whatsnew/2 3 translation-repo3002647
Ref: 169d3002647
Ref: whatsnew/2 3 what-s-new-in-python-2-33002647
Ref: 169e3002647
Node: PEP 218 標準の集合データ型3006651
Ref: whatsnew/2 3 pep-218-a-standard-set-datatype3006791
Ref: 16a03006791
Ref: PEP 218 標準の集合データ型-Footnote-13010324
Node: PEP 255 単純なジェネレータ3010366
Ref: whatsnew/2 3 pep-255-simple-generators3010568
Ref: 16a53010568
Ref: whatsnew/2 3 section-generators3010568
Ref: 16a63010568
Ref: PEP 255 単純なジェネレータ-Footnote-13019968
Ref: PEP 255 単純なジェネレータ-Footnote-23020010
Node: PEP 263 ソースコードのエンコーディング3020052
Ref: whatsnew/2 3 pep-263-source-code-encodings3020291
Ref: 16a73020291
Ref: whatsnew/2 3 section-encodings3020291
Ref: 16a83020291
Ref: PEP 263 ソースコードのエンコーディング-Footnote-13021956
Node: PEP 273 Zip アーカイブからモジュールをインポートする3021998
Ref: whatsnew/2 3 pep-273-importing-modules-from-zip-archives3022263
Ref: 16a93022263
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-13024707
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-23024749
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-33024791
Node: PEP 277 Windows NT での Unicode ファイル名サポート3024833
Ref: whatsnew/2 3 pep-277-unicode-file-name-support-for-windows-nt3025083
Ref: 16ab3025083
Ref: PEP 277 Windows NT での Unicode ファイル名サポート-Footnote-13027129
Node: PEP 278 Universal Newline サポート3027171
Ref: whatsnew/2 3 pep-278-universal-newline-support3027366
Ref: 16ad3027366
Ref: PEP 278 Universal Newline サポート-Footnote-13029248
Node: PEP 279 enumerate3029290
Ref: whatsnew/2 3 pep-279-enumerate3029459
Ref: 16ae3029459
Ref: whatsnew/2 3 section-enumerate3029459
Ref: 16af3029459
Ref: PEP 279 enumerate-Footnote-13030427
Node: PEP 282 ロギングパッケージ3030469
Ref: whatsnew/2 3 pep-282-the-logging-package3030619
Ref: 16b03030619
Ref: PEP 282 ロギングパッケージ-Footnote-13036048
Ref: PEP 282 ロギングパッケージ-Footnote-23036090
Node: PEP 285 Boolean 型3036132
Ref: whatsnew/2 3 pep-285-a-boolean-type3036330
Ref: 16b63036330
Ref: whatsnew/2 3 section-bool3036330
Ref: 16b73036330
Ref: PEP 285 Boolean 型-Footnote-13039278
Ref: PEP 285 Boolean 型-Footnote-23039320
Node: PEP 293 コーデックエラーを処理するコールバック3039362
Ref: whatsnew/2 3 pep-293-codec-error-handling-callbacks3039607
Ref: 16b83039607
Ref: PEP 293 コーデックエラーを処理するコールバック-Footnote-13041541
Node: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ3041583
Ref: whatsnew/2 3 pep-301-package-index-and-metadata-for-distutils3041850
Ref: 16bb3041850
Ref: whatsnew/2 3 section-pep3013041850
Ref: 16bc3041850
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-13043727
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-23043763
Node: PEP 302 新たなインポートフック3043805
Ref: whatsnew/2 3 pep-302-new-import-hooks3044051
Ref: 16bd3044051
Ref: whatsnew/2 3 section-pep3023044051
Ref: 16aa3044051
Ref: PEP 302 新たなインポートフック-Footnote-13047786
Ref: PEP 302 新たなインポートフック-Footnote-23047828
Ref: PEP 302 新たなインポートフック-Footnote-33047870
Node: PEP 305 カンマ区切り形式ファイル3047912
Ref: whatsnew/2 3 pep-305-comma-separated-files3048106
Ref: 16be3048106
Ref: whatsnew/2 3 section-pep3053048106
Ref: 16bf3048106
Ref: PEP 305 カンマ区切り形式ファイル-Footnote-13049900
Node: PEP 307 Pickle の機能拡張3049942
Ref: whatsnew/2 3 pep-307-pickle-enhancements3050113
Ref: 16c03050113
Ref: whatsnew/2 3 section-pep3073050113
Ref: 16c13050113
Ref: PEP 307 Pickle の機能拡張-Footnote-13052418
Ref: PEP 307 Pickle の機能拡張-Footnote-23052460
Ref: PEP 307 Pickle の機能拡張-Footnote-33052502
Node: 拡張スライス3052544
Ref: whatsnew/2 3 extended-slices3052699
Ref: 16c43052699
Ref: whatsnew/2 3 section-slices3052699
Ref: 16c53052699
Node: その他の言語変更<18>3056757
Ref: whatsnew/2 3 other-language-changes3056972
Ref: 16c63056972
Ref: その他の言語変更<18>-Footnote-13065988
Node: 文字列に関する変更3066061
Ref: whatsnew/2 3 string-changes3066175
Ref: 16cc3066175
Node: 最適化<18>3068922
Ref: whatsnew/2 3 optimizations3069036
Ref: 16d13069036
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>3070487
Ref: whatsnew/2 3 new-improved-and-deprecated-modules3070744
Ref: 16d33070744
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>-Footnote-13098511
Node: 日付時刻型3098551
Ref: whatsnew/2 3 date-time-type3098726
Ref: 16e73098726
Node: optparse モジュール3101632
Ref: whatsnew/2 3 the-optparse-module3101807
Ref: 16ea3101807
Node: Pymalloc 特殊化されたオブジェクトアロケータ3104364
Ref: whatsnew/2 3 pymalloc-a-specialized-object-allocator3104634
Ref: 16ed3104634
Ref: whatsnew/2 3 section-pymalloc3104634
Ref: 16ee3104634
Node: ビルドならびに C API の変更<12>3109740
Ref: whatsnew/2 3 build-and-c-api-changes3109950
Ref: 16f03109950
Node: ポート特有の変更<3>3114107
Ref: whatsnew/2 3 port-specific-changes3114212
Ref: 16f63114212
Node: その他の変更と修正<2>3115441
Ref: whatsnew/2 3 other-changes-and-fixes3115614
Ref: 16f73115614
Ref: whatsnew/2 3 section-other3115614
Ref: 16d23115614
Node: Python 2 3 への移植3118723
Ref: whatsnew/2 3 porting-to-python-2-33118864
Ref: 16fa3118864
Node: 謝辞<5>3123146
Ref: whatsnew/2 3 acknowledgements3123248
Ref: 16fb3123248
Ref: whatsnew/2 3 acks3123248
Ref: 16fc3123248
Node: What's New in Python 2 23123837
Ref: whatsnew/2 2 doc3123984
Ref: 16fd3123984
Ref: whatsnew/2 2 translation-repo3123984
Ref: 16fe3123984
Ref: whatsnew/2 2 what-s-new-in-python-2-23123984
Ref: 16ff3123984
Node: はじめに3124900
Ref: whatsnew/2 2 introduction3125038
Ref: 17003125038
Ref: はじめに-Footnote-13126249
Ref: はじめに-Footnote-23126298
Node: PEP 252 と PEP 253 型とクラスについての変更3126347
Ref: whatsnew/2 2 peps-252-and-253-type-and-class-changes3126517
Ref: 17013126517
Node: 旧と新クラス3130686
Ref: whatsnew/2 2 old-and-new-classes3130824
Ref: 17043130824
Ref: 旧と新クラス-Footnote-13133750
Node: デスクリプタ3133792
Ref: whatsnew/2 2 descriptors3133979
Ref: 17053133979
Node: 多重継承 ダイヤモンドルール3138203
Ref: whatsnew/2 2 multiple-inheritance-the-diamond-rule3138390
Ref: 17073138390
Ref: 多重継承 ダイヤモンドルール-Footnote-13141416
Node: 属性アクセス3141458
Ref: whatsnew/2 2 attribute-access3141642
Ref: 17083141642
Node: 関連リンク3145633
Ref: whatsnew/2 2 related-links3145768
Ref: 170a3145768
Ref: whatsnew/2 2 sect-rellinks3145768
Ref: 17033145768
Ref: 関連リンク-Footnote-13147735
Ref: 関連リンク-Footnote-23147777
Ref: 関連リンク-Footnote-33147819
Ref: 関連リンク-Footnote-43147861
Ref: 関連リンク-Footnote-53147903
Node: PEP 234 イテレータ3147945
Ref: whatsnew/2 2 pep-234-iterators3148141
Ref: 170c3148141
Ref: PEP 234 イテレータ-Footnote-13153534
Node: PEP 255 単純なジェネレータ<2>3153576
Ref: whatsnew/2 2 pep-255-simple-generators3153769
Ref: 170f3153769
Ref: PEP 255 単純なジェネレータ<2>-Footnote-13163050
Ref: PEP 255 単純なジェネレータ<2>-Footnote-23163092
Node: PEP 237 長整数と整数を一体化していく<2>3163134
Ref: whatsnew/2 2 pep-237-unifying-long-integers-and-integers3163348
Ref: 17103163348
Ref: PEP 237 長整数と整数を一体化していく<2>-Footnote-13165822
Node: PEP 238 除算演算子を変更していく3165864
Ref: whatsnew/2 2 pep-238-changing-the-division-operator3166057
Ref: 17113166057
Ref: PEP 238 除算演算子を変更していく-Footnote-13170714
Ref: PEP 238 除算演算子を変更していく-Footnote-23170756
Ref: PEP 238 除算演算子を変更していく-Footnote-33170798
Node: Unicode の変更3170840
Ref: whatsnew/2 2 unicode-changes3171015
Ref: 17133171015
Ref: Unicode の変更-Footnote-13174270
Ref: Unicode の変更-Footnote-23174312
Node: PEP 227 入れ子状のスコープ3174354
Ref: whatsnew/2 2 pep-227-nested-scopes3174545
Ref: 17143174545
Ref: PEP 227 入れ子状のスコープ-Footnote-13179652
Node: 新しいモジュールと改良されたモジュール<3>3179694
Ref: whatsnew/2 2 new-and-improved-modules3179904
Ref: 17153179904
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-13187189
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-23187248
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-33187307
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-43187366
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-53187425
Node: インタプリタの変更と修正3187483
Ref: whatsnew/2 2 interpreter-changes-and-fixes3187688
Ref: 171a3187688
Node: その他の変更と修正<3>3193288
Ref: whatsnew/2 2 other-changes-and-fixes3193442
Ref: 172a3193442
Ref: その他の変更と修正<3>-Footnote-13201221
Node: 謝辞<6>3201263
Ref: whatsnew/2 2 acknowledgements3201372
Ref: 172d3201372
Node: What's New in Python 2 13201939
Ref: whatsnew/2 1 doc3202086
Ref: 172e3202086
Ref: whatsnew/2 1 translation-repo3202086
Ref: 172f3202086
Ref: whatsnew/2 1 what-s-new-in-python-2-13202086
Ref: 17303202086
Node: はじめに<2>3203397
Ref: whatsnew/2 1 introduction3203520
Ref: 17313203520
Node: PEP 227 入れ子状のスコープ<2>3204710
Ref: whatsnew/2 1 pep-227-nested-scopes3204870
Ref: 17323204870
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-13210087
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-23210129
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-33210171
Node: PEP 236 __future__ 指示文3210213
Ref: whatsnew/2 1 pep-236-future-directives3210378
Ref: 17333210378
Ref: PEP 236 __future__ 指示文-Footnote-13212003
Node: PEP 207 拡張比較3212045
Ref: whatsnew/2 1 pep-207-rich-comparisons3212207
Ref: 17343212207
Ref: PEP 207 拡張比較-Footnote-13215820
Ref: PEP 207 拡張比較-Footnote-23215862
Node: PEP 230 警告フレームワーク3215904
Ref: whatsnew/2 1 pep-230-warning-framework3216076
Ref: 17363216076
Ref: PEP 230 警告フレームワーク-Footnote-13219905
Ref: PEP 230 警告フレームワーク-Footnote-23219947
Node: PEP 229 新しいビルドシステム3219989
Ref: whatsnew/2 1 pep-229-new-build-system3220158
Ref: 17383220158
Ref: PEP 229 新しいビルドシステム-Footnote-13222951
Node: PEP 205 弱参照3222993
Ref: whatsnew/2 1 pep-205-weak-references3223150
Ref: 17393223150
Ref: PEP 205 弱参照-Footnote-13226719
Node: PEP 232 関数の属性3226761
Ref: whatsnew/2 1 pep-232-function-attributes3226984
Ref: 173a3226984
Ref: PEP 232 関数の属性-Footnote-13228506
Node: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み3228548
Ref: whatsnew/2 1 pep-235-importing-modules-on-case-insensitive-platforms3228793
Ref: 173b3228793
Node: PEP 217 対話モード用 Display Hook3230067
Ref: whatsnew/2 1 pep-217-interactive-display-hook3230324
Ref: 173c3230324
Ref: PEP 217 対話モード用 Display Hook-Footnote-13231309
Node: PEP 208 新しい型強制モデル3231351
Ref: whatsnew/2 1 pep-208-new-coercion-model3231578
Ref: 173e3231578
Ref: PEP 208 新しい型強制モデル-Footnote-13233532
Node: PEP 241 Pythonソフトウェアパッケージのためのメタデータ3233574
Ref: whatsnew/2 1 pep-241-metadata-in-python-packages3233822
Ref: 173f3233822
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-13236659
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-23236701
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-33236743
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-43236785
Node: 新しいモジュールと改良されたモジュール<4>3236827
Ref: whatsnew/2 1 new-and-improved-modules3237070
Ref: 17403237070
Node: その他の変更と修正<4>3244097
Ref: whatsnew/2 1 other-changes-and-fixes3244275
Ref: 17413244275
Node: 謝辞<7>3251083
Ref: whatsnew/2 1 acknowledgements3251192
Ref: 17453251192
Node: What's New in Python 2 03251481
Ref: whatsnew/2 0 doc3251616
Ref: 17463251616
Ref: whatsnew/2 0 translation-repo3251616
Ref: 17473251616
Ref: whatsnew/2 0 what-s-new-in-python-2-03251616
Ref: 17483251616
Node: はじめに<3>3252570
Ref: whatsnew/2 0 introduction3252688
Ref: 17493252688
Node: Python 1 6 はいかがですか?3253875
Ref: whatsnew/2 0 what-about-python-1-63254029
Ref: 174a3254029
Node: 新しい開発プロセス3255721
Ref: whatsnew/2 0 new-development-process3255883
Ref: 174b3255883
Ref: 新しい開発プロセス-Footnote-13262796
Ref: 新しい開発プロセス-Footnote-23262838
Ref: 新しい開発プロセス-Footnote-33262880
Node: Unicode 文字列型<2>3262922
Ref: whatsnew/2 0 unicode3263075
Ref: 174c3263075
Ref: Unicode 文字列型<2>-Footnote-13271672
Node: リストの内包表記3271714
Ref: whatsnew/2 0 list-comprehensions3271873
Ref: 174d3271873
Node: 累算代入 Augmented Assignment3276301
Ref: whatsnew/2 0 augmented-assignment3276458
Ref: 174e3276458
Node: 文字列メソッド3278063
Ref: whatsnew/2 0 string-methods3278241
Ref: 174f3278241
Node: 循環参照のガベージコレクション3280293
Ref: whatsnew/2 0 garbage-collection-of-cycles3280471
Ref: 17503280471
Node: その他の言語コアの変更3285403
Ref: whatsnew/2 0 other-core-changes3285583
Ref: 17513285583
Node: 言語のマイナー変更3285937
Ref: whatsnew/2 0 minor-language-changes3286073
Ref: 17523286073
Node: ビルトイン関数の変更3291631
Ref: whatsnew/2 0 changes-to-built-in-functions3291767
Ref: 17563291767
Node: Python 2 0 への移植3294648
Ref: whatsnew/2 0 porting-to-2-03294825
Ref: 17573294825
Node: 拡張と埋め込みについての変更3301013
Ref: whatsnew/2 0 extending-embedding-changes3301209
Ref: 17593301209
Node: Distutils モジュールの簡単インストール3306697
Ref: whatsnew/2 0 distutils-making-modules-easy-to-install3306889
Ref: 175e3306889
Node: XML モジュール3310832
Ref: whatsnew/2 0 xml-modules3311012
Ref: 175f3311012
Node: SAX2 サポート3311927
Ref: whatsnew/2 0 sax2-support3312025
Ref: 17603312025
Node: DOM サポート3313883
Ref: whatsnew/2 0 dom-support3314008
Ref: 17643314008
Node: PyXML との関係3317076
Ref: whatsnew/2 0 relationship-to-pyxml3317175
Ref: 17653317175
Node: 更新されたモジュール3318650
Ref: whatsnew/2 0 module-changes3318805
Ref: 17663318805
Node: 新しいモジュール<2>3321510
Ref: whatsnew/2 0 new-modules3321660
Ref: 17673321660
Node: IDLE の改善3326359
Ref: whatsnew/2 0 idle-improvements3326548
Ref: 17683326548
Node: 削除されたモジュール、非推奨となったモジュール3328264
Ref: whatsnew/2 0 deleted-and-deprecated-modules3328435
Ref: 17693328435
Node: 謝辞<8>3329234
Ref: whatsnew/2 0 acknowledgements3329382
Ref: 176a3329382
Ref: 謝辞<8>-Footnote-13330015
Ref: 謝辞<8>-Footnote-23330079
Node: 変更履歴3330119
Ref: whatsnew/changelog doc3330221
Ref: 176b3330221
Ref: whatsnew/changelog changelog3330221
Ref: 1433330221
Ref: whatsnew/changelog id13330221
Ref: 176c3330221
Ref: whatsnew/changelog translation-repo3330221
Ref: 176d3330221
Node: Python next3336466
Ref: whatsnew/changelog python-next3336554
Ref: 176e3336554
Node: テスト3336779
Ref: whatsnew/changelog tests3336863
Ref: 176f3336863
Ref: テスト-Footnote-13337082
Node: セキュリティ3337138
Ref: whatsnew/changelog security3337246
Ref: 17703337246
Ref: セキュリティ-Footnote-13338109
Ref: セキュリティ-Footnote-23338165
Ref: セキュリティ-Footnote-33338221
Ref: セキュリティ-Footnote-43338277
Ref: セキュリティ-Footnote-53338332
Node: ライブラリ3338388
Ref: whatsnew/changelog library3338508
Ref: 17713338508
Ref: ライブラリ-Footnote-13346471
Ref: ライブラリ-Footnote-23346527
Ref: ライブラリ-Footnote-33346582
Ref: ライブラリ-Footnote-43346638
Ref: ライブラリ-Footnote-53346693
Ref: ライブラリ-Footnote-63346749
Ref: ライブラリ-Footnote-73346804
Ref: ライブラリ-Footnote-83346859
Ref: ライブラリ-Footnote-93346914
Ref: ライブラリ-Footnote-103346970
Ref: ライブラリ-Footnote-113347027
Ref: ライブラリ-Footnote-123347084
Ref: ライブラリ-Footnote-133347141
Ref: ライブラリ-Footnote-143347198
Ref: ライブラリ-Footnote-153347255
Ref: ライブラリ-Footnote-163347312
Ref: ライブラリ-Footnote-173347369
Ref: ライブラリ-Footnote-183347426
Ref: ライブラリ-Footnote-193347483
Ref: ライブラリ-Footnote-203347540
Ref: ライブラリ-Footnote-213347597
Ref: ライブラリ-Footnote-223347654
Ref: ライブラリ-Footnote-233347711
Ref: ライブラリ-Footnote-243347768
Ref: ライブラリ-Footnote-253347825
Ref: ライブラリ-Footnote-263347882
Ref: ライブラリ-Footnote-273347939
Ref: ライブラリ-Footnote-283347996
Ref: ライブラリ-Footnote-293348053
Ref: ライブラリ-Footnote-303348110
Ref: ライブラリ-Footnote-313348167
Ref: ライブラリ-Footnote-323348224
Ref: ライブラリ-Footnote-333348281
Ref: ライブラリ-Footnote-343348338
Ref: ライブラリ-Footnote-353348395
Ref: ライブラリ-Footnote-363348452
Ref: ライブラリ-Footnote-373348509
Node: ドキュメント<2>3348566
Ref: whatsnew/changelog documentation3348685
Ref: 17823348685
Ref: ドキュメント<2>-Footnote-13349078
Node: Core and Builtins3349133
Ref: whatsnew/changelog core-and-builtins3349242
Ref: 17833349242
Ref: Core and Builtins-Footnote-13352404
Ref: Core and Builtins-Footnote-23352460
Ref: Core and Builtins-Footnote-33352516
Ref: Core and Builtins-Footnote-43352572
Ref: Core and Builtins-Footnote-53352628
Ref: Core and Builtins-Footnote-63352684
Ref: Core and Builtins-Footnote-73352740
Ref: Core and Builtins-Footnote-83352796
Ref: Core and Builtins-Footnote-93352852
Ref: Core and Builtins-Footnote-103352908
Ref: Core and Builtins-Footnote-113352965
Ref: Core and Builtins-Footnote-123353022
Ref: Core and Builtins-Footnote-133353079
Ref: Core and Builtins-Footnote-143353136
Ref: Core and Builtins-Footnote-153353193
Ref: Core and Builtins-Footnote-163353250
Ref: Core and Builtins-Footnote-173353307
Ref: Core and Builtins-Footnote-183353364
Node: C API3353421
Ref: whatsnew/changelog c-api3353518
Ref: 178b3353518
Ref: C API-Footnote-13353818
Node: ビルド3353874
Ref: whatsnew/changelog build3353945
Ref: 178c3353945
Ref: ビルド-Footnote-13354210
Node: Python 3 14 6 final3354266
Ref: whatsnew/changelog python-3-14-6-final3354382
Ref: 178d3354382
Node: セキュリティ<2>3354759
Ref: whatsnew/changelog id23354865
Ref: 178e3354865
Ref: セキュリティ<2>-Footnote-13357163
Ref: セキュリティ<2>-Footnote-23357219
Ref: セキュリティ<2>-Footnote-33357275
Ref: セキュリティ<2>-Footnote-43357331
Ref: セキュリティ<2>-Footnote-53357387
Ref: セキュリティ<2>-Footnote-63357423
Ref: セキュリティ<2>-Footnote-73357479
Ref: セキュリティ<2>-Footnote-83357534
Ref: セキュリティ<2>-Footnote-93357590
Ref: セキュリティ<2>-Footnote-103357646
Node: Core and Builtins<2>3357703
Ref: whatsnew/changelog id33357836
Ref: 17903357836
Ref: Core and Builtins<2>-Footnote-13360878
Ref: Core and Builtins<2>-Footnote-23360934
Ref: Core and Builtins<2>-Footnote-33360990
Ref: Core and Builtins<2>-Footnote-43361046
Ref: Core and Builtins<2>-Footnote-53361102
Ref: Core and Builtins<2>-Footnote-63361158
Ref: Core and Builtins<2>-Footnote-73361214
Ref: Core and Builtins<2>-Footnote-83361270
Ref: Core and Builtins<2>-Footnote-93361326
Ref: Core and Builtins<2>-Footnote-103361382
Ref: Core and Builtins<2>-Footnote-113361439
Ref: Core and Builtins<2>-Footnote-123361496
Ref: Core and Builtins<2>-Footnote-133361553
Ref: Core and Builtins<2>-Footnote-143361610
Ref: Core and Builtins<2>-Footnote-153361667
Ref: Core and Builtins<2>-Footnote-163361721
Ref: Core and Builtins<2>-Footnote-173361778
Ref: Core and Builtins<2>-Footnote-183361835
Node: ライブラリ<2>3361892
Ref: whatsnew/changelog id43362025
Ref: 17923362025
Ref: ライブラリ<2>-Footnote-13367666
Ref: ライブラリ<2>-Footnote-23367722
Ref: ライブラリ<2>-Footnote-33367778
Ref: ライブラリ<2>-Footnote-43367834
Ref: ライブラリ<2>-Footnote-53367890
Ref: ライブラリ<2>-Footnote-63367946
Ref: ライブラリ<2>-Footnote-73368002
Ref: ライブラリ<2>-Footnote-83368058
Ref: ライブラリ<2>-Footnote-93368114
Ref: ライブラリ<2>-Footnote-103368170
Ref: ライブラリ<2>-Footnote-113368226
Ref: ライブラリ<2>-Footnote-123368283
Ref: ライブラリ<2>-Footnote-133368340
Ref: ライブラリ<2>-Footnote-143368396
Ref: ライブラリ<2>-Footnote-153368453
Ref: ライブラリ<2>-Footnote-163368510
Ref: ライブラリ<2>-Footnote-173368567
Ref: ライブラリ<2>-Footnote-183368624
Ref: ライブラリ<2>-Footnote-193368681
Ref: ライブラリ<2>-Footnote-203368738
Ref: ライブラリ<2>-Footnote-213368795
Ref: ライブラリ<2>-Footnote-223368852
Ref: ライブラリ<2>-Footnote-233368909
Ref: ライブラリ<2>-Footnote-243368966
Ref: ライブラリ<2>-Footnote-253369023
Ref: ライブラリ<2>-Footnote-263369080
Ref: ライブラリ<2>-Footnote-273369137
Ref: ライブラリ<2>-Footnote-283369193
Ref: ライブラリ<2>-Footnote-293369254
Ref: ライブラリ<2>-Footnote-303369311
Ref: ライブラリ<2>-Footnote-313369368
Ref: ライブラリ<2>-Footnote-323369428
Ref: ライブラリ<2>-Footnote-333369485
Ref: ライブラリ<2>-Footnote-343369542
Node: ドキュメント<3>3369598
Ref: whatsnew/changelog id53369723
Ref: 179c3369723
Ref: ドキュメント<3>-Footnote-13370148
Ref: ドキュメント<3>-Footnote-23370204
Node: テスト<2>3370260
Ref: whatsnew/changelog id63370379
Ref: 179d3370379
Ref: テスト<2>-Footnote-13370656
Ref: テスト<2>-Footnote-23370712
Node: ビルド<2>3370768
Ref: whatsnew/changelog id73370873
Ref: 179e3370873
Ref: ビルド<2>-Footnote-13371083
Node: Windows3371139
Ref: whatsnew/changelog windows3371237
Ref: 179f3371237
Ref: Windows-Footnote-13371373
Node: macOS3371429
Ref: whatsnew/changelog macos3371522
Ref: 17a03371522
Ref: macOS-Footnote-13371950
Ref: macOS-Footnote-23372006
Ref: macOS-Footnote-33372062
Node: IDLE<3>3372118
Ref: whatsnew/changelog idle3372212
Ref: 17a13372212
Ref: IDLE<3>-Footnote-13372358
Node: C API<2>3372422
Ref: whatsnew/changelog id83372502
Ref: 17a23372502
Ref: C API<2>-Footnote-13372976
Ref: C API<2>-Footnote-23373032
Node: Python 3 14 5 final3373088
Ref: whatsnew/changelog python-3-14-5-final3373226
Ref: 17a53373226
Node: セキュリティ<3>3373492
Ref: whatsnew/changelog id93373598
Ref: 17a63373598
Ref: セキュリティ<3>-Footnote-13373857
Node: Core and Builtins<3>3373913
Ref: whatsnew/changelog id103374046
Ref: 17a73374046
Ref: Core and Builtins<3>-Footnote-13374326
Ref: Core and Builtins<3>-Footnote-23374382
Node: ライブラリ<3>3374438
Ref: whatsnew/changelog id113374562
Ref: 17a83374562
Ref: ライブラリ<3>-Footnote-13375271
Ref: ライブラリ<3>-Footnote-23375327
Ref: ライブラリ<3>-Footnote-33375383
Ref: ライブラリ<3>-Footnote-43375439
Ref: ライブラリ<3>-Footnote-53375498
Ref: ライブラリ<3>-Footnote-63375554
Ref: ライブラリ<3>-Footnote-73375610
Node: テスト<3>3375666
Ref: whatsnew/changelog id123375778
Ref: 17a93375778
Ref: テスト<3>-Footnote-13376078
Ref: テスト<3>-Footnote-23376134
Node: macOS<2>3376190
Ref: whatsnew/changelog id133376275
Ref: 17aa3376275
Ref: macOS<2>-Footnote-13376596
Ref: macOS<2>-Footnote-23376652
Node: Python 3 14 5 release candidate 13376708
Ref: whatsnew/changelog python-3-14-5-release-candidate-13376846
Ref: 17ab3376846
Node: セキュリティ<4>3377208
Ref: whatsnew/changelog id143377328
Ref: 17ac3377328
Ref: セキュリティ<4>-Footnote-13379237
Ref: セキュリティ<4>-Footnote-23379293
Ref: セキュリティ<4>-Footnote-33379349
Ref: セキュリティ<4>-Footnote-43379385
Ref: セキュリティ<4>-Footnote-53379440
Ref: セキュリティ<4>-Footnote-63379496
Ref: セキュリティ<4>-Footnote-73379552
Ref: セキュリティ<4>-Footnote-83379608
Ref: セキュリティ<4>-Footnote-93379664
Ref: セキュリティ<4>-Footnote-103379720
Node: Core and Builtins<4>3379777
Ref: whatsnew/changelog id163379924
Ref: 17af3379924
Ref: Core and Builtins<4>-Footnote-13382976
Ref: Core and Builtins<4>-Footnote-23383032
Ref: Core and Builtins<4>-Footnote-33383088
Ref: Core and Builtins<4>-Footnote-43383144
Ref: Core and Builtins<4>-Footnote-53383200
Ref: Core and Builtins<4>-Footnote-63383256
Ref: Core and Builtins<4>-Footnote-73383312
Ref: Core and Builtins<4>-Footnote-83383368
Ref: Core and Builtins<4>-Footnote-93383424
Ref: Core and Builtins<4>-Footnote-103383480
Ref: Core and Builtins<4>-Footnote-113383537
Ref: Core and Builtins<4>-Footnote-123383594
Ref: Core and Builtins<4>-Footnote-133383651
Ref: Core and Builtins<4>-Footnote-143383708
Ref: Core and Builtins<4>-Footnote-153383765
Node: ライブラリ<4>3383822
Ref: whatsnew/changelog id173383969
Ref: 17b23383969
Ref: ライブラリ<4>-Footnote-13389082
Ref: ライブラリ<4>-Footnote-23389138
Ref: ライブラリ<4>-Footnote-33389194
Ref: ライブラリ<4>-Footnote-43389250
Ref: ライブラリ<4>-Footnote-53389305
Ref: ライブラリ<4>-Footnote-63389361
Ref: ライブラリ<4>-Footnote-73389417
Ref: ライブラリ<4>-Footnote-83389473
Ref: ライブラリ<4>-Footnote-93389529
Ref: ライブラリ<4>-Footnote-103389585
Ref: ライブラリ<4>-Footnote-113389642
Ref: ライブラリ<4>-Footnote-123389699
Ref: ライブラリ<4>-Footnote-133389756
Ref: ライブラリ<4>-Footnote-143389813
Ref: ライブラリ<4>-Footnote-153389870
Ref: ライブラリ<4>-Footnote-163389927
Ref: ライブラリ<4>-Footnote-173389984
Ref: ライブラリ<4>-Footnote-183390041
Ref: ライブラリ<4>-Footnote-193390098
Ref: ライブラリ<4>-Footnote-203390155
Ref: ライブラリ<4>-Footnote-213390212
Ref: ライブラリ<4>-Footnote-223390269
Ref: ライブラリ<4>-Footnote-233390326
Ref: ライブラリ<4>-Footnote-243390383
Ref: ライブラリ<4>-Footnote-253390440
Ref: ライブラリ<4>-Footnote-263390497
Ref: ライブラリ<4>-Footnote-273390553
Node: ドキュメント<4>3390609
Ref: whatsnew/changelog id183390748
Ref: 17bc3390748
Ref: ドキュメント<4>-Footnote-13391264
Ref: ドキュメント<4>-Footnote-23391320
Node: ビルド<3>3391376
Ref: whatsnew/changelog id193391507
Ref: 17be3391507
Ref: ビルド<3>-Footnote-13392529
Ref: ビルド<3>-Footnote-23392585
Ref: ビルド<3>-Footnote-33392641
Ref: ビルド<3>-Footnote-43392697
Ref: ビルド<3>-Footnote-53392753
Node: Windows<2>3392809
Ref: whatsnew/changelog id203392927
Ref: 17bf3392927
Ref: Windows<2>-Footnote-13393171
Ref: Windows<2>-Footnote-23393227
Node: macOS<3>3393283
Ref: whatsnew/changelog id213393380
Ref: 17c03393380
Ref: macOS<3>-Footnote-13393513
Node: Python 3 14 4 final3393569
Ref: whatsnew/changelog python-3-14-4-final3393707
Ref: 17c13393707
Node: セキュリティ<5>3394087
Ref: whatsnew/changelog id223394193
Ref: 17c23394193
Ref: セキュリティ<5>-Footnote-13395119
Ref: セキュリティ<5>-Footnote-23395175
Ref: セキュリティ<5>-Footnote-33395230
Ref: セキュリティ<5>-Footnote-43395286
Ref: セキュリティ<5>-Footnote-53395341
Ref: セキュリティ<5>-Footnote-63395397
Ref: セキュリティ<5>-Footnote-73395452
Ref: セキュリティ<5>-Footnote-83395508
Node: Core and Builtins<5>3395564
Ref: whatsnew/changelog id233395697
Ref: 17c63395697
Ref: Core and Builtins<5>-Footnote-13403431
Ref: Core and Builtins<5>-Footnote-23403487
Ref: Core and Builtins<5>-Footnote-33403540
Ref: Core and Builtins<5>-Footnote-43403596
Ref: Core and Builtins<5>-Footnote-53403652
Ref: Core and Builtins<5>-Footnote-63403708
Ref: Core and Builtins<5>-Footnote-73403764
Ref: Core and Builtins<5>-Footnote-83403820
Ref: Core and Builtins<5>-Footnote-93403876
Ref: Core and Builtins<5>-Footnote-103403932
Ref: Core and Builtins<5>-Footnote-113403989
Ref: Core and Builtins<5>-Footnote-123404046
Ref: Core and Builtins<5>-Footnote-133404103
Ref: Core and Builtins<5>-Footnote-143404160
Ref: Core and Builtins<5>-Footnote-153404217
Ref: Core and Builtins<5>-Footnote-163404274
Ref: Core and Builtins<5>-Footnote-173404331
Ref: Core and Builtins<5>-Footnote-183404388
Ref: Core and Builtins<5>-Footnote-193404445
Ref: Core and Builtins<5>-Footnote-203404502
Ref: Core and Builtins<5>-Footnote-213404559
Ref: Core and Builtins<5>-Footnote-223404613
Ref: Core and Builtins<5>-Footnote-233404670
Ref: Core and Builtins<5>-Footnote-243404727
Ref: Core and Builtins<5>-Footnote-253404781
Ref: Core and Builtins<5>-Footnote-263404838
Ref: Core and Builtins<5>-Footnote-273404895
Ref: Core and Builtins<5>-Footnote-283404952
Ref: Core and Builtins<5>-Footnote-293405009
Ref: Core and Builtins<5>-Footnote-303405066
Ref: Core and Builtins<5>-Footnote-313405123
Ref: Core and Builtins<5>-Footnote-323405180
Ref: Core and Builtins<5>-Footnote-333405237
Ref: Core and Builtins<5>-Footnote-343405294
Ref: Core and Builtins<5>-Footnote-353405351
Ref: Core and Builtins<5>-Footnote-363405408
Ref: Core and Builtins<5>-Footnote-373405465
Ref: Core and Builtins<5>-Footnote-383405522
Ref: Core and Builtins<5>-Footnote-393405579
Ref: Core and Builtins<5>-Footnote-403405636
Ref: Core and Builtins<5>-Footnote-413405693
Ref: Core and Builtins<5>-Footnote-423405750
Ref: Core and Builtins<5>-Footnote-433405807
Ref: Core and Builtins<5>-Footnote-443405864
Ref: Core and Builtins<5>-Footnote-453405921
Ref: Core and Builtins<5>-Footnote-463405978
Ref: Core and Builtins<5>-Footnote-473406035
Ref: Core and Builtins<5>-Footnote-483406091
Ref: Core and Builtins<5>-Footnote-493406148
Node: ライブラリ<5>3406204
Ref: whatsnew/changelog id243406337
Ref: 17cb3406337
Ref: ライブラリ<5>-Footnote-13417348
Ref: ライブラリ<5>-Footnote-23417404
Ref: ライブラリ<5>-Footnote-33417460
Ref: ライブラリ<5>-Footnote-43417516
Ref: ライブラリ<5>-Footnote-53417572
Ref: ライブラリ<5>-Footnote-63417628
Ref: ライブラリ<5>-Footnote-73417673
Ref: ライブラリ<5>-Footnote-83417729
Ref: ライブラリ<5>-Footnote-93417785
Ref: ライブラリ<5>-Footnote-103417841
Ref: ライブラリ<5>-Footnote-113417898
Ref: ライブラリ<5>-Footnote-123417935
Ref: ライブラリ<5>-Footnote-133417992
Ref: ライブラリ<5>-Footnote-143418049
Ref: ライブラリ<5>-Footnote-153418103
Ref: ライブラリ<5>-Footnote-163418160
Ref: ライブラリ<5>-Footnote-173418217
Ref: ライブラリ<5>-Footnote-183418271
Ref: ライブラリ<5>-Footnote-193418325
Ref: ライブラリ<5>-Footnote-203418382
Ref: ライブラリ<5>-Footnote-213418439
Ref: ライブラリ<5>-Footnote-223418493
Ref: ライブラリ<5>-Footnote-233418550
Ref: ライブラリ<5>-Footnote-243418607
Ref: ライブラリ<5>-Footnote-253418664
Ref: ライブラリ<5>-Footnote-263418721
Ref: ライブラリ<5>-Footnote-273418778
Ref: ライブラリ<5>-Footnote-283418835
Ref: ライブラリ<5>-Footnote-293418892
Ref: ライブラリ<5>-Footnote-303418949
Ref: ライブラリ<5>-Footnote-313419006
Ref: ライブラリ<5>-Footnote-323419063
Ref: ライブラリ<5>-Footnote-333419120
Ref: ライブラリ<5>-Footnote-343419180
Ref: ライブラリ<5>-Footnote-353419237
Ref: ライブラリ<5>-Footnote-363419294
Ref: ライブラリ<5>-Footnote-373419350
Ref: ライブラリ<5>-Footnote-383419407
Ref: ライブラリ<5>-Footnote-393419464
Ref: ライブラリ<5>-Footnote-403419521
Ref: ライブラリ<5>-Footnote-413419578
Ref: ライブラリ<5>-Footnote-423419635
Ref: ライブラリ<5>-Footnote-433419692
Ref: ライブラリ<5>-Footnote-443419749
Ref: ライブラリ<5>-Footnote-453419806
Ref: ライブラリ<5>-Footnote-463419866
Ref: ライブラリ<5>-Footnote-473419922
Ref: ライブラリ<5>-Footnote-483419978
Ref: ライブラリ<5>-Footnote-493420035
Ref: ライブラリ<5>-Footnote-503420092
Ref: ライブラリ<5>-Footnote-513420149
Ref: ライブラリ<5>-Footnote-523420206
Ref: ライブラリ<5>-Footnote-533420263
Ref: ライブラリ<5>-Footnote-543420320
Ref: ライブラリ<5>-Footnote-553420357
Ref: ライブラリ<5>-Footnote-563420414
Ref: ライブラリ<5>-Footnote-573420471
Ref: ライブラリ<5>-Footnote-583420528
Ref: ライブラリ<5>-Footnote-593420585
Ref: ライブラリ<5>-Footnote-603420642
Ref: ライブラリ<5>-Footnote-613420699
Ref: ライブラリ<5>-Footnote-623420756
Ref: ライブラリ<5>-Footnote-633420813
Ref: ライブラリ<5>-Footnote-643420870
Ref: ライブラリ<5>-Footnote-653420927
Ref: ライブラリ<5>-Footnote-663420984
Ref: ライブラリ<5>-Footnote-673421041
Ref: ライブラリ<5>-Footnote-683421098
Ref: ライブラリ<5>-Footnote-693421155
Ref: ライブラリ<5>-Footnote-703421211
Node: ドキュメント<5>3421277
Ref: whatsnew/changelog id273421402
Ref: 17d93421402
Ref: ドキュメント<5>-Footnote-13422110
Ref: ドキュメント<5>-Footnote-23422166
Ref: ドキュメント<5>-Footnote-33422222
Ref: ドキュメント<5>-Footnote-43422268
Ref: ドキュメント<5>-Footnote-53422324
Node: テスト<4>3422380
Ref: whatsnew/changelog id283422499
Ref: 17da3422499
Ref: テスト<4>-Footnote-13423104
Ref: テスト<4>-Footnote-23423160
Ref: テスト<4>-Footnote-33423216
Node: ビルド<4>3423272
Ref: whatsnew/changelog id293423380
Ref: 17db3423380
Ref: ビルド<4>-Footnote-13424351
Ref: ビルド<4>-Footnote-23424407
Ref: ビルド<4>-Footnote-33424463
Ref: ビルド<4>-Footnote-43424519
Ref: ビルド<4>-Footnote-53424575
Node: Windows<3>3424631
Ref: whatsnew/changelog id303424735
Ref: 17dc3424735
Ref: Windows<3>-Footnote-13425115
Ref: Windows<3>-Footnote-23425171
Ref: Windows<3>-Footnote-33425227
Node: macOS<4>3425283
Ref: whatsnew/changelog id313425383
Ref: 17dd3425383
Ref: macOS<4>-Footnote-13425631
Ref: macOS<4>-Footnote-23425687
Node: C API<3>3425743
Ref: whatsnew/changelog id323425824
Ref: 17de3425824
Ref: C API<3>-Footnote-13426385
Ref: C API<3>-Footnote-23426441
Ref: C API<3>-Footnote-33426497
Node: Python 3 14 3 final3426553
Ref: whatsnew/changelog python-3-14-3-final3426677
Ref: 17e23426677
Node: Windows<4>3427071
Ref: whatsnew/changelog id333427157
Ref: 17e33427157
Ref: Windows<4>-Footnote-13427360
Node: Tools/Demos3427416
Ref: whatsnew/changelog tools-demos3427523
Ref: 17e43427523
Ref: Tools/Demos-Footnote-13427742
Node: テスト<5>3427798
Ref: whatsnew/changelog id343427916
Ref: 17e53427916
Ref: テスト<5>-Footnote-13428882
Ref: テスト<5>-Footnote-23428938
Ref: テスト<5>-Footnote-33428994
Ref: テスト<5>-Footnote-43429049
Ref: テスト<5>-Footnote-53429105
Ref: テスト<5>-Footnote-63429161
Node: セキュリティ<6>3429226
Ref: whatsnew/changelog id353429351
Ref: 17e63429351
Ref: セキュリティ<6>-Footnote-13430455
Ref: セキュリティ<6>-Footnote-23430511
Ref: セキュリティ<6>-Footnote-33430567
Ref: セキュリティ<6>-Footnote-43430623
Ref: セキュリティ<6>-Footnote-53430679
Ref: セキュリティ<6>-Footnote-63430735
Node: ライブラリ<6>3430791
Ref: whatsnew/changelog id363430911
Ref: 17e73430911
Ref: ライブラリ<6>-Footnote-13443135
Ref: ライブラリ<6>-Footnote-23443191
Ref: ライブラリ<6>-Footnote-33443247
Ref: ライブラリ<6>-Footnote-43443303
Ref: ライブラリ<6>-Footnote-53443359
Ref: ライブラリ<6>-Footnote-63443415
Ref: ライブラリ<6>-Footnote-73443471
Ref: ライブラリ<6>-Footnote-83443527
Ref: ライブラリ<6>-Footnote-93443583
Ref: ライブラリ<6>-Footnote-103443639
Ref: ライブラリ<6>-Footnote-113443696
Ref: ライブラリ<6>-Footnote-123443753
Ref: ライブラリ<6>-Footnote-133443809
Ref: ライブラリ<6>-Footnote-143443866
Ref: ライブラリ<6>-Footnote-153443923
Ref: ライブラリ<6>-Footnote-163443980
Ref: ライブラリ<6>-Footnote-173444037
Ref: ライブラリ<6>-Footnote-183444094
Ref: ライブラリ<6>-Footnote-193444151
Ref: ライブラリ<6>-Footnote-203444208
Ref: ライブラリ<6>-Footnote-213444265
Ref: ライブラリ<6>-Footnote-223444322
Ref: ライブラリ<6>-Footnote-233444379
Ref: ライブラリ<6>-Footnote-243444436
Ref: ライブラリ<6>-Footnote-253444493
Ref: ライブラリ<6>-Footnote-263444550
Ref: ライブラリ<6>-Footnote-273444607
Ref: ライブラリ<6>-Footnote-283444664
Ref: ライブラリ<6>-Footnote-293444721
Ref: ライブラリ<6>-Footnote-303444778
Ref: ライブラリ<6>-Footnote-313444835
Ref: ライブラリ<6>-Footnote-323444892
Ref: ライブラリ<6>-Footnote-333444949
Ref: ライブラリ<6>-Footnote-343445006
Ref: ライブラリ<6>-Footnote-353445063
Ref: ライブラリ<6>-Footnote-363445120
Ref: ライブラリ<6>-Footnote-373445177
Ref: ライブラリ<6>-Footnote-383445234
Ref: ライブラリ<6>-Footnote-393445291
Ref: ライブラリ<6>-Footnote-403445348
Ref: ライブラリ<6>-Footnote-413445405
Ref: ライブラリ<6>-Footnote-423445462
Ref: ライブラリ<6>-Footnote-433445519
Ref: ライブラリ<6>-Footnote-443445576
Ref: ライブラリ<6>-Footnote-453445633
Ref: ライブラリ<6>-Footnote-463445690
Ref: ライブラリ<6>-Footnote-473445747
Ref: ライブラリ<6>-Footnote-483445804
Ref: ライブラリ<6>-Footnote-493445861
Ref: ライブラリ<6>-Footnote-503445918
Ref: ライブラリ<6>-Footnote-513445975
Ref: ライブラリ<6>-Footnote-523446032
Ref: ライブラリ<6>-Footnote-533446089
Ref: ライブラリ<6>-Footnote-543446146
Ref: ライブラリ<6>-Footnote-553446203
Ref: ライブラリ<6>-Footnote-563446260
Ref: ライブラリ<6>-Footnote-573446316
Ref: ライブラリ<6>-Footnote-583446373
Ref: ライブラリ<6>-Footnote-593446429
Ref: ライブラリ<6>-Footnote-603446486
Ref: ライブラリ<6>-Footnote-613446543
Ref: ライブラリ<6>-Footnote-623446600
Ref: ライブラリ<6>-Footnote-633446657
Ref: ライブラリ<6>-Footnote-643446714
Ref: ライブラリ<6>-Footnote-653446770
Ref: ライブラリ<6>-Footnote-663446827
Ref: ライブラリ<6>-Footnote-673446884
Ref: ライブラリ<6>-Footnote-683446941
Node: IDLE<4>3446998
Ref: whatsnew/changelog id373447118
Ref: 17fb3447118
Ref: IDLE<4>-Footnote-13447267
Node: ドキュメント<6>3447323
Ref: whatsnew/changelog id383447445
Ref: 17fc3447445
Ref: ドキュメント<6>-Footnote-13447598
Node: Core and Builtins<6>3447654
Ref: whatsnew/changelog id393447777
Ref: 17fe3447777
Ref: Core and Builtins<6>-Footnote-13453226
Ref: Core and Builtins<6>-Footnote-23453282
Ref: Core and Builtins<6>-Footnote-33453338
Ref: Core and Builtins<6>-Footnote-43453394
Ref: Core and Builtins<6>-Footnote-53453450
Ref: Core and Builtins<6>-Footnote-63453506
Ref: Core and Builtins<6>-Footnote-73453562
Ref: Core and Builtins<6>-Footnote-83453618
Ref: Core and Builtins<6>-Footnote-93453674
Ref: Core and Builtins<6>-Footnote-103453730
Ref: Core and Builtins<6>-Footnote-113453787
Ref: Core and Builtins<6>-Footnote-123453844
Ref: Core and Builtins<6>-Footnote-133453901
Ref: Core and Builtins<6>-Footnote-143453958
Ref: Core and Builtins<6>-Footnote-153454015
Ref: Core and Builtins<6>-Footnote-163454072
Ref: Core and Builtins<6>-Footnote-173454129
Ref: Core and Builtins<6>-Footnote-183454186
Ref: Core and Builtins<6>-Footnote-193454243
Ref: Core and Builtins<6>-Footnote-203454300
Ref: Core and Builtins<6>-Footnote-213454357
Ref: Core and Builtins<6>-Footnote-223454414
Ref: Core and Builtins<6>-Footnote-233454471
Ref: Core and Builtins<6>-Footnote-243454528
Ref: Core and Builtins<6>-Footnote-253454585
Ref: Core and Builtins<6>-Footnote-263454642
Ref: Core and Builtins<6>-Footnote-273454699
Ref: Core and Builtins<6>-Footnote-283454756
Ref: Core and Builtins<6>-Footnote-293454813
Ref: Core and Builtins<6>-Footnote-303454869
Ref: Core and Builtins<6>-Footnote-313454926
Node: C API<4>3454983
Ref: whatsnew/changelog id403455097
Ref: 18093455097
Ref: C API<4>-Footnote-13455428
Ref: C API<4>-Footnote-23455484
Node: ビルド<5>3455540
Ref: whatsnew/changelog id413455625
Ref: 180a3455625
Ref: ビルド<5>-Footnote-13456359
Ref: ビルド<5>-Footnote-23456415
Ref: ビルド<5>-Footnote-33456471
Node: Python 3 14 2 final3456527
Ref: whatsnew/changelog python-3-14-2-final3456651
Ref: 180b3456651
Node: セキュリティ<7>3456910
Ref: whatsnew/changelog id423457014
Ref: 180c3457014
Ref: セキュリティ<7>-Footnote-13457605
Ref: セキュリティ<7>-Footnote-23457661
Node: ライブラリ<7>3457717
Ref: whatsnew/changelog id433457850
Ref: 180d3457850
Ref: ライブラリ<7>-Footnote-13459239
Ref: ライブラリ<7>-Footnote-23459295
Ref: ライブラリ<7>-Footnote-33459351
Node: Core and Builtins<7>3459407
Ref: whatsnew/changelog id443459537
Ref: 180e3459537
Ref: Core and Builtins<7>-Footnote-13459774
Node: ライブラリ<8>3459830
Ref: whatsnew/changelog id453459933
Ref: 180f3459933
Ref: ライブラリ<8>-Footnote-13460132
Node: Python 3 14 1 final3460188
Ref: whatsnew/changelog python-3-14-1-final3460312
Ref: 18103460312
Node: Windows<5>3461224
Ref: whatsnew/changelog id463461313
Ref: 18113461313
Ref: Windows<5>-Footnote-13461507
Node: Tools/Demos<2>3461563
Ref: whatsnew/changelog id473461673
Ref: 18123461673
Ref: Tools/Demos<2>-Footnote-13462639
Ref: Tools/Demos<2>-Footnote-23462695
Ref: Tools/Demos<2>-Footnote-33462751
Ref: Tools/Demos<2>-Footnote-43462807
Ref: Tools/Demos<2>-Footnote-53462863
Ref: Tools/Demos<2>-Footnote-63462919
Node: テスト<6>3462975
Ref: whatsnew/changelog id483463096
Ref: 18133463096
Ref: テスト<6>-Footnote-13463759
Ref: テスト<6>-Footnote-23463815
Ref: テスト<6>-Footnote-33463871
Ref: テスト<6>-Footnote-43463927
Node: セキュリティ<8>3463983
Ref: whatsnew/changelog id493464108
Ref: 18143464108
Ref: セキュリティ<8>-Footnote-13465825
Ref: セキュリティ<8>-Footnote-23465881
Ref: セキュリティ<8>-Footnote-33465937
Ref: セキュリティ<8>-Footnote-43465993
Ref: セキュリティ<8>-Footnote-53466049
Ref: セキュリティ<8>-Footnote-63466105
Ref: セキュリティ<8>-Footnote-73466161
Node: ライブラリ<9>3466217
Ref: whatsnew/changelog id503466337
Ref: 18173466337
Ref: ライブラリ<9>-Footnote-13486067
Ref: ライブラリ<9>-Footnote-23486122
Ref: ライブラリ<9>-Footnote-33486177
Ref: ライブラリ<9>-Footnote-43486233
Ref: ライブラリ<9>-Footnote-53486288
Ref: ライブラリ<9>-Footnote-63486344
Ref: ライブラリ<9>-Footnote-73486400
Ref: ライブラリ<9>-Footnote-83486456
Ref: ライブラリ<9>-Footnote-93486512
Ref: ライブラリ<9>-Footnote-103486568
Ref: ライブラリ<9>-Footnote-113486625
Ref: ライブラリ<9>-Footnote-123486682
Ref: ライブラリ<9>-Footnote-133486739
Ref: ライブラリ<9>-Footnote-143486796
Ref: ライブラリ<9>-Footnote-153486853
Ref: ライブラリ<9>-Footnote-163486910
Ref: ライブラリ<9>-Footnote-173486967
Ref: ライブラリ<9>-Footnote-183487024
Ref: ライブラリ<9>-Footnote-193487081
Ref: ライブラリ<9>-Footnote-203487138
Ref: ライブラリ<9>-Footnote-213487195
Ref: ライブラリ<9>-Footnote-223487252
Ref: ライブラリ<9>-Footnote-233487309
Ref: ライブラリ<9>-Footnote-243487366
Ref: ライブラリ<9>-Footnote-253487423
Ref: ライブラリ<9>-Footnote-263487480
Ref: ライブラリ<9>-Footnote-273487537
Ref: ライブラリ<9>-Footnote-283487594
Ref: ライブラリ<9>-Footnote-293487651
Ref: ライブラリ<9>-Footnote-303487708
Ref: ライブラリ<9>-Footnote-313487765
Ref: ライブラリ<9>-Footnote-323487822
Ref: ライブラリ<9>-Footnote-333487879
Ref: ライブラリ<9>-Footnote-343487936
Ref: ライブラリ<9>-Footnote-353487993
Ref: ライブラリ<9>-Footnote-363488050
Ref: ライブラリ<9>-Footnote-373488107
Ref: ライブラリ<9>-Footnote-383488164
Ref: ライブラリ<9>-Footnote-393488221
Ref: ライブラリ<9>-Footnote-403488278
Ref: ライブラリ<9>-Footnote-413488335
Ref: ライブラリ<9>-Footnote-423488392
Ref: ライブラリ<9>-Footnote-433488449
Ref: ライブラリ<9>-Footnote-443488506
Ref: ライブラリ<9>-Footnote-453488563
Ref: ライブラリ<9>-Footnote-463488620
Ref: ライブラリ<9>-Footnote-473488677
Ref: ライブラリ<9>-Footnote-483488734
Ref: ライブラリ<9>-Footnote-493488790
Ref: ライブラリ<9>-Footnote-503488846
Ref: ライブラリ<9>-Footnote-513488903
Ref: ライブラリ<9>-Footnote-523488943
Ref: ライブラリ<9>-Footnote-533488985
Ref: ライブラリ<9>-Footnote-543489042
Ref: ライブラリ<9>-Footnote-553489099
Ref: ライブラリ<9>-Footnote-563489156
Ref: ライブラリ<9>-Footnote-573489212
Ref: ライブラリ<9>-Footnote-583489269
Ref: ライブラリ<9>-Footnote-593489326
Ref: ライブラリ<9>-Footnote-603489383
Ref: ライブラリ<9>-Footnote-613489440
Ref: ライブラリ<9>-Footnote-623489497
Ref: ライブラリ<9>-Footnote-633489554
Ref: ライブラリ<9>-Footnote-643489611
Ref: ライブラリ<9>-Footnote-653489668
Ref: ライブラリ<9>-Footnote-663489725
Ref: ライブラリ<9>-Footnote-673489782
Ref: ライブラリ<9>-Footnote-683489825
Ref: ライブラリ<9>-Footnote-693489882
Ref: ライブラリ<9>-Footnote-703489939
Ref: ライブラリ<9>-Footnote-713489996
Ref: ライブラリ<9>-Footnote-723490053
Ref: ライブラリ<9>-Footnote-733490110
Ref: ライブラリ<9>-Footnote-743490167
Ref: ライブラリ<9>-Footnote-753490223
Ref: ライブラリ<9>-Footnote-763490280
Ref: ライブラリ<9>-Footnote-773490336
Ref: ライブラリ<9>-Footnote-783490393
Ref: ライブラリ<9>-Footnote-793490450
Ref: ライブラリ<9>-Footnote-803490507
Ref: ライブラリ<9>-Footnote-813490563
Ref: ライブラリ<9>-Footnote-823490620
Ref: ライブラリ<9>-Footnote-833490677
Ref: ライブラリ<9>-Footnote-843490734
Ref: ライブラリ<9>-Footnote-853490791
Ref: ライブラリ<9>-Footnote-863490848
Ref: ライブラリ<9>-Footnote-873490905
Ref: ライブラリ<9>-Footnote-883490962
Ref: ライブラリ<9>-Footnote-893491019
Ref: ライブラリ<9>-Footnote-903491076
Ref: ライブラリ<9>-Footnote-913491132
Ref: ライブラリ<9>-Footnote-923491188
Ref: ライブラリ<9>-Footnote-933491245
Ref: ライブラリ<9>-Footnote-943491302
Ref: ライブラリ<9>-Footnote-953491359
Ref: ライブラリ<9>-Footnote-963491415
Ref: ライブラリ<9>-Footnote-973491471
Ref: ライブラリ<9>-Footnote-983491528
Ref: ライブラリ<9>-Footnote-993491585
Ref: ライブラリ<9>-Footnote-1003491642
Ref: ライブラリ<9>-Footnote-1013491699
Ref: ライブラリ<9>-Footnote-1023491757
Ref: ライブラリ<9>-Footnote-1033491815
Ref: ライブラリ<9>-Footnote-1043491873
Ref: ライブラリ<9>-Footnote-1053491931
Ref: ライブラリ<9>-Footnote-1063491989
Ref: ライブラリ<9>-Footnote-1073492047
Ref: ライブラリ<9>-Footnote-1083492105
Ref: ライブラリ<9>-Footnote-1093492163
Ref: ライブラリ<9>-Footnote-1103492221
Ref: ライブラリ<9>-Footnote-1113492279
Ref: ライブラリ<9>-Footnote-1123492337
Ref: ライブラリ<9>-Footnote-1133492395
Ref: ライブラリ<9>-Footnote-1143492453
Ref: ライブラリ<9>-Footnote-1153492511
Ref: ライブラリ<9>-Footnote-1163492569
Ref: ライブラリ<9>-Footnote-1173492627
Ref: ライブラリ<9>-Footnote-1183492684
Ref: ライブラリ<9>-Footnote-1193492751
Node: IDLE<5>3492818
Ref: whatsnew/changelog id513492938
Ref: 18363492938
Ref: IDLE<5>-Footnote-13493215
Ref: IDLE<5>-Footnote-23493270
Node: ドキュメント<7>3493326
Ref: whatsnew/changelog id523493448
Ref: 18373493448
Ref: ドキュメント<7>-Footnote-13493935
Ref: ドキュメント<7>-Footnote-23493991
Ref: ドキュメント<7>-Footnote-33494056
Node: Core and Builtins<8>3494112
Ref: whatsnew/changelog id533494246
Ref: 18393494246
Ref: Core and Builtins<8>-Footnote-13494441
Node: ライブラリ<10>3494497
Ref: whatsnew/changelog id543494630
Ref: 183a3494630
Ref: ライブラリ<10>-Footnote-13494821
Node: Core and Builtins<9>3494877
Ref: whatsnew/changelog id553495009
Ref: 183b3495009
Ref: Core and Builtins<9>-Footnote-13496442
Ref: Core and Builtins<9>-Footnote-23496498
Ref: Core and Builtins<9>-Footnote-33496554
Ref: Core and Builtins<9>-Footnote-43496610
Ref: Core and Builtins<9>-Footnote-53496666
Ref: Core and Builtins<9>-Footnote-63496722
Ref: Core and Builtins<9>-Footnote-73496778
Ref: Core and Builtins<9>-Footnote-83496834
Node: ライブラリ<11>3496890
Ref: whatsnew/changelog id563497024
Ref: 183d3497024
Ref: ライブラリ<11>-Footnote-13497201
Node: Core and Builtins<10>3497257
Ref: whatsnew/changelog id573497390
Ref: 183e3497390
Ref: Core and Builtins<10>-Footnote-13497677
Node: ライブラリ<12>3497733
Ref: whatsnew/changelog id583497868
Ref: 183f3497868
Ref: ライブラリ<12>-Footnote-13498089
Node: Core and Builtins<11>3498145
Ref: whatsnew/changelog id593498278
Ref: 18403498278
Ref: Core and Builtins<11>-Footnote-13499550
Ref: Core and Builtins<11>-Footnote-23499606
Ref: Core and Builtins<11>-Footnote-33499662
Ref: Core and Builtins<11>-Footnote-43499718
Ref: Core and Builtins<11>-Footnote-53499774
Ref: Core and Builtins<11>-Footnote-63499830
Ref: Core and Builtins<11>-Footnote-73499886
Node: ライブラリ<13>3499942
Ref: whatsnew/changelog id603500077
Ref: 18433500077
Ref: ライブラリ<13>-Footnote-13500420
Node: Core and Builtins<12>3500476
Ref: whatsnew/changelog id613500609
Ref: 18473500609
Ref: Core and Builtins<12>-Footnote-13503901
Ref: Core and Builtins<12>-Footnote-23503957
Ref: Core and Builtins<12>-Footnote-33504013
Ref: Core and Builtins<12>-Footnote-43504069
Ref: Core and Builtins<12>-Footnote-53504125
Ref: Core and Builtins<12>-Footnote-63504181
Ref: Core and Builtins<12>-Footnote-73504237
Ref: Core and Builtins<12>-Footnote-83504293
Ref: Core and Builtins<12>-Footnote-93504349
Ref: Core and Builtins<12>-Footnote-103504405
Ref: Core and Builtins<12>-Footnote-113504462
Ref: Core and Builtins<12>-Footnote-123504519
Ref: Core and Builtins<12>-Footnote-133504576
Ref: Core and Builtins<12>-Footnote-143504633
Ref: Core and Builtins<12>-Footnote-153504690
Ref: Core and Builtins<12>-Footnote-163504747
Ref: Core and Builtins<12>-Footnote-173504790
Ref: Core and Builtins<12>-Footnote-183504847
Node: ライブラリ<14>3504903
Ref: whatsnew/changelog id623505038
Ref: 18483505038
Ref: ライブラリ<14>-Footnote-13505220
Node: Core and Builtins<13>3505276
Ref: whatsnew/changelog id633505409
Ref: 18493505409
Ref: Core and Builtins<13>-Footnote-13506273
Ref: Core and Builtins<13>-Footnote-23506329
Ref: Core and Builtins<13>-Footnote-33506385
Ref: Core and Builtins<13>-Footnote-43506441
Ref: Core and Builtins<13>-Footnote-53506497
Node: ライブラリ<15>3506552
Ref: whatsnew/changelog id643506687
Ref: 184b3506687
Ref: ライブラリ<15>-Footnote-13507054
Ref: ライブラリ<15>-Footnote-23507110
Node: Core and Builtins<14>3507166
Ref: whatsnew/changelog id653507288
Ref: 184c3507288
Ref: Core and Builtins<14>-Footnote-13508500
Ref: Core and Builtins<14>-Footnote-23508556
Ref: Core and Builtins<14>-Footnote-33508612
Ref: Core and Builtins<14>-Footnote-43508667
Ref: Core and Builtins<14>-Footnote-53508723
Ref: Core and Builtins<14>-Footnote-63508779
Node: C API<5>3508835
Ref: whatsnew/changelog id663508950
Ref: 184d3508950
Ref: C API<5>-Footnote-13510286
Ref: C API<5>-Footnote-23510342
Ref: C API<5>-Footnote-33510398
Ref: C API<5>-Footnote-43510454
Ref: C API<5>-Footnote-53510510
Ref: C API<5>-Footnote-63510566
Node: ビルド<6>3510622
Ref: whatsnew/changelog id673510707
Ref: 184f3510707
Ref: ビルド<6>-Footnote-13512078
Ref: ビルド<6>-Footnote-23512134
Ref: ビルド<6>-Footnote-33512190
Ref: ビルド<6>-Footnote-43512246
Ref: ビルド<6>-Footnote-53512302
Ref: ビルド<6>-Footnote-63512358
Ref: ビルド<6>-Footnote-73512414
Ref: ビルド<6>-Footnote-83512470
Node: Python 3 14 0 final3512526
Ref: whatsnew/changelog python-3-14-0-final3512664
Ref: 18503512664
Node: macOS<5>3512915
Ref: whatsnew/changelog id683512998
Ref: 18513512998
Ref: macOS<5>-Footnote-13513196
Ref: macOS<5>-Footnote-23513252
Node: Windows<6>3513308
Ref: whatsnew/changelog id693513414
Ref: 18523513414
Ref: Windows<6>-Footnote-13513551
Node: Tools/Demos<3>3513607
Ref: whatsnew/changelog id703513726
Ref: 18533513726
Ref: Tools/Demos<3>-Footnote-13514345
Ref: Tools/Demos<3>-Footnote-23514401
Ref: Tools/Demos<3>-Footnote-33514457
Node: セキュリティ<9>3514513
Ref: whatsnew/changelog id713514641
Ref: 18543514641
Ref: セキュリティ<9>-Footnote-13514988
Node: ライブラリ<16>3515044
Ref: whatsnew/changelog id723515149
Ref: 18553515149
Ref: ライブラリ<16>-Footnote-13515285
Node: Python 3 14 0 release candidate 33515341
Ref: whatsnew/changelog python-3-14-0-release-candidate-33515493
Ref: 18563515493
Node: Windows<7>3515800
Ref: whatsnew/changelog id733515903
Ref: 18573515903
Ref: Windows<7>-Footnote-13516064
Node: Tools/Demos<4>3516120
Ref: whatsnew/changelog id743516254
Ref: 18583516254
Ref: Tools/Demos<4>-Footnote-13516526
Node: セキュリティ<10>3516582
Ref: whatsnew/changelog id753516725
Ref: 18593516725
Ref: セキュリティ<10>-Footnote-13517221
Node: ライブラリ<17>3517277
Ref: whatsnew/changelog id763517427
Ref: 185a3517427
Ref: ライブラリ<17>-Footnote-13519920
Ref: ライブラリ<17>-Footnote-23519976
Ref: ライブラリ<17>-Footnote-33520032
Ref: ライブラリ<17>-Footnote-43520088
Ref: ライブラリ<17>-Footnote-53520144
Ref: ライブラリ<17>-Footnote-63520200
Ref: ライブラリ<17>-Footnote-73520256
Ref: ライブラリ<17>-Footnote-83520312
Ref: ライブラリ<17>-Footnote-93520367
Ref: ライブラリ<17>-Footnote-103520423
Ref: ライブラリ<17>-Footnote-113520480
Ref: ライブラリ<17>-Footnote-123520537
Ref: ライブラリ<17>-Footnote-133520593
Ref: ライブラリ<17>-Footnote-143520650
Ref: ライブラリ<17>-Footnote-153520707
Node: Core and Builtins<15>3520764
Ref: whatsnew/changelog id773520883
Ref: 185e3520883
Ref: Core and Builtins<15>-Footnote-13522565
Ref: Core and Builtins<15>-Footnote-23522620
Ref: Core and Builtins<15>-Footnote-33522676
Ref: Core and Builtins<15>-Footnote-43522732
Ref: Core and Builtins<15>-Footnote-53522788
Ref: Core and Builtins<15>-Footnote-63522844
Ref: Core and Builtins<15>-Footnote-73522900
Ref: Core and Builtins<15>-Footnote-83522956
Ref: Core and Builtins<15>-Footnote-93523012
Ref: Core and Builtins<15>-Footnote-103523068
Ref: Core and Builtins<15>-Footnote-113523125
Node: Python 3 14 0 release candidate 23523182
Ref: whatsnew/changelog python-3-14-0-release-candidate-23523348
Ref: 18613523348
Node: macOS<6>3523688
Ref: whatsnew/changelog id783523785
Ref: 18623523785
Ref: macOS<6>-Footnote-13524177
Ref: macOS<6>-Footnote-23524233
Node: Windows<8>3524289
Ref: whatsnew/changelog id793524414
Ref: 18633524414
Ref: Windows<8>-Footnote-13524560
Node: ライブラリ<18>3524616
Ref: whatsnew/changelog id803524754
Ref: 18643524754
Ref: ライブラリ<18>-Footnote-13526311
Ref: ライブラリ<18>-Footnote-23526367
Ref: ライブラリ<18>-Footnote-33526423
Ref: ライブラリ<18>-Footnote-43526479
Ref: ライブラリ<18>-Footnote-53526535
Ref: ライブラリ<18>-Footnote-63526591
Ref: ライブラリ<18>-Footnote-73526647
Ref: ライブラリ<18>-Footnote-83526703
Ref: ライブラリ<18>-Footnote-93526759
Node: ドキュメント<8>3526815
Ref: whatsnew/changelog id813526964
Ref: 18653526964
Ref: ドキュメント<8>-Footnote-13527137
Node: Core and Builtins<16>3527193
Ref: whatsnew/changelog id823527331
Ref: 18663527331
Ref: Core and Builtins<16>-Footnote-13528962
Ref: Core and Builtins<16>-Footnote-23529018
Ref: Core and Builtins<16>-Footnote-33529074
Ref: Core and Builtins<16>-Footnote-43529130
Ref: Core and Builtins<16>-Footnote-53529186
Ref: Core and Builtins<16>-Footnote-63529242
Ref: Core and Builtins<16>-Footnote-73529298
Node: C API<6>3529354
Ref: whatsnew/changelog id833529483
Ref: 18673529483
Ref: C API<6>-Footnote-13529683
Node: ビルド<7>3529739
Ref: whatsnew/changelog id843529838
Ref: 18693529838
Ref: ビルド<7>-Footnote-13529961
Node: Python 3 14 0 release candidate 13530017
Ref: whatsnew/changelog python-3-14-0-release-candidate-13530170
Ref: 186a3530170
Node: Tools/Demos<5>3530668
Ref: whatsnew/changelog id853530783
Ref: 186b3530783
Ref: Tools/Demos<5>-Footnote-13530966
Node: セキュリティ<11>3531022
Ref: whatsnew/changelog id863531165
Ref: 186c3531165
Ref: セキュリティ<11>-Footnote-13531560
Ref: セキュリティ<11>-Footnote-23531616
Node: ライブラリ<19>3531672
Ref: whatsnew/changelog id873531822
Ref: 186d3531822
Ref: ライブラリ<19>-Footnote-13533599
Ref: ライブラリ<19>-Footnote-23533655
Ref: ライブラリ<19>-Footnote-33533711
Ref: ライブラリ<19>-Footnote-43533767
Ref: ライブラリ<19>-Footnote-53533823
Ref: ライブラリ<19>-Footnote-63533879
Ref: ライブラリ<19>-Footnote-73533935
Ref: ライブラリ<19>-Footnote-83533990
Ref: ライブラリ<19>-Footnote-93534046
Ref: ライブラリ<19>-Footnote-103534102
Ref: ライブラリ<19>-Footnote-113534159
Ref: ライブラリ<19>-Footnote-123534216
Ref: ライブラリ<19>-Footnote-133534273
Node: Core and Builtins<17>3534330
Ref: whatsnew/changelog id883534477
Ref: 186e3534477
Ref: Core and Builtins<17>-Footnote-13534694
Node: ライブラリ<20>3534750
Ref: whatsnew/changelog id893534899
Ref: 186f3534899
Ref: ライブラリ<20>-Footnote-13535070
Node: Core and Builtins<18>3535126
Ref: whatsnew/changelog id903535273
Ref: 18703535273
Ref: Core and Builtins<18>-Footnote-13536215
Ref: Core and Builtins<18>-Footnote-23536271
Ref: Core and Builtins<18>-Footnote-33536327
Ref: Core and Builtins<18>-Footnote-43536383
Ref: Core and Builtins<18>-Footnote-53536439
Ref: Core and Builtins<18>-Footnote-63536495
Node: ライブラリ<21>3536537
Ref: whatsnew/changelog id913536686
Ref: 18713536686
Ref: ライブラリ<21>-Footnote-13536880
Node: Core and Builtins<19>3536936
Ref: whatsnew/changelog id923537072
Ref: 18723537072
Ref: Core and Builtins<19>-Footnote-13537740
Ref: Core and Builtins<19>-Footnote-23537796
Ref: Core and Builtins<19>-Footnote-33537852
Ref: Core and Builtins<19>-Footnote-43537907
Node: C API<7>3537963
Ref: whatsnew/changelog id933538092
Ref: 18733538092
Ref: C API<7>-Footnote-13538553
Ref: C API<7>-Footnote-23538609
Ref: C API<7>-Footnote-33538665
Node: ビルド<8>3538721
Ref: whatsnew/changelog id943538820
Ref: 18753538820
Ref: ビルド<8>-Footnote-13539020
Node: Python 3 14 0 beta 43539076
Ref: whatsnew/changelog python-3-14-0-beta-43539216
Ref: 18763539216
Node: Tools/Demos<6>3539592
Ref: whatsnew/changelog id953539684
Ref: 18773539684
Ref: Tools/Demos<6>-Footnote-13540078
Ref: Tools/Demos<6>-Footnote-23540134
Node: テスト<7>3540190
Ref: whatsnew/changelog id963540313
Ref: 18783540313
Ref: テスト<7>-Footnote-13540606
Ref: テスト<7>-Footnote-23540662
Node: セキュリティ<12>3540718
Ref: whatsnew/changelog id973540846
Ref: 18793540846
Ref: セキュリティ<12>-Footnote-13542746
Ref: セキュリティ<12>-Footnote-23542802
Ref: セキュリティ<12>-Footnote-33542858
Ref: セキュリティ<12>-Footnote-43542914
Node: ライブラリ<22>3542970
Ref: whatsnew/changelog id983543107
Ref: 187a3543107
Ref: ライブラリ<22>-Footnote-13547818
Ref: ライブラリ<22>-Footnote-23547874
Ref: ライブラリ<22>-Footnote-33547930
Ref: ライブラリ<22>-Footnote-43547985
Ref: ライブラリ<22>-Footnote-53548041
Ref: ライブラリ<22>-Footnote-63548097
Ref: ライブラリ<22>-Footnote-73548152
Ref: ライブラリ<22>-Footnote-83548207
Ref: ライブラリ<22>-Footnote-93548263
Ref: ライブラリ<22>-Footnote-103548319
Ref: ライブラリ<22>-Footnote-113548376
Ref: ライブラリ<22>-Footnote-123548433
Ref: ライブラリ<22>-Footnote-133548490
Ref: ライブラリ<22>-Footnote-143548547
Ref: ライブラリ<22>-Footnote-153548604
Ref: ライブラリ<22>-Footnote-163548661
Ref: ライブラリ<22>-Footnote-173548718
Ref: ライブラリ<22>-Footnote-183548775
Ref: ライブラリ<22>-Footnote-193548832
Ref: ライブラリ<22>-Footnote-203548889
Ref: ライブラリ<22>-Footnote-213548946
Ref: ライブラリ<22>-Footnote-223549003
Ref: ライブラリ<22>-Footnote-233549060
Ref: ライブラリ<22>-Footnote-243549117
Ref: ライブラリ<22>-Footnote-253549173
Ref: ライブラリ<22>-Footnote-263549229
Node: ドキュメント<9>3549286
Ref: whatsnew/changelog id993549422
Ref: 187f3549422
Ref: ドキュメント<9>-Footnote-13549598
Node: Core and Builtins<20>3549654
Ref: whatsnew/changelog id1003549779
Ref: 18803549779
Ref: Core and Builtins<20>-Footnote-13551219
Ref: Core and Builtins<20>-Footnote-23551275
Ref: Core and Builtins<20>-Footnote-33551330
Ref: Core and Builtins<20>-Footnote-43551386
Ref: Core and Builtins<20>-Footnote-53551442
Ref: Core and Builtins<20>-Footnote-63551498
Ref: Core and Builtins<20>-Footnote-73551554
Ref: Core and Builtins<20>-Footnote-83551610
Ref: Core and Builtins<20>-Footnote-93551666
Node: C API<8>3551722
Ref: whatsnew/changelog id1013551838
Ref: 18813551838
Ref: C API<8>-Footnote-13552012
Node: ビルド<9>3552068
Ref: whatsnew/changelog id1023552154
Ref: 18823552154
Ref: ビルド<9>-Footnote-13552330
Node: Python 3 14 0 beta 33552386
Ref: whatsnew/changelog python-3-14-0-beta-33552513
Ref: 18833552513
Node: Windows<9>3553135
Ref: whatsnew/changelog id1033553223
Ref: 18843553223
Ref: Windows<9>-Footnote-13553478
Node: テスト<8>3553534
Ref: whatsnew/changelog id1043553653
Ref: 18853553653
Ref: テスト<8>-Footnote-13553991
Ref: テスト<8>-Footnote-23554047
Ref: テスト<8>-Footnote-33554103
Node: セキュリティ<13>3554159
Ref: whatsnew/changelog id1053554287
Ref: 18863554287
Ref: セキュリティ<13>-Footnote-13554944
Ref: セキュリティ<13>-Footnote-23555000
Ref: セキュリティ<13>-Footnote-33555056
Ref: セキュリティ<13>-Footnote-43555112
Ref: セキュリティ<13>-Footnote-53555167
Ref: セキュリティ<13>-Footnote-63555222
Node: ライブラリ<23>3555277
Ref: whatsnew/changelog id1063555415
Ref: 18873555415
Ref: ライブラリ<23>-Footnote-13559757
Ref: ライブラリ<23>-Footnote-23559812
Ref: ライブラリ<23>-Footnote-33559868
Ref: ライブラリ<23>-Footnote-43559924
Ref: ライブラリ<23>-Footnote-53559980
Ref: ライブラリ<23>-Footnote-63560036
Ref: ライブラリ<23>-Footnote-73560092
Ref: ライブラリ<23>-Footnote-83560148
Ref: ライブラリ<23>-Footnote-93560204
Ref: ライブラリ<23>-Footnote-103560260
Ref: ライブラリ<23>-Footnote-113560336
Ref: ライブラリ<23>-Footnote-123560393
Ref: ライブラリ<23>-Footnote-133560450
Ref: ライブラリ<23>-Footnote-143560507
Ref: ライブラリ<23>-Footnote-153560550
Ref: ライブラリ<23>-Footnote-163560607
Ref: ライブラリ<23>-Footnote-173560664
Ref: ライブラリ<23>-Footnote-183560721
Ref: ライブラリ<23>-Footnote-193560778
Ref: ライブラリ<23>-Footnote-203560835
Ref: ライブラリ<23>-Footnote-213560892
Ref: ライブラリ<23>-Footnote-223560952
Ref: ライブラリ<23>-Footnote-233561009
Ref: ライブラリ<23>-Footnote-243561066
Ref: ライブラリ<23>-Footnote-253561123
Ref: ライブラリ<23>-Footnote-263561180
Ref: ライブラリ<23>-Footnote-273561237
Ref: ライブラリ<23>-Footnote-283561294
Ref: ライブラリ<23>-Footnote-293561351
Node: ドキュメント<10>3561408
Ref: whatsnew/changelog id1073561545
Ref: 188e3561545
Ref: ドキュメント<10>-Footnote-13561902
Ref: ドキュメント<10>-Footnote-23561958
Node: Core and Builtins<21>3562023
Ref: whatsnew/changelog id1083562160
Ref: 188f3562160
Ref: Core and Builtins<21>-Footnote-13562668
Ref: Core and Builtins<21>-Footnote-23562724
Node: ライブラリ<24>3562780
Ref: whatsnew/changelog id1093562916
Ref: 18903562916
Ref: ライブラリ<24>-Footnote-13563225
Node: Core and Builtins<22>3563281
Ref: whatsnew/changelog id1103563415
Ref: 18913563415
Ref: Core and Builtins<22>-Footnote-13564316
Ref: Core and Builtins<22>-Footnote-23564372
Ref: Core and Builtins<22>-Footnote-33564428
Node: ライブラリ<25>3564484
Ref: whatsnew/changelog id1113564620
Ref: 18923564620
Ref: ライブラリ<25>-Footnote-13564814
Node: Core and Builtins<23>3564870
Ref: whatsnew/changelog id1123565004
Ref: 18933565004
Ref: Core and Builtins<23>-Footnote-13565362
Ref: Core and Builtins<23>-Footnote-23565418
Ref: Core and Builtins<23>-Footnote-33565460
Node: ライブラリ<26>3565516
Ref: whatsnew/changelog id1133565652
Ref: 18943565652
Ref: ライブラリ<26>-Footnote-13565854
Node: Core and Builtins<24>3565910
Ref: whatsnew/changelog id1143566033
Ref: 18953566033
Ref: Core and Builtins<24>-Footnote-13566839
Ref: Core and Builtins<24>-Footnote-23566895
Ref: Core and Builtins<24>-Footnote-33566951
Ref: Core and Builtins<24>-Footnote-43567007
Node: C API<9>3567063
Ref: whatsnew/changelog id1153567180
Ref: 18963567180
Ref: C API<9>-Footnote-13568019
Ref: C API<9>-Footnote-23568075
Ref: C API<9>-Footnote-33568131
Node: ビルド<10>3568187
Ref: whatsnew/changelog id1163568274
Ref: 18993568274
Ref: ビルド<10>-Footnote-13569094
Ref: ビルド<10>-Footnote-23569150
Ref: ビルド<10>-Footnote-33569206
Ref: ビルド<10>-Footnote-43569262
Ref: ビルド<10>-Footnote-53569318
Ref: ビルド<10>-Footnote-63569374
Node: Python 3 14 0 beta 23569416
Ref: whatsnew/changelog python-3-14-0-beta-23569543
Ref: 189b3569543
Node: Windows<10>3569900
Ref: whatsnew/changelog id1173569991
Ref: 189c3569991
Ref: Windows<10>-Footnote-13570935
Ref: Windows<10>-Footnote-23570991
Ref: Windows<10>-Footnote-33571046
Ref: Windows<10>-Footnote-43571102
Node: Tools/Demos<7>3571158
Ref: whatsnew/changelog id1183571270
Ref: 189d3571270
Ref: Tools/Demos<7>-Footnote-13571470
Node: テスト<9>3571526
Ref: whatsnew/changelog id1193571649
Ref: 189e3571649
Ref: テスト<9>-Footnote-13572278
Ref: テスト<9>-Footnote-23572334
Ref: テスト<9>-Footnote-33572390
Node: セキュリティ<14>3572446
Ref: whatsnew/changelog id1203572574
Ref: 189f3572574
Ref: セキュリティ<14>-Footnote-13572957
Ref: セキュリティ<14>-Footnote-23573013
Node: ライブラリ<27>3573069
Ref: whatsnew/changelog id1213573206
Ref: 18a03573206
Ref: ライブラリ<27>-Footnote-13581133
Ref: ライブラリ<27>-Footnote-23581189
Ref: ライブラリ<27>-Footnote-33581244
Ref: ライブラリ<27>-Footnote-43581300
Ref: ライブラリ<27>-Footnote-53581356
Ref: ライブラリ<27>-Footnote-63581412
Ref: ライブラリ<27>-Footnote-73581468
Ref: ライブラリ<27>-Footnote-83581523
Ref: ライブラリ<27>-Footnote-93581579
Ref: ライブラリ<27>-Footnote-103581634
Ref: ライブラリ<27>-Footnote-113581691
Ref: ライブラリ<27>-Footnote-123581748
Ref: ライブラリ<27>-Footnote-133581805
Ref: ライブラリ<27>-Footnote-143581862
Ref: ライブラリ<27>-Footnote-153581918
Ref: ライブラリ<27>-Footnote-163581975
Ref: ライブラリ<27>-Footnote-173582032
Ref: ライブラリ<27>-Footnote-183582089
Ref: ライブラリ<27>-Footnote-193582146
Ref: ライブラリ<27>-Footnote-203582203
Ref: ライブラリ<27>-Footnote-213582260
Ref: ライブラリ<27>-Footnote-223582317
Ref: ライブラリ<27>-Footnote-233582374
Ref: ライブラリ<27>-Footnote-243582430
Ref: ライブラリ<27>-Footnote-253582487
Ref: ライブラリ<27>-Footnote-263582544
Ref: ライブラリ<27>-Footnote-273582601
Ref: ライブラリ<27>-Footnote-283582658
Ref: ライブラリ<27>-Footnote-293582715
Ref: ライブラリ<27>-Footnote-303582772
Ref: ライブラリ<27>-Footnote-313582828
Ref: ライブラリ<27>-Footnote-323582885
Ref: ライブラリ<27>-Footnote-333582942
Ref: ライブラリ<27>-Footnote-343582999
Ref: ライブラリ<27>-Footnote-353583056
Ref: ライブラリ<27>-Footnote-363583099
Ref: ライブラリ<27>-Footnote-373583156
Ref: ライブラリ<27>-Footnote-383583213
Ref: ライブラリ<27>-Footnote-393583270
Ref: ライブラリ<27>-Footnote-403583327
Ref: ライブラリ<27>-Footnote-413583383
Ref: ライブラリ<27>-Footnote-423583440
Ref: ライブラリ<27>-Footnote-433583496
Ref: ライブラリ<27>-Footnote-443583552
Ref: ライブラリ<27>-Footnote-453583608
Ref: ライブラリ<27>-Footnote-463583674
Node: Core and Builtins<25>3583731
Ref: whatsnew/changelog id1223583855
Ref: 18a73583855
Ref: Core and Builtins<25>-Footnote-13586226
Ref: Core and Builtins<25>-Footnote-23586282
Ref: Core and Builtins<25>-Footnote-33586338
Ref: Core and Builtins<25>-Footnote-43586394
Ref: Core and Builtins<25>-Footnote-53586449
Ref: Core and Builtins<25>-Footnote-63586505
Ref: Core and Builtins<25>-Footnote-73586561
Ref: Core and Builtins<25>-Footnote-83586617
Ref: Core and Builtins<25>-Footnote-93586673
Ref: Core and Builtins<25>-Footnote-103586729
Ref: Core and Builtins<25>-Footnote-113586786
Ref: Core and Builtins<25>-Footnote-123586843
Ref: Core and Builtins<25>-Footnote-133586900
Ref: Core and Builtins<25>-Footnote-143586957
Ref: Core and Builtins<25>-Footnote-153587014
Ref: Core and Builtins<25>-Footnote-163587071
Ref: Core and Builtins<25>-Footnote-173587128
Node: C API<10>3587173
Ref: whatsnew/changelog id1233587291
Ref: 18a93587291
Ref: C API<10>-Footnote-13587530
Node: ビルド<11>3587586
Ref: whatsnew/changelog id1243587674
Ref: 18ac3587674
Ref: ビルド<11>-Footnote-13588111
Ref: ビルド<11>-Footnote-23588167
Ref: ビルド<11>-Footnote-33588209
Ref: ビルド<11>-Footnote-43588265
Node: Python 3 14 0 beta 13588321
Ref: whatsnew/changelog python-3-14-0-beta-13588449
Ref: 18ad3588449
Node: Windows<11>3589078
Ref: whatsnew/changelog id1253589169
Ref: 18ae3589169
Ref: Windows<11>-Footnote-13589501
Ref: Windows<11>-Footnote-23589557
Node: Tools/Demos<8>3589613
Ref: whatsnew/changelog id1263589726
Ref: 18af3589726
Ref: Tools/Demos<8>-Footnote-13590043
Ref: Tools/Demos<8>-Footnote-23590099
Node: テスト<10>3590155
Ref: whatsnew/changelog id1273590279
Ref: 18b03590279
Ref: テスト<10>-Footnote-13591257
Ref: テスト<10>-Footnote-23591313
Ref: テスト<10>-Footnote-33591368
Ref: テスト<10>-Footnote-43591424
Ref: テスト<10>-Footnote-53591480
Node: セキュリティ<15>3591536
Ref: whatsnew/changelog id1283591665
Ref: 18b13591665
Ref: セキュリティ<15>-Footnote-13592187
Node: ライブラリ<28>3592243
Ref: whatsnew/changelog id1293592366
Ref: 18b23592366
Ref: ライブラリ<28>-Footnote-13611750
Ref: ライブラリ<28>-Footnote-23611806
Ref: ライブラリ<28>-Footnote-33611862
Ref: ライブラリ<28>-Footnote-43611918
Ref: ライブラリ<28>-Footnote-53611974
Ref: ライブラリ<28>-Footnote-63612030
Ref: ライブラリ<28>-Footnote-73612086
Ref: ライブラリ<28>-Footnote-83612142
Ref: ライブラリ<28>-Footnote-93612198
Ref: ライブラリ<28>-Footnote-103612254
Ref: ライブラリ<28>-Footnote-113612311
Ref: ライブラリ<28>-Footnote-123612368
Ref: ライブラリ<28>-Footnote-133612425
Ref: ライブラリ<28>-Footnote-143612482
Ref: ライブラリ<28>-Footnote-153612539
Ref: ライブラリ<28>-Footnote-163612596
Ref: ライブラリ<28>-Footnote-173612653
Ref: ライブラリ<28>-Footnote-183612710
Ref: ライブラリ<28>-Footnote-193612767
Ref: ライブラリ<28>-Footnote-203612824
Ref: ライブラリ<28>-Footnote-213612881
Ref: ライブラリ<28>-Footnote-223612938
Ref: ライブラリ<28>-Footnote-233612995
Ref: ライブラリ<28>-Footnote-243613052
Ref: ライブラリ<28>-Footnote-253613109
Ref: ライブラリ<28>-Footnote-263613166
Ref: ライブラリ<28>-Footnote-273613223
Ref: ライブラリ<28>-Footnote-283613280
Ref: ライブラリ<28>-Footnote-293613337
Ref: ライブラリ<28>-Footnote-303613394
Ref: ライブラリ<28>-Footnote-313613451
Ref: ライブラリ<28>-Footnote-323613508
Ref: ライブラリ<28>-Footnote-333613564
Ref: ライブラリ<28>-Footnote-343613621
Ref: ライブラリ<28>-Footnote-353613678
Ref: ライブラリ<28>-Footnote-363613735
Ref: ライブラリ<28>-Footnote-373613792
Ref: ライブラリ<28>-Footnote-383613849
Ref: ライブラリ<28>-Footnote-393613906
Ref: ライブラリ<28>-Footnote-403613963
Ref: ライブラリ<28>-Footnote-413614020
Ref: ライブラリ<28>-Footnote-423614077
Ref: ライブラリ<28>-Footnote-433614134
Ref: ライブラリ<28>-Footnote-443614191
Ref: ライブラリ<28>-Footnote-453614248
Ref: ライブラリ<28>-Footnote-463614305
Ref: ライブラリ<28>-Footnote-473614362
Ref: ライブラリ<28>-Footnote-483614418
Ref: ライブラリ<28>-Footnote-493614475
Ref: ライブラリ<28>-Footnote-503614532
Ref: ライブラリ<28>-Footnote-513614589
Ref: ライブラリ<28>-Footnote-523614645
Ref: ライブラリ<28>-Footnote-533614702
Ref: ライブラリ<28>-Footnote-543614759
Ref: ライブラリ<28>-Footnote-553614816
Ref: ライブラリ<28>-Footnote-563614873
Ref: ライブラリ<28>-Footnote-573614930
Ref: ライブラリ<28>-Footnote-583614987
Ref: ライブラリ<28>-Footnote-593615044
Ref: ライブラリ<28>-Footnote-603615101
Ref: ライブラリ<28>-Footnote-613615158
Ref: ライブラリ<28>-Footnote-623615215
Ref: ライブラリ<28>-Footnote-633615272
Ref: ライブラリ<28>-Footnote-643615329
Ref: ライブラリ<28>-Footnote-653615386
Ref: ライブラリ<28>-Footnote-663615443
Ref: ライブラリ<28>-Footnote-673615500
Ref: ライブラリ<28>-Footnote-683615557
Ref: ライブラリ<28>-Footnote-693615614
Ref: ライブラリ<28>-Footnote-703615671
Ref: ライブラリ<28>-Footnote-713615731
Ref: ライブラリ<28>-Footnote-723615788
Ref: ライブラリ<28>-Footnote-733615845
Ref: ライブラリ<28>-Footnote-743615901
Ref: ライブラリ<28>-Footnote-753615958
Ref: ライブラリ<28>-Footnote-763616015
Ref: ライブラリ<28>-Footnote-773616072
Ref: ライブラリ<28>-Footnote-783616129
Ref: ライブラリ<28>-Footnote-793616186
Ref: ライブラリ<28>-Footnote-803616242
Ref: ライブラリ<28>-Footnote-813616299
Ref: ライブラリ<28>-Footnote-823616356
Ref: ライブラリ<28>-Footnote-833616412
Ref: ライブラリ<28>-Footnote-843616469
Ref: ライブラリ<28>-Footnote-853616526
Ref: ライブラリ<28>-Footnote-863616583
Ref: ライブラリ<28>-Footnote-873616640
Ref: ライブラリ<28>-Footnote-883616697
Ref: ライブラリ<28>-Footnote-893616753
Ref: ライブラリ<28>-Footnote-903616810
Ref: ライブラリ<28>-Footnote-913616867
Ref: ライブラリ<28>-Footnote-923616924
Ref: ライブラリ<28>-Footnote-933616981
Ref: ライブラリ<28>-Footnote-943617038
Ref: ライブラリ<28>-Footnote-953617095
Ref: ライブラリ<28>-Footnote-963617152
Ref: ライブラリ<28>-Footnote-973617209
Ref: ライブラリ<28>-Footnote-983617266
Ref: ライブラリ<28>-Footnote-993617323
Ref: ライブラリ<28>-Footnote-1003617380
Ref: ライブラリ<28>-Footnote-1013617437
Ref: ライブラリ<28>-Footnote-1023617495
Ref: ライブラリ<28>-Footnote-1033617553
Ref: ライブラリ<28>-Footnote-1043617610
Ref: ライブラリ<28>-Footnote-1053617668
Ref: ライブラリ<28>-Footnote-1063617726
Ref: ライブラリ<28>-Footnote-1073617793
Node: IDLE<6>3617850
Ref: whatsnew/changelog id1303617973
Ref: 18c23617973
Ref: IDLE<6>-Footnote-13618113
Node: ドキュメント<11>3618169
Ref: whatsnew/changelog id1313618294
Ref: 18c33618294
Ref: ドキュメント<11>-Footnote-13618657
Ref: ドキュメント<11>-Footnote-23618713
Node: Core and Builtins<26>3618769
Ref: whatsnew/changelog id1323618906
Ref: 18c53618906
Ref: Core and Builtins<26>-Footnote-13620536
Ref: Core and Builtins<26>-Footnote-23620592
Ref: Core and Builtins<26>-Footnote-33620648
Ref: Core and Builtins<26>-Footnote-43620704
Ref: Core and Builtins<26>-Footnote-53620760
Ref: Core and Builtins<26>-Footnote-63620815
Ref: Core and Builtins<26>-Footnote-73620871
Ref: Core and Builtins<26>-Footnote-83620927
Node: ライブラリ<29>3620983
Ref: whatsnew/changelog id1333621119
Ref: 18c73621119
Ref: ライブラリ<29>-Footnote-13621332
Ref: ライブラリ<29>-Footnote-23621388
Node: Core and Builtins<27>3621430
Ref: whatsnew/changelog id1343621564
Ref: 18c83621564
Ref: Core and Builtins<27>-Footnote-13624117
Ref: Core and Builtins<27>-Footnote-23624173
Ref: Core and Builtins<27>-Footnote-33624229
Ref: Core and Builtins<27>-Footnote-43624285
Ref: Core and Builtins<27>-Footnote-53624341
Ref: Core and Builtins<27>-Footnote-63624397
Ref: Core and Builtins<27>-Footnote-73624453
Ref: Core and Builtins<27>-Footnote-83624509
Ref: Core and Builtins<27>-Footnote-93624565
Ref: Core and Builtins<27>-Footnote-103624621
Ref: Core and Builtins<27>-Footnote-113624678
Ref: Core and Builtins<27>-Footnote-123624721
Ref: Core and Builtins<27>-Footnote-133624778
Ref: Core and Builtins<27>-Footnote-143624835
Ref: Core and Builtins<27>-Footnote-153624878
Ref: Core and Builtins<27>-Footnote-163624935
Ref: Core and Builtins<27>-Footnote-173624992
Ref: Core and Builtins<27>-Footnote-183625049
Node: ライブラリ<30>3625106
Ref: whatsnew/changelog id1353625242
Ref: 18ca3625242
Ref: ライブラリ<30>-Footnote-13625432
Node: Core and Builtins<28>3625488
Ref: whatsnew/changelog id1363625622
Ref: 18cb3625622
Ref: Core and Builtins<28>-Footnote-13632533
Ref: Core and Builtins<28>-Footnote-23632589
Ref: Core and Builtins<28>-Footnote-33632645
Ref: Core and Builtins<28>-Footnote-43632701
Ref: Core and Builtins<28>-Footnote-53632757
Ref: Core and Builtins<28>-Footnote-63632813
Ref: Core and Builtins<28>-Footnote-73632869
Ref: Core and Builtins<28>-Footnote-83632925
Ref: Core and Builtins<28>-Footnote-93632981
Ref: Core and Builtins<28>-Footnote-103633037
Ref: Core and Builtins<28>-Footnote-113633094
Ref: Core and Builtins<28>-Footnote-123633151
Ref: Core and Builtins<28>-Footnote-133633208
Ref: Core and Builtins<28>-Footnote-143633265
Ref: Core and Builtins<28>-Footnote-153633322
Ref: Core and Builtins<28>-Footnote-163633379
Ref: Core and Builtins<28>-Footnote-173633436
Ref: Core and Builtins<28>-Footnote-183633493
Ref: Core and Builtins<28>-Footnote-193633550
Ref: Core and Builtins<28>-Footnote-203633607
Ref: Core and Builtins<28>-Footnote-213633664
Ref: Core and Builtins<28>-Footnote-223633721
Ref: Core and Builtins<28>-Footnote-233633778
Ref: Core and Builtins<28>-Footnote-243633835
Ref: Core and Builtins<28>-Footnote-253633892
Ref: Core and Builtins<28>-Footnote-263633949
Ref: Core and Builtins<28>-Footnote-273634006
Ref: Core and Builtins<28>-Footnote-283634063
Ref: Core and Builtins<28>-Footnote-293634120
Ref: Core and Builtins<28>-Footnote-303634177
Ref: Core and Builtins<28>-Footnote-313634234
Ref: Core and Builtins<28>-Footnote-323634290
Ref: Core and Builtins<28>-Footnote-333634347
Ref: Core and Builtins<28>-Footnote-343634404
Ref: Core and Builtins<28>-Footnote-353634461
Ref: Core and Builtins<28>-Footnote-363634518
Node: ライブラリ<31>3634575
Ref: whatsnew/changelog id1373634699
Ref: 18ce3634699
Ref: ライブラリ<31>-Footnote-13634866
Node: C API<11>3634921
Ref: whatsnew/changelog id1383635037
Ref: 18cf3635037
Ref: C API<11>-Footnote-13637917
Ref: C API<11>-Footnote-23637973
Ref: C API<11>-Footnote-33638029
Ref: C API<11>-Footnote-43638085
Ref: C API<11>-Footnote-53638141
Ref: C API<11>-Footnote-63638197
Ref: C API<11>-Footnote-73638253
Ref: C API<11>-Footnote-83638309
Ref: C API<11>-Footnote-93638365
Ref: C API<11>-Footnote-103638421
Ref: C API<11>-Footnote-113638478
Ref: C API<11>-Footnote-123638535
Ref: C API<11>-Footnote-133638592
Node: ビルド<12>3638648
Ref: whatsnew/changelog id1393638736
Ref: 18d13638736
Ref: ビルド<12>-Footnote-13639998
Ref: ビルド<12>-Footnote-23640054
Ref: ビルド<12>-Footnote-33640110
Ref: ビルド<12>-Footnote-43640166
Ref: ビルド<12>-Footnote-53640222
Ref: ビルド<12>-Footnote-63640278
Ref: ビルド<12>-Footnote-73640334
Ref: ビルド<12>-Footnote-83640390
Node: Python 3 14 0 alpha 73640446
Ref: whatsnew/changelog python-3-14-0-alpha-73640575
Ref: 18d23640575
Node: macOS<7>3641087
Ref: whatsnew/changelog id1403641173
Ref: 18d33641173
Ref: macOS<7>-Footnote-13641476
Ref: macOS<7>-Footnote-23641532
Ref: macOS<7>-Footnote-33641588
Node: Windows<12>3641644
Ref: whatsnew/changelog id1413641753
Ref: 18d43641753
Ref: Windows<12>-Footnote-13642313
Ref: Windows<12>-Footnote-23642369
Ref: Windows<12>-Footnote-33642425
Ref: Windows<12>-Footnote-43642480
Node: Tools/Demos<9>3642536
Ref: whatsnew/changelog id1423642650
Ref: 18d53642650
Ref: Tools/Demos<9>-Footnote-13642972
Ref: Tools/Demos<9>-Footnote-23643028
Node: テスト<11>3643084
Ref: whatsnew/changelog id1433643209
Ref: 18d63643209
Ref: テスト<11>-Footnote-13643599
Ref: テスト<11>-Footnote-23643655
Node: セキュリティ<16>3643711
Ref: whatsnew/changelog id1443643841
Ref: 18d83643841
Ref: セキュリティ<16>-Footnote-13644569
Ref: セキュリティ<16>-Footnote-23644625
Ref: セキュリティ<16>-Footnote-33644681
Node: ライブラリ<32>3644737
Ref: whatsnew/changelog id1453644876
Ref: 18d93644876
Ref: ライブラリ<32>-Footnote-13653103
Ref: ライブラリ<32>-Footnote-23653159
Ref: ライブラリ<32>-Footnote-33653215
Ref: ライブラリ<32>-Footnote-43653271
Ref: ライブラリ<32>-Footnote-53653327
Ref: ライブラリ<32>-Footnote-63653383
Ref: ライブラリ<32>-Footnote-73653438
Ref: ライブラリ<32>-Footnote-83653494
Ref: ライブラリ<32>-Footnote-93653550
Ref: ライブラリ<32>-Footnote-103653606
Ref: ライブラリ<32>-Footnote-113653663
Ref: ライブラリ<32>-Footnote-123653720
Ref: ライブラリ<32>-Footnote-133653777
Ref: ライブラリ<32>-Footnote-143653834
Ref: ライブラリ<32>-Footnote-153653891
Ref: ライブラリ<32>-Footnote-163653948
Ref: ライブラリ<32>-Footnote-173654005
Ref: ライブラリ<32>-Footnote-183654062
Ref: ライブラリ<32>-Footnote-193654118
Ref: ライブラリ<32>-Footnote-203654175
Ref: ライブラリ<32>-Footnote-213654232
Ref: ライブラリ<32>-Footnote-223654289
Ref: ライブラリ<32>-Footnote-233654346
Ref: ライブラリ<32>-Footnote-243654403
Ref: ライブラリ<32>-Footnote-253654460
Ref: ライブラリ<32>-Footnote-263654517
Ref: ライブラリ<32>-Footnote-273654574
Ref: ライブラリ<32>-Footnote-283654630
Ref: ライブラリ<32>-Footnote-293654687
Ref: ライブラリ<32>-Footnote-303654743
Ref: ライブラリ<32>-Footnote-313654800
Ref: ライブラリ<32>-Footnote-323654857
Ref: ライブラリ<32>-Footnote-333654914
Ref: ライブラリ<32>-Footnote-343654971
Ref: ライブラリ<32>-Footnote-353655028
Ref: ライブラリ<32>-Footnote-363655085
Ref: ライブラリ<32>-Footnote-373655141
Ref: ライブラリ<32>-Footnote-383655198
Ref: ライブラリ<32>-Footnote-393655255
Ref: ライブラリ<32>-Footnote-403655312
Ref: ライブラリ<32>-Footnote-413655369
Ref: ライブラリ<32>-Footnote-423655426
Ref: ライブラリ<32>-Footnote-433655483
Ref: ライブラリ<32>-Footnote-443655540
Ref: ライブラリ<32>-Footnote-453655612
Ref: ライブラリ<32>-Footnote-463655669
Ref: ライブラリ<32>-Footnote-473655726
Ref: ライブラリ<32>-Footnote-483655783
Ref: ライブラリ<32>-Footnote-493655839
Ref: ライブラリ<32>-Footnote-503655896
Node: ドキュメント<12>3655962
Ref: whatsnew/changelog id1463656100
Ref: 18e33656100
Ref: ドキュメント<12>-Footnote-13656303
Node: Core and Builtins<29>3656359
Ref: whatsnew/changelog id1473656497
Ref: 18e43656497
Ref: Core and Builtins<29>-Footnote-13659878
Ref: Core and Builtins<29>-Footnote-23659934
Ref: Core and Builtins<29>-Footnote-33659990
Ref: Core and Builtins<29>-Footnote-43660046
Ref: Core and Builtins<29>-Footnote-53660102
Ref: Core and Builtins<29>-Footnote-63660144
Ref: Core and Builtins<29>-Footnote-73660200
Ref: Core and Builtins<29>-Footnote-83660256
Ref: Core and Builtins<29>-Footnote-93660298
Ref: Core and Builtins<29>-Footnote-103660354
Ref: Core and Builtins<29>-Footnote-113660411
Ref: Core and Builtins<29>-Footnote-123660468
Ref: Core and Builtins<29>-Footnote-133660525
Ref: Core and Builtins<29>-Footnote-143660582
Ref: Core and Builtins<29>-Footnote-153660639
Ref: Core and Builtins<29>-Footnote-163660696
Ref: Core and Builtins<29>-Footnote-173660753
Ref: Core and Builtins<29>-Footnote-183660810
Ref: Core and Builtins<29>-Footnote-193660867
Ref: Core and Builtins<29>-Footnote-203660924
Ref: Core and Builtins<29>-Footnote-213660981
Ref: Core and Builtins<29>-Footnote-223661038
Ref: Core and Builtins<29>-Footnote-233661095
Ref: Core and Builtins<29>-Footnote-243661151
Node: ライブラリ<33>3661208
Ref: whatsnew/changelog id1483661345
Ref: 18e73661345
Ref: ライブラリ<33>-Footnote-13661559
Ref: ライブラリ<33>-Footnote-23661614
Node: Core and Builtins<30>3661673
Ref: whatsnew/changelog id1493661798
Ref: 18e83661798
Ref: Core and Builtins<30>-Footnote-13662444
Ref: Core and Builtins<30>-Footnote-23662500
Ref: Core and Builtins<30>-Footnote-33662556
Ref: Core and Builtins<30>-Footnote-43662612
Ref: Core and Builtins<30>-Footnote-53662668
Node: C API<12>3662724
Ref: whatsnew/changelog id1503662843
Ref: 18e93662843
Ref: C API<12>-Footnote-13663099
Ref: C API<12>-Footnote-23663155
Node: ビルド<13>3663211
Ref: whatsnew/changelog id1513663300
Ref: 18ea3663300
Ref: ビルド<13>-Footnote-13664166
Ref: ビルド<13>-Footnote-23664222
Ref: ビルド<13>-Footnote-33664278
Ref: ビルド<13>-Footnote-43664334
Ref: ビルド<13>-Footnote-53664390
Ref: ビルド<13>-Footnote-63664446
Node: Python 3 14 0 alpha 63664502
Ref: whatsnew/changelog python-3-14-0-alpha-63664632
Ref: 18eb3664632
Node: macOS<8>3665226
Ref: whatsnew/changelog id1523665312
Ref: 18ec3665312
Ref: macOS<8>-Footnote-13665510
Node: Windows<13>3665566
Ref: whatsnew/changelog id1533665676
Ref: 18ed3665676
Ref: Windows<13>-Footnote-13665864
Ref: Windows<13>-Footnote-23665920
Node: Tools/Demos<10>3665987
Ref: whatsnew/changelog id1543666102
Ref: 18ee3666102
Ref: Tools/Demos<10>-Footnote-13666861
Ref: Tools/Demos<10>-Footnote-23666917
Ref: Tools/Demos<10>-Footnote-33666972
Ref: Tools/Demos<10>-Footnote-43667028
Ref: Tools/Demos<10>-Footnote-53667084
Ref: Tools/Demos<10>-Footnote-63667140
Ref: Tools/Demos<10>-Footnote-73667196
Node: テスト<12>3667252
Ref: whatsnew/changelog id1553667378
Ref: 18ef3667378
Ref: テスト<12>-Footnote-13668100
Ref: テスト<12>-Footnote-23668156
Ref: テスト<12>-Footnote-33668212
Ref: テスト<12>-Footnote-43668268
Ref: テスト<12>-Footnote-53668324
Node: セキュリティ<17>3668380
Ref: whatsnew/changelog id1563668510
Ref: 18f03668510
Ref: セキュリティ<17>-Footnote-13668850
Node: ライブラリ<34>3668906
Ref: whatsnew/changelog id1573669045
Ref: 18f13669045
Ref: ライブラリ<34>-Footnote-13681748
Ref: ライブラリ<34>-Footnote-23681804
Ref: ライブラリ<34>-Footnote-33681860
Ref: ライブラリ<34>-Footnote-43681916
Ref: ライブラリ<34>-Footnote-53681972
Ref: ライブラリ<34>-Footnote-63682027
Ref: ライブラリ<34>-Footnote-73682082
Ref: ライブラリ<34>-Footnote-83682137
Ref: ライブラリ<34>-Footnote-93682192
Ref: ライブラリ<34>-Footnote-103682248
Ref: ライブラリ<34>-Footnote-113682305
Ref: ライブラリ<34>-Footnote-123682362
Ref: ライブラリ<34>-Footnote-133682419
Ref: ライブラリ<34>-Footnote-143682476
Ref: ライブラリ<34>-Footnote-153682533
Ref: ライブラリ<34>-Footnote-163682590
Ref: ライブラリ<34>-Footnote-173682647
Ref: ライブラリ<34>-Footnote-183682704
Ref: ライブラリ<34>-Footnote-193682760
Ref: ライブラリ<34>-Footnote-203682817
Ref: ライブラリ<34>-Footnote-213682874
Ref: ライブラリ<34>-Footnote-223682930
Ref: ライブラリ<34>-Footnote-233682987
Ref: ライブラリ<34>-Footnote-243683044
Ref: ライブラリ<34>-Footnote-253683101
Ref: ライブラリ<34>-Footnote-263683158
Ref: ライブラリ<34>-Footnote-273683215
Ref: ライブラリ<34>-Footnote-283683272
Ref: ライブラリ<34>-Footnote-293683328
Ref: ライブラリ<34>-Footnote-303683385
Ref: ライブラリ<34>-Footnote-313683442
Ref: ライブラリ<34>-Footnote-323683499
Ref: ライブラリ<34>-Footnote-333683556
Ref: ライブラリ<34>-Footnote-343683613
Ref: ライブラリ<34>-Footnote-353683670
Ref: ライブラリ<34>-Footnote-363683727
Ref: ライブラリ<34>-Footnote-373683784
Ref: ライブラリ<34>-Footnote-383683841
Ref: ライブラリ<34>-Footnote-393683898
Ref: ライブラリ<34>-Footnote-403683954
Ref: ライブラリ<34>-Footnote-413684011
Ref: ライブラリ<34>-Footnote-423684068
Ref: ライブラリ<34>-Footnote-433684125
Ref: ライブラリ<34>-Footnote-443684182
Ref: ライブラリ<34>-Footnote-453684238
Ref: ライブラリ<34>-Footnote-463684295
Ref: ライブラリ<34>-Footnote-473684352
Ref: ライブラリ<34>-Footnote-483684409
Ref: ライブラリ<34>-Footnote-493684465
Ref: ライブラリ<34>-Footnote-503684522
Ref: ライブラリ<34>-Footnote-513684579
Ref: ライブラリ<34>-Footnote-523684636
Ref: ライブラリ<34>-Footnote-533684693
Ref: ライブラリ<34>-Footnote-543684749
Ref: ライブラリ<34>-Footnote-553684806
Ref: ライブラリ<34>-Footnote-563684863
Ref: ライブラリ<34>-Footnote-573684920
Ref: ライブラリ<34>-Footnote-583684977
Ref: ライブラリ<34>-Footnote-593685034
Ref: ライブラリ<34>-Footnote-603685091
Ref: ライブラリ<34>-Footnote-613685148
Ref: ライブラリ<34>-Footnote-623685205
Ref: ライブラリ<34>-Footnote-633685262
Ref: ライブラリ<34>-Footnote-643685318
Ref: ライブラリ<34>-Footnote-653685375
Ref: ライブラリ<34>-Footnote-663685432
Ref: ライブラリ<34>-Footnote-673685488
Ref: ライブラリ<34>-Footnote-683685548
Ref: ライブラリ<34>-Footnote-693685604
Ref: ライブラリ<34>-Footnote-703685664
Ref: ライブラリ<34>-Footnote-713685721
Ref: ライブラリ<34>-Footnote-723685778
Node: ドキュメント<13>3685834
Ref: whatsnew/changelog id1583685972
Ref: 18f93685972
Ref: ドキュメント<13>-Footnote-13686431
Ref: ドキュメント<13>-Footnote-23686487
Ref: ドキュメント<13>-Footnote-33686543
Node: Core and Builtins<31>3686598
Ref: whatsnew/changelog id1593686736
Ref: 18fd3686736
Ref: Core and Builtins<31>-Footnote-13691298
Ref: Core and Builtins<31>-Footnote-23691354
Ref: Core and Builtins<31>-Footnote-33691410
Ref: Core and Builtins<31>-Footnote-43691466
Ref: Core and Builtins<31>-Footnote-53691522
Ref: Core and Builtins<31>-Footnote-63691578
Ref: Core and Builtins<31>-Footnote-73691634
Ref: Core and Builtins<31>-Footnote-83691690
Ref: Core and Builtins<31>-Footnote-93691746
Ref: Core and Builtins<31>-Footnote-103691802
Ref: Core and Builtins<31>-Footnote-113691859
Ref: Core and Builtins<31>-Footnote-123691916
Ref: Core and Builtins<31>-Footnote-133691973
Ref: Core and Builtins<31>-Footnote-143692030
Ref: Core and Builtins<31>-Footnote-153692087
Ref: Core and Builtins<31>-Footnote-163692144
Ref: Core and Builtins<31>-Footnote-173692201
Ref: Core and Builtins<31>-Footnote-183692258
Ref: Core and Builtins<31>-Footnote-193692315
Ref: Core and Builtins<31>-Footnote-203692372
Ref: Core and Builtins<31>-Footnote-213692429
Ref: Core and Builtins<31>-Footnote-223692488
Ref: Core and Builtins<31>-Footnote-233692545
Ref: Core and Builtins<31>-Footnote-243692602
Ref: Core and Builtins<31>-Footnote-253692659
Ref: Core and Builtins<31>-Footnote-263692716
Ref: Core and Builtins<31>-Footnote-273692773
Ref: Core and Builtins<31>-Footnote-283692830
Ref: Core and Builtins<31>-Footnote-293692887
Ref: Core and Builtins<31>-Footnote-303692930
Ref: Core and Builtins<31>-Footnote-313692987
Ref: Core and Builtins<31>-Footnote-323693043
Node: ライブラリ<35>3693100
Ref: whatsnew/changelog id1603693237
Ref: 18ff3693237
Ref: ライブラリ<35>-Footnote-13693391
Node: Core and Builtins<32>3693447
Ref: whatsnew/changelog id1613693582
Ref: 19003693582
Ref: Core and Builtins<32>-Footnote-13696268
Ref: Core and Builtins<32>-Footnote-23696324
Ref: Core and Builtins<32>-Footnote-33696380
Ref: Core and Builtins<32>-Footnote-43696436
Ref: Core and Builtins<32>-Footnote-53696492
Ref: Core and Builtins<32>-Footnote-63696548
Ref: Core and Builtins<32>-Footnote-73696604
Ref: Core and Builtins<32>-Footnote-83696660
Ref: Core and Builtins<32>-Footnote-93696716
Ref: Core and Builtins<32>-Footnote-103696772
Ref: Core and Builtins<32>-Footnote-113696829
Ref: Core and Builtins<32>-Footnote-123696886
Ref: Core and Builtins<32>-Footnote-133696942
Ref: Core and Builtins<32>-Footnote-143696999
Node: ライブラリ<36>3697056
Ref: whatsnew/changelog id1623697193
Ref: 19023697193
Ref: ライブラリ<36>-Footnote-13697465
Node: Core and Builtins<33>3697521
Ref: whatsnew/changelog id1633697646
Ref: 19033697646
Ref: Core and Builtins<33>-Footnote-13697843
Node: C API<13>3697908
Ref: whatsnew/changelog id1643698027
Ref: 19043698027
Ref: C API<13>-Footnote-13700399
Ref: C API<13>-Footnote-23700455
Ref: C API<13>-Footnote-33700511
Ref: C API<13>-Footnote-43700567
Ref: C API<13>-Footnote-53700620
Node: ビルド<14>3700675
Ref: whatsnew/changelog id1653700764
Ref: 19063700764
Ref: ビルド<14>-Footnote-13701890
Ref: ビルド<14>-Footnote-23701946
Ref: ビルド<14>-Footnote-33702002
Ref: ビルド<14>-Footnote-43702058
Ref: ビルド<14>-Footnote-53702114
Ref: ビルド<14>-Footnote-63702170
Ref: ビルド<14>-Footnote-73702226
Node: Python 3 14 0 alpha 53702281
Ref: whatsnew/changelog python-3-14-0-alpha-53702411
Ref: 19073702411
Node: macOS<9>3703038
Ref: whatsnew/changelog id1663703128
Ref: 19083703128
Ref: macOS<9>-Footnote-13703259
Node: Tools/Demos<11>3703314
Ref: whatsnew/changelog id1673703426
Ref: 19093703426
Ref: Tools/Demos<11>-Footnote-13703725
Ref: Tools/Demos<11>-Footnote-23703781
Node: テスト<13>3703837
Ref: whatsnew/changelog id1683703963
Ref: 190a3703963
Ref: テスト<13>-Footnote-13704700
Ref: テスト<13>-Footnote-23704756
Ref: テスト<13>-Footnote-33704812
Node: セキュリティ<18>3704868
Ref: whatsnew/changelog id1693704998
Ref: 190b3704998
Ref: セキュリティ<18>-Footnote-13706567
Ref: セキュリティ<18>-Footnote-23706623
Ref: セキュリティ<18>-Footnote-33706684
Ref: セキュリティ<18>-Footnote-43706740
Ref: セキュリティ<18>-Footnote-53706795
Node: ライブラリ<37>3706851
Ref: whatsnew/changelog id1703706975
Ref: 190c3706975
Ref: ライブラリ<37>-Footnote-13718611
Ref: ライブラリ<37>-Footnote-23718667
Ref: ライブラリ<37>-Footnote-33718723
Ref: ライブラリ<37>-Footnote-43718779
Ref: ライブラリ<37>-Footnote-53718835
Ref: ライブラリ<37>-Footnote-63718891
Ref: ライブラリ<37>-Footnote-73718947
Ref: ライブラリ<37>-Footnote-83719003
Ref: ライブラリ<37>-Footnote-93719059
Ref: ライブラリ<37>-Footnote-103719115
Ref: ライブラリ<37>-Footnote-113719172
Ref: ライブラリ<37>-Footnote-123719229
Ref: ライブラリ<37>-Footnote-133719286
Ref: ライブラリ<37>-Footnote-143719343
Ref: ライブラリ<37>-Footnote-153719400
Ref: ライブラリ<37>-Footnote-163719457
Ref: ライブラリ<37>-Footnote-173719514
Ref: ライブラリ<37>-Footnote-183719571
Ref: ライブラリ<37>-Footnote-193719628
Ref: ライブラリ<37>-Footnote-203719685
Ref: ライブラリ<37>-Footnote-213719742
Ref: ライブラリ<37>-Footnote-223719799
Ref: ライブラリ<37>-Footnote-233719855
Ref: ライブラリ<37>-Footnote-243719912
Ref: ライブラリ<37>-Footnote-253719969
Ref: ライブラリ<37>-Footnote-263720026
Ref: ライブラリ<37>-Footnote-273720083
Ref: ライブラリ<37>-Footnote-283720140
Ref: ライブラリ<37>-Footnote-293720197
Ref: ライブラリ<37>-Footnote-303720254
Ref: ライブラリ<37>-Footnote-313720311
Ref: ライブラリ<37>-Footnote-323720368
Ref: ライブラリ<37>-Footnote-333720425
Ref: ライブラリ<37>-Footnote-343720482
Ref: ライブラリ<37>-Footnote-353720539
Ref: ライブラリ<37>-Footnote-363720596
Ref: ライブラリ<37>-Footnote-373720653
Ref: ライブラリ<37>-Footnote-383720710
Ref: ライブラリ<37>-Footnote-393720767
Ref: ライブラリ<37>-Footnote-403720824
Ref: ライブラリ<37>-Footnote-413720881
Ref: ライブラリ<37>-Footnote-423720938
Ref: ライブラリ<37>-Footnote-433720995
Ref: ライブラリ<37>-Footnote-443721052
Ref: ライブラリ<37>-Footnote-453721109
Ref: ライブラリ<37>-Footnote-463721166
Ref: ライブラリ<37>-Footnote-473721223
Ref: ライブラリ<37>-Footnote-483721283
Ref: ライブラリ<37>-Footnote-493721339
Ref: ライブラリ<37>-Footnote-503721396
Ref: ライブラリ<37>-Footnote-513721452
Ref: ライブラリ<37>-Footnote-523721509
Ref: ライブラリ<37>-Footnote-533721566
Ref: ライブラリ<37>-Footnote-543721623
Ref: ライブラリ<37>-Footnote-553721680
Ref: ライブラリ<37>-Footnote-563721737
Ref: ライブラリ<37>-Footnote-573721794
Ref: ライブラリ<37>-Footnote-583721851
Ref: ライブラリ<37>-Footnote-593721908
Ref: ライブラリ<37>-Footnote-603721965
Ref: ライブラリ<37>-Footnote-613722022
Ref: ライブラリ<37>-Footnote-623722079
Ref: ライブラリ<37>-Footnote-633722135
Ref: ライブラリ<37>-Footnote-643722192
Ref: ライブラリ<37>-Footnote-653722249
Ref: ライブラリ<37>-Footnote-663722306
Ref: ライブラリ<37>-Footnote-673722362
Ref: ライブラリ<37>-Footnote-683722419
Ref: ライブラリ<37>-Footnote-693722476
Ref: ライブラリ<37>-Footnote-703722532
Node: IDLE<7>3722598
Ref: whatsnew/changelog id1713722722
Ref: 19173722722
Ref: IDLE<7>-Footnote-13722944
Node: ドキュメント<14>3723000
Ref: whatsnew/changelog id1723723126
Ref: 19183723126
Ref: ドキュメント<14>-Footnote-13723554
Ref: ドキュメント<14>-Footnote-23723610
Node: Core and Builtins<34>3723665
Ref: whatsnew/changelog id1733723803
Ref: 191a3723803
Ref: Core and Builtins<34>-Footnote-13724913
Ref: Core and Builtins<34>-Footnote-23724969
Ref: Core and Builtins<34>-Footnote-33725025
Ref: Core and Builtins<34>-Footnote-43725081
Ref: Core and Builtins<34>-Footnote-53725137
Ref: Core and Builtins<34>-Footnote-63725193
Ref: Core and Builtins<34>-Footnote-73725249
Ref: Core and Builtins<34>-Footnote-83725305
Ref: Core and Builtins<34>-Footnote-93725361
Node: ライブラリ<38>3725417
Ref: whatsnew/changelog id1743725554
Ref: 191d3725554
Ref: ライブラリ<38>-Footnote-13725764
Node: Core and Builtins<35>3725820
Ref: whatsnew/changelog id1753725955
Ref: 191e3725955
Ref: Core and Builtins<35>-Footnote-13730509
Ref: Core and Builtins<35>-Footnote-23730565
Ref: Core and Builtins<35>-Footnote-33730621
Ref: Core and Builtins<35>-Footnote-43730677
Ref: Core and Builtins<35>-Footnote-53730733
Ref: Core and Builtins<35>-Footnote-63730789
Ref: Core and Builtins<35>-Footnote-73730845
Ref: Core and Builtins<35>-Footnote-83730901
Ref: Core and Builtins<35>-Footnote-93730957
Ref: Core and Builtins<35>-Footnote-103731013
Ref: Core and Builtins<35>-Footnote-113731070
Ref: Core and Builtins<35>-Footnote-123731127
Ref: Core and Builtins<35>-Footnote-133731184
Ref: Core and Builtins<35>-Footnote-143731241
Ref: Core and Builtins<35>-Footnote-153731298
Ref: Core and Builtins<35>-Footnote-163731355
Ref: Core and Builtins<35>-Footnote-173731412
Ref: Core and Builtins<35>-Footnote-183731469
Ref: Core and Builtins<35>-Footnote-193731526
Ref: Core and Builtins<35>-Footnote-203731583
Ref: Core and Builtins<35>-Footnote-213731640
Ref: Core and Builtins<35>-Footnote-223731697
Ref: Core and Builtins<35>-Footnote-233731754
Ref: Core and Builtins<35>-Footnote-243731811
Node: ライブラリ<39>3731868
Ref: whatsnew/changelog id1763732005
Ref: 19273732005
Ref: ライブラリ<39>-Footnote-13732277
Node: Core and Builtins<36>3732333
Ref: whatsnew/changelog id1773732468
Ref: 19283732468
Ref: Core and Builtins<36>-Footnote-13732752
Node: ライブラリ<40>3732808
Ref: whatsnew/changelog id1783732933
Ref: 19293732933
Ref: ライブラリ<40>-Footnote-13733123
Node: C API<14>3733179
Ref: whatsnew/changelog id1793733296
Ref: 192a3733296
Ref: C API<14>-Footnote-13736492
Ref: C API<14>-Footnote-23736548
Ref: C API<14>-Footnote-33736603
Ref: C API<14>-Footnote-43736658
Ref: C API<14>-Footnote-53736714
Ref: C API<14>-Footnote-63736770
Ref: C API<14>-Footnote-73736812
Ref: C API<14>-Footnote-83736868
Ref: C API<14>-Footnote-93736910
Ref: C API<14>-Footnote-103736966
Ref: C API<14>-Footnote-113737023
Ref: C API<14>-Footnote-123737080
Ref: C API<14>-Footnote-133737134
Ref: C API<14>-Footnote-143737191
Ref: C API<14>-Footnote-153737248
Node: ビルド<15>3737291
Ref: whatsnew/changelog id1803737380
Ref: 192d3737380
Ref: ビルド<15>-Footnote-13737717
Ref: ビルド<15>-Footnote-23737773
Node: Python 3 14 0 alpha 43737829
Ref: whatsnew/changelog python-3-14-0-alpha-43737959
Ref: 192e3737959
Node: macOS<10>3738438
Ref: whatsnew/changelog id1813738529
Ref: 192f3738529
Ref: macOS<10>-Footnote-13738733
Node: Tools/Demos<12>3738789
Ref: whatsnew/changelog id1823738902
Ref: 19303738902
Ref: Tools/Demos<12>-Footnote-13739154
Node: テスト<14>3739210
Ref: whatsnew/changelog id1833739333
Ref: 19313739333
Ref: テスト<14>-Footnote-13739581
Node: ライブラリ<41>3739637
Ref: whatsnew/changelog id1843739766
Ref: 19323739766
Ref: ライブラリ<41>-Footnote-13748317
Ref: ライブラリ<41>-Footnote-23748373
Ref: ライブラリ<41>-Footnote-33748428
Ref: ライブラリ<41>-Footnote-43748484
Ref: ライブラリ<41>-Footnote-53748540
Ref: ライブラリ<41>-Footnote-63748596
Ref: ライブラリ<41>-Footnote-73748652
Ref: ライブラリ<41>-Footnote-83748708
Ref: ライブラリ<41>-Footnote-93748764
Ref: ライブラリ<41>-Footnote-103748820
Ref: ライブラリ<41>-Footnote-113748877
Ref: ライブラリ<41>-Footnote-123748934
Ref: ライブラリ<41>-Footnote-133748991
Ref: ライブラリ<41>-Footnote-143749047
Ref: ライブラリ<41>-Footnote-153749104
Ref: ライブラリ<41>-Footnote-163749161
Ref: ライブラリ<41>-Footnote-173749218
Ref: ライブラリ<41>-Footnote-183749275
Ref: ライブラリ<41>-Footnote-193749332
Ref: ライブラリ<41>-Footnote-203749389
Ref: ライブラリ<41>-Footnote-213749446
Ref: ライブラリ<41>-Footnote-223749503
Ref: ライブラリ<41>-Footnote-233749559
Ref: ライブラリ<41>-Footnote-243749616
Ref: ライブラリ<41>-Footnote-253749673
Ref: ライブラリ<41>-Footnote-263749721
Ref: ライブラリ<41>-Footnote-273749766
Ref: ライブラリ<41>-Footnote-283749823
Ref: ライブラリ<41>-Footnote-293749880
Ref: ライブラリ<41>-Footnote-303749937
Ref: ライブラリ<41>-Footnote-313749993
Ref: ライブラリ<41>-Footnote-323750050
Ref: ライブラリ<41>-Footnote-333750106
Ref: ライブラリ<41>-Footnote-343750163
Ref: ライブラリ<41>-Footnote-353750220
Ref: ライブラリ<41>-Footnote-363750277
Ref: ライブラリ<41>-Footnote-373750334
Ref: ライブラリ<41>-Footnote-383750391
Ref: ライブラリ<41>-Footnote-393750448
Ref: ライブラリ<41>-Footnote-403750505
Ref: ライブラリ<41>-Footnote-413750562
Ref: ライブラリ<41>-Footnote-423750619
Ref: ライブラリ<41>-Footnote-433750676
Ref: ライブラリ<41>-Footnote-443750733
Ref: ライブラリ<41>-Footnote-453750790
Node: Core and Builtins<37>3750846
Ref: whatsnew/changelog id1853750981
Ref: 19373750981
Ref: Core and Builtins<37>-Footnote-13751793
Ref: Core and Builtins<37>-Footnote-23751849
Ref: Core and Builtins<37>-Footnote-33751905
Ref: Core and Builtins<37>-Footnote-43751961
Ref: Core and Builtins<37>-Footnote-53752017
Node: ライブラリ<42>3752073
Ref: whatsnew/changelog id1863752210
Ref: 19383752210
Ref: ライブラリ<42>-Footnote-13752473
Ref: ライブラリ<42>-Footnote-23752529
Node: Core and Builtins<38>3752588
Ref: whatsnew/changelog id1873752723
Ref: 19393752723
Ref: Core and Builtins<38>-Footnote-13753818
Ref: Core and Builtins<38>-Footnote-23753874
Ref: Core and Builtins<38>-Footnote-33753930
Ref: Core and Builtins<38>-Footnote-43753986
Ref: Core and Builtins<38>-Footnote-53754042
Node: ライブラリ<43>3754098
Ref: whatsnew/changelog id1883754235
Ref: 193b3754235
Ref: ライブラリ<43>-Footnote-13754513
Node: Core and Builtins<39>3754569
Ref: whatsnew/changelog id1893754694
Ref: 193c3754694
Ref: Core and Builtins<39>-Footnote-13756155
Ref: Core and Builtins<39>-Footnote-23756211
Ref: Core and Builtins<39>-Footnote-33756266
Ref: Core and Builtins<39>-Footnote-43756322
Ref: Core and Builtins<39>-Footnote-53756402
Ref: Core and Builtins<39>-Footnote-63756458
Ref: Core and Builtins<39>-Footnote-73756514
Ref: Core and Builtins<39>-Footnote-83756570
Node: C API<15>3756626
Ref: whatsnew/changelog id1903756745
Ref: 19403756745
Ref: C API<15>-Footnote-13757550
Ref: C API<15>-Footnote-23757606
Ref: C API<15>-Footnote-33757662
Ref: C API<15>-Footnote-43757718
Node: ビルド<16>3757774
Ref: whatsnew/changelog id1913757863
Ref: 19423757863
Ref: ビルド<16>-Footnote-13759375
Ref: ビルド<16>-Footnote-23759431
Ref: ビルド<16>-Footnote-33759487
Ref: ビルド<16>-Footnote-43759543
Ref: ビルド<16>-Footnote-53759599
Ref: ビルド<16>-Footnote-63759654
Ref: ビルド<16>-Footnote-73759710
Ref: ビルド<16>-Footnote-83759766
Ref: ビルド<16>-Footnote-93759822
Ref: ビルド<16>-Footnote-103759870
Node: Python 3 14 0 alpha 33759927
Ref: whatsnew/changelog python-3-14-0-alpha-33760057
Ref: 19433760057
Node: Windows<14>3760548
Ref: whatsnew/changelog id1923760641
Ref: 19443760641
Ref: Windows<14>-Footnote-13761040
Ref: Windows<14>-Footnote-23761096
Node: Tools/Demos<13>3761152
Ref: whatsnew/changelog id1933761267
Ref: 19453761267
Ref: Tools/Demos<13>-Footnote-13761456
Node: テスト<15>3761512
Ref: whatsnew/changelog id1943761638
Ref: 19463761638
Ref: テスト<15>-Footnote-13762312
Ref: テスト<15>-Footnote-23762368
Ref: テスト<15>-Footnote-33762424
Ref: テスト<15>-Footnote-43762480
Ref: テスト<15>-Footnote-53762536
Node: セキュリティ<19>3762592
Ref: whatsnew/changelog id1953762722
Ref: 19473762722
Ref: セキュリティ<19>-Footnote-13763066
Node: ライブラリ<44>3763122
Ref: whatsnew/changelog id1963763261
Ref: 19483763261
Ref: ライブラリ<44>-Footnote-13773818
Ref: ライブラリ<44>-Footnote-23773874
Ref: ライブラリ<44>-Footnote-33773930
Ref: ライブラリ<44>-Footnote-43773986
Ref: ライブラリ<44>-Footnote-53774042
Ref: ライブラリ<44>-Footnote-63774098
Ref: ライブラリ<44>-Footnote-73774154
Ref: ライブラリ<44>-Footnote-83774210
Ref: ライブラリ<44>-Footnote-93774266
Ref: ライブラリ<44>-Footnote-103774321
Ref: ライブラリ<44>-Footnote-113774378
Ref: ライブラリ<44>-Footnote-123774435
Ref: ライブラリ<44>-Footnote-133774492
Ref: ライブラリ<44>-Footnote-143774549
Ref: ライブラリ<44>-Footnote-153774606
Ref: ライブラリ<44>-Footnote-163774663
Ref: ライブラリ<44>-Footnote-173774720
Ref: ライブラリ<44>-Footnote-183774776
Ref: ライブラリ<44>-Footnote-193774833
Ref: ライブラリ<44>-Footnote-203774890
Ref: ライブラリ<44>-Footnote-213774947
Ref: ライブラリ<44>-Footnote-223775004
Ref: ライブラリ<44>-Footnote-233775061
Ref: ライブラリ<44>-Footnote-243775118
Ref: ライブラリ<44>-Footnote-253775175
Ref: ライブラリ<44>-Footnote-263775232
Ref: ライブラリ<44>-Footnote-273775289
Ref: ライブラリ<44>-Footnote-283775346
Ref: ライブラリ<44>-Footnote-293775403
Ref: ライブラリ<44>-Footnote-303775460
Ref: ライブラリ<44>-Footnote-313775517
Ref: ライブラリ<44>-Footnote-323775574
Ref: ライブラリ<44>-Footnote-333775631
Ref: ライブラリ<44>-Footnote-343775688
Ref: ライブラリ<44>-Footnote-353775745
Ref: ライブラリ<44>-Footnote-363775802
Ref: ライブラリ<44>-Footnote-373775859
Ref: ライブラリ<44>-Footnote-383775916
Ref: ライブラリ<44>-Footnote-393775973
Ref: ライブラリ<44>-Footnote-403776030
Ref: ライブラリ<44>-Footnote-413776087
Ref: ライブラリ<44>-Footnote-423776144
Ref: ライブラリ<44>-Footnote-433776201
Ref: ライブラリ<44>-Footnote-443776258
Ref: ライブラリ<44>-Footnote-453776315
Ref: ライブラリ<44>-Footnote-463776372
Ref: ライブラリ<44>-Footnote-473776428
Ref: ライブラリ<44>-Footnote-483776485
Ref: ライブラリ<44>-Footnote-493776542
Ref: ライブラリ<44>-Footnote-503776599
Ref: ライブラリ<44>-Footnote-513776656
Ref: ライブラリ<44>-Footnote-523776712
Ref: ライブラリ<44>-Footnote-533776769
Ref: ライブラリ<44>-Footnote-543776825
Ref: ライブラリ<44>-Footnote-553776882
Ref: ライブラリ<44>-Footnote-563776939
Ref: ライブラリ<44>-Footnote-573776998
Ref: ライブラリ<44>-Footnote-583777058
Ref: ライブラリ<44>-Footnote-593777115
Ref: ライブラリ<44>-Footnote-603777172
Ref: ライブラリ<44>-Footnote-613777229
Ref: ライブラリ<44>-Footnote-623777285
Ref: ライブラリ<44>-Footnote-633777341
Node: ドキュメント<15>3777397
Ref: whatsnew/changelog id1973777535
Ref: 19503777535
Ref: ドキュメント<15>-Footnote-13777729
Node: Core and Builtins<40>3777785
Ref: whatsnew/changelog id1983777923
Ref: 19523777923
Ref: Core and Builtins<40>-Footnote-13779476
Ref: Core and Builtins<40>-Footnote-23779532
Ref: Core and Builtins<40>-Footnote-33779588
Ref: Core and Builtins<40>-Footnote-43779644
Ref: Core and Builtins<40>-Footnote-53779700
Ref: Core and Builtins<40>-Footnote-63779756
Ref: Core and Builtins<40>-Footnote-73779812
Ref: Core and Builtins<40>-Footnote-83779868
Ref: Core and Builtins<40>-Footnote-93779924
Ref: Core and Builtins<40>-Footnote-103779980
Node: ライブラリ<45>3780037
Ref: whatsnew/changelog id1993780174
Ref: 19543780174
Ref: ライブラリ<45>-Footnote-13780764
Node: Core and Builtins<41>3780820
Ref: whatsnew/changelog id2003780945
Ref: 19553780945
Ref: Core and Builtins<41>-Footnote-13783707
Ref: Core and Builtins<41>-Footnote-23783763
Ref: Core and Builtins<41>-Footnote-33783819
Ref: Core and Builtins<41>-Footnote-43783875
Ref: Core and Builtins<41>-Footnote-53783931
Ref: Core and Builtins<41>-Footnote-63783987
Ref: Core and Builtins<41>-Footnote-73784043
Ref: Core and Builtins<41>-Footnote-83784099
Ref: Core and Builtins<41>-Footnote-93784155
Ref: Core and Builtins<41>-Footnote-103784211
Ref: Core and Builtins<41>-Footnote-113784268
Ref: Core and Builtins<41>-Footnote-123784325
Ref: Core and Builtins<41>-Footnote-133784382
Ref: Core and Builtins<41>-Footnote-143784439
Ref: Core and Builtins<41>-Footnote-153784495
Ref: Core and Builtins<41>-Footnote-163784552
Node: C API<16>3784609
Ref: whatsnew/changelog id2013784728
Ref: 195a3784728
Ref: C API<16>-Footnote-13787074
Ref: C API<16>-Footnote-23787130
Ref: C API<16>-Footnote-33787186
Ref: C API<16>-Footnote-43787242
Ref: C API<16>-Footnote-53787298
Ref: C API<16>-Footnote-63787354
Ref: C API<16>-Footnote-73787410
Ref: C API<16>-Footnote-83787466
Ref: C API<16>-Footnote-93787522
Ref: C API<16>-Footnote-103787564
Node: ビルド<17>3787621
Ref: whatsnew/changelog id2023787710
Ref: 19603787710
Ref: ビルド<17>-Footnote-13788262
Ref: ビルド<17>-Footnote-23788318
Ref: ビルド<17>-Footnote-33788374
Ref: ビルド<17>-Footnote-43788430
Ref: ビルド<17>-Footnote-53788486
Node: Python 3 14 0 alpha 23788542
Ref: whatsnew/changelog python-3-14-0-alpha-23788672
Ref: 19613788672
Node: Windows<15>3789287
Ref: whatsnew/changelog id2033789380
Ref: 19623789380
Ref: Windows<15>-Footnote-13790486
Ref: Windows<15>-Footnote-23790542
Ref: Windows<15>-Footnote-33790598
Ref: Windows<15>-Footnote-43790654
Ref: Windows<15>-Footnote-53790710
Ref: Windows<15>-Footnote-63790766
Ref: Windows<15>-Footnote-73790822
Ref: Windows<15>-Footnote-83790878
Ref: Windows<15>-Footnote-93790934
Node: Tools/Demos<14>3790990
Ref: whatsnew/changelog id2043791105
Ref: 19633791105
Ref: Tools/Demos<14>-Footnote-13791441
Ref: Tools/Demos<14>-Footnote-23791497
Node: テスト<16>3791553
Ref: whatsnew/changelog id2053791679
Ref: 19643791679
Ref: テスト<16>-Footnote-13792084
Ref: テスト<16>-Footnote-23792140
Ref: テスト<16>-Footnote-33792196
Node: セキュリティ<20>3792252
Ref: whatsnew/changelog id2063792382
Ref: 19653792382
Ref: セキュリティ<20>-Footnote-13792517
Node: ライブラリ<46>3792573
Ref: whatsnew/changelog id2073792712
Ref: 19663792712
Ref: ライブラリ<46>-Footnote-13810983
Ref: ライブラリ<46>-Footnote-23811038
Ref: ライブラリ<46>-Footnote-33811094
Ref: ライブラリ<46>-Footnote-43811149
Ref: ライブラリ<46>-Footnote-53811205
Ref: ライブラリ<46>-Footnote-63811261
Ref: ライブラリ<46>-Footnote-73811317
Ref: ライブラリ<46>-Footnote-83811373
Ref: ライブラリ<46>-Footnote-93811429
Ref: ライブラリ<46>-Footnote-103811485
Ref: ライブラリ<46>-Footnote-113811542
Ref: ライブラリ<46>-Footnote-123811599
Ref: ライブラリ<46>-Footnote-133811656
Ref: ライブラリ<46>-Footnote-143811713
Ref: ライブラリ<46>-Footnote-153811770
Ref: ライブラリ<46>-Footnote-163811827
Ref: ライブラリ<46>-Footnote-173811884
Ref: ライブラリ<46>-Footnote-183811941
Ref: ライブラリ<46>-Footnote-193811998
Ref: ライブラリ<46>-Footnote-203812055
Ref: ライブラリ<46>-Footnote-213812112
Ref: ライブラリ<46>-Footnote-223812169
Ref: ライブラリ<46>-Footnote-233812225
Ref: ライブラリ<46>-Footnote-243812285
Ref: ライブラリ<46>-Footnote-253812342
Ref: ライブラリ<46>-Footnote-263812399
Ref: ライブラリ<46>-Footnote-273812456
Ref: ライブラリ<46>-Footnote-283812513
Ref: ライブラリ<46>-Footnote-293812570
Ref: ライブラリ<46>-Footnote-303812627
Ref: ライブラリ<46>-Footnote-313812684
Ref: ライブラリ<46>-Footnote-323812741
Ref: ライブラリ<46>-Footnote-333812798
Ref: ライブラリ<46>-Footnote-343812855
Ref: ライブラリ<46>-Footnote-353812912
Ref: ライブラリ<46>-Footnote-363812969
Ref: ライブラリ<46>-Footnote-373813026
Ref: ライブラリ<46>-Footnote-383813083
Ref: ライブラリ<46>-Footnote-393813140
Ref: ライブラリ<46>-Footnote-403813197
Ref: ライブラリ<46>-Footnote-413813254
Ref: ライブラリ<46>-Footnote-423813311
Ref: ライブラリ<46>-Footnote-433813368
Ref: ライブラリ<46>-Footnote-443813425
Ref: ライブラリ<46>-Footnote-453813482
Ref: ライブラリ<46>-Footnote-463813539
Ref: ライブラリ<46>-Footnote-473813596
Ref: ライブラリ<46>-Footnote-483813656
Ref: ライブラリ<46>-Footnote-493813713
Ref: ライブラリ<46>-Footnote-503813770
Ref: ライブラリ<46>-Footnote-513813827
Ref: ライブラリ<46>-Footnote-523813884
Ref: ライブラリ<46>-Footnote-533813941
Ref: ライブラリ<46>-Footnote-543813998
Ref: ライブラリ<46>-Footnote-553814055
Ref: ライブラリ<46>-Footnote-563814112
Ref: ライブラリ<46>-Footnote-573814169
Ref: ライブラリ<46>-Footnote-583814226
Ref: ライブラリ<46>-Footnote-593814282
Ref: ライブラリ<46>-Footnote-603814339
Ref: ライブラリ<46>-Footnote-613814396
Ref: ライブラリ<46>-Footnote-623814453
Ref: ライブラリ<46>-Footnote-633814510
Ref: ライブラリ<46>-Footnote-643814567
Ref: ライブラリ<46>-Footnote-653814624
Ref: ライブラリ<46>-Footnote-663814680
Ref: ライブラリ<46>-Footnote-673814737
Ref: ライブラリ<46>-Footnote-683814794
Ref: ライブラリ<46>-Footnote-693814851
Ref: ライブラリ<46>-Footnote-703814908
Ref: ライブラリ<46>-Footnote-713814965
Ref: ライブラリ<46>-Footnote-723815022
Ref: ライブラリ<46>-Footnote-733815079
Ref: ライブラリ<46>-Footnote-743815136
Ref: ライブラリ<46>-Footnote-753815193
Ref: ライブラリ<46>-Footnote-763815250
Ref: ライブラリ<46>-Footnote-773815307
Ref: ライブラリ<46>-Footnote-783815364
Ref: ライブラリ<46>-Footnote-793815420
Ref: ライブラリ<46>-Footnote-803815477
Ref: ライブラリ<46>-Footnote-813815534
Ref: ライブラリ<46>-Footnote-823815591
Ref: ライブラリ<46>-Footnote-833815634
Ref: ライブラリ<46>-Footnote-843815690
Ref: ライブラリ<46>-Footnote-853815746
Ref: ライブラリ<46>-Footnote-863815802
Ref: ライブラリ<46>-Footnote-873815859
Ref: ライブラリ<46>-Footnote-883815915
Ref: ライブラリ<46>-Footnote-893815972
Ref: ライブラリ<46>-Footnote-903816028
Ref: ライブラリ<46>-Footnote-913816088
Ref: ライブラリ<46>-Footnote-923816145
Ref: ライブラリ<46>-Footnote-933816202
Ref: ライブラリ<46>-Footnote-943816259
Ref: ライブラリ<46>-Footnote-953816315
Ref: ライブラリ<46>-Footnote-963816372
Ref: ライブラリ<46>-Footnote-973816429
Ref: ライブラリ<46>-Footnote-983816485
Ref: ライブラリ<46>-Footnote-993816542
Ref: ライブラリ<46>-Footnote-1003816599
Ref: ライブラリ<46>-Footnote-1013816657
Ref: ライブラリ<46>-Footnote-1023816714
Ref: ライブラリ<46>-Footnote-1033816781
Node: ドキュメント<16>3816838
Ref: whatsnew/changelog id2083816976
Ref: 19753816976
Ref: ドキュメント<16>-Footnote-13817528
Ref: ドキュメント<16>-Footnote-23817584
Ref: ドキュメント<16>-Footnote-33817640
Node: Core and Builtins<42>3817695
Ref: whatsnew/changelog id2093817833
Ref: 19763817833
Ref: Core and Builtins<42>-Footnote-13818402
Ref: Core and Builtins<42>-Footnote-23818458
Ref: Core and Builtins<42>-Footnote-33818514
Node: ライブラリ<47>3818570
Ref: whatsnew/changelog id2103818707
Ref: 19773818707
Ref: ライブラリ<47>-Footnote-13818984
Node: Core and Builtins<43>3819040
Ref: whatsnew/changelog id2113819175
Ref: 19783819175
Ref: Core and Builtins<43>-Footnote-13819597
Ref: Core and Builtins<43>-Footnote-23819653
Node: ライブラリ<48>3819709
Ref: whatsnew/changelog id2123819846
Ref: 19793819846
Ref: ライブラリ<48>-Footnote-13820159
Node: Core and Builtins<44>3820215
Ref: whatsnew/changelog id2133820350
Ref: 197a3820350
Ref: Core and Builtins<44>-Footnote-13825040
Ref: Core and Builtins<44>-Footnote-23825096
Ref: Core and Builtins<44>-Footnote-33825152
Ref: Core and Builtins<44>-Footnote-43825208
Ref: Core and Builtins<44>-Footnote-53825264
Ref: Core and Builtins<44>-Footnote-63825320
Ref: Core and Builtins<44>-Footnote-73825376
Ref: Core and Builtins<44>-Footnote-83825432
Ref: Core and Builtins<44>-Footnote-93825488
Ref: Core and Builtins<44>-Footnote-103825543
Ref: Core and Builtins<44>-Footnote-113825600
Ref: Core and Builtins<44>-Footnote-123825657
Ref: Core and Builtins<44>-Footnote-133825714
Ref: Core and Builtins<44>-Footnote-143825771
Ref: Core and Builtins<44>-Footnote-153825828
Ref: Core and Builtins<44>-Footnote-163825885
Ref: Core and Builtins<44>-Footnote-173825942
Ref: Core and Builtins<44>-Footnote-183825999
Ref: Core and Builtins<44>-Footnote-193826056
Ref: Core and Builtins<44>-Footnote-203826113
Ref: Core and Builtins<44>-Footnote-213826170
Ref: Core and Builtins<44>-Footnote-223826227
Ref: Core and Builtins<44>-Footnote-233826284
Ref: Core and Builtins<44>-Footnote-243826341
Ref: Core and Builtins<44>-Footnote-253826398
Ref: Core and Builtins<44>-Footnote-263826455
Ref: Core and Builtins<44>-Footnote-273826512
Node: ライブラリ<49>3826569
Ref: whatsnew/changelog id2143826694
Ref: 197c3826694
Ref: ライブラリ<49>-Footnote-13827053
Ref: ライブラリ<49>-Footnote-23827109
Node: C API<17>3827165
Ref: whatsnew/changelog id2153827282
Ref: 197d3827282
Ref: C API<17>-Footnote-13828293
Ref: C API<17>-Footnote-23828349
Ref: C API<17>-Footnote-33828405
Ref: C API<17>-Footnote-43828461
Ref: C API<17>-Footnote-53828517
Ref: C API<17>-Footnote-63828559
Ref: C API<17>-Footnote-73828615
Node: ビルド<18>3828671
Ref: whatsnew/changelog id2163828760
Ref: 197e3828760
Ref: ビルド<18>-Footnote-13830377
Ref: ビルド<18>-Footnote-23830433
Ref: ビルド<18>-Footnote-33830489
Ref: ビルド<18>-Footnote-43830545
Ref: ビルド<18>-Footnote-53830600
Ref: ビルド<18>-Footnote-63830656
Ref: ビルド<18>-Footnote-73830712
Ref: ビルド<18>-Footnote-83830768
Ref: ビルド<18>-Footnote-93830824
Ref: ビルド<18>-Footnote-103830880
Ref: ビルド<18>-Footnote-113830946
Ref: ビルド<18>-Footnote-123831002
Ref: ビルド<18>-Footnote-133831059
Node: Python 3 14 0 alpha 13831116
Ref: whatsnew/changelog python-3-14-0-alpha-13831245
Ref: 197f3831245
Node: macOS<11>3832277
Ref: whatsnew/changelog id2173832364
Ref: 19803832364
Ref: macOS<11>-Footnote-13832672
Ref: macOS<11>-Footnote-23832728
Ref: macOS<11>-Footnote-33832784
Node: Windows<16>3832840
Ref: whatsnew/changelog id2183832951
Ref: 19813832951
Ref: Windows<16>-Footnote-13834779
Ref: Windows<16>-Footnote-23834835
Ref: Windows<16>-Footnote-33834891
Ref: Windows<16>-Footnote-43834947
Ref: Windows<16>-Footnote-53835003
Ref: Windows<16>-Footnote-63835059
Ref: Windows<16>-Footnote-73835115
Ref: Windows<16>-Footnote-83835171
Ref: Windows<16>-Footnote-93835227
Ref: Windows<16>-Footnote-103835283
Ref: Windows<16>-Footnote-113835340
Ref: Windows<16>-Footnote-123835397
Ref: Windows<16>-Footnote-133835454
Ref: Windows<16>-Footnote-143835511
Ref: Windows<16>-Footnote-153835568
Ref: Windows<16>-Footnote-163835625
Node: Tools/Demos<15>3835681
Ref: whatsnew/changelog id2193835796
Ref: 19823835796
Ref: Tools/Demos<15>-Footnote-13836002
Node: テスト<17>3836058
Ref: whatsnew/changelog id2203836184
Ref: 19833836184
Ref: テスト<17>-Footnote-13839265
Ref: テスト<17>-Footnote-23839321
Ref: テスト<17>-Footnote-33839377
Ref: テスト<17>-Footnote-43839433
Ref: テスト<17>-Footnote-53839489
Ref: テスト<17>-Footnote-63839545
Ref: テスト<17>-Footnote-73839601
Ref: テスト<17>-Footnote-83839656
Ref: テスト<17>-Footnote-93839711
Ref: テスト<17>-Footnote-103839767
Ref: テスト<17>-Footnote-113839824
Ref: テスト<17>-Footnote-123839881
Ref: テスト<17>-Footnote-133839938
Ref: テスト<17>-Footnote-143839995
Ref: テスト<17>-Footnote-153840052
Ref: テスト<17>-Footnote-163840109
Ref: テスト<17>-Footnote-173840166
Ref: テスト<17>-Footnote-183840223
Node: セキュリティ<21>3840280
Ref: whatsnew/changelog id2213840410
Ref: 19873840410
Ref: セキュリティ<21>-Footnote-13842735
Ref: セキュリティ<21>-Footnote-23842791
Ref: セキュリティ<21>-Footnote-33842847
Ref: セキュリティ<21>-Footnote-43842903
Ref: セキュリティ<21>-Footnote-53842959
Ref: セキュリティ<21>-Footnote-63843015
Ref: セキュリティ<21>-Footnote-73843071
Ref: セキュリティ<21>-Footnote-83843127
Ref: セキュリティ<21>-Footnote-93843183
Ref: セキュリティ<21>-Footnote-103843239
Ref: セキュリティ<21>-Footnote-113843296
Ref: セキュリティ<21>-Footnote-123843353
Ref: セキュリティ<21>-Footnote-133843410
Ref: セキュリティ<21>-Footnote-143843467
Node: ライブラリ<50>3843523
Ref: whatsnew/changelog id2223843647
Ref: 19883843647
Ref: ライブラリ<50>-Footnote-13898820
Ref: ライブラリ<50>-Footnote-23898876
Ref: ライブラリ<50>-Footnote-33898932
Ref: ライブラリ<50>-Footnote-43898987
Ref: ライブラリ<50>-Footnote-53899043
Ref: ライブラリ<50>-Footnote-63899098
Ref: ライブラリ<50>-Footnote-73899154
Ref: ライブラリ<50>-Footnote-83899210
Ref: ライブラリ<50>-Footnote-93899266
Ref: ライブラリ<50>-Footnote-103899322
Ref: ライブラリ<50>-Footnote-113899378
Ref: ライブラリ<50>-Footnote-123899435
Ref: ライブラリ<50>-Footnote-133899492
Ref: ライブラリ<50>-Footnote-143899549
Ref: ライブラリ<50>-Footnote-153899606
Ref: ライブラリ<50>-Footnote-163899663
Ref: ライブラリ<50>-Footnote-173899719
Ref: ライブラリ<50>-Footnote-183899776
Ref: ライブラリ<50>-Footnote-193899832
Ref: ライブラリ<50>-Footnote-203899889
Ref: ライブラリ<50>-Footnote-213899932
Ref: ライブラリ<50>-Footnote-223899989
Ref: ライブラリ<50>-Footnote-233900046
Ref: ライブラリ<50>-Footnote-243900102
Ref: ライブラリ<50>-Footnote-253900159
Ref: ライブラリ<50>-Footnote-263900215
Ref: ライブラリ<50>-Footnote-273900272
Ref: ライブラリ<50>-Footnote-283900328
Ref: ライブラリ<50>-Footnote-293900385
Ref: ライブラリ<50>-Footnote-303900442
Ref: ライブラリ<50>-Footnote-313900498
Ref: ライブラリ<50>-Footnote-323900555
Ref: ライブラリ<50>-Footnote-333900612
Ref: ライブラリ<50>-Footnote-343900669
Ref: ライブラリ<50>-Footnote-353900725
Ref: ライブラリ<50>-Footnote-363900782
Ref: ライブラリ<50>-Footnote-373900839
Ref: ライブラリ<50>-Footnote-383900895
Ref: ライブラリ<50>-Footnote-393900952
Ref: ライブラリ<50>-Footnote-403901008
Ref: ライブラリ<50>-Footnote-413901065
Ref: ライブラリ<50>-Footnote-423901122
Ref: ライブラリ<50>-Footnote-433901179
Ref: ライブラリ<50>-Footnote-443901235
Ref: ライブラリ<50>-Footnote-453901292
Ref: ライブラリ<50>-Footnote-463901349
Ref: ライブラリ<50>-Footnote-473901405
Ref: ライブラリ<50>-Footnote-483901462
Ref: ライブラリ<50>-Footnote-493901519
Ref: ライブラリ<50>-Footnote-503901576
Ref: ライブラリ<50>-Footnote-513901633
Ref: ライブラリ<50>-Footnote-523901690
Ref: ライブラリ<50>-Footnote-533901747
Ref: ライブラリ<50>-Footnote-543901803
Ref: ライブラリ<50>-Footnote-553901860
Ref: ライブラリ<50>-Footnote-563901916
Ref: ライブラリ<50>-Footnote-573901972
Ref: ライブラリ<50>-Footnote-583902028
Ref: ライブラリ<50>-Footnote-593902085
Ref: ライブラリ<50>-Footnote-603902141
Ref: ライブラリ<50>-Footnote-613902198
Ref: ライブラリ<50>-Footnote-623902255
Ref: ライブラリ<50>-Footnote-633902312
Ref: ライブラリ<50>-Footnote-643902368
Ref: ライブラリ<50>-Footnote-653902424
Ref: ライブラリ<50>-Footnote-663902480
Ref: ライブラリ<50>-Footnote-673902537
Ref: ライブラリ<50>-Footnote-683902594
Ref: ライブラリ<50>-Footnote-693902651
Ref: ライブラリ<50>-Footnote-703902708
Ref: ライブラリ<50>-Footnote-713902765
Ref: ライブラリ<50>-Footnote-723902822
Ref: ライブラリ<50>-Footnote-733902879
Ref: ライブラリ<50>-Footnote-743902936
Ref: ライブラリ<50>-Footnote-753902993
Ref: ライブラリ<50>-Footnote-763903049
Ref: ライブラリ<50>-Footnote-773903106
Ref: ライブラリ<50>-Footnote-783903163
Ref: ライブラリ<50>-Footnote-793903220
Ref: ライブラリ<50>-Footnote-803903277
Ref: ライブラリ<50>-Footnote-813903334
Ref: ライブラリ<50>-Footnote-823903391
Ref: ライブラリ<50>-Footnote-833903448
Ref: ライブラリ<50>-Footnote-843903505
Ref: ライブラリ<50>-Footnote-853903562
Ref: ライブラリ<50>-Footnote-863903619
Ref: ライブラリ<50>-Footnote-873903691
Ref: ライブラリ<50>-Footnote-883903748
Ref: ライブラリ<50>-Footnote-893903805
Ref: ライブラリ<50>-Footnote-903903862
Ref: ライブラリ<50>-Footnote-913903919
Ref: ライブラリ<50>-Footnote-923903976
Ref: ライブラリ<50>-Footnote-933904033
Ref: ライブラリ<50>-Footnote-943904090
Ref: ライブラリ<50>-Footnote-953904146
Ref: ライブラリ<50>-Footnote-963904203
Ref: ライブラリ<50>-Footnote-973904260
Ref: ライブラリ<50>-Footnote-983904316
Ref: ライブラリ<50>-Footnote-993904373
Ref: ライブラリ<50>-Footnote-1003904430
Ref: ライブラリ<50>-Footnote-1013904488
Ref: ライブラリ<50>-Footnote-1023904546
Ref: ライブラリ<50>-Footnote-1033904603
Ref: ライブラリ<50>-Footnote-1043904661
Ref: ライブラリ<50>-Footnote-1053904719
Ref: ライブラリ<50>-Footnote-1063904777
Ref: ライブラリ<50>-Footnote-1073904835
Ref: ライブラリ<50>-Footnote-1083904893
Ref: ライブラリ<50>-Footnote-1093904951
Ref: ライブラリ<50>-Footnote-1103905009
Ref: ライブラリ<50>-Footnote-1113905067
Ref: ライブラリ<50>-Footnote-1123905125
Ref: ライブラリ<50>-Footnote-1133905183
Ref: ライブラリ<50>-Footnote-1143905241
Ref: ライブラリ<50>-Footnote-1153905299
Ref: ライブラリ<50>-Footnote-1163905357
Ref: ライブラリ<50>-Footnote-1173905415
Ref: ライブラリ<50>-Footnote-1183905473
Ref: ライブラリ<50>-Footnote-1193905531
Ref: ライブラリ<50>-Footnote-1203905589
Ref: ライブラリ<50>-Footnote-1213905647
Ref: ライブラリ<50>-Footnote-1223905705
Ref: ライブラリ<50>-Footnote-1233905763
Ref: ライブラリ<50>-Footnote-1243905821
Ref: ライブラリ<50>-Footnote-1253905879
Ref: ライブラリ<50>-Footnote-1263905936
Ref: ライブラリ<50>-Footnote-1273905994
Ref: ライブラリ<50>-Footnote-1283906052
Ref: ライブラリ<50>-Footnote-1293906109
Ref: ライブラリ<50>-Footnote-1303906167
Ref: ライブラリ<50>-Footnote-1313906225
Ref: ライブラリ<50>-Footnote-1323906283
Ref: ライブラリ<50>-Footnote-1333906341
Ref: ライブラリ<50>-Footnote-1343906399
Ref: ライブラリ<50>-Footnote-1353906457
Ref: ライブラリ<50>-Footnote-1363906515
Ref: ライブラリ<50>-Footnote-1373906573
Ref: ライブラリ<50>-Footnote-1383906631
Ref: ライブラリ<50>-Footnote-1393906675
Ref: ライブラリ<50>-Footnote-1403906733
Ref: ライブラリ<50>-Footnote-1413906791
Ref: ライブラリ<50>-Footnote-1423906849
Ref: ライブラリ<50>-Footnote-1433906907
Ref: ライブラリ<50>-Footnote-1443906965
Ref: ライブラリ<50>-Footnote-1453907023
Ref: ライブラリ<50>-Footnote-1463907080
Ref: ライブラリ<50>-Footnote-1473907138
Ref: ライブラリ<50>-Footnote-1483907196
Ref: ライブラリ<50>-Footnote-1493907254
Ref: ライブラリ<50>-Footnote-1503907312
Ref: ライブラリ<50>-Footnote-1513907369
Ref: ライブラリ<50>-Footnote-1523907427
Ref: ライブラリ<50>-Footnote-1533907485
Ref: ライブラリ<50>-Footnote-1543907543
Ref: ライブラリ<50>-Footnote-1553907601
Ref: ライブラリ<50>-Footnote-1563907659
Ref: ライブラリ<50>-Footnote-1573907717
Ref: ライブラリ<50>-Footnote-1583907775
Ref: ライブラリ<50>-Footnote-1593907832
Ref: ライブラリ<50>-Footnote-1603907889
Ref: ライブラリ<50>-Footnote-1613907947
Ref: ライブラリ<50>-Footnote-1623908005
Ref: ライブラリ<50>-Footnote-1633908063
Ref: ライブラリ<50>-Footnote-1643908121
Ref: ライブラリ<50>-Footnote-1653908179
Ref: ライブラリ<50>-Footnote-1663908237
Ref: ライブラリ<50>-Footnote-1673908295
Ref: ライブラリ<50>-Footnote-1683908352
Ref: ライブラリ<50>-Footnote-1693908410
Ref: ライブラリ<50>-Footnote-1703908468
Ref: ライブラリ<50>-Footnote-1713908526
Ref: ライブラリ<50>-Footnote-1723908584
Ref: ライブラリ<50>-Footnote-1733908642
Ref: ライブラリ<50>-Footnote-1743908700
Ref: ライブラリ<50>-Footnote-1753908758
Ref: ライブラリ<50>-Footnote-1763908816
Ref: ライブラリ<50>-Footnote-1773908873
Ref: ライブラリ<50>-Footnote-1783908931
Ref: ライブラリ<50>-Footnote-1793908989
Ref: ライブラリ<50>-Footnote-1803909047
Ref: ライブラリ<50>-Footnote-1813909105
Ref: ライブラリ<50>-Footnote-1823909163
Ref: ライブラリ<50>-Footnote-1833909221
Ref: ライブラリ<50>-Footnote-1843909279
Ref: ライブラリ<50>-Footnote-1853909336
Ref: ライブラリ<50>-Footnote-1863909394
Ref: ライブラリ<50>-Footnote-1873909452
Ref: ライブラリ<50>-Footnote-1883909510
Ref: ライブラリ<50>-Footnote-1893909568
Ref: ライブラリ<50>-Footnote-1903909626
Ref: ライブラリ<50>-Footnote-1913909684
Ref: ライブラリ<50>-Footnote-1923909742
Ref: ライブラリ<50>-Footnote-1933909800
Ref: ライブラリ<50>-Footnote-1943909857
Ref: ライブラリ<50>-Footnote-1953909915
Ref: ライブラリ<50>-Footnote-1963909973
Ref: ライブラリ<50>-Footnote-1973910031
Ref: ライブラリ<50>-Footnote-1983910089
Ref: ライブラリ<50>-Footnote-1993910147
Ref: ライブラリ<50>-Footnote-2003910205
Ref: ライブラリ<50>-Footnote-2013910263
Ref: ライブラリ<50>-Footnote-2023910321
Ref: ライブラリ<50>-Footnote-2033910379
Ref: ライブラリ<50>-Footnote-2043910437
Ref: ライブラリ<50>-Footnote-2053910495
Ref: ライブラリ<50>-Footnote-2063910553
Ref: ライブラリ<50>-Footnote-2073910610
Ref: ライブラリ<50>-Footnote-2083910668
Ref: ライブラリ<50>-Footnote-2093910726
Ref: ライブラリ<50>-Footnote-2103910770
Ref: ライブラリ<50>-Footnote-2113910814
Ref: ライブラリ<50>-Footnote-2123910872
Ref: ライブラリ<50>-Footnote-2133910930
Ref: ライブラリ<50>-Footnote-2143910987
Ref: ライブラリ<50>-Footnote-2153911045
Ref: ライブラリ<50>-Footnote-2163911103
Ref: ライブラリ<50>-Footnote-2173911147
Ref: ライブラリ<50>-Footnote-2183911205
Ref: ライブラリ<50>-Footnote-2193911263
Ref: ライブラリ<50>-Footnote-2203911321
Ref: ライブラリ<50>-Footnote-2213911379
Ref: ライブラリ<50>-Footnote-2223911436
Ref: ライブラリ<50>-Footnote-2233911494
Ref: ライブラリ<50>-Footnote-2243911552
Ref: ライブラリ<50>-Footnote-2253911610
Ref: ライブラリ<50>-Footnote-2263911668
Ref: ライブラリ<50>-Footnote-2273911726
Ref: ライブラリ<50>-Footnote-2283911784
Ref: ライブラリ<50>-Footnote-2293911842
Ref: ライブラリ<50>-Footnote-2303911900
Ref: ライブラリ<50>-Footnote-2313911958
Ref: ライブラリ<50>-Footnote-2323912016
Ref: ライブラリ<50>-Footnote-2333912074
Ref: ライブラリ<50>-Footnote-2343912132
Ref: ライブラリ<50>-Footnote-2353912190
Ref: ライブラリ<50>-Footnote-2363912247
Ref: ライブラリ<50>-Footnote-2373912305
Ref: ライブラリ<50>-Footnote-2383912363
Ref: ライブラリ<50>-Footnote-2393912420
Ref: ライブラリ<50>-Footnote-2403912478
Ref: ライブラリ<50>-Footnote-2413912536
Ref: ライブラリ<50>-Footnote-2423912594
Ref: ライブラリ<50>-Footnote-2433912652
Ref: ライブラリ<50>-Footnote-2443912709
Ref: ライブラリ<50>-Footnote-2453912767
Ref: ライブラリ<50>-Footnote-2463912824
Ref: ライブラリ<50>-Footnote-2473912881
Ref: ライブラリ<50>-Footnote-2483912939
Ref: ライブラリ<50>-Footnote-2493912996
Ref: ライブラリ<50>-Footnote-2503913054
Ref: ライブラリ<50>-Footnote-2513913112
Ref: ライブラリ<50>-Footnote-2523913170
Ref: ライブラリ<50>-Footnote-2533913228
Ref: ライブラリ<50>-Footnote-2543913286
Ref: ライブラリ<50>-Footnote-2553913344
Ref: ライブラリ<50>-Footnote-2563913402
Ref: ライブラリ<50>-Footnote-2573913460
Ref: ライブラリ<50>-Footnote-2583913518
Ref: ライブラリ<50>-Footnote-2593913575
Ref: ライブラリ<50>-Footnote-2603913633
Ref: ライブラリ<50>-Footnote-2613913691
Ref: ライブラリ<50>-Footnote-2623913749
Ref: ライブラリ<50>-Footnote-2633913807
Ref: ライブラリ<50>-Footnote-2643913865
Ref: ライブラリ<50>-Footnote-2653913923
Ref: ライブラリ<50>-Footnote-2663913981
Ref: ライブラリ<50>-Footnote-2673914039
Ref: ライブラリ<50>-Footnote-2683914097
Ref: ライブラリ<50>-Footnote-2693914155
Ref: ライブラリ<50>-Footnote-2703914213
Ref: ライブラリ<50>-Footnote-2713914271
Ref: ライブラリ<50>-Footnote-2723914329
Ref: ライブラリ<50>-Footnote-2733914387
Ref: ライブラリ<50>-Footnote-2743914445
Ref: ライブラリ<50>-Footnote-2753914502
Ref: ライブラリ<50>-Footnote-2763914559
Ref: ライブラリ<50>-Footnote-2773914616
Ref: ライブラリ<50>-Footnote-2783914674
Ref: ライブラリ<50>-Footnote-2793914732
Ref: ライブラリ<50>-Footnote-2803914790
Ref: ライブラリ<50>-Footnote-2813914848
Ref: ライブラリ<50>-Footnote-2823914906
Ref: ライブラリ<50>-Footnote-2833914964
Ref: ライブラリ<50>-Footnote-2843915022
Ref: ライブラリ<50>-Footnote-2853915080
Ref: ライブラリ<50>-Footnote-2863915138
Ref: ライブラリ<50>-Footnote-2873915196
Ref: ライブラリ<50>-Footnote-2883915254
Ref: ライブラリ<50>-Footnote-2893915312
Ref: ライブラリ<50>-Footnote-2903915370
Ref: ライブラリ<50>-Footnote-2913915427
Ref: ライブラリ<50>-Footnote-2923915485
Ref: ライブラリ<50>-Footnote-2933915542
Ref: ライブラリ<50>-Footnote-2943915600
Ref: ライブラリ<50>-Footnote-2953915658
Ref: ライブラリ<50>-Footnote-2963915716
Ref: ライブラリ<50>-Footnote-2973915774
Ref: ライブラリ<50>-Footnote-2983915832
Ref: ライブラリ<50>-Footnote-2993915890
Ref: ライブラリ<50>-Footnote-3003915948
Ref: ライブラリ<50>-Footnote-3013916006
Ref: ライブラリ<50>-Footnote-3023916064
Ref: ライブラリ<50>-Footnote-3033916122
Ref: ライブラリ<50>-Footnote-3043916206
Ref: ライブラリ<50>-Footnote-3053916264
Ref: ライブラリ<50>-Footnote-3063916322
Ref: ライブラリ<50>-Footnote-3073916380
Ref: ライブラリ<50>-Footnote-3083916438
Ref: ライブラリ<50>-Footnote-3093916496
Ref: ライブラリ<50>-Footnote-3103916554
Ref: ライブラリ<50>-Footnote-3113916612
Ref: ライブラリ<50>-Footnote-3123916670
Ref: ライブラリ<50>-Footnote-3133916728
Ref: ライブラリ<50>-Footnote-3143916786
Ref: ライブラリ<50>-Footnote-3153916844
Ref: ライブラリ<50>-Footnote-3163916901
Ref: ライブラリ<50>-Footnote-3173916959
Ref: ライブラリ<50>-Footnote-3183917016
Ref: ライブラリ<50>-Footnote-3193917074
Ref: ライブラリ<50>-Footnote-3203917141
Ref: ライブラリ<50>-Footnote-3213917208
Ref: ライブラリ<50>-Footnote-3223917275
Ref: ライブラリ<50>-Footnote-3233917342
Ref: ライブラリ<50>-Footnote-3243917399
Node: IDLE<8>3917466
Ref: whatsnew/changelog id2233917590
Ref: 19c13917590
Ref: IDLE<8>-Footnote-13918444
Ref: IDLE<8>-Footnote-23918500
Ref: IDLE<8>-Footnote-33918556
Ref: IDLE<8>-Footnote-43918612
Ref: IDLE<8>-Footnote-53918667
Ref: IDLE<8>-Footnote-63918723
Node: ドキュメント<17>3918779
Ref: whatsnew/changelog id2243918905
Ref: 19c23918905
Ref: ドキュメント<17>-Footnote-13921414
Ref: ドキュメント<17>-Footnote-23921470
Ref: ドキュメント<17>-Footnote-33921526
Ref: ドキュメント<17>-Footnote-43921582
Ref: ドキュメント<17>-Footnote-53921638
Ref: ドキュメント<17>-Footnote-63921694
Ref: ドキュメント<17>-Footnote-73921750
Ref: ドキュメント<17>-Footnote-83921805
Ref: ドキュメント<17>-Footnote-93921861
Ref: ドキュメント<17>-Footnote-103921917
Ref: ドキュメント<17>-Footnote-113921974
Ref: ドキュメント<17>-Footnote-123922031
Ref: ドキュメント<17>-Footnote-133922088
Node: Core and Builtins<45>3922154
Ref: whatsnew/changelog id2253922292
Ref: 19ca3922292
Ref: Core and Builtins<45>-Footnote-13923029
Ref: Core and Builtins<45>-Footnote-23923085
Ref: Core and Builtins<45>-Footnote-33923141
Ref: Core and Builtins<45>-Footnote-43923197
Node: ライブラリ<51>3923253
Ref: whatsnew/changelog id2263923390
Ref: 19cc3923390
Ref: ライブラリ<51>-Footnote-13923627
Node: Core and Builtins<46>3923683
Ref: whatsnew/changelog id2273923818
Ref: 19cd3923818
Ref: Core and Builtins<46>-Footnote-13927965
Ref: Core and Builtins<46>-Footnote-23928021
Ref: Core and Builtins<46>-Footnote-33928077
Ref: Core and Builtins<46>-Footnote-43928133
Ref: Core and Builtins<46>-Footnote-53928189
Ref: Core and Builtins<46>-Footnote-63928245
Ref: Core and Builtins<46>-Footnote-73928301
Ref: Core and Builtins<46>-Footnote-83928357
Ref: Core and Builtins<46>-Footnote-93928413
Ref: Core and Builtins<46>-Footnote-103928469
Ref: Core and Builtins<46>-Footnote-113928526
Ref: Core and Builtins<46>-Footnote-123928583
Ref: Core and Builtins<46>-Footnote-133928640
Ref: Core and Builtins<46>-Footnote-143928696
Ref: Core and Builtins<46>-Footnote-153928753
Ref: Core and Builtins<46>-Footnote-163928810
Ref: Core and Builtins<46>-Footnote-173928867
Ref: Core and Builtins<46>-Footnote-183928924
Ref: Core and Builtins<46>-Footnote-193928981
Ref: Core and Builtins<46>-Footnote-203929038
Ref: Core and Builtins<46>-Footnote-213929095
Ref: Core and Builtins<46>-Footnote-223929151
Ref: Core and Builtins<46>-Footnote-233929208
Ref: Core and Builtins<46>-Footnote-243929265
Node: ライブラリ<52>3929322
Ref: whatsnew/changelog id2283929459
Ref: 19cf3929459
Ref: ライブラリ<52>-Footnote-13929702
Node: Core and Builtins<47>3929758
Ref: whatsnew/changelog id2293929893
Ref: 19d13929893
Ref: Core and Builtins<47>-Footnote-13937697
Ref: Core and Builtins<47>-Footnote-23937753
Ref: Core and Builtins<47>-Footnote-33937809
Ref: Core and Builtins<47>-Footnote-43937865
Ref: Core and Builtins<47>-Footnote-53937921
Ref: Core and Builtins<47>-Footnote-63937977
Ref: Core and Builtins<47>-Footnote-73938033
Ref: Core and Builtins<47>-Footnote-83938089
Ref: Core and Builtins<47>-Footnote-93938145
Ref: Core and Builtins<47>-Footnote-103938201
Ref: Core and Builtins<47>-Footnote-113938258
Ref: Core and Builtins<47>-Footnote-123938315
Ref: Core and Builtins<47>-Footnote-133938372
Ref: Core and Builtins<47>-Footnote-143938429
Ref: Core and Builtins<47>-Footnote-153938486
Ref: Core and Builtins<47>-Footnote-163938543
Ref: Core and Builtins<47>-Footnote-173938600
Ref: Core and Builtins<47>-Footnote-183938657
Ref: Core and Builtins<47>-Footnote-193938714
Ref: Core and Builtins<47>-Footnote-203938771
Ref: Core and Builtins<47>-Footnote-213938828
Ref: Core and Builtins<47>-Footnote-223938885
Ref: Core and Builtins<47>-Footnote-233938942
Ref: Core and Builtins<47>-Footnote-243938999
Ref: Core and Builtins<47>-Footnote-253939056
Ref: Core and Builtins<47>-Footnote-263939113
Ref: Core and Builtins<47>-Footnote-273939170
Ref: Core and Builtins<47>-Footnote-283939227
Ref: Core and Builtins<47>-Footnote-293939284
Ref: Core and Builtins<47>-Footnote-303939341
Ref: Core and Builtins<47>-Footnote-313939398
Ref: Core and Builtins<47>-Footnote-323939455
Ref: Core and Builtins<47>-Footnote-333939512
Ref: Core and Builtins<47>-Footnote-343939569
Ref: Core and Builtins<47>-Footnote-353939626
Ref: Core and Builtins<47>-Footnote-363939683
Ref: Core and Builtins<47>-Footnote-373939740
Ref: Core and Builtins<47>-Footnote-383939797
Ref: Core and Builtins<47>-Footnote-393939854
Ref: Core and Builtins<47>-Footnote-403939911
Ref: Core and Builtins<47>-Footnote-413939968
Ref: Core and Builtins<47>-Footnote-423940025
Ref: Core and Builtins<47>-Footnote-433940082
Ref: Core and Builtins<47>-Footnote-443940139
Ref: Core and Builtins<47>-Footnote-453940196
Ref: Core and Builtins<47>-Footnote-463940253
Node: ライブラリ<53>3940309
Ref: whatsnew/changelog id2303940446
Ref: 19d63940446
Ref: ライブラリ<53>-Footnote-13940654
Node: Core and Builtins<48>3940710
Ref: whatsnew/changelog id2313940845
Ref: 19d73940845
Ref: Core and Builtins<48>-Footnote-13943747
Ref: Core and Builtins<48>-Footnote-23943803
Ref: Core and Builtins<48>-Footnote-33943859
Ref: Core and Builtins<48>-Footnote-43943915
Ref: Core and Builtins<48>-Footnote-53943971
Ref: Core and Builtins<48>-Footnote-63944027
Ref: Core and Builtins<48>-Footnote-73944083
Ref: Core and Builtins<48>-Footnote-83944139
Ref: Core and Builtins<48>-Footnote-93944195
Ref: Core and Builtins<48>-Footnote-103944251
Ref: Core and Builtins<48>-Footnote-113944308
Ref: Core and Builtins<48>-Footnote-123944365
Ref: Core and Builtins<48>-Footnote-133944422
Ref: Core and Builtins<48>-Footnote-143944479
Ref: Core and Builtins<48>-Footnote-153944536
Ref: Core and Builtins<48>-Footnote-163944593
Ref: Core and Builtins<48>-Footnote-173944650
Ref: Core and Builtins<48>-Footnote-183944707
Node: ライブラリ<54>3944764
Ref: whatsnew/changelog id2323944901
Ref: 19db3944901
Ref: ライブラリ<54>-Footnote-13945167
Node: Core and Builtins<49>3945223
Ref: whatsnew/changelog id2333945358
Ref: 19dc3945358
Ref: Core and Builtins<49>-Footnote-13948140
Ref: Core and Builtins<49>-Footnote-23948196
Ref: Core and Builtins<49>-Footnote-33948252
Ref: Core and Builtins<49>-Footnote-43948308
Ref: Core and Builtins<49>-Footnote-53948364
Ref: Core and Builtins<49>-Footnote-63948420
Ref: Core and Builtins<49>-Footnote-73948476
Ref: Core and Builtins<49>-Footnote-83948531
Ref: Core and Builtins<49>-Footnote-93948587
Ref: Core and Builtins<49>-Footnote-103948643
Ref: Core and Builtins<49>-Footnote-113948700
Ref: Core and Builtins<49>-Footnote-123948757
Ref: Core and Builtins<49>-Footnote-133948814
Ref: Core and Builtins<49>-Footnote-143948871
Ref: Core and Builtins<49>-Footnote-153948928
Node: ライブラリ<55>3948985
Ref: whatsnew/changelog id2343949122
Ref: 19dd3949122
Ref: ライブラリ<55>-Footnote-13949384
Node: Core and Builtins<50>3949440
Ref: whatsnew/changelog id2353949575
Ref: 19de3949575
Ref: Core and Builtins<50>-Footnote-13950099
Ref: Core and Builtins<50>-Footnote-23950155
Node: ライブラリ<56>3950211
Ref: whatsnew/changelog id2363950348
Ref: 19df3950348
Ref: ライブラリ<56>-Footnote-13950634
Node: Core and Builtins<51>3950690
Ref: whatsnew/changelog id2373950825
Ref: 19e03950825
Ref: Core and Builtins<51>-Footnote-13958063
Ref: Core and Builtins<51>-Footnote-23958119
Ref: Core and Builtins<51>-Footnote-33958175
Ref: Core and Builtins<51>-Footnote-43958231
Ref: Core and Builtins<51>-Footnote-53958286
Ref: Core and Builtins<51>-Footnote-63958342
Ref: Core and Builtins<51>-Footnote-73958398
Ref: Core and Builtins<51>-Footnote-83958454
Ref: Core and Builtins<51>-Footnote-93958510
Ref: Core and Builtins<51>-Footnote-103958566
Ref: Core and Builtins<51>-Footnote-113958622
Ref: Core and Builtins<51>-Footnote-123958679
Ref: Core and Builtins<51>-Footnote-133958736
Ref: Core and Builtins<51>-Footnote-143958793
Ref: Core and Builtins<51>-Footnote-153958850
Ref: Core and Builtins<51>-Footnote-163958907
Ref: Core and Builtins<51>-Footnote-173958964
Ref: Core and Builtins<51>-Footnote-183959021
Ref: Core and Builtins<51>-Footnote-193959064
Ref: Core and Builtins<51>-Footnote-203959121
Ref: Core and Builtins<51>-Footnote-213959178
Ref: Core and Builtins<51>-Footnote-223959235
Ref: Core and Builtins<51>-Footnote-233959292
Ref: Core and Builtins<51>-Footnote-243959349
Ref: Core and Builtins<51>-Footnote-253959406
Ref: Core and Builtins<51>-Footnote-263959463
Ref: Core and Builtins<51>-Footnote-273959520
Ref: Core and Builtins<51>-Footnote-283959577
Ref: Core and Builtins<51>-Footnote-293959634
Ref: Core and Builtins<51>-Footnote-303959691
Ref: Core and Builtins<51>-Footnote-313959748
Ref: Core and Builtins<51>-Footnote-323959805
Ref: Core and Builtins<51>-Footnote-333959862
Ref: Core and Builtins<51>-Footnote-343959919
Ref: Core and Builtins<51>-Footnote-353959962
Ref: Core and Builtins<51>-Footnote-363960019
Ref: Core and Builtins<51>-Footnote-373960076
Ref: Core and Builtins<51>-Footnote-383960133
Ref: Core and Builtins<51>-Footnote-393960190
Ref: Core and Builtins<51>-Footnote-403960247
Ref: Core and Builtins<51>-Footnote-413960290
Ref: Core and Builtins<51>-Footnote-423960347
Ref: Core and Builtins<51>-Footnote-433960404
Ref: Core and Builtins<51>-Footnote-443960461
Ref: Core and Builtins<51>-Footnote-453960518
Ref: Core and Builtins<51>-Footnote-463960575
Ref: Core and Builtins<51>-Footnote-473960632
Ref: Core and Builtins<51>-Footnote-483960689
Ref: Core and Builtins<51>-Footnote-493960746
Ref: Core and Builtins<51>-Footnote-503960803
Node: ライブラリ<57>3960846
Ref: whatsnew/changelog id2383960983
Ref: 19e43960983
Ref: ライブラリ<57>-Footnote-13961222
Node: Core and Builtins<52>3961278
Ref: whatsnew/changelog id2393961403
Ref: 19e73961403
Ref: Core and Builtins<52>-Footnote-13962432
Ref: Core and Builtins<52>-Footnote-23962488
Ref: Core and Builtins<52>-Footnote-33962544
Ref: Core and Builtins<52>-Footnote-43962600
Ref: Core and Builtins<52>-Footnote-53962656
Ref: Core and Builtins<52>-Footnote-63962712
Ref: Core and Builtins<52>-Footnote-73962767
Ref: Core and Builtins<52>-Footnote-83962822
Node: C API<18>3962887
Ref: whatsnew/changelog id2403963006
Ref: 19e83963006
Ref: C API<18>-Footnote-13974800
Ref: C API<18>-Footnote-23974856
Ref: C API<18>-Footnote-33974912
Ref: C API<18>-Footnote-43974968
Ref: C API<18>-Footnote-53975010
Ref: C API<18>-Footnote-63975052
Ref: C API<18>-Footnote-73975108
Ref: C API<18>-Footnote-83975164
Ref: C API<18>-Footnote-93975206
Ref: C API<18>-Footnote-103975248
Ref: C API<18>-Footnote-113975305
Ref: C API<18>-Footnote-123975362
Ref: C API<18>-Footnote-133975419
Ref: C API<18>-Footnote-143975476
Ref: C API<18>-Footnote-153975519
Ref: C API<18>-Footnote-163975576
Ref: C API<18>-Footnote-173975633
Ref: C API<18>-Footnote-183975690
Ref: C API<18>-Footnote-193975747
Ref: C API<18>-Footnote-203975804
Ref: C API<18>-Footnote-213975861
Ref: C API<18>-Footnote-223975918
Ref: C API<18>-Footnote-233975975
Ref: C API<18>-Footnote-243976032
Ref: C API<18>-Footnote-253976088
Ref: C API<18>-Footnote-263976145
Ref: C API<18>-Footnote-273976202
Ref: C API<18>-Footnote-283976259
Ref: C API<18>-Footnote-293976316
Ref: C API<18>-Footnote-303976373
Ref: C API<18>-Footnote-313976430
Ref: C API<18>-Footnote-323976487
Ref: C API<18>-Footnote-333976544
Ref: C API<18>-Footnote-343976600
Ref: C API<18>-Footnote-353976657
Ref: C API<18>-Footnote-363976714
Ref: C API<18>-Footnote-373976771
Ref: C API<18>-Footnote-383976828
Ref: C API<18>-Footnote-393976885
Ref: C API<18>-Footnote-403976942
Ref: C API<18>-Footnote-413976999
Ref: C API<18>-Footnote-423977056
Ref: C API<18>-Footnote-433977113
Ref: C API<18>-Footnote-443977170
Ref: C API<18>-Footnote-453977227
Ref: C API<18>-Footnote-463977284
Ref: C API<18>-Footnote-473977341
Ref: C API<18>-Footnote-483977398
Ref: C API<18>-Footnote-493977455
Ref: C API<18>-Footnote-503977512
Ref: C API<18>-Footnote-513977569
Ref: C API<18>-Footnote-523977625
Ref: C API<18>-Footnote-533977681
Node: ビルド<19>3977747
Ref: whatsnew/changelog id2413977836
Ref: 19f53977836
Ref: ビルド<19>-Footnote-13982397
Ref: ビルド<19>-Footnote-23982453
Ref: ビルド<19>-Footnote-33982509
Ref: ビルド<19>-Footnote-43982565
Ref: ビルド<19>-Footnote-53982621
Ref: ビルド<19>-Footnote-63982677
Ref: ビルド<19>-Footnote-73982733
Ref: ビルド<19>-Footnote-83982789
Ref: ビルド<19>-Footnote-93982845
Ref: ビルド<19>-Footnote-103982901
Ref: ビルド<19>-Footnote-113982958
Ref: ビルド<19>-Footnote-123983015
Ref: ビルド<19>-Footnote-133983072
Ref: ビルド<19>-Footnote-143983129
Ref: ビルド<19>-Footnote-153983186
Ref: ビルド<19>-Footnote-163983243
Ref: ビルド<19>-Footnote-173983300
Ref: ビルド<19>-Footnote-183983357
Ref: ビルド<19>-Footnote-193983414
Ref: ビルド<19>-Footnote-203983471
Ref: ビルド<19>-Footnote-213983528
Ref: ビルド<19>-Footnote-223983585
Ref: ビルド<19>-Footnote-233983642
Ref: ビルド<19>-Footnote-243983699
Ref: ビルド<19>-Footnote-253983756
Ref: ビルド<19>-Footnote-263983813
Ref: ビルド<19>-Footnote-273983870
Ref: ビルド<19>-Footnote-283983927
Ref: ビルド<19>-Footnote-293983984
Ref: ビルド<19>-Footnote-303984041
Ref: ビルド<19>-Footnote-313984098
Ref: ビルド<19>-Footnote-323984155
Node: Python 3 13 0 beta 13984212
Ref: whatsnew/changelog python-3-13-0-beta-13984341
Ref: 19f73984341
Node: セキュリティ<22>3984807
Ref: whatsnew/changelog id2423984916
Ref: 19f83984916
Ref: セキュリティ<22>-Footnote-13985325
Ref: セキュリティ<22>-Footnote-23985381
Node: Core and Builtins<53>3985437
Ref: whatsnew/changelog id2433985574
Ref: 19f93985574
Ref: Core and Builtins<53>-Footnote-13986716
Ref: Core and Builtins<53>-Footnote-23986772
Ref: Core and Builtins<53>-Footnote-33986828
Node: ライブラリ<58>3986884
Ref: whatsnew/changelog id2443987020
Ref: 19fa3987020
Ref: ライブラリ<58>-Footnote-13987356
Node: Core and Builtins<54>3987411
Ref: whatsnew/changelog id2453987545
Ref: 19fb3987545
Ref: Core and Builtins<54>-Footnote-13995605
Ref: Core and Builtins<54>-Footnote-23995661
Ref: Core and Builtins<54>-Footnote-33995717
Ref: Core and Builtins<54>-Footnote-43995773
Ref: Core and Builtins<54>-Footnote-53995829
Ref: Core and Builtins<54>-Footnote-63995885
Ref: Core and Builtins<54>-Footnote-73995941
Ref: Core and Builtins<54>-Footnote-83995997
Ref: Core and Builtins<54>-Footnote-93996053
Ref: Core and Builtins<54>-Footnote-103996109
Ref: Core and Builtins<54>-Footnote-113996166
Ref: Core and Builtins<54>-Footnote-123996222
Ref: Core and Builtins<54>-Footnote-133996279
Ref: Core and Builtins<54>-Footnote-143996336
Ref: Core and Builtins<54>-Footnote-153996393
Ref: Core and Builtins<54>-Footnote-163996450
Ref: Core and Builtins<54>-Footnote-173996507
Ref: Core and Builtins<54>-Footnote-183996564
Ref: Core and Builtins<54>-Footnote-193996621
Ref: Core and Builtins<54>-Footnote-203996678
Ref: Core and Builtins<54>-Footnote-213996735
Ref: Core and Builtins<54>-Footnote-223996792
Ref: Core and Builtins<54>-Footnote-233996849
Ref: Core and Builtins<54>-Footnote-243996906
Ref: Core and Builtins<54>-Footnote-253996963
Ref: Core and Builtins<54>-Footnote-263997020
Ref: Core and Builtins<54>-Footnote-273997077
Ref: Core and Builtins<54>-Footnote-283997134
Ref: Core and Builtins<54>-Footnote-293997191
Ref: Core and Builtins<54>-Footnote-303997248
Ref: Core and Builtins<54>-Footnote-313997305
Ref: Core and Builtins<54>-Footnote-323997362
Ref: Core and Builtins<54>-Footnote-333997419
Ref: Core and Builtins<54>-Footnote-343997462
Ref: Core and Builtins<54>-Footnote-353997519
Ref: Core and Builtins<54>-Footnote-363997576
Ref: Core and Builtins<54>-Footnote-373997633
Ref: Core and Builtins<54>-Footnote-383997690
Ref: Core and Builtins<54>-Footnote-393997747
Ref: Core and Builtins<54>-Footnote-403997790
Ref: Core and Builtins<54>-Footnote-413997846
Ref: Core and Builtins<54>-Footnote-423997903
Ref: Core and Builtins<54>-Footnote-433997959
Ref: Core and Builtins<54>-Footnote-443998015
Node: ライブラリ<59>3998072
Ref: whatsnew/changelog id2463998209
Ref: 19fe3998209
Ref: ライブラリ<59>-Footnote-14014479
Ref: ライブラリ<59>-Footnote-24014535
Ref: ライブラリ<59>-Footnote-34014591
Ref: ライブラリ<59>-Footnote-44014647
Ref: ライブラリ<59>-Footnote-54014703
Ref: ライブラリ<59>-Footnote-64014759
Ref: ライブラリ<59>-Footnote-74014815
Ref: ライブラリ<59>-Footnote-84014871
Ref: ライブラリ<59>-Footnote-94014927
Ref: ライブラリ<59>-Footnote-104014983
Ref: ライブラリ<59>-Footnote-114015040
Ref: ライブラリ<59>-Footnote-124015097
Ref: ライブラリ<59>-Footnote-134015154
Ref: ライブラリ<59>-Footnote-144015211
Ref: ライブラリ<59>-Footnote-154015254
Ref: ライブラリ<59>-Footnote-164015311
Ref: ライブラリ<59>-Footnote-174015368
Ref: ライブラリ<59>-Footnote-184015425
Ref: ライブラリ<59>-Footnote-194015482
Ref: ライブラリ<59>-Footnote-204015539
Ref: ライブラリ<59>-Footnote-214015596
Ref: ライブラリ<59>-Footnote-224015653
Ref: ライブラリ<59>-Footnote-234015710
Ref: ライブラリ<59>-Footnote-244015767
Ref: ライブラリ<59>-Footnote-254015823
Ref: ライブラリ<59>-Footnote-264015880
Ref: ライブラリ<59>-Footnote-274015937
Ref: ライブラリ<59>-Footnote-284015994
Ref: ライブラリ<59>-Footnote-294016051
Ref: ライブラリ<59>-Footnote-304016108
Ref: ライブラリ<59>-Footnote-314016165
Ref: ライブラリ<59>-Footnote-324016208
Ref: ライブラリ<59>-Footnote-334016265
Ref: ライブラリ<59>-Footnote-344016322
Ref: ライブラリ<59>-Footnote-354016379
Ref: ライブラリ<59>-Footnote-364016435
Ref: ライブラリ<59>-Footnote-374016495
Ref: ライブラリ<59>-Footnote-384016551
Ref: ライブラリ<59>-Footnote-394016608
Ref: ライブラリ<59>-Footnote-404016665
Ref: ライブラリ<59>-Footnote-414016722
Ref: ライブラリ<59>-Footnote-424016778
Ref: ライブラリ<59>-Footnote-434016834
Ref: ライブラリ<59>-Footnote-444016877
Ref: ライブラリ<59>-Footnote-454016934
Ref: ライブラリ<59>-Footnote-464016991
Ref: ライブラリ<59>-Footnote-474017048
Ref: ライブラリ<59>-Footnote-484017105
Ref: ライブラリ<59>-Footnote-494017162
Ref: ライブラリ<59>-Footnote-504017219
Ref: ライブラリ<59>-Footnote-514017276
Ref: ライブラリ<59>-Footnote-524017333
Ref: ライブラリ<59>-Footnote-534017390
Ref: ライブラリ<59>-Footnote-544017447
Ref: ライブラリ<59>-Footnote-554017504
Ref: ライブラリ<59>-Footnote-564017561
Ref: ライブラリ<59>-Footnote-574017618
Ref: ライブラリ<59>-Footnote-584017675
Ref: ライブラリ<59>-Footnote-594017732
Ref: ライブラリ<59>-Footnote-604017789
Ref: ライブラリ<59>-Footnote-614017846
Ref: ライブラリ<59>-Footnote-624017903
Ref: ライブラリ<59>-Footnote-634017946
Ref: ライブラリ<59>-Footnote-644018003
Ref: ライブラリ<59>-Footnote-654018060
Ref: ライブラリ<59>-Footnote-664018117
Ref: ライブラリ<59>-Footnote-674018174
Ref: ライブラリ<59>-Footnote-684018217
Ref: ライブラリ<59>-Footnote-694018273
Ref: ライブラリ<59>-Footnote-704018329
Ref: ライブラリ<59>-Footnote-714018386
Ref: ライブラリ<59>-Footnote-724018443
Ref: ライブラリ<59>-Footnote-734018500
Ref: ライブラリ<59>-Footnote-744018556
Ref: ライブラリ<59>-Footnote-754018612
Ref: ライブラリ<59>-Footnote-764018669
Ref: ライブラリ<59>-Footnote-774018726
Ref: ライブラリ<59>-Footnote-784018783
Ref: ライブラリ<59>-Footnote-794018840
Ref: ライブラリ<59>-Footnote-804018896
Ref: ライブラリ<59>-Footnote-814018953
Ref: ライブラリ<59>-Footnote-824019010
Ref: ライブラリ<59>-Footnote-834019066
Ref: ライブラリ<59>-Footnote-844019123
Ref: ライブラリ<59>-Footnote-854019180
Ref: ライブラリ<59>-Footnote-864019236
Ref: ライブラリ<59>-Footnote-874019292
Ref: ライブラリ<59>-Footnote-884019358
Ref: ライブラリ<59>-Footnote-894019424
Ref: ライブラリ<59>-Footnote-904019490
Ref: ライブラリ<59>-Footnote-914019556
Node: ドキュメント<18>4019622
Ref: whatsnew/changelog id2474019751
Ref: 1a0a4019751
Ref: ドキュメント<18>-Footnote-14019937
Node: ビルド<20>4019993
Ref: whatsnew/changelog id2484020114
Ref: 1a0b4020114
Ref: ビルド<20>-Footnote-14021068
Ref: ビルド<20>-Footnote-24021124
Ref: ビルド<20>-Footnote-34021180
Ref: ビルド<20>-Footnote-44021236
Ref: ビルド<20>-Footnote-54021292
Ref: ビルド<20>-Footnote-64021348
Node: Windows<17>4021404
Ref: whatsnew/changelog id2494021512
Ref: 1a0c4021512
Ref: Windows<17>-Footnote-14022551
Ref: Windows<17>-Footnote-24022607
Ref: Windows<17>-Footnote-34022663
Ref: Windows<17>-Footnote-44022719
Ref: Windows<17>-Footnote-54022775
Ref: Windows<17>-Footnote-64022831
Ref: Windows<17>-Footnote-74022886
Node: macOS<12>4022942
Ref: whatsnew/changelog id2504023044
Ref: 1a0d4023044
Ref: macOS<12>-Footnote-14023488
Ref: macOS<12>-Footnote-24023544
Ref: macOS<12>-Footnote-34023600
Ref: macOS<12>-Footnote-44023656
Node: IDLE<9>4023711
Ref: whatsnew/changelog id2514023811
Ref: 1a0e4023811
Ref: IDLE<9>-Footnote-14023952
Node: C API<19>4024017
Ref: whatsnew/changelog id2524024099
Ref: 1a0f4024099
Ref: C API<19>-Footnote-14025378
Ref: C API<19>-Footnote-24025434
Ref: C API<19>-Footnote-34025490
Ref: C API<19>-Footnote-44025546
Ref: C API<19>-Footnote-54025602
Ref: C API<19>-Footnote-64025658
Ref: C API<19>-Footnote-74025713
Node: Python 3 13 0 alpha 64025769
Ref: whatsnew/changelog python-3-13-0-alpha-64025898
Ref: 1a174025898
Node: Core and Builtins<55>4026311
Ref: whatsnew/changelog id2534026418
Ref: 1a184026418
Ref: Core and Builtins<55>-Footnote-14031079
Ref: Core and Builtins<55>-Footnote-24031135
Ref: Core and Builtins<55>-Footnote-34031191
Ref: Core and Builtins<55>-Footnote-44031247
Ref: Core and Builtins<55>-Footnote-54031303
Ref: Core and Builtins<55>-Footnote-64031359
Ref: Core and Builtins<55>-Footnote-74031415
Ref: Core and Builtins<55>-Footnote-84031471
Ref: Core and Builtins<55>-Footnote-94031526
Ref: Core and Builtins<55>-Footnote-104031573
Ref: Core and Builtins<55>-Footnote-114031630
Ref: Core and Builtins<55>-Footnote-124031687
Ref: Core and Builtins<55>-Footnote-134031744
Ref: Core and Builtins<55>-Footnote-144031801
Ref: Core and Builtins<55>-Footnote-154031858
Ref: Core and Builtins<55>-Footnote-164031915
Ref: Core and Builtins<55>-Footnote-174031972
Ref: Core and Builtins<55>-Footnote-184032029
Ref: Core and Builtins<55>-Footnote-194032086
Node: ライブラリ<60>4032143
Ref: whatsnew/changelog id2544032280
Ref: 1a1b4032280
Ref: ライブラリ<60>-Footnote-14032637
Ref: ライブラリ<60>-Footnote-24032693
Node: Core and Builtins<56>4032748
Ref: whatsnew/changelog id2554032883
Ref: 1a1c4032883
Ref: Core and Builtins<56>-Footnote-14033112
Node: ライブラリ<61>4033177
Ref: whatsnew/changelog id2564033315
Ref: 1a1d4033315
Ref: ライブラリ<61>-Footnote-14044112
Ref: ライブラリ<61>-Footnote-24044168
Ref: ライブラリ<61>-Footnote-34044224
Ref: ライブラリ<61>-Footnote-44044280
Ref: ライブラリ<61>-Footnote-54044336
Ref: ライブラリ<61>-Footnote-64044392
Ref: ライブラリ<61>-Footnote-74044448
Ref: ライブラリ<61>-Footnote-84044504
Ref: ライブラリ<61>-Footnote-94044560
Ref: ライブラリ<61>-Footnote-104044616
Ref: ライブラリ<61>-Footnote-114044673
Ref: ライブラリ<61>-Footnote-124044729
Ref: ライブラリ<61>-Footnote-134044785
Ref: ライブラリ<61>-Footnote-144044842
Ref: ライブラリ<61>-Footnote-154044899
Ref: ライブラリ<61>-Footnote-164044955
Ref: ライブラリ<61>-Footnote-174045012
Ref: ライブラリ<61>-Footnote-184045069
Ref: ライブラリ<61>-Footnote-194045126
Ref: ライブラリ<61>-Footnote-204045183
Ref: ライブラリ<61>-Footnote-214045240
Ref: ライブラリ<61>-Footnote-224045297
Ref: ライブラリ<61>-Footnote-234045354
Ref: ライブラリ<61>-Footnote-244045411
Ref: ライブラリ<61>-Footnote-254045468
Ref: ライブラリ<61>-Footnote-264045525
Ref: ライブラリ<61>-Footnote-274045581
Ref: ライブラリ<61>-Footnote-284045638
Ref: ライブラリ<61>-Footnote-294045695
Ref: ライブラリ<61>-Footnote-304045751
Ref: ライブラリ<61>-Footnote-314045808
Ref: ライブラリ<61>-Footnote-324045865
Ref: ライブラリ<61>-Footnote-334045921
Ref: ライブラリ<61>-Footnote-344045978
Ref: ライブラリ<61>-Footnote-354046046
Ref: ライブラリ<61>-Footnote-364046102
Ref: ライブラリ<61>-Footnote-374046159
Ref: ライブラリ<61>-Footnote-384046216
Ref: ライブラリ<61>-Footnote-394046273
Ref: ライブラリ<61>-Footnote-404046330
Ref: ライブラリ<61>-Footnote-414046386
Ref: ライブラリ<61>-Footnote-424046442
Ref: ライブラリ<61>-Footnote-434046498
Ref: ライブラリ<61>-Footnote-444046555
Ref: ライブラリ<61>-Footnote-454046612
Ref: ライブラリ<61>-Footnote-464046669
Ref: ライブラリ<61>-Footnote-474046726
Ref: ライブラリ<61>-Footnote-484046782
Ref: ライブラリ<61>-Footnote-494046838
Ref: ライブラリ<61>-Footnote-504046895
Ref: ライブラリ<61>-Footnote-514046952
Ref: ライブラリ<61>-Footnote-524047009
Ref: ライブラリ<61>-Footnote-534047066
Ref: ライブラリ<61>-Footnote-544047123
Ref: ライブラリ<61>-Footnote-554047179
Ref: ライブラリ<61>-Footnote-564047236
Ref: ライブラリ<61>-Footnote-574047293
Ref: ライブラリ<61>-Footnote-584047350
Ref: ライブラリ<61>-Footnote-594047406
Ref: ライブラリ<61>-Footnote-604047462
Ref: ライブラリ<61>-Footnote-614047528
Ref: ライブラリ<61>-Footnote-624047594
Ref: ライブラリ<61>-Footnote-634047660
Ref: ライブラリ<61>-Footnote-644047716
Node: ドキュメント<19>4047782
Ref: whatsnew/changelog id2574047912
Ref: 1a274047912
Ref: ドキュメント<19>-Footnote-14048329
Ref: ドキュメント<19>-Footnote-24048385
Ref: ドキュメント<19>-Footnote-34048441
Node: テスト<18>4048496
Ref: whatsnew/changelog id2584048620
Ref: 1a284048620
Ref: テスト<18>-Footnote-14049731
Ref: テスト<18>-Footnote-24049786
Ref: テスト<18>-Footnote-34049842
Ref: テスト<18>-Footnote-44049898
Ref: テスト<18>-Footnote-54049954
Ref: テスト<18>-Footnote-64050010
Ref: テスト<18>-Footnote-74050066
Node: ビルド<21>4050122
Ref: whatsnew/changelog id2594050235
Ref: 1a294050235
Ref: ビルド<21>-Footnote-14050518
Ref: ビルド<21>-Footnote-24050574
Ref: ビルド<21>-Footnote-34050630
Node: Windows<18>4050685
Ref: whatsnew/changelog id2604050794
Ref: 1a2a4050794
Ref: Windows<18>-Footnote-14052254
Ref: Windows<18>-Footnote-24052310
Ref: Windows<18>-Footnote-34052366
Ref: Windows<18>-Footnote-44052421
Ref: Windows<18>-Footnote-54052477
Ref: Windows<18>-Footnote-64052532
Node: C API<20>4052588
Ref: whatsnew/changelog id2614052675
Ref: 1a2c4052675
Ref: C API<20>-Footnote-14055939
Ref: C API<20>-Footnote-24055995
Ref: C API<20>-Footnote-34056037
Ref: C API<20>-Footnote-44056092
Ref: C API<20>-Footnote-54056148
Ref: C API<20>-Footnote-64056204
Ref: C API<20>-Footnote-74056260
Ref: C API<20>-Footnote-84056316
Ref: C API<20>-Footnote-94056372
Ref: C API<20>-Footnote-104056428
Ref: C API<20>-Footnote-114056485
Ref: C API<20>-Footnote-124056542
Ref: C API<20>-Footnote-134056599
Ref: C API<20>-Footnote-144056656
Ref: C API<20>-Footnote-154056699
Ref: C API<20>-Footnote-164056756
Ref: C API<20>-Footnote-174056813
Ref: C API<20>-Footnote-184056869
Ref: C API<20>-Footnote-194056926
Node: Python 3 13 0 alpha 54056983
Ref: whatsnew/changelog python-3-13-0-alpha-54057113
Ref: 1a2f4057113
Node: セキュリティ<23>4057726
Ref: whatsnew/changelog id2624057836
Ref: 1a304057836
Ref: セキュリティ<23>-Footnote-14058665
Ref: セキュリティ<23>-Footnote-24058721
Ref: セキュリティ<23>-Footnote-34058777
Node: Core and Builtins<57>4058833
Ref: whatsnew/changelog id2634058971
Ref: 1a314058971
Ref: Core and Builtins<57>-Footnote-14060351
Ref: Core and Builtins<57>-Footnote-24060407
Ref: Core and Builtins<57>-Footnote-34060463
Ref: Core and Builtins<57>-Footnote-44060505
Ref: Core and Builtins<57>-Footnote-54060561
Ref: Core and Builtins<57>-Footnote-64060617
Ref: Core and Builtins<57>-Footnote-74060673
Ref: Core and Builtins<57>-Footnote-84060729
Ref: Core and Builtins<57>-Footnote-94060785
Ref: Core and Builtins<57>-Footnote-104060841
Ref: Core and Builtins<57>-Footnote-114060898
Ref: Core and Builtins<57>-Footnote-124060955
Node: ライブラリ<62>4061012
Ref: whatsnew/changelog id2644061149
Ref: 1a324061149
Ref: ライブラリ<62>-Footnote-14061408
Node: Core and Builtins<58>4061464
Ref: whatsnew/changelog id2654061599
Ref: 1a334061599
Ref: Core and Builtins<58>-Footnote-14061841
Node: ライブラリ<63>4061897
Ref: whatsnew/changelog id2664062034
Ref: 1a344062034
Ref: ライブラリ<63>-Footnote-14062300
Node: Core and Builtins<59>4062356
Ref: whatsnew/changelog id2674062491
Ref: 1a354062491
Ref: Core and Builtins<59>-Footnote-14063320
Ref: Core and Builtins<59>-Footnote-24063376
Ref: Core and Builtins<59>-Footnote-34063432
Node: ライブラリ<64>4063487
Ref: whatsnew/changelog id2684063625
Ref: 1a364063625
Ref: ライブラリ<64>-Footnote-14075417
Ref: ライブラリ<64>-Footnote-24075473
Ref: ライブラリ<64>-Footnote-34075529
Ref: ライブラリ<64>-Footnote-44075585
Ref: ライブラリ<64>-Footnote-54075641
Ref: ライブラリ<64>-Footnote-64075683
Ref: ライブラリ<64>-Footnote-74075739
Ref: ライブラリ<64>-Footnote-84075795
Ref: ライブラリ<64>-Footnote-94075851
Ref: ライブラリ<64>-Footnote-104075906
Ref: ライブラリ<64>-Footnote-114075962
Ref: ライブラリ<64>-Footnote-124076018
Ref: ライブラリ<64>-Footnote-134076074
Ref: ライブラリ<64>-Footnote-144076130
Ref: ライブラリ<64>-Footnote-154076187
Ref: ライブラリ<64>-Footnote-164076244
Ref: ライブラリ<64>-Footnote-174076300
Ref: ライブラリ<64>-Footnote-184076356
Ref: ライブラリ<64>-Footnote-194076413
Ref: ライブラリ<64>-Footnote-204076469
Ref: ライブラリ<64>-Footnote-214076526
Ref: ライブラリ<64>-Footnote-224076583
Ref: ライブラリ<64>-Footnote-234076640
Ref: ライブラリ<64>-Footnote-244076697
Ref: ライブラリ<64>-Footnote-254076753
Ref: ライブラリ<64>-Footnote-264076809
Ref: ライブラリ<64>-Footnote-274076866
Ref: ライブラリ<64>-Footnote-284076923
Ref: ライブラリ<64>-Footnote-294076980
Ref: ライブラリ<64>-Footnote-304077037
Ref: ライブラリ<64>-Footnote-314077094
Ref: ライブラリ<64>-Footnote-324077151
Ref: ライブラリ<64>-Footnote-334077208
Ref: ライブラリ<64>-Footnote-344077265
Ref: ライブラリ<64>-Footnote-354077322
Ref: ライブラリ<64>-Footnote-364077379
Ref: ライブラリ<64>-Footnote-374077422
Ref: ライブラリ<64>-Footnote-384077479
Ref: ライブラリ<64>-Footnote-394077536
Ref: ライブラリ<64>-Footnote-404077593
Ref: ライブラリ<64>-Footnote-414077650
Ref: ライブラリ<64>-Footnote-424077707
Ref: ライブラリ<64>-Footnote-434077764
Ref: ライブラリ<64>-Footnote-444077821
Ref: ライブラリ<64>-Footnote-454077878
Ref: ライブラリ<64>-Footnote-464077935
Ref: ライブラリ<64>-Footnote-474077992
Ref: ライブラリ<64>-Footnote-484078048
Ref: ライブラリ<64>-Footnote-494078105
Ref: ライブラリ<64>-Footnote-504078162
Ref: ライブラリ<64>-Footnote-514078218
Ref: ライブラリ<64>-Footnote-524078274
Ref: ライブラリ<64>-Footnote-534078331
Ref: ライブラリ<64>-Footnote-544078387
Ref: ライブラリ<64>-Footnote-554078444
Ref: ライブラリ<64>-Footnote-564078500
Ref: ライブラリ<64>-Footnote-574078557
Ref: ライブラリ<64>-Footnote-584078614
Ref: ライブラリ<64>-Footnote-594078670
Ref: ライブラリ<64>-Footnote-604078726
Ref: ライブラリ<64>-Footnote-614078782
Ref: ライブラリ<64>-Footnote-624078848
Ref: ライブラリ<64>-Footnote-634078914
Ref: ライブラリ<64>-Footnote-644078980
Ref: ライブラリ<64>-Footnote-654079046
Ref: ライブラリ<64>-Footnote-664079112
Ref: ライブラリ<64>-Footnote-674079178
Node: ドキュメント<20>4079244
Ref: whatsnew/changelog id2694079374
Ref: 1a3f4079374
Ref: ドキュメント<20>-Footnote-14079630
Ref: ドキュメント<20>-Footnote-24079686
Ref: ドキュメント<20>-Footnote-34079742
Node: テスト<19>4079798
Ref: whatsnew/changelog id2704079922
Ref: 1a404079922
Ref: テスト<19>-Footnote-14081118
Ref: テスト<19>-Footnote-24081173
Ref: テスト<19>-Footnote-34081228
Ref: テスト<19>-Footnote-44081284
Ref: テスト<19>-Footnote-54081340
Ref: テスト<19>-Footnote-64081396
Ref: テスト<19>-Footnote-74081452
Ref: テスト<19>-Footnote-84081508
Ref: テスト<19>-Footnote-94081564
Node: ビルド<22>4081620
Ref: whatsnew/changelog id2714081733
Ref: 1a414081733
Ref: ビルド<22>-Footnote-14082646
Ref: ビルド<22>-Footnote-24082702
Ref: ビルド<22>-Footnote-34082757
Ref: ビルド<22>-Footnote-44082813
Ref: ビルド<22>-Footnote-54082868
Ref: ビルド<22>-Footnote-64082924
Ref: ビルド<22>-Footnote-74082980
Ref: ビルド<22>-Footnote-84083036
Ref: ビルド<22>-Footnote-94083092
Node: Windows<19>4083148
Ref: whatsnew/changelog id2724083257
Ref: 1a424083257
Ref: Windows<19>-Footnote-14084341
Ref: Windows<19>-Footnote-24084397
Ref: Windows<19>-Footnote-34084453
Ref: Windows<19>-Footnote-44084509
Node: macOS<13>4084565
Ref: whatsnew/changelog id2734084669
Ref: 1a434084669
Ref: macOS<13>-Footnote-14084801
Node: IDLE<10>4084857
Ref: whatsnew/changelog id2744084965
Ref: 1a444084965
Ref: IDLE<10>-Footnote-14085149
Node: Tools/Demos<16>4085204
Ref: whatsnew/changelog id2754085312
Ref: 1a454085312
Ref: Tools/Demos<16>-Footnote-14085555
Ref: Tools/Demos<16>-Footnote-24085611
Node: C API<21>4085676
Ref: whatsnew/changelog id2764085767
Ref: 1a464085767
Ref: C API<21>-Footnote-14086338
Ref: C API<21>-Footnote-24086394
Node: Python 3 13 0 alpha 44086450
Ref: whatsnew/changelog python-3-13-0-alpha-44086580
Ref: 1a4b4086580
Node: セキュリティ<24>4087025
Ref: whatsnew/changelog id2774087135
Ref: 1a4c4087135
Ref: セキュリティ<24>-Footnote-14087410
Ref: セキュリティ<24>-Footnote-24087466
Node: Core and Builtins<60>4087522
Ref: whatsnew/changelog id2784087660
Ref: 1a4d4087660
Ref: Core and Builtins<60>-Footnote-14092962
Ref: Core and Builtins<60>-Footnote-24093018
Ref: Core and Builtins<60>-Footnote-34093074
Ref: Core and Builtins<60>-Footnote-44093130
Ref: Core and Builtins<60>-Footnote-54093186
Ref: Core and Builtins<60>-Footnote-64093242
Ref: Core and Builtins<60>-Footnote-74093298
Ref: Core and Builtins<60>-Footnote-84093354
Ref: Core and Builtins<60>-Footnote-94093410
Ref: Core and Builtins<60>-Footnote-104093466
Ref: Core and Builtins<60>-Footnote-114093522
Ref: Core and Builtins<60>-Footnote-124093579
Ref: Core and Builtins<60>-Footnote-134093636
Ref: Core and Builtins<60>-Footnote-144093693
Ref: Core and Builtins<60>-Footnote-154093750
Ref: Core and Builtins<60>-Footnote-164093807
Ref: Core and Builtins<60>-Footnote-174093864
Ref: Core and Builtins<60>-Footnote-184093921
Ref: Core and Builtins<60>-Footnote-194093978
Ref: Core and Builtins<60>-Footnote-204094035
Ref: Core and Builtins<60>-Footnote-214094092
Ref: Core and Builtins<60>-Footnote-224094149
Ref: Core and Builtins<60>-Footnote-234094206
Ref: Core and Builtins<60>-Footnote-244094263
Ref: Core and Builtins<60>-Footnote-254094320
Ref: Core and Builtins<60>-Footnote-264094377
Ref: Core and Builtins<60>-Footnote-274094434
Ref: Core and Builtins<60>-Footnote-284094497
Ref: Core and Builtins<60>-Footnote-294094554
Ref: Core and Builtins<60>-Footnote-304094610
Node: ライブラリ<65>4094667
Ref: whatsnew/changelog id2794094805
Ref: 1a504094805
Ref: ライブラリ<65>-Footnote-14108767
Ref: ライブラリ<65>-Footnote-24108823
Ref: ライブラリ<65>-Footnote-34108879
Ref: ライブラリ<65>-Footnote-44108935
Ref: ライブラリ<65>-Footnote-54108991
Ref: ライブラリ<65>-Footnote-64109047
Ref: ライブラリ<65>-Footnote-74109103
Ref: ライブラリ<65>-Footnote-84109159
Ref: ライブラリ<65>-Footnote-94109214
Ref: ライブラリ<65>-Footnote-104109269
Ref: ライブラリ<65>-Footnote-114109326
Ref: ライブラリ<65>-Footnote-124109382
Ref: ライブラリ<65>-Footnote-134109439
Ref: ライブラリ<65>-Footnote-144109495
Ref: ライブラリ<65>-Footnote-154109552
Ref: ライブラリ<65>-Footnote-164109609
Ref: ライブラリ<65>-Footnote-174109666
Ref: ライブラリ<65>-Footnote-184109723
Ref: ライブラリ<65>-Footnote-194109780
Ref: ライブラリ<65>-Footnote-204109836
Ref: ライブラリ<65>-Footnote-214109893
Ref: ライブラリ<65>-Footnote-224109950
Ref: ライブラリ<65>-Footnote-234110006
Ref: ライブラリ<65>-Footnote-244110063
Ref: ライブラリ<65>-Footnote-254110120
Ref: ライブラリ<65>-Footnote-264110176
Ref: ライブラリ<65>-Footnote-274110232
Ref: ライブラリ<65>-Footnote-284110288
Ref: ライブラリ<65>-Footnote-294110345
Ref: ライブラリ<65>-Footnote-304110401
Ref: ライブラリ<65>-Footnote-314110458
Ref: ライブラリ<65>-Footnote-324110515
Ref: ライブラリ<65>-Footnote-334110572
Ref: ライブラリ<65>-Footnote-344110629
Ref: ライブラリ<65>-Footnote-354110686
Ref: ライブラリ<65>-Footnote-364110743
Ref: ライブラリ<65>-Footnote-374110799
Ref: ライブラリ<65>-Footnote-384110856
Ref: ライブラリ<65>-Footnote-394110913
Ref: ライブラリ<65>-Footnote-404110970
Ref: ライブラリ<65>-Footnote-414111027
Ref: ライブラリ<65>-Footnote-424111084
Ref: ライブラリ<65>-Footnote-434111128
Ref: ライブラリ<65>-Footnote-444111185
Ref: ライブラリ<65>-Footnote-454111242
Ref: ライブラリ<65>-Footnote-464111299
Ref: ライブラリ<65>-Footnote-474111356
Ref: ライブラリ<65>-Footnote-484111412
Ref: ライブラリ<65>-Footnote-494111469
Ref: ライブラリ<65>-Footnote-504111526
Ref: ライブラリ<65>-Footnote-514111582
Ref: ライブラリ<65>-Footnote-524111639
Ref: ライブラリ<65>-Footnote-534111696
Ref: ライブラリ<65>-Footnote-544111752
Ref: ライブラリ<65>-Footnote-554111809
Ref: ライブラリ<65>-Footnote-564111866
Ref: ライブラリ<65>-Footnote-574111923
Ref: ライブラリ<65>-Footnote-584111979
Ref: ライブラリ<65>-Footnote-594112036
Ref: ライブラリ<65>-Footnote-604112092
Ref: ライブラリ<65>-Footnote-614112149
Ref: ライブラリ<65>-Footnote-624112206
Ref: ライブラリ<65>-Footnote-634112263
Ref: ライブラリ<65>-Footnote-644112319
Ref: ライブラリ<65>-Footnote-654112375
Ref: ライブラリ<65>-Footnote-664112432
Ref: ライブラリ<65>-Footnote-674112489
Ref: ライブラリ<65>-Footnote-684112545
Ref: ライブラリ<65>-Footnote-694112601
Ref: ライブラリ<65>-Footnote-704112658
Ref: ライブラリ<65>-Footnote-714112715
Ref: ライブラリ<65>-Footnote-724112772
Ref: ライブラリ<65>-Footnote-734112828
Ref: ライブラリ<65>-Footnote-744112885
Ref: ライブラリ<65>-Footnote-754112941
Ref: ライブラリ<65>-Footnote-764112998
Ref: ライブラリ<65>-Footnote-774113054
Node: ドキュメント<21>4113120
Ref: whatsnew/changelog id2804113250
Ref: 1a634113250
Ref: ドキュメント<21>-Footnote-14113825
Ref: ドキュメント<21>-Footnote-24113881
Node: テスト<20>4113937
Ref: whatsnew/changelog id2814114061
Ref: 1a644114061
Ref: テスト<20>-Footnote-14114458
Ref: テスト<20>-Footnote-24114514
Node: ビルド<23>4114570
Ref: whatsnew/changelog id2824114683
Ref: 1a654114683
Ref: ビルド<23>-Footnote-14115226
Ref: ビルド<23>-Footnote-24115282
Ref: ビルド<23>-Footnote-34115338
Ref: ビルド<23>-Footnote-44115394
Node: Windows<20>4115450
Ref: whatsnew/changelog id2834115559
Ref: 1a664115559
Ref: Windows<20>-Footnote-14116312
Ref: Windows<20>-Footnote-24116368
Ref: Windows<20>-Footnote-34116424
Ref: Windows<20>-Footnote-44116480
Ref: Windows<20>-Footnote-54116536
Ref: Windows<20>-Footnote-64116592
Ref: Windows<20>-Footnote-74116648
Node: macOS<14>4116703
Ref: whatsnew/changelog id2844116807
Ref: 1a674116807
Ref: macOS<14>-Footnote-14117346
Ref: macOS<14>-Footnote-24117402
Ref: macOS<14>-Footnote-34117458
Ref: macOS<14>-Footnote-44117514
Node: IDLE<11>4117569
Ref: whatsnew/changelog id2854117677
Ref: 1a694117677
Ref: IDLE<11>-Footnote-14118004
Ref: IDLE<11>-Footnote-24118059
Node: Tools/Demos<17>4118115
Ref: whatsnew/changelog id2864118223
Ref: 1a6a4118223
Ref: Tools/Demos<17>-Footnote-14118834
Ref: Tools/Demos<17>-Footnote-24118890
Ref: Tools/Demos<17>-Footnote-34118946
Node: C API<22>4119002
Ref: whatsnew/changelog id2874119093
Ref: 1a6c4119093
Ref: C API<22>-Footnote-14121037
Ref: C API<22>-Footnote-24121093
Ref: C API<22>-Footnote-34121149
Ref: C API<22>-Footnote-44121205
Ref: C API<22>-Footnote-54121261
Ref: C API<22>-Footnote-64121317
Ref: C API<22>-Footnote-74121373
Node: Python 3 13 0 alpha 34121429
Ref: whatsnew/changelog python-3-13-0-alpha-34121559
Ref: 1a6f4121559
Node: セキュリティ<25>4121972
Ref: whatsnew/changelog id2884122082
Ref: 1a704122082
Ref: セキュリティ<25>-Footnote-14122385
Ref: セキュリティ<25>-Footnote-24122441
Node: Core and Builtins<61>4122497
Ref: whatsnew/changelog id2894122635
Ref: 1a714122635
Ref: Core and Builtins<61>-Footnote-14130014
Ref: Core and Builtins<61>-Footnote-24130070
Ref: Core and Builtins<61>-Footnote-34130126
Ref: Core and Builtins<61>-Footnote-44130182
Ref: Core and Builtins<61>-Footnote-54130238
Ref: Core and Builtins<61>-Footnote-64130293
Ref: Core and Builtins<61>-Footnote-74130335
Ref: Core and Builtins<61>-Footnote-84130391
Ref: Core and Builtins<61>-Footnote-94130447
Ref: Core and Builtins<61>-Footnote-104130503
Ref: Core and Builtins<61>-Footnote-114130560
Ref: Core and Builtins<61>-Footnote-124130616
Ref: Core and Builtins<61>-Footnote-134130673
Ref: Core and Builtins<61>-Footnote-144130730
Ref: Core and Builtins<61>-Footnote-154130787
Ref: Core and Builtins<61>-Footnote-164130844
Ref: Core and Builtins<61>-Footnote-174130901
Ref: Core and Builtins<61>-Footnote-184130958
Ref: Core and Builtins<61>-Footnote-194131015
Ref: Core and Builtins<61>-Footnote-204131072
Ref: Core and Builtins<61>-Footnote-214131129
Ref: Core and Builtins<61>-Footnote-224131186
Ref: Core and Builtins<61>-Footnote-234131243
Ref: Core and Builtins<61>-Footnote-244131300
Ref: Core and Builtins<61>-Footnote-254131356
Ref: Core and Builtins<61>-Footnote-264131413
Ref: Core and Builtins<61>-Footnote-274131470
Ref: Core and Builtins<61>-Footnote-284131526
Ref: Core and Builtins<61>-Footnote-294131583
Ref: Core and Builtins<61>-Footnote-304131640
Ref: Core and Builtins<61>-Footnote-314131697
Ref: Core and Builtins<61>-Footnote-324131754
Ref: Core and Builtins<61>-Footnote-334131811
Ref: Core and Builtins<61>-Footnote-344131867
Ref: Core and Builtins<61>-Footnote-354131924
Ref: Core and Builtins<61>-Footnote-364131981
Ref: Core and Builtins<61>-Footnote-374132038
Ref: Core and Builtins<61>-Footnote-384132095
Ref: Core and Builtins<61>-Footnote-394132151
Ref: Core and Builtins<61>-Footnote-404132208
Ref: Core and Builtins<61>-Footnote-414132265
Ref: Core and Builtins<61>-Footnote-424132322
Ref: Core and Builtins<61>-Footnote-434132378
Ref: Core and Builtins<61>-Footnote-444132444
Ref: Core and Builtins<61>-Footnote-454132510
Ref: Core and Builtins<61>-Footnote-464132553
Node: ライブラリ<66>4132619
Ref: whatsnew/changelog id2904132757
Ref: 1a764132757
Ref: ライブラリ<66>-Footnote-14157941
Ref: ライブラリ<66>-Footnote-24157997
Ref: ライブラリ<66>-Footnote-34158053
Ref: ライブラリ<66>-Footnote-44158109
Ref: ライブラリ<66>-Footnote-54158165
Ref: ライブラリ<66>-Footnote-64158221
Ref: ライブラリ<66>-Footnote-74158277
Ref: ライブラリ<66>-Footnote-84158333
Ref: ライブラリ<66>-Footnote-94158389
Ref: ライブラリ<66>-Footnote-104158445
Ref: ライブラリ<66>-Footnote-114158501
Ref: ライブラリ<66>-Footnote-124158558
Ref: ライブラリ<66>-Footnote-134158615
Ref: ライブラリ<66>-Footnote-144158672
Ref: ライブラリ<66>-Footnote-154158729
Ref: ライブラリ<66>-Footnote-164158786
Ref: ライブラリ<66>-Footnote-174158843
Ref: ライブラリ<66>-Footnote-184158900
Ref: ライブラリ<66>-Footnote-194158957
Ref: ライブラリ<66>-Footnote-204159014
Ref: ライブラリ<66>-Footnote-214159070
Ref: ライブラリ<66>-Footnote-224159127
Ref: ライブラリ<66>-Footnote-234159183
Ref: ライブラリ<66>-Footnote-244159240
Ref: ライブラリ<66>-Footnote-254159297
Ref: ライブラリ<66>-Footnote-264159354
Ref: ライブラリ<66>-Footnote-274159411
Ref: ライブラリ<66>-Footnote-284159468
Ref: ライブラリ<66>-Footnote-294159525
Ref: ライブラリ<66>-Footnote-304159582
Ref: ライブラリ<66>-Footnote-314159639
Ref: ライブラリ<66>-Footnote-324159696
Ref: ライブラリ<66>-Footnote-334159752
Ref: ライブラリ<66>-Footnote-344159809
Ref: ライブラリ<66>-Footnote-354159866
Ref: ライブラリ<66>-Footnote-364159923
Ref: ライブラリ<66>-Footnote-374159979
Ref: ライブラリ<66>-Footnote-384160036
Ref: ライブラリ<66>-Footnote-394160093
Ref: ライブラリ<66>-Footnote-404160150
Ref: ライブラリ<66>-Footnote-414160207
Ref: ライブラリ<66>-Footnote-424160264
Ref: ライブラリ<66>-Footnote-434160321
Ref: ライブラリ<66>-Footnote-444160378
Ref: ライブラリ<66>-Footnote-454160435
Ref: ライブラリ<66>-Footnote-464160492
Ref: ライブラリ<66>-Footnote-474160548
Ref: ライブラリ<66>-Footnote-484160605
Ref: ライブラリ<66>-Footnote-494160661
Ref: ライブラリ<66>-Footnote-504160718
Ref: ライブラリ<66>-Footnote-514160775
Ref: ライブラリ<66>-Footnote-524160832
Ref: ライブラリ<66>-Footnote-534160889
Ref: ライブラリ<66>-Footnote-544160946
Ref: ライブラリ<66>-Footnote-554161003
Ref: ライブラリ<66>-Footnote-564161059
Ref: ライブラリ<66>-Footnote-574161116
Ref: ライブラリ<66>-Footnote-584161172
Ref: ライブラリ<66>-Footnote-594161228
Ref: ライブラリ<66>-Footnote-604161284
Ref: ライブラリ<66>-Footnote-614161341
Ref: ライブラリ<66>-Footnote-624161398
Ref: ライブラリ<66>-Footnote-634161454
Ref: ライブラリ<66>-Footnote-644161510
Ref: ライブラリ<66>-Footnote-654161567
Ref: ライブラリ<66>-Footnote-664161624
Ref: ライブラリ<66>-Footnote-674161681
Ref: ライブラリ<66>-Footnote-684161738
Ref: ライブラリ<66>-Footnote-694161795
Ref: ライブラリ<66>-Footnote-704161852
Ref: ライブラリ<66>-Footnote-714161908
Ref: ライブラリ<66>-Footnote-724161965
Ref: ライブラリ<66>-Footnote-734162022
Ref: ライブラリ<66>-Footnote-744162079
Ref: ライブラリ<66>-Footnote-754162136
Ref: ライブラリ<66>-Footnote-764162193
Ref: ライブラリ<66>-Footnote-774162250
Ref: ライブラリ<66>-Footnote-784162306
Ref: ライブラリ<66>-Footnote-794162363
Ref: ライブラリ<66>-Footnote-804162420
Ref: ライブラリ<66>-Footnote-814162477
Ref: ライブラリ<66>-Footnote-824162533
Ref: ライブラリ<66>-Footnote-834162590
Ref: ライブラリ<66>-Footnote-844162647
Ref: ライブラリ<66>-Footnote-854162704
Ref: ライブラリ<66>-Footnote-864162761
Ref: ライブラリ<66>-Footnote-874162817
Ref: ライブラリ<66>-Footnote-884162874
Ref: ライブラリ<66>-Footnote-894162930
Ref: ライブラリ<66>-Footnote-904162987
Ref: ライブラリ<66>-Footnote-914163044
Ref: ライブラリ<66>-Footnote-924163101
Ref: ライブラリ<66>-Footnote-934163158
Ref: ライブラリ<66>-Footnote-944163215
Ref: ライブラリ<66>-Footnote-954163271
Ref: ライブラリ<66>-Footnote-964163328
Ref: ライブラリ<66>-Footnote-974163384
Ref: ライブラリ<66>-Footnote-984163441
Ref: ライブラリ<66>-Footnote-994163497
Ref: ライブラリ<66>-Footnote-1004163553
Ref: ライブラリ<66>-Footnote-1014163610
Ref: ライブラリ<66>-Footnote-1024163668
Ref: ライブラリ<66>-Footnote-1034163726
Ref: ライブラリ<66>-Footnote-1044163784
Ref: ライブラリ<66>-Footnote-1054163842
Ref: ライブラリ<66>-Footnote-1064163899
Ref: ライブラリ<66>-Footnote-1074163956
Ref: ライブラリ<66>-Footnote-1084164014
Ref: ライブラリ<66>-Footnote-1094164072
Ref: ライブラリ<66>-Footnote-1104164130
Ref: ライブラリ<66>-Footnote-1114164187
Ref: ライブラリ<66>-Footnote-1124164245
Ref: ライブラリ<66>-Footnote-1134164303
Ref: ライブラリ<66>-Footnote-1144164360
Ref: ライブラリ<66>-Footnote-1154164418
Ref: ライブラリ<66>-Footnote-1164164462
Ref: ライブラリ<66>-Footnote-1174164520
Ref: ライブラリ<66>-Footnote-1184164577
Ref: ライブラリ<66>-Footnote-1194164634
Ref: ライブラリ<66>-Footnote-1204164691
Ref: ライブラリ<66>-Footnote-1214164758
Ref: ライブラリ<66>-Footnote-1224164825
Ref: ライブラリ<66>-Footnote-1234164892
Ref: ライブラリ<66>-Footnote-1244164959
Ref: ライブラリ<66>-Footnote-1254165026
Ref: ライブラリ<66>-Footnote-1264165093
Ref: ライブラリ<66>-Footnote-1274165160
Ref: ライブラリ<66>-Footnote-1284165227
Ref: ライブラリ<66>-Footnote-1294165294
Ref: ライブラリ<66>-Footnote-1304165361
Ref: ライブラリ<66>-Footnote-1314165428
Ref: ライブラリ<66>-Footnote-1324165495
Ref: ライブラリ<66>-Footnote-1334165562
Ref: ライブラリ<66>-Footnote-1344165629
Node: ドキュメント<22>4165696
Ref: whatsnew/changelog id2914165826
Ref: 1a904165826
Ref: ドキュメント<22>-Footnote-14166396
Ref: ドキュメント<22>-Footnote-24166452
Ref: ドキュメント<22>-Footnote-34166508
Ref: ドキュメント<22>-Footnote-44166563
Node: テスト<21>4166621
Ref: whatsnew/changelog id2924166745
Ref: 1a914166745
Ref: テスト<21>-Footnote-14168695
Ref: テスト<21>-Footnote-24168751
Ref: テスト<21>-Footnote-34168807
Ref: テスト<21>-Footnote-44168863
Ref: テスト<21>-Footnote-54168918
Ref: テスト<21>-Footnote-64168974
Ref: テスト<21>-Footnote-74169030
Ref: テスト<21>-Footnote-84169086
Ref: テスト<21>-Footnote-94169142
Ref: テスト<21>-Footnote-104169198
Node: ビルド<24>4169264
Ref: whatsnew/changelog id2934169377
Ref: 1a924169377
Ref: ビルド<24>-Footnote-14170626
Ref: ビルド<24>-Footnote-24170682
Ref: ビルド<24>-Footnote-34170738
Ref: ビルド<24>-Footnote-44170794
Ref: ビルド<24>-Footnote-54170850
Ref: ビルド<24>-Footnote-64170906
Ref: ビルド<24>-Footnote-74170962
Ref: ビルド<24>-Footnote-84171027
Node: Windows<21>4171092
Ref: whatsnew/changelog id2944171201
Ref: 1a934171201
Ref: Windows<21>-Footnote-14173042
Ref: Windows<21>-Footnote-24173098
Ref: Windows<21>-Footnote-34173154
Ref: Windows<21>-Footnote-44173210
Ref: Windows<21>-Footnote-54173266
Ref: Windows<21>-Footnote-64173321
Ref: Windows<21>-Footnote-74173376
Ref: Windows<21>-Footnote-84173432
Ref: Windows<21>-Footnote-94173488
Ref: Windows<21>-Footnote-104173543
Ref: Windows<21>-Footnote-114173599
Node: macOS<15>4173665
Ref: whatsnew/changelog id2954173769
Ref: 1a944173769
Ref: macOS<15>-Footnote-14176165
Ref: macOS<15>-Footnote-24176221
Ref: macOS<15>-Footnote-34176277
Ref: macOS<15>-Footnote-44176333
Ref: macOS<15>-Footnote-54176388
Ref: macOS<15>-Footnote-64176443
Ref: macOS<15>-Footnote-74176498
Ref: macOS<15>-Footnote-84176554
Ref: macOS<15>-Footnote-94176610
Ref: macOS<15>-Footnote-104176666
Ref: macOS<15>-Footnote-114176723
Ref: macOS<15>-Footnote-124176780
Node: IDLE<12>4176837
Ref: whatsnew/changelog id2964176939
Ref: 1a954176939
Ref: IDLE<12>-Footnote-14177515
Ref: IDLE<12>-Footnote-24177570
Ref: IDLE<12>-Footnote-34177626
Ref: IDLE<12>-Footnote-44177682
Ref: IDLE<12>-Footnote-54177738
Ref: IDLE<12>-Footnote-64177794
Node: C API<23>4177859
Ref: whatsnew/changelog id2974177943
Ref: 1a964177943
Ref: C API<23>-Footnote-14178658
Ref: C API<23>-Footnote-24178714
Ref: C API<23>-Footnote-34178770
Ref: C API<23>-Footnote-44178826
Node: Python 3 13 0 alpha 24178881
Ref: whatsnew/changelog python-3-13-0-alpha-24179011
Ref: 1a974179011
Node: Core and Builtins<62>4179364
Ref: whatsnew/changelog id2984179471
Ref: 1a984179471
Ref: Core and Builtins<62>-Footnote-14187292
Ref: Core and Builtins<62>-Footnote-24187348
Ref: Core and Builtins<62>-Footnote-34187404
Ref: Core and Builtins<62>-Footnote-44187460
Ref: Core and Builtins<62>-Footnote-54187516
Ref: Core and Builtins<62>-Footnote-64187572
Ref: Core and Builtins<62>-Footnote-74187628
Ref: Core and Builtins<62>-Footnote-84187684
Ref: Core and Builtins<62>-Footnote-94187739
Ref: Core and Builtins<62>-Footnote-104187794
Ref: Core and Builtins<62>-Footnote-114187850
Ref: Core and Builtins<62>-Footnote-124187907
Ref: Core and Builtins<62>-Footnote-134187964
Ref: Core and Builtins<62>-Footnote-144188021
Ref: Core and Builtins<62>-Footnote-154188078
Ref: Core and Builtins<62>-Footnote-164188135
Ref: Core and Builtins<62>-Footnote-174188192
Ref: Core and Builtins<62>-Footnote-184188249
Ref: Core and Builtins<62>-Footnote-194188306
Ref: Core and Builtins<62>-Footnote-204188363
Ref: Core and Builtins<62>-Footnote-214188420
Ref: Core and Builtins<62>-Footnote-224188477
Ref: Core and Builtins<62>-Footnote-234188534
Ref: Core and Builtins<62>-Footnote-244188591
Ref: Core and Builtins<62>-Footnote-254188648
Ref: Core and Builtins<62>-Footnote-264188705
Ref: Core and Builtins<62>-Footnote-274188762
Ref: Core and Builtins<62>-Footnote-284188819
Ref: Core and Builtins<62>-Footnote-294188876
Ref: Core and Builtins<62>-Footnote-304188932
Ref: Core and Builtins<62>-Footnote-314188988
Ref: Core and Builtins<62>-Footnote-324189045
Ref: Core and Builtins<62>-Footnote-334189102
Ref: Core and Builtins<62>-Footnote-344189159
Ref: Core and Builtins<62>-Footnote-354189216
Ref: Core and Builtins<62>-Footnote-364189273
Ref: Core and Builtins<62>-Footnote-374189330
Ref: Core and Builtins<62>-Footnote-384189387
Ref: Core and Builtins<62>-Footnote-394189444
Ref: Core and Builtins<62>-Footnote-404189501
Ref: Core and Builtins<62>-Footnote-414189558
Ref: Core and Builtins<62>-Footnote-424189615
Ref: Core and Builtins<62>-Footnote-434189672
Ref: Core and Builtins<62>-Footnote-444189728
Ref: Core and Builtins<62>-Footnote-454189794
Ref: Core and Builtins<62>-Footnote-464189851
Ref: Core and Builtins<62>-Footnote-474189917
Ref: Core and Builtins<62>-Footnote-484189974
Ref: Core and Builtins<62>-Footnote-494190031
Ref: Core and Builtins<62>-Footnote-504190088
Node: ライブラリ<67>4190154
Ref: whatsnew/changelog id2994190283
Ref: 1a9b4190283
Ref: ライブラリ<67>-Footnote-14200860
Ref: ライブラリ<67>-Footnote-24200916
Ref: ライブラリ<67>-Footnote-34200972
Ref: ライブラリ<67>-Footnote-44201028
Ref: ライブラリ<67>-Footnote-54201084
Ref: ライブラリ<67>-Footnote-64201140
Ref: ライブラリ<67>-Footnote-74201196
Ref: ライブラリ<67>-Footnote-84201252
Ref: ライブラリ<67>-Footnote-94201308
Ref: ライブラリ<67>-Footnote-104201364
Ref: ライブラリ<67>-Footnote-114201421
Ref: ライブラリ<67>-Footnote-124201477
Ref: ライブラリ<67>-Footnote-134201534
Ref: ライブラリ<67>-Footnote-144201591
Ref: ライブラリ<67>-Footnote-154201648
Ref: ライブラリ<67>-Footnote-164201705
Ref: ライブラリ<67>-Footnote-174201762
Ref: ライブラリ<67>-Footnote-184201819
Ref: ライブラリ<67>-Footnote-194201876
Ref: ライブラリ<67>-Footnote-204201932
Ref: ライブラリ<67>-Footnote-214201989
Ref: ライブラリ<67>-Footnote-224202046
Ref: ライブラリ<67>-Footnote-234202102
Ref: ライブラリ<67>-Footnote-244202159
Ref: ライブラリ<67>-Footnote-254202215
Ref: ライブラリ<67>-Footnote-264202272
Ref: ライブラリ<67>-Footnote-274202329
Ref: ライブラリ<67>-Footnote-284202386
Ref: ライブラリ<67>-Footnote-294202443
Ref: ライブラリ<67>-Footnote-304202500
Ref: ライブラリ<67>-Footnote-314202557
Ref: ライブラリ<67>-Footnote-324202614
Ref: ライブラリ<67>-Footnote-334202671
Ref: ライブラリ<67>-Footnote-344202728
Ref: ライブラリ<67>-Footnote-354202785
Ref: ライブラリ<67>-Footnote-364202842
Ref: ライブラリ<67>-Footnote-374202899
Ref: ライブラリ<67>-Footnote-384202956
Ref: ライブラリ<67>-Footnote-394203012
Ref: ライブラリ<67>-Footnote-404203068
Ref: ライブラリ<67>-Footnote-414203125
Ref: ライブラリ<67>-Footnote-424203182
Ref: ライブラリ<67>-Footnote-434203239
Ref: ライブラリ<67>-Footnote-444203295
Ref: ライブラリ<67>-Footnote-454203351
Ref: ライブラリ<67>-Footnote-464203408
Ref: ライブラリ<67>-Footnote-474203465
Ref: ライブラリ<67>-Footnote-484203522
Ref: ライブラリ<67>-Footnote-494203579
Ref: ライブラリ<67>-Footnote-504203635
Ref: ライブラリ<67>-Footnote-514203692
Ref: ライブラリ<67>-Footnote-524203749
Ref: ライブラリ<67>-Footnote-534203806
Ref: ライブラリ<67>-Footnote-544203862
Ref: ライブラリ<67>-Footnote-554203918
Ref: ライブラリ<67>-Footnote-564203974
Ref: ライブラリ<67>-Footnote-574204031
Ref: ライブラリ<67>-Footnote-584204088
Ref: ライブラリ<67>-Footnote-594204144
Ref: ライブラリ<67>-Footnote-604204200
Ref: ライブラリ<67>-Footnote-614204285
Ref: ライブラリ<67>-Footnote-624204341
Node: テスト<22>4204397
Ref: whatsnew/changelog id3004204518
Ref: 1aab4204518
Ref: テスト<22>-Footnote-14206109
Ref: テスト<22>-Footnote-24206165
Ref: テスト<22>-Footnote-34206221
Ref: テスト<22>-Footnote-44206277
Ref: テスト<22>-Footnote-54206333
Ref: テスト<22>-Footnote-64206389
Ref: テスト<22>-Footnote-74206445
Ref: テスト<22>-Footnote-84206501
Node: ビルド<25>4206557
Ref: whatsnew/changelog id3014206670
Ref: 1aac4206670
Ref: ビルド<25>-Footnote-14207661
Ref: ビルド<25>-Footnote-24207716
Ref: ビルド<25>-Footnote-34207772
Ref: ビルド<25>-Footnote-44207822
Ref: ビルド<25>-Footnote-54207878
Ref: ビルド<25>-Footnote-64207934
Node: Windows<22>4207989
Ref: whatsnew/changelog id3024208098
Ref: 1aad4208098
Ref: Windows<22>-Footnote-14208552
Ref: Windows<22>-Footnote-24208608
Ref: Windows<22>-Footnote-34208664
Node: macOS<16>4208720
Ref: whatsnew/changelog id3034208824
Ref: 1aaf4208824
Ref: macOS<16>-Footnote-14209755
Ref: macOS<16>-Footnote-24209810
Ref: macOS<16>-Footnote-34209866
Ref: macOS<16>-Footnote-44209922
Ref: macOS<16>-Footnote-54209977
Node: IDLE<13>4210032
Ref: whatsnew/changelog id3044210140
Ref: 1ab04210140
Ref: IDLE<13>-Footnote-14210478
Node: Tools/Demos<18>4210543
Ref: whatsnew/changelog id3054210651
Ref: 1ab14210651
Ref: Tools/Demos<18>-Footnote-14211008
Node: C API<24>4211064
Ref: whatsnew/changelog id3064211155
Ref: 1ab24211155
Ref: C API<24>-Footnote-14216521
Ref: C API<24>-Footnote-24216577
Ref: C API<24>-Footnote-34216633
Ref: C API<24>-Footnote-44216689
Ref: C API<24>-Footnote-54216745
Ref: C API<24>-Footnote-64216801
Ref: C API<24>-Footnote-74216857
Ref: C API<24>-Footnote-84216913
Ref: C API<24>-Footnote-94216969
Ref: C API<24>-Footnote-104217025
Ref: C API<24>-Footnote-114217082
Ref: C API<24>-Footnote-124217125
Ref: C API<24>-Footnote-134217182
Ref: C API<24>-Footnote-144217239
Ref: C API<24>-Footnote-154217296
Ref: C API<24>-Footnote-164217353
Ref: C API<24>-Footnote-174217410
Ref: C API<24>-Footnote-184217466
Ref: C API<24>-Footnote-194217522
Ref: C API<24>-Footnote-204217579
Node: Python 3 13 0 alpha 14217635
Ref: whatsnew/changelog python-3-13-0-alpha-14217764
Ref: 1ab34217764
Node: セキュリティ<26>4218209
Ref: whatsnew/changelog id3074218319
Ref: 1ab44218319
Ref: セキュリティ<26>-Footnote-14219601
Ref: セキュリティ<26>-Footnote-24219657
Ref: セキュリティ<26>-Footnote-34219713
Ref: セキュリティ<26>-Footnote-44219769
Ref: セキュリティ<26>-Footnote-54219825
Ref: セキュリティ<26>-Footnote-64219881
Ref: セキュリティ<26>-Footnote-74219936
Node: Core and Builtins<63>4219992
Ref: whatsnew/changelog id3084220130
Ref: 1ab54220130
Ref: Core and Builtins<63>-Footnote-14250863
Ref: Core and Builtins<63>-Footnote-24250919
Ref: Core and Builtins<63>-Footnote-34250975
Ref: Core and Builtins<63>-Footnote-44251031
Ref: Core and Builtins<63>-Footnote-54251087
Ref: Core and Builtins<63>-Footnote-64251143
Ref: Core and Builtins<63>-Footnote-74251199
Ref: Core and Builtins<63>-Footnote-84251255
Ref: Core and Builtins<63>-Footnote-94251311
Ref: Core and Builtins<63>-Footnote-104251367
Ref: Core and Builtins<63>-Footnote-114251424
Ref: Core and Builtins<63>-Footnote-124251481
Ref: Core and Builtins<63>-Footnote-134251538
Ref: Core and Builtins<63>-Footnote-144251595
Ref: Core and Builtins<63>-Footnote-154251652
Ref: Core and Builtins<63>-Footnote-164251709
Ref: Core and Builtins<63>-Footnote-174251766
Ref: Core and Builtins<63>-Footnote-184251823
Ref: Core and Builtins<63>-Footnote-194251880
Ref: Core and Builtins<63>-Footnote-204251937
Ref: Core and Builtins<63>-Footnote-214251994
Ref: Core and Builtins<63>-Footnote-224252051
Ref: Core and Builtins<63>-Footnote-234252108
Ref: Core and Builtins<63>-Footnote-244252165
Ref: Core and Builtins<63>-Footnote-254252222
Ref: Core and Builtins<63>-Footnote-264252279
Ref: Core and Builtins<63>-Footnote-274252336
Ref: Core and Builtins<63>-Footnote-284252393
Ref: Core and Builtins<63>-Footnote-294252450
Ref: Core and Builtins<63>-Footnote-304252507
Ref: Core and Builtins<63>-Footnote-314252564
Ref: Core and Builtins<63>-Footnote-324252621
Ref: Core and Builtins<63>-Footnote-334252678
Ref: Core and Builtins<63>-Footnote-344252735
Ref: Core and Builtins<63>-Footnote-354252792
Ref: Core and Builtins<63>-Footnote-364252849
Ref: Core and Builtins<63>-Footnote-374252906
Ref: Core and Builtins<63>-Footnote-384252963
Ref: Core and Builtins<63>-Footnote-394253020
Ref: Core and Builtins<63>-Footnote-404253077
Ref: Core and Builtins<63>-Footnote-414253134
Ref: Core and Builtins<63>-Footnote-424253191
Ref: Core and Builtins<63>-Footnote-434253248
Ref: Core and Builtins<63>-Footnote-444253305
Ref: Core and Builtins<63>-Footnote-454253361
Ref: Core and Builtins<63>-Footnote-464253418
Ref: Core and Builtins<63>-Footnote-474253475
Ref: Core and Builtins<63>-Footnote-484253532
Ref: Core and Builtins<63>-Footnote-494253589
Ref: Core and Builtins<63>-Footnote-504253646
Ref: Core and Builtins<63>-Footnote-514253703
Ref: Core and Builtins<63>-Footnote-524253760
Ref: Core and Builtins<63>-Footnote-534253817
Ref: Core and Builtins<63>-Footnote-544253874
Ref: Core and Builtins<63>-Footnote-554253931
Ref: Core and Builtins<63>-Footnote-564253988
Ref: Core and Builtins<63>-Footnote-574254045
Ref: Core and Builtins<63>-Footnote-584254102
Ref: Core and Builtins<63>-Footnote-594254159
Ref: Core and Builtins<63>-Footnote-604254216
Ref: Core and Builtins<63>-Footnote-614254273
Ref: Core and Builtins<63>-Footnote-624254330
Ref: Core and Builtins<63>-Footnote-634254387
Ref: Core and Builtins<63>-Footnote-644254444
Ref: Core and Builtins<63>-Footnote-654254500
Ref: Core and Builtins<63>-Footnote-664254557
Ref: Core and Builtins<63>-Footnote-674254614
Ref: Core and Builtins<63>-Footnote-684254670
Ref: Core and Builtins<63>-Footnote-694254727
Ref: Core and Builtins<63>-Footnote-704254784
Ref: Core and Builtins<63>-Footnote-714254841
Ref: Core and Builtins<63>-Footnote-724254898
Ref: Core and Builtins<63>-Footnote-734254955
Ref: Core and Builtins<63>-Footnote-744255011
Ref: Core and Builtins<63>-Footnote-754255068
Ref: Core and Builtins<63>-Footnote-764255125
Ref: Core and Builtins<63>-Footnote-774255182
Ref: Core and Builtins<63>-Footnote-784255239
Ref: Core and Builtins<63>-Footnote-794255296
Ref: Core and Builtins<63>-Footnote-804255353
Ref: Core and Builtins<63>-Footnote-814255410
Ref: Core and Builtins<63>-Footnote-824255467
Ref: Core and Builtins<63>-Footnote-834255524
Ref: Core and Builtins<63>-Footnote-844255581
Ref: Core and Builtins<63>-Footnote-854255624
Ref: Core and Builtins<63>-Footnote-864255681
Ref: Core and Builtins<63>-Footnote-874255738
Ref: Core and Builtins<63>-Footnote-884255795
Ref: Core and Builtins<63>-Footnote-894255851
Ref: Core and Builtins<63>-Footnote-904255908
Ref: Core and Builtins<63>-Footnote-914255965
Ref: Core and Builtins<63>-Footnote-924256022
Ref: Core and Builtins<63>-Footnote-934256079
Ref: Core and Builtins<63>-Footnote-944256136
Ref: Core and Builtins<63>-Footnote-954256193
Ref: Core and Builtins<63>-Footnote-964256250
Ref: Core and Builtins<63>-Footnote-974256307
Ref: Core and Builtins<63>-Footnote-984256364
Ref: Core and Builtins<63>-Footnote-994256421
Ref: Core and Builtins<63>-Footnote-1004256478
Ref: Core and Builtins<63>-Footnote-1014256536
Ref: Core and Builtins<63>-Footnote-1024256594
Ref: Core and Builtins<63>-Footnote-1034256652
Ref: Core and Builtins<63>-Footnote-1044256710
Ref: Core and Builtins<63>-Footnote-1054256768
Ref: Core and Builtins<63>-Footnote-1064256826
Ref: Core and Builtins<63>-Footnote-1074256883
Ref: Core and Builtins<63>-Footnote-1084256940
Ref: Core and Builtins<63>-Footnote-1094256998
Ref: Core and Builtins<63>-Footnote-1104257056
Ref: Core and Builtins<63>-Footnote-1114257114
Ref: Core and Builtins<63>-Footnote-1124257172
Ref: Core and Builtins<63>-Footnote-1134257230
Ref: Core and Builtins<63>-Footnote-1144257288
Ref: Core and Builtins<63>-Footnote-1154257346
Ref: Core and Builtins<63>-Footnote-1164257404
Ref: Core and Builtins<63>-Footnote-1174257462
Ref: Core and Builtins<63>-Footnote-1184257520
Ref: Core and Builtins<63>-Footnote-1194257578
Ref: Core and Builtins<63>-Footnote-1204257636
Ref: Core and Builtins<63>-Footnote-1214257693
Ref: Core and Builtins<63>-Footnote-1224257751
Ref: Core and Builtins<63>-Footnote-1234257809
Ref: Core and Builtins<63>-Footnote-1244257866
Ref: Core and Builtins<63>-Footnote-1254257924
Ref: Core and Builtins<63>-Footnote-1264257982
Ref: Core and Builtins<63>-Footnote-1274258040
Ref: Core and Builtins<63>-Footnote-1284258098
Ref: Core and Builtins<63>-Footnote-1294258156
Ref: Core and Builtins<63>-Footnote-1304258214
Ref: Core and Builtins<63>-Footnote-1314258272
Ref: Core and Builtins<63>-Footnote-1324258330
Ref: Core and Builtins<63>-Footnote-1334258388
Ref: Core and Builtins<63>-Footnote-1344258446
Ref: Core and Builtins<63>-Footnote-1354258504
Ref: Core and Builtins<63>-Footnote-1364258562
Ref: Core and Builtins<63>-Footnote-1374258620
Ref: Core and Builtins<63>-Footnote-1384258678
Ref: Core and Builtins<63>-Footnote-1394258736
Ref: Core and Builtins<63>-Footnote-1404258794
Ref: Core and Builtins<63>-Footnote-1414258852
Ref: Core and Builtins<63>-Footnote-1424258910
Ref: Core and Builtins<63>-Footnote-1434258968
Ref: Core and Builtins<63>-Footnote-1444259026
Ref: Core and Builtins<63>-Footnote-1454259083
Ref: Core and Builtins<63>-Footnote-1464259141
Ref: Core and Builtins<63>-Footnote-1474259199
Ref: Core and Builtins<63>-Footnote-1484259256
Ref: Core and Builtins<63>-Footnote-1494259314
Ref: Core and Builtins<63>-Footnote-1504259372
Ref: Core and Builtins<63>-Footnote-1514259430
Ref: Core and Builtins<63>-Footnote-1524259488
Ref: Core and Builtins<63>-Footnote-1534259546
Ref: Core and Builtins<63>-Footnote-1544259604
Ref: Core and Builtins<63>-Footnote-1554259662
Ref: Core and Builtins<63>-Footnote-1564259720
Ref: Core and Builtins<63>-Footnote-1574259778
Ref: Core and Builtins<63>-Footnote-1584259836
Ref: Core and Builtins<63>-Footnote-1594259894
Ref: Core and Builtins<63>-Footnote-1604259952
Ref: Core and Builtins<63>-Footnote-1614260010
Ref: Core and Builtins<63>-Footnote-1624260068
Ref: Core and Builtins<63>-Footnote-1634260126
Ref: Core and Builtins<63>-Footnote-1644260184
Ref: Core and Builtins<63>-Footnote-1654260242
Ref: Core and Builtins<63>-Footnote-1664260300
Ref: Core and Builtins<63>-Footnote-1674260358
Ref: Core and Builtins<63>-Footnote-1684260415
Ref: Core and Builtins<63>-Footnote-1694260472
Ref: Core and Builtins<63>-Footnote-1704260529
Ref: Core and Builtins<63>-Footnote-1714260587
Node: ライブラリ<68>4260644
Ref: whatsnew/changelog id3094260782
Ref: 1ac74260782
Ref: ライブラリ<68>-Footnote-14309113
Ref: ライブラリ<68>-Footnote-24309169
Ref: ライブラリ<68>-Footnote-34309225
Ref: ライブラリ<68>-Footnote-44309281
Ref: ライブラリ<68>-Footnote-54309336
Ref: ライブラリ<68>-Footnote-64309392
Ref: ライブラリ<68>-Footnote-74309448
Ref: ライブラリ<68>-Footnote-84309504
Ref: ライブラリ<68>-Footnote-94309559
Ref: ライブラリ<68>-Footnote-104309615
Ref: ライブラリ<68>-Footnote-114309671
Ref: ライブラリ<68>-Footnote-124309728
Ref: ライブラリ<68>-Footnote-134309785
Ref: ライブラリ<68>-Footnote-144309842
Ref: ライブラリ<68>-Footnote-154309899
Ref: ライブラリ<68>-Footnote-164309956
Ref: ライブラリ<68>-Footnote-174310013
Ref: ライブラリ<68>-Footnote-184310070
Ref: ライブラリ<68>-Footnote-194310127
Ref: ライブラリ<68>-Footnote-204310184
Ref: ライブラリ<68>-Footnote-214310241
Ref: ライブラリ<68>-Footnote-224310298
Ref: ライブラリ<68>-Footnote-234310355
Ref: ライブラリ<68>-Footnote-244310412
Ref: ライブラリ<68>-Footnote-254310455
Ref: ライブラリ<68>-Footnote-264310511
Ref: ライブラリ<68>-Footnote-274310568
Ref: ライブラリ<68>-Footnote-284310625
Ref: ライブラリ<68>-Footnote-294310682
Ref: ライブラリ<68>-Footnote-304310739
Ref: ライブラリ<68>-Footnote-314310796
Ref: ライブラリ<68>-Footnote-324310853
Ref: ライブラリ<68>-Footnote-334310910
Ref: ライブラリ<68>-Footnote-344310967
Ref: ライブラリ<68>-Footnote-354311024
Ref: ライブラリ<68>-Footnote-364311081
Ref: ライブラリ<68>-Footnote-374311138
Ref: ライブラリ<68>-Footnote-384311194
Ref: ライブラリ<68>-Footnote-394311251
Ref: ライブラリ<68>-Footnote-404311308
Ref: ライブラリ<68>-Footnote-414311365
Ref: ライブラリ<68>-Footnote-424311422
Ref: ライブラリ<68>-Footnote-434311479
Ref: ライブラリ<68>-Footnote-444311536
Ref: ライブラリ<68>-Footnote-454311593
Ref: ライブラリ<68>-Footnote-464311650
Ref: ライブラリ<68>-Footnote-474311707
Ref: ライブラリ<68>-Footnote-484311764
Ref: ライブラリ<68>-Footnote-494311821
Ref: ライブラリ<68>-Footnote-504311878
Ref: ライブラリ<68>-Footnote-514311934
Ref: ライブラリ<68>-Footnote-524311991
Ref: ライブラリ<68>-Footnote-534312047
Ref: ライブラリ<68>-Footnote-544312104
Ref: ライブラリ<68>-Footnote-554312161
Ref: ライブラリ<68>-Footnote-564312218
Ref: ライブラリ<68>-Footnote-574312275
Ref: ライブラリ<68>-Footnote-584312332
Ref: ライブラリ<68>-Footnote-594312389
Ref: ライブラリ<68>-Footnote-604312446
Ref: ライブラリ<68>-Footnote-614312503
Ref: ライブラリ<68>-Footnote-624312560
Ref: ライブラリ<68>-Footnote-634312617
Ref: ライブラリ<68>-Footnote-644312674
Ref: ライブラリ<68>-Footnote-654312731
Ref: ライブラリ<68>-Footnote-664312788
Ref: ライブラリ<68>-Footnote-674312845
Ref: ライブラリ<68>-Footnote-684312902
Ref: ライブラリ<68>-Footnote-694312959
Ref: ライブラリ<68>-Footnote-704313015
Ref: ライブラリ<68>-Footnote-714313072
Ref: ライブラリ<68>-Footnote-724313129
Ref: ライブラリ<68>-Footnote-734313186
Ref: ライブラリ<68>-Footnote-744313243
Ref: ライブラリ<68>-Footnote-754313300
Ref: ライブラリ<68>-Footnote-764313356
Ref: ライブラリ<68>-Footnote-774313413
Ref: ライブラリ<68>-Footnote-784313470
Ref: ライブラリ<68>-Footnote-794313527
Ref: ライブラリ<68>-Footnote-804313584
Ref: ライブラリ<68>-Footnote-814313641
Ref: ライブラリ<68>-Footnote-824313698
Ref: ライブラリ<68>-Footnote-834313755
Ref: ライブラリ<68>-Footnote-844313811
Ref: ライブラリ<68>-Footnote-854313867
Ref: ライブラリ<68>-Footnote-864313923
Ref: ライブラリ<68>-Footnote-874313979
Ref: ライブラリ<68>-Footnote-884314036
Ref: ライブラリ<68>-Footnote-894314093
Ref: ライブラリ<68>-Footnote-904314150
Ref: ライブラリ<68>-Footnote-914314207
Ref: ライブラリ<68>-Footnote-924314264
Ref: ライブラリ<68>-Footnote-934314320
Ref: ライブラリ<68>-Footnote-944314377
Ref: ライブラリ<68>-Footnote-954314434
Ref: ライブラリ<68>-Footnote-964314491
Ref: ライブラリ<68>-Footnote-974314547
Ref: ライブラリ<68>-Footnote-984314604
Ref: ライブラリ<68>-Footnote-994314661
Ref: ライブラリ<68>-Footnote-1004314718
Ref: ライブラリ<68>-Footnote-1014314776
Ref: ライブラリ<68>-Footnote-1024314834
Ref: ライブラリ<68>-Footnote-1034314892
Ref: ライブラリ<68>-Footnote-1044314950
Ref: ライブラリ<68>-Footnote-1054315008
Ref: ライブラリ<68>-Footnote-1064315066
Ref: ライブラリ<68>-Footnote-1074315124
Ref: ライブラリ<68>-Footnote-1084315181
Ref: ライブラリ<68>-Footnote-1094315239
Ref: ライブラリ<68>-Footnote-1104315296
Ref: ライブラリ<68>-Footnote-1114315354
Ref: ライブラリ<68>-Footnote-1124315411
Ref: ライブラリ<68>-Footnote-1134315468
Ref: ライブラリ<68>-Footnote-1144315525
Ref: ライブラリ<68>-Footnote-1154315583
Ref: ライブラリ<68>-Footnote-1164315641
Ref: ライブラリ<68>-Footnote-1174315699
Ref: ライブラリ<68>-Footnote-1184315757
Ref: ライブラリ<68>-Footnote-1194315815
Ref: ライブラリ<68>-Footnote-1204315873
Ref: ライブラリ<68>-Footnote-1214315931
Ref: ライブラリ<68>-Footnote-1224315989
Ref: ライブラリ<68>-Footnote-1234316047
Ref: ライブラリ<68>-Footnote-1244316105
Ref: ライブラリ<68>-Footnote-1254316163
Ref: ライブラリ<68>-Footnote-1264316221
Ref: ライブラリ<68>-Footnote-1274316279
Ref: ライブラリ<68>-Footnote-1284316337
Ref: ライブラリ<68>-Footnote-1294316395
Ref: ライブラリ<68>-Footnote-1304316453
Ref: ライブラリ<68>-Footnote-1314316511
Ref: ライブラリ<68>-Footnote-1324316569
Ref: ライブラリ<68>-Footnote-1334316627
Ref: ライブラリ<68>-Footnote-1344316685
Ref: ライブラリ<68>-Footnote-1354316743
Ref: ライブラリ<68>-Footnote-1364316800
Ref: ライブラリ<68>-Footnote-1374316858
Ref: ライブラリ<68>-Footnote-1384316916
Ref: ライブラリ<68>-Footnote-1394316974
Ref: ライブラリ<68>-Footnote-1404317032
Ref: ライブラリ<68>-Footnote-1414317090
Ref: ライブラリ<68>-Footnote-1424317148
Ref: ライブラリ<68>-Footnote-1434317206
Ref: ライブラリ<68>-Footnote-1444317264
Ref: ライブラリ<68>-Footnote-1454317322
Ref: ライブラリ<68>-Footnote-1464317380
Ref: ライブラリ<68>-Footnote-1474317438
Ref: ライブラリ<68>-Footnote-1484317496
Ref: ライブラリ<68>-Footnote-1494317554
Ref: ライブラリ<68>-Footnote-1504317611
Ref: ライブラリ<68>-Footnote-1514317669
Ref: ライブラリ<68>-Footnote-1524317726
Ref: ライブラリ<68>-Footnote-1534317784
Ref: ライブラリ<68>-Footnote-1544317842
Ref: ライブラリ<68>-Footnote-1554317900
Ref: ライブラリ<68>-Footnote-1564317958
Ref: ライブラリ<68>-Footnote-1574318016
Ref: ライブラリ<68>-Footnote-1584318074
Ref: ライブラリ<68>-Footnote-1594318132
Ref: ライブラリ<68>-Footnote-1604318190
Ref: ライブラリ<68>-Footnote-1614318248
Ref: ライブラリ<68>-Footnote-1624318306
Ref: ライブラリ<68>-Footnote-1634318364
Ref: ライブラリ<68>-Footnote-1644318422
Ref: ライブラリ<68>-Footnote-1654318480
Ref: ライブラリ<68>-Footnote-1664318538
Ref: ライブラリ<68>-Footnote-1674318595
Ref: ライブラリ<68>-Footnote-1684318652
Ref: ライブラリ<68>-Footnote-1694318710
Ref: ライブラリ<68>-Footnote-1704318768
Ref: ライブラリ<68>-Footnote-1714318826
Ref: ライブラリ<68>-Footnote-1724318884
Ref: ライブラリ<68>-Footnote-1734318928
Ref: ライブラリ<68>-Footnote-1744318986
Ref: ライブラリ<68>-Footnote-1754319044
Ref: ライブラリ<68>-Footnote-1764319102
Ref: ライブラリ<68>-Footnote-1774319160
Ref: ライブラリ<68>-Footnote-1784319218
Ref: ライブラリ<68>-Footnote-1794319276
Ref: ライブラリ<68>-Footnote-1804319334
Ref: ライブラリ<68>-Footnote-1814319392
Ref: ライブラリ<68>-Footnote-1824319450
Ref: ライブラリ<68>-Footnote-1834319508
Ref: ライブラリ<68>-Footnote-1844319566
Ref: ライブラリ<68>-Footnote-1854319624
Ref: ライブラリ<68>-Footnote-1864319682
Ref: ライブラリ<68>-Footnote-1874319740
Ref: ライブラリ<68>-Footnote-1884319798
Ref: ライブラリ<68>-Footnote-1894319856
Ref: ライブラリ<68>-Footnote-1904319914
Ref: ライブラリ<68>-Footnote-1914319972
Ref: ライブラリ<68>-Footnote-1924320030
Ref: ライブラリ<68>-Footnote-1934320088
Ref: ライブラリ<68>-Footnote-1944320146
Ref: ライブラリ<68>-Footnote-1954320204
Ref: ライブラリ<68>-Footnote-1964320262
Ref: ライブラリ<68>-Footnote-1974320320
Ref: ライブラリ<68>-Footnote-1984320377
Ref: ライブラリ<68>-Footnote-1994320435
Ref: ライブラリ<68>-Footnote-2004320493
Ref: ライブラリ<68>-Footnote-2014320551
Ref: ライブラリ<68>-Footnote-2024320609
Ref: ライブラリ<68>-Footnote-2034320667
Ref: ライブラリ<68>-Footnote-2044320725
Ref: ライブラリ<68>-Footnote-2054320783
Ref: ライブラリ<68>-Footnote-2064320840
Ref: ライブラリ<68>-Footnote-2074320898
Ref: ライブラリ<68>-Footnote-2084320956
Ref: ライブラリ<68>-Footnote-2094321014
Ref: ライブラリ<68>-Footnote-2104321072
Ref: ライブラリ<68>-Footnote-2114321129
Ref: ライブラリ<68>-Footnote-2124321187
Ref: ライブラリ<68>-Footnote-2134321245
Ref: ライブラリ<68>-Footnote-2144321303
Ref: ライブラリ<68>-Footnote-2154321361
Ref: ライブラリ<68>-Footnote-2164321419
Ref: ライブラリ<68>-Footnote-2174321477
Ref: ライブラリ<68>-Footnote-2184321535
Ref: ライブラリ<68>-Footnote-2194321579
Ref: ライブラリ<68>-Footnote-2204321637
Ref: ライブラリ<68>-Footnote-2214321681
Ref: ライブラリ<68>-Footnote-2224321739
Ref: ライブラリ<68>-Footnote-2234321783
Ref: ライブラリ<68>-Footnote-2244321841
Ref: ライブラリ<68>-Footnote-2254321885
Ref: ライブラリ<68>-Footnote-2264321943
Ref: ライブラリ<68>-Footnote-2274321987
Ref: ライブラリ<68>-Footnote-2284322045
Ref: ライブラリ<68>-Footnote-2294322089
Ref: ライブラリ<68>-Footnote-2304322147
Ref: ライブラリ<68>-Footnote-2314322205
Ref: ライブラリ<68>-Footnote-2324322249
Ref: ライブラリ<68>-Footnote-2334322307
Ref: ライブラリ<68>-Footnote-2344322351
Ref: ライブラリ<68>-Footnote-2354322409
Ref: ライブラリ<68>-Footnote-2364322467
Ref: ライブラリ<68>-Footnote-2374322525
Ref: ライブラリ<68>-Footnote-2384322583
Ref: ライブラリ<68>-Footnote-2394322627
Ref: ライブラリ<68>-Footnote-2404322685
Ref: ライブラリ<68>-Footnote-2414322729
Ref: ライブラリ<68>-Footnote-2424322776
Ref: ライブラリ<68>-Footnote-2434322833
Ref: ライブラリ<68>-Footnote-2444322891
Ref: ライブラリ<68>-Footnote-2454322935
Ref: ライブラリ<68>-Footnote-2464322993
Ref: ライブラリ<68>-Footnote-2474323037
Ref: ライブラリ<68>-Footnote-2484323095
Ref: ライブラリ<68>-Footnote-2494323139
Ref: ライブラリ<68>-Footnote-2504323197
Ref: ライブラリ<68>-Footnote-2514323241
Ref: ライブラリ<68>-Footnote-2524323299
Ref: ライブラリ<68>-Footnote-2534323343
Ref: ライブラリ<68>-Footnote-2544323401
Ref: ライブラリ<68>-Footnote-2554323459
Ref: ライブラリ<68>-Footnote-2564323517
Ref: ライブラリ<68>-Footnote-2574323575
Ref: ライブラリ<68>-Footnote-2584323632
Ref: ライブラリ<68>-Footnote-2594323690
Ref: ライブラリ<68>-Footnote-2604323734
Ref: ライブラリ<68>-Footnote-2614323792
Ref: ライブラリ<68>-Footnote-2624323850
Ref: ライブラリ<68>-Footnote-2634323908
Ref: ライブラリ<68>-Footnote-2644323966
Ref: ライブラリ<68>-Footnote-2654324010
Ref: ライブラリ<68>-Footnote-2664324068
Ref: ライブラリ<68>-Footnote-2674324112
Ref: ライブラリ<68>-Footnote-2684324170
Ref: ライブラリ<68>-Footnote-2694324214
Ref: ライブラリ<68>-Footnote-2704324272
Ref: ライブラリ<68>-Footnote-2714324316
Ref: ライブラリ<68>-Footnote-2724324374
Ref: ライブラリ<68>-Footnote-2734324431
Ref: ライブラリ<68>-Footnote-2744324489
Ref: ライブラリ<68>-Footnote-2754324547
Ref: ライブラリ<68>-Footnote-2764324605
Ref: ライブラリ<68>-Footnote-2774324663
Ref: ライブラリ<68>-Footnote-2784324721
Ref: ライブラリ<68>-Footnote-2794324779
Ref: ライブラリ<68>-Footnote-2804324837
Ref: ライブラリ<68>-Footnote-2814324895
Ref: ライブラリ<68>-Footnote-2824324953
Ref: ライブラリ<68>-Footnote-2834325011
Ref: ライブラリ<68>-Footnote-2844325068
Ref: ライブラリ<68>-Footnote-2854325126
Ref: ライブラリ<68>-Footnote-2864325184
Ref: ライブラリ<68>-Footnote-2874325242
Ref: ライブラリ<68>-Footnote-2884325299
Ref: ライブラリ<68>-Footnote-2894325357
Ref: ライブラリ<68>-Footnote-2904325414
Ref: ライブラリ<68>-Footnote-2914325471
Ref: ライブラリ<68>-Footnote-2924325528
Ref: ライブラリ<68>-Footnote-2934325585
Ref: ライブラリ<68>-Footnote-2944325642
Ref: ライブラリ<68>-Footnote-2954325699
Ref: ライブラリ<68>-Footnote-2964325756
Ref: ライブラリ<68>-Footnote-2974325823
Ref: ライブラリ<68>-Footnote-2984325884
Ref: ライブラリ<68>-Footnote-2994325951
Ref: ライブラリ<68>-Footnote-3004325995
Ref: ライブラリ<68>-Footnote-3014326062
Ref: ライブラリ<68>-Footnote-3024326129
Ref: ライブラリ<68>-Footnote-3034326196
Ref: ライブラリ<68>-Footnote-3044326263
Node: ドキュメント<23>4326330
Ref: whatsnew/changelog id3104326460
Ref: 1adb4326460
Ref: ドキュメント<23>-Footnote-14328414
Ref: ドキュメント<23>-Footnote-24328470
Ref: ドキュメント<23>-Footnote-34328526
Ref: ドキュメント<23>-Footnote-44328582
Ref: ドキュメント<23>-Footnote-54328638
Ref: ドキュメント<23>-Footnote-64328694
Ref: ドキュメント<23>-Footnote-74328750
Ref: ドキュメント<23>-Footnote-84328806
Ref: ドキュメント<23>-Footnote-94328862
Ref: ドキュメント<23>-Footnote-104328917
Ref: ドキュメント<23>-Footnote-114328973
Ref: ドキュメント<23>-Footnote-124329030
Ref: ドキュメント<23>-Footnote-134329086
Ref: ドキュメント<23>-Footnote-144329143
Node: テスト<23>4329200
Ref: whatsnew/changelog id3114329324
Ref: 1adc4329324
Ref: テスト<23>-Footnote-14342460
Ref: テスト<23>-Footnote-24342516
Ref: テスト<23>-Footnote-34342572
Ref: テスト<23>-Footnote-44342628
Ref: テスト<23>-Footnote-54342684
Ref: テスト<23>-Footnote-64342739
Ref: テスト<23>-Footnote-74342795
Ref: テスト<23>-Footnote-84342851
Ref: テスト<23>-Footnote-94342907
Ref: テスト<23>-Footnote-104342963
Ref: テスト<23>-Footnote-114343020
Ref: テスト<23>-Footnote-124343077
Ref: テスト<23>-Footnote-134343134
Ref: テスト<23>-Footnote-144343191
Ref: テスト<23>-Footnote-154343248
Ref: テスト<23>-Footnote-164343305
Ref: テスト<23>-Footnote-174343362
Ref: テスト<23>-Footnote-184343419
Ref: テスト<23>-Footnote-194343476
Ref: テスト<23>-Footnote-204343533
Ref: テスト<23>-Footnote-214343590
Ref: テスト<23>-Footnote-224343647
Ref: テスト<23>-Footnote-234343704
Ref: テスト<23>-Footnote-244343761
Ref: テスト<23>-Footnote-254343818
Ref: テスト<23>-Footnote-264343875
Ref: テスト<23>-Footnote-274343932
Ref: テスト<23>-Footnote-284343989
Ref: テスト<23>-Footnote-294344046
Ref: テスト<23>-Footnote-304344103
Ref: テスト<23>-Footnote-314344160
Ref: テスト<23>-Footnote-324344217
Ref: テスト<23>-Footnote-334344274
Ref: テスト<23>-Footnote-344344318
Ref: テスト<23>-Footnote-354344374
Ref: テスト<23>-Footnote-364344431
Ref: テスト<23>-Footnote-374344487
Ref: テスト<23>-Footnote-384344543
Ref: テスト<23>-Footnote-394344600
Ref: テスト<23>-Footnote-404344657
Ref: テスト<23>-Footnote-414344714
Ref: テスト<23>-Footnote-424344771
Ref: テスト<23>-Footnote-434344828
Ref: テスト<23>-Footnote-444344885
Ref: テスト<23>-Footnote-454344942
Ref: テスト<23>-Footnote-464344999
Ref: テスト<23>-Footnote-474345056
Ref: テスト<23>-Footnote-484345113
Ref: テスト<23>-Footnote-494345170
Ref: テスト<23>-Footnote-504345227
Ref: テスト<23>-Footnote-514345284
Ref: テスト<23>-Footnote-524345341
Ref: テスト<23>-Footnote-534345398
Ref: テスト<23>-Footnote-544345455
Ref: テスト<23>-Footnote-554345512
Ref: テスト<23>-Footnote-564345569
Ref: テスト<23>-Footnote-574345626
Ref: テスト<23>-Footnote-584345682
Ref: テスト<23>-Footnote-594345739
Node: ビルド<26>4345795
Ref: whatsnew/changelog id3124345908
Ref: 1ade4345908
Ref: ビルド<26>-Footnote-14349899
Ref: ビルド<26>-Footnote-24349955
Ref: ビルド<26>-Footnote-34350011
Ref: ビルド<26>-Footnote-44350067
Ref: ビルド<26>-Footnote-54350123
Ref: ビルド<26>-Footnote-64350179
Ref: ビルド<26>-Footnote-74350235
Ref: ビルド<26>-Footnote-84350290
Ref: ビルド<26>-Footnote-94350346
Ref: ビルド<26>-Footnote-104350402
Ref: ビルド<26>-Footnote-114350458
Ref: ビルド<26>-Footnote-124350515
Ref: ビルド<26>-Footnote-134350572
Ref: ビルド<26>-Footnote-144350629
Ref: ビルド<26>-Footnote-154350686
Ref: ビルド<26>-Footnote-164350742
Ref: ビルド<26>-Footnote-174350799
Ref: ビルド<26>-Footnote-184350856
Ref: ビルド<26>-Footnote-194350913
Ref: ビルド<26>-Footnote-204350970
Ref: ビルド<26>-Footnote-214351026
Ref: ビルド<26>-Footnote-224351083
Ref: ビルド<26>-Footnote-234351139
Ref: ビルド<26>-Footnote-244351196
Node: Windows<23>4351253
Ref: whatsnew/changelog id3134351362
Ref: 1ae04351362
Ref: Windows<23>-Footnote-14353867
Ref: Windows<23>-Footnote-24353923
Ref: Windows<23>-Footnote-34353979
Ref: Windows<23>-Footnote-44354034
Ref: Windows<23>-Footnote-54354090
Ref: Windows<23>-Footnote-64354146
Ref: Windows<23>-Footnote-74354201
Ref: Windows<23>-Footnote-84354257
Ref: Windows<23>-Footnote-94354313
Ref: Windows<23>-Footnote-104354369
Ref: Windows<23>-Footnote-114354426
Ref: Windows<23>-Footnote-124354482
Ref: Windows<23>-Footnote-134354539
Node: macOS<17>4354596
Ref: whatsnew/changelog id3144354700
Ref: 1ae14354700
Ref: macOS<17>-Footnote-14354964
Ref: macOS<17>-Footnote-24355020
Ref: macOS<17>-Footnote-34355076
Node: IDLE<14>4355131
Ref: whatsnew/changelog id3154355239
Ref: 1ae24355239
Ref: IDLE<14>-Footnote-14355428
Node: Tools/Demos<19>4355484
Ref: whatsnew/changelog id3164355592
Ref: 1ae34355592
Ref: Tools/Demos<19>-Footnote-14358106
Ref: Tools/Demos<19>-Footnote-24358162
Ref: Tools/Demos<19>-Footnote-34358218
Ref: Tools/Demos<19>-Footnote-44358280
Ref: Tools/Demos<19>-Footnote-54358369
Ref: Tools/Demos<19>-Footnote-64358425
Ref: Tools/Demos<19>-Footnote-74358519
Ref: Tools/Demos<19>-Footnote-84358575
Ref: Tools/Demos<19>-Footnote-94358631
Ref: Tools/Demos<19>-Footnote-104358686
Ref: Tools/Demos<19>-Footnote-114358782
Ref: Tools/Demos<19>-Footnote-124358839
Ref: Tools/Demos<19>-Footnote-134358896
Ref: Tools/Demos<19>-Footnote-144358953
Ref: Tools/Demos<19>-Footnote-154359010
Ref: Tools/Demos<19>-Footnote-164359067
Ref: Tools/Demos<19>-Footnote-174359124
Ref: Tools/Demos<19>-Footnote-184359180
Node: C API<25>4359278
Ref: whatsnew/changelog id3174359369
Ref: 1ae44359369
Ref: C API<25>-Footnote-14374276
Ref: C API<25>-Footnote-24374331
Ref: C API<25>-Footnote-34374387
Ref: C API<25>-Footnote-44374443
Ref: C API<25>-Footnote-54374499
Ref: C API<25>-Footnote-64374555
Ref: C API<25>-Footnote-74374611
Ref: C API<25>-Footnote-84374666
Ref: C API<25>-Footnote-94374722
Ref: C API<25>-Footnote-104374778
Ref: C API<25>-Footnote-114374835
Ref: C API<25>-Footnote-124374892
Ref: C API<25>-Footnote-134374949
Ref: C API<25>-Footnote-144375006
Ref: C API<25>-Footnote-154375063
Ref: C API<25>-Footnote-164375120
Ref: C API<25>-Footnote-174375177
Ref: C API<25>-Footnote-184375234
Ref: C API<25>-Footnote-194375291
Ref: C API<25>-Footnote-204375348
Ref: C API<25>-Footnote-214375405
Ref: C API<25>-Footnote-224375462
Ref: C API<25>-Footnote-234375519
Ref: C API<25>-Footnote-244375576
Ref: C API<25>-Footnote-254375633
Ref: C API<25>-Footnote-264375690
Ref: C API<25>-Footnote-274375747
Ref: C API<25>-Footnote-284375804
Ref: C API<25>-Footnote-294375861
Ref: C API<25>-Footnote-304375918
Ref: C API<25>-Footnote-314375975
Ref: C API<25>-Footnote-324376032
Ref: C API<25>-Footnote-334376075
Ref: C API<25>-Footnote-344376132
Ref: C API<25>-Footnote-354376189
Ref: C API<25>-Footnote-364376246
Ref: C API<25>-Footnote-374376303
Ref: C API<25>-Footnote-384376360
Ref: C API<25>-Footnote-394376417
Ref: C API<25>-Footnote-404376474
Ref: C API<25>-Footnote-414376531
Ref: C API<25>-Footnote-424376588
Ref: C API<25>-Footnote-434376645
Ref: C API<25>-Footnote-444376702
Ref: C API<25>-Footnote-454376759
Ref: C API<25>-Footnote-464376816
Ref: C API<25>-Footnote-474376873
Ref: C API<25>-Footnote-484376930
Ref: C API<25>-Footnote-494376987
Ref: C API<25>-Footnote-504377043
Ref: C API<25>-Footnote-514377100
Ref: C API<25>-Footnote-524377157
Ref: C API<25>-Footnote-534377214
Ref: C API<25>-Footnote-544377271
Ref: C API<25>-Footnote-554377328
Ref: C API<25>-Footnote-564377385
Ref: C API<25>-Footnote-574377442
Ref: C API<25>-Footnote-584377499
Ref: C API<25>-Footnote-594377565
Node: Python 3 12 0 beta 14377631
Ref: whatsnew/changelog python-3-12-0-beta-14377760
Ref: 1aef4377760
Node: セキュリティ<27>4378327
Ref: whatsnew/changelog id3184378434
Ref: 1af04378434
Ref: セキュリティ<27>-Footnote-14379267
Ref: セキュリティ<27>-Footnote-24379322
Ref: セキュリティ<27>-Footnote-34379378
Ref: セキュリティ<27>-Footnote-44379433
Ref: セキュリティ<27>-Footnote-54379489
Node: ライブラリ<69>4379545
Ref: whatsnew/changelog id3194379682
Ref: 1af14379682
Ref: ライブラリ<69>-Footnote-14379910
Node: Core and Builtins<64>4379966
Ref: whatsnew/changelog id3204380100
Ref: 1af24380100
Ref: Core and Builtins<64>-Footnote-14386506
Ref: Core and Builtins<64>-Footnote-24386562
Ref: Core and Builtins<64>-Footnote-34386618
Ref: Core and Builtins<64>-Footnote-44386660
Ref: Core and Builtins<64>-Footnote-54386716
Ref: Core and Builtins<64>-Footnote-64386772
Ref: Core and Builtins<64>-Footnote-74386828
Ref: Core and Builtins<64>-Footnote-84386870
Ref: Core and Builtins<64>-Footnote-94386926
Ref: Core and Builtins<64>-Footnote-104386982
Ref: Core and Builtins<64>-Footnote-114387038
Ref: Core and Builtins<64>-Footnote-124387094
Ref: Core and Builtins<64>-Footnote-134387151
Ref: Core and Builtins<64>-Footnote-144387208
Ref: Core and Builtins<64>-Footnote-154387251
Ref: Core and Builtins<64>-Footnote-164387308
Ref: Core and Builtins<64>-Footnote-174387365
Ref: Core and Builtins<64>-Footnote-184387422
Ref: Core and Builtins<64>-Footnote-194387479
Ref: Core and Builtins<64>-Footnote-204387536
Ref: Core and Builtins<64>-Footnote-214387593
Ref: Core and Builtins<64>-Footnote-224387650
Ref: Core and Builtins<64>-Footnote-234387707
Ref: Core and Builtins<64>-Footnote-244387764
Ref: Core and Builtins<64>-Footnote-254387821
Node: ライブラリ<70>4387864
Ref: whatsnew/changelog id3214388000
Ref: 1af34388000
Ref: ライブラリ<70>-Footnote-14388434
Ref: ライブラリ<70>-Footnote-24388490
Node: Core and Builtins<65>4388546
Ref: whatsnew/changelog id3224388680
Ref: 1af44388680
Ref: Core and Builtins<65>-Footnote-14392718
Ref: Core and Builtins<65>-Footnote-24392774
Ref: Core and Builtins<65>-Footnote-34392830
Ref: Core and Builtins<65>-Footnote-44392886
Ref: Core and Builtins<65>-Footnote-54392942
Ref: Core and Builtins<65>-Footnote-64392998
Ref: Core and Builtins<65>-Footnote-74393054
Ref: Core and Builtins<65>-Footnote-84393110
Ref: Core and Builtins<65>-Footnote-94393165
Ref: Core and Builtins<65>-Footnote-104393221
Ref: Core and Builtins<65>-Footnote-114393277
Ref: Core and Builtins<65>-Footnote-124393333
Ref: Core and Builtins<65>-Footnote-134393376
Ref: Core and Builtins<65>-Footnote-144393433
Ref: Core and Builtins<65>-Footnote-154393490
Ref: Core and Builtins<65>-Footnote-164393547
Ref: Core and Builtins<65>-Footnote-174393603
Ref: Core and Builtins<65>-Footnote-184393660
Ref: Core and Builtins<65>-Footnote-194393717
Ref: Core and Builtins<65>-Footnote-204393760
Ref: Core and Builtins<65>-Footnote-214393816
Ref: Core and Builtins<65>-Footnote-224393873
Ref: Core and Builtins<65>-Footnote-234393916
Ref: Core and Builtins<65>-Footnote-244393972
Ref: Core and Builtins<65>-Footnote-254394015
Ref: Core and Builtins<65>-Footnote-264394071
Ref: Core and Builtins<65>-Footnote-274394127
Node: ライブラリ<71>4394193
Ref: whatsnew/changelog id3234394330
Ref: 1af54394330
Ref: ライブラリ<71>-Footnote-14417945
Ref: ライブラリ<71>-Footnote-24418010
Ref: ライブラリ<71>-Footnote-34418066
Ref: ライブラリ<71>-Footnote-44418108
Ref: ライブラリ<71>-Footnote-54418164
Ref: ライブラリ<71>-Footnote-64418220
Ref: ライブラリ<71>-Footnote-74418276
Ref: ライブラリ<71>-Footnote-84418332
Ref: ライブラリ<71>-Footnote-94418387
Ref: ライブラリ<71>-Footnote-104418443
Ref: ライブラリ<71>-Footnote-114418500
Ref: ライブラリ<71>-Footnote-124418557
Ref: ライブラリ<71>-Footnote-134418614
Ref: ライブラリ<71>-Footnote-144418671
Ref: ライブラリ<71>-Footnote-154418728
Ref: ライブラリ<71>-Footnote-164418785
Ref: ライブラリ<71>-Footnote-174418842
Ref: ライブラリ<71>-Footnote-184418918
Ref: ライブラリ<71>-Footnote-194418975
Ref: ライブラリ<71>-Footnote-204419032
Ref: ライブラリ<71>-Footnote-214419088
Ref: ライブラリ<71>-Footnote-224419145
Ref: ライブラリ<71>-Footnote-234419211
Ref: ライブラリ<71>-Footnote-244419268
Ref: ライブラリ<71>-Footnote-254419324
Ref: ライブラリ<71>-Footnote-264419380
Ref: ライブラリ<71>-Footnote-274419437
Ref: ライブラリ<71>-Footnote-284419494
Ref: ライブラリ<71>-Footnote-294419551
Ref: ライブラリ<71>-Footnote-304419608
Ref: ライブラリ<71>-Footnote-314419665
Ref: ライブラリ<71>-Footnote-324419722
Ref: ライブラリ<71>-Footnote-334419779
Ref: ライブラリ<71>-Footnote-344419822
Ref: ライブラリ<71>-Footnote-354419879
Ref: ライブラリ<71>-Footnote-364419936
Ref: ライブラリ<71>-Footnote-374419993
Ref: ライブラリ<71>-Footnote-384420050
Ref: ライブラリ<71>-Footnote-394420106
Ref: ライブラリ<71>-Footnote-404420163
Ref: ライブラリ<71>-Footnote-414420219
Ref: ライブラリ<71>-Footnote-424420276
Ref: ライブラリ<71>-Footnote-434420333
Ref: ライブラリ<71>-Footnote-444420390
Ref: ライブラリ<71>-Footnote-454420447
Ref: ライブラリ<71>-Footnote-464420504
Ref: ライブラリ<71>-Footnote-474420561
Ref: ライブラリ<71>-Footnote-484420617
Ref: ライブラリ<71>-Footnote-494420673
Ref: ライブラリ<71>-Footnote-504420730
Ref: ライブラリ<71>-Footnote-514420787
Ref: ライブラリ<71>-Footnote-524420844
Ref: ライブラリ<71>-Footnote-534420901
Ref: ライブラリ<71>-Footnote-544420957
Ref: ライブラリ<71>-Footnote-554421014
Ref: ライブラリ<71>-Footnote-564421070
Ref: ライブラリ<71>-Footnote-574421127
Ref: ライブラリ<71>-Footnote-584421184
Ref: ライブラリ<71>-Footnote-594421240
Ref: ライブラリ<71>-Footnote-604421296
Ref: ライブラリ<71>-Footnote-614421353
Ref: ライブラリ<71>-Footnote-624421410
Ref: ライブラリ<71>-Footnote-634421466
Ref: ライブラリ<71>-Footnote-644421523
Ref: ライブラリ<71>-Footnote-654421580
Ref: ライブラリ<71>-Footnote-664421637
Ref: ライブラリ<71>-Footnote-674421694
Ref: ライブラリ<71>-Footnote-684421751
Ref: ライブラリ<71>-Footnote-694421808
Ref: ライブラリ<71>-Footnote-704421865
Ref: ライブラリ<71>-Footnote-714421922
Ref: ライブラリ<71>-Footnote-724421979
Ref: ライブラリ<71>-Footnote-734422036
Ref: ライブラリ<71>-Footnote-744422093
Ref: ライブラリ<71>-Footnote-754422150
Ref: ライブラリ<71>-Footnote-764422207
Ref: ライブラリ<71>-Footnote-774422264
Ref: ライブラリ<71>-Footnote-784422321
Ref: ライブラリ<71>-Footnote-794422364
Ref: ライブラリ<71>-Footnote-804422421
Ref: ライブラリ<71>-Footnote-814422478
Ref: ライブラリ<71>-Footnote-824422521
Ref: ライブラリ<71>-Footnote-834422577
Ref: ライブラリ<71>-Footnote-844422633
Ref: ライブラリ<71>-Footnote-854422690
Ref: ライブラリ<71>-Footnote-864422747
Ref: ライブラリ<71>-Footnote-874422804
Ref: ライブラリ<71>-Footnote-884422861
Ref: ライブラリ<71>-Footnote-894422918
Ref: ライブラリ<71>-Footnote-904422961
Ref: ライブラリ<71>-Footnote-914423018
Ref: ライブラリ<71>-Footnote-924423061
Ref: ライブラリ<71>-Footnote-934423117
Ref: ライブラリ<71>-Footnote-944423174
Ref: ライブラリ<71>-Footnote-954423231
Ref: ライブラリ<71>-Footnote-964423274
Ref: ライブラリ<71>-Footnote-974423331
Ref: ライブラリ<71>-Footnote-984423388
Ref: ライブラリ<71>-Footnote-994423445
Ref: ライブラリ<71>-Footnote-1004423501
Ref: ライブラリ<71>-Footnote-1014423559
Ref: ライブラリ<71>-Footnote-1024423617
Ref: ライブラリ<71>-Footnote-1034423675
Ref: ライブラリ<71>-Footnote-1044423733
Ref: ライブラリ<71>-Footnote-1054423791
Ref: ライブラリ<71>-Footnote-1064423849
Ref: ライブラリ<71>-Footnote-1074423906
Ref: ライブラリ<71>-Footnote-1084423963
Ref: ライブラリ<71>-Footnote-1094424021
Ref: ライブラリ<71>-Footnote-1104424065
Ref: ライブラリ<71>-Footnote-1114424122
Ref: ライブラリ<71>-Footnote-1124424180
Ref: ライブラリ<71>-Footnote-1134424238
Ref: ライブラリ<71>-Footnote-1144424295
Ref: ライブラリ<71>-Footnote-1154424352
Ref: ライブラリ<71>-Footnote-1164424409
Ref: ライブラリ<71>-Footnote-1174424467
Ref: ライブラリ<71>-Footnote-1184424525
Ref: ライブラリ<71>-Footnote-1194424582
Ref: ライブラリ<71>-Footnote-1204424639
Ref: ライブラリ<71>-Footnote-1214424696
Ref: ライブラリ<71>-Footnote-1224424753
Ref: ライブラリ<71>-Footnote-1234424810
Ref: ライブラリ<71>-Footnote-1244424867
Ref: ライブラリ<71>-Footnote-1254424924
Ref: ライブラリ<71>-Footnote-1264424981
Ref: ライブラリ<71>-Footnote-1274425038
Ref: ライブラリ<71>-Footnote-1284425095
Ref: ライブラリ<71>-Footnote-1294425152
Ref: ライブラリ<71>-Footnote-1304425209
Ref: ライブラリ<71>-Footnote-1314425266
Ref: ライブラリ<71>-Footnote-1324425323
Ref: ライブラリ<71>-Footnote-1334425380
Ref: ライブラリ<71>-Footnote-1344425447
Ref: ライブラリ<71>-Footnote-1354425514
Ref: ライブラリ<71>-Footnote-1364425581
Ref: ライブラリ<71>-Footnote-1374425648
Ref: ライブラリ<71>-Footnote-1384425715
Ref: ライブラリ<71>-Footnote-1394425782
Ref: ライブラリ<71>-Footnote-1404425849
Node: ドキュメント<24>4425916
Ref: whatsnew/changelog id3244426045
Ref: 1b024426045
Ref: ドキュメント<24>-Footnote-14426822
Ref: ドキュメント<24>-Footnote-24426877
Ref: ドキュメント<24>-Footnote-34426933
Ref: ドキュメント<24>-Footnote-44426975
Ref: ドキュメント<24>-Footnote-54427030
Ref: ドキュメント<24>-Footnote-64427085
Node: テスト<24>4427140
Ref: whatsnew/changelog id3254427263
Ref: 1b034427263
Ref: テスト<24>-Footnote-14428175
Ref: テスト<24>-Footnote-24428231
Ref: テスト<24>-Footnote-34428287
Ref: テスト<24>-Footnote-44428342
Ref: テスト<24>-Footnote-54428398
Ref: テスト<24>-Footnote-64428454
Node: ビルド<27>4428509
Ref: whatsnew/changelog id3264428621
Ref: 1b044428621
Ref: ビルド<27>-Footnote-14430210
Ref: ビルド<27>-Footnote-24430266
Ref: ビルド<27>-Footnote-34430321
Ref: ビルド<27>-Footnote-44430377
Ref: ビルド<27>-Footnote-54430433
Ref: ビルド<27>-Footnote-64430489
Ref: ビルド<27>-Footnote-74430544
Ref: ビルド<27>-Footnote-84430599
Ref: ビルド<27>-Footnote-94430655
Node: Windows<24>4430710
Ref: whatsnew/changelog id3274430818
Ref: 1b054430818
Ref: Windows<24>-Footnote-14431673
Ref: Windows<24>-Footnote-24431729
Ref: Windows<24>-Footnote-34431784
Ref: Windows<24>-Footnote-44431840
Ref: Windows<24>-Footnote-54431896
Ref: Windows<24>-Footnote-64431952
Node: macOS<18>4432007
Ref: whatsnew/changelog id3284432110
Ref: 1b064432110
Ref: macOS<18>-Footnote-14432914
Ref: macOS<18>-Footnote-24432969
Ref: macOS<18>-Footnote-34433025
Ref: macOS<18>-Footnote-44433081
Ref: macOS<18>-Footnote-54433137
Ref: macOS<18>-Footnote-64433192
Node: IDLE<15>4433248
Ref: whatsnew/changelog id3294433355
Ref: 1b074433355
Ref: IDLE<15>-Footnote-14433639
Ref: IDLE<15>-Footnote-24433695
Ref: IDLE<15>-Footnote-34433751
Node: Tools/Demos<20>4433806
Ref: whatsnew/changelog id3304433913
Ref: 1b084433913
Ref: Tools/Demos<20>-Footnote-14434173
Node: C API<26>4434229
Ref: whatsnew/changelog id3314434319
Ref: 1b094434319
Ref: C API<26>-Footnote-14437297
Ref: C API<26>-Footnote-24437353
Ref: C API<26>-Footnote-34437409
Ref: C API<26>-Footnote-44437465
Ref: C API<26>-Footnote-54437521
Ref: C API<26>-Footnote-64437577
Ref: C API<26>-Footnote-74437633
Ref: C API<26>-Footnote-84437675
Ref: C API<26>-Footnote-94437731
Ref: C API<26>-Footnote-104437787
Ref: C API<26>-Footnote-114437843
Node: Python 3 12 0 alpha 74437899
Ref: whatsnew/changelog python-3-12-0-alpha-74438028
Ref: 1b104438028
Node: Core and Builtins<66>4438545
Ref: whatsnew/changelog id3324438652
Ref: 1b114438652
Ref: Core and Builtins<66>-Footnote-14439980
Ref: Core and Builtins<66>-Footnote-24440036
Ref: Core and Builtins<66>-Footnote-34440091
Ref: Core and Builtins<66>-Footnote-44440147
Ref: Core and Builtins<66>-Footnote-54440203
Ref: Core and Builtins<66>-Footnote-64440259
Ref: Core and Builtins<66>-Footnote-74440315
Ref: Core and Builtins<66>-Footnote-84440371
Ref: Core and Builtins<66>-Footnote-94440427
Ref: Core and Builtins<66>-Footnote-104440483
Node: ライブラリ<72>4440539
Ref: whatsnew/changelog id3334440676
Ref: 1b124440676
Ref: ライブラリ<72>-Footnote-14440994
Node: Core and Builtins<67>4441050
Ref: whatsnew/changelog id3344441179
Ref: 1b134441179
Ref: Core and Builtins<67>-Footnote-14442499
Ref: Core and Builtins<67>-Footnote-24442555
Ref: Core and Builtins<67>-Footnote-34442611
Ref: Core and Builtins<67>-Footnote-44442667
Ref: Core and Builtins<67>-Footnote-54442709
Ref: Core and Builtins<67>-Footnote-64442765
Ref: Core and Builtins<67>-Footnote-74442821
Ref: Core and Builtins<67>-Footnote-84442877
Node: ビルド<28>4442933
Ref: whatsnew/changelog id3354443064
Ref: 1b144443064
Ref: ビルド<28>-Footnote-14443249
Node: Core and Builtins<68>4443305
Ref: whatsnew/changelog id3364443434
Ref: 1b154443434
Ref: Core and Builtins<68>-Footnote-14443634
Node: ライブラリ<73>4443690
Ref: whatsnew/changelog id3374443828
Ref: 1b164443828
Ref: ライブラリ<73>-Footnote-14451768
Ref: ライブラリ<73>-Footnote-24451835
Ref: ライブラリ<73>-Footnote-34451877
Ref: ライブラリ<73>-Footnote-44451933
Ref: ライブラリ<73>-Footnote-54451989
Ref: ライブラリ<73>-Footnote-64452045
Ref: ライブラリ<73>-Footnote-74452101
Ref: ライブラリ<73>-Footnote-84452157
Ref: ライブラリ<73>-Footnote-94452213
Ref: ライブラリ<73>-Footnote-104452269
Ref: ライブラリ<73>-Footnote-114452326
Ref: ライブラリ<73>-Footnote-124452383
Ref: ライブラリ<73>-Footnote-134452440
Ref: ライブラリ<73>-Footnote-144452497
Ref: ライブラリ<73>-Footnote-154452554
Ref: ライブラリ<73>-Footnote-164452610
Ref: ライブラリ<73>-Footnote-174452666
Ref: ライブラリ<73>-Footnote-184452722
Ref: ライブラリ<73>-Footnote-194452779
Ref: ライブラリ<73>-Footnote-204452836
Ref: ライブラリ<73>-Footnote-214452893
Ref: ライブラリ<73>-Footnote-224452950
Ref: ライブラリ<73>-Footnote-234453007
Ref: ライブラリ<73>-Footnote-244453064
Ref: ライブラリ<73>-Footnote-254453120
Ref: ライブラリ<73>-Footnote-264453177
Ref: ライブラリ<73>-Footnote-274453233
Ref: ライブラリ<73>-Footnote-284453290
Ref: ライブラリ<73>-Footnote-294453347
Ref: ライブラリ<73>-Footnote-304453404
Ref: ライブラリ<73>-Footnote-314453460
Ref: ライブラリ<73>-Footnote-324453517
Ref: ライブラリ<73>-Footnote-334453574
Ref: ライブラリ<73>-Footnote-344453631
Ref: ライブラリ<73>-Footnote-354453687
Ref: ライブラリ<73>-Footnote-364453744
Ref: ライブラリ<73>-Footnote-374453800
Ref: ライブラリ<73>-Footnote-384453856
Ref: ライブラリ<73>-Footnote-394453912
Ref: ライブラリ<73>-Footnote-404453968
Ref: ライブラリ<73>-Footnote-414454024
Ref: ライブラリ<73>-Footnote-424454080
Ref: ライブラリ<73>-Footnote-434454136
Node: ドキュメント<25>4454202
Ref: whatsnew/changelog id3384454332
Ref: 1b1b4454332
Ref: ドキュメント<25>-Footnote-14454535
Node: テスト<25>4454591
Ref: whatsnew/changelog id3394454715
Ref: 1b1c4454715
Ref: テスト<25>-Footnote-14455077
Ref: テスト<25>-Footnote-24455133
Ref: テスト<25>-Footnote-34455189
Node: ビルド<29>4455245
Ref: whatsnew/changelog id3404455358
Ref: 1b1d4455358
Ref: ビルド<29>-Footnote-14455609
Ref: ビルド<29>-Footnote-24455665
Node: Windows<25>4455721
Ref: whatsnew/changelog id3414455836
Ref: 1b1e4455836
Ref: Windows<25>-Footnote-14456136
Ref: Windows<25>-Footnote-24456192
Node: Tools/Demos<21>4456247
Ref: whatsnew/changelog id3424456358
Ref: 1b1f4456358
Ref: Tools/Demos<21>-Footnote-14456493
Node: C API<27>4456549
Ref: whatsnew/changelog id3434456640
Ref: 1b204456640
Ref: C API<27>-Footnote-14456856
Node: Python 3 12 0 alpha 64456912
Ref: whatsnew/changelog python-3-12-0-alpha-64457042
Ref: 1b214457042
Node: セキュリティ<28>4457437
Ref: whatsnew/changelog id3444457547
Ref: 1b224457547
Ref: セキュリティ<28>-Footnote-14458499
Ref: セキュリティ<28>-Footnote-24458554
Ref: セキュリティ<28>-Footnote-34458610
Ref: セキュリティ<28>-Footnote-44458665
Ref: セキュリティ<28>-Footnote-54458720
Ref: セキュリティ<28>-Footnote-64458775
Ref: セキュリティ<28>-Footnote-74458836
Ref: セキュリティ<28>-Footnote-84458891
Ref: セキュリティ<28>-Footnote-94458939
Node: Core and Builtins<69>4458995
Ref: whatsnew/changelog id3454459133
Ref: 1b234459133
Ref: Core and Builtins<69>-Footnote-14462762
Ref: Core and Builtins<69>-Footnote-24462818
Ref: Core and Builtins<69>-Footnote-34462874
Ref: Core and Builtins<69>-Footnote-44462930
Ref: Core and Builtins<69>-Footnote-54462986
Ref: Core and Builtins<69>-Footnote-64463042
Ref: Core and Builtins<69>-Footnote-74463098
Ref: Core and Builtins<69>-Footnote-84463154
Ref: Core and Builtins<69>-Footnote-94463210
Ref: Core and Builtins<69>-Footnote-104463266
Ref: Core and Builtins<69>-Footnote-114463323
Ref: Core and Builtins<69>-Footnote-124463380
Ref: Core and Builtins<69>-Footnote-134463436
Ref: Core and Builtins<69>-Footnote-144463493
Ref: Core and Builtins<69>-Footnote-154463550
Ref: Core and Builtins<69>-Footnote-164463606
Ref: Core and Builtins<69>-Footnote-174463662
Ref: Core and Builtins<69>-Footnote-184463719
Ref: Core and Builtins<69>-Footnote-194463776
Ref: Core and Builtins<69>-Footnote-204463833
Ref: Core and Builtins<69>-Footnote-214463890
Ref: Core and Builtins<69>-Footnote-224463947
Node: ライブラリ<74>4464003
Ref: whatsnew/changelog id3464464141
Ref: 1b264464141
Ref: ライブラリ<74>-Footnote-14469960
Ref: ライブラリ<74>-Footnote-24470016
Ref: ライブラリ<74>-Footnote-34470072
Ref: ライブラリ<74>-Footnote-44470127
Ref: ライブラリ<74>-Footnote-54470182
Ref: ライブラリ<74>-Footnote-64470238
Ref: ライブラリ<74>-Footnote-74470294
Ref: ライブラリ<74>-Footnote-84470350
Ref: ライブラリ<74>-Footnote-94470406
Ref: ライブラリ<74>-Footnote-104470473
Ref: ライブラリ<74>-Footnote-114470529
Ref: ライブラリ<74>-Footnote-124470613
Ref: ライブラリ<74>-Footnote-134470670
Ref: ライブラリ<74>-Footnote-144470726
Ref: ライブラリ<74>-Footnote-154470783
Ref: ライブラリ<74>-Footnote-164470839
Ref: ライブラリ<74>-Footnote-174470895
Ref: ライブラリ<74>-Footnote-184470952
Ref: ライブラリ<74>-Footnote-194471009
Ref: ライブラリ<74>-Footnote-204471066
Ref: ライブラリ<74>-Footnote-214471123
Ref: ライブラリ<74>-Footnote-224471180
Ref: ライブラリ<74>-Footnote-234471237
Ref: ライブラリ<74>-Footnote-244471294
Ref: ライブラリ<74>-Footnote-254471350
Ref: ライブラリ<74>-Footnote-264471407
Ref: ライブラリ<74>-Footnote-274471450
Ref: ライブラリ<74>-Footnote-284471506
Ref: ライブラリ<74>-Footnote-294471563
Ref: ライブラリ<74>-Footnote-304471620
Ref: ライブラリ<74>-Footnote-314471663
Ref: ライブラリ<74>-Footnote-324471720
Ref: ライブラリ<74>-Footnote-334471776
Ref: ライブラリ<74>-Footnote-344471819
Ref: ライブラリ<74>-Footnote-354471875
Ref: ライブラリ<74>-Footnote-364471931
Node: ドキュメント<26>4471997
Ref: whatsnew/changelog id3474472127
Ref: 1b2e4472127
Ref: ドキュメント<26>-Footnote-14472440
Ref: ドキュメント<26>-Footnote-24472495
Node: テスト<26>4472550
Ref: whatsnew/changelog id3484472674
Ref: 1b304472674
Ref: テスト<26>-Footnote-14473251
Ref: テスト<26>-Footnote-24473307
Ref: テスト<26>-Footnote-34473362
Node: ビルド<30>4473417
Ref: whatsnew/changelog id3494473530
Ref: 1b314473530
Ref: ビルド<30>-Footnote-14474214
Ref: ビルド<30>-Footnote-24474269
Ref: ビルド<30>-Footnote-34474324
Ref: ビルド<30>-Footnote-44474380
Node: Windows<26>4474435
Ref: whatsnew/changelog id3504474544
Ref: 1b334474544
Ref: Windows<26>-Footnote-14475563
Ref: Windows<26>-Footnote-24475619
Ref: Windows<26>-Footnote-34475675
Ref: Windows<26>-Footnote-44475731
Ref: Windows<26>-Footnote-54475787
Ref: Windows<26>-Footnote-64475843
Ref: Windows<26>-Footnote-74475899
Ref: Windows<26>-Footnote-84475955
Node: macOS<19>4476011
Ref: whatsnew/changelog id3514476116
Ref: 1b344476116
Ref: macOS<19>-Footnote-14476246
Node: C API<28>4476302
Ref: whatsnew/changelog id3524476387
Ref: 1b354476387
Ref: C API<28>-Footnote-14477482
Ref: C API<28>-Footnote-24477538
Ref: C API<28>-Footnote-34477593
Ref: C API<28>-Footnote-44477649
Ref: C API<28>-Footnote-54477704
Node: Python 3 12 0 alpha 54477746
Ref: whatsnew/changelog python-3-12-0-alpha-54477876
Ref: 1b364477876
Node: セキュリティ<29>4478231
Ref: whatsnew/changelog id3534478341
Ref: 1b374478341
Ref: セキュリティ<29>-Footnote-14478733
Ref: セキュリティ<29>-Footnote-24478788
Node: Core and Builtins<70>4478836
Ref: whatsnew/changelog id3554478974
Ref: 1b384478974
Ref: Core and Builtins<70>-Footnote-14481871
Ref: Core and Builtins<70>-Footnote-24481926
Ref: Core and Builtins<70>-Footnote-34481981
Ref: Core and Builtins<70>-Footnote-44482037
Ref: Core and Builtins<70>-Footnote-54482093
Ref: Core and Builtins<70>-Footnote-64482149
Ref: Core and Builtins<70>-Footnote-74482205
Ref: Core and Builtins<70>-Footnote-84482261
Ref: Core and Builtins<70>-Footnote-94482317
Ref: Core and Builtins<70>-Footnote-104482373
Ref: Core and Builtins<70>-Footnote-114482430
Ref: Core and Builtins<70>-Footnote-124482487
Ref: Core and Builtins<70>-Footnote-134482544
Ref: Core and Builtins<70>-Footnote-144482601
Ref: Core and Builtins<70>-Footnote-154482657
Ref: Core and Builtins<70>-Footnote-164482714
Node: ライブラリ<75>4482771
Ref: whatsnew/changelog id3564482909
Ref: 1b3b4482909
Ref: ライブラリ<75>-Footnote-14488172
Ref: ライブラリ<75>-Footnote-24488237
Ref: ライブラリ<75>-Footnote-34488293
Ref: ライブラリ<75>-Footnote-44488349
Ref: ライブラリ<75>-Footnote-54488405
Ref: ライブラリ<75>-Footnote-64488461
Ref: ライブラリ<75>-Footnote-74488517
Ref: ライブラリ<75>-Footnote-84488572
Ref: ライブラリ<75>-Footnote-94488614
Ref: ライブラリ<75>-Footnote-104488670
Ref: ライブラリ<75>-Footnote-114488727
Ref: ライブラリ<75>-Footnote-124488784
Ref: ライブラリ<75>-Footnote-134488840
Ref: ライブラリ<75>-Footnote-144488897
Ref: ライブラリ<75>-Footnote-154488954
Ref: ライブラリ<75>-Footnote-164489011
Ref: ライブラリ<75>-Footnote-174489067
Ref: ライブラリ<75>-Footnote-184489124
Ref: ライブラリ<75>-Footnote-194489181
Ref: ライブラリ<75>-Footnote-204489237
Ref: ライブラリ<75>-Footnote-214489293
Ref: ライブラリ<75>-Footnote-224489349
Ref: ライブラリ<75>-Footnote-234489405
Ref: ライブラリ<75>-Footnote-244489461
Ref: ライブラリ<75>-Footnote-254489517
Ref: ライブラリ<75>-Footnote-264489573
Ref: ライブラリ<75>-Footnote-274489629
Ref: ライブラリ<75>-Footnote-284489695
Ref: ライブラリ<75>-Footnote-294489761
Ref: ライブラリ<75>-Footnote-304489827
Node: ドキュメント<27>4489883
Ref: whatsnew/changelog id3574490013
Ref: 1b444490013
Ref: ドキュメント<27>-Footnote-14490302
Node: テスト<27>4490357
Ref: whatsnew/changelog id3584490481
Ref: 1b454490481
Ref: テスト<27>-Footnote-14490648
Node: ビルド<31>4490704
Ref: whatsnew/changelog id3594490817
Ref: 1b464490817
Ref: ビルド<31>-Footnote-14492261
Ref: ビルド<31>-Footnote-24492317
Ref: ビルド<31>-Footnote-34492373
Ref: ビルド<31>-Footnote-44492428
Ref: ビルド<31>-Footnote-54492484
Ref: ビルド<31>-Footnote-64492526
Ref: ビルド<31>-Footnote-74492582
Ref: ビルド<31>-Footnote-84492638
Ref: ビルド<31>-Footnote-94492693
Ref: ビルド<31>-Footnote-104492748
Node: Windows<27>4492804
Ref: whatsnew/changelog id3604492895
Ref: 1b474492895
Ref: Windows<27>-Footnote-14494145
Ref: Windows<27>-Footnote-24494201
Ref: Windows<27>-Footnote-34494257
Ref: Windows<27>-Footnote-44494312
Ref: Windows<27>-Footnote-54494368
Ref: Windows<27>-Footnote-64494423
Ref: Windows<27>-Footnote-74494479
Node: Python 3 12 0 alpha 44494535
Ref: whatsnew/changelog python-3-12-0-alpha-44494665
Ref: 1b484494665
Node: Core and Builtins<71>4495214
Ref: whatsnew/changelog id3614495321
Ref: 1b494495321
Ref: Core and Builtins<71>-Footnote-14497217
Ref: Core and Builtins<71>-Footnote-24497273
Ref: Core and Builtins<71>-Footnote-34497328
Ref: Core and Builtins<71>-Footnote-44497383
Ref: Core and Builtins<71>-Footnote-54497439
Ref: Core and Builtins<71>-Footnote-64497495
Ref: Core and Builtins<71>-Footnote-74497551
Ref: Core and Builtins<71>-Footnote-84497607
Ref: Core and Builtins<71>-Footnote-94497663
Ref: Core and Builtins<71>-Footnote-104497719
Ref: Core and Builtins<71>-Footnote-114497775
Ref: Core and Builtins<71>-Footnote-124497818
Ref: Core and Builtins<71>-Footnote-134497875
Node: ライブラリ<76>4497932
Ref: whatsnew/changelog id3624498069
Ref: 1b4b4498069
Ref: ライブラリ<76>-Footnote-14498269
Node: Core and Builtins<72>4498325
Ref: whatsnew/changelog id3634498460
Ref: 1b4d4498460
Ref: Core and Builtins<72>-Footnote-14501193
Ref: Core and Builtins<72>-Footnote-24501249
Ref: Core and Builtins<72>-Footnote-34501305
Ref: Core and Builtins<72>-Footnote-44501360
Ref: Core and Builtins<72>-Footnote-54501416
Ref: Core and Builtins<72>-Footnote-64501471
Ref: Core and Builtins<72>-Footnote-74501527
Ref: Core and Builtins<72>-Footnote-84501582
Ref: Core and Builtins<72>-Footnote-94501637
Ref: Core and Builtins<72>-Footnote-104501692
Ref: Core and Builtins<72>-Footnote-114501749
Ref: Core and Builtins<72>-Footnote-124501806
Ref: Core and Builtins<72>-Footnote-134501863
Ref: Core and Builtins<72>-Footnote-144501920
Ref: Core and Builtins<72>-Footnote-154501976
Ref: Core and Builtins<72>-Footnote-164502032
Ref: Core and Builtins<72>-Footnote-174502088
Ref: Core and Builtins<72>-Footnote-184502144
Node: ライブラリ<77>4502200
Ref: whatsnew/changelog id3644502337
Ref: 1b4f4502337
Ref: ライブラリ<77>-Footnote-14502486
Node: Core and Builtins<73>4502541
Ref: whatsnew/changelog id3654502676
Ref: 1b514502676
Ref: Core and Builtins<73>-Footnote-14502951
Node: ライブラリ<78>4503016
Ref: whatsnew/changelog id3664503154
Ref: 1b524503154
Ref: ライブラリ<78>-Footnote-14513430
Ref: ライブラリ<78>-Footnote-24513486
Ref: ライブラリ<78>-Footnote-34513542
Ref: ライブラリ<78>-Footnote-44513598
Ref: ライブラリ<78>-Footnote-54513654
Ref: ライブラリ<78>-Footnote-64513709
Ref: ライブラリ<78>-Footnote-74513764
Ref: ライブラリ<78>-Footnote-84513820
Ref: ライブラリ<78>-Footnote-94513876
Ref: ライブラリ<78>-Footnote-104513931
Ref: ライブラリ<78>-Footnote-114513988
Ref: ライブラリ<78>-Footnote-124514044
Ref: ライブラリ<78>-Footnote-134514101
Ref: ライブラリ<78>-Footnote-144514157
Ref: ライブラリ<78>-Footnote-154514213
Ref: ライブラリ<78>-Footnote-164514270
Ref: ライブラリ<78>-Footnote-174514327
Ref: ライブラリ<78>-Footnote-184514384
Ref: ライブラリ<78>-Footnote-194514441
Ref: ライブラリ<78>-Footnote-204514498
Ref: ライブラリ<78>-Footnote-214514555
Ref: ライブラリ<78>-Footnote-224514612
Ref: ライブラリ<78>-Footnote-234514668
Ref: ライブラリ<78>-Footnote-244514725
Ref: ライブラリ<78>-Footnote-254514782
Ref: ライブラリ<78>-Footnote-264514839
Ref: ライブラリ<78>-Footnote-274514895
Ref: ライブラリ<78>-Footnote-284514952
Ref: ライブラリ<78>-Footnote-294515009
Ref: ライブラリ<78>-Footnote-304515066
Ref: ライブラリ<78>-Footnote-314515123
Ref: ライブラリ<78>-Footnote-324515189
Ref: ライブラリ<78>-Footnote-334515246
Ref: ライブラリ<78>-Footnote-344515302
Ref: ライブラリ<78>-Footnote-354515358
Ref: ライブラリ<78>-Footnote-364515414
Ref: ライブラリ<78>-Footnote-374515470
Ref: ライブラリ<78>-Footnote-384515526
Ref: ライブラリ<78>-Footnote-394515582
Ref: ライブラリ<78>-Footnote-404515638
Ref: ライブラリ<78>-Footnote-414515694
Ref: ライブラリ<78>-Footnote-424515750
Ref: ライブラリ<78>-Footnote-434515793
Ref: ライブラリ<78>-Footnote-444515849
Ref: ライブラリ<78>-Footnote-454515905
Ref: ライブラリ<78>-Footnote-464515961
Ref: ライブラリ<78>-Footnote-474516017
Ref: ライブラリ<78>-Footnote-484516073
Ref: ライブラリ<78>-Footnote-494516129
Ref: ライブラリ<78>-Footnote-504516185
Ref: ライブラリ<78>-Footnote-514516241
Ref: ライブラリ<78>-Footnote-524516297
Ref: ライブラリ<78>-Footnote-534516353
Ref: ライブラリ<78>-Footnote-544516409
Ref: ライブラリ<78>-Footnote-554516475
Ref: ライブラリ<78>-Footnote-564516541
Node: ドキュメント<28>4516607
Ref: whatsnew/changelog id3674516737
Ref: 1b5b4516737
Ref: ドキュメント<28>-Footnote-14517324
Ref: ドキュメント<28>-Footnote-24517380
Ref: ドキュメント<28>-Footnote-34517436
Node: テスト<28>4517501
Ref: whatsnew/changelog id3684517625
Ref: 1b5d4517625
Ref: テスト<28>-Footnote-14518077
Ref: テスト<28>-Footnote-24518133
Ref: テスト<28>-Footnote-34518189
Node: ビルド<32>4518244
Ref: whatsnew/changelog id3694518357
Ref: 1b5e4518357
Ref: ビルド<32>-Footnote-14519249
Ref: ビルド<32>-Footnote-24519305
Ref: ビルド<32>-Footnote-34519360
Node: Windows<28>4519425
Ref: whatsnew/changelog id3704519534
Ref: 1b5f4519534
Ref: Windows<28>-Footnote-14520461
Ref: Windows<28>-Footnote-24520517
Ref: Windows<28>-Footnote-34520572
Ref: Windows<28>-Footnote-44520627
Ref: Windows<28>-Footnote-54520682
Ref: Windows<28>-Footnote-64520747
Node: macOS<20>4520812
Ref: whatsnew/changelog id3714520923
Ref: 1b624520923
Ref: macOS<20>-Footnote-14521207
Ref: macOS<20>-Footnote-24521263
Node: Tools/Demos<22>4521319
Ref: whatsnew/changelog id3724521428
Ref: 1b634521428
Ref: Tools/Demos<22>-Footnote-14521804
Ref: Tools/Demos<22>-Footnote-24521869
Node: C API<29>4521925
Ref: whatsnew/changelog id3734522016
Ref: 1b644522016
Ref: C API<29>-Footnote-14522585
Ref: C API<29>-Footnote-24522640
Ref: C API<29>-Footnote-34522695
Node: Python 3 12 0 alpha 34522750
Ref: whatsnew/changelog python-3-12-0-alpha-34522880
Ref: 1b654522880
Node: セキュリティ<30>4523394
Ref: whatsnew/changelog id3744523504
Ref: 1b664523504
Ref: セキュリティ<30>-Footnote-14524078
Ref: セキュリティ<30>-Footnote-24524134
Node: Core and Builtins<74>4524189
Ref: whatsnew/changelog id3754524327
Ref: 1b674524327
Ref: Core and Builtins<74>-Footnote-14525647
Ref: Core and Builtins<74>-Footnote-24525702
Ref: Core and Builtins<74>-Footnote-34525757
Ref: Core and Builtins<74>-Footnote-44525812
Ref: Core and Builtins<74>-Footnote-54525867
Ref: Core and Builtins<74>-Footnote-64525922
Ref: Core and Builtins<74>-Footnote-74525977
Node: ライブラリ<79>4526032
Ref: whatsnew/changelog id3764526169
Ref: 1b684526169
Ref: ライブラリ<79>-Footnote-14526515
Ref: ライブラリ<79>-Footnote-24526570
Node: Core and Builtins<75>4526625
Ref: whatsnew/changelog id3774526760
Ref: 1b694526760
Ref: Core and Builtins<75>-Footnote-14528565
Ref: Core and Builtins<75>-Footnote-24528620
Ref: Core and Builtins<75>-Footnote-34528675
Ref: Core and Builtins<75>-Footnote-44528730
Ref: Core and Builtins<75>-Footnote-54528785
Ref: Core and Builtins<75>-Footnote-64528840
Ref: Core and Builtins<75>-Footnote-74528895
Ref: Core and Builtins<75>-Footnote-84528960
Ref: Core and Builtins<75>-Footnote-94529025
Node: ライブラリ<80>4529090
Ref: whatsnew/changelog id3784529228
Ref: 1b6a4529228
Ref: ライブラリ<80>-Footnote-14535484
Ref: ライブラリ<80>-Footnote-24535540
Ref: ライブラリ<80>-Footnote-34535595
Ref: ライブラリ<80>-Footnote-44535650
Ref: ライブラリ<80>-Footnote-54535705
Ref: ライブラリ<80>-Footnote-64535760
Ref: ライブラリ<80>-Footnote-74535815
Ref: ライブラリ<80>-Footnote-84535870
Ref: ライブラリ<80>-Footnote-94535925
Ref: ライブラリ<80>-Footnote-104535980
Ref: ライブラリ<80>-Footnote-114536036
Ref: ライブラリ<80>-Footnote-124536092
Ref: ライブラリ<80>-Footnote-134536148
Ref: ライブラリ<80>-Footnote-144536204
Ref: ライブラリ<80>-Footnote-154536260
Ref: ライブラリ<80>-Footnote-164536316
Ref: ライブラリ<80>-Footnote-174536372
Ref: ライブラリ<80>-Footnote-184536428
Ref: ライブラリ<80>-Footnote-194536484
Ref: ライブラリ<80>-Footnote-204536540
Ref: ライブラリ<80>-Footnote-214536596
Ref: ライブラリ<80>-Footnote-224536652
Ref: ライブラリ<80>-Footnote-234536708
Ref: ライブラリ<80>-Footnote-244536764
Ref: ライブラリ<80>-Footnote-254536820
Ref: ライブラリ<80>-Footnote-264536876
Ref: ライブラリ<80>-Footnote-274536932
Ref: ライブラリ<80>-Footnote-284536988
Ref: ライブラリ<80>-Footnote-294537044
Ref: ライブラリ<80>-Footnote-304537100
Ref: ライブラリ<80>-Footnote-314537156
Ref: ライブラリ<80>-Footnote-324537222
Ref: ライブラリ<80>-Footnote-334537288
Ref: ライブラリ<80>-Footnote-344537354
Node: ドキュメント<29>4537420
Ref: whatsnew/changelog id3794537550
Ref: 1b6f4537550
Ref: ドキュメント<29>-Footnote-14538323
Ref: ドキュメント<29>-Footnote-24538378
Ref: ドキュメント<29>-Footnote-34538430
Ref: ドキュメント<29>-Footnote-44538454
Ref: ドキュメント<29>-Footnote-54538509
Ref: ドキュメント<29>-Footnote-64538564
Ref: ドキュメント<29>-Footnote-74538619
Node: テスト<29>4538684
Ref: whatsnew/changelog id3804538808
Ref: 1b704538808
Ref: テスト<29>-Footnote-14539588
Ref: テスト<29>-Footnote-24539643
Ref: テスト<29>-Footnote-34539698
Ref: テスト<29>-Footnote-44539753
Ref: テスト<29>-Footnote-54539808
Ref: テスト<29>-Footnote-64539863
Node: ビルド<33>4539918
Ref: whatsnew/changelog id3814540031
Ref: 1b714540031
Ref: ビルド<33>-Footnote-14541000
Ref: ビルド<33>-Footnote-24541055
Ref: ビルド<33>-Footnote-34541110
Ref: ビルド<33>-Footnote-44541165
Ref: ビルド<33>-Footnote-54541220
Node: Windows<29>4541275
Ref: whatsnew/changelog id3824541384
Ref: 1b724541384
Ref: Windows<29>-Footnote-14541913
Ref: Windows<29>-Footnote-24541968
Ref: Windows<29>-Footnote-34542023
Ref: Windows<29>-Footnote-44542078
Node: macOS<21>4542143
Ref: whatsnew/changelog id3834542254
Ref: 1b734542254
Ref: macOS<21>-Footnote-14542524
Ref: macOS<21>-Footnote-24542579
Node: Tools/Demos<23>4542634
Ref: whatsnew/changelog id3844542743
Ref: 1b744542743
Ref: Tools/Demos<23>-Footnote-14543235
Node: C API<30>4543290
Ref: whatsnew/changelog id3854543381
Ref: 1b754543381
Ref: C API<30>-Footnote-14544202
Ref: C API<30>-Footnote-24544257
Ref: C API<30>-Footnote-34544312
Node: Python 3 12 0 alpha 24544367
Ref: whatsnew/changelog python-3-12-0-alpha-24544497
Ref: 1b774544497
Node: セキュリティ<31>4544964
Ref: whatsnew/changelog id3864545074
Ref: 1b784545074
Ref: セキュリティ<31>-Footnote-14546217
Ref: セキュリティ<31>-Footnote-24546272
Ref: セキュリティ<31>-Footnote-34546331
Ref: セキュリティ<31>-Footnote-44546390
Ref: セキュリティ<31>-Footnote-54546449
Node: Core and Builtins<76>4546504
Ref: whatsnew/changelog id3874546636
Ref: 1b794546636
Ref: Core and Builtins<76>-Footnote-14553337
Ref: Core and Builtins<76>-Footnote-24553392
Ref: Core and Builtins<76>-Footnote-34553447
Ref: Core and Builtins<76>-Footnote-44553502
Ref: Core and Builtins<76>-Footnote-54553557
Ref: Core and Builtins<76>-Footnote-64553612
Ref: Core and Builtins<76>-Footnote-74553667
Ref: Core and Builtins<76>-Footnote-84553722
Ref: Core and Builtins<76>-Footnote-94553777
Ref: Core and Builtins<76>-Footnote-104553832
Ref: Core and Builtins<76>-Footnote-114553888
Ref: Core and Builtins<76>-Footnote-124553944
Ref: Core and Builtins<76>-Footnote-134554000
Ref: Core and Builtins<76>-Footnote-144554056
Ref: Core and Builtins<76>-Footnote-154554112
Ref: Core and Builtins<76>-Footnote-164554168
Ref: Core and Builtins<76>-Footnote-174554224
Ref: Core and Builtins<76>-Footnote-184554280
Ref: Core and Builtins<76>-Footnote-194554336
Ref: Core and Builtins<76>-Footnote-204554392
Ref: Core and Builtins<76>-Footnote-214554448
Ref: Core and Builtins<76>-Footnote-224554504
Ref: Core and Builtins<76>-Footnote-234554560
Ref: Core and Builtins<76>-Footnote-244554616
Ref: Core and Builtins<76>-Footnote-254554659
Ref: Core and Builtins<76>-Footnote-264554715
Ref: Core and Builtins<76>-Footnote-274554771
Node: ビルド<34>4554827
Ref: whatsnew/changelog id3884554958
Ref: 1b804554958
Ref: ビルド<34>-Footnote-14555148
Node: Core and Builtins<77>4555203
Ref: whatsnew/changelog id3894555332
Ref: 1b814555332
Ref: Core and Builtins<77>-Footnote-14556469
Ref: Core and Builtins<77>-Footnote-24556524
Ref: Core and Builtins<77>-Footnote-34556579
Ref: Core and Builtins<77>-Footnote-44556634
Ref: Core and Builtins<77>-Footnote-54556689
Ref: Core and Builtins<77>-Footnote-64556744
Node: ライブラリ<81>4556799
Ref: whatsnew/changelog id3904556937
Ref: 1b844556937
Ref: ライブラリ<81>-Footnote-14562841
Ref: ライブラリ<81>-Footnote-24562896
Ref: ライブラリ<81>-Footnote-34562951
Ref: ライブラリ<81>-Footnote-44563006
Ref: ライブラリ<81>-Footnote-54563061
Ref: ライブラリ<81>-Footnote-64563116
Ref: ライブラリ<81>-Footnote-74563171
Ref: ライブラリ<81>-Footnote-84563226
Ref: ライブラリ<81>-Footnote-94563281
Ref: ライブラリ<81>-Footnote-104563336
Ref: ライブラリ<81>-Footnote-114563392
Ref: ライブラリ<81>-Footnote-124563448
Ref: ライブラリ<81>-Footnote-134563504
Ref: ライブラリ<81>-Footnote-144563547
Ref: ライブラリ<81>-Footnote-154563603
Ref: ライブラリ<81>-Footnote-164563659
Ref: ライブラリ<81>-Footnote-174563715
Ref: ライブラリ<81>-Footnote-184563771
Ref: ライブラリ<81>-Footnote-194563827
Ref: ライブラリ<81>-Footnote-204563883
Ref: ライブラリ<81>-Footnote-214563939
Ref: ライブラリ<81>-Footnote-224563995
Ref: ライブラリ<81>-Footnote-234564051
Ref: ライブラリ<81>-Footnote-244564107
Ref: ライブラリ<81>-Footnote-254564163
Ref: ライブラリ<81>-Footnote-264564219
Ref: ライブラリ<81>-Footnote-274564275
Ref: ライブラリ<81>-Footnote-284564331
Ref: ライブラリ<81>-Footnote-294564387
Ref: ライブラリ<81>-Footnote-304564443
Ref: ライブラリ<81>-Footnote-314564499
Ref: ライブラリ<81>-Footnote-324564555
Ref: ライブラリ<81>-Footnote-334564598
Ref: ライブラリ<81>-Footnote-344564654
Ref: ライブラリ<81>-Footnote-354564710
Ref: ライブラリ<81>-Footnote-364564766
Ref: ライブラリ<81>-Footnote-374564822
Ref: ライブラリ<81>-Footnote-384564865
Ref: ライブラリ<81>-Footnote-394564921
Ref: ライブラリ<81>-Footnote-404564977
Ref: ライブラリ<81>-Footnote-414565043
Ref: ライブラリ<81>-Footnote-424565109
Node: ドキュメント<30>4565175
Ref: whatsnew/changelog id3914565305
Ref: 1b894565305
Ref: ドキュメント<30>-Footnote-14565627
Ref: ドキュメント<30>-Footnote-24565682
Node: テスト<30>4565737
Ref: whatsnew/changelog id3924565861
Ref: 1b8a4565861
Ref: テスト<30>-Footnote-14566754
Ref: テスト<30>-Footnote-24566809
Ref: テスト<30>-Footnote-34566864
Ref: テスト<30>-Footnote-44566919
Ref: テスト<30>-Footnote-54566974
Node: ビルド<35>4567039
Ref: whatsnew/changelog id3934567152
Ref: 1b8b4567152
Ref: ビルド<35>-Footnote-14568842
Ref: ビルド<35>-Footnote-24568897
Ref: ビルド<35>-Footnote-34568952
Ref: ビルド<35>-Footnote-44569007
Ref: ビルド<35>-Footnote-54569062
Ref: ビルド<35>-Footnote-64569117
Ref: ビルド<35>-Footnote-74569172
Ref: ビルド<35>-Footnote-84569262
Ref: ビルド<35>-Footnote-94569317
Ref: ビルド<35>-Footnote-104569372
Node: Windows<30>4569428
Ref: whatsnew/changelog id3944569537
Ref: 1b8d4569537
Ref: Windows<30>-Footnote-14570230
Ref: Windows<30>-Footnote-24570285
Ref: Windows<30>-Footnote-34570341
Ref: Windows<30>-Footnote-44570396
Ref: Windows<30>-Footnote-54570451
Ref: Windows<30>-Footnote-64570506
Node: macOS<22>4570561
Ref: whatsnew/changelog id3954570666
Ref: 1b8e4570666
Ref: macOS<22>-Footnote-14570797
Node: C API<31>4570852
Ref: whatsnew/changelog id3964570937
Ref: 1b8f4570937
Ref: C API<31>-Footnote-14573002
Ref: C API<31>-Footnote-24573057
Ref: C API<31>-Footnote-34573112
Ref: C API<31>-Footnote-44573167
Ref: C API<31>-Footnote-54573222
Ref: C API<31>-Footnote-64573277
Ref: C API<31>-Footnote-74573332
Node: Python 3 12 0 alpha 14573387
Ref: whatsnew/changelog python-3-12-0-alpha-14573516
Ref: 1b914573516
Node: セキュリティ<32>4574717
Ref: whatsnew/changelog id3974574827
Ref: 1b924574827
Ref: セキュリティ<32>-Footnote-14576674
Ref: セキュリティ<32>-Footnote-24576729
Ref: セキュリティ<32>-Footnote-34576784
Ref: セキュリティ<32>-Footnote-44576856
Ref: セキュリティ<32>-Footnote-54576912
Ref: セキュリティ<32>-Footnote-64576967
Ref: セキュリティ<32>-Footnote-74577022
Ref: セキュリティ<32>-Footnote-84577077
Node: Core and Builtins<78>4577132
Ref: whatsnew/changelog id3984577270
Ref: 1b934577270
Ref: Core and Builtins<78>-Footnote-14578546
Ref: Core and Builtins<78>-Footnote-24578601
Ref: Core and Builtins<78>-Footnote-34578656
Ref: Core and Builtins<78>-Footnote-44578711
Ref: Core and Builtins<78>-Footnote-54578766
Ref: Core and Builtins<78>-Footnote-64578821
Ref: Core and Builtins<78>-Footnote-74578876
Ref: Core and Builtins<78>-Footnote-84578931
Node: ライブラリ<82>4578986
Ref: whatsnew/changelog id3994579123
Ref: 1b944579123
Ref: ライブラリ<82>-Footnote-14579401
Ref: ライブラリ<82>-Footnote-24579456
Node: Core and Builtins<79>4579511
Ref: whatsnew/changelog id4004579646
Ref: 1b954579646
Ref: Core and Builtins<79>-Footnote-14583085
Ref: Core and Builtins<79>-Footnote-24583140
Ref: Core and Builtins<79>-Footnote-34583195
Ref: Core and Builtins<79>-Footnote-44583250
Ref: Core and Builtins<79>-Footnote-54583305
Ref: Core and Builtins<79>-Footnote-64583360
Ref: Core and Builtins<79>-Footnote-74583415
Ref: Core and Builtins<79>-Footnote-84583470
Ref: Core and Builtins<79>-Footnote-94583525
Ref: Core and Builtins<79>-Footnote-104583580
Ref: Core and Builtins<79>-Footnote-114583636
Ref: Core and Builtins<79>-Footnote-124583692
Ref: Core and Builtins<79>-Footnote-134583748
Ref: Core and Builtins<79>-Footnote-144583804
Ref: Core and Builtins<79>-Footnote-154583860
Ref: Core and Builtins<79>-Footnote-164583916
Ref: Core and Builtins<79>-Footnote-174583972
Node: ライブラリ<83>4584028
Ref: whatsnew/changelog id4014584165
Ref: 1b9a4584165
Ref: ライブラリ<83>-Footnote-14584312
Node: Core and Builtins<80>4584367
Ref: whatsnew/changelog id4024584502
Ref: 1b9b4584502
Ref: Core and Builtins<80>-Footnote-14586229
Ref: Core and Builtins<80>-Footnote-24586284
Ref: Core and Builtins<80>-Footnote-34586339
Ref: Core and Builtins<80>-Footnote-44586394
Ref: Core and Builtins<80>-Footnote-54586449
Ref: Core and Builtins<80>-Footnote-64586504
Ref: Core and Builtins<80>-Footnote-74586559
Ref: Core and Builtins<80>-Footnote-84586614
Ref: Core and Builtins<80>-Footnote-94586669
Ref: Core and Builtins<80>-Footnote-104586724
Ref: Core and Builtins<80>-Footnote-114586780
Node: ライブラリ<84>4586836
Ref: whatsnew/changelog id4034586973
Ref: 1b9c4586973
Ref: ライブラリ<84>-Footnote-14587192
Ref: ライブラリ<84>-Footnote-24587247
Node: Core and Builtins<81>4587302
Ref: whatsnew/changelog id4044587437
Ref: 1b9d4587437
Ref: Core and Builtins<81>-Footnote-14596676
Ref: Core and Builtins<81>-Footnote-24596731
Ref: Core and Builtins<81>-Footnote-34596786
Ref: Core and Builtins<81>-Footnote-44596841
Ref: Core and Builtins<81>-Footnote-54596896
Ref: Core and Builtins<81>-Footnote-64596951
Ref: Core and Builtins<81>-Footnote-74597006
Ref: Core and Builtins<81>-Footnote-84597048
Ref: Core and Builtins<81>-Footnote-94597103
Ref: Core and Builtins<81>-Footnote-104597158
Ref: Core and Builtins<81>-Footnote-114597214
Ref: Core and Builtins<81>-Footnote-124597270
Ref: Core and Builtins<81>-Footnote-134597326
Ref: Core and Builtins<81>-Footnote-144597382
Ref: Core and Builtins<81>-Footnote-154597438
Ref: Core and Builtins<81>-Footnote-164597494
Ref: Core and Builtins<81>-Footnote-174597550
Ref: Core and Builtins<81>-Footnote-184597606
Ref: Core and Builtins<81>-Footnote-194597662
Ref: Core and Builtins<81>-Footnote-204597718
Ref: Core and Builtins<81>-Footnote-214597774
Ref: Core and Builtins<81>-Footnote-224597830
Ref: Core and Builtins<81>-Footnote-234597886
Ref: Core and Builtins<81>-Footnote-244597942
Ref: Core and Builtins<81>-Footnote-254597998
Ref: Core and Builtins<81>-Footnote-264598054
Ref: Core and Builtins<81>-Footnote-274598110
Ref: Core and Builtins<81>-Footnote-284598166
Ref: Core and Builtins<81>-Footnote-294598222
Ref: Core and Builtins<81>-Footnote-304598278
Ref: Core and Builtins<81>-Footnote-314598334
Ref: Core and Builtins<81>-Footnote-324598390
Ref: Core and Builtins<81>-Footnote-334598446
Ref: Core and Builtins<81>-Footnote-344598502
Ref: Core and Builtins<81>-Footnote-354598558
Ref: Core and Builtins<81>-Footnote-364598614
Ref: Core and Builtins<81>-Footnote-374598670
Ref: Core and Builtins<81>-Footnote-384598726
Ref: Core and Builtins<81>-Footnote-394598782
Ref: Core and Builtins<81>-Footnote-404598838
Ref: Core and Builtins<81>-Footnote-414598894
Ref: Core and Builtins<81>-Footnote-424598950
Ref: Core and Builtins<81>-Footnote-434599006
Ref: Core and Builtins<81>-Footnote-444599062
Ref: Core and Builtins<81>-Footnote-454599118
Ref: Core and Builtins<81>-Footnote-464599174
Node: ライブラリ<85>4599230
Ref: whatsnew/changelog id4054599367
Ref: 1b9f4599367
Ref: ライブラリ<85>-Footnote-14599572
Node: Core and Builtins<82>4599627
Ref: whatsnew/changelog id4064599762
Ref: 1ba24599762
Ref: Core and Builtins<82>-Footnote-14600230
Ref: Core and Builtins<82>-Footnote-24600285
Node: ライブラリ<86>4600340
Ref: whatsnew/changelog id4074600477
Ref: 1ba34600477
Ref: ライブラリ<86>-Footnote-14600769
Node: Core and Builtins<83>4600824
Ref: whatsnew/changelog id4084600959
Ref: 1ba44600959
Ref: Core and Builtins<83>-Footnote-14601155
Node: ライブラリ<87>4601210
Ref: whatsnew/changelog id4094601347
Ref: 1ba54601347
Ref: ライブラリ<87>-Footnote-14601801
Ref: ライブラリ<87>-Footnote-24601856
Node: Core and Builtins<84>4601911
Ref: whatsnew/changelog id4104602046
Ref: 1ba64602046
Ref: Core and Builtins<84>-Footnote-14607526
Ref: Core and Builtins<84>-Footnote-24607581
Ref: Core and Builtins<84>-Footnote-34607636
Ref: Core and Builtins<84>-Footnote-44607691
Ref: Core and Builtins<84>-Footnote-54607746
Ref: Core and Builtins<84>-Footnote-64607801
Ref: Core and Builtins<84>-Footnote-74607856
Ref: Core and Builtins<84>-Footnote-84607911
Ref: Core and Builtins<84>-Footnote-94607966
Ref: Core and Builtins<84>-Footnote-104608021
Ref: Core and Builtins<84>-Footnote-114608077
Ref: Core and Builtins<84>-Footnote-124608133
Ref: Core and Builtins<84>-Footnote-134608176
Ref: Core and Builtins<84>-Footnote-144608232
Ref: Core and Builtins<84>-Footnote-154608288
Ref: Core and Builtins<84>-Footnote-164608344
Ref: Core and Builtins<84>-Footnote-174608400
Ref: Core and Builtins<84>-Footnote-184608456
Ref: Core and Builtins<84>-Footnote-194608512
Ref: Core and Builtins<84>-Footnote-204608568
Ref: Core and Builtins<84>-Footnote-214608624
Ref: Core and Builtins<84>-Footnote-224608680
Ref: Core and Builtins<84>-Footnote-234608736
Ref: Core and Builtins<84>-Footnote-244608792
Ref: Core and Builtins<84>-Footnote-254608848
Ref: Core and Builtins<84>-Footnote-264608904
Ref: Core and Builtins<84>-Footnote-274608960
Ref: Core and Builtins<84>-Footnote-284609016
Ref: Core and Builtins<84>-Footnote-294609072
Ref: Core and Builtins<84>-Footnote-304609128
Ref: Core and Builtins<84>-Footnote-314609184
Ref: Core and Builtins<84>-Footnote-324609240
Ref: Core and Builtins<84>-Footnote-334609296
Ref: Core and Builtins<84>-Footnote-344609352
Node: ライブラリ<88>4609408
Ref: whatsnew/changelog id4114609545
Ref: 1ba74609545
Ref: ライブラリ<88>-Footnote-14609991
Node: Core and Builtins<85>4610046
Ref: whatsnew/changelog id4124610181
Ref: 1ba84610181
Ref: Core and Builtins<85>-Footnote-14615427
Ref: Core and Builtins<85>-Footnote-24615482
Ref: Core and Builtins<85>-Footnote-34615537
Ref: Core and Builtins<85>-Footnote-44615592
Ref: Core and Builtins<85>-Footnote-54615647
Ref: Core and Builtins<85>-Footnote-64615702
Ref: Core and Builtins<85>-Footnote-74615757
Ref: Core and Builtins<85>-Footnote-84615812
Ref: Core and Builtins<85>-Footnote-94615867
Ref: Core and Builtins<85>-Footnote-104615922
Ref: Core and Builtins<85>-Footnote-114615978
Ref: Core and Builtins<85>-Footnote-124616034
Ref: Core and Builtins<85>-Footnote-134616090
Ref: Core and Builtins<85>-Footnote-144616146
Ref: Core and Builtins<85>-Footnote-154616202
Ref: Core and Builtins<85>-Footnote-164616258
Ref: Core and Builtins<85>-Footnote-174616314
Ref: Core and Builtins<85>-Footnote-184616370
Ref: Core and Builtins<85>-Footnote-194616426
Ref: Core and Builtins<85>-Footnote-204616486
Ref: Core and Builtins<85>-Footnote-214616542
Ref: Core and Builtins<85>-Footnote-224616598
Ref: Core and Builtins<85>-Footnote-234616654
Ref: Core and Builtins<85>-Footnote-244616710
Ref: Core and Builtins<85>-Footnote-254616766
Ref: Core and Builtins<85>-Footnote-264616822
Ref: Core and Builtins<85>-Footnote-274616878
Ref: Core and Builtins<85>-Footnote-284616934
Ref: Core and Builtins<85>-Footnote-294616990
Ref: Core and Builtins<85>-Footnote-304617046
Ref: Core and Builtins<85>-Footnote-314617102
Ref: Core and Builtins<85>-Footnote-324617158
Node: ライブラリ<89>4617214
Ref: whatsnew/changelog id4134617351
Ref: 1ba94617351
Ref: ライブラリ<89>-Footnote-14617523
Node: Core and Builtins<86>4617578
Ref: whatsnew/changelog id4144617713
Ref: 1baa4617713
Ref: Core and Builtins<86>-Footnote-14618167
Ref: Core and Builtins<86>-Footnote-24618222
Node: ライブラリ<90>4618277
Ref: whatsnew/changelog id4154618414
Ref: 1bab4618414
Ref: ライブラリ<90>-Footnote-14618578
Node: Core and Builtins<87>4618633
Ref: whatsnew/changelog id4164618768
Ref: 1bac4618768
Ref: Core and Builtins<87>-Footnote-14619632
Ref: Core and Builtins<87>-Footnote-24619687
Ref: Core and Builtins<87>-Footnote-34619742
Ref: Core and Builtins<87>-Footnote-44619797
Ref: Core and Builtins<87>-Footnote-54619862
Ref: Core and Builtins<87>-Footnote-64619927
Node: ライブラリ<91>4619992
Ref: whatsnew/changelog id4174620130
Ref: 1bad4620130
Ref: ライブラリ<91>-Footnote-14663334
Ref: ライブラリ<91>-Footnote-24663389
Ref: ライブラリ<91>-Footnote-34663444
Ref: ライブラリ<91>-Footnote-44663499
Ref: ライブラリ<91>-Footnote-54663554
Ref: ライブラリ<91>-Footnote-64663609
Ref: ライブラリ<91>-Footnote-74663664
Ref: ライブラリ<91>-Footnote-84663719
Ref: ライブラリ<91>-Footnote-94663774
Ref: ライブラリ<91>-Footnote-104663829
Ref: ライブラリ<91>-Footnote-114663885
Ref: ライブラリ<91>-Footnote-124663941
Ref: ライブラリ<91>-Footnote-134663997
Ref: ライブラリ<91>-Footnote-144664053
Ref: ライブラリ<91>-Footnote-154664109
Ref: ライブラリ<91>-Footnote-164664165
Ref: ライブラリ<91>-Footnote-174664221
Ref: ライブラリ<91>-Footnote-184664277
Ref: ライブラリ<91>-Footnote-194664333
Ref: ライブラリ<91>-Footnote-204664393
Ref: ライブラリ<91>-Footnote-214664449
Ref: ライブラリ<91>-Footnote-224664505
Ref: ライブラリ<91>-Footnote-234664561
Ref: ライブラリ<91>-Footnote-244664617
Ref: ライブラリ<91>-Footnote-254664673
Ref: ライブラリ<91>-Footnote-264664729
Ref: ライブラリ<91>-Footnote-274664785
Ref: ライブラリ<91>-Footnote-284664841
Ref: ライブラリ<91>-Footnote-294664897
Ref: ライブラリ<91>-Footnote-304664953
Ref: ライブラリ<91>-Footnote-314665009
Ref: ライブラリ<91>-Footnote-324665065
Ref: ライブラリ<91>-Footnote-334665121
Ref: ライブラリ<91>-Footnote-344665177
Ref: ライブラリ<91>-Footnote-354665233
Ref: ライブラリ<91>-Footnote-364665289
Ref: ライブラリ<91>-Footnote-374665345
Ref: ライブラリ<91>-Footnote-384665401
Ref: ライブラリ<91>-Footnote-394665457
Ref: ライブラリ<91>-Footnote-404665513
Ref: ライブラリ<91>-Footnote-414665569
Ref: ライブラリ<91>-Footnote-424665625
Ref: ライブラリ<91>-Footnote-434665681
Ref: ライブラリ<91>-Footnote-444665737
Ref: ライブラリ<91>-Footnote-454665793
Ref: ライブラリ<91>-Footnote-464665849
Ref: ライブラリ<91>-Footnote-474665905
Ref: ライブラリ<91>-Footnote-484665961
Ref: ライブラリ<91>-Footnote-494666017
Ref: ライブラリ<91>-Footnote-504666073
Ref: ライブラリ<91>-Footnote-514666129
Ref: ライブラリ<91>-Footnote-524666185
Ref: ライブラリ<91>-Footnote-534666241
Ref: ライブラリ<91>-Footnote-544666297
Ref: ライブラリ<91>-Footnote-554666353
Ref: ライブラリ<91>-Footnote-564666409
Ref: ライブラリ<91>-Footnote-574666465
Ref: ライブラリ<91>-Footnote-584666521
Ref: ライブラリ<91>-Footnote-594666577
Ref: ライブラリ<91>-Footnote-604666633
Ref: ライブラリ<91>-Footnote-614666689
Ref: ライブラリ<91>-Footnote-624666745
Ref: ライブラリ<91>-Footnote-634666801
Ref: ライブラリ<91>-Footnote-644666857
Ref: ライブラリ<91>-Footnote-654666913
Ref: ライブラリ<91>-Footnote-664666969
Ref: ライブラリ<91>-Footnote-674667025
Ref: ライブラリ<91>-Footnote-684667091
Ref: ライブラリ<91>-Footnote-694667147
Ref: ライブラリ<91>-Footnote-704667203
Ref: ライブラリ<91>-Footnote-714667259
Ref: ライブラリ<91>-Footnote-724667315
Ref: ライブラリ<91>-Footnote-734667371
Ref: ライブラリ<91>-Footnote-744667427
Ref: ライブラリ<91>-Footnote-754667483
Ref: ライブラリ<91>-Footnote-764667539
Ref: ライブラリ<91>-Footnote-774667595
Ref: ライブラリ<91>-Footnote-784667651
Ref: ライブラリ<91>-Footnote-794667707
Ref: ライブラリ<91>-Footnote-804667763
Ref: ライブラリ<91>-Footnote-814667819
Ref: ライブラリ<91>-Footnote-824667875
Ref: ライブラリ<91>-Footnote-834667931
Ref: ライブラリ<91>-Footnote-844667987
Ref: ライブラリ<91>-Footnote-854668043
Ref: ライブラリ<91>-Footnote-864668099
Ref: ライブラリ<91>-Footnote-874668155
Ref: ライブラリ<91>-Footnote-884668211
Ref: ライブラリ<91>-Footnote-894668267
Ref: ライブラリ<91>-Footnote-904668323
Ref: ライブラリ<91>-Footnote-914668379
Ref: ライブラリ<91>-Footnote-924668435
Ref: ライブラリ<91>-Footnote-934668491
Ref: ライブラリ<91>-Footnote-944668547
Ref: ライブラリ<91>-Footnote-954668603
Ref: ライブラリ<91>-Footnote-964668659
Ref: ライブラリ<91>-Footnote-974668715
Ref: ライブラリ<91>-Footnote-984668771
Ref: ライブラリ<91>-Footnote-994668827
Ref: ライブラリ<91>-Footnote-1004668883
Ref: ライブラリ<91>-Footnote-1014668940
Ref: ライブラリ<91>-Footnote-1024668997
Ref: ライブラリ<91>-Footnote-1034669054
Ref: ライブラリ<91>-Footnote-1044669111
Ref: ライブラリ<91>-Footnote-1054669168
Ref: ライブラリ<91>-Footnote-1064669225
Ref: ライブラリ<91>-Footnote-1074669282
Ref: ライブラリ<91>-Footnote-1084669339
Ref: ライブラリ<91>-Footnote-1094669396
Ref: ライブラリ<91>-Footnote-1104669453
Ref: ライブラリ<91>-Footnote-1114669510
Ref: ライブラリ<91>-Footnote-1124669567
Ref: ライブラリ<91>-Footnote-1134669624
Ref: ライブラリ<91>-Footnote-1144669681
Ref: ライブラリ<91>-Footnote-1154669738
Ref: ライブラリ<91>-Footnote-1164669795
Ref: ライブラリ<91>-Footnote-1174669852
Ref: ライブラリ<91>-Footnote-1184669909
Ref: ライブラリ<91>-Footnote-1194669966
Ref: ライブラリ<91>-Footnote-1204670023
Ref: ライブラリ<91>-Footnote-1214670080
Ref: ライブラリ<91>-Footnote-1224670137
Ref: ライブラリ<91>-Footnote-1234670194
Ref: ライブラリ<91>-Footnote-1244670238
Ref: ライブラリ<91>-Footnote-1254670295
Ref: ライブラリ<91>-Footnote-1264670352
Ref: ライブラリ<91>-Footnote-1274670409
Ref: ライブラリ<91>-Footnote-1284670466
Ref: ライブラリ<91>-Footnote-1294670523
Ref: ライブラリ<91>-Footnote-1304670580
Ref: ライブラリ<91>-Footnote-1314670637
Ref: ライブラリ<91>-Footnote-1324670694
Ref: ライブラリ<91>-Footnote-1334670751
Ref: ライブラリ<91>-Footnote-1344670808
Ref: ライブラリ<91>-Footnote-1354670865
Ref: ライブラリ<91>-Footnote-1364670922
Ref: ライブラリ<91>-Footnote-1374670979
Ref: ライブラリ<91>-Footnote-1384671036
Ref: ライブラリ<91>-Footnote-1394671093
Ref: ライブラリ<91>-Footnote-1404671151
Ref: ライブラリ<91>-Footnote-1414671208
Ref: ライブラリ<91>-Footnote-1424671265
Ref: ライブラリ<91>-Footnote-1434671309
Ref: ライブラリ<91>-Footnote-1444671366
Ref: ライブラリ<91>-Footnote-1454671423
Ref: ライブラリ<91>-Footnote-1464671480
Ref: ライブラリ<91>-Footnote-1474671537
Ref: ライブラリ<91>-Footnote-1484671594
Ref: ライブラリ<91>-Footnote-1494671651
Ref: ライブラリ<91>-Footnote-1504671708
Ref: ライブラリ<91>-Footnote-1514671765
Ref: ライブラリ<91>-Footnote-1524671822
Ref: ライブラリ<91>-Footnote-1534671879
Ref: ライブラリ<91>-Footnote-1544671936
Ref: ライブラリ<91>-Footnote-1554671993
Ref: ライブラリ<91>-Footnote-1564672050
Ref: ライブラリ<91>-Footnote-1574672107
Ref: ライブラリ<91>-Footnote-1584672164
Ref: ライブラリ<91>-Footnote-1594672221
Ref: ライブラリ<91>-Footnote-1604672278
Ref: ライブラリ<91>-Footnote-1614672335
Ref: ライブラリ<91>-Footnote-1624672392
Ref: ライブラリ<91>-Footnote-1634672436
Ref: ライブラリ<91>-Footnote-1644672493
Ref: ライブラリ<91>-Footnote-1654672550
Ref: ライブラリ<91>-Footnote-1664672607
Ref: ライブラリ<91>-Footnote-1674672664
Ref: ライブラリ<91>-Footnote-1684672721
Ref: ライブラリ<91>-Footnote-1694672778
Ref: ライブラリ<91>-Footnote-1704672835
Ref: ライブラリ<91>-Footnote-1714672892
Ref: ライブラリ<91>-Footnote-1724672949
Ref: ライブラリ<91>-Footnote-1734673006
Ref: ライブラリ<91>-Footnote-1744673063
Ref: ライブラリ<91>-Footnote-1754673120
Ref: ライブラリ<91>-Footnote-1764673177
Ref: ライブラリ<91>-Footnote-1774673234
Ref: ライブラリ<91>-Footnote-1784673291
Ref: ライブラリ<91>-Footnote-1794673348
Ref: ライブラリ<91>-Footnote-1804673405
Ref: ライブラリ<91>-Footnote-1814673462
Ref: ライブラリ<91>-Footnote-1824673506
Ref: ライブラリ<91>-Footnote-1834673563
Ref: ライブラリ<91>-Footnote-1844673620
Ref: ライブラリ<91>-Footnote-1854673677
Ref: ライブラリ<91>-Footnote-1864673734
Ref: ライブラリ<91>-Footnote-1874673791
Ref: ライブラリ<91>-Footnote-1884673848
Ref: ライブラリ<91>-Footnote-1894673905
Ref: ライブラリ<91>-Footnote-1904673962
Ref: ライブラリ<91>-Footnote-1914674019
Ref: ライブラリ<91>-Footnote-1924674076
Ref: ライブラリ<91>-Footnote-1934674133
Ref: ライブラリ<91>-Footnote-1944674190
Ref: ライブラリ<91>-Footnote-1954674247
Ref: ライブラリ<91>-Footnote-1964674304
Ref: ライブラリ<91>-Footnote-1974674361
Ref: ライブラリ<91>-Footnote-1984674418
Ref: ライブラリ<91>-Footnote-1994674475
Ref: ライブラリ<91>-Footnote-2004674532
Ref: ライブラリ<91>-Footnote-2014674589
Ref: ライブラリ<91>-Footnote-2024674646
Ref: ライブラリ<91>-Footnote-2034674703
Ref: ライブラリ<91>-Footnote-2044674760
Ref: ライブラリ<91>-Footnote-2054674817
Ref: ライブラリ<91>-Footnote-2064674874
Ref: ライブラリ<91>-Footnote-2074674931
Ref: ライブラリ<91>-Footnote-2084674988
Ref: ライブラリ<91>-Footnote-2094675045
Ref: ライブラリ<91>-Footnote-2104675102
Ref: ライブラリ<91>-Footnote-2114675159
Ref: ライブラリ<91>-Footnote-2124675216
Ref: ライブラリ<91>-Footnote-2134675273
Ref: ライブラリ<91>-Footnote-2144675330
Ref: ライブラリ<91>-Footnote-2154675387
Ref: ライブラリ<91>-Footnote-2164675444
Ref: ライブラリ<91>-Footnote-2174675501
Ref: ライブラリ<91>-Footnote-2184675558
Ref: ライブラリ<91>-Footnote-2194675615
Ref: ライブラリ<91>-Footnote-2204675672
Ref: ライブラリ<91>-Footnote-2214675729
Ref: ライブラリ<91>-Footnote-2224675786
Ref: ライブラリ<91>-Footnote-2234675843
Ref: ライブラリ<91>-Footnote-2244675900
Ref: ライブラリ<91>-Footnote-2254675957
Ref: ライブラリ<91>-Footnote-2264676014
Ref: ライブラリ<91>-Footnote-2274676081
Ref: ライブラリ<91>-Footnote-2284676148
Ref: ライブラリ<91>-Footnote-2294676215
Ref: ライブラリ<91>-Footnote-2304676272
Ref: ライブラリ<91>-Footnote-2314676339
Ref: ライブラリ<91>-Footnote-2324676406
Ref: ライブラリ<91>-Footnote-2334676473
Ref: ライブラリ<91>-Footnote-2344676540
Ref: ライブラリ<91>-Footnote-2354676607
Ref: ライブラリ<91>-Footnote-2364676674
Ref: ライブラリ<91>-Footnote-2374676741
Ref: ライブラリ<91>-Footnote-2384676808
Ref: ライブラリ<91>-Footnote-2394676875
Ref: ライブラリ<91>-Footnote-2404676942
Ref: ライブラリ<91>-Footnote-2414677009
Ref: ライブラリ<91>-Footnote-2424677076
Ref: ライブラリ<91>-Footnote-2434677143
Ref: ライブラリ<91>-Footnote-2444677210
Ref: ライブラリ<91>-Footnote-2454677277
Ref: ライブラリ<91>-Footnote-2464677344
Ref: ライブラリ<91>-Footnote-2474677411
Ref: ライブラリ<91>-Footnote-2484677478
Ref: ライブラリ<91>-Footnote-2494677545
Ref: ライブラリ<91>-Footnote-2504677612
Ref: ライブラリ<91>-Footnote-2514677679
Ref: ライブラリ<91>-Footnote-2524677746
Ref: ライブラリ<91>-Footnote-2534677813
Ref: ライブラリ<91>-Footnote-2544677880
Node: ドキュメント<31>4677947
Ref: whatsnew/changelog id4184678077
Ref: 1bc84678077
Ref: ドキュメント<31>-Footnote-14681840
Ref: ドキュメント<31>-Footnote-24681895
Ref: ドキュメント<31>-Footnote-34681950
Ref: ドキュメント<31>-Footnote-44681996
Ref: ドキュメント<31>-Footnote-54682051
Ref: ドキュメント<31>-Footnote-64682106
Ref: ドキュメント<31>-Footnote-74682161
Ref: ドキュメント<31>-Footnote-84682216
Ref: ドキュメント<31>-Footnote-94682271
Ref: ドキュメント<31>-Footnote-104682326
Ref: ドキュメント<31>-Footnote-114682382
Ref: ドキュメント<31>-Footnote-124682438
Ref: ドキュメント<31>-Footnote-134682494
Ref: ドキュメント<31>-Footnote-144682550
Ref: ドキュメント<31>-Footnote-154682593
Ref: ドキュメント<31>-Footnote-164682649
Ref: ドキュメント<31>-Footnote-174682705
Ref: ドキュメント<31>-Footnote-184682761
Ref: ドキュメント<31>-Footnote-194682817
Ref: ドキュメント<31>-Footnote-204682873
Ref: ドキュメント<31>-Footnote-214682929
Ref: ドキュメント<31>-Footnote-224682985
Ref: ドキュメント<31>-Footnote-234683041
Ref: ドキュメント<31>-Footnote-244683107
Ref: ドキュメント<31>-Footnote-254683173
Ref: ドキュメント<31>-Footnote-264683239
Ref: ドキュメント<31>-Footnote-274683305
Node: テスト<31>4683371
Ref: whatsnew/changelog id4194683495
Ref: 1bcf4683495
Ref: テスト<31>-Footnote-14688876
Ref: テスト<31>-Footnote-24688931
Ref: テスト<31>-Footnote-34688986
Ref: テスト<31>-Footnote-44689041
Ref: テスト<31>-Footnote-54689096
Ref: テスト<31>-Footnote-64689183
Ref: テスト<31>-Footnote-74689238
Ref: テスト<31>-Footnote-84689293
Ref: テスト<31>-Footnote-94689348
Ref: テスト<31>-Footnote-104689403
Ref: テスト<31>-Footnote-114689459
Ref: テスト<31>-Footnote-124689515
Ref: テスト<31>-Footnote-134689571
Ref: テスト<31>-Footnote-144689627
Ref: テスト<31>-Footnote-154689683
Ref: テスト<31>-Footnote-164689739
Ref: テスト<31>-Footnote-174689795
Ref: テスト<31>-Footnote-184689851
Ref: テスト<31>-Footnote-194689907
Ref: テスト<31>-Footnote-204689963
Ref: テスト<31>-Footnote-214690019
Ref: テスト<31>-Footnote-224690075
Ref: テスト<31>-Footnote-234690131
Ref: テスト<31>-Footnote-244690187
Ref: テスト<31>-Footnote-254690243
Ref: テスト<31>-Footnote-264690299
Ref: テスト<31>-Footnote-274690355
Ref: テスト<31>-Footnote-284690411
Ref: テスト<31>-Footnote-294690467
Ref: テスト<31>-Footnote-304690523
Ref: テスト<31>-Footnote-314690579
Ref: テスト<31>-Footnote-324690635
Ref: テスト<31>-Footnote-334690691
Ref: テスト<31>-Footnote-344690747
Ref: テスト<31>-Footnote-354690803
Ref: テスト<31>-Footnote-364690859
Node: ビルド<36>4690925
Ref: whatsnew/changelog id4204691038
Ref: 1bd34691038
Ref: ビルド<36>-Footnote-14696524
Ref: ビルド<36>-Footnote-24696579
Ref: ビルド<36>-Footnote-34696634
Ref: ビルド<36>-Footnote-44696689
Ref: ビルド<36>-Footnote-54696744
Ref: ビルド<36>-Footnote-64696799
Ref: ビルド<36>-Footnote-74696854
Ref: ビルド<36>-Footnote-84696909
Ref: ビルド<36>-Footnote-94696964
Ref: ビルド<36>-Footnote-104697019
Ref: ビルド<36>-Footnote-114697075
Ref: ビルド<36>-Footnote-124697131
Ref: ビルド<36>-Footnote-134697187
Ref: ビルド<36>-Footnote-144697243
Ref: ビルド<36>-Footnote-154697299
Ref: ビルド<36>-Footnote-164697355
Ref: ビルド<36>-Footnote-174697398
Ref: ビルド<36>-Footnote-184697454
Ref: ビルド<36>-Footnote-194697510
Ref: ビルド<36>-Footnote-204697566
Ref: ビルド<36>-Footnote-214697622
Ref: ビルド<36>-Footnote-224697678
Ref: ビルド<36>-Footnote-234697734
Ref: ビルド<36>-Footnote-244697790
Ref: ビルド<36>-Footnote-254697846
Ref: ビルド<36>-Footnote-264697902
Ref: ビルド<36>-Footnote-274697958
Ref: ビルド<36>-Footnote-284698014
Ref: ビルド<36>-Footnote-294698070
Ref: ビルド<36>-Footnote-304698126
Ref: ビルド<36>-Footnote-314698182
Ref: ビルド<36>-Footnote-324698225
Ref: ビルド<36>-Footnote-334698281
Ref: ビルド<36>-Footnote-344698337
Ref: ビルド<36>-Footnote-354698393
Ref: ビルド<36>-Footnote-364698449
Node: Windows<31>4698515
Ref: whatsnew/changelog id4214698624
Ref: 1bd44698624
Ref: Windows<31>-Footnote-14703027
Ref: Windows<31>-Footnote-24703082
Ref: Windows<31>-Footnote-34703137
Ref: Windows<31>-Footnote-44703192
Ref: Windows<31>-Footnote-54703247
Ref: Windows<31>-Footnote-64703302
Ref: Windows<31>-Footnote-74703357
Ref: Windows<31>-Footnote-84703412
Ref: Windows<31>-Footnote-94703467
Ref: Windows<31>-Footnote-104703522
Ref: Windows<31>-Footnote-114703578
Ref: Windows<31>-Footnote-124703634
Ref: Windows<31>-Footnote-134703690
Ref: Windows<31>-Footnote-144703746
Ref: Windows<31>-Footnote-154703802
Ref: Windows<31>-Footnote-164703858
Ref: Windows<31>-Footnote-174703914
Ref: Windows<31>-Footnote-184703970
Ref: Windows<31>-Footnote-194704026
Ref: Windows<31>-Footnote-204704082
Ref: Windows<31>-Footnote-214704138
Ref: Windows<31>-Footnote-224704194
Ref: Windows<31>-Footnote-234704250
Ref: Windows<31>-Footnote-244704306
Ref: Windows<31>-Footnote-254704362
Ref: Windows<31>-Footnote-264704418
Ref: Windows<31>-Footnote-274704484
Ref: Windows<31>-Footnote-284704540
Ref: Windows<31>-Footnote-294704606
Node: macOS<23>4704672
Ref: whatsnew/changelog id4224704776
Ref: 1bd64704776
Ref: macOS<23>-Footnote-14705324
Node: IDLE<16>4705379
Ref: whatsnew/changelog id4234705487
Ref: 1bd74705487
Ref: IDLE<16>-Footnote-14706400
Ref: IDLE<16>-Footnote-24706455
Ref: IDLE<16>-Footnote-34706510
Ref: IDLE<16>-Footnote-44706565
Ref: IDLE<16>-Footnote-54706620
Ref: IDLE<16>-Footnote-64706675
Ref: IDLE<16>-Footnote-74706730
Node: Tools/Demos<24>4706785
Ref: whatsnew/changelog id4244706893
Ref: 1bd84706893
Ref: Tools/Demos<24>-Footnote-14708404
Ref: Tools/Demos<24>-Footnote-24708459
Ref: Tools/Demos<24>-Footnote-34708514
Ref: Tools/Demos<24>-Footnote-44708562
Ref: Tools/Demos<24>-Footnote-54708617
Ref: Tools/Demos<24>-Footnote-64708665
Ref: Tools/Demos<24>-Footnote-74708720
Ref: Tools/Demos<24>-Footnote-84708775
Ref: Tools/Demos<24>-Footnote-94708830
Ref: Tools/Demos<24>-Footnote-104708885
Ref: Tools/Demos<24>-Footnote-114708941
Ref: Tools/Demos<24>-Footnote-124708997
Node: C API<32>4709053
Ref: whatsnew/changelog id4264709144
Ref: 1bd94709144
Ref: C API<32>-Footnote-14716670
Ref: C API<32>-Footnote-24716725
Ref: C API<32>-Footnote-34716780
Ref: C API<32>-Footnote-44716835
Ref: C API<32>-Footnote-54716890
Ref: C API<32>-Footnote-64716945
Ref: C API<32>-Footnote-74717000
Ref: C API<32>-Footnote-84717055
Ref: C API<32>-Footnote-94717110
Ref: C API<32>-Footnote-104717165
Ref: C API<32>-Footnote-114717221
Ref: C API<32>-Footnote-124717277
Ref: C API<32>-Footnote-134717333
Ref: C API<32>-Footnote-144717389
Ref: C API<32>-Footnote-154717445
Ref: C API<32>-Footnote-164717501
Ref: C API<32>-Footnote-174717557
Ref: C API<32>-Footnote-184717613
Ref: C API<32>-Footnote-194717669
Ref: C API<32>-Footnote-204717725
Ref: C API<32>-Footnote-214717781
Ref: C API<32>-Footnote-224717837
Ref: C API<32>-Footnote-234717893
Ref: C API<32>-Footnote-244717949
Ref: C API<32>-Footnote-254718005
Ref: C API<32>-Footnote-264718061
Ref: C API<32>-Footnote-274718117
Ref: C API<32>-Footnote-284718173
Ref: C API<32>-Footnote-294718229
Ref: C API<32>-Footnote-304718285
Ref: C API<32>-Footnote-314718341
Ref: C API<32>-Footnote-324718397
Ref: C API<32>-Footnote-334718453
Ref: C API<32>-Footnote-344718509
Node: Python 3 11 0 beta 14718575
Ref: whatsnew/changelog python-3-11-0-beta-14718704
Ref: 1bdb4718704
Node: セキュリティ<33>4719285
Ref: whatsnew/changelog id4274719394
Ref: 1bdc4719394
Ref: セキュリティ<33>-Footnote-14719707
Node: Core and Builtins<88>4719762
Ref: whatsnew/changelog id4284719899
Ref: 1bdd4719899
Ref: Core and Builtins<88>-Footnote-14726542
Ref: Core and Builtins<88>-Footnote-24726597
Ref: Core and Builtins<88>-Footnote-34726662
Ref: Core and Builtins<88>-Footnote-44726717
Ref: Core and Builtins<88>-Footnote-54726782
Ref: Core and Builtins<88>-Footnote-64726837
Ref: Core and Builtins<88>-Footnote-74726892
Ref: Core and Builtins<88>-Footnote-84726947
Ref: Core and Builtins<88>-Footnote-94727002
Ref: Core and Builtins<88>-Footnote-104727057
Ref: Core and Builtins<88>-Footnote-114727113
Ref: Core and Builtins<88>-Footnote-124727169
Ref: Core and Builtins<88>-Footnote-134727225
Ref: Core and Builtins<88>-Footnote-144727281
Ref: Core and Builtins<88>-Footnote-154727324
Ref: Core and Builtins<88>-Footnote-164727380
Ref: Core and Builtins<88>-Footnote-174727436
Ref: Core and Builtins<88>-Footnote-184727492
Ref: Core and Builtins<88>-Footnote-194727548
Ref: Core and Builtins<88>-Footnote-204727604
Ref: Core and Builtins<88>-Footnote-214727660
Ref: Core and Builtins<88>-Footnote-224727726
Ref: Core and Builtins<88>-Footnote-234727782
Ref: Core and Builtins<88>-Footnote-244727838
Ref: Core and Builtins<88>-Footnote-254727894
Ref: Core and Builtins<88>-Footnote-264727950
Ref: Core and Builtins<88>-Footnote-274728006
Ref: Core and Builtins<88>-Footnote-284728062
Ref: Core and Builtins<88>-Footnote-294728118
Ref: Core and Builtins<88>-Footnote-304728174
Ref: Core and Builtins<88>-Footnote-314728230
Ref: Core and Builtins<88>-Footnote-324728286
Ref: Core and Builtins<88>-Footnote-334728329
Ref: Core and Builtins<88>-Footnote-344728385
Ref: Core and Builtins<88>-Footnote-354728441
Ref: Core and Builtins<88>-Footnote-364728497
Ref: Core and Builtins<88>-Footnote-374728563
Ref: Core and Builtins<88>-Footnote-384728619
Ref: Core and Builtins<88>-Footnote-394728675
Ref: Core and Builtins<88>-Footnote-404728741
Node: ライブラリ<92>4728807
Ref: whatsnew/changelog id4294728943
Ref: 1be04728943
Ref: ライブラリ<92>-Footnote-14729421
Node: Core and Builtins<89>4729486
Ref: whatsnew/changelog id4304729614
Ref: 1be14729614
Ref: Core and Builtins<89>-Footnote-14731389
Ref: Core and Builtins<89>-Footnote-24731454
Ref: Core and Builtins<89>-Footnote-34731519
Ref: Core and Builtins<89>-Footnote-44731584
Ref: Core and Builtins<89>-Footnote-54731649
Ref: Core and Builtins<89>-Footnote-64731714
Ref: Core and Builtins<89>-Footnote-74731779
Ref: Core and Builtins<89>-Footnote-84731844
Ref: Core and Builtins<89>-Footnote-94731909
Node: ビルド<37>4731974
Ref: whatsnew/changelog id4314732104
Ref: 1be44732104
Ref: ビルド<37>-Footnote-14732236
Node: Core and Builtins<90>4732301
Ref: whatsnew/changelog id4324732429
Ref: 1be54732429
Ref: Core and Builtins<90>-Footnote-14733253
Ref: Core and Builtins<90>-Footnote-24733318
Ref: Core and Builtins<90>-Footnote-34733383
Node: ライブラリ<93>4733448
Ref: whatsnew/changelog id4334733585
Ref: 1be64733585
Ref: ライブラリ<93>-Footnote-14751123
Ref: ライブラリ<93>-Footnote-24751178
Ref: ライブラリ<93>-Footnote-34751233
Ref: ライブラリ<93>-Footnote-44751288
Ref: ライブラリ<93>-Footnote-54751343
Ref: ライブラリ<93>-Footnote-64751398
Ref: ライブラリ<93>-Footnote-74751453
Ref: ライブラリ<93>-Footnote-84751508
Ref: ライブラリ<93>-Footnote-94751563
Ref: ライブラリ<93>-Footnote-104751618
Ref: ライブラリ<93>-Footnote-114751674
Ref: ライブラリ<93>-Footnote-124751730
Ref: ライブラリ<93>-Footnote-134751786
Ref: ライブラリ<93>-Footnote-144751842
Ref: ライブラリ<93>-Footnote-154751898
Ref: ライブラリ<93>-Footnote-164751954
Ref: ライブラリ<93>-Footnote-174752010
Ref: ライブラリ<93>-Footnote-184752066
Ref: ライブラリ<93>-Footnote-194752122
Ref: ライブラリ<93>-Footnote-204752178
Ref: ライブラリ<93>-Footnote-214752234
Ref: ライブラリ<93>-Footnote-224752290
Ref: ライブラリ<93>-Footnote-234752346
Ref: ライブラリ<93>-Footnote-244752402
Ref: ライブラリ<93>-Footnote-254752468
Ref: ライブラリ<93>-Footnote-264752524
Ref: ライブラリ<93>-Footnote-274752580
Ref: ライブラリ<93>-Footnote-284752623
Ref: ライブラリ<93>-Footnote-294752679
Ref: ライブラリ<93>-Footnote-304752735
Ref: ライブラリ<93>-Footnote-314752791
Ref: ライブラリ<93>-Footnote-324752847
Ref: ライブラリ<93>-Footnote-334752890
Ref: ライブラリ<93>-Footnote-344752946
Ref: ライブラリ<93>-Footnote-354753002
Ref: ライブラリ<93>-Footnote-364753058
Ref: ライブラリ<93>-Footnote-374753114
Ref: ライブラリ<93>-Footnote-384753170
Ref: ライブラリ<93>-Footnote-394753226
Ref: ライブラリ<93>-Footnote-404753282
Ref: ライブラリ<93>-Footnote-414753338
Ref: ライブラリ<93>-Footnote-424753394
Ref: ライブラリ<93>-Footnote-434753450
Ref: ライブラリ<93>-Footnote-444753506
Ref: ライブラリ<93>-Footnote-454753562
Ref: ライブラリ<93>-Footnote-464753618
Ref: ライブラリ<93>-Footnote-474753674
Ref: ライブラリ<93>-Footnote-484753730
Ref: ライブラリ<93>-Footnote-494753786
Ref: ライブラリ<93>-Footnote-504753842
Ref: ライブラリ<93>-Footnote-514753898
Ref: ライブラリ<93>-Footnote-524753954
Ref: ライブラリ<93>-Footnote-534754010
Ref: ライブラリ<93>-Footnote-544754066
Ref: ライブラリ<93>-Footnote-554754122
Ref: ライブラリ<93>-Footnote-564754178
Ref: ライブラリ<93>-Footnote-574754244
Ref: ライブラリ<93>-Footnote-584754300
Ref: ライブラリ<93>-Footnote-594754356
Ref: ライブラリ<93>-Footnote-604754412
Ref: ライブラリ<93>-Footnote-614754468
Ref: ライブラリ<93>-Footnote-624754524
Ref: ライブラリ<93>-Footnote-634754580
Ref: ライブラリ<93>-Footnote-644754636
Ref: ライブラリ<93>-Footnote-654754692
Ref: ライブラリ<93>-Footnote-664754748
Ref: ライブラリ<93>-Footnote-674754791
Ref: ライブラリ<93>-Footnote-684754847
Ref: ライブラリ<93>-Footnote-694754903
Ref: ライブラリ<93>-Footnote-704754959
Ref: ライブラリ<93>-Footnote-714755015
Ref: ライブラリ<93>-Footnote-724755071
Ref: ライブラリ<93>-Footnote-734755127
Ref: ライブラリ<93>-Footnote-744755183
Ref: ライブラリ<93>-Footnote-754755239
Ref: ライブラリ<93>-Footnote-764755305
Ref: ライブラリ<93>-Footnote-774755361
Ref: ライブラリ<93>-Footnote-784755417
Ref: ライブラリ<93>-Footnote-794755473
Ref: ライブラリ<93>-Footnote-804755539
Ref: ライブラリ<93>-Footnote-814755605
Ref: ライブラリ<93>-Footnote-824755648
Ref: ライブラリ<93>-Footnote-834755714
Ref: ライブラリ<93>-Footnote-844755780
Ref: ライブラリ<93>-Footnote-854755846
Ref: ライブラリ<93>-Footnote-864755912
Ref: ライブラリ<93>-Footnote-874755978
Ref: ライブラリ<93>-Footnote-884756044
Ref: ライブラリ<93>-Footnote-894756110
Ref: ライブラリ<93>-Footnote-904756176
Ref: ライブラリ<93>-Footnote-914756242
Ref: ライブラリ<93>-Footnote-924756308
Ref: ライブラリ<93>-Footnote-934756374
Ref: ライブラリ<93>-Footnote-944756440
Ref: ライブラリ<93>-Footnote-954756506
Ref: ライブラリ<93>-Footnote-964756572
Ref: ライブラリ<93>-Footnote-974756638
Ref: ライブラリ<93>-Footnote-984756704
Ref: ライブラリ<93>-Footnote-994756770
Ref: ライブラリ<93>-Footnote-1004756836
Ref: ライブラリ<93>-Footnote-1014756903
Ref: ライブラリ<93>-Footnote-1024756970
Ref: ライブラリ<93>-Footnote-1034757037
Ref: ライブラリ<93>-Footnote-1044757104
Ref: ライブラリ<93>-Footnote-1054757171
Ref: ライブラリ<93>-Footnote-1064757238
Ref: ライブラリ<93>-Footnote-1074757305
Ref: ライブラリ<93>-Footnote-1084757372
Ref: ライブラリ<93>-Footnote-1094757439
Ref: ライブラリ<93>-Footnote-1104757506
Ref: ライブラリ<93>-Footnote-1114757573
Ref: ライブラリ<93>-Footnote-1124757640
Ref: ライブラリ<93>-Footnote-1134757707
Ref: ライブラリ<93>-Footnote-1144757774
Ref: ライブラリ<93>-Footnote-1154757841
Ref: ライブラリ<93>-Footnote-1164757908
Ref: ライブラリ<93>-Footnote-1174757975
Ref: ライブラリ<93>-Footnote-1184758042
Ref: ライブラリ<93>-Footnote-1194758109
Ref: ライブラリ<93>-Footnote-1204758176
Node: ドキュメント<32>4758243
Ref: whatsnew/changelog id4344758372
Ref: 1bf34758372
Ref: ドキュメント<32>-Footnote-14759918
Ref: ドキュメント<32>-Footnote-24759973
Ref: ドキュメント<32>-Footnote-34760028
Ref: ドキュメント<32>-Footnote-44760083
Ref: ドキュメント<32>-Footnote-54760138
Ref: ドキュメント<32>-Footnote-64760203
Ref: ドキュメント<32>-Footnote-74760268
Ref: ドキュメント<32>-Footnote-84760333
Ref: ドキュメント<32>-Footnote-94760398
Ref: ドキュメント<32>-Footnote-104760440
Ref: ドキュメント<32>-Footnote-114760483
Ref: ドキュメント<32>-Footnote-124760549
Ref: ドキュメント<32>-Footnote-134760615
Ref: ドキュメント<32>-Footnote-144760680
Node: テスト<32>4760746
Ref: whatsnew/changelog id4354760869
Ref: 1bf54760869
Ref: テスト<32>-Footnote-14762216
Ref: テスト<32>-Footnote-24762271
Ref: テスト<32>-Footnote-34762326
Ref: テスト<32>-Footnote-44762381
Ref: テスト<32>-Footnote-54762436
Ref: テスト<32>-Footnote-64762491
Ref: テスト<32>-Footnote-74762556
Ref: テスト<32>-Footnote-84762621
Node: ビルド<38>4762686
Ref: whatsnew/changelog id4364762798
Ref: 1bf84762798
Ref: ビルド<38>-Footnote-14763432
Ref: ビルド<38>-Footnote-24763487
Ref: ビルド<38>-Footnote-34763542
Ref: ビルド<38>-Footnote-44763607
Node: Windows<32>4763672
Ref: whatsnew/changelog id4374763780
Ref: 1bf94763780
Ref: Windows<32>-Footnote-14764402
Ref: Windows<32>-Footnote-24764467
Ref: Windows<32>-Footnote-34764532
Ref: Windows<32>-Footnote-44764597
Ref: Windows<32>-Footnote-54764662
Node: macOS<24>4764727
Ref: whatsnew/changelog id4384764837
Ref: 1bfa4764837
Ref: macOS<24>-Footnote-14764969
Node: Tools/Demos<25>4765034
Ref: whatsnew/changelog id4394765142
Ref: 1bfb4765142
Ref: Tools/Demos<25>-Footnote-14765701
Ref: Tools/Demos<25>-Footnote-24765756
Ref: Tools/Demos<25>-Footnote-34765811
Node: C API<33>4765866
Ref: whatsnew/changelog id4404765956
Ref: 1bfc4765956
Ref: C API<33>-Footnote-14768111
Ref: C API<33>-Footnote-24768166
Ref: C API<33>-Footnote-34768221
Ref: C API<33>-Footnote-44768276
Ref: C API<33>-Footnote-54768331
Ref: C API<33>-Footnote-64768386
Ref: C API<33>-Footnote-74768428
Ref: C API<33>-Footnote-84768483
Ref: C API<33>-Footnote-94768538
Ref: C API<33>-Footnote-104768603
Ref: C API<33>-Footnote-114768669
Ref: C API<33>-Footnote-124768735
Ref: C API<33>-Footnote-134768801
Node: Python 3 11 0 alpha 74768867
Ref: whatsnew/changelog python-3-11-0-alpha-74768996
Ref: 1c004768996
Node: Core and Builtins<91>4769545
Ref: whatsnew/changelog id4414769652
Ref: 1c014769652
Ref: Core and Builtins<91>-Footnote-14772926
Ref: Core and Builtins<91>-Footnote-24772991
Ref: Core and Builtins<91>-Footnote-34773056
Ref: Core and Builtins<91>-Footnote-44773121
Ref: Core and Builtins<91>-Footnote-54773186
Ref: Core and Builtins<91>-Footnote-64773251
Ref: Core and Builtins<91>-Footnote-74773316
Ref: Core and Builtins<91>-Footnote-84773381
Ref: Core and Builtins<91>-Footnote-94773446
Ref: Core and Builtins<91>-Footnote-104773511
Ref: Core and Builtins<91>-Footnote-114773577
Ref: Core and Builtins<91>-Footnote-124773643
Ref: Core and Builtins<91>-Footnote-134773709
Ref: Core and Builtins<91>-Footnote-144773775
Ref: Core and Builtins<91>-Footnote-154773841
Ref: Core and Builtins<91>-Footnote-164773907
Ref: Core and Builtins<91>-Footnote-174773973
Node: ライブラリ<94>4774039
Ref: whatsnew/changelog id4424774176
Ref: 1c034774176
Ref: ライブラリ<94>-Footnote-14774466
Node: Core and Builtins<92>4774531
Ref: whatsnew/changelog id4434774666
Ref: 1c044774666
Ref: Core and Builtins<92>-Footnote-14775517
Ref: Core and Builtins<92>-Footnote-24775582
Ref: Core and Builtins<92>-Footnote-34775647
Ref: Core and Builtins<92>-Footnote-44775712
Ref: Core and Builtins<92>-Footnote-54775777
Node: ライブラリ<95>4775842
Ref: whatsnew/changelog id4444775979
Ref: 1c054775979
Ref: ライブラリ<95>-Footnote-14776201
Node: Core and Builtins<93>4776266
Ref: whatsnew/changelog id4454776401
Ref: 1c074776401
Ref: Core and Builtins<93>-Footnote-14777666
Ref: Core and Builtins<93>-Footnote-24777731
Ref: Core and Builtins<93>-Footnote-34777796
Ref: Core and Builtins<93>-Footnote-44777861
Ref: Core and Builtins<93>-Footnote-54777926
Ref: Core and Builtins<93>-Footnote-64777991
Ref: Core and Builtins<93>-Footnote-74778056
Ref: Core and Builtins<93>-Footnote-84778121
Ref: Core and Builtins<93>-Footnote-94778186
Node: ライブラリ<96>4778251
Ref: whatsnew/changelog id4464778389
Ref: 1c094778389
Ref: ライブラリ<96>-Footnote-14792573
Ref: ライブラリ<96>-Footnote-24792638
Ref: ライブラリ<96>-Footnote-34792703
Ref: ライブラリ<96>-Footnote-44792768
Ref: ライブラリ<96>-Footnote-54792833
Ref: ライブラリ<96>-Footnote-64792898
Ref: ライブラリ<96>-Footnote-74792962
Ref: ライブラリ<96>-Footnote-84793027
Ref: ライブラリ<96>-Footnote-94793092
Ref: ライブラリ<96>-Footnote-104793157
Ref: ライブラリ<96>-Footnote-114793223
Ref: ライブラリ<96>-Footnote-124793289
Ref: ライブラリ<96>-Footnote-134793355
Ref: ライブラリ<96>-Footnote-144793421
Ref: ライブラリ<96>-Footnote-154793464
Ref: ライブラリ<96>-Footnote-164793530
Ref: ライブラリ<96>-Footnote-174793596
Ref: ライブラリ<96>-Footnote-184793662
Ref: ライブラリ<96>-Footnote-194793705
Ref: ライブラリ<96>-Footnote-204793771
Ref: ライブラリ<96>-Footnote-214793837
Ref: ライブラリ<96>-Footnote-224793903
Ref: ライブラリ<96>-Footnote-234793946
Ref: ライブラリ<96>-Footnote-244794012
Ref: ライブラリ<96>-Footnote-254794078
Ref: ライブラリ<96>-Footnote-264794144
Ref: ライブラリ<96>-Footnote-274794210
Ref: ライブラリ<96>-Footnote-284794276
Ref: ライブラリ<96>-Footnote-294794342
Ref: ライブラリ<96>-Footnote-304794409
Ref: ライブラリ<96>-Footnote-314794475
Ref: ライブラリ<96>-Footnote-324794541
Ref: ライブラリ<96>-Footnote-334794607
Ref: ライブラリ<96>-Footnote-344794673
Ref: ライブラリ<96>-Footnote-354794716
Ref: ライブラリ<96>-Footnote-364794782
Ref: ライブラリ<96>-Footnote-374794848
Ref: ライブラリ<96>-Footnote-384794913
Ref: ライブラリ<96>-Footnote-394794979
Ref: ライブラリ<96>-Footnote-404795045
Ref: ライブラリ<96>-Footnote-414795111
Ref: ライブラリ<96>-Footnote-424795177
Ref: ライブラリ<96>-Footnote-434795220
Ref: ライブラリ<96>-Footnote-444795286
Ref: ライブラリ<96>-Footnote-454795352
Ref: ライブラリ<96>-Footnote-464795418
Ref: ライブラリ<96>-Footnote-474795484
Ref: ライブラリ<96>-Footnote-484795550
Ref: ライブラリ<96>-Footnote-494795616
Ref: ライブラリ<96>-Footnote-504795682
Ref: ライブラリ<96>-Footnote-514795748
Ref: ライブラリ<96>-Footnote-524795814
Ref: ライブラリ<96>-Footnote-534795880
Ref: ライブラリ<96>-Footnote-544795946
Ref: ライブラリ<96>-Footnote-554796012
Ref: ライブラリ<96>-Footnote-564796078
Ref: ライブラリ<96>-Footnote-574796144
Ref: ライブラリ<96>-Footnote-584796210
Ref: ライブラリ<96>-Footnote-594796276
Ref: ライブラリ<96>-Footnote-604796319
Ref: ライブラリ<96>-Footnote-614796386
Ref: ライブラリ<96>-Footnote-624796452
Ref: ライブラリ<96>-Footnote-634796518
Ref: ライブラリ<96>-Footnote-644796584
Ref: ライブラリ<96>-Footnote-654796650
Ref: ライブラリ<96>-Footnote-664796716
Ref: ライブラリ<96>-Footnote-674796782
Ref: ライブラリ<96>-Footnote-684796848
Ref: ライブラリ<96>-Footnote-694796914
Ref: ライブラリ<96>-Footnote-704796980
Ref: ライブラリ<96>-Footnote-714797046
Ref: ライブラリ<96>-Footnote-724797112
Ref: ライブラリ<96>-Footnote-734797178
Ref: ライブラリ<96>-Footnote-744797244
Ref: ライブラリ<96>-Footnote-754797310
Ref: ライブラリ<96>-Footnote-764797376
Ref: ライブラリ<96>-Footnote-774797442
Ref: ライブラリ<96>-Footnote-784797508
Ref: ライブラリ<96>-Footnote-794797574
Ref: ライブラリ<96>-Footnote-804797640
Ref: ライブラリ<96>-Footnote-814797706
Ref: ライブラリ<96>-Footnote-824797772
Ref: ライブラリ<96>-Footnote-834797838
Ref: ライブラリ<96>-Footnote-844797881
Ref: ライブラリ<96>-Footnote-854797947
Ref: ライブラリ<96>-Footnote-864798013
Ref: ライブラリ<96>-Footnote-874798079
Ref: ライブラリ<96>-Footnote-884798145
Node: ドキュメント<33>4798211
Ref: whatsnew/changelog id4474798341
Ref: 1c164798341
Ref: ドキュメント<33>-Footnote-14799487
Ref: ドキュメント<33>-Footnote-24799552
Ref: ドキュメント<33>-Footnote-34799617
Ref: ドキュメント<33>-Footnote-44799659
Ref: ドキュメント<33>-Footnote-54799724
Ref: ドキュメント<33>-Footnote-64799789
Ref: ドキュメント<33>-Footnote-74799854
Ref: ドキュメント<33>-Footnote-84799919
Node: テスト<33>4799984
Ref: whatsnew/changelog id4484800108
Ref: 1c194800108
Ref: テスト<33>-Footnote-14801076
Ref: テスト<33>-Footnote-24801141
Ref: テスト<33>-Footnote-34801206
Ref: テスト<33>-Footnote-44801271
Ref: テスト<33>-Footnote-54801336
Ref: テスト<33>-Footnote-64801401
Ref: テスト<33>-Footnote-74801466
Ref: テスト<33>-Footnote-84801531
Node: ビルド<39>4801573
Ref: whatsnew/changelog id4494801686
Ref: 1c1a4801686
Ref: ビルド<39>-Footnote-14802977
Ref: ビルド<39>-Footnote-24803042
Ref: ビルド<39>-Footnote-34803107
Ref: ビルド<39>-Footnote-44803172
Ref: ビルド<39>-Footnote-54803237
Ref: ビルド<39>-Footnote-64803302
Ref: ビルド<39>-Footnote-74803367
Ref: ビルド<39>-Footnote-84803432
Ref: ビルド<39>-Footnote-94803497
Node: Windows<33>4803562
Ref: whatsnew/changelog id4504803671
Ref: 1c1c4803671
Ref: Windows<33>-Footnote-14804859
Ref: Windows<33>-Footnote-24804924
Ref: Windows<33>-Footnote-34804980
Ref: Windows<33>-Footnote-44805045
Ref: Windows<33>-Footnote-54805110
Ref: Windows<33>-Footnote-64805152
Ref: Windows<33>-Footnote-74805217
Ref: Windows<33>-Footnote-84805282
Ref: Windows<33>-Footnote-94805347
Ref: Windows<33>-Footnote-104805402
Ref: Windows<33>-Footnote-114805459
Ref: Windows<33>-Footnote-124805525
Node: macOS<25>4805582
Ref: whatsnew/changelog id4514805693
Ref: 1c1d4805693
Ref: macOS<25>-Footnote-14806031
Ref: macOS<25>-Footnote-24806096
Node: Tools/Demos<26>4806161
Ref: whatsnew/changelog id4524806270
Ref: 1c1e4806270
Ref: Tools/Demos<26>-Footnote-14806473
Node: C API<34>4806538
Ref: whatsnew/changelog id4534806629
Ref: 1c1f4806629
Ref: C API<34>-Footnote-14808888
Ref: C API<34>-Footnote-24808953
Ref: C API<34>-Footnote-34809018
Ref: C API<34>-Footnote-44809083
Ref: C API<34>-Footnote-54809148
Ref: C API<34>-Footnote-64809213
Ref: C API<34>-Footnote-74809278
Ref: C API<34>-Footnote-84809343
Node: Python 3 11 0 alpha 64809408
Ref: whatsnew/changelog python-3-11-0-alpha-64809538
Ref: 1c224809538
Node: Core and Builtins<94>4810138
Ref: whatsnew/changelog id4544810245
Ref: 1c234810245
Ref: Core and Builtins<94>-Footnote-14813607
Ref: Core and Builtins<94>-Footnote-24813672
Ref: Core and Builtins<94>-Footnote-34813737
Ref: Core and Builtins<94>-Footnote-44813802
Ref: Core and Builtins<94>-Footnote-54813867
Ref: Core and Builtins<94>-Footnote-64813932
Ref: Core and Builtins<94>-Footnote-74813997
Ref: Core and Builtins<94>-Footnote-84814062
Ref: Core and Builtins<94>-Footnote-94814127
Ref: Core and Builtins<94>-Footnote-104814192
Ref: Core and Builtins<94>-Footnote-114814258
Ref: Core and Builtins<94>-Footnote-124814324
Ref: Core and Builtins<94>-Footnote-134814390
Ref: Core and Builtins<94>-Footnote-144814456
Ref: Core and Builtins<94>-Footnote-154814522
Ref: Core and Builtins<94>-Footnote-164814588
Ref: Core and Builtins<94>-Footnote-174814654
Ref: Core and Builtins<94>-Footnote-184814720
Ref: Core and Builtins<94>-Footnote-194814786
Ref: Core and Builtins<94>-Footnote-204814852
Ref: Core and Builtins<94>-Footnote-214814918
Ref: Core and Builtins<94>-Footnote-224814984
Ref: Core and Builtins<94>-Footnote-234815050
Ref: Core and Builtins<94>-Footnote-244815116
Ref: Core and Builtins<94>-Footnote-254815182
Ref: Core and Builtins<94>-Footnote-264815248
Node: ライブラリ<97>4815314
Ref: whatsnew/changelog id4554815451
Ref: 1c274815451
Ref: ライブラリ<97>-Footnote-14815595
Node: Core and Builtins<95>4815660
Ref: whatsnew/changelog id4564815795
Ref: 1c284815795
Ref: Core and Builtins<95>-Footnote-14817882
Ref: Core and Builtins<95>-Footnote-24817947
Ref: Core and Builtins<95>-Footnote-34818012
Ref: Core and Builtins<95>-Footnote-44818077
Ref: Core and Builtins<95>-Footnote-54818142
Ref: Core and Builtins<95>-Footnote-64818207
Ref: Core and Builtins<95>-Footnote-74818272
Ref: Core and Builtins<95>-Footnote-84818337
Ref: Core and Builtins<95>-Footnote-94818402
Ref: Core and Builtins<95>-Footnote-104818467
Ref: Core and Builtins<95>-Footnote-114818533
Node: ライブラリ<98>4818599
Ref: whatsnew/changelog id4574818736
Ref: 1c294818736
Ref: ライブラリ<98>-Footnote-14819007
Node: Core and Builtins<96>4819072
Ref: whatsnew/changelog id4584819207
Ref: 1c2a4819207
Ref: Core and Builtins<96>-Footnote-14819809
Ref: Core and Builtins<96>-Footnote-24819874
Ref: Core and Builtins<96>-Footnote-34819939
Ref: Core and Builtins<96>-Footnote-44820004
Node: ライブラリ<99>4820069
Ref: whatsnew/changelog id4594820206
Ref: 1c2b4820206
Ref: ライブラリ<99>-Footnote-14820510
Ref: ライブラリ<99>-Footnote-24820575
Node: Core and Builtins<97>4820640
Ref: whatsnew/changelog id4604820776
Ref: 1c2c4820776
Ref: Core and Builtins<97>-Footnote-14821475
Ref: Core and Builtins<97>-Footnote-24821540
Ref: Core and Builtins<97>-Footnote-34821605
Node: ライブラリ<100>4821670
Ref: whatsnew/changelog id4614821809
Ref: 1c2f4821809
Ref: ライブラリ<100>-Footnote-14830006
Ref: ライブラリ<100>-Footnote-24830071
Ref: ライブラリ<100>-Footnote-34830136
Ref: ライブラリ<100>-Footnote-44830201
Ref: ライブラリ<100>-Footnote-54830266
Ref: ライブラリ<100>-Footnote-64830331
Ref: ライブラリ<100>-Footnote-74830396
Ref: ライブラリ<100>-Footnote-84830461
Ref: ライブラリ<100>-Footnote-94830526
Ref: ライブラリ<100>-Footnote-104830591
Ref: ライブラリ<100>-Footnote-114830657
Ref: ライブラリ<100>-Footnote-124830723
Ref: ライブラリ<100>-Footnote-134830789
Ref: ライブラリ<100>-Footnote-144830855
Ref: ライブラリ<100>-Footnote-154830921
Ref: ライブラリ<100>-Footnote-164830987
Ref: ライブラリ<100>-Footnote-174831053
Ref: ライブラリ<100>-Footnote-184831119
Ref: ライブラリ<100>-Footnote-194831185
Ref: ライブラリ<100>-Footnote-204831251
Ref: ライブラリ<100>-Footnote-214831317
Ref: ライブラリ<100>-Footnote-224831383
Ref: ライブラリ<100>-Footnote-234831449
Ref: ライブラリ<100>-Footnote-244831515
Ref: ライブラリ<100>-Footnote-254831581
Ref: ライブラリ<100>-Footnote-264831647
Ref: ライブラリ<100>-Footnote-274831713
Ref: ライブラリ<100>-Footnote-284831779
Ref: ライブラリ<100>-Footnote-294831845
Ref: ライブラリ<100>-Footnote-304831911
Ref: ライブラリ<100>-Footnote-314831977
Ref: ライブラリ<100>-Footnote-324832043
Ref: ライブラリ<100>-Footnote-334832109
Ref: ライブラリ<100>-Footnote-344832175
Ref: ライブラリ<100>-Footnote-354832218
Ref: ライブラリ<100>-Footnote-364832284
Ref: ライブラリ<100>-Footnote-374832350
Ref: ライブラリ<100>-Footnote-384832416
Ref: ライブラリ<100>-Footnote-394832482
Ref: ライブラリ<100>-Footnote-404832548
Ref: ライブラリ<100>-Footnote-414832614
Ref: ライブラリ<100>-Footnote-424832680
Ref: ライブラリ<100>-Footnote-434832746
Ref: ライブラリ<100>-Footnote-444832812
Ref: ライブラリ<100>-Footnote-454832878
Ref: ライブラリ<100>-Footnote-464832944
Ref: ライブラリ<100>-Footnote-474833010
Ref: ライブラリ<100>-Footnote-484833076
Node: ドキュメント<34>4833142
Ref: whatsnew/changelog id4624833273
Ref: 1c3b4833273
Ref: ドキュメント<34>-Footnote-14833496
Node: テスト<34>4833561
Ref: whatsnew/changelog id4634833685
Ref: 1c3c4833685
Ref: テスト<34>-Footnote-14834661
Ref: テスト<34>-Footnote-24834726
Ref: テスト<34>-Footnote-34834791
Ref: テスト<34>-Footnote-44834856
Ref: テスト<34>-Footnote-54834921
Node: ビルド<40>4834986
Ref: whatsnew/changelog id4644835099
Ref: 1c3d4835099
Ref: ビルド<40>-Footnote-14836532
Ref: ビルド<40>-Footnote-24836597
Ref: ビルド<40>-Footnote-34836662
Ref: ビルド<40>-Footnote-44836727
Ref: ビルド<40>-Footnote-54836792
Ref: ビルド<40>-Footnote-64836857
Ref: ビルド<40>-Footnote-74836922
Node: Windows<34>4836987
Ref: whatsnew/changelog id4654837095
Ref: 1c3e4837095
Ref: Windows<34>-Footnote-14837755
Ref: Windows<34>-Footnote-24837820
Ref: Windows<34>-Footnote-34837885
Node: IDLE<17>4837950
Ref: whatsnew/changelog id4664838054
Ref: 1c3f4838054
Ref: IDLE<17>-Footnote-14838336
Ref: IDLE<17>-Footnote-24838401
Node: C API<35>4838466
Ref: whatsnew/changelog id4674838550
Ref: 1c404838550
Ref: C API<35>-Footnote-14839495
Ref: C API<35>-Footnote-24839560
Ref: C API<35>-Footnote-34839625
Ref: C API<35>-Footnote-44839690
Ref: C API<35>-Footnote-54839755
Node: Python 3 11 0 alpha 54839820
Ref: whatsnew/changelog python-3-11-0-alpha-54839950
Ref: 1c414839950
Node: Core and Builtins<98>4840517
Ref: whatsnew/changelog id4684840625
Ref: 1c424840625
Ref: Core and Builtins<98>-Footnote-14844550
Ref: Core and Builtins<98>-Footnote-24844615
Ref: Core and Builtins<98>-Footnote-34844680
Ref: Core and Builtins<98>-Footnote-44844745
Ref: Core and Builtins<98>-Footnote-54844810
Ref: Core and Builtins<98>-Footnote-64844875
Ref: Core and Builtins<98>-Footnote-74844940
Ref: Core and Builtins<98>-Footnote-84845005
Ref: Core and Builtins<98>-Footnote-94845070
Ref: Core and Builtins<98>-Footnote-104845135
Ref: Core and Builtins<98>-Footnote-114845201
Ref: Core and Builtins<98>-Footnote-124845267
Ref: Core and Builtins<98>-Footnote-134845333
Ref: Core and Builtins<98>-Footnote-144845376
Ref: Core and Builtins<98>-Footnote-154845442
Ref: Core and Builtins<98>-Footnote-164845508
Ref: Core and Builtins<98>-Footnote-174845574
Ref: Core and Builtins<98>-Footnote-184845640
Ref: Core and Builtins<98>-Footnote-194845706
Node: ライブラリ<101>4845772
Ref: whatsnew/changelog id4694845910
Ref: 1c444845910
Ref: ライブラリ<101>-Footnote-14846139
Node: Core and Builtins<99>4846204
Ref: whatsnew/changelog id4704846341
Ref: 1c454846341
Ref: Core and Builtins<99>-Footnote-14847076
Ref: Core and Builtins<99>-Footnote-24847141
Ref: Core and Builtins<99>-Footnote-34847206
Ref: Core and Builtins<99>-Footnote-44847271
Node: ライブラリ<102>4847336
Ref: whatsnew/changelog id4714847466
Ref: 1c474847466
Ref: ライブラリ<102>-Footnote-14847605
Node: ビルド<41>4847670
Ref: whatsnew/changelog id4724847801
Ref: 1c484847801
Ref: ビルド<41>-Footnote-14847933
Node: Core and Builtins<100>4847998
Ref: whatsnew/changelog id4734848129
Ref: 1c494848129
Ref: Core and Builtins<100>-Footnote-14848429
Node: ライブラリ<103>4848494
Ref: whatsnew/changelog id4744848634
Ref: 1c4a4848634
Ref: ライブラリ<103>-Footnote-14854584
Ref: ライブラリ<103>-Footnote-24854649
Ref: ライブラリ<103>-Footnote-34854714
Ref: ライブラリ<103>-Footnote-44854779
Ref: ライブラリ<103>-Footnote-54854844
Ref: ライブラリ<103>-Footnote-64854909
Ref: ライブラリ<103>-Footnote-74854974
Ref: ライブラリ<103>-Footnote-84855039
Ref: ライブラリ<103>-Footnote-94855104
Ref: ライブラリ<103>-Footnote-104855169
Ref: ライブラリ<103>-Footnote-114855235
Ref: ライブラリ<103>-Footnote-124855301
Ref: ライブラリ<103>-Footnote-134855367
Ref: ライブラリ<103>-Footnote-144855433
Ref: ライブラリ<103>-Footnote-154855499
Ref: ライブラリ<103>-Footnote-164855565
Ref: ライブラリ<103>-Footnote-174855631
Ref: ライブラリ<103>-Footnote-184855697
Ref: ライブラリ<103>-Footnote-194855763
Ref: ライブラリ<103>-Footnote-204855829
Ref: ライブラリ<103>-Footnote-214855895
Ref: ライブラリ<103>-Footnote-224855961
Ref: ライブラリ<103>-Footnote-234856027
Ref: ライブラリ<103>-Footnote-244856093
Ref: ライブラリ<103>-Footnote-254856159
Ref: ライブラリ<103>-Footnote-264856225
Ref: ライブラリ<103>-Footnote-274856291
Ref: ライブラリ<103>-Footnote-284856357
Ref: ライブラリ<103>-Footnote-294856423
Ref: ライブラリ<103>-Footnote-304856489
Ref: ライブラリ<103>-Footnote-314856555
Ref: ライブラリ<103>-Footnote-324856621
Ref: ライブラリ<103>-Footnote-334856687
Ref: ライブラリ<103>-Footnote-344856753
Ref: ライブラリ<103>-Footnote-354856819
Ref: ライブラリ<103>-Footnote-364856885
Ref: ライブラリ<103>-Footnote-374856951
Node: ドキュメント<35>4857017
Ref: whatsnew/changelog id4754857148
Ref: 1c504857148
Ref: ドキュメント<35>-Footnote-14857341
Node: テスト<35>4857406
Ref: whatsnew/changelog id4764857530
Ref: 1c514857530
Ref: テスト<35>-Footnote-14859680
Ref: テスト<35>-Footnote-24859745
Ref: テスト<35>-Footnote-34859810
Ref: テスト<35>-Footnote-44859875
Ref: テスト<35>-Footnote-54859940
Ref: テスト<35>-Footnote-64860005
Ref: テスト<35>-Footnote-74860070
Ref: テスト<35>-Footnote-84860135
Ref: テスト<35>-Footnote-94860200
Ref: テスト<35>-Footnote-104860265
Ref: テスト<35>-Footnote-114860331
Node: ビルド<42>4860397
Ref: whatsnew/changelog id4774860510
Ref: 1c524860510
Ref: ビルド<42>-Footnote-14862247
Ref: ビルド<42>-Footnote-24862312
Ref: ビルド<42>-Footnote-34862377
Ref: ビルド<42>-Footnote-44862442
Ref: ビルド<42>-Footnote-54862507
Ref: ビルド<42>-Footnote-64862572
Ref: ビルド<42>-Footnote-74862637
Ref: ビルド<42>-Footnote-84862702
Ref: ビルド<42>-Footnote-94862767
Ref: ビルド<42>-Footnote-104862832
Node: Windows<35>4862898
Ref: whatsnew/changelog id4784863007
Ref: 1c534863007
Ref: Windows<35>-Footnote-14863537
Ref: Windows<35>-Footnote-24863602
Ref: Windows<35>-Footnote-34863667
Node: macOS<26>4863732
Ref: whatsnew/changelog id4794863836
Ref: 1c544863836
Ref: macOS<26>-Footnote-14863968
Node: IDLE<18>4864033
Ref: whatsnew/changelog id4804864135
Ref: 1c554864135
Ref: IDLE<18>-Footnote-14864524
Node: C API<36>4864589
Ref: whatsnew/changelog id4814864673
Ref: 1c564864673
Ref: C API<36>-Footnote-14865566
Ref: C API<36>-Footnote-24865631
Ref: C API<36>-Footnote-34865696
Ref: C API<36>-Footnote-44865761
Ref: C API<36>-Footnote-54865826
Node: Python 3 11 0 alpha 44865891
Ref: whatsnew/changelog python-3-11-0-alpha-44866021
Ref: 1c574866021
Node: Core and Builtins<101>4866633
Ref: whatsnew/changelog id4824866742
Ref: 1c584866742
Ref: Core and Builtins<101>-Footnote-14868934
Ref: Core and Builtins<101>-Footnote-24868999
Ref: Core and Builtins<101>-Footnote-34869064
Ref: Core and Builtins<101>-Footnote-44869129
Ref: Core and Builtins<101>-Footnote-54869194
Ref: Core and Builtins<101>-Footnote-64869259
Ref: Core and Builtins<101>-Footnote-74869324
Ref: Core and Builtins<101>-Footnote-84869389
Ref: Core and Builtins<101>-Footnote-94869454
Ref: Core and Builtins<101>-Footnote-104869519
Ref: Core and Builtins<101>-Footnote-114869585
Node: ライブラリ<104>4869651
Ref: whatsnew/changelog id4834869791
Ref: 1c594869791
Ref: ライブラリ<104>-Footnote-14869991
Node: Core and Builtins<102>4870056
Ref: whatsnew/changelog id4844870194
Ref: 1c5a4870194
Ref: Core and Builtins<102>-Footnote-14870919
Ref: Core and Builtins<102>-Footnote-24870984
Ref: Core and Builtins<102>-Footnote-34871049
Ref: Core and Builtins<102>-Footnote-44871114
Ref: Core and Builtins<102>-Footnote-54871179
Node: ライブラリ<105>4871244
Ref: whatsnew/changelog id4854871384
Ref: 1c5b4871384
Ref: ライブラリ<105>-Footnote-14871539
Node: Core and Builtins<103>4871604
Ref: whatsnew/changelog id4864871742
Ref: 1c5c4871742
Ref: Core and Builtins<103>-Footnote-14874291
Ref: Core and Builtins<103>-Footnote-24874356
Ref: Core and Builtins<103>-Footnote-34874421
Ref: Core and Builtins<103>-Footnote-44874486
Ref: Core and Builtins<103>-Footnote-54874551
Ref: Core and Builtins<103>-Footnote-64874616
Ref: Core and Builtins<103>-Footnote-74874681
Ref: Core and Builtins<103>-Footnote-84874746
Ref: Core and Builtins<103>-Footnote-94874811
Ref: Core and Builtins<103>-Footnote-104874876
Ref: Core and Builtins<103>-Footnote-114874942
Ref: Core and Builtins<103>-Footnote-124875008
Ref: Core and Builtins<103>-Footnote-134875074
Ref: Core and Builtins<103>-Footnote-144875140
Ref: Core and Builtins<103>-Footnote-154875206
Node: ライブラリ<106>4875272
Ref: whatsnew/changelog id4874875412
Ref: 1c5e4875412
Ref: ライブラリ<106>-Footnote-14875595
Node: Core and Builtins<104>4875660
Ref: whatsnew/changelog id4884875798
Ref: 1c5f4875798
Ref: Core and Builtins<104>-Footnote-14877075
Ref: Core and Builtins<104>-Footnote-24877140
Ref: Core and Builtins<104>-Footnote-34877205
Ref: Core and Builtins<104>-Footnote-44877270
Ref: Core and Builtins<104>-Footnote-54877335
Ref: Core and Builtins<104>-Footnote-64877377
Ref: Core and Builtins<104>-Footnote-74877442
Node: ライブラリ<107>4877507
Ref: whatsnew/changelog id4894877647
Ref: 1c604877647
Ref: ライブラリ<107>-Footnote-14884923
Ref: ライブラリ<107>-Footnote-24884988
Ref: ライブラリ<107>-Footnote-34885053
Ref: ライブラリ<107>-Footnote-44885118
Ref: ライブラリ<107>-Footnote-54885183
Ref: ライブラリ<107>-Footnote-64885248
Ref: ライブラリ<107>-Footnote-74885313
Ref: ライブラリ<107>-Footnote-84885378
Ref: ライブラリ<107>-Footnote-94885443
Ref: ライブラリ<107>-Footnote-104885508
Ref: ライブラリ<107>-Footnote-114885574
Ref: ライブラリ<107>-Footnote-124885640
Ref: ライブラリ<107>-Footnote-134885706
Ref: ライブラリ<107>-Footnote-144885772
Ref: ライブラリ<107>-Footnote-154885838
Ref: ライブラリ<107>-Footnote-164885904
Ref: ライブラリ<107>-Footnote-174885970
Ref: ライブラリ<107>-Footnote-184886036
Ref: ライブラリ<107>-Footnote-194886102
Ref: ライブラリ<107>-Footnote-204886168
Ref: ライブラリ<107>-Footnote-214886234
Ref: ライブラリ<107>-Footnote-224886300
Ref: ライブラリ<107>-Footnote-234886366
Ref: ライブラリ<107>-Footnote-244886432
Ref: ライブラリ<107>-Footnote-254886498
Ref: ライブラリ<107>-Footnote-264886564
Ref: ライブラリ<107>-Footnote-274886630
Ref: ライブラリ<107>-Footnote-284886696
Ref: ライブラリ<107>-Footnote-294886762
Ref: ライブラリ<107>-Footnote-304886828
Ref: ライブラリ<107>-Footnote-314886894
Ref: ライブラリ<107>-Footnote-324886960
Ref: ライブラリ<107>-Footnote-334887026
Ref: ライブラリ<107>-Footnote-344887092
Ref: ライブラリ<107>-Footnote-354887158
Ref: ライブラリ<107>-Footnote-364887224
Ref: ライブラリ<107>-Footnote-374887290
Ref: ライブラリ<107>-Footnote-384887356
Ref: ライブラリ<107>-Footnote-394887422
Ref: ライブラリ<107>-Footnote-404887488
Ref: ライブラリ<107>-Footnote-414887554
Ref: ライブラリ<107>-Footnote-424887620
Ref: ライブラリ<107>-Footnote-434887686
Ref: ライブラリ<107>-Footnote-444887752
Node: ドキュメント<36>4887818
Ref: whatsnew/changelog id4904887949
Ref: 1c654887949
Ref: ドキュメント<36>-Footnote-14888450
Ref: ドキュメント<36>-Footnote-24888515
Ref: ドキュメント<36>-Footnote-34888580
Ref: ドキュメント<36>-Footnote-44888645
Node: テスト<36>4888710
Ref: whatsnew/changelog id4914888834
Ref: 1c684888834
Ref: テスト<36>-Footnote-14889769
Ref: テスト<36>-Footnote-24889834
Ref: テスト<36>-Footnote-34889899
Ref: テスト<36>-Footnote-44889964
Ref: テスト<36>-Footnote-54890029
Ref: テスト<36>-Footnote-64890094
Ref: テスト<36>-Footnote-74890159
Ref: テスト<36>-Footnote-84890224
Node: ビルド<43>4890289
Ref: whatsnew/changelog id4924890402
Ref: 1c694890402
Ref: ビルド<43>-Footnote-14892470
Ref: ビルド<43>-Footnote-24892535
Ref: ビルド<43>-Footnote-34892600
Ref: ビルド<43>-Footnote-44892665
Ref: ビルド<43>-Footnote-54892730
Ref: ビルド<43>-Footnote-64892795
Ref: ビルド<43>-Footnote-74892860
Ref: ビルド<43>-Footnote-84892925
Ref: ビルド<43>-Footnote-94892990
Ref: ビルド<43>-Footnote-104893055
Ref: ビルド<43>-Footnote-114893121
Ref: ビルド<43>-Footnote-124893187
Node: Windows<36>4893253
Ref: whatsnew/changelog id4934893362
Ref: 1c6a4893362
Ref: Windows<36>-Footnote-14893583
Node: macOS<27>4893648
Ref: whatsnew/changelog id4944893753
Ref: 1c6b4893753
Ref: macOS<27>-Footnote-14893993
Node: C API<37>4894058
Ref: whatsnew/changelog id4954894143
Ref: 1c6c4894143
Ref: C API<37>-Footnote-14895404
Ref: C API<37>-Footnote-24895469
Ref: C API<37>-Footnote-34895534
Ref: C API<37>-Footnote-44895599
Ref: C API<37>-Footnote-54895664
Node: Python 3 11 0 alpha 34895729
Ref: whatsnew/changelog python-3-11-0-alpha-34895859
Ref: 1c6e4895859
Node: Core and Builtins<105>4896296
Ref: whatsnew/changelog id4964896405
Ref: 1c6f4896405
Ref: Core and Builtins<105>-Footnote-14898986
Ref: Core and Builtins<105>-Footnote-24899051
Ref: Core and Builtins<105>-Footnote-34899116
Ref: Core and Builtins<105>-Footnote-44899181
Ref: Core and Builtins<105>-Footnote-54899246
Ref: Core and Builtins<105>-Footnote-64899311
Ref: Core and Builtins<105>-Footnote-74899376
Ref: Core and Builtins<105>-Footnote-84899441
Ref: Core and Builtins<105>-Footnote-94899506
Ref: Core and Builtins<105>-Footnote-104899571
Ref: Core and Builtins<105>-Footnote-114899637
Ref: Core and Builtins<105>-Footnote-124899703
Node: ライブラリ<108>4899769
Ref: whatsnew/changelog id4974899909
Ref: 1c714899909
Ref: ライブラリ<108>-Footnote-14900093
Node: Core and Builtins<106>4900158
Ref: whatsnew/changelog id4984900296
Ref: 1c724900296
Ref: Core and Builtins<106>-Footnote-14903314
Ref: Core and Builtins<106>-Footnote-24903379
Ref: Core and Builtins<106>-Footnote-34903444
Ref: Core and Builtins<106>-Footnote-44903509
Ref: Core and Builtins<106>-Footnote-54903574
Ref: Core and Builtins<106>-Footnote-64903639
Ref: Core and Builtins<106>-Footnote-74903704
Ref: Core and Builtins<106>-Footnote-84903769
Ref: Core and Builtins<106>-Footnote-94903834
Ref: Core and Builtins<106>-Footnote-104903876
Ref: Core and Builtins<106>-Footnote-114903942
Ref: Core and Builtins<106>-Footnote-124904008
Ref: Core and Builtins<106>-Footnote-134904074
Ref: Core and Builtins<106>-Footnote-144904140
Ref: Core and Builtins<106>-Footnote-154904206
Ref: Core and Builtins<106>-Footnote-164904272
Ref: Core and Builtins<106>-Footnote-174904338
Ref: Core and Builtins<106>-Footnote-184904404
Ref: Core and Builtins<106>-Footnote-194904470
Ref: Core and Builtins<106>-Footnote-204904536
Ref: Core and Builtins<106>-Footnote-214904602
Node: ライブラリ<109>4904668
Ref: whatsnew/changelog id4994904808
Ref: 1c734904808
Ref: ライブラリ<109>-Footnote-14910784
Ref: ライブラリ<109>-Footnote-24910849
Ref: ライブラリ<109>-Footnote-34910914
Ref: ライブラリ<109>-Footnote-44910979
Ref: ライブラリ<109>-Footnote-54911044
Ref: ライブラリ<109>-Footnote-64911109
Ref: ライブラリ<109>-Footnote-74911174
Ref: ライブラリ<109>-Footnote-84911239
Ref: ライブラリ<109>-Footnote-94911304
Ref: ライブラリ<109>-Footnote-104911369
Ref: ライブラリ<109>-Footnote-114911435
Ref: ライブラリ<109>-Footnote-124911501
Ref: ライブラリ<109>-Footnote-134911567
Ref: ライブラリ<109>-Footnote-144911633
Ref: ライブラリ<109>-Footnote-154911699
Ref: ライブラリ<109>-Footnote-164911765
Ref: ライブラリ<109>-Footnote-174911831
Ref: ライブラリ<109>-Footnote-184911897
Ref: ライブラリ<109>-Footnote-194911963
Ref: ライブラリ<109>-Footnote-204912029
Ref: ライブラリ<109>-Footnote-214912095
Ref: ライブラリ<109>-Footnote-224912161
Ref: ライブラリ<109>-Footnote-234912227
Ref: ライブラリ<109>-Footnote-244912293
Ref: ライブラリ<109>-Footnote-254912359
Ref: ライブラリ<109>-Footnote-264912425
Ref: ライブラリ<109>-Footnote-274912491
Ref: ライブラリ<109>-Footnote-284912557
Ref: ライブラリ<109>-Footnote-294912623
Ref: ライブラリ<109>-Footnote-304912689
Ref: ライブラリ<109>-Footnote-314912755
Ref: ライブラリ<109>-Footnote-324912798
Ref: ライブラリ<109>-Footnote-334912864
Ref: ライブラリ<109>-Footnote-344912930
Ref: ライブラリ<109>-Footnote-354912996
Ref: ライブラリ<109>-Footnote-364913062
Node: ドキュメント<37>4913128
Ref: whatsnew/changelog id5004913259
Ref: 1c754913259
Ref: ドキュメント<37>-Footnote-14914571
Ref: ドキュメント<37>-Footnote-24914636
Ref: ドキュメント<37>-Footnote-34914701
Ref: ドキュメント<37>-Footnote-44914766
Ref: ドキュメント<37>-Footnote-54914831
Ref: ドキュメント<37>-Footnote-64914896
Ref: ドキュメント<37>-Footnote-74914961
Ref: ドキュメント<37>-Footnote-84915026
Ref: ドキュメント<37>-Footnote-94915091
Node: テスト<37>4915156
Ref: whatsnew/changelog id5014915280
Ref: 1c764915280
Ref: テスト<37>-Footnote-14916092
Ref: テスト<37>-Footnote-24916157
Ref: テスト<37>-Footnote-34916222
Ref: テスト<37>-Footnote-44916287
Ref: テスト<37>-Footnote-54916352
Ref: テスト<37>-Footnote-64916417
Node: ビルド<44>4916482
Ref: whatsnew/changelog id5024916595
Ref: 1c774916595
Ref: ビルド<44>-Footnote-14922395
Ref: ビルド<44>-Footnote-24922460
Ref: ビルド<44>-Footnote-34922525
Ref: ビルド<44>-Footnote-44922590
Ref: ビルド<44>-Footnote-54922655
Ref: ビルド<44>-Footnote-64922720
Ref: ビルド<44>-Footnote-74922785
Ref: ビルド<44>-Footnote-84922850
Ref: ビルド<44>-Footnote-94922915
Ref: ビルド<44>-Footnote-104922980
Ref: ビルド<44>-Footnote-114923046
Ref: ビルド<44>-Footnote-124923112
Ref: ビルド<44>-Footnote-134923178
Ref: ビルド<44>-Footnote-144923244
Ref: ビルド<44>-Footnote-154923310
Ref: ビルド<44>-Footnote-164923376
Ref: ビルド<44>-Footnote-174923442
Ref: ビルド<44>-Footnote-184923508
Ref: ビルド<44>-Footnote-194923574
Ref: ビルド<44>-Footnote-204923640
Ref: ビルド<44>-Footnote-214923706
Ref: ビルド<44>-Footnote-224923772
Ref: ビルド<44>-Footnote-234923838
Ref: ビルド<44>-Footnote-244923904
Ref: ビルド<44>-Footnote-254923970
Ref: ビルド<44>-Footnote-264924036
Ref: ビルド<44>-Footnote-274924102
Ref: ビルド<44>-Footnote-284924168
Ref: ビルド<44>-Footnote-294924234
Ref: ビルド<44>-Footnote-304924300
Ref: ビルド<44>-Footnote-314924366
Ref: ビルド<44>-Footnote-324924432
Ref: ビルド<44>-Footnote-334924498
Node: Windows<37>4924564
Ref: whatsnew/changelog id5034924673
Ref: 1c784924673
Ref: Windows<37>-Footnote-14925854
Ref: Windows<37>-Footnote-24925919
Ref: Windows<37>-Footnote-34925984
Ref: Windows<37>-Footnote-44926049
Ref: Windows<37>-Footnote-54926114
Ref: Windows<37>-Footnote-64926179
Node: macOS<28>4926244
Ref: whatsnew/changelog id5044926349
Ref: 1c794926349
Ref: macOS<28>-Footnote-14926499
Node: C API<38>4926564
Ref: whatsnew/changelog id5054926649
Ref: 1c7a4926649
Ref: C API<38>-Footnote-14926856
Node: Python 3 11 0 alpha 24926921
Ref: whatsnew/changelog python-3-11-0-alpha-24927051
Ref: 1c7b4927051
Node: Core and Builtins<107>4927423
Ref: whatsnew/changelog id5064927532
Ref: 1c7c4927532
Ref: Core and Builtins<107>-Footnote-14932892
Ref: Core and Builtins<107>-Footnote-24932957
Ref: Core and Builtins<107>-Footnote-34933022
Ref: Core and Builtins<107>-Footnote-44933087
Ref: Core and Builtins<107>-Footnote-54933152
Ref: Core and Builtins<107>-Footnote-64933217
Ref: Core and Builtins<107>-Footnote-74933282
Ref: Core and Builtins<107>-Footnote-84933347
Ref: Core and Builtins<107>-Footnote-94933412
Ref: Core and Builtins<107>-Footnote-104933477
Ref: Core and Builtins<107>-Footnote-114933543
Ref: Core and Builtins<107>-Footnote-124933609
Ref: Core and Builtins<107>-Footnote-134933675
Ref: Core and Builtins<107>-Footnote-144933741
Ref: Core and Builtins<107>-Footnote-154933807
Ref: Core and Builtins<107>-Footnote-164933873
Ref: Core and Builtins<107>-Footnote-174933939
Ref: Core and Builtins<107>-Footnote-184934005
Ref: Core and Builtins<107>-Footnote-194934071
Ref: Core and Builtins<107>-Footnote-204934137
Ref: Core and Builtins<107>-Footnote-214934180
Ref: Core and Builtins<107>-Footnote-224934246
Ref: Core and Builtins<107>-Footnote-234934312
Ref: Core and Builtins<107>-Footnote-244934378
Ref: Core and Builtins<107>-Footnote-254934444
Ref: Core and Builtins<107>-Footnote-264934510
Node: ライブラリ<110>4934553
Ref: whatsnew/changelog id5074934693
Ref: 1c7e4934693
Ref: ライブラリ<110>-Footnote-14942258
Ref: ライブラリ<110>-Footnote-24942323
Ref: ライブラリ<110>-Footnote-34942388
Ref: ライブラリ<110>-Footnote-44942453
Ref: ライブラリ<110>-Footnote-54942518
Ref: ライブラリ<110>-Footnote-64942583
Ref: ライブラリ<110>-Footnote-74942648
Ref: ライブラリ<110>-Footnote-84942713
Ref: ライブラリ<110>-Footnote-94942778
Ref: ライブラリ<110>-Footnote-104942843
Ref: ライブラリ<110>-Footnote-114942909
Ref: ライブラリ<110>-Footnote-124942975
Ref: ライブラリ<110>-Footnote-134943041
Ref: ライブラリ<110>-Footnote-144943107
Ref: ライブラリ<110>-Footnote-154943173
Ref: ライブラリ<110>-Footnote-164943239
Ref: ライブラリ<110>-Footnote-174943305
Ref: ライブラリ<110>-Footnote-184943371
Ref: ライブラリ<110>-Footnote-194943437
Ref: ライブラリ<110>-Footnote-204943503
Ref: ライブラリ<110>-Footnote-214943569
Ref: ライブラリ<110>-Footnote-224943635
Ref: ライブラリ<110>-Footnote-234943701
Ref: ライブラリ<110>-Footnote-244943767
Ref: ライブラリ<110>-Footnote-254943833
Ref: ライブラリ<110>-Footnote-264943899
Ref: ライブラリ<110>-Footnote-274943965
Ref: ライブラリ<110>-Footnote-284944031
Ref: ライブラリ<110>-Footnote-294944097
Ref: ライブラリ<110>-Footnote-304944163
Ref: ライブラリ<110>-Footnote-314944229
Ref: ライブラリ<110>-Footnote-324944295
Ref: ライブラリ<110>-Footnote-334944361
Ref: ライブラリ<110>-Footnote-344944427
Ref: ライブラリ<110>-Footnote-354944493
Ref: ライブラリ<110>-Footnote-364944559
Ref: ライブラリ<110>-Footnote-374944625
Ref: ライブラリ<110>-Footnote-384944691
Ref: ライブラリ<110>-Footnote-394944757
Ref: ライブラリ<110>-Footnote-404944823
Ref: ライブラリ<110>-Footnote-414944889
Ref: ライブラリ<110>-Footnote-424944955
Ref: ライブラリ<110>-Footnote-434945021
Ref: ライブラリ<110>-Footnote-444945081
Ref: ライブラリ<110>-Footnote-454945147
Node: ドキュメント<38>4945213
Ref: whatsnew/changelog id5084945344
Ref: 1c834945344
Ref: ドキュメント<38>-Footnote-14946826
Ref: ドキュメント<38>-Footnote-24946891
Ref: ドキュメント<38>-Footnote-34946956
Ref: ドキュメント<38>-Footnote-44947021
Ref: ドキュメント<38>-Footnote-54947086
Ref: ドキュメント<38>-Footnote-64947151
Ref: ドキュメント<38>-Footnote-74947216
Ref: ドキュメント<38>-Footnote-84947281
Ref: ドキュメント<38>-Footnote-94947346
Ref: ドキュメント<38>-Footnote-104947388
Ref: ドキュメント<38>-Footnote-114947454
Node: テスト<38>4947520
Ref: whatsnew/changelog id5094947644
Ref: 1c854947644
Ref: テスト<38>-Footnote-14949915
Ref: テスト<38>-Footnote-24949980
Ref: テスト<38>-Footnote-34950045
Ref: テスト<38>-Footnote-44950110
Ref: テスト<38>-Footnote-54950175
Ref: テスト<38>-Footnote-64950240
Ref: テスト<38>-Footnote-74950305
Ref: テスト<38>-Footnote-84950370
Ref: テスト<38>-Footnote-94950435
Ref: テスト<38>-Footnote-104950500
Ref: テスト<38>-Footnote-114950566
Ref: テスト<38>-Footnote-124950632
Ref: テスト<38>-Footnote-134950698
Node: ビルド<45>4950764
Ref: whatsnew/changelog id5104950877
Ref: 1c864950877
Ref: ビルド<45>-Footnote-14953557
Ref: ビルド<45>-Footnote-24953622
Ref: ビルド<45>-Footnote-34953687
Ref: ビルド<45>-Footnote-44953752
Ref: ビルド<45>-Footnote-54953817
Ref: ビルド<45>-Footnote-64953882
Ref: ビルド<45>-Footnote-74953947
Ref: ビルド<45>-Footnote-84954012
Ref: ビルド<45>-Footnote-94954077
Ref: ビルド<45>-Footnote-104954142
Ref: ビルド<45>-Footnote-114954208
Ref: ビルド<45>-Footnote-124954274
Ref: ビルド<45>-Footnote-134954340
Ref: ビルド<45>-Footnote-144954406
Ref: ビルド<45>-Footnote-154954472
Node: Windows<38>4954538
Ref: whatsnew/changelog id5114954647
Ref: 1c874954647
Ref: Windows<38>-Footnote-14955202
Ref: Windows<38>-Footnote-24955267
Ref: Windows<38>-Footnote-34955332
Node: macOS<29>4955397
Ref: whatsnew/changelog id5124955501
Ref: 1c884955501
Ref: macOS<29>-Footnote-14955762
Node: IDLE<19>4955827
Ref: whatsnew/changelog id5134955929
Ref: 1c894955929
Ref: IDLE<19>-Footnote-14956082
Node: C API<39>4956147
Ref: whatsnew/changelog id5144956231
Ref: 1c8a4956231
Ref: C API<39>-Footnote-14959957
Ref: C API<39>-Footnote-24960022
Ref: C API<39>-Footnote-34960087
Ref: C API<39>-Footnote-44960152
Ref: C API<39>-Footnote-54960217
Ref: C API<39>-Footnote-64960282
Ref: C API<39>-Footnote-74960347
Ref: C API<39>-Footnote-84960412
Ref: C API<39>-Footnote-94960477
Ref: C API<39>-Footnote-104960542
Ref: C API<39>-Footnote-114960608
Ref: C API<39>-Footnote-124960674
Ref: C API<39>-Footnote-134960740
Ref: C API<39>-Footnote-144960806
Node: Python 3 11 0 alpha 14960872
Ref: whatsnew/changelog python-3-11-0-alpha-14961001
Ref: 1c8b4961001
Node: セキュリティ<34>4962222
Ref: whatsnew/changelog id5154962333
Ref: 1c8c4962333
Ref: セキュリティ<34>-Footnote-14963702
Ref: セキュリティ<34>-Footnote-24963767
Ref: セキュリティ<34>-Footnote-34963832
Ref: セキュリティ<34>-Footnote-44963897
Ref: セキュリティ<34>-Footnote-54963962
Ref: セキュリティ<34>-Footnote-64964017
Ref: セキュリティ<34>-Footnote-74964082
Node: Core and Builtins<108>4964147
Ref: whatsnew/changelog id5164964287
Ref: 1c8e4964287
Ref: Core and Builtins<108>-Footnote-14965391
Ref: Core and Builtins<108>-Footnote-24965456
Ref: Core and Builtins<108>-Footnote-34965521
Ref: Core and Builtins<108>-Footnote-44965586
Ref: Core and Builtins<108>-Footnote-54965651
Ref: Core and Builtins<108>-Footnote-64965716
Node: ライブラリ<111>4965781
Ref: whatsnew/changelog id5174965921
Ref: 1c904965921
Ref: ライブラリ<111>-Footnote-14966424
Ref: ライブラリ<111>-Footnote-24966489
Node: Core and Builtins<109>4966554
Ref: whatsnew/changelog id5184966692
Ref: 1c934966692
Ref: Core and Builtins<109>-Footnote-14966873
Node: ライブラリ<112>4966938
Ref: whatsnew/changelog id5194967078
Ref: 1c944967078
Ref: ライブラリ<112>-Footnote-14967342
Node: Core and Builtins<110>4967407
Ref: whatsnew/changelog id5204967545
Ref: 1c954967545
Ref: Core and Builtins<110>-Footnote-14970358
Ref: Core and Builtins<110>-Footnote-24970423
Ref: Core and Builtins<110>-Footnote-34970488
Ref: Core and Builtins<110>-Footnote-44970555
Ref: Core and Builtins<110>-Footnote-54970620
Ref: Core and Builtins<110>-Footnote-64970685
Ref: Core and Builtins<110>-Footnote-74970750
Ref: Core and Builtins<110>-Footnote-84970815
Ref: Core and Builtins<110>-Footnote-94970880
Node: ライブラリ<113>4970945
Ref: whatsnew/changelog id5214971085
Ref: 1c964971085
Ref: ライブラリ<113>-Footnote-14971369
Node: Core and Builtins<111>4971434
Ref: whatsnew/changelog id5224971572
Ref: 1c974971572
Ref: Core and Builtins<111>-Footnote-14972031
Ref: Core and Builtins<111>-Footnote-24972096
Ref: Core and Builtins<111>-Footnote-34972161
Node: ライブラリ<114>4972226
Ref: whatsnew/changelog id5234972366
Ref: 1c984972366
Ref: ライブラリ<114>-Footnote-14972716
Node: Core and Builtins<112>4972781
Ref: whatsnew/changelog id5244972919
Ref: 1c994972919
Ref: Core and Builtins<112>-Footnote-14973933
Ref: Core and Builtins<112>-Footnote-24973998
Ref: Core and Builtins<112>-Footnote-34974063
Ref: Core and Builtins<112>-Footnote-44974128
Ref: Core and Builtins<112>-Footnote-54974193
Node: ライブラリ<115>4974258
Ref: whatsnew/changelog id5254974398
Ref: 1c9a4974398
Ref: ライブラリ<115>-Footnote-14974607
Node: Core and Builtins<113>4974672
Ref: whatsnew/changelog id5264974810
Ref: 1c9b4974810
Ref: Core and Builtins<113>-Footnote-14979840
Ref: Core and Builtins<113>-Footnote-24979905
Ref: Core and Builtins<113>-Footnote-34979970
Ref: Core and Builtins<113>-Footnote-44980035
Ref: Core and Builtins<113>-Footnote-54980100
Ref: Core and Builtins<113>-Footnote-64980165
Ref: Core and Builtins<113>-Footnote-74980230
Ref: Core and Builtins<113>-Footnote-84980295
Ref: Core and Builtins<113>-Footnote-94980360
Ref: Core and Builtins<113>-Footnote-104980425
Ref: Core and Builtins<113>-Footnote-114980491
Ref: Core and Builtins<113>-Footnote-124980557
Ref: Core and Builtins<113>-Footnote-134980623
Ref: Core and Builtins<113>-Footnote-144980689
Ref: Core and Builtins<113>-Footnote-154980755
Ref: Core and Builtins<113>-Footnote-164980821
Ref: Core and Builtins<113>-Footnote-174980887
Ref: Core and Builtins<113>-Footnote-184980953
Ref: Core and Builtins<113>-Footnote-194981019
Ref: Core and Builtins<113>-Footnote-204981085
Ref: Core and Builtins<113>-Footnote-214981151
Ref: Core and Builtins<113>-Footnote-224981217
Ref: Core and Builtins<113>-Footnote-234981283
Ref: Core and Builtins<113>-Footnote-244981349
Ref: Core and Builtins<113>-Footnote-254981415
Ref: Core and Builtins<113>-Footnote-264981481
Ref: Core and Builtins<113>-Footnote-274981547
Ref: Core and Builtins<113>-Footnote-284981613
Ref: Core and Builtins<113>-Footnote-294981679
Ref: Core and Builtins<113>-Footnote-304981745
Ref: Core and Builtins<113>-Footnote-314981811
Ref: Core and Builtins<113>-Footnote-324981877
Node: ライブラリ<116>4981943
Ref: whatsnew/changelog id5274982083
Ref: 1c9d4982083
Ref: ライブラリ<116>-Footnote-14982361
Node: Core and Builtins<114>4982426
Ref: whatsnew/changelog id5284982564
Ref: 1c9e4982564
Ref: Core and Builtins<114>-Footnote-14984406
Ref: Core and Builtins<114>-Footnote-24984471
Ref: Core and Builtins<114>-Footnote-34984536
Ref: Core and Builtins<114>-Footnote-44984601
Ref: Core and Builtins<114>-Footnote-54984666
Ref: Core and Builtins<114>-Footnote-64984731
Ref: Core and Builtins<114>-Footnote-74984796
Ref: Core and Builtins<114>-Footnote-84984861
Ref: Core and Builtins<114>-Footnote-94984926
Node: ライブラリ<117>4984991
Ref: whatsnew/changelog id5294985131
Ref: 1c9f4985131
Ref: ライブラリ<117>-Footnote-14985468
Node: Core and Builtins<115>4985533
Ref: whatsnew/changelog id5304985671
Ref: 1ca04985671
Ref: Core and Builtins<115>-Footnote-14986204
Ref: Core and Builtins<115>-Footnote-24986269
Ref: Core and Builtins<115>-Footnote-34986311
Node: ライブラリ<118>4986376
Ref: whatsnew/changelog id5314986516
Ref: 1ca14986516
Ref: ライブラリ<118>-Footnote-14986837
Node: Core and Builtins<116>4986902
Ref: whatsnew/changelog id5324987040
Ref: 1ca24987040
Ref: Core and Builtins<116>-Footnote-14990800
Ref: Core and Builtins<116>-Footnote-24990865
Ref: Core and Builtins<116>-Footnote-34990907
Ref: Core and Builtins<116>-Footnote-44990972
Ref: Core and Builtins<116>-Footnote-54991037
Ref: Core and Builtins<116>-Footnote-64991102
Ref: Core and Builtins<116>-Footnote-74991167
Ref: Core and Builtins<116>-Footnote-84991232
Ref: Core and Builtins<116>-Footnote-94991297
Ref: Core and Builtins<116>-Footnote-104991362
Ref: Core and Builtins<116>-Footnote-114991428
Ref: Core and Builtins<116>-Footnote-124991494
Ref: Core and Builtins<116>-Footnote-134991560
Ref: Core and Builtins<116>-Footnote-144991626
Ref: Core and Builtins<116>-Footnote-154991692
Ref: Core and Builtins<116>-Footnote-164991758
Ref: Core and Builtins<116>-Footnote-174991824
Ref: Core and Builtins<116>-Footnote-184991890
Ref: Core and Builtins<116>-Footnote-194991956
Ref: Core and Builtins<116>-Footnote-204992022
Ref: Core and Builtins<116>-Footnote-214992088
Ref: Core and Builtins<116>-Footnote-224992154
Node: ライブラリ<119>4992220
Ref: whatsnew/changelog id5334992360
Ref: 1ca34992360
Ref: ライブラリ<119>-Footnote-14992625
Node: Core and Builtins<117>4992690
Ref: whatsnew/changelog id5344992828
Ref: 1ca44992828
Ref: Core and Builtins<117>-Footnote-14998481
Ref: Core and Builtins<117>-Footnote-24998546
Ref: Core and Builtins<117>-Footnote-34998611
Ref: Core and Builtins<117>-Footnote-44998676
Ref: Core and Builtins<117>-Footnote-54998741
Ref: Core and Builtins<117>-Footnote-64998806
Ref: Core and Builtins<117>-Footnote-74998871
Ref: Core and Builtins<117>-Footnote-84998936
Ref: Core and Builtins<117>-Footnote-94999001
Ref: Core and Builtins<117>-Footnote-104999066
Ref: Core and Builtins<117>-Footnote-114999132
Ref: Core and Builtins<117>-Footnote-124999198
Ref: Core and Builtins<117>-Footnote-134999264
Ref: Core and Builtins<117>-Footnote-144999330
Ref: Core and Builtins<117>-Footnote-154999396
Ref: Core and Builtins<117>-Footnote-164999462
Ref: Core and Builtins<117>-Footnote-174999528
Ref: Core and Builtins<117>-Footnote-184999594
Ref: Core and Builtins<117>-Footnote-194999660
Ref: Core and Builtins<117>-Footnote-204999726
Ref: Core and Builtins<117>-Footnote-214999792
Ref: Core and Builtins<117>-Footnote-224999858
Ref: Core and Builtins<117>-Footnote-234999924
Ref: Core and Builtins<117>-Footnote-244999990
Ref: Core and Builtins<117>-Footnote-255000056
Ref: Core and Builtins<117>-Footnote-265000122
Ref: Core and Builtins<117>-Footnote-275000188
Ref: Core and Builtins<117>-Footnote-285000254
Ref: Core and Builtins<117>-Footnote-295000320
Ref: Core and Builtins<117>-Footnote-305000386
Node: ライブラリ<120>5000452
Ref: whatsnew/changelog id5355000592
Ref: 1ca55000592
Ref: ライブラリ<120>-Footnote-15040366
Ref: ライブラリ<120>-Footnote-25040431
Ref: ライブラリ<120>-Footnote-35040496
Ref: ライブラリ<120>-Footnote-45040561
Ref: ライブラリ<120>-Footnote-55040628
Ref: ライブラリ<120>-Footnote-65040693
Ref: ライブラリ<120>-Footnote-75040758
Ref: ライブラリ<120>-Footnote-85040823
Ref: ライブラリ<120>-Footnote-95040888
Ref: ライブラリ<120>-Footnote-105040953
Ref: ライブラリ<120>-Footnote-115041019
Ref: ライブラリ<120>-Footnote-125041085
Ref: ライブラリ<120>-Footnote-135041151
Ref: ライブラリ<120>-Footnote-145041217
Ref: ライブラリ<120>-Footnote-155041283
Ref: ライブラリ<120>-Footnote-165041349
Ref: ライブラリ<120>-Footnote-175041415
Ref: ライブラリ<120>-Footnote-185041481
Ref: ライブラリ<120>-Footnote-195041547
Ref: ライブラリ<120>-Footnote-205041613
Ref: ライブラリ<120>-Footnote-215041679
Ref: ライブラリ<120>-Footnote-225041745
Ref: ライブラリ<120>-Footnote-235041811
Ref: ライブラリ<120>-Footnote-245041877
Ref: ライブラリ<120>-Footnote-255041943
Ref: ライブラリ<120>-Footnote-265042009
Ref: ライブラリ<120>-Footnote-275042075
Ref: ライブラリ<120>-Footnote-285042141
Ref: ライブラリ<120>-Footnote-295042207
Ref: ライブラリ<120>-Footnote-305042273
Ref: ライブラリ<120>-Footnote-315042339
Ref: ライブラリ<120>-Footnote-325042405
Ref: ライブラリ<120>-Footnote-335042471
Ref: ライブラリ<120>-Footnote-345042537
Ref: ライブラリ<120>-Footnote-355042603
Ref: ライブラリ<120>-Footnote-365042646
Ref: ライブラリ<120>-Footnote-375042712
Ref: ライブラリ<120>-Footnote-385042778
Ref: ライブラリ<120>-Footnote-395042844
Ref: ライブラリ<120>-Footnote-405042910
Ref: ライブラリ<120>-Footnote-415042976
Ref: ライブラリ<120>-Footnote-425043042
Ref: ライブラリ<120>-Footnote-435043108
Ref: ライブラリ<120>-Footnote-445043174
Ref: ライブラリ<120>-Footnote-455043240
Ref: ライブラリ<120>-Footnote-465043306
Ref: ライブラリ<120>-Footnote-475043372
Ref: ライブラリ<120>-Footnote-485043438
Ref: ライブラリ<120>-Footnote-495043504
Ref: ライブラリ<120>-Footnote-505043570
Ref: ライブラリ<120>-Footnote-515043636
Ref: ライブラリ<120>-Footnote-525043702
Ref: ライブラリ<120>-Footnote-535043768
Ref: ライブラリ<120>-Footnote-545043834
Ref: ライブラリ<120>-Footnote-555043900
Ref: ライブラリ<120>-Footnote-565043966
Ref: ライブラリ<120>-Footnote-575044032
Ref: ライブラリ<120>-Footnote-585044098
Ref: ライブラリ<120>-Footnote-595044164
Ref: ライブラリ<120>-Footnote-605044230
Ref: ライブラリ<120>-Footnote-615044296
Ref: ライブラリ<120>-Footnote-625044362
Ref: ライブラリ<120>-Footnote-635044428
Ref: ライブラリ<120>-Footnote-645044494
Ref: ライブラリ<120>-Footnote-655044560
Ref: ライブラリ<120>-Footnote-665044626
Ref: ライブラリ<120>-Footnote-675044692
Ref: ライブラリ<120>-Footnote-685044758
Ref: ライブラリ<120>-Footnote-695044824
Ref: ライブラリ<120>-Footnote-705044890
Ref: ライブラリ<120>-Footnote-715044956
Ref: ライブラリ<120>-Footnote-725045022
Ref: ライブラリ<120>-Footnote-735045088
Ref: ライブラリ<120>-Footnote-745045154
Ref: ライブラリ<120>-Footnote-755045220
Ref: ライブラリ<120>-Footnote-765045286
Ref: ライブラリ<120>-Footnote-775045352
Ref: ライブラリ<120>-Footnote-785045418
Ref: ライブラリ<120>-Footnote-795045484
Ref: ライブラリ<120>-Footnote-805045550
Ref: ライブラリ<120>-Footnote-815045616
Ref: ライブラリ<120>-Footnote-825045682
Ref: ライブラリ<120>-Footnote-835045748
Ref: ライブラリ<120>-Footnote-845045814
Ref: ライブラリ<120>-Footnote-855045880
Ref: ライブラリ<120>-Footnote-865045946
Ref: ライブラリ<120>-Footnote-875046012
Ref: ライブラリ<120>-Footnote-885046078
Ref: ライブラリ<120>-Footnote-895046144
Ref: ライブラリ<120>-Footnote-905046210
Ref: ライブラリ<120>-Footnote-915046276
Ref: ライブラリ<120>-Footnote-925046342
Ref: ライブラリ<120>-Footnote-935046408
Ref: ライブラリ<120>-Footnote-945046474
Ref: ライブラリ<120>-Footnote-955046540
Ref: ライブラリ<120>-Footnote-965046606
Ref: ライブラリ<120>-Footnote-975046672
Ref: ライブラリ<120>-Footnote-985046738
Ref: ライブラリ<120>-Footnote-995046804
Ref: ライブラリ<120>-Footnote-1005046870
Ref: ライブラリ<120>-Footnote-1015046937
Ref: ライブラリ<120>-Footnote-1025047004
Ref: ライブラリ<120>-Footnote-1035047071
Ref: ライブラリ<120>-Footnote-1045047138
Ref: ライブラリ<120>-Footnote-1055047205
Ref: ライブラリ<120>-Footnote-1065047272
Ref: ライブラリ<120>-Footnote-1075047339
Ref: ライブラリ<120>-Footnote-1085047406
Ref: ライブラリ<120>-Footnote-1095047473
Ref: ライブラリ<120>-Footnote-1105047540
Ref: ライブラリ<120>-Footnote-1115047607
Ref: ライブラリ<120>-Footnote-1125047674
Ref: ライブラリ<120>-Footnote-1135047741
Ref: ライブラリ<120>-Footnote-1145047808
Ref: ライブラリ<120>-Footnote-1155047875
Ref: ライブラリ<120>-Footnote-1165047942
Ref: ライブラリ<120>-Footnote-1175048009
Ref: ライブラリ<120>-Footnote-1185048076
Ref: ライブラリ<120>-Footnote-1195048143
Ref: ライブラリ<120>-Footnote-1205048210
Ref: ライブラリ<120>-Footnote-1215048277
Ref: ライブラリ<120>-Footnote-1225048344
Ref: ライブラリ<120>-Footnote-1235048411
Ref: ライブラリ<120>-Footnote-1245048478
Ref: ライブラリ<120>-Footnote-1255048545
Ref: ライブラリ<120>-Footnote-1265048612
Ref: ライブラリ<120>-Footnote-1275048679
Ref: ライブラリ<120>-Footnote-1285048746
Ref: ライブラリ<120>-Footnote-1295048813
Ref: ライブラリ<120>-Footnote-1305048880
Ref: ライブラリ<120>-Footnote-1315048947
Ref: ライブラリ<120>-Footnote-1325049014
Ref: ライブラリ<120>-Footnote-1335049081
Ref: ライブラリ<120>-Footnote-1345049148
Ref: ライブラリ<120>-Footnote-1355049215
Ref: ライブラリ<120>-Footnote-1365049282
Ref: ライブラリ<120>-Footnote-1375049349
Ref: ライブラリ<120>-Footnote-1385049416
Ref: ライブラリ<120>-Footnote-1395049483
Ref: ライブラリ<120>-Footnote-1405049550
Ref: ライブラリ<120>-Footnote-1415049617
Ref: ライブラリ<120>-Footnote-1425049684
Ref: ライブラリ<120>-Footnote-1435049751
Ref: ライブラリ<120>-Footnote-1445049818
Ref: ライブラリ<120>-Footnote-1455049885
Ref: ライブラリ<120>-Footnote-1465049952
Ref: ライブラリ<120>-Footnote-1475050019
Ref: ライブラリ<120>-Footnote-1485050085
Ref: ライブラリ<120>-Footnote-1495050152
Ref: ライブラリ<120>-Footnote-1505050219
Ref: ライブラリ<120>-Footnote-1515050280
Ref: ライブラリ<120>-Footnote-1525050347
Ref: ライブラリ<120>-Footnote-1535050414
Ref: ライブラリ<120>-Footnote-1545050481
Ref: ライブラリ<120>-Footnote-1555050548
Ref: ライブラリ<120>-Footnote-1565050615
Ref: ライブラリ<120>-Footnote-1575050682
Ref: ライブラリ<120>-Footnote-1585050749
Ref: ライブラリ<120>-Footnote-1595050816
Ref: ライブラリ<120>-Footnote-1605050860
Ref: ライブラリ<120>-Footnote-1615050927
Ref: ライブラリ<120>-Footnote-1625050994
Ref: ライブラリ<120>-Footnote-1635051061
Ref: ライブラリ<120>-Footnote-1645051128
Ref: ライブラリ<120>-Footnote-1655051195
Ref: ライブラリ<120>-Footnote-1665051262
Ref: ライブラリ<120>-Footnote-1675051329
Ref: ライブラリ<120>-Footnote-1685051396
Ref: ライブラリ<120>-Footnote-1695051463
Ref: ライブラリ<120>-Footnote-1705051530
Ref: ライブラリ<120>-Footnote-1715051597
Ref: ライブラリ<120>-Footnote-1725051664
Ref: ライブラリ<120>-Footnote-1735051731
Ref: ライブラリ<120>-Footnote-1745051798
Ref: ライブラリ<120>-Footnote-1755051865
Ref: ライブラリ<120>-Footnote-1765051932
Ref: ライブラリ<120>-Footnote-1775051999
Ref: ライブラリ<120>-Footnote-1785052066
Ref: ライブラリ<120>-Footnote-1795052133
Ref: ライブラリ<120>-Footnote-1805052200
Ref: ライブラリ<120>-Footnote-1815052267
Ref: ライブラリ<120>-Footnote-1825052334
Ref: ライブラリ<120>-Footnote-1835052401
Ref: ライブラリ<120>-Footnote-1845052468
Ref: ライブラリ<120>-Footnote-1855052535
Ref: ライブラリ<120>-Footnote-1865052602
Ref: ライブラリ<120>-Footnote-1875052669
Ref: ライブラリ<120>-Footnote-1885052736
Ref: ライブラリ<120>-Footnote-1895052803
Ref: ライブラリ<120>-Footnote-1905052870
Ref: ライブラリ<120>-Footnote-1915052937
Ref: ライブラリ<120>-Footnote-1925053004
Ref: ライブラリ<120>-Footnote-1935053071
Ref: ライブラリ<120>-Footnote-1945053138
Ref: ライブラリ<120>-Footnote-1955053205
Ref: ライブラリ<120>-Footnote-1965053271
Ref: ライブラリ<120>-Footnote-1975053338
Ref: ライブラリ<120>-Footnote-1985053405
Ref: ライブラリ<120>-Footnote-1995053472
Ref: ライブラリ<120>-Footnote-2005053539
Ref: ライブラリ<120>-Footnote-2015053606
Ref: ライブラリ<120>-Footnote-2025053673
Ref: ライブラリ<120>-Footnote-2035053740
Ref: ライブラリ<120>-Footnote-2045053807
Ref: ライブラリ<120>-Footnote-2055053874
Ref: ライブラリ<120>-Footnote-2065053941
Ref: ライブラリ<120>-Footnote-2075054008
Ref: ライブラリ<120>-Footnote-2085054075
Ref: ライブラリ<120>-Footnote-2095054142
Node: ドキュメント<39>5054209
Ref: whatsnew/changelog id5365054340
Ref: 1cbc5054340
Ref: ドキュメント<39>-Footnote-15060632
Ref: ドキュメント<39>-Footnote-25060697
Ref: ドキュメント<39>-Footnote-35060762
Ref: ドキュメント<39>-Footnote-45060827
Ref: ドキュメント<39>-Footnote-55060892
Ref: ドキュメント<39>-Footnote-65060957
Ref: ドキュメント<39>-Footnote-75061009
Ref: ドキュメント<39>-Footnote-85061074
Ref: ドキュメント<39>-Footnote-95061139
Ref: ドキュメント<39>-Footnote-105061198
Ref: ドキュメント<39>-Footnote-115061264
Ref: ドキュメント<39>-Footnote-125061330
Ref: ドキュメント<39>-Footnote-135061396
Ref: ドキュメント<39>-Footnote-145061462
Ref: ドキュメント<39>-Footnote-155061528
Ref: ドキュメント<39>-Footnote-165061594
Ref: ドキュメント<39>-Footnote-175061660
Ref: ドキュメント<39>-Footnote-185061726
Ref: ドキュメント<39>-Footnote-195061792
Ref: ドキュメント<39>-Footnote-205061858
Ref: ドキュメント<39>-Footnote-215061924
Ref: ドキュメント<39>-Footnote-225061990
Ref: ドキュメント<39>-Footnote-235062056
Ref: ドキュメント<39>-Footnote-245062122
Ref: ドキュメント<39>-Footnote-255062188
Ref: ドキュメント<39>-Footnote-265062254
Ref: ドキュメント<39>-Footnote-275062320
Ref: ドキュメント<39>-Footnote-285062386
Ref: ドキュメント<39>-Footnote-295062452
Ref: ドキュメント<39>-Footnote-305062518
Ref: ドキュメント<39>-Footnote-315062584
Ref: ドキュメント<39>-Footnote-325062650
Ref: ドキュメント<39>-Footnote-335062716
Ref: ドキュメント<39>-Footnote-345062782
Ref: ドキュメント<39>-Footnote-355062848
Ref: ドキュメント<39>-Footnote-365062914
Ref: ドキュメント<39>-Footnote-375062980
Ref: ドキュメント<39>-Footnote-385063046
Ref: ドキュメント<39>-Footnote-395063112
Ref: ドキュメント<39>-Footnote-405063178
Ref: ドキュメント<39>-Footnote-415063244
Ref: ドキュメント<39>-Footnote-425063310
Node: テスト<39>5063376
Ref: whatsnew/changelog id5375063500
Ref: 1cbe5063500
Ref: テスト<39>-Footnote-15069353
Ref: テスト<39>-Footnote-25069418
Ref: テスト<39>-Footnote-35069483
Ref: テスト<39>-Footnote-45069548
Ref: テスト<39>-Footnote-55069613
Ref: テスト<39>-Footnote-65069678
Ref: テスト<39>-Footnote-75069743
Ref: テスト<39>-Footnote-85069808
Ref: テスト<39>-Footnote-95069873
Ref: テスト<39>-Footnote-105069938
Ref: テスト<39>-Footnote-115070004
Ref: テスト<39>-Footnote-125070070
Ref: テスト<39>-Footnote-135070136
Ref: テスト<39>-Footnote-145070202
Ref: テスト<39>-Footnote-155070268
Ref: テスト<39>-Footnote-165070334
Ref: テスト<39>-Footnote-175070400
Ref: テスト<39>-Footnote-185070466
Ref: テスト<39>-Footnote-195070532
Ref: テスト<39>-Footnote-205070598
Ref: テスト<39>-Footnote-215070664
Ref: テスト<39>-Footnote-225070730
Ref: テスト<39>-Footnote-235070796
Ref: テスト<39>-Footnote-245070862
Ref: テスト<39>-Footnote-255070928
Ref: テスト<39>-Footnote-265070994
Ref: テスト<39>-Footnote-275071060
Ref: テスト<39>-Footnote-285071126
Ref: テスト<39>-Footnote-295071192
Ref: テスト<39>-Footnote-305071258
Ref: テスト<39>-Footnote-315071324
Ref: テスト<39>-Footnote-325071390
Ref: テスト<39>-Footnote-335071456
Ref: テスト<39>-Footnote-345071522
Ref: テスト<39>-Footnote-355071588
Node: ビルド<46>5071654
Ref: whatsnew/changelog id5385071767
Ref: 1cc15071767
Ref: ビルド<46>-Footnote-15073845
Ref: ビルド<46>-Footnote-25073910
Ref: ビルド<46>-Footnote-35073975
Ref: ビルド<46>-Footnote-45074040
Ref: ビルド<46>-Footnote-55074105
Ref: ビルド<46>-Footnote-65074170
Ref: ビルド<46>-Footnote-75074235
Ref: ビルド<46>-Footnote-85074300
Ref: ビルド<46>-Footnote-95074365
Ref: ビルド<46>-Footnote-105074430
Ref: ビルド<46>-Footnote-115074496
Node: Windows<39>5074562
Ref: whatsnew/changelog id5395074671
Ref: 1cc25074671
Ref: Windows<39>-Footnote-15075781
Ref: Windows<39>-Footnote-25075846
Ref: Windows<39>-Footnote-35075911
Ref: Windows<39>-Footnote-45075976
Ref: Windows<39>-Footnote-55076041
Ref: Windows<39>-Footnote-65076106
Ref: Windows<39>-Footnote-75076171
Ref: Windows<39>-Footnote-85076236
Ref: Windows<39>-Footnote-95076301
Node: macOS<30>5076366
Ref: whatsnew/changelog id5405076470
Ref: 1cc45076470
Ref: macOS<30>-Footnote-15077617
Ref: macOS<30>-Footnote-25077682
Ref: macOS<30>-Footnote-35077747
Ref: macOS<30>-Footnote-45077812
Ref: macOS<30>-Footnote-55077877
Ref: macOS<30>-Footnote-65077942
Ref: macOS<30>-Footnote-75078007
Node: IDLE<20>5078072
Ref: whatsnew/changelog id5415078180
Ref: 1cc55078180
Ref: IDLE<20>-Footnote-15079696
Ref: IDLE<20>-Footnote-25079761
Ref: IDLE<20>-Footnote-35079826
Ref: IDLE<20>-Footnote-45079891
Ref: IDLE<20>-Footnote-55079956
Ref: IDLE<20>-Footnote-65080021
Ref: IDLE<20>-Footnote-75080086
Ref: IDLE<20>-Footnote-85080151
Ref: IDLE<20>-Footnote-95080216
Node: Tools/Demos<27>5080281
Ref: whatsnew/changelog id5425080389
Ref: 1cc65080389
Ref: Tools/Demos<27>-Footnote-15081185
Ref: Tools/Demos<27>-Footnote-25081250
Ref: Tools/Demos<27>-Footnote-35081315
Ref: Tools/Demos<27>-Footnote-45081380
Ref: Tools/Demos<27>-Footnote-55081445
Ref: Tools/Demos<27>-Footnote-65081510
Node: C API<40>5081575
Ref: whatsnew/changelog id5435081666
Ref: 1cc75081666
Ref: C API<40>-Footnote-15087506
Ref: C API<40>-Footnote-25087571
Ref: C API<40>-Footnote-35087636
Ref: C API<40>-Footnote-45087701
Ref: C API<40>-Footnote-55087766
Ref: C API<40>-Footnote-65087831
Ref: C API<40>-Footnote-75087896
Ref: C API<40>-Footnote-85087961
Ref: C API<40>-Footnote-95088026
Ref: C API<40>-Footnote-105088091
Ref: C API<40>-Footnote-115088157
Ref: C API<40>-Footnote-125088223
Ref: C API<40>-Footnote-135088289
Ref: C API<40>-Footnote-145088355
Ref: C API<40>-Footnote-155088421
Ref: C API<40>-Footnote-165088487
Ref: C API<40>-Footnote-175088553
Ref: C API<40>-Footnote-185088619
Ref: C API<40>-Footnote-195088685
Ref: C API<40>-Footnote-205088751
Ref: C API<40>-Footnote-215088794
Ref: C API<40>-Footnote-225088860
Ref: C API<40>-Footnote-235088926
Ref: C API<40>-Footnote-245088992
Ref: C API<40>-Footnote-255089035
Ref: C API<40>-Footnote-265089078
Node: Python 3 10 0 beta 15089144
Ref: whatsnew/changelog python-3-10-0-beta-15089273
Ref: 1cc95089273
Node: セキュリティ<35>5089861
Ref: whatsnew/changelog id5445089971
Ref: 1cca5089971
Ref: セキュリティ<35>-Footnote-15092909
Ref: セキュリティ<35>-Footnote-25092974
Ref: セキュリティ<35>-Footnote-35093039
Ref: セキュリティ<35>-Footnote-45093104
Ref: セキュリティ<35>-Footnote-55093169
Ref: セキュリティ<35>-Footnote-65093234
Ref: セキュリティ<35>-Footnote-75093299
Ref: セキュリティ<35>-Footnote-85093364
Ref: セキュリティ<35>-Footnote-95093429
Ref: セキュリティ<35>-Footnote-105093494
Ref: セキュリティ<35>-Footnote-115093560
Node: Core and Builtins<118>5093626
Ref: whatsnew/changelog id5455093765
Ref: 1ccd5093765
Ref: Core and Builtins<118>-Footnote-15095119
Ref: Core and Builtins<118>-Footnote-25095184
Ref: Core and Builtins<118>-Footnote-35095249
Ref: Core and Builtins<118>-Footnote-45095314
Ref: Core and Builtins<118>-Footnote-55095379
Ref: Core and Builtins<118>-Footnote-65095444
Ref: Core and Builtins<118>-Footnote-75095509
Node: ライブラリ<121>5095574
Ref: whatsnew/changelog id5465095713
Ref: 1ccf5095713
Ref: ライブラリ<121>-Footnote-15095989
Ref: ライブラリ<121>-Footnote-25096054
Node: Core and Builtins<119>5096119
Ref: whatsnew/changelog id5475096256
Ref: 1cd05096256
Ref: Core and Builtins<119>-Footnote-15100273
Ref: Core and Builtins<119>-Footnote-25100338
Ref: Core and Builtins<119>-Footnote-35100403
Ref: Core and Builtins<119>-Footnote-45100468
Ref: Core and Builtins<119>-Footnote-55100533
Ref: Core and Builtins<119>-Footnote-65100575
Ref: Core and Builtins<119>-Footnote-75100640
Ref: Core and Builtins<119>-Footnote-85100705
Ref: Core and Builtins<119>-Footnote-95100770
Ref: Core and Builtins<119>-Footnote-105100835
Ref: Core and Builtins<119>-Footnote-115100901
Ref: Core and Builtins<119>-Footnote-125100967
Ref: Core and Builtins<119>-Footnote-135101033
Ref: Core and Builtins<119>-Footnote-145101099
Ref: Core and Builtins<119>-Footnote-155101165
Ref: Core and Builtins<119>-Footnote-165101231
Ref: Core and Builtins<119>-Footnote-175101297
Ref: Core and Builtins<119>-Footnote-185101363
Ref: Core and Builtins<119>-Footnote-195101429
Ref: Core and Builtins<119>-Footnote-205101495
Ref: Core and Builtins<119>-Footnote-215101561
Ref: Core and Builtins<119>-Footnote-225101627
Node: ライブラリ<122>5101693
Ref: whatsnew/changelog id5485101832
Ref: 1cd35101832
Ref: ライブラリ<122>-Footnote-15102034
Node: Core and Builtins<120>5102099
Ref: whatsnew/changelog id5495102236
Ref: 1cd45102236
Ref: Core and Builtins<120>-Footnote-15102888
Ref: Core and Builtins<120>-Footnote-25102953
Ref: Core and Builtins<120>-Footnote-35103018
Node: ライブラリ<123>5103083
Ref: whatsnew/changelog id5505103222
Ref: 1cd55103222
Ref: ライブラリ<123>-Footnote-15119982
Ref: ライブラリ<123>-Footnote-25120047
Ref: ライブラリ<123>-Footnote-35120112
Ref: ライブラリ<123>-Footnote-45120177
Ref: ライブラリ<123>-Footnote-55120242
Ref: ライブラリ<123>-Footnote-65120307
Ref: ライブラリ<123>-Footnote-75120372
Ref: ライブラリ<123>-Footnote-85120437
Ref: ライブラリ<123>-Footnote-95120502
Ref: ライブラリ<123>-Footnote-105120567
Ref: ライブラリ<123>-Footnote-115120633
Ref: ライブラリ<123>-Footnote-125120699
Ref: ライブラリ<123>-Footnote-135120765
Ref: ライブラリ<123>-Footnote-145120831
Ref: ライブラリ<123>-Footnote-155120897
Ref: ライブラリ<123>-Footnote-165120963
Ref: ライブラリ<123>-Footnote-175121029
Ref: ライブラリ<123>-Footnote-185121095
Ref: ライブラリ<123>-Footnote-195121161
Ref: ライブラリ<123>-Footnote-205121227
Ref: ライブラリ<123>-Footnote-215121293
Ref: ライブラリ<123>-Footnote-225121359
Ref: ライブラリ<123>-Footnote-235121402
Ref: ライブラリ<123>-Footnote-245121468
Ref: ライブラリ<123>-Footnote-255121534
Ref: ライブラリ<123>-Footnote-265121600
Ref: ライブラリ<123>-Footnote-275121666
Ref: ライブラリ<123>-Footnote-285121732
Ref: ライブラリ<123>-Footnote-295121798
Ref: ライブラリ<123>-Footnote-305121864
Ref: ライブラリ<123>-Footnote-315121930
Ref: ライブラリ<123>-Footnote-325121996
Ref: ライブラリ<123>-Footnote-335122062
Ref: ライブラリ<123>-Footnote-345122128
Ref: ライブラリ<123>-Footnote-355122194
Ref: ライブラリ<123>-Footnote-365122260
Ref: ライブラリ<123>-Footnote-375122326
Ref: ライブラリ<123>-Footnote-385122392
Ref: ライブラリ<123>-Footnote-395122458
Ref: ライブラリ<123>-Footnote-405122524
Ref: ライブラリ<123>-Footnote-415122590
Ref: ライブラリ<123>-Footnote-425122656
Ref: ライブラリ<123>-Footnote-435122699
Ref: ライブラリ<123>-Footnote-445122765
Ref: ライブラリ<123>-Footnote-455122831
Ref: ライブラリ<123>-Footnote-465122887
Ref: ライブラリ<123>-Footnote-475122953
Ref: ライブラリ<123>-Footnote-485123019
Ref: ライブラリ<123>-Footnote-495123085
Ref: ライブラリ<123>-Footnote-505123151
Ref: ライブラリ<123>-Footnote-515123217
Ref: ライブラリ<123>-Footnote-525123283
Ref: ライブラリ<123>-Footnote-535123349
Ref: ライブラリ<123>-Footnote-545123414
Ref: ライブラリ<123>-Footnote-555123480
Ref: ライブラリ<123>-Footnote-565123546
Ref: ライブラリ<123>-Footnote-575123612
Ref: ライブラリ<123>-Footnote-585123677
Ref: ライブラリ<123>-Footnote-595123743
Ref: ライブラリ<123>-Footnote-605123809
Ref: ライブラリ<123>-Footnote-615123875
Ref: ライブラリ<123>-Footnote-625123941
Ref: ライブラリ<123>-Footnote-635124007
Ref: ライブラリ<123>-Footnote-645124073
Ref: ライブラリ<123>-Footnote-655124139
Ref: ライブラリ<123>-Footnote-665124205
Ref: ライブラリ<123>-Footnote-675124271
Ref: ライブラリ<123>-Footnote-685124337
Ref: ライブラリ<123>-Footnote-695124380
Ref: ライブラリ<123>-Footnote-705124446
Ref: ライブラリ<123>-Footnote-715124512
Ref: ライブラリ<123>-Footnote-725124578
Ref: ライブラリ<123>-Footnote-735124644
Ref: ライブラリ<123>-Footnote-745124710
Ref: ライブラリ<123>-Footnote-755124776
Ref: ライブラリ<123>-Footnote-765124842
Ref: ライブラリ<123>-Footnote-775124908
Ref: ライブラリ<123>-Footnote-785124974
Ref: ライブラリ<123>-Footnote-795125040
Ref: ライブラリ<123>-Footnote-805125106
Ref: ライブラリ<123>-Footnote-815125172
Ref: ライブラリ<123>-Footnote-825125238
Ref: ライブラリ<123>-Footnote-835125304
Node: ドキュメント<40>5125370
Ref: whatsnew/changelog id5515125500
Ref: 1cdb5125500
Ref: ドキュメント<40>-Footnote-15126512
Ref: ドキュメント<40>-Footnote-25126577
Ref: ドキュメント<40>-Footnote-35126642
Ref: ドキュメント<40>-Footnote-45126707
Ref: ドキュメント<40>-Footnote-55126772
Ref: ドキュメント<40>-Footnote-65126837
Ref: ドキュメント<40>-Footnote-75126902
Node: テスト<40>5126967
Ref: whatsnew/changelog id5525127090
Ref: 1cdc5127090
Ref: テスト<40>-Footnote-15128172
Ref: テスト<40>-Footnote-25128237
Ref: テスト<40>-Footnote-35128302
Ref: テスト<40>-Footnote-45128367
Ref: テスト<40>-Footnote-55128432
Node: ビルド<47>5128497
Ref: whatsnew/changelog id5535128609
Ref: 1cdd5128609
Ref: ビルド<47>-Footnote-15128876
Ref: ビルド<47>-Footnote-25128941
Ref: ビルド<47>-Footnote-35129006
Node: Windows<40>5129048
Ref: whatsnew/changelog id5545129156
Ref: 1cde5129156
Ref: Windows<40>-Footnote-15130499
Ref: Windows<40>-Footnote-25130564
Ref: Windows<40>-Footnote-35130629
Ref: Windows<40>-Footnote-45130694
Ref: Windows<40>-Footnote-55130759
Ref: Windows<40>-Footnote-65130824
Ref: Windows<40>-Footnote-75130889
Ref: Windows<40>-Footnote-85130954
Ref: Windows<40>-Footnote-95131019
Node: macOS<31>5131084
Ref: whatsnew/changelog id5555131187
Ref: 1ce25131187
Ref: macOS<31>-Footnote-15132487
Ref: macOS<31>-Footnote-25132552
Ref: macOS<31>-Footnote-35132617
Ref: macOS<31>-Footnote-45132682
Ref: macOS<31>-Footnote-55132747
Ref: macOS<31>-Footnote-65132812
Node: IDLE<21>5132877
Ref: whatsnew/changelog id5565132978
Ref: 1ce35132978
Ref: IDLE<21>-Footnote-15133774
Ref: IDLE<21>-Footnote-25133839
Ref: IDLE<21>-Footnote-35133904
Ref: IDLE<21>-Footnote-45133969
Ref: IDLE<21>-Footnote-55134034
Node: C API<41>5134099
Ref: whatsnew/changelog id5575134182
Ref: 1ce45134182
Ref: C API<41>-Footnote-15136431
Ref: C API<41>-Footnote-25136496
Ref: C API<41>-Footnote-35136561
Ref: C API<41>-Footnote-45136626
Ref: C API<41>-Footnote-55136691
Ref: C API<41>-Footnote-65136756
Ref: C API<41>-Footnote-75136821
Ref: C API<41>-Footnote-85136886
Ref: C API<41>-Footnote-95136951
Ref: C API<41>-Footnote-105136993
Node: Python 3 10 0 alpha 75137059
Ref: whatsnew/changelog python-3-10-0-alpha-75137188
Ref: 1ce55137188
Node: セキュリティ<36>5137669
Ref: whatsnew/changelog id5585137780
Ref: 1ce65137780
Ref: セキュリティ<36>-Footnote-15138878
Ref: セキュリティ<36>-Footnote-25138943
Ref: セキュリティ<36>-Footnote-35138998
Ref: セキュリティ<36>-Footnote-45139063
Node: Core and Builtins<121>5139128
Ref: whatsnew/changelog id5595139268
Ref: 1ce75139268
Ref: Core and Builtins<121>-Footnote-15139888
Ref: Core and Builtins<121>-Footnote-25139953
Ref: Core and Builtins<121>-Footnote-35140018
Ref: Core and Builtins<121>-Footnote-45140083
Node: ライブラリ<124>5140148
Ref: whatsnew/changelog id5605140288
Ref: 1ce85140288
Ref: ライブラリ<124>-Footnote-15140477
Node: Core and Builtins<122>5140542
Ref: whatsnew/changelog id5615140680
Ref: 1ce95140680
Ref: Core and Builtins<122>-Footnote-15144559
Ref: Core and Builtins<122>-Footnote-25144624
Ref: Core and Builtins<122>-Footnote-35144689
Ref: Core and Builtins<122>-Footnote-45144754
Ref: Core and Builtins<122>-Footnote-55144796
Ref: Core and Builtins<122>-Footnote-65144861
Ref: Core and Builtins<122>-Footnote-75144926
Ref: Core and Builtins<122>-Footnote-85144991
Ref: Core and Builtins<122>-Footnote-95145056
Ref: Core and Builtins<122>-Footnote-105145121
Ref: Core and Builtins<122>-Footnote-115145187
Ref: Core and Builtins<122>-Footnote-125145253
Ref: Core and Builtins<122>-Footnote-135145319
Ref: Core and Builtins<122>-Footnote-145145385
Ref: Core and Builtins<122>-Footnote-155145451
Ref: Core and Builtins<122>-Footnote-165145517
Ref: Core and Builtins<122>-Footnote-175145583
Ref: Core and Builtins<122>-Footnote-185145626
Ref: Core and Builtins<122>-Footnote-195145692
Node: ライブラリ<125>5145758
Ref: whatsnew/changelog id5625145898
Ref: 1cea5145898
Ref: ライブラリ<125>-Footnote-15153578
Ref: ライブラリ<125>-Footnote-25153643
Ref: ライブラリ<125>-Footnote-35153708
Ref: ライブラリ<125>-Footnote-45153773
Ref: ライブラリ<125>-Footnote-55153838
Ref: ライブラリ<125>-Footnote-65153903
Ref: ライブラリ<125>-Footnote-75153968
Ref: ライブラリ<125>-Footnote-85154033
Ref: ライブラリ<125>-Footnote-95154098
Ref: ライブラリ<125>-Footnote-105154163
Ref: ライブラリ<125>-Footnote-115154229
Ref: ライブラリ<125>-Footnote-125154295
Ref: ライブラリ<125>-Footnote-135154361
Ref: ライブラリ<125>-Footnote-145154427
Ref: ライブラリ<125>-Footnote-155154493
Ref: ライブラリ<125>-Footnote-165154536
Ref: ライブラリ<125>-Footnote-175154602
Ref: ライブラリ<125>-Footnote-185154668
Ref: ライブラリ<125>-Footnote-195154734
Ref: ライブラリ<125>-Footnote-205154800
Ref: ライブラリ<125>-Footnote-215154866
Ref: ライブラリ<125>-Footnote-225154932
Ref: ライブラリ<125>-Footnote-235154998
Ref: ライブラリ<125>-Footnote-245155064
Ref: ライブラリ<125>-Footnote-255155130
Ref: ライブラリ<125>-Footnote-265155212
Ref: ライブラリ<125>-Footnote-275155278
Ref: ライブラリ<125>-Footnote-285155344
Ref: ライブラリ<125>-Footnote-295155410
Ref: ライブラリ<125>-Footnote-305155476
Ref: ライブラリ<125>-Footnote-315155542
Ref: ライブラリ<125>-Footnote-325155608
Ref: ライブラリ<125>-Footnote-335155674
Ref: ライブラリ<125>-Footnote-345155740
Ref: ライブラリ<125>-Footnote-355155806
Ref: ライブラリ<125>-Footnote-365155872
Ref: ライブラリ<125>-Footnote-375155938
Ref: ライブラリ<125>-Footnote-385156004
Ref: ライブラリ<125>-Footnote-395156070
Ref: ライブラリ<125>-Footnote-405156136
Ref: ライブラリ<125>-Footnote-415156202
Ref: ライブラリ<125>-Footnote-425156268
Ref: ライブラリ<125>-Footnote-435156334
Ref: ライブラリ<125>-Footnote-445156400
Ref: ライブラリ<125>-Footnote-455156466
Node: ドキュメント<41>5156532
Ref: whatsnew/changelog id5635156663
Ref: 1cf15156663
Ref: ドキュメント<41>-Footnote-15157361
Ref: ドキュメント<41>-Footnote-25157426
Ref: ドキュメント<41>-Footnote-35157491
Ref: ドキュメント<41>-Footnote-45157556
Node: テスト<41>5157621
Ref: whatsnew/changelog id5645157745
Ref: 1cf25157745
Ref: テスト<41>-Footnote-15158053
Ref: テスト<41>-Footnote-25158118
Node: ビルド<48>5158183
Ref: whatsnew/changelog id5655158296
Ref: 1cf35158296
Ref: ビルド<48>-Footnote-15159272
Ref: ビルド<48>-Footnote-25159337
Ref: ビルド<48>-Footnote-35159402
Ref: ビルド<48>-Footnote-45159467
Ref: ビルド<48>-Footnote-55159532
Ref: ビルド<48>-Footnote-65159597
Node: Windows<41>5159662
Ref: whatsnew/changelog id5665159770
Ref: 1cf45159770
Ref: Windows<41>-Footnote-15159960
Node: IDLE<22>5160025
Ref: whatsnew/changelog id5675160129
Ref: 1cf55160129
Ref: IDLE<22>-Footnote-15160372
Node: C API<42>5160437
Ref: whatsnew/changelog id5685160521
Ref: 1cf65160521
Ref: C API<42>-Footnote-15163987
Ref: C API<42>-Footnote-25164052
Ref: C API<42>-Footnote-35164117
Ref: C API<42>-Footnote-45164182
Ref: C API<42>-Footnote-55164247
Ref: C API<42>-Footnote-65164312
Ref: C API<42>-Footnote-75164377
Ref: C API<42>-Footnote-85164442
Ref: C API<42>-Footnote-95164507
Node: Python 3 10 0 alpha 65164549
Ref: whatsnew/changelog python-3-10-0-alpha-65164679
Ref: 1cf75164679
Node: セキュリティ<37>5165266
Ref: whatsnew/changelog id5695165377
Ref: 1cf85165377
Ref: セキュリティ<37>-Footnote-15165637
Node: Core and Builtins<123>5165702
Ref: whatsnew/changelog id5705165842
Ref: 1cf95165842
Ref: Core and Builtins<123>-Footnote-15167487
Ref: Core and Builtins<123>-Footnote-25167552
Ref: Core and Builtins<123>-Footnote-35167617
Ref: Core and Builtins<123>-Footnote-45167659
Ref: Core and Builtins<123>-Footnote-55167724
Ref: Core and Builtins<123>-Footnote-65167789
Ref: Core and Builtins<123>-Footnote-75167854
Ref: Core and Builtins<123>-Footnote-85167919
Node: ライブラリ<126>5167984
Ref: whatsnew/changelog id5715168124
Ref: 1cfa5168124
Ref: ライブラリ<126>-Footnote-15168831
Node: Core and Builtins<124>5168896
Ref: whatsnew/changelog id5725169034
Ref: 1cfb5169034
Ref: Core and Builtins<124>-Footnote-15169724
Ref: Core and Builtins<124>-Footnote-25169789
Ref: Core and Builtins<124>-Footnote-35169854
Ref: Core and Builtins<124>-Footnote-45169919
Ref: Core and Builtins<124>-Footnote-55169984
Node: ライブラリ<127>5170026
Ref: whatsnew/changelog id5735170166
Ref: 1cfc5170166
Ref: ライブラリ<127>-Footnote-15170587
Node: Core and Builtins<125>5170652
Ref: whatsnew/changelog id5745170790
Ref: 1cfd5170790
Ref: Core and Builtins<125>-Footnote-15171103
Node: ライブラリ<128>5171168
Ref: whatsnew/changelog id5755171308
Ref: 1cfe5171308
Ref: ライブラリ<128>-Footnote-15174155
Ref: ライブラリ<128>-Footnote-25174220
Ref: ライブラリ<128>-Footnote-35174285
Ref: ライブラリ<128>-Footnote-45174350
Ref: ライブラリ<128>-Footnote-55174415
Ref: ライブラリ<128>-Footnote-65174480
Ref: ライブラリ<128>-Footnote-75174545
Ref: ライブラリ<128>-Footnote-85174610
Ref: ライブラリ<128>-Footnote-95174675
Ref: ライブラリ<128>-Footnote-105174740
Ref: ライブラリ<128>-Footnote-115174806
Ref: ライブラリ<128>-Footnote-125174872
Ref: ライブラリ<128>-Footnote-135174938
Ref: ライブラリ<128>-Footnote-145175004
Ref: ライブラリ<128>-Footnote-155175070
Ref: ライブラリ<128>-Footnote-165175136
Node: ドキュメント<42>5175202
Ref: whatsnew/changelog id5765175333
Ref: 1d025175333
Ref: ドキュメント<42>-Footnote-15175679
Ref: ドキュメント<42>-Footnote-25175744
Ref: ドキュメント<42>-Footnote-35175809
Node: テスト<42>5175851
Ref: whatsnew/changelog id5775175975
Ref: 1d035175975
Ref: テスト<42>-Footnote-15176171
Node: ビルド<49>5176236
Ref: whatsnew/changelog id5785176349
Ref: 1d045176349
Ref: ビルド<49>-Footnote-15177421
Ref: ビルド<49>-Footnote-25177486
Ref: ビルド<49>-Footnote-35177551
Ref: ビルド<49>-Footnote-45177616
Ref: ビルド<49>-Footnote-55177681
Node: Windows<42>5177746
Ref: whatsnew/changelog id5795177855
Ref: 1d055177855
Ref: Windows<42>-Footnote-15178021
Node: macOS<32>5178086
Ref: whatsnew/changelog id5805178190
Ref: 1d075178190
Ref: macOS<32>-Footnote-15178333
Node: IDLE<23>5178398
Ref: whatsnew/changelog id5815178500
Ref: 1d085178500
Ref: IDLE<23>-Footnote-15178770
Node: C API<43>5178835
Ref: whatsnew/changelog id5825178919
Ref: 1d095178919
Ref: C API<43>-Footnote-15180673
Ref: C API<43>-Footnote-25180738
Ref: C API<43>-Footnote-35180803
Ref: C API<43>-Footnote-45180868
Ref: C API<43>-Footnote-55180933
Ref: C API<43>-Footnote-65180998
Ref: C API<43>-Footnote-75181063
Ref: C API<43>-Footnote-85181128
Ref: C API<43>-Footnote-95181193
Node: Python 3 10 0 alpha 55181258
Ref: whatsnew/changelog python-3-10-0-alpha-55181388
Ref: 1d115181388
Node: セキュリティ<38>5181889
Ref: whatsnew/changelog id5835182000
Ref: 1d125182000
Ref: セキュリティ<38>-Footnote-15182236
Node: Core and Builtins<126>5182301
Ref: whatsnew/changelog id5845182441
Ref: 1d155182441
Ref: Core and Builtins<126>-Footnote-15184567
Ref: Core and Builtins<126>-Footnote-25184632
Ref: Core and Builtins<126>-Footnote-35184697
Ref: Core and Builtins<126>-Footnote-45184762
Ref: Core and Builtins<126>-Footnote-55184827
Ref: Core and Builtins<126>-Footnote-65184892
Ref: Core and Builtins<126>-Footnote-75184957
Ref: Core and Builtins<126>-Footnote-85185022
Ref: Core and Builtins<126>-Footnote-95185087
Ref: Core and Builtins<126>-Footnote-105185152
Ref: Core and Builtins<126>-Footnote-115185218
Ref: Core and Builtins<126>-Footnote-125185284
Node: ライブラリ<129>5185350
Ref: whatsnew/changelog id5855185490
Ref: 1d165185490
Ref: ライブラリ<129>-Footnote-15185725
Node: Core and Builtins<127>5185790
Ref: whatsnew/changelog id5865185928
Ref: 1d175185928
Ref: Core and Builtins<127>-Footnote-15186267
Ref: Core and Builtins<127>-Footnote-25186332
Node: ライブラリ<130>5186397
Ref: whatsnew/changelog id5875186537
Ref: 1d185186537
Ref: ライブラリ<130>-Footnote-15191482
Ref: ライブラリ<130>-Footnote-25191547
Ref: ライブラリ<130>-Footnote-35191612
Ref: ライブラリ<130>-Footnote-45191677
Ref: ライブラリ<130>-Footnote-55191742
Ref: ライブラリ<130>-Footnote-65191807
Ref: ライブラリ<130>-Footnote-75191872
Ref: ライブラリ<130>-Footnote-85191937
Ref: ライブラリ<130>-Footnote-95192002
Ref: ライブラリ<130>-Footnote-105192067
Ref: ライブラリ<130>-Footnote-115192133
Ref: ライブラリ<130>-Footnote-125192199
Ref: ライブラリ<130>-Footnote-135192265
Ref: ライブラリ<130>-Footnote-145192331
Ref: ライブラリ<130>-Footnote-155192397
Ref: ライブラリ<130>-Footnote-165192463
Ref: ライブラリ<130>-Footnote-175192529
Ref: ライブラリ<130>-Footnote-185192595
Ref: ライブラリ<130>-Footnote-195192638
Ref: ライブラリ<130>-Footnote-205192704
Ref: ライブラリ<130>-Footnote-215192770
Ref: ライブラリ<130>-Footnote-225192836
Ref: ライブラリ<130>-Footnote-235192902
Ref: ライブラリ<130>-Footnote-245192970
Ref: ライブラリ<130>-Footnote-255193013
Ref: ライブラリ<130>-Footnote-265193079
Ref: ライブラリ<130>-Footnote-275193145
Ref: ライブラリ<130>-Footnote-285193211
Ref: ライブラリ<130>-Footnote-295193277
Ref: ライブラリ<130>-Footnote-305193343
Ref: ライブラリ<130>-Footnote-315193409
Ref: ライブラリ<130>-Footnote-325193475
Ref: ライブラリ<130>-Footnote-335193541
Ref: ライブラリ<130>-Footnote-345193607
Node: ドキュメント<43>5193673
Ref: whatsnew/changelog id5885193804
Ref: 1d195193804
Ref: ドキュメント<43>-Footnote-15194136
Ref: ドキュメント<43>-Footnote-25194201
Node: テスト<43>5194266
Ref: whatsnew/changelog id5895194390
Ref: 1d1a5194390
Ref: テスト<43>-Footnote-15194751
Ref: テスト<43>-Footnote-25194816
Node: ビルド<50>5194881
Ref: whatsnew/changelog id5905194994
Ref: 1d1b5194994
Ref: ビルド<50>-Footnote-15196192
Ref: ビルド<50>-Footnote-25196257
Ref: ビルド<50>-Footnote-35196322
Ref: ビルド<50>-Footnote-45196387
Ref: ビルド<50>-Footnote-55196452
Node: Windows<43>5196517
Ref: whatsnew/changelog id5915196626
Ref: 1d1c5196626
Ref: Windows<43>-Footnote-15196839
Ref: Windows<43>-Footnote-25196904
Node: macOS<33>5196969
Ref: whatsnew/changelog id5925197073
Ref: 1d1d5197073
Ref: macOS<33>-Footnote-15197322
Node: IDLE<24>5197387
Ref: whatsnew/changelog id5935197489
Ref: 1d1e5197489
Ref: IDLE<24>-Footnote-15198053
Ref: IDLE<24>-Footnote-25198118
Ref: IDLE<24>-Footnote-35198183
Ref: IDLE<24>-Footnote-45198248
Node: C API<44>5198313
Ref: whatsnew/changelog id5945198397
Ref: 1d1f5198397
Ref: C API<44>-Footnote-15199003
Ref: C API<44>-Footnote-25199068
Node: Python 3 10 0 alpha 45199133
Ref: whatsnew/changelog python-3-10-0-alpha-45199263
Ref: 1d215199263
Node: Core and Builtins<128>5199794
Ref: whatsnew/changelog id5955199903
Ref: 1d225199903
Ref: Core and Builtins<128>-Footnote-15201375
Ref: Core and Builtins<128>-Footnote-25201440
Ref: Core and Builtins<128>-Footnote-35201505
Ref: Core and Builtins<128>-Footnote-45201570
Ref: Core and Builtins<128>-Footnote-55201635
Ref: Core and Builtins<128>-Footnote-65201700
Ref: Core and Builtins<128>-Footnote-75201765
Ref: Core and Builtins<128>-Footnote-85201830
Ref: Core and Builtins<128>-Footnote-95201895
Ref: Core and Builtins<128>-Footnote-105201960
Node: ライブラリ<131>5202026
Ref: whatsnew/changelog id5965202166
Ref: 1d235202166
Ref: ライブラリ<131>-Footnote-15202442
Node: Core and Builtins<129>5202507
Ref: whatsnew/changelog id5975202645
Ref: 1d245202645
Ref: Core and Builtins<129>-Footnote-15202922
Node: ライブラリ<132>5202987
Ref: whatsnew/changelog id5985203127
Ref: 1d265203127
Ref: ライブラリ<132>-Footnote-15204388
Ref: ライブラリ<132>-Footnote-25204453
Ref: ライブラリ<132>-Footnote-35204495
Ref: ライブラリ<132>-Footnote-45204560
Ref: ライブラリ<132>-Footnote-55204625
Ref: ライブラリ<132>-Footnote-65204690
Ref: ライブラリ<132>-Footnote-75204757
Node: Core and Builtins<130>5204799
Ref: whatsnew/changelog id5995204937
Ref: 1d275204937
Ref: Core and Builtins<130>-Footnote-15205392
Ref: Core and Builtins<130>-Footnote-25205457
Node: ライブラリ<133>5205522
Ref: whatsnew/changelog id6005205662
Ref: 1d285205662
Ref: ライブラリ<133>-Footnote-15214517
Ref: ライブラリ<133>-Footnote-25214582
Ref: ライブラリ<133>-Footnote-35214647
Ref: ライブラリ<133>-Footnote-45214712
Ref: ライブラリ<133>-Footnote-55214777
Ref: ライブラリ<133>-Footnote-65214842
Ref: ライブラリ<133>-Footnote-75214907
Ref: ライブラリ<133>-Footnote-85214949
Ref: ライブラリ<133>-Footnote-95214991
Ref: ライブラリ<133>-Footnote-105215056
Ref: ライブラリ<133>-Footnote-115215122
Ref: ライブラリ<133>-Footnote-125215188
Ref: ライブラリ<133>-Footnote-135215254
Ref: ライブラリ<133>-Footnote-145215320
Ref: ライブラリ<133>-Footnote-155215386
Ref: ライブラリ<133>-Footnote-165215452
Ref: ライブラリ<133>-Footnote-175215518
Ref: ライブラリ<133>-Footnote-185215584
Ref: ライブラリ<133>-Footnote-195215649
Ref: ライブラリ<133>-Footnote-205215717
Ref: ライブラリ<133>-Footnote-215215760
Ref: ライブラリ<133>-Footnote-225215826
Ref: ライブラリ<133>-Footnote-235215892
Ref: ライブラリ<133>-Footnote-245215958
Ref: ライブラリ<133>-Footnote-255216024
Ref: ライブラリ<133>-Footnote-265216090
Ref: ライブラリ<133>-Footnote-275216156
Ref: ライブラリ<133>-Footnote-285216222
Ref: ライブラリ<133>-Footnote-295216288
Ref: ライブラリ<133>-Footnote-305216354
Ref: ライブラリ<133>-Footnote-315216420
Ref: ライブラリ<133>-Footnote-325216486
Ref: ライブラリ<133>-Footnote-335216529
Ref: ライブラリ<133>-Footnote-345216595
Ref: ライブラリ<133>-Footnote-355216661
Ref: ライブラリ<133>-Footnote-365216727
Ref: ライブラリ<133>-Footnote-375216793
Ref: ライブラリ<133>-Footnote-385216859
Ref: ライブラリ<133>-Footnote-395216925
Ref: ライブラリ<133>-Footnote-405216991
Ref: ライブラリ<133>-Footnote-415217057
Ref: ライブラリ<133>-Footnote-425217123
Ref: ライブラリ<133>-Footnote-435217189
Ref: ライブラリ<133>-Footnote-445217255
Ref: ライブラリ<133>-Footnote-455217321
Ref: ライブラリ<133>-Footnote-465217387
Ref: ライブラリ<133>-Footnote-475217453
Ref: ライブラリ<133>-Footnote-485217521
Ref: ライブラリ<133>-Footnote-495217564
Ref: ライブラリ<133>-Footnote-505217630
Ref: ライブラリ<133>-Footnote-515217696
Ref: ライブラリ<133>-Footnote-525217762
Ref: ライブラリ<133>-Footnote-535217828
Ref: ライブラリ<133>-Footnote-545217894
Ref: ライブラリ<133>-Footnote-555217960
Ref: ライブラリ<133>-Footnote-565218026
Ref: ライブラリ<133>-Footnote-575218092
Ref: ライブラリ<133>-Footnote-585218158
Node: ドキュメント<44>5218224
Ref: whatsnew/changelog id6015218355
Ref: 1d315218355
Ref: ドキュメント<44>-Footnote-15218675
Ref: ドキュメント<44>-Footnote-25218740
Node: テスト<44>5218805
Ref: whatsnew/changelog id6025218929
Ref: 1d335218929
Ref: テスト<44>-Footnote-15219711
Ref: テスト<44>-Footnote-25219776
Ref: テスト<44>-Footnote-35219841
Ref: テスト<44>-Footnote-45219906
Ref: テスト<44>-Footnote-55219971
Ref: テスト<44>-Footnote-65220036
Ref: テスト<44>-Footnote-75220101
Ref: テスト<44>-Footnote-85220166
Node: ビルド<51>5220231
Ref: whatsnew/changelog id6035220342
Ref: 1d345220342
Ref: ビルド<51>-Footnote-15221312
Ref: ビルド<51>-Footnote-25221377
Ref: ビルド<51>-Footnote-35221442
Ref: ビルド<51>-Footnote-45221507
Ref: ビルド<51>-Footnote-55221572
Ref: ビルド<51>-Footnote-65221637
Node: macOS<34>5221702
Ref: whatsnew/changelog id6045221815
Ref: 1d355221815
Ref: macOS<34>-Footnote-15222135
Ref: macOS<34>-Footnote-25222200
Ref: macOS<34>-Footnote-35222265
Node: Tools/Demos<28>5222330
Ref: whatsnew/changelog id6055222439
Ref: 1d365222439
Ref: Tools/Demos<28>-Footnote-15222765
Ref: Tools/Demos<28>-Footnote-25222830
Node: C API<45>5222895
Ref: whatsnew/changelog id6065222986
Ref: 1d375222986
Ref: C API<45>-Footnote-15223829
Ref: C API<45>-Footnote-25223894
Ref: C API<45>-Footnote-35223959
Ref: C API<45>-Footnote-45224026
Ref: C API<45>-Footnote-55224091
Node: Python 3 10 0 alpha 35224156
Ref: whatsnew/changelog python-3-10-0-alpha-35224286
Ref: 1d385224286
Node: セキュリティ<39>5224994
Ref: whatsnew/changelog id6075225105
Ref: 1d395225105
Ref: セキュリティ<39>-Footnote-15225359
Node: Core and Builtins<131>5225424
Ref: whatsnew/changelog id6085225564
Ref: 1d3a5225564
Ref: Core and Builtins<131>-Footnote-15227182
Ref: Core and Builtins<131>-Footnote-25227247
Ref: Core and Builtins<131>-Footnote-35227312
Ref: Core and Builtins<131>-Footnote-45227377
Ref: Core and Builtins<131>-Footnote-55227442
Node: ライブラリ<134>5227507
Ref: whatsnew/changelog id6095227647
Ref: 1d3c5227647
Ref: ライブラリ<134>-Footnote-15227884
Ref: ライブラリ<134>-Footnote-25227951
Node: Core and Builtins<132>5227993
Ref: whatsnew/changelog id6105228131
Ref: 1d3d5228131
Ref: Core and Builtins<132>-Footnote-15229974
Ref: Core and Builtins<132>-Footnote-25230039
Ref: Core and Builtins<132>-Footnote-35230104
Ref: Core and Builtins<132>-Footnote-45230169
Ref: Core and Builtins<132>-Footnote-55230234
Ref: Core and Builtins<132>-Footnote-65230299
Ref: Core and Builtins<132>-Footnote-75230364
Ref: Core and Builtins<132>-Footnote-85230429
Ref: Core and Builtins<132>-Footnote-95230494
Ref: Core and Builtins<132>-Footnote-105230559
Node: ライブラリ<135>5230625
Ref: whatsnew/changelog id6115230765
Ref: 1d3e5230765
Ref: ライブラリ<135>-Footnote-15230913
Node: Core and Builtins<133>5230978
Ref: whatsnew/changelog id6125231116
Ref: 1d3f5231116
Ref: Core and Builtins<133>-Footnote-15231342
Node: ライブラリ<136>5231407
Ref: whatsnew/changelog id6135231547
Ref: 1d405231547
Ref: ライブラリ<136>-Footnote-15231694
Node: Core and Builtins<134>5231759
Ref: whatsnew/changelog id6145231897
Ref: 1d415231897
Ref: Core and Builtins<134>-Footnote-15232482
Ref: Core and Builtins<134>-Footnote-25232547
Ref: Core and Builtins<134>-Footnote-35232612
Node: ライブラリ<137>5232677
Ref: whatsnew/changelog id6155232817
Ref: 1d425232817
Ref: ライブラリ<137>-Footnote-15243890
Ref: ライブラリ<137>-Footnote-25243954
Ref: ライブラリ<137>-Footnote-35244019
Ref: ライブラリ<137>-Footnote-45244084
Ref: ライブラリ<137>-Footnote-55244149
Ref: ライブラリ<137>-Footnote-65244214
Ref: ライブラリ<137>-Footnote-75244279
Ref: ライブラリ<137>-Footnote-85244344
Ref: ライブラリ<137>-Footnote-95244409
Ref: ライブラリ<137>-Footnote-105244474
Ref: ライブラリ<137>-Footnote-115244540
Ref: ライブラリ<137>-Footnote-125244606
Ref: ライブラリ<137>-Footnote-135244672
Ref: ライブラリ<137>-Footnote-145244738
Ref: ライブラリ<137>-Footnote-155244804
Ref: ライブラリ<137>-Footnote-165244870
Ref: ライブラリ<137>-Footnote-175244936
Ref: ライブラリ<137>-Footnote-185245002
Ref: ライブラリ<137>-Footnote-195245068
Ref: ライブラリ<137>-Footnote-205245134
Ref: ライブラリ<137>-Footnote-215245200
Ref: ライブラリ<137>-Footnote-225245266
Ref: ライブラリ<137>-Footnote-235245332
Ref: ライブラリ<137>-Footnote-245245400
Ref: ライブラリ<137>-Footnote-255245466
Ref: ライブラリ<137>-Footnote-265245532
Ref: ライブラリ<137>-Footnote-275245575
Ref: ライブラリ<137>-Footnote-285245641
Ref: ライブラリ<137>-Footnote-295245707
Ref: ライブラリ<137>-Footnote-305245773
Ref: ライブラリ<137>-Footnote-315245839
Ref: ライブラリ<137>-Footnote-325245905
Ref: ライブラリ<137>-Footnote-335245971
Ref: ライブラリ<137>-Footnote-345246037
Ref: ライブラリ<137>-Footnote-355246103
Ref: ライブラリ<137>-Footnote-365246169
Ref: ライブラリ<137>-Footnote-375246235
Ref: ライブラリ<137>-Footnote-385246301
Ref: ライブラリ<137>-Footnote-395246367
Ref: ライブラリ<137>-Footnote-405246433
Ref: ライブラリ<137>-Footnote-415246499
Ref: ライブラリ<137>-Footnote-425246565
Ref: ライブラリ<137>-Footnote-435246631
Ref: ライブラリ<137>-Footnote-445246697
Ref: ライブラリ<137>-Footnote-455246763
Ref: ライブラリ<137>-Footnote-465246829
Ref: ライブラリ<137>-Footnote-475246895
Ref: ライブラリ<137>-Footnote-485246961
Ref: ライブラリ<137>-Footnote-495247027
Ref: ライブラリ<137>-Footnote-505247093
Ref: ライブラリ<137>-Footnote-515247159
Ref: ライブラリ<137>-Footnote-525247225
Ref: ライブラリ<137>-Footnote-535247291
Ref: ライブラリ<137>-Footnote-545247357
Ref: ライブラリ<137>-Footnote-555247423
Ref: ライブラリ<137>-Footnote-565247489
Ref: ライブラリ<137>-Footnote-575247555
Ref: ライブラリ<137>-Footnote-585247621
Ref: ライブラリ<137>-Footnote-595247687
Ref: ライブラリ<137>-Footnote-605247753
Ref: ライブラリ<137>-Footnote-615247819
Ref: ライブラリ<137>-Footnote-625247885
Ref: ライブラリ<137>-Footnote-635247951
Ref: ライブラリ<137>-Footnote-645248017
Ref: ライブラリ<137>-Footnote-655248083
Node: ドキュメント<45>5248149
Ref: whatsnew/changelog id6165248280
Ref: 1d475248280
Ref: ドキュメント<45>-Footnote-15248752
Ref: ドキュメント<45>-Footnote-25248817
Ref: ドキュメント<45>-Footnote-35248882
Node: テスト<45>5248947
Ref: whatsnew/changelog id6175249071
Ref: 1d485249071
Ref: テスト<45>-Footnote-15250284
Ref: テスト<45>-Footnote-25250349
Ref: テスト<45>-Footnote-35250414
Ref: テスト<45>-Footnote-45250479
Ref: テスト<45>-Footnote-55250544
Ref: テスト<45>-Footnote-65250609
Ref: テスト<45>-Footnote-75250674
Ref: テスト<45>-Footnote-85250739
Ref: テスト<45>-Footnote-95250804
Ref: テスト<45>-Footnote-105250869
Ref: テスト<45>-Footnote-115250935
Ref: テスト<45>-Footnote-125251001
Node: ビルド<52>5251067
Ref: whatsnew/changelog id6185251180
Ref: 1d495251180
Ref: ビルド<52>-Footnote-15252324
Ref: ビルド<52>-Footnote-25252389
Ref: ビルド<52>-Footnote-35252454
Ref: ビルド<52>-Footnote-45252519
Ref: ビルド<52>-Footnote-55252584
Ref: ビルド<52>-Footnote-65252649
Ref: ビルド<52>-Footnote-75252714
Node: Windows<44>5252779
Ref: whatsnew/changelog id6195252888
Ref: 1d4a5252888
Ref: Windows<44>-Footnote-15253182
Ref: Windows<44>-Footnote-25253247
Node: macOS<35>5253312
Ref: whatsnew/changelog id6205253416
Ref: 1d4b5253416
Ref: macOS<35>-Footnote-15254354
Ref: macOS<35>-Footnote-25254419
Ref: macOS<35>-Footnote-35254484
Ref: macOS<35>-Footnote-45254549
Ref: macOS<35>-Footnote-55254614
Node: IDLE<25>5254679
Ref: whatsnew/changelog id6215254787
Ref: 1d4c5254787
Ref: IDLE<25>-Footnote-15255209
Ref: IDLE<25>-Footnote-25255274
Ref: IDLE<25>-Footnote-35255339
Node: Tools/Demos<29>5255404
Ref: whatsnew/changelog id6225255512
Ref: 1d4d5255512
Ref: Tools/Demos<29>-Footnote-15255914
Ref: Tools/Demos<29>-Footnote-25255979
Node: C API<46>5256044
Ref: whatsnew/changelog id6235256135
Ref: 1d4e5256135
Ref: C API<46>-Footnote-15260900
Ref: C API<46>-Footnote-25260965
Ref: C API<46>-Footnote-35261032
Ref: C API<46>-Footnote-45261074
Ref: C API<46>-Footnote-55261141
Ref: C API<46>-Footnote-65261183
Ref: C API<46>-Footnote-75261250
Ref: C API<46>-Footnote-85261292
Ref: C API<46>-Footnote-95261359
Ref: C API<46>-Footnote-105261401
Ref: C API<46>-Footnote-115261469
Ref: C API<46>-Footnote-125261512
Ref: C API<46>-Footnote-135261580
Ref: C API<46>-Footnote-145261623
Ref: C API<46>-Footnote-155261691
Ref: C API<46>-Footnote-165261734
Ref: C API<46>-Footnote-175261800
Ref: C API<46>-Footnote-185261868
Ref: C API<46>-Footnote-195261911
Ref: C API<46>-Footnote-205261979
Ref: C API<46>-Footnote-215262022
Ref: C API<46>-Footnote-225262090
Ref: C API<46>-Footnote-235262133
Ref: C API<46>-Footnote-245262201
Ref: C API<46>-Footnote-255262244
Ref: C API<46>-Footnote-265262310
Ref: C API<46>-Footnote-275262376
Ref: C API<46>-Footnote-285262442
Ref: C API<46>-Footnote-295262508
Ref: C API<46>-Footnote-305262574
Ref: C API<46>-Footnote-315262640
Ref: C API<46>-Footnote-325262706
Ref: C API<46>-Footnote-335262774
Ref: C API<46>-Footnote-345262840
Ref: C API<46>-Footnote-355262906
Ref: C API<46>-Footnote-365262972
Node: Python 3 10 0 alpha 25263038
Ref: whatsnew/changelog python-3-10-0-alpha-25263168
Ref: 1d505263168
Node: セキュリティ<40>5263669
Ref: whatsnew/changelog id6245263780
Ref: 1d515263780
Ref: セキュリティ<40>-Footnote-15264270
Ref: セキュリティ<40>-Footnote-25264335
Node: Core and Builtins<135>5264400
Ref: whatsnew/changelog id6255264540
Ref: 1d525264540
Ref: Core and Builtins<135>-Footnote-15267879
Ref: Core and Builtins<135>-Footnote-25267944
Ref: Core and Builtins<135>-Footnote-35268009
Ref: Core and Builtins<135>-Footnote-45268074
Ref: Core and Builtins<135>-Footnote-55268139
Ref: Core and Builtins<135>-Footnote-65268204
Ref: Core and Builtins<135>-Footnote-75268269
Ref: Core and Builtins<135>-Footnote-85268334
Ref: Core and Builtins<135>-Footnote-95268399
Ref: Core and Builtins<135>-Footnote-105268464
Ref: Core and Builtins<135>-Footnote-115268530
Ref: Core and Builtins<135>-Footnote-125268596
Ref: Core and Builtins<135>-Footnote-135268662
Ref: Core and Builtins<135>-Footnote-145268728
Ref: Core and Builtins<135>-Footnote-155268794
Ref: Core and Builtins<135>-Footnote-165268860
Ref: Core and Builtins<135>-Footnote-175268926
Ref: Core and Builtins<135>-Footnote-185268992
Node: ライブラリ<138>5269058
Ref: whatsnew/changelog id6265269198
Ref: 1d555269198
Ref: ライブラリ<138>-Footnote-15269513
Node: Core and Builtins<136>5269578
Ref: whatsnew/changelog id6275269716
Ref: 1d565269716
Ref: Core and Builtins<136>-Footnote-15270050
Ref: Core and Builtins<136>-Footnote-25270115
Node: ライブラリ<139>5270157
Ref: whatsnew/changelog id6285270297
Ref: 1d575270297
Ref: ライブラリ<139>-Footnote-15277339
Ref: ライブラリ<139>-Footnote-25277404
Ref: ライブラリ<139>-Footnote-35277469
Ref: ライブラリ<139>-Footnote-45277534
Ref: ライブラリ<139>-Footnote-55277599
Ref: ライブラリ<139>-Footnote-65277664
Ref: ライブラリ<139>-Footnote-75277729
Ref: ライブラリ<139>-Footnote-85277771
Ref: ライブラリ<139>-Footnote-95277836
Ref: ライブラリ<139>-Footnote-105277901
Ref: ライブラリ<139>-Footnote-115277967
Ref: ライブラリ<139>-Footnote-125278033
Ref: ライブラリ<139>-Footnote-135278099
Ref: ライブラリ<139>-Footnote-145278165
Ref: ライブラリ<139>-Footnote-155278231
Ref: ライブラリ<139>-Footnote-165278297
Ref: ライブラリ<139>-Footnote-175278363
Ref: ライブラリ<139>-Footnote-185278429
Ref: ライブラリ<139>-Footnote-195278495
Ref: ライブラリ<139>-Footnote-205278561
Ref: ライブラリ<139>-Footnote-215278627
Ref: ライブラリ<139>-Footnote-225278693
Ref: ライブラリ<139>-Footnote-235278759
Ref: ライブラリ<139>-Footnote-245278825
Ref: ライブラリ<139>-Footnote-255278891
Ref: ライブラリ<139>-Footnote-265278934
Ref: ライブラリ<139>-Footnote-275279000
Ref: ライブラリ<139>-Footnote-285279066
Ref: ライブラリ<139>-Footnote-295279132
Ref: ライブラリ<139>-Footnote-305279198
Ref: ライブラリ<139>-Footnote-315279264
Ref: ライブラリ<139>-Footnote-325279330
Ref: ライブラリ<139>-Footnote-335279396
Ref: ライブラリ<139>-Footnote-345279462
Ref: ライブラリ<139>-Footnote-355279528
Ref: ライブラリ<139>-Footnote-365279594
Ref: ライブラリ<139>-Footnote-375279659
Ref: ライブラリ<139>-Footnote-385279725
Ref: ライブラリ<139>-Footnote-395279791
Ref: ライブラリ<139>-Footnote-405279857
Ref: ライブラリ<139>-Footnote-415279923
Node: ドキュメント<46>5279989
Ref: whatsnew/changelog id6295280120
Ref: 1d5a5280120
Ref: ドキュメント<46>-Footnote-15280972
Ref: ドキュメント<46>-Footnote-25281037
Ref: ドキュメント<46>-Footnote-35281102
Ref: ドキュメント<46>-Footnote-45281167
Ref: ドキュメント<46>-Footnote-55281232
Ref: ドキュメント<46>-Footnote-65281297
Node: テスト<46>5281362
Ref: whatsnew/changelog id6305281486
Ref: 1d5d5281486
Ref: テスト<46>-Footnote-15282128
Ref: テスト<46>-Footnote-25282193
Ref: テスト<46>-Footnote-35282258
Ref: テスト<46>-Footnote-45282323
Node: ビルド<53>5282388
Ref: whatsnew/changelog id6315282501
Ref: 1d5e5282501
Ref: ビルド<53>-Footnote-15282770
Node: Windows<45>5282835
Ref: whatsnew/changelog id6325282944
Ref: 1d5f5282944
Ref: Windows<45>-Footnote-15283420
Ref: Windows<45>-Footnote-25283485
Ref: Windows<45>-Footnote-35283550
Ref: Windows<45>-Footnote-45283615
Ref: Windows<45>-Footnote-55283680
Node: macOS<36>5283745
Ref: whatsnew/changelog id6335283849
Ref: 1d605283849
Ref: macOS<36>-Footnote-15284001
Node: IDLE<26>5284066
Ref: whatsnew/changelog id6345284168
Ref: 1d615284168
Ref: IDLE<26>-Footnote-15284779
Ref: IDLE<26>-Footnote-25284844
Ref: IDLE<26>-Footnote-35284909
Node: C API<47>5284974
Ref: whatsnew/changelog id6355285058
Ref: 1d625285058
Ref: C API<47>-Footnote-15286391
Ref: C API<47>-Footnote-25286456
Ref: C API<47>-Footnote-35286521
Ref: C API<47>-Footnote-45286586
Ref: C API<47>-Footnote-55286651
Ref: C API<47>-Footnote-65286716
Ref: C API<47>-Footnote-75286781
Ref: C API<47>-Footnote-85286846
Node: Python 3 10 0 alpha 15286911
Ref: whatsnew/changelog python-3-10-0-alpha-15287039
Ref: 1d645287039
Node: セキュリティ<41>5288658
Ref: whatsnew/changelog id6365288769
Ref: 1d655288769
Ref: セキュリティ<41>-Footnote-15289686
Ref: セキュリティ<41>-Footnote-25289751
Ref: セキュリティ<41>-Footnote-35289816
Ref: セキュリティ<41>-Footnote-45289872
Ref: セキュリティ<41>-Footnote-55289937
Ref: セキュリティ<41>-Footnote-65290002
Ref: セキュリティ<41>-Footnote-75290058
Ref: セキュリティ<41>-Footnote-85290123
Node: Core and Builtins<137>5290188
Ref: whatsnew/changelog id6375290328
Ref: 1d665290328
Ref: Core and Builtins<137>-Footnote-15291020
Ref: Core and Builtins<137>-Footnote-25291085
Ref: Core and Builtins<137>-Footnote-35291150
Ref: Core and Builtins<137>-Footnote-45291192
Ref: Core and Builtins<137>-Footnote-55291257
Ref: Core and Builtins<137>-Footnote-65291322
Node: ライブラリ<140>5291364
Ref: whatsnew/changelog id6385291504
Ref: 1d675291504
Ref: ライブラリ<140>-Footnote-15291698
Ref: ライブラリ<140>-Footnote-25291765
Node: Core and Builtins<138>5291807
Ref: whatsnew/changelog id6395291945
Ref: 1d685291945
Ref: Core and Builtins<138>-Footnote-15292333
Ref: Core and Builtins<138>-Footnote-25292398
Node: ライブラリ<141>5292463
Ref: whatsnew/changelog id6405292603
Ref: 1d695292603
Ref: ライブラリ<141>-Footnote-15293235
Ref: ライブラリ<141>-Footnote-25293302
Ref: ライブラリ<141>-Footnote-35293344
Ref: ライブラリ<141>-Footnote-45293411
Ref: ライブラリ<141>-Footnote-55293453
Ref: ライブラリ<141>-Footnote-65293520
Ref: ライブラリ<141>-Footnote-75293562
Ref: ライブラリ<141>-Footnote-85293629
Ref: ライブラリ<141>-Footnote-95293671
Node: Core and Builtins<139>5293738
Ref: whatsnew/changelog id6415293876
Ref: 1d6a5293876
Ref: Core and Builtins<139>-Footnote-15294135
Node: ライブラリ<142>5294200
Ref: whatsnew/changelog id6425294340
Ref: 1d6b5294340
Ref: ライブラリ<142>-Footnote-15294770
Ref: ライブラリ<142>-Footnote-25294837
Ref: ライブラリ<142>-Footnote-35294879
Ref: ライブラリ<142>-Footnote-45294946
Ref: ライブラリ<142>-Footnote-55294988
Ref: ライブラリ<142>-Footnote-65295055
Node: Core and Builtins<140>5295097
Ref: whatsnew/changelog id6435295235
Ref: 1d6c5295235
Ref: Core and Builtins<140>-Footnote-15295489
Node: ライブラリ<143>5295554
Ref: whatsnew/changelog id6445295694
Ref: 1d6d5295694
Ref: ライブラリ<143>-Footnote-15296005
Node: Core and Builtins<141>5296070
Ref: whatsnew/changelog id6455296208
Ref: 1d6e5296208
Ref: Core and Builtins<141>-Footnote-15296651
Ref: Core and Builtins<141>-Footnote-25296716
Node: ライブラリ<144>5296781
Ref: whatsnew/changelog id6465296921
Ref: 1d6f5296921
Ref: ライブラリ<144>-Footnote-15297122
Ref: ライブラリ<144>-Footnote-25297189
Node: Core and Builtins<142>5297231
Ref: whatsnew/changelog id6475297369
Ref: 1d705297369
Ref: Core and Builtins<142>-Footnote-15297841
Node: ライブラリ<145>5297906
Ref: whatsnew/changelog id6485298046
Ref: 1d715298046
Ref: ライブラリ<145>-Footnote-15298218
Node: Core and Builtins<143>5298283
Ref: whatsnew/changelog id6495298421
Ref: 1d725298421
Ref: Core and Builtins<143>-Footnote-15298618
Node: ライブラリ<146>5298685
Ref: whatsnew/changelog id6505298825
Ref: 1d735298825
Ref: ライブラリ<146>-Footnote-15299031
Ref: ライブラリ<146>-Footnote-25299098
Node: Core and Builtins<144>5299140
Ref: whatsnew/changelog id6515299278
Ref: 1d745299278
Ref: Core and Builtins<144>-Footnote-15299754
Ref: Core and Builtins<144>-Footnote-25299819
Ref: Core and Builtins<144>-Footnote-35299884
Node: ライブラリ<147>5299949
Ref: whatsnew/changelog id6525300089
Ref: 1d755300089
Ref: ライブラリ<147>-Footnote-15300321
Ref: ライブラリ<147>-Footnote-25300388
Node: Core and Builtins<145>5300430
Ref: whatsnew/changelog id6535300568
Ref: 1d765300568
Ref: Core and Builtins<145>-Footnote-15302016
Ref: Core and Builtins<145>-Footnote-25302081
Ref: Core and Builtins<145>-Footnote-35302146
Ref: Core and Builtins<145>-Footnote-45302211
Ref: Core and Builtins<145>-Footnote-55302276
Ref: Core and Builtins<145>-Footnote-65302341
Ref: Core and Builtins<145>-Footnote-75302406
Ref: Core and Builtins<145>-Footnote-85302471
Ref: Core and Builtins<145>-Footnote-95302536
Ref: Core and Builtins<145>-Footnote-105302601
Ref: Core and Builtins<145>-Footnote-115302667
Node: ライブラリ<148>5302735
Ref: whatsnew/changelog id6545302875
Ref: 1d775302875
Ref: ライブラリ<148>-Footnote-15303030
Node: Core and Builtins<146>5303097
Ref: whatsnew/changelog id6555303235
Ref: 1d785303235
Ref: Core and Builtins<146>-Footnote-15303804
Ref: Core and Builtins<146>-Footnote-25303869
Node: ライブラリ<149>5303934
Ref: whatsnew/changelog id6565304074
Ref: 1d795304074
Ref: ライブラリ<149>-Footnote-15304315
Ref: ライブラリ<149>-Footnote-25304382
Node: Core and Builtins<147>5304449
Ref: whatsnew/changelog id6575304587
Ref: 1d7a5304587
Ref: Core and Builtins<147>-Footnote-15306551
Ref: Core and Builtins<147>-Footnote-25306616
Ref: Core and Builtins<147>-Footnote-35306681
Ref: Core and Builtins<147>-Footnote-45306746
Ref: Core and Builtins<147>-Footnote-55306811
Ref: Core and Builtins<147>-Footnote-65306876
Ref: Core and Builtins<147>-Footnote-75306941
Ref: Core and Builtins<147>-Footnote-85307006
Ref: Core and Builtins<147>-Footnote-95307071
Ref: Core and Builtins<147>-Footnote-105307136
Ref: Core and Builtins<147>-Footnote-115307202
Ref: Core and Builtins<147>-Footnote-125307268
Ref: Core and Builtins<147>-Footnote-135307334
Node: ライブラリ<150>5307400
Ref: whatsnew/changelog id6585307540
Ref: 1d7b5307540
Ref: ライブラリ<150>-Footnote-15307702
Node: Core and Builtins<148>5307767
Ref: whatsnew/changelog id6595307905
Ref: 1d7c5307905
Ref: Core and Builtins<148>-Footnote-15309021
Ref: Core and Builtins<148>-Footnote-25309086
Ref: Core and Builtins<148>-Footnote-35309151
Ref: Core and Builtins<148>-Footnote-45309193
Ref: Core and Builtins<148>-Footnote-55309260
Ref: Core and Builtins<148>-Footnote-65309325
Ref: Core and Builtins<148>-Footnote-75309390
Ref: Core and Builtins<148>-Footnote-85309457
Node: ライブラリ<151>5309522
Ref: whatsnew/changelog id6605309662
Ref: 1d7d5309662
Ref: ライブラリ<151>-Footnote-15309887
Ref: ライブラリ<151>-Footnote-25309952
Node: Core and Builtins<149>5309994
Ref: whatsnew/changelog id6615310132
Ref: 1d7e5310132
Ref: Core and Builtins<149>-Footnote-15315046
Ref: Core and Builtins<149>-Footnote-25315111
Ref: Core and Builtins<149>-Footnote-35315176
Ref: Core and Builtins<149>-Footnote-45315241
Ref: Core and Builtins<149>-Footnote-55315306
Ref: Core and Builtins<149>-Footnote-65315371
Ref: Core and Builtins<149>-Footnote-75315436
Ref: Core and Builtins<149>-Footnote-85315501
Ref: Core and Builtins<149>-Footnote-95315566
Ref: Core and Builtins<149>-Footnote-105315631
Ref: Core and Builtins<149>-Footnote-115315697
Ref: Core and Builtins<149>-Footnote-125315763
Ref: Core and Builtins<149>-Footnote-135315829
Ref: Core and Builtins<149>-Footnote-145315897
Ref: Core and Builtins<149>-Footnote-155315963
Ref: Core and Builtins<149>-Footnote-165316029
Ref: Core and Builtins<149>-Footnote-175316095
Ref: Core and Builtins<149>-Footnote-185316161
Ref: Core and Builtins<149>-Footnote-195316227
Ref: Core and Builtins<149>-Footnote-205316293
Ref: Core and Builtins<149>-Footnote-215316359
Ref: Core and Builtins<149>-Footnote-225316425
Ref: Core and Builtins<149>-Footnote-235316491
Ref: Core and Builtins<149>-Footnote-245316557
Ref: Core and Builtins<149>-Footnote-255316623
Ref: Core and Builtins<149>-Footnote-265316689
Node: ライブラリ<152>5316754
Ref: whatsnew/changelog id6625316894
Ref: 1d835316894
Ref: ライブラリ<152>-Footnote-15317122
Ref: ライブラリ<152>-Footnote-25317189
Node: Core and Builtins<150>5317256
Ref: whatsnew/changelog id6635317394
Ref: 1d845317394
Ref: Core and Builtins<150>-Footnote-15317981
Ref: Core and Builtins<150>-Footnote-25318046
Node: ライブラリ<153>5318111
Ref: whatsnew/changelog id6645318251
Ref: 1d855318251
Ref: ライブラリ<153>-Footnote-15318630
Node: Core and Builtins<151>5318695
Ref: whatsnew/changelog id6655318833
Ref: 1d865318833
Ref: Core and Builtins<151>-Footnote-15319177
Ref: Core and Builtins<151>-Footnote-25319242
Node: ライブラリ<154>5319307
Ref: whatsnew/changelog id6665319447
Ref: 1d875319447
Ref: ライブラリ<154>-Footnote-15341587
Ref: ライブラリ<154>-Footnote-25341652
Ref: ライブラリ<154>-Footnote-35341717
Ref: ライブラリ<154>-Footnote-45341782
Ref: ライブラリ<154>-Footnote-55341847
Ref: ライブラリ<154>-Footnote-65341912
Ref: ライブラリ<154>-Footnote-75341977
Ref: ライブラリ<154>-Footnote-85342042
Ref: ライブラリ<154>-Footnote-95342107
Ref: ライブラリ<154>-Footnote-105342172
Ref: ライブラリ<154>-Footnote-115342238
Ref: ライブラリ<154>-Footnote-125342304
Ref: ライブラリ<154>-Footnote-135342370
Ref: ライブラリ<154>-Footnote-145342436
Ref: ライブラリ<154>-Footnote-155342502
Ref: ライブラリ<154>-Footnote-165342568
Ref: ライブラリ<154>-Footnote-175342621
Ref: ライブラリ<154>-Footnote-185342687
Ref: ライブラリ<154>-Footnote-195342753
Ref: ライブラリ<154>-Footnote-205342819
Ref: ライブラリ<154>-Footnote-215342887
Ref: ライブラリ<154>-Footnote-225342930
Ref: ライブラリ<154>-Footnote-235342998
Ref: ライブラリ<154>-Footnote-245343041
Ref: ライブラリ<154>-Footnote-255343107
Ref: ライブラリ<154>-Footnote-265343173
Ref: ライブラリ<154>-Footnote-275343239
Ref: ライブラリ<154>-Footnote-285343305
Ref: ライブラリ<154>-Footnote-295343371
Ref: ライブラリ<154>-Footnote-305343437
Ref: ライブラリ<154>-Footnote-315343503
Ref: ライブラリ<154>-Footnote-325343569
Ref: ライブラリ<154>-Footnote-335343635
Ref: ライブラリ<154>-Footnote-345343701
Ref: ライブラリ<154>-Footnote-355343767
Ref: ライブラリ<154>-Footnote-365343833
Ref: ライブラリ<154>-Footnote-375343899
Ref: ライブラリ<154>-Footnote-385343965
Ref: ライブラリ<154>-Footnote-395344031
Ref: ライブラリ<154>-Footnote-405344097
Ref: ライブラリ<154>-Footnote-415344163
Ref: ライブラリ<154>-Footnote-425344229
Ref: ライブラリ<154>-Footnote-435344295
Ref: ライブラリ<154>-Footnote-445344361
Ref: ライブラリ<154>-Footnote-455344427
Ref: ライブラリ<154>-Footnote-465344493
Ref: ライブラリ<154>-Footnote-475344559
Ref: ライブラリ<154>-Footnote-485344625
Ref: ライブラリ<154>-Footnote-495344691
Ref: ライブラリ<154>-Footnote-505344757
Ref: ライブラリ<154>-Footnote-515344823
Ref: ライブラリ<154>-Footnote-525344889
Ref: ライブラリ<154>-Footnote-535344955
Ref: ライブラリ<154>-Footnote-545345021
Ref: ライブラリ<154>-Footnote-555345087
Ref: ライブラリ<154>-Footnote-565345153
Ref: ライブラリ<154>-Footnote-575345219
Ref: ライブラリ<154>-Footnote-585345276
Ref: ライブラリ<154>-Footnote-595345342
Ref: ライブラリ<154>-Footnote-605345408
Ref: ライブラリ<154>-Footnote-615345474
Ref: ライブラリ<154>-Footnote-625345540
Ref: ライブラリ<154>-Footnote-635345606
Ref: ライブラリ<154>-Footnote-645345672
Ref: ライブラリ<154>-Footnote-655345738
Ref: ライブラリ<154>-Footnote-665345804
Ref: ライブラリ<154>-Footnote-675345870
Ref: ライブラリ<154>-Footnote-685345936
Ref: ライブラリ<154>-Footnote-695346002
Ref: ライブラリ<154>-Footnote-705346068
Ref: ライブラリ<154>-Footnote-715346134
Ref: ライブラリ<154>-Footnote-725346200
Ref: ライブラリ<154>-Footnote-735346266
Ref: ライブラリ<154>-Footnote-745346332
Ref: ライブラリ<154>-Footnote-755346398
Ref: ライブラリ<154>-Footnote-765346464
Ref: ライブラリ<154>-Footnote-775346530
Ref: ライブラリ<154>-Footnote-785346596
Ref: ライブラリ<154>-Footnote-795346662
Ref: ライブラリ<154>-Footnote-805346728
Ref: ライブラリ<154>-Footnote-815346794
Ref: ライブラリ<154>-Footnote-825346860
Ref: ライブラリ<154>-Footnote-835346926
Ref: ライブラリ<154>-Footnote-845346992
Ref: ライブラリ<154>-Footnote-855347058
Ref: ライブラリ<154>-Footnote-865347124
Ref: ライブラリ<154>-Footnote-875347190
Ref: ライブラリ<154>-Footnote-885347256
Ref: ライブラリ<154>-Footnote-895347322
Ref: ライブラリ<154>-Footnote-905347388
Ref: ライブラリ<154>-Footnote-915347454
Ref: ライブラリ<154>-Footnote-925347520
Ref: ライブラリ<154>-Footnote-935347586
Ref: ライブラリ<154>-Footnote-945347652
Ref: ライブラリ<154>-Footnote-955347718
Ref: ライブラリ<154>-Footnote-965347784
Ref: ライブラリ<154>-Footnote-975347850
Ref: ライブラリ<154>-Footnote-985347916
Ref: ライブラリ<154>-Footnote-995347982
Ref: ライブラリ<154>-Footnote-1005348048
Ref: ライブラリ<154>-Footnote-1015348115
Ref: ライブラリ<154>-Footnote-1025348182
Ref: ライブラリ<154>-Footnote-1035348249
Ref: ライブラリ<154>-Footnote-1045348316
Ref: ライブラリ<154>-Footnote-1055348383
Ref: ライブラリ<154>-Footnote-1065348450
Ref: ライブラリ<154>-Footnote-1075348517
Ref: ライブラリ<154>-Footnote-1085348584
Ref: ライブラリ<154>-Footnote-1095348651
Ref: ライブラリ<154>-Footnote-1105348718
Ref: ライブラリ<154>-Footnote-1115348785
Ref: ライブラリ<154>-Footnote-1125348852
Ref: ライブラリ<154>-Footnote-1135348919
Ref: ライブラリ<154>-Footnote-1145348986
Ref: ライブラリ<154>-Footnote-1155349053
Ref: ライブラリ<154>-Footnote-1165349120
Ref: ライブラリ<154>-Footnote-1175349187
Ref: ライブラリ<154>-Footnote-1185349254
Ref: ライブラリ<154>-Footnote-1195349321
Ref: ライブラリ<154>-Footnote-1205349388
Ref: ライブラリ<154>-Footnote-1215349454
Ref: ライブラリ<154>-Footnote-1225349521
Ref: ライブラリ<154>-Footnote-1235349588
Ref: ライブラリ<154>-Footnote-1245349655
Ref: ライブラリ<154>-Footnote-1255349722
Ref: ライブラリ<154>-Footnote-1265349766
Ref: ライブラリ<154>-Footnote-1275349833
Ref: ライブラリ<154>-Footnote-1285349900
Ref: ライブラリ<154>-Footnote-1295349967
Ref: ライブラリ<154>-Footnote-1305350034
Ref: ライブラリ<154>-Footnote-1315350101
Ref: ライブラリ<154>-Footnote-1325350168
Ref: ライブラリ<154>-Footnote-1335350235
Ref: ライブラリ<154>-Footnote-1345350302
Ref: ライブラリ<154>-Footnote-1355350369
Ref: ライブラリ<154>-Footnote-1365350436
Ref: ライブラリ<154>-Footnote-1375350503
Ref: ライブラリ<154>-Footnote-1385350570
Ref: ライブラリ<154>-Footnote-1395350637
Ref: ライブラリ<154>-Footnote-1405350704
Ref: ライブラリ<154>-Footnote-1415350771
Ref: ライブラリ<154>-Footnote-1425350838
Ref: ライブラリ<154>-Footnote-1435350905
Ref: ライブラリ<154>-Footnote-1445350972
Ref: ライブラリ<154>-Footnote-1455351039
Ref: ライブラリ<154>-Footnote-1465351106
Ref: ライブラリ<154>-Footnote-1475351173
Ref: ライブラリ<154>-Footnote-1485351240
Ref: ライブラリ<154>-Footnote-1495351307
Ref: ライブラリ<154>-Footnote-1505351374
Ref: ライブラリ<154>-Footnote-1515351441
Ref: ライブラリ<154>-Footnote-1525351508
Ref: ライブラリ<154>-Footnote-1535351575
Ref: ライブラリ<154>-Footnote-1545351642
Node: ドキュメント<47>5351709
Ref: whatsnew/changelog id6675351840
Ref: 1d8e5351840
Ref: ドキュメント<47>-Footnote-15353603
Ref: ドキュメント<47>-Footnote-25353668
Ref: ドキュメント<47>-Footnote-35353710
Ref: ドキュメント<47>-Footnote-45353775
Ref: ドキュメント<47>-Footnote-55353840
Ref: ドキュメント<47>-Footnote-65353905
Ref: ドキュメント<47>-Footnote-75353970
Ref: ドキュメント<47>-Footnote-85354035
Ref: ドキュメント<47>-Footnote-95354100
Ref: ドキュメント<47>-Footnote-105354165
Ref: ドキュメント<47>-Footnote-115354231
Ref: ドキュメント<47>-Footnote-125354297
Ref: ドキュメント<47>-Footnote-135354363
Ref: ドキュメント<47>-Footnote-145354429
Node: テスト<47>5354495
Ref: whatsnew/changelog id6685354619
Ref: 1d905354619
Ref: テスト<47>-Footnote-15356775
Ref: テスト<47>-Footnote-25356840
Ref: テスト<47>-Footnote-35356905
Ref: テスト<47>-Footnote-45356970
Ref: テスト<47>-Footnote-55357035
Ref: テスト<47>-Footnote-65357100
Ref: テスト<47>-Footnote-75357165
Ref: テスト<47>-Footnote-85357230
Ref: テスト<47>-Footnote-95357295
Ref: テスト<47>-Footnote-105357360
Ref: テスト<47>-Footnote-115357426
Ref: テスト<47>-Footnote-125357492
Ref: テスト<47>-Footnote-135357558
Ref: テスト<47>-Footnote-145357624
Ref: テスト<47>-Footnote-155357690
Ref: テスト<47>-Footnote-165357756
Node: ビルド<54>5357822
Ref: whatsnew/changelog id6695357935
Ref: 1d935357935
Ref: ビルド<54>-Footnote-15358861
Ref: ビルド<54>-Footnote-25358926
Ref: ビルド<54>-Footnote-35358991
Ref: ビルド<54>-Footnote-45359056
Ref: ビルド<54>-Footnote-55359121
Ref: ビルド<54>-Footnote-65359186
Node: Windows<46>5359251
Ref: whatsnew/changelog id6705359360
Ref: 1d945359360
Ref: Windows<46>-Footnote-15361125
Ref: Windows<46>-Footnote-25361190
Ref: Windows<46>-Footnote-35361255
Ref: Windows<46>-Footnote-45361320
Ref: Windows<46>-Footnote-55361385
Ref: Windows<46>-Footnote-65361450
Ref: Windows<46>-Footnote-75361515
Ref: Windows<46>-Footnote-85361580
Ref: Windows<46>-Footnote-95361645
Ref: Windows<46>-Footnote-105361710
Ref: Windows<46>-Footnote-115361776
Ref: Windows<46>-Footnote-125361842
Ref: Windows<46>-Footnote-135361908
Ref: Windows<46>-Footnote-145361974
Node: macOS<37>5362040
Ref: whatsnew/changelog id6715362144
Ref: 1d955362144
Ref: macOS<37>-Footnote-15363035
Ref: macOS<37>-Footnote-25363100
Ref: macOS<37>-Footnote-35363165
Ref: macOS<37>-Footnote-45363230
Ref: macOS<37>-Footnote-55363295
Ref: macOS<37>-Footnote-65363360
Node: IDLE<27>5363425
Ref: whatsnew/changelog id6725363527
Ref: 1d965363527
Ref: IDLE<27>-Footnote-15364684
Ref: IDLE<27>-Footnote-25364749
Ref: IDLE<27>-Footnote-35364814
Ref: IDLE<27>-Footnote-45364879
Ref: IDLE<27>-Footnote-55364944
Ref: IDLE<27>-Footnote-65365009
Ref: IDLE<27>-Footnote-75365074
Ref: IDLE<27>-Footnote-85365139
Ref: IDLE<27>-Footnote-95365204
Ref: IDLE<27>-Footnote-105365269
Ref: IDLE<27>-Footnote-115365335
Node: C API<48>5365401
Ref: whatsnew/changelog id6735365485
Ref: 1d975365485
Ref: C API<48>-Footnote-15370655
Ref: C API<48>-Footnote-25370720
Ref: C API<48>-Footnote-35370785
Ref: C API<48>-Footnote-45370850
Ref: C API<48>-Footnote-55370915
Ref: C API<48>-Footnote-65370980
Ref: C API<48>-Footnote-75371045
Ref: C API<48>-Footnote-85371110
Ref: C API<48>-Footnote-95371175
Ref: C API<48>-Footnote-105371240
Ref: C API<48>-Footnote-115371306
Ref: C API<48>-Footnote-125371372
Ref: C API<48>-Footnote-135371438
Ref: C API<48>-Footnote-145371504
Ref: C API<48>-Footnote-155371570
Ref: C API<48>-Footnote-165371636
Ref: C API<48>-Footnote-175371702
Ref: C API<48>-Footnote-185371768
Ref: C API<48>-Footnote-195371834
Ref: C API<48>-Footnote-205371900
Ref: C API<48>-Footnote-215371943
Ref: C API<48>-Footnote-225372009
Ref: C API<48>-Footnote-235372075
Ref: C API<48>-Footnote-245372141
Ref: C API<48>-Footnote-255372207
Ref: C API<48>-Footnote-265372273
Ref: C API<48>-Footnote-275372339
Ref: C API<48>-Footnote-285372405
Ref: C API<48>-Footnote-295372471
Node: Python 3 9 0 beta 15372537
Ref: whatsnew/changelog python-3-9-0-beta-15372664
Ref: 1da15372664
Node: セキュリティ<42>5373092
Ref: whatsnew/changelog id6745373201
Ref: 1da25373201
Ref: セキュリティ<42>-Footnote-15373419
Node: Core and Builtins<152>5373484
Ref: whatsnew/changelog id6755373622
Ref: 1da35373622
Ref: Core and Builtins<152>-Footnote-15376165
Ref: Core and Builtins<152>-Footnote-25376230
Ref: Core and Builtins<152>-Footnote-35376295
Ref: Core and Builtins<152>-Footnote-45376360
Ref: Core and Builtins<152>-Footnote-55376425
Ref: Core and Builtins<152>-Footnote-65376490
Ref: Core and Builtins<152>-Footnote-75376532
Ref: Core and Builtins<152>-Footnote-85376597
Ref: Core and Builtins<152>-Footnote-95376662
Ref: Core and Builtins<152>-Footnote-105376729
Ref: Core and Builtins<152>-Footnote-115376772
Ref: Core and Builtins<152>-Footnote-125376838
Ref: Core and Builtins<152>-Footnote-135376906
Ref: Core and Builtins<152>-Footnote-145376949
Ref: Core and Builtins<152>-Footnote-155377015
Ref: Core and Builtins<152>-Footnote-165377081
Ref: Core and Builtins<152>-Footnote-175377147
Ref: Core and Builtins<152>-Footnote-185377213
Ref: Core and Builtins<152>-Footnote-195377281
Ref: Core and Builtins<152>-Footnote-205377324
Ref: Core and Builtins<152>-Footnote-215377390
Ref: Core and Builtins<152>-Footnote-225377456
Ref: Core and Builtins<152>-Footnote-235377522
Ref: Core and Builtins<152>-Footnote-245377588
Node: ライブラリ<155>5377654
Ref: whatsnew/changelog id6765377792
Ref: 1da55377792
Ref: ライブラリ<155>-Footnote-15385185
Ref: ライブラリ<155>-Footnote-25385250
Ref: ライブラリ<155>-Footnote-35385315
Ref: ライブラリ<155>-Footnote-45385380
Ref: ライブラリ<155>-Footnote-55385445
Ref: ライブラリ<155>-Footnote-65385510
Ref: ライブラリ<155>-Footnote-75385575
Ref: ライブラリ<155>-Footnote-85385640
Ref: ライブラリ<155>-Footnote-95385705
Ref: ライブラリ<155>-Footnote-105385770
Ref: ライブラリ<155>-Footnote-115385836
Ref: ライブラリ<155>-Footnote-125385902
Ref: ライブラリ<155>-Footnote-135385968
Ref: ライブラリ<155>-Footnote-145386034
Ref: ライブラリ<155>-Footnote-155386100
Ref: ライブラリ<155>-Footnote-165386143
Ref: ライブラリ<155>-Footnote-175386209
Ref: ライブラリ<155>-Footnote-185386275
Ref: ライブラリ<155>-Footnote-195386341
Ref: ライブラリ<155>-Footnote-205386407
Ref: ライブラリ<155>-Footnote-215386473
Ref: ライブラリ<155>-Footnote-225386539
Ref: ライブラリ<155>-Footnote-235386605
Ref: ライブラリ<155>-Footnote-245386671
Ref: ライブラリ<155>-Footnote-255386737
Ref: ライブラリ<155>-Footnote-265386803
Ref: ライブラリ<155>-Footnote-275386869
Ref: ライブラリ<155>-Footnote-285386935
Ref: ライブラリ<155>-Footnote-295387001
Ref: ライブラリ<155>-Footnote-305387067
Ref: ライブラリ<155>-Footnote-315387133
Ref: ライブラリ<155>-Footnote-325387199
Ref: ライブラリ<155>-Footnote-335387265
Ref: ライブラリ<155>-Footnote-345387331
Ref: ライブラリ<155>-Footnote-355387397
Ref: ライブラリ<155>-Footnote-365387463
Ref: ライブラリ<155>-Footnote-375387529
Ref: ライブラリ<155>-Footnote-385387595
Ref: ライブラリ<155>-Footnote-395387661
Ref: ライブラリ<155>-Footnote-405387727
Ref: ライブラリ<155>-Footnote-415387793
Ref: ライブラリ<155>-Footnote-425387859
Ref: ライブラリ<155>-Footnote-435387925
Ref: ライブラリ<155>-Footnote-445387991
Ref: ライブラリ<155>-Footnote-455388057
Ref: ライブラリ<155>-Footnote-465388123
Ref: ライブラリ<155>-Footnote-475388189
Ref: ライブラリ<155>-Footnote-485388255
Ref: ライブラリ<155>-Footnote-495388321
Ref: ライブラリ<155>-Footnote-505388387
Node: ドキュメント<48>5388453
Ref: whatsnew/changelog id6775388582
Ref: 1daa5388582
Ref: ドキュメント<48>-Footnote-15389251
Ref: ドキュメント<48>-Footnote-25389316
Ref: ドキュメント<48>-Footnote-35389381
Ref: ドキュメント<48>-Footnote-45389446
Ref: ドキュメント<48>-Footnote-55389511
Node: テスト<48>5389576
Ref: whatsnew/changelog id6785389698
Ref: 1dab5389698
Ref: テスト<48>-Footnote-15390058
Ref: テスト<48>-Footnote-25390123
Node: ビルド<55>5390188
Ref: whatsnew/changelog id6795390299
Ref: 1dac5390299
Ref: ビルド<55>-Footnote-15390644
Ref: ビルド<55>-Footnote-25390709
Node: Windows<47>5390774
Ref: whatsnew/changelog id6805390881
Ref: 1dad5390881
Ref: Windows<47>-Footnote-15391334
Ref: Windows<47>-Footnote-25391399
Ref: Windows<47>-Footnote-35391464
Node: macOS<38>5391529
Ref: whatsnew/changelog id6815391638
Ref: 1dae5391638
Ref: macOS<38>-Footnote-15392261
Ref: macOS<38>-Footnote-25392326
Node: Tools/Demos<30>5392391
Ref: whatsnew/changelog id6825392498
Ref: 1daf5392498
Ref: Tools/Demos<30>-Footnote-15392983
Ref: Tools/Demos<30>-Footnote-25393048
Ref: Tools/Demos<30>-Footnote-35393113
Node: C API<49>5393178
Ref: whatsnew/changelog id6835393267
Ref: 1db05393267
Ref: C API<49>-Footnote-15395293
Ref: C API<49>-Footnote-25395358
Ref: C API<49>-Footnote-35395423
Ref: C API<49>-Footnote-45395488
Ref: C API<49>-Footnote-55395553
Ref: C API<49>-Footnote-65395618
Ref: C API<49>-Footnote-75395683
Ref: C API<49>-Footnote-85395748
Ref: C API<49>-Footnote-95395813
Ref: C API<49>-Footnote-105395878
Ref: C API<49>-Footnote-115395944
Node: Python 3 9 0 alpha 65395987
Ref: whatsnew/changelog python-3-9-0-alpha-65396113
Ref: 1db15396113
Node: セキュリティ<43>5396561
Ref: whatsnew/changelog id6845396671
Ref: 1db25396671
Ref: セキュリティ<43>-Footnote-15397333
Ref: セキュリティ<43>-Footnote-25397398
Ref: セキュリティ<43>-Footnote-35397463
Ref: セキュリティ<43>-Footnote-45397528
Node: Core and Builtins<153>5397583
Ref: whatsnew/changelog id6855397722
Ref: 1db35397722
Ref: Core and Builtins<153>-Footnote-15401496
Ref: Core and Builtins<153>-Footnote-25401561
Ref: Core and Builtins<153>-Footnote-35401626
Ref: Core and Builtins<153>-Footnote-45401691
Ref: Core and Builtins<153>-Footnote-55401756
Ref: Core and Builtins<153>-Footnote-65401821
Ref: Core and Builtins<153>-Footnote-75401886
Ref: Core and Builtins<153>-Footnote-85401951
Ref: Core and Builtins<153>-Footnote-95402016
Ref: Core and Builtins<153>-Footnote-105402081
Ref: Core and Builtins<153>-Footnote-115402124
Ref: Core and Builtins<153>-Footnote-125402190
Ref: Core and Builtins<153>-Footnote-135402258
Ref: Core and Builtins<153>-Footnote-145402301
Ref: Core and Builtins<153>-Footnote-155402369
Ref: Core and Builtins<153>-Footnote-165402412
Ref: Core and Builtins<153>-Footnote-175402480
Ref: Core and Builtins<153>-Footnote-185402523
Ref: Core and Builtins<153>-Footnote-195402589
Ref: Core and Builtins<153>-Footnote-205402655
Ref: Core and Builtins<153>-Footnote-215402723
Ref: Core and Builtins<153>-Footnote-225402791
Ref: Core and Builtins<153>-Footnote-235402857
Ref: Core and Builtins<153>-Footnote-245402925
Ref: Core and Builtins<153>-Footnote-255402968
Ref: Core and Builtins<153>-Footnote-265403036
Ref: Core and Builtins<153>-Footnote-275403079
Ref: Core and Builtins<153>-Footnote-285403145
Ref: Core and Builtins<153>-Footnote-295403211
Ref: Core and Builtins<153>-Footnote-305403254
Ref: Core and Builtins<153>-Footnote-315403320
Ref: Core and Builtins<153>-Footnote-325403386
Ref: Core and Builtins<153>-Footnote-335403452
Node: ライブラリ<156>5403495
Ref: whatsnew/changelog id6865403634
Ref: 1db45403634
Ref: ライブラリ<156>-Footnote-15413885
Ref: ライブラリ<156>-Footnote-25413950
Ref: ライブラリ<156>-Footnote-35414015
Ref: ライブラリ<156>-Footnote-45414080
Ref: ライブラリ<156>-Footnote-55414145
Ref: ライブラリ<156>-Footnote-65414210
Ref: ライブラリ<156>-Footnote-75414252
Ref: ライブラリ<156>-Footnote-85414317
Ref: ライブラリ<156>-Footnote-95414382
Ref: ライブラリ<156>-Footnote-105414447
Ref: ライブラリ<156>-Footnote-115414513
Ref: ライブラリ<156>-Footnote-125414579
Ref: ライブラリ<156>-Footnote-135414645
Ref: ライブラリ<156>-Footnote-145414711
Ref: ライブラリ<156>-Footnote-155414777
Ref: ライブラリ<156>-Footnote-165414843
Ref: ライブラリ<156>-Footnote-175414909
Ref: ライブラリ<156>-Footnote-185414975
Ref: ライブラリ<156>-Footnote-195415041
Ref: ライブラリ<156>-Footnote-205415107
Ref: ライブラリ<156>-Footnote-215415173
Ref: ライブラリ<156>-Footnote-225415239
Ref: ライブラリ<156>-Footnote-235415305
Ref: ライブラリ<156>-Footnote-245415371
Ref: ライブラリ<156>-Footnote-255415437
Ref: ライブラリ<156>-Footnote-265415503
Ref: ライブラリ<156>-Footnote-275415569
Ref: ライブラリ<156>-Footnote-285415635
Ref: ライブラリ<156>-Footnote-295415701
Ref: ライブラリ<156>-Footnote-305415767
Ref: ライブラリ<156>-Footnote-315415833
Ref: ライブラリ<156>-Footnote-325415899
Ref: ライブラリ<156>-Footnote-335415965
Ref: ライブラリ<156>-Footnote-345416031
Ref: ライブラリ<156>-Footnote-355416097
Ref: ライブラリ<156>-Footnote-365416163
Ref: ライブラリ<156>-Footnote-375416229
Ref: ライブラリ<156>-Footnote-385416295
Ref: ライブラリ<156>-Footnote-395416361
Ref: ライブラリ<156>-Footnote-405416427
Ref: ライブラリ<156>-Footnote-415416493
Ref: ライブラリ<156>-Footnote-425416559
Ref: ライブラリ<156>-Footnote-435416625
Ref: ライブラリ<156>-Footnote-445416691
Ref: ライブラリ<156>-Footnote-455416757
Ref: ライブラリ<156>-Footnote-465416823
Ref: ライブラリ<156>-Footnote-475416889
Ref: ライブラリ<156>-Footnote-485416955
Ref: ライブラリ<156>-Footnote-495416998
Ref: ライブラリ<156>-Footnote-505417064
Ref: ライブラリ<156>-Footnote-515417107
Ref: ライブラリ<156>-Footnote-525417173
Ref: ライブラリ<156>-Footnote-535417239
Ref: ライブラリ<156>-Footnote-545417305
Ref: ライブラリ<156>-Footnote-555417348
Ref: ライブラリ<156>-Footnote-565417414
Ref: ライブラリ<156>-Footnote-575417480
Ref: ライブラリ<156>-Footnote-585417546
Ref: ライブラリ<156>-Footnote-595417612
Ref: ライブラリ<156>-Footnote-605417678
Ref: ライブラリ<156>-Footnote-615417744
Node: ドキュメント<49>5417810
Ref: whatsnew/changelog id6875417940
Ref: 1db75417940
Ref: ドキュメント<49>-Footnote-15418525
Ref: ドキュメント<49>-Footnote-25418590
Ref: ドキュメント<49>-Footnote-35418655
Ref: ドキュメント<49>-Footnote-45418720
Node: テスト<49>5418785
Ref: whatsnew/changelog id6885418908
Ref: 1dba5418908
Ref: テスト<49>-Footnote-15419994
Ref: テスト<49>-Footnote-25420059
Ref: テスト<49>-Footnote-35420124
Ref: テスト<49>-Footnote-45420189
Ref: テスト<49>-Footnote-55420254
Ref: テスト<49>-Footnote-65420319
Ref: テスト<49>-Footnote-75420384
Ref: テスト<49>-Footnote-85420443
Ref: テスト<49>-Footnote-95420508
Node: ビルド<56>5420572
Ref: whatsnew/changelog id6895420684
Ref: 1dbc5420684
Ref: ビルド<56>-Footnote-15421102
Ref: ビルド<56>-Footnote-25421167
Ref: ビルド<56>-Footnote-35421232
Node: Windows<48>5421297
Ref: whatsnew/changelog id6905421405
Ref: 1dbd5421405
Ref: Windows<48>-Footnote-15421618
Ref: Windows<48>-Footnote-25421683
Node: macOS<39>5421747
Ref: whatsnew/changelog id6915421850
Ref: 1dbe5421850
Ref: macOS<39>-Footnote-15422306
Ref: macOS<39>-Footnote-25422371
Node: IDLE<28>5422436
Ref: whatsnew/changelog id6925422543
Ref: 1dbf5422543
Ref: IDLE<28>-Footnote-15422887
Ref: IDLE<28>-Footnote-25422952
Node: Tools/Demos<31>5423017
Ref: whatsnew/changelog id6935423124
Ref: 1dc05423124
Ref: Tools/Demos<31>-Footnote-15423591
Ref: Tools/Demos<31>-Footnote-25423656
Ref: Tools/Demos<31>-Footnote-35423721
Node: C API<50>5423786
Ref: whatsnew/changelog id6945423876
Ref: 1dc15423876
Ref: C API<50>-Footnote-15425851
Ref: C API<50>-Footnote-25425916
Ref: C API<50>-Footnote-35425981
Ref: C API<50>-Footnote-45426046
Ref: C API<50>-Footnote-55426111
Ref: C API<50>-Footnote-65426176
Ref: C API<50>-Footnote-75426241
Ref: C API<50>-Footnote-85426306
Ref: C API<50>-Footnote-95426371
Node: Python 3 9 0 alpha 55426436
Ref: whatsnew/changelog python-3-9-0-alpha-55426563
Ref: 1dc25426563
Node: セキュリティ<44>5427011
Ref: whatsnew/changelog id6955427121
Ref: 1dc35427121
Ref: セキュリティ<44>-Footnote-15427419
Ref: セキュリティ<44>-Footnote-25427484
Node: Core and Builtins<154>5427540
Ref: whatsnew/changelog id6965427679
Ref: 1dc45427679
Ref: Core and Builtins<154>-Footnote-15433524
Ref: Core and Builtins<154>-Footnote-25433589
Ref: Core and Builtins<154>-Footnote-35433656
Ref: Core and Builtins<154>-Footnote-45433698
Ref: Core and Builtins<154>-Footnote-55433765
Ref: Core and Builtins<154>-Footnote-65433807
Ref: Core and Builtins<154>-Footnote-75433872
Ref: Core and Builtins<154>-Footnote-85433937
Ref: Core and Builtins<154>-Footnote-95434004
Ref: Core and Builtins<154>-Footnote-105434071
Ref: Core and Builtins<154>-Footnote-115434114
Ref: Core and Builtins<154>-Footnote-125434180
Ref: Core and Builtins<154>-Footnote-135434223
Ref: Core and Builtins<154>-Footnote-145434289
Ref: Core and Builtins<154>-Footnote-155434355
Ref: Core and Builtins<154>-Footnote-165434398
Ref: Core and Builtins<154>-Footnote-175434466
Ref: Core and Builtins<154>-Footnote-185434509
Ref: Core and Builtins<154>-Footnote-195434575
Ref: Core and Builtins<154>-Footnote-205434641
Ref: Core and Builtins<154>-Footnote-215434707
Ref: Core and Builtins<154>-Footnote-225434773
Ref: Core and Builtins<154>-Footnote-235434816
Ref: Core and Builtins<154>-Footnote-245434882
Ref: Core and Builtins<154>-Footnote-255434948
Ref: Core and Builtins<154>-Footnote-265435014
Ref: Core and Builtins<154>-Footnote-275435080
Ref: Core and Builtins<154>-Footnote-285435146
Ref: Core and Builtins<154>-Footnote-295435212
Ref: Core and Builtins<154>-Footnote-305435278
Ref: Core and Builtins<154>-Footnote-315435344
Ref: Core and Builtins<154>-Footnote-325435412
Ref: Core and Builtins<154>-Footnote-335435455
Ref: Core and Builtins<154>-Footnote-345435521
Ref: Core and Builtins<154>-Footnote-355435564
Ref: Core and Builtins<154>-Footnote-365435630
Ref: Core and Builtins<154>-Footnote-375435698
Ref: Core and Builtins<154>-Footnote-385435741
Ref: Core and Builtins<154>-Footnote-395435807
Ref: Core and Builtins<154>-Footnote-405435873
Ref: Core and Builtins<154>-Footnote-415435939
Ref: Core and Builtins<154>-Footnote-425436005
Node: ライブラリ<157>5436071
Ref: whatsnew/changelog id6975436210
Ref: 1dc55436210
Ref: ライブラリ<157>-Footnote-15445340
Ref: ライブラリ<157>-Footnote-25445405
Ref: ライブラリ<157>-Footnote-35445470
Ref: ライブラリ<157>-Footnote-45445535
Ref: ライブラリ<157>-Footnote-55445600
Ref: ライブラリ<157>-Footnote-65445665
Ref: ライブラリ<157>-Footnote-75445730
Ref: ライブラリ<157>-Footnote-85445795
Ref: ライブラリ<157>-Footnote-95445860
Ref: ライブラリ<157>-Footnote-105445925
Ref: ライブラリ<157>-Footnote-115445991
Ref: ライブラリ<157>-Footnote-125446057
Ref: ライブラリ<157>-Footnote-135446100
Ref: ライブラリ<157>-Footnote-145446166
Ref: ライブラリ<157>-Footnote-155446232
Ref: ライブラリ<157>-Footnote-165446298
Ref: ライブラリ<157>-Footnote-175446341
Ref: ライブラリ<157>-Footnote-185446407
Ref: ライブラリ<157>-Footnote-195446473
Ref: ライブラリ<157>-Footnote-205446539
Ref: ライブラリ<157>-Footnote-215446605
Ref: ライブラリ<157>-Footnote-225446671
Ref: ライブラリ<157>-Footnote-235446737
Ref: ライブラリ<157>-Footnote-245446803
Ref: ライブラリ<157>-Footnote-255446869
Ref: ライブラリ<157>-Footnote-265446935
Ref: ライブラリ<157>-Footnote-275447001
Ref: ライブラリ<157>-Footnote-285447067
Ref: ライブラリ<157>-Footnote-295447133
Ref: ライブラリ<157>-Footnote-305447199
Ref: ライブラリ<157>-Footnote-315447265
Ref: ライブラリ<157>-Footnote-325447331
Ref: ライブラリ<157>-Footnote-335447374
Ref: ライブラリ<157>-Footnote-345447440
Ref: ライブラリ<157>-Footnote-355447506
Ref: ライブラリ<157>-Footnote-365447572
Ref: ライブラリ<157>-Footnote-375447638
Ref: ライブラリ<157>-Footnote-385447704
Ref: ライブラリ<157>-Footnote-395447770
Ref: ライブラリ<157>-Footnote-405447813
Ref: ライブラリ<157>-Footnote-415447879
Ref: ライブラリ<157>-Footnote-425447945
Ref: ライブラリ<157>-Footnote-435448011
Ref: ライブラリ<157>-Footnote-445448077
Ref: ライブラリ<157>-Footnote-455448143
Ref: ライブラリ<157>-Footnote-465448209
Ref: ライブラリ<157>-Footnote-475448275
Ref: ライブラリ<157>-Footnote-485448341
Ref: ライブラリ<157>-Footnote-495448407
Ref: ライブラリ<157>-Footnote-505448473
Ref: ライブラリ<157>-Footnote-515448539
Ref: ライブラリ<157>-Footnote-525448605
Ref: ライブラリ<157>-Footnote-535448671
Ref: ライブラリ<157>-Footnote-545448737
Node: ドキュメント<50>5448803
Ref: whatsnew/changelog id6985448933
Ref: 1dcb5448933
Ref: ドキュメント<50>-Footnote-15449572
Ref: ドキュメント<50>-Footnote-25449637
Ref: ドキュメント<50>-Footnote-35449679
Ref: ドキュメント<50>-Footnote-45449744
Ref: ドキュメント<50>-Footnote-55449809
Ref: ドキュメント<50>-Footnote-65449874
Ref: ドキュメント<50>-Footnote-75449939
Node: テスト<50>5450004
Ref: whatsnew/changelog id6995450127
Ref: 1dcc5450127
Ref: テスト<50>-Footnote-15450810
Ref: テスト<50>-Footnote-25450875
Ref: テスト<50>-Footnote-35450940
Ref: テスト<50>-Footnote-45451005
Node: ビルド<57>5451070
Ref: whatsnew/changelog id7005451182
Ref: 1dcd5451182
Ref: ビルド<57>-Footnote-15452057
Ref: ビルド<57>-Footnote-25452122
Ref: ビルド<57>-Footnote-35452187
Node: Windows<49>5452254
Ref: whatsnew/changelog id7015452362
Ref: 1dce5452362
Ref: Windows<49>-Footnote-15453244
Ref: Windows<49>-Footnote-25453309
Ref: Windows<49>-Footnote-35453374
Ref: Windows<49>-Footnote-45453439
Ref: Windows<49>-Footnote-55453504
Ref: Windows<49>-Footnote-65453569
Node: macOS<40>5453634
Ref: whatsnew/changelog id7025453737
Ref: 1dcf5453737
Ref: macOS<40>-Footnote-15453867
Node: IDLE<29>5453932
Ref: whatsnew/changelog id7035454039
Ref: 1dd05454039
Ref: IDLE<29>-Footnote-15454593
Ref: IDLE<29>-Footnote-25454658
Ref: IDLE<29>-Footnote-35454723
Ref: IDLE<29>-Footnote-45454788
Node: Tools/Demos<32>5454853
Ref: whatsnew/changelog id7045454960
Ref: 1dd15454960
Ref: Tools/Demos<32>-Footnote-15455489
Ref: Tools/Demos<32>-Footnote-25455554
Node: C API<51>5455619
Ref: whatsnew/changelog id7055455709
Ref: 1dd25455709
Ref: C API<51>-Footnote-15459253
Ref: C API<51>-Footnote-25459318
Ref: C API<51>-Footnote-35459383
Ref: C API<51>-Footnote-45459448
Ref: C API<51>-Footnote-55459513
Ref: C API<51>-Footnote-65459578
Ref: C API<51>-Footnote-75459643
Ref: C API<51>-Footnote-85459708
Ref: C API<51>-Footnote-95459773
Ref: C API<51>-Footnote-105459838
Ref: C API<51>-Footnote-115459904
Ref: C API<51>-Footnote-125459970
Ref: C API<51>-Footnote-135460036
Ref: C API<51>-Footnote-145460102
Ref: C API<51>-Footnote-155460168
Ref: C API<51>-Footnote-165460234
Ref: C API<51>-Footnote-175460300
Node: Python 3 9 0 alpha 45460366
Ref: whatsnew/changelog python-3-9-0-alpha-45460493
Ref: 1dd75460493
Node: セキュリティ<45>5460886
Ref: whatsnew/changelog id7065460996
Ref: 1dd85460996
Ref: セキュリティ<45>-Footnote-15461421
Ref: セキュリティ<45>-Footnote-25461486
Ref: セキュリティ<45>-Footnote-35461551
Node: Core and Builtins<155>5461616
Ref: whatsnew/changelog id7075461755
Ref: 1dd95461755
Ref: Core and Builtins<155>-Footnote-15465158
Ref: Core and Builtins<155>-Footnote-25465223
Ref: Core and Builtins<155>-Footnote-35465288
Ref: Core and Builtins<155>-Footnote-45465353
Ref: Core and Builtins<155>-Footnote-55465418
Ref: Core and Builtins<155>-Footnote-65465483
Ref: Core and Builtins<155>-Footnote-75465548
Ref: Core and Builtins<155>-Footnote-85465613
Ref: Core and Builtins<155>-Footnote-95465680
Ref: Core and Builtins<155>-Footnote-105465722
Ref: Core and Builtins<155>-Footnote-115465790
Ref: Core and Builtins<155>-Footnote-125465833
Ref: Core and Builtins<155>-Footnote-135465899
Ref: Core and Builtins<155>-Footnote-145465965
Ref: Core and Builtins<155>-Footnote-155466031
Ref: Core and Builtins<155>-Footnote-165466097
Ref: Core and Builtins<155>-Footnote-175466163
Ref: Core and Builtins<155>-Footnote-185466231
Ref: Core and Builtins<155>-Footnote-195466274
Ref: Core and Builtins<155>-Footnote-205466342
Ref: Core and Builtins<155>-Footnote-215466385
Ref: Core and Builtins<155>-Footnote-225466453
Ref: Core and Builtins<155>-Footnote-235466496
Ref: Core and Builtins<155>-Footnote-245466562
Ref: Core and Builtins<155>-Footnote-255466628
Ref: Core and Builtins<155>-Footnote-265466694
Ref: Core and Builtins<155>-Footnote-275466760
Ref: Core and Builtins<155>-Footnote-285466826
Ref: Core and Builtins<155>-Footnote-295466892
Node: ライブラリ<158>5466958
Ref: whatsnew/changelog id7085467097
Ref: 1ddc5467097
Ref: ライブラリ<158>-Footnote-15473279
Ref: ライブラリ<158>-Footnote-25473344
Ref: ライブラリ<158>-Footnote-35473409
Ref: ライブラリ<158>-Footnote-45473474
Ref: ライブラリ<158>-Footnote-55473539
Ref: ライブラリ<158>-Footnote-65473604
Ref: ライブラリ<158>-Footnote-75473669
Ref: ライブラリ<158>-Footnote-85473734
Ref: ライブラリ<158>-Footnote-95473799
Ref: ライブラリ<158>-Footnote-105473864
Ref: ライブラリ<158>-Footnote-115473930
Ref: ライブラリ<158>-Footnote-125473996
Ref: ライブラリ<158>-Footnote-135474062
Ref: ライブラリ<158>-Footnote-145474128
Ref: ライブラリ<158>-Footnote-155474194
Ref: ライブラリ<158>-Footnote-165474260
Ref: ライブラリ<158>-Footnote-175474342
Ref: ライブラリ<158>-Footnote-185474408
Ref: ライブラリ<158>-Footnote-195474474
Ref: ライブラリ<158>-Footnote-205474540
Ref: ライブラリ<158>-Footnote-215474606
Ref: ライブラリ<158>-Footnote-225474672
Ref: ライブラリ<158>-Footnote-235474738
Ref: ライブラリ<158>-Footnote-245474804
Ref: ライブラリ<158>-Footnote-255474870
Ref: ライブラリ<158>-Footnote-265474936
Ref: ライブラリ<158>-Footnote-275475002
Ref: ライブラリ<158>-Footnote-285475045
Ref: ライブラリ<158>-Footnote-295475111
Ref: ライブラリ<158>-Footnote-305475177
Ref: ライブラリ<158>-Footnote-315475243
Ref: ライブラリ<158>-Footnote-325475309
Ref: ライブラリ<158>-Footnote-335475375
Ref: ライブラリ<158>-Footnote-345475441
Ref: ライブラリ<158>-Footnote-355475507
Ref: ライブラリ<158>-Footnote-365475573
Ref: ライブラリ<158>-Footnote-375475639
Ref: ライブラリ<158>-Footnote-385475705
Ref: ライブラリ<158>-Footnote-395475771
Node: ドキュメント<51>5475837
Ref: whatsnew/changelog id7095475967
Ref: 1dde5475967
Ref: ドキュメント<51>-Footnote-15477002
Ref: ドキュメント<51>-Footnote-25477067
Ref: ドキュメント<51>-Footnote-35477132
Ref: ドキュメント<51>-Footnote-45477197
Ref: ドキュメント<51>-Footnote-55477262
Ref: ドキュメント<51>-Footnote-65477327
Ref: ドキュメント<51>-Footnote-75477392
Node: テスト<51>5477456
Ref: whatsnew/changelog id7105477579
Ref: 1ddf5477579
Ref: テスト<51>-Footnote-15477918
Ref: テスト<51>-Footnote-25477983
Node: ビルド<58>5478048
Ref: whatsnew/changelog id7115478160
Ref: 1de05478160
Ref: ビルド<58>-Footnote-15478295
Node: Windows<50>5478360
Ref: whatsnew/changelog id7125478467
Ref: 1de15478467
Ref: Windows<50>-Footnote-15479275
Ref: Windows<50>-Footnote-25479340
Ref: Windows<50>-Footnote-35479405
Ref: Windows<50>-Footnote-45479470
Ref: Windows<50>-Footnote-55479535
Ref: Windows<50>-Footnote-65479600
Node: IDLE<30>5479665
Ref: whatsnew/changelog id7135479768
Ref: 1de25479768
Ref: IDLE<30>-Footnote-15480315
Ref: IDLE<30>-Footnote-25480380
Ref: IDLE<30>-Footnote-35480445
Ref: IDLE<30>-Footnote-45480510
Ref: IDLE<30>-Footnote-55480575
Node: C API<52>5480640
Ref: whatsnew/changelog id7145480723
Ref: 1de35480723
Ref: C API<52>-Footnote-15483382
Ref: C API<52>-Footnote-25483447
Ref: C API<52>-Footnote-35483512
Ref: C API<52>-Footnote-45483577
Ref: C API<52>-Footnote-55483642
Ref: C API<52>-Footnote-65483707
Ref: C API<52>-Footnote-75483772
Ref: C API<52>-Footnote-85483837
Ref: C API<52>-Footnote-95483902
Ref: C API<52>-Footnote-105483967
Ref: C API<52>-Footnote-115484033
Ref: C API<52>-Footnote-125484099
Node: Python 3 9 0 alpha 35484165
Ref: whatsnew/changelog python-3-9-0-alpha-35484292
Ref: 1de85484292
Node: Core and Builtins<156>5484587
Ref: whatsnew/changelog id7155484695
Ref: 1de95484695
Ref: Core and Builtins<156>-Footnote-15488781
Ref: Core and Builtins<156>-Footnote-25488846
Ref: Core and Builtins<156>-Footnote-35488911
Ref: Core and Builtins<156>-Footnote-45488976
Ref: Core and Builtins<156>-Footnote-55489041
Ref: Core and Builtins<156>-Footnote-65489106
Ref: Core and Builtins<156>-Footnote-75489171
Ref: Core and Builtins<156>-Footnote-85489236
Ref: Core and Builtins<156>-Footnote-95489301
Ref: Core and Builtins<156>-Footnote-105489366
Ref: Core and Builtins<156>-Footnote-115489432
Ref: Core and Builtins<156>-Footnote-125489500
Ref: Core and Builtins<156>-Footnote-135489543
Ref: Core and Builtins<156>-Footnote-145489609
Ref: Core and Builtins<156>-Footnote-155489675
Ref: Core and Builtins<156>-Footnote-165489741
Ref: Core and Builtins<156>-Footnote-175489807
Ref: Core and Builtins<156>-Footnote-185489873
Ref: Core and Builtins<156>-Footnote-195489939
Ref: Core and Builtins<156>-Footnote-205490005
Ref: Core and Builtins<156>-Footnote-215490071
Ref: Core and Builtins<156>-Footnote-225490137
Ref: Core and Builtins<156>-Footnote-235490203
Ref: Core and Builtins<156>-Footnote-245490269
Node: ライブラリ<159>5490335
Ref: whatsnew/changelog id7165490474
Ref: 1ded5490474
Ref: ライブラリ<159>-Footnote-15500077
Ref: ライブラリ<159>-Footnote-25500142
Ref: ライブラリ<159>-Footnote-35500207
Ref: ライブラリ<159>-Footnote-45500272
Ref: ライブラリ<159>-Footnote-55500337
Ref: ライブラリ<159>-Footnote-65500402
Ref: ライブラリ<159>-Footnote-75500467
Ref: ライブラリ<159>-Footnote-85500532
Ref: ライブラリ<159>-Footnote-95500597
Ref: ライブラリ<159>-Footnote-105500662
Ref: ライブラリ<159>-Footnote-115500728
Ref: ライブラリ<159>-Footnote-125500794
Ref: ライブラリ<159>-Footnote-135500860
Ref: ライブラリ<159>-Footnote-145500926
Ref: ライブラリ<159>-Footnote-155500992
Ref: ライブラリ<159>-Footnote-165501058
Ref: ライブラリ<159>-Footnote-175501124
Ref: ライブラリ<159>-Footnote-185501190
Ref: ライブラリ<159>-Footnote-195501256
Ref: ライブラリ<159>-Footnote-205501322
Ref: ライブラリ<159>-Footnote-215501388
Ref: ライブラリ<159>-Footnote-225501454
Ref: ライブラリ<159>-Footnote-235501520
Ref: ライブラリ<159>-Footnote-245501586
Ref: ライブラリ<159>-Footnote-255501652
Ref: ライブラリ<159>-Footnote-265501718
Ref: ライブラリ<159>-Footnote-275501784
Ref: ライブラリ<159>-Footnote-285501850
Ref: ライブラリ<159>-Footnote-295501916
Ref: ライブラリ<159>-Footnote-305501982
Ref: ライブラリ<159>-Footnote-315502048
Ref: ライブラリ<159>-Footnote-325502114
Ref: ライブラリ<159>-Footnote-335502180
Ref: ライブラリ<159>-Footnote-345502246
Ref: ライブラリ<159>-Footnote-355502312
Ref: ライブラリ<159>-Footnote-365502378
Ref: ライブラリ<159>-Footnote-375502444
Ref: ライブラリ<159>-Footnote-385502510
Ref: ライブラリ<159>-Footnote-395502576
Ref: ライブラリ<159>-Footnote-405502642
Ref: ライブラリ<159>-Footnote-415502708
Ref: ライブラリ<159>-Footnote-425502774
Ref: ライブラリ<159>-Footnote-435502840
Ref: ライブラリ<159>-Footnote-445502906
Ref: ライブラリ<159>-Footnote-455502972
Ref: ライブラリ<159>-Footnote-465503038
Ref: ライブラリ<159>-Footnote-475503104
Ref: ライブラリ<159>-Footnote-485503170
Ref: ライブラリ<159>-Footnote-495503236
Ref: ライブラリ<159>-Footnote-505503302
Ref: ライブラリ<159>-Footnote-515503368
Ref: ライブラリ<159>-Footnote-525503434
Ref: ライブラリ<159>-Footnote-535503500
Node: ドキュメント<52>5503566
Ref: whatsnew/changelog id7175503696
Ref: 1dee5503696
Ref: ドキュメント<52>-Footnote-15504308
Ref: ドキュメント<52>-Footnote-25504373
Ref: ドキュメント<52>-Footnote-35504438
Node: ビルド<59>5504502
Ref: whatsnew/changelog id7185504620
Ref: 1df05504620
Ref: ビルド<59>-Footnote-15505151
Ref: ビルド<59>-Footnote-25505216
Ref: ビルド<59>-Footnote-35505281
Node: IDLE<31>5505346
Ref: whatsnew/changelog id7195505451
Ref: 1df15505451
Ref: IDLE<31>-Footnote-15505872
Ref: IDLE<31>-Footnote-25505937
Ref: IDLE<31>-Footnote-35506002
Node: C API<53>5506067
Ref: whatsnew/changelog id7205506150
Ref: 1df25506150
Ref: C API<53>-Footnote-15506915
Ref: C API<53>-Footnote-25506980
Node: Python 3 9 0 alpha 25507045
Ref: whatsnew/changelog python-3-9-0-alpha-25507172
Ref: 1df35507172
Node: セキュリティ<46>5507585
Ref: whatsnew/changelog id7215507695
Ref: 1df45507695
Ref: セキュリティ<46>-Footnote-15508582
Ref: セキュリティ<46>-Footnote-25508647
Ref: セキュリティ<46>-Footnote-35508712
Ref: セキュリティ<46>-Footnote-45508777
Node: Core and Builtins<157>5508842
Ref: whatsnew/changelog id7225508981
Ref: 1df55508981
Ref: Core and Builtins<157>-Footnote-15512650
Ref: Core and Builtins<157>-Footnote-25512715
Ref: Core and Builtins<157>-Footnote-35512780
Ref: Core and Builtins<157>-Footnote-45512845
Ref: Core and Builtins<157>-Footnote-55512910
Ref: Core and Builtins<157>-Footnote-65512975
Ref: Core and Builtins<157>-Footnote-75513040
Ref: Core and Builtins<157>-Footnote-85513105
Ref: Core and Builtins<157>-Footnote-95513170
Ref: Core and Builtins<157>-Footnote-105513235
Ref: Core and Builtins<157>-Footnote-115513301
Ref: Core and Builtins<157>-Footnote-125513367
Ref: Core and Builtins<157>-Footnote-135513433
Ref: Core and Builtins<157>-Footnote-145513499
Ref: Core and Builtins<157>-Footnote-155513565
Ref: Core and Builtins<157>-Footnote-165513631
Ref: Core and Builtins<157>-Footnote-175513697
Ref: Core and Builtins<157>-Footnote-185513763
Ref: Core and Builtins<157>-Footnote-195513829
Ref: Core and Builtins<157>-Footnote-205513895
Node: ライブラリ<160>5513961
Ref: whatsnew/changelog id7235514100
Ref: 1df65514100
Ref: ライブラリ<160>-Footnote-15521891
Ref: ライブラリ<160>-Footnote-25521956
Ref: ライブラリ<160>-Footnote-35522021
Ref: ライブラリ<160>-Footnote-45522086
Ref: ライブラリ<160>-Footnote-55522151
Ref: ライブラリ<160>-Footnote-65522216
Ref: ライブラリ<160>-Footnote-75522281
Ref: ライブラリ<160>-Footnote-85522346
Ref: ライブラリ<160>-Footnote-95522411
Ref: ライブラリ<160>-Footnote-105522476
Ref: ライブラリ<160>-Footnote-115522542
Ref: ライブラリ<160>-Footnote-125522608
Ref: ライブラリ<160>-Footnote-135522674
Ref: ライブラリ<160>-Footnote-145522740
Ref: ライブラリ<160>-Footnote-155522806
Ref: ライブラリ<160>-Footnote-165522872
Ref: ライブラリ<160>-Footnote-175522938
Ref: ライブラリ<160>-Footnote-185523004
Ref: ライブラリ<160>-Footnote-195523070
Ref: ライブラリ<160>-Footnote-205523136
Ref: ライブラリ<160>-Footnote-215523202
Ref: ライブラリ<160>-Footnote-225523268
Ref: ライブラリ<160>-Footnote-235523334
Ref: ライブラリ<160>-Footnote-245523400
Ref: ライブラリ<160>-Footnote-255523466
Ref: ライブラリ<160>-Footnote-265523532
Ref: ライブラリ<160>-Footnote-275523598
Ref: ライブラリ<160>-Footnote-285523664
Ref: ライブラリ<160>-Footnote-295523730
Ref: ライブラリ<160>-Footnote-305523796
Ref: ライブラリ<160>-Footnote-315523862
Ref: ライブラリ<160>-Footnote-325523928
Ref: ライブラリ<160>-Footnote-335523994
Ref: ライブラリ<160>-Footnote-345524060
Ref: ライブラリ<160>-Footnote-355524126
Ref: ライブラリ<160>-Footnote-365524192
Ref: ライブラリ<160>-Footnote-375524258
Ref: ライブラリ<160>-Footnote-385524324
Ref: ライブラリ<160>-Footnote-395524390
Ref: ライブラリ<160>-Footnote-405524456
Node: ドキュメント<53>5524522
Ref: whatsnew/changelog id7245524652
Ref: 1df75524652
Ref: ドキュメント<53>-Footnote-15525241
Ref: ドキュメント<53>-Footnote-25525306
Ref: ドキュメント<53>-Footnote-35525371
Node: テスト<52>5525436
Ref: whatsnew/changelog id7255525559
Ref: 1df85525559
Ref: テスト<52>-Footnote-15528130
Ref: テスト<52>-Footnote-25528195
Ref: テスト<52>-Footnote-35528260
Ref: テスト<52>-Footnote-45528325
Ref: テスト<52>-Footnote-55528390
Ref: テスト<52>-Footnote-65528455
Ref: テスト<52>-Footnote-75528520
Ref: テスト<52>-Footnote-85528585
Ref: テスト<52>-Footnote-95528650
Ref: テスト<52>-Footnote-105528715
Ref: テスト<52>-Footnote-115528781
Ref: テスト<52>-Footnote-125528847
Ref: テスト<52>-Footnote-135528913
Node: ビルド<60>5528979
Ref: whatsnew/changelog id7265529091
Ref: 1dfc5529091
Ref: ビルド<60>-Footnote-15529494
Ref: ビルド<60>-Footnote-25529559
Node: Windows<51>5529624
Ref: whatsnew/changelog id7275529732
Ref: 1dfd5529732
Ref: Windows<51>-Footnote-15529973
Ref: Windows<51>-Footnote-25530038
Node: macOS<41>5530103
Ref: whatsnew/changelog id7285530206
Ref: 1dfe5530206
Ref: macOS<41>-Footnote-15530514
Node: IDLE<32>5530579
Ref: whatsnew/changelog id7295530680
Ref: 1dff5530680
Ref: IDLE<32>-Footnote-15531271
Ref: IDLE<32>-Footnote-25531336
Ref: IDLE<32>-Footnote-35531401
Ref: IDLE<32>-Footnote-45531466
Node: C API<54>5531531
Ref: whatsnew/changelog id7305531614
Ref: 1e005531614
Ref: C API<54>-Footnote-15532148
Ref: C API<54>-Footnote-25532213
Ref: C API<54>-Footnote-35532278
Node: Python 3 9 0 alpha 15532343
Ref: whatsnew/changelog python-3-9-0-alpha-15532469
Ref: 1e015532469
Node: セキュリティ<47>5532914
Ref: whatsnew/changelog id7315533024
Ref: 1e025533024
Ref: セキュリティ<47>-Footnote-15535359
Ref: セキュリティ<47>-Footnote-25535424
Ref: セキュリティ<47>-Footnote-35535489
Ref: セキュリティ<47>-Footnote-45535554
Ref: セキュリティ<47>-Footnote-55535619
Ref: セキュリティ<47>-Footnote-65535684
Ref: セキュリティ<47>-Footnote-75535749
Ref: セキュリティ<47>-Footnote-85535805
Ref: セキュリティ<47>-Footnote-95535870
Ref: セキュリティ<47>-Footnote-105535935
Ref: セキュリティ<47>-Footnote-115536001
Ref: セキュリティ<47>-Footnote-125536067
Ref: セキュリティ<47>-Footnote-135536133
Ref: セキュリティ<47>-Footnote-145536199
Ref: セキュリティ<47>-Footnote-155536265
Node: Core and Builtins<158>5536331
Ref: whatsnew/changelog id7325536470
Ref: 1e055536470
Ref: Core and Builtins<158>-Footnote-15551982
Ref: Core and Builtins<158>-Footnote-25552047
Ref: Core and Builtins<158>-Footnote-35552112
Ref: Core and Builtins<158>-Footnote-45552177
Ref: Core and Builtins<158>-Footnote-55552242
Ref: Core and Builtins<158>-Footnote-65552307
Ref: Core and Builtins<158>-Footnote-75552372
Ref: Core and Builtins<158>-Footnote-85552437
Ref: Core and Builtins<158>-Footnote-95552502
Ref: Core and Builtins<158>-Footnote-105552567
Ref: Core and Builtins<158>-Footnote-115552633
Ref: Core and Builtins<158>-Footnote-125552699
Ref: Core and Builtins<158>-Footnote-135552765
Ref: Core and Builtins<158>-Footnote-145552831
Ref: Core and Builtins<158>-Footnote-155552897
Ref: Core and Builtins<158>-Footnote-165552963
Ref: Core and Builtins<158>-Footnote-175553029
Ref: Core and Builtins<158>-Footnote-185553095
Ref: Core and Builtins<158>-Footnote-195553161
Ref: Core and Builtins<158>-Footnote-205553227
Ref: Core and Builtins<158>-Footnote-215553270
Ref: Core and Builtins<158>-Footnote-225553336
Ref: Core and Builtins<158>-Footnote-235553402
Ref: Core and Builtins<158>-Footnote-245553468
Ref: Core and Builtins<158>-Footnote-255553534
Ref: Core and Builtins<158>-Footnote-265553600
Ref: Core and Builtins<158>-Footnote-275553666
Ref: Core and Builtins<158>-Footnote-285553732
Ref: Core and Builtins<158>-Footnote-295553798
Ref: Core and Builtins<158>-Footnote-305553864
Ref: Core and Builtins<158>-Footnote-315553930
Ref: Core and Builtins<158>-Footnote-325553996
Ref: Core and Builtins<158>-Footnote-335554062
Ref: Core and Builtins<158>-Footnote-345554128
Ref: Core and Builtins<158>-Footnote-355554194
Ref: Core and Builtins<158>-Footnote-365554260
Ref: Core and Builtins<158>-Footnote-375554326
Ref: Core and Builtins<158>-Footnote-385554392
Ref: Core and Builtins<158>-Footnote-395554458
Ref: Core and Builtins<158>-Footnote-405554524
Ref: Core and Builtins<158>-Footnote-415554589
Ref: Core and Builtins<158>-Footnote-425554655
Ref: Core and Builtins<158>-Footnote-435554721
Ref: Core and Builtins<158>-Footnote-445554787
Ref: Core and Builtins<158>-Footnote-455554853
Ref: Core and Builtins<158>-Footnote-465554919
Ref: Core and Builtins<158>-Footnote-475554985
Ref: Core and Builtins<158>-Footnote-485555051
Ref: Core and Builtins<158>-Footnote-495555117
Ref: Core and Builtins<158>-Footnote-505555183
Ref: Core and Builtins<158>-Footnote-515555249
Ref: Core and Builtins<158>-Footnote-525555315
Ref: Core and Builtins<158>-Footnote-535555381
Ref: Core and Builtins<158>-Footnote-545555424
Ref: Core and Builtins<158>-Footnote-555555490
Ref: Core and Builtins<158>-Footnote-565555556
Ref: Core and Builtins<158>-Footnote-575555622
Ref: Core and Builtins<158>-Footnote-585555688
Ref: Core and Builtins<158>-Footnote-595555754
Ref: Core and Builtins<158>-Footnote-605555820
Ref: Core and Builtins<158>-Footnote-615555886
Ref: Core and Builtins<158>-Footnote-625555952
Ref: Core and Builtins<158>-Footnote-635556018
Ref: Core and Builtins<158>-Footnote-645556084
Ref: Core and Builtins<158>-Footnote-655556150
Ref: Core and Builtins<158>-Footnote-665556216
Ref: Core and Builtins<158>-Footnote-675556282
Ref: Core and Builtins<158>-Footnote-685556348
Ref: Core and Builtins<158>-Footnote-695556414
Ref: Core and Builtins<158>-Footnote-705556480
Ref: Core and Builtins<158>-Footnote-715556546
Ref: Core and Builtins<158>-Footnote-725556612
Ref: Core and Builtins<158>-Footnote-735556678
Ref: Core and Builtins<158>-Footnote-745556744
Ref: Core and Builtins<158>-Footnote-755556810
Ref: Core and Builtins<158>-Footnote-765556876
Ref: Core and Builtins<158>-Footnote-775556942
Ref: Core and Builtins<158>-Footnote-785557008
Ref: Core and Builtins<158>-Footnote-795557074
Ref: Core and Builtins<158>-Footnote-805557140
Ref: Core and Builtins<158>-Footnote-815557206
Ref: Core and Builtins<158>-Footnote-825557272
Ref: Core and Builtins<158>-Footnote-835557338
Ref: Core and Builtins<158>-Footnote-845557404
Ref: Core and Builtins<158>-Footnote-855557470
Ref: Core and Builtins<158>-Footnote-865557536
Ref: Core and Builtins<158>-Footnote-875557602
Ref: Core and Builtins<158>-Footnote-885557668
Ref: Core and Builtins<158>-Footnote-895557734
Ref: Core and Builtins<158>-Footnote-905557800
Ref: Core and Builtins<158>-Footnote-915557866
Ref: Core and Builtins<158>-Footnote-925557932
Ref: Core and Builtins<158>-Footnote-935557998
Ref: Core and Builtins<158>-Footnote-945558064
Node: ライブラリ<161>5558130
Ref: whatsnew/changelog id7335558269
Ref: 1e075558269
Ref: ライブラリ<161>-Footnote-15597652
Ref: ライブラリ<161>-Footnote-25597717
Ref: ライブラリ<161>-Footnote-35597782
Ref: ライブラリ<161>-Footnote-45597847
Ref: ライブラリ<161>-Footnote-55597912
Ref: ライブラリ<161>-Footnote-65597977
Ref: ライブラリ<161>-Footnote-75598042
Ref: ライブラリ<161>-Footnote-85598107
Ref: ライブラリ<161>-Footnote-95598172
Ref: ライブラリ<161>-Footnote-105598237
Ref: ライブラリ<161>-Footnote-115598303
Ref: ライブラリ<161>-Footnote-125598369
Ref: ライブラリ<161>-Footnote-135598435
Ref: ライブラリ<161>-Footnote-145598501
Ref: ライブラリ<161>-Footnote-155598567
Ref: ライブラリ<161>-Footnote-165598633
Ref: ライブラリ<161>-Footnote-175598699
Ref: ライブラリ<161>-Footnote-185598765
Ref: ライブラリ<161>-Footnote-195598831
Ref: ライブラリ<161>-Footnote-205598897
Ref: ライブラリ<161>-Footnote-215598963
Ref: ライブラリ<161>-Footnote-225599029
Ref: ライブラリ<161>-Footnote-235599095
Ref: ライブラリ<161>-Footnote-245599161
Ref: ライブラリ<161>-Footnote-255599227
Ref: ライブラリ<161>-Footnote-265599293
Ref: ライブラリ<161>-Footnote-275599359
Ref: ライブラリ<161>-Footnote-285599425
Ref: ライブラリ<161>-Footnote-295599491
Ref: ライブラリ<161>-Footnote-305599557
Ref: ライブラリ<161>-Footnote-315599623
Ref: ライブラリ<161>-Footnote-325599689
Ref: ライブラリ<161>-Footnote-335599755
Ref: ライブラリ<161>-Footnote-345599821
Ref: ライブラリ<161>-Footnote-355599887
Ref: ライブラリ<161>-Footnote-365599953
Ref: ライブラリ<161>-Footnote-375600019
Ref: ライブラリ<161>-Footnote-385600085
Ref: ライブラリ<161>-Footnote-395600151
Ref: ライブラリ<161>-Footnote-405600217
Ref: ライブラリ<161>-Footnote-415600283
Ref: ライブラリ<161>-Footnote-425600349
Ref: ライブラリ<161>-Footnote-435600415
Ref: ライブラリ<161>-Footnote-445600481
Ref: ライブラリ<161>-Footnote-455600547
Ref: ライブラリ<161>-Footnote-465600613
Ref: ライブラリ<161>-Footnote-475600679
Ref: ライブラリ<161>-Footnote-485600745
Ref: ライブラリ<161>-Footnote-495600811
Ref: ライブラリ<161>-Footnote-505600877
Ref: ライブラリ<161>-Footnote-515600943
Ref: ライブラリ<161>-Footnote-525601009
Ref: ライブラリ<161>-Footnote-535601075
Ref: ライブラリ<161>-Footnote-545601141
Ref: ライブラリ<161>-Footnote-555601207
Ref: ライブラリ<161>-Footnote-565601273
Ref: ライブラリ<161>-Footnote-575601339
Ref: ライブラリ<161>-Footnote-585601405
Ref: ライブラリ<161>-Footnote-595601471
Ref: ライブラリ<161>-Footnote-605601537
Ref: ライブラリ<161>-Footnote-615601603
Ref: ライブラリ<161>-Footnote-625601669
Ref: ライブラリ<161>-Footnote-635601735
Ref: ライブラリ<161>-Footnote-645601800
Ref: ライブラリ<161>-Footnote-655601866
Ref: ライブラリ<161>-Footnote-665601932
Ref: ライブラリ<161>-Footnote-675601998
Ref: ライブラリ<161>-Footnote-685602064
Ref: ライブラリ<161>-Footnote-695602130
Ref: ライブラリ<161>-Footnote-705602196
Ref: ライブラリ<161>-Footnote-715602262
Ref: ライブラリ<161>-Footnote-725602328
Ref: ライブラリ<161>-Footnote-735602394
Ref: ライブラリ<161>-Footnote-745602460
Ref: ライブラリ<161>-Footnote-755602526
Ref: ライブラリ<161>-Footnote-765602592
Ref: ライブラリ<161>-Footnote-775602700
Ref: ライブラリ<161>-Footnote-785602766
Ref: ライブラリ<161>-Footnote-795602832
Ref: ライブラリ<161>-Footnote-805602898
Ref: ライブラリ<161>-Footnote-815602964
Ref: ライブラリ<161>-Footnote-825603030
Ref: ライブラリ<161>-Footnote-835603096
Ref: ライブラリ<161>-Footnote-845603162
Ref: ライブラリ<161>-Footnote-855603228
Ref: ライブラリ<161>-Footnote-865603294
Ref: ライブラリ<161>-Footnote-875603360
Ref: ライブラリ<161>-Footnote-885603426
Ref: ライブラリ<161>-Footnote-895603492
Ref: ライブラリ<161>-Footnote-905603558
Ref: ライブラリ<161>-Footnote-915603624
Ref: ライブラリ<161>-Footnote-925603690
Ref: ライブラリ<161>-Footnote-935603756
Ref: ライブラリ<161>-Footnote-945603822
Ref: ライブラリ<161>-Footnote-955603888
Ref: ライブラリ<161>-Footnote-965603954
Ref: ライブラリ<161>-Footnote-975604020
Ref: ライブラリ<161>-Footnote-985604086
Ref: ライブラリ<161>-Footnote-995604152
Ref: ライブラリ<161>-Footnote-1005604218
Ref: ライブラリ<161>-Footnote-1015604285
Ref: ライブラリ<161>-Footnote-1025604352
Ref: ライブラリ<161>-Footnote-1035604419
Ref: ライブラリ<161>-Footnote-1045604486
Ref: ライブラリ<161>-Footnote-1055604553
Ref: ライブラリ<161>-Footnote-1065604620
Ref: ライブラリ<161>-Footnote-1075604687
Ref: ライブラリ<161>-Footnote-1085604753
Ref: ライブラリ<161>-Footnote-1095604820
Ref: ライブラリ<161>-Footnote-1105604887
Ref: ライブラリ<161>-Footnote-1115604954
Ref: ライブラリ<161>-Footnote-1125605021
Ref: ライブラリ<161>-Footnote-1135605088
Ref: ライブラリ<161>-Footnote-1145605155
Ref: ライブラリ<161>-Footnote-1155605222
Ref: ライブラリ<161>-Footnote-1165605289
Ref: ライブラリ<161>-Footnote-1175605356
Ref: ライブラリ<161>-Footnote-1185605423
Ref: ライブラリ<161>-Footnote-1195605490
Ref: ライブラリ<161>-Footnote-1205605557
Ref: ライブラリ<161>-Footnote-1215605624
Ref: ライブラリ<161>-Footnote-1225605691
Ref: ライブラリ<161>-Footnote-1235605758
Ref: ライブラリ<161>-Footnote-1245605825
Ref: ライブラリ<161>-Footnote-1255605892
Ref: ライブラリ<161>-Footnote-1265605959
Ref: ライブラリ<161>-Footnote-1275606026
Ref: ライブラリ<161>-Footnote-1285606093
Ref: ライブラリ<161>-Footnote-1295606160
Ref: ライブラリ<161>-Footnote-1305606227
Ref: ライブラリ<161>-Footnote-1315606294
Ref: ライブラリ<161>-Footnote-1325606361
Ref: ライブラリ<161>-Footnote-1335606428
Ref: ライブラリ<161>-Footnote-1345606495
Ref: ライブラリ<161>-Footnote-1355606562
Ref: ライブラリ<161>-Footnote-1365606629
Ref: ライブラリ<161>-Footnote-1375606706
Ref: ライブラリ<161>-Footnote-1385606773
Ref: ライブラリ<161>-Footnote-1395606840
Ref: ライブラリ<161>-Footnote-1405606907
Ref: ライブラリ<161>-Footnote-1415606974
Ref: ライブラリ<161>-Footnote-1425607041
Ref: ライブラリ<161>-Footnote-1435607108
Ref: ライブラリ<161>-Footnote-1445607175
Ref: ライブラリ<161>-Footnote-1455607242
Ref: ライブラリ<161>-Footnote-1465607309
Ref: ライブラリ<161>-Footnote-1475607376
Ref: ライブラリ<161>-Footnote-1485607443
Ref: ライブラリ<161>-Footnote-1495607510
Ref: ライブラリ<161>-Footnote-1505607577
Ref: ライブラリ<161>-Footnote-1515607644
Ref: ライブラリ<161>-Footnote-1525607711
Ref: ライブラリ<161>-Footnote-1535607778
Ref: ライブラリ<161>-Footnote-1545607845
Ref: ライブラリ<161>-Footnote-1555607912
Ref: ライブラリ<161>-Footnote-1565607979
Ref: ライブラリ<161>-Footnote-1575608046
Ref: ライブラリ<161>-Footnote-1585608113
Ref: ライブラリ<161>-Footnote-1595608180
Ref: ライブラリ<161>-Footnote-1605608247
Ref: ライブラリ<161>-Footnote-1615608314
Ref: ライブラリ<161>-Footnote-1625608381
Ref: ライブラリ<161>-Footnote-1635608448
Ref: ライブラリ<161>-Footnote-1645608515
Ref: ライブラリ<161>-Footnote-1655608582
Ref: ライブラリ<161>-Footnote-1665608649
Ref: ライブラリ<161>-Footnote-1675608716
Ref: ライブラリ<161>-Footnote-1685608783
Ref: ライブラリ<161>-Footnote-1695608850
Ref: ライブラリ<161>-Footnote-1705608917
Ref: ライブラリ<161>-Footnote-1715608984
Ref: ライブラリ<161>-Footnote-1725609051
Ref: ライブラリ<161>-Footnote-1735609095
Ref: ライブラリ<161>-Footnote-1745609162
Ref: ライブラリ<161>-Footnote-1755609229
Ref: ライブラリ<161>-Footnote-1765609296
Ref: ライブラリ<161>-Footnote-1775609363
Ref: ライブラリ<161>-Footnote-1785609430
Ref: ライブラリ<161>-Footnote-1795609497
Ref: ライブラリ<161>-Footnote-1805609564
Ref: ライブラリ<161>-Footnote-1815609631
Ref: ライブラリ<161>-Footnote-1825609698
Ref: ライブラリ<161>-Footnote-1835609765
Ref: ライブラリ<161>-Footnote-1845609832
Ref: ライブラリ<161>-Footnote-1855609899
Ref: ライブラリ<161>-Footnote-1865609966
Ref: ライブラリ<161>-Footnote-1875610033
Ref: ライブラリ<161>-Footnote-1885610100
Ref: ライブラリ<161>-Footnote-1895610167
Ref: ライブラリ<161>-Footnote-1905610234
Ref: ライブラリ<161>-Footnote-1915610301
Ref: ライブラリ<161>-Footnote-1925610368
Ref: ライブラリ<161>-Footnote-1935610435
Ref: ライブラリ<161>-Footnote-1945610502
Ref: ライブラリ<161>-Footnote-1955610569
Ref: ライブラリ<161>-Footnote-1965610636
Ref: ライブラリ<161>-Footnote-1975610703
Ref: ライブラリ<161>-Footnote-1985610770
Ref: ライブラリ<161>-Footnote-1995610837
Ref: ライブラリ<161>-Footnote-2005610904
Ref: ライブラリ<161>-Footnote-2015610971
Ref: ライブラリ<161>-Footnote-2025611038
Ref: ライブラリ<161>-Footnote-2035611105
Ref: ライブラリ<161>-Footnote-2045611172
Ref: ライブラリ<161>-Footnote-2055611239
Ref: ライブラリ<161>-Footnote-2065611306
Ref: ライブラリ<161>-Footnote-2075611373
Ref: ライブラリ<161>-Footnote-2085611440
Ref: ライブラリ<161>-Footnote-2095611507
Ref: ライブラリ<161>-Footnote-2105611574
Ref: ライブラリ<161>-Footnote-2115611641
Ref: ライブラリ<161>-Footnote-2125611708
Ref: ライブラリ<161>-Footnote-2135611775
Ref: ライブラリ<161>-Footnote-2145611842
Ref: ライブラリ<161>-Footnote-2155611909
Ref: ライブラリ<161>-Footnote-2165611976
Ref: ライブラリ<161>-Footnote-2175612043
Ref: ライブラリ<161>-Footnote-2185612110
Ref: ライブラリ<161>-Footnote-2195612177
Ref: ライブラリ<161>-Footnote-2205612244
Ref: ライブラリ<161>-Footnote-2215612311
Ref: ライブラリ<161>-Footnote-2225612378
Ref: ライブラリ<161>-Footnote-2235612445
Ref: ライブラリ<161>-Footnote-2245612512
Ref: ライブラリ<161>-Footnote-2255612579
Ref: ライブラリ<161>-Footnote-2265612646
Ref: ライブラリ<161>-Footnote-2275612713
Ref: ライブラリ<161>-Footnote-2285612780
Ref: ライブラリ<161>-Footnote-2295612847
Ref: ライブラリ<161>-Footnote-2305612914
Ref: ライブラリ<161>-Footnote-2315612981
Ref: ライブラリ<161>-Footnote-2325613048
Ref: ライブラリ<161>-Footnote-2335613115
Ref: ライブラリ<161>-Footnote-2345613182
Ref: ライブラリ<161>-Footnote-2355613249
Ref: ライブラリ<161>-Footnote-2365613316
Ref: ライブラリ<161>-Footnote-2375613383
Ref: ライブラリ<161>-Footnote-2385613450
Ref: ライブラリ<161>-Footnote-2395613517
Ref: ライブラリ<161>-Footnote-2405613583
Ref: ライブラリ<161>-Footnote-2415613650
Ref: ライブラリ<161>-Footnote-2425613717
Ref: ライブラリ<161>-Footnote-2435613784
Ref: ライブラリ<161>-Footnote-2445613851
Ref: ライブラリ<161>-Footnote-2455613918
Ref: ライブラリ<161>-Footnote-2465613985
Ref: ライブラリ<161>-Footnote-2475614052
Ref: ライブラリ<161>-Footnote-2485614119
Ref: ライブラリ<161>-Footnote-2495614186
Ref: ライブラリ<161>-Footnote-2505614253
Ref: ライブラリ<161>-Footnote-2515614320
Ref: ライブラリ<161>-Footnote-2525614387
Ref: ライブラリ<161>-Footnote-2535614454
Node: ドキュメント<54>5614520
Ref: whatsnew/changelog id7345614650
Ref: 1e135614650
Ref: ドキュメント<54>-Footnote-15619106
Ref: ドキュメント<54>-Footnote-25619171
Ref: ドキュメント<54>-Footnote-35619236
Ref: ドキュメント<54>-Footnote-45619301
Ref: ドキュメント<54>-Footnote-55619366
Ref: ドキュメント<54>-Footnote-65619431
Ref: ドキュメント<54>-Footnote-75619496
Ref: ドキュメント<54>-Footnote-85619561
Ref: ドキュメント<54>-Footnote-95619626
Ref: ドキュメント<54>-Footnote-105619691
Ref: ドキュメント<54>-Footnote-115619757
Ref: ドキュメント<54>-Footnote-125619823
Ref: ドキュメント<54>-Footnote-135619889
Ref: ドキュメント<54>-Footnote-145619955
Ref: ドキュメント<54>-Footnote-155620021
Ref: ドキュメント<54>-Footnote-165620087
Ref: ドキュメント<54>-Footnote-175620153
Ref: ドキュメント<54>-Footnote-185620219
Ref: ドキュメント<54>-Footnote-195620285
Ref: ドキュメント<54>-Footnote-205620351
Ref: ドキュメント<54>-Footnote-215620417
Ref: ドキュメント<54>-Footnote-225620483
Ref: ドキュメント<54>-Footnote-235620549
Ref: ドキュメント<54>-Footnote-245620615
Ref: ドキュメント<54>-Footnote-255620681
Ref: ドキュメント<54>-Footnote-265620747
Ref: ドキュメント<54>-Footnote-275620813
Ref: ドキュメント<54>-Footnote-285620879
Ref: ドキュメント<54>-Footnote-295620945
Ref: ドキュメント<54>-Footnote-305621011
Ref: ドキュメント<54>-Footnote-315621077
Ref: ドキュメント<54>-Footnote-325621143
Ref: ドキュメント<54>-Footnote-335621209
Ref: ドキュメント<54>-Footnote-345621275
Ref: ドキュメント<54>-Footnote-355621341
Node: テスト<53>5621407
Ref: whatsnew/changelog id7355621530
Ref: 1e155621530
Ref: テスト<53>-Footnote-15629616
Ref: テスト<53>-Footnote-25629681
Ref: テスト<53>-Footnote-35629746
Ref: テスト<53>-Footnote-45629811
Ref: テスト<53>-Footnote-55629876
Ref: テスト<53>-Footnote-65629941
Ref: テスト<53>-Footnote-75630006
Ref: テスト<53>-Footnote-85630071
Ref: テスト<53>-Footnote-95630136
Ref: テスト<53>-Footnote-105630201
Ref: テスト<53>-Footnote-115630267
Ref: テスト<53>-Footnote-125630333
Ref: テスト<53>-Footnote-135630399
Ref: テスト<53>-Footnote-145630465
Ref: テスト<53>-Footnote-155630531
Ref: テスト<53>-Footnote-165630597
Ref: テスト<53>-Footnote-175630663
Ref: テスト<53>-Footnote-185630729
Ref: テスト<53>-Footnote-195630795
Ref: テスト<53>-Footnote-205630861
Ref: テスト<53>-Footnote-215630927
Ref: テスト<53>-Footnote-225630993
Ref: テスト<53>-Footnote-235631059
Ref: テスト<53>-Footnote-245631125
Ref: テスト<53>-Footnote-255631191
Ref: テスト<53>-Footnote-265631257
Ref: テスト<53>-Footnote-275631323
Ref: テスト<53>-Footnote-285631389
Ref: テスト<53>-Footnote-295631455
Ref: テスト<53>-Footnote-305631521
Ref: テスト<53>-Footnote-315631587
Ref: テスト<53>-Footnote-325631653
Ref: テスト<53>-Footnote-335631719
Ref: テスト<53>-Footnote-345631785
Ref: テスト<53>-Footnote-355631851
Ref: テスト<53>-Footnote-365631917
Ref: テスト<53>-Footnote-375631983
Ref: テスト<53>-Footnote-385632049
Ref: テスト<53>-Footnote-395632115
Ref: テスト<53>-Footnote-405632181
Ref: テスト<53>-Footnote-415632247
Ref: テスト<53>-Footnote-425632313
Ref: テスト<53>-Footnote-435632379
Ref: テスト<53>-Footnote-445632445
Ref: テスト<53>-Footnote-455632511
Ref: テスト<53>-Footnote-465632577
Ref: テスト<53>-Footnote-475632643
Ref: テスト<53>-Footnote-485632709
Node: ビルド<61>5632775
Ref: whatsnew/changelog id7365632887
Ref: 1e1b5632887
Ref: ビルド<61>-Footnote-15636693
Ref: ビルド<61>-Footnote-25636758
Ref: ビルド<61>-Footnote-35636823
Ref: ビルド<61>-Footnote-45636888
Ref: ビルド<61>-Footnote-55636953
Ref: ビルド<61>-Footnote-65637018
Ref: ビルド<61>-Footnote-75637083
Ref: ビルド<61>-Footnote-85637148
Ref: ビルド<61>-Footnote-95637213
Ref: ビルド<61>-Footnote-105637278
Ref: ビルド<61>-Footnote-115637344
Ref: ビルド<61>-Footnote-125637410
Ref: ビルド<61>-Footnote-135637476
Ref: ビルド<61>-Footnote-145637542
Ref: ビルド<61>-Footnote-155637608
Ref: ビルド<61>-Footnote-165637674
Node: Windows<52>5637740
Ref: whatsnew/changelog id7375637848
Ref: 1e1d5637848
Ref: Windows<52>-Footnote-15642750
Ref: Windows<52>-Footnote-25642815
Ref: Windows<52>-Footnote-35642880
Ref: Windows<52>-Footnote-45642945
Ref: Windows<52>-Footnote-55643010
Ref: Windows<52>-Footnote-65643075
Ref: Windows<52>-Footnote-75643140
Ref: Windows<52>-Footnote-85643205
Ref: Windows<52>-Footnote-95643270
Ref: Windows<52>-Footnote-105643335
Ref: Windows<52>-Footnote-115643401
Ref: Windows<52>-Footnote-125643467
Ref: Windows<52>-Footnote-135643533
Ref: Windows<52>-Footnote-145643599
Ref: Windows<52>-Footnote-155643665
Ref: Windows<52>-Footnote-165643731
Ref: Windows<52>-Footnote-175643797
Ref: Windows<52>-Footnote-185643863
Ref: Windows<52>-Footnote-195643929
Ref: Windows<52>-Footnote-205643995
Ref: Windows<52>-Footnote-215644061
Ref: Windows<52>-Footnote-225644127
Ref: Windows<52>-Footnote-235644193
Ref: Windows<52>-Footnote-245644258
Ref: Windows<52>-Footnote-255644323
Ref: Windows<52>-Footnote-265644389
Ref: Windows<52>-Footnote-275644455
Ref: Windows<52>-Footnote-285644521
Ref: Windows<52>-Footnote-295644587
Ref: Windows<52>-Footnote-305644653
Ref: Windows<52>-Footnote-315644719
Ref: Windows<52>-Footnote-325644785
Ref: Windows<52>-Footnote-335644851
Ref: Windows<52>-Footnote-345644917
Ref: Windows<52>-Footnote-355644983
Ref: Windows<52>-Footnote-365645049
Ref: Windows<52>-Footnote-375645115
Ref: Windows<52>-Footnote-385645181
Ref: Windows<52>-Footnote-395645247
Ref: Windows<52>-Footnote-405645313
Ref: Windows<52>-Footnote-415645379
Ref: Windows<52>-Footnote-425645445
Node: macOS<42>5645511
Ref: whatsnew/changelog id7385645614
Ref: 1e205645614
Ref: macOS<42>-Footnote-15646447
Ref: macOS<42>-Footnote-25646512
Ref: macOS<42>-Footnote-35646577
Ref: macOS<42>-Footnote-45646642
Ref: macOS<42>-Footnote-55646707
Ref: macOS<42>-Footnote-65646772
Node: IDLE<33>5646837
Ref: whatsnew/changelog id7395646944
Ref: 1e215646944
Ref: IDLE<33>-Footnote-15651646
Ref: IDLE<33>-Footnote-25651711
Ref: IDLE<33>-Footnote-35651775
Ref: IDLE<33>-Footnote-45651840
Ref: IDLE<33>-Footnote-55651905
Ref: IDLE<33>-Footnote-65651970
Ref: IDLE<33>-Footnote-75652035
Ref: IDLE<33>-Footnote-85652100
Ref: IDLE<33>-Footnote-95652165
Ref: IDLE<33>-Footnote-105652230
Ref: IDLE<33>-Footnote-115652296
Ref: IDLE<33>-Footnote-125652362
Ref: IDLE<33>-Footnote-135652428
Ref: IDLE<33>-Footnote-145652494
Ref: IDLE<33>-Footnote-155652560
Ref: IDLE<33>-Footnote-165652626
Ref: IDLE<33>-Footnote-175652692
Ref: IDLE<33>-Footnote-185652758
Ref: IDLE<33>-Footnote-195652824
Ref: IDLE<33>-Footnote-205652890
Ref: IDLE<33>-Footnote-215652956
Ref: IDLE<33>-Footnote-225653022
Ref: IDLE<33>-Footnote-235653088
Ref: IDLE<33>-Footnote-245653154
Ref: IDLE<33>-Footnote-255653220
Ref: IDLE<33>-Footnote-265653286
Ref: IDLE<33>-Footnote-275653352
Ref: IDLE<33>-Footnote-285653418
Ref: IDLE<33>-Footnote-295653484
Ref: IDLE<33>-Footnote-305653549
Node: Tools/Demos<33>5653615
Ref: whatsnew/changelog id7405653722
Ref: 1e225653722
Ref: Tools/Demos<33>-Footnote-15654717
Ref: Tools/Demos<33>-Footnote-25654782
Ref: Tools/Demos<33>-Footnote-35654847
Ref: Tools/Demos<33>-Footnote-45654912
Ref: Tools/Demos<33>-Footnote-55654977
Ref: Tools/Demos<33>-Footnote-65655042
Ref: Tools/Demos<33>-Footnote-75655107
Ref: Tools/Demos<33>-Footnote-85655172
Node: C API<55>5655237
Ref: whatsnew/changelog id7415655327
Ref: 1e245655327
Ref: C API<55>-Footnote-15660720
Ref: C API<55>-Footnote-25660785
Ref: C API<55>-Footnote-35660850
Ref: C API<55>-Footnote-45660915
Ref: C API<55>-Footnote-55660980
Ref: C API<55>-Footnote-65661045
Ref: C API<55>-Footnote-75661110
Ref: C API<55>-Footnote-85661175
Ref: C API<55>-Footnote-95661240
Ref: C API<55>-Footnote-105661305
Ref: C API<55>-Footnote-115661371
Ref: C API<55>-Footnote-125661437
Ref: C API<55>-Footnote-135661503
Ref: C API<55>-Footnote-145661569
Ref: C API<55>-Footnote-155661612
Ref: C API<55>-Footnote-165661678
Ref: C API<55>-Footnote-175661744
Ref: C API<55>-Footnote-185661810
Ref: C API<55>-Footnote-195661876
Ref: C API<55>-Footnote-205661942
Ref: C API<55>-Footnote-215662008
Ref: C API<55>-Footnote-225662074
Ref: C API<55>-Footnote-235662140
Ref: C API<55>-Footnote-245662206
Ref: C API<55>-Footnote-255662272
Ref: C API<55>-Footnote-265662338
Ref: C API<55>-Footnote-275662404
Ref: C API<55>-Footnote-285662470
Ref: C API<55>-Footnote-295662536
Ref: C API<55>-Footnote-305662602
Ref: C API<55>-Footnote-315662668
Ref: C API<55>-Footnote-325662734
Ref: C API<55>-Footnote-335662800
Ref: C API<55>-Footnote-345662866
Node: Python 3 8 0 beta 15662932
Ref: whatsnew/changelog python-3-8-0-beta-15663058
Ref: 1e275663058
Node: セキュリティ<48>5663501
Ref: whatsnew/changelog id7425663610
Ref: 1e285663610
Ref: セキュリティ<48>-Footnote-15664218
Ref: セキュリティ<48>-Footnote-25664283
Ref: セキュリティ<48>-Footnote-35664338
Ref: セキュリティ<48>-Footnote-45664403
Node: Core and Builtins<159>5664468
Ref: whatsnew/changelog id7435664606
Ref: 1e295664606
Ref: Core and Builtins<159>-Footnote-15672646
Ref: Core and Builtins<159>-Footnote-25672711
Ref: Core and Builtins<159>-Footnote-35672776
Ref: Core and Builtins<159>-Footnote-45672841
Ref: Core and Builtins<159>-Footnote-55672906
Ref: Core and Builtins<159>-Footnote-65672971
Ref: Core and Builtins<159>-Footnote-75673036
Ref: Core and Builtins<159>-Footnote-85673101
Ref: Core and Builtins<159>-Footnote-95673166
Ref: Core and Builtins<159>-Footnote-105673231
Ref: Core and Builtins<159>-Footnote-115673297
Ref: Core and Builtins<159>-Footnote-125673363
Ref: Core and Builtins<159>-Footnote-135673429
Ref: Core and Builtins<159>-Footnote-145673495
Ref: Core and Builtins<159>-Footnote-155673561
Ref: Core and Builtins<159>-Footnote-165673627
Ref: Core and Builtins<159>-Footnote-175673693
Ref: Core and Builtins<159>-Footnote-185673759
Ref: Core and Builtins<159>-Footnote-195673824
Ref: Core and Builtins<159>-Footnote-205673890
Ref: Core and Builtins<159>-Footnote-215673956
Ref: Core and Builtins<159>-Footnote-225674022
Ref: Core and Builtins<159>-Footnote-235674087
Ref: Core and Builtins<159>-Footnote-245674153
Ref: Core and Builtins<159>-Footnote-255674219
Ref: Core and Builtins<159>-Footnote-265674285
Ref: Core and Builtins<159>-Footnote-275674351
Ref: Core and Builtins<159>-Footnote-285674417
Ref: Core and Builtins<159>-Footnote-295674483
Ref: Core and Builtins<159>-Footnote-305674549
Ref: Core and Builtins<159>-Footnote-315674615
Ref: Core and Builtins<159>-Footnote-325674681
Ref: Core and Builtins<159>-Footnote-335674747
Ref: Core and Builtins<159>-Footnote-345674813
Ref: Core and Builtins<159>-Footnote-355674879
Ref: Core and Builtins<159>-Footnote-365674945
Ref: Core and Builtins<159>-Footnote-375675011
Ref: Core and Builtins<159>-Footnote-385675077
Ref: Core and Builtins<159>-Footnote-395675143
Ref: Core and Builtins<159>-Footnote-405675209
Ref: Core and Builtins<159>-Footnote-415675275
Ref: Core and Builtins<159>-Footnote-425675341
Ref: Core and Builtins<159>-Footnote-435675407
Ref: Core and Builtins<159>-Footnote-445675473
Node: ライブラリ<162>5675539
Ref: whatsnew/changelog id7445675677
Ref: 1e2c5675677
Ref: ライブラリ<162>-Footnote-15693882
Ref: ライブラリ<162>-Footnote-25693947
Ref: ライブラリ<162>-Footnote-35694012
Ref: ライブラリ<162>-Footnote-45694077
Ref: ライブラリ<162>-Footnote-55694142
Ref: ライブラリ<162>-Footnote-65694207
Ref: ライブラリ<162>-Footnote-75694272
Ref: ライブラリ<162>-Footnote-85694337
Ref: ライブラリ<162>-Footnote-95694402
Ref: ライブラリ<162>-Footnote-105694467
Ref: ライブラリ<162>-Footnote-115694533
Ref: ライブラリ<162>-Footnote-125694599
Ref: ライブラリ<162>-Footnote-135694665
Ref: ライブラリ<162>-Footnote-145694731
Ref: ライブラリ<162>-Footnote-155694797
Ref: ライブラリ<162>-Footnote-165694863
Ref: ライブラリ<162>-Footnote-175694929
Ref: ライブラリ<162>-Footnote-185694995
Ref: ライブラリ<162>-Footnote-195695061
Ref: ライブラリ<162>-Footnote-205695127
Ref: ライブラリ<162>-Footnote-215695193
Ref: ライブラリ<162>-Footnote-225695259
Ref: ライブラリ<162>-Footnote-235695325
Ref: ライブラリ<162>-Footnote-245695391
Ref: ライブラリ<162>-Footnote-255695459
Ref: ライブラリ<162>-Footnote-265695525
Ref: ライブラリ<162>-Footnote-275695591
Ref: ライブラリ<162>-Footnote-285695657
Ref: ライブラリ<162>-Footnote-295695723
Ref: ライブラリ<162>-Footnote-305695789
Ref: ライブラリ<162>-Footnote-315695855
Ref: ライブラリ<162>-Footnote-325695921
Ref: ライブラリ<162>-Footnote-335695987
Ref: ライブラリ<162>-Footnote-345696053
Ref: ライブラリ<162>-Footnote-355696119
Ref: ライブラリ<162>-Footnote-365696185
Ref: ライブラリ<162>-Footnote-375696251
Ref: ライブラリ<162>-Footnote-385696317
Ref: ライブラリ<162>-Footnote-395696383
Ref: ライブラリ<162>-Footnote-405696449
Ref: ライブラリ<162>-Footnote-415696515
Ref: ライブラリ<162>-Footnote-425696581
Ref: ライブラリ<162>-Footnote-435696647
Ref: ライブラリ<162>-Footnote-445696713
Ref: ライブラリ<162>-Footnote-455696779
Ref: ライブラリ<162>-Footnote-465696845
Ref: ライブラリ<162>-Footnote-475696911
Ref: ライブラリ<162>-Footnote-485696977
Ref: ライブラリ<162>-Footnote-495697043
Ref: ライブラリ<162>-Footnote-505697109
Ref: ライブラリ<162>-Footnote-515697175
Ref: ライブラリ<162>-Footnote-525697241
Ref: ライブラリ<162>-Footnote-535697307
Ref: ライブラリ<162>-Footnote-545697373
Ref: ライブラリ<162>-Footnote-555697439
Ref: ライブラリ<162>-Footnote-565697505
Ref: ライブラリ<162>-Footnote-575697571
Ref: ライブラリ<162>-Footnote-585697637
Ref: ライブラリ<162>-Footnote-595697703
Ref: ライブラリ<162>-Footnote-605697769
Ref: ライブラリ<162>-Footnote-615697835
Ref: ライブラリ<162>-Footnote-625697901
Ref: ライブラリ<162>-Footnote-635697967
Ref: ライブラリ<162>-Footnote-645698033
Ref: ライブラリ<162>-Footnote-655698099
Ref: ライブラリ<162>-Footnote-665698165
Ref: ライブラリ<162>-Footnote-675698231
Ref: ライブラリ<162>-Footnote-685698297
Ref: ライブラリ<162>-Footnote-695698362
Ref: ライブラリ<162>-Footnote-705698428
Ref: ライブラリ<162>-Footnote-715698493
Ref: ライブラリ<162>-Footnote-725698559
Ref: ライブラリ<162>-Footnote-735698625
Ref: ライブラリ<162>-Footnote-745698691
Ref: ライブラリ<162>-Footnote-755698757
Ref: ライブラリ<162>-Footnote-765698823
Ref: ライブラリ<162>-Footnote-775698889
Ref: ライブラリ<162>-Footnote-785698955
Ref: ライブラリ<162>-Footnote-795699021
Ref: ライブラリ<162>-Footnote-805699087
Ref: ライブラリ<162>-Footnote-815699153
Ref: ライブラリ<162>-Footnote-825699219
Ref: ライブラリ<162>-Footnote-835699285
Ref: ライブラリ<162>-Footnote-845699351
Ref: ライブラリ<162>-Footnote-855699417
Ref: ライブラリ<162>-Footnote-865699483
Ref: ライブラリ<162>-Footnote-875699549
Ref: ライブラリ<162>-Footnote-885699615
Ref: ライブラリ<162>-Footnote-895699681
Ref: ライブラリ<162>-Footnote-905699747
Ref: ライブラリ<162>-Footnote-915699813
Ref: ライブラリ<162>-Footnote-925699879
Ref: ライブラリ<162>-Footnote-935699945
Ref: ライブラリ<162>-Footnote-945700011
Ref: ライブラリ<162>-Footnote-955700077
Ref: ライブラリ<162>-Footnote-965700143
Ref: ライブラリ<162>-Footnote-975700209
Ref: ライブラリ<162>-Footnote-985700275
Ref: ライブラリ<162>-Footnote-995700341
Ref: ライブラリ<162>-Footnote-1005700407
Ref: ライブラリ<162>-Footnote-1015700474
Ref: ライブラリ<162>-Footnote-1025700541
Ref: ライブラリ<162>-Footnote-1035700608
Ref: ライブラリ<162>-Footnote-1045700675
Ref: ライブラリ<162>-Footnote-1055700742
Ref: ライブラリ<162>-Footnote-1065700809
Ref: ライブラリ<162>-Footnote-1075700876
Node: ドキュメント<55>5700943
Ref: whatsnew/changelog id7455701072
Ref: 1e325701072
Ref: ドキュメント<55>-Footnote-15703152
Ref: ドキュメント<55>-Footnote-25703217
Ref: ドキュメント<55>-Footnote-35703282
Ref: ドキュメント<55>-Footnote-45703347
Ref: ドキュメント<55>-Footnote-55703412
Ref: ドキュメント<55>-Footnote-65703477
Ref: ドキュメント<55>-Footnote-75703542
Ref: ドキュメント<55>-Footnote-85703607
Ref: ドキュメント<55>-Footnote-95703672
Ref: ドキュメント<55>-Footnote-105703737
Ref: ドキュメント<55>-Footnote-115703803
Ref: ドキュメント<55>-Footnote-125703869
Ref: ドキュメント<55>-Footnote-135703935
Ref: ドキュメント<55>-Footnote-145704001
Node: テスト<54>5704067
Ref: whatsnew/changelog id7465704189
Ref: 1e335704189
Ref: テスト<54>-Footnote-15705826
Ref: テスト<54>-Footnote-25705891
Ref: テスト<54>-Footnote-35705956
Ref: テスト<54>-Footnote-45706021
Ref: テスト<54>-Footnote-55706086
Ref: テスト<54>-Footnote-65706151
Ref: テスト<54>-Footnote-75706216
Ref: テスト<54>-Footnote-85706281
Ref: テスト<54>-Footnote-95706346
Ref: テスト<54>-Footnote-105706411
Node: ビルド<62>5706477
Ref: whatsnew/changelog id7475706588
Ref: 1e355706588
Ref: ビルド<62>-Footnote-15707984
Ref: ビルド<62>-Footnote-25708049
Node: Windows<53>5708114
Ref: whatsnew/changelog id7485708221
Ref: 1e365708221
Ref: Windows<53>-Footnote-15708653
Ref: Windows<53>-Footnote-25708718
Ref: Windows<53>-Footnote-35708783
Ref: Windows<53>-Footnote-45708848
Node: macOS<43>5708913
Ref: whatsnew/changelog id7495709015
Ref: 1e375709015
Ref: macOS<43>-Footnote-15709317
Node: IDLE<34>5709382
Ref: whatsnew/changelog id7505709488
Ref: 1e385709488
Ref: IDLE<34>-Footnote-15710090
Ref: IDLE<34>-Footnote-25710155
Ref: IDLE<34>-Footnote-35710220
Ref: IDLE<34>-Footnote-45710285
Ref: IDLE<34>-Footnote-55710350
Ref: IDLE<34>-Footnote-65710415
Node: Tools/Demos<34>5710480
Ref: whatsnew/changelog id7515710586
Ref: 1e395710586
Ref: Tools/Demos<34>-Footnote-15710785
Node: C API<56>5710850
Ref: whatsnew/changelog id7525710939
Ref: 1e3a5710939
Ref: C API<56>-Footnote-15712275
Ref: C API<56>-Footnote-25712340
Ref: C API<56>-Footnote-35712382
Ref: C API<56>-Footnote-45712447
Ref: C API<56>-Footnote-55712512
Ref: C API<56>-Footnote-65712577
Ref: C API<56>-Footnote-75712619
Ref: C API<56>-Footnote-85712684
Ref: C API<56>-Footnote-95712749
Node: Python 3 8 0 alpha 45712814
Ref: whatsnew/changelog python-3-8-0-alpha-45712940
Ref: 1e3c5712940
Node: セキュリティ<49>5713385
Ref: whatsnew/changelog id7535713495
Ref: 1e3d5713495
Ref: セキュリティ<49>-Footnote-15714388
Ref: セキュリティ<49>-Footnote-25714453
Ref: セキュリティ<49>-Footnote-35714518
Ref: セキュリティ<49>-Footnote-45714573
Node: Core and Builtins<160>5714638
Ref: whatsnew/changelog id7545714777
Ref: 1e3e5714777
Ref: Core and Builtins<160>-Footnote-15718045
Ref: Core and Builtins<160>-Footnote-25718110
Ref: Core and Builtins<160>-Footnote-35718175
Ref: Core and Builtins<160>-Footnote-45718240
Ref: Core and Builtins<160>-Footnote-55718305
Ref: Core and Builtins<160>-Footnote-65718370
Ref: Core and Builtins<160>-Footnote-75718435
Ref: Core and Builtins<160>-Footnote-85718500
Ref: Core and Builtins<160>-Footnote-95718565
Ref: Core and Builtins<160>-Footnote-105718607
Ref: Core and Builtins<160>-Footnote-115718673
Ref: Core and Builtins<160>-Footnote-125718739
Ref: Core and Builtins<160>-Footnote-135718805
Ref: Core and Builtins<160>-Footnote-145718871
Ref: Core and Builtins<160>-Footnote-155718937
Ref: Core and Builtins<160>-Footnote-165719003
Ref: Core and Builtins<160>-Footnote-175719069
Ref: Core and Builtins<160>-Footnote-185719135
Ref: Core and Builtins<160>-Footnote-195719201
Ref: Core and Builtins<160>-Footnote-205719267
Node: ライブラリ<163>5719333
Ref: whatsnew/changelog id7555719472
Ref: 1e3f5719472
Ref: ライブラリ<163>-Footnote-15728778
Ref: ライブラリ<163>-Footnote-25728843
Ref: ライブラリ<163>-Footnote-35728908
Ref: ライブラリ<163>-Footnote-45728973
Ref: ライブラリ<163>-Footnote-55729040
Ref: ライブラリ<163>-Footnote-65729105
Ref: ライブラリ<163>-Footnote-75729170
Ref: ライブラリ<163>-Footnote-85729235
Ref: ライブラリ<163>-Footnote-95729300
Ref: ライブラリ<163>-Footnote-105729365
Ref: ライブラリ<163>-Footnote-115729431
Ref: ライブラリ<163>-Footnote-125729497
Ref: ライブラリ<163>-Footnote-135729563
Ref: ライブラリ<163>-Footnote-145729629
Ref: ライブラリ<163>-Footnote-155729695
Ref: ライブラリ<163>-Footnote-165729761
Ref: ライブラリ<163>-Footnote-175729827
Ref: ライブラリ<163>-Footnote-185729893
Ref: ライブラリ<163>-Footnote-195729959
Ref: ライブラリ<163>-Footnote-205730025
Ref: ライブラリ<163>-Footnote-215730091
Ref: ライブラリ<163>-Footnote-225730157
Ref: ライブラリ<163>-Footnote-235730223
Ref: ライブラリ<163>-Footnote-245730289
Ref: ライブラリ<163>-Footnote-255730355
Ref: ライブラリ<163>-Footnote-265730421
Ref: ライブラリ<163>-Footnote-275730487
Ref: ライブラリ<163>-Footnote-285730553
Ref: ライブラリ<163>-Footnote-295730619
Ref: ライブラリ<163>-Footnote-305730685
Ref: ライブラリ<163>-Footnote-315730751
Ref: ライブラリ<163>-Footnote-325730817
Ref: ライブラリ<163>-Footnote-335730883
Ref: ライブラリ<163>-Footnote-345730949
Ref: ライブラリ<163>-Footnote-355731015
Ref: ライブラリ<163>-Footnote-365731081
Ref: ライブラリ<163>-Footnote-375731147
Ref: ライブラリ<163>-Footnote-385731213
Ref: ライブラリ<163>-Footnote-395731279
Ref: ライブラリ<163>-Footnote-405731345
Ref: ライブラリ<163>-Footnote-415731411
Ref: ライブラリ<163>-Footnote-425731477
Ref: ライブラリ<163>-Footnote-435731543
Ref: ライブラリ<163>-Footnote-445731609
Ref: ライブラリ<163>-Footnote-455731675
Ref: ライブラリ<163>-Footnote-465731741
Ref: ライブラリ<163>-Footnote-475731807
Ref: ライブラリ<163>-Footnote-485731873
Ref: ライブラリ<163>-Footnote-495731939
Ref: ライブラリ<163>-Footnote-505732005
Ref: ライブラリ<163>-Footnote-515732071
Ref: ライブラリ<163>-Footnote-525732137
Ref: ライブラリ<163>-Footnote-535732203
Ref: ライブラリ<163>-Footnote-545732269
Node: ドキュメント<56>5732335
Ref: whatsnew/changelog id7565732465
Ref: 1e445732465
Ref: ドキュメント<56>-Footnote-15733900
Ref: ドキュメント<56>-Footnote-25733965
Ref: ドキュメント<56>-Footnote-35734030
Ref: ドキュメント<56>-Footnote-45734095
Ref: ドキュメント<56>-Footnote-55734160
Ref: ドキュメント<56>-Footnote-65734199
Ref: ドキュメント<56>-Footnote-75734264
Ref: ドキュメント<56>-Footnote-85734329
Ref: ドキュメント<56>-Footnote-95734394
Ref: ドキュメント<56>-Footnote-105734459
Ref: ドキュメント<56>-Footnote-115734525
Ref: ドキュメント<56>-Footnote-125734591
Node: テスト<55>5734657
Ref: whatsnew/changelog id7575734780
Ref: 1e455734780
Ref: テスト<55>-Footnote-15737036
Ref: テスト<55>-Footnote-25737101
Ref: テスト<55>-Footnote-35737166
Ref: テスト<55>-Footnote-45737231
Ref: テスト<55>-Footnote-55737296
Ref: テスト<55>-Footnote-65737361
Ref: テスト<55>-Footnote-75737426
Ref: テスト<55>-Footnote-85737491
Ref: テスト<55>-Footnote-95737556
Ref: テスト<55>-Footnote-105737621
Ref: テスト<55>-Footnote-115737687
Ref: テスト<55>-Footnote-125737753
Ref: テスト<55>-Footnote-135737819
Ref: テスト<55>-Footnote-145737885
Ref: テスト<55>-Footnote-155737951
Node: ビルド<63>5738017
Ref: whatsnew/changelog id7585738129
Ref: 1e475738129
Ref: ビルド<63>-Footnote-15741293
Ref: ビルド<63>-Footnote-25741358
Ref: ビルド<63>-Footnote-35741423
Ref: ビルド<63>-Footnote-45741488
Ref: ビルド<63>-Footnote-55741553
Ref: ビルド<63>-Footnote-65741618
Ref: ビルド<63>-Footnote-75741683
Ref: ビルド<63>-Footnote-85741748
Ref: ビルド<63>-Footnote-95741813
Ref: ビルド<63>-Footnote-105741878
Ref: ビルド<63>-Footnote-115741944
Ref: ビルド<63>-Footnote-125742010
Ref: ビルド<63>-Footnote-135742076
Node: Windows<54>5742142
Ref: whatsnew/changelog id7595742250
Ref: 1e485742250
Ref: Windows<54>-Footnote-15744898
Ref: Windows<54>-Footnote-25744963
Ref: Windows<54>-Footnote-35745028
Ref: Windows<54>-Footnote-45745093
Ref: Windows<54>-Footnote-55745158
Ref: Windows<54>-Footnote-65745223
Ref: Windows<54>-Footnote-75745288
Ref: Windows<54>-Footnote-85745353
Ref: Windows<54>-Footnote-95745418
Ref: Windows<54>-Footnote-105745483
Ref: Windows<54>-Footnote-115745549
Ref: Windows<54>-Footnote-125745615
Node: macOS<44>5745681
Ref: whatsnew/changelog id7605745784
Ref: 1e495745784
Ref: macOS<44>-Footnote-15746098
Ref: macOS<44>-Footnote-25746163
Node: IDLE<35>5746228
Ref: whatsnew/changelog id7615746335
Ref: 1e4a5746335
Ref: IDLE<35>-Footnote-15746578
Node: Tools/Demos<35>5746643
Ref: whatsnew/changelog id7625746750
Ref: 1e4b5746750
Ref: Tools/Demos<35>-Footnote-15746904
Node: C API<57>5746969
Ref: whatsnew/changelog id7635747059
Ref: 1e4c5747059
Ref: C API<57>-Footnote-15749062
Ref: C API<57>-Footnote-25749127
Ref: C API<57>-Footnote-35749192
Ref: C API<57>-Footnote-45749257
Ref: C API<57>-Footnote-55749322
Ref: C API<57>-Footnote-65749387
Node: Python 3 8 0 alpha 35749452
Ref: whatsnew/changelog python-3-8-0-alpha-35749579
Ref: 1e4f5749579
Node: セキュリティ<50>5750004
Ref: whatsnew/changelog id7645750114
Ref: 1e505750114
Ref: セキュリティ<50>-Footnote-15750690
Ref: セキュリティ<50>-Footnote-25750755
Node: Core and Builtins<161>5750820
Ref: whatsnew/changelog id7655750959
Ref: 1e525750959
Ref: Core and Builtins<161>-Footnote-15754539
Ref: Core and Builtins<161>-Footnote-25754604
Ref: Core and Builtins<161>-Footnote-35754669
Ref: Core and Builtins<161>-Footnote-45754734
Ref: Core and Builtins<161>-Footnote-55754799
Ref: Core and Builtins<161>-Footnote-65754864
Ref: Core and Builtins<161>-Footnote-75754929
Ref: Core and Builtins<161>-Footnote-85754994
Ref: Core and Builtins<161>-Footnote-95755059
Ref: Core and Builtins<161>-Footnote-105755124
Ref: Core and Builtins<161>-Footnote-115755190
Ref: Core and Builtins<161>-Footnote-125755256
Ref: Core and Builtins<161>-Footnote-135755322
Ref: Core and Builtins<161>-Footnote-145755388
Ref: Core and Builtins<161>-Footnote-155755454
Ref: Core and Builtins<161>-Footnote-165755520
Ref: Core and Builtins<161>-Footnote-175755586
Ref: Core and Builtins<161>-Footnote-185755652
Ref: Core and Builtins<161>-Footnote-195755718
Ref: Core and Builtins<161>-Footnote-205755784
Ref: Core and Builtins<161>-Footnote-215755850
Ref: Core and Builtins<161>-Footnote-225755916
Node: ライブラリ<164>5755982
Ref: whatsnew/changelog id7665756121
Ref: 1e545756121
Ref: ライブラリ<164>-Footnote-15761701
Ref: ライブラリ<164>-Footnote-25761766
Ref: ライブラリ<164>-Footnote-35761831
Ref: ライブラリ<164>-Footnote-45761896
Ref: ライブラリ<164>-Footnote-55761961
Ref: ライブラリ<164>-Footnote-65762026
Ref: ライブラリ<164>-Footnote-75762091
Ref: ライブラリ<164>-Footnote-85762156
Ref: ライブラリ<164>-Footnote-95762221
Ref: ライブラリ<164>-Footnote-105762286
Ref: ライブラリ<164>-Footnote-115762352
Ref: ライブラリ<164>-Footnote-125762418
Ref: ライブラリ<164>-Footnote-135762484
Ref: ライブラリ<164>-Footnote-145762550
Ref: ライブラリ<164>-Footnote-155762616
Ref: ライブラリ<164>-Footnote-165762682
Ref: ライブラリ<164>-Footnote-175762748
Ref: ライブラリ<164>-Footnote-185762814
Ref: ライブラリ<164>-Footnote-195762880
Ref: ライブラリ<164>-Footnote-205762946
Ref: ライブラリ<164>-Footnote-215763012
Ref: ライブラリ<164>-Footnote-225763078
Ref: ライブラリ<164>-Footnote-235763144
Ref: ライブラリ<164>-Footnote-245763210
Ref: ライブラリ<164>-Footnote-255763276
Ref: ライブラリ<164>-Footnote-265763342
Ref: ライブラリ<164>-Footnote-275763408
Ref: ライブラリ<164>-Footnote-285763474
Ref: ライブラリ<164>-Footnote-295763540
Ref: ライブラリ<164>-Footnote-305763606
Ref: ライブラリ<164>-Footnote-315763672
Ref: ライブラリ<164>-Footnote-325763738
Ref: ライブラリ<164>-Footnote-335763804
Ref: ライブラリ<164>-Footnote-345763870
Ref: ライブラリ<164>-Footnote-355763936
Ref: ライブラリ<164>-Footnote-365764002
Ref: ライブラリ<164>-Footnote-375764068
Node: ドキュメント<57>5764134
Ref: whatsnew/changelog id7675764264
Ref: 1e565764264
Ref: ドキュメント<57>-Footnote-15764839
Ref: ドキュメント<57>-Footnote-25764904
Ref: ドキュメント<57>-Footnote-35764969
Node: テスト<56>5765034
Ref: whatsnew/changelog id7685765157
Ref: 1e575765157
Ref: テスト<56>-Footnote-15765674
Ref: テスト<56>-Footnote-25765739
Ref: テスト<56>-Footnote-35765804
Node: ビルド<64>5765869
Ref: whatsnew/changelog id7695765981
Ref: 1e585765981
Ref: ビルド<64>-Footnote-15766506
Ref: ビルド<64>-Footnote-25766571
Ref: ビルド<64>-Footnote-35766636
Ref: ビルド<64>-Footnote-45766701
Node: Windows<55>5766766
Ref: whatsnew/changelog id7705766873
Ref: 1e595766873
Ref: Windows<55>-Footnote-15767322
Ref: Windows<55>-Footnote-25767387
Ref: Windows<55>-Footnote-35767452
Node: IDLE<36>5767517
Ref: whatsnew/changelog id7715767626
Ref: 1e5a5767626
Ref: IDLE<36>-Footnote-15768735
Ref: IDLE<36>-Footnote-25768800
Ref: IDLE<36>-Footnote-35768865
Ref: IDLE<36>-Footnote-45768930
Ref: IDLE<36>-Footnote-55768995
Ref: IDLE<36>-Footnote-65769060
Ref: IDLE<36>-Footnote-75769125
Ref: IDLE<36>-Footnote-85769190
Ref: IDLE<36>-Footnote-95769255
Node: Tools/Demos<36>5769320
Ref: whatsnew/changelog id7725769427
Ref: 1e5b5769427
Ref: Tools/Demos<36>-Footnote-15769640
Ref: Tools/Demos<36>-Footnote-25769705
Node: C API<58>5769770
Ref: whatsnew/changelog id7735769860
Ref: 1e5c5769860
Ref: C API<58>-Footnote-15770248
Ref: C API<58>-Footnote-25770313
Node: Python 3 8 0 alpha 25770378
Ref: whatsnew/changelog python-3-8-0-alpha-25770505
Ref: 1e5d5770505
Node: Core and Builtins<162>5770804
Ref: whatsnew/changelog id7745770912
Ref: 1e5e5770912
Ref: Core and Builtins<162>-Footnote-15774051
Ref: Core and Builtins<162>-Footnote-25774116
Ref: Core and Builtins<162>-Footnote-35774181
Ref: Core and Builtins<162>-Footnote-45774246
Ref: Core and Builtins<162>-Footnote-55774311
Ref: Core and Builtins<162>-Footnote-65774378
Ref: Core and Builtins<162>-Footnote-75774443
Ref: Core and Builtins<162>-Footnote-85774508
Ref: Core and Builtins<162>-Footnote-95774573
Ref: Core and Builtins<162>-Footnote-105774638
Ref: Core and Builtins<162>-Footnote-115774704
Ref: Core and Builtins<162>-Footnote-125774770
Ref: Core and Builtins<162>-Footnote-135774836
Ref: Core and Builtins<162>-Footnote-145774902
Ref: Core and Builtins<162>-Footnote-155774968
Ref: Core and Builtins<162>-Footnote-165775034
Ref: Core and Builtins<162>-Footnote-175775100
Node: ライブラリ<165>5775166
Ref: whatsnew/changelog id7755775305
Ref: 1e5f5775305
Ref: ライブラリ<165>-Footnote-15779019
Ref: ライブラリ<165>-Footnote-25779084
Ref: ライブラリ<165>-Footnote-35779149
Ref: ライブラリ<165>-Footnote-45779214
Ref: ライブラリ<165>-Footnote-55779279
Ref: ライブラリ<165>-Footnote-65779344
Ref: ライブラリ<165>-Footnote-75779409
Ref: ライブラリ<165>-Footnote-85779474
Ref: ライブラリ<165>-Footnote-95779539
Ref: ライブラリ<165>-Footnote-105779604
Ref: ライブラリ<165>-Footnote-115779670
Ref: ライブラリ<165>-Footnote-125779736
Ref: ライブラリ<165>-Footnote-135779802
Ref: ライブラリ<165>-Footnote-145779868
Ref: ライブラリ<165>-Footnote-155779934
Ref: ライブラリ<165>-Footnote-165780000
Ref: ライブラリ<165>-Footnote-175780066
Node: ドキュメント<58>5780132
Ref: whatsnew/changelog id7765780262
Ref: 1e615780262
Ref: ドキュメント<58>-Footnote-15780642
Ref: ドキュメント<58>-Footnote-25780707
Ref: ドキュメント<58>-Footnote-35780772
Node: テスト<57>5780837
Ref: whatsnew/changelog id7775780958
Ref: 1e625780958
Ref: テスト<57>-Footnote-15782328
Ref: テスト<57>-Footnote-25782393
Ref: テスト<57>-Footnote-35782458
Ref: テスト<57>-Footnote-45782523
Ref: テスト<57>-Footnote-55782588
Ref: テスト<57>-Footnote-65782653
Ref: テスト<57>-Footnote-75782718
Ref: テスト<57>-Footnote-85782783
Node: Windows<56>5782848
Ref: whatsnew/changelog id7785782955
Ref: 1e635782955
Ref: Windows<56>-Footnote-15783552
Ref: Windows<56>-Footnote-25783617
Ref: Windows<56>-Footnote-35783682
Ref: Windows<56>-Footnote-45783747
Ref: Windows<56>-Footnote-55783812
Node: IDLE<37>5783877
Ref: whatsnew/changelog id7795783962
Ref: 1e645783962
Ref: IDLE<37>-Footnote-15784266
Ref: IDLE<37>-Footnote-25784331
Ref: IDLE<37>-Footnote-35784396
Node: Python 3 8 0 alpha 15784461
Ref: whatsnew/changelog python-3-8-0-alpha-15784586
Ref: 1e655784586
Node: セキュリティ<51>5785031
Ref: whatsnew/changelog id7805785141
Ref: 1e665785141
Ref: セキュリティ<51>-Footnote-15787487
Ref: セキュリティ<51>-Footnote-25787552
Ref: セキュリティ<51>-Footnote-35787607
Ref: セキュリティ<51>-Footnote-45787672
Ref: セキュリティ<51>-Footnote-55787737
Ref: セキュリティ<51>-Footnote-65787802
Ref: セキュリティ<51>-Footnote-75787867
Ref: セキュリティ<51>-Footnote-85787923
Ref: セキュリティ<51>-Footnote-95787988
Ref: セキュリティ<51>-Footnote-105788053
Ref: セキュリティ<51>-Footnote-115788119
Ref: セキュリティ<51>-Footnote-125788185
Ref: セキュリティ<51>-Footnote-135788241
Ref: セキュリティ<51>-Footnote-145788307
Ref: セキュリティ<51>-Footnote-155788373
Ref: セキュリティ<51>-Footnote-165788429
Ref: セキュリティ<51>-Footnote-175788485
Node: Core and Builtins<163>5788551
Ref: whatsnew/changelog id7815788690
Ref: 1e675788690
Ref: Core and Builtins<163>-Footnote-15814735
Ref: Core and Builtins<163>-Footnote-25814800
Ref: Core and Builtins<163>-Footnote-35814865
Ref: Core and Builtins<163>-Footnote-45814930
Ref: Core and Builtins<163>-Footnote-55814995
Ref: Core and Builtins<163>-Footnote-65815060
Ref: Core and Builtins<163>-Footnote-75815125
Ref: Core and Builtins<163>-Footnote-85815190
Ref: Core and Builtins<163>-Footnote-95815255
Ref: Core and Builtins<163>-Footnote-105815320
Ref: Core and Builtins<163>-Footnote-115815386
Ref: Core and Builtins<163>-Footnote-125815452
Ref: Core and Builtins<163>-Footnote-135815518
Ref: Core and Builtins<163>-Footnote-145815584
Ref: Core and Builtins<163>-Footnote-155815650
Ref: Core and Builtins<163>-Footnote-165815716
Ref: Core and Builtins<163>-Footnote-175815782
Ref: Core and Builtins<163>-Footnote-185815848
Ref: Core and Builtins<163>-Footnote-195815914
Ref: Core and Builtins<163>-Footnote-205815980
Ref: Core and Builtins<163>-Footnote-215816046
Ref: Core and Builtins<163>-Footnote-225816112
Ref: Core and Builtins<163>-Footnote-235816178
Ref: Core and Builtins<163>-Footnote-245816244
Ref: Core and Builtins<163>-Footnote-255816310
Ref: Core and Builtins<163>-Footnote-265816353
Ref: Core and Builtins<163>-Footnote-275816419
Ref: Core and Builtins<163>-Footnote-285816485
Ref: Core and Builtins<163>-Footnote-295816551
Ref: Core and Builtins<163>-Footnote-305816617
Ref: Core and Builtins<163>-Footnote-315816683
Ref: Core and Builtins<163>-Footnote-325816749
Ref: Core and Builtins<163>-Footnote-335816815
Ref: Core and Builtins<163>-Footnote-345816881
Ref: Core and Builtins<163>-Footnote-355816947
Ref: Core and Builtins<163>-Footnote-365817013
Ref: Core and Builtins<163>-Footnote-375817079
Ref: Core and Builtins<163>-Footnote-385817145
Ref: Core and Builtins<163>-Footnote-395817211
Ref: Core and Builtins<163>-Footnote-405817277
Ref: Core and Builtins<163>-Footnote-415817343
Ref: Core and Builtins<163>-Footnote-425817409
Ref: Core and Builtins<163>-Footnote-435817475
Ref: Core and Builtins<163>-Footnote-445817541
Ref: Core and Builtins<163>-Footnote-455817607
Ref: Core and Builtins<163>-Footnote-465817673
Ref: Core and Builtins<163>-Footnote-475817739
Ref: Core and Builtins<163>-Footnote-485817805
Ref: Core and Builtins<163>-Footnote-495817871
Ref: Core and Builtins<163>-Footnote-505817937
Ref: Core and Builtins<163>-Footnote-515818003
Ref: Core and Builtins<163>-Footnote-525818069
Ref: Core and Builtins<163>-Footnote-535818135
Ref: Core and Builtins<163>-Footnote-545818201
Ref: Core and Builtins<163>-Footnote-555818267
Ref: Core and Builtins<163>-Footnote-565818333
Ref: Core and Builtins<163>-Footnote-575818399
Ref: Core and Builtins<163>-Footnote-585818465
Ref: Core and Builtins<163>-Footnote-595818531
Ref: Core and Builtins<163>-Footnote-605818596
Ref: Core and Builtins<163>-Footnote-615818662
Ref: Core and Builtins<163>-Footnote-625818728
Ref: Core and Builtins<163>-Footnote-635818794
Ref: Core and Builtins<163>-Footnote-645818860
Ref: Core and Builtins<163>-Footnote-655818926
Ref: Core and Builtins<163>-Footnote-665818992
Ref: Core and Builtins<163>-Footnote-675819058
Ref: Core and Builtins<163>-Footnote-685819124
Ref: Core and Builtins<163>-Footnote-695819190
Ref: Core and Builtins<163>-Footnote-705819256
Ref: Core and Builtins<163>-Footnote-715819322
Ref: Core and Builtins<163>-Footnote-725819388
Ref: Core and Builtins<163>-Footnote-735819454
Ref: Core and Builtins<163>-Footnote-745819520
Ref: Core and Builtins<163>-Footnote-755819586
Ref: Core and Builtins<163>-Footnote-765819652
Ref: Core and Builtins<163>-Footnote-775819718
Ref: Core and Builtins<163>-Footnote-785819784
Ref: Core and Builtins<163>-Footnote-795819850
Ref: Core and Builtins<163>-Footnote-805819916
Ref: Core and Builtins<163>-Footnote-815819982
Ref: Core and Builtins<163>-Footnote-825820048
Ref: Core and Builtins<163>-Footnote-835820114
Ref: Core and Builtins<163>-Footnote-845820180
Ref: Core and Builtins<163>-Footnote-855820246
Ref: Core and Builtins<163>-Footnote-865820312
Ref: Core and Builtins<163>-Footnote-875820378
Ref: Core and Builtins<163>-Footnote-885820444
Ref: Core and Builtins<163>-Footnote-895820510
Ref: Core and Builtins<163>-Footnote-905820576
Ref: Core and Builtins<163>-Footnote-915820642
Ref: Core and Builtins<163>-Footnote-925820708
Ref: Core and Builtins<163>-Footnote-935820774
Ref: Core and Builtins<163>-Footnote-945820840
Ref: Core and Builtins<163>-Footnote-955820906
Ref: Core and Builtins<163>-Footnote-965820972
Ref: Core and Builtins<163>-Footnote-975821040
Ref: Core and Builtins<163>-Footnote-985821106
Ref: Core and Builtins<163>-Footnote-995821172
Ref: Core and Builtins<163>-Footnote-1005821238
Ref: Core and Builtins<163>-Footnote-1015821305
Ref: Core and Builtins<163>-Footnote-1025821372
Ref: Core and Builtins<163>-Footnote-1035821439
Ref: Core and Builtins<163>-Footnote-1045821506
Ref: Core and Builtins<163>-Footnote-1055821573
Ref: Core and Builtins<163>-Footnote-1065821640
Ref: Core and Builtins<163>-Footnote-1075821707
Ref: Core and Builtins<163>-Footnote-1085821774
Ref: Core and Builtins<163>-Footnote-1095821841
Ref: Core and Builtins<163>-Footnote-1105821908
Ref: Core and Builtins<163>-Footnote-1115821975
Ref: Core and Builtins<163>-Footnote-1125822042
Ref: Core and Builtins<163>-Footnote-1135822109
Ref: Core and Builtins<163>-Footnote-1145822176
Ref: Core and Builtins<163>-Footnote-1155822243
Ref: Core and Builtins<163>-Footnote-1165822310
Ref: Core and Builtins<163>-Footnote-1175822377
Ref: Core and Builtins<163>-Footnote-1185822444
Ref: Core and Builtins<163>-Footnote-1195822511
Ref: Core and Builtins<163>-Footnote-1205822578
Ref: Core and Builtins<163>-Footnote-1215822645
Ref: Core and Builtins<163>-Footnote-1225822712
Ref: Core and Builtins<163>-Footnote-1235822779
Ref: Core and Builtins<163>-Footnote-1245822846
Ref: Core and Builtins<163>-Footnote-1255822913
Ref: Core and Builtins<163>-Footnote-1265822980
Ref: Core and Builtins<163>-Footnote-1275823047
Ref: Core and Builtins<163>-Footnote-1285823114
Ref: Core and Builtins<163>-Footnote-1295823181
Ref: Core and Builtins<163>-Footnote-1305823248
Ref: Core and Builtins<163>-Footnote-1315823315
Ref: Core and Builtins<163>-Footnote-1325823382
Ref: Core and Builtins<163>-Footnote-1335823449
Ref: Core and Builtins<163>-Footnote-1345823516
Ref: Core and Builtins<163>-Footnote-1355823583
Ref: Core and Builtins<163>-Footnote-1365823650
Ref: Core and Builtins<163>-Footnote-1375823717
Ref: Core and Builtins<163>-Footnote-1385823784
Ref: Core and Builtins<163>-Footnote-1395823851
Ref: Core and Builtins<163>-Footnote-1405823918
Ref: Core and Builtins<163>-Footnote-1415823985
Ref: Core and Builtins<163>-Footnote-1425824052
Ref: Core and Builtins<163>-Footnote-1435824119
Ref: Core and Builtins<163>-Footnote-1445824186
Ref: Core and Builtins<163>-Footnote-1455824253
Ref: Core and Builtins<163>-Footnote-1465824320
Ref: Core and Builtins<163>-Footnote-1475824387
Ref: Core and Builtins<163>-Footnote-1485824454
Ref: Core and Builtins<163>-Footnote-1495824521
Ref: Core and Builtins<163>-Footnote-1505824588
Ref: Core and Builtins<163>-Footnote-1515824655
Ref: Core and Builtins<163>-Footnote-1525824722
Ref: Core and Builtins<163>-Footnote-1535824789
Ref: Core and Builtins<163>-Footnote-1545824856
Ref: Core and Builtins<163>-Footnote-1555824923
Ref: Core and Builtins<163>-Footnote-1565824990
Ref: Core and Builtins<163>-Footnote-1575825057
Ref: Core and Builtins<163>-Footnote-1585825124
Ref: Core and Builtins<163>-Footnote-1595825191
Ref: Core and Builtins<163>-Footnote-1605825258
Ref: Core and Builtins<163>-Footnote-1615825325
Ref: Core and Builtins<163>-Footnote-1625825392
Node: ライブラリ<166>5825459
Ref: whatsnew/changelog id7825825598
Ref: 1e6d5825598
Ref: ライブラリ<166>-Footnote-15896481
Ref: ライブラリ<166>-Footnote-25896546
Ref: ライブラリ<166>-Footnote-35896611
Ref: ライブラリ<166>-Footnote-45896676
Ref: ライブラリ<166>-Footnote-55896741
Ref: ライブラリ<166>-Footnote-65896806
Ref: ライブラリ<166>-Footnote-75896871
Ref: ライブラリ<166>-Footnote-85896936
Ref: ライブラリ<166>-Footnote-95897001
Ref: ライブラリ<166>-Footnote-105897066
Ref: ライブラリ<166>-Footnote-115897132
Ref: ライブラリ<166>-Footnote-125897198
Ref: ライブラリ<166>-Footnote-135897264
Ref: ライブラリ<166>-Footnote-145897330
Ref: ライブラリ<166>-Footnote-155897396
Ref: ライブラリ<166>-Footnote-165897462
Ref: ライブラリ<166>-Footnote-175897528
Ref: ライブラリ<166>-Footnote-185897594
Ref: ライブラリ<166>-Footnote-195897660
Ref: ライブラリ<166>-Footnote-205897726
Ref: ライブラリ<166>-Footnote-215897792
Ref: ライブラリ<166>-Footnote-225897858
Ref: ライブラリ<166>-Footnote-235897924
Ref: ライブラリ<166>-Footnote-245897990
Ref: ライブラリ<166>-Footnote-255898056
Ref: ライブラリ<166>-Footnote-265898122
Ref: ライブラリ<166>-Footnote-275898188
Ref: ライブラリ<166>-Footnote-285898254
Ref: ライブラリ<166>-Footnote-295898320
Ref: ライブラリ<166>-Footnote-305898386
Ref: ライブラリ<166>-Footnote-315898452
Ref: ライブラリ<166>-Footnote-325898518
Ref: ライブラリ<166>-Footnote-335898584
Ref: ライブラリ<166>-Footnote-345898650
Ref: ライブラリ<166>-Footnote-355898716
Ref: ライブラリ<166>-Footnote-365898782
Ref: ライブラリ<166>-Footnote-375898848
Ref: ライブラリ<166>-Footnote-385898914
Ref: ライブラリ<166>-Footnote-395898980
Ref: ライブラリ<166>-Footnote-405899046
Ref: ライブラリ<166>-Footnote-415899112
Ref: ライブラリ<166>-Footnote-425899178
Ref: ライブラリ<166>-Footnote-435899244
Ref: ライブラリ<166>-Footnote-445899310
Ref: ライブラリ<166>-Footnote-455899376
Ref: ライブラリ<166>-Footnote-465899442
Ref: ライブラリ<166>-Footnote-475899508
Ref: ライブラリ<166>-Footnote-485899574
Ref: ライブラリ<166>-Footnote-495899640
Ref: ライブラリ<166>-Footnote-505899706
Ref: ライブラリ<166>-Footnote-515899772
Ref: ライブラリ<166>-Footnote-525899838
Ref: ライブラリ<166>-Footnote-535899904
Ref: ライブラリ<166>-Footnote-545899970
Ref: ライブラリ<166>-Footnote-555900036
Ref: ライブラリ<166>-Footnote-565900102
Ref: ライブラリ<166>-Footnote-575900168
Ref: ライブラリ<166>-Footnote-585900234
Ref: ライブラリ<166>-Footnote-595900300
Ref: ライブラリ<166>-Footnote-605900366
Ref: ライブラリ<166>-Footnote-615900432
Ref: ライブラリ<166>-Footnote-625900498
Ref: ライブラリ<166>-Footnote-635900564
Ref: ライブラリ<166>-Footnote-645900630
Ref: ライブラリ<166>-Footnote-655900696
Ref: ライブラリ<166>-Footnote-665900762
Ref: ライブラリ<166>-Footnote-675900828
Ref: ライブラリ<166>-Footnote-685900894
Ref: ライブラリ<166>-Footnote-695900960
Ref: ライブラリ<166>-Footnote-705901026
Ref: ライブラリ<166>-Footnote-715901092
Ref: ライブラリ<166>-Footnote-725901158
Ref: ライブラリ<166>-Footnote-735901224
Ref: ライブラリ<166>-Footnote-745901290
Ref: ライブラリ<166>-Footnote-755901356
Ref: ライブラリ<166>-Footnote-765901422
Ref: ライブラリ<166>-Footnote-775901488
Ref: ライブラリ<166>-Footnote-785901554
Ref: ライブラリ<166>-Footnote-795901620
Ref: ライブラリ<166>-Footnote-805901686
Ref: ライブラリ<166>-Footnote-815901752
Ref: ライブラリ<166>-Footnote-825901818
Ref: ライブラリ<166>-Footnote-835901884
Ref: ライブラリ<166>-Footnote-845901950
Ref: ライブラリ<166>-Footnote-855902016
Ref: ライブラリ<166>-Footnote-865902082
Ref: ライブラリ<166>-Footnote-875902148
Ref: ライブラリ<166>-Footnote-885902214
Ref: ライブラリ<166>-Footnote-895902280
Ref: ライブラリ<166>-Footnote-905902346
Ref: ライブラリ<166>-Footnote-915902412
Ref: ライブラリ<166>-Footnote-925902478
Ref: ライブラリ<166>-Footnote-935902544
Ref: ライブラリ<166>-Footnote-945902604
Ref: ライブラリ<166>-Footnote-955902670
Ref: ライブラリ<166>-Footnote-965902736
Ref: ライブラリ<166>-Footnote-975902802
Ref: ライブラリ<166>-Footnote-985902868
Ref: ライブラリ<166>-Footnote-995902934
Ref: ライブラリ<166>-Footnote-1005903000
Ref: ライブラリ<166>-Footnote-1015903067
Ref: ライブラリ<166>-Footnote-1025903134
Ref: ライブラリ<166>-Footnote-1035903201
Ref: ライブラリ<166>-Footnote-1045903268
Ref: ライブラリ<166>-Footnote-1055903335
Ref: ライブラリ<166>-Footnote-1065903402
Ref: ライブラリ<166>-Footnote-1075903469
Ref: ライブラリ<166>-Footnote-1085903536
Ref: ライブラリ<166>-Footnote-1095903603
Ref: ライブラリ<166>-Footnote-1105903670
Ref: ライブラリ<166>-Footnote-1115903737
Ref: ライブラリ<166>-Footnote-1125903804
Ref: ライブラリ<166>-Footnote-1135903871
Ref: ライブラリ<166>-Footnote-1145903938
Ref: ライブラリ<166>-Footnote-1155904005
Ref: ライブラリ<166>-Footnote-1165904072
Ref: ライブラリ<166>-Footnote-1175904139
Ref: ライブラリ<166>-Footnote-1185904206
Ref: ライブラリ<166>-Footnote-1195904273
Ref: ライブラリ<166>-Footnote-1205904340
Ref: ライブラリ<166>-Footnote-1215904407
Ref: ライブラリ<166>-Footnote-1225904474
Ref: ライブラリ<166>-Footnote-1235904541
Ref: ライブラリ<166>-Footnote-1245904608
Ref: ライブラリ<166>-Footnote-1255904675
Ref: ライブラリ<166>-Footnote-1265904741
Ref: ライブラリ<166>-Footnote-1275904808
Ref: ライブラリ<166>-Footnote-1285904875
Ref: ライブラリ<166>-Footnote-1295904942
Ref: ライブラリ<166>-Footnote-1305905009
Ref: ライブラリ<166>-Footnote-1315905076
Ref: ライブラリ<166>-Footnote-1325905143
Ref: ライブラリ<166>-Footnote-1335905210
Ref: ライブラリ<166>-Footnote-1345905277
Ref: ライブラリ<166>-Footnote-1355905344
Ref: ライブラリ<166>-Footnote-1365905411
Ref: ライブラリ<166>-Footnote-1375905477
Ref: ライブラリ<166>-Footnote-1385905544
Ref: ライブラリ<166>-Footnote-1395905611
Ref: ライブラリ<166>-Footnote-1405905678
Ref: ライブラリ<166>-Footnote-1415905745
Ref: ライブラリ<166>-Footnote-1425905812
Ref: ライブラリ<166>-Footnote-1435905879
Ref: ライブラリ<166>-Footnote-1445905946
Ref: ライブラリ<166>-Footnote-1455906013
Ref: ライブラリ<166>-Footnote-1465906080
Ref: ライブラリ<166>-Footnote-1475906147
Ref: ライブラリ<166>-Footnote-1485906214
Ref: ライブラリ<166>-Footnote-1495906281
Ref: ライブラリ<166>-Footnote-1505906348
Ref: ライブラリ<166>-Footnote-1515906415
Ref: ライブラリ<166>-Footnote-1525906482
Ref: ライブラリ<166>-Footnote-1535906549
Ref: ライブラリ<166>-Footnote-1545906616
Ref: ライブラリ<166>-Footnote-1555906682
Ref: ライブラリ<166>-Footnote-1565906749
Ref: ライブラリ<166>-Footnote-1575906816
Ref: ライブラリ<166>-Footnote-1585906883
Ref: ライブラリ<166>-Footnote-1595906950
Ref: ライブラリ<166>-Footnote-1605907017
Ref: ライブラリ<166>-Footnote-1615907084
Ref: ライブラリ<166>-Footnote-1625907128
Ref: ライブラリ<166>-Footnote-1635907195
Ref: ライブラリ<166>-Footnote-1645907262
Ref: ライブラリ<166>-Footnote-1655907329
Ref: ライブラリ<166>-Footnote-1665907395
Ref: ライブラリ<166>-Footnote-1675907462
Ref: ライブラリ<166>-Footnote-1685907529
Ref: ライブラリ<166>-Footnote-1695907596
Ref: ライブラリ<166>-Footnote-1705907663
Ref: ライブラリ<166>-Footnote-1715907730
Ref: ライブラリ<166>-Footnote-1725907797
Ref: ライブラリ<166>-Footnote-1735907864
Ref: ライブラリ<166>-Footnote-1745907931
Ref: ライブラリ<166>-Footnote-1755907997
Ref: ライブラリ<166>-Footnote-1765908064
Ref: ライブラリ<166>-Footnote-1775908131
Ref: ライブラリ<166>-Footnote-1785908198
Ref: ライブラリ<166>-Footnote-1795908265
Ref: ライブラリ<166>-Footnote-1805908332
Ref: ライブラリ<166>-Footnote-1815908398
Ref: ライブラリ<166>-Footnote-1825908465
Ref: ライブラリ<166>-Footnote-1835908532
Ref: ライブラリ<166>-Footnote-1845908599
Ref: ライブラリ<166>-Footnote-1855908666
Ref: ライブラリ<166>-Footnote-1865908733
Ref: ライブラリ<166>-Footnote-1875908800
Ref: ライブラリ<166>-Footnote-1885908867
Ref: ライブラリ<166>-Footnote-1895908934
Ref: ライブラリ<166>-Footnote-1905909001
Ref: ライブラリ<166>-Footnote-1915909068
Ref: ライブラリ<166>-Footnote-1925909135
Ref: ライブラリ<166>-Footnote-1935909202
Ref: ライブラリ<166>-Footnote-1945909269
Ref: ライブラリ<166>-Footnote-1955909336
Ref: ライブラリ<166>-Footnote-1965909403
Ref: ライブラリ<166>-Footnote-1975909470
Ref: ライブラリ<166>-Footnote-1985909537
Ref: ライブラリ<166>-Footnote-1995909604
Ref: ライブラリ<166>-Footnote-2005909671
Ref: ライブラリ<166>-Footnote-2015909738
Ref: ライブラリ<166>-Footnote-2025909805
Ref: ライブラリ<166>-Footnote-2035909873
Ref: ライブラリ<166>-Footnote-2045909940
Ref: ライブラリ<166>-Footnote-2055910007
Ref: ライブラリ<166>-Footnote-2065910074
Ref: ライブラリ<166>-Footnote-2075910141
Ref: ライブラリ<166>-Footnote-2085910208
Ref: ライブラリ<166>-Footnote-2095910275
Ref: ライブラリ<166>-Footnote-2105910342
Ref: ライブラリ<166>-Footnote-2115910409
Ref: ライブラリ<166>-Footnote-2125910476
Ref: ライブラリ<166>-Footnote-2135910543
Ref: ライブラリ<166>-Footnote-2145910587
Ref: ライブラリ<166>-Footnote-2155910654
Ref: ライブラリ<166>-Footnote-2165910721
Ref: ライブラリ<166>-Footnote-2175910788
Ref: ライブラリ<166>-Footnote-2185910855
Ref: ライブラリ<166>-Footnote-2195910922
Ref: ライブラリ<166>-Footnote-2205910989
Ref: ライブラリ<166>-Footnote-2215911056
Ref: ライブラリ<166>-Footnote-2225911123
Ref: ライブラリ<166>-Footnote-2235911190
Ref: ライブラリ<166>-Footnote-2245911257
Ref: ライブラリ<166>-Footnote-2255911324
Ref: ライブラリ<166>-Footnote-2265911391
Ref: ライブラリ<166>-Footnote-2275911458
Ref: ライブラリ<166>-Footnote-2285911525
Ref: ライブラリ<166>-Footnote-2295911592
Ref: ライブラリ<166>-Footnote-2305911659
Ref: ライブラリ<166>-Footnote-2315911726
Ref: ライブラリ<166>-Footnote-2325911793
Ref: ライブラリ<166>-Footnote-2335911860
Ref: ライブラリ<166>-Footnote-2345911927
Ref: ライブラリ<166>-Footnote-2355911994
Ref: ライブラリ<166>-Footnote-2365912061
Ref: ライブラリ<166>-Footnote-2375912128
Ref: ライブラリ<166>-Footnote-2385912195
Ref: ライブラリ<166>-Footnote-2395912262
Ref: ライブラリ<166>-Footnote-2405912329
Ref: ライブラリ<166>-Footnote-2415912396
Ref: ライブラリ<166>-Footnote-2425912463
Ref: ライブラリ<166>-Footnote-2435912530
Ref: ライブラリ<166>-Footnote-2445912597
Ref: ライブラリ<166>-Footnote-2455912664
Ref: ライブラリ<166>-Footnote-2465912731
Ref: ライブラリ<166>-Footnote-2475912798
Ref: ライブラリ<166>-Footnote-2485912865
Ref: ライブラリ<166>-Footnote-2495912932
Ref: ライブラリ<166>-Footnote-2505912999
Ref: ライブラリ<166>-Footnote-2515913066
Ref: ライブラリ<166>-Footnote-2525913133
Ref: ライブラリ<166>-Footnote-2535913200
Ref: ライブラリ<166>-Footnote-2545913267
Ref: ライブラリ<166>-Footnote-2555913334
Ref: ライブラリ<166>-Footnote-2565913401
Ref: ライブラリ<166>-Footnote-2575913468
Ref: ライブラリ<166>-Footnote-2585913535
Ref: ライブラリ<166>-Footnote-2595913602
Ref: ライブラリ<166>-Footnote-2605913669
Ref: ライブラリ<166>-Footnote-2615913735
Ref: ライブラリ<166>-Footnote-2625913802
Ref: ライブラリ<166>-Footnote-2635913869
Ref: ライブラリ<166>-Footnote-2645913936
Ref: ライブラリ<166>-Footnote-2655914003
Ref: ライブラリ<166>-Footnote-2665914070
Ref: ライブラリ<166>-Footnote-2675914137
Ref: ライブラリ<166>-Footnote-2685914204
Ref: ライブラリ<166>-Footnote-2695914271
Ref: ライブラリ<166>-Footnote-2705914338
Ref: ライブラリ<166>-Footnote-2715914405
Ref: ライブラリ<166>-Footnote-2725914472
Ref: ライブラリ<166>-Footnote-2735914539
Ref: ライブラリ<166>-Footnote-2745914606
Ref: ライブラリ<166>-Footnote-2755914673
Ref: ライブラリ<166>-Footnote-2765914740
Ref: ライブラリ<166>-Footnote-2775914807
Ref: ライブラリ<166>-Footnote-2785914874
Ref: ライブラリ<166>-Footnote-2795914941
Ref: ライブラリ<166>-Footnote-2805915008
Ref: ライブラリ<166>-Footnote-2815915075
Ref: ライブラリ<166>-Footnote-2825915142
Ref: ライブラリ<166>-Footnote-2835915209
Ref: ライブラリ<166>-Footnote-2845915276
Ref: ライブラリ<166>-Footnote-2855915343
Ref: ライブラリ<166>-Footnote-2865915410
Ref: ライブラリ<166>-Footnote-2875915477
Ref: ライブラリ<166>-Footnote-2885915544
Ref: ライブラリ<166>-Footnote-2895915611
Ref: ライブラリ<166>-Footnote-2905915678
Ref: ライブラリ<166>-Footnote-2915915745
Ref: ライブラリ<166>-Footnote-2925915812
Ref: ライブラリ<166>-Footnote-2935915879
Ref: ライブラリ<166>-Footnote-2945915946
Ref: ライブラリ<166>-Footnote-2955916013
Ref: ライブラリ<166>-Footnote-2965916080
Ref: ライブラリ<166>-Footnote-2975916147
Ref: ライブラリ<166>-Footnote-2985916214
Ref: ライブラリ<166>-Footnote-2995916281
Ref: ライブラリ<166>-Footnote-3005916348
Ref: ライブラリ<166>-Footnote-3015916415
Ref: ライブラリ<166>-Footnote-3025916482
Ref: ライブラリ<166>-Footnote-3035916549
Ref: ライブラリ<166>-Footnote-3045916616
Ref: ライブラリ<166>-Footnote-3055916683
Ref: ライブラリ<166>-Footnote-3065916750
Ref: ライブラリ<166>-Footnote-3075916817
Ref: ライブラリ<166>-Footnote-3085916884
Ref: ライブラリ<166>-Footnote-3095916951
Ref: ライブラリ<166>-Footnote-3105917018
Ref: ライブラリ<166>-Footnote-3115917085
Ref: ライブラリ<166>-Footnote-3125917152
Ref: ライブラリ<166>-Footnote-3135917219
Ref: ライブラリ<166>-Footnote-3145917286
Ref: ライブラリ<166>-Footnote-3155917353
Ref: ライブラリ<166>-Footnote-3165917420
Ref: ライブラリ<166>-Footnote-3175917487
Ref: ライブラリ<166>-Footnote-3185917554
Ref: ライブラリ<166>-Footnote-3195917621
Ref: ライブラリ<166>-Footnote-3205917688
Ref: ライブラリ<166>-Footnote-3215917755
Ref: ライブラリ<166>-Footnote-3225917822
Ref: ライブラリ<166>-Footnote-3235917889
Ref: ライブラリ<166>-Footnote-3245917956
Ref: ライブラリ<166>-Footnote-3255918023
Ref: ライブラリ<166>-Footnote-3265918090
Ref: ライブラリ<166>-Footnote-3275918157
Ref: ライブラリ<166>-Footnote-3285918224
Ref: ライブラリ<166>-Footnote-3295918292
Ref: ライブラリ<166>-Footnote-3305918359
Ref: ライブラリ<166>-Footnote-3315918426
Ref: ライブラリ<166>-Footnote-3325918493
Ref: ライブラリ<166>-Footnote-3335918560
Ref: ライブラリ<166>-Footnote-3345918627
Ref: ライブラリ<166>-Footnote-3355918694
Ref: ライブラリ<166>-Footnote-3365918761
Ref: ライブラリ<166>-Footnote-3375918828
Ref: ライブラリ<166>-Footnote-3385918895
Ref: ライブラリ<166>-Footnote-3395918962
Ref: ライブラリ<166>-Footnote-3405919029
Ref: ライブラリ<166>-Footnote-3415919096
Ref: ライブラリ<166>-Footnote-3425919163
Ref: ライブラリ<166>-Footnote-3435919230
Ref: ライブラリ<166>-Footnote-3445919297
Ref: ライブラリ<166>-Footnote-3455919364
Ref: ライブラリ<166>-Footnote-3465919408
Ref: ライブラリ<166>-Footnote-3475919475
Ref: ライブラリ<166>-Footnote-3485919542
Ref: ライブラリ<166>-Footnote-3495919609
Ref: ライブラリ<166>-Footnote-3505919653
Ref: ライブラリ<166>-Footnote-3515919720
Ref: ライブラリ<166>-Footnote-3525919787
Ref: ライブラリ<166>-Footnote-3535919854
Ref: ライブラリ<166>-Footnote-3545919921
Ref: ライブラリ<166>-Footnote-3555919988
Ref: ライブラリ<166>-Footnote-3565920055
Ref: ライブラリ<166>-Footnote-3575920122
Ref: ライブラリ<166>-Footnote-3585920189
Ref: ライブラリ<166>-Footnote-3595920256
Ref: ライブラリ<166>-Footnote-3605920323
Ref: ライブラリ<166>-Footnote-3615920390
Ref: ライブラリ<166>-Footnote-3625920457
Ref: ライブラリ<166>-Footnote-3635920524
Ref: ライブラリ<166>-Footnote-3645920591
Ref: ライブラリ<166>-Footnote-3655920658
Ref: ライブラリ<166>-Footnote-3665920725
Ref: ライブラリ<166>-Footnote-3675920792
Ref: ライブラリ<166>-Footnote-3685920859
Ref: ライブラリ<166>-Footnote-3695920926
Ref: ライブラリ<166>-Footnote-3705920993
Ref: ライブラリ<166>-Footnote-3715921060
Ref: ライブラリ<166>-Footnote-3725921127
Ref: ライブラリ<166>-Footnote-3735921194
Ref: ライブラリ<166>-Footnote-3745921261
Ref: ライブラリ<166>-Footnote-3755921328
Ref: ライブラリ<166>-Footnote-3765921395
Ref: ライブラリ<166>-Footnote-3775921462
Ref: ライブラリ<166>-Footnote-3785921529
Ref: ライブラリ<166>-Footnote-3795921596
Ref: ライブラリ<166>-Footnote-3805921663
Ref: ライブラリ<166>-Footnote-3815921730
Ref: ライブラリ<166>-Footnote-3825921797
Ref: ライブラリ<166>-Footnote-3835921864
Ref: ライブラリ<166>-Footnote-3845921931
Ref: ライブラリ<166>-Footnote-3855921998
Ref: ライブラリ<166>-Footnote-3865922065
Ref: ライブラリ<166>-Footnote-3875922132
Ref: ライブラリ<166>-Footnote-3885922199
Ref: ライブラリ<166>-Footnote-3895922266
Ref: ライブラリ<166>-Footnote-3905922333
Ref: ライブラリ<166>-Footnote-3915922400
Ref: ライブラリ<166>-Footnote-3925922467
Ref: ライブラリ<166>-Footnote-3935922534
Ref: ライブラリ<166>-Footnote-3945922601
Ref: ライブラリ<166>-Footnote-3955922668
Ref: ライブラリ<166>-Footnote-3965922735
Ref: ライブラリ<166>-Footnote-3975922802
Ref: ライブラリ<166>-Footnote-3985922869
Ref: ライブラリ<166>-Footnote-3995922936
Ref: ライブラリ<166>-Footnote-4005923003
Ref: ライブラリ<166>-Footnote-4015923070
Ref: ライブラリ<166>-Footnote-4025923137
Ref: ライブラリ<166>-Footnote-4035923204
Ref: ライブラリ<166>-Footnote-4045923271
Ref: ライブラリ<166>-Footnote-4055923338
Ref: ライブラリ<166>-Footnote-4065923405
Ref: ライブラリ<166>-Footnote-4075923472
Ref: ライブラリ<166>-Footnote-4085923539
Ref: ライブラリ<166>-Footnote-4095923606
Ref: ライブラリ<166>-Footnote-4105923673
Ref: ライブラリ<166>-Footnote-4115923740
Ref: ライブラリ<166>-Footnote-4125923807
Ref: ライブラリ<166>-Footnote-4135923874
Ref: ライブラリ<166>-Footnote-4145923941
Ref: ライブラリ<166>-Footnote-4155924008
Ref: ライブラリ<166>-Footnote-4165924075
Ref: ライブラリ<166>-Footnote-4175924142
Ref: ライブラリ<166>-Footnote-4185924209
Ref: ライブラリ<166>-Footnote-4195924276
Ref: ライブラリ<166>-Footnote-4205924343
Ref: ライブラリ<166>-Footnote-4215924410
Ref: ライブラリ<166>-Footnote-4225924477
Ref: ライブラリ<166>-Footnote-4235924543
Ref: ライブラリ<166>-Footnote-4245924610
Ref: ライブラリ<166>-Footnote-4255924677
Ref: ライブラリ<166>-Footnote-4265924744
Ref: ライブラリ<166>-Footnote-4275924811
Ref: ライブラリ<166>-Footnote-4285924878
Ref: ライブラリ<166>-Footnote-4295924945
Ref: ライブラリ<166>-Footnote-4305925012
Ref: ライブラリ<166>-Footnote-4315925079
Ref: ライブラリ<166>-Footnote-4325925146
Ref: ライブラリ<166>-Footnote-4335925213
Ref: ライブラリ<166>-Footnote-4345925280
Ref: ライブラリ<166>-Footnote-4355925347
Ref: ライブラリ<166>-Footnote-4365925414
Ref: ライブラリ<166>-Footnote-4375925481
Node: ドキュメント<59>5925548
Ref: whatsnew/changelog id7835925678
Ref: 1e835925678
Ref: ドキュメント<59>-Footnote-15932363
Ref: ドキュメント<59>-Footnote-25932428
Ref: ドキュメント<59>-Footnote-35932493
Ref: ドキュメント<59>-Footnote-45932558
Ref: ドキュメント<59>-Footnote-55932623
Ref: ドキュメント<59>-Footnote-65932688
Ref: ドキュメント<59>-Footnote-75932753
Ref: ドキュメント<59>-Footnote-85932818
Ref: ドキュメント<59>-Footnote-95932883
Ref: ドキュメント<59>-Footnote-105932948
Ref: ドキュメント<59>-Footnote-115933014
Ref: ドキュメント<59>-Footnote-125933080
Ref: ドキュメント<59>-Footnote-135933146
Ref: ドキュメント<59>-Footnote-145933212
Ref: ドキュメント<59>-Footnote-155933278
Ref: ドキュメント<59>-Footnote-165933344
Ref: ドキュメント<59>-Footnote-175933410
Ref: ドキュメント<59>-Footnote-185933476
Ref: ドキュメント<59>-Footnote-195933542
Ref: ドキュメント<59>-Footnote-205933608
Ref: ドキュメント<59>-Footnote-215933674
Ref: ドキュメント<59>-Footnote-225933740
Ref: ドキュメント<59>-Footnote-235933806
Ref: ドキュメント<59>-Footnote-245933849
Ref: ドキュメント<59>-Footnote-255933915
Ref: ドキュメント<59>-Footnote-265933981
Ref: ドキュメント<59>-Footnote-275934047
Ref: ドキュメント<59>-Footnote-285934113
Ref: ドキュメント<59>-Footnote-295934179
Ref: ドキュメント<59>-Footnote-305934222
Ref: ドキュメント<59>-Footnote-315934288
Ref: ドキュメント<59>-Footnote-325934354
Ref: ドキュメント<59>-Footnote-335934420
Ref: ドキュメント<59>-Footnote-345934486
Ref: ドキュメント<59>-Footnote-355934552
Ref: ドキュメント<59>-Footnote-365934618
Ref: ドキュメント<59>-Footnote-375934684
Ref: ドキュメント<59>-Footnote-385934750
Ref: ドキュメント<59>-Footnote-395934816
Ref: ドキュメント<59>-Footnote-405934882
Ref: ドキュメント<59>-Footnote-415934948
Ref: ドキュメント<59>-Footnote-425935014
Ref: ドキュメント<59>-Footnote-435935080
Ref: ドキュメント<59>-Footnote-445935146
Ref: ドキュメント<59>-Footnote-455935212
Ref: ドキュメント<59>-Footnote-465935278
Ref: ドキュメント<59>-Footnote-475935344
Ref: ドキュメント<59>-Footnote-485935410
Ref: ドキュメント<59>-Footnote-495935476
Ref: ドキュメント<59>-Footnote-505935542
Ref: ドキュメント<59>-Footnote-515935607
Ref: ドキュメント<59>-Footnote-525935673
Ref: ドキュメント<59>-Footnote-535935739
Ref: ドキュメント<59>-Footnote-545935805
Ref: ドキュメント<59>-Footnote-555935871
Ref: ドキュメント<59>-Footnote-565935937
Ref: ドキュメント<59>-Footnote-575936002
Ref: ドキュメント<59>-Footnote-585936068
Ref: ドキュメント<59>-Footnote-595936134
Node: テスト<58>5936200
Ref: whatsnew/changelog id7845936323
Ref: 1e855936323
Ref: テスト<58>-Footnote-15943920
Ref: テスト<58>-Footnote-25943985
Ref: テスト<58>-Footnote-35944050
Ref: テスト<58>-Footnote-45944115
Ref: テスト<58>-Footnote-55944180
Ref: テスト<58>-Footnote-65944245
Ref: テスト<58>-Footnote-75944310
Ref: テスト<58>-Footnote-85944375
Ref: テスト<58>-Footnote-95944440
Ref: テスト<58>-Footnote-105944505
Ref: テスト<58>-Footnote-115944571
Ref: テスト<58>-Footnote-125944637
Ref: テスト<58>-Footnote-135944703
Ref: テスト<58>-Footnote-145944769
Ref: テスト<58>-Footnote-155944835
Ref: テスト<58>-Footnote-165944901
Ref: テスト<58>-Footnote-175944967
Ref: テスト<58>-Footnote-185945033
Ref: テスト<58>-Footnote-195945099
Ref: テスト<58>-Footnote-205945165
Ref: テスト<58>-Footnote-215945231
Ref: テスト<58>-Footnote-225945297
Ref: テスト<58>-Footnote-235945363
Ref: テスト<58>-Footnote-245945429
Ref: テスト<58>-Footnote-255945495
Ref: テスト<58>-Footnote-265945561
Ref: テスト<58>-Footnote-275945627
Ref: テスト<58>-Footnote-285945693
Ref: テスト<58>-Footnote-295945759
Ref: テスト<58>-Footnote-305945825
Ref: テスト<58>-Footnote-315945891
Ref: テスト<58>-Footnote-325945957
Ref: テスト<58>-Footnote-335946023
Ref: テスト<58>-Footnote-345946089
Ref: テスト<58>-Footnote-355946155
Ref: テスト<58>-Footnote-365946221
Ref: テスト<58>-Footnote-375946287
Ref: テスト<58>-Footnote-385946353
Ref: テスト<58>-Footnote-395946419
Ref: テスト<58>-Footnote-405946485
Ref: テスト<58>-Footnote-415946551
Ref: テスト<58>-Footnote-425946617
Ref: テスト<58>-Footnote-435946683
Ref: テスト<58>-Footnote-445946749
Ref: テスト<58>-Footnote-455946815
Ref: テスト<58>-Footnote-465946881
Ref: テスト<58>-Footnote-475946947
Ref: テスト<58>-Footnote-485947013
Node: ビルド<65>5947079
Ref: whatsnew/changelog id7855947191
Ref: 1e865947191
Ref: ビルド<65>-Footnote-15952306
Ref: ビルド<65>-Footnote-25952371
Ref: ビルド<65>-Footnote-35952436
Ref: ビルド<65>-Footnote-45952501
Ref: ビルド<65>-Footnote-55952566
Ref: ビルド<65>-Footnote-65952631
Ref: ビルド<65>-Footnote-75952696
Ref: ビルド<65>-Footnote-85952761
Ref: ビルド<65>-Footnote-95952826
Ref: ビルド<65>-Footnote-105952891
Ref: ビルド<65>-Footnote-115952957
Ref: ビルド<65>-Footnote-125953023
Ref: ビルド<65>-Footnote-135953089
Ref: ビルド<65>-Footnote-145953155
Ref: ビルド<65>-Footnote-155953221
Ref: ビルド<65>-Footnote-165953287
Ref: ビルド<65>-Footnote-175953353
Ref: ビルド<65>-Footnote-185953419
Ref: ビルド<65>-Footnote-195953485
Ref: ビルド<65>-Footnote-205953551
Ref: ビルド<65>-Footnote-215953617
Ref: ビルド<65>-Footnote-225953683
Ref: ビルド<65>-Footnote-235953749
Ref: ビルド<65>-Footnote-245953814
Ref: ビルド<65>-Footnote-255953880
Ref: ビルド<65>-Footnote-265953946
Ref: ビルド<65>-Footnote-275954012
Ref: ビルド<65>-Footnote-285954078
Ref: ビルド<65>-Footnote-295954144
Ref: ビルド<65>-Footnote-305954210
Ref: ビルド<65>-Footnote-315954276
Ref: ビルド<65>-Footnote-325954342
Ref: ビルド<65>-Footnote-335954408
Ref: ビルド<65>-Footnote-345954474
Ref: ビルド<65>-Footnote-355954540
Ref: ビルド<65>-Footnote-365954606
Ref: ビルド<65>-Footnote-375954672
Node: Windows<57>5954738
Ref: whatsnew/changelog id7865954846
Ref: 1e885954846
Ref: Windows<57>-Footnote-15959255
Ref: Windows<57>-Footnote-25959320
Ref: Windows<57>-Footnote-35959385
Ref: Windows<57>-Footnote-45959450
Ref: Windows<57>-Footnote-55959515
Ref: Windows<57>-Footnote-65959580
Ref: Windows<57>-Footnote-75959645
Ref: Windows<57>-Footnote-85959710
Ref: Windows<57>-Footnote-95959775
Ref: Windows<57>-Footnote-105959840
Ref: Windows<57>-Footnote-115959906
Ref: Windows<57>-Footnote-125959972
Ref: Windows<57>-Footnote-135960038
Ref: Windows<57>-Footnote-145960104
Ref: Windows<57>-Footnote-155960170
Ref: Windows<57>-Footnote-165960236
Ref: Windows<57>-Footnote-175960302
Ref: Windows<57>-Footnote-185960368
Ref: Windows<57>-Footnote-195960434
Ref: Windows<57>-Footnote-205960500
Ref: Windows<57>-Footnote-215960566
Ref: Windows<57>-Footnote-225960632
Ref: Windows<57>-Footnote-235960698
Ref: Windows<57>-Footnote-245960764
Ref: Windows<57>-Footnote-255960830
Ref: Windows<57>-Footnote-265960896
Ref: Windows<57>-Footnote-275960962
Ref: Windows<57>-Footnote-285961028
Ref: Windows<57>-Footnote-295961094
Ref: Windows<57>-Footnote-305961160
Ref: Windows<57>-Footnote-315961226
Ref: Windows<57>-Footnote-325961292
Ref: Windows<57>-Footnote-335961358
Ref: Windows<57>-Footnote-345961424
Ref: Windows<57>-Footnote-355961490
Ref: Windows<57>-Footnote-365961556
Ref: Windows<57>-Footnote-375961622
Ref: Windows<57>-Footnote-385961688
Ref: Windows<57>-Footnote-395961754
Ref: Windows<57>-Footnote-405961820
Node: macOS<45>5961885
Ref: whatsnew/changelog id7875961988
Ref: 1e895961988
Ref: macOS<45>-Footnote-15963593
Ref: macOS<45>-Footnote-25963658
Ref: macOS<45>-Footnote-35963723
Ref: macOS<45>-Footnote-45963788
Ref: macOS<45>-Footnote-55963853
Ref: macOS<45>-Footnote-65963918
Ref: macOS<45>-Footnote-75963983
Ref: macOS<45>-Footnote-85964048
Ref: macOS<45>-Footnote-95964113
Ref: macOS<45>-Footnote-105964178
Node: IDLE<38>5964244
Ref: whatsnew/changelog id7885964351
Ref: 1e8a5964351
Ref: IDLE<38>-Footnote-15972713
Ref: IDLE<38>-Footnote-25972778
Ref: IDLE<38>-Footnote-35972843
Ref: IDLE<38>-Footnote-45972908
Ref: IDLE<38>-Footnote-55972973
Ref: IDLE<38>-Footnote-65973038
Ref: IDLE<38>-Footnote-75973103
Ref: IDLE<38>-Footnote-85973168
Ref: IDLE<38>-Footnote-95973233
Ref: IDLE<38>-Footnote-105973298
Ref: IDLE<38>-Footnote-115973364
Ref: IDLE<38>-Footnote-125973430
Ref: IDLE<38>-Footnote-135973496
Ref: IDLE<38>-Footnote-145973562
Ref: IDLE<38>-Footnote-155973628
Ref: IDLE<38>-Footnote-165973694
Ref: IDLE<38>-Footnote-175973760
Ref: IDLE<38>-Footnote-185973826
Ref: IDLE<38>-Footnote-195973892
Ref: IDLE<38>-Footnote-205973958
Ref: IDLE<38>-Footnote-215974024
Ref: IDLE<38>-Footnote-225974090
Ref: IDLE<38>-Footnote-235974156
Ref: IDLE<38>-Footnote-245974222
Ref: IDLE<38>-Footnote-255974288
Ref: IDLE<38>-Footnote-265974354
Ref: IDLE<38>-Footnote-275974420
Ref: IDLE<38>-Footnote-285974488
Ref: IDLE<38>-Footnote-295974554
Ref: IDLE<38>-Footnote-305974620
Ref: IDLE<38>-Footnote-315974686
Ref: IDLE<38>-Footnote-325974752
Ref: IDLE<38>-Footnote-335974818
Ref: IDLE<38>-Footnote-345974884
Ref: IDLE<38>-Footnote-355974950
Ref: IDLE<38>-Footnote-365975016
Ref: IDLE<38>-Footnote-375975082
Ref: IDLE<38>-Footnote-385975148
Ref: IDLE<38>-Footnote-395975214
Ref: IDLE<38>-Footnote-405975280
Ref: IDLE<38>-Footnote-415975346
Ref: IDLE<38>-Footnote-425975412
Ref: IDLE<38>-Footnote-435975478
Ref: IDLE<38>-Footnote-445975544
Ref: IDLE<38>-Footnote-455975610
Ref: IDLE<38>-Footnote-465975676
Ref: IDLE<38>-Footnote-475975742
Ref: IDLE<38>-Footnote-485975808
Ref: IDLE<38>-Footnote-495975874
Ref: IDLE<38>-Footnote-505975940
Ref: IDLE<38>-Footnote-515976006
Ref: IDLE<38>-Footnote-525976072
Ref: IDLE<38>-Footnote-535976138
Ref: IDLE<38>-Footnote-545976204
Ref: IDLE<38>-Footnote-555976270
Ref: IDLE<38>-Footnote-565976336
Ref: IDLE<38>-Footnote-575976402
Ref: IDLE<38>-Footnote-585976468
Ref: IDLE<38>-Footnote-595976534
Node: Tools/Demos<37>5976600
Ref: whatsnew/changelog id7895976707
Ref: 1e8b5976707
Ref: Tools/Demos<37>-Footnote-15978352
Ref: Tools/Demos<37>-Footnote-25978417
Ref: Tools/Demos<37>-Footnote-35978482
Ref: Tools/Demos<37>-Footnote-45978547
Ref: Tools/Demos<37>-Footnote-55978612
Ref: Tools/Demos<37>-Footnote-65978677
Ref: Tools/Demos<37>-Footnote-75978742
Ref: Tools/Demos<37>-Footnote-85978807
Ref: Tools/Demos<37>-Footnote-95978872
Ref: Tools/Demos<37>-Footnote-105978937
Ref: Tools/Demos<37>-Footnote-115979003
Ref: Tools/Demos<37>-Footnote-125979069
Node: C API<59>5979135
Ref: whatsnew/changelog id7905979225
Ref: 1e8c5979225
Ref: C API<59>-Footnote-15982642
Ref: C API<59>-Footnote-25982707
Ref: C API<59>-Footnote-35982772
Ref: C API<59>-Footnote-45982837
Ref: C API<59>-Footnote-55982902
Ref: C API<59>-Footnote-65982967
Ref: C API<59>-Footnote-75983032
Ref: C API<59>-Footnote-85983097
Ref: C API<59>-Footnote-95983162
Ref: C API<59>-Footnote-105983227
Ref: C API<59>-Footnote-115983293
Ref: C API<59>-Footnote-125983359
Ref: C API<59>-Footnote-135983425
Ref: C API<59>-Footnote-145983491
Ref: C API<59>-Footnote-155983557
Ref: C API<59>-Footnote-165983623
Ref: C API<59>-Footnote-175983689
Ref: C API<59>-Footnote-185983755
Ref: C API<59>-Footnote-195983821
Ref: C API<59>-Footnote-205983887
Ref: C API<59>-Footnote-215983953
Ref: C API<59>-Footnote-225984019
Node: Python 3 7 0 final5984085
Ref: whatsnew/changelog python-3-7-0-final5984222
Ref: 1e955984222
Node: ライブラリ<167>5984376
Ref: whatsnew/changelog id7915984469
Ref: 1e965984469
Ref: ライブラリ<167>-Footnote-15984650
Node: C API<60>5984715
Ref: whatsnew/changelog id7925984808
Ref: 1e985984808
Ref: C API<60>-Footnote-15985019
Node: Python 3 7 0 release candidate 15985084
Ref: whatsnew/changelog python-3-7-0-release-candidate-15985220
Ref: 1e995985220
Node: Core and Builtins<164>5985543
Ref: whatsnew/changelog id7935985663
Ref: 1e9a5985663
Ref: Core and Builtins<164>-Footnote-15986305
Ref: Core and Builtins<164>-Footnote-25986370
Ref: Core and Builtins<164>-Footnote-35986435
Ref: Core and Builtins<164>-Footnote-45986500
Node: ライブラリ<168>5986565
Ref: whatsnew/changelog id7945986716
Ref: 1e9b5986716
Ref: ライブラリ<168>-Footnote-15988423
Ref: ライブラリ<168>-Footnote-25988488
Ref: ライブラリ<168>-Footnote-35988553
Ref: ライブラリ<168>-Footnote-45988618
Ref: ライブラリ<168>-Footnote-55988683
Ref: ライブラリ<168>-Footnote-65988748
Ref: ライブラリ<168>-Footnote-75988813
Ref: ライブラリ<168>-Footnote-85988878
Ref: ライブラリ<168>-Footnote-95988943
Ref: ライブラリ<168>-Footnote-105989008
Ref: ライブラリ<168>-Footnote-115989074
Ref: ライブラリ<168>-Footnote-125989140
Ref: ライブラリ<168>-Footnote-135989206
Node: ドキュメント<60>5989272
Ref: whatsnew/changelog id7955989414
Ref: 1e9c5989414
Ref: ドキュメント<60>-Footnote-15989921
Ref: ドキュメント<60>-Footnote-25989986
Ref: ドキュメント<60>-Footnote-35990028
Ref: ドキュメント<60>-Footnote-45990093
Node: ビルド<66>5990158
Ref: whatsnew/changelog id7965990291
Ref: 1e9d5990291
Ref: ビルド<66>-Footnote-15990558
Node: Windows<58>5990622
Ref: whatsnew/changelog id7975990741
Ref: 1e9e5990741
Ref: Windows<58>-Footnote-15990898
Node: IDLE<39>5990963
Ref: whatsnew/changelog id7985991060
Ref: 1e9f5991060
Ref: IDLE<39>-Footnote-15992280
Ref: IDLE<39>-Footnote-25992345
Ref: IDLE<39>-Footnote-35992410
Ref: IDLE<39>-Footnote-45992475
Ref: IDLE<39>-Footnote-55992540
Ref: IDLE<39>-Footnote-65992605
Node: Python 3 7 0 beta 55992670
Ref: whatsnew/changelog python-3-7-0-beta-55992807
Ref: 1ea05992807
Node: Core and Builtins<165>5993128
Ref: whatsnew/changelog id7995993235
Ref: 1ea15993235
Ref: Core and Builtins<165>-Footnote-15994747
Ref: Core and Builtins<165>-Footnote-25994812
Ref: Core and Builtins<165>-Footnote-35994877
Ref: Core and Builtins<165>-Footnote-45994942
Ref: Core and Builtins<165>-Footnote-55995007
Ref: Core and Builtins<165>-Footnote-65995072
Ref: Core and Builtins<165>-Footnote-75995137
Ref: Core and Builtins<165>-Footnote-85995202
Ref: Core and Builtins<165>-Footnote-95995267
Node: ライブラリ<169>5995332
Ref: whatsnew/changelog id8005995470
Ref: 1ea25995470
Ref: ライブラリ<169>-Footnote-16001073
Ref: ライブラリ<169>-Footnote-26001138
Ref: ライブラリ<169>-Footnote-36001203
Ref: ライブラリ<169>-Footnote-46001268
Ref: ライブラリ<169>-Footnote-56001333
Ref: ライブラリ<169>-Footnote-66001398
Ref: ライブラリ<169>-Footnote-76001463
Ref: ライブラリ<169>-Footnote-86001528
Ref: ライブラリ<169>-Footnote-96001593
Ref: ライブラリ<169>-Footnote-106001658
Ref: ライブラリ<169>-Footnote-116001724
Ref: ライブラリ<169>-Footnote-126001790
Ref: ライブラリ<169>-Footnote-136001856
Ref: ライブラリ<169>-Footnote-146001922
Ref: ライブラリ<169>-Footnote-156001988
Ref: ライブラリ<169>-Footnote-166002054
Ref: ライブラリ<169>-Footnote-176002120
Ref: ライブラリ<169>-Footnote-186002186
Ref: ライブラリ<169>-Footnote-196002252
Ref: ライブラリ<169>-Footnote-206002318
Ref: ライブラリ<169>-Footnote-216002384
Ref: ライブラリ<169>-Footnote-226002450
Ref: ライブラリ<169>-Footnote-236002516
Ref: ライブラリ<169>-Footnote-246002582
Ref: ライブラリ<169>-Footnote-256002648
Ref: ライブラリ<169>-Footnote-266002714
Ref: ライブラリ<169>-Footnote-276002780
Ref: ライブラリ<169>-Footnote-286002846
Ref: ライブラリ<169>-Footnote-296002912
Ref: ライブラリ<169>-Footnote-306002978
Ref: ライブラリ<169>-Footnote-316003044
Ref: ライブラリ<169>-Footnote-326003110
Ref: ライブラリ<169>-Footnote-336003176
Ref: ライブラリ<169>-Footnote-346003242
Ref: ライブラリ<169>-Footnote-356003308
Ref: ライブラリ<169>-Footnote-366003374
Ref: ライブラリ<169>-Footnote-376003440
Ref: ライブラリ<169>-Footnote-386003506
Node: ドキュメント<61>6003572
Ref: whatsnew/changelog id8016003701
Ref: 1ea36003701
Ref: ドキュメント<61>-Footnote-16004175
Ref: ドキュメント<61>-Footnote-26004240
Ref: ドキュメント<61>-Footnote-36004305
Ref: ドキュメント<61>-Footnote-46004347
Ref: ドキュメント<61>-Footnote-56004412
Ref: ドキュメント<61>-Footnote-66004477
Node: テスト<59>6004542
Ref: whatsnew/changelog id8026004664
Ref: 1ea46004664
Ref: テスト<59>-Footnote-16005018
Ref: テスト<59>-Footnote-26005083
Node: ビルド<67>6005148
Ref: whatsnew/changelog id8036005257
Ref: 1ea56005257
Ref: ビルド<67>-Footnote-16005741
Ref: ビルド<67>-Footnote-26005806
Ref: ビルド<67>-Footnote-36005871
Node: macOS<46>6005936
Ref: whatsnew/changelog id8046006040
Ref: 1ea66006040
Ref: macOS<46>-Footnote-16006280
Node: IDLE<40>6006345
Ref: whatsnew/changelog id8056006427
Ref: 1ea76006427
Ref: IDLE<40>-Footnote-16006704
Ref: IDLE<40>-Footnote-26006769
Ref: IDLE<40>-Footnote-36006834
Node: Python 3 7 0 beta 46006899
Ref: whatsnew/changelog python-3-7-0-beta-46007023
Ref: 1ea86007023
Node: Core and Builtins<166>6007400
Ref: whatsnew/changelog id8066007507
Ref: 1ea96007507
Ref: Core and Builtins<166>-Footnote-16008633
Ref: Core and Builtins<166>-Footnote-26008698
Ref: Core and Builtins<166>-Footnote-36008763
Ref: Core and Builtins<166>-Footnote-46008828
Ref: Core and Builtins<166>-Footnote-56008893
Ref: Core and Builtins<166>-Footnote-66008958
Ref: Core and Builtins<166>-Footnote-76009023
Node: ライブラリ<170>6009088
Ref: whatsnew/changelog id8076009226
Ref: 1eaa6009226
Ref: ライブラリ<170>-Footnote-16012067
Ref: ライブラリ<170>-Footnote-26012132
Ref: ライブラリ<170>-Footnote-36012197
Ref: ライブラリ<170>-Footnote-46012262
Ref: ライブラリ<170>-Footnote-56012328
Ref: ライブラリ<170>-Footnote-66012393
Ref: ライブラリ<170>-Footnote-76012458
Ref: ライブラリ<170>-Footnote-86012523
Ref: ライブラリ<170>-Footnote-96012588
Ref: ライブラリ<170>-Footnote-106012653
Ref: ライブラリ<170>-Footnote-116012719
Ref: ライブラリ<170>-Footnote-126012785
Ref: ライブラリ<170>-Footnote-136012851
Ref: ライブラリ<170>-Footnote-146012917
Ref: ライブラリ<170>-Footnote-156012983
Ref: ライブラリ<170>-Footnote-166013049
Ref: ライブラリ<170>-Footnote-176013115
Ref: ライブラリ<170>-Footnote-186013158
Ref: ライブラリ<170>-Footnote-196013224
Ref: ライブラリ<170>-Footnote-206013290
Ref: ライブラリ<170>-Footnote-216013356
Ref: ライブラリ<170>-Footnote-226013422
Node: ドキュメント<62>6013488
Ref: whatsnew/changelog id8086013617
Ref: 1eab6013617
Ref: ドキュメント<62>-Footnote-16014372
Ref: ドキュメント<62>-Footnote-26014437
Ref: ドキュメント<62>-Footnote-36014502
Ref: ドキュメント<62>-Footnote-46014567
Ref: ドキュメント<62>-Footnote-56014632
Ref: ドキュメント<62>-Footnote-66014696
Node: テスト<60>6014761
Ref: whatsnew/changelog id8096014883
Ref: 1eac6014883
Ref: テスト<60>-Footnote-16015104
Node: ビルド<68>6015169
Ref: whatsnew/changelog id8106015280
Ref: 1ead6015280
Ref: ビルド<68>-Footnote-16015975
Ref: ビルド<68>-Footnote-26016040
Ref: ビルド<68>-Footnote-36016105
Ref: ビルド<68>-Footnote-46016170
Ref: ビルド<68>-Footnote-56016235
Node: Windows<59>6016300
Ref: whatsnew/changelog id8116016407
Ref: 1eae6016407
Ref: Windows<59>-Footnote-16016548
Node: macOS<47>6016613
Ref: whatsnew/changelog id8126016715
Ref: 1eaf6016715
Ref: macOS<47>-Footnote-16016856
Node: IDLE<41>6016921
Ref: whatsnew/changelog id8136017027
Ref: 1eb06017027
Ref: IDLE<41>-Footnote-16017605
Ref: IDLE<41>-Footnote-26017670
Node: Tools/Demos<38>6017735
Ref: whatsnew/changelog id8146017823
Ref: 1eb16017823
Ref: Tools/Demos<38>-Footnote-16018427
Ref: Tools/Demos<38>-Footnote-26018492
Ref: Tools/Demos<38>-Footnote-36018557
Ref: Tools/Demos<38>-Footnote-46018622
Node: Python 3 7 0 beta 36018687
Ref: whatsnew/changelog python-3-7-0-beta-36018811
Ref: 1eb26018811
Node: セキュリティ<52>6019254
Ref: whatsnew/changelog id8156019363
Ref: 1eb36019363
Ref: セキュリティ<52>-Footnote-16020009
Ref: セキュリティ<52>-Footnote-26020074
Ref: セキュリティ<52>-Footnote-36020129
Ref: セキュリティ<52>-Footnote-46020194
Ref: セキュリティ<52>-Footnote-56020259
Ref: セキュリティ<52>-Footnote-66020314
Node: Core and Builtins<167>6020369
Ref: whatsnew/changelog id8166020507
Ref: 1eb46020507
Ref: Core and Builtins<167>-Footnote-16021703
Ref: Core and Builtins<167>-Footnote-26021768
Ref: Core and Builtins<167>-Footnote-36021833
Ref: Core and Builtins<167>-Footnote-46021898
Ref: Core and Builtins<167>-Footnote-56021963
Ref: Core and Builtins<167>-Footnote-66022028
Ref: Core and Builtins<167>-Footnote-76022093
Node: ライブラリ<171>6022158
Ref: whatsnew/changelog id8176022296
Ref: 1eb56022296
Ref: ライブラリ<171>-Footnote-16026350
Ref: ライブラリ<171>-Footnote-26026415
Ref: ライブラリ<171>-Footnote-36026480
Ref: ライブラリ<171>-Footnote-46026545
Ref: ライブラリ<171>-Footnote-56026610
Ref: ライブラリ<171>-Footnote-66026675
Ref: ライブラリ<171>-Footnote-76026740
Ref: ライブラリ<171>-Footnote-86026805
Ref: ライブラリ<171>-Footnote-96026870
Ref: ライブラリ<171>-Footnote-106026935
Ref: ライブラリ<171>-Footnote-116027001
Ref: ライブラリ<171>-Footnote-126027067
Ref: ライブラリ<171>-Footnote-136027133
Ref: ライブラリ<171>-Footnote-146027199
Ref: ライブラリ<171>-Footnote-156027265
Ref: ライブラリ<171>-Footnote-166027331
Ref: ライブラリ<171>-Footnote-176027397
Ref: ライブラリ<171>-Footnote-186027463
Ref: ライブラリ<171>-Footnote-196027529
Ref: ライブラリ<171>-Footnote-206027595
Ref: ライブラリ<171>-Footnote-216027661
Ref: ライブラリ<171>-Footnote-226027727
Ref: ライブラリ<171>-Footnote-236027793
Ref: ライブラリ<171>-Footnote-246027859
Ref: ライブラリ<171>-Footnote-256027925
Ref: ライブラリ<171>-Footnote-266027991
Ref: ライブラリ<171>-Footnote-276028057
Node: ドキュメント<63>6028123
Ref: whatsnew/changelog id8186028252
Ref: 1eb66028252
Ref: ドキュメント<63>-Footnote-16028893
Ref: ドキュメント<63>-Footnote-26028958
Ref: ドキュメント<63>-Footnote-36029023
Ref: ドキュメント<63>-Footnote-46029088
Ref: ドキュメント<63>-Footnote-56029153
Node: テスト<61>6029218
Ref: whatsnew/changelog id8196029340
Ref: 1eb76029340
Ref: テスト<61>-Footnote-16029678
Ref: テスト<61>-Footnote-26029743
Ref: テスト<61>-Footnote-36029808
Node: ビルド<69>6029873
Ref: whatsnew/changelog id8206029984
Ref: 1eb86029984
Ref: ビルド<69>-Footnote-16030126
Node: Windows<60>6030191
Ref: whatsnew/changelog id8216030298
Ref: 1eb96030298
Ref: Windows<60>-Footnote-16030577
Ref: Windows<60>-Footnote-26030642
Node: macOS<48>6030707
Ref: whatsnew/changelog id8226030809
Ref: 1eba6030809
Ref: macOS<48>-Footnote-16031241
Node: IDLE<42>6031306
Ref: whatsnew/changelog id8236031412
Ref: 1ebb6031412
Ref: IDLE<42>-Footnote-16032126
Ref: IDLE<42>-Footnote-26032191
Node: Tools/Demos<39>6032256
Ref: whatsnew/changelog id8246032362
Ref: 1ebc6032362
Ref: Tools/Demos<39>-Footnote-16032592
Node: C API<61>6032657
Ref: whatsnew/changelog id8256032746
Ref: 1ebd6032746
Ref: C API<61>-Footnote-16033130
Ref: C API<61>-Footnote-26033195
Node: Python 3 7 0 beta 26033260
Ref: whatsnew/changelog python-3-7-0-beta-26033384
Ref: 1ebe6033384
Node: セキュリティ<53>6033807
Ref: whatsnew/changelog id8266033916
Ref: 1ebf6033916
Ref: セキュリティ<53>-Footnote-16034115
Node: Core and Builtins<168>6034180
Ref: whatsnew/changelog id8276034318
Ref: 1ec06034318
Ref: Core and Builtins<168>-Footnote-16035149
Ref: Core and Builtins<168>-Footnote-26035214
Ref: Core and Builtins<168>-Footnote-36035279
Ref: Core and Builtins<168>-Footnote-46035344
Ref: Core and Builtins<168>-Footnote-56035409
Ref: Core and Builtins<168>-Footnote-66035474
Ref: Core and Builtins<168>-Footnote-76035539
Node: ライブラリ<172>6035604
Ref: whatsnew/changelog id8286035742
Ref: 1ec16035742
Ref: ライブラリ<172>-Footnote-16042149
Ref: ライブラリ<172>-Footnote-26042214
Ref: ライブラリ<172>-Footnote-36042279
Ref: ライブラリ<172>-Footnote-46042344
Ref: ライブラリ<172>-Footnote-56042409
Ref: ライブラリ<172>-Footnote-66042474
Ref: ライブラリ<172>-Footnote-76042539
Ref: ライブラリ<172>-Footnote-86042604
Ref: ライブラリ<172>-Footnote-96042669
Ref: ライブラリ<172>-Footnote-106042734
Ref: ライブラリ<172>-Footnote-116042800
Ref: ライブラリ<172>-Footnote-126042866
Ref: ライブラリ<172>-Footnote-136042932
Ref: ライブラリ<172>-Footnote-146042998
Ref: ライブラリ<172>-Footnote-156043064
Ref: ライブラリ<172>-Footnote-166043130
Ref: ライブラリ<172>-Footnote-176043196
Ref: ライブラリ<172>-Footnote-186043262
Ref: ライブラリ<172>-Footnote-196043328
Ref: ライブラリ<172>-Footnote-206043394
Ref: ライブラリ<172>-Footnote-216043460
Ref: ライブラリ<172>-Footnote-226043526
Ref: ライブラリ<172>-Footnote-236043592
Ref: ライブラリ<172>-Footnote-246043658
Ref: ライブラリ<172>-Footnote-256043724
Ref: ライブラリ<172>-Footnote-266043790
Ref: ライブラリ<172>-Footnote-276043856
Ref: ライブラリ<172>-Footnote-286043922
Ref: ライブラリ<172>-Footnote-296043988
Ref: ライブラリ<172>-Footnote-306044054
Ref: ライブラリ<172>-Footnote-316044120
Ref: ライブラリ<172>-Footnote-326044186
Ref: ライブラリ<172>-Footnote-336044252
Ref: ライブラリ<172>-Footnote-346044318
Node: ドキュメント<64>6044384
Ref: whatsnew/changelog id8296044513
Ref: 1ec26044513
Ref: ドキュメント<64>-Footnote-16045468
Ref: ドキュメント<64>-Footnote-26045533
Ref: ドキュメント<64>-Footnote-36045598
Ref: ドキュメント<64>-Footnote-46045663
Ref: ドキュメント<64>-Footnote-56045728
Ref: ドキュメント<64>-Footnote-66045793
Ref: ドキュメント<64>-Footnote-76045857
Ref: ドキュメント<64>-Footnote-86045922
Node: テスト<62>6045987
Ref: whatsnew/changelog id8306046109
Ref: 1ec36046109
Ref: テスト<62>-Footnote-16046257
Node: ビルド<70>6046322
Ref: whatsnew/changelog id8316046433
Ref: 1ec46046433
Ref: ビルド<70>-Footnote-16046579
Node: Windows<61>6046644
Ref: whatsnew/changelog id8326046751
Ref: 1ec56046751
Ref: Windows<61>-Footnote-16047487
Ref: Windows<61>-Footnote-26047552
Ref: Windows<61>-Footnote-36047617
Ref: Windows<61>-Footnote-46047682
Ref: Windows<61>-Footnote-56047747
Ref: Windows<61>-Footnote-66047812
Node: macOS<49>6047877
Ref: whatsnew/changelog id8336047979
Ref: 1ec66047979
Ref: macOS<49>-Footnote-16048114
Node: IDLE<43>6048179
Ref: whatsnew/changelog id8346048285
Ref: 1ec76048285
Ref: IDLE<43>-Footnote-16049120
Ref: IDLE<43>-Footnote-26049185
Ref: IDLE<43>-Footnote-36049250
Ref: IDLE<43>-Footnote-46049315
Ref: IDLE<43>-Footnote-56049380
Ref: IDLE<43>-Footnote-66049445
Node: Tools/Demos<40>6049510
Ref: whatsnew/changelog id8356049598
Ref: 1ec86049598
Ref: Tools/Demos<40>-Footnote-16049817
Node: Python 3 7 0 beta 16049882
Ref: whatsnew/changelog python-3-7-0-beta-16050007
Ref: 1ec96050007
Node: Core and Builtins<169>6050354
Ref: whatsnew/changelog id8366050461
Ref: 1eca6050461
Ref: Core and Builtins<169>-Footnote-16053875
Ref: Core and Builtins<169>-Footnote-26053940
Ref: Core and Builtins<169>-Footnote-36054005
Ref: Core and Builtins<169>-Footnote-46054070
Ref: Core and Builtins<169>-Footnote-56054135
Ref: Core and Builtins<169>-Footnote-66054200
Ref: Core and Builtins<169>-Footnote-76054265
Ref: Core and Builtins<169>-Footnote-86054330
Ref: Core and Builtins<169>-Footnote-96054395
Ref: Core and Builtins<169>-Footnote-106054437
Ref: Core and Builtins<169>-Footnote-116054503
Ref: Core and Builtins<169>-Footnote-126054569
Ref: Core and Builtins<169>-Footnote-136054635
Ref: Core and Builtins<169>-Footnote-146054701
Ref: Core and Builtins<169>-Footnote-156054767
Ref: Core and Builtins<169>-Footnote-166054833
Ref: Core and Builtins<169>-Footnote-176054899
Ref: Core and Builtins<169>-Footnote-186054965
Ref: Core and Builtins<169>-Footnote-196055008
Ref: Core and Builtins<169>-Footnote-206055074
Ref: Core and Builtins<169>-Footnote-216055140
Ref: Core and Builtins<169>-Footnote-226055206
Ref: Core and Builtins<169>-Footnote-236055272
Node: ライブラリ<173>6055338
Ref: whatsnew/changelog id8376055476
Ref: 1ecb6055476
Ref: ライブラリ<173>-Footnote-16062836
Ref: ライブラリ<173>-Footnote-26062901
Ref: ライブラリ<173>-Footnote-36062966
Ref: ライブラリ<173>-Footnote-46063031
Ref: ライブラリ<173>-Footnote-56063096
Ref: ライブラリ<173>-Footnote-66063161
Ref: ライブラリ<173>-Footnote-76063226
Ref: ライブラリ<173>-Footnote-86063291
Ref: ライブラリ<173>-Footnote-96063356
Ref: ライブラリ<173>-Footnote-106063421
Ref: ライブラリ<173>-Footnote-116063487
Ref: ライブラリ<173>-Footnote-126063553
Ref: ライブラリ<173>-Footnote-136063619
Ref: ライブラリ<173>-Footnote-146063685
Ref: ライブラリ<173>-Footnote-156063751
Ref: ライブラリ<173>-Footnote-166063817
Ref: ライブラリ<173>-Footnote-176063883
Ref: ライブラリ<173>-Footnote-186063949
Ref: ライブラリ<173>-Footnote-196063992
Ref: ライブラリ<173>-Footnote-206064058
Ref: ライブラリ<173>-Footnote-216064124
Ref: ライブラリ<173>-Footnote-226064190
Ref: ライブラリ<173>-Footnote-236064256
Ref: ライブラリ<173>-Footnote-246064322
Ref: ライブラリ<173>-Footnote-256064388
Ref: ライブラリ<173>-Footnote-266064454
Ref: ライブラリ<173>-Footnote-276064520
Ref: ライブラリ<173>-Footnote-286064586
Ref: ライブラリ<173>-Footnote-296064652
Ref: ライブラリ<173>-Footnote-306064718
Ref: ライブラリ<173>-Footnote-316064784
Ref: ライブラリ<173>-Footnote-326064850
Ref: ライブラリ<173>-Footnote-336064916
Ref: ライブラリ<173>-Footnote-346064982
Ref: ライブラリ<173>-Footnote-356065048
Ref: ライブラリ<173>-Footnote-366065114
Ref: ライブラリ<173>-Footnote-376065180
Ref: ライブラリ<173>-Footnote-386065246
Ref: ライブラリ<173>-Footnote-396065312
Ref: ライブラリ<173>-Footnote-406065378
Ref: ライブラリ<173>-Footnote-416065444
Ref: ライブラリ<173>-Footnote-426065510
Ref: ライブラリ<173>-Footnote-436065576
Ref: ライブラリ<173>-Footnote-446065642
Ref: ライブラリ<173>-Footnote-456065708
Ref: ライブラリ<173>-Footnote-466065774
Ref: ライブラリ<173>-Footnote-476065840
Node: ドキュメント<65>6065906
Ref: whatsnew/changelog id8386066035
Ref: 1ecc6066035
Ref: ドキュメント<65>-Footnote-16066580
Ref: ドキュメント<65>-Footnote-26066645
Ref: ドキュメント<65>-Footnote-36066710
Node: テスト<63>6066775
Ref: whatsnew/changelog id8396066897
Ref: 1ecd6066897
Ref: テスト<63>-Footnote-16067810
Ref: テスト<63>-Footnote-26067875
Ref: テスト<63>-Footnote-36067940
Ref: テスト<63>-Footnote-46068005
Ref: テスト<63>-Footnote-56068070
Ref: テスト<63>-Footnote-66068135
Node: ビルド<71>6068200
Ref: whatsnew/changelog id8406068311
Ref: 1ece6068311
Ref: ビルド<71>-Footnote-16068919
Ref: ビルド<71>-Footnote-26068984
Ref: ビルド<71>-Footnote-36069049
Ref: ビルド<71>-Footnote-46069114
Node: Windows<62>6069179
Ref: whatsnew/changelog id8416069286
Ref: 1ecf6069286
Ref: Windows<62>-Footnote-16069667
Ref: Windows<62>-Footnote-26069732
Ref: Windows<62>-Footnote-36069797
Node: macOS<50>6069862
Ref: whatsnew/changelog id8426069965
Ref: 1ed06069965
Ref: macOS<50>-Footnote-16070487
Ref: macOS<50>-Footnote-26070552
Node: C API<62>6070617
Ref: whatsnew/changelog id8436070700
Ref: 1ed16070700
Ref: C API<62>-Footnote-16071018
Ref: C API<62>-Footnote-26071083
Node: Python 3 7 0 alpha 46071148
Ref: whatsnew/changelog python-3-7-0-alpha-46071274
Ref: 1ed26071274
Node: Core and Builtins<170>6071607
Ref: whatsnew/changelog id8446071715
Ref: 1ed36071715
Ref: Core and Builtins<170>-Footnote-16075216
Ref: Core and Builtins<170>-Footnote-26075281
Ref: Core and Builtins<170>-Footnote-36075346
Ref: Core and Builtins<170>-Footnote-46075411
Ref: Core and Builtins<170>-Footnote-56075476
Ref: Core and Builtins<170>-Footnote-66075541
Ref: Core and Builtins<170>-Footnote-76075606
Ref: Core and Builtins<170>-Footnote-86075671
Ref: Core and Builtins<170>-Footnote-96075736
Ref: Core and Builtins<170>-Footnote-106075801
Ref: Core and Builtins<170>-Footnote-116075867
Ref: Core and Builtins<170>-Footnote-126075933
Ref: Core and Builtins<170>-Footnote-136075999
Ref: Core and Builtins<170>-Footnote-146076065
Ref: Core and Builtins<170>-Footnote-156076131
Ref: Core and Builtins<170>-Footnote-166076197
Ref: Core and Builtins<170>-Footnote-176076263
Ref: Core and Builtins<170>-Footnote-186076329
Ref: Core and Builtins<170>-Footnote-196076395
Ref: Core and Builtins<170>-Footnote-206076438
Ref: Core and Builtins<170>-Footnote-216076504
Ref: Core and Builtins<170>-Footnote-226076547
Ref: Core and Builtins<170>-Footnote-236076613
Ref: Core and Builtins<170>-Footnote-246076656
Ref: Core and Builtins<170>-Footnote-256076722
Ref: Core and Builtins<170>-Footnote-266076788
Ref: Core and Builtins<170>-Footnote-276076831
Node: ライブラリ<174>6076897
Ref: whatsnew/changelog id8456077036
Ref: 1ed56077036
Ref: ライブラリ<174>-Footnote-16085026
Ref: ライブラリ<174>-Footnote-26085091
Ref: ライブラリ<174>-Footnote-36085156
Ref: ライブラリ<174>-Footnote-46085221
Ref: ライブラリ<174>-Footnote-56085286
Ref: ライブラリ<174>-Footnote-66085351
Ref: ライブラリ<174>-Footnote-76085416
Ref: ライブラリ<174>-Footnote-86085481
Ref: ライブラリ<174>-Footnote-96085546
Ref: ライブラリ<174>-Footnote-106085611
Ref: ライブラリ<174>-Footnote-116085677
Ref: ライブラリ<174>-Footnote-126085743
Ref: ライブラリ<174>-Footnote-136085809
Ref: ライブラリ<174>-Footnote-146085875
Ref: ライブラリ<174>-Footnote-156085941
Ref: ライブラリ<174>-Footnote-166086007
Ref: ライブラリ<174>-Footnote-176086073
Ref: ライブラリ<174>-Footnote-186086139
Ref: ライブラリ<174>-Footnote-196086205
Ref: ライブラリ<174>-Footnote-206086271
Ref: ライブラリ<174>-Footnote-216086337
Ref: ライブラリ<174>-Footnote-226086403
Ref: ライブラリ<174>-Footnote-236086469
Ref: ライブラリ<174>-Footnote-246086535
Ref: ライブラリ<174>-Footnote-256086601
Ref: ライブラリ<174>-Footnote-266086667
Ref: ライブラリ<174>-Footnote-276086733
Ref: ライブラリ<174>-Footnote-286086799
Ref: ライブラリ<174>-Footnote-296086865
Ref: ライブラリ<174>-Footnote-306086931
Ref: ライブラリ<174>-Footnote-316086997
Ref: ライブラリ<174>-Footnote-326087063
Ref: ライブラリ<174>-Footnote-336087129
Ref: ライブラリ<174>-Footnote-346087195
Ref: ライブラリ<174>-Footnote-356087261
Ref: ライブラリ<174>-Footnote-366087327
Ref: ライブラリ<174>-Footnote-376087393
Ref: ライブラリ<174>-Footnote-386087459
Ref: ライブラリ<174>-Footnote-396087525
Ref: ライブラリ<174>-Footnote-406087591
Ref: ライブラリ<174>-Footnote-416087657
Ref: ライブラリ<174>-Footnote-426087723
Ref: ライブラリ<174>-Footnote-436087789
Ref: ライブラリ<174>-Footnote-446087855
Ref: ライブラリ<174>-Footnote-456087921
Ref: ライブラリ<174>-Footnote-466087987
Ref: ライブラリ<174>-Footnote-476088053
Ref: ライブラリ<174>-Footnote-486088119
Ref: ライブラリ<174>-Footnote-496088185
Ref: ライブラリ<174>-Footnote-506088251
Ref: ライブラリ<174>-Footnote-516088317
Ref: ライブラリ<174>-Footnote-526088383
Ref: ライブラリ<174>-Footnote-536088449
Ref: ライブラリ<174>-Footnote-546088515
Node: ドキュメント<66>6088581
Ref: whatsnew/changelog id8466088711
Ref: 1ed66088711
Ref: ドキュメント<66>-Footnote-16088885
Node: テスト<64>6088950
Ref: whatsnew/changelog id8476089071
Ref: 1ed76089071
Ref: テスト<64>-Footnote-16089471
Ref: テスト<64>-Footnote-26089536
Node: Windows<63>6089601
Ref: whatsnew/changelog id8486089715
Ref: 1ed86089715
Ref: Windows<63>-Footnote-16089914
Node: Tools/Demos<41>6089979
Ref: whatsnew/changelog id8496090089
Ref: 1ed96090089
Ref: Tools/Demos<41>-Footnote-16090371
Node: C API<63>6090436
Ref: whatsnew/changelog id8506090526
Ref: 1eda6090526
Ref: C API<63>-Footnote-16091168
Ref: C API<63>-Footnote-26091233
Ref: C API<63>-Footnote-36091298
Ref: C API<63>-Footnote-46091363
Node: Python 3 7 0 alpha 36091428
Ref: whatsnew/changelog python-3-7-0-alpha-36091555
Ref: 1edb6091555
Node: Core and Builtins<171>6091954
Ref: whatsnew/changelog id8516092062
Ref: 1edc6092062
Ref: Core and Builtins<171>-Footnote-16097183
Ref: Core and Builtins<171>-Footnote-26097248
Ref: Core and Builtins<171>-Footnote-36097313
Ref: Core and Builtins<171>-Footnote-46097378
Ref: Core and Builtins<171>-Footnote-56097443
Ref: Core and Builtins<171>-Footnote-66097508
Ref: Core and Builtins<171>-Footnote-76097573
Ref: Core and Builtins<171>-Footnote-86097638
Ref: Core and Builtins<171>-Footnote-96097703
Ref: Core and Builtins<171>-Footnote-106097768
Ref: Core and Builtins<171>-Footnote-116097834
Ref: Core and Builtins<171>-Footnote-126097900
Ref: Core and Builtins<171>-Footnote-136097966
Ref: Core and Builtins<171>-Footnote-146098032
Ref: Core and Builtins<171>-Footnote-156098098
Ref: Core and Builtins<171>-Footnote-166098164
Ref: Core and Builtins<171>-Footnote-176098230
Ref: Core and Builtins<171>-Footnote-186098296
Ref: Core and Builtins<171>-Footnote-196098362
Ref: Core and Builtins<171>-Footnote-206098428
Ref: Core and Builtins<171>-Footnote-216098494
Ref: Core and Builtins<171>-Footnote-226098560
Node: ライブラリ<175>6098626
Ref: whatsnew/changelog id8526098765
Ref: 1edd6098765
Ref: ライブラリ<175>-Footnote-16114786
Ref: ライブラリ<175>-Footnote-26114851
Ref: ライブラリ<175>-Footnote-36114916
Ref: ライブラリ<175>-Footnote-46114981
Ref: ライブラリ<175>-Footnote-56115046
Ref: ライブラリ<175>-Footnote-66115111
Ref: ライブラリ<175>-Footnote-76115176
Ref: ライブラリ<175>-Footnote-86115241
Ref: ライブラリ<175>-Footnote-96115306
Ref: ライブラリ<175>-Footnote-106115371
Ref: ライブラリ<175>-Footnote-116115437
Ref: ライブラリ<175>-Footnote-126115503
Ref: ライブラリ<175>-Footnote-136115569
Ref: ライブラリ<175>-Footnote-146115635
Ref: ライブラリ<175>-Footnote-156115701
Ref: ライブラリ<175>-Footnote-166115767
Ref: ライブラリ<175>-Footnote-176115833
Ref: ライブラリ<175>-Footnote-186115899
Ref: ライブラリ<175>-Footnote-196115965
Ref: ライブラリ<175>-Footnote-206116031
Ref: ライブラリ<175>-Footnote-216116097
Ref: ライブラリ<175>-Footnote-226116163
Ref: ライブラリ<175>-Footnote-236116229
Ref: ライブラリ<175>-Footnote-246116295
Ref: ライブラリ<175>-Footnote-256116361
Ref: ライブラリ<175>-Footnote-266116429
Ref: ライブラリ<175>-Footnote-276116495
Ref: ライブラリ<175>-Footnote-286116561
Ref: ライブラリ<175>-Footnote-296116627
Ref: ライブラリ<175>-Footnote-306116693
Ref: ライブラリ<175>-Footnote-316116759
Ref: ライブラリ<175>-Footnote-326116825
Ref: ライブラリ<175>-Footnote-336116868
Ref: ライブラリ<175>-Footnote-346116934
Ref: ライブラリ<175>-Footnote-356117000
Ref: ライブラリ<175>-Footnote-366117066
Ref: ライブラリ<175>-Footnote-376117132
Ref: ライブラリ<175>-Footnote-386117198
Ref: ライブラリ<175>-Footnote-396117264
Ref: ライブラリ<175>-Footnote-406117330
Ref: ライブラリ<175>-Footnote-416117396
Ref: ライブラリ<175>-Footnote-426117462
Ref: ライブラリ<175>-Footnote-436117528
Ref: ライブラリ<175>-Footnote-446117594
Ref: ライブラリ<175>-Footnote-456117660
Ref: ライブラリ<175>-Footnote-466117726
Ref: ライブラリ<175>-Footnote-476117791
Ref: ライブラリ<175>-Footnote-486117857
Ref: ライブラリ<175>-Footnote-496117923
Ref: ライブラリ<175>-Footnote-506117989
Ref: ライブラリ<175>-Footnote-516118055
Ref: ライブラリ<175>-Footnote-526118121
Ref: ライブラリ<175>-Footnote-536118187
Ref: ライブラリ<175>-Footnote-546118253
Ref: ライブラリ<175>-Footnote-556118319
Ref: ライブラリ<175>-Footnote-566118385
Ref: ライブラリ<175>-Footnote-576118451
Ref: ライブラリ<175>-Footnote-586118517
Ref: ライブラリ<175>-Footnote-596118583
Ref: ライブラリ<175>-Footnote-606118649
Ref: ライブラリ<175>-Footnote-616118715
Ref: ライブラリ<175>-Footnote-626118781
Ref: ライブラリ<175>-Footnote-636118824
Ref: ライブラリ<175>-Footnote-646118890
Ref: ライブラリ<175>-Footnote-656118956
Ref: ライブラリ<175>-Footnote-666119022
Ref: ライブラリ<175>-Footnote-676119088
Ref: ライブラリ<175>-Footnote-686119154
Ref: ライブラリ<175>-Footnote-696119220
Ref: ライブラリ<175>-Footnote-706119286
Ref: ライブラリ<175>-Footnote-716119352
Ref: ライブラリ<175>-Footnote-726119418
Ref: ライブラリ<175>-Footnote-736119484
Ref: ライブラリ<175>-Footnote-746119550
Ref: ライブラリ<175>-Footnote-756119616
Ref: ライブラリ<175>-Footnote-766119682
Ref: ライブラリ<175>-Footnote-776119748
Ref: ライブラリ<175>-Footnote-786119814
Ref: ライブラリ<175>-Footnote-796119880
Ref: ライブラリ<175>-Footnote-806119946
Ref: ライブラリ<175>-Footnote-816120012
Ref: ライブラリ<175>-Footnote-826120078
Ref: ライブラリ<175>-Footnote-836120121
Ref: ライブラリ<175>-Footnote-846120187
Ref: ライブラリ<175>-Footnote-856120253
Ref: ライブラリ<175>-Footnote-866120319
Ref: ライブラリ<175>-Footnote-876120385
Ref: ライブラリ<175>-Footnote-886120451
Ref: ライブラリ<175>-Footnote-896120517
Ref: ライブラリ<175>-Footnote-906120583
Ref: ライブラリ<175>-Footnote-916120649
Ref: ライブラリ<175>-Footnote-926120715
Ref: ライブラリ<175>-Footnote-936120781
Ref: ライブラリ<175>-Footnote-946120847
Ref: ライブラリ<175>-Footnote-956120913
Ref: ライブラリ<175>-Footnote-966120979
Ref: ライブラリ<175>-Footnote-976121045
Ref: ライブラリ<175>-Footnote-986121111
Node: ドキュメント<67>6121177
Ref: whatsnew/changelog id8536121307
Ref: 1ee26121307
Ref: ドキュメント<67>-Footnote-16121494
Node: テスト<65>6121559
Ref: whatsnew/changelog id8546121682
Ref: 1ee36121682
Ref: テスト<65>-Footnote-16122893
Ref: テスト<65>-Footnote-26122958
Ref: テスト<65>-Footnote-36123023
Ref: テスト<65>-Footnote-46123088
Ref: テスト<65>-Footnote-56123153
Ref: テスト<65>-Footnote-66123218
Ref: テスト<65>-Footnote-76123283
Node: ビルド<72>6123348
Ref: whatsnew/changelog id8556123460
Ref: 1ee46123460
Ref: ビルド<72>-Footnote-16124679
Ref: ビルド<72>-Footnote-26124744
Ref: ビルド<72>-Footnote-36124809
Ref: ビルド<72>-Footnote-46124874
Ref: ビルド<72>-Footnote-56124939
Ref: ビルド<72>-Footnote-66125004
Ref: ビルド<72>-Footnote-76125069
Ref: ビルド<72>-Footnote-86125134
Ref: ビルド<72>-Footnote-96125199
Ref: ビルド<72>-Footnote-106125264
Ref: ビルド<72>-Footnote-116125330
Ref: ビルド<72>-Footnote-126125396
Node: Windows<64>6125462
Ref: whatsnew/changelog id8566125570
Ref: 1ee56125570
Ref: Windows<64>-Footnote-16126103
Ref: Windows<64>-Footnote-26126167
Ref: Windows<64>-Footnote-36126232
Ref: Windows<64>-Footnote-46126297
Node: macOS<51>6126362
Ref: whatsnew/changelog id8576126465
Ref: 1ee66126465
Ref: macOS<51>-Footnote-16126599
Node: IDLE<44>6126664
Ref: whatsnew/changelog id8586126771
Ref: 1ee76126771
Ref: IDLE<44>-Footnote-16128852
Ref: IDLE<44>-Footnote-26128917
Ref: IDLE<44>-Footnote-36128982
Ref: IDLE<44>-Footnote-46129047
Ref: IDLE<44>-Footnote-56129112
Ref: IDLE<44>-Footnote-66129177
Ref: IDLE<44>-Footnote-76129242
Ref: IDLE<44>-Footnote-86129307
Node: Tools/Demos<42>6129372
Ref: whatsnew/changelog id8596129479
Ref: 1ee86129479
Ref: Tools/Demos<42>-Footnote-16130009
Ref: Tools/Demos<42>-Footnote-26130074
Node: C API<64>6130139
Ref: whatsnew/changelog id8606130229
Ref: 1ee96130229
Ref: C API<64>-Footnote-16131355
Ref: C API<64>-Footnote-26131420
Ref: C API<64>-Footnote-36131485
Ref: C API<64>-Footnote-46131550
Ref: C API<64>-Footnote-56131615
Ref: C API<64>-Footnote-66131680
Node: Python 3 7 0 alpha 26131745
Ref: whatsnew/changelog python-3-7-0-alpha-26131872
Ref: 1eea6131872
Node: Core and Builtins<172>6132167
Ref: whatsnew/changelog id8616132275
Ref: 1eeb6132275
Ref: Core and Builtins<172>-Footnote-16136456
Ref: Core and Builtins<172>-Footnote-26136521
Ref: Core and Builtins<172>-Footnote-36136586
Ref: Core and Builtins<172>-Footnote-46136651
Ref: Core and Builtins<172>-Footnote-56136716
Ref: Core and Builtins<172>-Footnote-66136781
Ref: Core and Builtins<172>-Footnote-76136846
Ref: Core and Builtins<172>-Footnote-86136911
Ref: Core and Builtins<172>-Footnote-96136976
Ref: Core and Builtins<172>-Footnote-106137041
Ref: Core and Builtins<172>-Footnote-116137107
Ref: Core and Builtins<172>-Footnote-126137173
Ref: Core and Builtins<172>-Footnote-136137239
Ref: Core and Builtins<172>-Footnote-146137305
Ref: Core and Builtins<172>-Footnote-156137371
Ref: Core and Builtins<172>-Footnote-166137437
Ref: Core and Builtins<172>-Footnote-176137503
Ref: Core and Builtins<172>-Footnote-186137569
Ref: Core and Builtins<172>-Footnote-196137635
Ref: Core and Builtins<172>-Footnote-206137701
Ref: Core and Builtins<172>-Footnote-216137744
Ref: Core and Builtins<172>-Footnote-226137810
Ref: Core and Builtins<172>-Footnote-236137876
Ref: Core and Builtins<172>-Footnote-246137942
Ref: Core and Builtins<172>-Footnote-256138008
Ref: Core and Builtins<172>-Footnote-266138074
Ref: Core and Builtins<172>-Footnote-276138140
Node: ライブラリ<176>6138183
Ref: whatsnew/changelog id8626138322
Ref: 1eec6138322
Ref: ライブラリ<176>-Footnote-16142361
Ref: ライブラリ<176>-Footnote-26142426
Ref: ライブラリ<176>-Footnote-36142491
Ref: ライブラリ<176>-Footnote-46142556
Ref: ライブラリ<176>-Footnote-56142621
Ref: ライブラリ<176>-Footnote-66142686
Ref: ライブラリ<176>-Footnote-76142751
Ref: ライブラリ<176>-Footnote-86142816
Ref: ライブラリ<176>-Footnote-96142881
Ref: ライブラリ<176>-Footnote-106142946
Ref: ライブラリ<176>-Footnote-116143012
Ref: ライブラリ<176>-Footnote-126143078
Ref: ライブラリ<176>-Footnote-136143144
Ref: ライブラリ<176>-Footnote-146143210
Ref: ライブラリ<176>-Footnote-156143276
Ref: ライブラリ<176>-Footnote-166143342
Ref: ライブラリ<176>-Footnote-176143408
Ref: ライブラリ<176>-Footnote-186143474
Ref: ライブラリ<176>-Footnote-196143540
Ref: ライブラリ<176>-Footnote-206143606
Ref: ライブラリ<176>-Footnote-216143672
Ref: ライブラリ<176>-Footnote-226143738
Ref: ライブラリ<176>-Footnote-236143804
Ref: ライブラリ<176>-Footnote-246143870
Ref: ライブラリ<176>-Footnote-256143936
Ref: ライブラリ<176>-Footnote-266144002
Node: ドキュメント<68>6144068
Ref: whatsnew/changelog id8636144198
Ref: 1eed6144198
Ref: ドキュメント<68>-Footnote-16144593
Ref: ドキュメント<68>-Footnote-26144658
Node: ビルド<73>6144723
Ref: whatsnew/changelog id8646144841
Ref: 1eee6144841
Ref: ビルド<73>-Footnote-16145469
Ref: ビルド<73>-Footnote-26145534
Ref: ビルド<73>-Footnote-36145599
Ref: ビルド<73>-Footnote-46145664
Ref: ビルド<73>-Footnote-56145729
Ref: ビルド<73>-Footnote-66145794
Node: IDLE<45>6145859
Ref: whatsnew/changelog id8656145964
Ref: 1eef6145964
Ref: IDLE<45>-Footnote-16147266
Ref: IDLE<45>-Footnote-26147331
Ref: IDLE<45>-Footnote-36147396
Ref: IDLE<45>-Footnote-46147461
Ref: IDLE<45>-Footnote-56147526
Ref: IDLE<45>-Footnote-66147591
Node: C API<65>6147658
Ref: whatsnew/changelog id8666147741
Ref: 1ef06147741
Ref: C API<65>-Footnote-16148465
Ref: C API<65>-Footnote-26148530
Ref: C API<65>-Footnote-36148595
Ref: C API<65>-Footnote-46148660
Node: Python 3 7 0 alpha 16148702
Ref: whatsnew/changelog python-3-7-0-alpha-16148827
Ref: 1ef16148827
Node: セキュリティ<54>6149252
Ref: whatsnew/changelog id8676149362
Ref: 1ef26149362
Ref: セキュリティ<54>-Footnote-16151026
Ref: セキュリティ<54>-Footnote-26151091
Ref: セキュリティ<54>-Footnote-36151156
Ref: セキュリティ<54>-Footnote-46151221
Ref: セキュリティ<54>-Footnote-56151286
Ref: セキュリティ<54>-Footnote-66151351
Ref: セキュリティ<54>-Footnote-76151406
Ref: セキュリティ<54>-Footnote-86151461
Ref: セキュリティ<54>-Footnote-96151516
Ref: セキュリティ<54>-Footnote-106151571
Ref: セキュリティ<54>-Footnote-116151627
Ref: セキュリティ<54>-Footnote-126151683
Ref: セキュリティ<54>-Footnote-136151749
Ref: セキュリティ<54>-Footnote-146151815
Ref: セキュリティ<54>-Footnote-156151871
Node: Core and Builtins<173>6151927
Ref: whatsnew/changelog id8686152066
Ref: 1ef36152066
Ref: Core and Builtins<173>-Footnote-16172880
Ref: Core and Builtins<173>-Footnote-26172945
Ref: Core and Builtins<173>-Footnote-36173010
Ref: Core and Builtins<173>-Footnote-46173075
Ref: Core and Builtins<173>-Footnote-56173140
Ref: Core and Builtins<173>-Footnote-66173205
Ref: Core and Builtins<173>-Footnote-76173270
Ref: Core and Builtins<173>-Footnote-86173335
Ref: Core and Builtins<173>-Footnote-96173400
Ref: Core and Builtins<173>-Footnote-106173465
Ref: Core and Builtins<173>-Footnote-116173531
Ref: Core and Builtins<173>-Footnote-126173597
Ref: Core and Builtins<173>-Footnote-136173663
Ref: Core and Builtins<173>-Footnote-146173729
Ref: Core and Builtins<173>-Footnote-156173795
Ref: Core and Builtins<173>-Footnote-166173861
Ref: Core and Builtins<173>-Footnote-176173927
Ref: Core and Builtins<173>-Footnote-186173993
Ref: Core and Builtins<173>-Footnote-196174059
Ref: Core and Builtins<173>-Footnote-206174125
Ref: Core and Builtins<173>-Footnote-216174191
Ref: Core and Builtins<173>-Footnote-226174257
Ref: Core and Builtins<173>-Footnote-236174323
Ref: Core and Builtins<173>-Footnote-246174389
Ref: Core and Builtins<173>-Footnote-256174455
Ref: Core and Builtins<173>-Footnote-266174521
Ref: Core and Builtins<173>-Footnote-276174587
Ref: Core and Builtins<173>-Footnote-286174653
Ref: Core and Builtins<173>-Footnote-296174719
Ref: Core and Builtins<173>-Footnote-306174785
Ref: Core and Builtins<173>-Footnote-316174851
Ref: Core and Builtins<173>-Footnote-326174917
Ref: Core and Builtins<173>-Footnote-336174983
Ref: Core and Builtins<173>-Footnote-346175049
Ref: Core and Builtins<173>-Footnote-356175115
Ref: Core and Builtins<173>-Footnote-366175158
Ref: Core and Builtins<173>-Footnote-376175224
Ref: Core and Builtins<173>-Footnote-386175290
Ref: Core and Builtins<173>-Footnote-396175356
Ref: Core and Builtins<173>-Footnote-406175422
Ref: Core and Builtins<173>-Footnote-416175488
Ref: Core and Builtins<173>-Footnote-426175554
Ref: Core and Builtins<173>-Footnote-436175620
Ref: Core and Builtins<173>-Footnote-446175686
Ref: Core and Builtins<173>-Footnote-456175752
Ref: Core and Builtins<173>-Footnote-466175818
Ref: Core and Builtins<173>-Footnote-476175884
Ref: Core and Builtins<173>-Footnote-486175950
Ref: Core and Builtins<173>-Footnote-496176016
Ref: Core and Builtins<173>-Footnote-506176082
Ref: Core and Builtins<173>-Footnote-516176148
Ref: Core and Builtins<173>-Footnote-526176214
Ref: Core and Builtins<173>-Footnote-536176280
Ref: Core and Builtins<173>-Footnote-546176346
Ref: Core and Builtins<173>-Footnote-556176412
Ref: Core and Builtins<173>-Footnote-566176478
Ref: Core and Builtins<173>-Footnote-576176544
Ref: Core and Builtins<173>-Footnote-586176610
Ref: Core and Builtins<173>-Footnote-596176676
Ref: Core and Builtins<173>-Footnote-606176742
Ref: Core and Builtins<173>-Footnote-616176808
Ref: Core and Builtins<173>-Footnote-626176874
Ref: Core and Builtins<173>-Footnote-636176940
Ref: Core and Builtins<173>-Footnote-646177006
Ref: Core and Builtins<173>-Footnote-656177072
Ref: Core and Builtins<173>-Footnote-666177138
Ref: Core and Builtins<173>-Footnote-676177204
Ref: Core and Builtins<173>-Footnote-686177270
Ref: Core and Builtins<173>-Footnote-696177336
Ref: Core and Builtins<173>-Footnote-706177402
Ref: Core and Builtins<173>-Footnote-716177468
Ref: Core and Builtins<173>-Footnote-726177534
Ref: Core and Builtins<173>-Footnote-736177600
Ref: Core and Builtins<173>-Footnote-746177666
Ref: Core and Builtins<173>-Footnote-756177732
Ref: Core and Builtins<173>-Footnote-766177798
Ref: Core and Builtins<173>-Footnote-776177864
Ref: Core and Builtins<173>-Footnote-786177930
Ref: Core and Builtins<173>-Footnote-796177996
Ref: Core and Builtins<173>-Footnote-806178062
Ref: Core and Builtins<173>-Footnote-816178128
Ref: Core and Builtins<173>-Footnote-826178194
Ref: Core and Builtins<173>-Footnote-836178260
Ref: Core and Builtins<173>-Footnote-846178326
Ref: Core and Builtins<173>-Footnote-856178392
Ref: Core and Builtins<173>-Footnote-866178458
Ref: Core and Builtins<173>-Footnote-876178524
Ref: Core and Builtins<173>-Footnote-886178590
Ref: Core and Builtins<173>-Footnote-896178656
Ref: Core and Builtins<173>-Footnote-906178722
Ref: Core and Builtins<173>-Footnote-916178765
Ref: Core and Builtins<173>-Footnote-926178831
Ref: Core and Builtins<173>-Footnote-936178897
Ref: Core and Builtins<173>-Footnote-946178963
Ref: Core and Builtins<173>-Footnote-956179029
Ref: Core and Builtins<173>-Footnote-966179095
Ref: Core and Builtins<173>-Footnote-976179161
Ref: Core and Builtins<173>-Footnote-986179227
Ref: Core and Builtins<173>-Footnote-996179293
Ref: Core and Builtins<173>-Footnote-1006179359
Ref: Core and Builtins<173>-Footnote-1016179426
Ref: Core and Builtins<173>-Footnote-1026179493
Ref: Core and Builtins<173>-Footnote-1036179560
Ref: Core and Builtins<173>-Footnote-1046179627
Ref: Core and Builtins<173>-Footnote-1056179694
Ref: Core and Builtins<173>-Footnote-1066179761
Ref: Core and Builtins<173>-Footnote-1076179828
Ref: Core and Builtins<173>-Footnote-1086179895
Ref: Core and Builtins<173>-Footnote-1096179962
Ref: Core and Builtins<173>-Footnote-1106180029
Ref: Core and Builtins<173>-Footnote-1116180096
Ref: Core and Builtins<173>-Footnote-1126180163
Ref: Core and Builtins<173>-Footnote-1136180230
Ref: Core and Builtins<173>-Footnote-1146180297
Ref: Core and Builtins<173>-Footnote-1156180364
Ref: Core and Builtins<173>-Footnote-1166180431
Ref: Core and Builtins<173>-Footnote-1176180498
Ref: Core and Builtins<173>-Footnote-1186180565
Ref: Core and Builtins<173>-Footnote-1196180632
Ref: Core and Builtins<173>-Footnote-1206180699
Ref: Core and Builtins<173>-Footnote-1216180766
Ref: Core and Builtins<173>-Footnote-1226180833
Ref: Core and Builtins<173>-Footnote-1236180900
Ref: Core and Builtins<173>-Footnote-1246180967
Ref: Core and Builtins<173>-Footnote-1256181034
Ref: Core and Builtins<173>-Footnote-1266181101
Ref: Core and Builtins<173>-Footnote-1276181168
Ref: Core and Builtins<173>-Footnote-1286181235
Ref: Core and Builtins<173>-Footnote-1296181302
Ref: Core and Builtins<173>-Footnote-1306181369
Ref: Core and Builtins<173>-Footnote-1316181436
Ref: Core and Builtins<173>-Footnote-1326181503
Ref: Core and Builtins<173>-Footnote-1336181570
Ref: Core and Builtins<173>-Footnote-1346181637
Ref: Core and Builtins<173>-Footnote-1356181704
Ref: Core and Builtins<173>-Footnote-1366181771
Ref: Core and Builtins<173>-Footnote-1376181838
Ref: Core and Builtins<173>-Footnote-1386181905
Ref: Core and Builtins<173>-Footnote-1396181972
Ref: Core and Builtins<173>-Footnote-1406182039
Ref: Core and Builtins<173>-Footnote-1416182106
Ref: Core and Builtins<173>-Footnote-1426182173
Ref: Core and Builtins<173>-Footnote-1436182240
Ref: Core and Builtins<173>-Footnote-1446182307
Ref: Core and Builtins<173>-Footnote-1456182374
Ref: Core and Builtins<173>-Footnote-1466182441
Ref: Core and Builtins<173>-Footnote-1476182508
Ref: Core and Builtins<173>-Footnote-1486182575
Node: ライブラリ<177>6182642
Ref: whatsnew/changelog id8696182781
Ref: 1ef46182781
Ref: ライブラリ<177>-Footnote-16229290
Ref: ライブラリ<177>-Footnote-26229355
Ref: ライブラリ<177>-Footnote-36229420
Ref: ライブラリ<177>-Footnote-46229485
Ref: ライブラリ<177>-Footnote-56229550
Ref: ライブラリ<177>-Footnote-66229615
Ref: ライブラリ<177>-Footnote-76229680
Ref: ライブラリ<177>-Footnote-86229745
Ref: ライブラリ<177>-Footnote-96229810
Ref: ライブラリ<177>-Footnote-106229875
Ref: ライブラリ<177>-Footnote-116229941
Ref: ライブラリ<177>-Footnote-126230007
Ref: ライブラリ<177>-Footnote-136230073
Ref: ライブラリ<177>-Footnote-146230139
Ref: ライブラリ<177>-Footnote-156230205
Ref: ライブラリ<177>-Footnote-166230271
Ref: ライブラリ<177>-Footnote-176230337
Ref: ライブラリ<177>-Footnote-186230403
Ref: ライブラリ<177>-Footnote-196230469
Ref: ライブラリ<177>-Footnote-206230535
Ref: ライブラリ<177>-Footnote-216230601
Ref: ライブラリ<177>-Footnote-226230669
Ref: ライブラリ<177>-Footnote-236230735
Ref: ライブラリ<177>-Footnote-246230801
Ref: ライブラリ<177>-Footnote-256230867
Ref: ライブラリ<177>-Footnote-266230933
Ref: ライブラリ<177>-Footnote-276230976
Ref: ライブラリ<177>-Footnote-286231042
Ref: ライブラリ<177>-Footnote-296231108
Ref: ライブラリ<177>-Footnote-306231174
Ref: ライブラリ<177>-Footnote-316231240
Ref: ライブラリ<177>-Footnote-326231306
Ref: ライブラリ<177>-Footnote-336231372
Ref: ライブラリ<177>-Footnote-346231438
Ref: ライブラリ<177>-Footnote-356231503
Ref: ライブラリ<177>-Footnote-366231569
Ref: ライブラリ<177>-Footnote-376231635
Ref: ライブラリ<177>-Footnote-386231701
Ref: ライブラリ<177>-Footnote-396231767
Ref: ライブラリ<177>-Footnote-406231832
Ref: ライブラリ<177>-Footnote-416231898
Ref: ライブラリ<177>-Footnote-426231964
Ref: ライブラリ<177>-Footnote-436232030
Ref: ライブラリ<177>-Footnote-446232096
Ref: ライブラリ<177>-Footnote-456232162
Ref: ライブラリ<177>-Footnote-466232228
Ref: ライブラリ<177>-Footnote-476232294
Ref: ライブラリ<177>-Footnote-486232360
Ref: ライブラリ<177>-Footnote-496232426
Ref: ライブラリ<177>-Footnote-506232492
Ref: ライブラリ<177>-Footnote-516232558
Ref: ライブラリ<177>-Footnote-526232624
Ref: ライブラリ<177>-Footnote-536232689
Ref: ライブラリ<177>-Footnote-546232755
Ref: ライブラリ<177>-Footnote-556232821
Ref: ライブラリ<177>-Footnote-566232887
Ref: ライブラリ<177>-Footnote-576232953
Ref: ライブラリ<177>-Footnote-586233019
Ref: ライブラリ<177>-Footnote-596233085
Ref: ライブラリ<177>-Footnote-606233151
Ref: ライブラリ<177>-Footnote-616233217
Ref: ライブラリ<177>-Footnote-626233283
Ref: ライブラリ<177>-Footnote-636233349
Ref: ライブラリ<177>-Footnote-646233415
Ref: ライブラリ<177>-Footnote-656233481
Ref: ライブラリ<177>-Footnote-666233547
Ref: ライブラリ<177>-Footnote-676233613
Ref: ライブラリ<177>-Footnote-686233679
Ref: ライブラリ<177>-Footnote-696233745
Ref: ライブラリ<177>-Footnote-706233811
Ref: ライブラリ<177>-Footnote-716233877
Ref: ライブラリ<177>-Footnote-726233943
Ref: ライブラリ<177>-Footnote-736234008
Ref: ライブラリ<177>-Footnote-746234074
Ref: ライブラリ<177>-Footnote-756234140
Ref: ライブラリ<177>-Footnote-766234206
Ref: ライブラリ<177>-Footnote-776234272
Ref: ライブラリ<177>-Footnote-786234338
Ref: ライブラリ<177>-Footnote-796234404
Ref: ライブラリ<177>-Footnote-806234470
Ref: ライブラリ<177>-Footnote-816234536
Ref: ライブラリ<177>-Footnote-826234602
Ref: ライブラリ<177>-Footnote-836234668
Ref: ライブラリ<177>-Footnote-846234734
Ref: ライブラリ<177>-Footnote-856234800
Ref: ライブラリ<177>-Footnote-866234866
Ref: ライブラリ<177>-Footnote-876234932
Ref: ライブラリ<177>-Footnote-886234998
Ref: ライブラリ<177>-Footnote-896235064
Ref: ライブラリ<177>-Footnote-906235130
Ref: ライブラリ<177>-Footnote-916235196
Ref: ライブラリ<177>-Footnote-926235262
Ref: ライブラリ<177>-Footnote-936235328
Ref: ライブラリ<177>-Footnote-946235394
Ref: ライブラリ<177>-Footnote-956235460
Ref: ライブラリ<177>-Footnote-966235526
Ref: ライブラリ<177>-Footnote-976235592
Ref: ライブラリ<177>-Footnote-986235658
Ref: ライブラリ<177>-Footnote-996235724
Ref: ライブラリ<177>-Footnote-1006235790
Ref: ライブラリ<177>-Footnote-1016235857
Ref: ライブラリ<177>-Footnote-1026235924
Ref: ライブラリ<177>-Footnote-1036235991
Ref: ライブラリ<177>-Footnote-1046236058
Ref: ライブラリ<177>-Footnote-1056236125
Ref: ライブラリ<177>-Footnote-1066236192
Ref: ライブラリ<177>-Footnote-1076236259
Ref: ライブラリ<177>-Footnote-1086236326
Ref: ライブラリ<177>-Footnote-1096236393
Ref: ライブラリ<177>-Footnote-1106236460
Ref: ライブラリ<177>-Footnote-1116236527
Ref: ライブラリ<177>-Footnote-1126236594
Ref: ライブラリ<177>-Footnote-1136236661
Ref: ライブラリ<177>-Footnote-1146236728
Ref: ライブラリ<177>-Footnote-1156236795
Ref: ライブラリ<177>-Footnote-1166236862
Ref: ライブラリ<177>-Footnote-1176236928
Ref: ライブラリ<177>-Footnote-1186236995
Ref: ライブラリ<177>-Footnote-1196237062
Ref: ライブラリ<177>-Footnote-1206237129
Ref: ライブラリ<177>-Footnote-1216237196
Ref: ライブラリ<177>-Footnote-1226237263
Ref: ライブラリ<177>-Footnote-1236237330
Ref: ライブラリ<177>-Footnote-1246237397
Ref: ライブラリ<177>-Footnote-1256237464
Ref: ライブラリ<177>-Footnote-1266237531
Ref: ライブラリ<177>-Footnote-1276237598
Ref: ライブラリ<177>-Footnote-1286237665
Ref: ライブラリ<177>-Footnote-1296237732
Ref: ライブラリ<177>-Footnote-1306237799
Ref: ライブラリ<177>-Footnote-1316237866
Ref: ライブラリ<177>-Footnote-1326237933
Ref: ライブラリ<177>-Footnote-1336238000
Ref: ライブラリ<177>-Footnote-1346238067
Ref: ライブラリ<177>-Footnote-1356238134
Ref: ライブラリ<177>-Footnote-1366238201
Ref: ライブラリ<177>-Footnote-1376238268
Ref: ライブラリ<177>-Footnote-1386238335
Ref: ライブラリ<177>-Footnote-1396238402
Ref: ライブラリ<177>-Footnote-1406238469
Ref: ライブラリ<177>-Footnote-1416238536
Ref: ライブラリ<177>-Footnote-1426238603
Ref: ライブラリ<177>-Footnote-1436238670
Ref: ライブラリ<177>-Footnote-1446238737
Ref: ライブラリ<177>-Footnote-1456238804
Ref: ライブラリ<177>-Footnote-1466238871
Ref: ライブラリ<177>-Footnote-1476238937
Ref: ライブラリ<177>-Footnote-1486239004
Ref: ライブラリ<177>-Footnote-1496239071
Ref: ライブラリ<177>-Footnote-1506239138
Ref: ライブラリ<177>-Footnote-1516239205
Ref: ライブラリ<177>-Footnote-1526239272
Ref: ライブラリ<177>-Footnote-1536239339
Ref: ライブラリ<177>-Footnote-1546239406
Ref: ライブラリ<177>-Footnote-1556239473
Ref: ライブラリ<177>-Footnote-1566239540
Ref: ライブラリ<177>-Footnote-1576239607
Ref: ライブラリ<177>-Footnote-1586239674
Ref: ライブラリ<177>-Footnote-1596239741
Ref: ライブラリ<177>-Footnote-1606239808
Ref: ライブラリ<177>-Footnote-1616239875
Ref: ライブラリ<177>-Footnote-1626239942
Ref: ライブラリ<177>-Footnote-1636240009
Ref: ライブラリ<177>-Footnote-1646240076
Ref: ライブラリ<177>-Footnote-1656240143
Ref: ライブラリ<177>-Footnote-1666240210
Ref: ライブラリ<177>-Footnote-1676240277
Ref: ライブラリ<177>-Footnote-1686240344
Ref: ライブラリ<177>-Footnote-1696240411
Ref: ライブラリ<177>-Footnote-1706240477
Ref: ライブラリ<177>-Footnote-1716240544
Ref: ライブラリ<177>-Footnote-1726240611
Ref: ライブラリ<177>-Footnote-1736240678
Ref: ライブラリ<177>-Footnote-1746240745
Ref: ライブラリ<177>-Footnote-1756240812
Ref: ライブラリ<177>-Footnote-1766240879
Ref: ライブラリ<177>-Footnote-1776240946
Ref: ライブラリ<177>-Footnote-1786241013
Ref: ライブラリ<177>-Footnote-1796241080
Ref: ライブラリ<177>-Footnote-1806241147
Ref: ライブラリ<177>-Footnote-1816241213
Ref: ライブラリ<177>-Footnote-1826241280
Ref: ライブラリ<177>-Footnote-1836241347
Ref: ライブラリ<177>-Footnote-1846241414
Ref: ライブラリ<177>-Footnote-1856241481
Ref: ライブラリ<177>-Footnote-1866241548
Ref: ライブラリ<177>-Footnote-1876241614
Ref: ライブラリ<177>-Footnote-1886241681
Ref: ライブラリ<177>-Footnote-1896241748
Ref: ライブラリ<177>-Footnote-1906241815
Ref: ライブラリ<177>-Footnote-1916241882
Ref: ライブラリ<177>-Footnote-1926241949
Ref: ライブラリ<177>-Footnote-1936242016
Ref: ライブラリ<177>-Footnote-1946242083
Ref: ライブラリ<177>-Footnote-1956242150
Ref: ライブラリ<177>-Footnote-1966242217
Ref: ライブラリ<177>-Footnote-1976242284
Ref: ライブラリ<177>-Footnote-1986242351
Ref: ライブラリ<177>-Footnote-1996242418
Ref: ライブラリ<177>-Footnote-2006242485
Ref: ライブラリ<177>-Footnote-2016242552
Ref: ライブラリ<177>-Footnote-2026242619
Ref: ライブラリ<177>-Footnote-2036242686
Ref: ライブラリ<177>-Footnote-2046242753
Ref: ライブラリ<177>-Footnote-2056242820
Ref: ライブラリ<177>-Footnote-2066242887
Ref: ライブラリ<177>-Footnote-2076242954
Ref: ライブラリ<177>-Footnote-2086243021
Ref: ライブラリ<177>-Footnote-2096243088
Ref: ライブラリ<177>-Footnote-2106243155
Ref: ライブラリ<177>-Footnote-2116243222
Ref: ライブラリ<177>-Footnote-2126243289
Ref: ライブラリ<177>-Footnote-2136243356
Ref: ライブラリ<177>-Footnote-2146243423
Ref: ライブラリ<177>-Footnote-2156243490
Ref: ライブラリ<177>-Footnote-2166243557
Ref: ライブラリ<177>-Footnote-2176243624
Ref: ライブラリ<177>-Footnote-2186243691
Ref: ライブラリ<177>-Footnote-2196243758
Ref: ライブラリ<177>-Footnote-2206243825
Ref: ライブラリ<177>-Footnote-2216243892
Ref: ライブラリ<177>-Footnote-2226243959
Ref: ライブラリ<177>-Footnote-2236244026
Ref: ライブラリ<177>-Footnote-2246244093
Ref: ライブラリ<177>-Footnote-2256244159
Ref: ライブラリ<177>-Footnote-2266244226
Ref: ライブラリ<177>-Footnote-2276244293
Ref: ライブラリ<177>-Footnote-2286244360
Ref: ライブラリ<177>-Footnote-2296244427
Ref: ライブラリ<177>-Footnote-2306244494
Ref: ライブラリ<177>-Footnote-2316244561
Ref: ライブラリ<177>-Footnote-2326244628
Ref: ライブラリ<177>-Footnote-2336244695
Ref: ライブラリ<177>-Footnote-2346244762
Ref: ライブラリ<177>-Footnote-2356244829
Ref: ライブラリ<177>-Footnote-2366244896
Ref: ライブラリ<177>-Footnote-2376244963
Ref: ライブラリ<177>-Footnote-2386245030
Ref: ライブラリ<177>-Footnote-2396245097
Ref: ライブラリ<177>-Footnote-2406245164
Ref: ライブラリ<177>-Footnote-2416245231
Ref: ライブラリ<177>-Footnote-2426245298
Ref: ライブラリ<177>-Footnote-2436245365
Ref: ライブラリ<177>-Footnote-2446245432
Ref: ライブラリ<177>-Footnote-2456245499
Ref: ライブラリ<177>-Footnote-2466245566
Ref: ライブラリ<177>-Footnote-2476245633
Ref: ライブラリ<177>-Footnote-2486245700
Ref: ライブラリ<177>-Footnote-2496245767
Ref: ライブラリ<177>-Footnote-2506245834
Ref: ライブラリ<177>-Footnote-2516245901
Ref: ライブラリ<177>-Footnote-2526245968
Ref: ライブラリ<177>-Footnote-2536246035
Ref: ライブラリ<177>-Footnote-2546246102
Ref: ライブラリ<177>-Footnote-2556246169
Ref: ライブラリ<177>-Footnote-2566246236
Ref: ライブラリ<177>-Footnote-2576246303
Ref: ライブラリ<177>-Footnote-2586246370
Ref: ライブラリ<177>-Footnote-2596246437
Ref: ライブラリ<177>-Footnote-2606246504
Ref: ライブラリ<177>-Footnote-2616246571
Ref: ライブラリ<177>-Footnote-2626246638
Ref: ライブラリ<177>-Footnote-2636246705
Ref: ライブラリ<177>-Footnote-2646246772
Ref: ライブラリ<177>-Footnote-2656246839
Ref: ライブラリ<177>-Footnote-2666246906
Ref: ライブラリ<177>-Footnote-2676246973
Ref: ライブラリ<177>-Footnote-2686247040
Ref: ライブラリ<177>-Footnote-2696247107
Ref: ライブラリ<177>-Footnote-2706247174
Ref: ライブラリ<177>-Footnote-2716247241
Ref: ライブラリ<177>-Footnote-2726247308
Ref: ライブラリ<177>-Footnote-2736247364
Ref: ライブラリ<177>-Footnote-2746247431
Ref: ライブラリ<177>-Footnote-2756247498
Ref: ライブラリ<177>-Footnote-2766247565
Ref: ライブラリ<177>-Footnote-2776247632
Ref: ライブラリ<177>-Footnote-2786247699
Ref: ライブラリ<177>-Footnote-2796247766
Ref: ライブラリ<177>-Footnote-2806247833
Ref: ライブラリ<177>-Footnote-2816247900
Ref: ライブラリ<177>-Footnote-2826247967
Ref: ライブラリ<177>-Footnote-2836248034
Ref: ライブラリ<177>-Footnote-2846248101
Ref: ライブラリ<177>-Footnote-2856248168
Ref: ライブラリ<177>-Footnote-2866248235
Ref: ライブラリ<177>-Footnote-2876248302
Ref: ライブラリ<177>-Footnote-2886248369
Ref: ライブラリ<177>-Footnote-2896248436
Ref: ライブラリ<177>-Footnote-2906248503
Ref: ライブラリ<177>-Footnote-2916248570
Ref: ライブラリ<177>-Footnote-2926248637
Ref: ライブラリ<177>-Footnote-2936248704
Ref: ライブラリ<177>-Footnote-2946248771
Ref: ライブラリ<177>-Footnote-2956248838
Ref: ライブラリ<177>-Footnote-2966248905
Ref: ライブラリ<177>-Footnote-2976248972
Ref: ライブラリ<177>-Footnote-2986249039
Ref: ライブラリ<177>-Footnote-2996249106
Ref: ライブラリ<177>-Footnote-3006249173
Ref: ライブラリ<177>-Footnote-3016249240
Ref: ライブラリ<177>-Footnote-3026249307
Ref: ライブラリ<177>-Footnote-3036249374
Ref: ライブラリ<177>-Footnote-3046249441
Ref: ライブラリ<177>-Footnote-3056249508
Ref: ライブラリ<177>-Footnote-3066249575
Ref: ライブラリ<177>-Footnote-3076249642
Ref: ライブラリ<177>-Footnote-3086249709
Ref: ライブラリ<177>-Footnote-3096249776
Ref: ライブラリ<177>-Footnote-3106249843
Ref: ライブラリ<177>-Footnote-3116249910
Ref: ライブラリ<177>-Footnote-3126249977
Ref: ライブラリ<177>-Footnote-3136250044
Ref: ライブラリ<177>-Footnote-3146250111
Ref: ライブラリ<177>-Footnote-3156250178
Ref: ライブラリ<177>-Footnote-3166250245
Ref: ライブラリ<177>-Footnote-3176250312
Ref: ライブラリ<177>-Footnote-3186250379
Ref: ライブラリ<177>-Footnote-3196250446
Ref: ライブラリ<177>-Footnote-3206250513
Ref: ライブラリ<177>-Footnote-3216250580
Ref: ライブラリ<177>-Footnote-3226250647
Ref: ライブラリ<177>-Footnote-3236250714
Ref: ライブラリ<177>-Footnote-3246250781
Ref: ライブラリ<177>-Footnote-3256250848
Ref: ライブラリ<177>-Footnote-3266250915
Node: ドキュメント<69>6250982
Ref: whatsnew/changelog id8706251112
Ref: 1ef56251112
Ref: ドキュメント<69>-Footnote-16253280
Ref: ドキュメント<69>-Footnote-26253345
Ref: ドキュメント<69>-Footnote-36253410
Ref: ドキュメント<69>-Footnote-46253475
Ref: ドキュメント<69>-Footnote-56253540
Ref: ドキュメント<69>-Footnote-66253605
Ref: ドキュメント<69>-Footnote-76253670
Ref: ドキュメント<69>-Footnote-86253735
Ref: ドキュメント<69>-Footnote-96253800
Ref: ドキュメント<69>-Footnote-106253865
Ref: ドキュメント<69>-Footnote-116253931
Ref: ドキュメント<69>-Footnote-126253997
Ref: ドキュメント<69>-Footnote-136254063
Ref: ドキュメント<69>-Footnote-146254129
Ref: ドキュメント<69>-Footnote-156254195
Ref: ドキュメント<69>-Footnote-166254261
Ref: ドキュメント<69>-Footnote-176254304
Node: テスト<66>6254370
Ref: whatsnew/changelog id8716254493
Ref: 1ef86254493
Ref: テスト<66>-Footnote-16257244
Ref: テスト<66>-Footnote-26257309
Ref: テスト<66>-Footnote-36257374
Ref: テスト<66>-Footnote-46257439
Ref: テスト<66>-Footnote-56257504
Ref: テスト<66>-Footnote-66257569
Ref: テスト<66>-Footnote-76257634
Ref: テスト<66>-Footnote-86257699
Ref: テスト<66>-Footnote-96257764
Ref: テスト<66>-Footnote-106257829
Ref: テスト<66>-Footnote-116257895
Ref: テスト<66>-Footnote-126257961
Ref: テスト<66>-Footnote-136258027
Ref: テスト<66>-Footnote-146258093
Ref: テスト<66>-Footnote-156258159
Ref: テスト<66>-Footnote-166258225
Ref: テスト<66>-Footnote-176258291
Ref: テスト<66>-Footnote-186258357
Ref: テスト<66>-Footnote-196258423
Node: ビルド<74>6258489
Ref: whatsnew/changelog id8726258601
Ref: 1ef96258601
Ref: ビルド<74>-Footnote-16263359
Ref: ビルド<74>-Footnote-26263424
Ref: ビルド<74>-Footnote-36263489
Ref: ビルド<74>-Footnote-46263554
Ref: ビルド<74>-Footnote-56263596
Ref: ビルド<74>-Footnote-66263661
Ref: ビルド<74>-Footnote-76263726
Ref: ビルド<74>-Footnote-86263791
Ref: ビルド<74>-Footnote-96263856
Ref: ビルド<74>-Footnote-106263921
Ref: ビルド<74>-Footnote-116263987
Ref: ビルド<74>-Footnote-126264053
Ref: ビルド<74>-Footnote-136264119
Ref: ビルド<74>-Footnote-146264185
Ref: ビルド<74>-Footnote-156264251
Ref: ビルド<74>-Footnote-166264317
Ref: ビルド<74>-Footnote-176264383
Ref: ビルド<74>-Footnote-186264449
Ref: ビルド<74>-Footnote-196264515
Ref: ビルド<74>-Footnote-206264581
Ref: ビルド<74>-Footnote-216264647
Ref: ビルド<74>-Footnote-226264713
Ref: ビルド<74>-Footnote-236264779
Ref: ビルド<74>-Footnote-246264845
Ref: ビルド<74>-Footnote-256264911
Ref: ビルド<74>-Footnote-266264977
Ref: ビルド<74>-Footnote-276265043
Ref: ビルド<74>-Footnote-286265109
Ref: ビルド<74>-Footnote-296265175
Ref: ビルド<74>-Footnote-306265241
Ref: ビルド<74>-Footnote-316265307
Ref: ビルド<74>-Footnote-326265373
Ref: ビルド<74>-Footnote-336265439
Ref: ビルド<74>-Footnote-346265505
Ref: ビルド<74>-Footnote-356265571
Ref: ビルド<74>-Footnote-366265637
Ref: ビルド<74>-Footnote-376265703
Node: Windows<65>6265769
Ref: whatsnew/changelog id8736265876
Ref: 1efa6265876
Ref: Windows<65>-Footnote-16268362
Ref: Windows<65>-Footnote-26268427
Ref: Windows<65>-Footnote-36268492
Ref: Windows<65>-Footnote-46268557
Ref: Windows<65>-Footnote-56268622
Ref: Windows<65>-Footnote-66268687
Ref: Windows<65>-Footnote-76268752
Ref: Windows<65>-Footnote-86268817
Ref: Windows<65>-Footnote-96268882
Ref: Windows<65>-Footnote-106268947
Ref: Windows<65>-Footnote-116269013
Ref: Windows<65>-Footnote-126269079
Ref: Windows<65>-Footnote-136269145
Ref: Windows<65>-Footnote-146269211
Ref: Windows<65>-Footnote-156269277
Ref: Windows<65>-Footnote-166269343
Ref: Windows<65>-Footnote-176269409
Ref: Windows<65>-Footnote-186269475
Ref: Windows<65>-Footnote-196269541
Ref: Windows<65>-Footnote-206269607
Ref: Windows<65>-Footnote-216269673
Ref: Windows<65>-Footnote-226269739
Ref: Windows<65>-Footnote-236269805
Ref: Windows<65>-Footnote-246269871
Ref: Windows<65>-Footnote-256269937
Node: IDLE<46>6270003
Ref: whatsnew/changelog id8746270112
Ref: 1efb6270112
Ref: IDLE<46>-Footnote-16280021
Ref: IDLE<46>-Footnote-26280086
Ref: IDLE<46>-Footnote-36280151
Ref: IDLE<46>-Footnote-46280216
Ref: IDLE<46>-Footnote-56280281
Ref: IDLE<46>-Footnote-66280346
Ref: IDLE<46>-Footnote-76280411
Ref: IDLE<46>-Footnote-86280476
Ref: IDLE<46>-Footnote-96280541
Ref: IDLE<46>-Footnote-106280606
Ref: IDLE<46>-Footnote-116280672
Ref: IDLE<46>-Footnote-126280738
Ref: IDLE<46>-Footnote-136280804
Ref: IDLE<46>-Footnote-146280870
Ref: IDLE<46>-Footnote-156280936
Ref: IDLE<46>-Footnote-166281002
Ref: IDLE<46>-Footnote-176281068
Ref: IDLE<46>-Footnote-186281134
Ref: IDLE<46>-Footnote-196281200
Ref: IDLE<46>-Footnote-206281266
Ref: IDLE<46>-Footnote-216281332
Ref: IDLE<46>-Footnote-226281398
Ref: IDLE<46>-Footnote-236281464
Ref: IDLE<46>-Footnote-246281530
Ref: IDLE<46>-Footnote-256281596
Ref: IDLE<46>-Footnote-266281662
Ref: IDLE<46>-Footnote-276281728
Ref: IDLE<46>-Footnote-286281794
Ref: IDLE<46>-Footnote-296281860
Ref: IDLE<46>-Footnote-306281926
Ref: IDLE<46>-Footnote-316281992
Ref: IDLE<46>-Footnote-326282058
Ref: IDLE<46>-Footnote-336282124
Ref: IDLE<46>-Footnote-346282190
Ref: IDLE<46>-Footnote-356282255
Ref: IDLE<46>-Footnote-366282321
Ref: IDLE<46>-Footnote-376282387
Ref: IDLE<46>-Footnote-386282453
Ref: IDLE<46>-Footnote-396282519
Ref: IDLE<46>-Footnote-406282585
Ref: IDLE<46>-Footnote-416282651
Ref: IDLE<46>-Footnote-426282717
Ref: IDLE<46>-Footnote-436282783
Ref: IDLE<46>-Footnote-446282848
Ref: IDLE<46>-Footnote-456282914
Ref: IDLE<46>-Footnote-466282980
Ref: IDLE<46>-Footnote-476283046
Ref: IDLE<46>-Footnote-486283112
Ref: IDLE<46>-Footnote-496283178
Ref: IDLE<46>-Footnote-506283244
Ref: IDLE<46>-Footnote-516283310
Node: Tools/Demos<43>6283376
Ref: whatsnew/changelog id8756283483
Ref: 1efc6283483
Ref: Tools/Demos<43>-Footnote-16284965
Ref: Tools/Demos<43>-Footnote-26285030
Ref: Tools/Demos<43>-Footnote-36285072
Ref: Tools/Demos<43>-Footnote-46285137
Ref: Tools/Demos<43>-Footnote-56285202
Ref: Tools/Demos<43>-Footnote-66285267
Ref: Tools/Demos<43>-Footnote-76285332
Ref: Tools/Demos<43>-Footnote-86285397
Node: C API<66>6285462
Ref: whatsnew/changelog id8766285552
Ref: 1efd6285552
Ref: C API<66>-Footnote-16288606
Ref: C API<66>-Footnote-26288671
Ref: C API<66>-Footnote-36288736
Ref: C API<66>-Footnote-46288801
Ref: C API<66>-Footnote-56288866
Ref: C API<66>-Footnote-66288930
Ref: C API<66>-Footnote-76288995
Ref: C API<66>-Footnote-86289060
Ref: C API<66>-Footnote-96289125
Ref: C API<66>-Footnote-106289190
Ref: C API<66>-Footnote-116289256
Ref: C API<66>-Footnote-126289322
Ref: C API<66>-Footnote-136289388
Ref: C API<66>-Footnote-146289454
Ref: C API<66>-Footnote-156289520
Node: Python 3 6 6 final6289586
Ref: whatsnew/changelog python-3-6-6-final6289723
Ref: 1efe6289723
Node: Python 3 6 6 release candidate 16289851
Ref: whatsnew/changelog python-3-6-6-release-candidate-16289986
Ref: 1eff6289986
Node: Core and Builtins<174>6290409
Ref: whatsnew/changelog id8776290529
Ref: 1f006290529
Ref: Core and Builtins<174>-Footnote-16292107
Ref: Core and Builtins<174>-Footnote-26292172
Ref: Core and Builtins<174>-Footnote-36292237
Ref: Core and Builtins<174>-Footnote-46292302
Ref: Core and Builtins<174>-Footnote-56292367
Ref: Core and Builtins<174>-Footnote-66292432
Ref: Core and Builtins<174>-Footnote-76292497
Ref: Core and Builtins<174>-Footnote-86292562
Ref: Core and Builtins<174>-Footnote-96292627
Ref: Core and Builtins<174>-Footnote-106292692
Ref: Core and Builtins<174>-Footnote-116292758
Ref: Core and Builtins<174>-Footnote-126292824
Node: ライブラリ<178>6292890
Ref: whatsnew/changelog id8786293041
Ref: 1f016293041
Ref: ライブラリ<178>-Footnote-16298519
Ref: ライブラリ<178>-Footnote-26298584
Ref: ライブラリ<178>-Footnote-36298649
Ref: ライブラリ<178>-Footnote-46298714
Ref: ライブラリ<178>-Footnote-56298779
Ref: ライブラリ<178>-Footnote-66298844
Ref: ライブラリ<178>-Footnote-76298909
Ref: ライブラリ<178>-Footnote-86298974
Ref: ライブラリ<178>-Footnote-96299039
Ref: ライブラリ<178>-Footnote-106299104
Ref: ライブラリ<178>-Footnote-116299170
Ref: ライブラリ<178>-Footnote-126299236
Ref: ライブラリ<178>-Footnote-136299302
Ref: ライブラリ<178>-Footnote-146299368
Ref: ライブラリ<178>-Footnote-156299434
Ref: ライブラリ<178>-Footnote-166299500
Ref: ライブラリ<178>-Footnote-176299566
Ref: ライブラリ<178>-Footnote-186299632
Ref: ライブラリ<178>-Footnote-196299698
Ref: ライブラリ<178>-Footnote-206299764
Ref: ライブラリ<178>-Footnote-216299830
Ref: ライブラリ<178>-Footnote-226299897
Ref: ライブラリ<178>-Footnote-236299963
Ref: ライブラリ<178>-Footnote-246300029
Ref: ライブラリ<178>-Footnote-256300095
Ref: ライブラリ<178>-Footnote-266300161
Ref: ライブラリ<178>-Footnote-276300227
Ref: ライブラリ<178>-Footnote-286300293
Ref: ライブラリ<178>-Footnote-296300336
Ref: ライブラリ<178>-Footnote-306300402
Ref: ライブラリ<178>-Footnote-316300468
Ref: ライブラリ<178>-Footnote-326300534
Ref: ライブラリ<178>-Footnote-336300600
Ref: ライブラリ<178>-Footnote-346300666
Ref: ライブラリ<178>-Footnote-356300732
Ref: ライブラリ<178>-Footnote-366300798
Ref: ライブラリ<178>-Footnote-376300864
Ref: ライブラリ<178>-Footnote-386300930
Ref: ライブラリ<178>-Footnote-396300996
Node: ドキュメント<70>6301062
Ref: whatsnew/changelog id8796301204
Ref: 1f026301204
Ref: ドキュメント<70>-Footnote-16302699
Ref: ドキュメント<70>-Footnote-26302764
Ref: ドキュメント<70>-Footnote-36302829
Ref: ドキュメント<70>-Footnote-46302894
Ref: ドキュメント<70>-Footnote-56302959
Ref: ドキュメント<70>-Footnote-66303024
Ref: ドキュメント<70>-Footnote-76303089
Ref: ドキュメント<70>-Footnote-86303154
Ref: ドキュメント<70>-Footnote-96303219
Ref: ドキュメント<70>-Footnote-106303284
Ref: ドキュメント<70>-Footnote-116303350
Ref: ドキュメント<70>-Footnote-126303416
Ref: ドキュメント<70>-Footnote-136303481
Node: テスト<67>6303547
Ref: whatsnew/changelog id8806303682
Ref: 1f036303682
Ref: テスト<67>-Footnote-16303909
Ref: テスト<67>-Footnote-26303974
Node: ビルド<75>6304039
Ref: whatsnew/changelog id8816304163
Ref: 1f046304163
Ref: ビルド<75>-Footnote-16304965
Ref: ビルド<75>-Footnote-26305029
Ref: ビルド<75>-Footnote-36305094
Ref: ビルド<75>-Footnote-46305159
Ref: ビルド<75>-Footnote-56305224
Node: Windows<66>6305289
Ref: whatsnew/changelog id8826305409
Ref: 1f056305409
Ref: Windows<66>-Footnote-16305546
Node: macOS<52>6305611
Ref: whatsnew/changelog id8836305726
Ref: 1f066305726
Ref: macOS<52>-Footnote-16305867
Node: IDLE<47>6305932
Ref: whatsnew/changelog id8846306051
Ref: 1f076306051
Ref: IDLE<47>-Footnote-16308106
Ref: IDLE<47>-Footnote-26308171
Ref: IDLE<47>-Footnote-36308236
Ref: IDLE<47>-Footnote-46308301
Ref: IDLE<47>-Footnote-56308366
Ref: IDLE<47>-Footnote-66308431
Ref: IDLE<47>-Footnote-76308496
Ref: IDLE<47>-Footnote-86308561
Ref: IDLE<47>-Footnote-96308626
Ref: IDLE<47>-Footnote-106308691
Ref: IDLE<47>-Footnote-116308757
Ref: IDLE<47>-Footnote-126308823
Node: Tools/Demos<44>6308889
Ref: whatsnew/changelog id8856309008
Ref: 1f086309008
Ref: Tools/Demos<44>-Footnote-16309759
Ref: Tools/Demos<44>-Footnote-26309824
Ref: Tools/Demos<44>-Footnote-36309889
Ref: Tools/Demos<44>-Footnote-46309954
Ref: Tools/Demos<44>-Footnote-56310019
Node: C API<67>6310084
Ref: whatsnew/changelog id8866310186
Ref: 1f096310186
Ref: C API<67>-Footnote-16310399
Node: Python 3 6 5 final6310464
Ref: whatsnew/changelog python-3-6-5-final6310613
Ref: 1f0a6310613
Node: テスト<68>6310762
Ref: whatsnew/changelog id8876310852
Ref: 1f0b6310852
Ref: テスト<68>-Footnote-16311011
Node: ビルド<76>6311076
Ref: whatsnew/changelog id8886311166
Ref: 1f0c6311166
Ref: ビルド<76>-Footnote-16311308
Node: Python 3 6 5 release candidate 16311373
Ref: whatsnew/changelog python-3-6-5-release-candidate-16311508
Ref: 1f0d6311508
Node: セキュリティ<55>6311977
Ref: whatsnew/changelog id8896312099
Ref: 1f0e6312099
Ref: セキュリティ<55>-Footnote-16312544
Ref: セキュリティ<55>-Footnote-26312609
Ref: セキュリティ<55>-Footnote-36312674
Ref: セキュリティ<55>-Footnote-46312729
Node: Core and Builtins<175>6312784
Ref: whatsnew/changelog id8906312935
Ref: 1f0f6312935
Ref: Core and Builtins<175>-Footnote-16315097
Ref: Core and Builtins<175>-Footnote-26315162
Ref: Core and Builtins<175>-Footnote-36315227
Ref: Core and Builtins<175>-Footnote-46315292
Ref: Core and Builtins<175>-Footnote-56315357
Ref: Core and Builtins<175>-Footnote-66315422
Ref: Core and Builtins<175>-Footnote-76315487
Ref: Core and Builtins<175>-Footnote-86315552
Ref: Core and Builtins<175>-Footnote-96315617
Ref: Core and Builtins<175>-Footnote-106315682
Ref: Core and Builtins<175>-Footnote-116315748
Ref: Core and Builtins<175>-Footnote-126315814
Ref: Core and Builtins<175>-Footnote-136315880
Ref: Core and Builtins<175>-Footnote-146315946
Node: ライブラリ<179>6316012
Ref: whatsnew/changelog id8916316163
Ref: 1f106316163
Ref: ライブラリ<179>-Footnote-16322077
Ref: ライブラリ<179>-Footnote-26322142
Ref: ライブラリ<179>-Footnote-36322207
Ref: ライブラリ<179>-Footnote-46322272
Ref: ライブラリ<179>-Footnote-56322337
Ref: ライブラリ<179>-Footnote-66322402
Ref: ライブラリ<179>-Footnote-76322467
Ref: ライブラリ<179>-Footnote-86322532
Ref: ライブラリ<179>-Footnote-96322597
Ref: ライブラリ<179>-Footnote-106322662
Ref: ライブラリ<179>-Footnote-116322728
Ref: ライブラリ<179>-Footnote-126322794
Ref: ライブラリ<179>-Footnote-136322860
Ref: ライブラリ<179>-Footnote-146322926
Ref: ライブラリ<179>-Footnote-156322992
Ref: ライブラリ<179>-Footnote-166323058
Ref: ライブラリ<179>-Footnote-176323124
Ref: ライブラリ<179>-Footnote-186323190
Ref: ライブラリ<179>-Footnote-196323256
Ref: ライブラリ<179>-Footnote-206323322
Ref: ライブラリ<179>-Footnote-216323388
Ref: ライブラリ<179>-Footnote-226323454
Ref: ライブラリ<179>-Footnote-236323520
Ref: ライブラリ<179>-Footnote-246323586
Ref: ライブラリ<179>-Footnote-256323652
Ref: ライブラリ<179>-Footnote-266323718
Ref: ライブラリ<179>-Footnote-276323784
Ref: ライブラリ<179>-Footnote-286323850
Ref: ライブラリ<179>-Footnote-296323916
Ref: ライブラリ<179>-Footnote-306323982
Ref: ライブラリ<179>-Footnote-316324048
Ref: ライブラリ<179>-Footnote-326324114
Ref: ライブラリ<179>-Footnote-336324180
Ref: ライブラリ<179>-Footnote-346324246
Ref: ライブラリ<179>-Footnote-356324312
Ref: ライブラリ<179>-Footnote-366324378
Ref: ライブラリ<179>-Footnote-376324444
Ref: ライブラリ<179>-Footnote-386324510
Ref: ライブラリ<179>-Footnote-396324576
Ref: ライブラリ<179>-Footnote-406324642
Node: ドキュメント<71>6324708
Ref: whatsnew/changelog id8926324850
Ref: 1f116324850
Ref: ドキュメント<71>-Footnote-16325690
Ref: ドキュメント<71>-Footnote-26325755
Ref: ドキュメント<71>-Footnote-36325820
Ref: ドキュメント<71>-Footnote-46325884
Ref: ドキュメント<71>-Footnote-56325949
Ref: ドキュメント<71>-Footnote-66326014
Node: テスト<69>6326079
Ref: whatsnew/changelog id8936326214
Ref: 1f126326214
Ref: テスト<69>-Footnote-16326880
Ref: テスト<69>-Footnote-26326945
Ref: テスト<69>-Footnote-36327010
Ref: テスト<69>-Footnote-46327075
Node: ビルド<77>6327140
Ref: whatsnew/changelog id8946327264
Ref: 1f136327264
Ref: ビルド<77>-Footnote-16327458
Node: Windows<67>6327523
Ref: whatsnew/changelog id8956327643
Ref: 1f146327643
Ref: Windows<67>-Footnote-16328593
Ref: Windows<67>-Footnote-26328658
Ref: Windows<67>-Footnote-36328723
Ref: Windows<67>-Footnote-46328788
Ref: Windows<67>-Footnote-56328853
Ref: Windows<67>-Footnote-66328918
Ref: Windows<67>-Footnote-76328983
Ref: Windows<67>-Footnote-86329048
Node: macOS<53>6329113
Ref: whatsnew/changelog id8966329228
Ref: 1f156329228
Ref: macOS<53>-Footnote-16329621
Node: IDLE<48>6329686
Ref: whatsnew/changelog id8976329805
Ref: 1f166329805
Ref: IDLE<48>-Footnote-16331287
Ref: IDLE<48>-Footnote-26331352
Ref: IDLE<48>-Footnote-36331417
Ref: IDLE<48>-Footnote-46331482
Ref: IDLE<48>-Footnote-56331547
Ref: IDLE<48>-Footnote-66331612
Ref: IDLE<48>-Footnote-76331677
Ref: IDLE<48>-Footnote-86331742
Node: Tools/Demos<45>6331807
Ref: whatsnew/changelog id8986331926
Ref: 1f176331926
Ref: Tools/Demos<45>-Footnote-16332346
Ref: Tools/Demos<45>-Footnote-26332411
Node: C API<68>6332476
Ref: whatsnew/changelog id8996332578
Ref: 1f186332578
Ref: C API<68>-Footnote-16332828
Node: Python 3 6 4 final6332893
Ref: whatsnew/changelog python-3-6-4-final6333042
Ref: 1f196333042
Node: Python 3 6 4 release candidate 16333191
Ref: whatsnew/changelog python-3-6-4-release-candidate-16333326
Ref: 1f1a6333326
Node: Core and Builtins<176>6333749
Ref: whatsnew/changelog id9006333869
Ref: 1f1b6333869
Ref: Core and Builtins<176>-Footnote-16338587
Ref: Core and Builtins<176>-Footnote-26338652
Ref: Core and Builtins<176>-Footnote-36338717
Ref: Core and Builtins<176>-Footnote-46338782
Ref: Core and Builtins<176>-Footnote-56338847
Ref: Core and Builtins<176>-Footnote-66338912
Ref: Core and Builtins<176>-Footnote-76338977
Ref: Core and Builtins<176>-Footnote-86339042
Ref: Core and Builtins<176>-Footnote-96339107
Ref: Core and Builtins<176>-Footnote-106339172
Ref: Core and Builtins<176>-Footnote-116339238
Ref: Core and Builtins<176>-Footnote-126339304
Ref: Core and Builtins<176>-Footnote-136339370
Ref: Core and Builtins<176>-Footnote-146339436
Ref: Core and Builtins<176>-Footnote-156339502
Ref: Core and Builtins<176>-Footnote-166339568
Ref: Core and Builtins<176>-Footnote-176339634
Ref: Core and Builtins<176>-Footnote-186339700
Ref: Core and Builtins<176>-Footnote-196339766
Ref: Core and Builtins<176>-Footnote-206339832
Ref: Core and Builtins<176>-Footnote-216339898
Ref: Core and Builtins<176>-Footnote-226339964
Ref: Core and Builtins<176>-Footnote-236340030
Ref: Core and Builtins<176>-Footnote-246340096
Node: ライブラリ<180>6340162
Ref: whatsnew/changelog id9016340313
Ref: 1f1c6340313
Ref: ライブラリ<180>-Footnote-16347635
Ref: ライブラリ<180>-Footnote-26347700
Ref: ライブラリ<180>-Footnote-36347765
Ref: ライブラリ<180>-Footnote-46347830
Ref: ライブラリ<180>-Footnote-56347895
Ref: ライブラリ<180>-Footnote-66347960
Ref: ライブラリ<180>-Footnote-76348025
Ref: ライブラリ<180>-Footnote-86348090
Ref: ライブラリ<180>-Footnote-96348155
Ref: ライブラリ<180>-Footnote-106348220
Ref: ライブラリ<180>-Footnote-116348286
Ref: ライブラリ<180>-Footnote-126348352
Ref: ライブラリ<180>-Footnote-136348418
Ref: ライブラリ<180>-Footnote-146348484
Ref: ライブラリ<180>-Footnote-156348550
Ref: ライブラリ<180>-Footnote-166348616
Ref: ライブラリ<180>-Footnote-176348681
Ref: ライブラリ<180>-Footnote-186348747
Ref: ライブラリ<180>-Footnote-196348813
Ref: ライブラリ<180>-Footnote-206348879
Ref: ライブラリ<180>-Footnote-216348945
Ref: ライブラリ<180>-Footnote-226349011
Ref: ライブラリ<180>-Footnote-236349077
Ref: ライブラリ<180>-Footnote-246349143
Ref: ライブラリ<180>-Footnote-256349209
Ref: ライブラリ<180>-Footnote-266349275
Ref: ライブラリ<180>-Footnote-276349341
Ref: ライブラリ<180>-Footnote-286349407
Ref: ライブラリ<180>-Footnote-296349473
Ref: ライブラリ<180>-Footnote-306349539
Ref: ライブラリ<180>-Footnote-316349605
Ref: ライブラリ<180>-Footnote-326349671
Ref: ライブラリ<180>-Footnote-336349737
Ref: ライブラリ<180>-Footnote-346349803
Ref: ライブラリ<180>-Footnote-356349869
Ref: ライブラリ<180>-Footnote-366349935
Ref: ライブラリ<180>-Footnote-376350001
Ref: ライブラリ<180>-Footnote-386350067
Ref: ライブラリ<180>-Footnote-396350133
Ref: ライブラリ<180>-Footnote-406350199
Ref: ライブラリ<180>-Footnote-416350265
Ref: ライブラリ<180>-Footnote-426350331
Ref: ライブラリ<180>-Footnote-436350397
Ref: ライブラリ<180>-Footnote-446350463
Ref: ライブラリ<180>-Footnote-456350529
Ref: ライブラリ<180>-Footnote-466350595
Ref: ライブラリ<180>-Footnote-476350661
Ref: ライブラリ<180>-Footnote-486350727
Ref: ライブラリ<180>-Footnote-496350793
Ref: ライブラリ<180>-Footnote-506350859
Ref: ライブラリ<180>-Footnote-516350925
Ref: ライブラリ<180>-Footnote-526350991
Node: ドキュメント<72>6351057
Ref: whatsnew/changelog id9026351199
Ref: 1f1d6351199
Ref: ドキュメント<72>-Footnote-16351692
Ref: ドキュメント<72>-Footnote-26351757
Ref: ドキュメント<72>-Footnote-36351822
Node: テスト<70>6351887
Ref: whatsnew/changelog id9036352022
Ref: 1f1e6352022
Ref: テスト<70>-Footnote-16352705
Ref: テスト<70>-Footnote-26352770
Ref: テスト<70>-Footnote-36352835
Ref: テスト<70>-Footnote-46352900
Node: ビルド<78>6352965
Ref: whatsnew/changelog id9046353089
Ref: 1f1f6353089
Ref: ビルド<78>-Footnote-16353998
Ref: ビルド<78>-Footnote-26354063
Ref: ビルド<78>-Footnote-36354128
Ref: ビルド<78>-Footnote-46354193
Ref: ビルド<78>-Footnote-56354258
Ref: ビルド<78>-Footnote-66354323
Ref: ビルド<78>-Footnote-76354388
Ref: ビルド<78>-Footnote-86354453
Ref: ビルド<78>-Footnote-96354518
Node: Windows<68>6354583
Ref: whatsnew/changelog id9056354703
Ref: 1f206354703
Ref: Windows<68>-Footnote-16355021
Ref: Windows<68>-Footnote-26355085
Node: macOS<54>6355150
Ref: whatsnew/changelog id9066355265
Ref: 1f216355265
Ref: macOS<54>-Footnote-16355399
Node: IDLE<49>6355464
Ref: whatsnew/changelog id9076355583
Ref: 1f226355583
Ref: IDLE<49>-Footnote-16358904
Ref: IDLE<49>-Footnote-26358969
Ref: IDLE<49>-Footnote-36359034
Ref: IDLE<49>-Footnote-46359099
Ref: IDLE<49>-Footnote-56359164
Ref: IDLE<49>-Footnote-66359229
Ref: IDLE<49>-Footnote-76359294
Ref: IDLE<49>-Footnote-86359359
Ref: IDLE<49>-Footnote-96359424
Ref: IDLE<49>-Footnote-106359489
Ref: IDLE<49>-Footnote-116359555
Ref: IDLE<49>-Footnote-126359621
Ref: IDLE<49>-Footnote-136359687
Ref: IDLE<49>-Footnote-146359753
Node: Tools/Demos<46>6359821
Ref: whatsnew/changelog id9086359940
Ref: 1f236359940
Ref: Tools/Demos<46>-Footnote-16360228
Node: C API<69>6360293
Ref: whatsnew/changelog id9096360395
Ref: 1f246360395
Ref: C API<69>-Footnote-16361123
Ref: C API<69>-Footnote-26361188
Ref: C API<69>-Footnote-36361253
Ref: C API<69>-Footnote-46361318
Node: Python 3 6 3 final6361383
Ref: whatsnew/changelog python-3-6-3-final6361532
Ref: 1f256361532
Node: ライブラリ<181>6361694
Ref: whatsnew/changelog id9106361791
Ref: 1f266361791
Ref: ライブラリ<181>-Footnote-16362004
Node: ビルド<79>6362069
Ref: whatsnew/changelog id9116362166
Ref: 1f276362166
Ref: ビルド<79>-Footnote-16362462
Ref: ビルド<79>-Footnote-26362527
Node: Python 3 6 3 release candidate 16362592
Ref: whatsnew/changelog python-3-6-3-release-candidate-16362727
Ref: 1f286362727
Node: セキュリティ<56>6363156
Ref: whatsnew/changelog id9126363278
Ref: 1f296363278
Ref: セキュリティ<56>-Footnote-16363598
Ref: セキュリティ<56>-Footnote-26363663
Node: Core and Builtins<177>6363728
Ref: whatsnew/changelog id9136363879
Ref: 1f2a6363879
Ref: Core and Builtins<177>-Footnote-16367397
Ref: Core and Builtins<177>-Footnote-26367462
Ref: Core and Builtins<177>-Footnote-36367527
Ref: Core and Builtins<177>-Footnote-46367592
Ref: Core and Builtins<177>-Footnote-56367657
Ref: Core and Builtins<177>-Footnote-66367722
Ref: Core and Builtins<177>-Footnote-76367787
Ref: Core and Builtins<177>-Footnote-86367852
Ref: Core and Builtins<177>-Footnote-96367917
Ref: Core and Builtins<177>-Footnote-106367982
Ref: Core and Builtins<177>-Footnote-116368048
Ref: Core and Builtins<177>-Footnote-126368114
Ref: Core and Builtins<177>-Footnote-136368180
Ref: Core and Builtins<177>-Footnote-146368246
Ref: Core and Builtins<177>-Footnote-156368312
Ref: Core and Builtins<177>-Footnote-166368378
Ref: Core and Builtins<177>-Footnote-176368444
Ref: Core and Builtins<177>-Footnote-186368510
Ref: Core and Builtins<177>-Footnote-196368576
Ref: Core and Builtins<177>-Footnote-206368642
Ref: Core and Builtins<177>-Footnote-216368708
Ref: Core and Builtins<177>-Footnote-226368774
Node: ライブラリ<182>6368840
Ref: whatsnew/changelog id9146368991
Ref: 1f2b6368991
Ref: ライブラリ<182>-Footnote-16374989
Ref: ライブラリ<182>-Footnote-26375054
Ref: ライブラリ<182>-Footnote-36375119
Ref: ライブラリ<182>-Footnote-46375184
Ref: ライブラリ<182>-Footnote-56375249
Ref: ライブラリ<182>-Footnote-66375314
Ref: ライブラリ<182>-Footnote-76375379
Ref: ライブラリ<182>-Footnote-86375444
Ref: ライブラリ<182>-Footnote-96375509
Ref: ライブラリ<182>-Footnote-106375574
Ref: ライブラリ<182>-Footnote-116375640
Ref: ライブラリ<182>-Footnote-126375706
Ref: ライブラリ<182>-Footnote-136375772
Ref: ライブラリ<182>-Footnote-146375838
Ref: ライブラリ<182>-Footnote-156375904
Ref: ライブラリ<182>-Footnote-166375969
Ref: ライブラリ<182>-Footnote-176376035
Ref: ライブラリ<182>-Footnote-186376101
Ref: ライブラリ<182>-Footnote-196376144
Ref: ライブラリ<182>-Footnote-206376210
Ref: ライブラリ<182>-Footnote-216376276
Ref: ライブラリ<182>-Footnote-226376342
Ref: ライブラリ<182>-Footnote-236376408
Ref: ライブラリ<182>-Footnote-246376474
Ref: ライブラリ<182>-Footnote-256376540
Ref: ライブラリ<182>-Footnote-266376606
Ref: ライブラリ<182>-Footnote-276376672
Ref: ライブラリ<182>-Footnote-286376738
Ref: ライブラリ<182>-Footnote-296376804
Ref: ライブラリ<182>-Footnote-306376870
Ref: ライブラリ<182>-Footnote-316376936
Ref: ライブラリ<182>-Footnote-326377002
Ref: ライブラリ<182>-Footnote-336377068
Ref: ライブラリ<182>-Footnote-346377134
Ref: ライブラリ<182>-Footnote-356377200
Ref: ライブラリ<182>-Footnote-366377266
Ref: ライブラリ<182>-Footnote-376377332
Ref: ライブラリ<182>-Footnote-386377398
Ref: ライブラリ<182>-Footnote-396377464
Ref: ライブラリ<182>-Footnote-406377530
Ref: ライブラリ<182>-Footnote-416377596
Ref: ライブラリ<182>-Footnote-426377662
Node: ドキュメント<73>6377728
Ref: whatsnew/changelog id9156377870
Ref: 1f2c6377870
Ref: ドキュメント<73>-Footnote-16378297
Ref: ドキュメント<73>-Footnote-26378362
Ref: ドキュメント<73>-Footnote-36378427
Node: テスト<71>6378492
Ref: whatsnew/changelog id9166378627
Ref: 1f2d6378627
Ref: テスト<71>-Footnote-16379333
Ref: テスト<71>-Footnote-26379398
Ref: テスト<71>-Footnote-36379463
Ref: テスト<71>-Footnote-46379528
Node: ビルド<80>6379593
Ref: whatsnew/changelog id9176379717
Ref: 1f2e6379717
Ref: ビルド<80>-Footnote-16379895
Node: Windows<69>6379960
Ref: whatsnew/changelog id9186380079
Ref: 1f2f6380079
Ref: Windows<69>-Footnote-16380587
Ref: Windows<69>-Footnote-26380652
Ref: Windows<69>-Footnote-36380717
Ref: Windows<69>-Footnote-46380782
Node: IDLE<50>6380847
Ref: whatsnew/changelog id9196380968
Ref: 1f306380968
Ref: IDLE<50>-Footnote-16389713
Ref: IDLE<50>-Footnote-26389778
Ref: IDLE<50>-Footnote-36389843
Ref: IDLE<50>-Footnote-46389908
Ref: IDLE<50>-Footnote-56389973
Ref: IDLE<50>-Footnote-66390038
Ref: IDLE<50>-Footnote-76390103
Ref: IDLE<50>-Footnote-86390168
Ref: IDLE<50>-Footnote-96390233
Ref: IDLE<50>-Footnote-106390298
Ref: IDLE<50>-Footnote-116390364
Ref: IDLE<50>-Footnote-126390430
Ref: IDLE<50>-Footnote-136390496
Ref: IDLE<50>-Footnote-146390562
Ref: IDLE<50>-Footnote-156390628
Ref: IDLE<50>-Footnote-166390694
Ref: IDLE<50>-Footnote-176390760
Ref: IDLE<50>-Footnote-186390826
Ref: IDLE<50>-Footnote-196390892
Ref: IDLE<50>-Footnote-206390958
Ref: IDLE<50>-Footnote-216391024
Ref: IDLE<50>-Footnote-226391090
Ref: IDLE<50>-Footnote-236391156
Ref: IDLE<50>-Footnote-246391222
Ref: IDLE<50>-Footnote-256391288
Ref: IDLE<50>-Footnote-266391354
Ref: IDLE<50>-Footnote-276391420
Ref: IDLE<50>-Footnote-286391486
Ref: IDLE<50>-Footnote-296391552
Ref: IDLE<50>-Footnote-306391618
Ref: IDLE<50>-Footnote-316391684
Ref: IDLE<50>-Footnote-326391750
Ref: IDLE<50>-Footnote-336391816
Ref: IDLE<50>-Footnote-346391882
Ref: IDLE<50>-Footnote-356391947
Ref: IDLE<50>-Footnote-366392013
Ref: IDLE<50>-Footnote-376392079
Ref: IDLE<50>-Footnote-386392145
Ref: IDLE<50>-Footnote-396392211
Ref: IDLE<50>-Footnote-406392277
Ref: IDLE<50>-Footnote-416392343
Ref: IDLE<50>-Footnote-426392409
Ref: IDLE<50>-Footnote-436392475
Node: Tools/Demos<47>6392540
Ref: whatsnew/changelog id9206392641
Ref: 1f316392641
Ref: Tools/Demos<47>-Footnote-16393199
Ref: Tools/Demos<47>-Footnote-26393264
Node: Python 3 6 2 final6393306
Ref: whatsnew/changelog python-3-6-2-final6393455
Ref: 1f326393455
Node: Python 3 6 2 release candidate 26393576
Ref: whatsnew/changelog python-3-6-2-release-candidate-26393725
Ref: 1f336393725
Node: セキュリティ<57>6393892
Ref: whatsnew/changelog id9216393983
Ref: 1f346393983
Ref: セキュリティ<57>-Footnote-16395118
Ref: セキュリティ<57>-Footnote-26395183
Ref: セキュリティ<57>-Footnote-36395248
Ref: セキュリティ<57>-Footnote-46395303
Ref: セキュリティ<57>-Footnote-56395358
Ref: セキュリティ<57>-Footnote-66395413
Ref: セキュリティ<57>-Footnote-76395468
Ref: セキュリティ<57>-Footnote-86395523
Ref: セキュリティ<57>-Footnote-96395578
Node: Python 3 6 2 release candidate 16395643
Ref: whatsnew/changelog python-3-6-2-release-candidate-16395792
Ref: 1f356395792
Node: セキュリティ<58>6396241
Ref: whatsnew/changelog id9226396363
Ref: 1f366396363
Ref: セキュリティ<58>-Footnote-16396650
Ref: セキュリティ<58>-Footnote-26396715
Ref: セキュリティ<58>-Footnote-36396770
Node: Core and Builtins<178>6396825
Ref: whatsnew/changelog id9236396976
Ref: 1f376396976
Ref: Core and Builtins<178>-Footnote-16398950
Ref: Core and Builtins<178>-Footnote-26399015
Ref: Core and Builtins<178>-Footnote-36399080
Ref: Core and Builtins<178>-Footnote-46399145
Ref: Core and Builtins<178>-Footnote-56399210
Ref: Core and Builtins<178>-Footnote-66399275
Ref: Core and Builtins<178>-Footnote-76399340
Ref: Core and Builtins<178>-Footnote-86399405
Ref: Core and Builtins<178>-Footnote-96399470
Ref: Core and Builtins<178>-Footnote-106399535
Ref: Core and Builtins<178>-Footnote-116399601
Ref: Core and Builtins<178>-Footnote-126399667
Ref: Core and Builtins<178>-Footnote-136399733
Ref: Core and Builtins<178>-Footnote-146399799
Ref: Core and Builtins<178>-Footnote-156399865
Node: ライブラリ<183>6399931
Ref: whatsnew/changelog id9246400068
Ref: 1f386400068
Ref: ライブラリ<183>-Footnote-16408477
Ref: ライブラリ<183>-Footnote-26408542
Ref: ライブラリ<183>-Footnote-36408607
Ref: ライブラリ<183>-Footnote-46408672
Ref: ライブラリ<183>-Footnote-56408737
Ref: ライブラリ<183>-Footnote-66408802
Ref: ライブラリ<183>-Footnote-76408867
Ref: ライブラリ<183>-Footnote-86408932
Ref: ライブラリ<183>-Footnote-96408997
Ref: ライブラリ<183>-Footnote-106409062
Ref: ライブラリ<183>-Footnote-116409128
Ref: ライブラリ<183>-Footnote-126409194
Ref: ライブラリ<183>-Footnote-136409260
Ref: ライブラリ<183>-Footnote-146409326
Ref: ライブラリ<183>-Footnote-156409392
Ref: ライブラリ<183>-Footnote-166409458
Ref: ライブラリ<183>-Footnote-176409524
Ref: ライブラリ<183>-Footnote-186409590
Ref: ライブラリ<183>-Footnote-196409656
Ref: ライブラリ<183>-Footnote-206409722
Ref: ライブラリ<183>-Footnote-216409788
Ref: ライブラリ<183>-Footnote-226409854
Ref: ライブラリ<183>-Footnote-236409920
Ref: ライブラリ<183>-Footnote-246409986
Ref: ライブラリ<183>-Footnote-256410052
Ref: ライブラリ<183>-Footnote-266410118
Ref: ライブラリ<183>-Footnote-276410184
Ref: ライブラリ<183>-Footnote-286410250
Ref: ライブラリ<183>-Footnote-296410316
Ref: ライブラリ<183>-Footnote-306410382
Ref: ライブラリ<183>-Footnote-316410448
Ref: ライブラリ<183>-Footnote-326410514
Ref: ライブラリ<183>-Footnote-336410580
Ref: ライブラリ<183>-Footnote-346410646
Ref: ライブラリ<183>-Footnote-356410712
Ref: ライブラリ<183>-Footnote-366410778
Ref: ライブラリ<183>-Footnote-376410844
Ref: ライブラリ<183>-Footnote-386410910
Ref: ライブラリ<183>-Footnote-396410976
Ref: ライブラリ<183>-Footnote-406411042
Ref: ライブラリ<183>-Footnote-416411108
Ref: ライブラリ<183>-Footnote-426411174
Ref: ライブラリ<183>-Footnote-436411240
Ref: ライブラリ<183>-Footnote-446411306
Ref: ライブラリ<183>-Footnote-456411372
Ref: ライブラリ<183>-Footnote-466411438
Ref: ライブラリ<183>-Footnote-476411504
Ref: ライブラリ<183>-Footnote-486411570
Ref: ライブラリ<183>-Footnote-496411636
Ref: ライブラリ<183>-Footnote-506411702
Ref: ライブラリ<183>-Footnote-516411768
Ref: ライブラリ<183>-Footnote-526411834
Ref: ライブラリ<183>-Footnote-536411900
Ref: ライブラリ<183>-Footnote-546411966
Ref: ライブラリ<183>-Footnote-556412032
Ref: ライブラリ<183>-Footnote-566412097
Ref: ライブラリ<183>-Footnote-576412163
Ref: ライブラリ<183>-Footnote-586412229
Ref: ライブラリ<183>-Footnote-596412295
Ref: ライブラリ<183>-Footnote-606412361
Node: IDLE<51>6412427
Ref: whatsnew/changelog id9256412551
Ref: 1f396412551
Ref: IDLE<51>-Footnote-16413554
Ref: IDLE<51>-Footnote-26413619
Ref: IDLE<51>-Footnote-36413684
Ref: IDLE<51>-Footnote-46413749
Ref: IDLE<51>-Footnote-56413814
Ref: IDLE<51>-Footnote-66413879
Node: C API<70>6413944
Ref: whatsnew/changelog id9266414061
Ref: 1f3a6414061
Ref: C API<70>-Footnote-16414249
Node: ビルド<81>6414314
Ref: whatsnew/changelog id9276414445
Ref: 1f3b6414445
Ref: ビルド<81>-Footnote-16415255
Ref: ビルド<81>-Footnote-26415320
Ref: ビルド<81>-Footnote-36415385
Ref: ビルド<81>-Footnote-46415450
Ref: ビルド<81>-Footnote-56415515
Node: ドキュメント<74>6415580
Ref: whatsnew/changelog id9286415717
Ref: 1f3c6415717
Ref: ドキュメント<74>-Footnote-16416450
Ref: ドキュメント<74>-Footnote-26416515
Ref: ドキュメント<74>-Footnote-36416580
Node: Tools/Demos<48>6416645
Ref: whatsnew/changelog id9296416782
Ref: 1f3d6416782
Ref: Tools/Demos<48>-Footnote-16416972
Node: テスト<72>6417037
Ref: whatsnew/changelog id9306417163
Ref: 1f3e6417163
Ref: テスト<72>-Footnote-16417823
Ref: テスト<72>-Footnote-26417888
Node: Windows<70>6417953
Ref: whatsnew/changelog id9316418055
Ref: 1f3f6418055
Ref: Windows<70>-Footnote-16418499
Ref: Windows<70>-Footnote-26418564
Node: Python 3 6 1 final6418629
Ref: whatsnew/changelog python-3-6-1-final6418778
Ref: 1f406418778
Node: Core and Builtins<179>6418944
Ref: whatsnew/changelog id9326419043
Ref: 1f416419043
Ref: Core and Builtins<179>-Footnote-16419660
Ref: Core and Builtins<179>-Footnote-26419725
Node: ビルド<82>6419790
Ref: whatsnew/changelog id9336419889
Ref: 1f426419889
Ref: ビルド<82>-Footnote-16420076
Node: Python 3 6 1 release candidate 16420141
Ref: whatsnew/changelog python-3-6-1-release-candidate-16420276
Ref: 1f436420276
Node: Core and Builtins<180>6420647
Ref: whatsnew/changelog id9346420767
Ref: 1f446420767
Ref: Core and Builtins<180>-Footnote-16423599
Ref: Core and Builtins<180>-Footnote-26423664
Ref: Core and Builtins<180>-Footnote-36423729
Ref: Core and Builtins<180>-Footnote-46423794
Ref: Core and Builtins<180>-Footnote-56423859
Ref: Core and Builtins<180>-Footnote-66423924
Ref: Core and Builtins<180>-Footnote-76423989
Ref: Core and Builtins<180>-Footnote-86424054
Ref: Core and Builtins<180>-Footnote-96424119
Ref: Core and Builtins<180>-Footnote-106424184
Ref: Core and Builtins<180>-Footnote-116424250
Ref: Core and Builtins<180>-Footnote-126424316
Ref: Core and Builtins<180>-Footnote-136424382
Ref: Core and Builtins<180>-Footnote-146424448
Ref: Core and Builtins<180>-Footnote-156424514
Ref: Core and Builtins<180>-Footnote-166424580
Ref: Core and Builtins<180>-Footnote-176424646
Ref: Core and Builtins<180>-Footnote-186424712
Ref: Core and Builtins<180>-Footnote-196424778
Ref: Core and Builtins<180>-Footnote-206424844
Ref: Core and Builtins<180>-Footnote-216424910
Ref: Core and Builtins<180>-Footnote-226424976
Node: ライブラリ<184>6425042
Ref: whatsnew/changelog id9356425179
Ref: 1f456425179
Ref: ライブラリ<184>-Footnote-16430825
Ref: ライブラリ<184>-Footnote-26430890
Ref: ライブラリ<184>-Footnote-36430955
Ref: ライブラリ<184>-Footnote-46431020
Ref: ライブラリ<184>-Footnote-56431085
Ref: ライブラリ<184>-Footnote-66431150
Ref: ライブラリ<184>-Footnote-76431215
Ref: ライブラリ<184>-Footnote-86431280
Ref: ライブラリ<184>-Footnote-96431345
Ref: ライブラリ<184>-Footnote-106431410
Ref: ライブラリ<184>-Footnote-116431476
Ref: ライブラリ<184>-Footnote-126431542
Ref: ライブラリ<184>-Footnote-136431608
Ref: ライブラリ<184>-Footnote-146431674
Ref: ライブラリ<184>-Footnote-156431740
Ref: ライブラリ<184>-Footnote-166431806
Ref: ライブラリ<184>-Footnote-176431872
Ref: ライブラリ<184>-Footnote-186431938
Ref: ライブラリ<184>-Footnote-196432004
Ref: ライブラリ<184>-Footnote-206432070
Ref: ライブラリ<184>-Footnote-216432136
Ref: ライブラリ<184>-Footnote-226432202
Ref: ライブラリ<184>-Footnote-236432268
Ref: ライブラリ<184>-Footnote-246432334
Ref: ライブラリ<184>-Footnote-256432400
Ref: ライブラリ<184>-Footnote-266432466
Ref: ライブラリ<184>-Footnote-276432532
Ref: ライブラリ<184>-Footnote-286432575
Ref: ライブラリ<184>-Footnote-296432641
Ref: ライブラリ<184>-Footnote-306432707
Ref: ライブラリ<184>-Footnote-316432773
Ref: ライブラリ<184>-Footnote-326432839
Ref: ライブラリ<184>-Footnote-336432905
Ref: ライブラリ<184>-Footnote-346432971
Ref: ライブラリ<184>-Footnote-356433037
Ref: ライブラリ<184>-Footnote-366433102
Ref: ライブラリ<184>-Footnote-376433168
Ref: ライブラリ<184>-Footnote-386433234
Ref: ライブラリ<184>-Footnote-396433300
Ref: ライブラリ<184>-Footnote-406433366
Ref: ライブラリ<184>-Footnote-416433432
Ref: ライブラリ<184>-Footnote-426433498
Ref: ライブラリ<184>-Footnote-436433564
Ref: ライブラリ<184>-Footnote-446433630
Node: IDLE<52>6433696
Ref: whatsnew/changelog id9366433822
Ref: 1f466433822
Ref: IDLE<52>-Footnote-16434109
Ref: IDLE<52>-Footnote-26434174
Node: Windows<71>6434239
Ref: whatsnew/changelog id9376434354
Ref: 1f476434354
Ref: Windows<71>-Footnote-16435001
Ref: Windows<71>-Footnote-26435066
Ref: Windows<71>-Footnote-36435131
Ref: Windows<71>-Footnote-46435196
Ref: Windows<71>-Footnote-56435261
Ref: Windows<71>-Footnote-66435303
Ref: Windows<71>-Footnote-76435368
Ref: Windows<71>-Footnote-86435433
Node: C API<71>6435498
Ref: whatsnew/changelog id9386435627
Ref: 1f486435627
Ref: C API<71>-Footnote-16436453
Ref: C API<71>-Footnote-26436518
Ref: C API<71>-Footnote-36436583
Node: ドキュメント<75>6436648
Ref: whatsnew/changelog id9396436779
Ref: 1f496436779
Ref: ドキュメント<75>-Footnote-16437320
Ref: ドキュメント<75>-Footnote-26437385
Ref: ドキュメント<75>-Footnote-36437450
Ref: ドキュメント<75>-Footnote-46437515
Node: テスト<73>6437580
Ref: whatsnew/changelog id9406437715
Ref: 1f4a6437715
Ref: テスト<73>-Footnote-16438705
Ref: テスト<73>-Footnote-26438770
Ref: テスト<73>-Footnote-36438835
Ref: テスト<73>-Footnote-46438900
Ref: テスト<73>-Footnote-56438965
Node: ビルド<83>6439030
Ref: whatsnew/changelog id9416439134
Ref: 1f4b6439134
Ref: ビルド<83>-Footnote-16440400
Ref: ビルド<83>-Footnote-26440465
Ref: ビルド<83>-Footnote-36440530
Ref: ビルド<83>-Footnote-46440595
Ref: ビルド<83>-Footnote-56440660
Ref: ビルド<83>-Footnote-66440725
Ref: ビルド<83>-Footnote-76440790
Ref: ビルド<83>-Footnote-86440855
Ref: ビルド<83>-Footnote-96440920
Ref: ビルド<83>-Footnote-106440985
Node: Python 3 6 0 final6441051
Ref: whatsnew/changelog python-3-6-0-final6441200
Ref: 1f4c6441200
Node: Python 3 6 0 release candidate 26441321
Ref: whatsnew/changelog python-3-6-0-release-candidate-26441470
Ref: 1f4d6441470
Node: Core and Builtins<181>6441720
Ref: whatsnew/changelog id9426441835
Ref: 1f4e6441835
Ref: Core and Builtins<181>-Footnote-16442220
Ref: Core and Builtins<181>-Footnote-26442285
Node: Tools/Demos<49>6442350
Ref: whatsnew/changelog id9436442485
Ref: 1f4f6442485
Ref: Tools/Demos<49>-Footnote-16442619
Node: Windows<72>6442684
Ref: whatsnew/changelog id9446442810
Ref: 1f506442810
Ref: Windows<72>-Footnote-16442936
Node: ビルド<84>6443001
Ref: whatsnew/changelog id9456443103
Ref: 1f516443103
Ref: ビルド<84>-Footnote-16443263
Node: Python 3 6 0 release candidate 16443328
Ref: whatsnew/changelog python-3-6-0-release-candidate-16443478
Ref: 1f526443478
Node: Core and Builtins<182>6443783
Ref: whatsnew/changelog id9466443903
Ref: 1f536443903
Ref: Core and Builtins<182>-Footnote-16444710
Ref: Core and Builtins<182>-Footnote-26444775
Ref: Core and Builtins<182>-Footnote-36444840
Ref: Core and Builtins<182>-Footnote-46444905
Node: ライブラリ<185>6444970
Ref: whatsnew/changelog id9476445108
Ref: 1f546445108
Ref: ライブラリ<185>-Footnote-16446158
Ref: ライブラリ<185>-Footnote-26446223
Ref: ライブラリ<185>-Footnote-36446288
Ref: ライブラリ<185>-Footnote-46446353
Ref: ライブラリ<185>-Footnote-56446418
Ref: ライブラリ<185>-Footnote-66446483
Node: C API<72>6446548
Ref: whatsnew/changelog id9486446686
Ref: 1f556446686
Ref: C API<72>-Footnote-16446844
Node: ドキュメント<76>6446909
Ref: whatsnew/changelog id9496447042
Ref: 1f566447042
Ref: ドキュメント<76>-Footnote-16447384
Ref: ドキュメント<76>-Footnote-26447449
Node: Tools/Demos<50>6447491
Ref: whatsnew/changelog id9506447606
Ref: 1f576447606
Ref: Tools/Demos<50>-Footnote-16447770
Node: Python 3 6 0 beta 46447835
Ref: whatsnew/changelog python-3-6-0-beta-46447972
Ref: 1f586447972
Node: Core and Builtins<183>6448255
Ref: whatsnew/changelog id9516448362
Ref: 1f596448362
Ref: Core and Builtins<183>-Footnote-16449910
Ref: Core and Builtins<183>-Footnote-26449975
Ref: Core and Builtins<183>-Footnote-36450040
Ref: Core and Builtins<183>-Footnote-46450105
Ref: Core and Builtins<183>-Footnote-56450170
Ref: Core and Builtins<183>-Footnote-66450235
Ref: Core and Builtins<183>-Footnote-76450300
Ref: Core and Builtins<183>-Footnote-86450365
Ref: Core and Builtins<183>-Footnote-96450430
Ref: Core and Builtins<183>-Footnote-106450495
Ref: Core and Builtins<183>-Footnote-116450561
Node: ライブラリ<186>6450627
Ref: whatsnew/changelog id9526450765
Ref: 1f5a6450765
Ref: ライブラリ<186>-Footnote-16452774
Ref: ライブラリ<186>-Footnote-26452839
Ref: ライブラリ<186>-Footnote-36452904
Ref: ライブラリ<186>-Footnote-46452969
Ref: ライブラリ<186>-Footnote-56453034
Ref: ライブラリ<186>-Footnote-66453099
Ref: ライブラリ<186>-Footnote-76453164
Ref: ライブラリ<186>-Footnote-86453229
Ref: ライブラリ<186>-Footnote-96453294
Ref: ライブラリ<186>-Footnote-106453359
Ref: ライブラリ<186>-Footnote-116453425
Ref: ライブラリ<186>-Footnote-126453491
Ref: ライブラリ<186>-Footnote-136453557
Ref: ライブラリ<186>-Footnote-146453623
Ref: ライブラリ<186>-Footnote-156453689
Ref: ライブラリ<186>-Footnote-166453755
Ref: ライブラリ<186>-Footnote-176453821
Ref: ライブラリ<186>-Footnote-186453887
Node: ドキュメント<77>6453953
Ref: whatsnew/changelog id9536454082
Ref: 1f5b6454082
Ref: ドキュメント<77>-Footnote-16454237
Node: テスト<74>6454302
Ref: whatsnew/changelog id9546454424
Ref: 1f5c6454424
Ref: テスト<74>-Footnote-16454691
Ref: テスト<74>-Footnote-26454756
Node: ビルド<85>6454821
Ref: whatsnew/changelog id9556454912
Ref: 1f5d6454912
Ref: ビルド<85>-Footnote-16455272
Ref: ビルド<85>-Footnote-26455337
Ref: ビルド<85>-Footnote-36455402
Node: Python 3 6 0 beta 36455467
Ref: whatsnew/changelog python-3-6-0-beta-36455591
Ref: 1f5e6455591
Node: Core and Builtins<184>6455852
Ref: whatsnew/changelog id9566455959
Ref: 1f5f6455959
Ref: Core and Builtins<184>-Footnote-16456862
Ref: Core and Builtins<184>-Footnote-26456927
Ref: Core and Builtins<184>-Footnote-36456992
Ref: Core and Builtins<184>-Footnote-46457057
Ref: Core and Builtins<184>-Footnote-56457122
Ref: Core and Builtins<184>-Footnote-66457187
Ref: Core and Builtins<184>-Footnote-76457252
Node: ライブラリ<187>6457317
Ref: whatsnew/changelog id9576457444
Ref: 1f606457444
Ref: ライブラリ<187>-Footnote-16460477
Ref: ライブラリ<187>-Footnote-26460542
Ref: ライブラリ<187>-Footnote-36460607
Ref: ライブラリ<187>-Footnote-46460672
Ref: ライブラリ<187>-Footnote-56460737
Ref: ライブラリ<187>-Footnote-66460802
Ref: ライブラリ<187>-Footnote-76460867
Ref: ライブラリ<187>-Footnote-86460932
Ref: ライブラリ<187>-Footnote-96460997
Ref: ライブラリ<187>-Footnote-106461062
Ref: ライブラリ<187>-Footnote-116461128
Ref: ライブラリ<187>-Footnote-126461194
Ref: ライブラリ<187>-Footnote-136461260
Ref: ライブラリ<187>-Footnote-146461326
Ref: ライブラリ<187>-Footnote-156461392
Ref: ライブラリ<187>-Footnote-166461458
Ref: ライブラリ<187>-Footnote-176461524
Ref: ライブラリ<187>-Footnote-186461590
Ref: ライブラリ<187>-Footnote-196461656
Ref: ライブラリ<187>-Footnote-206461722
Ref: ライブラリ<187>-Footnote-216461788
Ref: ライブラリ<187>-Footnote-226461854
Ref: ライブラリ<187>-Footnote-236461920
Ref: ライブラリ<187>-Footnote-246461986
Node: Windows<73>6462052
Ref: whatsnew/changelog id9586462170
Ref: 1f616462170
Ref: Windows<73>-Footnote-16462314
Node: ビルド<86>6462379
Ref: whatsnew/changelog id9596462490
Ref: 1f626462490
Ref: ビルド<86>-Footnote-16462814
Ref: ビルド<86>-Footnote-26462879
Ref: ビルド<86>-Footnote-36462944
Node: テスト<75>6463009
Ref: whatsnew/changelog id9606463100
Ref: 1f636463100
Ref: テスト<75>-Footnote-16463360
Ref: テスト<75>-Footnote-26463425
Node: Python 3 6 0 beta 26463490
Ref: whatsnew/changelog python-3-6-0-beta-26463614
Ref: 1f646463614
Node: Core and Builtins<185>6463895
Ref: whatsnew/changelog id9616464002
Ref: 1f656464002
Ref: Core and Builtins<185>-Footnote-16466735
Ref: Core and Builtins<185>-Footnote-26466800
Ref: Core and Builtins<185>-Footnote-36466865
Ref: Core and Builtins<185>-Footnote-46466930
Ref: Core and Builtins<185>-Footnote-56466995
Ref: Core and Builtins<185>-Footnote-66467060
Ref: Core and Builtins<185>-Footnote-76467125
Ref: Core and Builtins<185>-Footnote-86467190
Ref: Core and Builtins<185>-Footnote-96467255
Ref: Core and Builtins<185>-Footnote-106467320
Ref: Core and Builtins<185>-Footnote-116467386
Ref: Core and Builtins<185>-Footnote-126467452
Ref: Core and Builtins<185>-Footnote-136467518
Ref: Core and Builtins<185>-Footnote-146467584
Ref: Core and Builtins<185>-Footnote-156467650
Ref: Core and Builtins<185>-Footnote-166467716
Ref: Core and Builtins<185>-Footnote-176467782
Ref: Core and Builtins<185>-Footnote-186467848
Ref: Core and Builtins<185>-Footnote-196467914
Ref: Core and Builtins<185>-Footnote-206467980
Ref: Core and Builtins<185>-Footnote-216468046
Ref: Core and Builtins<185>-Footnote-226468112
Ref: Core and Builtins<185>-Footnote-236468178
Node: ライブラリ<188>6468244
Ref: whatsnew/changelog id9626468371
Ref: 1f666468371
Ref: ライブラリ<188>-Footnote-16474162
Ref: ライブラリ<188>-Footnote-26474227
Ref: ライブラリ<188>-Footnote-36474292
Ref: ライブラリ<188>-Footnote-46474357
Ref: ライブラリ<188>-Footnote-56474422
Ref: ライブラリ<188>-Footnote-66474487
Ref: ライブラリ<188>-Footnote-76474552
Ref: ライブラリ<188>-Footnote-86474617
Ref: ライブラリ<188>-Footnote-96474682
Ref: ライブラリ<188>-Footnote-106474747
Ref: ライブラリ<188>-Footnote-116474813
Ref: ライブラリ<188>-Footnote-126474879
Ref: ライブラリ<188>-Footnote-136474945
Ref: ライブラリ<188>-Footnote-146475011
Ref: ライブラリ<188>-Footnote-156475077
Ref: ライブラリ<188>-Footnote-166475143
Ref: ライブラリ<188>-Footnote-176475209
Ref: ライブラリ<188>-Footnote-186475275
Ref: ライブラリ<188>-Footnote-196475341
Ref: ライブラリ<188>-Footnote-206475407
Ref: ライブラリ<188>-Footnote-216475473
Ref: ライブラリ<188>-Footnote-226475539
Ref: ライブラリ<188>-Footnote-236475605
Ref: ライブラリ<188>-Footnote-246475671
Ref: ライブラリ<188>-Footnote-256475737
Ref: ライブラリ<188>-Footnote-266475803
Ref: ライブラリ<188>-Footnote-276475869
Ref: ライブラリ<188>-Footnote-286475935
Ref: ライブラリ<188>-Footnote-296476001
Ref: ライブラリ<188>-Footnote-306476067
Ref: ライブラリ<188>-Footnote-316476133
Ref: ライブラリ<188>-Footnote-326476199
Ref: ライブラリ<188>-Footnote-336476265
Ref: ライブラリ<188>-Footnote-346476331
Ref: ライブラリ<188>-Footnote-356476397
Ref: ライブラリ<188>-Footnote-366476463
Ref: ライブラリ<188>-Footnote-376476529
Ref: ライブラリ<188>-Footnote-386476595
Ref: ライブラリ<188>-Footnote-396476661
Ref: ライブラリ<188>-Footnote-406476727
Ref: ライブラリ<188>-Footnote-416476793
Ref: ライブラリ<188>-Footnote-426476859
Ref: ライブラリ<188>-Footnote-436476925
Ref: ライブラリ<188>-Footnote-446476991
Ref: ライブラリ<188>-Footnote-456477057
Ref: ライブラリ<188>-Footnote-466477123
Ref: ライブラリ<188>-Footnote-476477189
Ref: ライブラリ<188>-Footnote-486477255
Node: Windows<74>6477321
Ref: whatsnew/changelog id9636477435
Ref: 1f676477435
Ref: Windows<74>-Footnote-16478246
Ref: Windows<74>-Footnote-26478311
Ref: Windows<74>-Footnote-36478376
Ref: Windows<74>-Footnote-46478441
Ref: Windows<74>-Footnote-56478506
Ref: Windows<74>-Footnote-66478571
Ref: Windows<74>-Footnote-76478636
Ref: Windows<74>-Footnote-86478701
Ref: Windows<74>-Footnote-96478766
Ref: Windows<74>-Footnote-106478831
Node: C API<73>6478897
Ref: whatsnew/changelog id9646479004
Ref: 1f686479004
Ref: C API<73>-Footnote-16479258
Node: ビルド<87>6479323
Ref: whatsnew/changelog id9656479432
Ref: 1f696479432
Ref: ビルド<87>-Footnote-16479863
Ref: ビルド<87>-Footnote-26479928
Ref: ビルド<87>-Footnote-36479993
Node: テスト<76>6480058
Ref: whatsnew/changelog id9666480149
Ref: 1f6a6480149
Ref: テスト<76>-Footnote-16480291
Node: Python 3 6 0 beta 16480356
Ref: whatsnew/changelog python-3-6-0-beta-16480481
Ref: 1f6b6480481
Node: Core and Builtins<186>6480812
Ref: whatsnew/changelog id9676480919
Ref: 1f6c6480919
Ref: Core and Builtins<186>-Footnote-16487086
Ref: Core and Builtins<186>-Footnote-26487151
Ref: Core and Builtins<186>-Footnote-36487216
Ref: Core and Builtins<186>-Footnote-46487281
Ref: Core and Builtins<186>-Footnote-56487323
Ref: Core and Builtins<186>-Footnote-66487388
Ref: Core and Builtins<186>-Footnote-76487453
Ref: Core and Builtins<186>-Footnote-86487518
Ref: Core and Builtins<186>-Footnote-96487583
Ref: Core and Builtins<186>-Footnote-106487648
Ref: Core and Builtins<186>-Footnote-116487714
Ref: Core and Builtins<186>-Footnote-126487780
Ref: Core and Builtins<186>-Footnote-136487846
Ref: Core and Builtins<186>-Footnote-146487889
Ref: Core and Builtins<186>-Footnote-156487955
Ref: Core and Builtins<186>-Footnote-166488021
Ref: Core and Builtins<186>-Footnote-176488064
Ref: Core and Builtins<186>-Footnote-186488130
Ref: Core and Builtins<186>-Footnote-196488173
Ref: Core and Builtins<186>-Footnote-206488239
Ref: Core and Builtins<186>-Footnote-216488305
Ref: Core and Builtins<186>-Footnote-226488371
Ref: Core and Builtins<186>-Footnote-236488437
Ref: Core and Builtins<186>-Footnote-246488503
Ref: Core and Builtins<186>-Footnote-256488569
Ref: Core and Builtins<186>-Footnote-266488635
Ref: Core and Builtins<186>-Footnote-276488701
Ref: Core and Builtins<186>-Footnote-286488744
Ref: Core and Builtins<186>-Footnote-296488810
Ref: Core and Builtins<186>-Footnote-306488876
Ref: Core and Builtins<186>-Footnote-316488942
Ref: Core and Builtins<186>-Footnote-326489008
Ref: Core and Builtins<186>-Footnote-336489074
Ref: Core and Builtins<186>-Footnote-346489140
Ref: Core and Builtins<186>-Footnote-356489206
Ref: Core and Builtins<186>-Footnote-366489272
Ref: Core and Builtins<186>-Footnote-376489338
Ref: Core and Builtins<186>-Footnote-386489404
Ref: Core and Builtins<186>-Footnote-396489470
Ref: Core and Builtins<186>-Footnote-406489536
Ref: Core and Builtins<186>-Footnote-416489602
Ref: Core and Builtins<186>-Footnote-426489668
Ref: Core and Builtins<186>-Footnote-436489734
Ref: Core and Builtins<186>-Footnote-446489800
Ref: Core and Builtins<186>-Footnote-456489866
Ref: Core and Builtins<186>-Footnote-466489932
Ref: Core and Builtins<186>-Footnote-476489975
Node: ライブラリ<189>6490041
Ref: whatsnew/changelog id9686490165
Ref: 1f6d6490165
Ref: ライブラリ<189>-Footnote-16501119
Ref: ライブラリ<189>-Footnote-26501184
Ref: ライブラリ<189>-Footnote-36501249
Ref: ライブラリ<189>-Footnote-46501314
Ref: ライブラリ<189>-Footnote-56501379
Ref: ライブラリ<189>-Footnote-66501444
Ref: ライブラリ<189>-Footnote-76501509
Ref: ライブラリ<189>-Footnote-86501574
Ref: ライブラリ<189>-Footnote-96501639
Ref: ライブラリ<189>-Footnote-106501704
Ref: ライブラリ<189>-Footnote-116501770
Ref: ライブラリ<189>-Footnote-126501836
Ref: ライブラリ<189>-Footnote-136501902
Ref: ライブラリ<189>-Footnote-146501968
Ref: ライブラリ<189>-Footnote-156502034
Ref: ライブラリ<189>-Footnote-166502100
Ref: ライブラリ<189>-Footnote-176502166
Ref: ライブラリ<189>-Footnote-186502234
Ref: ライブラリ<189>-Footnote-196502300
Ref: ライブラリ<189>-Footnote-206502366
Ref: ライブラリ<189>-Footnote-216502432
Ref: ライブラリ<189>-Footnote-226502498
Ref: ライブラリ<189>-Footnote-236502564
Ref: ライブラリ<189>-Footnote-246502630
Ref: ライブラリ<189>-Footnote-256502696
Ref: ライブラリ<189>-Footnote-266502763
Ref: ライブラリ<189>-Footnote-276502829
Ref: ライブラリ<189>-Footnote-286502895
Ref: ライブラリ<189>-Footnote-296502961
Ref: ライブラリ<189>-Footnote-306503027
Ref: ライブラリ<189>-Footnote-316503093
Ref: ライブラリ<189>-Footnote-326503159
Ref: ライブラリ<189>-Footnote-336503225
Ref: ライブラリ<189>-Footnote-346503291
Ref: ライブラリ<189>-Footnote-356503357
Ref: ライブラリ<189>-Footnote-366503423
Ref: ライブラリ<189>-Footnote-376503489
Ref: ライブラリ<189>-Footnote-386503555
Ref: ライブラリ<189>-Footnote-396503621
Ref: ライブラリ<189>-Footnote-406503687
Ref: ライブラリ<189>-Footnote-416503753
Ref: ライブラリ<189>-Footnote-426503819
Ref: ライブラリ<189>-Footnote-436503862
Ref: ライブラリ<189>-Footnote-446503928
Ref: ライブラリ<189>-Footnote-456503971
Ref: ライブラリ<189>-Footnote-466504037
Ref: ライブラリ<189>-Footnote-476504103
Ref: ライブラリ<189>-Footnote-486504169
Ref: ライブラリ<189>-Footnote-496504235
Ref: ライブラリ<189>-Footnote-506504301
Ref: ライブラリ<189>-Footnote-516504367
Ref: ライブラリ<189>-Footnote-526504433
Ref: ライブラリ<189>-Footnote-536504499
Ref: ライブラリ<189>-Footnote-546504555
Ref: ライブラリ<189>-Footnote-556504621
Ref: ライブラリ<189>-Footnote-566504687
Ref: ライブラリ<189>-Footnote-576504753
Ref: ライブラリ<189>-Footnote-586504819
Ref: ライブラリ<189>-Footnote-596504885
Ref: ライブラリ<189>-Footnote-606504951
Ref: ライブラリ<189>-Footnote-616505017
Ref: ライブラリ<189>-Footnote-626505083
Ref: ライブラリ<189>-Footnote-636505149
Ref: ライブラリ<189>-Footnote-646505215
Ref: ライブラリ<189>-Footnote-656505281
Ref: ライブラリ<189>-Footnote-666505347
Ref: ライブラリ<189>-Footnote-676505413
Ref: ライブラリ<189>-Footnote-686505479
Ref: ライブラリ<189>-Footnote-696505545
Ref: ライブラリ<189>-Footnote-706505611
Ref: ライブラリ<189>-Footnote-716505677
Ref: ライブラリ<189>-Footnote-726505743
Ref: ライブラリ<189>-Footnote-736505809
Ref: ライブラリ<189>-Footnote-746505875
Ref: ライブラリ<189>-Footnote-756505941
Ref: ライブラリ<189>-Footnote-766506007
Ref: ライブラリ<189>-Footnote-776506072
Ref: ライブラリ<189>-Footnote-786506137
Ref: ライブラリ<189>-Footnote-796506203
Ref: ライブラリ<189>-Footnote-806506269
Ref: ライブラリ<189>-Footnote-816506334
Ref: ライブラリ<189>-Footnote-826506400
Node: IDLE<53>6506466
Ref: whatsnew/changelog id9696506577
Ref: 1f6e6506577
Ref: IDLE<53>-Footnote-16507333
Ref: IDLE<53>-Footnote-26507398
Ref: IDLE<53>-Footnote-36507463
Ref: IDLE<53>-Footnote-46507528
Ref: IDLE<53>-Footnote-56507593
Ref: IDLE<53>-Footnote-66507658
Node: C API<74>6507723
Ref: whatsnew/changelog id9706507827
Ref: 1f6f6507827
Ref: C API<74>-Footnote-16508099
Ref: C API<74>-Footnote-26508164
Node: テスト<77>6508229
Ref: whatsnew/changelog id9716508338
Ref: 1f706508338
Ref: テスト<77>-Footnote-16508859
Ref: テスト<77>-Footnote-26508924
Ref: テスト<77>-Footnote-36508989
Ref: テスト<77>-Footnote-46509054
Node: ビルド<88>6509119
Ref: whatsnew/changelog id9726509234
Ref: 1f716509234
Ref: ビルド<88>-Footnote-16510622
Ref: ビルド<88>-Footnote-26510687
Ref: ビルド<88>-Footnote-36510752
Ref: ビルド<88>-Footnote-46510817
Ref: ビルド<88>-Footnote-56510882
Ref: ビルド<88>-Footnote-66510947
Ref: ビルド<88>-Footnote-76511012
Ref: ビルド<88>-Footnote-86511077
Ref: ビルド<88>-Footnote-96511142
Ref: ビルド<88>-Footnote-106511207
Ref: ビルド<88>-Footnote-116511273
Node: Tools/Demos<51>6511339
Ref: whatsnew/changelog id9736511452
Ref: 1f726511452
Ref: Tools/Demos<51>-Footnote-16511727
Node: Windows<75>6511792
Ref: whatsnew/changelog id9746511883
Ref: 1f736511883
Ref: Windows<75>-Footnote-16512850
Ref: Windows<75>-Footnote-26512915
Ref: Windows<75>-Footnote-36512980
Ref: Windows<75>-Footnote-46513044
Ref: Windows<75>-Footnote-56513109
Ref: Windows<75>-Footnote-66513174
Ref: Windows<75>-Footnote-76513238
Ref: Windows<75>-Footnote-86513303
Ref: Windows<75>-Footnote-96513368
Ref: Windows<75>-Footnote-106513433
Ref: Windows<75>-Footnote-116513499
Node: Python 3 6 0 alpha 46513565
Ref: whatsnew/changelog python-3-6-0-alpha-46513691
Ref: 1f746513691
Node: Core and Builtins<187>6513972
Ref: whatsnew/changelog id9756514080
Ref: 1f756514080
Ref: Core and Builtins<187>-Footnote-16516024
Ref: Core and Builtins<187>-Footnote-26516089
Ref: Core and Builtins<187>-Footnote-36516154
Ref: Core and Builtins<187>-Footnote-46516219
Ref: Core and Builtins<187>-Footnote-56516284
Ref: Core and Builtins<187>-Footnote-66516349
Ref: Core and Builtins<187>-Footnote-76516414
Ref: Core and Builtins<187>-Footnote-86516479
Ref: Core and Builtins<187>-Footnote-96516544
Ref: Core and Builtins<187>-Footnote-106516608
Ref: Core and Builtins<187>-Footnote-116516674
Ref: Core and Builtins<187>-Footnote-126516740
Ref: Core and Builtins<187>-Footnote-136516806
Ref: Core and Builtins<187>-Footnote-146516872
Node: ライブラリ<190>6516915
Ref: whatsnew/changelog id9766517040
Ref: 1f766517040
Ref: ライブラリ<190>-Footnote-16521542
Ref: ライブラリ<190>-Footnote-26521607
Ref: ライブラリ<190>-Footnote-36521649
Ref: ライブラリ<190>-Footnote-46521714
Ref: ライブラリ<190>-Footnote-56521779
Ref: ライブラリ<190>-Footnote-66521844
Ref: ライブラリ<190>-Footnote-76521909
Ref: ライブラリ<190>-Footnote-86521974
Ref: ライブラリ<190>-Footnote-96522039
Ref: ライブラリ<190>-Footnote-106522104
Ref: ライブラリ<190>-Footnote-116522170
Ref: ライブラリ<190>-Footnote-126522213
Ref: ライブラリ<190>-Footnote-136522279
Ref: ライブラリ<190>-Footnote-146522345
Ref: ライブラリ<190>-Footnote-156522411
Ref: ライブラリ<190>-Footnote-166522477
Ref: ライブラリ<190>-Footnote-176522542
Ref: ライブラリ<190>-Footnote-186522608
Ref: ライブラリ<190>-Footnote-196522674
Ref: ライブラリ<190>-Footnote-206522740
Ref: ライブラリ<190>-Footnote-216522806
Ref: ライブラリ<190>-Footnote-226522872
Ref: ライブラリ<190>-Footnote-236522938
Ref: ライブラリ<190>-Footnote-246523004
Ref: ライブラリ<190>-Footnote-256523070
Ref: ライブラリ<190>-Footnote-266523136
Ref: ライブラリ<190>-Footnote-276523202
Ref: ライブラリ<190>-Footnote-286523268
Ref: ライブラリ<190>-Footnote-296523327
Ref: ライブラリ<190>-Footnote-306523392
Ref: ライブラリ<190>-Footnote-316523458
Ref: ライブラリ<190>-Footnote-326523524
Ref: ライブラリ<190>-Footnote-336523590
Ref: ライブラリ<190>-Footnote-346523633
Ref: ライブラリ<190>-Footnote-356523699
Ref: ライブラリ<190>-Footnote-366523764
Ref: ライブラリ<190>-Footnote-376523830
Ref: ライブラリ<190>-Footnote-386523896
Ref: ライブラリ<190>-Footnote-396523962
Node: IDLE<54>6524028
Ref: whatsnew/changelog id9776524144
Ref: 1f776524144
Ref: IDLE<54>-Footnote-16525464
Ref: IDLE<54>-Footnote-26525529
Ref: IDLE<54>-Footnote-36525594
Ref: IDLE<54>-Footnote-46525659
Ref: IDLE<54>-Footnote-56525724
Ref: IDLE<54>-Footnote-66525789
Ref: IDLE<54>-Footnote-76525854
Ref: IDLE<54>-Footnote-86525919
Node: テスト<78>6525984
Ref: whatsnew/changelog id9786526091
Ref: 1f786526091
Ref: テスト<78>-Footnote-16526683
Ref: テスト<78>-Footnote-26526748
Ref: テスト<78>-Footnote-36526813
Ref: テスト<78>-Footnote-46526878
Node: Windows<76>6526943
Ref: whatsnew/changelog id9796527055
Ref: 1f796527055
Ref: Windows<76>-Footnote-16527431
Ref: Windows<76>-Footnote-26527496
Ref: Windows<76>-Footnote-36527561
Ref: Windows<76>-Footnote-46527603
Ref: Windows<76>-Footnote-56527668
Node: ビルド<89>6527733
Ref: whatsnew/changelog id9806527823
Ref: 1f7a6527823
Ref: ビルド<89>-Footnote-16528727
Ref: ビルド<89>-Footnote-26528792
Ref: ビルド<89>-Footnote-36528857
Ref: ビルド<89>-Footnote-46528922
Ref: ビルド<89>-Footnote-56528987
Ref: ビルド<89>-Footnote-66529052
Node: Python 3 6 0 alpha 36529117
Ref: whatsnew/changelog python-3-6-0-alpha-36529244
Ref: 1f7b6529244
Node: セキュリティ<59>6529645
Ref: whatsnew/changelog id9816529755
Ref: 1f7c6529755
Ref: セキュリティ<59>-Footnote-16530147
Ref: セキュリティ<59>-Footnote-26530212
Node: Core and Builtins<188>6530277
Ref: whatsnew/changelog id9826530416
Ref: 1f7d6530416
Ref: Core and Builtins<188>-Footnote-16531163
Ref: Core and Builtins<188>-Footnote-26531228
Ref: Core and Builtins<188>-Footnote-36531293
Ref: Core and Builtins<188>-Footnote-46531358
Node: ライブラリ<191>6531423
Ref: whatsnew/changelog id9836531548
Ref: 1f7e6531548
Ref: ライブラリ<191>-Footnote-16535642
Ref: ライブラリ<191>-Footnote-26535707
Ref: ライブラリ<191>-Footnote-36535772
Ref: ライブラリ<191>-Footnote-46535837
Ref: ライブラリ<191>-Footnote-56535902
Ref: ライブラリ<191>-Footnote-66535967
Ref: ライブラリ<191>-Footnote-76536032
Ref: ライブラリ<191>-Footnote-86536097
Ref: ライブラリ<191>-Footnote-96536162
Ref: ライブラリ<191>-Footnote-106536227
Ref: ライブラリ<191>-Footnote-116536293
Ref: ライブラリ<191>-Footnote-126536359
Ref: ライブラリ<191>-Footnote-136536425
Ref: ライブラリ<191>-Footnote-146536491
Ref: ライブラリ<191>-Footnote-156536557
Ref: ライブラリ<191>-Footnote-166536623
Ref: ライブラリ<191>-Footnote-176536689
Ref: ライブラリ<191>-Footnote-186536755
Ref: ライブラリ<191>-Footnote-196536821
Ref: ライブラリ<191>-Footnote-206536887
Ref: ライブラリ<191>-Footnote-216536953
Ref: ライブラリ<191>-Footnote-226536996
Ref: ライブラリ<191>-Footnote-236537062
Ref: ライブラリ<191>-Footnote-246537128
Ref: ライブラリ<191>-Footnote-256537193
Ref: ライブラリ<191>-Footnote-266537259
Node: IDLE<55>6537325
Ref: whatsnew/changelog id9846537437
Ref: 1f7f6537437
Ref: IDLE<55>-Footnote-16539093
Ref: IDLE<55>-Footnote-26539158
Ref: IDLE<55>-Footnote-36539223
Ref: IDLE<55>-Footnote-46539288
Ref: IDLE<55>-Footnote-56539353
Ref: IDLE<55>-Footnote-66539418
Ref: IDLE<55>-Footnote-76539483
Ref: IDLE<55>-Footnote-86539548
Ref: IDLE<55>-Footnote-96539613
Ref: IDLE<55>-Footnote-106539678
Node: C API<75>6539744
Ref: whatsnew/changelog id9856539849
Ref: 1f806539849
Ref: C API<75>-Footnote-16540089
Node: ビルド<90>6540154
Ref: whatsnew/changelog id9866540266
Ref: 1f816540266
Ref: ビルド<90>-Footnote-16541242
Ref: ビルド<90>-Footnote-26541307
Ref: ビルド<90>-Footnote-36541372
Ref: ビルド<90>-Footnote-46541437
Ref: ビルド<90>-Footnote-56541502
Node: Tools/Demos<52>6541567
Ref: whatsnew/changelog id9876541692
Ref: 1f826541692
Ref: Tools/Demos<52>-Footnote-16541976
Ref: Tools/Demos<52>-Footnote-26542041
Node: ドキュメント<78>6542106
Ref: whatsnew/changelog id9886542231
Ref: 1f836542231
Ref: ドキュメント<78>-Footnote-16542612
Ref: ドキュメント<78>-Footnote-26542677
Node: テスト<79>6542742
Ref: whatsnew/changelog id9896542843
Ref: 1f846542843
Ref: テスト<79>-Footnote-16543016
Node: Python 3 6 0 alpha 26543081
Ref: whatsnew/changelog python-3-6-0-alpha-26543208
Ref: 1f856543208
Node: セキュリティ<60>6543635
Ref: whatsnew/changelog id9906543745
Ref: 1f866543745
Ref: セキュリティ<60>-Footnote-16544252
Ref: セキュリティ<60>-Footnote-26544317
Ref: セキュリティ<60>-Footnote-36544372
Ref: セキュリティ<60>-Footnote-46544427
Node: Core and Builtins<189>6544492
Ref: whatsnew/changelog id9916544631
Ref: 1f876544631
Ref: Core and Builtins<189>-Footnote-16546265
Ref: Core and Builtins<189>-Footnote-26546330
Ref: Core and Builtins<189>-Footnote-36546395
Ref: Core and Builtins<189>-Footnote-46546460
Ref: Core and Builtins<189>-Footnote-56546525
Ref: Core and Builtins<189>-Footnote-66546590
Ref: Core and Builtins<189>-Footnote-76546632
Ref: Core and Builtins<189>-Footnote-86546697
Ref: Core and Builtins<189>-Footnote-96546762
Ref: Core and Builtins<189>-Footnote-106546827
Ref: Core and Builtins<189>-Footnote-116546893
Ref: Core and Builtins<189>-Footnote-126546959
Node: ライブラリ<192>6547025
Ref: whatsnew/changelog id9926547150
Ref: 1f886547150
Ref: ライブラリ<192>-Footnote-16552362
Ref: ライブラリ<192>-Footnote-26552427
Ref: ライブラリ<192>-Footnote-36552492
Ref: ライブラリ<192>-Footnote-46552557
Ref: ライブラリ<192>-Footnote-56552622
Ref: ライブラリ<192>-Footnote-66552687
Ref: ライブラリ<192>-Footnote-76552752
Ref: ライブラリ<192>-Footnote-86552817
Ref: ライブラリ<192>-Footnote-96552882
Ref: ライブラリ<192>-Footnote-106552924
Ref: ライブラリ<192>-Footnote-116552990
Ref: ライブラリ<192>-Footnote-126553056
Ref: ライブラリ<192>-Footnote-136553122
Ref: ライブラリ<192>-Footnote-146553165
Ref: ライブラリ<192>-Footnote-156553231
Ref: ライブラリ<192>-Footnote-166553274
Ref: ライブラリ<192>-Footnote-176553317
Ref: ライブラリ<192>-Footnote-186553383
Ref: ライブラリ<192>-Footnote-196553449
Ref: ライブラリ<192>-Footnote-206553515
Ref: ライブラリ<192>-Footnote-216553581
Ref: ライブラリ<192>-Footnote-226553647
Ref: ライブラリ<192>-Footnote-236553713
Ref: ライブラリ<192>-Footnote-246553779
Ref: ライブラリ<192>-Footnote-256553845
Ref: ライブラリ<192>-Footnote-266553911
Ref: ライブラリ<192>-Footnote-276553977
Ref: ライブラリ<192>-Footnote-286554043
Ref: ライブラリ<192>-Footnote-296554109
Ref: ライブラリ<192>-Footnote-306554175
Ref: ライブラリ<192>-Footnote-316554241
Ref: ライブラリ<192>-Footnote-326554307
Ref: ライブラリ<192>-Footnote-336554373
Ref: ライブラリ<192>-Footnote-346554439
Ref: ライブラリ<192>-Footnote-356554505
Node: IDLE<56>6554571
Ref: whatsnew/changelog id9936554696
Ref: 1f896554696
Ref: IDLE<56>-Footnote-16557337
Ref: IDLE<56>-Footnote-26557401
Ref: IDLE<56>-Footnote-36557466
Ref: IDLE<56>-Footnote-46557531
Ref: IDLE<56>-Footnote-56557596
Ref: IDLE<56>-Footnote-66557661
Ref: IDLE<56>-Footnote-76557726
Ref: IDLE<56>-Footnote-86557791
Ref: IDLE<56>-Footnote-96557856
Ref: IDLE<56>-Footnote-106557921
Ref: IDLE<56>-Footnote-116557987
Ref: IDLE<56>-Footnote-126558053
Ref: IDLE<56>-Footnote-136558119
Ref: IDLE<56>-Footnote-146558185
Ref: IDLE<56>-Footnote-156558251
Ref: IDLE<56>-Footnote-166558317
Ref: IDLE<56>-Footnote-176558383
Ref: IDLE<56>-Footnote-186558449
Ref: IDLE<56>-Footnote-196558515
Node: ドキュメント<79>6558581
Ref: whatsnew/changelog id9946558699
Ref: 1f8a6558699
Ref: ドキュメント<79>-Footnote-16559148
Ref: ドキュメント<79>-Footnote-26559213
Ref: ドキュメント<79>-Footnote-36559278
Ref: ドキュメント<79>-Footnote-46559320
Node: テスト<80>6559385
Ref: whatsnew/changelog id9956559506
Ref: 1f8b6559506
Ref: テスト<80>-Footnote-16559893
Ref: テスト<80>-Footnote-26559958
Node: Windows<77>6560023
Ref: whatsnew/changelog id9966560135
Ref: 1f8c6560135
Ref: Windows<77>-Footnote-16560547
Ref: Windows<77>-Footnote-26560612
Node: ビルド<91>6560677
Ref: whatsnew/changelog id9976560785
Ref: 1f8d6560785
Ref: ビルド<91>-Footnote-16561069
Ref: ビルド<91>-Footnote-26561134
Node: C API<76>6561199
Ref: whatsnew/changelog id9986561311
Ref: 1f8e6561311
Ref: C API<76>-Footnote-16561551
Ref: C API<76>-Footnote-26561616
Ref: C API<76>-Footnote-36561658
Node: Tools/Demos<53>6561723
Ref: whatsnew/changelog id9996561813
Ref: 1f8f6561813
Ref: Tools/Demos<53>-Footnote-16562013
Node: Python 3 6 0 alpha 16562078
Ref: whatsnew/changelog python-3-6-0-alpha-16562203
Ref: 1f906562203
Node: セキュリティ<61>6562630
Ref: whatsnew/changelog id10006562740
Ref: 1f916562740
Ref: セキュリティ<61>-Footnote-16563247
Ref: セキュリティ<61>-Footnote-26563312
Ref: セキュリティ<61>-Footnote-36563377
Node: Core and Builtins<190>6563442
Ref: whatsnew/changelog id10016563581
Ref: 1f926563581
Ref: Core and Builtins<190>-Footnote-16576724
Ref: Core and Builtins<190>-Footnote-26576789
Ref: Core and Builtins<190>-Footnote-36576854
Ref: Core and Builtins<190>-Footnote-46576919
Ref: Core and Builtins<190>-Footnote-56576984
Ref: Core and Builtins<190>-Footnote-66577049
Ref: Core and Builtins<190>-Footnote-76577114
Ref: Core and Builtins<190>-Footnote-86577179
Ref: Core and Builtins<190>-Footnote-96577244
Ref: Core and Builtins<190>-Footnote-106577309
Ref: Core and Builtins<190>-Footnote-116577375
Ref: Core and Builtins<190>-Footnote-126577441
Ref: Core and Builtins<190>-Footnote-136577507
Ref: Core and Builtins<190>-Footnote-146577573
Ref: Core and Builtins<190>-Footnote-156577639
Ref: Core and Builtins<190>-Footnote-166577705
Ref: Core and Builtins<190>-Footnote-176577748
Ref: Core and Builtins<190>-Footnote-186577814
Ref: Core and Builtins<190>-Footnote-196577880
Ref: Core and Builtins<190>-Footnote-206577946
Ref: Core and Builtins<190>-Footnote-216578012
Ref: Core and Builtins<190>-Footnote-226578078
Ref: Core and Builtins<190>-Footnote-236578144
Ref: Core and Builtins<190>-Footnote-246578187
Ref: Core and Builtins<190>-Footnote-256578253
Ref: Core and Builtins<190>-Footnote-266578319
Ref: Core and Builtins<190>-Footnote-276578385
Ref: Core and Builtins<190>-Footnote-286578451
Ref: Core and Builtins<190>-Footnote-296578517
Ref: Core and Builtins<190>-Footnote-306578583
Ref: Core and Builtins<190>-Footnote-316578649
Ref: Core and Builtins<190>-Footnote-326578715
Ref: Core and Builtins<190>-Footnote-336578781
Ref: Core and Builtins<190>-Footnote-346578847
Ref: Core and Builtins<190>-Footnote-356578913
Ref: Core and Builtins<190>-Footnote-366578979
Ref: Core and Builtins<190>-Footnote-376579044
Ref: Core and Builtins<190>-Footnote-386579110
Ref: Core and Builtins<190>-Footnote-396579176
Ref: Core and Builtins<190>-Footnote-406579242
Ref: Core and Builtins<190>-Footnote-416579308
Ref: Core and Builtins<190>-Footnote-426579374
Ref: Core and Builtins<190>-Footnote-436579440
Ref: Core and Builtins<190>-Footnote-446579506
Ref: Core and Builtins<190>-Footnote-456579572
Ref: Core and Builtins<190>-Footnote-466579638
Ref: Core and Builtins<190>-Footnote-476579704
Ref: Core and Builtins<190>-Footnote-486579770
Ref: Core and Builtins<190>-Footnote-496579836
Ref: Core and Builtins<190>-Footnote-506579902
Ref: Core and Builtins<190>-Footnote-516579968
Ref: Core and Builtins<190>-Footnote-526580034
Ref: Core and Builtins<190>-Footnote-536580099
Ref: Core and Builtins<190>-Footnote-546580165
Ref: Core and Builtins<190>-Footnote-556580231
Ref: Core and Builtins<190>-Footnote-566580297
Ref: Core and Builtins<190>-Footnote-576580363
Ref: Core and Builtins<190>-Footnote-586580429
Ref: Core and Builtins<190>-Footnote-596580495
Ref: Core and Builtins<190>-Footnote-606580561
Ref: Core and Builtins<190>-Footnote-616580627
Ref: Core and Builtins<190>-Footnote-626580693
Ref: Core and Builtins<190>-Footnote-636580759
Ref: Core and Builtins<190>-Footnote-646580825
Ref: Core and Builtins<190>-Footnote-656580891
Ref: Core and Builtins<190>-Footnote-666580957
Ref: Core and Builtins<190>-Footnote-676581023
Ref: Core and Builtins<190>-Footnote-686581089
Ref: Core and Builtins<190>-Footnote-696581155
Ref: Core and Builtins<190>-Footnote-706581221
Ref: Core and Builtins<190>-Footnote-716581287
Ref: Core and Builtins<190>-Footnote-726581353
Ref: Core and Builtins<190>-Footnote-736581419
Ref: Core and Builtins<190>-Footnote-746581485
Ref: Core and Builtins<190>-Footnote-756581551
Ref: Core and Builtins<190>-Footnote-766581617
Ref: Core and Builtins<190>-Footnote-776581683
Ref: Core and Builtins<190>-Footnote-786581749
Ref: Core and Builtins<190>-Footnote-796581814
Ref: Core and Builtins<190>-Footnote-806581880
Ref: Core and Builtins<190>-Footnote-816581923
Ref: Core and Builtins<190>-Footnote-826581989
Ref: Core and Builtins<190>-Footnote-836582055
Ref: Core and Builtins<190>-Footnote-846582121
Ref: Core and Builtins<190>-Footnote-856582187
Ref: Core and Builtins<190>-Footnote-866582253
Ref: Core and Builtins<190>-Footnote-876582319
Node: ライブラリ<193>6582385
Ref: whatsnew/changelog id10026582510
Ref: 1f946582510
Ref: ライブラリ<193>-Footnote-16613442
Ref: ライブラリ<193>-Footnote-26613507
Ref: ライブラリ<193>-Footnote-36613572
Ref: ライブラリ<193>-Footnote-46613637
Ref: ライブラリ<193>-Footnote-56613702
Ref: ライブラリ<193>-Footnote-66613767
Ref: ライブラリ<193>-Footnote-76613832
Ref: ライブラリ<193>-Footnote-86613897
Ref: ライブラリ<193>-Footnote-96613962
Ref: ライブラリ<193>-Footnote-106614027
Ref: ライブラリ<193>-Footnote-116614093
Ref: ライブラリ<193>-Footnote-126614159
Ref: ライブラリ<193>-Footnote-136614225
Ref: ライブラリ<193>-Footnote-146614291
Ref: ライブラリ<193>-Footnote-156614357
Ref: ライブラリ<193>-Footnote-166614423
Ref: ライブラリ<193>-Footnote-176614489
Ref: ライブラリ<193>-Footnote-186614555
Ref: ライブラリ<193>-Footnote-196614598
Ref: ライブラリ<193>-Footnote-206614664
Ref: ライブラリ<193>-Footnote-216614730
Ref: ライブラリ<193>-Footnote-226614796
Ref: ライブラリ<193>-Footnote-236614862
Ref: ライブラリ<193>-Footnote-246614928
Ref: ライブラリ<193>-Footnote-256614994
Ref: ライブラリ<193>-Footnote-266615060
Ref: ライブラリ<193>-Footnote-276615126
Ref: ライブラリ<193>-Footnote-286615192
Ref: ライブラリ<193>-Footnote-296615258
Ref: ライブラリ<193>-Footnote-306615324
Ref: ライブラリ<193>-Footnote-316615390
Ref: ライブラリ<193>-Footnote-326615456
Ref: ライブラリ<193>-Footnote-336615522
Ref: ライブラリ<193>-Footnote-346615588
Ref: ライブラリ<193>-Footnote-356615654
Ref: ライブラリ<193>-Footnote-366615720
Ref: ライブラリ<193>-Footnote-376615786
Ref: ライブラリ<193>-Footnote-386615852
Ref: ライブラリ<193>-Footnote-396615918
Ref: ライブラリ<193>-Footnote-406615984
Ref: ライブラリ<193>-Footnote-416616050
Ref: ライブラリ<193>-Footnote-426616116
Ref: ライブラリ<193>-Footnote-436616182
Ref: ライブラリ<193>-Footnote-446616248
Ref: ライブラリ<193>-Footnote-456616314
Ref: ライブラリ<193>-Footnote-466616380
Ref: ライブラリ<193>-Footnote-476616446
Ref: ライブラリ<193>-Footnote-486616512
Ref: ライブラリ<193>-Footnote-496616578
Ref: ライブラリ<193>-Footnote-506616644
Ref: ライブラリ<193>-Footnote-516616710
Ref: ライブラリ<193>-Footnote-526616776
Ref: ライブラリ<193>-Footnote-536616842
Ref: ライブラリ<193>-Footnote-546616908
Ref: ライブラリ<193>-Footnote-556616974
Ref: ライブラリ<193>-Footnote-566617040
Ref: ライブラリ<193>-Footnote-576617106
Ref: ライブラリ<193>-Footnote-586617172
Ref: ライブラリ<193>-Footnote-596617238
Ref: ライブラリ<193>-Footnote-606617304
Ref: ライブラリ<193>-Footnote-616617370
Ref: ライブラリ<193>-Footnote-626617436
Ref: ライブラリ<193>-Footnote-636617502
Ref: ライブラリ<193>-Footnote-646617568
Ref: ライブラリ<193>-Footnote-656617634
Ref: ライブラリ<193>-Footnote-666617700
Ref: ライブラリ<193>-Footnote-676617766
Ref: ライブラリ<193>-Footnote-686617832
Ref: ライブラリ<193>-Footnote-696617898
Ref: ライブラリ<193>-Footnote-706617964
Ref: ライブラリ<193>-Footnote-716618030
Ref: ライブラリ<193>-Footnote-726618096
Ref: ライブラリ<193>-Footnote-736618162
Ref: ライブラリ<193>-Footnote-746618228
Ref: ライブラリ<193>-Footnote-756618294
Ref: ライブラリ<193>-Footnote-766618360
Ref: ライブラリ<193>-Footnote-776618426
Ref: ライブラリ<193>-Footnote-786618492
Ref: ライブラリ<193>-Footnote-796618558
Ref: ライブラリ<193>-Footnote-806618624
Ref: ライブラリ<193>-Footnote-816618689
Ref: ライブラリ<193>-Footnote-826618755
Ref: ライブラリ<193>-Footnote-836618821
Ref: ライブラリ<193>-Footnote-846618887
Ref: ライブラリ<193>-Footnote-856618953
Ref: ライブラリ<193>-Footnote-866619019
Ref: ライブラリ<193>-Footnote-876619085
Ref: ライブラリ<193>-Footnote-886619151
Ref: ライブラリ<193>-Footnote-896619217
Ref: ライブラリ<193>-Footnote-906619283
Ref: ライブラリ<193>-Footnote-916619349
Ref: ライブラリ<193>-Footnote-926619415
Ref: ライブラリ<193>-Footnote-936619481
Ref: ライブラリ<193>-Footnote-946619547
Ref: ライブラリ<193>-Footnote-956619613
Ref: ライブラリ<193>-Footnote-966619679
Ref: ライブラリ<193>-Footnote-976619745
Ref: ライブラリ<193>-Footnote-986619811
Ref: ライブラリ<193>-Footnote-996619877
Ref: ライブラリ<193>-Footnote-1006619943
Ref: ライブラリ<193>-Footnote-1016620010
Ref: ライブラリ<193>-Footnote-1026620077
Ref: ライブラリ<193>-Footnote-1036620144
Ref: ライブラリ<193>-Footnote-1046620211
Ref: ライブラリ<193>-Footnote-1056620278
Ref: ライブラリ<193>-Footnote-1066620345
Ref: ライブラリ<193>-Footnote-1076620412
Ref: ライブラリ<193>-Footnote-1086620479
Ref: ライブラリ<193>-Footnote-1096620546
Ref: ライブラリ<193>-Footnote-1106620613
Ref: ライブラリ<193>-Footnote-1116620680
Ref: ライブラリ<193>-Footnote-1126620747
Ref: ライブラリ<193>-Footnote-1136620814
Ref: ライブラリ<193>-Footnote-1146620881
Ref: ライブラリ<193>-Footnote-1156620948
Ref: ライブラリ<193>-Footnote-1166621015
Ref: ライブラリ<193>-Footnote-1176621082
Ref: ライブラリ<193>-Footnote-1186621149
Ref: ライブラリ<193>-Footnote-1196621216
Ref: ライブラリ<193>-Footnote-1206621283
Ref: ライブラリ<193>-Footnote-1216621350
Ref: ライブラリ<193>-Footnote-1226621417
Ref: ライブラリ<193>-Footnote-1236621484
Ref: ライブラリ<193>-Footnote-1246621551
Ref: ライブラリ<193>-Footnote-1256621618
Ref: ライブラリ<193>-Footnote-1266621685
Ref: ライブラリ<193>-Footnote-1276621752
Ref: ライブラリ<193>-Footnote-1286621819
Ref: ライブラリ<193>-Footnote-1296621886
Ref: ライブラリ<193>-Footnote-1306621953
Ref: ライブラリ<193>-Footnote-1316622020
Ref: ライブラリ<193>-Footnote-1326622087
Ref: ライブラリ<193>-Footnote-1336622154
Ref: ライブラリ<193>-Footnote-1346622221
Ref: ライブラリ<193>-Footnote-1356622288
Ref: ライブラリ<193>-Footnote-1366622355
Ref: ライブラリ<193>-Footnote-1376622422
Ref: ライブラリ<193>-Footnote-1386622489
Ref: ライブラリ<193>-Footnote-1396622556
Ref: ライブラリ<193>-Footnote-1406622623
Ref: ライブラリ<193>-Footnote-1416622690
Ref: ライブラリ<193>-Footnote-1426622757
Ref: ライブラリ<193>-Footnote-1436622824
Ref: ライブラリ<193>-Footnote-1446622891
Ref: ライブラリ<193>-Footnote-1456622957
Ref: ライブラリ<193>-Footnote-1466623024
Ref: ライブラリ<193>-Footnote-1476623091
Ref: ライブラリ<193>-Footnote-1486623158
Ref: ライブラリ<193>-Footnote-1496623225
Ref: ライブラリ<193>-Footnote-1506623292
Ref: ライブラリ<193>-Footnote-1516623358
Ref: ライブラリ<193>-Footnote-1526623425
Ref: ライブラリ<193>-Footnote-1536623492
Ref: ライブラリ<193>-Footnote-1546623559
Ref: ライブラリ<193>-Footnote-1556623626
Ref: ライブラリ<193>-Footnote-1566623693
Ref: ライブラリ<193>-Footnote-1576623760
Ref: ライブラリ<193>-Footnote-1586623827
Ref: ライブラリ<193>-Footnote-1596623894
Ref: ライブラリ<193>-Footnote-1606623961
Ref: ライブラリ<193>-Footnote-1616624027
Ref: ライブラリ<193>-Footnote-1626624094
Ref: ライブラリ<193>-Footnote-1636624161
Ref: ライブラリ<193>-Footnote-1646624228
Ref: ライブラリ<193>-Footnote-1656624295
Ref: ライブラリ<193>-Footnote-1666624362
Ref: ライブラリ<193>-Footnote-1676624429
Ref: ライブラリ<193>-Footnote-1686624496
Ref: ライブラリ<193>-Footnote-1696624563
Ref: ライブラリ<193>-Footnote-1706624630
Ref: ライブラリ<193>-Footnote-1716624697
Ref: ライブラリ<193>-Footnote-1726624764
Ref: ライブラリ<193>-Footnote-1736624831
Ref: ライブラリ<193>-Footnote-1746624898
Ref: ライブラリ<193>-Footnote-1756624965
Ref: ライブラリ<193>-Footnote-1766625032
Ref: ライブラリ<193>-Footnote-1776625099
Ref: ライブラリ<193>-Footnote-1786625166
Ref: ライブラリ<193>-Footnote-1796625233
Ref: ライブラリ<193>-Footnote-1806625300
Ref: ライブラリ<193>-Footnote-1816625367
Ref: ライブラリ<193>-Footnote-1826625434
Ref: ライブラリ<193>-Footnote-1836625501
Ref: ライブラリ<193>-Footnote-1846625568
Ref: ライブラリ<193>-Footnote-1856625635
Ref: ライブラリ<193>-Footnote-1866625702
Ref: ライブラリ<193>-Footnote-1876625769
Ref: ライブラリ<193>-Footnote-1886625836
Ref: ライブラリ<193>-Footnote-1896625903
Ref: ライブラリ<193>-Footnote-1906625970
Ref: ライブラリ<193>-Footnote-1916626037
Ref: ライブラリ<193>-Footnote-1926626104
Ref: ライブラリ<193>-Footnote-1936626171
Ref: ライブラリ<193>-Footnote-1946626238
Ref: ライブラリ<193>-Footnote-1956626305
Ref: ライブラリ<193>-Footnote-1966626372
Ref: ライブラリ<193>-Footnote-1976626439
Ref: ライブラリ<193>-Footnote-1986626506
Ref: ライブラリ<193>-Footnote-1996626573
Ref: ライブラリ<193>-Footnote-2006626640
Ref: ライブラリ<193>-Footnote-2016626707
Ref: ライブラリ<193>-Footnote-2026626774
Ref: ライブラリ<193>-Footnote-2036626841
Ref: ライブラリ<193>-Footnote-2046626908
Ref: ライブラリ<193>-Footnote-2056626975
Ref: ライブラリ<193>-Footnote-2066627042
Ref: ライブラリ<193>-Footnote-2076627109
Ref: ライブラリ<193>-Footnote-2086627176
Ref: ライブラリ<193>-Footnote-2096627242
Ref: ライブラリ<193>-Footnote-2106627308
Ref: ライブラリ<193>-Footnote-2116627375
Ref: ライブラリ<193>-Footnote-2126627442
Ref: ライブラリ<193>-Footnote-2136627509
Ref: ライブラリ<193>-Footnote-2146627576
Ref: ライブラリ<193>-Footnote-2156627643
Ref: ライブラリ<193>-Footnote-2166627710
Ref: ライブラリ<193>-Footnote-2176627777
Ref: ライブラリ<193>-Footnote-2186627844
Ref: ライブラリ<193>-Footnote-2196627911
Ref: ライブラリ<193>-Footnote-2206627978
Ref: ライブラリ<193>-Footnote-2216628045
Ref: ライブラリ<193>-Footnote-2226628112
Ref: ライブラリ<193>-Footnote-2236628179
Ref: ライブラリ<193>-Footnote-2246628246
Node: IDLE<57>6628313
Ref: whatsnew/changelog id10036628438
Ref: 1f966628438
Ref: IDLE<57>-Footnote-16633971
Ref: IDLE<57>-Footnote-26634036
Ref: IDLE<57>-Footnote-36634101
Ref: IDLE<57>-Footnote-46634166
Ref: IDLE<57>-Footnote-56634231
Ref: IDLE<57>-Footnote-66634296
Ref: IDLE<57>-Footnote-76634361
Ref: IDLE<57>-Footnote-86634426
Ref: IDLE<57>-Footnote-96634491
Ref: IDLE<57>-Footnote-106634556
Ref: IDLE<57>-Footnote-116634622
Ref: IDLE<57>-Footnote-126634688
Ref: IDLE<57>-Footnote-136634754
Ref: IDLE<57>-Footnote-146634820
Ref: IDLE<57>-Footnote-156634886
Ref: IDLE<57>-Footnote-166634952
Ref: IDLE<57>-Footnote-176635018
Ref: IDLE<57>-Footnote-186635084
Ref: IDLE<57>-Footnote-196635150
Ref: IDLE<57>-Footnote-206635216
Ref: IDLE<57>-Footnote-216635282
Ref: IDLE<57>-Footnote-226635348
Ref: IDLE<57>-Footnote-236635414
Ref: IDLE<57>-Footnote-246635480
Ref: IDLE<57>-Footnote-256635546
Ref: IDLE<57>-Footnote-266635612
Ref: IDLE<57>-Footnote-276635678
Ref: IDLE<57>-Footnote-286635744
Node: ドキュメント<80>6635810
Ref: whatsnew/changelog id10046635928
Ref: 1f976635928
Ref: ドキュメント<80>-Footnote-16636718
Ref: ドキュメント<80>-Footnote-26636783
Ref: ドキュメント<80>-Footnote-36636847
Ref: ドキュメント<80>-Footnote-46636912
Ref: ドキュメント<80>-Footnote-56636977
Node: テスト<81>6637042
Ref: whatsnew/changelog id10056637165
Ref: 1f986637165
Ref: テスト<81>-Footnote-16638915
Ref: テスト<81>-Footnote-26638980
Ref: テスト<81>-Footnote-36639045
Ref: テスト<81>-Footnote-46639110
Ref: テスト<81>-Footnote-56639175
Ref: テスト<81>-Footnote-66639240
Ref: テスト<81>-Footnote-76639305
Ref: テスト<81>-Footnote-86639370
Ref: テスト<81>-Footnote-96639435
Ref: テスト<81>-Footnote-106639500
Ref: テスト<81>-Footnote-116639566
Ref: テスト<81>-Footnote-126639632
Ref: テスト<81>-Footnote-136639698
Node: ビルド<92>6639764
Ref: whatsnew/changelog id10066639876
Ref: 1f996639876
Ref: ビルド<92>-Footnote-16642607
Ref: ビルド<92>-Footnote-26642672
Ref: ビルド<92>-Footnote-36642737
Ref: ビルド<92>-Footnote-46642802
Ref: ビルド<92>-Footnote-56642867
Ref: ビルド<92>-Footnote-66642932
Ref: ビルド<92>-Footnote-76642997
Ref: ビルド<92>-Footnote-86643062
Ref: ビルド<92>-Footnote-96643127
Ref: ビルド<92>-Footnote-106643192
Ref: ビルド<92>-Footnote-116643258
Ref: ビルド<92>-Footnote-126643324
Ref: ビルド<92>-Footnote-136643390
Ref: ビルド<92>-Footnote-146643456
Ref: ビルド<92>-Footnote-156643522
Ref: ビルド<92>-Footnote-166643588
Ref: ビルド<92>-Footnote-176643654
Ref: ビルド<92>-Footnote-186643720
Ref: ビルド<92>-Footnote-196643786
Node: Windows<78>6643852
Ref: whatsnew/changelog id10076643966
Ref: 1f9a6643966
Ref: Windows<78>-Footnote-16644614
Ref: Windows<78>-Footnote-26644679
Ref: Windows<78>-Footnote-36644744
Ref: Windows<78>-Footnote-46644809
Ref: Windows<78>-Footnote-56644874
Ref: Windows<78>-Footnote-66644939
Node: Tools/Demos<54>6645004
Ref: whatsnew/changelog id10086645114
Ref: 1f9b6645114
Ref: Tools/Demos<54>-Footnote-16645902
Ref: Tools/Demos<54>-Footnote-26645967
Ref: Tools/Demos<54>-Footnote-36646032
Ref: Tools/Demos<54>-Footnote-46646097
Ref: Tools/Demos<54>-Footnote-56646162
Ref: Tools/Demos<54>-Footnote-66646227
Node: C API<77>6646292
Ref: whatsnew/changelog id10096646382
Ref: 1f9c6646382
Ref: C API<77>-Footnote-16646873
Ref: C API<77>-Footnote-26646938
Node: Python 3 5 5 final6647003
Ref: whatsnew/changelog python-3-5-5-final6647140
Ref: 1f9d6647140
Node: Python 3 5 5 release candidate 16647270
Ref: whatsnew/changelog python-3-5-5-release-candidate-16647405
Ref: 1f9e6647405
Node: セキュリティ<62>6647660
Ref: whatsnew/changelog id10106647782
Ref: 1f9f6647782
Ref: セキュリティ<62>-Footnote-16649067
Ref: セキュリティ<62>-Footnote-26649132
Ref: セキュリティ<62>-Footnote-36649197
Ref: セキュリティ<62>-Footnote-46649262
Ref: セキュリティ<62>-Footnote-56649327
Ref: セキュリティ<62>-Footnote-66649385
Node: Core and Builtins<191>6649450
Ref: whatsnew/changelog id10116649601
Ref: 1fa06649601
Ref: Core and Builtins<191>-Footnote-16649826
Node: ライブラリ<194>6649891
Ref: whatsnew/changelog id10126650011
Ref: 1fa16650011
Ref: ライブラリ<194>-Footnote-16650551
Ref: ライブラリ<194>-Footnote-26650616
Node: Python 3 5 4 final6650681
Ref: whatsnew/changelog python-3-5-4-final6650830
Ref: 1fa26650830
Node: ライブラリ<195>6650966
Ref: whatsnew/changelog id10136651041
Ref: 1fa36651041
Ref: ライブラリ<195>-Footnote-16651252
Node: Python 3 5 4 release candidate 16651317
Ref: whatsnew/changelog python-3-5-4-release-candidate-16651452
Ref: 1fa46651452
Node: セキュリティ<63>6651853
Ref: whatsnew/changelog id10146651975
Ref: 1fa56651975
Ref: セキュリティ<63>-Footnote-16653313
Ref: セキュリティ<63>-Footnote-26653378
Ref: セキュリティ<63>-Footnote-36653443
Ref: セキュリティ<63>-Footnote-46653498
Ref: セキュリティ<63>-Footnote-56653553
Ref: セキュリティ<63>-Footnote-66653608
Ref: セキュリティ<63>-Footnote-76653663
Ref: セキュリティ<63>-Footnote-86653718
Ref: セキュリティ<63>-Footnote-96653773
Ref: セキュリティ<63>-Footnote-106653838
Ref: セキュリティ<63>-Footnote-116653904
Ref: セキュリティ<63>-Footnote-126653960
Node: Core and Builtins<192>6654016
Ref: whatsnew/changelog id10156654167
Ref: 1fa66654167
Ref: Core and Builtins<192>-Footnote-16656424
Ref: Core and Builtins<192>-Footnote-26656489
Ref: Core and Builtins<192>-Footnote-36656554
Ref: Core and Builtins<192>-Footnote-46656619
Ref: Core and Builtins<192>-Footnote-56656684
Ref: Core and Builtins<192>-Footnote-66656749
Ref: Core and Builtins<192>-Footnote-76656814
Ref: Core and Builtins<192>-Footnote-86656879
Ref: Core and Builtins<192>-Footnote-96656944
Ref: Core and Builtins<192>-Footnote-106657009
Ref: Core and Builtins<192>-Footnote-116657075
Ref: Core and Builtins<192>-Footnote-126657141
Ref: Core and Builtins<192>-Footnote-136657207
Ref: Core and Builtins<192>-Footnote-146657273
Ref: Core and Builtins<192>-Footnote-156657339
Node: ライブラリ<196>6657405
Ref: whatsnew/changelog id10166657556
Ref: 1fa76657556
Ref: ライブラリ<196>-Footnote-16667730
Ref: ライブラリ<196>-Footnote-26667795
Ref: ライブラリ<196>-Footnote-36667860
Ref: ライブラリ<196>-Footnote-46667925
Ref: ライブラリ<196>-Footnote-56667990
Ref: ライブラリ<196>-Footnote-66668055
Ref: ライブラリ<196>-Footnote-76668120
Ref: ライブラリ<196>-Footnote-86668185
Ref: ライブラリ<196>-Footnote-96668250
Ref: ライブラリ<196>-Footnote-106668315
Ref: ライブラリ<196>-Footnote-116668381
Ref: ライブラリ<196>-Footnote-126668447
Ref: ライブラリ<196>-Footnote-136668513
Ref: ライブラリ<196>-Footnote-146668579
Ref: ライブラリ<196>-Footnote-156668645
Ref: ライブラリ<196>-Footnote-166668711
Ref: ライブラリ<196>-Footnote-176668777
Ref: ライブラリ<196>-Footnote-186668843
Ref: ライブラリ<196>-Footnote-196668909
Ref: ライブラリ<196>-Footnote-206668975
Ref: ライブラリ<196>-Footnote-216669041
Ref: ライブラリ<196>-Footnote-226669107
Ref: ライブラリ<196>-Footnote-236669173
Ref: ライブラリ<196>-Footnote-246669239
Ref: ライブラリ<196>-Footnote-256669305
Ref: ライブラリ<196>-Footnote-266669371
Ref: ライブラリ<196>-Footnote-276669437
Ref: ライブラリ<196>-Footnote-286669503
Ref: ライブラリ<196>-Footnote-296669569
Ref: ライブラリ<196>-Footnote-306669635
Ref: ライブラリ<196>-Footnote-316669701
Ref: ライブラリ<196>-Footnote-326669767
Ref: ライブラリ<196>-Footnote-336669833
Ref: ライブラリ<196>-Footnote-346669899
Ref: ライブラリ<196>-Footnote-356669965
Ref: ライブラリ<196>-Footnote-366670031
Ref: ライブラリ<196>-Footnote-376670097
Ref: ライブラリ<196>-Footnote-386670163
Ref: ライブラリ<196>-Footnote-396670229
Ref: ライブラリ<196>-Footnote-406670295
Ref: ライブラリ<196>-Footnote-416670361
Ref: ライブラリ<196>-Footnote-426670427
Ref: ライブラリ<196>-Footnote-436670493
Ref: ライブラリ<196>-Footnote-446670559
Ref: ライブラリ<196>-Footnote-456670625
Ref: ライブラリ<196>-Footnote-466670691
Ref: ライブラリ<196>-Footnote-476670757
Ref: ライブラリ<196>-Footnote-486670823
Ref: ライブラリ<196>-Footnote-496670889
Ref: ライブラリ<196>-Footnote-506670955
Ref: ライブラリ<196>-Footnote-516671021
Ref: ライブラリ<196>-Footnote-526671087
Ref: ライブラリ<196>-Footnote-536671153
Ref: ライブラリ<196>-Footnote-546671219
Ref: ライブラリ<196>-Footnote-556671284
Ref: ライブラリ<196>-Footnote-566671350
Ref: ライブラリ<196>-Footnote-576671416
Ref: ライブラリ<196>-Footnote-586671482
Ref: ライブラリ<196>-Footnote-596671548
Ref: ライブラリ<196>-Footnote-606671614
Ref: ライブラリ<196>-Footnote-616671680
Ref: ライブラリ<196>-Footnote-626671746
Ref: ライブラリ<196>-Footnote-636671812
Ref: ライブラリ<196>-Footnote-646671878
Ref: ライブラリ<196>-Footnote-656671944
Ref: ライブラリ<196>-Footnote-666672010
Ref: ライブラリ<196>-Footnote-676672076
Ref: ライブラリ<196>-Footnote-686672142
Ref: ライブラリ<196>-Footnote-696672208
Ref: ライブラリ<196>-Footnote-706672274
Ref: ライブラリ<196>-Footnote-716672340
Ref: ライブラリ<196>-Footnote-726672406
Ref: ライブラリ<196>-Footnote-736672472
Ref: ライブラリ<196>-Footnote-746672538
Node: ドキュメント<81>6672604
Ref: whatsnew/changelog id10176672746
Ref: 1fa86672746
Ref: ドキュメント<81>-Footnote-16673462
Ref: ドキュメント<81>-Footnote-26673527
Ref: ドキュメント<81>-Footnote-36673592
Ref: ドキュメント<81>-Footnote-46673657
Ref: ドキュメント<81>-Footnote-56673722
Ref: ドキュメント<81>-Footnote-66673787
Node: テスト<82>6673852
Ref: whatsnew/changelog id10186673987
Ref: 1fa96673987
Ref: テスト<82>-Footnote-16676071
Ref: テスト<82>-Footnote-26676136
Ref: テスト<82>-Footnote-36676201
Ref: テスト<82>-Footnote-46676266
Ref: テスト<82>-Footnote-56676331
Ref: テスト<82>-Footnote-66676396
Ref: テスト<82>-Footnote-76676461
Ref: テスト<82>-Footnote-86676526
Ref: テスト<82>-Footnote-96676591
Node: ビルド<93>6676656
Ref: whatsnew/changelog id10196676780
Ref: 1faa6676780
Ref: ビルド<93>-Footnote-16677299
Ref: ビルド<93>-Footnote-26677364
Ref: ビルド<93>-Footnote-36677429
Node: Windows<79>6677494
Ref: whatsnew/changelog id10206677614
Ref: 1fab6677614
Ref: Windows<79>-Footnote-16677874
Ref: Windows<79>-Footnote-26677939
Node: C API<78>6678004
Ref: whatsnew/changelog id10216678102
Ref: 1fac6678102
Ref: C API<78>-Footnote-16678711
Ref: C API<78>-Footnote-26678776
Node: Python 3 5 3 final6678841
Ref: whatsnew/changelog python-3-5-3-final6678990
Ref: 1fad6678990
Node: Python 3 5 3 release candidate 16679137
Ref: whatsnew/changelog python-3-5-3-release-candidate-16679272
Ref: 1fae6679272
Node: セキュリティ<64>6679723
Ref: whatsnew/changelog id10226679845
Ref: 1faf6679845
Ref: セキュリティ<64>-Footnote-16680239
Ref: セキュリティ<64>-Footnote-26680304
Node: Core and Builtins<193>6680369
Ref: whatsnew/changelog id10236680520
Ref: 1fb06680520
Ref: Core and Builtins<193>-Footnote-16685952
Ref: Core and Builtins<193>-Footnote-26686017
Ref: Core and Builtins<193>-Footnote-36686082
Ref: Core and Builtins<193>-Footnote-46686147
Ref: Core and Builtins<193>-Footnote-56686212
Ref: Core and Builtins<193>-Footnote-66686277
Ref: Core and Builtins<193>-Footnote-76686342
Ref: Core and Builtins<193>-Footnote-86686407
Ref: Core and Builtins<193>-Footnote-96686472
Ref: Core and Builtins<193>-Footnote-106686537
Ref: Core and Builtins<193>-Footnote-116686603
Ref: Core and Builtins<193>-Footnote-126686669
Ref: Core and Builtins<193>-Footnote-136686735
Ref: Core and Builtins<193>-Footnote-146686801
Ref: Core and Builtins<193>-Footnote-156686867
Ref: Core and Builtins<193>-Footnote-166686933
Ref: Core and Builtins<193>-Footnote-176686999
Ref: Core and Builtins<193>-Footnote-186687065
Ref: Core and Builtins<193>-Footnote-196687131
Ref: Core and Builtins<193>-Footnote-206687197
Ref: Core and Builtins<193>-Footnote-216687263
Ref: Core and Builtins<193>-Footnote-226687329
Ref: Core and Builtins<193>-Footnote-236687395
Ref: Core and Builtins<193>-Footnote-246687461
Ref: Core and Builtins<193>-Footnote-256687527
Ref: Core and Builtins<193>-Footnote-266687593
Ref: Core and Builtins<193>-Footnote-276687659
Ref: Core and Builtins<193>-Footnote-286687725
Ref: Core and Builtins<193>-Footnote-296687791
Ref: Core and Builtins<193>-Footnote-306687857
Ref: Core and Builtins<193>-Footnote-316687923
Ref: Core and Builtins<193>-Footnote-326687989
Ref: Core and Builtins<193>-Footnote-336688055
Ref: Core and Builtins<193>-Footnote-346688121
Ref: Core and Builtins<193>-Footnote-356688187
Ref: Core and Builtins<193>-Footnote-366688253
Ref: Core and Builtins<193>-Footnote-376688319
Ref: Core and Builtins<193>-Footnote-386688385
Ref: Core and Builtins<193>-Footnote-396688451
Ref: Core and Builtins<193>-Footnote-406688517
Ref: Core and Builtins<193>-Footnote-416688583
Ref: Core and Builtins<193>-Footnote-426688649
Ref: Core and Builtins<193>-Footnote-436688715
Node: ライブラリ<197>6688781
Ref: whatsnew/changelog id10246688918
Ref: 1fb16688918
Ref: ライブラリ<197>-Footnote-16704861
Ref: ライブラリ<197>-Footnote-26704926
Ref: ライブラリ<197>-Footnote-36704991
Ref: ライブラリ<197>-Footnote-46705056
Ref: ライブラリ<197>-Footnote-56705121
Ref: ライブラリ<197>-Footnote-66705185
Ref: ライブラリ<197>-Footnote-76705250
Ref: ライブラリ<197>-Footnote-86705315
Ref: ライブラリ<197>-Footnote-96705380
Ref: ライブラリ<197>-Footnote-106705445
Ref: ライブラリ<197>-Footnote-116705511
Ref: ライブラリ<197>-Footnote-126705577
Ref: ライブラリ<197>-Footnote-136705643
Ref: ライブラリ<197>-Footnote-146705709
Ref: ライブラリ<197>-Footnote-156705775
Ref: ライブラリ<197>-Footnote-166705841
Ref: ライブラリ<197>-Footnote-176705907
Ref: ライブラリ<197>-Footnote-186705973
Ref: ライブラリ<197>-Footnote-196706039
Ref: ライブラリ<197>-Footnote-206706105
Ref: ライブラリ<197>-Footnote-216706171
Ref: ライブラリ<197>-Footnote-226706237
Ref: ライブラリ<197>-Footnote-236706303
Ref: ライブラリ<197>-Footnote-246706369
Ref: ライブラリ<197>-Footnote-256706435
Ref: ライブラリ<197>-Footnote-266706501
Ref: ライブラリ<197>-Footnote-276706567
Ref: ライブラリ<197>-Footnote-286706633
Ref: ライブラリ<197>-Footnote-296706699
Ref: ライブラリ<197>-Footnote-306706765
Ref: ライブラリ<197>-Footnote-316706831
Ref: ライブラリ<197>-Footnote-326706897
Ref: ライブラリ<197>-Footnote-336706965
Ref: ライブラリ<197>-Footnote-346707031
Ref: ライブラリ<197>-Footnote-356707097
Ref: ライブラリ<197>-Footnote-366707163
Ref: ライブラリ<197>-Footnote-376707229
Ref: ライブラリ<197>-Footnote-386707295
Ref: ライブラリ<197>-Footnote-396707361
Ref: ライブラリ<197>-Footnote-406707427
Ref: ライブラリ<197>-Footnote-416707493
Ref: ライブラリ<197>-Footnote-426707559
Ref: ライブラリ<197>-Footnote-436707625
Ref: ライブラリ<197>-Footnote-446707691
Ref: ライブラリ<197>-Footnote-456707757
Ref: ライブラリ<197>-Footnote-466707823
Ref: ライブラリ<197>-Footnote-476707889
Ref: ライブラリ<197>-Footnote-486707955
Ref: ライブラリ<197>-Footnote-496708021
Ref: ライブラリ<197>-Footnote-506708087
Ref: ライブラリ<197>-Footnote-516708153
Ref: ライブラリ<197>-Footnote-526708219
Ref: ライブラリ<197>-Footnote-536708285
Ref: ライブラリ<197>-Footnote-546708351
Ref: ライブラリ<197>-Footnote-556708417
Ref: ライブラリ<197>-Footnote-566708483
Ref: ライブラリ<197>-Footnote-576708549
Ref: ライブラリ<197>-Footnote-586708615
Ref: ライブラリ<197>-Footnote-596708681
Ref: ライブラリ<197>-Footnote-606708747
Ref: ライブラリ<197>-Footnote-616708803
Ref: ライブラリ<197>-Footnote-626708869
Ref: ライブラリ<197>-Footnote-636708935
Ref: ライブラリ<197>-Footnote-646709001
Ref: ライブラリ<197>-Footnote-656709067
Ref: ライブラリ<197>-Footnote-666709133
Ref: ライブラリ<197>-Footnote-676709199
Ref: ライブラリ<197>-Footnote-686709265
Ref: ライブラリ<197>-Footnote-696709331
Ref: ライブラリ<197>-Footnote-706709397
Ref: ライブラリ<197>-Footnote-716709463
Ref: ライブラリ<197>-Footnote-726709529
Ref: ライブラリ<197>-Footnote-736709594
Ref: ライブラリ<197>-Footnote-746709660
Ref: ライブラリ<197>-Footnote-756709726
Ref: ライブラリ<197>-Footnote-766709792
Ref: ライブラリ<197>-Footnote-776709858
Ref: ライブラリ<197>-Footnote-786709924
Ref: ライブラリ<197>-Footnote-796709990
Ref: ライブラリ<197>-Footnote-806710056
Ref: ライブラリ<197>-Footnote-816710115
Ref: ライブラリ<197>-Footnote-826710181
Ref: ライブラリ<197>-Footnote-836710247
Ref: ライブラリ<197>-Footnote-846710313
Ref: ライブラリ<197>-Footnote-856710379
Ref: ライブラリ<197>-Footnote-866710445
Ref: ライブラリ<197>-Footnote-876710511
Ref: ライブラリ<197>-Footnote-886710577
Ref: ライブラリ<197>-Footnote-896710643
Ref: ライブラリ<197>-Footnote-906710709
Ref: ライブラリ<197>-Footnote-916710775
Ref: ライブラリ<197>-Footnote-926710841
Ref: ライブラリ<197>-Footnote-936710907
Ref: ライブラリ<197>-Footnote-946710973
Ref: ライブラリ<197>-Footnote-956711039
Ref: ライブラリ<197>-Footnote-966711105
Ref: ライブラリ<197>-Footnote-976711171
Ref: ライブラリ<197>-Footnote-986711214
Ref: ライブラリ<197>-Footnote-996711280
Ref: ライブラリ<197>-Footnote-1006711346
Ref: ライブラリ<197>-Footnote-1016711413
Ref: ライブラリ<197>-Footnote-1026711480
Ref: ライブラリ<197>-Footnote-1036711547
Ref: ライブラリ<197>-Footnote-1046711614
Ref: ライブラリ<197>-Footnote-1056711681
Ref: ライブラリ<197>-Footnote-1066711748
Ref: ライブラリ<197>-Footnote-1076711815
Ref: ライブラリ<197>-Footnote-1086711882
Ref: ライブラリ<197>-Footnote-1096711949
Ref: ライブラリ<197>-Footnote-1106712016
Ref: ライブラリ<197>-Footnote-1116712083
Ref: ライブラリ<197>-Footnote-1126712150
Ref: ライブラリ<197>-Footnote-1136712217
Ref: ライブラリ<197>-Footnote-1146712284
Ref: ライブラリ<197>-Footnote-1156712351
Ref: ライブラリ<197>-Footnote-1166712418
Ref: ライブラリ<197>-Footnote-1176712485
Ref: ライブラリ<197>-Footnote-1186712552
Ref: ライブラリ<197>-Footnote-1196712619
Ref: ライブラリ<197>-Footnote-1206712686
Ref: ライブラリ<197>-Footnote-1216712753
Ref: ライブラリ<197>-Footnote-1226712820
Ref: ライブラリ<197>-Footnote-1236712887
Ref: ライブラリ<197>-Footnote-1246712954
Ref: ライブラリ<197>-Footnote-1256713021
Ref: ライブラリ<197>-Footnote-1266713088
Node: IDLE<58>6713155
Ref: whatsnew/changelog id10256713279
Ref: 1fb26713279
Ref: IDLE<58>-Footnote-16714520
Ref: IDLE<58>-Footnote-26714585
Ref: IDLE<58>-Footnote-36714650
Ref: IDLE<58>-Footnote-46714715
Ref: IDLE<58>-Footnote-56714780
Ref: IDLE<58>-Footnote-66714845
Ref: IDLE<58>-Footnote-76714910
Ref: IDLE<58>-Footnote-86714975
Node: C API<79>6715040
Ref: whatsnew/changelog id10266715166
Ref: 1fb36715166
Ref: C API<79>-Footnote-16715498
Ref: C API<79>-Footnote-26715563
Node: ドキュメント<82>6715628
Ref: whatsnew/changelog id10276715759
Ref: 1fb46715759
Ref: ドキュメント<82>-Footnote-16715916
Node: テスト<83>6715981
Ref: whatsnew/changelog id10286716118
Ref: 1fb56716118
Ref: テスト<83>-Footnote-16716812
Ref: テスト<83>-Footnote-26716877
Ref: テスト<83>-Footnote-36716942
Ref: テスト<83>-Footnote-46717007
Ref: テスト<83>-Footnote-56717072
Ref: テスト<83>-Footnote-66717137
Node: Tools/Demos<55>6717202
Ref: whatsnew/changelog id10296717328
Ref: 1fb66717328
Ref: Tools/Demos<55>-Footnote-16717808
Ref: Tools/Demos<55>-Footnote-26717873
Ref: Tools/Demos<55>-Footnote-36717938
Node: Windows<80>6718003
Ref: whatsnew/changelog id10306718129
Ref: 1fb76718129
Ref: Windows<80>-Footnote-16718631
Ref: Windows<80>-Footnote-26718696
Ref: Windows<80>-Footnote-36718761
Ref: Windows<80>-Footnote-46718826
Ref: Windows<80>-Footnote-56718891
Node: ビルド<94>6718956
Ref: whatsnew/changelog id10316719058
Ref: 1fb86719058
Ref: ビルド<94>-Footnote-16721758
Ref: ビルド<94>-Footnote-26721823
Ref: ビルド<94>-Footnote-36721888
Ref: ビルド<94>-Footnote-46721953
Ref: ビルド<94>-Footnote-56722018
Ref: ビルド<94>-Footnote-66722083
Ref: ビルド<94>-Footnote-76722148
Ref: ビルド<94>-Footnote-86722213
Ref: ビルド<94>-Footnote-96722278
Ref: ビルド<94>-Footnote-106722343
Ref: ビルド<94>-Footnote-116722409
Ref: ビルド<94>-Footnote-126722475
Ref: ビルド<94>-Footnote-136722541
Ref: ビルド<94>-Footnote-146722607
Ref: ビルド<94>-Footnote-156722673
Ref: ビルド<94>-Footnote-166722739
Ref: ビルド<94>-Footnote-176722805
Ref: ビルド<94>-Footnote-186722871
Ref: ビルド<94>-Footnote-196722937
Ref: ビルド<94>-Footnote-206723003
Ref: ビルド<94>-Footnote-216723069
Ref: ビルド<94>-Footnote-226723135
Node: Python 3 5 2 final6723201
Ref: whatsnew/changelog python-3-5-2-final6723350
Ref: 1fb96723350
Node: Core and Builtins<194>6723536
Ref: whatsnew/changelog id10326723635
Ref: 1fba6723635
Ref: Core and Builtins<194>-Footnote-16723795
Node: テスト<84>6723860
Ref: whatsnew/changelog id10336723976
Ref: 1fbb6723976
Ref: テスト<84>-Footnote-16724141
Node: IDLE<59>6724206
Ref: whatsnew/changelog id10346724291
Ref: 1fbc6724291
Ref: IDLE<59>-Footnote-16724447
Node: Python 3 5 2 release candidate 16724512
Ref: whatsnew/changelog python-3-5-2-release-candidate-16724647
Ref: 1fbd6724647
Node: セキュリティ<65>6725078
Ref: whatsnew/changelog id10356725200
Ref: 1fbe6725200
Ref: セキュリティ<65>-Footnote-16726123
Ref: セキュリティ<65>-Footnote-26726188
Ref: セキュリティ<65>-Footnote-36726243
Ref: セキュリティ<65>-Footnote-46726298
Ref: セキュリティ<65>-Footnote-56726363
Ref: セキュリティ<65>-Footnote-66726428
Ref: セキュリティ<65>-Footnote-76726493
Node: Core and Builtins<195>6726558
Ref: whatsnew/changelog id10366726709
Ref: 1fbf6726709
Ref: Core and Builtins<195>-Footnote-16732550
Ref: Core and Builtins<195>-Footnote-26732615
Ref: Core and Builtins<195>-Footnote-36732680
Ref: Core and Builtins<195>-Footnote-46732745
Ref: Core and Builtins<195>-Footnote-56732810
Ref: Core and Builtins<195>-Footnote-66732875
Ref: Core and Builtins<195>-Footnote-76732940
Ref: Core and Builtins<195>-Footnote-86733005
Ref: Core and Builtins<195>-Footnote-96733070
Ref: Core and Builtins<195>-Footnote-106733135
Ref: Core and Builtins<195>-Footnote-116733201
Ref: Core and Builtins<195>-Footnote-126733267
Ref: Core and Builtins<195>-Footnote-136733333
Ref: Core and Builtins<195>-Footnote-146733399
Ref: Core and Builtins<195>-Footnote-156733465
Ref: Core and Builtins<195>-Footnote-166733531
Ref: Core and Builtins<195>-Footnote-176733597
Ref: Core and Builtins<195>-Footnote-186733662
Ref: Core and Builtins<195>-Footnote-196733728
Ref: Core and Builtins<195>-Footnote-206733794
Ref: Core and Builtins<195>-Footnote-216733860
Ref: Core and Builtins<195>-Footnote-226733926
Ref: Core and Builtins<195>-Footnote-236733992
Ref: Core and Builtins<195>-Footnote-246734058
Ref: Core and Builtins<195>-Footnote-256734124
Ref: Core and Builtins<195>-Footnote-266734190
Ref: Core and Builtins<195>-Footnote-276734256
Ref: Core and Builtins<195>-Footnote-286734322
Ref: Core and Builtins<195>-Footnote-296734388
Ref: Core and Builtins<195>-Footnote-306734454
Ref: Core and Builtins<195>-Footnote-316734520
Ref: Core and Builtins<195>-Footnote-326734563
Ref: Core and Builtins<195>-Footnote-336734629
Ref: Core and Builtins<195>-Footnote-346734695
Ref: Core and Builtins<195>-Footnote-356734761
Ref: Core and Builtins<195>-Footnote-366734827
Ref: Core and Builtins<195>-Footnote-376734893
Ref: Core and Builtins<195>-Footnote-386734959
Node: ライブラリ<198>6735025
Ref: whatsnew/changelog id10376735162
Ref: 1fc06735162
Ref: ライブラリ<198>-Footnote-16751923
Ref: ライブラリ<198>-Footnote-26751988
Ref: ライブラリ<198>-Footnote-36752053
Ref: ライブラリ<198>-Footnote-46752095
Ref: ライブラリ<198>-Footnote-56752160
Ref: ライブラリ<198>-Footnote-66752225
Ref: ライブラリ<198>-Footnote-76752290
Ref: ライブラリ<198>-Footnote-86752355
Ref: ライブラリ<198>-Footnote-96752420
Ref: ライブラリ<198>-Footnote-106752485
Ref: ライブラリ<198>-Footnote-116752551
Ref: ライブラリ<198>-Footnote-126752617
Ref: ライブラリ<198>-Footnote-136752683
Ref: ライブラリ<198>-Footnote-146752749
Ref: ライブラリ<198>-Footnote-156752815
Ref: ライブラリ<198>-Footnote-166752881
Ref: ライブラリ<198>-Footnote-176752947
Ref: ライブラリ<198>-Footnote-186753013
Ref: ライブラリ<198>-Footnote-196753079
Ref: ライブラリ<198>-Footnote-206753145
Ref: ライブラリ<198>-Footnote-216753211
Ref: ライブラリ<198>-Footnote-226753277
Ref: ライブラリ<198>-Footnote-236753343
Ref: ライブラリ<198>-Footnote-246753409
Ref: ライブラリ<198>-Footnote-256753475
Ref: ライブラリ<198>-Footnote-266753541
Ref: ライブラリ<198>-Footnote-276753607
Ref: ライブラリ<198>-Footnote-286753673
Ref: ライブラリ<198>-Footnote-296753739
Ref: ライブラリ<198>-Footnote-306753805
Ref: ライブラリ<198>-Footnote-316753871
Ref: ライブラリ<198>-Footnote-326753937
Ref: ライブラリ<198>-Footnote-336754003
Ref: ライブラリ<198>-Footnote-346754069
Ref: ライブラリ<198>-Footnote-356754135
Ref: ライブラリ<198>-Footnote-366754201
Ref: ライブラリ<198>-Footnote-376754267
Ref: ライブラリ<198>-Footnote-386754333
Ref: ライブラリ<198>-Footnote-396754399
Ref: ライブラリ<198>-Footnote-406754465
Ref: ライブラリ<198>-Footnote-416754531
Ref: ライブラリ<198>-Footnote-426754597
Ref: ライブラリ<198>-Footnote-436754663
Ref: ライブラリ<198>-Footnote-446754729
Ref: ライブラリ<198>-Footnote-456754795
Ref: ライブラリ<198>-Footnote-466754861
Ref: ライブラリ<198>-Footnote-476754927
Ref: ライブラリ<198>-Footnote-486754993
Ref: ライブラリ<198>-Footnote-496755059
Ref: ライブラリ<198>-Footnote-506755125
Ref: ライブラリ<198>-Footnote-516755191
Ref: ライブラリ<198>-Footnote-526755257
Ref: ライブラリ<198>-Footnote-536755323
Ref: ライブラリ<198>-Footnote-546755389
Ref: ライブラリ<198>-Footnote-556755455
Ref: ライブラリ<198>-Footnote-566755521
Ref: ライブラリ<198>-Footnote-576755587
Ref: ライブラリ<198>-Footnote-586755653
Ref: ライブラリ<198>-Footnote-596755719
Ref: ライブラリ<198>-Footnote-606755785
Ref: ライブラリ<198>-Footnote-616755851
Ref: ライブラリ<198>-Footnote-626755916
Ref: ライブラリ<198>-Footnote-636755982
Ref: ライブラリ<198>-Footnote-646756048
Ref: ライブラリ<198>-Footnote-656756114
Ref: ライブラリ<198>-Footnote-666756180
Ref: ライブラリ<198>-Footnote-676756246
Ref: ライブラリ<198>-Footnote-686756312
Ref: ライブラリ<198>-Footnote-696756378
Ref: ライブラリ<198>-Footnote-706756444
Ref: ライブラリ<198>-Footnote-716756510
Ref: ライブラリ<198>-Footnote-726756576
Ref: ライブラリ<198>-Footnote-736756642
Ref: ライブラリ<198>-Footnote-746756708
Ref: ライブラリ<198>-Footnote-756756774
Ref: ライブラリ<198>-Footnote-766756840
Ref: ライブラリ<198>-Footnote-776756906
Ref: ライブラリ<198>-Footnote-786756972
Ref: ライブラリ<198>-Footnote-796757038
Ref: ライブラリ<198>-Footnote-806757104
Ref: ライブラリ<198>-Footnote-816757170
Ref: ライブラリ<198>-Footnote-826757236
Ref: ライブラリ<198>-Footnote-836757302
Ref: ライブラリ<198>-Footnote-846757368
Ref: ライブラリ<198>-Footnote-856757434
Ref: ライブラリ<198>-Footnote-866757500
Ref: ライブラリ<198>-Footnote-876757566
Ref: ライブラリ<198>-Footnote-886757632
Ref: ライブラリ<198>-Footnote-896757698
Ref: ライブラリ<198>-Footnote-906757764
Ref: ライブラリ<198>-Footnote-916757830
Ref: ライブラリ<198>-Footnote-926757896
Ref: ライブラリ<198>-Footnote-936757962
Ref: ライブラリ<198>-Footnote-946758028
Ref: ライブラリ<198>-Footnote-956758094
Ref: ライブラリ<198>-Footnote-966758160
Ref: ライブラリ<198>-Footnote-976758226
Ref: ライブラリ<198>-Footnote-986758292
Ref: ライブラリ<198>-Footnote-996758358
Ref: ライブラリ<198>-Footnote-1006758424
Ref: ライブラリ<198>-Footnote-1016758491
Ref: ライブラリ<198>-Footnote-1026758557
Ref: ライブラリ<198>-Footnote-1036758624
Ref: ライブラリ<198>-Footnote-1046758691
Ref: ライブラリ<198>-Footnote-1056758758
Ref: ライブラリ<198>-Footnote-1066758825
Ref: ライブラリ<198>-Footnote-1076758892
Ref: ライブラリ<198>-Footnote-1086758959
Ref: ライブラリ<198>-Footnote-1096759026
Ref: ライブラリ<198>-Footnote-1106759093
Ref: ライブラリ<198>-Footnote-1116759160
Ref: ライブラリ<198>-Footnote-1126759227
Ref: ライブラリ<198>-Footnote-1136759294
Ref: ライブラリ<198>-Footnote-1146759361
Ref: ライブラリ<198>-Footnote-1156759428
Ref: ライブラリ<198>-Footnote-1166759495
Ref: ライブラリ<198>-Footnote-1176759562
Ref: ライブラリ<198>-Footnote-1186759629
Ref: ライブラリ<198>-Footnote-1196759696
Ref: ライブラリ<198>-Footnote-1206759763
Node: IDLE<60>6759830
Ref: whatsnew/changelog id10386759967
Ref: 1fc16759967
Ref: IDLE<60>-Footnote-16762302
Ref: IDLE<60>-Footnote-26762366
Ref: IDLE<60>-Footnote-36762431
Ref: IDLE<60>-Footnote-46762496
Ref: IDLE<60>-Footnote-56762561
Ref: IDLE<60>-Footnote-66762626
Ref: IDLE<60>-Footnote-76762691
Ref: IDLE<60>-Footnote-86762756
Ref: IDLE<60>-Footnote-96762821
Ref: IDLE<60>-Footnote-106762886
Ref: IDLE<60>-Footnote-116762952
Ref: IDLE<60>-Footnote-126763018
Ref: IDLE<60>-Footnote-136763084
Ref: IDLE<60>-Footnote-146763150
Ref: IDLE<60>-Footnote-156763216
Node: ドキュメント<83>6763282
Ref: whatsnew/changelog id10396763412
Ref: 1fc26763412
Ref: ドキュメント<83>-Footnote-16764372
Ref: ドキュメント<83>-Footnote-26764437
Ref: ドキュメント<83>-Footnote-36764502
Ref: ドキュメント<83>-Footnote-46764544
Ref: ドキュメント<83>-Footnote-56764609
Ref: ドキュメント<83>-Footnote-66764673
Ref: ドキュメント<83>-Footnote-76764738
Ref: ドキュメント<83>-Footnote-86764803
Node: テスト<85>6764868
Ref: whatsnew/changelog id10406765003
Ref: 1fc36765003
Ref: テスト<85>-Footnote-16765883
Ref: テスト<85>-Footnote-26765948
Ref: テスト<85>-Footnote-36766013
Ref: テスト<85>-Footnote-46766078
Ref: テスト<85>-Footnote-56766143
Ref: テスト<85>-Footnote-66766208
Ref: テスト<85>-Footnote-76766273
Node: ビルド<95>6766338
Ref: whatsnew/changelog id10416766462
Ref: 1fc46766462
Ref: ビルド<95>-Footnote-16768991
Ref: ビルド<95>-Footnote-26769056
Ref: ビルド<95>-Footnote-36769121
Ref: ビルド<95>-Footnote-46769186
Ref: ビルド<95>-Footnote-56769251
Ref: ビルド<95>-Footnote-66769316
Ref: ビルド<95>-Footnote-76769381
Ref: ビルド<95>-Footnote-86769446
Ref: ビルド<95>-Footnote-96769511
Ref: ビルド<95>-Footnote-106769576
Ref: ビルド<95>-Footnote-116769642
Ref: ビルド<95>-Footnote-126769708
Ref: ビルド<95>-Footnote-136769774
Ref: ビルド<95>-Footnote-146769840
Ref: ビルド<95>-Footnote-156769906
Ref: ビルド<95>-Footnote-166769972
Ref: ビルド<95>-Footnote-176770038
Node: Windows<81>6770104
Ref: whatsnew/changelog id10426770230
Ref: 1fc56770230
Ref: Windows<81>-Footnote-16770938
Ref: Windows<81>-Footnote-26771003
Ref: Windows<81>-Footnote-36771068
Ref: Windows<81>-Footnote-46771133
Ref: Windows<81>-Footnote-56771198
Ref: Windows<81>-Footnote-66771263
Node: Tools/Demos<56>6771328
Ref: whatsnew/changelog id10436771432
Ref: 1fc66771432
Ref: Tools/Demos<56>-Footnote-16772054
Ref: Tools/Demos<56>-Footnote-26772119
Ref: Tools/Demos<56>-Footnote-36772184
Ref: Tools/Demos<56>-Footnote-46772249
Node: Python 3 5 1 final6772314
Ref: whatsnew/changelog python-3-5-1-final6772463
Ref: 1fc76772463
Node: Core and Builtins<196>6772627
Ref: whatsnew/changelog id10446772724
Ref: 1fc86772724
Ref: Core and Builtins<196>-Footnote-16772910
Node: Windows<82>6772975
Ref: whatsnew/changelog id10456773072
Ref: 1fc96773072
Ref: Windows<82>-Footnote-16773264
Node: Python 3 5 1 release candidate 16773329
Ref: whatsnew/changelog python-3-5-1-release-candidate-16773464
Ref: 1fca6773464
Node: Core and Builtins<197>6773849
Ref: whatsnew/changelog id10466773969
Ref: 1fcb6773969
Ref: Core and Builtins<197>-Footnote-16777107
Ref: Core and Builtins<197>-Footnote-26777172
Ref: Core and Builtins<197>-Footnote-36777237
Ref: Core and Builtins<197>-Footnote-46777302
Ref: Core and Builtins<197>-Footnote-56777367
Ref: Core and Builtins<197>-Footnote-66777432
Ref: Core and Builtins<197>-Footnote-76777497
Ref: Core and Builtins<197>-Footnote-86777562
Ref: Core and Builtins<197>-Footnote-96777627
Ref: Core and Builtins<197>-Footnote-106777692
Ref: Core and Builtins<197>-Footnote-116777758
Ref: Core and Builtins<197>-Footnote-126777824
Ref: Core and Builtins<197>-Footnote-136777890
Ref: Core and Builtins<197>-Footnote-146777956
Ref: Core and Builtins<197>-Footnote-156778022
Ref: Core and Builtins<197>-Footnote-166778088
Ref: Core and Builtins<197>-Footnote-176778154
Ref: Core and Builtins<197>-Footnote-186778220
Ref: Core and Builtins<197>-Footnote-196778286
Node: ライブラリ<199>6778352
Ref: whatsnew/changelog id10476778489
Ref: 1fcc6778489
Ref: ライブラリ<199>-Footnote-16788840
Ref: ライブラリ<199>-Footnote-26788905
Ref: ライブラリ<199>-Footnote-36788970
Ref: ライブラリ<199>-Footnote-46789035
Ref: ライブラリ<199>-Footnote-56789099
Ref: ライブラリ<199>-Footnote-66789164
Ref: ライブラリ<199>-Footnote-76789229
Ref: ライブラリ<199>-Footnote-86789294
Ref: ライブラリ<199>-Footnote-96789359
Ref: ライブラリ<199>-Footnote-106789424
Ref: ライブラリ<199>-Footnote-116789490
Ref: ライブラリ<199>-Footnote-126789556
Ref: ライブラリ<199>-Footnote-136789622
Ref: ライブラリ<199>-Footnote-146789688
Ref: ライブラリ<199>-Footnote-156789754
Ref: ライブラリ<199>-Footnote-166789820
Ref: ライブラリ<199>-Footnote-176789886
Ref: ライブラリ<199>-Footnote-186789952
Ref: ライブラリ<199>-Footnote-196790018
Ref: ライブラリ<199>-Footnote-206790084
Ref: ライブラリ<199>-Footnote-216790150
Ref: ライブラリ<199>-Footnote-226790216
Ref: ライブラリ<199>-Footnote-236790282
Ref: ライブラリ<199>-Footnote-246790348
Ref: ライブラリ<199>-Footnote-256790414
Ref: ライブラリ<199>-Footnote-266790480
Ref: ライブラリ<199>-Footnote-276790546
Ref: ライブラリ<199>-Footnote-286790612
Ref: ライブラリ<199>-Footnote-296790678
Ref: ライブラリ<199>-Footnote-306790744
Ref: ライブラリ<199>-Footnote-316790810
Ref: ライブラリ<199>-Footnote-326790876
Ref: ライブラリ<199>-Footnote-336790942
Ref: ライブラリ<199>-Footnote-346791008
Ref: ライブラリ<199>-Footnote-356791074
Ref: ライブラリ<199>-Footnote-366791140
Ref: ライブラリ<199>-Footnote-376791206
Ref: ライブラリ<199>-Footnote-386791272
Ref: ライブラリ<199>-Footnote-396791338
Ref: ライブラリ<199>-Footnote-406791404
Ref: ライブラリ<199>-Footnote-416791470
Ref: ライブラリ<199>-Footnote-426791536
Ref: ライブラリ<199>-Footnote-436791602
Ref: ライブラリ<199>-Footnote-446791668
Ref: ライブラリ<199>-Footnote-456791734
Ref: ライブラリ<199>-Footnote-466791800
Ref: ライブラリ<199>-Footnote-476791866
Ref: ライブラリ<199>-Footnote-486791932
Ref: ライブラリ<199>-Footnote-496791998
Ref: ライブラリ<199>-Footnote-506792064
Ref: ライブラリ<199>-Footnote-516792130
Ref: ライブラリ<199>-Footnote-526792196
Ref: ライブラリ<199>-Footnote-536792262
Ref: ライブラリ<199>-Footnote-546792328
Ref: ライブラリ<199>-Footnote-556792394
Ref: ライブラリ<199>-Footnote-566792460
Ref: ライブラリ<199>-Footnote-576792526
Ref: ライブラリ<199>-Footnote-586792592
Ref: ライブラリ<199>-Footnote-596792658
Ref: ライブラリ<199>-Footnote-606792724
Ref: ライブラリ<199>-Footnote-616792790
Ref: ライブラリ<199>-Footnote-626792856
Ref: ライブラリ<199>-Footnote-636792922
Ref: ライブラリ<199>-Footnote-646792988
Ref: ライブラリ<199>-Footnote-656793054
Ref: ライブラリ<199>-Footnote-666793120
Ref: ライブラリ<199>-Footnote-676793186
Ref: ライブラリ<199>-Footnote-686793252
Ref: ライブラリ<199>-Footnote-696793318
Ref: ライブラリ<199>-Footnote-706793384
Node: IDLE<61>6793450
Ref: whatsnew/changelog id10486793587
Ref: 1fcd6793587
Ref: IDLE<61>-Footnote-16798506
Ref: IDLE<61>-Footnote-26798571
Ref: IDLE<61>-Footnote-36798636
Ref: IDLE<61>-Footnote-46798701
Ref: IDLE<61>-Footnote-56798766
Ref: IDLE<61>-Footnote-66798831
Ref: IDLE<61>-Footnote-76798896
Ref: IDLE<61>-Footnote-86798961
Ref: IDLE<61>-Footnote-96799026
Ref: IDLE<61>-Footnote-106799091
Ref: IDLE<61>-Footnote-116799157
Ref: IDLE<61>-Footnote-126799223
Ref: IDLE<61>-Footnote-136799289
Ref: IDLE<61>-Footnote-146799355
Ref: IDLE<61>-Footnote-156799421
Ref: IDLE<61>-Footnote-166799487
Ref: IDLE<61>-Footnote-176799553
Ref: IDLE<61>-Footnote-186799619
Ref: IDLE<61>-Footnote-196799685
Ref: IDLE<61>-Footnote-206799751
Ref: IDLE<61>-Footnote-216799817
Ref: IDLE<61>-Footnote-226799883
Ref: IDLE<61>-Footnote-236799949
Ref: IDLE<61>-Footnote-246800015
Ref: IDLE<61>-Footnote-256800081
Node: ドキュメント<84>6800147
Ref: whatsnew/changelog id10496800277
Ref: 1fce6800277
Ref: ドキュメント<84>-Footnote-16801354
Ref: ドキュメント<84>-Footnote-26801419
Ref: ドキュメント<84>-Footnote-36801484
Ref: ドキュメント<84>-Footnote-46801549
Ref: ドキュメント<84>-Footnote-56801614
Ref: ドキュメント<84>-Footnote-66801679
Node: テスト<86>6801744
Ref: whatsnew/changelog id10506801879
Ref: 1fcf6801879
Ref: テスト<86>-Footnote-16802393
Ref: テスト<86>-Footnote-26802458
Ref: テスト<86>-Footnote-36802523
Node: ビルド<96>6802588
Ref: whatsnew/changelog id10516802712
Ref: 1fd06802712
Ref: ビルド<96>-Footnote-16803144
Ref: ビルド<96>-Footnote-26803209
Ref: ビルド<96>-Footnote-36803274
Node: Windows<83>6803339
Ref: whatsnew/changelog id10526803465
Ref: 1fd16803465
Ref: Windows<83>-Footnote-16804740
Ref: Windows<83>-Footnote-26804805
Ref: Windows<83>-Footnote-36804870
Ref: Windows<83>-Footnote-46804935
Ref: Windows<83>-Footnote-56805000
Ref: Windows<83>-Footnote-66805065
Ref: Windows<83>-Footnote-76805130
Ref: Windows<83>-Footnote-86805195
Ref: Windows<83>-Footnote-96805260
Ref: Windows<83>-Footnote-106805325
Ref: Windows<83>-Footnote-116805391
Ref: Windows<83>-Footnote-126805457
Ref: Windows<83>-Footnote-136805523
Ref: Windows<83>-Footnote-146805589
Node: Tools/Demos<57>6805655
Ref: whatsnew/changelog id10536805759
Ref: 1fd26805759
Ref: Tools/Demos<57>-Footnote-16805909
Node: Python 3 5 0 final6805974
Ref: whatsnew/changelog python-3-5-0-final6806123
Ref: 1fd36806123
Node: ビルド<97>6806246
Ref: whatsnew/changelog id10546806314
Ref: 1fd46806314
Ref: ビルド<97>-Footnote-16806497
Node: Python 3 5 0 release candidate 46806562
Ref: whatsnew/changelog python-3-5-0-release-candidate-46806711
Ref: 1fd56806711
Node: ライブラリ<200>6806903
Ref: whatsnew/changelog id10556807014
Ref: 1fd66807014
Ref: ライブラリ<200>-Footnote-16807156
Node: ビルド<98>6807221
Ref: whatsnew/changelog id10566807332
Ref: 1fd76807332
Ref: ビルド<98>-Footnote-16807521
Node: Python 3 5 0 release candidate 36807586
Ref: whatsnew/changelog python-3-5-0-release-candidate-36807749
Ref: 1fd86807749
Node: Core and Builtins<198>6807958
Ref: whatsnew/changelog id10576808078
Ref: 1fd96808078
Ref: Core and Builtins<198>-Footnote-16808448
Ref: Core and Builtins<198>-Footnote-26808513
Ref: Core and Builtins<198>-Footnote-36808578
Ref: Core and Builtins<198>-Footnote-46808643
Node: ライブラリ<201>6808685
Ref: whatsnew/changelog id10586808805
Ref: 1fda6808805
Ref: ライブラリ<201>-Footnote-16809592
Ref: ライブラリ<201>-Footnote-26809657
Ref: ライブラリ<201>-Footnote-36809722
Ref: ライブラリ<201>-Footnote-46809787
Ref: ライブラリ<201>-Footnote-56809852
Node: Python 3 5 0 release candidate 26809917
Ref: whatsnew/changelog python-3-5-0-release-candidate-26810080
Ref: 1fdb6810080
Node: Core and Builtins<199>6810289
Ref: whatsnew/changelog id10596810409
Ref: 1fdc6810409
Ref: Core and Builtins<199>-Footnote-16810951
Ref: Core and Builtins<199>-Footnote-26811016
Ref: Core and Builtins<199>-Footnote-36811081
Node: ライブラリ<202>6811146
Ref: whatsnew/changelog id10606811266
Ref: 1fdd6811266
Ref: ライブラリ<202>-Footnote-16811556
Ref: ライブラリ<202>-Footnote-26811621
Ref: ライブラリ<202>-Footnote-36811686
Node: Python 3 5 0 release candidate 16811751
Ref: whatsnew/changelog python-3-5-0-release-candidate-16811901
Ref: 1fde6811901
Node: Core and Builtins<200>6812202
Ref: whatsnew/changelog id10616812322
Ref: 1fdf6812322
Ref: Core and Builtins<200>-Footnote-16812502
Node: ライブラリ<203>6812567
Ref: whatsnew/changelog id10626812704
Ref: 1fe06812704
Ref: ライブラリ<203>-Footnote-16814293
Ref: ライブラリ<203>-Footnote-26814358
Ref: ライブラリ<203>-Footnote-36814423
Ref: ライブラリ<203>-Footnote-46814488
Ref: ライブラリ<203>-Footnote-56814552
Ref: ライブラリ<203>-Footnote-66814617
Ref: ライブラリ<203>-Footnote-76814682
Ref: ライブラリ<203>-Footnote-86814747
Ref: ライブラリ<203>-Footnote-96814812
Ref: ライブラリ<203>-Footnote-106814877
Ref: ライブラリ<203>-Footnote-116814943
Ref: ライブラリ<203>-Footnote-126815009
Ref: ライブラリ<203>-Footnote-136815075
Ref: ライブラリ<203>-Footnote-146815141
Ref: ライブラリ<203>-Footnote-156815207
Node: IDLE<62>6815273
Ref: whatsnew/changelog id10636815410
Ref: 1fe16815410
Ref: IDLE<62>-Footnote-16816159
Ref: IDLE<62>-Footnote-26816224
Ref: IDLE<62>-Footnote-36816289
Ref: IDLE<62>-Footnote-46816354
Node: ドキュメント<85>6816419
Ref: whatsnew/changelog id10646816549
Ref: 1fe26816549
Ref: ドキュメント<85>-Footnote-16817215
Ref: ドキュメント<85>-Footnote-26817280
Ref: ドキュメント<85>-Footnote-36817345
Ref: ドキュメント<85>-Footnote-46817410
Node: テスト<87>6817475
Ref: whatsnew/changelog id10656817588
Ref: 1fe36817588
Ref: テスト<87>-Footnote-16817833
Node: Python 3 5 0 beta 46817898
Ref: whatsnew/changelog python-3-5-0-beta-46818035
Ref: 1fe46818035
Node: Core and Builtins<201>6818246
Ref: whatsnew/changelog id10666818353
Ref: 1fe56818353
Ref: Core and Builtins<201>-Footnote-16819156
Ref: Core and Builtins<201>-Footnote-26819221
Ref: Core and Builtins<201>-Footnote-36819286
Ref: Core and Builtins<201>-Footnote-46819328
Ref: Core and Builtins<201>-Footnote-56819393
Ref: Core and Builtins<201>-Footnote-66819458
Ref: Core and Builtins<201>-Footnote-76819523
Ref: Core and Builtins<201>-Footnote-86819588
Node: ライブラリ<204>6819653
Ref: whatsnew/changelog id10676819782
Ref: 1fe66819782
Ref: ライブラリ<204>-Footnote-16822064
Ref: ライブラリ<204>-Footnote-26822129
Ref: ライブラリ<204>-Footnote-36822194
Ref: ライブラリ<204>-Footnote-46822259
Ref: ライブラリ<204>-Footnote-56822324
Ref: ライブラリ<204>-Footnote-66822389
Ref: ライブラリ<204>-Footnote-76822454
Ref: ライブラリ<204>-Footnote-86822519
Ref: ライブラリ<204>-Footnote-96822584
Ref: ライブラリ<204>-Footnote-106822649
Ref: ライブラリ<204>-Footnote-116822715
Ref: ライブラリ<204>-Footnote-126822781
Ref: ライブラリ<204>-Footnote-136822847
Ref: ライブラリ<204>-Footnote-146822913
Ref: ライブラリ<204>-Footnote-156822979
Ref: ライブラリ<204>-Footnote-166823045
Ref: ライブラリ<204>-Footnote-176823111
Ref: ライブラリ<204>-Footnote-186823177
Ref: ライブラリ<204>-Footnote-196823243
Node: ビルド<99>6823309
Ref: whatsnew/changelog id10686823407
Ref: 1fe76823407
Ref: ビルド<99>-Footnote-16823577
Node: Python 3 5 0 beta 36823642
Ref: whatsnew/changelog python-3-5-0-beta-36823766
Ref: 1fe86823766
Node: Core and Builtins<202>6824052
Ref: whatsnew/changelog id10696824159
Ref: 1fe96824159
Ref: Core and Builtins<202>-Footnote-16825472
Ref: Core and Builtins<202>-Footnote-26825537
Ref: Core and Builtins<202>-Footnote-36825602
Ref: Core and Builtins<202>-Footnote-46825667
Ref: Core and Builtins<202>-Footnote-56825709
Ref: Core and Builtins<202>-Footnote-66825774
Node: ライブラリ<205>6825839
Ref: whatsnew/changelog id10706825968
Ref: 1fea6825968
Ref: ライブラリ<205>-Footnote-16827927
Ref: ライブラリ<205>-Footnote-26827992
Ref: ライブラリ<205>-Footnote-36828057
Ref: ライブラリ<205>-Footnote-46828122
Ref: ライブラリ<205>-Footnote-56828187
Ref: ライブラリ<205>-Footnote-66828252
Ref: ライブラリ<205>-Footnote-76828317
Ref: ライブラリ<205>-Footnote-86828382
Ref: ライブラリ<205>-Footnote-96828447
Ref: ライブラリ<205>-Footnote-106828512
Ref: ライブラリ<205>-Footnote-116828578
Ref: ライブラリ<205>-Footnote-126828644
Ref: ライブラリ<205>-Footnote-136828710
Ref: ライブラリ<205>-Footnote-146828776
Ref: ライブラリ<205>-Footnote-156828842
Ref: ライブラリ<205>-Footnote-166828908
Ref: ライブラリ<205>-Footnote-176828974
Ref: ライブラリ<205>-Footnote-186829040
Node: テスト<88>6829106
Ref: whatsnew/changelog id10716829235
Ref: 1feb6829235
Ref: テスト<88>-Footnote-16829522
Ref: テスト<88>-Footnote-26829587
Node: ドキュメント<86>6829652
Ref: whatsnew/changelog id10726829775
Ref: 1fec6829775
Ref: ドキュメント<86>-Footnote-16830119
Ref: ドキュメント<86>-Footnote-26830184
Node: ビルド<100>6830249
Ref: whatsnew/changelog id10736830350
Ref: 1fed6830350
Ref: ビルド<100>-Footnote-16830520
Node: Python 3 5 0 beta 26830585
Ref: whatsnew/changelog python-3-5-0-beta-26830709
Ref: 1fee6830709
Node: Core and Builtins<203>6830892
Ref: whatsnew/changelog id10746830999
Ref: 1fef6830999
Ref: Core and Builtins<203>-Footnote-16831752
Ref: Core and Builtins<203>-Footnote-26831817
Ref: Core and Builtins<203>-Footnote-36831882
Ref: Core and Builtins<203>-Footnote-46831947
Ref: Core and Builtins<203>-Footnote-56832012
Node: ライブラリ<206>6832077
Ref: whatsnew/changelog id10756832184
Ref: 1ff06832184
Ref: ライブラリ<206>-Footnote-16832902
Ref: ライブラリ<206>-Footnote-26832967
Ref: ライブラリ<206>-Footnote-36833032
Ref: ライブラリ<206>-Footnote-46833074
Ref: ライブラリ<206>-Footnote-56833138
Ref: ライブラリ<206>-Footnote-66833203
Ref: ライブラリ<206>-Footnote-76833268
Node: Python 3 5 0 beta 16833333
Ref: whatsnew/changelog python-3-5-0-beta-16833458
Ref: 1ff16833458
Node: Core and Builtins<204>6833765
Ref: whatsnew/changelog id10766833872
Ref: 1ff26833872
Ref: Core and Builtins<204>-Footnote-16835745
Ref: Core and Builtins<204>-Footnote-26835810
Ref: Core and Builtins<204>-Footnote-36835875
Ref: Core and Builtins<204>-Footnote-46835940
Ref: Core and Builtins<204>-Footnote-56836005
Ref: Core and Builtins<204>-Footnote-66836070
Ref: Core and Builtins<204>-Footnote-76836135
Ref: Core and Builtins<204>-Footnote-86836200
Ref: Core and Builtins<204>-Footnote-96836265
Ref: Core and Builtins<204>-Footnote-106836330
Ref: Core and Builtins<204>-Footnote-116836395
Ref: Core and Builtins<204>-Footnote-126836461
Ref: Core and Builtins<204>-Footnote-136836527
Ref: Core and Builtins<204>-Footnote-146836593
Ref: Core and Builtins<204>-Footnote-156836659
Ref: Core and Builtins<204>-Footnote-166836725
Ref: Core and Builtins<204>-Footnote-176836791
Ref: Core and Builtins<204>-Footnote-186836856
Ref: Core and Builtins<204>-Footnote-196836922
Node: ライブラリ<207>6836988
Ref: whatsnew/changelog id10776837112
Ref: 1ff36837112
Ref: ライブラリ<207>-Footnote-16844759
Ref: ライブラリ<207>-Footnote-26844824
Ref: ライブラリ<207>-Footnote-36844889
Ref: ライブラリ<207>-Footnote-46844954
Ref: ライブラリ<207>-Footnote-56845019
Ref: ライブラリ<207>-Footnote-66845084
Ref: ライブラリ<207>-Footnote-76845149
Ref: ライブラリ<207>-Footnote-86845214
Ref: ライブラリ<207>-Footnote-96845279
Ref: ライブラリ<207>-Footnote-106845344
Ref: ライブラリ<207>-Footnote-116845409
Ref: ライブラリ<207>-Footnote-126845475
Ref: ライブラリ<207>-Footnote-136845541
Ref: ライブラリ<207>-Footnote-146845607
Ref: ライブラリ<207>-Footnote-156845672
Ref: ライブラリ<207>-Footnote-166845738
Ref: ライブラリ<207>-Footnote-176845804
Ref: ライブラリ<207>-Footnote-186845870
Ref: ライブラリ<207>-Footnote-196845936
Ref: ライブラリ<207>-Footnote-206846002
Ref: ライブラリ<207>-Footnote-216846068
Ref: ライブラリ<207>-Footnote-226846134
Ref: ライブラリ<207>-Footnote-236846200
Ref: ライブラリ<207>-Footnote-246846266
Ref: ライブラリ<207>-Footnote-256846332
Ref: ライブラリ<207>-Footnote-266846397
Ref: ライブラリ<207>-Footnote-276846463
Ref: ライブラリ<207>-Footnote-286846529
Ref: ライブラリ<207>-Footnote-296846595
Ref: ライブラリ<207>-Footnote-306846661
Ref: ライブラリ<207>-Footnote-316846727
Ref: ライブラリ<207>-Footnote-326846793
Ref: ライブラリ<207>-Footnote-336846859
Ref: ライブラリ<207>-Footnote-346846925
Ref: ライブラリ<207>-Footnote-356846991
Ref: ライブラリ<207>-Footnote-366847057
Ref: ライブラリ<207>-Footnote-376847123
Ref: ライブラリ<207>-Footnote-386847189
Ref: ライブラリ<207>-Footnote-396847255
Ref: ライブラリ<207>-Footnote-406847321
Ref: ライブラリ<207>-Footnote-416847387
Ref: ライブラリ<207>-Footnote-426847452
Ref: ライブラリ<207>-Footnote-436847518
Ref: ライブラリ<207>-Footnote-446847584
Ref: ライブラリ<207>-Footnote-456847650
Ref: ライブラリ<207>-Footnote-466847716
Ref: ライブラリ<207>-Footnote-476847782
Ref: ライブラリ<207>-Footnote-486847848
Ref: ライブラリ<207>-Footnote-496847914
Ref: ライブラリ<207>-Footnote-506847980
Ref: ライブラリ<207>-Footnote-516848046
Ref: ライブラリ<207>-Footnote-526848112
Ref: ライブラリ<207>-Footnote-536848178
Ref: ライブラリ<207>-Footnote-546848244
Ref: ライブラリ<207>-Footnote-556848310
Ref: ライブラリ<207>-Footnote-566848376
Node: IDLE<63>6848442
Ref: whatsnew/changelog id10786848557
Ref: 1ff46848557
Ref: IDLE<63>-Footnote-16848726
Node: テスト<89>6848791
Ref: whatsnew/changelog id10796848908
Ref: 1ff56848908
Ref: テスト<89>-Footnote-16849207
Ref: テスト<89>-Footnote-26849272
Node: ドキュメント<87>6849336
Ref: whatsnew/changelog id10806849460
Ref: 1ff66849460
Ref: ドキュメント<87>-Footnote-16849871
Ref: ドキュメント<87>-Footnote-26849936
Ref: ドキュメント<87>-Footnote-36850001
Node: Tools/Demos<58>6850066
Ref: whatsnew/changelog id10816850168
Ref: 1ff76850168
Ref: Tools/Demos<58>-Footnote-16850677
Ref: Tools/Demos<58>-Footnote-26850742
Ref: Tools/Demos<58>-Footnote-36850807
Ref: Tools/Demos<58>-Footnote-46850872
Node: Python 3 5 0 alpha 46850937
Ref: whatsnew/changelog python-3-5-0-alpha-46851063
Ref: 1ff86851063
Node: Core and Builtins<205>6851357
Ref: whatsnew/changelog id10826851465
Ref: 1ff96851465
Ref: Core and Builtins<205>-Footnote-16852830
Ref: Core and Builtins<205>-Footnote-26852895
Ref: Core and Builtins<205>-Footnote-36852937
Ref: Core and Builtins<205>-Footnote-46853002
Ref: Core and Builtins<205>-Footnote-56853067
Ref: Core and Builtins<205>-Footnote-66853109
Ref: Core and Builtins<205>-Footnote-76853174
Ref: Core and Builtins<205>-Footnote-86853239
Ref: Core and Builtins<205>-Footnote-96853304
Ref: Core and Builtins<205>-Footnote-106853369
Ref: Core and Builtins<205>-Footnote-116853435
Node: ライブラリ<208>6853501
Ref: whatsnew/changelog id10836853632
Ref: 1ffa6853632
Ref: ライブラリ<208>-Footnote-16860330
Ref: ライブラリ<208>-Footnote-26860395
Ref: ライブラリ<208>-Footnote-36860460
Ref: ライブラリ<208>-Footnote-46860524
Ref: ライブラリ<208>-Footnote-56860589
Ref: ライブラリ<208>-Footnote-66860654
Ref: ライブラリ<208>-Footnote-76860718
Ref: ライブラリ<208>-Footnote-86860783
Ref: ライブラリ<208>-Footnote-96860848
Ref: ライブラリ<208>-Footnote-106860913
Ref: ライブラリ<208>-Footnote-116860979
Ref: ライブラリ<208>-Footnote-126861045
Ref: ライブラリ<208>-Footnote-136861111
Ref: ライブラリ<208>-Footnote-146861177
Ref: ライブラリ<208>-Footnote-156861243
Ref: ライブラリ<208>-Footnote-166861309
Ref: ライブラリ<208>-Footnote-176861375
Ref: ライブラリ<208>-Footnote-186861441
Ref: ライブラリ<208>-Footnote-196861507
Ref: ライブラリ<208>-Footnote-206861573
Ref: ライブラリ<208>-Footnote-216861639
Ref: ライブラリ<208>-Footnote-226861705
Ref: ライブラリ<208>-Footnote-236861771
Ref: ライブラリ<208>-Footnote-246861837
Ref: ライブラリ<208>-Footnote-256861903
Ref: ライブラリ<208>-Footnote-266861969
Ref: ライブラリ<208>-Footnote-276862035
Ref: ライブラリ<208>-Footnote-286862101
Ref: ライブラリ<208>-Footnote-296862167
Ref: ライブラリ<208>-Footnote-306862233
Ref: ライブラリ<208>-Footnote-316862298
Ref: ライブラリ<208>-Footnote-326862364
Ref: ライブラリ<208>-Footnote-336862430
Ref: ライブラリ<208>-Footnote-346862496
Ref: ライブラリ<208>-Footnote-356862562
Ref: ライブラリ<208>-Footnote-366862628
Ref: ライブラリ<208>-Footnote-376862694
Ref: ライブラリ<208>-Footnote-386862760
Ref: ライブラリ<208>-Footnote-396862826
Ref: ライブラリ<208>-Footnote-406862892
Ref: ライブラリ<208>-Footnote-416862958
Ref: ライブラリ<208>-Footnote-426863024
Ref: ライブラリ<208>-Footnote-436863067
Ref: ライブラリ<208>-Footnote-446863133
Ref: ライブラリ<208>-Footnote-456863199
Ref: ライブラリ<208>-Footnote-466863265
Ref: ライブラリ<208>-Footnote-476863331
Ref: ライブラリ<208>-Footnote-486863397
Node: ビルド<101>6863463
Ref: whatsnew/changelog id10846863585
Ref: 1ffb6863585
Ref: ビルド<101>-Footnote-16863867
Ref: ビルド<101>-Footnote-26863932
Node: テスト<90>6863997
Ref: whatsnew/changelog id10856864114
Ref: 1ffc6864114
Ref: テスト<90>-Footnote-16864420
Ref: テスト<90>-Footnote-26864485
Node: Tools/Demos<59>6864550
Ref: whatsnew/changelog id10866864662
Ref: 1ffd6864662
Ref: Tools/Demos<59>-Footnote-16865686
Ref: Tools/Demos<59>-Footnote-26865751
Ref: Tools/Demos<59>-Footnote-36865816
Ref: Tools/Demos<59>-Footnote-46865881
Ref: Tools/Demos<59>-Footnote-56865946
Ref: Tools/Demos<59>-Footnote-66866011
Node: C API<80>6866076
Ref: whatsnew/changelog id10876866166
Ref: 1ffe6866166
Ref: C API<80>-Footnote-16866321
Node: Python 3 5 0 alpha 36866386
Ref: whatsnew/changelog python-3-5-0-alpha-36866513
Ref: 1fff6866513
Node: Core and Builtins<206>6866787
Ref: whatsnew/changelog id10886866895
Ref: 20006866895
Ref: Core and Builtins<206>-Footnote-16867689
Ref: Core and Builtins<206>-Footnote-26867754
Ref: Core and Builtins<206>-Footnote-36867819
Ref: Core and Builtins<206>-Footnote-46867884
Ref: Core and Builtins<206>-Footnote-56867949
Ref: Core and Builtins<206>-Footnote-66868014
Node: ライブラリ<209>6868079
Ref: whatsnew/changelog id10896868210
Ref: 20016868210
Ref: ライブラリ<209>-Footnote-16874631
Ref: ライブラリ<209>-Footnote-26874696
Ref: ライブラリ<209>-Footnote-36874761
Ref: ライブラリ<209>-Footnote-46874826
Ref: ライブラリ<209>-Footnote-56874891
Ref: ライブラリ<209>-Footnote-66874956
Ref: ライブラリ<209>-Footnote-76875021
Ref: ライブラリ<209>-Footnote-86875086
Ref: ライブラリ<209>-Footnote-96875151
Ref: ライブラリ<209>-Footnote-106875216
Ref: ライブラリ<209>-Footnote-116875282
Ref: ライブラリ<209>-Footnote-126875348
Ref: ライブラリ<209>-Footnote-136875414
Ref: ライブラリ<209>-Footnote-146875480
Ref: ライブラリ<209>-Footnote-156875545
Ref: ライブラリ<209>-Footnote-166875611
Ref: ライブラリ<209>-Footnote-176875677
Ref: ライブラリ<209>-Footnote-186875743
Ref: ライブラリ<209>-Footnote-196875809
Ref: ライブラリ<209>-Footnote-206875875
Ref: ライブラリ<209>-Footnote-216875941
Ref: ライブラリ<209>-Footnote-226876007
Ref: ライブラリ<209>-Footnote-236876073
Ref: ライブラリ<209>-Footnote-246876139
Ref: ライブラリ<209>-Footnote-256876205
Ref: ライブラリ<209>-Footnote-266876271
Ref: ライブラリ<209>-Footnote-276876337
Ref: ライブラリ<209>-Footnote-286876403
Ref: ライブラリ<209>-Footnote-296876469
Ref: ライブラリ<209>-Footnote-306876535
Ref: ライブラリ<209>-Footnote-316876600
Ref: ライブラリ<209>-Footnote-326876666
Ref: ライブラリ<209>-Footnote-336876732
Ref: ライブラリ<209>-Footnote-346876798
Ref: ライブラリ<209>-Footnote-356876863
Ref: ライブラリ<209>-Footnote-366876929
Ref: ライブラリ<209>-Footnote-376876995
Ref: ライブラリ<209>-Footnote-386877061
Ref: ライブラリ<209>-Footnote-396877127
Ref: ライブラリ<209>-Footnote-406877193
Ref: ライブラリ<209>-Footnote-416877259
Ref: ライブラリ<209>-Footnote-426877325
Node: ビルド<102>6877391
Ref: whatsnew/changelog id10906877513
Ref: 20026877513
Ref: ビルド<102>-Footnote-16877663
Node: テスト<91>6877728
Ref: whatsnew/changelog id10916877845
Ref: 20036877845
Ref: テスト<91>-Footnote-16878075
Ref: テスト<91>-Footnote-26878140
Node: Tools/Demos<60>6878205
Ref: whatsnew/changelog id10926878299
Ref: 20046878299
Ref: Tools/Demos<60>-Footnote-16878568
Node: Python 3 5 0 alpha 26878633
Ref: whatsnew/changelog python-3-5-0-alpha-26878760
Ref: 20056878760
Node: Core and Builtins<207>6879018
Ref: whatsnew/changelog id10936879126
Ref: 20066879126
Ref: Core and Builtins<207>-Footnote-16879424
Node: ライブラリ<210>6879489
Ref: whatsnew/changelog id10946879620
Ref: 20076879620
Ref: ライブラリ<210>-Footnote-16883924
Ref: ライブラリ<210>-Footnote-26883989
Ref: ライブラリ<210>-Footnote-36884031
Ref: ライブラリ<210>-Footnote-46884096
Ref: ライブラリ<210>-Footnote-56884161
Ref: ライブラリ<210>-Footnote-66884226
Ref: ライブラリ<210>-Footnote-76884291
Ref: ライブラリ<210>-Footnote-86884356
Ref: ライブラリ<210>-Footnote-96884421
Ref: ライブラリ<210>-Footnote-106884485
Ref: ライブラリ<210>-Footnote-116884551
Ref: ライブラリ<210>-Footnote-126884617
Ref: ライブラリ<210>-Footnote-136884683
Ref: ライブラリ<210>-Footnote-146884749
Ref: ライブラリ<210>-Footnote-156884815
Ref: ライブラリ<210>-Footnote-166884881
Ref: ライブラリ<210>-Footnote-176884946
Ref: ライブラリ<210>-Footnote-186885013
Ref: ライブラリ<210>-Footnote-196885078
Ref: ライブラリ<210>-Footnote-206885144
Ref: ライブラリ<210>-Footnote-216885209
Ref: ライブラリ<210>-Footnote-226885275
Ref: ライブラリ<210>-Footnote-236885341
Ref: ライブラリ<210>-Footnote-246885407
Ref: ライブラリ<210>-Footnote-256885473
Ref: ライブラリ<210>-Footnote-266885539
Ref: ライブラリ<210>-Footnote-276885605
Ref: ライブラリ<210>-Footnote-286885671
Ref: ライブラリ<210>-Footnote-296885737
Ref: ライブラリ<210>-Footnote-306885803
Ref: ライブラリ<210>-Footnote-316885869
Ref: ライブラリ<210>-Footnote-326885935
Ref: ライブラリ<210>-Footnote-336886001
Ref: ライブラリ<210>-Footnote-346886067
Ref: ライブラリ<210>-Footnote-356886133
Ref: ライブラリ<210>-Footnote-366886199
Ref: ライブラリ<210>-Footnote-376886265
Node: ビルド<103>6886331
Ref: whatsnew/changelog id10956886449
Ref: 20086886449
Ref: ビルド<103>-Footnote-16886721
Ref: ビルド<103>-Footnote-26886786
Node: C API<81>6886851
Ref: whatsnew/changelog id10966886960
Ref: 20096886960
Ref: C API<81>-Footnote-16887142
Node: Windows<84>6887207
Ref: whatsnew/changelog id10976887293
Ref: 200a6887293
Ref: Windows<84>-Footnote-16887590
Ref: Windows<84>-Footnote-26887655
Ref: Windows<84>-Footnote-36887697
Node: Python 3 5 0 alpha 16887762
Ref: whatsnew/changelog python-3-5-0-alpha-16887860
Ref: 200b6887860
Node: Core and Builtins<208>6888242
Ref: whatsnew/changelog id10986888350
Ref: 200c6888350
Ref: Core and Builtins<208>-Footnote-16898193
Ref: Core and Builtins<208>-Footnote-26898258
Ref: Core and Builtins<208>-Footnote-36898323
Ref: Core and Builtins<208>-Footnote-46898388
Ref: Core and Builtins<208>-Footnote-56898453
Ref: Core and Builtins<208>-Footnote-66898518
Ref: Core and Builtins<208>-Footnote-76898583
Ref: Core and Builtins<208>-Footnote-86898648
Ref: Core and Builtins<208>-Footnote-96898713
Ref: Core and Builtins<208>-Footnote-106898778
Ref: Core and Builtins<208>-Footnote-116898844
Ref: Core and Builtins<208>-Footnote-126898910
Ref: Core and Builtins<208>-Footnote-136898976
Ref: Core and Builtins<208>-Footnote-146899042
Ref: Core and Builtins<208>-Footnote-156899108
Ref: Core and Builtins<208>-Footnote-166899174
Ref: Core and Builtins<208>-Footnote-176899240
Ref: Core and Builtins<208>-Footnote-186899306
Ref: Core and Builtins<208>-Footnote-196899372
Ref: Core and Builtins<208>-Footnote-206899438
Ref: Core and Builtins<208>-Footnote-216899504
Ref: Core and Builtins<208>-Footnote-226899570
Ref: Core and Builtins<208>-Footnote-236899636
Ref: Core and Builtins<208>-Footnote-246899702
Ref: Core and Builtins<208>-Footnote-256899768
Ref: Core and Builtins<208>-Footnote-266899834
Ref: Core and Builtins<208>-Footnote-276899900
Ref: Core and Builtins<208>-Footnote-286899966
Ref: Core and Builtins<208>-Footnote-296900032
Ref: Core and Builtins<208>-Footnote-306900098
Ref: Core and Builtins<208>-Footnote-316900164
Ref: Core and Builtins<208>-Footnote-326900230
Ref: Core and Builtins<208>-Footnote-336900296
Ref: Core and Builtins<208>-Footnote-346900364
Ref: Core and Builtins<208>-Footnote-356900430
Ref: Core and Builtins<208>-Footnote-366900496
Ref: Core and Builtins<208>-Footnote-376900562
Ref: Core and Builtins<208>-Footnote-386900628
Ref: Core and Builtins<208>-Footnote-396900694
Ref: Core and Builtins<208>-Footnote-406900760
Ref: Core and Builtins<208>-Footnote-416900826
Ref: Core and Builtins<208>-Footnote-426900892
Ref: Core and Builtins<208>-Footnote-436900958
Ref: Core and Builtins<208>-Footnote-446901024
Ref: Core and Builtins<208>-Footnote-456901090
Ref: Core and Builtins<208>-Footnote-466901156
Ref: Core and Builtins<208>-Footnote-476901222
Ref: Core and Builtins<208>-Footnote-486901288
Ref: Core and Builtins<208>-Footnote-496901354
Ref: Core and Builtins<208>-Footnote-506901420
Ref: Core and Builtins<208>-Footnote-516901486
Ref: Core and Builtins<208>-Footnote-526901552
Ref: Core and Builtins<208>-Footnote-536901618
Ref: Core and Builtins<208>-Footnote-546901684
Ref: Core and Builtins<208>-Footnote-556901750
Ref: Core and Builtins<208>-Footnote-566901816
Ref: Core and Builtins<208>-Footnote-576901882
Ref: Core and Builtins<208>-Footnote-586901948
Ref: Core and Builtins<208>-Footnote-596902014
Ref: Core and Builtins<208>-Footnote-606902080
Ref: Core and Builtins<208>-Footnote-616902146
Ref: Core and Builtins<208>-Footnote-626902212
Ref: Core and Builtins<208>-Footnote-636902278
Ref: Core and Builtins<208>-Footnote-646902344
Ref: Core and Builtins<208>-Footnote-656902410
Ref: Core and Builtins<208>-Footnote-666902476
Ref: Core and Builtins<208>-Footnote-676902541
Ref: Core and Builtins<208>-Footnote-686902607
Ref: Core and Builtins<208>-Footnote-696902673
Ref: Core and Builtins<208>-Footnote-706902739
Ref: Core and Builtins<208>-Footnote-716902805
Ref: Core and Builtins<208>-Footnote-726902871
Ref: Core and Builtins<208>-Footnote-736902936
Node: ライブラリ<211>6903002
Ref: whatsnew/changelog id10996903127
Ref: 200d6903127
Ref: ライブラリ<211>-Footnote-16955442
Ref: ライブラリ<211>-Footnote-26955507
Ref: ライブラリ<211>-Footnote-36955572
Ref: ライブラリ<211>-Footnote-46955637
Ref: ライブラリ<211>-Footnote-56955702
Ref: ライブラリ<211>-Footnote-66955767
Ref: ライブラリ<211>-Footnote-76955832
Ref: ライブラリ<211>-Footnote-86955897
Ref: ライブラリ<211>-Footnote-96955962
Ref: ライブラリ<211>-Footnote-106956027
Ref: ライブラリ<211>-Footnote-116956093
Ref: ライブラリ<211>-Footnote-126956159
Ref: ライブラリ<211>-Footnote-136956225
Ref: ライブラリ<211>-Footnote-146956291
Ref: ライブラリ<211>-Footnote-156956357
Ref: ライブラリ<211>-Footnote-166956423
Ref: ライブラリ<211>-Footnote-176956489
Ref: ライブラリ<211>-Footnote-186956555
Ref: ライブラリ<211>-Footnote-196956621
Ref: ライブラリ<211>-Footnote-206956687
Ref: ライブラリ<211>-Footnote-216956753
Ref: ライブラリ<211>-Footnote-226956819
Ref: ライブラリ<211>-Footnote-236956885
Ref: ライブラリ<211>-Footnote-246956951
Ref: ライブラリ<211>-Footnote-256957017
Ref: ライブラリ<211>-Footnote-266957083
Ref: ライブラリ<211>-Footnote-276957149
Ref: ライブラリ<211>-Footnote-286957215
Ref: ライブラリ<211>-Footnote-296957281
Ref: ライブラリ<211>-Footnote-306957347
Ref: ライブラリ<211>-Footnote-316957413
Ref: ライブラリ<211>-Footnote-326957479
Ref: ライブラリ<211>-Footnote-336957545
Ref: ライブラリ<211>-Footnote-346957611
Ref: ライブラリ<211>-Footnote-356957677
Ref: ライブラリ<211>-Footnote-366957743
Ref: ライブラリ<211>-Footnote-376957809
Ref: ライブラリ<211>-Footnote-386957875
Ref: ライブラリ<211>-Footnote-396957941
Ref: ライブラリ<211>-Footnote-406958007
Ref: ライブラリ<211>-Footnote-416958073
Ref: ライブラリ<211>-Footnote-426958139
Ref: ライブラリ<211>-Footnote-436958205
Ref: ライブラリ<211>-Footnote-446958271
Ref: ライブラリ<211>-Footnote-456958337
Ref: ライブラリ<211>-Footnote-466958403
Ref: ライブラリ<211>-Footnote-476958469
Ref: ライブラリ<211>-Footnote-486958535
Ref: ライブラリ<211>-Footnote-496958601
Ref: ライブラリ<211>-Footnote-506958667
Ref: ライブラリ<211>-Footnote-516958733
Ref: ライブラリ<211>-Footnote-526958799
Ref: ライブラリ<211>-Footnote-536958865
Ref: ライブラリ<211>-Footnote-546958931
Ref: ライブラリ<211>-Footnote-556958997
Ref: ライブラリ<211>-Footnote-566959065
Ref: ライブラリ<211>-Footnote-576959131
Ref: ライブラリ<211>-Footnote-586959197
Ref: ライブラリ<211>-Footnote-596959263
Ref: ライブラリ<211>-Footnote-606959329
Ref: ライブラリ<211>-Footnote-616959395
Ref: ライブラリ<211>-Footnote-626959451
Ref: ライブラリ<211>-Footnote-636959517
Ref: ライブラリ<211>-Footnote-646959583
Ref: ライブラリ<211>-Footnote-656959649
Ref: ライブラリ<211>-Footnote-666959715
Ref: ライブラリ<211>-Footnote-676959781
Ref: ライブラリ<211>-Footnote-686959847
Ref: ライブラリ<211>-Footnote-696959913
Ref: ライブラリ<211>-Footnote-706959979
Ref: ライブラリ<211>-Footnote-716960045
Ref: ライブラリ<211>-Footnote-726960111
Ref: ライブラリ<211>-Footnote-736960177
Ref: ライブラリ<211>-Footnote-746960243
Ref: ライブラリ<211>-Footnote-756960309
Ref: ライブラリ<211>-Footnote-766960375
Ref: ライブラリ<211>-Footnote-776960441
Ref: ライブラリ<211>-Footnote-786960507
Ref: ライブラリ<211>-Footnote-796960573
Ref: ライブラリ<211>-Footnote-806960639
Ref: ライブラリ<211>-Footnote-816960705
Ref: ライブラリ<211>-Footnote-826960771
Ref: ライブラリ<211>-Footnote-836960837
Ref: ライブラリ<211>-Footnote-846960903
Ref: ライブラリ<211>-Footnote-856960969
Ref: ライブラリ<211>-Footnote-866961035
Ref: ライブラリ<211>-Footnote-876961101
Ref: ライブラリ<211>-Footnote-886961167
Ref: ライブラリ<211>-Footnote-896961233
Ref: ライブラリ<211>-Footnote-906961299
Ref: ライブラリ<211>-Footnote-916961365
Ref: ライブラリ<211>-Footnote-926961431
Ref: ライブラリ<211>-Footnote-936961497
Ref: ライブラリ<211>-Footnote-946961563
Ref: ライブラリ<211>-Footnote-956961629
Ref: ライブラリ<211>-Footnote-966961695
Ref: ライブラリ<211>-Footnote-976961760
Ref: ライブラリ<211>-Footnote-986961826
Ref: ライブラリ<211>-Footnote-996961892
Ref: ライブラリ<211>-Footnote-1006961958
Ref: ライブラリ<211>-Footnote-1016962024
Ref: ライブラリ<211>-Footnote-1026962091
Ref: ライブラリ<211>-Footnote-1036962158
Ref: ライブラリ<211>-Footnote-1046962225
Ref: ライブラリ<211>-Footnote-1056962292
Ref: ライブラリ<211>-Footnote-1066962359
Ref: ライブラリ<211>-Footnote-1076962426
Ref: ライブラリ<211>-Footnote-1086962492
Ref: ライブラリ<211>-Footnote-1096962558
Ref: ライブラリ<211>-Footnote-1106962625
Ref: ライブラリ<211>-Footnote-1116962692
Ref: ライブラリ<211>-Footnote-1126962759
Ref: ライブラリ<211>-Footnote-1136962826
Ref: ライブラリ<211>-Footnote-1146962893
Ref: ライブラリ<211>-Footnote-1156962960
Ref: ライブラリ<211>-Footnote-1166963027
Ref: ライブラリ<211>-Footnote-1176963094
Ref: ライブラリ<211>-Footnote-1186963161
Ref: ライブラリ<211>-Footnote-1196963228
Ref: ライブラリ<211>-Footnote-1206963295
Ref: ライブラリ<211>-Footnote-1216963362
Ref: ライブラリ<211>-Footnote-1226963431
Ref: ライブラリ<211>-Footnote-1236963498
Ref: ライブラリ<211>-Footnote-1246963565
Ref: ライブラリ<211>-Footnote-1256963632
Ref: ライブラリ<211>-Footnote-1266963699
Ref: ライブラリ<211>-Footnote-1276963766
Ref: ライブラリ<211>-Footnote-1286963833
Ref: ライブラリ<211>-Footnote-1296963900
Ref: ライブラリ<211>-Footnote-1306963967
Ref: ライブラリ<211>-Footnote-1316964034
Ref: ライブラリ<211>-Footnote-1326964101
Ref: ライブラリ<211>-Footnote-1336964168
Ref: ライブラリ<211>-Footnote-1346964235
Ref: ライブラリ<211>-Footnote-1356964302
Ref: ライブラリ<211>-Footnote-1366964369
Ref: ライブラリ<211>-Footnote-1376964436
Ref: ライブラリ<211>-Footnote-1386964503
Ref: ライブラリ<211>-Footnote-1396964570
Ref: ライブラリ<211>-Footnote-1406964637
Ref: ライブラリ<211>-Footnote-1416964704
Ref: ライブラリ<211>-Footnote-1426964771
Ref: ライブラリ<211>-Footnote-1436964837
Ref: ライブラリ<211>-Footnote-1446964903
Ref: ライブラリ<211>-Footnote-1456964970
Ref: ライブラリ<211>-Footnote-1466965037
Ref: ライブラリ<211>-Footnote-1476965104
Ref: ライブラリ<211>-Footnote-1486965171
Ref: ライブラリ<211>-Footnote-1496965238
Ref: ライブラリ<211>-Footnote-1506965305
Ref: ライブラリ<211>-Footnote-1516965372
Ref: ライブラリ<211>-Footnote-1526965439
Ref: ライブラリ<211>-Footnote-1536965506
Ref: ライブラリ<211>-Footnote-1546965573
Ref: ライブラリ<211>-Footnote-1556965640
Ref: ライブラリ<211>-Footnote-1566965707
Ref: ライブラリ<211>-Footnote-1576965774
Ref: ライブラリ<211>-Footnote-1586965840
Ref: ライブラリ<211>-Footnote-1596965907
Ref: ライブラリ<211>-Footnote-1606965974
Ref: ライブラリ<211>-Footnote-1616966041
Ref: ライブラリ<211>-Footnote-1626966108
Ref: ライブラリ<211>-Footnote-1636966175
Ref: ライブラリ<211>-Footnote-1646966242
Ref: ライブラリ<211>-Footnote-1656966309
Ref: ライブラリ<211>-Footnote-1666966376
Ref: ライブラリ<211>-Footnote-1676966443
Ref: ライブラリ<211>-Footnote-1686966510
Ref: ライブラリ<211>-Footnote-1696966577
Ref: ライブラリ<211>-Footnote-1706966644
Ref: ライブラリ<211>-Footnote-1716966711
Ref: ライブラリ<211>-Footnote-1726966778
Ref: ライブラリ<211>-Footnote-1736966845
Ref: ライブラリ<211>-Footnote-1746966912
Ref: ライブラリ<211>-Footnote-1756966979
Ref: ライブラリ<211>-Footnote-1766967046
Ref: ライブラリ<211>-Footnote-1776967113
Ref: ライブラリ<211>-Footnote-1786967180
Ref: ライブラリ<211>-Footnote-1796967247
Ref: ライブラリ<211>-Footnote-1806967314
Ref: ライブラリ<211>-Footnote-1816967381
Ref: ライブラリ<211>-Footnote-1826967448
Ref: ライブラリ<211>-Footnote-1836967515
Ref: ライブラリ<211>-Footnote-1846967582
Ref: ライブラリ<211>-Footnote-1856967649
Ref: ライブラリ<211>-Footnote-1866967716
Ref: ライブラリ<211>-Footnote-1876967783
Ref: ライブラリ<211>-Footnote-1886967850
Ref: ライブラリ<211>-Footnote-1896967916
Ref: ライブラリ<211>-Footnote-1906967983
Ref: ライブラリ<211>-Footnote-1916968050
Ref: ライブラリ<211>-Footnote-1926968117
Ref: ライブラリ<211>-Footnote-1936968184
Ref: ライブラリ<211>-Footnote-1946968251
Ref: ライブラリ<211>-Footnote-1956968318
Ref: ライブラリ<211>-Footnote-1966968385
Ref: ライブラリ<211>-Footnote-1976968451
Ref: ライブラリ<211>-Footnote-1986968518
Ref: ライブラリ<211>-Footnote-1996968585
Ref: ライブラリ<211>-Footnote-2006968652
Ref: ライブラリ<211>-Footnote-2016968719
Ref: ライブラリ<211>-Footnote-2026968786
Ref: ライブラリ<211>-Footnote-2036968853
Ref: ライブラリ<211>-Footnote-2046968919
Ref: ライブラリ<211>-Footnote-2056968986
Ref: ライブラリ<211>-Footnote-2066969053
Ref: ライブラリ<211>-Footnote-2076969120
Ref: ライブラリ<211>-Footnote-2086969187
Ref: ライブラリ<211>-Footnote-2096969254
Ref: ライブラリ<211>-Footnote-2106969321
Ref: ライブラリ<211>-Footnote-2116969388
Ref: ライブラリ<211>-Footnote-2126969455
Ref: ライブラリ<211>-Footnote-2136969522
Ref: ライブラリ<211>-Footnote-2146969589
Ref: ライブラリ<211>-Footnote-2156969656
Ref: ライブラリ<211>-Footnote-2166969723
Ref: ライブラリ<211>-Footnote-2176969790
Ref: ライブラリ<211>-Footnote-2186969857
Ref: ライブラリ<211>-Footnote-2196969924
Ref: ライブラリ<211>-Footnote-2206969991
Ref: ライブラリ<211>-Footnote-2216970058
Ref: ライブラリ<211>-Footnote-2226970125
Ref: ライブラリ<211>-Footnote-2236970192
Ref: ライブラリ<211>-Footnote-2246970259
Ref: ライブラリ<211>-Footnote-2256970325
Ref: ライブラリ<211>-Footnote-2266970391
Ref: ライブラリ<211>-Footnote-2276970458
Ref: ライブラリ<211>-Footnote-2286970525
Ref: ライブラリ<211>-Footnote-2296970592
Ref: ライブラリ<211>-Footnote-2306970659
Ref: ライブラリ<211>-Footnote-2316970726
Ref: ライブラリ<211>-Footnote-2326970793
Ref: ライブラリ<211>-Footnote-2336970860
Ref: ライブラリ<211>-Footnote-2346970927
Ref: ライブラリ<211>-Footnote-2356970994
Ref: ライブラリ<211>-Footnote-2366971061
Ref: ライブラリ<211>-Footnote-2376971128
Ref: ライブラリ<211>-Footnote-2386971195
Ref: ライブラリ<211>-Footnote-2396971262
Ref: ライブラリ<211>-Footnote-2406971329
Ref: ライブラリ<211>-Footnote-2416971396
Ref: ライブラリ<211>-Footnote-2426971463
Ref: ライブラリ<211>-Footnote-2436971530
Ref: ライブラリ<211>-Footnote-2446971597
Ref: ライブラリ<211>-Footnote-2456971664
Ref: ライブラリ<211>-Footnote-2466971730
Ref: ライブラリ<211>-Footnote-2476971797
Ref: ライブラリ<211>-Footnote-2486971864
Ref: ライブラリ<211>-Footnote-2496971931
Ref: ライブラリ<211>-Footnote-2506971998
Ref: ライブラリ<211>-Footnote-2516972065
Ref: ライブラリ<211>-Footnote-2526972132
Ref: ライブラリ<211>-Footnote-2536972199
Ref: ライブラリ<211>-Footnote-2546972266
Ref: ライブラリ<211>-Footnote-2556972333
Ref: ライブラリ<211>-Footnote-2566972400
Ref: ライブラリ<211>-Footnote-2576972467
Ref: ライブラリ<211>-Footnote-2586972534
Ref: ライブラリ<211>-Footnote-2596972601
Ref: ライブラリ<211>-Footnote-2606972668
Ref: ライブラリ<211>-Footnote-2616972735
Ref: ライブラリ<211>-Footnote-2626972802
Ref: ライブラリ<211>-Footnote-2636972869
Ref: ライブラリ<211>-Footnote-2646972936
Ref: ライブラリ<211>-Footnote-2656973003
Ref: ライブラリ<211>-Footnote-2666973070
Ref: ライブラリ<211>-Footnote-2676973137
Ref: ライブラリ<211>-Footnote-2686973204
Ref: ライブラリ<211>-Footnote-2696973271
Ref: ライブラリ<211>-Footnote-2706973338
Ref: ライブラリ<211>-Footnote-2716973405
Ref: ライブラリ<211>-Footnote-2726973472
Ref: ライブラリ<211>-Footnote-2736973539
Ref: ライブラリ<211>-Footnote-2746973606
Ref: ライブラリ<211>-Footnote-2756973673
Ref: ライブラリ<211>-Footnote-2766973740
Ref: ライブラリ<211>-Footnote-2776973807
Ref: ライブラリ<211>-Footnote-2786973873
Ref: ライブラリ<211>-Footnote-2796973940
Ref: ライブラリ<211>-Footnote-2806974007
Ref: ライブラリ<211>-Footnote-2816974074
Ref: ライブラリ<211>-Footnote-2826974141
Ref: ライブラリ<211>-Footnote-2836974208
Ref: ライブラリ<211>-Footnote-2846974275
Ref: ライブラリ<211>-Footnote-2856974342
Ref: ライブラリ<211>-Footnote-2866974409
Ref: ライブラリ<211>-Footnote-2876974476
Ref: ライブラリ<211>-Footnote-2886974543
Ref: ライブラリ<211>-Footnote-2896974610
Ref: ライブラリ<211>-Footnote-2906974654
Ref: ライブラリ<211>-Footnote-2916974721
Ref: ライブラリ<211>-Footnote-2926974788
Ref: ライブラリ<211>-Footnote-2936974855
Ref: ライブラリ<211>-Footnote-2946974922
Ref: ライブラリ<211>-Footnote-2956974989
Ref: ライブラリ<211>-Footnote-2966975056
Ref: ライブラリ<211>-Footnote-2976975123
Ref: ライブラリ<211>-Footnote-2986975190
Ref: ライブラリ<211>-Footnote-2996975257
Ref: ライブラリ<211>-Footnote-3006975324
Ref: ライブラリ<211>-Footnote-3016975391
Ref: ライブラリ<211>-Footnote-3026975458
Ref: ライブラリ<211>-Footnote-3036975525
Ref: ライブラリ<211>-Footnote-3046975592
Ref: ライブラリ<211>-Footnote-3056975659
Ref: ライブラリ<211>-Footnote-3066975726
Ref: ライブラリ<211>-Footnote-3076975793
Ref: ライブラリ<211>-Footnote-3086975860
Ref: ライブラリ<211>-Footnote-3096975927
Ref: ライブラリ<211>-Footnote-3106975994
Ref: ライブラリ<211>-Footnote-3116976061
Ref: ライブラリ<211>-Footnote-3126976128
Ref: ライブラリ<211>-Footnote-3136976195
Ref: ライブラリ<211>-Footnote-3146976262
Ref: ライブラリ<211>-Footnote-3156976329
Ref: ライブラリ<211>-Footnote-3166976395
Ref: ライブラリ<211>-Footnote-3176976462
Ref: ライブラリ<211>-Footnote-3186976529
Ref: ライブラリ<211>-Footnote-3196976596
Ref: ライブラリ<211>-Footnote-3206976663
Ref: ライブラリ<211>-Footnote-3216976730
Ref: ライブラリ<211>-Footnote-3226976797
Ref: ライブラリ<211>-Footnote-3236976864
Ref: ライブラリ<211>-Footnote-3246976931
Ref: ライブラリ<211>-Footnote-3256976998
Ref: ライブラリ<211>-Footnote-3266977065
Ref: ライブラリ<211>-Footnote-3276977132
Ref: ライブラリ<211>-Footnote-3286977199
Ref: ライブラリ<211>-Footnote-3296977266
Ref: ライブラリ<211>-Footnote-3306977333
Ref: ライブラリ<211>-Footnote-3316977400
Ref: ライブラリ<211>-Footnote-3326977467
Ref: ライブラリ<211>-Footnote-3336977534
Ref: ライブラリ<211>-Footnote-3346977601
Ref: ライブラリ<211>-Footnote-3356977668
Ref: ライブラリ<211>-Footnote-3366977734
Ref: ライブラリ<211>-Footnote-3376977801
Ref: ライブラリ<211>-Footnote-3386977868
Ref: ライブラリ<211>-Footnote-3396977925
Ref: ライブラリ<211>-Footnote-3406977992
Ref: ライブラリ<211>-Footnote-3416978059
Ref: ライブラリ<211>-Footnote-3426978126
Ref: ライブラリ<211>-Footnote-3436978193
Ref: ライブラリ<211>-Footnote-3446978260
Ref: ライブラリ<211>-Footnote-3456978327
Ref: ライブラリ<211>-Footnote-3466978394
Ref: ライブラリ<211>-Footnote-3476978461
Ref: ライブラリ<211>-Footnote-3486978528
Ref: ライブラリ<211>-Footnote-3496978595
Ref: ライブラリ<211>-Footnote-3506978662
Ref: ライブラリ<211>-Footnote-3516978729
Ref: ライブラリ<211>-Footnote-3526978796
Ref: ライブラリ<211>-Footnote-3536978863
Ref: ライブラリ<211>-Footnote-3546978930
Ref: ライブラリ<211>-Footnote-3556978997
Ref: ライブラリ<211>-Footnote-3566979064
Ref: ライブラリ<211>-Footnote-3576979131
Ref: ライブラリ<211>-Footnote-3586979198
Ref: ライブラリ<211>-Footnote-3596979265
Ref: ライブラリ<211>-Footnote-3606979332
Ref: ライブラリ<211>-Footnote-3616979399
Ref: ライブラリ<211>-Footnote-3626979466
Ref: ライブラリ<211>-Footnote-3636979533
Ref: ライブラリ<211>-Footnote-3646979600
Ref: ライブラリ<211>-Footnote-3656979667
Ref: ライブラリ<211>-Footnote-3666979734
Ref: ライブラリ<211>-Footnote-3676979801
Ref: ライブラリ<211>-Footnote-3686979868
Ref: ライブラリ<211>-Footnote-3696979935
Ref: ライブラリ<211>-Footnote-3706980002
Ref: ライブラリ<211>-Footnote-3716980069
Ref: ライブラリ<211>-Footnote-3726980136
Ref: ライブラリ<211>-Footnote-3736980202
Ref: ライブラリ<211>-Footnote-3746980269
Ref: ライブラリ<211>-Footnote-3756980336
Ref: ライブラリ<211>-Footnote-3766980403
Ref: ライブラリ<211>-Footnote-3776980470
Ref: ライブラリ<211>-Footnote-3786980537
Ref: ライブラリ<211>-Footnote-3796980604
Ref: ライブラリ<211>-Footnote-3806980671
Ref: ライブラリ<211>-Footnote-3816980738
Ref: ライブラリ<211>-Footnote-3826980805
Ref: ライブラリ<211>-Footnote-3836980872
Ref: ライブラリ<211>-Footnote-3846980939
Ref: ライブラリ<211>-Footnote-3856981006
Ref: ライブラリ<211>-Footnote-3866981072
Ref: ライブラリ<211>-Footnote-3876981139
Ref: ライブラリ<211>-Footnote-3886981206
Ref: ライブラリ<211>-Footnote-3896981273
Ref: ライブラリ<211>-Footnote-3906981340
Ref: ライブラリ<211>-Footnote-3916981405
Ref: ライブラリ<211>-Footnote-3926981472
Ref: ライブラリ<211>-Footnote-3936981539
Ref: ライブラリ<211>-Footnote-3946981606
Ref: ライブラリ<211>-Footnote-3956981673
Ref: ライブラリ<211>-Footnote-3966981740
Ref: ライブラリ<211>-Footnote-3976981807
Ref: ライブラリ<211>-Footnote-3986981874
Node: IDLE<64>6981941
Ref: whatsnew/changelog id11006982058
Ref: 200e6982058
Ref: IDLE<64>-Footnote-16985540
Ref: IDLE<64>-Footnote-26985605
Ref: IDLE<64>-Footnote-36985670
Ref: IDLE<64>-Footnote-46985734
Ref: IDLE<64>-Footnote-56985799
Ref: IDLE<64>-Footnote-66985863
Ref: IDLE<64>-Footnote-76985928
Ref: IDLE<64>-Footnote-86985993
Ref: IDLE<64>-Footnote-96986058
Ref: IDLE<64>-Footnote-106986123
Ref: IDLE<64>-Footnote-116986189
Ref: IDLE<64>-Footnote-126986255
Ref: IDLE<64>-Footnote-136986321
Ref: IDLE<64>-Footnote-146986387
Ref: IDLE<64>-Footnote-156986453
Ref: IDLE<64>-Footnote-166986519
Ref: IDLE<64>-Footnote-176986585
Ref: IDLE<64>-Footnote-186986651
Ref: IDLE<64>-Footnote-196986717
Ref: IDLE<64>-Footnote-206986783
Ref: IDLE<64>-Footnote-216986849
Ref: IDLE<64>-Footnote-226986915
Ref: IDLE<64>-Footnote-236986981
Ref: IDLE<64>-Footnote-246987024
Ref: IDLE<64>-Footnote-256987090
Ref: IDLE<64>-Footnote-266987156
Node: ビルド<104>6987222
Ref: whatsnew/changelog id11016987328
Ref: 200f6987328
Ref: ビルド<104>-Footnote-16990741
Ref: ビルド<104>-Footnote-26990806
Ref: ビルド<104>-Footnote-36990871
Ref: ビルド<104>-Footnote-46990936
Ref: ビルド<104>-Footnote-56991001
Ref: ビルド<104>-Footnote-66991066
Ref: ビルド<104>-Footnote-76991131
Ref: ビルド<104>-Footnote-86991196
Ref: ビルド<104>-Footnote-96991261
Ref: ビルド<104>-Footnote-106991326
Ref: ビルド<104>-Footnote-116991392
Ref: ビルド<104>-Footnote-126991458
Ref: ビルド<104>-Footnote-136991524
Ref: ビルド<104>-Footnote-146991590
Ref: ビルド<104>-Footnote-156991656
Ref: ビルド<104>-Footnote-166991722
Ref: ビルド<104>-Footnote-176991788
Ref: ビルド<104>-Footnote-186991854
Ref: ビルド<104>-Footnote-196991920
Ref: ビルド<104>-Footnote-206991986
Ref: ビルド<104>-Footnote-216992052
Ref: ビルド<104>-Footnote-226992118
Ref: ビルド<104>-Footnote-236992184
Ref: ビルド<104>-Footnote-246992250
Ref: ビルド<104>-Footnote-256992316
Ref: ビルド<104>-Footnote-266992382
Node: C API<82>6992448
Ref: whatsnew/changelog id11026992568
Ref: 20106992568
Ref: C API<82>-Footnote-16993933
Ref: C API<82>-Footnote-26993998
Ref: C API<82>-Footnote-36994063
Ref: C API<82>-Footnote-46994128
Ref: C API<82>-Footnote-56994193
Ref: C API<82>-Footnote-66994258
Ref: C API<82>-Footnote-76994323
Node: ドキュメント<88>6994388
Ref: whatsnew/changelog id11036994507
Ref: 20116994507
Ref: ドキュメント<88>-Footnote-16996318
Ref: ドキュメント<88>-Footnote-26996383
Ref: ドキュメント<88>-Footnote-36996448
Ref: ドキュメント<88>-Footnote-46996513
Ref: ドキュメント<88>-Footnote-56996578
Ref: ドキュメント<88>-Footnote-66996642
Ref: ドキュメント<88>-Footnote-76996707
Ref: ドキュメント<88>-Footnote-86996772
Ref: ドキュメント<88>-Footnote-96996837
Ref: ドキュメント<88>-Footnote-106996902
Ref: ドキュメント<88>-Footnote-116996968
Node: テスト<92>6997034
Ref: whatsnew/changelog id11046997159
Ref: 20126997159
Ref: テスト<92>-Footnote-17001355
Ref: テスト<92>-Footnote-27001420
Ref: テスト<92>-Footnote-37001485
Ref: テスト<92>-Footnote-47001550
Ref: テスト<92>-Footnote-57001615
Ref: テスト<92>-Footnote-67001680
Ref: テスト<92>-Footnote-77001745
Ref: テスト<92>-Footnote-87001810
Ref: テスト<92>-Footnote-97001875
Ref: テスト<92>-Footnote-107001940
Ref: テスト<92>-Footnote-117002006
Ref: テスト<92>-Footnote-127002072
Ref: テスト<92>-Footnote-137002138
Ref: テスト<92>-Footnote-147002204
Ref: テスト<92>-Footnote-157002269
Ref: テスト<92>-Footnote-167002335
Ref: テスト<92>-Footnote-177002401
Ref: テスト<92>-Footnote-187002467
Ref: テスト<92>-Footnote-197002533
Ref: テスト<92>-Footnote-207002599
Ref: テスト<92>-Footnote-217002665
Ref: テスト<92>-Footnote-227002731
Ref: テスト<92>-Footnote-237002797
Ref: テスト<92>-Footnote-247002863
Ref: テスト<92>-Footnote-257002929
Ref: テスト<92>-Footnote-267002995
Ref: テスト<92>-Footnote-277003061
Ref: テスト<92>-Footnote-287003127
Ref: テスト<92>-Footnote-297003193
Ref: テスト<92>-Footnote-307003259
Ref: テスト<92>-Footnote-317003325
Ref: テスト<92>-Footnote-327003391
Ref: テスト<92>-Footnote-337003457
Ref: テスト<92>-Footnote-347003523
Ref: テスト<92>-Footnote-357003589
Ref: テスト<92>-Footnote-367003655
Ref: テスト<92>-Footnote-377003721
Node: Tools/Demos<61>7003787
Ref: whatsnew/changelog id11057003901
Ref: 20137003901
Ref: Tools/Demos<61>-Footnote-17005563
Ref: Tools/Demos<61>-Footnote-27005628
Ref: Tools/Demos<61>-Footnote-37005693
Ref: Tools/Demos<61>-Footnote-47005758
Ref: Tools/Demos<61>-Footnote-57005823
Ref: Tools/Demos<61>-Footnote-67005888
Ref: Tools/Demos<61>-Footnote-77005953
Ref: Tools/Demos<61>-Footnote-87006018
Ref: Tools/Demos<61>-Footnote-97006083
Ref: Tools/Demos<61>-Footnote-107006148
Ref: Tools/Demos<61>-Footnote-117006191
Ref: Tools/Demos<61>-Footnote-127006257
Ref: Tools/Demos<61>-Footnote-137006323
Node: Windows<85>7006389
Ref: whatsnew/changelog id11067006481
Ref: 20147006481
Ref: Windows<85>-Footnote-17007688
Ref: Windows<85>-Footnote-27007753
Ref: Windows<85>-Footnote-37007818
Ref: Windows<85>-Footnote-47007883
Ref: Windows<85>-Footnote-57007948
Ref: Windows<85>-Footnote-67008013
Ref: Windows<85>-Footnote-77008078
Node: Python チュートリアル7008143
Ref: tutorial/index doc7008286
Ref: 20157008286
Ref: tutorial/index the-python-tutorial7008286
Ref: 20167008286
Ref: tutorial/index translation-repo7008286
Ref: 20177008286
Ref: tutorial/index tutorial-index7008286
Ref: 20187008286
Node: やる気を高めよう7012105
Ref: tutorial/appetite doc7012237
Ref: 201c7012237
Ref: tutorial/appetite tut-intro7012237
Ref: 201d7012237
Ref: tutorial/appetite whetting-your-appetite7012237
Ref: 201e7012237
Node: Python インタプリタを使う7018486
Ref: tutorial/interpreter doc7018662
Ref: 201f7018662
Ref: tutorial/interpreter translation-repo7018662
Ref: 20207018662
Ref: tutorial/interpreter tut-using7018662
Ref: 20217018662
Ref: tutorial/interpreter using-the-python-interpreter7018662
Ref: 20227018662
Node: インタプリタを起動する7018818
Ref: tutorial/interpreter invoking-the-interpreter7018964
Ref: 20237018964
Ref: tutorial/interpreter tut-invoking7018964
Ref: 20247018964
Ref: インタプリタを起動する-Footnote-17022830
Node: 引数の受け渡し7023102
Ref: tutorial/interpreter argument-passing7023217
Ref: 20287023217
Ref: tutorial/interpreter tut-argpassing7023217
Ref: 20297023217
Node: 対話モード7024410
Ref: tutorial/interpreter interactive-mode7024525
Ref: 202a7024525
Ref: tutorial/interpreter tut-interactive7024525
Ref: 4417024525
Node: インタプリタとその環境7025960
Ref: tutorial/interpreter the-interpreter-and-its-environment7026106
Ref: 202b7026106
Ref: tutorial/interpreter tut-interp7026106
Ref: 202c7026106
Node: ソースコードの文字コード7026227
Ref: tutorial/interpreter source-code-encoding7026333
Ref: 202d7026333
Ref: tutorial/interpreter tut-source-encoding7026333
Ref: 202e7026333
Node: 形式ばらない Python の紹介7028046
Ref: tutorial/introduction doc7028234
Ref: 20307028234
Ref: tutorial/introduction an-informal-introduction-to-python7028234
Ref: 20317028234
Ref: tutorial/introduction translation-repo7028234
Ref: 20327028234
Ref: tutorial/introduction tut-informal7028234
Ref: 20337028234
Node: Python を電卓として使う7029716
Ref: tutorial/introduction tut-calculator7029864
Ref: 20347029864
Ref: tutorial/introduction using-python-as-a-calculator7029864
Ref: 20357029864
Node: 数7030249
Ref: tutorial/introduction numbers7030341
Ref: 20367030341
Ref: tutorial/introduction tut-numbers7030341
Ref: 20377030341
Ref: 数-Footnote-17033747
Node: テキスト7033985
Ref: tutorial/introduction text7034103
Ref: 20397034103
Ref: tutorial/introduction tut-strings7034103
Ref: 203a7034103
Ref: テキスト-Footnote-17044135
Node: リスト型 list7044524
Ref: tutorial/introduction lists7044630
Ref: 203e7044630
Ref: tutorial/introduction tut-lists7044630
Ref: 203f7044630
Node: プログラミングへの第一歩7048372
Ref: tutorial/introduction first-steps-towards-programming7048520
Ref: 20417048520
Ref: tutorial/introduction tut-firststeps7048520
Ref: 20427048520
Ref: プログラミングへの第一歩-Footnote-17052422
Node: その他の制御フローツール7052479
Ref: tutorial/controlflow doc7052648
Ref: 20437052648
Ref: tutorial/controlflow more-control-flow-tools7052648
Ref: 20447052648
Ref: tutorial/controlflow translation-repo7052648
Ref: 20457052648
Ref: tutorial/controlflow tut-morecontrol7052648
Ref: 20467052648
Node: if 文7053172
Ref: tutorial/controlflow if-statements7053267
Ref: 20477053267
Ref: tutorial/controlflow tut-if7053267
Ref: 20487053267
Node: for 文7054344
Ref: tutorial/controlflow for-statements7054460
Ref: 204a7054460
Ref: tutorial/controlflow tut-for7054460
Ref: 204b7054460
Node: range 関数7056136
Ref: tutorial/controlflow the-range-function7056271
Ref: 204c7056271
Ref: tutorial/controlflow tut-range7056271
Ref: 204d7056271
Node: break 文と continue 文7058776
Ref: tutorial/controlflow break-and-continue-statements7058925
Ref: 20507058925
Ref: tutorial/controlflow tut-break7058925
Ref: 20517058925
Ref: tutorial/controlflow tut-for-else7060044
Ref: 20527060044
Node: ループの else 節7060045
Ref: tutorial/controlflow break-and-continue-statements-and-else-clauses-on-loops7060190
Ref: 20537060190
Ref: tutorial/controlflow else-clauses-on-loops7060190
Ref: 20547060190
Node: pass 文7062649
Ref: tutorial/controlflow pass-statements7062778
Ref: 20567062778
Ref: tutorial/controlflow tut-pass7062778
Ref: 20577062778
Node: match 文7064107
Ref: tutorial/controlflow match-statements7064236
Ref: 20597064236
Ref: tutorial/controlflow tut-match7064236
Ref: 20497064236
Ref: match 文-Footnote-17072042
Node: 関数を定義する7072084
Ref: tutorial/controlflow defining-functions7072241
Ref: 205a7072241
Ref: tutorial/controlflow tut-functions7072241
Ref: 205b7072241
Ref: 関数を定義する-Footnote-17078934
Node: 関数定義についてもう少し7079339
Ref: tutorial/controlflow more-on-defining-functions7079527
Ref: 205e7079527
Ref: tutorial/controlflow tut-defining7079527
Ref: 205f7079527
Node: デフォルトの引数値7080042
Ref: tutorial/controlflow default-argument-values7080172
Ref: 20607080172
Ref: tutorial/controlflow tut-defaultargs7080172
Ref: 20617080172
Node: キーワード引数7082516
Ref: tutorial/controlflow keyword-arguments7082679
Ref: 20627082679
Ref: tutorial/controlflow tut-keywordargs7082679
Ref: 20637082679
Node: 特殊なパラメータ7086820
Ref: tutorial/controlflow special-parameters7086977
Ref: 20657086977
Node: 位置またはキーワード引数7088324
Ref: tutorial/controlflow positional-or-keyword-arguments7088451
Ref: 20667088451
Node: 位置専用引数<2>7088659
Ref: tutorial/controlflow positional-only-parameters7088822
Ref: 20677088822
Node: キーワード専用引数7089490
Ref: tutorial/controlflow keyword-only-arguments7089629
Ref: 20687089629
Node: 関数の例7089932
Ref: tutorial/controlflow function-examples7090056
Ref: 20697090056
Node: 要約7093378
Ref: tutorial/controlflow recap7093466
Ref: 206a7093466
Node: 任意引数リスト7094527
Ref: tutorial/controlflow arbitrary-argument-lists7094696
Ref: 206b7094696
Ref: tutorial/controlflow tut-arbitraryargs7094696
Ref: 206c7094696
Node: 引数リストのアンパック7095784
Ref: tutorial/controlflow tut-unpacking-arguments7095941
Ref: 206d7095941
Ref: tutorial/controlflow unpacking-argument-lists7095941
Ref: 206e7095941
Node: ラムダ式7097370
Ref: tutorial/controlflow lambda-expressions7097545
Ref: 206f7097545
Ref: tutorial/controlflow tut-lambda7097545
Ref: 20707097545
Node: ドキュメンテーション文字列7098922
Ref: tutorial/controlflow documentation-strings7099094
Ref: 20717099094
Ref: tutorial/controlflow tut-docstrings7099094
Ref: 205c7099094
Node: 関数のアノテーション7100738
Ref: tutorial/controlflow function-annotations7100889
Ref: 20727100889
Ref: tutorial/controlflow tut-annotations7100889
Ref: 20737100889
Ref: 関数のアノテーション-Footnote-17102317
Ref: 関数のアノテーション-Footnote-27102359
Node: 間奏曲 コーディングスタイル7102401
Ref: tutorial/controlflow intermezzo-coding-style7102559
Ref: 20767102559
Ref: tutorial/controlflow tut-codingstyle7102559
Ref: 20777102559
Ref: 間奏曲 コーディングスタイル-Footnote-17105365
Node: データ構造7105407
Ref: tutorial/datastructures doc7105559
Ref: 20797105559
Ref: tutorial/datastructures data-structures7105559
Ref: 207a7105559
Ref: tutorial/datastructures translation-repo7105559
Ref: 207b7105559
Ref: tutorial/datastructures tut-structures7105559
Ref: 204f7105559
Node: リスト型についてもう少し7106013
Ref: tutorial/datastructures more-on-lists7106117
Ref: 207c7106117
Ref: tutorial/datastructures tut-morelists7106117
Ref: 207d7106117
Ref: リスト型についてもう少し-Footnote-17110840
Node: リストをスタックとして使う7111038
Ref: tutorial/datastructures tut-lists-as-stacks7111195
Ref: 207f7111195
Ref: tutorial/datastructures using-lists-as-stacks7111195
Ref: 20807111195
Node: リストをキューとして使う7112016
Ref: tutorial/datastructures tut-lists-as-queues7112209
Ref: 20827112209
Ref: tutorial/datastructures using-lists-as-queues7112209
Ref: 20837112209
Node: リストの内包表記<2>7113660
Ref: tutorial/datastructures list-comprehensions7113853
Ref: 20847113853
Ref: tutorial/datastructures tut-listcomps7113853
Ref: 20857113853
Node: ネストしたリストの内包表記7117601
Ref: tutorial/datastructures nested-list-comprehensions7117749
Ref: 20867117749
Node: del 文7119617
Ref: tutorial/datastructures the-del-statement7119757
Ref: 20877119757
Ref: tutorial/datastructures tut-del7119757
Ref: 20887119757
Node: タプルとシーケンス7120766
Ref: tutorial/datastructures tuples-and-sequences7120879
Ref: 20897120879
Ref: tutorial/datastructures tut-tuples7120879
Ref: 20647120879
Node: 集合型7124690
Ref: tutorial/datastructures sets7124816
Ref: 208b7124816
Ref: tutorial/datastructures tut-sets7124816
Ref: 208c7124816
Node: 辞書型 dictionary7126977
Ref: tutorial/datastructures dictionaries7127103
Ref: 208e7127103
Ref: tutorial/datastructures tut-dictionaries7127103
Ref: 208f7127103
Node: ループのテクニック7131341
Ref: tutorial/datastructures looping-techniques7131488
Ref: 20917131488
Ref: tutorial/datastructures tut-loopidioms7131488
Ref: 204e7131488
Node: 条件についてもう少し7134534
Ref: tutorial/datastructures more-on-conditions7134703
Ref: 20927134703
Ref: tutorial/datastructures tut-conditions7134703
Ref: 20937134703
Node: シーケンスとその他の型の比較7137387
Ref: tutorial/datastructures comparing-sequences-and-other-types7137520
Ref: 20957137520
Ref: tutorial/datastructures tut-comparing7137520
Ref: 20967137520
Node: モジュール<2>7139556
Ref: tutorial/modules doc7139687
Ref: 20977139687
Ref: tutorial/modules modules7139687
Ref: 20987139687
Ref: tutorial/modules translation-repo7139687
Ref: 20997139687
Ref: tutorial/modules tut-modules7139687
Ref: 209a7139687
Node: モジュールについてもうすこし7143063
Ref: tutorial/modules more-on-modules7143190
Ref: 209d7143190
Ref: tutorial/modules tut-moremodules7143190
Ref: 209e7143190
Ref: モジュールについてもうすこし-Footnote-17147732
Node: モジュールをスクリプトとして実行する7147952
Ref: tutorial/modules executing-modules-as-scripts7148121
Ref: 209f7148121
Ref: tutorial/modules tut-modulesasscripts7148121
Ref: 20a07148121
Node: モジュール検索パス7149349
Ref: tutorial/modules the-module-search-path7149574
Ref: 20a17149574
Ref: tutorial/modules tut-searchpath7149574
Ref: 20a27149574
Node: "コンパイル" された Python ファイル7151763
Ref: tutorial/modules compiled-python-files7151925
Ref: 20a57151925
Ref: tutorial/modules tut-pycache7151925
Ref: 8ec7151925
Ref: "コンパイル" された Python ファイル-Footnote-17155467
Node: 標準モジュール7155509
Ref: tutorial/modules standard-modules7155655
Ref: 20a67155655
Ref: tutorial/modules tut-standardmodules7155655
Ref: 20a47155655
Node: dir 関数7157406
Ref: tutorial/modules the-dir-function7157525
Ref: 20a77157525
Ref: tutorial/modules tut-dir7157525
Ref: 20a87157525
Node: パッケージ7162240
Ref: tutorial/modules packages7162329
Ref: 20a97162329
Ref: tutorial/modules tut-packages7162329
Ref: 20aa7162329
Node: パッケージから * を import する7168223
Ref: tutorial/modules importing-from-a-package7168349
Ref: 20ab7168349
Ref: tutorial/modules tut-pkg-import-star7168349
Ref: 20ac7168349
Node: パッケージ内参照7173080
Ref: tutorial/modules id27173260
Ref: 20ad7173260
Ref: tutorial/modules intra-package-references7173260
Ref: 20ae7173260
Node: 複数ディレクトリ中のパッケージ7174522
Ref: tutorial/modules packages-in-multiple-directories7174652
Ref: 20af7174652
Node: 入力と出力7175501
Ref: tutorial/inputoutput doc7175635
Ref: 20b17175635
Ref: tutorial/inputoutput input-and-output7175635
Ref: 20b27175635
Ref: tutorial/inputoutput translation-repo7175635
Ref: 20b37175635
Ref: tutorial/inputoutput tut-io7175635
Ref: 20b47175635
Node: 出力を見やすくフォーマットする7176069
Ref: tutorial/inputoutput fancier-output-formatting7176208
Ref: 20b57176208
Ref: tutorial/inputoutput tut-formatting7176208
Ref: 20b67176208
Node: フォーマット済み文字列リテラル7181132
Ref: tutorial/inputoutput formatted-string-literals7181300
Ref: 20b97181300
Ref: tutorial/inputoutput tut-f-strings7181300
Ref: 20b87181300
Node: 文字列の format メソッド7183694
Ref: tutorial/inputoutput the-string-format-method7183916
Ref: 20ba7183916
Ref: tutorial/inputoutput tut-string-format7183916
Ref: 20bb7183916
Node: 文字列の手作業でのフォーマット7187053
Ref: tutorial/inputoutput manual-string-formatting7187263
Ref: 20bc7187263
Node: 古い文字列書式設定方法7189231
Ref: tutorial/inputoutput old-string-formatting7189400
Ref: 20c07189400
Node: ファイルを読み書きする7190058
Ref: tutorial/inputoutput reading-and-writing-files7190197
Ref: 20c17190197
Ref: tutorial/inputoutput tut-files7190197
Ref: 20c27190197
Node: ファイルオブジェクトのメソッド7194447
Ref: tutorial/inputoutput methods-of-file-objects7194621
Ref: 20c37194621
Ref: tutorial/inputoutput tut-filemethods7194621
Ref: 20c47194621
Node: json による構造化されたデータの保存7199614
Ref: tutorial/inputoutput saving-structured-data-with-json7199788
Ref: 20c67199788
Ref: tutorial/inputoutput tut-json7199788
Ref: 20c77199788
Ref: json による構造化されたデータの保存-Footnote-17203632
Node: エラーと例外7203657
Ref: tutorial/errors doc7203782
Ref: 20cb7203782
Ref: tutorial/errors errors-and-exceptions7203782
Ref: 20cc7203782
Ref: tutorial/errors translation-repo7203782
Ref: 20cd7203782
Ref: tutorial/errors tut-errors7203782
Ref: 20ce7203782
Node: 構文エラー7204566
Ref: tutorial/errors syntax-errors7204651
Ref: 20cf7204651
Ref: tutorial/errors tut-syntaxerrors7204651
Ref: 20d07204651
Node: 例外7205691
Ref: tutorial/errors exceptions7205806
Ref: 20d17205806
Ref: tutorial/errors tut-exceptions7205806
Ref: 20d27205806
Node: 例外を処理する7208177
Ref: tutorial/errors handling-exceptions7208298
Ref: 20d37208298
Ref: tutorial/errors tut-handling7208298
Ref: 20557208298
Node: 例外を送出する7216115
Ref: tutorial/errors raising-exceptions7216245
Ref: 20d47216245
Ref: tutorial/errors tut-raising7216245
Ref: 20d57216245
Node: 例外の連鎖7217645
Ref: tutorial/errors exception-chaining7217778
Ref: 20d67217778
Ref: tutorial/errors tut-exception-chaining7217778
Ref: 20d77217778
Node: ユーザー定義例外7220071
Ref: tutorial/errors tut-userexceptions7220225
Ref: 20d87220225
Ref: tutorial/errors user-defined-exceptions7220225
Ref: 20d97220225
Node: クリーンアップ動作を定義する7221285
Ref: tutorial/errors defining-clean-up-actions7221463
Ref: 20da7221463
Ref: tutorial/errors tut-cleanup7221463
Ref: 20db7221463
Ref: クリーンアップ動作を定義する-Footnote-17225508
Ref: クリーンアップ動作を定義する-Footnote-27225550
Node: 定義済みクリーンアップ処理7225592
Ref: tutorial/errors predefined-clean-up-actions7225794
Ref: 20dc7225794
Ref: tutorial/errors tut-cleanup-with7225794
Ref: 20dd7225794
Node: 複数の関連しない例外の送出と処理7227092
Ref: tutorial/errors raising-and-handling-multiple-unrelated-exceptions7227297
Ref: 20de7227297
Ref: tutorial/errors tut-exception-groups7227297
Ref: 20df7227297
Node: ノートによって例外を充実させる7231051
Ref: tutorial/errors enriching-exceptions-with-notes7231208
Ref: 20e07231208
Ref: tutorial/errors tut-exception-notes7231208
Ref: 20e17231208
Node: クラス7234228
Ref: tutorial/classes doc7234372
Ref: 20e27234372
Ref: tutorial/classes classes7234372
Ref: 20e37234372
Ref: tutorial/classes translation-repo7234372
Ref: 20e47234372
Ref: tutorial/classes tut-classes7234372
Ref: 205d7234372
Node: 名前とオブジェクトについて7237772
Ref: tutorial/classes a-word-about-names-and-objects7237903
Ref: 20e67237903
Ref: tutorial/classes tut-object7237903
Ref: 20e77237903
Node: Python のスコープと名前空間7239226
Ref: tutorial/classes python-scopes-and-namespaces7239381
Ref: 20e87239381
Ref: tutorial/classes tut-scopes7239381
Ref: 209c7239381
Ref: Python のスコープと名前空間-Footnote-17247617
Node: スコープと名前空間の例7248153
Ref: tutorial/classes scopes-and-namespaces-example7248260
Ref: 20ea7248260
Ref: tutorial/classes tut-scopeexample7248260
Ref: 20eb7248260
Node: クラス初見7249748
Ref: tutorial/classes a-first-look-at-classes7249888
Ref: 20ec7249888
Ref: tutorial/classes tut-firstclasses7249888
Ref: 20787249888
Node: クラス定義の構文7250281
Ref: tutorial/classes class-definition-syntax7250393
Ref: 20ed7250393
Ref: tutorial/classes tut-classdefinition7250393
Ref: 20ee7250393
Node: クラスオブジェクト7252336
Ref: tutorial/classes class-objects7252493
Ref: 20ef7252493
Ref: tutorial/classes tut-classobjects7252493
Ref: 20f07252493
Node: インスタンスオブジェクト7255426
Ref: tutorial/classes instance-objects7255589
Ref: 20f27255589
Ref: tutorial/classes tut-instanceobjects7255589
Ref: 20f37255589
Node: メソッドオブジェクト7257418
Ref: tutorial/classes method-objects7257590
Ref: 20f47257590
Ref: tutorial/classes tut-methodobjects7257590
Ref: 20f57257590
Node: クラスとインスタンス変数7260075
Ref: tutorial/classes class-and-instance-variables7260202
Ref: 20f67260202
Ref: tutorial/classes tut-class-and-instance-variables7260202
Ref: 20f77260202
Node: いろいろな注意点7262451
Ref: tutorial/classes random-remarks7262560
Ref: 20f87262560
Ref: tutorial/classes tut-remarks7262560
Ref: 20f97262560
Node: 継承7267711
Ref: tutorial/classes inheritance7267829
Ref: 20fa7267829
Ref: tutorial/classes tut-inheritance7267829
Ref: 20fb7267829
Node: 多重継承7271691
Ref: tutorial/classes multiple-inheritance7271746
Ref: 20fc7271746
Ref: tutorial/classes tut-multiple7271746
Ref: 20fd7271746
Node: プライベート変数7274242
Ref: tutorial/classes private-variables7274357
Ref: 20fe7274357
Ref: tutorial/classes tut-private7274357
Ref: 20e57274357
Node: 残りのはしばし7277846
Ref: tutorial/classes odds-and-ends7277979
Ref: 21007277979
Ref: tutorial/classes tut-odds7277979
Ref: 21017277979
Node: イテレータ iterator7279418
Ref: tutorial/classes iterators7279555
Ref: 21037279555
Ref: tutorial/classes tut-iterators7279555
Ref: 21047279555
Node: ジェネレータ generator7282338
Ref: tutorial/classes generators7282475
Ref: 21067282475
Ref: tutorial/classes tut-generators7282475
Ref: 21077282475
Node: ジェネレータ式7284413
Ref: tutorial/classes generator-expressions7284517
Ref: 210a7284517
Ref: tutorial/classes tut-genexps7284517
Ref: 210b7284517
Node: Brief tour of the standard library7285697
Ref: tutorial/stdlib doc7285869
Ref: 210c7285869
Ref: tutorial/stdlib brief-tour-of-the-standard-library7285869
Ref: 210d7285869
Ref: tutorial/stdlib translation-repo7285869
Ref: 210e7285869
Ref: tutorial/stdlib tut-brieftour7285869
Ref: 210f7285869
Node: Operating system interface7286261
Ref: tutorial/stdlib operating-system-interface7286381
Ref: 21107286381
Ref: tutorial/stdlib tut-os-interface7286381
Ref: 21117286381
Node: File wildcards7287906
Ref: tutorial/stdlib file-wildcards7288057
Ref: 21127288057
Ref: tutorial/stdlib tut-file-wildcards7288057
Ref: 21137288057
Node: Command-line arguments7288371
Ref: tutorial/stdlib command-line-arguments7288544
Ref: 21147288544
Ref: tutorial/stdlib tut-command-line-arguments7288544
Ref: 21157288544
Node: Error output redirection and program termination7289918
Ref: tutorial/stdlib error-output-redirection-and-program-termination7290100
Ref: 21167290100
Ref: tutorial/stdlib tut-stderr7290100
Ref: 21177290100
Node: String pattern matching7290714
Ref: tutorial/stdlib string-pattern-matching7290880
Ref: 21187290880
Ref: tutorial/stdlib tut-string-pattern-matching7290880
Ref: 21197290880
Node: 数学7291580
Ref: tutorial/stdlib mathematics7291713
Ref: 211a7291713
Ref: tutorial/stdlib tut-mathematics7291713
Ref: 211b7291713
Node: Internet access7293053
Ref: tutorial/stdlib internet-access7293178
Ref: 211c7293178
Ref: tutorial/stdlib tut-internet-access7293178
Ref: 211d7293178
Node: Dates and times7294380
Ref: tutorial/stdlib dates-and-times7294515
Ref: 211e7294515
Ref: tutorial/stdlib tut-dates-and-times7294515
Ref: 211f7294515
Node: Data compression7295497
Ref: tutorial/stdlib data-compression7295640
Ref: 21207295640
Ref: tutorial/stdlib tut-data-compression7295640
Ref: 21217295640
Node: Performance measurement7296211
Ref: tutorial/stdlib performance-measurement7296354
Ref: 21227296354
Ref: tutorial/stdlib tut-performance-measurement7296354
Ref: 21237296354
Node: Quality control7297503
Ref: tutorial/stdlib quality-control7297648
Ref: 21247297648
Ref: tutorial/stdlib tut-quality-control7297648
Ref: 21257297648
Node: Batteries included7299550
Ref: tutorial/stdlib batteries-included7299663
Ref: 21267299663
Ref: tutorial/stdlib tut-batteries-included7299663
Ref: 21277299663
Ref: Batteries included-Footnote-17302082
Node: Brief tour of the standard library --- part II7302141
Ref: tutorial/stdlib2 doc7302334
Ref: 21287302334
Ref: tutorial/stdlib2 brief-tour-of-the-standard-library-part-ii7302334
Ref: 21297302334
Ref: tutorial/stdlib2 translation-repo7302334
Ref: 212a7302334
Ref: tutorial/stdlib2 tut-brieftourtwo7302334
Ref: 212b7302334
Node: Output formatting7302979
Ref: tutorial/stdlib2 output-formatting7303115
Ref: 212c7303115
Ref: tutorial/stdlib2 tut-output-formatting7303115
Ref: 212d7303115
Node: 文字列テンプレート7305529
Ref: tutorial/stdlib2 templating7305713
Ref: 212e7305713
Ref: tutorial/stdlib2 tut-templating7305713
Ref: 212f7305713
Node: Working with binary data record layouts7309070
Ref: tutorial/stdlib2 tut-binary-formats7309270
Ref: 21327309270
Ref: tutorial/stdlib2 working-with-binary-data-record-layouts7309270
Ref: 21337309270
Node: マルチスレッディング<2>7310641
Ref: tutorial/stdlib2 multi-threading7310826
Ref: 21347310826
Ref: tutorial/stdlib2 tut-multi-threading7310826
Ref: 21357310826
Node: ログ記録7313258
Ref: tutorial/stdlib2 logging7313419
Ref: 21367313419
Ref: tutorial/stdlib2 tut-logging7313419
Ref: 21377313419
Node: Weak references7314995
Ref: tutorial/stdlib2 tut-weak-references7315151
Ref: 213e7315151
Ref: tutorial/stdlib2 weak-references7315151
Ref: 213f7315151
Node: Tools for working with lists7317314
Ref: tutorial/stdlib2 tools-for-working-with-lists7317491
Ref: 21407317491
Ref: tutorial/stdlib2 tut-list-tools7317491
Ref: 21417317491
Node: Decimal floating-point arithmetic7320440
Ref: tutorial/stdlib2 decimal-floating-point-arithmetic7320593
Ref: 21427320593
Ref: tutorial/stdlib2 tut-decimal-fp7320593
Ref: 21437320593
Node: 仮想環境とパッケージ7322938
Ref: tutorial/venv doc7323112
Ref: 21447323112
Ref: tutorial/venv translation-repo7323112
Ref: 21457323112
Ref: tutorial/venv tut-venv7323112
Ref: 21467323112
Ref: tutorial/venv virtual-environments-and-packages7323112
Ref: 21477323112
Node: はじめに<4>7323286
Ref: tutorial/venv introduction7323398
Ref: 21487323398
Node: 仮想環境の作成7325208
Ref: tutorial/venv creating-virtual-environments7325366
Ref: 214a7325366
Node: pip を使ったパッケージ管理7328077
Ref: tutorial/venv managing-packages-with-pip7328211
Ref: 214b7328211
Ref: pip を使ったパッケージ管理-Footnote-17332782
Ref: pip を使ったパッケージ管理-Footnote-27332807
Node: さあ何を？7332885
Ref: tutorial/whatnow doc7333046
Ref: 214c7333046
Ref: tutorial/whatnow translation-repo7333046
Ref: 214d7333046
Ref: tutorial/whatnow tut-whatnow7333046
Ref: 214e7333046
Ref: tutorial/whatnow what-now7333046
Ref: 214f7333046
Ref: さあ何を？-Footnote-17337319
Node: 対話入力編集と履歴置換7337462
Ref: tutorial/interactive doc7337638
Ref: 21517337638
Ref: tutorial/interactive interactive-input-editing-and-history-substitution7337638
Ref: 21527337638
Ref: tutorial/interactive translation-repo7337638
Ref: 21537337638
Ref: tutorial/interactive tut-interacting7337638
Ref: 20277337638
Ref: 対話入力編集と履歴置換-Footnote-17338334
Node: タブ補完と履歴編集7338395
Ref: tutorial/interactive tab-completion-and-history-editing7338540
Ref: 21547338540
Ref: tutorial/interactive tut-keybindings7338540
Ref: 21557338540
Node: 対話的インタープリタの代替7339633
Ref: tutorial/interactive alternatives-to-the-interactive-interpreter7339778
Ref: 21567339778
Ref: tutorial/interactive tut-commentary7339778
Ref: 21577339778
Ref: 対話的インタープリタの代替-Footnote-17340975
Ref: 対話的インタープリタの代替-Footnote-27341004
Node: 浮動小数点演算、その問題と制限7341045
Ref: tutorial/floatingpoint doc7341212
Ref: 21597341212
Ref: tutorial/floatingpoint floating-point-arithmetic-issues-and-limitations7341212
Ref: 215a7341212
Ref: tutorial/floatingpoint translation-repo7341212
Ref: 215b7341212
Ref: tutorial/floatingpoint tut-fp-issues7341212
Ref: 215c7341212
Ref: 浮動小数点演算、その問題と制限-Footnote-17352396
Ref: 浮動小数点演算、その問題と制限-Footnote-27352474
Node: 表現エラー7352525
Ref: tutorial/floatingpoint representation-error7352622
Ref: 215f7352622
Ref: tutorial/floatingpoint tut-fp-error7352622
Ref: 21607352622
Node: 付録7356697
Ref: tutorial/appendix doc7356822
Ref: 21617356822
Ref: tutorial/appendix appendix7356822
Ref: 21627356822
Ref: tutorial/appendix translation-repo7356822
Ref: 21637356822
Ref: tutorial/appendix tut-appendix7356822
Ref: 21647356822
Node: 対話モード<2>7356894
Ref: tutorial/appendix interactive-mode7356955
Ref: 21657356955
Ref: tutorial/appendix tut-interac7356955
Ref: 4947356955
Node: エラー処理7358274
Ref: tutorial/appendix error-handling7358391
Ref: 21667358391
Ref: tutorial/appendix tut-error7358391
Ref: 21677358391
Ref: エラー処理-Footnote-17359772
Node: 実行可能な Python スクリプト7359879
Ref: tutorial/appendix executable-python-scripts7360053
Ref: 21687360053
Ref: tutorial/appendix tut-scripts7360053
Ref: 202f7360053
Node: 対話モード用の起動時実行ファイル7361618
Ref: tutorial/appendix the-interactive-startup-file7361813
Ref: 21697361813
Ref: tutorial/appendix tut-startup7361813
Ref: 216a7361813
Node: カスタマイズ用モジュール7363910
Ref: tutorial/appendix the-customization-modules7364058
Ref: 216b7364058
Ref: tutorial/appendix tut-customize7364058
Ref: 216c7364058
Node: Python のセットアップと利用7365308
Ref: using/index doc7365462
Ref: 216d7365462
Ref: using/index python-setup-and-usage7365462
Ref: 216e7365462
Ref: using/index translation-repo7365462
Ref: 216f7365462
Ref: using/index using-index7365462
Ref: 21707365462
Node: コマンドラインと環境<2>7366064
Ref: using/cmdline doc7366229
Ref: 21717366229
Ref: using/cmdline command-line-and-environment7366229
Ref: 21727366229
Ref: using/cmdline using-on-general7366229
Ref: 1e047366229
Node: コマンドライン7366633
Ref: using/cmdline command-line7366745
Ref: 21747366745
Ref: using/cmdline using-on-cmdline7366745
Ref: 120d7366745
Node: インターフェイスオプション7367242
Ref: using/cmdline interface-options7367369
Ref: 21757367369
Ref: using/cmdline using-on-interface-options7367369
Ref: 21767367369
Ref: using/cmdline cmdoption-c7369067
Ref: 1a97369067
Ref: using/cmdline cmdoption-m7369925
Ref: 23e7369925
Ref: using/cmdline cmdarg-dash7372886
Ref: 21777372886
Ref: using/cmdline cmdarg-script7373439
Ref: 21787373439
Ref: インターフェイスオプション-Footnote-17375684
Node: 一般オプション7375726
Ref: using/cmdline generic-options7375889
Ref: 21797375889
Ref: using/cmdline using-on-generic-options7375889
Ref: 217a7375889
Ref: using/cmdline cmdoption-07375943
Ref: 16467375943
Ref: using/cmdline cmdoption-h7375958
Ref: 217b7375958
Ref: using/cmdline cmdoption-help7375973
Ref: 8067375973
Ref: using/cmdline cmdoption-help-env7376108
Ref: 8087376108
Ref: using/cmdline cmdoption-help-xoptions7376249
Ref: 8097376249
Ref: using/cmdline cmdoption-help-all7376398
Ref: 80a7376398
Ref: using/cmdline cmdoption-V7376500
Ref: 49b7376500
Ref: using/cmdline cmdoption-version7376515
Ref: f1b7376515
Node: その他のオプション7376900
Ref: using/cmdline miscellaneous-options7377036
Ref: 217c7377036
Ref: using/cmdline using-on-misc-options7377036
Ref: 120e7377036
Ref: using/cmdline cmdoption-b7377100
Ref: 7f97377100
Ref: using/cmdline cmdoption-B7377523
Ref: 15eb7377523
Ref: using/cmdline cmdoption-check-hash-based-pycs7377774
Ref: 217d7377774
Ref: using/cmdline cmdoption-d7378493
Ref: 217e7378493
Ref: using/cmdline cmdoption-E7378724
Ref: b5a7378724
Ref: using/cmdline cmdoption-i7378948
Ref: 16f97378948
Ref: using/cmdline cmdoption-I7379674
Ref: b5b7379674
Ref: using/cmdline cmdoption-O7380174
Ref: 18d7380174
Ref: using/cmdline cmdoption-OO7380589
Ref: fb97380589
Ref: using/cmdline cmdoption-P7380921
Ref: 7c17380921
Ref: using/cmdline cmdoption-q7381582
Ref: 17ee7381582
Ref: using/cmdline cmdoption-R7381749
Ref: 1ed47381749
Ref: using/cmdline cmdoption-s7382896
Ref: 15aa7382896
Ref: using/cmdline cmdoption-S7383189
Ref: 13c47383189
Ref: using/cmdline cmdoption-u7383576
Ref: 1deb7383576
Ref: using/cmdline cmdoption-v7383881
Ref: 16437383881
Ref: using/cmdline using-on-warnings7384582
Ref: 21847384582
Ref: using/cmdline cmdoption-W7384582
Ref: aca7384582
Ref: using/cmdline cmdoption-x7387291
Ref: 21867387291
Ref: using/cmdline cmdoption-X7387497
Ref: 1707387497
Ref: その他のオプション-Footnote-17396402
Ref: その他のオプション-Footnote-27396444
Ref: その他のオプション-Footnote-37396486
Ref: その他のオプション-Footnote-47396528
Ref: その他のオプション-Footnote-57396570
Ref: その他のオプション-Footnote-67396612
Ref: その他のオプション-Footnote-77396654
Ref: その他のオプション-Footnote-87396696
Node: 色の制御7396728
Ref: using/cmdline controlling-color7396834
Ref: 218d7396834
Ref: using/cmdline using-on-controlling-color7396834
Ref: 1b97396834
Ref: 色の制御-Footnote-17398121
Ref: 色の制御-Footnote-27398154
Node: 環境変数7398184
Ref: using/cmdline environment-variables7398296
Ref: 218e7398296
Ref: using/cmdline using-on-envvars7398296
Ref: 8077398296
Ref: using/cmdline envvar-PYTHONHOME7398615
Ref: 3ee7398615
Ref: using/cmdline envvar-PYTHONPATH7399373
Ref: 12237399373
Ref: using/cmdline envvar-PYTHONSAFEPATH7400798
Ref: 7c27400798
Ref: using/cmdline envvar-PYTHONPLATLIBDIR7401023
Ref: 1d817401023
Ref: using/cmdline envvar-PYTHONSTARTUP7401187
Ref: 1ba7401187
Ref: using/cmdline envvar-PYTHONOPTIMIZE7402018
Ref: 21807402018
Ref: using/cmdline envvar-PYTHONBREAKPOINT7402289
Ref: cd67402289
Ref: using/cmdline envvar-PYTHONDEBUG7402892
Ref: 217f7402892
Ref: using/cmdline envvar-PYTHONINSPECT7403267
Ref: 16f87403267
Ref: using/cmdline envvar-PYTHONUNBUFFERED7403995
Ref: 1dec7403995
Ref: using/cmdline envvar-PYTHONVERBOSE7404169
Ref: 21837404169
Ref: using/cmdline envvar-PYTHONCASEOK7404440
Ref: b597404440
Ref: using/cmdline envvar-PYTHONDONTWRITEBYTECODE7404678
Ref: 15ec7404678
Ref: using/cmdline envvar-PYTHONPYCACHEPREFIX7404998
Ref: b9f7404998
Ref: using/cmdline envvar-PYTHONHASHSEED7405333
Ref: 128d7405333
Ref: using/cmdline envvar-PYTHONINTMAXSTRDIGITS7406177
Ref: 1b997406177
Ref: using/cmdline envvar-PYTHONIOENCODING7406407
Ref: 12107406407
Ref: using/cmdline envvar-PYTHONNOUSERSITE7407363
Ref: 15ab7407363
Ref: using/cmdline envvar-PYTHONUSERBASE7407613
Ref: 15a97407613
Ref: using/cmdline envvar-PYTHONEXECUTABLE7407972
Ref: 21937407972
Ref: using/cmdline envvar-PYTHONWARNINGS7408231
Ref: da77408231
Ref: using/cmdline envvar-PYTHONFAULTHANDLER7409226
Ref: 12957409226
Ref: using/cmdline envvar-PYTHONTRACEMALLOC7409669
Ref: 21887409669
Ref: using/cmdline envvar-PYTHONPROFILEIMPORTTIME7410232
Ref: cf17410232
Ref: using/cmdline envvar-PYTHONASYNCIODEBUG7410713
Ref: 21947410713
Ref: using/cmdline envvar-PYTHONMALLOC7410960
Ref: e627410960
Ref: using/cmdline envvar-PYTHONMALLOCSTATS7412702
Ref: 1f937412702
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSFSENCODING7413404
Ref: 33d7413404
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSSTDIO7413945
Ref: e597413945
Ref: using/cmdline envvar-PYTHONCOERCECLOCALE7414410
Ref: cd07414410
Ref: using/cmdline envvar-PYTHONDEVMODE7417167
Ref: ceb7417167
Ref: using/cmdline envvar-PYTHONUTF87417506
Ref: cd37417506
Ref: using/cmdline envvar-PYTHONWARNDEFAULTENCODING7417794
Ref: 9c37417794
Ref: using/cmdline envvar-PYTHONNODEBUGRANGES7418114
Ref: 7d37418114
Ref: using/cmdline envvar-PYTHONPERFSUPPORT7418575
Ref: 6997418575
Ref: using/cmdline envvar-PYTHON_PERF_JIT_SUPPORT7418979
Ref: 4af7418979
Ref: using/cmdline envvar-PYTHON_DISABLE_REMOTE_DEBUG7419422
Ref: 16f7419422
Ref: using/cmdline envvar-PYTHON_CPU_COUNT7419882
Ref: 51e7419882
Ref: using/cmdline envvar-PYTHON_FROZEN_MODULES7420175
Ref: 4ad7420175
Ref: using/cmdline envvar-PYTHON_COLORS7420812
Ref: 4767420812
Ref: using/cmdline envvar-PYTHON_BASIC_REPL7421066
Ref: 1b87421066
Ref: using/cmdline envvar-PYTHON_HISTORY7421356
Ref: 4b07421356
Ref: using/cmdline envvar-PYTHON_GIL7421597
Ref: 49a7421597
Ref: using/cmdline envvar-PYTHON_THREAD_INHERIT_CONTEXT7422038
Ref: 18cd7422038
Ref: using/cmdline envvar-PYTHON_CONTEXT_AWARE_WARNINGS7422500
Ref: 18c07422500
Ref: using/cmdline envvar-PYTHON_JIT7422888
Ref: 44b7422888
Ref: using/cmdline envvar-PYTHON_TLBC7423133
Ref: 218b7423133
Ref: 環境変数-Footnote-17423554
Ref: 環境変数-Footnote-27423596
Ref: 環境変数-Footnote-37423638
Ref: 環境変数-Footnote-47423680
Ref: 環境変数-Footnote-57423722
Node: デバッグモード変数7423764
Ref: using/cmdline debug-mode-variables7423840
Ref: 219b7423840
Ref: using/cmdline envvar-PYTHONDUMPREFS7423904
Ref: ba27423904
Ref: using/cmdline envvar-PYTHONDUMPREFSFILE7424199
Ref: 1c9c7424199
Ref: using/cmdline envvar-PYTHON_PRESITE7424547
Ref: 218a7424547
Node: Unix プラットフォームで Python を使う7425281
Ref: using/unix doc7425477
Ref: 219c7425477
Ref: using/unix translation-repo7425477
Ref: 219d7425477
Ref: using/unix using-on-unix7425477
Ref: 219e7425477
Ref: using/unix using-python-on-unix-platforms7425477
Ref: 219f7425477
Node: 最新バージョンの Python の取得とインストール7425778
Ref: using/unix getting-and-installing-the-latest-version-of-python7425954
Ref: 21a07425954
Node: Linux7426119
Ref: using/unix on-linux7426251
Ref: 21a17426251
Node: IDLE のインストール7427211
Ref: using/unix installing-idle7427279
Ref: 21a27427279
Ref: using/unix installing-idle-on-linux7427279
Ref: 21a37427279
Node: FreeBSD と OpenBSD7427802
Ref: using/unix on-freebsd-and-openbsd7427934
Ref: 21a47427934
Node: Python のビルド7428610
Ref: using/unix building-python7428838
Ref: 21a57428838
Ref: using/unix building-python-on-unix7428838
Ref: 10fa7428838
Ref: Python のビルド-Footnote-17429959
Ref: Python のビルド-Footnote-27430027
Ref: Python のビルド-Footnote-37430076
Ref: Python のビルド-Footnote-47430139
Node: Python に関係するパスとファイル7430202
Ref: using/unix python-related-paths-and-files7430380
Ref: 21a87430380
Node: その他<2>7432003
Ref: using/unix miscellaneous7432185
Ref: 21ab7432185
Node: カスタムの OpenSSL7432967
Ref: using/unix custom-openssl7433097
Ref: 21ac7433097
Ref: using/unix unix-custom-openssl7433097
Ref: 21ad7433097
Node: Python を構成する7434726
Ref: using/configure doc7434917
Ref: 21ae7434917
Ref: using/configure configure-python7434917
Ref: 21af7434917
Ref: using/configure translation-repo7434917
Ref: 21b07434917
Node: ビルド要件7435121
Ref: using/configure build-requirements7435231
Ref: 21a67435231
Ref: using/configure id17435231
Ref: 21b17435231
Ref: ビルド要件-Footnote-17436264
Ref: ビルド要件-Footnote-27436307
Ref: ビルド要件-Footnote-37436390
Ref: ビルド要件-Footnote-47436437
Ref: ビルド要件-Footnote-57436494
Ref: ビルド要件-Footnote-67436536
Node: オプションのモジュールの要件7436578
Ref: using/configure optional-module-requirements7436672
Ref: 21b27436672
Ref: using/configure requirements-for-optional-modules7436672
Ref: 21b37436672
Ref: オプションのモジュールの要件-Footnote-17442323
Ref: オプションのモジュールの要件-Footnote-27442361
Ref: オプションのモジュールの要件-Footnote-37442400
Ref: オプションのモジュールの要件-Footnote-47442432
Ref: オプションのモジュールの要件-Footnote-57442489
Ref: オプションのモジュールの要件-Footnote-67442650
Ref: オプションのモジュールの要件-Footnote-77442711
Ref: オプションのモジュールの要件-Footnote-87442753
Ref: オプションのモジュールの要件-Footnote-97442854
Ref: オプションのモジュールの要件-Footnote-107442898
Ref: オプションのモジュールの要件-Footnote-117443021
Ref: オプションのモジュールの要件-Footnote-127443076
Ref: オプションのモジュールの要件-Footnote-137443279
Ref: オプションのモジュールの要件-Footnote-147443317
Ref: オプションのモジュールの要件-Footnote-157443524
Ref: オプションのモジュールの要件-Footnote-167443553
Ref: オプションのモジュールの要件-Footnote-177443588
Ref: オプションのモジュールの要件-Footnote-187443618
Ref: オプションのモジュールの要件-Footnote-197443660
Ref: オプションのモジュールの要件-Footnote-207443751
Node: 生成されるファイル7443788
Ref: using/configure generated-files7443931
Ref: 21b87443931
Node: 構成スクリプト7444416
Ref: using/configure configure-script7444501
Ref: 21b97444501
Ref: 構成スクリプト-Footnote-17445360
Ref: 構成スクリプト-Footnote-27445402
Ref: 構成スクリプト-Footnote-37445448
Node: Configureオプション7445510
Ref: using/configure configure-options7445666
Ref: 21a77445666
Ref: using/configure id127445666
Ref: 21ba7445666
Node: 一般的なオプション7446517
Ref: using/configure general-options7446649
Ref: 21bb7446649
Ref: using/configure cmdoption-enable-loadable-sqlite-extensions7446713
Ref: 21bc7446713
Ref: using/configure cmdoption-disable-ipv67447070
Ref: 21bd7447070
Ref: using/configure cmdoption-enable-big-digits7447277
Ref: 9577447277
Ref: using/configure cmdoption-with-suffix7447675
Ref: 21be7447675
Ref: using/configure cmdoption-with-tzpath7448317
Ref: 21bf7448317
Ref: using/configure cmdoption-without-decimal-contextvar7448840
Ref: 21c27448840
Ref: using/configure cmdoption-with-dbmliborder7449315
Ref: 21c47449315
Ref: using/configure cmdoption-without-c-locale-coercion7449672
Ref: 21c57449672
Ref: using/configure cmdoption-with-platlibdir7450009
Ref: 21c67450009
Ref: using/configure cmdoption-with-wheel-pkg-dir7450325
Ref: a917450325
Ref: using/configure cmdoption-with-pkg-config7450942
Ref: 21c77450942
Ref: using/configure cmdoption-enable-pystats7451399
Ref: 1b977451399
Ref: using/configure free-threading-build7453746
Ref: 21c87453746
Ref: using/configure cmdoption-disable-gil7453746
Ref: 4997453746
Ref: using/configure cmdoption-enable-experimental-jit7454106
Ref: 44c7454106
Ref: using/configure cmdoption-arg-PKG_CONFIG7455291
Ref: 21c97455291
Ref: using/configure cmdoption-arg-PKG_CONFIG_LIBDIR7455355
Ref: 21ca7455355
Ref: using/configure cmdoption-arg-PKG_CONFIG_PATH7455386
Ref: 21cb7455386
Ref: 一般的なオプション-Footnote-17455483
Node: C コンパイラのオプション7455525
Ref: using/configure c-compiler-options7455693
Ref: 21cc7455693
Ref: using/configure cmdoption-arg-CC7455771
Ref: 21cd7455771
Ref: using/configure cmdoption-arg-CFLAGS7455829
Ref: 21ce7455829
Ref: using/configure cmdoption-arg-CPP7455888
Ref: 21cf7455888
Ref: using/configure cmdoption-arg-CPPFLAGS7455953
Ref: 21d07455953
Node: リンカのオプション7456049
Ref: using/configure linker-options7456241
Ref: 21d17456241
Ref: using/configure cmdoption-arg-LDFLAGS7456305
Ref: 21d27456305
Ref: using/configure cmdoption-arg-LIBS7456392
Ref: 21d37456392
Ref: using/configure cmdoption-arg-MACHDEP7456478
Ref: 21d47456478
Node: サードパーティ依存関係のオプション7456563
Ref: using/configure configure-options-for-dependencies7456747
Ref: 21b77456747
Ref: using/configure options-for-third-party-dependencies7456747
Ref: 21d57456747
Ref: using/configure cmdoption-arg-BZIP2_CFLAGS7456875
Ref: 21d67456875
Ref: using/configure cmdoption-arg-BZIP2_LIBS7456901
Ref: 21d77456901
Ref: using/configure cmdoption-arg-CURSES_CFLAGS7457056
Ref: 21d87457056
Ref: using/configure cmdoption-arg-CURSES_LIBS7457083
Ref: 21d97457083
Ref: using/configure cmdoption-arg-GDBM_CFLAGS7457253
Ref: 21da7457253
Ref: using/configure cmdoption-arg-GDBM_LIBS7457278
Ref: 21db7457278
Ref: using/configure cmdoption-arg-LIBEDIT_CFLAGS7457351
Ref: 21dc7457351
Ref: using/configure cmdoption-arg-LIBEDIT_LIBS7457379
Ref: 21dd7457379
Ref: using/configure cmdoption-arg-LIBFFI_CFLAGS7457528
Ref: 21de7457528
Ref: using/configure cmdoption-arg-LIBFFI_LIBS7457555
Ref: 21df7457555
Ref: using/configure cmdoption-arg-LIBMPDEC_CFLAGS7457700
Ref: 21e07457700
Ref: using/configure cmdoption-arg-LIBMPDEC_LIBS7457729
Ref: 21e17457729
Ref: using/configure cmdoption-arg-LIBLZMA_CFLAGS7458006
Ref: 21e27458006
Ref: using/configure cmdoption-arg-LIBLZMA_LIBS7458034
Ref: 21e37458034
Ref: using/configure cmdoption-arg-LIBREADLINE_CFLAGS7458179
Ref: 21e47458179
Ref: using/configure cmdoption-arg-LIBREADLINE_LIBS7458211
Ref: 21e57458211
Ref: using/configure cmdoption-arg-LIBSQLITE3_CFLAGS7458368
Ref: 21e67458368
Ref: using/configure cmdoption-arg-LIBSQLITE3_LIBS7458399
Ref: 21e77458399
Ref: using/configure cmdoption-arg-LIBUUID_CFLAGS7458553
Ref: 21e87458553
Ref: using/configure cmdoption-arg-LIBUUID_LIBS7458581
Ref: 21e97458581
Ref: using/configure cmdoption-arg-LIBZSTD_CFLAGS7458727
Ref: 21ea7458727
Ref: using/configure cmdoption-arg-LIBZSTD_LIBS7458755
Ref: 21eb7458755
Ref: using/configure cmdoption-arg-PANEL_CFLAGS7458941
Ref: 21ec7458941
Ref: using/configure cmdoption-arg-PANEL_LIBS7458967
Ref: 21ed7458967
Ref: using/configure cmdoption-arg-TCLTK_CFLAGS7459212
Ref: 21ee7459212
Ref: using/configure cmdoption-arg-TCLTK_LIBS7459238
Ref: 21ef7459238
Ref: using/configure cmdoption-arg-ZLIB_CFLAGS7459336
Ref: 21f07459336
Ref: using/configure cmdoption-arg-ZLIB_LIBS7459361
Ref: 21f17459361
Node: WebAssembly オプション7459503
Ref: using/configure webassembly-options7459693
Ref: 21f27459693
Ref: using/configure cmdoption-enable-wasm-dynamic-linking7459761
Ref: 1c1b7459761
Ref: using/configure cmdoption-enable-wasm-pthreads7460145
Ref: 1beb7460145
Node: インストールオプション7460271
Ref: using/configure install-options7460458
Ref: 21f37460458
Ref: using/configure cmdoption-prefix7460532
Ref: 21a97460532
Ref: using/configure cmdoption-exec-prefix7461019
Ref: 21aa7461019
Ref: using/configure cmdoption-disable-test-modules7461320
Ref: a907461320
Ref: using/configure cmdoption-with-ensurepip7461637
Ref: 21f47461637
Node: パフォーマンスに関するオプション7462129
Ref: using/configure performance-options7462317
Ref: 21f57462317
Ref: using/configure cmdoption-enable-optimizations7462615
Ref: a667462615
Ref: using/configure envvar-PROFILE_TASK7463767
Ref: 1adf7463767
Ref: using/configure cmdoption-with-lto7464090
Ref: 9567464090
Ref: using/configure cmdoption-enable-bolt7464616
Ref: 21f67464616
Ref: using/configure cmdoption-arg-BOLT_APPLY_FLAGS7465683
Ref: 21f77465683
Ref: using/configure cmdoption-arg-BOLT_INSTRUMENT_FLAGS7465819
Ref: 21f87465819
Ref: using/configure cmdoption-with-computed-gotos7465947
Ref: 21f97465947
Ref: using/configure cmdoption-with-tail-call-interp7466079
Ref: 1737466079
Ref: using/configure cmdoption-without-mimalloc7466485
Ref: 21fa7466485
Ref: using/configure cmdoption-without-pymalloc7466801
Ref: 21fb7466801
Ref: using/configure cmdoption-without-doc-strings7466997
Ref: 21fc7466997
Ref: using/configure cmdoption-enable-profiling7467292
Ref: 21fd7467292
Ref: using/configure cmdoption-with-strict-overflow7467400
Ref: 1b327467400
Ref: using/configure cmdoption-without-remote-debug7467555
Ref: 1717467555
Ref: using/configure c Py_REMOTE_DEBUG7468001
Ref: 21fe7468001
Ref: パフォーマンスに関するオプション-Footnote-17468373
Ref: パフォーマンスに関するオプション-Footnote-27468433
Ref: パフォーマンスに関するオプション-Footnote-37468481
Ref: パフォーマンスに関するオプション-Footnote-47468555
Ref: パフォーマンスに関するオプション-Footnote-57468597
Node: Python デバッグビルド7468639
Ref: using/configure debug-build7468807
Ref: 5097468807
Ref: using/configure python-debug-build7468807
Ref: 21ff7468807
Node: Debug options7471209
Ref: using/configure debug-options7471359
Ref: 22007471359
Ref: using/configure cmdoption-with-pydebug7471404
Ref: 6667471404
Ref: using/configure cmdoption-with-trace-refs7471538
Ref: 6367471538
Ref: using/configure cmdoption-with-assertions7472187
Ref: 62d7472187
Ref: using/configure cmdoption-with-valgrind7472573
Ref: 22027472573
Ref: using/configure cmdoption-with-dtrace7472649
Ref: 22037472649
Ref: using/configure cmdoption-with-address-sanitizer7472819
Ref: 22047472819
Ref: using/configure cmdoption-with-memory-sanitizer7473189
Ref: 22057473189
Ref: using/configure cmdoption-with-undefined-behavior-sanitizer7473343
Ref: 22067473343
Ref: using/configure cmdoption-with-thread-sanitizer7473524
Ref: 22077473524
Node: リンカのオプション<2>7473667
Ref: using/configure id137473806
Ref: 22087473806
Ref: using/configure cmdoption-enable-shared7473872
Ref: a677473872
Ref: using/configure cmdoption-without-static-libpython7473986
Ref: a927473986
Node: Libraries options7474174
Ref: using/configure libraries-options7474316
Ref: 22097474316
Ref: using/configure cmdoption-with-libs7474371
Ref: 220a7474371
Ref: using/configure cmdoption-with-system-expat7474464
Ref: 1b8c7474464
Ref: using/configure cmdoption-with-system-libmpdec7474595
Ref: 6577474595
Ref: using/configure cmdoption-with-readline7475497
Ref: 21b57475497
Ref: using/configure cmdoption-without-readline7475743
Ref: 220b7475743
Ref: using/configure cmdoption-with-libm7475926
Ref: 220c7475926
Ref: using/configure cmdoption-with-libc7476045
Ref: 220d7476045
Ref: using/configure cmdoption-with-openssl7476161
Ref: 220e7476161
Ref: using/configure cmdoption-with-openssl-rpath7476258
Ref: a937476258
Node: Security Options7476596
Ref: using/configure security-options7476732
Ref: 220f7476732
Ref: using/configure cmdoption-with-hash-algorithm7476785
Ref: 22107476785
Ref: using/configure cmdoption-with-builtin-hashlib-hashes7477110
Ref: 21b67477110
Ref: using/configure cmdoption-with-ssl-default-suites7477411
Ref: 22117477411
Ref: using/configure cmdoption-disable-safety7477896
Ref: 4437477896
Ref: using/configure cmdoption-enable-slower-safety7478590
Ref: 4447478590
Ref: Security Options-Footnote-17479258
Ref: Security Options-Footnote-27479414
Ref: Security Options-Footnote-37479626
Ref: Security Options-Footnote-47479846
Ref: Security Options-Footnote-57480002
Node: macOS のオプション7480217
Ref: using/configure macos-options7480358
Ref: 22127480358
Ref: using/configure cmdoption-enable-universalsdk7480453
Ref: b677480453
Ref: using/configure cmdoption-07480488
Ref: 22137480488
Ref: using/configure cmdoption-enable-framework7480751
Ref: 22147480751
Ref: using/configure cmdoption-17480783
Ref: 22157480783
Ref: using/configure cmdoption-with-universal-archs7481061
Ref: 22167481061
Ref: using/configure cmdoption-with-framework-name7481915
Ref: 22177481915
Ref: using/configure cmdoption-with-app-store-compliance7482161
Ref: 19f67482161
Ref: using/configure cmdoption-27482202
Ref: 22187482202
Ref: macOS のオプション-Footnote-17482906
Ref: macOS のオプション-Footnote-27482973
Node: iOS のオプション7483071
Ref: using/configure ios-options7483238
Ref: 22197483238
Ref: using/configure cmdoption-37483329
Ref: 221a7483329
Ref: using/configure cmdoption-47483522
Ref: 221b7483522
Ref: iOS のオプション-Footnote-17483694
Node: クロスコンパイルのオプション7483761
Ref: using/configure cross-compiling-options7483895
Ref: 221c7483895
Ref: using/configure cmdoption-build7484452
Ref: 221d7484452
Ref: using/configure cmdoption-host7484602
Ref: 221e7484602
Ref: using/configure cmdoption-with-build-python7484771
Ref: 221f7484771
Ref: using/configure cmdoption-arg-CONFIG_SITE7484935
Ref: 22207484935
Ref: using/configure cmdoption-arg-HOSTRUNNER7485222
Ref: 22217485222
Node: Python ビルドシステム7485611
Ref: using/configure python-build-system7485765
Ref: 22227485765
Node: ビルドシステムの主要なファイル7485967
Ref: using/configure main-files-of-the-build-system7486116
Ref: 22237486116
Node: 主要なビルドステップ7486553
Ref: using/configure main-build-steps7486732
Ref: 22247486732
Node: Main Makefile targets7487130
Ref: using/configure main-makefile-targets7487276
Ref: 22257487276
Node: make7487513
Ref: using/configure make7487597
Ref: 22267487597
Node: make platform7489038
Ref: using/configure make-platform7489147
Ref: 22277489147
Node: make profile-opt7489463
Ref: using/configure make-profile-opt7489578
Ref: 22287489578
Node: make clean7489846
Ref: using/configure make-clean7489962
Ref: 22297489962
Node: make distclean7490022
Ref: using/configure make-distclean7490134
Ref: 222a7490134
Ref: make distclean-Footnote-17490379
Node: make install7490798
Ref: using/configure make-install7490909
Ref: 222b7490909
Node: make test7491000
Ref: using/configure make-test7491104
Ref: 222c7491104
Node: make ci7491463
Ref: using/configure make-ci7491572
Ref: 222d7491572
Node: make buildbottest7491716
Ref: using/configure make-buildbottest7491830
Ref: 222e7491830
Node: make regen-all7492028
Ref: using/configure make-regen-all7492126
Ref: 222f7492126
Node: C extensions7492427
Ref: using/configure c-extensions7492534
Ref: 22307492534
Node: Compiler and linker flags7494202
Ref: using/configure compiler-and-linker-flags7494323
Ref: 22317494323
Node: Preprocessor flags7494556
Ref: using/configure preprocessor-flags7494659
Ref: 22327494659
Ref: using/configure envvar-CONFIGURE_CPPFLAGS7494714
Ref: 22337494714
Ref: using/configure envvar-CPPFLAGS7494871
Ref: 16d77494871
Ref: using/configure envvar-BASECPPFLAGS7495238
Ref: 22347495238
Ref: using/configure envvar-PY_CPPFLAGS7495298
Ref: 22357495298
Node: Compiler flags7495543
Ref: using/configure compiler-flags7495667
Ref: 22367495667
Ref: using/configure envvar-CC7495714
Ref: 16d47495714
Ref: using/configure envvar-CXX7495813
Ref: 22377495813
Ref: using/configure envvar-CFLAGS7495899
Ref: 16d57495899
Ref: using/configure envvar-CFLAGS_NODIST7495964
Ref: 22387495964
Ref: using/configure envvar-COMPILEALL_OPTS7496762
Ref: 22397496762
Ref: using/configure envvar-EXTRA_CFLAGS7496962
Ref: 223a7496962
Ref: using/configure envvar-CONFIGURE_CFLAGS7497024
Ref: 223b7497024
Ref: using/configure envvar-CONFIGURE_CFLAGS_NODIST7497177
Ref: 223c7497177
Ref: using/configure envvar-BASECFLAGS7497344
Ref: 223d7497344
Ref: using/configure envvar-OPT7497401
Ref: 22017497401
Ref: using/configure envvar-CFLAGS_ALIASING7497450
Ref: 223e7497450
Ref: using/configure envvar-CFLAGS_CEVAL7497597
Ref: 223f7497597
Ref: using/configure envvar-CCSHARED7497710
Ref: 22407497710
Ref: using/configure envvar-CFLAGSFORSHARED7497851
Ref: 22417497851
Ref: using/configure envvar-PY_CFLAGS7498064
Ref: 22427498064
Ref: using/configure envvar-PY_CFLAGS_NODIST7498187
Ref: 22437498187
Ref: using/configure envvar-PY_STDMODULE_CFLAGS7498351
Ref: 22447498351
Ref: using/configure envvar-PY_CORE_CFLAGS7498574
Ref: 22457498574
Ref: using/configure envvar-PY_BUILTIN_MODULE_CFLAGS7498697
Ref: 22467498697
Ref: using/configure envvar-PURIFY7498965
Ref: 22477498965
Ref: Compiler flags-Footnote-17499127
Node: Linker flags7499182
Ref: using/configure linker-flags7499279
Ref: 22487499279
Ref: using/configure envvar-LINKCC7499322
Ref: 22497499322
Ref: using/configure envvar-CONFIGURE_LDFLAGS7499475
Ref: 224a7499475
Ref: using/configure envvar-LDFLAGS_NODIST7499814
Ref: 224b7499814
Ref: using/configure envvar-CONFIGURE_LDFLAGS_NODIST7500403
Ref: 224c7500403
Ref: using/configure envvar-LDFLAGS7500572
Ref: 16d67500572
Ref: using/configure envvar-LIBS7500908
Ref: 224d7500908
Ref: using/configure envvar-LDSHARED7501051
Ref: 224e7501051
Ref: using/configure envvar-BLDSHARED7501167
Ref: 224f7501167
Ref: using/configure envvar-PY_LDFLAGS7501304
Ref: 22507501304
Ref: using/configure envvar-PY_LDFLAGS_NODIST7501388
Ref: 22517501388
Ref: using/configure envvar-PY_CORE_LDFLAGS7501521
Ref: 22527501521
Ref: Linker flags-Footnote-17501700
Node: Windows で Python を使う7501755
Ref: using/windows doc7501923
Ref: 22537501923
Ref: using/windows translation-repo7501923
Ref: 22547501923
Ref: using/windows using-on-windows7501923
Ref: ca27501923
Ref: using/windows using-python-on-windows7501923
Ref: 22557501923
Ref: using/windows pymanager7504367
Ref: 22597504367
Ref: using/windows windows-store7504367
Ref: 20257504367
Ref: using/windows setting-envvars7504367
Ref: 20267504367
Ref: using/windows windows-path-mod7504367
Ref: 12607504367
Ref: Windows で Python を使う-Footnote-17504908
Ref: Windows で Python を使う-Footnote-27504950
Node: Python install manager7505005
Ref: using/windows launcher7505137
Ref: 7da7505137
Ref: using/windows python-install-manager7505137
Ref: 225a7505137
Node: Installation7505532
Ref: using/windows installation7505633
Ref: 225b7505633
Ref: Installation-Footnote-17507609
Ref: Installation-Footnote-27507664
Node: 基本的な使い方7507706
Ref: using/windows basic-use7507828
Ref: 225d7507828
Node: Command help7512014
Ref: using/windows command-help7512140
Ref: 22617512140
Node: Listing runtimes7513017
Ref: using/windows listing-runtimes7513141
Ref: 22627513141
Node: Installing runtimes7515040
Ref: using/windows installing-runtimes7515168
Ref: 22637515168
Node: Offline installs7517709
Ref: using/windows offline-installs7517842
Ref: 22667517842
Ref: using/windows pymanager-offline7517842
Ref: 22647517842
Node: Uninstalling runtimes7519046
Ref: using/windows uninstalling-runtimes7519173
Ref: 22677519173
Node: Configuration7520333
Ref: using/windows configuration7520457
Ref: 22687520457
Ref: using/windows pymanager-config7520457
Ref: 225f7520457
Ref: using/windows envvar-PYTHON_MANAGER_DEFAULT7522273
Ref: 225e7522273
Ref: using/windows envvar-PYTHON_MANAGER_AUTOMATIC_INSTALL7524400
Ref: 22657524400
Node: Shebang lines7533024
Ref: using/windows pymanager-shebang7533148
Ref: 22607533148
Ref: using/windows shebang-lines7533148
Ref: 22697533148
Ref: Shebang lines-Footnote-17537767
Node: Advanced installation7537835
Ref: using/windows advanced-installation7537974
Ref: 226a7537974
Ref: using/windows pymanager-advancedinstall7537974
Ref: 225c7537974
Ref: Advanced installation-Footnote-17542451
Ref: Advanced installation-Footnote-27542527
Ref: Advanced installation-Footnote-37542606
Ref: Advanced installation-Footnote-47542693
Node: Administrative configuration7542783
Ref: using/windows administrative-configuration7542942
Ref: 226c7542942
Ref: using/windows pymanager-admin-config7542942
Ref: 226b7542942
Node: Installing free-threaded binaries7550706
Ref: using/windows install-freethreaded-windows7550860
Ref: 4977550860
Ref: using/windows installing-free-threaded-binaries7550860
Ref: 226e7550860
Node: Index signatures7551474
Ref: using/windows pymanager-index-signatures7551615
Ref: 226d7551615
Node: Troubleshooting7555680
Ref: using/windows pymanager-troubleshoot7555779
Ref: 22567555779
Ref: using/windows troubleshooting7555779
Ref: 226f7555779
Ref: Troubleshooting-Footnote-17568611
Ref: Troubleshooting-Footnote-27568662
Ref: Troubleshooting-Footnote-37568730
Node: 埋め込み可能なパッケージ7568798
Ref: using/windows the-embeddable-package7568964
Ref: 22707568964
Ref: using/windows windows-embeddable7568964
Ref: 22587568964
Node: Python application7571108
Ref: using/windows python-application7571230
Ref: 22717571230
Node: Python の埋め込み7573392
Ref: using/windows embedding-python7573514
Ref: 22727573514
Node: nuget org パッケージ7574571
Ref: using/windows the-nuget-org-packages7574733
Ref: 22737574733
Ref: using/windows windows-nuget7574733
Ref: 22577574733
Ref: nuget org パッケージ-Footnote-17577960
Ref: nuget org パッケージ-Footnote-27577991
Ref: nuget org パッケージ-Footnote-37578037
Ref: nuget org パッケージ-Footnote-47578086
Node: フリースレッドパッケージ Free-threaded packages7578137
Ref: using/windows free-threaded-packages7578258
Ref: 22747578258
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-17578879
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-27578938
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-37579000
Node: 別のバンドル7579064
Ref: using/windows alternative-bundles7579216
Ref: 22757579216
Ref: 別のバンドル-Footnote-17580523
Ref: 別のバンドル-Footnote-27580576
Ref: 別のバンドル-Footnote-37580619
Ref: 別のバンドル-Footnote-47580671
Ref: 別のバンドル-Footnote-57580838
Node: Supported Windows versions7580875
Ref: using/windows supported-windows-versions7581034
Ref: 22767581034
Ref: Supported Windows versions-Footnote-17581464
Node: Removing the MAX_PATH limitation7581506
Ref: using/windows max-path7581662
Ref: e3f7581662
Ref: using/windows removing-the-max-path-limitation7581662
Ref: 22777581662
Node: UTF-8 モード7582554
Ref: using/windows utf-8-mode7582708
Ref: 22787582708
Ref: using/windows win-utf8-mode7582708
Ref: 22797582708
Ref: UTF-8 モード-Footnote-17584219
Ref: UTF-8 モード-Footnote-27584261
Node: モジュールの検索7584303
Ref: using/windows finding-modules7584449
Ref: 227a7584449
Ref: using/windows windows-finding-modules7584449
Ref: e1e7584449
Node: 追加のモジュール7590660
Ref: using/windows additional-modules7590837
Ref: 227b7590837
Node: PyWin327591356
Ref: using/windows pywin327591442
Ref: 227d7591442
Ref: PyWin32-Footnote-17592113
Ref: PyWin32-Footnote-27592155
Ref: PyWin32-Footnote-37592244
Ref: PyWin32-Footnote-47592313
Ref: PyWin32-Footnote-57592407
Ref: PyWin32-Footnote-67592466
Node: cx_Freeze7592516
Ref: using/windows cx-freeze7592602
Ref: 227e7592602
Ref: cx_Freeze-Footnote-17592876
Node: Windows 上で Python をコンパイルする7592928
Ref: using/windows compiling-python-on-windows7593110
Ref: 227f7593110
Ref: Windows 上で Python をコンパイルする-Footnote-17594065
Ref: Windows 上で Python をコンパイルする-Footnote-27594114
Node: The full installer deprecated7594177
Ref: using/windows the-full-installer-deprecated7594373
Ref: 22817594373
Ref: using/windows windows-full7594373
Ref: 22827594373
Node: インストール手順7594929
Ref: using/windows installation-steps7595063
Ref: 22837595063
Node: Removing the MAX_PATH limitation<2>7598197
Ref: using/windows id27598361
Ref: 22857598361
Node: Installing without UI7599461
Ref: using/windows install-quiet-option7599631
Ref: 8047599631
Ref: using/windows installing-without-ui7599631
Ref: 22867599631
Node: Installing without downloading7612215
Ref: using/windows install-layout-option7612380
Ref: 22847612380
Ref: using/windows installing-without-downloading7612380
Ref: 22877612380
Node: インストール後の変更7613870
Ref: using/windows modifying-an-install7614050
Ref: 22887614050
Node: Installing free-threaded binaries<2>7615403
Ref: using/windows id37615544
Ref: 22897615544
Ref: Installing free-threaded binaries<2>-Footnote-17617291
Node: Python launcher for Windows deprecated7617333
Ref: using/windows python-launcher-for-windows-deprecated7617474
Ref: 228a7617474
Ref: Python launcher for Windows deprecated-Footnote-17618783
Node: 最初に7618825
Ref: using/windows getting-started7618934
Ref: 228b7618934
Node: コマンドラインから起動する7619186
Ref: using/windows from-the-command-line7619313
Ref: 228c7619313
Ref: コマンドラインから起動する-Footnote-17622350
Node: 仮想環境 Virtual environments7622392
Ref: using/windows virtual-environments7622561
Ref: 228d7622561
Node: スクリプトから起動する7623231
Ref: using/windows from-a-script7623406
Ref: 228e7623406
Node: ファイルの関連付けから起動する7624803
Ref: using/windows from-file-associations7624936
Ref: 228f7624936
Node: Shebang lines<2>7625657
Ref: using/windows id47625799
Ref: 22907625799
Node: シェバン行の引数7630535
Ref: using/windows arguments-in-shebang-lines7630686
Ref: 22927630686
Node: カスタマイズ7631067
Ref: using/windows customization7631208
Ref: 22937631208
Node: INI ファイルによるカスタマイズ7631382
Ref: using/windows customization-via-ini-files7631549
Ref: 22947631549
Ref: using/windows launcher-ini7631549
Ref: 22917631549
Node: デフォルトのPythonバージョンのカスタマイズ7632470
Ref: using/windows customizing-default-python-versions7632637
Ref: 22957632637
Node: 診断7637482
Ref: using/windows diagnostics7637606
Ref: 22967637606
Node: Dry run7638084
Ref: using/windows dry-run7638207
Ref: 22977638207
Node: Install on demand7638641
Ref: using/windows install-on-demand7638770
Ref: 22987638770
Node: Return codes7639353
Ref: using/windows return-codes7639466
Ref: 22997639466
Node: macOS で Python を使う7641221
Ref: using/mac doc7641395
Ref: 229a7641395
Ref: using/mac translation-repo7641395
Ref: 229b7641395
Ref: using/mac using-on-mac7641395
Ref: 229c7641395
Ref: using/mac using-python-on-macos7641395
Ref: 229d7641395
Ref: using/mac getting-osx7642110
Ref: 229f7642110
Ref: macOS で Python を使う-Footnote-17642406
Node: Using Python for macOS from python org7642448
Ref: using/mac getting-and-installing-macpython7642583
Ref: 22a07642583
Ref: using/mac using-python-for-macos-from-python-org7642583
Ref: 22a17642583
Node: インストール手順<2>7642791
Ref: using/mac installation-steps7642939
Ref: 22a27642939
Ref: インストール手順<2>-Footnote-17648066
Ref: インストール手順<2>-Footnote-27648108
Ref: インストール手順<2>-Footnote-37648156
Ref: インストール手順<2>-Footnote-47648211
Ref: インストール手順<2>-Footnote-57648258
Node: Python スクリプトの実行方法7648307
Ref: using/mac how-to-run-a-python-script7648455
Ref: 22a37648455
Node: Alternative Distributions7650458
Ref: using/mac alternative-bundles7650655
Ref: 229e7650655
Ref: using/mac alternative-distributions7650655
Ref: 22a57650655
Ref: Alternative Distributions-Footnote-17651729
Ref: Alternative Distributions-Footnote-27651782
Ref: Alternative Distributions-Footnote-37651825
Ref: Alternative Distributions-Footnote-47651849
Node: 追加の Python パッケージのインストール7651882
Ref: using/mac installing-additional-python-packages7652066
Ref: 22a67652066
Ref: using/mac mac-package-manager7652066
Ref: 22a77652066
Ref: using/mac osx-gui-scripts7652237
Ref: 22a87652237
Ref: 追加の Python パッケージのインストール-Footnote-17652275
Node: GUI プログラミング7652354
Ref: using/mac gui-programming7652534
Ref: 22a97652534
Ref: using/mac gui-programming-on-the-mac7652534
Ref: 22aa7652534
Ref: GUI プログラミング-Footnote-17653510
Ref: GUI プログラミング-Footnote-27653551
Ref: GUI プログラミング-Footnote-37653591
Ref: GUI プログラミング-Footnote-47653632
Ref: GUI プログラミング-Footnote-57653686
Ref: GUI プログラミング-Footnote-67653711
Ref: GUI プログラミング-Footnote-77653747
Ref: GUI プログラミング-Footnote-87653775
Node: 高度なトピック7653804
Ref: using/mac advanced-topics7653949
Ref: 22ab7653949
Node: フリースレッドバイナリ Free-threaded Binaries のインストール7654295
Ref: using/mac install-freethreaded-macos7654473
Ref: 4987654473
Ref: using/mac installing-free-threaded-binaries7654473
Ref: 22ac7654473
Ref: フリースレッドバイナリ Free-threaded Binaries のインストール-Footnote-17659653
Node: Installing using the command line7659695
Ref: using/mac installing-using-the-command-line7659922
Ref: 22ae7659922
Node: Python アプリケーションの配布7662726
Ref: using/mac distributing-python-applications7662909
Ref: 22af7662909
Ref: using/mac distributing-python-applications-on-the-mac7662909
Ref: 22b07662909
Ref: Python アプリケーションの配布-Footnote-17663581
Ref: Python アプリケーションの配布-Footnote-27663622
Ref: Python アプリケーションの配布-Footnote-37663663
Ref: Python アプリケーションの配布-Footnote-47663691
Node: App Store コンプライアンス7663724
Ref: using/mac app-store-compliance7663865
Ref: 22b17663865
Ref: App Store コンプライアンス-Footnote-17664991
Node: 他のリソース7665085
Ref: using/mac other-resources7665196
Ref: 22b27665196
Ref: 他のリソース-Footnote-17665462
Ref: 他のリソース-Footnote-27665505
Node: Android で Python を使う7665574
Ref: using/android doc7665744
Ref: 22b37665744
Ref: using/android translation-repo7665744
Ref: 22b47665744
Ref: using/android using-android7665744
Ref: 22b57665744
Ref: using/android using-python-on-android7665744
Ref: 22b67665744
Node: Android アプリに Python を追加する7667606
Ref: using/android adding-python-to-an-android-app7667781
Ref: 22b97667781
Ref: Android アプリに Python を追加する-Footnote-17669463
Ref: Android アプリに Python を追加する-Footnote-27669501
Ref: Android アプリに Python を追加する-Footnote-37669542
Ref: Android アプリに Python を追加する-Footnote-47669578
Ref: Android アプリに Python を追加する-Footnote-57669645
Ref: Android アプリに Python を追加する-Footnote-67669676
Ref: Android アプリに Python を追加する-Footnote-77669744
Ref: Android アプリに Python を追加する-Footnote-87669794
Ref: Android アプリに Python を追加する-Footnote-97669864
Ref: Android アプリに Python を追加する-Footnote-107669954
Ref: Android アプリに Python を追加する-Footnote-117670077
Node: Android 向けの Python パッケージをビルドする7670178
Ref: using/android building-a-python-package-for-android7670353
Ref: 22ba7670353
Ref: Android 向けの Python パッケージをビルドする-Footnote-17670766
Node: iOS で Python を使う7670832
Ref: using/ios doc7670995
Ref: 22bb7670995
Ref: using/ios translation-repo7670995
Ref: 22bc7670995
Ref: using/ios using-ios7670995
Ref: 22bd7670995
Ref: using/ios using-python-on-ios7670995
Ref: 22be7670995
Ref: iOS で Python を使う-Footnote-17673226
Ref: iOS で Python を使う-Footnote-27673254
Node: iOS ランタイムでの Python7673279
Ref: using/ios python-at-runtime-on-ios7673420
Ref: 22bf7673420
Node: iOS のバージョン互換性7673699
Ref: using/ios ios-version-compatibility7673841
Ref: 22c07673841
Node: プラットフォームの識別7674567
Ref: using/ios platform-identification7674757
Ref: 22c17674757
Node: 標準ライブラリの利用可能性7675610
Ref: using/ios standard-library-availability7675802
Ref: 22c47675802
Node: バイナリ拡張モジュール7676101
Ref: using/ios binary-extension-modules7676296
Ref: 22c57676296
Node: コンパイラスタブバイナリ7680114
Ref: using/ios compiler-stub-binaries7680261
Ref: 22c97680261
Node: iOS での Python のインストール7682160
Ref: using/ios installing-python-on-ios7682347
Ref: 22ca7682347
Node: iOS アプリビルド用のツール7682575
Ref: using/ios tools-for-building-ios-apps7682745
Ref: 22cb7682745
Node: iOS プロジェクトに Python を追加する7683813
Ref: using/ios adding-ios7684026
Ref: 22c67684026
Ref: using/ios adding-python-to-an-ios-project7684026
Ref: 22cc7684026
Ref: iOS プロジェクトに Python を追加する-Footnote-17690740
Ref: iOS プロジェクトに Python を追加する-Footnote-27690785
Node: Python パッケージのテスト7690857
Ref: using/ios testing-a-python-package7691024
Ref: 22cf7691024
Ref: Python パッケージのテスト-Footnote-17694109
Ref: Python パッケージのテスト-Footnote-27694179
Node: App Store コンプライアンス<2>7694251
Ref: using/ios app-store-compliance7694397
Ref: 22d07694397
Node: 標準ライブラリ内の互換性のないコード7695001
Ref: using/ios incompatible-code-in-the-standard-library7695174
Ref: 22d17695174
Ref: 標準ライブラリ内の互換性のないコード-Footnote-17696040
Node: プライバシーマニフェスト7696134
Ref: using/ios privacy-manifests7696307
Ref: 22d27696307
Ref: プライバシーマニフェスト-Footnote-17697072
Node: エディタと IDE7697145
Ref: using/editors doc7697271
Ref: 22d37697271
Ref: using/editors editors7697271
Ref: 22a47697271
Ref: using/editors editors-and-ides7697271
Ref: 22d47697271
Ref: using/editors translation-repo7697271
Ref: 22d57697271
Ref: エディタと IDE-Footnote-17697717
Node: IDLE --- Python のエディタとシェル7697759
Ref: using/editors idle-python-editor-and-shell7697889
Ref: 22d67697889
Node: Other Editors and IDEs7698241
Ref: using/editors other-editors-and-ides7698371
Ref: 22d77698371
Ref: Other Editors and IDEs-Footnote-17698656
Ref: Other Editors and IDEs-Footnote-27698707
Node: Python 言語リファレンス7698778
Ref: reference/index doc7698932
Ref: 22d87698932
Ref: reference/index reference-index7698932
Ref: 14b7698932
Ref: reference/index the-python-language-reference7698932
Ref: 22d97698932
Ref: reference/index translation-repo7698932
Ref: 22da7698932
Node: はじめに<5>7700425
Ref: reference/introduction doc7700529
Ref: 22db7700529
Ref: reference/introduction id17700529
Ref: 22dc7700529
Ref: reference/introduction introduction7700529
Ref: 22dd7700529
Node: 別のPythonの実装7703099
Ref: reference/introduction alternate-implementations7703220
Ref: 22de7703220
Ref: reference/introduction implementations7703220
Ref: 21737703220
Ref: 別のPythonの実装-Footnote-17706096
Ref: 別のPythonの実装-Footnote-27706128
Ref: 別のPythonの実装-Footnote-37706165
Ref: 別のPythonの実装-Footnote-47706197
Node: 本マニュアルにおける表記法7706223
Ref: reference/introduction id27706344
Ref: 22df7706344
Ref: reference/introduction notation7706344
Ref: 22e07706344
Ref: reference/introduction grammar-token-notation-name7706550
Ref: 22e17706550
Ref: reference/introduction grammar-token-notation-letter7706633
Ref: 22e27706633
Ref: reference/introduction grammar-token-notation-digit7706668
Ref: 22e37706668
Ref: reference/introduction lexical-lookaheads7709406
Ref: 22ea7709406
Ref: reference/introduction grammar-token-notation-literal7709991
Ref: 22eb7709991
Ref: reference/introduction grammar-token-notation-alt-literal7710245
Ref: 22ec7710245
Ref: 本マニュアルにおける表記法-Footnote-17710516
Ref: 本マニュアルにおける表記法-Footnote-27710588
Ref: 本マニュアルにおける表記法-Footnote-37710653
Node: Lexical and Syntactic definitions7710695
Ref: reference/introduction lexical-and-syntactic-definitions7710804
Ref: 22ed7710804
Ref: reference/introduction notation-lexical-vs-syntactic7710804
Ref: 22e97710804
Node: 字句解析7711829
Ref: reference/lexical_analysis doc7711960
Ref: 22f27711960
Ref: reference/lexical_analysis lexical7711960
Ref: 22f17711960
Ref: reference/lexical_analysis lexical-analysis7711960
Ref: 22f37711960
Ref: reference/lexical_analysis translation-repo7711960
Ref: 22f47711960
Node: 行構造7716734
Ref: reference/lexical_analysis id17716825
Ref: 22ff7716825
Ref: reference/lexical_analysis line-structure7716825
Ref: 22f77716825
Node: 論理行 logical line7717332
Ref: reference/lexical_analysis id27717432
Ref: 23007717432
Ref: reference/lexical_analysis logical-lines7717432
Ref: 23017717432
Node: 物理行 physical line7717875
Ref: reference/lexical_analysis id37718005
Ref: 23037718005
Ref: reference/lexical_analysis physical-lines7718005
Ref: 23047718005
Ref: reference/lexical_analysis grammar-token-python-grammar-newline7718729
Ref: 23057718729
Ref: 物理行 physical line-Footnote-17718828
Node: コメント Comments7718881
Ref: reference/lexical_analysis comments7719031
Ref: 22fa7719031
Ref: reference/lexical_analysis id57719031
Ref: 23067719031
Node: エンコード宣言 encoding declaration7719409
Ref: reference/lexical_analysis encoding-declarations7719557
Ref: 23077719557
Ref: reference/lexical_analysis encodings7719557
Ref: 22f57719557
Ref: reference/lexical_analysis lexical-source-character7721018
Ref: 22f67721018
Ref: reference/lexical_analysis grammar-token-python-grammar-source_character7721240
Ref: 23087721240
Node: 明示的な行継続7721302
Ref: reference/lexical_analysis explicit-joining7721453
Ref: 22f97721453
Ref: reference/lexical_analysis explicit-line-joining7721453
Ref: 23097721453
Node: 非明示的な行継続7722842
Ref: reference/lexical_analysis implicit-joining7722957
Ref: 23027722957
Ref: reference/lexical_analysis implicit-line-joining7722957
Ref: 230a7722957
Node: 空行7723986
Ref: reference/lexical_analysis blank-lines7724095
Ref: 230b7724095
Ref: reference/lexical_analysis id67724095
Ref: 230c7724095
Node: インデント7724574
Ref: reference/lexical_analysis id77724683
Ref: 230d7724683
Ref: reference/lexical_analysis indentation7724683
Ref: 22f87724683
Node: トークン間の空白7728725
Ref: reference/lexical_analysis whitespace7728838
Ref: 22ef7728838
Ref: reference/lexical_analysis whitespace-between-tokens7728838
Ref: 230f7728838
Ref: reference/lexical_analysis grammar-token-python-grammar-whitespace7729061
Ref: 23107729061
Node: End marker7729402
Ref: reference/lexical_analysis end-marker7729491
Ref: 23117729491
Ref: reference/lexical_analysis endmarker-token7729491
Ref: 22fe7729491
Node: その他のトークン7729634
Ref: reference/lexical_analysis id87729764
Ref: 23137729764
Ref: reference/lexical_analysis other-tokens7729764
Ref: 23147729764
Node: Names identifiers and keywords7730370
Ref: reference/lexical_analysis identifiers7730503
Ref: 22fc7730503
Ref: reference/lexical_analysis names-identifiers-and-keywords7730503
Ref: 23187730503
Ref: reference/lexical_analysis grammar-token-python-grammar-NAME7731243
Ref: 231a7731243
Ref: reference/lexical_analysis grammar-token-python-grammar-name_start7731315
Ref: 231b7731315
Ref: reference/lexical_analysis grammar-token-python-grammar-name_continue7731387
Ref: 231c7731387
Ref: reference/lexical_analysis grammar-token-python-grammar-identifier7731430
Ref: 231d7731430
Node: キーワード keyword7731860
Ref: reference/lexical_analysis id97731983
Ref: 231e7731983
Ref: reference/lexical_analysis keywords7731983
Ref: 22e57731983
Node: ソフトキーワード7732601
Ref: reference/lexical_analysis id107732792
Ref: 231f7732792
Ref: reference/lexical_analysis soft-keywords7732792
Ref: a117732792
Node: 予約済みの識別子種 reserved classes of identifiers7733483
Ref: reference/lexical_analysis id-classes7733680
Ref: 23207733680
Ref: reference/lexical_analysis reserved-classes-of-identifiers7733680
Ref: 23217733680
Node: Non-ASCII characters in names7736132
Ref: reference/lexical_analysis lexical-names-nonascii7736296
Ref: 23197736296
Ref: reference/lexical_analysis non-ascii-characters-in-names7736296
Ref: 23237736296
Ref: Non-ASCII characters in names-Footnote-17739853
Ref: Non-ASCII characters in names-Footnote-27739910
Ref: Non-ASCII characters in names-Footnote-37739956
Ref: Non-ASCII characters in names-Footnote-47740002
Ref: Non-ASCII characters in names-Footnote-57740079
Ref: Non-ASCII characters in names-Footnote-67740142
Ref: Non-ASCII characters in names-Footnote-77740205
Ref: Non-ASCII characters in names-Footnote-87740247
Node: リテラル7740289
Ref: reference/lexical_analysis id117740440
Ref: 23247740440
Ref: reference/lexical_analysis literals7740440
Ref: 23257740440
Node: 文字列およびバイト列リテラル7740845
Ref: reference/lexical_analysis string-and-bytes-literals7740984
Ref: 23277740984
Ref: reference/lexical_analysis strings7740984
Ref: 22fb7740984
Node: Triple-quoted strings7742165
Ref: reference/lexical_analysis triple-quoted-strings7742289
Ref: 23287742289
Node: String prefixes7742918
Ref: reference/lexical_analysis string-prefixes7743065
Ref: 23297743065
Ref: String prefixes-Footnote-17744320
Node: Formal grammar7744362
Ref: reference/lexical_analysis formal-grammar7744504
Ref: 232c7744504
Ref: reference/lexical_analysis grammar-token-python-grammar-STRING7744798
Ref: 232d7744798
Ref: reference/lexical_analysis grammar-token-python-grammar-stringprefix7744877
Ref: 232e7744877
Ref: reference/lexical_analysis grammar-token-python-grammar-stringcontent7744951
Ref: 232f7744951
Ref: reference/lexical_analysis grammar-token-python-grammar-stringitem7745195
Ref: 23317745195
Ref: reference/lexical_analysis grammar-token-python-grammar-stringchar7745272
Ref: 23327745272
Ref: reference/lexical_analysis grammar-token-python-grammar-longstringitem7745359
Ref: 23307745359
Ref: reference/lexical_analysis grammar-token-python-grammar-stringescapeseq7745415
Ref: 23337745415
Node: Escape sequences7745635
Ref: reference/lexical_analysis escape-sequences7745776
Ref: 6877745776
Ref: reference/lexical_analysis id127745776
Ref: 23347745776
Node: Ignored end of line7749688
Ref: reference/lexical_analysis ignored-end-of-line7749787
Ref: 233b7749787
Ref: reference/lexical_analysis string-escape-ignore7749787
Ref: 23357749787
Node: Escaped characters7750207
Ref: reference/lexical_analysis escaped-characters7750330
Ref: 233d7750330
Ref: reference/lexical_analysis string-escape-escaped-char7750330
Ref: 23367750330
Node: Octal character7750755
Ref: reference/lexical_analysis octal-character7750880
Ref: 233e7750880
Ref: reference/lexical_analysis string-escape-oct7750880
Ref: 23377750880
Node: Hexadecimal character7751559
Ref: reference/lexical_analysis hexadecimal-character7751689
Ref: 233f7751689
Ref: reference/lexical_analysis string-escape-hex7751689
Ref: 23387751689
Node: Named Unicode character7752088
Ref: reference/lexical_analysis named-unicode-character7752233
Ref: 23407752233
Ref: reference/lexical_analysis string-escape-named7752233
Ref: 23397752233
Ref: Named Unicode character-Footnote-17752631
Node: Hexadecimal Unicode characters7752697
Ref: reference/lexical_analysis hexadecimal-unicode-characters7752850
Ref: 23417752850
Ref: reference/lexical_analysis string-escape-long-hex7752850
Ref: 233a7752850
Node: Unrecognized escape sequences7753315
Ref: reference/lexical_analysis unrecognized-escape-sequences7753436
Ref: 23427753436
Node: Bytes literals7754168
Ref: reference/lexical_analysis bytes-literal7754314
Ref: 232a7754314
Ref: reference/lexical_analysis bytes-literals7754314
Ref: 23437754314
Node: Raw string literals7754963
Ref: reference/lexical_analysis raw-string-literals7755102
Ref: 23447755102
Ref: reference/lexical_analysis raw-strings7755102
Ref: 232b7755102
Ref: reference/lexical_analysis f-strings7756419
Ref: 19b7756419
Node: f-strings7756419
Ref: reference/lexical_analysis formatted-string-literals7756553
Ref: 23457756553
Ref: reference/lexical_analysis id137756553
Ref: 23467756553
Ref: reference/lexical_analysis t-strings7761588
Ref: 18607761588
Ref: f-strings-Footnote-17761624
Ref: f-strings-Footnote-27761666
Node: t-strings7761708
Ref: reference/lexical_analysis id147761851
Ref: 23497761851
Ref: reference/lexical_analysis template-string-literals7761851
Ref: 234a7761851
Node: Formal grammar for f-strings7762205
Ref: reference/lexical_analysis formal-grammar-for-f-strings7762330
Ref: 234c7762330
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring7763737
Ref: 23507763737
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_START7763836
Ref: 23517763836
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_END7763916
Ref: 23537763916
Ref: reference/lexical_analysis grammar-token-python-grammar-fstringprefix7763962
Ref: 23547763962
Ref: reference/lexical_analysis grammar-token-python-grammar-f_debug_specifier7764027
Ref: 23567764027
Ref: reference/lexical_analysis grammar-token-python-grammar-f_quote7764056
Ref: 23557764056
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_middle7764129
Ref: 23527764129
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_MIDDLE7764237
Ref: 23587764237
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_replacement_field7764481
Ref: 23577764481
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_conversion7764678
Ref: 235a7764678
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_full_format_spec7764735
Ref: 235b7764735
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_format_spec7764814
Ref: 235c7764814
Ref: reference/lexical_analysis grammar-token-python-grammar-f_expression7764927
Ref: 23597764927
Ref: reference/lexical_analysis grammar-token-python-grammar-tstring7765557
Ref: 23607765557
Node: 数値リテラル7765676
Ref: reference/lexical_analysis numbers7765827
Ref: 22fd7765827
Ref: reference/lexical_analysis numeric-literals7765827
Ref: 23617765827
Ref: reference/lexical_analysis grammar-token-python-grammar-NUMBER7766017
Ref: 23627766017
Node: 整数リテラル7766650
Ref: reference/lexical_analysis integer-literals7766755
Ref: 23667766755
Ref: reference/lexical_analysis integers7766755
Ref: 23677766755
Ref: reference/lexical_analysis grammar-token-python-grammar-integer7768209
Ref: 23637768209
Ref: reference/lexical_analysis grammar-token-python-grammar-decinteger7768357
Ref: 23687768357
Ref: reference/lexical_analysis grammar-token-python-grammar-bininteger7768430
Ref: 23697768430
Ref: reference/lexical_analysis grammar-token-python-grammar-octinteger7768496
Ref: 236a7768496
Ref: reference/lexical_analysis grammar-token-python-grammar-hexinteger7768562
Ref: 236b7768562
Ref: reference/lexical_analysis grammar-token-python-grammar-zerointeger7768628
Ref: 236c7768628
Ref: reference/lexical_analysis grammar-token-python-grammar-nonzerodigit7768665
Ref: 236d7768665
Ref: reference/lexical_analysis grammar-token-python-grammar-digit7768694
Ref: 236e7768694
Ref: reference/lexical_analysis grammar-token-python-grammar-bindigit7768723
Ref: 236f7768723
Ref: reference/lexical_analysis grammar-token-python-grammar-octdigit7768752
Ref: 23707768752
Ref: reference/lexical_analysis grammar-token-python-grammar-hexdigit7768781
Ref: 23717768781
Node: Floating-point literals7768992
Ref: reference/lexical_analysis floating7769135
Ref: 23727769135
Ref: reference/lexical_analysis floating-point-literals7769135
Ref: 23737769135
Ref: reference/lexical_analysis grammar-token-python-grammar-floatnumber7770608
Ref: 23647770608
Ref: reference/lexical_analysis grammar-token-python-grammar-digitpart7770828
Ref: 23757770828
Ref: reference/lexical_analysis grammar-token-python-grammar-exponent7770891
Ref: 23767770891
Node: 虚数 imaginary リテラル7771103
Ref: reference/lexical_analysis imaginary7771219
Ref: 23777771219
Ref: reference/lexical_analysis imaginary-literals7771219
Ref: 23787771219
Ref: reference/lexical_analysis grammar-token-python-grammar-imagnumber7772747
Ref: 23657772747
Ref: reference/lexical_analysis delimiters7772828
Ref: 22e77772828
Ref: reference/lexical_analysis operators7772828
Ref: 22e87772828
Node: Operators and delimiters7772829
Ref: reference/lexical_analysis lexical-ellipsis7772929
Ref: 23267772929
Ref: reference/lexical_analysis operators-and-delimiters7772929
Ref: 23797772929
Ref: reference/lexical_analysis grammar-token-python-grammar-OP7773219
Ref: 237b7773219
Ref: reference/lexical_analysis grammar-token-python-grammar-assignment_operator7773437
Ref: 237c7773437
Ref: reference/lexical_analysis grammar-token-python-grammar-bitwise_operator7773595
Ref: 237d7773595
Ref: reference/lexical_analysis grammar-token-python-grammar-comparison_operator7773665
Ref: 237e7773665
Ref: reference/lexical_analysis grammar-token-python-grammar-enclosing_delimiter7773735
Ref: 237f7773735
Ref: reference/lexical_analysis grammar-token-python-grammar-other_delimiter7773804
Ref: 23807773804
Ref: reference/lexical_analysis grammar-token-python-grammar-arithmetic_operator7773874
Ref: 23817773874
Ref: reference/lexical_analysis grammar-token-python-grammar-other_op7773951
Ref: 23827773951
Node: データモデル7775000
Ref: reference/datamodel doc7775131
Ref: 23857775131
Ref: reference/datamodel data-model7775131
Ref: 23867775131
Ref: reference/datamodel datamodel7775131
Ref: 1db87775131
Ref: reference/datamodel translation-repo7775131
Ref: 23877775131
Node: オブジェクト、値、および型7775295
Ref: reference/datamodel objects7775416
Ref: 23887775416
Ref: reference/datamodel objects-values-and-types7775416
Ref: 23897775416
Ref: オブジェクト、値、および型-Footnote-17781752
Node: 標準型の階層7782027
Ref: reference/datamodel the-standard-type-hierarchy7782178
Ref: 238a7782178
Ref: reference/datamodel types7782178
Ref: 238b7782178
Node: None7783759
Ref: reference/datamodel none7783841
Ref: 238c7783841
Node: NotImplemented7784323
Ref: reference/datamodel notimplemented7784422
Ref: 238d7784422
Node: Ellipsis7785333
Ref: reference/datamodel ellipsis7785442
Ref: 238f7785442
Node: numbers Number7785782
Ref: reference/datamodel numbers-number7785904
Ref: 23907785904
Node: numbers Integral 整数7787410
Ref: reference/datamodel numbers-integral7787518
Ref: 23917787518
Node: numbers Real float 実数7788848
Ref: reference/datamodel datamodel-float7788988
Ref: 23747788988
Ref: reference/datamodel numbers-real-float7788988
Ref: 23927788988
Node: numbers Complex complex7789589
Ref: reference/datamodel numbers-complex-complex7789697
Ref: 23937789697
Node: シーケンス型 sequence7790077
Ref: reference/datamodel datamodel-sequences7790203
Ref: 23947790203
Ref: reference/datamodel sequences7790203
Ref: 23957790203
Node: 変更不能なシーケンス immutable sequence7792201
Ref: reference/datamodel immutable-sequences7792373
Ref: 23967792373
Node: 変更可能なシーケンス型 mutable sequence7794808
Ref: reference/datamodel mutable-sequences7794980
Ref: 23987794980
Node: 集合型<2>7796412
Ref: reference/datamodel set-types7796550
Ref: 23997796550
Node: マッピング型 mapping7798095
Ref: reference/datamodel datamodel-mappings7798241
Ref: 239b7798241
Ref: reference/datamodel mappings7798241
Ref: 239c7798241
Node: 辞書型 dictionary<2>7798894
Ref: reference/datamodel dictionaries7798980
Ref: 239d7798980
Node: 呼び出し可能型 callable type7800677
Ref: reference/datamodel callable-types7800829
Ref: 239e7800829
Node: ユーザ定義関数 user-defined function7801712
Ref: reference/datamodel user-defined-funcs7801866
Ref: 59c7801866
Ref: reference/datamodel user-defined-functions7801866
Ref: 239f7801866
Node: Special read-only attributes7802313
Ref: reference/datamodel special-read-only-attributes7802457
Ref: 23a07802457
Ref: reference/datamodel function __builtins__7802857
Ref: 23a17802857
Ref: reference/datamodel function __globals__7803303
Ref: 14ef7803303
Ref: reference/datamodel function __closure__7803808
Ref: 14ec7803808
Node: Special writable attributes7804628
Ref: reference/datamodel special-writable-attributes7804772
Ref: 23a47804772
Ref: reference/datamodel function __doc__7805229
Ref: 13f57805229
Ref: reference/datamodel function __name__7805592
Ref: 14f07805592
Ref: reference/datamodel function __qualname__7805886
Ref: 23a57805886
Ref: reference/datamodel function __module__7806333
Ref: 23a67806333
Ref: reference/datamodel function __defaults__7806691
Ref: 14ed7806691
Ref: reference/datamodel function __code__7807185
Ref: 59d7807185
Ref: reference/datamodel function __dict__7807479
Ref: 14ee7807479
Ref: reference/datamodel function __annotations__7807865
Ref: 13f47807865
Ref: reference/datamodel function __annotate__7808749
Ref: 23a87808749
Ref: reference/datamodel function __kwdefaults__7809306
Ref: 122d7809306
Ref: reference/datamodel function __type_params__7809618
Ref: 23a97809618
Ref: Special writable attributes-Footnote-17810647
Node: インスタンスメソッド7810689
Ref: reference/datamodel id27810895
Ref: 23ab7810895
Ref: reference/datamodel instance-methods7810895
Ref: 21027810895
Ref: reference/datamodel method __self__7811229
Ref: 15e67811229
Ref: reference/datamodel method __func__7811532
Ref: 15187811532
Ref: reference/datamodel method __doc__7811752
Ref: 23ad7811752
Ref: reference/datamodel method __name__7812244
Ref: 23ae7812244
Ref: reference/datamodel method __module__7812542
Ref: 23af7812542
Ref: reference/datamodel method-binding7813111
Ref: 23ac7813111
Node: ジェネレータ関数 generator function7814579
Ref: reference/datamodel generator-functions7814782
Ref: 23b07814782
Node: コルーチン関数 coroutine function7815587
Ref: reference/datamodel coroutine-functions7815825
Ref: 23b17815825
Node: 非同期ジェネレータ関数 asynchronous generator function7816401
Ref: reference/datamodel asynchronous-generator-functions7816632
Ref: 23b37816632
Node: 組み込み関数 built-in function7817729
Ref: reference/datamodel built-in-functions7817960
Ref: 23b47817960
Ref: reference/datamodel builtin-functions7817960
Ref: 23aa7817960
Node: 組み込みメソッド built-in method7818780
Ref: reference/datamodel built-in-methods7818958
Ref: 23b57818958
Ref: reference/datamodel builtin-methods7818958
Ref: 23b67818958
Node: クラス<2>7819491
Ref: reference/datamodel classes7819663
Ref: 23b77819663
Ref: reference/datamodel id37819663
Ref: 23b87819663
Node: クラスのインスタンス7820017
Ref: reference/datamodel class-instances7820140
Ref: 23b97820140
Node: モジュール<3>7820367
Ref: reference/datamodel module-objects7820517
Ref: 23ba7820517
Ref: reference/datamodel modules7820517
Ref: 23bb7820517
Node: Import-related attributes on module objects7821591
Ref: reference/datamodel import-mod-attrs7821741
Ref: 23bd7821741
Ref: reference/datamodel import-related-attributes-on-module-objects7821741
Ref: 23be7821741
Ref: reference/datamodel module __name__7823378
Ref: 15a77823378
Ref: reference/datamodel module __spec__7823717
Ref: 23c07823717
Ref: reference/datamodel module __package__7823974
Ref: 3257823974
Ref: reference/datamodel module __loader__7826088
Ref: 3397826088
Ref: reference/datamodel module __path__7827326
Ref: 20b07827326
Ref: reference/datamodel module __file__7827781
Ref: 23c57827781
Ref: reference/datamodel module __cached__7827813
Ref: 3237827813
Ref: Import-related attributes on module objects-Footnote-17829801
Ref: Import-related attributes on module objects-Footnote-27829843
Node: Other writable attributes on module objects7829885
Ref: reference/datamodel other-writable-attributes-on-module-objects7830063
Ref: 23c77830063
Ref: reference/datamodel module __doc__7830286
Ref: 1c4c7830286
Ref: reference/datamodel module __annotations__7830435
Ref: 23c87830435
Ref: reference/datamodel module __annotate__7830783
Ref: 23c97830783
Ref: Other writable attributes on module objects-Footnote-17831048
Node: Module dictionaries7831090
Ref: reference/datamodel module-dictionaries7831216
Ref: 23ca7831216
Ref: reference/datamodel module __dict__7831344
Ref: 23cb7831344
Node: カスタムクラス型7832005
Ref: reference/datamodel class-attrs-and-methods7832162
Ref: 23cc7832162
Ref: reference/datamodel custom-classes7832162
Ref: 23cd7832162
Node: Special attributes7833892
Ref: reference/datamodel special-attributes7833995
Ref: 23ce7833995
Ref: reference/datamodel type __name__7834367
Ref: 16c97834367
Ref: reference/datamodel type __qualname__7834658
Ref: 23cf7834658
Ref: reference/datamodel type __module__7834969
Ref: 6177834969
Ref: reference/datamodel type __dict__7835198
Ref: e5b7835198
Ref: reference/datamodel type __bases__7835603
Ref: 16ca7835603
Ref: reference/datamodel type __base__7836109
Ref: 23d07836109
Ref: reference/datamodel type __doc__7836641
Ref: 20f17836641
Ref: reference/datamodel type __annotations__7836966
Ref: 18a87836966
Ref: reference/datamodel type __annotate__7839438
Ref: 18cc7839438
Ref: reference/datamodel type __type_params__7839995
Ref: 23d27839995
Ref: reference/datamodel type __static_attributes__7840510
Ref: 4777840510
Ref: reference/datamodel type __firstlineno__7841054
Ref: 4787841054
Ref: reference/datamodel type __mro__7841709
Ref: 23d47841709
Ref: Special attributes-Footnote-17842052
Ref: Special attributes-Footnote-27842113
Node: Special methods7842155
Ref: reference/datamodel special-methods7842258
Ref: 23d57842258
Ref: reference/datamodel type mro7842431
Ref: 23d67842431
Ref: reference/datamodel type __subclasses__7842670
Ref: 7937842670
Node: クラスインスタンス class instance7843026
Ref: reference/datamodel id47843227
Ref: 23d77843227
Node: Special attributes<2>7844991
Ref: reference/datamodel id57845091
Ref: 23da7845091
Ref: reference/datamodel object __class__7845148
Ref: 16cb7845148
Ref: reference/datamodel object __dict__7845251
Ref: 77d7845251
Node: I/O オブジェクト ファイルオブジェクトの別名7845502
Ref: reference/datamodel i-o-objects-also-known-as-file-objects7845702
Ref: 23dc7845702
Ref: reference/datamodel file read7846858
Ref: 23df7846858
Ref: reference/datamodel file write7847031
Ref: 23e07847031
Ref: reference/datamodel file close7847103
Ref: 23e17847103
Node: 内部型 internal type7847191
Ref: reference/datamodel internal-types7847340
Ref: 23e27847340
Node: コードオブジェクト7848174
Ref: reference/datamodel code-objects7848307
Ref: 4e67848307
Ref: reference/datamodel id67848307
Ref: 23e37848307
Node: Special read-only attributes<2>7849379
Ref: reference/datamodel id77849506
Ref: 23e47849506
Ref: reference/datamodel codeobject co_name7849616
Ref: 23e57849616
Ref: reference/datamodel codeobject co_qualname7849808
Ref: 23e67849808
Ref: reference/datamodel codeobject co_argcount7850146
Ref: 23e77850146
Ref: reference/datamodel codeobject co_posonlyargcount7850639
Ref: 23e87850639
Ref: reference/datamodel codeobject co_kwonlyargcount7851036
Ref: 23e97851036
Ref: reference/datamodel codeobject co_nlocals7851424
Ref: 23ea7851424
Ref: reference/datamodel codeobject co_varnames7851737
Ref: 23eb7851737
Ref: reference/datamodel codeobject co_cellvars7852133
Ref: 23ec7852133
Ref: reference/datamodel codeobject co_freevars7852625
Ref: 23a37852625
Ref: reference/datamodel codeobject co_code7853376
Ref: 23ee7853376
Ref: reference/datamodel codeobject co_consts7853691
Ref: 18fe7853691
Ref: reference/datamodel codeobject co_names7854008
Ref: 23ef7854008
Ref: reference/datamodel codeobject co_filename7854326
Ref: 15897854326
Ref: reference/datamodel codeobject co_firstlineno7854608
Ref: 23f07854608
Ref: reference/datamodel codeobject co_lnotab7854823
Ref: 32e7854823
Ref: reference/datamodel codeobject co_stacksize7855578
Ref: 23f17855578
Ref: reference/datamodel codeobject co_flags7855787
Ref: 193d7855787
Node: Methods on code objects7856968
Ref: reference/datamodel methods-on-code-objects7857095
Ref: 23f57857095
Ref: reference/datamodel codeobject co_positions7857162
Ref: 7d07857162
Ref: reference/datamodel codeobject co_lines7858717
Ref: 34e7858717
Ref: reference/datamodel codeobject replace7860348
Ref: 23f67860348
Ref: Methods on code objects-Footnote-17860641
Node: フレーム frame オブジェクト7860683
Ref: reference/datamodel frame-objects7860875
Ref: 8f07860875
Ref: reference/datamodel id87860875
Ref: 23f77860875
Node: Special read-only attributes<3>7861270
Ref: reference/datamodel id97861414
Ref: 23f87861414
Ref: reference/datamodel frame f_back7861518
Ref: 9937861518
Ref: reference/datamodel frame f_code7861848
Ref: 23f97861848
Ref: reference/datamodel frame f_locals7862377
Ref: 4a57862377
Ref: reference/datamodel frame f_globals7863119
Ref: 23fa7863119
Ref: reference/datamodel frame f_builtins7863419
Ref: 23fb7863419
Ref: reference/datamodel frame f_lasti7863725
Ref: a8c7863725
Ref: reference/datamodel frame f_generator7864142
Ref: 23fc7864142
Node: Special writable attributes<2>7864599
Ref: reference/datamodel id107864772
Ref: 23fd7864772
Ref: reference/datamodel frame f_trace7864875
Ref: 23fe7864875
Ref: reference/datamodel frame f_trace_lines7865421
Ref: dda7865421
Ref: reference/datamodel frame f_trace_opcodes7865748
Ref: ddb7865748
Ref: reference/datamodel frame f_lineno7866354
Ref: 9b37866354
Node: Frame object methods7866898
Ref: reference/datamodel frame-object-methods7867031
Ref: 23ff7867031
Ref: reference/datamodel frame clear7867170
Ref: 5857867170
Node: トレースバック traceback オブジェクト7867865
Ref: reference/datamodel id117868067
Ref: 24007868067
Ref: reference/datamodel traceback-objects7868067
Ref: cf07868067
Ref: reference/datamodel traceback tb_frame7869448
Ref: 24017869448
Ref: reference/datamodel traceback tb_lineno7870094
Ref: 24027870094
Ref: reference/datamodel traceback tb_lasti7870314
Ref: 24037870314
Ref: reference/datamodel traceback tb_next7870678
Ref: cef7870678
Node: スライス slice オブジェクト7870969
Ref: reference/datamodel slice-objects7871185
Ref: 24047871185
Ref: reference/datamodel slice indices7871868
Ref: 122c7871868
Node: 静的メソッド static method オブジェクト7872509
Ref: reference/datamodel static-method-objects7872714
Ref: 24087872714
Node: クラスメソッドオブジェクト7873682
Ref: reference/datamodel class-method-objects7873841
Ref: 24097873841
Node: 特殊メソッド名7874309
Ref: reference/datamodel special-method-names7874436
Ref: 240a7874436
Ref: reference/datamodel specialnames7874436
Ref: e6c7874436
Ref: 特殊メソッド名-Footnote-17876880
Node: 基本的なカスタマイズ7877217
Ref: reference/datamodel basic-customization7877362
Ref: 240c7877362
Ref: reference/datamodel customization7877362
Ref: 240d7877362
Ref: reference/datamodel object __new__7877431
Ref: 7a07877431
Ref: reference/datamodel object __init__7879510
Ref: 8c07879510
Ref: reference/datamodel object __del__7880624
Ref: 12037880624
Ref: reference/datamodel object __repr__7884615
Ref: 82f7884615
Ref: reference/datamodel object __str__7885709
Ref: 8307885709
Ref: reference/datamodel object __bytes__7886473
Ref: 7fe7886473
Ref: reference/datamodel object __format__7886735
Ref: 8317886735
Ref: reference/datamodel richcmpfuncs7888236
Ref: 240e7888236
Ref: reference/datamodel object __lt__7888236
Ref: 14bc7888236
Ref: reference/datamodel object __le__7888282
Ref: 15267888282
Ref: reference/datamodel object __eq__7888328
Ref: cf67888328
Ref: reference/datamodel object __ne__7888374
Ref: 17357888374
Ref: reference/datamodel object __gt__7888420
Ref: 15277888420
Ref: reference/datamodel object __ge__7888466
Ref: 15287888466
Ref: reference/datamodel object __hash__7891740
Ref: cf77891740
Ref: reference/datamodel object __bool__7896868
Ref: 14f17896868
Node: 属性値アクセスをカスタマイズする7897374
Ref: reference/datamodel attribute-access7897570
Ref: 240f7897570
Ref: reference/datamodel customizing-attribute-access7897570
Ref: 24107897570
Ref: reference/datamodel object __getattr__7897904
Ref: 6fa7897904
Ref: reference/datamodel object __getattribute__7899188
Ref: dcf7899188
Ref: reference/datamodel object __setattr__7900565
Ref: 23d87900565
Ref: reference/datamodel object __delattr__7901422
Ref: 23d97901422
Ref: reference/datamodel object __dir__7901955
Ref: 17d87901955
Node: モジュールの属性値アクセスをカスタマイズする7902398
Ref: reference/datamodel customizing-module-attribute-access7902597
Ref: 24127902597
Ref: reference/datamodel module __getattr__7902726
Ref: cdc7902726
Ref: reference/datamodel module __dir__7902766
Ref: cdd7902766
Ref: reference/datamodel module __class__7903736
Ref: 24137903736
Ref: モジュールの属性値アクセスをカスタマイズする-Footnote-17905237
Node: デスクリプタ descriptor の実装7905279
Ref: reference/datamodel descriptors7905520
Ref: e4d7905520
Ref: reference/datamodel implementing-descriptors7905520
Ref: 24147905520
Ref: reference/datamodel object __get__7906097
Ref: 17067906097
Ref: reference/datamodel object __set__7907216
Ref: 24157907216
Ref: reference/datamodel object __delete__7907685
Ref: 19af7907685
Ref: reference/datamodel object __objclass__7907945
Ref: 24177907945
Ref: デスクリプタ descriptor の実装-Footnote-17908512
Node: デスクリプタの呼び出し7908554
Ref: reference/datamodel descriptor-invocation7908741
Ref: 24167908741
Ref: reference/datamodel invoking-descriptors7908741
Ref: 24187908741
Node: __slots__<2>7912975
Ref: reference/datamodel id137913114
Ref: 24197913114
Ref: reference/datamodel slots7913114
Ref: 23db7913114
Ref: reference/datamodel object __slots__7913614
Ref: 17097913614
Ref: reference/datamodel datamodel-note-slots7914051
Ref: 241a7914051
Node: クラス生成をカスタマイズする7917729
Ref: reference/datamodel class-customization7917964
Ref: e497917964
Ref: reference/datamodel customizing-class-creation7917964
Ref: 241c7917964
Ref: reference/datamodel object __init_subclass__7918630
Ref: 8437918630
Ref: reference/datamodel object __set_name__7920312
Ref: e4c7920312
Node: メタクラス7921381
Ref: reference/datamodel id147921509
Ref: 241d7921509
Ref: reference/datamodel metaclasses7921509
Ref: 241e7921509
Node: MRO エントリの解決7922748
Ref: reference/datamodel resolving-mro-entries7922918
Ref: 241f7922918
Ref: reference/datamodel object __mro_entries__7922980
Ref: ce77922980
Ref: MRO エントリの解決-Footnote-17923989
Node: 適切なメタクラスの決定7924031
Ref: reference/datamodel determining-the-appropriate-metaclass7924219
Ref: 24207924219
Node: クラスの名前空間の準備7925418
Ref: reference/datamodel prepare7925605
Ref: e5c7925605
Ref: reference/datamodel preparing-the-class-namespace7925605
Ref: 24217925605
Ref: クラスの名前空間の準備-Footnote-17926648
Node: クラス本体の実行7926690
Ref: reference/datamodel executing-the-class-body7926880
Ref: 24227926880
Node: クラスオブジェクトの作成7927850
Ref: reference/datamodel class-object-creation7928031
Ref: e487928031
Ref: reference/datamodel creating-the-class-object7928031
Ref: 24237928031
Ref: クラスオブジェクトの作成-Footnote-17931184
Node: メタクラスの用途7931226
Ref: reference/datamodel uses-for-metaclasses7931374
Ref: 24247931374
Node: インスタンスのカスタマイズとサブクラスチェック7931816
Ref: reference/datamodel customizing-instance-and-subclass-checks7932051
Ref: 24257932051
Ref: reference/datamodel type __instancecheck__7932660
Ref: 24267932660
Ref: reference/datamodel type __subclasscheck__7932972
Ref: 24277932972
Ref: インスタンスのカスタマイズとサブクラスチェック-Footnote-17934100
Node: ジェネリック型をエミュレートする7934142
Ref: reference/datamodel emulating-generic-types7934398
Ref: 24287934398
Ref: reference/datamodel object __class_getitem__7935407
Ref: 9477935407
Ref: ジェネリック型をエミュレートする-Footnote-17935928
Node: The purpose of __class_getitem__7935970
Ref: reference/datamodel the-purpose-of-class-getitem7936132
Ref: 242a7936132
Node: __class_getitem__ versus __getitem__7937023
Ref: reference/datamodel class-getitem-versus-getitem7937185
Ref: 242c7937185
Ref: reference/datamodel classgetitem-versus-getitem7937185
Ref: 242d7937185
Ref: __class_getitem__ versus __getitem__-Footnote-17940543
Node: 呼び出し可能オブジェクトをエミュレートする7940585
Ref: reference/datamodel emulating-callable-objects7940811
Ref: 24317940811
Ref: reference/datamodel id157940811
Ref: 24327940811
Ref: reference/datamodel object __call__7940937
Ref: 77a7940937
Node: コンテナをエミュレートする7941242
Ref: reference/datamodel emulating-container-types7941456
Ref: 24337941456
Ref: reference/datamodel sequence-types7941456
Ref: 24347941456
Ref: reference/datamodel object __len__7943906
Ref: 17ff7943906
Ref: reference/datamodel object __length_hint__7944639
Ref: 11137944639
Ref: reference/datamodel object __getitem__7945177
Ref: 5887945177
Ref: reference/datamodel object __setitem__7947160
Ref: 14e77947160
Ref: reference/datamodel object __delitem__7947815
Ref: 14e87947815
Ref: reference/datamodel object __missing__7948355
Ref: 13d97948355
Ref: reference/datamodel object __iter__7948629
Ref: e6d7948629
Ref: reference/datamodel object __reversed__7949127
Ref: e8a7949127
Ref: reference/datamodel object __contains__7950309
Ref: 15d77950309
Node: 数値型をエミュレートする7951109
Ref: reference/datamodel emulating-numeric-types7951303
Ref: 24477951303
Ref: reference/datamodel numeric-types7951303
Ref: 24487951303
Ref: reference/datamodel object __add__7951741
Ref: 243d7951741
Ref: reference/datamodel object __sub__7951788
Ref: 24497951788
Ref: reference/datamodel object __mul__7951835
Ref: 24407951835
Ref: reference/datamodel object __matmul__7951882
Ref: f7d7951882
Ref: reference/datamodel object __truediv__7951932
Ref: 10947951932
Ref: reference/datamodel object __floordiv__7951983
Ref: 17127951983
Ref: reference/datamodel object __mod__7952035
Ref: 244a7952035
Ref: reference/datamodel object __divmod__7952082
Ref: 10957952082
Ref: reference/datamodel object __pow__7952132
Ref: 9d87952132
Ref: reference/datamodel object __lshift__7952189
Ref: 244b7952189
Ref: reference/datamodel object __rshift__7952239
Ref: 244c7952239
Ref: reference/datamodel object __and__7952289
Ref: 244d7952289
Ref: reference/datamodel object __xor__7952336
Ref: 244e7952336
Ref: reference/datamodel object __or__7952383
Ref: 244f7952383
Ref: reference/datamodel object __radd__7953349
Ref: 243e7953349
Ref: reference/datamodel object __rsub__7953397
Ref: 24507953397
Ref: reference/datamodel object __rmul__7953445
Ref: 24417953445
Ref: reference/datamodel object __rmatmul__7953493
Ref: f7e7953493
Ref: reference/datamodel object __rtruediv__7953544
Ref: 24517953544
Ref: reference/datamodel object __rfloordiv__7953596
Ref: 24527953596
Ref: reference/datamodel object __rmod__7953649
Ref: fd97953649
Ref: reference/datamodel object __rdivmod__7953697
Ref: 24537953697
Ref: reference/datamodel object __rpow__7953748
Ref: 1a67953748
Ref: reference/datamodel object __rlshift__7953806
Ref: 24547953806
Ref: reference/datamodel object __rrshift__7953857
Ref: 24557953857
Ref: reference/datamodel object __rand__7953908
Ref: 24567953908
Ref: reference/datamodel object __rxor__7953956
Ref: 24577953956
Ref: reference/datamodel object __ror__7954004
Ref: 24587954004
Ref: reference/datamodel object __iadd__7955803
Ref: 243f7955803
Ref: reference/datamodel object __isub__7955851
Ref: 24597955851
Ref: reference/datamodel object __imul__7955899
Ref: 24427955899
Ref: reference/datamodel object __imatmul__7955947
Ref: f7f7955947
Ref: reference/datamodel object __itruediv__7955998
Ref: 245a7955998
Ref: reference/datamodel object __ifloordiv__7956050
Ref: 245b7956050
Ref: reference/datamodel object __imod__7956103
Ref: 245c7956103
Ref: reference/datamodel object __ipow__7956151
Ref: 9d77956151
Ref: reference/datamodel object __ilshift__7956209
Ref: 245d7956209
Ref: reference/datamodel object __irshift__7956260
Ref: 245e7956260
Ref: reference/datamodel object __iand__7956311
Ref: 245f7956311
Ref: reference/datamodel object __ixor__7956359
Ref: 24607956359
Ref: reference/datamodel object __ior__7956407
Ref: 24617956407
Ref: reference/datamodel object __neg__7957617
Ref: 24637957617
Ref: reference/datamodel object __pos__7957657
Ref: 24647957657
Ref: reference/datamodel object __abs__7957697
Ref: 24657957697
Ref: reference/datamodel object __invert__7957737
Ref: 24667957737
Ref: reference/datamodel object __complex__7957906
Ref: 7fd7957906
Ref: reference/datamodel object __int__7957950
Ref: 19e7957950
Ref: reference/datamodel object __float__7957990
Ref: bc57957990
Ref: reference/datamodel object __index__7958230
Ref: 19f7958230
Ref: reference/datamodel object __round__7959087
Ref: 24677959087
Ref: reference/datamodel object __trunc__7959140
Ref: 19d7959140
Ref: reference/datamodel object __floor__7959182
Ref: 24687959182
Ref: reference/datamodel object __ceil__7959224
Ref: 24697959224
Ref: 数値型をエミュレートする-Footnote-17959862
Ref: 数値型をエミュレートする-Footnote-27960176
Ref: 数値型をエミュレートする-Footnote-37960387
Node: with文とコンテキストマネージャ7960563
Ref: reference/datamodel context-managers7960784
Ref: 23de7960784
Ref: reference/datamodel with-statement-context-managers7960784
Ref: 246b7960784
Ref: reference/datamodel object __enter__7961858
Ref: 7e47961858
Ref: reference/datamodel object __exit__7962118
Ref: 151c7962118
Ref: with文とコンテキストマネージャ-Footnote-17963215
Node: クラスパターンマッチの位置引数のカスタマイズ7963257
Ref: reference/datamodel class-pattern-matching7963464
Ref: 246d7963464
Ref: reference/datamodel customizing-positional-arguments-in-class-pattern-matching7963464
Ref: 246e7963464
Ref: reference/datamodel object __match_args__7963947
Ref: 1cd27963947
Ref: クラスパターンマッチの位置引数のカスタマイズ-Footnote-17965022
Node: Emulating buffer types7965064
Ref: reference/datamodel emulating-buffer-types7965239
Ref: 246f7965239
Ref: reference/datamodel python-buffer-protocol7965239
Ref: 24707965239
Ref: reference/datamodel object __buffer__7965696
Ref: 68c7965696
Ref: reference/datamodel object __release_buffer__7966612
Ref: 1ac67966612
Ref: Emulating buffer types-Footnote-17967598
Node: Annotations7967640
Ref: reference/datamodel annotations7967773
Ref: 24727967773
Ref: reference/datamodel object __annotations__7967975
Ref: 4567967975
Ref: reference/datamodel object __annotate__7968394
Ref: 19e37968394
Ref: Annotations-Footnote-17969740
Node: 特殊メソッド検索7969782
Ref: reference/datamodel special-lookup7969884
Ref: 24117969884
Ref: reference/datamodel special-method-lookup7969884
Ref: 24737969884
Node: コルーチン7972928
Ref: reference/datamodel coroutines7973028
Ref: 24747973028
Node: 待機可能オブジェクト Awaitable Object7973468
Ref: reference/datamodel awaitable-objects7973609
Ref: 24757973609
Ref: reference/datamodel object __await__7974233
Ref: f797974233
Ref: 待機可能オブジェクト Awaitable Object-Footnote-17975138
Node: コルーチンオブジェクト7975180
Ref: reference/datamodel coroutine-objects7975376
Ref: 23b27975376
Ref: reference/datamodel id197975376
Ref: 24767975376
Ref: reference/datamodel coroutine send7976669
Ref: 24797976669
Ref: reference/datamodel coroutine throw7977203
Ref: 71b7977203
Ref: reference/datamodel coroutine close7978124
Ref: 247a7978124
Node: 非同期イテレータ Asynchronous Iterator7978897
Ref: reference/datamodel async-iterators7979117
Ref: f7b7979117
Ref: reference/datamodel asynchronous-iterators7979117
Ref: 247b7979117
Ref: reference/datamodel object __aiter__7979482
Ref: dfa7979482
Ref: reference/datamodel object __anext__7979616
Ref: 18e67979616
Node: 非同期コンテキストマネージャ Asynchronous Context Manager7980650
Ref: reference/datamodel async-context-managers7980828
Ref: 8127980828
Ref: reference/datamodel asynchronous-context-managers7980828
Ref: 247c7980828
Ref: reference/datamodel object __aenter__7981346
Ref: 247d7981346
Ref: reference/datamodel object __aexit__7981511
Ref: 1a007981511
Node: 実行モデル7982014
Ref: reference/executionmodel doc7982160
Ref: 247e7982160
Ref: reference/executionmodel execmodel7982160
Ref: 247f7982160
Ref: reference/executionmodel execution-model7982160
Ref: 24807982160
Ref: reference/executionmodel translation-repo7982160
Ref: 24817982160
Node: プログラムの構造7982367
Ref: reference/executionmodel prog-structure7982492
Ref: 24827982492
Ref: reference/executionmodel structure-of-a-program7982492
Ref: 24837982492
Node: 名前づけと束縛 naming and binding7984013
Ref: reference/executionmodel naming7984156
Ref: 23a27984156
Ref: reference/executionmodel naming-and-binding7984156
Ref: 24847984156
Node: 名前の束縛7984416
Ref: reference/executionmodel bind-names7984529
Ref: 24857984529
Ref: reference/executionmodel binding-of-names7984529
Ref: 24867984529
Node: 名前解決7986493
Ref: reference/executionmodel resolution-of-names7986632
Ref: 24897986632
Ref: reference/executionmodel resolve-names7986632
Ref: 248a7986632
Node: Annotation scopes7991149
Ref: reference/executionmodel annotation-scopes7991288
Ref: 4ab7991288
Ref: reference/executionmodel id17991288
Ref: 248c7991288
Ref: Annotation scopes-Footnote-17994021
Ref: Annotation scopes-Footnote-27994063
Ref: Annotation scopes-Footnote-37994105
Ref: Annotation scopes-Footnote-47994147
Node: Lazy evaluation7994189
Ref: reference/executionmodel id27994352
Ref: 248e7994352
Ref: reference/executionmodel lazy-evaluation7994352
Ref: 6857994352
Node: 組み込みと制限付きの実行7996100
Ref: reference/executionmodel builtins-and-restricted-execution7996279
Ref: 248f7996279
Ref: reference/executionmodel restrict-exec7996279
Ref: 24907996279
Node: 動的な機能とのやりとり7997363
Ref: reference/executionmodel dynamic-features7997518
Ref: 24917997518
Ref: reference/executionmodel interaction-with-dynamic-features7997518
Ref: 24927997518
Ref: 動的な機能とのやりとり-Footnote-17998444
Node: 例外<2>7998625
Ref: reference/executionmodel exceptions7998762
Ref: 24937998762
Ref: reference/executionmodel id47998762
Ref: 24947998762
Node: Runtime Components8001735
Ref: reference/executionmodel execcomponents8001823
Ref: 24958001823
Ref: reference/executionmodel runtime-components8001823
Ref: 24968001823
Node: General Computing Model8001937
Ref: reference/executionmodel general-computing-model8002044
Ref: 24978002044
Node: Python Runtime Model8004953
Ref: reference/executionmodel python-runtime-model8005060
Ref: 24988005060
Ref: Python Runtime Model-Footnote-18010447
Node: インポートシステム8010506
Ref: reference/import doc8010648
Ref: 24998010648
Ref: reference/import importsystem8010648
Ref: 23bc8010648
Ref: reference/import the-import-system8010648
Ref: 249a8010648
Ref: reference/import translation-repo8010648
Ref: 249b8010648
Ref: インポートシステム-Footnote-18013981
Ref: インポートシステム-Footnote-28014050
Ref: インポートシステム-Footnote-38014092
Node: importlib<10>8014134
Ref: reference/import importlib8014238
Ref: 249d8014238
Node: パッケージ<2>8014722
Ref: reference/import packages8014841
Ref: 249e8014841
Node: 通常のパッケージ8016899
Ref: reference/import regular-packages8017014
Ref: 249f8017014
Ref: 通常のパッケージ-Footnote-18018888
Node: 名前空間パッケージ8018930
Ref: reference/import namespace-packages8019045
Ref: 24a28019045
Ref: reference/import reference-namespace-package8019045
Ref: 24a18019045
Ref: 名前空間パッケージ-Footnote-18021316
Node: 検索8021358
Ref: reference/import searching8021473
Ref: 24a48021473
Node: モジュールキャッシュ8022554
Ref: reference/import the-module-cache8022669
Ref: 24a58022669
Node: ファインダーとローダー8024939
Ref: reference/import finders-and-loaders8025087
Ref: 24a68025087
Ref: reference/import id28025087
Ref: 24a78025087
Node: インポートフック8027982
Ref: reference/import import-hooks8028112
Ref: 24ab8028112
Node: メタパス8029357
Ref: reference/import the-meta-path8029445
Ref: 24ac8029445
Node: ロード8033337
Ref: reference/import loading8033470
Ref: 24ae8033470
Ref: ロード-Footnote-18037281
Node: ローダー8037795
Ref: reference/import loaders8037883
Ref: 24af8037883
Node: サブモジュール8042482
Ref: reference/import submodules8042591
Ref: 24b08042591
Node: Module specs8044266
Ref: reference/import id48044393
Ref: 24b18044393
Ref: reference/import module-specs8044393
Ref: 23c28044393
Node: __path__ attributes on modules8045728
Ref: reference/import package-path-rules8045857
Ref: 23c38045857
Ref: reference/import path-attributes-on-modules8045857
Ref: 24b48045857
Ref: __path__ attributes on modules-Footnote-18047178
Ref: __path__ attributes on modules-Footnote-28047220
Node: モジュールの repr8047262
Ref: reference/import module-reprs8047433
Ref: 24b58047433
Node: キャッシュされたバイトコードの無効化8049354
Ref: reference/import cached-bytecode-invalidation8049486
Ref: 24b68049486
Ref: reference/import pyc-invalidation8049486
Ref: 8028049486
Node: パスベース・ファインダー8050866
Ref: reference/import the-path-based-finder8051047
Ref: 24b78051047
Node: パスエントリ・ファインダー8054731
Ref: reference/import path-entry-finders8054909
Ref: 24b98054909
Node: パスエントリ・ファインダー・プロトコル8060981
Ref: reference/import path-entry-finder-protocol8061159
Ref: 24bb8061159
Node: 標準のインポートシステムを置き換える8064409
Ref: reference/import replacing-the-standard-import-system8064605
Ref: 24bc8064605
Node: Package Relative Imports8065682
Ref: reference/import package-relative-imports8065878
Ref: 24bd8065878
Ref: reference/import relativeimports8065878
Ref: 24be8065878
Node: __main__ に対する特別な考慮8067081
Ref: reference/import import-dunder-main8067235
Ref: 24bf8067235
Ref: reference/import special-considerations-for-main8067235
Ref: 24c08067235
Node: __main__ __spec__8068058
Ref: reference/import id58068148
Ref: 24c18068148
Ref: reference/import main-spec8068148
Ref: 24b38068148
Node: 参考資料8070317
Ref: reference/import references8070438
Ref: 24c28070438
Ref: 参考資料-Footnote-18072071
Ref: 参考資料-Footnote-28072123
Ref: 参考資料-Footnote-38072165
Ref: 参考資料-Footnote-48072207
Ref: 参考資料-Footnote-58072249
Ref: 参考資料-Footnote-68072291
Ref: 参考資料-Footnote-78072333
Ref: 参考資料-Footnote-88072375
Ref: 参考資料-Footnote-98072417
Ref: 参考資料-Footnote-108072459
Node: 式 expression8072502
Ref: reference/expressions doc8072655
Ref: 24c38072655
Ref: reference/expressions expressions8072655
Ref: 23838072655
Ref: reference/expressions id18072655
Ref: 24c48072655
Ref: reference/expressions translation-repo8072655
Ref: 24c58072655
Ref: reference/expressions grammar-token-python-grammar-name8072989
Ref: 24c68072989
Node: 算術変換 arithmetic conversion8074265
Ref: reference/expressions arithmetic-conversions8074391
Ref: 24c78074391
Ref: reference/expressions conversions8074391
Ref: 24c88074391
Node: アトム、原子的要素 atom8074972
Ref: reference/expressions atoms8075122
Ref: 24ca8075122
Ref: reference/expressions id28075122
Ref: 24cb8075122
Ref: reference/expressions grammar-token-python-grammar-atom8075435
Ref: 24cc8075435
Ref: reference/expressions grammar-token-python-grammar-enclosure8075612
Ref: 24ce8075612
Node: Built-in constants8076242
Ref: reference/expressions atom-singletons8076381
Ref: 24d58076381
Ref: reference/expressions built-in-constants8076381
Ref: 24d68076381
Node: 識別子 identifier、または名前 name8077028
Ref: reference/expressions atom-identifiers8077191
Ref: 23228077191
Ref: reference/expressions identifiers-names8077191
Ref: 24d88077191
Ref: reference/expressions private-name-mangling8077861
Ref: 20ff8077861
Node: Private name mangling8077897
Ref: reference/expressions id38077998
Ref: 24d98077998
Node: リテラル<2>8079777
Ref: reference/expressions atom-literals8079941
Ref: 24da8079941
Ref: reference/expressions literals8079941
Ref: 24db8079941
Ref: reference/expressions grammar-token-python-grammar-literal8081089
Ref: 24cd8081089
Node: Literals and object identity8081286
Ref: reference/expressions literals-and-object-identity8081419
Ref: 24df8081419
Node: 文字列リテラルの結合 concatenation8083234
Ref: reference/expressions string-concatenation8083367
Ref: 233c8083367
Ref: reference/expressions string-literal-concatenation8083367
Ref: 24e18083367
Ref: reference/expressions grammar-token-python-grammar-strings8084799
Ref: 24de8084799
Node: Parenthesized forms8084884
Ref: reference/expressions parenthesized8085045
Ref: 24e28085045
Ref: reference/expressions parenthesized-forms8085045
Ref: 24e38085045
Ref: reference/expressions grammar-token-python-grammar-parenth_form8085180
Ref: 24cf8085180
Node: Displays for lists sets and dictionaries8085940
Ref: reference/expressions comprehensions8086101
Ref: 7ec8086101
Ref: reference/expressions displays-for-lists-sets-and-dictionaries8086101
Ref: 24e58086101
Ref: reference/expressions grammar-token-python-grammar-comprehension8086543
Ref: 24e68086543
Ref: reference/expressions grammar-token-python-grammar-comp_for8086620
Ref: 24e78086620
Ref: reference/expressions grammar-token-python-grammar-comp_iter8086732
Ref: 24ea8086732
Ref: reference/expressions grammar-token-python-grammar-comp_if8086797
Ref: 24eb8086797
Ref: Displays for lists sets and dictionaries-Footnote-18089366
Node: リスト表示8089408
Ref: reference/expressions list-displays8089562
Ref: 24ec8089562
Ref: reference/expressions lists8089562
Ref: 24ed8089562
Ref: reference/expressions grammar-token-python-grammar-list_display8089693
Ref: 24d08089693
Node: 集合表示8090174
Ref: reference/expressions set8090300
Ref: 24ef8090300
Ref: reference/expressions set-displays8090300
Ref: 24f08090300
Ref: reference/expressions grammar-token-python-grammar-set_display8090478
Ref: 24d28090478
Node: 辞書表示8091045
Ref: reference/expressions dict8091180
Ref: f838091180
Ref: reference/expressions dictionary-displays8091180
Ref: 24f18091180
Ref: reference/expressions grammar-token-python-grammar-dict_display8091328
Ref: 24d18091328
Ref: reference/expressions grammar-token-python-grammar-dict_item_list8091425
Ref: 24f28091425
Ref: reference/expressions grammar-token-python-grammar-dict_item8091509
Ref: 24f48091509
Ref: reference/expressions grammar-token-python-grammar-dict_comprehension8091612
Ref: 24f38091612
Ref: 辞書表示-Footnote-18093555
Ref: 辞書表示-Footnote-28093597
Node: ジェネレータ式<2>8093639
Ref: reference/expressions generator-expressions8093771
Ref: 24f58093771
Ref: reference/expressions genexpr8093771
Ref: 24f68093771
Ref: reference/expressions grammar-token-python-grammar-generator_expression8097027
Ref: 24d38097027
Node: Yield 式8097608
Ref: reference/expressions yield-expressions8097719
Ref: 24f78097719
Ref: reference/expressions yieldexpr8097719
Ref: 24f88097719
Ref: reference/expressions grammar-token-python-grammar-yield_atom8097757
Ref: 24d48097757
Ref: reference/expressions grammar-token-python-grammar-yield_from8097818
Ref: 24f98097818
Ref: reference/expressions grammar-token-python-grammar-yield_expression8097879
Ref: 235f8097879
Ref: Yield 式-Footnote-18103541
Ref: Yield 式-Footnote-28103583
Ref: Yield 式-Footnote-38103625
Ref: Yield 式-Footnote-48103667
Ref: Yield 式-Footnote-58103709
Node: ジェネレータ-イテレータメソッド8103751
Ref: reference/expressions generator-iterator-methods8103861
Ref: 24fd8103861
Ref: reference/expressions generator-methods8103861
Ref: 24788103861
Ref: reference/expressions generator __next__8104315
Ref: 21098104315
Ref: reference/expressions generator send8105108
Ref: 12718105108
Ref: reference/expressions generator throw8105768
Ref: 71c8105768
Ref: reference/expressions generator close8107127
Ref: 18028107127
Node: 使用例8108133
Ref: reference/expressions examples8108320
Ref: 24fe8108320
Node: 非同期ジェネレータ関数 asynchronous generator function<2>8109431
Ref: reference/expressions asynchronous-generator-functions8109626
Ref: 24fc8109626
Ref: reference/expressions id48109626
Ref: 24ff8109626
Ref: 非同期ジェネレータ関数 asynchronous generator function<2>-Footnote-18113624
Node: 非同期ジェネレータイテレータメソッド8113704
Ref: reference/expressions asynchronous-generator-iterator-methods8113881
Ref: 25018113881
Ref: reference/expressions asynchronous-generator-methods8113881
Ref: 25028113881
Ref: reference/expressions agen __anext__8114157
Ref: 25008114157
Ref: reference/expressions agen asend8115113
Ref: ada8115113
Ref: reference/expressions agen athrow8115962
Ref: 71d8115962
Ref: reference/expressions agen aclose8116859
Ref: ad98116859
Node: プライマリ8117858
Ref: reference/expressions id58117983
Ref: 25038117983
Ref: reference/expressions primaries8117983
Ref: 25048117983
Ref: reference/expressions grammar-token-python-grammar-primary8118150
Ref: 25058118150
Node: 属性参照8118359
Ref: reference/expressions attribute-references8118458
Ref: 25098118458
Ref: reference/expressions id68118458
Ref: 250a8118458
Ref: reference/expressions grammar-token-python-grammar-attributeref8118590
Ref: 25068118590
Node: Subscriptions and slicings8119404
Ref: reference/expressions subscriptions8119529
Ref: 242e8119529
Ref: reference/expressions subscriptions-and-slicings8119529
Ref: 250b8119529
Node: スライス表記 slicing8122234
Ref: reference/expressions id78122358
Ref: 250c8122358
Ref: reference/expressions slicings8122358
Ref: 250d8122358
Node: Comma-separated subscripts8123879
Ref: reference/expressions comma-separated-subscripts8124035
Ref: 250f8124035
Node: "Starred" subscriptions8124885
Ref: reference/expressions starred-subscriptions8125042
Ref: 25108125042
Ref: "Starred" subscriptions-Footnote-18125754
Node: Formal subscription grammar8125796
Ref: reference/expressions formal-subscription-grammar8125918
Ref: 25118125918
Ref: reference/expressions grammar-token-python-grammar-subscription8125991
Ref: 25078125991
Ref: reference/expressions grammar-token-python-grammar-subscript8126066
Ref: 25128126066
Ref: reference/expressions grammar-token-python-grammar-single_subscript8126150
Ref: 25138126150
Ref: reference/expressions grammar-token-python-grammar-proper_slice8126236
Ref: 25158126236
Ref: reference/expressions grammar-token-python-grammar-tuple_subscript8126346
Ref: 25148126346
Node: 呼び出し call8126634
Ref: reference/expressions calls8126738
Ref: f818126738
Ref: reference/expressions id88126738
Ref: 25168126738
Ref: reference/expressions grammar-token-python-grammar-call8127006
Ref: 25088127006
Ref: reference/expressions grammar-token-python-grammar-argument_list8127126
Ref: 25188127126
Ref: reference/expressions grammar-token-python-grammar-positional_arguments8127456
Ref: 25198127456
Ref: reference/expressions grammar-token-python-grammar-positional_item8127548
Ref: 251c8127548
Ref: reference/expressions grammar-token-python-grammar-starred_and_keywords8127639
Ref: 251a8127639
Ref: reference/expressions grammar-token-python-grammar-keywords_arguments8127816
Ref: 251b8127816
Ref: reference/expressions grammar-token-python-grammar-keyword_item8127995
Ref: 251d8127995
Ref: 呼び出し call-Footnote-18136326
Node: Await 式8136368
Ref: reference/expressions await8136491
Ref: 18e8136491
Ref: reference/expressions await-expression8136491
Ref: 251e8136491
Ref: reference/expressions grammar-token-python-grammar-await_expr8136693
Ref: 251f8136693
Node: べき乗演算 power operator8136763
Ref: reference/expressions power8136952
Ref: 25208136952
Ref: reference/expressions the-power-operator8136952
Ref: 25218136952
Ref: reference/expressions grammar-token-python-grammar-power8137268
Ref: 25228137268
Node: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation8138675
Ref: reference/expressions unary8138901
Ref: 24dc8138901
Ref: reference/expressions unary-arithmetic-and-bitwise-operations8138901
Ref: 25248138901
Ref: reference/expressions grammar-token-python-grammar-u_expr8139167
Ref: 25238139167
Node: 二項算術演算 binary arithmetic operation8139993
Ref: reference/expressions binary8140223
Ref: 24dd8140223
Ref: reference/expressions binary-arithmetic-operations8140223
Ref: 25258140223
Ref: reference/expressions grammar-token-python-grammar-m_expr8140689
Ref: 25268140689
Ref: reference/expressions grammar-token-python-grammar-a_expr8140979
Ref: 25278140979
Ref: 二項算術演算 binary arithmetic operation-Footnote-18145305
Ref: 二項算術演算 binary arithmetic operation-Footnote-28146119
Node: シフト演算 shifting operation8146464
Ref: reference/expressions shifting8146674
Ref: 25298146674
Ref: reference/expressions shifting-operations8146674
Ref: 252a8146674
Ref: reference/expressions grammar-token-python-grammar-shift_expr8146840
Ref: 252b8146840
Node: ビット単位演算の二項演算 binary bitwise operation8147611
Ref: reference/expressions binary-bitwise-operations8147781
Ref: 252c8147781
Ref: reference/expressions bitwise8147781
Ref: 252d8147781
Ref: reference/expressions grammar-token-python-grammar-and_expr8148018
Ref: 252e8148018
Ref: reference/expressions grammar-token-python-grammar-xor_expr8148109
Ref: 252f8148109
Ref: reference/expressions grammar-token-python-grammar-or_expr8148196
Ref: 235e8148196
Node: 比較8148916
Ref: reference/expressions comparisons8149085
Ref: 25308149085
Ref: reference/expressions id118149085
Ref: 25318149085
Ref: reference/expressions grammar-token-python-grammar-comparison8149450
Ref: 25328149450
Ref: reference/expressions grammar-token-python-grammar-comp_operator8149542
Ref: 25338149542
Node: 値の比較8150886
Ref: reference/expressions expressions-value-comparisons8150968
Ref: 1c7d8150968
Ref: reference/expressions value-comparisons8150968
Ref: 25348150968
Ref: reference/expressions in8160294
Ref: 3498160294
Ref: reference/expressions not-in8160294
Ref: 8418160294
Ref: 値の比較-Footnote-18160332
Ref: 値の比較-Footnote-28160374
Node: 所属検査演算8161791
Ref: reference/expressions membership-test-details8161900
Ref: 24468161900
Ref: reference/expressions membership-test-operations8161900
Ref: 25358161900
Ref: reference/expressions is8164074
Ref: 34a8164074
Node: 同一性の比較8164074
Ref: reference/expressions identity-comparisons8164162
Ref: 25368164162
Ref: reference/expressions is-not8164162
Ref: 25378164162
Ref: reference/expressions booleans8164645
Ref: 25388164645
Ref: reference/expressions and8164645
Ref: 3478164645
Ref: reference/expressions or8164645
Ref: 34b8164645
Ref: 同一性の比較-Footnote-18164683
Node: ブール演算 boolean operation8165082
Ref: reference/expressions boolean-operations8165202
Ref: 25398165202
Ref: reference/expressions not8165202
Ref: 253a8165202
Ref: reference/expressions grammar-token-python-grammar-or_test8165284
Ref: 24e98165284
Ref: reference/expressions grammar-token-python-grammar-and_test8165371
Ref: 253b8165371
Ref: reference/expressions grammar-token-python-grammar-not_test8165460
Ref: 253c8165460
Node: 代入式<2>8167051
Ref: reference/expressions assignment-expressions8167198
Ref: 253d8167198
Ref: reference/expressions id148167198
Ref: 253e8167198
Ref: reference/expressions grammar-token-python-grammar-assignment_expression8167230
Ref: 248d8167230
Ref: 代入式<2>-Footnote-18168309
Node: 条件式 Conditional Expressions8168351
Ref: reference/expressions conditional-expressions8168481
Ref: 253f8168481
Ref: reference/expressions if-expr8168481
Ref: 17e8168481
Ref: reference/expressions grammar-token-python-grammar-conditional_expression8168565
Ref: 235d8168565
Ref: reference/expressions grammar-token-python-grammar-expression8168673
Ref: 1838168673
Ref: reference/expressions lambdas8169269
Ref: 25418169269
Ref: 条件式 Conditional Expressions-Footnote-18169307
Node: ラムダ lambda8169349
Ref: reference/expressions id158169482
Ref: 25428169482
Ref: reference/expressions lambda8169482
Ref: 14b98169482
Ref: reference/expressions grammar-token-python-grammar-lambda_expr8169532
Ref: 25408169532
Node: 式のリスト8170198
Ref: reference/expressions expression-lists8170310
Ref: 25448170310
Ref: reference/expressions exprlists8170310
Ref: f828170310
Ref: reference/expressions grammar-token-python-grammar-starred_expression8170352
Ref: 24e48170352
Ref: reference/expressions grammar-token-python-grammar-flexible_expression8170433
Ref: 25458170433
Ref: reference/expressions grammar-token-python-grammar-flexible_expression_list8170533
Ref: 24ee8170533
Ref: reference/expressions grammar-token-python-grammar-starred_expression_list8170643
Ref: 25468170643
Ref: reference/expressions grammar-token-python-grammar-expression_list8170751
Ref: 25478170751
Ref: reference/expressions grammar-token-python-grammar-yield_list8170841
Ref: 24fa8170841
Ref: 式のリスト-Footnote-18172053
Ref: 式のリスト-Footnote-28172095
Node: 評価順序8172137
Ref: reference/expressions evalorder8172257
Ref: 25488172257
Ref: reference/expressions evaluation-order8172257
Ref: 25498172257
Node: 演算子の優先順位8172779
Ref: reference/expressions operator-precedence8172875
Ref: 254a8172875
Ref: reference/expressions operator-summary8172875
Ref: 254b8172875
Ref: 演算子の優先順位-Footnote-18177540
Ref: 演算子の優先順位-Footnote-28177760
Node: 単純文 simple statement8177880
Ref: reference/simple_stmts doc8178034
Ref: 254c8178034
Ref: reference/simple_stmts simple8178034
Ref: 254d8178034
Ref: reference/simple_stmts simple-statements8178034
Ref: 254e8178034
Ref: reference/simple_stmts translation-repo8178034
Ref: 254f8178034
Ref: reference/simple_stmts grammar-token-python-grammar-simple_stmt8178322
Ref: 25508178322
Node: 式文 expression statement8179463
Ref: reference/simple_stmts expression-statements8179592
Ref: 25628179592
Ref: reference/simple_stmts exprstmts8179592
Ref: 25638179592
Ref: reference/simple_stmts grammar-token-python-grammar-expression_stmt8180110
Ref: 25518180110
Node: 代入文 assignment statement8180614
Ref: reference/simple_stmts assignment8180762
Ref: 24878180762
Ref: reference/simple_stmts assignment-statements8180762
Ref: 25648180762
Ref: reference/simple_stmts grammar-token-python-grammar-assignment_stmt8180996
Ref: 25538180996
Ref: reference/simple_stmts grammar-token-python-grammar-target_list8181116
Ref: 24e88181116
Ref: reference/simple_stmts grammar-token-python-grammar-target8181191
Ref: 25658181191
Ref: reference/simple_stmts attr-target-note8185624
Ref: 25668185624
Ref: 代入文 assignment statement-Footnote-18189982
Node: 累算代入文 augmented assignment statement8190024
Ref: reference/simple_stmts augassign8190199
Ref: 25678190199
Ref: reference/simple_stmts augmented-assignment-statements8190199
Ref: 25688190199
Ref: reference/simple_stmts grammar-token-python-grammar-augmented_assignment_stmt8190411
Ref: 25548190411
Ref: reference/simple_stmts grammar-token-python-grammar-augtarget8190548
Ref: 25698190548
Ref: reference/simple_stmts grammar-token-python-grammar-augop8190660
Ref: 256a8190660
Node: 注釈付き代入文 annotated assignment statements8192468
Ref: reference/simple_stmts annassign8192643
Ref: 256b8192643
Ref: reference/simple_stmts annotated-assignment-statements8192643
Ref: 256c8192643
Ref: reference/simple_stmts grammar-token-python-grammar-annotated_assignment_stmt8192922
Ref: 25558192922
Ref: 注釈付き代入文 annotated assignment statements-Footnote-18195226
Ref: 注釈付き代入文 annotated assignment statements-Footnote-28195268
Node: assert 文8195310
Ref: reference/simple_stmts assert8195442
Ref: b648195442
Ref: reference/simple_stmts the-assert-statement8195442
Ref: 256d8195442
Ref: reference/simple_stmts grammar-token-python-grammar-assert_stmt8195625
Ref: 25528195625
Node: pass 文<2>8196769
Ref: reference/simple_stmts pass8196881
Ref: 17f8196881
Ref: reference/simple_stmts the-pass-statement8196881
Ref: 256e8196881
Ref: reference/simple_stmts grammar-token-python-grammar-pass_stmt8196919
Ref: 25568196919
Node: del 文<2>8197356
Ref: reference/simple_stmts del8197468
Ref: 1b7e8197468
Ref: reference/simple_stmts the-del-statement8197468
Ref: 256f8197468
Ref: reference/simple_stmts grammar-token-python-grammar-del_stmt8197504
Ref: 25578197504
Node: return 文8198645
Ref: reference/simple_stmts return8198755
Ref: 1b08198755
Ref: reference/simple_stmts the-return-statement8198755
Ref: 25708198755
Ref: reference/simple_stmts grammar-token-python-grammar-return_stmt8198797
Ref: 25588198797
Node: yield 文8200114
Ref: reference/simple_stmts the-yield-statement8200223
Ref: 25718200223
Ref: reference/simple_stmts yield8200223
Ref: bc68200223
Ref: reference/simple_stmts grammar-token-python-grammar-yield_stmt8200263
Ref: 25598200263
Node: raise 文8201126
Ref: reference/simple_stmts raise8201234
Ref: 8038201234
Ref: reference/simple_stmts the-raise-statement8201234
Ref: 25728201234
Ref: reference/simple_stmts grammar-token-python-grammar-raise_stmt8201274
Ref: 255a8201274
Node: break 文8205645
Ref: reference/simple_stmts break8205756
Ref: 1808205756
Ref: reference/simple_stmts the-break-statement8205756
Ref: 25758205756
Ref: reference/simple_stmts grammar-token-python-grammar-break_stmt8205796
Ref: 255b8205796
Node: continue 文8206602
Ref: reference/simple_stmts continue8206714
Ref: 1818206714
Ref: reference/simple_stmts the-continue-statement8206714
Ref: 25768206714
Ref: reference/simple_stmts grammar-token-python-grammar-continue_stmt8206762
Ref: 255c8206762
Ref: reference/simple_stmts import8207318
Ref: 7f88207318
Node: import 文8207320
Ref: reference/simple_stmts from8207433
Ref: 14c78207433
Ref: reference/simple_stmts the-import-statement8207433
Ref: 25778207433
Ref: reference/simple_stmts grammar-token-python-grammar-import_stmt8207477
Ref: 255d8207477
Ref: reference/simple_stmts grammar-token-python-grammar-module8208120
Ref: 25788208120
Ref: reference/simple_stmts grammar-token-python-grammar-relative_module8208197
Ref: 25798208197
Ref: reference/simple_stmts module __all__8212405
Ref: f3f8212405
Ref: import 文-Footnote-18215254
Node: future 文 future statement8215311
Ref: reference/simple_stmts future8215385
Ref: 45b8215385
Ref: reference/simple_stmts future-statements8215385
Ref: 257a8215385
Ref: reference/simple_stmts grammar-token-python-grammar-future_stmt8216028
Ref: 255e8216028
Ref: reference/simple_stmts grammar-token-python-grammar-feature8216396
Ref: 257b8216396
Ref: future 文 future statement-Footnote-18219860
Ref: future 文 future statement-Footnote-28219902
Node: global 文8219944
Ref: reference/simple_stmts global8220057
Ref: 4ac8220057
Ref: reference/simple_stmts the-global-statement8220057
Ref: 257c8220057
Ref: reference/simple_stmts grammar-token-python-grammar-global_stmt8220101
Ref: 255f8220101
Node: nonlocal 文8221622
Ref: reference/simple_stmts nonlocal8221743
Ref: 14c38221743
Ref: reference/simple_stmts the-nonlocal-statement8221743
Ref: 257d8221743
Ref: reference/simple_stmts grammar-token-python-grammar-nonlocal_stmt8221791
Ref: 25608221791
Ref: nonlocal 文-Footnote-18222971
Node: The type statement8223013
Ref: reference/simple_stmts the-type-statement8223115
Ref: 257e8223115
Ref: reference/simple_stmts type8223115
Ref: 66d8223115
Ref: reference/simple_stmts grammar-token-python-grammar-type_stmt8223176
Ref: 25618223176
Ref: The type statement-Footnote-18224494
Node: 複合文 compound statement8224536
Ref: reference/compound_stmts doc8224700
Ref: 25808224700
Ref: reference/compound_stmts compound8224700
Ref: 25818224700
Ref: reference/compound_stmts compound-statements8224700
Ref: 25828224700
Ref: reference/compound_stmts translation-repo8224700
Ref: 25838224700
Ref: reference/compound_stmts grammar-token-python-grammar-compound_stmt8226876
Ref: 25848226876
Ref: reference/compound_stmts grammar-token-python-grammar-suite8227379
Ref: 25908227379
Ref: reference/compound_stmts grammar-token-python-grammar-statement8227478
Ref: 25928227478
Ref: reference/compound_stmts grammar-token-python-grammar-stmt_list8227558
Ref: 25918227558
Ref: reference/compound_stmts if8228200
Ref: 1828228200
Ref: reference/compound_stmts elif8228200
Ref: 17c8228200
Node: if 文<2>8228453
Ref: reference/compound_stmts else8228545
Ref: 17d8228545
Ref: reference/compound_stmts the-if-statement8228545
Ref: 25938228545
Ref: reference/compound_stmts grammar-token-python-grammar-if_stmt8228657
Ref: 25858228657
Node: while 文8229408
Ref: reference/compound_stmts the-while-statement8229519
Ref: 25948229519
Ref: reference/compound_stmts while8229519
Ref: 19d38229519
Ref: reference/compound_stmts grammar-token-python-grammar-while_stmt8229666
Ref: 25868229666
Node: for 文<2>8230437
Ref: reference/compound_stmts for8230546
Ref: 3488230546
Ref: reference/compound_stmts the-for-statement8230546
Ref: 25958230546
Ref: reference/compound_stmts grammar-token-python-grammar-for_stmt8230809
Ref: 25878230809
Node: try 文8232895
Ref: reference/compound_stmts the-try-statement8233003
Ref: 25968233003
Ref: reference/compound_stmts try8233003
Ref: 8f98233003
Ref: reference/compound_stmts grammar-token-python-grammar-try_stmt8233177
Ref: 25888233177
Ref: reference/compound_stmts grammar-token-python-grammar-try1_stmt8233266
Ref: 25978233266
Ref: reference/compound_stmts grammar-token-python-grammar-try2_stmt8233517
Ref: 25988233517
Ref: reference/compound_stmts grammar-token-python-grammar-try3_stmt8233770
Ref: 25998233770
Ref: try 文-Footnote-18234326
Node: except 節8234368
Ref: reference/compound_stmts except8234442
Ref: 1ac8234442
Ref: reference/compound_stmts except-clause8234442
Ref: 259a8234442
Ref: except 節-Footnote-18238345
Node: except* 節8238560
Ref: reference/compound_stmts except-star8238651
Ref: 1ad8238651
Ref: reference/compound_stmts id28238651
Ref: 259b8238651
Node: else 節8241654
Ref: reference/compound_stmts else-clause8241746
Ref: 259c8241746
Ref: reference/compound_stmts except-else8241746
Ref: 259d8241746
Node: finally 節8242185
Ref: reference/compound_stmts finally8242257
Ref: 1b18242257
Ref: reference/compound_stmts finally-clause8242257
Ref: 259e8242257
Ref: reference/compound_stmts with8244211
Ref: 1878244211
Ref: finally 節-Footnote-18244247
Node: with 文8244289
Ref: reference/compound_stmts as8244399
Ref: 259f8244399
Ref: reference/compound_stmts the-with-statement8244399
Ref: 25a08244399
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt8244891
Ref: 25898244891
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt_contents8245029
Ref: 25a18245029
Ref: reference/compound_stmts grammar-token-python-grammar-with_item8245107
Ref: 25a28245107
Ref: reference/compound_stmts match8248928
Ref: a128248928
Ref: with 文-Footnote-18248964
Node: match 文<2>8249006
Ref: reference/compound_stmts case8249121
Ref: 17788249121
Ref: reference/compound_stmts the-match-statement8249121
Ref: 25a38249121
Ref: reference/compound_stmts grammar-token-python-grammar-match_stmt8249270
Ref: 258a8249270
Ref: reference/compound_stmts grammar-token-python-grammar-subject_expr8249374
Ref: 25a48249374
Ref: reference/compound_stmts grammar-token-python-grammar-case_block8249532
Ref: 25a58249532
Ref: match 文<2>-Footnote-18250702
Ref: match 文<2>-Footnote-28250744
Node: 概要8250786
Ref: reference/compound_stmts overview8250862
Ref: 25a88250862
Node: ガード<2>8254143
Ref: reference/compound_stmts guards8254267
Ref: 25aa8254267
Ref: reference/compound_stmts grammar-token-python-grammar-guard8254301
Ref: 25a78254301
Node: 論駁不可能なケースブロック8255861
Ref: reference/compound_stmts irrefutable-case8255991
Ref: 25ab8255991
Ref: reference/compound_stmts irrefutable-case-blocks8255991
Ref: 25ac8255991
Node: パターン8257072
Ref: reference/compound_stmts patterns8257181
Ref: 25b08257181
Ref: reference/compound_stmts grammar-token-python-grammar-patterns8257558
Ref: 25a68257558
Ref: reference/compound_stmts grammar-token-python-grammar-pattern8257637
Ref: 25b28257637
Ref: reference/compound_stmts grammar-token-python-grammar-closed_pattern8257708
Ref: 25b58257708
Node: OR パターン8258955
Ref: reference/compound_stmts id38259043
Ref: 25be8259043
Ref: reference/compound_stmts or-patterns8259043
Ref: 25ae8259043
Ref: reference/compound_stmts grammar-token-python-grammar-or_pattern8259194
Ref: 25b48259194
Node: AS パターン8260144
Ref: reference/compound_stmts as-patterns8260265
Ref: 25ad8260265
Ref: reference/compound_stmts id48260265
Ref: 25bf8260265
Ref: reference/compound_stmts grammar-token-python-grammar-as_pattern8260468
Ref: 25b38260468
Node: リテラルパターン8261009
Ref: reference/compound_stmts id58261142
Ref: 25c08261142
Ref: reference/compound_stmts literal-patterns8261142
Ref: 25c18261142
Ref: reference/compound_stmts grammar-token-python-grammar-literal_pattern8261316
Ref: 25b68261316
Ref: reference/compound_stmts grammar-token-python-grammar-signed_number8261628
Ref: 25c28261628
Node: キャプチャパターン8262438
Ref: reference/compound_stmts capture-patterns8262589
Ref: 25af8262589
Ref: reference/compound_stmts id68262589
Ref: 25c48262589
Ref: reference/compound_stmts grammar-token-python-grammar-capture_pattern8262747
Ref: 25b78262747
Ref: キャプチャパターン-Footnote-18263749
Node: ワイルドカードパターン8263791
Ref: reference/compound_stmts id78263933
Ref: 25c58263933
Ref: reference/compound_stmts wildcard-patterns8263933
Ref: a138263933
Ref: reference/compound_stmts grammar-token-python-grammar-wildcard_pattern8264142
Ref: 25b88264142
Node: 値パターン8264563
Ref: reference/compound_stmts id88264702
Ref: 25c68264702
Ref: reference/compound_stmts value-patterns8264702
Ref: 25c78264702
Ref: reference/compound_stmts grammar-token-python-grammar-value_pattern8264832
Ref: 25b98264832
Ref: reference/compound_stmts grammar-token-python-grammar-attr8264870
Ref: 25c88264870
Ref: reference/compound_stmts grammar-token-python-grammar-name_or_attr8264925
Ref: 25c98264925
Node: グループパターン8265737
Ref: reference/compound_stmts group-patterns8265870
Ref: 25ca8265870
Ref: reference/compound_stmts id98265870
Ref: 25cb8265870
Ref: reference/compound_stmts grammar-token-python-grammar-group_pattern8266082
Ref: 25ba8266082
Node: シーケンスパターン8266191
Ref: reference/compound_stmts id108266336
Ref: 25cc8266336
Ref: reference/compound_stmts sequence-patterns8266336
Ref: 25cd8266336
Ref: reference/compound_stmts grammar-token-python-grammar-sequence_pattern8266552
Ref: 25bb8266552
Ref: reference/compound_stmts grammar-token-python-grammar-open_sequence_pattern8266703
Ref: 25b18266703
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_sequence_pattern8266806
Ref: 25ce8266806
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_star_pattern8266877
Ref: 25cf8266877
Ref: reference/compound_stmts grammar-token-python-grammar-star_pattern8266955
Ref: 25d08266955
Ref: シーケンスパターン-Footnote-18270004
Node: マッピングパターン8270725
Ref: reference/compound_stmts id128270867
Ref: 25d18270867
Ref: reference/compound_stmts mapping-patterns8270867
Ref: 25d28270867
Ref: reference/compound_stmts grammar-token-python-grammar-mapping_pattern8271062
Ref: 25bc8271062
Ref: reference/compound_stmts grammar-token-python-grammar-items_pattern8271125
Ref: 25d38271125
Ref: reference/compound_stmts grammar-token-python-grammar-key_value_pattern8271192
Ref: 25d48271192
Ref: reference/compound_stmts grammar-token-python-grammar-double_star_pattern8271364
Ref: 25d58271364
Ref: マッピングパターン-Footnote-18273015
Node: クラスパターン8273489
Ref: reference/compound_stmts class-patterns8273595
Ref: 25d68273595
Ref: reference/compound_stmts id148273595
Ref: 25d78273595
Ref: reference/compound_stmts grammar-token-python-grammar-class_pattern8273747
Ref: 25bd8273747
Ref: reference/compound_stmts grammar-token-python-grammar-pattern_arguments8273845
Ref: 25d88273845
Ref: reference/compound_stmts grammar-token-python-grammar-positional_patterns8273998
Ref: 25d98273998
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_patterns8274050
Ref: 25da8274050
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_pattern8274110
Ref: 25db8274110
Ref: reference/compound_stmts function8278180
Ref: 20748278180
Ref: クラスパターン-Footnote-18278216
Ref: クラスパターン-Footnote-28278258
Node: 関数定義8278300
Ref: reference/compound_stmts def8278422
Ref: 16788278422
Ref: reference/compound_stmts function-definitions8278422
Ref: 25dc8278422
Ref: reference/compound_stmts grammar-token-python-grammar-funcdef8278579
Ref: 258b8278579
Ref: reference/compound_stmts grammar-token-python-grammar-decorators8278815
Ref: 25dd8278815
Ref: reference/compound_stmts grammar-token-python-grammar-decorator8278871
Ref: 25df8278871
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list8278950
Ref: 25438278950
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_no_posonly8279171
Ref: 25e18279171
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_starargs8279378
Ref: 25e28279378
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_star_kwargs8279703
Ref: 25e48279703
Ref: reference/compound_stmts grammar-token-python-grammar-parameter8279769
Ref: 25e58279769
Ref: reference/compound_stmts grammar-token-python-grammar-star_parameter8279854
Ref: 25e38279854
Ref: reference/compound_stmts grammar-token-python-grammar-defparameter8279945
Ref: 25e08279945
Ref: reference/compound_stmts grammar-token-python-grammar-funcname8280029
Ref: 25de8280029
Ref: 関数定義-Footnote-18287759
Ref: 関数定義-Footnote-28287956
Ref: 関数定義-Footnote-38287998
Ref: 関数定義-Footnote-48288040
Ref: 関数定義-Footnote-58288082
Ref: 関数定義-Footnote-68288124
Ref: 関数定義-Footnote-78288166
Ref: 関数定義-Footnote-88288208
Ref: 関数定義-Footnote-98288250
Ref: 関数定義-Footnote-108288292
Node: クラス定義8288335
Ref: reference/compound_stmts class8288463
Ref: 14f38288463
Ref: reference/compound_stmts class-definitions8288463
Ref: 25e78288463
Ref: reference/compound_stmts grammar-token-python-grammar-classdef8288616
Ref: 258c8288616
Ref: reference/compound_stmts grammar-token-python-grammar-inheritance8288768
Ref: 25e98288768
Ref: reference/compound_stmts grammar-token-python-grammar-classname8288823
Ref: 25e88288823
Ref: クラス定義-Footnote-18292793
Ref: クラス定義-Footnote-28292980
Ref: クラス定義-Footnote-38293022
Ref: クラス定義-Footnote-48293064
Ref: クラス定義-Footnote-58293106
Node: コルーチン<2>8293148
Ref: reference/compound_stmts async8293284
Ref: 93f8293284
Ref: reference/compound_stmts coroutines8293284
Ref: 25ea8293284
Node: コルーチン関数定義8293426
Ref: reference/compound_stmts async-def8293530
Ref: 7ed8293530
Ref: reference/compound_stmts coroutine-function-definition8293530
Ref: 25eb8293530
Ref: reference/compound_stmts grammar-token-python-grammar-async_funcdef8293594
Ref: 258f8293594
Node: async for 文8294616
Ref: reference/compound_stmts async-for8294743
Ref: ca58294743
Ref: reference/compound_stmts the-async-for-statement8294743
Ref: 25ec8294743
Ref: reference/compound_stmts grammar-token-python-grammar-async_for_stmt8294795
Ref: 258e8294795
Node: async with 文8295838
Ref: reference/compound_stmts async-with8295929
Ref: 1868295929
Ref: reference/compound_stmts the-async-with-statement8295929
Ref: 25ed8295929
Ref: reference/compound_stmts grammar-token-python-grammar-async_with_stmt8295983
Ref: 258d8295983
Ref: async with 文-Footnote-18297201
Node: Type parameter lists8297243
Ref: reference/compound_stmts type-parameter-lists8297378
Ref: 25ee8297378
Ref: reference/compound_stmts type-params8297378
Ref: 5ad8297378
Ref: reference/compound_stmts grammar-token-python-grammar-type_params8297547
Ref: 257f8297547
Ref: reference/compound_stmts grammar-token-python-grammar-type_param8297629
Ref: 25ef8297629
Ref: reference/compound_stmts grammar-token-python-grammar-typevar8297722
Ref: 25f08297722
Ref: reference/compound_stmts grammar-token-python-grammar-typevartuple8297825
Ref: 25f18297825
Ref: reference/compound_stmts grammar-token-python-grammar-paramspec8297902
Ref: 25f28297902
Ref: Type parameter lists-Footnote-18302280
Node: Generic functions8302322
Ref: reference/compound_stmts generic-functions8302420
Ref: 6828302420
Ref: reference/compound_stmts id178302420
Ref: 25f48302420
Node: Generic classes8304224
Ref: reference/compound_stmts generic-classes8304351
Ref: 23d38304351
Ref: reference/compound_stmts id188304351
Ref: 25f58304351
Node: Generic type aliases8305493
Ref: reference/compound_stmts generic-type-aliases8305594
Ref: 6848305594
Ref: reference/compound_stmts id198305594
Ref: 25f68305594
Node: Annotations<2>8306398
Ref: reference/compound_stmts annotations8306506
Ref: 25e68306506
Ref: reference/compound_stmts id208306506
Ref: 25f78306506
Ref: Annotations<2>-Footnote-18308354
Node: トップレベル要素8308396
Ref: reference/toplevel_components doc8308555
Ref: 25f88308555
Ref: reference/toplevel_components top-level8308555
Ref: 25f98308555
Ref: reference/toplevel_components top-level-components8308555
Ref: 25fa8308555
Ref: reference/toplevel_components translation-repo8308555
Ref: 25fb8308555
Node: 完全な Python プログラム8309088
Ref: reference/toplevel_components complete-python-programs8309208
Ref: 25fc8309208
Ref: reference/toplevel_components programs8309208
Ref: 24b28309208
Node: ファイル入力8311182
Ref: reference/toplevel_components file-input8311326
Ref: 25fd8311326
Ref: reference/toplevel_components id18311326
Ref: 25fe8311326
Ref: reference/toplevel_components grammar-token-python-grammar-file_input8311455
Ref: 25ff8311455
Node: 対話的入力8311825
Ref: reference/toplevel_components interactive8311946
Ref: 26008311946
Ref: reference/toplevel_components interactive-input8311946
Ref: 26018311946
Ref: reference/toplevel_components grammar-token-python-grammar-interactive_input8312070
Ref: 26028312070
Node: 式入力8312429
Ref: reference/toplevel_components expression-input8312523
Ref: 26038312523
Ref: reference/toplevel_components id28312523
Ref: 26048312523
Ref: reference/toplevel_components grammar-token-python-grammar-eval_input8312756
Ref: 26058312756
Node: 完全な文法仕様8312822
Ref: reference/grammar doc8312944
Ref: 25c38312944
Ref: reference/grammar full-grammar-specification8312944
Ref: 26068312944
Ref: reference/grammar id18312944
Ref: 26078312944
Ref: reference/grammar translation-repo8312944
Ref: 26088312944
Ref: 完全な文法仕様-Footnote-18392404
Node: Python 標準ライブラリ8392476
Ref: library/index doc8392642
Ref: 26098392642
Ref: library/index library-index8392642
Ref: 14a8392642
Ref: library/index the-python-standard-library8392642
Ref: 260a8392642
Ref: library/index translation-repo8392642
Ref: 260b8392642
Ref: Python 標準ライブラリ-Footnote-18396366
Node: はじめに<6>8396391
Ref: library/intro doc8396498
Ref: 260c8396498
Ref: library/intro introduction8396498
Ref: 260d8396498
Ref: library/intro library-intro8396498
Ref: 260e8396498
Node: 利用可能性について8400504
Ref: library/intro availability8400583
Ref: 21998400583
Ref: library/intro notes-on-availability8400583
Ref: 260f8400583
Node: WebAssembly プラットフォーム8401573
Ref: library/intro wasm-availability8401718
Ref: 1bc98401718
Ref: library/intro webassembly-platforms8401718
Ref: 26108401718
Ref: library/intro mobile-availability8404824
Ref: 22b88404824
Ref: WebAssembly プラットフォーム-Footnote-18404861
Ref: WebAssembly プラットフォーム-Footnote-28404894
Ref: WebAssembly プラットフォーム-Footnote-38404926
Ref: WebAssembly プラットフォーム-Footnote-48404952
Ref: WebAssembly プラットフォーム-Footnote-58404984
Ref: WebAssembly プラットフォーム-Footnote-68405010
Ref: WebAssembly プラットフォーム-Footnote-78405040
Ref: WebAssembly プラットフォーム-Footnote-88405069
Ref: WebAssembly プラットフォーム-Footnote-98405099
Node: モバイルプラットフォーム8405159
Ref: library/intro ios-availability8405304
Ref: 26118405304
Ref: library/intro mobile-platforms8405304
Ref: 26128405304
Ref: モバイルプラットフォーム-Footnote-18408156
Node: 組み込み関数8408222
Ref: library/functions doc8408356
Ref: 26138408356
Ref: library/functions built-in-funcs8408356
Ref: 14788408356
Ref: library/functions built-in-functions8408356
Ref: 26148408356
Ref: library/functions translation-repo8408356
Ref: 26158408356
Ref: library/functions abs8411826
Ref: 20e98411826
Ref: library/functions aiter8412099
Ref: 9d98412099
Ref: library/functions all8412449
Ref: 16408412449
Ref: library/functions anext8412809
Ref: 9da8412809
Ref: library/functions any8413794
Ref: 163f8413794
Ref: library/functions ascii8414168
Ref: 16048414168
Ref: library/functions bin8414600
Ref: 14c48414600
Ref: library/functions bool8415595
Ref: 3c18415595
Ref: library/functions breakpoint8416460
Ref: 2738416460
Ref: library/functions func-bytearray8418112
Ref: 1ef78418112
Ref: library/functions func-bytes8419874
Ref: 1ef68419874
Ref: library/functions callable8420873
Ref: 13e28420873
Ref: library/functions chr8421663
Ref: 1a4e8421663
Ref: library/functions classmethod8422122
Ref: 48e8422122
Ref: library/functions compile8424328
Ref: 4b18424328
Ref: library/functions complex8429617
Ref: 1988429617
Ref: library/functions grammar-token-float-complexvalue8431241
Ref: 26288431241
Ref: library/functions delattr8433418
Ref: 26168433418
Ref: library/functions func-dict8433998
Ref: 26178433998
Ref: library/functions dir8434458
Ref: 8448434458
Ref: library/functions divmod8437768
Ref: b9d8437768
Ref: library/functions enumerate8438584
Ref: 169f8438584
Ref: library/functions func-eval8439656
Ref: 262c8439656
Ref: library/functions eval8439656
Ref: 4a38439656
Ref: library/functions exec8443171
Ref: 4a28443171
Ref: library/functions filter8447581
Ref: a688447581
Ref: library/functions float8448570
Ref: 1978448570
Ref: library/functions grammar-token-float-sign8449569
Ref: 262a8449569
Ref: library/functions grammar-token-float-infinity8449604
Ref: 262e8449604
Ref: library/functions grammar-token-float-nan8449648
Ref: 262f8449648
Ref: library/functions grammar-token-float-digit8449679
Ref: 26308449679
Ref: library/functions grammar-token-float-digitpart8449778
Ref: 26318449778
Ref: library/functions grammar-token-float-number8449850
Ref: 26328449850
Ref: library/functions grammar-token-float-exponent8449958
Ref: 26338449958
Ref: library/functions grammar-token-float-floatnumber8450038
Ref: 26348450038
Ref: library/functions grammar-token-float-absfloatvalue8450107
Ref: 262b8450107
Ref: library/functions grammar-token-float-floatvalue8450200
Ref: 26298450200
Ref: library/functions format8451718
Ref: 19a8451718
Ref: library/functions func-frozenset8452970
Ref: 26188452970
Ref: library/functions getattr8453471
Ref: dce8453471
Ref: library/functions globals8454675
Ref: 1c678454675
Ref: library/functions hasattr8454985
Ref: 6f98454985
Ref: library/functions hash8455406
Ref: 8018455406
Ref: library/functions help8456078
Ref: ad88456078
Ref: library/functions hex8457542
Ref: 14eb8457542
Ref: library/functions id8458800
Ref: 16418458800
Ref: library/functions input8459344
Ref: 14f48459344
Ref: library/functions int8460377
Ref: 19c8460377
Ref: library/functions isinstance8464592
Ref: 2af8464592
Ref: library/functions issubclass8465786
Ref: 9c88465786
Ref: library/functions iter8466406
Ref: 9db8466406
Ref: library/functions len8468252
Ref: 8408468252
Ref: library/functions func-list8468710
Ref: 26198468710
Ref: library/functions locals8469001
Ref: 46f8469001
Ref: library/functions map8472180
Ref: 1a08472180
Ref: library/functions max8473156
Ref: 11108473156
Ref: library/functions func-memoryview8474756
Ref: 261a8474756
Ref: library/functions min8474989
Ref: 110f8474989
Ref: library/functions next8476576
Ref: 9dc8476576
Ref: library/functions object8476996
Ref: c828476996
Ref: library/functions oct8477630
Ref: 14ea8477630
Ref: library/functions open8478584
Ref: 3188478584
Ref: library/functions filemodes8480736
Ref: 26388480736
Ref: library/functions open-newline-parameter8487333
Ref: 94c8487333
Ref: library/functions ord8493572
Ref: 23978493572
Ref: library/functions pow8494133
Ref: 1a58494133
Ref: library/functions print8496606
Ref: 117b8496606
Ref: library/functions property8498248
Ref: 4b38498248
Ref: library/functions property getter8500081
Ref: 1a388500081
Ref: library/functions property setter8500110
Ref: 1a398500110
Ref: library/functions property deleter8500139
Ref: 1a3a8500139
Ref: library/functions property __name__8501553
Ref: 4b28501553
Ref: library/functions func-range8501736
Ref: 261b8501736
Ref: library/functions repr8502058
Ref: 1c38502058
Ref: library/functions reversed8503236
Ref: a698503236
Ref: library/functions round8503704
Ref: 14f68503704
Ref: library/functions func-set8505315
Ref: 261c8505315
Ref: library/functions setattr8505820
Ref: 261d8505820
Ref: library/functions slice8507180
Ref: 6948507180
Ref: library/functions slice start8507783
Ref: 24058507783
Ref: library/functions slice stop8507809
Ref: 24068507809
Ref: library/functions slice step8507834
Ref: 24078507834
Ref: library/functions sorted8508491
Ref: dcb8508491
Ref: library/functions staticmethod8510736
Ref: 4518510736
Ref: library/functions func-str8512901
Ref: 261e8512901
Ref: library/functions sum8513420
Ref: 6958513420
Ref: library/functions super8514717
Ref: 1a78514717
Ref: library/functions func-tuple8520223
Ref: 261f8520223
Ref: library/functions type8520516
Ref: f488520516
Ref: library/functions vars8522661
Ref: 1e7f8522661
Ref: library/functions zip8523946
Ref: 1a18523946
Ref: library/functions import__8528842
Ref: ad58528842
Ref: 組み込み関数-Footnote-18533022
Ref: 組み込み関数-Footnote-28533275
Ref: 組み込み関数-Footnote-38533317
Ref: 組み込み関数-Footnote-48533359
Ref: 組み込み関数-Footnote-58533401
Ref: 組み込み関数-Footnote-68533443
Ref: 組み込み関数-Footnote-78533520
Ref: 組み込み関数-Footnote-88533568
Ref: 組み込み関数-Footnote-98533610
Node: 組み込み定数8533652
Ref: library/constants doc8533786
Ref: 26408533786
Ref: library/constants built-in-constants8533786
Ref: 26418533786
Ref: library/constants built-in-consts8533786
Ref: 24d78533786
Ref: library/constants translation-repo8533786
Ref: 26428533786
Ref: library/constants False8533914
Ref: d2f8533914
Ref: library/constants True8534070
Ref: e0b8534070
Ref: library/constants None8534224
Ref: 8868534224
Ref: library/constants NotImplemented8534527
Ref: 1a38534527
Ref: library/constants Ellipsis8536572
Ref: 23848536572
Ref: library/constants debug__8536918
Ref: 9de8536918
Node: site モジュールで追加される定数8537534
Ref: library/constants constants-added-by-the-site-module8537633
Ref: 26438537633
Ref: library/constants site-consts8537633
Ref: 26448537633
Ref: library/constants quit8538123
Ref: 26458538123
Ref: library/constants exit8538155
Ref: 26468538155
Ref: library/constants copyright8538723
Ref: 17f88538723
Ref: library/constants credits8538748
Ref: 17f98538748
Ref: library/constants license8538941
Ref: 17f78538941
Node: 組み込み型8539258
Ref: library/stdtypes doc8539392
Ref: 26478539392
Ref: library/stdtypes bltin-types8539392
Ref: 26488539392
Ref: library/stdtypes built-in-types8539392
Ref: 26498539392
Ref: library/stdtypes translation-repo8539392
Ref: 264a8539392
Node: 真理値判定8541418
Ref: library/stdtypes truth8541524
Ref: 18bd8541524
Ref: library/stdtypes truth-value-testing8541524
Ref: 264b8541524
Ref: 真理値判定-Footnote-18542908
Node: ブール演算 --- and or not8543108
Ref: library/stdtypes boolean8543232
Ref: 264c8543232
Ref: library/stdtypes boolean-operations-and-or-not8543232
Ref: 264d8543232
Node: 比較<2>8544705
Ref: library/stdtypes comparisons8544841
Ref: 264e8544841
Ref: library/stdtypes stdcomparisons8544841
Ref: 264f8544841
Node: 数値型 int float complex8547766
Ref: library/stdtypes numeric-types-int-float-complex8547897
Ref: 26508547897
Ref: library/stdtypes typesnumeric8547897
Ref: 20388547897
Ref: library/stdtypes stdtypes-mixed-arithmetic8549628
Ref: 24c98549628
Ref: 数値型 int float complex-Footnote-18557432
Ref: 数値型 int float complex-Footnote-28557582
Node: 整数型におけるビット単位演算8557659
Ref: library/stdtypes bitstring-ops8557816
Ref: 26528557816
Ref: library/stdtypes bitwise-operations-on-integer-types8557816
Ref: 26538557816
Node: 整数型における追加のメソッド8560393
Ref: library/stdtypes additional-methods-on-integer-types8560610
Ref: 26548560610
Ref: library/stdtypes int bit_length8560865
Ref: 26558560865
Ref: library/stdtypes int bit_count8561773
Ref: 9d38561773
Ref: library/stdtypes int to_bytes8562173
Ref: 1c8f8562173
Ref: library/stdtypes int from_bytes8564565
Ref: 1c468564565
Ref: library/stdtypes int as_integer_ratio8566684
Ref: bc48566684
Ref: library/stdtypes int is_integer8567014
Ref: 1b4a8567014
Node: 浮動小数点数に対する追加のメソッド8567246
Ref: library/stdtypes additional-methods-on-float8567463
Ref: 26588567463
Ref: library/stdtypes float from_number8567763
Ref: 1958567763
Ref: library/stdtypes float as_integer_ratio8568485
Ref: 215d8568485
Ref: library/stdtypes float is_integer8568842
Ref: 26578568842
Ref: library/stdtypes float hex8569612
Ref: 215e8569612
Ref: library/stdtypes float fromhex8569836
Ref: 26598569836
Node: 複素数に対する追加のメソッド8571660
Ref: library/stdtypes additional-methods-on-complex8571862
Ref: 265a8571862
Ref: library/stdtypes complex from_number8572146
Ref: 1968572146
Node: 数値型のハッシュ化8572716
Ref: library/stdtypes hashing-of-numeric-types8572858
Ref: 265c8572858
Ref: library/stdtypes numeric-hash8572858
Ref: 265d8572858
Ref: library/stdtypes bltin-boolean-values8577499
Ref: 265f8577499
Node: ブーリアン型 - bool8577500
Ref: library/stdtypes boolean-type-bool8577640
Ref: 26608577640
Ref: library/stdtypes typebool8577640
Ref: 26208577640
Node: イテレータ型8579176
Ref: library/stdtypes iterator-types8579328
Ref: 26618579328
Ref: library/stdtypes typeiter8579328
Ref: 26368579328
Ref: library/stdtypes container __iter__8579940
Ref: 21058579940
Ref: library/stdtypes iterator __iter__8580955
Ref: 21088580955
Ref: library/stdtypes iterator __next__8581400
Ref: 14e98581400
Node: ジェネレータ型8582408
Ref: library/stdtypes generator-types8582484
Ref: 26628582484
Ref: library/stdtypes id38582484
Ref: 26638582484
Node: シーケンス型 --- list tuple range8583157
Ref: library/stdtypes sequence-types-list-tuple-range8583329
Ref: 26648583329
Ref: library/stdtypes typesseq8583329
Ref: 208a8583329
Node: 共通のシーケンス演算8583976
Ref: library/stdtypes common-sequence-operations8584133
Ref: 26658584133
Ref: library/stdtypes typesseq-common8584133
Ref: 26668584133
Ref: library/stdtypes list count8593709
Ref: 15e38593709
Ref: library/stdtypes sequence count8593709
Ref: 24388593709
Ref: library/stdtypes list index8593829
Ref: 15e28593829
Ref: library/stdtypes sequence index8593829
Ref: 19d98593829
Ref: 共通のシーケンス演算-Footnote-18594508
Node: イミュータブルなシーケンス型8594659
Ref: library/stdtypes immutable-sequence-types8594864
Ref: 26698594864
Ref: library/stdtypes typesseq-immutable8594864
Ref: 266a8594864
Node: ミュータブルなシーケンス型8595592
Ref: library/stdtypes mutable-sequence-types8595787
Ref: 266b8595787
Ref: library/stdtypes typesseq-mutable8595787
Ref: 26218595787
Ref: library/stdtypes bytearray append8599761
Ref: 15c38599761
Ref: library/stdtypes sequence append8599761
Ref: 24368599761
Ref: library/stdtypes bytearray clear8599932
Ref: 266c8599932
Ref: library/stdtypes sequence clear8599932
Ref: 24378599932
Ref: library/stdtypes bytearray copy8600096
Ref: 266d8600096
Ref: library/stdtypes sequence copy8600096
Ref: 266e8600096
Ref: library/stdtypes bytearray extend8600441
Ref: 18018600441
Ref: library/stdtypes sequence extend8600441
Ref: 24398600441
Ref: library/stdtypes bytearray insert8600646
Ref: 266f8600646
Ref: library/stdtypes sequence insert8600646
Ref: 243a8600646
Ref: library/stdtypes bytearray pop8600833
Ref: 15c48600833
Ref: library/stdtypes sequence pop8600833
Ref: 243b8600833
Ref: library/stdtypes bytearray remove8601021
Ref: 26708601021
Ref: library/stdtypes sequence remove8601021
Ref: 19da8601021
Ref: library/stdtypes bytearray reverse8601253
Ref: 15c58601253
Ref: library/stdtypes sequence reverse8601253
Ref: 243c8601253
Node: リスト型 list<2>8601496
Ref: library/stdtypes lists8601667
Ref: 26718601667
Ref: library/stdtypes typesseq-list8601667
Ref: 207e8601667
Ref: library/stdtypes list8601958
Ref: 24f8601958
Ref: library/stdtypes list sort8603441
Ref: dcc8603441
Node: タプル型 tuple8606504
Ref: library/stdtypes tuples8606641
Ref: 26738606641
Ref: library/stdtypes typesseq-tuple8606641
Ref: 25a98606641
Ref: library/stdtypes tuple8607166
Ref: 6148607166
Node: range8609215
Ref: library/stdtypes ranges8609323
Ref: 26758609323
Ref: library/stdtypes typesseq-range8609323
Ref: 263c8609323
Ref: library/stdtypes range8609533
Ref: b418609533
Ref: library/stdtypes range start8611812
Ref: 26768611812
Ref: library/stdtypes range stop8611931
Ref: 26778611931
Ref: library/stdtypes range step8611989
Ref: 26788611989
Ref: range-Footnote-18614363
Node: Text and Binary Sequence Type Methods Summary8614449
Ref: library/stdtypes text-and-binary-sequence-type-methods-summary8614641
Ref: 26798614641
Ref: library/stdtypes text-methods-summary8614641
Ref: 267a8614641
Node: テキストシーケンス型 --- str8625647
Ref: library/stdtypes text-sequence-type-str8625861
Ref: 26a88625861
Ref: library/stdtypes textseq8625861
Ref: 203c8625861
Ref: library/stdtypes str8628156
Ref: 16a8628156
Node: 文字列メソッド<2>8631105
Ref: library/stdtypes id58631248
Ref: 26ab8631248
Ref: library/stdtypes string-methods8631248
Ref: 203d8631248
Ref: library/stdtypes str capitalize8632283
Ref: 26988632283
Ref: library/stdtypes str casefold8632770
Ref: fda8632770
Ref: library/stdtypes str center8633598
Ref: 20bf8633598
Ref: library/stdtypes str count8634067
Ref: 19e18634067
Ref: library/stdtypes str encode8634799
Ref: ad68634799
Ref: library/stdtypes str endswith8636348
Ref: 10d08636348
Ref: library/stdtypes str expandtabs8637138
Ref: 26a18637138
Ref: library/stdtypes str find8638373
Ref: 10ac8638373
Ref: library/stdtypes str format8639184
Ref: 8338639184
Ref: library/stdtypes str format_map8641215
Ref: fdb8641215
Ref: library/stdtypes str index8641780
Ref: 1a198641780
Ref: library/stdtypes str isalnum8642329
Ref: 268b8642329
Ref: library/stdtypes str isalpha8642881
Ref: 26858642881
Ref: library/stdtypes str isascii8643700
Ref: ced8643700
Ref: library/stdtypes str isdecimal8644065
Ref: 26878644065
Ref: library/stdtypes str isdigit8644686
Ref: 26888644686
Ref: library/stdtypes str isidentifier8645611
Ref: 1da48645611
Ref: library/stdtypes str islower8646244
Ref: 268d8646244
Ref: library/stdtypes str isnumeric8646518
Ref: 268a8646518
Ref: library/stdtypes str isprintable8647412
Ref: fdc8647412
Ref: library/stdtypes str isspace8648466
Ref: 26938648466
Ref: library/stdtypes str istitle8649260
Ref: 26918649260
Ref: library/stdtypes str isupper8649889
Ref: 268f8649889
Ref: library/stdtypes meth-str-join8650354
Ref: 26af8650354
Ref: library/stdtypes str join8650354
Ref: 26688650354
Ref: library/stdtypes str ljust8650878
Ref: 20be8650878
Ref: library/stdtypes str lower8651447
Ref: 1bd58651447
Ref: library/stdtypes str lstrip8651791
Ref: 16ce8651791
Ref: library/stdtypes str maketrans8652728
Ref: fdd8652728
Ref: library/stdtypes str partition8653627
Ref: 10af8653627
Ref: library/stdtypes str removeprefix8654377
Ref: ad08654377
Ref: library/stdtypes str removesuffix8654812
Ref: ad18654812
Ref: library/stdtypes str replace8655276
Ref: 4b88655276
Ref: library/stdtypes str rfind8655896
Ref: 10ad8655896
Ref: library/stdtypes str rindex8656397
Ref: 14738656397
Ref: library/stdtypes str rjust8656976
Ref: 20bd8656976
Ref: library/stdtypes str rpartition8657581
Ref: 14748657581
Ref: library/stdtypes str rsplit8658334
Ref: 14718658334
Ref: library/stdtypes str rstrip8658907
Ref: 16cf8658907
Ref: library/stdtypes str split8659760
Ref: 10ae8659760
Ref: library/stdtypes str splitlines8662093
Ref: 14728662093
Ref: library/stdtypes str startswith8664849
Ref: 10cf8664849
Ref: library/stdtypes str strip8665589
Ref: 16cd8665589
Ref: library/stdtypes str swapcase8666736
Ref: 269c8666736
Ref: library/stdtypes str title8667192
Ref: 269a8667192
Ref: library/stdtypes str translate8668573
Ref: 26a68668573
Ref: library/stdtypes str upper8669881
Ref: 26968669881
Ref: library/stdtypes str zfill8670454
Ref: 16d08670454
Ref: 文字列メソッド<2>-Footnote-18671016
Ref: 文字列メソッド<2>-Footnote-28671100
Ref: 文字列メソッド<2>-Footnote-38671184
Ref: 文字列メソッド<2>-Footnote-48671241
Ref: 文字列メソッド<2>-Footnote-58671498
Ref: 文字列メソッド<2>-Footnote-68671755
Ref: 文字列メソッド<2>-Footnote-78672012
Ref: 文字列メソッド<2>-Footnote-88672096
Ref: 文字列メソッド<2>-Footnote-98672353
Node: Formatted String Literals f-strings8672437
Ref: library/stdtypes formatted-string-literals-f-strings8672623
Ref: 26b18672623
Ref: library/stdtypes stdtypes-fstrings8672623
Ref: 23478672623
Node: Debug specifier8673829
Ref: library/stdtypes debug-specifier8673945
Ref: 26b28673945
Node: Conversion specifier8674533
Ref: library/stdtypes conversion-specifier8674674
Ref: 26b38674674
Node: Format specifier8675658
Ref: library/stdtypes format-specifier8675775
Ref: 26b48675775
Node: Template String Literals t-strings8676542
Ref: library/stdtypes stdtypes-tstrings8676738
Ref: 234b8676738
Ref: library/stdtypes template-string-literals-t-strings8676738
Ref: 26b58676738
Node: printf 形式の文字列書式化8678608
Ref: library/stdtypes old-string-formatting8678760
Ref: 8dc8678760
Ref: library/stdtypes printf-style-string-formatting8678760
Ref: 26b78678760
Ref: printf 形式の文字列書式化-Footnote-18689601
Ref: printf 形式の文字列書式化-Footnote-28689817
Node: バイナリシーケンス型 --- bytes bytearray memoryview8689859
Ref: library/stdtypes binary-sequence-types-bytes-bytearray-memoryview8690064
Ref: 26b88690064
Ref: library/stdtypes binaryseq8690064
Ref: 26238690064
Node: バイトオブジェクト8690955
Ref: library/stdtypes bytes-objects8691117
Ref: 26b98691117
Ref: library/stdtypes typebytes8691117
Ref: 26258691117
Ref: library/stdtypes bytes8691558
Ref: 1938691558
Ref: library/stdtypes bytes fromhex8694488
Ref: 1918694488
Ref: library/stdtypes bytes hex8695483
Ref: f698695483
Node: bytearray オブジェクト8697595
Ref: library/stdtypes bytearray-objects8697795
Ref: 26ba8697795
Ref: library/stdtypes typebytearray8697795
Ref: 26248697795
Ref: library/stdtypes bytearray8697985
Ref: 3428697985
Ref: library/stdtypes bytearray fromhex8699253
Ref: 1928699253
Ref: library/stdtypes bytearray hex8700293
Ref: f6a8700293
Ref: library/stdtypes bytearray resize8700983
Ref: 17c98700983
Node: bytes と bytearray の操作8702848
Ref: library/stdtypes bytes-and-bytearray-operations8703059
Ref: 26bc8703059
Ref: library/stdtypes bytes-methods8703059
Ref: 26228703059
Ref: library/stdtypes bytes count8704734
Ref: 19e28704734
Ref: library/stdtypes bytearray count8704786
Ref: 18038704786
Ref: library/stdtypes bytes removeprefix8705565
Ref: 26bd8705565
Ref: library/stdtypes bytearray removeprefix8705614
Ref: 26be8705614
Ref: library/stdtypes bytes removesuffix8706347
Ref: 26bf8706347
Ref: library/stdtypes bytearray removesuffix8706396
Ref: 26c08706396
Ref: library/stdtypes bytes decode8707160
Ref: ad78707160
Ref: library/stdtypes bytearray decode8707227
Ref: 26c18707227
Ref: library/stdtypes bytes endswith8708936
Ref: 267e8708936
Ref: library/stdtypes bytearray endswith8708994
Ref: 15c08708994
Ref: library/stdtypes bytes find8709631
Ref: 1c318709631
Ref: library/stdtypes bytearray find8709682
Ref: 15c18709682
Ref: library/stdtypes bytes index8710816
Ref: 267b8710816
Ref: library/stdtypes bytearray index8710868
Ref: 18048710868
Ref: library/stdtypes bytes join8711383
Ref: 177e8711383
Ref: library/stdtypes bytearray join8711426
Ref: 177f8711426
Ref: library/stdtypes bytes maketrans8711934
Ref: 14908711934
Ref: library/stdtypes bytearray maketrans8711989
Ref: 14918711989
Ref: library/stdtypes bytes partition8712463
Ref: 26838712463
Ref: library/stdtypes bytearray partition8712506
Ref: 26c28712506
Ref: library/stdtypes bytes replace8713187
Ref: 267f8713187
Ref: library/stdtypes bytearray replace8713243
Ref: 26c38713243
Ref: library/stdtypes bytes rfind8713884
Ref: 1c328713884
Ref: library/stdtypes bytearray rfind8713936
Ref: 15c28713936
Ref: library/stdtypes bytes rindex8714622
Ref: 267c8714622
Ref: library/stdtypes bytearray rindex8714675
Ref: 18058714675
Ref: library/stdtypes bytes rpartition8715199
Ref: 26848715199
Ref: library/stdtypes bytearray rpartition8715243
Ref: 26c48715243
Ref: library/stdtypes bytes startswith8715904
Ref: 267d8715904
Ref: library/stdtypes bytearray startswith8715964
Ref: 15bf8715964
Ref: library/stdtypes bytes translate8716603
Ref: 26a78716603
Ref: library/stdtypes bytearray translate8716660
Ref: 15178716660
Ref: library/stdtypes bytes center8717986
Ref: 26a08717986
Ref: library/stdtypes bytearray center8718043
Ref: 26c58718043
Ref: library/stdtypes bytes ljust8718675
Ref: 269e8718675
Ref: library/stdtypes bytearray ljust8718731
Ref: 26c68718731
Ref: library/stdtypes bytes lstrip8719359
Ref: 26a48719359
Ref: library/stdtypes bytearray lstrip8719406
Ref: 26c78719406
Ref: library/stdtypes bytes rjust8720741
Ref: 269f8720741
Ref: library/stdtypes bytearray rjust8720797
Ref: 26c88720797
Ref: library/stdtypes bytes rsplit8721425
Ref: 26818721425
Ref: library/stdtypes bytearray rsplit8721480
Ref: 18088721480
Ref: library/stdtypes bytes rstrip8722116
Ref: 26a58722116
Ref: library/stdtypes bytearray rstrip8722163
Ref: 26c98722163
Ref: library/stdtypes bytes split8723480
Ref: 26808723480
Ref: library/stdtypes bytearray split8723534
Ref: 18078723534
Ref: library/stdtypes bytes strip8725758
Ref: 26a38725758
Ref: library/stdtypes bytearray strip8725804
Ref: 26ca8725804
Ref: library/stdtypes bytes capitalize8727178
Ref: 26998727178
Ref: library/stdtypes bytearray capitalize8727216
Ref: 26cb8727216
Ref: library/stdtypes bytes expandtabs8727725
Ref: 26a28727725
Ref: library/stdtypes bytearray expandtabs8727772
Ref: 26cc8727772
Ref: library/stdtypes bytes isalnum8729495
Ref: 268c8729495
Ref: library/stdtypes bytearray isalnum8729530
Ref: 26cd8729530
Ref: library/stdtypes bytes isalpha8730183
Ref: 26868730183
Ref: library/stdtypes bytearray isalpha8730218
Ref: 26ce8730218
Ref: library/stdtypes bytes isascii8730763
Ref: 26cf8730763
Ref: library/stdtypes bytearray isascii8730798
Ref: 26d08730798
Ref: library/stdtypes bytes isdigit8731111
Ref: 26898731111
Ref: library/stdtypes bytearray isdigit8731146
Ref: 26d18731146
Ref: library/stdtypes bytes islower8731588
Ref: 268e8731588
Ref: library/stdtypes bytearray islower8731623
Ref: 26d28731623
Ref: library/stdtypes bytes isspace8732305
Ref: 26948732305
Ref: library/stdtypes bytearray isspace8732340
Ref: 26d38732340
Ref: library/stdtypes bytes istitle8732820
Ref: 26928732820
Ref: library/stdtypes bytearray istitle8732855
Ref: 26d48732855
Ref: library/stdtypes bytes isupper8733341
Ref: 26908733341
Ref: library/stdtypes bytearray isupper8733376
Ref: 26d58733376
Ref: library/stdtypes bytes lower8734058
Ref: 26958734058
Ref: library/stdtypes bytearray lower8734091
Ref: 26d68734091
Ref: library/stdtypes bytes splitlines8734855
Ref: 26828734855
Ref: library/stdtypes bytearray splitlines8734907
Ref: 26d78734907
Ref: library/stdtypes bytes swapcase8736075
Ref: 269d8736075
Ref: library/stdtypes bytearray swapcase8736111
Ref: 26d88736111
Ref: library/stdtypes bytes title8737248
Ref: 269b8737248
Ref: library/stdtypes bytearray title8737281
Ref: 26d98737281
Ref: library/stdtypes bytes upper8739310
Ref: 26978739310
Ref: library/stdtypes bytearray upper8739343
Ref: 26da8739343
Ref: library/stdtypes bytes zfill8740107
Ref: 26db8740107
Ref: library/stdtypes bytearray zfill8740148
Ref: 26dc8740148
Node: printf 形式での bytes の書式化8740938
Ref: library/stdtypes bytes-formatting8741139
Ref: f858741139
Ref: library/stdtypes printf-style-bytes-formatting8741139
Ref: 26dd8741139
Ref: printf 形式での bytes の書式化-Footnote-18752119
Ref: printf 形式での bytes の書式化-Footnote-28752335
Ref: printf 形式での bytes の書式化-Footnote-38752377
Node: メモリビュー8752419
Ref: library/stdtypes memory-views8752582
Ref: 26de8752582
Ref: library/stdtypes typememoryview8752582
Ref: 26378752582
Ref: library/stdtypes memoryview8752881
Ref: 1668752881
Ref: library/stdtypes memoryview __eq__8758166
Ref: 26e18758166
Ref: library/stdtypes memoryview tobytes8760549
Ref: 26e28760549
Ref: library/stdtypes memoryview hex8762118
Ref: f6b8762118
Ref: library/stdtypes memoryview tolist8762860
Ref: 26df8762860
Ref: library/stdtypes memoryview toreadonly8763582
Ref: 26e38763582
Ref: library/stdtypes memoryview release8764325
Ref: 13da8764325
Ref: library/stdtypes memoryview cast8766052
Ref: 12518766052
Ref: library/stdtypes memoryview count8770075
Ref: 19598770075
Ref: library/stdtypes memoryview index8770220
Ref: 19588770220
Ref: library/stdtypes memoryview obj8770621
Ref: 26e48770621
Ref: library/stdtypes memoryview nbytes8770907
Ref: 26e58770907
Ref: library/stdtypes memoryview readonly8772161
Ref: 26e68772161
Ref: library/stdtypes memoryview format8772282
Ref: 12508772282
Ref: library/stdtypes memoryview itemsize8773109
Ref: 26e08773109
Ref: library/stdtypes memoryview ndim8773537
Ref: 12548773537
Ref: library/stdtypes memoryview shape8773657
Ref: 12558773657
Ref: library/stdtypes memoryview strides8774002
Ref: 12568774002
Ref: library/stdtypes memoryview suboffsets8774429
Ref: 12578774429
Ref: library/stdtypes memoryview c_contiguous8774622
Ref: 26e78774622
Ref: library/stdtypes memoryview f_contiguous8774857
Ref: 26e88774857
Ref: library/stdtypes memoryview contiguous8775096
Ref: 26e98775096
Ref: メモリビュー-Footnote-18775509
Node: set（集合）型 --- set frozenset8775551
Ref: library/stdtypes set-types-set-frozenset8775740
Ref: 26ea8775740
Ref: library/stdtypes types-set8775740
Ref: 208d8775740
Ref: library/stdtypes set8777586
Ref: 1858777586
Ref: library/stdtypes frozenset8777622
Ref: 7f28777622
Ref: library/stdtypes frozenset isdisjoint8778880
Ref: 26ec8778880
Ref: library/stdtypes set isdisjoint8778930
Ref: 26ed8778930
Ref: library/stdtypes frozenset issubset8779191
Ref: 26ee8779191
Ref: library/stdtypes set issubset8779239
Ref: 26ef8779239
Ref: library/stdtypes frozenset issuperset8779560
Ref: 26f08779560
Ref: library/stdtypes set issuperset8779610
Ref: 1be38779610
Ref: library/stdtypes frozenset union8779933
Ref: 16a18779933
Ref: library/stdtypes set union8779977
Ref: 17878779977
Ref: library/stdtypes frozenset intersection8780133
Ref: 16a28780133
Ref: library/stdtypes set intersection8780184
Ref: 17848780184
Ref: library/stdtypes frozenset difference8780359
Ref: 26f18780359
Ref: library/stdtypes set difference8780408
Ref: 17858780408
Ref: library/stdtypes frozenset symmetric_difference8780614
Ref: 26f28780614
Ref: library/stdtypes set symmetric_difference8780674
Ref: 17868780674
Ref: library/stdtypes frozenset copy8780875
Ref: 26f38780875
Ref: library/stdtypes set copy8780911
Ref: 26f48780911
Ref: library/stdtypes set update8783502
Ref: 26f58783502
Ref: library/stdtypes set intersection_update8783649
Ref: 16a38783649
Ref: library/stdtypes set difference_update8783844
Ref: 26f68783844
Ref: library/stdtypes set symmetric_difference_update8784009
Ref: 16a48784009
Ref: library/stdtypes set add8784213
Ref: 239a8784213
Ref: library/stdtypes set remove8784300
Ref: 26eb8784300
Ref: library/stdtypes set discard8784490
Ref: 26f78784490
Ref: library/stdtypes set pop8784608
Ref: 26f88784608
Ref: library/stdtypes set clear8784781
Ref: 26f98784781
Node: Mapping Types --- dict8785538
Ref: library/stdtypes mapping-types-dict8785702
Ref: 26fb8785702
Ref: library/stdtypes typesmapping8785702
Ref: cc18785702
Ref: library/stdtypes dict8786653
Ref: 1848786653
Ref: library/stdtypes dict clear8792814
Ref: 17ca8792814
Ref: library/stdtypes dict copy8792904
Ref: dcd8792904
Ref: library/stdtypes dict fromkeys8792990
Ref: 2508792990
Ref: library/stdtypes dict get8793751
Ref: 20908793751
Ref: library/stdtypes dict items8794148
Ref: 9d68794148
Ref: library/stdtypes dict keys8794375
Ref: 9d48794375
Ref: library/stdtypes dict pop8794575
Ref: 5e68794575
Ref: library/stdtypes dict popitem8794951
Ref: 17448794951
Ref: library/stdtypes dict setdefault8795908
Ref: 12898795908
Ref: library/stdtypes dict update8796227
Ref: 16838796227
Ref: library/stdtypes dict values8796977
Ref: 9d58796977
Node: 辞書ビューオブジェクト8799026
Ref: library/stdtypes dict-views8799118
Ref: 26fc8799118
Ref: library/stdtypes dictionary-view-objects8799118
Ref: 26fe8799118
Node: コンテキストマネージャ型8803407
Ref: library/stdtypes context-manager-types8803617
Ref: 27008803617
Ref: library/stdtypes typecontextmanager8803617
Ref: 246c8803617
Ref: library/stdtypes contextmanager __enter__8804079
Ref: 27018804079
Ref: library/stdtypes contextmanager __exit__8805340
Ref: 27028805340
Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン8808426
Ref: library/stdtypes type-annotation-types-generic-alias-union8808641
Ref: 27038808641
Node: ジェネリックエイリアス型8809023
Ref: library/stdtypes generic-alias-type8809196
Ref: 27048809196
Ref: library/stdtypes types-genericalias8809196
Ref: 8c28809196
Node: 標準ジェネリッククラス8815712
Ref: library/stdtypes standard-generic-classes8815876
Ref: 27068815876
Node: GenericAlias オブジェクトの特別な属性8818377
Ref: library/stdtypes special-attributes-of-genericalias-objects8818541
Ref: 27138818541
Ref: library/stdtypes genericalias __origin__8818785
Ref: 27148818785
Ref: library/stdtypes genericalias __args__8819002
Ref: 27058819002
Ref: library/stdtypes genericalias __parameters__8819299
Ref: 27158819299
Ref: library/stdtypes genericalias __unpacked__8819976
Ref: 27168819976
Ref: GenericAlias オブジェクトの特別な属性-Footnote-18821095
Ref: GenericAlias オブジェクトの特別な属性-Footnote-28821137
Node: Union 型8821179
Ref: library/stdtypes types-union8821352
Ref: 9c98821352
Ref: library/stdtypes union-type8821352
Ref: 27178821352
Ref: Union 型-Footnote-18825436
Node: その他の組み込み型8825478
Ref: library/stdtypes other-built-in-types8825669
Ref: 27188825669
Ref: library/stdtypes typesother8825669
Ref: 27198825669
Node: モジュール<4>8826282
Ref: library/stdtypes modules8826418
Ref: 271a8826418
Ref: library/stdtypes typesmodules8826418
Ref: 271b8826418
Node: クラスおよびクラスインスタンス8827945
Ref: library/stdtypes classes-and-class-instances8828096
Ref: 271c8828096
Ref: library/stdtypes typesobjects8828096
Ref: 271d8828096
Node: 関数8828341
Ref: library/stdtypes functions8828486
Ref: 271e8828486
Ref: library/stdtypes typesfunctions8828486
Ref: 271f8828486
Node: メソッド8829055
Ref: library/stdtypes methods8829185
Ref: 27208829185
Ref: library/stdtypes typesmethods8829185
Ref: 27218829185
Node: コードオブジェクト<2>8831465
Ref: library/stdtypes bltin-code-objects8831610
Ref: 27228831610
Ref: library/stdtypes code-objects8831610
Ref: 27238831610
Node: 型オブジェクト8832701
Ref: library/stdtypes bltin-type-objects8832858
Ref: 263f8832858
Ref: library/stdtypes type-objects8832858
Ref: 27248832858
Node: ヌルオブジェクト8833321
Ref: library/stdtypes bltin-null-object8833475
Ref: 27258833475
Ref: library/stdtypes the-null-object8833475
Ref: 27268833475
Node: Ellipsis オブジェクト8833915
Ref: library/stdtypes bltin-ellipsis-object8834081
Ref: 20588834081
Ref: library/stdtypes the-ellipsis-object8834081
Ref: 27278834081
Ref: Ellipsis オブジェクト-Footnote-18835301
Node: NotImplemented オブジェクト8835386
Ref: library/stdtypes bltin-notimplemented-object8835552
Ref: 27298835552
Ref: library/stdtypes the-notimplemented-object8835552
Ref: 272a8835552
Node: 内部オブジェクト8836066
Ref: library/stdtypes internal-objects8836196
Ref: 272b8836196
Ref: library/stdtypes typesinternal8836196
Ref: 272c8836196
Node: 特殊属性8836475
Ref: library/stdtypes special-attributes8836629
Ref: 272d8836629
Ref: library/stdtypes specialattrs8836629
Ref: 272e8836629
Ref: library/stdtypes definition __name__8836899
Ref: 12768836899
Ref: library/stdtypes definition __qualname__8837059
Ref: 12758837059
Ref: library/stdtypes definition __module__8837268
Ref: 272f8837268
Ref: library/stdtypes definition __doc__8837377
Ref: b258837377
Ref: library/stdtypes definition __type_params__8837500
Ref: 25f38837500
Node: 整数と文字列の変換での長さ制限8837758
Ref: library/stdtypes int-max-str-digits8837876
Ref: 80b8837876
Ref: library/stdtypes integer-string-conversion-length-limitation8837876
Ref: 27308837876
Ref: 整数と文字列の変換での長さ制限-Footnote-18840973
Node: 影響のあるAPI8841029
Ref: library/stdtypes affected-apis8841162
Ref: 27318841162
Node: 上限値を設定する8842197
Ref: library/stdtypes configuring-the-limit8842351
Ref: 27328842351
Node: 推奨設定8845496
Ref: library/stdtypes recommended-configuration8845623
Ref: 27358845623
Node: 組み込み例外8846763
Ref: library/exceptions doc8846903
Ref: 27368846903
Ref: library/exceptions bltin-exceptions8846903
Ref: 1c848846903
Ref: library/exceptions built-in-exceptions8846903
Ref: 27378846903
Ref: library/exceptions translation-repo8846903
Ref: 27388846903
Node: 例外コンテキスト8849063
Ref: library/exceptions exception-context8849187
Ref: 27398849187
Ref: library/exceptions BaseException __context__8849358
Ref: 14e38849358
Ref: library/exceptions BaseException __cause__8849399
Ref: 14e48849399
Ref: library/exceptions BaseException __suppress_context__8849438
Ref: 25748849438
Node: 組み込み例外から継承する8851345
Ref: library/exceptions inheriting-from-built-in-exceptions8851493
Ref: 273a8851493
Ref: 組み込み例外から継承する-Footnote-18852355
Node: 基底クラス8852428
Ref: library/exceptions base-classes8852564
Ref: 273b8852564
Ref: library/exceptions BaseException8852690
Ref: 7d68852690
Ref: library/exceptions BaseException args8853138
Ref: 78d8853138
Ref: library/exceptions BaseException with_traceback8853566
Ref: 25738853566
Ref: library/exceptions BaseException __traceback__8854472
Ref: 14e28854472
Ref: library/exceptions BaseException add_note8854664
Ref: 7d78854664
Ref: library/exceptions BaseException __notes__8855016
Ref: 273c8855016
Ref: library/exceptions Exception8855250
Ref: bd18855250
Ref: library/exceptions ArithmeticError8855472
Ref: 273d8855472
Ref: library/exceptions BufferError8855709
Ref: 18068855709
Ref: library/exceptions LookupError8855844
Ref: 24458855844
Ref: 基底クラス-Footnote-18856218
Node: 具象例外8856260
Ref: library/exceptions concrete-exceptions8856366
Ref: 273f8856366
Ref: library/exceptions AssertionError8856460
Ref: 8b98856460
Ref: library/exceptions AttributeError8856562
Ref: 5f08856562
Ref: library/exceptions AttributeError name8856967
Ref: 27408856967
Ref: library/exceptions AttributeError obj8857065
Ref: 27418857065
Ref: library/exceptions EOFError8857278
Ref: 14f58857278
Ref: library/exceptions FloatingPointError8857564
Ref: 273e8857564
Ref: library/exceptions GeneratorExit8857639
Ref: 15e58857639
Ref: library/exceptions ImportError8858062
Ref: 65b8858062
Ref: library/exceptions ImportError name8858481
Ref: 17b48858481
Ref: library/exceptions ImportError path8858573
Ref: 27428858573
Ref: library/exceptions ModuleNotFoundError8858785
Ref: d418858785
Ref: library/exceptions IndexError8859101
Ref: 17538859101
Ref: library/exceptions KeyError8859421
Ref: 5e78859421
Ref: library/exceptions KeyboardInterrupt8859580
Ref: bc98859580
Ref: library/exceptions MemoryError8860499
Ref: 17728860499
Ref: library/exceptions NameError8861236
Ref: 4508861236
Ref: library/exceptions NameError name8861663
Ref: 27448861663
Ref: library/exceptions NotImplementedError8861850
Ref: 3698861850
Ref: library/exceptions OSError8862913
Ref: 2c28862913
Ref: library/exceptions OSError errno8864126
Ref: 18218864126
Ref: library/exceptions OSError winerror8864234
Ref: 27468864234
Ref: library/exceptions OSError strerror8864857
Ref: 27478864857
Ref: library/exceptions OSError filename8865093
Ref: 27488865093
Ref: library/exceptions OSError filename28865122
Ref: 27498865122
Ref: library/exceptions OverflowError8866242
Ref: a858866242
Ref: library/exceptions PythonFinalizationError8866823
Ref: 47a8866823
Ref: library/exceptions RecursionError8867602
Ref: f6c8867602
Ref: library/exceptions ReferenceError8867968
Ref: 172b8867968
Ref: library/exceptions RuntimeError8868372
Ref: 2468868372
Ref: library/exceptions StopIteration8868591
Ref: df98868591
Ref: library/exceptions StopIteration value8868868
Ref: 24778868868
Ref: library/exceptions StopAsyncIteration8870264
Ref: 1e6c8870264
Ref: library/exceptions SyntaxError8870532
Ref: 18f8870532
Ref: library/exceptions SyntaxError filename8871105
Ref: 274a8871105
Ref: library/exceptions SyntaxError lineno8871201
Ref: 274b8871201
Ref: library/exceptions SyntaxError offset8871394
Ref: 274c8871394
Ref: library/exceptions SyntaxError text8871572
Ref: 274d8871572
Ref: library/exceptions SyntaxError end_lineno8871664
Ref: 274e8871664
Ref: library/exceptions SyntaxError end_offset8871870
Ref: 274f8871870
Ref: library/exceptions IndentationError8872498
Ref: 17558872498
Ref: library/exceptions TabError8872685
Ref: 7658872685
Ref: library/exceptions SystemError8872898
Ref: 7958872898
Ref: library/exceptions SystemExit8873795
Ref: f408873795
Ref: library/exceptions SystemExit code8875152
Ref: 27518875152
Ref: library/exceptions TypeError8875322
Ref: 1998875322
Ref: library/exceptions UnboundLocalError8876365
Ref: 17548876365
Ref: library/exceptions UnicodeError8876632
Ref: 4608876632
Ref: library/exceptions UnicodeError encoding8877117
Ref: 27528877117
Ref: library/exceptions UnicodeError reason8877225
Ref: 27538877225
Ref: library/exceptions UnicodeError object8877328
Ref: 195d8877328
Ref: library/exceptions UnicodeError start8877478
Ref: 19228877478
Ref: library/exceptions UnicodeError end8877749
Ref: 19238877749
Ref: library/exceptions UnicodeEncodeError8878024
Ref: 8888878024
Ref: library/exceptions UnicodeDecodeError8878210
Ref: c0c8878210
Ref: library/exceptions UnicodeTranslateError8878393
Ref: 195e8878393
Ref: library/exceptions ValueError8878573
Ref: 2ee8878573
Ref: library/exceptions ZeroDivisionError8878833
Ref: b438878833
Ref: library/exceptions EnvironmentError8879243
Ref: 12638879243
Ref: library/exceptions IOError8879273
Ref: 12628879273
Ref: library/exceptions WindowsError8879294
Ref: 12648879294
Ref: 具象例外-Footnote-18879425
Ref: 具象例外-Footnote-28879467
Node: OS 例外8879509
Ref: library/exceptions os-exceptions8879567
Ref: 27458879567
Ref: library/exceptions BlockingIOError8879734
Ref: 2378879734
Ref: library/exceptions BlockingIOError characters_written8880216
Ref: 27588880216
Ref: library/exceptions ChildProcessError8880468
Ref: 12678880468
Ref: library/exceptions ConnectionError8880633
Ref: 100f8880633
Ref: library/exceptions BrokenPipeError8880903
Ref: 126b8880903
Ref: library/exceptions ConnectionAbortedError8881293
Ref: 126c8881293
Ref: library/exceptions ConnectionRefusedError8881544
Ref: 126d8881544
Ref: library/exceptions ConnectionResetError8881795
Ref: 126e8881795
Ref: library/exceptions FileExistsError8882040
Ref: 12258882040
Ref: library/exceptions FileNotFoundError8882246
Ref: 2668882246
Ref: library/exceptions InterruptedError8882439
Ref: f8c8882439
Ref: library/exceptions IsADirectoryError8882985
Ref: 12688882985
Ref: library/exceptions NotADirectoryError8883213
Ref: 12698883213
Ref: library/exceptions PermissionError8883671
Ref: f428883671
Ref: library/exceptions ProcessLookupError8884097
Ref: 126a8884097
Ref: library/exceptions TimeoutError8884268
Ref: a3a8884268
Ref: OS 例外-Footnote-18884676
Ref: OS 例外-Footnote-28884718
Node: 警告8884760
Ref: library/exceptions warning-categories-as-exceptions8884869
Ref: 27668884869
Ref: library/exceptions warnings8884869
Ref: 27678884869
Ref: library/exceptions Warning8885061
Ref: 27698885061
Ref: library/exceptions UserWarning8885134
Ref: 276a8885134
Ref: library/exceptions DeprecationWarning8885244
Ref: 1a48885244
Ref: library/exceptions PendingDeprecationWarning8885722
Ref: ac98885722
Ref: library/exceptions SyntaxWarning8886427
Ref: 1af8886427
Ref: library/exceptions RuntimeWarning8886672
Ref: 4d78886672
Ref: library/exceptions FutureWarning8886788
Ref: 6598886788
Ref: library/exceptions ImportWarning8887009
Ref: 71e8887009
Ref: library/exceptions UnicodeWarning8887331
Ref: 16428887331
Ref: library/exceptions EncodingWarning8887422
Ref: 21898887422
Ref: library/exceptions BytesWarning8887642
Ref: e208887642
Ref: library/exceptions ResourceWarning8887773
Ref: 54c8887773
Ref: 警告-Footnote-18888119
Ref: 警告-Footnote-28888161
Ref: 警告-Footnote-38888203
Node: 例外グループ8888245
Ref: library/exceptions exception-groups8888366
Ref: 276b8888366
Ref: library/exceptions lib-exception-groups8888366
Ref: 276c8888366
Ref: library/exceptions ExceptionGroup8888804
Ref: 4d28888804
Ref: library/exceptions BaseExceptionGroup8888844
Ref: 5668888844
Ref: library/exceptions BaseExceptionGroup message8890246
Ref: 276d8890246
Ref: library/exceptions BaseExceptionGroup exceptions8890373
Ref: 276e8890373
Ref: library/exceptions BaseExceptionGroup subgroup8890569
Ref: 1a9a8890569
Ref: library/exceptions BaseExceptionGroup split8891930
Ref: 193a8891930
Ref: library/exceptions BaseExceptionGroup derive8892198
Ref: 1a998892198
Node: 例外のクラス階層8895284
Ref: library/exceptions exception-hierarchy8895390
Ref: 276f8895390
Node: Thread Safety Guarantees8898286
Ref: library/threadsafety doc8898441
Ref: 27708898441
Ref: library/threadsafety thread-safety-guarantees8898441
Ref: 27718898441
Ref: library/threadsafety threadsafety8898441
Ref: 27728898441
Ref: library/threadsafety translation-repo8898441
Ref: 27738898441
Node: Thread safety levels8899123
Ref: library/threadsafety thread-safety-levels8899243
Ref: 27758899243
Ref: library/threadsafety threadsafety-levels8899243
Ref: 27768899243
Node: Incompatible8899565
Ref: library/threadsafety incompatible8899653
Ref: 27778899653
Ref: library/threadsafety threadsafety-level-incompatible8899653
Ref: 27788899653
Node: Compatible8900180
Ref: library/threadsafety compatible8900301
Ref: 27798900301
Ref: library/threadsafety threadsafety-level-compatible8900301
Ref: 277a8900301
Node: Safe on distinct objects8900857
Ref: library/threadsafety safe-on-distinct-objects8900988
Ref: 277e8900988
Ref: library/threadsafety threadsafety-level-distinct8900988
Ref: 277f8900988
Node: Safe on shared objects8901595
Ref: library/threadsafety safe-on-shared-objects8901722
Ref: 27808901722
Ref: library/threadsafety threadsafety-level-shared8901722
Ref: 27818901722
Node: Atomic8902245
Ref: library/threadsafety atomic8902339
Ref: 27858902339
Ref: library/threadsafety threadsafety-level-atomic8902339
Ref: 27868902339
Node: Thread safety for list objects8902704
Ref: library/threadsafety thread-safety-for-list-objects8902863
Ref: 27888902863
Ref: library/threadsafety thread-safety-list8902863
Ref: 26728902863
Node: Thread safety for dict objects8906261
Ref: library/threadsafety thread-safety-dict8906429
Ref: 26fd8906429
Ref: library/threadsafety thread-safety-for-dict-objects8906429
Ref: 278a8906429
Node: Thread safety for set objects8910632
Ref: library/threadsafety thread-safety-for-set-objects8910805
Ref: 278b8910805
Ref: library/threadsafety thread-safety-set8910805
Ref: 26fa8910805
Node: Thread safety for bytearray objects8914613
Ref: library/threadsafety thread-safety-bytearray8914792
Ref: 26bb8914792
Ref: library/threadsafety thread-safety-for-bytearray-objects8914792
Ref: 278c8914792
Node: Thread safety for memoryview objects8917553
Ref: library/threadsafety thread-safety-for-memoryview-objects8917694
Ref: 278d8917694
Ref: library/threadsafety thread-safety-memoryview8917694
Ref: 24718917694
Ref: library/text stringservices8919620
Ref: 26aa8919620
Node: テキスト処理サービス8919620
Ref: library/text doc8919784
Ref: 278e8919784
Ref: library/text text-processing-services8919784
Ref: 278f8919784
Ref: library/text textservices8919784
Ref: 26ac8919784
Ref: library/text translation-repo8919784
Ref: 27908919784
Node: string --- 一般的な文字列操作8921175
Ref: library/string doc8921366
Ref: 27928921366
Ref: library/string module-string8921366
Ref: d88921366
Ref: library/string string-common-string-operations8921366
Ref: 27938921366
Ref: string --- 一般的な文字列操作-Footnote-18921868
Node: 文字列定数8921944
Ref: library/string string-constants8922067
Ref: 27948922067
Ref: library/string string ascii_letters8922189
Ref: 14df8922189
Ref: library/string string ascii_lowercase8922382
Ref: 27958922382
Ref: library/string string ascii_uppercase8922539
Ref: 27968922539
Ref: library/string string digits8922696
Ref: 27978922696
Ref: library/string string hexdigits8922771
Ref: 27988922771
Ref: library/string string octdigits8922861
Ref: 27998922861
Ref: library/string string punctuation8922937
Ref: 279a8922937
Ref: library/string string printable8923154
Ref: 19198923154
Ref: library/string string whitespace8923622
Ref: 279b8923622
Ref: 文字列定数-Footnote-18923980
Node: Custom string formatting8924026
Ref: library/string custom-string-formatting8924178
Ref: 279c8924178
Ref: library/string string-formatting8924178
Ref: 26a98924178
Ref: library/string string Formatter8924615
Ref: 10c18924615
Ref: library/string string Formatter format8924730
Ref: dfe8924730
Ref: library/string string Formatter vformat8925175
Ref: 279d8925175
Ref: library/string string Formatter parse8926090
Ref: 279e8926090
Ref: library/string string Formatter get_field8927059
Ref: 279f8927059
Ref: library/string string Formatter get_value8927690
Ref: 27a08927690
Ref: library/string string Formatter check_unused_args8929177
Ref: 27a18929177
Ref: library/string string Formatter format_field8929870
Ref: 27a28929870
Ref: library/string string Formatter convert_field8930182
Ref: 27a38930182
Ref: Custom string formatting-Footnote-18930592
Ref: Custom string formatting-Footnote-28930634
Node: Format string syntax8930676
Ref: library/string format-string-syntax8930839
Ref: 27a48930839
Ref: library/string formatstrings8930839
Ref: 15b78930839
Ref: library/string grammar-token-format-string-replacement_field8931788
Ref: 27a58931788
Ref: library/string grammar-token-format-string-field_name8931907
Ref: 27a68931907
Ref: library/string grammar-token-format-string-arg_name8932025
Ref: 27a98932025
Ref: library/string grammar-token-format-string-attribute_name8932097
Ref: 27aa8932097
Ref: library/string grammar-token-format-string-element_index8932145
Ref: 27ab8932145
Ref: library/string grammar-token-format-string-index_string8932217
Ref: 27ac8932217
Ref: library/string grammar-token-format-string-conversion8932277
Ref: 27a78932277
Ref: library/string grammar-token-format-string-format_spec8932317
Ref: 27a88932317
Ref: library/string formatstrings-conversion8935102
Ref: 27ae8935102
Node: Format specification mini-language8937162
Ref: library/string format-specification-mini-language8937277
Ref: 27b08937277
Ref: library/string formatspec8937277
Ref: 4f98937277
Ref: library/string grammar-token-format-spec-format_spec8938281
Ref: 27ad8938281
Ref: library/string grammar-token-format-spec-options8938387
Ref: 27b18938387
Ref: library/string grammar-token-format-spec-fill8938491
Ref: 27b48938491
Ref: library/string grammar-token-format-spec-align8938537
Ref: 27b58938537
Ref: library/string grammar-token-format-spec-sign8938589
Ref: 27b68938589
Ref: library/string grammar-token-format-spec-width_and_precision8938635
Ref: 27b28938635
Ref: library/string grammar-token-format-spec-width_with_grouping8938738
Ref: 27b78938738
Ref: library/string grammar-token-format-spec-precision_with_grouping8938812
Ref: 27b88938812
Ref: library/string grammar-token-format-spec-width8938922
Ref: 27b98938922
Ref: library/string grammar-token-format-spec-precision8938972
Ref: 27bb8938972
Ref: library/string grammar-token-format-spec-grouping8939022
Ref: 27ba8939022
Ref: library/string grammar-token-format-spec-type8939062
Ref: 27b38939062
Ref: library/string n-format-integer8947595
Ref: 27bd8947595
Ref: library/string n-format-float8953145
Ref: 27bc8953145
Ref: Format specification mini-language-Footnote-18955758
Ref: Format specification mini-language-Footnote-28955800
Ref: Format specification mini-language-Footnote-38955842
Node: 書式指定例8955884
Ref: library/string format-examples8955999
Ref: 27c08955999
Ref: library/string formatexamples8955999
Ref: 27af8955999
Node: Template strings $-strings8961051
Ref: library/string template-strings-pep2928961208
Ref: 27c18961208
Ref: library/string template-strings-strings8961208
Ref: 27c28961208
Ref: library/string string Template8963765
Ref: 8988963765
Ref: library/string string Template substitute8963911
Ref: 21308963911
Ref: library/string string Template safe_substitute8964584
Ref: 21318964584
Ref: library/string string Template is_valid8965817
Ref: 8978965817
Ref: library/string string Template get_identifiers8966053
Ref: 8968966053
Ref: library/string string Template template8966433
Ref: 27c48966433
Ref: Template strings $-strings-Footnote-18971557
Ref: Template strings $-strings-Footnote-28971599
Node: ヘルパー関数8971651
Ref: library/string helper-functions8971779
Ref: 27c58971779
Ref: library/string string capwords8971828
Ref: 26b08971828
Node: string templatelib --- テンプレート文字列リテラルのサポート8972457
Ref: library/string templatelib doc8972682
Ref: 27c68972682
Ref: library/string templatelib module-string templatelib8972682
Ref: d98972682
Ref: library/string templatelib string-templatelib-support-for-template-string-literals8972682
Ref: 27c78972682
Ref: library/string templatelib translation-repo8972682
Ref: 27c88972682
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-18973262
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-28973341
Node: テンプレート文字列8973383
Ref: library/string templatelib id18973536
Ref: 27c98973536
Ref: library/string templatelib template-strings8973536
Ref: 27c38973536
Node: 型8974247
Ref: library/string templatelib types8974430
Ref: 27ca8974430
Ref: library/string templatelib string templatelib Template8974454
Ref: 16b8974454
Ref: library/string templatelib string templatelib Template strings8975957
Ref: 27cb8975957
Ref: library/string templatelib string templatelib Template interpolations8976921
Ref: 27cc8976921
Ref: library/string templatelib string templatelib Template values8977501
Ref: 27cd8977501
Ref: library/string templatelib string templatelib Template __new__8978031
Ref: 27ce8978031
Ref: library/string templatelib string templatelib Interpolation8981858
Ref: 16c8981858
Ref: library/string templatelib string templatelib Interpolation value8982787
Ref: 27cf8982787
Ref: library/string templatelib string templatelib Interpolation expression8982959
Ref: 27d08982959
Ref: library/string templatelib string templatelib Interpolation conversion8983810
Ref: 26b68983810
Ref: library/string templatelib string templatelib Interpolation format_spec8984575
Ref: 27d28984575
Ref: library/string templatelib string templatelib Interpolation __new__8985486
Ref: 27d38985486
Node: ヘルパー関数<2>8986256
Ref: library/string templatelib helper-functions8986403
Ref: 27d48986403
Ref: library/string templatelib string templatelib convert8986452
Ref: 27d18986452
Node: re --- 正規表現操作8987050
Ref: library/re doc8987273
Ref: 27d58987273
Ref: library/re module-re8987273
Ref: be8987273
Ref: library/re re-regular-expression-operations8987273
Ref: 27d68987273
Ref: library/re translation-repo8987273
Ref: 27d78987273
Ref: re --- 正規表現操作-Footnote-18990360
Ref: re --- 正規表現操作-Footnote-28990420
Node: Regular Expression Syntax8990460
Ref: library/re re-syntax8990571
Ref: 9328990571
Ref: library/re regular-expression-syntax8990571
Ref: 27d88990571
Ref: library/re re-conditional-expression9015178
Ref: 1b879015178
Ref: library/re re-special-sequences9016049
Ref: 27e59016049
Ref: Regular Expression Syntax-Footnote-19023559
Ref: Regular Expression Syntax-Footnote-29023601
Node: Module Contents9023673
Ref: library/re contents-of-module-re9023819
Ref: 27e49023819
Ref: library/re module-contents9023819
Ref: 27e69023819
Node: フラグ9024290
Ref: library/re flags9024369
Ref: 27e79024369
Ref: library/re re RegexFlag9024575
Ref: 83f9024575
Ref: library/re re A9024746
Ref: 27dd9024746
Ref: library/re re ASCII9024766
Ref: 83e9024766
Ref: library/re re DEBUG9025501
Ref: 27e89025501
Ref: library/re re I9025675
Ref: 27de9025675
Ref: library/re re IGNORECASE9025695
Ref: 1af79025695
Ref: library/re re L9026767
Ref: 27df9026767
Ref: library/re re LOCALE9026787
Ref: d679026787
Ref: library/re re M9027882
Ref: 27e09027882
Ref: library/re re MULTILINE9027902
Ref: 27dc9027902
Ref: library/re re NOFLAG9028503
Ref: 27e99028503
Ref: library/re re S9028899
Ref: 27e19028899
Ref: library/re re DOTALL9028919
Ref: 27db9028919
Ref: library/re re U9029240
Ref: 27e29029240
Ref: library/re re UNICODE9029260
Ref: d689029260
Ref: library/re re X9029561
Ref: 27e39029561
Ref: library/re re VERBOSE9029581
Ref: 27ea9029581
Node: 関数<2>9030824
Ref: library/re functions9030921
Ref: 27eb9030921
Ref: library/re re compile9030950
Ref: dd29030950
Ref: library/re re search9032188
Ref: 14489032188
Ref: library/re re match9032873
Ref: 14499032873
Ref: library/re re fullmatch9033843
Ref: 118b9033843
Ref: library/re re split9034417
Ref: 5a29034417
Ref: library/re re findall9036914
Ref: 122f9036914
Ref: library/re re finditer9038183
Ref: 17189038183
Ref: library/re re sub9038917
Ref: 5a39038917
Ref: library/re re subn9043208
Ref: 5a49043208
Ref: library/re re escape9043606
Ref: e079043606
Ref: library/re re purge9045233
Ref: 27ef9045233
Node: 例外<3>9045319
Ref: library/re exceptions9045398
Ref: 27f09045398
Ref: library/re re PatternError9045427
Ref: 5469045427
Ref: library/re re PatternError msg9045877
Ref: 104f9045877
Ref: library/re re PatternError pattern9045983
Ref: 10509045983
Ref: library/re re PatternError pos9046060
Ref: 10519046060
Ref: library/re re PatternError lineno9046224
Ref: 10529046224
Ref: library/re re PatternError colno9046335
Ref: 10539046335
Node: Regular Expression Objects9046680
Ref: library/re re-objects9046814
Ref: 118d9046814
Ref: library/re regular-expression-objects9046814
Ref: 27f19046814
Ref: library/re re Pattern9046885
Ref: 1bc69046885
Ref: library/re re Pattern search9047298
Ref: 27ed9047298
Ref: library/re re Pattern match9049028
Ref: 27ec9049028
Ref: library/re re Pattern fullmatch9050032
Ref: 118c9050032
Ref: library/re re Pattern split9050904
Ref: 27f29050904
Ref: library/re re Pattern findall9051069
Ref: 27f39051069
Ref: library/re re Pattern finditer9051379
Ref: 27f49051379
Ref: library/re re Pattern sub9051691
Ref: 27f59051691
Ref: library/re re Pattern subn9051855
Ref: 27f69051855
Ref: library/re re Pattern flags9052021
Ref: 27f79052021
Ref: library/re re Pattern groups9052380
Ref: 27f89052380
Ref: library/re re Pattern groupindex9052478
Ref: 27f99052478
Ref: library/re re Pattern pattern9052775
Ref: 27fa9052775
Node: Match Objects9053153
Ref: library/re id39053299
Ref: 27fb9053299
Ref: library/re match-objects9053299
Ref: 118e9053299
Ref: library/re re Match9053678
Ref: ec79053678
Ref: library/re re Match expand9054083
Ref: 27fc9054083
Ref: library/re re Match group9054723
Ref: 12309054723
Ref: library/re re Match __getitem__9057073
Ref: 27fd9057073
Ref: library/re re Match groups9057804
Ref: 12319057804
Ref: library/re re Match groupdict9058768
Ref: 27fe9058768
Ref: library/re re Match start9059291
Ref: 27ff9059291
Ref: library/re re Match end9059331
Ref: 28009059331
Ref: library/re re Match span9060630
Ref: 28019060630
Ref: library/re re Match pos9060933
Ref: 28029060933
Ref: library/re re Match endpos9061220
Ref: 28039061220
Ref: library/re re Match lastindex9061504
Ref: 28049061504
Ref: library/re re Match lastgroup9061954
Ref: 28059061954
Ref: library/re re Match re9062188
Ref: 28069062188
Ref: library/re re Match string9062413
Ref: 28079062413
Node: Regular Expression Examples9062757
Ref: library/re re-examples9062868
Ref: 14799062868
Ref: library/re regular-expression-examples9062868
Ref: 28089062868
Node: Checking for a Pair9063246
Ref: library/re checking-for-a-pair9063371
Ref: 28099063371
Node: scanf をシミュレートする9065660
Ref: library/re simulating-scanf9065809
Ref: 280a9065809
Node: search vs match9067955
Ref: library/re id49068103
Ref: 280b9068103
Ref: library/re search-vs-match9068103
Ref: 27ee9068103
Node: Making a Phonebook9069556
Ref: library/re making-a-phonebook9069683
Ref: 280c9069683
Node: Text Munging9072143
Ref: library/re text-munging9072274
Ref: 280d9072274
Node: Finding all Adverbs9073183
Ref: library/re finding-all-adverbs9073335
Ref: 280e9073335
Node: Finding all Adverbs and their Positions9073851
Ref: library/re finding-all-adverbs-and-their-positions9074010
Ref: 280f9074010
Node: Raw String Notation9074732
Ref: library/re raw-string-notation9074891
Ref: 28109074891
Node: Writing a Tokenizer9075956
Ref: library/re writing-a-tokenizer9076067
Ref: 28119076067
Ref: library/re frie099079561
Ref: 27d99079561
Ref: Writing a Tokenizer-Footnote-19079877
Node: difflib --- 差分の計算の補助9079932
Ref: library/difflib doc9080133
Ref: 28129080133
Ref: library/difflib difflib-helpers-for-computing-deltas9080133
Ref: 28139080133
Ref: library/difflib module-difflib9080133
Ref: 3b9080133
Ref: library/difflib translation-repo9080133
Ref: 28149080133
Ref: library/difflib difflib Differ9083332
Ref: 28159083332
Ref: library/difflib difflib HtmlDiff9084658
Ref: 2039084658
Ref: library/difflib difflib HtmlDiff __init__9085181
Ref: 28169085181
Ref: library/difflib difflib HtmlDiff make_file9086232
Ref: ff49086232
Ref: library/difflib difflib HtmlDiff make_table9088378
Ref: 28189088378
Ref: library/difflib difflib context_diff9088865
Ref: 19e69088865
Ref: library/difflib difflib get_close_matches9091237
Ref: 281b9091237
Ref: library/difflib difflib ndiff9092598
Ref: 28179092598
Ref: library/difflib difflib restore9094356
Ref: 281d9094356
Ref: library/difflib difflib unified_diff9095230
Ref: 19e59095230
Ref: library/difflib difflib diff_bytes9097436
Ref: ff59097436
Ref: library/difflib difflib IS_LINE_JUNK9098696
Ref: 2d99098696
Ref: library/difflib difflib IS_CHARACTER_JUNK9099072
Ref: 281c9099072
Ref: difflib --- 差分の計算の補助-Footnote-19099842
Ref: difflib --- 差分の計算の補助-Footnote-29099909
Node: SequenceMatcher objects9099989
Ref: library/difflib sequence-matcher9100118
Ref: 281f9100118
Ref: library/difflib sequencematcher-objects9100118
Ref: 28209100118
Ref: library/difflib difflib SequenceMatcher9100288
Ref: 121f9100288
Ref: library/difflib difflib SequenceMatcher set_seqs9102329
Ref: 28219102329
Ref: library/difflib difflib SequenceMatcher set_seq19102882
Ref: 28239102882
Ref: library/difflib difflib SequenceMatcher set_seq29103070
Ref: 28229103070
Ref: library/difflib difflib SequenceMatcher find_longest_match9103258
Ref: 1da99103258
Ref: library/difflib difflib SequenceMatcher get_matching_blocks9105797
Ref: 28249105797
Ref: library/difflib difflib SequenceMatcher get_opcodes9106886
Ref: 28259106886
Ref: library/difflib difflib SequenceMatcher get_grouped_opcodes9108997
Ref: 28269108997
Ref: library/difflib difflib SequenceMatcher ratio9109539
Ref: 28279109539
Ref: library/difflib difflib SequenceMatcher quick_ratio9110810
Ref: 28289110810
Ref: library/difflib difflib SequenceMatcher real_quick_ratio9110930
Ref: 28299110930
Node: SequenceMatcher examples9111481
Ref: library/difflib id19111633
Ref: 282a9111633
Ref: library/difflib sequencematcher-examples9111633
Ref: 282b9111633
Ref: SequenceMatcher examples-Footnote-19113399
Node: Differ objects9113476
Ref: library/difflib differ-objects9113619
Ref: 282c9113619
Ref: library/difflib id29113619
Ref: 282d9113619
Ref: library/difflib difflib Differ compare9115578
Ref: 281e9115578
Node: Differ example9116351
Ref: library/difflib differ-example9116526
Ref: 282e9116526
Ref: library/difflib differ-examples9116526
Ref: 282f9116526
Node: difflib のコマンドラインインターフェース9118961
Ref: library/difflib a-command-line-interface-to-difflib9119135
Ref: 28309119135
Ref: library/difflib difflib-interface9119135
Ref: 281a9119135
Node: ndiff example9121791
Ref: library/difflib ndiff-example9121942
Ref: 28319121942
Node: textwrap --- テキストの折り返しと詰め込み9125592
Ref: library/textwrap doc9125810
Ref: 28329125810
Ref: library/textwrap module-textwrap9125810
Ref: f29125810
Ref: library/textwrap textwrap-text-wrapping-and-filling9125810
Ref: 28339125810
Ref: library/textwrap translation-repo9125810
Ref: 28349125810
Ref: library/textwrap textwrap wrap9126356
Ref: 16e59126356
Ref: library/textwrap textwrap fill9127230
Ref: 16e49127230
Ref: library/textwrap textwrap shorten9127939
Ref: 11d69127939
Ref: library/textwrap textwrap dedent9129401
Ref: 1aa9129401
Ref: library/textwrap textwrap indent9130795
Ref: 57d9130795
Ref: library/textwrap textwrap TextWrapper9132424
Ref: 11d39132424
Ref: library/textwrap textwrap TextWrapper width9133266
Ref: 283b9133266
Ref: library/textwrap textwrap TextWrapper expand_tabs9133594
Ref: 28379133594
Ref: library/textwrap textwrap TextWrapper tabsize9133860
Ref: 28369133860
Ref: library/textwrap textwrap TextWrapper replace_whitespace9134162
Ref: 28399134162
Ref: library/textwrap textwrap TextWrapper drop_whitespace9135167
Ref: 28389135167
Ref: library/textwrap textwrap TextWrapper initial_indent9135631
Ref: 283c9135631
Ref: library/textwrap textwrap TextWrapper subsequent_indent9135885
Ref: 283d9135885
Ref: library/textwrap textwrap TextWrapper fix_sentence_endings9136178
Ref: 283e9136178
Ref: library/textwrap textwrap TextWrapper break_long_words9137546
Ref: 283a9137546
Ref: library/textwrap textwrap TextWrapper break_on_hyphens9138077
Ref: 283f9138077
Ref: library/textwrap textwrap TextWrapper max_lines9138751
Ref: 11d49138751
Ref: library/textwrap textwrap TextWrapper placeholder9139053
Ref: 11d59139053
Ref: library/textwrap textwrap TextWrapper wrap9139395
Ref: 28359139395
Ref: library/textwrap textwrap TextWrapper fill9139862
Ref: 28409139862
Ref: textwrap --- テキストの折り返しと詰め込み-Footnote-19140093
Node: unicodedata --- Unicode データベース9140161
Ref: library/unicodedata doc9140397
Ref: 28419140397
Ref: library/unicodedata module-unicodedata9140397
Ref: 10c9140397
Ref: library/unicodedata translation-repo9140397
Ref: 28429140397
Ref: library/unicodedata unicodedata-unicode-database9140397
Ref: 28439140397
Ref: library/unicodedata unicodedata lookup9141041
Ref: 12889141041
Ref: library/unicodedata unicodedata name9141694
Ref: 28449141694
Ref: library/unicodedata unicodedata decimal9142090
Ref: 28459142090
Ref: library/unicodedata unicodedata digit9142507
Ref: 28469142507
Ref: library/unicodedata unicodedata numeric9142821
Ref: 147e9142821
Ref: library/unicodedata unicodedata category9143123
Ref: 28479143123
Ref: library/unicodedata unicodedata bidirectional9143524
Ref: 28489143524
Ref: library/unicodedata unicodedata combining9143984
Ref: 28499143984
Ref: library/unicodedata unicodedata east_asian_width9144290
Ref: 284a9144290
Ref: library/unicodedata unicodedata mirrored9144515
Ref: 284b9144515
Ref: library/unicodedata unicodedata decomposition9144842
Ref: 17d29144842
Ref: library/unicodedata unicodedata normalize9145141
Ref: 8e59145141
Ref: library/unicodedata unicodedata is_normalized9147149
Ref: c409147149
Ref: library/unicodedata unicodedata unidata_version9147450
Ref: 284c9147450
Ref: library/unicodedata unicodedata ucd_3_2_09147591
Ref: 16529147591
Ref: unicodedata --- Unicode データベース-Footnote-19147908
Ref: unicodedata --- Unicode データベース-Footnote-29147958
Ref: unicodedata --- Unicode データベース-Footnote-39148004
Ref: unicodedata --- Unicode データベース-Footnote-49148076
Ref: unicodedata --- Unicode データベース-Footnote-59148151
Ref: unicodedata --- Unicode データベース-Footnote-69148234
Ref: unicodedata --- Unicode データベース-Footnote-79148311
Ref: unicodedata --- Unicode データベース-Footnote-89148403
Node: stringprep --- インターネットの文字列調製9148461
Ref: library/stringprep doc9148695
Ref: 284d9148695
Ref: library/stringprep module-stringprep9148695
Ref: da9148695
Ref: library/stringprep stringprep-internet-string-preparation9148695
Ref: 284e9148695
Ref: library/stringprep translation-repo9148695
Ref: 284f9148695
Ref: library/stringprep stringprep in_table_a19150983
Ref: 28509150983
Ref: library/stringprep stringprep in_table_b19151185
Ref: 28519151185
Ref: library/stringprep stringprep map_table_b29151382
Ref: 28529151382
Ref: library/stringprep stringprep map_table_b39151578
Ref: 28539151578
Ref: library/stringprep stringprep in_table_c119151775
Ref: 28549151775
Ref: library/stringprep stringprep in_table_c129151915
Ref: 28559151915
Ref: library/stringprep stringprep in_table_c11_c129152065
Ref: 28569152065
Ref: library/stringprep stringprep in_table_c219152244
Ref: 28579152244
Ref: library/stringprep stringprep in_table_c229152378
Ref: 28589152378
Ref: library/stringprep stringprep in_table_c21_c229152516
Ref: 28599152516
Ref: library/stringprep stringprep in_table_c39152689
Ref: 285a9152689
Ref: library/stringprep stringprep in_table_c49152826
Ref: 285b9152826
Ref: library/stringprep stringprep in_table_c59153001
Ref: 285c9153001
Ref: library/stringprep stringprep in_table_c69153144
Ref: 285d9153144
Ref: library/stringprep stringprep in_table_c79153299
Ref: 285e9153299
Ref: library/stringprep stringprep in_table_c89153474
Ref: 285f9153474
Ref: library/stringprep stringprep in_table_c99153638
Ref: 28609153638
Ref: library/stringprep stringprep in_table_d19153763
Ref: 28619153763
Ref: library/stringprep stringprep in_table_d29153940
Ref: 28629153940
Ref: stringprep --- インターネットの文字列調製-Footnote-19154139
Ref: stringprep --- インターネットの文字列調製-Footnote-29154209
Ref: stringprep --- インターネットの文字列調製-Footnote-39154268
Node: readline --- GNU readline のインターフェース9154327
Ref: library/readline doc9154563
Ref: 28639154563
Ref: library/readline module-readline9154563
Ref: bf9154563
Ref: library/readline readline-gnu-readline-interface9154563
Ref: 28649154563
Ref: library/readline translation-repo9154563
Ref: 28659154563
Ref: library/readline readline backend9157127
Ref: 1a899157127
Ref: readline --- GNU readline のインターフェース-Footnote-19157494
Node: 初期化ファイル9157579
Ref: library/readline init-file9157714
Ref: 28669157714
Ref: library/readline readline parse_and_bind9157858
Ref: 28679157858
Ref: library/readline readline read_init_file9158040
Ref: 18449158040
Node: 行バッファ9158514
Ref: library/readline line-buffer9158676
Ref: 28689158676
Ref: library/readline readline get_line_buffer9158774
Ref: 28699158774
Ref: library/readline readline insert_text9158926
Ref: 286a9158926
Ref: library/readline readline redisplay9159137
Ref: 16e39159137
Node: 履歴ファイル9159341
Ref: library/readline history-file9159497
Ref: 286b9159497
Ref: library/readline readline read_history_file9159603
Ref: 18459159603
Ref: library/readline readline write_history_file9160029
Ref: 18469160029
Ref: library/readline readline append_history_file9160479
Ref: 10559160479
Ref: library/readline readline get_history_length9161077
Ref: 286c9161077
Ref: library/readline readline set_history_length9161123
Ref: 19869161123
Node: 履歴リスト9161487
Ref: library/readline history-list9161643
Ref: 286d9161643
Ref: library/readline readline clear_history9161759
Ref: 286e9161759
Ref: library/readline readline get_current_history_length9162008
Ref: 16e29162008
Ref: library/readline readline get_history_item9162229
Ref: 16e19162229
Ref: library/readline readline remove_history_item9162440
Ref: 286f9162440
Ref: library/readline readline replace_history_item9162661
Ref: 28709162661
Ref: library/readline readline add_history9162893
Ref: 28719162893
Ref: library/readline readline set_auto_history9163078
Ref: ec99163078
Node: 開始フック9163536
Ref: library/readline startup-hooks9163680
Ref: 28729163680
Ref: library/readline readline set_startup_hook9163724
Ref: 28739163724
Ref: library/readline readline set_pre_input_hook9164129
Ref: 28749164129
Node: 補完9164702
Ref: library/readline completion9164843
Ref: 28759164843
Ref: library/readline readline-completion9164843
Ref: 28769164843
Ref: library/readline readline set_completer9165314
Ref: 28779165314
Ref: library/readline readline get_completer9166285
Ref: 28789166285
Ref: library/readline readline get_completion_type9166455
Ref: 28799166455
Ref: library/readline readline get_begidx9166656
Ref: 1cff9166656
Ref: library/readline readline get_endidx9166694
Ref: 1d009166694
Ref: library/readline readline set_completer_delims9167140
Ref: 1a8c9167140
Ref: library/readline readline get_completer_delims9167194
Ref: 287a9167194
Ref: library/readline readline set_completion_display_matches_hook9167516
Ref: 287b9167516
Node: 使用例<2>9168106
Ref: library/readline example9168223
Ref: 287c9168223
Ref: library/readline readline-example9168223
Ref: 287d9168223
Node: rlcompleter --- GNU readline の補完機能9171196
Ref: library/rlcompleter doc9171369
Ref: 287f9171369
Ref: library/rlcompleter module-rlcompleter9171369
Ref: c29171369
Ref: library/rlcompleter rlcompleter-completion-function-for-gnu-readline9171369
Ref: 28809171369
Ref: library/rlcompleter translation-repo9171369
Ref: 28819171369
Ref: library/rlcompleter completer-objects9172900
Ref: 28839172900
Ref: library/rlcompleter rlcompleter Completer9172900
Ref: 1d899172900
Ref: library/rlcompleter rlcompleter Completer complete9173018
Ref: 28829173018
Ref: rlcompleter --- GNU readline の補完機能-Footnote-19174089
Node: バイナリデータ処理9174160
Ref: library/binary doc9174312
Ref: 28849174312
Ref: library/binary binary-data-services9174312
Ref: 28859174312
Ref: library/binary binaryservices9174312
Ref: 27919174312
Ref: library/binary translation-repo9174312
Ref: 28869174312
Node: struct --- バイト列をパックされたバイナリデータとして解釈する9175456
Ref: library/struct doc9175665
Ref: 28879175665
Ref: library/struct struct-interpret-bytes-as-packed-binary-data9175665
Ref: 28889175665
Ref: library/struct module-struct9175833
Ref: db9175833
Ref: struct --- バイト列をパックされたバイナリデータとして解釈する-Footnote-19177660
Node: 関数と例外9177726
Ref: library/struct functions-and-exceptions9177888
Ref: 288b9177888
Ref: library/struct struct error9178007
Ref: 153f9178007
Ref: library/struct struct pack9178157
Ref: 14929178157
Ref: library/struct struct pack_into9178476
Ref: 288c9178476
Ref: library/struct struct unpack9178806
Ref: 18bf9178806
Ref: library/struct struct unpack_from9179284
Ref: 288d9179284
Ref: library/struct struct iter_unpack9179779
Ref: 11c59179779
Ref: library/struct struct calcsize9180431
Ref: 1e069180431
Node: 書式文字列9180659
Ref: library/struct format-strings9180854
Ref: 288e9180854
Ref: library/struct struct-format-strings9180854
Ref: 28899180854
Node: バイトオーダ、サイズ、アラインメント9181485
Ref: library/struct byte-order-size-and-alignment9181618
Ref: 288f9181618
Ref: library/struct struct-alignment9181618
Ref: 288a9181618
Ref: バイトオーダ、サイズ、アラインメント-Footnote-19186307
Node: 書式指定文字9186361
Ref: library/struct format-characters9186515
Ref: 124f9186515
Ref: library/struct id19186515
Ref: 28919186515
Ref: 書式指定文字-Footnote-19200827
Ref: 書式指定文字-Footnote-29200924
Ref: 書式指定文字-Footnote-39200985
Node: 使用例<3>9201061
Ref: library/struct examples9201152
Ref: 28939201152
Ref: library/struct struct-examples9201152
Ref: 28909201152
Node: アプリケーション9203776
Ref: library/struct applications9203968
Ref: 28949203968
Ref: library/struct id29203968
Ref: 28959203968
Node: Native Formats9204480
Ref: library/struct native-formats9204580
Ref: 28989204580
Ref: library/struct struct-native-formats9204580
Ref: 28969204580
Node: Standard Formats9205728
Ref: library/struct standard-formats9205828
Ref: 28999205828
Ref: library/struct struct-standard-formats9205828
Ref: 28979205828
Node: クラス<3>9207267
Ref: library/struct classes9207435
Ref: 289a9207435
Ref: library/struct struct-objects9207435
Ref: 289b9207435
Ref: library/struct struct Struct9207527
Ref: 17ce9207527
Ref: library/struct struct Struct pack9208401
Ref: 289c9208401
Ref: library/struct struct Struct pack_into9208661
Ref: 289e9208661
Ref: library/struct struct Struct unpack9208869
Ref: 289f9208869
Ref: library/struct struct Struct unpack_from9209149
Ref: 28a09209149
Ref: library/struct struct Struct iter_unpack9209501
Ref: 11c69209501
Ref: library/struct struct Struct format9209824
Ref: e049209824
Ref: library/struct struct Struct size9210106
Ref: 289d9210106
Node: codecs --- codec レジストリと基底クラス9210482
Ref: library/codecs doc9210691
Ref: 28a19210691
Ref: library/codecs codecs-codec-registry-and-base-classes9210691
Ref: 28a29210691
Ref: library/codecs module-codecs9210691
Ref: 1c9210691
Ref: library/codecs translation-repo9210691
Ref: 28a39210691
Ref: library/codecs codecs encode9211876
Ref: 11089211876
Ref: library/codecs codecs decode9212588
Ref: 11099212588
Ref: library/codecs codecs charmap_build9213268
Ref: 28a59213268
Ref: library/codecs codecs lookup9213796
Ref: b609213796
Ref: library/codecs codecs CodecInfo9214324
Ref: 1acd9214324
Ref: library/codecs codecs CodecInfo name9214656
Ref: 28a69214656
Ref: library/codecs codecs CodecInfo encode9214736
Ref: 28a79214736
Ref: library/codecs codecs CodecInfo decode9214763
Ref: 28a89214763
Ref: library/codecs codecs CodecInfo incrementalencoder9215314
Ref: 28ac9215314
Ref: library/codecs codecs CodecInfo incrementaldecoder9215353
Ref: 28ad9215353
Ref: library/codecs codecs CodecInfo streamwriter9215854
Ref: 28b09215854
Ref: library/codecs codecs CodecInfo streamreader9215887
Ref: 28b19215887
Ref: library/codecs codecs getencoder9216569
Ref: 28b49216569
Ref: library/codecs codecs getdecoder9216850
Ref: 28b59216850
Ref: library/codecs codecs getincrementalencoder9217128
Ref: 28b69217128
Ref: library/codecs codecs getincrementaldecoder9217562
Ref: 28b79217562
Ref: library/codecs codecs getreader9217990
Ref: 28b89217990
Ref: library/codecs codecs getwriter9218313
Ref: 28b99218313
Ref: library/codecs codecs register9218774
Ref: 28ba9218774
Ref: library/codecs codecs unregister9219260
Ref: 9ed9219260
Ref: library/codecs codecs open9219883
Ref: 3179219883
Ref: library/codecs codecs EncodedFile9221772
Ref: 28bc9221772
Ref: library/codecs codecs iterencode9222953
Ref: 28bd9222953
Ref: library/codecs codecs iterdecode9223651
Ref: 28be9223651
Ref: library/codecs codecs readbuffer_encode9224426
Ref: 28bf9224426
Ref: library/codecs codecs BOM9224974
Ref: 28c09224974
Ref: library/codecs codecs BOM_BE9225000
Ref: 28c19225000
Ref: library/codecs codecs BOM_LE9225029
Ref: 28c29225029
Ref: library/codecs codecs BOM_UTF89225058
Ref: 28c39225058
Ref: library/codecs codecs BOM_UTF169225089
Ref: 28c49225089
Ref: library/codecs codecs BOM_UTF16_BE9225121
Ref: 28c59225121
Ref: library/codecs codecs BOM_UTF16_LE9225156
Ref: 28c69225156
Ref: library/codecs codecs BOM_UTF329225191
Ref: 28c79225191
Ref: library/codecs codecs BOM_UTF32_BE9225223
Ref: 28c89225223
Ref: library/codecs codecs BOM_UTF32_LE9225258
Ref: 28c99225258
Ref: codecs --- codec レジストリと基底クラス-Footnote-19226737
Node: Codec 基底クラス9226803
Ref: library/codecs codec-base-classes9226955
Ref: 28a49226955
Ref: library/codecs id19226955
Ref: 28ca9226955
Ref: library/codecs surrogateescape9227747
Ref: 28cb9227747
Node: エラーハンドラ9227955
Ref: library/codecs error-handlers9228094
Ref: 1bce9228094
Ref: library/codecs id29228094
Ref: 28cc9228094
Ref: library/codecs codecs register_error9233395
Ref: 16b99233395
Ref: library/codecs codecs lookup_error9235291
Ref: 16ba9235291
Ref: library/codecs codecs strict_errors9235630
Ref: 28cd9235630
Ref: library/codecs codecs ignore_errors9235803
Ref: 28ce9235803
Ref: library/codecs codecs replace_errors9236000
Ref: 19249236000
Ref: library/codecs codecs backslashreplace_errors9236251
Ref: 19259236251
Ref: library/codecs codecs xmlcharrefreplace_errors9236721
Ref: 19269236721
Ref: library/codecs codecs namereplace_errors9237086
Ref: 28cf9237086
Ref: エラーハンドラ-Footnote-19237650
Node: ステートレスなエンコードとデコード9237692
Ref: library/codecs codec-objects9237897
Ref: 28ab9237897
Ref: library/codecs stateless-encoding-and-decoding9237897
Ref: 28d09237897
Ref: library/codecs codecs Codec9238227
Ref: 28d19238227
Ref: library/codecs codecs Codec encode9238256
Ref: 28a99238256
Ref: library/codecs codecs Codec decode9239386
Ref: 28aa9239386
Node: インクリメンタルなエンコードとデコード9240964
Ref: library/codecs incremental-encoding-and-decoding9241196
Ref: 28d29241196
Node: IncrementalEncoder オブジェクト9242406
Ref: library/codecs incremental-encoder-objects9242583
Ref: 28d59242583
Ref: library/codecs incrementalencoder-objects9242583
Ref: 28d69242583
Ref: library/codecs codecs IncrementalEncoder9243018
Ref: 28ae9243018
Ref: library/codecs codecs IncrementalEncoder encode9244071
Ref: 28d39244071
Ref: library/codecs codecs IncrementalEncoder reset9244477
Ref: 28d79244477
Ref: library/codecs codecs IncrementalEncoder getstate9244850
Ref: 28d89244850
Ref: library/codecs codecs IncrementalEncoder setstate9245326
Ref: 28d99245326
Node: IncrementalDecoder オブジェクト9245575
Ref: library/codecs incremental-decoder-objects9245752
Ref: 28da9245752
Ref: library/codecs incrementaldecoder-objects9245752
Ref: 28db9245752
Ref: library/codecs codecs IncrementalDecoder9246181
Ref: 28af9246181
Ref: library/codecs codecs IncrementalDecoder decode9247231
Ref: 28d49247231
Ref: library/codecs codecs IncrementalDecoder reset9248104
Ref: 28dc9248104
Ref: library/codecs codecs IncrementalDecoder getstate9248203
Ref: 28dd9248203
Ref: library/codecs codecs IncrementalDecoder setstate9249336
Ref: 28de9249336
Node: ストリームのエンコードとデコード9249582
Ref: library/codecs stream-encoding-and-decoding9249754
Ref: 28df9249754
Node: StreamWriter オブジェクト9250249
Ref: library/codecs stream-writer-objects9250405
Ref: 28e09250405
Ref: library/codecs streamwriter-objects9250405
Ref: 28e19250405
Ref: library/codecs codecs StreamWriter9250785
Ref: 28b29250785
Ref: library/codecs codecs StreamWriter write9252041
Ref: 28e29252041
Ref: library/codecs codecs StreamWriter writelines9252173
Ref: 28e39252173
Ref: library/codecs codecs StreamWriter reset9252485
Ref: 28e49252485
Node: StreamReader オブジェクト9253108
Ref: library/codecs stream-reader-objects9253310
Ref: 28e59253310
Ref: library/codecs streamreader-objects9253310
Ref: 28e69253310
Ref: library/codecs codecs StreamReader9253690
Ref: 28b39253690
Ref: library/codecs codecs StreamReader read9255059
Ref: 28e79255059
Ref: library/codecs codecs StreamReader readline9256723
Ref: 28e89256723
Ref: library/codecs codecs StreamReader readlines9257148
Ref: 28e99257148
Ref: library/codecs codecs StreamReader reset9257661
Ref: 28ea9257661
Node: StreamReaderWriter オブジェクト9258227
Ref: library/codecs stream-reader-writer9258430
Ref: 28eb9258430
Ref: library/codecs streamreaderwriter-objects9258430
Ref: 28ec9258430
Ref: library/codecs codecs StreamReaderWriter9258785
Ref: 28bb9258785
Node: StreamRecoder オブジェクト9259661
Ref: library/codecs stream-recoder-objects9259824
Ref: 28ed9259824
Ref: library/codecs streamrecoder-objects9259824
Ref: 28ee9259824
Ref: library/codecs codecs StreamRecoder9260258
Ref: 1e309260258
Node: エンコーディングと Unicode9261724
Ref: library/codecs encodings-and-unicode9261915
Ref: 28ef9261915
Ref: library/codecs encodings-overview9261915
Ref: 28f09261915
Ref: エンコーディングと Unicode-Footnote-19270190
Node: 標準エンコーディング9270232
Ref: library/codecs id39270442
Ref: 28f19270442
Ref: library/codecs standard-encodings9270442
Ref: fbc9270442
Ref: 標準エンコーディング-Footnote-19293847
Node: Python 特有のエンコーディング9293925
Ref: library/codecs python-specific-encodings9294131
Ref: 28f29294131
Node: テキストエンコーディング9295144
Ref: library/codecs text-encodings9295302
Ref: 28f39295302
Ref: テキストエンコーディング-Footnote-19299723
Ref: テキストエンコーディング-Footnote-29299782
Node: バイナリ変換 Binary Transforms9299841
Ref: library/codecs binary-transforms9300034
Ref: 110a9300034
Ref: library/codecs id49300034
Ref: 28f49300034
Ref: バイナリ変換 Binary Transforms-Footnote-19304193
Node: Standalone Codec Functions9304399
Ref: library/codecs id69304590
Ref: 28fa9304590
Ref: library/codecs standalone-codec-functions9304590
Ref: 28fb9304590
Ref: library/codecs codecs codecs escape_encode9305004
Ref: 28fc9305004
Ref: library/codecs codecs codecs escape_decode9305377
Ref: 28fd9305377
Node: テキスト変換 Text Transforms9305701
Ref: library/codecs id79305847
Ref: 28fe9305847
Ref: library/codecs text-transforms9305847
Ref: 110b9305847
Node: encodings --- Encodings package9306893
Ref: library/codecs encodings-encodings-package9307134
Ref: 28ff9307134
Ref: library/codecs module-encodings9307134
Ref: 559307134
Ref: library/codecs encodings normalize_encoding9307272
Ref: a019307272
Ref: library/codecs encodings search_function9307852
Ref: 17cd9307852
Ref: library/codecs encodings win32_code_page_search_function9308548
Ref: 29009308548
Ref: library/codecs encodings CodecRegistryError9308931
Ref: 29019308931
Node: encodings idna --- Internationalized Domain Names in Applications9309027
Ref: library/codecs encodings-idna-internationalized-domain-names-in-applications9309268
Ref: 29029309268
Ref: library/codecs module-encodings idna9309268
Ref: 569309268
Ref: library/codecs encodings idna nameprep9312570
Ref: 29039312570
Ref: library/codecs encodings idna ToASCII9312797
Ref: 29049312797
Ref: library/codecs encodings idna ToUnicode9312986
Ref: 29059312986
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-19313150
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-29313209
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-39313268
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-49313327
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-59313386
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-69313425
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-79313496
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-89313555
Node: encodings mbcs --- Windows ANSI codepage9313614
Ref: library/codecs encodings-mbcs-windows-ansi-codepage9313878
Ref: 29069313878
Ref: library/codecs module-encodings mbcs9313878
Ref: 579313878
Node: encodings utf_8_sig --- UTF-8 codec with BOM signature9314352
Ref: library/codecs encodings-utf-8-sig-utf-8-codec-with-bom-signature9314542
Ref: 29079314542
Ref: library/codecs module-encodings utf_8_sig9314542
Ref: 589314542
Node: データ型9315186
Ref: library/datatypes doc9315338
Ref: 29089315338
Ref: library/datatypes data-types9315338
Ref: 29099315338
Ref: library/datatypes datatypes9315338
Ref: 290a9315338
Ref: library/datatypes translation-repo9315338
Ref: 290b9315338
Node: datetime --- 基本的な日付と時間の型9317454
Ref: library/datetime doc9317609
Ref: 290c9317609
Ref: library/datetime datetime-basic-date-and-time-types9317609
Ref: 290d9317609
Ref: library/datetime module-datetime9317609
Ref: 349317609
Ref: datetime --- 基本的な日付と時間の型-Footnote-19319128
Ref: datetime --- 基本的な日付と時間の型-Footnote-29319196
Ref: datetime --- 基本的な日付と時間の型-Footnote-39319247
Node: Aware and naive objects9319290
Ref: library/datetime aware-and-naive-objects9319411
Ref: 290f9319411
Ref: library/datetime datetime-naive-aware9319411
Ref: 29109319411
Ref: Aware and naive objects-Footnote-19321915
Node: 定数9321973
Ref: library/datetime constants9322118
Ref: 29119322118
Ref: library/datetime datetime MINYEAR9322225
Ref: 29129322225
Ref: library/datetime datetime MAXYEAR9322432
Ref: 29139322432
Ref: library/datetime datetime UTC9322642
Ref: 7139322642
Node: Available types9322799
Ref: library/datetime available-types9322938
Ref: 29149322938
Node: Common properties9325054
Ref: library/datetime common-properties9325174
Ref: 29259325174
Node: Determining if an object is aware or naive9325760
Ref: library/datetime determining-if-an-object-is-aware-or-naive9325880
Ref: 29269325880
Node: timedelta objects9326912
Ref: library/datetime datetime-timedelta9327057
Ref: 29279327057
Ref: library/datetime timedelta-objects9327057
Ref: 29289327057
Ref: library/datetime datetime timedelta9327293
Ref: bc79327293
Ref: library/datetime datetime timedelta min9330516
Ref: 29299330516
Ref: library/datetime datetime timedelta max9330664
Ref: 292a9330664
Ref: library/datetime datetime timedelta resolution9330876
Ref: 292b9330876
Ref: library/datetime datetime timedelta days9331345
Ref: 292c9331345
Ref: library/datetime datetime timedelta seconds9331439
Ref: 292d9331439
Ref: library/datetime datetime timedelta microseconds9331968
Ref: 292e9331968
Ref: library/datetime datetime timedelta total_seconds9338620
Ref: 15219338620
Ref: timedelta objects-Footnote-19339273
Node: Examples of usage timedelta9339353
Ref: library/datetime examples-of-usage-timedelta9339434
Ref: 292f9339434
Node: date objects9340360
Ref: library/datetime date-objects9340506
Ref: 29309340506
Ref: library/datetime datetime-date9340506
Ref: 29319340506
Ref: library/datetime datetime date9340846
Ref: 1fc9340846
Ref: library/datetime datetime date today9341373
Ref: 16e89341373
Ref: library/datetime datetime date fromtimestamp9341536
Ref: dd19341536
Ref: library/datetime datetime date fromordinal9342757
Ref: dd09342757
Ref: library/datetime datetime date fromisoformat9343160
Ref: 8289343160
Ref: library/datetime datetime date fromisocalendar9344180
Ref: be39344180
Ref: library/datetime datetime date strptime9344466
Ref: 1fb9344466
Ref: library/datetime datetime date min9346000
Ref: 29329346000
Ref: library/datetime datetime date max9346106
Ref: 29339346106
Ref: library/datetime datetime date resolution9346217
Ref: 29349346217
Ref: library/datetime datetime date year9346409
Ref: 29159346409
Ref: library/datetime datetime date month9346537
Ref: 29169346537
Ref: library/datetime datetime date day9346623
Ref: 29179346623
Ref: library/datetime datetime date replace9349865
Ref: 1a5b9349865
Ref: library/datetime datetime date timetuple9350352
Ref: 29359350352
Ref: library/datetime datetime date toordinal9350854
Ref: 29369350854
Ref: library/datetime datetime date weekday9351156
Ref: 29379351156
Ref: library/datetime datetime date isoweekday9351433
Ref: 29389351433
Ref: library/datetime datetime date isocalendar9351743
Ref: af59351743
Ref: library/datetime datetime date isoformat9352991
Ref: 29399352991
Ref: library/datetime datetime date __str__9353225
Ref: 293a9353225
Ref: library/datetime datetime date ctime9353386
Ref: 293b9353386
Ref: library/datetime datetime date strftime9353950
Ref: e939353950
Ref: library/datetime datetime date __format__9354301
Ref: 293d9354301
Ref: date objects-Footnote-19354854
Ref: date objects-Footnote-29355253
Node: Examples of usage date9355491
Ref: library/datetime examples-of-usage-date9355562
Ref: 293e9355562
Node: datetime objects9357481
Ref: library/datetime datetime-datetime9357622
Ref: 293f9357622
Ref: library/datetime datetime-objects9357622
Ref: 29409357622
Ref: library/datetime datetime datetime9358154
Ref: 4e29358154
Ref: library/datetime datetime datetime today9359142
Ref: 29419359142
Ref: library/datetime datetime datetime now9359587
Ref: 7119359587
Ref: library/datetime datetime datetime utcnow9360671
Ref: 34f9360671
Ref: library/datetime datetime datetime fromtimestamp9361744
Ref: 7129361744
Ref: library/datetime datetime datetime utcfromtimestamp9364030
Ref: 3509364030
Ref: library/datetime datetime datetime fromordinal9366342
Ref: 29429366342
Ref: library/datetime datetime datetime combine9366845
Ref: e949366845
Ref: library/datetime datetime datetime fromisoformat9367663
Ref: 82a9367663
Ref: library/datetime datetime datetime fromisocalendar9369880
Ref: be49369880
Ref: library/datetime datetime datetime strptime9370277
Ref: 19b09370277
Ref: library/datetime datetime datetime min9371884
Ref: 1bc49371884
Ref: library/datetime datetime datetime max9372033
Ref: 29439372033
Ref: library/datetime datetime datetime resolution9372207
Ref: 29449372207
Ref: library/datetime datetime datetime year9372427
Ref: 291d9372427
Ref: library/datetime datetime datetime month9372559
Ref: 291e9372559
Ref: library/datetime datetime datetime day9372649
Ref: 291f9372649
Ref: library/datetime datetime datetime hour9372756
Ref: 29209372756
Ref: library/datetime datetime datetime minute9372833
Ref: 29219372833
Ref: library/datetime datetime datetime second9372912
Ref: 29229372912
Ref: library/datetime datetime datetime microsecond9372991
Ref: 29239372991
Ref: library/datetime datetime datetime tzinfo9373080
Ref: 29249373080
Ref: library/datetime datetime datetime fold9373309
Ref: e559373309
Ref: library/datetime datetime datetime date9378732
Ref: 29459378732
Ref: library/datetime datetime datetime time9378853
Ref: 29469378853
Ref: library/datetime datetime datetime timetz9379252
Ref: 29479379252
Ref: library/datetime datetime datetime replace9379637
Ref: 16e99379637
Ref: library/datetime datetime datetime astimezone9380359
Ref: bc89380359
Ref: library/datetime datetime datetime utcoffset9383642
Ref: 29489383642
Ref: library/datetime datetime datetime dst9384176
Ref: 29499384176
Ref: library/datetime datetime datetime tzname9384698
Ref: 294b9384698
Ref: library/datetime datetime datetime timetuple9385027
Ref: 294c9385027
Ref: library/datetime datetime datetime utctimetuple9386019
Ref: 294e9386019
Ref: library/datetime datetime datetime toordinal9387306
Ref: 294f9387306
Ref: library/datetime datetime datetime timestamp9387474
Ref: 12b09387474
Ref: library/datetime datetime datetime weekday9389239
Ref: 29509389239
Ref: library/datetime datetime datetime isoweekday9389477
Ref: 29519389477
Ref: library/datetime datetime datetime isocalendar9389747
Ref: af69389747
Ref: library/datetime datetime datetime isoformat9389961
Ref: d299389961
Ref: library/datetime datetime datetime __str__9393256
Ref: 29529393256
Ref: library/datetime datetime datetime ctime9393405
Ref: 29539393405
Ref: library/datetime datetime datetime strftime9394131
Ref: e929394131
Ref: library/datetime datetime datetime __format__9394427
Ref: 29549394427
Node: Examples of usage datetime9394966
Ref: library/datetime examples-of-usage-datetime9395045
Ref: 29559395045
Node: time objects9399533
Ref: library/datetime datetime-time9399676
Ref: 29569399676
Ref: library/datetime time-objects9399676
Ref: 29579399676
Ref: library/datetime datetime time9399964
Ref: 1fd9399964
Ref: library/datetime datetime time min9400791
Ref: 29589400791
Ref: library/datetime datetime time max9400907
Ref: 29599400907
Ref: library/datetime datetime time resolution9401039
Ref: 295a9401039
Ref: library/datetime datetime time hour9401372
Ref: 29189401372
Ref: library/datetime datetime time minute9401445
Ref: 29199401445
Ref: library/datetime datetime time second9401520
Ref: 291a9401520
Ref: library/datetime datetime time microsecond9401595
Ref: 291b9401595
Ref: library/datetime datetime time tzinfo9401680
Ref: 291c9401680
Ref: library/datetime datetime time fold9401901
Ref: e919401901
Ref: library/datetime datetime time fromisoformat9403718
Ref: 8299403718
Ref: library/datetime datetime time strptime9405365
Ref: 19ac9405365
Ref: library/datetime datetime time replace9406046
Ref: 1a5c9406046
Ref: library/datetime datetime time isoformat9406688
Ref: 295b9406688
Ref: library/datetime datetime time __str__9409023
Ref: 295d9409023
Ref: library/datetime datetime time strftime9409135
Ref: 17769409135
Ref: library/datetime datetime time __format__9409409
Ref: 295e9409409
Ref: library/datetime datetime time utcoffset9409866
Ref: 295c9409866
Ref: library/datetime datetime time dst9410396
Ref: 295f9410396
Ref: library/datetime datetime time tzname9410914
Ref: 29609410914
Ref: time objects-Footnote-19411336
Node: Examples of usage time9411401
Ref: library/datetime examples-of-usage-time9411472
Ref: 29619411472
Node: tzinfo objects9412347
Ref: library/datetime datetime-tzinfo9412490
Ref: 29629412490
Ref: library/datetime tzinfo-objects9412490
Ref: 29639412490
Ref: library/datetime datetime tzinfo9412547
Ref: 7f69412547
Ref: library/datetime datetime tzinfo utcoffset9414498
Ref: 29649414498
Ref: library/datetime datetime tzinfo dst9416164
Ref: 29659416164
Ref: library/datetime datetime tzinfo tzname9419173
Ref: 29669419173
Ref: library/datetime datetime tzinfo fromutc9421416
Ref: 294a9421416
Ref: tzinfo objects-Footnote-19435310
Node: timezone objects9435350
Ref: library/datetime datetime-timezone9435511
Ref: 29679435511
Ref: library/datetime timezone-objects9435511
Ref: 29689435511
Ref: library/datetime datetime timezone9436061
Ref: 12d99436061
Ref: library/datetime datetime timezone utcoffset9436901
Ref: 29699436901
Ref: library/datetime datetime timezone tzname9437362
Ref: 296a9437362
Ref: library/datetime datetime timezone dst9438204
Ref: 296b9438204
Ref: library/datetime datetime timezone fromutc9438284
Ref: 296c9438284
Ref: library/datetime datetime timezone utc9438567
Ref: 8279438567
Node: strftime and strptime behavior9438664
Ref: library/datetime strftime-and-strptime-behavior9438802
Ref: 296d9438802
Ref: library/datetime strftime-strptime-behavior9438802
Ref: 1bb39438802
Ref: library/datetime format-codes9440729
Ref: 290e9440729
Node: strftime and strptime format codes9440838
Ref: library/datetime strftime-and-strptime-format-codes9440964
Ref: 296e9440964
Ref: strftime and strptime format codes-Footnote-19452545
Node: Technical detail9452593
Ref: library/datetime technical-detail9452719
Ref: 296f9452719
Ref: Technical detail-Footnote-19461800
Node: zoneinfo --- IANA タイムゾーンのサポート9461855
Ref: library/zoneinfo doc9462083
Ref: 29709462083
Ref: library/zoneinfo module-zoneinfo9462083
Ref: 13b9462083
Ref: library/zoneinfo translation-repo9462083
Ref: 29719462083
Ref: library/zoneinfo zoneinfo-iana-time-zone-support9462083
Ref: 29729462083
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-19463524
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-29463589
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-39463631
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-49463672
Node: ZoneInfo を使用する9463713
Ref: library/zoneinfo using-zoneinfo9463852
Ref: 29739463852
Ref: ZoneInfo を使用する-Footnote-19465862
Node: データソース9465904
Ref: library/zoneinfo data-sources9466070
Ref: 29749466070
Ref: データソース-Footnote-19466760
Node: Configuring the data sources9466801
Ref: library/zoneinfo configuring-the-data-sources9466884
Ref: 29759466884
Ref: library/zoneinfo zoneinfo-data-configuration9466884
Ref: 29769466884
Node: Compile-time configuration9467637
Ref: library/zoneinfo compile-time-configuration9467762
Ref: 29799467762
Ref: library/zoneinfo zoneinfo-data-compile-time-config9467762
Ref: 21c19467762
Node: Environment configuration9468492
Ref: library/zoneinfo environment-configuration9468647
Ref: 297a9468647
Ref: library/zoneinfo zoneinfo-data-environment-var9468647
Ref: 29779468647
Ref: library/zoneinfo envvar-PYTHONTZPATH9468966
Ref: 297b9468966
Node: Runtime configuration9469619
Ref: library/zoneinfo runtime-configuration9469739
Ref: 297d9469739
Ref: library/zoneinfo zoneinfo-data-runtime-config9469739
Ref: 29789469739
Node: ZoneInfo クラス9470107
Ref: library/zoneinfo the-zoneinfo-class9470258
Ref: 297e9470258
Ref: library/zoneinfo zoneinfo ZoneInfo9470318
Ref: ae09470318
Ref: library/zoneinfo zoneinfo ZoneInfo from_file9471283
Ref: 17ec9471283
Ref: library/zoneinfo zoneinfo ZoneInfo no_cache9472050
Ref: 29809472050
Ref: library/zoneinfo zoneinfo ZoneInfo clear_cache9472789
Ref: 17d69472789
Ref: library/zoneinfo zoneinfo ZoneInfo key9473591
Ref: 29819473591
Node: 文字列表現9474442
Ref: library/zoneinfo string-representations9474541
Ref: 29839474541
Node: Pickle serialization9475338
Ref: library/zoneinfo pickle-serialization9475437
Ref: 29849475437
Ref: library/zoneinfo pickling9475437
Ref: 297f9475437
Node: 関数<3>9477832
Ref: library/zoneinfo functions9477972
Ref: 29859477972
Ref: library/zoneinfo zoneinfo available_timezones9478003
Ref: 1da69478003
Ref: library/zoneinfo zoneinfo reset_tzpath9478973
Ref: 182b9478973
Node: Globals9479663
Ref: library/zoneinfo globals9479800
Ref: 29869479800
Ref: library/zoneinfo zoneinfo TZPATH9479835
Ref: 21c09479835
Node: 例外と警告9480613
Ref: library/zoneinfo exceptions-and-warnings9480732
Ref: 29879480732
Ref: library/zoneinfo zoneinfo ZoneInfoNotFoundError9480778
Ref: 187c9480778
Ref: library/zoneinfo zoneinfo InvalidTZPathWarning9481006
Ref: 297c9481006
Node: calendar --- 一般的なカレンダーに関係する機能群9481180
Ref: library/calendar doc9481402
Ref: 29889481402
Ref: library/calendar calendar-general-calendar-related-functions9481402
Ref: 29899481402
Ref: library/calendar module-calendar9481402
Ref: 159481402
Ref: library/calendar translation-repo9481402
Ref: 298a9481402
Ref: library/calendar calendar Calendar9482890
Ref: 298c9482890
Ref: library/calendar calendar Calendar firstweekday9483583
Ref: 298f9483583
Ref: library/calendar calendar Calendar getfirstweekday9483823
Ref: 29919483823
Ref: library/calendar calendar Calendar setfirstweekday9484012
Ref: 29909484012
Ref: library/calendar calendar Calendar iterweekdays9484237
Ref: 29929484237
Ref: library/calendar calendar Calendar itermonthdates9484491
Ref: e179484491
Ref: library/calendar calendar Calendar itermonthdays9484921
Ref: 29939484921
Ref: library/calendar calendar Calendar itermonthdays29485312
Ref: 29949485312
Ref: library/calendar calendar Calendar itermonthdays39485667
Ref: e189485667
Ref: library/calendar calendar Calendar itermonthdays49486055
Ref: e199486055
Ref: library/calendar calendar Calendar monthdatescalendar9486463
Ref: 29959486463
Ref: library/calendar calendar Calendar monthdays2calendar9486696
Ref: 29969486696
Ref: library/calendar calendar Calendar monthdayscalendar9486936
Ref: 29979486936
Ref: library/calendar calendar Calendar yeardatescalendar9487139
Ref: 29989487139
Ref: library/calendar calendar Calendar yeardays2calendar9487585
Ref: 29999487585
Ref: library/calendar calendar Calendar yeardayscalendar9487945
Ref: 299a9487945
Ref: library/calendar calendar TextCalendar9488254
Ref: 190d9488254
Ref: library/calendar calendar TextCalendar formatday9488506
Ref: 299b9488506
Ref: library/calendar calendar TextCalendar formatweek9488820
Ref: 299c9488820
Ref: library/calendar calendar TextCalendar formatweekday9489171
Ref: 299d9489171
Ref: library/calendar calendar TextCalendar formatweekheader9489481
Ref: 299e9489481
Ref: library/calendar calendar TextCalendar formatmonth9489761
Ref: 299f9489761
Ref: library/calendar calendar TextCalendar formatmonthname9490236
Ref: 29a09490236
Ref: library/calendar calendar TextCalendar prmonth9490644
Ref: 29a19490644
Ref: library/calendar calendar TextCalendar formatyear9490822
Ref: 29a29490822
Ref: library/calendar calendar TextCalendar pryear9491409
Ref: 29a39491409
Ref: library/calendar calendar HTMLCalendar9491582
Ref: d1c9491582
Ref: library/calendar calendar HTMLCalendar formatmonth9491809
Ref: 29a49491809
Ref: library/calendar calendar HTMLCalendar formatyear9492120
Ref: 29a59492120
Ref: library/calendar calendar HTMLCalendar formatyearpage9492391
Ref: 29a69492391
Ref: library/calendar calendar HTMLCalendar formatmonthname9492908
Ref: 29a79492908
Ref: library/calendar calendar HTMLCalendar cssclasses9493288
Ref: 29a89493288
Ref: library/calendar calendar HTMLCalendar cssclass_noday9493702
Ref: 29a99493702
Ref: library/calendar calendar HTMLCalendar cssclasses_weekday_head9493863
Ref: 29aa9493863
Ref: library/calendar calendar HTMLCalendar cssclass_month_head9494078
Ref: 29ab9494078
Ref: library/calendar calendar HTMLCalendar cssclass_month9494279
Ref: 29ac9494279
Ref: library/calendar calendar HTMLCalendar cssclass_year9494486
Ref: 29ad9494486
Ref: library/calendar calendar HTMLCalendar cssclass_year_head9494699
Ref: 29ae9494699
Ref: library/calendar calendar LocaleTextCalendar9495608
Ref: 94f9495608
Ref: library/calendar calendar LocaleHTMLCalendar9495853
Ref: 9509495853
Ref: library/calendar calendar setfirstweekday9496508
Ref: 298b9496508
Ref: library/calendar calendar firstweekday9497017
Ref: 29b49497017
Ref: library/calendar calendar isleap9497131
Ref: 29b59497131
Ref: library/calendar calendar leapdays9497286
Ref: 29b69497286
Ref: library/calendar calendar weekday9497559
Ref: 29b79497559
Ref: library/calendar calendar weekheader9497772
Ref: 29b89497772
Ref: library/calendar calendar monthrange9497946
Ref: 29b99497946
Ref: library/calendar calendar monthcalendar9498116
Ref: 29ba9498116
Ref: library/calendar calendar prmonth9498422
Ref: 29bb9498422
Ref: library/calendar calendar month9498591
Ref: 196b9498591
Ref: library/calendar calendar prcal9498790
Ref: 29bc9498790
Ref: library/calendar calendar calendar9498952
Ref: 29bd9498952
Ref: library/calendar calendar timegm9499175
Ref: 29be9499175
Ref: library/calendar calendar day_name9499627
Ref: 29bf9499627
Ref: library/calendar calendar day_abbr9499931
Ref: 29c09499931
Ref: library/calendar calendar MONDAY9500215
Ref: 298d9500215
Ref: library/calendar calendar TUESDAY9500246
Ref: 29af9500246
Ref: library/calendar calendar WEDNESDAY9500278
Ref: 29b09500278
Ref: library/calendar calendar THURSDAY9500312
Ref: 29b19500312
Ref: library/calendar calendar FRIDAY9500345
Ref: 29b29500345
Ref: library/calendar calendar SATURDAY9500376
Ref: 29b39500376
Ref: library/calendar calendar SUNDAY9500409
Ref: 298e9500409
Ref: library/calendar calendar Day9500574
Ref: 6aa9500574
Ref: library/calendar calendar month_name9500825
Ref: 29c19500825
Ref: library/calendar calendar month_abbr9501298
Ref: 29c29501298
Ref: library/calendar calendar JANUARY9501745
Ref: 34c9501745
Ref: library/calendar calendar FEBRUARY9501777
Ref: 34d9501777
Ref: library/calendar calendar MARCH9501810
Ref: 29c39501810
Ref: library/calendar calendar APRIL9501840
Ref: 29c49501840
Ref: library/calendar calendar MAY9501870
Ref: 29c59501870
Ref: library/calendar calendar JUNE9501898
Ref: 29c69501898
Ref: library/calendar calendar JULY9501927
Ref: 29c79501927
Ref: library/calendar calendar AUGUST9501956
Ref: 29c89501956
Ref: library/calendar calendar SEPTEMBER9501987
Ref: 29c99501987
Ref: library/calendar calendar OCTOBER9502021
Ref: 29ca9502021
Ref: library/calendar calendar NOVEMBER9502053
Ref: 29cb9502053
Ref: library/calendar calendar DECEMBER9502086
Ref: 29cc9502086
Ref: library/calendar calendar Month9502259
Ref: 6a99502259
Ref: library/calendar calendar IllegalMonthError9502577
Ref: 17bd9502577
Ref: library/calendar calendar IllegalMonthError month9502960
Ref: 29cd9502960
Ref: library/calendar calendar IllegalWeekdayError9503024
Ref: 29ce9503024
Ref: library/calendar calendar IllegalWeekdayError weekday9503202
Ref: 29cf9503202
Ref: calendar --- 一般的なカレンダーに関係する機能群-Footnote-19503632
Node: コマンドラインでの使用9503700
Ref: library/calendar calendar-cli9503834
Ref: 1d29503834
Ref: library/calendar command-line-usage9503834
Ref: 29d09503834
Ref: library/calendar cmdoption-calendar-help9506603
Ref: 29d19506603
Ref: library/calendar cmdoption-calendar-h9506603
Ref: 29d29506603
Ref: library/calendar cmdoption-calendar-locale9506691
Ref: 29d39506691
Ref: library/calendar cmdoption-calendar-L9506691
Ref: 29d49506691
Ref: library/calendar cmdoption-calendar-encoding9506811
Ref: 29d59506811
Ref: library/calendar cmdoption-calendar-e9506811
Ref: 29d69506811
Ref: library/calendar cmdoption-calendar-type9506968
Ref: 29d79506968
Ref: library/calendar cmdoption-calendar-t9506968
Ref: 29d89506968
Ref: library/calendar cmdoption-calendar-first-weekday9507090
Ref: 29d99507090
Ref: library/calendar cmdoption-calendar-f9507090
Ref: 29da9507090
Ref: library/calendar cmdoption-calendar-arg-year9507292
Ref: 29db9507292
Ref: library/calendar cmdoption-calendar-arg-month9507383
Ref: 29dc9507383
Ref: library/calendar cmdoption-calendar-width9507635
Ref: 29dd9507635
Ref: library/calendar cmdoption-calendar-w9507635
Ref: 29de9507635
Ref: library/calendar cmdoption-calendar-lines9507833
Ref: 29df9507833
Ref: library/calendar cmdoption-calendar-l9507833
Ref: 29e09507833
Ref: library/calendar cmdoption-calendar-spacing9508024
Ref: 29e19508024
Ref: library/calendar cmdoption-calendar-s9508024
Ref: 29e29508024
Ref: library/calendar cmdoption-calendar-months9508167
Ref: 29e39508167
Ref: library/calendar cmdoption-calendar-m9508167
Ref: 29e49508167
Ref: library/calendar cmdoption-calendar-css9508433
Ref: 29e59508433
Ref: library/calendar cmdoption-calendar-c9508433
Ref: 29e69508433
Node: collections --- コンテナデータ型9508630
Ref: library/collections doc9508857
Ref: 29e79508857
Ref: library/collections collections-container-datatypes9508857
Ref: 29e89508857
Ref: library/collections module-collections9508857
Ref: 1e9508857
Ref: library/collections translation-repo9508857
Ref: 29e99508857
Ref: collections --- コンテナデータ型-Footnote-19511250
Node: ChainMap オブジェクト9511331
Ref: library/collections chainmap-objects9511470
Ref: 29ea9511470
Ref: library/collections collections ChainMap9511969
Ref: e1a9511969
Ref: library/collections collections ChainMap maps9513299
Ref: 29eb9513299
Ref: library/collections collections ChainMap new_child9513789
Ref: 112a9513789
Ref: library/collections collections ChainMap parents9514908
Ref: 29ec9514908
Ref: ChainMap オブジェクト-Footnote-19517326
Ref: ChainMap オブジェクト-Footnote-29517368
Ref: ChainMap オブジェクト-Footnote-39517415
Ref: ChainMap オブジェクト-Footnote-49517510
Ref: ChainMap オブジェクト-Footnote-59517589
Ref: ChainMap オブジェクト-Footnote-69517686
Node: ChainMap の例とレシピ9517739
Ref: library/collections chainmap-examples-and-recipes9517830
Ref: 29ed9517830
Node: Counter オブジェクト9521044
Ref: library/collections counter-objects9521216
Ref: 29ee9521216
Ref: library/collections collections Counter9521971
Ref: 12a79521971
Ref: library/collections collections Counter elements9524465
Ref: 151f9524465
Ref: library/collections collections Counter most_common9524932
Ref: 151e9524932
Ref: library/collections collections Counter subtract9525453
Ref: 13fb9525453
Ref: library/collections collections Counter total9526140
Ref: 29ef9526140
Ref: library/collections collections Counter fromkeys9526495
Ref: 29f09526495
Ref: library/collections collections Counter update9526668
Ref: 17ed9526668
Ref: Counter オブジェクト-Footnote-19532715
Ref: Counter オブジェクト-Footnote-29532794
Ref: Counter オブジェクト-Footnote-39532841
Node: deque オブジェクト9532934
Ref: library/collections deque-objects9533109
Ref: 29f19533109
Ref: library/collections collections deque9533178
Ref: 7f49533178
Ref: library/collections collections deque append9535206
Ref: 29f29535206
Ref: library/collections collections deque appendleft9535301
Ref: 29f39535301
Ref: library/collections collections deque clear9535399
Ref: 29f49535399
Ref: library/collections collections deque copy9535516
Ref: fd69535516
Ref: library/collections collections deque count9535638
Ref: 13fd9535638
Ref: library/collections collections deque extend9535776
Ref: 29f59535776
Ref: library/collections collections deque extendleft9535951
Ref: 29f69535951
Ref: library/collections collections deque index9536242
Ref: fd49536242
Ref: library/collections collections deque insert9536530
Ref: fd59536530
Ref: library/collections collections deque pop9536837
Ref: 29f79536837
Ref: library/collections collections deque popleft9537077
Ref: 29f89537077
Ref: library/collections collections deque remove9537321
Ref: 1d2c9537321
Ref: library/collections collections deque reverse9537529
Ref: 13fe9537529
Ref: library/collections collections deque rotate9537689
Ref: 1ceb9537689
Ref: library/collections collections deque maxlen9538255
Ref: 15209538255
Node: deque のレシピ9541084
Ref: library/collections deque-recipes9541163
Ref: 29f99541163
Ref: deque のレシピ-Footnote-19544009
Node: defaultdict オブジェクト9544070
Ref: library/collections defaultdict-objects9544299
Ref: 29fa9544299
Ref: library/collections collections defaultdict9544380
Ref: 13d89544380
Ref: library/collections collections defaultdict __missing__9545640
Ref: 29fc9545640
Ref: library/collections collections defaultdict default_factory9547222
Ref: 29fb9547222
Ref: defaultdict オブジェクト-Footnote-19547752
Node: defaultdict の使用例9547794
Ref: library/collections defaultdict-examples9547885
Ref: 29fd9547885
Node: namedtuple 名前付きフィールドを持つタプルのファクトリ関数9550777
Ref: library/collections namedtuple-factory-function-for-tuples-with-named-fields9551012
Ref: 29fe9551012
Ref: library/collections collections namedtuple9551566
Ref: 4e09551566
Ref: library/collections collections somenamedtuple _make9556525
Ref: 2a009556525
Ref: library/collections collections somenamedtuple _asdict9556785
Ref: bd89556785
Ref: library/collections collections somenamedtuple _replace9557595
Ref: 2a019557595
Ref: library/collections collections somenamedtuple _fields9558330
Ref: 2a029558330
Ref: library/collections collections somenamedtuple _field_defaults9558899
Ref: 29ff9558899
Node: OrderedDict オブジェクト9562234
Ref: library/collections ordereddict-objects9562466
Ref: 2a039562466
Ref: library/collections collections OrderedDict9565466
Ref: 7f39565466
Ref: library/collections collections OrderedDict popitem9565820
Ref: 15099565820
Ref: library/collections collections OrderedDict move_to_end9566121
Ref: 13fc9566121
Ref: library/collections collections-ordereddict-eq9566993
Ref: 19a99566993
Ref: OrderedDict オブジェクト-Footnote-19568045
Ref: OrderedDict オブジェクト-Footnote-29568087
Node: OrderedDict の例とレシピ9568129
Ref: library/collections ordereddict-examples-and-recipes9568226
Ref: 2a059568226
Node: UserDict オブジェクト9571287
Ref: library/collections userdict-objects9571466
Ref: 2a069571466
Ref: library/collections collections UserDict9571948
Ref: 1ddb9571948
Ref: library/collections collections UserDict data9572552
Ref: 2a079572552
Node: UserList オブジェクト9572701
Ref: library/collections userlist-objects9572879
Ref: 2a089572879
Ref: library/collections collections UserList9573606
Ref: 17029573606
Ref: library/collections collections UserList data9574359
Ref: 2a099574359
Node: UserString オブジェクト9575424
Ref: library/collections userstring-objects9575566
Ref: 2a0a9575566
Ref: library/collections collections UserString9576058
Ref: fd79576058
Ref: library/collections collections UserString data9576748
Ref: 2a0b9576748
Node: collections abc --- コンテナの抽象基底クラス9577101
Ref: library/collections abc doc9577310
Ref: 2a0c9577310
Ref: library/collections abc collections-abc-abstract-base-classes-for-containers9577310
Ref: 2a0d9577310
Ref: library/collections abc module-collections abc9577310
Ref: 1f9577310
Ref: library/collections abc translation-repo9577310
Ref: 2a0e9577310
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-19581909
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-29581986
Node: コレクション抽象基底クラス9582028
Ref: library/collections abc collections-abstract-base-classes9582230
Ref: a7c9582230
Ref: library/collections abc id19582230
Ref: 2a0f9582230
Ref: コレクション抽象基底クラス-Footnote-19592046
Ref: コレクション抽象基底クラス-Footnote-29592579
Ref: コレクション抽象基底クラス-Footnote-39593112
Ref: コレクション抽象基底クラス-Footnote-49593645
Ref: コレクション抽象基底クラス-Footnote-59594121
Ref: コレクション抽象基底クラス-Footnote-69594654
Ref: コレクション抽象基底クラス-Footnote-79595187
Ref: コレクション抽象基底クラス-Footnote-89595720
Ref: コレクション抽象基底クラス-Footnote-99596253
Ref: コレクション抽象基底クラス-Footnote-109596786
Ref: コレクション抽象基底クラス-Footnote-119597320
Ref: コレクション抽象基底クラス-Footnote-129597854
Ref: コレクション抽象基底クラス-Footnote-139598388
Ref: コレクション抽象基底クラス-Footnote-149598922
Ref: コレクション抽象基底クラス-Footnote-159599456
Ref: コレクション抽象基底クラス-Footnote-169599990
Node: コレクションの抽象基底クラス -- 詳細な説明9600524
Ref: library/collections abc collections-abstract-base-classes-detailed-descriptions9600750
Ref: 2a119600750
Ref: library/collections abc collections abc Container9600870
Ref: 27099600870
Ref: library/collections abc collections abc Hashable9601000
Ref: 7199601000
Ref: library/collections abc collections abc Sized9601124
Ref: 71a9601124
Ref: library/collections abc collections abc Callable9601245
Ref: 9ef9601245
Ref: library/collections abc collections abc Iterable9601564
Ref: 27079601564
Ref: library/collections abc collections abc Collection9602187
Ref: e889602187
Ref: library/collections abc collections abc Iterator9602339
Ref: 27089602339
Ref: library/collections abc collections abc Reversible9602577
Ref: e899602577
Ref: library/collections abc collections abc Generator9602755
Ref: fdf9602755
Ref: library/collections abc collections abc Sequence9603264
Ref: 13e09603264
Ref: library/collections abc collections abc MutableSequence9603304
Ref: 4bf9603304
Ref: library/collections abc collections abc ByteString9603351
Ref: 3409603351
Ref: library/collections abc collections abc ByteString index9604058
Ref: 2a139604058
Ref: library/collections abc collections abc Set9605473
Ref: 26ff9605473
Ref: library/collections abc collections abc MutableSet9605508
Ref: 270a9605508
Ref: library/collections abc collections abc Mapping9605638
Ref: acb9605638
Ref: library/collections abc collections abc MutableMapping9605677
Ref: 12c49605677
Ref: library/collections abc collections abc MappingView9605852
Ref: 270b9605852
Ref: library/collections abc collections abc ItemsView9605895
Ref: 270d9605895
Ref: library/collections abc collections abc KeysView9605936
Ref: 270c9605936
Ref: library/collections abc collections abc ValuesView9605976
Ref: 270e9605976
Ref: library/collections abc collections abc Awaitable9606109
Ref: fe09606109
Ref: library/collections abc collections abc Coroutine9606951
Ref: fe19606951
Ref: library/collections abc collections abc AsyncIterable9608175
Ref: fe39608175
Ref: library/collections abc collections abc AsyncIterator9608403
Ref: fe29608403
Ref: library/collections abc collections abc AsyncGenerator9608658
Ref: e8b9608658
Ref: library/collections abc collections abc Buffer9609064
Ref: 3419609064
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-19609343
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-29609385
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-39609443
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-49609485
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-59609527
Node: 例とレシピ9609569
Ref: library/collections abc examples-and-recipes9609747
Ref: 2a149609747
Ref: 例とレシピ-Footnote-19613095
Ref: 例とレシピ-Footnote-29613148
Node: heapq --- ヒープキューアルゴリズム9613190
Ref: library/heapq doc9613403
Ref: 2a159613403
Ref: library/heapq heapq-heap-queue-algorithm9613403
Ref: 2a169613403
Ref: library/heapq module-heapq9613403
Ref: 6d9613403
Ref: library/heapq translation-repo9613403
Ref: 2a179613403
Ref: library/heapq heapq heapify9615852
Ref: 2a189615852
Ref: library/heapq heapq heappush9615954
Ref: 16da9615954
Ref: library/heapq heapq heappop9616084
Ref: 16db9616084
Ref: library/heapq heapq heappushpop9616354
Ref: 2a199616354
Ref: library/heapq heapq heapreplace9616678
Ref: 2a1a9616678
Ref: library/heapq heapq heapify_max9617709
Ref: 2239617709
Ref: library/heapq heapq heappush_max9617844
Ref: 2249617844
Ref: library/heapq heapq heappop_max9618016
Ref: 2259618016
Ref: library/heapq heapq heappushpop_max9618333
Ref: 2279618333
Ref: library/heapq heapq heapreplace_max9618652
Ref: 2269618652
Ref: library/heapq heapq merge9619187
Ref: 10099619187
Ref: library/heapq heapq nlargest9620719
Ref: 2a1b9620719
Ref: library/heapq heapq nsmallest9621198
Ref: 2a1c9621198
Ref: heapq --- ヒープキューアルゴリズム-Footnote-19622222
Node: 基本的な例9622287
Ref: library/heapq basic-examples9622412
Ref: 2a1d9622412
Ref: 基本的な例-Footnote-19623489
Node: Other Applications9623583
Ref: library/heapq other-applications9623750
Ref: 2a1e9623750
Ref: Other Applications-Footnote-19625010
Ref: Other Applications-Footnote-29625055
Node: 優先度キュー実装の注釈9625110
Ref: library/heapq priority-queue-implementation-notes9625268
Ref: 2a1f9625268
Ref: 優先度キュー実装の注釈-Footnote-19628707
Node: 理論9628819
Ref: library/heapq theory9628950
Ref: 2a209628950
Ref: 理論-Footnote-19634697
Node: bisect --- 配列二分法アルゴリズム9635612
Ref: library/bisect doc9635803
Ref: 2a219635803
Ref: library/bisect bisect-array-bisection-algorithm9635803
Ref: 2a229635803
Ref: library/bisect module-bisect9635803
Ref: 129635803
Ref: library/bisect translation-repo9635803
Ref: 2a239635803
Ref: library/bisect bisect-functions9637323
Ref: 2a259637323
Ref: library/bisect bisect bisect_left9637365
Ref: 2a269637365
Ref: library/bisect bisect bisect_right9638777
Ref: 2a279638777
Ref: library/bisect bisect bisect9638849
Ref: 2a289638849
Ref: library/bisect bisect insort_left9639503
Ref: 2a249639503
Ref: library/bisect bisect insort_right9640199
Ref: 2a299640199
Ref: library/bisect bisect insort9640271
Ref: 2a2a9640271
Ref: bisect --- 配列二分法アルゴリズム-Footnote-19641229
Node: パフォーマンスに関するメモ9641295
Ref: library/bisect performance-notes9641457
Ref: 2a2b9641457
Ref: パフォーマンスに関するメモ-Footnote-19642978
Ref: パフォーマンスに関するメモ-Footnote-29643033
Node: ソート済みリストの探索9643103
Ref: library/bisect searching-sorted-lists9643286
Ref: 2a2c9643286
Node: 使用例<4>9644635
Ref: library/bisect examples9644770
Ref: 2a2d9644770
Ref: library/bisect bisect-example9644804
Ref: 2a2e9644804
Node: array --- 効率的な数値配列9647491
Ref: library/array doc9647663
Ref: 2a2f9647663
Ref: library/array array-efficient-arrays-of-numeric-values9647663
Ref: 2a309647663
Ref: library/array module-array9647663
Ref: 89647663
Ref: library/array translation-repo9647663
Ref: 2a319647663
Ref: library/array array typecodes9652927
Ref: 2a339652927
Ref: library/array array array9653068
Ref: 4be9653068
Ref: library/array array array typecode9654435
Ref: 2a369654435
Ref: library/array array array itemsize9654537
Ref: 2a329654537
Ref: library/array array array append9654654
Ref: 2a379654654
Ref: library/array array array buffer_info9654785
Ref: 2a389654785
Ref: library/array array array byteswap9656266
Ref: 2a399656266
Ref: library/array array array count9656619
Ref: 2a3a9656619
Ref: library/array array array extend9656729
Ref: 2a359656729
Ref: library/array array array frombytes9657327
Ref: 148d9657327
Ref: library/array array array fromfile9657748
Ref: 14dc9657748
Ref: library/array array array fromlist9658200
Ref: 2a3b9658200
Ref: library/array array array fromunicode9658467
Ref: 2a349658467
Ref: library/array array array index9658833
Ref: 9e59658833
Ref: library/array array array insert9659309
Ref: 2a3c9659309
Ref: library/array array array pop9659525
Ref: 2a3d9659525
Ref: library/array array array remove9659826
Ref: 2a3e9659826
Ref: library/array array array clear9659934
Ref: 4c09659934
Ref: library/array array array reverse9660048
Ref: 2a3f9660048
Ref: library/array array array tobytes9660143
Ref: 148c9660143
Ref: library/array array array tofile9660500
Ref: 14dd9660500
Ref: library/array array array tolist9660665
Ref: 2a409660665
Ref: library/array array array tounicode9660783
Ref: 2a419660783
Ref: array --- 効率的な数値配列-Footnote-19662091
Ref: array --- 効率的な数値配列-Footnote-29662188
Node: weakref --- Weak references9662215
Ref: library/weakref doc9662398
Ref: 2a429662398
Ref: library/weakref mod-weakref9662398
Ref: 11119662398
Ref: library/weakref module-weakref9662398
Ref: 11b9662398
Ref: library/weakref translation-repo9662398
Ref: 2a439662398
Ref: library/weakref weakref-weak-references9662398
Ref: 2a449662398
Ref: library/weakref weakref ref9667330
Ref: 11f69667330
Ref: library/weakref weakref ref __callback__9669606
Ref: 11f79669606
Ref: library/weakref weakref proxy9670050
Ref: c4a9670050
Ref: library/weakref weakref getweakrefcount9671461
Ref: 2a469671461
Ref: library/weakref weakref getweakrefs9671589
Ref: 2a479671589
Ref: library/weakref weakref WeakKeyDictionary9671755
Ref: 19899671755
Ref: library/weakref weakref WeakKeyDictionary keyrefs9673893
Ref: 2a489673893
Ref: library/weakref weakref WeakValueDictionary9674024
Ref: 198a9674024
Ref: library/weakref weakref WeakValueDictionary valuerefs9674546
Ref: 2a499674546
Ref: library/weakref weakref WeakSet9674678
Ref: 7f59674678
Ref: library/weakref weakref WeakMethod9674865
Ref: 11f59674865
Ref: library/weakref weakref finalize9676049
Ref: c739676049
Ref: library/weakref weakref finalize __call__9677762
Ref: 2a4a9677762
Ref: library/weakref weakref finalize detach9677979
Ref: 2a4b9677979
Ref: library/weakref weakref finalize peek9678186
Ref: 2a4c9678186
Ref: library/weakref weakref finalize alive9678361
Ref: 2a4d9678361
Ref: library/weakref weakref finalize atexit9678525
Ref: 2a4e9678525
Ref: library/weakref weakref ReferenceType9679128
Ref: 1bbc9679128
Ref: library/weakref weakref ProxyType9679236
Ref: 1bbd9679236
Ref: library/weakref weakref CallableProxyType9679373
Ref: 1bbe9679373
Ref: library/weakref weakref ProxyTypes9679512
Ref: 2a4f9679512
Ref: weakref --- Weak references-Footnote-19680260
Ref: weakref --- Weak references-Footnote-29680327
Ref: weakref --- Weak references-Footnote-39680369
Ref: weakref --- Weak references-Footnote-49680411
Node: 弱参照オブジェクト9680453
Ref: library/weakref weak-reference-objects9680565
Ref: 2a509680565
Ref: library/weakref weakref-objects9680565
Ref: 2a519680565
Node: 使用例<5>9683696
Ref: library/weakref example9683856
Ref: 2a529683856
Ref: library/weakref weakref-example9683856
Ref: 2a539683856
Node: ファイナライザオブジェクト9684531
Ref: library/weakref finalize-examples9684705
Ref: 2a549684705
Ref: library/weakref finalizer-objects9684705
Ref: 2a559684705
Node: Comparing finalizers with __del__ methods9686652
Ref: library/weakref comparing-finalizers-with-del-methods9686805
Ref: 2a569686805
Node: types --- 動的な型生成と組み込み型の名前9689761
Ref: library/types doc9689964
Ref: 2a579689964
Ref: library/types module-types9689964
Ref: 10a9689964
Ref: library/types translation-repo9689964
Ref: 2a589689964
Ref: library/types types-dynamic-type-creation-and-names-for-built-in-types9689964
Ref: 2a599689964
Ref: types --- 動的な型生成と組み込み型の名前-Footnote-19690945
Node: 動的な型生成9691010
Ref: library/types dynamic-type-creation9691162
Ref: 2a5a9691162
Ref: library/types types new_class9691213
Ref: 137d9691213
Ref: library/types types prepare_class9692037
Ref: 137e9692037
Ref: library/types types resolve_bases9693377
Ref: d999693377
Ref: library/types types get_original_bases9693936
Ref: 6f59693936
Ref: 動的な型生成-Footnote-19695531
Ref: 動的な型生成-Footnote-29695573
Ref: 動的な型生成-Footnote-39695615
Ref: 動的な型生成-Footnote-49695657
Node: 標準的なインタプリタ型9695699
Ref: library/types standard-interpreter-types9695908
Ref: 2a5b9695908
Ref: library/types types NoneType9696691
Ref: a569696691
Ref: library/types types FunctionType9696790
Ref: a879696790
Ref: library/types types LambdaType9696824
Ref: 2a5c9696824
Ref: library/types types GeneratorType9697275
Ref: 1a099697275
Ref: library/types types CoroutineType9697456
Ref: 108d9697456
Ref: library/types types AsyncGeneratorType9697635
Ref: 2a5d9697635
Ref: library/types types CodeType9697866
Ref: 32d9697866
Ref: library/types types CellType9698487
Ref: 2a5e9698487
Ref: library/types types MethodType9698668
Ref: 1be29698668
Ref: library/types types BuiltinFunctionType9698789
Ref: 2a5f9698789
Ref: library/types types BuiltinMethodType9698830
Ref: 2a609698830
Ref: library/types types WrapperDescriptorType9699119
Ref: d969699119
Ref: library/types types MethodWrapperType9699342
Ref: 85b9699342
Ref: library/types types NotImplementedType9699550
Ref: a579699550
Ref: library/types types MethodDescriptorType9699669
Ref: d979699669
Ref: library/types types ClassMethodDescriptorType9699831
Ref: d989699831
Ref: library/types types ModuleType9700023
Ref: 10189700023
Ref: library/types types EllipsisType9700830
Ref: a559700830
Ref: library/types types GenericAlias9700938
Ref: 9f09700938
Ref: library/types types UnionType9701896
Ref: 2a99701896
Ref: library/types types TracebackType9702103
Ref: cee9702103
Ref: library/types types FrameType9702467
Ref: 1c4b9702467
Ref: library/types types GetSetDescriptorType9702625
Ref: 2a619702625
Ref: library/types types MemberDescriptorType9702997
Ref: 2a629702997
Ref: library/types types MappingProxyType9703887
Ref: 6989703887
Ref: library/types types MappingProxyType copy9705367
Ref: 2a639705367
Ref: library/types types MappingProxyType get9705477
Ref: 2a649705477
Ref: library/types types MappingProxyType items9705931
Ref: 2a659705931
Ref: library/types types MappingProxyType keys9706109
Ref: 2a669706109
Ref: library/types types MappingProxyType values9706240
Ref: 2a679706240
Ref: library/types types CapsuleType9706650
Ref: 2a689706650
Ref: 標準的なインタプリタ型-Footnote-19706796
Ref: 標準的なインタプリタ型-Footnote-29706838
Node: 追加のユーティリティクラスと関数9706880
Ref: library/types additional-utility-classes-and-functions9707113
Ref: 2a6a9707113
Ref: library/types types SimpleNamespace9707214
Ref: 4e59707214
Ref: library/types types DynamicClassAttribute9709380
Ref: 83c9709380
Node: コルーチンユーティリティ関数9710242
Ref: library/types coroutine-utility-functions9710433
Ref: 2a6b9710433
Ref: library/types types coroutine9710524
Ref: 108c9710524
Node: copy --- 浅いコピーおよび深いコピー操作9711624
Ref: library/copy doc9711835
Ref: 2a6c9711835
Ref: library/copy copy-shallow-and-deep-copy-operations9711835
Ref: 2a6d9711835
Ref: library/copy module-copy9711835
Ref: 299711835
Ref: library/copy translation-repo9711835
Ref: 2a6e9711835
Ref: library/copy copy copy9712688
Ref: 7579712688
Ref: library/copy copy deepcopy9712780
Ref: d699712780
Ref: library/copy copy replace9712881
Ref: 1c29712881
Ref: library/copy copy Error9713063
Ref: 2a6f9713063
Ref: library/copy shallow-vs-deep-copy9713147
Ref: 20409713147
Ref: library/copy object __copy__9716083
Ref: 184a9716083
Ref: library/copy object __deepcopy__9716220
Ref: 17b79716220
Ref: library/copy object __replace__9716930
Ref: 47d9716930
Ref: copy --- 浅いコピーおよび深いコピー操作-Footnote-19717369
Node: pprint --- データの整形表示9717433
Ref: library/pprint doc9717631
Ref: 2a719717631
Ref: library/pprint module-pprint9717631
Ref: b39717631
Ref: library/pprint pprint-data-pretty-printer9717631
Ref: 2a729717631
Ref: library/pprint translation-repo9717631
Ref: 2a739717631
Ref: pprint --- データの整形表示-Footnote-19718858
Node: 関数<4>9718924
Ref: library/pprint functions9719046
Ref: 2a749719046
Ref: library/pprint pprint-functions9719046
Ref: 2a759719046
Ref: library/pprint pprint pp9719077
Ref: c1c9719077
Ref: library/pprint pprint pprint9721897
Ref: a2d9721897
Ref: library/pprint pprint pformat9722285
Ref: 11869722285
Ref: library/pprint pprint isreadable9722738
Ref: 2a769722738
Ref: library/pprint pprint isrecursive9723087
Ref: 2a779723087
Ref: library/pprint pprint saferepr9723389
Ref: 2a789723389
Node: PrettyPrinter オブジェクト9724038
Ref: library/pprint id19724181
Ref: 2a799724181
Ref: library/pprint prettyprinter-objects9724181
Ref: 2a7a9724181
Ref: library/pprint pprint PrettyPrinter9724260
Ref: 11859724260
Ref: library/pprint pprint PrettyPrinter pformat9726019
Ref: 2a7b9726019
Ref: library/pprint pprint PrettyPrinter pprint9726268
Ref: 2a7c9726268
Ref: library/pprint pprint PrettyPrinter isreadable9726721
Ref: 2a7d9726721
Ref: library/pprint pprint PrettyPrinter isrecursive9727238
Ref: 2a7e9727238
Ref: library/pprint pprint PrettyPrinter format9727630
Ref: 1d459727630
Node: 使用例<6>9729008
Ref: library/pprint example9729133
Ref: 2a7f9729133
Ref: library/pprint pprint-example9729133
Ref: 2a809729133
Ref: 使用例<6>-Footnote-19736611
Node: reprlib --- もう一つの repr の実装9736636
Ref: library/reprlib doc9736813
Ref: 2a819736813
Ref: library/reprlib module-reprlib9736813
Ref: c09736813
Ref: library/reprlib reprlib-alternate-repr-implementation9736813
Ref: 2a829736813
Ref: library/reprlib translation-repo9736813
Ref: 2a839736813
Ref: library/reprlib reprlib Repr9737422
Ref: 2a849737422
Ref: library/reprlib reprlib aRepr9738478
Ref: 2a869738478
Ref: library/reprlib reprlib repr9738811
Ref: 2a879738811
Ref: library/reprlib reprlib recursive_repr9739244
Ref: 14109739244
Ref: reprlib --- もう一つの repr の実装-Footnote-19740078
Node: Reprオブジェクト9740145
Ref: library/reprlib id19740304
Ref: 2a859740304
Ref: library/reprlib repr-objects9740304
Ref: 2a899740304
Ref: library/reprlib reprlib Repr fillvalue9740616
Ref: 2a8a9740616
Ref: library/reprlib reprlib Repr maxlevel9740765
Ref: 2a8b9740765
Ref: library/reprlib reprlib Repr maxdict9740889
Ref: 2a8c9740889
Ref: library/reprlib reprlib Repr maxlist9740917
Ref: 2a8d9740917
Ref: library/reprlib reprlib Repr maxtuple9740945
Ref: 2a8e9740945
Ref: library/reprlib reprlib Repr maxset9740974
Ref: 2a8f9740974
Ref: library/reprlib reprlib Repr maxfrozenset9741001
Ref: 2a909741001
Ref: library/reprlib reprlib Repr maxdeque9741034
Ref: 2a919741034
Ref: library/reprlib reprlib Repr maxarray9741063
Ref: 2a929741063
Ref: library/reprlib reprlib Repr maxlong9741353
Ref: 2a939741353
Ref: library/reprlib reprlib Repr maxstring9741522
Ref: 2a949741522
Ref: library/reprlib reprlib Repr maxother9741944
Ref: 2a959741944
Ref: library/reprlib reprlib Repr indent9742316
Ref: 2a969742316
Ref: library/reprlib reprlib Repr repr9743797
Ref: 2a889743797
Ref: library/reprlib reprlib Repr repr19743969
Ref: 2a979743969
Node: Reprオブジェクトをサブクラス化する9745032
Ref: library/reprlib subclassing-repr-objects9745191
Ref: 2a989745191
Ref: library/reprlib subclassing-reprs9745191
Ref: 2a999745191
Node: enum --- 列挙型のサポート9745923
Ref: library/enum doc9746114
Ref: 2a9a9746114
Ref: library/enum enum-support-for-enumerations9746114
Ref: 2a9b9746114
Ref: library/enum module-enum9746114
Ref: 5a9746114
Ref: library/enum translation-repo9746114
Ref: 2a9c9746114
Ref: enum --- 列挙型のサポート-Footnote-19748309
Node: モジュールの内容9748373
Ref: library/enum module-contents9748491
Ref: 2aa19748491
Node: データ型<2>9752657
Ref: library/enum data-types9752808
Ref: 2aa59752808
Ref: library/enum enum EnumType9752849
Ref: 4f79752849
Ref: library/enum enum EnumType __call__9753549
Ref: 2aa79753549
Ref: library/enum enum EnumType __contains__9754861
Ref: 2aa89754861
Ref: library/enum enum EnumType __dir__9755347
Ref: 2aa99755347
Ref: library/enum enum EnumType __getitem__9755750
Ref: 2aaa9755750
Ref: library/enum enum EnumType __iter__9755977
Ref: 2aab9755977
Ref: library/enum enum EnumType __len__9756176
Ref: 2aac9756176
Ref: library/enum enum EnumType __members__9756313
Ref: 2aad9756313
Ref: library/enum enum EnumType __reversed__9756437
Ref: 2aae9756437
Ref: library/enum enum Enum9756666
Ref: 8429756666
Ref: library/enum enum Enum name9756762
Ref: 2aaf9756762
Ref: library/enum enum Enum value9756927
Ref: 2ab09756927
Ref: library/enum enum Enum _name_9757868
Ref: 2ab29757868
Ref: library/enum enum Enum _value_9757927
Ref: 2ab39757927
Ref: library/enum enum Enum _order_9758025
Ref: 2ab49758025
Ref: library/enum enum Enum _ignore_9759037
Ref: 2ab59759037
Ref: library/enum enum Enum __dir__9759454
Ref: 1c619759454
Ref: library/enum enum Enum _generate_next_value_9760329
Ref: 2ab79760329
Ref: library/enum enum Enum __init__9761852
Ref: 2ab89761852
Ref: library/enum enum Enum __init_subclass__9762361
Ref: 2ab99762361
Ref: library/enum enum Enum _missing_9762569
Ref: 2aba9762569
Ref: library/enum enum Enum __new__9763564
Ref: 2ab19763564
Ref: library/enum enum Enum __repr__9764295
Ref: 1b589764295
Ref: library/enum enum Enum __str__9765158
Ref: 8349765158
Ref: library/enum enum Enum __format__9765925
Ref: 8329765925
Ref: library/enum enum Enum _add_alias_9766996
Ref: 2abb9766996
Ref: library/enum enum Enum _add_value_alias_9767350
Ref: 2abc9767350
Ref: library/enum enum IntEnum9767770
Ref: edf9767770
Ref: library/enum enum StrEnum9768935
Ref: 82d9768935
Ref: library/enum enum Flag9770441
Ref: 8359770441
Ref: library/enum enum Flag __contains__9770728
Ref: 2abe9770728
Ref: library/enum enum Flag __iter__9771400
Ref: 2abf9771400
Ref: library/enum enum Flag __len__9771699
Ref: 2ac09771699
Ref: library/enum enum Flag __bool__9771930
Ref: 2ac19771930
Ref: library/enum enum Flag __or__9772308
Ref: 2ac29772308
Ref: library/enum enum Flag __and__9772527
Ref: 2ac39772527
Ref: library/enum enum Flag __xor__9772803
Ref: 2ac49772803
Ref: library/enum enum Flag __invert__9773100
Ref: 2ac59773100
Ref: library/enum enum Flag _numeric_repr_9773394
Ref: 2ac69773394
Ref: library/enum enum IntFlag9773918
Ref: e9e9773918
Ref: library/enum enum ReprEnum9775684
Ref: 82e9775684
Ref: library/enum enum EnumCheck9776251
Ref: 8389776251
Ref: library/enum enum EnumCheck UNIQUE9776530
Ref: 2ac79776530
Ref: library/enum enum EnumCheck CONTINUOUS9777053
Ref: 2ac89777053
Ref: library/enum enum EnumCheck NAMED_FLAGS9777584
Ref: 2ac99777584
Ref: library/enum enum FlagBoundary9778563
Ref: 8369778563
Ref: library/enum enum FlagBoundary STRICT9778712
Ref: 2aca9778712
Ref: library/enum enum FlagBoundary CONFORM9779369
Ref: 2acb9779369
Ref: library/enum enum FlagBoundary EJECT9779838
Ref: 2acc9779838
Ref: library/enum enum FlagBoundary KEEP9780278
Ref: 2acd9780278
Ref: library/enum enum EnumDict9780804
Ref: 4f69780804
Ref: library/enum enum EnumDict member_names9781534
Ref: 2ace9781534
Node: __dunder__ 名のサポート9781776
Ref: library/enum enum-dunder-sunder9781893
Ref: 2acf9781893
Ref: library/enum supported-dunder-names9781893
Ref: 2ad09781893
Node: _sunder_ 名のサポート9782382
Ref: library/enum supported-sunder-names9782499
Ref: 2ad19782499
Ref: _sunder_ 名のサポート-Footnote-19784169
Node: Utilities and decorators9784256
Ref: library/enum ipython-s-rich-display9784389
Ref: 2ad29784389
Ref: library/enum utilities-and-decorators9784389
Ref: 2ad39784389
Ref: library/enum enum auto9784458
Ref: e9f9784458
Ref: library/enum enum property9786184
Ref: 83b9786184
Ref: library/enum enum unique9786708
Ref: 2aa39786708
Ref: library/enum enum verify9787360
Ref: 8379787360
Ref: library/enum enum member9787636
Ref: 8399787636
Ref: library/enum enum nonmember9787794
Ref: 83a9787794
Ref: library/enum enum global_enum9787958
Ref: 83d9787958
Ref: library/enum enum show_flag_values9788328
Ref: 2aa49788328
Ref: library/enum enum bin9788504
Ref: 17fd9788504
Node: 注釈9788985
Ref: library/enum notes9789094
Ref: 2aa29789094
Node: graphlib --- グラフ構造を操作する機能9790187
Ref: library/graphlib doc9790327
Ref: 2ad49790327
Ref: library/graphlib graphlib-functionality-to-operate-with-graph-like-structures9790327
Ref: 2ad59790327
Ref: library/graphlib module-graphlib9790327
Ref: 699790327
Ref: library/graphlib translation-repo9790327
Ref: 2ad69790327
Ref: library/graphlib graphlib TopologicalSorter9790546
Ref: ae29790546
Ref: library/graphlib graphlib TopologicalSorter add9794311
Ref: 2ad79794311
Ref: library/graphlib graphlib TopologicalSorter prepare9795233
Ref: 2219795233
Ref: library/graphlib graphlib TopologicalSorter is_active9796067
Ref: 2ad89796067
Ref: library/graphlib graphlib TopologicalSorter done9797005
Ref: 2ada9797005
Ref: library/graphlib graphlib TopologicalSorter get_ready9797690
Ref: 2ad99797690
Ref: library/graphlib graphlib TopologicalSorter static_order9798294
Ref: 2adb9798294
Ref: graphlib --- グラフ構造を操作する機能-Footnote-19799825
Node: 例外<4>9799893
Ref: library/graphlib exceptions9799988
Ref: 2add9799988
Ref: library/graphlib graphlib CycleError9800087
Ref: 2adc9800087
Node: 数値と数学モジュール9800756
Ref: library/numeric doc9800929
Ref: 2ade9800929
Ref: library/numeric numeric9800929
Ref: 2adf9800929
Ref: library/numeric numeric-and-mathematical-modules9800929
Ref: 2ae09800929
Ref: library/numeric translation-repo9800929
Ref: 2ae19800929
Node: numbers --- 数の抽象基底クラス9802112
Ref: library/numbers doc9802248
Ref: 2ae29802248
Ref: library/numbers module-numbers9802248
Ref: a29802248
Ref: library/numbers numbers-numeric-abstract-base-classes9802248
Ref: 2ae39802248
Ref: library/numbers numbers Number9802674
Ref: 2ae49802674
Ref: numbers --- 数の抽象基底クラス-Footnote-19802981
Ref: numbers --- 数の抽象基底クラス-Footnote-29803048
Node: 数値塔9803090
Ref: library/numbers the-numeric-tower9803211
Ref: 2ae59803211
Ref: library/numbers numbers Complex9803247
Ref: 265b9803247
Ref: library/numbers numbers Complex real9803771
Ref: 2ae69803771
Ref: library/numbers numbers Complex imag9803875
Ref: 2ae79803875
Ref: library/numbers numbers Complex conjugate9803979
Ref: 2ae89803979
Ref: library/numbers numbers Real9804167
Ref: 26519804167
Ref: library/numbers numbers Rational9804727
Ref: 14da9804727
Ref: library/numbers numbers Rational numerator9805173
Ref: 2ae99805173
Ref: library/numbers numbers Rational denominator9805265
Ref: 2aea9805265
Ref: library/numbers numbers Integral9805361
Ref: 246a9805361
Node: Notes for type implementers9805829
Ref: library/numbers notes-for-type-implementers9805950
Ref: 2aeb9805950
Node: さらに数のABCを追加する9806794
Ref: library/numbers adding-more-numeric-abcs9806921
Ref: 2aec9806921
Node: 算術演算の実装9807431
Ref: library/numbers id19807558
Ref: 2aed9807558
Ref: library/numbers implementing-the-arithmetic-operations9807558
Ref: 238e9807558
Node: math --- 数学関数9812498
Ref: library/math doc9812680
Ref: 2aee9812680
Ref: library/math math-mathematical-functions9812680
Ref: 2aef9812680
Ref: library/math module-math9812680
Ref: 929812680
Ref: library/math translation-repo9812680
Ref: 2af09812680
Ref: math --- 数学関数-Footnote-19827381
Ref: math --- 数学関数-Footnote-29827434
Ref: math --- 数学関数-Footnote-39827487
Ref: math --- 数学関数-Footnote-49827540
Node: Number-theoretic functions9827593
Ref: library/math number-theoretic-functions9827711
Ref: 2b019827711
Ref: library/math math comb9827784
Ref: 8e09827784
Ref: library/math math factorial9828376
Ref: b459828376
Ref: library/math math gcd9828578
Ref: b109828578
Ref: library/math math isqrt9829121
Ref: bfc9829121
Ref: library/math math lcm9829642
Ref: b119829642
Ref: library/math math perm9830045
Ref: 8e19830045
Node: Floating point arithmetic9830595
Ref: library/math floating-point-arithmetic9830759
Ref: 2b029830759
Ref: library/math math ceil9830830
Ref: 15dc9830830
Ref: library/math math fabs9831093
Ref: 2af19831093
Ref: library/math math floor9831164
Ref: 15db9831164
Ref: library/math math fma9831426
Ref: 5149831426
Ref: library/math math fmod9832111
Ref: 25289832111
Ref: library/math math modf9833143
Ref: 2af29833143
Ref: library/math math remainder9833607
Ref: d4e9833607
Ref: library/math math trunc9834772
Ref: 15dd9834772
Node: Floating point manipulation functions9835749
Ref: library/math floating-point-manipulation-functions9835930
Ref: 2b039835930
Ref: library/math math copysign9836025
Ref: 15f19836025
Ref: library/math math frexp9836307
Ref: 2af39836307
Ref: library/math math isclose9836967
Ref: fb49836967
Ref: library/math math isfinite9838598
Ref: 14089838598
Ref: library/math math isinf9838857
Ref: 15ef9838857
Ref: library/math math isnan9839028
Ref: 15f09839028
Ref: library/math math ldexp9839204
Ref: 18a59839204
Ref: library/math math nextafter9839350
Ref: 6c09839350
Ref: library/math math ulp9840066
Ref: b129840066
Ref: Floating point manipulation functions-Footnote-19841309
Node: Power exponential and logarithmic functions9841351
Ref: library/math power-exponential-and-logarithmic-functions9841538
Ref: 2b049841538
Ref: library/math math cbrt9841647
Ref: 8729841647
Ref: library/math math exp9841747
Ref: 152f9841747
Ref: library/math math exp29841982
Ref: 8719841982
Ref: library/math math expm19842081
Ref: 14099842081
Ref: library/math math log9842691
Ref: 16de9842691
Ref: library/math math log1p9842959
Ref: 15f69842959
Ref: library/math math log29843164
Ref: 12f79843164
Ref: library/math math log109843570
Ref: 19a89843570
Ref: library/math math pow9843743
Ref: 8739843743
Ref: library/math math sqrt9844726
Ref: bfd9844726
Ref: Power exponential and logarithmic functions-Footnote-19844833
Node: Summation and product functions9844892
Ref: library/math summation-and-product-functions9845054
Ref: 2b059845054
Ref: library/math math dist9845137
Ref: bf99845137
Ref: library/math math fsum9845526
Ref: 15f29845526
Ref: library/math math hypot9846282
Ref: bfa9846282
Ref: library/math math prod9847142
Ref: bfb9847142
Ref: library/math math sumprod9847544
Ref: 6bf9847544
Ref: Summation and product functions-Footnote-19848019
Node: 角度変換9848124
Ref: library/math angular-conversion9848255
Ref: 2b069848255
Ref: library/math math degrees9848296
Ref: 2af49848296
Ref: library/math math radians9848389
Ref: 2af59848389
Node: 三角関数9848482
Ref: library/math trigonometric-functions9848597
Ref: 2b079848597
Ref: library/math math acos9848638
Ref: 2af69848638
Ref: library/math math asin9848773
Ref: 2af79848773
Ref: library/math math atan9848920
Ref: 2af89848920
Ref: library/math math atan29849067
Ref: 2af99849067
Ref: library/math math cos9849700
Ref: 16dd9849700
Ref: library/math math sin9849779
Ref: 16dc9849779
Ref: library/math math tan9849858
Ref: 2afa9849858
Node: 双曲線関数9849937
Ref: library/math hyperbolic-functions9850052
Ref: 2b089850052
Ref: library/math math acosh9850211
Ref: 15f39850211
Ref: library/math math asinh9850292
Ref: 15f49850292
Ref: library/math math atanh9850373
Ref: 15f59850373
Ref: library/math math cosh9850454
Ref: 2afb9850454
Ref: library/math math sinh9850531
Ref: 2afc9850531
Ref: library/math math tanh9850608
Ref: 2afd9850608
Ref: 双曲線関数-Footnote-19850721
Node: 特殊関数9850780
Ref: library/math special-functions9850892
Ref: 2b099850892
Ref: library/math math erf9850933
Ref: dd79850933
Ref: library/math math erfc9851351
Ref: dd89851351
Ref: library/math math gamma9851653
Ref: 140a9851653
Ref: library/math math lgamma9851764
Ref: 140b9851764
Ref: 特殊関数-Footnote-19851934
Ref: 特殊関数-Footnote-29852010
Ref: 特殊関数-Footnote-39852081
Ref: 特殊関数-Footnote-49852157
Ref: 特殊関数-Footnote-59852243
Node: 定数<2>9852328
Ref: library/math constants9852416
Ref: 2b0a9852416
Ref: library/math math pi9852449
Ref: 2afe9852449
Ref: library/math math e9852560
Ref: 2aff9852560
Ref: library/math math tau9852678
Ref: 2b009852678
Ref: library/math math inf9853060
Ref: e829853060
Ref: library/math math nan9853269
Ref: 8749853269
Ref: 定数<2>-Footnote-19855283
Ref: 定数<2>-Footnote-29855319
Ref: 定数<2>-Footnote-39855347
Node: cmath --- 複素数用の数学関数9855394
Ref: library/cmath doc9855596
Ref: 2b0b9855596
Ref: library/cmath cmath-mathematical-functions-for-complex-numbers9855596
Ref: 2b0c9855596
Ref: library/cmath module-cmath9855596
Ref: 199855596
Ref: library/cmath translation-repo9855596
Ref: 2b0d9855596
Node: 極座標変換9863895
Ref: library/cmath conversions-to-and-from-polar-coordinates9864020
Ref: 2b269864020
Ref: library/cmath cmath phase9864740
Ref: 2b0f9864740
Ref: library/cmath cmath polar9865482
Ref: 2b109865482
Ref: library/cmath cmath rect9865738
Ref: 2b119865738
Node: 指数関数と対数関数9865920
Ref: library/cmath power-and-logarithmic-functions9866069
Ref: 2b279866069
Ref: library/cmath cmath exp9866135
Ref: 2b129866135
Ref: library/cmath cmath log9866257
Ref: 2b139866257
Ref: library/cmath cmath log109866502
Ref: 2b149866502
Ref: library/cmath cmath sqrt9866634
Ref: 2b0e9866634
Node: 三角関数<2>9866759
Ref: library/cmath trigonometric-functions9866911
Ref: 2b289866911
Ref: library/cmath cmath acos9866952
Ref: 2b159866952
Ref: library/cmath cmath asin9867171
Ref: 2b169867171
Ref: library/cmath cmath atan9867295
Ref: 2b179867295
Ref: library/cmath cmath cos9867542
Ref: 2b189867542
Ref: library/cmath cmath sin9867604
Ref: 2b199867604
Ref: library/cmath cmath tan9867664
Ref: 2b1a9867664
Node: 双曲線関数<2>9867727
Ref: library/cmath hyperbolic-functions9867864
Ref: 2b299867864
Ref: library/cmath cmath acosh9867910
Ref: 2b1b9867910
Ref: library/cmath cmath asinh9868075
Ref: 2b1c9868075
Ref: library/cmath cmath atanh9868335
Ref: 2b1d9868335
Ref: library/cmath cmath cosh9868584
Ref: 2b1e9868584
Ref: library/cmath cmath sinh9868658
Ref: 2b1f9868658
Ref: library/cmath cmath tanh9868730
Ref: 2b209868730
Node: 類別関数9868805
Ref: library/cmath classification-functions9868936
Ref: 2b2a9868936
Ref: library/cmath cmath isfinite9868977
Ref: 2b219868977
Ref: library/cmath cmath isinf9869152
Ref: 2b229869152
Ref: library/cmath cmath isnan9869304
Ref: 2b239869304
Ref: library/cmath cmath isclose9869450
Ref: fb59869450
Ref: 類別関数-Footnote-19871108
Node: 定数<3>9871150
Ref: library/cmath constants9871254
Ref: 2b2b9871254
Ref: library/cmath cmath pi9871285
Ref: 2b249871285
Ref: library/cmath cmath e9871373
Ref: 2b259871373
Ref: library/cmath cmath tau9871468
Ref: e819871468
Ref: library/cmath cmath inf9871580
Ref: e839871580
Ref: library/cmath cmath infj9871723
Ref: e859871723
Ref: library/cmath cmath nan9871904
Ref: e849871904
Ref: library/cmath cmath nanj9872080
Ref: e869872080
Node: decimal --- 10進固定小数点と浮動小数点の演算9873644
Ref: library/decimal doc9873848
Ref: 2b2c9873848
Ref: library/decimal decimal-decimal-fixed-point-and-floating-point-arithmetic9873848
Ref: 2b2d9873848
Ref: library/decimal module-decimal9873848
Ref: 3a9873848
Ref: library/decimal translation-repo9873848
Ref: 2b2e9873848
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-19880368
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-29880435
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-39880498
Node: Quick-start tutorial9880552
Ref: library/decimal decimal-tutorial9880703
Ref: 12b59880703
Ref: library/decimal quick-start-tutorial9880703
Ref: 2b3e9880703
Node: Decimal オブジェクト9889333
Ref: library/decimal decimal-decimal9889519
Ref: 2b419889519
Ref: library/decimal decimal-objects9889519
Ref: 2b429889519
Ref: library/decimal decimal Decimal9889586
Ref: 2009889586
Ref: library/decimal decimal Decimal adjusted9895651
Ref: 2b439895651
Ref: library/decimal decimal Decimal as_integer_ratio9896008
Ref: e969896008
Ref: library/decimal decimal Decimal as_tuple9896504
Ref: 2b449896504
Ref: library/decimal decimal Decimal canonical9896693
Ref: 2b459896693
Ref: library/decimal decimal Decimal compare9897009
Ref: 2b469897009
Ref: library/decimal decimal Decimal compare_signal9897489
Ref: 2b479897489
Ref: library/decimal decimal Decimal compare_total9897925
Ref: 2b489897925
Ref: library/decimal decimal Decimal compare_total_mag9899298
Ref: 2b499899298
Ref: library/decimal decimal Decimal conjugate9900037
Ref: 2b4a9900037
Ref: library/decimal decimal Decimal copy_abs9900210
Ref: 2b4b9900210
Ref: library/decimal decimal Decimal copy_negate9900449
Ref: 2b4c9900449
Ref: library/decimal decimal Decimal copy_sign9900697
Ref: 2b4d9900697
Ref: library/decimal decimal Decimal exp9901343
Ref: 12c29901343
Ref: library/decimal decimal Decimal from_float9901767
Ref: 14219901767
Ref: library/decimal decimal Decimal from_number9902993
Ref: 1ff9902993
Ref: library/decimal decimal Decimal fma9903542
Ref: 2b4e9903542
Ref: library/decimal decimal Decimal is_canonical9903834
Ref: 2b4f9903834
Ref: library/decimal decimal Decimal is_finite9904197
Ref: 2b509904197
Ref: library/decimal decimal Decimal is_infinite9904377
Ref: 2b519904377
Ref: library/decimal decimal Decimal is_nan9904566
Ref: 2b529904566
Ref: library/decimal decimal Decimal is_normal9904764
Ref: 2b539904764
Ref: library/decimal decimal Decimal is_qnan9905046
Ref: 2b549905046
Ref: library/decimal decimal Decimal is_signed9905217
Ref: 2b559905217
Ref: library/decimal decimal Decimal is_snan9905489
Ref: 2b569905489
Ref: library/decimal decimal Decimal is_subnormal9905660
Ref: 2b579905660
Ref: library/decimal decimal Decimal is_zero9905861
Ref: 2b589905861
Ref: library/decimal decimal Decimal ln9906048
Ref: 12c39906048
Ref: library/decimal decimal Decimal log109906261
Ref: 2b599906261
Ref: library/decimal decimal Decimal logb9906464
Ref: 2b5a9906464
Ref: library/decimal decimal Decimal logical_and9906913
Ref: 2b5b9906913
Ref: library/decimal decimal Decimal logical_invert9907185
Ref: 2b5d9907185
Ref: library/decimal decimal Decimal logical_or9907364
Ref: 2b5e9907364
Ref: library/decimal decimal Decimal logical_xor9907632
Ref: 2b5f9907632
Ref: library/decimal decimal Decimal max9907911
Ref: 2b609907911
Ref: library/decimal decimal Decimal max_mag9908319
Ref: 2b619908319
Ref: library/decimal decimal Decimal min9908490
Ref: 2b629908490
Ref: library/decimal decimal Decimal min_mag9908898
Ref: 2b639908898
Ref: library/decimal decimal Decimal next_minus9909069
Ref: 2b649909069
Ref: library/decimal decimal Decimal next_plus9909362
Ref: 2b659909362
Ref: library/decimal decimal Decimal next_toward9909654
Ref: 2b669909654
Ref: library/decimal decimal Decimal normalize9910019
Ref: 2b679910019
Ref: library/decimal decimal Decimal number_class9911071
Ref: 2b689911071
Ref: library/decimal decimal Decimal quantize9912130
Ref: 12c89912130
Ref: library/decimal decimal Decimal radix9913683
Ref: 2b6a9913683
Ref: library/decimal decimal Decimal remainder_near9913936
Ref: 2b6b9913936
Ref: library/decimal decimal Decimal rotate9914828
Ref: 2b6c9914828
Ref: library/decimal decimal Decimal same_quantum9915520
Ref: 2b6d9915520
Ref: library/decimal decimal Decimal scaleb9916107
Ref: 2b6e9916107
Ref: library/decimal decimal Decimal shift9916454
Ref: 2b6f9916454
Ref: library/decimal decimal Decimal sqrt9917141
Ref: 2b709917141
Ref: library/decimal decimal Decimal to_eng_string9917248
Ref: 2b719917248
Ref: library/decimal decimal Decimal to_integral9917798
Ref: 2b729917798
Ref: library/decimal decimal Decimal to_integral_exact9918063
Ref: 2b749918063
Ref: library/decimal decimal Decimal to_integral_value9918684
Ref: 2b739918684
Node: 論理引数9921266
Ref: library/decimal logical-operands9921341
Ref: 2b759921341
Ref: library/decimal logical-operands-label9921341
Ref: 2b5c9921341
Node: Context オブジェクト9921757
Ref: library/decimal context-objects9921932
Ref: 2b769921932
Ref: library/decimal decimal-context9921932
Ref: 27bf9921932
Ref: library/decimal decimal getcontext9922502
Ref: 19979922502
Ref: library/decimal decimal setcontext9922625
Ref: 2b3f9922625
Ref: library/decimal decimal localcontext9922908
Ref: 15a29922908
Ref: library/decimal decimal IEEEContext9924437
Ref: 2019924437
Ref: library/decimal decimal BasicContext9924957
Ref: 12bc9924957
Ref: library/decimal decimal ExtendedContext9925572
Ref: 12bd9925572
Ref: library/decimal decimal DefaultContext9926398
Ref: 12bb9926398
Ref: library/decimal decimal Context9927908
Ref: 12c79927908
Ref: library/decimal decimal Context prec9928408
Ref: 2b789928408
Ref: library/decimal decimal Context rounding9928578
Ref: 2b799928578
Ref: library/decimal decimal Context traps9928700
Ref: 12c69928700
Ref: library/decimal decimal Context flags9928726
Ref: 12c59928726
Ref: library/decimal decimal Context Emin9928880
Ref: 12bf9928880
Ref: library/decimal decimal Context Emax9928905
Ref: 12be9928905
Ref: library/decimal decimal Context capitals9929139
Ref: 2b7b9929139
Ref: library/decimal decimal Context clamp9929374
Ref: 13ba9929374
Ref: library/decimal decimal Context clear_flags9931289
Ref: 2b409931289
Ref: library/decimal decimal Context clear_traps9931394
Ref: 2b7c9931394
Ref: library/decimal decimal Context copy9931535
Ref: 2b7d9931535
Ref: library/decimal decimal Context copy_decimal9931624
Ref: 2b7e9931624
Ref: library/decimal decimal Context create_decimal9931743
Ref: 12c19931743
Ref: library/decimal decimal Context create_decimal_from_float9933317
Ref: 2b7f9933317
Ref: library/decimal decimal Context Etiny9934188
Ref: 2b699934188
Ref: library/decimal decimal Context Etop9934461
Ref: 2b809934461
Ref: library/decimal decimal Context abs9935166
Ref: 2b819935166
Ref: library/decimal decimal Context add9935247
Ref: 2b829935247
Ref: library/decimal decimal Context canonical9935333
Ref: 15229935333
Ref: library/decimal decimal Context compare9935442
Ref: 2b839935442
Ref: library/decimal decimal Context compare_signal9935544
Ref: 2b849935544
Ref: library/decimal decimal Context compare_total9935668
Ref: 2b859935668
Ref: library/decimal decimal Context compare_total_mag9935800
Ref: 2b869935800
Ref: library/decimal decimal Context copy_abs9935954
Ref: 2b879935954
Ref: library/decimal decimal Context copy_negate9936070
Ref: 2b889936070
Ref: library/decimal decimal Context copy_sign9936180
Ref: 2b899936180
Ref: library/decimal decimal Context divide9936284
Ref: 2b8a9936284
Ref: library/decimal decimal Context divide_int9936385
Ref: 2b8b9936385
Ref: library/decimal decimal Context divmod9936514
Ref: 2b8c9936514
Ref: library/decimal decimal Context exp9936642
Ref: 2b8d9936642
Ref: library/decimal decimal Context fma9936720
Ref: 2b8e9936720
Ref: library/decimal decimal Context is_canonical9936835
Ref: 15239936835
Ref: library/decimal decimal Context is_finite9937011
Ref: 2b8f9937011
Ref: library/decimal decimal Context is_infinite9937170
Ref: 2b909937170
Ref: library/decimal decimal Context is_nan9937331
Ref: 2b919937331
Ref: library/decimal decimal Context is_normal9937498
Ref: 2b929937498
Ref: library/decimal decimal Context is_qnan9937662
Ref: 2b939937662
Ref: library/decimal decimal Context is_signed9937826
Ref: 2b949937826
Ref: library/decimal decimal Context is_snan9937990
Ref: 2b959937990
Ref: library/decimal decimal Context is_subnormal9938154
Ref: 2b969938154
Ref: library/decimal decimal Context is_zero9938324
Ref: 2b979938324
Ref: library/decimal decimal Context ln9938484
Ref: 2b989938484
Ref: library/decimal decimal Context log109938584
Ref: 2b999938584
Ref: library/decimal decimal Context logb9938674
Ref: 2b9a9938674
Ref: library/decimal decimal Context logical_and9938784
Ref: 2b9b9938784
Ref: library/decimal decimal Context logical_invert9938906
Ref: 2b9c9938906
Ref: library/decimal decimal Context logical_or9939007
Ref: 2b9d9939007
Ref: library/decimal decimal Context logical_xor9939127
Ref: 2b9e9939127
Ref: library/decimal decimal Context max9939249
Ref: 2b9f9939249
Ref: library/decimal decimal Context max_mag9939374
Ref: 2ba09939374
Ref: library/decimal decimal Context min9939488
Ref: 2ba19939488
Ref: library/decimal decimal Context min_mag9939613
Ref: 2ba29939613
Ref: library/decimal decimal Context minus9939727
Ref: 2ba39939727
Ref: library/decimal decimal Context multiply9939852
Ref: 2ba49939852
Ref: library/decimal decimal Context next_minus9939943
Ref: 2ba59939943
Ref: library/decimal decimal Context next_plus9940061
Ref: 2ba69940061
Ref: library/decimal decimal Context next_toward9940178
Ref: 2ba79940178
Ref: library/decimal decimal Context normalize9940305
Ref: 2ba89940305
Ref: library/decimal decimal Context number_class9940404
Ref: 2ba99940404
Ref: library/decimal decimal Context plus9940515
Ref: 2baa9940515
Ref: library/decimal decimal Context power9940781
Ref: 2bab9940781
Ref: library/decimal decimal Context quantize9942829
Ref: 2bac9942829
Ref: library/decimal decimal Context radix9942959
Ref: 2bad9942959
Ref: library/decimal decimal Context remainder9943059
Ref: 2bae9943059
Ref: library/decimal decimal Context remainder_near9943259
Ref: 2baf9943259
Ref: library/decimal decimal Context rotate9943525
Ref: 2bb09943525
Ref: library/decimal decimal Context same_quantum9943632
Ref: 2bb19943632
Ref: library/decimal decimal Context scaleb9943782
Ref: 2bb29943782
Ref: library/decimal decimal Context shift9943925
Ref: 2bb39943925
Ref: library/decimal decimal Context sqrt9944034
Ref: 2bb49944034
Ref: library/decimal decimal Context subtract9944140
Ref: 2bb59944140
Ref: library/decimal decimal Context to_eng_string9944237
Ref: 2bb69944237
Ref: library/decimal decimal Context to_integral_exact9944664
Ref: 2bb79944664
Ref: library/decimal decimal Context to_sci_string9944767
Ref: 2bb89944767
Node: 定数<4>9944878
Ref: library/decimal constants9945042
Ref: 2bb99945042
Ref: library/decimal decimal-rounding-modes9945042
Ref: 2bba9945042
Ref: library/decimal decimal MAX_PREC9945543
Ref: 12b89945543
Ref: library/decimal decimal MAX_EMAX9945769
Ref: 12b99945769
Ref: library/decimal decimal MIN_EMIN9945995
Ref: 12ba9945995
Ref: library/decimal decimal MIN_ETINY9946223
Ref: 2bbb9946223
Ref: library/decimal decimal IEEE_CONTEXT_MAX_BITS9946433
Ref: 2b779946433
Ref: library/decimal decimal HAVE_THREADS9946566
Ref: 12b69946566
Ref: library/decimal decimal HAVE_CONTEXTVAR9946776
Ref: 21c39946776
Node: 丸めモード9947144
Ref: library/decimal rounding-modes9947294
Ref: 2b7a9947294
Ref: library/decimal decimal ROUND_CEILING9947340
Ref: 2b2f9947340
Ref: library/decimal decimal ROUND_DOWN9947424
Ref: 2b309947424
Ref: library/decimal decimal ROUND_FLOOR9947496
Ref: 2b319947496
Ref: library/decimal decimal ROUND_HALF_DOWN9947579
Ref: 2b329947579
Ref: library/decimal decimal ROUND_HALF_EVEN9947695
Ref: 2b339947695
Ref: library/decimal decimal ROUND_HALF_UP9947817
Ref: 2b349947817
Ref: library/decimal decimal ROUND_UP9947943
Ref: 2b359947943
Ref: library/decimal decimal ROUND_05UP9948025
Ref: 2b369948025
Node: シグナル9948223
Ref: library/decimal decimal-signals9948384
Ref: 12b49948384
Ref: library/decimal signals9948384
Ref: 2bbc9948384
Ref: library/decimal decimal Clamped9949367
Ref: 2b379949367
Ref: library/decimal decimal DecimalException9949829
Ref: 2bbd9949829
Ref: library/decimal decimal DivisionByZero9949982
Ref: 2b389949982
Ref: library/decimal decimal Inexact9950409
Ref: 2b399950409
Ref: library/decimal decimal InvalidOperation9950836
Ref: 12c09950836
Ref: library/decimal decimal Overflow9951464
Ref: 2b3c9951464
Ref: library/decimal decimal Rounded9952118
Ref: 2b3a9952118
Ref: library/decimal decimal Subnormal9952671
Ref: 2b3b9952671
Ref: library/decimal decimal Underflow9953027
Ref: 2b3d9953027
Ref: library/decimal decimal FloatOperation9953393
Ref: 12b39953393
Node: Floating-point notes9954907
Ref: library/decimal decimal-notes9955083
Ref: 2bbe9955083
Ref: library/decimal floating-point-notes9955083
Ref: 2bbf9955083
Node: 精度を上げて丸め誤差を抑制する9955218
Ref: library/decimal mitigating-round-off-error-with-increased-precision9955338
Ref: 2bc09955338
Node: 特殊値9957088
Ref: library/decimal special-values9957208
Ref: 2bc19957208
Node: スレッドを使った処理9961055
Ref: library/decimal decimal-threads9961228
Ref: 2bc29961228
Ref: library/decimal working-with-threads9961228
Ref: 2bc39961228
Node: レシピ9963193
Ref: library/decimal decimal-recipes9963357
Ref: 2bc49963357
Ref: library/decimal recipes9963357
Ref: 2bc59963357
Node: Decimal FAQ9968244
Ref: library/decimal decimal-faq9968369
Ref: 2bc69968369
Ref: library/decimal id19968369
Ref: 2bc79968369
Ref: Decimal FAQ-Footnote-19977480
Ref: Decimal FAQ-Footnote-29977547
Ref: Decimal FAQ-Footnote-39977578
Ref: Decimal FAQ-Footnote-49977636
Ref: Decimal FAQ-Footnote-59977739
Node: fractions --- 有理数9977856
Ref: library/fractions doc9978061
Ref: 2bc89978061
Ref: library/fractions fractions-rational-numbers9978061
Ref: 2bc99978061
Ref: library/fractions module-fractions9978061
Ref: 619978061
Ref: library/fractions translation-repo9978061
Ref: 2bca9978061
Ref: library/fractions fractions Fraction9978428
Ref: 2159978428
Ref: library/fractions fractions Fraction numerator9983114
Ref: 2bcc9983114
Ref: library/fractions fractions Fraction denominator9983211
Ref: 2bcd9983211
Ref: library/fractions fractions Fraction as_integer_ratio9983338
Ref: 2bce9983338
Ref: library/fractions fractions Fraction is_integer9983587
Ref: 2bcf9983587
Ref: library/fractions fractions Fraction from_float9983719
Ref: 14229983719
Ref: library/fractions fractions Fraction from_decimal9984208
Ref: 14239984208
Ref: library/fractions fractions Fraction from_number9984628
Ref: 2169984628
Ref: library/fractions fractions Fraction limit_denominator9984996
Ref: 2bcb9984996
Ref: library/fractions fractions Fraction __floor__9985898
Ref: 1b569985898
Ref: library/fractions fractions Fraction __ceil__9986211
Ref: 1b559986211
Ref: library/fractions fractions Fraction __round__9986419
Ref: 1b549986419
Ref: library/fractions fractions Fraction __format__9986938
Ref: 2bd09986938
Ref: fractions --- 有理数-Footnote-19989259
Ref: fractions --- 有理数-Footnote-29989328
Node: random --- 疑似乱数を生成する9989370
Ref: library/random doc9989552
Ref: 2bd19989552
Ref: library/random module-random9989552
Ref: bd9989552
Ref: library/random random-generate-pseudo-random-numbers9989552
Ref: 2bd29989552
Ref: library/random translation-repo9989552
Ref: 2bd39989552
Ref: random --- 疑似乱数を生成する-Footnote-19993444
Ref: random --- 疑似乱数を生成する-Footnote-29993510
Node: 保守 bookkeeping 関数9993600
Ref: library/random bookkeeping-functions9993733
Ref: 2bd59993733
Ref: library/random random seed9993804
Ref: 148f9993804
Ref: library/random random getstate9995207
Ref: 2bd69995207
Ref: library/random random setstate9995466
Ref: 2bd79995466
Node: バイト列用の関数9995751
Ref: library/random functions-for-bytes9995911
Ref: 2bd89995911
Ref: library/random random randbytes9995972
Ref: 188c9995972
Node: 整数用の関数9996316
Ref: library/random functions-for-integers9996478
Ref: 2bda9996478
Ref: library/random random randrange9996529
Ref: a6f9996529
Ref: library/random random randint9997716
Ref: 144b9997716
Ref: library/random random getrandbits9997898
Ref: 12139997898
Node: シーケンス用の関数9998497
Ref: library/random functions-for-sequences9998657
Ref: 2bdb9998657
Ref: library/random random choice9998723
Ref: 144c9998723
Ref: library/random random choices9998928
Ref: ec59998928
Ref: library/random random shuffle10001401
Ref: 95210001401
Ref: library/random random sample10002318
Ref: 95110002318
Node: Discrete distributions10004281
Ref: library/random discrete-distributions10004435
Ref: 2bdc10004435
Ref: library/random random binomialvariate10004559
Ref: 6d710004559
Ref: Discrete distributions-Footnote-110005122
Node: 実数分布10005186
Ref: library/random id110005328
Ref: 2bdd10005328
Ref: library/random real-valued-distributions10005328
Ref: 2bde10005328
Ref: library/random random random10005675
Ref: 95310005675
Ref: library/random random uniform10005802
Ref: 2bdf10005802
Ref: library/random random triangular10006180
Ref: 2be010006180
Ref: library/random random betavariate10006593
Ref: 2be110006593
Ref: library/random random expovariate10006807
Ref: 6d810006807
Ref: library/random random gammavariate10007274
Ref: 2be210007274
Ref: library/random random gauss10007765
Ref: 1c3510007765
Ref: library/random random lognormvariate10008554
Ref: 2be310008554
Ref: library/random random normalvariate10008891
Ref: 1c3610008891
Ref: library/random random vonmisesvariate10009137
Ref: 2be410009137
Ref: library/random random paretovariate10009522
Ref: 2be510009522
Ref: library/random random weibullvariate10009643
Ref: 2be610009643
Node: 他の生成器10009812
Ref: library/random alternative-generator10009953
Ref: 2be710009953
Ref: library/random random Random10009999
Ref: 1cb910009999
Ref: library/random random Random seed10010570
Ref: 1dc810010570
Ref: library/random random Random getstate10010742
Ref: 2be810010742
Ref: library/random random Random setstate10010905
Ref: 2be910010905
Ref: library/random random Random random10011073
Ref: 2bea10011073
Ref: library/random random Random getrandbits10011321
Ref: 2beb10011321
Ref: library/random random Random randbytes10011491
Ref: b2710011491
Ref: library/random random SystemRandom10011657
Ref: 2bd410011657
Node: 再現性について10012325
Ref: library/random notes-on-reproducibility10012466
Ref: 2bec10012466
Node: 使用例<7>10013347
Ref: library/random examples10013485
Ref: 2bed10013485
Ref: library/random random-examples10013485
Ref: 13f910013485
Ref: 使用例<7>-Footnote-110018898
Ref: 使用例<7>-Footnote-210019019
Ref: 使用例<7>-Footnote-310019065
Ref: 使用例<7>-Footnote-410019146
Ref: 使用例<7>-Footnote-510019198
Ref: 使用例<7>-Footnote-610019253
Ref: 使用例<7>-Footnote-710019321
Ref: 使用例<7>-Footnote-810019357
Ref: 使用例<7>-Footnote-910019427
Node: レシピ<2>10019463
Ref: library/random recipes10019616
Ref: 2bee10019616
Ref: レシピ<2>-Footnote-110023353
Node: コマンドラインでの使用<2>10023421
Ref: library/random command-line-usage10023589
Ref: 2bef10023589
Ref: library/random random-cli10023589
Ref: 47f10023589
Ref: library/random cmdoption-random-h10023899
Ref: 2bf010023899
Ref: library/random cmdoption-random-help10023899
Ref: 2bf110023899
Ref: library/random cmdoption-random-c10023987
Ref: 2bf210023987
Ref: library/random cmdoption-random-choice10024022
Ref: 2bf310024022
Ref: library/random cmdoption-random-i10024153
Ref: 2bf410024153
Ref: library/random cmdoption-random-integer10024172
Ref: 2bf510024172
Ref: library/random cmdoption-random-f10024321
Ref: 2bf610024321
Ref: library/random cmdoption-random-float10024340
Ref: 2bf710024340
Node: コマンドラインの例10024756
Ref: library/random command-line-example10024903
Ref: 2bf810024903
Ref: library/random random-cli-example10024903
Ref: 2bf910024903
Node: statistics --- 数学的統計関数10025757
Ref: library/statistics doc10025907
Ref: 2bfa10025907
Ref: library/statistics module-statistics10025907
Ref: d710025907
Ref: library/statistics statistics-mathematical-statistics-functions10025907
Ref: 2bfb10025907
Ref: library/statistics translation-repo10025907
Ref: 2bfc10025907
Ref: statistics --- 数学的統計関数-Footnote-110028583
Ref: statistics --- 数学的統計関数-Footnote-210028653
Ref: statistics --- 数学的統計関数-Footnote-310028679
Node: 平均及び中心位置の測度10028706
Ref: library/statistics averages-and-measures-of-central-location10028836
Ref: 2bfd10028836
Node: 分散の測度10030671
Ref: library/statistics measures-of-spread10030838
Ref: 2c0210030838
Node: 2入力間の関係の統計10031465
Ref: library/statistics statistics-for-relations-between-two-inputs10031614
Ref: 2c0410031614
Node: 関数の詳細10032131
Ref: library/statistics function-details10032274
Ref: 2c0510032274
Ref: library/statistics statistics mean10032490
Ref: 8e210032490
Ref: library/statistics statistics fmean10034115
Ref: c2d10034115
Ref: library/statistics statistics geometric_mean10035106
Ref: c2e10035106
Ref: library/statistics statistics harmonic_mean10035796
Ref: ee110035796
Ref: library/statistics statistics kde10037378
Ref: 55310037378
Ref: library/statistics statistics kde_random10039257
Ref: 55410039257
Ref: library/statistics statistics median10040307
Ref: 2bfe10040307
Ref: library/statistics statistics median_low10041468
Ref: 2bff10041468
Ref: library/statistics statistics median_high10042194
Ref: 2c0010042194
Ref: library/statistics statistics median_grouped10042914
Ref: 2c0110042914
Ref: library/statistics statistics mode10044819
Ref: c8910044819
Ref: library/statistics statistics multimode10046384
Ref: c2f10046384
Ref: library/statistics statistics pstdev10046806
Ref: 181e10046806
Ref: library/statistics statistics pvariance10047085
Ref: 2c0310047085
Ref: library/statistics statistics stdev10049378
Ref: 8e410049378
Ref: library/statistics statistics variance10049662
Ref: 8e310049662
Ref: library/statistics statistics quantiles10052018
Ref: c3010052018
Ref: library/statistics statistics covariance10055002
Ref: a3510055002
Ref: library/statistics statistics correlation10055619
Ref: 6e310055619
Ref: library/statistics statistics linear_regression10057706
Ref: a3610057706
Ref: 関数の詳細-Footnote-110060299
Ref: 関数の詳細-Footnote-210060347
Ref: 関数の詳細-Footnote-310060393
Ref: 関数の詳細-Footnote-410060448
Ref: 関数の詳細-Footnote-510060544
Ref: 関数の詳細-Footnote-610060602
Ref: 関数の詳細-Footnote-710060674
Ref: 関数の詳細-Footnote-810060725
Ref: 関数の詳細-Footnote-910060795
Ref: 関数の詳細-Footnote-1010060876
Ref: 関数の詳細-Footnote-1110060949
Ref: 関数の詳細-Footnote-1210061013
Node: 例外<5>10061071
Ref: library/statistics exceptions10061215
Ref: 2c0710061215
Ref: library/statistics statistics StatisticsError10061286
Ref: 2c0610061286
Node: NormalDist オブジェクト10061401
Ref: library/statistics normaldist-objects10061548
Ref: 2c0810061548
Ref: library/statistics statistics NormalDist10061954
Ref: c3110061954
Ref: library/statistics statistics NormalDist mean10062244
Ref: 2c0910062244
Ref: library/statistics statistics NormalDist median10062365
Ref: 2c0a10062365
Ref: library/statistics statistics NormalDist mode10062479
Ref: 2c0b10062479
Ref: library/statistics statistics NormalDist stdev10062579
Ref: 2c0c10062579
Ref: library/statistics statistics NormalDist variance10062704
Ref: 2c0d10062704
Ref: library/statistics statistics NormalDist from_samples10062870
Ref: 2c0e10062870
Ref: library/statistics statistics NormalDist samples10063484
Ref: 2c0f10063484
Ref: library/statistics statistics NormalDist pdf10064110
Ref: 2c1010064110
Ref: library/statistics statistics NormalDist cdf10064713
Ref: 18b710064713
Ref: library/statistics statistics NormalDist inv_cdf10064962
Ref: 2c1110064962
Ref: library/statistics statistics NormalDist overlap10065407
Ref: 2c1210065407
Ref: library/statistics statistics NormalDist quantiles10065669
Ref: 2c1310065669
Ref: library/statistics statistics NormalDist zscore10066130
Ref: 2c1410066130
Ref: NormalDist オブジェクト-Footnote-110067542
Ref: NormalDist オブジェクト-Footnote-210067606
Ref: NormalDist オブジェクト-Footnote-310067666
Ref: NormalDist オブジェクト-Footnote-410067720
Ref: NormalDist オブジェクト-Footnote-510067777
Ref: NormalDist オブジェクト-Footnote-610067831
Ref: NormalDist オブジェクト-Footnote-710067876
Ref: NormalDist オブジェクト-Footnote-810067932
Ref: NormalDist オブジェクト-Footnote-910067989
Ref: NormalDist オブジェクト-Footnote-1010068036
Ref: NormalDist オブジェクト-Footnote-1110068104
Ref: NormalDist オブジェクト-Footnote-1210068176
Ref: NormalDist オブジェクト-Footnote-1310068233
Ref: NormalDist オブジェクト-Footnote-1410068368
Ref: NormalDist オブジェクト-Footnote-1510068415
Ref: NormalDist オブジェクト-Footnote-1610068493
Node: 例とレシピ<2>10068578
Ref: library/statistics examples-and-recipes10068707
Ref: 2c1510068707
Node: Classic probability problems10068906
Ref: library/statistics classic-probability-problems10069032
Ref: 2c1610069032
Ref: Classic probability problems-Footnote-110069861
Ref: Classic probability problems-Footnote-210069932
Ref: Classic probability problems-Footnote-310069979
Node: Monte Carlo inputs for simulations10070024
Ref: library/statistics monte-carlo-inputs-for-simulations10070195
Ref: 2c1710070195
Ref: Monte Carlo inputs for simulations-Footnote-110070885
Node: Approximating binomial distributions10070942
Ref: library/statistics approximating-binomial-distributions10071110
Ref: 2c1810071110
Ref: Approximating binomial distributions-Footnote-110072542
Node: Naive bayesian classifier10072606
Ref: library/statistics naive-bayesian-classifier10072731
Ref: 2c1910072731
Ref: Naive bayesian classifier-Footnote-110074624
Ref: Naive bayesian classifier-Footnote-210074708
Ref: Naive bayesian classifier-Footnote-310074764
Node: 関数型プログラミング用モジュール10074834
Ref: library/functional doc10075046
Ref: 2c1a10075046
Ref: library/functional functional-programming-modules10075046
Ref: 2c1b10075046
Ref: library/functional translation-repo10075046
Ref: 2c1c10075046
Node: itertools --- 効率的なループ用のイテレータ生成関数群10075783
Ref: library/itertools doc10076022
Ref: 2c1d10076022
Ref: library/itertools itertools-functions-creating-iterators-for-efficient-looping10076022
Ref: 2c1e10076022
Ref: library/itertools module-itertools10076022
Ref: 8510076022
Node: Itertool関数10087148
Ref: library/itertools itertool-functions10087298
Ref: 2c2410087298
Ref: library/itertools itertools-functions10087298
Ref: 2c2510087298
Ref: library/itertools itertools accumulate10087528
Ref: bf410087528
Ref: library/itertools itertools batched10090013
Ref: 51110090013
Ref: library/itertools itertools chain10091575
Ref: 263d10091575
Ref: library/itertools itertools chain from_iterable10092055
Ref: 2c1f10092055
Ref: library/itertools itertools combinations10092551
Ref: 152d10092551
Ref: library/itertools itertools combinations_with_replacement10094176
Ref: 149d10094176
Ref: library/itertools itertools compress10095775
Ref: 149e10095775
Ref: library/itertools itertools count10096273
Ref: 149f10096273
Ref: library/itertools itertools cycle10097134
Ref: 2c2010097134
Ref: library/itertools itertools dropwhile10097838
Ref: 2c2110097838
Ref: library/itertools itertools filterfalse10098546
Ref: 262d10098546
Ref: library/itertools itertools groupby10099132
Ref: 17cc10099132
Ref: library/itertools itertools islice10102104
Ref: d4710102104
Ref: library/itertools itertools pairwise10103880
Ref: a1a10103880
Ref: library/itertools itertools permutations10104504
Ref: 1d3b10104504
Ref: library/itertools itertools product10106600
Ref: 152e10106600
Ref: library/itertools itertools repeat10108494
Ref: 18be10108494
Ref: library/itertools itertools starmap10109205
Ref: 12fe10109205
Ref: library/itertools itertools takewhile10109842
Ref: 2c2210109842
Ref: library/itertools itertools tee10110646
Ref: 2c2310110646
Ref: library/itertools itertools zip_longest10113522
Ref: 14ba10113522
Ref: Itertool関数-Footnote-110115031
Ref: Itertool関数-Footnote-210115105
Ref: Itertool関数-Footnote-310115160
Ref: Itertool関数-Footnote-410115216
Node: Itertools レシピ10115314
Ref: library/itertools id110115464
Ref: 2c2710115464
Ref: library/itertools itertools-recipes10115464
Ref: 147a10115464
Ref: Itertools レシピ-Footnote-110131541
Ref: Itertools レシピ-Footnote-210131590
Node: functools --- 高階関数と呼び出し可能オブジェクトの操作10131661
Ref: library/functools doc10131952
Ref: 2c2810131952
Ref: library/functools functools-higher-order-functions-and-operations-on-callable-objects10131952
Ref: 2c2910131952
Ref: library/functools module-functools10131952
Ref: 6310131952
Ref: library/functools translation-repo10131952
Ref: 2c2a10131952
Ref: library/functools functools cache10132478
Ref: 183310132478
Ref: library/functools functools cached_property10133757
Ref: 76310133757
Ref: library/functools functools cmp_to_key10137704
Ref: 13f610137704
Ref: library/functools functools lru_cache10138953
Ref: be610138953
Ref: library/functools functools lru_cache cache_info10141870
Ref: 2c2c10141870
Ref: library/functools functools lru_cache cache_clear10142135
Ref: 2c2d10142135
Ref: library/functools functools total_ordering10145044
Ref: 114810145044
Ref: library/functools functools Placeholder10147581
Ref: 21810147581
Ref: library/functools functools partial10147813
Ref: 21910147813
Ref: library/functools functools partialmethod10151068
Ref: 21a10151068
Ref: library/functools functools reduce10153117
Ref: 21c10153117
Ref: library/functools functools singledispatch10154499
Ref: 84b10154499
Ref: library/functools functools singledispatch register10155131
Ref: 2c2e10155131
Ref: library/functools functools singledispatchmethod10161192
Ref: be910161192
Ref: library/functools functools update_wrapper10162949
Ref: 122710162949
Ref: library/functools functools wraps10165840
Ref: 116310165840
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-110167171
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-210167240
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-310167290
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-410167332
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-510167424
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-610167478
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-710167538
Node: partial オブジェクト10167603
Ref: library/functools id110167740
Ref: 2c3010167740
Ref: library/functools partial-objects10167740
Ref: 21b10167740
Ref: library/functools functools partial func10168034
Ref: 2c3110168034
Ref: library/functools functools partial args10168284
Ref: 2c3210168284
Ref: library/functools functools partial keywords10168482
Ref: 2c3310168482
Node: operator --- 関数形式の標準演算子10168913
Ref: library/operator doc10169124
Ref: 2c3410169124
Ref: library/operator module-operator10169124
Ref: a310169124
Ref: library/operator operator-standard-operators-as-functions10169124
Ref: 2c3510169124
Ref: library/operator translation-repo10169124
Ref: 2c3610169124
Ref: library/operator operator lt10170091
Ref: 2c3710170091
Ref: library/operator operator le10170125
Ref: 2c3810170125
Ref: library/operator operator eq10170159
Ref: 2c3910170159
Ref: library/operator operator ne10170193
Ref: 2c3a10170193
Ref: library/operator operator ge10170227
Ref: 2c3b10170227
Ref: library/operator operator gt10170261
Ref: 2c3c10170261
Ref: library/operator operator __lt__10170295
Ref: 2c3d10170295
Ref: library/operator operator __le__10170333
Ref: 2c3e10170333
Ref: library/operator operator __eq__10170371
Ref: 2c3f10170371
Ref: library/operator operator __ne__10170409
Ref: 2c4010170409
Ref: library/operator operator __ge__10170447
Ref: 2c4110170447
Ref: library/operator operator __gt__10170485
Ref: 2c4210170485
Ref: library/operator operator not_10171272
Ref: 2c4310171272
Ref: library/operator operator __not__10171307
Ref: 2c4410171307
Ref: library/operator operator truth10171718
Ref: 2c4510171718
Ref: library/operator operator is_10171969
Ref: 2c4610171969
Ref: library/operator operator is_not10172094
Ref: 2c4710172094
Ref: library/operator operator is_none10172226
Ref: 25710172226
Ref: library/operator operator is_not_none10172346
Ref: 25810172346
Ref: library/operator operator abs10172558
Ref: 2c4810172558
Ref: library/operator operator __abs__10172592
Ref: 2c4910172592
Ref: library/operator operator add10172674
Ref: 2c4a10172674
Ref: library/operator operator __add__10172709
Ref: 2c4b10172709
Ref: library/operator operator and_10172824
Ref: 2c4c10172824
Ref: library/operator operator __and__10172860
Ref: 2c4d10172860
Ref: library/operator operator floordiv10172926
Ref: 2c4e10172926
Ref: library/operator operator __floordiv__10172966
Ref: 2c4f10172966
Ref: library/operator operator index10173049
Ref: 1d2f10173049
Ref: library/operator operator __index__10173083
Ref: 2c5010173083
Ref: library/operator operator inv10173414
Ref: 2c5110173414
Ref: library/operator operator invert10173448
Ref: 2c5210173448
Ref: library/operator operator __inv__10173485
Ref: 2c5310173485
Ref: library/operator operator __invert__10173523
Ref: 2c5410173523
Ref: library/operator operator lshift10173590
Ref: 2c5510173590
Ref: library/operator operator __lshift__10173628
Ref: 2c5610173628
Ref: library/operator operator mod10173698
Ref: 2c5710173698
Ref: library/operator operator __mod__10173733
Ref: 2c5810173733
Ref: library/operator operator mul10173810
Ref: 2c2610173810
Ref: library/operator operator __mul__10173845
Ref: 2c5910173845
Ref: library/operator operator matmul10173911
Ref: 103910173911
Ref: library/operator operator __matmul__10173949
Ref: 2c5a10173949
Ref: library/operator operator neg10174057
Ref: 2c5b10174057
Ref: library/operator operator __neg__10174091
Ref: 2c5c10174091
Ref: library/operator operator or_10174181
Ref: 2c5d10174181
Ref: library/operator operator __or__10174216
Ref: 2c5e10174216
Ref: library/operator operator pos10174281
Ref: 2c5f10174281
Ref: library/operator operator __pos__10174315
Ref: 2c6010174315
Ref: library/operator operator pow10174379
Ref: 2c6110174379
Ref: library/operator operator __pow__10174414
Ref: 2c6210174414
Ref: library/operator operator rshift10174481
Ref: 2c6310174481
Ref: library/operator operator __rshift__10174519
Ref: 2c6410174519
Ref: library/operator operator sub10174589
Ref: 2c6510174589
Ref: library/operator operator __sub__10174624
Ref: 2c6610174624
Ref: library/operator operator truediv10174701
Ref: 2c6710174701
Ref: library/operator operator __truediv__10174740
Ref: 2c6810174740
Ref: library/operator operator xor10174926
Ref: 2c6910174926
Ref: library/operator operator __xor__10174961
Ref: 2c6a10174961
Ref: library/operator operator concat10175172
Ref: 2c6b10175172
Ref: library/operator operator __concat__10175210
Ref: 2c6c10175210
Ref: library/operator operator contains10175337
Ref: adb10175337
Ref: library/operator operator __contains__10175377
Ref: 2c6d10175377
Ref: library/operator operator countOf10175553
Ref: add10175553
Ref: library/operator operator delitem10175657
Ref: 2c6e10175657
Ref: library/operator operator __delitem__10175696
Ref: 2c6f10175696
Ref: library/operator operator getitem10175804
Ref: 2c7010175804
Ref: library/operator operator __getitem__10175843
Ref: 2c7110175843
Ref: library/operator operator indexOf10175948
Ref: adc10175948
Ref: library/operator operator setitem10176073
Ref: 2c7210176073
Ref: library/operator operator __setitem__10176115
Ref: 2c7310176115
Ref: library/operator operator length_hint10176234
Ref: 117310176234
Ref: library/operator operator call10176655
Ref: 1c7f10176655
Ref: library/operator operator __call__10176710
Ref: 2c7410176710
Ref: library/operator operator attrgetter10177133
Ref: 103710177133
Ref: library/operator operator itemgetter10178591
Ref: c5b10178591
Ref: library/operator operator methodcaller10180645
Ref: 103810180645
Ref: operator --- 関数形式の標準演算子-Footnote-110181638
Node: 演算子から関数への対応表10181706
Ref: library/operator mapping-operators-to-functions10181868
Ref: 2c7510181868
Ref: library/operator operator-map10181868
Ref: 2c7610181868
Node: インプレース in-place 演算子10189649
Ref: library/operator in-place-operators10189811
Ref: 2c7710189811
Ref: library/operator operator iadd10191326
Ref: 2c7910191326
Ref: library/operator operator __iadd__10191362
Ref: 2c7a10191362
Ref: library/operator operator iand10191466
Ref: 2c7b10191466
Ref: library/operator operator __iand__10191502
Ref: 2c7c10191502
Ref: library/operator operator iconcat10191606
Ref: 2c7d10191606
Ref: library/operator operator __iconcat__10191645
Ref: 2c7e10191645
Ref: library/operator operator ifloordiv10191807
Ref: 2c7f10191807
Ref: library/operator operator __ifloordiv__10191848
Ref: 2c8010191848
Ref: library/operator operator ilshift10191963
Ref: 2c8110191963
Ref: library/operator operator __ilshift__10192002
Ref: 2c8210192002
Ref: library/operator operator imod10192113
Ref: 2c8310192113
Ref: library/operator operator __imod__10192149
Ref: 2c8410192149
Ref: library/operator operator imul10192253
Ref: 2c8510192253
Ref: library/operator operator __imul__10192289
Ref: 2c8610192289
Ref: library/operator operator imatmul10192393
Ref: 103a10192393
Ref: library/operator operator __imatmul__10192432
Ref: 2c8710192432
Ref: library/operator operator ior10192570
Ref: 2c8810192570
Ref: library/operator operator __ior__10192605
Ref: 2c8910192605
Ref: library/operator operator ipow10192707
Ref: 2c8a10192707
Ref: library/operator operator __ipow__10192743
Ref: 2c8b10192743
Ref: library/operator operator irshift10192848
Ref: 2c8c10192848
Ref: library/operator operator __irshift__10192887
Ref: 2c8d10192887
Ref: library/operator operator isub10192998
Ref: 2c8e10192998
Ref: library/operator operator __isub__10193034
Ref: 2c8f10193034
Ref: library/operator operator itruediv10193138
Ref: 2c9010193138
Ref: library/operator operator __itruediv__10193178
Ref: 2c9110193178
Ref: library/operator operator ixor10193290
Ref: 2c9210193290
Ref: library/operator operator __ixor__10193326
Ref: 2c9310193326
Node: ファイルとディレクトリへのアクセス10193430
Ref: library/filesys doc10193633
Ref: 2c9410193633
Ref: library/filesys file-and-directory-access10193633
Ref: 2c9510193633
Ref: library/filesys filesys10193633
Ref: 2c9610193633
Ref: library/filesys translation-repo10193633
Ref: 2c9710193633
Node: pathlib --- オブジェクト指向のファイルシステムパス10195067
Ref: library/pathlib doc10195272
Ref: 2c9810195272
Ref: library/pathlib module-pathlib10195272
Ref: a810195272
Ref: library/pathlib pathlib-object-oriented-filesystem-paths10195272
Ref: 2c9910195272
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-110198055
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-210198120
Node: 基本的な使い方<2>10198162
Ref: library/pathlib basic-use10198310
Ref: 2c9d10198310
Node: 例外<6>10199419
Ref: library/pathlib exceptions10199588
Ref: 2c9e10199588
Ref: library/pathlib pathlib UnsupportedOperation10199619
Ref: 53310199619
Node: 純粋パス10199873
Ref: library/pathlib id110200030
Ref: 2c9f10200030
Ref: library/pathlib pure-paths10200030
Ref: 2c9a10200030
Ref: library/pathlib pathlib PurePath10200332
Ref: 6cd10200332
Ref: library/pathlib pathlib PurePosixPath10203313
Ref: 2ca010203313
Ref: library/pathlib pathlib PureWindowsPath10203646
Ref: 1ad610203646
Ref: 純粋パス-Footnote-110204482
Node: 全般的な性質10204541
Ref: library/pathlib general-properties10204626
Ref: 2ca110204626
Node: 演算子10205789
Ref: library/pathlib operators10205922
Ref: 2ca210205922
Node: 個別の構成要素へのアクセス10207887
Ref: library/pathlib accessing-individual-parts10208032
Ref: 2ca310208032
Ref: library/pathlib pathlib PurePath parts10208228
Ref: 2ca410208228
Node: メソッドとプロパティ10208688
Ref: library/pathlib methods-and-properties10208815
Ref: 2ca510208815
Ref: library/pathlib pathlib PurePath parser10208961
Ref: 53610208961
Ref: library/pathlib pathlib PurePath drive10209183
Ref: 2ca610209183
Ref: library/pathlib pathlib PurePath root10209648
Ref: 2ca710209648
Ref: library/pathlib pathlib PurePath anchor10210836
Ref: 2ca810210836
Ref: library/pathlib pathlib PurePath parents10211227
Ref: a2510211227
Ref: library/pathlib pathlib PurePath parent10211807
Ref: 1afe10211807
Ref: library/pathlib pathlib PurePath name10212780
Ref: 2ca910212780
Ref: library/pathlib pathlib PurePath suffix10213219
Ref: 19b710213219
Ref: library/pathlib pathlib PurePath suffixes10213729
Ref: 19b810213729
Ref: library/pathlib pathlib PurePath stem10214172
Ref: 2caa10214172
Ref: library/pathlib pathlib PurePath as_posix10214594
Ref: 2cab10214594
Ref: library/pathlib pathlib PurePath is_absolute10214882
Ref: 1afd10214882
Ref: library/pathlib pathlib PurePath is_relative_to10215545
Ref: 30010215545
Ref: library/pathlib pathlib PurePath is_reserved10216334
Ref: 32810216334
Ref: library/pathlib pathlib PurePath joinpath10216946
Ref: 2cac10216946
Ref: library/pathlib pathlib PurePath full_match10217565
Ref: 53510217565
Ref: library/pathlib pathlib PurePath match10218553
Ref: 6d310218553
Ref: library/pathlib pathlib PurePath relative_to10219538
Ref: 2ff10219538
Ref: library/pathlib pathlib PurePath with_name10221935
Ref: 1ac910221935
Ref: library/pathlib pathlib PurePath with_stem10222712
Ref: 1a3b10222712
Ref: library/pathlib pathlib PurePath with_suffix10223793
Ref: 19b610223793
Ref: library/pathlib pathlib PurePath with_segments10224693
Ref: 6ce10224693
Ref: メソッドとプロパティ-Footnote-110225635
Node: 具象パス10225727
Ref: library/pathlib concrete-paths10225891
Ref: 2c9b10225891
Ref: library/pathlib id210225891
Ref: 2cae10225891
Ref: library/pathlib pathlib Path10226228
Ref: 26810226228
Ref: library/pathlib pathlib PosixPath10226675
Ref: 2caf10226675
Ref: library/pathlib pathlib WindowsPath10227253
Ref: 2c9c10227253
Node: URIのパースと生成10229087
Ref: library/pathlib parsing-and-generating-uris10229193
Ref: 2cb010229193
Ref: library/pathlib pathlib Path from_uri10229469
Ref: 53410229469
Ref: library/pathlib pathlib Path as_uri10230808
Ref: 31e10230808
Ref: URIのパースと生成-Footnote-110231488
Node: パスの展開と解決10231547
Ref: library/pathlib expanding-and-resolving-paths10231722
Ref: 2cb210231722
Ref: library/pathlib pathlib Path home10231785
Ref: 104710231785
Ref: library/pathlib pathlib Path expanduser10232218
Ref: 104610232218
Ref: library/pathlib pathlib Path cwd10232706
Ref: 1afc10232706
Ref: library/pathlib pathlib Path absolute10232955
Ref: 1a8810232955
Ref: library/pathlib pathlib Path resolve10233308
Ref: 1ace10233308
Ref: library/pathlib pathlib Path readlink10234567
Ref: b1d10234567
Node: ファイルの種類とステータスを問い合わせる10235125
Ref: library/pathlib querying-file-type-and-status10235312
Ref: 2cb310235312
Ref: library/pathlib pathlib Path stat10236257
Ref: a2810236257
Ref: library/pathlib pathlib Path lstat10237059
Ref: 2cb410237059
Ref: library/pathlib pathlib Path exists10237318
Ref: c0f10237318
Ref: library/pathlib pathlib Path is_file10238167
Ref: 53910238167
Ref: library/pathlib pathlib Path is_dir10238811
Ref: 53a10238811
Ref: library/pathlib pathlib Path is_symlink10239478
Ref: c1110239478
Ref: library/pathlib pathlib Path is_junction10239832
Ref: 6d210239832
Ref: library/pathlib pathlib Path is_mount10240131
Ref: c1010240131
Ref: library/pathlib pathlib Path is_socket10241138
Ref: c1510241138
Ref: library/pathlib pathlib Path is_fifo10241450
Ref: c1410241450
Ref: library/pathlib pathlib Path is_block_device10241744
Ref: c1210241744
Ref: library/pathlib pathlib Path is_char_device10242064
Ref: c1310242064
Ref: library/pathlib pathlib Path samefile10242391
Ref: 104410242391
Ref: library/pathlib pathlib Path info10243093
Ref: 26d10243093
Node: ファイルを読み書きする<2>10244338
Ref: library/pathlib reading-and-writing-files10244528
Ref: 2cb510244528
Ref: library/pathlib pathlib Path open10244606
Ref: 2cb610244606
Ref: library/pathlib pathlib Path read_text10244979
Ref: 104910244979
Ref: library/pathlib pathlib Path read_bytes10245575
Ref: 2e110245575
Ref: library/pathlib pathlib Path write_text10245904
Ref: 104810245904
Ref: library/pathlib pathlib Path write_bytes10246581
Ref: 104a10246581
Node: ディレクトリを読む10247028
Ref: library/pathlib reading-directories10247200
Ref: 2cb710247200
Ref: library/pathlib pathlib Path iterdir10247268
Ref: 27010247268
Ref: library/pathlib pathlib Path glob10248280
Ref: 53710248280
Ref: library/pathlib pathlib Path rglob10250972
Ref: 53810250972
Ref: library/pathlib pathlib Path walk10252210
Ref: 6cf10252210
Node: ファイルとディレクトリの作成10257219
Ref: library/pathlib creating-files-and-directories10257382
Ref: 2cb910257382
Ref: library/pathlib pathlib Path touch10257475
Ref: 2cba10257475
Ref: library/pathlib pathlib Path mkdir10258206
Ref: 104510258206
Ref: library/pathlib pathlib Path symlink_to10259546
Ref: a2710259546
Ref: library/pathlib pathlib Path hardlink_to10260974
Ref: a2610260974
Node: Copying moving and deleting10261494
Ref: library/pathlib copying-moving-and-deleting10261663
Ref: 2cbb10261663
Ref: library/pathlib pathlib Path copy10261742
Ref: 26910261742
Ref: library/pathlib pathlib Path copy_into10262901
Ref: 26a10262901
Ref: library/pathlib pathlib Path rename10263284
Ref: 18f410263284
Ref: library/pathlib pathlib Path replace10264531
Ref: 2cbc10264531
Ref: library/pathlib pathlib Path move10265257
Ref: 26b10265257
Ref: library/pathlib pathlib Path move_into10265940
Ref: 26c10265940
Ref: library/pathlib pathlib Path unlink10266196
Ref: 1e3110266196
Ref: library/pathlib pathlib Path rmdir10266860
Ref: 2cb810266860
Node: パーミッションと所有者10267011
Ref: library/pathlib permissions-and-ownership10267129
Ref: 2cbd10267129
Ref: library/pathlib pathlib Path owner10267207
Ref: 53b10267207
Ref: library/pathlib pathlib Path group10268066
Ref: 53c10268066
Ref: library/pathlib pathlib Path chmod10268928
Ref: a2910268928
Ref: library/pathlib pathlib Path lchmod10269736
Ref: 2cbe10269736
Node: Pattern language10270010
Ref: library/pathlib pathlib-pattern-language10270194
Ref: 2cad10270194
Ref: library/pathlib pattern-language10270194
Ref: 2cbf10270194
Node: glob モジュールとの比較10272749
Ref: library/pathlib comparison-to-the-glob-module10272960
Ref: 2cc010272960
Node: os と os path モジュールの比較10274389
Ref: library/pathlib comparison-to-the-os-and-os-path-modules10274599
Ref: 2cc110274599
Node: 対応するツール10276759
Ref: library/pathlib corresponding-tools10276856
Ref: 2cc210276856
Ref: 対応するツール-Footnote-110282172
Ref: 対応するツール-Footnote-210282480
Ref: 対応するツール-Footnote-310282660
Ref: 対応するツール-Footnote-410282882
Node: プロトコル10283114
Ref: library/pathlib module-pathlib types10283283
Ref: a910283283
Ref: library/pathlib protocols10283283
Ref: 2cc510283283
Ref: library/pathlib pathlib types PathInfo10283428
Ref: 26e10283428
Ref: library/pathlib pathlib types PathInfo exists10283624
Ref: 2cc610283624
Ref: library/pathlib pathlib types PathInfo is_dir10283979
Ref: 2cc710283979
Ref: library/pathlib pathlib types PathInfo is_file10284494
Ref: 2cc810284494
Ref: library/pathlib pathlib types PathInfo is_symlink10285009
Ref: 2cc910285009
Node: os path --- 一般的なパス名操作10285236
Ref: library/os path doc10285488
Ref: 2cca10285488
Ref: library/os path module-os path10285488
Ref: a610285488
Ref: library/os path os-path-common-pathname-manipulations10285488
Ref: 2ccb10285488
Ref: library/os path translation-repo10285488
Ref: 2ccc10285488
Ref: library/os path os path abspath10287929
Ref: 153610287929
Ref: library/os path os path basename10288350
Ref: 2cc410288350
Ref: library/os path os path commonpath10288964
Ref: 104110288964
Ref: library/os path os path commonprefix10289588
Ref: 104210289588
Ref: library/os path os path dirname10290425
Ref: 2cc310290425
Ref: library/os path os path exists10290770
Ref: c0710290770
Ref: library/os path os path lexists10291657
Ref: c0810291657
Ref: library/os path os path expanduser10291999
Ref: c0d10291999
Ref: library/os path os path expandvars10293417
Ref: 15f710293417
Ref: library/os path os path getatime10294054
Ref: 2cce10294054
Ref: library/os path os path getmtime10294358
Ref: 2ccf10294358
Ref: library/os path os path getctime10294786
Ref: 2cd010294786
Ref: library/os path os path getsize10295426
Ref: 2cd110295426
Ref: library/os path os path isabs10295777
Ref: 53110295777
Ref: library/os path os path isfile10296333
Ref: c0a10296333
Ref: library/os path os path isdir10296788
Ref: c0910296788
Ref: library/os path os path isjunction10297244
Ref: 6ca10297244
Ref: library/os path os path islink10297512
Ref: c0510297512
Ref: library/os path os path ismount10297966
Ref: c0b10297966
Ref: library/os path os path isdevdrive10299035
Ref: 1a1f10299035
Ref: library/os path os path isreserved10299879
Ref: 32910299879
Ref: library/os path os path join10300737
Ref: 1a0710300737
Ref: library/os path os path normcase10302238
Ref: 2cd210302238
Ref: library/os path os path normpath10302694
Ref: 153510302694
Ref: library/os path os path realpath10303785
Ref: 26410303785
Ref: library/os path os path ALLOW_MISSING10306151
Ref: 26510306151
Ref: library/os path os path relpath10306300
Ref: 6d110306300
Ref: library/os path os path samefile10306977
Ref: 117710306977
Ref: library/os path os path sameopenfile10307713
Ref: 2cd410307713
Ref: library/os path os path samestat10308086
Ref: 117610308086
Ref: library/os path os path split10308629
Ref: 2ccd10308629
Ref: library/os path os path splitdrive10309491
Ref: df310309491
Ref: library/os path os path splitroot10310485
Ref: 6cb10310485
Ref: library/os path os path splitext10311756
Ref: 19b910311756
Ref: library/os path os path supports_unicode_filenames10312771
Ref: 16ac10312771
Ref: os path --- 一般的なパス名操作-Footnote-110313004
Ref: os path --- 一般的なパス名操作-Footnote-210313075
Ref: os path --- 一般的なパス名操作-Footnote-310313144
Ref: os path --- 一般的なパス名操作-Footnote-410313210
Ref: os path --- 一般的なパス名操作-Footnote-510313265
Ref: os path --- 一般的なパス名操作-Footnote-610313357
Node: stat --- stat の結果を解釈する10313449
Ref: library/stat doc10313686
Ref: 2cd510313686
Ref: library/stat module-stat10313686
Ref: d610313686
Ref: library/stat stat-interpreting-stat-results10313686
Ref: 2cd610313686
Ref: library/stat translation-repo10313686
Ref: 2cd710313686
Ref: library/stat stat S_ISDIR10314403
Ref: 2cd810314403
Ref: library/stat stat S_ISCHR10314539
Ref: 2cd910314539
Ref: library/stat stat S_ISBLK10314714
Ref: 2cda10314714
Ref: library/stat stat S_ISREG10314886
Ref: 2cdb10314886
Ref: library/stat stat S_ISFIFO10315022
Ref: 2cdc10315022
Ref: library/stat stat S_ISLNK10315177
Ref: 2cdd10315177
Ref: library/stat stat S_ISSOCK10315328
Ref: 2cde10315328
Ref: library/stat stat S_ISDOOR10315459
Ref: 1e0810315459
Ref: library/stat stat S_ISPORT10315612
Ref: 1e0910315612
Ref: library/stat stat S_ISWHT10315780
Ref: 1e0a10315780
Ref: library/stat stat S_IMODE10316059
Ref: 2cdf10316059
Ref: library/stat stat S_IFMT10316506
Ref: 2ce010316506
Ref: library/stat stat filemode10318111
Ref: 136710318111
Ref: library/stat stat ST_MODE10318659
Ref: 11c010318659
Ref: library/stat stat ST_INO10318726
Ref: 2ce110318726
Ref: library/stat stat ST_DEV10318780
Ref: 2ce210318780
Ref: library/stat stat ST_NLINK10318855
Ref: 2ce310318855
Ref: library/stat stat ST_UID10318936
Ref: 2ce410318936
Ref: library/stat stat ST_GID10319013
Ref: 2ce510319013
Ref: library/stat stat ST_SIZE10319093
Ref: 2ce610319093
Ref: library/stat stat ST_ATIME10319248
Ref: 2ce710319248
Ref: library/stat stat ST_MTIME10319321
Ref: 2ce810319321
Ref: library/stat stat ST_CTIME10319391
Ref: 2ce910319391
Ref: library/stat stat S_IFSOCK10320844
Ref: 2cea10320844
Ref: library/stat stat S_IFLNK10320896
Ref: 2ceb10320896
Ref: library/stat stat S_IFREG10320962
Ref: 2cec10320962
Ref: library/stat stat S_IFBLK10321022
Ref: 2ced10321022
Ref: library/stat stat S_IFDIR10321085
Ref: 2cee10321085
Ref: library/stat stat S_IFCHR10321142
Ref: 2cef10321142
Ref: library/stat stat S_IFIFO10321211
Ref: 2cf010321211
Ref: library/stat stat S_IFDOOR10321254
Ref: 11c110321254
Ref: library/stat stat S_IFPORT10321328
Ref: 11c210321328
Ref: library/stat stat S_IFWHT10321417
Ref: 11c310321417
Ref: library/stat stat S_ISUID10321849
Ref: 2cf110321849
Ref: library/stat stat S_ISGID10321916
Ref: 2cf210321916
Ref: library/stat stat S_ISVTX10322798
Ref: 2cf510322798
Ref: library/stat stat S_IRWXU10323209
Ref: 2cf610323209
Ref: library/stat stat S_IRUSR10323302
Ref: 2cf710323302
Ref: library/stat stat S_IWUSR10323389
Ref: 2cf810323389
Ref: library/stat stat S_IXUSR10323476
Ref: 2cf910323476
Ref: library/stat stat S_IRWXG10323560
Ref: 2cfa10323560
Ref: library/stat stat S_IRGRP10323641
Ref: 2cfb10323641
Ref: library/stat stat S_IWGRP10323728
Ref: 2cfc10323728
Ref: library/stat stat S_IXGRP10323815
Ref: 2cf310323815
Ref: library/stat stat S_IRWXO10323899
Ref: 2cfd10323899
Ref: library/stat stat S_IROTH10323996
Ref: 2cfe10323996
Ref: library/stat stat S_IWOTH10324080
Ref: 2cff10324080
Ref: library/stat stat S_IXOTH10324164
Ref: 2d0010324164
Ref: library/stat stat S_ENFMT10324245
Ref: 2cf410324245
Ref: library/stat stat S_IREAD10324562
Ref: 2d0110324562
Ref: library/stat stat S_IWRITE10324652
Ref: 2d0210324652
Ref: library/stat stat S_IEXEC10324743
Ref: 2d0310324743
Ref: library/stat stat UF_SETTABLE10324930
Ref: 2d0410324930
Ref: library/stat stat UF_NODUMP10325023
Ref: 2d0510325023
Ref: library/stat stat UF_IMMUTABLE10325097
Ref: 2d0610325097
Ref: library/stat stat UF_APPEND10325174
Ref: 2d0710325174
Ref: library/stat stat UF_OPAQUE10325254
Ref: 2d0810325254
Ref: library/stat stat UF_NOUNLINK10325415
Ref: 2d0910325415
Ref: library/stat stat UF_COMPRESSED10325506
Ref: 2d0a10325506
Ref: library/stat stat UF_TRACKED10325607
Ref: 2d0b10325607
Ref: library/stat stat UF_DATAVAULT10325713
Ref: 2d0c10325713
Ref: library/stat stat UF_HIDDEN10325850
Ref: 2d0d10325850
Ref: library/stat stat SF_SETTABLE10325958
Ref: 2d0e10325958
Ref: library/stat stat SF_SUPPORTED10326058
Ref: 2d0f10326058
Ref: library/stat stat SF_SYNTHETIC10326197
Ref: 2d1010326197
Ref: library/stat stat SF_ARCHIVED10326346
Ref: 2d1110326346
Ref: library/stat stat SF_IMMUTABLE10326455
Ref: 2d1210326455
Ref: library/stat stat SF_APPEND10326532
Ref: 2d1310326532
Ref: library/stat stat SF_RESTRICTED10326612
Ref: 2d1410326612
Ref: library/stat stat SF_NOUNLINK10326739
Ref: 2d1510326739
Ref: library/stat stat SF_SNAPSHOT10326830
Ref: 2d1610326830
Ref: library/stat stat SF_FIRMLINK10326936
Ref: 2d1710326936
Ref: library/stat stat SF_DATALESS10327042
Ref: 2d1810327042
Ref: library/stat stat FILE_ATTRIBUTE_ARCHIVE10327567
Ref: 2d1910327567
Ref: library/stat stat FILE_ATTRIBUTE_COMPRESSED10327610
Ref: 2d1a10327610
Ref: library/stat stat FILE_ATTRIBUTE_DEVICE10327656
Ref: 2d1b10327656
Ref: library/stat stat FILE_ATTRIBUTE_DIRECTORY10327698
Ref: 2d1c10327698
Ref: library/stat stat FILE_ATTRIBUTE_ENCRYPTED10327743
Ref: 2d1d10327743
Ref: library/stat stat FILE_ATTRIBUTE_HIDDEN10327788
Ref: 2d1e10327788
Ref: library/stat stat FILE_ATTRIBUTE_INTEGRITY_STREAM10327830
Ref: 2d1f10327830
Ref: library/stat stat FILE_ATTRIBUTE_NORMAL10327882
Ref: 2d2010327882
Ref: library/stat stat FILE_ATTRIBUTE_NOT_CONTENT_INDEXED10327924
Ref: 2d2110327924
Ref: library/stat stat FILE_ATTRIBUTE_NO_SCRUB_DATA10327979
Ref: 2d2210327979
Ref: library/stat stat FILE_ATTRIBUTE_OFFLINE10328028
Ref: 2d2310328028
Ref: library/stat stat FILE_ATTRIBUTE_READONLY10328071
Ref: 2d2410328071
Ref: library/stat stat FILE_ATTRIBUTE_REPARSE_POINT10328115
Ref: 2d2510328115
Ref: library/stat stat FILE_ATTRIBUTE_SPARSE_FILE10328164
Ref: 2d2610328164
Ref: library/stat stat FILE_ATTRIBUTE_SYSTEM10328211
Ref: 2d2710328211
Ref: library/stat stat FILE_ATTRIBUTE_TEMPORARY10328253
Ref: 2d2810328253
Ref: library/stat stat FILE_ATTRIBUTE_VIRTUAL10328298
Ref: 2d2910328298
Ref: library/stat stat IO_REPARSE_TAG_SYMLINK10328612
Ref: 2d2a10328612
Ref: library/stat stat IO_REPARSE_TAG_MOUNT_POINT10328655
Ref: 2d2b10328655
Ref: library/stat stat IO_REPARSE_TAG_APPEXECLINK10328702
Ref: 2d2c10328702
Ref: stat --- stat の結果を解釈する-Footnote-110328814
Ref: stat --- stat の結果を解釈する-Footnote-210328878
Ref: stat --- stat の結果を解釈する-Footnote-310328925
Node: filecmp --- ファイルとディレクトリの比較10329005
Ref: library/filecmp doc10329264
Ref: 2d2d10329264
Ref: library/filecmp filecmp-file-and-directory-comparisons10329264
Ref: 2d2e10329264
Ref: library/filecmp module-filecmp10329264
Ref: 5e10329264
Ref: library/filecmp translation-repo10329264
Ref: 2d2f10329264
Ref: library/filecmp filecmp cmp10329740
Ref: 1a3c10329740
Ref: library/filecmp filecmp cmpfiles10330723
Ref: 19a510330723
Ref: library/filecmp filecmp clear_cache10331949
Ref: 114410331949
Ref: filecmp --- ファイルとディレクトリの比較-Footnote-110332287
Node: dircmp クラス10332354
Ref: library/filecmp dircmp-objects10332461
Ref: 2d3010332461
Ref: library/filecmp the-dircmp-class10332461
Ref: 2d3110332461
Ref: library/filecmp filecmp dircmp10332519
Ref: 114610332519
Ref: library/filecmp filecmp dircmp report10333214
Ref: 2d3210333214
Ref: library/filecmp filecmp dircmp report_partial_closure10333332
Ref: 2d3310333332
Ref: library/filecmp filecmp dircmp report_full_closure10333534
Ref: 2d3410333534
Ref: library/filecmp filecmp dircmp left10334185
Ref: 2d3510334185
Ref: library/filecmp filecmp dircmp right10334255
Ref: 2d3610334255
Ref: library/filecmp filecmp dircmp left_list10334326
Ref: 2d3710334326
Ref: library/filecmp filecmp dircmp right_list10334508
Ref: 2d3810334508
Ref: library/filecmp filecmp dircmp common10334691
Ref: 2d3910334691
Ref: library/filecmp filecmp dircmp left_only10334832
Ref: 2d3a10334832
Ref: library/filecmp filecmp dircmp right_only10334948
Ref: 2d3b10334948
Ref: library/filecmp filecmp dircmp common_dirs10335065
Ref: 2d3c10335065
Ref: library/filecmp filecmp dircmp common_files10335179
Ref: 2d3d10335179
Ref: library/filecmp filecmp dircmp common_funny10335282
Ref: 2d3e10335282
Ref: library/filecmp filecmp dircmp same_files10335503
Ref: 2d3f10335503
Ref: library/filecmp filecmp dircmp diff_files10335679
Ref: 2d4010335679
Ref: library/filecmp filecmp dircmp funny_files10335869
Ref: 2d4110335869
Ref: library/filecmp filecmp dircmp subdirs10335998
Ref: 1d4310335998
Ref: library/filecmp filecmp DEFAULT_IGNORES10336430
Ref: 114510336430
Node: tempfile --- 一時ファイルやディレクトリの作成10337193
Ref: library/tempfile doc10337467
Ref: 2d4210337467
Ref: library/tempfile module-tempfile10337467
Ref: e610337467
Ref: library/tempfile tempfile-generate-temporary-files-and-directories10337467
Ref: 2d4310337467
Ref: library/tempfile translation-repo10337467
Ref: 2d4410337467
Ref: library/tempfile tempfile TemporaryFile10339012
Ref: 2d4510339012
Ref: library/tempfile tempfile NamedTemporaryFile10341868
Ref: 6ed10341868
Ref: library/tempfile tempfile SpooledTemporaryFile10345741
Ref: 8a310345741
Ref: library/tempfile tempfile SpooledTemporaryFile rollover10346357
Ref: 2d4810346357
Ref: library/tempfile tempfile TemporaryDirectory10347699
Ref: 145010347699
Ref: library/tempfile tempfile TemporaryDirectory name10348367
Ref: 2d4910348367
Ref: library/tempfile tempfile TemporaryDirectory cleanup10348772
Ref: 2d4a10348772
Ref: library/tempfile tempfile mkstemp10350119
Ref: 2d4610350119
Ref: library/tempfile tempfile mkdtemp10353927
Ref: 52d10353927
Ref: library/tempfile tempfile gettempdir10355494
Ref: 1cee10355494
Ref: library/tempfile tempfile gettempdirb10356919
Ref: 1cef10356919
Ref: library/tempfile tempfile gettempprefix10357065
Ref: 2d4c10357065
Ref: library/tempfile tempfile gettempprefixb10357274
Ref: 2d4d10357274
Ref: library/tempfile tempfile tempdir10357854
Ref: 1ced10357854
Ref: tempfile --- 一時ファイルやディレクトリの作成-Footnote-110359032
Node: 使用例<8>10359100
Ref: library/tempfile examples10359246
Ref: 2d4e10359246
Ref: library/tempfile tempfile-examples10359246
Ref: 2d4710359246
Node: 非推奨の関数と変数10360635
Ref: library/tempfile deprecated-functions-and-variables10360781
Ref: 2d4f10360781
Ref: library/tempfile tempfile-mktemp-deprecated10360781
Ref: 2d5010360781
Ref: library/tempfile tempfile mktemp10361562
Ref: 1c8d10361562
Node: glob --- Unix 形式のパス名のパターン展開10362976
Ref: library/glob doc10363252
Ref: 2d5110363252
Ref: library/glob glob-unix-style-pathname-pattern-expansion10363252
Ref: 2d5210363252
Ref: library/glob module-glob10363252
Ref: 6810363252
Ref: library/glob translation-repo10363252
Ref: 2d5310363252
Ref: library/glob glob glob10364465
Ref: 5a010364465
Ref: library/glob glob iglob10367696
Ref: a0c10367696
Ref: library/glob glob escape10369050
Ref: 114b10369050
Ref: library/glob glob translate10369561
Ref: 4fb10369561
Ref: glob --- Unix 形式のパス名のパターン展開-Footnote-110371490
Node: 使用例<9>10371554
Ref: library/glob examples10371656
Ref: 2d5410371656
Node: fnmatch --- Unix のファイル名パターンマッチ10372975
Ref: library/fnmatch doc10373255
Ref: 2d5510373255
Ref: library/fnmatch fnmatch-unix-filename-pattern-matching10373255
Ref: 2d5610373255
Ref: library/fnmatch module-fnmatch10373255
Ref: 6010373255
Ref: library/fnmatch translation-repo10373255
Ref: 2d5710373255
Ref: library/fnmatch fnmatch fnmatch10375533
Ref: 1cb110375533
Ref: library/fnmatch fnmatch fnmatchcase10376423
Ref: 1cb210376423
Ref: library/fnmatch fnmatch filter10376749
Ref: 1cb310376749
Ref: library/fnmatch fnmatch filterfalse10377042
Ref: 21310377042
Ref: library/fnmatch fnmatch translate10377381
Ref: 18b410377381
Ref: fnmatch --- Unix のファイル名パターンマッチ-Footnote-110378022
Node: linecache --- テキストラインへのランダムアクセス10378089
Ref: library/linecache doc10378357
Ref: 2d5810378357
Ref: library/linecache linecache-random-access-to-text-lines10378357
Ref: 2d5910378357
Ref: library/linecache module-linecache10378357
Ref: 8910378357
Ref: library/linecache translation-repo10378357
Ref: 2d5a10378357
Ref: library/linecache linecache getline10379319
Ref: 24210379319
Ref: library/linecache linecache clearcache10380578
Ref: 2d5c10380578
Ref: library/linecache linecache checkcache10380831
Ref: 194d10380831
Ref: library/linecache linecache lazycache10381236
Ref: 102810381236
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-110381923
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-210381992
Node: shutil --- 高水準のファイル操作10382034
Ref: library/shutil doc10382237
Ref: 2d5d10382237
Ref: library/shutil module-shutil10382237
Ref: ca10382237
Ref: library/shutil shutil-high-level-file-operations10382237
Ref: 2d5e10382237
Ref: library/shutil translation-repo10382237
Ref: 2d5f10382237
Ref: shutil --- 高水準のファイル操作-Footnote-110383629
Node: ディレクトリとファイルの操作10383695
Ref: library/shutil directory-and-files-operations10383848
Ref: 2d6010383848
Ref: library/shutil file-operations10383848
Ref: 2d6110383848
Ref: library/shutil shutil copyfileobj10383939
Ref: c5610383939
Ref: library/shutil shutil copyfile10385164
Ref: c5210385164
Ref: library/shutil shutil SpecialFileError10387385
Ref: 153710387385
Ref: library/shutil shutil SameFileError10387570
Ref: 11a410387570
Ref: library/shutil shutil copymode10387740
Ref: 1a8610387740
Ref: library/shutil shutil copystat10388920
Ref: 134a10388920
Ref: library/shutil shutil copy10391556
Ref: c5310391556
Ref: library/shutil shutil copy210393673
Ref: c5410393673
Ref: library/shutil shutil ignore_patterns10395818
Ref: 2d6310395818
Ref: library/shutil shutil copytree10396190
Ref: c2210396190
Ref: library/shutil shutil rmtree10400554
Ref: 35410400554
Ref: library/shutil shutil rmtree avoids_symlink_attacks10403980
Ref: 2d6410403980
Ref: library/shutil shutil move10404456
Ref: c5510404456
Ref: library/shutil shutil disk_usage10407152
Ref: 134910407152
Ref: library/shutil shutil chown10408065
Ref: 54810408065
Ref: library/shutil shutil which10408861
Ref: 6db10408861
Ref: library/shutil shutil Error10411594
Ref: 11a310411594
Node: プラットフォーム依存の効率的なコピー操作10411941
Ref: library/shutil platform-dependent-efficient-copy-operations10412104
Ref: 2d6610412104
Ref: library/shutil shutil-platform-dependent-efficient-copy-operations10412104
Ref: c5710412104
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-110413845
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-210413910
Node: copytree の例10413958
Ref: library/shutil copytree-example10414143
Ref: 2d6710414143
Ref: library/shutil shutil-copytree-example10414143
Ref: 2d6810414143
Node: rmtree の例10414845
Ref: library/shutil rmtree-example10414961
Ref: 2d6910414961
Ref: library/shutil shutil-rmtree-example10414961
Ref: 2d6510414961
Node: アーカイブ化操作10415636
Ref: library/shutil archiving-operations10415840
Ref: 143510415840
Ref: library/shutil id110415840
Ref: 2d6a10415840
Ref: library/shutil shutil make_archive10416250
Ref: 6da10416250
Ref: library/shutil shutil get_archive_formats10419036
Ref: 2d6d10419036
Ref: library/shutil shutil register_archive_format10420322
Ref: 2d6c10420322
Ref: library/shutil shutil unregister_archive_format10421772
Ref: 2d6e10421772
Ref: library/shutil shutil unpack_archive10421972
Ref: 69610421972
Ref: library/shutil shutil register_unpack_format10424293
Ref: 2d6f10424293
Ref: library/shutil shutil unregister_unpack_format10425336
Ref: 2d7210425336
Ref: library/shutil shutil get_unpack_formats10425511
Ref: 2d7110425511
Ref: アーカイブ化操作-Footnote-110426925
Node: アーカイブ化の例10426967
Ref: library/shutil archiving-example10427106
Ref: 2d7310427106
Ref: library/shutil shutil-archiving-example10427106
Ref: 2d7410427106
Node: base_dir を使ったアーカイブ化の例10428281
Ref: library/shutil archiving-example-with-base-dir10428420
Ref: 2d7510428420
Ref: library/shutil shutil-archiving-example-with-basedir10428420
Ref: 2d6b10428420
Node: 出力ターミナルのサイズの取得10429700
Ref: library/shutil querying-the-size-of-the-output-terminal10429853
Ref: 2d7610429853
Ref: library/shutil shutil get_terminal_size10429944
Ref: 131f10429944
Ref: 出力ターミナルのサイズの取得-Footnote-110431937
Node: データの永続化10432020
Ref: library/persistence doc10432208
Ref: 2d7910432208
Ref: library/persistence data-persistence10432208
Ref: 2d7a10432208
Ref: library/persistence persistence10432208
Ref: 2d7b10432208
Ref: library/persistence translation-repo10432208
Ref: 2d7c10432208
Node: pickle --- Python オブジェクトの直列化10433541
Ref: library/pickle doc10433708
Ref: 2d7d10433708
Ref: library/pickle module-pickle10433708
Ref: ab10433708
Ref: library/pickle pickle-python-object-serialization10433708
Ref: 2d7e10433708
Ref: pickle --- Python オブジェクトの直列化-Footnote-110435921
Ref: pickle --- Python オブジェクトの直列化-Footnote-210435987
Node: 他の Python モジュールとの関係10436084
Ref: library/pickle relationship-to-other-python-modules10436252
Ref: 2d8010436252
Node: marshal との比較10436401
Ref: library/pickle comparison-with-marshal10436525
Ref: 2d8110436525
Node: json との比較10437853
Ref: library/pickle comparison-with-json10437977
Ref: 2d7f10437977
Ref: library/pickle id210437977
Ref: 2d8210437977
Ref: json との比較-Footnote-110439395
Node: データストリームの形式10439420
Ref: library/pickle data-stream-format10439636
Ref: 2d8410439636
Ref: library/pickle pickle-protocols10439636
Ref: 27d10439636
Ref: データストリームの形式-Footnote-110443373
Ref: データストリームの形式-Footnote-210443415
Ref: データストリームの形式-Footnote-310443457
Node: モジュールインターフェース10443499
Ref: library/pickle module-interface10443716
Ref: 2d8710443716
Ref: library/pickle pickle HIGHEST_PROTOCOL10444301
Ref: 16c310444301
Ref: library/pickle pickle DEFAULT_PROTOCOL10444630
Ref: a3310444630
Ref: library/pickle pickle dump10445429
Ref: 2d8810445429
Ref: library/pickle pickle dumps10446017
Ref: 16c210446017
Ref: library/pickle pickle load10446517
Ref: f1010446517
Ref: library/pickle pickle loads10447447
Ref: f1110447447
Ref: library/pickle pickle PickleError10448349
Ref: 2d8910448349
Ref: library/pickle pickle PicklingError10448493
Ref: 19a210448493
Ref: library/pickle pickle UnpicklingError10448889
Ref: 2d8b10448889
Ref: library/pickle pickle Pickler10449530
Ref: c1710449530
Ref: library/pickle pickle Pickler dump10451830
Ref: 1e8110451830
Ref: library/pickle pickle Pickler persistent_id10452052
Ref: 196c10452052
Ref: library/pickle pickle Pickler dispatch_table10453134
Ref: 133e10453134
Ref: library/pickle pickle Pickler reducer_override10454602
Ref: c1810454602
Ref: library/pickle pickle Pickler fast10455525
Ref: 2d9110455525
Ref: library/pickle pickle Pickler clear_memo10456192
Ref: 2d9310456192
Ref: library/pickle pickle Unpickler10456527
Ref: 17e910456527
Ref: library/pickle pickle Unpickler load10459444
Ref: 2d9410459444
Ref: library/pickle pickle Unpickler persistent_load10459843
Ref: 197410459843
Ref: library/pickle pickle Unpickler find_class10460575
Ref: 2d9510460575
Ref: library/pickle pickle PickleBuffer10461579
Ref: 17b610461579
Ref: library/pickle pickle PickleBuffer raw10462487
Ref: 2d9710462487
Ref: library/pickle pickle PickleBuffer release10462927
Ref: 2d9810462927
Ref: モジュールインターフェース-Footnote-110463127
Node: pickle 化、非 pickle 化できるもの10463169
Ref: library/pickle pickle-picklable10463394
Ref: 2d8a10463394
Ref: library/pickle what-can-be-pickled-and-unpickled10463394
Ref: 2d9910463394
Ref: pickle 化、非 pickle 化できるもの-Footnote-110467045
Ref: pickle 化、非 pickle 化できるもの-Footnote-210467232
Node: クラスインスタンスの pickle 化10467384
Ref: library/pickle pickle-inst10467666
Ref: 2d8310467666
Ref: library/pickle pickling-class-instances10467666
Ref: 2d9a10467666
Ref: library/pickle object __getnewargs_ex__10468988
Ref: 2d9b10468988
Ref: library/pickle object __getnewargs__10469915
Ref: fd810469915
Ref: library/pickle object __getstate__10470653
Ref: 7f110470653
Ref: library/pickle object __setstate__10472003
Ref: bcb10472003
Ref: library/pickle object __reduce__10474594
Ref: bca10474594
Ref: library/pickle object __reduce_ex__10478629
Ref: 19cb10478629
Ref: クラスインスタンスの pickle 化-Footnote-110479496
Node: 外部オブジェクトの永続化10479630
Ref: library/pickle persistence-of-external-objects10479783
Ref: 2d9d10479783
Ref: library/pickle pickle-persistent10479783
Ref: 2d8d10479783
Ref: 外部オブジェクトの永続化-Footnote-110484552
Node: ディスパッチテーブル10484880
Ref: library/pickle dispatch-tables10485084
Ref: 2d9e10485084
Ref: library/pickle pickle-dispatch10485084
Ref: 2d8f10485084
Node: 状態を持つオブジェクトの扱い10486657
Ref: library/pickle handling-stateful-objects10486816
Ref: 2d9f10486816
Ref: library/pickle pickle-state10486816
Ref: 2d9c10486816
Node: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ10489121
Ref: library/pickle custom-reduction-for-types-functions-and-other-objects10489400
Ref: 2da010489400
Ref: library/pickle reducer-override10489400
Ref: 2d9010489400
Node: アウトオブバウンドバッファ10491875
Ref: library/pickle out-of-band-buffers10492149
Ref: 2da110492149
Ref: library/pickle pickle-oob10492149
Ref: 2d8c10492149
Node: 生産者 API10493053
Ref: library/pickle provider-api10493164
Ref: 2da210493164
Node: 消費者 API10493895
Ref: library/pickle consumer-api10494028
Ref: 2da310494028
Node: 使用例<10>10495712
Ref: library/pickle example10495823
Ref: 2da410495823
Ref: 使用例<10>-Footnote-110498693
Node: グローバル変数を制限する10498735
Ref: library/pickle pickle-restrict10498922
Ref: 2d9610498922
Ref: library/pickle restricting-globals10498922
Ref: 2da510498922
Node: 性能<2>10502295
Ref: library/pickle performance10502456
Ref: 2da610502456
Node: 使用例<11>10502715
Ref: library/pickle examples10502888
Ref: 2da710502888
Ref: library/pickle pickle-example10502888
Ref: 2da810502888
Node: コマンドライン・インターフェース10503715
Ref: library/pickle command-line-interface10503870
Ref: 2da910503870
Ref: library/pickle pickle-cli10503870
Ref: 2daa10503870
Ref: library/pickle cmdoption-pickle-arg-pickle_file10504393
Ref: 2dac10504393
Node: copyreg --- pickle サポート関数を登録する10505042
Ref: library/copyreg doc10505266
Ref: 2dad10505266
Ref: library/copyreg copyreg-register-pickle-support-functions10505266
Ref: 2dae10505266
Ref: library/copyreg module-copyreg10505266
Ref: 2a10505266
Ref: library/copyreg translation-repo10505266
Ref: 2daf10505266
Ref: library/copyreg copyreg constructor10505864
Ref: 2db010505864
Ref: library/copyreg copyreg pickle10506160
Ref: 2d8e10506160
Ref: copyreg --- pickle サポート関数を登録する-Footnote-110507130
Node: 使用例<12>10507197
Ref: library/copyreg example10507299
Ref: 2db110507299
Node: shelve --- Python オブジェクトの永続化10507881
Ref: library/shelve doc10508125
Ref: 2db210508125
Ref: library/shelve module-shelve10508125
Ref: c810508125
Ref: library/shelve shelve-python-object-persistence10508125
Ref: 2db310508125
Ref: library/shelve translation-repo10508125
Ref: 2db410508125
Ref: library/shelve shelve open10508904
Ref: 1ad210508904
Ref: library/shelve shelve-security10511583
Ref: 2db810511583
Ref: library/shelve shelve Shelf sync10512102
Ref: 2db610512102
Ref: library/shelve shelve Shelf close10512429
Ref: 2db710512429
Ref: shelve --- Python オブジェクトの永続化-Footnote-110512889
Ref: shelve --- Python オブジェクトの永続化-Footnote-210512955
Node: 制限事項10513060
Ref: library/shelve restrictions10513179
Ref: 2db910513179
Ref: library/shelve shelve Shelf10514551
Ref: 11a110514551
Ref: library/shelve shelve BsdDbShelf10516413
Ref: 271110516413
Ref: library/shelve shelve DbfilenameShelf10517134
Ref: 271210517134
Ref: 制限事項-Footnote-110517749
Node: 使用例<13>10517802
Ref: library/shelve example10517921
Ref: 2dba10517921
Ref: library/shelve shelve-example10517921
Ref: 2db510517921
Node: marshal --- 内部使用向けの Python オブジェクト直列化10519716
Ref: library/marshal doc10519972
Ref: 2dbb10519972
Ref: library/marshal marshal-internal-python-object-serialization10519972
Ref: 2dbc10519972
Ref: library/marshal module-marshal10519972
Ref: 9110519972
Ref: library/marshal translation-repo10519972
Ref: 2dbd10519972
Ref: library/marshal marshal dump10523204
Ref: 2dbf10523204
Ref: library/marshal marshal load10524221
Ref: 1e5310524221
Ref: library/marshal marshal dumps10525293
Ref: 10a910525293
Ref: library/marshal marshal loads10526057
Ref: 2dc010526057
Ref: library/marshal marshal version10526879
Ref: 2dbe10526879
Ref: marshal --- 内部使用向けの Python オブジェクト直列化-Footnote-110528102
Node: dbm --- Unix "データベース" へのインターフェース10528646
Ref: library/dbm doc10528933
Ref: 2dc110528933
Ref: library/dbm dbm-interfaces-to-unix-databases10528933
Ref: 2dc210528933
Ref: library/dbm module-dbm10528933
Ref: 3510528933
Ref: library/dbm translation-repo10528933
Ref: 2dc310528933
Ref: library/dbm dbm error10529513
Ref: 2dc410529513
Ref: library/dbm dbm whichdb10529985
Ref: 2dc510529985
Ref: library/dbm dbm open10530684
Ref: 113110530684
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-110534647
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-210534719
Node: dbm sqlite3 --- SQLite backend for dbm10534772
Ref: library/dbm dbm-sqlite3-sqlite-backend-for-dbm10534952
Ref: 2dc610534952
Ref: library/dbm module-dbm sqlite310534952
Ref: 3910534952
Ref: library/dbm dbm sqlite3 open10535652
Ref: 2dc710535652
Ref: library/dbm dbm sqlite3 sqlite3 close10536783
Ref: 2dc810536783
Ref: dbm sqlite3 --- SQLite backend for dbm-Footnote-110536898
Node: dbm gnu --- GNU database manager10536969
Ref: library/dbm dbm-gnu-gnu-database-manager10537191
Ref: 2dc910537191
Ref: library/dbm module-dbm gnu10537191
Ref: 3710537191
Ref: library/dbm dbm gnu error10537962
Ref: c9510537962
Ref: library/dbm dbm gnu open_flags10538159
Ref: 2dca10538159
Ref: library/dbm dbm gnu open10538282
Ref: 1e7c10538282
Ref: library/dbm dbm gnu gdbm close10540458
Ref: 2dcb10540458
Ref: library/dbm dbm gnu gdbm firstkey10540532
Ref: 2dcc10540532
Ref: library/dbm dbm gnu gdbm nextkey10540870
Ref: 2dcd10540870
Ref: library/dbm dbm gnu gdbm reorganize10541354
Ref: 2dce10541354
Ref: library/dbm dbm gnu gdbm sync10541797
Ref: 2dcf10541797
Ref: dbm gnu --- GNU database manager-Footnote-110542070
Node: dbm ndbm --- New Database Manager10542137
Ref: library/dbm dbm-ndbm-new-database-manager10542361
Ref: 2dd010542361
Ref: library/dbm module-dbm ndbm10542361
Ref: 3810542361
Ref: library/dbm dbm ndbm error10543444
Ref: c9610543444
Ref: library/dbm dbm ndbm library10543643
Ref: 2dd110543643
Ref: library/dbm dbm ndbm open10543728
Ref: 1e7d10543728
Ref: library/dbm dbm ndbm ndbm close10545320
Ref: 2dd210545320
Ref: dbm ndbm --- New Database Manager-Footnote-110545430
Node: dbm dumb --- Portable DBM implementation10545498
Ref: library/dbm dbm-dumb-portable-dbm-implementation10545681
Ref: 2dd310545681
Ref: library/dbm module-dbm dumb10545681
Ref: 3610545681
Ref: library/dbm dbm dumb error10546438
Ref: c9410546438
Ref: library/dbm dbm dumb open10546637
Ref: c9110546637
Ref: library/dbm dbm dumb dumbdbm close10548666
Ref: 2dd410548666
Ref: library/dbm dbm dumb dumbdbm sync10548738
Ref: 2dd510548738
Ref: dbm dumb --- Portable DBM implementation-Footnote-110548956
Node: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース10549024
Ref: library/sqlite3 doc10549234
Ref: 2dd610549234
Ref: library/sqlite3 module-sqlite310549234
Ref: d410549234
Ref: library/sqlite3 sqlite3-db-api-2-0-interface-for-sqlite-databases10549234
Ref: 2dd710549234
Ref: library/sqlite3 translation-repo10549234
Ref: 2dd810549234
Ref: library/sqlite3 sqlite3-intro10549438
Ref: 2dd910549438
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-110551588
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-210551653
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-310551695
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-410551723
Node: チュートリアル10551765
Ref: library/sqlite3 sqlite3-tutorial10551929
Ref: 2dda10551929
Ref: library/sqlite3 tutorial10551929
Ref: 2dde10551929
Ref: チュートリアル-Footnote-110559561
Ref: チュートリアル-Footnote-210559618
Ref: チュートリアル-Footnote-310559677
Ref: チュートリアル-Footnote-410559726
Ref: チュートリアル-Footnote-510559772
Node: リファレンス10559824
Ref: library/sqlite3 reference10560021
Ref: 2de810560021
Ref: library/sqlite3 sqlite3-reference10560021
Ref: 2ddb10560021
Ref: library/sqlite3 sqlite3-module-contents10560072
Ref: 2de910560072
Node: モジュール関数10560643
Ref: library/sqlite3 module-functions10560749
Ref: 2dea10560749
Ref: library/sqlite3 sqlite3-module-functions10560749
Ref: 2deb10560749
Ref: library/sqlite3 sqlite3 connect10560805
Ref: 5a610560805
Ref: library/sqlite3 sqlite3 complete_statement10566301
Ref: 2df410566301
Ref: library/sqlite3 sqlite3 enable_callback_tracebacks10567316
Ref: 2df510567316
Ref: library/sqlite3 sqlite3 register_adapter10568156
Ref: 2df610568156
Ref: library/sqlite3 sqlite3 register_converter10568631
Ref: 2ded10568631
Ref: モジュール関数-Footnote-110569475
Ref: モジュール関数-Footnote-210569518
Ref: モジュール関数-Footnote-310569560
Node: モジュール定数10569637
Ref: library/sqlite3 module-constants10569781
Ref: 2df810569781
Ref: library/sqlite3 sqlite3-module-constants10569781
Ref: 2df910569781
Ref: library/sqlite3 sqlite3 LEGACY_TRANSACTION_CONTROL10569837
Ref: 2df210569837
Ref: library/sqlite3 sqlite3 PARSE_DECLTYPES10570217
Ref: 2dee10570217
Ref: library/sqlite3 sqlite3 PARSE_COLNAMES10571328
Ref: 2def10571328
Ref: library/sqlite3 sqlite3 SQLITE_OK10571974
Ref: 2dfa10571974
Ref: library/sqlite3 sqlite3 SQLITE_DENY10572007
Ref: 2dfb10572007
Ref: library/sqlite3 sqlite3 SQLITE_IGNORE10572042
Ref: 2dfc10572042
Ref: library/sqlite3 sqlite3 apilevel10572629
Ref: 2dfd10572629
Ref: library/sqlite3 sqlite3 paramstyle10572836
Ref: 2dfe10572836
Ref: library/sqlite3 sqlite3 sqlite_version10573241
Ref: 30510573241
Ref: library/sqlite3 sqlite3 sqlite_version_info10573395
Ref: 30610573395
Ref: library/sqlite3 sqlite3 threadsafety10573576
Ref: 88d10573576
Ref: library/sqlite3 sqlite3-dbconfig-constants10576498
Ref: 2dff10576498
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DEFENSIVE10576498
Ref: 2e0010576498
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DDL10576547
Ref: 2e0110576547
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DML10576594
Ref: 2e0210576594
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FKEY10576641
Ref: 2e0310576641
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER10576692
Ref: 2e0410576692
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION10576753
Ref: 2e0510576753
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_QPSG10576814
Ref: 2e0610576814
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_TRIGGER10576865
Ref: 2e0710576865
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_VIEW10576919
Ref: 2e0810576919
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_ALTER_TABLE10576970
Ref: 2e0910576970
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_FILE_FORMAT10577028
Ref: 2e0a10577028
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE10577086
Ref: 2e0b10577086
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_RESET_DATABASE10577142
Ref: 2e0c10577142
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRIGGER_EQP10577196
Ref: 2e0d10577196
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRUSTED_SCHEMA10577247
Ref: 2e0e10577247
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_WRITABLE_SCHEMA10577301
Ref: 2e0f10577301
Ref: モジュール定数-Footnote-110578005
Ref: モジュール定数-Footnote-210578048
Ref: モジュール定数-Footnote-310578103
Node: Connection オブジェクト10578154
Ref: library/sqlite3 connection-objects10578302
Ref: 2e1010578302
Ref: library/sqlite3 sqlite3-connection-objects10578302
Ref: 2e1110578302
Ref: library/sqlite3 sqlite3 Connection10578375
Ref: 54d10578375
Ref: library/sqlite3 sqlite3 Connection cursor10579253
Ref: 2ddf10579253
Ref: library/sqlite3 sqlite3 Connection blobopen10579732
Ref: 89210579732
Ref: library/sqlite3 sqlite3 Connection commit10581194
Ref: 2de310581194
Ref: library/sqlite3 sqlite3 Connection rollback10581724
Ref: 2e1310581724
Ref: library/sqlite3 sqlite3 Connection close10582267
Ref: 54e10582267
Ref: library/sqlite3 sqlite3 Connection execute10582863
Ref: 2e1410582863
Ref: library/sqlite3 sqlite3 Connection executemany10583158
Ref: 2e1510583158
Ref: library/sqlite3 sqlite3 Connection executescript10583464
Ref: 2e1610583464
Ref: library/sqlite3 sqlite3 Connection create_function10583760
Ref: 5a710583760
Ref: library/sqlite3 sqlite3 Connection create_aggregate10585822
Ref: 5a810585822
Ref: library/sqlite3 sqlite3 Connection create_window_function10587897
Ref: 89110587897
Ref: library/sqlite3 sqlite3 Connection create_collation10591411
Ref: 88710591411
Ref: library/sqlite3 sqlite3 Connection interrupt10593166
Ref: 2e1a10593166
Ref: library/sqlite3 sqlite3 Connection set_authorizer10593497
Ref: 5a910593497
Ref: library/sqlite3 sqlite3 Connection set_progress_handler10595563
Ref: 5aa10595563
Ref: library/sqlite3 sqlite3 Connection set_trace_callback10596602
Ref: 5ab10596602
Ref: library/sqlite3 sqlite3 Connection enable_load_extension10598216
Ref: a4310598216
Ref: library/sqlite3 sqlite3 Connection load_extension10600973
Ref: 6df10600973
Ref: library/sqlite3 sqlite3 Connection iterdump10602226
Ref: 54f10602226
Ref: library/sqlite3 sqlite3 Connection backup10603357
Ref: d7710603357
Ref: library/sqlite3 sqlite3 Connection getlimit10606254
Ref: 88c10606254
Ref: library/sqlite3 sqlite3 Connection setlimit10607050
Ref: 88b10607050
Ref: library/sqlite3 sqlite3 Connection getconfig10608392
Ref: 6e010608392
Ref: library/sqlite3 sqlite3 Connection setconfig10608719
Ref: 6e110608719
Ref: library/sqlite3 sqlite3 Connection serialize10609264
Ref: 88f10609264
Ref: library/sqlite3 sqlite3 Connection deserialize10610267
Ref: 89010610267
Ref: library/sqlite3 sqlite3 Connection autocommit10611731
Ref: 6dd10611731
Ref: library/sqlite3 sqlite3 Connection in_transaction10613629
Ref: 2e1d10613629
Ref: library/sqlite3 sqlite3 Connection isolation_level10614013
Ref: 2df010614013
Ref: library/sqlite3 sqlite3 Connection row_factory10615257
Ref: 1a0310615257
Ref: library/sqlite3 sqlite3 Connection text_factory10616073
Ref: 2e1f10616073
Ref: library/sqlite3 sqlite3 Connection total_changes10616731
Ref: 2e2010616731
Ref: Connection オブジェクト-Footnote-110616966
Ref: Connection オブジェクト-Footnote-210617012
Ref: Connection オブジェクト-Footnote-310617077
Ref: Connection オブジェクト-Footnote-410617136
Ref: Connection オブジェクト-Footnote-510617195
Ref: Connection オブジェクト-Footnote-610617237
Ref: Connection オブジェクト-Footnote-710617279
Ref: Connection オブジェクト-Footnote-810617371
Ref: Connection オブジェクト-Footnote-910617413
Ref: Connection オブジェクト-Footnote-1010617505
Node: Cursor オブジェクト10617606
Ref: library/sqlite3 cursor-objects10617755
Ref: 2e2110617755
Ref: library/sqlite3 sqlite3-cursor-objects10617755
Ref: 2e2210617755
Ref: library/sqlite3 sqlite3 Cursor10618618
Ref: 2de010618618
Ref: library/sqlite3 sqlite3 Cursor execute10618745
Ref: 5b010618745
Ref: library/sqlite3 sqlite3 Cursor executemany10620552
Ref: 5b110620552
Ref: library/sqlite3 sqlite3 Cursor executescript10622230
Ref: 2e1710622230
Ref: library/sqlite3 sqlite3 Cursor fetchone10623222
Ref: 2de110623222
Ref: library/sqlite3 sqlite3 Cursor fetchmany10623613
Ref: 181510623613
Ref: library/sqlite3 sqlite3 Cursor fetchall10624734
Ref: 2de410624734
Ref: library/sqlite3 sqlite3 Cursor close10625117
Ref: 2e2310625117
Ref: library/sqlite3 sqlite3 Cursor setinputsizes10625502
Ref: 2e2410625502
Ref: library/sqlite3 sqlite3 Cursor setoutputsize10625630
Ref: 2e2510625630
Ref: library/sqlite3 sqlite3 Cursor arraysize10625770
Ref: 181610625770
Ref: library/sqlite3 sqlite3 Cursor connection10626191
Ref: 2e2610626191
Ref: library/sqlite3 sqlite3 Cursor description10626741
Ref: 190e10626741
Ref: library/sqlite3 sqlite3 Cursor lastrowid10627189
Ref: ed010627189
Ref: library/sqlite3 sqlite3 Cursor rowcount10627954
Ref: 1bbf10627954
Ref: library/sqlite3 sqlite3 Cursor row_factory10628540
Ref: 2e1e10628540
Ref: library/sqlite3 sqlite3-columns-by-name10629742
Ref: 2e2710629742
Ref: Cursor オブジェクト-Footnote-110629778
Ref: Cursor オブジェクト-Footnote-210629835
Node: Row オブジェクト10629886
Ref: library/sqlite3 row-objects10630029
Ref: 2e2810630029
Ref: library/sqlite3 sqlite3-row-objects10630029
Ref: 2e2910630029
Ref: library/sqlite3 sqlite3 Row10630088
Ref: 107510630088
Ref: library/sqlite3 sqlite3 Row keys10630817
Ref: 2e2a10630817
Node: Blob オブジェクト10631184
Ref: library/sqlite3 blob-objects10631336
Ref: 2e2b10631336
Ref: library/sqlite3 sqlite3-blob-objects10631336
Ref: 2e2c10631336
Ref: library/sqlite3 sqlite3 Blob10631397
Ref: 89310631397
Ref: library/sqlite3 sqlite3 Blob close10632737
Ref: 2e2d10632737
Ref: library/sqlite3 sqlite3 Blob read10633035
Ref: 2e2e10633035
Ref: library/sqlite3 sqlite3 Blob write10633600
Ref: 2e2f10633600
Ref: library/sqlite3 sqlite3 Blob tell10633910
Ref: 2e3010633910
Ref: library/sqlite3 sqlite3 Blob seek10634045
Ref: 2e3110634045
Node: PrepareProtocol オブジェクト10634475
Ref: library/sqlite3 prepareprotocol-objects10634614
Ref: 2e3210634614
Ref: library/sqlite3 sqlite3 PrepareProtocol10634697
Ref: 1bca10634697
Ref: PrepareProtocol オブジェクト-Footnote-110635083
Node: 例外<7>10635125
Ref: library/sqlite3 exceptions10635265
Ref: 2e3410635265
Ref: library/sqlite3 sqlite3-exceptions10635265
Ref: 2e3510635265
Ref: library/sqlite3 sqlite3 Warning10635374
Ref: 1c1310635374
Ref: library/sqlite3 sqlite3 Error10635776
Ref: 1c8210635776
Ref: library/sqlite3 sqlite3 Error sqlite_errorcode10636194
Ref: 88910636194
Ref: library/sqlite3 sqlite3 Error sqlite_errorname10636328
Ref: 88a10636328
Ref: library/sqlite3 sqlite3 InterfaceError10636474
Ref: 88e10636474
Ref: library/sqlite3 sqlite3 DatabaseError10636799
Ref: 2e1b10636799
Ref: library/sqlite3 sqlite3 DataError10637222
Ref: 1cae10637222
Ref: library/sqlite3 sqlite3 OperationalError10637499
Ref: 1caf10637499
Ref: library/sqlite3 sqlite3 IntegrityError10637911
Ref: 2e3610637911
Ref: library/sqlite3 sqlite3 InternalError10638190
Ref: 2e3710638190
Ref: library/sqlite3 sqlite3 ProgrammingError10638540
Ref: 30710638540
Ref: library/sqlite3 sqlite3 NotSupportedError10638956
Ref: 2e1910638956
Ref: 例外<7>-Footnote-110639518
Ref: 例外<7>-Footnote-210639560
Ref: 例外<7>-Footnote-310639600
Node: SQLite と Python の型10639640
Ref: library/sqlite3 sqlite-and-python-types10639840
Ref: 2e3810639840
Ref: library/sqlite3 sqlite3-types10639840
Ref: 2dec10639840
Node: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨10641944
Ref: library/sqlite3 default-adapters-and-converters-deprecated10642186
Ref: 2e3910642186
Ref: library/sqlite3 sqlite3-default-converters10642186
Ref: 71410642186
Ref: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨-Footnote-110643986
Node: コマンドライン・インターフェース<2>10644033
Ref: library/sqlite3 command-line-interface10644242
Ref: 2e3a10644242
Ref: library/sqlite3 sqlite3-cli10644242
Ref: 67410644242
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-h10644731
Ref: 2e3b10644731
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-help10644731
Ref: 2e3c10644731
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-v10644787
Ref: 2e3d10644787
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-version10644787
Ref: 2e3e10644787
Node: ハウツー・ガイド10644916
Ref: library/sqlite3 how-to-guides10645098
Ref: 2e3f10645098
Ref: library/sqlite3 sqlite3-howtos10645098
Ref: 2ddc10645098
Node: プレースホルダを使用して SQL クエリに値を結び付ける方法10645889
Ref: library/sqlite3 how-to-use-placeholders-to-bind-values-in-sql-queries10646100
Ref: 2e4010646100
Ref: library/sqlite3 sqlite3-placeholders10646100
Ref: 5b210646100
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-110649022
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-210649074
Node: カスタム Python 型を SQLite 値に適合させる方法10649116
Ref: library/sqlite3 how-to-adapt-custom-python-types-to-sqlite-values10649393
Ref: 2e4110649393
Ref: library/sqlite3 sqlite3-adapters10649393
Ref: 2de510649393
Node: 適合可能オブジェクトの書き方10650651
Ref: library/sqlite3 how-to-write-adaptable-objects10650879
Ref: 2e4210650879
Ref: library/sqlite3 sqlite3-conform10650879
Ref: 2e3310650879
Node: 適合用呼び出し可能オブジェクト adapter callables の登録方法10651890
Ref: library/sqlite3 how-to-register-adapter-callables10652118
Ref: 2e4310652118
Node: SQLite 値をカスタム Python 型に変換する方法10652878
Ref: library/sqlite3 how-to-convert-sqlite-values-to-custom-python-types10653117
Ref: 2e4410653117
Ref: library/sqlite3 sqlite3-converters10653117
Ref: 2de610653117
Node: 適合関数と変換関数のレシピ集10656070
Ref: library/sqlite3 adapter-and-converter-recipes10656314
Ref: 2e4510656314
Ref: library/sqlite3 sqlite3-adapter-converter-recipes10656314
Ref: 71510656314
Node: 接続 connection ショートカット・メソッドの使い方10657778
Ref: library/sqlite3 how-to-use-connection-shortcut-methods10658028
Ref: 2e4610658028
Ref: library/sqlite3 sqlite3-connection-shortcuts10658028
Ref: 2e1210658028
Node: 接続 connection コンテキストマネージャの使い方10659489
Ref: library/sqlite3 how-to-use-the-connection-context-manager10659723
Ref: 2e4710659723
Ref: library/sqlite3 sqlite3-connection-context-manager10659723
Ref: 1bcb10659723
Node: SQLite URI の操作方法10661875
Ref: library/sqlite3 how-to-work-with-sqlite-uris10662097
Ref: 2e4810662097
Ref: library/sqlite3 sqlite3-uri-tricks10662097
Ref: 2df310662097
Ref: SQLite URI の操作方法-Footnote-110663555
Node: 行工場 row factories の作成方法と使用方法10663595
Ref: library/sqlite3 how-to-create-and-use-row-factories10663792
Ref: 2e4910663792
Ref: library/sqlite3 sqlite3-howto-row-factory10663792
Ref: 2de710663792
Node: How to handle non-UTF-8 text encodings10667331
Ref: library/sqlite3 how-to-handle-non-utf-8-text-encodings10667493
Ref: 2e4a10667493
Ref: library/sqlite3 sqlite3-howto-encoding10667493
Ref: 2e1c10667493
Ref: How to handle non-UTF-8 text encodings-Footnote-110668825
Node: 説明10668874
Ref: library/sqlite3 explanation10669029
Ref: 2e4b10669029
Ref: library/sqlite3 sqlite3-explanation10669029
Ref: 2ddd10669029
Ref: library/sqlite3 sqlite3-transaction-control10669062
Ref: 2e4c10669062
Node: トランザクション制御10669107
Ref: library/sqlite3 sqlite3-controlling-transactions10669180
Ref: 2de210669180
Ref: library/sqlite3 transaction-control10669180
Ref: 2e4d10669180
Node: autocommit 属性に依るトランザクション制御10669794
Ref: library/sqlite3 sqlite3-transaction-control-autocommit10669987
Ref: 6de10669987
Ref: library/sqlite3 transaction-control-via-the-autocommit-attribute10669987
Ref: 2e4e10669987
Ref: autocommit 属性に依るトランザクション制御-Footnote-110672457
Ref: autocommit 属性に依るトランザクション制御-Footnote-210672499
Ref: autocommit 属性に依るトランザクション制御-Footnote-310672591
Node: isolation_level 属性に依るトランザクション制御10672633
Ref: library/sqlite3 sqlite3-transaction-control-isolation-level10672826
Ref: 2df110672826
Ref: library/sqlite3 transaction-control-via-the-isolation-level-attribute10672826
Ref: 2e4f10672826
Ref: isolation_level 属性に依るトランザクション制御-Footnote-110675630
Ref: isolation_level 属性に依るトランザクション制御-Footnote-210675730
Node: データ圧縮とアーカイブ10675822
Ref: library/archiving doc10675989
Ref: 2d8510675989
Ref: library/archiving archiving10675989
Ref: 2e5010675989
Ref: library/archiving data-compression-and-archiving10675989
Ref: 2e5110675989
Ref: library/archiving translation-repo10675989
Ref: 2e5210675989
Node: compression パッケージ10677022
Ref: library/compression doc10677197
Ref: 2e5310677197
Ref: library/compression module-compression10677197
Ref: 2210677197
Ref: library/compression the-compression-package10677197
Ref: 2e5410677197
Node: compression zstd --- Compression compatible with the Zstandard format10678046
Ref: library/compression zstd doc10678259
Ref: 2e5510678259
Ref: library/compression zstd compression-zstd-compression-compatible-with-the-zstandard-format10678259
Ref: 2e5610678259
Ref: library/compression zstd module-compression zstd10678259
Ref: 2310678259
Ref: library/compression zstd translation-repo10678259
Ref: 2e5710678259
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-110680310
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-210680396
Node: 例外<8>10680463
Ref: library/compression zstd exceptions10680623
Ref: 2e6310680623
Ref: library/compression zstd compression zstd ZstdError10680654
Ref: 2e6410680654
Node: 圧縮ファイルへの読み書き10680836
Ref: library/compression zstd reading-and-writing-compressed-files10681038
Ref: 2e6510681038
Ref: library/compression zstd compression zstd open10681119
Ref: 2e5810681119
Ref: library/compression zstd compression zstd ZstdFile10683318
Ref: 2e5910683318
Ref: library/compression zstd compression zstd ZstdFile peek10685502
Ref: 2e6710685502
Ref: library/compression zstd compression zstd ZstdFile mode10686171
Ref: 2e6810686171
Ref: library/compression zstd compression zstd ZstdFile name10686281
Ref: 2e6910686281
Node: メモリ上での圧縮と展開10686450
Ref: library/compression zstd compressing-and-decompressing-data-in-memory10686665
Ref: 2e6b10686665
Ref: library/compression zstd compression zstd compress10686741
Ref: 2e5b10686741
Ref: library/compression zstd compression zstd decompress10687952
Ref: 2e5c10687952
Ref: library/compression zstd compression zstd ZstdCompressor10688781
Ref: 2e5a10688781
Ref: library/compression zstd compression zstd ZstdCompressor compress10690110
Ref: 2e6e10690110
Ref: library/compression zstd compression zstd ZstdCompressor flush10691123
Ref: 2e6f10691123
Ref: library/compression zstd compression zstd ZstdCompressor set_pledged_input_size10691514
Ref: 2e7310691514
Ref: library/compression zstd compression zstd ZstdCompressor CONTINUE10692820
Ref: 2e7010692820
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_BLOCK10693073
Ref: 2e7110693073
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_FRAME10693374
Ref: 2e7210693374
Ref: library/compression zstd compression zstd ZstdCompressor last_mode10693586
Ref: 2e7510693586
Ref: library/compression zstd compression zstd ZstdDecompressor10693950
Ref: 17b910693950
Ref: library/compression zstd compression zstd ZstdDecompressor decompress10695182
Ref: 2e7610695182
Ref: library/compression zstd compression zstd ZstdDecompressor eof10696454
Ref: 2e7910696454
Ref: library/compression zstd compression zstd ZstdDecompressor unused_data10696569
Ref: 2e7810696569
Ref: library/compression zstd compression zstd ZstdDecompressor needs_input10696768
Ref: 2e7710696768
Node: Zstandard dictionaries10696948
Ref: library/compression zstd zstandard-dictionaries10697153
Ref: 2e7a10697153
Ref: library/compression zstd compression zstd train_dict10697218
Ref: 2e5d10697218
Ref: library/compression zstd compression zstd finalize_dict10698311
Ref: 2e5e10698311
Ref: library/compression zstd compression zstd ZstdDict10699452
Ref: 2e5f10699452
Ref: library/compression zstd compression zstd ZstdDict dict_content10702749
Ref: 2e7b10702749
Ref: library/compression zstd compression zstd ZstdDict dict_id10703061
Ref: 2e7c10703061
Ref: library/compression zstd compression zstd ZstdDict as_digested_dict10703681
Ref: 2e7e10703681
Ref: library/compression zstd compression zstd ZstdDict as_undigested_dict10703771
Ref: 2e7f10703771
Node: Advanced parameter control10703866
Ref: library/compression zstd advanced-parameter-control10704050
Ref: 2e8010704050
Ref: library/compression zstd compression zstd CompressionParameter10704123
Ref: 2e6010704123
Ref: library/compression zstd compression zstd CompressionParameter bounds10704949
Ref: 2e6d10704949
Ref: library/compression zstd compression zstd CompressionParameter compression_level10705423
Ref: 2e6c10705423
Ref: library/compression zstd compression zstd CompressionParameter window_log10705989
Ref: 2e8110705989
Ref: library/compression zstd compression zstd CompressionParameter hash_log10706427
Ref: 2e8310706427
Ref: library/compression zstd compression zstd CompressionParameter chain_log10706822
Ref: 2e8510706822
Ref: library/compression zstd compression zstd CompressionParameter search_log10707338
Ref: 2e8710707338
Ref: library/compression zstd compression zstd CompressionParameter min_match10707671
Ref: 2e8810707671
Ref: library/compression zstd compression zstd CompressionParameter target_length10708240
Ref: 2e8a10708240
Ref: library/compression zstd compression zstd CompressionParameter strategy10708893
Ref: 2e8d10708893
Ref: library/compression zstd compression zstd CompressionParameter enable_long_distance_matching10709183
Ref: 2e8e10709183
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_log10709863
Ref: 2e8f10709863
Ref: library/compression zstd compression zstd CompressionParameter ldm_min_match10710159
Ref: 2e9010710159
Ref: library/compression zstd compression zstd CompressionParameter ldm_bucket_size_log10710405
Ref: 2e9110710405
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_rate_log10710717
Ref: 2e9210710717
Ref: library/compression zstd compression zstd CompressionParameter content_size_flag10711088
Ref: 2e7410711088
Ref: library/compression zstd compression zstd CompressionParameter checksum_flag10712221
Ref: 2e9310712221
Ref: library/compression zstd compression zstd CompressionParameter dict_id_flag10712634
Ref: 2e9410712634
Ref: library/compression zstd compression zstd CompressionParameter nb_workers10712906
Ref: 2e9510712906
Ref: library/compression zstd compression zstd CompressionParameter job_size10713329
Ref: 2e9610713329
Ref: library/compression zstd compression zstd CompressionParameter overlap_log10713689
Ref: 2e9710713689
Ref: library/compression zstd compression zstd DecompressionParameter10714343
Ref: 2e6110714343
Ref: library/compression zstd compression zstd DecompressionParameter bounds10715078
Ref: 2e9810715078
Ref: library/compression zstd compression zstd DecompressionParameter window_log_max10715368
Ref: 2e9910715368
Ref: library/compression zstd compression zstd Strategy10715744
Ref: 2e6210715744
Ref: library/compression zstd compression zstd Strategy fast10716229
Ref: 2e8610716229
Ref: library/compression zstd compression zstd Strategy dfast10716255
Ref: 2e8410716255
Ref: library/compression zstd compression zstd Strategy greedy10716282
Ref: 2e9a10716282
Ref: library/compression zstd compression zstd Strategy lazy10716310
Ref: 2e9b10716310
Ref: library/compression zstd compression zstd Strategy lazy210716336
Ref: 2e9c10716336
Ref: library/compression zstd compression zstd Strategy btlazy210716363
Ref: 2e9d10716363
Ref: library/compression zstd compression zstd Strategy btopt10716392
Ref: 2e8910716392
Ref: library/compression zstd compression zstd Strategy btultra10716419
Ref: 2e8b10716419
Ref: library/compression zstd compression zstd Strategy btultra210716448
Ref: 2e8c10716448
Node: その他<3>10716478
Ref: library/compression zstd miscellaneous10716653
Ref: 2e9e10716653
Ref: library/compression zstd compression zstd get_frame_info10716689
Ref: 2e7d10716689
Ref: library/compression zstd compression zstd FrameInfo10716921
Ref: 2e9f10716921
Ref: library/compression zstd compression zstd FrameInfo decompressed_size10717009
Ref: 2ea010717009
Ref: library/compression zstd compression zstd FrameInfo dictionary_id10717111
Ref: 2ea110717111
Ref: library/compression zstd compression zstd COMPRESSION_LEVEL_DEFAULT10717472
Ref: 2e8210717472
Ref: library/compression zstd compression zstd zstd_version_info10717591
Ref: 2ea210717591
Node: 使用例<14>10717744
Ref: library/compression zstd examples10717884
Ref: 2ea310717884
Node: zlib --- gzip 互換の圧縮10719303
Ref: library/zlib doc10719530
Ref: 2ea410719530
Ref: library/zlib module-zlib10719530
Ref: 13a10719530
Ref: library/zlib translation-repo10719530
Ref: 2ea510719530
Ref: library/zlib zlib-compression-compatible-with-gzip10719530
Ref: 2ea610719530
Ref: library/zlib zlib error10720501
Ref: 2ea710720501
Ref: library/zlib zlib adler3210720610
Ref: 1c1710720610
Ref: library/zlib zlib compress10721652
Ref: 84f10721652
Ref: library/zlib compress-wbits10722193
Ref: 2eac10722193
Ref: library/zlib zlib compressobj10723445
Ref: 2eae10723445
Ref: library/zlib zlib crc3210725483
Ref: 1a7210725483
Ref: library/zlib zlib decompress10726422
Ref: f0d10726422
Ref: library/zlib decompress-wbits10726856
Ref: 2eb510726856
Ref: library/zlib zlib decompressobj10728719
Ref: 2eb610728719
Ref: library/zlib zlib Compress compress10729908
Ref: 2eb710729908
Ref: library/zlib zlib Compress flush10730418
Ref: 2eb810730418
Ref: library/zlib zlib Compress copy10731197
Ref: 2ebf10731197
Ref: library/zlib zlib Decompress unused_data10731636
Ref: 2ec010731636
Ref: library/zlib zlib Decompress unconsumed_tail10732118
Ref: 2ec110732118
Ref: library/zlib zlib Decompress eof10732694
Ref: 138910732694
Ref: library/zlib zlib Decompress decompress10733028
Ref: 2ec210733028
Ref: library/zlib zlib Decompress flush10734126
Ref: 2ec310734126
Ref: library/zlib zlib Decompress copy10734651
Ref: 2ec410734651
Ref: library/zlib zlib DEFLATED10735237
Ref: 2eaf10735237
Ref: library/zlib zlib MAX_WBITS10735305
Ref: 2ead10735305
Ref: library/zlib zlib DEF_MEM_LEVEL10735489
Ref: 2ec510735489
Ref: library/zlib zlib DEF_BUF_SIZE10735580
Ref: 2ec610735580
Ref: library/zlib zlib Z_NO_COMPRESSION10735674
Ref: 2eaa10735674
Ref: library/zlib zlib Z_BEST_SPEED10735789
Ref: 2ea810735789
Ref: library/zlib zlib Z_BEST_COMPRESSION10735900
Ref: 2ea910735900
Ref: library/zlib zlib Z_DEFAULT_COMPRESSION10736016
Ref: 2eab10736016
Ref: library/zlib zlib Z_DEFAULT_STRATEGY10736204
Ref: 2eb010736204
Ref: library/zlib zlib Z_FILTERED10736297
Ref: 2eb110736297
Ref: library/zlib zlib Z_HUFFMAN_ONLY10736402
Ref: 2eb210736402
Ref: library/zlib zlib Z_RLE10736498
Ref: 2eb310736498
Ref: library/zlib zlib Z_FIXED10736739
Ref: 2eb410736739
Ref: library/zlib zlib Z_NO_FLUSH10736972
Ref: 2eb910736972
Ref: library/zlib zlib Z_PARTIAL_FLUSH10737089
Ref: 2eba10737089
Ref: library/zlib zlib Z_SYNC_FLUSH10737187
Ref: 2ebb10737187
Ref: library/zlib zlib Z_FULL_FLUSH10737321
Ref: 2ebc10737321
Ref: library/zlib zlib Z_FINISH10737445
Ref: 2ebe10737445
Ref: library/zlib zlib Z_BLOCK10737566
Ref: 2ebd10737566
Ref: library/zlib zlib Z_TREES10737788
Ref: 2ec710737788
Ref: library/zlib zlib ZLIB_VERSION10738179
Ref: 2ec810738179
Ref: library/zlib zlib ZLIB_RUNTIME_VERSION10738525
Ref: 138a10738525
Ref: library/zlib zlib ZLIBNG_VERSION10738710
Ref: 2ec910738710
Ref: zlib --- gzip 互換の圧縮-Footnote-110739641
Ref: zlib --- gzip 互換の圧縮-Footnote-210739670
Ref: zlib --- gzip 互換の圧縮-Footnote-310739711
Node: gzip --- gzip ファイルのサポート10739764
Ref: library/gzip doc10739957
Ref: 2eca10739957
Ref: library/gzip gzip-support-for-gzip-files10739957
Ref: 2ecb10739957
Ref: library/gzip module-gzip10739957
Ref: 6b10739957
Ref: library/gzip translation-repo10739957
Ref: 2ecc10739957
Ref: library/gzip gzip open10741340
Ref: 2ecd10741340
Ref: library/gzip gzip BadGzipFile10743296
Ref: bee10743296
Ref: library/gzip gzip GzipFile10743546
Ref: 65c10743546
Ref: library/gzip gzip GzipFile peek10747456
Ref: 142910747456
Ref: library/gzip gzip GzipFile mode10748036
Ref: 2ed010748036
Ref: library/gzip gzip GzipFile mtime10748258
Ref: 2ece10748258
Ref: library/gzip gzip GzipFile name10748598
Ref: 73110748598
Ref: library/gzip gzip compress10750101
Ref: 84e10750101
Ref: library/gzip gzip decompress10751309
Ref: 142a10751309
Ref: gzip --- gzip ファイルのサポート-Footnote-110752052
Node: 使い方の例10752116
Ref: library/gzip examples-of-usage10752269
Ref: 2ed210752269
Ref: library/gzip gzip-usage-examples10752269
Ref: 2ed310752269
Ref: 使い方の例-Footnote-110753382
Node: コマンドライン・インターフェース<3>10753435
Ref: library/gzip command-line-interface10753588
Ref: 2ed410753588
Ref: library/gzip gzip-cli10753588
Ref: 2ed510753588
Node: コマンドラインオプション10754057
Ref: library/gzip command-line-options10754181
Ref: 2ed610754181
Ref: library/gzip cmdoption-gzip-arg-file10754262
Ref: 2ed710754262
Ref: library/gzip cmdoption-gzip-fast10754346
Ref: 2ed810754346
Ref: library/gzip cmdoption-gzip-best10754433
Ref: 2ed910754433
Ref: library/gzip cmdoption-gzip-d10754520
Ref: 2eda10754520
Ref: library/gzip cmdoption-gzip-decompress10754520
Ref: 2edb10754520
Ref: library/gzip cmdoption-gzip-h10754583
Ref: 2edc10754583
Ref: library/gzip cmdoption-gzip-help10754583
Ref: 2edd10754583
Node: bz2 --- bzip2 圧縮のサポート10754656
Ref: library/bz2 doc10754873
Ref: 2ede10754873
Ref: library/bz2 bz2-support-for-bzip2-compression10754873
Ref: 2edf10754873
Ref: library/bz2 module-bz210754873
Ref: 1410754873
Ref: library/bz2 translation-repo10754873
Ref: 2ee010754873
Ref: bz2 --- bzip2 圧縮のサポート-Footnote-110756086
Node: ファイルの圧縮/解凍10756149
Ref: library/bz2 de-compression-of-files10756285
Ref: 2ee110756285
Ref: library/bz2 bz2 open10756353
Ref: 12a310756353
Ref: library/bz2 bz2 BZ2File10758201
Ref: a6a10758201
Ref: library/bz2 bz2 BZ2File peek10759995
Ref: 2ee210759995
Ref: library/bz2 bz2 BZ2File fileno10760721
Ref: 2ee310760721
Ref: library/bz2 bz2 BZ2File readable10760851
Ref: 2ee410760851
Ref: library/bz2 bz2 BZ2File seekable10760979
Ref: 2ee510760979
Ref: library/bz2 bz2 BZ2File writable10761101
Ref: 2ee610761101
Ref: library/bz2 bz2 BZ2File read110761229
Ref: 2ee710761229
Ref: library/bz2 bz2 BZ2File readinto10761554
Ref: 2ee810761554
Ref: library/bz2 bz2 BZ2File mode10761713
Ref: 2ee910761713
Ref: library/bz2 bz2 BZ2File name10761857
Ref: 2eea10761857
Node: 逐次圧縮および展開10763465
Ref: library/bz2 incremental-de-compression10763629
Ref: 2eeb10763629
Ref: library/bz2 bz2 BZ2Compressor10763695
Ref: 1b2d10763695
Ref: library/bz2 bz2 BZ2Compressor compress10764173
Ref: 2eec10764173
Ref: library/bz2 bz2 BZ2Compressor flush10764673
Ref: 2eed10764673
Ref: library/bz2 bz2 BZ2Decompressor10764986
Ref: 178f10764986
Ref: library/bz2 bz2 BZ2Decompressor decompress10765783
Ref: fce10765783
Ref: library/bz2 bz2 BZ2Decompressor eof10767390
Ref: 2ef010767390
Ref: library/bz2 bz2 BZ2Decompressor unused_data10767538
Ref: 2eef10767538
Ref: library/bz2 bz2 BZ2Decompressor needs_input10767803
Ref: 2eee10767803
Node: 一括圧縮/解凍10768053
Ref: library/bz2 one-shot-de-compression10768207
Ref: 2ef110768207
Ref: library/bz2 bz2 compress10768260
Ref: 28f510768260
Ref: library/bz2 bz2 decompress10768681
Ref: 12a410768681
Node: 使い方の例<2>10769111
Ref: library/bz2 bz2-usage-examples10769229
Ref: 2ef210769229
Ref: library/bz2 examples-of-usage10769229
Ref: 2ef310769229
Node: lzma --- LZMA アルゴリズムを使用した圧縮10772301
Ref: library/lzma doc10772517
Ref: 2ef410772517
Ref: library/lzma lzma-compression-using-the-lzma-algorithm10772517
Ref: 2ef510772517
Ref: library/lzma module-lzma10772517
Ref: 8e10772517
Ref: library/lzma translation-repo10772517
Ref: 2ef610772517
Ref: library/lzma lzma LZMAError10773841
Ref: 2ef710773841
Ref: lzma --- LZMA アルゴリズムを使用した圧縮-Footnote-110774334
Node: 圧縮ファイルへの読み書き<2>10774398
Ref: library/lzma reading-and-writing-compressed-files10774572
Ref: 2ef810774572
Ref: library/lzma lzma open10774653
Ref: 2ef910774653
Ref: library/lzma lzma LZMAFile10776937
Ref: 121210776937
Ref: library/lzma lzma LZMAFile peek10779420
Ref: 2efa10779420
Ref: library/lzma lzma LZMAFile mode10780142
Ref: 2efb10780142
Ref: library/lzma lzma LZMAFile name10780286
Ref: 2efc10780286
Node: メモリ上での圧縮と展開<2>10780867
Ref: library/lzma compressing-and-decompressing-data-in-memory10781062
Ref: 2efd10781062
Ref: library/lzma lzma LZMACompressor10781138
Ref: 1b2c10781138
Ref: library/lzma lzma LZMACompressor compress10785045
Ref: 2f0010785045
Ref: library/lzma lzma LZMACompressor flush10785606
Ref: 2f0110785606
Ref: library/lzma lzma LZMADecompressor10785930
Ref: 17ae10785930
Ref: library/lzma lzma LZMADecompressor decompress10787740
Ref: 103210787740
Ref: library/lzma lzma LZMADecompressor check10789348
Ref: 2f0510789348
Ref: library/lzma lzma LZMADecompressor eof10789706
Ref: 2f0610789706
Ref: library/lzma lzma LZMADecompressor unused_data10789821
Ref: 2f0410789821
Ref: library/lzma lzma LZMADecompressor needs_input10790039
Ref: 2f0310790039
Ref: library/lzma lzma compress10790290
Ref: 2efe10790290
Ref: library/lzma lzma decompress10790702
Ref: 2f0210790702
Node: その他<4>10791255
Ref: library/lzma miscellaneous10791456
Ref: 2f0710791456
Ref: library/lzma lzma is_check_supported10791492
Ref: 2f0810791492
Node: カスタムフィルタチェインの指定10791951
Ref: library/lzma filter-chain-specs10792129
Ref: 2eff10792129
Ref: library/lzma specifying-custom-filter-chains10792129
Ref: 2f0910792129
Node: 使用例<15>10795360
Ref: library/lzma examples10795517
Ref: 2f0a10795517
Node: zipfile --- ZIP アーカイブの処理10796947
Ref: library/zipfile doc10797186
Ref: 2f0b10797186
Ref: library/zipfile module-zipfile10797186
Ref: 13810797186
Ref: library/zipfile translation-repo10797186
Ref: 2f0c10797186
Ref: library/zipfile zipfile-work-with-zip-archives10797186
Ref: 2f0d10797186
Ref: library/zipfile zipfile BadZipFile10798703
Ref: 1bc710798703
Ref: library/zipfile zipfile BadZipfile10798850
Ref: 2f0e10798850
Ref: library/zipfile zipfile LargeZipFile10799066
Ref: 2f0f10799066
Ref: library/zipfile zipfile ZipInfo10799890
Ref: 2cd10799890
Ref: library/zipfile zipfile ZipInfo _for_archive10800837
Ref: 2cc10800837
Ref: library/zipfile zipfile is_zipfile10801121
Ref: 154610801121
Ref: library/zipfile zipfile ZIP_STORED10801579
Ref: 2f1410801579
Ref: library/zipfile zipfile ZIP_DEFLATED10801757
Ref: 2f1510801757
Ref: library/zipfile zipfile ZIP_BZIP210801926
Ref: 2f1610801926
Ref: library/zipfile zipfile ZIP_LZMA10802110
Ref: 2f1710802110
Ref: library/zipfile zipfile ZIP_ZSTANDARD10802293
Ref: 2f1810802293
Ref: zipfile --- ZIP アーカイブの処理-Footnote-110803840
Ref: zipfile --- ZIP アーカイブの処理-Footnote-210803905
Ref: zipfile --- ZIP アーカイブの処理-Footnote-310803973
Ref: zipfile --- ZIP アーカイブの処理-Footnote-410804041
Node: ZipFile objects10804082
Ref: library/zipfile id110804195
Ref: 2f1910804195
Ref: library/zipfile zipfile-objects10804195
Ref: 2f1010804195
Ref: library/zipfile zipfile ZipFile10804246
Ref: 8d410804246
Ref: library/zipfile zipfile ZipFile close10810428
Ref: 2f1a10810428
Ref: library/zipfile zipfile ZipFile getinfo10810732
Ref: 2f1110810732
Ref: library/zipfile zipfile ZipFile infolist10811064
Ref: 2f1210811064
Ref: library/zipfile zipfile ZipFile namelist10811406
Ref: 2f1b10811406
Ref: library/zipfile zipfile ZipFile open10811515
Ref: 65d10811515
Ref: library/zipfile zipfile ZipFile extract10814557
Ref: 2f1e10814557
Ref: library/zipfile zipfile ZipFile extractall10816204
Ref: 2f1f10816204
Ref: library/zipfile zipfile ZipFile printdir10817279
Ref: 2f2010817279
Ref: library/zipfile zipfile ZipFile setpassword10817400
Ref: 2f2110817400
Ref: library/zipfile zipfile ZipFile read10817543
Ref: 2f1d10817543
Ref: library/zipfile zipfile ZipFile testzip10818501
Ref: 2f2210818501
Ref: library/zipfile zipfile ZipFile write10818875
Ref: f4d10818875
Ref: library/zipfile zipfile ZipFile writestr10820858
Ref: 2ce10820858
Ref: library/zipfile zipfile ZipFile mkdir10822795
Ref: 8d510822795
Ref: library/zipfile zipfile ZipFile filename10823336
Ref: 2f2310823336
Ref: library/zipfile zipfile ZipFile debug10823410
Ref: 2f2410823410
Ref: library/zipfile zipfile ZipFile comment10823729
Ref: 2f2510823729
Node: Path objects10824177
Ref: library/zipfile id210824316
Ref: 2f2610824316
Ref: library/zipfile path-objects10824316
Ref: 2f2710824316
Ref: library/zipfile zipfile Path10824361
Ref: 8d910824361
Ref: library/zipfile zipfile Path name10825527
Ref: 2f2810825527
Ref: library/zipfile zipfile Path open10825585
Ref: 196810825585
Ref: library/zipfile zipfile Path iterdir10826481
Ref: 2f2910826481
Ref: library/zipfile zipfile Path is_dir10826571
Ref: 2f2a10826571
Ref: library/zipfile zipfile Path is_file10826676
Ref: 2f2b10826676
Ref: library/zipfile zipfile Path is_symlink10826777
Ref: 2f2c10826777
Ref: library/zipfile zipfile Path exists10827033
Ref: 2f2d10827033
Ref: library/zipfile zipfile Path suffix10827167
Ref: 8d710827167
Ref: library/zipfile zipfile Path stem10827376
Ref: 8d610827376
Ref: library/zipfile zipfile Path suffixes10827515
Ref: 8d810827515
Ref: library/zipfile zipfile Path read_text10827682
Ref: 1b3d10827682
Ref: library/zipfile zipfile Path read_bytes10828271
Ref: 2f2e10828271
Ref: library/zipfile zipfile Path joinpath10828347
Ref: 2f2f10828347
Ref: Path objects-Footnote-110829010
Node: PyZipFile objects10829049
Ref: library/zipfile id310829188
Ref: 2f3010829188
Ref: library/zipfile pyzipfile-objects10829188
Ref: 2f3110829188
Ref: library/zipfile zipfile PyZipFile10829415
Ref: 11fe10829415
Ref: library/zipfile zipfile PyZipFile writepy10829840
Ref: 11ff10829840
Node: ZipInfo objects10833134
Ref: library/zipfile id410833312
Ref: 2f3210833312
Ref: library/zipfile zipinfo-objects10833312
Ref: 2f1310833312
Ref: library/zipfile zipfile ZipInfo from_file10833760
Ref: f0a10833760
Ref: library/zipfile zipfile ZipInfo is_dir10834913
Ref: f0b10834913
Ref: library/zipfile zipfile ZipInfo filename10835156
Ref: 2f3310835156
Ref: library/zipfile zipfile ZipInfo date_time10835235
Ref: 2f3410835235
Ref: library/zipfile zipfile ZipInfo compress_type10836829
Ref: 2f3510836829
Ref: library/zipfile zipfile ZipInfo comment10836916
Ref: 2f3610836916
Ref: library/zipfile zipfile ZipInfo extra10837032
Ref: 2f3710837032
Ref: library/zipfile zipfile ZipInfo create_system10837282
Ref: 2f3810837282
Ref: library/zipfile zipfile ZipInfo create_version10837400
Ref: 2f3910837400
Ref: library/zipfile zipfile ZipInfo extract_version10837510
Ref: 2f3a10837510
Ref: library/zipfile zipfile ZipInfo reserved10837636
Ref: 2f3b10837636
Ref: library/zipfile zipfile ZipInfo flag_bits10837730
Ref: 2f3c10837730
Ref: library/zipfile zipfile ZipInfo volume10837799
Ref: 2f3d10837799
Ref: library/zipfile zipfile ZipInfo internal_attr10837885
Ref: 2f3e10837885
Ref: library/zipfile zipfile ZipInfo external_attr10837945
Ref: 2f3f10837945
Ref: library/zipfile zipfile ZipInfo header_offset10838017
Ref: 2f4010838017
Ref: library/zipfile zipfile ZipInfo CRC10838116
Ref: 2f4110838116
Ref: library/zipfile zipfile ZipInfo compress_size10838207
Ref: 2f4210838207
Ref: library/zipfile zipfile ZipInfo file_size10838288
Ref: 2f1c10838288
Ref: ZipInfo objects-Footnote-110838404
Node: コマンドライン・インターフェース<4>10838472
Ref: library/zipfile command-line-interface10838655
Ref: 2f4310838655
Ref: library/zipfile zipfile-commandline10838655
Ref: 2f4410838655
Node: コマンドラインオプション<2>10839605
Ref: library/zipfile command-line-options10839732
Ref: 2f4810839732
Ref: library/zipfile cmdoption-zipfile-l10839813
Ref: 2f4710839813
Ref: library/zipfile cmdoption-zipfile-list10839838
Ref: 2f4910839838
Ref: library/zipfile cmdoption-zipfile-c10839928
Ref: 2f4510839928
Ref: library/zipfile cmdoption-zipfile-create10839977
Ref: 2f4a10839977
Ref: library/zipfile cmdoption-zipfile-e10840097
Ref: 2f4610840097
Ref: library/zipfile cmdoption-zipfile-extract10840135
Ref: 2f4b10840135
Ref: library/zipfile cmdoption-zipfile-t10840253
Ref: 2f4c10840253
Ref: library/zipfile cmdoption-zipfile-test10840278
Ref: 2f4d10840278
Ref: library/zipfile cmdoption-zipfile-metadata-encoding10840359
Ref: 2f4e10840359
Node: Decompression pitfalls10840532
Ref: library/zipfile decompression-pitfalls10840691
Ref: 2f4f10840691
Node: From file itself10840974
Ref: library/zipfile from-file-itself10841081
Ref: 2f5010841081
Node: File system limitations10841260
Ref: library/zipfile file-system-limitations10841397
Ref: 2f5110841397
Node: Resources limitations10841699
Ref: library/zipfile resources-limitations10841832
Ref: 2f5210841832
Ref: library/zipfile zipfile-resources-limitations10841832
Ref: 2f5310841832
Ref: Resources limitations-Footnote-110842119
Node: Interruption10842166
Ref: library/zipfile interruption10842307
Ref: 2f5410842307
Node: Default behaviors of extraction10842513
Ref: library/zipfile default-behaviors-of-extraction10842624
Ref: 2f5510842624
Node: tarfile --- tar アーカイブファイルの読み書き10842889
Ref: library/tarfile doc10843066
Ref: 2f5610843066
Ref: library/tarfile module-tarfile10843066
Ref: e410843066
Ref: library/tarfile tarfile-read-and-write-tar-archive-files10843066
Ref: 2f5710843066
Ref: library/tarfile translation-repo10843066
Ref: 2f5810843066
Ref: library/tarfile tarfile open10845557
Ref: 107b10845557
Ref: library/tarfile tarfile is_tarfile10855079
Ref: 1c3810855079
Ref: library/tarfile tarfile TarError10855488
Ref: 2f5d10855488
Ref: library/tarfile tarfile ReadError10855569
Ref: 1cac10855569
Ref: library/tarfile tarfile CompressionError10855732
Ref: 2f5b10855732
Ref: library/tarfile tarfile StreamError10855918
Ref: 2f5e10855918
Ref: library/tarfile tarfile ExtractError10856085
Ref: 2f5f10856085
Ref: library/tarfile tarfile HeaderError10856328
Ref: 2f6010856328
Ref: library/tarfile tarfile FilterError10856495
Ref: 2f6210856495
Ref: library/tarfile tarfile FilterError tarinfo10856590
Ref: 2f6410856590
Ref: library/tarfile tarfile AbsolutePathError10856729
Ref: 2f6610856729
Ref: library/tarfile tarfile OutsideDestinationError10856834
Ref: 2f6710856834
Ref: library/tarfile tarfile SpecialFileError10856962
Ref: 2f6810856962
Ref: library/tarfile tarfile AbsoluteLinkError10857080
Ref: 2f6910857080
Ref: library/tarfile tarfile LinkOutsideDestinationError10857192
Ref: 2f6a10857192
Ref: library/tarfile tarfile LinkFallbackError10857340
Ref: 29f10857340
Ref: library/tarfile tarfile ENCODING10857760
Ref: 2f6b10857760
Ref: library/tarfile tarfile REGTYPE10857959
Ref: 2f6c10857959
Ref: library/tarfile tarfile AREGTYPE10857990
Ref: 2f6d10857990
Ref: library/tarfile tarfile LNKTYPE10858062
Ref: 2f6f10858062
Ref: library/tarfile tarfile SYMTYPE10858142
Ref: 2f7010858142
Ref: library/tarfile tarfile CHRTYPE10858214
Ref: 2f7110858214
Ref: library/tarfile tarfile BLKTYPE10858297
Ref: 2f7210858297
Ref: library/tarfile tarfile DIRTYPE10858376
Ref: 2f7310858376
Ref: library/tarfile tarfile FIFOTYPE10858444
Ref: 2f7410858444
Ref: library/tarfile tarfile CONTTYPE10858523
Ref: 2f7510858523
Ref: library/tarfile tarfile GNUTYPE_LONGNAME10858598
Ref: 2f7610858598
Ref: library/tarfile tarfile GNUTYPE_LONGLINK10858682
Ref: 2f7710858682
Ref: library/tarfile tarfile GNUTYPE_SPARSE10858766
Ref: 2f7810858766
Ref: library/tarfile tarfile USTAR_FORMAT10859049
Ref: 2f7a10859049
Ref: library/tarfile tarfile GNU_FORMAT10859135
Ref: 2f7b10859135
Ref: library/tarfile tarfile PAX_FORMAT10859206
Ref: 2f7c10859206
Ref: library/tarfile tarfile DEFAULT_FORMAT10859288
Ref: 2f7d10859288
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-110860372
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-210860439
Node: TarFile オブジェクト10860511
Ref: library/tarfile id110860667
Ref: 2f7e10860667
Ref: library/tarfile tarfile-objects10860667
Ref: 2f5a10860667
Ref: library/tarfile tarfile TarFile10862002
Ref: 142d10862002
Ref: library/tarfile tarfile TarFile open10866356
Ref: 1c3910866356
Ref: library/tarfile tarfile TarFile getmember10866606
Ref: 1c4d10866606
Ref: library/tarfile tarfile TarFile getmembers10867028
Ref: 107d10867028
Ref: library/tarfile tarfile TarFile getnames10867265
Ref: 2f8010867265
Ref: library/tarfile tarfile TarFile list10867457
Ref: 107c10867457
Ref: library/tarfile tarfile TarFile next10867996
Ref: 2f8110867996
Ref: library/tarfile tarfile TarFile extractall10868320
Ref: 29d10868320
Ref: library/tarfile tarfile TarFile extract10870654
Ref: 29e10870654
Ref: library/tarfile tarfile TarFile extractfile10872283
Ref: 2f8210872283
Ref: library/tarfile tarfile TarFile errorlevel10873226
Ref: 2a010873226
Ref: library/tarfile tarfile TarFile extraction_filter10874157
Ref: 2f8310874157
Ref: library/tarfile tarfile TarFile add10875441
Ref: df210875441
Ref: library/tarfile tarfile TarFile addfile10876778
Ref: 1a0510876778
Ref: library/tarfile tarfile TarFile gettarinfo10877299
Ref: 2f8410877299
Ref: library/tarfile tarfile TarFile close10878779
Ref: 2f8710878779
Ref: library/tarfile tarfile TarFile pax_headers10878978
Ref: 2f8810878978
Node: TarInfo オブジェクト10879120
Ref: library/tarfile id210879303
Ref: 2f8910879303
Ref: library/tarfile tarinfo-objects10879303
Ref: 2f6510879303
Ref: library/tarfile tarfile TarInfo10880694
Ref: 142e10880694
Ref: library/tarfile tarfile TarInfo frombuf10880803
Ref: 2f6110880803
Ref: library/tarfile tarfile TarInfo fromtarfile10881080
Ref: 2f8b10881080
Ref: library/tarfile tarfile TarInfo tobuf10881334
Ref: 2f8c10881334
Ref: library/tarfile tarfile TarInfo name10881881
Ref: 2f8610881881
Ref: library/tarfile tarfile TarInfo size10881973
Ref: 2f8510881973
Ref: library/tarfile tarfile TarInfo mtime10882059
Ref: 2f8d10882059
Ref: library/tarfile tarfile TarInfo mode10882426
Ref: 2f9010882426
Ref: library/tarfile tarfile TarInfo type10882705
Ref: 2f6e10882705
Ref: library/tarfile tarfile TarInfo linkname10883249
Ref: 2f9110883249
Ref: library/tarfile tarfile TarInfo uid10883696
Ref: 2f9210883696
Ref: library/tarfile tarfile TarInfo gid10884006
Ref: 2f9310884006
Ref: library/tarfile tarfile TarInfo uname10884316
Ref: 2f9410884316
Ref: library/tarfile tarfile TarInfo gname10884628
Ref: 2f9510884628
Ref: library/tarfile tarfile TarInfo chksum10884940
Ref: 2f9610884940
Ref: library/tarfile tarfile TarInfo devmajor10885011
Ref: 2f9710885011
Ref: library/tarfile tarfile TarInfo devminor10885088
Ref: 2f9810885088
Ref: library/tarfile tarfile TarInfo offset10885165
Ref: 2f9910885165
Ref: library/tarfile tarfile TarInfo offset_data10885247
Ref: 2f9a10885247
Ref: library/tarfile tarfile TarInfo sparse10885335
Ref: 2f9b10885335
Ref: library/tarfile tarfile TarInfo pax_headers10885399
Ref: 2f9c10885399
Ref: library/tarfile tarfile TarInfo replace10885537
Ref: 2f8a10885537
Ref: library/tarfile tarfile TarInfo isfile10886271
Ref: 2f9d10886271
Ref: library/tarfile tarfile TarInfo isreg10886397
Ref: 2f9e10886397
Ref: library/tarfile tarfile TarInfo isdir10886480
Ref: 2f9f10886480
Ref: library/tarfile tarfile TarInfo issym10886589
Ref: 2fa010886589
Ref: library/tarfile tarfile TarInfo islnk10886707
Ref: 2fa110886707
Ref: library/tarfile tarfile TarInfo ischr10886816
Ref: 2fa210886816
Ref: library/tarfile tarfile TarInfo isblk10886937
Ref: 2fa310886937
Ref: library/tarfile tarfile TarInfo isfifo10887052
Ref: 2fa410887052
Ref: library/tarfile tarfile TarInfo isdev10887149
Ref: 2fa510887149
Node: Extraction filters10887336
Ref: library/tarfile extraction-filters10887538
Ref: 2fa610887538
Ref: library/tarfile tarfile-extraction-filter10887538
Ref: 69710887538
Ref: Extraction filters-Footnote-110890746
Node: Default named filters10890788
Ref: library/tarfile default-named-filters10890886
Ref: 2fa810890886
Ref: library/tarfile tarfile fully_trusted_filter10891050
Ref: 2f5910891050
Ref: library/tarfile tarfile tar_filter10891199
Ref: 2fa710891199
Ref: library/tarfile tarfile data_filter10892007
Ref: 29c10892007
Node: Filter errors10893865
Ref: library/tarfile filter-errors10894002
Ref: 2fa910894002
Ref: library/tarfile tarfile-extraction-refuse10894002
Ref: 2f6310894002
Node: Hints for further verification10894362
Ref: library/tarfile hints-for-further-verification10894510
Ref: 2faa10894510
Ref: library/tarfile tarfile-further-verification10894510
Ref: 2d7010894510
Node: Supporting older Python versions10896249
Ref: library/tarfile supporting-older-python-versions10896418
Ref: 2fab10896418
Node: Stateful extraction filter example10897978
Ref: library/tarfile stateful-extraction-filter-example10898108
Ref: 2fac10898108
Node: コマンドラインインターフェイス10898900
Ref: library/tarfile command-line-interface10899089
Ref: 2fad10899089
Ref: library/tarfile tarfile-commandline10899089
Ref: 11d110899089
Node: コマンドラインオプション<3>10900241
Ref: library/tarfile command-line-options10900362
Ref: 2fb110900362
Ref: library/tarfile cmdoption-tarfile-l10900445
Ref: 2fb010900445
Ref: library/tarfile cmdoption-tarfile-list10900470
Ref: 2fb210900470
Ref: library/tarfile cmdoption-tarfile-c10900560
Ref: 2fae10900560
Ref: library/tarfile cmdoption-tarfile-create10900609
Ref: 2fb310900609
Ref: library/tarfile cmdoption-tarfile-e10900729
Ref: 2faf10900729
Ref: library/tarfile cmdoption-tarfile-extract10900769
Ref: 2fb410900769
Ref: library/tarfile cmdoption-tarfile-t10900941
Ref: 2fb510900941
Ref: library/tarfile cmdoption-tarfile-test10900966
Ref: 2fb610900966
Ref: library/tarfile cmdoption-tarfile-v10901047
Ref: 2fb710901047
Ref: library/tarfile cmdoption-tarfile-verbose10901047
Ref: 2fb810901047
Ref: library/tarfile cmdoption-tarfile-filter10901108
Ref: 2fb910901108
Node: 使用例<16>10901343
Ref: library/tarfile examples10901561
Ref: 2fba10901561
Ref: library/tarfile tar-examples10901561
Ref: 2f5c10901561
Node: Reading examples10901651
Ref: library/tarfile reading-examples10901742
Ref: 2fbb10901742
Node: Writing examples10902928
Ref: library/tarfile writing-examples10903019
Ref: 2fbc10903019
Node: サポートしている tar フォーマット10904234
Ref: library/tarfile supported-tar-formats10904433
Ref: 2fbd10904433
Ref: library/tarfile tar-formats10904433
Ref: 2f7910904433
Node: Unicode に関する問題10906936
Ref: library/tarfile tar-unicode10907113
Ref: 2f7f10907113
Ref: library/tarfile unicode-issues10907113
Ref: 2fbe10907113
Node: ファイルフォーマット10909854
Ref: library/fileformats doc10910027
Ref: 2fc010910027
Ref: library/fileformats file-formats10910027
Ref: 2fc110910027
Ref: library/fileformats fileformats10910027
Ref: 2fc210910027
Ref: library/fileformats translation-repo10910027
Ref: 2fc310910027
Node: csv --- CSV ファイルの読み書き10910715
Ref: library/csv doc10910880
Ref: 2fc410910880
Ref: library/csv csv-csv-file-reading-and-writing10910880
Ref: 2fc510910880
Ref: library/csv module-csv10910880
Ref: 2d10910880
Ref: csv --- CSV ファイルの読み書き-Footnote-110913303
Ref: csv --- CSV ファイルの読み書き-Footnote-210913366
Ref: csv --- CSV ファイルの読み書き-Footnote-310913425
Node: モジュールコンテンツ10913467
Ref: library/csv csv-contents10913626
Ref: 2fc610913626
Ref: library/csv module-contents10913626
Ref: 2fc710913626
Ref: library/csv csv reader10913752
Ref: 6ae10913752
Ref: library/csv csv writer10915680
Ref: 6af10915680
Ref: library/csv csv register_dialect10918042
Ref: 199910918042
Ref: library/csv csv unregister_dialect10918633
Ref: 1bf110918633
Ref: library/csv csv get_dialect10918876
Ref: 1bf010918876
Ref: library/csv csv list_dialects10919146
Ref: 1bf210919146
Ref: library/csv csv field_size_limit10919250
Ref: 1bef10919250
Ref: library/csv csv DictReader10919570
Ref: bdc10919570
Ref: library/csv csv DictWriter10921874
Ref: 141b10921874
Ref: library/csv csv Dialect10923911
Ref: 188d10923911
Ref: library/csv csv excel10924854
Ref: 2fcb10924854
Ref: library/csv csv excel_tab10925107
Ref: 2fcc10925107
Ref: library/csv csv unix_dialect10925378
Ref: 141a10925378
Ref: library/csv csv Sniffer10925789
Ref: 2fcd10925789
Ref: library/csv csv Sniffer sniff10926032
Ref: 2fce10926032
Ref: library/csv csv Sniffer has_header10926432
Ref: 1cb410926432
Ref: library/csv csv-constants10927640
Ref: 2fcf10927640
Ref: library/csv csv QUOTE_ALL10927695
Ref: 2fd010927695
Ref: library/csv csv QUOTE_MINIMAL10927859
Ref: 2fd110927859
Ref: library/csv csv QUOTE_NONNUMERIC10928178
Ref: 19a710928178
Ref: library/csv csv QUOTE_NONE10928863
Ref: 2fd210928863
Ref: library/csv csv QUOTE_NOTNULL10929512
Ref: 6ac10929512
Ref: library/csv csv QUOTE_STRINGS10929955
Ref: 6ad10929955
Ref: library/csv csv Error10930483
Ref: 2fca10930483
Ref: モジュールコンテンツ-Footnote-110930642
Ref: モジュールコンテンツ-Footnote-210930985
Node: Dialect クラスと書式化パラメータ10931328
Ref: library/csv csv-fmt-params10931521
Ref: 2fc910931521
Ref: library/csv dialects-and-formatting-parameters10931521
Ref: 2fd310931521
Ref: library/csv csv Dialect delimiter10932320
Ref: 2fd410932320
Ref: library/csv csv Dialect doublequote10932501
Ref: 2fd510932501
Ref: library/csv csv Dialect escapechar10933198
Ref: 2fd610933198
Ref: library/csv csv Dialect lineterminator10933930
Ref: 2fd710933930
Ref: library/csv csv Dialect quotechar10934405
Ref: 2fd810934405
Ref: library/csv csv Dialect quoting10934918
Ref: 2fd910934918
Ref: library/csv csv Dialect skipinitialspace10935230
Ref: 2fda10935230
Ref: library/csv csv Dialect strict10935515
Ref: 2fdb10935515
Node: reader オブジェクト10935699
Ref: library/csv id310935887
Ref: 2fdc10935887
Ref: library/csv reader-objects10935887
Ref: 2fc810935887
Ref: library/csv csv csvreader __next__10936166
Ref: 2fdd10936166
Ref: library/csv csv csvreader dialect10936706
Ref: 2fde10936706
Ref: library/csv csv csvreader line_num10936822
Ref: 2fdf10936822
Ref: library/csv csv DictReader fieldnames10937138
Ref: 2fe010937138
Node: writer オブジェクト10937402
Ref: library/csv writer-objects10937559
Ref: 2fe110937559
Ref: library/csv csv csvwriter writerow10938479
Ref: fed10938479
Ref: library/csv csv csvwriter writerows10938917
Ref: 2fe210938917
Ref: library/csv csv csvwriter dialect10939269
Ref: 2fe310939269
Ref: library/csv csv DictWriter writeheader10939471
Ref: 141c10939471
Node: 使用例<17>10939996
Ref: library/csv csv-examples10940119
Ref: 2fe410940119
Ref: library/csv examples10940119
Ref: 2fe510940119
Node: configparser --- 設定ファイルのパーサー10942400
Ref: library/configparser doc10942612
Ref: 2fe610942612
Ref: library/configparser configparser-configuration-file-parser10942612
Ref: 2fe710942612
Ref: library/configparser module-configparser10942612
Ref: 2610942612
Ref: library/configparser translation-repo10942612
Ref: 2fe810942612
Ref: configparser --- 設定ファイルのパーサー-Footnote-110944316
Node: クイックスタート10944388
Ref: library/configparser quick-start10944541
Ref: 2fe910944541
Ref: クイックスタート-Footnote-110948567
Ref: クイックスタート-Footnote-210948805
Node: サポートされるデータ型10949043
Ref: library/configparser supported-datatypes10949214
Ref: 2fed10949214
Ref: サポートされるデータ型-Footnote-110950738
Ref: サポートされるデータ型-Footnote-210950976
Node: 代替値10951214
Ref: library/configparser fallback-values10951404
Ref: 2ff110951404
Node: サポートするINI ファイルの構造10952963
Ref: library/configparser supported-ini-file-structure10953136
Ref: 2fea10953136
Ref: サポートするINI ファイルの構造-Footnote-110955955
Ref: サポートするINI ファイルの構造-Footnote-210956193
Ref: サポートするINI ファイルの構造-Footnote-310956431
Ref: サポートするINI ファイルの構造-Footnote-410956669
Ref: サポートするINI ファイルの構造-Footnote-510956907
Node: Unnamed Sections10957145
Ref: library/configparser id1010957321
Ref: 2ff310957321
Ref: library/configparser unnamed-sections10957321
Ref: 2ff410957321
Node: 値の補間10957801
Ref: library/configparser interpolation-of-values10957973
Ref: 2ff510957973
Ref: library/configparser configparser BasicInterpolation10958260
Ref: 92d10958260
Ref: library/configparser configparser ExtendedInterpolation10959677
Ref: 92e10959677
Ref: 値の補間-Footnote-110961307
Node: マップ型プロトコルアクセス10961545
Ref: library/configparser mapping-protocol-access10961755
Ref: 2feb10961755
Ref: マップ型プロトコルアクセス-Footnote-110965206
Node: パーサーの振る舞いをカスタマイズする10965444
Ref: library/configparser customizing-parser-behaviour10965668
Ref: 2fec10965668
Ref: library/configparser configparser ConfigParser BOOLEAN_STATES10977367
Ref: 2ff810977367
Ref: library/configparser configparser ConfigParser SECTCRE10979769
Ref: 2ff210979769
Node: レガシーな API の例10981228
Ref: library/configparser legacy-api-examples10981444
Ref: 2ff910981444
Node: ConfigParser オブジェクト10985344
Ref: library/configparser configparser-objects10985540
Ref: 2ffa10985540
Ref: library/configparser id1310985540
Ref: 2ffb10985540
Ref: library/configparser configparser ConfigParser10985619
Ref: 4de10985619
Ref: library/configparser configparser ConfigParser defaults10991439
Ref: 2ffe10991439
Ref: library/configparser configparser ConfigParser sections10991571
Ref: 2fff10991571
Ref: library/configparser configparser ConfigParser add_section10991744
Ref: 148910991744
Ref: library/configparser configparser ConfigParser has_section10992436
Ref: 300010992436
Ref: library/configparser configparser ConfigParser options10992623
Ref: 300110992623
Ref: library/configparser configparser ConfigParser has_option10992780
Ref: 300210992780
Ref: library/configparser configparser ConfigParser read10993176
Ref: 168610993176
Ref: library/configparser configparser ConfigParser read_file10995408
Ref: 72a10995408
Ref: library/configparser configparser ConfigParser read_string10995962
Ref: 2ff710995962
Ref: library/configparser configparser ConfigParser read_dict10996410
Ref: 2ff610996410
Ref: library/configparser configparser ConfigParser get10997248
Ref: 148710997248
Ref: library/configparser configparser ConfigParser getint10998233
Ref: 2fef10998233
Ref: library/configparser configparser ConfigParser getfloat10998561
Ref: 2ff010998561
Ref: library/configparser configparser ConfigParser getboolean10998871
Ref: 2fee10998871
Ref: library/configparser configparser ConfigParser items10999602
Ref: 300310999602
Ref: library/configparser configparser ConfigParser set11000399
Ref: 148811000399
Ref: library/configparser configparser ConfigParser write11000831
Ref: 1e011000831
Ref: library/configparser configparser ConfigParser remove_option11001832
Ref: 300511001832
Ref: library/configparser configparser ConfigParser remove_section11002248
Ref: 300611002248
Ref: library/configparser configparser ConfigParser optionxform11002516
Ref: 2ffc11002516
Ref: library/configparser configparser UNNAMED_SECTION11003718
Ref: 17fa11003718
Ref: library/configparser configparser MAX_INTERPOLATION_DEPTH11003894
Ref: 300711003894
Node: RawConfigParser オブジェクト11004132
Ref: library/configparser id1511004311
Ref: 300811004311
Ref: library/configparser rawconfigparser-objects11004311
Ref: 300911004311
Ref: library/configparser configparser RawConfigParser11004396
Ref: 116a11004396
Ref: library/configparser configparser RawConfigParser add_section11005875
Ref: 300a11005875
Ref: library/configparser configparser RawConfigParser set11006719
Ref: 300c11006719
Node: 例外<9>11007849
Ref: library/configparser exceptions11007988
Ref: 300d11007988
Ref: library/configparser configparser Error11008021
Ref: 300e11008021
Ref: library/configparser configparser NoSectionError11008115
Ref: 300411008115
Ref: library/configparser configparser DuplicateSectionError11008247
Ref: 148a11008247
Ref: library/configparser configparser DuplicateOptionError11008660
Ref: 148b11008660
Ref: library/configparser configparser NoOptionError11009105
Ref: 300f11009105
Ref: library/configparser configparser InterpolationError11009281
Ref: 301011009281
Ref: library/configparser configparser InterpolationDepthError11009426
Ref: 301111009426
Ref: library/configparser configparser InterpolationMissingOptionError11009715
Ref: 301211009715
Ref: library/configparser configparser InterpolationSyntaxError11009938
Ref: 301311009938
Ref: library/configparser configparser MissingSectionHeaderError11010185
Ref: 301411010185
Ref: library/configparser configparser ParsingError11010364
Ref: 72911010364
Ref: library/configparser configparser MultilineContinuationError11010698
Ref: 2ffd11010698
Ref: library/configparser configparser UnnamedSectionDisabledError11010885
Ref: 300b11010885
Ref: library/configparser configparser InvalidWriteError11011078
Ref: 1e111011078
Node: tomllib --- TOML ファイルの解析11011522
Ref: library/tomllib doc11011732
Ref: 301511011732
Ref: library/tomllib module-tomllib11011732
Ref: 10311011732
Ref: library/tomllib tomllib-parse-toml-files11011732
Ref: 301611011732
Ref: library/tomllib translation-repo11011732
Ref: 301711011732
Ref: library/tomllib tomllib load11012966
Ref: 301811012966
Ref: library/tomllib tomllib loads11013994
Ref: 198c11013994
Ref: library/tomllib tomllib TOMLDecodeError11014508
Ref: 196d11014508
Ref: library/tomllib tomllib TOMLDecodeError msg11014655
Ref: 301a11014655
Ref: library/tomllib tomllib TOMLDecodeError doc11014761
Ref: 301b11014761
Ref: library/tomllib tomllib TOMLDecodeError pos11014849
Ref: 301c11014849
Ref: library/tomllib tomllib TOMLDecodeError lineno11014940
Ref: 301d11014940
Ref: library/tomllib tomllib TOMLDecodeError colno11015013
Ref: 301e11015013
Ref: tomllib --- TOML ファイルの解析-Footnote-111015483
Ref: tomllib --- TOML ファイルの解析-Footnote-211015547
Ref: tomllib --- TOML ファイルの解析-Footnote-311015575
Ref: tomllib --- TOML ファイルの解析-Footnote-411015617
Node: 使用例<18>11015659
Ref: library/tomllib examples11015765
Ref: 301f11015765
Node: 変換表11016132
Ref: library/tomllib conversion-table11016238
Ref: 302011016238
Ref: library/tomllib toml-to-py-table11016274
Ref: 301911016274
Node: netrc --- netrc ファイルの処理11017795
Ref: library/netrc doc11018016
Ref: 302111018016
Ref: library/netrc module-netrc11018016
Ref: 9f11018016
Ref: library/netrc netrc-netrc-file-processing11018016
Ref: 302211018016
Ref: library/netrc translation-repo11018016
Ref: 302311018016
Ref: library/netrc netrc netrc11018413
Ref: 1cd611018413
Ref: library/netrc netrc NetrcParseError11020515
Ref: 302411020515
Ref: library/netrc netrc NetrcParseError msg11020768
Ref: 302511020768
Ref: library/netrc netrc NetrcParseError filename11020847
Ref: 302611020847
Ref: library/netrc netrc NetrcParseError lineno11020922
Ref: 302711020922
Ref: netrc --- netrc ファイルの処理-Footnote-111021076
Node: netrc オブジェクト11021141
Ref: library/netrc id111021239
Ref: 302811021239
Ref: library/netrc netrc-objects11021239
Ref: 302911021239
Ref: library/netrc netrc netrc authenticators11021387
Ref: 302a11021387
Ref: library/netrc netrc netrc __repr__11021843
Ref: 302b11021843
Ref: library/netrc netrc netrc hosts11022215
Ref: 302c11022215
Ref: library/netrc netrc netrc macros11022474
Ref: 302d11022474
Node: plistlib --- Apple plist ファイルを生成・解析する11022585
Ref: library/plistlib doc11022759
Ref: 302e11022759
Ref: library/plistlib module-plistlib11022759
Ref: b011022759
Ref: library/plistlib plistlib-generate-and-parse-apple-plist-files11022759
Ref: 302f11022759
Ref: library/plistlib translation-repo11022759
Ref: 303011022759
Ref: library/plistlib plistlib load11024692
Ref: b4c11024692
Ref: library/plistlib plistlib loads11026195
Ref: b4d11026195
Ref: library/plistlib plistlib dump11026643
Ref: b4e11026643
Ref: library/plistlib plistlib dumps11028314
Ref: b4f11028314
Ref: library/plistlib plistlib UID11028713
Ref: c1a11028713
Ref: library/plistlib plistlib UID data11028974
Ref: 303111028974
Ref: library/plistlib plistlib FMT_XML11029159
Ref: 117f11029159
Ref: library/plistlib plistlib FMT_BINARY11029265
Ref: 118011029265
Ref: library/plistlib plistlib InvalidFileException11029427
Ref: 1d5811029427
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-111029615
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-211029683
Node: 使用例<19>11029782
Ref: library/plistlib examples11029893
Ref: 303211029893
Node: 暗号関連のサービス11030759
Ref: library/crypto doc11030953
Ref: 303311030953
Ref: library/crypto crypto11030953
Ref: 303411030953
Ref: library/crypto cryptographic-services11030953
Ref: 303511030953
Ref: library/crypto translation-repo11030953
Ref: 303611030953
Node: hashlib --- セキュアハッシュとメッセージダイジェスト11031693
Ref: library/hashlib doc11031904
Ref: 303711031904
Ref: library/hashlib hashlib-secure-hashes-and-message-digests11031904
Ref: 303811031904
Ref: library/hashlib module-hashlib11031904
Ref: 6c11031904
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-111032904
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-211032971
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-311033028
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-411033078
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-511033148
Node: ハッシュアルゴリズム11033207
Ref: library/hashlib hash-algorithms11033364
Ref: 303911033364
Ref: library/hashlib id111033364
Ref: 303a11033364
Ref: library/hashlib hashlib-usedforsecurity11035677
Ref: 304311035677
Ref: ハッシュアルゴリズム-Footnote-111036383
Ref: ハッシュアルゴリズム-Footnote-211036491
Node: 使用法11036538
Ref: library/hashlib usage11036725
Ref: 304411036725
Node: コンストラクタ11037485
Ref: library/hashlib constructors11037648
Ref: 304511037648
Ref: library/hashlib hashlib new11037704
Ref: 1d8c11037704
Ref: library/hashlib hashlib md511038344
Ref: 188911038344
Ref: library/hashlib hashlib sha111038406
Ref: 303e11038406
Ref: library/hashlib hashlib sha22411038469
Ref: 303f11038469
Ref: library/hashlib hashlib sha25611038534
Ref: 191011038534
Ref: library/hashlib hashlib sha38411038599
Ref: 304011038599
Ref: library/hashlib hashlib sha51211038664
Ref: 304111038664
Ref: library/hashlib hashlib sha3_22411038729
Ref: ea411038729
Ref: library/hashlib hashlib sha3_25611038796
Ref: ea511038796
Ref: library/hashlib hashlib sha3_38411038863
Ref: ea611038863
Ref: library/hashlib hashlib sha3_51211038930
Ref: ea711038930
Node: 属性11039095
Ref: library/hashlib attributes11039261
Ref: 304611039261
Ref: library/hashlib hashlib algorithms_guaranteed11039352
Ref: 158f11039352
Ref: library/hashlib hashlib algorithms_available11039898
Ref: 159011039898
Node: Hash Objects11040372
Ref: library/hashlib hash-objects11040550
Ref: 304711040550
Ref: library/hashlib hashlib hash digest_size11040722
Ref: 304811040722
Ref: library/hashlib hashlib hash block_size11040807
Ref: 304911040807
Ref: library/hashlib hashlib hash name11041005
Ref: 114d11041005
Ref: library/hashlib hashlib hash update11041579
Ref: 303b11041579
Ref: library/hashlib hashlib hash digest11041966
Ref: 303c11041966
Ref: library/hashlib hashlib hash hexdigest11042255
Ref: 303d11042255
Ref: library/hashlib hashlib hash copy11042515
Ref: 304a11042515
Node: SHAKE 可変長ダイジェスト11042776
Ref: library/hashlib shake-variable-length-digests11042978
Ref: 304b11042978
Ref: library/hashlib hashlib shake_12811043056
Ref: ea811043056
Ref: library/hashlib hashlib shake_25611043124
Ref: ea911043124
Ref: library/hashlib hashlib shake digest11043453
Ref: 1e7611043453
Ref: library/hashlib hashlib shake hexdigest11043733
Ref: 1e7711043733
Node: ファイルのハッシュ化11044161
Ref: library/hashlib file-hashing11044360
Ref: 304c11044360
Ref: library/hashlib hashlib file_digest11044531
Ref: 85411044531
Node: 鍵導出11046237
Ref: library/hashlib key-derivation11046409
Ref: 304d11046409
Ref: library/hashlib hashlib pbkdf2_hmac11046854
Ref: 73311046854
Ref: library/hashlib hashlib scrypt11048897
Ref: e3c11048897
Ref: 鍵導出-Footnote-111049802
Ref: 鍵導出-Footnote-211049864
Ref: 鍵導出-Footnote-311049951
Ref: 鍵導出-Footnote-411050062
Node: BLAKE211050121
Ref: library/hashlib blake211050254
Ref: 304e11050254
Ref: library/hashlib hashlib-blake211050254
Ref: 304f11050254
Ref: BLAKE2-Footnote-111051009
Ref: BLAKE2-Footnote-211051040
Ref: BLAKE2-Footnote-311051099
Node: ハッシュオブジェクトの作成11051177
Ref: library/hashlib creating-hash-objects11051277
Ref: 305011051277
Ref: library/hashlib hashlib blake2b11051483
Ref: 85211051483
Ref: library/hashlib hashlib blake2s11051720
Ref: 85311051720
Ref: ハッシュオブジェクトの作成-Footnote-111054900
Node: 定数<5>11054951
Ref: library/hashlib constants11055073
Ref: 305111055073
Ref: library/hashlib hashlib blake2b SALT_SIZE11055106
Ref: 305211055106
Ref: library/hashlib hashlib blake2s SALT_SIZE11055140
Ref: 305311055140
Ref: library/hashlib hashlib blake2b PERSON_SIZE11055245
Ref: 305411055245
Ref: library/hashlib hashlib blake2s PERSON_SIZE11055281
Ref: 305511055281
Ref: library/hashlib hashlib blake2b MAX_KEY_SIZE11055391
Ref: 305611055391
Ref: library/hashlib hashlib blake2s MAX_KEY_SIZE11055428
Ref: 305711055428
Ref: library/hashlib hashlib blake2b MAX_DIGEST_SIZE11055482
Ref: 305811055482
Ref: library/hashlib hashlib blake2s MAX_DIGEST_SIZE11055522
Ref: 305911055522
Node: 使用例<20>11055630
Ref: library/hashlib examples11055728
Ref: 305a11055728
Node: 簡単なハッシュ化11055922
Ref: library/hashlib simple-hashing11056033
Ref: 305b11056033
Node: Using different digest sizes11057499
Ref: library/hashlib using-different-digest-sizes11057632
Ref: 305c11057632
Node: Keyed hashing11058877
Ref: library/hashlib keyed-hashing11059004
Ref: 305d11059004
Ref: Keyed hashing-Footnote-111061011
Node: Randomized hashing11061054
Ref: library/hashlib randomized-hashing11061168
Ref: 305e11061168
Ref: Randomized hashing-Footnote-111063770
Ref: Randomized hashing-Footnote-211063822
Node: Personalization11063857
Ref: library/hashlib personalization11063976
Ref: 305f11063976
Ref: Personalization-Footnote-111065994
Node: ツリーモード11066064
Ref: library/hashlib tree-mode11066156
Ref: 306011066156
Node: クレジット11067480
Ref: library/hashlib credits11067560
Ref: 306111067560
Ref: library/hashlib hashlib-seealso11069298
Ref: 304211069298
Ref: クレジット-Footnote-111070435
Ref: クレジット-Footnote-211070466
Ref: クレジット-Footnote-311070527
Ref: クレジット-Footnote-411070605
Ref: クレジット-Footnote-511070642
Ref: クレジット-Footnote-611070685
Node: hmac --- メッセージ認証のための鍵付きハッシュ化11070728
Ref: library/hmac doc11071014
Ref: 306211071014
Ref: library/hmac hmac-keyed-hashing-for-message-authentication11071014
Ref: 306311071014
Ref: library/hmac module-hmac11071014
Ref: 6e11071014
Ref: library/hmac translation-repo11071014
Ref: 306411071014
Ref: library/hmac hmac new11071503
Ref: c9a11071503
Ref: library/hmac hmac digest11072477
Ref: d3611072477
Ref: library/hmac hmac HMAC11073211
Ref: d3711073211
Ref: library/hmac hmac HMAC update11073313
Ref: 114f11073313
Ref: library/hmac hmac HMAC digest11073818
Ref: 306511073818
Ref: library/hmac hmac HMAC hexdigest11074485
Ref: 306611074485
Ref: library/hmac hmac HMAC copy11075083
Ref: 17f211075083
Ref: library/hmac hmac HMAC digest_size11075448
Ref: 115211075448
Ref: library/hmac hmac HMAC block_size11075545
Ref: 115011075545
Ref: library/hmac hmac HMAC name11075696
Ref: 115111075696
Ref: library/hmac hmac compare_digest11076055
Ref: 12e411076055
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-111077219
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-211077283
Node: secrets --- 機密を扱うために安全な乱数を生成する11077342
Ref: library/secrets doc11077547
Ref: 306711077547
Ref: library/secrets module-secrets11077547
Ref: c511077547
Ref: library/secrets secrets-generate-secure-random-numbers-for-managing-secrets11077547
Ref: 306811077547
Ref: library/secrets translation-repo11077547
Ref: 306911077547
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-111078404
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-211078471
Node: 乱数11078513
Ref: library/secrets random-numbers11078652
Ref: 306a11078652
Ref: library/secrets secrets SystemRandom11078802
Ref: 306b11078802
Ref: library/secrets secrets choice11079063
Ref: 306c11079063
Ref: library/secrets secrets randbelow11079191
Ref: 306d11079191
Ref: library/secrets secrets randbits11079336
Ref: 306e11079336
Node: トークンの生成11079445
Ref: library/secrets generating-tokens11079611
Ref: 306f11079611
Ref: library/secrets secrets token_bytes11079826
Ref: 2bd911079826
Ref: library/secrets secrets token_hex11080136
Ref: 1b8511080136
Ref: library/secrets secrets token_urlsafe11080493
Ref: 307111080493
Node: トークンは何バイト使うべきか？11080956
Ref: library/secrets how-many-bytes-should-tokens-use11081059
Ref: 307211081059
Ref: library/secrets secrets DEFAULT_ENTROPY11081983
Ref: 307011081983
Ref: トークンは何バイト使うべきか？-Footnote-111082245
Node: その他の関数11082302
Ref: library/secrets other-functions11082501
Ref: 307311082501
Ref: library/secrets secrets compare_digest11082552
Ref: 307411082552
Ref: その他の関数-Footnote-111083024
Node: レシピとベストプラクティス11083081
Ref: library/secrets recipes-and-best-practices11083250
Ref: 307511083250
Ref: レシピとベストプラクティス-Footnote-111085215
Ref: レシピとベストプラクティス-Footnote-211085271
Node: 汎用オペレーティングシステムサービス11085301
Ref: library/allos doc11085525
Ref: 307611085525
Ref: library/allos allos11085525
Ref: 307711085525
Ref: library/allos generic-operating-system-services11085525
Ref: 307811085525
Ref: library/allos translation-repo11085525
Ref: 307911085525
Node: os --- 雑多なオペレーティングシステムインターフェース11087083
Ref: library/os doc11087305
Ref: 307a11087305
Ref: library/os module-os11087305
Ref: a511087305
Ref: library/os os-miscellaneous-operating-system-interfaces11087305
Ref: 307b11087305
Ref: library/os os error11090065
Ref: 307d11090065
Ref: library/os os name11090172
Ref: 307e11090172
Ref: library/os os-filenames11090744
Ref: 2fbf11090744
Ref: os --- 雑多なオペレーティングシステムインターフェース-Footnote-111091173
Node: ファイル名、コマンドライン引数、および環境変数11091235
Ref: library/os file-names-command-line-arguments-and-environment-variables11091443
Ref: 307f11091443
Ref: library/os filesystem-encoding11091443
Ref: 2cb111091443
Node: Python UTF-8 Mode11093305
Ref: library/os python-utf-8-mode11093555
Ref: 308011093555
Ref: library/os utf8-mode11093555
Ref: 86711093555
Ref: Python UTF-8 Mode-Footnote-111096407
Ref: Python UTF-8 Mode-Footnote-211096449
Node: プロセスのパラメーター11096491
Ref: library/os os-procinfo11096711
Ref: 308111096711
Ref: library/os process-parameters11096711
Ref: 308211096711
Ref: library/os os ctermid11096964
Ref: 308311096964
Ref: library/os os environ11097125
Ref: 25b11097125
Ref: library/os os environb11099506
Ref: 25c11099506
Ref: library/os os reload_environ11100152
Ref: 25a11100152
Ref: library/os os fsencode11101223
Ref: e5311101223
Ref: library/os os fsdecode11101776
Ref: e5211101776
Ref: library/os os fspath11102327
Ref: e5111102327
Ref: library/os os PathLike11102873
Ref: e4f11102873
Ref: library/os os PathLike __fspath__11103086
Ref: e5011103086
Ref: library/os os getenv11103411
Ref: 308411103411
Ref: library/os os getenvb11104328
Ref: 143311104328
Ref: library/os os get_exec_path11105134
Ref: 308611105134
Ref: library/os os getegid11105586
Ref: 308711105586
Ref: library/os os geteuid11105855
Ref: 1bd111105855
Ref: library/os os getgid11106005
Ref: 308811106005
Ref: library/os os getgrouplist11106260
Ref: 133011106260
Ref: library/os os getgroups11106656
Ref: 308911106656
Ref: library/os os getlogin11107883
Ref: 188811107883
Ref: library/os os getpgid11108398
Ref: 308b11108398
Ref: library/os os getpgrp11108673
Ref: 308c11108673
Ref: library/os os getpid11108817
Ref: 307c11108817
Ref: library/os os getppid11109015
Ref: 1a2b11109015
Ref: library/os os getpriority11109515
Ref: 131b11109515
Ref: library/os os PRIO_PROCESS11110335
Ref: 308d11110335
Ref: library/os os PRIO_PGRP11110366
Ref: 308e11110366
Ref: library/os os PRIO_USER11110394
Ref: 308f11110394
Ref: library/os os PRIO_DARWIN_THREAD11110601
Ref: 309011110601
Ref: library/os os PRIO_DARWIN_PROCESS11110638
Ref: 309111110638
Ref: library/os os PRIO_DARWIN_BG11110676
Ref: 309211110676
Ref: library/os os PRIO_DARWIN_NONUI11110709
Ref: 309311110709
Ref: library/os os getresuid11110915
Ref: 153111110915
Ref: library/os os getresgid11111221
Ref: 153011111221
Ref: library/os os getuid11111527
Ref: 187d11111527
Ref: library/os os initgroups11111782
Ref: 153411111782
Ref: library/os os putenv11112105
Ref: 25d11112105
Ref: library/os os setegid11113568
Ref: 309511113568
Ref: library/os os seteuid11113744
Ref: 309611113744
Ref: library/os os setgid11113920
Ref: 309711113920
Ref: library/os os setgroups11114088
Ref: 308a11114088
Ref: library/os os setns11114948
Ref: 1ba011114948
Ref: library/os os setpgrp11116461
Ref: 309911116461
Ref: library/os os setpgid11116758
Ref: 309a11116758
Ref: library/os os setpriority11117104
Ref: 131c11117104
Ref: library/os os setregid11118107
Ref: 309b11118107
Ref: library/os os setresgid11118315
Ref: 153211118315
Ref: library/os os setresuid11118620
Ref: 153311118620
Ref: library/os os setreuid11118922
Ref: 309c11118922
Ref: library/os os getsid11119130
Ref: 309d11119130
Ref: library/os os setsid11119362
Ref: 1e1611119362
Ref: library/os os setuid11119588
Ref: 309e11119588
Ref: library/os os strerror11119753
Ref: 309f11119753
Ref: library/os os supports_bytes_environ11120055
Ref: 143211120055
Ref: library/os os umask11120266
Ref: 30a011120266
Ref: library/os os uname11120501
Ref: 133211120501
Ref: library/os os uname_result11121355
Ref: 1b6d11121355
Ref: library/os os uname_result sysname11121796
Ref: 30a111121796
Ref: library/os os uname_result nodename11121859
Ref: 30a211121859
Ref: library/os os uname_result release11122169
Ref: 30a311122169
Ref: library/os os uname_result version11122235
Ref: 30a411122235
Ref: library/os os uname_result machine11122301
Ref: 30a511122301
Ref: library/os os unsetenv11122362
Ref: 25e11122362
Ref: library/os os unshare11123332
Ref: 1ba111123332
Ref: library/os os-unshare-clone-flags11124035
Ref: 309811124035
Ref: library/os os CLONE_FILES11124205
Ref: 30a711124205
Ref: library/os os CLONE_FS11124235
Ref: 30a811124235
Ref: library/os os CLONE_NEWCGROUP11124262
Ref: 30a911124262
Ref: library/os os CLONE_NEWIPC11124296
Ref: 30aa11124296
Ref: library/os os CLONE_NEWNET11124327
Ref: 30ab11124327
Ref: library/os os CLONE_NEWNS11124358
Ref: 30ac11124358
Ref: library/os os CLONE_NEWPID11124388
Ref: 30ad11124388
Ref: library/os os CLONE_NEWTIME11124419
Ref: 30ae11124419
Ref: library/os os CLONE_NEWUSER11124451
Ref: 30af11124451
Ref: library/os os CLONE_NEWUTS11124483
Ref: 30b011124483
Ref: library/os os CLONE_SIGHAND11124514
Ref: 30b111124514
Ref: library/os os CLONE_SYSVSEM11124546
Ref: 30b211124546
Ref: library/os os CLONE_THREAD11124578
Ref: 30b311124578
Ref: library/os os CLONE_VM11124609
Ref: 30b411124609
Ref: プロセスのパラメーター-Footnote-111124673
Ref: プロセスのパラメーター-Footnote-211124715
Ref: プロセスのパラメーター-Footnote-311124757
Ref: プロセスのパラメーター-Footnote-411124802
Ref: プロセスのパラメーター-Footnote-511124852
Ref: プロセスのパラメーター-Footnote-611124897
Ref: プロセスのパラメーター-Footnote-711124944
Node: ファイルオブジェクトの生成11124991
Ref: library/os file-object-creation11125224
Ref: 30b511125224
Ref: library/os os-newstreams11125224
Ref: 30b611125224
Ref: library/os os fdopen11125506
Ref: 23dd11125506
Node: ファイル記述子の操作11125904
Ref: library/os file-descriptor-operations11126137
Ref: 30b711126137
Ref: library/os os-fd-ops11126137
Ref: 30b811126137
Ref: library/os os close11127310
Ref: d6f11127310
Ref: library/os os closerange11127892
Ref: 30b911127892
Ref: library/os os copy_file_range11128257
Ref: 191611128257
Ref: library/os os device_encoding11129968
Ref: 1c9211129968
Ref: library/os os dup11130517
Ref: 1e1e11130517
Ref: library/os os dup211131043
Ref: d5e11131043
Ref: library/os os fchmod11131695
Ref: 52a11131695
Ref: library/os os fchown11132386
Ref: f8e11132386
Ref: library/os os fdatasync11133103
Ref: f8f11133103
Ref: library/os os fpathconf11133359
Ref: 30bb11133359
Ref: library/os os fstat11134585
Ref: f9011134585
Ref: library/os os fstatvfs11134871
Ref: f9111134871
Ref: library/os os fsync11135188
Ref: f9211135188
Ref: library/os os ftruncate11135776
Ref: f9311135776
Ref: library/os os get_blocking11136309
Ref: 103d11136309
Ref: library/os os grantpt11137024
Ref: 1a6011137024
Ref: library/os os isatty11137409
Ref: 1c9111137409
Ref: library/os os lockf11137671
Ref: 132f11137671
Ref: library/os os F_LOCK11138385
Ref: 30be11138385
Ref: library/os os F_TLOCK11138410
Ref: 30bf11138410
Ref: library/os os F_ULOCK11138436
Ref: 30c011138436
Ref: library/os os F_TEST11138462
Ref: 30c111138462
Ref: library/os os login_tty11138631
Ref: 1b2b11138631
Ref: library/os os lseek11138991
Ref: 133311138991
Ref: library/os os SEEK_SET11139841
Ref: 14a911139841
Ref: library/os os SEEK_CUR11139868
Ref: 14aa11139868
Ref: library/os os SEEK_END11139895
Ref: 14ab11139895
Ref: library/os os SEEK_HOLE11140479
Ref: 30c211140479
Ref: library/os os SEEK_DATA11140507
Ref: 30c311140507
Ref: library/os os open11141239
Ref: f9611141239
Ref: library/os os O_RDONLY11143735
Ref: 30c411143735
Ref: library/os os O_WRONLY11143762
Ref: 30c511143762
Ref: library/os os O_RDWR11143789
Ref: 30c711143789
Ref: library/os os O_APPEND11143814
Ref: 30c811143814
Ref: library/os os O_CREAT11143841
Ref: 30c911143841
Ref: library/os os O_EXCL11143867
Ref: 2d4b11143867
Ref: library/os os O_TRUNC11143892
Ref: 30ca11143892
Ref: library/os os O_DSYNC11143992
Ref: 30cb11143992
Ref: library/os os O_RSYNC11144018
Ref: 30cc11144018
Ref: library/os os O_SYNC11144044
Ref: 30cd11144044
Ref: library/os os O_NDELAY11144069
Ref: 30ce11144069
Ref: library/os os O_NONBLOCK11144096
Ref: 103f11144096
Ref: library/os os O_NOCTTY11144125
Ref: 30cf11144125
Ref: library/os os O_CLOEXEC11144152
Ref: 128c11144152
Ref: library/os os O_BINARY11144343
Ref: 30c611144343
Ref: library/os os O_NOINHERIT11144370
Ref: 30d011144370
Ref: library/os os O_SHORT_LIVED11144400
Ref: 30d111144400
Ref: library/os os O_TEMPORARY11144432
Ref: 30d211144432
Ref: library/os os O_RANDOM11144462
Ref: 30d311144462
Ref: library/os os O_SEQUENTIAL11144489
Ref: 30d411144489
Ref: library/os os O_TEXT11144520
Ref: 30d511144520
Ref: library/os os O_EVTONLY11144610
Ref: a1f11144610
Ref: library/os os O_FSYNC11144638
Ref: a2011144638
Ref: library/os os O_SYMLINK11144664
Ref: a2111144664
Ref: library/os os O_NOFOLLOW_ANY11144692
Ref: a2211144692
Ref: library/os os O_ASYNC11144919
Ref: 30d611144919
Ref: library/os os O_DIRECT11144945
Ref: 30d711144945
Ref: library/os os O_DIRECTORY11144972
Ref: 30d811144972
Ref: library/os os O_NOFOLLOW11145002
Ref: 30d911145002
Ref: library/os os O_NOATIME11145031
Ref: 30da11145031
Ref: library/os os O_PATH11145059
Ref: 117811145059
Ref: library/os os O_TMPFILE11145084
Ref: 117911145084
Ref: library/os os O_SHLOCK11145112
Ref: 164d11145112
Ref: library/os os O_EXLOCK11145139
Ref: 164e11145139
Ref: library/os os openpty11145547
Ref: 30db11145547
Ref: library/os os pipe11146062
Ref: 1bc311146062
Ref: library/os os pipe211146474
Ref: 130511146474
Ref: library/os os posix_fallocate11146932
Ref: f9811146932
Ref: library/os os posix_fadvise11147254
Ref: f9711147254
Ref: library/os os POSIX_FADV_NORMAL11148018
Ref: 30dc11148018
Ref: library/os os POSIX_FADV_SEQUENTIAL11148054
Ref: 30dd11148054
Ref: library/os os POSIX_FADV_RANDOM11148094
Ref: 30de11148094
Ref: library/os os POSIX_FADV_NOREUSE11148130
Ref: 30df11148130
Ref: library/os os POSIX_FADV_WILLNEED11148167
Ref: 30e011148167
Ref: library/os os POSIX_FADV_DONTNEED11148205
Ref: 30e111148205
Ref: library/os os pread11148476
Ref: d5a11148476
Ref: library/os os posix_openpt11148925
Ref: 1a5f11148925
Ref: library/os os preadv11149524
Ref: d5811149524
Ref: library/os os RWF_NOWAIT11150861
Ref: 30e311150861
Ref: library/os os RWF_HIPRI11151434
Ref: 30e211151434
Ref: library/os os ptsname11151990
Ref: 1a6211151990
Ref: library/os os pwrite11152533
Ref: d5d11152533
Ref: library/os os pwritev11152881
Ref: d5b11152881
Ref: library/os os RWF_DSYNC11154058
Ref: 30e411154058
Ref: library/os os RWF_SYNC11154424
Ref: 30e511154424
Ref: library/os os RWF_APPEND11154788
Ref: 1d8b11154788
Ref: library/os os read11155350
Ref: f9911155350
Ref: library/os os readinto11156458
Ref: 26111156458
Ref: library/os os sendfile11157674
Ref: d0911157674
Ref: library/os os SF_NODISKIO11159682
Ref: 30e611159682
Ref: library/os os SF_MNOWAIT11159712
Ref: 30e711159712
Ref: library/os os SF_SYNC11159741
Ref: 30e811159741
Ref: library/os os SF_NOCACHE11159963
Ref: 30e911159963
Ref: library/os os set_blocking11160250
Ref: 103e11160250
Ref: library/os os splice11160988
Ref: a1e11160988
Ref: library/os os SPLICE_F_MOVE11163407
Ref: 30ea11163407
Ref: library/os os SPLICE_F_NONBLOCK11163439
Ref: 30eb11163439
Ref: library/os os SPLICE_F_MORE11163475
Ref: 30ec11163475
Ref: library/os os readv11163537
Ref: d5911163537
Ref: library/os os tcgetpgrp11164294
Ref: 30ed11164294
Ref: library/os os tcsetpgrp11164562
Ref: 30ee11164562
Ref: library/os os ttyname11164846
Ref: 30ef11164846
Ref: library/os os unlockpt11165143
Ref: 1a6111165143
Ref: library/os os write11165520
Ref: f9f11165520
Ref: library/os os writev11166512
Ref: d5c11166512
Ref: ファイル記述子の操作-Footnote-111167416
Ref: ファイル記述子の操作-Footnote-211167458
Ref: ファイル記述子の操作-Footnote-311167502
Ref: ファイル記述子の操作-Footnote-411167565
Ref: ファイル記述子の操作-Footnote-511167607
Ref: ファイル記述子の操作-Footnote-611167653
Node: ターミナルのサイズの問い合わせ11167695
Ref: library/os querying-the-size-of-a-terminal11167846
Ref: 30f011167846
Ref: library/os terminal-size11167846
Ref: 30f111167846
Ref: library/os os get_terminal_size11167965
Ref: 131e11167965
Ref: library/os os terminal_size11168684
Ref: 2d7811168684
Ref: library/os os terminal_size columns11168847
Ref: 30f211168847
Ref: library/os os terminal_size lines11168949
Ref: 30f311168949
Node: ファイル記述子の継承11169049
Ref: library/os fd-inheritance11169200
Ref: 110011169200
Ref: library/os inheritance-of-file-descriptors11169200
Ref: 30f411169200
Ref: library/os os get_inheritable11170699
Ref: 110111170699
Ref: library/os os set_inheritable11170863
Ref: 110211170863
Ref: library/os os get_handle_inheritable11171033
Ref: 110311171033
Ref: library/os os set_handle_inheritable11171240
Ref: 110411171240
Node: ファイルとディレクトリ11171448
Ref: library/os files-and-directories11171660
Ref: 30f511171660
Ref: library/os os-file-dir11171660
Ref: 308511171660
Ref: library/os path-fd11171887
Ref: d5711171887
Ref: library/os dir-fd11172975
Ref: 130611172975
Ref: library/os follow-symlinks11173727
Ref: 130711173727
Ref: library/os os access11174352
Ref: 130811174352
Ref: library/os os F_OK11177848
Ref: 30f611177848
Ref: library/os os R_OK11177871
Ref: 30f711177871
Ref: library/os os W_OK11177894
Ref: 30f811177894
Ref: library/os os X_OK11177917
Ref: 30f911177917
Ref: library/os os chdir11178181
Ref: 82111178181
Ref: library/os os chflags11179169
Ref: 130911179169
Ref: library/os os chmod11180451
Ref: 52911180451
Ref: library/os os chown11182791
Ref: 130a11182791
Ref: library/os os chroot11184104
Ref: 1dda11184104
Ref: library/os os fchdir11184407
Ref: f8d11184407
Ref: library/os os getcwd11184935
Ref: 196a11184935
Ref: library/os os getcwdb11185040
Ref: c8611185040
Ref: library/os os lchflags11185476
Ref: 30fb11185476
Ref: library/os os lchmod11186083
Ref: 52811186083
Ref: library/os os lchown11187130
Ref: 30fc11187130
Ref: library/os os link11187770
Ref: 130b11187770
Ref: library/os os listdir11188749
Ref: 131611188749
Ref: library/os os listdrives11190688
Ref: 6c511190688
Ref: library/os os listmounts11191322
Ref: 6c711191322
Ref: library/os os listvolumes11192164
Ref: 6c611192164
Ref: library/os os lstat11192885
Ref: 6c811192885
Ref: library/os os mkdir11194173
Ref: 52b11194173
Ref: library/os mkdir-modebits11194492
Ref: 30fd11194492
Ref: library/os os makedirs11196031
Ref: 52c11196031
Ref: library/os os mkfifo11198160
Ref: f9411198160
Ref: library/os os mknod11199398
Ref: f9511199398
Ref: library/os os major11200397
Ref: 19be11200397
Ref: library/os os minor11200569
Ref: 19bf11200569
Ref: library/os os makedev11200741
Ref: 19c011200741
Ref: library/os os pathconf11200912
Ref: 131711200912
Ref: library/os os pathconf_names11202245
Ref: 30ff11202245
Ref: library/os os readlink11202672
Ref: b1e11202672
Ref: library/os os remove11204392
Ref: 130c11204392
Ref: library/os os removedirs11205512
Ref: 310011205512
Ref: library/os os rename11206648
Ref: 130d11206648
Ref: library/os os renames11208483
Ref: 310111208483
Ref: library/os os replace11209436
Ref: 130e11209436
Ref: library/os os rmdir11210611
Ref: 130f11210611
Ref: library/os os scandir11211379
Ref: c5811211379
Ref: library/os os scandir close11213598
Ref: ebc11213598
Ref: library/os os DirEntry11215406
Ref: 6c311215406
Ref: library/os os DirEntry name11217109
Ref: 310311217109
Ref: library/os os DirEntry path11217512
Ref: 1a5a11217512
Ref: library/os os DirEntry inode11218232
Ref: 1aae11218232
Ref: library/os os DirEntry is_dir11218733
Ref: 310211218733
Ref: library/os os DirEntry is_file11220855
Ref: f8811220855
Ref: library/os os DirEntry is_symlink11221855
Ref: 310411221855
Ref: library/os os DirEntry is_junction11223071
Ref: 6c411223071
Ref: library/os os DirEntry stat11223510
Ref: 1acc11223510
Ref: library/os os stat11225603
Ref: 26f11225603
Ref: library/os os stat_result11228423
Ref: 16df11228423
Ref: library/os os stat_result st_mode11228673
Ref: c0311228673
Ref: library/os os stat_result st_ino11228822
Ref: 310511228822
Ref: library/os os stat_result st_dev11229071
Ref: 310611229071
Ref: library/os os stat_result st_nlink11229171
Ref: 310711229171
Ref: library/os os stat_result st_uid11229240
Ref: 310811229240
Ref: library/os os stat_result st_gid11229325
Ref: 310911229325
Ref: library/os os stat_result st_size11229413
Ref: 310a11229413
Ref: library/os os stat_result st_atime11229794
Ref: 310b11229794
Ref: library/os os stat_result st_mtime11229878
Ref: 2f8f11229878
Ref: library/os os stat_result st_ctime11229962
Ref: 310c11229962
Ref: library/os os stat_result st_atime_ns11230339
Ref: 310d11230339
Ref: library/os os stat_result st_mtime_ns11230475
Ref: 310e11230475
Ref: library/os os stat_result st_ctime_ns11230611
Ref: 310f11230611
Ref: library/os os stat_result st_birthtime11231058
Ref: 311011231058
Ref: library/os os stat_result st_birthtime_ns11231340
Ref: 311111231340
Ref: library/os os stat_result st_blocks11232909
Ref: 311211232909
Ref: library/os os stat_result st_blksize11233200
Ref: 311311233200
Ref: library/os os stat_result st_rdev11233532
Ref: 182a11233532
Ref: library/os os stat_result st_flags11233621
Ref: 311411233621
Ref: library/os os stat_result st_gen11233925
Ref: 311511233925
Ref: library/os os stat_result st_fstype11234076
Ref: d5f11234076
Ref: library/os os stat_result st_rsize11234283
Ref: 311611234283
Ref: library/os os stat_result st_creator11234358
Ref: 311711234358
Ref: library/os os stat_result st_type11234426
Ref: 311811234426
Ref: library/os os stat_result st_file_attributes11234559
Ref: 103c11234559
Ref: library/os os stat_result st_reparse_tag11234939
Ref: c0411234939
Ref: library/os os statvfs11237332
Ref: 131811237332
Ref: library/os os statvfs_result11238008
Ref: 30bc11238008
Ref: library/os os statvfs_result f_bsize11238187
Ref: 311911238187
Ref: library/os os statvfs_result f_frsize11238239
Ref: 311a11238239
Ref: library/os os statvfs_result f_blocks11238295
Ref: 311b11238295
Ref: library/os os statvfs_result f_bfree11238419
Ref: 311c11238419
Ref: library/os os statvfs_result f_bavail11238482
Ref: 311d11238482
Ref: library/os os statvfs_result f_files11238569
Ref: 311e11238569
Ref: library/os os statvfs_result f_ffree11238669
Ref: 311f11238669
Ref: library/os os statvfs_result f_favail11238739
Ref: 312011238739
Ref: library/os os statvfs_result f_flag11238832
Ref: 312111238832
Ref: library/os os statvfs_result f_namemax11239275
Ref: 312e11239275
Ref: library/os os statvfs_result f_fsid11239493
Ref: 312f11239493
Ref: library/os os ST_RDONLY11239648
Ref: 312211239648
Ref: library/os os ST_NOSUID11239733
Ref: 312311239733
Ref: library/os os ST_NODEV11239846
Ref: 312411239846
Ref: library/os os ST_NOEXEC11239989
Ref: 312511239989
Ref: library/os os ST_SYNCHRONOUS11240120
Ref: 312611240120
Ref: library/os os ST_MANDLOCK11240255
Ref: 312711240255
Ref: library/os os ST_WRITE11240392
Ref: 312811240392
Ref: library/os os ST_APPEND11240527
Ref: 312911240527
Ref: library/os os ST_IMMUTABLE11240648
Ref: 312a11240648
Ref: library/os os ST_NOATIME11240770
Ref: 312b11240770
Ref: library/os os ST_NODIRATIME11240902
Ref: 312c11240902
Ref: library/os os ST_RELATIME11241047
Ref: 312d11241047
Ref: library/os os supports_dir_fd11241190
Ref: 131311241190
Ref: library/os os supports_effective_ids11242390
Ref: 131a11242390
Ref: library/os os supports_fd11243174
Ref: 131911243174
Ref: library/os os supports_follow_symlinks11243998
Ref: 131411243998
Ref: library/os os symlink11245130
Ref: 131011245130
Ref: library/os os sync11247592
Ref: 132e11247592
Ref: library/os os truncate11247774
Ref: 104011247774
Ref: library/os os unlink11248452
Ref: 131111248452
Ref: library/os os utime11249078
Ref: 131211249078
Ref: library/os os walk11251490
Ref: 6d011251490
Ref: library/os os fwalk11257986
Ref: d5611257986
Ref: library/os os memfd_create11260927
Ref: c0211260927
Ref: library/os os MFD_CLOEXEC11261788
Ref: 313011261788
Ref: library/os os MFD_ALLOW_SEALING11261818
Ref: 313111261818
Ref: library/os os MFD_HUGETLB11261854
Ref: 313211261854
Ref: library/os os MFD_HUGE_SHIFT11261884
Ref: 313311261884
Ref: library/os os MFD_HUGE_MASK11261917
Ref: 313411261917
Ref: library/os os MFD_HUGE_64KB11261949
Ref: 313511261949
Ref: library/os os MFD_HUGE_512KB11261981
Ref: 313611261981
Ref: library/os os MFD_HUGE_1MB11262014
Ref: 313711262014
Ref: library/os os MFD_HUGE_2MB11262045
Ref: 313811262045
Ref: library/os os MFD_HUGE_8MB11262076
Ref: 313911262076
Ref: library/os os MFD_HUGE_16MB11262107
Ref: 313a11262107
Ref: library/os os MFD_HUGE_32MB11262139
Ref: 313b11262139
Ref: library/os os MFD_HUGE_256MB11262171
Ref: 313c11262171
Ref: library/os os MFD_HUGE_512MB11262204
Ref: 313d11262204
Ref: library/os os MFD_HUGE_1GB11262237
Ref: 313e11262237
Ref: library/os os MFD_HUGE_2GB11262268
Ref: 313f11262268
Ref: library/os os MFD_HUGE_16GB11262299
Ref: 314011262299
Ref: library/os os eventfd11262557
Ref: a1d11262557
Ref: library/os os eventfd_read11264599
Ref: 314211264599
Ref: library/os os eventfd_write11264884
Ref: 314311264884
Ref: library/os os EFD_CLOEXEC11265181
Ref: 1bb711265181
Ref: library/os os EFD_NONBLOCK11265371
Ref: 1bb811265371
Ref: library/os os EFD_SEMAPHORE11265579
Ref: 1bb911265579
Ref: ファイルとディレクトリ-Footnote-111265945
Ref: ファイルとディレクトリ-Footnote-211265991
Ref: ファイルとディレクトリ-Footnote-311266033
Ref: ファイルとディレクトリ-Footnote-411266098
Ref: ファイルとディレクトリ-Footnote-511266178
Ref: ファイルとディレクトリ-Footnote-611266260
Ref: ファイルとディレクトリ-Footnote-711266349
Ref: ファイルとディレクトリ-Footnote-811266438
Ref: ファイルとディレクトリ-Footnote-911266496
Ref: ファイルとディレクトリ-Footnote-1011266543
Ref: ファイルとディレクトリ-Footnote-1111266591
Ref: ファイルとディレクトリ-Footnote-1211266640
Node: Timer File Descriptors11266688
Ref: library/os os-timerfd11266807
Ref: 47e11266807
Ref: library/os timer-file-descriptors11266807
Ref: 314411266807
Ref: library/os os timerfd_create11267019
Ref: 51f11267019
Ref: library/os os timerfd_settime11269666
Ref: 52011269666
Ref: library/os os timerfd_settime_ns11272366
Ref: 52111272366
Ref: library/os os timerfd_gettime11272715
Ref: 52211272715
Ref: library/os os timerfd_gettime_ns11273295
Ref: 52311273295
Ref: library/os os TFD_NONBLOCK11273521
Ref: 52411273521
Ref: library/os os TFD_CLOEXEC11273888
Ref: 52511273888
Ref: library/os os TFD_TIMER_ABSTIME11274178
Ref: 52611274178
Ref: library/os os TFD_TIMER_CANCEL_ON_SET11274568
Ref: 52711274568
Ref: Timer File Descriptors-Footnote-111274984
Ref: Timer File Descriptors-Footnote-211275038
Ref: Timer File Descriptors-Footnote-311275092
Ref: Timer File Descriptors-Footnote-411275147
Ref: Timer File Descriptors-Footnote-511275199
Ref: Timer File Descriptors-Footnote-611275252
Ref: Timer File Descriptors-Footnote-711275296
Node: Linux 拡張属性11275351
Ref: library/os linux-extended-attributes11275470
Ref: 314611275470
Ref: library/os os getxattr11275614
Ref: 132011275614
Ref: library/os os listxattr11276396
Ref: 132111276396
Ref: library/os os removexattr11277212
Ref: 132211277212
Ref: library/os os setxattr11278025
Ref: 132311278025
Ref: library/os os XATTR_SIZE_MAX11279402
Ref: 314911279402
Ref: library/os os XATTR_CREATE11279552
Ref: 314811279552
Ref: library/os os XATTR_REPLACE11279751
Ref: 314711279751
Node: プロセス管理11279963
Ref: library/os os-process11280196
Ref: 314a11280196
Ref: library/os process-management11280196
Ref: 314b11280196
Ref: library/os os abort11281040
Ref: 314d11281040
Ref: library/os os add_dll_directory11281417
Ref: be111281417
Ref: library/os os execl11282606
Ref: 314c11282606
Ref: library/os os execle11282654
Ref: 314e11282654
Ref: library/os os execlp11282708
Ref: 314f11282708
Ref: library/os os execlpe11282757
Ref: 315011282757
Ref: library/os os execv11282812
Ref: 309411282812
Ref: library/os os execve11282849
Ref: 131511282849
Ref: library/os os execvp11282892
Ref: 315111282892
Ref: library/os os execvpe11282930
Ref: 315211282930
Ref: library/os os _exit11286730
Ref: 275011286730
Ref: library/os os EX_OK11287717
Ref: 315311287717
Ref: library/os os EX_USAGE11287956
Ref: 315411287956
Ref: library/os os EX_DATAERR11288169
Ref: 315511288169
Ref: library/os os EX_NOINPUT11288321
Ref: 315611288321
Ref: library/os os EX_NOUSER11288530
Ref: 315711288530
Ref: library/os os EX_NOHOST11288699
Ref: 315811288699
Ref: library/os os EX_UNAVAILABLE11288865
Ref: 315911288865
Ref: library/os os EX_SOFTWARE11289036
Ref: 315a11289036
Ref: library/os os EX_OSERR11289207
Ref: 315b11289207
Ref: library/os os EX_OSFILE11289455
Ref: 315c11289455
Ref: library/os os EX_CANTCREAT11289696
Ref: 315d11289696
Ref: library/os os EX_IOERR11289892
Ref: 315e11289892
Ref: library/os os EX_TEMPFAIL11290071
Ref: 315f11290071
Ref: library/os os EX_PROTOCOL11290425
Ref: 316011290425
Ref: library/os os EX_NOPERM11290620
Ref: 316111290620
Ref: library/os os EX_CONFIG11290846
Ref: 316211290846
Ref: library/os os EX_NOTFOUND11290994
Ref: 316311290994
Ref: library/os os fork11291151
Ref: 4b511291151
Ref: library/os os forkpty11293329
Ref: 4b611293329
Ref: library/os os kill11294567
Ref: 158311294567
Ref: library/os os killpg11295579
Ref: 1e1711295579
Ref: library/os os nice11295883
Ref: 131d11295883
Ref: library/os os pidfd_open11296082
Ref: 6a411296082
Ref: library/os os PIDFD_NONBLOCK11296494
Ref: 6c211296494
Ref: library/os os plock11296950
Ref: 316411296950
Ref: library/os os popen11297267
Ref: 31c11297267
Ref: library/os os posix_spawn11299756
Ref: 52e11299756
Ref: library/os os POSIX_SPAWN_OPEN11301112
Ref: 316511301112
Ref: library/os os POSIX_SPAWN_CLOSE11301302
Ref: 316611301302
Ref: library/os os POSIX_SPAWN_DUP211301442
Ref: 316711301442
Ref: library/os os POSIX_SPAWN_CLOSEFROM11301597
Ref: 52f11301597
Ref: library/os os posix_spawnp11304532
Ref: 17d511304532
Ref: library/os os register_at_fork11305315
Ref: 35311305315
Ref: library/os os spawnl11306765
Ref: 31d11306765
Ref: library/os os spawnle11306808
Ref: 316811306808
Ref: library/os os spawnlp11306857
Ref: 316911306857
Ref: library/os os spawnlpe11306901
Ref: 316a11306901
Ref: library/os os spawnv11306951
Ref: 316b11306951
Ref: library/os os spawnve11306995
Ref: 316c11306995
Ref: library/os os spawnvp11307045
Ref: 316d11307045
Ref: library/os os spawnvpe11307090
Ref: 316e11307090
Ref: library/os os P_NOWAIT11311646
Ref: 316f11311646
Ref: library/os os P_NOWAITO11311673
Ref: 317111311673
Ref: library/os os P_WAIT11312021
Ref: 317011312021
Ref: library/os os P_DETACH11312440
Ref: 317211312440
Ref: library/os os P_OVERLAY11312467
Ref: 317311312467
Ref: library/os os startfile11313085
Ref: 1cdf11313085
Ref: library/os os system11315745
Ref: 167b11315745
Ref: library/os os times11317655
Ref: 133111317655
Ref: library/os os wait11318798
Ref: f9c11318798
Ref: library/os os waitid11319880
Ref: f9d11319880
Ref: library/os os waitpid11321325
Ref: f9e11321325
Ref: library/os os wait311324242
Ref: f9a11324242
Ref: library/os os wait411324975
Ref: f9b11324975
Ref: library/os os P_PID11325662
Ref: 317411325662
Ref: library/os os P_PGID11325686
Ref: 317511325686
Ref: library/os os P_ALL11325711
Ref: 317611325711
Ref: library/os os P_PIDFD11325735
Ref: b1a11325735
Ref: library/os os WCONTINUED11326500
Ref: 317911326500
Ref: library/os os WEXITED11326854
Ref: 317711326854
Ref: library/os os WSTOPPED11327226
Ref: 317811327226
Ref: library/os os WUNTRACED11327571
Ref: 317e11327571
Ref: library/os os WNOHANG11327982
Ref: 317a11327982
Ref: library/os os WNOWAIT11328284
Ref: 317b11328284
Ref: library/os os CLD_EXITED11328653
Ref: 317d11328653
Ref: library/os os CLD_KILLED11328682
Ref: b1811328682
Ref: library/os os CLD_DUMPED11328711
Ref: 317f11328711
Ref: library/os os CLD_TRAPPED11328740
Ref: 318011328740
Ref: library/os os CLD_STOPPED11328770
Ref: b1911328770
Ref: library/os os CLD_CONTINUED11328800
Ref: 318111328800
Ref: library/os os waitstatus_to_exitcode11329144
Ref: b1b11329144
Ref: library/os os WCOREDUMP11330997
Ref: 318811330997
Ref: library/os os WIFCONTINUED11331383
Ref: 318911331383
Ref: library/os os WIFSTOPPED11331768
Ref: 318611331768
Ref: library/os os WIFSIGNALED11332353
Ref: 318411332353
Ref: library/os os WIFEXITED11332631
Ref: 318211332631
Ref: library/os os WEXITSTATUS11333019
Ref: 318311333019
Ref: library/os os WSTOPSIG11333302
Ref: 318711333302
Ref: library/os os WTERMSIG11333595
Ref: 318511333595
Ref: プロセス管理-Footnote-111333928
Ref: プロセス管理-Footnote-211334000
Ref: プロセス管理-Footnote-311334043
Ref: プロセス管理-Footnote-411334093
Ref: プロセス管理-Footnote-511334139
Ref: プロセス管理-Footnote-611334184
Ref: プロセス管理-Footnote-711334236
Ref: プロセス管理-Footnote-811334345
Ref: プロセス管理-Footnote-911334387
Node: スケジューラーへのインターフェイス11334433
Ref: library/os interface-to-the-scheduler11334660
Ref: 318b11334660
Ref: library/os os-scheduling-policy11335220
Ref: 318c11335220
Ref: library/os os SCHED_OTHER11335220
Ref: 318d11335220
Ref: library/os os SCHED_BATCH11335321
Ref: 318e11335321
Ref: library/os os SCHED_DEADLINE11335532
Ref: 25f11335532
Ref: library/os os SCHED_IDLE11335656
Ref: 318f11335656
Ref: library/os os SCHED_NORMAL11335810
Ref: 26011335810
Ref: library/os os SCHED_SPORADIC11335912
Ref: 319011335912
Ref: library/os os SCHED_FIFO11336043
Ref: 319111336043
Ref: library/os os SCHED_RR11336158
Ref: 319211336158
Ref: library/os os SCHED_RESET_ON_FORK11336265
Ref: 319311336265
Ref: library/os os sched_param11336626
Ref: 197011336626
Ref: library/os os sched_param sched_priority11337018
Ref: 319411337018
Ref: library/os os sched_get_priority_min11337147
Ref: 132511337147
Ref: library/os os sched_get_priority_max11337358
Ref: 132411337358
Ref: library/os os sched_setscheduler11337569
Ref: 132c11337569
Ref: library/os os sched_getscheduler11337971
Ref: 132811337971
Ref: library/os os sched_setparam11338277
Ref: 132b11338277
Ref: library/os os sched_getparam11338576
Ref: 132711338576
Ref: library/os os sched_rr_get_interval11338850
Ref: 132911338850
Ref: library/os os sched_yield11339071
Ref: 132d11339071
Ref: library/os os sched_setaffinity11339189
Ref: 132a11339189
Ref: library/os os sched_getaffinity11339476
Ref: 132611339476
Ref: スケジューラーへのインターフェイス-Footnote-111339805
Node: 雑多なシステム情報11339856
Ref: library/os miscellaneous-system-information11340074
Ref: 319511340074
Ref: library/os os-path11340074
Ref: 319611340074
Ref: library/os os confstr11340142
Ref: 194e11340142
Ref: library/os os confstr_names11341308
Ref: 319711341308
Ref: library/os os cpu_count11341683
Ref: 4db11341683
Ref: library/os os getloadavg11342179
Ref: 198511342179
Ref: library/os os process_cpu_count11342474
Ref: 4da11342474
Ref: library/os os sysconf11343077
Ref: 194f11343077
Ref: library/os os sysconf_names11343572
Ref: 319811343572
Ref: library/os os curdir11344311
Ref: 2cd311344311
Ref: library/os os pardir11344582
Ref: 30fe11344582
Ref: library/os os sep11344851
Ref: 87b11344851
Ref: library/os os altsep11345471
Ref: 87c11345471
Ref: library/os os extsep11345923
Ref: 319911345923
Ref: library/os os pathsep11346135
Ref: 218f11346135
Ref: library/os os defpath11346488
Ref: 1e4011346488
Ref: library/os os linesep11346757
Ref: 263b11346757
Ref: library/os os devnull11347382
Ref: 1e7011347382
Ref: library/os os RTLD_LAZY11347622
Ref: 133411347622
Ref: library/os os RTLD_NOW11347650
Ref: 133511347650
Ref: library/os os RTLD_GLOBAL11347677
Ref: 133611347677
Ref: library/os os RTLD_LOCAL11347707
Ref: 133711347707
Ref: library/os os RTLD_NODELETE11347736
Ref: 133811347736
Ref: library/os os RTLD_NOLOAD11347768
Ref: 133911347768
Ref: library/os os RTLD_DEEPBIND11347798
Ref: 133a11347798
Ref: 雑多なシステム情報-Footnote-111348157
Node: 乱数<2>11348203
Ref: library/os random-numbers11348361
Ref: 319a11348361
Ref: library/os os getrandom11348394
Ref: ebd11348394
Ref: library/os os urandom11349414
Ref: 74611349414
Ref: library/os os GRND_NONBLOCK11352365
Ref: 319c11352365
Ref: library/os os GRND_RANDOM11352981
Ref: 319b11352981
Ref: 乱数<2>-Footnote-111353261
Ref: 乱数<2>-Footnote-211353324
Node: io --- ストリームを扱うコアツール11353366
Ref: library/io doc11353648
Ref: 319d11353648
Ref: library/io io-core-tools-for-working-with-streams11353648
Ref: 319e11353648
Ref: library/io module-io11353648
Ref: 8311353648
Ref: library/io translation-repo11353648
Ref: 319f11353648
Ref: io --- ストリームを扱うコアツール-Footnote-111354054
Node: 概要<2>11354116
Ref: library/io io-overview11354230
Ref: 263911354230
Ref: library/io overview11354230
Ref: 31a011354230
Node: テキスト I/O11355692
Ref: library/io text-i-o11355779
Ref: 31a111355779
Ref: library/io text-io11355779
Ref: 31a211355779
Node: バイナリ I/O11356911
Ref: library/io binary-i-o11357014
Ref: 31a311357014
Ref: library/io binary-io11357014
Ref: 31a411357014
Node: Raw I/O11358162
Ref: library/io raw-i-o11358240
Ref: 31a511358240
Node: Text Encoding11359326
Ref: library/io io-text-encoding11359500
Ref: 9c411359500
Ref: library/io text-encoding11359500
Ref: 31a611359500
Ref: Text Encoding-Footnote-111360668
Node: Opt-in EncodingWarning11360710
Ref: library/io io-encoding-warning11360782
Ref: 219a11360782
Ref: library/io opt-in-encodingwarning11360782
Ref: 31a711360782
Ref: Opt-in EncodingWarning-Footnote-111361598
Node: 高水準のモジュールインターフェイス11361640
Ref: library/io high-level-module-interface11361820
Ref: 31a811361820
Ref: library/io io DEFAULT_BUFFER_SIZE11361926
Ref: 1a9f11361926
Ref: library/io io open11362239
Ref: 74011362239
Ref: library/io io open_code11362668
Ref: 17c411362668
Ref: library/io io text_encoding11363367
Ref: 1a9e11363367
Ref: library/io io BlockingIOError11364498
Ref: 31a911364498
Ref: library/io io UnsupportedOperation11364644
Ref: 1ddd11364644
Node: クラス階層11365029
Ref: library/io class-hierarchy11365209
Ref: 31aa11365209
Node: I/O 基底クラス11370572
Ref: library/io i-o-base-classes11370670
Ref: 31ab11370670
Ref: library/io io IOBase11370724
Ref: 50511370724
Ref: library/io io IOBase close11373026
Ref: 50611373026
Ref: library/io io IOBase closed11373627
Ref: 1e6b11373627
Ref: library/io io IOBase fileno11373742
Ref: 181b11373742
Ref: library/io io IOBase flush11374052
Ref: 2d6211374052
Ref: library/io io IOBase isatty11374288
Ref: 20c511374288
Ref: library/io io IOBase readable11374491
Ref: 15cb11374491
Ref: library/io io IOBase readline11374659
Ref: 154511374659
Ref: library/io io IOBase readlines11375148
Ref: 281911375148
Ref: library/io io IOBase seek11375881
Ref: 14a811375881
Ref: library/io io IOBase seekable11376861
Ref: 15cd11376861
Ref: library/io io IOBase tell11377207
Ref: 15ca11377207
Ref: library/io io IOBase truncate11377299
Ref: 152c11377299
Ref: library/io io IOBase writable11378142
Ref: 15cc11378142
Ref: library/io io IOBase writelines11378349
Ref: 17eb11378349
Ref: library/io io IOBase __del__11378621
Ref: 31ac11378621
Ref: library/io io RawIOBase11378919
Ref: 12eb11378919
Ref: library/io io RawIOBase read11379584
Ref: 102111379584
Ref: library/io io RawIOBase readall11380514
Ref: 31ad11380514
Ref: library/io io RawIOBase readinto11380984
Ref: 102211380984
Ref: library/io io RawIOBase write11381426
Ref: 15c911381426
Ref: library/io io BufferedIOBase11382756
Ref: 8a411382756
Ref: library/io io BufferedIOBase raw11384060
Ref: 15ce11384060
Ref: library/io io BufferedIOBase detach11384367
Ref: 2e6611384367
Ref: library/io io BufferedIOBase read11384904
Ref: 154411384904
Ref: library/io io BufferedIOBase read111386191
Ref: 2ed111386191
Ref: library/io io BufferedIOBase readinto11386782
Ref: 18f811386782
Ref: library/io io BufferedIOBase readinto111387529
Ref: 102011387529
Ref: library/io io BufferedIOBase write11388185
Ref: edb11388185
Ref: I/O 基底クラス-Footnote-111389375
Ref: I/O 基底クラス-Footnote-211389417
Ref: I/O 基底クラス-Footnote-311389459
Node: 生ファイルI/O11389501
Ref: library/io raw-file-i-o11389641
Ref: 31ae11389641
Ref: library/io io FileIO11389695
Ref: 152b11389695
Ref: library/io io FileIO mode11393171
Ref: 31af11393171
Ref: library/io io FileIO name11393263
Ref: 2e6a11393263
Node: バッファ付きストリーム11393432
Ref: library/io buffered-streams11393572
Ref: 31b011393572
Ref: library/io io BytesIO11393790
Ref: 10a811393790
Ref: library/io io BytesIO getbuffer11394362
Ref: 140e11394362
Ref: library/io io BytesIO getvalue11395054
Ref: 2ecf11395054
Ref: library/io io BytesIO read111395172
Ref: 31b111395172
Ref: library/io io BytesIO readinto111395422
Ref: 31b211395422
Ref: library/io io BufferedReader11395621
Ref: 142b11395621
Ref: library/io io BufferedReader peek11396766
Ref: 31b311396766
Ref: library/io io BufferedReader read11397072
Ref: 31b411397072
Ref: library/io io BufferedReader read111397217
Ref: 31b511397217
Ref: library/io io BufferedWriter11397450
Ref: 15cf11397450
Ref: library/io io BufferedWriter flush11398854
Ref: 31b611398854
Ref: library/io io BufferedWriter write11399117
Ref: 31b711399117
Ref: library/io io BufferedRandom11399480
Ref: 15d011399480
Ref: library/io io BufferedRWPair11400255
Ref: 15d111400255
Node: テキスト I/O<2>11401368
Ref: library/io id111401481
Ref: 31b811401481
Ref: library/io io TextIOBase11401532
Ref: 8a511401532
Ref: library/io io TextIOBase encoding11401892
Ref: 31b911401892
Ref: library/io io TextIOBase errors11402131
Ref: 152a11402131
Ref: library/io io TextIOBase newlines11402234
Ref: 31ba11402234
Ref: library/io io TextIOBase buffer11402544
Ref: 14bf11402544
Ref: library/io io TextIOBase detach11402830
Ref: 17f111402830
Ref: library/io io TextIOBase read11403409
Ref: 20c811403409
Ref: library/io io TextIOBase readline11403671
Ref: 177c11403671
Ref: library/io io TextIOBase seek11403955
Ref: 31bb11403955
Ref: library/io io TextIOBase tell11404940
Ref: 31bc11404940
Ref: library/io io TextIOBase write11405166
Ref: 20b711405166
Ref: library/io io TextIOWrapper11405321
Ref: 9c211405321
Ref: library/io io TextIOWrapper line_buffering11410071
Ref: 31bd11410071
Ref: library/io io TextIOWrapper write_through11410167
Ref: 31be11410167
Ref: library/io io TextIOWrapper reconfigure11410337
Ref: d4411410337
Ref: library/io io TextIOWrapper seek11411426
Ref: 31bf11411426
Ref: library/io io TextIOWrapper tell11412347
Ref: 181f11412347
Ref: library/io io StringIO11412576
Ref: 112e11412576
Ref: library/io io StringIO getvalue11413908
Ref: 31c011413908
Ref: library/io io IncrementalNewlineDecoder11414565
Ref: 17d311414565
Node: Static Typing11414756
Ref: library/io static-typing11414894
Ref: 31c111414894
Ref: library/io io Reader11415137
Ref: 23811415137
Ref: library/io io Reader read11415387
Ref: 31c211415387
Ref: library/io io Writer11415786
Ref: 23911415786
Ref: library/io io Writer write11416041
Ref: 31c311416041
Node: 性能<3>11416455
Ref: library/io performance11416569
Ref: 31c511416569
Node: バイナリ I/O<2>11416898
Ref: library/io id211416991
Ref: 31c611416991
Node: テキスト I/O<3>11417972
Ref: library/io id311418107
Ref: 31c711418107
Node: マルチスレッディング<3>11418719
Ref: library/io multi-threading11418859
Ref: 31c811418859
Ref: マルチスレッディング<3>-Footnote-111419583
Node: リエントラント性11419627
Ref: library/io reentrancy11419739
Ref: 31c911419739
Node: time --- 時刻データへのアクセスと変換11420796
Ref: library/time doc11421045
Ref: 31ca11421045
Ref: library/time module-time11421045
Ref: f411421045
Ref: library/time time-time-access-and-conversions11421045
Ref: 31cb11421045
Ref: library/time translation-repo11421045
Ref: 31cc11421045
Ref: library/time epoch11422023
Ref: 2f8e11422023
Ref: time --- 時刻データへのアクセスと変換-Footnote-111427437
Ref: time --- 時刻データへのアクセスと変換-Footnote-211427487
Ref: time --- 時刻データへのアクセスと変換-Footnote-311427552
Node: 関数<5>11427610
Ref: library/time functions11427734
Ref: 31cf11427734
Ref: library/time time-functions11427734
Ref: 31d011427734
Ref: library/time time asctime11427765
Ref: 140411427765
Ref: library/time time pthread_getcpuclockid11428449
Ref: d8f11428449
Ref: library/time time clock_getres11429091
Ref: 137911429091
Ref: library/time time clock_gettime11429413
Ref: 137a11429413
Ref: library/time time clock_gettime_ns11429846
Ref: cdf11429846
Ref: library/time time clock_settime11430075
Ref: 137b11430075
Ref: library/time time clock_settime_ns11430502
Ref: ce011430502
Ref: library/time time ctime11430760
Ref: 293c11430760
Ref: library/time time get_clock_info11431402
Ref: 137811431402
Ref: library/time time gmtime11432740
Ref: 13dc11432740
Ref: library/time time localtime11433382
Ref: 171711433382
Ref: library/time time mktime11434113
Ref: 140511434113
Ref: library/time time monotonic11435061
Ref: 55c11435061
Ref: library/time time monotonic_ns11436198
Ref: ce111436198
Ref: library/time time perf_counter11436373
Ref: c7e11436373
Ref: library/time time perf_counter_ns11437317
Ref: ce211437317
Ref: library/time time process_time11437498
Ref: c7f11437498
Ref: library/time time process_time_ns11438041
Ref: ce311438041
Ref: library/time time sleep11438222
Ref: 8ad11438222
Ref: library/time time strftime11440442
Ref: 140611440442
Ref: library/time leap-second11448536
Ref: 31d211448536
Ref: library/time time strptime11450009
Ref: 164b11450009
Ref: library/time time struct_time11452215
Ref: eea11452215
Ref: library/time time struct_time tm_year11452932
Ref: 171611452932
Ref: library/time time struct_time tm_mon11453196
Ref: 31d311453196
Ref: library/time time struct_time tm_mday11453465
Ref: 31d411453465
Ref: library/time time struct_time tm_hour11453733
Ref: 31d511453733
Ref: library/time time struct_time tm_min11454000
Ref: 31d611454000
Ref: library/time time struct_time tm_sec11454268
Ref: 31d711454268
Ref: library/time time struct_time tm_wday11454747
Ref: 31d811454747
Ref: library/time time struct_time tm_yday11455021
Ref: 31d911455021
Ref: library/time time struct_time tm_isdst11455291
Ref: 294d11455291
Ref: library/time time struct_time tm_zone11455673
Ref: 31ce11455673
Ref: library/time time struct_time tm_gmtoff11455954
Ref: 31cd11455954
Ref: library/time time time11456813
Ref: 55d11456813
Ref: library/time time time_ns11458741
Ref: ce411458741
Ref: library/time time thread_time11458953
Ref: b3411458953
Ref: library/time time thread_time_ns11459637
Ref: d8e11459637
Ref: library/time time tzset11459816
Ref: 31da11459816
Ref: 関数<5>-Footnote-111464525
Ref: 関数<5>-Footnote-211464586
Ref: 関数<5>-Footnote-311464685
Ref: 関数<5>-Footnote-411464727
Ref: 関数<5>-Footnote-511465508
Ref: 関数<5>-Footnote-611466289
Ref: 関数<5>-Footnote-711466339
Ref: 関数<5>-Footnote-811466398
Ref: 関数<5>-Footnote-911467179
Ref: 関数<5>-Footnote-1011467227
Ref: 関数<5>-Footnote-1111467278
Ref: 関数<5>-Footnote-1211467327
Node: Clock ID Constants11467374
Ref: library/time clock-id-constants11467525
Ref: 31db11467525
Ref: library/time time-clock-id-constants11467525
Ref: 314511467525
Ref: library/time time CLOCK_BOOTTIME11467687
Ref: d8b11467687
Ref: library/time time CLOCK_HIGHRES11468170
Ref: 31dc11468170
Ref: library/time time CLOCK_MONOTONIC11468547
Ref: 8a911468547
Ref: library/time time CLOCK_MONOTONIC_RAW11468781
Ref: 31dd11468781
Ref: library/time time CLOCK_MONOTONIC_RAW_APPROX11469093
Ref: 31de11469093
Ref: library/time time CLOCK_PROCESS_CPUTIME_ID11469360
Ref: 31df11469360
Ref: library/time time CLOCK_PROF11469550
Ref: d8c11469550
Ref: library/time time CLOCK_TAI11469751
Ref: 1db511469751
Ref: library/time time CLOCK_THREAD_CPUTIME_ID11470051
Ref: 31e011470051
Ref: library/time time CLOCK_UPTIME11470226
Ref: d8d11470226
Ref: library/time time CLOCK_UPTIME_RAW11470514
Ref: c3b11470514
Ref: library/time time CLOCK_UPTIME_RAW_APPROX11470818
Ref: 31e111470818
Ref: library/time time CLOCK_REALTIME11471172
Ref: 8aa11471172
Ref: Clock ID Constants-Footnote-111471434
Node: Timezone Constants11471561
Ref: library/time time-timezone-constants11471694
Ref: 31e211471694
Ref: library/time timezone-constants11471694
Ref: 31e311471694
Ref: library/time time altzone11471751
Ref: 31e411471751
Ref: library/time time daylight11472197
Ref: 31e511472197
Ref: library/time time timezone11472373
Ref: 31e611472373
Ref: library/time time tzname11472740
Ref: 31e711472740
Node: logging --- Python 用のログ記録手段11474235
Ref: library/logging doc11474484
Ref: 31e811474484
Ref: library/logging logging-logging-facility-for-python11474484
Ref: 31e911474484
Ref: library/logging module-logging11474484
Ref: 8b11474484
Ref: library/logging translation-repo11474484
Ref: 31ea11474484
Ref: logging --- Python 用のログ記録手段-Footnote-111479128
Node: ロガーオブジェクト11479205
Ref: library/logging logger11479342
Ref: 31eb11479342
Ref: library/logging logger-objects11479342
Ref: 31ec11479342
Ref: library/logging logging Logger11480866
Ref: d4a11480866
Ref: library/logging logging Logger name11480897
Ref: 31ed11480897
Ref: library/logging logging Logger level11481181
Ref: 31ee11481181
Ref: library/logging logging Logger parent11481621
Ref: 31ef11481621
Ref: library/logging logging Logger propagate11481975
Ref: 16b311481975
Ref: library/logging logging Logger handlers11484530
Ref: 31f011484530
Ref: library/logging logging Logger disabled11485088
Ref: 31f311485088
Ref: library/logging logging Logger setLevel11485508
Ref: 16b111485508
Ref: library/logging logging Logger isEnabledFor11487894
Ref: 151211487894
Ref: library/logging logging Logger getEffectiveLevel11488346
Ref: 31f511488346
Ref: library/logging logging Logger getChild11488963
Ref: 151011488963
Ref: library/logging logging Logger getChildren11489538
Ref: 1bb111489538
Ref: library/logging logging Logger debug11490293
Ref: 102f11490293
Ref: library/logging logging Logger info11496969
Ref: 213811496969
Ref: library/logging logging Logger warning11497199
Ref: 1ad511497199
Ref: library/logging logging Logger error11497697
Ref: 31f811497697
Ref: library/logging logging Logger critical11497929
Ref: 102e11497929
Ref: library/logging logging Logger log11498167
Ref: 102c11498167
Ref: library/logging logging Logger exception11498434
Ref: 102d11498434
Ref: library/logging logging Logger addFilter11498836
Ref: 31f911498836
Ref: library/logging logging Logger removeFilter11498967
Ref: 31fa11498967
Ref: library/logging logging Logger filter11499107
Ref: 31fb11499107
Ref: library/logging logging Logger addHandler11499696
Ref: 31f111499696
Ref: library/logging logging Logger removeHandler11499824
Ref: 31f211499824
Ref: library/logging logging Logger findCaller11499961
Ref: 31fc11499961
Ref: library/logging logging Logger handle11501005
Ref: 31fd11501005
Ref: library/logging logging Logger makeRecord11501615
Ref: 31fe11501615
Ref: library/logging logging Logger hasHandlers11501958
Ref: 31ff11501958
Node: ロギングレベル11502763
Ref: library/logging levels11502939
Ref: 86b11502939
Ref: library/logging logging-levels11502939
Ref: 320011502939
Ref: library/logging logging NOTSET11503710
Ref: 31f411503710
Ref: library/logging logging DEBUG11504548
Ref: 213911504548
Ref: library/logging logging INFO11504918
Ref: 213a11504918
Ref: library/logging logging WARNING11505167
Ref: 213b11505167
Ref: library/logging logging ERROR11505765
Ref: 213c11505765
Ref: library/logging logging CRITICAL11506046
Ref: 213d11506046
Node: ハンドラオブジェクト11506273
Ref: library/logging handler11506458
Ref: 320111506458
Ref: library/logging handler-objects11506458
Ref: 320211506458
Ref: library/logging logging Handler11506943
Ref: 16b411506943
Ref: library/logging logging Handler __init__11506975
Ref: 320311506975
Ref: library/logging logging Handler createLock11507341
Ref: 320411507341
Ref: library/logging logging Handler acquire11507589
Ref: 320511507589
Ref: library/logging logging Handler release11507733
Ref: 320611507733
Ref: library/logging logging Handler setLevel11507860
Ref: 320711507860
Ref: library/logging logging Handler setFormatter11508599
Ref: 320811508599
Ref: library/logging logging Handler addFilter11508786
Ref: 320911508786
Ref: library/logging logging Handler removeFilter11508920
Ref: 320a11508920
Ref: library/logging logging Handler filter11509060
Ref: 320b11509060
Ref: library/logging logging Handler flush11509585
Ref: 320c11509585
Ref: library/logging logging Handler close11509827
Ref: 320d11509827
Ref: library/logging logging Handler handle11510170
Ref: 320e11510170
Ref: library/logging logging Handler handleError11510481
Ref: 320f11510481
Ref: library/logging logging Handler format11511546
Ref: 321111511546
Ref: library/logging logging Handler emit11511851
Ref: 321011511851
Node: フォーマッタオブジェクト11514282
Ref: library/logging formatter-objects11514476
Ref: 321211514476
Ref: library/logging id111514476
Ref: 321311514476
Ref: library/logging logging Formatter11514557
Ref: 16b511514557
Ref: library/logging logging Formatter format11517282
Ref: 321611517282
Ref: library/logging logging Formatter formatTime11519076
Ref: 321411519076
Ref: library/logging logging Formatter formatException11522097
Ref: 321711522097
Ref: library/logging logging Formatter formatStack11522466
Ref: 321811522466
Ref: library/logging logging BufferingFormatter11522851
Ref: 321911522851
Ref: library/logging logging BufferingFormatter formatHeader11523389
Ref: 321a11523389
Ref: library/logging logging BufferingFormatter formatFooter11523873
Ref: 321b11523873
Ref: library/logging logging BufferingFormatter format11524301
Ref: 321c11524301
Node: フィルタオブジェクト11524830
Ref: library/logging filter11525022
Ref: 321d11525022
Ref: library/logging filter-objects11525022
Ref: 321e11525022
Ref: library/logging logging Filter11525740
Ref: 141811525740
Ref: library/logging logging Filter filter11526161
Ref: 321f11526161
Node: LogRecord オブジェクト11529481
Ref: library/logging log-record11529653
Ref: 322211529653
Ref: library/logging logrecord-objects11529653
Ref: 322311529653
Ref: library/logging logging LogRecord11530052
Ref: 11ec11530052
Ref: library/logging logging LogRecord getMessage11532950
Ref: 322611532950
Node: LogRecord 属性11534810
Ref: library/logging id211534984
Ref: 322911534984
Ref: library/logging logrecord-attributes11534984
Ref: 31f611534984
Node: LoggerAdapter オブジェクト11544784
Ref: library/logging logger-adapter11544954
Ref: 322a11544954
Ref: library/logging loggeradapter-objects11544954
Ref: 322b11544954
Ref: library/logging logging LoggerAdapter11545303
Ref: 151111545303
Ref: library/logging logging LoggerAdapter process11545871
Ref: 322d11545871
Ref: library/logging logging LoggerAdapter manager11546425
Ref: 322e11546425
Ref: library/logging logging LoggerAdapter _log11546565
Ref: 322f11546565
Node: スレッドセーフ性11547949
Ref: library/logging thread-safety11548136
Ref: 323011548136
Node: モジュールレベルの関数11549080
Ref: library/logging module-level-functions11549265
Ref: 323111549265
Ref: library/logging logging getLogger11549453
Ref: b5d11549453
Ref: library/logging logging getLoggerClass11550355
Ref: 323211550355
Ref: library/logging logging getLogRecordFactory11550965
Ref: 322711550965
Ref: library/logging logging debug11551542
Ref: 31f711551542
Ref: library/logging logging info11552670
Ref: 322011552670
Ref: library/logging logging warning11552938
Ref: 35211552938
Ref: library/logging logging error11553451
Ref: 323411553451
Ref: library/logging logging critical11553720
Ref: 323511553720
Ref: library/logging logging exception11553995
Ref: 16b211553995
Ref: library/logging logging log11554412
Ref: 323611554412
Ref: library/logging logging disable11554691
Ref: 323711554691
Ref: library/logging logging addLevelName11556066
Ref: 323811556066
Ref: library/logging logging getLevelNamesMapping11556919
Ref: 86a11556919
Ref: library/logging logging getLevelName11557344
Ref: 323a11557344
Ref: library/logging logging getHandlerByName11559171
Ref: 1bc111559171
Ref: library/logging logging getHandlerNames11559403
Ref: 1acf11559403
Ref: library/logging logging makeLogRecord11559569
Ref: 322411559569
Ref: library/logging logging basicConfig11559966
Ref: bf711559966
Ref: library/logging logging shutdown11566227
Ref: 323b11566227
Ref: library/logging logging setLoggerClass11566902
Ref: 323311566902
Ref: library/logging logging setLogRecordFactory11567812
Ref: 322811567812
Ref: モジュールレベルの関数-Footnote-111569324
Node: モジュールレベル属性11569389
Ref: library/logging module-level-attributes11569586
Ref: 323c11569586
Ref: library/logging logging lastResort11569659
Ref: 141711569659
Ref: library/logging logging raiseExceptions11570482
Ref: 141611570482
Node: warnings モジュールとの統合11571072
Ref: library/logging integration-with-the-warnings-module11571227
Ref: 323d11571227
Ref: library/logging logging captureWarnings11571435
Ref: 323e11571435
Ref: warnings モジュールとの統合-Footnote-111573066
Ref: warnings モジュールとの統合-Footnote-211573108
Node: logging config --- ログ記録の環境設定11573161
Ref: library/logging config doc11573407
Ref: 323f11573407
Ref: library/logging config logging-config-logging-configuration11573407
Ref: 324011573407
Ref: library/logging config module-logging config11573407
Ref: 8c11573407
Ref: library/logging config translation-repo11573407
Ref: 324111573407
Ref: logging config --- ログ記録の環境設定-Footnote-111574238
Node: 環境設定のための関数11574312
Ref: library/logging config configuration-functions11574473
Ref: 324211574473
Ref: library/logging config logging-config-api11574473
Ref: 150d11574473
Ref: library/logging config logging config dictConfig11574908
Ref: 13cc11574908
Ref: library/logging config logging config fileConfig11577155
Ref: d4c11577155
Ref: library/logging config logging config listen11580405
Ref: 116b11580405
Ref: library/logging config logging-eval-security11582625
Ref: 324611582625
Ref: library/logging config logging config stopListening11584828
Ref: 324511584828
Node: セキュリティで考慮すべき点11585103
Ref: library/logging config security-considerations11585303
Ref: 324711585303
Node: 環境設定辞書スキーマ11586455
Ref: library/logging config configuration-dictionary-schema11586658
Ref: 324911586658
Ref: library/logging config logging-config-dictschema11586658
Ref: 324311586658
Node: 辞書スキーマの詳細11587953
Ref: library/logging config dictionary-schema-details11588068
Ref: 324b11588068
Ref: library/logging config logging-config-dictschema-formatters11589164
Ref: 324c11589164
Node: 増分設定11595142
Ref: library/logging config incremental-configuration11595293
Ref: 324e11595293
Ref: library/logging config logging-config-dict-incremental11595293
Ref: 324d11595293
Node: オブジェクトの接続11597041
Ref: library/logging config logging-config-dict-connections11597198
Ref: 324a11597198
Ref: library/logging config object-connections11597198
Ref: 324f11597198
Node: ユーザ定義オブジェクト11600003
Ref: library/logging config logging-config-dict-userdef11600175
Ref: 324811600175
Ref: library/logging config user-defined-objects11600175
Ref: 325011600175
Node: ハンドラの設定順序11605883
Ref: library/logging config handler-config-dict-order11606070
Ref: 325111606070
Ref: library/logging config handler-configuration-order11606070
Ref: 325211606070
Node: 外部オブジェクトへのアクセス11607374
Ref: library/logging config access-to-external-objects11607570
Ref: 325311607570
Ref: library/logging config logging-config-dict-externalobj11607570
Ref: 325411607570
Node: 内部オブジェクトへのアクセス11609059
Ref: library/logging config access-to-internal-objects11609282
Ref: 325511609282
Ref: library/logging config logging-config-dict-internalobj11609282
Ref: 325611609282
Node: インポート解決とカスタムインポーター11613166
Ref: library/logging config import-resolution-and-custom-importers11613389
Ref: 325811613389
Ref: library/logging config logging-import-resolution11613389
Ref: 325911613389
Node: Configuring QueueHandler and QueueListener11614662
Ref: library/logging config configure-queue11614834
Ref: 19a611614834
Ref: library/logging config configuring-queuehandler-and-queuelistener11614834
Ref: 325a11614834
Node: 環境設定ファイルの書式11618067
Ref: library/logging config configuration-file-format11618222
Ref: 325f11618222
Ref: library/logging config logging-config-fileformat11618222
Ref: 324411618222
Node: logging handlers --- ログ記録ハンドラー11627243
Ref: library/logging handlers doc11627522
Ref: 326011627522
Ref: library/logging handlers logging-handlers-logging-handlers11627522
Ref: 326111627522
Ref: library/logging handlers module-logging handlers11627522
Ref: 8d11627522
Ref: library/logging handlers translation-repo11627522
Ref: 326211627522
Ref: logging handlers --- ログ記録ハンドラー-Footnote-111628829
Node: StreamHandler11628906
Ref: library/logging handlers stream-handler11629024
Ref: 326311629024
Ref: library/logging handlers streamhandler11629024
Ref: 326411629024
Ref: library/logging handlers logging StreamHandler11629479
Ref: 141511629479
Ref: library/logging handlers logging StreamHandler emit11629821
Ref: 326511629821
Ref: library/logging handlers logging StreamHandler flush11630289
Ref: 326711630289
Ref: library/logging handlers logging StreamHandler setStream11630683
Ref: d4b11630683
Ref: library/logging handlers logging StreamHandler terminator11631191
Ref: 326611631191
Node: FileHandler11631753
Ref: library/logging handlers file-handler11631891
Ref: 326811631891
Ref: library/logging handlers filehandler11631891
Ref: 326911631891
Ref: library/logging handlers logging FileHandler11632191
Ref: 1cb011632191
Ref: library/logging handlers logging FileHandler close11633065
Ref: 326b11633065
Ref: library/logging handlers logging FileHandler emit11633140
Ref: 326a11633140
Ref: FileHandler-Footnote-111633544
Node: NullHandler11633609
Ref: library/logging handlers null-handler11633752
Ref: 326c11633752
Ref: library/logging handlers nullhandler11633752
Ref: 326d11633752
Ref: library/logging handlers logging NullHandler11634065
Ref: 14a011634065
Ref: library/logging handlers logging NullHandler emit11634190
Ref: 326e11634190
Ref: library/logging handlers logging NullHandler handle11634282
Ref: 326f11634282
Ref: library/logging handlers logging NullHandler createLock11634376
Ref: 327011634376
Node: WatchedFileHandler11634742
Ref: library/logging handlers watched-file-handler11634893
Ref: 327211634893
Ref: library/logging handlers watchedfilehandler11634893
Ref: 327311634893
Ref: library/logging handlers logging handlers WatchedFileHandler11636285
Ref: 327411636285
Ref: library/logging handlers logging handlers WatchedFileHandler reopenIfNeeded11637171
Ref: eb811637171
Ref: library/logging handlers logging handlers WatchedFileHandler emit11637536
Ref: 327511637536
Node: BaseRotatingHandler11637781
Ref: library/logging handlers base-rotating-handler11637940
Ref: 327611637940
Ref: library/logging handlers baserotatinghandler11637940
Ref: 327711637940
Ref: library/logging handlers logging handlers BaseRotatingHandler11638323
Ref: 327811638323
Ref: library/logging handlers logging handlers BaseRotatingHandler namer11638534
Ref: 327911638534
Ref: library/logging handlers logging handlers BaseRotatingHandler rotator11640759
Ref: 327c11640759
Ref: library/logging handlers logging handlers BaseRotatingHandler rotation_filename11641076
Ref: 327a11641076
Ref: library/logging handlers logging handlers BaseRotatingHandler rotate11641817
Ref: 327d11641817
Node: RotatingFileHandler11643442
Ref: library/logging handlers rotating-file-handler11643607
Ref: 327f11643607
Ref: library/logging handlers rotatingfilehandler11643607
Ref: 328011643607
Ref: library/logging handlers logging handlers RotatingFileHandler11643794
Ref: 19a111643794
Ref: library/logging handlers logging handlers RotatingFileHandler doRollover11646512
Ref: 328211646512
Ref: library/logging handlers logging handlers RotatingFileHandler emit11646625
Ref: 328111646625
Ref: library/logging handlers logging handlers RotatingFileHandler shouldRollover11646791
Ref: 328311646791
Node: TimedRotatingFileHandler11646945
Ref: library/logging handlers timed-rotating-file-handler11647104
Ref: 328411647104
Ref: library/logging handlers timedrotatingfilehandler11647104
Ref: 328511647104
Ref: library/logging handlers logging handlers TimedRotatingFileHandler11647333
Ref: 116711647333
Ref: library/logging handlers logging handlers TimedRotatingFileHandler doRollover11653353
Ref: 328711653353
Ref: library/logging handlers logging handlers TimedRotatingFileHandler emit11653466
Ref: 328611653466
Ref: library/logging handlers logging handlers TimedRotatingFileHandler getFilesToDelete11653641
Ref: 327b11653641
Ref: library/logging handlers logging handlers TimedRotatingFileHandler shouldRollover11653962
Ref: 328811653962
Node: SocketHandler11654132
Ref: library/logging handlers socket-handler11654287
Ref: 328911654287
Ref: library/logging handlers sockethandler11654287
Ref: 328a11654287
Ref: library/logging handlers logging handlers SocketHandler11654496
Ref: 116811654496
Ref: library/logging handlers logging handlers SocketHandler close11655005
Ref: 328b11655005
Ref: library/logging handlers logging handlers SocketHandler emit11655080
Ref: 328c11655080
Ref: library/logging handlers logging handlers SocketHandler handleError11655613
Ref: 328d11655613
Ref: library/logging handlers logging handlers SocketHandler makeSocket11655895
Ref: 328e11655895
Ref: library/logging handlers logging handlers SocketHandler makePickle11656204
Ref: 328f11656204
Ref: library/logging handlers logging handlers SocketHandler send11657239
Ref: 329011657239
Ref: library/logging handlers logging handlers SocketHandler createSocket11657655
Ref: 86e11657655
Node: DatagramHandler11659032
Ref: library/logging handlers datagram-handler11659176
Ref: 329111659176
Ref: library/logging handlers datagramhandler11659176
Ref: 329211659176
Ref: library/logging handlers logging handlers DatagramHandler11659409
Ref: 116911659409
Ref: library/logging handlers logging handlers DatagramHandler emit11660736
Ref: 329311660736
Ref: library/logging handlers logging handlers DatagramHandler makeSocket11661269
Ref: 329411661269
Ref: library/logging handlers logging handlers DatagramHandler send11661516
Ref: 329511661516
Node: SysLogHandler11661799
Ref: library/logging handlers syslog-handler11661947
Ref: 329611661947
Ref: library/logging handlers sysloghandler11661947
Ref: 329711661947
Ref: library/logging handlers logging handlers SysLogHandler11662148
Ref: 86d11662148
Ref: library/logging handlers logging handlers SysLogHandler close11664873
Ref: 329811664873
Ref: library/logging handlers logging handlers SysLogHandler createSocket11664969
Ref: 86c11664969
Ref: library/logging handlers logging handlers SysLogHandler emit11665424
Ref: 329911665424
Ref: library/logging handlers logging handlers SysLogHandler encodePriority11667866
Ref: 329a11667866
Ref: library/logging handlers logging handlers SysLogHandler mapPriority11672033
Ref: 329b11672033
Ref: SysLogHandler-Footnote-111672675
Ref: SysLogHandler-Footnote-211672730
Ref: SysLogHandler-Footnote-311672795
Ref: SysLogHandler-Footnote-411672854
Node: NTEventLogHandler11672919
Ref: library/logging handlers nt-eventlog-handler11673063
Ref: 329c11673063
Ref: library/logging handlers nteventloghandler11673063
Ref: 329d11673063
Ref: library/logging handlers logging handlers NTEventLogHandler11673391
Ref: 329e11673391
Ref: library/logging handlers logging handlers NTEventLogHandler close11674600
Ref: 329f11674600
Ref: library/logging handlers logging handlers NTEventLogHandler emit11675186
Ref: 32a011675186
Ref: library/logging handlers logging handlers NTEventLogHandler getEventCategory11675386
Ref: 32a111675386
Ref: library/logging handlers logging handlers NTEventLogHandler getEventType11675716
Ref: 32a211675716
Ref: library/logging handlers logging handlers NTEventLogHandler getMessageID11676454
Ref: 32a311676454
Node: SMTPHandler11676959
Ref: library/logging handlers smtp-handler11677103
Ref: 32a411677103
Ref: library/logging handlers smtphandler11677103
Ref: 32a511677103
Ref: library/logging handlers logging handlers SMTPHandler11677295
Ref: 191411677295
Ref: library/logging handlers logging handlers SMTPHandler emit11678921
Ref: 32a611678921
Ref: library/logging handlers logging handlers SMTPHandler getSubject11679049
Ref: 32a711679049
Node: MemoryHandler11679248
Ref: library/logging handlers memory-handler11679386
Ref: 32a811679386
Ref: library/logging handlers memoryhandler11679386
Ref: 32a911679386
Ref: library/logging handlers logging handlers BufferingHandler11680250
Ref: 32aa11680250
Ref: library/logging handlers logging handlers BufferingHandler emit11680488
Ref: 32ab11680488
Ref: library/logging handlers logging handlers BufferingHandler flush11680743
Ref: 32ad11680743
Ref: library/logging handlers logging handlers BufferingHandler shouldFlush11680979
Ref: 32ac11680979
Ref: library/logging handlers logging handlers MemoryHandler11681268
Ref: 325711681268
Ref: library/logging handlers logging handlers MemoryHandler close11682389
Ref: 32af11682389
Ref: library/logging handlers logging handlers MemoryHandler flush11682562
Ref: 32b011682562
Ref: library/logging handlers logging handlers MemoryHandler setTarget11682869
Ref: 32ae11682869
Ref: library/logging handlers logging handlers MemoryHandler shouldFlush11682993
Ref: 32b111682993
Node: HTTPHandler11683186
Ref: library/logging handlers http-handler11683325
Ref: 32b211683325
Ref: library/logging handlers httphandler11683325
Ref: 32b311683325
Ref: library/logging handlers logging handlers HTTPHandler11683552
Ref: 103011683552
Ref: library/logging handlers logging handlers HTTPHandler mapLogRecord11684684
Ref: 32b411684684
Ref: library/logging handlers logging handlers HTTPHandler emit11685255
Ref: 32b511685255
Node: QueueHandler11686217
Ref: library/logging handlers queue-handler11686356
Ref: 32b611686356
Ref: library/logging handlers queuehandler11686356
Ref: 32b711686356
Ref: library/logging handlers logging handlers QueueHandler11687265
Ref: 1bc011687265
Ref: library/logging handlers logging handlers QueueHandler emit11688649
Ref: 32ba11688649
Ref: library/logging handlers logging handlers QueueHandler prepare11689151
Ref: 32bb11689151
Ref: library/logging handlers logging handlers QueueHandler enqueue11692000
Ref: 32b811692000
Ref: library/logging handlers logging handlers QueueHandler listener11692328
Ref: 325b11692328
Node: QueueListener11692623
Ref: library/logging handlers queue-listener11692742
Ref: 32bc11692742
Ref: library/logging handlers queuelistener11692742
Ref: 32bd11692742
Ref: library/logging handlers logging handlers QueueListener11693925
Ref: 24411693925
Ref: library/logging handlers logging handlers QueueListener dequeue11695877
Ref: 32be11695877
Ref: library/logging handlers logging handlers QueueListener prepare11696323
Ref: 32bf11696323
Ref: library/logging handlers logging handlers QueueListener handle11696775
Ref: 32c011696775
Ref: library/logging handlers logging handlers QueueListener start11697109
Ref: 24511697109
Ref: library/logging handlers logging handlers QueueListener stop11697473
Ref: 32c111697473
Ref: library/logging handlers logging handlers QueueListener enqueue_sentinel11697883
Ref: 32c211697883
Node: platform --- 実行中プラットフォームの固有情報を参照する11698547
Ref: library/platform doc11698830
Ref: 32c311698830
Ref: library/platform module-platform11698830
Ref: af11698830
Ref: library/platform platform-access-to-underlying-platform-s-identifying-data11698830
Ref: 32c411698830
Ref: library/platform translation-repo11698830
Ref: 32c511698830
Ref: platform --- 実行中プラットフォームの固有情報を参照する-Footnote-111699538
Node: Cross platform11699606
Ref: library/platform cross-platform11699755
Ref: 32c611699755
Ref: library/platform platform architecture11699804
Ref: 1a6811699804
Ref: library/platform platform machine11701463
Ref: 32c711701463
Ref: library/platform platform node11701706
Ref: 32c811701706
Ref: library/platform platform platform11701923
Ref: 1b2711701923
Ref: library/platform platform processor11703122
Ref: 32ca11703122
Ref: library/platform platform python_build11703512
Ref: 32cb11703512
Ref: library/platform platform python_compiler11703662
Ref: 32cc11703662
Ref: library/platform platform python_branch11703818
Ref: 32cd11703818
Ref: library/platform platform python_implementation11703981
Ref: 32ce11703981
Ref: library/platform platform python_revision11704177
Ref: 32cf11704177
Ref: library/platform platform python_version11704345
Ref: 32d011704345
Ref: library/platform platform python_version_tuple11704614
Ref: 32d111704614
Ref: library/platform platform release11704903
Ref: 32d211704903
Ref: library/platform platform system11705095
Ref: 22c311705095
Ref: library/platform platform system_alias11705530
Ref: 32c911705530
Ref: library/platform platform version11705818
Ref: 32d311705818
Ref: library/platform platform uname11706143
Ref: 1e6f11706143
Ref: library/platform platform invalidate_caches11706968
Ref: 27f11706968
Node: Java platform11707287
Ref: library/platform java-platform11707461
Ref: 32d411707461
Ref: library/platform platform java_ver11707508
Ref: 32a11707508
Node: Windows platform11708156
Ref: library/platform windows-platform11708330
Ref: 32d511708330
Ref: library/platform platform win32_ver11708383
Ref: 1da811708383
Ref: library/platform platform win32_edition11709212
Ref: 32d611709212
Ref: library/platform platform win32_is_iot11709543
Ref: 32d711709543
Node: macOS platform11709770
Ref: library/platform macos-platform11709943
Ref: 32d811709943
Ref: library/platform platform mac_ver11709992
Ref: 1e7111709992
Node: iOS platform11710390
Ref: library/platform ios-platform11710561
Ref: 32d911710561
Ref: library/platform platform ios_ver11710606
Ref: 22c211710606
Node: Unix platforms11711571
Ref: library/platform unix-platforms11711743
Ref: 32da11711743
Ref: library/platform platform libc_ver11711792
Ref: 185b11711792
Node: Linux platforms11712587
Ref: library/platform linux-platforms11712763
Ref: 32db11712763
Ref: library/platform platform freedesktop_os_release11712814
Ref: a2b11712814
Ref: Linux platforms-Footnote-111714307
Node: Android platform11714380
Ref: library/platform android-platform11714578
Ref: 32dc11714578
Ref: library/platform platform android_ver11714631
Ref: 1a2311714631
Ref: Android platform-Footnote-111715810
Ref: Android platform-Footnote-211715889
Ref: Android platform-Footnote-311715960
Ref: Android platform-Footnote-411716032
Node: コマンドラインでの使用<3>11716106
Ref: library/platform command-line-usage11716280
Ref: 32dd11716280
Ref: library/platform platform-cli11716280
Ref: 32de11716280
Ref: library/platform cmdoption-platform-terse11716576
Ref: 32df11716576
Ref: library/platform cmdoption-platform-nonaliased11716766
Ref: 32e011716766
Node: errno --- 標準の errno システムシンボル11717160
Ref: library/errno doc11717446
Ref: 32e111717446
Ref: library/errno errno-standard-errno-system-symbols11717446
Ref: 32e211717446
Ref: library/errno module-errno11717446
Ref: 5b11717446
Ref: library/errno translation-repo11717446
Ref: 32e311717446
Ref: library/errno errno errorcode11717944
Ref: 32e411717944
Ref: library/errno errno EPERM11718683
Ref: 1bb511718683
Ref: library/errno errno ENOENT11718814
Ref: 276011718814
Ref: library/errno errno ESRCH11718950
Ref: 276411718950
Ref: library/errno errno EINTR11719077
Ref: f8b11719077
Ref: library/errno errno EIO11719209
Ref: 32e511719209
Ref: library/errno errno ENXIO11719273
Ref: 32e611719273
Ref: library/errno errno E2BIG11719410
Ref: 32e711719410
Ref: library/errno errno ENOEXEC11719498
Ref: 32e811719498
Ref: library/errno errno EBADF11719594
Ref: b5811719594
Ref: library/errno errno ECHILD11719689
Ref: 275911719689
Ref: library/errno errno EAGAIN11719819
Ref: 275411719819
Ref: library/errno errno ENOMEM11719937
Ref: 32e911719937
Ref: library/errno errno EACCES11720022
Ref: 276311720022
Ref: library/errno errno EFAULT11720148
Ref: 32ea11720148
Ref: library/errno errno ENOTBLK11720225
Ref: 32eb11720225
Ref: library/errno errno EBUSY11720325
Ref: 32ec11720325
Ref: library/errno errno EEXIST11720443
Ref: 275f11720443
Ref: library/errno errno EXDEV11720564
Ref: 30ba11720564
Ref: library/errno errno ENODEV11720661
Ref: 32ed11720661
Ref: library/errno errno ENOTDIR11720759
Ref: 276211720759
Ref: library/errno errno EISDIR11720888
Ref: 276111720888
Ref: library/errno errno EINVAL11721014
Ref: 1e2e11721014
Ref: library/errno errno ENFILE11721090
Ref: 32ee11721090
Ref: library/errno errno EMFILE11721208
Ref: 32ef11721208
Ref: library/errno errno ENOTTY11721308
Ref: 32f011721308
Ref: library/errno errno ETXTBSY11721402
Ref: 32f111721402
Ref: library/errno errno EFBIG11721498
Ref: 32f211721498
Ref: library/errno errno ENOSPC11721583
Ref: 32f311721583
Ref: library/errno errno ESPIPE11721687
Ref: 32f411721687
Ref: library/errno errno EROFS11721762
Ref: 32f511721762
Ref: library/errno errno EMLINK11721875
Ref: 32f611721875
Ref: library/errno errno EPIPE11721955
Ref: 275a11721955
Ref: library/errno errno EDOM11722075
Ref: 32f711722075
Ref: library/errno errno ERANGE11722206
Ref: 32f811722206
Ref: library/errno errno EDEADLK11722333
Ref: 32f911722333
Ref: library/errno errno ENAMETOOLONG11722450
Ref: 32fa11722450
Ref: library/errno errno ENOLCK11722546
Ref: 32fb11722546
Ref: library/errno errno ENOSYS11722661
Ref: 1bb611722661
Ref: library/errno errno ENOTEMPTY11722760
Ref: 32fc11722760
Ref: library/errno errno ELOOP11722866
Ref: 32fd11722866
Ref: library/errno errno EWOULDBLOCK11723007
Ref: 275611723007
Ref: library/errno errno ENOMSG11723142
Ref: 32fe11723142
Ref: library/errno errno EIDRM11723261
Ref: 32ff11723261
Ref: library/errno errno ECHRNG11723350
Ref: 330011723350
Ref: library/errno errno EL2NSYNC11723461
Ref: 330111723461
Ref: library/errno errno EL3HLT11723571
Ref: 330211723571
Ref: library/errno errno EL3RST11723657
Ref: 330311723657
Ref: library/errno errno ELNRNG11723748
Ref: 330411723748
Ref: library/errno errno EUNATCH11723856
Ref: 330511723856
Ref: library/errno errno ENOCSI11723986
Ref: 330611723986
Ref: library/errno errno EL2HLT11724082
Ref: 330711724082
Ref: library/errno errno EBADE11724168
Ref: 330811724168
Ref: library/errno errno EBADR11724243
Ref: 330911724243
Ref: library/errno errno EXFULL11724337
Ref: 330a11724337
Ref: library/errno errno ENOANO11724422
Ref: 330b11724422
Ref: library/errno errno EBADRQC11724493
Ref: 330c11724493
Ref: library/errno errno EBADSLT11724592
Ref: 330d11724592
Ref: library/errno errno EDEADLOCK11724671
Ref: 330e11724671
Ref: library/errno errno EBFONT11724811
Ref: 330f11724811
Ref: library/errno errno ENOSTR11724924
Ref: 331011724924
Ref: library/errno errno ENODATA11725027
Ref: 331111725027
Ref: library/errno errno ETIME11725126
Ref: 331211725126
Ref: library/errno errno ENOSR11725195
Ref: 331311725195
Ref: library/errno errno ENONET11725308
Ref: 331411725308
Ref: library/errno errno ENOPKG11725427
Ref: 331511725427
Ref: library/errno errno EREMOTE11725544
Ref: 331611725544
Ref: library/errno errno ENOLINK11725633
Ref: 331711725633
Ref: library/errno errno EADV11725724
Ref: 331811725724
Ref: library/errno errno ESRMNT11725801
Ref: 331911725801
Ref: library/errno errno ECOMM11725876
Ref: 331a11725876
Ref: library/errno errno EPROTO11725974
Ref: 331b11725974
Ref: library/errno errno EMULTIHOP11726057
Ref: 331c11726057
Ref: library/errno errno EDOTDOT11726150
Ref: 331d11726150
Ref: library/errno errno EBADMSG11726236
Ref: 331e11726236
Ref: library/errno errno EOVERFLOW11726339
Ref: 331f11726339
Ref: library/errno errno ENOTUNIQ11726486
Ref: 332011726486
Ref: library/errno errno EBADFD11726610
Ref: 332111726610
Ref: library/errno errno EREMCHG11726722
Ref: 332211726722
Ref: library/errno errno ELIBACC11726829
Ref: 332311726829
Ref: library/errno errno ELIBBAD11726972
Ref: 332411726972
Ref: library/errno errno ELIBSCN11727113
Ref: 332511727113
Ref: library/errno errno ELIBMAX11727240
Ref: 332611727240
Ref: library/errno errno ELIBEXEC11727392
Ref: 332711727392
Ref: library/errno errno EILSEQ11727541
Ref: 332811727541
Ref: library/errno errno ERESTART11727628
Ref: 332911727628
Ref: library/errno errno ESTRPIPE11727789
Ref: 332a11727789
Ref: library/errno errno EUSERS11727890
Ref: 332b11727890
Ref: library/errno errno ENOTSOCK11727970
Ref: 332c11727970
Ref: library/errno errno EDESTADDRREQ11728092
Ref: 332d11728092
Ref: library/errno errno EMSGSIZE11728198
Ref: 332e11728198
Ref: library/errno errno EPROTOTYPE11728288
Ref: 332f11728288
Ref: library/errno errno ENOPROTOOPT11728423
Ref: 333011728423
Ref: library/errno errno EPROTONOSUPPORT11728528
Ref: 333111728528
Ref: library/errno errno ESOCKTNOSUPPORT11728649
Ref: 333211728649
Ref: library/errno errno EOPNOTSUPP11728773
Ref: 333311728773
Ref: library/errno errno ENOTSUP11728932
Ref: 333411728932
Ref: library/errno errno EPFNOSUPPORT11729020
Ref: 333511729020
Ref: library/errno errno EAFNOSUPPORT11729162
Ref: 333611729162
Ref: library/errno errno EADDRINUSE11729330
Ref: 333711729330
Ref: library/errno errno EADDRNOTAVAIL11729425
Ref: 333811729425
Ref: library/errno errno ENETDOWN11729564
Ref: 333911729564
Ref: library/errno errno ENETUNREACH11729665
Ref: 1e4611729665
Ref: library/errno errno ENETRESET11729773
Ref: 333a11729773
Ref: library/errno errno ECONNABORTED11729932
Ref: 275c11729932
Ref: library/errno errno ECONNRESET11730087
Ref: 275e11730087
Ref: library/errno errno ENOBUFS11730230
Ref: 1bd011730230
Ref: library/errno errno EISCONN11730334
Ref: 333b11730334
Ref: library/errno errno ENOTCONN11730466
Ref: 333c11730466
Ref: library/errno errno ESHUTDOWN11730584
Ref: 275b11730584
Ref: library/errno errno ETOOMANYREFS11730742
Ref: 333d11730742
Ref: library/errno errno ETIMEDOUT11730873
Ref: 276511730873
Ref: library/errno errno ECONNREFUSED11731002
Ref: 275d11731002
Ref: library/errno errno EHOSTDOWN11731143
Ref: 333e11731143
Ref: library/errno errno EHOSTUNREACH11731245
Ref: 333f11731245
Ref: library/errno errno EHWPOISON11731345
Ref: 20d11731345
Ref: library/errno errno EALREADY11731444
Ref: 275511731444
Ref: library/errno errno EINPROGRESS11731584
Ref: 275711731584
Ref: library/errno errno ESTALE11731723
Ref: 334011731723
Ref: library/errno errno EUCLEAN11731827
Ref: 334111731827
Ref: library/errno errno ENOTNAM11731933
Ref: 334211731933
Ref: library/errno errno ENAVAIL11732051
Ref: 334311732051
Ref: library/errno errno EISNAM11732162
Ref: 334411732162
Ref: library/errno errno EREMOTEIO11732251
Ref: 334511732251
Ref: library/errno errno EDQUOT11732341
Ref: 334611732341
Ref: library/errno errno EQFULL11732436
Ref: 334711732436
Ref: library/errno errno ENOMEDIUM11732531
Ref: 334811732531
Ref: library/errno errno EMEDIUMTYPE11732585
Ref: 334911732585
Ref: library/errno errno ENOKEY11732643
Ref: 334a11732643
Ref: library/errno errno EKEYEXPIRED11732705
Ref: 334b11732705
Ref: library/errno errno EKEYREVOKED11732761
Ref: 334c11732761
Ref: library/errno errno EKEYREJECTED11732822
Ref: 334d11732822
Ref: library/errno errno ERFKILL11732891
Ref: 334e11732891
Ref: library/errno errno ELOCKUNMAPPED11732965
Ref: 334f11732965
Ref: library/errno errno ENOTACTIVE11733032
Ref: 335011733032
Ref: library/errno errno EAUTH11733094
Ref: 335111733094
Ref: library/errno errno EBADARCH11733177
Ref: 335211733177
Ref: library/errno errno EBADEXEC11733269
Ref: 335311733269
Ref: library/errno errno EBADMACHO11733369
Ref: 335411733369
Ref: library/errno errno EDEVERR11733457
Ref: 335511733457
Ref: library/errno errno EFTYPE11733534
Ref: 335611733534
Ref: library/errno errno ENEEDAUTH11733631
Ref: 335711733631
Ref: library/errno errno ENOATTR11733716
Ref: 335811733716
Ref: library/errno errno ENOPOLICY11733800
Ref: 335911733800
Ref: library/errno errno EPROCLIM11733883
Ref: 335a11733883
Ref: library/errno errno EPROCUNAVAIL11733967
Ref: 335b11733967
Ref: library/errno errno EPROGMISMATCH11734062
Ref: 335c11734062
Ref: library/errno errno EPROGUNAVAIL11734154
Ref: 335d11734154
Ref: library/errno errno EPWROFF11734244
Ref: 335e11734244
Ref: library/errno errno EBADRPC11734328
Ref: 335f11734328
Ref: library/errno errno ERPCMISMATCH11734410
Ref: 336011734410
Ref: library/errno errno ESHLIBVERS11734497
Ref: 336111734497
Ref: library/errno errno ENOTCAPABLE11734596
Ref: 1b9e11734596
Ref: library/errno errno ECANCELED11734813
Ref: 182d11734813
Ref: library/errno errno EOWNERDEAD11734898
Ref: 336211734898
Ref: library/errno errno ENOTRECOVERABLE11734976
Ref: 336311734976
Node: ctypes --- Python 用の外部関数ライブラリ11735070
Ref: library/ctypes doc11735271
Ref: 336411735271
Ref: library/ctypes ctypes-a-foreign-function-library-for-python11735271
Ref: 336511735271
Ref: library/ctypes module-ctypes11735271
Ref: 2e11735271
Ref: library/ctypes translation-repo11735271
Ref: 336611735271
Ref: ctypes --- Python 用の外部関数ライブラリ-Footnote-111736409
Node: ctypes チュートリアル11736472
Ref: library/ctypes ctypes-ctypes-tutorial11736621
Ref: 336711736621
Ref: library/ctypes ctypes-tutorial11736621
Ref: 336811736621
Node: 動的リンクライブラリをロードする11738172
Ref: library/ctypes ctypes-loading-dynamic-link-libraries11738345
Ref: 336b11738345
Ref: library/ctypes loading-dynamic-link-libraries11738345
Ref: 336c11738345
Node: ロードしたdllから関数にアクセスする11740914
Ref: library/ctypes accessing-functions-from-loaded-dlls11741117
Ref: 337111741117
Ref: library/ctypes ctypes-accessing-functions-from-loaded-dlls11741117
Ref: 337211741117
Node: 関数を呼び出す11743648
Ref: library/ctypes calling-functions11743821
Ref: 337311743821
Ref: library/ctypes ctypes-calling-functions11743821
Ref: 337411743821
Node: 基本データ型11746211
Ref: library/ctypes ctypes-fundamental-data-types11746360
Ref: 289211746360
Ref: library/ctypes fundamental-data-types11746360
Ref: 337511746360
Node: 続・関数を呼び出す11760382
Ref: library/ctypes calling-functions-continued11760536
Ref: 338c11760536
Ref: library/ctypes ctypes-calling-functions-continued11760536
Ref: 338d11760536
Node: Calling variadic functions11761698
Ref: library/ctypes calling-variadic-functions11761888
Ref: 338e11761888
Ref: library/ctypes ctypes-calling-variadic-functions11761888
Ref: 338f11761888
Node: 自作のデータ型とともに関数を呼び出す11762583
Ref: library/ctypes calling-functions-with-your-own-custom-data-types11762813
Ref: 339011762813
Ref: library/ctypes ctypes-calling-functions-with-own-custom-data-types11762813
Ref: 339111762813
Node: 要求される引数の型を指定する 関数プロトタイプ11763702
Ref: library/ctypes ctypes-specifying-required-argument-types11763921
Ref: 339211763921
Ref: library/ctypes specifying-the-required-argument-types-function-prototypes11763921
Ref: 339311763921
Node: 戻り値の型11765829
Ref: library/ctypes ctypes-return-types11766058
Ref: 339511766058
Ref: library/ctypes return-types11766058
Ref: 339611766058
Node: ポインタを渡す または、パラメータの参照渡し11769297
Ref: library/ctypes ctypes-passing-pointers11769480
Ref: 339a11769480
Ref: library/ctypes passing-pointers-or-passing-parameters-by-reference11769480
Ref: 339b11769480
Node: 構造体と共用体11770680
Ref: library/ctypes ctypes-structures-unions11770895
Ref: 339d11770895
Ref: library/ctypes structures-and-unions11770895
Ref: 339e11770895
Ref: library/ctypes ctypes-structureunion-alignment-byte-order11773162
Ref: 339f11773162
Node: Structure/union layout alignment and byte order11773482
Ref: library/ctypes structure-union-layout-alignment-and-byte-order11773690
Ref: 33a011773690
Node: 構造体と共用体におけるビットフィールド11774642
Ref: library/ctypes bit-fields-in-structures-and-unions11774838
Ref: 33a311774838
Ref: library/ctypes ctypes-bit-fields-in-structures-unions11774838
Ref: 1e611774838
Node: 配列<2>11775865
Ref: library/ctypes arrays11776026
Ref: 33a411776026
Ref: library/ctypes ctypes-arrays11776026
Ref: 33a511776026
Node: ポインタ11777457
Ref: library/ctypes ctypes-pointers11777590
Ref: 33a611777590
Ref: library/ctypes pointers11777590
Ref: 33a711777590
Node: Thread safety without the GIL11780566
Ref: library/ctypes ctypes-thread-safety11780699
Ref: 33a911780699
Ref: library/ctypes thread-safety-without-the-gil11780699
Ref: 33aa11780699
Node: 型変換11781707
Ref: library/ctypes ctypes-type-conversions11781840
Ref: 33ab11781840
Ref: library/ctypes type-conversions11781840
Ref: 33ac11781840
Node: 不完全型11784671
Ref: library/ctypes ctypes-incomplete-types11784799
Ref: 31a11784799
Ref: library/ctypes incomplete-types11784799
Ref: 33ae11784799
Node: コールバック関数11786495
Ref: library/ctypes callback-functions11786674
Ref: 33af11786674
Ref: library/ctypes ctypes-callback-functions11786674
Ref: 33b011786674
Node: dllからエクスポートされた値へアクセスする11791030
Ref: library/ctypes accessing-values-exported-from-dlls11791215
Ref: 33b311791215
Ref: library/ctypes ctypes-accessing-values-exported-from-dlls11791215
Ref: 33b411791215
Node: びっくり仰天11794437
Ref: library/ctypes ctypes-surprises11794628
Ref: 33b711794628
Ref: library/ctypes surprises11794628
Ref: 33b811794628
Node: 可変サイズのデータ型11797355
Ref: library/ctypes ctypes-variable-sized-data-types11797477
Ref: 33b911797477
Ref: library/ctypes variable-sized-data-types11797477
Ref: 33ba11797477
Node: ctypesリファレンス11799102
Ref: library/ctypes ctypes-ctypes-reference11799251
Ref: 33bc11799251
Ref: library/ctypes ctypes-reference11799251
Ref: 33bd11799251
Node: 共有ライブラリを見つける11799680
Ref: library/ctypes ctypes-finding-shared-libraries11799817
Ref: 33be11799817
Ref: library/ctypes finding-shared-libraries11799817
Ref: 33bf11799817
Node: Listing loaded shared libraries11802583
Ref: library/ctypes ctypes-listing-loaded-shared-libraries11802768
Ref: 33c011802768
Ref: library/ctypes listing-loaded-shared-libraries11802768
Ref: 33c111802768
Node: 共有ライブラリをロードする11803657
Ref: library/ctypes ctypes-loading-shared-libraries11803818
Ref: 33c211803818
Ref: library/ctypes loading-shared-libraries11803818
Ref: 33c311803818
Ref: library/ctypes ctypes CDLL11804049
Ref: be011804049
Ref: library/ctypes ctypes CDLL _handle11809637
Ref: 33c411809637
Ref: library/ctypes ctypes CDLL _name11809756
Ref: 33c511809756
Ref: library/ctypes ctypes OleDLL11809858
Ref: 1b4111809858
Ref: library/ctypes ctypes WinDLL11810526
Ref: 1b4211810526
Ref: library/ctypes ctypes PyDLL11810788
Ref: 1b4311810788
Ref: library/ctypes ctypes RTLD_GLOBAL11811204
Ref: 33cb11811204
Ref: library/ctypes ctypes RTLD_LOCAL11811415
Ref: 33cc11811415
Ref: library/ctypes ctypes DEFAULT_MODE11811604
Ref: 33cd11811604
Ref: library/ctypes ctypes LibraryLoader11812099
Ref: 33ce11812099
Ref: library/ctypes ctypes LibraryLoader LoadLibrary11812607
Ref: 337011812607
Ref: library/ctypes ctypes cdll11812946
Ref: 336d11812946
Ref: library/ctypes ctypes windll11813034
Ref: 336e11813034
Ref: library/ctypes ctypes oledll11813150
Ref: 336f11813150
Ref: library/ctypes ctypes pydll11813266
Ref: 33cf11813266
Ref: library/ctypes ctypes pythonapi11813457
Ref: 33c611813457
Ref: 共有ライブラリをロードする-Footnote-111814406
Ref: 共有ライブラリをロードする-Footnote-211814452
Ref: 共有ライブラリをロードする-Footnote-311814498
Node: 外部関数11814593
Ref: library/ctypes ctypes-foreign-functions11814747
Ref: 33d011814747
Ref: library/ctypes foreign-functions11814747
Ref: 33d111814747
Ref: library/ctypes ctypes _CFuncPtr11815429
Ref: 193411815429
Ref: library/ctypes ctypes _CFuncPtr restype11815842
Ref: 339711815842
Ref: library/ctypes ctypes _CFuncPtr argtypes11816541
Ref: 182c11816541
Ref: library/ctypes ctypes _CFuncPtr errcheck11817765
Ref: 339911817765
Node: 関数プロトタイプ11819589
Ref: library/ctypes ctypes-function-prototypes11819734
Ref: 33d211819734
Ref: library/ctypes function-prototypes11819734
Ref: 33d311819734
Ref: library/ctypes ctypes CFUNCTYPE11820448
Ref: 33b111820448
Ref: library/ctypes ctypes WINFUNCTYPE11821019
Ref: 33b211821019
Ref: library/ctypes ctypes PYFUNCTYPE11821401
Ref: 33d411821401
Node: ユーティリティー関数11827742
Ref: library/ctypes ctypes-utility-functions11827890
Ref: 33d511827890
Ref: library/ctypes utility-functions11827890
Ref: 33d611827890
Ref: library/ctypes ctypes addressof11827963
Ref: 33d711827963
Ref: library/ctypes ctypes alignment11828280
Ref: 33d811828280
Ref: library/ctypes ctypes byref11828492
Ref: 339c11828492
Ref: library/ctypes ctypes CopyComPointer11829137
Ref: 1ec11829137
Ref: library/ctypes ctypes cast11829733
Ref: 33ad11829733
Ref: library/ctypes ctypes create_string_buffer11830119
Ref: 338b11830119
Ref: library/ctypes ctypes create_unicode_buffer11831677
Ref: 1e1011831677
Ref: library/ctypes ctypes DllCanUnloadNow11832273
Ref: 33d911832273
Ref: library/ctypes ctypes DllGetClassObject11832546
Ref: 33da11832546
Ref: library/ctypes ctypes util find_library11832829
Ref: f4911832829
Ref: library/ctypes ctypes util find_msvcrt11833315
Ref: 33db11833315
Ref: library/ctypes ctypes util dllist11833842
Ref: 1f211833842
Ref: library/ctypes ctypes FormatError11834417
Ref: 33dc11834417
Ref: library/ctypes ctypes GetLastError11834698
Ref: 339811834698
Ref: library/ctypes ctypes get_errno11834994
Ref: 177d11834994
Ref: library/ctypes ctypes get_last_error11835265
Ref: 33c811835265
Ref: library/ctypes ctypes memmove11835583
Ref: 33dd11835583
Ref: library/ctypes ctypes memset11835906
Ref: 33de11835906
Ref: library/ctypes ctypes POINTER11836254
Ref: 1f311836254
Ref: library/ctypes ctypes pointer11836916
Ref: 1ab711836916
Ref: library/ctypes ctypes resize11837256
Ref: 33bb11837256
Ref: library/ctypes ctypes set_errno11837683
Ref: 33c711837683
Ref: library/ctypes ctypes set_last_error11838039
Ref: 33c911838039
Ref: library/ctypes ctypes sizeof11838423
Ref: 33df11838423
Ref: library/ctypes ctypes string_at11838644
Ref: 1ee11838644
Ref: library/ctypes ctypes WinError11838957
Ref: 33e011838957
Ref: library/ctypes ctypes wstring_at11839472
Ref: 33e111839472
Ref: library/ctypes ctypes memoryview_at11839831
Ref: 1ed11839831
Node: データ型<3>11840801
Ref: library/ctypes ctypes-data-types11840946
Ref: 33e311840946
Ref: library/ctypes data-types11840946
Ref: 33e411840946
Ref: library/ctypes ctypes _CData11840989
Ref: 33e511840989
Ref: library/ctypes ctypes _CData from_buffer11841836
Ref: 33e711841836
Ref: library/ctypes ctypes _CData from_buffer_copy11842659
Ref: 33e811842659
Ref: library/ctypes ctypes _CData from_address11843367
Ref: 33e211843367
Ref: library/ctypes ctypes _CData from_param11843797
Ref: 339411843797
Ref: library/ctypes ctypes _CData in_dll11844435
Ref: 33b511844435
Ref: library/ctypes ctypes _CData __pointer_type__11844835
Ref: 1f411844835
Ref: library/ctypes ctypes _CData _b_base_11845167
Ref: 33e911845167
Ref: library/ctypes ctypes _CData _b_needsfree_11845568
Ref: 33ea11845568
Ref: library/ctypes ctypes _CData _objects11845862
Ref: 33e611845862
Node: 基本データ型<2>11846290
Ref: library/ctypes ctypes-fundamental-data-types-211846426
Ref: 33eb11846426
Ref: library/ctypes id111846426
Ref: 33ec11846426
Ref: library/ctypes ctypes _SimpleCData11846479
Ref: 33ed11846479
Ref: library/ctypes ctypes _SimpleCData value11847074
Ref: 33ee11847074
Ref: library/ctypes ctypes _SimpleCData _type_11847814
Ref: 337611847814
Ref: library/ctypes ctypes c_byte11849462
Ref: 1b3f11849462
Ref: library/ctypes ctypes c_char11849739
Ref: 337811849739
Ref: library/ctypes ctypes c_char_p11850026
Ref: 1ab811850026
Ref: library/ctypes ctypes c_double11850446
Ref: 1d1311850446
Ref: library/ctypes ctypes c_longdouble11850626
Ref: 1d1411850626
Ref: library/ctypes ctypes c_float11850951
Ref: 338911850951
Ref: library/ctypes ctypes c_double_complex11851129
Ref: 1f011851129
Ref: library/ctypes ctypes c_float_complex11851335
Ref: 1ef11851335
Ref: library/ctypes ctypes c_longdouble_complex11851539
Ref: 1f111851539
Ref: library/ctypes ctypes c_int11851754
Ref: 336911851754
Ref: library/ctypes ctypes c_int811852109
Ref: 337c11852109
Ref: library/ctypes ctypes c_int1611852234
Ref: 337d11852234
Ref: library/ctypes ctypes c_int3211852385
Ref: 337e11852385
Ref: library/ctypes ctypes c_int6411852534
Ref: 337f11852534
Ref: library/ctypes ctypes c_long11852688
Ref: 336a11852688
Ref: library/ctypes ctypes c_longlong11852919
Ref: 338611852919
Ref: library/ctypes ctypes c_short11853204
Ref: 337a11853204
Ref: library/ctypes ctypes c_size_t11853437
Ref: 338811853437
Ref: library/ctypes ctypes c_ssize_t11853573
Ref: 145811853573
Ref: library/ctypes ctypes c_time_t11853824
Ref: 1bc211853824
Ref: library/ctypes ctypes c_ubyte11853980
Ref: 1b4011853980
Ref: library/ctypes ctypes c_uint11854265
Ref: 338011854265
Ref: library/ctypes ctypes c_uint811854637
Ref: 338111854637
Ref: library/ctypes ctypes c_uint1611854766
Ref: 338211854766
Ref: library/ctypes ctypes c_uint3211854921
Ref: 338311854921
Ref: library/ctypes ctypes c_uint6411855074
Ref: 338411855074
Ref: library/ctypes ctypes c_ulong11855232
Ref: 338511855232
Ref: library/ctypes ctypes c_ulonglong11855466
Ref: 338711855466
Ref: library/ctypes ctypes c_ushort11855754
Ref: 337b11855754
Ref: library/ctypes ctypes c_void_p11855990
Ref: 1aba11855990
Ref: library/ctypes ctypes c_wchar11856196
Ref: 337911856196
Ref: library/ctypes ctypes c_wchar_p11856520
Ref: 1ab911856520
Ref: library/ctypes ctypes c_bool11856778
Ref: 337711856778
Ref: library/ctypes ctypes HRESULT11857057
Ref: 33ca11857057
Ref: library/ctypes ctypes py_object11857249
Ref: 1f511857249
Ref: library/ctypes ctypes-wintypes11857536
Ref: 338a11857536
Ref: 基本データ型<2>-Footnote-111857804
Node: 構造化データ型11857901
Ref: library/ctypes ctypes-structured-data-types11858043
Ref: 33ef11858043
Ref: library/ctypes structured-data-types11858043
Ref: 33f011858043
Ref: library/ctypes ctypes Union11858101
Ref: 1e811858101
Ref: library/ctypes ctypes BigEndianUnion11858369
Ref: 1c1411858369
Ref: library/ctypes ctypes LittleEndianUnion11858568
Ref: 1c1511858568
Ref: library/ctypes ctypes BigEndianStructure11858770
Ref: 33a111858770
Ref: library/ctypes ctypes LittleEndianStructure11858944
Ref: 33a211858944
Ref: library/ctypes ctypes Structure11859362
Ref: 1e711859362
Ref: library/ctypes ctypes Structure _fields_11859823
Ref: 199611859823
Ref: library/ctypes ctypes Structure _pack_11862040
Ref: 31911862040
Ref: library/ctypes ctypes Structure _align_11863136
Ref: 4e811863136
Ref: library/ctypes ctypes Structure _layout_11863969
Ref: 1e911863969
Ref: library/ctypes ctypes Structure _anonymous_11865248
Ref: 33f111865248
Ref: library/ctypes ctypes CField11868007
Ref: 1ea11868007
Ref: library/ctypes ctypes CField name11869172
Ref: 33f211869172
Ref: library/ctypes ctypes CField type11869241
Ref: 33f311869241
Ref: library/ctypes ctypes CField offset11869328
Ref: 33f411869328
Ref: library/ctypes ctypes CField byte_offset11869355
Ref: 33f511869355
Ref: library/ctypes ctypes CField byte_size11869560
Ref: 33f711869560
Ref: library/ctypes ctypes CField size11869785
Ref: 33f811869785
Ref: library/ctypes ctypes CField is_bitfield11870099
Ref: 33fa11870099
Ref: library/ctypes ctypes CField bit_offset11870171
Ref: 33f611870171
Ref: library/ctypes ctypes CField bit_size11870202
Ref: 33f911870202
Ref: library/ctypes ctypes CField is_anonymous11870716
Ref: 33fb11870716
Node: 配列とポインタ11870913
Ref: library/ctypes arrays-and-pointers11871044
Ref: 33fc11871044
Ref: library/ctypes ctypes-arrays-pointers11871044
Ref: 33fd11871044
Ref: library/ctypes ctypes Array11871102
Ref: 1e6911871102
Ref: library/ctypes ctypes Array _length_11871697
Ref: 33fe11871697
Ref: library/ctypes ctypes Array _type_11871950
Ref: 33ff11871950
Ref: library/ctypes ctypes ARRAY11872198
Ref: 59e11872198
Ref: library/ctypes ctypes _Pointer11872490
Ref: 340011872490
Ref: library/ctypes ctypes _Pointer _type_11873382
Ref: 18b511873382
Ref: library/ctypes ctypes _Pointer contents11873464
Ref: 33a811873464
Node: 例外<10>11873697
Ref: library/ctypes ctypes-exceptions11873798
Ref: 340111873798
Ref: library/ctypes exceptions11873798
Ref: 340211873798
Ref: library/ctypes ctypes ArgumentError11873831
Ref: 340311873831
Ref: library/ctypes ctypes COMError11873995
Ref: 1eb11873995
Ref: library/ctypes ctypes COMError hresult11874111
Ref: 340411874111
Ref: library/ctypes ctypes COMError text11874198
Ref: 340511874198
Ref: library/ctypes ctypes COMError details11874254
Ref: 340611874254
Node: コマンドラインインターフェースライブラリ11874777
Ref: library/cmdlinelibs doc11874986
Ref: 340711874986
Ref: library/cmdlinelibs cmdlinelibs11874986
Ref: 340811874986
Ref: library/cmdlinelibs command-line-interface-libraries11874986
Ref: 340911874986
Ref: library/cmdlinelibs translation-repo11874986
Ref: 340a11874986
Node: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー11876500
Ref: library/argparse doc11876750
Ref: 340b11876750
Ref: library/argparse argparse-parser-for-command-line-options-arguments-and-subcommands11876750
Ref: 340c11876750
Ref: library/argparse module-argparse11876750
Ref: 711876750
Ref: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー-Footnote-111880064
Node: ArgumentParser オブジェクト11880132
Ref: library/argparse argumentparser-objects11880336
Ref: 341111880336
Ref: library/argparse argparse ArgumentParser11880417
Ref: 1bf11880417
Node: prog11884008
Ref: library/argparse id111884096
Ref: 341f11884096
Ref: library/argparse prog11884096
Ref: 1be11884096
Node: usage11885827
Ref: library/argparse usage11885935
Ref: 341211885935
Node: description11887002
Ref: library/argparse description11887112
Ref: 341311887112
Ref: library/argparse id211887112
Ref: 342011887112
Node: epilog11887685
Ref: library/argparse epilog11887797
Ref: 341411887797
Node: parents11888593
Ref: library/argparse parents11888709
Ref: 341511888709
Node: formatter_class11890447
Ref: library/argparse formatter-class11890569
Ref: 341611890569
Ref: library/argparse id311890569
Ref: 342111890569
Ref: library/argparse argparse RawDescriptionHelpFormatter11890860
Ref: 342211890860
Ref: library/argparse argparse RawTextHelpFormatter11890912
Ref: 342311890912
Ref: library/argparse argparse ArgumentDefaultsHelpFormatter11890957
Ref: 1cad11890957
Ref: library/argparse argparse MetavarTypeHelpFormatter11891011
Ref: 342411891011
Node: prefix_chars11894490
Ref: library/argparse prefix-chars11894626
Ref: 341711894626
Node: fromfile_prefix_chars11895399
Ref: library/argparse fromfile-prefix-chars11895536
Ref: 341811895536
Node: argument_default11897538
Ref: library/argparse argument-default11897675
Ref: 341911897675
Node: allow_abbrev11898662
Ref: library/argparse allow-abbrev11898794
Ref: fc211898794
Ref: library/argparse id411898794
Ref: 342911898794
Node: conflict_handler11899481
Ref: library/argparse conflict-handler11899605
Ref: 341a11899605
Node: add_help11901423
Ref: library/argparse add-help11901548
Ref: 341b11901548
Node: exit_on_error11902800
Ref: library/argparse exit-on-error11902925
Ref: 341c11902925
Node: suggest_on_error11903837
Ref: library/argparse suggest-on-error11903959
Ref: 341d11903959
Node: color11905270
Ref: library/argparse color11905370
Ref: 341e11905370
Ref: color-Footnote-111906595
Ref: color-Footnote-211906650
Node: add_argument メソッド11906680
Ref: library/argparse the-add-argument-method11906916
Ref: 342a11906916
Ref: library/argparse argparse ArgumentParser add_argument11906989
Ref: 4bc11906989
Node: name または flags11909115
Ref: library/argparse id511909212
Ref: 343011909212
Ref: library/argparse name-or-flags11909212
Ref: 342b11909212
Node: action11911328
Ref: library/argparse action11911439
Ref: 198b11911439
Ref: library/argparse id611911439
Ref: 343111911439
Node: nargs11918106
Ref: library/argparse id711918202
Ref: 343311918202
Ref: library/argparse nargs11918202
Ref: 199111918202
Node: const11922250
Ref: library/argparse const11922347
Ref: 199311922347
Ref: library/argparse id811922347
Ref: 343511922347
Node: default11923770
Ref: library/argparse default11923866
Ref: 199211923866
Ref: library/argparse id911923866
Ref: 343611923866
Node: type11926763
Ref: library/argparse argparse-type11926861
Ref: 343711926861
Ref: library/argparse type11926861
Ref: 342511926861
Node: choices11930580
Ref: library/argparse choices11930679
Ref: 198d11930679
Ref: library/argparse id1011930679
Ref: 343911930679
Node: required11932897
Ref: library/argparse id1111932996
Ref: 343a11932996
Ref: library/argparse required11932996
Ref: 342c11932996
Node: help11934040
Ref: library/argparse help11934139
Ref: 342d11934139
Ref: library/argparse id1211934139
Ref: 343b11934139
Node: metavar11935819
Ref: library/argparse id1311935914
Ref: 343c11935914
Ref: library/argparse metavar11935914
Ref: 342e11935914
Node: dest11938191
Ref: library/argparse dest11938292
Ref: 342611938292
Ref: library/argparse id1411938292
Ref: 343d11938292
Node: deprecated11940328
Ref: library/argparse deprecated11940438
Ref: 342f11940438
Ref: library/argparse id1511940438
Ref: 343e11940438
Node: Action クラス11941350
Ref: library/argparse action-classes11941447
Ref: 343f11941447
Ref: library/argparse argparse Action11941741
Ref: 1bea11941741
Ref: library/argparse argparse Action __call__11942639
Ref: 344011942639
Ref: library/argparse argparse Action format_usage11943939
Ref: 344111943939
Ref: library/argparse argparse BooleanOptionalAction11944253
Ref: 1c4f11944253
Node: parse_args メソッド11944847
Ref: library/argparse the-parse-args-method11945083
Ref: 344211945083
Ref: library/argparse argparse ArgumentParser parse_args11945152
Ref: 340f11945152
Node: オプション値の文法11946192
Ref: library/argparse option-value-syntax11946303
Ref: 344511946303
Node: 不正な引数11947993
Ref: library/argparse invalid-arguments11948130
Ref: 344611948130
Node: - を含む引数11949159
Ref: library/argparse arguments-containing11949321
Ref: 344711949321
Node: 引数の短縮形 先頭文字でのマッチング11951490
Ref: library/argparse argument-abbreviations-prefix-matching11951652
Ref: 344811951652
Ref: library/argparse prefix-matching11951652
Ref: fc311951652
Node: sys argv 以外11952687
Ref: library/argparse args11952860
Ref: 344311952860
Ref: library/argparse beyond-sys-argv11952860
Ref: 344911952860
Node: Namespace オブジェクト11953820
Ref: library/argparse namespace11953932
Ref: 344411953932
Ref: library/argparse the-namespace-object11953932
Ref: 344a11953932
Ref: library/argparse argparse Namespace11954005
Ref: 341011954005
Node: その他のユーティリティ11955294
Ref: library/argparse other-utilities11955515
Ref: 344b11955515
Node: Subcommands11955908
Ref: library/argparse subcommands11956025
Ref: 344c11956025
Ref: library/argparse argparse ArgumentParser add_subparsers11956070
Ref: e1511956070
Node: FileType オブジェクト11966047
Ref: library/argparse filetype-objects11966191
Ref: 344d11966191
Ref: library/argparse argparse FileType11966262
Ref: 30e11966262
Node: 引数グループ11968282
Ref: library/argparse argument-groups11968427
Ref: 344e11968427
Ref: library/argparse argparse ArgumentParser add_argument_group11968480
Ref: 2ed11968480
Node: 相互排他11971490
Ref: library/argparse mutual-exclusion11971641
Ref: 344f11971641
Ref: library/argparse argparse ArgumentParser add_mutually_exclusive_group11971684
Ref: 2ef11971684
Node: パーサーのデフォルト値11974433
Ref: library/argparse parser-defaults11974584
Ref: 345011974584
Ref: library/argparse argparse ArgumentParser set_defaults11974662
Ref: 342811974662
Ref: library/argparse argparse ArgumentParser get_default11976048
Ref: 345111976048
Node: ヘルプの表示11976433
Ref: library/argparse printing-help11976584
Ref: 345211976584
Ref: library/argparse argparse ArgumentParser print_usage11976908
Ref: 345311976908
Ref: library/argparse argparse ArgumentParser print_help11977190
Ref: 345411977190
Ref: library/argparse argparse ArgumentParser format_usage11977627
Ref: 1e0c11977627
Ref: library/argparse argparse ArgumentParser format_help11977834
Ref: 345511977834
Node: 部分解析11978074
Ref: library/argparse partial-parsing11978231
Ref: 345611978231
Ref: library/argparse argparse ArgumentParser parse_known_args11978274
Ref: 345711978274
Node: ファイル解析のカスタマイズ11979522
Ref: library/argparse customizing-file-parsing11979679
Ref: 345811979679
Ref: library/argparse argparse ArgumentParser convert_arg_line_to_args11979767
Ref: 342711979767
Node: 終了メソッド11981053
Ref: library/argparse exiting-methods11981225
Ref: 345911981225
Ref: library/argparse argparse ArgumentParser exit11981278
Ref: 345a11981278
Ref: library/argparse argparse ArgumentParser error11981847
Ref: 345b11981847
Node: 混在した引数の解析11982052
Ref: library/argparse intermixed-parsing11982220
Ref: 345c11982220
Ref: library/argparse argparse ArgumentParser parse_intermixed_args11982288
Ref: cfb11982288
Ref: library/argparse argparse ArgumentParser parse_known_intermixed_args11982382
Ref: 345d11982382
Node: Registering custom types or actions11984177
Ref: library/argparse registering-custom-types-or-actions11984318
Ref: 345e11984318
Ref: library/argparse argparse ArgumentParser register11984411
Ref: 343211984411
Node: 例外<11>11985883
Ref: library/argparse exceptions11986072
Ref: 345f11986072
Ref: library/argparse argparse ArgumentError11986105
Ref: 346011986105
Ref: library/argparse argparse ArgumentTypeError11986402
Ref: 343811986402
Node: Argparse チュートリアル11986715
Ref: howto/argparse doc11986836
Ref: 346111986836
Ref: howto/argparse argparse-tutorial11986836
Ref: 340e11986836
Ref: howto/argparse id111986836
Ref: 346211986836
Node: コンセプト11988178
Ref: howto/argparse concepts11988275
Ref: 346311988275
Node: 基礎11990940
Ref: howto/argparse the-basics11991067
Ref: 346411991067
Node: 位置引数の入門11992494
Ref: howto/argparse introducing-positional-arguments11992629
Ref: 346511992629
Node: Optional引数の導入11996323
Ref: howto/argparse introducing-optional-arguments11996490
Ref: 346611996490
Node: 短いオプション12000122
Ref: howto/argparse short-options12000203
Ref: 346712000203
Node: 位置引数とOptional引数の併用12001114
Ref: howto/argparse combining-positional-and-optional-arguments12001290
Ref: 346812001290
Node: もうちょっとだけ学ぶ12010340
Ref: howto/argparse getting-a-little-more-advanced12010532
Ref: 346912010532
Node: 多義性のある引数の指定12012627
Ref: howto/argparse id212012763
Ref: 346a12012763
Ref: howto/argparse specifying-ambiguous-arguments12012763
Ref: 343412012763
Node: 競合するオプション12013809
Ref: howto/argparse conflicting-options12013945
Ref: 346b12013945
Node: argparse の出力を翻訳するには12017374
Ref: howto/argparse how-to-translate-the-argparse-output12017550
Ref: 346c12017550
Ref: argparse の出力を翻訳するには-Footnote-112019710
Node: Custom type converters12019743
Ref: howto/argparse custom-type-converters12019895
Ref: 346e12019895
Node: 結び12021657
Ref: howto/argparse conclusion12021761
Ref: 346f12021761
Ref: howto/argparse-optparse upgrading-optparse-code12022169
Ref: 13ca12022169
Node: Migrating optparse code to argparse12022169
Ref: howto/argparse-optparse doc12022290
Ref: 347012022290
Ref: howto/argparse-optparse migrating-optparse-code12022290
Ref: 347112022290
Ref: howto/argparse-optparse migrating-optparse-code-to-argparse12022290
Ref: 347212022290
Ref: howto/argparse-optparse translation-repo12022290
Ref: 347312022290
Node: optparse --- Parser for command line options12025668
Ref: library/optparse doc12025984
Ref: 347912025984
Ref: library/optparse module-optparse12025984
Ref: a412025984
Ref: library/optparse optparse-parser-for-command-line-options12025984
Ref: 347a12025984
Ref: library/optparse translation-repo12025984
Ref: 347b12025984
Ref: optparse --- Parser for command line options-Footnote-112026508
Node: Choosing an argument parsing library12026576
Ref: library/optparse choosing-an-argument-parser12026717
Ref: 340d12026717
Ref: library/optparse choosing-an-argument-parsing-library12026717
Ref: 347c12026717
Ref: Choosing an argument parsing library-Footnote-112032326
Ref: Choosing an argument parsing library-Footnote-212032366
Ref: Choosing an argument parsing library-Footnote-312032406
Node: はじめに<7>12032454
Ref: library/optparse introduction12032610
Ref: 347d12032610
Node: 背景12035111
Ref: library/optparse background12035255
Ref: 347e12035255
Ref: library/optparse optparse-background12035255
Ref: 347f12035255
Node: 用語集12035831
Ref: library/optparse optparse-terminology12035919
Ref: 348012035919
Ref: library/optparse terminology12035919
Ref: 348112035919
Node: オプションとは何か12040415
Ref: library/optparse optparse-what-options-for12040536
Ref: 348212040536
Ref: library/optparse what-are-options-for12040536
Ref: 348312040536
Node: 位置引数とは何か12043109
Ref: library/optparse optparse-what-positional-arguments-for12043212
Ref: 348412043212
Ref: library/optparse what-are-positional-arguments-for12043212
Ref: 348512043212
Node: チュートリアル<2>12044939
Ref: library/optparse optparse-tutorial12045095
Ref: 348612045095
Ref: library/optparse tutorial12045095
Ref: 348712045095
Node: オプション・アクションを理解する12048282
Ref: library/optparse optparse-understanding-option-actions12048421
Ref: 348c12048421
Ref: library/optparse understanding-option-actions12048421
Ref: 348d12048421
Node: store アクション12049013
Ref: library/optparse optparse-store-action12049208
Ref: 348f12049208
Ref: library/optparse the-store-action12049208
Ref: 349012049208
Node: ブール値 フラグ オプションの処理12051608
Ref: library/optparse handling-boolean-flag-options12051782
Ref: 349112051782
Ref: library/optparse optparse-handling-boolean-options12051782
Ref: 349212051782
Node: その他のアクション12052738
Ref: library/optparse optparse-other-actions12052909
Ref: 349312052909
Ref: library/optparse other-actions12052909
Ref: 349412052909
Node: デフォルト値12053506
Ref: library/optparse default-values12053648
Ref: 349812053648
Ref: library/optparse optparse-default-values12053648
Ref: 349912053648
Node: ヘルプの生成12055946
Ref: library/optparse generating-help12056091
Ref: 349a12056091
Ref: library/optparse optparse-generating-help12056091
Ref: 349b12056091
Node: オプションをグループ化する12060575
Ref: library/optparse grouping-options12060669
Ref: 349c12060669
Ref: library/optparse optparse OptionGroup12061129
Ref: 349d12061129
Ref: library/optparse optparse OptionParser get_option_group12064825
Ref: 349e12064825
Node: バージョン番号の出力12065167
Ref: library/optparse optparse-printing-version-string12065321
Ref: 349f12065321
Ref: library/optparse printing-a-version-string12065321
Ref: 34a012065321
Ref: library/optparse optparse OptionParser print_version12066230
Ref: 34a112066230
Ref: library/optparse optparse OptionParser get_version12066692
Ref: 34a312066692
Node: How optparse handles errors12066868
Ref: library/optparse how-optparse-handles-errors12067034
Ref: 34a412067034
Ref: library/optparse optparse-how-optparse-handles-errors12067034
Ref: 34a512067034
Node: 全てをつなぎ合わせる12069175
Ref: library/optparse optparse-putting-it-all-together12069302
Ref: 34a612069302
Ref: library/optparse putting-it-all-together12069302
Ref: 34a712069302
Node: リファレンスガイド12070217
Ref: library/optparse optparse-reference-guide12070406
Ref: 349612070406
Ref: library/optparse reference-guide12070406
Ref: 34a812070406
Node: parserを作る12070854
Ref: library/optparse creating-the-parser12070978
Ref: 34a912070978
Ref: library/optparse optparse-creating-parser12070978
Ref: 34aa12070978
Ref: library/optparse optparse OptionParser12071107
Ref: 16eb12071107
Node: パーザへのオプション追加12074621
Ref: library/optparse optparse-populating-parser12074778
Ref: 34ac12074778
Ref: library/optparse populating-the-parser12074778
Ref: 34ad12074778
Node: オプションの定義12076355
Ref: library/optparse defining-options12076518
Ref: 34af12076518
Ref: library/optparse optparse-defining-options12076518
Ref: 34b012076518
Ref: library/optparse optparse OptionParser add_option12077113
Ref: 347412077113
Ref: library/optparse optparse Values12079590
Ref: 347612079590
Node: オプション属性12080913
Ref: library/optparse option-attributes12081085
Ref: 34b312081085
Ref: library/optparse optparse-option-attributes12081085
Ref: 34b412081085
Ref: library/optparse optparse Option12081143
Ref: 34ae12081143
Ref: library/optparse optparse Option action12081760
Ref: 348812081760
Ref: library/optparse optparse Option type12081984
Ref: 348912081984
Ref: library/optparse optparse Option dest12082273
Ref: 348a12082273
Ref: library/optparse optparse Option default12082613
Ref: 34b612082613
Ref: library/optparse optparse Option nargs12082846
Ref: 34b812082846
Ref: library/optparse optparse Option const12083082
Ref: 349512083082
Ref: library/optparse optparse Option choices12083181
Ref: 34b912083181
Ref: library/optparse optparse Option callback12083339
Ref: 34ba12083339
Ref: library/optparse optparse Option callback_args12083713
Ref: 34bb12083713
Ref: library/optparse optparse Option callback_kwargs12083749
Ref: 34bc12083749
Ref: library/optparse optparse Option help12083940
Ref: 348b12083940
Ref: library/optparse optparse Option metavar12084410
Ref: 34bd12084410
Node: 標準的なオプション・アクション12084680
Ref: library/optparse optparse-standard-option-actions12084855
Ref: 34b112084855
Ref: library/optparse standard-option-actions12084855
Ref: 34be12084855
Node: 標準のオプション型12093732
Ref: library/optparse optparse-standard-option-types12093907
Ref: 34b512093907
Ref: library/optparse standard-option-types12093907
Ref: 34bf12093907
Node: 引数を解析する12095654
Ref: library/optparse optparse-parsing-arguments12095838
Ref: 34b212095838
Ref: library/optparse parsing-arguments12095838
Ref: 34c012095838
Ref: library/optparse optparse OptionParser parse_args12096058
Ref: 16ec12096058
Node: オプション解析器への問い合わせと操作12097733
Ref: library/optparse optparse-querying-manipulating-option-parser12097917
Ref: 34c112097917
Ref: library/optparse querying-and-manipulating-your-option-parser12097917
Ref: 34c212097917
Ref: library/optparse optparse OptionParser disable_interspersed_args12098321
Ref: 347512098321
Ref: library/optparse optparse OptionParser enable_interspersed_args12099370
Ref: 34c312099370
Ref: library/optparse optparse OptionParser get_option12099692
Ref: 34c412099692
Ref: library/optparse optparse OptionParser has_option12099934
Ref: 34c512099934
Ref: library/optparse optparse OptionParser remove_option12100146
Ref: 34c612100146
Node: オプション間の衝突12100679
Ref: library/optparse conflicts-between-options12100863
Ref: 34c712100863
Ref: library/optparse optparse-conflicts-between-options12100863
Ref: 34ab12100863
Node: クリーンアップ12103587
Ref: library/optparse cleanup12103741
Ref: 34c912103741
Ref: library/optparse optparse-cleanup12103741
Ref: 34ca12103741
Node: その他のメソッド12104369
Ref: library/optparse optparse-other-methods12104487
Ref: 34cb12104487
Ref: library/optparse other-methods12104487
Ref: 34cc12104487
Ref: library/optparse optparse OptionParser set_usage12104641
Ref: 34cd12104641
Ref: library/optparse optparse OptionParser print_usage12105045
Ref: 34a212105045
Ref: library/optparse optparse OptionParser get_usage12105452
Ref: 34ce12105452
Ref: library/optparse optparse OptionParser set_defaults12105642
Ref: 34b712105642
Node: オプション処理コールバック12107092
Ref: library/optparse option-callbacks12107275
Ref: 34cf12107275
Ref: library/optparse optparse-option-callbacks12107275
Ref: 349712107275
Node: callbackオプションの定義12108933
Ref: library/optparse defining-a-callback-option12109113
Ref: 34d012109113
Ref: library/optparse optparse-defining-callback-option12109113
Ref: 34d112109113
Node: コールバック関数はどのように呼び出されるか12111452
Ref: library/optparse how-callbacks-are-called12111686
Ref: 34d212111686
Ref: library/optparse optparse-how-callbacks-called12111686
Ref: 34d312111686
Node: コールバック中で例外を送出する12114854
Ref: library/optparse optparse-raising-errors-in-callback12115116
Ref: 34d412115116
Ref: library/optparse raising-errors-in-a-callback12115116
Ref: 34d512115116
Node: コールバックの例 1 ありふれたコールバック12115608
Ref: library/optparse callback-example-1-trivial-callback12115879
Ref: 34d612115879
Ref: library/optparse optparse-callback-example-112115879
Ref: 34d712115879
Node: コールバックの例 2 オプションの順番をチェックする12116412
Ref: library/optparse callback-example-2-check-option-order12116720
Ref: 34d812116720
Ref: library/optparse optparse-callback-example-212116720
Ref: 34d912116720
Node: コールバックの例 3 オプションの順番をチェックする 汎用的12117376
Ref: library/optparse callback-example-3-check-option-order-generalized12117687
Ref: 34da12117687
Ref: library/optparse optparse-callback-example-312117687
Ref: 34db12117687
Node: コールバックの例 4 任意の条件をチェックする12118627
Ref: library/optparse callback-example-4-check-arbitrary-condition12118904
Ref: 34dc12118904
Ref: library/optparse optparse-callback-example-412118904
Ref: 34dd12118904
Node: コールバックの例5 固定引数12119808
Ref: library/optparse callback-example-5-fixed-arguments12120047
Ref: 34de12120047
Ref: library/optparse optparse-callback-example-512120047
Ref: 34df12120047
Node: コールバックの例6 可変個の引数12121281
Ref: library/optparse callback-example-6-variable-arguments12121448
Ref: 34e012121448
Ref: library/optparse optparse-callback-example-612121448
Ref: 34e112121448
Node: Extending optparse12123691
Ref: library/optparse extending-optparse12123857
Ref: 34e212123857
Ref: library/optparse optparse-extending-optparse12123857
Ref: 348e12123857
Node: 新しい型の追加12124209
Ref: library/optparse adding-new-types12124327
Ref: 34e312124327
Ref: library/optparse optparse-adding-new-types12124327
Ref: 34e412124327
Ref: library/optparse optparse Option TYPES12124612
Ref: 34e512124612
Ref: library/optparse optparse Option TYPE_CHECKER12124857
Ref: 34e612124857
Node: 新しいアクションの追加12128307
Ref: library/optparse adding-new-actions12128425
Ref: 34e712128425
Ref: library/optparse optparse-adding-new-actions12128425
Ref: 34e812128425
Ref: library/optparse optparse Option ACTIONS12129841
Ref: 34e912129841
Ref: library/optparse optparse Option STORE_ACTIONS12129969
Ref: 34ea12129969
Ref: library/optparse optparse Option TYPED_ACTIONS12130075
Ref: 34eb12130075
Ref: library/optparse optparse Option ALWAYS_TYPED_ACTIONS12130181
Ref: 34ec12130181
Node: 例外<12>12133999
Ref: library/optparse exceptions12134117
Ref: 34ed12134117
Ref: library/optparse optparse OptionError12134150
Ref: 347712134150
Ref: library/optparse optparse OptionConflictError12134288
Ref: 34c812134288
Ref: library/optparse optparse OptionValueError12134413
Ref: 347812134413
Ref: library/optparse optparse BadOptionError12134533
Ref: 34ee12134533
Ref: library/optparse optparse AmbiguousOptionError12134635
Ref: 34ef12134635
Node: getpass --- 可搬性のあるパスワード入力機構12134745
Ref: library/getpass doc12135038
Ref: 34f012135038
Ref: library/getpass getpass-portable-password-input12135038
Ref: 34f112135038
Ref: library/getpass module-getpass12135038
Ref: 6612135038
Ref: library/getpass translation-repo12135038
Ref: 34f212135038
Ref: library/getpass getpass getpass12135534
Ref: 21f12135534
Ref: library/getpass getpass GetPassWarning12137427
Ref: 34f312137427
Ref: library/getpass getpass getuser12137591
Ref: 65a12137591
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-112138407
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-212138474
Node: fileinput --- 複数の入力ストリームをまたいだ行を反復する12138554
Ref: library/fileinput doc12138856
Ref: 34f412138856
Ref: library/fileinput fileinput-iterate-over-lines-from-multiple-input-streams12138856
Ref: 34f512138856
Ref: library/fileinput module-fileinput12138856
Ref: 5f12138856
Ref: library/fileinput translation-repo12138856
Ref: 34f612138856
Ref: library/fileinput fileinput input12141940
Ref: a0412141940
Ref: library/fileinput fileinput filename12143449
Ref: 34f712143449
Ref: library/fileinput fileinput fileno12143622
Ref: 164c12143622
Ref: library/fileinput fileinput lineno12143895
Ref: 34f812143895
Ref: library/fileinput fileinput filelineno12144191
Ref: 34f912144191
Ref: library/fileinput fileinput isfirstline12144494
Ref: 34fa12144494
Ref: library/fileinput fileinput isstdin12144675
Ref: 34fb12144675
Ref: library/fileinput fileinput nextfile12144875
Ref: 34fc12144875
Ref: library/fileinput fileinput close12145636
Ref: 34fd12145636
Ref: library/fileinput fileinput FileInput12145844
Ref: 94412145844
Ref: library/fileinput fileinput hook_compressed12149480
Ref: a0512149480
Ref: library/fileinput fileinput hook_encoded12150395
Ref: ea212150395
Ref: fileinput --- 複数の入力ストリームをまたいだ行を反復する-Footnote-112151079
Node: curses --- 文字セル表示のターミナル処理12151148
Ref: library/curses doc12151449
Ref: 34fe12151449
Ref: library/curses curses-terminal-handling-for-character-cell-displays12151449
Ref: 34ff12151449
Ref: library/curses module-curses12151449
Ref: 2f12151449
Ref: library/curses translation-repo12151449
Ref: 350012151449
Ref: curses --- 文字セル表示のターミナル処理-Footnote-112153806
Node: 関数<6>12153869
Ref: library/curses curses-functions12153991
Ref: 350212153991
Ref: library/curses functions12153991
Ref: 350312153991
Ref: library/curses curses error12154080
Ref: 350412154080
Ref: library/curses curses assume_default_colors12154542
Ref: 1f812154542
Ref: library/curses curses baudrate12155202
Ref: 350612155202
Ref: library/curses curses beep12155739
Ref: 350712155739
Ref: library/curses curses can_change_color12155822
Ref: 350812155822
Ref: library/curses curses cbreak12156016
Ref: 350912156016
Ref: library/curses curses color_content12156732
Ref: 9f612156732
Ref: library/curses curses color_pair12157172
Ref: 350b12157172
Ref: library/curses curses curs_set12157560
Ref: 350f12157560
Ref: library/curses curses def_prog_mode12158145
Ref: 351012158145
Ref: library/curses curses def_shell_mode12158556
Ref: 351212158556
Ref: library/curses curses delay_output12159003
Ref: 351412159003
Ref: library/curses curses doupdate12159108
Ref: 351512159108
Ref: library/curses curses echo12160176
Ref: 351812160176
Ref: library/curses curses endwin12160371
Ref: 351912160371
Ref: library/curses curses erasechar12160495
Ref: 351a12160495
Ref: library/curses curses filter12160857
Ref: 351b12160857
Ref: library/curses curses flash12161468
Ref: 351c12161468
Ref: library/curses curses flushinp12161774
Ref: 351d12161774
Ref: library/curses curses getmouse12162071
Ref: 351e12162071
Ref: library/curses curses getsyx12163343
Ref: 352812163343
Ref: library/curses curses getwin12163598
Ref: 352912163598
Ref: library/curses curses has_colors12163937
Ref: 352b12163937
Ref: library/curses curses has_extended_color_support12164116
Ref: 9fa12164116
Ref: library/curses curses has_ic12164511
Ref: 352c12164511
Ref: library/curses curses has_il12164801
Ref: 352d12164801
Ref: library/curses curses has_key12165088
Ref: 352e12165088
Ref: library/curses curses halfdelay12165266
Ref: 352f12165266
Ref: library/curses curses init_color12165804
Ref: 9f712165804
Ref: library/curses curses init_pair12166551
Ref: 9f812166551
Ref: library/curses curses initscr12167351
Ref: 196f12167351
Ref: library/curses curses intrflush12167726
Ref: 353112167726
Ref: library/curses curses is_term_resized12167961
Ref: 353212167961
Ref: library/curses curses isendwin12168195
Ref: 353312168195
Ref: library/curses curses keyname12168423
Ref: 353412168423
Ref: library/curses curses killchar12169139
Ref: 353512169139
Ref: library/curses curses longname12169409
Ref: 353612169409
Ref: library/curses curses meta12169756
Ref: 353712169756
Ref: library/curses curses mouseinterval12169963
Ref: 353812169963
Ref: library/curses curses mousemask12170353
Ref: 353912170353
Ref: library/curses curses napms12170757
Ref: 196e12170757
Ref: library/curses curses newpad12170839
Ref: 353a12170839
Ref: library/curses curses newwin12171987
Ref: 353c12171987
Ref: library/curses curses nl12172377
Ref: 353d12172377
Ref: library/curses curses nocbreak12172792
Ref: 353012172792
Ref: library/curses curses noecho12172956
Ref: 353f12172956
Ref: library/curses curses nonl12173085
Ref: 353e12173085
Ref: library/curses curses noqiflush12173690
Ref: 354012173690
Ref: library/curses curses noraw12174169
Ref: 354112174169
Ref: library/curses curses pair_content12174327
Ref: 9f912174327
Ref: library/curses curses pair_number12174572
Ref: 350e12174572
Ref: library/curses curses putp12174758
Ref: 354212174758
Ref: library/curses curses qiflush12175125
Ref: 354412175125
Ref: library/curses curses raw12175431
Ref: 350a12175431
Ref: library/curses curses reset_prog_mode12175764
Ref: 351112175764
Ref: library/curses curses reset_shell_mode12175946
Ref: 351312175946
Ref: library/curses curses resetty12176128
Ref: 354512176128
Ref: library/curses curses resize_term12176283
Ref: 199012176283
Ref: library/curses curses resizeterm12176927
Ref: 198f12176927
Ref: library/curses curses savetty12177235
Ref: 354612177235
Ref: library/curses curses get_escdelay12177398
Ref: af012177398
Ref: library/curses curses set_escdelay12177525
Ref: af112177525
Ref: library/curses curses get_tabsize12177824
Ref: af212177824
Ref: library/curses curses set_tabsize12177949
Ref: af312177949
Ref: library/curses curses setsyx12178163
Ref: 354712178163
Ref: library/curses curses setupterm12178394
Ref: 354312178394
Ref: library/curses curses start_color12179068
Ref: 354812179068
Ref: library/curses curses termattrs12179839
Ref: 354b12179839
Ref: library/curses curses termname12180120
Ref: 354c12180120
Ref: library/curses curses tigetflag12180298
Ref: 354d12180298
Ref: library/curses curses tigetnum12180732
Ref: 354e12180732
Ref: library/curses curses tigetstr12181160
Ref: 354f12181160
Ref: library/curses curses tparm12181553
Ref: 355012181553
Ref: library/curses curses typeahead12182032
Ref: 355112182032
Ref: library/curses curses unctrl12182781
Ref: 177a12182781
Ref: library/curses curses ungetch12183063
Ref: 177b12183063
Ref: library/curses curses update_lines_cols12183349
Ref: fef12183349
Ref: library/curses curses unget_wch12183543
Ref: 12ae12183543
Ref: library/curses curses ungetmouse12183863
Ref: 355212183863
Ref: library/curses curses use_env12184067
Ref: 355312184067
Ref: library/curses curses use_default_colors12184708
Ref: 1f912184708
Ref: library/curses curses wrapper12184810
Ref: c7712184810
Node: Window objects12185864
Ref: library/curses curses-window-objects12186004
Ref: 19e912186004
Ref: library/curses window-objects12186004
Ref: 355412186004
Ref: library/curses curses window12186053
Ref: 12ab12186053
Ref: library/curses curses window addch12186231
Ref: 177412186231
Ref: library/curses curses window addnstr12186911
Ref: 355512186911
Ref: library/curses curses window addstr12187207
Ref: 351612187207
Ref: library/curses curses window attroff12188229
Ref: 355612188229
Ref: library/curses curses window attron12188435
Ref: 355712188435
Ref: library/curses curses window attrset12188576
Ref: 355812188576
Ref: library/curses curses window bkgd12188751
Ref: 355912188751
Ref: library/curses curses window bkgdset12189244
Ref: 355a12189244
Ref: library/curses curses window border12189856
Ref: 355b12189856
Ref: library/curses curses window box12192005
Ref: 356212192005
Ref: library/curses curses window chgat12192296
Ref: 356312192296
Ref: library/curses curses window clear12192944
Ref: 356512192944
Ref: library/curses curses window clearok12193160
Ref: 356712193160
Ref: library/curses curses window clrtobot12193326
Ref: 356812193326
Ref: library/curses curses window clrtoeol12193556
Ref: 356912193556
Ref: library/curses curses window cursyncup12193658
Ref: 356a12193658
Ref: library/curses curses window delch12193839
Ref: 356b12193839
Ref: library/curses curses window deleteln12194044
Ref: 356c12194044
Ref: library/curses curses window derwin12194200
Ref: 356d12194200
Ref: library/curses curses window echochar12194680
Ref: 356f12194680
Ref: library/curses curses window enclose12194869
Ref: 1cec12194869
Ref: library/curses curses window encoding12195391
Ref: 12ac12195391
Ref: library/curses curses window erase12195899
Ref: 356612195899
Ref: library/curses curses window getbegyx12195980
Ref: 357012195980
Ref: library/curses curses window getbkgd12196089
Ref: 357112196089
Ref: library/curses curses window getch12196280
Ref: 188b12196280
Ref: library/curses curses window get_wch12196741
Ref: 12ad12196741
Ref: library/curses curses window getkey12197098
Ref: 357312197098
Ref: library/curses curses window getmaxyx12197490
Ref: 357412197490
Ref: library/curses curses window getparyx12197621
Ref: 357512197621
Ref: library/curses curses window getstr12197864
Ref: 18a312197864
Ref: library/curses curses window getyx12198285
Ref: 357612198285
Ref: library/curses curses window hline12198457
Ref: 357712198457
Ref: library/curses curses window idcok12198791
Ref: 357812198791
Ref: library/curses curses window idlok12199195
Ref: 357912199195
Ref: library/curses curses window immedok12199371
Ref: 357a12199371
Ref: library/curses curses window inch12199885
Ref: 357212199885
Ref: library/curses curses window insch12200230
Ref: 177512200230
Ref: library/curses curses window insdelln12200635
Ref: 357d12200635
Ref: library/curses curses window insertln12201110
Ref: 357e12201110
Ref: library/curses curses window insnstr12201269
Ref: 357f12201269
Ref: library/curses curses window insstr12201851
Ref: 358012201851
Ref: library/curses curses window instr12202311
Ref: 18a212202311
Ref: library/curses curses window is_linetouched12202913
Ref: 358112202913
Ref: library/curses curses window is_wintouched12203300
Ref: 358212203300
Ref: library/curses curses window keypad12203565
Ref: 358312203565
Ref: library/curses curses window leaveok12203836
Ref: 358412203836
Ref: library/curses curses window move12204168
Ref: 358512204168
Ref: library/curses curses window mvderwin12204279
Ref: 358612204279
Ref: library/curses curses window mvwin12204622
Ref: 358712204622
Ref: library/curses curses window nodelay12204923
Ref: 358812204923
Ref: library/curses curses window notimeout12205071
Ref: 358912205071
Ref: library/curses curses window noutrefresh12205425
Ref: 351712205425
Ref: library/curses curses window overlay12206117
Ref: 358a12206117
Ref: library/curses curses window overwrite12206854
Ref: 358b12206854
Ref: library/curses curses window putwin12207596
Ref: 352a12207596
Ref: library/curses curses window redrawln12207891
Ref: 358c12207891
Ref: library/curses curses window redrawwin12208160
Ref: 358d12208160
Ref: library/curses curses window refresh12208350
Ref: 353b12208350
Ref: library/curses curses window resize12209431
Ref: 358e12209431
Ref: library/curses curses window scroll12209779
Ref: 358f12209779
Ref: library/curses curses window scrollok12210066
Ref: 359012210066
Ref: library/curses curses window setscrreg12210706
Ref: 359112210706
Ref: library/curses curses window standend12210903
Ref: 359212210903
Ref: library/curses curses window standout12211102
Ref: 359312211102
Ref: library/curses curses window subpad12211190
Ref: 359412211190
Ref: library/curses curses window subwin12211638
Ref: 356e12211638
Ref: library/curses curses window syncdown12212065
Ref: 359512212065
Ref: library/curses curses window syncok12212416
Ref: 359612212416
Ref: library/curses curses window syncup12212615
Ref: 359712212615
Ref: library/curses curses window timeout12212781
Ref: 359812212781
Ref: library/curses curses window touchline12213393
Ref: 356412213393
Ref: library/curses curses window touchwin12213745
Ref: 359912213745
Ref: library/curses curses window untouchwin12213913
Ref: 359a12213913
Ref: library/curses curses window vline12214122
Ref: 1b5c12214122
Node: 定数<6>12214357
Ref: library/curses constants12214479
Ref: 359b12214479
Ref: library/curses curses ERR12214571
Ref: 359c12214571
Ref: library/curses curses OK12214754
Ref: 359d12214754
Ref: library/curses curses version12214935
Ref: 359e12214935
Ref: library/curses curses ncurses_version12215035
Ref: bde12215035
Ref: library/curses curses COLORS12215459
Ref: 354912215459
Ref: library/curses curses COLOR_PAIRS12215620
Ref: 354a12215620
Ref: library/curses curses COLS12215791
Ref: ff112215791
Ref: library/curses curses LINES12216059
Ref: ff012216059
Ref: library/curses curses A_ALTCHARSET12216626
Ref: 359f12216626
Ref: library/curses curses A_BLINK12216735
Ref: 35a012216735
Ref: library/curses curses A_BOLD12216842
Ref: 35a112216842
Ref: library/curses curses A_DIM12216949
Ref: 35a212216949
Ref: library/curses curses A_INVIS12217062
Ref: 35a312217062
Ref: library/curses curses A_ITALIC12217163
Ref: 35a412217163
Ref: library/curses curses A_NORMAL12217251
Ref: 350512217251
Ref: library/curses curses A_PROTECT12217330
Ref: 35a512217330
Ref: library/curses curses A_REVERSE12217408
Ref: 350d12217408
Ref: library/curses curses A_STANDOUT12217570
Ref: 350c12217570
Ref: library/curses curses A_UNDERLINE12217649
Ref: 35a612217649
Ref: library/curses curses A_HORIZONTAL12217728
Ref: 35a712217728
Ref: library/curses curses A_LEFT12217826
Ref: 35a812217826
Ref: library/curses curses A_LOW12217932
Ref: 35a912217932
Ref: library/curses curses A_RIGHT12218040
Ref: 35aa12218040
Ref: library/curses curses A_TOP12218146
Ref: 35ab12218146
Ref: library/curses curses A_VERTICAL12218239
Ref: 35ac12218239
Ref: library/curses curses A_ATTRIBUTES12218648
Ref: 357c12218648
Ref: library/curses curses A_CHARTEXT12218744
Ref: 357b12218744
Ref: library/curses curses A_COLOR12218856
Ref: 35ad12218856
Ref: library/curses curses KEY_MIN12219324
Ref: 35ae12219324
Ref: library/curses curses KEY_BREAK12219423
Ref: 35af12219423
Ref: library/curses curses KEY_DOWN12219554
Ref: 35b012219554
Ref: library/curses curses KEY_UP12219657
Ref: 35b112219657
Ref: library/curses curses KEY_LEFT12219764
Ref: 35b212219764
Ref: library/curses curses KEY_RIGHT12219853
Ref: 35b312219853
Ref: library/curses curses KEY_HOME12219944
Ref: 35b412219944
Ref: library/curses curses KEY_BACKSPACE12220069
Ref: 35b512220069
Ref: library/curses curses KEY_F012220205
Ref: 35b612220205
Ref: library/curses curses KEY_Fn12220407
Ref: 35b712220407
Ref: library/curses curses KEY_DL12220541
Ref: 35b812220541
Ref: library/curses curses KEY_IL12220660
Ref: 35b912220660
Ref: library/curses curses KEY_DC12220779
Ref: 35ba12220779
Ref: library/curses curses KEY_IC12220901
Ref: 35bb12220901
Ref: library/curses curses KEY_EIC12221052
Ref: 35bc12221052
Ref: library/curses curses KEY_CLEAR12221169
Ref: 35bd12221169
Ref: library/curses curses KEY_EOS12221262
Ref: 35be12221262
Ref: library/curses curses KEY_EOL12221385
Ref: 35bf12221385
Ref: library/curses curses KEY_SF12221501
Ref: 35c012221501
Ref: library/curses curses KEY_SR12221624
Ref: 35c112221624
Ref: library/curses curses KEY_NPAGE12221749
Ref: 35c212221749
Ref: library/curses curses KEY_PPAGE12221842
Ref: 35c312221842
Ref: library/curses curses KEY_STAB12221951
Ref: 35c412221951
Ref: library/curses curses KEY_CTAB12222059
Ref: 35c512222059
Ref: library/curses curses KEY_CATAB12222157
Ref: 35c612222157
Ref: library/curses curses KEY_ENTER12222256
Ref: 35c712222256
Ref: library/curses curses KEY_SRESET12222367
Ref: 35c812222367
Ref: library/curses curses KEY_RESET12222561
Ref: 35c912222561
Ref: library/curses curses KEY_PRINT12222693
Ref: 35ca12222693
Ref: library/curses curses KEY_LL12222787
Ref: 35cb12222787
Ref: library/curses curses KEY_A112222935
Ref: 35cc12222935
Ref: library/curses curses KEY_A312223061
Ref: 35cd12223061
Ref: library/curses curses KEY_B212223187
Ref: 35ce12223187
Ref: library/curses curses KEY_C112223313
Ref: 35cf12223313
Ref: library/curses curses KEY_C312223439
Ref: 35d012223439
Ref: library/curses curses KEY_BTAB12223567
Ref: 35d112223567
Ref: library/curses curses KEY_BEG12223670
Ref: 35d212223670
Ref: library/curses curses KEY_CANCEL12223763
Ref: 35d312223763
Ref: library/curses curses KEY_CLOSE12223853
Ref: 35d412223853
Ref: library/curses curses KEY_COMMAND12223936
Ref: 35d512223936
Ref: library/curses curses KEY_COPY12224036
Ref: 35d612224036
Ref: library/curses curses KEY_CREATE12224132
Ref: 35d712224132
Ref: library/curses curses KEY_END12224228
Ref: 35d812224228
Ref: library/curses curses KEY_EXIT12224337
Ref: 35d912224337
Ref: library/curses curses KEY_FIND12224446
Ref: 35da12224446
Ref: library/curses curses KEY_HELP12224555
Ref: 35db12224555
Ref: library/curses curses KEY_MARK12224667
Ref: 35dc12224667
Ref: library/curses curses KEY_MESSAGE12224763
Ref: 35dd12224763
Ref: library/curses curses KEY_MOVE12224870
Ref: 35de12224870
Ref: library/curses curses KEY_NEXT12224979
Ref: 35df12224979
Ref: library/curses curses KEY_OPEN12225088
Ref: 35e012225088
Ref: library/curses curses KEY_OPTIONS12225181
Ref: 35e112225181
Ref: library/curses curses KEY_PREVIOUS12225262
Ref: 35e212225262
Ref: library/curses curses KEY_REDO12225357
Ref: 35e312225357
Ref: library/curses curses KEY_REFERENCE12225456
Ref: 35e412225456
Ref: library/curses curses KEY_REFRESH12225534
Ref: 35e512225534
Ref: library/curses curses KEY_REPLACE12225616
Ref: 35e612225616
Ref: library/curses curses KEY_RESTART12225698
Ref: 35e712225698
Ref: library/curses curses KEY_RESUME12225783
Ref: 35e812225783
Ref: library/curses curses KEY_SAVE12225880
Ref: 35e912225880
Ref: library/curses curses KEY_SBEG12225989
Ref: 35ea12225989
Ref: library/curses curses KEY_SCANCEL12226088
Ref: 35eb12226088
Ref: library/curses curses KEY_SCOMMAND12226176
Ref: 35ec12226176
Ref: library/curses curses KEY_SCOPY12226265
Ref: 35ed12226265
Ref: library/curses curses KEY_SCREATE12226351
Ref: 35ee12226351
Ref: library/curses curses KEY_SDC12226454
Ref: 35ef12226454
Ref: library/curses curses KEY_SDL12226577
Ref: 35f012226577
Ref: library/curses curses KEY_SELECT12226685
Ref: 35f112226685
Ref: library/curses curses KEY_SEND12226782
Ref: 35f212226782
Ref: library/curses curses KEY_SEOL12226897
Ref: 35f312226897
Ref: library/curses curses KEY_SEXIT12227003
Ref: 35f412227003
Ref: library/curses curses KEY_SFIND12227089
Ref: 35f512227089
Ref: library/curses curses KEY_SHELP12227175
Ref: 35f612227175
Ref: library/curses curses KEY_SHOME12227261
Ref: 35f712227261
Ref: library/curses curses KEY_SIC12227362
Ref: 35f812227362
Ref: library/curses curses KEY_SLEFT12227464
Ref: 35f912227464
Ref: library/curses curses KEY_SMESSAGE12227556
Ref: 35fa12227556
Ref: library/curses curses KEY_SMOVE12227645
Ref: 35fb12227645
Ref: library/curses curses KEY_SNEXT12227731
Ref: 35fc12227731
Ref: library/curses curses KEY_SOPTIONS12227817
Ref: 35fd12227817
Ref: library/curses curses KEY_SPREVIOUS12227906
Ref: 35fe12227906
Ref: library/curses curses KEY_SPRINT12227992
Ref: 35ff12227992
Ref: library/curses curses KEY_SREDO12228079
Ref: 360012228079
Ref: library/curses curses KEY_SREPLACE12228165
Ref: 360112228165
Ref: library/curses curses KEY_SRIGHT12228254
Ref: 360212228254
Ref: library/curses curses KEY_SRSUME12228347
Ref: 360312228347
Ref: library/curses curses KEY_SSAVE12228435
Ref: 360412228435
Ref: library/curses curses KEY_SSUSPEND12228521
Ref: 360512228521
Ref: library/curses curses KEY_SUNDO12228610
Ref: 360612228610
Ref: library/curses curses KEY_SUSPEND12228696
Ref: 360712228696
Ref: library/curses curses KEY_UNDO12228800
Ref: 360812228800
Ref: library/curses curses KEY_MOUSE12228899
Ref: 351f12228899
Ref: library/curses curses KEY_RESIZE12228992
Ref: 360912228992
Ref: library/curses curses KEY_MAX12229103
Ref: 360a12229103
Ref: library/curses curses-acs-codes12230287
Ref: 360b12230287
Ref: library/curses curses ACS_BBSS12230951
Ref: 360c12230951
Ref: library/curses curses ACS_BLOCK12231052
Ref: 360d12231052
Ref: library/curses curses ACS_BOARD12231137
Ref: 360e12231137
Ref: library/curses curses ACS_BSBS12231222
Ref: 360f12231222
Ref: library/curses curses ACS_BSSB12231304
Ref: 361012231304
Ref: library/curses curses ACS_BSSS12231404
Ref: 361112231404
Ref: library/curses curses ACS_BTEE12231498
Ref: 361212231498
Ref: library/curses curses ACS_BULLET12231583
Ref: 361312231583
Ref: library/curses curses ACS_CKBOARD12231661
Ref: 361412231661
Ref: library/curses curses ACS_DARROW12231767
Ref: 361512231767
Ref: library/curses curses ACS_DEGREE12231846
Ref: 361612231846
Ref: library/curses curses ACS_DIAMOND12231919
Ref: 361712231919
Ref: library/curses curses ACS_GEQUAL12232001
Ref: 361812232001
Ref: library/curses curses ACS_HLINE12232086
Ref: 355d12232086
Ref: library/curses curses ACS_LANTERN12232159
Ref: 361912232159
Ref: library/curses curses ACS_LARROW12232257
Ref: 361a12232257
Ref: library/curses curses ACS_LEQUAL12232336
Ref: 361b12232336
Ref: library/curses curses ACS_LLCORNER12232421
Ref: 356012232421
Ref: library/curses curses ACS_LRCORNER12232502
Ref: 356112232502
Ref: library/curses curses ACS_LTEE12232584
Ref: 361c12232584
Ref: library/curses curses ACS_NEQUAL12232669
Ref: 361d12232669
Ref: library/curses curses ACS_PI12232756
Ref: 361e12232756
Ref: library/curses curses ACS_PLMINUS12232847
Ref: 361f12232847
Ref: library/curses curses ACS_PLUS12232938
Ref: 362012232938
Ref: library/curses curses ACS_RARROW12233020
Ref: 362112233020
Ref: library/curses curses ACS_RTEE12233099
Ref: 362212233099
Ref: library/curses curses ACS_S112233198
Ref: 362312233198
Ref: library/curses curses ACS_S312233314
Ref: 362412233314
Ref: library/curses curses ACS_S712233430
Ref: 362512233430
Ref: library/curses curses ACS_S912233546
Ref: 362612233546
Ref: library/curses curses ACS_SBBS12233648
Ref: 362712233648
Ref: library/curses curses ACS_SBSB12233749
Ref: 362812233749
Ref: library/curses curses ACS_SBSS12233831
Ref: 362912233831
Ref: library/curses curses ACS_SSBB12233925
Ref: 362a12233925
Ref: library/curses curses ACS_SSBS12234025
Ref: 362b12234025
Ref: library/curses curses ACS_SSSB12234119
Ref: 362c12234119
Ref: library/curses curses ACS_SSSS12234213
Ref: 362d12234213
Ref: library/curses curses ACS_STERLING12234325
Ref: 362e12234325
Ref: library/curses curses ACS_TTEE12234422
Ref: 362f12234422
Ref: library/curses curses ACS_UARROW12234507
Ref: 363012234507
Ref: library/curses curses ACS_ULCORNER12234586
Ref: 355e12234586
Ref: library/curses curses ACS_URCORNER12234667
Ref: 355f12234667
Ref: library/curses curses ACS_VLINE12234749
Ref: 355c12234749
Ref: library/curses curses BUTTONn_PRESSED12235144
Ref: 352012235144
Ref: library/curses curses BUTTONn_RELEASED12235292
Ref: 352112235292
Ref: library/curses curses BUTTONn_CLICKED12235439
Ref: 352212235439
Ref: library/curses curses BUTTONn_DOUBLE_CLICKED12235563
Ref: 352312235563
Ref: library/curses curses BUTTONn_TRIPLE_CLICKED12235678
Ref: 352412235678
Ref: library/curses curses BUTTON_SHIFT12235813
Ref: 352512235813
Ref: library/curses curses BUTTON_CTRL12235976
Ref: 352612235976
Ref: library/curses curses BUTTON_ALT12236141
Ref: 352712236141
Ref: library/curses curses COLOR_BLACK12236614
Ref: 363112236614
Ref: library/curses curses COLOR_BLUE12236683
Ref: 363212236683
Ref: library/curses curses COLOR_CYAN12236752
Ref: 363312236752
Ref: library/curses curses COLOR_GREEN12236854
Ref: 363412236854
Ref: library/curses curses COLOR_MAGENTA12236923
Ref: 363512236923
Ref: library/curses curses COLOR_RED12237022
Ref: 363612237022
Ref: library/curses curses COLOR_WHITE12237091
Ref: 363712237091
Ref: library/curses curses COLOR_YELLOW12237160
Ref: 363812237160
Node: curses textpad --- Text input widget for curses programs12237218
Ref: library/curses curses-textpad-text-input-widget-for-curses-programs12237498
Ref: 363912237498
Ref: library/curses module-curses textpad12237498
Ref: 3212237498
Ref: library/curses curses textpad rectangle12238077
Ref: 363a12238077
Node: Textbox オブジェクト12238802
Ref: library/curses curses-textpad-objects12238921
Ref: 363b12238921
Ref: library/curses textbox-objects12238921
Ref: 363c12238921
Ref: library/curses curses textpad Textbox12239104
Ref: 177312239104
Ref: library/curses curses textpad Textbox edit12239762
Ref: 363e12239762
Ref: library/curses curses textpad Textbox do_command12240406
Ref: 363f12240406
Ref: library/curses curses textpad Textbox gather12244817
Ref: 364012244817
Ref: library/curses curses textpad Textbox stripspaces12245069
Ref: 363d12245069
Node: curses ascii --- ASCII 文字のユーティリティー12245613
Ref: library/curses ascii doc12245903
Ref: 364112245903
Ref: library/curses ascii curses-ascii-utilities-for-ascii-characters12245903
Ref: 364212245903
Ref: library/curses ascii module-curses ascii12245903
Ref: 3012245903
Ref: library/curses ascii translation-repo12245903
Ref: 364312245903
Ref: library/curses ascii curses ascii NUL12246511
Ref: 364412246511
Ref: library/curses ascii curses ascii SOH12246554
Ref: 364512246554
Ref: library/curses ascii curses ascii STX12246657
Ref: 364612246657
Ref: library/curses ascii curses ascii ETX12246727
Ref: 364712246727
Ref: library/curses ascii curses ascii EOT12246797
Ref: 364812246797
Ref: library/curses ascii curses ascii ENQ12246873
Ref: 364912246873
Ref: library/curses ascii curses ascii ACK12246988
Ref: 364a12246988
Ref: library/curses ascii curses ascii BEL12247052
Ref: 364b12247052
Ref: library/curses ascii curses ascii BS12247110
Ref: 364c12247110
Ref: library/curses ascii curses ascii TAB12247176
Ref: 364d12247176
Ref: library/curses ascii curses ascii HT12247234
Ref: 364e12247234
Ref: library/curses ascii curses ascii LF12247327
Ref: 364f12247327
Ref: library/curses ascii curses ascii NL12247384
Ref: 365012247384
Ref: library/curses ascii curses ascii VT12247470
Ref: 365112247470
Ref: library/curses ascii curses ascii FF12247533
Ref: 365212247533
Ref: library/curses ascii curses ascii CR12247590
Ref: 365312247590
Ref: library/curses ascii curses ascii SO12247647
Ref: 365412247647
Ref: library/curses ascii curses ascii SI12247749
Ref: 365512247749
Ref: library/curses ascii curses ascii DLE12247851
Ref: 365612247851
Ref: library/curses ascii curses ascii DC112247942
Ref: 365712247942
Ref: library/curses ascii curses ascii DC212248042
Ref: 365812248042
Ref: library/curses ascii curses ascii DC312248147
Ref: 365912248147
Ref: library/curses ascii curses ascii DC412248248
Ref: 365a12248248
Ref: library/curses ascii curses ascii NAK12248314
Ref: 365b12248314
Ref: library/curses ascii curses ascii SYN12248378
Ref: 365c12248378
Ref: library/curses ascii curses ascii ETB12248442
Ref: 365d12248442
Ref: library/curses ascii curses ascii CAN12248518
Ref: 365e12248518
Ref: library/curses ascii curses ascii EM12248594
Ref: 365f12248594
Ref: library/curses ascii curses ascii SUB12248657
Ref: 366012248657
Ref: library/curses ascii curses ascii ESC12248721
Ref: 366112248721
Ref: library/curses ascii curses ascii FS12248794
Ref: 366212248794
Ref: library/curses ascii curses ascii GS12248872
Ref: 366312248872
Ref: library/curses ascii curses ascii RS12248950
Ref: 366412248950
Ref: library/curses ascii curses ascii US12249061
Ref: 366512249061
Ref: library/curses ascii curses ascii SP12249133
Ref: 366612249133
Ref: library/curses ascii curses ascii DEL12249196
Ref: 366712249196
Ref: library/curses ascii curses ascii isalnum12249659
Ref: 366812249659
Ref: library/curses ascii curses ascii isalpha12249809
Ref: 366912249809
Ref: library/curses ascii curses ascii isascii12249973
Ref: 366a12249973
Ref: library/curses ascii curses ascii isblank12250100
Ref: 366b12250100
Ref: library/curses ascii curses ascii iscntrl12250209
Ref: 366c12250209
Ref: library/curses ascii curses ascii isdigit12250355
Ref: 366d12250355
Ref: library/curses ascii curses ascii isgraph12250558
Ref: 366e12250558
Ref: library/curses ascii curses ascii islower12250660
Ref: 366f12250660
Ref: library/curses ascii curses ascii isprint12250753
Ref: 367012250753
Ref: library/curses ascii curses ascii ispunct12250879
Ref: 367112250879
Ref: library/curses ascii curses ascii isspace12251023
Ref: 367212251023
Ref: library/curses ascii curses ascii isupper12251203
Ref: 367312251203
Ref: library/curses ascii curses ascii isxdigit12251296
Ref: 367412251296
Ref: library/curses ascii curses ascii isctrl12251445
Ref: 367512251445
Ref: library/curses ascii curses ascii ismeta12251646
Ref: 367612251646
Ref: library/curses ascii curses ascii ascii12252423
Ref: 367712252423
Ref: library/curses ascii curses ascii ctrl12252542
Ref: 367812252542
Ref: library/curses ascii curses ascii alt12252706
Ref: 367912252706
Ref: library/curses ascii curses ascii unctrl12252995
Ref: 367a12252995
Ref: library/curses ascii curses ascii controlnames12253681
Ref: 367b12253681
Ref: curses ascii --- ASCII 文字のユーティリティー-Footnote-112253956
Node: curses panel --- curses のためのパネルスタック拡張12254028
Ref: library/curses panel doc12254333
Ref: 367c12254333
Ref: library/curses panel curses-panel-a-panel-stack-extension-for-curses12254333
Ref: 367d12254333
Ref: library/curses panel module-curses panel12254333
Ref: 3112254333
Ref: library/curses panel translation-repo12254333
Ref: 367e12254333
Node: 関数<7>12254963
Ref: library/curses panel cursespanel-functions12255094
Ref: 367f12255094
Ref: library/curses panel functions12255094
Ref: 368012255094
Ref: library/curses panel curses panel bottom_panel12255189
Ref: 368112255189
Ref: library/curses panel curses panel new_panel12255304
Ref: 368212255304
Ref: library/curses panel curses panel top_panel12255662
Ref: 368312255662
Ref: library/curses panel curses panel update_panels12255774
Ref: 368412255774
Node: Panel objects12256054
Ref: library/curses panel curses-panel-objects12256185
Ref: 368512256185
Ref: library/curses panel panel-objects12256185
Ref: 368612256185
Ref: library/curses panel curses panel Panel above12256564
Ref: 368712256564
Ref: library/curses panel curses panel Panel below12256665
Ref: 368812256665
Ref: library/curses panel curses panel Panel bottom12256766
Ref: 368912256766
Ref: library/curses panel curses panel Panel hidden12256871
Ref: 368a12256871
Ref: library/curses panel curses panel Panel hide12257053
Ref: 368b12257053
Ref: library/curses panel curses panel Panel move12257255
Ref: 368c12257255
Ref: library/curses panel curses panel Panel replace12257367
Ref: 368d12257367
Ref: library/curses panel curses panel Panel set_userptr12257492
Ref: 368e12257492
Ref: library/curses panel curses panel Panel show12257776
Ref: 368f12257776
Ref: library/curses panel curses panel Panel top12257908
Ref: 369012257908
Ref: library/curses panel curses panel Panel userptr12258010
Ref: 369112258010
Ref: library/curses panel curses panel Panel window12258148
Ref: 369212258148
Node: cmd --- 行指向のコマンドインタープリターのサポート12258280
Ref: library/cmd doc12258520
Ref: 369312258520
Ref: library/cmd cmd-support-for-line-oriented-command-interpreters12258520
Ref: 369412258520
Ref: library/cmd module-cmd12258520
Ref: 1a12258520
Ref: library/cmd translation-repo12258520
Ref: 369512258520
Ref: library/cmd cmd Cmd12259139
Ref: 18b312259139
Ref: cmd --- 行指向のコマンドインタープリターのサポート-Footnote-112261094
Node: Cmdオブジェクト12261157
Ref: library/cmd cmd-objects12261305
Ref: 369712261305
Ref: library/cmd id112261305
Ref: 369812261305
Ref: library/cmd cmd Cmd cmdloop12261439
Ref: 369912261439
Ref: library/cmd cmd Cmd do_help12263764
Ref: 1a8d12263764
Ref: library/cmd cmd Cmd onecmd12264303
Ref: 369c12264303
Ref: library/cmd cmd Cmd emptyline12264900
Ref: 369f12264900
Ref: library/cmd cmd Cmd default12265186
Ref: 369e12265186
Ref: library/cmd cmd Cmd completedefault12265471
Ref: 36a012265471
Ref: library/cmd cmd Cmd columnize12265699
Ref: 1c6612265699
Ref: library/cmd cmd Cmd precmd12265941
Ref: 369d12265941
Ref: library/cmd cmd Cmd postcmd12266598
Ref: 369b12266598
Ref: library/cmd cmd Cmd preloop12267301
Ref: 36a112267301
Ref: library/cmd cmd Cmd postloop12267602
Ref: 36a212267602
Ref: library/cmd cmd Cmd prompt12268030
Ref: 36a312268030
Ref: library/cmd cmd Cmd identchars12268124
Ref: 36a412268124
Ref: library/cmd cmd Cmd lastcmd12268240
Ref: 36a512268240
Ref: library/cmd cmd Cmd cmdqueue12268320
Ref: 36a612268320
Ref: library/cmd cmd Cmd intro12268673
Ref: 369a12268673
Ref: library/cmd cmd Cmd doc_header12268909
Ref: 36a712268909
Ref: library/cmd cmd Cmd misc_header12269061
Ref: 36a812269061
Ref: library/cmd cmd Cmd undoc_header12269280
Ref: 36a912269280
Ref: library/cmd cmd Cmd ruler12269496
Ref: 36aa12269496
Ref: library/cmd cmd Cmd use_rawinput12269746
Ref: 369612269746
Node: Cmd の例12270222
Ref: library/cmd cmd-example12270370
Ref: 36ab12270370
Ref: library/cmd id212270370
Ref: 36ac12270370
Node: 並行実行12275743
Ref: library/concurrency doc12275946
Ref: 36ae12275946
Ref: library/concurrency concurrency12275946
Ref: 36af12275946
Ref: library/concurrency concurrent-execution12275946
Ref: 36b012275946
Ref: library/concurrency translation-repo12275946
Ref: 36b112275946
Node: threading --- スレッドベースの並列処理12277450
Ref: library/threading doc12277614
Ref: 36b212277614
Ref: library/threading module-threading12277614
Ref: f312277614
Ref: library/threading threading-thread-based-parallelism12277614
Ref: 36b312277614
Ref: threading --- スレッドベースの並列処理-Footnote-112278453
Node: はじめに<8>12278522
Ref: library/threading introduction12278667
Ref: 36b412278667
Ref: はじめに<8>-Footnote-112281742
Node: GIL and performance considerations12281799
Ref: library/threading gil-and-performance-considerations12281974
Ref: 36b512281974
Ref: GIL and performance considerations-Footnote-112282765
Node: リファレンス<2>12282807
Ref: library/threading reference12283032
Ref: 36b612283032
Ref: library/threading threading active_count12283149
Ref: 35d12283149
Ref: library/threading threading current_thread12283439
Ref: 35c12283439
Ref: library/threading threading excepthook12283829
Ref: a4f12283829
Ref: library/threading threading __excepthook__12285197
Ref: a4e12285197
Ref: library/threading threading get_ident12285474
Ref: 137612285474
Ref: library/threading threading get_native_id12285992
Ref: c3612285992
Ref: library/threading threading enumerate12286554
Ref: 1cb712286554
Ref: library/threading threading main_thread12287069
Ref: 11d812287069
Ref: library/threading threading settrace12287328
Ref: a4c12287328
Ref: library/threading threading settrace_all_threads12287585
Ref: 6ef12287585
Ref: library/threading threading gettrace12287940
Ref: a4a12287940
Ref: library/threading threading setprofile12288097
Ref: a4d12288097
Ref: library/threading threading setprofile_all_threads12288361
Ref: 6f012288361
Ref: library/threading threading getprofile12288723
Ref: a4b12288723
Ref: library/threading threading stack_size12288896
Ref: 36b712288896
Ref: library/threading threading TIMEOUT_MAX12290638
Ref: 36b812290638
Node: Thread-local data12292272
Ref: library/threading thread-local-data12292370
Ref: 36b912292370
Ref: library/threading threading local12295467
Ref: 18c412295467
Node: Thread objects12295566
Ref: library/threading id112295685
Ref: 36ba12295685
Ref: library/threading thread-objects12295685
Ref: 36bb12295685
Ref: library/threading threading Thread12299567
Ref: 17712299567
Ref: library/threading threading Thread start12302201
Ref: 17912302201
Ref: library/threading threading Thread run12303057
Ref: c3512303057
Ref: library/threading meth-thread-join12304001
Ref: 36bc12304001
Ref: library/threading threading Thread join12304001
Ref: 140112304001
Ref: library/threading threading Thread name12305771
Ref: 2a212305771
Ref: library/threading threading Thread getName12306632
Ref: 36be12306632
Ref: library/threading threading Thread setName12306666
Ref: 35b12306666
Ref: library/threading threading Thread ident12306891
Ref: 31d112306891
Ref: library/threading threading Thread native_id12307377
Ref: c3712307377
Ref: library/threading threading Thread is_alive12308192
Ref: b4a12308192
Ref: library/threading threading Thread daemon12308624
Ref: 35a12308624
Ref: library/threading threading Thread isDaemon12309417
Ref: 36bf12309417
Ref: library/threading threading Thread setDaemon12309452
Ref: 35912309452
Node: Lock objects12309681
Ref: library/threading id212309796
Ref: 36c012309796
Ref: library/threading lock-objects12309796
Ref: 36c112309796
Ref: library/threading threading Lock12311842
Ref: 1a5412311842
Ref: library/threading threading Lock acquire12312401
Ref: 8a812312401
Ref: library/threading threading Lock release12314140
Ref: 14de12314140
Ref: library/threading threading Lock locked12314881
Ref: 36c312314881
Node: RLock objects12314981
Ref: library/threading id312315099
Ref: 36c412315099
Ref: library/threading rlock-objects12315099
Ref: 36c512315099
Ref: library/threading threading RLock12316657
Ref: 32c12316657
Ref: library/threading threading RLock acquire12317400
Ref: 107f12317400
Ref: library/threading threading RLock release12319425
Ref: 36c612319425
Ref: library/threading threading RLock locked12320405
Ref: 18a112320405
Node: Condition objects12320563
Ref: library/threading condition-objects12320686
Ref: 36c712320686
Ref: library/threading id412320686
Ref: 36c812320686
Ref: library/threading threading Condition12324724
Ref: 137112324724
Ref: library/threading threading Condition acquire12325499
Ref: 36c912325499
Ref: library/threading threading Condition release12325762
Ref: 36ca12325762
Ref: library/threading threading Condition locked12325991
Ref: 36cc12325991
Ref: library/threading threading Condition wait12326149
Ref: 1cc312326149
Ref: library/threading threading Condition wait_for12328191
Ref: 36cb12328191
Ref: library/threading threading Condition notify12329498
Ref: 1bc512329498
Ref: library/threading threading Condition notify_all12330734
Ref: 35712330734
Node: Semaphore objects12331245
Ref: library/threading id512331372
Ref: 36cd12331372
Ref: library/threading semaphore-objects12331372
Ref: 36ce12331372
Ref: library/threading threading Semaphore12332258
Ref: 137212332258
Ref: library/threading threading Semaphore acquire12333188
Ref: 146f12333188
Ref: library/threading threading Semaphore release12334633
Ref: 36cf12334633
Ref: library/threading threading BoundedSemaphore12335202
Ref: 137312335202
Node: Semaphore example12335978
Ref: library/threading semaphore-example12336101
Ref: 36d012336101
Ref: library/threading semaphore-examples12336101
Ref: 36d112336101
Node: Event objects12337123
Ref: library/threading event-objects12337242
Ref: 36d212337242
Ref: library/threading id612337242
Ref: 36d312337242
Ref: library/threading threading Event12337811
Ref: 137412337811
Ref: library/threading threading Event is_set12338424
Ref: 35812338424
Ref: library/threading threading Event set12338624
Ref: 36d412338624
Ref: library/threading threading Event clear12338988
Ref: 36d512338988
Ref: library/threading threading Event wait12339331
Ref: 154212339331
Node: Timer objects12340103
Ref: library/threading id712340220
Ref: 36d612340220
Ref: library/threading timer-objects12340220
Ref: 36d712340220
Ref: library/threading threading Timer12341001
Ref: 137512341001
Ref: library/threading threading Timer cancel12341502
Ref: 36d812341502
Node: Barrier objects12341742
Ref: library/threading barrier-objects12341837
Ref: 36d912341837
Ref: library/threading threading Barrier12342958
Ref: 140012342958
Ref: library/threading threading Barrier wait12343459
Ref: 36da12343459
Ref: library/threading threading Barrier reset12344928
Ref: 36db12344928
Ref: library/threading threading Barrier abort12345537
Ref: 36dc12345537
Ref: library/threading threading Barrier parties12346251
Ref: 36dd12346251
Ref: library/threading threading Barrier n_waiting12346355
Ref: 36de12346355
Ref: library/threading threading Barrier broken12346458
Ref: 36df12346458
Ref: library/threading threading BrokenBarrierError12346581
Ref: 140212346581
Node: with 文でのロック・条件変数・セマフォの使い方12346808
Ref: library/threading using-locks-conditions-and-semaphores-in-the-with-statement12346990
Ref: 36e012346990
Ref: library/threading with-locks12346990
Ref: 36c212346990
Node: multiprocessing --- プロセスベースの並列処理12347885
Ref: library/multiprocessing doc12348152
Ref: 36e112348152
Ref: library/multiprocessing module-multiprocessing12348152
Ref: 9812348152
Ref: library/multiprocessing multiprocessing-process-based-parallelism12348152
Ref: 36e212348152
Ref: library/multiprocessing translation-repo12348152
Ref: 36e312348152
Ref: multiprocessing --- プロセスベースの並列処理-Footnote-112348806
Node: はじめに<9>12348879
Ref: library/multiprocessing introduction12349017
Ref: 36e412349017
Node: Process クラス12351100
Ref: library/multiprocessing the-process-class12351211
Ref: 36e512351211
Node: コンテキストと開始方式12352766
Ref: library/multiprocessing contexts-and-start-methods12352931
Ref: 36e712352931
Ref: library/multiprocessing multiprocessing-start-methods12352931
Ref: 1d712352931
Ref: library/multiprocessing multiprocessing-start-method-spawn12353124
Ref: 1da12353124
Ref: library/multiprocessing multiprocessing-start-method-fork12353745
Ref: 1d912353745
Ref: library/multiprocessing multiprocessing-start-method-forkserver12354883
Ref: 1d612354883
Ref: コンテキストと開始方式-Footnote-112359349
Ref: コンテキストと開始方式-Footnote-212359414
Node: プロセス間でのオブジェクト交換12359469
Ref: library/multiprocessing exchanging-objects-between-processes12359641
Ref: 36e912359641
Node: プロセス間の同期12361893
Ref: library/multiprocessing synchronization-between-processes12362068
Ref: 36eb12362068
Node: プロセス間での状態の共有12362819
Ref: library/multiprocessing sharing-state-between-processes12362994
Ref: 36ec12362994
Node: ワーカープロセスのプールを使用12367271
Ref: library/multiprocessing using-a-pool-of-workers12367413
Ref: 36f412367413
Node: リファレンス<3>12371134
Ref: library/multiprocessing reference12371320
Ref: 36f512371320
Node: Global start method12372005
Ref: library/multiprocessing global-start-method12372117
Ref: 36f612372117
Ref: library/multiprocessing id112372117
Ref: 36f712372117
Node: Process クラスと例外12372734
Ref: library/multiprocessing process-and-exceptions12372888
Ref: 36f812372888
Ref: library/multiprocessing multiprocessing Process12372965
Ref: 25412372965
Ref: library/multiprocessing multiprocessing Process run12376244
Ref: 36e812376244
Ref: library/multiprocessing multiprocessing Process start12377280
Ref: 15ad12377280
Ref: library/multiprocessing multiprocessing Process join12377646
Ref: 15af12377646
Ref: library/multiprocessing multiprocessing Process name12378640
Ref: 36f912378640
Ref: library/multiprocessing multiprocessing Process is_alive12379252
Ref: 15ae12379252
Ref: library/multiprocessing multiprocessing Process daemon12379565
Ref: 36fa12379565
Ref: library/multiprocessing multiprocessing Process pid12380857
Ref: 36fd12380857
Ref: library/multiprocessing multiprocessing Process exitcode12381006
Ref: 36fc12381006
Ref: library/multiprocessing multiprocessing Process authkey12381603
Ref: 36fe12381603
Ref: library/multiprocessing multiprocessing Process sentinel12382183
Ref: 12fd12382183
Ref: library/multiprocessing multiprocessing Process interrupt12382845
Ref: 25312382845
Ref: library/multiprocessing multiprocessing Process terminate12383750
Ref: 18bc12383750
Ref: library/multiprocessing multiprocessing Process kill12384794
Ref: d5312384794
Ref: library/multiprocessing multiprocessing Process close12384958
Ref: d5212384958
Ref: library/multiprocessing multiprocessing ProcessError12386381
Ref: 370012386381
Ref: library/multiprocessing multiprocessing BufferTooShort12386485
Ref: 370112386485
Ref: library/multiprocessing multiprocessing AuthenticationError12386848
Ref: 370212386848
Ref: library/multiprocessing multiprocessing TimeoutError12386961
Ref: 370312386961
Ref: Process クラスと例外-Footnote-112387166
Node: パイプ Pipe とキュー Queue12387222
Ref: library/multiprocessing pipes-and-queues12387369
Ref: 370412387369
Ref: library/multiprocessing multiprocessing Pipe12392492
Ref: 36ea12392492
Ref: library/multiprocessing multiprocessing Queue12393070
Ref: 1be712393070
Ref: library/multiprocessing multiprocessing Queue qsize12393959
Ref: 370f12393959
Ref: library/multiprocessing multiprocessing Queue empty12394334
Ref: 19c812394334
Ref: library/multiprocessing multiprocessing Queue full12394694
Ref: 371012394694
Ref: library/multiprocessing multiprocessing Queue put12394966
Ref: 1e7912394966
Ref: library/multiprocessing multiprocessing Queue put_nowait12395977
Ref: 371112395977
Ref: library/multiprocessing multiprocessing Queue get12396070
Ref: 1e7a12396070
Ref: library/multiprocessing multiprocessing Queue get_nowait12397007
Ref: 370c12397007
Ref: library/multiprocessing multiprocessing Queue close12397309
Ref: 1be812397309
Ref: library/multiprocessing multiprocessing Queue join_thread12397774
Ref: 371212397774
Ref: library/multiprocessing multiprocessing Queue cancel_join_thread12398577
Ref: 370d12398577
Ref: library/multiprocessing multiprocessing SimpleQueue12400156
Ref: b1412400156
Ref: library/multiprocessing multiprocessing SimpleQueue close12400454
Ref: b1512400454
Ref: library/multiprocessing multiprocessing SimpleQueue empty12400771
Ref: 19c912400771
Ref: library/multiprocessing multiprocessing SimpleQueue get12401009
Ref: 371312401009
Ref: library/multiprocessing multiprocessing SimpleQueue put12401103
Ref: 371412401103
Ref: library/multiprocessing multiprocessing JoinableQueue12401190
Ref: 370512401190
Ref: library/multiprocessing multiprocessing JoinableQueue task_done12401576
Ref: 370812401576
Ref: library/multiprocessing multiprocessing JoinableQueue join12402493
Ref: 371512402493
Ref: パイプ Pipe とキュー Queue-Footnote-112403104
Node: その他<5>12403168
Ref: library/multiprocessing miscellaneous12403321
Ref: 371612403321
Ref: library/multiprocessing multiprocessing active_children12403359
Ref: 371712403359
Ref: library/multiprocessing multiprocessing cpu_count12403648
Ref: 117512403648
Ref: library/multiprocessing multiprocessing current_process12404393
Ref: 371812404393
Ref: library/multiprocessing multiprocessing parent_process12404629
Ref: 371912404629
Ref: library/multiprocessing multiprocessing freeze_support12404899
Ref: 17d412404899
Ref: library/multiprocessing multiprocessing get_all_start_methods12405972
Ref: 116f12405972
Ref: library/multiprocessing multiprocessing get_context12406335
Ref: 24c12406335
Ref: library/multiprocessing multiprocessing get_start_method12406985
Ref: 117012406985
Ref: library/multiprocessing multiprocessing set_executable12407813
Ref: 1bee12407813
Ref: library/multiprocessing multiprocessing set_forkserver_preload12408434
Ref: 196912408434
Ref: library/multiprocessing multiprocessing set_start_method12409153
Ref: 24d12409153
Ref: その他<5>-Footnote-112410313
Node: Connection オブジェクト<2>12410378
Ref: library/multiprocessing connection-objects12410522
Ref: 371a12410522
Ref: library/multiprocessing multiprocessing connection Connection12411038
Ref: 12fc12411038
Ref: library/multiprocessing multiprocessing connection Connection send12411092
Ref: 371c12411092
Ref: library/multiprocessing multiprocessing connection Connection recv12411549
Ref: 371d12411549
Ref: library/multiprocessing multiprocessing connection Connection fileno12411922
Ref: 371e12411922
Ref: library/multiprocessing multiprocessing connection Connection close12412061
Ref: 371f12412061
Ref: library/multiprocessing multiprocessing connection Connection poll12412273
Ref: 372012412273
Ref: library/multiprocessing multiprocessing connection Connection send_bytes12412924
Ref: 372112412924
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes12413414
Ref: 372212413414
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes_into12414245
Ref: 372312414245
Ref: library/multiprocessing multiprocessing-recv-pickle-security12416146
Ref: 372412416146
Node: 同期プリミティブ12417019
Ref: library/multiprocessing synchronization-primitives12417183
Ref: 372512417183
Ref: library/multiprocessing multiprocessing Barrier12417707
Ref: 36f312417707
Ref: library/multiprocessing multiprocessing BoundedSemaphore12418031
Ref: 36f112418031
Ref: library/multiprocessing multiprocessing BoundedSemaphore locked12418561
Ref: 372712418561
Ref: library/multiprocessing multiprocessing Condition12418870
Ref: 36f212418870
Ref: library/multiprocessing multiprocessing Event12419354
Ref: 1c6312419354
Ref: library/multiprocessing multiprocessing Lock12419577
Ref: 18b812419577
Ref: library/multiprocessing multiprocessing Lock acquire12420858
Ref: 372612420858
Ref: library/multiprocessing multiprocessing Lock release12422577
Ref: 372812422577
Ref: library/multiprocessing multiprocessing Lock locked12423037
Ref: 18dc12423037
Ref: library/multiprocessing multiprocessing RLock12423195
Ref: 18b912423195
Ref: library/multiprocessing multiprocessing RLock acquire12424308
Ref: 372912424308
Ref: library/multiprocessing multiprocessing RLock release12426556
Ref: 372a12426556
Ref: library/multiprocessing multiprocessing RLock locked12427942
Ref: 18dd12427942
Ref: library/multiprocessing multiprocessing Semaphore12428100
Ref: 36f012428100
Ref: library/multiprocessing multiprocessing Semaphore get_value12428613
Ref: 372b12428613
Ref: library/multiprocessing multiprocessing Semaphore locked12428859
Ref: 372c12428859
Ref: 同期プリミティブ-Footnote-112429791
Node: 共有 ctypes オブジェクト12429855
Ref: library/multiprocessing shared-ctypes-objects12430005
Ref: 372d12430005
Ref: library/multiprocessing multiprocessing Value12430227
Ref: 36ed12430227
Ref: library/multiprocessing multiprocessing Array12432025
Ref: 36ee12432025
Node: The multiprocessing sharedctypes module12433997
Ref: library/multiprocessing module-multiprocessing sharedctypes12434105
Ref: 9e12434105
Ref: library/multiprocessing the-multiprocessing-sharedctypes-module12434105
Ref: 372e12434105
Ref: library/multiprocessing multiprocessing sharedctypes RawArray12434899
Ref: 372f12434899
Ref: library/multiprocessing multiprocessing sharedctypes RawValue12435963
Ref: 373112435963
Ref: library/multiprocessing multiprocessing sharedctypes Array12436979
Ref: 373012436979
Ref: library/multiprocessing multiprocessing sharedctypes Value12438083
Ref: 373212438083
Ref: library/multiprocessing multiprocessing sharedctypes copy12439182
Ref: 373312439182
Ref: library/multiprocessing multiprocessing sharedctypes synchronized12439380
Ref: 103512439380
Node: マネージャー12443067
Ref: library/multiprocessing managers12443217
Ref: 373412443217
Ref: library/multiprocessing multiprocessing-managers12443217
Ref: 370912443217
Ref: library/multiprocessing multiprocessing Manager12443733
Ref: 25212443733
Ref: library/multiprocessing module-multiprocessing managers12444195
Ref: 9b12444195
Ref: library/multiprocessing multiprocessing managers BaseManager12444432
Ref: 373512444432
Ref: library/multiprocessing multiprocessing managers BaseManager start12446228
Ref: 373612446228
Ref: library/multiprocessing multiprocessing managers BaseManager get_server12446534
Ref: 373812446534
Ref: library/multiprocessing multiprocessing managers BaseManager connect12447147
Ref: 373a12447147
Ref: library/multiprocessing multiprocessing managers BaseManager shutdown12447463
Ref: 373712447463
Ref: library/multiprocessing multiprocessing managers BaseManager register12447789
Ref: 373b12447789
Ref: library/multiprocessing multiprocessing managers BaseManager address12450767
Ref: 373912450767
Ref: library/multiprocessing multiprocessing managers SyncManager12451588
Ref: 18f712451588
Ref: library/multiprocessing multiprocessing managers SyncManager Barrier12452069
Ref: 373e12452069
Ref: library/multiprocessing multiprocessing managers SyncManager BoundedSemaphore12452298
Ref: 373f12452298
Ref: library/multiprocessing multiprocessing managers SyncManager Condition12452491
Ref: 374012452491
Ref: library/multiprocessing multiprocessing managers SyncManager Event12452960
Ref: 374112452960
Ref: library/multiprocessing multiprocessing managers SyncManager Lock12453124
Ref: 15b312453124
Ref: library/multiprocessing multiprocessing managers SyncManager Namespace12453286
Ref: 374212453286
Ref: library/multiprocessing multiprocessing managers SyncManager Queue12453448
Ref: 325e12453448
Ref: library/multiprocessing multiprocessing managers SyncManager RLock12453617
Ref: 15b412453617
Ref: library/multiprocessing multiprocessing managers SyncManager Semaphore12453780
Ref: 15b512453780
Ref: library/multiprocessing multiprocessing managers SyncManager Array12453959
Ref: 374312453959
Ref: library/multiprocessing multiprocessing managers SyncManager Value12454082
Ref: 374412454082
Ref: library/multiprocessing multiprocessing managers SyncManager dict12454247
Ref: 374512454247
Ref: library/multiprocessing multiprocessing managers SyncManager list12454477
Ref: 374612454477
Ref: library/multiprocessing multiprocessing managers SyncManager set12454668
Ref: 25112454668
Ref: library/multiprocessing multiprocessing managers Namespace12455251
Ref: 36ef12455251
Node: カスタマイズされたマネージャー12456279
Ref: library/multiprocessing customized-managers12456433
Ref: 374712456433
Node: リモートマネージャーを使用する12457340
Ref: library/multiprocessing using-a-remote-manager12457494
Ref: 374812457494
Node: Proxy オブジェクト12459970
Ref: library/multiprocessing multiprocessing-proxy-objects12460109
Ref: 24e12460109
Ref: library/multiprocessing proxy-objects12460109
Ref: 374912460109
Ref: library/multiprocessing multiprocessing managers BaseProxy12464085
Ref: 373c12464085
Ref: library/multiprocessing multiprocessing managers BaseProxy _callmethod12464254
Ref: 373d12464254
Ref: library/multiprocessing multiprocessing managers BaseProxy _getvalue12466020
Ref: 374a12466020
Ref: library/multiprocessing multiprocessing managers BaseProxy __repr__12466193
Ref: 374b12466193
Ref: library/multiprocessing multiprocessing managers BaseProxy __str__12466316
Ref: 374c12466316
Node: クリーンアップ<2>12466481
Ref: library/multiprocessing cleanup12466566
Ref: 374d12466566
Node: プロセスプール12467045
Ref: library/multiprocessing module-multiprocessing pool12467199
Ref: 9c12467199
Ref: library/multiprocessing process-pools12467199
Ref: 374e12467199
Ref: library/multiprocessing multiprocessing pool Pool12467377
Ref: 117112467377
Ref: library/multiprocessing multiprocessing pool Pool apply12470728
Ref: 15b112470728
Ref: library/multiprocessing multiprocessing pool Pool apply_async12471179
Ref: 15b212471179
Ref: library/multiprocessing multiprocessing pool Pool map12472326
Ref: 12ff12472326
Ref: library/multiprocessing multiprocessing pool Pool map_async12473259
Ref: 130012473259
Ref: library/multiprocessing multiprocessing pool Pool imap12474409
Ref: 375212474409
Ref: library/multiprocessing multiprocessing pool Pool imap_unordered12475284
Ref: 375312475284
Ref: library/multiprocessing multiprocessing pool Pool starmap12475647
Ref: 130112475647
Ref: library/multiprocessing multiprocessing pool Pool starmap_async12476093
Ref: 130212476093
Ref: library/multiprocessing multiprocessing pool Pool close12476584
Ref: 374f12476584
Ref: library/multiprocessing multiprocessing pool Pool terminate12476802
Ref: 375012476802
Ref: library/multiprocessing multiprocessing pool Pool join12477090
Ref: 375412477090
Ref: library/multiprocessing multiprocessing pool AsyncResult12477781
Ref: 375112477781
Ref: library/multiprocessing multiprocessing pool AsyncResult get12477951
Ref: 375512477951
Ref: library/multiprocessing multiprocessing pool AsyncResult wait12478389
Ref: 375612478389
Ref: library/multiprocessing multiprocessing pool AsyncResult ready12478516
Ref: 375712478516
Ref: library/multiprocessing multiprocessing pool AsyncResult successful12478630
Ref: 375812478630
Node: リスナーとクライアント12480000
Ref: library/multiprocessing listeners-and-clients12480142
Ref: 375912480142
Ref: library/multiprocessing module-multiprocessing connection12480142
Ref: 9912480142
Ref: library/multiprocessing multiprocessing-listeners-clients12480142
Ref: 371b12480142
Ref: library/multiprocessing multiprocessing connection deliver_challenge12480726
Ref: 375a12480726
Ref: library/multiprocessing multiprocessing connection answer_challenge12481234
Ref: 375b12481234
Ref: library/multiprocessing multiprocessing connection Client12481628
Ref: 375c12481628
Ref: library/multiprocessing multiprocessing connection Listener12482488
Ref: 1a8512482488
Ref: library/multiprocessing multiprocessing connection Listener accept12484615
Ref: 1a3e12484615
Ref: library/multiprocessing multiprocessing connection Listener close12484964
Ref: 375e12484964
Ref: library/multiprocessing multiprocessing connection Listener address12485428
Ref: 375f12485428
Ref: library/multiprocessing multiprocessing connection Listener last_accepted12485535
Ref: 376012485535
Ref: library/multiprocessing multiprocessing connection wait12486162
Ref: 12fb12486162
Node: アドレスフォーマット12490525
Ref: library/multiprocessing address-formats12490625
Ref: 376112490625
Ref: library/multiprocessing multiprocessing-address-formats12490625
Ref: 375d12490625
Node: 認証キー12491533
Ref: library/multiprocessing authentication-keys12491669
Ref: 376212491669
Ref: library/multiprocessing multiprocessing-auth-keys12491669
Ref: 36ff12491669
Node: ログ記録<2>12493835
Ref: library/multiprocessing logging12493970
Ref: 376312493970
Ref: library/multiprocessing multiprocessing get_logger12494337
Ref: 32b912494337
Ref: library/multiprocessing multiprocessing log_to_stderr12494911
Ref: 376412494911
Node: The multiprocessing dummy module12496181
Ref: library/multiprocessing module-multiprocessing dummy12496295
Ref: 9a12496295
Ref: library/multiprocessing the-multiprocessing-dummy-module12496295
Ref: 376512496295
Ref: library/multiprocessing multiprocessing pool ThreadPool12496805
Ref: 1d3212496805
Node: プログラミングガイドライン12498589
Ref: library/multiprocessing multiprocessing-programming12498773
Ref: 36e612498773
Ref: library/multiprocessing programming-guidelines12498773
Ref: 376612498773
Node: すべての開始方式について12499071
Ref: library/multiprocessing all-start-methods12499244
Ref: 376712499244
Ref: library/multiprocessing multiprocessing-programming-spawn12506412
Ref: 36fb12506412
Ref: すべての開始方式について-Footnote-112506449
Ref: すべての開始方式について-Footnote-212506513
Ref: すべての開始方式について-Footnote-312506577
Node: 開始方式が spawn および forkserver の場合12506641
Ref: library/multiprocessing multiprocessing-programming-forkserver12506814
Ref: 1db12506814
Ref: library/multiprocessing the-spawn-and-forkserver-start-methods12506814
Ref: 376812506814
Ref: library/multiprocessing multiprocessing-safe-main-import12507730
Ref: 376912507730
Node: 使用例<21>12509238
Ref: library/multiprocessing examples12509392
Ref: 376a12509392
Ref: library/multiprocessing multiprocessing-examples12509392
Ref: 370e12509392
Node: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ12518411
Ref: library/multiprocessing shared_memory doc12518654
Ref: 376b12518654
Ref: library/multiprocessing shared_memory module-multiprocessing shared_memory12518654
Ref: 9d12518654
Ref: library/multiprocessing shared_memory multiprocessing-shared-memory-shared-memory-for-direct-access-across-processes12518654
Ref: 376c12518654
Ref: library/multiprocessing shared_memory translation-repo12518654
Ref: 376d12518654
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory12520346
Ref: 1a3712520346
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory close12523660
Ref: 376f12523660
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory unlink12524134
Ref: 377012524134
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory buf12524746
Ref: 377112524746
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory name12524835
Ref: 377212524835
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory size12524946
Ref: 377312524946
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager12528036
Ref: 376e12528036
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager SharedMemory12529440
Ref: 377412529440
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager ShareableList12529598
Ref: 377512529598
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList12531459
Ref: 1db612531459
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList count12533959
Ref: 377612533959
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList index12534053
Ref: 377712534053
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList format12534209
Ref: 377812534209
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList shm12534363
Ref: 377912534363
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-112536954
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-212537044
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-312537071
Node: concurrent パッケージ12537127
Ref: library/concurrent doc12537358
Ref: 377a12537358
Ref: library/concurrent the-concurrent-package12537358
Ref: 377b12537358
Ref: library/concurrent translation-repo12537358
Ref: 377c12537358
Node: concurrent futures --- 並列タスク実行12537626
Ref: library/concurrent futures doc12537832
Ref: 377d12537832
Ref: library/concurrent futures concurrent-futures-launching-parallel-tasks12537832
Ref: 377e12537832
Ref: library/concurrent futures module-concurrent futures12537832
Ref: 2412537832
Ref: library/concurrent futures translation-repo12537832
Ref: 377f12537832
Ref: concurrent futures --- 並列タスク実行-Footnote-112539305
Ref: concurrent futures --- 並列タスク実行-Footnote-212539391
Ref: concurrent futures --- 並列タスク実行-Footnote-312539478
Node: Executor オブジェクト12539569
Ref: library/concurrent futures executor-objects12539704
Ref: 378212539704
Ref: library/concurrent futures concurrent futures Executor12539773
Ref: 378012539773
Ref: library/concurrent futures concurrent futures Executor submit12540022
Ref: c7912540022
Ref: library/concurrent futures concurrent futures Executor map12540528
Ref: 1de12540528
Ref: library/concurrent futures concurrent futures Executor shutdown12542567
Ref: aee12542567
Node: ThreadPoolExecutor12544936
Ref: library/concurrent futures threadpoolexecutor12545103
Ref: 378312545103
Ref: library/concurrent futures concurrent futures ThreadPoolExecutor12546422
Ref: 94d12546422
Node: ThreadPoolExecutor の例12549035
Ref: library/concurrent futures id112549115
Ref: 378512549115
Ref: library/concurrent futures threadpoolexecutor-example12549115
Ref: 13cf12549115
Node: InterpreterPoolExecutor12550319
Ref: library/concurrent futures interpreterpoolexecutor12550478
Ref: 378612550478
Ref: library/concurrent futures concurrent futures InterpreterPoolExecutor12553192
Ref: 1d412553192
Ref: InterpreterPoolExecutor-Footnote-112555180
Node: ProcessPoolExecutor12555222
Ref: library/concurrent futures processpoolexecutor12555388
Ref: 378812555388
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor12556608
Ref: 1d812556608
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor terminate_workers12560432
Ref: 1dc12560432
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor kill_workers12560924
Ref: 1dd12560924
Ref: ProcessPoolExecutor-Footnote-112561478
Node: ProcessPoolExecutor の例12561534
Ref: library/concurrent futures id212561616
Ref: 378912561616
Ref: library/concurrent futures processpoolexecutor-example12561616
Ref: 13d012561616
Node: Future オブジェクト12562518
Ref: library/concurrent futures future-objects12562685
Ref: 378a12562685
Ref: library/concurrent futures concurrent futures Future12562972
Ref: 13ce12562972
Ref: library/concurrent futures concurrent futures Future cancel12563273
Ref: 378b12563273
Ref: library/concurrent futures concurrent futures Future cancelled12563578
Ref: 378c12563578
Ref: library/concurrent futures concurrent futures Future running12563711
Ref: 378d12563711
Ref: library/concurrent futures concurrent futures Future done12563865
Ref: 378e12563865
Ref: library/concurrent futures concurrent futures Future result12564019
Ref: 178112564019
Ref: library/concurrent futures concurrent futures Future exception12564825
Ref: 378f12564825
Ref: library/concurrent futures concurrent futures Future add_done_callback12565658
Ref: 379012565658
Ref: library/concurrent futures concurrent futures Future set_running_or_notify_cancel12566827
Ref: 379112566827
Ref: library/concurrent futures concurrent futures Future set_result12568084
Ref: 379212568084
Ref: library/concurrent futures concurrent futures Future set_exception12568569
Ref: 379312568569
Node: モジュール関数<2>12569084
Ref: library/concurrent futures module-functions12569247
Ref: 379412569247
Ref: library/concurrent futures concurrent futures wait12569303
Ref: 1c6212569303
Ref: library/concurrent futures concurrent futures FIRST_COMPLETED12570682
Ref: 379512570682
Ref: library/concurrent futures concurrent futures FIRST_EXCEPTION12571025
Ref: 379612571025
Ref: library/concurrent futures concurrent futures ALL_COMPLETED12571549
Ref: 379712571549
Ref: library/concurrent futures concurrent futures as_completed12571777
Ref: 1a2612571777
Ref: モジュール関数<2>-Footnote-112572786
Node: 例外クラス12572828
Ref: library/concurrent futures exception-classes12572957
Ref: 379812572957
Ref: library/concurrent futures concurrent futures CancelledError12573003
Ref: bd212573003
Ref: library/concurrent futures concurrent futures TimeoutError12573121
Ref: 379912573121
Ref: library/concurrent futures concurrent futures BrokenExecutor12573410
Ref: 379a12573410
Ref: library/concurrent futures concurrent futures InvalidStateError12573665
Ref: 19b112573665
Ref: library/concurrent futures concurrent futures thread BrokenThreadPool12573846
Ref: 378412573846
Ref: library/concurrent futures concurrent futures interpreter BrokenInterpreterPool12574103
Ref: 379b12574103
Ref: library/concurrent futures concurrent futures process BrokenProcessPool12574378
Ref: 178012574378
Node: concurrent interpreters --- Multiple interpreters in the same process12574743
Ref: library/concurrent interpreters doc12574962
Ref: 379c12574962
Ref: library/concurrent interpreters concurrent-interpreters-multiple-interpreters-in-the-same-process12574962
Ref: 379d12574962
Ref: library/concurrent interpreters module-concurrent interpreters12574962
Ref: 2512574962
Ref: library/concurrent interpreters translation-repo12574962
Ref: 379e12574962
Ref: library/concurrent interpreters interp-concurrency12575874
Ref: 379f12575874
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-112576559
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-212576640
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-312576682
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-412576724
Node: Key details12576766
Ref: library/concurrent interpreters key-details12576908
Ref: 37a012576908
Ref: library/concurrent interpreters interp-isolation12577092
Ref: 37a112577092
Node: はじめに<10>12577201
Ref: library/concurrent interpreters interpreters-intro12577373
Ref: 37a212577373
Ref: library/concurrent interpreters introduction12577373
Ref: 37a312577373
Node: Multiple Interpreters and Isolation12578223
Ref: library/concurrent interpreters multiple-interpreters-and-isolation12578345
Ref: 37a412578345
Node: Running in an Interpreter12579319
Ref: library/concurrent interpreters running-in-an-interpreter12579477
Ref: 37a512579477
Ref: library/concurrent interpreters interp-call-in-thread12579979
Ref: 37a612579979
Node: Concurrency and Parallelism12580425
Ref: library/concurrent interpreters concurrency-and-parallelism12580582
Ref: 37a712580582
Node: Communication Between Interpreters12582155
Ref: library/concurrent interpreters communication-between-interpreters12582304
Ref: 37a812582304
Node: "Sharing" Objects12582765
Ref: library/concurrent interpreters interp-object-sharing12582878
Ref: 37aa12582878
Ref: library/concurrent interpreters sharing-objects12582878
Ref: 37ab12582878
Node: リファレンス<4>12583905
Ref: library/concurrent interpreters reference12584090
Ref: 37ad12584090
Ref: library/concurrent interpreters concurrent interpreters list_all12584207
Ref: 37ae12584207
Ref: library/concurrent interpreters concurrent interpreters get_current12584368
Ref: 37b012584368
Ref: library/concurrent interpreters concurrent interpreters get_main12584515
Ref: 37b112584515
Ref: library/concurrent interpreters concurrent interpreters create12584798
Ref: 177712584798
Ref: library/concurrent interpreters concurrent interpreters create_queue12584955
Ref: 37a912584955
Node: Interpreter objects12585205
Ref: library/concurrent interpreters interpreter-objects12585301
Ref: 37b212585301
Ref: library/concurrent interpreters concurrent interpreters Interpreter12585360
Ref: 37af12585360
Ref: library/concurrent interpreters concurrent interpreters Interpreter id12585612
Ref: 37b312585612
Ref: library/concurrent interpreters concurrent interpreters Interpreter whence12585703
Ref: 37b412585703
Ref: library/concurrent interpreters concurrent interpreters Interpreter is_running12585818
Ref: 37b512585818
Ref: library/concurrent interpreters concurrent interpreters Interpreter close12585998
Ref: 183c12585998
Ref: library/concurrent interpreters concurrent interpreters Interpreter prepare_main12586080
Ref: 37b612586080
Ref: library/concurrent interpreters concurrent interpreters Interpreter exec12586380
Ref: 37b712586380
Ref: library/concurrent interpreters concurrent interpreters Interpreter call12586523
Ref: 37b812586523
Ref: library/concurrent interpreters concurrent interpreters Interpreter call_in_thread12586704
Ref: 37b912586704
Node: 例外<13>12586846
Ref: library/concurrent interpreters exceptions12586985
Ref: 37ba12586985
Ref: library/concurrent interpreters concurrent interpreters InterpreterError12587018
Ref: 37bb12587018
Ref: library/concurrent interpreters concurrent interpreters InterpreterNotFoundError12587188
Ref: 37bc12587188
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed12587379
Ref: 378712587379
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed excinfo12587565
Ref: 37bd12587565
Ref: library/concurrent interpreters concurrent interpreters NotShareableError12587682
Ref: 37be12587682
Node: Communicating Between Interpreters12587864
Ref: library/concurrent interpreters communicating-between-interpreters12587975
Ref: 37bf12587975
Ref: library/concurrent interpreters concurrent interpreters Queue12588066
Ref: 37ac12588066
Ref: library/concurrent interpreters concurrent interpreters Queue id12588483
Ref: 37c012588483
Ref: library/concurrent interpreters concurrent interpreters QueueEmptyError12588557
Ref: 37c112588557
Ref: library/concurrent interpreters concurrent interpreters QueueFullError12588768
Ref: 37c212588768
Node: 基本的な使い方<3>12588971
Ref: library/concurrent interpreters basic-usage12589131
Ref: 37c312589131
Node: subprocess --- サブプロセス管理12589799
Ref: library/subprocess doc12590017
Ref: 37c412590017
Ref: library/subprocess module-subprocess12590017
Ref: dc12590017
Ref: library/subprocess subprocess-subprocess-management12590017
Ref: 37c512590017
Ref: library/subprocess translation-repo12590017
Ref: 37c612590017
Ref: subprocess --- サブプロセス管理-Footnote-112591275
Ref: subprocess --- サブプロセス管理-Footnote-212591345
Node: Using the subprocess Module12591387
Ref: library/subprocess using-the-subprocess-module12591541
Ref: 37c712591541
Ref: library/subprocess subprocess run12591904
Ref: d8312591904
Ref: library/subprocess subprocess CompletedProcess12597301
Ref: 107712597301
Ref: library/subprocess subprocess CompletedProcess args12597436
Ref: 37ca12597436
Ref: library/subprocess subprocess CompletedProcess returncode12597601
Ref: 37cb12597601
Ref: library/subprocess subprocess CompletedProcess stdout12597944
Ref: 37cc12597944
Ref: library/subprocess subprocess CompletedProcess stderr12598574
Ref: 37cd12598574
Ref: library/subprocess subprocess CompletedProcess check_returncode12598969
Ref: 37ce12598969
Ref: library/subprocess subprocess DEVNULL12599167
Ref: 136a12599167
Ref: library/subprocess subprocess PIPE12599432
Ref: d8412599432
Ref: library/subprocess subprocess STDOUT12599712
Ref: 37c912599712
Ref: library/subprocess subprocess SubprocessError12599934
Ref: 37cf12599934
Ref: library/subprocess subprocess TimeoutExpired12600093
Ref: 181912600093
Ref: library/subprocess subprocess TimeoutExpired cmd12600315
Ref: 37d012600315
Ref: library/subprocess subprocess TimeoutExpired timeout12600415
Ref: 37d112600415
Ref: library/subprocess subprocess TimeoutExpired output12600483
Ref: 37d212600483
Ref: library/subprocess subprocess TimeoutExpired stdout12600973
Ref: 37d312600973
Ref: library/subprocess subprocess TimeoutExpired stderr12601076
Ref: 37d412601076
Ref: library/subprocess subprocess CalledProcessError12601711
Ref: 154012601711
Ref: library/subprocess subprocess CalledProcessError returncode12602076
Ref: 37d612602076
Ref: library/subprocess subprocess CalledProcessError cmd12602296
Ref: 37d712602296
Ref: library/subprocess subprocess CalledProcessError output12602396
Ref: 37d812602396
Ref: library/subprocess subprocess CalledProcessError stdout12602625
Ref: 37d912602625
Ref: library/subprocess subprocess CalledProcessError stderr12602728
Ref: 37da12602728
Node: よく使われる引数12603125
Ref: library/subprocess frequently-used-arguments12603252
Ref: 37c812603252
Ref: library/subprocess id112603252
Ref: 37db12603252
Node: Popen コンストラクター12608167
Ref: library/subprocess popen-constructor12608313
Ref: 37e012608313
Ref: library/subprocess subprocess Popen12608707
Ref: 4b712608707
Ref: Popen コンストラクター-Footnote-112629022
Node: 例外<14>12629082
Ref: library/subprocess exceptions12629195
Ref: 37f112629195
Node: セキュリティで考慮すべき点<2>12630548
Ref: library/subprocess security-considerations12630735
Ref: 37df12630735
Ref: library/subprocess subprocess-security12630735
Ref: 37f212630735
Ref: セキュリティで考慮すべき点<2>-Footnote-112631868
Ref: セキュリティで考慮すべき点<2>-Footnote-212631938
Node: Popen オブジェクト12631994
Ref: library/subprocess popen-objects12632180
Ref: 37f412632180
Ref: library/subprocess subprocess Popen poll12632349
Ref: 37f512632349
Ref: library/subprocess subprocess Popen wait12632571
Ref: ee412632571
Ref: library/subprocess subprocess Popen communicate12633765
Ref: 181812633765
Ref: library/subprocess subprocess Popen send_signal12636254
Ref: 15fc12636254
Ref: library/subprocess subprocess Popen terminate12636677
Ref: 15fa12636677
Ref: library/subprocess subprocess Popen kill12636902
Ref: 15fb12636902
Ref: library/subprocess subprocess Popen args12637263
Ref: 37f612637263
Ref: library/subprocess subprocess Popen stdin12637471
Ref: 37dc12637471
Ref: library/subprocess subprocess Popen stdout12637907
Ref: 37dd12637907
Ref: library/subprocess subprocess Popen stderr12638415
Ref: 37de12638415
Ref: library/subprocess subprocess Popen pid12639278
Ref: 37f712639278
Ref: library/subprocess subprocess Popen returncode12639492
Ref: c8712639492
Node: Windows Popen ヘルパー12640297
Ref: library/subprocess windows-popen-helpers12640460
Ref: 37f812640460
Ref: library/subprocess subprocess STARTUPINFO12640628
Ref: 37e412640628
Ref: library/subprocess subprocess STARTUPINFO dwFlags12641093
Ref: 37f912641093
Ref: library/subprocess subprocess STARTUPINFO hStdInput12641450
Ref: 37fa12641450
Ref: library/subprocess subprocess STARTUPINFO hStdOutput12641792
Ref: 37fc12641792
Ref: library/subprocess subprocess STARTUPINFO hStdError12642150
Ref: 37fd12642150
Ref: library/subprocess subprocess STARTUPINFO wShowWindow12642519
Ref: 37fe12642519
Ref: library/subprocess subprocess STARTUPINFO lpAttributeList12643089
Ref: e0c12643089
Ref: Windows Popen ヘルパー-Footnote-112644345
Ref: Windows Popen ヘルパー-Footnote-212644417
Ref: Windows Popen ヘルパー-Footnote-312644489
Node: Windows Constants12644578
Ref: library/subprocess windows-constants12644658
Ref: 380112644658
Ref: library/subprocess subprocess STD_INPUT_HANDLE12644775
Ref: 380212644775
Ref: library/subprocess subprocess STD_OUTPUT_HANDLE12644944
Ref: 380312644944
Ref: library/subprocess subprocess STD_ERROR_HANDLE12645128
Ref: 380412645128
Ref: library/subprocess subprocess SW_HIDE12645314
Ref: 380012645314
Ref: library/subprocess subprocess STARTF_USESTDHANDLES12645446
Ref: 37fb12645446
Ref: library/subprocess subprocess STARTF_USESHOWWINDOW12645684
Ref: 37ff12645684
Ref: library/subprocess subprocess STARTF_FORCEONFEEDBACK12645840
Ref: 380512645840
Ref: library/subprocess subprocess STARTF_FORCEOFFFEEDBACK12646139
Ref: 380612646139
Ref: library/subprocess subprocess CREATE_NEW_CONSOLE12646354
Ref: 37e512646354
Ref: library/subprocess subprocess CREATE_NEW_PROCESS_GROUP12646567
Ref: 37e612646567
Ref: library/subprocess subprocess ABOVE_NORMAL_PRIORITY_CLASS12646984
Ref: 37e712646984
Ref: library/subprocess subprocess BELOW_NORMAL_PRIORITY_CLASS12647195
Ref: 37e812647195
Ref: library/subprocess subprocess HIGH_PRIORITY_CLASS12647405
Ref: 37e912647405
Ref: library/subprocess subprocess IDLE_PRIORITY_CLASS12647598
Ref: 37ea12647598
Ref: library/subprocess subprocess NORMAL_PRIORITY_CLASS12647801
Ref: 37eb12647801
Ref: library/subprocess subprocess REALTIME_PRIORITY_CLASS12648009
Ref: 37ec12648009
Ref: library/subprocess subprocess CREATE_NO_WINDOW12648546
Ref: 37ed12648546
Ref: library/subprocess subprocess DETACHED_PROCESS12648735
Ref: 37ee12648735
Ref: library/subprocess subprocess CREATE_DEFAULT_ERROR_MODE12648994
Ref: 37ef12648994
Ref: library/subprocess subprocess CREATE_BREAKAWAY_FROM_JOB12649401
Ref: 37f012649401
Node: 古い高水準 API12649605
Ref: library/subprocess call-function-trio12649796
Ref: 380712649796
Ref: library/subprocess older-high-level-api12649796
Ref: 380812649796
Ref: library/subprocess subprocess call12650165
Ref: d8512650165
Ref: library/subprocess subprocess check_call12651948
Ref: 37d512651948
Ref: library/subprocess subprocess check_output12653976
Ref: 11c812653976
Node: Replacing Older Functions with the subprocess Module12656969
Ref: library/subprocess replacing-older-functions-with-the-subprocess-module12657176
Ref: 380912657176
Ref: library/subprocess subprocess-replacements12657176
Ref: 13a412657176
Node: Replacing /bin/sh shell command substitution12658455
Ref: library/subprocess replacing-bin-sh-shell-command-substitution12658645
Ref: 380a12658645
Node: シェルのパイプラインを置き換える12658882
Ref: library/subprocess replacing-shell-pipeline12659109
Ref: 380b12659109
Node: os system を置き換える12659947
Ref: library/subprocess replacing-os-system12660166
Ref: 380c12660166
Node: os spawn 関数群を置き換える12661153
Ref: library/subprocess replacing-the-os-spawn-family12661342
Ref: 380d12661342
Node: Replacing os popen12662000
Ref: library/subprocess replacing-os-popen12662152
Ref: 380e12662152
Node: レガシーなシェル呼び出し関数12662589
Ref: library/subprocess legacy-shell-invocation-functions12662786
Ref: 380f12662786
Ref: library/subprocess subprocess getstatusoutput12663240
Ref: 11ca12663240
Ref: library/subprocess subprocess getoutput12664635
Ref: 11c912664635
Node: 注釈<2>12665257
Ref: library/subprocess notes12665393
Ref: 381012665393
Node: Timeout Behavior12665590
Ref: library/subprocess subprocess-timeout-behavior12665729
Ref: 381112665729
Ref: library/subprocess timeout-behavior12665729
Ref: 381212665729
Node: Windows における引数シーケンスから文字列への変換12666516
Ref: library/subprocess converting-an-argument-sequence-to-a-string-on-windows12666690
Ref: 381312666690
Ref: library/subprocess converting-argument-sequence12666690
Ref: 37e112666690
Node: Disable use of posix_spawn12668203
Ref: library/subprocess disable-posix-spawn12668352
Ref: 381412668352
Ref: library/subprocess disable-use-of-posix-spawn12668352
Ref: 381512668352
Node: sched --- イベントスケジューラー12669187
Ref: library/sched doc12669370
Ref: 381612669370
Ref: library/sched module-sched12669370
Ref: c412669370
Ref: library/sched sched-event-scheduler12669370
Ref: 381712669370
Ref: library/sched translation-repo12669370
Ref: 381812669370
Ref: library/sched sched scheduler12669667
Ref: 134312669667
Ref: sched --- イベントスケジューラー-Footnote-112672158
Node: スケジューラオブジェクト12672223
Ref: library/sched id112672339
Ref: 381912672339
Ref: library/sched scheduler-objects12672339
Ref: 381a12672339
Ref: library/sched sched scheduler enterabs12672518
Ref: 134512672518
Ref: library/sched sched scheduler enter12673709
Ref: 134412673709
Ref: library/sched sched scheduler cancel12674187
Ref: 1d5912674187
Ref: library/sched sched scheduler empty12674442
Ref: 381b12674442
Ref: library/sched sched scheduler run12674562
Ref: 134212674562
Ref: library/sched sched scheduler queue12676174
Ref: 381c12676174
Node: queue --- 同期キュークラス12676504
Ref: library/queue doc12676688
Ref: 381d12676688
Ref: library/queue module-queue12676688
Ref: bb12676688
Ref: library/queue queue-a-synchronized-queue-class12676688
Ref: 381e12676688
Ref: library/queue translation-repo12676688
Ref: 381f12676688
Ref: library/queue queue Queue12678272
Ref: 15b012678272
Ref: library/queue queue LifoQueue12678678
Ref: 270f12678678
Ref: library/queue queue PriorityQueue12679088
Ref: 271012679088
Ref: library/queue queue SimpleQueue12680175
Ref: d6512680175
Ref: library/queue queue Empty12680435
Ref: 370a12680435
Ref: library/queue queue Full12680667
Ref: 370b12680667
Ref: library/queue queue ShutDown12680901
Ref: 54312680901
Ref: queue --- 同期キュークラス-Footnote-112681212
Node: キューオブジェクト12681277
Ref: library/queue queue-objects12681414
Ref: 382212681414
Ref: library/queue queueobjects12681414
Ref: 382312681414
Ref: library/queue queue Queue qsize12681639
Ref: 382412681639
Ref: library/queue queue Queue empty12681955
Ref: 382512681955
Ref: library/queue queue Queue full12682388
Ref: 382612682388
Ref: library/queue queue Queue put12682821
Ref: 382112682821
Ref: library/queue queue Queue put_nowait12683692
Ref: 325c12683692
Ref: library/queue queue Queue get12683789
Ref: 325d12683789
Ref: library/queue queue Queue get_nowait12685059
Ref: 382012685059
Ref: library/queue queue Queue task_done12685316
Ref: 370612685316
Ref: library/queue queue Queue join12686118
Ref: 370712686118
Node: Waiting for task completion12686788
Ref: library/queue waiting-for-task-completion12686906
Ref: 382712686906
Node: Terminating queues12687563
Ref: library/queue terminating-queues12687681
Ref: 382812687681
Ref: library/queue queue Queue shutdown12687867
Ref: 54212687867
Node: SimpleQueue オブジェクト12689278
Ref: library/queue simplequeue-objects12689415
Ref: 382912689415
Ref: library/queue queue SimpleQueue qsize12689592
Ref: 382a12689592
Ref: library/queue queue SimpleQueue empty12689868
Ref: 382b12689868
Ref: library/queue queue SimpleQueue put12690161
Ref: 382c12690161
Ref: library/queue queue SimpleQueue put_nowait12690926
Ref: 382d12690926
Ref: library/queue queue SimpleQueue get12691114
Ref: 382e12691114
Ref: library/queue queue SimpleQueue get_nowait12691929
Ref: 382f12691929
Node: contextvars --- コンテキスト変数12692409
Ref: library/contextvars doc12692590
Ref: 383012692590
Ref: library/contextvars contextvars-context-variables12692590
Ref: 383112692590
Ref: library/contextvars module-contextvars12692590
Ref: 2812692590
Ref: library/contextvars translation-repo12692590
Ref: 383212692590
Ref: contextvars --- コンテキスト変数-Footnote-112693646
Node: コンテキスト変数12693688
Ref: library/contextvars context-variables12693843
Ref: 383312693843
Ref: library/contextvars contextvars ContextVar12693906
Ref: 18da12693906
Ref: library/contextvars contextvars ContextVar name12694952
Ref: 383512694952
Ref: library/contextvars contextvars ContextVar get12695088
Ref: 383412695088
Ref: library/contextvars contextvars ContextVar set12695712
Ref: 178812695712
Ref: library/contextvars contextvars ContextVar reset12697013
Ref: 383612697013
Ref: library/contextvars contextvars Token12697604
Ref: 1e412697604
Ref: library/contextvars contextvars Token var12698294
Ref: 383712698294
Ref: library/contextvars contextvars Token old_value12698474
Ref: 383812698474
Ref: library/contextvars contextvars Token MISSING12698850
Ref: 185f12698850
Node: マニュアルでのコンテキスト管理12698988
Ref: library/contextvars manual-context-management12699172
Ref: 383912699172
Ref: library/contextvars contextvars copy_context12699270
Ref: 36bd12699270
Ref: library/contextvars contextvars Context12699882
Ref: 17812699882
Ref: library/contextvars contextvars Context run12701905
Ref: 19ab12701905
Ref: library/contextvars contextvars Context copy12703234
Ref: 383a12703234
Ref: library/contextvars contextvars Context get12703796
Ref: 383b12703796
Ref: library/contextvars contextvars Context keys12704390
Ref: 383c12704390
Ref: library/contextvars contextvars Context values12704524
Ref: 383d12704524
Ref: library/contextvars contextvars Context items12704677
Ref: 383e12704677
Node: asyncio サポート12704887
Ref: library/contextvars asyncio-support12705038
Ref: 383f12705038
Node: _thread --- 低水準なスレッド API12706815
Ref: library/_thread doc12706953
Ref: 384012706953
Ref: library/_thread module-_thread12706953
Ref: 212706953
Ref: library/_thread thread-low-level-threading-api12706953
Ref: 384112706953
Ref: library/_thread translation-repo12706953
Ref: 384212706953
Ref: library/_thread thread error12707940
Ref: 384312707940
Ref: library/_thread thread start_new_thread12708122
Ref: 4b412708122
Ref: library/_thread thread interrupt_main12709217
Ref: a4812709217
Ref: library/_thread thread exit12710144
Ref: 384412710144
Ref: library/_thread thread allocate_lock12710317
Ref: 384512710317
Ref: library/_thread thread get_ident12710548
Ref: 384612710548
Ref: library/_thread thread get_native_id12711036
Ref: 384712711036
Ref: library/_thread thread stack_size12711596
Ref: 17ea12711596
Ref: library/_thread thread TIMEOUT_MAX12713267
Ref: 384812713267
Ref: library/_thread thread LockType12713515
Ref: 384912713515
Ref: library/_thread thread LockType acquire12713698
Ref: 384a12713698
Ref: library/_thread thread LockType release12715297
Ref: 384b12715297
Ref: library/_thread thread LockType locked12715573
Ref: 384c12715573
Node: ネットワーク通信とプロセス間通信12716751
Ref: library/ipc doc12716939
Ref: 384d12716939
Ref: library/ipc ipc12716939
Ref: 384e12716939
Ref: library/ipc networking-and-interprocess-communication12716939
Ref: 384f12716939
Ref: library/ipc translation-repo12716939
Ref: 385012716939
Node: asyncio --- 非同期 I/O12718256
Ref: library/asyncio doc12718437
Ref: 385112718437
Ref: library/asyncio asyncio-asynchronous-i-o12718437
Ref: 385212718437
Ref: library/asyncio module-asyncio12718437
Ref: b12718437
Ref: library/asyncio asyncio-cli12720620
Ref: 385e12720620
Node: Runners12722047
Ref: library/asyncio-runner doc12722145
Ref: 385f12722145
Ref: library/asyncio-runner runners12722145
Ref: 386012722145
Ref: Runners-Footnote-112722734
Node: 非同期プログラムの実行12722810
Ref: library/asyncio-runner running-an-asyncio-program12722918
Ref: 386112722918
Ref: library/asyncio-runner asyncio run12722994
Ref: 2f512722994
Node: Runner context manager12725344
Ref: library/asyncio-runner runner-context-manager12725491
Ref: 386312725491
Ref: library/asyncio-runner asyncio Runner12725556
Ref: 2f712725556
Ref: library/asyncio-runner asyncio Runner run12726874
Ref: 19ad12726874
Ref: library/asyncio-runner asyncio Runner close12727624
Ref: 386412727624
Ref: library/asyncio-runner asyncio Runner get_loop12727852
Ref: 386512727852
Node: Handling Keyboard Interruption12728294
Ref: library/asyncio-runner handling-keyboard-interruption12728399
Ref: 386612728399
Node: Coroutines and tasks12729907
Ref: library/asyncio-task doc12730029
Ref: 386712730029
Ref: library/asyncio-task coroutines-and-tasks12730029
Ref: 386812730029
Ref: library/asyncio-task translation-repo12730029
Ref: 386912730029
Node: コルーチン<3>12730589
Ref: library/asyncio-task coroutine12730682
Ref: 385412730682
Ref: library/asyncio-task coroutines12730682
Ref: 386a12730682
Ref: コルーチン<3>-Footnote-112734338
Node: Awaitable12734417
Ref: library/asyncio-task asyncio-awaitables12734533
Ref: 386b12734533
Ref: library/asyncio-task awaitables12734533
Ref: 386c12734533
Node: Creating tasks12737702
Ref: library/asyncio-task creating-tasks12737817
Ref: 386d12737817
Ref: library/asyncio-task asyncio create_task12737981
Ref: 1cb12737981
Ref: Creating tasks-Footnote-112740891
Node: Task cancellation12740964
Ref: library/asyncio-task task-cancellation12741081
Ref: 386e12741081
Node: Task groups12742176
Ref: library/asyncio-task task-groups12742291
Ref: 386f12742291
Ref: library/asyncio-task taskgroups12742291
Ref: 387012742291
Ref: library/asyncio-task asyncio TaskGroup12742458
Ref: 4d112742458
Ref: library/asyncio-task asyncio TaskGroup create_task12742727
Ref: 1cd12742727
Node: Terminating a task group12746892
Ref: library/asyncio-task terminating-a-task-group12746964
Ref: 387112746964
Node: スリープ12748293
Ref: library/asyncio-task sleeping12748417
Ref: 387212748417
Ref: library/asyncio-task asyncio sleep12748460
Ref: c6812748460
Ref: library/asyncio-task asyncio-example-sleep12749126
Ref: 387312749126
Node: Running tasks concurrently12749810
Ref: library/asyncio-task running-tasks-concurrently12749941
Ref: 387412749941
Ref: library/asyncio-task asyncio gather12750016
Ref: 81312750016
Ref: library/asyncio-task asyncio-example-gather12752120
Ref: 387512752120
Node: Eager task factory12754331
Ref: library/asyncio-task eager-task-factory12754477
Ref: 387612754477
Ref: library/asyncio-task id212754477
Ref: 387712754477
Ref: library/asyncio-task asyncio eager_task_factory12754536
Ref: 6a212754536
Ref: library/asyncio-task asyncio create_eager_task_factory12755683
Ref: 6a312755683
Node: Shielding from cancellation12756354
Ref: library/asyncio-task shielding-from-cancellation12756492
Ref: 387812756492
Ref: library/asyncio-task asyncio shield12756569
Ref: c6912756569
Node: タイムアウト12758466
Ref: library/asyncio-task timeouts12758604
Ref: 387912758604
Ref: library/asyncio-task asyncio timeout12758657
Ref: 81412758657
Ref: library/asyncio-task asyncio Timeout12760423
Ref: 1aa112760423
Ref: library/asyncio-task asyncio Timeout when12761067
Ref: 387b12761067
Ref: library/asyncio-task asyncio Timeout reschedule12761245
Ref: 387a12761245
Ref: library/asyncio-task asyncio Timeout expired12761356
Ref: 387c12761356
Ref: library/asyncio-task asyncio timeout_at12762228
Ref: 1c1012762228
Ref: library/asyncio-task asyncio wait_for12762870
Ref: 81512762870
Ref: library/asyncio-task asyncio-example-waitfor12763904
Ref: 387d12763904
Node: Waiting primitives12764806
Ref: library/asyncio-task waiting-primitives12764935
Ref: 387e12764935
Ref: library/asyncio-task asyncio wait12764994
Ref: 6a712764994
Ref: library/asyncio-task asyncio FIRST_COMPLETED12766318
Ref: 387f12766318
Ref: library/asyncio-task asyncio FIRST_EXCEPTION12766661
Ref: 388012766661
Ref: library/asyncio-task asyncio ALL_COMPLETED12767185
Ref: 388112767185
Ref: library/asyncio-task asyncio as_completed12767856
Ref: 4c612767856
Node: Running in threads12770756
Ref: library/asyncio-task running-in-threads12770896
Ref: 388212770896
Ref: library/asyncio-task asyncio to_thread12770955
Ref: ae912770955
Node: Scheduling from other threads12773249
Ref: library/asyncio-task scheduling-from-other-threads12773401
Ref: 388312773401
Ref: library/asyncio-task asyncio run_coroutine_threadsafe12773482
Ref: a8612773482
Node: イントロスペクション12777015
Ref: library/asyncio-task introspection12777160
Ref: 388512777160
Ref: library/asyncio-task asyncio current_task12777233
Ref: 6a512777233
Ref: library/asyncio-task asyncio all_tasks12777599
Ref: b5312777599
Ref: library/asyncio-task asyncio iscoroutine12777951
Ref: 6a612777951
Node: Task object12778077
Ref: library/asyncio-task asyncio-task-obj12778184
Ref: 388612778184
Ref: library/asyncio-task task-object12778184
Ref: 388712778184
Ref: library/asyncio-task asyncio Task12778229
Ref: 1c912778229
Ref: library/asyncio-task asyncio Task done12781689
Ref: 388a12781689
Ref: library/asyncio-task asyncio Task result12781996
Ref: 388b12781996
Ref: library/asyncio-task asyncio Task exception12782585
Ref: 388d12782585
Ref: library/asyncio-task asyncio Task add_done_callback12783211
Ref: 388e12783211
Ref: library/asyncio-task asyncio Task remove_done_callback12783640
Ref: 388f12783640
Ref: library/asyncio-task asyncio Task get_stack12784038
Ref: 389012784038
Ref: library/asyncio-task asyncio Task print_stack12785386
Ref: 1b2f12785386
Ref: library/asyncio-task asyncio Task get_coro12786000
Ref: bd312786000
Ref: library/asyncio-task asyncio Task get_context12786473
Ref: 389112786473
Ref: library/asyncio-task asyncio Task get_name12786643
Ref: bd512786643
Ref: library/asyncio-task asyncio Task set_name12786990
Ref: bd412786990
Ref: library/asyncio-task asyncio Task cancel12787394
Ref: 4d312787394
Ref: library/asyncio-task asyncio-example-task-cancel12788654
Ref: 389212788654
Ref: library/asyncio-task asyncio Task cancelled12789952
Ref: 388812789952
Ref: library/asyncio-task asyncio Task uncancel12790392
Ref: 4d612790392
Ref: library/asyncio-task asyncio Task cancelling12792697
Ref: 4d512792697
Node: ストリーム12793509
Ref: library/asyncio-stream doc12793651
Ref: 389312793651
Ref: library/asyncio-stream asyncio-streams12793651
Ref: 385512793651
Ref: library/asyncio-stream streams12793651
Ref: 389412793651
Ref: library/asyncio-stream translation-repo12793651
Ref: 389512793651
Ref: library/asyncio-stream asyncio-example-stream12794122
Ref: 389612794122
Ref: library/asyncio-stream asyncio open_connection12794942
Ref: d1212794942
Ref: library/asyncio-stream asyncio start_server12796471
Ref: d1312796471
Ref: library/asyncio-stream asyncio open_unix_connection12798495
Ref: 389a12798495
Ref: library/asyncio-stream asyncio start_unix_server12799643
Ref: 389c12799643
Ref: ストリーム-Footnote-112801166
Node: StreamReader12801242
Ref: library/asyncio-stream streamreader12801327
Ref: 389d12801327
Ref: library/asyncio-stream asyncio StreamReader12801374
Ref: 17d712801374
Ref: library/asyncio-stream asyncio StreamReader feed_eof12801824
Ref: 389e12801824
Ref: library/asyncio-stream asyncio StreamReader read12801909
Ref: 389f12801909
Ref: library/asyncio-stream asyncio StreamReader readline12802782
Ref: 38a012802782
Ref: library/asyncio-stream asyncio StreamReader readexactly12803257
Ref: e7a12803257
Ref: library/asyncio-stream asyncio StreamReader readuntil12803662
Ref: 4d012803662
Ref: library/asyncio-stream asyncio StreamReader at_eof12805143
Ref: 38a312805143
Node: StreamWriter12805305
Ref: library/asyncio-stream streamwriter12805412
Ref: 38a412805412
Ref: library/asyncio-stream asyncio StreamWriter12805459
Ref: 1ad112805459
Ref: library/asyncio-stream asyncio StreamWriter write12805851
Ref: 38a512805851
Ref: library/asyncio-stream asyncio StreamWriter writelines12806464
Ref: 38a612806464
Ref: library/asyncio-stream asyncio StreamWriter close12807020
Ref: 389812807020
Ref: library/asyncio-stream asyncio StreamWriter can_write_eof12807344
Ref: 38a712807344
Ref: library/asyncio-stream asyncio StreamWriter write_eof12807608
Ref: 38a812807608
Ref: library/asyncio-stream asyncio StreamWriter transport12807812
Ref: 38a912807812
Ref: library/asyncio-stream asyncio StreamWriter get_extra_info12807918
Ref: 38aa12807918
Ref: library/asyncio-stream asyncio StreamWriter drain12808155
Ref: 1b8812808155
Ref: library/asyncio-stream asyncio StreamWriter start_tls12808908
Ref: 81912808908
Ref: library/asyncio-stream asyncio StreamWriter is_closing12809990
Ref: d0712809990
Ref: library/asyncio-stream asyncio StreamWriter wait_closed12810200
Ref: d0612810200
Node: 使用例<22>12810553
Ref: library/asyncio-stream examples12810639
Ref: 389712810639
Node: ストリームを使った TCP Echo クライアント12810915
Ref: library/asyncio-stream asyncio-tcp-echo-client-streams12811078
Ref: 38ab12811078
Ref: library/asyncio-stream tcp-echo-client-using-streams12811078
Ref: 38ac12811078
Node: ストリームを使った TCP Echo サーバー12811958
Ref: library/asyncio-stream asyncio-tcp-echo-server-streams12812156
Ref: 38ae12812156
Ref: library/asyncio-stream tcp-echo-server-using-streams12812156
Ref: 38af12812156
Node: HTTP ヘッダーの取得12813265
Ref: library/asyncio-stream get-http-headers12813486
Ref: 38b112813486
Node: ストリームを使ってデータを待つオープンソケットの登録12814817
Ref: library/asyncio-stream asyncio-example-create-connection-streams12814980
Ref: 38b212814980
Ref: library/asyncio-stream register-an-open-socket-to-wait-for-data-using-streams12814980
Ref: 38b312814980
Node: 同期プリミティブ<2>12816578
Ref: library/asyncio-sync doc12816718
Ref: 38b712816718
Ref: library/asyncio-sync asyncio-sync12816718
Ref: 385812816718
Ref: library/asyncio-sync synchronization-primitives12816718
Ref: 38b812816718
Ref: library/asyncio-sync translation-repo12816718
Ref: 38b912816718
Ref: 同期プリミティブ<2>-Footnote-112817995
Node: Lock12818068
Ref: library/asyncio-sync lock12818150
Ref: 38ba12818150
Ref: library/asyncio-sync asyncio Lock12818181
Ref: c6a12818181
Ref: library/asyncio-sync asyncio Lock acquire12819059
Ref: 38bb12819059
Ref: library/asyncio-sync asyncio Lock release12819743
Ref: 38bc12819743
Ref: library/asyncio-sync asyncio Lock locked12820067
Ref: 38bd12820067
Node: Event12820173
Ref: library/asyncio-sync event12820273
Ref: 38be12820273
Ref: library/asyncio-sync asyncio Event12820306
Ref: 2f612820306
Ref: library/asyncio-sync asyncio-example-sync-event12821100
Ref: 38c212821100
Ref: library/asyncio-sync asyncio Event wait12821755
Ref: 38c112821755
Ref: library/asyncio-sync asyncio Event set12822103
Ref: 38bf12822103
Ref: library/asyncio-sync asyncio Event clear12822340
Ref: 38c012822340
Ref: library/asyncio-sync asyncio Event is_set12822575
Ref: 38c312822575
Node: Condition12822696
Ref: library/asyncio-sync condition12822801
Ref: 38c412822801
Ref: library/asyncio-sync asyncio Condition12822842
Ref: c6b12822842
Ref: library/asyncio-sync asyncio Condition acquire12824481
Ref: 38c512824481
Ref: library/asyncio-sync asyncio Condition notify12824753
Ref: 1a5712824753
Ref: library/asyncio-sync asyncio Condition locked12825301
Ref: 38c612825301
Ref: library/asyncio-sync asyncio Condition notify_all12825419
Ref: 38c712825419
Ref: library/asyncio-sync asyncio Condition release12826084
Ref: 38c812826084
Ref: library/asyncio-sync asyncio Condition wait12826313
Ref: 1a8212826313
Ref: library/asyncio-sync asyncio Condition wait_for12827250
Ref: 38c912827250
Node: Semaphore12827635
Ref: library/asyncio-sync semaphore12827751
Ref: 38ca12827751
Ref: library/asyncio-sync asyncio Semaphore12827792
Ref: c6c12827792
Ref: library/asyncio-sync asyncio Semaphore acquire12829339
Ref: 1a8312829339
Ref: library/asyncio-sync asyncio Semaphore locked12829737
Ref: 38cc12829737
Ref: library/asyncio-sync asyncio Semaphore release12829861
Ref: 38cb12829861
Node: BoundedSemaphore12830270
Ref: library/asyncio-sync boundedsemaphore12830384
Ref: 38cd12830384
Ref: library/asyncio-sync asyncio BoundedSemaphore12830439
Ref: c6d12830439
Node: Barrier12830939
Ref: library/asyncio-sync barrier12831035
Ref: 38ce12831035
Ref: library/asyncio-sync asyncio Barrier12831072
Ref: 81612831072
Ref: library/asyncio-sync asyncio-example-barrier12831661
Ref: 38d012831661
Ref: library/asyncio-sync asyncio Barrier wait12832561
Ref: 38cf12832561
Ref: library/asyncio-sync asyncio Barrier reset12833640
Ref: 38d112833640
Ref: library/asyncio-sync asyncio Barrier abort12833942
Ref: 38d212833942
Ref: library/asyncio-sync asyncio Barrier parties12834261
Ref: 38d312834261
Ref: library/asyncio-sync asyncio Barrier n_waiting12834351
Ref: 38d412834351
Ref: library/asyncio-sync asyncio Barrier broken12834471
Ref: 38d512834471
Ref: library/asyncio-sync asyncio BrokenBarrierError12834594
Ref: 81712834594
Node: サブプロセス12835212
Ref: library/asyncio-subprocess doc12835346
Ref: 38d612835346
Ref: library/asyncio-subprocess asyncio-subprocess12835346
Ref: 385612835346
Ref: library/asyncio-subprocess subprocesses12835346
Ref: 38d712835346
Ref: library/asyncio-subprocess translation-repo12835346
Ref: 38d812835346
Ref: library/asyncio-subprocess asyncio-example-subprocess-shell12835690
Ref: 38d912835690
Ref: サブプロセス-Footnote-112837252
Ref: サブプロセス-Footnote-212837331
Node: サブプロセスの生成12837415
Ref: library/asyncio-subprocess creating-subprocesses12837515
Ref: 38db12837515
Ref: library/asyncio-subprocess asyncio create_subprocess_exec12837583
Ref: c6f12837583
Ref: library/asyncio-subprocess asyncio create_subprocess_shell12838392
Ref: c7012838392
Ref: サブプロセスの生成-Footnote-112840340
Node: 定数<7>12840410
Ref: library/asyncio-subprocess constants12840558
Ref: 38e612840558
Ref: library/asyncio-subprocess asyncio subprocess PIPE12840591
Ref: 38e712840591
Ref: library/asyncio-subprocess asyncio subprocess STDOUT12841050
Ref: 38e912841050
Ref: library/asyncio-subprocess asyncio subprocess DEVNULL12841258
Ref: 38ea12841258
Node: サブプロセスとやりとりする12841578
Ref: library/asyncio-subprocess interacting-with-subprocesses12841690
Ref: 38eb12841690
Ref: library/asyncio-subprocess asyncio subprocess Process12842105
Ref: 38de12842105
Ref: library/asyncio-subprocess asyncio subprocess Process wait12843304
Ref: 38ec12843304
Ref: library/asyncio-subprocess asyncio subprocess Process communicate12844032
Ref: 1b0112844032
Ref: library/asyncio-subprocess asyncio subprocess Process send_signal12845972
Ref: 19aa12845972
Ref: library/asyncio-subprocess asyncio subprocess Process terminate12846408
Ref: 38ef12846408
Ref: library/asyncio-subprocess asyncio subprocess Process kill12846709
Ref: 38f012846709
Ref: library/asyncio-subprocess asyncio subprocess Process stdin12847015
Ref: 38e812847015
Ref: library/asyncio-subprocess asyncio subprocess Process stdout12847177
Ref: 38dc12847177
Ref: library/asyncio-subprocess asyncio subprocess Process stderr12847342
Ref: 38dd12847342
Ref: library/asyncio-subprocess asyncio subprocess Process pid12847846
Ref: 38f112847846
Ref: library/asyncio-subprocess asyncio subprocess Process returncode12848101
Ref: 38ee12848101
Node: サブプロセスとスレッド12848975
Ref: library/asyncio-subprocess asyncio-subprocess-threads12849106
Ref: 38ed12849106
Ref: library/asyncio-subprocess subprocess-and-threads12849106
Ref: 38f212849106
Node: 使用例<23>12849813
Ref: library/asyncio-subprocess examples12849944
Ref: 38da12849944
Ref: library/asyncio-subprocess asyncio-example-create-subprocess-exec12850170
Ref: 38f312850170
Node: キュー12851018
Ref: library/asyncio-queue doc12851135
Ref: 38f512851135
Ref: library/asyncio-queue asyncio-queues12851135
Ref: 385712851135
Ref: library/asyncio-queue queues12851135
Ref: 38f612851135
Ref: library/asyncio-queue translation-repo12851135
Ref: 38f712851135
Ref: キュー-Footnote-112852057
Node: Queue12852131
Ref: library/asyncio-queue queue12852218
Ref: 38f912852218
Ref: library/asyncio-queue asyncio Queue12852251
Ref: c6e12852251
Ref: library/asyncio-queue asyncio Queue maxsize12853082
Ref: 38fc12853082
Ref: library/asyncio-queue asyncio Queue empty12853174
Ref: 38fd12853174
Ref: library/asyncio-queue asyncio Queue full12853324
Ref: 38fe12853324
Ref: library/asyncio-queue asyncio Queue get12853594
Ref: 38fa12853594
Ref: library/asyncio-queue asyncio Queue get_nowait12853941
Ref: 38ff12853941
Ref: library/asyncio-queue asyncio Queue join12854131
Ref: fca12854131
Ref: library/asyncio-queue asyncio Queue put12854772
Ref: 390112854772
Ref: library/asyncio-queue asyncio Queue put_nowait12855094
Ref: 390212855094
Ref: library/asyncio-queue asyncio Queue qsize12855335
Ref: 38fb12855335
Ref: library/asyncio-queue asyncio Queue shutdown12855422
Ref: 4cc12855422
Ref: library/asyncio-queue asyncio Queue task_done12856974
Ref: fcb12856974
Node: 優先度付きのキュー12857770
Ref: library/asyncio-queue priority-queue12857880
Ref: 390412857880
Ref: library/asyncio-queue asyncio PriorityQueue12857948
Ref: 390512857948
Node: LIFO キュー12858231
Ref: library/asyncio-queue lifo-queue12858346
Ref: 390612858346
Ref: library/asyncio-queue asyncio LifoQueue12858394
Ref: 390712858394
Node: 例外<15>12858582
Ref: library/asyncio-queue exceptions12858683
Ref: 390812858683
Ref: library/asyncio-queue asyncio QueueEmpty12858716
Ref: 390012858716
Ref: library/asyncio-queue asyncio QueueFull12858887
Ref: 390312858887
Ref: library/asyncio-queue asyncio QueueShutDown12859080
Ref: 4cd12859080
Node: 使用例<24>12859265
Ref: library/asyncio-queue examples12859343
Ref: 38f812859343
Ref: library/asyncio-queue asyncio-example-queue-dist12859381
Ref: 390912859381
Node: 例外<16>12861189
Ref: library/asyncio-exceptions doc12861312
Ref: 390a12861312
Ref: library/asyncio-exceptions asyncio-exceptions12861312
Ref: 390b12861312
Ref: library/asyncio-exceptions exceptions12861312
Ref: 390c12861312
Ref: library/asyncio-exceptions translation-repo12861312
Ref: 390d12861312
Ref: library/asyncio-exceptions asyncio TimeoutError12861465
Ref: 1b1712861465
Ref: library/asyncio-exceptions asyncio CancelledError12861767
Ref: 4d412861767
Ref: library/asyncio-exceptions asyncio InvalidStateError12862309
Ref: 388c12862309
Ref: library/asyncio-exceptions asyncio SendfileNotAvailableError12862658
Ref: 390e12862658
Ref: library/asyncio-exceptions asyncio IncompleteReadError12862918
Ref: 1d4612862918
Ref: library/asyncio-exceptions asyncio IncompleteReadError expected12863182
Ref: 390f12863182
Ref: library/asyncio-exceptions asyncio IncompleteReadError partial12863282
Ref: 38a112863282
Ref: library/asyncio-exceptions asyncio LimitOverrunError12863431
Ref: 38a212863431
Ref: library/asyncio-exceptions asyncio LimitOverrunError consumed12863645
Ref: 391012863645
Ref: 例外<16>-Footnote-112863765
Node: Call Graph Introspection12863844
Ref: library/asyncio-graph doc12863968
Ref: 391112863968
Ref: library/asyncio-graph asyncio-graph12863968
Ref: 391212863968
Ref: library/asyncio-graph call-graph-introspection12863968
Ref: 391312863968
Ref: library/asyncio-graph translation-repo12863968
Ref: 391412863968
Ref: library/asyncio-graph asyncio print_call_graph12864455
Ref: 1cf12864455
Ref: library/asyncio-graph asyncio format_call_graph12866421
Ref: 391512866421
Ref: library/asyncio-graph asyncio capture_call_graph12866682
Ref: 1ce12866682
Ref: Call Graph Introspection-Footnote-112867905
Node: Low level utility functions12867978
Ref: library/asyncio-graph low-level-utility-functions12868066
Ref: 391612868066
Ref: library/asyncio-graph asyncio future_add_to_awaited_by12868583
Ref: 391712868583
Ref: library/asyncio-graph asyncio future_discard_from_awaited_by12869054
Ref: 391812869054
Node: Event loop12869358
Ref: library/asyncio-eventloop doc12869478
Ref: 391912869478
Ref: library/asyncio-eventloop asyncio-event-loop12869478
Ref: f7a12869478
Ref: library/asyncio-eventloop event-loop12869478
Ref: 391a12869478
Ref: library/asyncio-eventloop translation-repo12869478
Ref: 391b12869478
Ref: library/asyncio-eventloop asyncio get_running_loop12870578
Ref: d0512870578
Ref: library/asyncio-eventloop asyncio get_event_loop12870884
Ref: 2f412870884
Ref: library/asyncio-eventloop asyncio set_event_loop12872191
Ref: 1bb412872191
Ref: library/asyncio-eventloop asyncio new_event_loop12872324
Ref: 386212872324
Ref: Event loop-Footnote-112873846
Ref: Event loop-Footnote-212873922
Node: Event loop methods12873996
Ref: library/asyncio-eventloop asyncio-event-loop-methods12874086
Ref: 392212874086
Ref: library/asyncio-eventloop event-loop-methods12874086
Ref: 391d12874086
Node: ループの開始と停止12874844
Ref: library/asyncio-eventloop running-and-stopping-the-loop12874980
Ref: 392312874980
Ref: library/asyncio-eventloop asyncio loop run_until_complete12875048
Ref: e7612875048
Ref: library/asyncio-eventloop asyncio loop run_forever12875475
Ref: 392412875475
Ref: library/asyncio-eventloop asyncio loop stop12876696
Ref: e7b12876696
Ref: library/asyncio-eventloop asyncio loop is_running12876777
Ref: 392512876777
Ref: library/asyncio-eventloop asyncio loop is_closed12876900
Ref: fc712876900
Ref: library/asyncio-eventloop asyncio loop close12877025
Ref: 392612877025
Ref: library/asyncio-eventloop asyncio loop shutdown_asyncgens12877714
Ref: e7d12877714
Ref: library/asyncio-eventloop asyncio loop shutdown_default_executor12878714
Ref: ae812878714
Node: コールバックのスケジューリング12879754
Ref: library/asyncio-eventloop scheduling-callbacks12879950
Ref: 392712879950
Ref: library/asyncio-eventloop asyncio loop call_soon12880048
Ref: cfe12880048
Ref: library/asyncio-eventloop asyncio loop call_soon_threadsafe12880978
Ref: cff12880978
Ref: library/asyncio-eventloop asyncio-pass-keywords12882077
Ref: 392812882077
Ref: コールバックのスケジューリング-Footnote-112882818
Node: 遅延コールバックのスケジューリング12882860
Ref: library/asyncio-eventloop asyncio-delayed-calls12883055
Ref: 392912883055
Ref: library/asyncio-eventloop scheduling-delayed-callbacks12883055
Ref: 392a12883055
Ref: library/asyncio-eventloop asyncio loop call_later12883444
Ref: d0012883444
Ref: library/asyncio-eventloop asyncio loop call_at12885327
Ref: d0112885327
Ref: library/asyncio-eventloop asyncio loop time12886607
Ref: 392b12886607
Ref: 遅延コールバックのスケジューリング-Footnote-112887237
Ref: 遅延コールバックのスケジューリング-Footnote-212887279
Node: Creating futures and tasks12887321
Ref: library/asyncio-eventloop creating-futures-and-tasks12887504
Ref: 392c12887504
Ref: library/asyncio-eventloop asyncio loop create_future12887579
Ref: e7812887579
Ref: library/asyncio-eventloop asyncio loop create_task12888101
Ref: 1cc12888101
Ref: library/asyncio-eventloop asyncio loop set_task_factory12890253
Ref: 1ca12890253
Ref: library/asyncio-eventloop asyncio loop get_task_factory12891196
Ref: fc912891196
Node: ネットワーク接続の確立12891391
Ref: library/asyncio-eventloop opening-network-connections12891559
Ref: 392d12891559
Ref: library/asyncio-eventloop asyncio loop create_connection12891637
Ref: 81812891637
Ref: library/asyncio-eventloop asyncio loop create_datagram_endpoint12900391
Ref: 94012900391
Ref: library/asyncio-eventloop asyncio loop create_unix_connection12905606
Ref: 389b12905606
Ref: ネットワーク接続の確立-Footnote-112906873
Ref: ネットワーク接続の確立-Footnote-212906932
Node: ネットワークサーバの生成12906991
Ref: library/asyncio-eventloop creating-network-servers12907154
Ref: 393512907154
Ref: library/asyncio-eventloop loop-create-server12907237
Ref: 385912907237
Ref: library/asyncio-eventloop asyncio loop create_server12907237
Ref: d0d12907237
Ref: library/asyncio-eventloop asyncio loop create_unix_server12913352
Ref: 4ca12913352
Ref: library/asyncio-eventloop asyncio loop connect_accepted_socket12914760
Ref: 9e212914760
Node: ファイルの転送12916682
Ref: library/asyncio-eventloop transferring-files12916823
Ref: 393712916823
Ref: library/asyncio-eventloop asyncio loop sendfile12916881
Ref: 393812916881
Node: TLS upgrade12918502
Ref: library/asyncio-eventloop tls-upgrade12918637
Ref: 393912918637
Ref: library/asyncio-eventloop asyncio loop start_tls12918682
Ref: d0312918682
Node: ファイル記述子の監視12920954
Ref: library/asyncio-eventloop watching-file-descriptors12921125
Ref: 393a12921125
Ref: library/asyncio-eventloop asyncio loop add_reader12921198
Ref: 38b612921198
Ref: library/asyncio-eventloop asyncio loop remove_reader12921582
Ref: 393b12921582
Ref: library/asyncio-eventloop asyncio loop add_writer12921769
Ref: 393c12921769
Ref: library/asyncio-eventloop asyncio loop remove_writer12922257
Ref: 393d12922257
Node: ソケットオブジェクトと直接やりとりする12922604
Ref: library/asyncio-eventloop working-with-socket-objects-directly12922767
Ref: 393f12922767
Ref: library/asyncio-eventloop asyncio loop sock_recv12923329
Ref: e0f12923329
Ref: library/asyncio-eventloop asyncio loop sock_recv_into12924085
Ref: d0412924085
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom12924552
Ref: 81b12924552
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom_into12924901
Ref: 81c12924901
Ref: library/asyncio-eventloop asyncio loop sock_sendall12925287
Ref: e1012925287
Ref: library/asyncio-eventloop asyncio loop sock_sendto12926340
Ref: 81a12926340
Ref: library/asyncio-eventloop asyncio loop sock_connect12926664
Ref: fcc12926664
Ref: library/asyncio-eventloop asyncio loop sock_accept12927478
Ref: e1112927478
Ref: library/asyncio-eventloop asyncio loop sock_sendfile12928596
Ref: d0812928596
Node: DNS12930451
Ref: library/asyncio-eventloop dns12930614
Ref: 394012930614
Ref: library/asyncio-eventloop asyncio loop getaddrinfo12930643
Ref: e1212930643
Ref: library/asyncio-eventloop asyncio loop getnameinfo12930812
Ref: e1312930812
Node: パイプとやりとりする12931813
Ref: library/asyncio-eventloop working-with-pipes12931936
Ref: 394112931936
Ref: library/asyncio-eventloop asyncio loop connect_read_pipe12932009
Ref: 38e212932009
Ref: library/asyncio-eventloop asyncio loop connect_write_pipe12932860
Ref: 38e312932860
Node: Unix シグナル12934010
Ref: library/asyncio-eventloop unix-signals12934199
Ref: 394412934199
Ref: library/asyncio-eventloop loop-add-signal-handler12934252
Ref: 385b12934252
Ref: library/asyncio-eventloop asyncio loop add_signal_handler12934252
Ref: 394512934252
Ref: library/asyncio-eventloop asyncio loop remove_signal_handler12935374
Ref: 394612935374
Node: スレッドまたはプロセスプールでコードを実行する12935784
Ref: library/asyncio-eventloop executing-code-in-thread-or-process-pools12935961
Ref: 394712935961
Ref: library/asyncio-eventloop asyncio loop run_in_executor12936099
Ref: aea12936099
Ref: library/asyncio-eventloop asyncio loop set_default_executor12939299
Ref: 94e12939299
Node: Error handling API12939678
Ref: library/asyncio-eventloop error-handling-api12939871
Ref: 394812939871
Ref: library/asyncio-eventloop asyncio loop set_exception_handler12940016
Ref: 394912940016
Ref: library/asyncio-eventloop asyncio loop get_exception_handler12941132
Ref: e7912941132
Ref: library/asyncio-eventloop asyncio loop default_exception_handler12941365
Ref: 394b12941365
Ref: library/asyncio-eventloop asyncio loop call_exception_handler12941874
Ref: 394a12941874
Node: デバッグモードの有効化12943191
Ref: library/asyncio-eventloop enabling-debug-mode12943335
Ref: 394c12943335
Ref: library/asyncio-eventloop asyncio loop get_debug12943413
Ref: fc612943413
Ref: library/asyncio-eventloop asyncio loop set_debug12943754
Ref: fc512943754
Ref: library/asyncio-eventloop asyncio loop slow_callback_duration12944062
Ref: 394d12944062
Node: Running subprocesses12944387
Ref: library/asyncio-eventloop running-subprocesses12944504
Ref: 394e12944504
Ref: library/asyncio-eventloop loop-subprocess-exec12945086
Ref: 385a12945086
Ref: library/asyncio-eventloop asyncio loop subprocess_exec12945086
Ref: 38df12945086
Ref: library/asyncio-eventloop asyncio loop subprocess_shell12950068
Ref: 38e012950068
Ref: Running subprocesses-Footnote-112951919
Node: Callback handles12951989
Ref: library/asyncio-eventloop callback-handles12952102
Ref: 391e12952102
Ref: library/asyncio-eventloop asyncio Handle12952157
Ref: 1ee012952157
Ref: library/asyncio-eventloop asyncio Handle get_context12952324
Ref: 395112952324
Ref: library/asyncio-eventloop asyncio Handle cancel12952496
Ref: 395212952496
Ref: library/asyncio-eventloop asyncio Handle cancelled12952730
Ref: d1412952730
Ref: library/asyncio-eventloop asyncio TimerHandle12952893
Ref: 1b3c12952893
Ref: library/asyncio-eventloop asyncio TimerHandle when12953112
Ref: d1112953112
Node: Server objects12953442
Ref: library/asyncio-eventloop server-objects12953563
Ref: 391f12953563
Ref: library/asyncio-eventloop asyncio Server12953887
Ref: d0c12953887
Ref: library/asyncio-eventloop asyncio Server close12954733
Ref: 389912954733
Ref: library/asyncio-eventloop asyncio Server close_clients12955245
Ref: 4ce12955245
Ref: library/asyncio-eventloop asyncio Server abort_clients12955613
Ref: 4cf12955613
Ref: library/asyncio-eventloop asyncio Server get_loop12956055
Ref: d0b12956055
Ref: library/asyncio-eventloop asyncio Server start_serving12956217
Ref: d0e12956217
Ref: library/asyncio-eventloop asyncio Server serve_forever12957023
Ref: d0f12957023
Ref: library/asyncio-eventloop asyncio Server is_serving12958112
Ref: d1012958112
Ref: library/asyncio-eventloop asyncio Server wait_closed12958302
Ref: 1aa012958302
Ref: library/asyncio-eventloop asyncio Server sockets12958463
Ref: e1412958463
Ref: library/asyncio-eventloop asyncio-event-loops12958935
Ref: 395412958935
Node: Event loop implementations12958935
Ref: library/asyncio-eventloop asyncio-event-loop-implementations12959053
Ref: 395512959053
Ref: library/asyncio-eventloop event-loop-implementations12959053
Ref: 392012959053
Ref: library/asyncio-eventloop asyncio SelectorEventLoop12959341
Ref: 31612959341
Ref: library/asyncio-eventloop asyncio ProactorEventLoop12959969
Ref: 81d12959969
Ref: library/asyncio-eventloop asyncio EventLoop12960237
Ref: 1ac812960237
Ref: library/asyncio-eventloop asyncio AbstractEventLoop12960551
Ref: b5c12960551
Ref: Event loop implementations-Footnote-112960874
Node: 使用例<25>12960953
Ref: library/asyncio-eventloop examples12961048
Ref: 392112961048
Node: call_soon を使った Hello World12961830
Ref: library/asyncio-eventloop asyncio-example-lowlevel-helloworld12961967
Ref: 395612961967
Ref: library/asyncio-eventloop hello-world-with-call-soon12961967
Ref: 395712961967
Node: call_later で現在の日時を表示する12962804
Ref: library/asyncio-eventloop asyncio-example-call-later12963007
Ref: 395812963007
Ref: library/asyncio-eventloop display-the-current-date-with-call-later12963007
Ref: 395912963007
Node: 読み込みイベント用ファイル記述子の監視12964053
Ref: library/asyncio-eventloop asyncio-example-watch-fd12964289
Ref: 38b512964289
Ref: library/asyncio-eventloop watch-a-file-descriptor-for-read-events12964289
Ref: 395a12964289
Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定12965741
Ref: library/asyncio-eventloop asyncio-example-unix-signals12965924
Ref: 395b12965924
Ref: library/asyncio-eventloop set-signal-handlers-for-sigint-and-sigterm12965924
Ref: 395c12965924
Node: Future12966884
Ref: library/asyncio-future doc12967019
Ref: 378112967019
Ref: library/asyncio-future asyncio-futures12967019
Ref: 385d12967019
Ref: library/asyncio-future futures12967019
Ref: 395d12967019
Ref: library/asyncio-future translation-repo12967019
Ref: 395e12967019
Ref: Future-Footnote-112967486
Ref: Future-Footnote-212967562
Node: Future の関数12967643
Ref: library/asyncio-future future-functions12967739
Ref: 395f12967739
Ref: library/asyncio-future asyncio isfuture12967791
Ref: 396012967791
Ref: library/asyncio-future asyncio ensure_future12968194
Ref: e7512968194
Ref: library/asyncio-future asyncio wrap_future12969909
Ref: 1cd912969909
Node: Future オブジェクト<2>12970296
Ref: library/asyncio-future asyncio-future-obj12970392
Ref: 396112970392
Ref: library/asyncio-future future-object12970392
Ref: 396212970392
Ref: library/asyncio-future asyncio Future12970459
Ref: dca12970459
Ref: library/asyncio-future asyncio Future result12971937
Ref: 396312971937
Ref: library/asyncio-future asyncio Future set_result12972664
Ref: 388912972664
Ref: library/asyncio-future asyncio Future set_exception12972886
Ref: e7c12972886
Ref: library/asyncio-future asyncio Future done12973114
Ref: 396412973114
Ref: library/asyncio-future asyncio Future cancelled12973495
Ref: 396512973495
Ref: library/asyncio-future asyncio Future add_done_callback12973922
Ref: d0212973922
Ref: library/asyncio-future asyncio Future remove_done_callback12975309
Ref: 197112975309
Ref: library/asyncio-future asyncio Future cancel12975614
Ref: 1c0612975614
Ref: library/asyncio-future asyncio Future exception12976304
Ref: 396612976304
Ref: library/asyncio-future asyncio Future get_loop12976869
Ref: d0a12976869
Ref: library/asyncio-future asyncio-example-future12977038
Ref: 396712977038
Ref: Future オブジェクト<2>-Footnote-112979524
Node: トランスポートとプロトコル12979566
Ref: library/asyncio-protocol doc12979703
Ref: 396812979703
Ref: library/asyncio-protocol asyncio-transports-protocols12979703
Ref: 385c12979703
Ref: library/asyncio-protocol translation-repo12979703
Ref: 396912979703
Ref: library/asyncio-protocol transports-and-protocols12979703
Ref: 396a12979703
Node: トランスポート12982959
Ref: library/asyncio-protocol asyncio-transport12983083
Ref: 392f12983083
Ref: library/asyncio-protocol transports12983083
Ref: 396b12983083
Ref: トランスポート-Footnote-112984175
Node: トランスポートのクラス階層構造12984254
Ref: library/asyncio-protocol transports-hierarchy12984393
Ref: 397212984393
Ref: library/asyncio-protocol asyncio BaseTransport12984491
Ref: 396d12984491
Ref: library/asyncio-protocol asyncio WriteTransport12984692
Ref: 394312984692
Ref: library/asyncio-protocol asyncio ReadTransport12985123
Ref: 394212985123
Ref: library/asyncio-protocol asyncio Transport12985495
Ref: 396e12985495
Ref: library/asyncio-protocol asyncio DatagramTransport12986373
Ref: 1b8612986373
Ref: library/asyncio-protocol asyncio SubprocessTransport12986684
Ref: 395012986684
Node: 基底トランスポート12987061
Ref: library/asyncio-protocol base-transport12987251
Ref: 397312987251
Ref: library/asyncio-protocol asyncio BaseTransport close12987319
Ref: 393212987319
Ref: library/asyncio-protocol asyncio BaseTransport is_closing12987961
Ref: e7712987961
Ref: library/asyncio-protocol asyncio BaseTransport get_extra_info12988114
Ref: c9712988114
Ref: library/asyncio-protocol asyncio BaseTransport set_protocol12990799
Ref: 397712990799
Ref: library/asyncio-protocol asyncio BaseTransport get_protocol12991107
Ref: 397812991107
Node: 読み出し専用のトランスポート12991205
Ref: library/asyncio-protocol read-only-transports12991392
Ref: 397912991392
Ref: library/asyncio-protocol asyncio ReadTransport is_reading12991485
Ref: d1512991485
Ref: library/asyncio-protocol asyncio ReadTransport pause_reading12991660
Ref: d1712991660
Ref: library/asyncio-protocol asyncio ReadTransport resume_reading12992179
Ref: d1612992179
Node: 書き込み専用のトランスポート12992643
Ref: library/asyncio-protocol write-only-transports12992842
Ref: 397a12992842
Ref: library/asyncio-protocol asyncio WriteTransport abort12992935
Ref: 395312992935
Ref: library/asyncio-protocol asyncio WriteTransport can_write_eof12993388
Ref: 397b12993388
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_size12993643
Ref: 397d12993643
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_limits12993820
Ref: fc812993820
Ref: library/asyncio-protocol asyncio WriteTransport set_write_buffer_limits12994228
Ref: 397e12994228
Ref: library/asyncio-protocol asyncio WriteTransport write12996034
Ref: 183512996034
Ref: library/asyncio-protocol asyncio WriteTransport writelines12996297
Ref: 183412996297
Ref: library/asyncio-protocol asyncio WriteTransport write_eof12996678
Ref: 397c12996678
Node: データグラムトランスポート12997161
Ref: library/asyncio-protocol datagram-transports12997369
Ref: 398112997369
Ref: library/asyncio-protocol asyncio DatagramTransport sendto12997457
Ref: 4cb12997457
Ref: library/asyncio-protocol asyncio DatagramTransport abort12998292
Ref: 398212998292
Node: サブプロセス化されたトランスポート12998748
Ref: library/asyncio-protocol asyncio-subprocess-transports12998905
Ref: 38e412998905
Ref: library/asyncio-protocol subprocess-transports12998905
Ref: 398312998905
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pid12999013
Ref: 398412999013
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pipe_transport12999134
Ref: 398512999134
Ref: library/asyncio-protocol asyncio SubprocessTransport get_returncode12999902
Ref: 398612999902
Ref: library/asyncio-protocol asyncio SubprocessTransport kill13000204
Ref: 398713000204
Ref: library/asyncio-protocol asyncio SubprocessTransport send_signal13000573
Ref: 398913000573
Ref: library/asyncio-protocol asyncio SubprocessTransport terminate13000771
Ref: 398813000771
Ref: library/asyncio-protocol asyncio SubprocessTransport close13001207
Ref: 398a13001207
Node: プロトコル<2>13001550
Ref: library/asyncio-protocol asyncio-protocol13001696
Ref: 392e13001696
Ref: library/asyncio-protocol protocols13001696
Ref: 396c13001696
Ref: プロトコル<2>-Footnote-113002863
Node: 基底プロトコル13002941
Ref: library/asyncio-protocol base-protocols13003050
Ref: 398b13003050
Ref: library/asyncio-protocol asyncio BaseProtocol13003108
Ref: 396f13003108
Ref: library/asyncio-protocol asyncio Protocol13003278
Ref: 397013003278
Ref: library/asyncio-protocol asyncio BufferedProtocol13003455
Ref: c9813003455
Ref: library/asyncio-protocol asyncio DatagramProtocol13003653
Ref: 8df13003653
Ref: library/asyncio-protocol asyncio SubprocessProtocol13003804
Ref: 394f13003804
Node: 基底プロトコル<2>13004002
Ref: library/asyncio-protocol base-protocol13004156
Ref: 398c13004156
Ref: library/asyncio-protocol asyncio BaseProtocol connection_made13004681
Ref: 393013004681
Ref: library/asyncio-protocol asyncio BaseProtocol connection_lost13005005
Ref: 397413005005
Ref: library/asyncio-protocol asyncio BaseProtocol pause_writing13005814
Ref: 397f13005814
Ref: library/asyncio-protocol asyncio BaseProtocol resume_writing13006005
Ref: 398013006005
Node: ストリーミングプロトコル13006726
Ref: library/asyncio-protocol streaming-protocols13006925
Ref: 398d13006925
Ref: library/asyncio-protocol asyncio Protocol data_received13007412
Ref: 1b6013007412
Ref: library/asyncio-protocol asyncio Protocol eof_received13008437
Ref: 398e13008437
Node: バッファリングされたストリーミングプロトコル13009577
Ref: library/asyncio-protocol buffered-streaming-protocols13009785
Ref: 398f13009785
Ref: library/asyncio-protocol asyncio BufferedProtocol get_buffer13010812
Ref: 399013010812
Ref: library/asyncio-protocol asyncio BufferedProtocol buffer_updated13011526
Ref: 399113011526
Ref: library/asyncio-protocol asyncio BufferedProtocol eof_received13011756
Ref: 399213011756
Node: データグラムプロトコル13012454
Ref: library/asyncio-protocol datagram-protocols13012659
Ref: 399313012659
Ref: library/asyncio-protocol asyncio DatagramProtocol datagram_received13012941
Ref: 399413012941
Ref: library/asyncio-protocol asyncio DatagramProtocol error_received13013286
Ref: 399513013286
Node: サブプロセスプロトコル13014662
Ref: library/asyncio-protocol asyncio-subprocess-protocols13014792
Ref: 38e513014792
Ref: library/asyncio-protocol subprocess-protocols13014792
Ref: 399613014792
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_data_received13015104
Ref: 1baf13015104
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_connection_lost13015478
Ref: 399713015478
Ref: library/asyncio-protocol asyncio SubprocessProtocol process_exited13015752
Ref: 1bae13015752
Node: 使用例<26>13016040
Ref: library/asyncio-protocol examples13016156
Ref: 397113016156
Node: TCP エコーサーバー13016468
Ref: library/asyncio-protocol asyncio-example-tcp-echo-server-protocol13016583
Ref: 38b013016583
Ref: library/asyncio-protocol tcp-echo-server13016583
Ref: 399813016583
Node: TCP エコークライアント13017982
Ref: library/asyncio-protocol asyncio-example-tcp-echo-client-protocol13018131
Ref: 38ad13018131
Ref: library/asyncio-protocol tcp-echo-client13018131
Ref: 399913018131
Node: UDP エコーサーバー13019818
Ref: library/asyncio-protocol asyncio-udp-echo-server-protocol13019973
Ref: 393413019973
Ref: library/asyncio-protocol udp-echo-server13019973
Ref: 399a13019973
Node: UDP エコークライアント13021171
Ref: library/asyncio-protocol asyncio-udp-echo-client-protocol13021328
Ref: 393313021328
Ref: library/asyncio-protocol udp-echo-client13021328
Ref: 399b13021328
Node: 既存のソケットへの接続13022939
Ref: library/asyncio-protocol asyncio-example-create-connection13023114
Ref: 38b413023114
Ref: library/asyncio-protocol connecting-existing-sockets13023114
Ref: 399c13023114
Node: loop subprocess_exec と SubprocessProtocol13025216
Ref: library/asyncio-protocol asyncio-example-subprocess-proto13025351
Ref: 38f413025351
Ref: library/asyncio-protocol loop-subprocess-exec-and-subprocessprotocol13025351
Ref: 399d13025351
Node: ポリシー13027774
Ref: library/asyncio-policy doc13027947
Ref: 399e13027947
Ref: library/asyncio-policy asyncio-policies13027947
Ref: 391c13027947
Ref: library/asyncio-policy policies13027947
Ref: 399f13027947
Ref: library/asyncio-policy translation-repo13027947
Ref: 39a013027947
Node: ポリシーの取得と設定13029189
Ref: library/asyncio-policy asyncio-policy-get-set13029307
Ref: 39a113029307
Ref: library/asyncio-policy getting-and-setting-the-policy13029307
Ref: 39a513029307
Ref: library/asyncio-policy asyncio get_event_loop_policy13029500
Ref: 31413029500
Ref: library/asyncio-policy asyncio set_event_loop_policy13029764
Ref: 31513029764
Node: ポリシーオブジェクト13030171
Ref: library/asyncio-policy asyncio-policy-objects13030331
Ref: 39a413030331
Ref: library/asyncio-policy policy-objects13030331
Ref: 39a613030331
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy13030511
Ref: 31013030511
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy get_event_loop13030619
Ref: 39a713030619
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy set_event_loop13031017
Ref: 39a813031017
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy new_event_loop13031155
Ref: 39a913031155
Ref: library/asyncio-policy asyncio-policy-builtin13031501
Ref: 39a213031501
Ref: library/asyncio-policy asyncio DefaultEventLoopPolicy13031566
Ref: 31113031566
Ref: library/asyncio-policy asyncio WindowsSelectorEventLoopPolicy13032452
Ref: 31213032452
Ref: library/asyncio-policy asyncio WindowsProactorEventLoopPolicy13032822
Ref: 31313032822
Node: ポリシーのカスタマイズ13033192
Ref: library/asyncio-policy asyncio-custom-policies13033313
Ref: 39a313033313
Ref: library/asyncio-policy custom-policies13033313
Ref: 39aa13033313
Node: プラットフォームでのサポート13034030
Ref: library/asyncio-platforms doc13034173
Ref: 39ab13034173
Ref: library/asyncio-platforms asyncio-platform-support13034173
Ref: 393e13034173
Ref: library/asyncio-platforms platform-support13034173
Ref: 39ac13034173
Ref: library/asyncio-platforms translation-repo13034173
Ref: 39ad13034173
Node: 全てのプラットホーム13034619
Ref: library/asyncio-platforms all-platforms13034748
Ref: 39ae13034748
Node: Windows<86>13034967
Ref: library/asyncio-platforms windows13035114
Ref: 39af13035114
Ref: Windows<86>-Footnote-113037402
Ref: Windows<86>-Footnote-213037486
Ref: Windows<86>-Footnote-313037569
Ref: Windows<86>-Footnote-413037651
Node: Windows におけるサブプロセスのサポート13037716
Ref: library/asyncio-platforms asyncio-windows-subprocess13037817
Ref: 38e113037817
Ref: library/asyncio-platforms subprocess-support-on-windows13037817
Ref: 39b113037817
Node: macOS<55>13038141
Ref: library/asyncio-platforms macos13038249
Ref: 39b213038249
Node: Extending13039105
Ref: library/asyncio-extending doc13039271
Ref: 39b413039271
Ref: library/asyncio-extending extending13039271
Ref: 39b513039271
Ref: library/asyncio-extending translation-repo13039271
Ref: 39b613039271
Node: Writing a Custom Event Loop13039753
Ref: library/asyncio-extending writing-a-custom-event-loop13039871
Ref: 39b713039871
Node: Future and Task private constructors13040590
Ref: library/asyncio-extending future-and-task-private-constructors13040738
Ref: 39b813040738
Ref: library/asyncio-extending asyncio Future __init__13041302
Ref: 39b913041302
Ref: library/asyncio-extending asyncio Task __init__13041442
Ref: 39ba13041442
Node: Task lifetime support13041775
Ref: library/asyncio-extending task-lifetime-support13041887
Ref: 39bb13041887
Ref: library/asyncio-extending asyncio _register_task13042123
Ref: 39bc13042123
Ref: library/asyncio-extending asyncio _unregister_task13042271
Ref: 39bd13042271
Ref: library/asyncio-extending asyncio _enter_task13042449
Ref: 39be13042449
Ref: library/asyncio-extending asyncio _leave_task13042708
Ref: 39bf13042708
Node: 高水準の API インデックス13042933
Ref: library/asyncio-api-index doc13043092
Ref: a7d13043092
Ref: library/asyncio-api-index high-level-api-index13043092
Ref: 39c013043092
Ref: library/asyncio-api-index translation-repo13043092
Ref: 39c113043092
Node: Task13043464
Ref: library/asyncio-api-index tasks13043561
Ref: 39c213043561
Node: キュー<2>13048323
Ref: library/asyncio-api-index queues13048450
Ref: 39c313048450
Node: サブプロセス<2>13049360
Ref: library/asyncio-api-index subprocesses13049501
Ref: 39c413049501
Node: ストリーム<2>13050214
Ref: library/asyncio-api-index streams13050349
Ref: 39c513050349
Node: 同期13052104
Ref: library/asyncio-api-index synchronization13052228
Ref: 39c613052228
Node: 例外<17>13053788
Ref: library/asyncio-api-index exceptions13053885
Ref: 39c713053885
Node: 低水準の API インデックス13054790
Ref: library/asyncio-llapi-index doc13054960
Ref: 39c813054960
Ref: library/asyncio-llapi-index low-level-api-index13054960
Ref: 39c913054960
Ref: library/asyncio-llapi-index translation-repo13054960
Ref: 39ca13054960
Node: イベントループの取得13055346
Ref: library/asyncio-llapi-index obtaining-the-event-loop13055493
Ref: 39cb13055493
Node: イベントループのメソッド13056789
Ref: library/asyncio-llapi-index event-loop-methods13056969
Ref: 39cc13056969
Node: トランスポート<2>13070933
Ref: library/asyncio-llapi-index transports13071101
Ref: 39cd13071101
Node: プロトコル<3>13078511
Ref: library/asyncio-llapi-index protocols13078679
Ref: 39ce13078679
Node: イベントループのポリシー13083242
Ref: library/asyncio-llapi-index event-loop-policies13083377
Ref: 39cf13083377
Node: asyncio での開発13084398
Ref: library/asyncio-dev doc13084565
Ref: 39d013084565
Ref: library/asyncio-dev asyncio-dev13084565
Ref: 39d113084565
Ref: library/asyncio-dev developing-with-asyncio13084565
Ref: 39d213084565
Ref: library/asyncio-dev translation-repo13084565
Ref: 39d313084565
Node: デバッグモード13085154
Ref: library/asyncio-dev asyncio-debug-mode13085283
Ref: 219513085283
Ref: library/asyncio-dev debug-mode13085283
Ref: 39d413085283
Node: 並行処理とマルチスレッド処理13087123
Ref: library/asyncio-dev asyncio-multithreading13087297
Ref: 388413087297
Ref: library/asyncio-dev concurrency-and-multithreading13087297
Ref: 39d613087297
Node: ブロッキングコードの実行13090487
Ref: library/asyncio-dev asyncio-handle-blocking13090655
Ref: 39d713090655
Ref: library/asyncio-dev running-blocking-code13090655
Ref: 39d813090655
Node: ログ記録<3>13091296
Ref: library/asyncio-dev asyncio-logger13091479
Ref: 39d513091479
Ref: library/asyncio-dev logging13091479
Ref: 39d913091479
Node: 待ち受け処理を伴わないコルーチンの検出13092140
Ref: library/asyncio-dev asyncio-coroutine-not-scheduled13092320
Ref: 39db13092320
Ref: library/asyncio-dev detect-never-awaited-coroutines13092320
Ref: 39dc13092320
Node: 回収されない例外の検出13093544
Ref: library/asyncio-dev detect-never-retrieved-exceptions13093747
Ref: 39dd13093747
Node: Asynchronous generators best practices13095470
Ref: library/asyncio-dev asynchronous-generators-best-practices13095607
Ref: 39de13095607
Node: Close asynchronous generators explicitly13096069
Ref: library/asyncio-dev close-asynchronous-generators-explicitly13096259
Ref: 39df13096259
Node: Create asynchronous generators only when the event loop is running13099021
Ref: library/asyncio-dev create-asynchronous-generators-only-when-the-event-loop-is-running13099280
Ref: 39e113099280
Node: Avoid concurrent iteration and closure of the same generator13101372
Ref: library/asyncio-dev avoid-concurrent-iteration-and-closure-of-the-same-generator13101582
Ref: 39e213101582
Node: asyncio and free-threaded Python13103292
Ref: library/asyncio-threading doc13103415
Ref: 39e313103415
Ref: library/asyncio-threading asyncio-and-free-threaded-python13103415
Ref: 39e413103415
Ref: library/asyncio-threading asyncio-threading13103415
Ref: 39e513103415
Ref: library/asyncio-threading translation-repo13103415
Ref: 39e613103415
Ref: asyncio and free-threaded Python-Footnote-113105208
Node: Thread safety considerations13105289
Ref: library/asyncio-threading thread-safety-considerations13105421
Ref: 39e713105421
Node: Using asyncio with threads13106788
Ref: library/asyncio-threading using-asyncio-with-threads13106961
Ref: 39e813106961
Node: Producer/consumer across threads13108035
Ref: library/asyncio-threading producer-consumer-across-threads13108171
Ref: 39e913108171
Ref: Producer/consumer across threads-Footnote-113109848
Node: socket --- 低水準ネットワークインターフェース13109913
Ref: library/socket doc13110168
Ref: 39ea13110168
Ref: library/socket module-socket13110168
Ref: d113110168
Ref: library/socket socket-low-level-networking-interface13110168
Ref: 39eb13110168
Ref: library/socket translation-repo13110168
Ref: 39ec13110168
Ref: socket --- 低水準ネットワークインターフェース-Footnote-113112215
Node: ソケットファミリー13112281
Ref: library/socket socket-addresses13112443
Ref: 39ed13112443
Ref: library/socket socket-families13112443
Ref: 39ee13112443
Ref: library/socket host-port13114174
Ref: 39ef13114174
Ref: ソケットファミリー-Footnote-113127062
Ref: ソケットファミリー-Footnote-213127104
Node: モジュールの内容<2>13127149
Ref: library/socket module-contents13127345
Ref: 39fb13127345
Node: 例外<18>13127537
Ref: library/socket exceptions13127629
Ref: 39fc13127629
Ref: library/socket socket error13127660
Ref: 126513127660
Ref: library/socket socket herror13127900
Ref: 39fd13127900
Ref: library/socket socket gaierror13128619
Ref: 1b2513128619
Ref: library/socket socket timeout13129254
Ref: a3913129254
Ref: 例外<18>-Footnote-113130088
Node: 定数<8>13130130
Ref: library/socket constants13130240
Ref: 39ff13130240
Ref: library/socket socket AF_UNIX13130424
Ref: 1c0d13130424
Ref: library/socket socket AF_INET13130454
Ref: 1c0a13130454
Ref: library/socket socket AF_INET613130484
Ref: 1c0b13130484
Ref: library/socket socket AF_UNSPEC13130803
Ref: 393613130803
Ref: library/socket socket SOCK_STREAM13131019
Ref: 150f13131019
Ref: library/socket socket SOCK_DGRAM13131053
Ref: 150e13131053
Ref: library/socket socket SOCK_RAW13131086
Ref: 3a0013131086
Ref: library/socket socket SOCK_RDM13131117
Ref: 3a0113131117
Ref: library/socket socket SOCK_SEQPACKET13131148
Ref: 3a0213131148
Ref: library/socket socket SOCK_CLOEXEC13131454
Ref: e0913131454
Ref: library/socket socket SOCK_NONBLOCK13131489
Ref: e0813131489
Ref: library/socket socket-unix-constants13132003
Ref: d7013132003
Ref: library/socket socket SOMAXCONN13132023
Ref: 106313132023
Ref: library/socket socket AF_CAN13135092
Ref: 39f013135092
Ref: library/socket socket PF_CAN13135121
Ref: 3a0313135121
Ref: library/socket socket CAN_BCM13135596
Ref: 11a913135596
Ref: library/socket socket CAN_RAW_FD_FRAMES13136083
Ref: 10ce13136083
Ref: library/socket socket CAN_RAW_JOIN_FILTERS13136704
Ref: b2f13136704
Ref: library/socket socket CAN_ISOTP13137044
Ref: 39f113137044
Ref: library/socket socket CAN_J193913137301
Ref: b3013137301
Ref: library/socket socket AF_DIVERT13137542
Ref: 3a0413137542
Ref: library/socket socket PF_DIVERT13137574
Ref: 3a0513137574
Ref: library/socket socket AF_PACKET13137806
Ref: 39f713137806
Ref: library/socket socket PF_PACKET13137838
Ref: 3a0613137838
Ref: library/socket socket ETH_P_ALL13138069
Ref: 1b8213138069
Ref: library/socket socket AF_RDS13138424
Ref: 3a0713138424
Ref: library/socket socket PF_RDS13138453
Ref: 3a0813138453
Ref: library/socket socket SOL_RDS13138482
Ref: 3a0913138482
Ref: library/socket socket SIO_RCVALL13138739
Ref: 3a0a13138739
Ref: library/socket socket SIO_KEEPALIVE_VALS13138772
Ref: 3a0b13138772
Ref: library/socket socket SIO_LOOPBACK_FAST_PATH13138813
Ref: ed313138813
Ref: library/socket socket AF_ALG13139366
Ref: ed613139366
Ref: library/socket socket SOL_ALG13139395
Ref: 3a0c13139395
Ref: library/socket socket AF_VSOCK13139578
Ref: d7113139578
Ref: library/socket socket IOCTL_VM_SOCKETS_GET_LOCAL_CID13139609
Ref: 3a0d13139609
Ref: library/socket socket AF_LINK13139837
Ref: 11aa13139837
Ref: library/socket socket has_ipv613139941
Ref: 3a0e13139941
Ref: library/socket socket AF_BLUETOOTH13140086
Ref: 1c0c13140086
Ref: library/socket socket BTPROTO_L2CAP13140121
Ref: 28513140121
Ref: library/socket socket BTPROTO_RFCOMM13140157
Ref: 39f513140157
Ref: library/socket socket BTPROTO_HCI13140194
Ref: 28313140194
Ref: library/socket socket BTPROTO_SCO13140228
Ref: 28413140228
Ref: library/socket socket BDADDR_ANY13140321
Ref: 3a0f13140321
Ref: library/socket socket BDADDR_LOCAL13140354
Ref: 3a1013140354
Ref: library/socket socket BDADDR_BREDR13140700
Ref: 39f213140700
Ref: library/socket socket BDADDR_LE_PUBLIC13140735
Ref: 39f313140735
Ref: library/socket socket BDADDR_LE_RANDOM13140774
Ref: 39f413140774
Ref: library/socket socket SOL_RFCOMM13141017
Ref: 3a1113141017
Ref: library/socket socket SOL_L2CAP13141050
Ref: 3a1213141050
Ref: library/socket socket SOL_HCI13141082
Ref: 3a1313141082
Ref: library/socket socket SOL_SCO13141112
Ref: 3a1413141112
Ref: library/socket socket SOL_BLUETOOTH13141142
Ref: 3a1513141142
Ref: library/socket socket L2CAP_LM13141482
Ref: 3a1613141482
Ref: library/socket socket HCI_FILTER13142052
Ref: 3a1713142052
Ref: library/socket socket HCI_TIME_STAMP13142085
Ref: 3a1813142085
Ref: library/socket socket HCI_DATA_DIR13142122
Ref: 3a1913142122
Ref: library/socket socket SO_HCI_EVT_FILTER13142157
Ref: 3a1a13142157
Ref: library/socket socket SO_HCI_PKT_FILTER13142197
Ref: 3a1b13142197
Ref: library/socket socket HCI_DEV_NONE13142563
Ref: 3a1c13142563
Ref: library/socket socket HCI_CHANNEL_RAW13142784
Ref: 39f613142784
Ref: library/socket socket HCI_CHANNEL_USER13142822
Ref: 3a1d13142822
Ref: library/socket socket HCI_CHANNEL_MONITOR13142861
Ref: 3a1e13142861
Ref: library/socket socket HCI_CHANNEL_CONTROL13142903
Ref: 3a1f13142903
Ref: library/socket socket HCI_CHANNEL_LOGGING13142945
Ref: 3a2013142945
Ref: library/socket socket AF_QIPCRTR13143147
Ref: 39f813143147
Ref: library/socket socket SCM_CREDS213143346
Ref: 3a2113143346
Ref: library/socket socket LOCAL_CREDS13143379
Ref: 3a2213143379
Ref: library/socket socket LOCAL_CREDS_PERSISTENT13143413
Ref: 3a2313143413
Ref: library/socket socket SO_INCOMING_CPU13143856
Ref: 3a2413143856
Ref: library/socket socket SO_REUSEPORT_LB13144067
Ref: 193613144067
Ref: library/socket socket AF_HYPERV13144281
Ref: 39f913144281
Ref: library/socket socket HV_PROTOCOL_RAW13144313
Ref: 3a2513144313
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT13144351
Ref: 3a2613144351
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT_MAX13144398
Ref: 3a2713144398
Ref: library/socket socket HVSOCKET_CONNECTED_SUSPEND13144449
Ref: 3a2813144449
Ref: library/socket socket HVSOCKET_ADDRESS_FLAG_PASSTHRU13144498
Ref: 3a2913144498
Ref: library/socket socket HV_GUID_ZERO13144551
Ref: 3a2a13144551
Ref: library/socket socket HV_GUID_WILDCARD13144586
Ref: 3a2b13144586
Ref: library/socket socket HV_GUID_BROADCAST13144625
Ref: 3a2c13144625
Ref: library/socket socket HV_GUID_CHILDREN13144665
Ref: 3a2d13144665
Ref: library/socket socket HV_GUID_LOOPBACK13144704
Ref: 3a2e13144704
Ref: library/socket socket HV_GUID_PARENT13144743
Ref: 3a2f13144743
Ref: library/socket socket-ethernet-types13144932
Ref: 1b8313144932
Ref: library/socket socket ETHERTYPE_ARP13144932
Ref: 3a3013144932
Ref: library/socket socket ETHERTYPE_IP13144968
Ref: 3a3113144968
Ref: library/socket socket ETHERTYPE_IPV613145003
Ref: 3a3213145003
Ref: library/socket socket ETHERTYPE_VLAN13145040
Ref: 3a3313145040
Ref: library/socket socket SHUT_RD13145212
Ref: 3a3413145212
Ref: library/socket socket SHUT_WR13145242
Ref: 3a3513145242
Ref: library/socket socket SHUT_RDWR13145272
Ref: 3a3613145272
Ref: 定数<8>-Footnote-113145477
Ref: 定数<8>-Footnote-213145529
Ref: 定数<8>-Footnote-313145575
Node: 関数<8>13145655
Ref: library/socket functions13145746
Ref: 3a3813145746
Node: ソケットの作成13145858
Ref: library/socket creating-sockets13145955
Ref: 3a3913145955
Ref: library/socket socket socketpair13146243
Ref: df413146243
Ref: library/socket socket create_connection13147133
Ref: 88313147133
Ref: library/socket socket create_server13148948
Ref: c2413148948
Ref: library/socket socket has_dualstack_ipv613150781
Ref: c2513150781
Ref: library/socket socket fromfd13150979
Ref: 3a3c13150979
Ref: library/socket socket fromshare13151904
Ref: e0513151904
Node: その他の関数<2>13152222
Ref: library/socket other-functions13152319
Ref: 3a3d13152319
Ref: library/socket socket close13152441
Ref: d6e13152441
Ref: library/socket socket getaddrinfo13152707
Ref: 17c713152707
Ref: library/socket socket getfqdn13157022
Ref: 1b4c13157022
Ref: library/socket socket gethostbyname13157640
Ref: 3a3e13157640
Ref: library/socket socket gethostbyname_ex13158473
Ref: 1ce113158473
Ref: library/socket socket gethostname13159279
Ref: 30a613159279
Ref: library/socket socket gethostbyaddr13159815
Ref: 1ce013159815
Ref: library/socket socket getnameinfo13160574
Ref: 1a9c13160574
Ref: library/socket socket getprotobyname13161371
Ref: 3a3f13161371
Ref: library/socket socket getservbyname13161865
Ref: 3a4013161865
Ref: library/socket socket getservbyport13162476
Ref: 3a4113162476
Ref: library/socket socket ntohl13163055
Ref: 3a4213163055
Ref: library/socket socket ntohs13163458
Ref: a8413163458
Ref: library/socket socket htonl13163987
Ref: 3a4313163987
Ref: library/socket socket htons13164390
Ref: a8313164390
Ref: library/socket socket inet_aton13164919
Ref: b5e13164919
Ref: library/socket socket inet_ntoa13165912
Ref: 3a4413165912
Ref: library/socket socket inet_pton13166944
Ref: b5f13166944
Ref: library/socket socket inet_ntop13167860
Ref: 11ab13167860
Ref: library/socket socket CMSG_LEN13169132
Ref: 1e7413169132
Ref: library/socket socket CMSG_SPACE13170089
Ref: 1e7313170089
Ref: library/socket socket getdefaulttimeout13171243
Ref: 3a3b13171243
Ref: library/socket socket setdefaulttimeout13171637
Ref: 39fe13171637
Ref: library/socket socket sethostname13171926
Ref: 135713171926
Ref: library/socket socket if_nameindex13172315
Ref: c2613172315
Ref: library/socket socket if_nametoindex13173228
Ref: c2713173228
Ref: library/socket socket if_indextoname13173825
Ref: c2813173825
Ref: library/socket socket send_fds13174421
Ref: b3113174421
Ref: library/socket socket recv_fds13174897
Ref: b3213174897
Ref: その他の関数<2>-Footnote-113175485
Ref: その他の関数<2>-Footnote-213175538
Ref: その他の関数<2>-Footnote-313175589
Ref: その他の関数<2>-Footnote-413175633
Node: socket オブジェクト13175692
Ref: library/socket id113175906
Ref: 3a4513175906
Ref: library/socket socket-objects13175906
Ref: 3a3a13175906
Ref: library/socket socket socket13175971
Ref: fa513175971
Ref: library/socket socket socket accept13179379
Ref: fa613179379
Ref: library/socket socket socket bind13180442
Ref: 12db13180442
Ref: library/socket socket socket close13180874
Ref: f4313180874
Ref: library/socket socket socket connect13181994
Ref: fa713181994
Ref: library/socket socket socket connect_ex13183386
Ref: 175813183386
Ref: library/socket socket socket detach13184087
Ref: 143913184087
Ref: library/socket socket socket dup13184401
Ref: 3a4613184401
Ref: library/socket socket socket fileno13184729
Ref: 3a4713184729
Ref: library/socket socket socket get_inheritable13185225
Ref: 110513185225
Ref: library/socket socket socket getpeername13185581
Ref: 397513185581
Ref: library/socket socket socket getsockname13185979
Ref: 28613185979
Ref: library/socket socket socket getsockopt13186286
Ref: ed413186286
Ref: library/socket socket socket getblocking13187097
Ref: d6d13187097
Ref: library/socket socket socket gettimeout13187345
Ref: 3a4813187345
Ref: library/socket socket socket ioctl13187799
Ref: ed213187799
Ref: library/socket socket socket listen13188702
Ref: 106213188702
Ref: library/socket socket socket makefile13189357
Ref: 13bb13189357
Ref: library/socket socket socket recv13190911
Ref: fa813190911
Ref: library/socket socket socket recvfrom13191786
Ref: fa913191786
Ref: library/socket socket socket recvmsg13192959
Ref: faa13192959
Ref: library/socket socket socket recvmsg_into13198017
Ref: 135613198017
Ref: library/socket socket socket recvfrom_into13200102
Ref: 153a13200102
Ref: library/socket socket socket recv_into13200719
Ref: 153913200719
Ref: library/socket socket socket send13201379
Ref: fab13201379
Ref: library/socket socket socket sendall13202379
Ref: fac13202379
Ref: library/socket socket socket sendto13203631
Ref: fad13203631
Ref: library/socket socket socket sendmsg13204693
Ref: 6a113204693
Ref: library/socket socket socket sendmsg_afalg13207540
Ref: ed713207540
Ref: library/socket socket socket sendfile13207978
Ref: 106113207978
Ref: library/socket socket socket set_inheritable13209210
Ref: 110613209210
Ref: library/socket socket socket setblocking13209454
Ref: 30bd13209454
Ref: library/socket socket socket settimeout13210261
Ref: 39fa13210261
Ref: library/socket socket socket setsockopt13211085
Ref: ed513211085
Ref: library/socket socket socket shutdown13212333
Ref: 3a3713212333
Ref: library/socket socket socket share13212767
Ref: e0613212767
Ref: library/socket socket socket family13214053
Ref: 3a4b13214053
Ref: library/socket socket socket type13214123
Ref: e0a13214123
Ref: library/socket socket socket proto13214185
Ref: 3a4c13214185
Ref: library/socket socket SocketType13214254
Ref: 3a4d13214254
Ref: socket オブジェクト-Footnote-113214597
Ref: socket オブジェクト-Footnote-213214639
Ref: socket オブジェクト-Footnote-313214681
Ref: socket オブジェクト-Footnote-413214731
Ref: socket オブジェクト-Footnote-513214805
Ref: socket オブジェクト-Footnote-613214849
Ref: socket オブジェクト-Footnote-713214891
Ref: socket オブジェクト-Footnote-813214935
Ref: socket オブジェクト-Footnote-913214977
Ref: socket オブジェクト-Footnote-1013215019
Ref: socket オブジェクト-Footnote-1113215064
Ref: socket オブジェクト-Footnote-1213215109
Ref: socket オブジェクト-Footnote-1313215152
Ref: socket オブジェクト-Footnote-1413215195
Ref: socket オブジェクト-Footnote-1513215238
Ref: socket オブジェクト-Footnote-1613215281
Node: ソケットタイムアウトの注意事項13215332
Ref: library/socket notes-on-socket-timeouts13215532
Ref: 3a4e13215532
Ref: library/socket socket-timeouts13215532
Ref: 3a4a13215532
Node: タイムアウトと connect メソッド13217483
Ref: library/socket timeouts-and-the-connect-method13217657
Ref: 3a4f13217657
Node: タイムアウトと accept メソッド13218217
Ref: library/socket timeouts-and-the-accept-method13218391
Ref: 3a5013218391
Node: 使用例<27>13219452
Ref: library/socket example13219618
Ref: 3a5113219618
Ref: library/socket socket-example13219618
Ref: 3a5213219618
Ref: 使用例<27>-Footnote-113227869
Node: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー13227928
Ref: library/ssl doc13228188
Ref: 3a5313228188
Ref: library/ssl module-ssl13228188
Ref: d513228188
Ref: library/ssl ssl-tls-ssl-wrapper-for-socket-objects13228188
Ref: 3a5413228188
Ref: library/ssl translation-repo13228188
Ref: 3a5513228188
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-113231748
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-213231811
Node: Functions constants and exceptions13231853
Ref: library/ssl functions-constants-and-exceptions13232009
Ref: 3a5613232009
Node: ソケットの作成<2>13232284
Ref: library/ssl socket-creation13232415
Ref: 3a5713232415
Node: コンテキストの作成13233948
Ref: library/ssl context-creation13234098
Ref: 3a5813234098
Ref: library/ssl ssl create_default_context13234314
Ref: 48013234314
Ref: コンテキストの作成-Footnote-113238827
Ref: コンテキストの作成-Footnote-213238886
Ref: コンテキストの作成-Footnote-313238931
Node: 例外<19>13238990
Ref: library/ssl exceptions13239128
Ref: 3a5d13239128
Ref: library/ssl ssl SSLError13239159
Ref: 149513239159
Ref: library/ssl ssl SSLError library13239861
Ref: 136313239861
Ref: library/ssl ssl SSLError reason13240168
Ref: 136413240168
Ref: library/ssl ssl SSLZeroReturnError13240448
Ref: 3a5e13240448
Ref: library/ssl ssl SSLWantReadError13240851
Ref: 106d13240851
Ref: library/ssl ssl SSLWantWriteError13241245
Ref: 106e13241245
Ref: library/ssl ssl SSLSyscallError13241640
Ref: 3a6013241640
Ref: library/ssl ssl SSLEOFError13241985
Ref: 1b1a13241985
Ref: library/ssl ssl SSLCertVerificationError13242312
Ref: d7913242312
Ref: library/ssl ssl SSLCertVerificationError verify_code13242476
Ref: 3a6113242476
Ref: library/ssl ssl SSLCertVerificationError verify_message13242580
Ref: 3a6213242580
Ref: library/ssl ssl CertificateError13242678
Ref: 3a6313242678
Node: 乱数生成13242894
Ref: library/ssl random-generation13243029
Ref: 3a6413243029
Ref: library/ssl ssl RAND_bytes13243070
Ref: 74713243070
Ref: library/ssl ssl RAND_status13244064
Ref: 1cda13244064
Ref: library/ssl ssl RAND_add13244381
Ref: 3a6513244381
Ref: 乱数生成-Footnote-113244876
Ref: 乱数生成-Footnote-213244970
Ref: 乱数生成-Footnote-313245108
Node: 証明書の取り扱い13245167
Ref: library/ssl certificate-handling13245301
Ref: 3a6613245301
Ref: library/ssl ssl cert_time_to_seconds13245362
Ref: 106f13245362
Ref: library/ssl ssl get_server_certificate13246386
Ref: a4113246386
Ref: library/ssl ssl DER_cert_to_PEM_cert13247638
Ref: 3a6813247638
Ref: library/ssl ssl PEM_cert_to_DER_cert13247869
Ref: 3a6913247869
Ref: library/ssl ssl get_default_verify_paths13248082
Ref: 11b013248082
Ref: library/ssl ssl enum_certificates13249050
Ref: 11bb13249050
Ref: library/ssl ssl enum_crls13250137
Ref: 11bc13250137
Ref: 証明書の取り扱い-Footnote-113250857
Node: 定数<9>13250916
Ref: library/ssl constants13251029
Ref: 3a6a13251029
Ref: library/ssl ssl CERT_NONE13251239
Ref: 3a6b13251239
Ref: library/ssl ssl CERT_OPTIONAL13251877
Ref: 3a6c13251877
Ref: library/ssl ssl CERT_REQUIRED13252626
Ref: 3a5a13252626
Ref: library/ssl ssl VerifyMode13253595
Ref: 3a6e13253595
Ref: library/ssl ssl VERIFY_DEFAULT13253730
Ref: 11b513253730
Ref: library/ssl ssl VERIFY_CRL_CHECK_LEAF13254058
Ref: 11b613254058
Ref: library/ssl ssl VERIFY_CRL_CHECK_CHAIN13254598
Ref: 11b713254598
Ref: library/ssl ssl VERIFY_X509_STRICT13254884
Ref: 55113254884
Ref: library/ssl ssl VERIFY_ALLOW_PROXY_CERTS13255107
Ref: 1cf013255107
Ref: library/ssl ssl VERIFY_X509_TRUSTED_FIRST13255291
Ref: 3a6f13255291
Ref: library/ssl ssl VERIFY_X509_PARTIAL_CHAIN13255650
Ref: 48113255650
Ref: library/ssl ssl VerifyFlags13256090
Ref: 3a7013256090
Ref: library/ssl ssl PROTOCOL_TLS13256228
Ref: 3a5c13256228
Ref: library/ssl ssl PROTOCOL_TLS_CLIENT13256834
Ref: a7613256834
Ref: library/ssl ssl PROTOCOL_TLS_SERVER13257152
Ref: a7713257152
Ref: library/ssl ssl PROTOCOL_SSLv2313257372
Ref: 3a7113257372
Ref: library/ssl ssl PROTOCOL_SSLv313257584
Ref: 3a6713257584
Ref: library/ssl ssl PROTOCOL_TLSv113258298
Ref: 3a7213258298
Ref: library/ssl ssl PROTOCOL_TLSv1_113258530
Ref: 11ae13258530
Ref: library/ssl ssl PROTOCOL_TLSv1_213258851
Ref: 11af13258851
Ref: library/ssl ssl OP_ALL13259174
Ref: 3a7313259174
Ref: library/ssl ssl OP_NO_SSLv213259565
Ref: a3e13259565
Ref: library/ssl ssl OP_NO_SSLv313259970
Ref: a3f13259970
Ref: library/ssl ssl OP_NO_TLSv113260375
Ref: 3a7413260375
Ref: library/ssl ssl OP_NO_TLSv1_113260914
Ref: 3a7513260914
Ref: library/ssl ssl OP_NO_TLSv1_213261423
Ref: 3a7613261423
Ref: library/ssl ssl OP_NO_TLSv1_313261932
Ref: 1cb813261932
Ref: library/ssl ssl OP_NO_RENEGOTIATION13262529
Ref: 3a7713262529
Ref: library/ssl ssl OP_CIPHER_SERVER_PREFERENCE13262833
Ref: 136513262833
Ref: library/ssl ssl OP_SINGLE_DH_USE13263157
Ref: 3a7813263157
Ref: library/ssl ssl OP_SINGLE_ECDH_USE13263417
Ref: 3a7913263417
Ref: library/ssl ssl OP_ENABLE_MIDDLEBOX_COMPAT13263681
Ref: 3a7a13263681
Ref: library/ssl ssl OP_NO_COMPRESSION13263981
Ref: 136213263981
Ref: library/ssl ssl Options13264232
Ref: 3a7b13264232
Ref: library/ssl ssl OP_NO_TICKET13264334
Ref: 3a7c13264334
Ref: library/ssl ssl OP_IGNORE_UNEXPECTED_EOF13264513
Ref: a3c13264513
Ref: library/ssl ssl OP_ENABLE_KTLS13264721
Ref: 1b6e13264721
Ref: library/ssl ssl OP_LEGACY_SERVER_CONNECT13265451
Ref: 1b5013265451
Ref: library/ssl ssl HAS_ALPN13265616
Ref: 106a13265616
Ref: library/ssl ssl HAS_NEVER_CHECK_COMMON_NAME13265866
Ref: 3a7d13265866
Ref: library/ssl ssl HAS_ECDH13266109
Ref: 3a7e13266109
Ref: library/ssl ssl HAS_SNI13266439
Ref: 3a7f13266439
Ref: library/ssl ssl HAS_NPN13266665
Ref: 3a8013266665
Ref: library/ssl ssl HAS_SSLv213267089
Ref: 3a8113267089
Ref: library/ssl ssl HAS_SSLv313267270
Ref: 3a8213267270
Ref: library/ssl ssl HAS_TLSv113267451
Ref: 3a8313267451
Ref: library/ssl ssl HAS_TLSv1_113267632
Ref: d8013267632
Ref: library/ssl ssl HAS_TLSv1_213267815
Ref: 3a8413267815
Ref: library/ssl ssl HAS_TLSv1_313267998
Ref: 3a8513267998
Ref: library/ssl ssl HAS_PSK13268181
Ref: 3a8613268181
Ref: library/ssl ssl HAS_PHA13268306
Ref: 28813268306
Ref: library/ssl ssl CHANNEL_BINDING_TYPES13268431
Ref: 3a8713268431
Ref: library/ssl ssl OPENSSL_VERSION13268715
Ref: 143b13268715
Ref: library/ssl ssl OPENSSL_VERSION_INFO13268967
Ref: 143c13268967
Ref: library/ssl ssl OPENSSL_VERSION_NUMBER13269193
Ref: 143d13269193
Ref: library/ssl ssl ALERT_DESCRIPTION_HANDSHAKE_FAILURE13269485
Ref: 3a8813269485
Ref: library/ssl ssl ALERT_DESCRIPTION_INTERNAL_ERROR13269540
Ref: 3a8913269540
Ref: library/ssl ssl AlertDescription13270005
Ref: 3a8a13270005
Ref: library/ssl ssl Purpose SERVER_AUTH13270166
Ref: 11b913270166
Ref: library/ssl ssl Purpose CLIENT_AUTH13270576
Ref: 11ba13270576
Ref: library/ssl ssl SSLErrorNumber13270986
Ref: 3a8b13270986
Ref: library/ssl ssl TLSVersion13271131
Ref: 3a8c13271131
Ref: library/ssl ssl TLSVersion MINIMUM_SUPPORTED13271352
Ref: 3a8d13271352
Ref: library/ssl ssl TLSVersion MAXIMUM_SUPPORTED13271397
Ref: 3a8e13271397
Ref: library/ssl ssl TLSVersion SSLv313271618
Ref: 3a8f13271618
Ref: library/ssl ssl TLSVersion TLSv113271651
Ref: 3a9013271651
Ref: library/ssl ssl TLSVersion TLSv1_113271684
Ref: 3a9113271684
Ref: library/ssl ssl TLSVersion TLSv1_213271719
Ref: 3a9213271719
Ref: library/ssl ssl TLSVersion TLSv1_313271754
Ref: 3a9313271754
Ref: 定数<9>-Footnote-113272022
Ref: 定数<9>-Footnote-213272081
Ref: 定数<9>-Footnote-313272140
Ref: 定数<9>-Footnote-413272218
Ref: 定数<9>-Footnote-513272277
Node: SSL sockets13272370
Ref: library/ssl ssl-sockets13272547
Ref: 3a9413272547
Ref: library/ssl ssl SSLSocket13272590
Ref: aeb13272590
Ref: library/ssl ssl SSLSocket read13275405
Ref: 107213275405
Ref: library/ssl ssl SSLSocket write13276534
Ref: 107313276534
Ref: library/ssl ssl SSLSocket do_handshake13278118
Ref: 107113278118
Ref: library/ssl ssl SSLSocket getpeercert13279197
Ref: 11be13279197
Ref: library/ssl ssl SSLSocket get_verified_chain13283137
Ref: 19bc13283137
Ref: library/ssl ssl SSLSocket get_unverified_chain13283452
Ref: 19bd13283452
Ref: library/ssl ssl SSLSocket cipher13283652
Ref: 397613283652
Ref: library/ssl ssl SSLSocket shared_ciphers13283990
Ref: 107013283990
Ref: library/ssl ssl SSLSocket compression13284630
Ref: 136113284630
Ref: library/ssl ssl SSLSocket get_channel_binding13285066
Ref: 136013285066
Ref: library/ssl ssl SSLSocket selected_alpn_protocol13285907
Ref: 106913285907
Ref: library/ssl ssl SSLSocket selected_npn_protocol13286448
Ref: a7813286448
Ref: library/ssl ssl SSLSocket unwrap13286970
Ref: 3a9513286970
Ref: library/ssl ssl SSLSocket verify_client_post_handshake13287532
Ref: c2b13287532
Ref: library/ssl ssl SSLSocket version13288419
Ref: 106c13288419
Ref: library/ssl ssl SSLSocket pending13288968
Ref: 3a9713288968
Ref: library/ssl ssl SSLSocket context13289141
Ref: 3a9613289141
Ref: library/ssl ssl SSLSocket server_side13289271
Ref: 3a9813289271
Ref: library/ssl ssl SSLSocket server_hostname13289504
Ref: d7c13289504
Ref: library/ssl ssl SSLSocket session13290056
Ref: 199d13290056
Ref: library/ssl ssl SSLSocket session_reused13290534
Ref: 3a9913290534
Ref: SSL sockets-Footnote-113290639
Ref: SSL sockets-Footnote-213290698
Node: SSL contexts13290757
Ref: library/ssl ssl-contexts13290909
Ref: 3a9a13290909
Ref: library/ssl ssl SSLContext13291370
Ref: 35513291370
Ref: library/ssl ssl SSLContext cert_store_stats13296397
Ref: 11b213296397
Ref: library/ssl ssl SSLContext load_cert_chain13296857
Ref: 59813296857
Ref: library/ssl ssl SSLContext load_default_certs13298783
Ref: 11b813298783
Ref: library/ssl ssl SSLContext load_verify_locations13299776
Ref: 10f213299776
Ref: library/ssl ssl SSLContext get_ca_certs13301567
Ref: 11b313301567
Ref: library/ssl ssl SSLContext get_ciphers13302418
Ref: ede13302418
Ref: library/ssl ssl SSLContext set_default_verify_paths13303809
Ref: 11b113303809
Ref: library/ssl ssl SSLContext set_ciphers13304450
Ref: 3a9c13304450
Ref: library/ssl ssl SSLContext set_alpn_protocols13305045
Ref: 106813305045
Ref: library/ssl ssl SSLContext set_npn_protocols13305792
Ref: 35613305792
Ref: library/ssl ssl SSLContext sni_callback13306632
Ref: 179413306632
Ref: library/ssl ssl SSLContext set_servername_callback13309602
Ref: 11bd13309602
Ref: library/ssl ssl SSLContext load_dh_params13310282
Ref: 135e13310282
Ref: library/ssl ssl SSLContext set_ecdh_curve13311033
Ref: 135f13311033
Ref: library/ssl ssl SSLContext wrap_socket13311961
Ref: 74813311961
Ref: library/ssl ssl SSLContext sslsocket_class13315407
Ref: 3a9d13315407
Ref: library/ssl ssl SSLContext wrap_bio13315719
Ref: d7f13315719
Ref: library/ssl ssl SSLContext sslobject_class13316510
Ref: 3a9e13316510
Ref: library/ssl ssl SSLContext session_stats13316795
Ref: 3a9f13316795
Ref: library/ssl ssl SSLContext check_hostname13317266
Ref: 3a6d13317266
Ref: library/ssl ssl SSLContext keylog_filename13318795
Ref: 3a5b13318795
Ref: library/ssl ssl SSLContext maximum_version13319241
Ref: a7513319241
Ref: library/ssl ssl SSLContext minimum_version13320083
Ref: a7413320083
Ref: library/ssl ssl SSLContext num_tickets13320296
Ref: 3aa013320296
Ref: library/ssl ssl SSLContext options13320529
Ref: a3d13320529
Ref: library/ssl ssl SSLContext post_handshake_auth13321338
Ref: c2a13321338
Ref: library/ssl ssl SSLContext protocol13322155
Ref: 3aa113322155
Ref: library/ssl ssl SSLContext hostname_checks_common_name13322327
Ref: d7a13322327
Ref: library/ssl ssl SSLContext security_level13322767
Ref: 3aa213322767
Ref: library/ssl ssl SSLContext verify_flags13322942
Ref: 11b413322942
Ref: library/ssl ssl SSLContext verify_mode13323581
Ref: 3a5913323581
Ref: library/ssl ssl SSLContext set_psk_client_callback13324195
Ref: 3aa313324195
Ref: library/ssl ssl SSLContext set_psk_server_callback13326200
Ref: 3aa413326200
Ref: SSL contexts-Footnote-113328088
Ref: SSL contexts-Footnote-213328242
Ref: SSL contexts-Footnote-313328374
Ref: SSL contexts-Footnote-413328507
Ref: SSL contexts-Footnote-513328661
Ref: SSL contexts-Footnote-613328793
Ref: SSL contexts-Footnote-713328926
Ref: SSL contexts-Footnote-813329003
Ref: SSL contexts-Footnote-913329057
Ref: SSL contexts-Footnote-1013329116
Ref: SSL contexts-Footnote-1113329195
Ref: SSL contexts-Footnote-1213329255
Ref: SSL contexts-Footnote-1313329332
Ref: SSL contexts-Footnote-1413329398
Node: 証明書13329472
Ref: library/ssl certificates13329626
Ref: 3aa513329626
Ref: library/ssl ssl-certificates13329626
Ref: 3a9b13329626
Ref: 証明書-Footnote-113332370
Node: 証明書チェイン13332429
Ref: library/ssl certificate-chains13332517
Ref: 3aa613332517
Node: CA 証明書13333879
Ref: library/ssl ca-certificates13334015
Ref: 3aa713334015
Node: 秘密鍵と証明書の組み合わせ13334725
Ref: library/ssl combined-key-and-certificate13334861
Ref: 3aa813334861
Node: 自己署名証明書13335486
Ref: library/ssl self-signed-certificates13335601
Ref: 3aa913335601
Node: 使用例<28>13337215
Ref: library/ssl examples13337420
Ref: 3aaa13337420
Node: SSLサポートをテストする13337579
Ref: library/ssl testing-for-ssl-support13337707
Ref: 3aab13337707
Node: クライアントサイドの処理13338123
Ref: library/ssl client-side-operation13338287
Ref: 3aac13338287
Node: サーバサイドの処理13343415
Ref: library/ssl server-side-operation13343537
Ref: 3aad13343537
Node: ノンブロッキングソケットについての注意事項13345862
Ref: library/ssl notes-on-non-blocking-sockets13346076
Ref: 3aae13346076
Ref: library/ssl ssl-nonblocking13346076
Ref: 3a5f13346076
Node: Memory BIO support13349866
Ref: library/ssl memory-bio-support13350086
Ref: 3aaf13350086
Ref: library/ssl ssl SSLObject13351562
Ref: d7e13351562
Ref: library/ssl ssl MemoryBIO13355839
Ref: 106613355839
Ref: library/ssl ssl MemoryBIO pending13356014
Ref: 3ab013356014
Ref: library/ssl ssl MemoryBIO eof13356124
Ref: 3ab113356124
Ref: library/ssl ssl MemoryBIO read13356243
Ref: 3ab213356243
Ref: library/ssl ssl MemoryBIO write13356462
Ref: 3ab313356462
Ref: library/ssl ssl MemoryBIO write_eof13356843
Ref: 3ab413356843
Node: SSL セッション13357203
Ref: library/ssl ssl-session13357402
Ref: 3ab513357402
Ref: library/ssl ssl SSLSession13357481
Ref: edd13357481
Ref: library/ssl ssl SSLSession id13357597
Ref: 3ab613357597
Ref: library/ssl ssl SSLSession time13357621
Ref: 3ab713357621
Ref: library/ssl ssl SSLSession timeout13357647
Ref: 3ab813357647
Ref: library/ssl ssl SSLSession ticket_lifetime_hint13357676
Ref: 3ab913357676
Ref: library/ssl ssl SSLSession has_ticket13357718
Ref: 3aba13357718
Node: セキュリティで考慮すべき点<3>13357750
Ref: library/ssl security-considerations13357938
Ref: 3abb13357938
Ref: library/ssl ssl-security13357938
Ref: 393113357938
Node: 最善のデフォルト値13358120
Ref: library/ssl best-defaults13358253
Ref: 3abc13358253
Node: 手動での設定13359732
Ref: library/ssl manual-settings13359898
Ref: 3abd13359898
Node: 証明書の検証13360042
Ref: library/ssl verifying-certificates13360157
Ref: 3abe13360157
Node: プロトコルのバージョン13361414
Ref: library/ssl protocol-versions13361553
Ref: 3abf13361553
Node: 暗号の選択13362515
Ref: library/ssl cipher-selection13362627
Ref: 3ac013362627
Ref: 暗号の選択-Footnote-113363274
Node: マルチプロセス化13363346
Ref: library/ssl multi-processing13363476
Ref: 3ac113363476
Node: TLS 1 313364005
Ref: library/ssl ssl-tlsv1-313364165
Ref: d7d13364165
Ref: library/ssl tls-1-313364165
Ref: 3ac213364165
Ref: TLS 1 3-Footnote-113366369
Ref: TLS 1 3-Footnote-213366435
Ref: TLS 1 3-Footnote-313366494
Ref: TLS 1 3-Footnote-413366553
Ref: TLS 1 3-Footnote-513366612
Ref: TLS 1 3-Footnote-613366671
Ref: TLS 1 3-Footnote-713366730
Ref: TLS 1 3-Footnote-813366806
Ref: TLS 1 3-Footnote-913366865
Node: select --- I/O 完了の待機13366923
Ref: library/select doc13367161
Ref: 3ac313367161
Ref: library/select module-select13367161
Ref: c613367161
Ref: library/select select-waiting-for-i-o-completion13367161
Ref: 3ac413367161
Ref: library/select translation-repo13367161
Ref: 3ac513367161
Ref: library/select select error13368646
Ref: 126613368646
Ref: library/select select devpoll13368886
Ref: 119c13368886
Ref: library/select select epoll13369721
Ref: 119a13369721
Ref: library/select select poll13371508
Ref: 314113371508
Ref: library/select select kqueue13371819
Ref: 1aa413371819
Ref: library/select select kevent13372210
Ref: 3aca13372210
Ref: library/select select select13372503
Ref: fa413372503
Ref: library/select select PIPE_BUF13375351
Ref: 142713375351
Ref: select --- I/O 完了の待機-Footnote-113376078
Ref: select --- I/O 完了の待機-Footnote-213376120
Node: /dev/poll polling objects13376162
Ref: library/select dev-poll-polling-objects13376307
Ref: 3acc13376307
Ref: library/select devpoll-objects13376307
Ref: 3ac613376307
Ref: library/select select devpoll close13376673
Ref: 119e13376673
Ref: library/select select devpoll closed13376819
Ref: 119f13376819
Ref: library/select select devpoll fileno13376963
Ref: 119d13376963
Ref: library/select select devpoll register13377116
Ref: 3acd13377116
Ref: library/select select devpoll modify13378243
Ref: 3ace13378243
Ref: library/select select devpoll unregister13378457
Ref: 3acf13378457
Ref: library/select select devpoll poll13378916
Ref: fa013378916
Ref: /dev/poll polling objects-Footnote-113380620
Node: Edge and level trigger polling epoll objects13380662
Ref: library/select edge-and-level-trigger-polling-epoll-objects13380831
Ref: 3ad013380831
Ref: library/select epoll-objects13380831
Ref: 3ac713380831
Ref: library/select select epoll close13384113
Ref: 119b13384113
Ref: library/select select epoll closed13384229
Ref: 3ad113384229
Ref: library/select select epoll fileno13384328
Ref: 3ad213384328
Ref: library/select select epoll fromfd13384427
Ref: 3ad313384427
Ref: library/select select epoll register13384528
Ref: 3ad413384528
Ref: library/select select epoll modify13384641
Ref: 3ad513384641
Ref: library/select select epoll unregister13384737
Ref: b5713384737
Ref: library/select select epoll poll13384978
Ref: fa113384978
Ref: Edge and level trigger polling epoll objects-Footnote-113385554
Node: Polling objects13385596
Ref: library/select poll-objects13385754
Ref: 3ac813385754
Ref: library/select polling-objects13385754
Ref: 3ad613385754
Ref: library/select select poll register13386329
Ref: 3ad713386329
Ref: library/select select poll modify13388602
Ref: 3ad813388602
Ref: library/select select poll unregister13388981
Ref: 3ad913388981
Ref: library/select select poll poll13389467
Ref: fa313389467
Ref: Polling objects-Footnote-113391173
Node: Kqueue objects13391215
Ref: library/select id113391343
Ref: 3ada13391343
Ref: library/select kqueue-objects13391343
Ref: 3ac913391343
Ref: library/select select kqueue close13391392
Ref: 3adb13391392
Ref: library/select select kqueue closed13391507
Ref: 3adc13391507
Ref: library/select select kqueue fileno13391614
Ref: 3add13391614
Ref: library/select select kqueue fromfd13391714
Ref: 3ade13391714
Ref: library/select select kqueue control13391847
Ref: fa213391847
Ref: Kqueue objects-Footnote-113392714
Node: Kevent objects13392756
Ref: library/select id213392860
Ref: 3adf13392860
Ref: library/select kevent-objects13392860
Ref: 3acb13392860
Ref: library/select select kevent ident13392975
Ref: 3ae013392975
Ref: library/select select kevent filter13393363
Ref: 3ae113393363
Ref: library/select select kevent flags13395161
Ref: 3ae213395161
Ref: library/select select kevent fflags13396851
Ref: 3ae313396851
Ref: library/select select kevent data13400698
Ref: 3ae413400698
Ref: library/select select kevent udata13400754
Ref: 3ae513400754
Node: selectors --- 高水準の I/O 多重化13400809
Ref: library/selectors doc13401047
Ref: 3ae613401047
Ref: library/selectors module-selectors13401047
Ref: c713401047
Ref: library/selectors selectors-high-level-i-o-multiplexing13401047
Ref: 3ae713401047
Ref: library/selectors translation-repo13401047
Ref: 3ae813401047
Ref: selectors --- 高水準の I/O 多重化-Footnote-113401412
Node: はじめに<11>13401481
Ref: library/selectors introduction13401595
Ref: 3ae913401595
Node: クラス<4>13403466
Ref: library/selectors classes13403602
Ref: 3aec13403602
Ref: library/selectors selectors EVENT_READ13404185
Ref: 3aed13404185
Ref: library/selectors selectors EVENT_WRITE13404277
Ref: 3aee13404277
Ref: library/selectors selectors SelectorKey13404351
Ref: 3aef13404351
Ref: library/selectors selectors SelectorKey fileobj13404729
Ref: 3af013404729
Ref: library/selectors selectors SelectorKey fd13404824
Ref: 3af113404824
Ref: library/selectors selectors SelectorKey events13404899
Ref: 3af213404899
Ref: library/selectors selectors SelectorKey data13405032
Ref: 3af313405032
Ref: library/selectors selectors BaseSelector13405321
Ref: 3aea13405321
Ref: library/selectors selectors BaseSelector register13406296
Ref: 3af413406296
Ref: library/selectors selectors BaseSelector unregister13407208
Ref: 3af513407208
Ref: library/selectors selectors BaseSelector modify13408043
Ref: dd313408043
Ref: library/selectors selectors BaseSelector select13408788
Ref: 3af613408788
Ref: library/selectors selectors BaseSelector close13410679
Ref: 3af713410679
Ref: library/selectors selectors BaseSelector get_key13410960
Ref: 3af813410960
Ref: library/selectors selectors BaseSelector get_map13411374
Ref: 3af913411374
Ref: library/selectors selectors DefaultSelector13411786
Ref: 3aeb13411786
Ref: library/selectors selectors SelectSelector13412058
Ref: 39b013412058
Ref: library/selectors selectors PollSelector13412173
Ref: dd513412173
Ref: library/selectors selectors EpollSelector13412285
Ref: dd413412285
Ref: library/selectors selectors EpollSelector fileno13412399
Ref: 3afa13412399
Ref: library/selectors selectors DevpollSelector13412572
Ref: dd613412572
Ref: library/selectors selectors DevpollSelector fileno13412690
Ref: 3afb13412690
Ref: library/selectors selectors KqueueSelector13412893
Ref: 39b313412893
Ref: library/selectors selectors KqueueSelector fileno13413009
Ref: 3afc13413009
Ref: クラス<4>-Footnote-113413219
Node: 使用例<29>13413261
Ref: library/selectors examples13413372
Ref: 3afd13413372
Node: signal --- 非同期イベントにハンドラーを設定する13414397
Ref: library/signal doc13414659
Ref: 3afe13414659
Ref: library/signal module-signal13414659
Ref: cb13414659
Ref: library/signal signal-set-handlers-for-asynchronous-events13414659
Ref: 3aff13414659
Ref: library/signal translation-repo13414659
Ref: 3b0013414659
Ref: signal --- 非同期イベントにハンドラーを設定する-Footnote-113415232
Node: 一般的なルール13415298
Ref: library/signal general-rules13415457
Ref: 3b0113415457
Node: Python のシグナルハンドラの実行13416764
Ref: library/signal execution-of-python-signal-handlers13416901
Ref: 3b0313416901
Node: シグナルとスレッド13418282
Ref: library/signal id113418419
Ref: 3b0513418419
Ref: library/signal signals-and-threads13418419
Ref: 3b0613418419
Node: モジュールの内容<3>13419224
Ref: library/signal module-contents13419405
Ref: 3b0713419405
Ref: library/signal signal Signals13420023
Ref: 3b0b13420023
Ref: library/signal signal Handlers13420173
Ref: 3b0c13420173
Ref: library/signal signal Sigmasks13420343
Ref: 3b0d13420343
Ref: library/signal signal SIG_DFL13420752
Ref: 1c0f13420752
Ref: library/signal signal SIG_IGN13421170
Ref: 1c0e13421170
Ref: library/signal signal SIGABRT13421328
Ref: 129213421328
Ref: library/signal signal SIGALRM13421402
Ref: 3b0f13421402
Ref: library/signal signal SIGBREAK13421515
Ref: 3b1013421515
Ref: library/signal signal SIGBUS13421635
Ref: 129313421635
Ref: library/signal signal SIGCHLD13421741
Ref: 317c13421741
Ref: library/signal signal SIGCLD13421854
Ref: 3b1113421854
Ref: library/signal signal SIGCONT13421983
Ref: 318a13421983
Ref: library/signal signal SIGFPE13422107
Ref: 129113422107
Ref: library/signal signal SIGHUP13422343
Ref: 3b1213422343
Ref: library/signal signal SIGILL13422496
Ref: 129413422496
Ref: library/signal signal SIGINT13422553
Ref: 25513422553
Ref: library/signal signal SIGKILL13422688
Ref: d5413422688
Ref: library/signal signal SIGPIPE13422825
Ref: 3b0213422825
Ref: library/signal signal SIGPROF13422991
Ref: 3b1313422991
Ref: library/signal signal SIGQUIT13423092
Ref: 3b0e13423092
Ref: library/signal signal SIGSEGV13423190
Ref: 129013423190
Ref: library/signal signal SIGSTOP13423273
Ref: 3b1413423273
Ref: library/signal signal SIGSTKFLT13423395
Ref: 1c6413423395
Ref: library/signal signal SIGTERM13423740
Ref: 15fd13423740
Ref: library/signal signal SIGUSR113423797
Ref: 3b1513423797
Ref: library/signal signal SIGUSR213423896
Ref: 3b1613423896
Ref: library/signal signal SIGVTALRM13423995
Ref: 3b1713423995
Ref: library/signal signal SIGWINCH13424096
Ref: 3b1813424096
Ref: library/signal signal SIGXCPU13424195
Ref: 3b1913424195
Ref: library/signal signal CTRL_C_EVENT13424864
Ref: 158413424864
Ref: library/signal signal CTRL_BREAK_EVENT13425127
Ref: 158513425127
Ref: library/signal signal NSIG13425398
Ref: 1be913425398
Ref: library/signal signal ITIMER_REAL13425555
Ref: 3b1b13425555
Ref: library/signal signal ITIMER_VIRTUAL13425754
Ref: 3b1c13425754
Ref: library/signal signal ITIMER_PROF13425979
Ref: 3b1d13425979
Ref: library/signal signal SIG_BLOCK13426493
Ref: 3b0813426493
Ref: library/signal signal SIG_UNBLOCK13426698
Ref: 3b0913426698
Ref: library/signal signal SIG_SETMASK13426911
Ref: 3b0a13426911
Ref: library/signal signal ItimerError13427160
Ref: 3b1e13427160
Ref: library/signal signal alarm13427796
Ref: 3b2113427796
Ref: library/signal signal getsignal13428705
Ref: 1a8713428705
Ref: library/signal signal strsignal13429422
Ref: 1e7b13429422
Ref: library/signal signal valid_signals13429725
Ref: 3b1a13429725
Ref: library/signal signal pause13429971
Ref: 3b2213429971
Ref: library/signal signal raise_signal13430427
Ref: 1bed13430427
Ref: library/signal signal pidfd_send_signal13430563
Ref: b2913430563
Ref: library/signal signal pthread_kill13431191
Ref: 134d13431191
Ref: library/signal signal pthread_sigmask13432470
Ref: 134c13432470
Ref: library/signal signal setitimer13434327
Ref: 3b1f13434327
Ref: library/signal signal getitimer13435496
Ref: 3b2013435496
Ref: library/signal signal set_wakeup_fd13435672
Ref: d6b13435672
Ref: library/signal signal siginterrupt13438192
Ref: 135113438192
Ref: library/signal signal signal13438903
Ref: 135013438903
Ref: library/signal signal sigpending13440756
Ref: 134e13440756
Ref: library/signal signal sigwait13441291
Ref: 134f13441291
Ref: library/signal signal sigwaitinfo13441950
Ref: faf13441950
Ref: library/signal signal sigtimedwait13443245
Ref: fae13443245
Ref: モジュールの内容<3>-Footnote-113444045
Ref: モジュールの内容<3>-Footnote-213444096
Ref: モジュールの内容<3>-Footnote-313444151
Ref: モジュールの内容<3>-Footnote-413444196
Ref: モジュールの内容<3>-Footnote-513444241
Ref: モジュールの内容<3>-Footnote-613444287
Ref: モジュールの内容<3>-Footnote-713444333
Ref: モジュールの内容<3>-Footnote-813444379
Ref: モジュールの内容<3>-Footnote-913444424
Ref: モジュールの内容<3>-Footnote-1013444470
Ref: モジュールの内容<3>-Footnote-1113444528
Ref: モジュールの内容<3>-Footnote-1213444581
Ref: モジュールの内容<3>-Footnote-1313444633
Ref: モジュールの内容<3>-Footnote-1413444689
Ref: モジュールの内容<3>-Footnote-1513444742
Ref: モジュールの内容<3>-Footnote-1613444789
Ref: モジュールの内容<3>-Footnote-1713444840
Ref: モジュールの内容<3>-Footnote-1813444888
Ref: モジュールの内容<3>-Footnote-1913444940
Ref: モジュールの内容<3>-Footnote-2013444983
Ref: モジュールの内容<3>-Footnote-2113445036
Node: 使用例<30>13445079
Ref: library/signal examples13445254
Ref: 3b2313445254
Ref: library/signal signal-example13445254
Ref: 3b2413445254
Node: Note on SIGPIPE13446466
Ref: library/signal note-on-sigpipe13446652
Ref: 3b2513446652
Ref: Note on SIGPIPE-Footnote-113448099
Node: Note on Signal Handlers and Exceptions13448143
Ref: library/signal handlers-and-exceptions13448307
Ref: 274313448307
Ref: library/signal note-on-signal-handlers-and-exceptions13448307
Ref: 3b2613448307
Node: mmap --- メモリマップファイルのサポート13450898
Ref: library/mmap doc13451111
Ref: 3b2713451111
Ref: library/mmap mmap-memory-mapped-file-support13451111
Ref: 3b2813451111
Ref: library/mmap module-mmap13451111
Ref: 9413451111
Ref: library/mmap translation-repo13451111
Ref: 3b2913451111
Ref: library/mmap mmap mmap13454873
Ref: 51913454873
Ref: library/mmap mmap mmap close13461304
Ref: 3b2f13461304
Ref: library/mmap mmap mmap closed13461658
Ref: 3b3013461658
Ref: library/mmap mmap mmap find13461797
Ref: 3b3113461797
Ref: library/mmap mmap mmap flush13462385
Ref: c9313462385
Ref: library/mmap mmap mmap madvise13463346
Ref: bff13463346
Ref: library/mmap mmap mmap move13463920
Ref: 3b3313463920
Ref: library/mmap mmap mmap read13464238
Ref: 12f913464238
Ref: library/mmap mmap mmap read_byte13464853
Ref: 3b3413464853
Ref: library/mmap mmap mmap readline13465020
Ref: 3b3513465020
Ref: library/mmap mmap mmap resize13465251
Ref: 3b2e13465251
Ref: library/mmap mmap mmap rfind13466123
Ref: 3b3613466123
Ref: library/mmap mmap mmap seek13466712
Ref: 51b13466712
Ref: library/mmap mmap mmap seekable13467309
Ref: 51a13467309
Ref: library/mmap mmap mmap size13467485
Ref: 3b2d13467485
Ref: library/mmap mmap mmap tell13467630
Ref: 3b3713467630
Ref: library/mmap mmap mmap write13467731
Ref: f4a13467731
Ref: library/mmap mmap mmap write_byte13468635
Ref: 3b3813468635
Node: MADV_* 定数13469061
Ref: library/mmap madv-constants13469186
Ref: 3b3913469186
Ref: library/mmap madvise-constants13469186
Ref: 3b3213469186
Ref: library/mmap mmap MADV_NORMAL13469231
Ref: 3b3a13469231
Ref: library/mmap mmap MADV_RANDOM13469263
Ref: 3b3b13469263
Ref: library/mmap mmap MADV_SEQUENTIAL13469295
Ref: 3b3c13469295
Ref: library/mmap mmap MADV_WILLNEED13469331
Ref: 3b3d13469331
Ref: library/mmap mmap MADV_DONTNEED13469365
Ref: 3b3e13469365
Ref: library/mmap mmap MADV_REMOVE13469399
Ref: 3b3f13469399
Ref: library/mmap mmap MADV_DONTFORK13469431
Ref: 3b4013469431
Ref: library/mmap mmap MADV_DOFORK13469465
Ref: 3b4113469465
Ref: library/mmap mmap MADV_HWPOISON13469497
Ref: 3b4213469497
Ref: library/mmap mmap MADV_MERGEABLE13469531
Ref: 3b4313469531
Ref: library/mmap mmap MADV_UNMERGEABLE13469566
Ref: 3b4413469566
Ref: library/mmap mmap MADV_SOFT_OFFLINE13469603
Ref: 3b4513469603
Ref: library/mmap mmap MADV_HUGEPAGE13469641
Ref: 3b4613469641
Ref: library/mmap mmap MADV_NOHUGEPAGE13469675
Ref: 3b4713469675
Ref: library/mmap mmap MADV_DONTDUMP13469711
Ref: 3b4813469711
Ref: library/mmap mmap MADV_DODUMP13469745
Ref: 3b4913469745
Ref: library/mmap mmap MADV_FREE13469777
Ref: 3b4a13469777
Ref: library/mmap mmap MADV_NOSYNC13469807
Ref: 3b4b13469807
Ref: library/mmap mmap MADV_AUTOSYNC13469839
Ref: 3b4c13469839
Ref: library/mmap mmap MADV_NOCORE13469873
Ref: 3b4d13469873
Ref: library/mmap mmap MADV_CORE13469905
Ref: 3b4e13469905
Ref: library/mmap mmap MADV_PROTECT13469935
Ref: 3b4f13469935
Ref: library/mmap mmap MADV_FREE_REUSABLE13469968
Ref: 3b5013469968
Ref: library/mmap mmap MADV_FREE_REUSE13470007
Ref: 3b5113470007
Node: MAP_* 定数13470252
Ref: library/mmap id113470377
Ref: 3b5213470377
Ref: library/mmap map-constants13470377
Ref: 3b2c13470377
Ref: library/mmap mmap MAP_SHARED13470420
Ref: 3b2b13470420
Ref: library/mmap mmap MAP_PRIVATE13470451
Ref: 3b2a13470451
Ref: library/mmap mmap MAP_32BIT13470483
Ref: 1a7e13470483
Ref: library/mmap mmap MAP_ALIGNED_SUPER13470513
Ref: 1b2813470513
Ref: library/mmap mmap MAP_ANON13470551
Ref: 3b5313470551
Ref: library/mmap mmap MAP_ANONYMOUS13470580
Ref: 3b5413470580
Ref: library/mmap mmap MAP_CONCEAL13470614
Ref: 1b2913470614
Ref: library/mmap mmap MAP_DENYWRITE13470646
Ref: 3b5513470646
Ref: library/mmap mmap MAP_EXECUTABLE13470680
Ref: 3b5613470680
Ref: library/mmap mmap MAP_HASSEMAPHORE13470715
Ref: 1a7913470715
Ref: library/mmap mmap MAP_JIT13470752
Ref: 1a7b13470752
Ref: library/mmap mmap MAP_NOCACHE13470780
Ref: 1a7a13470780
Ref: library/mmap mmap MAP_NOEXTEND13470812
Ref: 1a7813470812
Ref: library/mmap mmap MAP_NORESERVE13470845
Ref: 1a7713470845
Ref: library/mmap mmap MAP_POPULATE13470879
Ref: 1d8d13470879
Ref: library/mmap mmap MAP_RESILIENT_CODESIGN13470912
Ref: 1a7c13470912
Ref: library/mmap mmap MAP_RESILIENT_MEDIA13470955
Ref: 1a7d13470955
Ref: library/mmap mmap MAP_STACK13470995
Ref: 3b5713470995
Ref: library/mmap mmap MAP_TPRO13471025
Ref: 1a8113471025
Ref: library/mmap mmap MAP_TRANSLATED_ALLOW_EXECUTE13471054
Ref: 1a7f13471054
Ref: library/mmap mmap MAP_UNIX0313471103
Ref: 1a8013471103
Node: インターネット上のデータの操作13471935
Ref: library/netdata doc13472147
Ref: 3b5813472147
Ref: library/netdata internet-data-handling13472147
Ref: 3b5913472147
Ref: library/netdata netdata13472147
Ref: 3b5a13472147
Ref: library/netdata translation-repo13472147
Ref: 3b5b13472147
Node: email --- 電子メールと MIME 処理のためのパッケージ13473307
Ref: library/email doc13473515
Ref: 3b5c13473515
Ref: library/email email-an-email-and-mime-handling-package13473515
Ref: 3b5d13473515
Ref: library/email module-email13473515
Ref: 3f13473515
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-113480294
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-213480368
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-313480427
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-413480486
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-513480545
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-613480604
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-713480663
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-813480722
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-913480781
Node: email message Representing an email message13480840
Ref: library/email message doc13481031
Ref: 3b5e13481031
Ref: library/email message email-message-representing-an-email-message13481031
Ref: 3b5f13481031
Ref: library/email message module-email message13481031
Ref: 4813481031
Ref: library/email message email message EmailMessage13483496
Ref: 58013483496
Ref: library/email message email message EmailMessage as_string13483986
Ref: 3b6113483986
Ref: library/email message email message EmailMessage __str__13485934
Ref: 3b6313485934
Ref: library/email message email message EmailMessage as_bytes13486416
Ref: 3b6413486416
Ref: library/email message email message EmailMessage __bytes__13487672
Ref: 3b6513487672
Ref: library/email message email message EmailMessage is_multipart13487854
Ref: 3b6613487854
Ref: library/email message email message EmailMessage set_unixfrom13488514
Ref: 3b6713488514
Ref: library/email message email message EmailMessage get_unixfrom13488740
Ref: 3b6913488740
Ref: library/email message email message EmailMessage __len__13489980
Ref: 3b6b13489980
Ref: library/email message email message EmailMessage __contains__13490102
Ref: 3b6c13490102
Ref: library/email message email message EmailMessage __getitem__13490498
Ref: 3b6d13490498
Ref: library/email message email message EmailMessage __setitem__13491219
Ref: 3b7013491219
Ref: library/email message email message EmailMessage __delitem__13492449
Ref: 3b7113492449
Ref: library/email message email message EmailMessage keys13492737
Ref: 3b6a13492737
Ref: library/email message email message EmailMessage values13492891
Ref: 3b7213492891
Ref: library/email message email message EmailMessage items13493027
Ref: 3b7313493027
Ref: library/email message email message EmailMessage get13493215
Ref: 3b7413493215
Ref: library/email message email message EmailMessage get_all13493569
Ref: 3b6e13493569
Ref: library/email message email message EmailMessage add_header13493903
Ref: 3b7513493903
Ref: library/email message email message EmailMessage replace_header13495988
Ref: 3b7613495988
Ref: library/email message email message EmailMessage get_content_type13496300
Ref: 3b7713496300
Ref: library/email message email message EmailMessage get_content_maintype13497180
Ref: 3b7913497180
Ref: library/email message email message EmailMessage get_content_subtype13497428
Ref: 3b7a13497428
Ref: library/email message email message EmailMessage get_default_type13497705
Ref: 3b7813497705
Ref: library/email message email message EmailMessage set_default_type13498082
Ref: 3b7b13498082
Ref: library/email message email message EmailMessage set_param13498530
Ref: 3b7c13498530
Ref: library/email message email message EmailMessage del_param13500188
Ref: 3b7e13500188
Ref: library/email message email message EmailMessage get_filename13500751
Ref: 3b7f13500751
Ref: library/email message email message EmailMessage get_boundary13501349
Ref: 3b8113501349
Ref: library/email message email message EmailMessage set_boundary13501810
Ref: 3b8213501810
Ref: library/email message email message EmailMessage get_content_charset13502577
Ref: 3b8413502577
Ref: library/email message email message EmailMessage get_charsets13503017
Ref: 3b8513503017
Ref: library/email message email message EmailMessage is_attachment13503900
Ref: 3b8613503900
Ref: library/email message email message EmailMessage get_content_disposition13504369
Ref: 3b8813504369
Ref: library/email message email message EmailMessage walk13504850
Ref: 3b8913504850
Ref: library/email message email message EmailMessage get_body13507084
Ref: 3b8a13507084
Ref: library/email message email message EmailMessage iter_attachments13509212
Ref: 3b8b13509212
Ref: library/email message email message EmailMessage iter_parts13510186
Ref: 3b8c13510186
Ref: library/email message email message EmailMessage get_content13510405
Ref: 3b8d13510405
Ref: library/email message email message EmailMessage set_content13510821
Ref: 1cba13510821
Ref: library/email message email message EmailMessage make_related13511237
Ref: 3b9013511237
Ref: library/email message email message EmailMessage make_alternative13511731
Ref: 3b9113511731
Ref: library/email message email message EmailMessage make_mixed13512256
Ref: 3b9213512256
Ref: library/email message email message EmailMessage add_related13512801
Ref: 3b9313512801
Ref: library/email message email message EmailMessage add_alternative13513564
Ref: 3b9513513564
Ref: library/email message email message EmailMessage add_attachment13514260
Ref: 3b9613514260
Ref: library/email message email message EmailMessage clear13515251
Ref: 3b9713515251
Ref: library/email message email message EmailMessage clear_content13515353
Ref: 3b9813515353
Ref: library/email message email message EmailMessage preamble13515650
Ref: 3b9913515650
Ref: library/email message email message EmailMessage epilogue13517403
Ref: 3b9a13517403
Ref: library/email message email message EmailMessage defects13517749
Ref: 3b9b13517749
Ref: library/email message email message MIMEPart13518105
Ref: 114113518105
Ref: email message Representing an email message-Footnote-113518488
Ref: email message Representing an email message-Footnote-213518561
Ref: email message Representing an email message-Footnote-313518773
Ref: email message Representing an email message-Footnote-413518832
Ref: email message Representing an email message-Footnote-513518891
Ref: email message Representing an email message-Footnote-613518950
Ref: email message Representing an email message-Footnote-713519267
Ref: email message Representing an email message-Footnote-813519326
Ref: email message Representing an email message-Footnote-913519385
Ref: email message Representing an email message-Footnote-1013519444
Ref: email message Representing an email message-Footnote-1113519504
Ref: email message Representing an email message-Footnote-1213519564
Ref: email message Representing an email message-Footnote-1313519624
Ref: email message Representing an email message-Footnote-1413519684
Node: email parser Parsing email messages13519744
Ref: library/email parser doc13519985
Ref: 3b9c13519985
Ref: library/email parser email-parser-parsing-email-messages13519985
Ref: 3b9d13519985
Ref: library/email parser module-email parser13519985
Ref: 5213519985
Ref: library/email parser translation-repo13519985
Ref: 3b9e13519985
Ref: email parser Parsing email messages-Footnote-113522358
Node: FeedParser API13522430
Ref: library/email parser feedparser-api13522535
Ref: 3b9f13522535
Ref: library/email parser email parser BytesFeedParser13524119
Ref: 13e713524119
Ref: library/email parser email parser BytesFeedParser feed13525364
Ref: 3ba013525364
Ref: library/email parser email parser BytesFeedParser close13525915
Ref: 3ba113525915
Ref: library/email parser email parser FeedParser13526161
Ref: 17f513526161
Node: Parser API13526668
Ref: library/email parser parser-api13526794
Ref: 3ba213526794
Ref: library/email parser email parser BytesParser13527501
Ref: 13e813527501
Ref: library/email parser email parser BytesParser parse13528195
Ref: 3ba313528195
Ref: library/email parser email parser BytesParser parsebytes13529291
Ref: 3ba413529291
Ref: library/email parser email parser BytesHeaderParser13529814
Ref: 12d513529814
Ref: library/email parser email parser Parser13530039
Ref: 13b913530039
Ref: library/email parser email parser Parser parse13530414
Ref: 3ba513530414
Ref: library/email parser email parser Parser parsestr13531090
Ref: 3ba613531090
Ref: library/email parser email parser HeaderParser13531676
Ref: 12d613531676
Ref: library/email parser email message_from_bytes13532181
Ref: 13e513532181
Ref: library/email parser email message_from_binary_file13532765
Ref: 13e613532765
Ref: library/email parser email message_from_string13533349
Ref: 3ba713533349
Ref: library/email parser email message_from_file13533833
Ref: 3ba813533833
Ref: Parser API-Footnote-113534698
Ref: Parser API-Footnote-213534757
Node: 追記事項13534816
Ref: library/email parser additional-notes13534919
Ref: 3ba913534919
Node: email generator Generating MIME documents13536690
Ref: library/email generator doc13536915
Ref: 3bab13536915
Ref: library/email generator email-generator-generating-mime-documents13536915
Ref: 3bac13536915
Ref: library/email generator module-email generator13536915
Ref: 4413536915
Ref: library/email generator translation-repo13536915
Ref: 3bad13536915
Ref: library/email generator email generator BytesGenerator13539003
Ref: 13eb13539003
Ref: library/email generator email generator BytesGenerator flatten13540954
Ref: 3baf13540954
Ref: library/email generator email generator BytesGenerator clone13542871
Ref: 3bb213542871
Ref: library/email generator email generator BytesGenerator write13543069
Ref: 3bb013543069
Ref: library/email generator email generator Generator13544095
Ref: 13ea13544095
Ref: library/email generator email generator Generator flatten13545984
Ref: 3bb313545984
Ref: library/email generator email generator Generator clone13547892
Ref: 3bb513547892
Ref: library/email generator email generator Generator write13548067
Ref: 3bb413548067
Ref: library/email generator email generator DecodedGenerator13548965
Ref: e9913548965
Ref: email generator Generating MIME documents-Footnote-113550429
Ref: email generator Generating MIME documents-Footnote-213550505
Ref: email generator Generating MIME documents-Footnote-313551012
Ref: email generator Generating MIME documents-Footnote-413551064
Ref: email generator Generating MIME documents-Footnote-513551123
Ref: email generator Generating MIME documents-Footnote-613551175
Node: email policy Policy Objects13551234
Ref: library/email policy doc13551465
Ref: 3bb613551465
Ref: library/email policy email-policy-policy-objects13551465
Ref: 3bb713551465
Ref: library/email policy module-email policy13551465
Ref: 5313551465
Ref: library/email policy translation-repo13551465
Ref: 3bb813551465
Ref: library/email policy email policy Policy13557821
Ref: 12cb13557821
Ref: library/email policy email policy Policy max_line_length13558648
Ref: 3b6213558648
Ref: library/email policy email policy Policy linesep13559035
Ref: 3bb913559035
Ref: library/email policy email policy Policy cte_type13559302
Ref: 3bb113559302
Ref: library/email policy email policy Policy raise_on_defect13560409
Ref: 3bbb13560409
Ref: library/email policy email policy Policy mangle_from_13560653
Ref: ffb13560653
Ref: library/email policy email policy Policy message_factory13560978
Ref: e9a13560978
Ref: library/email policy email policy Policy verify_generated_headers13561255
Ref: 4f213561255
Ref: library/email policy email policy Policy clone13562094
Ref: 12cd13562094
Ref: library/email policy email policy Policy handle_defect13562562
Ref: 3bbe13562562
Ref: library/email policy email policy Policy register_defect13563060
Ref: 3bbc13563060
Ref: library/email policy email policy Policy header_max_count13563772
Ref: 3bc013563772
Ref: library/email policy email policy Policy header_source_parse13564856
Ref: 3bc113564856
Ref: library/email policy email policy Policy header_store_parse13565951
Ref: 3bc213565951
Ref: library/email policy email policy Policy header_fetch_parse13566729
Ref: 3bc313566729
Ref: library/email policy email policy Policy fold13567663
Ref: 3bc413567663
Ref: library/email policy email policy Policy fold_binary13568480
Ref: 3bba13568480
Ref: library/email policy email policy EmailPolicy13568926
Ref: 12cf13568926
Ref: library/email policy email policy EmailPolicy utf813569763
Ref: ffd13569763
Ref: library/email policy email policy EmailPolicy refold_source13570155
Ref: 3bae13570155
Ref: library/email policy email policy EmailPolicy header_factory13570963
Ref: 3bc513570963
Ref: library/email policy email policy EmailPolicy content_manager13571574
Ref: 114013571574
Ref: library/email policy email policy EmailPolicy header_max_count13572276
Ref: 3bc713572276
Ref: library/email policy email policy EmailPolicy header_source_parse13572488
Ref: 197213572488
Ref: library/email policy email policy EmailPolicy header_store_parse13572875
Ref: 3bc913572875
Ref: library/email policy email policy EmailPolicy header_fetch_parse13573362
Ref: 3bca13573362
Ref: library/email policy email policy EmailPolicy fold13573794
Ref: 1a5213573794
Ref: library/email policy email policy EmailPolicy fold_binary13574959
Ref: 3bcb13574959
Ref: library/email policy email policy default13575807
Ref: 12d013575807
Ref: library/email policy email policy SMTP13576066
Ref: 12d113576066
Ref: library/email policy email policy SMTPUTF813576273
Ref: 3bcc13576273
Ref: library/email policy email policy HTTP13576693
Ref: 3bcd13576693
Ref: library/email policy email policy strict13576890
Ref: 3bce13576890
Ref: library/email policy email policy Compat3213578294
Ref: 12cc13578294
Ref: library/email policy email policy Compat32 mangle_from_13578817
Ref: 3bcf13578817
Ref: library/email policy email policy Compat32 header_source_parse13579009
Ref: 197313579009
Ref: library/email policy email policy Compat32 header_store_parse13579396
Ref: 3bd013579396
Ref: library/email policy email policy Compat32 header_fetch_parse13579516
Ref: 3bd113579516
Ref: library/email policy email policy Compat32 fold13579764
Ref: 3bd213579764
Ref: library/email policy email policy Compat32 fold_binary13580113
Ref: 3bd313580113
Ref: library/email policy email policy compat3213580649
Ref: e9b13580649
Ref: email policy Policy Objects-Footnote-113581132
Ref: email policy Policy Objects-Footnote-213581204
Ref: email policy Policy Objects-Footnote-313581263
Ref: email policy Policy Objects-Footnote-413581322
Ref: email policy Policy Objects-Footnote-513581381
Ref: email policy Policy Objects-Footnote-613581440
Ref: email policy Policy Objects-Footnote-713581499
Ref: email policy Policy Objects-Footnote-813581558
Ref: email policy Policy Objects-Footnote-913581628
Ref: email policy Policy Objects-Footnote-1013581687
Ref: email policy Policy Objects-Footnote-1113581747
Ref: email policy Policy Objects-Footnote-1213581807
Node: email errors Exception and Defect classes13581867
Ref: library/email errors doc13582099
Ref: 3bd413582099
Ref: library/email errors email-errors-exception-and-defect-classes13582099
Ref: 3bd513582099
Ref: library/email errors module-email errors13582099
Ref: 4313582099
Ref: library/email errors translation-repo13582099
Ref: 3bd613582099
Ref: library/email errors email errors MessageError13582405
Ref: 3bd713582405
Ref: library/email errors email errors MessageParseError13582699
Ref: 3bd813582699
Ref: library/email errors email errors HeaderParseError13582973
Ref: 3b8313582973
Ref: library/email errors email errors BoundaryError13583613
Ref: 3bd913583613
Ref: library/email errors email errors MultipartConversionError13583690
Ref: 3bda13583690
Ref: library/email errors email errors HeaderWriteError13584041
Ref: 3bbd13584041
Ref: library/email errors email errors MessageDefect13584170
Ref: 3bbf13584170
Ref: library/email errors email errors HeaderDefect13584338
Ref: 3bdd13584338
Ref: library/email errors email errors NoBoundaryInMultipartDefect13585123
Ref: 3bde13585123
Ref: library/email errors email errors StartBoundaryNotFoundDefect13585262
Ref: 3bdf13585262
Ref: library/email errors email errors CloseBoundaryNotFoundDefect13585404
Ref: 3be013585404
Ref: library/email errors email errors FirstHeaderLineIsContinuationDefect13585577
Ref: 3be113585577
Ref: library/email errors email errors MisplacedEnvelopeHeaderDefect13585707
Ref: 3be213585707
Ref: library/email errors email errors MissingHeaderBodySeparatorDefect13585833
Ref: 3be313585833
Ref: library/email errors email errors MalformedHeaderDefect13586110
Ref: 3be413586110
Ref: library/email errors email errors MultipartInvariantViolationDefect13586376
Ref: 3baa13586376
Ref: library/email errors email errors InvalidBase64PaddingDefect13586691
Ref: 3be513586691
Ref: library/email errors email errors InvalidBase64CharactersDefect13586932
Ref: 3be613586932
Ref: library/email errors email errors InvalidBase64LengthDefect13587185
Ref: 3be713587185
Ref: library/email errors email errors InvalidDateDefect13587422
Ref: 3be813587422
Ref: email errors Exception and Defect classes-Footnote-113587599
Ref: email errors Exception and Defect classes-Footnote-213587671
Node: email headerregistry Custom Header Objects13587730
Ref: library/email headerregistry doc13587977
Ref: 3be913587977
Ref: library/email headerregistry email-headerregistry-custom-header-objects13587977
Ref: 3bea13587977
Ref: library/email headerregistry module-email headerregistry13587977
Ref: 4613587977
Ref: library/email headerregistry translation-repo13587977
Ref: 3beb13587977
Ref: library/email headerregistry email headerregistry BaseHeader13590426
Ref: 3b6f13590426
Ref: library/email headerregistry email headerregistry BaseHeader name13590821
Ref: 3bee13590821
Ref: library/email headerregistry email headerregistry BaseHeader defects13591104
Ref: 3bef13591104
Ref: library/email headerregistry email headerregistry BaseHeader max_count13591595
Ref: 3bc813591595
Ref: library/email headerregistry email headerregistry BaseHeader fold13592263
Ref: 3bf013592263
Ref: library/email headerregistry email headerregistry UnstructuredHeader13594942
Ref: 3bed13594942
Ref: library/email headerregistry email headerregistry DateHeader13596401
Ref: 3bf113596401
Ref: library/email headerregistry email headerregistry DateHeader datetime13596763
Ref: 3bf213596763
Ref: library/email headerregistry email headerregistry AddressHeader13598514
Ref: 3bf313598514
Ref: library/email headerregistry email headerregistry AddressHeader groups13598871
Ref: 3bf413598871
Ref: library/email headerregistry email headerregistry AddressHeader addresses13599272
Ref: 3bf713599272
Ref: library/email headerregistry email headerregistry SingleAddressHeader13600527
Ref: 3bf913600527
Ref: library/email headerregistry email headerregistry SingleAddressHeader address13600676
Ref: 3bfa13600676
Ref: library/email headerregistry email headerregistry MIMEVersionHeader13601208
Ref: 3bfb13601208
Ref: library/email headerregistry email headerregistry MIMEVersionHeader version13601604
Ref: 3bfc13601604
Ref: library/email headerregistry email headerregistry MIMEVersionHeader major13601723
Ref: 3bfd13601723
Ref: library/email headerregistry email headerregistry MIMEVersionHeader minor13601804
Ref: 3bfe13601804
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader13601885
Ref: 3bff13601885
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader params13602268
Ref: 3b7d13602268
Ref: library/email headerregistry email headerregistry ContentTypeHeader13602365
Ref: 3c0013602365
Ref: library/email headerregistry email headerregistry ContentTypeHeader content_type13602526
Ref: 3c0113602526
Ref: library/email headerregistry email headerregistry ContentTypeHeader maintype13602632
Ref: 3c0213602632
Ref: library/email headerregistry email headerregistry ContentTypeHeader subtype13602662
Ref: 3c0313602662
Ref: library/email headerregistry email headerregistry ContentDispositionHeader13602691
Ref: 3c0413602691
Ref: library/email headerregistry email headerregistry ContentDispositionHeader content_disposition13602865
Ref: 3c0513602865
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader13603002
Ref: 3c0613603002
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader cte13603135
Ref: 3c0713603135
Ref: library/email headerregistry email headerregistry HeaderRegistry13603337
Ref: 3bec13603337
Ref: library/email headerregistry email headerregistry HeaderRegistry map_to_type13605098
Ref: 3c0813605098
Ref: library/email headerregistry email headerregistry HeaderRegistry __getitem__13605439
Ref: 3c0913605439
Ref: library/email headerregistry email headerregistry HeaderRegistry __call__13605568
Ref: 3c0a13605568
Ref: library/email headerregistry email headerregistry Address13606214
Ref: 3bf813606214
Ref: library/email headerregistry email headerregistry Address display_name13607105
Ref: 3c0b13607105
Ref: library/email headerregistry email headerregistry Address username13607331
Ref: 3c0c13607331
Ref: library/email headerregistry email headerregistry Address domain13607452
Ref: 3c0d13607452
Ref: library/email headerregistry email headerregistry Address addr_spec13607530
Ref: 3c0e13607530
Ref: library/email headerregistry email headerregistry Address __str__13607748
Ref: 3c0f13607748
Ref: library/email headerregistry email headerregistry Group13608193
Ref: 3bf513608193
Ref: library/email headerregistry email headerregistry Group display_name13608784
Ref: 3bf613608784
Ref: library/email headerregistry email headerregistry Group addresses13609039
Ref: 3c1013609039
Ref: library/email headerregistry email headerregistry Group __str__13609187
Ref: 3c1113609187
Ref: email headerregistry Custom Header Objects-Footnote-113609646
Ref: email headerregistry Custom Header Objects-Footnote-213609727
Ref: email headerregistry Custom Header Objects-Footnote-313609796
Ref: email headerregistry Custom Header Objects-Footnote-413609855
Ref: email headerregistry Custom Header Objects-Footnote-513609914
Ref: email headerregistry Custom Header Objects-Footnote-613609973
Ref: email headerregistry Custom Header Objects-Footnote-713610032
Ref: email headerregistry Custom Header Objects-Footnote-813610091
Ref: email headerregistry Custom Header Objects-Footnote-913610150
Ref: email headerregistry Custom Header Objects-Footnote-1013610209
Ref: email headerregistry Custom Header Objects-Footnote-1113610269
Ref: email headerregistry Custom Header Objects-Footnote-1213610329
Ref: email headerregistry Custom Header Objects-Footnote-1313610389
Ref: email headerregistry Custom Header Objects-Footnote-1413610449
Ref: email headerregistry Custom Header Objects-Footnote-1513610509
Ref: email headerregistry Custom Header Objects-Footnote-1613610569
Ref: email headerregistry Custom Header Objects-Footnote-1713610629
Node: email contentmanager Managing MIME Content13610689
Ref: library/email contentmanager doc13610910
Ref: 3c1213610910
Ref: library/email contentmanager email-contentmanager-managing-mime-content13610910
Ref: 3c1313610910
Ref: library/email contentmanager module-email contentmanager13610910
Ref: 4113610910
Ref: library/email contentmanager translation-repo13610910
Ref: 3c1413610910
Ref: library/email contentmanager email contentmanager ContentManager13611176
Ref: 3c1513611176
Ref: library/email contentmanager email contentmanager ContentManager get_content13611469
Ref: 3b8e13611469
Ref: library/email contentmanager email contentmanager ContentManager set_content13612278
Ref: 3b8f13612278
Ref: library/email contentmanager email contentmanager ContentManager add_get_handler13613895
Ref: 3c1613613895
Ref: library/email contentmanager email contentmanager ContentManager add_set_handler13614093
Ref: 3c1813614093
Ref: email contentmanager Managing MIME Content-Footnote-113614458
Ref: email contentmanager Managing MIME Content-Footnote-213614539
Node: Content Manager Instances13614608
Ref: library/email contentmanager content-manager-instances13614712
Ref: 3c1a13614712
Ref: library/email contentmanager email contentmanager raw_data_manager13615047
Ref: 3bc613615047
Ref: library/email contentmanager email contentmanager get_content13615776
Ref: 3c1713615776
Ref: library/email contentmanager email contentmanager set_content13616381
Ref: 3c1913616381
Ref: Content Manager Instances-Footnote-113621196
Node: email 使用例13621255
Ref: library/email examples doc13621523
Ref: 3c1b13621523
Ref: library/email examples email-examples13621523
Ref: 114213621523
Ref: library/email examples id113621523
Ref: 3c1c13621523
Ref: library/email examples translation-repo13621523
Ref: 3c1d13621523
Ref: email 使用例-Footnote-113636641
Ref: email 使用例-Footnote-213636699
Node: email message Message compat32 API を使用した電子メールメッセージの表現13636784
Ref: library/email compat32-message doc13637065
Ref: 3c1e13637065
Ref: library/email compat32-message compat32-message13637065
Ref: 3b6013637065
Ref: library/email compat32-message email-message-message-representing-an-email-message-using-the-compat32-api13637065
Ref: 3c1f13637065
Ref: library/email compat32-message translation-repo13637065
Ref: 3c2013637065
Ref: library/email compat32-message email message Message13639639
Ref: 58113639639
Ref: library/email compat32-message email message Message as_string13640196
Ref: 113c13640196
Ref: library/email compat32-message email message Message __str__13642476
Ref: 3c2113642476
Ref: library/email compat32-message email message Message as_bytes13642648
Ref: 113d13642648
Ref: library/email compat32-message email message Message __bytes__13644299
Ref: 113e13644299
Ref: library/email compat32-message email message Message is_multipart13644513
Ref: 3b8713644513
Ref: library/email compat32-message email message Message set_unixfrom13645165
Ref: 3c2213645165
Ref: library/email compat32-message email message Message get_unixfrom13645368
Ref: 3c2313645368
Ref: library/email compat32-message email message Message attach13645590
Ref: 3b9413645590
Ref: library/email compat32-message email message Message get_payload13646411
Ref: 13e913646411
Ref: library/email compat32-message email message Message set_payload13649294
Ref: 3c2413649294
Ref: library/email compat32-message email message Message set_charset13649889
Ref: 3c2513649889
Ref: library/email compat32-message email message Message get_charset13651939
Ref: 3c2613651939
Ref: library/email compat32-message email message Message __len__13653741
Ref: 3c2813653741
Ref: library/email compat32-message email message Message __contains__13653863
Ref: 1b5313653863
Ref: library/email compat32-message email message Message __getitem__13654409
Ref: 3c2913654409
Ref: library/email compat32-message email message Message __setitem__13655099
Ref: 18e113655099
Ref: library/email compat32-message email message Message __delitem__13655854
Ref: 3c2b13655854
Ref: library/email compat32-message email message Message keys13656142
Ref: 3c2713656142
Ref: library/email compat32-message email message Message values13656296
Ref: 3c2c13656296
Ref: library/email compat32-message email message Message items13656432
Ref: 3c2d13656432
Ref: library/email compat32-message email message Message get13656620
Ref: 3c2e13656620
Ref: library/email compat32-message email message Message get_all13656966
Ref: 3c2a13656966
Ref: library/email compat32-message email message Message add_header13657300
Ref: 18e213657300
Ref: library/email compat32-message email message Message replace_header13659737
Ref: 3c2f13659737
Ref: library/email compat32-message email message Message get_content_type13660125
Ref: 3c3013660125
Ref: library/email compat32-message email message Message get_content_maintype13661390
Ref: 3c3213661390
Ref: library/email compat32-message email message Message get_content_subtype13661638
Ref: 3c3313661638
Ref: library/email compat32-message email message Message get_default_type13661915
Ref: 3c3113661915
Ref: library/email compat32-message email message Message set_default_type13662292
Ref: 3c3413662292
Ref: library/email compat32-message email message Message get_params13662664
Ref: 3c3513662664
Ref: library/email compat32-message email message Message get_param13664019
Ref: 3c3613664019
Ref: library/email compat32-message email message Message set_param13666573
Ref: 113f13666573
Ref: library/email compat32-message email message Message del_param13668228
Ref: 3c3813668228
Ref: library/email compat32-message email message Message set_type13668853
Ref: 3c3913668853
Ref: library/email compat32-message email message Message get_filename13670029
Ref: 3c3a13670029
Ref: library/email compat32-message email message Message get_boundary13670627
Ref: 3c3b13670627
Ref: library/email compat32-message email message Message set_boundary13671088
Ref: 3c3c13671088
Ref: library/email compat32-message email message Message get_content_charset13672054
Ref: 3c3d13672054
Ref: library/email compat32-message email message Message get_charsets13672800
Ref: 3c3e13672800
Ref: library/email compat32-message email message Message get_content_disposition13673695
Ref: ffc13673695
Ref: library/email compat32-message email message Message walk13674064
Ref: 3c3f13674064
Ref: library/email compat32-message email message Message preamble13676506
Ref: 3c4013676506
Ref: library/email compat32-message email message Message epilogue13678259
Ref: 3c4113678259
Ref: library/email compat32-message email message Message defects13678683
Ref: 3c4213678683
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-113679075
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-213679134
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-313679193
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-413679252
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-513679311
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-613679370
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-713679429
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-813679488
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-913679547
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1013679606
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1113679666
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1213679726
Node: email mime Creating email and MIME objects from scratch13679786
Ref: library/email mime doc13680095
Ref: 3c4313680095
Ref: library/email mime email-mime-creating-email-and-mime-objects-from-scratch13680095
Ref: 3c4413680095
Ref: library/email mime module-email mime13680095
Ref: 4913680095
Ref: library/email mime translation-repo13680095
Ref: 3c4513680095
Ref: library/email mime module-email mime base13681939
Ref: 4c13681939
Ref: library/email mime email mime base MIMEBase13681939
Ref: 3c4613681939
Ref: library/email mime module-email mime nonmultipart13683401
Ref: 5013683401
Ref: library/email mime email mime nonmultipart MIMENonMultipart13683401
Ref: 3bdb13683401
Ref: library/email mime module-email mime multipart13684029
Ref: 4f13684029
Ref: library/email mime email mime multipart MIMEMultipart13684029
Ref: 3c4713684029
Ref: library/email mime module-email mime application13685827
Ref: 4a13685827
Ref: library/email mime email mime application MIMEApplication13685827
Ref: 3c4813685827
Ref: library/email mime module-email mime audio13687470
Ref: 4b13687470
Ref: library/email mime email mime audio MIMEAudio13687470
Ref: 3c4913687470
Ref: library/email mime module-email mime image13689339
Ref: 4d13689339
Ref: library/email mime email mime image MIMEImage13689339
Ref: 3bdc13689339
Ref: library/email mime module-email mime message13691261
Ref: 4e13691261
Ref: library/email mime email mime message MIMEMessage13691261
Ref: 3c4a13691261
Ref: library/email mime module-email mime text13692299
Ref: 5113692299
Ref: library/email mime email mime text MIMEText13692299
Ref: ffe13692299
Ref: email mime Creating email and MIME objects from scratch-Footnote-113694426
Node: email header 国際化されたヘッダー13694494
Ref: library/email header doc13694749
Ref: 3c4b13694749
Ref: library/email header email-header-internationalized-headers13694749
Ref: 3c4c13694749
Ref: library/email header module-email header13694749
Ref: 4513694749
Ref: library/email header translation-repo13694749
Ref: 3c4d13694749
Ref: library/email header email header Header13697864
Ref: 1cbb13697864
Ref: library/email header email header Header append13700281
Ref: 3c4e13700281
Ref: library/email header email header Header encode13702009
Ref: 3c4f13702009
Ref: library/email header email header Header __str__13704005
Ref: 3c5013704005
Ref: library/email header email header Header __eq__13704604
Ref: 3c5113704604
Ref: library/email header email header Header __ne__13704807
Ref: 3c5213704807
Ref: library/email header email header decode_header13705103
Ref: 12d213705103
Ref: library/email header email header make_header13706603
Ref: 12d313706603
Ref: email header 国際化されたヘッダー-Footnote-113707641
Ref: email header 国際化されたヘッダー-Footnote-213707713
Ref: email header 国際化されたヘッダー-Footnote-313707772
Ref: email header 国際化されたヘッダー-Footnote-413707830
Ref: email header 国際化されたヘッダー-Footnote-513707889
Ref: email header 国際化されたヘッダー-Footnote-613707948
Ref: email header 国際化されたヘッダー-Footnote-713708007
Ref: email header 国際化されたヘッダー-Footnote-813708066
Ref: email header 国際化されたヘッダー-Footnote-913708125
Ref: email header 国際化されたヘッダー-Footnote-1013708184
Ref: email header 国際化されたヘッダー-Footnote-1113708244
Ref: email header 国際化されたヘッダー-Footnote-1213708304
Ref: email header 国際化されたヘッダー-Footnote-1313708364
Ref: email header 国際化されたヘッダー-Footnote-1413708424
Ref: email header 国際化されたヘッダー-Footnote-1513708484
Node: email charset 文字集合の表現13708544
Ref: library/email charset doc13708777
Ref: 3c5313708777
Ref: library/email charset email-charset-representing-character-sets13708777
Ref: 3c5413708777
Ref: library/email charset module-email charset13708777
Ref: 4013708777
Ref: library/email charset translation-repo13708777
Ref: 3c5513708777
Ref: library/email charset email charset Charset13709696
Ref: fff13709696
Ref: library/email charset email charset Charset input_charset13711765
Ref: 3c5613711765
Ref: library/email charset email charset Charset header_encoding13712102
Ref: 3c5713712102
Ref: library/email charset email charset Charset body_encoding13712649
Ref: 3c5813712649
Ref: library/email charset email charset Charset output_charset13713026
Ref: 3c5913713026
Ref: library/email charset email charset Charset input_codec13713528
Ref: 3c5a13713528
Ref: library/email charset email charset Charset output_codec13713780
Ref: 3c5b13713780
Ref: library/email charset email charset Charset get_body_encoding13714220
Ref: 3c5c13714220
Ref: library/email charset email charset Charset get_output_charset13715198
Ref: 3c5d13715198
Ref: library/email charset email charset Charset header_encode13715482
Ref: 3c5e13715482
Ref: library/email charset email charset Charset header_encode_lines13715749
Ref: 3c5f13715749
Ref: library/email charset email charset Charset body_encode13716328
Ref: 3c6013716328
Ref: library/email charset email charset Charset __str__13716759
Ref: 3c6113716759
Ref: library/email charset email charset Charset __eq__13716972
Ref: 3c6213716972
Ref: library/email charset email charset Charset __ne__13717167
Ref: 3c6313717167
Ref: library/email charset email charset add_charset13717516
Ref: 3c6413717516
Ref: library/email charset email charset add_alias13719414
Ref: 3c6613719414
Ref: library/email charset email charset add_codec13719896
Ref: 3c6513719896
Ref: email charset 文字集合の表現-Footnote-113720322
Node: email encoders エンコーダー13720395
Ref: library/email encoders doc13720620
Ref: 3c6713720620
Ref: library/email encoders email-encoders-encoders13720620
Ref: 3c6813720620
Ref: library/email encoders module-email encoders13720620
Ref: 4213720620
Ref: library/email encoders translation-repo13720620
Ref: 3c6913720620
Ref: library/email encoders email encoders encode_quopri13722666
Ref: 3c6a13722666
Ref: library/email encoders email encoders encode_base6413723120
Ref: 3c6b13723120
Ref: library/email encoders email encoders encode_7or8bit13723687
Ref: 3c6c13723687
Ref: library/email encoders email encoders encode_noop13723977
Ref: 3c6d13723977
Ref: email encoders エンコーダー-Footnote-113724208
Ref: email encoders エンコーダー-Footnote-213724282
Node: email utils Miscellaneous utilities13724443
Ref: library/email utils doc13724664
Ref: 3c6e13724664
Ref: library/email utils email-utils-miscellaneous-utilities13724664
Ref: 3c6f13724664
Ref: library/email utils module-email utils13724664
Ref: 5413724664
Ref: library/email utils translation-repo13724664
Ref: 3c7013724664
Ref: library/email utils email utils localtime13724962
Ref: 2f913724962
Ref: library/email utils email utils make_msgid13725519
Ref: 3c7113725519
Ref: library/email utils email utils quote13726444
Ref: 3c7213726444
Ref: library/email utils email utils unquote13726736
Ref: 3b8013726736
Ref: library/email utils email utils parseaddr13727106
Ref: 4f413727106
Ref: library/email utils email utils formataddr13727729
Ref: 13b613727729
Ref: library/email utils email utils getaddresses13728475
Ref: 4f313728475
Ref: library/email utils email utils parsedate13729327
Ref: 3c7313729327
Ref: library/email utils email utils parsedate_tz13730122
Ref: 1c8013730122
Ref: library/email utils email utils parsedate_to_datetime13730701
Ref: 12d813730701
Ref: library/email utils email utils mktime_tz13731584
Ref: 3c7413731584
Ref: library/email utils email utils formatdate13731915
Ref: 168813731915
Ref: library/email utils email utils format_datetime13733071
Ref: 12d713733071
Ref: library/email utils email utils decode_rfc223113733758
Ref: 3c7513733758
Ref: library/email utils email utils encode_rfc223113733877
Ref: 3c7613733877
Ref: library/email utils email utils collapse_rfc2231_value13734469
Ref: 3c3713734469
Ref: library/email utils email utils decode_params13735808
Ref: 188a13735808
Ref: email utils Miscellaneous utilities-Footnote-113736087
Ref: email utils Miscellaneous utilities-Footnote-213736158
Ref: email utils Miscellaneous utilities-Footnote-313736217
Ref: email utils Miscellaneous utilities-Footnote-413736276
Ref: email utils Miscellaneous utilities-Footnote-513736335
Ref: email utils Miscellaneous utilities-Footnote-613736394
Ref: email utils Miscellaneous utilities-Footnote-713736700
Ref: email utils Miscellaneous utilities-Footnote-813736759
Ref: email utils Miscellaneous utilities-Footnote-913736818
Ref: email utils Miscellaneous utilities-Footnote-1013736877
Ref: email utils Miscellaneous utilities-Footnote-1113736937
Ref: email utils Miscellaneous utilities-Footnote-1213736997
Node: email iterators イテレータ13737057
Ref: library/email iterators doc13737236
Ref: 3c7713737236
Ref: library/email iterators email-iterators-iterators13737236
Ref: 3c7813737236
Ref: library/email iterators module-email iterators13737236
Ref: 4713737236
Ref: library/email iterators translation-repo13737236
Ref: 3c7913737236
Ref: library/email iterators email iterators body_line_iterator13737645
Ref: 3c7a13737645
Ref: library/email iterators email iterators typed_subpart_iterator13738420
Ref: 3c7b13738420
Ref: library/email iterators email iterators _structure13739430
Ref: 3c7c13739430
Ref: email iterators イテレータ-Footnote-113741060
Node: json --- JSON エンコーダーとデコーダー13741136
Ref: library/json doc13741419
Ref: 3c7d13741419
Ref: library/json json-json-encoder-and-decoder13741419
Ref: 3c7e13741419
Ref: library/json module-json13741419
Ref: 8613741419
Ref: library/json translation-repo13741419
Ref: 3c7f13741419
Ref: json --- JSON エンコーダーとデコーダー-Footnote-113746760
Ref: json --- JSON エンコーダーとデコーダー-Footnote-213746833
Ref: json --- JSON エンコーダーとデコーダー-Footnote-313746858
Ref: json --- JSON エンコーダーとデコーダー-Footnote-413746917
Ref: json --- JSON エンコーダーとデコーダー-Footnote-513746976
Ref: json --- JSON エンコーダーとデコーダー-Footnote-613747063
Ref: json --- JSON エンコーダーとデコーダー-Footnote-713747112
Ref: json --- JSON エンコーダーとデコーダー-Footnote-813747416
Node: 基本的な使い方<4>13747442
Ref: library/json basic-usage13747592
Ref: 3c8013747592
Ref: library/json json dump13747648
Ref: f4413747648
Ref: library/json json dumps13752253
Ref: f4513752253
Ref: library/json json load13753201
Ref: eb613753201
Ref: library/json json loads13757059
Ref: b5213757059
Ref: 基本的な使い方<4>-Footnote-113757876
Node: エンコーダとデコーダ13757908
Ref: library/json encoders-and-decoders13758077
Ref: 3c8413758077
Ref: library/json json JSONDecoder13758148
Ref: f4713758148
Ref: library/json json-to-py-table13758439
Ref: 3c8313758439
Ref: library/json json JSONDecoder decode13761628
Ref: 3c8513761628
Ref: library/json json JSONDecoder raw_decode13761927
Ref: 3c8613761927
Ref: library/json json JSONEncoder13762388
Ref: f4613762388
Ref: library/json py-to-json-table13762742
Ref: 3c8113762742
Ref: library/json json JSONEncoder default13768392
Ref: 3c8213768392
Ref: library/json json JSONEncoder encode13769192
Ref: 3c8713769192
Ref: library/json json JSONEncoder iterencode13769433
Ref: 3c8813769433
Ref: エンコーダとデコーダ-Footnote-113769773
Node: 例外<20>13769805
Ref: library/json exceptions13769980
Ref: 3c8913769980
Ref: library/json json JSONDecodeError13770011
Ref: 102613770011
Ref: library/json json JSONDecodeError msg13770155
Ref: 3c8a13770155
Ref: library/json json JSONDecodeError doc13770261
Ref: 3c8b13770261
Ref: library/json json JSONDecodeError pos13770346
Ref: 3c8c13770346
Ref: library/json json JSONDecodeError lineno13770446
Ref: 3c8d13770446
Ref: library/json json JSONDecodeError colno13770519
Ref: 3c8e13770519
Node: 標準への準拠と互換性13770619
Ref: library/json standard-compliance-and-interoperability13770815
Ref: 3c8f13770815
Ref: 標準への準拠と互換性-Footnote-113772130
Ref: 標準への準拠と互換性-Footnote-213772189
Node: 文字エンコーディング13772276
Ref: library/json character-encodings13772411
Ref: 3c9013772411
Node: 無限および NaN の数値13774135
Ref: library/json infinite-and-nan-number-values13774330
Ref: 3c9113774330
Node: オブジェクト中に重複した名前の扱い13775241
Ref: library/json repeated-names-within-an-object13775475
Ref: 3c9213775475
Node: トップレベルの非オブジェクト、非配列の値の扱い13776162
Ref: library/json top-level-non-object-non-array-values13776382
Ref: 3c9313776382
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-113777358
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-213777417
Node: 実装の制限13777476
Ref: library/json implementation-limitations13777636
Ref: 3c9413777636
Node: コマンドライン・インターフェース<5>13778799
Ref: library/json command-line-interface13778976
Ref: 3c9513778976
Ref: library/json json-commandline13778976
Ref: 24013778976
Ref: library/json module-json tool13778976
Ref: 8713778976
Ref: コマンドライン・インターフェース<5>-Footnote-113780321
Node: コマンドラインオプション<4>13780390
Ref: library/json command-line-options13780517
Ref: 3c9713780517
Ref: library/json cmdoption-json-arg-infile13780600
Ref: 3c9813780600
Ref: library/json cmdoption-json-arg-outfile13781145
Ref: 3c9913781145
Ref: library/json cmdoption-json-sort-keys13781306
Ref: 3c9613781306
Ref: library/json cmdoption-json-no-ensure-ascii13781444
Ref: 3c9a13781444
Ref: library/json cmdoption-json-json-lines13781647
Ref: 3c9b13781647
Ref: library/json cmdoption-json-indent13781794
Ref: 3c9c13781794
Ref: library/json cmdoption-json-tab13781794
Ref: 3c9d13781794
Ref: library/json cmdoption-json-no-indent13781794
Ref: 3c9e13781794
Ref: library/json cmdoption-json-compact13781794
Ref: 3c9f13781794
Ref: library/json cmdoption-json-h13781945
Ref: 3ca013781945
Ref: library/json cmdoption-json-help13781945
Ref: 3ca113781945
Node: mailbox --- 様々な形式のメールボックスを操作する13782031
Ref: library/mailbox doc13782312
Ref: 3ca213782312
Ref: library/mailbox mailbox-manipulate-mailboxes-in-various-formats13782312
Ref: 3ca313782312
Ref: library/mailbox module-mailbox13782312
Ref: 8f13782312
Ref: library/mailbox translation-repo13782312
Ref: 3ca413782312
Ref: mailbox --- 様々な形式のメールボックスを操作する-Footnote-113783420
Node: Mailbox オブジェクト13783487
Ref: library/mailbox id113783651
Ref: 3ca513783651
Ref: library/mailbox mailbox-objects13783651
Ref: 3ca613783651
Ref: library/mailbox mailbox Mailbox13783726
Ref: 146713783726
Ref: library/mailbox mailbox Mailbox add13787593
Ref: 146813787593
Ref: library/mailbox mailbox Mailbox remove13788628
Ref: 3ca713788628
Ref: library/mailbox mailbox Mailbox __delitem__13788664
Ref: 3cab13788664
Ref: library/mailbox mailbox Mailbox discard13788705
Ref: 3ca813788705
Ref: library/mailbox mailbox Mailbox __setitem__13789449
Ref: 3cac13789449
Ref: library/mailbox mailbox Mailbox iterkeys13790559
Ref: 3cad13790559
Ref: library/mailbox mailbox Mailbox keys13790651
Ref: 3cae13790651
Ref: library/mailbox mailbox Mailbox itervalues13790819
Ref: 3caf13790819
Ref: library/mailbox mailbox Mailbox __iter__13790856
Ref: 3cb013790856
Ref: library/mailbox mailbox Mailbox values13791499
Ref: 3cb113791499
Ref: library/mailbox mailbox Mailbox iteritems13791671
Ref: 3cb213791671
Ref: library/mailbox mailbox Mailbox items13792195
Ref: 3cb313792195
Ref: library/mailbox mailbox Mailbox get13792394
Ref: 3cb413792394
Ref: library/mailbox mailbox Mailbox __getitem__13792441
Ref: 3cb513792441
Ref: library/mailbox mailbox Mailbox get_message13793174
Ref: 3cb613793174
Ref: library/mailbox mailbox Mailbox get_bytes13793514
Ref: 146a13793514
Ref: library/mailbox mailbox Mailbox get_string13793782
Ref: 146b13793782
Ref: library/mailbox mailbox Mailbox get_file13794184
Ref: 146913794184
Ref: library/mailbox mailbox Mailbox __contains__13795566
Ref: 3cb713795566
Ref: library/mailbox mailbox Mailbox __len__13795749
Ref: 3cb813795749
Ref: library/mailbox mailbox Mailbox clear13795859
Ref: 3cb913795859
Ref: library/mailbox mailbox Mailbox pop13795976
Ref: 3cba13795976
Ref: library/mailbox mailbox Mailbox popitem13796444
Ref: 3cbb13796444
Ref: library/mailbox mailbox Mailbox update13797094
Ref: 3cbc13797094
Ref: library/mailbox mailbox Mailbox flush13798058
Ref: 1a1e13798058
Ref: library/mailbox mailbox Mailbox lock13798478
Ref: 3ca913798478
Ref: library/mailbox mailbox Mailbox unlock13798974
Ref: 3caa13798974
Ref: library/mailbox mailbox Mailbox close13799095
Ref: 3cbe13799095
Node: Maildir オブジェクト13799524
Ref: library/mailbox mailbox-maildir13799645
Ref: 3cbf13799645
Ref: library/mailbox maildir-objects13799645
Ref: 3cc013799645
Ref: library/mailbox mailbox Maildir13799720
Ref: 65e13799720
Ref: library/mailbox mailbox Maildir colon13802553
Ref: 3cc213802553
Ref: library/mailbox mailbox Maildir list_folders13803587
Ref: 3cc313803587
Ref: library/mailbox mailbox Maildir get_folder13803693
Ref: 3cc413803693
Ref: library/mailbox mailbox Maildir add_folder13803987
Ref: 3cc613803987
Ref: library/mailbox mailbox Maildir remove_folder13804175
Ref: 3cc713804175
Ref: library/mailbox mailbox Maildir clean13804477
Ref: 3cc913804477
Ref: library/mailbox mailbox Maildir get_flags13804776
Ref: 1aa713804776
Ref: library/mailbox mailbox Maildir set_flags13805583
Ref: 1aa813805583
Ref: library/mailbox mailbox Maildir add_flag13806338
Ref: 1aa913806338
Ref: library/mailbox mailbox Maildir remove_flag13806854
Ref: 1aaa13806854
Ref: library/mailbox mailbox Maildir get_info13807381
Ref: 1aa513807381
Ref: library/mailbox mailbox Maildir set_info13808113
Ref: 1aa613808113
Ref: library/mailbox mailbox Maildir add13808950
Ref: 3cd113808950
Ref: library/mailbox mailbox Maildir __setitem__13808987
Ref: 3cce13808987
Ref: library/mailbox mailbox Maildir update13809037
Ref: 3cd213809037
Ref: library/mailbox mailbox Maildir flush13809516
Ref: 3cd313809516
Ref: library/mailbox mailbox Maildir lock13809691
Ref: 3cd413809691
Ref: library/mailbox mailbox Maildir unlock13809722
Ref: 3cd513809722
Ref: library/mailbox mailbox Maildir close13809912
Ref: 3cd613809912
Ref: library/mailbox mailbox Maildir get_file13810170
Ref: 3cd713810170
Ref: Maildir オブジェクト-Footnote-113810844
Ref: Maildir オブジェクト-Footnote-213810893
Node: mbox オブジェクト13810937
Ref: library/mailbox mailbox-mbox13811088
Ref: 3cd813811088
Ref: library/mailbox mbox-objects13811088
Ref: 3cd913811088
Ref: library/mailbox mailbox mbox13811157
Ref: 1a5d13811157
Ref: library/mailbox mailbox mbox get_bytes13812898
Ref: 3cda13812898
Ref: library/mailbox mailbox mbox get_file13813197
Ref: 3cdb13813197
Ref: library/mailbox mailbox mbox get_string13813785
Ref: 3cdc13813785
Ref: library/mailbox mailbox mbox lock13814085
Ref: 3cdd13814085
Ref: library/mailbox mailbox mbox unlock13814116
Ref: 3cde13814116
Ref: mbox オブジェクト-Footnote-113814835
Ref: mbox オブジェクト-Footnote-213814895
Ref: mbox オブジェクト-Footnote-313814947
Node: MH オブジェクト13815025
Ref: library/mailbox mailbox-mh13815174
Ref: 3cdf13815174
Ref: library/mailbox mh-objects13815174
Ref: 3ce013815174
Ref: library/mailbox mailbox MH13815239
Ref: 1a8f13815239
Ref: library/mailbox mailbox MH list_folders13817360
Ref: 3ce213817360
Ref: library/mailbox mailbox MH get_folder13817466
Ref: 3ce313817466
Ref: library/mailbox mailbox MH add_folder13817745
Ref: 3ce413817745
Ref: library/mailbox mailbox MH remove_folder13817930
Ref: 3ce513817930
Ref: library/mailbox mailbox MH get_sequences13818232
Ref: 3ce613818232
Ref: library/mailbox mailbox MH set_sequences13818446
Ref: 3ce713818446
Ref: library/mailbox mailbox MH pack13818729
Ref: 3ce813818729
Ref: library/mailbox mailbox MH remove13819292
Ref: 3ce913819292
Ref: library/mailbox mailbox MH __delitem__13819328
Ref: 3cea13819328
Ref: library/mailbox mailbox MH discard13819369
Ref: 3ceb13819369
Ref: library/mailbox mailbox MH lock13819637
Ref: 3cec13819637
Ref: library/mailbox mailbox MH unlock13819668
Ref: 3ced13819668
Ref: library/mailbox mailbox MH get_file13820139
Ref: 3cee13820139
Ref: library/mailbox mailbox MH flush13820366
Ref: 3cef13820366
Ref: library/mailbox mailbox MH close13820536
Ref: 3cf013820536
Ref: MH オブジェクト-Footnote-113821079
Ref: MH オブジェクト-Footnote-213821115
Node: Babyl オブジェクト13821160
Ref: library/mailbox babyl-objects13821309
Ref: 3cf113821309
Ref: library/mailbox mailbox-babyl13821309
Ref: 3cf213821309
Ref: library/mailbox mailbox Babyl13821380
Ref: 3cf313821380
Ref: library/mailbox mailbox Babyl get_labels13823389
Ref: 3cf513823389
Ref: library/mailbox mailbox Babyl get_file13824081
Ref: 3cf613824081
Ref: library/mailbox mailbox Babyl lock13824714
Ref: 3cf713824714
Ref: library/mailbox mailbox Babyl unlock13824745
Ref: 3cf813824745
Ref: Babyl オブジェクト-Footnote-113825223
Ref: Babyl オブジェクト-Footnote-213825267
Node: MMDF オブジェクト13825345
Ref: library/mailbox mailbox-mmdf13825464
Ref: 3cf913825464
Ref: library/mailbox mmdf-objects13825464
Ref: 3cfa13825464
Ref: library/mailbox mailbox MMDF13825533
Ref: 1a5e13825533
Ref: library/mailbox mailbox MMDF get_bytes13827076
Ref: 3cfc13827076
Ref: library/mailbox mailbox MMDF get_file13827375
Ref: 3cfd13827375
Ref: library/mailbox mailbox MMDF lock13827963
Ref: 3cfe13827963
Ref: library/mailbox mailbox MMDF unlock13827994
Ref: 3cff13827994
Ref: MMDF オブジェクト-Footnote-113828491
Ref: MMDF オブジェクト-Footnote-213828551
Node: Message オブジェクト13828594
Ref: library/mailbox mailbox-message-objects13828777
Ref: 3d0013828777
Ref: library/mailbox message-objects13828777
Ref: 3d0113828777
Ref: library/mailbox mailbox Message13828852
Ref: 146c13828852
Ref: Message オブジェクト-Footnote-113831474
Node: MaildirMessage オブジェクト13831533
Ref: library/mailbox mailbox-maildirmessage13831668
Ref: 3d0213831668
Ref: library/mailbox maildirmessage-objects13831668
Ref: 3d0313831668
Ref: library/mailbox mailbox MaildirMessage13831757
Ref: 3cc113831757
Ref: library/mailbox mailbox MaildirMessage get_subdir13833972
Ref: 3d0413833972
Ref: library/mailbox mailbox MaildirMessage set_subdir13834633
Ref: 3d0513834633
Ref: library/mailbox mailbox MaildirMessage get_flags13834897
Ref: 3cca13834897
Ref: library/mailbox mailbox MaildirMessage set_flags13835480
Ref: 3ccb13835480
Ref: library/mailbox mailbox MaildirMessage add_flag13835623
Ref: 3ccc13835623
Ref: library/mailbox mailbox MaildirMessage remove_flag13836037
Ref: 3ccd13836037
Ref: library/mailbox mailbox MaildirMessage get_date13836391
Ref: 3d0613836391
Ref: library/mailbox mailbox MaildirMessage set_date13836558
Ref: 3d0713836558
Ref: library/mailbox mailbox MaildirMessage get_info13836762
Ref: 3ccf13836762
Ref: library/mailbox mailbox MaildirMessage set_info13837034
Ref: 3cd013837034
Node: mboxMessage オブジェクト13840061
Ref: library/mailbox mailbox-mboxmessage13840233
Ref: 3d0813840233
Ref: library/mailbox mboxmessage-objects13840233
Ref: 3d0913840233
Ref: library/mailbox mailbox mboxMessage13840316
Ref: 3b6813840316
Ref: library/mailbox mailbox mboxMessage get_from13842418
Ref: 3d0a13842418
Ref: library/mailbox mailbox mboxMessage set_from13842667
Ref: 3d0b13842667
Ref: library/mailbox mailbox mboxMessage get_flags13843366
Ref: 3d0c13843366
Ref: library/mailbox mailbox mboxMessage set_flags13843709
Ref: 3d0d13843709
Ref: library/mailbox mailbox mboxMessage add_flag13843993
Ref: 3d0e13843993
Ref: library/mailbox mailbox mboxMessage remove_flag13844292
Ref: 3d0f13844292
Node: MHMessage オブジェクト13847605
Ref: library/mailbox mailbox-mhmessage13847775
Ref: 3d1013847775
Ref: library/mailbox mhmessage-objects13847775
Ref: 3d1113847775
Ref: library/mailbox mailbox MHMessage13847856
Ref: 3ce113847856
Ref: library/mailbox mailbox MHMessage get_sequences13849024
Ref: 3d1213849024
Ref: library/mailbox mailbox MHMessage set_sequences13849155
Ref: 3d1313849155
Ref: library/mailbox mailbox MHMessage add_sequence13849295
Ref: 3d1413849295
Ref: library/mailbox mailbox MHMessage remove_sequence13849455
Ref: 3d1513849455
Node: BabylMessage オブジェクト13851542
Ref: library/mailbox babylmessage-objects13851712
Ref: 3d1613851712
Ref: library/mailbox mailbox-babylmessage13851712
Ref: 3d1713851712
Ref: library/mailbox mailbox BabylMessage13851799
Ref: 3cf413851799
Ref: library/mailbox mailbox BabylMessage get_labels13853455
Ref: 3d1813853455
Ref: library/mailbox mailbox BabylMessage set_labels13853577
Ref: 3d1913853577
Ref: library/mailbox mailbox BabylMessage add_label13853735
Ref: 3d1a13853735
Ref: library/mailbox mailbox BabylMessage remove_label13853876
Ref: 3d1b13853876
Ref: library/mailbox mailbox BabylMessage get_visible13854034
Ref: 3d1c13854034
Ref: library/mailbox mailbox BabylMessage set_visible13854240
Ref: 3d1d13854240
Ref: library/mailbox mailbox BabylMessage update_visible13854692
Ref: 3d1e13854692
Node: MMDFMessage オブジェクト13857446
Ref: library/mailbox mailbox-mmdfmessage13857579
Ref: 3d1f13857579
Ref: library/mailbox mmdfmessage-objects13857579
Ref: 3d2013857579
Ref: library/mailbox mailbox MMDFMessage13857664
Ref: 3cfb13857664
Ref: library/mailbox mailbox MMDFMessage get_from13859557
Ref: 3d2113859557
Ref: library/mailbox mailbox MMDFMessage set_from13859806
Ref: 3d2213859806
Ref: library/mailbox mailbox MMDFMessage get_flags13860505
Ref: 3d2313860505
Ref: library/mailbox mailbox MMDFMessage set_flags13860848
Ref: 3d2413860848
Ref: library/mailbox mailbox MMDFMessage add_flag13861132
Ref: 3d2513861132
Ref: library/mailbox mailbox MMDFMessage remove_flag13861431
Ref: 3d2613861431
Node: 例外<21>13864738
Ref: library/mailbox exceptions13864908
Ref: 3d2713864908
Ref: library/mailbox mailbox Error13865030
Ref: 3d2813865030
Ref: library/mailbox mailbox NoSuchMailboxError13865120
Ref: 3cc513865120
Ref: library/mailbox mailbox NotEmptyError13865588
Ref: 3cc813865588
Ref: library/mailbox mailbox ExternalClashError13865855
Ref: 3cbd13865855
Ref: library/mailbox mailbox FormatError13866158
Ref: 3d2913866158
Node: 使用例<31>13866419
Ref: library/mailbox examples13866554
Ref: 3d2a13866554
Ref: library/mailbox mailbox-examples13866554
Ref: 3d2b13866554
Node: mimetypes --- ファイル名を MIME タイプへマップする13869044
Ref: library/mimetypes doc13869341
Ref: 3d2c13869341
Ref: library/mimetypes mimetypes-map-filenames-to-mime-types13869341
Ref: 3d2d13869341
Ref: library/mimetypes module-mimetypes13869341
Ref: 9313869341
Ref: library/mimetypes translation-repo13869341
Ref: 3d2e13869341
Ref: library/mimetypes mimetypes guess_type13870507
Ref: 51713870507
Ref: library/mimetypes mimetypes guess_file_type13872600
Ref: 51613872600
Ref: library/mimetypes mimetypes guess_all_extensions13872932
Ref: 1ca713872932
Ref: library/mimetypes mimetypes guess_extension13873541
Ref: 3d3013873541
Ref: library/mimetypes mimetypes init13874320
Ref: 3d2f13874320
Ref: library/mimetypes mimetypes read_mime_types13875654
Ref: 1d8813875654
Ref: library/mimetypes mimetypes add_type13876132
Ref: 3d3213876132
Ref: library/mimetypes mimetypes inited13876692
Ref: 3d3313876692
Ref: library/mimetypes mimetypes knownfiles13876906
Ref: 3d3113876906
Ref: library/mimetypes mimetypes suffix_map13877196
Ref: 3d3413877196
Ref: library/mimetypes mimetypes encodings_map13877590
Ref: 3d3513877590
Ref: library/mimetypes mimetypes types_map13877715
Ref: 3d3613877715
Ref: library/mimetypes mimetypes common_types13877821
Ref: 3d3713877821
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-113878535
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-213878604
Node: MimeTypes objects13878675
Ref: library/mimetypes id113878839
Ref: 3d3813878839
Ref: library/mimetypes mimetypes-objects13878839
Ref: 3d3913878839
Ref: library/mimetypes mimetypes MimeTypes13879083
Ref: 171913879083
Ref: library/mimetypes mimetypes MimeTypes suffix_map13880040
Ref: 3d3c13880040
Ref: library/mimetypes mimetypes MimeTypes encodings_map13880608
Ref: 3d3d13880608
Ref: library/mimetypes mimetypes MimeTypes types_map13880869
Ref: 3d3e13880869
Ref: library/mimetypes mimetypes MimeTypes types_map_inv13881201
Ref: 3d3f13881201
Ref: library/mimetypes mimetypes MimeTypes guess_extension13881548
Ref: 3d4013881548
Ref: library/mimetypes mimetypes MimeTypes guess_type13881758
Ref: 1e7513881758
Ref: library/mimetypes mimetypes MimeTypes guess_file_type13881956
Ref: 3d4113881956
Ref: library/mimetypes mimetypes MimeTypes guess_all_extensions13882176
Ref: 3d4213882176
Ref: library/mimetypes mimetypes MimeTypes read13882390
Ref: 3d3a13882390
Ref: library/mimetypes mimetypes MimeTypes readfp13882869
Ref: 3d3b13882869
Ref: library/mimetypes mimetypes MimeTypes read_windows_registry13883357
Ref: 3d4313883357
Ref: library/mimetypes mimetypes MimeTypes add_type13883805
Ref: 31b13883805
Node: コマンドラインでの使用<4>13884576
Ref: library/mimetypes command-line-usage13884779
Ref: 3d4413884779
Ref: library/mimetypes mimetypes-cli13884779
Ref: 24913884779
Ref: library/mimetypes cmdoption-mimetypes-h13885039
Ref: 3d4513885039
Ref: library/mimetypes cmdoption-mimetypes-help13885078
Ref: 3d4613885078
Ref: library/mimetypes cmdoption-mimetypes-e13885186
Ref: 3d4713885186
Ref: library/mimetypes cmdoption-mimetypes-extension13885225
Ref: 3d4813885225
Ref: library/mimetypes cmdoption-mimetypes-l13885313
Ref: 3d4913885313
Ref: library/mimetypes cmdoption-mimetypes-lenient13885352
Ref: 3d4a13885352
Node: コマンドラインの例<2>13885830
Ref: library/mimetypes command-line-example13886007
Ref: 3d4b13886007
Node: base64 --- Base16 Base32 Base64 Base85 データのエンコード13887671
Ref: library/base64 doc13887950
Ref: 3d4c13887950
Ref: library/base64 base64-base16-base32-base64-base85-data-encodings13887950
Ref: 3d4d13887950
Ref: library/base64 module-base6413887950
Ref: f13887950
Ref: library/base64 translation-repo13887950
Ref: 3d4e13887950
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-113890239
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-213890305
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-313890364
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-413890411
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-513890470
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-613890529
Node: RFC 4648 エンコーディング13890588
Ref: library/base64 base64-rfc-464813890764
Ref: 3d4f13890764
Ref: library/base64 rfc-4648-encodings13890764
Ref: 3d5213890764
Ref: library/base64 base64 b64encode13891067
Ref: 3d5313891067
Ref: library/base64 base64 b64decode13891919
Ref: 17d013891919
Ref: library/base64 base64 standard_b64encode13893069
Ref: 3d5413893069
Ref: library/base64 base64 standard_b64decode13893310
Ref: 3d5513893310
Ref: library/base64 base64 urlsafe_b64encode13893566
Ref: 3d5613893566
Ref: library/base64 base64 urlsafe_b64decode13893907
Ref: 3d5713893907
Ref: library/base64 base64 b32encode13894336
Ref: 3d5813894336
Ref: library/base64 base64 b32decode13894529
Ref: 122a13894529
Ref: library/base64 base64 b32hexencode13895984
Ref: 9e813895984
Ref: library/base64 base64 b32hexdecode13896201
Ref: 9e913896201
Ref: library/base64 base64 b16encode13896689
Ref: 3d5913896689
Ref: library/base64 base64 b16decode13896882
Ref: 2d513896882
Ref: RFC 4648 エンコーディング-Footnote-113897624
Ref: RFC 4648 エンコーディング-Footnote-213897683
Node: Base85 エンコーディング13897742
Ref: library/base64 base64-base-8513897963
Ref: 3d5013897963
Ref: library/base64 base85-encodings13897963
Ref: 3d5a13897963
Ref: library/base64 base64 a85encode13899285
Ref: 112513899285
Ref: library/base64 base64 a85decode13900635
Ref: 112613900635
Ref: library/base64 base64 b85encode13901636
Ref: 112713901636
Ref: library/base64 base64 b85decode13902265
Ref: 112813902265
Ref: library/base64 base64 z85encode13902458
Ref: 47b13902458
Ref: library/base64 base64 z85decode13902870
Ref: 47c13902870
Ref: Base85 エンコーディング-Footnote-113903097
Ref: Base85 エンコーディング-Footnote-213903156
Node: レガシーインターフェース13903196
Ref: library/base64 base64-legacy13903426
Ref: 3d5113903426
Ref: library/base64 legacy-interface13903426
Ref: 3d5b13903426
Ref: library/base64 base64 decode13903507
Ref: 3d5c13903507
Ref: library/base64 base64 decodebytes13903879
Ref: b5113903879
Ref: library/base64 base64 encode13904198
Ref: 3d5d13904198
Ref: library/base64 base64 encodebytes13904803
Ref: b5013904803
Ref: レガシーインターフェース-Footnote-113905528
Ref: レガシーインターフェース-Footnote-213905587
Node: セキュリティで考慮すべき点<4>13905646
Ref: library/base64 base64-security13905836
Ref: 3d5e13905836
Ref: library/base64 security-considerations13905836
Ref: 3d5f13905836
Ref: セキュリティで考慮すべき点<4>-Footnote-113906975
Ref: セキュリティで考慮すべき点<4>-Footnote-213907034
Ref: セキュリティで考慮すべき点<4>-Footnote-313907093
Ref: セキュリティで考慮すべき点<4>-Footnote-413907140
Node: binascii --- バイナリ と ASCII 間の変換13907180
Ref: library/binascii doc13907469
Ref: 3d6013907469
Ref: library/binascii binascii-convert-between-binary-and-ascii13907469
Ref: 3d6113907469
Ref: library/binascii module-binascii13907469
Ref: 1113907469
Ref: library/binascii translation-repo13907469
Ref: 3d6213907469
Ref: library/binascii binascii a2b_uu13908590
Ref: 17b513908590
Ref: library/binascii binascii b2a_uu13908965
Ref: d1a13908965
Ref: library/binascii binascii a2b_base6413909369
Ref: 17cf13909369
Ref: library/binascii binascii b2a_base6413910140
Ref: e7f13910140
Ref: library/binascii binascii a2b_qp13910521
Ref: 3d6313910521
Ref: library/binascii binascii b2a_qp13910928
Ref: 3d6413910928
Ref: library/binascii binascii crc_hqx13912072
Ref: 94113912072
Ref: library/binascii binascii crc3213912431
Ref: 1a7313912431
Ref: library/binascii binascii b2a_hex13913270
Ref: 28f613913270
Ref: library/binascii binascii hexlify13913335
Ref: 3d6513913335
Ref: library/binascii binascii a2b_hex13914556
Ref: 28f713914556
Ref: library/binascii binascii unhexlify13914597
Ref: 1e8213914597
Ref: library/binascii binascii Error13915148
Ref: 122b13915148
Ref: library/binascii binascii Incomplete13915294
Ref: 3d6613915294
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-113915889
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-213915948
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-313916007
Node: quopri --- MIME quoted-printable データのエンコードとデコード13916066
Ref: library/quopri doc13916280
Ref: 3d6713916280
Ref: library/quopri module-quopri13916280
Ref: bc13916280
Ref: library/quopri quopri-encode-and-decode-mime-quoted-printable-data13916280
Ref: 3d6813916280
Ref: library/quopri translation-repo13916280
Ref: 3d6913916280
Ref: library/quopri quopri decode13917216
Ref: 28f913917216
Ref: library/quopri quopri encode13917983
Ref: 28f813917983
Ref: library/quopri quopri decodestring13918910
Ref: 3d6a13918910
Ref: library/quopri quopri encodestring13919133
Ref: 3d6b13919133
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-113919656
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-213919722
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-313919781
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-413919840
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-513919899
Node: 構造化マークアップツール13919958
Ref: library/markup doc13920173
Ref: 3d6c13920173
Ref: library/markup markup13920173
Ref: 3d6d13920173
Ref: library/markup structured-markup-processing-tools13920173
Ref: 3d6e13920173
Ref: library/markup translation-repo13920173
Ref: 3d6f13920173
Node: html --- HyperText Markup Language のサポート13922018
Ref: library/html doc13922211
Ref: 3d7013922211
Ref: library/html html-hypertext-markup-language-support13922211
Ref: 3d7113922211
Ref: library/html module-html13922211
Ref: 6f13922211
Ref: library/html html escape13922539
Ref: 121413922539
Ref: library/html html unescape13923120
Ref: b5413923120
Ref: html --- HyperText Markup Language のサポート-Footnote-113923901
Node: html parser --- HTML と XHTML のシンプルなパーサー13923974
Ref: library/html parser doc13924220
Ref: 3d7213924220
Ref: library/html parser html-parser-simple-html-and-xhtml-parser13924220
Ref: 3d7313924220
Ref: library/html parser module-html parser13924220
Ref: 7113924220
Ref: library/html parser translation-repo13924220
Ref: 3d7413924220
Ref: library/html parser html parser HTMLParser13924758
Ref: a7b13924758
Ref: html parser --- HTML と XHTML のシンプルなパーサー-Footnote-113926440
Node: HTML パーサーアプリケーションの例13926511
Ref: library/html parser example-html-parser-application13926688
Ref: 3d7513926688
Node: HTMLParser メソッド13927928
Ref: library/html parser htmlparser-methods13928127
Ref: 3d7613928127
Ref: library/html parser html parser HTMLParser feed13928284
Ref: 3d7713928284
Ref: library/html parser html parser HTMLParser close13928717
Ref: 18a613928717
Ref: library/html parser html parser HTMLParser reset13929294
Ref: 3d7813929294
Ref: library/html parser html parser HTMLParser getpos13929508
Ref: 3d7913929508
Ref: library/html parser html parser HTMLParser get_starttag_text13929618
Ref: 3d7a13929618
Ref: library/html parser html parser HTMLParser handle_starttag13930385
Ref: 3d7c13930385
Ref: library/html parser html parser HTMLParser handle_endtag13931319
Ref: 3d7d13931319
Ref: library/html parser html parser HTMLParser handle_startendtag13931562
Ref: 3d7b13931562
Ref: library/html parser html parser HTMLParser handle_data13932058
Ref: 3d7e13932058
Ref: library/html parser html parser HTMLParser handle_entityref13932248
Ref: 3d7f13932248
Ref: library/html parser html parser HTMLParser handle_charref13932552
Ref: 3d8013932552
Ref: library/html parser html parser HTMLParser handle_comment13932998
Ref: 3d8113932998
Ref: library/html parser html parser HTMLParser handle_decl13933627
Ref: 3d8213933627
Ref: library/html parser html parser HTMLParser handle_pi13933935
Ref: 3d8313933935
Ref: library/html parser html parser HTMLParser unknown_decl13934657
Ref: 3d8413934657
Node: 使用例<32>13935071
Ref: library/html parser examples13935214
Ref: 3d8513935214
Ref: library/html parser htmlparser-examples13935214
Ref: 3d8613935214
Node: html entities --- HTML 一般実体の定義13939193
Ref: library/html entities doc13939419
Ref: 3d8713939419
Ref: library/html entities html-entities-definitions-of-html-general-entities13939419
Ref: 3d8813939419
Ref: library/html entities module-html entities13939419
Ref: 7013939419
Ref: library/html entities translation-repo13939419
Ref: 3d8913939419
Ref: library/html entities html entities html513939825
Ref: 12ed13939825
Ref: library/html entities html entities entitydefs13940346
Ref: 3d8c13940346
Ref: library/html entities html entities name2codepoint13940508
Ref: 3d8a13940508
Ref: library/html entities html entities codepoint2name13940644
Ref: 3d8b13940644
Ref: html entities --- HTML 一般実体の定義-Footnote-113940829
Ref: html entities --- HTML 一般実体の定義-Footnote-213940902
Node: XMLを扱うモジュール群13941015
Ref: library/xml doc13941225
Ref: 3d8d13941225
Ref: library/xml module-xml13941225
Ref: 12713941225
Ref: library/xml translation-repo13941225
Ref: 3d8e13941225
Ref: library/xml xml13941225
Ref: 3d8f13941225
Ref: library/xml xml-processing-modules13941225
Ref: 3d9013941225
Ref: library/xml xml-security13942545
Ref: 3d9113942545
Ref: XMLを扱うモジュール群-Footnote-113942608
Node: XML security13942669
Ref: library/xml id113942748
Ref: 3d9213942748
Ref: library/xml xml-vulnerabilities13942748
Ref: 3d9313942748
Ref: XML security-Footnote-113945501
Ref: XML security-Footnote-213945546
Ref: XML security-Footnote-313945599
Ref: XML security-Footnote-413945652
Ref: XML security-Footnote-513945773
Node: xml etree ElementTree --- ElementTree XML API13945829
Ref: library/xml etree elementtree doc13946056
Ref: 3d9413946056
Ref: library/xml etree elementtree module-xml etree ElementTree13946056
Ref: 12c13946056
Ref: library/xml etree elementtree translation-repo13946056
Ref: 3d9513946056
Ref: library/xml etree elementtree xml-etree-elementtree-the-elementtree-xml-api13946056
Ref: 3d9613946056
Ref: xml etree ElementTree --- ElementTree XML API-Footnote-113946969
Node: チュートリアル<3>13947051
Ref: library/xml etree elementtree tutorial13947184
Ref: 3d9713947184
Node: XML 木構造と要素13947647
Ref: library/xml etree elementtree xml-tree-and-elements13947752
Ref: 3d9813947752
Node: XML の解析13948342
Ref: library/xml etree elementtree elementtree-parsing-xml13948502
Ref: 3d9913948502
Ref: library/xml etree elementtree parsing-xml13948502
Ref: 3d9a13948502
Node: 非ブロックパースのためのプル API13951400
Ref: library/xml etree elementtree elementtree-pull-parsing13951565
Ref: 11fa13951565
Ref: library/xml etree elementtree pull-api-for-non-blocking-parsing13951565
Ref: 3d9c13951565
Node: 関心ある要素の検索13954233
Ref: library/xml etree elementtree finding-interesting-elements13954410
Ref: 3d9f13954410
Node: XML ファイルの編集13955759
Ref: library/xml etree elementtree modifying-an-xml-file13955909
Ref: 3da213955909
Node: XML 文書の構築13959013
Ref: library/xml etree elementtree building-xml-documents13959171
Ref: 3da513959171
Node: 名前空間のある XML の解析13959548
Ref: library/xml etree elementtree parsing-xml-with-namespaces13959672
Ref: 3da713959672
Ref: 名前空間のある XML の解析-Footnote-113962200
Ref: 名前空間のある XML の解析-Footnote-213962252
Node: XPath サポート13962304
Ref: library/xml etree elementtree elementtree-xpath13962467
Ref: daa13962467
Ref: library/xml etree elementtree xpath-support13962467
Ref: 3da813962467
Ref: XPath サポート-Footnote-113962930
Node: 使用例<33>13962966
Ref: library/xml etree elementtree example13963083
Ref: 3da913963083
Node: サポートされている XPath 構文13964091
Ref: library/xml etree elementtree supported-xpath-syntax13964208
Ref: 3daa13964208
Node: リファレンス<5>13969413
Ref: library/xml etree elementtree reference13969573
Ref: 3dab13969573
Node: 関数<9>13969657
Ref: library/xml etree elementtree elementtree-functions13969724
Ref: 3dac13969724
Ref: library/xml etree elementtree functions13969724
Ref: 3dad13969724
Ref: library/xml etree elementtree xml etree ElementTree canonicalize13969757
Ref: c4c13969757
Ref: library/xml etree elementtree xml etree ElementTree Comment13972147
Ref: 3dae13972147
Ref: library/xml etree elementtree xml etree ElementTree dump13972968
Ref: 3daf13972968
Ref: library/xml etree elementtree xml etree ElementTree fromstring13973562
Ref: 3d9b13973562
Ref: library/xml etree elementtree xml etree ElementTree fromstringlist13974067
Ref: 13ed13974067
Ref: library/xml etree elementtree xml etree ElementTree indent13974641
Ref: 3db113974641
Ref: library/xml etree elementtree xml etree ElementTree iselement13975170
Ref: 3db213975170
Ref: library/xml etree elementtree xml etree ElementTree iterparse13975457
Ref: 57a13975457
Ref: library/xml etree elementtree xml etree ElementTree parse13977822
Ref: 3db313977822
Ref: library/xml etree elementtree xml etree ElementTree ProcessingInstruction13978328
Ref: 3db413978328
Ref: library/xml etree elementtree xml etree ElementTree register_namespace13979114
Ref: 13ee13979114
Ref: library/xml etree elementtree xml etree ElementTree SubElement13979685
Ref: 3da613979685
Ref: library/xml etree elementtree xml etree ElementTree tostring13980357
Ref: 11fb13980357
Ref: library/xml etree elementtree xml etree ElementTree tostringlist13981612
Ref: 11fc13981612
Ref: library/xml etree elementtree xml etree ElementTree XML13983091
Ref: 3db013983091
Ref: library/xml etree elementtree xml etree ElementTree XMLID13983649
Ref: 3db513983649
Ref: 関数<9>-Footnote-113984228
Ref: 関数<9>-Footnote-213984269
Ref: 関数<9>-Footnote-313984661
Node: XInclude サポート13985053
Ref: library/xml etree elementtree elementtree-xinclude13985216
Ref: 3db613985216
Ref: library/xml etree elementtree xinclude-support13985216
Ref: 3db713985216
Ref: XInclude サポート-Footnote-113985592
Node: 使用例<34>13985632
Ref: library/xml etree elementtree id313985703
Ref: 3db813985703
Node: リファレンス<6>13987502
Ref: library/xml etree elementtree id413987635
Ref: 3db913987635
Node: 関数<10>13987942
Ref: library/xml etree elementtree elementinclude-functions13988045
Ref: 3dba13988045
Ref: library/xml etree elementtree id513988045
Ref: 3dbb13988045
Ref: library/xml etree elementtree module-xml etree ElementInclude13988078
Ref: 12b13988078
Ref: library/xml etree elementtree xml etree ElementInclude default_loader13988078
Ref: 3dbc13988078
Ref: library/xml etree elementtree xml etree ElementInclude include13988666
Ref: 3dbd13988666
Node: Element オブジェクト13989553
Ref: library/xml etree elementtree element-objects13989695
Ref: 3dbe13989695
Ref: library/xml etree elementtree elementtree-element-objects13989695
Ref: 3dbf13989695
Ref: library/xml etree elementtree xml etree ElementTree Element13989764
Ref: 36113989764
Ref: library/xml etree elementtree xml etree ElementTree Element tag13990384
Ref: 156913990384
Ref: library/xml etree elementtree xml etree ElementTree Element text13990540
Ref: 3da013990540
Ref: library/xml etree elementtree xml etree ElementTree Element tail13990565
Ref: 3dc013990565
Ref: library/xml etree elementtree xml etree ElementTree Element attrib13991989
Ref: 3dc113991989
Ref: library/xml etree elementtree xml etree ElementTree Element clear13992569
Ref: 3dc213992569
Ref: library/xml etree elementtree xml etree ElementTree Element get13992796
Ref: 3da113992796
Ref: library/xml etree elementtree xml etree ElementTree Element items13993006
Ref: 3dc313993006
Ref: library/xml etree elementtree xml etree ElementTree Element keys13993200
Ref: 3dc413993200
Ref: library/xml etree elementtree xml etree ElementTree Element set13993366
Ref: 3da313993366
Ref: library/xml etree elementtree xml etree ElementTree Element append13993569
Ref: 3da413993569
Ref: library/xml etree elementtree xml etree ElementTree Element extend13993832
Ref: 13ef13993832
Ref: library/xml etree elementtree xml etree ElementTree Element find13994054
Ref: 18df13994054
Ref: library/xml etree elementtree xml etree ElementTree Element findall13994482
Ref: 18e013994482
Ref: library/xml etree elementtree xml etree ElementTree Element findtext13994907
Ref: 17b813994907
Ref: library/xml etree elementtree xml etree ElementTree Element insert13995517
Ref: 3dc513995517
Ref: library/xml etree elementtree xml etree ElementTree Element iter13995770
Ref: 156a13995770
Ref: library/xml etree elementtree xml etree ElementTree Element iterfind13996383
Ref: 13f013996383
Ref: library/xml etree elementtree xml etree ElementTree Element itertext13996862
Ref: 13f113996862
Ref: library/xml etree elementtree xml etree ElementTree Element makeelement13997160
Ref: 3dc613997160
Ref: library/xml etree elementtree xml etree ElementTree Element remove13997442
Ref: 18db13997442
Ref: Element オブジェクト-Footnote-114000300
Node: ElementTree オブジェクト14000343
Ref: library/xml etree elementtree elementtree-elementtree-objects14000499
Ref: 3dc714000499
Ref: library/xml etree elementtree elementtree-objects14000499
Ref: 3dc814000499
Ref: library/xml etree elementtree xml etree ElementTree ElementTree14000576
Ref: b4b14000576
Ref: library/xml etree elementtree xml etree ElementTree ElementTree _setroot14000978
Ref: 3dc914000978
Ref: library/xml etree elementtree xml etree ElementTree ElementTree find14001284
Ref: 3dca14001284
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findall14001443
Ref: 3dcb14001443
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findtext14001608
Ref: 3dcc14001608
Ref: library/xml etree elementtree xml etree ElementTree ElementTree getroot14001789
Ref: 3dcd14001789
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iter14001881
Ref: 3dce14001881
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iterfind14002219
Ref: 3dcf14002219
Ref: library/xml etree elementtree xml etree ElementTree ElementTree parse14002419
Ref: 3dd014002419
Ref: library/xml etree elementtree xml etree ElementTree ElementTree write14002903
Ref: c9014002903
Ref: ElementTree オブジェクト-Footnote-114006156
Node: QName オブジェクト14006548
Ref: library/xml etree elementtree elementtree-qname-objects14006708
Ref: 3dd114006708
Ref: library/xml etree elementtree qname-objects14006708
Ref: 3dd214006708
Ref: library/xml etree elementtree xml etree ElementTree QName14006773
Ref: 3dd314006773
Node: TreeBuilder オブジェクト14007397
Ref: library/xml etree elementtree elementtree-treebuilder-objects14007555
Ref: 3dd414007555
Ref: library/xml etree elementtree treebuilder-objects14007555
Ref: 3dd514007555
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder14007632
Ref: c4e14007632
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder close14008812
Ref: 3dd614008812
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder data14009027
Ref: 3dd714009027
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end14009247
Ref: 13f214009247
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start14009410
Ref: 1dca14009410
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder comment14009636
Ref: 3dd814009636
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder pi14009840
Ref: 3dd914009840
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder doctype14010211
Ref: c9214010211
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start_ns14010591
Ref: 3dda14010591
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end_ns14010993
Ref: 3ddb14010993
Ref: library/xml etree elementtree xml etree ElementTree C14NWriterTarget14011248
Ref: 3ddc14011248
Ref: TreeBuilder オブジェクト-Footnote-114011801
Node: XMLParser オブジェクト14011842
Ref: library/xml etree elementtree elementtree-xmlparser-objects14012008
Ref: 3ddd14012008
Ref: library/xml etree elementtree xmlparser-objects14012008
Ref: 3dde14012008
Ref: library/xml etree elementtree xml etree ElementTree XMLParser14012081
Ref: c4d14012081
Ref: library/xml etree elementtree xml etree ElementTree XMLParser close14013027
Ref: 3de014013027
Ref: library/xml etree elementtree xml etree ElementTree XMLParser feed14013337
Ref: 3ddf14013337
Ref: library/xml etree elementtree xml etree ElementTree XMLParser flush14013491
Ref: 57614013491
Ref: XMLParser オブジェクト-Footnote-114016294
Node: XMLPullParser オブジェクト14016686
Ref: library/xml etree elementtree elementtree-xmlpullparser-objects14016832
Ref: 3de114016832
Ref: library/xml etree elementtree xmlpullparser-objects14016832
Ref: 3de214016832
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser14016913
Ref: 11f914016913
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser feed14017820
Ref: 3d9d14017820
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser flush14017928
Ref: 57714017928
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser close14018765
Ref: 3de314018765
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser read_events14019193
Ref: 3d9e14019193
Node: 例外<22>14021120
Ref: library/xml etree elementtree exceptions14021229
Ref: 3de414021229
Ref: library/xml etree elementtree xml etree ElementTree ParseError14021262
Ref: 149314021262
Ref: library/xml etree elementtree xml etree ElementTree ParseError code14021626
Ref: 3de514021626
Ref: library/xml etree elementtree xml etree ElementTree ParseError position14021890
Ref: 3de614021890
Node: xml dom --- ドキュメントオブジェクトモデル API14022043
Ref: library/xml dom doc14022286
Ref: 3de714022286
Ref: library/xml dom module-xml dom14022286
Ref: 12814022286
Ref: library/xml dom translation-repo14022286
Ref: 3de814022286
Ref: library/xml dom xml-dom-the-document-object-model-api14022286
Ref: 3de914022286
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-114027377
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-214027454
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-314027520
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-414027567
Node: モジュールコンテンツ<2>14027613
Ref: library/xml dom module-contents14027781
Ref: 3dec14027781
Ref: library/xml dom xml dom registerDOMImplementation14027905
Ref: 3ded14027905
Ref: library/xml dom xml dom getDOMImplementation14028537
Ref: 3dea14028537
Ref: library/xml dom xml dom EMPTY_NAMESPACE14029634
Ref: 3dee14029634
Ref: library/xml dom xml dom XML_NAMESPACE14030009
Ref: 3def14030009
Ref: library/xml dom xml dom XMLNS_NAMESPACE14030224
Ref: 3df014030224
Ref: library/xml dom xml dom XHTML_NAMESPACE14030424
Ref: 3df114030424
Ref: モジュールコンテンツ<2>-Footnote-114031169
Ref: モジュールコンテンツ<2>-Footnote-214031214
Ref: モジュールコンテンツ<2>-Footnote-314031271
Node: DOM 内のオブジェクト14031309
Ref: library/xml dom dom-objects14031495
Ref: 3df214031495
Ref: library/xml dom objects-in-the-dom14031495
Ref: 3df314031495
Node: DOMImplementation オブジェクト14036446
Ref: library/xml dom dom-implementation-objects14036579
Ref: 3df414036579
Ref: library/xml dom domimplementation-objects14036579
Ref: 3dfd14036579
Ref: library/xml dom xml dom DOMImplementation hasFeature14037080
Ref: 3dfe14037080
Ref: library/xml dom xml dom DOMImplementation createDocument14037309
Ref: 3dff14037309
Ref: library/xml dom xml dom DOMImplementation createDocumentType14038077
Ref: 3e0014038077
Node: Node オブジェクト14038442
Ref: library/xml dom dom-node-objects14038611
Ref: 3df514038611
Ref: library/xml dom node-objects14038611
Ref: 3e0114038611
Ref: library/xml dom xml dom Node nodeType14038750
Ref: 3e0214038750
Ref: library/xml dom xml dom Node parentNode14039272
Ref: 3e0314039272
Ref: library/xml dom xml dom Node attributes14039855
Ref: 3e0414039855
Ref: library/xml dom xml dom Node previousSibling14040138
Ref: 3e0514040138
Ref: library/xml dom xml dom Node nextSibling14040768
Ref: 3e0614040768
Ref: library/xml dom xml dom Node childNodes14041137
Ref: 3e0714041137
Ref: library/xml dom xml dom Node firstChild14041299
Ref: 3e0814041299
Ref: library/xml dom xml dom Node lastChild14041512
Ref: 3e0914041512
Ref: library/xml dom xml dom Node localName14041724
Ref: 3e0a14041724
Ref: library/xml dom xml dom Node prefix14041913
Ref: 3e0b14041913
Ref: library/xml dom xml dom Node namespaceURI14042118
Ref: 3e0c14042118
Ref: library/xml dom xml dom Node nodeName14042297
Ref: 3e0d14042297
Ref: library/xml dom xml dom Node nodeValue14042831
Ref: 3e0e14042831
Ref: library/xml dom xml dom Node hasAttributes14043134
Ref: 3e0f14043134
Ref: library/xml dom xml dom Node hasChildNodes14043269
Ref: 3e1014043269
Ref: library/xml dom xml dom Node isSameNode14043410
Ref: 3e1114043410
Ref: library/xml dom xml dom Node appendChild14044386
Ref: 3e1214044386
Ref: library/xml dom xml dom Node insertBefore14044649
Ref: 3e1314044649
Ref: library/xml dom xml dom Node removeChild14045104
Ref: 3e1414045104
Ref: library/xml dom xml dom Node replaceChild14045531
Ref: 3e1514045531
Ref: library/xml dom xml dom Node normalize14045840
Ref: 3e1614045840
Ref: library/xml dom xml dom Node cloneNode14046174
Ref: 3e1714046174
Node: NodeList オブジェクト14046406
Ref: library/xml dom dom-nodelist-objects14046570
Ref: 240b14046570
Ref: library/xml dom nodelist-objects14046570
Ref: 3e1814046570
Ref: library/xml dom xml dom NodeList item14047358
Ref: 3e1914047358
Ref: library/xml dom xml dom NodeList length14047614
Ref: 3e1a14047614
Node: DocumentType オブジェクト14048483
Ref: library/xml dom documenttype-objects14048651
Ref: 3e1b14048651
Ref: library/xml dom dom-documenttype-objects14048651
Ref: 3df614048651
Ref: library/xml dom xml dom DocumentType publicId14049477
Ref: 3e1c14049477
Ref: library/xml dom xml dom DocumentType systemId14049700
Ref: 3e1d14049700
Ref: library/xml dom xml dom DocumentType internalSubset14049943
Ref: 3e1e14049943
Ref: library/xml dom xml dom DocumentType name14050246
Ref: 3e1f14050246
Ref: library/xml dom xml dom DocumentType entities14050400
Ref: 3e2014050400
Ref: library/xml dom xml dom DocumentType notations14050898
Ref: 3e2114050898
Node: Document オブジェクト14051371
Ref: library/xml dom document-objects14051541
Ref: 3e2214051541
Ref: library/xml dom dom-document-objects14051541
Ref: 3df714051541
Ref: library/xml dom xml dom Document documentElement14051881
Ref: 17f014051881
Ref: library/xml dom xml dom Document createElement14051989
Ref: 3e2314051989
Ref: library/xml dom xml dom Document createElementNS14052349
Ref: 3e2414052349
Ref: library/xml dom xml dom Document createTextNode14052812
Ref: 3e2514052812
Ref: library/xml dom xml dom Document createComment14053110
Ref: 3e2614053110
Ref: library/xml dom xml dom Document createProcessingInstruction14053407
Ref: 3e2714053407
Ref: library/xml dom xml dom Document createAttribute14053744
Ref: 3e2814053744
Ref: library/xml dom xml dom Document createAttributeNS14054137
Ref: 3e2914054137
Ref: library/xml dom xml dom Document getElementsByTagName14054662
Ref: 3e2a14054662
Ref: library/xml dom xml dom Document getElementsByTagNameNS14054867
Ref: 3e2b14054867
Node: Element オブジェクト<2>14055207
Ref: library/xml dom dom-element-objects14055369
Ref: 3df814055369
Ref: library/xml dom element-objects14055369
Ref: 3e2c14055369
Ref: library/xml dom xml dom Element tagName14055567
Ref: 3e2d14055567
Ref: library/xml dom xml dom Element getElementsByTagName14055753
Ref: 3e2e14055753
Ref: library/xml dom xml dom Element getElementsByTagNameNS14055896
Ref: 3e2f14055896
Ref: library/xml dom xml dom Element hasAttribute14056057
Ref: 3e3014056057
Ref: library/xml dom xml dom Element hasAttributeNS14056221
Ref: 3e3114056221
Ref: library/xml dom xml dom Element getAttribute14056433
Ref: 3e3214056433
Ref: library/xml dom xml dom Element getAttributeNode14056701
Ref: 3e3314056701
Ref: library/xml dom xml dom Element getAttributeNS14056840
Ref: 3e3414056840
Ref: library/xml dom xml dom Element getAttributeNodeNS14057162
Ref: 3e3514057162
Ref: library/xml dom xml dom Element removeAttribute14057351
Ref: 3e3614057351
Ref: library/xml dom xml dom Element removeAttributeNode14057549
Ref: 3e3814057549
Ref: library/xml dom xml dom Element removeAttributeNS14057780
Ref: 3e3914057780
Ref: library/xml dom xml dom Element setAttribute14058083
Ref: 3e3a14058083
Ref: library/xml dom xml dom Element setAttributeNode14058195
Ref: 3e3b14058195
Ref: library/xml dom xml dom Element setAttributeNodeNS14058601
Ref: 3e3d14058601
Ref: library/xml dom xml dom Element setAttributeNS14059052
Ref: 3e3e14059052
Node: Attr オブジェクト14059374
Ref: library/xml dom attr-objects14059529
Ref: 3e3f14059529
Ref: library/xml dom dom-attr-objects14059529
Ref: 3df914059529
Ref: library/xml dom xml dom Attr name14059684
Ref: 3e4014059684
Ref: library/xml dom xml dom Attr localName14059846
Ref: 3e4114059846
Ref: library/xml dom xml dom Attr prefix14059992
Ref: 3e4214059992
Ref: library/xml dom xml dom Attr value14060135
Ref: 3e4314060135
Node: NamedNodeMap Objects14060248
Ref: library/xml dom dom-attributelist-objects14060400
Ref: 3e4414060400
Ref: library/xml dom namednodemap-objects14060400
Ref: 3e4514060400
Ref: library/xml dom xml dom NamedNodeMap length14060533
Ref: 3e4614060533
Ref: library/xml dom xml dom NamedNodeMap item14060609
Ref: 3e4714060609
Node: Comment オブジェクト14061273
Ref: library/xml dom comment-objects14061466
Ref: 3e4814061466
Ref: library/xml dom dom-comment-objects14061466
Ref: 3dfa14061466
Ref: library/xml dom xml dom Comment data14061713
Ref: 3e4914061713
Node: Text オブジェクトおよび CDATASection オブジェクト14062028
Ref: library/xml dom dom-text-objects14062241
Ref: 3dfb14062241
Ref: library/xml dom text-and-cdatasection-objects14062241
Ref: 3e4a14062241
Ref: library/xml dom xml dom Text data14062988
Ref: 3e4b14062988
Node: ProcessingInstruction オブジェクト14063612
Ref: library/xml dom dom-pi-objects14063809
Ref: 3dfc14063809
Ref: library/xml dom processinginstruction-objects14063809
Ref: 3e4c14063809
Ref: library/xml dom xml dom ProcessingInstruction target14064070
Ref: 3e4d14064070
Ref: library/xml dom xml dom ProcessingInstruction data14064218
Ref: 3e4e14064218
Node: 例外<23>14064328
Ref: library/xml dom dom-exceptions14064452
Ref: 3e4f14064452
Ref: library/xml dom exceptions14064452
Ref: 3e5014064452
Ref: library/xml dom xml dom DOMException14065291
Ref: 3e5114065291
Ref: library/xml dom xml dom DomstringSizeErr14065502
Ref: 3e5214065502
Ref: library/xml dom xml dom HierarchyRequestErr14065836
Ref: 3e5314065836
Ref: library/xml dom xml dom IndexSizeErr14065977
Ref: 3e5414065977
Ref: library/xml dom xml dom InuseAttributeErr14066159
Ref: 3e3c14066159
Ref: library/xml dom xml dom InvalidAccessErr14066322
Ref: 3e5514066322
Ref: library/xml dom xml dom InvalidCharacterErr14066499
Ref: 3e5614066499
Ref: library/xml dom xml dom InvalidModificationErr14066873
Ref: 3e5714066873
Ref: library/xml dom xml dom InvalidStateErr14066996
Ref: 3e5814066996
Ref: library/xml dom xml dom NamespaceErr14067199
Ref: 3e5914067199
Ref: library/xml dom xml dom NotFoundErr14067408
Ref: 3e3714067408
Ref: library/xml dom xml dom NotSupportedErr14067735
Ref: 3e5a14067735
Ref: library/xml dom xml dom NoDataAllowedErr14067905
Ref: 3e5b14067905
Ref: library/xml dom xml dom NoModificationAllowedErr14068058
Ref: 3e5c14068058
Ref: library/xml dom xml dom SyntaxErr14068289
Ref: 3e5d14068289
Ref: library/xml dom xml dom WrongDocumentErr14068405
Ref: 3e5e14068405
Ref: 例外<23>-Footnote-114071492
Node: 適合性14071537
Ref: library/xml dom conformance14071681
Ref: 3e5f14071681
Ref: library/xml dom dom-conformance14071681
Ref: 3deb14071681
Node: 型の対応付け14071961
Ref: library/xml dom dom-type-mapping14072058
Ref: 3e6014072058
Ref: library/xml dom type-mapping14072058
Ref: 3e6114072058
Node: アクセサメソッド14072931
Ref: library/xml dom accessor-methods14073028
Ref: 3e6214073028
Ref: library/xml dom dom-accessor-methods14073028
Ref: 3e6314073028
Node: xml dom minidom --- 最小限の DOM の実装14075552
Ref: library/xml dom minidom doc14075817
Ref: 3e6414075817
Ref: library/xml dom minidom module-xml dom minidom14075817
Ref: 12914075817
Ref: library/xml dom minidom translation-repo14075817
Ref: 3e6514075817
Ref: library/xml dom minidom xml-dom-minidom-minimal-dom-implementation14075817
Ref: 3e6614075817
Ref: library/xml dom minidom xml dom minidom parse14077092
Ref: 3e6714077092
Ref: library/xml dom minidom xml dom minidom parseString14077859
Ref: 3e6814077859
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-114080619
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-214080695
Node: DOM オブジェクト14080742
Ref: library/xml dom minidom dom-objects14080866
Ref: 3e6914080866
Ref: library/xml dom minidom minidom-objects14080866
Ref: 3e6a14080866
Ref: library/xml dom minidom xml dom minidom Node unlink14081112
Ref: 3e6b14081112
Ref: library/xml dom minidom xml dom minidom Node writexml14082252
Ref: c8d14082252
Ref: library/xml dom minidom xml dom minidom Node toxml14083830
Ref: c8e14083830
Ref: library/xml dom minidom xml dom minidom Node toprettyxml14084878
Ref: c8f14084878
Ref: DOM オブジェクト-Footnote-114085740
Node: DOM の例14086226
Ref: library/xml dom minidom dom-example14086381
Ref: 3e6c14086381
Ref: library/xml dom minidom id214086381
Ref: 3e6d14086381
Node: minidom と DOM 標準14088437
Ref: library/xml dom minidom minidom-and-dom14088561
Ref: 3e6e14088561
Ref: library/xml dom minidom minidom-and-the-dom-standard14088561
Ref: 3e6f14088561
Node: xml dom pulldom --- 部分的な DOM ツリー構築のサポート14091872
Ref: library/xml dom pulldom doc14092120
Ref: 3e7014092120
Ref: library/xml dom pulldom module-xml dom pulldom14092120
Ref: 12a14092120
Ref: library/xml dom pulldom translation-repo14092120
Ref: 3e7114092120
Ref: library/xml dom pulldom xml-dom-pulldom-support-for-building-partial-dom-trees14092120
Ref: 3e7214092120
Ref: library/xml dom pulldom xml dom pulldom PullDOM14095009
Ref: 3e7414095009
Ref: library/xml dom pulldom xml dom pulldom SAX2DOM14095150
Ref: 3e7614095150
Ref: library/xml dom pulldom xml dom pulldom parse14095291
Ref: 3e7714095291
Ref: library/xml dom pulldom xml dom pulldom parseString14096061
Ref: 3e7914096061
Ref: library/xml dom pulldom xml dom pulldom default_bufsize14096222
Ref: 3e7a14096222
Ref: xml dom pulldom --- 部分的な DOM ツリー構築のサポート-Footnote-114096611
Node: DOMEventStream オブジェクト14096687
Ref: library/xml dom pulldom domeventstream-objects14096824
Ref: 3e7b14096824
Ref: library/xml dom pulldom id114096824
Ref: 3e7c14096824
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream14096905
Ref: 94214096905
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream getEvent14097103
Ref: 3e7d14097103
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream expandNode14097630
Ref: 3e7314097630
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream reset14098358
Ref: 3e7e14098358
Node: xml sax --- SAX2 バーサーのサポート14098391
Ref: library/xml sax doc14098650
Ref: 3e7f14098650
Ref: library/xml sax module-xml sax14098650
Ref: 13014098650
Ref: library/xml sax translation-repo14098650
Ref: 3e8014098650
Ref: library/xml sax xml-sax-support-for-sax2-parsers14098650
Ref: 3e8114098650
Ref: library/xml sax xml sax make_parser14099908
Ref: 1e7814099908
Ref: library/xml sax xml sax parse14100590
Ref: 1e4314100590
Ref: library/xml sax xml sax parseString14101472
Ref: 10a014101472
Ref: library/xml sax xml sax SAXException14103834
Ref: 3e8614103834
Ref: library/xml sax xml sax SAXParseException14104889
Ref: 3e8414104889
Ref: library/xml sax xml sax SAXNotRecognizedException14105385
Ref: 3e8714105385
Ref: library/xml sax xml sax SAXNotSupportedException14105778
Ref: 3e8814105778
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-114106939
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-214107016
Node: SAXException オブジェクト14107051
Ref: library/xml sax sax-exception-objects14107163
Ref: 3e8914107163
Ref: library/xml sax saxexception-objects14107163
Ref: 3e8a14107163
Ref: library/xml sax xml sax SAXException getMessage14107339
Ref: 3e8b14107339
Ref: library/xml sax xml sax SAXException getException14107455
Ref: 3e8c14107455
Node: xml sax handler --- SAX ハンドラーの基底クラス14107594
Ref: library/xml sax handler doc14107835
Ref: 3e8d14107835
Ref: library/xml sax handler module-xml sax handler14107835
Ref: 13114107835
Ref: library/xml sax handler translation-repo14107835
Ref: 3e8e14107835
Ref: library/xml sax handler xml-sax-handler-base-classes-for-sax-handlers14107835
Ref: 3e8f14107835
Ref: library/xml sax handler xml sax handler ContentHandler14108545
Ref: 3e7514108545
Ref: library/xml sax handler xml sax handler DTDHandler14108868
Ref: 3e9014108868
Ref: library/xml sax handler xml sax handler EntityResolver14109140
Ref: 3e9114109140
Ref: library/xml sax handler xml sax handler ErrorHandler14109500
Ref: 3e8314109500
Ref: library/xml sax handler xml sax handler LexicalHandler14109879
Ref: a6014109879
Ref: library/xml sax handler xml sax handler feature_namespaces14110168
Ref: 3e9214110168
Ref: library/xml sax handler xml sax handler feature_namespace_prefixes14110568
Ref: 3e9314110568
Ref: library/xml sax handler xml sax handler feature_string_interning14111096
Ref: 3e9414111096
Ref: library/xml sax handler xml sax handler feature_validation14111614
Ref: 3e9514111614
Ref: library/xml sax handler xml sax handler feature_external_ges14112045
Ref: 183814112045
Ref: library/xml sax handler xml sax handler feature_external_pes14112674
Ref: 3e9614112674
Ref: library/xml sax handler xml sax handler all_features14113131
Ref: 3e9714113131
Ref: library/xml sax handler xml sax handler property_lexical_handler14113207
Ref: 3e9814113207
Ref: library/xml sax handler xml sax handler property_declaration_handler14113557
Ref: 3e9914113557
Ref: library/xml sax handler xml sax handler property_dom_node14113949
Ref: 3e9a14113949
Ref: library/xml sax handler xml sax handler property_xml_string14114395
Ref: 3e9b14114395
Ref: library/xml sax handler xml sax handler all_properties14114664
Ref: 3e9c14114664
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-114114982
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-214115058
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-314115123
Node: ContentHandler オブジェクト14115174
Ref: library/xml sax handler content-handler-objects14115339
Ref: 3e9d14115339
Ref: library/xml sax handler contenthandler-objects14115339
Ref: 3e9e14115339
Ref: library/xml sax handler xml sax handler ContentHandler setDocumentLocator14115695
Ref: 3e9f14115695
Ref: library/xml sax handler xml sax handler ContentHandler startDocument14116998
Ref: 3ea014116998
Ref: library/xml sax handler xml sax handler ContentHandler endDocument14117328
Ref: 3ea114117328
Ref: library/xml sax handler xml sax handler ContentHandler startPrefixMapping14117765
Ref: 3ea214117765
Ref: library/xml sax handler xml sax handler ContentHandler endPrefixMapping14119126
Ref: 3ea314119126
Ref: library/xml sax handler xml sax handler ContentHandler startElement14119555
Ref: 176114119555
Ref: library/xml sax handler xml sax handler ContentHandler endElement14120172
Ref: 176214120172
Ref: library/xml sax handler xml sax handler ContentHandler startElementNS14120418
Ref: 3ea514120418
Ref: library/xml sax handler xml sax handler ContentHandler endElementNS14121404
Ref: 3ea714121404
Ref: library/xml sax handler xml sax handler ContentHandler characters14121688
Ref: 176314121688
Ref: library/xml sax handler xml sax handler ContentHandler ignorableWhitespace14123092
Ref: 3ea814123092
Ref: library/xml sax handler xml sax handler ContentHandler processingInstruction14124009
Ref: 3ea914124009
Ref: library/xml sax handler xml sax handler ContentHandler skippedEntity14124581
Ref: 3eaa14124581
Node: DTDHandler オブジェクト14125230
Ref: library/xml sax handler dtd-handler-objects14125437
Ref: 3eab14125437
Ref: library/xml sax handler dtdhandler-objects14125437
Ref: 3eac14125437
Ref: library/xml sax handler xml sax handler DTDHandler notationDecl14125599
Ref: 3ead14125599
Ref: library/xml sax handler xml sax handler DTDHandler unparsedEntityDecl14125727
Ref: 3eae14125727
Node: EntityResolver オブジェクト14125905
Ref: library/xml sax handler entity-resolver-objects14126110
Ref: 3eaf14126110
Ref: library/xml sax handler entityresolver-objects14126110
Ref: 3eb014126110
Ref: library/xml sax handler xml sax handler EntityResolver resolveEntity14126193
Ref: 3eb114126193
Node: ErrorHandler オブジェクト14126528
Ref: library/xml sax handler errorhandler-objects14126726
Ref: 3eb214126726
Ref: library/xml sax handler sax-error-handler14126726
Ref: 3eb314126726
Ref: library/xml sax handler xml sax handler ErrorHandler error14127390
Ref: 3eb414127390
Ref: library/xml sax handler xml sax handler ErrorHandler fatalError14127870
Ref: 3eb514127870
Ref: library/xml sax handler xml sax handler ErrorHandler warning14128107
Ref: 3eb614128107
Node: LexicalHandler Objects14128525
Ref: library/xml sax handler lexical-handler-objects14128681
Ref: 3eb714128681
Ref: library/xml sax handler lexicalhandler-objects14128681
Ref: 3eb814128681
Ref: library/xml sax handler xml sax handler LexicalHandler comment14129286
Ref: 3eb914129286
Ref: library/xml sax handler xml sax handler LexicalHandler startDTD14129446
Ref: 3eba14129446
Ref: library/xml sax handler xml sax handler LexicalHandler endDTD14129610
Ref: 3ebb14129610
Ref: library/xml sax handler xml sax handler LexicalHandler startCDATA14129696
Ref: 3ebc14129696
Ref: library/xml sax handler xml sax handler LexicalHandler endCDATA14129896
Ref: 3ebd14129896
Node: xml sax saxutils --- SAX ユーティリティー14129991
Ref: library/xml sax utils doc14130253
Ref: 3ebe14130253
Ref: library/xml sax utils module-xml sax saxutils14130253
Ref: 13214130253
Ref: library/xml sax utils translation-repo14130253
Ref: 3ebf14130253
Ref: library/xml sax utils xml-sax-saxutils-sax-utilities14130253
Ref: 3ec014130253
Ref: library/xml sax utils xml sax saxutils escape14130663
Ref: 3ec114130663
Ref: library/xml sax utils xml sax saxutils unescape14131455
Ref: 3ec214131455
Ref: library/xml sax utils xml sax saxutils quoteattr14131964
Ref: 3ec314131964
Ref: library/xml sax utils xml sax saxutils XMLGenerator14132925
Ref: 3ec414132925
Ref: library/xml sax utils xml sax saxutils XMLFilterBase14133989
Ref: 3ec514133989
Ref: library/xml sax utils xml sax saxutils prepare_input_source14134602
Ref: 3ec614134602
Ref: xml sax saxutils --- SAX ユーティリティー-Footnote-114135185
Node: xml sax xmlreader --- XML パーサーのインターフェース14135262
Ref: library/xml sax reader doc14135530
Ref: 3ec814135530
Ref: library/xml sax reader module-xml sax xmlreader14135530
Ref: 13314135530
Ref: library/xml sax reader translation-repo14135530
Ref: 3ec914135530
Ref: library/xml sax reader xml-sax-xmlreader-interface-for-xml-parsers14135530
Ref: 3eca14135530
Ref: library/xml sax reader xml sax xmlreader XMLReader14136131
Ref: 3e7814136131
Ref: library/xml sax reader xml sax xmlreader IncrementalParser14136237
Ref: 3ecb14136237
Ref: library/xml sax reader xml sax xmlreader Locator14137758
Ref: 3e8514137758
Ref: library/xml sax reader xml sax xmlreader InputSource14138196
Ref: 109f14138196
Ref: library/xml sax reader xml sax xmlreader AttributesImpl14139162
Ref: 3ecc14139162
Ref: library/xml sax reader xml sax xmlreader AttributesNSImpl14139858
Ref: 3ecd14139858
Ref: xml sax xmlreader --- XML パーサーのインターフェース-Footnote-114140722
Node: XMLReader オブジェクト14140800
Ref: library/xml sax reader id114140975
Ref: 3ece14140975
Ref: library/xml sax reader xmlreader-objects14140975
Ref: 3ecf14140975
Ref: library/xml sax reader xml sax xmlreader XMLReader parse14141119
Ref: 3ec714141119
Ref: library/xml sax reader xml sax xmlreader XMLReader getContentHandler14141913
Ref: 3ed014141913
Ref: library/xml sax reader xml sax xmlreader XMLReader setContentHandler14142026
Ref: 3ed114142026
Ref: library/xml sax reader xml sax xmlreader XMLReader getDTDHandler14142254
Ref: 3ed214142254
Ref: library/xml sax reader xml sax xmlreader XMLReader setDTDHandler14142359
Ref: 3ed314142359
Ref: library/xml sax reader xml sax xmlreader XMLReader getEntityResolver14142568
Ref: 3ed414142568
Ref: library/xml sax reader xml sax xmlreader XMLReader setEntityResolver14142681
Ref: 3ed514142681
Ref: library/xml sax reader xml sax xmlreader XMLReader getErrorHandler14143036
Ref: 3ed614143036
Ref: library/xml sax reader xml sax xmlreader XMLReader setErrorHandler14143145
Ref: 3ed714143145
Ref: library/xml sax reader xml sax xmlreader XMLReader setLocale14143398
Ref: 3ed814143398
Ref: library/xml sax reader xml sax xmlreader XMLReader getFeature14143906
Ref: 3ed914143906
Ref: library/xml sax reader xml sax xmlreader XMLReader setFeature14144230
Ref: 3e8214144230
Ref: library/xml sax reader xml sax xmlreader XMLReader getProperty14144620
Ref: 3eda14144620
Ref: library/xml sax reader xml sax xmlreader XMLReader setProperty14144947
Ref: 3edb14144947
Node: IncrementalParser オブジェクト14145340
Ref: library/xml sax reader incremental-parser-objects14145550
Ref: 3edc14145550
Ref: library/xml sax reader incrementalparser-objects14145550
Ref: 3edd14145550
Ref: library/xml sax reader xml sax xmlreader IncrementalParser feed14145740
Ref: 3ede14145740
Ref: library/xml sax reader xml sax xmlreader IncrementalParser close14145839
Ref: 3edf14145839
Ref: library/xml sax reader xml sax xmlreader IncrementalParser reset14146072
Ref: 3ee014146072
Node: Locator オブジェクト14146410
Ref: library/xml sax reader id214146622
Ref: 3ee114146622
Ref: library/xml sax reader locator-objects14146622
Ref: 3ee214146622
Ref: library/xml sax reader xml sax xmlreader Locator getColumnNumber14146775
Ref: 3ee314146775
Ref: library/xml sax reader xml sax xmlreader Locator getLineNumber14146891
Ref: 3ee414146891
Ref: library/xml sax reader xml sax xmlreader Locator getPublicId14147005
Ref: 3ee514147005
Ref: library/xml sax reader xml sax xmlreader Locator getSystemId14147117
Ref: 3ee614147117
Node: InputSource オブジェクト14147229
Ref: library/xml sax reader input-source-objects14147440
Ref: 3ee714147440
Ref: library/xml sax reader inputsource-objects14147440
Ref: 3ee814147440
Ref: library/xml sax reader xml sax xmlreader InputSource setPublicId14147517
Ref: 3ee914147517
Ref: library/xml sax reader xml sax xmlreader InputSource getPublicId14147643
Ref: 3eea14147643
Ref: library/xml sax reader xml sax xmlreader InputSource setSystemId14147764
Ref: 3eeb14147764
Ref: library/xml sax reader xml sax xmlreader InputSource getSystemId14147896
Ref: 3eec14147896
Ref: library/xml sax reader xml sax xmlreader InputSource setEncoding14148023
Ref: 3eed14148023
Ref: library/xml sax reader xml sax xmlreader InputSource getEncoding14148516
Ref: 3eee14148516
Ref: library/xml sax reader xml sax xmlreader InputSource setByteStream14148642
Ref: 3eef14148642
Ref: library/xml sax reader xml sax xmlreader InputSource getByteStream14149232
Ref: 3ef014149232
Ref: library/xml sax reader xml sax xmlreader InputSource setCharacterStream14149528
Ref: 3ef114149528
Ref: library/xml sax reader xml sax xmlreader InputSource getCharacterStream14149881
Ref: 3ef214149881
Node: Attributes インターフェース14150007
Ref: library/xml sax reader attributes-objects14150229
Ref: 3ea414150229
Ref: library/xml sax reader the-attributes-interface14150229
Ref: 3ef314150229
Ref: library/xml sax reader xml sax xmlreader Attributes getLength14150608
Ref: 3ef414150608
Ref: library/xml sax reader xml sax xmlreader Attributes getNames14150688
Ref: 3ef514150688
Ref: library/xml sax reader xml sax xmlreader Attributes getType14150770
Ref: 3ef614150770
Ref: library/xml sax reader xml sax xmlreader Attributes getValue14150902
Ref: 3ef714150902
Node: AttributesNS インターフェース14150993
Ref: library/xml sax reader attributes-ns-objects14151176
Ref: 3ea614151176
Ref: library/xml sax reader the-attributesns-interface14151176
Ref: 3ef814151176
Ref: library/xml sax reader xml sax xmlreader AttributesNS getValueByQName14151647
Ref: 3ef914151647
Ref: library/xml sax reader xml sax xmlreader AttributesNS getNameByQName14151742
Ref: 3efa14151742
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNameByName14151898
Ref: 3efb14151898
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNames14152039
Ref: 3efc14152039
Node: xml parsers expat --- Expat を使用した高速な XML 解析14152139
Ref: library/pyexpat doc14152349
Ref: 3efd14152349
Ref: library/pyexpat module-xml parsers expat14152349
Ref: 12d14152349
Ref: library/pyexpat translation-repo14152349
Ref: 3efe14152349
Ref: library/pyexpat xml-parsers-expat-fast-xml-parsing-using-expat14152349
Ref: 3eff14152349
Ref: library/pyexpat xml parsers expat ExpatError14153445
Ref: 149414153445
Ref: library/pyexpat xml parsers expat error14153700
Ref: 3f0114153700
Ref: library/pyexpat xml parsers expat XMLParserType14153786
Ref: 3f0214153786
Ref: library/pyexpat xml parsers expat ErrorString14153986
Ref: 3f0414153986
Ref: library/pyexpat xml parsers expat ParserCreate14154128
Ref: 3f0314154128
Ref: library/pyexpat xmlparser-non-root14154890
Ref: 3f0514154890
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-114157330
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-214157724
Node: XMLParser オブジェクト<2>14157757
Ref: library/pyexpat id214157914
Ref: 3f0614157914
Ref: library/pyexpat xmlparser-objects14157914
Ref: 179a14157914
Ref: library/pyexpat xml parsers expat xmlparser Parse14158072
Ref: 3f0714158072
Ref: library/pyexpat xml parsers expat xmlparser ParseFile14158569
Ref: 3f0814158569
Ref: library/pyexpat xml parsers expat xmlparser SetBase14158888
Ref: 3f0914158888
Ref: library/pyexpat xml parsers expat xmlparser GetBase14159341
Ref: 3f0d14159341
Ref: library/pyexpat xml parsers expat xmlparser GetInputContext14159590
Ref: 3f0e14159590
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityParserCreate14159983
Ref: 17d114159983
Ref: library/pyexpat xml parsers expat xmlparser SetParamEntityParsing14160608
Ref: 3f1114160608
Ref: library/pyexpat xml parsers expat xmlparser UseForeignDTD14161011
Ref: 3f1214161011
Ref: library/pyexpat xml parsers expat xmlparser SetReparseDeferralEnabled14162156
Ref: 57914162156
Ref: library/pyexpat xml parsers expat xmlparser GetReparseDeferralEnabled14163659
Ref: 57814163659
Ref: library/pyexpat xml parsers expat xmlparser SetBillionLaughsAttackProtectionActivationThreshold14163961
Ref: 179814163961
Ref: library/pyexpat xml parsers expat xmlparser SetBillionLaughsAttackProtectionMaximumAmplification14164859
Ref: 179914164859
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerActivationThreshold14166470
Ref: 182614166470
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerMaximumAmplification14167118
Ref: 182714167118
Ref: library/pyexpat xml parsers expat xmlparser buffer_size14168679
Ref: 179714168679
Ref: library/pyexpat xml parsers expat xmlparser buffer_text14169004
Ref: 16e014169004
Ref: library/pyexpat xml parsers expat xmlparser buffer_used14169550
Ref: 3f1714169550
Ref: library/pyexpat xml parsers expat xmlparser ordered_attributes14169875
Ref: 3f0f14169875
Ref: library/pyexpat xml parsers expat xmlparser specified_attributes14170498
Ref: 3f1014170498
Ref: library/pyexpat xml parsers expat xmlparser ErrorByteIndex14171500
Ref: 3f1814171500
Ref: library/pyexpat xml parsers expat xmlparser ErrorCode14171608
Ref: 3f1914171608
Ref: library/pyexpat xml parsers expat xmlparser ErrorColumnNumber14171857
Ref: 3f1a14171857
Ref: library/pyexpat xml parsers expat xmlparser ErrorLineNumber14171956
Ref: 3f1b14171956
Ref: library/pyexpat xml parsers expat xmlparser CurrentByteIndex14172532
Ref: 3f1c14172532
Ref: library/pyexpat xml parsers expat xmlparser CurrentColumnNumber14172648
Ref: 3f1d14172648
Ref: library/pyexpat xml parsers expat xmlparser CurrentLineNumber14172755
Ref: 3f1e14172755
Ref: library/pyexpat xml parsers expat xmlparser XmlDeclHandler14173338
Ref: 3f1f14173338
Ref: library/pyexpat xml parsers expat xmlparser StartDoctypeDeclHandler14173999
Ref: 3f1314173999
Ref: library/pyexpat xml parsers expat xmlparser EndDoctypeDeclHandler14174557
Ref: 3f1414174557
Ref: library/pyexpat xml parsers expat xmlparser ElementDeclHandler14174769
Ref: 17c314174769
Ref: library/pyexpat xml parsers expat xmlparser AttlistDeclHandler14175010
Ref: 3f2014175010
Ref: library/pyexpat xml parsers expat xmlparser StartElementHandler14176083
Ref: 3f2114176083
Ref: library/pyexpat xml parsers expat xmlparser EndElementHandler14176515
Ref: 3f2214176515
Ref: library/pyexpat xml parsers expat xmlparser ProcessingInstructionHandler14176639
Ref: 3f2314176639
Ref: library/pyexpat xml parsers expat xmlparser CharacterDataHandler14176779
Ref: 179614176779
Ref: library/pyexpat xml parsers expat xmlparser UnparsedEntityDeclHandler14177444
Ref: 3f0c14177444
Ref: library/pyexpat xml parsers expat xmlparser EntityDeclHandler14178024
Ref: 3f2614178024
Ref: library/pyexpat xml parsers expat xmlparser NotationDeclHandler14179103
Ref: 3f0b14179103
Ref: library/pyexpat xml parsers expat xmlparser StartNamespaceDeclHandler14179486
Ref: 3f2714179486
Ref: library/pyexpat xml parsers expat xmlparser EndNamespaceDeclHandler14179805
Ref: 3f2814179805
Ref: library/pyexpat xml parsers expat xmlparser CommentHandler14180398
Ref: 3f2914180398
Ref: library/pyexpat xml parsers expat xmlparser StartCdataSectionHandler14180624
Ref: 3f2414180624
Ref: library/pyexpat xml parsers expat xmlparser EndCdataSectionHandler14180934
Ref: 3f2514180934
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandler14181056
Ref: 3f2a14181056
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandlerExpand14181449
Ref: 3f2b14181449
Ref: library/pyexpat xml parsers expat xmlparser NotStandaloneHandler14181711
Ref: 3f2c14181711
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityRefHandler14182333
Ref: 3f0a14182333
Ref: XMLParser オブジェクト<2>-Footnote-114184177
Ref: XMLParser オブジェクト<2>-Footnote-214184237
Ref: XMLParser オブジェクト<2>-Footnote-314184297
Ref: XMLParser オブジェクト<2>-Footnote-414184362
Node: ExpatError 例外14184413
Ref: library/pyexpat expaterror-exceptions14184592
Ref: 3f2d14184592
Ref: library/pyexpat expaterror-objects14184592
Ref: 3f0014184592
Ref: library/pyexpat xml parsers expat ExpatError code14184737
Ref: 3f2e14184737
Ref: library/pyexpat xml parsers expat ExpatError lineno14185495
Ref: 3f1514185495
Ref: library/pyexpat xml parsers expat ExpatError offset14185632
Ref: 3f1614185632
Node: 使用例<35>14185795
Ref: library/pyexpat example14185967
Ref: 3f3114185967
Ref: library/pyexpat expat-example14185967
Ref: 3f3214185967
Node: 内容モデルの記述14187144
Ref: library/pyexpat content-model-descriptions14187320
Ref: 3f3314187320
Ref: library/pyexpat expat-content-models14187320
Ref: 3f3414187320
Ref: library/pyexpat module-xml parsers expat model14187320
Ref: 12f14187320
Node: Expat エラー定数14189541
Ref: library/pyexpat expat-error-constants14189695
Ref: 3f3514189695
Ref: library/pyexpat expat-errors14189695
Ref: 3f3614189695
Ref: library/pyexpat module-xml parsers expat errors14189695
Ref: 12e14189695
Ref: library/pyexpat xml parsers expat errors codes14190284
Ref: 3f3014190284
Ref: library/pyexpat xml parsers expat errors messages14190438
Ref: 3f2f14190438
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ASYNC_ENTITY14190607
Ref: 3f3714190607
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF14190671
Ref: 3f3814190671
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BAD_CHAR_REF14190904
Ref: 3f3914190904
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BINARY_ENTITY_REF14191101
Ref: 3f3a14191101
Ref: library/pyexpat xml parsers expat errors XML_ERROR_DUPLICATE_ATTRIBUTE14191327
Ref: 3f3b14191327
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCORRECT_ENCODING14191492
Ref: 3f3c14191492
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_TOKEN14191562
Ref: 3f3d14191562
Ref: library/pyexpat xml parsers expat errors XML_ERROR_JUNK_AFTER_DOC_ELEMENT14191830
Ref: 3f3e14191830
Ref: library/pyexpat xml parsers expat errors XML_ERROR_MISPLACED_XML_PI14191983
Ref: 3f3f14191983
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_ELEMENTS14192138
Ref: 3f4014192138
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_MEMORY14192368
Ref: 3f4114192368
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARAM_ENTITY_REF14192496
Ref: 3f4214192496
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARTIAL_CHAR14192664
Ref: 3f4314192664
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RECURSIVE_ENTITY_REF14192789
Ref: 3f4414192789
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SYNTAX14193061
Ref: 3f4514193061
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TAG_MISMATCH14193204
Ref: 3f4614193204
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_TOKEN14193359
Ref: 3f4714193359
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDEFINED_ENTITY14193589
Ref: 3f4814193589
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNKNOWN_ENCODING14193742
Ref: 3f4914193742
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_CDATA_SECTION14193902
Ref: 3f4a14193902
Ref: library/pyexpat xml parsers expat errors XML_ERROR_EXTERNAL_ENTITY_HANDLING14194036
Ref: 3f4b14194036
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STANDALONE14194112
Ref: 3f4c14194112
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNEXPECTED_STATE14194409
Ref: 3f4d14194409
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ENTITY_DECLARED_IN_PE14194477
Ref: 3f4e14194477
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FEATURE_REQUIRES_XML_DTD14194550
Ref: 3f4f14194550
Ref: library/pyexpat xml parsers expat errors XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING14194855
Ref: 3f5014194855
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNBOUND_PREFIX14195198
Ref: 3f5114195198
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDECLARING_PREFIX14195385
Ref: 3f5214195385
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCOMPLETE_PE14195570
Ref: 3f5314195570
Ref: library/pyexpat xml parsers expat errors XML_ERROR_XML_DECL14195732
Ref: 3f5414195732
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TEXT_DECL14195841
Ref: 3f5514195841
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PUBLICID14195987
Ref: 3f5614195987
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPENDED14196125
Ref: 3f5714196125
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_SUSPENDED14196487
Ref: 3f5814196487
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ABORTED14196646
Ref: 3f5914196646
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FINISHED14196772
Ref: 3f5a14196772
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPEND_PE14197148
Ref: 3f5b14197148
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XML14197210
Ref: 3f5c14197210
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XMLNS14197401
Ref: 3f5d14197401
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_NAMESPACE_URI14197568
Ref: 3f5e14197568
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_ARGUMENT14197783
Ref: 3f5f14197783
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_BUFFER14197918
Ref: 3f6014197918
Ref: library/pyexpat xml parsers expat errors XML_ERROR_AMPLIFICATION_LIMIT_BREACH14198046
Ref: 3f6114198046
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STARTED14198228
Ref: 193514198228
Node: インターネットプロトコルとサポート14198406
Ref: library/internet doc14198609
Ref: 3f6214198609
Ref: library/internet internet14198609
Ref: 3f6314198609
Ref: library/internet internet-protocols-and-support14198609
Ref: 3f6414198609
Ref: library/internet translation-repo14198609
Ref: 3f6514198609
Node: webbrowser --- 便利なウェブブラウザコントローラー14201707
Ref: library/webbrowser doc14201935
Ref: 3f6614201935
Ref: library/webbrowser module-webbrowser14201935
Ref: 11c14201935
Ref: library/webbrowser webbrowser-convenient-web-browser-controller14201935
Ref: 3f6714201935
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-114204716
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-214204786
Node: コマンドライン・インターフェース<6>14204964
Ref: library/webbrowser command-line-interface14205153
Ref: 3f6814205153
Ref: library/webbrowser webbrowser-cli14205153
Ref: 3f6914205153
Ref: library/webbrowser cmdoption-webbrowser-n14205520
Ref: 3f6a14205520
Ref: library/webbrowser cmdoption-webbrowser-new-window14205520
Ref: 3f6b14205520
Ref: library/webbrowser cmdoption-webbrowser-t14205608
Ref: 3f6c14205608
Ref: library/webbrowser cmdoption-webbrowser-new-tab14205608
Ref: 3f6d14205608
Ref: library/webbrowser webbrowser Error14205893
Ref: 3f6e14205893
Ref: library/webbrowser webbrowser open14206053
Ref: 17c514206053
Ref: library/webbrowser webbrowser open_new14207230
Ref: 3f6f14207230
Ref: library/webbrowser webbrowser open_new_tab14207587
Ref: 3f7014207587
Ref: library/webbrowser webbrowser get14207941
Ref: 3f7114207941
Ref: library/webbrowser webbrowser register14208234
Ref: 3f7214208234
Node: Browser controller objects14215233
Ref: library/webbrowser browser-controller-objects14215422
Ref: 3f7314215422
Ref: library/webbrowser browser-controllers14215422
Ref: 3f7414215422
Ref: library/webbrowser webbrowser controller name14215639
Ref: 59a14215639
Ref: library/webbrowser webbrowser controller open14215717
Ref: 3f7514215717
Ref: library/webbrowser webbrowser controller open_new14216100
Ref: 3f7614216100
Ref: library/webbrowser webbrowser controller open_new_tab14216440
Ref: 3f7714216440
Node: wsgiref --- WSGI ユーティリティとリファレンス実装14216737
Ref: library/wsgiref doc14217016
Ref: 3f7814217016
Ref: library/wsgiref module-wsgiref14217016
Ref: 11f14217016
Ref: library/wsgiref translation-repo14217016
Ref: 3f7914217016
Ref: library/wsgiref wsgiref-wsgi-utilities-and-reference-implementation14217016
Ref: 3f7a14217016
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-114219456
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-214219520
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-314219562
Node: wsgiref util -- WSGI environment utilities14219599
Ref: library/wsgiref module-wsgiref util14219797
Ref: 12414219797
Ref: library/wsgiref wsgiref-util-wsgi-environment-utilities14219797
Ref: 3f7b14219797
Ref: library/wsgiref wsgiref util guess_scheme14220432
Ref: 3f7d14220432
Ref: library/wsgiref wsgiref util request_uri14221254
Ref: 3f7e14221254
Ref: library/wsgiref wsgiref util application_uri14221648
Ref: 3f7f14221648
Ref: library/wsgiref wsgiref util shift_path_info14221970
Ref: 3f8014221970
Ref: library/wsgiref wsgiref util setup_testing_defaults14224085
Ref: 3f8114224085
Ref: library/wsgiref wsgiref util is_hop_by_hop14226136
Ref: 1a9d14226136
Ref: library/wsgiref wsgiref util FileWrapper14226337
Ref: 94314226337
Ref: wsgiref util -- WSGI environment utilities-Footnote-114227674
Ref: wsgiref util -- WSGI environment utilities-Footnote-214227716
Ref: wsgiref util -- WSGI environment utilities-Footnote-314227758
Ref: wsgiref util -- WSGI environment utilities-Footnote-414227800
Ref: wsgiref util -- WSGI environment utilities-Footnote-514227842
Node: wsgiref headers -- WSGI response header tools14227901
Ref: library/wsgiref module-wsgiref headers14228158
Ref: 12114228158
Ref: library/wsgiref wsgiref-headers-wsgi-response-header-tools14228158
Ref: 3f8414228158
Ref: library/wsgiref wsgiref headers Headers14228467
Ref: 109c14228467
Ref: library/wsgiref wsgiref headers Headers get_all14231233
Ref: 3f8514231233
Ref: library/wsgiref wsgiref headers Headers add_header14231805
Ref: 3f8614231805
Ref: wsgiref headers -- WSGI response header tools-Footnote-114233340
Node: wsgiref simple_server -- a simple WSGI HTTP server14233382
Ref: library/wsgiref module-wsgiref simple_server14233642
Ref: 12214233642
Ref: library/wsgiref wsgiref-simple-server-a-simple-wsgi-http-server14233642
Ref: 3f8714233642
Ref: library/wsgiref wsgiref simple_server make_server14234460
Ref: 3f8814234460
Ref: library/wsgiref wsgiref simple_server demo_app14235401
Ref: 3f8214235401
Ref: library/wsgiref wsgiref simple_server WSGIServer14235927
Ref: 3f8a14235927
Ref: library/wsgiref wsgiref simple_server WSGIServer set_app14236818
Ref: 3f8c14236818
Ref: library/wsgiref wsgiref simple_server WSGIServer get_app14237025
Ref: 3f8d14237025
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler14237454
Ref: 3f8e14237454
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_environ14238292
Ref: 3f8f14238292
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_stderr14238883
Ref: 3f9014238883
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler handle14239103
Ref: 3f9114239103
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-114239470
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-214239512
Node: wsgiref validate --- WSGI conformance checker14239554
Ref: library/wsgiref module-wsgiref validate14239816
Ref: 12514239816
Ref: library/wsgiref wsgiref-validate-wsgi-conformance-checker14239816
Ref: 3f9214239816
Ref: library/wsgiref wsgiref validate validator14240874
Ref: 3f9314240874
Ref: wsgiref validate --- WSGI conformance checker-Footnote-114243434
Ref: wsgiref validate --- WSGI conformance checker-Footnote-214243476
Ref: wsgiref validate --- WSGI conformance checker-Footnote-314243535
Node: wsgiref handlers -- server/gateway base classes14243577
Ref: library/wsgiref module-wsgiref handlers14243841
Ref: 12014243841
Ref: library/wsgiref wsgiref-handlers-server-gateway-base-classes14243841
Ref: 3f9414243841
Ref: library/wsgiref wsgiref handlers CGIHandler14244315
Ref: 3f9514244315
Ref: library/wsgiref wsgiref handlers IISCGIHandler14245204
Ref: 3f9714245204
Ref: library/wsgiref wsgiref handlers BaseCGIHandler14246658
Ref: 3f9614246658
Ref: library/wsgiref wsgiref handlers SimpleHandler14247732
Ref: 3f9814247732
Ref: library/wsgiref wsgiref handlers BaseHandler14248774
Ref: 1e2f14248774
Ref: library/wsgiref wsgiref handlers BaseHandler run14249282
Ref: 3f9e14249282
Ref: library/wsgiref wsgiref handlers BaseHandler _write14249792
Ref: 3f9c14249792
Ref: library/wsgiref wsgiref handlers BaseHandler _flush14250252
Ref: 3f9d14250252
Ref: library/wsgiref wsgiref handlers BaseHandler get_stdin14250538
Ref: 3f9914250538
Ref: library/wsgiref wsgiref handlers BaseHandler get_stderr14250747
Ref: 3f9a14250747
Ref: library/wsgiref wsgiref handlers BaseHandler add_cgi_vars14250958
Ref: 3f9b14250958
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multithread14251609
Ref: 3fa114251609
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multiprocess14251968
Ref: 3fa214251968
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_run_once14252329
Ref: 3fa314252329
Ref: library/wsgiref wsgiref handlers BaseHandler os_environ14252600
Ref: 3fa414252600
Ref: library/wsgiref wsgiref handlers BaseHandler server_software14253098
Ref: 3fa514253098
Ref: library/wsgiref wsgiref handlers BaseHandler get_scheme14253781
Ref: 3fa714253781
Ref: library/wsgiref wsgiref handlers BaseHandler setup_environ14254151
Ref: 3fa814254151
Ref: library/wsgiref wsgiref handlers BaseHandler log_exception14254885
Ref: 3faa14254885
Ref: library/wsgiref wsgiref handlers BaseHandler traceback_limit14255561
Ref: 3fab14255561
Ref: library/wsgiref wsgiref handlers BaseHandler error_output14255854
Ref: 3fac14255854
Ref: library/wsgiref wsgiref handlers BaseHandler error_status14257308
Ref: 3fad14257308
Ref: library/wsgiref wsgiref handlers BaseHandler error_headers14257580
Ref: 3fae14257580
Ref: library/wsgiref wsgiref handlers BaseHandler error_body14257992
Ref: 3faf14257992
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_file_wrapper14258471
Ref: 3fa914258471
Ref: library/wsgiref wsgiref handlers BaseHandler sendfile14258744
Ref: 3fb014258744
Ref: library/wsgiref wsgiref handlers BaseHandler origin_server14259400
Ref: 3fa614259400
Ref: library/wsgiref wsgiref handlers BaseHandler http_version14260013
Ref: 3fb114260013
Ref: library/wsgiref wsgiref handlers read_environ14260295
Ref: 13d514260295
Ref: wsgiref handlers -- server/gateway base classes-Footnote-114261204
Ref: wsgiref handlers -- server/gateway base classes-Footnote-214261246
Ref: wsgiref handlers -- server/gateway base classes-Footnote-314261288
Ref: wsgiref handlers -- server/gateway base classes-Footnote-414261330
Ref: wsgiref handlers -- server/gateway base classes-Footnote-514261372
Node: wsgiref types -- WSGI types for static type checking14261414
Ref: library/wsgiref module-wsgiref types14261646
Ref: 12314261646
Ref: library/wsgiref wsgiref-types-wsgi-types-for-static-type-checking14261646
Ref: 3fb214261646
Ref: library/wsgiref wsgiref types StartResponse14261891
Ref: 3f8914261891
Ref: library/wsgiref wsgiref types WSGIEnvironment14262033
Ref: 3f7c14262033
Ref: library/wsgiref wsgiref types WSGIApplication14262140
Ref: 3fb314262140
Ref: library/wsgiref wsgiref types InputStream14262245
Ref: 3f9f14262245
Ref: library/wsgiref wsgiref types ErrorStream14262358
Ref: 3fa014262358
Ref: library/wsgiref wsgiref types FileWrapper14262471
Ref: 3f8314262471
Ref: wsgiref types -- WSGI types for static type checking-Footnote-114262715
Ref: wsgiref types -- WSGI types for static type checking-Footnote-214262757
Ref: wsgiref types -- WSGI types for static type checking-Footnote-314262827
Ref: wsgiref types -- WSGI types for static type checking-Footnote-414262869
Ref: wsgiref types -- WSGI types for static type checking-Footnote-514262935
Ref: wsgiref types -- WSGI types for static type checking-Footnote-614263001
Node: 使用例<36>14263085
Ref: library/wsgiref examples14263261
Ref: 3fb414263261
Node: urllib --- URL を扱うモジュール群14266088
Ref: library/urllib doc14266369
Ref: 3fb514266369
Ref: library/urllib module-urllib14266369
Ref: 10f14266369
Ref: library/urllib translation-repo14266369
Ref: 3fb614266369
Ref: library/urllib urllib-url-handling-modules14266369
Ref: 3fb714266369
Ref: urllib --- URL を扱うモジュール群-Footnote-114267119
Node: urllib request --- URL を開くための大規模なライブラリ14267183
Ref: library/urllib request doc14267450
Ref: 3fb814267450
Ref: library/urllib request module-urllib request14267450
Ref: 11214267450
Ref: library/urllib request translation-repo14267450
Ref: 3fb914267450
Ref: library/urllib request urllib-request-extensible-library-for-opening-urls14267450
Ref: 3fba14267450
Ref: library/urllib request urllib request urlopen14268649
Ref: 30914268649
Ref: library/urllib request urllib request install_opener14273082
Ref: 3fc014273082
Ref: library/urllib request urllib request build_opener14273820
Ref: 30b14273820
Ref: library/urllib request urllib request pathname2url14275221
Ref: 2c114275221
Ref: library/urllib request urllib request url2pathname14276372
Ref: 2bf14276372
Ref: library/urllib request urllib request getproxies14278301
Ref: 3fbb14278301
Ref: library/urllib request urllib request Request14279779
Ref: 11de14279779
Ref: library/urllib request urllib request OpenerDirector14285413
Ref: 3fbe14285413
Ref: library/urllib request urllib request BaseHandler14285744
Ref: 3fc114285744
Ref: library/urllib request urllib request HTTPDefaultErrorHandler14286013
Ref: 3fc214286013
Ref: library/urllib request urllib request HTTPRedirectHandler14286259
Ref: 3fc314286259
Ref: library/urllib request urllib request HTTPCookieProcessor14286368
Ref: 3fc814286368
Ref: library/urllib request urllib request ProxyHandler14286491
Ref: 1e1114286491
Ref: library/urllib request urllib request HTTPPasswordMgr14287970
Ref: 3fc914287970
Ref: library/urllib request urllib request HTTPPasswordMgrWithDefaultRealm14288123
Ref: 3fca14288123
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth14288424
Ref: 109814288424
Ref: library/urllib request urllib request AbstractBasicAuthHandler14288873
Ref: 1ccc14288873
Ref: library/urllib request urllib request HTTPBasicAuthHandler14290556
Ref: 3fcd14290556
Ref: library/urllib request urllib request ProxyBasicAuthHandler14291153
Ref: 3fce14291153
Ref: library/urllib request urllib request AbstractDigestAuthHandler14291621
Ref: 1dc914291621
Ref: library/urllib request urllib request HTTPDigestAuthHandler14292325
Ref: 3fcf14292325
Ref: library/urllib request urllib request ProxyDigestAuthHandler14293354
Ref: 3fd014293354
Ref: library/urllib request urllib request HTTPHandler14293823
Ref: efc14293823
Ref: library/urllib request urllib request HTTPSHandler14293904
Ref: 144014293904
Ref: library/urllib request urllib request FileHandler14294274
Ref: 3fc514294274
Ref: library/urllib request urllib request DataHandler14294366
Ref: 11dd14294366
Ref: library/urllib request urllib request FTPHandler14294471
Ref: 3fc414294471
Ref: library/urllib request urllib request CacheFTPHandler14294550
Ref: 1afa14294550
Ref: library/urllib request urllib request UnknownHandler14294756
Ref: 3fbf14294756
Ref: library/urllib request urllib request HTTPErrorProcessor14294901
Ref: 3fc614294901
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-114296105
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-214296179
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-314296230
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-414296299
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-514296358
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-614296417
Node: Request オブジェクト14296476
Ref: library/urllib request id114296649
Ref: 3fd114296649
Ref: library/urllib request request-objects14296649
Ref: 3fd214296649
Ref: library/urllib request urllib request Request full_url14297046
Ref: 11e014297046
Ref: library/urllib request urllib request Request type14297423
Ref: 3fd314297423
Ref: library/urllib request urllib request Request host14297484
Ref: 3fd414297484
Ref: library/urllib request urllib request Request origin_req_host14297671
Ref: 3fd514297671
Ref: library/urllib request urllib request Request selector14297814
Ref: 3fd614297814
Ref: library/urllib request urllib request Request data14298016
Ref: 11e114298016
Ref: library/urllib request urllib request Request unverifiable14298428
Ref: 3fd714298428
Ref: library/urllib request urllib request Request method14298603
Ref: 11df14298603
Ref: library/urllib request urllib request Request get_method14299450
Ref: 138514299450
Ref: library/urllib request urllib request Request add_header14300024
Ref: 3fc714300024
Ref: library/urllib request urllib request Request add_unredirected_header14301061
Ref: 3fd814301061
Ref: library/urllib request urllib request Request has_header14301232
Ref: 3fd914301232
Ref: library/urllib request urllib request Request remove_header14301455
Ref: 11e314301455
Ref: library/urllib request urllib request Request get_full_url14301703
Ref: 3fda14301703
Ref: library/urllib request urllib request Request set_proxy14301907
Ref: 3fdb14301907
Ref: library/urllib request urllib request Request get_header14302259
Ref: 3fdc14302259
Ref: library/urllib request urllib request Request header_items14302456
Ref: 3fdd14302456
Ref: Request オブジェクト-Footnote-114302888
Node: OpenerDirector オブジェクト14302947
Ref: library/urllib request opener-director-objects14303159
Ref: 3fde14303159
Ref: library/urllib request openerdirector-objects14303159
Ref: 3fdf14303159
Ref: library/urllib request urllib request OpenerDirector add_handler14303334
Ref: 3fe014303334
Ref: library/urllib request urllib request OpenerDirector open14305232
Ref: 11e214305232
Ref: library/urllib request urllib request OpenerDirector error14306139
Ref: 3fe514306139
Node: BaseHandler オブジェクト14308586
Ref: library/urllib request base-handler-objects14308810
Ref: 3fe814308810
Ref: library/urllib request basehandler-objects14308810
Ref: 3fe914308810
Ref: library/urllib request urllib request BaseHandler add_parent14309144
Ref: 3fea14309144
Ref: library/urllib request urllib request BaseHandler close14309274
Ref: 3feb14309274
Ref: library/urllib request urllib request BaseHandler parent14309765
Ref: 3fec14309765
Ref: library/urllib request urllib request BaseHandler default_open14309976
Ref: 3fe614309976
Ref: library/urllib request protocol-open14310940
Ref: 3fe114310940
Ref: library/urllib request urllib request BaseHandler unknown_open14311429
Ref: 3fe714311429
Ref: library/urllib request urllib request BaseHandler http_error_default14311996
Ref: 3fed14311996
Ref: library/urllib request http-error-nnn14313060
Ref: 3fe214313060
Ref: library/urllib request protocol-request14313819
Ref: 3fe314313819
Ref: library/urllib request protocol-response14314428
Ref: 3fe414314428
Node: HTTPRedirectHandler オブジェクト14315269
Ref: library/urllib request http-redirect-handler14315498
Ref: 3fee14315498
Ref: library/urllib request httpredirecthandler-objects14315498
Ref: 3fef14315498
Ref: library/urllib request urllib request HTTPRedirectHandler redirect_request14316182
Ref: 3ff014316182
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30114317643
Ref: 3ff114317643
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30214318015
Ref: 3ff214318015
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30314318229
Ref: 3ff314318229
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30714318447
Ref: 3ff414318447
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30814318723
Ref: 3ff514318723
Ref: HTTPRedirectHandler オブジェクト-Footnote-114319064
Ref: HTTPRedirectHandler オブジェクト-Footnote-214319123
Ref: HTTPRedirectHandler オブジェクト-Footnote-314319182
Node: HTTPCookieProcessor オブジェクト14319241
Ref: library/urllib request http-cookie-processor14319471
Ref: 3ff614319471
Ref: library/urllib request httpcookieprocessor-objects14319471
Ref: 3ff714319471
Ref: library/urllib request urllib request HTTPCookieProcessor cookiejar14319655
Ref: 3ff814319655
Node: ProxyHandler オブジェクト14319805
Ref: library/urllib request proxy-handler14320031
Ref: 3ffa14320031
Ref: library/urllib request proxyhandler-objects14320031
Ref: 3ffb14320031
Node: HTTPPasswordMgr オブジェクト14320716
Ref: library/urllib request http-password-mgr14320951
Ref: 3fcb14320951
Ref: library/urllib request httppasswordmgr-objects14320951
Ref: 3ffc14320951
Ref: library/urllib request urllib request HTTPPasswordMgr add_password14321187
Ref: 3ffd14321187
Ref: library/urllib request urllib request HTTPPasswordMgr find_user_password14321647
Ref: 1c3314321647
Node: HTTPPasswordMgrWithPriorAuth オブジェクト14322229
Ref: library/urllib request http-password-mgr-with-prior-auth14322476
Ref: 3fcc14322476
Ref: library/urllib request httppasswordmgrwithpriorauth-objects14322476
Ref: 3ffe14322476
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth add_password14322804
Ref: 3fff14322804
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth find_user_password14323300
Ref: 400014323300
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth update_authenticated14323521
Ref: 400114323521
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth is_authenticated14323748
Ref: 1c3414323748
Node: AbstractBasicAuthHandler オブジェクト14323938
Ref: library/urllib request abstract-basic-auth-handler14324190
Ref: 400214324190
Ref: library/urllib request abstractbasicauthhandler-objects14324190
Ref: 400314324190
Ref: library/urllib request urllib request AbstractBasicAuthHandler http_error_auth_reqed14324291
Ref: 400414324291
Node: HTTPBasicAuthHandler オブジェクト14325259
Ref: library/urllib request http-basic-auth-handler14325504
Ref: 400514325504
Ref: library/urllib request httpbasicauthhandler-objects14325504
Ref: 400614325504
Ref: library/urllib request urllib request HTTPBasicAuthHandler http_error_40114325599
Ref: 400714325599
Node: ProxyBasicAuthHandler オブジェクト14325788
Ref: library/urllib request proxy-basic-auth-handler14326034
Ref: 400814326034
Ref: library/urllib request proxybasicauthhandler-objects14326034
Ref: 400914326034
Ref: library/urllib request urllib request ProxyBasicAuthHandler http_error_40714326131
Ref: 400a14326131
Node: AbstractDigestAuthHandler オブジェクト14326321
Ref: library/urllib request abstract-digest-auth-handler14326568
Ref: 400b14326568
Ref: library/urllib request abstractdigestauthhandler-objects14326568
Ref: 400c14326568
Ref: library/urllib request urllib request AbstractDigestAuthHandler http_error_auth_reqed14326673
Ref: 400d14326673
Node: HTTPDigestAuthHandler オブジェクト14327112
Ref: library/urllib request http-digest-auth-handler14327360
Ref: 400e14327360
Ref: library/urllib request httpdigestauthhandler-objects14327360
Ref: 400f14327360
Ref: library/urllib request urllib request HTTPDigestAuthHandler http_error_40114327457
Ref: 401014327457
Node: ProxyDigestAuthHandler オブジェクト14327647
Ref: library/urllib request proxy-digest-auth-handler14327881
Ref: 401114327881
Ref: library/urllib request proxydigestauthhandler-objects14327881
Ref: 401214327881
Ref: library/urllib request urllib request ProxyDigestAuthHandler http_error_40714327980
Ref: 401314327980
Node: HTTPHandler オブジェクト14328171
Ref: library/urllib request http-handler-objects14328396
Ref: 401414328396
Ref: library/urllib request httphandler-objects14328396
Ref: 401514328396
Ref: library/urllib request urllib request HTTPHandler http_open14328473
Ref: 401614328473
Node: HTTPSHandler オブジェクト14328670
Ref: library/urllib request https-handler-objects14328884
Ref: 401714328884
Ref: library/urllib request httpshandler-objects14328884
Ref: 401814328884
Ref: library/urllib request urllib request HTTPSHandler https_open14328963
Ref: 401914328963
Node: FileHandler オブジェクト14329162
Ref: library/urllib request file-handler-objects14329376
Ref: 401a14329376
Ref: library/urllib request filehandler-objects14329376
Ref: 401b14329376
Ref: library/urllib request urllib request FileHandler file_open14329453
Ref: 401c14329453
Node: DataHandler オブジェクト14329884
Ref: library/urllib request data-handler-objects14330096
Ref: 401d14330096
Ref: library/urllib request datahandler-objects14330096
Ref: 401e14330096
Ref: library/urllib request urllib request DataHandler data_open14330173
Ref: 401f14330173
Ref: DataHandler オブジェクト-Footnote-114330735
Node: FTPHandler オブジェクト14330794
Ref: library/urllib request ftp-handler-objects14331010
Ref: 402014331010
Ref: library/urllib request ftphandler-objects14331010
Ref: 402114331010
Ref: library/urllib request urllib request FTPHandler ftp_open14331085
Ref: 402214331085
Node: CacheFTPHandler オブジェクト14331307
Ref: library/urllib request cacheftp-handler-objects14331526
Ref: 402314331526
Ref: library/urllib request cacheftphandler-objects14331526
Ref: 402414331526
Ref: library/urllib request urllib request CacheFTPHandler setTimeout14331759
Ref: 402514331759
Ref: library/urllib request urllib request CacheFTPHandler setMaxConns14331875
Ref: 402614331875
Node: UnknownHandler オブジェクト14332007
Ref: library/urllib request unknown-handler-objects14332234
Ref: 402714332234
Ref: library/urllib request unknownhandler-objects14332234
Ref: 402814332234
Ref: library/urllib request urllib request UnknownHandler unknown_open14332317
Ref: 402914332317
Node: HTTPErrorProcessor オブジェクト14332422
Ref: library/urllib request http-error-processor-objects14332628
Ref: 402a14332628
Ref: library/urllib request httperrorprocessor-objects14332628
Ref: 402b14332628
Ref: library/urllib request urllib request HTTPErrorProcessor http_response14332719
Ref: 402c14332719
Ref: library/urllib request urllib request HTTPErrorProcessor https_response14333322
Ref: 402d14333322
Node: 使用例<37>14333517
Ref: library/urllib request examples14333729
Ref: 402e14333729
Ref: library/urllib request urllib-request-examples14333729
Ref: 402f14333729
Ref: library/urllib request urllib-examples14340763
Ref: 403114340763
Node: レガシーインターフェース<2>14342534
Ref: library/urllib request legacy-interface14342736
Ref: 403214342736
Ref: library/urllib request urllib request urlretrieve14343040
Ref: 30a14343040
Ref: library/urllib request urllib request urlcleanup14346266
Ref: 1e1814346266
Node: urllib request Restrictions14346465
Ref: library/urllib request urllib-request-restrictions14346645
Ref: 403414346645
Node: urllib response --- Response classes used by urllib14349997
Ref: library/urllib request module-urllib response14350273
Ref: 11314350273
Ref: library/urllib request urllib-response-response-classes-used-by-urllib14350273
Ref: 403514350273
Ref: library/urllib request urllib response addinfourl14350724
Ref: 3fbc14350724
Ref: library/urllib request urllib response addinfourl url14350767
Ref: 194a14350767
Ref: library/urllib request urllib response addinfourl headers14350945
Ref: 403614350945
Ref: library/urllib request urllib response addinfourl status14351084
Ref: 403714351084
Ref: library/urllib request urllib response addinfourl geturl14351208
Ref: 403814351208
Ref: library/urllib request urllib response addinfourl info14351374
Ref: 403914351374
Ref: library/urllib request urllib response addinfourl code14351541
Ref: 403a14351541
Ref: library/urllib request urllib response addinfourl getcode14351701
Ref: 403b14351701
Node: urllib parse --- URL を構成要素に解析する14351870
Ref: library/urllib parse doc14352152
Ref: 403c14352152
Ref: library/urllib parse module-urllib parse14352152
Ref: 11114352152
Ref: library/urllib parse translation-repo14352152
Ref: 403d14352152
Ref: library/urllib parse urllib-parse-parse-urls-into-components14352152
Ref: 403e14352152
Ref: urllib parse --- URL を構成要素に解析する-Footnote-114354403
Ref: urllib parse --- URL を構成要素に解析する-Footnote-214354475
Ref: urllib parse --- URL を構成要素に解析する-Footnote-314354534
Node: URL の解析14354593
Ref: library/urllib parse url-parsing14354723
Ref: 403f14354723
Ref: library/urllib parse urllib parse urlsplit14354932
Ref: f3e14354932
Ref: library/urllib parse urllib parse parse_qs14363323
Ref: 32114363323
Ref: library/urllib parse urllib parse parse_qsl14366170
Ref: 32014366170
Ref: library/urllib parse urllib parse urlunsplit14368667
Ref: 199e14368667
Ref: library/urllib parse urllib parse urlparse14369071
Ref: 36014369071
Ref: library/urllib parse urllib parse urlunparse14369983
Ref: 199f14369983
Ref: library/urllib parse urllib parse urljoin14370427
Ref: 109a14370427
Ref: library/urllib parse urllib parse urldefrag14372319
Ref: 146314372319
Ref: library/urllib parse urllib parse unwrap14373875
Ref: 404614373875
Ref: URL の解析-Footnote-114374224
Ref: URL の解析-Footnote-214374283
Ref: URL の解析-Footnote-314374345
Ref: URL の解析-Footnote-414374404
Ref: URL の解析-Footnote-514374463
Ref: URL の解析-Footnote-614374522
Ref: URL の解析-Footnote-714374581
Ref: URL の解析-Footnote-814374640
Node: URL parsing security14374699
Ref: library/urllib parse id114374880
Ref: 404714374880
Ref: library/urllib parse url-parsing-security14374880
Ref: 404314374880
Ref: URL parsing security-Footnote-114376338
Ref: URL parsing security-Footnote-214376400
Node: ASCII エンコードバイト列の解析14376459
Ref: library/urllib parse id214376657
Ref: 404814376657
Ref: library/urllib parse parsing-ascii-encoded-bytes14376657
Ref: 146514376657
Node: 構造化された解析結果14379208
Ref: library/urllib parse structured-parse-results14379405
Ref: 404914379405
Ref: library/urllib parse urlparse-result-object14379405
Ref: 404214379405
Ref: library/urllib parse urllib parse urllib parse SplitResult geturl14379824
Ref: 404a14379824
Ref: library/urllib parse urllib parse DefragResult14381042
Ref: 404b14381042
Ref: library/urllib parse urllib parse ParseResult14381349
Ref: 404414381349
Ref: library/urllib parse urllib parse SplitResult14381666
Ref: 404014381666
Ref: library/urllib parse urllib parse DefragResultBytes14382129
Ref: 404c14382129
Ref: library/urllib parse urllib parse ParseResultBytes14382439
Ref: 404514382439
Ref: library/urllib parse urllib parse SplitResultBytes14382778
Ref: 404114382778
Node: URL のクオート14383118
Ref: library/urllib parse url-quoting14383264
Ref: 404d14383264
Ref: library/urllib parse urllib parse quote14383715
Ref: da014383715
Ref: library/urllib parse urllib parse quote_plus14385344
Ref: 146414385344
Ref: library/urllib parse urllib parse quote_from_bytes14385855
Ref: 1bb014385855
Ref: library/urllib parse urllib parse unquote14386211
Ref: 1b5914386211
Ref: library/urllib parse urllib parse unquote_plus14387176
Ref: 404e14387176
Ref: library/urllib parse urllib parse unquote_to_bytes14387588
Ref: 1b5a14387588
Ref: library/urllib parse urllib parse urlencode14388162
Ref: 109914388162
Ref: URL のクオート-Footnote-114393219
Ref: URL のクオート-Footnote-214393278
Ref: URL のクオート-Footnote-314393337
Ref: URL のクオート-Footnote-414393374
Ref: URL のクオート-Footnote-514393433
Ref: URL のクオート-Footnote-614393492
Ref: URL のクオート-Footnote-714393551
Ref: URL のクオート-Footnote-814393610
Ref: URL のクオート-Footnote-914393669
Node: urllib error --- urllib request によって送出される例外クラス14393728
Ref: library/urllib error doc14394011
Ref: 404f14394011
Ref: library/urllib error module-urllib error14394011
Ref: 11014394011
Ref: library/urllib error translation-repo14394011
Ref: 405014394011
Ref: library/urllib error urllib-error-exception-classes-raised-by-urllib-request14394011
Ref: 405114394011
Ref: library/urllib error urllib error URLError14394520
Ref: 2c014394520
Ref: library/urllib error urllib error URLError reason14394775
Ref: 405214394775
Ref: library/urllib error urllib error HTTPError14395125
Ref: 11e414395125
Ref: library/urllib error urllib error HTTPError url14395584
Ref: 405314395584
Ref: library/urllib error urllib error HTTPError code14395704
Ref: 405414395704
Ref: library/urllib error urllib error HTTPError reason14395980
Ref: 405614395980
Ref: library/urllib error urllib error HTTPError headers14396146
Ref: 11e514396146
Ref: library/urllib error urllib error HTTPError fp14396373
Ref: 405714396373
Ref: library/urllib error urllib error ContentTooShortError14396509
Ref: 403314396509
Ref: library/urllib error urllib error ContentTooShortError content14396815
Ref: 405814396815
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-114396971
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-214397043
Node: urllib robotparser --- robots txt 用のパーサー14397102
Ref: library/urllib robotparser doc14397366
Ref: 405914397366
Ref: library/urllib robotparser module-urllib robotparser14397366
Ref: 11414397366
Ref: library/urllib robotparser translation-repo14397366
Ref: 405a14397366
Ref: library/urllib robotparser urllib-robotparser-parser-for-robots-txt14397366
Ref: 405b14397366
Ref: library/urllib robotparser urllib robotparser RobotFileParser14397894
Ref: efe14397894
Ref: library/urllib robotparser urllib robotparser RobotFileParser set_url14398075
Ref: 405c14398075
Ref: library/urllib robotparser urllib robotparser RobotFileParser read14398204
Ref: 193314398204
Ref: library/urllib robotparser urllib robotparser RobotFileParser parse14398317
Ref: 1edf14398317
Ref: library/urllib robotparser urllib robotparser RobotFileParser can_fetch14398412
Ref: 405d14398412
Ref: library/urllib robotparser urllib robotparser RobotFileParser mtime14398679
Ref: 405e14398679
Ref: library/urllib robotparser urllib robotparser RobotFileParser modified14399008
Ref: 405f14399008
Ref: library/urllib robotparser urllib robotparser RobotFileParser crawl_delay14399165
Ref: 406014399165
Ref: library/urllib robotparser urllib robotparser RobotFileParser request_rate14399700
Ref: 406114399700
Ref: library/urllib robotparser urllib robotparser RobotFileParser site_maps14400272
Ref: 1e7e14400272
Ref: urllib robotparser --- robots txt 用のパーサー-Footnote-114401243
Ref: urllib robotparser --- robots txt 用のパーサー-Footnote-214401322
Node: http --- HTTP モジュール群14401381
Ref: library/http doc14401625
Ref: 406214401625
Ref: library/http http-http-modules14401625
Ref: 406314401625
Ref: library/http module-http14401625
Ref: 7214401625
Ref: library/http translation-repo14401625
Ref: 406414401625
Ref: library/http http HTTPStatus14402581
Ref: b0014402581
Ref: http --- HTTP モジュール群-Footnote-114403411
Node: HTTP ステータスコード14403484
Ref: library/http http-status-codes14403632
Ref: 406514403632
Ref: library/http id114403632
Ref: 406614403632
Ref: HTTP ステータスコード-Footnote-114418154
Ref: HTTP ステータスコード-Footnote-214418238
Ref: HTTP ステータスコード-Footnote-314418297
Ref: HTTP ステータスコード-Footnote-414418356
Ref: HTTP ステータスコード-Footnote-514418415
Ref: HTTP ステータスコード-Footnote-614418474
Ref: HTTP ステータスコード-Footnote-714418533
Ref: HTTP ステータスコード-Footnote-814418592
Ref: HTTP ステータスコード-Footnote-914418651
Ref: HTTP ステータスコード-Footnote-1014418710
Ref: HTTP ステータスコード-Footnote-1114418770
Ref: HTTP ステータスコード-Footnote-1214418830
Ref: HTTP ステータスコード-Footnote-1314418890
Ref: HTTP ステータスコード-Footnote-1414418950
Ref: HTTP ステータスコード-Footnote-1514419010
Ref: HTTP ステータスコード-Footnote-1614419070
Ref: HTTP ステータスコード-Footnote-1714419130
Ref: HTTP ステータスコード-Footnote-1814419190
Ref: HTTP ステータスコード-Footnote-1914419250
Ref: HTTP ステータスコード-Footnote-2014419310
Ref: HTTP ステータスコード-Footnote-2114419370
Ref: HTTP ステータスコード-Footnote-2214419430
Ref: HTTP ステータスコード-Footnote-2314419490
Ref: HTTP ステータスコード-Footnote-2414419550
Ref: HTTP ステータスコード-Footnote-2514419610
Ref: HTTP ステータスコード-Footnote-2614419670
Ref: HTTP ステータスコード-Footnote-2714419730
Ref: HTTP ステータスコード-Footnote-2814419790
Ref: HTTP ステータスコード-Footnote-2914419850
Ref: HTTP ステータスコード-Footnote-3014419910
Ref: HTTP ステータスコード-Footnote-3114419970
Ref: HTTP ステータスコード-Footnote-3214420030
Ref: HTTP ステータスコード-Footnote-3314420090
Ref: HTTP ステータスコード-Footnote-3414420150
Ref: HTTP ステータスコード-Footnote-3514420210
Ref: HTTP ステータスコード-Footnote-3614420270
Ref: HTTP ステータスコード-Footnote-3714420330
Ref: HTTP ステータスコード-Footnote-3814420390
Ref: HTTP ステータスコード-Footnote-3914420450
Ref: HTTP ステータスコード-Footnote-4014420510
Ref: HTTP ステータスコード-Footnote-4114420570
Ref: HTTP ステータスコード-Footnote-4214420630
Ref: HTTP ステータスコード-Footnote-4314420690
Ref: HTTP ステータスコード-Footnote-4414420750
Ref: HTTP ステータスコード-Footnote-4514420810
Ref: HTTP ステータスコード-Footnote-4614420870
Ref: HTTP ステータスコード-Footnote-4714420930
Ref: HTTP ステータスコード-Footnote-4814420990
Ref: HTTP ステータスコード-Footnote-4914421050
Ref: HTTP ステータスコード-Footnote-5014421110
Ref: HTTP ステータスコード-Footnote-5114421170
Ref: HTTP ステータスコード-Footnote-5214421230
Ref: HTTP ステータスコード-Footnote-5314421290
Ref: HTTP ステータスコード-Footnote-5414421350
Ref: HTTP ステータスコード-Footnote-5514421410
Ref: HTTP ステータスコード-Footnote-5614421470
Ref: HTTP ステータスコード-Footnote-5714421530
Ref: HTTP ステータスコード-Footnote-5814421590
Ref: HTTP ステータスコード-Footnote-5914421650
Ref: HTTP ステータスコード-Footnote-6014421710
Ref: HTTP ステータスコード-Footnote-6114421770
Ref: HTTP ステータスコード-Footnote-6214421830
Ref: HTTP ステータスコード-Footnote-6314421890
Node: HTTP ステータスコードカテゴリ14421950
Ref: library/http http-status-category14422124
Ref: 406714422124
Ref: library/http http HTTPMethod14423806
Ref: 406814423806
Ref: HTTP ステータスコードカテゴリ-Footnote-114424657
Ref: HTTP ステータスコードカテゴリ-Footnote-214424716
Ref: HTTP ステータスコードカテゴリ-Footnote-314424775
Ref: HTTP ステータスコードカテゴリ-Footnote-414424834
Ref: HTTP ステータスコードカテゴリ-Footnote-514424893
Node: HTTP メソッド14424952
Ref: library/http http-methods14425088
Ref: 406914425088
Ref: library/http id214425088
Ref: 406a14425088
Ref: HTTP メソッド-Footnote-114427517
Ref: HTTP メソッド-Footnote-214427590
Ref: HTTP メソッド-Footnote-314427649
Ref: HTTP メソッド-Footnote-414427708
Ref: HTTP メソッド-Footnote-514427767
Ref: HTTP メソッド-Footnote-614427826
Ref: HTTP メソッド-Footnote-714427885
Ref: HTTP メソッド-Footnote-814427944
Ref: HTTP メソッド-Footnote-914428003
Ref: HTTP メソッド-Footnote-1014428062
Node: http client --- HTTP プロトコルクライアント14428122
Ref: library/http client doc14428362
Ref: 406b14428362
Ref: library/http client http-client-http-protocol-client14428362
Ref: 406c14428362
Ref: library/http client module-http client14428362
Ref: 7314428362
Ref: library/http client translation-repo14428362
Ref: 406d14428362
Ref: library/http client http client HTTPConnection14429580
Ref: d3914429580
Ref: library/http client http client HTTPSConnection14431294
Ref: d3a14431294
Ref: library/http client http client HTTPResponse14433467
Ref: 12e914433467
Ref: library/http client http client parse_headers14434009
Ref: 1e8414434009
Ref: library/http client http client HTTPException14434955
Ref: 407114434955
Ref: library/http client http client NotConnected14435137
Ref: 407214435137
Ref: library/http client http client InvalidURL14435233
Ref: 407314435233
Ref: library/http client http client UnknownProtocol14435486
Ref: 407414435486
Ref: library/http client http client UnknownTransferEncoding14435585
Ref: 407514435585
Ref: library/http client http client UnimplementedFileMode14435692
Ref: 407614435692
Ref: library/http client http client IncompleteRead14435797
Ref: 407714435797
Ref: library/http client http client ImproperConnectionState14435895
Ref: 407814435895
Ref: library/http client http client CannotSendRequest14436002
Ref: 407914436002
Ref: library/http client http client CannotSendHeader14436116
Ref: 407a14436116
Ref: library/http client http client ResponseNotReady14436229
Ref: 407b14436229
Ref: library/http client http client BadStatusLine14436342
Ref: 407c14436342
Ref: library/http client http client LineTooLong14436543
Ref: 407d14436543
Ref: library/http client http client RemoteDisconnected14436718
Ref: 100e14436718
Ref: library/http client http client HTTP_PORT14437233
Ref: 407e14437233
Ref: library/http client http client HTTPS_PORT14437350
Ref: 407f14437350
Ref: library/http client http client responses14437470
Ref: 408014437470
Ref: http client --- HTTP プロトコルクライアント-Footnote-114438053
Ref: http client --- HTTP プロトコルクライアント-Footnote-214438124
Ref: http client --- HTTP プロトコルクライアント-Footnote-314438175
Node: HTTPConnection オブジェクト14438234
Ref: library/http client httpconnection-objects14438398
Ref: 408114438398
Ref: library/http client id114438398
Ref: 408214438398
Ref: library/http client http client HTTPConnection request14438571
Ref: eab14438571
Ref: library/http client http client HTTPConnection getresponse14442446
Ref: 100d14442446
Ref: library/http client http client HTTPConnection set_debuglevel14443113
Ref: 408414443113
Ref: library/http client http client HTTPConnection set_tunnel14443523
Ref: 144414443523
Ref: library/http client http client HTTPConnection get_proxy_response_headers14445253
Ref: 1ad414445253
Ref: library/http client http client HTTPConnection connect14445540
Ref: 408514445540
Ref: library/http client http client HTTPConnection close14445902
Ref: 408314445902
Ref: library/http client http client HTTPConnection blocksize14445991
Ref: 408614445991
Ref: library/http client http client HTTPConnection putrequest14446283
Ref: 408714446283
Ref: library/http client http client HTTPConnection putheader14446964
Ref: 408814446964
Ref: library/http client http client HTTPConnection endheaders14447376
Ref: eac14447376
Ref: library/http client http client HTTPConnection send14448825
Ref: 408914448825
Ref: HTTPConnection オブジェクト-Footnote-114449253
Ref: HTTPConnection オブジェクト-Footnote-214449326
Ref: HTTPConnection オブジェクト-Footnote-314449399
Ref: HTTPConnection オブジェクト-Footnote-414449472
Ref: HTTPConnection オブジェクト-Footnote-514449540
Ref: HTTPConnection オブジェクト-Footnote-614449598
Node: HTTPResponse オブジェクト14449657
Ref: library/http client httpresponse-objects14449843
Ref: 408a14449843
Ref: library/http client id214449843
Ref: 408b14449843
Ref: library/http client http client HTTPResponse read14450416
Ref: 191114450416
Ref: library/http client http client HTTPResponse readinto14450546
Ref: 12ea14450546
Ref: library/http client http client HTTPResponse getheader14450783
Ref: 408c14450783
Ref: library/http client http client HTTPResponse getheaders14451172
Ref: 408d14451172
Ref: library/http client http client HTTPResponse fileno14451292
Ref: 408e14451292
Ref: library/http client http client HTTPResponse msg14451388
Ref: 406f14451388
Ref: library/http client http client HTTPResponse version14451600
Ref: 408f14451600
Ref: library/http client http client HTTPResponse url14451775
Ref: 409014451775
Ref: library/http client http client HTTPResponse headers14451951
Ref: 409114451951
Ref: library/http client http client HTTPResponse status14452090
Ref: 409214452090
Ref: library/http client http client HTTPResponse reason14452184
Ref: 3fbd14452184
Ref: library/http client http client HTTPResponse debuglevel14452281
Ref: 409314452281
Ref: library/http client http client HTTPResponse closed14452476
Ref: 409414452476
Ref: library/http client http client HTTPResponse geturl14452588
Ref: 409514452588
Ref: library/http client http client HTTPResponse info14452752
Ref: 409614452752
Ref: library/http client http client HTTPResponse getcode14452918
Ref: 409714452918
Node: 使用例<38>14453086
Ref: library/http client examples14453269
Ref: 409814453269
Node: HTTPMessage オブジェクト14456233
Ref: library/http client httpmessage-objects14456376
Ref: 409914456376
Ref: library/http client id314456376
Ref: 409a14456376
Ref: library/http client http client HTTPMessage14456453
Ref: 406e14456453
Node: ftplib --- FTP プロトコルクライアント14456719
Ref: library/ftplib doc14456976
Ref: 409b14456976
Ref: library/ftplib ftplib-ftp-protocol-client14456976
Ref: 409c14456976
Ref: library/ftplib module-ftplib14456976
Ref: 6214456976
Ref: library/ftplib translation-repo14456976
Ref: 409d14456976
Ref: ftplib --- FTP プロトコルクライアント-Footnote-114459160
Ref: ftplib --- FTP プロトコルクライアント-Footnote-214459226
Ref: ftplib --- FTP プロトコルクライアント-Footnote-314459284
Node: リファレンス<7>14459343
Ref: library/ftplib ftplib-reference14459449
Ref: 409e14459449
Ref: library/ftplib reference14459449
Ref: 409f14459449
Node: FTP オブジェクト14459596
Ref: library/ftplib ftp-objects14459711
Ref: 40a014459711
Ref: library/ftplib id114459711
Ref: 40a114459711
Ref: library/ftplib ftplib FTP14459772
Ref: afa14459772
Ref: library/ftplib ftplib FTP set_debuglevel14462744
Ref: 40a314462744
Ref: library/ftplib ftplib FTP connect14463305
Ref: 40a214463305
Ref: library/ftplib ftplib FTP getwelcome14464742
Ref: 40a414464742
Ref: library/ftplib ftplib FTP login14465051
Ref: 40a514465051
Ref: library/ftplib ftplib FTP abort14466095
Ref: 40a614466095
Ref: library/ftplib ftplib FTP sendcmd14466304
Ref: 40a714466304
Ref: library/ftplib ftplib FTP voidcmd14466611
Ref: 40a814466611
Ref: library/ftplib ftplib FTP retrbinary14467044
Ref: 40aa14467044
Ref: library/ftplib ftplib FTP retrlines14468106
Ref: 40ac14468106
Ref: library/ftplib ftplib FTP set_pasv14468849
Ref: 40ad14468849
Ref: library/ftplib ftplib FTP storbinary14469063
Ref: 152514469063
Ref: library/ftplib ftplib FTP storlines14470245
Ref: 40ae14470245
Ref: library/ftplib ftplib FTP transfercmd14470749
Ref: 40ab14470749
Ref: library/ftplib ftplib FTP ntransfercmd14472040
Ref: 40af14472040
Ref: library/ftplib ftplib FTP mlsd14472426
Ref: 12dd14472426
Ref: library/ftplib ftplib FTP nlst14473187
Ref: 12de14473187
Ref: library/ftplib ftplib FTP dir14473731
Ref: 12df14473731
Ref: library/ftplib ftplib FTP rename14474436
Ref: 40b014474436
Ref: library/ftplib ftplib FTP delete14474600
Ref: 40b114474600
Ref: library/ftplib ftplib FTP cwd14474946
Ref: 40b314474946
Ref: library/ftplib ftplib FTP mkd14475060
Ref: 40b414475060
Ref: library/ftplib ftplib FTP pwd14475171
Ref: 40b514475171
Ref: library/ftplib ftplib FTP rmd14475286
Ref: 40b614475286
Ref: library/ftplib ftplib FTP size14475401
Ref: 40b714475401
Ref: library/ftplib ftplib FTP quit14475816
Ref: 40b814475816
Ref: library/ftplib ftplib FTP close14476369
Ref: 40b914476369
Ref: FTP オブジェクト-Footnote-114476979
Ref: FTP オブジェクト-Footnote-214477037
Ref: FTP オブジェクト-Footnote-314477096
Ref: FTP オブジェクト-Footnote-414477154
Node: FTP_TLS オブジェクト14477213
Ref: library/ftplib ftp-tls-objects14477358
Ref: 40ba14477358
Ref: library/ftplib ftplib FTP_TLS14477427
Ref: afb14477427
Ref: library/ftplib ftplib FTP_TLS ssl_version14481229
Ref: 40bc14481229
Ref: library/ftplib ftplib FTP_TLS auth14481354
Ref: 40bd14481354
Ref: library/ftplib ftplib FTP_TLS ccc14481757
Ref: 12dc14481757
Ref: library/ftplib ftplib FTP_TLS prot_p14482022
Ref: 40bb14482022
Ref: library/ftplib ftplib FTP_TLS prot_c14482098
Ref: 40be14482098
Ref: FTP_TLS オブジェクト-Footnote-114482234
Ref: FTP_TLS オブジェクト-Footnote-214482293
Ref: FTP_TLS オブジェクト-Footnote-314482351
Node: モジュール変数14482410
Ref: library/ftplib module-variables14482524
Ref: 40bf14482524
Ref: library/ftplib ftplib error_reply14482582
Ref: 40a914482582
Ref: library/ftplib ftplib error_temp14482699
Ref: 40c014482699
Ref: library/ftplib ftplib error_perm14482869
Ref: 40b214482869
Ref: library/ftplib ftplib error_proto14483036
Ref: 40c114483036
Ref: library/ftplib ftplib all_errors14483257
Ref: 40c214483257
Node: poplib --- POP3 プロトコルクライアント14483949
Ref: library/poplib doc14484203
Ref: 40c314484203
Ref: library/poplib module-poplib14484203
Ref: b114484203
Ref: library/poplib poplib-pop3-protocol-client14484203
Ref: 40c414484203
Ref: library/poplib translation-repo14484203
Ref: 40c514484203
Ref: library/poplib poplib POP314485951
Ref: b2114485951
Ref: library/poplib poplib POP3_SSL14487111
Ref: b2214487111
Ref: library/poplib poplib error_proto14489088
Ref: 13b814489088
Ref: poplib --- POP3 プロトコルクライアント-Footnote-114489876
Ref: poplib --- POP3 プロトコルクライアント-Footnote-214489942
Ref: poplib --- POP3 プロトコルクライアント-Footnote-314490001
Ref: poplib --- POP3 プロトコルクライアント-Footnote-414490060
Ref: poplib --- POP3 プロトコルクライアント-Footnote-514490119
Node: POP3 オブジェクト14490181
Ref: library/poplib id114490310
Ref: 40c614490310
Ref: library/poplib pop3-objects14490310
Ref: 40c714490310
Ref: library/poplib poplib POP3 set_debuglevel14490679
Ref: 40c814490679
Ref: library/poplib poplib POP3 getwelcome14491213
Ref: 40c914491213
Ref: library/poplib poplib POP3 capa14491346
Ref: 118214491346
Ref: library/poplib poplib POP3 user14491577
Ref: 40ca14491577
Ref: library/poplib poplib POP3 pass_14491712
Ref: 40cb14491712
Ref: library/poplib poplib POP3 apop14492008
Ref: 40cc14492008
Ref: library/poplib poplib POP3 rpop14492163
Ref: 40cd14492163
Ref: library/poplib poplib POP3 stat14492328
Ref: 40ce14492328
Ref: library/poplib poplib POP3 list14492517
Ref: 40cf14492517
Ref: library/poplib poplib POP3 retr14492803
Ref: 40d014492803
Ref: library/poplib poplib POP3 dele14493055
Ref: 40d114493055
Ref: library/poplib poplib POP3 rset14493495
Ref: 40d214493495
Ref: library/poplib poplib POP3 noop14493606
Ref: 40d314493606
Ref: library/poplib poplib POP3 quit14493708
Ref: 13b714493708
Ref: library/poplib poplib POP3 top14493872
Ref: 40d414493872
Ref: library/poplib poplib POP3 uidl14494668
Ref: 40d514494668
Ref: library/poplib poplib POP3 utf814495083
Ref: 104d14495083
Ref: library/poplib poplib POP3 stls14495377
Ref: 118314495377
Ref: POP3 オブジェクト-Footnote-114496463
Ref: POP3 オブジェクト-Footnote-214496522
Ref: POP3 オブジェクト-Footnote-314496581
Node: POP3 の例14496640
Ref: library/poplib id214496769
Ref: 40d614496769
Ref: library/poplib pop3-example14496769
Ref: 40d714496769
Node: imaplib --- IMAP4 プロトコルクライアント14497352
Ref: library/imaplib doc14497608
Ref: 40d814497608
Ref: library/imaplib imaplib-imap4-protocol-client14497608
Ref: 40d914497608
Ref: library/imaplib module-imaplib14497608
Ref: 7814497608
Ref: library/imaplib translation-repo14497608
Ref: 40da14497608
Ref: library/imaplib imaplib IMAP414498701
Ref: b0314498701
Ref: library/imaplib imaplib IMAP4 error14499967
Ref: 185d14499967
Ref: library/imaplib imaplib IMAP4 abort14500149
Ref: 40db14500149
Ref: library/imaplib imaplib IMAP4 readonly14500485
Ref: 40dc14500485
Ref: library/imaplib imaplib IMAP4_SSL14501046
Ref: b0414501046
Ref: library/imaplib imaplib IMAP4_stream14502665
Ref: b0614502665
Ref: library/imaplib imaplib Internaldate2tuple14502982
Ref: 40dd14502982
Ref: library/imaplib imaplib Int2AP14503299
Ref: 40de14503299
Ref: library/imaplib imaplib ParseFlags14503457
Ref: 40df14503457
Ref: library/imaplib imaplib Time2Internaldate14503596
Ref: 40e014503596
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-114505117
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-214505184
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-314505243
Node: IMAP4 オブジェクト14505302
Ref: library/imaplib id114505441
Ref: 40e114505441
Ref: library/imaplib imap4-objects14505441
Ref: 40e214505441
Ref: library/imaplib imaplib IMAP4 append14507270
Ref: 40e314507270
Ref: library/imaplib imaplib IMAP4 authenticate14507426
Ref: 40e414507426
Ref: library/imaplib imaplib IMAP4 check14508378
Ref: 40e514508378
Ref: library/imaplib imaplib IMAP4 close14508503
Ref: b0814508503
Ref: library/imaplib imaplib IMAP4 copy14508776
Ref: 40e614508776
Ref: library/imaplib imaplib IMAP4 create14508944
Ref: 40e714508944
Ref: library/imaplib imaplib IMAP4 delete14509075
Ref: 40e814509075
Ref: library/imaplib imaplib IMAP4 deleteacl14509203
Ref: 40e914509203
Ref: library/imaplib imaplib IMAP4 enable14509341
Ref: 101214509341
Ref: library/imaplib imaplib IMAP4 expunge14509660
Ref: 40ea14509660
Ref: library/imaplib imaplib IMAP4 fetch14510038
Ref: 40eb14510038
Ref: library/imaplib imaplib IMAP4 getacl14510460
Ref: 40ec14510460
Ref: library/imaplib imaplib IMAP4 getannotation14510668
Ref: 40ed14510668
Ref: library/imaplib imaplib IMAP4 getquota14510908
Ref: 40ee14510908
Ref: library/imaplib imaplib IMAP4 getquotaroot14511145
Ref: 40ef14511145
Ref: library/imaplib imaplib IMAP4 idle14511403
Ref: 22f14511403
Ref: library/imaplib imaplib IMAP4 Idler burst14512974
Ref: 40f114512974
Ref: library/imaplib imaplib IMAP4 list14515120
Ref: 40f214515120
Ref: library/imaplib imaplib IMAP4 login14515511
Ref: 179b14515511
Ref: library/imaplib imaplib IMAP4 login_cram_md514515685
Ref: 185c14515685
Ref: library/imaplib imaplib IMAP4 logout14516094
Ref: c8814516094
Ref: library/imaplib imaplib IMAP4 lsub14516333
Ref: 40f314516333
Ref: library/imaplib imaplib IMAP4 myrights14516845
Ref: 40f414516845
Ref: library/imaplib imaplib IMAP4 namespace14517021
Ref: 40f514517021
Ref: library/imaplib imaplib IMAP4 noop14517130
Ref: 40f614517130
Ref: library/imaplib imaplib IMAP4 open14517215
Ref: b0514517215
Ref: library/imaplib imaplib IMAP4 partial14518206
Ref: 40fb14518206
Ref: library/imaplib imaplib IMAP4 proxyauth14518472
Ref: 40fc14518472
Ref: library/imaplib imaplib IMAP4 read14518699
Ref: 40f714518699
Ref: library/imaplib imaplib IMAP4 readline14518880
Ref: 40f814518880
Ref: library/imaplib imaplib IMAP4 recent14519050
Ref: 40fd14519050
Ref: library/imaplib imaplib IMAP4 rename14519271
Ref: 40fe14519271
Ref: library/imaplib imaplib IMAP4 response14519437
Ref: 40f014519437
Ref: library/imaplib imaplib IMAP4 search14519695
Ref: 40ff14519695
Ref: library/imaplib imaplib IMAP4 select14520403
Ref: 410014520403
Ref: library/imaplib imaplib IMAP4 send14520784
Ref: 40f914520784
Ref: library/imaplib imaplib IMAP4 setacl14521087
Ref: 410114521087
Ref: library/imaplib imaplib IMAP4 setannotation14521297
Ref: 410214521297
Ref: library/imaplib imaplib IMAP4 setquota14521535
Ref: 410314521535
Ref: library/imaplib imaplib IMAP4 shutdown14521759
Ref: 40fa14521759
Ref: library/imaplib imaplib IMAP4 socket14522022
Ref: 410414522022
Ref: library/imaplib imaplib IMAP4 sort14522154
Ref: 410514522154
Ref: library/imaplib imaplib IMAP4 starttls14523232
Ref: 144214523232
Ref: library/imaplib imaplib IMAP4 status14523790
Ref: 410614523790
Ref: library/imaplib imaplib IMAP4 store14523919
Ref: 410714523919
Ref: library/imaplib imaplib IMAP4 subscribe14525297
Ref: 410814525297
Ref: library/imaplib imaplib IMAP4 thread14525413
Ref: 410914525413
Ref: library/imaplib imaplib IMAP4 uid14526608
Ref: 410a14526608
Ref: library/imaplib imaplib IMAP4 unsubscribe14527013
Ref: 410b14527013
Ref: library/imaplib imaplib IMAP4 unselect14527139
Ref: b0714527139
Ref: library/imaplib imaplib IMAP4 xatom14527536
Ref: 410c14527536
Ref: library/imaplib imaplib IMAP4 PROTOCOL_VERSION14527792
Ref: 410d14527792
Ref: library/imaplib imaplib IMAP4 debug14527967
Ref: 410e14527967
Ref: library/imaplib imaplib IMAP4 utf8_enabled14528199
Ref: 101314528199
Ref: IMAP4 オブジェクト-Footnote-114528480
Ref: IMAP4 オブジェクト-Footnote-214528539
Ref: IMAP4 オブジェクト-Footnote-314528598
Ref: IMAP4 オブジェクト-Footnote-414528657
Ref: IMAP4 オブジェクト-Footnote-514528716
Ref: IMAP4 オブジェクト-Footnote-614528775
Ref: IMAP4 オブジェクト-Footnote-714528834
Ref: IMAP4 オブジェクト-Footnote-814528893
Ref: IMAP4 オブジェクト-Footnote-914528952
Ref: IMAP4 オブジェクト-Footnote-1014529011
Node: IMAP4 の使用例14529071
Ref: library/imaplib id214529210
Ref: 410f14529210
Ref: library/imaplib imap4-example14529210
Ref: 411014529210
Node: smtplib --- SMTP プロトコルクライアント14529777
Ref: library/smtplib doc14530038
Ref: 411114530038
Ref: library/smtplib module-smtplib14530038
Ref: cf14530038
Ref: library/smtplib smtplib-smtp-protocol-client14530038
Ref: 411214530038
Ref: library/smtplib translation-repo14530038
Ref: 411314530038
Ref: library/smtplib smtplib SMTP14530769
Ref: b2b14530769
Ref: library/smtplib smtplib SMTP_SSL14533531
Ref: b2c14533531
Ref: library/smtplib smtplib LMTP14535174
Ref: b2d14535174
Ref: library/smtplib smtplib SMTPException14536246
Ref: 11a714536246
Ref: library/smtplib smtplib SMTPServerDisconnected14536543
Ref: 411614536543
Ref: library/smtplib smtplib SMTPResponseException14536773
Ref: 411714536773
Ref: library/smtplib smtplib SMTPResponseException smtp_code14536988
Ref: 411814536988
Ref: library/smtplib smtplib SMTPResponseException smtp_error14537052
Ref: 411914537052
Ref: library/smtplib smtplib SMTPSenderRefused14537114
Ref: 411a14537114
Ref: library/smtplib smtplib SMTPRecipientsRefused14537393
Ref: 411b14537393
Ref: library/smtplib smtplib SMTPRecipientsRefused recipients14537475
Ref: 411c14537475
Ref: library/smtplib smtplib SMTPDataError14537662
Ref: 411d14537662
Ref: library/smtplib smtplib SMTPConnectError14537834
Ref: 411414537834
Ref: library/smtplib smtplib SMTPHeloError14537969
Ref: 411e14537969
Ref: library/smtplib smtplib SMTPNotSupportedError14538104
Ref: 1e0b14538104
Ref: library/smtplib smtplib SMTPAuthenticationError14538275
Ref: 411f14538275
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-114539168
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-214539235
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-314539293
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-414539352
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-514539411
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-614539469
Node: SMTP オブジェクト14539528
Ref: library/smtplib id114539661
Ref: 412014539661
Ref: library/smtplib smtp-objects14539661
Ref: 412114539661
Ref: library/smtplib smtplib SMTP set_debuglevel14539810
Ref: 105c14539810
Ref: library/smtplib smtplib SMTP docmd14540261
Ref: 412214540261
Ref: library/smtplib smtplib SMTP connect14541205
Ref: 17bb14541205
Ref: library/smtplib smtplib SMTP helo14542040
Ref: 412314542040
Ref: library/smtplib smtplib SMTP ehlo14542493
Ref: 412514542493
Ref: library/smtplib smtplib SMTP ehlo_or_helo_if_needed14543557
Ref: 412a14543557
Ref: library/smtplib smtplib SMTP has_extn14544024
Ref: 412614544024
Ref: library/smtplib smtplib SMTP verify14544283
Ref: 412b14544283
Ref: library/smtplib smtplib SMTP login14544810
Ref: 412c14544810
Ref: library/smtplib smtplib SMTP auth14546630
Ref: 105b14546630
Ref: library/smtplib smtplib SMTP starttls14548877
Ref: 135414548877
Ref: library/smtplib smtplib SMTP sendmail14550572
Ref: 105d14550572
Ref: library/smtplib smtplib SMTP send_message14554505
Ref: 105e14554505
Ref: library/smtplib smtplib SMTP quit14556581
Ref: 411514556581
Ref: library/smtplib smtplib SMTP helo_resp14557139
Ref: 412414557139
Ref: library/smtplib smtplib SMTP ehlo_resp14557240
Ref: 412714557240
Ref: library/smtplib smtplib SMTP does_esmtp14557341
Ref: 412814557341
Ref: library/smtplib smtplib SMTP esmtp_features14557470
Ref: 412914557470
Ref: SMTP オブジェクト-Footnote-114557655
Ref: SMTP オブジェクト-Footnote-214557713
Ref: SMTP オブジェクト-Footnote-314557772
Ref: SMTP オブジェクト-Footnote-414557831
Ref: SMTP オブジェクト-Footnote-514557889
Ref: SMTP オブジェクト-Footnote-614557947
Node: SMTP 使用例14558006
Ref: library/smtplib id214558139
Ref: 412d14558139
Ref: library/smtplib smtp-example14558139
Ref: 412e14558139
Ref: SMTP 使用例-Footnote-114559623
Node: uuid --- RFC 9562 に基づく UUID オブジェクト14559681
Ref: library/uuid doc14559962
Ref: 412f14559962
Ref: library/uuid module-uuid14559962
Ref: 11714559962
Ref: library/uuid translation-repo14559962
Ref: 413014559962
Ref: library/uuid uuid-uuid-objects-according-to-rfc-956214559962
Ref: 413114559962
Ref: library/uuid uuid SafeUUID14561373
Ref: 413314561373
Ref: library/uuid uuid SafeUUID safe14561431
Ref: 413414561431
Ref: library/uuid uuid SafeUUID unsafe14561552
Ref: 413514561552
Ref: library/uuid uuid SafeUUID unknown14561695
Ref: 413614561695
Ref: library/uuid uuid UUID14561854
Ref: c5a14561854
Ref: library/uuid uuid UUID bytes14563956
Ref: 413814563956
Ref: library/uuid uuid UUID bytes_le14564126
Ref: 413914564126
Ref: library/uuid uuid UUID fields14564289
Ref: 413a14564289
Ref: library/uuid uuid UUID time_low14564693
Ref: 413b14564693
Ref: library/uuid uuid UUID time_mid14564977
Ref: 413c14564977
Ref: library/uuid uuid UUID time_hi_version14565267
Ref: 413d14565267
Ref: library/uuid uuid UUID clock_seq_hi_variant14565555
Ref: 413e14565555
Ref: library/uuid uuid UUID clock_seq_low14565837
Ref: 413f14565837
Ref: library/uuid uuid UUID node14566117
Ref: 414014566117
Ref: library/uuid uuid UUID time14566400
Ref: 414114566400
Ref: library/uuid uuid UUID clock_seq14567015
Ref: 414214567015
Ref: library/uuid uuid UUID hex14567220
Ref: 18f214567220
Ref: library/uuid uuid UUID int14567306
Ref: 413714567306
Ref: library/uuid uuid UUID urn14567371
Ref: 414314567371
Ref: library/uuid uuid UUID variant14567449
Ref: 414414567449
Ref: library/uuid uuid UUID version14567708
Ref: 414914567708
Ref: library/uuid uuid UUID is_safe14567916
Ref: da314567916
Ref: library/uuid uuid getnode14568177
Ref: da414568177
Ref: library/uuid uuid-factory-functions14569456
Ref: 413214569456
Ref: library/uuid uuid uuid114569456
Ref: da514569456
Ref: library/uuid uuid uuid314569988
Ref: 2e714569988
Ref: library/uuid uuid uuid414570263
Ref: 2e914570263
Ref: library/uuid uuid uuid514570397
Ref: 2e814570397
Ref: library/uuid uuid uuid614570675
Ref: 2c414570675
Ref: library/uuid uuid uuid714571314
Ref: 2c514571314
Ref: library/uuid uuid uuid814571654
Ref: 2c614571654
Ref: library/uuid uuid NAMESPACE_DNS14572475
Ref: 414a14572475
Ref: library/uuid uuid NAMESPACE_URL14572623
Ref: 414b14572623
Ref: library/uuid uuid NAMESPACE_OID14572743
Ref: 414c14572743
Ref: library/uuid uuid NAMESPACE_X50014572867
Ref: 414d14572867
Ref: library/uuid uuid RESERVED_NCS14573158
Ref: 414514573158
Ref: library/uuid uuid RFC_412214573251
Ref: 414614573251
Ref: library/uuid uuid RESERVED_MICROSOFT14573458
Ref: 414714573458
Ref: library/uuid uuid RESERVED_FUTURE14573566
Ref: 414814573566
Ref: library/uuid uuid NIL14573723
Ref: 2c714573723
Ref: library/uuid uuid MAX14573896
Ref: 2c814573896
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-114574458
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-214574522
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-314574581
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-414574640
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-514574699
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-614574758
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-714574817
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-814574888
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-914574959
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1014575030
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1114575102
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1214575174
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1314575246
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1414575318
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1514575378
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1614575438
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1714575498
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1814575570
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1914575643
Node: コマンドラインからの使用14575703
Ref: library/uuid command-line-usage14575852
Ref: 414e14575852
Ref: library/uuid uuid-cli14575852
Ref: 67614575852
Ref: library/uuid cmdoption-uuid-h14576181
Ref: 414f14576181
Ref: library/uuid cmdoption-uuid-help14576181
Ref: 415014576181
Ref: library/uuid cmdoption-uuid-u14576269
Ref: 415114576269
Ref: library/uuid cmdoption-uuid-uuid14576291
Ref: 415214576291
Ref: library/uuid cmdoption-uuid-n14576506
Ref: 415314576506
Ref: library/uuid cmdoption-uuid-namespace14576533
Ref: 415414576533
Ref: library/uuid cmdoption-uuid-N14576845
Ref: 415514576845
Ref: library/uuid cmdoption-uuid-name14576867
Ref: 415614576867
Ref: library/uuid cmdoption-uuid-C14577023
Ref: 415714577023
Ref: library/uuid cmdoption-uuid-count14577044
Ref: 2c914577044
Node: 使用例<39>14577134
Ref: library/uuid example14577312
Ref: 415814577312
Ref: library/uuid uuid-example14577312
Ref: 415914577312
Node: Command-Line Example14579369
Ref: library/uuid command-line-example14579502
Ref: 415a14579502
Ref: library/uuid uuid-cli-example14579502
Ref: 415b14579502
Node: socketserver --- ネットワークサーバーのフレームワーク14579950
Ref: library/socketserver doc14580214
Ref: 415c14580214
Ref: library/socketserver module-socketserver14580214
Ref: d214580214
Ref: library/socketserver socketserver-a-framework-for-network-servers14580214
Ref: 415d14580214
Ref: library/socketserver translation-repo14580214
Ref: 415e14580214
Ref: library/socketserver socketserver TCPServer14580829
Ref: 153b14580829
Ref: library/socketserver socketserver UDPServer14581305
Ref: 416114581305
Ref: library/socketserver socketserver UnixStreamServer14581612
Ref: 416214581612
Ref: library/socketserver socketserver UnixDatagramServer14581729
Ref: 416314581729
Ref: socketserver --- ネットワークサーバーのフレームワーク-Footnote-114584731
Node: サーバ生成に関するノート14584803
Ref: library/socketserver server-creation-notes14584980
Ref: 416614584980
Ref: library/socketserver socketserver ForkingMixIn14585825
Ref: d7514585825
Ref: library/socketserver socketserver ThreadingMixIn14585866
Ref: d3e14585866
Ref: library/socketserver socketserver ThreadingMixIn block_on_close14586704
Ref: d7414586704
Ref: library/socketserver socketserver ThreadingMixIn max_children14587093
Ref: 416814587093
Ref: library/socketserver socketserver ThreadingMixIn daemon_threads14587342
Ref: 416914587342
Ref: library/socketserver socketserver ForkingTCPServer14587867
Ref: 416a14587867
Ref: library/socketserver socketserver ForkingUDPServer14587912
Ref: 416b14587912
Ref: library/socketserver socketserver ThreadingTCPServer14587957
Ref: 416c14587957
Ref: library/socketserver socketserver ThreadingUDPServer14588004
Ref: 416714588004
Ref: library/socketserver socketserver ForkingUnixStreamServer14588051
Ref: 416d14588051
Ref: library/socketserver socketserver ForkingUnixDatagramServer14588103
Ref: 416e14588103
Ref: library/socketserver socketserver ThreadingUnixStreamServer14588157
Ref: 416f14588157
Ref: library/socketserver socketserver ThreadingUnixDatagramServer14588211
Ref: 417014588211
Node: Serverオブジェクト14591275
Ref: library/socketserver server-objects14591484
Ref: 417214591484
Ref: library/socketserver socketserver BaseServer14591549
Ref: 135914591549
Ref: library/socketserver socketserver BaseServer fileno14591962
Ref: 417514591962
Ref: library/socketserver socketserver BaseServer handle_request14592295
Ref: 153e14592295
Ref: library/socketserver socketserver BaseServer serve_forever14593001
Ref: 135b14593001
Ref: library/socketserver socketserver BaseServer service_actions14593660
Ref: 135a14593660
Ref: library/socketserver socketserver BaseServer shutdown14593969
Ref: 1e7214593969
Ref: library/socketserver socketserver BaseServer server_close14594243
Ref: d7314594243
Ref: library/socketserver socketserver BaseServer address_family14594364
Ref: 417914594364
Ref: library/socketserver socketserver BaseServer RequestHandlerClass14594776
Ref: 417414594776
Ref: library/socketserver socketserver BaseServer server_address14594968
Ref: 417314594968
Ref: library/socketserver socketserver BaseServer socket14595458
Ref: 417a14595458
Ref: library/socketserver socketserver BaseServer allow_reuse_address14595665
Ref: 417b14595665
Ref: library/socketserver socketserver BaseServer request_queue_size14595960
Ref: 417c14595960
Ref: library/socketserver socketserver BaseServer socket_type14596560
Ref: 417d14596560
Ref: library/socketserver socketserver BaseServer timeout14596775
Ref: 153c14596775
Ref: library/socketserver socketserver BaseServer finish_request14597391
Ref: 417e14597391
Ref: library/socketserver socketserver BaseServer get_request14597633
Ref: 417614597633
Ref: library/socketserver socketserver BaseServer handle_error14597934
Ref: f4114597934
Ref: library/socketserver socketserver BaseServer handle_timeout14598461
Ref: 153d14598461
Ref: library/socketserver socketserver BaseServer process_request14598952
Ref: 417814598952
Ref: library/socketserver socketserver BaseServer server_activate14599432
Ref: 416014599432
Ref: library/socketserver socketserver BaseServer server_bind14599682
Ref: 415f14599682
Ref: library/socketserver socketserver BaseServer verify_request14599915
Ref: 417714599915
Node: Request Handler Objects14600625
Ref: library/socketserver request-handler-objects14600811
Ref: 417f14600811
Ref: library/socketserver socketserver BaseRequestHandler14600880
Ref: 416414600880
Ref: library/socketserver socketserver BaseRequestHandler setup14601238
Ref: 418014601238
Ref: library/socketserver socketserver BaseRequestHandler handle14601457
Ref: 416514601457
Ref: library/socketserver socketserver BaseRequestHandler finish14602164
Ref: 418414602164
Ref: library/socketserver socketserver BaseRequestHandler request14602532
Ref: 418114602532
Ref: library/socketserver socketserver BaseRequestHandler client_address14602668
Ref: 418214602668
Ref: library/socketserver socketserver BaseRequestHandler server14602790
Ref: 418314602790
Ref: library/socketserver socketserver StreamRequestHandler14602891
Ref: eda14602891
Ref: library/socketserver socketserver DatagramRequestHandler14602940
Ref: 417114602940
Ref: library/socketserver socketserver DatagramRequestHandler rfile14603191
Ref: 418514603191
Ref: library/socketserver socketserver DatagramRequestHandler wfile14603356
Ref: ed914603356
Node: 使用例<40>14603639
Ref: library/socketserver examples14603792
Ref: 418614603792
Node: socketserver TCPServer の例14603998
Ref: library/socketserver socketserver-tcpserver-example14604115
Ref: 418714604115
Node: socketserver UDPServer の例14608043
Ref: library/socketserver socketserver-udpserver-example14608194
Ref: 418814608194
Node: 非同期処理の Mix-in14609802
Ref: library/socketserver asynchronous-mixins14609915
Ref: 418914609915
Node: http server --- HTTP サーバー14612401
Ref: library/http server doc14612648
Ref: 418a14612648
Ref: library/http server http-server-http-servers14612648
Ref: 418b14612648
Ref: library/http server module-http server14612648
Ref: 7614612648
Ref: library/http server translation-repo14612648
Ref: 418c14612648
Ref: library/http server http server HTTPServer14613840
Ref: 3f8b14613840
Ref: library/http server http server ThreadingHTTPServer14614287
Ref: d3d14614287
Ref: library/http server http server HTTPSServer14614664
Ref: 22a14614664
Ref: library/http server http server ThreadingHTTPSServer14616006
Ref: 418e14616006
Ref: library/http server http server BaseHTTPRequestHandler14616701
Ref: 12e614616701
Ref: library/http server http server BaseHTTPRequestHandler client_address14617730
Ref: 418f14617730
Ref: library/http server http server BaseHTTPRequestHandler server14617921
Ref: 419014617921
Ref: library/http server http server BaseHTTPRequestHandler close_connection14618010
Ref: 419114618010
Ref: library/http server http server BaseHTTPRequestHandler requestline14618311
Ref: 419314618311
Ref: library/http server http server BaseHTTPRequestHandler command14618714
Ref: 419414618714
Ref: library/http server http server BaseHTTPRequestHandler path14618857
Ref: 419514618857
Ref: library/http server http server BaseHTTPRequestHandler request_version14619131
Ref: 419614619131
Ref: library/http server http server BaseHTTPRequestHandler headers14619292
Ref: 407014619292
Ref: library/http server http server BaseHTTPRequestHandler rfile14619719
Ref: 419814619719
Ref: library/http server http server BaseHTTPRequestHandler wfile14619871
Ref: 419914619871
Ref: library/http server http server BaseHTTPRequestHandler server_version14620338
Ref: 419a14620338
Ref: library/http server http server BaseHTTPRequestHandler sys_version14620741
Ref: 419b14620741
Ref: library/http server http server BaseHTTPRequestHandler error_message_format14621020
Ref: 115614621020
Ref: library/http server http server BaseHTTPRequestHandler error_content_type14621377
Ref: 419d14621377
Ref: library/http server http server BaseHTTPRequestHandler protocol_version14621609
Ref: 419e14621609
Ref: library/http server http server BaseHTTPRequestHandler MessageClass14622203
Ref: 419714622203
Ref: library/http server http server BaseHTTPRequestHandler responses14622528
Ref: 405514622528
Ref: library/http server http server BaseHTTPRequestHandler handle14623123
Ref: 41a114623123
Ref: library/http server http server BaseHTTPRequestHandler handle_one_request14623429
Ref: 419214623429
Ref: library/http server http server BaseHTTPRequestHandler handle_expect_10014623633
Ref: 41a214623633
Ref: library/http server http server BaseHTTPRequestHandler send_error14624167
Ref: 115514624167
Ref: library/http server http server BaseHTTPRequestHandler send_response14625308
Ref: 41a314625308
Ref: library/http server http server BaseHTTPRequestHandler send_header14626132
Ref: 419f14626132
Ref: library/http server http server BaseHTTPRequestHandler send_response_only14626796
Ref: 41a014626796
Ref: library/http server http server BaseHTTPRequestHandler end_headers14627310
Ref: 12e714627310
Ref: library/http server http server BaseHTTPRequestHandler flush_headers14627651
Ref: 12e814627651
Ref: library/http server http server BaseHTTPRequestHandler log_request14627862
Ref: 41a514627862
Ref: library/http server http server BaseHTTPRequestHandler log_error14628252
Ref: 41a614628252
Ref: library/http server http server BaseHTTPRequestHandler log_message14628562
Ref: 41a714628562
Ref: library/http server http server BaseHTTPRequestHandler version_string14629202
Ref: 419c14629202
Ref: library/http server http server BaseHTTPRequestHandler date_time_string14629473
Ref: 41a414629473
Ref: library/http server http server BaseHTTPRequestHandler log_date_time_string14629958
Ref: 41a814629958
Ref: library/http server http server BaseHTTPRequestHandler address_string14630108
Ref: 41a914630108
Ref: library/http server http server SimpleHTTPRequestHandler14630388
Ref: d3c14630388
Ref: library/http server http server SimpleHTTPRequestHandler server_version14631235
Ref: 41ac14631235
Ref: library/http server http server SimpleHTTPRequestHandler extensions_map14631437
Ref: 41ad14631437
Ref: library/http server http server SimpleHTTPRequestHandler do_HEAD14631959
Ref: 41ab14631959
Ref: library/http server http server SimpleHTTPRequestHandler do_GET14632370
Ref: 41aa14632370
Ref: library/http server http server CGIHTTPRequestHandler14635041
Ref: 32714635041
Ref: library/http server http server CGIHTTPRequestHandler cgi_directories14636218
Ref: 41ae14636218
Ref: library/http server http server CGIHTTPRequestHandler do_POST14636452
Ref: 41af14636452
Ref: http server --- HTTP サーバー-Footnote-114637482
Ref: http server --- HTTP サーバー-Footnote-214637553
Ref: http server --- HTTP サーバー-Footnote-314637612
Ref: http server --- HTTP サーバー-Footnote-414637671
Node: コマンドライン・インターフェース<7>14637742
Ref: library/http server command-line-interface14637914
Ref: 41b014637914
Ref: library/http server http-server-cli14637914
Ref: 115714637914
Ref: library/http server cmdoption-http server-arg-port14638299
Ref: 41b114638299
Ref: library/http server cmdoption-http server-b14638492
Ref: 41b214638492
Ref: library/http server cmdoption-http server-bind14638492
Ref: 41b314638492
Ref: library/http server cmdoption-http server-d14638939
Ref: 18a414638939
Ref: library/http server cmdoption-http server-directory14638939
Ref: 41b414638939
Ref: library/http server cmdoption-http server-p14639242
Ref: 41b514639242
Ref: library/http server cmdoption-http server-protocol14639242
Ref: 41b614639242
Ref: library/http server cmdoption-http server-cgi14639563
Ref: 41b714639563
Ref: library/http server cmdoption-http server-tls-cert14640183
Ref: 22b14640183
Ref: library/http server cmdoption-http server-tls-key14640357
Ref: 22c14640357
Ref: library/http server cmdoption-http server-tls-password-file14640528
Ref: 22d14640528
Node: セキュリティで考慮すべき点<5>14640883
Ref: library/http server http-server-security14641055
Ref: 418d14641055
Ref: library/http server security-considerations14641055
Ref: 41b814641055
Node: http cookies --- HTTP の状態管理14642018
Ref: library/http cookies doc14642256
Ref: 41b914642256
Ref: library/http cookies http-cookies-http-state-management14642256
Ref: 41ba14642256
Ref: library/http cookies module-http cookies14642256
Ref: 7514642256
Ref: library/http cookies translation-repo14642256
Ref: 41bb14642256
Ref: library/http cookies http cookies CookieError14643835
Ref: 41bc14643835
Ref: library/http cookies http cookies BaseCookie14644022
Ref: 41bd14644022
Ref: library/http cookies http cookies SimpleCookie14644488
Ref: 1e8014644488
Ref: http cookies --- HTTP の状態管理-Footnote-114645485
Ref: http cookies --- HTTP の状態管理-Footnote-214645557
Ref: http cookies --- HTTP の状態管理-Footnote-314645616
Ref: http cookies --- HTTP の状態管理-Footnote-414645675
Ref: http cookies --- HTTP の状態管理-Footnote-514645734
Node: Cookieオブジェクト14645793
Ref: library/http cookies cookie-objects14645924
Ref: 41c114645924
Ref: library/http cookies id114645924
Ref: 41c214645924
Ref: library/http cookies http cookies BaseCookie value_decode14645989
Ref: 41bf14645989
Ref: library/http cookies http cookies BaseCookie value_encode14646362
Ref: 41c014646362
Ref: library/http cookies http cookies BaseCookie output14646976
Ref: 41c314646976
Ref: library/http cookies http cookies BaseCookie js_output14647348
Ref: 17ad14647348
Ref: library/http cookies http cookies BaseCookie load14647658
Ref: 41be14647658
Node: Morselオブジェクト14647988
Ref: library/http cookies id214648141
Ref: 41c514648141
Ref: library/http cookies morsel-objects14648141
Ref: 41c614648141
Ref: library/http cookies http cookies Morsel14648206
Ref: e0214648206
Ref: library/http cookies http cookies Morsel expires14648458
Ref: 41c714648458
Ref: library/http cookies http cookies Morsel path14648491
Ref: 41c814648491
Ref: library/http cookies http cookies Morsel comment14648521
Ref: 41c914648521
Ref: library/http cookies http cookies Morsel domain14648554
Ref: 41ca14648554
Ref: library/http cookies http cookies Morsel secure14648620
Ref: 41cb14648620
Ref: library/http cookies http cookies Morsel version14648652
Ref: 41cc14648652
Ref: library/http cookies http cookies Morsel httponly14648685
Ref: 15ee14648685
Ref: library/http cookies http cookies Morsel samesite14648719
Ref: 41cd14648719
Ref: library/http cookies http cookies Morsel partitioned14648753
Ref: 41ce14648753
Ref: library/http cookies http cookies Morsel value14650786
Ref: e0014650786
Ref: library/http cookies http cookies Morsel coded_value14650843
Ref: e0114650843
Ref: library/http cookies http cookies Morsel key14650954
Ref: dff14650954
Ref: library/http cookies http cookies Morsel set14651006
Ref: e0314651006
Ref: library/http cookies http cookies Morsel isReservedKey14651142
Ref: 41cf14651142
Ref: library/http cookies http cookies Morsel output14651271
Ref: 41c414651271
Ref: library/http cookies http cookies Morsel js_output14651673
Ref: 41d014651673
Ref: library/http cookies http cookies Morsel OutputString14651979
Ref: 41d114651979
Ref: library/http cookies http cookies Morsel update14652182
Ref: 10cd14652182
Ref: library/http cookies http cookies Morsel copy14652509
Ref: 10cc14652509
Ref: library/http cookies http cookies Morsel setdefault14652716
Ref: 41d214652716
Ref: Morselオブジェクト-Footnote-114652997
Ref: Morselオブジェクト-Footnote-214653056
Ref: Morselオブジェクト-Footnote-314653115
Ref: Morselオブジェクト-Footnote-414653178
Ref: Morselオブジェクト-Footnote-514653237
Node: 使用例<41>14653296
Ref: library/http cookies cookie-example14653416
Ref: 41d314653416
Ref: library/http cookies example14653416
Ref: 41d414653416
Node: http cookiejar --- HTTP クライアント用の Cookie 処理14655055
Ref: library/http cookiejar doc14655329
Ref: 41d514655329
Ref: library/http cookiejar http-cookiejar-cookie-handling-for-http-clients14655329
Ref: 41d614655329
Ref: library/http cookiejar module-http cookiejar14655329
Ref: 7414655329
Ref: library/http cookiejar translation-repo14655329
Ref: 41d714655329
Ref: library/http cookiejar http cookiejar LoadError14656929
Ref: 41d814656929
Ref: library/http cookiejar http cookiejar CookieJar14657461
Ref: 3ff914657461
Ref: library/http cookiejar http cookiejar FileCookieJar14658166
Ref: 41d914658166
Ref: library/http cookiejar http cookiejar CookiePolicy14659291
Ref: 41da14659291
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy14659513
Ref: 1e5114659513
Ref: library/http cookiejar http cookiejar Cookie14661749
Ref: 41df14661749
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-114663655
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-214663729
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-314663788
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-414663847
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-514663906
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-614663965
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-714664024
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-814664083
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-914664142
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1014664201
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1114664261
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1214664321
Node: CookieJar および FileCookieJar オブジェクト14664381
Ref: library/http cookiejar cookie-jar-objects14664605
Ref: 41e014664605
Ref: library/http cookiejar cookiejar-and-filecookiejar-objects14664605
Ref: 41e114664605
Ref: library/http cookiejar http cookiejar CookieJar add_cookie_header14665029
Ref: 41e214665029
Ref: library/http cookiejar http cookiejar CookieJar extract_cookies14666185
Ref: 41e314666185
Ref: library/http cookiejar http cookiejar CookieJar set_policy14667851
Ref: 41e514667851
Ref: library/http cookiejar http cookiejar CookieJar make_cookies14667985
Ref: 41e614667985
Ref: library/http cookiejar http cookiejar CookieJar set_cookie_if_ok14668366
Ref: 41e714668366
Ref: library/http cookiejar http cookiejar CookieJar set_cookie14668539
Ref: 41e814668539
Ref: library/http cookiejar http cookiejar CookieJar clear14668748
Ref: 41e914668748
Ref: library/http cookiejar http cookiejar CookieJar clear_session_cookies14669475
Ref: 41ea14669475
Ref: library/http cookiejar http cookiejar FileCookieJar save14670350
Ref: 41eb14670350
Ref: library/http cookiejar http cookiejar FileCookieJar load14671628
Ref: 41db14671628
Ref: library/http cookiejar http cookiejar FileCookieJar revert14672450
Ref: 41dc14672450
Ref: library/http cookiejar http cookiejar FileCookieJar filename14672972
Ref: 41ec14672972
Ref: library/http cookiejar http cookiejar FileCookieJar delayload14673159
Ref: 41ed14673159
Node: FileCookieJar のサブクラスと web ブラウザとの連携14673849
Ref: library/http cookiejar file-cookie-jar-classes14674113
Ref: 41dd14674113
Ref: library/http cookiejar filecookiejar-subclasses-and-co-operation-with-web-browsers14674113
Ref: 41ee14674113
Ref: library/http cookiejar http cookiejar MozillaCookieJar14674372
Ref: 41ef14674372
Ref: library/http cookiejar http cookiejar LWPCookieJar14675482
Ref: 41f014675482
Ref: FileCookieJar のサブクラスと web ブラウザとの連携-Footnote-114676037
Node: CookiePolicy オブジェクト14676096
Ref: library/http cookiejar cookie-policy-objects14676346
Ref: 41f114676346
Ref: library/http cookiejar cookiepolicy-objects14676346
Ref: 41f214676346
Ref: library/http cookiejar http cookiejar CookiePolicy set_ok14676566
Ref: 41e414676566
Ref: library/http cookiejar http cookiejar CookiePolicy return_ok14676980
Ref: 41f314676980
Ref: library/http cookiejar http cookiejar CookiePolicy domain_return_ok14677387
Ref: 41f414677387
Ref: library/http cookiejar http cookiejar CookiePolicy path_return_ok14679402
Ref: 41f514679402
Ref: library/http cookiejar http cookiejar CookiePolicy netscape14680036
Ref: 41f614680036
Ref: library/http cookiejar http cookiejar CookiePolicy rfc296514680150
Ref: 41f714680150
Ref: library/http cookiejar http cookiejar CookiePolicy hide_cookie214680266
Ref: 41f814680266
Ref: CookiePolicy オブジェクト-Footnote-114681077
Ref: CookiePolicy オブジェクト-Footnote-214681136
Node: DefaultCookiePolicy オブジェクト14681195
Ref: library/http cookiejar default-cookie-policy-objects14681408
Ref: 41f914681408
Ref: library/http cookiejar defaultcookiepolicy-objects14681408
Ref: 41fa14681408
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy blocked_domains14684596
Ref: 41fb14684596
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_blocked_domains14684755
Ref: 41fc14684755
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_blocked14684890
Ref: 41fd14684890
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy allowed_domains14685070
Ref: 41fe14685070
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_allowed_domains14685255
Ref: 41ff14685255
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_not_allowed14685417
Ref: 420014685417
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy rfc2109_as_netscape14685848
Ref: 41de14685848
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_domain14686629
Ref: 420114686629
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_rfc2965_unverifiable14687053
Ref: 420214687053
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_unverifiable14687561
Ref: 420314687561
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_domain14687766
Ref: 420414687766
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_initial_dollar14688039
Ref: 420514688039
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_path14688202
Ref: 420614688202
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNoDots14688543
Ref: 420714688543
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNonDomain14688918
Ref: 420814688918
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainRFC2965Match14689365
Ref: 420914689365
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainLiberal14689690
Ref: 420a14689690
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrict14689873
Ref: 420b14689873
Ref: DefaultCookiePolicy オブジェクト-Footnote-114690030
Ref: DefaultCookiePolicy オブジェクト-Footnote-214690089
Ref: DefaultCookiePolicy オブジェクト-Footnote-314690148
Ref: DefaultCookiePolicy オブジェクト-Footnote-414690207
Ref: DefaultCookiePolicy オブジェクト-Footnote-514690266
Ref: DefaultCookiePolicy オブジェクト-Footnote-614690325
Ref: DefaultCookiePolicy オブジェクト-Footnote-714690384
Node: Cookieオブジェクト<2>14690443
Ref: library/http cookiejar cookie-objects14690638
Ref: 420c14690638
Ref: library/http cookiejar http cookiejar Cookie version14691519
Ref: 420d14691519
Ref: library/http cookiejar http cookiejar Cookie name14691861
Ref: 420e14691861
Ref: library/http cookiejar http cookiejar Cookie value14691932
Ref: 420f14691932
Ref: library/http cookiejar http cookiejar Cookie port14692034
Ref: 421014692034
Ref: library/http cookiejar http cookiejar Cookie domain14692205
Ref: 421114692205
Ref: library/http cookiejar http cookiejar Cookie path14692285
Ref: 421214692285
Ref: library/http cookiejar http cookiejar Cookie secure14692397
Ref: 421314692397
Ref: library/http cookiejar http cookiejar Cookie expires14692542
Ref: 421414692542
Ref: library/http cookiejar http cookiejar Cookie discard14692784
Ref: 421614692784
Ref: library/http cookiejar http cookiejar Cookie comment14692900
Ref: 421714692900
Ref: library/http cookiejar http cookiejar Cookie comment_url14693063
Ref: 421814693063
Ref: library/http cookiejar http cookiejar Cookie rfc210914693238
Ref: 421914693238
Ref: library/http cookiejar http cookiejar Cookie port_specified14693634
Ref: 421a14693634
Ref: library/http cookiejar http cookiejar Cookie domain_specified14693866
Ref: 421b14693866
Ref: library/http cookiejar http cookiejar Cookie domain_initial_dot14694012
Ref: 421c14694012
Ref: library/http cookiejar http cookiejar Cookie has_nonstandard_attr14694368
Ref: 421d14694368
Ref: library/http cookiejar http cookiejar Cookie get_nonstandard_attr14694557
Ref: 421e14694557
Ref: library/http cookiejar http cookiejar Cookie set_nonstandard_attr14694799
Ref: 421f14694799
Ref: library/http cookiejar http cookiejar Cookie is_expired14695010
Ref: 421514695010
Ref: Cookieオブジェクト<2>-Footnote-114695358
Ref: Cookieオブジェクト<2>-Footnote-214695417
Ref: Cookieオブジェクト<2>-Footnote-314695476
Ref: Cookieオブジェクト<2>-Footnote-414695535
Node: 使用例<42>14695594
Ref: library/http cookiejar examples14695742
Ref: 422014695742
Ref: 使用例<42>-Footnote-114697387
Node: xmlrpc --- XMLRPC サーバーとクライアントモジュール群14697446
Ref: library/xmlrpc doc14697739
Ref: 422114697739
Ref: library/xmlrpc module-xmlrpc14697739
Ref: 13414697739
Ref: library/xmlrpc translation-repo14697739
Ref: 422214697739
Ref: library/xmlrpc xmlrpc-xmlrpc-server-and-client-modules14697739
Ref: 422314697739
Node: xmlrpc client --- XML-RPC クライアントアクセス14698469
Ref: library/xmlrpc client doc14698751
Ref: 422414698751
Ref: library/xmlrpc client module-xmlrpc client14698751
Ref: 13514698751
Ref: library/xmlrpc client translation-repo14698751
Ref: 422514698751
Ref: library/xmlrpc client xmlrpc-client-xml-rpc-client-access14698751
Ref: 422614698751
Ref: library/xmlrpc client xmlrpc client ServerProxy14700086
Ref: c5014700086
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-114709056
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-214709129
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-314709223
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-414709279
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-514709338
Node: ServerProxy オブジェクト14709384
Ref: library/xmlrpc client id114709543
Ref: 422a14709543
Ref: library/xmlrpc client serverproxy-objects14709543
Ref: 422b14709543
Ref: library/xmlrpc client xmlrpc client ServerProxy system listMethods14710223
Ref: 422c14710223
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodSignature14710409
Ref: 422d14710409
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodHelp14711527
Ref: 422e14711527
Node: DateTime オブジェクト14712657
Ref: library/xmlrpc client datetime-objects14712850
Ref: 422f14712850
Ref: library/xmlrpc client id214712850
Ref: 423014712850
Ref: library/xmlrpc client xmlrpc client DateTime14712921
Ref: 160114712921
Ref: library/xmlrpc client xmlrpc client DateTime decode14713381
Ref: 423114713381
Ref: library/xmlrpc client xmlrpc client DateTime encode14713520
Ref: 423214713520
Node: Binary オブジェクト14714689
Ref: library/xmlrpc client binary-objects14714876
Ref: 423314714876
Ref: library/xmlrpc client id314714876
Ref: 423414714876
Ref: library/xmlrpc client xmlrpc client Binary14714943
Ref: 422714714943
Ref: library/xmlrpc client xmlrpc client Binary data14715151
Ref: 423514715151
Ref: library/xmlrpc client xmlrpc client Binary decode14715523
Ref: 423614715523
Ref: library/xmlrpc client xmlrpc client Binary encode14715709
Ref: 423714715709
Ref: Binary オブジェクト-Footnote-114717082
Node: Fault オブジェクト14717153
Ref: library/xmlrpc client fault-objects14717345
Ref: 423814717345
Ref: library/xmlrpc client id414717345
Ref: 423914717345
Ref: library/xmlrpc client xmlrpc client Fault14717410
Ref: 422814717410
Ref: library/xmlrpc client xmlrpc client Fault faultCode14717596
Ref: 423a14717596
Ref: library/xmlrpc client xmlrpc client Fault faultString14717675
Ref: 423b14717675
Node: ProtocolError オブジェクト14718638
Ref: library/xmlrpc client protocol-error-objects14718833
Ref: 423c14718833
Ref: library/xmlrpc client protocolerror-objects14718833
Ref: 423d14718833
Ref: library/xmlrpc client xmlrpc client ProtocolError14718914
Ref: 422914718914
Ref: library/xmlrpc client xmlrpc client ProtocolError url14719223
Ref: 423e14719223
Ref: library/xmlrpc client xmlrpc client ProtocolError errcode14719308
Ref: 423f14719308
Ref: library/xmlrpc client xmlrpc client ProtocolError errmsg14719370
Ref: 424014719370
Ref: library/xmlrpc client xmlrpc client ProtocolError headers14719461
Ref: 424114719461
Node: MultiCall オブジェクト14720183
Ref: library/xmlrpc client multicall-objects14720366
Ref: 424214720366
Ref: library/xmlrpc client xmlrpc client MultiCall14720622
Ref: 424314720622
Ref: MultiCall オブジェクト-Footnote-114722363
Node: 補助関数14722561
Ref: library/xmlrpc client convenience-functions14722745
Ref: 424414722745
Ref: library/xmlrpc client xmlrpc client dumps14722788
Ref: 179514722788
Ref: library/xmlrpc client xmlrpc client loads14723499
Ref: 165314723499
Node: クライアントのサンプル14724557
Ref: library/xmlrpc client example-of-client-usage14724758
Ref: 424514724758
Ref: library/xmlrpc client xmlrpc-client-example14724758
Ref: 424614724758
Node: クライアントとサーバーの利用例14726127
Ref: library/xmlrpc client example-of-client-and-server-usage14726307
Ref: 424714726307
Node: xmlrpc server --- 基本的な XML-RPC サーバー14726490
Ref: library/xmlrpc server doc14726748
Ref: 424914726748
Ref: library/xmlrpc server module-xmlrpc server14726748
Ref: 13614726748
Ref: library/xmlrpc server translation-repo14726748
Ref: 424a14726748
Ref: library/xmlrpc server xmlrpc-server-basic-xml-rpc-servers14726748
Ref: 424b14726748
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer14727649
Ref: 424c14727649
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler14729467
Ref: 424d14729467
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler14730196
Ref: 154314730196
Ref: xmlrpc server --- 基本的な XML-RPC サーバー-Footnote-114730762
Node: SimpleXMLRPCServer objects14730835
Ref: library/xmlrpc server simple-xmlrpc-servers14730981
Ref: 424e14730981
Ref: library/xmlrpc server simplexmlrpcserver-objects14730981
Ref: 424f14730981
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_function14731263
Ref: 425014731263
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_instance14732333
Ref: 425114732333
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_introspection_functions14734215
Ref: 425214734215
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_multicall_functions14734459
Ref: 425314734459
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler rpc_paths14734637
Ref: 425414734637
Node: SimpleXMLRPCServer example14735176
Ref: library/xmlrpc server id114735265
Ref: 425514735265
Ref: library/xmlrpc server simplexmlrpcserver-example14735265
Ref: 424814735265
Node: CGIXMLRPCRequestHandler14739964
Ref: library/xmlrpc server cgixmlrpcrequesthandler14740147
Ref: 425614740147
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_function14740385
Ref: 425714740385
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_instance14741460
Ref: 425814741460
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_introspection_functions14742466
Ref: 425914742466
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_multicall_functions14742725
Ref: 425a14742725
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler handle_request14742884
Ref: 425b14742884
Node: XMLRPC サーバの文書化14743580
Ref: library/xmlrpc server documenting-xmlrpc-server14743760
Ref: 425c14743760
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer14744176
Ref: 1e0314744176
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler14744761
Ref: 425d14744761
Ref: library/xmlrpc server xmlrpc server DocXMLRPCRequestHandler14744930
Ref: 425e14744930
Node: DocXMLRPCServer objects14745351
Ref: library/xmlrpc server doc-xmlrpc-servers14745534
Ref: 425f14745534
Ref: library/xmlrpc server docxmlrpcserver-objects14745534
Ref: 426014745534
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_title14746071
Ref: 426114746071
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_name14746292
Ref: 426214746292
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_documentation14746518
Ref: 426314746518
Node: DocCGIXMLRPCRequestHandler14746789
Ref: library/xmlrpc server doccgixmlrpcrequesthandler14746935
Ref: 426414746935
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_title14747479
Ref: 426514747479
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_name14747711
Ref: 426614747711
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_documentation14747948
Ref: 426714747948
Node: ipaddress --- IPv4/IPv6 操作ライブラリ14748230
Ref: library/ipaddress doc14748423
Ref: 426814748423
Ref: library/ipaddress ipaddress-ipv4-ipv6-manipulation-library14748423
Ref: 426914748423
Ref: library/ipaddress module-ipaddress14748423
Ref: 8414748423
Ref: library/ipaddress translation-repo14748423
Ref: 426a14748423
Ref: ipaddress --- IPv4/IPv6 操作ライブラリ-Footnote-114749658
Node: 便利なファクトリ関数14749727
Ref: library/ipaddress convenience-factory-functions14749863
Ref: 426c14749863
Ref: library/ipaddress ipaddress ip_address14750053
Ref: 426d14750053
Ref: library/ipaddress ipaddress ip_network14750725
Ref: 426e14750725
Ref: library/ipaddress ipaddress ip_interface14751604
Ref: 426f14751604
Node: IP アドレス14752668
Ref: library/ipaddress ip-addresses14752840
Ref: 427014752840
Node: Address オブジェクト14752992
Ref: library/ipaddress address-objects14753109
Ref: 427114753109
Ref: library/ipaddress ipaddress IPv4Address14753632
Ref: 50c14753632
Ref: library/ipaddress ipaddress IPv4Address version14755029
Ref: 427314755029
Ref: library/ipaddress ipaddress IPv4Address max_prefixlen14755215
Ref: 427414755215
Ref: library/ipaddress ipaddress IPv4Address compressed14755658
Ref: 427514755658
Ref: library/ipaddress ipaddress IPv4Address exploded14755690
Ref: 427614755690
Ref: library/ipaddress ipaddress IPv4Address packed14756237
Ref: 427714756237
Ref: library/ipaddress ipaddress IPv4Address reverse_pointer14756491
Ref: 102414756491
Ref: library/ipaddress ipaddress IPv4Address is_multicast14757038
Ref: 427814757038
Ref: library/ipaddress ipaddress IPv4Address is_private14757236
Ref: 1a2014757236
Ref: library/ipaddress ipaddress IPv4Address is_global14758894
Ref: 116514758894
Ref: library/ipaddress ipaddress IPv4Address is_unspecified14759816
Ref: 427a14759816
Ref: library/ipaddress ipaddress IPv4Address is_reserved14759975
Ref: 427b14759975
Ref: library/ipaddress ipaddress IPv4Address is_loopback14760681
Ref: 427d14760681
Ref: library/ipaddress ipaddress IPv4Address is_link_local14760854
Ref: 427e14760854
Ref: library/ipaddress ipaddress IPv4Address ipv6_mapped14761024
Ref: 50b14761024
Ref: library/ipaddress ipaddress IPv4Address __format__14761199
Ref: 427f14761199
Ref: library/ipaddress ipaddress IPv6Address14762455
Ref: 50d14762455
Ref: library/ipaddress ipaddress IPv6Address compressed14763936
Ref: 428014763936
Ref: library/ipaddress ipaddress IPv6Address exploded14764286
Ref: 428114764286
Ref: library/ipaddress ipaddress IPv6Address packed14764624
Ref: 428214764624
Ref: library/ipaddress ipaddress IPv6Address reverse_pointer14764652
Ref: 199a14764652
Ref: library/ipaddress ipaddress IPv6Address version14764689
Ref: 428314764689
Ref: library/ipaddress ipaddress IPv6Address max_prefixlen14764718
Ref: 428414764718
Ref: library/ipaddress ipaddress IPv6Address is_multicast14764753
Ref: 428514764753
Ref: library/ipaddress ipaddress IPv6Address is_private14764787
Ref: 1a2114764787
Ref: library/ipaddress ipaddress IPv6Address is_global14764819
Ref: 1a2214764819
Ref: library/ipaddress ipaddress IPv6Address is_unspecified14764883
Ref: 428614764883
Ref: library/ipaddress ipaddress IPv6Address is_reserved14764919
Ref: 428714764919
Ref: library/ipaddress ipaddress IPv6Address is_loopback14764952
Ref: 1a0814764952
Ref: library/ipaddress ipaddress IPv6Address is_link_local14764985
Ref: 428814764985
Ref: library/ipaddress ipaddress IPv6Address is_site_local14765020
Ref: 427c14765020
Ref: library/ipaddress ipaddress IPv6Address ipv4_mapped14765543
Ref: 427914765543
Ref: library/ipaddress ipaddress IPv6Address scope_id14765839
Ref: b0e14765839
Ref: library/ipaddress ipaddress IPv6Address sixtofour14766137
Ref: 428914766137
Ref: library/ipaddress ipaddress IPv6Address teredo14766477
Ref: 428a14766477
Ref: library/ipaddress ipaddress IPv6Address __format__14766847
Ref: 428b14766847
Ref: Address オブジェクト-Footnote-114767074
Ref: Address オブジェクト-Footnote-214767133
Ref: Address オブジェクト-Footnote-314767192
Ref: Address オブジェクト-Footnote-414767294
Ref: Address オブジェクト-Footnote-514767396
Ref: Address オブジェクト-Footnote-614767498
Ref: Address オブジェクト-Footnote-714767600
Ref: Address オブジェクト-Footnote-814767659
Ref: Address オブジェクト-Footnote-914767718
Ref: Address オブジェクト-Footnote-1014767804
Ref: Address オブジェクト-Footnote-1114767907
Ref: Address オブジェクト-Footnote-1214767967
Ref: Address オブジェクト-Footnote-1314768027
Ref: Address オブジェクト-Footnote-1414768087
Ref: Address オブジェクト-Footnote-1514768147
Ref: Address オブジェクト-Footnote-1614768207
Ref: Address オブジェクト-Footnote-1714768267
Ref: Address オブジェクト-Footnote-1814768327
Ref: Address オブジェクト-Footnote-1914768387
Ref: Address オブジェクト-Footnote-2014768447
Ref: Address オブジェクト-Footnote-2114768507
Ref: Address オブジェクト-Footnote-2214768567
Ref: Address オブジェクト-Footnote-2314768627
Node: 文字列と整数への変換14768687
Ref: library/ipaddress conversion-to-strings-and-integers14768825
Ref: 428c14768825
Node: 演算子<2>14769490
Ref: library/ipaddress operators14769593
Ref: 428d14769593
Node: 比較演算子14769910
Ref: library/ipaddress comparison-operators14769995
Ref: 428e14769995
Node: 算術演算14770574
Ref: library/ipaddress arithmetic-operators14770659
Ref: 428f14770659
Node: IP ネットワーク定義14771154
Ref: library/ipaddress ip-network-definitions14771338
Ref: 429014771338
Node: プリフィックス ネットマスク、ホストマスク14772235
Ref: library/ipaddress prefix-net-mask-and-host-mask14772395
Ref: 429114772395
Node: Network オブジェクト14773296
Ref: library/ipaddress network-objects14773477
Ref: 429214773477
Ref: library/ipaddress ipaddress IPv4Network14774065
Ref: 50e14774065
Ref: library/ipaddress ipaddress IPv4Network version14776940
Ref: 429414776940
Ref: library/ipaddress ipaddress IPv4Network max_prefixlen14776969
Ref: 429514776969
Ref: library/ipaddress ipaddress IPv4Network is_multicast14777123
Ref: 429614777123
Ref: library/ipaddress ipaddress IPv4Network is_private14777157
Ref: 429714777157
Ref: library/ipaddress ipaddress IPv4Network is_unspecified14777189
Ref: 429814777189
Ref: library/ipaddress ipaddress IPv4Network is_reserved14777225
Ref: 429914777225
Ref: library/ipaddress ipaddress IPv4Network is_loopback14777258
Ref: 429a14777258
Ref: library/ipaddress ipaddress IPv4Network is_link_local14777291
Ref: 429b14777291
Ref: library/ipaddress ipaddress IPv4Network network_address14777483
Ref: 429c14777483
Ref: library/ipaddress ipaddress IPv4Network broadcast_address14777720
Ref: 429d14777720
Ref: library/ipaddress ipaddress IPv4Network hostmask14778000
Ref: 429e14778000
Ref: library/ipaddress ipaddress IPv4Network netmask14778141
Ref: 429f14778141
Ref: library/ipaddress ipaddress IPv4Network with_prefixlen14778281
Ref: 42a014778281
Ref: library/ipaddress ipaddress IPv4Network compressed14778317
Ref: 42a114778317
Ref: library/ipaddress ipaddress IPv4Network exploded14778349
Ref: 42a214778349
Ref: library/ipaddress ipaddress IPv4Network with_netmask14778650
Ref: 42a314778650
Ref: library/ipaddress ipaddress IPv4Network with_hostmask14778781
Ref: 42a414778781
Ref: library/ipaddress ipaddress IPv4Network num_addresses14778914
Ref: 42a514778914
Ref: library/ipaddress ipaddress IPv4Network prefixlen14779006
Ref: 42a614779006
Ref: library/ipaddress ipaddress IPv4Network hosts14779106
Ref: 181c14779106
Ref: library/ipaddress ipaddress IPv4Network overlaps14780109
Ref: 42a714780109
Ref: library/ipaddress ipaddress IPv4Network address_exclude14780287
Ref: 42a814780287
Ref: library/ipaddress ipaddress IPv4Network subnets14780899
Ref: 10a414780899
Ref: library/ipaddress ipaddress IPv4Network supernet14782453
Ref: 10a514782453
Ref: library/ipaddress ipaddress IPv4Network subnet_of14783265
Ref: 42a914783265
Ref: library/ipaddress ipaddress IPv4Network supernet_of14783620
Ref: 42aa14783620
Ref: library/ipaddress ipaddress IPv4Network compare_networks14783985
Ref: 42ab14783985
Ref: library/ipaddress ipaddress IPv6Network14784755
Ref: 50f14784755
Ref: library/ipaddress ipaddress IPv6Network version14786844
Ref: 42ac14786844
Ref: library/ipaddress ipaddress IPv6Network max_prefixlen14786873
Ref: 42ad14786873
Ref: library/ipaddress ipaddress IPv6Network is_multicast14786908
Ref: 42ae14786908
Ref: library/ipaddress ipaddress IPv6Network is_private14786942
Ref: 42af14786942
Ref: library/ipaddress ipaddress IPv6Network is_unspecified14786974
Ref: 42b014786974
Ref: library/ipaddress ipaddress IPv6Network is_reserved14787010
Ref: 42b114787010
Ref: library/ipaddress ipaddress IPv6Network is_loopback14787043
Ref: 42b214787043
Ref: library/ipaddress ipaddress IPv6Network is_link_local14787076
Ref: 42b314787076
Ref: library/ipaddress ipaddress IPv6Network network_address14787111
Ref: 42b414787111
Ref: library/ipaddress ipaddress IPv6Network broadcast_address14787148
Ref: 42b514787148
Ref: library/ipaddress ipaddress IPv6Network hostmask14787187
Ref: 42b614787187
Ref: library/ipaddress ipaddress IPv6Network netmask14787217
Ref: 42b714787217
Ref: library/ipaddress ipaddress IPv6Network with_prefixlen14787246
Ref: 42b814787246
Ref: library/ipaddress ipaddress IPv6Network compressed14787282
Ref: 42b914787282
Ref: library/ipaddress ipaddress IPv6Network exploded14787314
Ref: 42ba14787314
Ref: library/ipaddress ipaddress IPv6Network with_netmask14787344
Ref: 42bb14787344
Ref: library/ipaddress ipaddress IPv6Network with_hostmask14787378
Ref: 42bc14787378
Ref: library/ipaddress ipaddress IPv6Network num_addresses14787413
Ref: 42bd14787413
Ref: library/ipaddress ipaddress IPv6Network prefixlen14787448
Ref: 42be14787448
Ref: library/ipaddress ipaddress IPv6Network hosts14787479
Ref: 181d14787479
Ref: library/ipaddress ipaddress IPv6Network overlaps14787935
Ref: 42bf14787935
Ref: library/ipaddress ipaddress IPv6Network address_exclude14787976
Ref: 42c014787976
Ref: library/ipaddress ipaddress IPv6Network subnets14788026
Ref: 42c114788026
Ref: library/ipaddress ipaddress IPv6Network supernet14788094
Ref: 42c214788094
Ref: library/ipaddress ipaddress IPv6Network subnet_of14788163
Ref: 42c314788163
Ref: library/ipaddress ipaddress IPv6Network supernet_of14788205
Ref: 42c414788205
Ref: library/ipaddress ipaddress IPv6Network compare_networks14788249
Ref: 42c514788249
Ref: library/ipaddress ipaddress IPv6Network is_site_local14788417
Ref: 42c614788417
Node: 演算子<3>14788593
Ref: library/ipaddress id114788704
Ref: 42c714788704
Node: 論理演算子14789094
Ref: library/ipaddress logical-operators14789188
Ref: 42c814789188
Node: イテレーション14789384
Ref: library/ipaddress iteration14789544
Ref: 42c914789544
Node: アドレスのコンテナとしてのネットワーク14790389
Ref: library/ipaddress networks-as-containers-of-addresses14790525
Ref: 42ca14790525
Node: インターフェイスオブジェクト14791069
Ref: library/ipaddress interface-objects14791280
Ref: 42cb14791280
Ref: library/ipaddress ipaddress IPv4Interface14791502
Ref: 1bf614791502
Ref: library/ipaddress ipaddress IPv4Interface ip14791915
Ref: 42cc14791915
Ref: library/ipaddress ipaddress IPv4Interface network14792161
Ref: 42cd14792161
Ref: library/ipaddress ipaddress IPv4Interface with_prefixlen14792418
Ref: 42ce14792418
Ref: library/ipaddress ipaddress IPv4Interface with_netmask14792686
Ref: 42cf14792686
Ref: library/ipaddress ipaddress IPv4Interface with_hostmask14792959
Ref: 42d014792959
Ref: library/ipaddress ipaddress IPv6Interface14793231
Ref: 1bf714793231
Ref: library/ipaddress ipaddress IPv6Interface ip14793651
Ref: 42d114793651
Ref: library/ipaddress ipaddress IPv6Interface network14793675
Ref: 42d214793675
Ref: library/ipaddress ipaddress IPv6Interface with_prefixlen14793704
Ref: 42d314793704
Ref: library/ipaddress ipaddress IPv6Interface with_netmask14793740
Ref: 42d414793740
Ref: library/ipaddress ipaddress IPv6Interface with_hostmask14793774
Ref: 42d514793774
Node: 演算子<4>14793968
Ref: library/ipaddress id214794059
Ref: 42d614794059
Node: 論理演算子<2>14794382
Ref: library/ipaddress id314794449
Ref: 42d714794449
Node: その他のモジュールレベル関数14795097
Ref: library/ipaddress other-module-level-functions14795298
Ref: 42d814795298
Ref: library/ipaddress ipaddress v4_int_to_packed14795483
Ref: 42d914795483
Ref: library/ipaddress ipaddress v6_int_to_packed14796062
Ref: 42da14796062
Ref: library/ipaddress ipaddress summarize_address_range14796476
Ref: 10a614796476
Ref: library/ipaddress ipaddress collapse_addresses14797489
Ref: 10a714797489
Ref: library/ipaddress ipaddress get_mixed_type_key14798059
Ref: 42db14798059
Node: Custom Exceptions14798776
Ref: library/ipaddress custom-exceptions14798926
Ref: 42dc14798926
Ref: library/ipaddress ipaddress AddressValueError14799139
Ref: 427214799139
Ref: library/ipaddress ipaddress NetmaskValueError14799239
Ref: 429314799239
Node: マルチメディアサービス14799340
Ref: library/mm doc14799516
Ref: 42dd14799516
Ref: library/mm mmedia14799516
Ref: 42de14799516
Ref: library/mm multimedia-services14799516
Ref: 42df14799516
Ref: library/mm translation-repo14799516
Ref: 42e014799516
Node: wave --- WAV ファイルの読み書き14800057
Ref: library/wave doc14800210
Ref: 42e114800210
Ref: library/wave module-wave14800210
Ref: 11a14800210
Ref: library/wave wave-read-and-write-wav-files14800210
Ref: 42e214800210
Ref: library/wave wave open14800806
Ref: b4914800806
Ref: library/wave wave Error14802122
Ref: 42e514802122
Ref: wave --- WAV ファイルの読み書き-Footnote-114802395
Node: Wave_read オブジェクト14802459
Ref: library/wave id114802602
Ref: 42e614802602
Ref: library/wave wave-read-objects14802602
Ref: 42e714802602
Ref: library/wave wave Wave_read14802673
Ref: 33414802673
Ref: library/wave wave Wave_read close14802858
Ref: 42e314802858
Ref: library/wave wave Wave_read getnchannels14803055
Ref: 42e814803055
Ref: library/wave wave Wave_read getsampwidth14803232
Ref: 42e914803232
Ref: library/wave wave Wave_read getframerate14803338
Ref: 42ea14803338
Ref: library/wave wave Wave_read getnframes14803435
Ref: 42eb14803435
Ref: library/wave wave Wave_read getcomptype14803533
Ref: 42ec14803533
Ref: library/wave wave Wave_read getcompname14803693
Ref: 42ed14803693
Ref: library/wave wave Wave_read getparams14803913
Ref: 11f014803913
Ref: library/wave wave Wave_read readframes14804136
Ref: 42ee14804136
Ref: library/wave wave Wave_read rewind14804323
Ref: 42ef14804323
Ref: library/wave wave Wave_read getmarkers14804590
Ref: 33314804590
Ref: library/wave wave Wave_read getmark14804872
Ref: 33214804872
Ref: library/wave wave Wave_read setpos14805305
Ref: 42f014805305
Ref: library/wave wave Wave_read tell14805423
Ref: 42f114805423
Node: Wave_write オブジェクト14805527
Ref: library/wave id214805670
Ref: 42f214805670
Ref: library/wave wave-write-objects14805670
Ref: 11f114805670
Ref: library/wave wave Wave_write14805743
Ref: 33514805743
Ref: library/wave wave Wave_write close14806824
Ref: 42e414806824
Ref: library/wave wave Wave_write setnchannels14807171
Ref: 42f514807171
Ref: library/wave wave Wave_write getnchannels14807263
Ref: 42f614807263
Ref: library/wave wave Wave_write setsampwidth14807345
Ref: 42f714807345
Ref: library/wave wave Wave_write getsampwidth14807457
Ref: 42f814807457
Ref: library/wave wave Wave_write setframerate14807542
Ref: 42f914807542
Ref: library/wave wave Wave_write getframerate14807816
Ref: 42fa14807816
Ref: library/wave wave Wave_write setnframes14807890
Ref: 42f314807890
Ref: library/wave wave Wave_write getnframes14808220
Ref: 42fb14808220
Ref: library/wave wave Wave_write setcomptype14808319
Ref: 42fc14808319
Ref: library/wave wave Wave_write getcomptype14808544
Ref: 42fd14808544
Ref: library/wave wave Wave_write getcompname14808638
Ref: 42fe14808638
Ref: library/wave wave Wave_write setparams14808737
Ref: 42f414808737
Ref: library/wave wave Wave_write getparams14808972
Ref: 42ff14808972
Ref: library/wave wave Wave_write tell14809185
Ref: 430014809185
Ref: library/wave wave Wave_write writeframesraw14809455
Ref: 11f214809455
Ref: library/wave wave Wave_write writeframes14809736
Ref: 11f314809736
Node: colorsys --- 色体系間の変換14810490
Ref: library/colorsys doc14810643
Ref: 430114810643
Ref: library/colorsys colorsys-conversions-between-color-systems14810643
Ref: 430214810643
Ref: library/colorsys module-colorsys14810643
Ref: 2014810643
Ref: library/colorsys translation-repo14810643
Ref: 430314810643
Ref: library/colorsys colorsys rgb_to_yiq14811604
Ref: 430414811604
Ref: library/colorsys colorsys yiq_to_rgb14811693
Ref: 430514811693
Ref: library/colorsys colorsys rgb_to_hls14811782
Ref: 1ad314811782
Ref: library/colorsys colorsys hls_to_rgb14811871
Ref: 430614811871
Ref: library/colorsys colorsys rgb_to_hsv14811960
Ref: 430714811960
Ref: library/colorsys colorsys hsv_to_rgb14812049
Ref: 430814812049
Ref: colorsys --- 色体系間の変換-Footnote-114812366
Node: 国際化14812434
Ref: library/i18n doc14812592
Ref: 430914812592
Ref: library/i18n i18n14812592
Ref: 430a14812592
Ref: library/i18n internationalization14812592
Ref: 430b14812592
Ref: library/i18n translation-repo14812592
Ref: 430c14812592
Node: gettext --- 多言語国際化サービス14813140
Ref: library/gettext doc14813269
Ref: 430d14813269
Ref: library/gettext gettext-multilingual-internationalization-services14813269
Ref: 430e14813269
Ref: library/gettext module-gettext14813269
Ref: 6714813269
Ref: gettext --- 多言語国際化サービス-Footnote-114814275
Node: GNU gettext API14814342
Ref: library/gettext gnu-gettext-api14814467
Ref: 430f14814467
Ref: library/gettext gettext bindtextdomain14815006
Ref: 431014815006
Ref: library/gettext gettext textdomain14815637
Ref: 431114815637
Ref: library/gettext gettext gettext14816033
Ref: 168714816033
Ref: library/gettext gettext dgettext14816306
Ref: 431214816306
Ref: library/gettext gettext ngettext14816481
Ref: 431314816481
Ref: library/gettext gettext dngettext14817451
Ref: 431414817451
Ref: library/gettext gettext pgettext14817640
Ref: bec14817640
Ref: library/gettext gettext dpgettext14817695
Ref: 431514817695
Ref: library/gettext gettext npgettext14817759
Ref: 431614817759
Ref: library/gettext gettext dnpgettext14817827
Ref: 431714817827
Ref: GNU gettext API-Footnote-114818660
Ref: GNU gettext API-Footnote-214819140
Node: クラス形式の API14819205
Ref: library/gettext class-based-api14819390
Ref: 431814819390
Ref: library/gettext gettext find14819923
Ref: 431a14819923
Ref: library/gettext gettext translation14821805
Ref: c7114821805
Ref: library/gettext gettext install14823335
Ref: c7214823335
Ref: クラス形式の API-Footnote-114824428
Node: NullTranslations クラス14824523
Ref: library/gettext the-nulltranslations-class14824642
Ref: 431d14824642
Ref: library/gettext gettext NullTranslations14825242
Ref: 431b14825242
Ref: library/gettext gettext NullTranslations _parse14825895
Ref: 431f14825895
Ref: library/gettext gettext NullTranslations add_fallback14826457
Ref: 431e14826457
Ref: library/gettext gettext NullTranslations gettext14826846
Ref: 432014826846
Ref: library/gettext gettext NullTranslations ngettext14827199
Ref: 432114827199
Ref: library/gettext gettext NullTranslations pgettext14827599
Ref: 432214827599
Ref: library/gettext gettext NullTranslations npgettext14827975
Ref: 432314827975
Ref: library/gettext gettext NullTranslations info14828366
Ref: 432414828366
Ref: library/gettext gettext NullTranslations charset14828498
Ref: 432514828498
Ref: library/gettext gettext NullTranslations install14828629
Ref: 431c14828629
Node: GNUTranslations クラス14829905
Ref: library/gettext the-gnutranslations-class14830089
Ref: 432614830089
Ref: library/gettext gettext GNUTranslations14831724
Ref: 431914831724
Ref: library/gettext gettext GNUTranslations gettext14831862
Ref: 432714831862
Ref: library/gettext gettext GNUTranslations ngettext14832404
Ref: 432814832404
Ref: library/gettext gettext GNUTranslations pgettext14833525
Ref: 432914833525
Ref: library/gettext gettext GNUTranslations npgettext14834148
Ref: 432a14834148
Ref: GNUTranslations クラス-Footnote-114835006
Node: Solaris メッセージカタログ機構のサポート14835064
Ref: library/gettext solaris-message-catalog-support14835251
Ref: 432b14835251
Node: Catalog コンストラクタ14835628
Ref: library/gettext the-catalog-constructor14835781
Ref: 432c14835781
Node: プログラムやモジュールを国際化する14836580
Ref: library/gettext i18n-howto14836759
Ref: 346d14836759
Ref: library/gettext internationalizing-your-programs-and-modules14836759
Ref: 432d14836759
Ref: プログラムやモジュールを国際化する-Footnote-114841167
Ref: プログラムやモジュールを国際化する-Footnote-214841200
Node: モジュールを地域化する14841243
Ref: library/gettext localizing-your-module14841415
Ref: 432e14841415
Node: アプリケーションを地域化する14842159
Ref: library/gettext localizing-your-application14842388
Ref: 432f14842388
Node: 動作中 on the fly に言語を切り替える14843182
Ref: library/gettext changing-languages-on-the-fly14843405
Ref: 433014843405
Node: 翻訳処理の遅延解決14844182
Ref: library/gettext deferred-translations14844354
Ref: 433114844354
Node: 謝辞<9>14846815
Ref: library/gettext acknowledgements14846963
Ref: 433214846963
Node: locale --- 国際化サービス14847394
Ref: library/locale doc14847523
Ref: 433314847523
Ref: library/locale locale-internationalization-services14847523
Ref: 433414847523
Ref: library/locale module-locale14847523
Ref: 8a14847523
Ref: library/locale translation-repo14847523
Ref: 433514847523
Ref: library/locale locale Error14848220
Ref: 433614848220
Ref: library/locale locale setlocale14848367
Ref: 93014848367
Ref: library/locale locale localeconv14850428
Ref: dfc14850428
Ref: library/locale locale nl_langinfo14858836
Ref: 45214858836
Ref: library/locale locale CODESET14859452
Ref: 433a14859452
Ref: library/locale locale D_T_FMT14859634
Ref: 433b14859634
Ref: library/locale locale D_FMT14859889
Ref: 433c14859889
Ref: library/locale locale T_FMT14860133
Ref: 433d14860133
Ref: library/locale locale T_FMT_AMPM14860377
Ref: 433e14860377
Ref: library/locale locale DAY_114860623
Ref: 433f14860623
Ref: library/locale locale DAY_214860656
Ref: 434014860656
Ref: library/locale locale DAY_314860689
Ref: 434114860689
Ref: library/locale locale DAY_414860722
Ref: 434214860722
Ref: library/locale locale DAY_514860755
Ref: 434314860755
Ref: library/locale locale DAY_614860788
Ref: 434414860788
Ref: library/locale locale DAY_714860821
Ref: 434514860821
Ref: library/locale locale ABDAY_114861169
Ref: 434614861169
Ref: library/locale locale ABDAY_214861204
Ref: 434714861204
Ref: library/locale locale ABDAY_314861239
Ref: 434814861239
Ref: library/locale locale ABDAY_414861274
Ref: 434914861274
Ref: library/locale locale ABDAY_514861309
Ref: 434a14861309
Ref: library/locale locale ABDAY_614861344
Ref: 434b14861344
Ref: library/locale locale ABDAY_714861379
Ref: 434c14861379
Ref: library/locale locale MON_114861498
Ref: 434d14861498
Ref: library/locale locale MON_214861531
Ref: 434e14861531
Ref: library/locale locale MON_314861564
Ref: 434f14861564
Ref: library/locale locale MON_414861597
Ref: 435014861597
Ref: library/locale locale MON_514861630
Ref: 435114861630
Ref: library/locale locale MON_614861663
Ref: 435214861663
Ref: library/locale locale MON_714861696
Ref: 435314861696
Ref: library/locale locale MON_814861729
Ref: 435414861729
Ref: library/locale locale MON_914861762
Ref: 435514861762
Ref: library/locale locale MON_1014861795
Ref: 435614861795
Ref: library/locale locale MON_1114861829
Ref: 435714861829
Ref: library/locale locale MON_1214861863
Ref: 435814861863
Ref: library/locale locale ABMON_114861954
Ref: 435914861954
Ref: library/locale locale ABMON_214861989
Ref: 435a14861989
Ref: library/locale locale ABMON_314862024
Ref: 435b14862024
Ref: library/locale locale ABMON_414862059
Ref: 435c14862059
Ref: library/locale locale ABMON_514862094
Ref: 435d14862094
Ref: library/locale locale ABMON_614862129
Ref: 435e14862129
Ref: library/locale locale ABMON_714862164
Ref: 435f14862164
Ref: library/locale locale ABMON_814862199
Ref: 436014862199
Ref: library/locale locale ABMON_914862234
Ref: 436114862234
Ref: library/locale locale ABMON_1014862269
Ref: 436214862269
Ref: library/locale locale ABMON_1114862305
Ref: 436314862305
Ref: library/locale locale ABMON_1214862341
Ref: 436414862341
Ref: library/locale locale RADIXCHAR14862449
Ref: 436514862449
Ref: library/locale locale THOUSEP14862590
Ref: 436614862590
Ref: library/locale locale YESEXPR14862744
Ref: 436714862744
Ref: library/locale locale NOEXPR14862953
Ref: 436814862953
Ref: library/locale locale CRNCYSTR14863417
Ref: 436914863417
Ref: library/locale locale ERA14863720
Ref: 436a14863720
Ref: library/locale locale ERA_D_T_FMT14864549
Ref: 436b14864549
Ref: library/locale locale ERA_D_FMT14864836
Ref: 436c14864836
Ref: library/locale locale ERA_T_FMT14865105
Ref: 436d14865105
Ref: library/locale locale ALT_DIGITS14865374
Ref: 436e14865374
Ref: library/locale locale getdefaultlocale14866063
Ref: 92f14866063
Ref: library/locale locale getlocale14867585
Ref: 93114867585
Ref: library/locale locale getpreferredencoding14868158
Ref: 75c14868158
Ref: library/locale locale getencoding14869570
Ref: 86614869570
Ref: library/locale locale normalize14870345
Ref: 437214870345
Ref: library/locale locale strcoll14870962
Ref: 437314870962
Ref: library/locale locale strxfrm14871372
Ref: 182814871372
Ref: library/locale locale format_string14871790
Ref: 74214871790
Ref: library/locale locale currency14872553
Ref: 437514872553
Ref: library/locale locale str14873386
Ref: 437614873386
Ref: library/locale locale delocalize14873576
Ref: 102a14873576
Ref: library/locale locale localize14873787
Ref: 437714873787
Ref: library/locale locale atof14874008
Ref: 437814874008
Ref: library/locale locale atoi14874234
Ref: 437914874234
Ref: library/locale locale LC_CTYPE14874384
Ref: 437014874384
Ref: library/locale locale LC_COLLATE14875050
Ref: 437414875050
Ref: library/locale locale LC_TIME14875243
Ref: 437a14875243
Ref: library/locale locale LC_MONETARY14875451
Ref: 433914875451
Ref: library/locale locale LC_MESSAGES14875681
Ref: 437b14875681
Ref: library/locale locale LC_NUMERIC14876267
Ref: 27be14876267
Ref: library/locale locale LC_ALL14876590
Ref: 436f14876590
Ref: library/locale locale CHAR_MAX14877224
Ref: 433814877224
Ref: locale --- 国際化サービス-Footnote-114877629
Ref: locale --- 国際化サービス-Footnote-214877695
Ref: locale --- 国際化サービス-Footnote-314877793
Ref: locale --- 国際化サービス-Footnote-414877835
Node: ロケールの背景、詳細、ヒント、助言および補足説明14877877
Ref: library/locale background-details-hints-tips-and-caveats14878039
Ref: 437c14878039
Node: Locale names14880939
Ref: library/locale locale-name14881196
Ref: 433714881196
Ref: library/locale locale-names14881196
Ref: 437d14881196
Ref: Locale names-Footnote-114882810
Ref: Locale names-Footnote-214882960
Ref: Locale names-Footnote-314883010
Ref: Locale names-Footnote-414883066
Ref: Locale names-Footnote-514883239
Ref: Locale names-Footnote-614883328
Ref: Locale names-Footnote-714883374
Node: Python 拡張の作者と、Python を埋め込むようなプログラムに関して14883416
Ref: library/locale embedding-locale14883646
Ref: 437e14883646
Ref: library/locale for-extension-writers-and-programs-that-embed-python14883646
Ref: 437f14883646
Node: メッセージカタログへのアクセス14884577
Ref: library/locale access-to-message-catalogs14884786
Ref: 438014884786
Ref: library/locale locale-gettext14884786
Ref: 438114884786
Ref: library/locale locale gettext14884882
Ref: 438214884882
Ref: library/locale locale dgettext14884919
Ref: 438314884919
Ref: library/locale locale dcgettext14884965
Ref: 438414884965
Ref: library/locale locale textdomain14885022
Ref: 438514885022
Ref: library/locale locale bindtextdomain14885065
Ref: 438614885065
Ref: library/locale locale bind_textdomain_codeset14885117
Ref: 438714885117
Node: Graphical user interfaces with Tk14886327
Ref: library/tk doc14886467
Ref: 438814886467
Ref: library/tk graphical-user-interfaces-with-tk14886467
Ref: 438914886467
Ref: library/tk tkinter14886467
Ref: 438a14886467
Ref: library/tk translation-repo14886467
Ref: 438b14886467
Ref: Graphical user interfaces with Tk-Footnote-114888963
Node: tkinter --- Tcl/Tk の Python インターフェース14889015
Ref: library/tkinter doc14889203
Ref: 438c14889203
Ref: library/tkinter module-tkinter14889203
Ref: f614889203
Ref: library/tkinter tkinter-python-interface-to-tcl-tk14889203
Ref: 438d14889203
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-114892969
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-214893046
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-314893074
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-414893114
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-514893175
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-614893202
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-714893239
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-814893337
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-914893389
Node: Architecture14893448
Ref: library/tkinter architecture14893575
Ref: 438e14893575
Ref: Architecture-Footnote-114895905
Node: Tkinter modules14895945
Ref: library/tkinter tkinter-modules14896103
Ref: 439014896103
Ref: library/tkinter module-_tkinter14897590
Ref: 314897590
Node: Tkinter life preserver14898529
Ref: library/tkinter tkinter-life-preserver14898690
Ref: 439114898690
Node: A Hello World program14899546
Ref: library/tkinter a-hello-world-program14899656
Ref: 439214899656
Node: Important Tk concepts14901137
Ref: library/tkinter important-tk-concepts14901294
Ref: 439614901294
Node: Understanding how Tkinter wraps Tcl/Tk14902659
Ref: library/tkinter understanding-how-tkinter-wraps-tcl-tk14902824
Ref: 439a14902824
Node: How do I ? What option does ?14904966
Ref: library/tkinter how-do-i-what-option-does14905148
Ref: 439b14905148
Node: Navigating the Tcl/Tk reference manual14906901
Ref: library/tkinter navigating-the-tcl-tk-reference-manual14907036
Ref: 439e14907036
Ref: Navigating the Tcl/Tk reference manual-Footnote-114909162
Ref: Navigating the Tcl/Tk reference manual-Footnote-214909223
Ref: Navigating the Tcl/Tk reference manual-Footnote-314909289
Ref: Navigating the Tcl/Tk reference manual-Footnote-414909349
Ref: Navigating the Tcl/Tk reference manual-Footnote-514909412
Ref: Navigating the Tcl/Tk reference manual-Footnote-614909478
Node: Threading model14909539
Ref: library/tkinter threading-model14909700
Ref: 438f14909700
Node: Handy reference14912838
Ref: library/tkinter handy-reference14912998
Ref: 43a514912998
Node: Setting options14913252
Ref: library/tkinter setting-options14913338
Ref: 43a614913338
Ref: library/tkinter tkinter-setting-options14913338
Ref: 43a714913338
Ref: Setting options-Footnote-114917354
Node: The packer14917401
Ref: library/tkinter pack-the-packer14917510
Ref: 43a914917510
Ref: library/tkinter the-packer14917510
Ref: 43aa14917510
Node: Packer options14919260
Ref: library/tkinter packer-options14919379
Ref: 43ac14919379
Node: Coupling widget variables14920143
Ref: library/tkinter coupling-widget-variables14920270
Ref: 43ad14920270
Ref: library/tkinter id214920270
Ref: 43ae14920270
Node: The window manager14922675
Ref: library/tkinter the-window-manager14922808
Ref: 43b414922808
Node: Tk option data types14924372
Ref: library/tkinter tk-option-data-types14924499
Ref: 43b814924499
Node: Bindings and events14928426
Ref: library/tkinter bindings-and-events14928554
Ref: 43b914928554
Ref: library/tkinter id314928554
Ref: 43ba14928554
Ref: Bindings and events-Footnote-114933045
Ref: Bindings and events-Footnote-214933091
Ref: Bindings and events-Footnote-314933137
Node: The index parameter14933184
Ref: library/tkinter the-index-parameter14933298
Ref: 43bb14933298
Node: 画像14935920
Ref: library/tkinter images14936006
Ref: 43bc14936006
Ref: 画像-Footnote-114937437
Node: リファレンス<8>14937472
Ref: library/tkinter reference14937608
Ref: 43bf14937608
Ref: library/tkinter tkinter TclError14937894
Ref: 43c014937894
Node: Base and mixin classes14938280
Ref: library/tkinter base-and-mixin-classes14938385
Ref: 43c114938385
Ref: library/tkinter tkinter Misc14938452
Ref: 43c214938452
Ref: library/tkinter tkinter Misc cget14939115
Ref: 43c414939115
Ref: library/tkinter tkinter Misc config14939349
Ref: 43a814939349
Ref: library/tkinter tkinter Misc configure14939349
Ref: 439c14939349
Ref: library/tkinter tkinter Misc keys14940092
Ref: 439d14940092
Ref: library/tkinter tkinter Misc getboolean14940217
Ref: 43c514940217
Ref: library/tkinter tkinter Misc getdouble14940553
Ref: 43c614940553
Ref: library/tkinter tkinter Misc getint14940808
Ref: 43c714940808
Ref: library/tkinter tkinter Misc getvar14941013
Ref: 43c814941013
Ref: library/tkinter tkinter Misc setvar14941129
Ref: 43c914941129
Ref: library/tkinter tkinter Misc register14941584
Ref: 43ca14941584
Ref: library/tkinter tkinter Misc deletecommand14942306
Ref: 43cb14942306
Ref: library/tkinter tkinter Misc nametowidget14942468
Ref: 43cc14942468
Ref: library/tkinter tkinter Misc send14942601
Ref: 43cd14942601
Ref: library/tkinter tkinter Misc destroy14942856
Ref: 439414942856
Ref: library/tkinter tkinter Misc lift14943017
Ref: 43ce14943017
Ref: library/tkinter tkinter Misc tkraise14943017
Ref: 43cf14943017
Ref: library/tkinter tkinter Misc lower14943341
Ref: 43d014943341
Ref: library/tkinter tkinter Misc image_names14943781
Ref: 43d114943781
Ref: library/tkinter tkinter Misc image_types14944076
Ref: 43d214944076
Ref: library/tkinter tkinter Misc anchor14944212
Ref: 43d314944212
Ref: library/tkinter tkinter Misc grid_anchor14944212
Ref: 43d414944212
Ref: library/tkinter tkinter Misc bbox14944739
Ref: 43d514944739
Ref: library/tkinter tkinter Misc grid_bbox14944739
Ref: 43d614944739
Ref: library/tkinter tkinter Misc columnconfigure14945600
Ref: 43da14945600
Ref: library/tkinter tkinter Misc grid_columnconfigure14945600
Ref: 43db14945600
Ref: library/tkinter tkinter Misc rowconfigure14947000
Ref: 43dc14947000
Ref: library/tkinter tkinter Misc grid_rowconfigure14947000
Ref: 43dd14947000
Ref: library/tkinter tkinter Misc grid_location14947490
Ref: 43de14947490
Ref: library/tkinter tkinter Misc grid_propagate14947820
Ref: 43df14947820
Ref: library/tkinter tkinter Misc size14948305
Ref: 43e014948305
Ref: library/tkinter tkinter Misc grid_size14948305
Ref: 43e114948305
Ref: library/tkinter tkinter Misc grid_slaves14948623
Ref: 43e214948623
Ref: library/tkinter tkinter Misc propagate14948898
Ref: 43e314948898
Ref: library/tkinter tkinter Misc pack_propagate14948898
Ref: 43e414948898
Ref: library/tkinter tkinter Misc slaves14949458
Ref: 43e514949458
Ref: library/tkinter tkinter Misc pack_slaves14949458
Ref: 43e614949458
Ref: library/tkinter tkinter Misc place_slaves14949698
Ref: 43e714949698
Ref: library/tkinter tkinter Misc bind14949853
Ref: 43e814949853
Ref: library/tkinter tkinter Misc bind_class14951082
Ref: 43eb14951082
Ref: library/tkinter tkinter Misc bind_all14951746
Ref: 43ed14951746
Ref: library/tkinter tkinter Misc unbind14952089
Ref: 43ea14952089
Ref: library/tkinter tkinter Misc unbind_class14952682
Ref: 43ee14952682
Ref: library/tkinter tkinter Misc unbind_all14952880
Ref: 43ef14952880
Ref: library/tkinter tkinter Misc bindtags14953071
Ref: 43ec14953071
Ref: library/tkinter tkinter Misc event_add14953910
Ref: 43f014953910
Ref: library/tkinter tkinter Misc event_delete14954310
Ref: 43f114954310
Ref: library/tkinter tkinter Misc event_generate14954686
Ref: 43f214954686
Ref: library/tkinter tkinter Misc event_info14955293
Ref: 43f314955293
Ref: library/tkinter tkinter Misc after14955743
Ref: 43f414955743
Ref: library/tkinter tkinter Misc after_cancel14956425
Ref: 43f514956425
Ref: library/tkinter tkinter Misc after_idle14956967
Ref: 43f614956967
Ref: library/tkinter tkinter Misc after_info14957430
Ref: 43f714957430
Ref: library/tkinter tkinter Misc mainloop14958062
Ref: 43a414958062
Ref: library/tkinter tkinter Misc quit14958288
Ref: 43f814958288
Ref: library/tkinter tkinter Misc update14958410
Ref: 43f914958410
Ref: library/tkinter tkinter Misc update_idletasks14958677
Ref: 43fa14958677
Ref: library/tkinter tkinter Misc waitvar14958956
Ref: 43fb14958956
Ref: library/tkinter tkinter Misc wait_variable14958956
Ref: 43fc14958956
Ref: library/tkinter tkinter Misc wait_window14959378
Ref: 43fd14959378
Ref: library/tkinter tkinter Misc wait_visibility14959680
Ref: 43fe14959680
Ref: library/tkinter tkinter Misc focus_set14960151
Ref: 43ff14960151
Ref: library/tkinter tkinter Misc focus14960151
Ref: 440014960151
Ref: library/tkinter tkinter Misc focus_force14960772
Ref: 440114960772
Ref: library/tkinter tkinter Misc focus_get14961154
Ref: 440214961154
Ref: library/tkinter tkinter Misc focus_displayof14961446
Ref: 440314961446
Ref: library/tkinter tkinter Misc focus_lastfor14961698
Ref: 440414961698
Ref: library/tkinter tkinter Misc tk_focusFollowsMouse14962188
Ref: 440514962188
Ref: library/tkinter tkinter Misc tk_focusNext14962434
Ref: 440614962434
Ref: library/tkinter tkinter Misc tk_focusPrev14962944
Ref: 440714962944
Ref: library/tkinter tkinter Misc grab_set14963418
Ref: 440814963418
Ref: library/tkinter tkinter Misc grab_set_global14964178
Ref: 440914964178
Ref: library/tkinter tkinter Misc grab_release14964697
Ref: 440a14964697
Ref: library/tkinter tkinter Misc grab_current14964829
Ref: 440b14964829
Ref: library/tkinter tkinter Misc grab_status14965037
Ref: 440c14965037
Ref: library/tkinter tkinter Misc selection_clear14965343
Ref: 440d14965343
Ref: library/tkinter tkinter Misc selection_get14965999
Ref: 440f14965999
Ref: library/tkinter tkinter Misc selection_handle14966720
Ref: 441014966720
Ref: library/tkinter tkinter Misc selection_own14967554
Ref: 441114967554
Ref: library/tkinter tkinter Misc selection_own_get14967859
Ref: 441214967859
Ref: library/tkinter tkinter Misc clipboard_append14968423
Ref: 441314968423
Ref: library/tkinter tkinter Misc clipboard_clear14969369
Ref: 441414969369
Ref: library/tkinter tkinter Misc clipboard_get14969663
Ref: 441514969663
Ref: library/tkinter tkinter Misc option_add14970414
Ref: 441614970414
Ref: library/tkinter tkinter Misc option_clear14970947
Ref: 441714970947
Ref: library/tkinter tkinter Misc option_get14971238
Ref: 441814971238
Ref: library/tkinter tkinter Misc option_readfile14971653
Ref: 441914971653
Ref: library/tkinter tkinter Misc bell14972051
Ref: 441a14972051
Ref: library/tkinter tkinter Misc tk_setPalette14972364
Ref: 441b14972364
Ref: library/tkinter tkinter Misc tk_bisque14973365
Ref: 441c14973365
Ref: library/tkinter tkinter Misc tk_strictMotif14973582
Ref: 441d14973582
Ref: library/tkinter tkinter Misc busy14974041
Ref: 441e14974041
Ref: library/tkinter tkinter Misc busy_hold14974041
Ref: 441f14974041
Ref: library/tkinter tkinter Misc tk_busy14974041
Ref: 442014974041
Ref: library/tkinter tkinter Misc tk_busy_hold14974041
Ref: 442114974041
Ref: library/tkinter tkinter Misc busy_configure14974890
Ref: 442214974890
Ref: library/tkinter tkinter Misc busy_config14974890
Ref: 442314974890
Ref: library/tkinter tkinter Misc tk_busy_config14974890
Ref: 442414974890
Ref: library/tkinter tkinter Misc tk_busy_configure14974890
Ref: 442514974890
Ref: library/tkinter tkinter Misc busy_cget14976013
Ref: 442714976013
Ref: library/tkinter tkinter Misc tk_busy_cget14976013
Ref: 442814976013
Ref: library/tkinter tkinter Misc busy_forget14976411
Ref: 442914976411
Ref: library/tkinter tkinter Misc tk_busy_forget14976411
Ref: 442a14976411
Ref: library/tkinter tkinter Misc busy_status14976855
Ref: 442b14976855
Ref: library/tkinter tkinter Misc tk_busy_status14976855
Ref: 442c14976855
Ref: library/tkinter tkinter Misc busy_current14977103
Ref: 442d14977103
Ref: library/tkinter tkinter Misc tk_busy_current14977103
Ref: 442e14977103
Ref: library/tkinter tkinter Misc winfo_atom14977555
Ref: 442f14977555
Ref: library/tkinter tkinter Misc winfo_atomname14977916
Ref: 443014977916
Ref: library/tkinter tkinter Misc winfo_cells14978305
Ref: 443114978305
Ref: library/tkinter tkinter Misc winfo_children14978414
Ref: 443214978414
Ref: library/tkinter tkinter Misc winfo_class14978668
Ref: 443314978668
Ref: library/tkinter tkinter Misc winfo_colormapfull14978755
Ref: 443414978755
Ref: library/tkinter tkinter Misc winfo_containing14978915
Ref: 443514978915
Ref: library/tkinter tkinter Misc winfo_depth14979428
Ref: 443614979428
Ref: library/tkinter tkinter Misc winfo_exists14979559
Ref: 443714979559
Ref: library/tkinter tkinter Misc winfo_fpixels14979666
Ref: 443814979666
Ref: library/tkinter tkinter Misc winfo_geometry14980006
Ref: 443a14980006
Ref: library/tkinter tkinter Misc winfo_height14980171
Ref: 43a114980171
Ref: library/tkinter tkinter Misc winfo_id14980439
Ref: 443c14980439
Ref: library/tkinter tkinter Misc winfo_interps14980652
Ref: 443d14980652
Ref: library/tkinter tkinter Misc winfo_ismapped14981004
Ref: 443e14981004
Ref: library/tkinter tkinter Misc winfo_manager14981126
Ref: 443f14981126
Ref: library/tkinter tkinter Misc winfo_name14981341
Ref: 444014981341
Ref: library/tkinter tkinter Misc winfo_parent14981478
Ref: 444114981478
Ref: library/tkinter tkinter Misc winfo_pathname14981656
Ref: 444214981656
Ref: library/tkinter tkinter Misc winfo_pixels14981974
Ref: 443914981974
Ref: library/tkinter tkinter Misc winfo_pointerx14982295
Ref: 444314982295
Ref: library/tkinter tkinter Misc winfo_pointerxy14982572
Ref: 444414982572
Ref: library/tkinter tkinter Misc winfo_pointery14982887
Ref: 444514982887
Ref: library/tkinter tkinter Misc winfo_reqheight14983164
Ref: 443b14983164
Ref: library/tkinter tkinter Misc winfo_reqwidth14983368
Ref: 444614983368
Ref: library/tkinter tkinter Misc winfo_rgb14983570
Ref: 444714983570
Ref: library/tkinter tkinter Misc winfo_rootx14983870
Ref: 444814983870
Ref: library/tkinter tkinter Misc winfo_rooty14984096
Ref: 444914984096
Ref: library/tkinter tkinter Misc winfo_screen14984322
Ref: 444a14984322
Ref: library/tkinter tkinter Misc winfo_screencells14984484
Ref: 444b14984484
Ref: library/tkinter tkinter Misc winfo_screendepth14984626
Ref: 444c14984626
Ref: library/tkinter tkinter Misc winfo_screenheight14984791
Ref: 444d14984791
Ref: library/tkinter tkinter Misc winfo_screenmmheight14984900
Ref: 444e14984900
Ref: library/tkinter tkinter Misc winfo_screenmmwidth14985016
Ref: 444f14985016
Ref: library/tkinter tkinter Misc winfo_screenvisual14985130
Ref: 445014985130
Ref: library/tkinter tkinter Misc winfo_screenwidth14985395
Ref: 445114985395
Ref: library/tkinter tkinter Misc winfo_server14985502
Ref: 445214985502
Ref: library/tkinter tkinter Misc winfo_toplevel14985724
Ref: 43b714985724
Ref: library/tkinter tkinter Misc winfo_viewable14985908
Ref: 43a214985908
Ref: library/tkinter tkinter Misc winfo_visual14986095
Ref: 445414986095
Ref: library/tkinter tkinter Misc winfo_visualid14986337
Ref: 445514986337
Ref: library/tkinter tkinter Misc winfo_visualsavailable14986445
Ref: 445614986445
Ref: library/tkinter tkinter Misc winfo_vrootheight14986812
Ref: 445714986812
Ref: library/tkinter tkinter Misc winfo_vrootwidth14987029
Ref: 445814987029
Ref: library/tkinter tkinter Misc winfo_vrootx14987243
Ref: 445914987243
Ref: library/tkinter tkinter Misc winfo_vrooty14987530
Ref: 445a14987530
Ref: library/tkinter tkinter Misc winfo_width14987817
Ref: 445b14987817
Ref: library/tkinter tkinter Misc winfo_x14988071
Ref: 43a014988071
Ref: library/tkinter tkinter Misc winfo_y14988283
Ref: 445c14988283
Ref: library/tkinter tkinter Misc info_patchlevel14988495
Ref: 445d14988495
Ref: library/tkinter tkinter Wm14989017
Ref: 43b514989017
Ref: library/tkinter tkinter Wm wm_aspect14989584
Ref: 446014989584
Ref: library/tkinter tkinter Wm aspect14989584
Ref: 446114989584
Ref: library/tkinter tkinter Wm wm_attributes14990209
Ref: 446214990209
Ref: library/tkinter tkinter Wm attributes14990209
Ref: 446314990209
Ref: library/tkinter tkinter Wm wm_client14994176
Ref: 446414994176
Ref: library/tkinter tkinter Wm client14994176
Ref: 446514994176
Ref: library/tkinter tkinter Wm wm_colormapwindows14994620
Ref: 446614994620
Ref: library/tkinter tkinter Wm colormapwindows14994620
Ref: 446714994620
Ref: library/tkinter tkinter Wm wm_command14995143
Ref: 446814995143
Ref: library/tkinter tkinter Wm command14995143
Ref: 446914995143
Ref: library/tkinter tkinter Wm wm_deiconify14995595
Ref: 446a14995595
Ref: library/tkinter tkinter Wm deiconify14995595
Ref: 446b14995595
Ref: library/tkinter tkinter Wm wm_focusmodel14995970
Ref: 446c14995970
Ref: library/tkinter tkinter Wm focusmodel14995970
Ref: 446d14995970
Ref: library/tkinter tkinter Wm wm_forget14996566
Ref: 446e14996566
Ref: library/tkinter tkinter Wm forget14996566
Ref: 446f14996566
Ref: library/tkinter tkinter Wm wm_frame14997080
Ref: 447114997080
Ref: library/tkinter tkinter Wm frame14997080
Ref: 447214997080
Ref: library/tkinter tkinter Wm wm_geometry14997437
Ref: 447314997437
Ref: library/tkinter tkinter Wm geometry14997437
Ref: 447414997437
Ref: library/tkinter tkinter Wm wm_grid14998250
Ref: 447514998250
Ref: library/tkinter tkinter Wm grid14998250
Ref: 447614998250
Ref: library/tkinter tkinter Wm wm_group14999047
Ref: 447714999047
Ref: library/tkinter tkinter Wm group14999047
Ref: 447814999047
Ref: library/tkinter tkinter Wm wm_iconbitmap14999565
Ref: 447914999565
Ref: library/tkinter tkinter Wm iconbitmap14999565
Ref: 447a14999565
Ref: library/tkinter tkinter Wm wm_iconify15000197
Ref: 447b15000197
Ref: library/tkinter tkinter Wm iconify15000197
Ref: 447c15000197
Ref: library/tkinter tkinter Wm wm_iconmask15000489
Ref: 447d15000489
Ref: library/tkinter tkinter Wm iconmask15000489
Ref: 447e15000489
Ref: library/tkinter tkinter Wm wm_iconname15000992
Ref: 447f15000992
Ref: library/tkinter tkinter Wm iconname15000992
Ref: 448015000992
Ref: library/tkinter tkinter Wm wm_iconphoto15001393
Ref: 448115001393
Ref: library/tkinter tkinter Wm iconphoto15001393
Ref: 448215001393
Ref: library/tkinter tkinter Wm wm_iconposition15002140
Ref: 448315002140
Ref: library/tkinter tkinter Wm iconposition15002140
Ref: 448415002140
Ref: library/tkinter tkinter Wm wm_iconwindow15002563
Ref: 448515002563
Ref: library/tkinter tkinter Wm iconwindow15002563
Ref: 448615002563
Ref: library/tkinter tkinter Wm wm_manage15003164
Ref: 448715003164
Ref: library/tkinter tkinter Wm manage15003164
Ref: 448815003164
Ref: library/tkinter tkinter Wm wm_maxsize15003594
Ref: 448a15003594
Ref: library/tkinter tkinter Wm maxsize15003594
Ref: 448b15003594
Ref: library/tkinter tkinter Wm wm_minsize15004107
Ref: 448c15004107
Ref: library/tkinter tkinter Wm minsize15004107
Ref: 448d15004107
Ref: library/tkinter tkinter Wm wm_overrideredirect15004626
Ref: 448e15004626
Ref: library/tkinter tkinter Wm overrideredirect15004626
Ref: 448f15004626
Ref: library/tkinter tkinter Wm wm_positionfrom15005274
Ref: 449015005274
Ref: library/tkinter tkinter Wm positionfrom15005274
Ref: 449115005274
Ref: library/tkinter tkinter Wm wm_protocol15005943
Ref: 449215005943
Ref: library/tkinter tkinter Wm protocol15005943
Ref: 449315005943
Ref: library/tkinter tkinter Wm wm_resizable15006842
Ref: 449415006842
Ref: library/tkinter tkinter Wm resizable15006842
Ref: 449515006842
Ref: library/tkinter tkinter Wm wm_sizefrom15007384
Ref: 449615007384
Ref: library/tkinter tkinter Wm sizefrom15007384
Ref: 449715007384
Ref: library/tkinter tkinter Wm wm_state15007859
Ref: 449815007859
Ref: library/tkinter tkinter Wm state15007859
Ref: 449915007859
Ref: library/tkinter tkinter Wm wm_title15008515
Ref: 445f15008515
Ref: library/tkinter tkinter Wm title15008515
Ref: 445e15008515
Ref: library/tkinter tkinter Wm wm_transient15008858
Ref: 449b15008858
Ref: library/tkinter tkinter Wm transient15008858
Ref: 449c15008858
Ref: library/tkinter tkinter Wm wm_withdraw15009505
Ref: 449d15009505
Ref: library/tkinter tkinter Wm withdraw15009505
Ref: 449e15009505
Ref: library/tkinter tkinter Pack15010033
Ref: 449f15010033
Ref: library/tkinter tkinter Pack configure15011156
Ref: 44a215011156
Ref: library/tkinter tkinter Pack config15011156
Ref: 44a315011156
Ref: library/tkinter tkinter Pack pack_configure15011156
Ref: 44a415011156
Ref: library/tkinter tkinter Pack pack15011209
Ref: 43ab15011209
Ref: library/tkinter tkinter Pack forget15013137
Ref: 447015013137
Ref: library/tkinter tkinter Pack pack_forget15013137
Ref: 44a515013137
Ref: library/tkinter tkinter Pack info15013649
Ref: 44a915013649
Ref: library/tkinter tkinter Pack pack_info15013649
Ref: 44aa15013649
Ref: library/tkinter tkinter Pack propagate15013822
Ref: 44ab15013822
Ref: library/tkinter tkinter Pack pack_propagate15013822
Ref: 44ac15013822
Ref: library/tkinter tkinter Pack slaves15014125
Ref: 44ad15014125
Ref: library/tkinter tkinter Pack pack_slaves15014125
Ref: 44ae15014125
Ref: library/tkinter tkinter Place15014345
Ref: 44a015014345
Ref: library/tkinter tkinter Place configure15014567
Ref: 44af15014567
Ref: library/tkinter tkinter Place config15014567
Ref: 44b015014567
Ref: library/tkinter tkinter Place place_configure15014567
Ref: 44b115014567
Ref: library/tkinter tkinter Place place15014621
Ref: 44b215014621
Ref: library/tkinter tkinter Place forget15016617
Ref: 44b315016617
Ref: library/tkinter tkinter Place place_forget15016617
Ref: 44b415016617
Ref: library/tkinter tkinter Place info15016759
Ref: 44b515016759
Ref: library/tkinter tkinter Place place_info15016759
Ref: 44b615016759
Ref: library/tkinter tkinter Place slaves15016867
Ref: 44b715016867
Ref: library/tkinter tkinter Place place_slaves15016867
Ref: 44b815016867
Ref: library/tkinter tkinter Grid15017020
Ref: 44a115017020
Ref: library/tkinter tkinter Grid configure15017256
Ref: 44b915017256
Ref: library/tkinter tkinter Grid config15017256
Ref: 44ba15017256
Ref: library/tkinter tkinter Grid grid_configure15017256
Ref: 44bb15017256
Ref: library/tkinter tkinter Grid grid15017309
Ref: 439315017309
Ref: library/tkinter tkinter Grid forget15019272
Ref: 44bc15019272
Ref: library/tkinter tkinter Grid grid_forget15019272
Ref: 44bd15019272
Ref: library/tkinter tkinter Grid grid_remove15019407
Ref: 44be15019407
Ref: library/tkinter tkinter Grid info15019617
Ref: 44bf15019617
Ref: library/tkinter tkinter Grid grid_info15019617
Ref: 44c015019617
Ref: library/tkinter tkinter Grid bbox15019723
Ref: 44c115019723
Ref: library/tkinter tkinter Grid grid_bbox15019723
Ref: 44c215019723
Ref: library/tkinter tkinter Grid columnconfigure15020149
Ref: 44c315020149
Ref: library/tkinter tkinter Grid grid_columnconfigure15020149
Ref: 44c415020149
Ref: library/tkinter tkinter Grid rowconfigure15020478
Ref: 44c515020478
Ref: library/tkinter tkinter Grid grid_rowconfigure15020478
Ref: 44c615020478
Ref: library/tkinter tkinter Grid location15020731
Ref: 44c715020731
Ref: library/tkinter tkinter Grid grid_location15020731
Ref: 44c815020731
Ref: library/tkinter tkinter Grid size15020990
Ref: 44c915020990
Ref: library/tkinter tkinter Grid grid_size15020990
Ref: 44ca15020990
Ref: library/tkinter tkinter Grid propagate15021315
Ref: 44cb15021315
Ref: library/tkinter tkinter Grid grid_propagate15021315
Ref: 44cc15021315
Ref: library/tkinter tkinter Grid slaves15021457
Ref: 44cd15021457
Ref: library/tkinter tkinter Grid grid_slaves15021457
Ref: 44ce15021457
Ref: library/tkinter tkinter XView15021679
Ref: 44cf15021679
Ref: library/tkinter tkinter XView xview15022026
Ref: 44d015022026
Ref: library/tkinter tkinter XView xview_moveto15022550
Ref: 44d215022550
Ref: library/tkinter tkinter XView xview_scroll15022767
Ref: 44d315022767
Ref: library/tkinter tkinter YView15023015
Ref: 44d415023015
Ref: library/tkinter tkinter YView yview15023313
Ref: 44d515023313
Ref: library/tkinter tkinter YView yview_moveto15023828
Ref: 44d615023828
Ref: library/tkinter tkinter YView yview_scroll15024048
Ref: 44d715024048
Ref: library/tkinter tkinter BaseWidget15024290
Ref: 43c315024290
Ref: library/tkinter tkinter BaseWidget destroy15024668
Ref: 44d815024668
Ref: library/tkinter tkinter Widget15024859
Ref: 43a315024859
Node: Toplevel widgets15025324
Ref: library/tkinter toplevel-widgets15025452
Ref: 44db15025452
Ref: library/tkinter tkinter Tk15025507
Ref: 177915025507
Ref: library/tkinter tkinter Tk tk15027833
Ref: 44dd15027833
Ref: library/tkinter tkinter Tk master15028119
Ref: 43b615028119
Ref: library/tkinter tkinter Tk children15028706
Ref: 44de15028706
Ref: library/tkinter tkinter Tk destroy15028916
Ref: 44df15028916
Ref: library/tkinter tkinter Tk loadtk15029092
Ref: 44e015029092
Ref: library/tkinter tkinter Tk readprofile15029373
Ref: 44e115029373
Ref: library/tkinter tkinter Tk report_callback_exception15029767
Ref: 44e215029767
Ref: library/tkinter tkinter Toplevel15030286
Ref: 445315030286
Node: Widget classes15031011
Ref: library/tkinter widget-classes15031133
Ref: 44e415031133
Ref: library/tkinter tkinter Button15031184
Ref: 44d915031184
Ref: library/tkinter tkinter Button invoke15031763
Ref: 44e515031763
Ref: library/tkinter tkinter Button flash15032047
Ref: 44e615032047
Ref: library/tkinter tkinter Canvas15032400
Ref: 1a5915032400
Ref: library/tkinter tkinter Canvas create_arc15034225
Ref: 44e915034225
Ref: library/tkinter tkinter Canvas create_bitmap15034273
Ref: 44ea15034273
Ref: library/tkinter tkinter Canvas create_image15034324
Ref: 44eb15034324
Ref: library/tkinter tkinter Canvas create_line15034374
Ref: 44ec15034374
Ref: library/tkinter tkinter Canvas create_oval15034423
Ref: 44ed15034423
Ref: library/tkinter tkinter Canvas create_polygon15034472
Ref: 44ee15034472
Ref: library/tkinter tkinter Canvas create_rectangle15034524
Ref: 44ef15034524
Ref: library/tkinter tkinter Canvas create_text15034578
Ref: 44f015034578
Ref: library/tkinter tkinter Canvas create_window15034627
Ref: 44f115034627
Ref: library/tkinter tkinter Canvas coords15042917
Ref: 1b0015042917
Ref: library/tkinter tkinter Canvas move15043957
Ref: 44f215043957
Ref: library/tkinter tkinter Canvas moveto15044212
Ref: 44f315044212
Ref: library/tkinter tkinter Canvas scale15044684
Ref: 44f415044684
Ref: library/tkinter tkinter Canvas delete15045153
Ref: 44f515045153
Ref: library/tkinter tkinter Canvas dchars15045267
Ref: 44f615045267
Ref: library/tkinter tkinter Canvas insert15045685
Ref: 44f715045685
Ref: library/tkinter tkinter Canvas itemcget15045995
Ref: 44f815045995
Ref: library/tkinter tkinter Canvas itemconfig15046300
Ref: 44f915046300
Ref: library/tkinter tkinter Canvas itemconfigure15046300
Ref: 44fa15046300
Ref: library/tkinter tkinter Canvas type15046957
Ref: 44fb15046957
Ref: library/tkinter tkinter Canvas gettags15047218
Ref: 44fc15047218
Ref: library/tkinter tkinter Canvas dtag15047513
Ref: 44fd15047513
Ref: library/tkinter tkinter Canvas addtag15047792
Ref: 44fe15047792
Ref: library/tkinter tkinter Canvas addtag_above15048256
Ref: 44ff15048256
Ref: library/tkinter tkinter Canvas addtag_all15048415
Ref: 450015048415
Ref: library/tkinter tkinter Canvas addtag_below15048519
Ref: 450115048519
Ref: library/tkinter tkinter Canvas addtag_closest15048679
Ref: 450215048679
Ref: library/tkinter tkinter Canvas addtag_enclosed15049147
Ref: 450315049147
Ref: library/tkinter tkinter Canvas addtag_overlapping15049382
Ref: 450415049382
Ref: library/tkinter tkinter Canvas addtag_withtag15049629
Ref: 450515049629
Ref: library/tkinter tkinter Canvas find15049752
Ref: 450615049752
Ref: library/tkinter tkinter Canvas find_above15050179
Ref: 450715050179
Ref: library/tkinter tkinter Canvas find_all15050332
Ref: 450815050332
Ref: library/tkinter tkinter Canvas find_below15050462
Ref: 450915050462
Ref: library/tkinter tkinter Canvas find_closest15050615
Ref: 450a15050615
Ref: library/tkinter tkinter Canvas find_enclosed15050864
Ref: 450b15050864
Ref: library/tkinter tkinter Canvas find_overlapping15051046
Ref: 450c15051046
Ref: library/tkinter tkinter Canvas find_withtag15051240
Ref: 450d15051240
Ref: library/tkinter tkinter Canvas lift15051357
Ref: 450e15051357
Ref: library/tkinter tkinter Canvas tkraise15051357
Ref: 450f15051357
Ref: library/tkinter tkinter Canvas tag_raise15051357
Ref: 44e715051357
Ref: library/tkinter tkinter Canvas lower15051973
Ref: 451015051973
Ref: library/tkinter tkinter Canvas tag_lower15051973
Ref: 44e815051973
Ref: library/tkinter tkinter Canvas tag_bind15052830
Ref: 451115052830
Ref: library/tkinter tkinter Canvas tag_unbind15053670
Ref: 451315053670
Ref: library/tkinter tkinter Canvas bbox15054075
Ref: 451415054075
Ref: library/tkinter tkinter Canvas canvasx15054627
Ref: 451515054627
Ref: library/tkinter tkinter Canvas canvasy15054924
Ref: 451615054924
Ref: library/tkinter tkinter Canvas focus15055221
Ref: 451215055221
Ref: library/tkinter tkinter Canvas icursor15055974
Ref: 451715055974
Ref: library/tkinter tkinter Canvas index15056344
Ref: 451815056344
Ref: library/tkinter tkinter Canvas select_adjust15056772
Ref: 451915056772
Ref: library/tkinter tkinter Canvas select_clear15057137
Ref: 451b15057137
Ref: library/tkinter tkinter Canvas select_from15057265
Ref: 451c15057265
Ref: library/tkinter tkinter Canvas select_item15057577
Ref: 451d15057577
Ref: library/tkinter tkinter Canvas select_to15057877
Ref: 451a15057877
Ref: library/tkinter tkinter Canvas scan_mark15058205
Ref: 451e15058205
Ref: library/tkinter tkinter Canvas scan_dragto15058432
Ref: 451f15058432
Ref: library/tkinter tkinter Canvas postscript15058812
Ref: 452015058812
Ref: library/tkinter tkinter Checkbutton15059575
Ref: 1a2415059575
Ref: library/tkinter tkinter Checkbutton invoke15060350
Ref: 452115060350
Ref: library/tkinter tkinter Checkbutton select15060783
Ref: 452215060783
Ref: library/tkinter tkinter Checkbutton deselect15060915
Ref: 452315060915
Ref: library/tkinter tkinter Checkbutton toggle15061052
Ref: 452415061052
Ref: library/tkinter tkinter Checkbutton flash15061229
Ref: 452515061229
Ref: library/tkinter tkinter Entry15061597
Ref: 440e15061597
Ref: library/tkinter tkinter Entry delete15063075
Ref: 452615063075
Ref: library/tkinter tkinter Entry get15063307
Ref: 452715063307
Ref: library/tkinter tkinter Entry insert15063384
Ref: 452815063384
Ref: library/tkinter tkinter Entry icursor15063502
Ref: 452915063502
Ref: library/tkinter tkinter Entry index15063656
Ref: 452a15063656
Ref: library/tkinter tkinter Entry select_adjust15063758
Ref: 452b15063758
Ref: library/tkinter tkinter Entry selection_adjust15063758
Ref: 452c15063758
Ref: library/tkinter tkinter Entry select_clear15064305
Ref: 452e15064305
Ref: library/tkinter tkinter Entry selection_clear15064305
Ref: 452f15064305
Ref: library/tkinter tkinter Entry select_from15064773
Ref: 453015064773
Ref: library/tkinter tkinter Entry selection_from15064773
Ref: 453115064773
Ref: library/tkinter tkinter Entry select_present15065028
Ref: 453215065028
Ref: library/tkinter tkinter Entry selection_present15065028
Ref: 453315065028
Ref: library/tkinter tkinter Entry select_range15065265
Ref: 453415065265
Ref: library/tkinter tkinter Entry selection_range15065265
Ref: 453515065265
Ref: library/tkinter tkinter Entry select_to15065661
Ref: 453615065661
Ref: library/tkinter tkinter Entry selection_to15065661
Ref: 452d15065661
Ref: library/tkinter tkinter Entry scan_mark15066361
Ref: 453715066361
Ref: library/tkinter tkinter Entry scan_dragto15066599
Ref: 453815066599
Ref: library/tkinter tkinter Frame15066975
Ref: 442615066975
Ref: library/tkinter tkinter Label15067399
Ref: 44da15067399
Ref: library/tkinter tkinter LabelFrame15067960
Ref: 448915067960
Ref: library/tkinter tkinter Listbox15068465
Ref: 43d715068465
Ref: library/tkinter tkinter Listbox insert15070004
Ref: 453c15070004
Ref: library/tkinter tkinter Listbox delete15070244
Ref: 453d15070244
Ref: library/tkinter tkinter Listbox get15070470
Ref: 453e15070470
Ref: library/tkinter tkinter Listbox size15070791
Ref: 453f15070791
Ref: library/tkinter tkinter Listbox index15070998
Ref: 453b15070998
Ref: library/tkinter tkinter Listbox bbox15071298
Ref: 454015071298
Ref: library/tkinter tkinter Listbox nearest15071919
Ref: 454115071919
Ref: library/tkinter tkinter Listbox see15072091
Ref: 454215072091
Ref: library/tkinter tkinter Listbox activate15072451
Ref: 453915072451
Ref: library/tkinter tkinter Listbox curselection15072840
Ref: 454315072840
Ref: library/tkinter tkinter Listbox select_anchor15073052
Ref: 454415073052
Ref: library/tkinter tkinter Listbox selection_anchor15073052
Ref: 453a15073052
Ref: library/tkinter tkinter Listbox select_clear15073542
Ref: 454515073542
Ref: library/tkinter tkinter Listbox selection_clear15073542
Ref: 454615073542
Ref: library/tkinter tkinter Listbox select_includes15074063
Ref: 454715074063
Ref: library/tkinter tkinter Listbox selection_includes15074063
Ref: 454815074063
Ref: library/tkinter tkinter Listbox select_set15074313
Ref: 454915074313
Ref: library/tkinter tkinter Listbox selection_set15074313
Ref: 454a15074313
Ref: library/tkinter tkinter Listbox itemcget15074614
Ref: 454b15074614
Ref: library/tkinter tkinter Listbox itemconfig15074777
Ref: 454c15074777
Ref: library/tkinter tkinter Listbox itemconfigure15074777
Ref: 454d15074777
Ref: library/tkinter tkinter Listbox scan_mark15075405
Ref: 454e15075405
Ref: library/tkinter tkinter Listbox scan_dragto15075632
Ref: 454f15075632
Ref: library/tkinter tkinter Menu15075998
Ref: 44e315075998
Ref: library/tkinter tkinter Menu add15076971
Ref: 455015076971
Ref: library/tkinter tkinter Menu add_cascade15080384
Ref: 455115080384
Ref: library/tkinter tkinter Menu add_checkbutton15080683
Ref: 455215080683
Ref: library/tkinter tkinter Menu add_command15081022
Ref: 455315081022
Ref: library/tkinter tkinter Menu add_radiobutton15081274
Ref: 455415081274
Ref: library/tkinter tkinter Menu add_separator15081586
Ref: 455515081586
Ref: library/tkinter tkinter Menu insert15081805
Ref: 455615081805
Ref: library/tkinter tkinter Menu insert_cascade15082431
Ref: 455715082431
Ref: library/tkinter tkinter Menu insert_checkbutton15082608
Ref: 455815082608
Ref: library/tkinter tkinter Menu insert_command15082797
Ref: 455915082797
Ref: library/tkinter tkinter Menu insert_radiobutton15082974
Ref: 455a15082974
Ref: library/tkinter tkinter Menu insert_separator15083163
Ref: 455b15083163
Ref: library/tkinter tkinter Menu delete15083336
Ref: 455c15083336
Ref: library/tkinter tkinter Menu entrycget15083699
Ref: 455d15083699
Ref: library/tkinter tkinter Menu entryconfig15083864
Ref: 455e15083864
Ref: library/tkinter tkinter Menu entryconfigure15083864
Ref: 455f15083864
Ref: library/tkinter tkinter Menu index15084479
Ref: 1af915084479
Ref: library/tkinter tkinter Menu type15084634
Ref: 456015084634
Ref: library/tkinter tkinter Menu activate15084895
Ref: 456115084895
Ref: library/tkinter tkinter Menu invoke15085215
Ref: 456215085215
Ref: library/tkinter tkinter Menu post15085555
Ref: 456315085555
Ref: library/tkinter tkinter Menu tk_popup15085862
Ref: 456415085862
Ref: library/tkinter tkinter Menu unpost15086108
Ref: 456515086108
Ref: library/tkinter tkinter Menu xposition15086379
Ref: 456615086379
Ref: library/tkinter tkinter Menu yposition15086577
Ref: 456715086577
Ref: library/tkinter tkinter Menubutton15086741
Ref: 456815086741
Ref: library/tkinter tkinter Message15087278
Ref: 456915087278
Ref: library/tkinter tkinter OptionMenu15087828
Ref: 456a15087828
Ref: library/tkinter tkinter OptionMenu destroy15088360
Ref: 456b15088360
Ref: library/tkinter tkinter PanedWindow15088571
Ref: 44a615088571
Ref: library/tkinter tkinter PanedWindow add15089385
Ref: 456c15089385
Ref: library/tkinter tkinter PanedWindow forget15089691
Ref: 456e15089691
Ref: library/tkinter tkinter PanedWindow remove15089691
Ref: 456f15089691
Ref: library/tkinter tkinter PanedWindow panes15090168
Ref: 457015090168
Ref: library/tkinter tkinter PanedWindow panecget15090304
Ref: 457115090304
Ref: library/tkinter tkinter PanedWindow paneconfig15090543
Ref: 457215090543
Ref: library/tkinter tkinter PanedWindow paneconfigure15090543
Ref: 456d15090543
Ref: library/tkinter tkinter PanedWindow identify15091802
Ref: 457315091802
Ref: library/tkinter tkinter PanedWindow sash15092337
Ref: 457415092337
Ref: library/tkinter tkinter PanedWindow sash_coord15092686
Ref: 457515092686
Ref: library/tkinter tkinter PanedWindow sash_mark15093041
Ref: 457615093041
Ref: library/tkinter tkinter PanedWindow sash_place15093246
Ref: 457715093246
Ref: library/tkinter tkinter PanedWindow proxy15093380
Ref: 457815093380
Ref: library/tkinter tkinter PanedWindow proxy_coord15093811
Ref: 457915093811
Ref: library/tkinter tkinter PanedWindow proxy_forget15093956
Ref: 457a15093956
Ref: library/tkinter tkinter PanedWindow proxy_place15094042
Ref: 457b15094042
Ref: library/tkinter tkinter Radiobutton15094144
Ref: 457c15094144
Ref: library/tkinter tkinter Radiobutton invoke15094950
Ref: 457d15094950
Ref: library/tkinter tkinter Radiobutton select15095360
Ref: 457e15095360
Ref: library/tkinter tkinter Radiobutton deselect15095513
Ref: 457f15095513
Ref: library/tkinter tkinter Radiobutton flash15095726
Ref: 458015095726
Ref: library/tkinter tkinter Scale15096094
Ref: 458115096094
Ref: library/tkinter tkinter Scale get15096900
Ref: 458315096900
Ref: library/tkinter tkinter Scale set15097100
Ref: 458415097100
Ref: library/tkinter tkinter Scale coords15097260
Ref: 458515097260
Ref: library/tkinter tkinter Scale identify15097560
Ref: 458615097560
Ref: library/tkinter tkinter Scrollbar15097950
Ref: 44d115097950
Ref: library/tkinter tkinter Scrollbar get15098553
Ref: 458715098553
Ref: library/tkinter tkinter Scrollbar set15098830
Ref: 458815098830
Ref: library/tkinter tkinter Scrollbar activate15099210
Ref: 458915099210
Ref: library/tkinter tkinter Scrollbar delta15099671
Ref: 458a15099671
Ref: library/tkinter tkinter Scrollbar fraction15099987
Ref: 458b15099987
Ref: library/tkinter tkinter Scrollbar identify15100243
Ref: 458c15100243
Ref: library/tkinter tkinter Spinbox15100486
Ref: 43d815100486
Ref: library/tkinter tkinter Spinbox get15101979
Ref: 458d15101979
Ref: library/tkinter tkinter Spinbox insert15102050
Ref: 458e15102050
Ref: library/tkinter tkinter Spinbox delete15102197
Ref: 458f15102197
Ref: library/tkinter tkinter Spinbox icursor15102531
Ref: 459015102531
Ref: library/tkinter tkinter Spinbox index15102685
Ref: 459115102685
Ref: library/tkinter tkinter Spinbox bbox15102810
Ref: 459215102810
Ref: library/tkinter tkinter Spinbox identify15103387
Ref: 459315103387
Ref: library/tkinter tkinter Spinbox invoke15103607
Ref: 459415103607
Ref: library/tkinter tkinter Spinbox scan15103801
Ref: 459515103801
Ref: library/tkinter tkinter Spinbox scan_mark15104206
Ref: 459615104206
Ref: library/tkinter tkinter Spinbox scan_dragto15104455
Ref: 459715104455
Ref: library/tkinter tkinter Spinbox selection15104798
Ref: 459815104798
Ref: library/tkinter tkinter Spinbox selection_adjust15105607
Ref: 459915105607
Ref: library/tkinter tkinter Spinbox selection_clear15106148
Ref: 459a15106148
Ref: library/tkinter tkinter Spinbox selection_element15106530
Ref: 459b15106530
Ref: library/tkinter tkinter Spinbox selection_from15106877
Ref: 459c15106877
Ref: library/tkinter tkinter Spinbox selection_present15107095
Ref: 459d15107095
Ref: library/tkinter tkinter Spinbox selection_range15107284
Ref: 459e15107284
Ref: library/tkinter tkinter Spinbox selection_to15107634
Ref: 459f15107634
Ref: library/tkinter tkinter Text15108326
Ref: 1a5815108326
Ref: library/tkinter tkinter Text insert15110163
Ref: 45a015110163
Ref: library/tkinter tkinter Text delete15110734
Ref: 45a115110734
Ref: library/tkinter tkinter Text replace15111105
Ref: 45a215111105
Ref: library/tkinter tkinter Text get15111477
Ref: 45a315111477
Ref: library/tkinter tkinter Text index15111768
Ref: 45a415111768
Ref: library/tkinter tkinter Text compare15111913
Ref: 45a515111913
Ref: library/tkinter tkinter Text count15112214
Ref: 1a5115112214
Ref: library/tkinter tkinter Text see15113252
Ref: 45a615113252
Ref: library/tkinter tkinter Text bbox15113614
Ref: 45a715113614
Ref: library/tkinter tkinter Text dlineinfo15114005
Ref: 45a815114005
Ref: library/tkinter tkinter Text mark_set15114436
Ref: 45a915114436
Ref: library/tkinter tkinter Text mark_unset15114705
Ref: 45aa15114705
Ref: library/tkinter tkinter Text mark_names15114891
Ref: 45ab15114891
Ref: library/tkinter tkinter Text mark_gravity15115020
Ref: 45ac15115020
Ref: library/tkinter tkinter Text mark_next15115461
Ref: 45ad15115461
Ref: library/tkinter tkinter Text mark_previous15115698
Ref: 45ae15115698
Ref: library/tkinter tkinter Text tag_add15115940
Ref: 45af15115940
Ref: library/tkinter tkinter Text tag_remove15116297
Ref: 45b015116297
Ref: library/tkinter tkinter Text tag_delete15116630
Ref: 45b115116630
Ref: library/tkinter tkinter Text tag_config15116820
Ref: 45b215116820
Ref: library/tkinter tkinter Text tag_configure15116820
Ref: 45b315116820
Ref: library/tkinter tkinter Text tag_cget15120398
Ref: 45b415120398
Ref: library/tkinter tkinter Text tag_names15120555
Ref: 45b515120555
Ref: library/tkinter tkinter Text tag_ranges15120866
Ref: 45b615120866
Ref: library/tkinter tkinter Text tag_nextrange15121134
Ref: 45b715121134
Ref: library/tkinter tkinter Text tag_prevrange15121462
Ref: 45b815121462
Ref: library/tkinter tkinter Text tag_raise15121805
Ref: 45b915121805
Ref: library/tkinter tkinter Text tag_lower15122148
Ref: 45ba15122148
Ref: library/tkinter tkinter Text tag_bind15122394
Ref: 45bb15122394
Ref: library/tkinter tkinter Text tag_unbind15122876
Ref: 45bc15122876
Ref: library/tkinter tkinter Text image_create15123299
Ref: 45bd15123299
Ref: library/tkinter tkinter Text image_cget15123718
Ref: 45be15123718
Ref: library/tkinter tkinter Text image_configure15123887
Ref: 45bf15123887
Ref: library/tkinter tkinter Text image_names15124115
Ref: 45c015124115
Ref: library/tkinter tkinter Text window_create15124477
Ref: 45c115124477
Ref: library/tkinter tkinter Text window_cget15124874
Ref: 45c215124874
Ref: library/tkinter tkinter Text window_config15125045
Ref: 45c315125045
Ref: library/tkinter tkinter Text window_configure15125045
Ref: 45c415125045
Ref: library/tkinter tkinter Text window_names15125367
Ref: 45c515125367
Ref: library/tkinter tkinter Text edit15125495
Ref: 45c615125495
Ref: library/tkinter tkinter Text edit_modified15125852
Ref: 45c715125852
Ref: library/tkinter tkinter Text edit_undo15126150
Ref: 45c815126150
Ref: library/tkinter tkinter Text edit_redo15126615
Ref: 45c915126615
Ref: library/tkinter tkinter Text edit_reset15127041
Ref: 45ca15127041
Ref: library/tkinter tkinter Text edit_separator15127122
Ref: 45cb15127122
Ref: library/tkinter tkinter Text search15127432
Ref: 45cc15127432
Ref: library/tkinter tkinter Text scan_mark15128429
Ref: 45cd15128429
Ref: library/tkinter tkinter Text scan_dragto15128656
Ref: 45ce15128656
Ref: library/tkinter tkinter Text debug15129007
Ref: 45cf15129007
Ref: library/tkinter tkinter Text dump15129359
Ref: 45d015129359
Ref: library/tkinter tkinter Text peer_create15130210
Ref: 45d115130210
Ref: library/tkinter tkinter Text peer_names15130728
Ref: 45d215130728
Ref: library/tkinter tkinter Text yview_pickplace15130910
Ref: 45d315130910
Node: Variable classes15131138
Ref: library/tkinter variable-classes15131257
Ref: 45d415131257
Ref: library/tkinter tkinter Variable15131312
Ref: 1d2915131312
Ref: library/tkinter tkinter Variable get15132638
Ref: 43b315132638
Ref: library/tkinter tkinter Variable initialize15132861
Ref: 45d515132861
Ref: library/tkinter tkinter Variable set15132861
Ref: 45d615132861
Ref: library/tkinter tkinter Variable trace_add15133062
Ref: 45d715133062
Ref: library/tkinter tkinter Variable trace_remove15133770
Ref: 45d815133770
Ref: library/tkinter tkinter Variable trace_info15134068
Ref: 45d915134068
Ref: library/tkinter tkinter Variable trace15134353
Ref: 45da15134353
Ref: library/tkinter tkinter Variable trace_variable15134353
Ref: 45db15134353
Ref: library/tkinter tkinter Variable trace_vdelete15134903
Ref: 45dc15134903
Ref: library/tkinter tkinter Variable trace_vinfo15135243
Ref: 45dd15135243
Ref: library/tkinter tkinter StringVar15135583
Ref: 43af15135583
Ref: library/tkinter tkinter StringVar get15135751
Ref: 45de15135751
Ref: library/tkinter tkinter IntVar15135847
Ref: 43b015135847
Ref: library/tkinter tkinter IntVar get15136013
Ref: 45df15136013
Ref: library/tkinter tkinter DoubleVar15136110
Ref: 43b115136110
Ref: library/tkinter tkinter DoubleVar get15136278
Ref: 45e015136278
Ref: library/tkinter tkinter-numeric-locale15136375
Ref: 458215136375
Ref: library/tkinter tkinter BooleanVar15136878
Ref: 43b215136878
Ref: library/tkinter tkinter BooleanVar get15137051
Ref: 45e115137051
Ref: library/tkinter tkinter BooleanVar initialize15137249
Ref: 45e215137249
Ref: library/tkinter tkinter BooleanVar set15137249
Ref: 45e315137249
Node: Image classes15137477
Ref: library/tkinter image-classes15137595
Ref: 45e415137595
Ref: library/tkinter tkinter Image15137644
Ref: 43bd15137644
Ref: library/tkinter tkinter Image config15138357
Ref: 45e615138357
Ref: library/tkinter tkinter Image configure15138357
Ref: 45e515138357
Ref: library/tkinter tkinter Image height15138653
Ref: 45e715138653
Ref: library/tkinter tkinter Image width15138741
Ref: 45e815138741
Ref: library/tkinter tkinter Image type15138827
Ref: 45e915138827
Ref: library/tkinter tkinter PhotoImage15139024
Ref: 1e4215139024
Ref: library/tkinter tkinter PhotoImage blank15139727
Ref: 45ea15139727
Ref: library/tkinter tkinter PhotoImage cget15139976
Ref: 45eb15139976
Ref: library/tkinter tkinter PhotoImage copy15140088
Ref: 45ec15140088
Ref: library/tkinter tkinter PhotoImage copy_replace15141181
Ref: 45ef15141181
Ref: library/tkinter tkinter PhotoImage data15143283
Ref: 45f015143283
Ref: library/tkinter tkinter PhotoImage get15144629
Ref: 45f115144629
Ref: library/tkinter tkinter PhotoImage put15144878
Ref: 45f215144878
Ref: library/tkinter tkinter PhotoImage read15145489
Ref: 45f315145489
Ref: library/tkinter tkinter PhotoImage subsample15146713
Ref: 45ee15146713
Ref: library/tkinter tkinter PhotoImage transparency_get15147243
Ref: 45f415147243
Ref: library/tkinter tkinter PhotoImage transparency_set15147447
Ref: 45f515147447
Ref: library/tkinter tkinter PhotoImage write15147663
Ref: 45f615147663
Ref: library/tkinter tkinter PhotoImage zoom15148944
Ref: 45ed15148944
Ref: library/tkinter tkinter BitmapImage15149434
Ref: 43be15149434
Node: Other classes15150430
Ref: library/tkinter other-classes15150554
Ref: 45f715150554
Ref: library/tkinter tkinter Event15150603
Ref: 43e915150603
Ref: library/tkinter tkinter Event serial15151038
Ref: 45f815151038
Ref: library/tkinter tkinter Event num15151109
Ref: 45f915151109
Ref: library/tkinter tkinter Event focus15151222
Ref: 45fa15151222
Ref: library/tkinter tkinter Event height15151345
Ref: 45fb15151345
Ref: library/tkinter tkinter Event width15151372
Ref: 45fc15151372
Ref: library/tkinter tkinter Event keycode15151506
Ref: 45fd15151506
Ref: library/tkinter tkinter Event state15151599
Ref: 45fe15151599
Ref: library/tkinter tkinter Event time15151744
Ref: 45ff15151744
Ref: library/tkinter tkinter Event x15151826
Ref: 460015151826
Ref: library/tkinter tkinter Event y15151848
Ref: 460115151848
Ref: library/tkinter tkinter Event x_root15151938
Ref: 460215151938
Ref: library/tkinter tkinter Event y_root15151965
Ref: 460315151965
Ref: library/tkinter tkinter Event char15152093
Ref: 460415152093
Ref: library/tkinter tkinter Event send_event15152181
Ref: 460515152181
Ref: library/tkinter tkinter Event keysym15152281
Ref: 460615152281
Ref: library/tkinter tkinter Event keysym_num15152379
Ref: 460715152379
Ref: library/tkinter tkinter Event type15152463
Ref: 460815152463
Ref: library/tkinter tkinter Event widget15152541
Ref: 460a15152541
Ref: library/tkinter tkinter Event delta15152620
Ref: 460b15152620
Ref: library/tkinter tkinter EventType15152738
Ref: 460915152738
Ref: library/tkinter tkinter CallWrapper15153213
Ref: 460c15153213
Node: Module-level functions15153650
Ref: library/tkinter module-level-functions15153774
Ref: 460d15153774
Ref: library/tkinter tkinter Tcl15153841
Ref: 44dc15153841
Ref: library/tkinter tkinter NoDefaultRoot15154534
Ref: 1d2b15154534
Ref: library/tkinter tkinter mainloop15154947
Ref: 439515154947
Ref: library/tkinter tkinter getboolean15155162
Ref: 460e15155162
Ref: library/tkinter tkinter getdouble15155436
Ref: 460f15155436
Ref: library/tkinter tkinter getint15155565
Ref: 461015155565
Ref: library/tkinter tkinter image_names15155671
Ref: 461115155671
Ref: library/tkinter tkinter image_types15155796
Ref: 461215155796
Node: File handlers15155957
Ref: library/tkinter file-handlers15156078
Ref: 461315156078
Ref: library/tkinter tkinter-file-handlers15156078
Ref: 461415156078
Ref: library/tkinter tkinter Widget tk createfilehandler15157320
Ref: 461515157320
Ref: library/tkinter tkinter Widget tk deletefilehandler15157893
Ref: 461615157893
Ref: library/tkinter tkinter READABLE15158008
Ref: 461715158008
Ref: library/tkinter tkinter WRITABLE15158040
Ref: 461815158040
Ref: library/tkinter tkinter EXCEPTION15158072
Ref: 461915158072
Node: 定数<10>15158150
Ref: library/tkinter constants15158240
Ref: 461a15158240
Ref: library/tkinter tkinter TRUE15158387
Ref: 461b15158387
Ref: library/tkinter tkinter YES15158415
Ref: 461c15158415
Ref: library/tkinter tkinter ON15158442
Ref: 461d15158442
Ref: library/tkinter tkinter FALSE15158524
Ref: 461e15158524
Ref: library/tkinter tkinter NO15158553
Ref: 461f15158553
Ref: library/tkinter tkinter OFF15158579
Ref: 462015158579
Ref: library/tkinter tkinter N15158661
Ref: 462115158661
Ref: library/tkinter tkinter S15158686
Ref: 462215158686
Ref: library/tkinter tkinter E15158711
Ref: 462315158711
Ref: library/tkinter tkinter W15158736
Ref: 462415158736
Ref: library/tkinter tkinter NE15158761
Ref: 462515158761
Ref: library/tkinter tkinter NW15158787
Ref: 462615158787
Ref: library/tkinter tkinter SE15158813
Ref: 462715158813
Ref: library/tkinter tkinter SW15158839
Ref: 462815158839
Ref: library/tkinter tkinter NS15158865
Ref: 462915158865
Ref: library/tkinter tkinter EW15158891
Ref: 462a15158891
Ref: library/tkinter tkinter NSEW15158917
Ref: 462b15158917
Ref: library/tkinter tkinter CENTER15158945
Ref: 462c15158945
Ref: library/tkinter tkinter LEFT15159233
Ref: 462d15159233
Ref: library/tkinter tkinter RIGHT15159261
Ref: 462e15159261
Ref: library/tkinter tkinter TOP15159290
Ref: 462f15159290
Ref: library/tkinter tkinter BOTTOM15159317
Ref: 463015159317
Ref: library/tkinter tkinter X15159443
Ref: 463115159443
Ref: library/tkinter tkinter Y15159468
Ref: 463215159468
Ref: library/tkinter tkinter BOTH15159493
Ref: 463315159493
Ref: library/tkinter tkinter NONE15159521
Ref: 463415159521
Ref: library/tkinter tkinter RAISED15159657
Ref: 463515159657
Ref: library/tkinter tkinter SUNKEN15159687
Ref: 463615159687
Ref: library/tkinter tkinter FLAT15159717
Ref: 463715159717
Ref: library/tkinter tkinter RIDGE15159745
Ref: 463815159745
Ref: library/tkinter tkinter GROOVE15159774
Ref: 463915159774
Ref: library/tkinter tkinter SOLID15159804
Ref: 463a15159804
Ref: library/tkinter tkinter HORIZONTAL15159915
Ref: 463b15159915
Ref: library/tkinter tkinter VERTICAL15159949
Ref: 463c15159949
Ref: library/tkinter tkinter CHAR15160114
Ref: 463d15160114
Ref: library/tkinter tkinter WORD15160142
Ref: 463e15160142
Ref: library/tkinter tkinter BASELINE15160301
Ref: 463f15160301
Ref: library/tkinter tkinter INSIDE15160383
Ref: 464015160383
Ref: library/tkinter tkinter OUTSIDE15160413
Ref: 464115160413
Ref: library/tkinter tkinter INSERT15160549
Ref: 464215160549
Ref: library/tkinter tkinter CURRENT15160579
Ref: 464315160579
Ref: library/tkinter tkinter END15160610
Ref: 464415160610
Ref: library/tkinter tkinter ANCHOR15160637
Ref: 464515160637
Ref: library/tkinter tkinter SEL15160667
Ref: 464615160667
Ref: library/tkinter tkinter SEL_FIRST15160694
Ref: 464715160694
Ref: library/tkinter tkinter SEL_LAST15160727
Ref: 464815160727
Ref: library/tkinter tkinter ALL15161067
Ref: 464915161067
Ref: library/tkinter tkinter NORMAL15161272
Ref: 464a15161272
Ref: library/tkinter tkinter DISABLED15161302
Ref: 464b15161302
Ref: library/tkinter tkinter ACTIVE15161334
Ref: 464c15161334
Ref: library/tkinter tkinter HIDDEN15161364
Ref: 464d15161364
Ref: library/tkinter tkinter CASCADE15161461
Ref: 464e15161461
Ref: library/tkinter tkinter CHECKBUTTON15161492
Ref: 464f15161492
Ref: library/tkinter tkinter COMMAND15161527
Ref: 465015161527
Ref: library/tkinter tkinter RADIOBUTTON15161558
Ref: 465115161558
Ref: library/tkinter tkinter SEPARATOR15161593
Ref: 465215161593
Ref: library/tkinter tkinter SINGLE15161746
Ref: 465315161746
Ref: library/tkinter tkinter BROWSE15161776
Ref: 465415161776
Ref: library/tkinter tkinter MULTIPLE15161806
Ref: 465515161806
Ref: library/tkinter tkinter EXTENDED15161838
Ref: 465615161838
Ref: library/tkinter tkinter PIESLICE15161953
Ref: 465715161953
Ref: library/tkinter tkinter CHORD15161985
Ref: 465815161985
Ref: library/tkinter tkinter ARC15162014
Ref: 465915162014
Ref: library/tkinter tkinter BUTT15162112
Ref: 465a15162112
Ref: library/tkinter tkinter PROJECTING15162140
Ref: 465b15162140
Ref: library/tkinter tkinter ROUND15162174
Ref: 465c15162174
Ref: library/tkinter tkinter BEVEL15162203
Ref: 465d15162203
Ref: library/tkinter tkinter MITER15162232
Ref: 465e15162232
Ref: library/tkinter tkinter FIRST15162459
Ref: 465f15162459
Ref: library/tkinter tkinter LAST15162488
Ref: 466015162488
Ref: library/tkinter tkinter MOVETO15162632
Ref: 466115162632
Ref: library/tkinter tkinter SCROLL15162662
Ref: 466215162662
Ref: library/tkinter tkinter UNITS15162858
Ref: 466315162858
Ref: library/tkinter tkinter PAGES15162887
Ref: 466415162887
Ref: library/tkinter tkinter UNDERLINE15163034
Ref: 466515163034
Ref: library/tkinter tkinter NUMERIC15163067
Ref: 466615163067
Ref: library/tkinter tkinter DOTBOX15163098
Ref: 466715163098
Node: tkinter colorchooser --- カラー選択ダイアログ15163211
Ref: library/tkinter colorchooser doc15163457
Ref: 466815163457
Ref: library/tkinter colorchooser module-tkinter colorchooser15163457
Ref: f715163457
Ref: library/tkinter colorchooser tkinter-colorchooser-color-choosing-dialog15163457
Ref: 466915163457
Ref: library/tkinter colorchooser translation-repo15163457
Ref: 466a15163457
Ref: library/tkinter colorchooser tkinter colorchooser Chooser15163966
Ref: 466b15163966
Ref: library/tkinter colorchooser tkinter colorchooser askcolor15164227
Ref: 466d15164227
Ref: tkinter colorchooser --- カラー選択ダイアログ-Footnote-115165036
Node: tkinter font --- Tkinter フォントラッパー15165117
Ref: library/tkinter font doc15165324
Ref: 466e15165324
Ref: library/tkinter font module-tkinter font15165324
Ref: fc15165324
Ref: library/tkinter font tkinter-font-tkinter-font-wrapper15165324
Ref: 466f15165324
Ref: library/tkinter font translation-repo15165324
Ref: 467015165324
Ref: library/tkinter font tkinter font NORMAL15165699
Ref: 467115165699
Ref: library/tkinter font tkinter font BOLD15165734
Ref: 467215165734
Ref: library/tkinter font tkinter font ITALIC15165767
Ref: 467315165767
Ref: library/tkinter font tkinter font ROMAN15165802
Ref: 467415165802
Ref: library/tkinter font tkinter font Font15165837
Ref: 1d2a15165837
Ref: library/tkinter font tkinter font Font actual15167262
Ref: 467515167262
Ref: library/tkinter font tkinter font Font cget15167607
Ref: 467615167607
Ref: library/tkinter font tkinter font Font config15167691
Ref: 467715167691
Ref: library/tkinter font tkinter font Font configure15167691
Ref: 467815167691
Ref: library/tkinter font tkinter font Font copy15167935
Ref: 467915167935
Ref: library/tkinter font tkinter font Font measure15168019
Ref: 467a15168019
Ref: library/tkinter font tkinter font Font metrics15168326
Ref: 467b15168326
Ref: library/tkinter font tkinter font families15169095
Ref: 467c15169095
Ref: library/tkinter font tkinter font names15169227
Ref: 467d15169227
Ref: library/tkinter font tkinter font nametofont15169334
Ref: 1d2d15169334
Ref: tkinter font --- Tkinter フォントラッパー-Footnote-115169695
Node: Tkinter dialogs15169767
Ref: library/dialog doc15169980
Ref: 467e15169980
Ref: library/dialog tkinter-dialogs15169980
Ref: 467f15169980
Ref: library/dialog translation-repo15169980
Ref: 468015169980
Node: tkinter simpledialog --- Standard Tkinter input dialogs15170425
Ref: library/dialog module-tkinter simpledialog15170586
Ref: ff15170586
Ref: library/dialog tkinter-simpledialog-standard-tkinter-input-dialogs15170586
Ref: 468115170586
Ref: library/dialog tkinter simpledialog askfloat15170991
Ref: 468215170991
Ref: library/dialog tkinter simpledialog askinteger15171127
Ref: 1d2e15171127
Ref: library/dialog tkinter simpledialog askstring15171265
Ref: 468315171265
Ref: library/dialog tkinter simpledialog Dialog15171969
Ref: 468415171969
Ref: library/dialog tkinter simpledialog Dialog result15172232
Ref: 468515172232
Ref: library/dialog tkinter simpledialog Dialog body15172367
Ref: 468715172367
Ref: library/dialog tkinter simpledialog Dialog buttonbox15172575
Ref: 468815172575
Ref: library/dialog tkinter simpledialog Dialog validate15172793
Ref: 468915172793
Ref: library/dialog tkinter simpledialog Dialog apply15173126
Ref: 468615173126
Ref: library/dialog tkinter simpledialog Dialog destroy15173478
Ref: 468a15173478
Ref: library/dialog tkinter simpledialog SimpleDialog15173626
Ref: 468b15173626
Ref: library/dialog tkinter simpledialog SimpleDialog go15174209
Ref: 468c15174209
Ref: tkinter simpledialog --- Standard Tkinter input dialogs-Footnote-115174418
Node: tkinter filedialog --- File selection dialogs15174499
Ref: library/dialog module-tkinter filedialog15174717
Ref: fb15174717
Ref: library/dialog tkinter-filedialog-file-selection-dialogs15174717
Ref: 468d15174717
Ref: tkinter filedialog --- File selection dialogs-Footnote-115175152
Node: Native load/save dialogs15175231
Ref: library/dialog native-load-save-dialogs15175337
Ref: 468e15175337
Ref: library/dialog tkinter filedialog askopenfile15176651
Ref: 468f15176651
Ref: library/dialog tkinter filedialog askopenfiles15176719
Ref: 469015176719
Ref: library/dialog tkinter filedialog asksaveasfile15177112
Ref: 469215177112
Ref: library/dialog tkinter filedialog askopenfilename15177371
Ref: 469415177371
Ref: library/dialog tkinter filedialog askopenfilenames15177433
Ref: 469515177433
Ref: library/dialog tkinter filedialog asksaveasfilename15177770
Ref: 469615177770
Ref: library/dialog tkinter filedialog askdirectory15177980
Ref: 469715177980
Ref: library/dialog tkinter filedialog Open15178298
Ref: 469115178298
Ref: library/dialog tkinter filedialog SaveAs15178362
Ref: 469315178362
Ref: library/dialog tkinter filedialog Directory15178686
Ref: 469815178686
Ref: library/dialog tkinter filedialog FileDialog15178924
Ref: 469915178924
Ref: library/dialog tkinter filedialog FileDialog cancel_command15179035
Ref: 469a15179035
Ref: library/dialog tkinter filedialog FileDialog dirs_double_event15179144
Ref: 469b15179144
Ref: library/dialog tkinter filedialog FileDialog dirs_select_event15179256
Ref: 469c15179256
Ref: library/dialog tkinter filedialog FileDialog files_double_event15179361
Ref: 469d15179361
Ref: library/dialog tkinter filedialog FileDialog files_select_event15179469
Ref: 469e15179469
Ref: library/dialog tkinter filedialog FileDialog filter_command15179577
Ref: 469f15179577
Ref: library/dialog tkinter filedialog FileDialog get_filter15179671
Ref: 46a015179671
Ref: library/dialog tkinter filedialog FileDialog get_selection15179763
Ref: 46a115179763
Ref: library/dialog tkinter filedialog FileDialog go15179853
Ref: 46a215179853
Ref: library/dialog tkinter filedialog FileDialog ok_event15180001
Ref: 46a315180001
Ref: library/dialog tkinter filedialog FileDialog ok_command15180094
Ref: 46a415180094
Ref: library/dialog tkinter filedialog FileDialog quit15180398
Ref: 46a715180398
Ref: library/dialog tkinter filedialog FileDialog set_filter15180489
Ref: 46a815180489
Ref: library/dialog tkinter filedialog FileDialog set_selection15180567
Ref: 46a915180567
Ref: library/dialog tkinter filedialog LoadFileDialog15180668
Ref: 46a515180668
Ref: library/dialog tkinter filedialog LoadFileDialog ok_command15180836
Ref: 46aa15180836
Ref: library/dialog tkinter filedialog SaveFileDialog15180983
Ref: 46a615180983
Ref: library/dialog tkinter filedialog SaveFileDialog ok_command15181153
Ref: 46ab15181153
Node: tkinter commondialog --- Dialog window templates15181371
Ref: library/dialog module-tkinter commondialog15181576
Ref: f815181576
Ref: library/dialog tkinter-commondialog-dialog-window-templates15181576
Ref: 46ac15181576
Ref: library/dialog tkinter commondialog Dialog15181964
Ref: 466c15181964
Ref: library/dialog tkinter commondialog Dialog show15182033
Ref: 46ad15182033
Ref: tkinter commondialog --- Dialog window templates-Footnote-115182147
Node: tkinter dialog --- Classic Tk dialog boxes15182228
Ref: library/dialog module-tkinter dialog15182379
Ref: f915182379
Ref: library/dialog tkinter-dialog-classic-tk-dialog-boxes15182379
Ref: 46ae15182379
Ref: library/dialog tkinter dialog DIALOG_ICON15182713
Ref: 46af15182713
Ref: library/dialog tkinter dialog Dialog15182853
Ref: 46b015182853
Ref: library/dialog tkinter dialog Dialog destroy15183442
Ref: 46b115183442
Ref: tkinter dialog --- Classic Tk dialog boxes-Footnote-115183650
Node: tkinter messagebox --- Tkinter メッセージプロンプト15183724
Ref: library/tkinter messagebox doc15183933
Ref: 46b215183933
Ref: library/tkinter messagebox module-tkinter messagebox15183933
Ref: fd15183933
Ref: library/tkinter messagebox tkinter-messagebox-tkinter-message-prompts15183933
Ref: 46b315183933
Ref: library/tkinter messagebox translation-repo15183933
Ref: 46b415183933
Ref: library/tkinter messagebox tkinter messagebox Message15184848
Ref: 46b815184848
Ref: library/tkinter messagebox tkinter messagebox Message show15187047
Ref: 46b515187047
Ref: library/tkinter messagebox tkinter messagebox showinfo15187368
Ref: 46be15187368
Ref: library/tkinter messagebox tkinter messagebox showwarning15187594
Ref: 46bf15187594
Ref: library/tkinter messagebox tkinter messagebox showerror15187781
Ref: 46c015187781
Ref: library/tkinter messagebox tkinter messagebox askquestion15188002
Ref: 46c115188002
Ref: library/tkinter messagebox tkinter messagebox askokcancel15188253
Ref: 46c315188253
Ref: library/tkinter messagebox tkinter messagebox askretrycancel15188519
Ref: 46c415188519
Ref: library/tkinter messagebox tkinter messagebox askyesno15188796
Ref: 46c615188796
Ref: library/tkinter messagebox tkinter messagebox askyesnocancel15189034
Ref: 46c715189034
Ref: library/tkinter messagebox messagebox-buttons15189328
Ref: 46b915189328
Ref: library/tkinter messagebox tkinter messagebox ABORT15189356
Ref: 46c815189356
Ref: library/tkinter messagebox tkinter messagebox RETRY15189407
Ref: 46c515189407
Ref: library/tkinter messagebox tkinter messagebox IGNORE15189458
Ref: 46c915189458
Ref: library/tkinter messagebox tkinter messagebox OK15189511
Ref: 46b615189511
Ref: library/tkinter messagebox tkinter messagebox CANCEL15189556
Ref: 46ba15189556
Ref: library/tkinter messagebox tkinter messagebox YES15189609
Ref: 46b715189609
Ref: library/tkinter messagebox tkinter messagebox NO15189656
Ref: 46c215189656
Ref: library/tkinter messagebox messagebox-types15189700
Ref: 46bd15189700
Ref: library/tkinter messagebox tkinter messagebox ABORTRETRYIGNORE15189729
Ref: 46ca15189729
Ref: library/tkinter messagebox tkinter messagebox OKCANCEL15190033
Ref: 46cb15190033
Ref: library/tkinter messagebox tkinter messagebox RETRYCANCEL15190187
Ref: 46cc15190187
Ref: library/tkinter messagebox tkinter messagebox YESNO15190350
Ref: 46cd15190350
Ref: library/tkinter messagebox tkinter messagebox YESNOCANCEL15190495
Ref: 46ce15190495
Ref: library/tkinter messagebox messagebox-icons15190673
Ref: 46bb15190673
Ref: library/tkinter messagebox tkinter messagebox ERROR15190687
Ref: 46cf15190687
Ref: library/tkinter messagebox tkinter messagebox INFO15190738
Ref: 46bc15190738
Ref: library/tkinter messagebox tkinter messagebox QUESTION15190787
Ref: 46d015190787
Ref: library/tkinter messagebox tkinter messagebox WARNING15190844
Ref: 46d115190844
Ref: tkinter messagebox --- Tkinter メッセージプロンプト-Footnote-115190935
Node: tkinter scrolledtext --- Scrolled text widget15191014
Ref: library/tkinter scrolledtext doc15191272
Ref: 46d215191272
Ref: library/tkinter scrolledtext module-tkinter scrolledtext15191272
Ref: fe15191272
Ref: library/tkinter scrolledtext tkinter-scrolledtext-scrolled-text-widget15191272
Ref: 46d315191272
Ref: library/tkinter scrolledtext translation-repo15191272
Ref: 46d415191272
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText15192214
Ref: 46d515192214
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText frame15192284
Ref: 46d615192284
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText vbar15192407
Ref: 46d715192407
Ref: tkinter scrolledtext --- Scrolled text widget-Footnote-115192523
Node: tkinter dnd --- ドラッグアンドドロップのサポート15192604
Ref: library/tkinter dnd doc15192856
Ref: 46d815192856
Ref: library/tkinter dnd module-tkinter dnd15192856
Ref: fa15192856
Ref: library/tkinter dnd tkinter-dnd-drag-and-drop-support15192856
Ref: 46d915192856
Ref: library/tkinter dnd translation-repo15192856
Ref: 46da15192856
Ref: library/tkinter dnd tkinter dnd DndHandler15194392
Ref: 46dc15194392
Ref: library/tkinter dnd tkinter dnd DndHandler cancel15194584
Ref: 46dd15194584
Ref: library/tkinter dnd tkinter dnd DndHandler finish15194673
Ref: 46de15194673
Ref: library/tkinter dnd tkinter dnd DndHandler on_motion15194773
Ref: 46df15194773
Ref: library/tkinter dnd tkinter dnd DndHandler on_release15194907
Ref: 46e015194907
Ref: library/tkinter dnd tkinter dnd dnd_start15195019
Ref: 46db15195019
Ref: tkinter dnd --- ドラッグアンドドロップのサポート-Footnote-115195330
Node: tkinter ttk --- Tk のテーマ付きウィジェット15195401
Ref: library/tkinter ttk doc15195654
Ref: 46e115195654
Ref: library/tkinter ttk module-tkinter ttk15195654
Ref: 10015195654
Ref: library/tkinter ttk tkinter-ttk-tk-themed-widgets15195654
Ref: 46e215195654
Ref: library/tkinter ttk translation-repo15195654
Ref: 46e315195654
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-115196733
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-215196804
Node: Ttk を使う15196857
Ref: library/tkinter ttk using-ttk15196982
Ref: 46e415196982
Ref: Ttk を使う-Footnote-115198371
Node: Ttk widgets15198435
Ref: library/tkinter ttk ttk-widgets15198587
Ref: 46ea15198587
Node: ウィジェット15199932
Ref: library/tkinter ttk widget15200092
Ref: 46f115200092
Node: Standard options15200434
Ref: library/tkinter ttk standard-options15200539
Ref: 46f215200539
Node: Scrollable widget options15202456
Ref: library/tkinter ttk scrollable-widget-options15202583
Ref: 46f315202583
Node: Label options15203717
Ref: library/tkinter ttk label-options15203849
Ref: 46f415203849
Node: Compatibility options15206622
Ref: library/tkinter ttk compatibility-options15206742
Ref: 46f515206742
Node: Widget states15207345
Ref: library/tkinter ttk widget-states15207462
Ref: 46f615207462
Node: ttk Widget15209413
Ref: library/tkinter ttk ttk-widget15209500
Ref: 46f715209500
Ref: library/tkinter ttk tkinter ttk Widget15209703
Ref: 46ef15209703
Ref: library/tkinter ttk tkinter ttk Widget identify15209738
Ref: 46f815209738
Ref: library/tkinter ttk tkinter ttk Widget instate15210016
Ref: 46f915210016
Ref: library/tkinter ttk tkinter ttk Widget state15210581
Ref: 449a15210581
Node: コンボボックス15211163
Ref: library/tkinter ttk combobox15211319
Ref: 46fa15211319
Node: オプション15212046
Ref: library/tkinter ttk options15212146
Ref: 46fc15212146
Node: 仮想イベント15214838
Ref: library/tkinter ttk virtual-events15214959
Ref: 46fd15214959
Node: ttk Combobox15215178
Ref: library/tkinter ttk ttk-combobox15215275
Ref: 46fe15215275
Ref: library/tkinter ttk tkinter ttk Combobox15215322
Ref: 46eb15215322
Ref: library/tkinter ttk tkinter ttk Combobox current15215359
Ref: 46ff15215359
Ref: library/tkinter ttk tkinter ttk Combobox get15215767
Ref: 470015215767
Ref: library/tkinter ttk tkinter ttk Combobox set15215864
Ref: 470115215864
Node: Spinbox15215972
Ref: library/tkinter ttk spinbox15216128
Ref: 470215216128
Node: オプション<2>15216902
Ref: library/tkinter ttk id115216994
Ref: 470315216994
Node: 仮想イベント<2>15219414
Ref: library/tkinter ttk id215219526
Ref: 470415219526
Node: ttk Spinbox15219736
Ref: library/tkinter ttk ttk-spinbox15219821
Ref: 470515219821
Ref: library/tkinter ttk tkinter ttk Spinbox15219866
Ref: d9115219866
Ref: library/tkinter ttk tkinter ttk Spinbox get15220018
Ref: 470615220018
Ref: library/tkinter ttk tkinter ttk Spinbox set15220102
Ref: 470715220102
Node: ノートブック15220191
Ref: library/tkinter ttk notebook15220347
Ref: 470815220347
Node: オプション<3>15220864
Ref: library/tkinter ttk id315220957
Ref: 470915220957
Node: Tab options15222277
Ref: library/tkinter ttk tab-options15222394
Ref: 470a15222394
Node: Tab identifiers15224506
Ref: library/tkinter ttk tab-identifiers15224626
Ref: 470c15224626
Node: 仮想イベント<3>15225118
Ref: library/tkinter ttk id415225239
Ref: 470e15225239
Node: ttk Notebook15225425
Ref: library/tkinter ttk ttk-notebook15225522
Ref: 470f15225522
Ref: library/tkinter ttk tkinter ttk Notebook15225569
Ref: 44a715225569
Ref: library/tkinter ttk tkinter ttk Notebook add15225606
Ref: 471015225606
Ref: library/tkinter ttk tkinter ttk Notebook forget15226013
Ref: 471115226013
Ref: library/tkinter ttk tkinter ttk Notebook hide15226465
Ref: 471215226465
Ref: library/tkinter ttk tkinter ttk Notebook identify15226845
Ref: 471315226845
Ref: library/tkinter ttk tkinter ttk Notebook index15227015
Ref: 470d15227015
Ref: library/tkinter ttk tkinter ttk Notebook insert15227220
Ref: 471415227220
Ref: library/tkinter ttk tkinter ttk Notebook select15227737
Ref: 471515227737
Ref: library/tkinter ttk tkinter ttk Notebook tab15228172
Ref: 471615228172
Ref: library/tkinter ttk tkinter ttk Notebook tabs15228644
Ref: 471715228644
Ref: library/tkinter ttk tkinter ttk Notebook enable_traversal15228739
Ref: 470b15228739
Node: プログレスバー15229784
Ref: library/tkinter ttk progressbar15229948
Ref: 471815229948
Node: オプション<4>15230425
Ref: library/tkinter ttk id515230525
Ref: 471915230525
Node: ttk Progressbar15232542
Ref: library/tkinter ttk ttk-progressbar15232642
Ref: 471a15232642
Ref: library/tkinter ttk tkinter ttk Progressbar15232695
Ref: 46ec15232695
Ref: library/tkinter ttk tkinter ttk Progressbar start15232735
Ref: 471b15232735
Ref: library/tkinter ttk tkinter ttk Progressbar step15233099
Ref: 471c15233099
Ref: library/tkinter ttk tkinter ttk Progressbar stop15233334
Ref: 471d15233334
Node: セパレータ15233597
Ref: library/tkinter ttk separator15233764
Ref: 471e15233764
Node: オプション<5>15234030
Ref: library/tkinter ttk id615234100
Ref: 471f15234100
Node: サイズグリップ15234507
Ref: library/tkinter ttk sizegrip15234671
Ref: 472015234671
Node: プラットフォーム固有のメモ15235071
Ref: library/tkinter ttk platform-specific-notes15235183
Ref: 472115235183
Node: バグ15235560
Ref: library/tkinter ttk bugs15235672
Ref: 472215235672
Node: ツリービュー15236014
Ref: library/tkinter ttk treeview15236174
Ref: 472315236174
Node: オプション<6>15237947
Ref: library/tkinter ttk id715238041
Ref: 472715238041
Node: Item options15241278
Ref: library/tkinter ttk item-options15241392
Ref: 472815241392
Node: Tag options15242613
Ref: library/tkinter ttk tag-options15242727
Ref: 472915242727
Node: Column identifiers15243458
Ref: library/tkinter ttk column-identifiers15243581
Ref: 472415243581
Node: 仮想イベント<4>15244744
Ref: library/tkinter ttk id815244868
Ref: 472a15244868
Node: ttk Treeview15245843
Ref: library/tkinter ttk ttk-treeview15245940
Ref: 472c15245940
Ref: library/tkinter ttk tkinter ttk Treeview15245987
Ref: c8b15245987
Ref: library/tkinter ttk tkinter ttk Treeview bbox15246024
Ref: 472d15246024
Ref: library/tkinter ttk tkinter ttk Treeview get_children15246671
Ref: 472e15246671
Ref: library/tkinter ttk tkinter ttk Treeview set_children15246900
Ref: 472f15246900
Ref: library/tkinter ttk tkinter ttk Treeview column15247385
Ref: 473015247385
Ref: library/tkinter ttk tkinter ttk Treeview delete15249109
Ref: 473115249109
Ref: library/tkinter ttk tkinter ttk Treeview detach15249287
Ref: 473215249287
Ref: library/tkinter ttk tkinter ttk Treeview exists15249691
Ref: 473315249691
Ref: library/tkinter ttk tkinter ttk Treeview focus15249840
Ref: 472b15249840
Ref: library/tkinter ttk tkinter ttk Treeview heading15250300
Ref: 473415250300
Ref: library/tkinter ttk tkinter ttk Treeview identify15251545
Ref: 473515251545
Ref: library/tkinter ttk tkinter ttk Treeview identify_row15252178
Ref: 473615252178
Ref: library/tkinter ttk tkinter ttk Treeview identify_column15252301
Ref: 473715252301
Ref: library/tkinter ttk tkinter ttk Treeview identify_region15252506
Ref: 473815252506
Ref: library/tkinter ttk tkinter ttk Treeview identify_element15253211
Ref: 473915253211
Ref: library/tkinter ttk tkinter ttk Treeview index15253389
Ref: 473a15253389
Ref: library/tkinter ttk tkinter ttk Treeview insert15253527
Ref: 473b15253527
Ref: library/tkinter ttk tkinter ttk Treeview item15254535
Ref: 473c15254535
Ref: library/tkinter ttk tkinter ttk Treeview reattach15255066
Ref: 473d15255066
Ref: library/tkinter ttk tkinter ttk Treeview move15255066
Ref: 473e15255066
Ref: library/tkinter ttk tkinter ttk Treeview next15255637
Ref: 473f15255637
Ref: library/tkinter ttk tkinter ttk Treeview parent15255823
Ref: 474015255823
Ref: library/tkinter ttk tkinter ttk Treeview prev15255981
Ref: 474115255981
Ref: library/tkinter ttk tkinter ttk Treeview see15256167
Ref: 474215256167
Ref: library/tkinter ttk tkinter ttk Treeview selection15256486
Ref: c8a15256486
Ref: library/tkinter ttk tkinter ttk Treeview selection_set15256747
Ref: c8c15256747
Ref: library/tkinter ttk tkinter ttk Treeview selection_add15257018
Ref: 474315257018
Ref: library/tkinter ttk tkinter ttk Treeview selection_remove15257289
Ref: 474415257289
Ref: library/tkinter ttk tkinter ttk Treeview selection_toggle15257563
Ref: 474515257563
Ref: library/tkinter ttk tkinter ttk Treeview set15257848
Ref: 474615257848
Ref: library/tkinter ttk tkinter ttk Treeview tag_bind15258310
Ref: 474715258310
Ref: library/tkinter ttk tkinter ttk Treeview tag_configure15258669
Ref: 474815258669
Ref: library/tkinter ttk tkinter ttk Treeview tag_has15259205
Ref: 474915259205
Ref: library/tkinter ttk tkinter ttk Treeview xview15259524
Ref: 472515259524
Ref: library/tkinter ttk tkinter ttk Treeview yview15259681
Ref: 472615259681
Node: Ttk styling15259838
Ref: library/tkinter ttk ttk-styling15259995
Ref: 474a15259995
Ref: library/tkinter ttk ttkstyling15259995
Ref: 46f015259995
Ref: library/tkinter ttk tkinter ttk Style15260630
Ref: 56015260630
Ref: library/tkinter ttk tkinter ttk Style configure15260761
Ref: 474b15260761
Ref: library/tkinter ttk tkinter ttk Style map15261604
Ref: 1d4415261604
Ref: library/tkinter ttk tkinter ttk Style lookup15263401
Ref: 474c15263401
Ref: library/tkinter ttk tkinter ttk Style layout15264083
Ref: 474d15264083
Ref: library/tkinter ttk tkinter ttk Style element_create15265647
Ref: 55f15265647
Ref: library/tkinter ttk tkinter ttk Style element_names15271305
Ref: 474f15271305
Ref: library/tkinter ttk tkinter ttk Style element_options15271415
Ref: 475015271415
Ref: library/tkinter ttk tkinter ttk Style theme_create15271523
Ref: 475115271523
Ref: library/tkinter ttk tkinter ttk Style theme_settings15272065
Ref: 475215272065
Ref: library/tkinter ttk tkinter ttk Style theme_names15273625
Ref: 475315273625
Ref: library/tkinter ttk tkinter ttk Style theme_use15273712
Ref: 475415273712
Ref: Ttk styling-Footnote-115274148
Node: レイアウト15274210
Ref: library/tkinter ttk layouts15274273
Ref: 474e15274273
Node: Additional widgets15275548
Ref: library/tkinter ttk additional-widgets15275678
Ref: 475515275678
Ref: library/tkinter ttk layout15275678
Ref: 475615275678
Ref: library/tkinter ttk tkinter ttk Button15275948
Ref: 439915275948
Ref: library/tkinter ttk tkinter ttk Button invoke15276251
Ref: 439f15276251
Ref: library/tkinter ttk tkinter ttk Checkbutton15276375
Ref: 1a2515276375
Ref: library/tkinter ttk tkinter ttk Checkbutton invoke15276679
Ref: 475715276679
Ref: library/tkinter ttk tkinter ttk Entry15276876
Ref: 43d915276876
Ref: library/tkinter ttk tkinter ttk Entry bbox15277238
Ref: 46fb15277238
Ref: library/tkinter ttk tkinter ttk Entry identify15277525
Ref: 475815277525
Ref: library/tkinter ttk tkinter ttk Entry validate15277728
Ref: 475915277728
Ref: library/tkinter ttk tkinter ttk Frame15277889
Ref: 439715277889
Ref: library/tkinter ttk tkinter ttk Label15278165
Ref: 439815278165
Ref: library/tkinter ttk tkinter ttk Labelframe15278422
Ref: 475a15278422
Ref: library/tkinter ttk tkinter ttk Menubutton15278731
Ref: 46e615278731
Ref: library/tkinter ttk tkinter ttk OptionMenu15279041
Ref: 475b15279041
Ref: library/tkinter ttk tkinter ttk OptionMenu set_menu15279730
Ref: 475c15279730
Ref: library/tkinter ttk tkinter ttk OptionMenu destroy15279931
Ref: 475d15279931
Ref: library/tkinter ttk tkinter ttk Panedwindow15280112
Ref: 475e15280112
Ref: library/tkinter ttk tkinter ttk Panedwindow insert15280622
Ref: 475f15280622
Ref: library/tkinter ttk tkinter ttk Panedwindow forget15281002
Ref: 476015281002
Ref: library/tkinter ttk tkinter ttk Panedwindow pane15281403
Ref: 476115281403
Ref: library/tkinter ttk tkinter ttk Panedwindow sashpos15281869
Ref: 476215281869
Ref: library/tkinter ttk tkinter ttk Radiobutton15282330
Ref: 46e715282330
Ref: library/tkinter ttk tkinter ttk Radiobutton invoke15282691
Ref: 476315282691
Ref: library/tkinter ttk tkinter ttk Scale15282892
Ref: 46e815282892
Ref: library/tkinter ttk tkinter ttk Scale configure15283225
Ref: 476415283225
Ref: library/tkinter ttk tkinter ttk Scale get15283645
Ref: 476515283645
Ref: library/tkinter ttk tkinter ttk Scrollbar15283860
Ref: 46e915283860
Ref: library/tkinter ttk tkinter ttk Separator15284322
Ref: 46ed15284322
Ref: library/tkinter ttk tkinter ttk Sizegrip15284590
Ref: 46ee15284590
Ref: library/tkinter ttk tkinter ttk LabeledScale15284974
Ref: 1d3015284974
Ref: library/tkinter ttk tkinter ttk LabeledScale destroy15285362
Ref: 476615285362
Ref: library/tkinter ttk tkinter ttk LabelFrame15285507
Ref: 46e515285507
Ref: library/tkinter ttk tkinter ttk PanedWindow15285677
Ref: 44a815285677
Node: IDLE --- Python のエディタとシェル<2>15285850
Ref: library/idle doc15286065
Ref: 476715286065
Ref: library/idle idle15286065
Ref: 121b15286065
Ref: library/idle idle-python-editor-and-shell15286065
Ref: 476815286065
Ref: library/idle translation-repo15286065
Ref: 476915286065
Ref: IDLE --- Python のエディタとシェル<2>-Footnote-115287758
Node: メニュー15287823
Ref: library/idle menus15287949
Ref: 476a15287949
Node: File メニュー Shell ウィンドウ、Editor ウィンドウ15290087
Ref: library/idle file-menu-shell-and-editor15290273
Ref: 476b15290273
Node: Edit メニュー Shell ウィンドウ、Editor ウィンドウ15292845
Ref: library/idle edit-menu-shell-and-editor15293106
Ref: 476c15293106
Node: Format メニュー Shell ウィンドウ、Editor ウィンドウ15295668
Ref: library/idle format-menu15295910
Ref: 476f15295910
Ref: library/idle format-menu-editor-window-only15295910
Ref: 477015295910
Node: Run メニュー Editor ウィンドウのみ15297889
Ref: library/idle run-menu-editor-window-only15298113
Ref: 477215298113
Ref: library/idle run-module15298217
Ref: 477315298217
Ref: library/idle run-custom15298938
Ref: 477515298938
Ref: library/idle check-module15299198
Ref: 477415299198
Ref: library/idle python-shell15299661
Ref: 477615299661
Node: Shell メニュー Shell ウィンドウのみ15299763
Ref: library/idle shell-menu-shell-window-only15299967
Ref: 477715299967
Node: Debug メニュー Shell ウィンドウのみ15300684
Ref: library/idle debug-menu-shell-window-only15300910
Ref: 477815300910
Node: Options メニュー Shell ウィンドウ、Editor ウィンドウ15302333
Ref: library/idle options-menu-shell-and-editor15302579
Ref: 477915302579
Node: Window メニュー Shell ウィンドウ、Editor ウィンドウ15304438
Ref: library/idle window-menu-shell-and-editor15304702
Ref: 477c15304702
Node: Help メニュー Shell ウィンドウ、Editor ウィンドウ15304955
Ref: library/idle help-menu-shell-and-editor15305165
Ref: 477d15305165
Node: Context menus15306440
Ref: library/idle context-menus15306575
Ref: 477f15306575
Node: Editing and Navigation15308380
Ref: library/idle editing-and-navigation15308541
Ref: 478015308541
Ref: library/idle id115308541
Ref: 478115308541
Node: Editor windows15308886
Ref: library/idle editor-windows15308980
Ref: 478215308980
Node: Key bindings15309594
Ref: library/idle key-bindings15309718
Ref: 478315309718
Node: 自動的な字下げ15311220
Ref: library/idle automatic-indentation15311345
Ref: 478415311345
Node: 検索と置換15312091
Ref: library/idle search-and-replace15312222
Ref: 478515312222
Node: 補完 Completions15312545
Ref: library/idle completions15312685
Ref: 476d15312685
Ref: library/idle id215312685
Ref: 478615312685
Node: 呼び出しヒント Calltips15315324
Ref: library/idle calltips15315461
Ref: 476e15315461
Ref: library/idle id315315461
Ref: 478715315461
Node: Format block15317112
Ref: library/idle format-block15317243
Ref: 477115317243
Ref: library/idle id415317243
Ref: 478815317243
Node: Code Context15317762
Ref: library/idle code-context15317875
Ref: 477b15317875
Ref: library/idle id515317875
Ref: 478915317875
Node: Shell window15318763
Ref: library/idle shell-window15318882
Ref: 478a15318882
Node: テキストの色15320557
Ref: library/idle text-colors15320655
Ref: 478b15320655
Node: Startup and Code Execution15322099
Ref: library/idle startup-and-code-execution15322268
Ref: 478c15322268
Node: コマンドラインでの使用<5>15323655
Ref: library/idle command-line-usage15323778
Ref: 478d15323778
Ref: library/idle idlelib-cli15323778
Ref: 478e15323778
Ref: library/idle cmdoption-idle-c15324028
Ref: 478f15324028
Ref: library/idle cmdoption-idle-d15324240
Ref: 479015324240
Ref: library/idle cmdoption-idle-e15324309
Ref: 479115324309
Ref: library/idle cmdoption-idle-h15324354
Ref: 479215324354
Ref: library/idle cmdoption-idle-i15324442
Ref: 479315324442
Ref: library/idle cmdoption-idle-r15324485
Ref: 479415324485
Ref: library/idle cmdoption-idle-s15324558
Ref: 479515324558
Ref: library/idle cmdoption-idle-t15324733
Ref: 479615324733
Ref: library/idle cmdoption-idle-015324798
Ref: 479715324798
Node: Startup failure15325385
Ref: library/idle startup-failure15325534
Ref: 479815325534
Node: Running user code15328708
Ref: library/idle running-user-code15328841
Ref: 479915328841
Node: User output in Shell15331621
Ref: library/idle user-output-in-shell15331770
Ref: 479a15331770
Node: Developing tkinter applications15334840
Ref: library/idle developing-tkinter-applications15335020
Ref: 479b15335020
Node: サブプロセスを起こさずに起動する15336269
Ref: library/idle running-without-a-subprocess15336420
Ref: 479c15336420
Node: Help and Preferences15338487
Ref: library/idle help-and-preferences15338680
Ref: 479d15338680
Node: Help sources15338854
Ref: library/idle help-sources15338969
Ref: 477e15338969
Ref: library/idle id615338969
Ref: 479e15338969
Node: Setting preferences [お好み設定]15339827
Ref: library/idle preferences15339964
Ref: 477a15339964
Ref: library/idle setting-preferences15339964
Ref: 479f15339964
Node: IDLE on macOS15341002
Ref: library/idle idle-on-macos15341146
Ref: 47a015341146
Node: Extensions [拡張]15341405
Ref: library/idle extensions15341503
Ref: 47a115341503
Node: idlelib --- implementation of IDLE application15341870
Ref: library/idle idlelib-implementation-of-idle-application15342028
Ref: 47a215342028
Ref: library/idle module-idlelib15342028
Ref: 7715342028
Ref: idlelib --- implementation of IDLE application-Footnote-115342728
Ref: idlelib --- implementation of IDLE application-Footnote-215342792
Node: turtle --- Turtle graphics15342834
Ref: library/turtle doc15342985
Ref: 47a315342985
Ref: library/turtle module-turtle15342985
Ref: 10815342985
Ref: library/turtle translation-repo15342985
Ref: 47a415342985
Ref: library/turtle turtle-turtle-graphics15342985
Ref: 47a515342985
Ref: turtle --- Turtle graphics-Footnote-115343730
Node: はじめに<12>15343796
Ref: library/turtle introduction15343895
Ref: 47a615343895
Ref: はじめに<12>-Footnote-115344410
Node: Get started15344463
Ref: library/turtle get-started15344595
Ref: 47a715344595
Node: チュートリアル<4>15345843
Ref: library/turtle turtle-tutorial15345965
Ref: 47a815345965
Ref: library/turtle tutorial15345965
Ref: 47a915345965
Node: Starting a turtle environment15346217
Ref: library/turtle starting-a-turtle-environment15346329
Ref: 47aa15346329
Node: Basic drawing15346642
Ref: library/turtle basic-drawing15346790
Ref: 47ab15346790
Node: Pen の制御15347429
Ref: library/turtle pen-control15347522
Ref: 47ac15347522
Node: The turtle's position15347853
Ref: library/turtle the-turtle-s-position15347946
Ref: 47ad15347946
Node: Making algorithmic patterns15348385
Ref: library/turtle making-algorithmic-patterns15348495
Ref: 47ae15348495
Node: How to15349468
Ref: library/turtle how-to15349604
Ref: 47af15349604
Ref: library/turtle turtle-how-to15349604
Ref: 47b015349604
Node: Get started as quickly as possible15349913
Ref: library/turtle get-started-as-quickly-as-possible15350034
Ref: 47b115350034
Ref: library/turtle note15350786
Ref: 47b215350786
Node: Automatically begin and end filling15351054
Ref: library/turtle automatically-begin-and-end-filling15351215
Ref: 47b315351215
Node: Use the turtle module namespace15351792
Ref: library/turtle use-the-turtle-module-namespace15351950
Ref: 47b615351950
Node: Use turtle graphics in a script15352612
Ref: library/turtle use-turtle-graphics-in-a-script15352770
Ref: 47b715352770
Node: Use object-oriented turtle graphics15353462
Ref: library/turtle use-object-oriented-turtle-graphics15353580
Ref: 47b815353580
Node: Turtle graphics reference15354800
Ref: library/turtle turtle-graphics-reference15354965
Ref: 47bb15354965
Node: Turtle のメソッド15355332
Ref: library/turtle turtle-methods15355460
Ref: 47bc15355460
Node: TurtleScreen/Screen のメソッド15358604
Ref: library/turtle methods-of-turtlescreen-screen15358732
Ref: 480715358732
Node: RawTurtle/Turtle のメソッドと対応する関数15360183
Ref: library/turtle methods-of-rawturtle-turtle-and-corresponding-functions15360398
Ref: 482615360398
Node: Turtle の動き15360863
Ref: library/turtle turtle-motion15361003
Ref: 482715361003
Ref: library/turtle turtle forward15361057
Ref: 36ad15361057
Ref: library/turtle turtle fd15361098
Ref: 47bd15361098
Ref: library/turtle turtle back15361567
Ref: 47c015361567
Ref: library/turtle turtle bk15361605
Ref: 47bf15361605
Ref: library/turtle turtle backward15361641
Ref: 47be15361641
Ref: library/turtle turtle right15362050
Ref: 47c115362050
Ref: library/turtle turtle rt15362086
Ref: 47c215362086
Ref: library/turtle turtle left15362673
Ref: 47c315362673
Ref: library/turtle turtle lt15362708
Ref: 47c415362708
Ref: library/turtle turtle goto15363293
Ref: 47c515363293
Ref: library/turtle turtle setpos15363332
Ref: 47c615363332
Ref: library/turtle turtle setposition15363373
Ref: 47c715363373
Ref: library/turtle turtle teleport15364228
Ref: 1af815364228
Ref: library/turtle turtle setx15365243
Ref: 47c815365243
Ref: library/turtle turtle sety15365586
Ref: 47c915365586
Ref: library/turtle turtle setheading15365928
Ref: 47ca15365928
Ref: library/turtle turtle seth15365972
Ref: 47cb15365972
Ref: library/turtle turtle home15366844
Ref: 47cc15366844
Ref: library/turtle turtle circle15367322
Ref: 47cd15367322
Ref: library/turtle turtle dot15368865
Ref: 47ce15368865
Ref: library/turtle turtle stamp15369599
Ref: 47cf15369599
Ref: library/turtle turtle clearstamp15370028
Ref: 47d015370028
Ref: library/turtle turtle clearstamps15370591
Ref: 47d115370591
Ref: library/turtle turtle undo15371194
Ref: 47d215371194
Ref: library/turtle turtle speed15371586
Ref: 47d315371586
Node: Turtle の状態を知る15372850
Ref: library/turtle tell-turtle-s-state15373014
Ref: 482915373014
Ref: library/turtle turtle position15373083
Ref: 47d415373083
Ref: library/turtle turtle pos15373117
Ref: 47d515373117
Ref: library/turtle turtle towards15373305
Ref: 47d615373305
Ref: library/turtle turtle xcor15373879
Ref: 47d715373879
Ref: library/turtle turtle ycor15374167
Ref: 47d815374167
Ref: library/turtle turtle heading15374462
Ref: 47d915374462
Ref: library/turtle turtle distance15374776
Ref: 47da15374776
Node: 設定と計測15375474
Ref: library/turtle settings-for-measurement15375638
Ref: 482a15375638
Ref: library/turtle turtle degrees15375688
Ref: 47db15375688
Ref: library/turtle turtle radians15376375
Ref: 47dc15376375
Node: Pen の制御<2>15376719
Ref: library/turtle id115376879
Ref: 482b15376879
Node: 描画状態15377039
Ref: library/turtle drawing-state15377128
Ref: 482c15377128
Ref: library/turtle turtle pendown15377173
Ref: 47dd15377173
Ref: library/turtle turtle pd15377206
Ref: 47de15377206
Ref: library/turtle turtle down15377234
Ref: 47df15377234
Ref: library/turtle turtle penup15377332
Ref: 47e015377332
Ref: library/turtle turtle pu15377363
Ref: 47e115377363
Ref: library/turtle turtle up15377391
Ref: 47e215377391
Ref: library/turtle turtle pensize15377490
Ref: 47e315377490
Ref: library/turtle turtle width15377533
Ref: 47e415377533
Ref: library/turtle turtle pen15378037
Ref: 47e515378037
Ref: library/turtle turtle isdown15379961
Ref: 47e615379961
Node: 色の制御<2>15380262
Ref: library/turtle color-control15380375
Ref: 482d15380375
Ref: library/turtle turtle pencolor15380420
Ref: 47e815380420
Ref: library/turtle turtle fillcolor15382341
Ref: 47e915382341
Ref: library/turtle turtle color15384211
Ref: 47e715384211
Node: 塗りつぶし15385825
Ref: library/turtle filling15385953
Ref: 482e15385953
Ref: library/turtle turtle filling15386003
Ref: 47ea15386003
Ref: library/turtle turtle fill15386263
Ref: 2a515386263
Ref: library/turtle turtle begin_fill15386807
Ref: 47b415386807
Ref: library/turtle turtle end_fill15386905
Ref: 47b515386905
Node: さらなる描画の制御15387493
Ref: library/turtle more-drawing-control15387597
Ref: 482f15387597
Ref: library/turtle turtle reset15387667
Ref: 47eb15387667
Ref: library/turtle turtle clear15388170
Ref: 47ec15388170
Ref: library/turtle turtle write15388440
Ref: 47ed15388440
Node: タートルの状態15389270
Ref: library/turtle turtle-state15389442
Ref: 483015389442
Node: 可視性15389540
Ref: library/turtle visibility15389625
Ref: 483115389625
Ref: library/turtle turtle hideturtle15389665
Ref: 47f015389665
Ref: library/turtle turtle ht15389701
Ref: 47f115389701
Ref: library/turtle turtle showturtle15390029
Ref: 47ee15390029
Ref: library/turtle turtle st15390065
Ref: 47ef15390065
Ref: library/turtle turtle isvisible15390181
Ref: 47f215390181
Node: 見た目15390511
Ref: library/turtle appearance15390596
Ref: 483215390596
Ref: library/turtle turtle shape15390636
Ref: 47f315390636
Ref: library/turtle turtle resizemode15391432
Ref: 47f415391432
Ref: library/turtle turtle shapesize15392540
Ref: 47f515392540
Ref: library/turtle turtle turtlesize15392633
Ref: 47f615392633
Ref: library/turtle turtle shearfactor15393751
Ref: 47f715393751
Ref: library/turtle turtle tilt15394417
Ref: 47f815394417
Ref: library/turtle turtle tiltangle15394891
Ref: 93315394891
Ref: library/turtle turtle shapetransform15395615
Ref: 47f915395615
Ref: library/turtle turtle get_shapepoly15396645
Ref: 47fa15396645
Node: イベントを利用する15397017
Ref: library/turtle using-events15397205
Ref: 483315397205
Ref: library/turtle turtle onrelease15398264
Ref: 47fc15398264
Ref: library/turtle turtle ondrag15399420
Ref: 47fd15399420
Node: 特別な Turtle のメソッド15400522
Ref: library/turtle special-turtle-methods15400704
Ref: 483415400704
Ref: library/turtle turtle poly15400785
Ref: 2a615400785
Ref: library/turtle turtle begin_poly15401129
Ref: 47fe15401129
Ref: library/turtle turtle end_poly15401281
Ref: 47ff15401281
Ref: library/turtle turtle get_poly15401482
Ref: 480015401482
Ref: library/turtle turtle clone15401903
Ref: 480115401903
Ref: library/turtle turtle getturtle15402129
Ref: 480215402129
Ref: library/turtle turtle getpen15402164
Ref: 480315402164
Ref: library/turtle turtle getscreen15402467
Ref: 480415402467
Ref: library/turtle turtle setundobuffer15402848
Ref: 480515402848
Ref: library/turtle turtle undobufferentries15403418
Ref: 480615403418
Node: Compound shapes15403599
Ref: library/turtle compound-shapes15403745
Ref: 483615403745
Ref: library/turtle compoundshapes15403745
Ref: 483715403745
Node: TurtleScreen/Screen のメソッドと対応する関数15404995
Ref: library/turtle methods-of-turtlescreen-screen-and-corresponding-functions15405199
Ref: 483a15405199
Node: ウィンドウの制御15405703
Ref: library/turtle window-control15405859
Ref: 483b15405859
Ref: library/turtle turtle bgcolor15405924
Ref: 480815405924
Ref: library/turtle turtle bgpic15407270
Ref: 480915407270
Ref: library/turtle turtle clearscreen15408309
Ref: 480a15408309
Ref: library/turtle turtle resetscreen15408937
Ref: 480b15408937
Ref: library/turtle turtle screensize15409078
Ref: 480c15409078
Ref: library/turtle turtle setworldcoordinates15410265
Ref: 480d15410265
Node: アニメーションの制御15411281
Ref: library/turtle animation-control15411488
Ref: 483c15411488
Ref: library/turtle turtle no_animation15411563
Ref: 2a715411563
Ref: library/turtle turtle delay15411968
Ref: 480e15411968
Ref: library/turtle turtle tracer15412469
Ref: 480f15412469
Ref: library/turtle turtle update15413299
Ref: 481015413299
Node: スクリーンイベントを利用する15413516
Ref: library/turtle using-screen-events15413717
Ref: 483d15413717
Ref: library/turtle turtle listen15413812
Ref: 481115413812
Ref: library/turtle turtle onkey15414094
Ref: 481215414094
Ref: library/turtle turtle onkeyrelease15414133
Ref: 481315414133
Ref: library/turtle turtle onkeypress15414902
Ref: 481415414902
Ref: library/turtle turtle onclick15415516
Ref: 47fb15415516
Ref: library/turtle turtle onscreenclick15415569
Ref: 481515415569
Ref: library/turtle turtle ontimer15416981
Ref: 481615416981
Ref: library/turtle turtle mainloop15417470
Ref: 481715417470
Ref: library/turtle turtle done15417504
Ref: 481815417504
Node: 入力メソッド15417829
Ref: library/turtle input-methods15418030
Ref: 483e15418030
Ref: library/turtle turtle textinput15418085
Ref: 1cd715418085
Ref: library/turtle turtle numinput15418541
Ref: 1cd815418541
Node: 設定と特殊なメソッド15419460
Ref: library/turtle settings-and-special-methods15419693
Ref: 483f15419693
Ref: library/turtle turtle mode15419768
Ref: 481915419768
Ref: library/turtle turtle colormode15421034
Ref: 481a15421034
Ref: library/turtle turtle getcanvas15421773
Ref: 481b15421773
Ref: library/turtle turtle getshapes15422057
Ref: 481c15422057
Ref: library/turtle turtle register_shape15422275
Ref: 481d15422275
Ref: library/turtle turtle addshape15422331
Ref: 481e15422331
Ref: library/turtle turtle turtles15423993
Ref: 481f15423993
Ref: library/turtle turtle window_height15424182
Ref: 482015424182
Ref: library/turtle turtle window_width15424335
Ref: 482115424335
Node: Screen 独自のメソッド、TurtleScreen から継承したもの以外15424483
Ref: library/turtle methods-specific-to-screen-not-inherited-from-turtlescreen15424689
Ref: 484015424689
Ref: library/turtle screenspecific15424689
Ref: 484115424689
Ref: library/turtle turtle bye15424844
Ref: 482215424844
Ref: library/turtle turtle exitonclick15424966
Ref: 482315424966
Ref: library/turtle turtle save15425584
Ref: 19d015425584
Ref: library/turtle turtle setup15426173
Ref: 482415426173
Ref: library/turtle turtle title15427694
Ref: 482515427694
Node: Public classes15428018
Ref: library/turtle public-classes15428178
Ref: 484215428178
Ref: library/turtle turtle RawTurtle15428231
Ref: 484315428231
Ref: library/turtle turtle RawPen15428272
Ref: 484415428272
Ref: library/turtle turtle Turtle15428599
Ref: 484615428599
Ref: library/turtle turtle TurtleScreen15428847
Ref: 483515428847
Ref: library/turtle turtle Screen15429070
Ref: 47ba15429070
Ref: library/turtle turtle ScrolledCanvas15429207
Ref: 484515429207
Ref: library/turtle turtle Shape15429572
Ref: 483815429572
Ref: library/turtle turtle Shape addcomponent15430438
Ref: 483915430438
Ref: library/turtle turtle Vec2D15431057
Ref: 482815431057
Node: 説明<2>15431711
Ref: library/turtle explanation15431833
Ref: 484715431833
Ref: library/turtle turtle-explanation15431833
Ref: 47b915431833
Node: ヘルプと設定15433251
Ref: library/turtle help-and-configuration15433386
Ref: 484815433386
Node: ヘルプの使い方15433562
Ref: library/turtle how-to-use-help15433683
Ref: 484915433683
Node: ドキュメント文字列の翻訳15436234
Ref: library/turtle translation-of-docstrings-into-different-languages15436403
Ref: 484a15436403
Ref: library/turtle turtle write_docstringdict15436686
Ref: 484b15436686
Node: Screen および Turtle の設定方法15438056
Ref: library/turtle how-to-configure-screen-and-turtles15438195
Ref: 484c15438195
Node: turtledemo --- Demo scripts15441408
Ref: library/turtle module-turtledemo15441562
Ref: 10915441562
Ref: library/turtle turtledemo-demo-scripts15441562
Ref: 484d15441562
Node: python 2 6からの変更点15448248
Ref: library/turtle changes-since-python-2-615448412
Ref: 484e15448412
Node: python 3 0からの変更点15449447
Ref: library/turtle changes-since-python-3-015449575
Ref: 484f15449575
Node: 開発ツール15450685
Ref: library/development doc15450839
Ref: 485015450839
Ref: library/development development15450839
Ref: 485115450839
Ref: library/development development-tools15450839
Ref: 485215450839
Ref: library/development translation-repo15450839
Ref: 485315450839
Node: typing --- 型ヒントのサポート15453151
Ref: library/typing doc15453323
Ref: 485415453323
Ref: library/typing typing-support-for-type-hints15453323
Ref: 485515453323
Ref: library/typing module-typing15453413
Ref: 10b15453413
Ref: typing --- 型ヒントのサポート-Footnote-115456245
Ref: typing --- 型ヒントのサポート-Footnote-215456311
Ref: typing --- 型ヒントのサポート-Footnote-315456363
Ref: typing --- 型ヒントのサポート-Footnote-415456430
Ref: typing --- 型ヒントのサポート-Footnote-515456487
Node: Python 型システムの仕様15456532
Ref: library/typing relevant-peps15456665
Ref: 485615456665
Ref: library/typing specification-for-the-python-type-system15456665
Ref: 485715456665
Ref: Python 型システムの仕様-Footnote-115456906
Node: 型エイリアス15456966
Ref: library/typing id215457115
Ref: 485815457115
Ref: library/typing type-aliases15457115
Ref: 68315457115
Node: NewType15458854
Ref: library/typing distinct15459032
Ref: 485915459032
Ref: library/typing newtype15459032
Ref: 485a15459032
Ref: NewType-Footnote-115462774
Node: 呼び出し可能オブジェクトのアノテーション15462816
Ref: library/typing annotating-callable-objects15462994
Ref: 485b15462994
Ref: library/typing annotating-callables15462994
Ref: 272815462994
Ref: 呼び出し可能オブジェクトのアノテーション-Footnote-115466566
Node: ジェネリクス15466608
Ref: library/typing generics15466812
Ref: 242915466812
Ref: library/typing id315466812
Ref: 485d15466812
Node: タプルのアノテーション15468467
Ref: library/typing annotating-tuples15468644
Ref: 267415468644
Ref: library/typing id415468644
Ref: 485e15468644
Node: クラスオブジェクトの型15471353
Ref: library/typing the-type-of-class-objects15471548
Ref: 485f15471548
Ref: library/typing type-of-class-objects15471548
Ref: 486015471548
Node: Annotating generators and coroutines15473228
Ref: library/typing annotating-generators-and-coroutines15473432
Ref: 2a1215473432
Ref: library/typing id515473432
Ref: 486215473432
Node: ユーザー定義のジェネリック型15475997
Ref: library/typing user-defined-generic-types15476175
Ref: 486315476175
Ref: library/typing user-defined-generics15476175
Ref: 6f615476175
Ref: ユーザー定義のジェネリック型-Footnote-115482272
Node: Any 型15482314
Ref: library/typing the-any-type15482496
Ref: 486515482496
Node: 名前的部分型 vs 構造的部分型15485410
Ref: library/typing nominal-vs-structural-subtyping15485577
Ref: 486615485577
Ref: 名前的部分型 vs 構造的部分型-Footnote-115487544
Ref: 名前的部分型 vs 構造的部分型-Footnote-215487586
Ref: 名前的部分型 vs 構造的部分型-Footnote-315487628
Node: モジュールの内容<4>15487670
Ref: library/typing module-contents15487872
Ref: 486715487872
Node: 特殊型付けプリミティブ15488257
Ref: library/typing special-typing-primitives15488381
Ref: 486815488381
Node: 特殊型15488573
Ref: library/typing special-types15488673
Ref: 486915488673
Ref: library/typing typing Any15488805
Ref: 8bc15488805
Ref: library/typing typing AnyStr15489209
Ref: 5ac15489209
Ref: library/typing typing LiteralString15491035
Ref: 7e615491035
Ref: library/typing typing Never15492288
Ref: 8b815492288
Ref: library/typing typing NoReturn15492316
Ref: 486b15492316
Ref: library/typing typing Self15493548
Ref: 7e315493548
Ref: library/typing typing TypeAlias15495510
Ref: 9d015495510
Ref: 特殊型-Footnote-115497143
Ref: 特殊型-Footnote-215497185
Ref: 特殊型-Footnote-315497227
Ref: 特殊型-Footnote-415497277
Ref: 特殊型-Footnote-515497319
Node: 特殊形式15497361
Ref: library/typing special-forms15497509
Ref: 486c15497509
Ref: library/typing typing Union15497754
Ref: 2aa15497754
Ref: library/typing typing Optional15499951
Ref: 8c315499951
Ref: library/typing typing Concatenate15501034
Ref: 9cb15501034
Ref: library/typing typing Literal15503507
Ref: a5915503507
Ref: library/typing typing ClassVar15505828
Ref: 56d15505828
Ref: library/typing typing Final15507178
Ref: 56e15507178
Ref: library/typing typing Required15507964
Ref: 7e015507964
Ref: library/typing typing NotRequired15508237
Ref: 7e115508237
Ref: library/typing typing ReadOnly15508499
Ref: 48a15508499
Ref: library/typing typing Annotated15509032
Ref: b3b15509032
Ref: library/typing typing TypeIs15514793
Ref: 48b15514793
Ref: library/typing typing TypeGuard15518588
Ref: 48c15518588
Ref: library/typing typing Unpack15521012
Ref: 1a0415521012
Ref: 特殊形式-Footnote-115522722
Ref: 特殊形式-Footnote-215522764
Ref: 特殊形式-Footnote-315522806
Ref: 特殊形式-Footnote-415522848
Ref: 特殊形式-Footnote-515522890
Ref: 特殊形式-Footnote-615522932
Ref: 特殊形式-Footnote-715522974
Ref: 特殊形式-Footnote-815523016
Ref: 特殊形式-Footnote-915523058
Ref: 特殊形式-Footnote-1015523100
Ref: 特殊形式-Footnote-1115523143
Node: Building generic types and type aliases15523186
Ref: library/typing building-generic-types-and-type-aliases15523349
Ref: 486e15523349
Ref: library/typing typing Generic15523860
Ref: 182315523860
Ref: library/typing typevar15525123
Ref: 486415525123
Ref: library/typing typing TypeVar15525123
Ref: 48615525123
Ref: library/typing typing-constrained-typevar15528656
Ref: 486a15528656
Ref: library/typing typing TypeVar __name__15529274
Ref: 486f15529274
Ref: library/typing typing TypeVar __covariant__15529346
Ref: 487015529346
Ref: library/typing typing TypeVar __contravariant__15529454
Ref: 487115529454
Ref: library/typing typing TypeVar __infer_variance__15529580
Ref: 487215529580
Ref: library/typing typing TypeVar __bound__15529749
Ref: 487315529749
Ref: library/typing typing TypeVar evaluate_bound15530112
Ref: 487415530112
Ref: library/typing typing TypeVar __constraints__15530636
Ref: 487715530636
Ref: library/typing typing TypeVar evaluate_constraints15531041
Ref: 487815531041
Ref: library/typing typing TypeVar __default__15531583
Ref: 487915531583
Ref: library/typing typing TypeVar evaluate_default15531765
Ref: 487a15531765
Ref: library/typing typing TypeVar has_default15532295
Ref: 487b15532295
Ref: library/typing typevartuple15532962
Ref: 486d15532962
Ref: library/typing typing TypeVarTuple15532962
Ref: 48815532962
Ref: library/typing typing TypeVarTuple __name__15537230
Ref: 487c15537230
Ref: library/typing typing TypeVarTuple __default__15537308
Ref: 487d15537308
Ref: library/typing typing TypeVarTuple evaluate_default15537496
Ref: 487e15537496
Ref: library/typing typing TypeVarTuple has_default15538026
Ref: 487f15538026
Ref: library/typing typing ParamSpec15538689
Ref: 48715538689
Ref: library/typing typing ParamSpec args15541185
Ref: 488115541185
Ref: library/typing typing ParamSpec kwargs15541211
Ref: 488215541211
Ref: library/typing typing ParamSpec __name__15541975
Ref: 488315541975
Ref: library/typing typing ParamSpec __default__15542057
Ref: 488415542057
Ref: library/typing typing ParamSpec evaluate_default15542249
Ref: 488515542249
Ref: library/typing typing ParamSpec has_default15542779
Ref: 488615542779
Ref: library/typing typing ParamSpecArgs15544167
Ref: 9cd15544167
Ref: library/typing typing ParamSpecKwargs15544203
Ref: 9ce15544203
Ref: library/typing typing TypeAliasType15544923
Ref: 2b015544923
Ref: library/typing typing TypeAliasType __name__15545216
Ref: 488715545216
Ref: library/typing typing TypeAliasType __module__15545379
Ref: 488815545379
Ref: library/typing typing TypeAliasType __type_params__15545581
Ref: 488915545581
Ref: library/typing typing TypeAliasType __value__15545952
Ref: 488a15545952
Ref: library/typing typing TypeAliasType evaluate_value15546510
Ref: 488b15546510
Ref: Building generic types and type aliases-Footnote-115548013
Ref: Building generic types and type aliases-Footnote-215548055
Ref: Building generic types and type aliases-Footnote-315548097
Ref: Building generic types and type aliases-Footnote-415548139
Ref: Building generic types and type aliases-Footnote-515548181
Ref: Building generic types and type aliases-Footnote-615548223
Ref: Building generic types and type aliases-Footnote-715548265
Node: Other special directives15548307
Ref: library/typing other-special-directives15548449
Ref: 488c15548449
Ref: library/typing typing NamedTuple15548675
Ref: 32f15548675
Ref: library/typing typing NewType15552543
Ref: ef515552543
Ref: library/typing typing NewType __module__15552993
Ref: 488d15552993
Ref: library/typing typing NewType __name__15553093
Ref: 488e15553093
Ref: library/typing typing NewType __supertype__15553160
Ref: 488f15553160
Ref: library/typing typing Protocol15553372
Ref: 56b15553372
Ref: library/typing typing runtime_checkable15554813
Ref: 67515554813
Ref: library/typing typing TypedDict15557492
Ref: 33015557492
Ref: library/typing typing TypedDict __total__15562338
Ref: 489015562338
Ref: library/typing typing TypedDict __required_keys__15563402
Ref: 489115563402
Ref: library/typing typing TypedDict __optional_keys__15563474
Ref: 489215563474
Ref: library/typing typing TypedDict __readonly_keys__15565288
Ref: 489315565288
Ref: library/typing typing TypedDict __mutable_keys__15565530
Ref: 489415565530
Ref: Other special directives-Footnote-115567085
Ref: Other special directives-Footnote-215567127
Ref: Other special directives-Footnote-315567169
Ref: Other special directives-Footnote-415567243
Node: プロトコル<4>15567285
Ref: library/typing protocols15567457
Ref: 489515567457
Ref: library/typing typing SupportsAbs15567626
Ref: 489615567626
Ref: library/typing typing SupportsBytes15567760
Ref: 80015567760
Ref: library/typing typing SupportsComplex15567856
Ref: 7ff15567856
Ref: library/typing typing SupportsFloat15567956
Ref: 489715567956
Ref: library/typing typing SupportsIndex15568052
Ref: c3e15568052
Ref: library/typing typing SupportsInt15568176
Ref: c3d15568176
Ref: library/typing typing SupportsRound15568268
Ref: 489815568268
Node: ABCs and Protocols for working with I/O15568406
Ref: library/typing abcs-and-protocols-for-working-with-i-o15568569
Ref: 489915568569
Ref: library/typing typing-io15568569
Ref: 31c415568569
Ref: library/typing typing IO15568670
Ref: 23a15568670
Ref: library/typing typing TextIO15568704
Ref: 23b15568704
Ref: library/typing typing BinaryIO15568733
Ref: 23c15568733
Node: Functions and decorators15569578
Ref: library/typing functions-and-decorators15569744
Ref: 489a15569744
Ref: library/typing typing cast15569815
Ref: 488015569815
Ref: library/typing typing assert_type15570214
Ref: 8bb15570214
Ref: library/typing typing assert_never15571306
Ref: 8b715571306
Ref: library/typing typing reveal_type15572732
Ref: 8ba15572732
Ref: library/typing typing dataclass_transform15573927
Ref: 6fb15573927
Ref: library/typing overload15579972
Ref: 485c15579972
Ref: library/typing typing overload15579972
Ref: 489b15579972
Ref: library/typing typing get_overloads15581521
Ref: 8be15581521
Ref: library/typing typing clear_overloads15582197
Ref: 8bf15582197
Ref: library/typing typing final15582398
Ref: 8bd15582398
Ref: library/typing typing no_type_check15583700
Ref: 8c415583700
Ref: library/typing typing no_type_check_decorator15584215
Ref: 33115584215
Ref: library/typing typing override15584692
Ref: 67d15584692
Ref: library/typing typing type_check_only15586037
Ref: 489c15586037
Ref: Functions and decorators-Footnote-115586887
Ref: Functions and decorators-Footnote-215586955
Ref: Functions and decorators-Footnote-315586997
Ref: Functions and decorators-Footnote-415587039
Ref: Functions and decorators-Footnote-515587081
Node: Introspection helpers15587123
Ref: library/typing introspection-helpers15587260
Ref: 489d15587260
Ref: library/typing typing get_type_hints15587325
Ref: 8c115587325
Ref: library/typing typing get_origin15590757
Ref: 2ad15590757
Ref: library/typing typing get_args15591613
Ref: 2ae15591613
Ref: library/typing typing get_protocol_members15592251
Ref: 56a15592251
Ref: library/typing typing is_protocol15592710
Ref: 56c15592710
Ref: library/typing typing is_typeddict15593270
Ref: a5a15593270
Ref: library/typing typing ForwardRef15593976
Ref: 1c3715593976
Ref: library/typing typing evaluate_forward_ref15594872
Ref: 187b15594872
Ref: library/typing typing NoDefault15595774
Ref: 56915595774
Ref: Introspection helpers-Footnote-115596167
Ref: Introspection helpers-Footnote-215596209
Node: 定数<11>15596251
Ref: library/typing constant15596391
Ref: 489f15596391
Ref: library/typing typing TYPE_CHECKING15596424
Ref: ef415596424
Ref: library/typing generic-concrete-collections15597813
Ref: 48a015597813
Ref: 定数<11>-Footnote-115597849
Node: 非推奨のエイリアス15597891
Ref: library/typing deprecated-aliases15598001
Ref: 48a115598001
Ref: library/typing id615598001
Ref: 48a215598001
Ref: 非推奨のエイリアス-Footnote-115599594
Node: Aliases to built-in types15599636
Ref: library/typing aliases-to-built-in-types15599765
Ref: 48a315599765
Ref: library/typing corresponding-to-built-in-types15599765
Ref: 48a415599765
Ref: library/typing typing Dict15599838
Ref: 48a515599838
Ref: library/typing typing List15600387
Ref: 48a615600387
Ref: library/typing typing Set15600959
Ref: 48a715600959
Ref: library/typing typing FrozenSet15601507
Ref: 48a815601507
Ref: library/typing typing Tuple15601880
Ref: 48a915601880
Ref: library/typing typing Type15602367
Ref: 486115602367
Ref: Aliases to built-in types-Footnote-115602924
Ref: Aliases to built-in types-Footnote-215602966
Ref: Aliases to built-in types-Footnote-315603008
Ref: Aliases to built-in types-Footnote-415603050
Ref: Aliases to built-in types-Footnote-515603092
Ref: Aliases to built-in types-Footnote-615603134
Node: Aliases to types in collections15603176
Ref: library/typing aliases-to-types-in-collections15603345
Ref: 48aa15603345
Ref: library/typing corresponding-to-types-in-collections15603345
Ref: 48ab15603345
Ref: library/typing typing DefaultDict15603438
Ref: 48ac15603438
Ref: library/typing typing OrderedDict15603899
Ref: 48ad15603899
Ref: library/typing typing ChainMap15604358
Ref: 48ae15604358
Ref: library/typing typing Counter15604805
Ref: 48af15604805
Ref: library/typing typing Deque15605230
Ref: 48b015605230
Ref: Aliases to types in collections-Footnote-115605674
Ref: Aliases to types in collections-Footnote-215605716
Ref: Aliases to types in collections-Footnote-315605758
Ref: Aliases to types in collections-Footnote-415605800
Ref: Aliases to types in collections-Footnote-515605842
Node: Aliases to other concrete types15605884
Ref: library/typing aliases-to-other-concrete-types15606072
Ref: 48b115606072
Ref: library/typing other-concrete-types15606072
Ref: 48b215606072
Ref: library/typing typing Pattern15606157
Ref: 93915606157
Ref: library/typing typing Match15606187
Ref: 48b315606187
Ref: library/typing typing Text15606794
Ref: 35e15606794
Ref: library/typing abstract-base-classes15607605
Ref: 48b415607605
Ref: Aliases to other concrete types-Footnote-115607641
Node: Aliases to container ABCs in collections abc15607683
Ref: library/typing aliases-to-container-abcs-in-collections-abc15607887
Ref: 48b515607887
Ref: library/typing corresponding-to-collections-in-collections-abc15607887
Ref: 48b615607887
Ref: library/typing typing AbstractSet15608006
Ref: 48b715608006
Ref: library/typing typing ByteString15608388
Ref: 34315608388
Ref: library/typing typing Collection15609464
Ref: ef315609464
Ref: library/typing typing Container15609907
Ref: 48b815609907
Ref: library/typing typing ItemsView15610296
Ref: 48b915610296
Ref: library/typing typing KeysView15610727
Ref: 48ba15610727
Ref: library/typing typing Mapping15611131
Ref: 48bb15611131
Ref: library/typing typing MappingView15611533
Ref: 48bc15611533
Ref: library/typing typing MutableMapping15611920
Ref: 48bd15611920
Ref: library/typing typing MutableSequence15612325
Ref: 48be15612325
Ref: library/typing typing MutableSet15612728
Ref: 48bf15612728
Ref: library/typing typing Sequence15613122
Ref: 48c015613122
Ref: library/typing typing ValuesView15613530
Ref: 48c115613530
Ref: Aliases to container ABCs in collections abc-Footnote-115613977
Ref: Aliases to container ABCs in collections abc-Footnote-215614019
Ref: Aliases to container ABCs in collections abc-Footnote-315614077
Ref: Aliases to container ABCs in collections abc-Footnote-415614119
Ref: Aliases to container ABCs in collections abc-Footnote-515614161
Ref: Aliases to container ABCs in collections abc-Footnote-615614203
Ref: Aliases to container ABCs in collections abc-Footnote-715614245
Ref: Aliases to container ABCs in collections abc-Footnote-815614287
Ref: Aliases to container ABCs in collections abc-Footnote-915614329
Ref: Aliases to container ABCs in collections abc-Footnote-1015614371
Ref: Aliases to container ABCs in collections abc-Footnote-1115614414
Ref: Aliases to container ABCs in collections abc-Footnote-1215614457
Ref: Aliases to container ABCs in collections abc-Footnote-1315614500
Node: Aliases to asynchronous ABCs in collections abc15614543
Ref: library/typing aliases-to-asynchronous-abcs-in-collections-abc15614756
Ref: 48c215614756
Ref: library/typing asynchronous-programming15614756
Ref: 48c315614756
Ref: library/typing typing Coroutine15614881
Ref: 1d8f15614881
Ref: library/typing typing AsyncGenerator15615535
Ref: 1a0215615535
Ref: library/typing typing AsyncIterable15616290
Ref: 48c415616290
Ref: library/typing typing AsyncIterator15616718
Ref: 48c515616718
Ref: library/typing typing Awaitable15617152
Ref: 48c615617152
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-115617605
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-215617647
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-315617689
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-415617731
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-515617773
Node: Aliases to other ABCs in collections abc15617815
Ref: library/typing aliases-to-other-abcs-in-collections-abc15618010
Ref: 48c715618010
Ref: library/typing corresponding-to-other-types-in-collections-abc15618010
Ref: 48c815618010
Ref: library/typing typing Iterable15618121
Ref: 48c915618121
Ref: library/typing typing Iterator15618507
Ref: 48ca15618507
Ref: library/typing typing Callable15618894
Ref: 9cc15618894
Ref: library/typing typing Generator15619666
Ref: 1a0115619666
Ref: library/typing typing Hashable15620388
Ref: 71715620388
Ref: library/typing typing Reversible15620630
Ref: 48cb15620630
Ref: library/typing typing Sized15621021
Ref: 71815621021
Ref: Aliases to other ABCs in collections abc-Footnote-115621290
Ref: Aliases to other ABCs in collections abc-Footnote-215621332
Ref: Aliases to other ABCs in collections abc-Footnote-315621374
Ref: Aliases to other ABCs in collections abc-Footnote-415621416
Ref: Aliases to other ABCs in collections abc-Footnote-515621458
Ref: Aliases to other ABCs in collections abc-Footnote-615621500
Node: Aliases to contextlib ABCs15621542
Ref: library/typing aliases-to-contextlib-abcs15621681
Ref: 48cc15621681
Ref: library/typing context-manager-types15621681
Ref: 48cd15621681
Ref: library/typing typing ContextManager15621764
Ref: e8f15621764
Ref: library/typing typing AsyncContextManager15622603
Ref: 19ff15622603
Ref: Aliases to contextlib ABCs-Footnote-115623505
Ref: Aliases to contextlib ABCs-Footnote-215623547
Node: メジャーな機能の非推奨時系列15623589
Ref: library/typing deprecation-timeline-of-major-features15623742
Ref: 48ce15623742
Ref: メジャーな機能の非推奨時系列-Footnote-115626616
Ref: メジャーな機能の非推奨時系列-Footnote-215626658
Ref: メジャーな機能の非推奨時系列-Footnote-315626713
Ref: メジャーな機能の非推奨時系列-Footnote-415626768
Ref: メジャーな機能の非推奨時系列-Footnote-515626823
Ref: メジャーな機能の非推奨時系列-Footnote-615626865
Ref: メジャーな機能の非推奨時系列-Footnote-715626921
Node: pydoc --- ドキュメント生成とオンラインヘルプシステム15626977
Ref: library/pydoc doc15627180
Ref: 48cf15627180
Ref: library/pydoc module-pydoc15627180
Ref: ba15627180
Ref: library/pydoc pydoc-documentation-generator-and-online-help-system15627180
Ref: 48d015627180
Ref: library/pydoc translation-repo15627180
Ref: 48d115627180
Ref: pydoc --- ドキュメント生成とオンラインヘルプシステム-Footnote-115633398
Node: Python 開発モード15633463
Ref: library/devmode doc15633684
Ref: 48d215633684
Ref: library/devmode devmode15633684
Ref: 50815633684
Ref: library/devmode python-development-mode15633684
Ref: 48d315633684
Ref: library/devmode translation-repo15633684
Ref: 48d415633684
Node: Python 開発モードの影響15634304
Ref: library/devmode effects-of-the-python-development-mode15634425
Ref: 48d515634425
Node: ResourceWarning の例15638198
Ref: library/devmode resourcewarning-example15638361
Ref: 48d615638361
Node: Bad file descriptor error example15640299
Ref: library/devmode bad-file-descriptor-error-example15640422
Ref: 48d715640422
Ref: Bad file descriptor error example-Footnote-115641966
Node: doctest --- 対話型の Python の例をテストする15642031
Ref: library/doctest doc15642234
Ref: 48d815642234
Ref: library/doctest doctest-test-interactive-python-examples15642234
Ref: 48d915642234
Ref: library/doctest module-doctest15642234
Ref: 3e15642234
Ref: library/doctest translation-repo15642234
Ref: 48da15642234
Ref: doctest --- 対話型の Python の例をテストする-Footnote-115646888
Node: 簡単な利用法 docstring 中の実行例をチェックする15646955
Ref: library/doctest doctest-simple-testmod15647201
Ref: 48db15647201
Ref: library/doctest simple-usage-checking-examples-in-docstrings15647201
Ref: 48dc15647201
Node: 簡単な利用法 テキストファイル中の実行例をチェックする15649051
Ref: library/doctest doctest-simple-testfile15649342
Ref: 48df15649342
Ref: library/doctest simple-usage-checking-examples-in-a-text-file15649342
Ref: 48e015649342
Node: コマンドラインでの使用<6>15651924
Ref: library/doctest command-line-usage15652173
Ref: 48e215652173
Ref: library/doctest doctest-cli15652173
Ref: 48dd15652173
Ref: library/doctest cmdoption-doctest-v15652387
Ref: 48e315652387
Ref: library/doctest cmdoption-doctest-verbose15652387
Ref: 48e415652387
Ref: library/doctest cmdoption-doctest-o15653135
Ref: 48e515653135
Ref: library/doctest cmdoption-doctest-option15653135
Ref: 48e615653135
Ref: library/doctest cmdoption-doctest-f15653319
Ref: 48e715653319
Ref: library/doctest cmdoption-doctest-fail-fast15653319
Ref: 48e815653319
Node: doctest のからくり15653424
Ref: library/doctest doctest-how-it-works15653604
Ref: 48e915653604
Ref: library/doctest how-it-works15653604
Ref: 48ea15653604
Node: どの docstring が検証されるのか?15654595
Ref: library/doctest doctest-which-docstrings15654768
Ref: 48eb15654768
Ref: library/doctest which-docstrings-are-examined15654768
Ref: 48ec15654768
Ref: library/doctest module __test__15655070
Ref: 48ed15655070
Node: docstring 内の実行例をどのように認識するのか?15656766
Ref: library/doctest doctest-finding-examples15656985
Ref: 48ee15656985
Ref: library/doctest how-are-docstring-examples-recognized15656985
Ref: 48ef15656985
Node: 実行コンテキストとは何か?15660953
Ref: library/doctest doctest-execution-context15661164
Ref: 48f315661164
Ref: library/doctest what-s-the-execution-context15661164
Ref: 48f415661164
Node: 例外はどう扱えばよいか?15661888
Ref: library/doctest doctest-exceptions15662061
Ref: 48f515662061
Ref: library/doctest what-about-exceptions15662061
Ref: 48f615662061
Ref: library/doctest option-flags-and-directives15667997
Ref: 48f715667997
Ref: 例外はどう扱えばよいか?-Footnote-115668034
Node: オプションフラグ15668309
Ref: library/doctest doctest-options15668477
Ref: 113815668477
Ref: library/doctest option-flags15668477
Ref: 48f815668477
Ref: library/doctest doctest DONT_ACCEPT_TRUE_FOR_115669330
Ref: 48f915669330
Ref: library/doctest doctest DONT_ACCEPT_BLANKLINE15670271
Ref: 48fa15670271
Ref: library/doctest doctest NORMALIZE_WHITESPACE15670902
Ref: 48f015670902
Ref: library/doctest doctest ELLIPSIS15671512
Ref: 168c15671512
Ref: library/doctest doctest IGNORE_EXCEPTION_DETAIL15672147
Ref: 152415672147
Ref: library/doctest doctest SKIP15673684
Ref: 48fb15673684
Ref: library/doctest doctest COMPARISON_FLAGS15674357
Ref: 48fc15674357
Ref: library/doctest doctest REPORT_UDIFF15674585
Ref: 168d15674585
Ref: library/doctest doctest REPORT_CDIFF15674826
Ref: 168e15674826
Ref: library/doctest doctest REPORT_NDIFF15675067
Ref: 168f15675067
Ref: library/doctest doctest REPORT_ONLY_FIRST_FAILURE15675783
Ref: 48fd15675783
Ref: library/doctest doctest FAIL_FAST15676656
Ref: 113915676656
Ref: library/doctest doctest REPORTING_FLAGS15677069
Ref: 48fe15677069
Ref: library/doctest doctest register_optionflag15677377
Ref: 48ff15677377
Node: ディレクティブ Directives15677957
Ref: library/doctest directives15678100
Ref: 490215678100
Ref: library/doctest doctest-directives15678100
Ref: 48f115678100
Ref: library/doctest grammar-token-doctest-directive15678436
Ref: 490315678436
Ref: library/doctest grammar-token-doctest-directive_options15678510
Ref: 490415678510
Ref: library/doctest grammar-token-doctest-directive_option15678605
Ref: 490515678605
Ref: library/doctest grammar-token-doctest-on_or_off15678691
Ref: 490615678691
Ref: library/doctest grammar-token-doctest-directive_option_name15678729
Ref: 490715678729
Node: 警告<2>15681365
Ref: library/doctest doctest-warnings15681475
Ref: 490815681475
Ref: library/doctest warnings15681475
Ref: 490915681475
Node: 基本 API15683493
Ref: library/doctest basic-api15683656
Ref: 490a15683656
Ref: library/doctest doctest-basic-api15683656
Ref: 48de15683656
Ref: library/doctest doctest testfile15684175
Ref: 48e115684175
Ref: library/doctest doctest testmod15689855
Ref: 168b15689855
Ref: library/doctest doctest run_docstring_examples15692116
Ref: 490c15692116
Node: 単体テスト API15693413
Ref: library/doctest doctest-unittest-api15693563
Ref: 490d15693563
Ref: library/doctest unittest-api15693563
Ref: 490e15693563
Ref: library/doctest doctest DocFileSuite15694384
Ref: 491015694384
Ref: library/doctest doctest DocTestSuite15699492
Ref: ff815699492
Ref: library/doctest doctest set_unittest_reportflags15703195
Ref: 491315703195
Node: 拡張 API15704456
Ref: library/doctest advanced-api15704608
Ref: 491415704608
Ref: library/doctest doctest-advanced-api15704608
Ref: 491515704608
Node: DocTest オブジェクト15707177
Ref: library/doctest doctest-doctest15707285
Ref: 491715707285
Ref: library/doctest doctest-objects15707285
Ref: 491815707285
Ref: library/doctest doctest DocTest15707354
Ref: 1a8b15707354
Ref: library/doctest doctest DocTest examples15707869
Ref: 491915707869
Ref: library/doctest doctest DocTest globs15708114
Ref: 491215708114
Ref: library/doctest doctest DocTest name15708558
Ref: 491a15708558
Ref: library/doctest doctest DocTest filename15708778
Ref: 491b15708778
Ref: library/doctest doctest DocTest lineno15709001
Ref: 183215709001
Ref: library/doctest doctest DocTest docstring15709299
Ref: 491c15709299
Node: Example オブジェクト15709589
Ref: library/doctest doctest-example15709738
Ref: 491d15709738
Ref: library/doctest example-objects15709738
Ref: 491e15709738
Ref: library/doctest doctest Example15709807
Ref: 491615709807
Ref: library/doctest doctest Example source15710379
Ref: 491f15710379
Ref: library/doctest doctest Example want15710643
Ref: 492015710643
Ref: library/doctest doctest Example exc_msg15711135
Ref: 492115711135
Ref: library/doctest doctest Example lineno15711676
Ref: 492215711676
Ref: library/doctest doctest Example indent15711871
Ref: 492315711871
Ref: library/doctest doctest Example options15712072
Ref: 492415712072
Node: DocTestFinder オブジェクト15712483
Ref: library/doctest doctest-doctestfinder15712638
Ref: 492515712638
Ref: library/doctest doctestfinder-objects15712638
Ref: 492615712638
Ref: library/doctest doctest DocTestFinder15712719
Ref: 1a0615712719
Ref: library/doctest doctest DocTestFinder find15714224
Ref: 1ad015714224
Node: DocTestParser オブジェクト15717013
Ref: library/doctest doctest-doctestparser15717161
Ref: 492715717161
Ref: library/doctest doctestparser-objects15717161
Ref: 492815717161
Ref: library/doctest doctest DocTestParser15717242
Ref: 48f215717242
Ref: library/doctest doctest DocTestParser get_doctest15717553
Ref: 492915717553
Ref: library/doctest doctest DocTestParser get_examples15717976
Ref: 492a15717976
Ref: library/doctest doctest DocTestParser parse15718421
Ref: 492b15718421
Node: TestResults objects15718815
Ref: library/doctest testresults-objects15718963
Ref: 492c15718963
Ref: library/doctest doctest TestResults15719024
Ref: 492d15719024
Ref: library/doctest doctest TestResults failed15719080
Ref: 492e15719080
Ref: library/doctest doctest TestResults attempted15719143
Ref: 492f15719143
Ref: library/doctest doctest TestResults skipped15719212
Ref: 4f015719212
Node: DocTestRunner オブジェクト15719311
Ref: library/doctest doctest-doctestrunner15719459
Ref: 493015719459
Ref: library/doctest doctestrunner-objects15719459
Ref: 493115719459
Ref: library/doctest doctest DocTestRunner15719540
Ref: 490115719540
Ref: library/doctest doctest DocTestRunner report_start15722375
Ref: 493215722375
Ref: library/doctest doctest DocTestRunner report_success15722960
Ref: 493315722960
Ref: library/doctest doctest DocTestRunner report_failure15723637
Ref: 493515723637
Ref: library/doctest doctest DocTestRunner report_unexpected_exception15724323
Ref: 493415724323
Ref: library/doctest doctest DocTestRunner run15725146
Ref: 4ee15725146
Ref: library/doctest doctest DocTestRunner summarize15726343
Ref: 490b15726343
Ref: library/doctest doctest DocTestRunner tries15726866
Ref: 493615726866
Ref: library/doctest doctest DocTestRunner failures15726934
Ref: 493715726934
Ref: library/doctest doctest DocTestRunner skips15727002
Ref: 4ef15727002
Node: OutputChecker オブジェクト15727102
Ref: library/doctest doctest-outputchecker15727222
Ref: 493815727222
Ref: library/doctest outputchecker-objects15727222
Ref: 493915727222
Ref: library/doctest doctest OutputChecker15727303
Ref: 490015727303
Ref: library/doctest doctest OutputChecker check_output15727930
Ref: 493a15727930
Ref: library/doctest doctest OutputChecker output_difference15728613
Ref: 493b15728613
Node: デバッグ15729004
Ref: library/doctest debugging15729152
Ref: 493c15729152
Ref: library/doctest doctest-debugging15729152
Ref: 493d15729152
Ref: library/doctest doctest script_from_examples15731672
Ref: 494015731672
Ref: library/doctest doctest testsource15732755
Ref: 494115732755
Ref: library/doctest doctest debug15733578
Ref: 493f15733578
Ref: library/doctest doctest debug_src15734914
Ref: 494315734914
Ref: library/doctest doctest DebugRunner15736029
Ref: 493e15736029
Ref: library/doctest doctest DocTestFailure15737040
Ref: 494515737040
Ref: library/doctest doctest DocTestFailure test15737471
Ref: 494615737471
Ref: library/doctest doctest DocTestFailure example15737620
Ref: 494715737620
Ref: library/doctest doctest DocTestFailure got15737727
Ref: 494815737727
Ref: library/doctest doctest UnexpectedException15737805
Ref: 494415737805
Ref: library/doctest doctest UnexpectedException test15738226
Ref: 494915738226
Ref: library/doctest doctest UnexpectedException example15738380
Ref: 494a15738380
Ref: library/doctest doctest UnexpectedException exc_info15738492
Ref: 494b15738492
Node: アドバイス15738682
Ref: library/doctest doctest-soapbox15738811
Ref: 494c15738811
Ref: library/doctest soapbox15738811
Ref: 494d15738811
Node: unittest --- ユニットテストフレームワーク15743618
Ref: library/unittest doc15743859
Ref: 494e15743859
Ref: library/unittest module-unittest15743859
Ref: 10d15743859
Ref: library/unittest translation-repo15743859
Ref: 494f15743859
Ref: library/unittest unittest-unit-testing-framework15743859
Ref: 495015743859
Ref: unittest --- ユニットテストフレームワーク-Footnote-115747889
Ref: unittest --- ユニットテストフレームワーク-Footnote-215747967
Ref: unittest --- ユニットテストフレームワーク-Footnote-315748060
Ref: unittest --- ユニットテストフレームワーク-Footnote-415748093
Ref: unittest --- ユニットテストフレームワーク-Footnote-515748157
Ref: unittest --- ユニットテストフレームワーク-Footnote-615748215
Ref: unittest --- ユニットテストフレームワーク-Footnote-715748245
Ref: unittest --- ユニットテストフレームワーク-Footnote-815748277
Ref: unittest --- ユニットテストフレームワーク-Footnote-915748321
Node: 基本的な例<2>15748355
Ref: library/unittest basic-example15748522
Ref: 495215748522
Ref: library/unittest unittest-minimal-example15748522
Ref: 495315748522
Node: コマンドラインインターフェイス<2>15751838
Ref: library/unittest command-line-interface15752041
Ref: 495515752041
Ref: library/unittest unittest-command-line-interface15752041
Ref: 113a15752041
Node: コマンドラインオプション<5>15754170
Ref: library/unittest command-line-options15754294
Ref: 495715754294
Ref: library/unittest cmdoption-unittest-b15754459
Ref: 154d15754459
Ref: library/unittest cmdoption-unittest-buffer15754459
Ref: 495815754459
Ref: library/unittest cmdoption-unittest-c15754810
Ref: 154e15754810
Ref: library/unittest cmdoption-unittest-catch15754810
Ref: 495915754810
Ref: library/unittest cmdoption-unittest-f15755223
Ref: 155015755223
Ref: library/unittest cmdoption-unittest-failfast15755223
Ref: 495b15755223
Ref: library/unittest cmdoption-unittest-k15755333
Ref: 495c15755333
Ref: library/unittest cmdoption-unittest-locals15756285
Ref: 495d15756285
Ref: library/unittest cmdoption-unittest-durations15756374
Ref: 495e15756374
Node: テストディスカバリ15757005
Ref: library/unittest test-discovery15757217
Ref: 495f15757217
Ref: library/unittest unittest-test-discovery15757217
Ref: 495615757217
Ref: library/unittest cmdoption-unittest-discover-v15758408
Ref: 496015758408
Ref: library/unittest cmdoption-unittest-discover-verbose15758408
Ref: 496115758408
Ref: library/unittest cmdoption-unittest-discover-s15758457
Ref: 496215758457
Ref: library/unittest cmdoption-unittest-discover-start-directory15758457
Ref: 496315758457
Ref: library/unittest cmdoption-unittest-discover-p15758589
Ref: 496415758589
Ref: library/unittest cmdoption-unittest-discover-pattern15758589
Ref: 496515758589
Ref: library/unittest cmdoption-unittest-discover-t15758718
Ref: 496615758718
Ref: library/unittest cmdoption-unittest-discover-top-level-directory15758718
Ref: 496715758718
Node: テストコードの構成15761494
Ref: library/unittest organizing-test-code15761694
Ref: 496915761694
Ref: library/unittest organizing-tests15761694
Ref: 495415761694
Node: 既存テストコードの再利用15767278
Ref: library/unittest legacy-unit-tests15767499
Ref: 496a15767499
Ref: library/unittest re-using-old-test-code15767499
Ref: 496b15767499
Node: テストのスキップと予期された失敗15769170
Ref: library/unittest skipping-tests-and-expected-failures15769436
Ref: 496c15769436
Ref: library/unittest unittest-skipping15769436
Ref: 496d15769436
Ref: library/unittest unittest skip15773089
Ref: 1e1a15773089
Ref: library/unittest unittest skipIf15773283
Ref: 497015773283
Ref: library/unittest unittest skipUnless15773430
Ref: 497115773430
Ref: library/unittest unittest expectedFailure15773581
Ref: 496f15773581
Ref: library/unittest unittest SkipTest15773985
Ref: 11ea15773985
Node: サブテストを利用して繰り返しテストの区別を付ける15774700
Ref: library/unittest distinguishing-test-iterations-using-subtests15774948
Ref: 497215774948
Ref: library/unittest subtests15774948
Ref: 11e815774948
Node: クラスと関数15777656
Ref: library/unittest classes-and-functions15777904
Ref: 497315777904
Ref: library/unittest unittest-contents15777904
Ref: 497415777904
Node: テストクラス15778115
Ref: library/unittest test-cases15778224
Ref: 497515778224
Ref: library/unittest testcase-objects15778224
Ref: 497615778224
Ref: library/unittest unittest TestCase15778277
Ref: 2b515778277
Ref: library/unittest unittest TestCase setUp15779926
Ref: 155515779926
Ref: library/unittest unittest TestCase tearDown15780383
Ref: 155615780383
Ref: library/unittest unittest TestCase setUpClass15781293
Ref: c4715781293
Ref: library/unittest unittest TestCase tearDownClass15781869
Ref: 155315781869
Ref: library/unittest unittest TestCase run15782465
Ref: 138215782465
Ref: library/unittest unittest TestCase skipTest15783391
Ref: 496e15783391
Ref: library/unittest unittest TestCase subTest15783728
Ref: 11e715783728
Ref: library/unittest unittest TestCase debug15784473
Ref: 1ca615784473
Ref: library/unittest assert-methods15784711
Ref: 495115784711
Ref: library/unittest unittest TestCase assertEqual15789306
Ref: 74c15789306
Ref: library/unittest unittest TestCase assertNotEqual15790349
Ref: 74d15790349
Ref: library/unittest unittest TestCase assertTrue15790560
Ref: 74a15790560
Ref: library/unittest unittest TestCase assertFalse15790611
Ref: 74b15790611
Ref: library/unittest unittest TestCase assertIs15791365
Ref: 155715791365
Ref: library/unittest unittest TestCase assertIsNot15791423
Ref: 155815791423
Ref: library/unittest unittest TestCase assertIsNone15791662
Ref: 14a615791662
Ref: library/unittest unittest TestCase assertIsNotNone15791715
Ref: 14a715791715
Ref: library/unittest unittest TestCase assertIn15791926
Ref: 156015791926
Ref: library/unittest unittest TestCase assertNotIn15791988
Ref: 156115791988
Ref: library/unittest unittest TestCase assertIsInstance15792213
Ref: 155915792213
Ref: library/unittest unittest TestCase assertNotIsInstance15792274
Ref: 155a15792274
Ref: library/unittest unittest TestCase assertIsSubclass15792807
Ref: 2b815792807
Ref: library/unittest unittest TestCase assertNotIsSubclass15792875
Ref: 2b915792875
Ref: library/unittest unittest TestCase assertRaises15796252
Ref: 75015796252
Ref: library/unittest unittest TestCase assertRaisesRegex15798478
Ref: 75215798478
Ref: library/unittest unittest TestCase assertWarns15799680
Ref: 138015799680
Ref: library/unittest unittest TestCase assertWarnsRegex15801874
Ref: 138115801874
Ref: library/unittest unittest TestCase assertLogs15802963
Ref: a5d15802963
Ref: library/unittest unittest TestCase records15804374
Ref: 497a15804374
Ref: library/unittest unittest TestCase output15804547
Ref: 497b15804547
Ref: library/unittest unittest TestCase assertNoLogs15805151
Ref: a5c15805151
Ref: library/unittest unittest TestCase assertAlmostEqual15810486
Ref: 74e15810486
Ref: library/unittest unittest TestCase assertNotAlmostEqual15810590
Ref: 74f15810590
Ref: library/unittest unittest TestCase assertGreater15811902
Ref: 155b15811902
Ref: library/unittest unittest TestCase assertGreaterEqual15811965
Ref: 155c15811965
Ref: library/unittest unittest TestCase assertLess15812033
Ref: 155d15812033
Ref: library/unittest unittest TestCase assertLessEqual15812093
Ref: 155e15812093
Ref: library/unittest unittest TestCase assertRegex15812537
Ref: 75115812537
Ref: library/unittest unittest TestCase assertNotRegex15812596
Ref: 75315812596
Ref: library/unittest unittest TestCase assertCountEqual15813539
Ref: 144615813539
Ref: library/unittest unittest TestCase assertStartsWith15814401
Ref: 2ba15814401
Ref: library/unittest unittest TestCase assertNotStartsWith15814464
Ref: 2bb15814464
Ref: library/unittest unittest TestCase assertEndsWith15814729
Ref: 2bc15814729
Ref: library/unittest unittest TestCase assertNotEndsWith15814790
Ref: 2bd15814790
Ref: library/unittest unittest TestCase assertHasAttr15815049
Ref: 2b615815049
Ref: library/unittest unittest TestCase assertNotHasAttr15815109
Ref: 2b715815109
Ref: library/unittest type-specific-methods15815292
Ref: 497915815292
Ref: library/unittest unittest TestCase addTypeEqualityFunc15815731
Ref: 156415815731
Ref: library/unittest unittest TestCase assertMultiLineEqual15818858
Ref: 155f15818858
Ref: library/unittest unittest TestCase assertSequenceEqual15819368
Ref: 14a515819368
Ref: library/unittest unittest TestCase assertListEqual15820097
Ref: 14a315820097
Ref: library/unittest unittest TestCase assertTupleEqual15820162
Ref: 14a415820162
Ref: library/unittest unittest TestCase assertSetEqual15820708
Ref: 14a115820708
Ref: library/unittest unittest TestCase assertDictEqual15821276
Ref: 14a215821276
Ref: library/unittest other-methods-and-attrs15821681
Ref: 497c15821681
Ref: library/unittest unittest TestCase fail15821774
Ref: 497d15821774
Ref: library/unittest unittest TestCase failureException15821968
Ref: 491115821968
Ref: library/unittest unittest TestCase longMessage15822370
Ref: 155115822370
Ref: library/unittest unittest TestCase maxDiff15823338
Ref: 144715823338
Ref: library/unittest unittest TestCase countTestCases15824121
Ref: 497e15824121
Ref: library/unittest unittest TestCase defaultTestResult15824336
Ref: 497815824336
Ref: library/unittest unittest TestCase id15824909
Ref: 497f15824909
Ref: library/unittest unittest TestCase shortDescription15825144
Ref: 498015825144
Ref: library/unittest unittest TestCase addCleanup15825846
Ref: c7815825846
Ref: library/unittest unittest TestCase enterContext15826595
Ref: 8c915826595
Ref: library/unittest unittest TestCase doCleanups15826930
Ref: 155415826930
Ref: library/unittest unittest TestCase addClassCleanup15827728
Ref: c4515827728
Ref: library/unittest unittest TestCase enterClassContext15828528
Ref: 8ca15828528
Ref: library/unittest unittest TestCase doClassCleanups15828885
Ref: 498115828885
Ref: library/unittest unittest IsolatedAsyncioTestCase15829734
Ref: 35f15829734
Ref: library/unittest unittest IsolatedAsyncioTestCase loop_factory15829974
Ref: 498215829974
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncSetUp15830230
Ref: 498315830230
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncTearDown15830832
Ref: 498415830832
Ref: library/unittest unittest IsolatedAsyncioTestCase addAsyncCleanup15831840
Ref: 498515831840
Ref: library/unittest unittest IsolatedAsyncioTestCase enterAsyncContext15832045
Ref: 8cb15832045
Ref: library/unittest unittest IsolatedAsyncioTestCase run15832412
Ref: 498615832412
Ref: library/unittest unittest FunctionTestCase15834374
Ref: 1ada15834374
Node: テストのグループ化15834850
Ref: library/unittest grouping-tests15834998
Ref: 498715834998
Ref: library/unittest testsuite-objects15834998
Ref: 498815834998
Ref: library/unittest unittest TestSuite15835066
Ref: ff915835066
Ref: library/unittest unittest TestSuite addTest15836355
Ref: 498915836355
Ref: library/unittest unittest TestSuite addTests15836524
Ref: 498a15836524
Ref: library/unittest unittest TestSuite run15837034
Ref: 498b15837034
Ref: library/unittest unittest TestSuite debug15837385
Ref: 498c15837385
Ref: library/unittest unittest TestSuite countTestCases15837731
Ref: 498d15837731
Ref: library/unittest unittest TestSuite __iter__15837964
Ref: 122e15837964
Node: テストのロードと起動15839900
Ref: library/unittest loading-and-running-tests15840021
Ref: 498e15840021
Ref: library/unittest unittest TestLoader15840094
Ref: 59315840094
Ref: library/unittest unittest TestLoader errors15840597
Ref: 109015840597
Ref: library/unittest unittest TestLoader loadTestsFromTestCase15841201
Ref: 59515841201
Ref: library/unittest unittest TestLoader loadTestsFromModule15841903
Ref: 59415841903
Ref: library/unittest unittest TestLoader loadTestsFromName15843674
Ref: 156215843674
Ref: library/unittest unittest TestLoader loadTestsFromNames15845778
Ref: 499015845778
Ref: library/unittest unittest TestLoader getTestCaseNames15846166
Ref: 59615846166
Ref: library/unittest unittest TestLoader discover15846453
Ref: 11eb15846453
Ref: library/unittest unittest TestLoader testMethodPrefix15850753
Ref: 499115850753
Ref: library/unittest unittest TestLoader sortTestMethodsUsing15851093
Ref: 499215851093
Ref: library/unittest unittest TestLoader suiteClass15851310
Ref: 156315851310
Ref: library/unittest unittest TestLoader testNamePatterns15851672
Ref: 499315851672
Ref: library/unittest unittest TestResult15852721
Ref: 138315852721
Ref: library/unittest unittest TestResult errors15853657
Ref: 499415853657
Ref: library/unittest unittest TestResult failures15853950
Ref: 499515853950
Ref: library/unittest unittest TestResult skipped15854298
Ref: 499615854298
Ref: library/unittest unittest TestResult expectedFailures15854534
Ref: 499715854534
Ref: library/unittest unittest TestResult unexpectedSuccesses15854840
Ref: 499815854840
Ref: library/unittest unittest TestResult collectedDurations15855030
Ref: 1add15855030
Ref: library/unittest unittest TestResult shouldStop15855240
Ref: 499915855240
Ref: library/unittest unittest TestResult testsRun15855396
Ref: 499b15855396
Ref: library/unittest unittest TestResult buffer15855492
Ref: 499c15855492
Ref: library/unittest unittest TestResult failfast15856064
Ref: 499f15856064
Ref: library/unittest unittest TestResult tb_locals15856288
Ref: 49a015856288
Ref: library/unittest unittest TestResult wasSuccessful15856439
Ref: 49a115856439
Ref: library/unittest unittest TestResult stop15856863
Ref: 499a15856863
Ref: library/unittest unittest TestResult startTest15858004
Ref: 499d15858004
Ref: library/unittest unittest TestResult stopTest15858112
Ref: 499e15858112
Ref: library/unittest unittest TestResult startTestRun15858246
Ref: 156515858246
Ref: library/unittest unittest TestResult stopTestRun15858406
Ref: 156615858406
Ref: library/unittest unittest TestResult addError15858565
Ref: 1ca915858565
Ref: library/unittest unittest TestResult addFailure15859139
Ref: 1ca815859139
Ref: library/unittest unittest TestResult addSuccess15859692
Ref: 49a215859692
Ref: library/unittest unittest TestResult addSkip15859883
Ref: 1caa15859883
Ref: library/unittest unittest TestResult addExpectedFailure15860249
Ref: 49a315860249
Ref: library/unittest unittest TestResult addUnexpectedSuccess15860754
Ref: 49a415860754
Ref: library/unittest unittest TestResult addSubTest15861097
Ref: 1cab15861097
Ref: library/unittest unittest TestResult addDuration15861882
Ref: 1b1915861882
Ref: library/unittest unittest TextTestResult15862134
Ref: 75415862134
Ref: library/unittest unittest defaultTestLoader15862570
Ref: 498f15862570
Ref: library/unittest unittest TextTestRunner15862890
Ref: 1b1815862890
Ref: library/unittest unittest TextTestRunner _makeResult15864649
Ref: 49a615864649
Ref: library/unittest unittest TextTestRunner run15865535
Ref: 49a715865535
Ref: library/unittest unittest main15866022
Ref: 11e915866022
Node: load_tests プロトコル15869521
Ref: library/unittest id115869614
Ref: 496815869614
Ref: library/unittest load-tests-protocol15869614
Ref: 490f15869614
Node: クラスとモジュールのフィクスチャ15872929
Ref: library/unittest class-and-module-fixtures15873135
Ref: 497715873135
Node: setUpClass と tearDownClass15875604
Ref: library/unittest setupclass-and-teardownclass15875756
Ref: 49a815875756
Node: setUpModule と tearDownModule15876795
Ref: library/unittest setupmodule-and-teardownmodule15876947
Ref: 49a915876947
Ref: library/unittest unittest setUpModule15877029
Ref: c4615877029
Ref: library/unittest unittest addModuleCleanup15877682
Ref: c4415877682
Ref: library/unittest unittest enterModuleContext15878416
Ref: 8cc15878416
Ref: library/unittest unittest doModuleCleanups15878739
Ref: 1c3015878739
Node: シグナルハンドリング15879529
Ref: library/unittest signal-handling15879708
Ref: 495a15879708
Ref: library/unittest unittest installHandler15881317
Ref: 49aa15881317
Ref: library/unittest unittest registerResult15881624
Ref: 49ab15881624
Ref: library/unittest unittest removeResult15882225
Ref: 49ac15882225
Ref: library/unittest unittest removeHandler15882502
Ref: 154f15882502
Node: unittest mock --- モックオブジェクトライブラリ15883010
Ref: library/unittest mock doc15883219
Ref: 49ad15883219
Ref: library/unittest mock module-unittest mock15883219
Ref: 10e15883219
Ref: library/unittest mock translation-repo15883219
Ref: 49ae15883219
Ref: library/unittest mock unittest-mock-mock-object-library15883219
Ref: 49af15883219
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-115885067
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-215885140
Node: クイックガイド15885179
Ref: library/unittest mock quick-guide15885320
Ref: 49b015885320
Node: Mock クラス15891594
Ref: library/unittest mock the-mock-class15891751
Ref: 49b515891751
Ref: library/unittest mock unittest mock Mock15893038
Ref: c4315893038
Ref: library/unittest mock unittest mock Mock assert_called15897395
Ref: ef815897395
Ref: library/unittest mock unittest mock Mock assert_called_once15897734
Ref: ef915897734
Ref: library/unittest mock unittest mock Mock assert_called_with15898408
Ref: 1e6015898408
Ref: library/unittest mock unittest mock Mock assert_called_once_with15898798
Ref: 49bb15898798
Ref: library/unittest mock unittest mock Mock assert_any_call15899517
Ref: 49bc15899517
Ref: library/unittest mock unittest mock Mock assert_has_calls15900172
Ref: 1a8415900172
Ref: library/unittest mock unittest mock Mock assert_not_called15901212
Ref: 109215901212
Ref: library/unittest mock unittest mock Mock reset_mock15901729
Ref: efa15901729
Ref: library/unittest mock unittest mock Mock mock_add_spec15903375
Ref: 49be15903375
Ref: library/unittest mock unittest mock Mock attach_mock15903785
Ref: 19b515903785
Ref: library/unittest mock unittest mock Mock configure_mock15904083
Ref: 49ba15904083
Ref: library/unittest mock unittest mock Mock __dir__15905371
Ref: 49c015905371
Ref: library/unittest mock unittest mock Mock _get_child_mock15905818
Ref: 49c215905818
Ref: library/unittest mock unittest mock Mock called15906377
Ref: 49c315906377
Ref: library/unittest mock unittest mock Mock call_count15906661
Ref: 17f315906661
Ref: library/unittest mock unittest mock Mock return_value15906988
Ref: 49b915906988
Ref: library/unittest mock unittest mock Mock side_effect15907833
Ref: 49b115907833
Ref: library/unittest mock unittest mock Mock call_args15910497
Ref: 1dc715910497
Ref: library/unittest mock unittest mock Mock call_args_list15912465
Ref: 49c415912465
Ref: library/unittest mock unittest mock Mock method_calls15913716
Ref: 49bf15913716
Ref: library/unittest mock unittest mock Mock mock_calls15914543
Ref: 49bd15914543
Ref: library/unittest mock unittest mock Mock __class__15916247
Ref: 49c615916247
Ref: library/unittest mock unittest mock NonCallableMock15917084
Ref: 49b615917084
Ref: library/unittest mock unittest mock PropertyMock15919961
Ref: 49c715919961
Ref: library/unittest mock unittest mock AsyncMock15922065
Ref: c4215922065
Ref: library/unittest mock unittest mock AsyncMock assert_awaited15924877
Ref: 49c815924877
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once15925618
Ref: 49c915925618
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_with15926182
Ref: 49ca15926182
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once_with15926858
Ref: 49cb15926858
Ref: library/unittest mock unittest mock AsyncMock assert_any_await15927589
Ref: 49cc15927589
Ref: library/unittest mock unittest mock AsyncMock assert_has_awaits15928238
Ref: 49cd15928238
Ref: library/unittest mock unittest mock AsyncMock assert_not_awaited15929339
Ref: 49ce15929339
Ref: library/unittest mock unittest mock AsyncMock reset_mock15929520
Ref: 49cf15929520
Ref: library/unittest mock unittest mock AsyncMock await_count15929757
Ref: 49d015929757
Ref: library/unittest mock unittest mock AsyncMock await_args15930203
Ref: 49d115930203
Ref: library/unittest mock unittest mock AsyncMock await_args_list15930822
Ref: 1dc615930822
Ref: library/unittest mock unittest mock ThreadingMock15931534
Ref: 179315931534
Ref: library/unittest mock unittest mock ThreadingMock wait_until_called15932239
Ref: 49d315932239
Ref: library/unittest mock unittest mock ThreadingMock wait_until_any_call_with15932798
Ref: 49d415932798
Ref: library/unittest mock unittest mock ThreadingMock DEFAULT_TIMEOUT15933403
Ref: 49d215933403
Ref: Mock クラス-Footnote-115933729
Node: 呼び出し15934260
Ref: library/unittest mock calling15934347
Ref: 49d515934347
Node: 属性の削除15937907
Ref: library/unittest mock deleting-attributes15938032
Ref: 49d615938032
Ref: library/unittest mock id215938032
Ref: 49d715938032
Node: Mock の名前と name 属性15938859
Ref: library/unittest mock mock-names-and-the-name-attribute15939011
Ref: 49d815939011
Node: 属性として設定されるモック15939688
Ref: library/unittest mock attaching-mocks-as-attributes15939816
Ref: 49d915939816
Node: patcher15941823
Ref: library/unittest mock the-patchers15942001
Ref: 49da15942001
Node: patch15942754
Ref: library/unittest mock patch15942824
Ref: 49db15942824
Ref: library/unittest mock unittest mock patch15943024
Ref: 109615943024
Node: patch object15952910
Ref: library/unittest mock patch-object15952999
Ref: 49dd15952999
Ref: library/unittest mock unittest mock patch object15953044
Ref: 196715953044
Node: patch dict15954740
Ref: library/unittest mock patch-dict15954838
Ref: 49de15954838
Ref: library/unittest mock unittest mock patch dict15954881
Ref: 19c715954881
Node: patch multiple15959284
Ref: library/unittest mock patch-multiple15959406
Ref: 49e015959406
Ref: library/unittest mock unittest mock patch multiple15959457
Ref: 49e115959457
Node: patch のメソッド start と stop15962674
Ref: library/unittest mock patch-methods-start-and-stop15962819
Ref: 49e215962819
Ref: library/unittest mock start-and-stop15962819
Ref: 49e315962819
Ref: library/unittest mock unittest mock patch stopall15965704
Ref: 49e415965704
Node: ビルトインをパッチする15965864
Ref: library/unittest mock id415966006
Ref: 49e515966006
Ref: library/unittest mock patch-builtins15966006
Ref: 49e615966006
Node: TEST_PREFIX15966427
Ref: library/unittest mock id515966572
Ref: 49e715966572
Ref: library/unittest mock test-prefix15966572
Ref: 49df15966572
Node: patch デコレータをネストする15967570
Ref: library/unittest mock nesting-patch-decorators15967709
Ref: 49e815967709
Node: どこにパッチするか15968745
Ref: library/unittest mock id615968942
Ref: 49dc15968942
Ref: library/unittest mock where-to-patch15968942
Ref: 49b215968942
Node: デスクリプタやプロキシオブジェクトにパッチする15971217
Ref: library/unittest mock patching-descriptors-and-proxy-objects15971366
Ref: 49e915971366
Ref: デスクリプタやプロキシオブジェクトにパッチする-Footnote-115972032
Node: MagicMock と magic method のサポート15972157
Ref: library/unittest mock magicmock-and-magic-method-support15972333
Ref: 49ea15972333
Node: Magic Method をモックする15972495
Ref: library/unittest mock magic-methods15972624
Ref: 49b315972624
Ref: library/unittest mock mocking-magic-methods15972624
Ref: 49eb15972624
Ref: Magic Method をモックする-Footnote-115976874
Ref: Magic Method をモックする-Footnote-215977253
Node: Magic Mock15977377
Ref: library/unittest mock magic-mock15977506
Ref: 49ed15977506
Ref: library/unittest mock unittest mock MagicMock15977676
Ref: 109315977676
Ref: library/unittest mock unittest mock NonCallableMagicMock15978186
Ref: 49b715978186
Node: ヘルパー15981900
Ref: library/unittest mock helpers15982126
Ref: 49ee15982126
Node: sentinel15982311
Ref: library/unittest mock sentinel15982384
Ref: 49ef15982384
Ref: library/unittest mock unittest mock sentinel15982423
Ref: d9d15982423
Node: DEFAULT15983884
Ref: library/unittest mock default15983970
Ref: 49f015983970
Ref: library/unittest mock unittest mock DEFAULT15984007
Ref: 49b815984007
Node: call15984308
Ref: library/unittest mock call15984401
Ref: 49f115984401
Ref: library/unittest mock unittest mock call15984432
Ref: 1e0f15984432
Ref: library/unittest mock unittest mock call call_list15985044
Ref: 49f215985044
Ref: library/unittest mock calls-as-tuples15986178
Ref: 49c515986178
Node: create_autospec15987991
Ref: library/unittest mock create-autospec15988080
Ref: 49f315988080
Ref: library/unittest mock unittest mock create_autospec15988133
Ref: 199415988133
Node: ANY15989676
Ref: library/unittest mock any15989771
Ref: 49f415989771
Ref: library/unittest mock unittest mock ANY15989800
Ref: 1e0d15989800
Node: FILTER_DIR15991080
Ref: library/unittest mock filter-dir15991169
Ref: 49f515991169
Ref: library/unittest mock unittest mock FILTER_DIR15991212
Ref: 49c115991212
Node: mock_open15993600
Ref: library/unittest mock mock-open15993704
Ref: 49f615993704
Ref: library/unittest mock unittest mock mock_open15993745
Ref: 11ed15993745
Ref: mock_open-Footnote-115996900
Node: autospec を使う15996925
Ref: library/unittest mock auto-speccing15997032
Ref: 49b415997032
Ref: library/unittest mock autospeccing15997032
Ref: 49f715997032
Ref: autospec を使う-Footnote-116006726
Node: Sealing mocks16007094
Ref: library/unittest mock sealing-mocks16007183
Ref: 49f816007183
Ref: library/unittest mock unittest mock seal16007232
Ref: d9e16007232
Node: Order of precedence of side_effect return_value and wraps16008045
Ref: library/unittest mock order-of-precedence-of-side-effect-return-value-and-wraps16008220
Ref: 49f916008220
Node: unittest mock --- 入門16012297
Ref: library/unittest mock-examples doc16012495
Ref: 49fa16012495
Ref: library/unittest mock-examples translation-repo16012495
Ref: 49fb16012495
Ref: library/unittest mock-examples unittest-mock-getting-started16012495
Ref: 49fc16012495
Ref: library/unittest mock-examples getting-started16012587
Ref: 49fd16012587
Node: Mock を使う16012658
Ref: library/unittest mock-examples using-mock16012758
Ref: 49fe16012758
Node: Mock patching methods16013285
Ref: library/unittest mock-examples mock-patching-methods16013400
Ref: 49ff16013400
Node: Mock for method calls on an object16015238
Ref: library/unittest mock-examples mock-for-method-calls-on-an-object16015377
Ref: 4a0016015377
Node: Mocking classes16016916
Ref: library/unittest mock-examples mocking-classes16017064
Ref: 4a0116017064
Node: モックに名前をつける16018336
Ref: library/unittest mock-examples naming-your-mocks16018468
Ref: 4a0216018468
Node: Tracking all calls16019008
Ref: library/unittest mock-examples tracking-all-calls16019161
Ref: 4a0316019161
Node: Setting return values and attributes16020738
Ref: library/unittest mock-examples setting-return-values-and-attributes16020900
Ref: 4a0416020900
Node: モックから例外を発生させる16022540
Ref: library/unittest mock-examples raising-exceptions-with-mocks16022717
Ref: 4a0516022717
Node: side_effect の関数と iterable16023161
Ref: library/unittest mock-examples side-effect-functions-and-iterables16023344
Ref: 4a0616023344
Node: 非同期イテレータをモックする16024517
Ref: library/unittest mock-examples mocking-asynchronous-iterators16024721
Ref: 4a0716024721
Node: 非同期コンテキストマネージャをモックする16025391
Ref: library/unittest mock-examples mocking-asynchronous-context-manager16025601
Ref: 4a0816025601
Node: Creating a mock from an existing object16026631
Ref: library/unittest mock-examples creating-a-mock-from-an-existing-object16026843
Ref: 4a0916026843
Node: Using side_effect to return per file content16028889
Ref: library/unittest mock-examples using-side-effect-to-return-per-file-content16029032
Ref: 4a0a16029032
Node: Patch decorators16029883
Ref: library/unittest mock-examples patch-decorators16030008
Ref: 4a0b16030008
Node: Further examples16035734
Ref: library/unittest mock-examples further-examples16035836
Ref: 4a0c16035836
Ref: library/unittest mock-examples id116035836
Ref: 4a0d16035836
Node: chained call をモックする16036545
Ref: library/unittest mock-examples mocking-chained-calls16036659
Ref: 4a0e16036659
Node: 部分的なモック16040461
Ref: library/unittest mock-examples partial-mocking16040610
Ref: 4a0f16040610
Ref: 部分的なモック-Footnote-116042897
Node: Mocking a generator method16042998
Ref: library/unittest mock-examples mocking-a-generator-method16043170
Ref: 4a1016043170
Ref: Mocking a generator method-Footnote-116044575
Node: 同じパッチを全てのメソッドに適用する16044960
Ref: library/unittest mock-examples applying-the-same-patch-to-every-test-method16045134
Ref: 4a1116045134
Node: Mocking unbound methods16047721
Ref: library/unittest mock-examples mocking-unbound-methods16047926
Ref: 4a1216047926
Node: モックで複数回の呼び出しをチェックする16049750
Ref: library/unittest mock-examples checking-multiple-calls-with-mock16049943
Ref: 4a1316049943
Node: ミュータブルな引数に対処する16051742
Ref: library/unittest mock-examples coping-with-mutable-arguments16051927
Ref: 4a1416051927
Node: Nesting patches16056490
Ref: library/unittest mock-examples nesting-patches16056655
Ref: 4a1516056655
Node: MagicMock で辞書をモックする16058470
Ref: library/unittest mock-examples mocking-a-dictionary-with-magicmock16058625
Ref: 4a1616058625
Node: Mock のサブクラスと属性16061268
Ref: library/unittest mock-examples mock-subclasses-and-their-attributes16061448
Ref: 4a1716061448
Ref: Mock のサブクラスと属性-Footnote-116063557
Ref: Mock のサブクラスと属性-Footnote-216063725
Ref: Mock のサブクラスと属性-Footnote-316063783
Node: patch dict で import をモックする16063864
Ref: library/unittest mock-examples mocking-imports-with-patch-dict16064063
Ref: 4a1816064063
Node: Tracking order of calls and less verbose call assertions16066706
Ref: library/unittest mock-examples tracking-order-of-calls-and-less-verbose-call-assertions16066903
Ref: 4a1916066903
Node: More complex argument matching16070236
Ref: library/unittest mock-examples more-complex-argument-matching16070384
Ref: 4a1a16070384
Ref: More complex argument matching-Footnote-116073453
Ref: More complex argument matching-Footnote-216073496
Node: test --- Regression tests package for Python16073618
Ref: library/test doc16073808
Ref: 4a1b16073808
Ref: library/test module-test16073808
Ref: e816073808
Ref: library/test test-regression-tests-package-for-python16073808
Ref: 4a1c16073808
Ref: library/test translation-repo16073808
Ref: 4a1d16073808
Node: Writing Unit Tests for the test package16075293
Ref: library/test writing-tests16075506
Ref: 4a1e16075506
Ref: library/test writing-unit-tests-for-the-test-package16075506
Ref: 4a1f16075506
Node: コマンドラインインターフェースを利用してテストを実行する16081493
Ref: library/test module-test regrtest16081706
Ref: e916081706
Ref: library/test regrtest16081706
Ref: 120f16081706
Ref: library/test running-tests-using-the-command-line-interface16081706
Ref: 4a2016081706
Node: test support --- Utilities for the Python test suite16083890
Ref: library/test module-test support16084113
Ref: ea16084113
Ref: library/test test-support-utilities-for-the-python-test-suite16084113
Ref: 4a2116084113
Ref: library/test test support TestFailed16084625
Ref: 4a2216084625
Ref: library/test test support ResourceDenied16084899
Ref: 4a2316084899
Ref: library/test test support verbose16085244
Ref: 4a2516085244
Ref: library/test test support is_jython16085531
Ref: 4a2616085531
Ref: library/test test support is_android16085657
Ref: 4a2716085657
Ref: library/test test support is_emscripten16085754
Ref: 4a2816085754
Ref: library/test test support is_wasi16085857
Ref: 4a2916085857
Ref: library/test test support is_apple_mobile16085948
Ref: 4a2a16085948
Ref: library/test test support is_apple16086076
Ref: 4a2b16086076
Ref: library/test test support unix_shell16086214
Ref: 4a2c16086214
Ref: library/test test support LOOPBACK_TIMEOUT16086352
Ref: 1df916086352
Ref: library/test test support INTERNET_TIMEOUT16086975
Ref: 1dfa16086975
Ref: library/test test support SHORT_TIMEOUT16087502
Ref: 1cc016087502
Ref: library/test test support LONG_TIMEOUT16087891
Ref: 1dfb16087891
Ref: library/test test support PGO16088404
Ref: 4a2e16088404
Ref: library/test test support PIPE_MAX_SIZE16088572
Ref: 4a2f16088572
Ref: library/test test support Py_DEBUG16088761
Ref: 4a3016088761
Ref: library/test test support SOCK_MAX_SIZE16088971
Ref: 4a3116088971
Ref: library/test test support TEST_SUPPORT_DIR16089163
Ref: 4a3216089163
Ref: library/test test support TEST_HOME_DIR16089280
Ref: 4a3316089280
Ref: library/test test support TEST_DATA_DIR16089405
Ref: 4a3416089405
Ref: library/test test support MAX_Py_ssize_t16089536
Ref: 4a3516089536
Ref: library/test test support max_memuse16089688
Ref: 4a3616089688
Ref: library/test test support real_max_memuse16089921
Ref: 4a3816089921
Ref: library/test test support MISSING_C_DOCSTRINGS16090171
Ref: 4a3916090171
Ref: library/test test support HAVE_DOCSTRINGS16090463
Ref: 4a3a16090463
Ref: library/test test support TEST_HTTP_URL16090743
Ref: 4a3b16090743
Ref: library/test test support ALWAYS_EQ16090876
Ref: 4a3c16090876
Ref: library/test test support NEVER_EQ16090997
Ref: 4a3d16090997
Ref: library/test test support LARGEST16091154
Ref: 4a3e16091154
Ref: library/test test support SMALLEST16091293
Ref: 4a3f16091293
Ref: library/test test support busy_retry16091494
Ref: 4a4016091494
Ref: library/test test support sleeping_retry16092163
Ref: 4a4116092163
Ref: library/test test support is_resource_enabled16093048
Ref: 4a4216093048
Ref: library/test test support get_resource_value16093335
Ref: 4a4316093335
Ref: library/test test support python_is_optimized16093547
Ref: 4a4416093547
Ref: library/test test support with_pymalloc16093676
Ref: 4a4516093676
Ref: library/test test support requires16093766
Ref: 4a2416093766
Ref: library/test test support sortdict16094229
Ref: 4a4616094229
Ref: library/test test support findfile16094322
Ref: 4a4716094322
Ref: library/test test support get_pagesize16094877
Ref: 4a4816094877
Ref: library/test test support setswitchinterval16094986
Ref: 4a4916094986
Ref: library/test test support check_impl_detail16095213
Ref: 4a4a16095213
Ref: library/test test support set_memlimit16095730
Ref: 4a3716095730
Ref: library/test test support record_original_stdout16095889
Ref: 4a4b16095889
Ref: library/test test support get_original_stdout16096056
Ref: 4a4c16096056
Ref: library/test test support args_from_interpreter_flags16096228
Ref: 4a4d16096228
Ref: library/test test support optim_args_from_interpreter_flags16096418
Ref: 4a4e16096418
Ref: library/test test support captured_stdin16096601
Ref: 4a4f16096601
Ref: library/test test support captured_stdout16096647
Ref: 4a5016096647
Ref: library/test test support captured_stderr16096694
Ref: 1e3416096694
Ref: library/test test support disable_faulthandler16097475
Ref: 4a5116097475
Ref: library/test test support gc_collect16097600
Ref: 4a5216097600
Ref: library/test test support disable_gc16097937
Ref: 4a5316097937
Ref: library/test test support swap_attr16098119
Ref: 4a5416098119
Ref: library/test test support swap_item16098702
Ref: 4a5516098702
Ref: library/test test support flush_std_streams16099283
Ref: 4a5616099283
Ref: library/test test support print_warning16099560
Ref: 4a5716099560
Ref: library/test test support wait_process16099835
Ref: 1dbb16099835
Ref: library/test test support calcobjsize16100355
Ref: 4a5916100355
Ref: library/test test support calcvobjsize16100589
Ref: 4a5a16100589
Ref: library/test test support checksizeof16100828
Ref: 4a5c16100828
Ref: library/test test support anticipate_failure16101000
Ref: 4a5d16101000
Ref: library/test test support system_must_validate_cert16101314
Ref: 4a5e16101314
Ref: library/test test support run_with_locale16101468
Ref: 4a5f16101468
Ref: library/test test support run_with_tz16101906
Ref: 4a6016101906
Ref: library/test test support requires_freebsd_version16102069
Ref: 4a6116102069
Ref: library/test test support requires_linux_version16102284
Ref: 4a6216102284
Ref: library/test test support requires_mac_version16102494
Ref: 4a6316102494
Ref: library/test test support requires_gil_enabled16102701
Ref: 4a6416102701
Ref: library/test test support requires_IEEE_75416102878
Ref: 4a6516102878
Ref: library/test test support requires_zlib16102988
Ref: 4a6616102988
Ref: library/test test support requires_gzip16103102
Ref: 4a6716103102
Ref: library/test test support requires_bz216103215
Ref: 4a6816103215
Ref: library/test test support requires_lzma16103326
Ref: 4a6916103326
Ref: library/test test support requires_resource16103439
Ref: 4a6a16103439
Ref: library/test test support requires_docstrings16103565
Ref: 4a6b16103565
Ref: library/test test support requires_limited_api16103689
Ref: 4a6c16103689
Ref: library/test test support cpython_only16103830
Ref: 4a6d16103830
Ref: library/test test support impl_detail16103927
Ref: 4a6e16103927
Ref: library/test test support thread_unsafe16104158
Ref: 4a6f16104158
Ref: library/test test support no_tracing16104359
Ref: 4a7016104359
Ref: library/test test support refcount_test16104483
Ref: 4a7116104483
Ref: library/test test support bigmemtest16104788
Ref: 4a7216104788
Ref: library/test test support bigaddrspacetest16105534
Ref: 4a7316105534
Ref: library/test test support linked_to_musl16105636
Ref: 4a7416105636
Ref: library/test test support check_syntax_error16106092
Ref: 4a7516106092
Ref: library/test test support open_urlresource16106647
Ref: 4a7616106647
Ref: library/test test support reap_children16106777
Ref: 4a7716106777
Ref: library/test test support get_attribute16107052
Ref: 4a7816107052
Ref: library/test test support catch_unraisable_exception16107216
Ref: 1e1916107216
Ref: library/test test support load_package_tests16108109
Ref: 4a7916108109
Ref: library/test test support detect_api_mismatch16108738
Ref: 4a7a16108738
Ref: library/test test support patch16109202
Ref: 4a7b16109202
Ref: library/test test support run_in_subinterp16109539
Ref: 4a7c16109539
Ref: library/test test support check_free_after_iterating16109710
Ref: 4a7d16109710
Ref: library/test test support missing_compiler_executable16109868
Ref: 4a7e16109868
Ref: library/test test support check__all__16110191
Ref: 1d9116110191
Ref: library/test test support skip_if_broken_multiprocessing_synchronize16112002
Ref: 1d9216112002
Ref: library/test test support check_disallow_instantiation16112296
Ref: 4a7f16112296
Ref: library/test test support adjust_int_max_str_digits16112505
Ref: 4a8016112505
Ref: library/test test support SuppressCrashReport16112972
Ref: 4a8116112972
Ref: library/test test support SaveSignals16113477
Ref: 4a8316113477
Ref: library/test test support SaveSignals save16113612
Ref: 4a8416113612
Ref: library/test test support SaveSignals restore16113764
Ref: 4a8516113764
Ref: library/test test support Matcher16113909
Ref: 4a8616113909
Ref: library/test test support Matcher matches16113946
Ref: 4a8716113946
Ref: library/test test support Matcher match_value16114065
Ref: 4a8816114065
Ref: test support --- Utilities for the Python test suite-Footnote-116114246
Node: test support socket_helper --- Utilities for socket tests16114326
Ref: library/test module-test support socket_helper16114576
Ref: ef16114576
Ref: library/test test-support-socket-helper-utilities-for-socket-tests16114576
Ref: 4a8916114576
Ref: library/test test support socket_helper IPV6_ENABLED16114818
Ref: 4a8a16114818
Ref: library/test test support socket_helper find_unused_port16114954
Ref: 4a8b16114954
Ref: library/test test support socket_helper bind_port16116262
Ref: 4a8c16116262
Ref: library/test test support socket_helper bind_unix_socket16117208
Ref: 4a8d16117208
Ref: library/test test support socket_helper skip_unless_bind_unix_socket16117393
Ref: 4a8e16117393
Ref: library/test test support socket_helper transient_internet16117564
Ref: 4a2d16117564
Node: test support script_helper --- Utilities for the Python execution tests16117838
Ref: library/test module-test support script_helper16118122
Ref: ee16118122
Ref: library/test test-support-script-helper-utilities-for-the-python-execution-tests16118122
Ref: 4a8f16118122
Ref: library/test test support script_helper interpreter_requires_environment16118388
Ref: 4a9016118388
Ref: library/test test support script_helper run_python_until_end16119361
Ref: 4a9116119361
Ref: library/test test support script_helper assert_python_ok16119747
Ref: 4a9216119747
Ref: library/test test support script_helper assert_python_failure16120388
Ref: 4a9316120388
Ref: library/test test support script_helper spawn_python16120830
Ref: 4a9416120830
Ref: library/test test support script_helper kill_python16121144
Ref: 4a9516121144
Ref: library/test test support script_helper make_script16121301
Ref: 4a9616121301
Ref: library/test test support script_helper make_zip_script16121611
Ref: 4a9716121611
Ref: library/test test support script_helper make_pkg16121981
Ref: 4a9816121981
Ref: library/test test support script_helper make_zip_pkg16122185
Ref: 4a9916122185
Node: test support bytecode_helper --- Support tools for testing correct bytecode generation16122716
Ref: library/test module-test support bytecode_helper16123006
Ref: eb16123006
Ref: library/test test-support-bytecode-helper-support-tools-for-testing-correct-bytecode-generation16123006
Ref: 4a9a16123006
Ref: library/test test support bytecode_helper BytecodeTestCase16123379
Ref: 4a9b16123379
Ref: library/test test support bytecode_helper BytecodeTestCase get_disassembly_as_string16123542
Ref: 4a9c16123542
Ref: library/test test support bytecode_helper BytecodeTestCase assertInBytecode16123657
Ref: 4a9d16123657
Ref: library/test test support bytecode_helper BytecodeTestCase assertNotInBytecode16123843
Ref: 4a9e16123843
Node: test support threading_helper --- Utilities for threading tests16124004
Ref: library/test module-test support threading_helper16124272
Ref: f016124272
Ref: library/test test-support-threading-helper-utilities-for-threading-tests16124272
Ref: 4a9f16124272
Ref: library/test test support threading_helper join_thread16124533
Ref: 4aa016124533
Ref: library/test test support threading_helper reap_threads16124756
Ref: 4aa116124756
Ref: library/test test support threading_helper start_threads16124898
Ref: 4aa216124898
Ref: library/test test support threading_helper threading_cleanup16125307
Ref: 4aa316125307
Ref: library/test test support threading_helper threading_setup16125546
Ref: 4aa416125546
Ref: library/test test support threading_helper wait_threads_exit16125675
Ref: 4aa516125675
Ref: library/test test support threading_helper catch_threading_exception16125859
Ref: 4aa616125859
Ref: library/test test support threading_helper run_concurrently16126825
Ref: 4aa716126825
Node: test support os_helper --- Utilities for os tests16127098
Ref: library/test module-test support os_helper16127337
Ref: ed16127337
Ref: library/test test-support-os-helper-utilities-for-os-tests16127337
Ref: 4aa816127337
Ref: library/test test support os_helper FS_NONASCII16127556
Ref: 4aa916127556
Ref: library/test test support os_helper SAVEDCWD16127687
Ref: 4aaa16127687
Ref: library/test test support os_helper TESTFN16127791
Ref: 4aab16127791
Ref: library/test test support os_helper TESTFN_NONASCII16128052
Ref: 4aac16128052
Ref: library/test test support os_helper TESTFN_UNENCODABLE16128440
Ref: 4aad16128440
Ref: library/test test support os_helper TESTFN_UNDECODABLE16128772
Ref: 4aae16128772
Ref: library/test test support os_helper TESTFN_UNICODE16129103
Ref: 4aaf16129103
Ref: library/test test support os_helper EnvironmentVarGuard16129219
Ref: 160016129219
Ref: library/test test support os_helper FakePath16129884
Ref: 4ab016129884
Ref: library/test test support os_helper EnvironmentVarGuard set16130150
Ref: 4ab116130150
Ref: library/test test support os_helper EnvironmentVarGuard unset16130285
Ref: 18d716130285
Ref: library/test test support os_helper can_symlink16130499
Ref: 4ab216130499
Ref: library/test test support os_helper can_xattr16130702
Ref: 4ab316130702
Ref: library/test test support os_helper change_cwd16130827
Ref: 4ab416130827
Ref: library/test test support os_helper create_empty_file16131292
Ref: 4ab516131292
Ref: library/test test support os_helper fd_count16131445
Ref: 4ab616131445
Ref: library/test test support os_helper fs_is_case_insensitive16131545
Ref: 4ab716131545
Ref: library/test test support os_helper make_bad_fd16131704
Ref: 4ab816131704
Ref: library/test test support os_helper rmdir16131900
Ref: 4ab916131900
Ref: library/test test support os_helper rmtree16132209
Ref: 4aba16132209
Ref: library/test test support os_helper skip_unless_symlink16132553
Ref: 4abb16132553
Ref: library/test test support os_helper skip_unless_xattr16132737
Ref: 4abc16132737
Ref: library/test test support os_helper temp_cwd16132863
Ref: 4abd16132863
Ref: library/test test support os_helper temp_dir16133713
Ref: 4abe16133713
Ref: library/test test support os_helper temp_umask16134170
Ref: 4abf16134170
Ref: library/test test support os_helper unlink16134320
Ref: 4ac016134320
Node: test support import_helper --- Utilities for import tests16134566
Ref: library/test module-test support import_helper16134803
Ref: ec16134803
Ref: library/test test-support-import-helper-utilities-for-import-tests16134803
Ref: 4ac116134803
Ref: library/test test support import_helper forget16135046
Ref: 4ac216135046
Ref: library/test test support import_helper import_fresh_module16135286
Ref: 1cbf16135286
Ref: library/test test support import_helper import_module16137193
Ref: 4ac316137193
Ref: library/test test support import_helper modules_setup16137927
Ref: 4ac416137927
Ref: library/test test support import_helper modules_cleanup16138035
Ref: 4ac516138035
Ref: library/test test support import_helper unload16138214
Ref: 4ac616138214
Ref: library/test test support import_helper make_legacy_pyc16138331
Ref: 4ac716138331
Ref: library/test test support import_helper CleanImport16138681
Ref: 4ac816138681
Ref: library/test test support import_helper DirsOnSysPath16139075
Ref: 4ac916139075
Ref: test support import_helper --- Utilities for import tests-Footnote-116139630
Ref: test support import_helper --- Utilities for import tests-Footnote-216139672
Node: test support warnings_helper --- Utilities for warnings tests16139714
Ref: library/test module-test support warnings_helper16139893
Ref: f116139893
Ref: library/test test-support-warnings-helper-utilities-for-warnings-tests16139893
Ref: 4aca16139893
Ref: library/test test support warnings_helper ignore_warnings16140148
Ref: 4acb16140148
Ref: library/test test support warnings_helper check_no_resource_warning16140662
Ref: 4acc16140662
Ref: library/test test support warnings_helper check_syntax_warning16140947
Ref: 4acd16140947
Ref: library/test test support warnings_helper check_warnings16141751
Ref: 4ace16141751
Ref: library/test test support warnings_helper WarningsRecorder16145227
Ref: 4acf16145227
Node: Debugging and Profiling16145470
Ref: library/debug doc16145636
Ref: 4ad016145636
Ref: library/debug debugging-and-profiling16145636
Ref: 4ad116145636
Ref: library/debug translation-repo16145636
Ref: 4ad216145636
Ref: library/audit_events audit-events16146104
Ref: 1c7016146104
Node: 監査イベント表16146767
Ref: library/audit_events doc16146901
Ref: 4ad316146901
Ref: library/audit_events audit-events-table16146901
Ref: 4ad416146901
Ref: 監査イベント表-Footnote-116207499
Node: bdb --- デバッガーフレームワーク16207541
Ref: library/bdb doc16207747
Ref: 4af616207747
Ref: library/bdb bdb-debugger-framework16207747
Ref: 4af716207747
Ref: library/bdb module-bdb16207747
Ref: 1016207747
Ref: library/bdb translation-repo16207747
Ref: 4af816207747
Ref: library/bdb bdb BdbQuit16208117
Ref: 27a16208117
Ref: library/bdb bdb Breakpoint16208288
Ref: 4af916208288
Ref: library/bdb bdb Breakpoint deleteMe16209649
Ref: 4b0016209649
Ref: library/bdb bdb Breakpoint enable16210020
Ref: 4b0116210020
Ref: library/bdb bdb Breakpoint disable16210120
Ref: 4b0216210120
Ref: library/bdb bdb Breakpoint bpformat16210221
Ref: 4b0316210221
Ref: library/bdb bdb Breakpoint bpprint16210645
Ref: 4b0416210645
Ref: library/bdb bdb Breakpoint file16210930
Ref: 4afc16210930
Ref: library/bdb bdb Breakpoint line16211002
Ref: 4b0516211002
Ref: library/bdb bdb Breakpoint temporary16211100
Ref: 4b0616211100
Ref: library/bdb bdb Breakpoint cond16211205
Ref: 4aff16211205
Ref: library/bdb bdb Breakpoint funcname16211303
Ref: 4afd16211303
Ref: library/bdb bdb Breakpoint enabled16211443
Ref: 4b0716211443
Ref: library/bdb bdb Breakpoint bpbynumber16211526
Ref: 4afa16211526
Ref: library/bdb bdb Breakpoint bplist16211628
Ref: 4afb16211628
Ref: library/bdb bdb Breakpoint ignore16211775
Ref: 4b0816211775
Ref: library/bdb bdb Breakpoint hits16211860
Ref: 4afe16211860
Ref: library/bdb bdb Bdb16211959
Ref: 2d716211959
Ref: library/bdb bdb Bdb canonic16213812
Ref: 4b0916213812
Ref: library/bdb bdb Bdb start_trace16214197
Ref: 4b0a16214197
Ref: library/bdb bdb Bdb stop_trace16214410
Ref: 4b0b16214410
Ref: library/bdb bdb Bdb reset16214606
Ref: 4b0c16214606
Ref: library/bdb bdb Bdb trace_dispatch16214804
Ref: 4b0e16214804
Ref: library/bdb bdb Bdb dispatch_line16216506
Ref: 4b0f16216506
Ref: library/bdb bdb Bdb dispatch_call16216981
Ref: 4b1116216981
Ref: library/bdb bdb Bdb dispatch_return16217463
Ref: 4b1316217463
Ref: library/bdb bdb Bdb dispatch_exception16217953
Ref: 4b1516217953
Ref: library/bdb bdb Bdb is_skipped_module16218694
Ref: 4b1716218694
Ref: library/bdb bdb Bdb stop_here16218822
Ref: 4b1816218822
Ref: library/bdb bdb Bdb break_here16218956
Ref: 4b1916218956
Ref: library/bdb bdb Bdb break_anywhere16219270
Ref: 4b1b16219270
Ref: library/bdb bdb Bdb user_call16219533
Ref: 4b1216219533
Ref: library/bdb bdb Bdb user_line16219840
Ref: 4b1016219840
Ref: library/bdb bdb Bdb user_return16220069
Ref: 4b1416220069
Ref: library/bdb bdb Bdb user_exception16220275
Ref: 4b1616220275
Ref: library/bdb bdb Bdb do_clear16220483
Ref: 4b1c16220483
Ref: library/bdb bdb Bdb set_step16220936
Ref: 4b1d16220936
Ref: library/bdb bdb Bdb set_next16221032
Ref: 4b1e16221032
Ref: library/bdb bdb Bdb set_return16221206
Ref: 4b1f16221206
Ref: library/bdb bdb Bdb set_until16221336
Ref: 4b2016221336
Ref: library/bdb bdb Bdb set_trace16221565
Ref: 4b2116221565
Ref: library/bdb bdb Bdb set_continue16221970
Ref: 4b2316221970
Ref: library/bdb bdb Bdb set_quit16222254
Ref: 4b0d16222254
Ref: library/bdb bdb Bdb set_break16222771
Ref: 4b2416222771
Ref: library/bdb bdb Bdb clear_break16223217
Ref: 4b2516223217
Ref: library/bdb bdb Bdb clear_bpbynumber16223483
Ref: 4b2616223483
Ref: library/bdb bdb Bdb clear_all_file_breaks16223781
Ref: 4b2716223781
Ref: library/bdb bdb Bdb clear_all_breaks16224034
Ref: 4b2816224034
Ref: library/bdb bdb Bdb get_bpbynumber16224266
Ref: 4b2916224266
Ref: library/bdb bdb Bdb get_break16224714
Ref: 4b2a16224714
Ref: library/bdb bdb Bdb get_breaks16224859
Ref: 4b2b16224859
Ref: library/bdb bdb Bdb get_file_breaks16225107
Ref: 4b2c16225107
Ref: library/bdb bdb Bdb get_all_breaks16225339
Ref: 4b2d16225339
Ref: library/bdb bdb Bdb disable_current_event16225675
Ref: 4b2e16225675
Ref: library/bdb bdb Bdb restart_events16225950
Ref: 4b2f16225950
Ref: library/bdb bdb Bdb get_stack16226514
Ref: 4b3016226514
Ref: library/bdb bdb Bdb format_stack_entry16226811
Ref: 4b3116226811
Ref: library/bdb bdb Bdb run16227445
Ref: 4b3216227445
Ref: library/bdb bdb Bdb runeval16227681
Ref: 4b3316227681
Ref: library/bdb bdb Bdb runctx16227919
Ref: 4b3416227919
Ref: library/bdb bdb Bdb runcall16228091
Ref: c7516228091
Ref: library/bdb bdb checkfuncname16228314
Ref: 4b3516228314
Ref: library/bdb bdb effective16228768
Ref: 4b1a16228768
Ref: library/bdb bdb set_trace16229523
Ref: 4b2216229523
Ref: bdb --- デバッガーフレームワーク-Footnote-116229735
Node: faulthandler --- Python トレースバックをダンプする16229798
Ref: library/faulthandler doc16230010
Ref: 4b3616230010
Ref: library/faulthandler faulthandler-dump-the-python-traceback16230010
Ref: 4b3716230010
Ref: library/faulthandler module-faulthandler16230010
Ref: 5c16230010
Ref: library/faulthandler translation-repo16230010
Ref: 4b3816230010
Node: tracebackのダンプ16233330
Ref: library/faulthandler dumping-the-traceback16233479
Ref: 4b3916233479
Ref: library/faulthandler faulthandler dump_traceback16233538
Ref: 100316233538
Node: Dumping the C stack16233968
Ref: library/faulthandler dumping-the-c-stack16234162
Ref: 4b3a16234162
Ref: library/faulthandler faulthandler dump_c_stack16234245
Ref: 21016234245
Node: C Stack Compatibility16234573
Ref: library/faulthandler c-stack-compatibility16234650
Ref: 20f16234650
Ref: library/faulthandler id116234650
Ref: 4b3b16234650
Ref: C Stack Compatibility-Footnote-116235269
Ref: C Stack Compatibility-Footnote-216235318
Node: フォールトハンドラの状態16235365
Ref: library/faulthandler fault-handler-state16235589
Ref: 4b3c16235589
Ref: library/faulthandler faulthandler enable16235670
Ref: 21116235670
Ref: library/faulthandler faulthandler disable16237040
Ref: 4b3e16237040
Ref: library/faulthandler faulthandler is_enabled16237266
Ref: 4b3f16237266
Node: タイムアウト後にtracebackをダンプする16237388
Ref: library/faulthandler dumping-the-tracebacks-after-a-timeout16237653
Ref: 4b4016237653
Ref: library/faulthandler faulthandler dump_traceback_later16237762
Ref: 100416237762
Ref: library/faulthandler faulthandler cancel_dump_traceback_later16238807
Ref: 4b4116238807
Node: ユーザシグナルに対してtracebackをダンプする16238970
Ref: library/faulthandler dumping-the-traceback-on-a-user-signal16239229
Ref: 4b4216239229
Ref: library/faulthandler faulthandler register16239353
Ref: 100216239353
Ref: library/faulthandler faulthandler unregister16240001
Ref: 4b4316240001
Node: ファイル記述子の問題16240402
Ref: library/faulthandler faulthandler-fd16240623
Ref: 4b3d16240623
Ref: library/faulthandler issue-with-file-descriptors16240623
Ref: 4b4416240623
Node: 使用例<43>16241238
Ref: library/faulthandler example16241390
Ref: 4b4516241390
Node: pdb --- The Python Debugger16244695
Ref: library/pdb doc16244883
Ref: 4b4616244883
Ref: library/pdb debugger16244883
Ref: 4b4716244883
Ref: library/pdb module-pdb16244883
Ref: aa16244883
Ref: library/pdb pdb-the-python-debugger16244883
Ref: 4b4816244883
Ref: library/pdb translation-repo16244883
Ref: 4b4916244883
Ref: pdb --- The Python Debugger-Footnote-116247368
Node: コマンドライン・インターフェース<8>16247431
Ref: library/pdb command-line-interface16247572
Ref: 4b4b16247572
Ref: library/pdb pdb-cli16247572
Ref: 2e416247572
Ref: library/pdb cmdoption-pdb-c16248376
Ref: 4b4c16248376
Ref: library/pdb cmdoption-pdb-command16248376
Ref: 4b4d16248376
Ref: library/pdb cmdoption-pdb-m16248604
Ref: 4b4f16248604
Ref: library/pdb cmdoption-pdb-p16248889
Ref: 27216248889
Ref: library/pdb cmdoption-pdb-pid16248889
Ref: 4b5016248889
Ref: library/pdb pdb run16250377
Ref: 494216250377
Ref: library/pdb pdb runeval16251301
Ref: 4b5316251301
Ref: library/pdb pdb runcall16251696
Ref: 4b5416251696
Ref: library/pdb pdb set_trace16252113
Ref: 27416252113
Ref: library/pdb pdb set_trace_async16252861
Ref: 27b16252861
Ref: library/pdb pdb post_mortem16253275
Ref: 15f816253275
Ref: library/pdb pdb pm16253658
Ref: 53f16253658
Ref: library/pdb pdb set_default_backend16253774
Ref: 4b5516253774
Ref: library/pdb pdb get_default_backend16254339
Ref: 4b5616254339
Ref: library/pdb pdb Pdb16254758
Ref: 27516254758
Ref: library/pdb pdb Pdb run16257893
Ref: 4b5716257893
Ref: library/pdb pdb Pdb runeval16257959
Ref: 4b5816257959
Ref: library/pdb pdb Pdb runcall16258030
Ref: 4b5916258030
Ref: library/pdb pdb Pdb set_trace16258087
Ref: 27616258087
Ref: コマンドライン・インターフェース<8>-Footnote-116258247
Ref: コマンドライン・インターフェース<8>-Footnote-216258289
Node: Debugger commands16258431
Ref: library/pdb debugger-commands16258572
Ref: 4b4e16258572
Ref: library/pdb id216258572
Ref: 4b5a16258572
Ref: library/pdb pdbcommand-help16262706
Ref: 4b5d16262706
Ref: library/pdb pdbcommand-where16263240
Ref: 4b5e16263240
Ref: library/pdb pdbcommand-down16263706
Ref: 4b5f16263706
Ref: library/pdb pdbcommand-up16263894
Ref: 4b6016263894
Ref: library/pdb pdbcommand-break16264077
Ref: 4b6116264077
Ref: library/pdb pdbcommand-tbreak16265355
Ref: 4b6216265355
Ref: library/pdb pdbcommand-clear16265600
Ref: 4b6316265600
Ref: library/pdb pdbcommand-disable16266078
Ref: 4b6416266078
Ref: library/pdb pdbcommand-enable16266500
Ref: 4b6516266500
Ref: library/pdb pdbcommand-ignore16266615
Ref: 4b6616266615
Ref: library/pdb pdbcommand-condition16267178
Ref: 4b6716267178
Ref: library/pdb pdbcommand-commands16267605
Ref: 27816267605
Ref: library/pdb pdbcommand-step16269483
Ref: 4b5116269483
Ref: library/pdb pdbcommand-next16269692
Ref: 4b5216269692
Ref: library/pdb pdbcommand-until16270112
Ref: 4b6916270112
Ref: library/pdb pdbcommand-return16270538
Ref: 4b6816270538
Ref: library/pdb pdbcommand-continue16270628
Ref: 4b4a16270628
Ref: library/pdb pdbcommand-jump16270737
Ref: 4b6a16270737
Ref: library/pdb pdbcommand-list16271198
Ref: 4b5b16271198
Ref: library/pdb pdbcommand-ll16272183
Ref: 4b6c16272183
Ref: library/pdb pdbcommand-args16272420
Ref: 4b6d16272420
Ref: library/pdb pdbcommand-p16272525
Ref: 117c16272525
Ref: library/pdb pdbcommand-pp16272882
Ref: 4b6e16272882
Ref: library/pdb pdbcommand-whatis16273084
Ref: 4b6f16273084
Ref: library/pdb pdbcommand-source16273166
Ref: 4b7016273166
Ref: library/pdb pdbcommand-display16273327
Ref: 27716273327
Ref: library/pdb pdbcommand-undisplay16274860
Ref: 4b7116274860
Ref: library/pdb pdbcommand-interact16275166
Ref: 4b7216275166
Ref: library/pdb debugger-aliases16276083
Ref: 4b5c16276083
Ref: library/pdb pdbcommand-alias16276083
Ref: 4b7316276083
Ref: library/pdb pdbcommand-unalias16277393
Ref: 4b7416277393
Ref: library/pdb pdbcommand-016277486
Ref: 4b7516277486
Ref: library/pdb pdbcommand-run16277973
Ref: 4b7616277973
Ref: library/pdb pdbcommand-restart16278004
Ref: 4b7716278004
Ref: library/pdb pdbcommand-quit16278627
Ref: 4b6b16278627
Ref: library/pdb pdbcommand-debug16279254
Ref: 4b7816279254
Ref: library/pdb pdbcommand-retval16279442
Ref: 4b7916279442
Ref: library/pdb pdbcommand-exceptions16279540
Ref: 54016279540
Node: The Python Profilers16280906
Ref: library/profile doc16281096
Ref: 4b7a16281096
Ref: library/profile profile16281096
Ref: 4b7b16281096
Ref: library/profile the-python-profilers16281096
Ref: 4b7c16281096
Ref: library/profile translation-repo16281096
Ref: 4b7d16281096
Ref: The Python Profilers-Footnote-116281640
Ref: The Python Profilers-Footnote-216281707
Node: Introduction to the profilers16281773
Ref: library/profile introduction-to-the-profilers16281889
Ref: 4b7e16281889
Ref: library/profile profiler-introduction16281889
Ref: 4b7f16281889
Node: Instant User's Manual16283372
Ref: library/profile instant-user-s-manual16283534
Ref: 4b8016283534
Ref: library/profile profile-instant16283534
Ref: 4b8116283534
Ref: library/profile profile-cli16286406
Ref: 4b8316286406
Ref: library/profile cmdoption-cProfile-o16286619
Ref: 4b8416286619
Ref: library/profile cmdoption-cProfile-s16286714
Ref: 4b8516286714
Ref: library/profile cmdoption-cProfile-m16286898
Ref: 4b8716286898
Node: profile and cProfile Module Reference16289822
Ref: library/profile module-cProfile16289970
Ref: 2b16289970
Ref: library/profile profile-and-cprofile-module-reference16289970
Ref: 4b8a16289970
Ref: library/profile module-profile16290081
Ref: b416290081
Ref: library/profile profile run16290170
Ref: 4b8b16290170
Ref: library/profile profile runctx16290963
Ref: 4b8c16290963
Ref: library/profile profile Profile16291368
Ref: bda16291368
Ref: library/profile profile Profile enable16293115
Ref: 4b8d16293115
Ref: library/profile profile Profile disable16293218
Ref: 4b8e16293218
Ref: library/profile profile Profile create_stats16293321
Ref: 4b8f16293321
Ref: library/profile profile Profile print_stats16293513
Ref: 4b9016293513
Ref: library/profile profile Profile dump_stats16294042
Ref: 4b9116294042
Ref: library/profile profile Profile run16294175
Ref: 4b9216294175
Ref: library/profile profile Profile runctx16294290
Ref: 4b9316294290
Ref: library/profile profile Profile runcall16294499
Ref: c7416294499
Node: The Stats Class16294875
Ref: library/profile profile-stats16295034
Ref: 4b9416295034
Ref: library/profile the-stats-class16295034
Ref: 4b9516295034
Ref: library/profile module-pstats16295168
Ref: b516295168
Ref: library/profile pstats Stats16295168
Ref: 4b8216295168
Ref: library/profile pstats Stats strip_dirs16296424
Ref: 4b8816296424
Ref: library/profile pstats Stats add16297240
Ref: 4b9616297240
Ref: library/profile pstats Stats dump_stats16297732
Ref: 4b9716297732
Ref: library/profile pstats Stats sort_stats16298112
Ref: 4b8616298112
Ref: library/profile pstats Stats reverse_order16303470
Ref: 4b9816303470
Ref: library/profile pstats Stats print_stats16303755
Ref: 4b8916303755
Ref: library/profile pstats Stats print_callers16305191
Ref: 4b9916305191
Ref: library/profile pstats Stats print_callees16306305
Ref: 4b9a16306305
Ref: library/profile pstats Stats get_stats_profile16306686
Ref: 4b9b16306686
Node: What Is Deterministic Profiling?16307237
Ref: library/profile deterministic-profiling16307374
Ref: 4b9c16307374
Ref: library/profile what-is-deterministic-profiling16307374
Ref: 4b9d16307374
Node: 制限事項<2>16309623
Ref: library/profile limitations16309779
Ref: 4b9e16309779
Ref: library/profile profile-limitations16309779
Ref: 4b9f16309779
Node: キャリブレーション 補正16311901
Ref: library/profile calibration16312070
Ref: 4ba016312070
Ref: library/profile profile-calibration16312070
Ref: 4ba116312070
Node: カスタムな時刻取得用関数を使う16314187
Ref: library/profile profile-timers16314332
Ref: 4ba216314332
Ref: library/profile using-a-custom-timer16314332
Ref: 4ba316314332
Node: timeit --- 小さなコードスニペットの実行時間計測16317133
Ref: library/timeit doc16317346
Ref: 4ba416317346
Ref: library/timeit module-timeit16317346
Ref: f516317346
Ref: library/timeit timeit-measure-execution-time-of-small-code-snippets16317346
Ref: 4ba516317346
Ref: library/timeit translation-repo16317346
Ref: 4ba616317346
Ref: timeit --- 小さなコードスニペットの実行時間計測-Footnote-116318180
Node: Basic Examples16318246
Ref: library/timeit basic-examples16318387
Ref: 4ba916318387
Node: Python Interface16319785
Ref: library/timeit id116319957
Ref: 4bab16319957
Ref: library/timeit python-interface16319957
Ref: 4ba816319957
Ref: library/timeit timeit timeit16320109
Ref: 108216320109
Ref: library/timeit timeit repeat16320623
Ref: 4bac16320623
Ref: library/timeit timeit default_timer16321295
Ref: 4bae16321295
Ref: library/timeit timeit Timer16321679
Ref: 16e616321679
Ref: library/timeit timeit Timer timeit16323488
Ref: eed16323488
Ref: library/timeit timeit Timer autorange16324833
Ref: eec16324833
Ref: library/timeit timeit Timer repeat16325593
Ref: 4bad16325593
Ref: library/timeit timeit Timer print_exc16327017
Ref: 4baf16327017
Node: Command-Line Interface16327735
Ref: library/timeit command-line-interface16327906
Ref: 4bb016327906
Ref: library/timeit timeit-command-line-interface16327906
Ref: 4ba716327906
Ref: library/timeit cmdoption-timeit-n16328206
Ref: 4bb116328206
Ref: library/timeit cmdoption-timeit-number16328206
Ref: 4bb216328206
Ref: library/timeit cmdoption-timeit-r16328276
Ref: 4bb316328276
Ref: library/timeit cmdoption-timeit-repeat16328276
Ref: 4bb416328276
Ref: library/timeit cmdoption-timeit-s16328365
Ref: 4bb516328365
Ref: library/timeit cmdoption-timeit-setup16328365
Ref: 4bb616328365
Ref: library/timeit cmdoption-timeit-p16328467
Ref: 4bb716328467
Ref: library/timeit cmdoption-timeit-process16328467
Ref: 4bb816328467
Ref: library/timeit cmdoption-timeit-u16328711
Ref: 4bb916328711
Ref: library/timeit cmdoption-timeit-unit16328711
Ref: 4bba16328711
Ref: library/timeit cmdoption-timeit-v16328902
Ref: 4bbb16328902
Ref: library/timeit cmdoption-timeit-verbose16328902
Ref: 4bbc16328902
Ref: library/timeit cmdoption-timeit-h16329014
Ref: 4bbd16329014
Ref: library/timeit cmdoption-timeit-help16329014
Ref: 4bbe16329014
Node: 使用例<44>16330601
Ref: library/timeit examples16330747
Ref: 4bbf16330747
Ref: library/timeit timeit-examples16330747
Ref: 4baa16330747
Node: trace --- Python 文実行のトレースと追跡16334561
Ref: library/trace doc16334800
Ref: 4bc016334800
Ref: library/trace module-trace16334800
Ref: 10416334800
Ref: library/trace trace-trace-or-track-python-statement-execution16334800
Ref: 4bc116334800
Ref: library/trace translation-repo16334800
Ref: 4bc216334800
Ref: trace --- Python 文実行のトレースと追跡-Footnote-116335656
Ref: trace --- Python 文実行のトレースと追跡-Footnote-216335721
Node: コマンドラインからの使用<2>16335762
Ref: library/trace command-line-usage16335942
Ref: 4bc316335942
Ref: library/trace trace-cli16335942
Ref: 4bc416335942
Ref: library/trace cmdoption-trace-help16336330
Ref: 4bc516336330
Ref: library/trace cmdoption-trace-version16336399
Ref: 4bc616336399
Node: 主要なオプション16336691
Ref: library/trace main-options16336824
Ref: 4bc716336824
Ref: library/trace cmdoption-trace-c16337196
Ref: 4bca16337196
Ref: library/trace cmdoption-trace-count16337196
Ref: 4bcb16337196
Ref: library/trace cmdoption-trace-t16337486
Ref: 4bc916337486
Ref: library/trace cmdoption-trace-trace16337486
Ref: 4bcf16337486
Ref: library/trace cmdoption-trace-l16337566
Ref: 4bc816337566
Ref: library/trace cmdoption-trace-listfuncs16337566
Ref: 4bd016337566
Ref: library/trace cmdoption-trace-r16337674
Ref: 4bd116337674
Ref: library/trace cmdoption-trace-report16337674
Ref: 4bd216337674
Ref: library/trace cmdoption-trace-T16337936
Ref: 4bd316337936
Ref: library/trace cmdoption-trace-trackcalls16337936
Ref: 4bd416337936
Node: 修飾的オプション16338069
Ref: library/trace modifiers16338241
Ref: 4bd516338241
Ref: library/trace cmdoption-trace-f16338302
Ref: 4bcd16338302
Ref: library/trace cmdoption-trace-file16338302
Ref: 4bd616338302
Ref: library/trace cmdoption-trace-C16338547
Ref: 4bcc16338547
Ref: library/trace cmdoption-trace-coverdir16338547
Ref: 4bd716338547
Ref: library/trace cmdoption-trace-m16338808
Ref: 4bd816338808
Ref: library/trace cmdoption-trace-missing16338808
Ref: 4bd916338808
Ref: library/trace cmdoption-trace-s16338955
Ref: 4bda16338955
Ref: library/trace cmdoption-trace-summary16338955
Ref: 4bdb16338955
Ref: library/trace cmdoption-trace-R16339176
Ref: 4bce16339176
Ref: library/trace cmdoption-trace-no-report16339176
Ref: 4bdc16339176
Ref: library/trace cmdoption-trace-g16339416
Ref: 4bdd16339416
Ref: library/trace cmdoption-trace-timing16339416
Ref: 4bde16339416
Node: フィルターオプション16339569
Ref: library/trace filters16339708
Ref: 4bdf16339708
Ref: library/trace cmdoption-trace-ignore-module16339841
Ref: 4be016339841
Ref: library/trace cmdoption-trace-ignore-dir16340075
Ref: 4be116340075
Node: プログラミングインターフェース16340343
Ref: library/trace programmatic-interface16340523
Ref: 4be216340523
Ref: library/trace trace-api16340523
Ref: 4be316340523
Ref: library/trace trace Trace16340619
Ref: 4be416340619
Ref: library/trace trace Trace run16341684
Ref: 4be516341684
Ref: library/trace trace Trace runctx16341980
Ref: 4be616341980
Ref: library/trace trace Trace runfunc16342366
Ref: c7616342366
Ref: library/trace trace Trace results16342615
Ref: 4be716342615
Ref: library/trace trace CoverageResults16342984
Ref: 4be816342984
Ref: library/trace trace CoverageResults update16343203
Ref: 4be916343203
Ref: library/trace trace CoverageResults write_results16343352
Ref: 4bea16343352
Node: tracemalloc --- メモリ割り当ての追跡16344987
Ref: library/tracemalloc doc16345152
Ref: 4beb16345152
Ref: library/tracemalloc module-tracemalloc16345152
Ref: 10616345152
Ref: library/tracemalloc tracemalloc-trace-memory-allocations16345152
Ref: 4bec16345152
Ref: library/tracemalloc translation-repo16345152
Ref: 4bed16345152
Ref: tracemalloc --- メモリ割り当ての追跡-Footnote-116346909
Node: 使用例<45>16346980
Ref: library/tracemalloc examples16347088
Ref: 4bee16347088
Node: 上位10を表示する16347277
Ref: library/tracemalloc display-the-top-1016347377
Ref: 4bef16347377
Node: 差を計算する16349043
Ref: library/tracemalloc compute-differences16349212
Ref: 4bf116349212
Node: メモリブロックのトレースバックを取得する16351742
Ref: library/tracemalloc get-the-traceback-of-a-memory-block16351910
Ref: 4bf416351910
Node: top を整形化する16354637
Ref: library/tracemalloc pretty-top16354778
Ref: 4bf516354778
Node: Record the current and peak size of all traced memory blocks16357337
Ref: library/tracemalloc record-the-current-and-peak-size-of-all-traced-memory-blocks16357456
Ref: 4bf616357456
Node: API16359143
Ref: library/tracemalloc api16359251
Ref: 4bf816359251
Node: 関数<11>16359417
Ref: library/tracemalloc functions16359488
Ref: 4bf916359488
Ref: library/tracemalloc tracemalloc clear_traces16359519
Ref: 4bfa16359519
Ref: library/tracemalloc tracemalloc get_object_traceback16359709
Ref: 1f9516359709
Ref: library/tracemalloc tracemalloc get_traceback_limit16360129
Ref: 4bfb16360129
Ref: library/tracemalloc tracemalloc get_traced_memory16360489
Ref: 4bf716360489
Ref: library/tracemalloc tracemalloc reset_peak16360685
Ref: b3916360685
Ref: library/tracemalloc tracemalloc get_tracemalloc_memory16361324
Ref: 4bfd16361324
Ref: library/tracemalloc tracemalloc is_tracing16361517
Ref: 4bfe16361517
Ref: library/tracemalloc tracemalloc start16361777
Ref: 218716361777
Ref: library/tracemalloc tracemalloc stop16363397
Ref: 190f16363397
Ref: library/tracemalloc tracemalloc take_snapshot16364033
Ref: 4bfc16364033
Node: DomainFilter16364876
Ref: library/tracemalloc domainfilter16364962
Ref: 4c0216364962
Ref: library/tracemalloc tracemalloc DomainFilter16365007
Ref: ef116365007
Ref: library/tracemalloc tracemalloc DomainFilter inclusive16365177
Ref: 4c0316365177
Ref: library/tracemalloc tracemalloc DomainFilter domain16365477
Ref: 4c0416365477
Node: Filter16365582
Ref: library/tracemalloc filter16365663
Ref: 4c0516365663
Ref: library/tracemalloc tracemalloc Filter16365698
Ref: 4c0616365698
Ref: library/tracemalloc tracemalloc Filter domain16366711
Ref: 4c0716366711
Ref: library/tracemalloc tracemalloc Filter inclusive16366982
Ref: 4c0816366982
Ref: library/tracemalloc tracemalloc Filter lineno16367414
Ref: 4c0a16367414
Ref: library/tracemalloc tracemalloc Filter filename_pattern16367603
Ref: 4c0916367603
Ref: library/tracemalloc tracemalloc Filter all_frames16367775
Ref: 4c0b16367775
Node: Frame16368281
Ref: library/tracemalloc frame16368358
Ref: 4c0d16368358
Ref: library/tracemalloc tracemalloc Frame16368391
Ref: 4c0e16368391
Ref: library/tracemalloc tracemalloc Frame filename16368592
Ref: 4c0f16368592
Ref: library/tracemalloc tracemalloc Frame lineno16368664
Ref: 4c1016368664
Node: Snapshot16368728
Ref: library/tracemalloc snapshot16368808
Ref: 4c1116368808
Ref: library/tracemalloc tracemalloc Snapshot16368847
Ref: 4c0116368847
Ref: library/tracemalloc tracemalloc Snapshot compare_to16369102
Ref: 4c0016369102
Ref: library/tracemalloc tracemalloc Snapshot dump16369947
Ref: 4bf216369947
Ref: library/tracemalloc tracemalloc Snapshot filter_traces16370178
Ref: 4c1816370178
Ref: library/tracemalloc tracemalloc Snapshot load16370861
Ref: 4bf316370861
Ref: library/tracemalloc tracemalloc Snapshot statistics16371053
Ref: 4bf016371053
Ref: library/tracemalloc tracemalloc Snapshot traceback_limit16372312
Ref: 4c0c16372312
Ref: library/tracemalloc tracemalloc Snapshot traces16372586
Ref: 4c1916372586
Node: Statistic16372965
Ref: library/tracemalloc statistic16373053
Ref: 4c1e16373053
Ref: library/tracemalloc tracemalloc Statistic16373094
Ref: 4c1a16373094
Ref: library/tracemalloc tracemalloc Statistic count16373371
Ref: 4c1616373371
Ref: library/tracemalloc tracemalloc Statistic size16373449
Ref: 4c1b16373449
Ref: library/tracemalloc tracemalloc Statistic traceback16373556
Ref: 4c1c16373556
Node: StatisticDiff16373727
Ref: library/tracemalloc statisticdiff16373812
Ref: 4c1f16373812
Ref: library/tracemalloc tracemalloc StatisticDiff16373861
Ref: 4c1216373861
Ref: library/tracemalloc tracemalloc StatisticDiff count16374204
Ref: 4c2016374204
Ref: library/tracemalloc tracemalloc StatisticDiff count_diff16374458
Ref: 4c1516374458
Ref: library/tracemalloc tracemalloc StatisticDiff size16374719
Ref: 4c1416374719
Ref: library/tracemalloc tracemalloc StatisticDiff size_diff16375002
Ref: 4c1316375002
Ref: library/tracemalloc tracemalloc StatisticDiff traceback16375272
Ref: 4c1716375272
Node: Trace16375450
Ref: library/tracemalloc trace16375535
Ref: 4c2116375535
Ref: library/tracemalloc tracemalloc Trace16375568
Ref: 4c1d16375568
Ref: library/tracemalloc tracemalloc Trace domain16375867
Ref: 4c2216375867
Ref: library/tracemalloc tracemalloc Trace size16376145
Ref: 4c2316376145
Ref: library/tracemalloc tracemalloc Trace traceback16376249
Ref: 4c2416376249
Node: Traceback16376420
Ref: library/tracemalloc traceback16376483
Ref: 4c2516376483
Ref: library/tracemalloc tracemalloc Traceback16376524
Ref: d9316376524
Ref: library/tracemalloc tracemalloc Traceback total_nframe16377447
Ref: 4bff16377447
Ref: library/tracemalloc tracemalloc Traceback format16377773
Ref: d9416377773
Node: ソフトウェア・パッケージと配布16378867
Ref: library/distribution doc16379052
Ref: 4c2716379052
Ref: library/distribution software-packaging-and-distribution16379052
Ref: 4c2816379052
Ref: library/distribution translation-repo16379052
Ref: 4c2916379052
Ref: ソフトウェア・パッケージと配布-Footnote-116379891
Node: ensurepip --- pip インストーラーのブートストラップ16379916
Ref: library/ensurepip doc16380103
Ref: 4c2a16380103
Ref: library/ensurepip ensurepip-bootstrapping-the-pip-installer16380103
Ref: 4c2b16380103
Ref: library/ensurepip module-ensurepip16380103
Ref: 5916380103
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-116382479
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-216382545
Node: コマンドライン・インターフェース<9>16382587
Ref: library/ensurepip command-line-interface16382769
Ref: 4c2c16382769
Ref: library/ensurepip ensurepip-cli16382769
Ref: 4c2d16382769
Ref: library/ensurepip cmdoption-ensurepip-root16383787
Ref: 4c2e16383787
Ref: library/ensurepip cmdoption-ensurepip-user16384016
Ref: 4c2f16384016
Ref: library/ensurepip cmdoption-ensurepip-altinstall16384504
Ref: 4c3016384504
Ref: library/ensurepip cmdoption-ensurepip-default-pip16384631
Ref: 4c3116384631
Node: モジュール API16384884
Ref: library/ensurepip module-api16385066
Ref: 4c3216385066
Ref: library/ensurepip ensurepip version16385181
Ref: 4c3316385181
Ref: library/ensurepip ensurepip bootstrap16385392
Ref: 4ae016385392
Node: venv --- 仮想環境の作成16387798
Ref: library/venv doc16388062
Ref: 4c3416388062
Ref: library/venv module-venv16388062
Ref: 11816388062
Ref: library/venv translation-repo16388062
Ref: 4c3516388062
Ref: library/venv venv-creation-of-virtual-environments16388062
Ref: 4c3616388062
Ref: library/venv venv-def16388265
Ref: 3e616388265
Ref: library/venv venv-intro16388265
Ref: 4c3716388265
Ref: venv --- 仮想環境の作成-Footnote-116390553
Ref: venv --- 仮想環境の作成-Footnote-216390615
Ref: venv --- 仮想環境の作成-Footnote-316390653
Ref: venv --- 仮想環境の作成-Footnote-416390695
Node: 仮想環境の作成<2>16390823
Ref: library/venv creating-virtual-environments16390947
Ref: 4c3a16390947
Ref: library/venv venv-cli16392775
Ref: 4c3b16392775
Ref: library/venv cmdoption-venv-arg-ENV_DIR16392775
Ref: 4c3c16392775
Ref: library/venv cmdoption-venv-system-site-packages16392882
Ref: 4c3d16392882
Ref: library/venv cmdoption-venv-symlinks16393004
Ref: 4c3e16393004
Ref: library/venv cmdoption-venv-copies16393131
Ref: 4c3f16393131
Ref: library/venv cmdoption-venv-clear16393257
Ref: 4c4016393257
Ref: library/venv cmdoption-venv-upgrade16393389
Ref: 4c4116393389
Ref: library/venv cmdoption-venv-without-pip16393532
Ref: 4c4216393532
Ref: library/venv cmdoption-venv-prompt16393665
Ref: 4c4316393665
Ref: library/venv cmdoption-venv-upgrade-deps16393762
Ref: 4c4416393762
Ref: library/venv cmdoption-venv-without-scm-ignore-files16393859
Ref: 4c4516393859
Ref: 仮想環境の作成<2>-Footnote-116396378
Node: 仮想環境のしくみ16396433
Ref: library/venv how-venvs-work16396572
Ref: 4c4616396572
Ref: library/venv venv-explanation16396572
Ref: 67e16396572
Node: API<2>16401925
Ref: library/venv api16402069
Ref: 4c4716402069
Ref: library/venv venv-api16402069
Ref: 10f916402069
Ref: library/venv venv EnvBuilder16402366
Ref: 57116402366
Ref: library/venv venv EnvBuilder create16405000
Ref: 4c4916405000
Ref: library/venv venv EnvBuilder ensure_directories16406393
Ref: 4c4a16406393
Ref: library/venv venv EnvBuilder create_configuration16409685
Ref: 4c4b16409685
Ref: library/venv venv EnvBuilder setup_python16409824
Ref: 4c4c16409824
Ref: library/venv venv EnvBuilder setup_scripts16410338
Ref: 4c4d16410338
Ref: library/venv venv EnvBuilder upgrade_dependencies16410520
Ref: 4c5016410520
Ref: library/venv venv EnvBuilder post_setup16410965
Ref: 4c4e16410965
Ref: library/venv venv EnvBuilder install_scripts16411311
Ref: 4c4f16411311
Ref: library/venv venv EnvBuilder create_git_ignore_file16412869
Ref: 4c4816412869
Ref: library/venv venv create16413970
Ref: 57216413970
Ref: API<2>-Footnote-116414766
Node: EnvBuilder を拡張する例16414811
Ref: library/venv an-example-of-extending-envbuilder16414922
Ref: 4c5116414922
Ref: EnvBuilder を拡張する例-Footnote-116425130
Node: zipapp --- 実行可能な Python zip アーカイブを管理する16425177
Ref: library/zipapp doc16425366
Ref: 4c5216425366
Ref: library/zipapp module-zipapp16425366
Ref: 13716425366
Ref: library/zipapp translation-repo16425366
Ref: 4c5316425366
Ref: library/zipapp zipapp-manage-executable-python-zip-archives16425366
Ref: 4c5416425366
Ref: zipapp --- 実行可能な Python zip アーカイブを管理する-Footnote-116426367
Node: 基本的な例<3>16426433
Ref: library/zipapp basic-example16426613
Ref: 4c5716426613
Node: コマンドラインインターフェイス<3>16427125
Ref: library/zipapp command-line-interface16427324
Ref: 4c5816427324
Ref: library/zipapp zipapp-command-line-interface16427324
Ref: 4c5516427324
Ref: library/zipapp cmdoption-zipapp-o16428016
Ref: 4c5916428016
Ref: library/zipapp cmdoption-zipapp-output16428016
Ref: 4c5a16428016
Ref: library/zipapp cmdoption-zipapp-p16428769
Ref: 4c5b16428769
Ref: library/zipapp cmdoption-zipapp-python16428769
Ref: 4c5c16428769
Ref: library/zipapp cmdoption-zipapp-m16429100
Ref: 4c5d16429100
Ref: library/zipapp cmdoption-zipapp-main16429100
Ref: 4c5e16429100
Ref: library/zipapp cmdoption-zipapp-c16429691
Ref: 4c5f16429691
Ref: library/zipapp cmdoption-zipapp-compress16429691
Ref: 4c6016429691
Ref: library/zipapp cmdoption-zipapp-info16429991
Ref: 4c6116429991
Ref: library/zipapp cmdoption-zipapp-h16430263
Ref: 4c6216430263
Ref: library/zipapp cmdoption-zipapp-help16430263
Ref: 4c6316430263
Node: Python API16430345
Ref: library/zipapp python-api16430539
Ref: 4c6416430539
Ref: library/zipapp zipapp-python-api16430539
Ref: 4c5616430539
Ref: library/zipapp zipapp create_archive16430652
Ref: dad16430652
Ref: library/zipapp zipapp get_interpreter16435250
Ref: 4c6516435250
Node: 使用例<46>16435700
Ref: library/zipapp examples16435876
Ref: 4c6616435876
Ref: library/zipapp zipapp-examples16435876
Ref: 4c6716435876
Node: インタープリタの指定16437537
Ref: library/zipapp specifying-the-interpreter16437747
Ref: 4c6816437747
Ref: library/zipapp zipapp-specifying-the-interpreter16437747
Ref: 4c6916437747
Node: Creating Standalone Applications with zipapp16438952
Ref: library/zipapp creating-standalone-applications-with-zipapp16439190
Ref: 4c6a16439190
Node: Caveats16440891
Ref: library/zipapp caveats16440979
Ref: 4c6b16440979
Node: The Python Zip Application Archive Format16441716
Ref: library/zipapp the-python-zip-application-archive-format16441915
Ref: 4c6c16441915
Node: Python ランタイムサービス16443806
Ref: library/python doc16444006
Ref: 4c6d16444006
Ref: library/python python16444006
Ref: 4c6e16444006
Ref: library/python python-runtime-services16444006
Ref: 4c6f16444006
Ref: library/python translation-repo16444006
Ref: 4c7016444006
Node: sys --- システム固有のパラメーターと関数16445822
Ref: library/sys doc16446013
Ref: 4c7116446013
Ref: library/sys module-sys16446013
Ref: df16446013
Ref: library/sys sys-system-specific-parameters-and-functions16446013
Ref: 4c7216446013
Ref: library/sys sys abiflags16446437
Ref: c5d16446437
Ref: library/sys sys addaudithook16446878
Ref: 4ad516446878
Ref: library/sys sys argv16449124
Ref: 148016449124
Ref: library/sys auditing16450317
Ref: 1ccb16450317
Ref: library/sys sys audit16450317
Ref: 197b16450317
Ref: library/sys sys base_exec_prefix16451711
Ref: 3e816451711
Ref: library/sys sys base_prefix16452198
Ref: 3e416452198
Ref: library/sys sys byteorder16452662
Ref: 265616452662
Ref: library/sys sys builtin_module_names16452971
Ref: 20a316452971
Ref: library/sys sys call_tracing16453404
Ref: 1c2016453404
Ref: library/sys sys copyright16453927
Ref: 4c7316453927
Ref: library/sys sys _clear_type_cache16454034
Ref: 29416454034
Ref: library/sys sys _clear_internal_caches16454599
Ref: 36216454599
Ref: library/sys sys _current_frames16454839
Ref: 165116454839
Ref: library/sys sys _current_exceptions16456020
Ref: 6e916456020
Ref: library/sys sys breakpointhook16456761
Ref: cd516456761
Ref: library/sys sys _debugmallocstats16459412
Ref: 4c7416459412
Ref: library/sys sys dllhandle16459932
Ref: 4c7516459932
Ref: library/sys sys displayhook16460060
Ref: 173d16460060
Ref: library/sys sys dont_write_bytecode16461752
Ref: 4c7616461752
Ref: library/sys sys _emscripten_info16462266
Ref: 1bec16462266
Ref: library/sys sys _emscripten_info emscripten_version16462486
Ref: 4c7716462486
Ref: library/sys sys _emscripten_info runtime16462646
Ref: 4c7816462646
Ref: library/sys sys _emscripten_info pthreads16462801
Ref: 4c7916462801
Ref: library/sys sys _emscripten_info shared_memory16462926
Ref: 4c7a16462926
Ref: library/sys sys pycache_prefix16463124
Ref: ba016463124
Ref: library/sys sys excepthook16464102
Ref: a1016464102
Ref: library/sys sys __breakpointhook__16465464
Ref: 4c7b16465464
Ref: library/sys sys __displayhook__16465502
Ref: 4c7c16465502
Ref: library/sys sys __excepthook__16465537
Ref: 4c7d16465537
Ref: library/sys sys __unraisablehook__16465571
Ref: 4c7e16465571
Ref: library/sys sys exception16466157
Ref: 89c16466157
Ref: library/sys sys exc_info16466628
Ref: 89b16466628
Ref: library/sys sys exec_prefix16467626
Ref: 3e916467626
Ref: library/sys sys executable16469063
Ref: 3eb16469063
Ref: library/sys sys exit16469451
Ref: 27916469451
Ref: library/sys sys flags16471191
Ref: 89d16471191
Ref: library/sys sys flags debug16471435
Ref: 4c7f16471435
Ref: library/sys sys flags inspect16471638
Ref: 180016471638
Ref: library/sys sys flags interactive16471843
Ref: 4c8016471843
Ref: library/sys sys flags isolated16472041
Ref: 4c8116472041
Ref: library/sys sys flags optimize16472241
Ref: 4c8216472241
Ref: library/sys sys flags dont_write_bytecode16472478
Ref: 4c8316472478
Ref: library/sys sys flags no_user_site16472672
Ref: 4c8416472672
Ref: library/sys sys flags no_site16472868
Ref: 4c8516472868
Ref: library/sys sys flags ignore_environment16473080
Ref: 4c8616473080
Ref: library/sys sys flags verbose16473269
Ref: 4c8716473269
Ref: library/sys sys flags bytes_warning16473476
Ref: 4c8816473476
Ref: library/sys sys flags quiet16473668
Ref: 4c8916473668
Ref: library/sys sys flags hash_randomization16473882
Ref: 4c8a16473882
Ref: library/sys sys flags dev_mode16474073
Ref: 1ede16474073
Ref: library/sys sys flags utf8_mode16474376
Ref: 4c8b16474376
Ref: library/sys sys flags safe_path16474581
Ref: 53e16474581
Ref: library/sys sys flags int_max_str_digits16474790
Ref: 273316474790
Ref: library/sys sys flags warn_default_encoding16475130
Ref: 4c8c16475130
Ref: library/sys sys flags gil16475334
Ref: 4c8d16475334
Ref: library/sys sys flags thread_inherit_context16475584
Ref: 17616475584
Ref: library/sys sys flags context_aware_warnings16475914
Ref: 18b16475914
Ref: library/sys sys float_info16477422
Ref: 1e2b16477422
Ref: library/sys sys float_info epsilon16478410
Ref: 4c8f16478410
Ref: library/sys sys float_info dig16479213
Ref: 4c9016479213
Ref: library/sys sys float_info mant_dig16479727
Ref: 4c9116479727
Ref: library/sys sys float_info max16480222
Ref: 4c9216480222
Ref: library/sys sys float_info max_exp16480608
Ref: 4c9316480608
Ref: library/sys sys float_info max_10_exp16481111
Ref: 4c9416481111
Ref: library/sys sys float_info min16481612
Ref: 4c9516481612
Ref: library/sys sys float_info min_exp16482424
Ref: 4c9616482424
Ref: library/sys sys float_info min_10_exp16482917
Ref: 4c9716482917
Ref: library/sys sys float_info radix16483314
Ref: 4c9816483314
Ref: library/sys sys float_info rounds16483686
Ref: 4c9916483686
Ref: library/sys sys float_repr_style16486618
Ref: 151616486618
Ref: library/sys sys getallocatedblocks16487266
Ref: 11cd16487266
Ref: library/sys sys getunicodeinternedsize16487897
Ref: 4c9a16487897
Ref: library/sys sys getandroidapilevel16488040
Ref: d8716488040
Ref: library/sys sys getdefaultencoding16488386
Ref: 4c9b16488386
Ref: library/sys sys getdlopenflags16488557
Ref: 172c16488557
Ref: library/sys sys getfilesystemencoding16488871
Ref: e5716488871
Ref: library/sys sys getfilesystemencodeerrors16490669
Ref: ee616490669
Ref: library/sys sys get_int_max_str_digits16491588
Ref: 187e16491588
Ref: library/sys sys getrefcount16491817
Ref: 2d016491817
Ref: library/sys sys getrecursionlimit16492819
Ref: 6eb16492819
Ref: library/sys sys getsizeof16493286
Ref: 1b3a16493286
Ref: library/sys sys getswitchinterval16494393
Ref: b4716494393
Ref: library/sys sys _getframe16494571
Ref: 8f116494571
Ref: library/sys sys _getframemodulename16495399
Ref: 1b3e16495399
Ref: library/sys sys getobjects16496142
Ref: 29016496142
Ref: library/sys sys getprofile16497267
Ref: 15fe16497267
Ref: library/sys sys gettrace16497406
Ref: 15ff16497406
Ref: library/sys sys getwindowsversion16497896
Ref: ee716497896
Ref: library/sys sys get_asyncgen_hooks16500823
Ref: 1c2116500823
Ref: library/sys sys get_coroutine_origin_tracking_depth16501576
Ref: d8816501576
Ref: library/sys sys hash_info16501931
Ref: 120516501931
Ref: library/sys sys hash_info width16502193
Ref: 4c9d16502193
Ref: library/sys sys hash_info modulus16502280
Ref: 265e16502280
Ref: library/sys sys hash_info inf16502379
Ref: 4c9e16502379
Ref: library/sys sys hash_info nan16502473
Ref: 4c9f16502473
Ref: library/sys sys hash_info imag16502554
Ref: 4ca016502554
Ref: library/sys sys hash_info algorithm16502664
Ref: 4ca116502664
Ref: library/sys sys hash_info hash_bits16502794
Ref: 4ca216502794
Ref: library/sys sys hash_info seed_bits16502893
Ref: 4ca316502893
Ref: library/sys sys hash_info cutoff16502992
Ref: 4ca416502992
Ref: library/sys sys hexversion16503253
Ref: 4ca516503253
Ref: library/sys sys implementation16504262
Ref: 73b16504262
Ref: library/sys sys int_info16507324
Ref: 14af16507324
Ref: library/sys sys int_info bits_per_digit16507516
Ref: 4ca716507516
Ref: library/sys sys int_info sizeof_digit16507702
Ref: 4ca816507702
Ref: library/sys sys int_info default_max_str_digits16507815
Ref: 273416507815
Ref: library/sys sys int_info str_digits_check_threshold16508001
Ref: 4ca916508001
Ref: library/sys sys __interactivehook__16508401
Ref: 11ce16508401
Ref: library/sys sys intern16509046
Ref: 14f716509046
Ref: library/sys sys _is_gil_enabled16510032
Ref: 4caa16510032
Ref: library/sys sys is_finalizing16510312
Ref: c8416510312
Ref: library/sys sys _jit16510575
Ref: 29516510575
Ref: library/sys sys _jit is_available16510936
Ref: 44d16510936
Ref: library/sys sys _jit is_enabled16511306
Ref: 44e16511306
Ref: library/sys sys _jit is_active16511743
Ref: 18c616511743
Ref: library/sys sys last_exc16513073
Ref: 6e516513073
Ref: library/sys sys _is_immortal16513651
Ref: 29116513651
Ref: library/sys sys _is_interned16514222
Ref: 55916514222
Ref: library/sys sys last_type16514494
Ref: 6e616514494
Ref: library/sys sys last_value16514523
Ref: 6e716514523
Ref: library/sys sys last_traceback16514553
Ref: 6e816514553
Ref: library/sys sys maxsize16514787
Ref: 13e116514787
Ref: library/sys sys maxunicode16515064
Ref: 125c16515064
Ref: library/sys sys meta_path16515510
Ref: f2b16515510
Ref: library/sys sys modules16516809
Ref: 179116516809
Ref: library/sys sys orig_argv16517422
Ref: a4516517422
Ref: library/sys sys path16517883
Ref: 3e216517883
Ref: library/sys sys path_hooks16519318
Ref: 122916519318
Ref: library/sys sys path_importer_cache16519776
Ref: 7fa16519776
Ref: library/sys sys platform16520292
Ref: 29316520292
Ref: library/sys sys platlibdir16522977
Ref: b3616522977
Ref: library/sys sys prefix16523980
Ref: 3e516523980
Ref: library/sys sys ps116525087
Ref: 219016525087
Ref: library/sys sys ps216525110
Ref: 219116525110
Ref: library/sys sys setdlopenflags16525638
Ref: 133b16525638
Ref: library/sys sys set_int_max_str_digits16526240
Ref: 178916526240
Ref: library/sys sys setprofile16526478
Ref: 171c16526478
Ref: library/sys sys setrecursionlimit16529177
Ref: 6ea16529177
Ref: library/sys sys setswitchinterval16530152
Ref: b4816530152
Ref: library/sys sys settrace16530908
Ref: 2e316530908
Ref: library/sys sys set_asyncgen_hooks16535959
Ref: 19fc16535959
Ref: library/sys sys set_coroutine_origin_tracking_depth16537099
Ref: d8916537099
Ref: library/sys sys activate_stack_trampoline16537920
Ref: 69a16537920
Ref: library/sys sys deactivate_stack_trampoline16538355
Ref: 69b16538355
Ref: library/sys sys is_stack_trampoline_active16538609
Ref: 69c16538609
Ref: library/sys sys remote_exec16538794
Ref: 16e16538794
Ref: library/sys sys _enablelegacywindowsfsencoding16540452
Ref: 33c16540452
Ref: library/sys sys stdin16541454
Ref: 75f16541454
Ref: library/sys sys stdout16541479
Ref: cd116541479
Ref: library/sys sys stderr16541505
Ref: b3716541505
Ref: library/sys sys __stdin__16544966
Ref: 4cad16544966
Ref: library/sys sys __stdout__16544995
Ref: 2d7716544995
Ref: library/sys sys __stderr__16545025
Ref: 4a5816545025
Ref: library/sys sys stdlib_module_names16546232
Ref: a4616546232
Ref: library/sys sys thread_info16546972
Ref: 136c16546972
Ref: library/sys sys thread_info name16547108
Ref: 4cae16547108
Ref: library/sys sys thread_info lock16547462
Ref: 4caf16547462
Ref: library/sys sys thread_info version16547761
Ref: 4cb016547761
Ref: library/sys sys tracebacklimit16547958
Ref: 19a416547958
Ref: library/sys sys unraisablehook16548331
Ref: 50716548331
Ref: library/sys sys version16550143
Ref: 49c16550143
Ref: library/sys sys api_version16550593
Ref: 4cb116550593
Ref: library/sys sys version_info16550892
Ref: 8b016550892
Ref: library/sys sys warnoptions16551583
Ref: 3f316551583
Ref: library/sys sys winver16551800
Ref: 4cb316551800
Ref: library/sys sys _xoptions16552446
Ref: 218c16552446
Ref: library/sys c9916553333
Ref: 4c8e16553333
Ref: sys --- システム固有のパラメーターと関数-Footnote-116553559
Ref: sys --- システム固有のパラメーターと関数-Footnote-216553601
Ref: sys --- システム固有のパラメーターと関数-Footnote-316553643
Ref: sys --- システム固有のパラメーターと関数-Footnote-416553685
Ref: sys --- システム固有のパラメーターと関数-Footnote-516553790
Ref: sys --- システム固有のパラメーターと関数-Footnote-616553832
Ref: sys --- システム固有のパラメーターと関数-Footnote-716553874
Ref: sys --- システム固有のパラメーターと関数-Footnote-816553916
Ref: sys --- システム固有のパラメーターと関数-Footnote-916553958
Ref: sys --- システム固有のパラメーターと関数-Footnote-1016554000
Ref: sys --- システム固有のパラメーターと関数-Footnote-1116554043
Ref: sys --- システム固有のパラメーターと関数-Footnote-1216554086
Ref: sys --- システム固有のパラメーターと関数-Footnote-1316554129
Ref: sys --- システム固有のパラメーターと関数-Footnote-1416554172
Ref: sys --- システム固有のパラメーターと関数-Footnote-1516554215
Ref: sys --- システム固有のパラメーターと関数-Footnote-1616554258
Ref: sys --- システム固有のパラメーターと関数-Footnote-1716554301
Ref: sys --- システム固有のパラメーターと関数-Footnote-1816554382
Ref: sys --- システム固有のパラメーターと関数-Footnote-1916554425
Ref: sys --- システム固有のパラメーターと関数-Footnote-2016554468
Ref: sys --- システム固有のパラメーターと関数-Footnote-2116554511
Node: sys monitoring --- 実行イベントモニタリング16554554
Ref: library/sys monitoring doc16554823
Ref: 4cb416554823
Ref: library/sys monitoring module-sys monitoring16554823
Ref: e016554823
Ref: library/sys monitoring sys-monitoring-execution-event-monitoring16554823
Ref: 4cb516554823
Ref: library/sys monitoring translation-repo16554823
Ref: 4cb616554823
Node: Tool identifiers16555902
Ref: library/sys monitoring tool-identifiers16556025
Ref: 4cb716556025
Node: Registering and using tools16556582
Ref: library/sys monitoring registering-and-using-tools16556662
Ref: 4cba16556662
Ref: library/sys monitoring sys monitoring use_tool_id16556737
Ref: 4cbb16556737
Ref: library/sys monitoring sys monitoring clear_tool_id16556995
Ref: 198e16556995
Ref: library/sys monitoring sys monitoring free_tool_id16557149
Ref: 4cbc16557149
Ref: library/sys monitoring sys monitoring get_tool16557357
Ref: 4cbd16557357
Node: Events16557861
Ref: library/sys monitoring events16558018
Ref: 4cb816558018
Ref: library/sys monitoring monitoring-event-BRANCH_LEFT16558088
Ref: 29716558088
Ref: library/sys monitoring monitoring-event-BRANCH_RIGHT16558417
Ref: 29816558417
Ref: library/sys monitoring monitoring-event-CALL16558514
Ref: 1a1a16558514
Ref: library/sys monitoring monitoring-event-C_RAISE16558624
Ref: 4cbe16558624
Ref: library/sys monitoring monitoring-event-C_RETURN16558786
Ref: 4cbf16558786
Ref: library/sys monitoring monitoring-event-EXCEPTION_HANDLED16558938
Ref: 4cc016558938
Ref: library/sys monitoring monitoring-event-INSTRUCTION16559032
Ref: 4cc116559032
Ref: library/sys monitoring monitoring-event-JUMP16559137
Ref: 4cc216559137
Ref: library/sys monitoring monitoring-event-LINE16559250
Ref: 4cc316559250
Ref: library/sys monitoring monitoring-event-PY_RESUME16559415
Ref: 4cc416559415
Ref: library/sys monitoring monitoring-event-PY_RETURN16559586
Ref: 4cc516559586
Ref: library/sys monitoring monitoring-event-PY_START16559763
Ref: 4cc616559763
Ref: library/sys monitoring monitoring-event-PY_THROW16559932
Ref: 18ba16559932
Ref: library/sys monitoring monitoring-event-PY_UNWIND16560046
Ref: 4cc716560046
Ref: library/sys monitoring monitoring-event-PY_YIELD16560282
Ref: 4cc816560282
Ref: library/sys monitoring monitoring-event-RAISE16560456
Ref: 19d416560456
Ref: library/sys monitoring monitoring-event-RERAISE16560603
Ref: 4cca16560603
Ref: library/sys monitoring monitoring-event-STOP_ITERATION16560749
Ref: 4cc916560749
Ref: library/sys monitoring monitoring-event-NO_EVENTS16561301
Ref: 4ccc16561301
Node: Local events16561660
Ref: library/sys monitoring local-events16561740
Ref: 4ccd16561740
Ref: library/sys monitoring monitoring-event-local16561740
Ref: 4cce16561740
Node: Deprecated event16562261
Ref: library/sys monitoring deprecated-event16562366
Ref: 4ccf16562366
Node: Ancillary events16562625
Ref: library/sys monitoring ancillary-events16562730
Ref: 4cd016562730
Node: Other events16563152
Ref: library/sys monitoring monitoring-event-global16563265
Ref: 4cd116563265
Ref: library/sys monitoring other-events16563265
Ref: 4cd216563265
Node: The STOP_ITERATION event16563612
Ref: library/sys monitoring the-stop-iteration-event16563700
Ref: 4ccb16563700
Ref: The STOP_ITERATION event-Footnote-116564673
Node: Turning events on and off16564754
Ref: library/sys monitoring turning-events-on-and-off16564925
Ref: 4cd416564925
Node: Setting events globally16565375
Ref: library/sys monitoring setting-events-globally16565491
Ref: 4cd516565491
Ref: library/sys monitoring sys monitoring get_events16565643
Ref: 4cd616565643
Ref: library/sys monitoring sys monitoring set_events16565774
Ref: 4cd716565774
Node: Per code object events16566025
Ref: library/sys monitoring per-code-object-events16566166
Ref: 4cd816566166
Ref: library/sys monitoring sys monitoring get_local_events16566495
Ref: 4cd916566495
Ref: library/sys monitoring sys monitoring set_local_events16566653
Ref: 4cda16566653
Node: Disabling events16566931
Ref: library/sys monitoring disabling-events16567040
Ref: 4cdb16567040
Ref: library/sys monitoring sys monitoring DISABLE16567095
Ref: 4cd316567095
Ref: library/sys monitoring sys monitoring restart_events16567935
Ref: 4cdc16567935
Node: Registering callback functions16568098
Ref: library/sys monitoring callbacks16568254
Ref: 4cb916568254
Ref: library/sys monitoring registering-callback-functions16568254
Ref: 4cdd16568254
Ref: library/sys monitoring sys monitoring register_callback16568337
Ref: 4ae516568337
Node: Callback function arguments16569303
Ref: library/sys monitoring callback-function-arguments16569397
Ref: 4cde16569397
Ref: library/sys monitoring sys monitoring MISSING16569474
Ref: 4cdf16569474
Node: sysconfig --- Python の構成情報へのアクセスを提供する16571510
Ref: library/sysconfig doc16571766
Ref: 4ce016571766
Ref: library/sysconfig module-sysconfig16571766
Ref: e116571766
Ref: library/sysconfig sysconfig-provide-access-to-python-s-configuration-information16571766
Ref: 4ce116571766
Ref: library/sysconfig translation-repo16571766
Ref: 4ce216571766
Ref: sysconfig --- Python の構成情報へのアクセスを提供する-Footnote-116572521
Node: 構成変数16572587
Ref: library/sysconfig configuration-variables16572738
Ref: 4ce316572738
Ref: library/sysconfig sysconfig get_config_vars16573277
Ref: 29a16573277
Ref: library/sysconfig sysconfig get_config_var16573696
Ref: 17516573696
Node: インストールパス16574161
Ref: library/sysconfig id116574332
Ref: 4ce416574332
Ref: library/sysconfig installation-paths16574332
Ref: 44716574332
Node: User scheme16577026
Ref: library/sysconfig sysconfig-user-scheme16577196
Ref: 219216577196
Ref: library/sysconfig user-scheme16577196
Ref: 4ce516577196
Node: posix_user16577721
Ref: library/sysconfig posix-user16577795
Ref: 4ce616577795
Node: nt_user16578653
Ref: library/sysconfig nt-user16578754
Ref: 4ce716578754
Node: osx_framework_user16579600
Ref: library/sysconfig osx-framework-user16579682
Ref: 4ce816579682
Node: Home scheme16580536
Ref: library/sysconfig home-scheme16580695
Ref: 4ce916580695
Ref: library/sysconfig sysconfig-home-scheme16580695
Ref: 4cea16580695
Node: posix_home16581352
Ref: library/sysconfig posix-home16581410
Ref: 4ceb16581410
Node: Prefix scheme16582274
Ref: library/sysconfig prefix-scheme16582449
Ref: 4cec16582449
Ref: library/sysconfig sysconfig-prefix-scheme16582449
Ref: 4ced16582449
Node: posix_prefix16584047
Ref: library/sysconfig posix-prefix16584120
Ref: 4cee16584120
Node: nt16585063
Ref: library/sysconfig nt16585136
Ref: 4cef16585136
Node: Installation path functions16585991
Ref: library/sysconfig installation-path-functions16586176
Ref: 4cf016586176
Ref: library/sysconfig sysconfig get_scheme_names16586333
Ref: 4cf116586333
Ref: library/sysconfig sysconfig get_default_scheme16586468
Ref: 1c1216586468
Ref: library/sysconfig sysconfig get_preferred_scheme16586836
Ref: 8a016586836
Ref: library/sysconfig sysconfig _get_preferred_schemes16587430
Ref: 4cf216587430
Ref: library/sysconfig sysconfig get_path_names16588098
Ref: 4cf316588098
Ref: library/sysconfig sysconfig get_path16588234
Ref: 154916588234
Ref: library/sysconfig sysconfig get_paths16589763
Ref: 33e16589763
Node: その他の関数<3>16590558
Ref: library/sysconfig other-functions16590766
Ref: 4cf416590766
Ref: library/sysconfig sysconfig get_python_version16590819
Ref: 145f16590819
Ref: library/sysconfig sysconfig get_platform16591021
Ref: 145e16591021
Ref: library/sysconfig sysconfig is_python_build16592115
Ref: 32b16592115
Ref: library/sysconfig sysconfig parse_config_h16592500
Ref: 4cf516592500
Ref: library/sysconfig sysconfig get_config_h_filename16592994
Ref: 4cf616592994
Ref: library/sysconfig sysconfig get_makefile_filename16593096
Ref: 4cf716593096
Ref: library/sysconfig sysconfig-cli16593195
Ref: 4cf816593195
Node: コマンドラインでの使用<7>16593196
Ref: library/sysconfig command-line-usage16593368
Ref: 4cf916593368
Ref: library/sysconfig using-sysconfig-as-a-script16593368
Ref: 4cfa16593368
Node: builtins --- 組み込みオブジェクト16594436
Ref: library/builtins doc16594686
Ref: 4cfb16594686
Ref: library/builtins builtins-built-in-objects16594686
Ref: 4cfc16594686
Ref: library/builtins module-builtins16594686
Ref: 1316594686
Ref: library/builtins translation-repo16594686
Ref: 4cfd16594686
Node: __main__ --- トップレベルのコード環境16596555
Ref: library/__main__ doc16596764
Ref: 4cfe16596764
Ref: library/__main__ main-top-level-code-environment16596764
Ref: 4cff16596764
Ref: library/__main__ module-__main__16596764
Ref: 116596764
Ref: library/__main__ translation-repo16596764
Ref: 4d0016596764
Node: __name__ == '__main__'16597793
Ref: library/__main__ name-equals-main16597940
Ref: 4d0116597940
Ref: library/__main__ name-main16597940
Ref: 4d0216597940
Node: 「トップレベルのスクリプト環境」とは16598971
Ref: library/__main__ what-is-the-top-level-code-environment16599114
Ref: 4d0316599114
Node: 通常の使われ方16601729
Ref: library/__main__ idiomatic-usage16601923
Ref: 4d0416601923
Node: パッケージングで考慮すべき点16604460
Ref: library/__main__ packaging-considerations16604591
Ref: 4d0516604591
Ref: パッケージングで考慮すべき点-Footnote-116606108
Ref: パッケージングで考慮すべき点-Footnote-216606137
Node: __main__ py in Python Packages16606175
Ref: library/__main__ main-py-in-python-packages16606346
Ref: 4d0616606346
Node: 通常の使われ方<2>16607775
Ref: library/__main__ id116607866
Ref: 4d0716607866
Node: import __main__16609198
Ref: library/__main__ import-main16609338
Ref: 4d0816609338
Node: warnings --- 警告の制御16612220
Ref: library/warnings doc16612420
Ref: 4d0916612420
Ref: library/warnings module-warnings16612420
Ref: 11916612420
Ref: library/warnings translation-repo16612420
Ref: 4d0a16612420
Ref: library/warnings warnings-warning-control16612420
Ref: 4d0b16612420
Ref: warnings --- 警告の制御-Footnote-116615480
Node: 警告カテゴリ16615548
Ref: library/warnings id116615658
Ref: 4d0f16615658
Ref: library/warnings warning-categories16615658
Ref: 276816615658
Node: 警告フィルタ16620273
Ref: library/warnings the-warnings-filter16620425
Ref: 4d1016620425
Ref: library/warnings warning-filter16620425
Ref: 1b216620425
Node: Repeated Warning Suppression Criteria16624108
Ref: library/warnings id216624235
Ref: 4d1116624235
Ref: library/warnings repeated-warning-suppression-criteria16624235
Ref: 4d1216624235
Node: Describing Warning Filters16624870
Ref: library/warnings describing-warning-filters16625042
Ref: 218516625042
Ref: library/warnings id316625042
Ref: 4d1316625042
Node: デフォルトの警告フィルタ16626758
Ref: library/warnings default-warning-filter16626922
Ref: 4d1416626922
Ref: library/warnings id416626922
Ref: 4d1516626922
Node: Overriding the default filter16628183
Ref: library/warnings overriding-the-default-filter16628312
Ref: 4d1616628312
Ref: library/warnings warning-disable16628312
Ref: 4d1716628312
Node: 一時的に警告を抑制する16629747
Ref: library/warnings temporarily-suppressing-warnings16629899
Ref: 4d1816629899
Ref: library/warnings warning-suppress16629899
Ref: 4d1916629899
Node: 警告のテスト16630974
Ref: library/warnings testing-warnings16631154
Ref: 4d1b16631154
Ref: library/warnings warning-testing16631154
Ref: 4d1c16631154
Node: Updating Code For New Versions of Dependencies16633407
Ref: library/warnings updating-code-for-new-versions-of-dependencies16633575
Ref: 4d1d16633575
Ref: library/warnings warning-ignored16633575
Ref: 49a516633575
Node: 利用可能な関数16634949
Ref: library/warnings available-functions16635150
Ref: 4d1e16635150
Ref: library/warnings warning-functions16635150
Ref: 4d1f16635150
Ref: library/warnings warnings warn16635208
Ref: 173716635208
Ref: library/warnings warnings warn_explicit16638012
Ref: f0116638012
Ref: library/warnings warnings showwarning16639575
Ref: 4d0e16639575
Ref: library/warnings warnings formatwarning16640355
Ref: 1e5516640355
Ref: library/warnings warnings filterwarnings16640880
Ref: 16c716640880
Ref: library/warnings warnings simplefilter16641712
Ref: 8d116641712
Ref: library/warnings warnings resetwarnings16642229
Ref: 4d0d16642229
Ref: library/warnings warnings deprecated16642590
Ref: 48916642590
Ref: 利用可能な関数-Footnote-116644464
Node: 利用可能なコンテキストマネージャー16644506
Ref: library/warnings available-context-managers16644698
Ref: 4d2016644698
Ref: library/warnings warnings catch_warnings16644806
Ref: 17a16644806
Node: Concurrent safety of Context Managers16647279
Ref: library/warnings concurrent-safety-of-context-managers16647441
Ref: 4d2116647441
Ref: library/warnings warning-concurrent-safe16647441
Ref: 4d1a16647441
Node: dataclasses --- データクラス16650492
Ref: library/dataclasses doc16650708
Ref: 4d2216650708
Ref: library/dataclasses dataclasses-data-classes16650708
Ref: 4d2316650708
Ref: library/dataclasses module-dataclasses16650708
Ref: 3316650708
Ref: library/dataclasses translation-repo16650708
Ref: 4d2416650708
Ref: dataclasses --- データクラス-Footnote-116652700
Ref: dataclasses --- データクラス-Footnote-216652771
Ref: dataclasses --- データクラス-Footnote-316652813
Node: モジュールの内容<5>16652855
Ref: library/dataclasses module-contents16652983
Ref: 4d2516652983
Ref: library/dataclasses dataclasses dataclass16653044
Ref: 4e116653044
Ref: library/dataclasses dataclasses field16663727
Ref: 19ba16663727
Ref: library/dataclasses dataclasses Field16668516
Ref: 19bb16668516
Ref: library/dataclasses dataclasses InitVar16669336
Ref: 1c1116669336
Ref: library/dataclasses dataclasses fields16669747
Ref: 199516669747
Ref: library/dataclasses dataclasses asdict16670280
Ref: 1af616670280
Ref: library/dataclasses dataclasses astuple16671323
Ref: 1aff16671323
Ref: library/dataclasses dataclasses make_dataclass16672055
Ref: 18c116672055
Ref: library/dataclasses dataclasses replace16674238
Ref: 1acb16674238
Ref: library/dataclasses dataclasses is_dataclass16675732
Ref: 1c7416675732
Ref: library/dataclasses dataclasses MISSING16676355
Ref: 4d2816676355
Ref: library/dataclasses dataclasses KW_ONLY16676506
Ref: 4d2716676506
Ref: library/dataclasses dataclasses FrozenInstanceError16677463
Ref: 17ba16677463
Ref: モジュールの内容<5>-Footnote-116677841
Node: 初期化後の処理16677896
Ref: library/dataclasses id116678048
Ref: 4d2b16678048
Ref: library/dataclasses post-init-processing16678048
Ref: 4d2c16678048
Ref: library/dataclasses dataclasses __post_init__16678104
Ref: 4d2a16678104
Node: クラス変数16680036
Ref: library/dataclasses class-variables16680182
Ref: 4d2d16680182
Ref: library/dataclasses dataclasses-class-variables16680182
Ref: 4d2e16680182
Ref: クラス変数-Footnote-116680735
Node: 初期化限定変数16680777
Ref: library/dataclasses dataclasses-init-only-variables16680935
Ref: 4d2916680935
Ref: library/dataclasses init-only-variables16680935
Ref: 4d2f16680935
Node: 凍結されたインスタンス16682223
Ref: library/dataclasses dataclasses-frozen16682375
Ref: 4d2616682375
Ref: library/dataclasses frozen-instances16682375
Ref: 4d3016682375
Node: 継承<2>16682995
Ref: library/dataclasses dataclasses-inheritance16683176
Ref: 4d3116683176
Ref: library/dataclasses inheritance16683176
Ref: 4d3216683176
Node: Re-ordering of keyword-only parameters in __init__16684218
Ref: library/dataclasses re-ordering-of-keyword-only-parameters-in-init16684402
Ref: 4d3316684402
Node: デフォルトファクトリ関数16685872
Ref: library/dataclasses default-factory-functions16686074
Ref: 4d3416686074
Node: 可変なデフォルト値16686702
Ref: library/dataclasses mutable-default-values16686877
Ref: 4d3516686877
Node: Descriptor-typed fields16689120
Ref: library/dataclasses descriptor-typed-fields16689250
Ref: 4d3616689250
Node: contextlib --- with 文コンテキスト用ユーティリティ16691218
Ref: library/contextlib doc16691435
Ref: 4d3716691435
Ref: library/contextlib contextlib-utilities-for-with-statement-contexts16691435
Ref: 4d3816691435
Ref: library/contextlib module-contextlib16691435
Ref: 2716691435
Ref: library/contextlib translation-repo16691435
Ref: 4d3916691435
Ref: contextlib --- with 文コンテキスト用ユーティリティ-Footnote-116692207
Node: ユーティリティ16692277
Ref: library/contextlib utilities16692427
Ref: 4d3a16692427
Ref: library/contextlib contextlib AbstractContextManager16692537
Ref: e8e16692537
Ref: library/contextlib contextlib AbstractAsyncContextManager16693006
Ref: d2416693006
Ref: library/contextlib contextlib contextmanager16693521
Ref: 141f16693521
Ref: library/contextlib contextlib asynccontextmanager16697407
Ref: d2316697407
Ref: library/contextlib contextlib closing16700012
Ref: 15a516700012
Ref: library/contextlib contextlib aclosing16701408
Ref: 9f216701408
Ref: library/contextlib simplifying-support-for-single-optional-context-managers16702838
Ref: 4d3b16702838
Ref: library/contextlib contextlib nullcontext16702838
Ref: 9f316702838
Ref: library/contextlib contextlib suppress16704660
Ref: 112d16704660
Ref: library/contextlib contextlib redirect_stdout16706347
Ref: feb16706347
Ref: library/contextlib contextlib redirect_stderr16708182
Ref: fea16708182
Ref: library/contextlib contextlib chdir16708507
Ref: 82016708507
Ref: library/contextlib contextlib ContextDecorator16709604
Ref: 141e16709604
Ref: library/contextlib contextlib AsyncContextDecorator16712357
Ref: 9f416712357
Ref: library/contextlib contextlib ExitStack16713488
Ref: d2216713488
Ref: library/contextlib contextlib ExitStack enter_context16715715
Ref: 7ee16715715
Ref: library/contextlib contextlib ExitStack push16716390
Ref: 4d3d16716390
Ref: library/contextlib contextlib ExitStack callback16717301
Ref: c7a16717301
Ref: library/contextlib contextlib ExitStack pop_all16717790
Ref: 4d3e16717790
Ref: library/contextlib contextlib ExitStack close16718922
Ref: 4d3f16718922
Ref: library/contextlib contextlib AsyncExitStack16719277
Ref: d2516719277
Ref: library/contextlib contextlib AsyncExitStack enter_async_context16719741
Ref: 7ef16719741
Ref: library/contextlib contextlib AsyncExitStack push_async_exit16720143
Ref: 4d4116720143
Ref: library/contextlib contextlib AsyncExitStack push_async_callback16720328
Ref: c7b16720328
Ref: library/contextlib contextlib AsyncExitStack aclose16720500
Ref: 4d4016720500
Node: 例とレシピ<3>16721116
Ref: library/contextlib examples-and-recipes16721374
Ref: 4d4216721374
Node: 可変数個のコンテキストマネージャーをサポートする16721879
Ref: library/contextlib supporting-a-variable-number-of-context-managers16722073
Ref: 4d4316722073
Node: __enter__ メソッドからの例外をキャッチする16723397
Ref: library/contextlib catching-exceptions-from-enter-methods16723643
Ref: 4d4416723643
Node: __enter__ 実装内のクリーンアップ16725002
Ref: library/contextlib cleaning-up-in-an-enter-implementation16725231
Ref: 4d4516725231
Node: try-finally + flag 変数パターンを置き換える16727195
Ref: library/contextlib replacing-any-use-of-try-finally-and-flag-variables16727444
Ref: 4d4616727444
Node: コンテキストマネージャーを関数デコレーターとして使う16730227
Ref: library/contextlib using-a-context-manager-as-a-function-decorator16730424
Ref: 4d4716730424
Ref: コンテキストマネージャーを関数デコレーターとして使う-Footnote-116732456
Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ16732498
Ref: library/contextlib single-use-reusable-and-reentrant-cms16732726
Ref: 112f16732726
Ref: library/contextlib single-use-reusable-and-reentrant-context-managers16732726
Ref: 4d4816732726
Node: リエントラントなコンテキストマネージャ16734691
Ref: library/contextlib reentrant-cms16734944
Ref: 4d3c16734944
Ref: library/contextlib reentrant-context-managers16734944
Ref: 4d4916734944
Node: 再利用可能なコンテキストマネージャ16736915
Ref: library/contextlib reusable-cms16737168
Ref: 4d4a16737168
Ref: library/contextlib reusable-context-managers16737168
Ref: 4d4b16737168
Node: abc --- 抽象基底クラス16740471
Ref: library/abc doc16740686
Ref: 4d4c16740686
Ref: library/abc abc-abstract-base-classes16740686
Ref: 4d4d16740686
Ref: library/abc module-abc16740686
Ref: 416740686
Ref: library/abc translation-repo16740686
Ref: 4d4e16740686
Ref: library/abc abc ABC16742036
Ref: 111f16742036
Ref: library/abc abc ABCMeta16742946
Ref: 112016742946
Ref: library/abc abc ABCMeta register16743919
Ref: 129e16743919
Ref: library/abc abc ABCMeta __subclasshook__16744724
Ref: 2a1016744724
Ref: library/abc abc abstractmethod16747676
Ref: 129b16747676
Ref: library/abc abc abstractclassmethod16750890
Ref: 129c16750890
Ref: library/abc abc abstractstaticmethod16751748
Ref: 129d16751748
Ref: library/abc abc abstractproperty16752604
Ref: 129a16752604
Ref: library/abc abc get_cache_token16754300
Ref: 111e16754300
Ref: library/abc abc update_abstractmethods16754797
Ref: 4d4f16754797
Ref: abc --- 抽象基底クラス-Footnote-116755462
Ref: abc --- 抽象基底クラス-Footnote-216755525
Ref: abc --- 抽象基底クラス-Footnote-316755567
Ref: abc --- 抽象基底クラス-Footnote-416755609
Node: atexit --- 終了ハンドラー16755765
Ref: library/atexit doc16755977
Ref: 4d5016755977
Ref: library/atexit atexit-exit-handlers16755977
Ref: 4d5116755977
Ref: library/atexit module-atexit16755977
Ref: d16755977
Ref: library/atexit translation-repo16755977
Ref: 4d5216755977
Ref: library/atexit atexit register16757174
Ref: a8216757174
Ref: library/atexit atexit unregister16759229
Ref: 17ef16759229
Node: atexit Example16759908
Ref: library/atexit atexit-example16759991
Ref: 4d5316759991
Ref: library/atexit id116759991
Ref: 4d5416759991
Node: traceback --- スタックトレースの表示または取得16761450
Ref: library/traceback doc16761667
Ref: 4d5516761667
Ref: library/traceback module-traceback16761667
Ref: 10516761667
Ref: library/traceback traceback-print-or-retrieve-a-stack-traceback16761667
Ref: 4d5616761667
Ref: library/traceback translation-repo16761667
Ref: 4d5716761667
Ref: traceback --- スタックトレースの表示または取得-Footnote-116763873
Node: モジュールレベルの関数<2>16763942
Ref: library/traceback module-level-functions16764123
Ref: 4d5816764123
Ref: library/traceback traceback print_tb16764201
Ref: 108916764201
Ref: library/traceback traceback print_exception16765173
Ref: a5316765173
Ref: library/traceback traceback print_exc16766885
Ref: 1c8116766885
Ref: library/traceback traceback print_last16767069
Ref: 4d5916767069
Ref: library/traceback traceback print_stack16767382
Ref: 108a16767382
Ref: library/traceback traceback extract_tb16768145
Ref: 4d5a16768145
Ref: library/traceback traceback extract_stack16768697
Ref: 4d5b16768697
Ref: library/traceback traceback print_list16769055
Ref: 195116769055
Ref: library/traceback traceback format_list16769359
Ref: 4d5c16769359
Ref: library/traceback traceback format_exception_only16770053
Ref: a5216770053
Ref: library/traceback traceback format_exception16771465
Ref: a5116771465
Ref: library/traceback traceback format_exc16772285
Ref: 4d5d16772285
Ref: library/traceback traceback format_tb16772485
Ref: 4c2616772485
Ref: library/traceback traceback format_stack16772610
Ref: 4d5e16772610
Ref: library/traceback traceback clear_frames16772744
Ref: 11da16772744
Ref: library/traceback traceback walk_stack16772990
Ref: 108516772990
Ref: library/traceback traceback walk_tb16773547
Ref: 108616773547
Node: TracebackException オブジェクト16773790
Ref: library/traceback tracebackexception-objects16774011
Ref: 4d6016774011
Ref: library/traceback traceback TracebackException16774510
Ref: 56316774510
Ref: library/traceback traceback TracebackException __cause__16775920
Ref: 4d6216775920
Ref: library/traceback traceback TracebackException __context__16776027
Ref: 4d6116776027
Ref: library/traceback traceback TracebackException exceptions16776138
Ref: 4d6416776138
Ref: library/traceback traceback TracebackException __suppress_context__16776417
Ref: 4d6316776417
Ref: library/traceback traceback TracebackException __notes__16776532
Ref: 4d6516776532
Ref: library/traceback traceback TracebackException stack16776842
Ref: 4d6616776842
Ref: library/traceback traceback TracebackException exc_type16776940
Ref: 56416776940
Ref: library/traceback traceback TracebackException exc_type_str16777064
Ref: 56216777064
Ref: library/traceback traceback TracebackException filename16777198
Ref: 4d6716777198
Ref: library/traceback traceback TracebackException lineno16777309
Ref: 4d6816777309
Ref: library/traceback traceback TracebackException end_lineno16777406
Ref: 4d6916777406
Ref: library/traceback traceback TracebackException text16777594
Ref: 4d6a16777594
Ref: library/traceback traceback TracebackException offset16777692
Ref: 4d6b16777692
Ref: library/traceback traceback TracebackException end_offset16777813
Ref: 4d6c16777813
Ref: library/traceback traceback TracebackException msg16778010
Ref: 4d6d16778010
Ref: library/traceback traceback TracebackException from_exception16778113
Ref: 4d6e16778113
Ref: library/traceback traceback TracebackException print16778673
Ref: 8b416778673
Ref: library/traceback traceback TracebackException format16778887
Ref: 4d6f16778887
Ref: library/traceback traceback TracebackException format_exception_only16779400
Ref: 56516779400
Node: StackSummary オブジェクト16780509
Ref: library/traceback stacksummary-objects16780725
Ref: 4d7016780725
Ref: library/traceback traceback StackSummary16780953
Ref: 108716780953
Ref: library/traceback traceback StackSummary extract16780992
Ref: 4d5f16780992
Ref: library/traceback traceback StackSummary from_list16782010
Ref: 4d7116782010
Ref: library/traceback traceback StackSummary format16782321
Ref: 4d7216782321
Ref: library/traceback traceback StackSummary format_frame_summary16782966
Ref: 8b316782966
Node: FrameSummary オブジェクト16783377
Ref: library/traceback framesummary-objects16783600
Ref: 4d7316783600
Ref: library/traceback traceback FrameSummary16783804
Ref: 108816783804
Ref: library/traceback traceback FrameSummary filename16784728
Ref: 4d7516784728
Ref: library/traceback traceback FrameSummary lineno16784931
Ref: 4d7616784931
Ref: library/traceback traceback FrameSummary name16785021
Ref: 4d7716785021
Ref: library/traceback traceback FrameSummary line16785157
Ref: 4d7416785157
Ref: library/traceback traceback FrameSummary end_lineno16785366
Ref: 4d7816785366
Ref: library/traceback traceback FrameSummary colno16785656
Ref: 4d7916785656
Ref: library/traceback traceback FrameSummary end_colno16785817
Ref: 4d7a16785817
Node: Examples of Using the Module-Level Functions16785987
Ref: library/traceback examples-of-using-the-module-level-functions16786215
Ref: 4d7b16786215
Ref: library/traceback traceback-example16786215
Ref: 4d7c16786215
Node: Examples of Using TracebackException16791776
Ref: library/traceback examples-of-using-tracebackexception16791964
Ref: 4d7d16791964
Node: __future__ --- future 文の定義16794620
Ref: library/__future__ doc16794863
Ref: 4d7e16794863
Ref: library/__future__ future-future-statement-definitions16794863
Ref: 4d7f16794863
Ref: library/__future__ module-__future__16794863
Ref: 016794863
Ref: library/__future__ translation-repo16794863
Ref: 4d8016794863
Ref: __future__ --- future 文の定義-Footnote-116796532
Node: モジュールコンテンツ<3>16796602
Ref: library/__future__ module-contents16796706
Ref: 4d8116796706
Ref: library/__future__ future__ nested_scopes16797383
Ref: 4d8216797383
Ref: library/__future__ future__ generators16797787
Ref: 4d8316797787
Ref: library/__future__ future__ division16798184
Ref: 4d8416798184
Ref: library/__future__ future__ absolute_import16798594
Ref: 4d8516798594
Ref: library/__future__ future__ with_statement16799105
Ref: 4d8616799105
Ref: library/__future__ future__ print_function16799509
Ref: 4d8716799509
Ref: library/__future__ future__ unicode_literals16799911
Ref: 4d8816799911
Ref: library/__future__ future__ generator_stop16800321
Ref: 4d8916800321
Ref: library/__future__ future__ annotations16800741
Ref: 4d8a16800741
Ref: library/__future__ future-classes16801392
Ref: 4d8b16801392
Ref: library/__future__ future__ _Feature16801392
Ref: 262716801392
Ref: library/__future__ future__ _Feature getOptionalRelease16802126
Ref: 4d8c16802126
Ref: library/__future__ future__ _Feature getMandatoryRelease16802282
Ref: 4d8d16802282
Ref: library/__future__ future__ _Feature compiler_flag16803030
Ref: 23f316803030
Ref: モジュールコンテンツ<3>-Footnote-116803685
Ref: モジュールコンテンツ<3>-Footnote-216803727
Ref: モジュールコンテンツ<3>-Footnote-316803769
Ref: モジュールコンテンツ<3>-Footnote-416803811
Ref: モジュールコンテンツ<3>-Footnote-516803853
Ref: モジュールコンテンツ<3>-Footnote-616803895
Ref: モジュールコンテンツ<3>-Footnote-716803937
Ref: モジュールコンテンツ<3>-Footnote-816803979
Ref: モジュールコンテンツ<3>-Footnote-916804021
Ref: モジュールコンテンツ<3>-Footnote-1016804338
Ref: モジュールコンテンツ<3>-Footnote-1116804381
Ref: モジュールコンテンツ<3>-Footnote-1216804424
Node: gc --- ガベージコレクターインターフェース16804467
Ref: library/gc doc16804705
Ref: 4d8e16804705
Ref: library/gc gc-garbage-collector-interface16804705
Ref: 4d8f16804705
Ref: library/gc module-gc16804705
Ref: 6416804705
Ref: library/gc translation-repo16804705
Ref: 4d9016804705
Ref: library/gc gc enable16805915
Ref: 4d9116805915
Ref: library/gc gc disable16806011
Ref: 4d9216806011
Ref: library/gc gc isenabled16806108
Ref: 4d9316806108
Ref: library/gc gc collect16806228
Ref: 1b516806228
Ref: library/gc gc set_debug16807193
Ref: 4d9416807193
Ref: library/gc gc get_debug16807476
Ref: 4d9516807476
Ref: library/gc gc get_objects16807563
Ref: a0816807563
Ref: library/gc gc get_stats16808192
Ref: 2de16808192
Ref: library/gc gc set_threshold16808933
Ref: 2dc16808933
Ref: library/gc gc get_count16810728
Ref: 2dd16810728
Ref: library/gc gc get_threshold16810853
Ref: 2db16810853
Ref: library/gc gc get_referrers16811003
Ref: a0916811003
Ref: library/gc gc get_referents16812320
Ref: a0a16812320
Ref: library/gc gc is_tracked16813331
Ref: 152916813331
Ref: library/gc gc is_finalized16814383
Ref: afd16814383
Ref: library/gc gc freeze16814896
Ref: d3216814896
Ref: library/gc gc unfreeze16815730
Ref: d3316815730
Ref: library/gc gc get_freeze_count16815919
Ref: d3416815919
Ref: library/gc gc garbage16816245
Ref: 13dd16816245
Ref: library/gc gc callbacks16817354
Ref: 12e216817354
Ref: library/gc gc DEBUG_STATS16818975
Ref: 4d9716818975
Ref: library/gc gc DEBUG_COLLECTABLE16819133
Ref: 4d9816819133
Ref: library/gc gc DEBUG_UNCOLLECTABLE16819252
Ref: 13de16819252
Ref: library/gc gc DEBUG_SAVEALL16819781
Ref: 4d9616819781
Ref: library/gc gc DEBUG_LEAK16820047
Ref: 4d9916820047
Ref: gc --- ガベージコレクターインターフェース-Footnote-116820293
Ref: gc --- ガベージコレクターインターフェース-Footnote-216820449
Ref: gc --- ガベージコレクターインターフェース-Footnote-316820536
Node: inspect --- 活動中のオブジェクトを調査する16820578
Ref: library/inspect doc16820843
Ref: 4d9a16820843
Ref: library/inspect inspect-inspect-live-objects16820843
Ref: 4d9b16820843
Ref: library/inspect translation-repo16820843
Ref: 4d9c16820843
Ref: library/inspect module-inspect16820967
Ref: 8216820967
Ref: inspect --- 活動中のオブジェクトを調査する-Footnote-116822334
Node: 型とメンバー16822401
Ref: library/inspect inspect-types16822555
Ref: 1def16822555
Ref: library/inspect types-and-members16822555
Ref: 4d9d16822555
Ref: library/inspect inspect getmembers16843688
Ref: 1c4e16843688
Ref: library/inspect inspect getmembers_static16844463
Ref: 85916844463
Ref: library/inspect inspect getmodulename16845543
Ref: f3816845543
Ref: library/inspect inspect ismodule16846506
Ref: 4d9f16846506
Ref: library/inspect inspect isclass16846630
Ref: 4da016846630
Ref: library/inspect inspect ismethod16846908
Ref: 4da116846908
Ref: library/inspect inspect isfunction16848288
Ref: 4da216848288
Ref: library/inspect inspect ispackage16848544
Ref: 23416848544
Ref: library/inspect inspect isgeneratorfunction16848679
Ref: 1bba16848679
Ref: library/inspect inspect isgenerator16849494
Ref: 4da316849494
Ref: library/inspect inspect iscoroutinefunction16849624
Ref: 30f16849624
Ref: library/inspect inspect markcoroutinefunction16850818
Ref: 6b816850818
Ref: library/inspect inspect iscoroutine16851641
Ref: 101b16851641
Ref: library/inspect inspect isawaitable16851856
Ref: 101c16851856
Ref: library/inspect inspect isasyncgenfunction16852388
Ref: 1bbb16852388
Ref: library/inspect inspect isasyncgen16853230
Ref: 4da416853230
Ref: library/inspect inspect istraceback16853505
Ref: 4da516853505
Ref: library/inspect inspect isframe16853641
Ref: 4da616853641
Ref: library/inspect inspect iscode16853764
Ref: 4da716853764
Ref: library/inspect inspect isbuiltin16853883
Ref: 4da816853883
Ref: library/inspect inspect ismethodwrapper16854061
Ref: 85a16854061
Ref: library/inspect inspect isroutine16854433
Ref: 1c3a16854433
Ref: library/inspect inspect isabstract16854611
Ref: 4da916854611
Ref: library/inspect inspect ismethoddescriptor16854752
Ref: 19ae16854752
Ref: library/inspect inspect isdatadescriptor16856559
Ref: 4daa16856559
Ref: library/inspect inspect isgetsetdescriptor16857531
Ref: 4dab16857531
Ref: library/inspect inspect ismemberdescriptor16857943
Ref: 4dac16857943
Node: ソースコードの情報取得16858380
Ref: library/inspect inspect-source16858625
Ref: 4dad16858625
Ref: library/inspect retrieving-source-code16858625
Ref: 4dae16858625
Ref: library/inspect inspect getdoc16858703
Ref: bf116858703
Ref: library/inspect inspect getcomments16859294
Ref: 199816859294
Ref: library/inspect inspect getfile16859899
Ref: 1ee116859899
Ref: library/inspect inspect getmodule16860208
Ref: 1bcc16860208
Ref: library/inspect inspect getsourcefile16860423
Ref: 1bcd16860423
Ref: library/inspect inspect getsourcelines16860781
Ref: 182416860781
Ref: library/inspect inspect getsource16861802
Ref: 182e16861802
Ref: library/inspect inspect cleandoc16862655
Ref: 1a8e16862655
Node: Signature オブジェクトで呼び出し可能オブジェクトを内省する16863112
Ref: library/inspect inspect-signature-object16863360
Ref: 4daf16863360
Ref: library/inspect introspecting-callables-with-the-signature-object16863360
Ref: 4db016863360
Ref: library/inspect inspect signature16863830
Ref: 23116863830
Ref: library/inspect inspect Signature16868161
Ref: 4e316868161
Ref: library/inspect inspect Signature empty16869863
Ref: 4db316869863
Ref: library/inspect inspect Signature parameters16870010
Ref: 4db116870010
Ref: library/inspect inspect Signature return_annotation16870635
Ref: 4db416870635
Ref: library/inspect inspect Signature bind16870944
Ref: 18f516870944
Ref: library/inspect inspect Signature bind_partial16871359
Ref: 4db516871359
Ref: library/inspect inspect Signature replace16871825
Ref: 4db216871825
Ref: library/inspect inspect Signature format16872899
Ref: 23316872899
Ref: library/inspect inspect Signature from_callable16874017
Ref: 94616874017
Ref: library/inspect inspect Parameter16874959
Ref: 4e416874959
Ref: library/inspect inspect Parameter empty16875624
Ref: 4db716875624
Ref: library/inspect inspect Parameter name16875785
Ref: 4db816875785
Ref: library/inspect inspect Parameter default16876376
Ref: 4db916876376
Ref: library/inspect inspect Parameter annotation16876578
Ref: 4dba16876578
Ref: library/inspect inspect Parameter kind16876789
Ref: 4dbb16876789
Ref: library/inspect inspect Parameter kind description16879752
Ref: 4dbc16879752
Ref: library/inspect inspect Parameter replace16880330
Ref: 4db616880330
Ref: library/inspect inspect BoundArguments16881788
Ref: 127916881788
Ref: library/inspect inspect BoundArguments arguments16882055
Ref: b0c16882055
Ref: library/inspect inspect BoundArguments args16883141
Ref: 4dbd16883141
Ref: library/inspect inspect BoundArguments kwargs16883293
Ref: 4dbe16883293
Ref: library/inspect inspect BoundArguments signature16883591
Ref: 4dbf16883591
Ref: library/inspect inspect BoundArguments apply_defaults16883702
Ref: 101a16883702
Ref: Signature オブジェクトで呼び出し可能オブジェクトを内省する-Footnote-116884813
Node: クラスと関数<2>16884855
Ref: library/inspect classes-and-functions16885103
Ref: 4dc016885103
Ref: library/inspect inspect-classes-functions16885103
Ref: 4dc116885103
Ref: library/inspect inspect getclasstree16885156
Ref: 4dc216885156
Ref: library/inspect inspect getfullargspec16885801
Ref: 94516885801
Ref: library/inspect inspect getargvalues16888798
Ref: 10c316888798
Ref: library/inspect inspect formatargvalues16889422
Ref: 10c416889422
Ref: library/inspect inspect getmro16889921
Ref: 4dc316889921
Ref: library/inspect inspect getcallargs16890404
Ref: 10c216890404
Ref: library/inspect inspect getclosurevars16891947
Ref: 12f016891947
Ref: library/inspect inspect unwrap16892957
Ref: 116216892957
Ref: library/inspect inspect get_annotations16894075
Ref: a1816894075
Node: インタープリタスタック16894942
Ref: library/inspect inspect-stack16895138
Ref: 4dc416895138
Ref: library/inspect the-interpreter-stack16895138
Ref: 4dc516895138
Ref: library/inspect inspect FrameInfo16895582
Ref: 85c16895582
Ref: library/inspect inspect FrameInfo frame16895616
Ref: 4dc616895616
Ref: library/inspect inspect FrameInfo filename16895741
Ref: 4dc716895741
Ref: library/inspect inspect FrameInfo lineno16895902
Ref: 4dc816895902
Ref: library/inspect inspect FrameInfo function16896073
Ref: 4dc916896073
Ref: library/inspect inspect FrameInfo code_context16896205
Ref: 4dca16896205
Ref: library/inspect inspect FrameInfo index16896421
Ref: 4dcb16896421
Ref: library/inspect inspect FrameInfo positions16896575
Ref: 4dcc16896575
Ref: library/inspect inspect Traceback16897245
Ref: 85d16897245
Ref: library/inspect inspect Traceback filename16897279
Ref: 4dcd16897279
Ref: library/inspect inspect Traceback lineno16897449
Ref: 4dce16897449
Ref: library/inspect inspect Traceback function16897629
Ref: 4dcf16897629
Ref: library/inspect inspect Traceback code_context16897781
Ref: 4dd016897781
Ref: library/inspect inspect Traceback index16898006
Ref: 4dd116898006
Ref: library/inspect inspect Traceback positions16898160
Ref: 4dd216898160
Ref: library/inspect inspect getframeinfo16900393
Ref: 85f16900393
Ref: library/inspect inspect getouterframes16900776
Ref: 86016900776
Ref: library/inspect inspect getinnerframes16901637
Ref: 86116901637
Ref: library/inspect inspect currentframe16902436
Ref: 8f216902436
Ref: library/inspect inspect stack16902873
Ref: 86216902873
Ref: library/inspect inspect trace16903539
Ref: 86316903539
Node: 属性の静的なフェッチ16904213
Ref: library/inspect fetching-attributes-statically16904454
Ref: 4dd316904454
Ref: library/inspect inspect getattr_static16905106
Ref: 6bc16905106
Node: Current State of Generators Coroutines and Asynchronous Generators16906958
Ref: library/inspect current-state-of-generators-coroutines-and-asynchronous-generators16907188
Ref: 4dd416907188
Ref: library/inspect inspect getgeneratorstate16907670
Ref: 145216907670
Ref: library/inspect inspect getcoroutinestate16908150
Ref: 101e16908150
Ref: library/inspect inspect getasyncgenstate16908796
Ref: 6ba16908796
Ref: library/inspect inspect getgeneratorlocals16909726
Ref: 12f116909726
Ref: library/inspect inspect getcoroutinelocals16910592
Ref: 101d16910592
Ref: library/inspect inspect getasyncgenlocals16910831
Ref: 6bb16910831
Node: Code Objects Bit Flags16911120
Ref: library/inspect code-objects-bit-flags16911332
Ref: 4dd516911332
Ref: library/inspect inspect-module-co-flags16911332
Ref: 23f216911332
Ref: library/inspect inspect CO_OPTIMIZED16911502
Ref: 4dd616911502
Ref: library/inspect inspect CO_NEWLOCALS16911594
Ref: 4dd716911594
Ref: library/inspect inspect CO_VARARGS16911748
Ref: 4dd816911748
Ref: library/inspect inspect CO_VARKEYWORDS16911861
Ref: 4dd916911861
Ref: library/inspect inspect CO_NESTED16911978
Ref: 4dda16911978
Ref: library/inspect inspect CO_GENERATOR16912077
Ref: 4ddb16912077
Ref: library/inspect inspect CO_COROUTINE16912257
Ref: 4ddc16912257
Ref: library/inspect inspect CO_ITERABLE_COROUTINE16912499
Ref: 4ddd16912499
Ref: library/inspect inspect CO_ASYNC_GENERATOR16912819
Ref: 4dde16912819
Ref: library/inspect inspect CO_HAS_DOCSTRING16913095
Ref: 23f416913095
Ref: library/inspect inspect CO_METHOD16913324
Ref: 4ddf16913324
Ref: Code Objects Bit Flags-Footnote-116913844
Ref: Code Objects Bit Flags-Footnote-216913886
Ref: Code Objects Bit Flags-Footnote-316913928
Node: Buffer flags16913970
Ref: library/inspect buffer-flags16914168
Ref: 4de016914168
Ref: library/inspect inspect BufferFlags16914215
Ref: 68d16914215
Ref: library/inspect inspect BufferFlags SIMPLE16914548
Ref: 4de116914548
Ref: library/inspect inspect BufferFlags WRITABLE16914576
Ref: 4de216914576
Ref: library/inspect inspect BufferFlags FORMAT16914606
Ref: 4de316914606
Ref: library/inspect inspect BufferFlags ND16914634
Ref: 4de416914634
Ref: library/inspect inspect BufferFlags STRIDES16914658
Ref: 4de516914658
Ref: library/inspect inspect BufferFlags C_CONTIGUOUS16914687
Ref: 4de616914687
Ref: library/inspect inspect BufferFlags F_CONTIGUOUS16914721
Ref: 4de716914721
Ref: library/inspect inspect BufferFlags ANY_CONTIGUOUS16914755
Ref: 4de816914755
Ref: library/inspect inspect BufferFlags INDIRECT16914791
Ref: 4de916914791
Ref: library/inspect inspect BufferFlags CONTIG16914821
Ref: 4dea16914821
Ref: library/inspect inspect BufferFlags CONTIG_RO16914849
Ref: 4deb16914849
Ref: library/inspect inspect BufferFlags STRIDED16914880
Ref: 4dec16914880
Ref: library/inspect inspect BufferFlags STRIDED_RO16914909
Ref: 4ded16914909
Ref: library/inspect inspect BufferFlags RECORDS16914941
Ref: 4dee16914941
Ref: library/inspect inspect BufferFlags RECORDS_RO16914970
Ref: 4def16914970
Ref: library/inspect inspect BufferFlags FULL16915002
Ref: 4df016915002
Ref: library/inspect inspect BufferFlags FULL_RO16915028
Ref: 4df116915028
Ref: library/inspect inspect BufferFlags READ16915057
Ref: 195616915057
Ref: library/inspect inspect BufferFlags WRITE16915083
Ref: 195716915083
Node: コマンドライン・インターフェース<10>16915139
Ref: library/inspect command-line-interface16915306
Ref: 4df216915306
Ref: library/inspect inspect-module-cli16915306
Ref: 116116915306
Ref: library/inspect cmdoption-inspect-details16915714
Ref: 4df316915714
Node: annotationlib --- Functionality for introspecting annotations16915821
Ref: library/annotationlib doc16916070
Ref: 4df416916070
Ref: library/annotationlib annotationlib-functionality-for-introspecting-annotations16916070
Ref: 4df516916070
Ref: library/annotationlib module-annotationlib16916070
Ref: 616916070
Ref: library/annotationlib translation-repo16916070
Ref: 4df616916070
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-116919081
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-216919154
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-316919196
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-416919238
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-516919280
Node: Annotation semantics16919332
Ref: library/annotationlib annotation-semantics16919471
Ref: 4df716919471
Ref: Annotation semantics-Footnote-116922120
Ref: Annotation semantics-Footnote-216922162
Ref: Annotation semantics-Footnote-316922204
Ref: Annotation semantics-Footnote-416922246
Ref: Annotation semantics-Footnote-516922288
Ref: Annotation semantics-Footnote-616922330
Ref: Annotation semantics-Footnote-716922372
Ref: Annotation semantics-Footnote-816922414
Ref: Annotation semantics-Footnote-916922456
Node: クラス<5>16922498
Ref: library/annotationlib classes16922656
Ref: 4df816922656
Ref: library/annotationlib annotationlib Format16922694
Ref: 23216922694
Ref: library/annotationlib annotationlib Format VALUE16923033
Ref: 15f16923033
Ref: library/annotationlib annotationlib Format VALUE_WITH_FAKE_GLOBALS16923149
Ref: 4df916923149
Ref: library/annotationlib annotationlib Format FORWARDREF16923722
Ref: 16016923722
Ref: library/annotationlib annotationlib Format STRING16924024
Ref: 16116924024
Ref: library/annotationlib annotationlib ForwardRef16924416
Ref: 17e816924416
Ref: library/annotationlib annotationlib ForwardRef __forward_arg__16924808
Ref: 4dfa16924808
Ref: library/annotationlib annotationlib ForwardRef evaluate16925023
Ref: 182016925023
Node: 関数<12>16928073
Ref: library/annotationlib functions16928223
Ref: 4dfb16928223
Ref: library/annotationlib annotationlib annotations_to_string16928256
Ref: 4dfc16928256
Ref: library/annotationlib annotationlib call_annotate_function16929100
Ref: 182916929100
Ref: library/annotationlib annotationlib call_evaluate_function16930326
Ref: 487616930326
Ref: library/annotationlib annotationlib get_annotate_from_class_namespace16932242
Ref: 45916932242
Ref: library/annotationlib annotationlib get_annotations16932805
Ref: 45716932805
Ref: library/annotationlib annotationlib type_repr16938141
Ref: 18bb16938141
Ref: 関数<12>-Footnote-116938833
Node: レシピ<3>16938924
Ref: library/annotationlib recipes16939094
Ref: 4dfe16939094
Node: Using annotations in a metaclass16939228
Ref: library/annotationlib annotationlib-metaclass16939362
Ref: 4dfd16939362
Ref: library/annotationlib using-annotations-in-a-metaclass16939362
Ref: 4dff16939362
Node: Creating a custom callable annotate function16942496
Ref: library/annotationlib creating-a-custom-callable-annotate-function16942630
Ref: 4e0016942630
Node: Limitations of the STRING format16945501
Ref: library/annotationlib limitations-of-the-string-format16945697
Ref: 4e0116945697
Node: Limitations of the FORWARDREF format16949499
Ref: library/annotationlib limitations-of-the-forwardref-format16949733
Ref: 4e2616949733
Node: Security implications of introspecting annotations16950827
Ref: library/annotationlib annotationlib-security16951020
Ref: 489e16951020
Ref: library/annotationlib security-implications-of-introspecting-annotations16951020
Ref: 4e2716951020
Node: site --- サイト固有の設定フック16952244
Ref: library/site doc16952427
Ref: 4e2816952427
Ref: library/site module-site16952427
Ref: cc16952427
Ref: library/site site-site-specific-configuration-hook16952427
Ref: 4e2916952427
Ref: library/site translation-repo16952427
Ref: 4e2a16952427
Ref: library/site site-virtual-environments-configuration16954874
Ref: 4c3916954874
Ref: site --- サイト固有の設定フック-Footnote-116958049
Node: sitecustomize16958113
Ref: library/site module-sitecustomize16958227
Ref: cd16958227
Ref: library/site sitecustomize16958227
Ref: 4e2b16958227
Node: usercustomize16958978
Ref: library/site module-usercustomize16959119
Ref: 11516959119
Ref: library/site usercustomize16959119
Ref: 4e2c16959119
Node: readline の設定16959913
Ref: library/site readline-configuration16960068
Ref: 4e2e16960068
Ref: library/site rlcompleter-config16960068
Ref: 11cf16960068
Node: モジュールの内容<6>16960785
Ref: library/site module-contents16960979
Ref: 4e2f16960979
Ref: library/site site PREFIXES16961042
Ref: 4e3016961042
Ref: library/site site ENABLE_USER_SITE16961140
Ref: 4e2d16961140
Ref: library/site site USER_SITE16961828
Ref: 218116961828
Ref: library/site site USER_BASE16962444
Ref: 153816962444
Ref: library/site site main16963205
Ref: 218216963205
Ref: library/site site addsitedir16963636
Ref: 22ce16963636
Ref: library/site site getsitepackages16963859
Ref: 145a16963859
Ref: library/site site getuserbase16964024
Ref: 145b16964024
Ref: library/site site getusersitepackages16964310
Ref: 145c16964310
Node: コマンドライン・インターフェース<11>16964796
Ref: library/site command-line-interface16964963
Ref: 4e3116964963
Ref: library/site site-commandline16964963
Ref: 4e3216964963
Ref: library/site cmdoption-site-user-base16965592
Ref: 4e3316965592
Ref: library/site cmdoption-site-user-site16965684
Ref: 4e3416965684
Ref: コマンドライン・インターフェース<11>-Footnote-116966762
Node: カスタム Python インタプリタ16966804
Ref: library/custominterp doc16966992
Ref: 4e3516966992
Ref: library/custominterp custom-python-interpreters16966992
Ref: 4e3616966992
Ref: library/custominterp custominterp16966992
Ref: 4e3716966992
Ref: library/custominterp translation-repo16966992
Ref: 4e3816966992
Node: code --- インタープリター基底クラス16967884
Ref: library/code doc16968067
Ref: 4e3916968067
Ref: library/code code-interpreter-base-classes16968067
Ref: 4e3a16968067
Ref: library/code module-code16968067
Ref: 1b16968067
Ref: library/code code InteractiveInterpreter16968600
Ref: 19a316968600
Ref: library/code code InteractiveConsole16969546
Ref: 287e16969546
Ref: library/code code interact16970268
Ref: 18f316970268
Ref: library/code code compile_command16971505
Ref: 4e3d16971505
Ref: code --- インタープリター基底クラス-Footnote-116973165
Node: 対話的なインタプリタオブジェクト16973229
Ref: library/code interactive-interpreter-objects16973416
Ref: 4e3e16973416
Ref: library/code interpreter-objects16973416
Ref: 4e3f16973416
Ref: library/code code InteractiveInterpreter runsource16973517
Ref: 4e4016973517
Ref: library/code code InteractiveInterpreter runcode16975078
Ref: 4e4216975078
Ref: library/code code InteractiveInterpreter showsyntaxerror16975754
Ref: 4e4116975754
Ref: library/code code InteractiveInterpreter showtraceback16976404
Ref: fd216976404
Ref: library/code code InteractiveInterpreter write16976917
Ref: 4e4316976917
Node: 対話的なコンソールオブジェクト16977207
Ref: library/code console-objects16977394
Ref: 4e4416977394
Ref: library/code interactive-console-objects16977394
Ref: 4e4516977394
Ref: library/code code InteractiveConsole interact16977730
Ref: 4e3c16977730
Ref: library/code code InteractiveConsole push16978907
Ref: 4e4616978907
Ref: library/code code InteractiveConsole resetbuffer16979864
Ref: 4e4716979864
Ref: library/code code InteractiveConsole raw_input16980017
Ref: 4e3b16980017
Node: codeop --- Python コードをコンパイルする16980471
Ref: library/codeop doc16980654
Ref: 4e4816980654
Ref: library/codeop codeop-compile-python-code16980654
Ref: 4e4916980654
Ref: library/codeop module-codeop16980654
Ref: 1d16980654
Ref: library/codeop translation-repo16980654
Ref: 4e4a16980654
Ref: library/codeop codeop compile_command16981803
Ref: 1bb216981803
Ref: library/codeop codeop Compile16983608
Ref: 4e4b16983608
Ref: library/codeop codeop CommandCompiler16984140
Ref: 4e4c16984140
Ref: codeop --- Python コードをコンパイルする-Footnote-116984713
Node: モジュールのインポート16984779
Ref: library/modules doc16984957
Ref: 4e4d16984957
Ref: library/modules importing-modules16984957
Ref: 4e4e16984957
Ref: library/modules modules16984957
Ref: 4e4f16984957
Ref: library/modules translation-repo16984957
Ref: 4e5016984957
Node: zipimport --- Zip アーカイブからモジュールをインポートする16986487
Ref: library/zipimport doc16986698
Ref: 4e5116986698
Ref: library/zipimport module-zipimport16986698
Ref: 13916986698
Ref: library/zipimport zipimport-import-modules-from-zip-archives16986698
Ref: 4e5216986698
Ref: library/zipimport zipimport ZipImportError16989565
Ref: 4e5316989565
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-116989891
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-216989960
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-316990028
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-416990070
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-516990112
Node: zipimporter オブジェクト16990154
Ref: library/zipimport id116990321
Ref: 4e5416990321
Ref: library/zipimport zipimporter-objects16990321
Ref: 4e5516990321
Ref: library/zipimport zipimport zipimporter16990487
Ref: 4e5616990487
Ref: library/zipimport zipimport zipimporter create_module16991315
Ref: a6316991315
Ref: library/zipimport zipimport zipimporter exec_module16991567
Ref: 33716991567
Ref: library/zipimport zipimport zipimporter find_spec16991723
Ref: a6216991723
Ref: library/zipimport zipimport zipimporter get_code16991910
Ref: 4e5716991910
Ref: library/zipimport zipimport zipimporter get_data16992189
Ref: 4e5816992189
Ref: library/zipimport zipimport zipimporter get_filename16992597
Ref: 4e5916992597
Ref: library/zipimport zipimport zipimporter get_source16992957
Ref: 4e5a16992957
Ref: library/zipimport zipimport zipimporter is_package16993351
Ref: 4e5b16993351
Ref: library/zipimport zipimport zipimporter load_module16993626
Ref: 33616993626
Ref: library/zipimport zipimport zipimporter invalidate_caches16994039
Ref: a6416994039
Ref: library/zipimport zipimport zipimporter archive16994225
Ref: 4e5c16994225
Ref: library/zipimport zipimport zipimporter prefix16994390
Ref: 4e5d16994390
Node: 使用例<47>16994866
Ref: library/zipimport examples16995033
Ref: 4e5e16995033
Ref: library/zipimport zipimport-examples16995033
Ref: 4e5f16995033
Node: pkgutil --- パッケージ拡張ユーティリティ16995692
Ref: library/pkgutil doc16995995
Ref: 4e6016995995
Ref: library/pkgutil module-pkgutil16995995
Ref: ae16995995
Ref: library/pkgutil pkgutil-package-extension-utility16995995
Ref: 4e6116995995
Ref: library/pkgutil translation-repo16995995
Ref: 4e6216995995
Ref: library/pkgutil pkgutil ModuleInfo16996356
Ref: f4c16996356
Ref: library/pkgutil pkgutil extend_path16996511
Ref: 198416996511
Ref: library/pkgutil pkgutil get_importer16998433
Ref: 4e6316998433
Ref: library/pkgutil pkgutil iter_importers16999122
Ref: 13b516999122
Ref: library/pkgutil pkgutil iter_modules17000029
Ref: f4b17000029
Ref: library/pkgutil pkgutil walk_packages17001161
Ref: dfd17001161
Ref: library/pkgutil pkgutil get_data17003184
Ref: 4e6417003184
Ref: library/pkgutil pkgutil resolve_name17005315
Ref: 4e6717005315
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-117007171
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-217007238
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-317007280
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-417007322
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-517007364
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-617007406
Node: modulefinder --- スクリプト中で使用されているモジュールの検索17007471
Ref: library/modulefinder doc17007752
Ref: 4e6817007752
Ref: library/modulefinder module-modulefinder17007752
Ref: 9517007752
Ref: library/modulefinder modulefinder-find-modules-used-by-a-script17007752
Ref: 4e6917007752
Ref: library/modulefinder translation-repo17007752
Ref: 4e6a17007752
Ref: library/modulefinder modulefinder AddPackagePath17008459
Ref: 4e6b17008459
Ref: library/modulefinder modulefinder ReplacePackage17008636
Ref: 4e6c17008636
Ref: library/modulefinder modulefinder ModuleFinder17008871
Ref: 1e4117008871
Ref: library/modulefinder modulefinder ModuleFinder report17009828
Ref: 4e6e17009828
Ref: library/modulefinder modulefinder ModuleFinder run_script17010185
Ref: 4e6d17010185
Ref: library/modulefinder modulefinder ModuleFinder modules17010401
Ref: 4e6f17010401
Ref: modulefinder --- スクリプト中で使用されているモジュールの検索-Footnote-117010658
Node: ModuleFinder の使用例17010730
Ref: library/modulefinder example-usage-of-modulefinder17010875
Ref: 4e7117010875
Ref: library/modulefinder modulefinder-example17010875
Ref: 4e7017010875
Node: runpy --- Python モジュールの位置特定と実行17012276
Ref: library/runpy doc17012533
Ref: 4e7217012533
Ref: library/runpy module-runpy17012533
Ref: c317012533
Ref: library/runpy runpy-locating-and-executing-python-modules17012533
Ref: 4e7317012533
Ref: library/runpy translation-repo17012533
Ref: 4e7417012533
Ref: library/runpy runpy run_module17013680
Ref: 17b317013680
Ref: library/runpy runpy run_path17017323
Ref: 4a417017323
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-117021935
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-217022000
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-317022042
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-417022084
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-517022126
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-617022168
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-717022210
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-817022252
Node: importlib --- import の実装17022294
Ref: library/importlib doc17022563
Ref: 4e7517022563
Ref: library/importlib importlib-the-implementation-of-import17022563
Ref: 4e7617022563
Ref: library/importlib module-importlib17022563
Ref: 7b17022563
Ref: library/importlib translation-repo17022563
Ref: 4e7717022563
Ref: importlib --- import の実装-Footnote-117023227
Node: はじめに<13>17023306
Ref: library/importlib introduction17023408
Ref: 4e7817023408
Ref: はじめに<13>-Footnote-117026006
Ref: はじめに<13>-Footnote-217026058
Ref: はじめに<13>-Footnote-317026100
Ref: はじめに<13>-Footnote-417026142
Ref: はじめに<13>-Footnote-517026184
Ref: はじめに<13>-Footnote-617026226
Ref: はじめに<13>-Footnote-717026268
Ref: はじめに<13>-Footnote-817026310
Ref: はじめに<13>-Footnote-917026352
Ref: はじめに<13>-Footnote-1017026394
Ref: はじめに<13>-Footnote-1117026437
Ref: はじめに<13>-Footnote-1217026480
Ref: はじめに<13>-Footnote-1317026523
Node: 関数<13>17026566
Ref: library/importlib functions17026733
Ref: 4e7917026733
Ref: library/importlib importlib __import__17026764
Ref: 127d17026764
Ref: library/importlib importlib import_module17027122
Ref: 73c17027122
Ref: library/importlib importlib invalidate_caches17028794
Ref: e0e17028794
Ref: library/importlib importlib reload17029595
Ref: 73d17029595
Node: importlib abc -- Abstract base classes related to import17034643
Ref: library/importlib importlib-abc-abstract-base-classes-related-to-import17034841
Ref: 4e7a17034841
Ref: library/importlib module-importlib abc17034841
Ref: 7c17034841
Ref: library/importlib importlib abc MetaPathFinder17035648
Ref: a7217035648
Ref: library/importlib importlib abc MetaPathFinder find_spec17035873
Ref: a6c17035873
Ref: library/importlib importlib abc MetaPathFinder invalidate_caches17036624
Ref: 4e7b17036624
Ref: library/importlib importlib abc PathEntryFinder17037144
Ref: a7317037144
Ref: library/importlib importlib abc PathEntryFinder find_spec17037653
Ref: a7017037653
Ref: library/importlib importlib abc PathEntryFinder invalidate_caches17038494
Ref: 4e7c17038494
Ref: library/importlib importlib abc Loader17038898
Ref: 10cb17038898
Ref: library/importlib importlib abc Loader create_module17039445
Ref: eb017039445
Ref: library/importlib importlib abc Loader exec_module17040047
Ref: a6e17040047
Ref: library/importlib importlib abc Loader load_module17040715
Ref: a6d17040715
Ref: library/importlib importlib abc ResourceLoader17042737
Ref: de617042737
Ref: library/importlib importlib abc ResourceLoader get_data17043371
Ref: 4e6517043371
Ref: library/importlib importlib abc InspectLoader17044214
Ref: 115a17044214
Ref: library/importlib importlib abc InspectLoader get_code17044441
Ref: 115b17044441
Ref: library/importlib importlib abc InspectLoader get_source17045263
Ref: 115e17045263
Ref: library/importlib importlib abc InspectLoader is_package17046039
Ref: 4e7e17046039
Ref: library/importlib importlib abc InspectLoader source_to_code17046545
Ref: 101617046545
Ref: library/importlib importlib abc InspectLoader exec_module17047384
Ref: 121817047384
Ref: library/importlib importlib abc InspectLoader load_module17047525
Ref: 4e7f17047525
Ref: library/importlib importlib abc ExecutionLoader17047768
Ref: 4e8017047768
Ref: library/importlib importlib abc ExecutionLoader get_filename17048106
Ref: 4e8117048106
Ref: library/importlib importlib abc FileLoader17048811
Ref: 128317048811
Ref: library/importlib importlib abc FileLoader name17049365
Ref: 4e8217049365
Ref: library/importlib importlib abc FileLoader path17049460
Ref: 4e8317049460
Ref: library/importlib importlib abc FileLoader load_module17049549
Ref: 4e8417049549
Ref: library/importlib importlib abc FileLoader get_filename17049782
Ref: 4e8517049782
Ref: library/importlib importlib abc FileLoader get_data17049893
Ref: 4e6617049893
Ref: library/importlib importlib abc SourceLoader17050065
Ref: 4e8617050065
Ref: library/importlib importlib abc SourceLoader path_stats17051539
Ref: 13a517051539
Ref: library/importlib importlib abc SourceLoader path_mtime17052388
Ref: 13a617052388
Ref: library/importlib importlib abc SourceLoader set_data17053032
Ref: 4e8717053032
Ref: library/importlib importlib abc SourceLoader get_code17053640
Ref: 4e8817053640
Ref: library/importlib importlib abc SourceLoader exec_module17053758
Ref: 121917053758
Ref: library/importlib importlib abc SourceLoader load_module17053905
Ref: 4e8917053905
Ref: library/importlib importlib abc SourceLoader get_source17054157
Ref: 122617054157
Ref: library/importlib importlib abc SourceLoader is_package17054279
Ref: 4e8a17054279
Ref: importlib abc -- Abstract base classes related to import-Footnote-117054866
Ref: importlib abc -- Abstract base classes related to import-Footnote-217054939
Ref: importlib abc -- Abstract base classes related to import-Footnote-317054981
Ref: importlib abc -- Abstract base classes related to import-Footnote-417055023
Ref: importlib abc -- Abstract base classes related to import-Footnote-517055065
Node: importlib machinery -- Importers and path hooks17055107
Ref: library/importlib importlib-machinery-importers-and-path-hooks17055339
Ref: 4e8b17055339
Ref: library/importlib module-importlib machinery17055339
Ref: 7d17055339
Ref: library/importlib importlib machinery SOURCE_SUFFIXES17055742
Ref: 73817055742
Ref: library/importlib importlib machinery DEBUG_BYTECODE_SUFFIXES17055943
Ref: 191217055943
Ref: library/importlib importlib machinery OPTIMIZED_BYTECODE_SUFFIXES17056250
Ref: 191317056250
Ref: library/importlib importlib machinery BYTECODE_SUFFIXES17056552
Ref: 73a17056552
Ref: library/importlib importlib machinery EXTENSION_SUFFIXES17056909
Ref: 73917056909
Ref: library/importlib importlib machinery all_suffixes17057128
Ref: 4d9e17057128
Ref: library/importlib importlib machinery BuiltinImporter17057680
Ref: eb117057680
Ref: library/importlib importlib machinery FrozenImporter17058433
Ref: 122417058433
Ref: library/importlib importlib machinery WindowsRegistryFinder17058988
Ref: f2a17058988
Ref: library/importlib importlib machinery PathFinder17059681
Ref: 122817059681
Ref: library/importlib importlib machinery PathFinder find_spec17060098
Ref: 121717060098
Ref: library/importlib importlib machinery PathFinder invalidate_caches17061633
Ref: e0d17061633
Ref: library/importlib importlib machinery FileFinder17062329
Ref: 128217062329
Ref: library/importlib importlib machinery FileFinder path17063945
Ref: 4e8c17063945
Ref: library/importlib importlib machinery FileFinder find_spec17064034
Ref: 10ca17064034
Ref: library/importlib importlib machinery FileFinder invalidate_caches17064232
Ref: 4e8d17064232
Ref: library/importlib importlib machinery FileFinder path_hook17064340
Ref: 4e8e17064340
Ref: library/importlib importlib machinery SourceFileLoader17064826
Ref: 128417064826
Ref: library/importlib importlib machinery SourceFileLoader name17065129
Ref: 4e8f17065129
Ref: library/importlib importlib machinery SourceFileLoader path17065227
Ref: 4e9017065227
Ref: library/importlib importlib machinery SourceFileLoader is_package17065307
Ref: 4e9117065307
Ref: library/importlib importlib machinery SourceFileLoader path_stats17065446
Ref: 4e9217065446
Ref: library/importlib importlib machinery SourceFileLoader set_data17065588
Ref: 4e9317065588
Ref: library/importlib importlib machinery SourceFileLoader load_module17065732
Ref: f2817065732
Ref: library/importlib importlib machinery SourcelessFileLoader17066100
Ref: 128517066100
Ref: library/importlib importlib machinery SourcelessFileLoader name17066747
Ref: 4e9417066747
Ref: library/importlib importlib machinery SourcelessFileLoader path17066839
Ref: 4e9517066839
Ref: library/importlib importlib machinery SourcelessFileLoader is_package17066928
Ref: 4e9617066928
Ref: library/importlib importlib machinery SourcelessFileLoader get_code17067103
Ref: 4e9717067103
Ref: library/importlib importlib machinery SourcelessFileLoader get_source17067276
Ref: 4e9817067276
Ref: library/importlib importlib machinery SourcelessFileLoader load_module17067474
Ref: f2917067474
Ref: library/importlib importlib machinery ExtensionFileLoader17067817
Ref: eb217067817
Ref: library/importlib importlib machinery ExtensionFileLoader name17068525
Ref: 4e9917068525
Ref: library/importlib importlib machinery ExtensionFileLoader path17068629
Ref: 4e9a17068629
Ref: library/importlib importlib machinery ExtensionFileLoader create_module17068709
Ref: 4e9b17068709
Ref: library/importlib importlib machinery ExtensionFileLoader exec_module17068921
Ref: 4e9c17068921
Ref: library/importlib importlib machinery ExtensionFileLoader is_package17069118
Ref: 4e9d17069118
Ref: library/importlib importlib machinery ExtensionFileLoader get_code17069305
Ref: 4e9e17069305
Ref: library/importlib importlib machinery ExtensionFileLoader get_source17069468
Ref: 4e9f17069468
Ref: library/importlib importlib machinery ExtensionFileLoader get_filename17069613
Ref: 115f17069613
Ref: library/importlib importlib machinery NamespaceLoader17069742
Ref: 115c17069742
Ref: library/importlib importlib machinery ModuleSpec17070409
Ref: 22c817070409
Ref: library/importlib importlib machinery ModuleSpec name17071206
Ref: 23c117071206
Ref: library/importlib importlib machinery ModuleSpec loader17071414
Ref: 33a17071414
Ref: library/importlib importlib machinery ModuleSpec origin17071617
Ref: 4ea017071617
Ref: library/importlib importlib machinery ModuleSpec submodule_search_locations17072106
Ref: 23c417072106
Ref: library/importlib importlib machinery ModuleSpec loader_state17072754
Ref: 4ea117072754
Ref: library/importlib importlib machinery ModuleSpec cached17072998
Ref: 32417072998
Ref: library/importlib importlib machinery ModuleSpec parent17073294
Ref: 32617073294
Ref: library/importlib importlib machinery ModuleSpec has_location17073585
Ref: 4ea217073585
Ref: library/importlib importlib machinery AppleFrameworkLoader17073868
Ref: 22c717073868
Ref: library/importlib importlib machinery AppleFrameworkLoader name17077579
Ref: 4ea317077579
Ref: library/importlib importlib machinery AppleFrameworkLoader path17077683
Ref: 4ea417077683
Ref: importlib machinery -- Importers and path hooks-Footnote-117077822
Ref: importlib machinery -- Importers and path hooks-Footnote-217077902
Ref: importlib machinery -- Importers and path hooks-Footnote-317077944
Ref: importlib machinery -- Importers and path hooks-Footnote-417077986
Ref: importlib machinery -- Importers and path hooks-Footnote-517078028
Node: importlib util -- Utility code for importers17078070
Ref: library/importlib importlib-util-utility-code-for-importers17078259
Ref: 4ea517078259
Ref: library/importlib module-importlib util17078259
Ref: 8117078259
Ref: library/importlib importlib util MAGIC_NUMBER17078622
Ref: 73717078622
Ref: library/importlib importlib util cache_from_source17078936
Ref: 35117078936
Ref: library/importlib importlib util source_from_cache17081256
Ref: 73e17081256
Ref: library/importlib importlib util decode_source17082086
Ref: 115d17082086
Ref: library/importlib importlib util resolve_name17082451
Ref: b0a17082451
Ref: library/importlib importlib util find_spec17083535
Ref: 5af17083535
Ref: library/importlib importlib util module_from_spec17084534
Ref: 101717084534
Ref: library/importlib importlib util spec_from_loader17085400
Ref: a7117085400
Ref: library/importlib importlib util spec_from_file_location17085725
Ref: eb317085725
Ref: library/importlib importlib util source_hash17086375
Ref: d4217086375
Ref: library/importlib importlib util _incompatible_extension_module_restrictions17086641
Ref: 4ea617086641
Ref: library/importlib importlib util LazyLoader17087756
Ref: eaf17087756
Ref: library/importlib importlib util LazyLoader factory17089418
Ref: 4ea717089418
Ref: importlib util -- Utility code for importers-Footnote-117090057
Ref: importlib util -- Utility code for importers-Footnote-217090131
Ref: importlib util -- Utility code for importers-Footnote-317090173
Ref: importlib util -- Utility code for importers-Footnote-417090215
Ref: importlib util -- Utility code for importers-Footnote-517090257
Ref: importlib util -- Utility code for importers-Footnote-617090299
Ref: importlib util -- Utility code for importers-Footnote-717090341
Node: 使用例<48>17090383
Ref: library/importlib examples17090516
Ref: 4ea817090516
Ref: library/importlib importlib-examples17090516
Ref: 4ea917090516
Node: プログラムからのインポート17090883
Ref: library/importlib importing-programmatically17091038
Ref: 4eaa17091038
Node: モジュールがインポートできるか確認する17091339
Ref: library/importlib checking-if-a-module-can-be-imported17091557
Ref: 4eab17091557
Node: ソースファイルから直接インポートする17092545
Ref: library/importlib importing-a-source-file-directly17092749
Ref: 4eac17092749
Node: Implementing lazy imports17093937
Ref: library/importlib implementing-lazy-imports17094123
Ref: 4ead17094123
Node: インポーターのセットアップ17094842
Ref: library/importlib setting-up-an-importer17095011
Ref: 4eae17095011
Node: Approximating importlib import_module17096609
Ref: library/importlib approximating-importlib-import-module17096744
Ref: 4eaf17096744
Node: importlib resources -- パッケージリソースの読み取り、オープン、アクセス17098244
Ref: library/importlib resources doc17098520
Ref: 4eb017098520
Ref: library/importlib resources importlib-resources-package-resource-reading-opening-and-access17098520
Ref: 4eb117098520
Ref: library/importlib resources module-importlib resources17098520
Ref: 7f17098520
Ref: library/importlib resources translation-repo17098520
Ref: 4eb217098520
Ref: library/importlib resources importlib resources Anchor17100661
Ref: 4eb317100661
Ref: library/importlib resources importlib resources files17100864
Ref: 6b617100864
Ref: library/importlib resources importlib resources as_file17101909
Ref: 6b517101909
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-117102752
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-217102841
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-317102913
Node: 関数 API17102990
Ref: library/importlib resources functional-api17103132
Ref: 4eb417103132
Ref: library/importlib resources importlib-resources-functional17103132
Ref: 4eb517103132
Ref: library/importlib resources importlib resources open_binary17104362
Ref: 4fe17104362
Ref: library/importlib resources importlib resources open_text17104854
Ref: 4ff17104854
Ref: library/importlib resources importlib resources read_binary17105806
Ref: 50117105806
Ref: library/importlib resources importlib resources read_text17106226
Ref: 50217106226
Ref: library/importlib resources importlib resources path17107103
Ref: 50017107103
Ref: library/importlib resources importlib resources is_resource17108034
Ref: 4fd17108034
Ref: library/importlib resources importlib resources contents17108511
Ref: 50317108511
Node: importlib resources abc -- リソースの抽象基底クラス17109219
Ref: library/importlib resources abc doc17109535
Ref: 4eb617109535
Ref: library/importlib resources abc importlib-resources-abc-abstract-base-classes-for-resources17109535
Ref: 4eb717109535
Ref: library/importlib resources abc module-importlib resources abc17109535
Ref: 8017109535
Ref: library/importlib resources abc translation-repo17109535
Ref: 4eb817109535
Ref: library/importlib resources abc importlib resources abc ResourceReader17109821
Ref: 4e7d17109821
Ref: library/importlib resources abc importlib resources abc ResourceReader open_resource17111682
Ref: 4eb917111682
Ref: library/importlib resources abc importlib resources abc ResourceReader resource_path17111977
Ref: 4eba17111977
Ref: library/importlib resources abc importlib resources abc ResourceReader is_resource17112270
Ref: 4ebb17112270
Ref: library/importlib resources abc importlib resources abc ResourceReader contents17112586
Ref: 4ebc17112586
Ref: library/importlib resources abc importlib resources abc Traversable17113461
Ref: 2fc17113461
Ref: library/importlib resources abc importlib resources abc Traversable name17113751
Ref: 4ebd17113751
Ref: library/importlib resources abc importlib resources abc Traversable iterdir17113869
Ref: 4ebe17113869
Ref: library/importlib resources abc importlib resources abc Traversable is_dir17113965
Ref: 4ebf17113965
Ref: library/importlib resources abc importlib resources abc Traversable is_file17114067
Ref: 4ec017114067
Ref: library/importlib resources abc importlib resources abc Traversable joinpath17114165
Ref: 4ec117114165
Ref: library/importlib resources abc importlib resources abc Traversable __truediv__17115292
Ref: 4ec217115292
Ref: library/importlib resources abc importlib resources abc Traversable open17115444
Ref: 4ec317115444
Ref: library/importlib resources abc importlib resources abc Traversable read_bytes17115806
Ref: 4ec417115806
Ref: library/importlib resources abc importlib resources abc Traversable read_text17115887
Ref: 4ec517115887
Ref: library/importlib resources abc importlib resources abc TraversableResources17115979
Ref: 2fb17115979
Ref: library/importlib resources abc importlib resources abc TraversableResources files17116505
Ref: 4ec617116505
Ref: importlib resources abc -- リソースの抽象基底クラス-Footnote-117116699
Node: importlib metadata -- パッケージメタデータへのアクセス17116783
Ref: library/importlib metadata doc17117052
Ref: 4ec717117052
Ref: library/importlib metadata importlib-metadata-accessing-package-metadata17117052
Ref: 4ec817117052
Ref: library/importlib metadata module-importlib metadata17117052
Ref: 7e17117052
Ref: library/importlib metadata translation-repo17117052
Ref: 4ec917117052
Ref: library/importlib metadata using17117052
Ref: 4eca17117052
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-117119647
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-217119735
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-317119819
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-417119897
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-517119935
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-617120027
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-717120096
Node: 概要<3>17120172
Ref: library/importlib metadata overview17120307
Ref: 4ecb17120307
Ref: library/importlib metadata importlib metadata PackageNotFoundError17121951
Ref: 4ed017121951
Ref: 概要<3>-Footnote-117122241
Node: 機能 API17122325
Ref: library/importlib metadata functional-api17122482
Ref: 4ed117122482
Node: エントリポイント17122794
Ref: library/importlib metadata entry-points17122898
Ref: 58917122898
Ref: library/importlib metadata id217122898
Ref: 4ed217122898
Ref: library/importlib metadata importlib metadata entry_points17122959
Ref: 4ed317122959
Ref: library/importlib metadata importlib metadata EntryPoints17123532
Ref: 4ed417123532
Ref: library/importlib metadata importlib metadata EntryPoint17123816
Ref: 4ed517123816
Ref: エントリポイント-Footnote-117126720
Ref: エントリポイント-Footnote-217126792
Node: 配布物メタデータ17126860
Ref: library/importlib metadata distribution-metadata17126997
Ref: 4ed617126997
Ref: library/importlib metadata metadata17126997
Ref: 4ecc17126997
Ref: library/importlib metadata importlib metadata metadata17127058
Ref: 4ed717127058
Ref: library/importlib metadata importlib metadata PackageMetadata17127396
Ref: 4ed817127396
Ref: 配布物メタデータ-Footnote-117128722
Ref: 配布物メタデータ-Footnote-217128827
Ref: 配布物メタデータ-Footnote-317128911
Ref: 配布物メタデータ-Footnote-417128953
Node: 配布物バージョン17129045
Ref: library/importlib metadata distribution-versions17129179
Ref: 4ed917129179
Ref: library/importlib metadata version17129179
Ref: 4ecd17129179
Ref: library/importlib metadata importlib metadata version17129240
Ref: 19c617129240
Ref: 配布物バージョン-Footnote-117129732
Ref: 配布物バージョン-Footnote-217129818
Node: 配布物ファイル17129902
Ref: library/importlib metadata distribution-files17130030
Ref: 4eda17130030
Ref: library/importlib metadata files17130030
Ref: 4ece17130030
Ref: library/importlib metadata importlib metadata files17130086
Ref: 4edb17130086
Ref: library/importlib metadata importlib metadata PackagePath17130556
Ref: 4edc17130556
Ref: 配布物ファイル-Footnote-117132165
Ref: 配布物ファイル-Footnote-217132249
Node: 配布物の要件17132346
Ref: library/importlib metadata distribution-requirements17132489
Ref: 4edd17132489
Ref: library/importlib metadata requirements17132489
Ref: 4ecf17132489
Ref: library/importlib metadata importlib metadata requires17132540
Ref: 4ede17132540
Ref: library/importlib metadata package-distributions17133037
Ref: a1517133037
Ref: 配布物の要件-Footnote-117133074
Node: Mapping import to distribution packages17133158
Ref: library/importlib metadata import-distribution-package-mapping17133271
Ref: 4edf17133271
Ref: library/importlib metadata mapping-import-to-distribution-packages17133271
Ref: 4ee017133271
Ref: library/importlib metadata importlib metadata packages_distributions17133370
Ref: 4ee117133370
Ref: Mapping import to distribution packages-Footnote-117134457
Ref: Mapping import to distribution packages-Footnote-217134535
Ref: Mapping import to distribution packages-Footnote-317134619
Node: Distributions17134681
Ref: library/importlib metadata distributions17134851
Ref: a1617134851
Ref: library/importlib metadata id917134851
Ref: 4ee217134851
Ref: library/importlib metadata importlib metadata distribution17134898
Ref: 4ee317134898
Ref: library/importlib metadata importlib metadata Distribution17135202
Ref: 4ee417135202
Ref: Distributions-Footnote-117136827
Ref: Distributions-Footnote-217136911
Ref: Distributions-Footnote-317136953
Node: Distribution Discovery17137045
Ref: library/importlib metadata distribution-discovery17137234
Ref: 4ee517137234
Ref: Distribution Discovery-Footnote-117138092
Node: Implementing Custom Providers17138176
Ref: library/importlib metadata implementing-custom-providers17138343
Ref: 4ee617138343
Ref: Implementing Custom Providers-Footnote-117140537
Node: 使用例<49>17140621
Ref: library/importlib metadata example17140700
Ref: 4ee717140700
Node: sys path モジュール検索パスの初期化17143978
Ref: library/sys_path_init doc17144175
Ref: 4ee817144175
Ref: library/sys_path_init sys-path-init17144175
Ref: 193e17144175
Ref: library/sys_path_init the-initialization-of-the-sys-path-module-search-path17144175
Ref: 4ee917144175
Ref: library/sys_path_init translation-repo17144175
Ref: 4eea17144175
Node: Virtual Environments17148388
Ref: library/sys_path_init sys-path-init-virtual-environments17148512
Ref: 4c3817148512
Ref: library/sys_path_init virtual-environments17148512
Ref: 4eeb17148512
Node: _pth files17149577
Ref: library/sys_path_init pth-files17149732
Ref: 4eec17149732
Node: 埋め込みの Python17151055
Ref: library/sys_path_init embedded-python17151181
Ref: 4eed17151181
Node: Python言語サービス17151766
Ref: library/language doc17151938
Ref: 4eee17151938
Ref: library/language language17151938
Ref: 4eef17151938
Ref: library/language python-language-services17151938
Ref: 4ef017151938
Ref: library/language translation-repo17151938
Ref: 4ef117151938
Node: ast --- Abstract syntax trees17153628
Ref: library/ast doc17153788
Ref: 4ef217153788
Ref: library/ast ast-abstract-syntax-trees17153788
Ref: 4ef317153788
Ref: library/ast module-ast17153788
Ref: 917153788
Ref: ast --- Abstract syntax trees-Footnote-117154975
Node: Abstract grammar17155038
Ref: library/ast abstract-grammar17155143
Ref: 4ef517155143
Ref: library/ast id117155143
Ref: 4ef617155143
Node: Node クラス17162701
Ref: library/ast node-classes17162826
Ref: 4ef717162826
Ref: library/ast ast AST17162872
Ref: 4c317162872
Ref: library/ast ast AST _fields17163841
Ref: 184117163841
Ref: library/ast ast AST _field_types17164996
Ref: 4c417164996
Ref: library/ast ast AST lineno17165388
Ref: 4ef817165388
Ref: library/ast ast AST col_offset17165415
Ref: 4ef917165415
Ref: library/ast ast AST end_lineno17165446
Ref: 4efa17165446
Ref: library/ast ast AST end_col_offset17165477
Ref: 4efb17165477
Ref: Node クラス-Footnote-117170274
Node: Root nodes17170332
Ref: library/ast ast-root-nodes17170417
Ref: 4efc17170417
Ref: library/ast root-nodes17170417
Ref: 4efd17170417
Ref: library/ast ast Module17170458
Ref: 4efe17170458
Ref: library/ast ast Expression17171142
Ref: 4f0017171142
Ref: library/ast ast Interactive17171524
Ref: 18de17171524
Ref: library/ast ast FunctionType17172253
Ref: 4f0217172253
Ref: Root nodes-Footnote-117173301
Node: リテラル<3>17173343
Ref: library/ast literals17173443
Ref: 4f0317173443
Ref: library/ast ast Constant17173484
Ref: 2f117173484
Ref: library/ast ast FormattedValue17174362
Ref: 4e1a17174362
Ref: library/ast ast JoinedStr17175507
Ref: 1abd17175507
Ref: library/ast ast TemplateStr17176506
Ref: 4f0417176506
Ref: library/ast ast Interpolation17177561
Ref: 182217177561
Ref: library/ast ast List17179010
Ref: 4e1717179010
Ref: library/ast ast Tuple17179046
Ref: 4e1817179046
Ref: library/ast ast Set17180070
Ref: 4e0717180070
Ref: library/ast ast Dict17180515
Ref: 1da717180515
Node: 変数17181431
Ref: library/ast variables17181538
Ref: 4f0617181538
Ref: library/ast ast Name17181569
Ref: 1d8017181569
Ref: library/ast ast Load17181755
Ref: 4c217181755
Ref: library/ast ast Store17181779
Ref: 4f0517181779
Ref: library/ast ast Del17181804
Ref: 4f0717181804
Ref: library/ast ast Starred17182767
Ref: 4e1617182767
Node: 式 expression<2>17183659
Ref: library/ast ast-expressions17183765
Ref: 4f0117183765
Ref: library/ast expressions17183765
Ref: 4f0817183765
Ref: library/ast ast Expr17183817
Ref: 4f0917183817
Ref: library/ast ast UnaryOp17184592
Ref: 4e0217184592
Ref: library/ast ast UAdd17184771
Ref: 4e0417184771
Ref: library/ast ast USub17184795
Ref: 4e0517184795
Ref: library/ast ast Not17184819
Ref: 4e0617184819
Ref: library/ast ast Invert17184842
Ref: 4e0317184842
Ref: library/ast ast BinOp17185278
Ref: 1e0e17185278
Ref: library/ast ast Add17185748
Ref: 4f0a17185748
Ref: library/ast ast Sub17185771
Ref: 4f0b17185771
Ref: library/ast ast Mult17185794
Ref: 4f0c17185794
Ref: library/ast ast Div17185818
Ref: 4f0d17185818
Ref: library/ast ast FloorDiv17185841
Ref: 4f0e17185841
Ref: library/ast ast Mod17185869
Ref: 4f0f17185869
Ref: library/ast ast Pow17185892
Ref: 4f1017185892
Ref: library/ast ast LShift17185915
Ref: 4f1117185915
Ref: library/ast ast RShift17185941
Ref: 4f1217185941
Ref: library/ast ast BitOr17185967
Ref: 4f1317185967
Ref: library/ast ast BitXor17185992
Ref: 4f1417185992
Ref: library/ast ast BitAnd17186018
Ref: 4f1517186018
Ref: library/ast ast MatMult17186044
Ref: 4f1617186044
Ref: library/ast ast BoolOp17186127
Ref: 4e1b17186127
Ref: library/ast ast And17186902
Ref: 4f1817186902
Ref: library/ast ast Or17186925
Ref: 4f1717186925
Ref: library/ast ast Compare17187003
Ref: 4e0817187003
Ref: library/ast ast Eq17187636
Ref: 4e0917187636
Ref: library/ast ast NotEq17187658
Ref: 4e0a17187658
Ref: library/ast ast Lt17187683
Ref: 4e0b17187683
Ref: library/ast ast LtE17187705
Ref: 4e0c17187705
Ref: library/ast ast Gt17187728
Ref: 4e0d17187728
Ref: library/ast ast GtE17187750
Ref: 4e0e17187750
Ref: library/ast ast Is17187773
Ref: 4e0f17187773
Ref: library/ast ast IsNot17187795
Ref: 4e1017187795
Ref: library/ast ast In17187820
Ref: 4e1117187820
Ref: library/ast ast NotIn17187842
Ref: 4e1217187842
Ref: library/ast ast Call17187923
Ref: 4e1317187923
Ref: library/ast ast keyword17189111
Ref: 4f1917189111
Ref: library/ast ast IfExp17189386
Ref: 4e1c17189386
Ref: library/ast ast Attribute17189939
Ref: 4e1417189939
Ref: library/ast ast NamedExpr17190627
Ref: 4e2217190627
Node: 配列要素の参照 Subscripting17191516
Ref: library/ast subscripting17191639
Ref: 4f1b17191639
Ref: library/ast ast Subscript17191725
Ref: 4e1517191725
Ref: library/ast ast Slice17192807
Ref: 4e1917192807
Node: 内包表記 Comprehension17193492
Ref: library/ast comprehensions17193615
Ref: 4f1c17193615
Ref: library/ast ast ListComp17193688
Ref: 4e1e17193688
Ref: library/ast ast SetComp17193734
Ref: 4e1f17193734
Ref: library/ast ast GeneratorExp17193779
Ref: 4e2117193779
Ref: library/ast ast DictComp17193829
Ref: 4e2017193829
Ref: library/ast ast comprehension17195801
Ref: 4f1d17195801
Node: 文 Statements17198980
Ref: library/ast ast-statements17199095
Ref: 4eff17199095
Ref: library/ast statements17199095
Ref: 4f1e17199095
Ref: library/ast ast Assign17199147
Ref: 4f1a17199147
Ref: library/ast ast Assign type_comment17199578
Ref: 4f1f17199578
Ref: library/ast ast AnnAssign17200556
Ref: 4f2017200556
Ref: library/ast ast AugAssign17202811
Ref: 4f2117202811
Ref: library/ast ast Raise17203632
Ref: 4f2217203632
Ref: library/ast ast Assert17204258
Ref: 4f2317204258
Ref: library/ast ast Delete17204734
Ref: 4f2417204734
Ref: library/ast ast Pass17205260
Ref: 4f2517205260
Ref: library/ast ast TypeAlias17205456
Ref: 1ab617205456
Node: インポート17206185
Ref: library/ast imports17206251
Ref: 4f2717206251
Ref: library/ast ast Import17206299
Ref: 4f2817206299
Ref: library/ast ast ImportFrom17206735
Ref: 4f2917206735
Ref: library/ast ast alias17207589
Ref: 1cd117207589
Node: 制御フロー17208162
Ref: library/ast control-flow17208276
Ref: 4f2a17208276
Ref: library/ast ast If17208467
Ref: 4f2b17208467
Ref: library/ast ast For17209812
Ref: 4f2c17209812
Ref: library/ast ast For type_comment17210354
Ref: 4f2d17210354
Ref: library/ast ast While17211116
Ref: 4f2e17211116
Ref: library/ast ast Break17211837
Ref: 4f2f17211837
Ref: library/ast ast Continue17211862
Ref: 4f3017211862
Ref: library/ast ast Try17212879
Ref: 4f3117212879
Ref: library/ast ast TryStar17214517
Ref: 4f3317214517
Ref: library/ast ast ExceptHandler17215527
Ref: 4f3217215527
Ref: library/ast ast With17216855
Ref: 4f3417216855
Ref: library/ast ast With type_comment17217184
Ref: 4f3617217184
Ref: library/ast ast withitem17217356
Ref: 4f3517217356
Node: Pattern matching17218849
Ref: library/ast pattern-matching17218965
Ref: 4f3717218965
Ref: library/ast ast Match17219020
Ref: 4f3817219020
Ref: library/ast ast match_case17219333
Ref: 4f3917219333
Ref: library/ast ast MatchValue17221300
Ref: 4f3a17221300
Ref: library/ast ast MatchSingleton17222274
Ref: 4f3b17222274
Ref: library/ast ast MatchSequence17223134
Ref: 4f3c17223134
Ref: library/ast ast MatchStar17224329
Ref: 4f3d17224329
Ref: library/ast ast MatchMapping17225942
Ref: 4f3e17225942
Ref: library/ast ast MatchClass17227912
Ref: 4f3f17227912
Ref: library/ast ast MatchAs17230851
Ref: 4f4017230851
Ref: library/ast ast MatchOr17232469
Ref: 4f4117232469
Node: Type annotations17233716
Ref: library/ast type-annotations17233832
Ref: 4f4217233832
Ref: library/ast ast TypeIgnore17233887
Ref: 1b6c17233887
Node: Type parameters17235139
Ref: library/ast ast-type-params17235269
Ref: 4f2617235269
Ref: library/ast type-parameters17235269
Ref: 4f4317235269
Ref: library/ast ast TypeVar17235402
Ref: 4f4417235402
Ref: library/ast ast ParamSpec17236604
Ref: 4f4517236604
Ref: library/ast ast TypeVarTuple17237989
Ref: 4f4617237989
Node: 関数およびクラス定義17239206
Ref: library/ast function-and-class-definitions17239335
Ref: 4f4717239335
Ref: library/ast ast FunctionDef17239408
Ref: 1ad917239408
Ref: library/ast ast FunctionDef type_comment17240208
Ref: 4f4917240208
Ref: library/ast ast Lambda17240443
Ref: 4e1d17240443
Ref: library/ast ast arguments17241094
Ref: 4f4817241094
Ref: library/ast ast arg17242021
Ref: 4f4a17242021
Ref: library/ast ast arg type_comment17242241
Ref: 4f4b17242241
Ref: library/ast ast Return17243847
Ref: 4f4c17243847
Ref: library/ast ast Yield17244092
Ref: 4e2417244092
Ref: library/ast ast YieldFrom17244125
Ref: 4e2517244125
Ref: library/ast ast Global17244796
Ref: 4f4d17244796
Ref: library/ast ast Nonlocal17244830
Ref: 4f4e17244830
Ref: library/ast ast ClassDef17245504
Ref: 1ad717245504
Ref: 関数およびクラス定義-Footnote-117247324
Node: async と await17247366
Ref: library/ast async-and-await17247471
Ref: 4f4f17247471
Ref: library/ast ast AsyncFunctionDef17247523
Ref: 1ad817247523
Ref: library/ast ast Await17247851
Ref: 4e2317247851
Ref: library/ast ast AsyncFor17248510
Ref: 4f5017248510
Ref: library/ast ast AsyncWith17248581
Ref: 4f5117248581
Node: ast helpers17249301
Ref: library/ast ast-helpers17249427
Ref: 4f5217249427
Ref: library/ast ast parse17249613
Ref: 1c417249613
Ref: library/ast ast unparse17252898
Ref: ae617252898
Ref: library/ast ast literal_eval17253636
Ref: e1617253636
Ref: library/ast ast get_docstring17255737
Ref: 1e9717255737
Ref: library/ast ast get_source_segment17256386
Ref: bcf17256386
Ref: library/ast ast fix_missing_locations17256903
Ref: 4f5417256903
Ref: library/ast ast increment_lineno17257379
Ref: 1b6b17257379
Ref: library/ast ast copy_location17257652
Ref: 4f5517257652
Ref: library/ast ast iter_fields17257912
Ref: 4f5617257912
Ref: library/ast ast iter_child_nodes17258109
Ref: 4f5717258109
Ref: library/ast ast walk17258417
Ref: 4f5817258417
Ref: library/ast ast NodeVisitor17258716
Ref: 2f217258716
Ref: library/ast ast NodeVisitor visit17259159
Ref: 4f5917259159
Ref: library/ast ast NodeVisitor generic_visit17259512
Ref: 4f5a17259512
Ref: library/ast ast NodeVisitor visit_Constant17259995
Ref: c6717259995
Ref: library/ast ast NodeTransformer17260671
Ref: 4f5b17260671
Ref: library/ast ast dump17262794
Ref: ae517262794
Ref: library/ast ast compare17265466
Ref: 1c117265466
Ref: ast helpers-Footnote-117266036
Ref: ast helpers-Footnote-217266078
Ref: ast helpers-Footnote-317266120
Node: Compiler flags<2>17266162
Ref: library/ast ast-compiler-flags17266310
Ref: 262617266310
Ref: library/ast compiler-flags17266310
Ref: 4f5c17266310
Ref: library/ast ast PyCF_ALLOW_TOP_LEVEL_AWAIT17266513
Ref: 4f5d17266513
Ref: library/ast ast PyCF_ONLY_AST17266737
Ref: 4ef417266737
Ref: library/ast ast PyCF_OPTIMIZED_AST17266895
Ref: 4f5e17266895
Ref: library/ast ast PyCF_TYPE_COMMENTS17267093
Ref: 4f5317267093
Ref: Compiler flags<2>-Footnote-117267357
Ref: Compiler flags<2>-Footnote-217267399
Node: コマンドラインでの使用<8>17267441
Ref: library/ast ast-cli17267569
Ref: 4f5f17267569
Ref: library/ast command-line-usage17267569
Ref: 4f6017267569
Ref: library/ast cmdoption-ast-h17267858
Ref: 4f6117267858
Ref: library/ast cmdoption-ast-help17267858
Ref: 4f6217267858
Ref: library/ast cmdoption-ast-m17267946
Ref: 4f6317267946
Ref: library/ast cmdoption-ast-mode17267968
Ref: 4f6417267968
Ref: library/ast cmdoption-ast-no-type-comments17268123
Ref: 4f6517268123
Ref: library/ast cmdoption-ast-a17268204
Ref: 4f6617268204
Ref: library/ast cmdoption-ast-include-attributes17268204
Ref: 4f6717268204
Ref: library/ast cmdoption-ast-i17268312
Ref: 4f6817268312
Ref: library/ast cmdoption-ast-indent17268336
Ref: 4f6917268336
Ref: library/ast cmdoption-ast-feature-version17268442
Ref: 1c517268442
Ref: library/ast cmdoption-ast-O17268630
Ref: 4f6a17268630
Ref: library/ast cmdoption-ast-optimize17268653
Ref: 1c617268653
Ref: library/ast cmdoption-ast-show-empty17268781
Ref: 1c717268781
Ref: コマンドラインでの使用<8>-Footnote-117270112
Ref: コマンドラインでの使用<8>-Footnote-217270160
Ref: コマンドラインでの使用<8>-Footnote-317270227
Ref: コマンドラインでの使用<8>-Footnote-417270301
Ref: コマンドラインでの使用<8>-Footnote-517270340
Node: symtable --- コンパイラーの記号表へのアクセス17270377
Ref: library/symtable doc17270593
Ref: 4f6b17270593
Ref: library/symtable module-symtable17270593
Ref: de17270593
Ref: library/symtable symtable-access-to-the-compiler-s-symbol-tables17270593
Ref: 4f6c17270593
Ref: library/symtable translation-repo17270593
Ref: 4f6d17270593
Ref: symtable --- コンパイラーの記号表へのアクセス-Footnote-117271249
Node: 記号表の生成17271317
Ref: library/symtable generating-symbol-tables17271460
Ref: 4f6e17271460
Ref: library/symtable symtable symtable17271511
Ref: 1e2d17271511
Node: 記号表の検査17271792
Ref: library/symtable examining-symbol-tables17271983
Ref: 4f7017271983
Ref: library/symtable symtable SymbolTableType17272034
Ref: 19b217272034
Ref: library/symtable symtable SymbolTableType MODULE17272159
Ref: 4f7117272159
Ref: library/symtable symtable SymbolTableType FUNCTION17272248
Ref: 4f7217272248
Ref: library/symtable symtable SymbolTableType CLASS17272343
Ref: 4f7317272343
Ref: library/symtable symtable SymbolTableType ANNOTATION17272522
Ref: 4f7417272522
Ref: library/symtable symtable SymbolTableType TYPE_ALIAS17272666
Ref: 4f7517272666
Ref: library/symtable symtable SymbolTableType TYPE_PARAMETERS17272785
Ref: 4f7617272785
Ref: library/symtable symtable SymbolTableType TYPE_VARIABLE17272954
Ref: 4f7717272954
Ref: library/symtable symtable SymbolTable17273323
Ref: 4f6f17273323
Ref: library/symtable symtable SymbolTable get_type17273487
Ref: 19b317273487
Ref: library/symtable symtable SymbolTable get_id17274173
Ref: 4f7817274173
Ref: library/symtable symtable SymbolTable get_name17274258
Ref: 4f7917274258
Ref: library/symtable symtable SymbolTable get_lineno17274908
Ref: 4f7a17274908
Ref: library/symtable symtable SymbolTable is_optimized17275042
Ref: 4f7b17275042
Ref: library/symtable symtable SymbolTable is_nested17275213
Ref: 4f7c17275213
Ref: library/symtable symtable SymbolTable has_children17275352
Ref: 4f7d17275352
Ref: library/symtable symtable SymbolTable get_identifiers17275599
Ref: 4f7f17275599
Ref: library/symtable symtable SymbolTable lookup17275782
Ref: 4f8017275782
Ref: library/symtable symtable SymbolTable get_symbols17275955
Ref: 4f8117275955
Ref: library/symtable symtable SymbolTable get_children17276115
Ref: 4f7e17276115
Ref: library/symtable symtable Function17276227
Ref: 4f8217276227
Ref: library/symtable symtable Function get_parameters17276361
Ref: 4f8317276361
Ref: library/symtable symtable Function get_locals17276478
Ref: 4f8417276478
Ref: library/symtable symtable Function get_globals17276609
Ref: 4f8517276609
Ref: library/symtable symtable Function get_nonlocals17276744
Ref: 4f8617276744
Ref: library/symtable symtable Function get_frees17276889
Ref: 4f8717276889
Ref: library/symtable symtable Class17277038
Ref: 4f8817277038
Ref: library/symtable symtable Class get_methods17277155
Ref: 31f17277155
Ref: library/symtable symtable Symbol17278471
Ref: 28b17278471
Ref: library/symtable symtable Symbol get_name17278676
Ref: 4f8917278676
Ref: library/symtable symtable Symbol is_referenced17278757
Ref: 4f8a17278757
Ref: library/symtable symtable Symbol is_imported17278897
Ref: 4f8b17278897
Ref: library/symtable symtable Symbol is_parameter17279028
Ref: 4f8c17279028
Ref: library/symtable symtable Symbol is_type_parameter17279143
Ref: 19b417279143
Ref: library/symtable symtable Symbol is_global17279286
Ref: 4f8d17279286
Ref: library/symtable symtable Symbol is_nonlocal17279398
Ref: 1e6a17279398
Ref: library/symtable symtable Symbol is_declared_global17279512
Ref: 154117279512
Ref: library/symtable symtable Symbol is_local17279696
Ref: 4f8e17279696
Ref: library/symtable symtable Symbol is_annotated17279834
Ref: 4f8f17279834
Ref: library/symtable symtable Symbol is_free17279979
Ref: 4f9017279979
Ref: library/symtable symtable Symbol is_free_class17280169
Ref: 28e17280169
Ref: library/symtable symtable Symbol is_assigned17280846
Ref: 4f9117280846
Ref: library/symtable symtable Symbol is_comp_iter17281004
Ref: 28d17281004
Ref: library/symtable symtable Symbol is_comp_cell17281170
Ref: 28c17281170
Ref: library/symtable symtable Symbol is_namespace17281336
Ref: 4f9217281336
Ref: library/symtable symtable Symbol get_namespaces17282176
Ref: 4f9317282176
Ref: library/symtable symtable Symbol get_namespace17282302
Ref: 4f9417282302
Node: コマンドラインからの使用<3>17282566
Ref: library/symtable command-line-usage17282730
Ref: 4f9517282730
Ref: library/symtable symtable-cli17282730
Ref: 4f9617282730
Node: token --- Python 解析木で使われる定数17283103
Ref: library/token doc17283336
Ref: 4f9717283336
Ref: library/token module-token17283336
Ref: 10117283336
Ref: library/token token-constants-used-with-python-parse-trees17283336
Ref: 4f9817283336
Ref: library/token translation-repo17283336
Ref: 4f9917283336
Ref: library/token token tok_name17284395
Ref: 4f9c17284395
Ref: library/token token ISTERMINAL17284628
Ref: 4f9d17284628
Ref: library/token token ISNONTERMINAL17284738
Ref: 4f9e17284738
Ref: library/token token ISEOF17284854
Ref: 4f9f17284854
Ref: library/token token NAME17285005
Ref: 231517285005
Ref: library/token token NUMBER17285103
Ref: 231617285103
Ref: library/token token STRING17285196
Ref: 231717285196
Ref: library/token token OP17285546
Ref: 22e617285546
Ref: library/token token COMMENT17285849
Ref: 4fa017285849
Ref: library/token token NEWLINE17285972
Ref: 22f017285972
Ref: library/token token NL17286074
Ref: 4fa117286074
Ref: library/token token INDENT17286310
Ref: 215817286310
Ref: library/token token DEDENT17286471
Ref: 230e17286471
Ref: library/token token FSTRING_START17286630
Ref: 234d17286630
Ref: library/token token FSTRING_MIDDLE17286897
Ref: 234e17286897
Ref: library/token token FSTRING_END17287323
Ref: 234f17287323
Ref: library/token token TSTRING_START17287512
Ref: 4fa617287512
Ref: library/token token TSTRING_MIDDLE17287803
Ref: 4fa717287803
Ref: library/token token TSTRING_END17288252
Ref: 4fa817288252
Ref: library/token token ENDMARKER17288474
Ref: 231217288474
Ref: library/token token ENCODING17288608
Ref: 4fa917288608
Ref: library/token token TYPE_IGNORE17289150
Ref: 4faa17289150
Ref: library/token token TYPE_COMMENT17289403
Ref: 4fab17289403
Ref: library/token token SOFT_KEYWORD17289638
Ref: 4f9b17289638
Ref: library/token token ERRORTOKEN17289896
Ref: 4fad17289896
Ref: library/token token-operators-delimiters17290232
Ref: 237a17290232
Ref: library/token token LPAR17290770
Ref: 4fae17290770
Ref: library/token token RPAR17290950
Ref: 4faf17290950
Ref: library/token token LSQB17291130
Ref: 4fb017291130
Ref: library/token token RSQB17291310
Ref: 4fb117291310
Ref: library/token token COLON17291491
Ref: 4fa517291491
Ref: library/token token COMMA17291671
Ref: 4fb217291671
Ref: library/token token SEMI17291850
Ref: 4fb317291850
Ref: library/token token PLUS17292030
Ref: 4f9a17292030
Ref: library/token token MINUS17292211
Ref: 4fb417292211
Ref: library/token token STAR17292390
Ref: 4fb517292390
Ref: library/token token SLASH17292571
Ref: 4fb617292571
Ref: library/token token VBAR17292750
Ref: 4fb717292750
Ref: library/token token AMPER17292931
Ref: 4fb817292931
Ref: library/token token LESS17293110
Ref: 4fb917293110
Ref: library/token token GREATER17293293
Ref: 4fba17293293
Ref: library/token token EQUAL17293471
Ref: 4fbb17293471
Ref: library/token token DOT17293649
Ref: 4fbc17293649
Ref: library/token token PERCENT17293833
Ref: 4fbd17293833
Ref: library/token token LBRACE17294012
Ref: 4fa217294012
Ref: library/token token RBRACE17294192
Ref: 4fa317294192
Ref: library/token token EQEQUAL17294373
Ref: 4fbe17294373
Ref: library/token token NOTEQUAL17294555
Ref: 4fbf17294555
Ref: library/token token LESSEQUAL17294737
Ref: 4fc017294737
Ref: library/token token GREATEREQUAL17294921
Ref: 4fc117294921
Ref: library/token token TILDE17295095
Ref: 4fc217295095
Ref: library/token token CIRCUMFLEX17295280
Ref: 4fc317295280
Ref: library/token token LEFTSHIFT17295459
Ref: 4fc417295459
Ref: library/token token RIGHTSHIFT17295641
Ref: 4fc517295641
Ref: library/token token DOUBLESTAR17295822
Ref: 4fc617295822
Ref: library/token token PLUSEQUAL17296002
Ref: 4fc717296002
Ref: library/token token MINEQUAL17296182
Ref: 4fc817296182
Ref: library/token token STAREQUAL17296364
Ref: 4fc917296364
Ref: library/token token SLASHEQUAL17296546
Ref: 4fca17296546
Ref: library/token token PERCENTEQUAL17296729
Ref: 4fcb17296729
Ref: library/token token AMPEREQUAL17296908
Ref: 4fcc17296908
Ref: library/token token VBAREQUAL17297088
Ref: 4fcd17297088
Ref: library/token token CIRCUMFLEXEQUAL17297275
Ref: 4fce17297275
Ref: library/token token LEFTSHIFTEQUAL17297455
Ref: 4fcf17297455
Ref: library/token token RIGHTSHIFTEQUAL17297638
Ref: 4fd017297638
Ref: library/token token DOUBLESTAREQUAL17297820
Ref: 4fd117297820
Ref: library/token token DOUBLESLASH17297998
Ref: 4fd217297998
Ref: library/token token DOUBLESLASHEQUAL17298184
Ref: 4fd317298184
Ref: library/token token AT17298352
Ref: 4fd417298352
Ref: library/token token ATEQUAL17298537
Ref: 4fd517298537
Ref: library/token token RARROW17298717
Ref: 4fd617298717
Ref: library/token token ELLIPSIS17298900
Ref: 4fd717298900
Ref: library/token token COLONEQUAL17299084
Ref: 4fd817299084
Ref: library/token token EXCLAMATION17299266
Ref: 4fa417299266
Ref: library/token token N_TOKENS17299408
Ref: 4fd917299408
Ref: library/token token EXACT_TOKEN_TYPES17299495
Ref: 194917299495
Ref: token --- Python 解析木で使われる定数-Footnote-117300482
Node: keyword --- Python キーワードのテスト17300547
Ref: library/keyword doc17300775
Ref: 4fda17300775
Ref: library/keyword keyword-testing-for-python-keywords17300775
Ref: 4fdb17300775
Ref: library/keyword module-keyword17300775
Ref: 8817300775
Ref: library/keyword translation-repo17300775
Ref: 4fdc17300775
Ref: library/keyword keyword iskeyword17301187
Ref: 26ae17301187
Ref: library/keyword keyword kwlist17301328
Ref: 4fdd17301328
Ref: library/keyword keyword issoftkeyword17301610
Ref: 4fac17301610
Ref: library/keyword keyword softkwlist17301791
Ref: 4fde17301791
Ref: keyword --- Python キーワードのテスト-Footnote-117302158
Node: tokenize --- Python ソース用のトークナイザー17302225
Ref: library/tokenize doc17302458
Ref: 4fdf17302458
Ref: library/tokenize module-tokenize17302458
Ref: 10217302458
Ref: library/tokenize tokenize-tokenizer-for-python-source17302458
Ref: 4fe017302458
Ref: library/tokenize translation-repo17302458
Ref: 4fe117302458
Ref: tokenize --- Python ソース用のトークナイザー-Footnote-117303830
Node: Tokenizing Input17303898
Ref: library/tokenize tokenizing-input17304034
Ref: 4fe217304034
Ref: library/tokenize tokenize tokenize17304165
Ref: 70017304165
Ref: library/tokenize tokenize generate_tokens17305957
Ref: 70117305957
Ref: library/tokenize tokenize untokenize17306825
Ref: 191517306825
Ref: library/tokenize tokenize detect_encoding17307919
Ref: 182517307919
Ref: library/tokenize tokenize open17309183
Ref: 2d5b17309183
Ref: library/tokenize tokenize TokenError17309422
Ref: 76417309422
Ref: Tokenizing Input-Footnote-117309765
Ref: Tokenizing Input-Footnote-217309807
Node: Command-Line Usage17309849
Ref: library/tokenize command-line-usage17310007
Ref: 4fe317310007
Ref: library/tokenize tokenize-cli17310007
Ref: 4fe417310007
Ref: library/tokenize cmdoption-tokenize-h17310277
Ref: 4fe517310277
Ref: library/tokenize cmdoption-tokenize-help17310277
Ref: 4fe617310277
Ref: library/tokenize cmdoption-tokenize-e17310368
Ref: 4fe717310368
Ref: library/tokenize cmdoption-tokenize-exact17310368
Ref: 4fe817310368
Node: 使用例<50>17310651
Ref: library/tokenize examples17310784
Ref: 4fe917310784
Node: tabnanny --- あいまいなインデントの検出17315349
Ref: library/tabnanny doc17315596
Ref: 4fea17315596
Ref: library/tabnanny module-tabnanny17315596
Ref: e317315596
Ref: library/tabnanny tabnanny-detection-of-ambiguous-indentation17315596
Ref: 4feb17315596
Ref: library/tabnanny translation-repo17315596
Ref: 4fec17315596
Ref: library/tabnanny tabnanny check17316254
Ref: 4fed17316254
Ref: library/tabnanny tabnanny verbose17316837
Ref: 4fee17316837
Ref: library/tabnanny tabnanny filename_only17317069
Ref: 4fef17317069
Ref: library/tabnanny tabnanny NannyNag17317364
Ref: 4ff017317364
Ref: library/tabnanny tabnanny process_tokens17317593
Ref: 4ff117317593
Ref: tabnanny --- あいまいなインデントの検出-Footnote-117317955
Node: pyclbr --- Python モジュールブラウザーサポート17318023
Ref: library/pyclbr doc17318281
Ref: 4ff217318281
Ref: library/pyclbr module-pyclbr17318281
Ref: b917318281
Ref: library/pyclbr pyclbr-python-module-browser-support17318281
Ref: 4ff317318281
Ref: library/pyclbr translation-repo17318281
Ref: 4ff417318281
Ref: library/pyclbr pyclbr readmodule17319008
Ref: a3017319008
Ref: library/pyclbr pyclbr readmodule_ex17319620
Ref: a3117319620
Ref: pyclbr --- Python モジュールブラウザーサポート-Footnote-117320738
Node: Function オブジェクト17320804
Ref: library/pyclbr function-objects17320967
Ref: 4ff517320967
Ref: library/pyclbr pyclbr-function-objects17320967
Ref: 4ff617320967
Ref: library/pyclbr pyclbr Function17321036
Ref: 4ff717321036
Ref: library/pyclbr pyclbr Function file17321193
Ref: 4ff817321193
Ref: library/pyclbr pyclbr Function module17321281
Ref: 4ff917321281
Ref: library/pyclbr pyclbr Function name17321376
Ref: 4ffa17321376
Ref: library/pyclbr pyclbr Function lineno17321438
Ref: 4ffb17321438
Ref: library/pyclbr pyclbr Function parent17321534
Ref: 4ffc17321534
Ref: library/pyclbr pyclbr Function children17321688
Ref: 4ffd17321688
Ref: library/pyclbr pyclbr Function is_async17321860
Ref: 4ffe17321860
Node: クラスオブジェクト<2>17322045
Ref: library/pyclbr class-objects17322208
Ref: 4fff17322208
Ref: library/pyclbr pyclbr-class-objects17322208
Ref: 500017322208
Ref: library/pyclbr pyclbr Class17322274
Ref: 500117322274
Ref: library/pyclbr pyclbr Class file17322464
Ref: 500217322464
Ref: library/pyclbr pyclbr Class module17322549
Ref: 500317322549
Ref: library/pyclbr pyclbr Class name17322641
Ref: 500417322641
Ref: library/pyclbr pyclbr Class lineno17322706
Ref: 500517322706
Ref: library/pyclbr pyclbr Class parent17322802
Ref: 500617322802
Ref: library/pyclbr pyclbr Class children17322952
Ref: 500717322952
Ref: library/pyclbr pyclbr Class super17323112
Ref: 500817323112
Ref: library/pyclbr pyclbr Class methods17323473
Ref: 500917323473
Node: py_compile --- Python ソースファイルをコンパイルする17323701
Ref: library/py_compile doc17323977
Ref: 500a17323977
Ref: library/py_compile module-py_compile17323977
Ref: b817323977
Ref: library/py_compile py-compile-compile-python-source-files17323977
Ref: 500b17323977
Ref: library/py_compile translation-repo17323977
Ref: 500c17323977
Ref: library/py_compile py_compile PyCompileError17324754
Ref: 500d17324754
Ref: library/py_compile py_compile compile17324887
Ref: c1e17324887
Ref: library/py_compile py_compile PycInvalidationMode17329255
Ref: 500e17329255
Ref: library/py_compile py_compile PycInvalidationMode TIMESTAMP17329709
Ref: 501017329709
Ref: library/py_compile py_compile PycInvalidationMode CHECKED_HASH17329991
Ref: 500f17329991
Ref: library/py_compile py_compile PycInvalidationMode UNCHECKED_HASH17330237
Ref: 501117330237
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-117330831
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-217330901
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-317330943
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-417330985
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-517331027
Node: コマンドラインインターフェイス<4>17331069
Ref: library/py_compile command-line-interface17331221
Ref: 501217331221
Ref: library/py_compile py-compile-cli17331221
Ref: 501317331221
Ref: library/py_compile cmdoption-python-m-py_compile-arg-file17331681
Ref: 501417331681
Ref: library/py_compile cmdoption-python-m-py_compile17331712
Ref: 501517331712
Ref: library/py_compile cmdoption-python-m-py_compile-q17331864
Ref: 501617331864
Ref: library/py_compile cmdoption-python-m-py_compile-quiet17331864
Ref: 501717331864
Node: compileall --- Python ライブラリをバイトコンパイルする17332269
Ref: library/compileall doc17332542
Ref: 501817332542
Ref: library/compileall compileall-byte-compile-python-libraries17332542
Ref: 501917332542
Ref: library/compileall module-compileall17332542
Ref: 2117332542
Ref: library/compileall translation-repo17332542
Ref: 501a17332542
Ref: compileall --- Python ライブラリをバイトコンパイルする-Footnote-117333716
Node: コマンドラインでの使用<9>17333786
Ref: library/compileall command-line-use17333962
Ref: 501b17333962
Ref: library/compileall compileall-cli17333962
Ref: 501c17333962
Ref: library/compileall cmdoption-compileall-arg-directory17334193
Ref: 501d17334193
Ref: library/compileall cmdoption-compileall-arg-file17334219
Ref: 501e17334219
Ref: library/compileall cmdoption-compileall-l17334540
Ref: 501f17334540
Ref: library/compileall cmdoption-compileall-f17334752
Ref: 502017334752
Ref: library/compileall cmdoption-compileall-q17334853
Ref: 502117334853
Ref: library/compileall cmdoption-compileall-d17335107
Ref: 502217335107
Ref: library/compileall cmdoption-compileall-s17335582
Ref: 502317335582
Ref: library/compileall cmdoption-compileall-p17335797
Ref: 502417335797
Ref: library/compileall cmdoption-compileall-x17336017
Ref: 502517336017
Ref: library/compileall cmdoption-compileall-i17336211
Ref: 502617336211
Ref: library/compileall cmdoption-compileall-b17336496
Ref: 502717336496
Ref: library/compileall cmdoption-compileall-r17336896
Ref: 502817336896
Ref: library/compileall cmdoption-compileall-j17337208
Ref: 502917337208
Ref: library/compileall cmdoption-compileall-invalidation-mode17337395
Ref: 502a17337395
Ref: library/compileall cmdoption-compileall-o17338487
Ref: 502b17338487
Ref: library/compileall cmdoption-compileall-e17338680
Ref: 502c17338680
Ref: library/compileall cmdoption-compileall-hardlink-dupes17338760
Ref: 502d17338760
Ref: コマンドラインでの使用<9>-Footnote-117340234
Node: パブリックな関数17340276
Ref: library/compileall public-functions17340452
Ref: 502e17340452
Ref: library/compileall compileall compile_dir17340513
Ref: d1f17340513
Ref: library/compileall compileall compile_file17345351
Ref: fe517345351
Ref: library/compileall compileall compile_path17348849
Ref: fe617348849
Ref: パブリックな関数-Footnote-117350975
Ref: パブリックな関数-Footnote-217351017
Node: dis --- Python バイトコードの逆アセンブラー17351059
Ref: library/dis doc17351315
Ref: 502f17351315
Ref: library/dis dis-disassembler-for-python-bytecode17351315
Ref: 503017351315
Ref: library/dis module-dis17351315
Ref: 3c17351315
Ref: library/dis translation-repo17351315
Ref: 503117351315
Ref: dis --- Python バイトコードの逆アセンブラー-Footnote-117354508
Node: コマンドライン・インターフェース<12>17354571
Ref: library/dis command-line-interface17354750
Ref: 503217354750
Ref: library/dis dis-cli17354750
Ref: 503317354750
Ref: library/dis cmdoption-dis-h17355027
Ref: 503417355027
Ref: library/dis cmdoption-dis-help17355027
Ref: 503517355027
Ref: library/dis cmdoption-dis-C17355100
Ref: 503617355100
Ref: library/dis cmdoption-dis-show-caches17355100
Ref: 503717355100
Ref: library/dis cmdoption-dis-O17355186
Ref: 4eb17355186
Ref: library/dis cmdoption-dis-show-offsets17355186
Ref: 503817355186
Ref: library/dis cmdoption-dis-P17355283
Ref: 20a17355283
Ref: library/dis cmdoption-dis-show-positions17355283
Ref: 503917355283
Ref: library/dis cmdoption-dis-S17355403
Ref: 20b17355403
Ref: library/dis cmdoption-dis-specialized17355403
Ref: 503a17355403
Node: バイトコード解析17355658
Ref: library/dis bytecode-analysis17355858
Ref: 503b17355858
Ref: library/dis dis Bytecode17356174
Ref: 20617356174
Ref: library/dis dis Bytecode from_traceback17358234
Ref: 113517358234
Ref: library/dis dis Bytecode codeobj17358536
Ref: 503c17358536
Ref: library/dis dis Bytecode first_line17358631
Ref: 503d17358631
Ref: library/dis dis Bytecode dis17358756
Ref: 113417358756
Ref: library/dis dis Bytecode info17358978
Ref: 503e17358978
Node: 解析関数17359721
Ref: library/dis analysis-functions17359900
Ref: 503f17359900
Ref: library/dis dis code_info17360183
Ref: 145517360183
Ref: library/dis dis show_code17360808
Ref: 113317360808
Ref: library/dis dis dis17361411
Ref: 20717361411
Ref: library/dis dis distb17363578
Ref: 20817363578
Ref: library/dis dis disassemble17364440
Ref: 20917364440
Ref: library/dis dis disco17364599
Ref: 504017364599
Ref: library/dis dis get_instructions17366109
Ref: 4ec17366109
Ref: library/dis dis findlinestarts17367411
Ref: 504117367411
Ref: library/dis dis findlabels17368140
Ref: 504217368140
Ref: library/dis dis stack_effect17368311
Ref: 113617368311
Ref: 解析関数-Footnote-117369262
Node: Python バイトコード命令17369304
Ref: library/dis bytecodes17369492
Ref: 7cf17369492
Ref: library/dis python-bytecode-instructions17369492
Ref: 504317369492
Ref: library/dis dis Instruction17369751
Ref: 20517369751
Ref: library/dis dis Instruction opcode17369823
Ref: 504417369823
Ref: library/dis dis Instruction opname17370033
Ref: 504617370033
Ref: library/dis dis Instruction baseopcode17370106
Ref: 504717370106
Ref: library/dis dis Instruction baseopname17370263
Ref: 504817370263
Ref: library/dis dis Instruction arg17370427
Ref: 504a17370427
Ref: library/dis dis Instruction oparg17370529
Ref: 504b17370529
Ref: library/dis dis Instruction argval17370594
Ref: 504c17370594
Ref: library/dis dis Instruction argrepr17370683
Ref: 504d17370683
Ref: library/dis dis Instruction offset17370819
Ref: 504e17370819
Ref: library/dis dis Instruction start_offset17370913
Ref: 504f17370913
Ref: library/dis dis Instruction cache_offset17371129
Ref: 505017371129
Ref: library/dis dis Instruction end_offset17371231
Ref: 505117371231
Ref: library/dis dis Instruction starts_line17371329
Ref: 505217371329
Ref: library/dis dis Instruction line_number17371443
Ref: 505317371443
Ref: library/dis dis Instruction is_jump_target17371575
Ref: 505417371575
Ref: library/dis dis Instruction jump_target17371742
Ref: 505517371742
Ref: library/dis dis Instruction positions17371880
Ref: 505617371880
Ref: library/dis dis Instruction cache_info17372040
Ref: 505717372040
Ref: library/dis dis Positions17372768
Ref: 19a017372768
Ref: library/dis dis Positions lineno17372884
Ref: 505817372884
Ref: library/dis dis Positions end_lineno17372912
Ref: 505917372912
Ref: library/dis dis Positions col_offset17372944
Ref: 505a17372944
Ref: library/dis dis Positions end_col_offset17372976
Ref: 505b17372976
Ref: library/dis opcode-NOP17373350
Ref: 505c17373350
Ref: library/dis opcode-NOT_TAKEN17373482
Ref: 37417373482
Ref: library/dis opcode-POP_ITER17373692
Ref: 36e17373692
Ref: library/dis opcode-POP_TOP17373797
Ref: 505d17373797
Ref: library/dis opcode-END_FOR17373878
Ref: 505e17373878
Ref: library/dis opcode-END_SEND17374055
Ref: 505f17374055
Ref: library/dis opcode-COPY17374191
Ref: 91817374191
Ref: library/dis opcode-SWAP17374402
Ref: 91917374402
Ref: library/dis opcode-CACHE17374563
Ref: 90917374563
Ref: library/dis opcode-UNARY_NEGATIVE17375441
Ref: 506017375441
Ref: library/dis opcode-UNARY_NOT17375516
Ref: 1ac217375516
Ref: library/dis opcode-UNARY_INVERT17375697
Ref: 506117375697
Ref: library/dis opcode-GET_ITER17375770
Ref: 506217375770
Ref: library/dis opcode-GET_YIELD_FROM_ITER17375844
Ref: 506317375844
Ref: library/dis opcode-TO_BOOL17376084
Ref: 1abf17376084
Ref: library/dis opcode-BINARY_OP17376601
Ref: 36417376601
Ref: library/dis opcode-STORE_SUBSCR17376978
Ref: 1c0817376978
Ref: library/dis opcode-DELETE_SUBSCR17377148
Ref: 506417377148
Ref: library/dis opcode-BINARY_SLICE17377285
Ref: 70517377285
Ref: library/dis opcode-STORE_SLICE17377496
Ref: 70617377496
Ref: library/dis opcode-GET_AWAITABLE17377764
Ref: 1c2417377764
Ref: library/dis opcode-GET_AITER17378397
Ref: 506517378397
Ref: library/dis opcode-GET_ANEXT17378621
Ref: 506617378621
Ref: library/dis opcode-END_ASYNC_FOR17378828
Ref: ca417378828
Ref: library/dis opcode-CLEANUP_THROW17379320
Ref: 70917379320
Ref: library/dis opcode-SET_ADD17379713
Ref: 506717379713
Ref: library/dis opcode-LIST_APPEND17379865
Ref: 506817379865
Ref: library/dis opcode-MAP_ADD17380026
Ref: ca617380026
Ref: library/dis opcode-RETURN_VALUE17380685
Ref: 1b7f17380685
Ref: library/dis opcode-YIELD_VALUE17380777
Ref: 5ba17380777
Ref: library/dis opcode-SETUP_ANNOTATIONS17381194
Ref: f5417381194
Ref: library/dis opcode-POP_EXCEPT17381494
Ref: 506917381494
Ref: library/dis opcode-RERAISE17381723
Ref: 506a17381723
Ref: library/dis opcode-PUSH_EXC_INFO17382088
Ref: 91317382088
Ref: library/dis opcode-CHECK_EXC_MATCH17382328
Ref: 91a17382328
Ref: library/dis opcode-CHECK_EG_MATCH17382590
Ref: 91217382590
Ref: library/dis opcode-WITH_EXCEPT_START17383047
Ref: 506b17383047
Ref: library/dis opcode-LOAD_COMMON_CONSTANT17383590
Ref: 36817383590
Ref: library/dis opcode-LOAD_BUILD_CLASS17383879
Ref: 506c17383879
Ref: library/dis opcode-GET_LEN17384018
Ref: 506d17384018
Ref: library/dis opcode-MATCH_MAPPING17384215
Ref: 506e17384215
Ref: library/dis opcode-MATCH_SEQUENCE17384536
Ref: 506f17384536
Ref: library/dis opcode-MATCH_KEYS17384950
Ref: 92117384950
Ref: library/dis opcode-STORE_NAME17385424
Ref: 507017385424
Ref: library/dis opcode-DELETE_NAME17385708
Ref: 507217385708
Ref: library/dis opcode-UNPACK_SEQUENCE17385874
Ref: 1c2617385874
Ref: library/dis opcode-UNPACK_EX17386166
Ref: 507317386166
Ref: library/dis opcode-STORE_ATTR17387125
Ref: 1c2517387125
Ref: library/dis opcode-DELETE_ATTR17387363
Ref: 507417387363
Ref: library/dis opcode-STORE_GLOBAL17387570
Ref: 507117387570
Ref: library/dis opcode-DELETE_GLOBAL17387731
Ref: 507517387731
Ref: library/dis opcode-LOAD_CONST17387887
Ref: 507617387887
Ref: library/dis opcode-LOAD_SMALL_INT17387993
Ref: 36c17387993
Ref: library/dis opcode-LOAD_NAME17388140
Ref: 507717388140
Ref: library/dis opcode-LOAD_LOCALS17388336
Ref: 70e17388336
Ref: library/dis opcode-LOAD_FROM_DICT_OR_GLOBALS17388601
Ref: 70d17388601
Ref: library/dis opcode-BUILD_TEMPLATE17388994
Ref: 36617388994
Ref: library/dis opcode-BUILD_INTERPOLATION17389353
Ref: 36517389353
Ref: library/dis opcode-BUILD_TUPLE17390366
Ref: 507817390366
Ref: library/dis opcode-BUILD_LIST17390692
Ref: 507917390692
Ref: library/dis opcode-BUILD_SET17390849
Ref: 507a17390849
Ref: library/dis opcode-BUILD_MAP17391001
Ref: 36717391001
Ref: library/dis opcode-BUILD_STRING17391389
Ref: f5117391389
Ref: library/dis opcode-LIST_EXTEND17391554
Ref: 507b17391554
Ref: library/dis opcode-SET_UPDATE17391723
Ref: 507c17391723
Ref: library/dis opcode-DICT_UPDATE17391889
Ref: 507d17391889
Ref: library/dis opcode-DICT_MERGE17392058
Ref: 507e17392058
Ref: library/dis opcode-LOAD_ATTR17392199
Ref: 70417392199
Ref: library/dis opcode-LOAD_SUPER_ATTR17393142
Ref: 70217393142
Ref: library/dis opcode-COMPARE_OP17394213
Ref: b6517394213
Ref: library/dis opcode-IS_OP17394599
Ref: 199c17394599
Ref: library/dis opcode-CONTAINS_OP17394729
Ref: 199b17394729
Ref: library/dis opcode-IMPORT_NAME17394865
Ref: 507f17394865
Ref: library/dis opcode-IMPORT_FROM17395285
Ref: 508017395285
Ref: library/dis opcode-JUMP_FORWARD17395534
Ref: 19d217395534
Ref: library/dis opcode-JUMP_BACKWARD17395644
Ref: 91b17395644
Ref: library/dis opcode-JUMP_BACKWARD_NO_INTERRUPT17395778
Ref: 90f17395778
Ref: library/dis opcode-POP_JUMP_IF_TRUE17395938
Ref: 1ac017395938
Ref: library/dis opcode-POP_JUMP_IF_FALSE17396501
Ref: 1ac117396501
Ref: library/dis opcode-POP_JUMP_IF_NOT_NONE17397067
Ref: 1bdf17397067
Ref: library/dis opcode-POP_JUMP_IF_NONE17397337
Ref: 1bde17397337
Ref: library/dis opcode-FOR_ITER17397599
Ref: 1b2417397599
Ref: library/dis opcode-LOAD_GLOBAL17398019
Ref: 1abb17398019
Ref: library/dis opcode-LOAD_FAST17398315
Ref: 508117398315
Ref: library/dis opcode-LOAD_FAST_BORROW17398655
Ref: 36a17398655
Ref: library/dis opcode-LOAD_FAST_LOAD_FAST17398819
Ref: 508217398819
Ref: library/dis opcode-LOAD_FAST_BORROW_LOAD_FAST_BORROW17399010
Ref: 36b17399010
Ref: library/dis opcode-LOAD_FAST_CHECK17399224
Ref: 70b17399224
Ref: library/dis opcode-LOAD_FAST_AND_CLEAR17399473
Ref: 70a17399473
Ref: library/dis opcode-STORE_FAST17399771
Ref: 1ac417399771
Ref: library/dis opcode-STORE_FAST_STORE_FAST17399879
Ref: 508317399879
Ref: library/dis opcode-STORE_FAST_LOAD_FAST17400085
Ref: 508417400085
Ref: library/dis opcode-DELETE_FAST17400333
Ref: 508517400333
Ref: library/dis opcode-MAKE_CELL17400439
Ref: 91017400439
Ref: library/dis opcode-LOAD_DEREF17400613
Ref: 508617400613
Ref: library/dis opcode-LOAD_FROM_DICT_OR_DEREF17400901
Ref: 70c17400901
Ref: library/dis opcode-STORE_DEREF17401428
Ref: 508717401428
Ref: library/dis opcode-DELETE_DEREF17401676
Ref: 508817401676
Ref: library/dis opcode-COPY_FREE_VARS17401972
Ref: 90e17401972
Ref: library/dis opcode-RAISE_VARARGS17402218
Ref: 508917402218
Ref: library/dis opcode-CALL17402687
Ref: 91617402687
Ref: library/dis opcode-CALL_KW17403472
Ref: 37017403472
Ref: library/dis opcode-CALL_FUNCTION_EX17404304
Ref: f5317404304
Ref: library/dis opcode-PUSH_NULL17404982
Ref: 91717404982
Ref: library/dis opcode-MAKE_FUNCTION17405180
Ref: f5217405180
Ref: library/dis opcode-SET_FUNCTION_ATTRIBUTE17405678
Ref: 508a17405678
Ref: library/dis opcode-BUILD_SLICE17406598
Ref: 508b17406598
Ref: library/dis opcode-EXTENDED_ARG17407067
Ref: 1b7d17407067
Ref: library/dis opcode-CONVERT_VALUE17407404
Ref: 508c17407404
Ref: library/dis opcode-FORMAT_SIMPLE17407880
Ref: 508d17407880
Ref: library/dis opcode-FORMAT_WITH_SPEC17408146
Ref: 508e17408146
Ref: library/dis opcode-MATCH_CLASS17408463
Ref: 92017408463
Ref: library/dis opcode-RESUME17409187
Ref: 5bb17409187
Ref: library/dis opcode-RETURN_GENERATOR17409932
Ref: 90c17409932
Ref: library/dis opcode-SEND17410226
Ref: 90d17410226
Ref: library/dis opcode-HAVE_ARGUMENT17410591
Ref: 6b117410591
Ref: library/dis opcode-CALL_INTRINSIC_117411463
Ref: 70717411463
Ref: library/dis opcode-CALL_INTRINSIC_217414786
Ref: 70817414786
Ref: library/dis opcode-LOAD_SPECIAL17416647
Ref: 36d17416647
Ref: library/dis opcode-SETUP_FINALLY17417165
Ref: 508f17417165
Ref: library/dis opcode-SETUP_CLEANUP17417429
Ref: 509017417429
Ref: library/dis opcode-SETUP_WITH17417834
Ref: 509117417834
Ref: library/dis opcode-POP_BLOCK17418264
Ref: 509217418264
Ref: library/dis opcode-LOAD_CONST_IMMORTAL17418417
Ref: 37317418417
Ref: library/dis opcode-JUMP17418547
Ref: 509317418547
Ref: library/dis opcode-JUMP_NO_INTERRUPT17418564
Ref: 1c0217418564
Ref: library/dis opcode-JUMP_IF_TRUE17418731
Ref: 37117418731
Ref: library/dis opcode-JUMP_IF_FALSE17418756
Ref: 37217418756
Ref: library/dis opcode-LOAD_CLOSURE17418928
Ref: 1abe17418928
Node: 命令コードコレクション17419226
Ref: library/dis id117419393
Ref: 509417419393
Ref: library/dis opcode-collections17419393
Ref: 504517419393
Ref: library/dis dis opname17419808
Ref: 504917419808
Ref: library/dis dis opmap17419954
Ref: 509517419954
Ref: library/dis dis cmp_op17420053
Ref: 509617420053
Ref: library/dis dis hasarg17420135
Ref: 59f17420135
Ref: library/dis dis hasconst17420244
Ref: 509717420244
Ref: library/dis dis hasfree17420340
Ref: 509817420340
Ref: library/dis dis hasname17420689
Ref: 509917420689
Ref: library/dis dis hasjump17420802
Ref: 509a17420802
Ref: library/dis dis haslocal17420942
Ref: 509b17420942
Ref: library/dis dis hascompare17421050
Ref: 509c17421050
Ref: library/dis dis hasexc17421139
Ref: 6b217421139
Ref: library/dis dis hasjrel17421254
Ref: 509d17421254
Ref: library/dis dis hasjabs17421452
Ref: 509e17421452
Node: pickletools --- pickle 開発者用のツール群17421645
Ref: library/pickletools doc17421822
Ref: 509f17421822
Ref: library/pickletools module-pickletools17421822
Ref: ac17421822
Ref: library/pickletools pickletools-tools-for-pickle-developers17421822
Ref: 50a017421822
Ref: library/pickletools translation-repo17421822
Ref: 50a117421822
Ref: pickletools --- pickle 開発者用のツール群-Footnote-117422613
Node: コマンドラインでの使用<10>17422684
Ref: library/pickletools command-line-usage17422839
Ref: 50a217422839
Ref: library/pickletools pickletools-cli17422839
Ref: 2dab17422839
Node: コマンドラインオプション<6>17424074
Ref: library/pickletools command-line-options17424187
Ref: 50a317424187
Ref: library/pickletools cmdoption-pickletools-a17424270
Ref: 50a417424270
Ref: library/pickletools cmdoption-pickletools-annotate17424270
Ref: 50a517424270
Ref: library/pickletools cmdoption-pickletools-o17424380
Ref: 50a617424380
Ref: library/pickletools cmdoption-pickletools-output17424380
Ref: 50a717424380
Ref: library/pickletools cmdoption-pickletools-l17424465
Ref: 50a817424465
Ref: library/pickletools cmdoption-pickletools-indentlevel17424465
Ref: 50a917424465
Ref: library/pickletools cmdoption-pickletools-m17424581
Ref: 50aa17424581
Ref: library/pickletools cmdoption-pickletools-memo17424581
Ref: 50ab17424581
Ref: library/pickletools cmdoption-pickletools-p17424735
Ref: 50ac17424735
Ref: library/pickletools cmdoption-pickletools-preamble17424735
Ref: 50ad17424735
Ref: library/pickletools cmdoption-pickletools-arg-pickle_file17424876
Ref: 50ae17424876
Node: Programmatic interface17424987
Ref: library/pickletools programmatic-interface17425142
Ref: 50af17425142
Ref: library/pickletools pickletools dis17425209
Ref: ec217425209
Ref: library/pickletools pickletools genops17426259
Ref: 50b017426259
Ref: library/pickletools pickletools optimize17426856
Ref: 2d9217426856
Node: MS Windows 固有のサービス17427245
Ref: library/windows doc17427406
Ref: 50b117427406
Ref: library/windows ms-windows-specific-services17427406
Ref: 50b217427406
Ref: library/windows mswin-specific-services17427406
Ref: 227c17427406
Ref: library/windows translation-repo17427406
Ref: 50b317427406
Node: msvcrt --- MS VC++ ランタイムの有用なルーチン群17427975
Ref: library/msvcrt doc17428166
Ref: 50b417428166
Ref: library/msvcrt module-msvcrt17428166
Ref: 9717428166
Ref: library/msvcrt msvcrt-useful-routines-from-the-ms-vc-runtime17428166
Ref: 50b517428166
Node: ファイル操作関連17429648
Ref: library/msvcrt file-operations17429805
Ref: 50b617429805
Ref: library/msvcrt msvcrt-files17429805
Ref: 50b717429805
Ref: library/msvcrt msvcrt locking17429866
Ref: 4ae317429866
Ref: library/msvcrt msvcrt LK_LOCK17430554
Ref: 50b817430554
Ref: library/msvcrt msvcrt LK_RLCK17430584
Ref: 50b917430584
Ref: library/msvcrt msvcrt LK_NBLCK17430830
Ref: 50ba17430830
Ref: library/msvcrt msvcrt LK_NBRLCK17430861
Ref: 50bb17430861
Ref: library/msvcrt msvcrt LK_UNLCK17431060
Ref: 50bc17431060
Ref: library/msvcrt msvcrt setmode17431246
Ref: 50bd17431246
Ref: library/msvcrt msvcrt open_osfhandle17431573
Ref: 4ae417431573
Ref: library/msvcrt msvcrt get_osfhandle17432249
Ref: 4ae217432249
Node: コンソール I/O 関連17432534
Ref: library/msvcrt console-i-o17432718
Ref: 50be17432718
Ref: library/msvcrt msvcrt-console17432718
Ref: 50bf17432718
Ref: library/msvcrt msvcrt kbhit17432784
Ref: 50c017432784
Ref: library/msvcrt msvcrt getch17432909
Ref: 50c117432909
Ref: library/msvcrt msvcrt getwch17433397
Ref: 161317433397
Ref: library/msvcrt msvcrt getche17433517
Ref: 50c217433517
Ref: library/msvcrt msvcrt getwche17433665
Ref: 161417433665
Ref: library/msvcrt msvcrt putch17433787
Ref: 50c317433787
Ref: library/msvcrt msvcrt putwch17433940
Ref: 161517433940
Ref: library/msvcrt msvcrt ungetch17434087
Ref: 50c417434087
Ref: library/msvcrt msvcrt ungetwch17434382
Ref: 50c517434382
Node: その多の関数17434533
Ref: library/msvcrt msvcrt-other17434684
Ref: 50c617434684
Ref: library/msvcrt other-functions17434684
Ref: 50c717434684
Ref: library/msvcrt msvcrt heapmin17434735
Ref: 50c817434735
Ref: library/msvcrt msvcrt set_error_mode17434929
Ref: 50c917434929
Ref: library/msvcrt msvcrt OUT_TO_DEFAULT17435302
Ref: 50cb17435302
Ref: library/msvcrt msvcrt OUT_TO_STDERR17435448
Ref: 50cc17435448
Ref: library/msvcrt msvcrt OUT_TO_MSGBOX17435581
Ref: 50cd17435581
Ref: library/msvcrt msvcrt REPORT_ERRMODE17435711
Ref: 50ca17435711
Ref: library/msvcrt msvcrt CrtSetReportMode17435850
Ref: 50ce17435850
Ref: library/msvcrt msvcrt CrtSetReportFile17436239
Ref: 50cf17436239
Ref: library/msvcrt msvcrt CRT_WARN17436637
Ref: 50d117436637
Ref: library/msvcrt msvcrt CRT_ERROR17436755
Ref: 50d217436755
Ref: library/msvcrt msvcrt CRT_ASSERT17436876
Ref: 50d317436876
Ref: library/msvcrt msvcrt CRTDBG_MODE_DEBUG17436936
Ref: 50d417436936
Ref: library/msvcrt msvcrt CRTDBG_MODE_FILE17437035
Ref: 50d017437035
Ref: library/msvcrt msvcrt CRTDBG_MODE_WNDW17437257
Ref: 50d517437257
Ref: library/msvcrt msvcrt CRTDBG_REPORT_MODE17437420
Ref: 50d617437420
Ref: library/msvcrt msvcrt CRT_ASSEMBLY_VERSION17437517
Ref: 157b17437517
Ref: library/msvcrt msvcrt VC_ASSEMBLY_PUBLICKEYTOKEN17437632
Ref: 157c17437632
Ref: library/msvcrt msvcrt LIBRARIES_ASSEMBLY_NAME_PREFIX17437766
Ref: 157d17437766
Node: winreg --- Windows レジストリへのアクセス17437906
Ref: library/winreg doc17438169
Ref: 50d717438169
Ref: library/winreg module-winreg17438169
Ref: 11d17438169
Ref: library/winreg translation-repo17438169
Ref: 50d817438169
Ref: library/winreg winreg-windows-registry-access17438169
Ref: 50d917438169
Ref: library/winreg exception-changed17438793
Ref: 50db17438793
Node: 関数<14>17439103
Ref: library/winreg functions17439221
Ref: 50dc17439221
Ref: library/winreg id117439221
Ref: 50dd17439221
Ref: library/winreg winreg CloseKey17439315
Ref: 50de17439315
Ref: library/winreg winreg ConnectRegistry17439745
Ref: 4ae917439745
Ref: library/winreg winreg CreateKey17440646
Ref: 4aea17440646
Ref: library/winreg winreg CreateKeyEx17441866
Ref: 157e17441866
Ref: library/winreg winreg DeleteKey17443597
Ref: 4aeb17443597
Ref: library/winreg winreg DeleteKeyEx17444598
Ref: 157f17444598
Ref: library/winreg winreg DeleteValue17446299
Ref: 4aec17446299
Ref: library/winreg winreg EnumKey17446768
Ref: 4aed17446768
Ref: library/winreg winreg EnumValue17447591
Ref: 4aee17447591
Ref: library/winreg winreg ExpandEnvironmentStrings17449099
Ref: 161617449099
Ref: library/winreg winreg FlushKey17449497
Ref: 50e517449497
Ref: library/winreg winreg LoadKey17450572
Ref: 4aef17450572
Ref: library/winreg winreg OpenKey17452036
Ref: 4af017452036
Ref: library/winreg winreg OpenKeyEx17452110
Ref: 50e817452110
Ref: library/winreg winreg QueryInfoKey17453532
Ref: 4af217453532
Ref: library/winreg winreg QueryValue17454519
Ref: 4af317454519
Ref: library/winreg winreg QueryValueEx17455646
Ref: 17f417455646
Ref: library/winreg winreg SaveKey17456705
Ref: 4af417456705
Ref: library/winreg winreg SetValue17457927
Ref: 4af517457927
Ref: library/winreg winreg SetValueEx17459388
Ref: 1b6117459388
Ref: library/winreg winreg DisableReflectionKey17460980
Ref: 158017460980
Ref: library/winreg winreg EnableReflectionKey17461809
Ref: 158117461809
Ref: library/winreg winreg QueryReflectionKey17462470
Ref: 158217462470
Ref: 関数<14>-Footnote-117463080
Ref: 関数<14>-Footnote-217463157
Node: 定数<12>17463234
Ref: library/winreg constants17463406
Ref: 50ed17463406
Ref: library/winreg id217463406
Ref: 50ee17463406
Node: HKEY_* 定数17463579
Ref: library/winreg hkey-constants17463666
Ref: 50e017463666
Ref: library/winreg id317463666
Ref: 50ef17463666
Ref: library/winreg winreg HKEY_CLASSES_ROOT17463711
Ref: 50f017463711
Ref: library/winreg winreg HKEY_CURRENT_USER17464033
Ref: 50f117464033
Ref: library/winreg winreg HKEY_LOCAL_MACHINE17464405
Ref: 50e717464405
Ref: library/winreg winreg HKEY_USERS17464730
Ref: 50e617464730
Ref: library/winreg winreg HKEY_PERFORMANCE_DATA17464984
Ref: 50f217464984
Ref: library/winreg winreg HKEY_CURRENT_CONFIG17465342
Ref: 50f317465342
Ref: library/winreg winreg HKEY_DYN_DATA17465524
Ref: 50f417465524
Node: アクセス権限17465659
Ref: library/winreg access-rights17465764
Ref: 50e217465764
Ref: library/winreg id417465764
Ref: 50f517465764
Ref: library/winreg winreg KEY_ALL_ACCESS17465924
Ref: 50f617465924
Ref: library/winreg winreg KEY_WRITE17466227
Ref: 50e117466227
Ref: library/winreg winreg KEY_READ17466394
Ref: 50e917466394
Ref: library/winreg winreg KEY_EXECUTE17466595
Ref: 50fc17466595
Ref: library/winreg winreg KEY_QUERY_VALUE17466671
Ref: 50f717466671
Ref: library/winreg winreg KEY_SET_VALUE17466780
Ref: 50eb17466780
Ref: library/winreg winreg KEY_CREATE_SUB_KEY17466893
Ref: 50f817466893
Ref: library/winreg winreg KEY_ENUMERATE_SUB_KEYS17467002
Ref: 50f917467002
Ref: library/winreg winreg KEY_NOTIFY17467121
Ref: 50fa17467121
Ref: library/winreg winreg KEY_CREATE_LINK17467258
Ref: 50fb17467258
Ref: アクセス権限-Footnote-117467446
Node: 64-bit 特有のアクセス権17467523
Ref: library/winreg bit-access-rights17467609
Ref: 50fd17467609
Ref: library/winreg bit-specific17467609
Ref: 50fe17467609
Ref: library/winreg winreg KEY_WOW64_64KEY17467797
Ref: 50e317467797
Ref: library/winreg winreg KEY_WOW64_32KEY17468039
Ref: 50ff17468039
Ref: 64-bit 特有のアクセス権-Footnote-117468317
Node: 値の型17468389
Ref: library/winreg id517468472
Ref: 510017468472
Ref: library/winreg value-types17468472
Ref: 50ec17468472
Ref: library/winreg winreg REG_BINARY17468604
Ref: 510117468604
Ref: library/winreg winreg REG_DWORD17468690
Ref: 510217468690
Ref: library/winreg winreg REG_DWORD_LITTLE_ENDIAN17468751
Ref: 510317468751
Ref: library/winreg winreg REG_DWORD_BIG_ENDIAN17468903
Ref: 510417468903
Ref: library/winreg winreg REG_EXPAND_SZ17469011
Ref: 50e417469011
Ref: library/winreg winreg REG_LINK17469150
Ref: 510517469150
Ref: library/winreg winreg REG_MULTI_SZ17469230
Ref: 1e1f17469230
Ref: library/winreg winreg REG_NONE17469451
Ref: 510617469451
Ref: library/winreg winreg REG_QWORD17469529
Ref: f0317469529
Ref: library/winreg winreg REG_QWORD_LITTLE_ENDIAN17469618
Ref: 510717469618
Ref: library/winreg winreg REG_RESOURCE_LIST17469797
Ref: 510817469797
Ref: library/winreg winreg REG_FULL_RESOURCE_DESCRIPTOR17469896
Ref: 510917469896
Ref: library/winreg winreg REG_RESOURCE_REQUIREMENTS_LIST17469994
Ref: 510a17469994
Ref: library/winreg winreg REG_SZ17470097
Ref: 50ea17470097
Ref: 値の型-Footnote-117470212
Node: レジストリハンドルオブジェクト17470289
Ref: library/winreg handle-object17470442
Ref: 50da17470442
Ref: library/winreg registry-handle-objects17470442
Ref: 510b17470442
Ref: library/winreg winreg PyHKEY Close17471929
Ref: 50df17471929
Ref: library/winreg winreg PyHKEY Detach17472110
Ref: 4af117472110
Ref: library/winreg winreg PyHKEY __enter__17472908
Ref: 510c17472908
Ref: library/winreg winreg PyHKEY __exit__17472946
Ref: 510d17472946
Node: winsound --- Windows 用の音声再生インターフェース17473437
Ref: library/winsound doc17473630
Ref: 510e17473630
Ref: library/winsound module-winsound17473630
Ref: 11e17473630
Ref: library/winsound translation-repo17473630
Ref: 510f17473630
Ref: library/winsound winsound-sound-playing-interface-for-windows17473630
Ref: 511017473630
Ref: library/winsound winsound Beep17474027
Ref: f0517474027
Ref: library/winsound winsound PlaySound17474483
Ref: f0717474483
Ref: library/winsound winsound MessageBeep17475224
Ref: f0617475224
Ref: library/winsound winsound SND_FILENAME17476020
Ref: 511117476020
Ref: library/winsound winsound SND_ALIAS17476212
Ref: 511217476212
Ref: library/winsound winsound SND_LOOP17478124
Ref: 511417478124
Ref: library/winsound winsound SND_MEMORY17478436
Ref: 511617478436
Ref: library/winsound winsound SND_PURGE17478985
Ref: 511717478985
Ref: library/winsound winsound SND_ASYNC17479251
Ref: 511517479251
Ref: library/winsound winsound SND_NODEFAULT17479389
Ref: 511317479389
Ref: library/winsound winsound SND_NOSTOP17479561
Ref: 511817479561
Ref: library/winsound winsound SND_NOWAIT17479673
Ref: 511917479673
Ref: library/winsound winsound SND_APPLICATION17479955
Ref: 511a17479955
Ref: library/winsound winsound SND_SENTRY17480195
Ref: 511b17480195
Ref: library/winsound winsound SND_SYNC17480321
Ref: 511c17480321
Ref: library/winsound winsound SND_SYSTEM17480456
Ref: 511d17480456
Ref: library/winsound winsound MB_ICONASTERISK17480602
Ref: 511e17480602
Ref: library/winsound winsound MB_ICONEXCLAMATION17480698
Ref: 511f17480698
Ref: library/winsound winsound MB_ICONHAND17480801
Ref: 512017480801
Ref: library/winsound winsound MB_ICONQUESTION17480890
Ref: 512117480890
Ref: library/winsound winsound MB_OK17480987
Ref: 512217480987
Ref: library/winsound winsound MB_ICONERROR17481073
Ref: 512317481073
Ref: library/winsound winsound MB_ICONINFORMATION17481192
Ref: 512417481192
Ref: library/winsound winsound MB_ICONSTOP17481320
Ref: 512517481320
Ref: library/winsound winsound MB_ICONWARNING17481438
Ref: 512617481438
Node: Unix-specific services17481566
Ref: library/unix doc17481770
Ref: 512717481770
Ref: library/unix translation-repo17481770
Ref: 512817481770
Ref: library/unix unix17481770
Ref: 512917481770
Ref: library/unix unix-specific-services17481770
Ref: 512a17481770
Node: shlex --- 単純な字句解析17482979
Ref: library/shlex doc17483137
Ref: 512b17483137
Ref: library/shlex module-shlex17483137
Ref: c917483137
Ref: library/shlex shlex-simple-lexical-analysis17483137
Ref: 512c17483137
Ref: library/shlex shlex split17483682
Ref: 75e17483682
Ref: library/shlex shlex join17484375
Ref: c2017484375
Ref: library/shlex shlex quote17484834
Ref: 58217484834
Ref: library/shlex shlex-quote-warning17485116
Ref: 37f317485116
Ref: library/shlex shlex shlex17486809
Ref: ecc17486809
Ref: shlex --- 単純な字句解析-Footnote-117489045
Node: shlex オブジェクト17489110
Ref: library/shlex id117489223
Ref: 513017489223
Ref: library/shlex shlex-objects17489223
Ref: 513117489223
Ref: library/shlex shlex shlex get_token17489370
Ref: 513217489370
Ref: library/shlex shlex shlex push_token17489908
Ref: 513317489908
Ref: library/shlex shlex shlex read_token17490026
Ref: 513517490026
Ref: library/shlex shlex shlex sourcehook17490364
Ref: 513617490364
Ref: library/shlex shlex shlex push_source17492530
Ref: 513817492530
Ref: library/shlex shlex shlex pop_source17492921
Ref: 513917492921
Ref: library/shlex shlex shlex error_leader17493200
Ref: 513a17493200
Ref: library/shlex shlex shlex commenters17494063
Ref: 512d17494063
Ref: library/shlex shlex shlex wordchars17494330
Ref: 512f17494330
Ref: library/shlex shlex shlex whitespace17495026
Ref: 513c17495026
Ref: library/shlex shlex shlex escape17495303
Ref: 513d17495303
Ref: library/shlex shlex shlex quotes17495510
Ref: 513e17495510
Ref: library/shlex shlex shlex escapedquotes17495927
Ref: 513f17495927
Ref: library/shlex shlex shlex whitespace_split17496215
Ref: 513b17496215
Ref: library/shlex shlex shlex infile17496760
Ref: 512e17496760
Ref: library/shlex shlex shlex instream17497081
Ref: 514017497081
Ref: library/shlex shlex shlex source17497224
Ref: 513717497224
Ref: library/shlex shlex shlex debug17498042
Ref: 514117498042
Ref: library/shlex shlex shlex lineno17498407
Ref: 514217498407
Ref: library/shlex shlex shlex token17498522
Ref: 514317498522
Ref: library/shlex shlex shlex eof17498680
Ref: 513417498680
Ref: library/shlex shlex shlex punctuation_chars17498897
Ref: 1e1217498897
Node: 解析規則17499304
Ref: library/shlex parsing-rules17499460
Ref: 514417499460
Ref: library/shlex shlex-parsing-rules17499460
Ref: 514517499460
Node: Improved Compatibility with Shells17501596
Ref: library/shlex improved-compatibility-with-shells17501719
Ref: 514617501719
Ref: library/shlex improved-shell-compatibility17501719
Ref: ecd17501719
Node: posix --- 最も一般的な POSIX システムコール群17504554
Ref: library/posix doc17504762
Ref: 514717504762
Ref: library/posix module-posix17504762
Ref: b217504762
Ref: library/posix posix-the-most-common-posix-system-calls17504762
Ref: 514817504762
Ref: library/posix translation-repo17504762
Ref: 514917504762
Node: ラージファイルのサポート17506188
Ref: library/posix large-file-support17506368
Ref: 514a17506368
Ref: library/posix posix-large-files17506368
Ref: 514b17506368
Node: 注目すべきモジュールの内容17507951
Ref: library/posix notable-module-contents17508131
Ref: 514c17508131
Ref: library/posix posix-contents17508131
Ref: 514d17508131
Ref: library/posix posix environ17508346
Ref: 514e17508346
Node: pwd --- パスワードデータベース17509642
Ref: library/pwd doc17509857
Ref: 514f17509857
Ref: library/pwd module-pwd17509857
Ref: b717509857
Ref: library/pwd pwd-the-password-database17509857
Ref: 515017509857
Ref: library/pwd translation-repo17509857
Ref: 515117509857
Ref: library/pwd pwd getpwuid17512513
Ref: 1e6e17512513
Ref: library/pwd pwd getpwnam17512654
Ref: 37e317512654
Ref: library/pwd pwd getpwall17512811
Ref: 515217512811
Node: grp --- グループデータベース17513145
Ref: library/grp doc17513346
Ref: 515317513346
Ref: library/grp grp-the-group-database17513346
Ref: 515417513346
Ref: library/grp module-grp17513346
Ref: 6a17513346
Ref: library/grp translation-repo17513346
Ref: 515517513346
Ref: library/grp grp getgrgid17515511
Ref: f2617515511
Ref: library/grp grp getgrnam17515937
Ref: 37e217515937
Ref: library/grp grp getgrall17516200
Ref: 194b17516200
Node: termios --- POSIX スタイルの端末制御17516495
Ref: library/termios doc17516690
Ref: 515617516690
Ref: library/termios module-termios17516690
Ref: e717516690
Ref: library/termios termios-posix-style-tty-control17516690
Ref: 515717516690
Ref: library/termios translation-repo17516690
Ref: 515817516690
Ref: library/termios termios tcgetattr17518167
Ref: 1a5317518167
Ref: library/termios termios tcsetattr17518741
Ref: 1aca17518741
Ref: library/termios termios TCSANOW17519021
Ref: 515917519021
Ref: library/termios termios TCSADRAIN17519100
Ref: 515a17519100
Ref: library/termios termios TCSAFLUSH17519206
Ref: 515b17519206
Ref: library/termios termios tcsendbreak17519354
Ref: 515c17519354
Ref: library/termios termios tcdrain17519660
Ref: 515d17519660
Ref: library/termios termios tcflush17519812
Ref: 515e17519812
Ref: library/termios termios tcflow17520134
Ref: 515f17520134
Ref: library/termios termios tcgetwinsize17520552
Ref: 516017520552
Ref: library/termios termios tcsetwinsize17520797
Ref: 516117520797
Ref: termios --- POSIX スタイルの端末制御-Footnote-117521413
Node: 使用例<51>17521460
Ref: library/termios example17521555
Ref: 516217521555
Ref: library/termios termios-example17521555
Ref: 516317521555
Node: tty --- 端末制御用の関数群17522354
Ref: library/tty doc17522552
Ref: 516417522552
Ref: library/tty module-tty17522552
Ref: 10717522552
Ref: library/tty translation-repo17522552
Ref: 516517522552
Ref: library/tty tty-terminal-control-functions17522552
Ref: 516617522552
Ref: library/tty tty cfmakeraw17523042
Ref: 1aa317523042
Ref: library/tty tty cfmakecbreak17523267
Ref: 1a5617523267
Ref: library/tty tty setraw17523843
Ref: 1aa217523843
Ref: library/tty tty setcbreak17524335
Ref: 1a5517524335
Ref: tty --- 端末制御用の関数群-Footnote-117525369
Node: pty --- 擬似端末ユーティリティ17525432
Ref: library/pty doc17525638
Ref: 516717525638
Ref: library/pty module-pty17525638
Ref: b617525638
Ref: library/pty pty-pseudo-terminal-utilities17525638
Ref: 516817525638
Ref: library/pty translation-repo17525638
Ref: 516917525638
Ref: library/pty pty fork17526318
Ref: 1b2a17526318
Ref: library/pty pty openpty17526986
Ref: 30317526986
Ref: library/pty pty spawn17527386
Ref: 118817527386
Ref: pty --- 擬似端末ユーティリティ-Footnote-117529717
Node: 使用例<52>17529780
Ref: library/pty example17529871
Ref: 516a17529871
Ref: 使用例<52>-Footnote-117531135
Node: fcntl --- fcntl および ioctl システムコール17531181
Ref: library/fcntl doc17531389
Ref: 516b17531389
Ref: library/fcntl fcntl-the-fcntl-and-ioctl-system-calls17531389
Ref: 516c17531389
Ref: library/fcntl module-fcntl17531389
Ref: 5d17531389
Ref: library/fcntl translation-repo17531389
Ref: 516d17531389
Ref: library/fcntl fcntl fcntl17535233
Ref: 18b617535233
Ref: library/fcntl fcntl ioctl17537289
Ref: 169917537289
Ref: library/fcntl fcntl flock17540073
Ref: 4ae117540073
Ref: library/fcntl fcntl lockf17540756
Ref: 160a17540756
Ref: library/fcntl fcntl LOCK_UN17541213
Ref: 516e17541213
Ref: library/fcntl fcntl LOCK_SH17541285
Ref: 516f17541285
Ref: library/fcntl fcntl LOCK_EX17541354
Ref: 517017541354
Ref: library/fcntl fcntl LOCK_NB17541427
Ref: 517117541427
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-117543887
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-217543932
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-317543977
Node: resource --- リソース使用情報17544022
Ref: library/resource doc17544242
Ref: 517217544242
Ref: library/resource module-resource17544242
Ref: c117544242
Ref: library/resource resource-resource-usage-information17544242
Ref: 517317544242
Ref: library/resource translation-repo17544242
Ref: 517417544242
Ref: library/resource resource error17544913
Ref: 517517544913
Ref: resource --- リソース使用情報-Footnote-117545259
Node: リソースの制限17545301
Ref: library/resource resource-limits17545432
Ref: 517617545432
Ref: library/resource resource RLIM_INFINITY17546801
Ref: 183017546801
Ref: library/resource resource getrlimit17546913
Ref: 182f17546913
Ref: library/resource resource setrlimit17547293
Ref: 183117547293
Ref: library/resource resource prlimit17548525
Ref: 119017548525
Ref: library/resource resource RLIMIT_CORE17550722
Ref: 4a8217550722
Ref: library/resource resource RLIMIT_CPU17551091
Ref: 517817551091
Ref: library/resource resource RLIMIT_FSIZE17551463
Ref: 517917551463
Ref: library/resource resource RLIMIT_DATA17551574
Ref: 517a17551574
Ref: library/resource resource RLIMIT_STACK17551682
Ref: 517b17551682
Ref: library/resource resource RLIMIT_RSS17551939
Ref: 517c17551939
Ref: library/resource resource RLIMIT_NPROC17552080
Ref: 517d17552080
Ref: library/resource resource RLIMIT_NOFILE17552194
Ref: 517717552194
Ref: library/resource resource RLIMIT_OFILE17552312
Ref: 517e17552312
Ref: library/resource resource RLIMIT_MEMLOCK17552413
Ref: 517f17552413
Ref: library/resource resource RLIMIT_VMEM17552526
Ref: 518017552526
Ref: library/resource resource RLIMIT_AS17552740
Ref: 518117552740
Ref: library/resource resource RLIMIT_MSGQUEUE17552873
Ref: 119117552873
Ref: library/resource resource RLIMIT_NICE17553085
Ref: 119217553085
Ref: library/resource resource RLIMIT_RTPRIO17553262
Ref: 119317553262
Ref: library/resource resource RLIMIT_RTTIME17553434
Ref: 119417553434
Ref: library/resource resource RLIMIT_SIGPENDING17553756
Ref: 119517553756
Ref: library/resource resource RLIMIT_SBSIZE17553943
Ref: 119617553943
Ref: library/resource resource RLIMIT_SWAP17554300
Ref: 119717554300
Ref: library/resource resource RLIMIT_NPTS17554779
Ref: 119817554779
Ref: library/resource resource RLIMIT_KQUEUES17554968
Ref: 1d0117554968
Ref: リソースの制限-Footnote-117555192
Ref: リソースの制限-Footnote-217555241
Ref: リソースの制限-Footnote-317555290
Node: リソースの使用状態17555357
Ref: library/resource resource-usage17555488
Ref: 518217555488
Ref: library/resource resource getrusage17555638
Ref: 164f17555638
Ref: library/resource resource getpagesize17560482
Ref: 518317560482
Ref: library/resource resource RUSAGE_SELF17560816
Ref: 518417560816
Ref: library/resource resource RUSAGE_CHILDREN17561074
Ref: 518517561074
Ref: library/resource resource RUSAGE_BOTH17561328
Ref: 518617561328
Ref: library/resource resource RUSAGE_THREAD17561598
Ref: 518717561598
Ref: リソースの使用状態-Footnote-117561895
Node: syslog --- Unix syslog ライブラリルーチン群17561944
Ref: library/syslog doc17562102
Ref: 518817562102
Ref: library/syslog module-syslog17562102
Ref: e217562102
Ref: library/syslog syslog-unix-syslog-library-routines17562102
Ref: 518917562102
Ref: library/syslog translation-repo17562102
Ref: 518a17562102
Ref: library/syslog syslog syslog17562952
Ref: 76217562952
Ref: library/syslog syslog openlog17564622
Ref: 76017564622
Ref: library/syslog syslog closelog17566280
Ref: 76117566280
Ref: library/syslog syslog setlogmask17567296
Ref: 4ae717567296
Ref: library/syslog syslog LOG_EMERG17568068
Ref: 518d17568068
Ref: library/syslog syslog LOG_ALERT17568100
Ref: 518e17568100
Ref: library/syslog syslog LOG_CRIT17568132
Ref: 518f17568132
Ref: library/syslog syslog LOG_ERR17568163
Ref: 519017568163
Ref: library/syslog syslog LOG_WARNING17568193
Ref: 519117568193
Ref: library/syslog syslog LOG_NOTICE17568227
Ref: 519217568227
Ref: library/syslog syslog LOG_INFO17568260
Ref: 518b17568260
Ref: library/syslog syslog LOG_DEBUG17568291
Ref: 519317568291
Ref: library/syslog syslog LOG_AUTH17568377
Ref: 519417568377
Ref: library/syslog syslog LOG_AUTHPRIV17568408
Ref: 519517568408
Ref: library/syslog syslog LOG_CRON17568443
Ref: 519617568443
Ref: library/syslog syslog LOG_DAEMON17568474
Ref: 519717568474
Ref: library/syslog syslog LOG_FTP17568507
Ref: 519817568507
Ref: library/syslog syslog LOG_INSTALL17568537
Ref: 519917568537
Ref: library/syslog syslog LOG_KERN17568571
Ref: 519a17568571
Ref: library/syslog syslog LOG_LAUNCHD17568602
Ref: 519b17568602
Ref: library/syslog syslog LOG_LPR17568636
Ref: 519c17568636
Ref: library/syslog syslog LOG_MAIL17568666
Ref: 519d17568666
Ref: library/syslog syslog LOG_NETINFO17568697
Ref: 519e17568697
Ref: library/syslog syslog LOG_NEWS17568731
Ref: 519f17568731
Ref: library/syslog syslog LOG_RAS17568762
Ref: 51a017568762
Ref: library/syslog syslog LOG_REMOTEAUTH17568792
Ref: 51a117568792
Ref: library/syslog syslog LOG_SYSLOG17568829
Ref: 51a217568829
Ref: library/syslog syslog LOG_USER17568862
Ref: 518c17568862
Ref: library/syslog syslog LOG_UUCP17568893
Ref: 51a317568893
Ref: library/syslog syslog LOG_LOCAL017568924
Ref: 51a417568924
Ref: library/syslog syslog LOG_LOCAL117568957
Ref: 51a517568957
Ref: library/syslog syslog LOG_LOCAL217568990
Ref: 51a617568990
Ref: library/syslog syslog LOG_LOCAL317569023
Ref: 51a717569023
Ref: library/syslog syslog LOG_LOCAL417569056
Ref: 51a817569056
Ref: library/syslog syslog LOG_LOCAL517569089
Ref: 51a917569089
Ref: library/syslog syslog LOG_LOCAL617569122
Ref: 51aa17569122
Ref: library/syslog syslog LOG_LOCAL717569155
Ref: 51ab17569155
Ref: library/syslog syslog LOG_PID17569625
Ref: 51ac17569625
Ref: library/syslog syslog LOG_CONS17569655
Ref: 51ad17569655
Ref: library/syslog syslog LOG_NDELAY17569686
Ref: 51ae17569686
Ref: library/syslog syslog LOG_ODELAY17569719
Ref: 51af17569719
Ref: library/syslog syslog LOG_NOWAIT17569752
Ref: 51b017569752
Ref: library/syslog syslog LOG_PERROR17569785
Ref: 51b117569785
Node: 使用例<53>17570012
Ref: library/syslog examples17570115
Ref: 51b217570115
Node: シンプルな例17570186
Ref: library/syslog simple-example17570254
Ref: 51b317570254
Node: モジュールのコマンドラインインターフェース CLI17570798
Ref: library/cmdline doc17570988
Ref: 51b417570988
Ref: library/cmdline library-cmdline17570988
Ref: 51b517570988
Ref: library/cmdline modules-command-line-interface-cli17570988
Ref: 51b617570988
Ref: library/cmdline translation-repo17570988
Ref: 51b717570988
Node: Superseded Modules17572633
Ref: library/superseded doc17572831
Ref: 51b817572831
Ref: library/superseded superseded17572831
Ref: 51b917572831
Ref: library/superseded superseded-modules17572831
Ref: 51ba17572831
Ref: library/superseded translation-repo17572831
Ref: 51bb17572831
Ref: Superseded Modules-Footnote-117573973
Node: getopt --- C-style parser for command line options17574015
Ref: library/getopt doc17574120
Ref: 51bc17574120
Ref: library/getopt getopt-c-style-parser-for-command-line-options17574120
Ref: 51bd17574120
Ref: library/getopt module-getopt17574120
Ref: 6517574120
Ref: library/getopt getopt getopt17575571
Ref: 16d917575571
Ref: library/getopt getopt gnu_getopt17578138
Ref: 16d817578138
Ref: library/getopt getopt GetoptError17579316
Ref: 194c17579316
Ref: library/getopt getopt error17579893
Ref: 51be17579893
Ref: getopt --- C-style parser for command line options-Footnote-117583958
Node: 削除されたモジュール17584024
Ref: library/removed doc17584197
Ref: 51bf17584197
Ref: library/removed removed17584197
Ref: 51c017584197
Ref: library/removed removed-modules17584197
Ref: 51c117584197
Ref: library/removed translation-repo17584197
Ref: 51c217584197
Node: aifc --- Read and write AIFF and AIFC files17586429
Ref: library/aifc doc17586605
Ref: 51c317586605
Ref: library/aifc aifc-read-and-write-aiff-and-aifc-files17586605
Ref: 51c417586605
Ref: library/aifc module-aifc17586605
Ref: 517586605
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-117587174
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-217587216
Node: asynchat --- Asynchronous socket command/response handler17587271
Ref: library/asynchat doc17587496
Ref: 51c517587496
Ref: library/asynchat asynchat-asynchronous-socket-command-response-handler17587496
Ref: 51c617587496
Ref: library/asynchat module-asynchat17587496
Ref: a17587496
Ref: library/asynchat translation-repo17587496
Ref: 51c717587496
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-117588071
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-217588113
Node: asyncore --- Asynchronous socket handler17588172
Ref: library/asyncore doc17588391
Ref: 51c817588391
Ref: library/asyncore asyncore-asynchronous-socket-handler17588391
Ref: 51c917588391
Ref: library/asyncore module-asyncore17588391
Ref: c17588391
Ref: library/asyncore translation-repo17588391
Ref: 51ca17588391
Ref: asyncore --- Asynchronous socket handler-Footnote-117588932
Ref: asyncore --- Asynchronous socket handler-Footnote-217588974
Node: audioop --- Manipulate raw audio data17589033
Ref: library/audioop doc17589243
Ref: 51cb17589243
Ref: library/audioop audioop-manipulate-raw-audio-data17589243
Ref: 51cc17589243
Ref: library/audioop module-audioop17589243
Ref: e17589243
Ref: library/audioop translation-repo17589243
Ref: 51cd17589243
Ref: audioop --- Manipulate raw audio data-Footnote-117589803
Ref: audioop --- Manipulate raw audio data-Footnote-217589845
Node: cgi --- Common Gateway Interface のサポート17589903
Ref: library/cgi doc17590116
Ref: 51ce17590116
Ref: library/cgi cgi-common-gateway-interface-support17590116
Ref: 51cf17590116
Ref: library/cgi module-cgi17590116
Ref: 1617590116
Ref: library/cgi translation-repo17590116
Ref: 51d017590116
Ref: cgi --- Common Gateway Interface のサポート-Footnote-117590986
Ref: cgi --- Common Gateway Interface のサポート-Footnote-217591028
Ref: cgi --- Common Gateway Interface のサポート-Footnote-317591073
Node: cgitb --- Traceback manager for CGI scripts17591127
Ref: library/cgitb doc17591334
Ref: 51d117591334
Ref: library/cgitb cgitb-traceback-manager-for-cgi-scripts17591334
Ref: 51d217591334
Ref: library/cgitb module-cgitb17591334
Ref: 1717591334
Ref: library/cgitb translation-repo17591334
Ref: 51d317591334
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-117592067
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-217592109
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-317592154
Node: chunk --- Read IFF chunked data17592210
Ref: library/chunk doc17592411
Ref: 51d417592411
Ref: library/chunk chunk-read-iff-chunked-data17592411
Ref: 51d517592411
Ref: library/chunk module-chunk17592411
Ref: 1817592411
Ref: library/chunk translation-repo17592411
Ref: 51d617592411
Ref: chunk --- Read IFF chunked data-Footnote-117592957
Ref: chunk --- Read IFF chunked data-Footnote-217592999
Node: crypt --- Function to check Unix passwords17593055
Ref: library/crypt doc17593265
Ref: 51d717593265
Ref: library/crypt crypt-function-to-check-unix-passwords17593265
Ref: 51d817593265
Ref: library/crypt module-crypt17593265
Ref: 2c17593265
Ref: library/crypt translation-repo17593265
Ref: 51d917593265
Ref: crypt --- Function to check Unix passwords-Footnote-117594088
Ref: crypt --- Function to check Unix passwords-Footnote-217594130
Ref: crypt --- Function to check Unix passwords-Footnote-317594176
Ref: crypt --- Function to check Unix passwords-Footnote-417594217
Ref: crypt --- Function to check Unix passwords-Footnote-517594263
Node: distutils --- Building and installing Python modules17594319
Ref: library/distutils doc17594539
Ref: 51da17594539
Ref: library/distutils distutils-building-and-installing-python-modules17594539
Ref: 51db17594539
Ref: library/distutils module-distutils17594539
Ref: 3d17594539
Ref: library/distutils translation-repo17594539
Ref: 51dc17594539
Ref: distutils --- Building and installing Python modules-Footnote-117595076
Ref: distutils --- Building and installing Python modules-Footnote-217595118
Ref: distutils --- Building and installing Python modules-Footnote-317595177
Node: imghdr --- Determine the type of an image17595237
Ref: library/imghdr doc17595450
Ref: 51dd17595450
Ref: library/imghdr imghdr-determine-the-type-of-an-image17595450
Ref: 51de17595450
Ref: library/imghdr module-imghdr17595450
Ref: 7917595450
Ref: library/imghdr translation-repo17595450
Ref: 51df17595450
Ref: imghdr --- Determine the type of an image-Footnote-117596190
Ref: imghdr --- Determine the type of an image-Footnote-217596232
Ref: imghdr --- Determine the type of an image-Footnote-317596275
Ref: imghdr --- Determine the type of an image-Footnote-417596319
Ref: imghdr --- Determine the type of an image-Footnote-517596366
Node: imp --- Access the import internals17596423
Ref: library/imp doc17596617
Ref: 51e017596617
Ref: library/imp imp-access-the-import-internals17596617
Ref: 51e117596617
Ref: library/imp module-imp17596617
Ref: 7a17596617
Ref: library/imp translation-repo17596617
Ref: 51e217596617
Ref: imp --- Access the import internals-Footnote-117597151
Node: mailcap --- Mailcap file handling17597205
Ref: library/mailcap doc17597409
Ref: 51e317597409
Ref: library/mailcap mailcap-mailcap-file-handling17597409
Ref: 51e417597409
Ref: library/mailcap module-mailcap17597409
Ref: 9017597409
Ref: library/mailcap translation-repo17597409
Ref: 51e517597409
Ref: mailcap --- Mailcap file handling-Footnote-117597963
Ref: mailcap --- Mailcap file handling-Footnote-217598005
Node: msilib --- Read and write Microsoft Installer files17598063
Ref: library/msilib doc17598277
Ref: 51e617598277
Ref: library/msilib module-msilib17598277
Ref: 9617598277
Ref: library/msilib msilib-read-and-write-microsoft-installer-files17598277
Ref: 51e717598277
Ref: library/msilib translation-repo17598277
Ref: 51e817598277
Ref: msilib --- Read and write Microsoft Installer files-Footnote-117598866
Ref: msilib --- Read and write Microsoft Installer files-Footnote-217598908
Node: nis --- Interface to Sun’s NIS Yellow Pages17598965
Ref: library/nis doc17599178
Ref: 51e917599178
Ref: library/nis module-nis17599178
Ref: a017599178
Ref: library/nis nis-interface-to-suns-nis-yellow-pages17599178
Ref: 51ea17599178
Ref: library/nis translation-repo17599178
Ref: 51eb17599178
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-117599754
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-217599796
Node: nntplib --- NNTP protocol client17599850
Ref: library/nntplib doc17600066
Ref: 51ec17600066
Ref: library/nntplib module-nntplib17600066
Ref: a117600066
Ref: library/nntplib nntplib-nntp-protocol-client17600066
Ref: 51ed17600066
Ref: library/nntplib translation-repo17600066
Ref: 51ee17600066
Ref: nntplib --- NNTP protocol client-Footnote-117600618
Ref: nntplib --- NNTP protocol client-Footnote-217600660
Node: ossaudiodev --- Access to OSS-compatible audio devices17600718
Ref: library/ossaudiodev doc17600927
Ref: 51ef17600927
Ref: library/ossaudiodev module-ossaudiodev17600927
Ref: a717600927
Ref: library/ossaudiodev ossaudiodev-access-to-oss-compatible-audio-devices17600927
Ref: 51f017600927
Ref: library/ossaudiodev translation-repo17600927
Ref: 51f117600927
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-117601527
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-217601569
Node: pipes --- Interface to shell pipelines17601631
Ref: library/pipes doc17601829
Ref: 51f217601829
Ref: library/pipes module-pipes17601829
Ref: ad17601829
Ref: library/pipes pipes-interface-to-shell-pipelines17601829
Ref: 51f317601829
Ref: library/pipes translation-repo17601829
Ref: 51f417601829
Ref: pipes --- Interface to shell pipelines-Footnote-117602458
Ref: pipes --- Interface to shell pipelines-Footnote-217602500
Node: smtpd --- SMTP Server17602556
Ref: library/smtpd doc17602739
Ref: 51f517602739
Ref: library/smtpd module-smtpd17602739
Ref: ce17602739
Ref: library/smtpd smtpd-smtp-server17602739
Ref: 51f617602739
Ref: library/smtpd translation-repo17602739
Ref: 51f717602739
Ref: smtpd --- SMTP Server-Footnote-117603312
Ref: smtpd --- SMTP Server-Footnote-217603354
Ref: smtpd --- SMTP Server-Footnote-317603397
Node: sndhdr --- Determine type of sound file17603453
Ref: library/sndhdr doc17603635
Ref: 51f817603635
Ref: library/sndhdr module-sndhdr17603635
Ref: d017603635
Ref: library/sndhdr sndhdr-determine-type-of-sound-file17603635
Ref: 51f917603635
Ref: library/sndhdr translation-repo17603635
Ref: 51fa17603635
Ref: sndhdr --- Determine type of sound file-Footnote-117604369
Ref: sndhdr --- Determine type of sound file-Footnote-217604411
Ref: sndhdr --- Determine type of sound file-Footnote-317604454
Ref: sndhdr --- Determine type of sound file-Footnote-417604498
Ref: sndhdr --- Determine type of sound file-Footnote-517604545
Node: spwd --- The shadow password database17604602
Ref: library/spwd doc17604800
Ref: 51fb17604800
Ref: library/spwd module-spwd17604800
Ref: d317604800
Ref: library/spwd spwd-the-shadow-password-database17604800
Ref: 51fc17604800
Ref: library/spwd translation-repo17604800
Ref: 51fd17604800
Ref: spwd --- The shadow password database-Footnote-117605495
Ref: spwd --- The shadow password database-Footnote-217605537
Ref: spwd --- The shadow password database-Footnote-317605582
Node: sunau --- Read and write Sun AU files17605637
Ref: library/sunau doc17605823
Ref: 51fe17605823
Ref: library/sunau module-sunau17605823
Ref: dd17605823
Ref: library/sunau sunau-read-and-write-sun-au-files17605823
Ref: 51ff17605823
Ref: library/sunau translation-repo17605823
Ref: 520017605823
Ref: sunau --- Read and write Sun AU files-Footnote-117606383
Ref: sunau --- Read and write Sun AU files-Footnote-217606425
Node: telnetlib --- Telnet client17606481
Ref: library/telnetlib doc17606669
Ref: 520117606669
Ref: library/telnetlib module-telnetlib17606669
Ref: e517606669
Ref: library/telnetlib telnetlib-telnet-client17606669
Ref: 520217606669
Ref: library/telnetlib translation-repo17606669
Ref: 520317606669
Ref: telnetlib --- Telnet client-Footnote-117607367
Ref: telnetlib --- Telnet client-Footnote-217607409
Ref: telnetlib --- Telnet client-Footnote-317607454
Ref: telnetlib --- Telnet client-Footnote-417607497
Node: uu --- Encode and decode uuencode files17607557
Ref: library/uu doc17607745
Ref: 520417607745
Ref: library/uu module-uu17607745
Ref: 11617607745
Ref: library/uu translation-repo17607745
Ref: 520517607745
Ref: library/uu uu-encode-and-decode-uuencode-files17607745
Ref: 520617607745
Ref: uu --- Encode and decode uuencode files-Footnote-117608306
Ref: uu --- Encode and decode uuencode files-Footnote-217608348
Node: xdrlib --- Encode and decode XDR data17608401
Ref: library/xdrlib doc17608553
Ref: 520717608553
Ref: library/xdrlib module-xdrlib17608553
Ref: 12617608553
Ref: library/xdrlib translation-repo17608553
Ref: 520817608553
Ref: library/xdrlib xdrlib-encode-and-decode-xdr-data17608553
Ref: 520917608553
Ref: library/security_warnings security-warnings17609078
Ref: 520a17609078
Ref: xdrlib --- Encode and decode XDR data-Footnote-117609114
Ref: xdrlib --- Encode and decode XDR data-Footnote-217609156
Node: セキュリティで考慮すべき点<6>17609213
Ref: library/security_warnings doc17609359
Ref: 520b17609359
Ref: library/security_warnings security-considerations17609359
Ref: 520c17609359
Ref: library/security_warnings translation-repo17609359
Ref: 520d17609359
Ref: セキュリティで考慮すべき点<6>-Footnote-117611149
Node: Python インタプリタの拡張と埋め込み17611208
Ref: extending/index doc17611372
Ref: 520e17611372
Ref: extending/index extending-and-embedding-the-python-interpreter17611372
Ref: 520f17611372
Ref: extending/index extending-index17611372
Ref: 201917611372
Ref: extending/index translation-repo17611372
Ref: 521017611372
Node: おすすめのサードパーティツール17612761
Ref: extending/index recommended-third-party-tools17612946
Ref: 521117612946
Node: Creating extensions without third party tools17613276
Ref: extending/index creating-extensions-without-third-party-tools17613550
Ref: 521317613550
Ref: Creating extensions without third party tools-Footnote-117614404
Node: Extending Python with C or C++17614446
Ref: extending/extending doc17614610
Ref: 521417614610
Ref: extending/extending extending-intro17614610
Ref: 521517614610
Ref: extending/extending extending-python-with-c-or-c17614610
Ref: 521617614610
Ref: Extending Python with C or C++-Footnote-117616590
Node: A Simple Example17616627
Ref: extending/extending a-simple-example17616751
Ref: 521717616751
Ref: extending/extending extending-simpleexample17616751
Ref: 521817616751
Ref: A Simple Example-Footnote-117621223
Node: Intermezzo Errors and Exceptions17621372
Ref: extending/extending extending-errors17621524
Ref: 521917621524
Ref: extending/extending intermezzo-errors-and-exceptions17621524
Ref: 521a17621524
Node: Back to the Example17630703
Ref: extending/extending back-to-the-example17630892
Ref: 522117630892
Ref: extending/extending backtoexample17630892
Ref: 522217630892
Node: The Module's Method Table and Initialization Function17632545
Ref: extending/extending methodtable17632725
Ref: 522417632725
Ref: extending/extending the-module-s-method-table-and-initialization-function17632725
Ref: 522517632725
Node: Compilation and Linkage17637719
Ref: extending/extending compilation17637917
Ref: 522917637917
Ref: extending/extending compilation-and-linkage17637917
Ref: 522a17637917
Node: C から Python 関数を呼び出す17639617
Ref: extending/extending calling-python-functions-from-c17639813
Ref: 522c17639813
Ref: extending/extending callingpython17639813
Ref: 522d17639813
Node: 拡張モジュール関数でのパラメタ展開17648192
Ref: extending/extending extracting-parameters-in-extension-functions17648422
Ref: 523217648422
Ref: extending/extending parsetuple17648422
Ref: 522f17648422
Node: 拡張モジュール関数のキーワードパラメタ17651478
Ref: extending/extending keyword-parameters-for-extension-functions17651698
Ref: 523317651698
Ref: extending/extending parsetupleandkeywords17651698
Ref: 523417651698
Node: 任意の値を構築する17654674
Ref: extending/extending building-arbitrary-values17654864
Ref: 523517654864
Ref: extending/extending buildvalue17654864
Ref: 523617654864
Node: 参照カウント法17657390
Ref: extending/extending refcounts17657559
Ref: 523017657559
Ref: extending/extending reference-counts17657559
Ref: 523717657559
Node: Python における参照カウント法17663255
Ref: extending/extending refcountsinpython17663392
Ref: 523817663392
Ref: extending/extending reference-counting-in-python17663392
Ref: 523917663392
Ref: Python における参照カウント法-Footnote-117666538
Ref: Python における参照カウント法-Footnote-217666737
Node: 所有権にまつわる規則17666996
Ref: extending/extending ownership-rules17667148
Ref: 523a17667148
Ref: extending/extending ownershiprules17667148
Ref: 523b17667148
Node: 薄氷17670317
Ref: extending/extending thin-ice17670446
Ref: 523f17670446
Ref: extending/extending thinice17670446
Ref: 524017670446
Ref: 薄氷-Footnote-117674423
Node: NULL ポインタ17674465
Ref: extending/extending null-pointers17674555
Ref: 524317674555
Ref: extending/extending nullpointers17674555
Ref: 524417674555
Ref: NULL ポインタ-Footnote-117676823
Node: C++での拡張モジュール作成17677023
Ref: extending/extending cplusplus17677211
Ref: 524517677211
Ref: extending/extending writing-extensions-in-c17677211
Ref: 524617677211
Node: 拡張モジュールに C API を提供する17678292
Ref: extending/extending providing-a-c-api-for-an-extension-module17678450
Ref: 524717678450
Ref: extending/extending using-capsules17678450
Ref: 157917678450
Node: 拡張の型の定義 チュートリアル17688572
Ref: extending/newtypes_tutorial doc17688788
Ref: 1c1817688788
Ref: extending/newtypes_tutorial defining-extension-types-tutorial17688788
Ref: 524917688788
Ref: extending/newtypes_tutorial defining-new-types17688788
Ref: 524a17688788
Ref: extending/newtypes_tutorial translation-repo17688788
Ref: 524b17688788
Node: 基本的なこと17689569
Ref: extending/newtypes_tutorial dnt-basics17689739
Ref: 524c17689739
Ref: extending/newtypes_tutorial the-basics17689739
Ref: 524d17689739
Node: 基本のサンプルにデータとメソッドを追加する17701454
Ref: extending/newtypes_tutorial adding-data-and-methods-to-the-basic-example17701675
Ref: 525317701675
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-117719990
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-217720123
Node: データ属性をこまかく制御する17720258
Ref: extending/newtypes_tutorial providing-finer-control-over-data-attributes17720518
Ref: 525b17720518
Ref: データ属性をこまかく制御する-Footnote-117730796
Node: 循環ガベージコレクションをサポートする17731170
Ref: extending/newtypes_tutorial supporting-cyclic-garbage-collection17731403
Ref: 525d17731403
Ref: 循環ガベージコレクションをサポートする-Footnote-117742765
Node: 他の型のサブクラスを作る17742939
Ref: extending/newtypes_tutorial subclassing-other-types17743121
Ref: 525f17743121
Node: 拡張の型の定義 雑多なトピック17748547
Ref: extending/newtypes doc17748767
Ref: 526117748767
Ref: extending/newtypes defining-extension-types-assorted-topics17748767
Ref: 526217748767
Ref: extending/newtypes new-types-topics17748767
Ref: 526317748767
Ref: extending/newtypes translation-repo17748767
Ref: 526417748767
Ref: extending/newtypes dnt-type-methods17748856
Ref: 526517748856
Node: ファイナライズとメモリ解放17754840
Ref: extending/newtypes finalization-and-de-allocation17754992
Ref: 526617754992
Ref: ファイナライズとメモリ解放-Footnote-117759397
Node: オブジェクト表現17759439
Ref: extending/newtypes object-presentation17759621
Ref: 526817759621
Node: 属性を管理する17761679
Ref: extending/newtypes attribute-management17761849
Ref: 526b17761849
Node: 総称的な属性を管理する17763404
Ref: extending/newtypes generic-attribute-management17763546
Ref: 525817763546
Ref: extending/newtypes id117763546
Ref: 526c17763546
Node: 特定の型に特化した属性の管理17767574
Ref: extending/newtypes type-specific-attribute-management17767716
Ref: 527117767716
Node: オブジェクトの比較17769523
Ref: extending/newtypes object-comparison17769711
Ref: 527417769711
Node: 抽象的なプロトコルのサポート17771592
Ref: extending/newtypes abstract-protocol-support17771799
Ref: 527717771799
Node: 弱参照 Weak Reference のサポート17778017
Ref: extending/newtypes weak-reference-support17778218
Ref: 527c17778218
Ref: extending/newtypes weakref-support17778218
Ref: 2a4517778218
Node: その他いろいろ17779494
Ref: extending/newtypes more-suggestions17779644
Ref: 527d17779644
Node: C および C++ 拡張のビルド17780610
Ref: extending/building doc17780854
Ref: 527e17780854
Ref: extending/building building17780854
Ref: 522b17780854
Ref: extending/building building-c-and-c-extensions17780854
Ref: 527f17780854
Ref: extending/building translation-repo17780854
Ref: 528017780854
Ref: extending/building install-index17781144
Ref: 10fd17781144
Node: setuptools による C および C++ 拡張のビルド17781215
Ref: extending/building building-c-and-c-extensions-with-setuptools17781341
Ref: 528217781341
Ref: extending/building setuptools-index17781341
Ref: 10fe17781341
Node: Windows 上での C および C++ 拡張モジュールのビルド17781928
Ref: extending/windows doc17782120
Ref: 528317782120
Ref: extending/windows building-c-and-c-extensions-on-windows17782120
Ref: 528417782120
Ref: extending/windows building-on-windows17782120
Ref: 228017782120
Ref: extending/windows translation-repo17782120
Ref: 528517782120
Node: 型どおりのアプローチ17783737
Ref: extending/windows a-cookbook-approach17783909
Ref: 528617783909
Ref: extending/windows win-cookbook17783909
Ref: 528717783909
Ref: 型どおりのアプローチ-Footnote-117784561
Node: Unix と Windows の相違点17784639
Ref: extending/windows differences-between-unix-and-windows17784839
Ref: 528817784839
Ref: extending/windows dynamic-linking17784839
Ref: 528917784839
Ref: extending/windows c Py_NO_LINK_LIB17789199
Ref: 44217789199
Node: DLL 使用の実際17789390
Ref: extending/windows using-dlls-in-practice17789551
Ref: 528a17789551
Ref: extending/windows win-dlls17789551
Ref: 528b17789551
Node: 大規模なアプリケーションへの Python ランタイムの埋め込み17792649
Ref: extending/index embedding-the-cpython-runtime-in-a-larger-application17792869
Ref: 528d17792869
Node: 他のアプリケーションへの Python の埋め込み17793427
Ref: extending/embedding doc17793603
Ref: 528e17793603
Ref: extending/embedding embedding17793603
Ref: 22b717793603
Ref: extending/embedding embedding-python-in-another-application17793603
Ref: 528f17793603
Node: 高水準の埋め込み17796908
Ref: extending/embedding high-level-embedding17797089
Ref: 529217797089
Ref: extending/embedding very-high-level-embedding17797089
Ref: 529317797089
Node: 超高水準の埋め込みから踏み出す 概要17799635
Ref: extending/embedding beyond-very-high-level-embedding-an-overview17799846
Ref: 529417799846
Ref: extending/embedding lower-level-embedding17799846
Ref: 529517799846
Node: 純粋な埋め込み17802306
Ref: extending/embedding id117802528
Ref: 529617802528
Ref: extending/embedding pure-embedding17802528
Ref: 529717802528
Node: 埋め込まれた Python の拡張17807792
Ref: extending/embedding extending-embedded-python17807997
Ref: 529917807997
Ref: extending/embedding extending-with-embedding17807997
Ref: 529a17807997
Node: C++による Python の埋め込み17810588
Ref: extending/embedding embedding-python-in-c17810831
Ref: 529b17810831
Ref: extending/embedding embeddingincplusplus17810831
Ref: 529c17810831
Node: Unix 系システムにおけるコンパイルとリンク17811338
Ref: extending/embedding compiling17811537
Ref: 529817811537
Ref: extending/embedding compiling-and-linking-under-unix-like-systems17811537
Ref: 529d17811537
Node: Python/C API reference manual17814255
Ref: c-api/index doc17814434
Ref: 529f17814434
Ref: c-api/index c-api-index17814434
Ref: 201a17814434
Ref: c-api/index python-c-api-reference-manual17814434
Ref: 52a017814434
Ref: c-api/index translation-repo17814434
Ref: 52a117814434
Node: はじめに<14>17816084
Ref: c-api/intro doc17816190
Ref: 52a217816190
Ref: c-api/intro api-intro17816190
Ref: 52a317816190
Ref: c-api/intro introduction17816190
Ref: 52a417816190
Node: 言語バージョン互換性17818614
Ref: c-api/intro language-version-compatibility17818730
Ref: 52a517818730
Node: コーディング基準17819035
Ref: c-api/intro coding-standards17819190
Ref: 52a617819190
Ref: コーディング基準-Footnote-117819753
Node: インクルードファイル17819795
Ref: c-api/intro api-includes17819938
Ref: 98b17819938
Ref: c-api/intro include-files17819938
Ref: 52a717819938
Node: 便利なマクロ17823350
Ref: c-api/intro useful-macros17823520
Ref: 52a817823520
Ref: c-api/intro c Py_CAN_START_THREADS17823847
Ref: 52a917823847
Ref: c-api/intro c Py_GETENV17824158
Ref: 52aa17824158
Ref: 便利なマクロ-Footnote-117824482
Node: Docstring macros17824524
Ref: c-api/intro docstring-macros17824626
Ref: 52ab17824626
Ref: c-api/intro c PyDoc_STRVAR17824677
Ref: 1db917824677
Ref: c-api/intro c PyDoc_STR17825266
Ref: 1bf417825266
Ref: c-api/intro c PyDoc_VAR17825700
Ref: 1e4d17825700
Node: General utility macros17826073
Ref: c-api/intro general-utility-macros17826205
Ref: 52ac17826205
Ref: c-api/intro c Py_UNUSED17826335
Ref: 1aeb17826335
Ref: c-api/intro c Py_GCC_ATTRIBUTE17826592
Ref: 52ad17826592
Node: Numeric utilities17827007
Ref: c-api/intro numeric-utilities17827111
Ref: 52ae17827111
Ref: c-api/intro c Py_ABS17827164
Ref: 52af17827164
Ref: c-api/intro c Py_MAX17827605
Ref: 52b017827605
Ref: c-api/intro c Py_MIN17827639
Ref: 52b117827639
Ref: c-api/intro c Py_ARITHMETIC_RIGHT_SHIFT17827985
Ref: 52b217827985
Ref: c-api/intro c Py_CHARMASK17828949
Ref: 52b317828949
Node: Assertion utilities17829204
Ref: c-api/intro assertion-utilities17829336
Ref: 52b417829336
Ref: c-api/intro c Py_UNREACHABLE17829393
Ref: db217829393
Ref: c-api/intro c Py_SAFE_DOWNCAST17830667
Ref: 52b517830667
Ref: c-api/intro c Py_BUILD_ASSERT17831350
Ref: 1a1017831350
Ref: c-api/intro c Py_BUILD_ASSERT_EXPR17831737
Ref: 1a1117831737
Node: Type size utilities17832145
Ref: c-api/intro type-size-utilities17832286
Ref: 52b617832286
Ref: c-api/intro c Py_ARRAY_LENGTH17832343
Ref: 52b717832343
Ref: c-api/intro c Py_MEMBER_SIZE17832813
Ref: 52b817832813
Node: Macro definition utilities17833024
Ref: c-api/intro macro-definition-utilities17833137
Ref: 52b917833137
Ref: c-api/intro c Py_FORCE_EXPANSION17833208
Ref: 52ba17833208
Ref: c-api/intro c Py_STRINGIFY17833417
Ref: 52bb17833417
Node: Declaration utilities17833584
Ref: c-api/intro declaration-utilities17833715
Ref: 52bc17833715
Ref: c-api/intro c Py_ALWAYS_INLINE17834016
Ref: 1cc817834016
Ref: c-api/intro c Py_NO_INLINE17835097
Ref: 186817835097
Ref: c-api/intro c Py_DEPRECATED17835494
Ref: c9f17835494
Ref: c-api/intro c Py_LOCAL17835868
Ref: 166817835868
Ref: c-api/intro c Py_LOCAL_INLINE17836108
Ref: 166917836108
Ref: c-api/intro c Py_LOCAL_SYMBOL17836250
Ref: 52bd17836250
Ref: c-api/intro c Py_EXPORTED_SYMBOL17836546
Ref: 52be17836546
Ref: c-api/intro c Py_IMPORTED_SYMBOL17836914
Ref: 52bf17836914
Ref: c-api/intro c PyAPI_FUNC17837155
Ref: 52c017837155
Ref: c-api/intro c PyAPI_DATA17837463
Ref: 52c117837463
Ref: Declaration utilities-Footnote-117837822
Node: Outdated macros17837887
Ref: c-api/intro outdated-macros17837987
Ref: 52c217837987
Ref: c-api/intro c Py_ALIGNED17838121
Ref: 52c317838121
Ref: c-api/intro c Py_LL17838313
Ref: 52c417838313
Ref: c-api/intro c Py_ULL17838348
Ref: 52c517838348
Ref: c-api/intro c Py_MEMCPY17838730
Ref: 19ef17838730
Ref: c-api/intro c Py_VA_COPY17838970
Ref: 52c617838970
Node: オブジェクト、型および参照カウント17839269
Ref: c-api/intro api-objects17839419
Ref: 52c717839419
Ref: c-api/intro objects-types-and-reference-counts17839419
Ref: 52c817839419
Node: 参照カウント法<2>17841274
Ref: c-api/intro api-refcounts17841401
Ref: 52c917841401
Ref: c-api/intro reference-counts17841401
Ref: 52ca17841401
Node: 参照カウントの詳細17845298
Ref: c-api/intro api-refcountdetails17845386
Ref: 52cb17845386
Ref: c-api/intro reference-count-details17845386
Ref: 52cc17845386
Node: 型<2>17853776
Ref: c-api/intro api-types17853903
Ref: 52cf17853903
Ref: c-api/intro types17853903
Ref: 52d017853903
Ref: c-api/intro c Py_ssize_t17854516
Ref: c5917854516
Ref: 型<2>-Footnote-117854933
Node: 例外<24>17854975
Ref: c-api/intro api-exceptions17855132
Ref: 52d117855132
Ref: c-api/intro exceptions17855132
Ref: 52d217855132
Node: Python の埋め込み<2>17863293
Ref: c-api/intro api-embedding17863440
Ref: 52d417863440
Ref: c-api/intro embedding-python17863440
Ref: 52d517863440
Node: デバッグ版ビルド Debugging Builds17867518
Ref: c-api/intro api-debugging17867703
Ref: 52d717867703
Ref: c-api/intro debugging-builds17867703
Ref: 52d817867703
Ref: c-api/intro c Py_DEBUG17868604
Ref: 189a17868604
Node: おすすめのサードパーティツール<2>17869941
Ref: c-api/intro c-api-tools17870092
Ref: 521217870092
Ref: c-api/intro recommended-third-party-tools17870092
Ref: 52d917870092
Ref: おすすめのサードパーティツール<2>-Footnote-117871545
Ref: おすすめのサードパーティツール<2>-Footnote-217871573
Ref: おすすめのサードパーティツール<2>-Footnote-317871609
Ref: おすすめのサードパーティツール<2>-Footnote-417871641
Ref: おすすめのサードパーティツール<2>-Footnote-517871684
Ref: おすすめのサードパーティツール<2>-Footnote-617871718
Ref: おすすめのサードパーティツール<2>-Footnote-717871759
Ref: おすすめのサードパーティツール<2>-Footnote-817871784
Ref: おすすめのサードパーティツール<2>-Footnote-917871813
Node: C API Stability17871886
Ref: c-api/stable doc17872022
Ref: 52da17872022
Ref: c-api/stable c-api-stability17872022
Ref: 52db17872022
Ref: c-api/stable stable17872022
Ref: 77517872022
Ref: c-api/stable translation-repo17872022
Ref: 52dc17872022
Ref: C API Stability-Footnote-117873591
Ref: C API Stability-Footnote-217873633
Node: Unstable C API17873688
Ref: c-api/stable id117873798
Ref: 52de17873798
Ref: c-api/stable unstable-c-api17873798
Ref: 76917873798
Node: Stable Application Binary Interface17874296
Ref: c-api/stable id217874460
Ref: 52df17874460
Ref: c-api/stable stable-application-binary-interface17874460
Ref: 528c17874460
Node: Limited C API17874819
Ref: c-api/stable id317874923
Ref: 52e017874923
Ref: c-api/stable limited-c-api17874923
Ref: 63717874923
Ref: c-api/stable c Py_LIMITED_API17875204
Ref: 66017875204
Node: Stable ABI17876066
Ref: c-api/stable id417876212
Ref: 52e117876212
Ref: c-api/stable stable-abi17876212
Ref: 52e217876212
Ref: Stable ABI-Footnote-117877624
Node: Limited API Scope and Performance17877666
Ref: c-api/stable limited-api-scope-and-performance17877818
Ref: 52e317877818
Node: Limited API Caveats17878938
Ref: c-api/stable limited-api-caveats17879071
Ref: 52e517879071
Node: プラットフォームで考慮すべき点17880859
Ref: c-api/stable platform-considerations17881030
Ref: 52e617881030
Ref: c-api/stable stable-abi-platform17881030
Ref: 52dd17881030
Node: 限定版APIの内容17881677
Ref: c-api/stable contents-of-limited-api17881804
Ref: 52e717881804
Ref: c-api/stable limited-api-list17881804
Ref: 9a117881804
Node: 超高水準レイヤ17924372
Ref: c-api/veryhigh doc17924510
Ref: 554217924510
Ref: c-api/veryhigh the-very-high-level-layer17924510
Ref: 554317924510
Ref: c-api/veryhigh translation-repo17924510
Ref: 554417924510
Ref: c-api/veryhigh veryhigh17924510
Ref: 522e17924510
Ref: c-api/veryhigh c PyRun_AnyFile17925596
Ref: 554917925596
Ref: c-api/veryhigh c PyRun_AnyFileFlags17925836
Ref: 554b17925836
Ref: c-api/veryhigh c PyRun_AnyFileEx17926086
Ref: 554c17926086
Ref: c-api/veryhigh c PyRun_AnyFileExFlags17926323
Ref: 554a17926323
Ref: c-api/veryhigh c PyRun_SimpleString17927173
Ref: 529017927173
Ref: c-api/veryhigh c PyRun_SimpleStringFlags17927405
Ref: 554e17927405
Ref: c-api/veryhigh c PyRun_SimpleFile17928180
Ref: 529117928180
Ref: c-api/veryhigh c PyRun_SimpleFileEx17928427
Ref: 554f17928427
Ref: c-api/veryhigh c PyRun_SimpleFileExFlags17928669
Ref: 1d2517928669
Ref: c-api/veryhigh c PyRun_InteractiveOneObject17929568
Ref: 555017929568
Ref: c-api/veryhigh c PyRun_InteractiveOne17930470
Ref: 555117930470
Ref: c-api/veryhigh c PyRun_InteractiveOneFlags17930693
Ref: 555217930693
Ref: c-api/veryhigh c PyRun_InteractiveLoop17930986
Ref: 554d17930986
Ref: c-api/veryhigh c PyRun_InteractiveLoopFlags17931211
Ref: 555317931211
Ref: c-api/veryhigh c PyOS_InputHook17931794
Ref: 7a417931794
Ref: c-api/veryhigh c PyOS_ReadlineFunctionPointer17932422
Ref: 7a517932422
Ref: c-api/veryhigh c PyRun_String17933813
Ref: 1e1c17933813
Ref: c-api/veryhigh c PyRun_StringFlags17934112
Ref: 555417934112
Ref: c-api/veryhigh c PyRun_File17934863
Ref: 555617934863
Ref: c-api/veryhigh c PyRun_FileEx17935213
Ref: 555817935213
Ref: c-api/veryhigh c PyRun_FileFlags17935550
Ref: 555917935550
Ref: c-api/veryhigh c PyRun_FileExFlags17935900
Ref: 555717935900
Ref: c-api/veryhigh c Py_CompileString17936634
Ref: a8917936634
Ref: c-api/veryhigh c Py_CompileStringFlags17936979
Ref: 555a17936979
Ref: c-api/veryhigh c Py_CompileStringObject17937303
Ref: 555c17937303
Ref: c-api/veryhigh c Py_CompileStringExFlags17938471
Ref: 555b17938471
Ref: c-api/veryhigh c PyEval_EvalCode17938944
Ref: a8a17938944
Ref: c-api/veryhigh c PyEval_EvalCodeEx17939400
Ref: 1b3917939400
Ref: c-api/veryhigh c PyEval_EvalFrame17940215
Ref: 536017940215
Ref: c-api/veryhigh c PyEval_EvalFrameEx17940569
Ref: 123317940569
Ref: c-api/veryhigh c PyEval_MergeCompilerFlags17941506
Ref: 555d17941506
Ref: c-api/veryhigh c PyCompilerFlags17941716
Ref: c9c17941716
Ref: c-api/veryhigh c PyCompilerFlags cf_flags17942337
Ref: 555e17942337
Ref: c-api/veryhigh c PyCompilerFlags cf_feature_version17942421
Ref: 555f17942421
Ref: c-api/veryhigh c PyCF_ALLOW_TOP_LEVEL_AWAIT17942869
Ref: 556017942869
Ref: c-api/veryhigh c PyCF_ONLY_AST17942921
Ref: 556117942921
Ref: c-api/veryhigh c PyCF_OPTIMIZED_AST17942960
Ref: 556217942960
Ref: c-api/veryhigh c PyCF_TYPE_COMMENTS17943004
Ref: 556317943004
Node: Available start symbols17943539
Ref: c-api/veryhigh available-start-symbols17943642
Ref: 556617943642
Ref: c-api/veryhigh start-symbols17943642
Ref: 555517943642
Ref: c-api/veryhigh c Py_eval_input17943703
Ref: 554517943703
Ref: c-api/veryhigh c Py_file_input17943864
Ref: 554617943864
Ref: c-api/veryhigh c Py_single_input17944206
Ref: 554717944206
Ref: c-api/veryhigh c Py_func_type_input17944450
Ref: 554817944450
Ref: Available start symbols-Footnote-117944893
Ref: Available start symbols-Footnote-217944935
Node: Stack Effects17944977
Ref: c-api/veryhigh stack-effects17945080
Ref: 556717945080
Ref: c-api/veryhigh c PY_INVALID_STACK_EFFECT17945167
Ref: 556817945167
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffect17945352
Ref: 556917945352
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffectWithJump17945667
Ref: 1e8e17945667
Node: 参照カウント17946196
Ref: c-api/refcounting doc17946331
Ref: 556a17946331
Ref: c-api/refcounting countingrefs17946331
Ref: 556b17946331
Ref: c-api/refcounting reference-counting17946331
Ref: 556c17946331
Ref: c-api/refcounting translation-repo17946331
Ref: 556d17946331
Ref: c-api/refcounting c Py_REFCNT17946509
Ref: 2d117946509
Ref: c-api/refcounting c Py_SET_REFCNT17947979
Ref: aac17947979
Ref: c-api/refcounting c Py_INCREF17948560
Ref: 78f17948560
Ref: c-api/refcounting c Py_XINCREF17949613
Ref: c5e17949613
Ref: c-api/refcounting c Py_NewRef17949819
Ref: a9e17949819
Ref: c-api/refcounting c Py_XNewRef17950547
Ref: a9f17950547
Ref: c-api/refcounting c Py_DECREF17950872
Ref: 79017950872
Ref: c-api/refcounting c Py_XDECREF17952622
Ref: 99617952622
Ref: c-api/refcounting c Py_CLEAR17952856
Ref: 79817952856
Ref: c-api/refcounting c Py_IncRef17953689
Ref: 54b717953689
Ref: c-api/refcounting c Py_DecRef17953974
Ref: 54af17953974
Ref: c-api/refcounting c Py_SETREF17954247
Ref: 79917954247
Ref: c-api/refcounting c Py_XSETREF17955013
Ref: 79a17955013
Ref: 参照カウント-Footnote-117955403
Ref: 参照カウント-Footnote-217955445
Node: 例外処理17955487
Ref: c-api/exceptions doc17955631
Ref: 556e17955631
Ref: c-api/exceptions exception-handling17955631
Ref: 556f17955631
Ref: c-api/exceptions exceptionhandling17955631
Ref: 4d0c17955631
Ref: c-api/exceptions translation-repo17955631
Ref: 557017955631
Node: 出力とクリア17958758
Ref: c-api/exceptions printing-and-clearing17958849
Ref: 557117958849
Ref: c-api/exceptions c PyErr_Clear17958894
Ref: 123617958894
Ref: c-api/exceptions c PyErr_PrintEx17959141
Ref: 535317959141
Ref: c-api/exceptions c PyErr_Print17960311
Ref: 1d8a17960311
Ref: c-api/exceptions c PyErr_WriteUnraisable17960458
Ref: 5f217960458
Ref: c-api/exceptions c PyErr_FormatUnraisable17961518
Ref: 5f117961518
Ref: c-api/exceptions c PyErr_DisplayException17962033
Ref: 43317962033
Node: 例外の送出17962327
Ref: c-api/exceptions raising-exceptions17962436
Ref: 557217962436
Ref: c-api/exceptions c PyErr_SetString17962733
Ref: 79c17962733
Ref: c-api/exceptions c PyErr_SetObject17963257
Ref: 79b17963257
Ref: c-api/exceptions c PyErr_Format17963568
Ref: 10b517963568
Ref: c-api/exceptions c PyErr_FormatV17964163
Ref: 10b417964163
Ref: c-api/exceptions c PyErr_SetNone17964559
Ref: 535c17964559
Ref: c-api/exceptions c PyErr_BadArgument17964748
Ref: 535017964748
Ref: c-api/exceptions c PyErr_NoMemory17965116
Ref: 521d17965116
Ref: c-api/exceptions c PyErr_SetFromErrno17965536
Ref: 521c17965536
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObject17966473
Ref: 535817966473
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObjects17967015
Ref: 535917967015
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilename17967570
Ref: 1ae617967570
Ref: c-api/exceptions c PyErr_SetFromWindowsErr17968062
Ref: 535a17968062
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErr17968983
Ref: 535517968983
Ref: c-api/exceptions c PyErr_SetFromWindowsErrWithFilename17969405
Ref: 1ae817969405
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObject17970056
Ref: 535617970056
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObjects17970669
Ref: 535717970669
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilename17971199
Ref: 1ae717971199
Ref: c-api/exceptions c PyErr_SetImportError17971677
Ref: f3d17971677
Ref: c-api/exceptions c PyErr_SetImportErrorSubclass17972275
Ref: f1617972275
Ref: c-api/exceptions c PyErr_SyntaxLocationObject17972767
Ref: 557317972767
Ref: c-api/exceptions c PyErr_RangedSyntaxLocationObject17973205
Ref: 557417973205
Ref: c-api/exceptions c PyErr_SyntaxLocationEx17973555
Ref: 535e17973555
Ref: c-api/exceptions c PyErr_SyntaxLocation17974014
Ref: 535d17974014
Ref: c-api/exceptions c PyErr_BadInternalCall17974279
Ref: 535117974279
Ref: c-api/exceptions c PyErr_ProgramTextObject17974687
Ref: 557517974687
Ref: c-api/exceptions c PyErr_ProgramText17975078
Ref: 535417975078
Node: 警告<3>17975445
Ref: c-api/exceptions issuing-warnings17975581
Ref: 557617975581
Ref: c-api/exceptions c PyErr_WarnEx17976634
Ref: 166a17976634
Ref: c-api/exceptions c PyErr_WarnExplicitObject17978152
Ref: 557817978152
Ref: c-api/exceptions c PyErr_WarnExplicit17978804
Ref: 1aee17978804
Ref: c-api/exceptions c PyErr_WarnFormat17979358
Ref: 535f17979358
Ref: c-api/exceptions c PyErr_WarnExplicitFormat17979733
Ref: 557917979733
Ref: c-api/exceptions c PyErr_ResourceWarning17980121
Ref: f1717980121
Node: エラーインジケータの問い合わせ17980522
Ref: c-api/exceptions querying-the-error-indicator17980676
Ref: 557a17980676
Ref: c-api/exceptions c PyErr_Occurred17980766
Ref: 1d0a17980766
Ref: c-api/exceptions c PyErr_ExceptionMatches17981943
Ref: 52d317981943
Ref: c-api/exceptions c PyErr_GivenExceptionMatches17982328
Ref: 535217982328
Ref: c-api/exceptions c PyErr_GetRaisedException17982892
Ref: 42717982892
Ref: c-api/exceptions c PyErr_SetRaisedException17983876
Ref: 42a17983876
Ref: c-api/exceptions c PyErr_Fetch17984260
Ref: 42617984260
Ref: c-api/exceptions c PyErr_Restore17985583
Ref: 42917985583
Ref: c-api/exceptions c PyErr_NormalizeException17986760
Ref: 42817986760
Ref: c-api/exceptions c PyErr_GetHandledException17988001
Ref: 97717988001
Ref: c-api/exceptions c PyErr_SetHandledException17988937
Ref: 97817988937
Ref: c-api/exceptions c PyErr_GetExcInfo17989729
Ref: 97a17989729
Ref: c-api/exceptions c PyErr_SetExcInfo17990832
Ref: 97917990832
Node: シグナルハンドリング<2>17992130
Ref: c-api/exceptions signal-handling17992293
Ref: 557b17992293
Ref: c-api/exceptions c PyErr_CheckSignals17992358
Ref: 69317992358
Ref: c-api/exceptions c PyErr_SetInterrupt17994126
Ref: 535b17994126
Ref: c-api/exceptions c PyErr_SetInterruptEx17994515
Ref: aa217994515
Ref: c-api/exceptions c PySignal_SetWakeupFd17995705
Ref: 15f917995705
Node: 例外クラス<2>17996629
Ref: c-api/exceptions exception-classes17996771
Ref: 557c17996771
Ref: c-api/exceptions c PyErr_NewException17996811
Ref: 148517996811
Ref: c-api/exceptions c PyErr_NewExceptionWithDoc17997986
Ref: 148417997986
Ref: c-api/exceptions c PyExceptionClass_Check17998486
Ref: 557d17998486
Ref: c-api/exceptions c PyExceptionClass_Name17998651
Ref: c5f17998651
Node: 例外オブジェクト17998861
Ref: c-api/exceptions exception-objects17999002
Ref: 557e17999002
Ref: c-api/exceptions c PyExceptionInstance_Check17999057
Ref: 557f17999057
Ref: c-api/exceptions c PyExceptionInstance_Class17999244
Ref: 558017999244
Ref: c-api/exceptions c PyException_GetTraceback17999340
Ref: 53a617999340
Ref: c-api/exceptions c PyException_SetTraceback17999757
Ref: 1e2a17999757
Ref: c-api/exceptions c PyException_GetContext18000031
Ref: 53a518000031
Ref: c-api/exceptions c PyException_SetContext18000497
Ref: 53a818000497
Ref: c-api/exceptions c PyException_GetCause18000921
Ref: 53a418000921
Ref: c-api/exceptions c PyException_SetCause18001317
Ref: 53a718001317
Ref: c-api/exceptions c PyException_GetArgs18001788
Ref: 78b18001788
Ref: c-api/exceptions c PyException_SetArgs18002026
Ref: 78c18002026
Ref: c-api/exceptions c PyUnstable_Exc_PrepReraiseStar18002237
Ref: 558118002237
Node: Unicode 例外オブジェクト18003230
Ref: c-api/exceptions unicode-exception-objects18003368
Ref: 558218003368
Ref: c-api/exceptions unicodeexceptions18003368
Ref: 45f18003368
Ref: c-api/exceptions c PyUnicodeDecodeError_Create18003552
Ref: 546218003552
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEncoding18004084
Ref: 546318004084
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEncoding18004182
Ref: 546b18004182
Ref: c-api/exceptions c PyUnicodeDecodeError_GetObject18004449
Ref: 546518004449
Ref: c-api/exceptions c PyUnicodeEncodeError_GetObject18004545
Ref: 546c18004545
Ref: c-api/exceptions c PyUnicodeTranslateError_GetObject18004641
Ref: 547318004641
Ref: c-api/exceptions c PyUnicodeDecodeError_GetStart18004907
Ref: 546718004907
Ref: c-api/exceptions c PyUnicodeEncodeError_GetStart18005003
Ref: 195f18005003
Ref: c-api/exceptions c PyUnicodeTranslateError_GetStart18005099
Ref: 547518005099
Ref: c-api/exceptions c PyUnicodeDecodeError_SetStart18005731
Ref: 546a18005731
Ref: c-api/exceptions c PyUnicodeEncodeError_SetStart18005826
Ref: 547018005826
Ref: c-api/exceptions c PyUnicodeTranslateError_SetStart18005921
Ref: 547818005921
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEnd18006369
Ref: 546418006369
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEnd18006461
Ref: 195c18006461
Ref: c-api/exceptions c PyUnicodeTranslateError_GetEnd18006553
Ref: 547218006553
Ref: c-api/exceptions c PyUnicodeDecodeError_SetEnd18007103
Ref: 546818007103
Ref: c-api/exceptions c PyUnicodeEncodeError_SetEnd18007194
Ref: 546e18007194
Ref: c-api/exceptions c PyUnicodeTranslateError_SetEnd18007285
Ref: 547618007285
Ref: c-api/exceptions c PyUnicodeDecodeError_GetReason18007658
Ref: 546618007658
Ref: c-api/exceptions c PyUnicodeEncodeError_GetReason18007754
Ref: 546d18007754
Ref: c-api/exceptions c PyUnicodeTranslateError_GetReason18007850
Ref: 547418007850
Ref: c-api/exceptions c PyUnicodeDecodeError_SetReason18008113
Ref: 546918008113
Ref: c-api/exceptions c PyUnicodeEncodeError_SetReason18008211
Ref: 546f18008211
Ref: c-api/exceptions c PyUnicodeTranslateError_SetReason18008309
Ref: 547718008309
Node: 再帰の管理18008637
Ref: c-api/exceptions recursion18008778
Ref: 558318008778
Ref: c-api/exceptions recursion-control18008778
Ref: 558418008778
Ref: c-api/exceptions c Py_EnterRecursiveCall18009201
Ref: 3d018009201
Ref: c-api/exceptions c Py_LeaveRecursiveCall18010124
Ref: b6f18010124
Ref: c-api/exceptions c Py_ReprEnter18010994
Ref: 54ba18010994
Ref: c-api/exceptions c Py_ReprLeave18011993
Ref: 54bb18011993
Ref: c-api/exceptions c Py_GetRecursionLimit18012266
Ref: 54b518012266
Ref: c-api/exceptions c Py_SetRecursionLimit18012742
Ref: 54bc18012742
Node: Exception and warning types18013078
Ref: c-api/exceptions exception-and-warning-types18013197
Ref: 558518013197
Ref: c-api/exceptions standardexceptions18013197
Ref: 558618013197
Node: Exception types18013612
Ref: c-api/exceptions exception-types18013715
Ref: 558718013715
Ref: c-api/exceptions c PyExc_BaseException18014090
Ref: 536718014090
Ref: c-api/exceptions c PyExc_BaseExceptionGroup18014281
Ref: 536818014281
Ref: c-api/exceptions c PyExc_Exception18014531
Ref: 537618014531
Ref: c-api/exceptions c PyExc_ArithmeticError18014656
Ref: 536418014656
Ref: c-api/exceptions c PyExc_AssertionError18014850
Ref: 536518014850
Ref: c-api/exceptions c PyExc_AttributeError18015042
Ref: 536618015042
Ref: c-api/exceptions c PyExc_BlockingIOError18015234
Ref: 536918015234
Ref: c-api/exceptions c PyExc_BrokenPipeError18015463
Ref: 536a18015463
Ref: c-api/exceptions c PyExc_BufferError18015712
Ref: 536b18015712
Ref: c-api/exceptions c PyExc_ChildProcessError18015838
Ref: 536d18015838
Ref: c-api/exceptions c PyExc_ConnectionAbortedError18016070
Ref: 536e18016070
Ref: c-api/exceptions c PyExc_ConnectionError18016307
Ref: 536f18016307
Ref: c-api/exceptions c PyExc_ConnectionRefusedError18016537
Ref: 537018016537
Ref: c-api/exceptions c PyExc_ConnectionResetError18016774
Ref: 537118016774
Ref: c-api/exceptions c PyExc_EOFError18017025
Ref: 537318017025
Ref: c-api/exceptions c PyExc_FileExistsError18017151
Ref: 537718017151
Ref: c-api/exceptions c PyExc_FileNotFoundError18017381
Ref: 537818017381
Ref: c-api/exceptions c PyExc_FloatingPointError18017612
Ref: 537918017612
Ref: c-api/exceptions c PyExc_GeneratorExit18017809
Ref: 537b18017809
Ref: c-api/exceptions c PyExc_ImportError18018020
Ref: 537d18018020
Ref: c-api/exceptions c PyExc_IndentationError18018145
Ref: 537f18018145
Ref: c-api/exceptions c PyExc_IndexError18018358
Ref: 538018018358
Ref: c-api/exceptions c PyExc_InterruptedError18018484
Ref: 538118018484
Ref: c-api/exceptions c PyExc_IsADirectoryError18018714
Ref: 538218018714
Ref: c-api/exceptions c PyExc_KeyError18018962
Ref: 538318018962
Ref: c-api/exceptions c PyExc_KeyboardInterrupt18019087
Ref: 538418019087
Ref: c-api/exceptions c PyExc_LookupError18019301
Ref: 538518019301
Ref: c-api/exceptions c PyExc_MemoryError18019446
Ref: 538618019446
Ref: c-api/exceptions c PyExc_ModuleNotFoundError18019572
Ref: 538718019572
Ref: c-api/exceptions c PyExc_NameError18019822
Ref: 538818019822
Ref: c-api/exceptions c PyExc_NotADirectoryError18019947
Ref: 538918019947
Ref: c-api/exceptions c PyExc_NotImplementedError18020180
Ref: 538a18020180
Ref: c-api/exceptions c PyExc_OSError18020392
Ref: 521f18020392
Ref: c-api/exceptions c PyExc_OverflowError18020517
Ref: 538b18020517
Ref: c-api/exceptions c PyExc_PermissionError18020708
Ref: 538d18020708
Ref: c-api/exceptions c PyExc_ProcessLookupError18020937
Ref: 538e18020937
Ref: c-api/exceptions c PyExc_PythonFinalizationError18021170
Ref: 558818021170
Ref: c-api/exceptions c PyExc_RecursionError18021320
Ref: 10b618021320
Ref: c-api/exceptions c PyExc_ReferenceError18021548
Ref: 538f18021548
Ref: c-api/exceptions c PyExc_RuntimeError18021761
Ref: 539118021761
Ref: c-api/exceptions c PyExc_StopAsyncIteration18021886
Ref: 539318021886
Ref: c-api/exceptions c PyExc_StopIteration18022119
Ref: 539418022119
Ref: c-api/exceptions c PyExc_SyntaxError18022329
Ref: 539518022329
Ref: c-api/exceptions c PyExc_SystemError18022473
Ref: 539718022473
Ref: c-api/exceptions c PyExc_SystemExit18022616
Ref: 539818022616
Ref: c-api/exceptions c PyExc_TabError18022757
Ref: 539918022757
Ref: c-api/exceptions c PyExc_TimeoutError18022902
Ref: 539a18022902
Ref: c-api/exceptions c PyExc_TypeError18023073
Ref: 521e18023073
Ref: c-api/exceptions c PyExc_UnboundLocalError18023198
Ref: 539b18023198
Ref: c-api/exceptions c PyExc_UnicodeDecodeError18023394
Ref: 539c18023394
Ref: c-api/exceptions c PyExc_UnicodeEncodeError18023590
Ref: 539d18023590
Ref: c-api/exceptions c PyExc_UnicodeError18023806
Ref: 539e18023806
Ref: c-api/exceptions c PyExc_UnicodeTranslateError18023931
Ref: 539f18023931
Ref: c-api/exceptions c PyExc_ValueError18024149
Ref: 522018024149
Ref: c-api/exceptions c PyExc_ZeroDivisionError18024274
Ref: 521b18024274
Ref: Exception types-Footnote-118025387
Node: OSError aliases18025429
Ref: c-api/exceptions oserror-aliases18025554
Ref: 558918025554
Ref: c-api/exceptions c PyExc_EnvironmentError18026182
Ref: 537518026182
Ref: c-api/exceptions c PyExc_IOError18026338
Ref: 537c18026338
Ref: c-api/exceptions c PyExc_WindowsError18026494
Ref: 53a318026494
Ref: c-api/exceptions win18026752
Ref: 558a18026752
Node: Warning types18026908
Ref: c-api/exceptions standardwarningcategories18027009
Ref: 557718027009
Ref: c-api/exceptions warning-types18027009
Ref: 558b18027009
Ref: c-api/exceptions c PyExc_Warning18027395
Ref: 53a218027395
Ref: c-api/exceptions c PyExc_BytesWarning18027541
Ref: 536c18027541
Ref: c-api/exceptions c PyExc_DeprecationWarning18027666
Ref: 537218027666
Ref: c-api/exceptions c PyExc_EncodingWarning18027862
Ref: 537418027862
Ref: c-api/exceptions c PyExc_FutureWarning18028093
Ref: 537a18028093
Ref: c-api/exceptions c PyExc_ImportWarning18028284
Ref: 537e18028284
Ref: c-api/exceptions c PyExc_PendingDeprecationWarning18028475
Ref: 538c18028475
Ref: c-api/exceptions c PyExc_ResourceWarning18028678
Ref: 539018028678
Ref: c-api/exceptions c PyExc_RuntimeWarning18028907
Ref: 539218028907
Ref: c-api/exceptions c PyExc_SyntaxWarning18029099
Ref: 539618029099
Ref: c-api/exceptions c PyExc_UnicodeWarning18029290
Ref: 53a018029290
Ref: c-api/exceptions c PyExc_UserWarning18029502
Ref: 53a118029502
Node: Tracebacks18029711
Ref: c-api/exceptions tracebacks18029806
Ref: 558c18029806
Ref: c-api/exceptions c PyTraceBack_Type18029843
Ref: 545918029843
Ref: c-api/exceptions c PyTraceBack_Check18030072
Ref: 558d18030072
Ref: c-api/exceptions c PyTraceBack_Here18030244
Ref: 545718030244
Ref: c-api/exceptions c PyTraceBack_Print18030686
Ref: 545818030686
Node: 拡張モジュールの定義18030963
Ref: c-api/extension-modules doc18031113
Ref: 558e18031113
Ref: c-api/extension-modules defining-extension-modules18031113
Ref: 558f18031113
Ref: c-api/extension-modules extension-modules18031113
Ref: 528118031113
Ref: c-api/extension-modules translation-repo18031113
Ref: 559018031113
Ref: 拡張モジュールの定義-Footnote-118033525
Node: 複数のモジュールインスタンス18033567
Ref: c-api/extension-modules multiple-module-instances18033708
Ref: 559318033708
Node: Initialization function18035210
Ref: c-api/extension-modules extension-export-hook18035378
Ref: 559118035378
Ref: c-api/extension-modules initialization-function18035378
Ref: 559518035378
Ref: c-api/extension-modules c PyInit_modulename18035528
Ref: 559618035528
Ref: c-api/extension-modules c PyMODINIT_FUNC18036417
Ref: 16f118036417
Ref: Initialization function-Footnote-118037545
Ref: Initialization function-Footnote-218037619
Node: 多段階初期化18037661
Ref: c-api/extension-modules id118037814
Ref: 559818037814
Ref: c-api/extension-modules multi-phase-initialization18037814
Ref: 559718037814
Ref: c-api/extension-modules c PyModuleDef_Init18038126
Ref: 522718038126
Node: 従来の一段階初期化18038852
Ref: c-api/extension-modules legacy-single-phase-initialization18038973
Ref: 559a18038973
Ref: c-api/extension-modules single-phase-initialization18038973
Ref: 559218038973
Ref: 従来の一段階初期化-Footnote-118041421
Node: ユーティリティ<2>18041554
Ref: c-api/utilities doc18041748
Ref: 559c18041748
Ref: c-api/utilities id118041748
Ref: 559d18041748
Ref: c-api/utilities translation-repo18041748
Ref: 559e18041748
Ref: c-api/utilities utilities18041748
Ref: 559f18041748
Node: オペレーティングシステム関連のユーティリティ18042714
Ref: c-api/sys doc18042868
Ref: 55a018042868
Ref: c-api/sys operating-system-utilities18042868
Ref: 55a118042868
Ref: c-api/sys os18042868
Ref: 55a218042868
Ref: c-api/sys c PyOS_FSPath18042993
Ref: f1818042993
Ref: c-api/sys c Py_FdIsInteractive18043637
Ref: 55a318043637
Ref: c-api/sys c PyOS_BeforeFork18044183
Ref: dbc18044183
Ref: c-api/sys c PyOS_AfterFork_Parent18044935
Ref: dbd18044935
Ref: c-api/sys c PyOS_AfterFork_Child18045787
Ref: 42e18045787
Ref: c-api/sys c PyOS_AfterFork18046828
Ref: 42d18046828
Ref: c-api/sys c PyOS_CheckStack18047461
Ref: 1bfe18047461
Ref: c-api/sys c PyOS_sighandler_t18047990
Ref: 540918047990
Ref: c-api/sys c PyOS_getsig18048104
Ref: 175c18048104
Ref: c-api/sys c PyOS_setsig18048399
Ref: 175d18048399
Ref: c-api/sys c PyOS_InterruptOccurred18048760
Ref: 1da018048760
Ref: c-api/sys c Py_DecodeLocale18049509
Ref: dc418049509
Ref: c-api/sys c Py_EncodeLocale18052362
Ref: dc518052362
Ref: c-api/sys c Py_fopen18054481
Ref: 39118054481
Ref: c-api/sys c Py_fclose18055136
Ref: 39218055136
Ref: オペレーティングシステム関連のユーティリティ-Footnote-118055563
Node: システム関数18055605
Ref: c-api/sys system-functions18055786
Ref: 55a518055786
Ref: c-api/sys systemfunctions18055786
Ref: 55a618055786
Ref: c-api/sys c PySys_GetObject18056157
Ref: 62a18056157
Ref: c-api/sys c PySys_SetObject18056444
Ref: 544418056444
Ref: c-api/sys c PySys_ResetWarnOptions18056847
Ref: 3f218056847
Ref: c-api/sys c PySys_WriteStdout18057231
Ref: 544618057231
Ref: c-api/sys c PySys_WriteStderr18058424
Ref: 544518058424
Ref: c-api/sys c PySys_FormatStdout18058676
Ref: 544218058676
Ref: c-api/sys c PySys_FormatStderr18059047
Ref: 544118059047
Ref: c-api/sys c PySys_GetXOptions18059329
Ref: 544318059329
Ref: c-api/sys c PySys_Audit18059739
Ref: 61318059739
Ref: c-api/sys c PySys_AuditTuple18061100
Ref: 61218061100
Ref: c-api/sys c PySys_AddAuditHook18061458
Ref: 4ad618061458
Ref: c-api/sys c Py_AuditHookFunction18063171
Ref: 55a718063171
Ref: システム関数-Footnote-118063687
Node: プロセス制御18063729
Ref: c-api/sys process-control18063880
Ref: 55a918063880
Ref: c-api/sys processcontrol18063880
Ref: 55aa18063880
Ref: c-api/sys c Py_FatalError18063925
Ref: b7e18063925
Ref: c-api/sys c Py_Exit18064716
Ref: f4f18064716
Ref: c-api/sys c Py_AtExit18065213
Ref: 54ad18065213
Node: モジュールのインポート<2>18066167
Ref: c-api/import doc18066351
Ref: 55ab18066351
Ref: c-api/import importing18066351
Ref: 55ac18066351
Ref: c-api/import importing-modules18066351
Ref: 55ad18066351
Ref: c-api/import translation-repo18066351
Ref: 55ae18066351
Ref: c-api/import c PyImport_ImportModule18066421
Ref: 3da18066421
Ref: c-api/import c PyImport_ImportModuleNoBlock18066738
Ref: 3d918066738
Ref: c-api/import c PyImport_ImportModuleEx18067427
Ref: 13c118067427
Ref: c-api/import c PyImport_ImportModuleLevelObject18068442
Ref: 53be18068442
Ref: c-api/import c PyImport_ImportModuleLevel18069520
Ref: 13c018069520
Ref: c-api/import c PyImport_Import18070086
Ref: 161a18070086
Ref: c-api/import c PyImport_ReloadModule18070803
Ref: 53bf18070803
Ref: c-api/import c PyImport_AddModuleRef18071321
Ref: 5fb18071321
Ref: c-api/import c PyImport_AddModuleObject18072337
Ref: 53b518072337
Ref: c-api/import c PyImport_AddModule18072721
Ref: 5fc18072721
Ref: c-api/import c PyImport_ExecCodeModule18072989
Ref: 53b618072989
Ref: c-api/import c PyImport_ExecCodeModuleEx18075159
Ref: 53b718075159
Ref: c-api/import c PyImport_ExecCodeModuleObject18075634
Ref: 53b818075634
Ref: c-api/import c PyImport_ExecCodeModuleWithPathnames18076308
Ref: 53b918076308
Ref: c-api/import c PyImport_GetMagicNumber18077187
Ref: 13bf18077187
Ref: c-api/import c PyImport_GetMagicTag18077726
Ref: 53ba18077726
Ref: c-api/import c PyImport_GetModuleDict18078153
Ref: 53bb18078153
Ref: c-api/import c PyImport_GetModule18078504
Ref: db018078504
Ref: c-api/import c PyImport_GetImporter18079080
Ref: 1ae518079080
Ref: c-api/import c PyImport_ImportFrozenModuleObject18079809
Ref: 53bd18079809
Ref: c-api/import c PyImport_ImportFrozenModule18080739
Ref: 53bc18080739
Ref: c-api/import c _frozen18081085
Ref: 97d18081085
Ref: c-api/import c PyImport_FrozenModules18081819
Ref: 33b618081819
Ref: c-api/import c PyImport_AppendInittab18082422
Ref: 1b7b18082422
Ref: c-api/import c _inittab18083142
Ref: 55af18083142
Ref: c-api/import c _inittab name18083472
Ref: 55b018083472
Ref: c-api/import c _inittab initfunc18083577
Ref: 55b118083577
Ref: c-api/import c PyImport_ExtendInittab18083735
Ref: 1b7c18083735
Ref: c-api/import c PyImport_Inittab18084556
Ref: 1b7a18084556
Ref: c-api/import c PyImport_ImportModuleAttr18084815
Ref: 39418084815
Ref: c-api/import c PyImport_ImportModuleAttrString18085375
Ref: 39518085375
Ref: モジュールのインポート<2>-Footnote-118085745
Node: データ整列化 data marshalling のサポート18085787
Ref: c-api/marshal doc18085983
Ref: 55b218085983
Ref: c-api/marshal data-marshalling-support18085983
Ref: 55b318085983
Ref: c-api/marshal marshalling-utils18085983
Ref: 55b418085983
Ref: c-api/marshal translation-repo18085983
Ref: 55b518085983
Ref: c-api/marshal c Py_MARSHAL_VERSION18086688
Ref: 55b618086688
Ref: c-api/marshal c PyMarshal_WriteLongToFile18086796
Ref: 99d18086796
Ref: c-api/marshal c PyMarshal_WriteObjectToFile18087366
Ref: 99e18087366
Ref: c-api/marshal c PyMarshal_WriteObjectToString18087804
Ref: 9a018087804
Ref: c-api/marshal c PyMarshal_ReadLongFromFile18088183
Ref: 55b718088183
Ref: c-api/marshal c PyMarshal_ReadShortFromFile18088633
Ref: 55b818088633
Ref: c-api/marshal c PyMarshal_ReadObjectFromFile18089085
Ref: 55b918089085
Ref: c-api/marshal c PyMarshal_ReadLastObjectFromFile18089498
Ref: 55ba18089498
Ref: c-api/marshal c PyMarshal_ReadObjectFromString18090297
Ref: 99f18090297
Node: 引数の解釈と値の構築18090756
Ref: c-api/arg doc18090946
Ref: 55bb18090946
Ref: c-api/arg arg-parsing18090946
Ref: 3d318090946
Ref: c-api/arg parsing-arguments-and-building-values18090946
Ref: 55bc18090946
Ref: c-api/arg translation-repo18090946
Ref: 55bd18090946
Node: 引数を解析する<2>18091713
Ref: c-api/arg parsing-arguments18091825
Ref: 55be18091825
Node: 文字列とバッファ18092686
Ref: c-api/arg arg-parsing-string-and-buffers18092786
Ref: 62c18092786
Ref: c-api/arg strings-and-buffers18092786
Ref: 55bf18092786
Ref: c-api/arg c-arg-borrowed-buffer18094452
Ref: 3d418094452
Node: 数<2>18106639
Ref: c-api/arg numbers18106778
Ref: 55c018106778
Node: その他のオブジェクト18109961
Ref: c-api/arg other-objects18110086
Ref: 55c218110086
Ref: c-api/arg o-ampersand18111204
Ref: 55c318111204
Ref: c-api/arg c Py_CLEANUP_SUPPORTED18112052
Ref: 55c418112052
Node: API 関数18117202
Ref: c-api/arg api-functions18117312
Ref: 55c518117312
Ref: c-api/arg c PyArg_ParseTuple18117349
Ref: 3bf18117349
Ref: c-api/arg c PyArg_VaParse18117722
Ref: 52e918117722
Ref: c-api/arg c PyArg_ParseTupleAndKeywords18118004
Ref: 62418118004
Ref: c-api/arg c PyArg_VaParseTupleAndKeywords18119119
Ref: 62518119119
Ref: c-api/arg c PyArg_ValidateKeywordArguments18119475
Ref: 52ea18119475
Ref: c-api/arg c PyArg_Parse18119924
Ref: 187418119924
Ref: c-api/arg c PyArg_UnpackTuple18120631
Ref: 172418120631
Ref: c-api/arg c PY_CXX_CONST18122968
Ref: 62618122968
Node: 値の構築18123394
Ref: c-api/arg building-values18123506
Ref: 55c618123506
Ref: c-api/arg c Py_BuildValue18123545
Ref: 3c018123545
Ref: c-api/arg capi-py-buildvalue-format-k18129512
Ref: 18d018129512
Ref: c-api/arg c Py_VaBuildValue18133373
Ref: 54cf18133373
Node: 文字列の変換と書式化18133680
Ref: c-api/conversion doc18133858
Ref: 55c718133858
Ref: c-api/conversion string-conversion18133858
Ref: 55c818133858
Ref: c-api/conversion string-conversion-and-formatting18133858
Ref: 55c918133858
Ref: c-api/conversion translation-repo18133858
Ref: 55ca18133858
Ref: c-api/conversion c PyOS_snprintf18133991
Ref: 172718133991
Ref: c-api/conversion c PyOS_vsnprintf18134345
Ref: 172818134345
Ref: c-api/conversion c PyOS_strtoul18136259
Ref: 540b18136259
Ref: c-api/conversion c PyOS_strtol18137298
Ref: 540a18137298
Ref: c-api/conversion c PyOS_string_to_double18137824
Ref: 14b118137824
Ref: c-api/conversion c PyOS_double_to_string18139813
Ref: 540818139813
Ref: c-api/conversion c Py_DTSF_SIGN18140551
Ref: 55cb18140551
Ref: c-api/conversion c Py_DTSF_ADD_DOT_018140700
Ref: 55cc18140700
Ref: c-api/conversion c Py_DTSF_ALT18140818
Ref: 55cd18140818
Ref: c-api/conversion c Py_DTSF_NO_NEG_018141006
Ref: 55ce18141006
Ref: c-api/conversion c Py_DTST_FINITE18141637
Ref: 55cf18141637
Ref: c-api/conversion c Py_DTST_INFINITE18141839
Ref: 55d018141839
Ref: c-api/conversion c Py_DTST_NAN18142036
Ref: 55d118142036
Ref: c-api/conversion c PyOS_mystricmp18142442
Ref: 1d9918142442
Ref: c-api/conversion c PyOS_mystrnicmp18142515
Ref: 1d9818142515
Ref: c-api/conversion c PyOS_stricmp18143316
Ref: 55d218143316
Ref: c-api/conversion c PyOS_strnicmp18143387
Ref: 55d318143387
Ref: 文字列の変換と書式化-Footnote-118143795
Ref: 文字列の変換と書式化-Footnote-218143843
Ref: 文字列の変換と書式化-Footnote-318143892
Ref: 文字列の変換と書式化-Footnote-418143939
Node: Character classification and conversion18143985
Ref: c-api/conversion character-classification-and-conversion18144143
Ref: 55d418144143
Ref: c-api/conversion c Py_ISALNUM18144421
Ref: 156d18144421
Ref: c-api/conversion c Py_ISALPHA18144526
Ref: 156e18144526
Ref: c-api/conversion c Py_ISDIGIT18144660
Ref: 156f18144660
Ref: c-api/conversion c Py_ISLOWER18144767
Ref: 157018144767
Ref: c-api/conversion c Py_ISUPPER18144888
Ref: 157218144888
Ref: c-api/conversion c Py_ISSPACE18145010
Ref: 157118145010
Ref: c-api/conversion c Py_ISXDIGIT18145184
Ref: 157318145184
Ref: c-api/conversion c Py_TOLOWER18145327
Ref: 157418145327
Ref: c-api/conversion c Py_TOUPPER18145423
Ref: 157518145423
Node: PyHash API18145519
Ref: c-api/hash doc18145668
Ref: 55d518145668
Ref: c-api/hash pyhash-api18145668
Ref: 55d618145668
Ref: c-api/hash translation-repo18145668
Ref: 55d718145668
Ref: c-api/hash c Py_hash_t18145823
Ref: 147f18145823
Ref: c-api/hash c Py_uhash_t18145938
Ref: 55d818145938
Ref: c-api/hash c Py_HASH_ALGORITHM18146054
Ref: 55d918146054
Ref: c-api/hash c Py_HASH_FNV18146361
Ref: 55da18146361
Ref: c-api/hash c Py_HASH_SIPHASH2418146393
Ref: 55db18146393
Ref: c-api/hash c Py_HASH_SIPHASH1318146431
Ref: 55dc18146431
Ref: c-api/hash c Py_HASH_CUTOFF18146838
Ref: 55dd18146838
Ref: c-api/hash c PyHASH_MODULUS18147532
Ref: 1a4718147532
Ref: c-api/hash c PyHASH_BITS18147754
Ref: 1a4818147754
Ref: c-api/hash c PyHASH_MULTIPLIER18147885
Ref: 19f318147885
Ref: c-api/hash c PyHASH_INF18148017
Ref: 1a4918148017
Ref: c-api/hash c PyHASH_IMAG18148204
Ref: 1a4a18148204
Ref: c-api/hash c PyHash_FuncDef18148408
Ref: 55de18148408
Ref: c-api/hash c PyHash_FuncDef hash18148524
Ref: 55e018148524
Ref: c-api/hash c PyHash_FuncDef name18148671
Ref: 55e118148671
Ref: c-api/hash c PyHash_FuncDef hash_bits18148866
Ref: 55e218148866
Ref: c-api/hash c PyHash_FuncDef seed_bits18149062
Ref: 55e318149062
Ref: c-api/hash c PyHash_GetFuncDef18149273
Ref: 55df18149273
Ref: c-api/hash c Py_HashPointer18149498
Ref: 42318149498
Ref: c-api/hash c Py_HashBuffer18149808
Ref: 39318149808
Ref: c-api/hash c PyObject_GenericHash18150449
Ref: 60c18150449
Ref: PyHash API-Footnote-118150858
Ref: PyHash API-Footnote-218150911
Node: リフレクション18150953
Ref: c-api/reflection doc18151105
Ref: 55e418151105
Ref: c-api/reflection id118151105
Ref: 55e518151105
Ref: c-api/reflection reflection18151105
Ref: 55e618151105
Ref: c-api/reflection translation-repo18151105
Ref: 55e718151105
Ref: c-api/reflection c PyEval_GetBuiltins18151157
Ref: 5f418151157
Ref: c-api/reflection c PyEval_GetLocals18151601
Ref: 5f818151601
Ref: c-api/reflection c PyEval_GetGlobals18153147
Ref: 5f618153147
Ref: c-api/reflection c PyEval_GetFrame18153538
Ref: 1b9818153538
Ref: c-api/reflection c PyEval_GetFrameBuiltins18153859
Ref: 5f318153859
Ref: c-api/reflection c PyEval_GetFrameLocals18154281
Ref: 5f718154281
Ref: c-api/reflection c PyEval_GetFrameGlobals18154928
Ref: 5f518154928
Ref: c-api/reflection c PyEval_GetFuncName18155350
Ref: 536218155350
Ref: c-api/reflection c PyEval_GetFuncDesc18155631
Ref: 536118155631
Ref: リフレクション-Footnote-118156096
Node: codec レジストリとサポート関数18156138
Ref: c-api/codec doc18156292
Ref: 55e818156292
Ref: c-api/codec codec-registry18156292
Ref: f3418156292
Ref: c-api/codec codec-registry-and-support-functions18156292
Ref: 55e918156292
Ref: c-api/codec translation-repo18156292
Ref: 55ea18156292
Ref: c-api/codec c PyCodec_Register18156381
Ref: 532b18156381
Ref: c-api/codec c PyCodec_Unregister18156725
Ref: a9b18156725
Ref: c-api/codec c PyCodec_KnownEncoding18157204
Ref: 532918157204
Ref: c-api/codec c PyCodec_Encode18157499
Ref: 3e018157499
Ref: c-api/codec c PyCodec_Decode18158184
Ref: 3df18158184
Node: コーデック検索API18158865
Ref: c-api/codec codec-lookup-api18159028
Ref: 55eb18159028
Ref: c-api/codec c PyCodec_Encoder18159362
Ref: 532518159362
Ref: c-api/codec c PyCodec_Decoder18159610
Ref: 532418159610
Ref: c-api/codec c PyCodec_IncrementalEncoder18159855
Ref: 532818159855
Ref: c-api/codec c PyCodec_IncrementalDecoder18160170
Ref: 532718160170
Ref: c-api/codec c PyCodec_StreamReader18160485
Ref: 532e18160485
Ref: c-api/codec c PyCodec_StreamWriter18160809
Ref: 532f18160809
Node: Unicode エラーハンドラ用レジストリ API18161133
Ref: c-api/codec registry-api-for-unicode-encoding-error-handlers18161328
Ref: 55ec18161328
Ref: c-api/codec c PyCodec_RegisterError18161438
Ref: 532c18161438
Ref: c-api/codec c PyCodec_LookupError18162825
Ref: 532a18162825
Ref: c-api/codec c PyCodec_StrictErrors18163254
Ref: 533018163254
Ref: c-api/codec c PyCodec_IgnoreErrors18163461
Ref: 532618163461
Ref: c-api/codec c PyCodec_ReplaceErrors18163700
Ref: 532d18163700
Ref: c-api/codec c PyCodec_XMLCharRefReplaceErrors18163946
Ref: 533118163946
Ref: c-api/codec c PyCodec_BackslashReplaceErrors18164199
Ref: 532318164199
Ref: c-api/codec c PyCodec_NameReplaceErrors18164511
Ref: 10b318164511
Node: Codec utility variables18164823
Ref: c-api/codec codec-utility-variables18164985
Ref: 55ed18164985
Ref: c-api/codec c Py_hexdigits18165052
Ref: 55ee18165052
Node: PyTime C API18165220
Ref: c-api/time doc18165374
Ref: 48318165374
Ref: c-api/time c-api-time18165374
Ref: 5d218165374
Ref: c-api/time pytime-c-api18165374
Ref: 55ef18165374
Ref: c-api/time translation-repo18165374
Ref: 55f018165374
Node: 型<3>18165844
Ref: c-api/time types18165923
Ref: 55f218165923
Ref: c-api/time c PyTime_t18165949
Ref: 5d318165949
Ref: c-api/time c PyTime_MIN18166485
Ref: 5d418166485
Ref: c-api/time c PyTime_MAX18166576
Ref: 5d518166576
Node: Clock Functions18166667
Ref: c-api/time clock-functions18166774
Ref: 55f318166774
Ref: c-api/time c PyTime_Monotonic18167500
Ref: 5d718167500
Ref: c-api/time c PyTime_PerfCounter18167666
Ref: 5d918167666
Ref: c-api/time c PyTime_Time18167841
Ref: 5db18167841
Node: Raw Clock Functions18168003
Ref: c-api/time raw-clock-functions18168124
Ref: 55f418168124
Ref: c-api/time c PyTime_MonotonicRaw18168668
Ref: 5d818168668
Ref: c-api/time c PyTime_PerfCounterRaw18168879
Ref: 5da18168879
Ref: c-api/time c PyTime_TimeRaw18169094
Ref: 5dc18169094
Node: Conversion functions18169290
Ref: c-api/time conversion-functions18169387
Ref: 55f518169387
Ref: c-api/time c PyTime_AsSecondsDouble18169448
Ref: 5d618169448
Node: Support for Perf Maps18169670
Ref: c-api/perfmaps doc18169773
Ref: 55f618169773
Ref: c-api/perfmaps perfmaps18169773
Ref: 55f718169773
Ref: c-api/perfmaps support-for-perf-maps18169773
Ref: 55f818169773
Ref: c-api/perfmaps translation-repo18169773
Ref: 55f918169773
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Init18170448
Ref: 1b0c18170448
Ref: c-api/perfmaps c PyUnstable_WritePerfMapEntry18171349
Ref: 1b0b18171349
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Fini18172207
Ref: 1b0d18172207
Ref: Support for Perf Maps-Footnote-118172839
Ref: Support for Perf Maps-Footnote-218172896
Node: 抽象オブジェクトレイヤ Abstract Objects Layer18173020
Ref: c-api/abstract doc18173234
Ref: 55fa18173234
Ref: c-api/abstract abstract18173234
Ref: 527818173234
Ref: c-api/abstract abstract-objects-layer18173234
Ref: 55fb18173234
Ref: c-api/abstract translation-repo18173234
Ref: 55fc18173234
Node: オブジェクトプロトコル object protocol18174637
Ref: c-api/object doc18174808
Ref: 55fd18174808
Ref: c-api/object object18174808
Ref: 55fe18174808
Ref: c-api/object object-protocol18174808
Ref: 55ff18174808
Ref: c-api/object c Py_GetConstant18174914
Ref: 5f918174914
Ref: c-api/object c Py_CONSTANT_NONE18175611
Ref: 560018175611
Ref: c-api/object c Py_CONSTANT_FALSE18175819
Ref: 560118175819
Ref: c-api/object c Py_CONSTANT_TRUE18176026
Ref: 560218176026
Ref: c-api/object c Py_CONSTANT_ELLIPSIS18176237
Ref: 560318176237
Ref: c-api/object c Py_CONSTANT_NOT_IMPLEMENTED18176428
Ref: 560418176428
Ref: c-api/object c Py_CONSTANT_ZERO18176602
Ref: 560518176602
Ref: c-api/object c Py_CONSTANT_ONE18176799
Ref: 560618176799
Ref: c-api/object c Py_CONSTANT_EMPTY_STR18177003
Ref: 560718177003
Ref: c-api/object c Py_CONSTANT_EMPTY_BYTES18177204
Ref: 560818177204
Ref: c-api/object c Py_CONSTANT_EMPTY_TUPLE18177404
Ref: 560918177404
Ref: c-api/object c Py_GetConstantBorrowed18177719
Ref: 5fa18177719
Ref: c-api/object c Py_NotImplemented18178272
Ref: 560a18178272
Ref: c-api/object c Py_RETURN_NOTIMPLEMENTED18178533
Ref: 184e18178533
Ref: c-api/object c Py_PRINT_RAW18178775
Ref: 560b18178775
Ref: c-api/object c PyObject_Print18179070
Ref: 17b118179070
Ref: c-api/object c PyObject_HasAttrWithError18179453
Ref: 61b18179453
Ref: c-api/object c PyObject_HasAttrStringWithError18179853
Ref: 61d18179853
Ref: c-api/object c PyObject_HasAttr18180251
Ref: 61c18180251
Ref: c-api/object c PyObject_HasAttrString18180909
Ref: 61e18180909
Ref: c-api/object c PyObject_GetAttr18181665
Ref: 5ee18181665
Ref: c-api/object c PyObject_GetAttrString18182225
Ref: 5ef18182225
Ref: c-api/object c PyObject_GetOptionalAttr18182733
Ref: 5ec18182733
Ref: c-api/object c PyObject_GetOptionalAttrString18183464
Ref: 5ed18183464
Ref: c-api/object c PyObject_GenericGetAttr18183882
Ref: 541418183882
Ref: c-api/object c PyObject_SetAttr18184753
Ref: 17c818184753
Ref: c-api/object c PyObject_SetAttrString18185420
Ref: 19ed18185420
Ref: c-api/object c PyObject_GenericSetAttr18186395
Ref: 541518186395
Ref: c-api/object c PyObject_DelAttr18187230
Ref: 189718187230
Ref: c-api/object c PyObject_DelAttrString18187600
Ref: 189818187600
Ref: c-api/object c PyObject_GenericGetDict18188419
Ref: 1d6318188419
Ref: c-api/object c PyObject_GenericSetDict18189193
Ref: 541618189193
Ref: c-api/object c _PyObject_GetDictPtr18189565
Ref: 560c18189565
Ref: c-api/object c PyObject_RichCompare18189994
Ref: 527618189994
Ref: c-api/object c PyObject_RichCompareBool18190727
Ref: 1dea18190727
Ref: c-api/object c PyObject_Format18191277
Ref: 541318191277
Ref: c-api/object c PyObject_Repr18191728
Ref: 123418191728
Ref: c-api/object c PyObject_ASCII18192473
Ref: 540c18192473
Ref: c-api/object c PyObject_Str18193174
Ref: 123518193174
Ref: c-api/object c PyObject_Bytes18193957
Ref: 540e18193957
Ref: c-api/object c PyObject_IsSubclass18194646
Ref: 10ab18194646
Ref: c-api/object c PyObject_IsInstance18195837
Ref: 10aa18195837
Ref: c-api/object c PyObject_Hash18197026
Ref: 43418197026
Ref: c-api/object c PyObject_HashNotImplemented18197507
Ref: 15e418197507
Ref: c-api/object c PyObject_IsTrue18197941
Ref: 541918197941
Ref: c-api/object c PyObject_Not18198264
Ref: 541b18198264
Ref: c-api/object c PyObject_Type18198580
Ref: 541e18198580
Ref: c-api/object c PyObject_TypeCheck18199275
Ref: 1d1018199275
Ref: c-api/object c PyObject_Size18199501
Ref: 541d18199501
Ref: c-api/object c PyObject_Length18199569
Ref: 541a18199569
Ref: c-api/object c PyObject_LengthHint18200032
Ref: 120a18200032
Ref: c-api/object c PyObject_GetItem18200513
Ref: 5ea18200513
Ref: c-api/object c PyObject_SetItem18200867
Ref: 52cd18200867
Ref: c-api/object c PyObject_DelItem18201319
Ref: 541018201319
Ref: c-api/object c PyObject_DelItemString18201624
Ref: 541118201624
Ref: c-api/object c PyObject_Dir18201919
Ref: 541218201919
Ref: c-api/object c PyObject_GetIter18202634
Ref: 541818202634
Ref: c-api/object c PyObject_SelfIter18203170
Ref: 541c18203170
Ref: c-api/object c PyObject_GetAIter18203522
Ref: 541718203522
Ref: c-api/object c PyObject_GetTypeData18204101
Ref: 76b18204101
Ref: c-api/object c PyType_GetTypeDataSize18204592
Ref: 76c18204592
Ref: c-api/object c PyObject_GetItemData18205297
Ref: 76e18205297
Ref: c-api/object c PyObject_VisitManagedDict18205641
Ref: 60d18205641
Ref: c-api/object c PyObject_ClearManagedDict18205957
Ref: 60e18205957
Ref: c-api/object c PyUnstable_Object_EnableDeferredRefcount18206233
Ref: 3c318206233
Ref: c-api/object c PyUnstable_Object_IsUniqueReferencedTemporary18207818
Ref: 3c518207818
Ref: c-api/object c PyUnstable_IsImmortal18209447
Ref: 3c218209447
Ref: c-api/object c PyUnstable_TryIncRef18210029
Ref: 192b18210029
Ref: c-api/object c PyUnstable_EnableTryIncRef18212761
Ref: 192c18212761
Ref: c-api/object c PyUnstable_Object_IsUniquelyReferenced18213272
Ref: 3c418213272
Ref: オブジェクトプロトコル object protocol-Footnote-118214300
Ref: オブジェクトプロトコル object protocol-Footnote-218214342
Ref: オブジェクトプロトコル object protocol-Footnote-318214384
Node: Call プロトコル18214454
Ref: c-api/call doc18214674
Ref: 561418214674
Ref: c-api/call call18214674
Ref: 7a318214674
Ref: c-api/call call-protocol18214674
Ref: 561518214674
Ref: c-api/call translation-repo18214674
Ref: 561618214674
Node: The tp_call Protocol18214908
Ref: c-api/call the-tp-call-protocol18215017
Ref: 561718215017
Node: The Vectorcall Protocol18215753
Ref: c-api/call the-vectorcall-protocol18215889
Ref: 561918215889
Ref: c-api/call vectorcall18215889
Ref: 77418215889
Ref: c-api/call c vectorcallfunc18217663
Ref: 77918217663
Ref: c-api/call c PY_VECTORCALL_ARGUMENTS_OFFSET18218775
Ref: 78018218775
Ref: The Vectorcall Protocol-Footnote-118219933
Node: 再帰の管理<2>18219975
Ref: c-api/call recursion-control18220084
Ref: 561b18220084
Node: Vectorcall Support API18220487
Ref: c-api/call vectorcall-support-api18220596
Ref: 561c18220596
Ref: c-api/call c PyVectorcall_NARGS18220659
Ref: 77718220659
Ref: c-api/call c PyVectorcall_Function18221129
Ref: 561d18221129
Ref: c-api/call c PyVectorcall_Call18221679
Ref: 77818221679
Node: Object Calling API18222308
Ref: c-api/call capi-call18222440
Ref: 561818222440
Ref: c-api/call object-calling-api18222440
Ref: 561e18222440
Ref: c-api/call c PyObject_Call18227067
Ref: 63d18227067
Ref: c-api/call c PyObject_CallNoArgs18227886
Ref: 63c18227886
Ref: c-api/call c PyObject_CallOneArg18228404
Ref: b7318228404
Ref: c-api/call c PyObject_CallObject18228808
Ref: 523118228808
Ref: c-api/call c PyObject_CallFunction18229433
Ref: 63f18229433
Ref: c-api/call c PyObject_CallMethod18230474
Ref: 64018230474
Ref: c-api/call c PyObject_CallFunctionObjArgs18231578
Ref: 540f18231578
Ref: c-api/call c PyObject_CallMethodObjArgs18232223
Ref: 1e3b18232223
Ref: c-api/call c PyObject_CallMethodNoArgs18232880
Ref: 561f18232880
Ref: c-api/call c PyObject_CallMethodOneArg18233287
Ref: 562018233287
Ref: c-api/call c _PyObject_Vectorcall18233731
Ref: 562218233731
Ref: c-api/call c PyObject_Vectorcall18233731
Ref: 77e18233731
Ref: c-api/call c PyObject_VectorcallDict18234551
Ref: 562118234551
Ref: c-api/call c PyObject_VectorcallMethod18235264
Ref: 77f18235264
Node: Call Support API18236420
Ref: c-api/call call-support-api18236520
Ref: 562318236520
Ref: c-api/call c PyCallable_Check18236571
Ref: 531718236571
Node: 数値型プロトコル number protocol18236967
Ref: c-api/number doc18237189
Ref: 562418237189
Ref: c-api/number number18237189
Ref: 562518237189
Ref: c-api/number number-protocol18237189
Ref: 562618237189
Ref: c-api/number translation-repo18237189
Ref: 562718237189
Ref: c-api/number c PyNumber_Check18237280
Ref: c6018237280
Ref: c-api/number c PyNumber_Add18237716
Ref: 53eb18237716
Ref: c-api/number c PyNumber_Subtract18238058
Ref: 540518238058
Ref: c-api/number c PyNumber_Multiply18238408
Ref: 53fe18238408
Ref: c-api/number c PyNumber_MatrixMultiply18238755
Ref: 10ba18238755
Ref: c-api/number c PyNumber_FloorDivide18239179
Ref: 53ef18239179
Ref: c-api/number c PyNumber_TrueDivide18239503
Ref: 540618239503
Ref: c-api/number c PyNumber_Remainder18240122
Ref: 540318240122
Ref: c-api/number c PyNumber_Divmod18240470
Ref: 53ee18240470
Ref: c-api/number c PyNumber_Power18240828
Ref: 540218240828
Ref: c-api/number c PyNumber_Negative18241439
Ref: 53ff18241439
Ref: c-api/number c PyNumber_Positive18241740
Ref: 540118241740
Ref: c-api/number c PyNumber_Absolute18242026
Ref: 53ea18242026
Ref: c-api/number c PyNumber_Invert18242326
Ref: 53fc18242326
Ref: c-api/number c PyNumber_Lshift18242653
Ref: 53fd18242653
Ref: c-api/number c PyNumber_Rshift18243008
Ref: 540418243008
Ref: c-api/number c PyNumber_And18243363
Ref: 53ec18243363
Ref: c-api/number c PyNumber_Xor18243729
Ref: 540718243729
Ref: c-api/number c PyNumber_Or18244118
Ref: 540018244118
Ref: c-api/number c PyNumber_InPlaceAdd18244479
Ref: 53f018244479
Ref: c-api/number c PyNumber_InPlaceSubtract18244924
Ref: 53f918244924
Ref: c-api/number c PyNumber_InPlaceMultiply18245377
Ref: 53f418245377
Ref: c-api/number c PyNumber_InPlaceMatrixMultiply18245827
Ref: 10bb18245827
Ref: c-api/number c PyNumber_InPlaceFloorDivide18246356
Ref: 53f218246356
Ref: c-api/number c PyNumber_InPlaceTrueDivide18246816
Ref: 53fa18246816
Ref: c-api/number c PyNumber_InPlaceRemainder18247504
Ref: 53f718247504
Ref: c-api/number c PyNumber_InPlacePower18247957
Ref: 53f618247957
Ref: c-api/number c PyNumber_InPlaceLshift18248755
Ref: 53f318248755
Ref: c-api/number c PyNumber_InPlaceRshift18249213
Ref: 53f818249213
Ref: c-api/number c PyNumber_InPlaceAnd18249671
Ref: 53f118249671
Ref: c-api/number c PyNumber_InPlaceXor18250140
Ref: 53fb18250140
Ref: c-api/number c PyNumber_InPlaceOr18250631
Ref: 53f518250631
Ref: c-api/number c PyNumber_Long18251095
Ref: c6118251095
Ref: c-api/number c PyNumber_Float18251410
Ref: c6218251410
Ref: c-api/number c PyNumber_Index18251739
Ref: a9718251739
Ref: c-api/number c PyNumber_ToBase18252276
Ref: 1bd218252276
Ref: c-api/number c PyNumber_AsSsize_t18252923
Ref: 53ed18252923
Ref: c-api/number c PyIndex_Check18253770
Ref: b8518253770
Node: シーケンス型プロトコル sequence protocol18254171
Ref: c-api/sequence doc18254417
Ref: 562818254417
Ref: c-api/sequence sequence18254417
Ref: 562918254417
Ref: c-api/sequence sequence-protocol18254417
Ref: 562a18254417
Ref: c-api/sequence translation-repo18254417
Ref: 562b18254417
Ref: c-api/sequence c PySequence_Check18254527
Ref: 542518254527
Ref: c-api/sequence c PySequence_Size18254993
Ref: 1e8f18254993
Ref: c-api/sequence c PySequence_Length18255063
Ref: 542d18255063
Ref: c-api/sequence c PySequence_Concat18255385
Ref: 542618255385
Ref: c-api/sequence c PySequence_Repeat18255736
Ref: 542f18255736
Ref: c-api/sequence c PySequence_InPlaceConcat18256101
Ref: 542a18256101
Ref: c-api/sequence c PySequence_InPlaceRepeat18256555
Ref: 542b18256555
Ref: c-api/sequence c PySequence_GetItem18257022
Ref: 1e9018257022
Ref: c-api/sequence c PySequence_GetSlice18257358
Ref: 542918257358
Ref: c-api/sequence c PySequence_SetItem18257739
Ref: 1e9118257739
Ref: c-api/sequence c PySequence_DelItem18258373
Ref: 1e9218258373
Ref: c-api/sequence c PySequence_SetSlice18258645
Ref: 543018258645
Ref: c-api/sequence c PySequence_DelSlice18258951
Ref: 542818258951
Ref: c-api/sequence c PySequence_Count18259312
Ref: 542718259312
Ref: c-api/sequence c PySequence_Contains18259699
Ref: 3d718259699
Ref: c-api/sequence c PySequence_In18260133
Ref: 3d618260133
Ref: c-api/sequence c PySequence_Index18260417
Ref: 542c18260417
Ref: c-api/sequence c PySequence_List18260780
Ref: 542e18260780
Ref: c-api/sequence c PySequence_Tuple18261259
Ref: 543118261259
Ref: c-api/sequence c PySequence_Fast18261807
Ref: 190518261807
Ref: c-api/sequence c PySequence_Fast_GET_SIZE18262766
Ref: 3c818262766
Ref: c-api/sequence c PySequence_Fast_GET_ITEM18263275
Ref: 3c918263275
Ref: c-api/sequence c PySequence_Fast_ITEMS18263649
Ref: 3ca18263649
Ref: c-api/sequence c PySequence_ITEM18264279
Ref: 562c18264279
Node: マップ型プロトコル mapping protocol18264698
Ref: c-api/mapping doc18264952
Ref: 562d18264952
Ref: c-api/mapping mapping18264952
Ref: 562e18264952
Ref: c-api/mapping mapping-protocol18264952
Ref: 562f18264952
Ref: c-api/mapping translation-repo18264952
Ref: 563018264952
Ref: c-api/mapping c PyMapping_Check18265177
Ref: 53d618265177
Ref: c-api/mapping c PyMapping_Size18265616
Ref: 1e9318265616
Ref: c-api/mapping c PyMapping_Length18265685
Ref: 53d718265685
Ref: c-api/mapping c PyMapping_GetItemString18265998
Ref: 5eb18265998
Ref: c-api/mapping c PyMapping_GetOptionalItem18266357
Ref: 5e818266357
Ref: c-api/mapping c PyMapping_GetOptionalItemString18267051
Ref: 5e918267051
Ref: c-api/mapping c PyMapping_SetItemString18267458
Ref: 53d818267458
Ref: c-api/mapping c PyMapping_DelItem18267777
Ref: 563118267777
Ref: c-api/mapping c PyMapping_DelItemString18267904
Ref: 563218267904
Ref: c-api/mapping c PyMapping_HasKeyWithError18268154
Ref: 61f18268154
Ref: c-api/mapping c PyMapping_HasKeyStringWithError18268525
Ref: 62118268525
Ref: c-api/mapping c PyMapping_HasKey18268911
Ref: 62018268911
Ref: c-api/mapping c PyMapping_HasKeyString18269610
Ref: 62218269610
Ref: c-api/mapping c PyMapping_Keys18270299
Ref: db918270299
Ref: c-api/mapping c PyMapping_Values18270717
Ref: dba18270717
Ref: c-api/mapping c PyMapping_Items18271134
Ref: dbb18271134
Node: イテレータプロトコル iterator protocol18271626
Ref: c-api/iter doc18271872
Ref: 563318271872
Ref: c-api/iter iterator18271872
Ref: 563418271872
Ref: c-api/iter iterator-protocol18271872
Ref: 563518271872
Ref: c-api/iter translation-repo18271872
Ref: 563618271872
Ref: c-api/iter c PyIter_Check18272051
Ref: 1d0d18272051
Ref: c-api/iter c PyAIter_Check18272339
Ref: 52e818272339
Ref: c-api/iter c PyIter_NextItem18272642
Ref: 39618272642
Ref: c-api/iter c PyIter_Next18273115
Ref: 39718273115
Ref: c-api/iter c PySendResult18273771
Ref: 563718273771
Ref: c-api/iter c PyIter_Send18273933
Ref: a9c18273933
Node: バッファプロトコル buffer Protocol18274537
Ref: c-api/buffer doc18274730
Ref: 563818274730
Ref: c-api/buffer buffer-protocol18274730
Ref: 563918274730
Ref: c-api/buffer bufferobjects18274730
Ref: 26218274730
Ref: c-api/buffer translation-repo18274730
Ref: 563a18274730
Node: buffer 構造体18278431
Ref: c-api/buffer buffer-structure18278575
Ref: 563b18278575
Ref: c-api/buffer id118278575
Ref: 563c18278575
Ref: c-api/buffer c Py_buffer18280010
Ref: 96018280010
Ref: c-api/buffer c Py_buffer buf18280171
Ref: 563e18280171
Ref: c-api/buffer c Py_buffer obj18280704
Ref: 564018280704
Ref: c-api/buffer c Py_buffer len18281534
Ref: 564118281534
Ref: c-api/buffer c Py_buffer readonly18282256
Ref: 564218282256
Ref: c-api/buffer c Py_buffer itemsize18282469
Ref: 564318282469
Ref: c-api/buffer c Py_buffer format18283578
Ref: 564418283578
Ref: c-api/buffer c Py_buffer ndim18283943
Ref: 564618283943
Ref: c-api/buffer c Py_buffer shape18284379
Ref: 564518284379
Ref: c-api/buffer c Py_buffer strides18285026
Ref: 563f18285026
Ref: c-api/buffer c Py_buffer suboffsets18285734
Ref: 564718285734
Ref: c-api/buffer c Py_buffer internal18286915
Ref: 564918286915
Ref: c-api/buffer c PyBUF_MAX_NDIM18287493
Ref: 52f218287493
Node: バッファリクエストのタイプ18287847
Ref: c-api/buffer buffer-request-types18288015
Ref: 124d18288015
Ref: c-api/buffer id218288015
Ref: 564a18288015
Node: リクエストに依存しないフィールド18288812
Ref: c-api/buffer request-independent-fields18288960
Ref: 564b18288960
Node: readonly format18289259
Ref: c-api/buffer readonly-format18289440
Ref: 564c18289440
Ref: c-api/buffer c PyBUF_WRITABLE18289491
Ref: 15d318289491
Ref: c-api/buffer c PyBUF_WRITEABLE18290058
Ref: 564d18290058
Ref: c-api/buffer c PyBUF_FORMAT18290196
Ref: 52ee18290196
Node: shape strides suboffsets18291177
Ref: c-api/buffer shape-strides-suboffsets18291337
Ref: 564e18291337
Ref: c-api/buffer c PyBUF_INDIRECT18291974
Ref: 52f118291974
Ref: c-api/buffer c PyBUF_STRIDES18292187
Ref: 52f918292187
Ref: c-api/buffer c PyBUF_ND18292385
Ref: 52f318292385
Ref: c-api/buffer c PyBUF_SIMPLE18292592
Ref: 52f618292592
Node: 隣接性のリクエスト18292763
Ref: c-api/buffer contiguity-requests18292929
Ref: 564f18292929
Ref: c-api/buffer c PyBUF_C_CONTIGUOUS18293649
Ref: 15d418293649
Ref: c-api/buffer c PyBUF_F_CONTIGUOUS18293895
Ref: 15d518293895
Ref: c-api/buffer c PyBUF_ANY_CONTIGUOUS18294143
Ref: 52eb18294143
Node: 複合リクエスト18294525
Ref: c-api/buffer compound-requests18294658
Ref: 565018294658
Ref: c-api/buffer c PyBUF_FULL18295690
Ref: 52ef18295690
Ref: c-api/buffer c PyBUF_FULL_RO18295994
Ref: 52f018295994
Ref: c-api/buffer c PyBUF_RECORDS18296296
Ref: 52f418296296
Ref: c-api/buffer c PyBUF_RECORDS_RO18296595
Ref: 52f518296595
Ref: c-api/buffer c PyBUF_STRIDED18296889
Ref: 52f718296889
Ref: c-api/buffer c PyBUF_STRIDED_RO18297189
Ref: 52f818297189
Ref: c-api/buffer c PyBUF_CONTIG18297483
Ref: 52ec18297483
Ref: c-api/buffer c PyBUF_CONTIG_RO18297783
Ref: 52ed18297783
Node: 複雑な配列18298046
Ref: c-api/buffer complex-arrays18298225
Ref: 564818298225
Node: NumPy スタイル shape strides18298442
Ref: c-api/buffer numpy-style-shape-and-strides18298576
Ref: 565118298576
Node: PIL スタイル shape strides suboffsets18300665
Ref: c-api/buffer pil-style-shape-strides-and-suboffsets18300799
Ref: 565218300799
Node: バッファ関連の関数18302100
Ref: c-api/buffer buffer-related-functions18302231
Ref: 565318302231
Ref: c-api/buffer c PyObject_CheckBuffer18302297
Ref: 63918302297
Ref: c-api/buffer c PyObject_GetBuffer18302767
Ref: 63a18302767
Ref: c-api/buffer c PyBuffer_Release18304157
Ref: 63b18304157
Ref: c-api/buffer c PyBuffer_SizeFromFormat18304738
Ref: 96218304738
Ref: c-api/buffer c PyBuffer_IsContiguous18305064
Ref: 96618305064
Ref: c-api/buffer c PyBuffer_GetPointer18305613
Ref: 96118305613
Ref: c-api/buffer c PyBuffer_FromContiguous18306029
Ref: 96418306029
Ref: c-api/buffer c PyBuffer_ToContiguous18306431
Ref: 96318306431
Ref: c-api/buffer c PyObject_CopyData18307049
Ref: 96518307049
Ref: c-api/buffer c PyBuffer_FillContiguousStrides18307397
Ref: 96718307397
Ref: c-api/buffer c PyBuffer_FillInfo18307878
Ref: 96818307878
Node: 具象オブジェクト concrete object レイヤ18309194
Ref: c-api/concrete doc18309432
Ref: 565418309432
Ref: c-api/concrete concrete18309432
Ref: 565518309432
Ref: c-api/concrete concrete-objects-layer18309432
Ref: 565618309432
Ref: c-api/concrete translation-repo18309432
Ref: 565718309432
Node: 基本オブジェクト fundamental object18311210
Ref: c-api/concrete fundamental18311391
Ref: 565918311391
Ref: c-api/concrete fundamental-objects18311391
Ref: 565a18311391
Node: 型オブジェクト<2>18311717
Ref: c-api/type doc18311853
Ref: 565b18311853
Ref: c-api/type type-objects18311853
Ref: 565c18311853
Ref: c-api/type typeobjects18311853
Ref: 565d18311853
Ref: c-api/type c PyTypeObject18311907
Ref: ca018311907
Ref: c-api/type c PyType_Type18312145
Ref: 76f18312145
Ref: c-api/type c PyType_Check18312404
Ref: 1de518312404
Ref: c-api/type c PyType_CheckExact18312651
Ref: 1de618312651
Ref: c-api/type c PyType_ClearCache18312881
Ref: 545f18312881
Ref: c-api/type c PyType_GetFlags18313094
Ref: 1d9b18313094
Ref: c-api/type c PyType_GetDict18313666
Ref: 1aec18313666
Ref: c-api/type c PyType_Modified18314396
Ref: 1bda18314396
Ref: c-api/type c PyType_AddWatcher18314764
Ref: 78518314764
Ref: c-api/type c PyType_ClearWatcher18315283
Ref: 565e18315283
Ref: c-api/type c PyType_Watch18315755
Ref: 78618315755
Ref: c-api/type c PyType_Unwatch18316459
Ref: 565f18316459
Ref: c-api/type c PyType_WatchCallback18316972
Ref: 566018316972
Ref: c-api/type c PyType_HasFeature18317338
Ref: 1d9a18317338
Ref: c-api/type c PyType_FastSubclass18317534
Ref: 566118317534
Ref: c-api/type c PyType_IS_GC18318023
Ref: 566318318023
Ref: c-api/type c PyType_IsSubtype18318215
Ref: 546018318215
Ref: c-api/type c PyType_GenericAlloc18318653
Ref: c6518318653
Ref: c-api/type c PyType_GenericNew18319887
Ref: 525118319887
Ref: c-api/type c PyType_Ready18320272
Ref: 98418320272
Ref: c-api/type c PyType_GetName18321353
Ref: 95c18321353
Ref: c-api/type c PyType_GetQualName18321674
Ref: 95d18321674
Ref: c-api/type c PyType_GetFullyQualifiedName18322023
Ref: 61618322023
Ref: c-api/type c PyType_GetModuleName18322471
Ref: 61818322471
Ref: c-api/type c PyType_GetSlot18322781
Ref: aa018322781
Ref: c-api/type c PyType_GetModule18323547
Ref: b6a18323547
Ref: c-api/type c PyType_GetModuleState18324750
Ref: b6b18324750
Ref: c-api/type c PyType_GetModuleByDef18325362
Ref: 63518325362
Ref: c-api/type c PyType_GetBaseByToken18326361
Ref: 3ae18326361
Ref: c-api/type c PyUnstable_Type_AssignVersionTag18327202
Ref: 566618327202
Ref: c-api/type c PyType_SUPPORTS_WEAKREFS18327743
Ref: 566718327743
Node: Creating Heap-Allocated Types18328126
Ref: c-api/type creating-heap-allocated-types18328216
Ref: 566818328216
Ref: c-api/type c PyType_FromMetaclass18328372
Ref: 77218328372
Ref: c-api/type c PyType_FromModuleAndSpec18330569
Ref: 77318330569
Ref: c-api/type c PyType_FromSpecWithBases18331582
Ref: 79e18331582
Ref: c-api/type c PyType_FromSpec18332426
Ref: 79d18332426
Ref: c-api/type c PyType_Freeze18333193
Ref: 3ad18333193
Ref: c-api/type c PyType_Spec18333739
Ref: 1aea18333739
Ref: c-api/type c PyType_Spec name18333911
Ref: 566918333911
Ref: c-api/type c PyType_Spec basicsize18334045
Ref: 76a18334045
Ref: c-api/type c PyType_Spec itemsize18334828
Ref: 566a18334828
Ref: c-api/type c PyType_Spec flags18335961
Ref: 566b18335961
Ref: c-api/type c PyType_Spec slots18336215
Ref: 566c18336215
Ref: c-api/type c PyType_Slot18336459
Ref: 546118336459
Ref: c-api/type c PyType_Slot slot18336693
Ref: 566418336693
Ref: c-api/type c PyType_Slot pfunc18339254
Ref: 567518339254
Ref: c-api/type c Py_tp_token18339657
Ref: 3af18339657
Ref: c-api/type c Py_TP_USE_SPEC18340771
Ref: 54be18340771
Node: None オブジェクト18341091
Ref: c-api/none doc18341227
Ref: 567618341227
Ref: c-api/none noneobject18341227
Ref: 567718341227
Ref: c-api/none the-none-object18341227
Ref: 567818341227
Ref: c-api/none translation-repo18341227
Ref: 567918341227
Ref: c-api/none c Py_None18341658
Ref: 522318341658
Ref: c-api/none c Py_RETURN_NONE18341968
Ref: 169118341968
Node: 数値型オブジェクト numeric object18342063
Ref: c-api/concrete numeric-objects18342302
Ref: 567a18342302
Ref: c-api/concrete numericobjects18342302
Ref: 567b18342302
Node: 整数型オブジェクト integer object18342588
Ref: c-api/long doc18342744
Ref: 567c18342744
Ref: c-api/long integer-objects18342744
Ref: 567d18342744
Ref: c-api/long longobjects18342744
Ref: 567e18342744
Ref: c-api/long c PyLongObject18343188
Ref: 39c18343188
Ref: c-api/long c PyLong_Type18343403
Ref: 53d418343403
Ref: c-api/long c PyLong_Check18343704
Ref: 567f18343704
Ref: c-api/long c PyLong_CheckExact18343920
Ref: 568018343920
Ref: c-api/long c PyLong_FromLong18344150
Ref: 1c2d18344150
Ref: c-api/long c PyLong_FromUnsignedLong18344694
Ref: 191f18344694
Ref: c-api/long c PyLong_FromSsize_t18345040
Ref: 190118345040
Ref: c-api/long c PyLong_FromSize_t18345382
Ref: 192118345382
Ref: c-api/long c PyLong_FromLongLong18345709
Ref: 1c2e18345709
Ref: c-api/long c PyLong_FromUnsignedLongLong18346037
Ref: 192018346037
Ref: c-api/long c PyLong_FromInt3218346401
Ref: 3a118346401
Ref: c-api/long c PyLong_FromInt6418346473
Ref: 3a218346473
Ref: c-api/long c PyLong_FromUInt3218346796
Ref: 3a318346796
Ref: c-api/long c PyLong_FromUInt6418346870
Ref: 3a418346870
Ref: c-api/long c PyLong_FromDouble18347200
Ref: b4018347200
Ref: c-api/long c PyLong_FromString18347520
Ref: 53d118347520
Ref: c-api/long c PyLong_FromUnicodeObject18348801
Ref: abb18348801
Ref: c-api/long c PyLong_FromVoidPtr18349052
Ref: 53d218349052
Ref: c-api/long c PyLong_FromNativeBytes18349379
Ref: 60718349379
Ref: c-api/long c PyLong_FromUnsignedNativeBytes18350139
Ref: 60818350139
Ref: c-api/long c PyLong_FromPid18350761
Ref: 568118350761
Ref: c-api/long c PyLong_AsLong18351068
Ref: 60518351068
Ref: c-api/long c PyLong_AS_LONG18351887
Ref: 568218351887
Ref: c-api/long c PyLong_AsInt18352174
Ref: 60418352174
Ref: c-api/long c PyLong_AsLongAndOverflow18352438
Ref: 148118352438
Ref: c-api/long c PyLong_AsLongLong18353478
Ref: 53cb18353478
Ref: c-api/long c PyLong_AsLongLongAndOverflow18354316
Ref: 148218354316
Ref: c-api/long c PyLong_AsSsize_t18355400
Ref: 53cd18355400
Ref: c-api/long c PyLong_AsUnsignedLong18355997
Ref: 53ce18355997
Ref: c-api/long c PyLong_AsSize_t18356588
Ref: 53cc18356588
Ref: c-api/long c PyLong_AsUnsignedLongLong18357157
Ref: 14b018357157
Ref: c-api/long c PyLong_AsUnsignedLongMask18357972
Ref: 53cf18357972
Ref: c-api/long c PyLong_AsUnsignedLongLongMask18358861
Ref: 1e2618358861
Ref: c-api/long c PyLong_AsInt3218359785
Ref: 39d18359785
Ref: c-api/long c PyLong_AsInt6418359853
Ref: 39e18359853
Ref: c-api/long c PyLong_AsUInt3218360507
Ref: 39f18360507
Ref: c-api/long c PyLong_AsUInt6418360577
Ref: 3a018360577
Ref: c-api/long c PyLong_AsDouble18361312
Ref: 19d518361312
Ref: c-api/long c PyLong_AsVoidPtr18361863
Ref: 53d018361863
Ref: c-api/long c PyLong_AsNativeBytes18362488
Ref: 60618362488
Ref: c-api/long c Py_ASNATIVEBYTES_DEFAULTS18366728
Ref: 54a818366728
Ref: c-api/long c Py_ASNATIVEBYTES_BIG_ENDIAN18366900
Ref: 54a718366900
Ref: c-api/long c Py_ASNATIVEBYTES_LITTLE_ENDIAN18367072
Ref: 54a918367072
Ref: c-api/long c Py_ASNATIVEBYTES_NATIVE_ENDIAN18367241
Ref: 54aa18367241
Ref: c-api/long c Py_ASNATIVEBYTES_UNSIGNED_BUFFER18367379
Ref: 54ac18367379
Ref: c-api/long c Py_ASNATIVEBYTES_REJECT_NEGATIVE18367601
Ref: 54ab18367601
Ref: c-api/long c Py_ASNATIVEBYTES_ALLOW_INDEX18367852
Ref: 54a618367852
Ref: c-api/long c PyLong_AsPid18369840
Ref: 1a2e18369840
Ref: c-api/long c PyLong_GetSign18370171
Ref: 39818370171
Ref: c-api/long c PyLong_IsPositive18370590
Ref: 39918370590
Ref: c-api/long c PyLong_IsNegative18370929
Ref: 39a18370929
Ref: c-api/long c PyLong_IsZero18371268
Ref: 39b18371268
Ref: c-api/long c PyLong_GetInfo18371579
Ref: 53d318371579
Ref: c-api/long c PyUnstable_Long_IsCompact18371994
Ref: 7a618371994
Ref: c-api/long c PyUnstable_Long_CompactValue18372865
Ref: 7a718372865
Node: Export API18373464
Ref: c-api/long export-api18373578
Ref: 568318373578
Ref: c-api/long c PyLongLayout18373641
Ref: 568418373641
Ref: c-api/long c PyLongLayout bits_per_digit18374090
Ref: 568518374090
Ref: c-api/long c PyLongLayout digit_size18374264
Ref: 568618374264
Ref: c-api/long c PyLongLayout digits_order18374417
Ref: 568718374417
Ref: c-api/long c PyLongLayout digit_endianness18374610
Ref: 568818374610
Ref: c-api/long c PyLong_GetNativeLayout18374838
Ref: 3a518374838
Ref: c-api/long c PyLongExport18375308
Ref: 568918375308
Ref: c-api/long c PyLongExport value18375654
Ref: 568b18375654
Ref: c-api/long c PyLongExport negative18375836
Ref: 568c18375836
Ref: c-api/long c PyLongExport ndigits18376014
Ref: 568d18376014
Ref: c-api/long c PyLongExport digits18376192
Ref: 568a18376192
Ref: c-api/long c PyLong_Export18376310
Ref: 3a618376310
Ref: c-api/long c PyLong_FreeExport18376922
Ref: 3a718376922
Node: PyLongWriter API18377204
Ref: c-api/long pylongwriter-api18377341
Ref: 568e18377341
Ref: c-api/long c PyLongWriter18377485
Ref: 568f18377485
Ref: c-api/long c PyLongWriter_Create18377685
Ref: 3a818377685
Ref: c-api/long c PyLongWriter_Finish18378810
Ref: 3a918378810
Ref: c-api/long c PyLongWriter_Discard18379338
Ref: 3aa18379338
Node: Deprecated API18379639
Ref: c-api/long deprecated-api18379757
Ref: 569018379757
Ref: c-api/long c PyLong_SHIFT18380243
Ref: 569118380243
Ref: c-api/long c PyLong_BASE18380392
Ref: 1c5d18380392
Ref: c-api/long c PyLong_MASK18380494
Ref: 569218380494
Node: Boolean オブジェクト18380607
Ref: c-api/bool doc18380794
Ref: 569318380794
Ref: c-api/bool boolean-objects18380794
Ref: 569418380794
Ref: c-api/bool boolobjects18380794
Ref: 569518380794
Ref: c-api/bool translation-repo18380794
Ref: 569618380794
Ref: c-api/bool c PyBool_Type18381198
Ref: 52fc18381198
Ref: c-api/bool c PyBool_Check18381495
Ref: 569918381495
Ref: c-api/bool c Py_False18381665
Ref: 569718381665
Ref: c-api/bool c Py_True18381953
Ref: 569818381953
Ref: c-api/bool c Py_RETURN_FALSE18382237
Ref: 169318382237
Ref: c-api/bool c Py_RETURN_TRUE18382334
Ref: 169218382334
Ref: c-api/bool c PyBool_FromLong18382429
Ref: 52fb18382429
Node: Floating-Point Objects18382688
Ref: c-api/float doc18382860
Ref: 569a18382860
Ref: c-api/float floating-point-objects18382860
Ref: 569b18382860
Ref: c-api/float floatobjects18382860
Ref: 569c18382860
Ref: c-api/float translation-repo18382860
Ref: 569d18382860
Ref: c-api/float c PyFloatObject18382923
Ref: 569e18382923
Ref: c-api/float c PyFloat_Type18383057
Ref: 53b018383057
Ref: c-api/float c PyFloat_Check18383324
Ref: 569f18383324
Ref: c-api/float c PyFloat_CheckExact18383544
Ref: 56a018383544
Ref: c-api/float c PyFloat_FromString18383778
Ref: 53af18383778
Ref: c-api/float c PyFloat_FromDouble18384092
Ref: 53ae18384092
Ref: c-api/float c PyFloat_AsDouble18384389
Ref: c6318384389
Ref: c-api/float c PyFloat_AS_DOUBLE18385085
Ref: 56a118385085
Ref: c-api/float c PyFloat_GetInfo18385275
Ref: 160e18385275
Ref: c-api/float c PyFloat_GetMax18385614
Ref: 160c18385614
Ref: c-api/float c PyFloat_GetMin18385804
Ref: 160d18385804
Ref: c-api/float c Py_INFINITY18386000
Ref: 56a218386000
Ref: c-api/float c Py_NAN18386265
Ref: 56a318386265
Ref: c-api/float c Py_HUGE_VAL18386532
Ref: 56a418386532
Ref: c-api/float c Py_MATH_E18386683
Ref: 56a518386683
Ref: c-api/float c Py_MATH_El18386806
Ref: 56a618386806
Ref: c-api/float c Py_MATH_PI18386912
Ref: 56a718386912
Ref: c-api/float c Py_MATH_PIl18387037
Ref: 56a818387037
Ref: c-api/float c Py_MATH_TAU18387150
Ref: 56a918387150
Ref: c-api/float c Py_RETURN_NAN18387305
Ref: 56aa18387305
Ref: c-api/float c Py_RETURN_INF18387481
Ref: 56ab18387481
Ref: c-api/float c Py_IS_FINITE18387757
Ref: 56ac18387757
Ref: c-api/float c Py_IS_INFINITY18388084
Ref: 56ad18388084
Ref: c-api/float c Py_IS_NAN18388362
Ref: 169418388362
Node: Pack and Unpack functions18388672
Ref: c-api/float pack-and-unpack-functions18388756
Ref: 56ae18388756
Node: Pack functions18390193
Ref: c-api/float pack-functions18390294
Ref: 56af18390294
Ref: c-api/float c PyFloat_Pack218391072
Ref: 96d18391072
Ref: c-api/float c PyFloat_Pack418391206
Ref: 96e18391206
Ref: c-api/float c PyFloat_Pack818391342
Ref: 96f18391342
Node: Unpack functions18391478
Ref: c-api/float unpack-functions18391579
Ref: 56b018391579
Ref: c-api/float c PyFloat_Unpack218392330
Ref: 97018392330
Ref: c-api/float c PyFloat_Unpack418392467
Ref: 97118392467
Ref: c-api/float c PyFloat_Unpack818392606
Ref: 97218392606
Node: 複素数オブジェクト18392745
Ref: c-api/complex doc18392882
Ref: 56b118392882
Ref: c-api/complex complex-number-objects18392882
Ref: 56b218392882
Ref: c-api/complex complexobjects18392882
Ref: 56b318392882
Ref: c-api/complex translation-repo18392882
Ref: 56b418392882
Node: C 構造体としての複素数18393317
Ref: c-api/complex complex-numbers-as-c-structures18393455
Ref: 56b518393455
Ref: c-api/complex c Py_complex18393732
Ref: 55c118393732
Ref: c-api/complex c Py_complex real18394017
Ref: 56b618394017
Ref: c-api/complex c Py_complex imag18394060
Ref: 56b718394060
Ref: c-api/complex c _Py_c_sum18394245
Ref: 56b818394245
Ref: c-api/complex c _Py_c_diff18394429
Ref: 56b918394429
Ref: c-api/complex c _Py_c_neg18394614
Ref: 56ba18394614
Ref: c-api/complex c _Py_c_prod18394773
Ref: 56bb18394773
Ref: c-api/complex c _Py_c_quot18394958
Ref: 56bc18394958
Ref: c-api/complex c _Py_c_pow18395286
Ref: 195318395286
Node: Complex Numbers as Python Objects18395692
Ref: c-api/complex complex-numbers-as-python-objects18395830
Ref: 56bd18395830
Ref: c-api/complex c PyComplexObject18395917
Ref: 56be18395917
Ref: c-api/complex c PyComplex_Type18396068
Ref: 533318396068
Ref: c-api/complex c PyComplex_Check18396363
Ref: 56bf18396363
Ref: c-api/complex c PyComplex_CheckExact18396589
Ref: 56c018396589
Ref: c-api/complex c PyComplex_FromCComplex18396829
Ref: 56c118396829
Ref: c-api/complex c PyComplex_FromDoubles18397097
Ref: 533218397097
Ref: c-api/complex c PyComplex_RealAsDouble18397412
Ref: 1a7418397412
Ref: c-api/complex c PyComplex_ImagAsDouble18398143
Ref: 1a7518398143
Ref: c-api/complex c PyComplex_AsCComplex18398884
Ref: 160f18398884
Node: シーケンスオブジェクト sequence object18399760
Ref: c-api/concrete sequence-objects18399984
Ref: 56c218399984
Ref: c-api/concrete sequenceobjects18399984
Ref: 56c318399984
Node: バイトオブジェクト<2>18400680
Ref: c-api/bytes doc18400836
Ref: 56c418400836
Ref: c-api/bytes bytes-objects18400836
Ref: 56c518400836
Ref: c-api/bytes bytesobjects18400836
Ref: 56c618400836
Ref: c-api/bytes c PyBytesObject18401113
Ref: 99918401113
Ref: c-api/bytes c PyBytes_Type18401273
Ref: 530d18401273
Ref: c-api/bytes c PyBytes_Check18401557
Ref: 15bb18401557
Ref: c-api/bytes c PyBytes_CheckExact18401801
Ref: 56c718401801
Ref: c-api/bytes c PyBytes_FromString18402053
Ref: 530a18402053
Ref: c-api/bytes c PyBytes_FromStringAndSize18402519
Ref: 15bc18402519
Ref: c-api/bytes c PyBytes_FromFormat18403043
Ref: 1e6818403043
Ref: c-api/bytes c PyBytes_FromFormatV18406900
Ref: 530818406900
Ref: c-api/bytes c PyBytes_FromObject18407248
Ref: 530918407248
Ref: c-api/bytes c PyBytes_Size18407757
Ref: 530c18407757
Ref: c-api/bytes c PyBytes_GET_SIZE18408004
Ref: 56c818408004
Ref: c-api/bytes c PyBytes_AsString18408220
Ref: a8b18408220
Ref: c-api/bytes c PyBytes_AS_STRING18409128
Ref: 56c918409128
Ref: c-api/bytes c PyBytes_AsStringAndSize18409404
Ref: 530418409404
Ref: c-api/bytes c PyBytes_Concat18410862
Ref: 530518410862
Ref: c-api/bytes c PyBytes_ConcatAndDel18411692
Ref: 530618411692
Ref: c-api/bytes c PyBytes_Join18412300
Ref: 38118412300
Ref: c-api/bytes c _PyBytes_Resize18413198
Ref: 1a2d18413198
Ref: c-api/bytes c PyBytes_Repr18414026
Ref: 530b18414026
Ref: c-api/bytes c PyBytes_DecodeEscape18415015
Ref: 530718415015
Ref: バイトオブジェクト<2>-Footnote-118415899
Ref: バイトオブジェクト<2>-Footnote-218416019
Ref: バイトオブジェクト<2>-Footnote-318416139
Ref: バイトオブジェクト<2>-Footnote-418416259
Ref: バイトオブジェクト<2>-Footnote-518416379
Ref: バイトオブジェクト<2>-Footnote-618416499
Ref: バイトオブジェクト<2>-Footnote-718416619
Ref: バイトオブジェクト<2>-Footnote-818416739
Node: bytearray オブジェクト<2>18416859
Ref: c-api/bytearray doc18417059
Ref: 56ca18417059
Ref: c-api/bytearray byte-array-objects18417059
Ref: 56cb18417059
Ref: c-api/bytearray bytearrayobjects18417059
Ref: 56cc18417059
Ref: c-api/bytearray translation-repo18417059
Ref: 56cd18417059
Ref: c-api/bytearray c PyByteArrayObject18417128
Ref: 56ce18417128
Ref: c-api/bytearray c PyByteArray_Type18417295
Ref: 530218417295
Node: 型チェックマクロ18417680
Ref: c-api/bytearray type-check-macros18417807
Ref: 56cf18417807
Ref: c-api/bytearray c PyByteArray_Check18417866
Ref: 56d018417866
Ref: c-api/bytearray c PyByteArray_CheckExact18418128
Ref: 56d118418128
Node: ダイレクト API 関数18418398
Ref: c-api/bytearray direct-api-functions18418543
Ref: 56d218418543
Ref: c-api/bytearray c PyByteArray_FromObject18418607
Ref: 15c618418607
Ref: c-api/bytearray c PyByteArray_FromStringAndSize18419231
Ref: 15c718419231
Ref: c-api/bytearray c PyByteArray_Concat18419604
Ref: 52ff18419604
Ref: c-api/bytearray c PyByteArray_Size18420188
Ref: 530118420188
Ref: c-api/bytearray c PyByteArray_AsString18420467
Ref: 52fe18420467
Ref: c-api/bytearray c PyByteArray_Resize18421016
Ref: 530018421016
Node: マクロ18421391
Ref: c-api/bytearray macros18421503
Ref: 56d318421503
Ref: c-api/bytearray c PyByteArray_AS_STRING18421684
Ref: 56d418421684
Ref: c-api/bytearray c PyByteArray_GET_SIZE18422097
Ref: 56d518422097
Node: Unicode オブジェクトと codec18422339
Ref: c-api/unicode doc18422549
Ref: 13bc18422549
Ref: c-api/unicode translation-repo18422549
Ref: 56d618422549
Ref: c-api/unicode unicode-objects-and-codecs18422549
Ref: 56d718422549
Ref: c-api/unicode unicodeobjects18422549
Ref: 56d818422549
Node: Unicode オブジェクト18422917
Ref: c-api/unicode unicode-objects18423057
Ref: 56d918423057
Ref: Unicode オブジェクト-Footnote-118424106
Ref: Unicode オブジェクト-Footnote-218424148
Node: Unicode 型18424190
Ref: c-api/unicode unicode-type18424302
Ref: 56da18424302
Ref: c-api/unicode c PyUnicode_Type18424447
Ref: 54a018424447
Ref: c-api/unicode c PyUnicodeIter_Type18424691
Ref: 547118424691
Ref: c-api/unicode c Py_UCS418424951
Ref: 33b18424951
Ref: c-api/unicode c Py_UCS218424987
Ref: 139018424987
Ref: c-api/unicode c Py_UCS118425023
Ref: 138f18425023
Ref: c-api/unicode c PyASCIIObject18425426
Ref: 139118425426
Ref: c-api/unicode c PyCompactUnicodeObject18425468
Ref: 139218425468
Ref: c-api/unicode c PyUnicodeObject18425519
Ref: 99b18425519
Ref: c-api/unicode c PyUnicode_IS_COMPACT18426169
Ref: 56db18426169
Ref: c-api/unicode c PyUnicode_IS_COMPACT_ASCII18426342
Ref: 56dc18426342
Ref: c-api/unicode c PyUnicode_Check18426638
Ref: 56dd18426638
Ref: c-api/unicode c PyUnicode_CheckExact18426892
Ref: 56de18426892
Ref: c-api/unicode c PyUnicode_GET_LENGTH18427139
Ref: ab518427139
Ref: c-api/unicode c PyUnicode_1BYTE_DATA18427490
Ref: 139618427490
Ref: c-api/unicode c PyUnicode_2BYTE_DATA18427580
Ref: 139718427580
Ref: c-api/unicode c PyUnicode_4BYTE_DATA18427670
Ref: 139818427670
Ref: c-api/unicode c PyUnicode_1BYTE_KIND18428172
Ref: 139a18428172
Ref: c-api/unicode c PyUnicode_2BYTE_KIND18428213
Ref: 139b18428213
Ref: c-api/unicode c PyUnicode_4BYTE_KIND18428254
Ref: 139c18428254
Ref: c-api/unicode c PyUnicode_KIND18428484
Ref: 139918428484
Ref: c-api/unicode c PyUnicode_DATA18428926
Ref: 139518428926
Ref: c-api/unicode c PyUnicode_WRITE18429242
Ref: 139f18429242
Ref: c-api/unicode c PyUnicode_READ18429901
Ref: 139d18429901
Ref: c-api/unicode c PyUnicode_READ_CHAR18430280
Ref: 139e18430280
Ref: c-api/unicode c PyUnicode_MAX_CHAR_VALUE18430733
Ref: 13a018430733
Ref: c-api/unicode c PyUnicode_IsIdentifier18431180
Ref: 1de418431180
Ref: c-api/unicode c PyUnicode_IS_ASCII18431642
Ref: 56df18431642
Node: Unicode 文字プロパティ18431849
Ref: c-api/unicode unicode-character-properties18432011
Ref: 56e018432011
Ref: c-api/unicode c Py_UNICODE_ISSPACE18432384
Ref: 1d2018432384
Ref: c-api/unicode c Py_UNICODE_ISLOWER18432534
Ref: 56e118432534
Ref: c-api/unicode c Py_UNICODE_ISUPPER18432681
Ref: 56e218432681
Ref: c-api/unicode c Py_UNICODE_ISTITLE18432828
Ref: 56e318432828
Ref: c-api/unicode c Py_UNICODE_ISLINEBREAK18433021
Ref: 56e418433021
Ref: c-api/unicode c Py_UNICODE_ISDECIMAL18433175
Ref: 56e518433175
Ref: c-api/unicode c Py_UNICODE_ISDIGIT18433330
Ref: 56e618433330
Ref: c-api/unicode c Py_UNICODE_ISNUMERIC18433481
Ref: 56e718433481
Ref: c-api/unicode c Py_UNICODE_ISALPHA18433650
Ref: 56e818433650
Ref: c-api/unicode c Py_UNICODE_ISALNUM18433821
Ref: 56e918433821
Ref: c-api/unicode c Py_UNICODE_ISPRINTABLE18433971
Ref: 56ea18433971
Ref: c-api/unicode c Py_UNICODE_TOLOWER18434247
Ref: 56eb18434247
Ref: c-api/unicode c Py_UNICODE_TOUPPER18434380
Ref: 56ec18434380
Ref: c-api/unicode c Py_UNICODE_TOTITLE18434513
Ref: 56ed18434513
Ref: c-api/unicode c Py_UNICODE_TODECIMAL18434664
Ref: 56ee18434664
Ref: c-api/unicode c Py_UNICODE_TODIGIT18434886
Ref: 56ef18434886
Ref: c-api/unicode c Py_UNICODE_TONUMERIC18435102
Ref: 56f018435102
Ref: c-api/unicode c Py_UNICODE_IS_SURROGATE18435378
Ref: 56f118435378
Ref: c-api/unicode c Py_UNICODE_IS_HIGH_SURROGATE18435544
Ref: 56f218435544
Ref: c-api/unicode c Py_UNICODE_IS_LOW_SURROGATE18435721
Ref: 56f318435721
Ref: c-api/unicode c Py_UNICODE_HIGH_SURROGATE18435897
Ref: 56f418435897
Ref: c-api/unicode c Py_UNICODE_LOW_SURROGATE18436114
Ref: 56f518436114
Ref: c-api/unicode c Py_UNICODE_JOIN_SURROGATES18436329
Ref: 56f618436329
Node: Unicode 文字列の生成とアクセス18436735
Ref: c-api/unicode creating-and-accessing-unicode-strings18436922
Ref: 56f718436922
Ref: c-api/unicode c PyUnicode_New18437207
Ref: aad18437207
Ref: c-api/unicode c PyUnicode_FromKindAndData18438691
Ref: 139318438691
Ref: c-api/unicode c PyUnicode_FromStringAndSize18439612
Ref: 549818439612
Ref: c-api/unicode c PyUnicode_FromString18440296
Ref: 549718440296
Ref: c-api/unicode c PyUnicode_FromFormat18440602
Ref: 62b18440602
Ref: c-api/unicode c PyUnicode_FromFormatV18453564
Ref: 79418453564
Ref: c-api/unicode c PyUnicode_FromObject18453878
Ref: 549518453878
Ref: c-api/unicode c PyUnicode_FromOrdinal18454381
Ref: 549618454381
Ref: c-api/unicode c PyUnicode_FromEncodedObject18454734
Ref: 549418454734
Ref: c-api/unicode c PyUnicode_Append18455897
Ref: 547918455897
Ref: c-api/unicode c PyUnicode_AppendAndDel18456367
Ref: 547a18456367
Ref: c-api/unicode c PyUnicode_BuildEncodingMap18456670
Ref: 1ac318456670
Ref: c-api/unicode c PyUnicode_GetDefaultEncoding18457245
Ref: 549918457245
Ref: c-api/unicode c PyUnicode_GetLength18457578
Ref: ab418457578
Ref: c-api/unicode c PyUnicode_CopyCharacters18457915
Ref: ab618457915
Ref: c-api/unicode c PyUnicode_Resize18458583
Ref: 549b18458583
Ref: c-api/unicode c PyUnicode_Fill18459272
Ref: 13a918459272
Ref: c-api/unicode c PyUnicode_WriteChar18459934
Ref: 138e18459934
Ref: c-api/unicode c PyUnicode_ReadChar18460679
Ref: 138d18460679
Ref: c-api/unicode c PyUnicode_Substring18461278
Ref: ab718461278
Ref: c-api/unicode c PyUnicode_AsUCS418461761
Ref: 139418461761
Ref: c-api/unicode c PyUnicode_AsUCS4Copy18462310
Node: ロケールエンコーディング18462865
Ref: c-api/unicode locale-encoding18463071
Ref: 56f918463071
Ref: c-api/unicode c PyUnicode_DecodeLocaleAndSize18463296
Ref: dc618463296
Ref: c-api/unicode c PyUnicode_DecodeLocale18464636
Ref: 548618464636
Ref: c-api/unicode c PyUnicode_EncodeLocale18465011
Ref: dc718465011
Ref: ロケールエンコーディング-Footnote-118466364
Ref: ロケールエンコーディング-Footnote-218466406
Node: ファイルシステムエンコーディング18466448
Ref: c-api/unicode file-system-encoding18466633
Ref: 56fa18466633
Ref: c-api/unicode c PyUnicode_FSConverter18467034
Ref: f1918467034
Ref: c-api/unicode c PyUnicode_FSDecoder18468342
Ref: 79718468342
Ref: c-api/unicode c PyUnicode_DecodeFSDefaultAndSize18469489
Ref: 548418469489
Ref: c-api/unicode c PyUnicode_DecodeFSDefault18470063
Ref: 1ae918470063
Ref: c-api/unicode c PyUnicode_EncodeFSDefault18470530
Ref: 1e8d18470530
Ref: ファイルシステムエンコーディング-Footnote-118471245
Ref: ファイルシステムエンコーディング-Footnote-218471287
Node: wchar_t サポート18471329
Ref: c-api/unicode wchar-t-support18471469
Ref: 56fb18471469
Ref: c-api/unicode c PyUnicode_FromWideChar18471615
Ref: 13a818471615
Ref: c-api/unicode c PyUnicode_AsWideChar18472056
Ref: 1e9418472056
Ref: c-api/unicode c PyUnicode_AsWideCharString18473059
Ref: abd18473059
Node: 組み込み codec built-in codec18474216
Ref: c-api/unicode built-in-codecs18474418
Ref: 56fc18474418
Ref: c-api/unicode builtincodecs18474418
Ref: 56f818474418
Node: 汎用 codec18476058
Ref: c-api/unicode generic-codecs18476161
Ref: 56fd18476161
Ref: c-api/unicode c Py_UNICODE_REPLACEMENT_CHARACTER18476238
Ref: 56fe18476238
Ref: c-api/unicode c PyUnicode_Decode18476531
Ref: 1e2318476531
Ref: c-api/unicode c PyUnicode_AsEncodedString18477114
Ref: 547c18477114
Node: UTF-8 Codecs18477808
Ref: c-api/unicode utf-8-codecs18477933
Ref: 56ff18477933
Ref: c-api/unicode c PyUnicode_DecodeUTF818478016
Ref: 549018478016
Ref: c-api/unicode c PyUnicode_DecodeUTF8Stateful18478437
Ref: 1b7618478437
Ref: c-api/unicode c PyUnicode_AsUTF8String18479067
Ref: 13aa18479067
Ref: c-api/unicode c PyUnicode_AsUTF8AndSize18479607
Ref: a9d18479607
Ref: c-api/unicode c PyUnicode_AsUTF818481109
Ref: 42218481109
Ref: UTF-8 Codecs-Footnote-118481912
Node: UTF-32 Codecs18481965
Ref: c-api/unicode utf-32-codecs18482091
Ref: 570018482091
Ref: c-api/unicode c PyUnicode_DecodeUTF3218482174
Ref: 548c18482174
Ref: c-api/unicode c PyUnicode_DecodeUTF32Stateful18483666
Ref: 548d18483666
Ref: c-api/unicode c PyUnicode_AsUTF32String18484441
Ref: 547e18484441
Node: UTF-16 Codecs18484938
Ref: c-api/unicode utf-16-codecs18485064
Ref: 570118485064
Ref: c-api/unicode c PyUnicode_DecodeUTF1618485150
Ref: 548a18485150
Ref: c-api/unicode c PyUnicode_DecodeUTF16Stateful18486762
Ref: 548b18486762
Ref: c-api/unicode c PyUnicode_AsUTF16String18487527
Ref: 547d18487527
Node: UTF-7 Codecs18488024
Ref: c-api/unicode utf-7-codecs18488158
Ref: 570218488158
Ref: c-api/unicode c PyUnicode_DecodeUTF718488242
Ref: 548e18488242
Ref: c-api/unicode c PyUnicode_DecodeUTF7Stateful18488609
Ref: 548f18488609
Node: Unicode-Escape Codecs18489235
Ref: c-api/unicode unicode-escape-codecs18489381
Ref: 570318489381
Ref: c-api/unicode c PyUnicode_DecodeUnicodeEscape18489494
Ref: 549118489494
Ref: c-api/unicode c PyUnicode_AsUnicodeEscapeString18489879
Ref: 13ab18489879
Node: Raw-Unicode-Escape Codecs18490323
Ref: c-api/unicode raw-unicode-escape-codecs18490471
Ref: 570418490471
Ref: c-api/unicode c PyUnicode_DecodeRawUnicodeEscape18490595
Ref: 548918490595
Ref: c-api/unicode c PyUnicode_AsRawUnicodeEscapeString18490987
Ref: 13ac18490987
Node: Latin-1 Codecs18491439
Ref: c-api/unicode latin-1-codecs18491578
Ref: 570518491578
Ref: c-api/unicode c PyUnicode_DecodeLatin118491798
Ref: 548518491798
Ref: c-api/unicode c PyUnicode_AsLatin1String18492222
Ref: 13ad18492222
Node: ASCII Codecs18492654
Ref: c-api/unicode ascii-codecs18492788
Ref: 570618492788
Ref: c-api/unicode c PyUnicode_DecodeASCII18492983
Ref: 548118492983
Ref: c-api/unicode c PyUnicode_AsASCIIString18493351
Ref: 13ae18493351
Node: Character Map Codecs18493781
Ref: c-api/unicode character-map-codecs18493926
Ref: 570718493926
Ref: c-api/unicode c PyUnicode_DecodeCharmap18494594
Ref: 548218494594
Ref: c-api/unicode c PyUnicode_AsCharmapString18495586
Ref: 547b18495586
Ref: c-api/unicode c PyUnicode_Translate18496490
Ref: 549f18496490
Node: Windows 用の MBCS codec18497543
Ref: c-api/unicode mbcs-codecs-for-windows18497667
Ref: 570818497667
Ref: c-api/unicode c PyUnicode_DecodeMBCS18498274
Ref: 548718498274
Ref: c-api/unicode c PyUnicode_DecodeMBCSStateful18498682
Ref: 548818498682
Ref: c-api/unicode c PyUnicode_DecodeCodePageStateful18499355
Ref: 548318499355
Ref: c-api/unicode c PyUnicode_AsMBCSString18499786
Ref: 13af18499786
Ref: c-api/unicode c PyUnicode_EncodeCodePage18500267
Ref: 13b018500267
Node: メソッドおよびスロット関数 slot function18500772
Ref: c-api/unicode methods-and-slot-functions18500963
Ref: 570918500963
Ref: c-api/unicode unicodemethodsandslots18500963
Ref: 570a18500963
Ref: c-api/unicode c PyUnicode_Concat18501439
Ref: 13bd18501439
Ref: c-api/unicode c PyUnicode_Split18501714
Ref: 549d18501714
Ref: c-api/unicode c PyUnicode_RSplit18502514
Ref: 18fa18502514
Ref: c-api/unicode c PyUnicode_Splitlines18502937
Ref: 549e18502937
Ref: c-api/unicode c PyUnicode_Partition18503358
Ref: 18fb18503358
Ref: c-api/unicode c PyUnicode_RPartition18503993
Ref: 18fc18503993
Ref: c-api/unicode c PyUnicode_Join18504555
Ref: 13be18504555
Ref: c-api/unicode c PyUnicode_Tailmatch18504891
Ref: ab918504891
Ref: c-api/unicode c PyUnicode_Find18505359
Ref: 549218505359
Ref: c-api/unicode c PyUnicode_FindChar18506119
Ref: aba18506119
Ref: c-api/unicode c PyUnicode_Count18507054
Ref: 548018507054
Ref: c-api/unicode c PyUnicode_Replace18507422
Ref: 549a18507422
Ref: c-api/unicode c PyUnicode_Compare18507937
Ref: ab818507937
Ref: c-api/unicode c PyUnicode_Equal18508551
Ref: 3b018508551
Ref: c-api/unicode c PyUnicode_EqualToUTF8AndSize18509263
Ref: 61918509263
Ref: c-api/unicode c PyUnicode_EqualToUTF818509890
Ref: 61a18509890
Ref: c-api/unicode c PyUnicode_CompareWithASCIIString18510292
Ref: 148318510292
Ref: c-api/unicode c PyUnicode_RichCompare18510978
Ref: 549c18510978
Ref: c-api/unicode c PyUnicode_Format18511721
Ref: 549318511721
Ref: c-api/unicode c PyUnicode_Contains18512085
Ref: 547f18512085
Ref: c-api/unicode c PyUnicode_InternInPlace18512498
Ref: ab218512498
Ref: c-api/unicode c PyUnicode_InternFromString18513845
Ref: 19eb18513845
Ref: c-api/unicode c PyUnicode_CHECK_INTERNED18514697
Ref: 570b18514697
Node: PyUnicodeWriter18515209
Ref: c-api/unicode pyunicodewriter18515384
Ref: 570c18515384
Ref: c-api/unicode c PyUnicodeWriter18515551
Ref: 3b118515551
Ref: c-api/unicode c PyUnicodeWriter_Create18515774
Ref: 3b218515774
Ref: c-api/unicode c PyUnicodeWriter_Finish18516129
Ref: 3b518516129
Ref: c-api/unicode c PyUnicodeWriter_Discard18516428
Ref: 3b418516428
Ref: c-api/unicode c PyUnicodeWriter_WriteChar18516695
Ref: 3b818516695
Ref: c-api/unicode c PyUnicodeWriter_WriteUTF818516969
Ref: 3bd18516969
Ref: c-api/unicode c PyUnicodeWriter_WriteASCII18517496
Ref: 3b718517496
Ref: c-api/unicode c PyUnicodeWriter_WriteWideChar18518033
Ref: 3be18518033
Ref: c-api/unicode c PyUnicodeWriter_WriteUCS418518456
Ref: 3bc18518456
Ref: c-api/unicode c PyUnicodeWriter_WriteStr18518783
Ref: 3ba18518783
Ref: c-api/unicode c PyUnicodeWriter_WriteRepr18519265
Ref: 3b918519265
Ref: c-api/unicode c PyUnicodeWriter_WriteSubstring18519718
Ref: 3bb18519718
Ref: c-api/unicode c PyUnicodeWriter_Format18520225
Ref: 3b618520225
Ref: c-api/unicode c PyUnicodeWriter_DecodeUTF8Stateful18520550
Ref: 3b318520550
Node: Deprecated API<2>18521487
Ref: c-api/unicode deprecated-api18521600
Ref: 570d18521600
Ref: c-api/unicode c Py_UNICODE18521683
Ref: 3de18521683
Ref: c-api/unicode c PyUnicode_READY18522245
Ref: 43218522245
Ref: c-api/unicode c PyUnicode_IS_READY18522676
Ref: 570e18522676
Node: タプルオブジェクト tuple object18523085
Ref: c-api/tuple doc18523298
Ref: 570f18523298
Ref: c-api/tuple translation-repo18523298
Ref: 571018523298
Ref: c-api/tuple tuple-objects18523298
Ref: 571118523298
Ref: c-api/tuple tupleobjects18523298
Ref: 571218523298
Ref: c-api/tuple c PyTupleObject18523394
Ref: 55a818523394
Ref: c-api/tuple c PyTuple_Type18523558
Ref: 545e18523558
Ref: c-api/tuple c PyTuple_Check18523857
Ref: 571318523857
Ref: c-api/tuple c PyTuple_CheckExact18524086
Ref: 571418524086
Ref: c-api/tuple c PyTuple_New18524323
Ref: 63e18524323
Ref: c-api/tuple c PyTuple_Pack18524573
Ref: 545c18524573
Ref: c-api/tuple c PyTuple_Size18525012
Ref: 545d18525012
Ref: c-api/tuple c PyTuple_GET_SIZE18525261
Ref: 571518525261
Ref: c-api/tuple c PyTuple_GetItem18525400
Ref: 523c18525400
Ref: c-api/tuple c PyTuple_GET_ITEM18526110
Ref: 571618526110
Ref: c-api/tuple c PyTuple_GetSlice18526363
Ref: 545b18526363
Ref: c-api/tuple c PyTuple_SetItem18526822
Ref: 523d18526822
Ref: c-api/tuple c PyTuple_SET_ITEM18527420
Ref: 62e18527420
Ref: c-api/tuple c _PyTuple_Resize18528443
Ref: 172918528443
Node: Struct Sequence オブジェクト18529527
Ref: c-api/tuple id118529732
Ref: 571718529732
Ref: c-api/tuple struct-sequence-objects18529732
Ref: 13db18529732
Ref: c-api/tuple c PyStructSequence_NewType18530056
Ref: 543e18530056
Ref: c-api/tuple c PyStructSequence_InitType18530513
Ref: 120818530513
Ref: c-api/tuple c PyStructSequence_InitType218530727
Ref: 120918530727
Ref: c-api/tuple c PyStructSequence_Desc18530999
Ref: db818530999
Ref: c-api/tuple c PyStructSequence_Desc name18531216
Ref: 571818531216
Ref: c-api/tuple c PyStructSequence_Desc doc18531391
Ref: 571918531391
Ref: c-api/tuple c PyStructSequence_Desc fields18531507
Ref: 571a18531507
Ref: c-api/tuple c PyStructSequence_Desc n_in_sequence18531676
Ref: 571b18531676
Ref: c-api/tuple c PyStructSequence_Field18531811
Ref: db718531811
Ref: c-api/tuple c PyStructSequence_Field name18532252
Ref: 571c18532252
Ref: c-api/tuple c PyStructSequence_Field doc18532465
Ref: 571d18532465
Ref: c-api/tuple c PyStructSequence_UnnamedField18532563
Ref: b7d18532563
Ref: c-api/tuple c PyStructSequence_New18532876
Ref: 543d18532876
Ref: c-api/tuple c PyStructSequence_GetItem18533292
Ref: 543c18533292
Ref: c-api/tuple c PyStructSequence_GET_ITEM18533697
Ref: 571e18533697
Ref: c-api/tuple c PyStructSequence_SetItem18534005
Ref: 543f18534005
Ref: c-api/tuple c PyStructSequence_SET_ITEM18534606
Ref: 571f18534606
Node: リストオブジェクト18534878
Ref: c-api/list doc18535034
Ref: 572018535034
Ref: c-api/list list-objects18535034
Ref: 572118535034
Ref: c-api/list listobjects18535034
Ref: 572218535034
Ref: c-api/list translation-repo18535034
Ref: 572318535034
Ref: c-api/list c PyListObject18535100
Ref: 278418535100
Ref: c-api/list c PyList_Type18535263
Ref: 526018535263
Ref: c-api/list c PyList_Check18535570
Ref: 572418535570
Ref: c-api/list c PyList_CheckExact18535842
Ref: 572518535842
Ref: c-api/list c PyList_New18536122
Ref: 52ce18536122
Ref: c-api/list c PyList_Size18536973
Ref: 163818536973
Ref: c-api/list c PyList_GET_SIZE18537285
Ref: 572618537285
Ref: c-api/list c PyList_GetItemRef18537503
Ref: 5fe18537503
Ref: c-api/list c PyList_GetItem18538097
Ref: 5ff18538097
Ref: c-api/list c PyList_GET_ITEM18538818
Ref: 52e418538818
Ref: c-api/list c PyList_SetItem18539453
Ref: 191c18539453
Ref: c-api/list c PyList_SET_ITEM18540176
Ref: 62f18540176
Ref: c-api/list c PyList_Insert18541556
Ref: 191b18541556
Ref: c-api/list c PyList_Append18542063
Ref: 53c418542063
Ref: c-api/list c PyList_GetSlice18542469
Ref: 53c618542469
Ref: c-api/list c PyList_SetSlice18543052
Ref: 53c818543052
Ref: c-api/list c PyList_Extend18544046
Ref: 60018544046
Ref: c-api/list c PyList_Clear18544970
Ref: 60118544970
Ref: c-api/list c PyList_Sort18545388
Ref: 53c918545388
Ref: c-api/list c PyList_Reverse18546151
Ref: 53c718546151
Ref: c-api/list c PyList_AsTuple18546536
Ref: 53c518546536
Node: Container オブジェクト18546861
Ref: c-api/concrete container-objects18547073
Ref: 572718547073
Ref: c-api/concrete mapobjects18547073
Ref: 572818547073
Node: Dictionary Objects18547198
Ref: c-api/dict doc18547312
Ref: 572918547312
Ref: c-api/dict dictionary-objects18547312
Ref: 572a18547312
Ref: c-api/dict dictobjects18547312
Ref: 572b18547312
Ref: c-api/dict c PyDictObject18547367
Ref: 64f18547367
Ref: c-api/dict c PyDict_Type18547527
Ref: 534b18547527
Ref: c-api/dict c PyDict_Check18547849
Ref: 565818547849
Ref: c-api/dict c PyDict_CheckExact18548115
Ref: 572c18548115
Ref: c-api/dict c PyDict_New18548389
Ref: 534918548389
Ref: c-api/dict c PyDictProxy_New18548660
Ref: 533c18548660
Ref: c-api/dict c PyDictProxy_Type18549178
Ref: 533d18549178
Ref: c-api/dict c PyDict_Clear18549774
Ref: 534218549774
Ref: c-api/dict c PyDict_Contains18550019
Ref: 5de18550019
Ref: c-api/dict c PyDict_ContainsString18550637
Ref: 5dd18550637
Ref: c-api/dict c PyDict_Copy18550950
Ref: 66218550950
Ref: c-api/dict c PyDict_SetItem18551227
Ref: 523e18551227
Ref: c-api/dict c PyDict_SetItemString18552066
Ref: 19ec18552066
Ref: c-api/dict c PyDict_DelItem18552425
Ref: 534318552425
Ref: c-api/dict c PyDict_DelItemString18553240
Ref: 534418553240
Ref: c-api/dict c PyDict_GetItemRef18553574
Ref: 5e018553574
Ref: c-api/dict c PyDict_GetItem18554538
Ref: 62818554538
Ref: c-api/dict c PyDict_GetItemWithError18555726
Ref: 5e118555726
Ref: c-api/dict c PyDict_GetItemString18556607
Ref: 62918556607
Ref: c-api/dict c PyDict_GetItemStringRef18557733
Ref: 41f18557733
Ref: c-api/dict c PyDict_SetDefault18558151
Ref: 5e418558151
Ref: c-api/dict c PyDict_SetDefaultRef18559176
Ref: 5e318559176
Ref: c-api/dict c PyDict_Pop18560549
Ref: 42018560549
Ref: c-api/dict c PyDict_PopString18561575
Ref: 5e518561575
Ref: c-api/dict c PyDict_Items18561898
Ref: 534518561898
Ref: c-api/dict c PyDict_Keys18562183
Ref: 534618562183
Ref: c-api/dict c PyDict_Values18562464
Ref: 534d18562464
Ref: c-api/dict c PyDict_Size18562749
Ref: 534a18562749
Ref: c-api/dict c PyDict_GET_SIZE18563033
Ref: 572d18563033
Ref: c-api/dict c PyDict_Next18563219
Ref: 19ee18563219
Ref: c-api/dict c PyDict_Merge18566523
Ref: 534718566523
Ref: c-api/dict c PyDict_Update18567750
Ref: 534c18567750
Ref: c-api/dict c PyDict_MergeFromSeq218568691
Ref: 534818568691
Ref: c-api/dict c PyDict_AddWatcher18570007
Ref: 3ce18570007
Ref: c-api/dict c PyDict_ClearWatcher18570749
Ref: 17a318570749
Ref: c-api/dict c PyDict_Watch18571432
Ref: 78418571432
Ref: c-api/dict c PyDict_Unwatch18571861
Ref: 17a418571861
Ref: c-api/dict c PyDict_WatchEvent18572378
Ref: 572f18572378
Ref: c-api/dict c PyDict_WatchCallback18572699
Ref: 573018572699
Node: Dictionary View Objects18575040
Ref: c-api/dict dictionary-view-objects18575147
Ref: 573118575147
Ref: c-api/dict c PyDictViewSet_Check18575212
Ref: 573218575212
Ref: c-api/dict c PyDictKeys_Type18575501
Ref: 533b18575501
Ref: c-api/dict c PyDictKeys_Check18575741
Ref: 573318575741
Ref: c-api/dict c PyDictValues_Type18575900
Ref: 534118575900
Ref: c-api/dict c PyDictValues_Check18576146
Ref: 573518576146
Ref: c-api/dict c PyDictItems_Type18576308
Ref: 533718576308
Ref: c-api/dict c PyDictItems_Check18576551
Ref: 573418576551
Node: Ordered Dictionaries18576711
Ref: c-api/dict ordered-dictionaries18576818
Ref: 573618576818
Ref: c-api/dict c PyODict_Type18577105
Ref: 573718577105
Ref: c-api/dict c PyODict_Check18577292
Ref: 573818577292
Ref: c-api/dict c PyODict_CheckExact18577508
Ref: 573918577508
Ref: c-api/dict c PyODictKeys_Type18577735
Ref: 573a18577735
Ref: c-api/dict c PyODictValues_Type18577866
Ref: 573b18577866
Ref: c-api/dict c PyODictItems_Type18578006
Ref: 573c18578006
Ref: c-api/dict c PyODict_New18578144
Ref: 573d18578144
Ref: c-api/dict c PyODict_SetItem18578327
Ref: 573e18578327
Ref: c-api/dict c PyODict_DelItem18578637
Ref: 573f18578637
Ref: c-api/dict c PyODict_GetItem18579318
Ref: 574018579318
Ref: c-api/dict c PyODict_GetItemWithError18579527
Ref: 574118579527
Ref: c-api/dict c PyODict_GetItemString18579733
Ref: 574218579733
Ref: c-api/dict c PyODict_Contains18579934
Ref: 574318579934
Ref: c-api/dict c PyODict_Size18580126
Ref: 574418580126
Ref: c-api/dict c PyODict_SIZE18580324
Ref: 574518580324
Node: Set オブジェクト18580434
Ref: c-api/set doc18580548
Ref: 574618580548
Ref: c-api/set set-objects18580548
Ref: 574718580548
Ref: c-api/set setobjects18580548
Ref: 574818580548
Ref: c-api/set translation-repo18580548
Ref: 574918580548
Ref: c-api/set c PySetObject18581385
Ref: 574a18581385
Ref: c-api/set c PySet_Type18582178
Ref: 543518582178
Ref: c-api/set c PyFrozenSet_Type18582394
Ref: 53b118582394
Ref: c-api/set c PySet_Check18582887
Ref: 574b18582887
Ref: c-api/set c PyFrozenSet_Check18583097
Ref: 574c18583097
Ref: c-api/set c PyAnySet_Check18583320
Ref: 574d18583320
Ref: c-api/set c PySet_CheckExact18583574
Ref: aa118583574
Ref: c-api/set c PyAnySet_CheckExact18583831
Ref: 574e18583831
Ref: c-api/set c PyFrozenSet_CheckExact18584130
Ref: 574f18584130
Ref: c-api/set c PySet_New18584370
Ref: 166218584370
Ref: c-api/set c PyFrozenSet_New18585247
Ref: 166318585247
Ref: c-api/set c PySet_Size18586199
Ref: 166718586199
Ref: c-api/set c PySet_GET_SIZE18586603
Ref: 575018586603
Ref: c-api/set c PySet_Contains18586815
Ref: 166618586815
Ref: c-api/set c PySet_Add18587651
Ref: 166418587651
Ref: c-api/set c PySet_Discard18588932
Ref: 166518588932
Ref: c-api/set c PySet_Pop18589825
Ref: 543418589825
Ref: c-api/set c PySet_Clear18590424
Ref: 543318590424
Node: Deprecated API<3>18591013
Ref: c-api/set deprecated-api18591089
Ref: 575118591089
Ref: c-api/set c PySet_MINSIZE18591136
Ref: 575218591136
Node: Function オブジェクト<2>18591711
Ref: c-api/concrete function-objects18591907
Ref: 575318591907
Ref: c-api/concrete otherobjects18591907
Ref: 575418591907
Node: Function オブジェクト<3>18592450
Ref: c-api/function doc18592628
Ref: 575518592628
Ref: c-api/function function-objects18592628
Ref: 575618592628
Ref: c-api/function id118592628
Ref: 575718592628
Ref: c-api/function c PyFunctionObject18592759
Ref: 78318592759
Ref: c-api/function c PyFunction_Type18592849
Ref: 575818592849
Ref: c-api/function c PyFunction_Check18593114
Ref: 575918593114
Ref: c-api/function c PyFunction_New18593382
Ref: 575a18593382
Ref: c-api/function c PyFunction_NewWithQualName18594201
Ref: 575b18594201
Ref: c-api/function c PyFunction_GetCode18594838
Ref: 575c18594838
Ref: c-api/function c PyFunction_GetGlobals18595052
Ref: 575d18595052
Ref: c-api/function c PyFunction_GetModule18595255
Ref: 575e18595255
Ref: c-api/function c PyFunction_GetDefaults18595644
Ref: 575f18595644
Ref: c-api/function c PyFunction_SetDefaults18595903
Ref: 576018595903
Ref: c-api/function c PyFunction_SetVectorcall18596266
Ref: 78218596266
Ref: c-api/function c PyFunction_GetKwDefaults18596592
Ref: 576118596592
Ref: c-api/function c PyFunction_SetKwDefaults18596857
Ref: 576218596857
Ref: c-api/function c PyFunction_GetClosure18597224
Ref: 576318597224
Ref: c-api/function c PyFunction_SetClosure18597483
Ref: 576418597483
Ref: c-api/function c PyFunction_GetAnnotations18597870
Ref: 1b9618597870
Ref: c-api/function c PyFunction_SetAnnotations18598141
Ref: 576518598141
Ref: c-api/function c PyFunction_GET_CODE18598506
Ref: 576618598506
Ref: c-api/function c PyFunction_GET_GLOBALS18598580
Ref: 576718598580
Ref: c-api/function c PyFunction_GET_MODULE18598667
Ref: 576818598667
Ref: c-api/function c PyFunction_GET_DEFAULTS18598743
Ref: 576918598743
Ref: c-api/function c PyFunction_GET_KW_DEFAULTS18598831
Ref: 576a18598831
Ref: c-api/function c PyFunction_GET_CLOSURE18598922
Ref: 576b18598922
Ref: c-api/function c PyFunction_GET_ANNOTATIONS18599009
Ref: 576c18599009
Ref: c-api/function c PyFunction_AddWatcher18599347
Ref: 576d18599347
Ref: c-api/function c PyFunction_ClearWatcher18599729
Ref: 576e18599729
Ref: c-api/function c PyFunction_WatchEvent18600098
Ref: 576f18600098
Ref: c-api/function c PyFunction_WatchCallback18600494
Ref: 577018600494
Node: インスタンスメソッドオブジェクト Instance Method Objects18602708
Ref: c-api/method doc18602928
Ref: 577118602928
Ref: c-api/method instance-method-objects18602928
Ref: 577218602928
Ref: c-api/method instancemethod-objects18602928
Ref: 577318602928
Ref: c-api/method translation-repo18602928
Ref: 577418602928
Ref: c-api/method c PyInstanceMethod_Type18603272
Ref: 577518603272
Ref: c-api/method c PyInstanceMethod_Check18603535
Ref: 577618603535
Ref: c-api/method c PyInstanceMethod_New18603838
Ref: 577718603838
Ref: c-api/method c PyInstanceMethod_Function18604219
Ref: 577818604219
Ref: c-api/method c PyInstanceMethod_GET_FUNCTION18604453
Ref: 577918604453
Node: メソッドオブジェクト<2>18604693
Ref: c-api/method id118604919
Ref: 577a18604919
Ref: c-api/method method-objects18604919
Ref: 577b18604919
Ref: c-api/method c PyMethod_Type18605291
Ref: 577c18605291
Ref: c-api/method c PyMethod_Check18605582
Ref: 577d18605582
Ref: c-api/method c PyMethod_New18605852
Ref: 577e18605852
Ref: c-api/method c PyMethod_Function18606340
Ref: 577f18606340
Ref: c-api/method c PyMethod_GET_FUNCTION18606548
Ref: 578018606548
Ref: c-api/method c PyMethod_Self18606774
Ref: 578118606774
Ref: c-api/method c PyMethod_GET_SELF18606966
Ref: 578218606966
Node: セルオブジェクト cell object18607174
Ref: c-api/cell doc18607358
Ref: 578318607358
Ref: c-api/cell cell-objects18607358
Ref: 91118607358
Ref: c-api/cell id118607358
Ref: 578418607358
Ref: c-api/cell translation-repo18607358
Ref: 578518607358
Ref: c-api/cell c PyCellObject18608042
Ref: 578618608042
Ref: c-api/cell c PyCell_Type18608151
Ref: 578718608151
Ref: c-api/cell c PyCell_Check18608279
Ref: 578818608279
Ref: c-api/cell c PyCell_New18608498
Ref: 578918608498
Ref: c-api/cell c PyCell_Get18608747
Ref: 578a18608747
Ref: c-api/cell c PyCell_GET18609002
Ref: 578b18609002
Ref: c-api/cell c PyCell_Set18609253
Ref: 578c18609253
Ref: c-api/cell c PyCell_SET18609626
Ref: aaf18609626
Node: コードオブジェクト<3>18610011
Ref: c-api/code doc18610179
Ref: 578d18610179
Ref: c-api/code code-objects18610179
Ref: 578e18610179
Ref: c-api/code codeobjects18610179
Ref: 7d218610179
Ref: c-api/code translation-repo18610179
Ref: 578f18610179
Ref: c-api/code c PyCodeObject18610456
Ref: 97f18610456
Ref: c-api/code c PyCode_Type18610656
Ref: 579018610656
Ref: c-api/code c PyCode_Check18610815
Ref: 579118610815
Ref: c-api/code c PyCode_GetNumFree18610957
Ref: 579218610957
Ref: c-api/code c PyUnstable_Code_GetFirstFree18611133
Ref: 62718611133
Ref: c-api/code c PyUnstable_Code_New18611763
Ref: 579318611763
Ref: c-api/code c PyCode_NewWithPosOnlyArgs18613264
Ref: 579418613264
Ref: c-api/code c PyUnstable_Code_NewWithPosOnlyArgs18613264
Ref: 579518613264
Ref: c-api/code c PyCode_NewEmpty18614556
Ref: 156c18614556
Ref: c-api/code c PyCode_Addr2Line18614903
Ref: a8d18614903
Ref: c-api/code c PyCode_Addr2Location18615307
Ref: 7d118615307
Ref: c-api/code c PyCode_GetCode18615788
Ref: 98018615788
Ref: c-api/code c PyCode_GetVarnames18616373
Ref: 98118616373
Ref: c-api/code c PyCode_GetCellvars18616738
Ref: 98218616738
Ref: c-api/code c PyCode_GetFreevars18617148
Ref: 98318617148
Ref: c-api/code c PyCode_AddWatcher18617534
Ref: 78718617534
Ref: c-api/code c PyCode_ClearWatcher18617896
Ref: 78818617896
Ref: c-api/code c PyCodeEvent18618256
Ref: 579618618256
Ref: c-api/code c PyCode_WatchCallback18618448
Ref: 579718618448
Ref: c-api/code c PyCode_Optimize18620239
Ref: 579818620239
Ref: コードオブジェクト<3>-Footnote-118620656
Node: Code Object Flags18620738
Ref: c-api/code c-codeobject-flags18620887
Ref: 556518620887
Ref: c-api/code code-object-flags18620887
Ref: 579918620887
Ref: c-api/code c CO_OPTIMIZED18621941
Ref: 579a18621941
Ref: c-api/code c CO_NEWLOCALS18622146
Ref: 579b18622146
Ref: c-api/code c CO_VARARGS18622349
Ref: 579c18622349
Ref: c-api/code c CO_VARKEYWORDS18622556
Ref: 579d18622556
Ref: c-api/code c CO_NESTED18622758
Ref: 579e18622758
Ref: c-api/code c CO_GENERATOR18622963
Ref: 579f18622963
Ref: c-api/code c CO_COROUTINE18623168
Ref: 57a018623168
Ref: c-api/code c CO_ITERABLE_COROUTINE18623382
Ref: 57a118623382
Ref: c-api/code c CO_ASYNC_GENERATOR18623593
Ref: 57a218623593
Ref: c-api/code c CO_HAS_DOCSTRING18623802
Ref: 57a318623802
Ref: c-api/code c CO_METHOD18624004
Ref: 57a418624004
Ref: c-api/code c CO_FUTURE_DIVISION18624215
Ref: 57a518624215
Ref: c-api/code c CO_FUTURE_ABSOLUTE_IMPORT18624438
Ref: 57a618624438
Ref: c-api/code c CO_FUTURE_WITH_STATEMENT18624660
Ref: 57a718624660
Ref: c-api/code c CO_FUTURE_PRINT_FUNCTION18624882
Ref: 57a818624882
Ref: c-api/code c CO_FUTURE_UNICODE_LITERALS18625106
Ref: 57a918625106
Ref: c-api/code c CO_FUTURE_GENERATOR_STOP18625328
Ref: 57aa18625328
Ref: c-api/code c CO_FUTURE_ANNOTATIONS18625547
Ref: 556418625547
Node: Extra information18625658
Ref: c-api/code extra-information18625768
Ref: 57ab18625768
Ref: c-api/code c _PyEval_RequestCodeExtraIndex18626141
Ref: 57ac18626141
Ref: c-api/code c PyUnstable_Eval_RequestCodeExtraIndex18626141
Ref: 17e118626141
Ref: c-api/code c _PyCode_GetExtra18627233
Ref: 57ad18627233
Ref: c-api/code c PyUnstable_Code_GetExtra18627233
Ref: 17e018627233
Ref: c-api/code c _PyCode_SetExtra18628065
Ref: 57ae18628065
Ref: c-api/code c PyUnstable_Code_SetExtra18628065
Ref: 17df18628065
Node: その他のオブジェクト<2>18628780
Ref: c-api/concrete other-objects18628975
Ref: 57af18628975
Node: File objects18630025
Ref: c-api/file doc18630163
Ref: 57b018630163
Ref: c-api/file file-objects18630163
Ref: 57b118630163
Ref: c-api/file fileobjects18630163
Ref: 57b218630163
Ref: c-api/file c PyFile_FromFd18631008
Ref: 53a918631008
Ref: c-api/file c PyObject_AsFileDescriptor18632302
Ref: 540d18632302
Ref: c-api/file c PyFile_GetLine18632903
Ref: 53aa18632903
Ref: c-api/file c PyFile_SetOpenCodeHook18633968
Ref: 1afb18633968
Ref: c-api/file c Py_OpenCodeHookFunction18634267
Ref: 57b318634267
Ref: c-api/file c PyFile_OpenCodeObject18635823
Ref: 57b418635823
Ref: c-api/file c PyFile_OpenCode18636424
Ref: 57b518636424
Ref: c-api/file c PyFile_WriteObject18636629
Ref: 53ab18636629
Ref: c-api/file c PyFile_WriteString18637147
Ref: 53ac18637147
Node: Soft-deprecated API18637513
Ref: c-api/file soft-deprecated-api18637581
Ref: 57b618637581
Ref: c-api/file c PyFile_NewStdPrinter18637836
Ref: 57b718637836
Ref: c-api/file c PyStdPrinter_Type18638020
Ref: 57b818638020
Node: モジュールオブジェクト module object18638290
Ref: c-api/module doc18638455
Ref: 57b918638455
Ref: c-api/module module-objects18638455
Ref: 57ba18638455
Ref: c-api/module moduleobjects18638455
Ref: 57bb18638455
Ref: c-api/module translation-repo18638455
Ref: 57bc18638455
Ref: c-api/module c PyModule_Type18638561
Ref: 53e918638561
Ref: c-api/module c PyModule_Check18638828
Ref: 57bd18638828
Ref: c-api/module c PyModule_CheckExact18639064
Ref: 57be18639064
Ref: c-api/module c PyModule_NewObject18639309
Ref: 53e718639309
Ref: c-api/module c PyModule_New18640058
Ref: 53e618640058
Ref: c-api/module c PyModule_GetDict18640381
Ref: 53e318640381
Ref: c-api/module c PyModule_GetNameObject18641287
Ref: 53e518641287
Ref: c-api/module c PyModule_GetName18641712
Ref: 53e418641712
Ref: c-api/module c PyModule_GetState18642153
Ref: b7b18642153
Ref: c-api/module c PyModule_GetDef18642443
Ref: 53e218642443
Ref: c-api/module c PyModule_GetFilenameObject18642974
Ref: 42c18642974
Ref: c-api/module c PyModule_GetFilename18643463
Ref: 42b18643463
Node: Module definitions18644168
Ref: c-api/module module-definitions18644359
Ref: 57bf18644359
Ref: c-api/module pymoduledef18644359
Ref: 57c018644359
Ref: c-api/module c PyModuleDef18645196
Ref: b7818645196
Ref: c-api/module c PyModuleDef m_base18645646
Ref: 57c218645646
Ref: c-api/module c PyModuleDef m_name18645775
Ref: 57c318645775
Ref: c-api/module c PyModuleDef m_doc18645862
Ref: 57c418645862
Ref: c-api/module c PyModuleDef m_size18646036
Ref: b7a18646036
Ref: c-api/module c PyModuleDef m_methods18647116
Ref: 57c518647116
Ref: c-api/module c PyModuleDef m_slots18647357
Ref: 559918647357
Ref: c-api/module c PyModuleDef m_slots m_reload18647838
Ref: 57c618647838
Ref: c-api/module c PyModuleDef m_traverse18647910
Ref: b7518647910
Ref: c-api/module c PyModuleDef m_clear18648664
Ref: b7618648664
Ref: c-api/module c PyModuleDef m_free18649748
Ref: b7718649748
Ref: c-api/module c PyModuleDef_Type18650484
Ref: 53df18650484
Ref: Module definitions-Footnote-118650730
Node: Module slots18650772
Ref: c-api/module module-slots18650839
Ref: 57c818650839
Ref: c-api/module c PyModuleDef_Slot18650882
Ref: 53de18650882
Ref: c-api/module c PyModuleDef_Slot slot18651049
Ref: 57c918651049
Ref: c-api/module c PyModuleDef_Slot value18651163
Ref: 57ca18651163
Ref: c-api/module c Py_mod_create18651334
Ref: 54d618651334
Ref: c-api/module c Py_mod_create create_module18651614
Ref: 57cb18651614
Ref: c-api/module c Py_mod_exec18653280
Ref: b7918653280
Ref: c-api/module c Py_mod_exec exec_module18653639
Ref: 57cc18653639
Ref: c-api/module c Py_mod_multiple_interpreters18653855
Ref: 54d718653855
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED18654031
Ref: 522818654031
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED18654174
Ref: 57cd18654174
Ref: c-api/module c Py_MOD_PER_INTERPRETER_GIL_SUPPORTED18654433
Ref: 57ce18654433
Ref: c-api/module c Py_mod_gil18655055
Ref: 48218655055
Ref: c-api/module c Py_MOD_GIL_USED18655213
Ref: 57cf18655213
Ref: c-api/module c Py_MOD_GIL_NOT_USED18655412
Ref: 57d018655412
Ref: Module slots-Footnote-118656060
Node: Creating extension modules dynamically18656102
Ref: c-api/module creating-extension-modules-dynamically18656264
Ref: 57d118656264
Ref: c-api/module moduledef-dynamic18656264
Ref: 57c118656264
Ref: c-api/module c PyModule_Create18656542
Ref: 559b18656542
Ref: c-api/module c PyModule_Create218656933
Ref: 53e118656933
Ref: c-api/module c PyModule_FromDefAndSpec18657895
Ref: 10b718657895
Ref: c-api/module c PyModule_FromDefAndSpec218658281
Ref: 10b818658281
Ref: c-api/module c PyModule_ExecDef18659480
Ref: 10b918659480
Ref: c-api/module c PYTHON_API_VERSION18659776
Ref: 4cb218659776
Ref: c-api/module c PYTHON_ABI_VERSION18660020
Ref: 57d218660020
Node: サポート関数18660255
Ref: c-api/module support-functions18660448
Ref: 57d318660448
Ref: c-api/module c PyModule_AddObjectRef18660768
Ref: 60a18660768
Ref: c-api/module c PyModule_Add18662858
Ref: 60918662858
Ref: c-api/module c PyModule_AddObject18663449
Ref: 60b18663449
Ref: c-api/module c PyModule_AddIntConstant18664842
Ref: 175a18664842
Ref: c-api/module c PyModule_AddStringConstant18665379
Ref: 175b18665379
Ref: c-api/module c PyModule_AddIntMacro18665991
Ref: 161118665991
Ref: c-api/module c PyModule_AddStringMacro18666355
Ref: 161018666355
Ref: c-api/module c PyModule_AddType18666472
Ref: b7018666472
Ref: c-api/module c PyModule_AddFunctions18666971
Ref: 53e018666971
Ref: c-api/module c PyModule_SetDocString18668072
Ref: 53e818668072
Ref: c-api/module c PyUnstable_Module_SetGIL18668622
Ref: 49d18668622
Node: Module lookup single-phase initialization18669686
Ref: c-api/module module-lookup-single-phase-initialization18669782
Ref: 57d418669782
Ref: c-api/module c PyState_FindModule18670364
Ref: 543a18670364
Ref: c-api/module c PyState_AddModule18671066
Ref: 543918671066
Ref: c-api/module c PyState_RemoveModule18672418
Ref: 543b18672418
Node: イテレータオブジェクト iterator object18672806
Ref: c-api/iterator doc18673015
Ref: 57d518673015
Ref: c-api/iterator id118673015
Ref: 57d618673015
Ref: c-api/iterator iterator-objects18673015
Ref: 57d718673015
Ref: c-api/iterator translation-repo18673015
Ref: 57d818673015
Ref: c-api/iterator c PySeqIter_Type18673626
Ref: 542418673626
Ref: c-api/iterator c PySeqIter_Check18673991
Ref: 57d918673991
Ref: c-api/iterator c PySeqIter_New18674168
Ref: 542318674168
Ref: c-api/iterator c PyCallIter_Type18674561
Ref: 531618674561
Ref: c-api/iterator c PyCallIter_Check18674848
Ref: 57da18674848
Ref: c-api/iterator c PyCallIter_New18675034
Ref: 531518675034
Node: Range Objects18675774
Ref: c-api/iterator range-objects18675904
Ref: 57db18675904
Ref: c-api/iterator c PyRange_Type18675951
Ref: 542118675951
Ref: c-api/iterator c PyRange_Check18676108
Ref: 57dc18676108
Node: Builtin Iterator Types18676277
Ref: c-api/iterator builtin-iterator-types18676438
Ref: 57dd18676438
Ref: c-api/iterator c PyEnum_Type18676990
Ref: 534f18676990
Ref: c-api/iterator c PyFilter_Type18677135
Ref: 53ad18677135
Ref: c-api/iterator c PyMap_Type18677271
Ref: 53d518677271
Ref: c-api/iterator c PyReversed_Type18677412
Ref: 542218677412
Ref: c-api/iterator c PyZip_Type18677548
Ref: 54a518677548
Node: Other Iterator Objects18677635
Ref: c-api/iterator other-iterator-objects18677774
Ref: 57de18677774
Ref: c-api/iterator c PyByteArrayIter_Type18677839
Ref: 52fd18677839
Ref: c-api/iterator c PyBytesIter_Type18677951
Ref: 530318677951
Ref: c-api/iterator c PyListIter_Type18678059
Ref: 53c218678059
Ref: c-api/iterator c PyListRevIter_Type18678166
Ref: 53c318678166
Ref: c-api/iterator c PySetIter_Type18678276
Ref: 543218678276
Ref: c-api/iterator c PyTupleIter_Type18678382
Ref: 545a18678382
Ref: c-api/iterator c PyRangeIter_Type18678490
Ref: 542018678490
Ref: c-api/iterator c PyLongRangeIter_Type18678598
Ref: 53ca18678598
Ref: c-api/iterator c PyDictIterKey_Type18678710
Ref: 533918678710
Ref: c-api/iterator c PyDictRevIterKey_Type18678820
Ref: 533f18678820
Ref: c-api/iterator c PyDictIterValue_Type18678963
Ref: 533a18678963
Ref: c-api/iterator c PyDictRevIterValue_Type18679075
Ref: 534018679075
Ref: c-api/iterator c PyDictIterItem_Type18679220
Ref: 533818679220
Ref: c-api/iterator c PyDictRevIterItem_Type18679331
Ref: 533e18679331
Ref: c-api/iterator c PyODictIter_Type18679475
Ref: 57df18679475
Node: デスクリプタオブジェクト descriptor object18680013
Ref: c-api/descriptor doc18680247
Ref: 57e018680247
Ref: c-api/descriptor descriptor-objects18680247
Ref: 57e118680247
Ref: c-api/descriptor id118680247
Ref: 57e218680247
Ref: c-api/descriptor translation-repo18680247
Ref: 57e318680247
Ref: c-api/descriptor c PyProperty_Type18680601
Ref: 541f18680601
Ref: c-api/descriptor c PyDescr_NewGetSet18680765
Ref: 533518680765
Ref: c-api/descriptor c PyDescr_NewMember18680964
Ref: 533618680964
Ref: c-api/descriptor c PyMemberDescr_Type18681161
Ref: 53d918681161
Ref: c-api/descriptor c PyGetSetDescr_Type18681535
Ref: 53b418681535
Ref: c-api/descriptor c PyDescr_NewMethod18681908
Ref: 1dd318681908
Ref: c-api/descriptor c PyMethodDescr_Type18682105
Ref: 53dd18682105
Ref: c-api/descriptor c PyDescr_NewWrapper18682469
Ref: 57e418682469
Ref: c-api/descriptor c PyWrapperDescr_Type18682640
Ref: 54a318682640
Ref: c-api/descriptor c PyDescr_NewClassMethod18683078
Ref: 533418683078
Ref: c-api/descriptor c PyDescr_IsData18683275
Ref: 1d0e18683275
Ref: c-api/descriptor c PyWrapper_New18683526
Ref: 54a418683526
Node: Built-in descriptors18683720
Ref: c-api/descriptor built-in-descriptors18683831
Ref: 57e518683831
Ref: c-api/descriptor c PySuper_Type18683892
Ref: 544018683892
Ref: c-api/descriptor c PyClassMethod_Type18684109
Ref: 57e618684109
Ref: c-api/descriptor c PyClassMethodDescr_Type18684286
Ref: 532218684286
Ref: c-api/descriptor c PyClassMethod_New18684649
Ref: 57e718684649
Ref: c-api/descriptor c PyStaticMethod_Type18685063
Ref: 57e818685063
Ref: c-api/descriptor c PyStaticMethod_New18685243
Ref: 57e918685243
Node: スライスオブジェクト slice object18685660
Ref: c-api/slice doc18685874
Ref: 57ea18685874
Ref: c-api/slice id118685874
Ref: 57eb18685874
Ref: c-api/slice slice-objects18685874
Ref: 57ec18685874
Ref: c-api/slice translation-repo18685874
Ref: 57ed18685874
Ref: c-api/slice c PySlice_Type18685975
Ref: 543818685975
Ref: c-api/slice c PySlice_Check18686250
Ref: 57ee18686250
Ref: c-api/slice c PySlice_New18686476
Ref: 543718686476
Ref: c-api/slice c PySlice_GetIndices18687067
Ref: 543618687067
Ref: c-api/slice c PySlice_GetIndicesEx18687998
Ref: 42f18687998
Ref: c-api/slice c PySlice_Unpack18690071
Ref: 43018690071
Ref: c-api/slice c PySlice_AdjustIndices18690754
Ref: 43118690754
Node: Ellipsis オブジェクト<2>18691360
Ref: c-api/slice ellipsis-object18691470
Ref: 57ef18691470
Ref: c-api/slice c PyEllipsis_Type18691539
Ref: 534e18691539
Ref: c-api/slice c Py_Ellipsis18691768
Ref: 57f018691768
Ref: c-api/memoryview memoryview-objects18692147
Ref: 563d18692147
Node: memoryview オブジェクト18692147
Ref: c-api/memoryview doc18692328
Ref: 57f118692328
Ref: c-api/memoryview id118692328
Ref: 57f218692328
Ref: c-api/memoryview translation-repo18692328
Ref: 57f318692328
Ref: c-api/memoryview c PyMemoryView_Type18692626
Ref: 53dc18692626
Ref: c-api/memoryview c PyMemoryView_FromObject18692899
Ref: 53da18692899
Ref: c-api/memoryview c PyBUF_READ18693532
Ref: 1a6d18693532
Ref: c-api/memoryview c PyBUF_WRITE18693686
Ref: 1a6e18693686
Ref: c-api/memoryview c PyMemoryView_FromMemory18693841
Ref: 138c18693841
Ref: c-api/memoryview c PyMemoryView_FromBuffer18694302
Ref: 96918694302
Ref: c-api/memoryview c PyMemoryView_GetContiguous18694769
Ref: 53db18694769
Ref: c-api/memoryview c PyMemoryView_Check18695562
Ref: 57f418695562
Ref: c-api/memoryview c PyMemoryView_GET_BUFFER18695854
Ref: 57f518695854
Ref: c-api/memoryview c PyMemoryView_GET_BASE18696329
Ref: 57f618696329
Ref: c-api/picklebuffer picklebuffer-objects18696715
Ref: 57f718696715
Node: Pickle buffer objects18696715
Ref: c-api/picklebuffer doc18696883
Ref: 57f818696883
Ref: c-api/picklebuffer pickle-buffer-objects18696883
Ref: 57f918696883
Ref: c-api/picklebuffer translation-repo18696883
Ref: 57fa18696883
Ref: c-api/picklebuffer c PyPickleBuffer_Type18697121
Ref: 57fb18697121
Ref: c-api/picklebuffer c PyPickleBuffer_Check18697363
Ref: 57fc18697363
Ref: c-api/picklebuffer c PyPickleBuffer_FromObject18697513
Ref: 57fd18697513
Ref: c-api/picklebuffer c PyPickleBuffer_GetBuffer18697949
Ref: 57fe18697949
Ref: c-api/picklebuffer c PyPickleBuffer_Release18698512
Ref: 57ff18698512
Node: 弱参照オブジェクト<2>18698817
Ref: c-api/weakref doc18698971
Ref: 580018698971
Ref: c-api/weakref translation-repo18698971
Ref: 580118698971
Ref: c-api/weakref weak-reference-objects18698971
Ref: 580218698971
Ref: c-api/weakref weakrefobjects18698971
Ref: 561318698971
Ref: c-api/weakref c PyWeakref_Check18699417
Ref: 580318699417
Ref: c-api/weakref c PyWeakref_CheckRef18699575
Ref: 580418699575
Ref: c-api/weakref c PyWeakref_CheckRefExact18699757
Ref: 580518699757
Ref: c-api/weakref c PyWeakref_CheckProxy18699950
Ref: 580618699950
Ref: c-api/weakref c PyWeakref_NewRef18700094
Ref: 1c4318700094
Ref: c-api/weakref c PyWeakref_NewProxy18700991
Ref: 54a218700991
Ref: c-api/weakref c PyWeakref_GetRef18701882
Ref: 3dd18701882
Ref: c-api/weakref c PyWeakref_GetObject18702433
Ref: 3db18702433
Ref: c-api/weakref c PyWeakref_GET_OBJECT18703189
Ref: 3dc18703189
Ref: c-api/weakref c PyWeakref_IsDead18703507
Ref: 194118703507
Ref: c-api/weakref c PyObject_ClearWeakRefs18703770
Ref: 79618703770
Ref: c-api/weakref c PyUnstable_Object_ClearWeakRefsNoCallbacks18704161
Ref: 19f418704161
Node: カプセル<2>18705139
Ref: c-api/capsule doc18705312
Ref: 580718705312
Ref: c-api/capsule capsules18705312
Ref: 2a6918705312
Ref: c-api/capsule id118705312
Ref: 580818705312
Ref: c-api/capsule translation-repo18705312
Ref: 580918705312
Ref: c-api/capsule c PyCapsule18705547
Ref: 148e18705547
Ref: c-api/capsule c PyCapsule_Type18706003
Ref: 532118706003
Ref: c-api/capsule c PyCapsule_Destructor18706250
Ref: 531818706250
Ref: c-api/capsule c PyCapsule_CheckExact18706655
Ref: 580a18706655
Ref: c-api/capsule c PyCapsule_New18706867
Ref: 524818706867
Ref: c-api/capsule c PyCapsule_GetPointer18708122
Ref: 531c18708122
Ref: c-api/capsule c PyCapsule_GetDestructor18708787
Ref: 531a18708787
Ref: c-api/capsule c PyCapsule_GetContext18709526
Ref: 531918709526
Ref: c-api/capsule c PyCapsule_GetName18710233
Ref: 531b18710233
Ref: c-api/capsule c PyCapsule_Import18710910
Ref: 1c6d18710910
Ref: c-api/capsule c PyCapsule_IsValid18712088
Ref: 157818712088
Ref: c-api/capsule c PyCapsule_SetContext18713119
Ref: 531d18713119
Ref: c-api/capsule c PyCapsule_SetDestructor18713560
Ref: 531e18713560
Ref: c-api/capsule c PyCapsule_SetName18714007
Ref: 531f18714007
Ref: c-api/capsule c PyCapsule_SetPointer18714679
Ref: 532018714679
Node: フレーム frame オブジェクト<2>18715160
Ref: c-api/frame doc18715339
Ref: 580b18715339
Ref: c-api/frame frame-objects18715339
Ref: 580c18715339
Ref: c-api/frame translation-repo18715339
Ref: 580d18715339
Ref: c-api/frame c PyFrameObject18715428
Ref: 99018715428
Ref: c-api/frame c PyFrame_Type18716066
Ref: 98e18716066
Ref: c-api/frame c PyFrame_New18716356
Ref: 1b4e18716356
Ref: c-api/frame c PyFrame_Check18716704
Ref: 98c18716704
Ref: c-api/frame c PyFrame_GetBack18716933
Ref: 98d18716933
Ref: c-api/frame c PyFrame_GetBuiltins18717248
Ref: 97318717248
Ref: c-api/frame c PyFrame_GetCode18717542
Ref: 99118717542
Ref: c-api/frame c PyFrame_GetGenerator18717901
Ref: 97418717901
Ref: c-api/frame c PyFrame_GetGlobals18718333
Ref: 97518718333
Ref: c-api/frame c PyFrame_GetLasti18718625
Ref: 97618718625
Ref: c-api/frame c PyFrame_GetVar18718825
Ref: 78918718825
Ref: c-api/frame c PyFrame_GetVarString18719333
Ref: 78a18719333
Ref: c-api/frame c PyFrame_GetLocals18719610
Ref: 66118719610
Ref: c-api/frame c PyFrame_GetLineNumber18720322
Ref: 99218720322
Ref: フレーム frame オブジェクト<2>-Footnote-118720661
Node: Frame locals proxies18720703
Ref: c-api/frame frame-locals-proxies18720835
Ref: 580f18720835
Ref: c-api/frame c PyFrameLocalsProxy_Type18721295
Ref: 580e18721295
Ref: c-api/frame c PyFrameLocalsProxy_Check18721419
Ref: 581018721419
Ref: Frame locals proxies-Footnote-118721588
Node: Legacy local variable APIs18721630
Ref: c-api/frame legacy-local-variable-apis18721786
Ref: 581118721786
Ref: c-api/frame c PyFrame_LocalsToFast18721988
Ref: 581218721988
Ref: c-api/frame c PyFrame_FastToLocals18722487
Ref: 581318722487
Ref: c-api/frame c PyFrame_FastToLocalsWithError18722903
Ref: 581418722903
Ref: Legacy local variable APIs-Footnote-118723313
Node: Internal frames18723355
Ref: c-api/frame internal-frames18723482
Ref: 581518723482
Ref: c-api/frame c _PyInterpreterFrame18723583
Ref: 19ce18723583
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetCode18723709
Ref: 581618723709
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLasti18724200
Ref: 581718724200
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLine18724646
Ref: 581818724646
Ref: Internal frames-Footnote-118725151
Node: ジェネレータオブジェクト18725193
Ref: c-api/gen doc18725393
Ref: 581918725393
Ref: c-api/gen gen-objects18725393
Ref: 581a18725393
Ref: c-api/gen generator-objects18725393
Ref: 581b18725393
Ref: c-api/gen translation-repo18725393
Ref: 581c18725393
Ref: c-api/gen c PyGenObject18725863
Ref: 581f18725863
Ref: c-api/gen c PyGen_Type18725989
Ref: 582018725989
Ref: c-api/gen c PyGen_Check18726128
Ref: 582118726128
Ref: c-api/gen c PyGen_CheckExact18726356
Ref: 582218726356
Ref: c-api/gen c PyGen_New18726581
Ref: 581d18726581
Ref: c-api/gen c PyGen_NewWithQualName18726930
Ref: 581e18726930
Ref: c-api/gen c PyGen_GetCode18727421
Ref: 582318727421
Node: Asynchronous Generator Objects18727702
Ref: c-api/gen asynchronous-generator-objects18727831
Ref: 582418727831
Ref: c-api/gen c PyAsyncGen_Type18727937
Ref: 582518727937
Ref: c-api/gen c PyAsyncGen_New18728182
Ref: 582618728182
Ref: c-api/gen c PyAsyncGen_CheckExact18728725
Ref: 582718728725
Ref: Asynchronous Generator Objects-Footnote-118728965
Node: Deprecated API<4>18729007
Ref: c-api/gen deprecated-api18729136
Ref: 582818729136
Ref: c-api/gen c PyAsyncGenASend_CheckExact18729185
Ref: 582918729185
Node: コルーチンオブジェクト<2>18729402
Ref: c-api/coro doc18729604
Ref: 582a18729604
Ref: c-api/coro coro-objects18729604
Ref: 10d418729604
Ref: c-api/coro coroutine-objects18729604
Ref: 582b18729604
Ref: c-api/coro translation-repo18729604
Ref: 582c18729604
Ref: c-api/coro c PyCoroObject18729836
Ref: 582d18729836
Ref: c-api/coro c PyCoro_Type18729945
Ref: 582e18729945
Ref: c-api/coro c PyCoro_CheckExact18730076
Ref: 582f18730076
Ref: c-api/coro c PyCoro_New18730304
Ref: 583018730304
Node: コンテキスト変数オブジェクト18730784
Ref: c-api/contextvars doc18730992
Ref: 583118730992
Ref: c-api/contextvars context-variables-objects18730992
Ref: 583218730992
Ref: c-api/contextvars contextvarsobjects18730992
Ref: cf418730992
Ref: c-api/contextvars translation-repo18730992
Ref: 583318730992
Ref: c-api/contextvars contextvarsobjects-pointertype-change18731083
Ref: e2318731083
Ref: c-api/contextvars c PyContext18731745
Ref: 583418731745
Ref: c-api/contextvars c PyContextVar18731886
Ref: 583518731886
Ref: c-api/contextvars c PyContextToken18732033
Ref: 583618732033
Ref: c-api/contextvars c PyContext_Type18732177
Ref: 583718732177
Ref: c-api/contextvars c PyContextVar_Type18732302
Ref: 583818732302
Ref: c-api/contextvars c PyContextToken_Type18732436
Ref: 583918732436
Ref: c-api/contextvars c PyContext_CheckExact18732611
Ref: 583a18732611
Ref: c-api/contextvars c PyContextVar_CheckExact18732842
Ref: 583b18732842
Ref: c-api/contextvars c PyContextToken_CheckExact18733079
Ref: 583c18733079
Ref: c-api/contextvars c PyContext_New18733380
Ref: 583d18733380
Ref: c-api/contextvars c PyContext_Copy18733618
Ref: 583e18733618
Ref: c-api/contextvars c PyContext_CopyCurrent18733888
Ref: 583f18733888
Ref: c-api/contextvars c PyContext_Enter18734146
Ref: 584018734146
Ref: c-api/contextvars c PyContext_Exit18734367
Ref: 584118734367
Ref: c-api/contextvars c PyContext_AddWatcher18734658
Ref: 19f118734658
Ref: c-api/contextvars c PyContext_ClearWatcher18735043
Ref: 19f218735043
Ref: c-api/contextvars c PyContextEvent18735410
Ref: 584218735410
Ref: c-api/contextvars c PyContext_WatchCallback18735816
Ref: 584318735816
Ref: c-api/contextvars c PyContextVar_New18736752
Ref: 584418736752
Ref: c-api/contextvars c PyContextVar_Get18737254
Ref: 584518737254
Ref: c-api/contextvars c PyContextVar_Set18738091
Ref: 584618738091
Ref: c-api/contextvars c PyContextVar_Reset18738453
Ref: 584718738453
Ref: コンテキスト変数オブジェクト-Footnote-118738826
Node: 型ヒントのためのオブジェクト18738891
Ref: c-api/typehints doc18739054
Ref: 584818739054
Ref: c-api/typehints objects-for-type-hinting18739054
Ref: 584918739054
Ref: c-api/typehints translation-repo18739054
Ref: 584a18739054
Ref: c-api/typehints typehintobjects18739054
Ref: 584b18739054
Ref: c-api/typehints c Py_GenericAlias18739319
Ref: 54b018739319
Ref: c-api/typehints c Py_GenericAliasType18740929
Ref: 54b118740929
Node: C API for extension modules18741255
Ref: c-api/concrete c-api-for-extension-modules18741411
Ref: 584c18741411
Node: Curses C API18741623
Ref: c-api/curses doc18741721
Ref: 584d18741721
Ref: c-api/curses curses-c-api18741721
Ref: 584e18741721
Ref: c-api/curses c import_curses18742206
Ref: 584f18742206
Ref: c-api/curses c PyCurses_API18742685
Ref: 585018742685
Ref: c-api/curses c PyCurses_API_pointers18743642
Ref: 585518743642
Ref: c-api/curses c PyCursesWindow_Type18743825
Ref: 585118743825
Ref: c-api/curses c PyCursesWindow_Check18743966
Ref: 585618743966
Ref: c-api/curses c PyCursesSetupTermCalled18744298
Ref: 585218744298
Ref: c-api/curses c PyCursesInitialised18744712
Ref: 585318744712
Ref: c-api/curses c PyCursesInitialisedColor18745116
Ref: 585418745116
Node: Internal data18745542
Ref: c-api/curses internal-data18745679
Ref: 585718745679
Ref: c-api/curses c PyCurses_CAPSULE_NAME18745812
Ref: 585818745812
Node: DateTime オブジェクト<2>18746004
Ref: c-api/datetime doc18746145
Ref: 585918746145
Ref: c-api/datetime datetime-objects18746145
Ref: 585a18746145
Ref: c-api/datetime datetimeobjects18746145
Ref: 55f118746145
Ref: c-api/datetime translation-repo18746145
Ref: 585b18746145
Ref: c-api/datetime c PyDateTime_IMPORT18746821
Ref: 585c18746821
Ref: c-api/datetime c PyDateTime_CAPI18747274
Ref: 585e18747274
Ref: c-api/datetime c PyDateTimeAPI18747523
Ref: 585d18747523
Ref: c-api/datetime c PyDateTime_Date18747737
Ref: 585f18747737
Ref: c-api/datetime c PyDateTime_DateTime18747898
Ref: 586018747898
Ref: c-api/datetime c PyDateTime_Time18748066
Ref: 586118748066
Ref: c-api/datetime c PyDateTime_Delta18748229
Ref: 586218748229
Ref: c-api/datetime c PyDateTime_DateType18748389
Ref: 586318748389
Ref: c-api/datetime c PyDateTime_DateTimeType18748652
Ref: 586418748652
Ref: c-api/datetime c PyDateTime_TimeType18748930
Ref: 586518748930
Ref: c-api/datetime c PyDateTime_DeltaType18749193
Ref: 586618749193
Ref: c-api/datetime c PyDateTime_TZInfoType18749464
Ref: 586718749464
Ref: c-api/datetime c PyDateTime_TimeZone_UTC18749812
Ref: dc018749812
Ref: c-api/datetime c PyDate_Check18750092
Ref: 586818750092
Ref: c-api/datetime c PyDate_CheckExact18750401
Ref: 586918750401
Ref: c-api/datetime c PyDateTime_Check18750636
Ref: 586a18750636
Ref: c-api/datetime c PyDateTime_CheckExact18750963
Ref: 586b18750963
Ref: c-api/datetime c PyTime_Check18751206
Ref: 586c18751206
Ref: c-api/datetime c PyTime_CheckExact18751515
Ref: 586d18751515
Ref: c-api/datetime c PyDelta_Check18751750
Ref: 586e18751750
Ref: c-api/datetime c PyDelta_CheckExact18752068
Ref: 586f18752068
Ref: c-api/datetime c PyTZInfo_Check18752305
Ref: 587018752305
Ref: c-api/datetime c PyTZInfo_CheckExact18752626
Ref: 587118752626
Ref: c-api/datetime c PyDate_FromDate18752934
Ref: 587218752934
Ref: c-api/datetime c PyDateTime_FromDateAndTime18753167
Ref: 587318753167
Ref: c-api/datetime c PyDateTime_FromDateAndTimeAndFold18753508
Ref: 587418753508
Ref: c-api/datetime c PyTime_FromTime18753906
Ref: 587518753906
Ref: c-api/datetime c PyTime_FromTimeAndFold18754177
Ref: 587618754177
Ref: c-api/datetime c PyDelta_FromDSU18754501
Ref: 587718754501
Ref: c-api/datetime c PyTimeZone_FromOffset18754915
Ref: dbe18754915
Ref: c-api/datetime c PyTimeZone_FromOffsetAndName18755230
Ref: dbf18755230
Ref: c-api/datetime c PyDateTime_GET_YEAR18755948
Ref: 587818755948
Ref: c-api/datetime c PyDateTime_GET_MONTH18756054
Ref: 587918756054
Ref: c-api/datetime c PyDateTime_GET_DAY18756177
Ref: 587a18756177
Ref: c-api/datetime c PyDateTime_DATE_GET_HOUR18756621
Ref: 587b18756621
Ref: c-api/datetime c PyDateTime_DATE_GET_MINUTE18756752
Ref: 587c18756752
Ref: c-api/datetime c PyDateTime_DATE_GET_SECOND18756885
Ref: 587d18756885
Ref: c-api/datetime c PyDateTime_DATE_GET_MICROSECOND18757018
Ref: 587e18757018
Ref: c-api/datetime c PyDateTime_DATE_GET_FOLD18757182
Ref: 587f18757182
Ref: c-api/datetime c PyDateTime_DATE_GET_TZINFO18757419
Ref: a9918757419
Ref: c-api/datetime c PyDateTime_TIME_GET_HOUR18757916
Ref: 588018757916
Ref: c-api/datetime c PyDateTime_TIME_GET_MINUTE18758043
Ref: 588118758043
Ref: c-api/datetime c PyDateTime_TIME_GET_SECOND18758172
Ref: 588218758172
Ref: c-api/datetime c PyDateTime_TIME_GET_MICROSECOND18758301
Ref: 588318758301
Ref: c-api/datetime c PyDateTime_TIME_GET_FOLD18758451
Ref: 588418758451
Ref: c-api/datetime c PyDateTime_TIME_GET_TZINFO18758684
Ref: a9a18758684
Ref: c-api/datetime c PyDateTime_DELTA_GET_DAYS18759178
Ref: 588518759178
Ref: c-api/datetime c PyDateTime_DELTA_GET_SECONDS18759354
Ref: 588618759354
Ref: c-api/datetime c PyDateTime_DELTA_GET_MICROSECONDS18759520
Ref: 588718759520
Ref: c-api/datetime c PyDateTime_FromTimestamp18759782
Ref: 588818759782
Ref: c-api/datetime c PyDate_FromTimestamp18760076
Ref: 1e4e18760076
Node: Internal data<2>18760358
Ref: c-api/datetime internal-data18760477
Ref: 588918760477
Ref: c-api/datetime c PyDateTime_CAPSULE_NAME18760610
Ref: 588a18760610
Node: インタープリタの初期化と終了処理18760810
Ref: c-api/interp-lifecycle doc18761037
Ref: 588b18761037
Ref: c-api/interp-lifecycle initialization18761037
Ref: 588c18761037
Ref: c-api/interp-lifecycle interpreter-initialization-and-finalization18761037
Ref: 588d18761037
Ref: c-api/interp-lifecycle translation-repo18761037
Ref: 588e18761037
Node: Before Python initialization18761527
Ref: c-api/interp-lifecycle before-python-initialization18761679
Ref: 588f18761679
Ref: c-api/interp-lifecycle pre-init-safe18761679
Ref: dc218761679
Node: グローバルな設定変数18764085
Ref: c-api/interp-lifecycle global-conf-vars18764297
Ref: 589018764297
Ref: c-api/interp-lifecycle global-configuration-variables18764297
Ref: 589418764297
Ref: c-api/interp-lifecycle c Py_BytesWarningFlag18764916
Ref: 40418764916
Ref: c-api/interp-lifecycle c Py_DebugFlag18765578
Ref: 3f618765578
Ref: c-api/interp-lifecycle c Py_DontWriteBytecodeFlag18766122
Ref: 40a18766122
Ref: c-api/interp-lifecycle c Py_FrozenFlag18766702
Ref: 40618766702
Ref: c-api/interp-lifecycle c Py_HashRandomizationFlag18767128
Ref: 41018767128
Ref: c-api/interp-lifecycle c Py_IgnoreEnvironmentFlag18767774
Ref: 40818767774
Ref: c-api/interp-lifecycle c Py_InspectFlag18768307
Ref: 3fe18768307
Ref: c-api/interp-lifecycle c Py_InteractiveFlag18769034
Ref: 3fc18769034
Ref: c-api/interp-lifecycle c Py_IsolatedFlag18769389
Ref: 41318769389
Ref: c-api/interp-lifecycle c Py_LegacyWindowsFSEncodingFlag18769993
Ref: 41518769993
Ref: c-api/interp-lifecycle c Py_LegacyWindowsStdioFlag18770818
Ref: 41718770818
Ref: c-api/interp-lifecycle c Py_NoSiteFlag18771526
Ref: 40218771526
Ref: c-api/interp-lifecycle c Py_NoUserSiteDirectory18772247
Ref: 40c18772247
Ref: c-api/interp-lifecycle c Py_OptimizeFlag18772816
Ref: 40018772816
Ref: c-api/interp-lifecycle c Py_QuietFlag18773224
Ref: 3fa18773224
Ref: c-api/interp-lifecycle c Py_UnbufferedStdioFlag18773718
Ref: 40e18773718
Ref: c-api/interp-lifecycle c Py_VerboseFlag18774229
Ref: 3f818774229
Ref: グローバルな設定変数-Footnote-118775126
Ref: グローバルな設定変数-Footnote-218775168
Node: インタープリタの初期化と終了処理<2>18775210
Ref: c-api/interp-lifecycle initializing-and-finalizing-the-interpreter18775433
Ref: 589518775433
Ref: c-api/interp-lifecycle c Py_Initialize18775530
Ref: 45e18775530
Ref: c-api/interp-lifecycle c Py_InitializeEx18776792
Ref: 54b818776792
Ref: c-api/interp-lifecycle c Py_InitializeFromConfig18777277
Ref: 3f418777277
Ref: c-api/interp-lifecycle c Py_IsInitialized18777704
Ref: 52d618777704
Ref: c-api/interp-lifecycle c Py_IsFinalizing18778086
Ref: 5fd18778086
Ref: c-api/interp-lifecycle c Py_FinalizeEx18778363
Ref: f1518778363
Ref: c-api/interp-lifecycle c Py_Finalize18781856
Ref: 45d18781856
Ref: c-api/interp-lifecycle c Py_BytesMain18782071
Ref: bbc18782071
Ref: c-api/interp-lifecycle c Py_Main18782420
Ref: e2218782420
Ref: c-api/interp-lifecycle c Py_RunMain18784794
Ref: bc018784794
Ref: c-api/interp-lifecycle c PyUnstable_AtExit18786364
Ref: 195b18786364
Node: Cautions regarding runtime finalization18787028
Ref: c-api/interp-lifecycle cautions-regarding-runtime-finalization18787260
Ref: 589b18787260
Ref: c-api/interp-lifecycle id118787260
Ref: 589c18787260
Node: プロセスワイドのパラメータ18788816
Ref: c-api/interp-lifecycle process-wide-parameters18788988
Ref: 589d18788988
Ref: c-api/interp-lifecycle c Py_SetProgramName18789070
Ref: 1a1318789070
Ref: c-api/interp-lifecycle c Py_GetProgramName18790287
Ref: 3ec18790287
Ref: c-api/interp-lifecycle c Py_GetPrefix18790973
Ref: 3e318790973
Ref: c-api/interp-lifecycle c Py_GetExecPrefix18792326
Ref: 3e718792326
Ref: c-api/interp-lifecycle c Py_GetProgramFullPath18795101
Ref: 3ea18795101
Ref: c-api/interp-lifecycle c Py_GetPath18795985
Ref: 3e118795985
Ref: c-api/interp-lifecycle c Py_GetVersion18797142
Ref: 54b618797142
Ref: c-api/interp-lifecycle c Py_GetPlatform18797974
Ref: 54b418797974
Ref: c-api/interp-lifecycle c Py_GetCopyright18798807
Ref: 54b318798807
Ref: c-api/interp-lifecycle c Py_GetCompiler18799342
Ref: 54b218799342
Ref: c-api/interp-lifecycle c Py_GetBuildInfo18799912
Ref: 165018799912
Ref: c-api/interp-lifecycle c PySys_SetArgvEx18800442
Ref: 1a1418800442
Ref: c-api/interp-lifecycle c PySys_SetArgv18803298
Ref: 1a1518803298
Ref: c-api/interp-lifecycle c Py_SetPythonHome18804321
Ref: 1a1218804321
Ref: c-api/interp-lifecycle c Py_GetPythonHome18805256
Ref: 3ed18805256
Ref: プロセスワイドのパラメータ-Footnote-118805973
Node: Thread states and the global interpreter lock18806028
Ref: c-api/threads doc18806231
Ref: 589e18806231
Ref: c-api/threads thread-states-and-the-global-interpreter-lock18806231
Ref: 589f18806231
Ref: c-api/threads threads18806231
Ref: 58a018806231
Ref: c-api/threads translation-repo18806231
Ref: 58a118806231
Node: Detaching the thread state from extension code18809295
Ref: c-api/threads detaching-the-thread-state-from-extension-code18809458
Ref: 58a318809458
Ref: c-api/threads detaching-thread-state18809458
Ref: 58a218809458
Node: APIs18811993
Ref: c-api/threads apis18812080
Ref: 58a418812080
Ref: c-api/threads c Py_BEGIN_ALLOW_THREADS18812373
Ref: 524218812373
Ref: c-api/threads c Py_END_ALLOW_THREADS18812874
Ref: c8318812874
Ref: c-api/threads c Py_BLOCK_THREADS18813359
Ref: 54ae18813359
Ref: c-api/threads c Py_UNBLOCK_THREADS18813622
Ref: 54ce18813622
Node: Non-Python created threads18813890
Ref: c-api/threads non-python-created-threads18814072
Ref: 58a518814072
Node: Legacy API18815914
Ref: c-api/threads gilstate18816069
Ref: 58a618816069
Ref: c-api/threads legacy-api18816069
Ref: 58a718816069
Node: Cautions about fork18817127
Ref: c-api/threads cautions-about-fork18817269
Ref: 58a818817269
Ref: c-api/threads fork-and-threads18817269
Ref: 55a418817269
Node: 高水準 API18819179
Ref: c-api/threads high-level-apis18819325
Ref: 58a918819325
Ref: c-api/threads c PyThreadState18819461
Ref: 99418819461
Ref: c-api/threads c PyThreadState interp18819694
Ref: 58aa18819694
Ref: c-api/threads c PyEval_InitThreads18819809
Ref: 1a1618819809
Ref: c-api/threads c PyEval_SaveThread18820489
Ref: 64718820489
Ref: c-api/threads c PyEval_RestoreThread18820745
Ref: 64818820745
Ref: c-api/threads c PyThreadState_Get18821512
Ref: 61518821512
Ref: c-api/threads c PyThreadState_GetUnchecked18821947
Ref: 42118821947
Ref: c-api/threads c PyThreadState_Swap18822332
Ref: 544918822332
Node: GIL-state APIs18823002
Ref: c-api/threads gil-state-apis18823142
Ref: 58ab18823142
Ref: c-api/threads c PyGILState_STATE18823284
Ref: 53b318823284
Ref: c-api/threads c PyGILState_STATE PyGILState_LOCKED18823505
Ref: 58ac18823505
Ref: c-api/threads c PyGILState_STATE PyGILState_UNLOCKED18823653
Ref: 58ad18823653
Ref: c-api/threads c PyGILState_Ensure18823799
Ref: 64a18823799
Ref: c-api/threads c PyGILState_Release18825690
Ref: 64b18825690
Ref: c-api/threads c PyGILState_GetThisThreadState18826270
Ref: 53b218826270
Ref: c-api/threads c PyGILState_Check18827050
Ref: 58ae18827050
Node: 低水準 API18827901
Ref: c-api/threads low-level-apis18828019
Ref: 58af18828019
Ref: c-api/threads c PyThreadState_New18828059
Ref: 544818828059
Ref: c-api/threads c PyThreadState_Clear18828353
Ref: 19f018828353
Ref: c-api/threads c PyThreadState_Delete18828863
Ref: 1de718828863
Ref: c-api/threads c PyThreadState_DeleteCurrent18829193
Ref: 1e1418829193
Ref: c-api/threads c PyThreadState_GetFrame18829508
Ref: 99518829508
Ref: c-api/threads c PyThreadState_GetID18830007
Ref: b6e18830007
Ref: c-api/threads c PyThreadState_GetInterpreter18830360
Ref: b6d18830360
Ref: c-api/threads c PyThreadState_EnterTracing18830718
Ref: 95e18830718
Ref: c-api/threads c PyThreadState_LeaveTracing18830978
Ref: 95f18830978
Ref: c-api/threads c PyUnstable_ThreadState_SetStackProtection18831323
Ref: 46418831323
Ref: c-api/threads c PyUnstable_ThreadState_ResetStackProtection18832872
Ref: 46518832872
Ref: c-api/threads c PyThreadState_GetDict18833476
Ref: 544718833476
Ref: c-api/threads c PyEval_AcquireThread18834035
Ref: 64918834035
Ref: c-api/threads c PyEval_ReleaseThread18835231
Ref: 536318835231
Node: Asynchronous notifications18835739
Ref: c-api/threads asynchronous-notifications18835922
Ref: 58b018835922
Ref: c-api/threads c Py_AddPendingCall18836210
Ref: b7c18836210
Ref: c-api/threads c Py_MakePendingCalls18838677
Ref: 54b918838677
Ref: c-api/threads c PyThreadState_SetAsyncExc18839301
Ref: dc118839301
Node: Operating system thread APIs18840174
Ref: c-api/threads operating-system-thread-apis18840339
Ref: 58b118840339
Ref: c-api/threads c PYTHREAD_INVALID_THREAD_ID18840408
Ref: 58b218840408
Ref: c-api/threads c PyThread_start_new_thread18840566
Ref: 1e8718840566
Ref: c-api/threads c PyThread_get_thread_ident18841132
Ref: 545118841132
Ref: c-api/threads c PyThread_GetInfo18841502
Ref: 544a18841502
Ref: c-api/threads c PY_HAVE_THREAD_NATIVE_ID18842068
Ref: 58b318842068
Ref: c-api/threads c PyThread_get_thread_native_id18842186
Ref: 1bff18842186
Ref: c-api/threads c PyThread_exit_thread18842774
Ref: 544e18842774
Ref: c-api/threads c PyThread_init_thread18843802
Ref: 545218843802
Ref: c-api/threads c PyThread_set_stacksize18844054
Ref: 545418844054
Ref: c-api/threads c PyThread_get_stacksize18844507
Ref: 545018844507
Ref: Operating system thread APIs-Footnote-118844853
Node: 同期プリミティブ<3>18844905
Ref: c-api/synchronization doc18845072
Ref: 58b418845072
Ref: c-api/synchronization synchronization18845072
Ref: 58b518845072
Ref: c-api/synchronization synchronization-primitives18845072
Ref: 58b618845072
Ref: c-api/synchronization translation-repo18845072
Ref: 58b718845072
Ref: c-api/synchronization c PyMutex18845176
Ref: 48418845176
Ref: c-api/synchronization c PyMutex_Lock18845811
Ref: 5d018845811
Ref: c-api/synchronization c PyMutex_Unlock18846161
Ref: 5d118846161
Ref: c-api/synchronization c PyMutex_IsLocked18846387
Ref: 46118846387
Node: Python critical section API18846890
Ref: c-api/synchronization id118847009
Ref: 58b818847009
Ref: c-api/synchronization python-critical-section-api18847009
Ref: 278318847009
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION18849861
Ref: 572e18849861
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION_MUTEX18850266
Ref: 58ba18850266
Ref: c-api/synchronization c Py_END_CRITICAL_SECTION18850798
Ref: 58bb18850798
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION218851116
Ref: 58b918851116
Ref: c-api/synchronization c Py_BEGIN_CRITICAL_SECTION2_MUTEX18851660
Ref: 58bc18851660
Ref: c-api/synchronization c Py_END_CRITICAL_SECTION218852222
Ref: 58bd18852222
Node: Legacy locking APIs18852544
Ref: c-api/synchronization legacy-locking-apis18852663
Ref: 58be18852663
Ref: c-api/synchronization c PyThread_type_lock18852806
Ref: 58bf18852806
Ref: c-api/synchronization c PyLockStatus18852898
Ref: 58c018852898
Ref: c-api/synchronization c PY_LOCK_FAILURE18852993
Ref: 58c118852993
Ref: c-api/synchronization c PY_LOCK_ACQUIRED18853083
Ref: 58c218853083
Ref: c-api/synchronization c PY_LOCK_INTR18853182
Ref: 58c318853182
Ref: c-api/synchronization c PyThread_allocate_lock18853279
Ref: 544d18853279
Ref: c-api/synchronization c PyThread_free_lock18853645
Ref: 544f18853645
Ref: c-api/synchronization c PyThread_acquire_lock_timed18853930
Ref: 544c18853930
Ref: c-api/synchronization c PyThread_acquire_lock18854935
Ref: 544b18854935
Ref: c-api/synchronization c PyThread_release_lock18855705
Ref: 545318855705
Node: Thread-local storage support18855995
Ref: c-api/tls doc18856175
Ref: 58c418856175
Ref: c-api/tls thread-local-storage18856175
Ref: 58c518856175
Ref: c-api/tls thread-local-storage-support18856175
Ref: 58c618856175
Ref: c-api/tls translation-repo18856175
Ref: 58c718856175
Node: Thread-specific storage API18857421
Ref: c-api/tls id118857540
Ref: 58c818857540
Ref: c-api/tls thread-specific-storage-api18857540
Ref: cd918857540
Ref: c-api/tls c Py_tss_t18857961
Ref: cda18857961
Ref: c-api/tls c Py_tss_NEEDS_INIT18858489
Ref: 58c918858489
Ref: Thread-specific storage API-Footnote-118858751
Node: Dynamic allocation18858793
Ref: c-api/tls dynamic-allocation18858936
Ref: 58ca18858936
Ref: c-api/tls c PyThread_tss_alloc18859256
Ref: 43618859256
Ref: c-api/tls c PyThread_tss_free18859569
Ref: 43818859569
Node: メソッド<2>18860073
Ref: c-api/tls methods18860200
Ref: 58cb18860200
Ref: c-api/tls c PyThread_tss_is_created18860506
Ref: 545618860506
Ref: c-api/tls c PyThread_tss_create18860776
Ref: 545518860776
Ref: c-api/tls c PyThread_tss_delete18861272
Ref: 43e18861272
Ref: c-api/tls c PyThread_tss_set18861781
Ref: 43a18861781
Ref: c-api/tls c PyThread_tss_get18862119
Ref: 43c18862119
Node: Legacy APIs18862431
Ref: c-api/tls legacy-apis18862531
Ref: 58cc18862531
Ref: c-api/tls thread-local-storage-api18862531
Ref: cd818862531
Ref: c-api/tls c PyThread_create_key18863151
Ref: 43518863151
Ref: c-api/tls c PyThread_delete_key18863247
Ref: 43718863247
Ref: c-api/tls c PyThread_set_key_value18863351
Ref: 43918863351
Ref: c-api/tls c PyThread_get_key_value18863470
Ref: 43b18863470
Ref: c-api/tls c PyThread_delete_key_value18863578
Ref: 43d18863578
Ref: c-api/tls c PyThread_ReInitTLS18863688
Ref: 43f18863688
Node: Multiple interpreters in a Python process18863784
Ref: c-api/subinterpreters doc18863958
Ref: 58cd18863958
Ref: c-api/subinterpreters multiple-interpreters-in-a-python-process18863958
Ref: 58ce18863958
Ref: c-api/subinterpreters sub-interpreter-support18863958
Ref: 16418863958
Ref: c-api/subinterpreters translation-repo18863958
Ref: 58cf18863958
Ref: c-api/subinterpreters c PyInterpreterConfig18865209
Ref: 78e18865209
Ref: c-api/subinterpreters c PyInterpreterConfig use_main_obmalloc18865515
Ref: 4c9c18865515
Ref: c-api/subinterpreters c PyInterpreterConfig allow_fork18865963
Ref: 58d418865963
Ref: c-api/subinterpreters c PyInterpreterConfig allow_exec18866309
Ref: 58d518866309
Ref: c-api/subinterpreters c PyInterpreterConfig allow_threads18866715
Ref: 58d618866715
Ref: c-api/subinterpreters c PyInterpreterConfig allow_daemon_threads18866914
Ref: 58d718866914
Ref: c-api/subinterpreters c PyInterpreterConfig check_multi_interp_extensions18867206
Ref: 58d118867206
Ref: c-api/subinterpreters c PyInterpreterConfig gil18867741
Ref: 58d218867741
Ref: c-api/subinterpreters c PyInterpreterConfig_DEFAULT_GIL18867901
Ref: 58d818867901
Ref: c-api/subinterpreters c PyInterpreterConfig_SHARED_GIL18868068
Ref: 58d918868068
Ref: c-api/subinterpreters c PyInterpreterConfig_OWN_GIL18868186
Ref: 58d318868186
Ref: c-api/subinterpreters c Py_NewInterpreterFromConfig18868442
Ref: 68918868442
Ref: c-api/subinterpreters c Py_NewInterpreter18873340
Ref: 1b9018873340
Ref: c-api/subinterpreters c Py_EndInterpreter18873823
Ref: 18aa18873823
Ref: Multiple interpreters in a Python process-Footnote-118874550
Node: A per-interpreter GIL18874592
Ref: c-api/subinterpreters a-per-interpreter-gil18874721
Ref: 58db18874721
Ref: c-api/subinterpreters per-interpreter-gil18874721
Ref: 58dc18874721
Ref: A per-interpreter GIL-Footnote-118876777
Ref: A per-interpreter GIL-Footnote-218876819
Node: バグと注意事項18876861
Ref: c-api/subinterpreters bugs-and-caveats18877015
Ref: 58da18877015
Node: 高水準 API<2>18878830
Ref: c-api/subinterpreters high-level-apis18878979
Ref: 58dd18878979
Ref: c-api/subinterpreters c PyInterpreterState18879019
Ref: abe18879019
Ref: c-api/subinterpreters c PyInterpreterState_Get18880104
Ref: 64c18880104
Ref: c-api/subinterpreters c PyInterpreterState_GetID18880443
Ref: dc318880443
Ref: c-api/subinterpreters c PyInterpreterState_GetDict18880879
Ref: 53c118880879
Ref: c-api/subinterpreters c _PyFrameEvalFunction18881769
Ref: 97e18881769
Ref: c-api/subinterpreters c _PyInterpreterState_GetEvalFrameFunc18882344
Ref: 1dd518882344
Ref: c-api/subinterpreters c _PyInterpreterState_SetEvalFrameFunc18882619
Ref: 1dd618882619
Ref: 高水準 API<2>-Footnote-118882925
Ref: 高水準 API<2>-Footnote-218882967
Ref: 高水準 API<2>-Footnote-318883009
Node: 低水準 API<2>18883051
Ref: c-api/subinterpreters low-level-apis18883204
Ref: 58de18883204
Ref: c-api/subinterpreters c PyInterpreterState_New18883494
Ref: 4ad918883494
Ref: c-api/subinterpreters c PyInterpreterState_Clear18883929
Ref: 4ad818883929
Ref: c-api/subinterpreters c PyInterpreterState_Delete18884316
Ref: 53c018884316
Node: Advanced debugger support18884710
Ref: c-api/subinterpreters advanced-debugger-support18884838
Ref: 58df18884838
Ref: c-api/subinterpreters advanced-debugging18884838
Ref: 58e018884838
Ref: c-api/subinterpreters c PyInterpreterState_Head18885000
Ref: 171d18885000
Ref: c-api/subinterpreters c PyInterpreterState_Main18885204
Ref: 58d018885204
Ref: c-api/subinterpreters c PyInterpreterState_Next18885360
Ref: 171e18885360
Ref: c-api/subinterpreters c PyInterpreterState_ThreadHead18885609
Ref: 171f18885609
Ref: c-api/subinterpreters c PyThreadState_Next18885917
Ref: 172018885917
Node: Profiling and tracing18886217
Ref: c-api/profiling doc18886380
Ref: 58e118886380
Ref: c-api/profiling profiling18886380
Ref: 58e218886380
Ref: c-api/profiling profiling-and-tracing18886380
Ref: 58e318886380
Ref: c-api/profiling translation-repo18886380
Ref: 58e418886380
Ref: c-api/profiling c Py_tracefunc18887439
Ref: 58e518887439
Ref: c-api/profiling c PyTrace_CALL18889894
Ref: 58e618889894
Ref: c-api/profiling c PyTrace_EXCEPTION18890385
Ref: 58e718890385
Ref: c-api/profiling c PyTrace_LINE18890992
Ref: 58e818890992
Ref: c-api/profiling c PyTrace_RETURN18891292
Ref: 58e918891292
Ref: c-api/profiling c PyTrace_C_CALL18891446
Ref: 58ea18891446
Ref: c-api/profiling c PyTrace_C_EXCEPTION18891601
Ref: 58eb18891601
Ref: c-api/profiling c PyTrace_C_RETURN18891769
Ref: 58ec18891769
Ref: c-api/profiling c PyTrace_OPCODE18891923
Ref: 58ed18891923
Ref: c-api/profiling c PyEval_SetProfile18892261
Ref: 171b18892261
Ref: c-api/profiling c PyEval_SetProfileAllThreads18892974
Ref: 78118892974
Ref: c-api/profiling c PyEval_SetTrace18893505
Ref: 66318893505
Ref: c-api/profiling c PyEval_SetTraceAllThreads18894217
Ref: 66418894217
Node: Reference tracing18894733
Ref: c-api/profiling reference-tracing18894877
Ref: 58ee18894877
Ref: c-api/profiling c PyRefTracer18894948
Ref: 58ef18894948
Ref: c-api/profiling c PyRefTracer_CREATE18895796
Ref: 58f018895796
Ref: c-api/profiling c PyRefTracer_DESTROY18895958
Ref: 58f118895958
Ref: c-api/profiling c PyRefTracer_TRACKER_REMOVED18896123
Ref: 58f218896123
Ref: c-api/profiling c PyRefTracer_SetTracer18896351
Ref: 61018896351
Ref: c-api/profiling c PyRefTracer_GetTracer18897415
Ref: 61118897415
Node: Python 初期化設定18897905
Ref: c-api/init_config doc18898043
Ref: 58f318898043
Ref: c-api/init_config init-config18898043
Ref: 64618898043
Ref: c-api/init_config python-initialization-configuration18898043
Ref: 58f418898043
Ref: c-api/init_config translation-repo18898043
Ref: 58f518898043
Node: PyInitConfig C API18898281
Ref: c-api/init_config pyinitconfig-api18898388
Ref: 37718898388
Ref: c-api/init_config pyinitconfig-c-api18898388
Ref: 58f618898388
Ref: PyInitConfig C API-Footnote-118899017
Node: 使用例<54>18899059
Ref: c-api/init_config example18899151
Ref: 58f718899151
Node: 設定の作成18900441
Ref: c-api/init_config create-config18900560
Ref: 58f818900560
Ref: c-api/init_config c PyInitConfig18900606
Ref: 58f918900606
Ref: c-api/init_config c PyInitConfig_Create18900721
Ref: 38518900721
Ref: c-api/init_config c PyInitConfig_Free18901016
Ref: 38618901016
Node: エラー処理<2>18901204
Ref: c-api/init_config error-handling18901321
Ref: 58fb18901321
Ref: c-api/init_config c PyInitConfig_GetError18901367
Ref: 38818901367
Ref: c-api/init_config c PyInitConfig_GetExitCode18901939
Ref: 38918901939
Node: Get Options18902534
Ref: c-api/init_config get-options18902647
Ref: 58fc18902647
Ref: c-api/init_config c PyInitConfig_HasOption18902830
Ref: 38d18902830
Ref: c-api/init_config c PyInitConfig_GetInt18903059
Ref: 38a18903059
Ref: c-api/init_config c PyInitConfig_GetStr18903333
Ref: 38b18903333
Ref: c-api/init_config c PyInitConfig_GetStrList18903854
Ref: 38c18903854
Ref: c-api/init_config c PyInitConfig_FreeStrList18904330
Ref: 38718904330
Node: Set Options18904502
Ref: c-api/init_config set-options18904603
Ref: 58fe18904603
Ref: c-api/init_config c PyInitConfig_SetInt18905060
Ref: 38e18905060
Ref: c-api/init_config c PyInitConfig_SetStr18905315
Ref: 38f18905315
Ref: c-api/init_config c PyInitConfig_SetStrList18905644
Ref: 39018905644
Node: Module18906014
Ref: c-api/init_config module18906121
Ref: 58ff18906121
Ref: c-api/init_config c PyInitConfig_AddModule18906154
Ref: 37918906154
Node: Initialize Python18906822
Ref: c-api/init_config initialize-python18906909
Ref: 590018906909
Ref: c-api/init_config c Py_InitializeFromInitConfig18906964
Ref: 38418906964
Node: Configuration Options18907366
Ref: c-api/init_config configuration-options18907514
Ref: 590118907514
Ref: c-api/init_config pyinitconfig-opts18907514
Ref: 58fd18907514
Node: Runtime Python configuration API18928469
Ref: c-api/init_config runtime-python-configuration-api18928613
Ref: 592018928613
Ref: c-api/init_config c PyConfig_Get18929105
Ref: 37a18929105
Ref: c-api/init_config c PyConfig_GetInt18929759
Ref: 38218929759
Ref: c-api/init_config c PyConfig_Names18930027
Ref: 38318930027
Ref: c-api/init_config c PyConfig_Set18930453
Ref: 37b18930453
Node: PyConfig C API18931408
Ref: c-api/init_config pyconfig-api18931545
Ref: 37818931545
Ref: c-api/init_config pyconfig-c-api18931545
Ref: 592118931545
Ref: PyConfig C API-Footnote-118933024
Node: 使用例<55>18933066
Ref: c-api/init_config id118933155
Ref: 592218933155
Node: PyWideStringList18934169
Ref: c-api/init_config pywidestringlist18934275
Ref: 592318934275
Ref: c-api/init_config c PyWideStringList18934328
Ref: ba918934328
Ref: c-api/init_config c PyWideStringList_Append18934593
Ref: bba18934593
Ref: c-api/init_config c PyWideStringList_Insert18934837
Ref: bbb18934837
Ref: c-api/init_config c PyWideStringList length18935345
Ref: 592418935345
Ref: c-api/init_config c PyWideStringList items18935440
Ref: 592518935440
Node: PyStatus18935521
Ref: c-api/init_config pystatus18935625
Ref: 592618935625
Ref: c-api/init_config c PyStatus18935662
Ref: ba818935662
Ref: c-api/init_config c PyStatus exitcode18935926
Ref: 592718935926
Ref: c-api/init_config c PyStatus err_msg18936050
Ref: 592818936050
Ref: c-api/init_config c PyStatus func18936141
Ref: 592918936141
Ref: c-api/init_config c PyStatus_Ok18936323
Ref: bb918936323
Ref: c-api/init_config c PyStatus_Error18936407
Ref: bb318936407
Ref: c-api/init_config c PyStatus_NoMemory18936620
Ref: bb818936620
Ref: c-api/init_config c PyStatus_Exit18936751
Ref: bb518936751
Ref: c-api/init_config c PyStatus_Exception18936931
Ref: bb418936931
Ref: c-api/init_config c PyStatus_IsError18937163
Ref: bb618937163
Ref: c-api/init_config c PyStatus_IsExit18937260
Ref: bb718937260
Ref: c-api/init_config c Py_ExitStatusException18937355
Ref: bbd18937355
Node: PyPreConfig18938325
Ref: c-api/init_config pypreconfig18938450
Ref: 592a18938450
Ref: c-api/init_config c PyPreConfig18938493
Ref: ba718938493
Ref: c-api/init_config c PyPreConfig_InitPythonConfig18938629
Ref: bb218938629
Ref: c-api/init_config c PyPreConfig_InitIsolatedConfig18938818
Ref: bb118938818
Ref: c-api/init_config c PyPreConfig allocator18939043
Ref: 590218939043
Ref: c-api/init_config c PyPreConfig configure_locale18940838
Ref: 590b18940838
Ref: c-api/init_config c PyPreConfig coerce_c_locale18941211
Ref: 590818941211
Ref: c-api/init_config c PyPreConfig coerce_c_locale_warn18941542
Ref: 590918941542
Ref: c-api/init_config c PyPreConfig dev_mode18941741
Ref: 592c18941741
Ref: c-api/init_config c PyPreConfig isolated18941950
Ref: 592d18941950
Ref: c-api/init_config c PyPreConfig legacy_windows_fs_encoding18942125
Ref: 41618942125
Ref: c-api/init_config c PyPreConfig parse_argv18942709
Ref: 592e18942709
Ref: c-api/init_config c PyPreConfig use_environment18943106
Ref: 592f18943106
Ref: c-api/init_config c PyPreConfig utf8_mode18943337
Ref: 41b18943337
Node: Preinitialize Python with PyPreConfig18943760
Ref: c-api/init_config c-preinit18943885
Ref: 437118943885
Ref: c-api/init_config preinitialize-python-with-pypreconfig18943885
Ref: 593018943885
Ref: c-api/init_config c Py_PreInitialize18944378
Ref: 41c18944378
Ref: c-api/init_config c Py_PreInitializeFromBytesArgs18944579
Ref: bbf18944579
Ref: c-api/init_config c Py_PreInitializeFromArgs18944940
Ref: bbe18944940
Node: PyConfig18946872
Ref: c-api/init_config pyconfig18947014
Ref: 593118947014
Ref: c-api/init_config c PyConfig18947051
Ref: 3f518947051
Ref: c-api/init_config c PyConfig_InitPythonConfig18947292
Ref: bac18947292
Ref: c-api/init_config c PyConfig_InitIsolatedConfig18947454
Ref: bab18947454
Ref: c-api/init_config c PyConfig_SetString18947620
Ref: bb018947620
Ref: c-api/init_config c PyConfig_SetBytesString18947893
Ref: baf18947893
Ref: c-api/init_config c PyConfig_SetArgv18948224
Ref: bad18948224
Ref: c-api/init_config c PyConfig_SetBytesArgv18948541
Ref: bae18948541
Ref: c-api/init_config c PyConfig_SetWideStringList18948911
Ref: 1e2518948911
Ref: c-api/init_config c PyConfig_Read18949219
Ref: 99718949219
Ref: c-api/init_config c PyConfig_Clear18950557
Ref: baa18950557
Ref: c-api/init_config c PyConfig argv18951673
Ref: 3ef18951673
Ref: c-api/init_config c PyConfig safe_path18952674
Ref: 97b18952674
Ref: c-api/init_config c PyConfig base_exec_prefix18953560
Ref: 590318953560
Ref: c-api/init_config c PyConfig base_executable18953817
Ref: 590418953817
Ref: c-api/init_config c PyConfig base_prefix18954227
Ref: 590518954227
Ref: c-api/init_config c PyConfig buffered_stdio18954469
Ref: 40f18954469
Ref: c-api/init_config c PyConfig bytes_warning18954894
Ref: 40518954894
Ref: c-api/init_config c PyConfig warn_default_encoding18955345
Ref: 591e18955345
Ref: c-api/init_config c PyConfig code_debug_ranges18955669
Ref: 590718955669
Ref: c-api/init_config c PyConfig check_hash_pycs_mode18956154
Ref: 590618956154
Ref: c-api/init_config c PyConfig configure_c_stdio18956826
Ref: 590a18956826
Ref: c-api/init_config c PyConfig dev_mode18957387
Ref: 590d18957387
Ref: c-api/init_config c PyConfig dump_refs18957699
Ref: 590e18957699
Ref: c-api/init_config c PyConfig dump_refs_file18958124
Ref: 590f18958124
Ref: c-api/init_config c PyConfig exec_prefix18958385
Ref: 591018958385
Ref: c-api/init_config c PyConfig executable18958749
Ref: 64518958749
Ref: c-api/init_config c PyConfig faulthandler18959079
Ref: 591118959079
Ref: c-api/init_config c PyConfig filesystem_encoding18959445
Ref: 41918959445
Ref: c-api/init_config c PyConfig filesystem_errors18960684
Ref: 41a18960684
Ref: c-api/init_config c PyConfig use_frozen_modules18961365
Ref: 591d18961365
Ref: c-api/init_config c PyConfig hash_seed18961650
Ref: 41218961650
Ref: c-api/init_config c PyConfig use_hash_seed18961706
Ref: 41118961706
Ref: c-api/init_config c PyConfig home18962125
Ref: 3f118962125
Ref: c-api/init_config c PyConfig import_time18962485
Ref: 591218962485
Ref: c-api/init_config c PyConfig inspect18962973
Ref: 3ff18962973
Ref: c-api/init_config c PyConfig install_signal_handlers18963573
Ref: abf18963573
Ref: c-api/init_config c PyConfig interactive18963746
Ref: 3fd18963746
Ref: c-api/init_config c PyConfig int_max_str_digits18963962
Ref: 591318963962
Ref: c-api/init_config c PyConfig cpu_count18964863
Ref: 590c18964863
Ref: c-api/init_config c PyConfig isolated18965363
Ref: 41418965363
Ref: c-api/init_config c PyConfig legacy_windows_stdio18966368
Ref: 41818966368
Ref: c-api/init_config c PyConfig malloc_stats18967005
Ref: 591418967005
Ref: c-api/init_config c PyConfig platlibdir18967401
Ref: 1d7f18967401
Ref: c-api/init_config c PyConfig pythonpath_env18968231
Ref: 593218968231
Ref: c-api/init_config c PyConfig module_search_paths18968583
Ref: 64318968583
Ref: c-api/init_config c PyConfig module_search_paths_set18968679
Ref: 80518968679
Ref: c-api/init_config c PyConfig optimization_level18969210
Ref: 40118969210
Ref: c-api/init_config c PyConfig orig_argv18969717
Ref: a9818969717
Ref: c-api/init_config c PyConfig parse_argv18970373
Ref: 1d4f18970373
Ref: c-api/init_config c PyConfig parser_debug18971271
Ref: 3f718971271
Ref: c-api/init_config c PyConfig pathconfig_warnings18971759
Ref: 40718971759
Ref: c-api/init_config c PyConfig prefix18972197
Ref: 591618972197
Ref: c-api/init_config c PyConfig program_name18972538
Ref: 3f018972538
Ref: c-api/init_config c PyConfig pycache_prefix18973282
Ref: 591718973282
Ref: c-api/init_config c PyConfig quiet18973756
Ref: 3fb18973756
Ref: c-api/init_config c PyConfig run_command18974032
Ref: 589718974032
Ref: c-api/init_config c PyConfig run_filename18974221
Ref: 589818974221
Ref: c-api/init_config c PyConfig run_module18974700
Ref: 589918974700
Ref: c-api/init_config c PyConfig run_presite18974888
Ref: 591818974888
Ref: c-api/init_config c PyConfig show_ref_count18975391
Ref: 591918975391
Ref: c-api/init_config c PyConfig site_import18975758
Ref: 40318975758
Ref: c-api/init_config c PyConfig skip_source_first_line18976423
Ref: 591a18976423
Ref: c-api/init_config c PyConfig stdio_encoding18976808
Ref: 64418976808
Ref: c-api/init_config c PyConfig stdio_errors18976864
Ref: 4cac18976864
Ref: c-api/init_config c PyConfig tracemalloc18977760
Ref: 591c18977760
Ref: c-api/init_config c PyConfig perf_profiling18978125
Ref: 591518978125
Ref: c-api/init_config c PyConfig stdlib_dir18978943
Ref: 591b18978943
Ref: c-api/init_config c PyConfig use_environment18979114
Ref: 40918979114
Ref: c-api/init_config c PyConfig use_system_logger18979448
Ref: 22cd18979448
Ref: c-api/init_config c PyConfig user_site_directory18979814
Ref: 40d18979814
Ref: c-api/init_config c PyConfig verbose18980221
Ref: 3f918980221
Ref: c-api/init_config c PyConfig warnoptions18980841
Ref: 64118980841
Ref: c-api/init_config c PyConfig write_bytecode18981695
Ref: 40b18981695
Ref: c-api/init_config c PyConfig xoptions18982164
Ref: 64218982164
Ref: c-api/init_config c PyConfig _pystats18982365
Ref: 591f18982365
Ref: PyConfig-Footnote-118983049
Ref: PyConfig-Footnote-218983091
Node: Initialization with PyConfig18983133
Ref: c-api/init_config init-from-config18983260
Ref: 589618983260
Ref: c-api/init_config initialization-with-pyconfig18983260
Ref: 593318983260
Node: Isolated Configuration18986945
Ref: c-api/init_config init-isolated-conf18987084
Ref: 58fa18987084
Ref: c-api/init_config isolated-configuration18987084
Ref: 593418987084
Node: Python Configuration18987855
Ref: c-api/init_config init-python-config18987991
Ref: 589a18987991
Ref: c-api/init_config python-configuration18987991
Ref: 593518987991
Ref: Python Configuration-Footnote-118988627
Ref: Python Configuration-Footnote-218988669
Node: Python Path Configuration18988711
Ref: c-api/init_config init-path-config18988816
Ref: aae18988816
Ref: c-api/init_config python-path-configuration18988816
Ref: 593618988816
Node: Py_GetArgcArgv18993138
Ref: c-api/init_config py-getargcargv18993273
Ref: 593718993273
Ref: c-api/init_config c Py_GetArgcArgv18993322
Ref: 1d9f18993322
Node: Delaying main module execution18993524
Ref: c-api/init_config delaying-main-module-execution18993636
Ref: 593818993636
Node: メモリ管理18994142
Ref: c-api/memory doc18994329
Ref: 593918994329
Ref: c-api/memory memory18994329
Ref: 592b18994329
Ref: c-api/memory memory-management18994329
Ref: 593a18994329
Ref: c-api/memory translation-repo18994329
Ref: 593b18994329
Node: 概要<4>18994777
Ref: c-api/memory memoryoverview18994864
Ref: 593c18994864
Ref: c-api/memory overview18994864
Ref: 593d18994864
Node: Allocator Domains19000036
Ref: c-api/memory allocator-domains19000168
Ref: 593e19000168
Ref: c-api/memory id119000219
Ref: 593f19000219
Node: 生メモリインターフェース19002258
Ref: c-api/memory raw-memory-interface19002414
Ref: 594519002414
Ref: c-api/memory raw-memoryinterface19002414
Ref: 594119002414
Ref: c-api/memory c PyMem_RawMalloc19002904
Ref: 63119002904
Ref: c-api/memory c PyMem_RawCalloc19003478
Ref: 63219003478
Ref: c-api/memory c PyMem_RawRealloc19004095
Ref: 63319004095
Ref: c-api/memory c PyMem_RawFree19005119
Ref: 63419005119
Node: メモリインターフェース19005679
Ref: c-api/memory memory-interface19005851
Ref: 594619005851
Ref: c-api/memory memoryinterface19005851
Ref: 594219005851
Ref: c-api/memory c PyMem_Malloc19006811
Ref: e6319006811
Ref: c-api/memory c PyMem_Calloc19007350
Ref: 10b119007350
Ref: c-api/memory c PyMem_Realloc19007961
Ref: 123719007961
Ref: c-api/memory c PyMem_Free19008949
Ref: 166019008949
Ref: c-api/memory c PyMem_New19009624
Ref: 174219009624
Ref: c-api/memory c PyMem_Resize19009866
Ref: 594719009866
Ref: c-api/memory c PyMem_Del19010383
Ref: 174319010383
Node: 非推奨のエイリアス<2>19010550
Ref: c-api/memory deprecated-aliases19010650
Ref: 594819010650
Ref: c-api/memory c PyMem_MALLOC19011203
Ref: 594919011203
Ref: c-api/memory c PyMem_NEW19011404
Ref: 594a19011404
Ref: c-api/memory c PyMem_REALLOC19011601
Ref: 594b19011601
Ref: c-api/memory c PyMem_RESIZE19011806
Ref: 594c19011806
Ref: c-api/memory c PyMem_FREE19011989
Ref: 594d19011989
Ref: c-api/memory c PyMem_DEL19012185
Ref: 594e19012185
Node: オブジェクトアロケータ19012559
Ref: c-api/memory object-allocators19012720
Ref: 594f19012720
Ref: c-api/memory objectinterface19012720
Ref: 594319012720
Ref: c-api/memory c PyObject_Malloc19013650
Ref: e6619013650
Ref: c-api/memory c PyObject_Calloc19014195
Ref: 10b219014195
Ref: c-api/memory c PyObject_Realloc19014811
Ref: 166119014811
Ref: c-api/memory c PyObject_Free19015824
Ref: e6419015824
Node: Default Memory Allocators19017111
Ref: c-api/memory default-memory-allocators19017290
Ref: 219619017290
Ref: c-api/memory id219017290
Ref: 595119017290
Node: メモリアロケータをカスタマイズする19020675
Ref: c-api/memory customize-memory-allocators19020864
Ref: 595019020864
Ref: c-api/memory id319020864
Ref: 595219020864
Ref: c-api/memory c PyMemAllocatorEx19020989
Ref: 10d219020989
Ref: c-api/memory c PyMemAllocatorDomain19023028
Ref: 594019023028
Ref: c-api/memory c PYMEM_DOMAIN_RAW19023170
Ref: 219719023170
Ref: c-api/memory c PYMEM_DOMAIN_MEM19023415
Ref: e6719023415
Ref: c-api/memory c PYMEM_DOMAIN_OBJ19023651
Ref: e6519023651
Ref: c-api/memory c PyMem_GetAllocator19023898
Ref: 589219023898
Ref: c-api/memory c PyMem_SetAllocator19024103
Ref: 7a819024103
Ref: c-api/memory c PyMem_SetupDebugHooks19026262
Ref: e6819026262
Node: Debug hooks on the Python memory allocators19026413
Ref: c-api/memory debug-hooks-on-the-python-memory-allocators19026601
Ref: 595319026601
Ref: c-api/memory pymem-debug-hooks19026601
Ref: 219819026601
Node: pymalloc アロケータ19031903
Ref: c-api/memory pymalloc19032062
Ref: f0f19032062
Ref: c-api/memory the-pymalloc-allocator19032062
Ref: 595419032062
Node: pymalloc アリーナアロケータのカスタマイズ19033424
Ref: c-api/memory customize-pymalloc-arena-allocator19033542
Ref: 595519033542
Ref: c-api/memory c PyObjectArenaAllocator19033684
Ref: 595619033684
Ref: c-api/memory c PyObject_GetArenaAllocator19034796
Ref: 589319034796
Ref: c-api/memory c PyObject_SetArenaAllocator19034947
Ref: 589119034947
Node: The mimalloc allocator19035098
Ref: c-api/memory mimalloc19035231
Ref: 178a19035231
Ref: c-api/memory the-mimalloc-allocator19035231
Ref: 595719035231
Ref: The mimalloc allocator-Footnote-119036505
Node: tracemalloc C API19036552
Ref: c-api/memory tracemalloc-c-api19036674
Ref: 595819036674
Ref: c-api/memory c PyTraceMalloc_Track19036750
Ref: db319036750
Ref: c-api/memory c PyTraceMalloc_Untrack19037164
Ref: db419037164
Node: 使用例<56>19037457
Ref: c-api/memory examples19037548
Ref: 595919037548
Ref: c-api/memory memoryexamples19037548
Ref: 595a19037548
Node: オブジェクト実装サポート object implementation support19039759
Ref: c-api/objimpl doc19039960
Ref: 595b19039960
Ref: c-api/objimpl newtypes19039960
Ref: 595c19039960
Ref: c-api/objimpl object-implementation-support19039960
Ref: 595d19039960
Ref: c-api/objimpl translation-repo19039960
Ref: 595e19039960
Node: Allocating objects on the heap19040537
Ref: c-api/allocation doc19040696
Ref: 595f19040696
Ref: c-api/allocation allocating-objects19040696
Ref: 596019040696
Ref: c-api/allocation allocating-objects-on-the-heap19040696
Ref: 596119040696
Ref: c-api/allocation c _PyObject_New19040773
Ref: 596219040773
Ref: c-api/allocation c _PyObject_NewVar19040885
Ref: 596319040885
Ref: c-api/allocation c PyObject_Init19041031
Ref: c6419041031
Ref: c-api/allocation c PyObject_InitVar19042025
Ref: 1d9e19042025
Ref: c-api/allocation c PyObject_New19042502
Ref: b8019042502
Ref: c-api/allocation c PyObject_NewVar19044358
Ref: b8119044358
Ref: c-api/allocation c _Py_NoneStruct19046311
Ref: 596419046311
Node: Soft-deprecated aliases19046781
Ref: c-api/allocation soft-deprecated-aliases19046871
Ref: 596519046871
Ref: c-api/allocation c PyObject_NEW19047421
Ref: 596619047421
Ref: c-api/allocation c PyObject_NEW_VAR19047624
Ref: 596719047624
Ref: c-api/allocation c PyObject_INIT19047815
Ref: 1d9c19047815
Ref: c-api/allocation c PyObject_INIT_VAR19048021
Ref: 1d9d19048021
Ref: c-api/allocation c PyObject_MALLOC19048209
Ref: 596819048209
Ref: c-api/allocation c PyObject_REALLOC19048414
Ref: 596919048414
Ref: c-api/allocation c PyObject_FREE19048611
Ref: 596a19048611
Ref: c-api/allocation c PyObject_DEL19048809
Ref: 596b19048809
Ref: c-api/allocation c PyObject_Del19049008
Ref: 16ef19049008
Node: Object Life Cycle19049116
Ref: c-api/lifecycle doc19049344
Ref: 596c19049344
Ref: c-api/lifecycle life-cycle19049344
Ref: 596d19049344
Ref: c-api/lifecycle object-life-cycle19049344
Ref: 596e19049344
Ref: c-api/lifecycle translation-repo19049344
Ref: 596f19049344
Node: Life Events19049768
Ref: c-api/lifecycle life-events19049868
Ref: 597019049868
Node: Cyclic Isolate Destruction19055128
Ref: c-api/lifecycle cyclic-isolate-destruction19055247
Ref: 597319055247
Ref: Cyclic Isolate Destruction-Footnote-119060495
Node: 関数<15>19060537
Ref: c-api/lifecycle functions19060636
Ref: 597419060636
Ref: c-api/lifecycle c PyObject_CallFinalizer19060745
Ref: 597519060745
Ref: c-api/lifecycle c PyObject_CallFinalizerFromDealloc19061293
Ref: 597119061293
Node: 共通のオブジェクト構造体 common object structure19061876
Ref: c-api/structures doc19062096
Ref: 597619062096
Ref: c-api/structures common-object-structures19062096
Ref: 597719062096
Ref: c-api/structures common-structs19062096
Ref: 597819062096
Ref: c-api/structures translation-repo19062096
Ref: 597919062096
Node: Base object types and macros19062538
Ref: c-api/structures base-object-types-and-macros19062706
Ref: 597a19062706
Ref: c-api/structures c PyObject19063212
Ref: 5df19063212
Ref: c-api/structures c PyObject ob_refcnt19063936
Ref: aa319063936
Ref: c-api/structures c PyObject ob_type19064432
Ref: 525219064432
Ref: c-api/structures c PyVarObject19064689
Ref: 4a5b19064689
Ref: c-api/structures c PyVarObject ob_size19065178
Ref: 54a119065178
Ref: c-api/structures c PyObject_HEAD19065941
Ref: 14f919065941
Ref: c-api/structures c PyObject_VAR_HEAD19066294
Ref: 597b19066294
Ref: c-api/structures c PyBaseObject_Type19066695
Ref: 52fa19066695
Ref: c-api/structures c Py_Is19066889
Ref: aa419066889
Ref: c-api/structures c Py_IsNone19067143
Ref: aa519067143
Ref: c-api/structures c Py_IsTrue19067396
Ref: aa619067396
Ref: c-api/structures c Py_IsFalse19067649
Ref: aa719067649
Ref: c-api/structures c Py_TYPE19067905
Ref: 3c719067905
Ref: c-api/structures c Py_IS_TYPE19068428
Ref: 1bfd19068428
Ref: c-api/structures c Py_SET_TYPE19068650
Ref: 98819068650
Ref: c-api/structures c Py_SIZE19069302
Ref: 98919069302
Ref: c-api/structures c Py_SET_SIZE19069594
Ref: 98a19069594
Ref: c-api/structures c PyObject_HEAD_INIT19069750
Ref: 597c19069750
Ref: c-api/structures c PyVarObject_HEAD_INIT19070003
Ref: 597d19070003
Node: Implementing functions and methods19070294
Ref: c-api/structures implementing-functions-and-methods19070510
Ref: 597e19070510
Ref: c-api/structures c PyCFunction19070599
Ref: 169619070599
Ref: c-api/structures c PyCFunctionWithKeywords19071258
Ref: 531019071258
Ref: c-api/structures c PyCFunctionFast19071704
Ref: 530e19071704
Ref: c-api/structures c PyCFunctionFastWithKeywords19072140
Ref: 530f19072140
Ref: c-api/structures c PyCMethod19072712
Ref: 96c19072712
Ref: c-api/structures c PyMethodDef19073213
Ref: 16f519073213
Ref: c-api/structures c PyMethodDef ml_name19073489
Ref: 526e19073489
Ref: c-api/structures c PyMethodDef ml_meth19073572
Ref: 598119073572
Ref: c-api/structures c PyMethodDef ml_flags19073681
Ref: 598219073681
Ref: c-api/structures c PyMethodDef ml_doc19073795
Ref: 598319073795
Ref: c-api/structures c METH_VARARGS19074519
Ref: 172619074519
Ref: c-api/structures c METH_KEYWORDS19075213
Ref: 522619075213
Ref: c-api/structures meth-varargs-meth-keywords19075473
Ref: 597f19075473
Ref: c-api/structures c METH_FASTCALL19075910
Ref: 19fd19075910
Ref: c-api/structures meth-fastcall-meth-keywords19076505
Ref: 598019076505
Ref: c-api/structures c METH_METHOD19077173
Ref: b6c19077173
Ref: c-api/structures meth-method-meth-fastcall-meth-keywords19077408
Ref: 1a6b19077408
Ref: c-api/structures c METH_NOARGS19077933
Ref: 16f219077933
Ref: c-api/structures c METH_O19078546
Ref: 172519078546
Ref: c-api/structures c METH_CLASS19079199
Ref: 16f319079199
Ref: c-api/structures c METH_STATIC19079605
Ref: 16f419079605
Ref: c-api/structures c METH_COEXIST19080116
Ref: 169519080116
Ref: c-api/structures c PyCMethod_Type19080840
Ref: 598419080840
Ref: c-api/structures c PyCMethod_Check19081049
Ref: 598519081049
Ref: c-api/structures c PyCMethod_CheckExact19081240
Ref: 598619081240
Ref: c-api/structures c PyCMethod_New19081395
Ref: 1d0619081395
Ref: c-api/structures c PyCFunction_Type19082537
Ref: 531419082537
Ref: c-api/structures c PyCFunction_Check19082798
Ref: 598719082798
Ref: c-api/structures c PyCFunction_CheckExact19082993
Ref: 598819082993
Ref: c-api/structures c PyCFunction_NewEx19083152
Ref: 1dd419083152
Ref: c-api/structures c PyCFunction_New19083418
Ref: 1d0c19083418
Ref: c-api/structures c PyCFunction_GetFlags19083699
Ref: 531119083699
Ref: c-api/structures c PyCFunction_GET_FLAGS19084119
Ref: 598919084119
Ref: c-api/structures c PyCFunction_GetFunction19084283
Ref: 531219084283
Ref: c-api/structures c PyCFunction_GET_FUNCTION19084735
Ref: 598a19084735
Ref: c-api/structures c PyCFunction_GetSelf19084905
Ref: 531319084905
Ref: c-api/structures c PyCFunction_GET_SELF19085576
Ref: 598b19085576
Node: Accessing attributes of extension types19085766
Ref: c-api/structures accessing-attributes-of-extension-types19085945
Ref: 598c19085945
Ref: c-api/structures c PyMemberDef19086044
Ref: 77119086044
Ref: c-api/structures c PyMemberDef name19086418
Ref: 598d19086418
Ref: c-api/structures c PyMemberDef type19086631
Ref: 526f19086631
Ref: c-api/structures c PyMemberDef offset19086789
Ref: 598e19086789
Ref: c-api/structures c PyMemberDef flags19086950
Ref: 527019086950
Ref: c-api/structures c PyMemberDef doc19087086
Ref: 599019087086
Ref: c-api/structures pymemberdef-offsets19087633
Ref: 567019087633
Ref: c-api/structures c PyMember_GetOne19089010
Ref: 7aa19089010
Ref: c-api/structures c PyMember_SetOne19089476
Ref: 7ab19089476
Node: Member flags19090068
Ref: c-api/structures member-flags19090177
Ref: 599119090177
Ref: c-api/structures pymemberdef-flags19090177
Ref: 598f19090177
Ref: c-api/structures c Py_READONLY19090292
Ref: 7ae19090292
Ref: c-api/structures c Py_AUDIT_READ19090426
Ref: 7af19090426
Ref: c-api/structures c Py_RELATIVE_OFFSET19090627
Ref: 77019090627
Node: Member types19091935
Ref: c-api/structures member-types19092081
Ref: 599219092081
Ref: c-api/structures pymemberdef-types19092081
Ref: 1a4f19092081
Ref: c-api/structures c Py_T_BYTE19092978
Ref: 54c019092978
Ref: c-api/structures c Py_T_SHORT19093215
Ref: 54c619093215
Ref: c-api/structures c Py_T_INT19093449
Ref: 7ac19093449
Ref: c-api/structures c Py_T_LONG19093686
Ref: 54c319093686
Ref: c-api/structures c Py_T_LONGLONG19093926
Ref: 54c419093926
Ref: c-api/structures c Py_T_UBYTE19094159
Ref: 54c919094159
Ref: c-api/structures c Py_T_UINT19094394
Ref: 54ca19094394
Ref: c-api/structures c Py_T_USHORT19094632
Ref: 54cd19094632
Ref: c-api/structures c Py_T_ULONG19094867
Ref: 54cb19094867
Ref: c-api/structures c Py_T_ULONGLONG19095107
Ref: 54cc19095107
Ref: c-api/structures c Py_T_PYSSIZET19095342
Ref: 54c519095342
Ref: c-api/structures c Py_T_FLOAT19095575
Ref: 54c219095575
Ref: c-api/structures c Py_T_DOUBLE19095814
Ref: 7ad19095814
Ref: c-api/structures c Py_T_BOOL19096050
Ref: 54bf19096050
Ref: c-api/structures c Py_T_STRING19096289
Ref: 54c719096289
Ref: c-api/structures c Py_T_STRING_INPLACE19096518
Ref: 54c819096518
Ref: c-api/structures c Py_T_CHAR19096790
Ref: 54c119096790
Ref: c-api/structures c Py_T_OBJECT_EX19097036
Ref: 7b119097036
Ref: c-api/structures c T_OBJECT19097972
Ref: 7b019097972
Ref: c-api/structures c T_NONE19098194
Ref: 7b219098194
Node: Defining Getters and Setters19098290
Ref: c-api/structures defining-getters-and-setters19098415
Ref: 599319098415
Ref: c-api/structures c PyGetSetDef19098492
Ref: db619098492
Ref: c-api/structures c PyGetSetDef name19098809
Ref: 599419098809
Ref: c-api/structures c PyGetSetDef get19098879
Ref: 599519098879
Ref: c-api/structures c PyGetSetDef set19098979
Ref: 599619098979
Ref: c-api/structures c PyGetSetDef doc19099152
Ref: 599719099152
Ref: c-api/structures c PyGetSetDef closure19099260
Ref: 599819099260
Ref: c-api/structures c getter19099404
Ref: 552d19099404
Ref: c-api/structures c setter19099830
Ref: 553b19099830
Node: Type Object Structures19100366
Ref: c-api/typeobj doc19100632
Ref: 599919100632
Ref: c-api/typeobj translation-repo19100632
Ref: 599a19100632
Ref: c-api/typeobj type-object-structures19100632
Ref: 599b19100632
Ref: c-api/typeobj type-structs19100632
Ref: b8819100632
Node: クイックリファレンス19102553
Ref: c-api/typeobj quick-reference19102670
Ref: 599d19102670
Node: tp スロット19102857
Ref: c-api/typeobj tp-slots19102957
Ref: 599e19102957
Ref: c-api/typeobj tp-slots-table19102957
Ref: 599f19102957
Ref: tp スロット-Footnote-119116227
Ref: tp スロット-Footnote-219116539
Node: sub-slots19117314
Ref: c-api/typeobj id319117455
Ref: 59aa19117455
Ref: c-api/typeobj sub-slots19117455
Ref: 59a119117455
Node: スロットの定義型 typedef19127814
Ref: c-api/typeobj slot-typedefs19127931
Ref: 59da19127931
Ref: c-api/typeobj slot-typedefs-table19127931
Ref: 59a019127931
Node: PyTypeObject 定義19135835
Ref: c-api/typeobj pytypeobject-definition19135982
Ref: 59dc19135982
Node: PyObject スロット19139591
Ref: c-api/typeobj pyobject-slots19139732
Ref: 59dd19139732
Node: PyVarObject スロット19141855
Ref: c-api/typeobj pyvarobject-slots19142002
Ref: 59de19142002
Node: PyTypeObject スロット19142596
Ref: c-api/typeobj pytypeobject-slots19142734
Ref: 59df19142734
Ref: c-api/typeobj c PyTypeObject tp_name19143098
Ref: 1d0b19143098
Ref: c-api/typeobj c PyTypeObject tp_basicsize19144962
Ref: b8219144962
Ref: c-api/typeobj c PyTypeObject tp_itemsize19145058
Ref: 241b19145058
Ref: c-api/typeobj c PyTypeObject tp_dealloc19149218
Ref: 524119149218
Ref: c-api/typeobj c Py_tp_dealloc19149423
Ref: 550b19149423
Ref: c-api/typeobj c PyTypeObject tp_vectorcall_offset19154767
Ref: 561a19154767
Ref: c-api/typeobj c PyTypeObject tp_getattr19156711
Ref: 527219156711
Ref: c-api/typeobj c Py_tp_getattr19156917
Ref: 551219156917
Ref: c-api/typeobj c PyTypeObject tp_setattr19157775
Ref: 527319157775
Ref: c-api/typeobj c Py_tp_setattr19157981
Ref: 551f19157981
Ref: c-api/typeobj c PyTypeObject tp_as_async19158842
Ref: 10d319158842
Ref: c-api/typeobj c PyTypeObject tp_repr19159622
Ref: 526919159622
Ref: c-api/typeobj c Py_tp_repr19159819
Ref: 551d19159819
Ref: c-api/typeobj c PyTypeObject tp_as_number19160989
Ref: b8619160989
Ref: c-api/typeobj c PyTypeObject tp_as_sequence19161484
Ref: 59a219161484
Ref: c-api/typeobj c PyTypeObject tp_as_mapping19162003
Ref: 59a319162003
Ref: c-api/typeobj c PyTypeObject tp_hash19162514
Ref: 527b19162514
Ref: c-api/typeobj c Py_tp_hash19162711
Ref: 551519162711
Ref: c-api/typeobj c PyTypeObject tp_call19164611
Ref: 77b19164611
Ref: c-api/typeobj c Py_tp_call19164811
Ref: 550919164811
Ref: c-api/typeobj c PyTypeObject tp_str19165288
Ref: 526a19165288
Ref: c-api/typeobj c Py_tp_str19165473
Ref: 552119165473
Ref: c-api/typeobj c PyTypeObject tp_getattro19166749
Ref: 1ac519166749
Ref: c-api/typeobj c Py_tp_getattro19166958
Ref: 551319166958
Ref: c-api/typeobj c PyTypeObject tp_setattro19167924
Ref: 526d19167924
Ref: c-api/typeobj c Py_tp_setattro19168133
Ref: 552019168133
Ref: c-api/typeobj c PyTypeObject tp_as_buffer19169250
Ref: b8419169250
Ref: c-api/typeobj c PyTypeObject tp_flags19169870
Ref: 1cce19169870
Ref: c-api/typeobj c Py_TPFLAGS_HEAPTYPE19172175
Ref: ab019172175
Ref: c-api/typeobj c Py_TPFLAGS_BASETYPE19172981
Ref: 525a19172981
Ref: c-api/typeobj c Py_TPFLAGS_READY19173413
Ref: 59e519173413
Ref: c-api/typeobj c Py_TPFLAGS_READYING19173636
Ref: 59e619173636
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_GC19173858
Ref: 98519173858
Ref: c-api/typeobj c Py_TPFLAGS_DEFAULT19174922
Ref: 524f19174922
Ref: c-api/typeobj c Py_TPFLAGS_METHOD_DESCRIPTOR19175324
Ref: 54bd19175324
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_DICT19176340
Ref: 60f19176340
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_WEAKREF19177008
Ref: 77c19177008
Ref: c-api/typeobj c Py_TPFLAGS_ITEMS_AT_END19177331
Ref: 76d19177331
Ref: c-api/typeobj c Py_TPFLAGS_LONG_SUBCLASS19178088
Ref: 566219178088
Ref: c-api/typeobj c Py_TPFLAGS_LIST_SUBCLASS19178139
Ref: 59e819178139
Ref: c-api/typeobj c Py_TPFLAGS_TUPLE_SUBCLASS19178190
Ref: 59e919178190
Ref: c-api/typeobj c Py_TPFLAGS_BYTES_SUBCLASS19178242
Ref: 59ea19178242
Ref: c-api/typeobj c Py_TPFLAGS_UNICODE_SUBCLASS19178294
Ref: 59eb19178294
Ref: c-api/typeobj c Py_TPFLAGS_DICT_SUBCLASS19178348
Ref: 59ec19178348
Ref: c-api/typeobj c Py_TPFLAGS_BASE_EXC_SUBCLASS19178399
Ref: 59ed19178399
Ref: c-api/typeobj c Py_TPFLAGS_TYPE_SUBCLASS19178454
Ref: 59ee19178454
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_FINALIZE19179069
Ref: 42519179069
Ref: c-api/typeobj c _Py_TPFLAGS_HAVE_VECTORCALL19179495
Ref: 59ef19179495
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VECTORCALL19179495
Ref: 77619179495
Ref: c-api/typeobj c Py_TPFLAGS_IMMUTABLETYPE19180368
Ref: 3cd19180368
Ref: c-api/typeobj c Py_TPFLAGS_DISALLOW_INSTANTIATION19180738
Ref: 7a219180738
Ref: c-api/typeobj c Py_TPFLAGS_MAPPING19181869
Ref: 1cb519181869
Ref: c-api/typeobj c Py_TPFLAGS_SEQUENCE19182712
Ref: 1cb619182712
Ref: c-api/typeobj c Py_TPFLAGS_VALID_VERSION_TAG19183556
Ref: 59f019183556
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VERSION_TAG19183896
Ref: 15e819183896
Ref: c-api/typeobj c Py_TPFLAGS_INLINE_VALUES19184152
Ref: 59f119184152
Ref: c-api/typeobj c Py_TPFLAGS_IS_ABSTRACT19184561
Ref: 59f219184561
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_STACKLESS_EXTENSION19184836
Ref: 59e719184836
Ref: c-api/typeobj c PyTypeObject tp_doc19185195
Ref: 525019185195
Ref: c-api/typeobj c Py_tp_doc19185370
Ref: 550f19185370
Ref: c-api/typeobj c PyTypeObject tp_traverse19185664
Ref: 98619185664
Ref: c-api/typeobj c Py_tp_traverse19185873
Ref: 552219185873
Ref: c-api/typeobj c PyTypeObject tp_clear19190317
Ref: 526719190317
Ref: c-api/typeobj c Py_tp_clear19190515
Ref: 550a19190515
Ref: c-api/typeobj c PyTypeObject tp_richcompare19197851
Ref: 527519197851
Ref: c-api/typeobj c Py_tp_richcompare19198065
Ref: 551e19198065
Ref: c-api/typeobj c Py_LT19199070
Ref: 560d19199070
Ref: c-api/typeobj c Py_LE19199174
Ref: 560e19199174
Ref: c-api/typeobj c Py_EQ19199279
Ref: 560f19199279
Ref: c-api/typeobj c Py_NE19199384
Ref: 561019199384
Ref: c-api/typeobj c Py_GT19199489
Ref: 561119199489
Ref: c-api/typeobj c Py_GE19199593
Ref: 561219199593
Ref: c-api/typeobj c Py_RETURN_RICHCOMPARE19199766
Ref: db119199766
Ref: c-api/typeobj c PyTypeObject tp_weaklistoffset19201238
Ref: b8319201238
Ref: c-api/typeobj c PyTypeObject tp_iter19203150
Ref: 170d19203150
Ref: c-api/typeobj c Py_tp_iter19203350
Ref: 551819203350
Ref: c-api/typeobj c PyTypeObject tp_iternext19203978
Ref: 170e19203978
Ref: c-api/typeobj c Py_tp_iternext19204187
Ref: 551919204187
Ref: c-api/typeobj c PyTypeObject tp_methods19205275
Ref: 525919205275
Ref: c-api/typeobj c Py_tp_methods19205489
Ref: 551b19205489
Ref: c-api/typeobj c PyTypeObject tp_members19206059
Ref: 525719206059
Ref: c-api/typeobj c Py_tp_members19206272
Ref: 551a19206272
Ref: c-api/typeobj c PyTypeObject tp_getset19206872
Ref: 525c19206872
Ref: c-api/typeobj c Py_tp_getset19207083
Ref: 551419207083
Ref: c-api/typeobj c PyTypeObject tp_base19207665
Ref: 23d119207665
Ref: c-api/typeobj c Py_tp_base19207866
Ref: 550719207866
Ref: c-api/typeobj c PyTypeObject tp_dict19209321
Ref: 1aed19209321
Ref: c-api/typeobj c PyTypeObject tp_descr_get19210954
Ref: 59a419210954
Ref: c-api/typeobj c Py_tp_descr_get19211165
Ref: 550d19211165
Ref: c-api/typeobj c PyTypeObject tp_descr_set19211481
Ref: 1d0f19211481
Ref: c-api/typeobj c Py_tp_descr_set19211692
Ref: 550e19211692
Ref: c-api/typeobj c PyTypeObject tp_dictoffset19212117
Ref: 566f19212117
Ref: c-api/typeobj c PyTypeObject tp_init19214150
Ref: 7a119214150
Ref: c-api/typeobj c Py_tp_init19214347
Ref: 551619214347
Ref: c-api/typeobj c PyTypeObject tp_alloc19215887
Ref: 525519215887
Ref: c-api/typeobj c Py_tp_alloc19216087
Ref: 550619216087
Ref: c-api/typeobj c PyTypeObject tp_new19216701
Ref: 79f19216701
Ref: c-api/typeobj c Py_tp_new19216885
Ref: 551c19216885
Ref: c-api/typeobj c PyTypeObject tp_free19218805
Ref: 525419218805
Ref: c-api/typeobj c Py_tp_free19219002
Ref: 551119219002
Ref: c-api/typeobj c PyTypeObject tp_is_gc19220031
Ref: 59a519220031
Ref: c-api/typeobj c Py_tp_is_gc19220229
Ref: 551719220229
Ref: c-api/typeobj c PyTypeObject tp_bases19221465
Ref: 59a619221465
Ref: c-api/typeobj c Py_tp_bases19221664
Ref: 550819221664
Ref: c-api/typeobj c PyTypeObject tp_mro19222387
Ref: 567119222387
Ref: c-api/typeobj c PyTypeObject tp_cache19223034
Ref: 567219223034
Ref: c-api/typeobj c PyTypeObject tp_subclasses19223276
Ref: 79219223276
Ref: c-api/typeobj c PyTypeObject tp_weaklist19223766
Ref: 567319223766
Ref: c-api/typeobj c PyTypeObject tp_del19224367
Ref: 59a719224367
Ref: c-api/typeobj c Py_tp_del19224564
Ref: 550c19224564
Ref: c-api/typeobj c PyTypeObject tp_version_tag19224693
Ref: 59a819224693
Ref: c-api/typeobj c PyTypeObject tp_finalize19224979
Ref: ca119224979
Ref: c-api/typeobj c Py_tp_finalize19225216
Ref: 551019225216
Ref: c-api/typeobj c PyTypeObject tp_vectorcall19232631
Ref: 19ea19232631
Ref: c-api/typeobj c Py_tp_vectorcall19232876
Ref: 552319232876
Ref: c-api/typeobj c PyTypeObject tp_watched19234507
Ref: 59a919234507
Ref: PyTypeObject スロット-Footnote-119234677
Ref: PyTypeObject スロット-Footnote-219234719
Ref: PyTypeObject スロット-Footnote-319234761
Ref: PyTypeObject スロット-Footnote-419234804
Node: Static Types19234846
Ref: c-api/typeobj id419234970
Ref: 59f319234970
Ref: c-api/typeobj static-types19234970
Ref: 98719234970
Node: Heap Types19235875
Ref: c-api/typeobj heap-types19236007
Ref: b6219236007
Ref: c-api/typeobj id519236007
Ref: 59f419236007
Node: 数値オブジェクト構造体19236510
Ref: c-api/typeobj number-object-structures19236666
Ref: 59f519236666
Ref: c-api/typeobj number-structs19236666
Ref: 59e119236666
Ref: c-api/typeobj c PyNumberMethods19236744
Ref: 163c19236744
Ref: c-api/typeobj c PyNumberMethods nb_add19239469
Ref: 566519239469
Ref: c-api/typeobj c Py_nb_add19239670
Ref: 54dc19239670
Ref: c-api/typeobj c PyNumberMethods nb_subtract19239672
Ref: 59b119239672
Ref: c-api/typeobj c Py_nb_subtract19239883
Ref: 54fb19239883
Ref: c-api/typeobj c PyNumberMethods nb_multiply19239885
Ref: 59b319239885
Ref: c-api/typeobj c Py_nb_multiply19240096
Ref: 54f419240096
Ref: c-api/typeobj c PyNumberMethods nb_remainder19240098
Ref: 59b519240098
Ref: c-api/typeobj c Py_nb_remainder19240311
Ref: 54f919240311
Ref: c-api/typeobj c PyNumberMethods nb_divmod19240313
Ref: 59b719240313
Ref: c-api/typeobj c Py_nb_divmod19240520
Ref: 54df19240520
Ref: c-api/typeobj c PyNumberMethods nb_power19240522
Ref: 59b819240522
Ref: c-api/typeobj c Py_nb_power19240728
Ref: 54f819240728
Ref: c-api/typeobj c PyNumberMethods nb_negative19240730
Ref: 59ba19240730
Ref: c-api/typeobj c Py_nb_negative19240940
Ref: 54f519240940
Ref: c-api/typeobj c PyNumberMethods nb_positive19240942
Ref: 59bb19240942
Ref: c-api/typeobj c Py_nb_positive19241152
Ref: 54f719241152
Ref: c-api/typeobj c PyNumberMethods nb_absolute19241154
Ref: 59bc19241154
Ref: c-api/typeobj c Py_nb_absolute19241364
Ref: 54db19241364
Ref: c-api/typeobj c PyNumberMethods nb_bool19241366
Ref: 59bd19241366
Ref: c-api/typeobj c Py_nb_bool19241566
Ref: 54de19241566
Ref: c-api/typeobj c PyNumberMethods nb_invert19241568
Ref: 59be19241568
Ref: c-api/typeobj c Py_nb_invert19241774
Ref: 54f119241774
Ref: c-api/typeobj c PyNumberMethods nb_lshift19241776
Ref: 59bf19241776
Ref: c-api/typeobj c Py_nb_lshift19241983
Ref: 54f219241983
Ref: c-api/typeobj c PyNumberMethods nb_rshift19241985
Ref: 59c119241985
Ref: c-api/typeobj c Py_nb_rshift19242192
Ref: 54fa19242192
Ref: c-api/typeobj c PyNumberMethods nb_and19242194
Ref: 59c319242194
Ref: c-api/typeobj c Py_nb_and19242395
Ref: 54dd19242395
Ref: c-api/typeobj c PyNumberMethods nb_xor19242397
Ref: 59c519242397
Ref: c-api/typeobj c Py_nb_xor19242598
Ref: 54fd19242598
Ref: c-api/typeobj c PyNumberMethods nb_or19242600
Ref: 59c719242600
Ref: c-api/typeobj c Py_nb_or19242799
Ref: 54f619242799
Ref: c-api/typeobj c PyNumberMethods nb_int19242801
Ref: 59c919242801
Ref: c-api/typeobj c Py_nb_int19243001
Ref: 54f019243001
Ref: c-api/typeobj c PyNumberMethods nb_reserved19243003
Ref: 59ca19243003
Ref: c-api/typeobj c PyNumberMethods nb_float19243076
Ref: 59cb19243076
Ref: c-api/typeobj c Py_nb_float19243280
Ref: 54e019243280
Ref: c-api/typeobj c PyNumberMethods nb_inplace_add19243282
Ref: 59b019243282
Ref: c-api/typeobj c Py_nb_inplace_add19243499
Ref: 54e319243499
Ref: c-api/typeobj c PyNumberMethods nb_inplace_subtract19243501
Ref: 59b219243501
Ref: c-api/typeobj c Py_nb_inplace_subtract19243728
Ref: 54ed19243728
Ref: c-api/typeobj c PyNumberMethods nb_inplace_multiply19243730
Ref: 59b419243730
Ref: c-api/typeobj c Py_nb_inplace_multiply19243957
Ref: 54e819243957
Ref: c-api/typeobj c PyNumberMethods nb_inplace_remainder19243959
Ref: 59b619243959
Ref: c-api/typeobj c Py_nb_inplace_remainder19244188
Ref: 54eb19244188
Ref: c-api/typeobj c PyNumberMethods nb_inplace_power19244190
Ref: 59b919244190
Ref: c-api/typeobj c Py_nb_inplace_power19244412
Ref: 54ea19244412
Ref: c-api/typeobj c PyNumberMethods nb_inplace_lshift19244414
Ref: 59c019244414
Ref: c-api/typeobj c Py_nb_inplace_lshift19244637
Ref: 54e619244637
Ref: c-api/typeobj c PyNumberMethods nb_inplace_rshift19244639
Ref: 59c219244639
Ref: c-api/typeobj c Py_nb_inplace_rshift19244862
Ref: 54ec19244862
Ref: c-api/typeobj c PyNumberMethods nb_inplace_and19244864
Ref: 59c419244864
Ref: c-api/typeobj c Py_nb_inplace_and19245081
Ref: 54e419245081
Ref: c-api/typeobj c PyNumberMethods nb_inplace_xor19245083
Ref: 59c619245083
Ref: c-api/typeobj c Py_nb_inplace_xor19245300
Ref: 54ef19245300
Ref: c-api/typeobj c PyNumberMethods nb_inplace_or19245302
Ref: 59c819245302
Ref: c-api/typeobj c Py_nb_inplace_or19245517
Ref: 54e919245517
Ref: c-api/typeobj c PyNumberMethods nb_floor_divide19245519
Ref: 59cc19245519
Ref: c-api/typeobj c Py_nb_floor_divide19245738
Ref: 54e119245738
Ref: c-api/typeobj c PyNumberMethods nb_true_divide19245740
Ref: 59ce19245740
Ref: c-api/typeobj c Py_nb_true_divide19245957
Ref: 54fc19245957
Ref: c-api/typeobj c PyNumberMethods nb_inplace_floor_divide19245959
Ref: 59cd19245959
Ref: c-api/typeobj c Py_nb_inplace_floor_divide19246195
Ref: 54e519246195
Ref: c-api/typeobj c PyNumberMethods nb_inplace_true_divide19246196
Ref: 59cf19246196
Ref: c-api/typeobj c Py_nb_inplace_true_divide19246430
Ref: 54ee19246430
Ref: c-api/typeobj c PyNumberMethods nb_index19246431
Ref: 163b19246431
Ref: c-api/typeobj c Py_nb_index19246635
Ref: 54e219246635
Ref: c-api/typeobj c PyNumberMethods nb_matrix_multiply19246637
Ref: 59d019246637
Ref: c-api/typeobj c Py_nb_matrix_multiply19246892
Ref: 54f319246892
Ref: c-api/typeobj c PyNumberMethods nb_inplace_matrix_multiply19246894
Ref: 59d119246894
Ref: c-api/typeobj c Py_nb_inplace_matrix_multiply19247170
Ref: 54e719247170
Node: マップオブジェクト構造体19247172
Ref: c-api/typeobj mapping-object-structures19247360
Ref: 59f619247360
Ref: c-api/typeobj mapping-structs19247360
Ref: 59e319247360
Ref: c-api/typeobj c PyMappingMethods19247443
Ref: 527a19247443
Ref: c-api/typeobj c PyMappingMethods mp_length19247685
Ref: 59d219247685
Ref: c-api/typeobj c Py_mp_length19247890
Ref: 54d919247890
Ref: c-api/typeobj c PyMappingMethods mp_subscript19248217
Ref: 1d5419248217
Ref: c-api/typeobj c Py_mp_subscript19248431
Ref: 54da19248431
Ref: c-api/typeobj c PyMappingMethods mp_ass_subscript19248806
Ref: 59d319248806
Ref: c-api/typeobj c Py_mp_ass_subscript19249031
Ref: 54d819249031
Node: シーケンスオブジェクト構造体19249427
Ref: c-api/typeobj sequence-object-structures19249645
Ref: 59f719249645
Ref: c-api/typeobj sequence-structs19249645
Ref: 59e219249645
Ref: c-api/typeobj c PySequenceMethods19249738
Ref: 527919249738
Ref: c-api/typeobj c PySequenceMethods sq_length19249939
Ref: 566e19249939
Ref: c-api/typeobj c Py_sq_length19250145
Ref: 550419250145
Ref: c-api/typeobj c PySequenceMethods sq_concat19250401
Ref: 59d419250401
Ref: c-api/typeobj c Py_sq_concat19250610
Ref: 54ff19250610
Ref: c-api/typeobj c PySequenceMethods sq_repeat19250872
Ref: 59d519250872
Ref: c-api/typeobj c Py_sq_repeat19251083
Ref: 550519251083
Ref: c-api/typeobj c PySequenceMethods sq_item19251349
Ref: 1d5319251349
Ref: c-api/typeobj c Py_sq_item19251556
Ref: 550319251556
Ref: c-api/typeobj c PySequenceMethods sq_ass_item19252226
Ref: 59d619252226
Ref: c-api/typeobj c Py_sq_ass_item19252444
Ref: 54fe19252444
Ref: c-api/typeobj c PySequenceMethods sq_contains19252839
Ref: 59d719252839
Ref: c-api/typeobj c Py_sq_contains19253052
Ref: 550019253052
Ref: c-api/typeobj c PySequenceMethods sq_inplace_concat19253394
Ref: 59d819253394
Ref: c-api/typeobj c Py_sq_inplace_concat19253619
Ref: 550119253619
Ref: c-api/typeobj c PySequenceMethods sq_inplace_repeat19254073
Ref: 59d919254073
Ref: c-api/typeobj c Py_sq_inplace_repeat19254300
Ref: 550219254300
Node: バッファオブジェクト構造体 buffer object structure19254765
Ref: c-api/typeobj buffer-object-structures19254980
Ref: 59f819254980
Ref: c-api/typeobj buffer-structs19254980
Ref: 124c19254980
Ref: c-api/typeobj c PyBufferProcs19255120
Ref: 567419255120
Ref: c-api/typeobj c PyBufferProcs bf_getbuffer19255492
Ref: 96a19255492
Ref: c-api/typeobj c Py_bf_getbuffer19255737
Ref: 54d419255737
Ref: c-api/typeobj c PyBufferProcs bf_releasebuffer19258848
Ref: 96b19258848
Ref: c-api/typeobj c Py_bf_releasebuffer19259105
Ref: 54d519259105
Node: async オブジェクト構造体19260929
Ref: c-api/typeobj async-object-structures19261120
Ref: 59f919261120
Ref: c-api/typeobj async-structs19261120
Ref: 59e019261120
Ref: c-api/typeobj c PyAsyncMethods19261223
Ref: 566d19261223
Ref: c-api/typeobj c PyAsyncMethods am_await19261712
Ref: 59ab19261712
Ref: c-api/typeobj c Py_am_await19261945
Ref: 54d219261945
Ref: c-api/typeobj c PyAsyncMethods am_aiter19262423
Ref: 59ac19262423
Ref: c-api/typeobj c Py_am_aiter19262656
Ref: 54d019262656
Ref: c-api/typeobj c PyAsyncMethods am_anext19263038
Ref: 59ad19263038
Ref: c-api/typeobj c Py_am_anext19263271
Ref: 54d119263271
Ref: c-api/typeobj c PyAsyncMethods am_send19263518
Ref: 59ae19263518
Ref: c-api/typeobj c Py_am_send19263749
Ref: 54d319263749
Node: Slot Type typedefs19264016
Ref: c-api/typeobj id619264157
Ref: 59db19264157
Ref: c-api/typeobj slot-type-typedefs19264157
Ref: 59fa19264157
Ref: c-api/typeobj c allocfunc19264216
Ref: 552419264216
Ref: c-api/typeobj c destructor19265403
Ref: 552819265403
Ref: c-api/typeobj c freefunc19265528
Ref: 57c719265528
Ref: c-api/typeobj c newfunc19265642
Ref: 553319265642
Ref: c-api/typeobj c initproc19265908
Ref: 552f19265908
Ref: c-api/typeobj c reprfunc19266144
Ref: 553719266144
Ref: c-api/typeobj c getattrfunc19266353
Ref: 552919266353
Ref: c-api/typeobj c setattrfunc19266582
Ref: 553919266582
Ref: c-api/typeobj c getattrofunc19266916
Ref: 552a19266916
Ref: c-api/typeobj c setattrofunc19267224
Ref: 553a19267224
Ref: c-api/typeobj c descrgetfunc19267647
Ref: 552619267647
Ref: c-api/typeobj c descrsetfunc19267910
Ref: 552719267910
Ref: c-api/typeobj c hashfunc19268155
Ref: 552e19268155
Ref: c-api/typeobj c richcmpfunc19268365
Ref: 553819268365
Ref: c-api/typeobj c getiterfunc19268611
Ref: 552c19268611
Ref: c-api/typeobj c iternextfunc19268823
Ref: 553119268823
Ref: c-api/typeobj c lenfunc19269040
Ref: 553219269040
Ref: c-api/typeobj c getbufferproc19269190
Ref: 552b19269190
Ref: c-api/typeobj c releasebufferproc19269387
Ref: 553619269387
Ref: c-api/typeobj c unaryfunc19269584
Ref: 554019269584
Ref: c-api/typeobj c binaryfunc19269735
Ref: 552519269735
Ref: c-api/typeobj c sendfunc19269910
Ref: 59af19269910
Ref: c-api/typeobj c ternaryfunc19270128
Ref: 553e19270128
Ref: c-api/typeobj c ssizeargfunc19270327
Ref: 553c19270327
Ref: c-api/typeobj c ssizeobjargproc19270505
Ref: 553d19270505
Ref: c-api/typeobj c objobjproc19270690
Ref: 553519270690
Ref: c-api/typeobj c objobjargproc19270847
Ref: 553419270847
Node: 使用例<57>19271030
Ref: c-api/typeobj examples19271129
Ref: 59fb19271129
Ref: c-api/typeobj typedef-examples19271129
Ref: 599c19271129
Node: 循環参照ガベージコレクションをサポートする19276756
Ref: c-api/gcsupport doc19276953
Ref: 59fc19276953
Ref: c-api/gcsupport supporting-cycle-detection19276953
Ref: 59e419276953
Ref: c-api/gcsupport supporting-cyclic-garbage-collection19276953
Ref: 59fd19276953
Ref: c-api/gcsupport translation-repo19276953
Ref: 59fe19276953
Ref: c-api/gcsupport c PyObject_GC_New19279889
Ref: c9d19279889
Ref: c-api/gcsupport c PyObject_GC_NewVar19280696
Ref: c9e19280696
Ref: c-api/gcsupport c PyUnstable_Object_GC_NewWithExtraData19281518
Ref: 1b0a19281518
Ref: c-api/gcsupport c PyObject_GC_Resize19282757
Ref: 1b0f19282757
Ref: c-api/gcsupport c PyObject_GC_Track19283147
Ref: 172219283147
Ref: c-api/gcsupport c PyObject_IS_GC19283758
Ref: b7f19283758
Ref: c-api/gcsupport c PyObject_GC_IsTracked19284010
Ref: b7119284010
Ref: c-api/gcsupport c PyObject_GC_IsFinalized19284416
Ref: b7219284416
Ref: c-api/gcsupport c PyObject_GC_Del19284825
Ref: 172119284825
Ref: c-api/gcsupport c PyObject_GC_UnTrack19285616
Ref: 172319285616
Ref: c-api/gcsupport c visitproc19286538
Ref: 554119286538
Ref: c-api/gcsupport c traverseproc19287333
Ref: 553f19287333
Ref: c-api/gcsupport c Py_VISIT19288344
Ref: 525e19288344
Ref: c-api/gcsupport c inquiry19289005
Ref: 553019289005
Node: Controlling the Garbage Collector State19289879
Ref: c-api/gcsupport controlling-the-garbage-collector-state19290059
Ref: 59ff19290059
Ref: c-api/gcsupport c PyGC_Collect19290243
Ref: b8919290243
Ref: c-api/gcsupport c PyGC_Enable19290819
Ref: aa819290819
Ref: c-api/gcsupport c PyGC_Disable19291109
Ref: aa919291109
Ref: c-api/gcsupport c PyGC_IsEnabled19291402
Ref: aaa19291402
Node: Querying Garbage Collector State19291715
Ref: c-api/gcsupport querying-garbage-collector-state19291895
Ref: 5a0019291895
Ref: c-api/gcsupport c PyUnstable_GC_VisitObjects19292078
Ref: 5a0119292078
Ref: c-api/gcsupport c gcvisitobjects_t19292930
Ref: 5a0219292930
Node: API と ABI のバージョニング19293428
Ref: c-api/apiabiversion doc19293630
Ref: 5a0319293630
Ref: c-api/apiabiversion api-and-abi-versioning19293630
Ref: 5a0419293630
Ref: c-api/apiabiversion apiabiversion19293630
Ref: 4ca619293630
Ref: c-api/apiabiversion translation-repo19293630
Ref: 5a0519293630
Node: Build-time version constants19293793
Ref: c-api/apiabiversion build-time-version-constants19293919
Ref: 5a0619293919
Ref: c-api/apiabiversion c PY_MAJOR_VERSION19294304
Ref: 5a0719294304
Ref: c-api/apiabiversion c PY_MINOR_VERSION19294378
Ref: 5a0819294378
Ref: c-api/apiabiversion c PY_MICRO_VERSION19294452
Ref: 5a0919294452
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL19294526
Ref: 5a0a19294526
Ref: c-api/apiabiversion c PY_RELEASE_SERIAL19294749
Ref: 5a0b19294749
Ref: c-api/apiabiversion c PY_VERSION_HEX19294869
Ref: 38019294869
Ref: Build-time version constants-Footnote-119295218
Node: Run-time version19295291
Ref: c-api/apiabiversion run-time-version19295444
Ref: 5a0c19295444
Ref: c-api/apiabiversion c Py_Version19295493
Ref: 37f19295493
Node: Bit-packing macros19295943
Ref: c-api/apiabiversion bit-packing-macros19296059
Ref: 5a0d19296059
Ref: c-api/apiabiversion c Py_PACK_FULL_VERSION19296112
Ref: 37e19296112
Ref: c-api/apiabiversion c Py_PACK_VERSION19299771
Ref: 37d19299771
Node: Monitoring C API19300121
Ref: c-api/monitoring doc19300284
Ref: 5a0e19300284
Ref: c-api/monitoring c-api-monitoring19300284
Ref: 48519300284
Ref: c-api/monitoring monitoring-c-api19300284
Ref: 5a0f19300284
Ref: c-api/monitoring translation-repo19300284
Ref: 5a1019300284
Node: Generating Execution Events19300538
Ref: c-api/monitoring generating-execution-events19300656
Ref: 5a1119300656
Ref: c-api/monitoring c PyMonitoringState19301591
Ref: 5be19301591
Ref: c-api/monitoring c PyMonitoring_FirePyStartEvent19301964
Ref: 5bf19301964
Ref: c-api/monitoring c PyMonitoring_FirePyResumeEvent19302124
Ref: 5c019302124
Ref: c-api/monitoring c PyMonitoring_FirePyReturnEvent19302286
Ref: 5c119302286
Ref: c-api/monitoring c PyMonitoring_FirePyYieldEvent19302466
Ref: 5c219302466
Ref: c-api/monitoring c PyMonitoring_FireCallEvent19302644
Ref: 5c319302644
Ref: c-api/monitoring c PyMonitoring_FireLineEvent19302843
Ref: 5c419302843
Ref: c-api/monitoring c PyMonitoring_FireJumpEvent19303008
Ref: 5c519303008
Ref: c-api/monitoring c PyMonitoring_FireBranchLeftEvent19303186
Ref: 3ab19303186
Ref: c-api/monitoring c PyMonitoring_FireBranchRightEvent19303387
Ref: 3ac19303387
Ref: c-api/monitoring c PyMonitoring_FireCReturnEvent19303590
Ref: 5c619303590
Ref: c-api/monitoring c PyMonitoring_FirePyThrowEvent19303768
Ref: 5c719303768
Ref: c-api/monitoring c PyMonitoring_FireRaiseEvent19304016
Ref: 5c819304016
Ref: c-api/monitoring c PyMonitoring_FireCRaiseEvent19304259
Ref: 5c919304259
Ref: c-api/monitoring c PyMonitoring_FireReraiseEvent19304505
Ref: 5ca19304505
Ref: c-api/monitoring c PyMonitoring_FireExceptionHandledEvent19304752
Ref: 5cb19304752
Ref: c-api/monitoring c PyMonitoring_FirePyUnwindEvent19305019
Ref: 5cc19305019
Ref: c-api/monitoring c PyMonitoring_FireStopIterationEvent19305269
Ref: 5cd19305269
Node: Managing the Monitoring State19305676
Ref: c-api/monitoring managing-the-monitoring-state19305769
Ref: 5a1219305769
Ref: c-api/monitoring c PyMonitoring_EnterScope19305972
Ref: 5ce19305972
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_LEFT19308034
Ref: 5a1319308034
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_RIGHT19308245
Ref: 5a1419308245
Ref: c-api/monitoring c PY_MONITORING_EVENT_CALL19308448
Ref: 5a1519308448
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RAISE19308655
Ref: 5a1619308655
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RETURN19308863
Ref: 5a1719308863
Ref: c-api/monitoring c PY_MONITORING_EVENT_EXCEPTION_HANDLED19309042
Ref: 5a1819309042
Ref: c-api/monitoring c PY_MONITORING_EVENT_INSTRUCTION19309231
Ref: 5a1919309231
Ref: c-api/monitoring c PY_MONITORING_EVENT_JUMP19309435
Ref: 5a1a19309435
Ref: c-api/monitoring c PY_MONITORING_EVENT_LINE19309639
Ref: 5a1b19309639
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RESUME19309848
Ref: 5a1c19309848
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RETURN19310057
Ref: 5a1d19310057
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_START19310265
Ref: 5a1e19310265
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_THROW19310473
Ref: 5a1f19310473
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_UNWIND19310682
Ref: 5a2019310682
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_YIELD19310890
Ref: 5a2119310890
Ref: c-api/monitoring c PY_MONITORING_EVENT_RAISE19311095
Ref: 5a2219311095
Ref: c-api/monitoring c PY_MONITORING_EVENT_RERAISE19311302
Ref: 5a2319311302
Ref: c-api/monitoring c PY_MONITORING_EVENT_STOP_ITERATION19311516
Ref: 5a2419311516
Ref: c-api/monitoring c PyMonitoring_ExitScope19311611
Ref: 5cf19311611
Ref: c-api/monitoring c PY_MONITORING_IS_INSTRUMENTED_EVENT19311749
Ref: 5a2519311749
Node: Python モジュールのインストール19312004
Ref: installing/index doc19312146
Ref: 5a2619312146
Ref: installing/index installing-index19312146
Ref: 10fc19312146
Ref: installing/index installing-python-modules19312146
Ref: 5a2719312146
Ref: installing/index translation-repo19312146
Ref: 5a2819312146
Ref: Python モジュールのインストール-Footnote-119313705
Node: 重要用語集19313783
Ref: installing/index key-terms19313911
Ref: 5a2919313911
Ref: 重要用語集-Footnote-119315279
Ref: 重要用語集-Footnote-219315304
Ref: 重要用語集-Footnote-319315333
Ref: 重要用語集-Footnote-419315365
Node: 基本的な使い方<5>19315445
Ref: installing/index basic-usage19315610
Ref: 5a2a19315610
Ref: 基本的な使い方<5>-Footnote-119317546
Ref: 基本的な使い方<5>-Footnote-219317583
Node: どうすればいいの ？19317632
Ref: installing/index how-do-i19317830
Ref: 5a2b19317830
Node: パッケージを現在のユーザ用のみにインストールするには？19318536
Ref: installing/index install-packages-just-for-the-current-user19318774
Ref: 5a2c19318774
Node: 科学技術計算用の Python パッケージをインストールするには？19319161
Ref: installing/index install-scientific-python-packages19319500
Ref: 5a2d19319500
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-119320048
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-219320094
Node: インストールされた複数のバージョンの Python を並行して使うには？19320140
Ref: installing/index work-with-multiple-versions-of-python-installed-in-parallel19320389
Ref: 5a2e19320389
Node: よくあるインストールに関する問題19321147
Ref: installing/index common-installation-issues19321312
Ref: 5a2f19321312
Node: Linux で、システムの Python 内にインストールする19321578
Ref: installing/index installing-into-the-system-python-on-linux19321780
Ref: 5a3019321780
Node: pip がインストールされていない19322376
Ref: installing/index pip-not-installed19322629
Ref: 5a3119322629
Ref: pip がインストールされていない-Footnote-119322942
Node: バイナリの拡張のインストール19323068
Ref: installing/index installing-binary-extensions19323247
Ref: 5a3219323247
Ref: バイナリの拡張のインストール-Footnote-119324042
Ref: バイナリの拡張のインストール-Footnote-219324088
Node: Python HOWTO19324137
Ref: howto/index doc19324275
Ref: 5a3319324275
Ref: howto/index how-tos19324275
Ref: 5a3419324275
Ref: howto/index python-howtos19324275
Ref: 5a3519324275
Ref: howto/index translation-repo19324275
Ref: 5a3619324275
Node: A Conceptual Overview of asyncio19325799
Ref: howto/a-conceptual-overview-of-asyncio doc19325931
Ref: 5a3719325931
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-of-asyncio19325931
Ref: 385319325931
Ref: howto/a-conceptual-overview-of-asyncio id119325931
Ref: 5a3819325931
Ref: A Conceptual Overview of asyncio-Footnote-119327297
Ref: A Conceptual Overview of asyncio-Footnote-219327378
Ref: A Conceptual Overview of asyncio-Footnote-319327471
Node: A conceptual overview part 1 the high-level19327552
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-1-the-high-level19327720
Ref: 5a3919327720
Node: Event Loop19328076
Ref: howto/a-conceptual-overview-of-asyncio event-loop19328212
Ref: 5a3a19328212
Node: Asynchronous functions and coroutines19329810
Ref: howto/a-conceptual-overview-of-asyncio asynchronous-functions-and-coroutines19329962
Ref: 5a3b19329962
Node: Task<2>19332884
Ref: howto/a-conceptual-overview-of-asyncio tasks19333031
Ref: 5a3c19333031
Node: await19335955
Ref: howto/a-conceptual-overview-of-asyncio await19336056
Ref: 5a3d19336056
Node: A conceptual overview part 2 the nuts and bolts19340226
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-2-the-nuts-and-bolts19340394
Ref: 5a3e19340394
Node: The inner workings of coroutines19340880
Ref: howto/a-conceptual-overview-of-asyncio the-inner-workings-of-coroutines19341014
Ref: 5a3f19341014
Node: Future<2>19344665
Ref: howto/a-conceptual-overview-of-asyncio futures19344832
Ref: 5a4019344832
Node: A homemade asyncio sleep19346087
Ref: howto/a-conceptual-overview-of-asyncio a-homemade-asyncio-sleep19346213
Ref: 5a4119346213
Node: Python 3 への拡張モジュール移植19350819
Ref: howto/cporting doc19350999
Ref: 5a4219350999
Ref: howto/cporting cporting-howto19350999
Ref: 14fc19350999
Ref: howto/cporting porting-extension-modules-to-python-319350999
Ref: 5a4319350999
Ref: howto/cporting translation-repo19350999
Ref: 5a4419350999
Ref: Python 3 への拡張モジュール移植-Footnote-119351828
Ref: Python 3 への拡張モジュール移植-Footnote-219351879
Node: Python で Curses プログラミング19351936
Ref: howto/curses doc19352112
Ref: 5a4519352112
Ref: howto/curses curses-howto19352112
Ref: 350119352112
Ref: howto/curses curses-programming-with-python19352112
Ref: 5a4619352112
Ref: howto/curses translation-repo19352112
Ref: 5a4719352112
Node: curses ってなに?19352622
Ref: howto/curses what-is-curses19352776
Ref: 5a4819352776
Ref: curses ってなに?-Footnote-119355764
Ref: curses ってなに?-Footnote-219355804
Node: Python の curses module19355853
Ref: howto/curses the-python-curses-module19355934
Ref: 5a4919355934
Node: curses アプリケーションの起動と終了19356903
Ref: howto/curses starting-and-ending-a-curses-application19357093
Ref: 5a4a19357093
Node: ウィンドウとパッド19360790
Ref: howto/curses windows-and-pads19360981
Ref: 5a4b19360981
Node: テキストの表示19365615
Ref: howto/curses displaying-text19365772
Ref: 5a4c19365772
Node: 属性とカラー19369874
Ref: howto/curses attributes-and-color19369950
Ref: 5a4d19369950
Node: ユーザ入力19374854
Ref: howto/curses user-input19375005
Ref: 5a4e19375005
Ref: ユーザ入力-Footnote-119378894
Node: より多くの情報19378934
Ref: howto/curses for-more-information19379055
Ref: 5a4f19379055
Ref: より多くの情報-Footnote-119380667
Ref: より多くの情報-Footnote-219380704
Ref: より多くの情報-Footnote-319380768
Ref: より多くの情報-Footnote-419380812
Ref: より多くの情報-Footnote-519380874
Ref: より多くの情報-Footnote-619380926
Node: デスクリプタ ガイド19380997
Ref: howto/descriptor doc19381188
Ref: 5a5019381188
Ref: howto/descriptor descriptor-guide19381188
Ref: 5a5119381188
Ref: howto/descriptor descriptorhowto19381188
Ref: 170b19381188
Ref: howto/descriptor translation-repo19381188
Ref: 5a5219381188
Node: 入門19382884
Ref: howto/descriptor primer19382988
Ref: 5a5319382988
Node: シンプルな例 定数を返すデスクリプタ19383370
Ref: howto/descriptor simple-example-a-descriptor-that-returns-a-constant19383501
Ref: 5a5419383501
Node: 動的なルックアップ19385287
Ref: howto/descriptor dynamic-lookups19385448
Ref: 5a5519385448
Node: 管理された属性19386958
Ref: howto/descriptor managed-attributes19387094
Ref: 5a5619387094
Node: 名前のカスタマイズ19390006
Ref: howto/descriptor customized-names19390124
Ref: 5a5719390124
Node: まとめ19392606
Ref: howto/descriptor closing-thoughts19392694
Ref: 5a5819392694
Node: 実践的なサンプル19394595
Ref: howto/descriptor complete-practical-example19394741
Ref: 5a5919394741
Node: バリデータクラス19395082
Ref: howto/descriptor validator-class19395203
Ref: 5a5a19395203
Node: カスタムバリデータ19396326
Ref: howto/descriptor custom-validators19396492
Ref: 5a5b19396492
Ref: カスタムバリデータ-Footnote-119399195
Node: 実践的なアプリケーション19399264
Ref: howto/descriptor practical-application19399397
Ref: 5a5c19399397
Node: 技術的なチュートリアル19400882
Ref: howto/descriptor technical-tutorial19401052
Ref: 5a5d19401052
Node: 概要<5>19401614
Ref: howto/descriptor abstract19401717
Ref: 5a5e19401717
Node: 定義と導入19402166
Ref: howto/descriptor definition-and-introduction19402311
Ref: 5a5f19402311
Node: デスクリプタプロトコル19403698
Ref: howto/descriptor descriptor-protocol19403873
Ref: 5a6019403873
Node: デスクリプタ呼び出しの概要19405346
Ref: howto/descriptor overview-of-descriptor-invocation19405545
Ref: 5a6119405545
Node: インスタンスからの呼び出し19406305
Ref: howto/descriptor invocation-from-an-instance19406501
Ref: 5a6219406501
Node: クラスからの呼び出し19409146
Ref: howto/descriptor invocation-from-a-class19409329
Ref: 5a6319409329
Ref: クラスからの呼び出し-Footnote-119409995
Node: superからの呼び出し19410068
Ref: howto/descriptor invocation-from-super19410248
Ref: 5a6419410248
Ref: superからの呼び出し-Footnote-119411010
Ref: superからの呼び出し-Footnote-219411083
Node: 呼び出しロジックのまとめ19411163
Ref: howto/descriptor summary-of-invocation-logic19411340
Ref: 5a6519411340
Node: 自動的の名前の伝達19412454
Ref: howto/descriptor automatic-name-notification19412623
Ref: 5a6619412623
Ref: 自動的の名前の伝達-Footnote-119413520
Node: ORMのサンプル19413593
Ref: howto/descriptor orm-example19413717
Ref: 5a6719413717
Ref: ORMのサンプル-Footnote-119415946
Ref: ORMのサンプル-Footnote-219416018
Node: ピュアPythonの等価実装19416071
Ref: howto/descriptor pure-python-equivalents19416208
Ref: 5a6819416208
Node: プロパティ19416839
Ref: howto/descriptor properties19416951
Ref: 5a6919416951
Node: 関数とメソッド19420077
Ref: howto/descriptor functions-and-methods19420219
Ref: 5a6a19420219
Node: メソッドの種類19423850
Ref: howto/descriptor kinds-of-methods19423995
Ref: 5a6b19423995
Node: 静的メソッド19425402
Ref: howto/descriptor static-methods19425547
Ref: 5a6c19425547
Node: クラスメソッド19427817
Ref: howto/descriptor class-methods19427984
Ref: 5a6d19427984
Node: メンバーオブジェクトと __slots__19430308
Ref: howto/descriptor member-objects-and-slots19430448
Ref: 5a6e19430448
Ref: メンバーオブジェクトと __slots__-Footnote-119438434
Node: Debugging C API extensions and CPython Internals with GDB19438490
Ref: howto/gdb_helpers doc19438657
Ref: 5a6f19438657
Ref: howto/gdb_helpers debugging-c-api-extensions-and-cpython-internals-with-gdb19438657
Ref: 5a7019438657
Ref: howto/gdb_helpers gdb19438657
Ref: 5a7119438657
Ref: howto/gdb_helpers translation-repo19438657
Ref: 5a7219438657
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-119440059
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-219440095
Node: Prerequisites19440149
Ref: howto/gdb_helpers prerequisites19440307
Ref: 5a7319440307
Node: Setup with Python built from source19440948
Ref: howto/gdb_helpers setup-with-python-built-from-source19441078
Ref: 5a7419441078
Node: Setup for Python from a Linux distro19441845
Ref: howto/gdb_helpers setup-for-python-from-a-linux-distro19441975
Ref: 5a7519441975
Node: Using the Debug build and Development mode19442623
Ref: howto/gdb_helpers using-the-debug-build-and-development-mode19442820
Ref: 5a7619442820
Node: Using the python-gdb extension19443424
Ref: howto/gdb_helpers using-the-python-gdb-extension19443629
Ref: 5a7719443629
Node: Pretty-printers19443935
Ref: howto/gdb_helpers pretty-printers19444033
Ref: 5a7819444033
Node: py-list19448558
Ref: howto/gdb_helpers py-list19448682
Ref: 5a7919448682
Node: py-up and py-down19449570
Ref: howto/gdb_helpers py-up-and-py-down19449684
Ref: 5a7a19449684
Node: py-bt19454399
Ref: howto/gdb_helpers py-bt19454514
Ref: 5a7b19454514
Node: py-print19456765
Ref: howto/gdb_helpers py-print19456872
Ref: 5a7c19456872
Node: py-locals19457621
Ref: howto/gdb_helpers py-locals19457714
Ref: 5a7d19457714
Node: Use with GDB commands19458617
Ref: howto/gdb_helpers use-with-gdb-commands19458771
Ref: 5a7e19458771
Node: 列挙型 HOWTO19464790
Ref: howto/enum doc19464965
Ref: 5a7f19464965
Ref: howto/enum enum-howto19464965
Ref: 5a8019464965
Ref: howto/enum id119464965
Ref: 5a8119464965
Ref: howto/enum translation-repo19464965
Ref: 5a8219464965
Ref: howto/enum enum-basic-tutorial19465003
Ref: 2a9d19465003
Node: 列挙型メンバーおよびそれらの属性へのプログラム的アクセス19471545
Ref: howto/enum enum-advanced-tutorial19471726
Ref: 2a9e19471726
Ref: howto/enum programmatic-access-to-enumeration-members-and-their-attributes19471726
Ref: 5a8319471726
Node: 列挙型メンバーと値の重複19472644
Ref: howto/enum duplicating-enum-members-and-values19472885
Ref: 5a8419472885
Node: 番号付けの値が一意であることの確認19474268
Ref: howto/enum ensuring-unique-enumeration-values19474452
Ref: 5a8519474452
Node: 値の自動設定を使う19475076
Ref: howto/enum using-automatic-values19475248
Ref: 5a8619475248
Node: イテレーション<2>19476198
Ref: howto/enum iteration19476328
Ref: 5a8719476328
Node: 比較<3>19477837
Ref: howto/enum comparisons19477985
Ref: 5a8819477985
Node: 列挙型で許されるメンバーと属性19479257
Ref: howto/enum allowed-members-and-attributes-of-enumerations19479415
Ref: 5a8a19479415
Node: Enumのサブクラス化の制限19481709
Ref: howto/enum restricted-enum-subclassing19481891
Ref: 5a8e19481891
Node: データクラスのサポート19483281
Ref: howto/enum dataclass-support19483428
Ref: 5a9019483428
Ref: howto/enum enum-dataclass-support19483428
Ref: 1b5719483428
Node: Pickle 化19484994
Ref: howto/enum pickling19485120
Ref: 5a9119485120
Node: 関数 API<2>19486269
Ref: howto/enum functional-api19486377
Ref: 5a8b19486377
Node: 派生列挙型19490297
Ref: howto/enum derived-enumerations19490426
Ref: 5a9219490426
Node: IntEnum19490550
Ref: howto/enum intenum19490625
Ref: 5a8919490625
Node: StrEnum19491794
Ref: howto/enum strenum19491885
Ref: 5a9319491885
Node: IntFlag19492233
Ref: howto/enum intflag19492321
Ref: 5a9419492321
Node: Flag19495101
Ref: howto/enum flag19495194
Ref: 5a9519495194
Node: その他<6>19497807
Ref: howto/enum others19497884
Ref: 5a9619497884
Node: When to use __new__ vs __init__19500224
Ref: howto/enum new-vs-init19500352
Ref: 5a8d19500352
Ref: howto/enum when-to-use-new-vs-init19500352
Ref: 5a9719500352
Node: 細かい点19501649
Ref: howto/enum finer-points19501797
Ref: 5a9819501797
Node: Supported __dunder__ and _sunder_ names19502150
Ref: howto/enum supported-dunder-and-sunder-names19502262
Ref: 5a9919502262
Node: _Private__names19502490
Ref: howto/enum private-names19502631
Ref: 5a9a19502631
Node: Enum メンバー型19502826
Ref: howto/enum enum-member-type19502981
Ref: 5a9b19502981
Node: Creating members that are mixed with other data types19503447
Ref: howto/enum creating-members-that-are-mixed-with-other-data-types19503628
Ref: 5a9c19503628
Node: Enum クラスとメンバーの真偽値19504161
Ref: howto/enum boolean-value-of-enum-classes-and-members19504358
Ref: 5a9d19504358
Node: メソッド付きの Enum クラス19505032
Ref: howto/enum enum-classes-with-methods19505214
Ref: 5a9e19505214
Node: Flag のメンバーの組み合わせ19505847
Ref: howto/enum combining-members-of-flag19506012
Ref: 5a9f19506012
Node: Flag and IntFlag minutia19506589
Ref: howto/enum flag-and-intflag-minutia19506709
Ref: 5aa019506709
Node: EnumとFlagはどう違うのか？19509474
Ref: howto/enum enum-class-differences19509614
Ref: 2aa019509614
Ref: howto/enum how-are-enums-and-flags-different19509614
Ref: 5aa119509614
Node: Enum クラス19510031
Ref: howto/enum enum-classes19510140
Ref: 5aa219510140
Node: Flag クラス19510719
Ref: howto/enum flag-classes19510873
Ref: 5aa319510873
Node: Enum メンバー インスタンス19511240
Ref: howto/enum enum-members-aka-instances19511397
Ref: 5aa419511397
Node: Flag メンバー19511795
Ref: howto/enum flag-members19511929
Ref: 5aa519511929
Node: Enum クックブック19512638
Ref: howto/enum enum-cookbook19512802
Ref: 2a9f19512802
Ref: howto/enum id219512802
Ref: 5aa619512802
Node: 値の省略19513349
Ref: howto/enum omitting-values19513441
Ref: 5aa719513441
Node: auto を使う19514349
Ref: howto/enum using-auto19514437
Ref: 5aa819514437
Node: object を使う19514712
Ref: howto/enum using-object19514833
Ref: 5aa919514833
Node: 解説文字列を使う19515509
Ref: howto/enum using-a-descriptive-string19515638
Ref: 5aaa19515638
Node: Using a custom __new__19515930
Ref: howto/enum using-a-custom-new19516034
Ref: 5aab19516034
Node: OrderedEnum19517927
Ref: howto/enum orderedenum19518045
Ref: 5a8f19518045
Node: DuplicateFreeEnum19519262
Ref: howto/enum duplicatefreeenum19519382
Ref: 5aac19519382
Node: MultiValueEnum19520560
Ref: howto/enum multi-value-enum19520675
Ref: 2abd19520675
Ref: howto/enum multivalueenum19520675
Ref: 5aad19520675
Node: Planet19521258
Ref: howto/enum planet19521366
Ref: 5a8c19521366
Node: TimePeriod19522427
Ref: howto/enum enum-time-period19522512
Ref: 2ab619522512
Ref: howto/enum timeperiod19522512
Ref: 5aae19522512
Node: EnumType のサブクラスを作る19523128
Ref: howto/enum enumtype-examples19523248
Ref: 2aa619523248
Ref: howto/enum subclassing-enumtype19523248
Ref: 5aaf19523248
Node: 関数型プログラミング HOWTO19523535
Ref: howto/functional doc19523666
Ref: 5ab019523666
Ref: howto/functional functional-howto19523666
Ref: 5ab119523666
Ref: howto/functional functional-programming-howto19523666
Ref: 5ab219523666
Ref: howto/functional translation-repo19523666
Ref: 5ab319523666
Node: はじめに<15>19524691
Ref: howto/functional introduction19524816
Ref: 5ab419524816
Node: 形式的証明可能性19530834
Ref: howto/functional formal-provability19530938
Ref: 5ab619530938
Node: モジュラー性19533404
Ref: howto/functional modularity19533553
Ref: 5ab719533553
Node: デバッグやテストの簡単さ19534076
Ref: howto/functional ease-of-debugging-and-testing19534210
Ref: 5ab819534210
Node: 結合性19535179
Ref: howto/functional composability19535286
Ref: 5ab919535286
Node: イテレータ iterator<2>19536140
Ref: howto/functional functional-howto-iterators19536319
Ref: 5ab519536319
Ref: howto/functional iterators19536319
Ref: 5aba19536319
Node: イテレータ対応のデータ型19540607
Ref: howto/functional data-types-that-support-iterators19540707
Ref: 5abb19540707
Node: ジェネレータ式とリスト内包表記19543072
Ref: howto/functional generator-expressions-and-list-comprehensions19543266
Ref: 5abc19543266
Node: ジェネレータ generator<2>19548479
Ref: howto/functional generators19548685
Ref: 5abd19548685
Ref: ジェネレータ generator<2>-Footnote-119553307
Node: ジェネレータに値を渡す19553388
Ref: howto/functional passing-values-into-a-generator19553489
Ref: 5abe19553489
Ref: ジェネレータに値を渡す-Footnote-119558105
Node: 組み込み関数 built-in function<2>19558147
Ref: howto/functional built-in-functions19558333
Ref: 5abf19558333
Ref: 組み込み関数 built-in function<2>-Footnote-119562889
Ref: 組み込み関数 built-in function<2>-Footnote-219562943
Node: itertools モジュール19563019
Ref: howto/functional the-itertools-module19563199
Ref: 5ac019563199
Node: 新しいイテレータを作る19564067
Ref: howto/functional creating-new-iterators19564204
Ref: 5ac119564204
Node: 要素に対して関数を呼ぶ19567103
Ref: howto/functional calling-functions-on-elements19567270
Ref: 5ac219567270
Node: 要素を選択する19568188
Ref: howto/functional selecting-elements19568337
Ref: 5ac319568337
Node: 組合せ関数19569951
Ref: howto/functional combinatoric-functions19570100
Ref: 5ac419570100
Node: 要素をグループ分けする19572636
Ref: howto/functional grouping-elements19572755
Ref: 5ac519572755
Node: functools モジュール19574545
Ref: howto/functional the-functools-module19574716
Ref: 5ac619574716
Node: operator モジュール19578852
Ref: howto/functional the-operator-module19578938
Ref: 5ac719578938
Node: 小さな関数とラムダ式19579843
Ref: howto/functional small-functions-and-the-lambda-expression19580010
Ref: 5ac819580010
Node: 更新履歴と謝辞19583475
Ref: howto/functional revision-history-and-acknowledgements19583632
Ref: 5ac919583632
Node: 参考資料<2>19584370
Ref: howto/functional references19584488
Ref: 5aca19584488
Node: 一般論19584591
Ref: howto/functional general19584680
Ref: 5acb19584680
Node: Python 特有の話19585887
Ref: howto/functional python-specific19585998
Ref: 5acc19585998
Ref: Python 特有の話-Footnote-119586552
Ref: Python 特有の話-Footnote-219586603
Ref: Python 特有の話-Footnote-319586656
Node: Python 文書19586709
Ref: howto/functional python-documentation19586802
Ref: 5acd19586802
Ref: Python 文書-Footnote-119587195
Ref: Python 文書-Footnote-219587237
Node: Logging HOWTO19587279
Ref: howto/logging doc19587421
Ref: 5ace19587421
Ref: howto/logging id119587421
Ref: 5acf19587421
Ref: howto/logging logging-howto19587421
Ref: 5ad019587421
Ref: howto/logging translation-repo19587421
Ref: 5ad119587421
Ref: howto/logging logging-basic-tutorial19587514
Ref: 141219587514
Node: 基本 logging チュートリアル19588025
Ref: howto/logging basic-logging-tutorial19588159
Ref: 5ad319588159
Node: logging を使うとき19589156
Ref: howto/logging when-to-use-logging19589273
Ref: 5ad419589273
Node: 簡単な例19593597
Ref: howto/logging a-simple-example19593749
Ref: 5ad519593749
Ref: howto/logging howto-minimal-example19593749
Ref: 5ad619593749
Node: ファイルへの logging19595022
Ref: howto/logging logging-to-a-file19595181
Ref: 5ad719595181
Node: 変数データのロギング19598762
Ref: howto/logging logging-variable-data19598969
Ref: 5ad819598969
Node: 表示されるメッセージのフォーマットの変更19600068
Ref: howto/logging changing-the-format-of-displayed-messages19600297
Ref: 5ad919600297
Node: メッセージ内での日付と時刻の表示19601473
Ref: howto/logging displaying-the-date-time-in-messages19601690
Ref: 5ada19601690
Ref: メッセージ内での日付と時刻の表示-Footnote-119602935
Node: 次のステップ19602994
Ref: howto/logging next-steps19603142
Ref: 5adb19603142
Ref: 次のステップ-Footnote-119604204
Node: 上級ロギングチュートリアル19604248
Ref: howto/logging advanced-logging-tutorial19604415
Ref: 5adc19604415
Ref: howto/logging logging-advanced-tutorial19604415
Ref: 141319604415
Node: Logging Flow19608977
Ref: howto/logging logging-flow19609083
Ref: 5add19609083
Node: ロガー19609278
Ref: howto/logging loggers19609405
Ref: 5ade19609405
Node: ハンドラ19614970
Ref: howto/logging handler-basic19615103
Ref: 5adf19615103
Ref: howto/logging handlers19615103
Ref: 5ae019615103
Node: フォーマッタ19617852
Ref: howto/logging formatters19618003
Ref: 5ae219618003
Ref: howto/logging logging logging Formatter __init__19618698
Ref: 5ae319618698
Node: ロギングの環境設定19620936
Ref: howto/logging configuring-logging19621126
Ref: 5ae419621126
Node: 環境設定が与えられないとどうなるか19628339
Ref: howto/logging what-happens-if-no-configuration-is-provided19628559
Ref: 5ae519628559
Node: ライブラリのためのロギングの設定19630132
Ref: howto/logging configuring-logging-for-a-library19630316
Ref: 5ae619630316
Ref: howto/logging library-config19630316
Ref: 327119630316
Node: ロギングレベル<2>19634063
Ref: howto/logging logging-levels19634215
Ref: 5ae719634215
Node: カスタムレベル19637822
Ref: howto/logging custom-levels19637904
Ref: 323919637904
Ref: howto/logging id219637904
Ref: 5ae819637904
Node: 便利なハンドラ19638638
Ref: howto/logging id319638787
Ref: 5ae919638787
Ref: howto/logging useful-handlers19638787
Ref: 5ae119638787
Node: ログ記録中に発生する例外19644326
Ref: howto/logging exceptions-raised-during-logging19644511
Ref: 5aea19644511
Ref: howto/logging logging-exceptions19644511
Ref: 5aeb19644511
Node: 任意のオブジェクトをメッセージに使用する19645978
Ref: howto/logging arbitrary-object-messages19646155
Ref: 322519646155
Ref: howto/logging using-arbitrary-objects-as-messages19646155
Ref: 5aec19646155
Node: 最適化<19>19647042
Ref: howto/logging optimization19647207
Ref: 5aed19647207
Node: その他のリソース19651586
Ref: howto/logging other-resources19651682
Ref: 5aee19651682
Ref: howto/logging tutorial-ref-links19651682
Ref: 5ad219651682
Node: Logging クックブック19652115
Ref: howto/logging-cookbook doc19652245
Ref: 5aef19652245
Ref: howto/logging-cookbook id119652245
Ref: 5af019652245
Ref: howto/logging-cookbook logging-cookbook19652245
Ref: 141419652245
Ref: howto/logging-cookbook translation-repo19652245
Ref: 5af119652245
Node: 複数のモジュールで logging を使う19654902
Ref: howto/logging-cookbook using-logging-in-multiple-modules19655061
Ref: 5af319655061
Node: 複数のスレッドからのロギング19658861
Ref: howto/logging-cookbook logging-from-multiple-threads19659060
Ref: 5af419659060
Node: 複数の handler と formatter19660938
Ref: howto/logging-cookbook multiple-handlers-and-formatters19661134
Ref: 5af519661134
Node: 複数の出力先にログを出力する19663726
Ref: howto/logging-cookbook logging-to-multiple-destinations19663916
Ref: 5af619663916
Ref: howto/logging-cookbook multiple-destinations19663916
Ref: 5af719663916
Node: ログレベルのカスタム処理19667607
Ref: howto/logging-cookbook custom-handling-of-levels19667787
Ref: 5af819667787
Ref: howto/logging-cookbook custom-level-handling19667787
Ref: 5af919667787
Node: 設定サーバの例19674189
Ref: howto/logging-cookbook configuration-server-example19674363
Ref: 5afa19674363
Node: ブロックする handler を扱う19675966
Ref: howto/logging-cookbook blocking-handlers19676164
Ref: 39da19676164
Ref: howto/logging-cookbook dealing-with-handlers-that-block19676164
Ref: 5afb19676164
Node: ネットワーク越しの logging イベントの送受信19681830
Ref: howto/logging-cookbook network-logging19682067
Ref: 5afc19682067
Ref: howto/logging-cookbook sending-and-receiving-logging-events-across-a-network19682067
Ref: 5afd19682067
Node: 作成中のロギングソケットのリスナーを実行する19687828
Ref: howto/logging-cookbook running-a-logging-socket-listener-in-production19687991
Ref: 5afe19687991
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-119693119
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-219693151
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-319693223
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-419693253
Node: コンテキスト情報をログ記録出力に付加する19693325
Ref: howto/logging-cookbook adding-contextual-information-to-your-logging-output19693547
Ref: 5aff19693547
Ref: howto/logging-cookbook context-info19693547
Ref: 322c19693547
Node: LoggerAdapter を使ったコンテキスト情報の伝達19694987
Ref: howto/logging-cookbook using-loggeradapters-to-impart-contextual-information19695204
Ref: 5b0019695204
Node: コンテキスト情報を渡すために dict 以外のオブジェクトを使う19699145
Ref: howto/logging-cookbook using-objects-other-than-dicts-to-pass-contextual-information19699325
Ref: 5b0119699325
Node: Filter を使ったコンテキスト情報の伝達19699855
Ref: howto/logging-cookbook filters-contextual19700072
Ref: 322119700072
Ref: howto/logging-cookbook using-filters-to-impart-contextual-information19700072
Ref: 5b0219700072
Node: contextvars の利用19704160
Ref: howto/logging-cookbook use-of-contextvars19704376
Ref: 5b0319704376
Node: ハンドラ内でのコンテキスト情報の付与19714643
Ref: howto/logging-cookbook imparting-contextual-information-in-handlers19714865
Ref: 5b0419714865
Node: 複数のプロセスからの単一ファイルへのログ記録19715903
Ref: howto/logging-cookbook logging-to-a-single-file-from-multiple-processes19716140
Ref: 5b0519716140
Ref: howto/logging-cookbook multiple-processes19716140
Ref: 5b0619716140
Node: concurrent futures ProcessPoolExecutorの利用19726977
Ref: howto/logging-cookbook using-concurrent-futures-processpoolexecutor19727187
Ref: 5b0719727187
Node: Deploying web applications using Gunicorn and uWSGI19728411
Ref: howto/logging-cookbook deploying-web-applications-using-gunicorn-and-uwsgi19728621
Ref: 5b0819728621
Ref: Deploying web applications using Gunicorn and uWSGI-Footnote-119729282
Ref: Deploying web applications using Gunicorn and uWSGI-Footnote-219729312
Node: ファイルをローテートする19729365
Ref: howto/logging-cookbook using-file-rotation19729589
Ref: 5b0919729589
Node: 別の format スタイルを利用する19731787
Ref: howto/logging-cookbook format-styles19731976
Ref: 5b0a19731976
Ref: howto/logging-cookbook use-of-alternative-formatting-styles19731976
Ref: 5b0b19731976
Node: LogRecord のカスタマイズ19739826
Ref: howto/logging-cookbook custom-logrecord19740039
Ref: 5b0c19740039
Ref: howto/logging-cookbook customizing-logrecord19740039
Ref: 5b0d19740039
Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example19744753
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-zeromq-example19744984
Ref: 5b0e19744984
Ref: howto/logging-cookbook zeromq-handlers19744984
Ref: 5b0f19744984
Node: Subclass QueueHandler19745184
Ref: howto/logging-cookbook subclass-queuehandler19745333
Ref: 5b1019745333
Node: Subclass QueueListener19746686
Ref: howto/logging-cookbook subclass-queuelistener19746835
Ref: 5b1119746835
Node: Subclassing QueueHandler and QueueListener- a pynng example19747622
Ref: howto/logging-cookbook pynng-handlers19747855
Ref: 5b1219747855
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-pynng-example19747855
Ref: 5b1319747855
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-119748479
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-219748519
Node: Subclass QueueListener<2>19748552
Ref: howto/logging-cookbook id319748706
Ref: 5b1419748706
Node: Subclass QueueHandler<2>19750682
Ref: howto/logging-cookbook id419750836
Ref: 5b1519750836
Node: 辞書ベースで構成する例19754548
Ref: howto/logging-cookbook an-example-dictionary-based-configuration19754799
Ref: 5b1619754799
Ref: 辞書ベースで構成する例-Footnote-119756768
Ref: 辞書ベースで構成する例-Footnote-219756854
Node: rotator と namer を使ってログローテートをカスタマイズする19756940
Ref: howto/logging-cookbook cookbook-rotator-namer19757176
Ref: 327e19757176
Ref: howto/logging-cookbook using-a-rotator-and-namer-to-customize-log-rotation-processing19757176
Ref: 5b1719757176
Node: より手の込んだ multiprocessing の例19758703
Ref: howto/logging-cookbook a-more-elaborate-multiprocessing-example19758967
Ref: 5b1819758967
Node: SysLogHandler に送るメッセージに BOM を挿入する19768790
Ref: howto/logging-cookbook inserting-a-bom-into-messages-sent-to-a-sysloghandler19769006
Ref: 5b1919769006
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-119771518
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-219771577
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-319771646
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-419771705
Node: 構造化ログを実装する19771764
Ref: howto/logging-cookbook implementing-structured-logging19771995
Ref: 5b1a19771995
Node: handler を dictConfig を使ってカスタマイズする19774720
Ref: howto/logging-cookbook custom-handlers19774962
Ref: 5b1b19774962
Ref: howto/logging-cookbook customizing-handlers-with-dictconfig19774962
Ref: 5b1c19774962
Node: 固有の書式化スタイルをアプリケーション全体で使う19780587
Ref: howto/logging-cookbook formatting-styles19780857
Ref: 321519780857
Ref: howto/logging-cookbook using-particular-formatting-styles-throughout-your-application19780857
Ref: 5b1d19780857
Node: LogRecord ファクトリを使う19783482
Ref: howto/logging-cookbook using-logrecord-factories19783691
Ref: 5b1e19783691
Node: カスタムなメッセージオブジェクトを使う19784932
Ref: howto/logging-cookbook using-custom-message-objects19785141
Ref: 5b1f19785141
Node: filter を dictConfig を使ってカスタマイズする19788452
Ref: howto/logging-cookbook configuring-filters-with-dictconfig19788708
Ref: 5b2019788708
Ref: howto/logging-cookbook filters-dictconfig19788708
Ref: 5b2119788708
Node: 例外の書式化をカスタマイズする19792353
Ref: howto/logging-cookbook custom-format-exception19792573
Ref: 5b2219792573
Ref: howto/logging-cookbook customized-exception-formatting19792573
Ref: 5b2319792573
Node: ロギングメッセージを喋る19794763
Ref: howto/logging-cookbook speaking-logging-messages19795012
Ref: 5b2419795012
Ref: howto/logging-cookbook spoken-messages19795012
Ref: 5b2519795012
Node: ロギングメッセージをバッファリングし、条件に従って出力する19797597
Ref: howto/logging-cookbook buffered-logging19797886
Ref: 5b2619797886
Ref: howto/logging-cookbook buffering-logging-messages-and-outputting-them-conditionally19797886
Ref: 5b2719797886
Node: バッファリングしながらロギングメッセージを email で送信する19804031
Ref: howto/logging-cookbook buffered-smtp19804338
Ref: 5b2819804338
Ref: howto/logging-cookbook sending-logging-messages-to-email-with-buffering19804338
Ref: 5b2919804338
Node: 設定によって時刻を UTC GMT で書式化する19808291
Ref: howto/logging-cookbook formatting-times-using-utc-gmt-via-configuration19808577
Ref: 5b2a19808577
Ref: howto/logging-cookbook utc-formatting19808577
Ref: 5b2b19808577
Node: ロギングの選択にコンテキストマネージャを使う19810686
Ref: howto/logging-cookbook context-manager19810947
Ref: 5b2c19810947
Ref: howto/logging-cookbook using-a-context-manager-for-selective-logging19810947
Ref: 5b2d19810947
Node: CLIアプリケーションスターターテンプレート19816538
Ref: howto/logging-cookbook a-cli-application-starter-template19816766
Ref: 5b2e19816766
Ref: howto/logging-cookbook starter-template19816766
Ref: 5b2f19816766
Node: Qt GUIのログ出力19823185
Ref: howto/logging-cookbook a-qt-gui-for-logging19823402
Ref: 5b3019823402
Ref: howto/logging-cookbook qt-gui19823402
Ref: 5b3119823402
Ref: Qt GUIのログ出力-Footnote-119833892
Ref: Qt GUIのログ出力-Footnote-219833919
Ref: Qt GUIのログ出力-Footnote-319833961
Node: RFC5424 をサポートする syslog へのロギング19834001
Ref: howto/logging-cookbook logging-to-syslog-with-rfc5424-support19834221
Ref: 5b3219834221
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-119838203
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-219838262
Node: ロガーを出力ストリームのように取り扱う方法19838321
Ref: howto/logging-cookbook how-to-treat-a-logger-like-an-output-stream19838570
Ref: 5b3319838570
Node: How to uniformly handle newlines in logging output19843803
Ref: howto/logging-cookbook how-to-uniformly-handle-newlines-in-logging-output19844024
Ref: 5b3419844024
Ref: How to uniformly handle newlines in logging output-Footnote-119847552
Node: 避けるべきパターン19847614
Ref: howto/logging-cookbook patterns-to-avoid19847799
Ref: 5b3519847799
Node: 同じログファイルを何度も開く19848480
Ref: howto/logging-cookbook opening-the-same-log-file-multiple-times19848664
Ref: 5b3619848664
Node: ロガーをクラスの属性にするか、パラメータで渡す19851329
Ref: howto/logging-cookbook using-loggers-as-attributes-in-a-class-or-passing-them-as-parameters19851607
Ref: 5b3719851607
Node: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する19852417
Ref: howto/logging-cookbook adding-handlers-other-than-nullhandler-to-a-logger-in-a-library19852686
Ref: 5b3819852686
Node: 大量のロガーを作成する19853291
Ref: howto/logging-cookbook creating-a-lot-of-loggers19853482
Ref: 5b3919853482
Node: その他のリソース<2>19854182
Ref: howto/logging-cookbook cookbook-ref-links19854308
Ref: 5af219854308
Ref: howto/logging-cookbook other-resources19854308
Ref: 5b3a19854308
Node: Regular expression HOWTO19854782
Ref: howto/regex doc19854938
Ref: 5b3b19854938
Ref: howto/regex regex-howto19854938
Ref: 27da19854938
Ref: howto/regex regular-expression-howto19854938
Ref: 5b3c19854938
Ref: howto/regex translation-repo19854938
Ref: 5b3d19854938
Node: はじめに<16>19855515
Ref: howto/regex introduction19855616
Ref: 5b3e19855616
Node: Simple patterns19857682
Ref: howto/regex simple-patterns19857817
Ref: 5b3f19857817
Node: Matching characters19858395
Ref: howto/regex matching-characters19858491
Ref: 5b4019858491
Node: Repeating things19864339
Ref: howto/regex repeating-things19864435
Ref: 5b4119864435
Node: Using regular expressions19870688
Ref: howto/regex using-regular-expressions19870825
Ref: 5b4219870825
Node: Compiling regular expressions19871464
Ref: howto/regex compiling-regular-expressions19871584
Ref: 5b4319871584
Node: The backslash plague19873258
Ref: howto/regex id119873405
Ref: 5b4419873405
Ref: howto/regex the-backslash-plague19873405
Ref: 5b4519873405
Node: Performing matches19877079
Ref: howto/regex performing-matches19877222
Ref: 5b4619877222
Node: Module-level functions<2>19883290
Ref: howto/regex module-level-functions19883430
Ref: 5b4719883430
Node: Compilation flags19884857
Ref: howto/regex compilation-flags19884970
Ref: 5b4819884970
Node: More pattern power19893783
Ref: howto/regex more-pattern-power19893922
Ref: 5b4a19893922
Node: More metacharacters19894348
Ref: howto/regex id219894449
Ref: 5b4b19894449
Ref: howto/regex more-metacharacters19894449
Ref: 5b4919894449
Node: グルーピング19900088
Ref: howto/regex grouping19900228
Ref: 5b4c19900228
Node: Non-capturing and named groups19904328
Ref: howto/regex non-capturing-and-named-groups19904469
Ref: 5b4d19904469
Node: Lookahead assertions19910873
Ref: howto/regex lookahead-assertions19910987
Ref: 5b4e19910987
Node: Modifying strings19915081
Ref: howto/regex modifying-strings19915210
Ref: 5b4f19915210
Node: Splitting strings19916310
Ref: howto/regex splitting-strings19916408
Ref: 5b5019916408
Node: Search and replace19918967
Ref: howto/regex search-and-replace19919065
Ref: 5b5119919065
Node: Common problems19924248
Ref: howto/regex common-problems19924380
Ref: 5b5219924380
Node: Use string methods19924863
Ref: howto/regex use-string-methods19924961
Ref: 5b5319924961
Node: match versus search19927045
Ref: howto/regex match-versus-search19927176
Ref: 5b5419927176
Node: Greedy versus non-greedy19928804
Ref: howto/regex greedy-versus-non-greedy19928937
Ref: 5b5519928937
Node: re VERBOSE の利用19931429
Ref: howto/regex using-re-verbose19931534
Ref: 5b5619931534
Node: フィードバック19933407
Ref: howto/regex feedback19933513
Ref: 5b5719933513
Node: ソケットプログラミング HOWTO19934563
Ref: howto/sockets doc19934720
Ref: 5b5819934720
Ref: howto/sockets socket-howto19934720
Ref: 3a4919934720
Ref: howto/sockets socket-programming-howto19934720
Ref: 5b5919934720
Ref: howto/sockets translation-repo19934720
Ref: 5b5a19934720
Node: ソケット19935561
Ref: howto/sockets sockets19935682
Ref: 5b5b19935682
Node: 歴史19937236
Ref: howto/sockets history19937291
Ref: 5b5c19937291
Node: ソケットの作成<3>19938019
Ref: howto/sockets creating-a-socket19938170
Ref: 5b5d19938170
Node: IPC19942068
Ref: howto/sockets ipc19942132
Ref: 5b5e19942132
Node: ソケットの利用19942728
Ref: howto/sockets using-a-socket19942873
Ref: 5b5f19942873
Node: バイナリデータ19950527
Ref: howto/sockets binary-data19950606
Ref: 5b6019950606
Ref: バイナリデータ-Footnote-119951886
Node: 切断19951946
Ref: howto/sockets disconnecting19952103
Ref: 5b6119952103
Node: ソケットが死ぬと19953881
Ref: howto/sockets when-sockets-die19953948
Ref: 5b6219953948
Node: ノンブロッキングソケット19955184
Ref: howto/sockets non-blocking-sockets19955311
Ref: 5b6319955311
Node: ソートのテクニック19960259
Ref: howto/sorting doc19960405
Ref: 5b6419960405
Ref: howto/sorting sorting-techniques19960405
Ref: 5b6519960405
Ref: howto/sorting sortinghowto19960405
Ref: 13f719960405
Ref: howto/sorting translation-repo19960405
Ref: 5b6619960405
Node: ソートの基本19961337
Ref: howto/sorting sorting-basics19961438
Ref: 5b6719961438
Node: Key 関数19962512
Ref: howto/sorting key-functions19962688
Ref: 5b6819962688
Node: operator モジュールの関数や partial 関数による評価19965028
Ref: howto/sorting operator-module-functions-and-partial-function-evaluation19965201
Ref: 5b6919965201
Ref: operator モジュールの関数や partial 関数による評価-Footnote-119967203
Node: 昇順と降順19967247
Ref: howto/sorting ascending-and-descending19967455
Ref: 5b6a19967455
Node: ソートの安定性と複合的なソート19968070
Ref: howto/sorting sort-stability-and-complex-sorts19968267
Ref: 5b6b19968267
Ref: ソートの安定性と複合的なソート-Footnote-119970222
Ref: ソートの安定性と複合的なソート-Footnote-219970288
Node: デコレート - ソート - アンデコレート DSU19970334
Ref: howto/sorting decorate-sort-undecorate19970528
Ref: 5b6c19970528
Ref: デコレート - ソート - アンデコレート DSU-Footnote-119972750
Node: 比較関数19972810
Ref: howto/sorting comparison-functions19973002
Ref: 5b6d19973002
Ref: 比較関数-Footnote-119974209
Node: Strategies For Unorderable Types and Values19974296
Ref: howto/sorting strategies-for-unorderable-types-and-values19974457
Ref: 5b6e19974457
Ref: Strategies For Unorderable Types and Values-Footnote-119976192
Node: 残りのはしばし<2>19976239
Ref: howto/sorting odds-and-ends19976409
Ref: 5b6f19976409
Ref: 残りのはしばし<2>-Footnote-119979147
Node: 部分的なソート19979189
Ref: howto/sorting partial-sorts19979307
Ref: 5b7019979307
Node: Unicode HOWTO19980605
Ref: howto/unicode doc19980806
Ref: 5b7119980806
Ref: howto/unicode id119980806
Ref: 5b7219980806
Ref: howto/unicode translation-repo19980806
Ref: 5b7319980806
Ref: howto/unicode unicode-howto19980806
Ref: 14c019980806
Node: Unicode 入門19981238
Ref: howto/unicode introduction-to-unicode19981342
Ref: 5b7419981342
Node: 定義19981496
Ref: howto/unicode definitions19981589
Ref: 5b7519981589
Ref: 定義-Footnote-119985028
Node: エンコーディング<3>19985085
Ref: howto/unicode encodings19985202
Ref: 5b7619985202
Node: 参考資料<3>19989619
Ref: howto/unicode references19989721
Ref: 5b7719989721
Ref: 参考資料<3>-Footnote-119990682
Ref: 参考資料<3>-Footnote-219990714
Ref: 参考資料<3>-Footnote-319990755
Ref: 参考資料<3>-Footnote-419990807
Ref: 参考資料<3>-Footnote-519990854
Ref: 参考資料<3>-Footnote-619991028
Ref: 参考資料<3>-Footnote-719991085
Node: Python の Unicode サポート19991129
Ref: howto/unicode python-s-unicode-support19991280
Ref: 5b7819991280
Node: 文字列型19991688
Ref: howto/unicode the-string-type19991801
Ref: 5b7919991801
Node: バイト列への変換19995515
Ref: howto/unicode converting-to-bytes19995689
Ref: 5b7a19995689
Node: Python ソースコード内の Unicode リテラル19997920
Ref: howto/unicode unicode-literals-in-python-source-code19998105
Ref: 5b7b19998105
Ref: Python ソースコード内の Unicode リテラル-Footnote-120000842
Node: Unicode プロパティ20000884
Ref: howto/unicode id220001062
Ref: 5b7c20001062
Ref: howto/unicode unicode-properties20001062
Ref: 26ad20001062
Ref: Unicode プロパティ-Footnote-120002901
Node: Comparing Strings20002971
Ref: howto/unicode comparing-strings20003117
Ref: 5b7d20003117
Node: Unicode 正規表現20005953
Ref: howto/unicode unicode-regular-expressions20006091
Ref: 5b7e20006091
Node: 参考資料<4>20007543
Ref: howto/unicode id320007655
Ref: 5b7f20007655
Ref: 参考資料<4>-Footnote-120008648
Ref: 参考資料<4>-Footnote-220008744
Ref: 参考資料<4>-Footnote-320008796
Node: Unicode データを読み書きする20008865
Ref: howto/unicode reading-and-writing-unicode-data20009012
Ref: 5b8020009012
Node: Unicode ファイル名20013658
Ref: howto/unicode unicode-filenames20013820
Ref: 5b8120013820
Node: Unicode 対応のプログラムを書くための Tips20016443
Ref: howto/unicode tips-for-writing-unicode-aware-programs20016629
Ref: 5b8220016629
Node: ファイルエンコーディングの変換20018461
Ref: howto/unicode converting-between-file-encodings20018655
Ref: 5b8320018655
Node: 不明なエンコーディングのファイル20019431
Ref: howto/unicode files-in-an-unknown-encoding20019625
Ref: 5b8420019625
Node: 参考資料<5>20020546
Ref: howto/unicode id420020700
Ref: 5b8520020700
Ref: 参考資料<5>-Footnote-120021543
Ref: 参考資料<5>-Footnote-220021615
Node: 謝辞<10>20021684
Ref: howto/unicode acknowledgements20021791
Ref: 5b8620021791
Node: urllib パッケージを使ってインターネット上のリソースを取得するには20022352
Ref: howto/urllib2 doc20022559
Ref: 5b8720022559
Ref: howto/urllib2 howto-fetch-internet-resources-using-the-urllib-package20022559
Ref: 5b8820022559
Ref: howto/urllib2 translation-repo20022559
Ref: 5b8920022559
Ref: howto/urllib2 urllib-howto20022559
Ref: 403020022559
Ref: urllib パッケージを使ってインターネット上のリソースを取得するには-Footnote-120023035
Node: はじめに<17>20023074
Ref: howto/urllib2 introduction20023249
Ref: 5b8a20023249
Ref: はじめに<17>-Footnote-120025204
Ref: はじめに<17>-Footnote-220025321
Node: URL を取得する20025380
Ref: howto/urllib2 fetching-urls20025588
Ref: 5b8b20025588
Node: データ20028397
Ref: howto/urllib2 data20028480
Ref: 5b8c20028480
Ref: データ-Footnote-120031834
Node: ヘッダ20031903
Ref: howto/urllib2 headers20031986
Ref: 5b8d20031986
Ref: ヘッダ-Footnote-120033874
Ref: ヘッダ-Footnote-220033911
Ref: ヘッダ-Footnote-320034237
Ref: ヘッダ-Footnote-420034374
Node: 例外を処理する<2>20034531
Ref: howto/urllib2 handling-exceptions20034738
Ref: 5b8f20034738
Node: URLError20035266
Ref: howto/urllib2 urlerror20035353
Ref: 5b9020035353
Node: HTTPError20035950
Ref: howto/urllib2 httperror20036073
Ref: 5b9120036073
Ref: HTTPError-Footnote-120036968
Node: エラーコード20037027
Ref: howto/urllib2 error-codes20037091
Ref: 5b9220037091
Ref: エラーコード-Footnote-120039425
Node: エラーをラップする20039484
Ref: howto/urllib2 wrapping-it-up20039590
Ref: 5b9320039590
Node: その120039837
Ref: howto/urllib2 number-120039924
Ref: 5b9420039924
Node: その220040548
Ref: howto/urllib2 number-220040635
Ref: 5b9520040635
Node: info と geturl20041163
Ref: howto/urllib2 info-and-geturl20041371
Ref: 5b8e20041371
Ref: info と geturl-Footnote-120042417
Node: Openers と Handlers20042455
Ref: howto/urllib2 openers-and-handlers20042651
Ref: 5b9620042651
Node: Basic 認証20044995
Ref: howto/urllib2 basic-authentication20045188
Ref: 5b9720045188
Ref: Basic 認証-Footnote-120049058
Node: プロキシ20049175
Ref: howto/urllib2 proxies20049375
Ref: 5b9820049375
Ref: プロキシ-Footnote-120050657
Ref: プロキシ-Footnote-220051178
Node: ソケットとレイヤー20051345
Ref: howto/urllib2 sockets-and-layers20051539
Ref: 5b9920051539
Node: 脚注20052928
Ref: howto/urllib2 footnotes20053101
Ref: 5b9a20053101
Node: ipaddressモジュールの紹介20053212
Ref: howto/ipaddress doc20053454
Ref: 5b9b20053454
Ref: howto/ipaddress an-introduction-to-the-ipaddress-module20053454
Ref: 5b9c20053454
Ref: howto/ipaddress ipaddress-howto20053454
Ref: 426b20053454
Ref: howto/ipaddress translation-repo20053454
Ref: 5b9d20053454
Node: アドレス/ネットワーク/インターフェースオブジェクトの作成20054397
Ref: howto/ipaddress creating-address-network-interface-objects20054633
Ref: 5b9e20054633
Node: IPバージョンについての注意20055254
Ref: howto/ipaddress a-note-on-ip-versions20055444
Ref: 5b9f20055444
Node: IPホストアドレス20056479
Ref: howto/ipaddress ip-host-addresses20056711
Ref: 5ba020056711
Node: ネットワークを定義する20058042
Ref: howto/ipaddress defining-networks20058269
Ref: 5ba120058269
Node: ホストインターフェース20061334
Ref: howto/ipaddress host-interfaces20061529
Ref: 5ba220061529
Node: アドレス/ネットワーク/インターフェースオブジェクト20062789
Ref: howto/ipaddress inspecting-address-network-interface-objects20063088
Ref: 5ba320063088
Node: アドレスのリストとしてのネットワーク20065784
Ref: howto/ipaddress networks-as-lists-of-addresses20066009
Ref: 5ba420066009
Node: 比較<4>20067049
Ref: howto/ipaddress comparisons20067253
Ref: 5ba520067253
Node: 他のモジュールでIPアドレスを使用する20067684
Ref: howto/ipaddress using-ip-addresses-with-other-modules20067915
Ref: 5ba620067915
Node: インスタンスの生成に失敗した場合にさらに詳細を取得する20068449
Ref: howto/ipaddress getting-more-detail-when-instance-creation-fails20068662
Ref: 5ba720068662
Node: DTrace と SystemTap で CPython を測定する20071083
Ref: howto/instrumentation doc20071273
Ref: 5ba820071273
Ref: howto/instrumentation instrumentation20071273
Ref: e6a20071273
Ref: howto/instrumentation instrumenting-cpython-with-dtrace-and-systemtap20071273
Ref: 5ba920071273
Ref: howto/instrumentation translation-repo20071273
Ref: 5baa20071273
Node: 静的マーカーの有効化20072783
Ref: howto/instrumentation enabling-the-static-markers20072933
Ref: 5bab20072933
Node: 静的 DTrace プローブ20077294
Ref: howto/instrumentation static-dtrace-probes20077482
Ref: 5bac20077482
Node: 静的 SystemTap マーカー20079951
Ref: howto/instrumentation static-systemtap-markers20080142
Ref: 5bad20080142
Node: 利用可能な静的マーカー20082364
Ref: howto/instrumentation available-static-markers20082545
Ref: 5bae20082545
Ref: howto/instrumentation static-markers20082545
Ref: db520082545
Node: C Entry Points20085388
Ref: howto/instrumentation c-entry-points20085497
Ref: 5baf20085497
Ref: howto/instrumentation c PyDTrace_LINE20086260
Ref: 5bb020086260
Ref: howto/instrumentation c PyDTrace_FUNCTION_ENTRY20086386
Ref: 5bb120086386
Ref: howto/instrumentation c PyDTrace_FUNCTION_RETURN20086526
Ref: 5bb220086526
Ref: howto/instrumentation c PyDTrace_GC_START20086663
Ref: 5bb320086663
Ref: howto/instrumentation c PyDTrace_GC_DONE20086881
Ref: 5bb420086881
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_START20087017
Ref: 5bb520087017
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_DONE20087214
Ref: 5bb620087214
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_START20087411
Ref: 5bb720087411
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_DONE20087608
Ref: 5bb820087608
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_START20087808
Ref: 5bb920087808
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_DONE20087956
Ref: 5bba20087956
Ref: howto/instrumentation c PyDTrace_AUDIT20088107
Ref: 5bbb20088107
Node: C Probing Checks20088181
Ref: howto/instrumentation c-probing-checks20088290
Ref: 5bbc20088290
Ref: howto/instrumentation c PyDTrace_LINE_ENABLED20088343
Ref: 5bbd20088343
Ref: howto/instrumentation c PyDTrace_FUNCTION_ENTRY_ENABLED20088394
Ref: 5bbe20088394
Ref: howto/instrumentation c PyDTrace_FUNCTION_RETURN_ENABLED20088455
Ref: 5bbf20088455
Ref: howto/instrumentation c PyDTrace_GC_START_ENABLED20088517
Ref: 5bc020088517
Ref: howto/instrumentation c PyDTrace_GC_DONE_ENABLED20088572
Ref: 5bc120088572
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_START_ENABLED20088626
Ref: 5bc220088626
Ref: howto/instrumentation c PyDTrace_INSTANCE_NEW_DONE_ENABLED20088691
Ref: 5bc320088691
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_START_ENABLED20088755
Ref: 5bc420088755
Ref: howto/instrumentation c PyDTrace_INSTANCE_DELETE_DONE_ENABLED20088823
Ref: 5bc520088823
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_START_ENABLED20088890
Ref: 5bc620088890
Ref: howto/instrumentation c PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED20088959
Ref: 5bc720088959
Ref: howto/instrumentation c PyDTrace_AUDIT_ENABLED20089027
Ref: 5bc820089027
Node: SystemTap Tapset20089355
Ref: howto/instrumentation systemtap-tapsets20089520
Ref: 5bc920089520
Node: 使用例<58>20091128
Ref: howto/instrumentation examples20091251
Ref: 5bca20091251
Node: Python support for the Linux perf profiler20092571
Ref: howto/perf_profiling doc20092779
Ref: 1b0e20092779
Ref: howto/perf_profiling perf-profiling20092779
Ref: 4ae20092779
Ref: howto/perf_profiling python-support-for-the-linux-perf-profiler20092779
Ref: 5bcb20092779
Ref: howto/perf_profiling translation-repo20092779
Ref: 5bcc20092779
Ref: Python support for the Linux perf profiler-Footnote-120100664
Node: How to enable perf profiling support20100701
Ref: howto/perf_profiling how-to-enable-perf-profiling-support20100855
Ref: 5bcd20100855
Node: How to obtain the best results20101997
Ref: howto/perf_profiling how-to-obtain-the-best-results20102194
Ref: 5bce20102194
Node: How to work without frame pointers20102972
Ref: howto/perf_profiling how-to-work-without-frame-pointers20103124
Ref: 5bcf20103124
Node: アノテーションのベストプラクティス20106987
Ref: howto/annotations doc20107183
Ref: 5bd020107183
Ref: howto/annotations annotations-best-practices20107183
Ref: 5bd120107183
Ref: howto/annotations annotations-howto20107183
Ref: 9dd20107183
Ref: howto/annotations translation-repo20107183
Ref: 5bd220107183
Node: オブジェクトのアノテーション辞書へのアクセス Python 3 10 以降20109046
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-10-and-newer20109312
Ref: 5bd320109312
Node: オブジェクトのアノテーション辞書へのアクセス Python 3 9 以前20111623
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older20111967
Ref: 5bd420111967
Node: 文字列指定のアノテーションを手動で解決する方法20114783
Ref: howto/annotations manually-un-stringizing-stringized-annotations20115121
Ref: 5bd520115121
Ref: 文字列指定のアノテーションを手動で解決する方法-Footnote-120117626
Node: __annotations__ のベストプラクティス 全 Python バージョン共通20117668
Ref: howto/annotations best-practices-for-annotations-in-any-python-version20117950
Ref: 5bd620117950
Node: __annotations__ の注意点20119053
Ref: howto/annotations annotations-quirks20119257
Ref: 5bd720119257
Ref: __annotations__ の注意点-Footnote-120121811
Node: 拡張モジュールを分離する20121872
Ref: howto/isolating-extensions doc20122053
Ref: 5bd820122053
Ref: howto/isolating-extensions isolating-extension-modules20122053
Ref: 5bd920122053
Ref: howto/isolating-extensions isolating-extensions-howto20122053
Ref: 16720122053
Ref: howto/isolating-extensions translation-repo20122053
Ref: 5bda20122053
Node: Who should read this20122801
Ref: howto/isolating-extensions who-should-read-this20122912
Ref: 5bdb20122912
Node: 背景<2>20123150
Ref: howto/isolating-extensions background20123316
Ref: 5bdc20123316
Node: Enter Per-Module State20124930
Ref: howto/isolating-extensions enter-per-module-state20125055
Ref: 5bdd20125055
Node: 分離されたモジュールオブジェクト20126214
Ref: howto/isolating-extensions isolated-module-objects20126369
Ref: 5bde20126369
Node: Surprising Edge Cases20127465
Ref: howto/isolating-extensions surprising-edge-cases20127589
Ref: 5be020127589
Node: Making Modules Safe with Multiple Interpreters20128601
Ref: howto/isolating-extensions making-modules-safe-with-multiple-interpreters20128760
Ref: 5be120128760
Node: Managing Global State20129079
Ref: howto/isolating-extensions managing-global-state20129217
Ref: 5bdf20129217
Node: Managing Per-Module State20130173
Ref: howto/isolating-extensions managing-per-module-state20130369
Ref: 5be220130369
Ref: Managing Per-Module State-Footnote-120132041
Node: Opt-Out Limiting to One Module Object per Process20132115
Ref: howto/isolating-extensions isolating-extensions-optout20132324
Ref: 559420132324
Ref: howto/isolating-extensions opt-out-limiting-to-one-module-object-per-process20132324
Ref: 5be320132324
Node: Module State Access from Functions20133682
Ref: howto/isolating-extensions module-state-access-from-functions20133857
Ref: 5be420133857
Node: Heap Types<2>20134639
Ref: howto/isolating-extensions heap-types20134816
Ref: 5be520134816
Node: Changing Static Types to Heap Types20136464
Ref: howto/isolating-extensions changing-static-types-to-heap-types20136577
Ref: 5be620136577
Node: Defining Heap Types20137553
Ref: howto/isolating-extensions defining-heap-types20137702
Ref: 5be720137702
Node: Garbage-Collection Protocol20138355
Ref: howto/isolating-extensions garbage-collection-protocol20138501
Ref: 5be820138501
Node: tp_traverse in Python 3 8 and lower20139595
Ref: howto/isolating-extensions tp-traverse-in-python-3-8-and-lower20139725
Ref: 5be920139725
Node: Delegating tp_traverse20140493
Ref: howto/isolating-extensions delegating-tp-traverse20140651
Ref: 5bea20140651
Node: Defining tp_dealloc20141459
Ref: howto/isolating-extensions defining-tp-dealloc20141604
Ref: 5beb20141604
Node: Not overriding tp_free20142372
Ref: howto/isolating-extensions not-overriding-tp-free20142516
Ref: 5bec20142516
Node: Avoiding PyObject_New20142723
Ref: howto/isolating-extensions avoiding-pyobject-new20142839
Ref: 5bed20142839
Node: Module State Access from Classes20143626
Ref: howto/isolating-extensions module-state-access-from-classes20143793
Ref: 5bee20143793
Node: Module State Access from Regular Methods20144364
Ref: howto/isolating-extensions module-state-access-from-regular-methods20144561
Ref: 5bef20144561
Node: Module State Access from Slot Methods Getters and Setters20147064
Ref: howto/isolating-extensions module-state-access-from-slot-methods-getters-and-setters20147257
Ref: 5bf020147257
Node: Lifetime of the Module State20148704
Ref: howto/isolating-extensions lifetime-of-the-module-state20148848
Ref: 5bf120148848
Node: 取り掛かり中の問題20149391
Ref: howto/isolating-extensions open-issues20149513
Ref: 5bf220149513
Ref: 取り掛かり中の問題-Footnote-120149863
Node: クラスごとのスコープ20149918
Ref: howto/isolating-extensions per-class-scope20150054
Ref: 5bf320150054
Node: Lossless Conversion to Heap Types20150367
Ref: howto/isolating-extensions lossless-conversion-to-heap-types20150503
Ref: 5bf420150503
Node: timer file descriptor HOWTO20150741
Ref: howto/timerfd doc20150909
Ref: 5bf520150909
Ref: howto/timerfd timer-file-descriptor-howto20150909
Ref: 5bf620150909
Ref: howto/timerfd timerfd-howto20150909
Ref: 5bf720150909
Ref: howto/timerfd translation-repo20150909
Ref: 5bf820150909
Node: 使用例<59>20151111
Ref: howto/timerfd examples20151188
Ref: 5bf920151188
Node: The Python 2 3 Method Resolution Order20159994
Ref: howto/mro doc20160159
Ref: 5bfa20160159
Ref: howto/mro python-2-3-mro20160159
Ref: 16c820160159
Ref: howto/mro the-python-2-3-method-resolution-order20160159
Ref: 5bfb20160159
Ref: howto/mro translation-repo20160159
Ref: 5bfc20160159
Ref: The Python 2 3 Method Resolution Order-Footnote-120161770
Node: The beginning20161817
Ref: howto/mro the-beginning20161944
Ref: 5bfd20161944
Ref: The beginning-Footnote-120166521
Ref: The beginning-Footnote-220166658
Node: The C3 Method Resolution Order20166770
Ref: howto/mro the-c3-method-resolution-order20166919
Ref: 5bfe20166919
Node: 使用例<60>20169251
Ref: howto/mro examples20169415
Ref: 5bff20169415
Node: Bad Method Resolution Orders20174963
Ref: howto/mro bad-method-resolution-orders20175104
Ref: 5c0020175104
Ref: Bad Method Resolution Orders-Footnote-120181352
Node: The end20181536
Ref: howto/mro the-end20181673
Ref: 5c0120181673
Node: Resources20184848
Ref: howto/mro resources20184948
Ref: 5c0220184948
Node: Python support for free threading20184983
Ref: howto/free-threading-python doc20185163
Ref: 5c0320185163
Ref: howto/free-threading-python freethreading-python-howto20185163
Ref: 277420185163
Ref: howto/free-threading-python python-support-for-free-threading20185163
Ref: 5c0420185163
Ref: howto/free-threading-python translation-repo20185163
Ref: 5c0520185163
Ref: Python support for free threading-Footnote-120186468
Node: Installation<2>20186510
Ref: howto/free-threading-python installation20186636
Ref: 5c0720186636
Ref: Installation<2>-Footnote-120187222
Node: Identifying free-threaded Python20187286
Ref: howto/free-threading-python identifying-free-threaded-python20187472
Ref: 5c0820187472
Node: The global interpreter lock in free-threaded Python20188139
Ref: howto/free-threading-python the-global-interpreter-lock-in-free-threaded-python20188323
Ref: 5c0920188323
Node: Thread safety20189073
Ref: howto/free-threading-python thread-safety20189242
Ref: 5c0a20189242
Node: Known limitations20190034
Ref: howto/free-threading-python known-limitations20190170
Ref: 5c0b20190170
Node: Immortalization20190505
Ref: howto/free-threading-python immortalization20190623
Ref: 5c0c20190623
Node: フレーム frame オブジェクト<3>20191150
Ref: howto/free-threading-python frame-objects20191304
Ref: 5c0d20191304
Node: イテレータ iterator<3>20191574
Ref: howto/free-threading-python iterators20191740
Ref: 5c0e20191740
Node: Single-threaded performance20191963
Ref: howto/free-threading-python single-threaded-performance20192080
Ref: 5c0f20192080
Node: Behavioral changes20192465
Ref: howto/free-threading-python behavioral-changes20192579
Ref: 5c1020192579
Node: Context variables20192793
Ref: howto/free-threading-python context-variables20192889
Ref: 5c1120192889
Node: Warning filters20193303
Ref: howto/free-threading-python warning-filters20193430
Ref: 5c1220193430
Node: Increased memory usage20193934
Ref: howto/free-threading-python increased-memory-usage20194035
Ref: 5c1320194035
Node: All interned strings are immortal20194554
Ref: howto/free-threading-python all-interned-strings-are-immortal20194697
Ref: 5c1420194697
Node: Non-GC objects have a larger object header20195171
Ref: howto/free-threading-python non-gc-objects-have-a-larger-object-header20195355
Ref: 5c1520195355
Node: QSBR can delay freeing of memory20195983
Ref: howto/free-threading-python qsbr-can-delay-freeing-of-memory20196164
Ref: 5c1620196164
Node: mimalloc allocator vs pymalloc20197063
Ref: howto/free-threading-python mimalloc-allocator-vs-pymalloc20197267
Ref: 5c1720197267
Node: Free-threaded reference counting can cause objects to live longer20198768
Ref: howto/free-threading-python free-threaded-reference-counting-can-cause-objects-to-live-longer20198995
Ref: 5c1820198995
Ref: Free-threaded reference counting can cause objects to live longer-Footnote-120200712
Node: Per-thread reference counting can delay freeing objects20200754
Ref: howto/free-threading-python per-thread-reference-counting-can-delay-freeing-objects20200942
Ref: 5c1920200942
Node: C API Extension Support for Free Threading20202202
Ref: howto/free-threading-extensions doc20202380
Ref: 5c1a20202380
Ref: howto/free-threading-extensions c-api-extension-support-for-free-threading20202380
Ref: 5c1b20202380
Ref: howto/free-threading-extensions freethreading-extensions-howto20202380
Ref: 5c0620202380
Ref: howto/free-threading-extensions translation-repo20202380
Ref: 5c1c20202380
Node: Identifying the Free-Threaded Build in C20203040
Ref: howto/free-threading-extensions identifying-the-free-threaded-build-in-c20203189
Ref: 5c1d20203189
Node: Module Initialization20203893
Ref: howto/free-threading-extensions module-initialization20204073
Ref: 5c1e20204073
Node: Multi-Phase Initialization20204567
Ref: howto/free-threading-extensions multi-phase-initialization20204687
Ref: 5c1f20204687
Node: Single-Phase Initialization20205360
Ref: howto/free-threading-extensions single-phase-initialization20205480
Ref: 5c2020205480
Node: General API Guidelines20206320
Ref: howto/free-threading-extensions general-api-guidelines20206479
Ref: 5c2120206479
Node: Container Thread Safety20207422
Ref: howto/free-threading-extensions container-thread-safety20207504
Ref: 5c2320207504
Node: PyDict_Next20207839
Ref: howto/free-threading-extensions id120207910
Ref: 5c2420207910
Ref: howto/free-threading-extensions pydict-next20207910
Ref: 5c2520207910
Node: Borrowed References20208398
Ref: howto/free-threading-extensions borrowed-references20208558
Ref: 5c2620208558
Ref: howto/free-threading-extensions id220208613
Ref: 5c2220208613
Ref: Borrowed References-Footnote-120211549
Node: Memory Allocation APIs20211601
Ref: howto/free-threading-extensions free-threaded-memory-allocation20211764
Ref: 594420211764
Ref: howto/free-threading-extensions memory-allocation-apis20211764
Ref: 5c2720211764
Node: Thread State and GIL APIs20212494
Ref: howto/free-threading-extensions thread-state-and-gil-apis20212673
Ref: 5c2820212673
Node: Protecting Internal Extension State20213639
Ref: howto/free-threading-extensions protecting-internal-extension-state20213813
Ref: 5c2920213813
Ref: Protecting Internal Extension State-Footnote-120214569
Node: Critical Sections20214635
Ref: howto/free-threading-extensions critical-sections20214831
Ref: 5c2a20214831
Ref: howto/free-threading-extensions id320214882
Ref: 5c2b20214882
Node: What Are Critical Sections?20215411
Ref: howto/free-threading-extensions what-are-critical-sections20215524
Ref: 5c2c20215524
Node: Using Critical Sections20216001
Ref: howto/free-threading-extensions using-critical-sections20216149
Ref: 5c2d20216149
Node: How Critical Sections Work20217399
Ref: howto/free-threading-extensions how-critical-sections-work20217538
Ref: 5c2e20217538
Node: Deadlock Avoidance20218445
Ref: howto/free-threading-extensions deadlock-avoidance20218585
Ref: 5c2f20218585
Node: Important Considerations20219733
Ref: howto/free-threading-extensions important-considerations20219838
Ref: 5c3020219838
Node: Building Extensions for the Free-Threaded Build20221783
Ref: howto/free-threading-extensions building-extensions-for-the-free-threaded-build20221935
Ref: 5c3120221935
Ref: Building Extensions for the Free-Threaded Build-Footnote-120222531
Ref: Building Extensions for the Free-Threaded Build-Footnote-220222573
Node: Limited C API and Stable ABI20222618
Ref: howto/free-threading-extensions limited-c-api-and-stable-abi20222750
Ref: 5c3220222750
Ref: Limited C API and Stable ABI-Footnote-120223449
Node: Windows<87>20223510
Ref: howto/free-threading-extensions windows20223642
Ref: 5c3320223642
Ref: Windows<87>-Footnote-120223994
Node: Remote debugging attachment protocol20224047
Ref: howto/remote_debugging doc20224215
Ref: 5c3420224215
Ref: howto/remote_debugging remote-debugging20224215
Ref: 4cab20224215
Ref: howto/remote_debugging remote-debugging-attachment-protocol20224215
Ref: 5c3520224215
Ref: howto/remote_debugging translation-repo20224215
Ref: 5c3620224215
Node: Disabling remote debugging20224533
Ref: howto/remote_debugging disabling-remote-debugging20224632
Ref: 5c3720224632
Node: Permission requirements20225041
Ref: howto/remote_debugging id120225199
Ref: 5c3820225199
Ref: howto/remote_debugging permission-requirements20225199
Ref: 5c3920225199
Node: Locating the PyRuntime structure20228864
Ref: howto/remote_debugging locating-the-pyruntime-structure20229010
Ref: 5c3a20229010
Ref: Locating the PyRuntime structure-Footnote-120239053
Ref: Locating the PyRuntime structure-Footnote-220239122
Ref: Locating the PyRuntime structure-Footnote-320239229
Ref: Locating the PyRuntime structure-Footnote-420239325
Node: Reading _Py_DebugOffsets20239420
Ref: howto/remote_debugging reading-py-debugoffsets20239584
Ref: 5c3b20239584
Node: Locating the interpreter and thread state20243388
Ref: howto/remote_debugging locating-the-interpreter-and-thread-state20243547
Ref: 5c3c20243547
Node: Writing control information20248141
Ref: howto/remote_debugging writing-control-information20248283
Ref: 5c3d20248283
Node: Summary20252063
Ref: howto/remote_debugging summary20252189
Ref: 5c3e20252189
Node: Security and threat model20252829
Ref: howto/remote_debugging remote-debugging-threat-model20252919
Ref: 5c3f20252919
Ref: howto/remote_debugging security-and-threat-model20252919
Ref: 5c4020252919
Node: When to use PYTHON_DISABLE_REMOTE_DEBUG20255087
Ref: howto/remote_debugging when-to-use-python-disable-remote-debug20255188
Ref: 5c4120255188
Node: Python よくある質問20257429
Ref: faq/index doc20257537
Ref: 5c4220257537
Ref: faq/index faq-index20257537
Ref: 215020257537
Ref: faq/index python-frequently-asked-questions20257537
Ref: 5c4320257537
Ref: faq/index translation-repo20257537
Ref: 5c4420257537
Node: 一般 Python FAQ20257938
Ref: faq/general doc20258051
Ref: 5c4520258051
Ref: faq/general general-python-faq20258051
Ref: 5c4620258051
Node: 一般情報20258153
Ref: faq/general general-information20258253
Ref: 5c4720258253
Node: Python とは何ですか？20259554
Ref: faq/general what-is-python20259688
Ref: 5c4820259688
Ref: Python とは何ですか？-Footnote-120261165
Node: Python Software Foundation とは何ですか？20261217
Ref: faq/general what-is-the-python-software-foundation20261421
Ref: 5c4920261421
Ref: Python Software Foundation とは何ですか？-Footnote-120262094
Node: Python を使うのに著作権の制限はありますか？20262140
Ref: faq/general are-there-copyright-restrictions-on-the-use-of-python20262372
Ref: 5c4a20262372
Ref: Python を使うのに著作権の制限はありますか？-Footnote-120263419
Ref: Python を使うのに著作権の制限はありますか？-Footnote-220263466
Node: そもそも Python は何故創られたのですか？20263513
Ref: faq/general why-was-python-created-in-the-first-place20263749
Ref: 5c4b20263749
Node: Python は何をするのに向いていますか？20266511
Ref: faq/general what-is-python-good-for20266768
Ref: 5c4c20266768
Ref: Python は何をするのに向いていますか？-Footnote-120267854
Node: Python のバージョン番号の仕組みはどうなっているのですか？20267879
Ref: faq/general faq-version-numbering-scheme20268147
Ref: 5c4d20268147
Ref: faq/general how-does-the-python-version-numbering-scheme-work20268147
Ref: 5c4e20268147
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-120270933
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-220271007
Node: Python のソースのコピーはどこで手に入りますか？20271049
Ref: faq/general how-do-i-obtain-a-copy-of-the-python-source20271329
Ref: 5c4f20271329
Ref: Python のソースのコピーはどこで手に入りますか？-Footnote-120272387
Node: Python のドキュメントはどこで手に入りますか？20272430
Ref: faq/general how-do-i-get-documentation-on-python20272740
Ref: 5c5020272740
Ref: Python のドキュメントはどこで手に入りますか？-Footnote-120273427
Node: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？20273463
Ref: faq/general i-ve-never-programmed-before-is-there-a-python-tutorial20273797
Ref: 5c5120273797
Ref: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？-Footnote-120274365
Node: Python のためのニュースグループやメーリングリストはありますか？20274417
Ref: faq/general is-there-a-newsgroup-or-mailing-list-devoted-to-python20274754
Ref: 5c5220274754
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-120275934
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-220275995
Node: Python のベータテスト版はどこで手に入りますか？20276076
Ref: faq/general how-do-i-get-a-beta-test-version-of-python20276386
Ref: 5c5320276386
Ref: Python のベータテスト版はどこで手に入りますか？-Footnote-120277030
Node: Python のバグ報告やパッチを上げるにはどうしたら良いですか？20277067
Ref: faq/general how-do-i-submit-bug-reports-and-patches-for-python20277359
Ref: 5c5420277359
Ref: Python のバグ報告やパッチを上げるにはどうしたら良いですか？-Footnote-120277812
Node: Python について発行された記事を何か参照できますか？20277849
Ref: faq/general are-there-any-published-articles-about-python-that-i-can-reference20278108
Ref: 5c5520278108
Ref: Python について発行された記事を何か参照できますか？-Footnote-120278680
Node: Python の本はありますか？20278716
Ref: faq/general are-there-any-books-on-python20278947
Ref: 5c5620278947
Node: www python org は世界のどこにあるのですか？20279398
Ref: faq/general where-in-the-world-is-www-python-org-located20279603
Ref: 5c5720279603
Ref: www python org は世界のどこにあるのですか？-Footnote-120279935
Node: なぜ Python という名前なのですか？20279964
Ref: faq/general why-is-it-called-python20280222
Ref: 5c5820280222
Ref: なぜ Python という名前なのですか？-Footnote-120280729
Node: 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？20280780
Ref: faq/general do-i-have-to-like-monty-python-s-flying-circus20280972
Ref: 5c5920280972
Node: 現実世界での Python20281210
Ref: faq/general python-in-the-real-world20281310
Ref: 5c5a20281310
Node: Python はどれくらい安定していますか？20281815
Ref: faq/general how-stable-is-python20281997
Ref: 5c5b20281997
Ref: Python はどれくらい安定していますか？-Footnote-120283311
Ref: Python はどれくらい安定していますか？-Footnote-220283353
Ref: Python はどれくらい安定していますか？-Footnote-320283395
Node: どれくらいの人が Python を使っていますか？20283437
Ref: faq/general how-many-people-are-using-python20283698
Ref: 5c5c20283698
Node: Python で行われた大きなプロジェクトはありますか？20284397
Ref: faq/general have-any-significant-projects-been-done-in-python20284680
Ref: 5c5d20284680
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-120285597
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-220285649
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-320285678
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-420285707
Node: 将来 Python にどのような新しい開発が期待されますか？20285738
Ref: faq/general what-new-developments-are-expected-for-python-in-the-future20286041
Ref: 5c5e20286041
Ref: 将来 Python にどのような新しい開発が期待されますか？-Footnote-120286678
Node: Python の互換性を無くすような提案をしてもいいのですか？20286748
Ref: faq/general is-it-reasonable-to-propose-incompatible-changes-to-python20287051
Ref: 5c5f20287051
Ref: Python の互換性を無くすような提案をしてもいいのですか？-Footnote-120288146
Node: Python は初心者プログラマに向いている言語ですか？20288188
Ref: faq/general is-python-a-good-language-for-beginning-programmers20288408
Ref: 5c6020288408
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-120293090
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-220293141
Node: プログラミング FAQ20293203
Ref: faq/programming doc20293350
Ref: 24a920293350
Ref: faq/programming programming-faq20293350
Ref: 5c6120293350
Ref: faq/programming translation-repo20293350
Ref: 5c6220293350
Node: 一般的な質問20293611
Ref: faq/programming general-questions20293712
Ref: 5c6320293712
Node: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？20294197
Ref: faq/programming is-there-a-source-code-level-debugger-with-breakpoints-and-single-stepping20294456
Ref: 5c6420294456
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-120296287
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-220296331
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-320296384
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-420296430
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-520296479
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-620296518
Ref: ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか？-Footnote-720296548
Node: バグの発見や静的解析に役立つツールはありますか？20296591
Ref: faq/programming are-there-tools-to-help-find-bugs-or-perform-static-analysis20296957
Ref: 5c6520296957
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-120297427
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-220297464
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-320297503
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-420297545
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-520297576
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-620297611
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-720297640
Node: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？20297681
Ref: faq/programming faq-create-standalone-binary20298039
Ref: 5c6620298039
Ref: faq/programming how-can-i-create-a-stand-alone-binary-from-a-python-script20298039
Ref: 5c6720298039
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-120300273
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-220300338
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-320300366
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-420300399
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-520300452
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-620300504
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-720300553
Node: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？20300585
Ref: faq/programming are-there-coding-standards-or-a-style-guide-for-python-programs20300862
Ref: 5c6820300862
Ref: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？-Footnote-120301260
Node: コア言語20301302
Ref: faq/programming core-language20301427
Ref: 5c6920301427
Node: なぜ変数に値があるのに UnboundLocalError が出るのですか？20303243
Ref: faq/programming faq-unboundlocalerror20303453
Ref: 248b20303453
Ref: faq/programming why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value20303453
Ref: 5c6a20303453
Node: Python のローカルとグローバル変数のルールは何ですか？20305647
Ref: faq/programming what-are-the-rules-for-local-and-global-variables-in-python20305974
Ref: 5c6b20305974
Node: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？20307069
Ref: faq/programming why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result20307416
Ref: 5c6c20307416
Node: グローバル変数をモジュール間で共有するにはどうしたらいいですか？20309812
Ref: faq/programming how-do-i-share-global-variables-across-modules20310175
Ref: 5c6d20310175
Node: モジュールで import を使う際の「ベストプラクティス」は何ですか？20311284
Ref: faq/programming what-are-the-best-practices-for-using-import-in-a-module20311620
Ref: 5c6e20311620
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-120315448
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-220315491
Ref: モジュールで import を使う際の「ベストプラクティス」は何ですか？-Footnote-320315534
Node: なぜオブジェクト間でデフォルト値が共有されるのですか？20315575
Ref: faq/programming why-are-default-values-shared-between-objects20315947
Ref: 5c6f20315947
Node: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？20319007
Ref: faq/programming how-can-i-pass-optional-or-keyword-parameters-from-one-function-to-another20319333
Ref: 5c7020319333
Node: 実引数と仮引数の違いは何ですか?20320047
Ref: faq/programming faq-argument-vs-parameter20320367
Ref: 5c7120320367
Ref: faq/programming what-is-the-difference-between-arguments-and-parameters20320367
Ref: 5c7220320367
Node: なぜ list 'y' を変更すると list 'x' も変更されるのですか?20321117
Ref: faq/programming why-did-changing-list-y-also-change-list-x20321382
Ref: 5c7320321382
Node: 出力引数のある関数 参照渡し はどのように書きますか？20325756
Ref: faq/programming how-do-i-write-a-function-with-output-parameters-call-by-reference20326036
Ref: 5c7420326036
Node: Python で高次関数はどのようにつくりますか？20328794
Ref: faq/programming how-do-you-make-a-higher-order-function-in-python20329069
Ref: 5c7520329069
Node: Python のオブジェクトはどのようにコピーしますか？20330967
Ref: faq/programming how-do-i-copy-an-object-in-python20331246
Ref: 5c7620331246
Node: オブジェクトのメソッドや属性はどのように見つけますか？20331830
Ref: faq/programming how-can-i-find-the-methods-or-attributes-of-an-object20332141
Ref: 5c7720332141
Node: どうすればコードにてオブジェクトの名前を得ることができますか？20332539
Ref: faq/programming how-can-my-code-discover-the-name-of-an-object20332837
Ref: 5c7820332837
Node: カンマ演算子はなぜ優先されるのですか？20335045
Ref: faq/programming what-s-up-with-the-comma-operator-s-precedence20335327
Ref: 5c7920335327
Node: C の "? " 三項演算子と等価なものはありますか？20335976
Ref: faq/programming is-there-an-equivalent-of-c-s-ternary-operator20336241
Ref: 5c7a20336241
Node: Python で解し難いワンライナーを書くことはできますか？20337005
Ref: faq/programming is-it-possible-to-write-obfuscated-one-liners-in-python20337297
Ref: 5c7b20337297
Node: 関数の仮引数リストにあるスラッシュ / は何を意味しますか？20338887
Ref: faq/programming faq-positional-only-arguments20339105
Ref: 263520339105
Ref: faq/programming what-does-the-slash-in-the-parameter-list-of-a-function-mean20339105
Ref: 5c7c20339105
Node: 数と文字列20340388
Ref: faq/programming numbers-and-strings20340504
Ref: 5c7d20340504
Node: 十六進数や八進数を指定するにはどうしたらいいですか？20341590
Ref: faq/programming how-do-i-specify-hexadecimal-and-octal-integers20341777
Ref: 5c7e20341777
Node: なぜ -22 // 10 は -3 を返すのですか？20342550
Ref: faq/programming why-does-22-10-return-320342843
Ref: 5c7f20342843
Node: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？20343763
Ref: faq/programming how-do-i-get-int-literal-attribute-instead-of-syntaxerror20344047
Ref: 5c8020344047
Node: 文字列を数に変換するにはどうしたらいいですか？20344702
Ref: faq/programming how-do-i-convert-a-string-to-a-number20345007
Ref: 5c8120345007
Node: 数を文字列に変換するにはどうしたらいいですか？20346691
Ref: faq/programming how-do-i-convert-a-number-to-a-string20346983
Ref: 5c8220346983
Node: 文字列をインプレースに変更するにはどうしたらいいですか？20347735
Ref: faq/programming how-do-i-modify-a-string-in-place20348051
Ref: 5c8320348051
Node: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？20349062
Ref: faq/programming how-do-i-use-strings-to-call-functions-methods20349412
Ref: 5c8420349412
Node: 文字列から後端の改行を取り除く Perl の chomp に相当するものはありますか？20350983
Ref: faq/programming is-there-an-equivalent-to-perl-s-chomp-for-removing-trailing-newlines-from-strings20351287
Ref: 5c8520351287
Node: Is there a scanf or sscanf equivalent?20352102
Ref: faq/programming is-there-a-scanf-or-sscanf-equivalent20352375
Ref: 5c8620352375
Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?20353093
Ref: faq/programming what-does-unicodedecodeerror-or-unicodeencodeerror-error-mean20353352
Ref: 5c8720353352
Node: raw string を奇数個のバックスラッシュで終えることはできますか？20353571
Ref: faq/programming can-i-end-a-raw-string-with-an-odd-number-of-backslashes20353783
Ref: 5c8820353783
Ref: faq/programming faq-programming-raw-string-backslash20353783
Ref: 203b20353783
Node: 性能<4>20355298
Ref: faq/programming performance20355424
Ref: 5c8920355424
Node: プログラムが遅すぎます。どうしたら速くなりますか？20355627
Ref: faq/programming my-program-is-too-slow-how-do-i-speed-it-up20355838
Ref: 5c8a20355838
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-120359279
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-220359306
Node: 多くの文字列を結合するのに最も効率的な方法は何ですか？20359371
Ref: faq/programming efficient-string-concatenation20359582
Ref: 5c8b20359582
Ref: faq/programming what-is-the-most-efficient-way-to-concatenate-many-strings-together20359582
Ref: 5c8c20359582
Node: Sequences tuples/lists20360738
Ref: faq/programming sequences-tuples-lists20360867
Ref: 5c8d20360867
Node: タプル、リスト間の変更はどのようにするのですか？20361783
Ref: faq/programming how-do-i-convert-between-tuples-and-lists20361956
Ref: 5c8e20361956
Node: 負の添え字は何ですか？20363044
Ref: faq/programming what-s-a-negative-index20363313
Ref: 5c8f20363313
Node: シーケンスを逆順にイテレートするにはどうしたらいいですか？20364026
Ref: faq/programming how-do-i-iterate-over-a-sequence-in-reverse-order20364286
Ref: 5c9020364286
Node: リストから重複を取り除くにはどうしますか？20364730
Ref: faq/programming how-do-you-remove-duplicates-from-a-list20365002
Ref: 5c9120365002
Node: How do you remove multiple items from a list?20365963
Ref: faq/programming how-do-you-remove-multiple-items-from-a-list20366200
Ref: 5c9220366200
Node: Python で配列を作るにはどうしますか？20366768
Ref: faq/programming how-do-you-make-an-array-in-python20366999
Ref: 5c9320366999
Ref: Python で配列を作るにはどうしますか？-Footnote-120368256
Node: 多次元のリストを作るにはどうしますか？20368283
Ref: faq/programming faq-multidimensional-list20368571
Ref: 266720368571
Ref: faq/programming how-do-i-create-a-multidimensional-list20368571
Ref: 5c9420368571
Ref: 多次元のリストを作るにはどうしますか？-Footnote-120370110
Node: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？20370137
Ref: faq/programming how-do-i-apply-a-method-or-function-to-a-sequence-of-objects20370464
Ref: 5c9520370464
Node: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?20371109
Ref: faq/programming faq-augmented-assignment-tuple-error20371476
Ref: 246220371476
Ref: faq/programming why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works20371476
Ref: 5c9620371476
Node: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？20375140
Ref: faq/programming i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python20375492
Ref: 5c9720375492
Node: リストを別のリストの値によってソートするにはどうしますか？20376076
Ref: faq/programming how-can-i-sort-one-list-by-values-from-another-list20376328
Ref: 5c9820376328
Node: オブジェクト20376964
Ref: faq/programming objects20377102
Ref: 5c9920377102
Node: クラスとは何ですか？20378807
Ref: faq/programming what-is-a-class20378934
Ref: 5c9a20378934
Node: メソッドとは何ですか？20380000
Ref: faq/programming what-is-a-method20380162
Ref: 5c9b20380162
Node: self とは何ですか？20380547
Ref: faq/programming what-is-self20380829
Ref: 5c9c20380829
Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？20381451
Ref: faq/programming how-do-i-check-if-an-object-is-an-instance-of-a-given-class-or-of-a-subclass-of-it20381727
Ref: 5c9e20381727
Node: 委譲とは何ですか？20384324
Ref: faq/programming what-is-delegation20384715
Ref: 5c9f20384715
Node: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？20387048
Ref: faq/programming how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-extends-it20387376
Ref: 5ca020387376
Node: 基底クラスの名前を変えやすいコードを書くにはどうしますか？20388101
Ref: faq/programming how-can-i-organize-my-code-to-make-it-easier-to-change-the-base-class20388498
Ref: 5ca120388498
Node: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？20389056
Ref: faq/programming how-do-i-create-static-class-data-and-static-class-methods20389429
Ref: 5ca220389429
Node: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？20391402
Ref: faq/programming how-can-i-overload-constructors-or-methods-in-python20391774
Ref: 5ca320391774
Node: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。20392936
Ref: faq/programming i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam20393344
Ref: 5ca420393344
Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。20394699
Ref: faq/programming my-class-defines-del-but-it-is-not-called-when-i-delete-the-object20395095
Ref: 5ca520395095
Node: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？20397418
Ref: faq/programming how-do-i-get-a-list-of-all-instances-of-a-given-class20397796
Ref: 5ca620397796
Node: なぜ id の結果は一意でないように見えるのですか?20398279
Ref: faq/programming why-does-the-result-of-id-appear-to-be-not-unique20398589
Ref: 5ca720398589
Node: いつ is 演算子での同一性テストが頼れますか？20399705
Ref: faq/programming faq-identity-with-is20400039
Ref: 24e020400039
Ref: faq/programming when-can-i-rely-on-identity-tests-with-the-is-operator20400039
Ref: 5ca820400039
Ref: いつ is 演算子での同一性テストが頼れますか？-Footnote-120403920
Node: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？20403962
Ref: faq/programming how-can-a-subclass-control-what-data-is-stored-in-an-immutable-instance20404316
Ref: 5ca920404316
Node: メソッド呼び出しをキャッシュするには どうしたらいいですか？20405979
Ref: faq/programming faq-cache-method-calls20406260
Ref: 2c2b20406260
Ref: faq/programming how-do-i-cache-method-calls20406260
Ref: 5caa20406260
Node: モジュール<5>20409615
Ref: faq/programming modules20409722
Ref: 5cab20409722
Node: pyc ファイルを作るにはどうしますか？20410409
Ref: faq/programming how-do-i-create-a-pyc-file20410588
Ref: 5cac20410588
Ref: pyc ファイルを作るにはどうしますか？-Footnote-120413686
Node: 現在のモジュール名を知るにはどうしますか？20413728
Ref: faq/programming how-do-i-find-the-current-module-name20414012
Ref: 5cad20414012
Node: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？20414776
Ref: faq/programming how-can-i-have-modules-that-mutually-import-each-other20415109
Ref: 5cae20415109
Node: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？20417816
Ref: faq/programming import-x-y-z-returns-module-x-how-do-i-get-z20418227
Ref: 5caf20418227
Node: インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？20418643
Ref: faq/programming when-i-edit-an-imported-module-and-reimport-it-the-changes-don-t-show-up-why-does-this-happen20418949
Ref: 5cb020418949
Node: デザインと歴史 FAQ20420806
Ref: faq/design doc20420964
Ref: 5cb120420964
Ref: faq/design design-and-history-faq20420964
Ref: 5cb220420964
Ref: faq/design translation-repo20420964
Ref: 5cb320420964
Node: Python はなぜ文のグループ化にインデントを使うのですか？20423902
Ref: faq/design why-does-python-use-indentation-for-grouping-of-statements20424121
Ref: 5cb420424121
Node: なぜ単純な算術演算が奇妙な結果になるのですか？20426326
Ref: faq/design why-am-i-getting-strange-results-with-simple-arithmetic-operations20426629
Ref: 5cb520426629
Node: なぜ浮動小数点数の計算はこんなに不正確なんですか？20426805
Ref: faq/design why-are-floating-point-calculations-so-inaccurate20427097
Ref: 5cb620427097
Node: なぜ Python の文字列はイミュータブルなのですか？20429027
Ref: faq/design why-are-python-strings-immutable20429363
Ref: 5cb720429363
Node: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？20430101
Ref: faq/design why-must-self-be-used-explicitly-in-method-definitions-and-calls20430416
Ref: 5cb820430416
Ref: faq/design why-self20430416
Ref: 5c9d20430416
Node: 式中で代入ができないのはなぜですか？20433610
Ref: faq/design id220433981
Ref: 5cb920433981
Ref: faq/design why-can-t-i-use-an-assignment-in-an-expression20433981
Ref: 209420433981
Ref: 式中で代入ができないのはなぜですか？-Footnote-120434377
Node: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？20434419
Ref: faq/design why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list20434784
Ref: 5cba20434784
Node: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？20436482
Ref: faq/design why-is-join-a-string-method-instead-of-a-list-or-tuple-method20436838
Ref: 5cbb20436838
Node: 例外はどれくらい速いのですか？20439163
Ref: faq/design how-fast-are-exceptions20439458
Ref: 5cbc20439458
Node: Python に switch や case 文がないのはなぜですか？20440488
Ref: faq/design why-isn-t-there-a-switch-or-case-statement-in-python20440817
Ref: 5cbd20440817
Node: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？20442526
Ref: faq/design can-t-you-emulate-threads-in-the-interpreter-instead-of-relying-on-an-os-specific-thread-implementation20442877
Ref: 5cbe20442877
Ref: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？-Footnote-120443731
Node: なぜラムダ式は文を含むことができないのですか?20443787
Ref: faq/design why-can-t-lambda-expressions-contain-statements20444166
Ref: 5cbf20444166
Node: Python は C やその他の言語のように機械語にコンパイルできますか？20445203
Ref: faq/design can-python-be-compiled-to-machine-code-c-or-some-other-language20445505
Ref: 5cc020445505
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-120446012
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-220446040
Node: Python はメモリをどのように管理するのですか？20446068
Ref: faq/design how-does-python-manage-memory20446404
Ref: 5cc120446404
Ref: Python はメモリをどのように管理するのですか？-Footnote-120448567
Ref: Python はメモリをどのように管理するのですか？-Footnote-220448598
Node: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？20448623
Ref: faq/design why-doesn-t-cpython-use-a-more-traditional-garbage-collection-scheme20448970
Ref: 5cc220448970
Node: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？20450262
Ref: faq/design why-isn-t-all-memory-freed-when-cpython-exits20450638
Ref: 5cc320450638
Node: なぜタプルとリストという別のデータ型が用意されているのですか？20451648
Ref: faq/design why-are-there-separate-tuple-and-list-data-types20451996
Ref: 5cc420451996
Node: CPythonでリストはどのように実装されているのですか？20453429
Ref: faq/design how-are-lists-implemented-in-cpython20453739
Ref: 5cc520453739
Node: CPythonで辞書はどのように実装されていますか？20454773
Ref: faq/design how-are-dictionaries-implemented-in-cpython20455077
Ref: 5cc620455077
Node: なぜ辞書のキーはイミュータブルでなくてはならないのですか？20456264
Ref: faq/design why-must-dictionary-keys-be-immutable20456572
Ref: 5cc720456572
Node: なぜ list sort はソートされたリストを返さないのですか？20461910
Ref: faq/design why-doesn-t-list-sort-return-the-sorted-list20462251
Ref: 5cc820462251
Node: Python ではどのようにインターフェース仕様を特定し適用するのですか？20463414
Ref: faq/design how-do-you-specify-and-enforce-an-interface-spec-in-python20463704
Ref: 5cc920463704
Node: なぜ goto が無いのですか？20466854
Ref: faq/design why-is-there-no-goto20467170
Ref: 5cca20467170
Node: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？20468577
Ref: faq/design why-can-t-raw-strings-r-strings-end-with-a-backslash20468864
Ref: 5ccb20468864
Node: 属性の代入に "with" 文が使えないのはなぜですか？20470410
Ref: faq/design why-doesn-t-python-have-a-with-statement-for-attribute-assignments20470736
Ref: 5ccc20470736
Node: なぜジェネレータは with 文をサポートしないのですか？20473633
Ref: faq/design why-don-t-generators-support-the-with-statement20473926
Ref: 5ccd20473926
Node: if/while/def/class 文にコロンが必要なのはなぜですか？20474487
Ref: faq/design why-are-colons-required-for-the-if-while-def-class-statements20474810
Ref: 5cce20474810
Node: なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？20475640
Ref: faq/design why-does-python-allow-commas-at-the-end-of-lists-and-tuples20475879
Ref: 5ccf20475879
Node: ライブラリと拡張 FAQ20477316
Ref: faq/library doc20477474
Ref: 5cd020477474
Ref: faq/library library-and-extension-faq20477474
Ref: 5cd120477474
Ref: faq/library translation-repo20477474
Ref: 5cd220477474
Node: ライブラリ一般の質問20477765
Ref: faq/library general-library-questions20477887
Ref: 5cd320477887
Node: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？20478635
Ref: faq/library how-do-i-find-a-module-or-application-to-perform-task-x20478901
Ref: 5cd420478901
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-120479765
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-220479790
Node: math py socket py regex py etc のソースファイルはどこにありますか？20479821
Ref: faq/library where-is-the-math-py-socket-py-regex-py-etc-source-file20480181
Ref: 5cd520480181
Node: Python のスクリプトを Unix で実行可能にするにはどうしますか？20481303
Ref: faq/library how-do-i-make-a-python-script-executable-on-unix20481623
Ref: 5cd620481623
Node: Python には curses/termcap パッケージはありますか？20483583
Ref: faq/library is-there-a-curses-termcap-package-for-python20483887
Ref: 5cd720483887
Ref: Python には curses/termcap パッケージはありますか？-Footnote-120484958
Node: Python には C の onexit に相当するものはありますか？20485018
Ref: faq/library is-there-an-equivalent-to-c-s-onexit-in-python20485306
Ref: 5cd820485306
Node: シグナルハンドラが動かないのですがなぜですか？20485566
Ref: faq/library why-don-t-my-signal-handlers-work20485780
Ref: 5cd920485780
Node: よくある作業20486238
Ref: faq/library common-tasks20486381
Ref: 5cda20486381
Node: Python のプログラムやコンポーネントをテストするにはどうしますか？20486716
Ref: faq/library how-do-i-test-a-python-program-or-component20486977
Ref: 5cdb20486977
Node: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？20489675
Ref: faq/library how-do-i-create-documentation-from-doc-strings20490011
Ref: 5cdc20490011
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-120490573
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-220490613
Node: 一度に一つの押鍵を取得するにはどうしますか？20490648
Ref: faq/library how-do-i-get-a-single-keypress-at-a-time20490881
Ref: 5cdd20490881
Node: スレッド20491194
Ref: faq/library threads20491325
Ref: 5cde20491325
Node: スレッドを使ったプログラムを書くにはどうしますか？20491978
Ref: faq/library how-do-i-program-using-threads20492192
Ref: 5cdf20492192
Node: スレッドが一つも実行されていないようです。なぜですか？20492618
Ref: faq/library none-of-my-threads-seem-to-run-why20492931
Ref: 5ce020492931
Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？20494910
Ref: faq/library how-do-i-parcel-out-work-among-a-bunch-of-worker-threads20495244
Ref: 5ce120495244
Node: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？20498334
Ref: faq/library what-kinds-of-global-value-mutation-are-thread-safe20498705
Ref: 5ce220498705
Node: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？20500646
Ref: faq/library can-t-we-get-rid-of-the-global-interpreter-lock20500918
Ref: 5ce320500918
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-120504834
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-220504876
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-320504919
Node: 入力と出力<2>20504979
Ref: faq/library input-and-output20505153
Ref: 5ce420505153
Node: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問20506151
Ref: faq/library how-do-i-delete-a-file-and-other-file-questions20506369
Ref: 5ce520506369
Node: ファイルをコピーするにはどうしますか？20508112
Ref: faq/library how-do-i-copy-a-file20508408
Ref: 5ce620508408
Ref: ファイルをコピーするにはどうしますか？-Footnote-120509123
Ref: ファイルをコピーするにはどうしますか？-Footnote-220509194
Node: バイナリデータを読み書きするにはどうしますか？20509246
Ref: faq/library how-do-i-read-or-write-binary-data20509556
Ref: 5ce720509556
Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？20511206
Ref: faq/library i-can-t-seem-to-use-os-read-on-a-pipe-created-with-os-popen-why20511535
Ref: 5ce820511535
Node: シリアル RS232 ポートにアクセスするにはどうしますか？20512262
Ref: faq/library how-do-i-access-the-serial-rs232-port20512624
Ref: 5ce920512624
Ref: シリアル RS232 ポートにアクセスするにはどうしますか？-Footnote-120513047
Node: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？20513090
Ref: faq/library why-doesn-t-closing-sys-stdout-stdin-stderr-really-close-it20513332
Ref: 5cea20513332
Node: ネットワーク/インターネットプログラミング20515064
Ref: faq/library network-internet-programming20515244
Ref: 5ceb20515244
Node: Python の WWW ツールには何がありますか？20515796
Ref: faq/library what-www-tools-are-there-for-python20516023
Ref: 5cec20516023
Node: どのモジュールが HTML の生成の役に立ちますか？20516691
Ref: faq/library what-module-should-i-use-to-help-with-generating-html20517003
Ref: 5ced20517003
Ref: どのモジュールが HTML の生成の役に立ちますか？-Footnote-120517282
Node: Python のスクリプトからメールを送るにはどうしますか？20517334
Ref: faq/library how-do-i-send-mail-from-a-python-script20517694
Ref: 5cee20517694
Node: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？20519318
Ref: faq/library how-do-i-avoid-blocking-in-the-connect-method-of-a-socket20519603
Ref: 5cef20519603
Ref: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？-Footnote-120521356
Node: データベース20521385
Ref: faq/library databases20521559
Ref: 5cf020521559
Node: Python にはデータベースパッケージへのインターフェースはありますか？20521805
Ref: faq/library are-there-any-interfaces-to-database-packages-in-python20522048
Ref: 5cf120522048
Ref: Python にはデータベースパッケージへのインターフェースはありますか？-Footnote-120522729
Node: Python で永続的なオブジェクトを実装するにはどうしますか？20522786
Ref: faq/library how-do-you-implement-persistent-objects-in-python20523029
Ref: 5cf220523029
Node: 数学と数20523600
Ref: faq/library mathematics-and-numerics20523704
Ref: 5cf320523704
Node: Python で乱数を生成するにはどうしますか？20523814
Ref: faq/library how-do-i-generate-random-numbers-in-python20523921
Ref: 5cf420523921
Node: 拡張と埋め込み FAQ20525109
Ref: faq/extending doc20525267
Ref: 5cf520525267
Ref: faq/extending extending-embedding-faq20525267
Ref: 5cf620525267
Ref: faq/extending translation-repo20525267
Ref: 5cf720525267
Node: C で独自の関数を作ることはできますか？20527449
Ref: faq/extending can-i-create-my-own-functions-in-c20527634
Ref: 5cf820527634
Node: C++ で独自の関数を作ることはできますか？20528089
Ref: faq/extending id220528351
Ref: 5cf920528351
Node: C を書くのは大変です。他の方法はありませんか？20528827
Ref: faq/extending c-wrapper-software20529103
Ref: 5cfa20529103
Ref: faq/extending writing-c-is-hard-are-there-any-alternatives20529103
Ref: 5cfb20529103
Node: C から任意の Python 文を実行するにはどうしますか？20529485
Ref: faq/extending how-can-i-execute-arbitrary-python-statements-from-c20529773
Ref: 5cfc20529773
Node: C から任意の Python 式を評価するにはどうしますか？20530407
Ref: faq/extending how-can-i-evaluate-an-arbitrary-python-expression-from-c20530709
Ref: 5cfd20530709
Node: Python オブジェクトから C の値を取り出すにはどうしますか？20531059
Ref: faq/extending how-do-i-extract-c-values-from-a-python-object20531365
Ref: 5cfe20531365
Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？20533014
Ref: faq/extending how-do-i-use-py-buildvalue-to-create-a-tuple-of-arbitrary-length20533333
Ref: 5cff20533333
Node: C からオブジェクトのメソッドを呼び出すにはどうしますか？20533570
Ref: faq/extending how-do-i-call-an-object-s-method-from-c20533922
Ref: 5d0020533922
Node: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？20535421
Ref: faq/extending how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr20535793
Ref: 5d0120535793
Node: C から Python で書かれたモジュールにアクセスするにはどうしますか？20537229
Ref: faq/extending how-do-i-access-a-module-written-in-python-from-c20537596
Ref: 5d0220537596
Node: Python から C++ へインターフェースするにはどうしますか？20538759
Ref: faq/extending how-do-i-interface-to-c-objects-from-python20539140
Ref: 5d0320539140
Node: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？20539909
Ref: faq/extending i-added-a-module-using-the-setup-file-and-the-make-fails-why20540250
Ref: 5d0420540250
Node: 拡張をデバッグするにはどうしますか？20540802
Ref: faq/extending how-do-i-debug-an-extension20541217
Ref: 5d0520541217
Node: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？20541879
Ref: faq/extending i-want-to-compile-a-python-module-on-my-linux-system-but-some-files-are-missing-why20542277
Ref: 5d0620542277
Node: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？20542770
Ref: faq/extending how-do-i-tell-incomplete-input-from-invalid-input20543219
Ref: 5d0720543219
Node: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？20544508
Ref: faq/extending how-do-i-find-undefined-g-symbols-builtin-new-or-pure-virtual20544962
Ref: 5d0820544962
Node: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？20545462
Ref: faq/extending can-i-create-an-object-class-with-some-methods-implemented-in-c-and-others-in-python-e-g-through-inheritance20545795
Ref: 5d0920545795
Node: Windows 上の Python FAQ20546446
Ref: faq/windows doc20546631
Ref: 5d0a20546631
Ref: faq/windows python-on-windows-faq20546631
Ref: 5d0b20546631
Ref: faq/windows translation-repo20546631
Ref: 5d0c20546631
Ref: faq/windows windows-faq20546631
Ref: 5d0d20546631
Node: Python プログラムを Windows で動かすにはどうしますか？20547601
Ref: faq/windows faq-run-program-under-windows20547818
Ref: 5d0e20547818
Ref: faq/windows how-do-i-run-a-python-program-under-windows20547818
Ref: 5d0f20547818
Node: Python スクリプトを実行可能にするにはどうしますか？20552368
Ref: faq/windows how-do-i-make-python-scripts-executable20552670
Ref: 5d1020552670
Node: Python の起動に時間がかかることがあるのはなぜですか？20553374
Ref: faq/windows why-does-python-sometimes-take-so-long-to-start20553668
Ref: 5d1120553668
Node: どうすれば Python スクリプトを EXE に出来ますか?20554716
Ref: faq/windows how-do-i-make-an-executable-from-a-python-script20554984
Ref: 5d1220554984
Node: * pyd ファイルは DLL と同じですか？20555314
Ref: faq/windows is-a-pyd-file-the-same-as-a-dll20555603
Ref: 5d1320555603
Node: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？20556867
Ref: faq/windows how-can-i-embed-python-into-a-windows-application20557201
Ref: 5d1420557201
Node: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？20562842
Ref: faq/windows how-do-i-keep-editors-from-inserting-tabs-into-my-python-source20563207
Ref: 5d1520563207
Ref: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？-Footnote-120564521
Node: ブロックすることなく押鍵を検出するにはどうしますか？20564563
Ref: faq/windows how-do-i-check-for-a-keypress-without-blocking20564924
Ref: 5d1620564924
Node: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？20565362
Ref: faq/windows how-do-i-solve-the-missing-api-ms-win-crt-runtime-l1-1-0-dll-error20565604
Ref: 5d1720565604
Ref: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？-Footnote-120566302
Node: グラフィックユーザインターフェース FAQ20566360
Ref: faq/gui doc20566618
Ref: 5d1820566618
Ref: faq/gui graphic-user-interface-faq20566618
Ref: 5d1920566618
Ref: faq/gui translation-repo20566618
Ref: 5d1a20566618
Node: 一般的な GUI の質問20566855
Ref: faq/gui general-gui-questions20567045
Ref: 5d1b20567045
Node: Python の GUI ツールキットには何がありますか？20567107
Ref: faq/gui what-gui-toolkits-exist-for-python20567323
Ref: 5d1c20567323
Ref: Python の GUI ツールキットには何がありますか？-Footnote-120568371
Ref: Python の GUI ツールキットには何がありますか？-Footnote-220568413
Ref: Python の GUI ツールキットには何がありますか？-Footnote-320568440
Ref: Python の GUI ツールキットには何がありますか？-Footnote-420568519
Node: Tkinter の質問20568601
Ref: faq/gui tkinter-questions20568782
Ref: 5d1d20568782
Node: Tkinter アプリケーションを凍結するにはどうしますか？20569083
Ref: faq/gui how-do-i-freeze-tkinter-applications20569288
Ref: 5d1e20569288
Node: I/O を待つ間に扱われる Tk イベントを作れますか？20570061
Ref: faq/gui can-i-have-tk-events-handled-while-waiting-for-i-o20570361
Ref: 5d1f20570361
Node: Tkinter で働くキーバインディングが得られません。なぜですか？20570981
Ref: faq/gui i-can-t-get-key-bindings-to-work-in-tkinter-why20571198
Ref: 5d2020571198
Node: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ20572050
Ref: faq/installed doc20572274
Ref: 5d2120572274
Ref: faq/installed translation-repo20572274
Ref: 5d2220572274
Ref: faq/installed why-is-python-installed-on-my-computer-faq20572274
Ref: 5d2320572274
Node: Python とは何ですか？<2>20572666
Ref: faq/installed what-is-python20572924
Ref: 5d2420572924
Ref: Python とは何ですか？<2>-Footnote-120573562
Node: なぜ Python が私のマシンにインストールされているのですか？20573614
Ref: faq/installed why-is-python-installed-on-my-machine20573924
Ref: 5d2520573924
Node: Python を削除してもいいですか？20575556
Ref: faq/installed can-i-delete-python20575826
Ref: 5d2620575826
Node: 非推奨<14>20576959
Ref: deprecations/index doc20577067
Ref: 5d2720577067
Ref: deprecations/index deprecations20577067
Ref: 5d2820577067
Ref: deprecations/index translation-repo20577067
Ref: 5d2920577067
Node: Pending removal in Python 3 15<7>20577546
Ref: deprecations/index pending-removal-in-python-3-1520577671
Ref: 5d2a20577671
Ref: Pending removal in Python 3 15<7>-Footnote-120581801
Ref: Pending removal in Python 3 15<7>-Footnote-220581856
Ref: Pending removal in Python 3 15<7>-Footnote-320581911
Ref: Pending removal in Python 3 15<7>-Footnote-420581953
Ref: Pending removal in Python 3 15<7>-Footnote-520582009
Node: Pending removal in Python 3 16<7>20582065
Ref: deprecations/index pending-removal-in-python-3-1620582232
Ref: 5d2b20582232
Ref: Pending removal in Python 3 16<7>-Footnote-120586467
Ref: Pending removal in Python 3 16<7>-Footnote-220586523
Ref: Pending removal in Python 3 16<7>-Footnote-320586579
Ref: Pending removal in Python 3 16<7>-Footnote-420586635
Node: Pending removal in Python 3 17<4>20586690
Ref: deprecations/index pending-removal-in-python-3-1720586857
Ref: 5d2c20586857
Ref: Pending removal in Python 3 17<4>-Footnote-120589785
Ref: Pending removal in Python 3 17<4>-Footnote-220589843
Ref: Pending removal in Python 3 17<4>-Footnote-320589898
Ref: Pending removal in Python 3 17<4>-Footnote-420589956
Node: Pending removal in Python 3 18<5>20590011
Ref: deprecations/index pending-removal-in-python-3-1820590178
Ref: 5d2d20590178
Ref: Pending removal in Python 3 18<5>-Footnote-120590598
Node: Pending removal in Python 3 19<3>20590653
Ref: deprecations/index pending-removal-in-python-3-1920590824
Ref: 5d2e20590824
Node: Pending removal in future versions<7>20591096
Ref: deprecations/index pending-removal-in-future-versions20591252
Ref: 5d2f20591252
Ref: Pending removal in future versions<7>-Footnote-120598433
Ref: Pending removal in future versions<7>-Footnote-220598488
Ref: Pending removal in future versions<7>-Footnote-320598544
Ref: Pending removal in future versions<7>-Footnote-420598600
Ref: Pending removal in future versions<7>-Footnote-520598656
Ref: Pending removal in future versions<7>-Footnote-620598711
Ref: Pending removal in future versions<7>-Footnote-720598766
Node: C API deprecations20598822
Ref: deprecations/index c-api-deprecations20598936
Ref: 5d3020598936
Node: Pending removal in Python 3 15<8>20599210
Ref: deprecations/index id120599340
Ref: 5d3120599340
Ref: Pending removal in Python 3 15<8>-Footnote-120605967
Ref: Pending removal in Python 3 15<8>-Footnote-220606020
Node: Pending removal in Python 3 18<6>20606073
Ref: deprecations/index id220606249
Ref: 5d3220606249
Ref: Pending removal in Python 3 18<6>-Footnote-120608920
Ref: Pending removal in Python 3 18<6>-Footnote-220608973
Node: Pending removal in future versions<8>20609029
Ref: deprecations/index id320609163
Ref: 5d3320609163
Node: 用語集<2>20610998
Ref: glossary doc20611117
Ref: 5d3420611117
Ref: glossary glossary20611117
Ref: 201b20611117
Ref: glossary id120611117
Ref: 5d3520611117
Ref: glossary translation-repo20611117
Ref: 5d3620611117
Ref: glossary term-020611141
Ref: 49220611141
Ref: glossary term-20611349
Ref: 49320611349
Ref: glossary term-abstract-base-class20611857
Ref: 13d220611857
Ref: glossary term-annotate-function20612987
Ref: 15e20612987
Ref: glossary term-annotation20613342
Ref: 15d20613342
Ref: glossary term-argument20614194
Ref: 67b20614194
Ref: glossary term-asynchronous-context-manager20615786
Ref: 7f020615786
Ref: glossary term-asynchronous-generator20616095
Ref: 24fb20616095
Ref: glossary term-asynchronous-generator-function20616474
Ref: 5d3820616474
Ref: glossary term-asynchronous-generator-iterator20617002
Ref: 39e020617002
Ref: glossary term-asynchronous-iterable20617868
Ref: f7820617868
Ref: glossary term-asynchronous-iterator20618184
Ref: 4c720618184
Ref: glossary term-atomic-operation20618705
Ref: 278720618705
Ref: glossary term-attached-thread-state20619187
Ref: 525620619187
Ref: glossary term-attribute20620250
Ref: 298220620250
Ref: glossary term-awaitable20620985
Ref: 4c920620985
Ref: glossary term-BDFL20621256
Ref: 5d3920621256
Ref: glossary term-binary-file20621406
Ref: 20ca20621406
Ref: glossary term-borrowed-reference20622079
Ref: 3d520622079
Ref: glossary term-bytes-like-object20622774
Ref: 19420622774
Ref: glossary term-bytecode20624114
Ref: 4aa20624114
Ref: glossary term-callable20625085
Ref: 2df720625085
Ref: glossary term-callback20625479
Ref: 2e1820625479
Ref: glossary term-class20625604
Ref: 1d5b20625604
Ref: glossary term-class-variable20625856
Ref: 5d3a20625856
Ref: glossary term-closure-variable20626078
Ref: 18f620626078
Ref: glossary term-complex-number20627173
Ref: 5d3b20627173
Ref: glossary term-concurrency20627981
Ref: 5d3c20627981
Ref: glossary term-concurrent-modification20628555
Ref: 5d3e20628555
Ref: glossary term-context20628828
Ref: 19c320628828
Ref: glossary term-context-management-protocol20629418
Ref: 19c520629418
Ref: glossary term-context-manager20629593
Ref: 1e320629593
Ref: glossary term-context-variable20629783
Ref: 5d3f20629783
Ref: glossary term-contiguous20630075
Ref: 125220630075
Ref: glossary term-coroutine20630750
Ref: 6b920630750
Ref: glossary term-coroutine-function20631210
Ref: f7720631210
Ref: glossary term-CPython20631589
Ref: 90620631589
Ref: glossary term-current-context20631875
Ref: 19c420631875
Ref: glossary term-cyclic-isolate20632347
Ref: 597220632347
Ref: glossary term-data-race20632675
Ref: 277d20632675
Ref: glossary term-deadlock20633309
Ref: 5d4420633309
Ref: glossary term-decorator20633967
Ref: 93e20633967
Ref: glossary term-descriptor20634767
Ref: 18e520634767
Ref: glossary term-dictionary20635667
Ref: 243520635667
Ref: glossary term-dictionary-comprehension20635873
Ref: 5d4620635873
Ref: glossary term-dictionary-view20636318
Ref: 2a0420636318
Ref: glossary term-docstring20636837
Ref: 234820636837
Ref: glossary term-duck-typing20637234
Ref: 5d3720637234
Ref: glossary term-dunder20638244
Ref: 5d4720638244
Ref: glossary term-EAFP20638434
Ref: 30fa20638434
Ref: glossary term-evaluate-function20639147
Ref: 487520639147
Ref: glossary term-expression20639346
Ref: 242f20639346
Ref: glossary term-extension-module20639904
Ref: 22ad20639904
Ref: glossary term-f-string20640102
Ref: 66b20640102
Ref: glossary term-f-strings20640112
Ref: 5d4920640112
Ref: glossary term-file-object20640300
Ref: 13df20640300
Ref: glossary term-file-like-object20641214
Ref: 181a20641214
Ref: glossary term-filesystem-encoding-and-error-handler20641282
Ref: 75d20641282
Ref: glossary term-finder20642444
Ref: 23c620642444
Ref: glossary term-floor-division20642906
Ref: b4220642906
Ref: glossary term-free-threading20643449
Ref: 1f620643449
Ref: glossary term-free-threaded-build20643744
Ref: 17b020643744
Ref: glossary term-free-variable20643983
Ref: 248820643983
Ref: glossary term-function20644400
Ref: 251720644400
Ref: glossary term-function-annotation20644755
Ref: 207520644755
Ref: glossary term-__future__20645666
Ref: fb120645666
Ref: glossary term-garbage-collection20646463
Ref: 184220646463
Ref: glossary term-generator20646874
Ref: 127020646874
Ref: glossary term-generator-function20647171
Ref: 5d4a20647171
Ref: glossary term-generator-iterator20647531
Ref: ddd20647531
Ref: glossary term-generator-expression20648269
Ref: 5d4b20648269
Ref: glossary term-generic-function20648725
Ref: be820648725
Ref: glossary term-generic-type20649131
Ref: 1a220649131
Ref: glossary term-GIL20649494
Ref: 16520649494
Ref: glossary term-global-interpreter-lock20649572
Ref: 47420649572
Ref: glossary term-global-state20651296
Ref: 5d4c20651296
Ref: glossary term-hash-based-pyc20651653
Ref: 5d4d20651653
Ref: glossary term-hashable20652020
Ref: 82420652020
Ref: glossary term-IDLE20653230
Ref: 5d4e20653230
Ref: glossary term-immortal20653557
Ref: 29220653557
Ref: glossary term-immutable20654073
Ref: 15bd20654073
Ref: glossary term-import-path20654634
Ref: 24aa20654634
Ref: glossary term-importing20654986
Ref: 249c20654986
Ref: glossary term-importer20655137
Ref: 24a820655137
Ref: glossary term-index20655312
Ref: 244320655312
Ref: glossary term-interactive20655751
Ref: 1b720655751
Ref: glossary term-interpreted20656239
Ref: 5d5020656239
Ref: glossary term-interpreter-shutdown20656952
Ref: 47920656952
Ref: glossary term-iterable20657954
Ref: 12f520657954
Ref: glossary term-iterator20659477
Ref: 4c820659477
Ref: glossary term-key20661260
Ref: 244420661260
Ref: glossary term-key-function20661370
Ref: 100a20661370
Ref: glossary term-keyword-argument20662670
Ref: f1220662670
Ref: glossary term-lambda20662746
Ref: 2c2f20662746
Ref: glossary term-LBYL20662996
Ref: 5d4820662996
Ref: glossary term-lexical-analyzer20663835
Ref: 22ee20663835
Ref: glossary term-list20663915
Ref: 5d5120663915
Ref: glossary term-list-comprehension20664099
Ref: 8de20664099
Ref: glossary term-lock20664665
Ref: 277b20664665
Ref: glossary term-lock-free20665473
Ref: 278920665473
Ref: glossary term-loader20666060
Ref: 1a8a20666060
Ref: glossary term-locale-encoding20666436
Ref: 54a20666436
Ref: glossary term-magic-method20666917
Ref: 49ec20666917
Ref: glossary term-mapping20666999
Ref: 13d720666999
Ref: glossary term-meta-path-finder20667480
Ref: 128020667480
Ref: glossary term-metaclass20667830
Ref: 243020667830
Ref: glossary term-method20668888
Ref: 18c920668888
Ref: glossary term-method-resolution-order20669344
Ref: 263e20669344
Ref: glossary term-module20669630
Ref: 1a3d20669630
Ref: glossary term-module-spec20670015
Ref: 23bf20670015
Ref: glossary term-MRO20670274
Ref: 193f20670274
Ref: glossary term-mutable20670353
Ref: 15be20670353
Ref: glossary term-named-tuple20670733
Ref: 85e20670733
Ref: glossary term-namespace20672056
Ref: 209b20672056
Ref: glossary term-namespace-package20672998
Ref: 2b420672998
Ref: glossary term-native-code20673608
Ref: 5d4220673608
Ref: glossary term-nested-scope20673980
Ref: 23ed20673980
Ref: glossary term-new-style-class20674689
Ref: 2d8620674689
Ref: glossary term-non-deterministic20675014
Ref: 5d4020675014
Ref: glossary term-object20675472
Ref: 5d5220675472
Ref: glossary term-optimized-scope20675720
Ref: 4a120675720
Ref: glossary term-optional-module20676251
Ref: 21b420676251
Ref: glossary term-package20676672
Ref: 23520676672
Ref: glossary term-parallelism20677048
Ref: 5d3d20677048
Ref: glossary term-parameter20677571
Ref: 23a720677571
Ref: glossary positional-only-parameter20678142
Ref: c7c20678142
Ref: glossary keyword-only-parameter20678564
Ref: 5a520678564
Ref: glossary term-per-object-lock20680160
Ref: 278220680160
Ref: glossary term-path-entry20680718
Ref: 24b820680718
Ref: glossary term-path-entry-finder20680868
Ref: 128120680868
Ref: glossary term-path-entry-hook20681312
Ref: 24ba20681312
Ref: glossary term-path-based-finder20681513
Ref: 24ad20681513
Ref: glossary term-path-like-object20681671
Ref: 5a120681671
Ref: glossary term-PEP20682467
Ref: 5d5420682467
Ref: glossary term-portion20683242
Ref: 24a320683242
Ref: glossary term-positional-argument20683476
Ref: f1320683476
Ref: glossary term-provisional-API20683571
Ref: 3cf20683571
Ref: glossary term-provisional-package20684700
Ref: 124720684700
Ref: glossary term-Python-300020684786
Ref: 5d5520684786
Ref: glossary term-Pythonic20684995
Ref: 5d5620684995
Ref: glossary term-qualified-name20685695
Ref: 1d8220685695
Ref: glossary term-race-condition20686690
Ref: 277c20686690
Ref: glossary term-reference-count20687328
Ref: 524e20687328
Ref: glossary term-regular-package20688248
Ref: 24a020688248
Ref: glossary term-reentrant20688452
Ref: 5d4520688452
Ref: glossary term-REPL20689381
Ref: 49120689381
Ref: glossary term-__slots__20689513
Ref: 7f720689513
Ref: glossary term-sequence20690044
Ref: 71620690044
Ref: glossary term-set-comprehension20691165
Ref: 5d5720691165
Ref: glossary term-single-dispatch20691602
Ref: be720691602
Ref: glossary term-slice20691733
Ref: 250e20691733
Ref: glossary term-soft-deprecated20692028
Ref: 23f20692028
Ref: glossary term-special-method20692400
Ref: 1cbd20692400
Ref: glossary term-standard-library20692798
Ref: 5d5320692798
Ref: glossary term-statement20693309
Ref: 2c7820693309
Ref: glossary term-static-type-checker20693606
Ref: 57420693606
Ref: glossary term-stdlib20693813
Ref: 17f620693813
Ref: glossary term-strong-reference20693876
Ref: 5e220693876
Ref: glossary term-subscript20694532
Ref: 5d4f20694532
Ref: glossary term-synchronization-primitive20694876
Ref: 5d4120694876
Ref: glossary term-t-string20695590
Ref: 5d5820695590
Ref: glossary term-t-strings20695600
Ref: 5d5920695600
Ref: glossary term-text-encoding20695765
Ref: 263a20695765
Ref: glossary term-text-file20696275
Ref: 20c920696275
Ref: glossary term-thread-state20697058
Ref: 18ab20697058
Ref: glossary term-thread-safe20698080
Ref: 5d4320698080
Ref: glossary term-token20698794
Ref: 22e420698794
Ref: glossary term-triple-quoted-string20699181
Ref: 5d5a20699181
Ref: glossary term-type20699779
Ref: 1d5c20699779
Ref: glossary term-type-alias20700011
Ref: 66e20700011
Ref: glossary term-type-hint20700664
Ref: 242b20700664
Ref: glossary term-universal-newlines20701306
Ref: f3920701306
Ref: glossary term-variable-annotation20701699
Ref: f5520701699
Ref: glossary term-virtual-environment20702690
Ref: 214920702690
Ref: glossary term-virtual-machine20703117
Ref: 3b0420703117
Ref: glossary term-walrus-operator20703374
Ref: 5d5b20703374
Ref: glossary term-Zen-of-Python20703556
Ref: 5d5c20703556
Ref: 用語集<2>-Footnote-120703860
Ref: 用語集<2>-Footnote-220703902
Ref: 用語集<2>-Footnote-320703944
Ref: 用語集<2>-Footnote-420703986
Ref: 用語集<2>-Footnote-520704028
Ref: 用語集<2>-Footnote-620704070
Ref: 用語集<2>-Footnote-720704112
Ref: 用語集<2>-Footnote-820704154
Ref: 用語集<2>-Footnote-920704196
Ref: 用語集<2>-Footnote-1020704238
Ref: 用語集<2>-Footnote-1120704281
Ref: 用語集<2>-Footnote-1220704324
Ref: 用語集<2>-Footnote-1320704363
Ref: 用語集<2>-Footnote-1420704406
Ref: 用語集<2>-Footnote-1520704449
Ref: 用語集<2>-Footnote-1620704492
Ref: 用語集<2>-Footnote-1720704535
Ref: 用語集<2>-Footnote-1820704567
Ref: 用語集<2>-Footnote-1920704610
Ref: 用語集<2>-Footnote-2020704653
Ref: 用語集<2>-Footnote-2120704696
Ref: 用語集<2>-Footnote-2220704739
Ref: 用語集<2>-Footnote-2320704782
Ref: 用語集<2>-Footnote-2420704825
Ref: 用語集<2>-Footnote-2520704868
Ref: 用語集<2>-Footnote-2620704911
Ref: 用語集<2>-Footnote-2720704954
Ref: 用語集<2>-Footnote-2820704997
Ref: 用語集<2>-Footnote-2920705040
Ref: 用語集<2>-Footnote-3020705083
Ref: 用語集<2>-Footnote-3120705126
Ref: 用語集<2>-Footnote-3220705169
Ref: 用語集<2>-Footnote-3320705212
Ref: 用語集<2>-Footnote-3420705255
Ref: 用語集<2>-Footnote-3520705298
Ref: 用語集<2>-Footnote-3620705341
Ref: 用語集<2>-Footnote-3720705401
Ref: 用語集<2>-Footnote-3820705444
Ref: 用語集<2>-Footnote-3920705487
Ref: 用語集<2>-Footnote-4020705530
Ref: 用語集<2>-Footnote-4120705573
Ref: 用語集<2>-Footnote-4220705616
Node: このドキュメントについて20705659
Ref: about doc20705783
Ref: 5d5d20705783
Ref: about about-this-documentation20705783
Ref: 5d5e20705783
Ref: about translation-repo20705783
Ref: 5d5f20705783
Ref: このドキュメントについて-Footnote-120707090
Ref: このドキュメントについて-Footnote-220707126
Ref: このドキュメントについて-Footnote-320707175
Ref: このドキュメントについて-Footnote-420707237
Node: Pythonドキュメントへの貢献者20707278
Ref: about contributors-to-the-python-documentation20707390
Ref: 5d6020707390
Ref: Pythonドキュメントへの貢献者-Footnote-120707868
Node: バグへの対処20707930
Ref: bugs doc20708051
Ref: 5d6120708051
Ref: bugs dealing-with-bugs20708051
Ref: 5d6220708051
Ref: bugs reporting-bugs20708051
Ref: 529e20708051
Ref: bugs translation-repo20708051
Ref: 5d6320708051
Node: ドキュメントの不備20708612
Ref: bugs documentation-bugs20708746
Ref: 5d6520708746
Ref: ドキュメントの不備-Footnote-120709947
Ref: ドキュメントの不備-Footnote-220709996
Ref: ドキュメントの不備-Footnote-320710050
Ref: ドキュメントの不備-Footnote-420710102
Ref: ドキュメントの不備-Footnote-520710188
Ref: ドキュメントの不備-Footnote-620710233
Ref: ドキュメントの不備-Footnote-720710309
Node: Python の課題管理システムを使う20710372
Ref: bugs using-the-python-issue-tracker20710549
Ref: 5d6620710549
Ref: bugs using-the-tracker20710549
Ref: 55720710549
Ref: Python の課題管理システムを使う-Footnote-120713327
Ref: Python の課題管理システムを使う-Footnote-220713390
Node: Python への貢献をはじめる20713458
Ref: bugs contributing-to-python20713599
Ref: 5d6420713599
Ref: bugs getting-started-contributing-to-python-yourself20713599
Ref: 5d6720713599
Ref: Python への貢献をはじめる-Footnote-120714118
Ref: Python への貢献をはじめる-Footnote-220714155
Node: Copyright20714231
Ref: copyright doc20714340
Ref: 5d6820714340
Ref: copyright copyright20714340
Ref: 5d6920714340
Ref: copyright translation-repo20714340
Ref: 5d6a20714340
Node: 歴史とライセンス20714896
Ref: license doc20715014
Ref: 5d6c20715014
Ref: license history-and-license20715014
Ref: 5d6b20715014
Ref: license id120715014
Ref: 5d6d20715014
Ref: license translation-repo20715014
Ref: 5d6e20715014
Node: Python の歴史20715219
Ref: license history-of-the-software20715365
Ref: 5d6f20715365
Node: Terms and conditions for accessing or otherwise using Python20720217
Ref: license terms-and-conditions-for-accessing-or-otherwise-using-python20720427
Ref: 5d7020720427
Node: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 220721497
Ref: license psf-license20721690
Ref: 5d7320721690
Ref: license python-software-foundation-license-version-220721690
Ref: 5d7420721690
Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 020724307
Ref: license beopen-com-license-agreement-for-python-2-020724548
Ref: 5d7520724548
Node: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 120727256
Ref: license cnri-license-agreement-for-python-1-6-120727503
Ref: 5d7620727503
Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 220731681
Ref: license cwi-license-agreement-for-python-0-9-0-through-1-220731945
Ref: 5d7720731945
Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION20733215
Ref: license bsd020733431
Ref: 5d7120733431
Ref: license zero-clause-bsd-license-for-code-in-the-python-documentation20733431
Ref: 5d7820733431
Node: Licenses and Acknowledgements for Incorporated Software20734221
Ref: license licenses-and-acknowledgements-for-incorporated-software20734406
Ref: 5d7920734406
Ref: license otherlicenses20734406
Ref: 5d7220734406
Node: Mersenne Twister20735190
Ref: license mersenne-twister20735322
Ref: 5d7a20735322
Node: ソケット<2>20737641
Ref: license sockets20737810
Ref: 5d7b20737810
Node: Asynchronous socket services20739649
Ref: license asynchronous-socket-services20739819
Ref: 5d7c20739819
Node: Cookie management20741057
Ref: license cookie-management20741229
Ref: 5d7d20741229
Node: Execution tracing20742446
Ref: license execution-tracing20742621
Ref: 5d7e20742621
Node: UUencode and UUdecode functions20743881
Ref: license uuencode-and-uudecode-functions20744065
Ref: 5d7f20744065
Node: XML Remote Procedure Calls20745640
Ref: license xml-remote-procedure-calls20745817
Ref: 5d8020745817
Node: test_epoll20747342
Ref: license test-epoll20747501
Ref: 5d8120747501
Node: Select kqueue20748766
Ref: license select-kqueue20748908
Ref: 5d8220748908
Node: SipHash2420750494
Ref: license siphash2420750641
Ref: 5d8320750641
Node: strtod と dtoa20751820
Ref: license strtod-and-dtoa20751964
Ref: 5d8420751964
Node: OpenSSL<2>20753360
Ref: license openssl20753500
Ref: 5d8520753500
Node: expat20764418
Ref: license expat20764549
Ref: 5d8620764549
Node: libffi20765955
Ref: license libffi20766083
Ref: 5d8720766083
Node: zlib<4>20767464
Ref: license zlib20767594
Ref: 5d8820767594
Node: cfuhash20768827
Ref: license cfuhash20768959
Ref: 5d8920768959
Node: libmpdec20770858
Ref: license libmpdec20771002
Ref: 5d8a20771002
Node: W3C C14N test suite20772612
Ref: license w3c-c14n-test-suite20772757
Ref: 5d8b20772757
Node: mimalloc20774659
Ref: license mimalloc20774807
Ref: 5d8c20774807
Ref: license mimalloc-license20774807
Ref: 65620774807
Node: asyncio<15>20776020
Ref: license asyncio20776179
Ref: 5d8d20776179
Ref: asyncio<15>-Footnote-120777536
Node: Global Unbounded Sequences GUS20777594
Ref: license global-unbounded-sequences-gus20777763
Ref: 5d8e20777763
Ref: Global Unbounded Sequences GUS-Footnote-120779439
Node: Zstandard bindings20779517
Ref: license zstandard-bindings20779666
Ref: 5d8f20779666
Ref: Zstandard bindings-Footnote-120781605
Node: Pythonモジュール索引20781648
Node: 索引20801430
Ref: 60323329907
Ref: 4ade23329908
Ref: library/ctypes audit_event_ctypes_memoryview_at_023329910
Ref: 4ada23329912
Ref: 4adb23329914
Ref: 4ad723329916
Ref: 13b423329918
Ref: using/cmdline audit_event_cpython_run_file_023329920
Ref: 2a7023329922
Ref: 4adc23329924
Ref: 60223329926
Ref: library/stdtypes list insert23329928
Ref: library/stdtypes list append23329930
Ref: 15e123329932
Ref: library/unittest unittest tearDownModule23329934
Ref: 4ae823329936
Ref: 19d823329938
Ref: 1abc23329940
Ref: using/cmdline audit_event_cpython_run_stdin_023329942
Ref: library/sys audit_event_cpython_remote_debugger_script_023329944
Ref: 8dd23329946
Ref: library/sys script_path23329948
Ref: library/stdtypes list extend23329950
Ref: 4ae623329952
Ref: library/_thread start_new_thread23329954
Ref: library/stdtypes list copy23329956
Ref: library/stdtypes list clear23329958
Ref: 4add23329960
Ref: 15e023329962
Ref: library/asyncio audit_event_cpython_run_stdin_223329964
Ref: library/stdtypes tuple count23329966
Ref: library/stdtypes list pop23329968
Ref: library/time audit_event_time_sleep_023329970
Ref: using/cmdline audit_event_cpython_run_stdin_123329972
Ref: 208123329974
Ref: 4adf23329976
Ref: library/stdtypes range index23329978
Ref: library/stdtypes tuple index23329980
Ref: 155223329982
Ref: library/stdtypes list remove23329984

End Tag Table


Local Variables:
coding: utf-8
End:
